aqua-playground/src/index.ts

41 lines
1.1 KiB
TypeScript
Raw Normal View History

2021-04-12 02:07:18 +03:00
#!/usr/bin/env node
2021-04-15 11:51:02 +03:00
import {createClient, registerServiceFunction} from "@fluencelabs/fluence";
2021-04-12 02:07:18 +03:00
import { testNet } from "@fluencelabs/fluence-network-environment";
2021-04-14 02:38:35 +03:00
import {callArrowCall} from "./callArrowCall";
import {dataAliasCall} from "./dataAliasCall";
import {onCall} from "./onCall";
import {funcCall} from "./funcCall";
import {helloWorldCall} from "./helloWorldCall";
2021-04-14 03:35:10 +03:00
import {foldCall} from "./foldCall";
import {ifCall} from "./if";
import {parCall} from "./parCall";
import {complexCall} from "./complex";
2021-04-12 02:07:18 +03:00
const main = async () => {
const client = await createClient(testNet[0]);
registerServiceFunction(client, "println", "print", (args: any[], _) => {
console.log("println: " + args[0])
return {}
})
2021-04-15 11:51:02 +03:00
// these calls return void, so they could be executed at any time,
// because promise waits only a fact that particle was sent
await callArrowCall(client)
await foldCall(client)
await ifCall(client)
await parCall(client)
2021-04-14 03:35:10 +03:00
2021-04-14 02:38:35 +03:00
await helloWorldCall(client)
await funcCall(client)
await onCall(client)
await dataAliasCall(client)
await complexCall(client)
2021-04-14 02:38:35 +03:00
client.disconnect();
process.exit(0)
2021-04-12 02:07:18 +03:00
};
main();