everything seems working

This commit is contained in:
DieMyst
2021-04-15 11:51:02 +03:00
parent 8978b75bbf
commit 598961c6ca
8 changed files with 17 additions and 11 deletions

6
package-lock.json generated
View File

@ -5,9 +5,9 @@
"requires": true, "requires": true,
"dependencies": { "dependencies": {
"@fluencelabs/aqua-cli": { "@fluencelabs/aqua-cli": {
"version": "0.1.1-74", "version": "0.1.1-76",
"resolved": "https://registry.npmjs.org/@fluencelabs/aqua-cli/-/aqua-cli-0.1.1-74.tgz", "resolved": "https://registry.npmjs.org/@fluencelabs/aqua-cli/-/aqua-cli-0.1.1-76.tgz",
"integrity": "sha512-AfABW9Zgor09SViOvY75kbBuwaLrUHNm9ucXg5ufw7rGBbpBtZFx3m6senAlzNyXmcEr4gyhrheYrYXqYmw5pQ==", "integrity": "sha512-4W3onIa1SSb2L2h9+1K3LyOtDyllpiH60XeBBZoUT0VrYvfIg1+QyJ+QOwbVp1PYLgEhxvzt9Ni+zdUnWErxFg==",
"dev": true "dev": true
}, },
"@fluencelabs/aquamarine-interpreter": { "@fluencelabs/aquamarine-interpreter": {

View File

@ -21,7 +21,7 @@
"compile-aqua": "aqua-cli -i ./src/aqua/ -o ./src/compiled" "compile-aqua": "aqua-cli -i ./src/aqua/ -o ./src/compiled"
}, },
"devDependencies": { "devDependencies": {
"@fluencelabs/aqua-cli": "^0.1.1-74", "@fluencelabs/aqua-cli": "^0.1.1-76",
"ts-node": "^9.1.1", "ts-node": "^9.1.1",
"typescript": "^4.2.4" "typescript": "^4.2.4"
}, },

View File

@ -9,5 +9,5 @@ func iterateAndPrint(strings: []string):
func iterateAndPrintParallel(nodes: []string, c: ExternalAddresses -> ()): func iterateAndPrintParallel(nodes: []string, c: ExternalAddresses -> ()):
for s <- nodes par: for s <- nodes par:
on s: on s:
ads <- Peer.identify ads <- Peer.identify()
c(ads) c(ads)

View File

@ -6,6 +6,6 @@ service ParAbb("parabb"):
func parFunc( node: string, c: ExternalAddresses -> () ): func parFunc( node: string, c: ExternalAddresses -> () ):
y <- ParAbb.call() y <- ParAbb.call()
par on node: par on node:
t <- Peer.identify t <- Peer.identify()
c(t) c(t)
par x <- ParAbb.call() par x <- ParAbb.call()

View File

@ -41,6 +41,6 @@ export async function id(client: FluenceClient): Promise<void> {
.build(); .build();
}); });
await client.initiateFlow(request); await client.initiateFlow(request);
return promise; return Promise.race([promise, Promise.resolve()]);
} }

View File

@ -2,6 +2,8 @@
import {iterateAndPrint, iterateAndPrintParallel} from "./compiled/fold"; import {iterateAndPrint, iterateAndPrintParallel} from "./compiled/fold";
export async function foldCall(client: FluenceClient) { export async function foldCall(client: FluenceClient) {
await iterateAndPrint(client, ["1", "2", "3"]) await iterateAndPrint(client, [client.relayPeerId!])
await iterateAndPrintParallel(client, ["4", "5", "6"]) await iterateAndPrintParallel(client, [client.relayPeerId!], (c) => {
console.log("iterateAndPrintParallel. external addresses: " + c.external_addresses)
})
} }

View File

@ -1,6 +1,6 @@
#!/usr/bin/env node #!/usr/bin/env node
import {createClient, registerServiceFunction, SecurityTetraplet} from "@fluencelabs/fluence"; import {createClient, registerServiceFunction} from "@fluencelabs/fluence";
import { testNet } from "@fluencelabs/fluence-network-environment"; import { testNet } from "@fluencelabs/fluence-network-environment";
import {callArrowCall} from "./callArrowCall"; import {callArrowCall} from "./callArrowCall";
import {dataAliasCall} from "./dataAliasCall"; import {dataAliasCall} from "./dataAliasCall";
@ -20,6 +20,8 @@ const main = async () => {
return {} return {}
}) })
// 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 callArrowCall(client)
await foldCall(client) await foldCall(client)
await ifCall(client) await ifCall(client)

View File

@ -6,5 +6,7 @@ export async function parCall(client: FluenceClient) {
return `hello` return `hello`
}) })
await parFunc(client, client.relayPeerId!) await parFunc(client, client.relayPeerId!, (c) => {
console.log("parFunc. external addresses par: " + c.external_addresses)
})
} }