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

    Interface TxClient

    Transaction client interface.

    Provides methods for transaction simulation, broadcasting, and signing. Implementations handle the underlying transport (e.g., Tendermint RPC via CosmJS).

    interface TxClient {
        broadcast(
            signedTx: Uint8Array,
            mode?: "sync" | "async" | "block",
        ): Promise<{ height?: bigint; txHash: string }>;
        getTx?(txHash: string): Promise<DeliverTxResponse>;
        signAndBroadcast?(
            signerAddress: string,
            messages: readonly EncodeObject[],
            fee: StdFee,
            memo?: string,
            timeoutHeight?: bigint,
        ): Promise<{ height: bigint; response: DeliverTxResponse; txHash: string }>;
        simulate(
            address: string,
            msgs: readonly EncodeObject[],
            memo?: string,
        ): Promise<bigint | null>;
    }

    Implemented by

    Index

    Methods

    • Broadcast a pre-signed transaction.

      Sends a signed transaction to the blockchain. This is a low-level method; prefer using signAndBroadcast for most use cases.

      Parameters

      • signedTx: Uint8Array

        Signed transaction bytes

      • Optionalmode: "sync" | "async" | "block"

        Broadcast mode ("sync", "async", or "block")

      Returns Promise<{ height?: bigint; txHash: string }>

      Broadcast result with transaction hash and optional height

      If broadcast fails

    • Query a transaction by hash.

      Retrieves the full transaction details including events from the blockchain. This is useful for extracting information from transaction events after broadcasting.

      Parameters

      • txHash: string

        Transaction hash (hex string)

      Returns Promise<DeliverTxResponse>

      Transaction response with full details including events

      If the query fails or transaction is not found

    • Sign and broadcast a transaction in one step.

      This is the recommended method for sending transactions. Handles the entire transaction lifecycle: signing with the wallet and broadcasting to the chain.

      Parameters

      • signerAddress: string

        Address of the transaction signer

      • messages: readonly EncodeObject[]

        Array of Cosmos messages to include in the transaction

      • fee: StdFee

        Transaction fee (gas amount and denomination)

      • Optionalmemo: string

        Optional transaction memo

      • OptionaltimeoutHeight: bigint

        Optional transaction timeout height

      Returns Promise<{ height: bigint; response: DeliverTxResponse; txHash: string }>

      Broadcast result with full delivery response

      If signing or broadcasting fails

    • Simulate a transaction to estimate gas usage.

      Performs a dry-run of the transaction without broadcasting it, returning the estimated gas amount needed for execution.

      Returns null if simulation is unavailable (e.g., when gRPC reflection service is not available). In this case, callers should use a fallback gas estimate or rely on alternative broadcasting methods.

      Parameters

      • address: string

        Signer's address

      • msgs: readonly EncodeObject[]

        Transaction messages to simulate

      • Optionalmemo: string

        Optional transaction memo

      Returns Promise<bigint | null>

      Estimated gas amount, or null if simulation is unavailable

      If simulation fails for reasons other than unavailability