update aqua and fluence-js

This commit is contained in:
DieMyst
2021-04-23 17:21:58 +03:00
parent 35498536f4
commit 93a9d0e27d
17 changed files with 432 additions and 188 deletions

View File

@ -1,3 +1,10 @@
/**
*
* This file is auto-generated. Do not edit manually: changes may be erased.
* Generated by Aqua compiler: https://github.com/fluencelabs/aqua/.
* If you find any bugs, please write an issue on GitHub: https://github.com/fluencelabs/aqua/issues
*
*/
import { FluenceClient, PeerIdB58 } from '@fluencelabs/fluence';
import { RequestFlowBuilder } from '@fluencelabs/fluence/dist/api.unstable';
@ -7,14 +14,15 @@ export async function helloWorld(client: FluenceClient, name: string): Promise<s
let request;
const promise = new Promise<string>((resolve, reject) => {
request = new RequestFlowBuilder()
.disableInjections()
.withRawScript(
`
(xor
(seq
(seq
(seq
(call %init_peer_id% ("getDataSrv" "name") [] name)
(call %init_peer_id% ("getDataSrv" "relay") [] relay)
(call %init_peer_id% ("getDataSrv" "name") [] name)
)
(call %init_peer_id% ("service-id" "addNameToHello") [name] res)
)
@ -27,18 +35,18 @@ export async function helloWorld(client: FluenceClient, name: string): Promise<s
)
.configHandler((h) => {
h.on('getDataSrv', 'relay', () => {
return client.relayPeerId;
return client.relayPeerId!;
});
h.on('getRelayService', 'hasReleay', () => {// Not Used
return client.relayPeerId !== undefined;
});
h.on('getDataSrv', 'name', () => {return name;});
h.on('callbackSrv', 'response', (args) => {
h.onEvent('callbackSrv', 'response', (args) => {
const [res] = args;
resolve(res);
});
h.on('errorHandlingSrv', 'error', (args) => {
h.onEvent('errorHandlingSrv', 'error', (args) => {
// assuming error is the single argument
const [err] = args;
reject(err);
@ -46,7 +54,7 @@ export async function helloWorld(client: FluenceClient, name: string): Promise<s
})
.handleScriptError(reject)
.handleTimeout(() => {
reject('Request timed out');
reject('Request timed out for helloWorld');
})
.build();
});