Create a new CosmJS transaction client
CosmJS SigningStargateClient instance
Optionaloptions: CosmjsTxClientOptionsOptional configuration
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.
Signed transaction bytes
Broadcast mode ("sync", "async", or "block")
Broadcast result with transaction hash and height
Disconnect and clean up resources.
Should be called when the client is no longer needed to properly close connections.
Get the underlying SigningStargateClient.
Provides access to the raw CosmJS client for advanced use cases not covered by this wrapper.
The underlying SigningStargateClient instance
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.
Transaction hash (hex string)
Transaction response with full details including events
Sign and broadcast a transaction in one step.
This is the recommended method for sending transactions. It handles the entire transaction lifecycle: signing with the wallet, broadcasting to the chain, and waiting for confirmation (in "block" mode).
Address of the transaction signer
Array of Cosmos messages to include in the transaction
Transaction fee (gas amount and denomination)
Optionalmemo: stringOptional transaction memo
OptionaltimeoutHeight: bigintOptional transaction timeout height
Broadcast result with full delivery response
const result = await client.signAndBroadcast(
myAddress,
[msgRegisterAction],
{ amount: [{ denom: "ulume", amount: "10000" }], gas: "300000" },
"Register cascade action"
);
if (result.response.code === 0) {
console.log("Success! TX:", result.txHash);
} else {
console.error("Failed:", result.response.rawLog);
}
Simulate a transaction to estimate gas usage.
Performs a dry-run of the transaction to estimate the gas required. The returned gas amount should typically be multiplied by a safety factor (e.g., 1.3-1.5) to account for state changes between simulation and execution.
Returns null if simulation fails due to type resolution errors (indicating
that the gRPC reflection service is unavailable). In this case, the caller
should use a fallback gas estimate.
Signer's address
Transaction messages to simulate
Transaction memo (optional)
Estimated gas amount, or null if simulation is unavailable
CosmJS-based transaction client for Lumera blockchain.
Wraps CosmJS's SigningStargateClient to provide transaction simulation, signing, and broadcasting capabilities. Handles gas estimation and transaction lifecycle management.
Example