diff --git a/docs/classes/FluencePeer.html b/docs/classes/FluencePeer.html index 4af9ac79..b9e01a1c 100644 --- a/docs/classes/FluencePeer.html +++ b/docs/classes/FluencePeer.html @@ -121,7 +121,7 @@
  • @@ -146,7 +146,7 @@
  • @@ -345,7 +345,7 @@
  • @@ -367,7 +367,7 @@
  • @@ -399,7 +399,7 @@
  • @@ -422,7 +422,7 @@
  • diff --git a/docs/classes/KeyPair.html b/docs/classes/KeyPair.html index 95333481..4ec667b5 100644 --- a/docs/classes/KeyPair.html +++ b/docs/classes/KeyPair.html @@ -112,7 +112,7 @@
  • Parameters

    @@ -134,7 +134,7 @@
    Libp2pPeerId: PeerId
    @@ -156,7 +156,7 @@
  • Returns Uint8Array

    @@ -174,7 +174,7 @@
  • @@ -205,7 +205,7 @@
  • diff --git a/docs/interfaces/CallParams.html b/docs/interfaces/CallParams.html index 4998af14..9cf99701 100644 --- a/docs/interfaces/CallParams.html +++ b/docs/interfaces/CallParams.html @@ -118,7 +118,7 @@
    initPeerId: string
    @@ -133,7 +133,7 @@
    particleId: string
    @@ -148,7 +148,7 @@
    signature: string
    @@ -163,7 +163,7 @@
    tetraplets: {[ key in string]: SecurityTetraplet[] }
    @@ -178,7 +178,7 @@
    timestamp: number
    @@ -193,7 +193,7 @@
    ttl: number
    diff --git a/docs/interfaces/PeerConfig.html b/docs/interfaces/PeerConfig.html index 750ed8b1..90cc3800 100644 --- a/docs/interfaces/PeerConfig.html +++ b/docs/interfaces/PeerConfig.html @@ -107,7 +107,7 @@
    KeyPair: KeyPair
    @@ -123,7 +123,7 @@
    avmLogLevel: LogLevel
    @@ -138,7 +138,7 @@
    checkConnectionTimeoutMs: number
    @@ -155,7 +155,7 @@
    connectTo: string | Multiaddr | Node
    @@ -177,15 +177,14 @@
    defaultTtlMs: number

    Sets the default TTL for all particles originating from the peer with no TTL specified. If the originating particle's TTL is defined then that value will be used - If the option is not set default TTL will be 7000 - Value 0 (zero) is treated as if the option was not set

    + If the option is not set default TTL will be 7000

    @@ -195,7 +194,7 @@
    dialTimeoutMs: number
    @@ -210,7 +209,7 @@
    skipCheckConnection: boolean
    diff --git a/docs/interfaces/PeerStatus.html b/docs/interfaces/PeerStatus.html index a2163a2c..029aee15 100644 --- a/docs/interfaces/PeerStatus.html +++ b/docs/interfaces/PeerStatus.html @@ -104,7 +104,7 @@
    isConnected: Boolean
    @@ -119,7 +119,7 @@
    isInitialized: Boolean
    @@ -134,7 +134,7 @@
    peerId: string
    @@ -149,7 +149,7 @@
    relayPeerId: string
    diff --git a/docs/modules.html b/docs/modules.html index c4a55fa0..26259d7b 100644 --- a/docs/modules.html +++ b/docs/modules.html @@ -106,7 +106,7 @@
    AvmLoglevel: LogLevel
    @@ -122,7 +122,7 @@
    PeerIdB58: string
    @@ -140,7 +140,7 @@
    Fluence: { getPeer: () => FluencePeer; getStatus: () => PeerStatus; start: (config?: PeerConfig) => Promise<void>; stop: () => Promise<void> } = ...
    @@ -260,7 +260,7 @@
  • Parameters

    diff --git a/src/internal/FluencePeer.ts b/src/internal/FluencePeer.ts index 2f8717da..285db03a 100644 --- a/src/internal/FluencePeer.ts +++ b/src/internal/FluencePeer.ts @@ -99,7 +99,6 @@ export interface PeerConfig { * Sets the default TTL for all particles originating from the peer with no TTL specified. * If the originating particle's TTL is defined then that value will be used * If the option is not set default TTL will be 7000 - * Value 0 (zero) is treated as if the option was not set */ defaultTtlMs?: number; } @@ -177,7 +176,10 @@ export class FluencePeer { this._keyPair = await KeyPair.randomEd25519(); } - this._defaultTTL = config?.defaultTtlMs || DEFAULT_TTL; + this._defaultTTL = + config?.defaultTtlMs !== undefined // don't miss value 0 (zero) + ? config?.defaultTtlMs + : DEFAULT_TTL; this._interpreter = await createInterpreter(config?.avmLogLevel || 'off'); diff --git a/src/internal/compilerSupport/v2.ts b/src/internal/compilerSupport/v2.ts index f45cddae..0a7d8088 100644 --- a/src/internal/compilerSupport/v2.ts +++ b/src/internal/compilerSupport/v2.ts @@ -188,6 +188,17 @@ interface ServiceDef { functions: Array; } +/** + * Options to configure Aqua function execution + */ +export interface FnConfig { + /** + * Sets the TTL (time to live) for particle responsible for the function execution + * If the option is not set the default TTL from FluencePeer config is used + */ + ttl?: number; +} + /** * Convenience function to support Aqua `func` generation backend * The compiler only need to generate a call the function and provide the corresponding definitions and the air script @@ -437,7 +448,7 @@ const extractFunctionArgs = ( numberOfExpectedArgs: number, ): { peer: FluencePeer; - config?: { ttl?: number }; + config?: FnConfig; args: any[]; } => { let peer: FluencePeer;