@lumera/sdk-js
    Preparing search index...

    Class BlockchainActionAdapter

    Adapter implementing CascadeChainPort using a BlockchainClient.

    This adapter:

    • Fetches and caches action parameters with a configurable TTL
    • Provides a single-call transaction flow (simulate → sign → broadcast)
    • Maps blockchain responses to plain DTOs for Cascade
    const adapter = new BlockchainActionAdapter(blockchainClient, signerAddress, {
    paramsCacheTtlMs: 300000, // 5 minutes
    defaultGasPrice: "0.025ulume",
    gasMultiplier: 1.3
    });

    // Cascade can now use the adapter
    const params = await adapter.getActionParams();
    const outcome = await adapter.requestActionTx({
    actionId: 'my-action',
    msg: { data_hash: '...', ... }
    });

    Implements

    Index

    Constructors

    Methods

    • Get action module parameters with TTL caching and single-flight protection.

      This method caches the action parameters for the configured TTL to avoid repeated LCD queries. If multiple calls are made before the first completes, they will all wait for and share the same underlying fetch promise (single-flight).

      Returns Promise<CascadeActionParams>

      Action parameters including max_raptor_q_symbols

      If the query fails

    • Invalidate the cached action parameters.

      Forces the next call to getActionParams() to fetch fresh data from the blockchain. Useful if you know the parameters have changed on-chain.

      Returns void

    • Request an action transaction (single-call: simulate → sign → broadcast).

      This method orchestrates the complete transaction flow:

      1. Fetches the action fee from the blockchain based on file size
      2. Builds the RequestAction message with the provided payload
      3. Simulates the transaction to get the exact gas required
      4. Calculates the fee based on simulated gas and gas price
      5. Signs the transaction
      6. Broadcasts the transaction
      7. Returns the transaction outcome

      Parameters

      Returns Promise<TxOutcome>

      Transaction outcome with hash, height, code, gas, and fee

      If any step fails (simulation, signing, or broadcast)

      const outcome = await adapter.requestActionTx({
      actionId: 'cascade-123',
      msg: {
      data_hash: 'abc...',
      file_name: 'example.txt',
      rq_ids_ic: 100,
      signatures: 'sig...',
      public: false
      }
      }, 1024000); // 1MB file

      console.log(`TX ${outcome.txHash} succeeded with code ${outcome.code}`);