217 lines
6.4 KiB
JavaScript
Raw Normal View History

2023-02-09 14:07:18 +04: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
* Aqua version: 0.9.3
*
*/
import { FluencePeer } from '@fluencelabs/fluence';
import {
callFunction$$,
registerService$$,
} from '@fluencelabs/fluence/dist/internal/compilerSupport/v4.js';
// Services
export function registerLogger(...args) {
registerService$$(
args,
{
"defaultServiceId" : "logger",
"functions" : {
"tag" : "labeledProduct",
"fields" : {
"log" : {
"tag" : "arrow",
"domain" : {
"tag" : "labeledProduct",
"fields" : {
"s" : {
"tag" : "array",
"type" : {
"tag" : "scalar",
"name" : "string"
}
}
}
},
"codomain" : {
"tag" : "nil"
}
}
}
}
}
);
}
export function registerEthCaller(...args) {
registerService$$(
args,
{
"functions" : {
"tag" : "labeledProduct",
"fields" : {
"eth_call" : {
"tag" : "arrow",
"domain" : {
"tag" : "labeledProduct",
"fields" : {
"uri" : {
"tag" : "scalar",
"name" : "string"
},
"method" : {
"tag" : "scalar",
"name" : "string"
},
"json_args" : {
"tag" : "array",
"type" : {
"tag" : "scalar",
"name" : "string"
}
}
}
},
"codomain" : {
"tag" : "unlabeledProduct",
"items" : [
{
"tag" : "struct",
"name" : "JsonString",
"fields" : {
"error" : {
"tag" : "scalar",
"name" : "string"
},
"success" : {
"tag" : "scalar",
"name" : "bool"
},
"value" : {
"tag" : "scalar",
"name" : "string"
}
}
}
]
}
}
}
}
}
);
}
// Functions
export function call(...args) {
let script = `
(xor
(seq
(seq
(seq
(seq
(seq
(seq
(call %init_peer_id% ("getDataSrv" "-relay-") [] -relay-)
(call %init_peer_id% ("getDataSrv" "uri") [] uri)
)
(call %init_peer_id% ("getDataSrv" "method") [] method)
)
(call %init_peer_id% ("getDataSrv" "json_args") [] json_args)
)
(call %init_peer_id% ("getDataSrv" "serviceId") [] serviceId)
)
(xor
(call -relay- (serviceId "eth_call") [uri method json_args] res)
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 1])
)
)
(xor
(call %init_peer_id% ("callbackSrv" "response") [res])
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 2])
)
)
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 3])
)
`
return callFunction$$(
args,
{
"functionName" : "call",
"arrow" : {
"tag" : "arrow",
"domain" : {
"tag" : "labeledProduct",
"fields" : {
"uri" : {
"tag" : "scalar",
"name" : "string"
},
"method" : {
"tag" : "scalar",
"name" : "string"
},
"json_args" : {
"tag" : "array",
"type" : {
"tag" : "scalar",
"name" : "string"
}
},
"serviceId" : {
"tag" : "scalar",
"name" : "string"
}
}
},
"codomain" : {
"tag" : "unlabeledProduct",
"items" : [
{
"tag" : "struct",
"name" : "JsonString",
"fields" : {
"error" : {
"tag" : "scalar",
"name" : "string"
},
"success" : {
"tag" : "scalar",
"name" : "bool"
},
"value" : {
"tag" : "scalar",
"name" : "string"
}
}
}
]
}
},
"names" : {
"relay" : "-relay-",
"getDataSrv" : "getDataSrv",
"callbackSrv" : "callbackSrv",
"responseSrv" : "callbackSrv",
"responseFnName" : "response",
"errorHandlingSrv" : "errorHandlingSrv",
"errorFnName" : "error"
}
},
script
)
}