mirror of
https://github.com/fluencelabs/aqua-playground
synced 2025-04-24 16:22:33 +00:00
Add ephemeral networks support (#17)
This commit is contained in:
parent
589acde2e2
commit
ec1d7b7f7a
3
.gitignore
vendored
3
.gitignore
vendored
@ -106,4 +106,5 @@ dist
|
||||
.idea/
|
||||
lib/
|
||||
|
||||
.jar
|
||||
.jar
|
||||
|
||||
|
6007
package-lock.json
generated
6007
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -34,13 +34,14 @@
|
||||
"@fluencelabs/aqua-lib": "0.4.3",
|
||||
"@types/jest": "^27.0.2",
|
||||
"jest": "^27.2.4",
|
||||
"js-base64": "^3.7.2",
|
||||
"ts-jest": "^27.0.5",
|
||||
"ts-node": "^9.1.1",
|
||||
"typescript": "^4.2.4"
|
||||
},
|
||||
"dependencies": {
|
||||
"@fluencelabs/aqua-dht-ts": "0.1.38" ,
|
||||
"@fluencelabs/fluence": "0.23.0",
|
||||
"@fluencelabs/aqua-dht-ts": "0.1.38",
|
||||
"@fluencelabs/fluence": "0.23.4",
|
||||
"@fluencelabs/fluence-network-environment": "1.0.13",
|
||||
"deep-equal": "^2.0.5"
|
||||
},
|
||||
|
@ -1,26 +1,27 @@
|
||||
import {Fluence, FluencePeer, setLogLevel} from '@fluencelabs/fluence';
|
||||
import { Fluence, FluencePeer, KeyPair, setLogLevel } from '@fluencelabs/fluence';
|
||||
import { EphemeralNetwork, defaultConfig } from '@fluencelabs/fluence/dist/internal/ephemeral';
|
||||
import { registerPrintln } from '../compiled/examples/println';
|
||||
import {callArrowCall, reproArgsBug426Call} from '../examples/callArrowCall';
|
||||
import { callArrowCall, reproArgsBug426Call } from '../examples/callArrowCall';
|
||||
import { dataAliasCall } from '../examples/dataAliasCall';
|
||||
import { onCall } from '../examples/onCall';
|
||||
import { funcCall } from '../examples/funcCall';
|
||||
import { helloWorldCall } from '../examples/helloWorldCall';
|
||||
import {foldBug499Call, foldCall} from '../examples/foldCall';
|
||||
import {bugNG69Call, ifCall, ifWrapCall} from '../examples/ifCall';
|
||||
import {parCall, testTimeoutCall} from '../examples/parCall';
|
||||
import { foldBug499Call, foldCall } from '../examples/foldCall';
|
||||
import { bugNG69Call, ifCall, ifWrapCall } from '../examples/ifCall';
|
||||
import { parCall, testTimeoutCall } from '../examples/parCall';
|
||||
import { complexCall } from '../examples/complex';
|
||||
import {constantsCall, particleTtlAndTimestampCall} from '../examples/constantsCall';
|
||||
import { constantsCall, particleTtlAndTimestampCall } from '../examples/constantsCall';
|
||||
import { returnNilCall, returnNoneCall, streamCall } from '../examples/streamCall';
|
||||
import {topologyBug205Call, topologyBug394Call, topologyBug427Call, topologyCall} from '../examples/topologyCall';
|
||||
import { topologyBug205Call, topologyBug394Call, topologyBug427Call, topologyCall } from '../examples/topologyCall';
|
||||
import { foldJoinCall } from '../examples/foldJoinCall';
|
||||
import { registerHandlers, returnNull, returnOptionalCall, useOptionalCall } from '../examples/useOptionalCall';
|
||||
import {viaArrCall, viaOptCall, viaOptNullCall, viaStreamCall} from '../examples/viaCall';
|
||||
import { viaArrCall, viaOptCall, viaOptNullCall, viaStreamCall } from '../examples/viaCall';
|
||||
import { nestedFuncsCall } from '../examples/nestedFuncsCall';
|
||||
import { assignmentCall } from '../examples/assignment';
|
||||
import { tryCatchCall } from '../examples/tryCatchCall';
|
||||
import { tryOtherwiseCall } from '../examples/tryOtherwiseCall';
|
||||
import { coCall } from '../examples/coCall';
|
||||
import {bugLNG60Call, passArgsCall} from '../examples/passArgsCall';
|
||||
import { bugLNG60Call, passArgsCall } from '../examples/passArgsCall';
|
||||
import { streamArgsCall } from '../examples/streamArgsCall';
|
||||
import { streamResultsCall } from '../examples/streamResultsCall';
|
||||
import { pushToStreamCall } from '../examples/pushToStreamCall';
|
||||
@ -28,40 +29,84 @@ import { literalCall } from '../examples/returnLiteralCall';
|
||||
import { multiReturnCall } from '../examples/multiReturnCall';
|
||||
import { declareCall } from '../examples/declareCall';
|
||||
import { genOptions } from '../examples/optionsCall';
|
||||
import { config } from '../config';
|
||||
import {closuresCall} from "../examples/closures";
|
||||
import {bugLNG63_2Call, bugLNG63_3Call, bugLNG63Call, streamCanCall} from "../examples/streamCanCall";
|
||||
import {streamCallbackCall} from "../examples/streamCallback";
|
||||
import {streamResCall} from "../examples/streamRestrictionsCall";
|
||||
import {joinIdxCall, joinIdxLocalCall, joinIdxRelayCall} from "../examples/joinCall";
|
||||
import {recursiveStreamsCall} from "../examples/recursiveStreamsCall";
|
||||
import { closuresCall } from '../examples/closures';
|
||||
import { bugLNG63_2Call, bugLNG63_3Call, bugLNG63Call, streamCanCall } from '../examples/streamCanCall';
|
||||
import { streamCallbackCall } from '../examples/streamCallback';
|
||||
import { streamResCall } from '../examples/streamRestrictionsCall';
|
||||
import { joinIdxCall, joinIdxLocalCall, joinIdxRelayCall } from '../examples/joinCall';
|
||||
import { recursiveStreamsCall } from '../examples/recursiveStreamsCall';
|
||||
import {
|
||||
allEmptySugarCall,
|
||||
arraySugarCall,
|
||||
bugLNG59Call,
|
||||
optionSugarCall,
|
||||
streamSugarCall
|
||||
} from "../examples/collectionSugarCall";
|
||||
import {funcsCall} from "../examples/funcsCall";
|
||||
import {nestedDataCall} from "../examples/nestedDataCall";
|
||||
import {mathTest1Call, mathTest2Call} from "../examples/mathCall";
|
||||
import {lng58Bug} from "../compiled/examples/closures";
|
||||
streamSugarCall,
|
||||
} from '../examples/collectionSugarCall';
|
||||
import { funcsCall } from '../examples/funcsCall';
|
||||
import { nestedDataCall } from '../examples/nestedDataCall';
|
||||
import { mathTest1Call, mathTest2Call } from '../examples/mathCall';
|
||||
import { lng58Bug } from '../compiled/examples/closures';
|
||||
import { config, isEphemeral } from '../config';
|
||||
|
||||
var selfPeerId: string;
|
||||
var peer2: FluencePeer;
|
||||
|
||||
|
||||
const relays = config.relays
|
||||
var ephemeralNetwork: EphemeralNetwork;
|
||||
|
||||
// setLogLevel('debug');
|
||||
|
||||
async function startEphemeral() {
|
||||
ephemeralNetwork = new EphemeralNetwork(defaultConfig);
|
||||
await ephemeralNetwork.up();
|
||||
|
||||
const defaultPeer = Fluence.getPeer();
|
||||
await defaultPeer.init({
|
||||
KeyPair: await KeyPair.randomEd25519(),
|
||||
});
|
||||
const conn = ephemeralNetwork.getRelayConnection(config.relays[0].peerId, defaultPeer);
|
||||
await defaultPeer.connect(conn);
|
||||
selfPeerId = defaultPeer.getStatus().peerId;
|
||||
|
||||
peer2 = new FluencePeer();
|
||||
await peer2.init({
|
||||
KeyPair: await KeyPair.randomEd25519(),
|
||||
});
|
||||
const conn2 = ephemeralNetwork.getRelayConnection(config.relays[1].peerId, peer2);
|
||||
await peer2.connect(conn2);
|
||||
}
|
||||
|
||||
async function stopEphemeral() {
|
||||
if (ephemeralNetwork) {
|
||||
await ephemeralNetwork.down();
|
||||
}
|
||||
|
||||
await Fluence.stop();
|
||||
if (peer2) {
|
||||
await peer2.stop();
|
||||
}
|
||||
}
|
||||
|
||||
async function start() {
|
||||
await Fluence.start({ connectTo: config.relays[0] });
|
||||
selfPeerId = Fluence.getStatus().peerId;
|
||||
|
||||
peer2 = new FluencePeer();
|
||||
await peer2.start({ connectTo: config.relays[1] });
|
||||
}
|
||||
|
||||
async function stop() {
|
||||
if (peer2) {
|
||||
Fluence.stop();
|
||||
await peer2.stop();
|
||||
}
|
||||
}
|
||||
|
||||
describe('Testing examples', () => {
|
||||
beforeAll(async () => {
|
||||
await Fluence.start({ connectTo: relays[0] });
|
||||
selfPeerId = Fluence.getStatus().peerId;
|
||||
|
||||
peer2 = new FluencePeer();
|
||||
await peer2.start({ connectTo: relays[1] });
|
||||
if (isEphemeral) {
|
||||
await startEphemeral();
|
||||
} else {
|
||||
await start();
|
||||
}
|
||||
|
||||
// this could be called from `println.aqua`
|
||||
registerPrintln({
|
||||
@ -72,9 +117,10 @@ describe('Testing examples', () => {
|
||||
});
|
||||
|
||||
afterAll(async () => {
|
||||
if (peer2) {
|
||||
Fluence.stop();
|
||||
await peer2.stop();
|
||||
if (isEphemeral) {
|
||||
await stopEphemeral();
|
||||
} else {
|
||||
await stop();
|
||||
}
|
||||
});
|
||||
|
||||
@ -87,13 +133,13 @@ describe('Testing examples', () => {
|
||||
it('callArrow.aqua args bug 426', async () => {
|
||||
let argResult = await reproArgsBug426Call();
|
||||
|
||||
expect(argResult).toBe("privet");
|
||||
expect(argResult).toBe('privet');
|
||||
});
|
||||
|
||||
it('streamRestrictions.aqua', async () => {
|
||||
let streamResResult = await streamResCall();
|
||||
|
||||
expect(streamResResult).toEqual([[], ["a", "b", "c"]]);
|
||||
expect(streamResResult).toEqual([[], ['a', 'b', 'c']]);
|
||||
});
|
||||
|
||||
it('fold.aqua', async () => {
|
||||
@ -102,7 +148,7 @@ describe('Testing examples', () => {
|
||||
});
|
||||
|
||||
it('fold.aqua bug #499', async () => {
|
||||
let foldCallResult = await foldBug499Call()
|
||||
let foldCallResult = await foldBug499Call();
|
||||
expect(foldCallResult).toEqual([5]);
|
||||
});
|
||||
|
||||
@ -152,20 +198,7 @@ describe('Testing examples', () => {
|
||||
|
||||
it('complex.aqua', async () => {
|
||||
let complexCallResult = await complexCall();
|
||||
expect(complexCallResult).toEqual([
|
||||
'some str',
|
||||
'3',
|
||||
'1',
|
||||
'4',
|
||||
'1',
|
||||
'1',
|
||||
'3',
|
||||
'2',
|
||||
'4',
|
||||
'2',
|
||||
'2',
|
||||
selfPeerId,
|
||||
]);
|
||||
expect(complexCallResult).toEqual(['some str', '3', '1', '4', '1', '1', '3', '2', '4', '2', '2', selfPeerId]);
|
||||
});
|
||||
|
||||
it('constants.aqua', async () => {
|
||||
@ -174,9 +207,9 @@ describe('Testing examples', () => {
|
||||
});
|
||||
|
||||
it('PARTICLE_TTL and PARTICLE_TIMESTAMP', async () => {
|
||||
const ttl = 1234
|
||||
const ttl = 1234;
|
||||
let result = await particleTtlAndTimestampCall(ttl);
|
||||
expect(result[1]).toBeDefined()
|
||||
expect(result[1]).toBeDefined();
|
||||
expect(result[0]).toEqual(ttl);
|
||||
});
|
||||
|
||||
@ -191,55 +224,60 @@ describe('Testing examples', () => {
|
||||
|
||||
it('streamCan.aqua', async () => {
|
||||
let streamCanResult = await streamCanCall();
|
||||
expect(streamCanResult).toEqual(["a", "b", null]);
|
||||
expect(streamCanResult).toEqual(['a', 'b', null]);
|
||||
});
|
||||
|
||||
it('streamCan.aqua LNG-63', async () => {
|
||||
let result = await bugLNG63Call();
|
||||
expect(result).toEqual("ok");
|
||||
let result = await bugLNG63Call();
|
||||
expect(result).toEqual('ok');
|
||||
});
|
||||
|
||||
it('streamCan.aqua LNG-63 2', async () => {
|
||||
let result = await bugLNG63_2Call();
|
||||
expect(result).toEqual(["ok", ["ok"], ["ok", "no", "ok"]]);
|
||||
let result = await bugLNG63_2Call();
|
||||
expect(result).toEqual(['ok', ['ok'], ['ok', 'no', 'ok']]);
|
||||
});
|
||||
|
||||
it('streamCan.aqua LNG-63 3', async () => {
|
||||
let result = await bugLNG63_3Call();
|
||||
expect(result).toEqual(["ok", 1, [1,3,2]]);
|
||||
expect(result).toEqual(['ok', 1, [1, 3, 2]]);
|
||||
});
|
||||
|
||||
it('collectionSugar array', async () => {
|
||||
let result = await arraySugarCall();
|
||||
expect(result).toEqual([[1,2,3], [4,5,6]]);
|
||||
expect(result).toEqual([
|
||||
[1, 2, 3],
|
||||
[4, 5, 6],
|
||||
]);
|
||||
});
|
||||
|
||||
it('collectionSugar stream', async () => {
|
||||
let result = await streamSugarCall();
|
||||
expect(result).toEqual([[1,2,3], [4,5,6]]);
|
||||
expect(result).toEqual([
|
||||
[1, 2, 3],
|
||||
[4, 5, 6],
|
||||
]);
|
||||
});
|
||||
|
||||
it('collectionSugar option', async () => {
|
||||
let result = await optionSugarCall()
|
||||
expect(result).toEqual([[1], ["some"], []]);
|
||||
let result = await optionSugarCall();
|
||||
expect(result).toEqual([[1], ['some'], []]);
|
||||
});
|
||||
|
||||
it('collectionSugar empty', async () => {
|
||||
let result = await allEmptySugarCall()
|
||||
let result = await allEmptySugarCall();
|
||||
expect(result).toEqual([[], [], [], [], null, [], null]);
|
||||
});
|
||||
|
||||
it('collectionSugar bug LNG-59', async () => {
|
||||
let result = await bugLNG59Call([config.relays[2].peerId, config.relays[3].peerId])
|
||||
expect(result).toEqual("some str");
|
||||
let result = await bugLNG59Call([config.relays[2].peerId, config.relays[3].peerId]);
|
||||
expect(result).toEqual('some str');
|
||||
});
|
||||
|
||||
it('recursiveStreams.aqua', async () => {
|
||||
|
||||
let [sucList, loopList] = await recursiveStreamsCall();
|
||||
console.log(sucList)
|
||||
console.log(loopList)
|
||||
expect(loopList).toEqual(["yes","yes","yes","yes","no"]);
|
||||
console.log(sucList);
|
||||
console.log(loopList);
|
||||
expect(loopList).toEqual(['yes', 'yes', 'yes', 'yes', 'no']);
|
||||
expect(sucList.length).toEqual(5);
|
||||
});
|
||||
|
||||
@ -255,15 +293,15 @@ describe('Testing examples', () => {
|
||||
|
||||
it('topology.aqua bug 205', async () => {
|
||||
let topologyResult = await topologyBug205Call(peer2);
|
||||
const peerId2 = peer2.getStatus().relayPeerId
|
||||
const res: string[] = [peerId2]
|
||||
const peerId2 = peer2.getStatus().relayPeerId;
|
||||
const res: string[] = [peerId2];
|
||||
expect(topologyResult).toEqual(res);
|
||||
});
|
||||
|
||||
it('topology.aqua bug 427', async () => {
|
||||
let topologyResult = await topologyBug427Call(peer2);
|
||||
|
||||
expect(topologyResult).toEqual(["some string", "some string"]);
|
||||
expect(topologyResult).toEqual(['some string', 'some string']);
|
||||
});
|
||||
|
||||
it('topology.aqua bug 394', async () => {
|
||||
@ -286,7 +324,7 @@ describe('Testing examples', () => {
|
||||
|
||||
it('foldJoin.aqua', async () => {
|
||||
let foldJoinResult = await foldJoinCall();
|
||||
expect(foldJoinResult.length).toBeGreaterThanOrEqual(3)
|
||||
expect(foldJoinResult.length).toBeGreaterThanOrEqual(3);
|
||||
}, 16000);
|
||||
|
||||
it('funcs.aqua', async () => {
|
||||
@ -323,16 +361,16 @@ describe('Testing examples', () => {
|
||||
let nestedDataResult = await nestedDataCall();
|
||||
expect(nestedDataResult).toEqual({
|
||||
one: {
|
||||
val: "hellohello"
|
||||
}
|
||||
val: 'hellohello',
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
it('closures.aqua', async () => {
|
||||
let closuresResult = await closuresCall();
|
||||
let res1 = config.externalAddressesRelay2
|
||||
let res2 = ["in", config.externalAddressesRelay2[0]]
|
||||
expect(closuresResult).toEqual(["in", res1, res1, res2]);
|
||||
let res1 = config.externalAddressesRelay2;
|
||||
let res2 = ['in', config.externalAddressesRelay2[0]];
|
||||
expect(closuresResult).toEqual(['in', res1, res1, res2]);
|
||||
});
|
||||
|
||||
// it('closures.aqua LNG-58 bug', async () => {
|
||||
@ -409,14 +447,7 @@ describe('Testing examples', () => {
|
||||
|
||||
it('multiReturn.aqua', async () => {
|
||||
let multiReturnResult = await multiReturnCall();
|
||||
expect(multiReturnResult).toEqual([
|
||||
['some-str', 'random-str', 'some-str'],
|
||||
5,
|
||||
'some-str',
|
||||
[1, 2],
|
||||
null,
|
||||
10,
|
||||
]);
|
||||
expect(multiReturnResult).toEqual([['some-str', 'random-str', 'some-str'], 5, 'some-str', [1, 2], null, 10]);
|
||||
});
|
||||
|
||||
it('declare.aqua', async () => {
|
||||
|
@ -1,23 +1,21 @@
|
||||
import {krasnodar, stage, testNet} from '@fluencelabs/fluence-network-environment';
|
||||
import { krasnodar, stage, testNet } from '@fluencelabs/fluence-network-environment';
|
||||
|
||||
const util = require('util');
|
||||
const exec = util.promisify(require('child_process').exec);
|
||||
|
||||
|
||||
describe('Testing run command', () => {
|
||||
const addr = krasnodar[4].multiaddr;
|
||||
const addr2 = krasnodar[1].multiaddr;
|
||||
const nodeId = krasnodar[5].peerId;
|
||||
const message = 'hello';
|
||||
const message2 = 'aaa';
|
||||
const func = `\"call(\\\"${message}\\\", \\\"${message2}\\\", \\\"${nodeId}\\\")\"`;
|
||||
const call = `npm run aqua run -- --addr ${addr} -i cli-run-aqua/caller.aqua -m node_modules/ --func ${func}`;
|
||||
const listBlueprintsCall = `npm run aqua remote list_blueprints -- --addr ${addr}`;
|
||||
const listModulesCall = `npm run aqua remote list_modules -- --addr ${addr}`;
|
||||
const listInterfacesCall = `npm run aqua remote list_interfaces -- --addr ${addr}`;
|
||||
|
||||
const addr = krasnodar[4].multiaddr
|
||||
const addr2 = krasnodar[1].multiaddr
|
||||
const nodeId = krasnodar[5].peerId
|
||||
const message = "hello"
|
||||
const message2 = "aaa"
|
||||
const func = `\"call(\\\"${message}\\\", \\\"${message2}\\\", \\\"${nodeId}\\\")\"`
|
||||
const call = `npm run aqua run -- --addr ${addr} -i cli-run-aqua/caller.aqua -m node_modules/ --func ${func}`
|
||||
const listBlueprintsCall = `npm run aqua remote list_blueprints -- --addr ${addr}`
|
||||
const listModulesCall = `npm run aqua remote list_modules -- --addr ${addr}`
|
||||
const listInterfacesCall = `npm run aqua remote list_interfaces -- --addr ${addr}`
|
||||
|
||||
it('run simple command', (done) => {
|
||||
it.skip('run simple command', (done) => {
|
||||
exec(call, (error, stdout, stderr) => {
|
||||
if (error) {
|
||||
console.error(`error: ${error.message}`);
|
||||
@ -49,12 +47,12 @@ describe('Testing run command', () => {
|
||||
console.error(`stderr: ${stderr}`);
|
||||
} else {
|
||||
try {
|
||||
let arr = stdout.split("\n").slice(3)
|
||||
const result = JSON.parse(arr.join("\n"));
|
||||
let arr = stdout.split('\n').slice(3);
|
||||
const result = JSON.parse(arr.join('\n'));
|
||||
|
||||
expect(Array.isArray(result)).toBeTruthy();
|
||||
} catch (e) {
|
||||
console.error(e)
|
||||
console.error(e);
|
||||
}
|
||||
}
|
||||
done();
|
||||
@ -69,12 +67,12 @@ describe('Testing run command', () => {
|
||||
console.error(`stderr: ${stderr}`);
|
||||
} else {
|
||||
try {
|
||||
let arr = stdout.split("\n").slice(3)
|
||||
const result = JSON.parse(arr.join("\n"));
|
||||
let arr = stdout.split('\n').slice(3);
|
||||
const result = JSON.parse(arr.join('\n'));
|
||||
|
||||
expect(Array.isArray(result)).toBeTruthy();
|
||||
} catch (e) {
|
||||
console.error(e)
|
||||
console.error(e);
|
||||
}
|
||||
}
|
||||
done();
|
||||
@ -89,15 +87,15 @@ describe('Testing run command', () => {
|
||||
console.error(`stderr: ${stderr}`);
|
||||
} else {
|
||||
try {
|
||||
let arr = stdout.split("\n").slice(3)
|
||||
const result = JSON.parse(arr.join(""));
|
||||
let arr = stdout.split('\n').slice(3);
|
||||
const result = JSON.parse(arr.join(''));
|
||||
|
||||
expect(Array.isArray(result)).toBeTruthy();
|
||||
} catch (e) {
|
||||
console.error(e)
|
||||
console.error(e);
|
||||
}
|
||||
}
|
||||
done();
|
||||
});
|
||||
}, 16000);
|
||||
})
|
||||
});
|
||||
|
@ -3,7 +3,7 @@
|
||||
* 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.6.2-281
|
||||
* Aqua version: 0.7.4-336
|
||||
*
|
||||
*/
|
||||
import { Fluence, FluencePeer } from '@fluencelabs/fluence';
|
||||
@ -11,7 +11,7 @@ import {
|
||||
CallParams,
|
||||
callFunction,
|
||||
registerService,
|
||||
} from '@fluencelabs/fluence/dist/internal/compilerSupport/v2';
|
||||
} from '@fluencelabs/fluence/dist/internal/compilerSupport/v3';
|
||||
|
||||
|
||||
// Services
|
||||
@ -52,25 +52,25 @@ export function put_value(...args: any) {
|
||||
(call -relay- ("kad" "neighborhood") [k [] []] nodes)
|
||||
)
|
||||
(par
|
||||
(fold nodes n
|
||||
(fold nodes n-0
|
||||
(par
|
||||
(xor
|
||||
(xor
|
||||
(seq
|
||||
(seq
|
||||
(call n ("peer" "timestamp_sec") [] t)
|
||||
(call n ("aqua-dht" "register_key") [initial_peer t false 0])
|
||||
(call n-0 ("peer" "timestamp_sec") [] t)
|
||||
(call n-0 ("aqua-dht" "register_key") [initial_peer t false 0])
|
||||
)
|
||||
(call n ("aqua-dht" "put_value") [initial_peer value t [] [] 0])
|
||||
(call n-0 ("aqua-dht" "put_value") [initial_peer value t [] [] 0])
|
||||
)
|
||||
(null)
|
||||
(call n-0 ("op" "noop") [])
|
||||
)
|
||||
(seq
|
||||
(call -relay- ("op" "noop") [])
|
||||
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 1])
|
||||
)
|
||||
)
|
||||
(next n)
|
||||
(next n-0)
|
||||
)
|
||||
)
|
||||
(null)
|
||||
@ -91,23 +91,31 @@ export function put_value(...args: any) {
|
||||
args,
|
||||
{
|
||||
"functionName" : "put_value",
|
||||
"returnType" : {
|
||||
"tag" : "primitive"
|
||||
},
|
||||
"argDefs" : [
|
||||
{
|
||||
"name" : "initial_peer",
|
||||
"argType" : {
|
||||
"tag" : "primitive"
|
||||
"arrow" : {
|
||||
"tag" : "arrow",
|
||||
"domain" : {
|
||||
"tag" : "labeledProduct",
|
||||
"fields" : {
|
||||
"initial_peer" : {
|
||||
"tag" : "scalar",
|
||||
"name" : "string"
|
||||
},
|
||||
"value" : {
|
||||
"tag" : "scalar",
|
||||
"name" : "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name" : "value",
|
||||
"argType" : {
|
||||
"tag" : "primitive"
|
||||
}
|
||||
"codomain" : {
|
||||
"tag" : "unlabeledProduct",
|
||||
"items" : [
|
||||
{
|
||||
"tag" : "scalar",
|
||||
"name" : "string"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
},
|
||||
"names" : {
|
||||
"relay" : "-relay-",
|
||||
"getDataSrv" : "getDataSrv",
|
||||
@ -172,19 +180,19 @@ export function registerKeyPutValue(...args: any) {
|
||||
(call %init_peer_id% ("kad" "neighborhood") [k [] []] nodes)
|
||||
)
|
||||
(par
|
||||
(fold nodes n
|
||||
(fold nodes n-0
|
||||
(par
|
||||
(seq
|
||||
(call -relay- ("op" "noop") [])
|
||||
(xor
|
||||
(call n ("peer" "timestamp_sec") [] t)
|
||||
(call n-0 ("peer" "timestamp_sec") [] t)
|
||||
(seq
|
||||
(call -relay- ("op" "noop") [])
|
||||
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 1])
|
||||
)
|
||||
)
|
||||
)
|
||||
(next n)
|
||||
(next n-0)
|
||||
)
|
||||
)
|
||||
(null)
|
||||
@ -202,41 +210,52 @@ export function registerKeyPutValue(...args: any) {
|
||||
args,
|
||||
{
|
||||
"functionName" : "registerKeyPutValue",
|
||||
"returnType" : {
|
||||
"tag" : "primitive"
|
||||
},
|
||||
"argDefs" : [
|
||||
{
|
||||
"name" : "node_id",
|
||||
"argType" : {
|
||||
"tag" : "primitive"
|
||||
"arrow" : {
|
||||
"tag" : "arrow",
|
||||
"domain" : {
|
||||
"tag" : "labeledProduct",
|
||||
"fields" : {
|
||||
"node_id" : {
|
||||
"tag" : "scalar",
|
||||
"name" : "string"
|
||||
},
|
||||
"key" : {
|
||||
"tag" : "scalar",
|
||||
"name" : "string"
|
||||
},
|
||||
"value" : {
|
||||
"tag" : "scalar",
|
||||
"name" : "string"
|
||||
},
|
||||
"relay_id" : {
|
||||
"tag" : "option",
|
||||
"type" : {
|
||||
"tag" : "scalar",
|
||||
"name" : "string"
|
||||
}
|
||||
},
|
||||
"service_id" : {
|
||||
"tag" : "option",
|
||||
"type" : {
|
||||
"tag" : "scalar",
|
||||
"name" : "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name" : "key",
|
||||
"argType" : {
|
||||
"tag" : "primitive"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name" : "value",
|
||||
"argType" : {
|
||||
"tag" : "primitive"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name" : "relay_id",
|
||||
"argType" : {
|
||||
"tag" : "optional"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name" : "service_id",
|
||||
"argType" : {
|
||||
"tag" : "optional"
|
||||
}
|
||||
"codomain" : {
|
||||
"tag" : "unlabeledProduct",
|
||||
"items" : [
|
||||
{
|
||||
"tag" : "array",
|
||||
"type" : {
|
||||
"tag" : "scalar",
|
||||
"name" : "string"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
},
|
||||
"names" : {
|
||||
"relay" : "-relay-",
|
||||
"getDataSrv" : "getDataSrv",
|
||||
|
@ -3,7 +3,7 @@
|
||||
* 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.7.4-SNAPSHOT
|
||||
* Aqua version: 0.7.4-336
|
||||
*
|
||||
*/
|
||||
import { Fluence, FluencePeer } from '@fluencelabs/fluence';
|
||||
|
@ -3,7 +3,7 @@
|
||||
* 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.7.4-SNAPSHOT
|
||||
* Aqua version: 0.7.4-336
|
||||
*
|
||||
*/
|
||||
import { Fluence, FluencePeer } from '@fluencelabs/fluence';
|
||||
|
@ -3,7 +3,7 @@
|
||||
* 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.7.4-SNAPSHOT
|
||||
* Aqua version: 0.7.4-336
|
||||
*
|
||||
*/
|
||||
import { Fluence, FluencePeer } from '@fluencelabs/fluence';
|
||||
|
@ -3,7 +3,7 @@
|
||||
* 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.7.4-327
|
||||
* Aqua version: 0.7.4-336
|
||||
*
|
||||
*/
|
||||
import { Fluence, FluencePeer } from '@fluencelabs/fluence';
|
||||
|
@ -3,7 +3,7 @@
|
||||
* 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.7.4-SNAPSHOT
|
||||
* Aqua version: 0.7.4-336
|
||||
*
|
||||
*/
|
||||
import { Fluence, FluencePeer } from '@fluencelabs/fluence';
|
||||
|
@ -3,7 +3,7 @@
|
||||
* 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.7.4-327
|
||||
* Aqua version: 0.7.4-336
|
||||
*
|
||||
*/
|
||||
import { Fluence, FluencePeer } from '@fluencelabs/fluence';
|
||||
|
@ -3,7 +3,7 @@
|
||||
* 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.7.4-SNAPSHOT
|
||||
* Aqua version: 0.7.4-336
|
||||
*
|
||||
*/
|
||||
import { Fluence, FluencePeer } from '@fluencelabs/fluence';
|
||||
@ -207,12 +207,24 @@ export function doStuff(...args: any) {
|
||||
)
|
||||
)
|
||||
)
|
||||
(null)
|
||||
(seq
|
||||
(seq
|
||||
(call -relay- ("op" "noop") [])
|
||||
(call b ("op" "noop") [])
|
||||
)
|
||||
(call -relay- ("op" "noop") [])
|
||||
)
|
||||
)
|
||||
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 3])
|
||||
)
|
||||
)
|
||||
(null)
|
||||
(seq
|
||||
(seq
|
||||
(call -relay- ("op" "noop") [])
|
||||
(call b ("op" "noop") [])
|
||||
)
|
||||
(call -relay- ("op" "noop") [])
|
||||
)
|
||||
)
|
||||
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 4])
|
||||
)
|
||||
|
@ -3,7 +3,7 @@
|
||||
* 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.7.4-SNAPSHOT
|
||||
* Aqua version: 0.7.4-336
|
||||
*
|
||||
*/
|
||||
import { Fluence, FluencePeer } from '@fluencelabs/fluence';
|
||||
|
@ -3,7 +3,7 @@
|
||||
* 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.7.4-SNAPSHOT
|
||||
* Aqua version: 0.7.4-336
|
||||
*
|
||||
*/
|
||||
import { Fluence, FluencePeer } from '@fluencelabs/fluence';
|
||||
|
@ -3,7 +3,7 @@
|
||||
* 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.7.4-SNAPSHOT
|
||||
* Aqua version: 0.7.4-336
|
||||
*
|
||||
*/
|
||||
import { Fluence, FluencePeer } from '@fluencelabs/fluence';
|
||||
@ -212,7 +212,7 @@ export function betterMessage(...args: any) {
|
||||
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 2])
|
||||
)
|
||||
)
|
||||
(null)
|
||||
(call %init_peer_id% ("op" "noop") [])
|
||||
)
|
||||
)
|
||||
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 3])
|
||||
|
@ -3,7 +3,7 @@
|
||||
* 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.7.4-SNAPSHOT
|
||||
* Aqua version: 0.7.4-336
|
||||
*
|
||||
*/
|
||||
import { Fluence, FluencePeer } from '@fluencelabs/fluence';
|
||||
|
@ -3,7 +3,7 @@
|
||||
* 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.7.4-SNAPSHOT
|
||||
* Aqua version: 0.7.4-336
|
||||
*
|
||||
*/
|
||||
import { Fluence, FluencePeer } from '@fluencelabs/fluence';
|
||||
@ -58,7 +58,7 @@ export function getTwoResults(...args: any) {
|
||||
(xor
|
||||
(xor
|
||||
(call n-0 ("peer" "timestamp_sec") [] $res)
|
||||
(null)
|
||||
(call n-0 ("op" "noop") [])
|
||||
)
|
||||
(seq
|
||||
(call -relay- ("op" "noop") [])
|
||||
|
@ -3,7 +3,7 @@
|
||||
* 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.7.4-SNAPSHOT
|
||||
* Aqua version: 0.7.4-336
|
||||
*
|
||||
*/
|
||||
import { Fluence, FluencePeer } from '@fluencelabs/fluence';
|
||||
|
797
src/compiled/examples/funcs.ts
Normal file
797
src/compiled/examples/funcs.ts
Normal file
@ -0,0 +1,797 @@
|
||||
/**
|
||||
*
|
||||
* 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.7.4-336
|
||||
*
|
||||
*/
|
||||
import { Fluence, FluencePeer } from '@fluencelabs/fluence';
|
||||
import {
|
||||
CallParams,
|
||||
callFunction,
|
||||
registerService,
|
||||
} from '@fluencelabs/fluence/dist/internal/compilerSupport/v3';
|
||||
|
||||
|
||||
// Services
|
||||
|
||||
export interface ADef {
|
||||
getJ: (i: number, callParams: CallParams<'i'>) => number | Promise<number>;
|
||||
}
|
||||
export function registerA(service: ADef): void;
|
||||
export function registerA(serviceId: string, service: ADef): void;
|
||||
export function registerA(peer: FluencePeer, service: ADef): void;
|
||||
export function registerA(peer: FluencePeer, serviceId: string, service: ADef): void;
|
||||
|
||||
|
||||
export function registerA(...args: any) {
|
||||
registerService(
|
||||
args,
|
||||
{
|
||||
"defaultServiceId" : "a",
|
||||
"functions" : {
|
||||
"tag" : "labeledProduct",
|
||||
"fields" : {
|
||||
"getJ" : {
|
||||
"tag" : "arrow",
|
||||
"domain" : {
|
||||
"tag" : "labeledProduct",
|
||||
"fields" : {
|
||||
"i" : {
|
||||
"tag" : "scalar",
|
||||
"name" : "u32"
|
||||
}
|
||||
}
|
||||
},
|
||||
"codomain" : {
|
||||
"tag" : "unlabeledProduct",
|
||||
"items" : [
|
||||
{
|
||||
"tag" : "scalar",
|
||||
"name" : "u32"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
// Functions
|
||||
|
||||
|
||||
export function main(
|
||||
log: (arg0: string, arg1: number[], callParams: CallParams<'arg0' | 'arg1'>) => void | Promise<void>,
|
||||
config?: {ttl?: number}
|
||||
): Promise<number>;
|
||||
|
||||
export function main(
|
||||
peer: FluencePeer,
|
||||
log: (arg0: string, arg1: number[], callParams: CallParams<'arg0' | 'arg1'>) => void | Promise<void>,
|
||||
config?: {ttl?: number}
|
||||
): Promise<number>;
|
||||
|
||||
export function main(...args: any) {
|
||||
|
||||
let script = `
|
||||
(xor
|
||||
(seq
|
||||
(seq
|
||||
(seq
|
||||
(seq
|
||||
(seq
|
||||
(seq
|
||||
(seq
|
||||
(seq
|
||||
(seq
|
||||
(seq
|
||||
(seq
|
||||
(seq
|
||||
(call %init_peer_id% ("getDataSrv" "-relay-") [] -relay-)
|
||||
(new $array-inline
|
||||
(seq
|
||||
(seq
|
||||
(seq
|
||||
(seq
|
||||
(seq
|
||||
(seq
|
||||
(seq
|
||||
(seq
|
||||
(seq
|
||||
(seq
|
||||
(seq
|
||||
(seq
|
||||
(seq
|
||||
(seq
|
||||
(seq
|
||||
(seq
|
||||
(seq
|
||||
(seq
|
||||
(seq
|
||||
(seq
|
||||
(ap 0 $array-inline)
|
||||
(ap 1 $array-inline)
|
||||
)
|
||||
(ap 2 $array-inline)
|
||||
)
|
||||
(ap 3 $array-inline)
|
||||
)
|
||||
(ap 4 $array-inline)
|
||||
)
|
||||
(ap 5 $array-inline)
|
||||
)
|
||||
(ap 6 $array-inline)
|
||||
)
|
||||
(ap 7 $array-inline)
|
||||
)
|
||||
(ap 8 $array-inline)
|
||||
)
|
||||
(ap 9 $array-inline)
|
||||
)
|
||||
(ap 10 $array-inline)
|
||||
)
|
||||
(ap 11 $array-inline)
|
||||
)
|
||||
(ap 12 $array-inline)
|
||||
)
|
||||
(ap 13 $array-inline)
|
||||
)
|
||||
(ap 14 $array-inline)
|
||||
)
|
||||
(ap 15 $array-inline)
|
||||
)
|
||||
(ap 16 $array-inline)
|
||||
)
|
||||
(ap 17 $array-inline)
|
||||
)
|
||||
(ap 18 $array-inline)
|
||||
)
|
||||
(ap 19 $array-inline)
|
||||
)
|
||||
(call %init_peer_id% ("op" "identity") [$array-inline] array-inline-0)
|
||||
)
|
||||
)
|
||||
)
|
||||
(call %init_peer_id% ("a" "getJ") [3] getJ)
|
||||
)
|
||||
(call %init_peer_id% ("math" "add") [getJ 2] add)
|
||||
)
|
||||
(call %init_peer_id% ("a" "getJ") [array-inline-0.$.[add]!] idx1)
|
||||
)
|
||||
(par
|
||||
(seq
|
||||
(call %init_peer_id% ("a" "getJ") [3] getJ-0)
|
||||
(call %init_peer_id% ("math" "add") [getJ-0 3] add-1)
|
||||
)
|
||||
(seq
|
||||
(call %init_peer_id% ("a" "getJ") [1] getJ-1)
|
||||
(call %init_peer_id% ("math" "sub") [getJ-1 1] sub-0)
|
||||
)
|
||||
)
|
||||
)
|
||||
(call %init_peer_id% ("math" "add") [array-inline-0.$.[add-1]! array-inline-0.$.[sub-0]!] add-0)
|
||||
)
|
||||
(call %init_peer_id% ("math" "sub") [add-0 3] sub)
|
||||
)
|
||||
(call %init_peer_id% ("a" "getJ") [sub] idx2)
|
||||
)
|
||||
(par
|
||||
(seq
|
||||
(par
|
||||
(call %init_peer_id% ("math" "add") [idx1 idx2] add-4)
|
||||
(call %init_peer_id% ("a" "getJ") [array-inline-0.$.[2]!] some)
|
||||
)
|
||||
(call %init_peer_id% ("math" "add") [add-4 some] add-3)
|
||||
)
|
||||
(call %init_peer_id% ("a" "getJ") [array-inline-0.$.[3]!] some-0)
|
||||
)
|
||||
)
|
||||
(call %init_peer_id% ("math" "add") [add-3 some-0] add-2)
|
||||
)
|
||||
(call %init_peer_id% ("a" "getJ") [array-inline-0.$.[add-2]!] getJ-2)
|
||||
)
|
||||
(xor
|
||||
(call %init_peer_id% ("callbackSrv" "response") [getJ-2])
|
||||
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 1])
|
||||
)
|
||||
)
|
||||
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 2])
|
||||
)
|
||||
`
|
||||
return callFunction(
|
||||
args,
|
||||
{
|
||||
"functionName" : "main",
|
||||
"arrow" : {
|
||||
"tag" : "arrow",
|
||||
"domain" : {
|
||||
"tag" : "labeledProduct",
|
||||
"fields" : {
|
||||
"log" : {
|
||||
"tag" : "arrow",
|
||||
"domain" : {
|
||||
"tag" : "unlabeledProduct",
|
||||
"items" : [
|
||||
{
|
||||
"tag" : "scalar",
|
||||
"name" : "string"
|
||||
},
|
||||
{
|
||||
"tag" : "array",
|
||||
"type" : {
|
||||
"tag" : "scalar",
|
||||
"name" : "u32"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"codomain" : {
|
||||
"tag" : "nil"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"codomain" : {
|
||||
"tag" : "unlabeledProduct",
|
||||
"items" : [
|
||||
{
|
||||
"tag" : "scalar",
|
||||
"name" : "u32"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"names" : {
|
||||
"relay" : "-relay-",
|
||||
"getDataSrv" : "getDataSrv",
|
||||
"callbackSrv" : "callbackSrv",
|
||||
"responseSrv" : "callbackSrv",
|
||||
"responseFnName" : "response",
|
||||
"errorHandlingSrv" : "errorHandlingSrv",
|
||||
"errorFnName" : "error"
|
||||
}
|
||||
},
|
||||
script
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
|
||||
export function calc2(
|
||||
log: (arg0: string, arg1: number[], callParams: CallParams<'arg0' | 'arg1'>) => void | Promise<void>,
|
||||
config?: {ttl?: number}
|
||||
): Promise<number>;
|
||||
|
||||
export function calc2(
|
||||
peer: FluencePeer,
|
||||
log: (arg0: string, arg1: number[], callParams: CallParams<'arg0' | 'arg1'>) => void | Promise<void>,
|
||||
config?: {ttl?: number}
|
||||
): Promise<number>;
|
||||
|
||||
export function calc2(...args: any) {
|
||||
|
||||
let script = `
|
||||
(xor
|
||||
(seq
|
||||
(seq
|
||||
(seq
|
||||
(seq
|
||||
(seq
|
||||
(seq
|
||||
(seq
|
||||
(seq
|
||||
(call %init_peer_id% ("getDataSrv" "-relay-") [] -relay-)
|
||||
(new $array-inline
|
||||
(seq
|
||||
(seq
|
||||
(seq
|
||||
(seq
|
||||
(seq
|
||||
(seq
|
||||
(seq
|
||||
(seq
|
||||
(seq
|
||||
(seq
|
||||
(seq
|
||||
(seq
|
||||
(seq
|
||||
(seq
|
||||
(seq
|
||||
(seq
|
||||
(seq
|
||||
(seq
|
||||
(seq
|
||||
(seq
|
||||
(ap 0 $array-inline)
|
||||
(ap 1 $array-inline)
|
||||
)
|
||||
(ap 2 $array-inline)
|
||||
)
|
||||
(ap 3 $array-inline)
|
||||
)
|
||||
(ap 4 $array-inline)
|
||||
)
|
||||
(ap 5 $array-inline)
|
||||
)
|
||||
(ap 6 $array-inline)
|
||||
)
|
||||
(ap 7 $array-inline)
|
||||
)
|
||||
(ap 8 $array-inline)
|
||||
)
|
||||
(ap 9 $array-inline)
|
||||
)
|
||||
(ap 10 $array-inline)
|
||||
)
|
||||
(ap 11 $array-inline)
|
||||
)
|
||||
(ap 12 $array-inline)
|
||||
)
|
||||
(ap 13 $array-inline)
|
||||
)
|
||||
(ap 14 $array-inline)
|
||||
)
|
||||
(ap 15 $array-inline)
|
||||
)
|
||||
(ap 16 $array-inline)
|
||||
)
|
||||
(ap 17 $array-inline)
|
||||
)
|
||||
(ap 18 $array-inline)
|
||||
)
|
||||
(ap 19 $array-inline)
|
||||
)
|
||||
(call %init_peer_id% ("op" "identity") [$array-inline] array-inline-0)
|
||||
)
|
||||
)
|
||||
)
|
||||
(par
|
||||
(seq
|
||||
(call %init_peer_id% ("math" "sub") [5 2] sub-0)
|
||||
(call %init_peer_id% ("math" "mul") [sub-0 3] mul)
|
||||
)
|
||||
(seq
|
||||
(seq
|
||||
(par
|
||||
(seq
|
||||
(call %init_peer_id% ("math" "add") [5 5] add)
|
||||
(call %init_peer_id% ("a" "getJ") [add] getJ)
|
||||
)
|
||||
(seq
|
||||
(seq
|
||||
(call %init_peer_id% ("math" "sub") [3 1] sub-2)
|
||||
(call %init_peer_id% ("math" "pow") [3 sub-2] pow-0)
|
||||
)
|
||||
(call %init_peer_id% ("a" "getJ") [pow-0] getJ-0)
|
||||
)
|
||||
)
|
||||
(call %init_peer_id% ("math" "sub") [getJ getJ-0] sub-1)
|
||||
)
|
||||
(call %init_peer_id% ("math" "pow") [3 sub-1] pow)
|
||||
)
|
||||
)
|
||||
)
|
||||
(call %init_peer_id% ("math" "sub") [mul pow] sub)
|
||||
)
|
||||
(call %init_peer_id% ("a" "getJ") [sub] num)
|
||||
)
|
||||
(par
|
||||
(call %init_peer_id% ("math" "add") [num num] add-0)
|
||||
(call %init_peer_id% ("a" "getJ") [num] getJ-1)
|
||||
)
|
||||
)
|
||||
(call %init_peer_id% ("math" "sub") [add-0 getJ-1] sub-4)
|
||||
)
|
||||
(call %init_peer_id% ("math" "sub") [sub-4 3] sub-3)
|
||||
)
|
||||
(xor
|
||||
(call %init_peer_id% ("callbackSrv" "response") [array-inline-0.$.[sub-3]!])
|
||||
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 1])
|
||||
)
|
||||
)
|
||||
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 2])
|
||||
)
|
||||
`
|
||||
return callFunction(
|
||||
args,
|
||||
{
|
||||
"functionName" : "calc2",
|
||||
"arrow" : {
|
||||
"tag" : "arrow",
|
||||
"domain" : {
|
||||
"tag" : "labeledProduct",
|
||||
"fields" : {
|
||||
"log" : {
|
||||
"tag" : "arrow",
|
||||
"domain" : {
|
||||
"tag" : "unlabeledProduct",
|
||||
"items" : [
|
||||
{
|
||||
"tag" : "scalar",
|
||||
"name" : "string"
|
||||
},
|
||||
{
|
||||
"tag" : "array",
|
||||
"type" : {
|
||||
"tag" : "scalar",
|
||||
"name" : "u32"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"codomain" : {
|
||||
"tag" : "nil"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"codomain" : {
|
||||
"tag" : "unlabeledProduct",
|
||||
"items" : [
|
||||
{
|
||||
"tag" : "scalar",
|
||||
"name" : "u32"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"names" : {
|
||||
"relay" : "-relay-",
|
||||
"getDataSrv" : "getDataSrv",
|
||||
"callbackSrv" : "callbackSrv",
|
||||
"responseSrv" : "callbackSrv",
|
||||
"responseFnName" : "response",
|
||||
"errorHandlingSrv" : "errorHandlingSrv",
|
||||
"errorFnName" : "error"
|
||||
}
|
||||
},
|
||||
script
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
|
||||
export function ifCalc(
|
||||
config?: {ttl?: number}
|
||||
): Promise<number>;
|
||||
|
||||
export function ifCalc(
|
||||
peer: FluencePeer,
|
||||
config?: {ttl?: number}
|
||||
): Promise<number>;
|
||||
|
||||
export function ifCalc(...args: any) {
|
||||
|
||||
let script = `
|
||||
(xor
|
||||
(seq
|
||||
(seq
|
||||
(call %init_peer_id% ("getDataSrv" "-relay-") [] -relay-)
|
||||
(new $res
|
||||
(seq
|
||||
(seq
|
||||
(new $array-inline
|
||||
(seq
|
||||
(seq
|
||||
(seq
|
||||
(seq
|
||||
(seq
|
||||
(seq
|
||||
(seq
|
||||
(seq
|
||||
(seq
|
||||
(seq
|
||||
(seq
|
||||
(seq
|
||||
(seq
|
||||
(seq
|
||||
(seq
|
||||
(seq
|
||||
(seq
|
||||
(seq
|
||||
(seq
|
||||
(seq
|
||||
(ap 0 $array-inline)
|
||||
(ap 1 $array-inline)
|
||||
)
|
||||
(ap 2 $array-inline)
|
||||
)
|
||||
(ap 3 $array-inline)
|
||||
)
|
||||
(ap 4 $array-inline)
|
||||
)
|
||||
(ap 5 $array-inline)
|
||||
)
|
||||
(ap 6 $array-inline)
|
||||
)
|
||||
(ap 7 $array-inline)
|
||||
)
|
||||
(ap 8 $array-inline)
|
||||
)
|
||||
(ap 9 $array-inline)
|
||||
)
|
||||
(ap 10 $array-inline)
|
||||
)
|
||||
(ap 11 $array-inline)
|
||||
)
|
||||
(ap 12 $array-inline)
|
||||
)
|
||||
(ap 13 $array-inline)
|
||||
)
|
||||
(ap 14 $array-inline)
|
||||
)
|
||||
(ap 15 $array-inline)
|
||||
)
|
||||
(ap 16 $array-inline)
|
||||
)
|
||||
(ap 17 $array-inline)
|
||||
)
|
||||
(ap 18 $array-inline)
|
||||
)
|
||||
(ap 19 $array-inline)
|
||||
)
|
||||
(call %init_peer_id% ("op" "identity") [$array-inline] array-inline-0)
|
||||
)
|
||||
)
|
||||
(xor
|
||||
(seq
|
||||
(seq
|
||||
(par
|
||||
(seq
|
||||
(par
|
||||
(seq
|
||||
(call %init_peer_id% ("math" "sub") [8 2] sub)
|
||||
(call %init_peer_id% ("a" "getJ") [sub] getJ)
|
||||
)
|
||||
(seq
|
||||
(call %init_peer_id% ("math" "rem") [4 2] rem)
|
||||
(call %init_peer_id% ("a" "getJ") [rem] getJ-0)
|
||||
)
|
||||
)
|
||||
(call %init_peer_id% ("math" "add") [getJ getJ-0] add)
|
||||
)
|
||||
(seq
|
||||
(seq
|
||||
(par
|
||||
(call %init_peer_id% ("math" "sub") [5 3] sub-1)
|
||||
(call %init_peer_id% ("a" "getJ") [3] getJ-1)
|
||||
)
|
||||
(call %init_peer_id% ("math" "add") [sub-1 getJ-1] add-0)
|
||||
)
|
||||
(call %init_peer_id% ("math" "sub") [array-inline-0.$.[add-0]! 2] sub-0)
|
||||
)
|
||||
)
|
||||
(call %init_peer_id% ("cmp" "gt") [add sub-0] gt)
|
||||
)
|
||||
(match gt true
|
||||
(ap 1 $res)
|
||||
)
|
||||
)
|
||||
(ap 2 $res)
|
||||
)
|
||||
)
|
||||
(call %init_peer_id% ("op" "identity") [$res] res-fix)
|
||||
)
|
||||
)
|
||||
)
|
||||
(xor
|
||||
(call %init_peer_id% ("callbackSrv" "response") [res-fix.$.[0]!])
|
||||
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 1])
|
||||
)
|
||||
)
|
||||
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 2])
|
||||
)
|
||||
`
|
||||
return callFunction(
|
||||
args,
|
||||
{
|
||||
"functionName" : "ifCalc",
|
||||
"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 calc(
|
||||
log: (arg0: string, arg1: number[], callParams: CallParams<'arg0' | 'arg1'>) => void | Promise<void>,
|
||||
config?: {ttl?: number}
|
||||
): Promise<number>;
|
||||
|
||||
export function calc(
|
||||
peer: FluencePeer,
|
||||
log: (arg0: string, arg1: number[], callParams: CallParams<'arg0' | 'arg1'>) => void | Promise<void>,
|
||||
config?: {ttl?: number}
|
||||
): Promise<number>;
|
||||
|
||||
export function calc(...args: any) {
|
||||
|
||||
let script = `
|
||||
(xor
|
||||
(seq
|
||||
(seq
|
||||
(seq
|
||||
(seq
|
||||
(seq
|
||||
(seq
|
||||
(seq
|
||||
(seq
|
||||
(call %init_peer_id% ("getDataSrv" "-relay-") [] -relay-)
|
||||
(new $array-inline
|
||||
(seq
|
||||
(seq
|
||||
(seq
|
||||
(seq
|
||||
(seq
|
||||
(seq
|
||||
(seq
|
||||
(seq
|
||||
(seq
|
||||
(seq
|
||||
(seq
|
||||
(seq
|
||||
(seq
|
||||
(seq
|
||||
(seq
|
||||
(seq
|
||||
(seq
|
||||
(seq
|
||||
(seq
|
||||
(seq
|
||||
(ap 0 $array-inline)
|
||||
(ap 1 $array-inline)
|
||||
)
|
||||
(ap 2 $array-inline)
|
||||
)
|
||||
(ap 3 $array-inline)
|
||||
)
|
||||
(ap 4 $array-inline)
|
||||
)
|
||||
(ap 5 $array-inline)
|
||||
)
|
||||
(ap 6 $array-inline)
|
||||
)
|
||||
(ap 7 $array-inline)
|
||||
)
|
||||
(ap 8 $array-inline)
|
||||
)
|
||||
(ap 9 $array-inline)
|
||||
)
|
||||
(ap 10 $array-inline)
|
||||
)
|
||||
(ap 11 $array-inline)
|
||||
)
|
||||
(ap 12 $array-inline)
|
||||
)
|
||||
(ap 13 $array-inline)
|
||||
)
|
||||
(ap 14 $array-inline)
|
||||
)
|
||||
(ap 15 $array-inline)
|
||||
)
|
||||
(ap 16 $array-inline)
|
||||
)
|
||||
(ap 17 $array-inline)
|
||||
)
|
||||
(ap 18 $array-inline)
|
||||
)
|
||||
(ap 19 $array-inline)
|
||||
)
|
||||
(call %init_peer_id% ("op" "identity") [$array-inline] array-inline-0)
|
||||
)
|
||||
)
|
||||
)
|
||||
(call %init_peer_id% ("math" "sub") [5 2] sub-0)
|
||||
)
|
||||
(call %init_peer_id% ("math" "mul") [sub-0 3] mul)
|
||||
)
|
||||
(call %init_peer_id% ("math" "sub") [mul 3] sub)
|
||||
)
|
||||
(call %init_peer_id% ("a" "getJ") [sub] num)
|
||||
)
|
||||
(new $array-inline-1
|
||||
(seq
|
||||
(ap num $array-inline-1)
|
||||
(call %init_peer_id% ("op" "identity") [$array-inline-1] array-inline-1-0)
|
||||
)
|
||||
)
|
||||
)
|
||||
(xor
|
||||
(call %init_peer_id% ("callbackSrv" "log") ["calc 2" array-inline-1-0])
|
||||
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 1])
|
||||
)
|
||||
)
|
||||
(xor
|
||||
(call %init_peer_id% ("callbackSrv" "response") [array-inline-0.$.[num]!])
|
||||
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 2])
|
||||
)
|
||||
)
|
||||
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 3])
|
||||
)
|
||||
`
|
||||
return callFunction(
|
||||
args,
|
||||
{
|
||||
"functionName" : "calc",
|
||||
"arrow" : {
|
||||
"tag" : "arrow",
|
||||
"domain" : {
|
||||
"tag" : "labeledProduct",
|
||||
"fields" : {
|
||||
"log" : {
|
||||
"tag" : "arrow",
|
||||
"domain" : {
|
||||
"tag" : "unlabeledProduct",
|
||||
"items" : [
|
||||
{
|
||||
"tag" : "scalar",
|
||||
"name" : "string"
|
||||
},
|
||||
{
|
||||
"tag" : "array",
|
||||
"type" : {
|
||||
"tag" : "scalar",
|
||||
"name" : "u32"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"codomain" : {
|
||||
"tag" : "nil"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"codomain" : {
|
||||
"tag" : "unlabeledProduct",
|
||||
"items" : [
|
||||
{
|
||||
"tag" : "scalar",
|
||||
"name" : "u32"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"names" : {
|
||||
"relay" : "-relay-",
|
||||
"getDataSrv" : "getDataSrv",
|
||||
"callbackSrv" : "callbackSrv",
|
||||
"responseSrv" : "callbackSrv",
|
||||
"responseFnName" : "response",
|
||||
"errorHandlingSrv" : "errorHandlingSrv",
|
||||
"errorFnName" : "error"
|
||||
}
|
||||
},
|
||||
script
|
||||
)
|
||||
}
|
@ -3,7 +3,7 @@
|
||||
* 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.7.4-SNAPSHOT
|
||||
* Aqua version: 0.7.4-336
|
||||
*
|
||||
*/
|
||||
import { Fluence, FluencePeer } from '@fluencelabs/fluence';
|
||||
|
@ -3,7 +3,7 @@
|
||||
* 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.7.4-SNAPSHOT
|
||||
* Aqua version: 0.7.4-336
|
||||
*
|
||||
*/
|
||||
import { Fluence, FluencePeer } from '@fluencelabs/fluence';
|
||||
@ -63,142 +63,6 @@ export function registerOpR(...args: any) {
|
||||
// Functions
|
||||
|
||||
|
||||
export function ifElseCall(
|
||||
condition: boolean,
|
||||
config?: {ttl?: number}
|
||||
): Promise<void>;
|
||||
|
||||
export function ifElseCall(
|
||||
peer: FluencePeer,
|
||||
condition: boolean,
|
||||
config?: {ttl?: number}
|
||||
): Promise<void>;
|
||||
|
||||
export function ifElseCall(...args: any) {
|
||||
|
||||
let script = `
|
||||
(xor
|
||||
(seq
|
||||
(seq
|
||||
(call %init_peer_id% ("getDataSrv" "-relay-") [] -relay-)
|
||||
(call %init_peer_id% ("getDataSrv" "condition") [] condition)
|
||||
)
|
||||
(xor
|
||||
(match condition true
|
||||
(xor
|
||||
(call %init_peer_id% ("println-service-id" "print") ["it is true"])
|
||||
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 1])
|
||||
)
|
||||
)
|
||||
(call %init_peer_id% ("println-service-id" "print") ["it is false"])
|
||||
)
|
||||
)
|
||||
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 2])
|
||||
)
|
||||
`
|
||||
return callFunction(
|
||||
args,
|
||||
{
|
||||
"functionName" : "ifElseCall",
|
||||
"arrow" : {
|
||||
"tag" : "arrow",
|
||||
"domain" : {
|
||||
"tag" : "labeledProduct",
|
||||
"fields" : {
|
||||
"condition" : {
|
||||
"tag" : "scalar",
|
||||
"name" : "bool"
|
||||
}
|
||||
}
|
||||
},
|
||||
"codomain" : {
|
||||
"tag" : "nil"
|
||||
}
|
||||
},
|
||||
"names" : {
|
||||
"relay" : "-relay-",
|
||||
"getDataSrv" : "getDataSrv",
|
||||
"callbackSrv" : "callbackSrv",
|
||||
"responseSrv" : "callbackSrv",
|
||||
"responseFnName" : "response",
|
||||
"errorHandlingSrv" : "errorHandlingSrv",
|
||||
"errorFnName" : "error"
|
||||
}
|
||||
},
|
||||
script
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
|
||||
export function ifElseNumCall(
|
||||
condition: number,
|
||||
config?: {ttl?: number}
|
||||
): Promise<void>;
|
||||
|
||||
export function ifElseNumCall(
|
||||
peer: FluencePeer,
|
||||
condition: number,
|
||||
config?: {ttl?: number}
|
||||
): Promise<void>;
|
||||
|
||||
export function ifElseNumCall(...args: any) {
|
||||
|
||||
let script = `
|
||||
(xor
|
||||
(seq
|
||||
(seq
|
||||
(call %init_peer_id% ("getDataSrv" "-relay-") [] -relay-)
|
||||
(call %init_peer_id% ("getDataSrv" "condition") [] condition)
|
||||
)
|
||||
(xor
|
||||
(match condition 1
|
||||
(xor
|
||||
(call %init_peer_id% ("println-service-id" "print") ["it is 1"])
|
||||
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 1])
|
||||
)
|
||||
)
|
||||
(call %init_peer_id% ("println-service-id" "print") ["it is not 1"])
|
||||
)
|
||||
)
|
||||
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 2])
|
||||
)
|
||||
`
|
||||
return callFunction(
|
||||
args,
|
||||
{
|
||||
"functionName" : "ifElseNumCall",
|
||||
"arrow" : {
|
||||
"tag" : "arrow",
|
||||
"domain" : {
|
||||
"tag" : "labeledProduct",
|
||||
"fields" : {
|
||||
"condition" : {
|
||||
"tag" : "scalar",
|
||||
"name" : "u32"
|
||||
}
|
||||
}
|
||||
},
|
||||
"codomain" : {
|
||||
"tag" : "nil"
|
||||
}
|
||||
},
|
||||
"names" : {
|
||||
"relay" : "-relay-",
|
||||
"getDataSrv" : "getDataSrv",
|
||||
"callbackSrv" : "callbackSrv",
|
||||
"responseSrv" : "callbackSrv",
|
||||
"responseFnName" : "response",
|
||||
"errorHandlingSrv" : "errorHandlingSrv",
|
||||
"errorFnName" : "error"
|
||||
}
|
||||
},
|
||||
script
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
|
||||
export function ifCorrectXorWrap(
|
||||
node: string,
|
||||
config?: {ttl?: number}
|
||||
@ -293,3 +157,240 @@ export function ifCorrectXorWrap(...args: any) {
|
||||
script
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
|
||||
export function ifElseNumCall(
|
||||
condition: number,
|
||||
config?: {ttl?: number}
|
||||
): Promise<void>;
|
||||
|
||||
export function ifElseNumCall(
|
||||
peer: FluencePeer,
|
||||
condition: number,
|
||||
config?: {ttl?: number}
|
||||
): Promise<void>;
|
||||
|
||||
export function ifElseNumCall(...args: any) {
|
||||
|
||||
let script = `
|
||||
(xor
|
||||
(seq
|
||||
(seq
|
||||
(call %init_peer_id% ("getDataSrv" "-relay-") [] -relay-)
|
||||
(call %init_peer_id% ("getDataSrv" "condition") [] condition)
|
||||
)
|
||||
(xor
|
||||
(match condition 1
|
||||
(xor
|
||||
(call %init_peer_id% ("println-service-id" "print") ["it is 1"])
|
||||
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 1])
|
||||
)
|
||||
)
|
||||
(call %init_peer_id% ("println-service-id" "print") ["it is not 1"])
|
||||
)
|
||||
)
|
||||
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 2])
|
||||
)
|
||||
`
|
||||
return callFunction(
|
||||
args,
|
||||
{
|
||||
"functionName" : "ifElseNumCall",
|
||||
"arrow" : {
|
||||
"tag" : "arrow",
|
||||
"domain" : {
|
||||
"tag" : "labeledProduct",
|
||||
"fields" : {
|
||||
"condition" : {
|
||||
"tag" : "scalar",
|
||||
"name" : "u32"
|
||||
}
|
||||
}
|
||||
},
|
||||
"codomain" : {
|
||||
"tag" : "nil"
|
||||
}
|
||||
},
|
||||
"names" : {
|
||||
"relay" : "-relay-",
|
||||
"getDataSrv" : "getDataSrv",
|
||||
"callbackSrv" : "callbackSrv",
|
||||
"responseSrv" : "callbackSrv",
|
||||
"responseFnName" : "response",
|
||||
"errorHandlingSrv" : "errorHandlingSrv",
|
||||
"errorFnName" : "error"
|
||||
}
|
||||
},
|
||||
script
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
|
||||
export function ifElseCall(
|
||||
condition: boolean,
|
||||
config?: {ttl?: number}
|
||||
): Promise<void>;
|
||||
|
||||
export function ifElseCall(
|
||||
peer: FluencePeer,
|
||||
condition: boolean,
|
||||
config?: {ttl?: number}
|
||||
): Promise<void>;
|
||||
|
||||
export function ifElseCall(...args: any) {
|
||||
|
||||
let script = `
|
||||
(xor
|
||||
(seq
|
||||
(seq
|
||||
(call %init_peer_id% ("getDataSrv" "-relay-") [] -relay-)
|
||||
(call %init_peer_id% ("getDataSrv" "condition") [] condition)
|
||||
)
|
||||
(xor
|
||||
(match condition true
|
||||
(xor
|
||||
(call %init_peer_id% ("println-service-id" "print") ["it is true"])
|
||||
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 1])
|
||||
)
|
||||
)
|
||||
(call %init_peer_id% ("println-service-id" "print") ["it is false"])
|
||||
)
|
||||
)
|
||||
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 2])
|
||||
)
|
||||
`
|
||||
return callFunction(
|
||||
args,
|
||||
{
|
||||
"functionName" : "ifElseCall",
|
||||
"arrow" : {
|
||||
"tag" : "arrow",
|
||||
"domain" : {
|
||||
"tag" : "labeledProduct",
|
||||
"fields" : {
|
||||
"condition" : {
|
||||
"tag" : "scalar",
|
||||
"name" : "bool"
|
||||
}
|
||||
}
|
||||
},
|
||||
"codomain" : {
|
||||
"tag" : "nil"
|
||||
}
|
||||
},
|
||||
"names" : {
|
||||
"relay" : "-relay-",
|
||||
"getDataSrv" : "getDataSrv",
|
||||
"callbackSrv" : "callbackSrv",
|
||||
"responseSrv" : "callbackSrv",
|
||||
"responseFnName" : "response",
|
||||
"errorHandlingSrv" : "errorHandlingSrv",
|
||||
"errorFnName" : "error"
|
||||
}
|
||||
},
|
||||
script
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
|
||||
export function bugLNG69(
|
||||
other_node: string,
|
||||
config?: {ttl?: number}
|
||||
): Promise<boolean>;
|
||||
|
||||
export function bugLNG69(
|
||||
peer: FluencePeer,
|
||||
other_node: string,
|
||||
config?: {ttl?: number}
|
||||
): Promise<boolean>;
|
||||
|
||||
export function bugLNG69(...args: any) {
|
||||
|
||||
let script = `
|
||||
(xor
|
||||
(seq
|
||||
(seq
|
||||
(seq
|
||||
(seq
|
||||
(call %init_peer_id% ("getDataSrv" "-relay-") [] -relay-)
|
||||
(call %init_peer_id% ("getDataSrv" "other_node") [] other_node)
|
||||
)
|
||||
(call -relay- ("op" "noop") [])
|
||||
)
|
||||
(xor
|
||||
(seq
|
||||
(call other_node ("op" "noop") [])
|
||||
(xor
|
||||
(match false true
|
||||
(xor
|
||||
(seq
|
||||
(call other_node ("op" "noop") [])
|
||||
(call -relay- ("op" "noop") [])
|
||||
)
|
||||
(seq
|
||||
(call -relay- ("op" "noop") [])
|
||||
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 1])
|
||||
)
|
||||
)
|
||||
)
|
||||
(seq
|
||||
(seq
|
||||
(call -relay- ("op" "noop") [])
|
||||
(call other_node ("op" "noop") [])
|
||||
)
|
||||
(call -relay- ("op" "noop") [])
|
||||
)
|
||||
)
|
||||
)
|
||||
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 2])
|
||||
)
|
||||
)
|
||||
(xor
|
||||
(call %init_peer_id% ("callbackSrv" "response") [true])
|
||||
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 3])
|
||||
)
|
||||
)
|
||||
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 4])
|
||||
)
|
||||
`
|
||||
return callFunction(
|
||||
args,
|
||||
{
|
||||
"functionName" : "bugLNG69",
|
||||
"arrow" : {
|
||||
"tag" : "arrow",
|
||||
"domain" : {
|
||||
"tag" : "labeledProduct",
|
||||
"fields" : {
|
||||
"other_node" : {
|
||||
"tag" : "scalar",
|
||||
"name" : "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"codomain" : {
|
||||
"tag" : "unlabeledProduct",
|
||||
"items" : [
|
||||
{
|
||||
"tag" : "scalar",
|
||||
"name" : "bool"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"names" : {
|
||||
"relay" : "-relay-",
|
||||
"getDataSrv" : "getDataSrv",
|
||||
"callbackSrv" : "callbackSrv",
|
||||
"responseSrv" : "callbackSrv",
|
||||
"responseFnName" : "response",
|
||||
"errorHandlingSrv" : "errorHandlingSrv",
|
||||
"errorFnName" : "error"
|
||||
}
|
||||
},
|
||||
script
|
||||
)
|
||||
}
|
||||
|
@ -3,7 +3,7 @@
|
||||
* 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.7.4-SNAPSHOT
|
||||
* Aqua version: 0.7.4-336
|
||||
*
|
||||
*/
|
||||
import { Fluence, FluencePeer } from '@fluencelabs/fluence';
|
||||
|
@ -3,7 +3,7 @@
|
||||
* 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.7.4-SNAPSHOT
|
||||
* Aqua version: 0.7.4-336
|
||||
*
|
||||
*/
|
||||
import { Fluence, FluencePeer } from '@fluencelabs/fluence';
|
||||
|
@ -3,7 +3,7 @@
|
||||
* 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.7.4-SNAPSHOT
|
||||
* Aqua version: 0.7.4-336
|
||||
*
|
||||
*/
|
||||
import { Fluence, FluencePeer } from '@fluencelabs/fluence';
|
||||
|
@ -3,7 +3,7 @@
|
||||
* 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.7.4-SNAPSHOT
|
||||
* Aqua version: 0.7.4-336
|
||||
*
|
||||
*/
|
||||
import { Fluence, FluencePeer } from '@fluencelabs/fluence';
|
||||
|
@ -3,7 +3,7 @@
|
||||
* 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.7.4-SNAPSHOT
|
||||
* Aqua version: 0.7.4-336
|
||||
*
|
||||
*/
|
||||
import { Fluence, FluencePeer } from '@fluencelabs/fluence';
|
||||
|
@ -3,7 +3,7 @@
|
||||
* 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.7.4-SNAPSHOT
|
||||
* Aqua version: 0.7.4-336
|
||||
*
|
||||
*/
|
||||
import { Fluence, FluencePeer } from '@fluencelabs/fluence';
|
||||
|
@ -3,7 +3,7 @@
|
||||
* 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.7.4-SNAPSHOT
|
||||
* Aqua version: 0.7.4-336
|
||||
*
|
||||
*/
|
||||
import { Fluence, FluencePeer } from '@fluencelabs/fluence';
|
||||
|
@ -3,7 +3,7 @@
|
||||
* 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.7.4-SNAPSHOT
|
||||
* Aqua version: 0.7.4-336
|
||||
*
|
||||
*/
|
||||
import { Fluence, FluencePeer } from '@fluencelabs/fluence';
|
||||
|
203
src/compiled/examples/math.ts
Normal file
203
src/compiled/examples/math.ts
Normal file
@ -0,0 +1,203 @@
|
||||
/**
|
||||
*
|
||||
* 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.7.4-336
|
||||
*
|
||||
*/
|
||||
import { Fluence, FluencePeer } from '@fluencelabs/fluence';
|
||||
import {
|
||||
CallParams,
|
||||
callFunction,
|
||||
registerService,
|
||||
} from '@fluencelabs/fluence/dist/internal/compilerSupport/v3';
|
||||
|
||||
|
||||
// Services
|
||||
|
||||
// Functions
|
||||
|
||||
|
||||
export function test1(
|
||||
config?: {ttl?: number}
|
||||
): Promise<number>;
|
||||
|
||||
export function test1(
|
||||
peer: FluencePeer,
|
||||
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: FluencePeer,
|
||||
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
|
||||
)
|
||||
}
|
@ -3,7 +3,7 @@
|
||||
* 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.7.4-SNAPSHOT
|
||||
* Aqua version: 0.7.4-336
|
||||
*
|
||||
*/
|
||||
import { Fluence, FluencePeer } from '@fluencelabs/fluence';
|
||||
|
261
src/compiled/examples/nestedData.ts
Normal file
261
src/compiled/examples/nestedData.ts
Normal file
@ -0,0 +1,261 @@
|
||||
/**
|
||||
*
|
||||
* 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.7.4-336
|
||||
*
|
||||
*/
|
||||
import { Fluence, FluencePeer } from '@fluencelabs/fluence';
|
||||
import {
|
||||
CallParams,
|
||||
callFunction,
|
||||
registerService,
|
||||
} from '@fluencelabs/fluence/dist/internal/compilerSupport/v3';
|
||||
|
||||
|
||||
// Services
|
||||
|
||||
export interface TestDef {
|
||||
test1: (callParams: CallParams<null>) => { one: { val: string; }; } | Promise<{ one: { val: string; }; }>;
|
||||
test2: (arg1: { val: string; }, arg2: string, callParams: CallParams<'arg1' | 'arg2'>) => { one: { val: string; }; } | Promise<{ one: { val: string; }; }>;
|
||||
}
|
||||
export function registerTest(service: TestDef): void;
|
||||
export function registerTest(serviceId: string, service: TestDef): void;
|
||||
export function registerTest(peer: FluencePeer, service: TestDef): void;
|
||||
export function registerTest(peer: FluencePeer, serviceId: string, service: TestDef): void;
|
||||
|
||||
|
||||
export function registerTest(...args: any) {
|
||||
registerService(
|
||||
args,
|
||||
{
|
||||
"defaultServiceId" : "service",
|
||||
"functions" : {
|
||||
"tag" : "labeledProduct",
|
||||
"fields" : {
|
||||
"test1" : {
|
||||
"tag" : "arrow",
|
||||
"domain" : {
|
||||
"tag" : "nil"
|
||||
},
|
||||
"codomain" : {
|
||||
"tag" : "unlabeledProduct",
|
||||
"items" : [
|
||||
{
|
||||
"tag" : "struct",
|
||||
"name" : "NestedStruct",
|
||||
"fields" : {
|
||||
"one" : {
|
||||
"tag" : "struct",
|
||||
"name" : "NestedType",
|
||||
"fields" : {
|
||||
"val" : {
|
||||
"tag" : "scalar",
|
||||
"name" : "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"test2" : {
|
||||
"tag" : "arrow",
|
||||
"domain" : {
|
||||
"tag" : "labeledProduct",
|
||||
"fields" : {
|
||||
"arg1" : {
|
||||
"tag" : "struct",
|
||||
"name" : "NestedType",
|
||||
"fields" : {
|
||||
"val" : {
|
||||
"tag" : "scalar",
|
||||
"name" : "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"arg2" : {
|
||||
"tag" : "scalar",
|
||||
"name" : "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"codomain" : {
|
||||
"tag" : "unlabeledProduct",
|
||||
"items" : [
|
||||
{
|
||||
"tag" : "struct",
|
||||
"name" : "NestedStruct",
|
||||
"fields" : {
|
||||
"one" : {
|
||||
"tag" : "struct",
|
||||
"name" : "NestedType",
|
||||
"fields" : {
|
||||
"val" : {
|
||||
"tag" : "scalar",
|
||||
"name" : "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
// Functions
|
||||
|
||||
export type TestResult = { one: { val: string; }; }
|
||||
export function test(
|
||||
config?: {ttl?: number}
|
||||
): Promise<TestResult>;
|
||||
|
||||
export function test(
|
||||
peer: FluencePeer,
|
||||
config?: {ttl?: number}
|
||||
): Promise<TestResult>;
|
||||
|
||||
export function test(...args: any) {
|
||||
|
||||
let script = `
|
||||
(xor
|
||||
(seq
|
||||
(seq
|
||||
(seq
|
||||
(call %init_peer_id% ("getDataSrv" "-relay-") [] -relay-)
|
||||
(call %init_peer_id% ("service" "test1") [] res-0)
|
||||
)
|
||||
(call %init_peer_id% ("service" "test2") [res-0.$.one! res-0.$.one.val!] res)
|
||||
)
|
||||
(xor
|
||||
(call %init_peer_id% ("callbackSrv" "response") [res])
|
||||
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 1])
|
||||
)
|
||||
)
|
||||
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 2])
|
||||
)
|
||||
`
|
||||
return callFunction(
|
||||
args,
|
||||
{
|
||||
"functionName" : "test",
|
||||
"arrow" : {
|
||||
"tag" : "arrow",
|
||||
"domain" : {
|
||||
"tag" : "labeledProduct",
|
||||
"fields" : {
|
||||
|
||||
}
|
||||
},
|
||||
"codomain" : {
|
||||
"tag" : "unlabeledProduct",
|
||||
"items" : [
|
||||
{
|
||||
"tag" : "struct",
|
||||
"name" : "NestedStruct",
|
||||
"fields" : {
|
||||
"one" : {
|
||||
"tag" : "struct",
|
||||
"name" : "NestedType",
|
||||
"fields" : {
|
||||
"val" : {
|
||||
"tag" : "scalar",
|
||||
"name" : "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"names" : {
|
||||
"relay" : "-relay-",
|
||||
"getDataSrv" : "getDataSrv",
|
||||
"callbackSrv" : "callbackSrv",
|
||||
"responseSrv" : "callbackSrv",
|
||||
"responseFnName" : "response",
|
||||
"errorHandlingSrv" : "errorHandlingSrv",
|
||||
"errorFnName" : "error"
|
||||
}
|
||||
},
|
||||
script
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
export type Test3Result = { val: string; }
|
||||
export function test3(
|
||||
config?: {ttl?: number}
|
||||
): Promise<Test3Result>;
|
||||
|
||||
export function test3(
|
||||
peer: FluencePeer,
|
||||
config?: {ttl?: number}
|
||||
): Promise<Test3Result>;
|
||||
|
||||
export function test3(...args: any) {
|
||||
|
||||
let script = `
|
||||
(xor
|
||||
(seq
|
||||
(seq
|
||||
(call %init_peer_id% ("getDataSrv" "-relay-") [] -relay-)
|
||||
(call %init_peer_id% ("service" "test1") [] res)
|
||||
)
|
||||
(xor
|
||||
(call %init_peer_id% ("callbackSrv" "response") [res.$.one!])
|
||||
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 1])
|
||||
)
|
||||
)
|
||||
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 2])
|
||||
)
|
||||
`
|
||||
return callFunction(
|
||||
args,
|
||||
{
|
||||
"functionName" : "test3",
|
||||
"arrow" : {
|
||||
"tag" : "arrow",
|
||||
"domain" : {
|
||||
"tag" : "labeledProduct",
|
||||
"fields" : {
|
||||
|
||||
}
|
||||
},
|
||||
"codomain" : {
|
||||
"tag" : "unlabeledProduct",
|
||||
"items" : [
|
||||
{
|
||||
"tag" : "struct",
|
||||
"name" : "NestedType",
|
||||
"fields" : {
|
||||
"val" : {
|
||||
"tag" : "scalar",
|
||||
"name" : "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"names" : {
|
||||
"relay" : "-relay-",
|
||||
"getDataSrv" : "getDataSrv",
|
||||
"callbackSrv" : "callbackSrv",
|
||||
"responseSrv" : "callbackSrv",
|
||||
"responseFnName" : "response",
|
||||
"errorHandlingSrv" : "errorHandlingSrv",
|
||||
"errorFnName" : "error"
|
||||
}
|
||||
},
|
||||
script
|
||||
)
|
||||
}
|
@ -3,7 +3,7 @@
|
||||
* 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.7.4-SNAPSHOT
|
||||
* Aqua version: 0.7.4-336
|
||||
*
|
||||
*/
|
||||
import { Fluence, FluencePeer } from '@fluencelabs/fluence';
|
||||
|
@ -3,7 +3,7 @@
|
||||
* 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.7.4-SNAPSHOT
|
||||
* Aqua version: 0.7.4-336
|
||||
*
|
||||
*/
|
||||
import { Fluence, FluencePeer } from '@fluencelabs/fluence';
|
||||
|
@ -3,7 +3,7 @@
|
||||
* 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.7.4-SNAPSHOT
|
||||
* Aqua version: 0.7.4-336
|
||||
*
|
||||
*/
|
||||
import { Fluence, FluencePeer } from '@fluencelabs/fluence';
|
||||
|
@ -3,7 +3,7 @@
|
||||
* 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.7.4-SNAPSHOT
|
||||
* Aqua version: 0.7.4-336
|
||||
*
|
||||
*/
|
||||
import { Fluence, FluencePeer } from '@fluencelabs/fluence';
|
||||
|
@ -3,7 +3,7 @@
|
||||
* 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.7.4-SNAPSHOT
|
||||
* Aqua version: 0.7.4-336
|
||||
*
|
||||
*/
|
||||
import { Fluence, FluencePeer } from '@fluencelabs/fluence';
|
||||
|
@ -3,7 +3,7 @@
|
||||
* 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.7.4-SNAPSHOT
|
||||
* Aqua version: 0.7.4-336
|
||||
*
|
||||
*/
|
||||
import { Fluence, FluencePeer } from '@fluencelabs/fluence';
|
||||
|
@ -3,7 +3,7 @@
|
||||
* 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.7.4-SNAPSHOT
|
||||
* Aqua version: 0.7.4-336
|
||||
*
|
||||
*/
|
||||
import { Fluence, FluencePeer } from '@fluencelabs/fluence';
|
||||
|
@ -3,7 +3,7 @@
|
||||
* 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.7.4-SNAPSHOT
|
||||
* Aqua version: 0.7.4-336
|
||||
*
|
||||
*/
|
||||
import { Fluence, FluencePeer } from '@fluencelabs/fluence';
|
||||
|
@ -3,7 +3,7 @@
|
||||
* 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.7.4-SNAPSHOT
|
||||
* Aqua version: 0.7.4-336
|
||||
*
|
||||
*/
|
||||
import { Fluence, FluencePeer } from '@fluencelabs/fluence';
|
||||
@ -89,7 +89,7 @@ export function recursiveStream(...args: any) {
|
||||
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 1])
|
||||
)
|
||||
)
|
||||
(null)
|
||||
(call %init_peer_id% ("op" "noop") [])
|
||||
)
|
||||
(ap "success" $result)
|
||||
)
|
||||
|
@ -3,7 +3,7 @@
|
||||
* 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.7.4-SNAPSHOT
|
||||
* Aqua version: 0.7.4-336
|
||||
*
|
||||
*/
|
||||
import { Fluence, FluencePeer } from '@fluencelabs/fluence';
|
||||
|
@ -3,7 +3,7 @@
|
||||
* 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.7.4-SNAPSHOT
|
||||
* Aqua version: 0.7.4-336
|
||||
*
|
||||
*/
|
||||
import { Fluence, FluencePeer } from '@fluencelabs/fluence';
|
||||
|
@ -3,7 +3,7 @@
|
||||
* 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.7.4-SNAPSHOT
|
||||
* Aqua version: 0.7.4-336
|
||||
*
|
||||
*/
|
||||
import { Fluence, FluencePeer } from '@fluencelabs/fluence';
|
||||
|
@ -3,7 +3,7 @@
|
||||
* 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.7.4-SNAPSHOT
|
||||
* Aqua version: 0.7.4-336
|
||||
*
|
||||
*/
|
||||
import { Fluence, FluencePeer } from '@fluencelabs/fluence';
|
||||
|
@ -3,7 +3,7 @@
|
||||
* 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.7.4-SNAPSHOT
|
||||
* Aqua version: 0.7.4-336
|
||||
*
|
||||
*/
|
||||
import { Fluence, FluencePeer } from '@fluencelabs/fluence';
|
||||
|
@ -3,7 +3,7 @@
|
||||
* 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.7.4-SNAPSHOT
|
||||
* Aqua version: 0.7.4-336
|
||||
*
|
||||
*/
|
||||
import { Fluence, FluencePeer } from '@fluencelabs/fluence';
|
||||
|
@ -3,7 +3,7 @@
|
||||
* 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.7.4-SNAPSHOT
|
||||
* Aqua version: 0.7.4-336
|
||||
*
|
||||
*/
|
||||
import { Fluence, FluencePeer } from '@fluencelabs/fluence';
|
||||
|
@ -3,7 +3,7 @@
|
||||
* 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.7.4-SNAPSHOT
|
||||
* Aqua version: 0.7.4-336
|
||||
*
|
||||
*/
|
||||
import { Fluence, FluencePeer } from '@fluencelabs/fluence';
|
||||
|
@ -3,7 +3,7 @@
|
||||
* 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.7.4-SNAPSHOT
|
||||
* Aqua version: 0.7.4-336
|
||||
*
|
||||
*/
|
||||
import { Fluence, FluencePeer } from '@fluencelabs/fluence';
|
||||
|
@ -3,7 +3,7 @@
|
||||
* 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.7.4-SNAPSHOT
|
||||
* Aqua version: 0.7.4-336
|
||||
*
|
||||
*/
|
||||
import { Fluence, FluencePeer } from '@fluencelabs/fluence';
|
||||
|
@ -3,7 +3,7 @@
|
||||
* 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.7.4-SNAPSHOT
|
||||
* Aqua version: 0.7.4-336
|
||||
*
|
||||
*/
|
||||
import { Fluence, FluencePeer } from '@fluencelabs/fluence';
|
||||
|
@ -3,7 +3,7 @@
|
||||
* 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.7.4-SNAPSHOT
|
||||
* Aqua version: 0.7.4-336
|
||||
*
|
||||
*/
|
||||
import { Fluence, FluencePeer } from '@fluencelabs/fluence';
|
||||
|
@ -1,25 +1,41 @@
|
||||
import {krasnodar, stage, testNet} from '@fluencelabs/fluence-network-environment';
|
||||
|
||||
import { krasnodar, stage, testNet } from '@fluencelabs/fluence-network-environment';
|
||||
import { defaultConfig } from '@fluencelabs/fluence/dist/internal/ephemeral';
|
||||
|
||||
export const krasnodarConfig = {
|
||||
relays: krasnodar,
|
||||
externalAddressesRelay1: ['/ip4/164.90.171.139/tcp/7770', '/ip4/164.90.171.139/tcp/9990/ws'],
|
||||
externalAddressesRelay2: ["/ip4/164.90.164.229/tcp/7001", "/ip4/164.90.164.229/tcp/9001/ws"],
|
||||
tryCatchError: "Local service error, ret_code is 1, error message is '\"Service with id 'unex' not found (function getStr)\"'"
|
||||
}
|
||||
externalAddressesRelay2: ['/ip4/164.90.164.229/tcp/7001', '/ip4/164.90.164.229/tcp/9001/ws'],
|
||||
tryCatchError:
|
||||
"Local service error, ret_code is 1, error message is '\"Service with id 'unex' not found (function getStr)\"'",
|
||||
};
|
||||
|
||||
export const stageConfig = {
|
||||
relays: stage,
|
||||
externalAddressesRelay1: ["/ip4/134.209.186.43/tcp/7001", "/ip4/134.209.186.43/tcp/9001/ws"],
|
||||
externalAddressesRelay2: ["/ip4/134.209.186.43/tcp/7770", "/ip4/134.209.186.43/tcp/9990/ws"],
|
||||
tryCatchError: "Local service error, ret_code is 1, error message is '\"Service with id 'unex' not found (function getStr)\"'"
|
||||
}
|
||||
externalAddressesRelay1: ['/ip4/134.209.186.43/tcp/7001', '/ip4/134.209.186.43/tcp/9001/ws'],
|
||||
externalAddressesRelay2: ['/ip4/134.209.186.43/tcp/7770', '/ip4/134.209.186.43/tcp/9990/ws'],
|
||||
tryCatchError:
|
||||
"Local service error, ret_code is 1, error message is '\"Service with id 'unex' not found (function getStr)\"'",
|
||||
};
|
||||
|
||||
export const testNetConfig = {
|
||||
relays: testNet,
|
||||
externalAddressesRelay1: ["/ip4/165.227.164.206/tcp/7001", "/ip4/165.227.164.206/tcp/9001/ws"],
|
||||
externalAddressesRelay2: ["/ip4/142.93.169.49/tcp/7001", "/ip4/142.93.169.49/tcp/9001/ws"],
|
||||
tryCatchError: "Local service error, ret_code is 1, error message is '\"Service with id 'unex' not found (function getStr)\"'"
|
||||
}
|
||||
externalAddressesRelay1: ['/ip4/165.227.164.206/tcp/7001', '/ip4/165.227.164.206/tcp/9001/ws'],
|
||||
externalAddressesRelay2: ['/ip4/142.93.169.49/tcp/7001', '/ip4/142.93.169.49/tcp/9001/ws'],
|
||||
tryCatchError:
|
||||
"Local service error, ret_code is 1, error message is '\"Service with id 'unex' not found (function getStr)\"'",
|
||||
};
|
||||
|
||||
export const config = stageConfig
|
||||
export const ephemeralConfig = {
|
||||
relays: defaultConfig.peers.map((x) => ({
|
||||
peerId: x.peerId,
|
||||
multiaddr: 'dontcare',
|
||||
})),
|
||||
externalAddressesRelay1: [],
|
||||
externalAddressesRelay2: [],
|
||||
tryCatchError:
|
||||
"Local service error, ret_code is 1, error message is '\"Service with id 'unex' not found (function getStr)\"'",
|
||||
};
|
||||
|
||||
export const isEphemeral = false;
|
||||
|
||||
export const config = isEphemeral ? ephemeralConfig : stageConfig;
|
||||
|
@ -25,7 +25,7 @@ const main = async () => {
|
||||
console.log(result);
|
||||
|
||||
// uncomment to play with examples
|
||||
// await runExamples()
|
||||
// await runExamples();
|
||||
|
||||
process.exit(0);
|
||||
};
|
||||
|
@ -33,7 +33,7 @@ import { declareCall } from './examples/declareCall';
|
||||
import { genOptions } from './examples/optionsCall';
|
||||
import { config } from './config';
|
||||
|
||||
const relays = config.relays
|
||||
const relays = config.relays;
|
||||
|
||||
export const runExamples = async () => {
|
||||
// stop the currently running peer to start with the clean state
|
||||
|
Loading…
x
Reference in New Issue
Block a user