Skip to main content
This page covers gas configuration for CosmWasm transactions, building custom encode objects, working with the CosmWasm Binary type, and using the low-level wasm query extension for fine-grained pagination.

Gas Estimation

Auto Gas

When you pass "auto" as the fee, the client simulates the transaction and applies a gas multiplier: You can pass a numeric multiplier instead of "auto" for finer control:

Static Fees

For full control, provide an explicit fee object:

Gas Simulation

Simulate a transaction to estimate gas without broadcasting:

Working with Binary Data

The toBinary and fromBinary helpers convert JavaScript objects to and from the base64-encoded JSON format used by CosmWasm Binary fields:
This is useful when composing nested messages, such as sending a sub-message through a contract:

Building Custom Messages

For advanced use cases, construct CosmWasm encode objects directly and broadcast them via signAndBroadcast:

Mixing CosmWasm and Cosmos SDK Messages

This approach lets you combine contract calls with standard Cosmos SDK messages in a single atomic transaction:

Wasm Query Extension

For fine-grained control over pagination or when building a custom query client, use the wasm extension directly instead of the high-level CosmWasmClient methods:

Available Extension Methods

Next Steps

CosmWasm Overview

Back to the CosmWasm guide overview.

Stargate vs CosmWasm

Comparing the two client families and when to use each.