From ceca3e5692f3c730b9c93e0838c8789508e576ba Mon Sep 17 00:00:00 2001 From: folex <0xdxdy@gmail.com> Date: Fri, 12 Feb 2021 18:27:21 +0300 Subject: [PATCH] Add ttl argument to some "builtin" functions (#17) --- 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 d872b5ea..7fb70a23 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"); }; /**