/* eslint-disable */ // @ts-nocheck /** * * This file is auto-generated. Do not edit manually: changes may be erased. * Generated by Aqua compiler: https://github.com/fluencelabs/aqua/. * If you find any bugs, please write an issue on GitHub: https://github.com/fluencelabs/aqua/issues * Aqua version: 0.10.1 * */ import type { IFluenceClient as IFluenceClient$$, CallParams as CallParams$$ } from '@fluencelabs/js-client.api'; import { v5_callFunction as callFunction$$, v5_registerService as registerService$$, } from '@fluencelabs/js-client.api'; // Services export interface CoServiceDef { call: (callParams: CallParams$$) => string | Promise; } export function registerCoService(service: CoServiceDef): void; export function registerCoService(serviceId: string, service: CoServiceDef): void; export function registerCoService(peer: IFluenceClient$$, service: CoServiceDef): void; export function registerCoService(peer: IFluenceClient$$, serviceId: string, service: CoServiceDef): void; export function registerCoService(...args: any) { registerService$$( args, { "defaultServiceId" : "coservice-id", "functions" : { "tag" : "labeledProduct", "fields" : { "call" : { "tag" : "arrow", "domain" : { "tag" : "nil" }, "codomain" : { "tag" : "unlabeledProduct", "items" : [ { "tag" : "scalar", "name" : "string" } ] } } } } } ); } // Functions export function coFunc( node: string, c: (arg0: { air_version: string; external_addresses: string[]; node_version: string; }, callParams: CallParams$$<'arg0'>) => void | Promise, config?: {ttl?: number} ): Promise; export function coFunc( peer: IFluenceClient$$, node: string, c: (arg0: { air_version: string; external_addresses: string[]; node_version: string; }, callParams: CallParams$$<'arg0'>) => void | Promise, config?: {ttl?: number} ): Promise; export function coFunc(...args: any) { let script = ` (xor (seq (seq (seq (seq (seq (call %init_peer_id% ("getDataSrv" "-relay-") [] -relay-) (call %init_peer_id% ("getDataSrv" "node") [] node) ) (call %init_peer_id% ("coservice-id" "call") [] y) ) (call -relay- ("op" "noop") []) ) (xor (seq (seq (call node ("peer" "identify") [] t) (par (seq (call -relay- ("op" "noop") []) (xor (call %init_peer_id% ("callbackSrv" "c") [t]) (call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 1]) ) ) (null) ) ) (call -relay- ("op" "noop") []) ) (seq (call -relay- ("op" "noop") []) (call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 2]) ) ) ) (call %init_peer_id% ("coservice-id" "call") [] x) ) (call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 3]) ) ` return callFunction$$( args, { "functionName" : "coFunc", "arrow" : { "tag" : "arrow", "domain" : { "tag" : "labeledProduct", "fields" : { "node" : { "tag" : "scalar", "name" : "string" }, "c" : { "tag" : "arrow", "domain" : { "tag" : "unlabeledProduct", "items" : [ { "tag" : "struct", "name" : "Info", "fields" : { "air_version" : { "tag" : "scalar", "name" : "string" }, "external_addresses" : { "tag" : "array", "type" : { "tag" : "scalar", "name" : "string" } }, "node_version" : { "tag" : "scalar", "name" : "string" } } } ] }, "codomain" : { "tag" : "nil" } } } }, "codomain" : { "tag" : "nil" } }, "names" : { "relay" : "-relay-", "getDataSrv" : "getDataSrv", "callbackSrv" : "callbackSrv", "responseSrv" : "callbackSrv", "responseFnName" : "response", "errorHandlingSrv" : "errorHandlingSrv", "errorFnName" : "error" } }, script ) } /* eslint-enable */