2021-10-22 16:32:45 +03:00
|
|
|
import { Fluence } from '@fluencelabs/fluence';
|
2022-03-14 13:14:39 +03:00
|
|
|
import {closureIn, closureBig, registerLocalSrv} from '../compiled/examples/closures';
|
2021-11-09 16:14:48 +03:00
|
|
|
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})
|
2022-03-14 13:14:39 +03:00
|
|
|
// const resOut = await closureOut(relays[5].peerId, {ttl: 15000})
|
|
|
|
// 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 13:14:39 +03:00
|
|
|
return [resIn, [], [], resBig]
|
2021-10-22 16:32:45 +03:00
|
|
|
}
|