Files
aqua-playground/src/examples/closures.ts

30 lines
1009 B
TypeScript
Raw Normal View History

2021-10-22 16:32:45 +03:00
import { Fluence } from '@fluencelabs/fluence';
2022-08-02 18:14:38 +03:00
import {
closureIn,
closureOut,
closureBig,
registerLocalSrv,
closureOut2,
lng58Bug
} from '../compiled/examples/closures';
import { config } from '../config'
const relays = config.relays
2021-10-22 16:32:45 +03:00
2022-03-14 12:14:06 +03:00
export async function closuresCall(): Promise<[string, string[], string[], [string, string]]> {
2021-10-22 16:32:45 +03:00
const relayPeerId = Fluence.getPeer().getStatus().relayPeerId;
const selfPeerId = Fluence.getPeer().getStatus().peerId;
2021-11-04 13:13:26 +03:00
registerLocalSrv({inside: () => console.log("call inside")})
2021-10-22 16:32:45 +03:00
2021-11-04 13:13:26 +03:00
const resIn = await closureIn(relays[4].peerId, {ttl: 15000})
const resOut = await closureOut(relays[5].peerId, {ttl: 15000})
2022-03-14 12:14:06 +03:00
const resOut2 = await closureOut2(relays[5].peerId, {ttl: 15000})
2021-11-04 14:26:50 +03:00
const resBig = await closureBig(relays[4].peerId, relays[5].peerId, {ttl: 15000})
2021-11-04 13:13:26 +03:00
2022-03-14 12:14:06 +03:00
return [resIn, resOut.external_addresses, resOut2.external_addresses, resBig]
2022-08-02 18:14:38 +03:00
}
export async function lng58CBugCall(): Promise<string> {
return lng58Bug()
2021-10-22 16:32:45 +03:00
}