109 lines
2.7 KiB
TypeScript
Raw Normal View History

2021-10-07 13:55:10 +03:00
/**
*
* 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
2021-11-15 16:15:29 +03:00
* Aqua version: 0.5.0-SNAPSHOT
2021-10-07 13:55:10 +03:00
*
*/
import { Fluence, FluencePeer } from '@fluencelabs/fluence';
import {
CallParams,
callFunction,
registerService,
} from '@fluencelabs/fluence/dist/internal/compilerSupport/v2';
2021-10-07 13:55:10 +03:00
2021-10-19 13:25:29 +03:00
2021-10-07 13:55:10 +03:00
// Services
export interface PrintlnDef {
2021-10-26 19:10:39 +03:00
print: (arg0: string, callParams: CallParams<'arg0'>) => void | Promise<void>;
2021-10-07 13:55:10 +03:00
}
export function registerPrintln(service: PrintlnDef): void;
export function registerPrintln(serviceId: string, service: PrintlnDef): void;
export function registerPrintln(peer: FluencePeer, service: PrintlnDef): void;
export function registerPrintln(peer: FluencePeer, serviceId: string, service: PrintlnDef): void;
2021-10-19 13:25:29 +03:00
2021-10-07 13:55:10 +03:00
export function registerPrintln(...args: any) {
registerService(
args,
{
"defaultServiceId" : "println-service-id",
"functions" : [
{
"functionName" : "print",
"argDefs" : [
{
"name" : "arg0",
"argType" : {
"tag" : "primitive"
}
}
],
"returnType" : {
"tag" : "void"
}
2021-10-07 13:55:10 +03:00
}
]
}
);
2021-10-07 13:55:10 +03:00
}
2021-10-19 13:25:29 +03:00
2021-10-07 13:55:10 +03:00
// Functions
2021-10-19 13:25:29 +03:00
2021-10-07 13:55:10 +03:00
2021-11-25 14:44:14 +03:00
export function print(
str: string,
config?: {ttl?: number}
): Promise<void>;
export function print(
peer: FluencePeer,
str: string,
config?: {ttl?: number}
): Promise<void>;
2021-10-07 13:55:10 +03:00
export function print(...args: any) {
let script = `
2021-11-25 14:44:14 +03:00
(xor
2021-10-07 13:55:10 +03:00
(seq
(seq
(call %init_peer_id% ("getDataSrv" "-relay-") [] -relay-)
(call %init_peer_id% ("getDataSrv" "str") [] str)
)
(call %init_peer_id% ("println-service-id" "print") [str])
)
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 1])
)
`
return callFunction(
args,
{
"functionName" : "print",
"returnType" : {
"tag" : "void"
},
"argDefs" : [
{
"name" : "str",
"argType" : {
"tag" : "primitive"
}
}
],
"names" : {
"relay" : "-relay-",
"getDataSrv" : "getDataSrv",
"callbackSrv" : "callbackSrv",
"responseSrv" : "callbackSrv",
"responseFnName" : "response",
"errorHandlingSrv" : "errorHandlingSrv",
"errorFnName" : "error"
}
},
script
)
2021-10-07 13:55:10 +03:00
}