-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathquickstart.ts
More file actions
35 lines (26 loc) · 834 Bytes
/
quickstart.ts
File metadata and controls
35 lines (26 loc) · 834 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import { BasicClient } from "../build";
import { ClientConfigBuilder } from "@polywrap/client-config-builder-js";
import { Uri } from "@polywrap/core-js";
export function instantiate(): BasicClient {
// $start: quickstart-instantiate
const config = new ClientConfigBuilder().addDefaults().build();
const client = new BasicClient(config);
// $end
return client;
}
export async function invoke(): Promise<any> {
const config = new ClientConfigBuilder().addDefaults().build();
const client = new BasicClient(config);
// $start: quickstart-invoke
const result = await client.invoke({
uri: Uri.from("wrapscan.io/polywrap/logging@1.0"),
method: "info",
args: {
message: "Hello World!",
},
});
if (!result.ok) throw result.error;
const value = result.value;
// $end
return value;
}