Skip to content

Commit ceca3e5

Browse files
authored
Add ttl argument to some "builtin" functions (#17)
1 parent 2fb5ffe commit ceca3e5

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/internal/builtins.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ const requestResponse = async <T>(
6565
* @param { FluenceClient } client - The Fluence Client instance.
6666
* @returns { Array<string> } - list of available modules on the connected relay
6767
*/
68-
export const getModules = async (client: FluenceClient): Promise<string[]> => {
68+
export const getModules = async (client: FluenceClient, ttl?: number): Promise<string[]> => {
6969
let callbackFn = "getModules"
7070
const particle = new Particle(
7171
`
@@ -78,6 +78,7 @@ export const getModules = async (client: FluenceClient): Promise<string[]> => {
7878
__relay: client.relayPeerId,
7979
myPeerId: client.selfPeerId,
8080
},
81+
ttl
8182
);
8283

8384
return sendParticleAsFetch(client, particle, callbackFn);
@@ -88,7 +89,7 @@ export const getModules = async (client: FluenceClient): Promise<string[]> => {
8889
* @param { FluenceClient } client - The Fluence Client instance.
8990
* @returns { Array<string> } - list of available modules on the connected relay
9091
*/
91-
export const getInterfaces = async (client: FluenceClient): Promise<string[]> => {
92+
export const getInterfaces = async (client: FluenceClient, ttl?: number): Promise<string[]> => {
9293
let callbackFn = "getInterfaces"
9394
const particle = new Particle(
9495
`
@@ -101,6 +102,7 @@ export const getInterfaces = async (client: FluenceClient): Promise<string[]> =>
101102
__relay: client.relayPeerId,
102103
myPeerId: client.selfPeerId,
103104
},
105+
ttl
104106
);
105107

106108
return sendParticleAsFetch(client, particle, callbackFn);
@@ -118,6 +120,7 @@ export const uploadModule = async (
118120
name: string,
119121
moduleBase64: string,
120122
config?: ModuleConfig,
123+
ttl?: number,
121124
): Promise<void> => {
122125
if (!config) {
123126
config = {
@@ -146,7 +149,7 @@ export const uploadModule = async (
146149
)
147150
`;
148151

149-
return sendParticleAsFetch(client, new Particle(script, data), 'getModules', "_callback");
152+
return sendParticleAsFetch(client, new Particle(script, data, ttl), 'getModules', "_callback");
150153
};
151154

152155
/**

0 commit comments

Comments
 (0)