From 82b31235df79589aaaf0e70f06b90b7661a2157c Mon Sep 17 00:00:00 2001 From: folex <0xdxdy@gmail.com> Date: Thu, 11 Feb 2021 22:36:02 +0300 Subject: [PATCH] ttl --- src/internal/builtins.ts | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/internal/builtins.ts b/src/internal/builtins.ts index d872b5ea2..7fb70a232 100644 --- a/src/internal/builtins.ts +++ b/src/internal/builtins.ts @@ -65,7 +65,7 @@ const requestResponse = async ( * @param { FluenceClient } client - The Fluence Client instance. * @returns { Array } - list of available modules on the connected relay */ -export const getModules = async (client: FluenceClient): Promise => { +export const getModules = async (client: FluenceClient, ttl?: number): Promise => { let callbackFn = "getModules" const particle = new Particle( ` @@ -78,6 +78,7 @@ export const getModules = async (client: FluenceClient): Promise => { __relay: client.relayPeerId, myPeerId: client.selfPeerId, }, + ttl ); return sendParticleAsFetch(client, particle, callbackFn); @@ -88,7 +89,7 @@ export const getModules = async (client: FluenceClient): Promise => { * @param { FluenceClient } client - The Fluence Client instance. * @returns { Array } - list of available modules on the connected relay */ -export const getInterfaces = async (client: FluenceClient): Promise => { +export const getInterfaces = async (client: FluenceClient, ttl?: number): Promise => { let callbackFn = "getInterfaces" const particle = new Particle( ` @@ -101,6 +102,7 @@ export const getInterfaces = async (client: FluenceClient): Promise => __relay: client.relayPeerId, myPeerId: client.selfPeerId, }, + ttl ); return sendParticleAsFetch(client, particle, callbackFn); @@ -118,6 +120,7 @@ export const uploadModule = async ( name: string, moduleBase64: string, config?: ModuleConfig, + ttl?: number, ): Promise => { if (!config) { config = { @@ -146,7 +149,7 @@ export const uploadModule = async ( ) `; - return sendParticleAsFetch(client, new Particle(script, data), 'getModules', "_callback"); + return sendParticleAsFetch(client, new Particle(script, data, ttl), 'getModules', "_callback"); }; /**