mirror of
https://github.com/fluencelabs/aqua-playground
synced 2025-04-25 18:02:33 +00:00
207 lines
6.4 KiB
TypeScript
207 lines
6.4 KiB
TypeScript
/* eslint-disable */
|
|
// @ts-nocheck
|
|
/**
|
|
*
|
|
* 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
|
|
* Aqua version: 0.9.4
|
|
*
|
|
*/
|
|
import type { IFluenceClient as IFluenceClient$$, CallParams as CallParams$$ } from '@fluencelabs/js-client.api';
|
|
import {
|
|
v5_callFunction as callFunction$$,
|
|
v5_registerService as registerService$$,
|
|
} from '@fluencelabs/js-client.api';
|
|
|
|
|
|
|
|
// Services
|
|
|
|
// Functions
|
|
|
|
|
|
export function test1(
|
|
config?: {ttl?: number}
|
|
): Promise<number>;
|
|
|
|
export function test1(
|
|
peer: IFluenceClient$$,
|
|
config?: {ttl?: number}
|
|
): Promise<number>;
|
|
|
|
export function test1(...args: any) {
|
|
|
|
let script = `
|
|
(xor
|
|
(seq
|
|
(seq
|
|
(seq
|
|
(seq
|
|
(call %init_peer_id% ("getDataSrv" "-relay-") [] -relay-)
|
|
(par
|
|
(seq
|
|
(par
|
|
(call %init_peer_id% ("math" "add") [1 2] add-0)
|
|
(call %init_peer_id% ("math" "mul") [3 5] mul)
|
|
)
|
|
(call %init_peer_id% ("math" "sub") [add-0 mul] sub-0)
|
|
)
|
|
(seq
|
|
(call %init_peer_id% ("math" "mul") [2 3] mul-0)
|
|
(call %init_peer_id% ("math" "div") [mul-0 2] div)
|
|
)
|
|
)
|
|
)
|
|
(call %init_peer_id% ("math" "sub") [sub-0 div] sub)
|
|
)
|
|
(call %init_peer_id% ("math" "add") [sub 5] add)
|
|
)
|
|
(xor
|
|
(call %init_peer_id% ("callbackSrv" "response") [add])
|
|
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 1])
|
|
)
|
|
)
|
|
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 2])
|
|
)
|
|
`
|
|
return callFunction$$(
|
|
args,
|
|
{
|
|
"functionName" : "test1",
|
|
"arrow" : {
|
|
"tag" : "arrow",
|
|
"domain" : {
|
|
"tag" : "labeledProduct",
|
|
"fields" : {
|
|
|
|
}
|
|
},
|
|
"codomain" : {
|
|
"tag" : "unlabeledProduct",
|
|
"items" : [
|
|
{
|
|
"tag" : "scalar",
|
|
"name" : "u64"
|
|
}
|
|
]
|
|
}
|
|
},
|
|
"names" : {
|
|
"relay" : "-relay-",
|
|
"getDataSrv" : "getDataSrv",
|
|
"callbackSrv" : "callbackSrv",
|
|
"responseSrv" : "callbackSrv",
|
|
"responseFnName" : "response",
|
|
"errorHandlingSrv" : "errorHandlingSrv",
|
|
"errorFnName" : "error"
|
|
}
|
|
},
|
|
script
|
|
)
|
|
}
|
|
|
|
|
|
|
|
export function test2(
|
|
config?: {ttl?: number}
|
|
): Promise<number>;
|
|
|
|
export function test2(
|
|
peer: IFluenceClient$$,
|
|
config?: {ttl?: number}
|
|
): Promise<number>;
|
|
|
|
export function test2(...args: any) {
|
|
|
|
let script = `
|
|
(xor
|
|
(seq
|
|
(seq
|
|
(seq
|
|
(call %init_peer_id% ("getDataSrv" "-relay-") [] -relay-)
|
|
(par
|
|
(seq
|
|
(seq
|
|
(par
|
|
(seq
|
|
(par
|
|
(seq
|
|
(seq
|
|
(seq
|
|
(seq
|
|
(call %init_peer_id% ("math" "mul") [2 2] mul)
|
|
(call %init_peer_id% ("math" "sub") [mul 2] sub-1)
|
|
)
|
|
(call %init_peer_id% ("math" "pow") [2 sub-1] pow-0)
|
|
)
|
|
(call %init_peer_id% ("math" "pow") [2 pow-0] pow)
|
|
)
|
|
(call %init_peer_id% ("math" "add") [pow 2] add-1)
|
|
)
|
|
(call %init_peer_id% ("math" "mul") [3 5] mul-0)
|
|
)
|
|
(call %init_peer_id% ("math" "sub") [add-1 mul-0] sub-0)
|
|
)
|
|
(seq
|
|
(call %init_peer_id% ("math" "mul") [2 3] mul-1)
|
|
(call %init_peer_id% ("math" "div") [mul-1 2] div)
|
|
)
|
|
)
|
|
(call %init_peer_id% ("math" "sub") [sub-0 div] sub)
|
|
)
|
|
(call %init_peer_id% ("math" "add") [sub 5] add-0)
|
|
)
|
|
(seq
|
|
(call %init_peer_id% ("math" "rem") [4 2] rem)
|
|
(call %init_peer_id% ("math" "sub") [rem 2] sub-2)
|
|
)
|
|
)
|
|
)
|
|
(call %init_peer_id% ("math" "add") [add-0 sub-2] add)
|
|
)
|
|
(xor
|
|
(call %init_peer_id% ("callbackSrv" "response") [add])
|
|
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 1])
|
|
)
|
|
)
|
|
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 2])
|
|
)
|
|
`
|
|
return callFunction$$(
|
|
args,
|
|
{
|
|
"functionName" : "test2",
|
|
"arrow" : {
|
|
"tag" : "arrow",
|
|
"domain" : {
|
|
"tag" : "labeledProduct",
|
|
"fields" : {
|
|
|
|
}
|
|
},
|
|
"codomain" : {
|
|
"tag" : "unlabeledProduct",
|
|
"items" : [
|
|
{
|
|
"tag" : "scalar",
|
|
"name" : "u64"
|
|
}
|
|
]
|
|
}
|
|
},
|
|
"names" : {
|
|
"relay" : "-relay-",
|
|
"getDataSrv" : "getDataSrv",
|
|
"callbackSrv" : "callbackSrv",
|
|
"responseSrv" : "callbackSrv",
|
|
"responseFnName" : "response",
|
|
"errorHandlingSrv" : "errorHandlingSrv",
|
|
"errorFnName" : "error"
|
|
}
|
|
},
|
|
script
|
|
)
|
|
}
|
|
|
|
/* eslint-enable */ |