Some checks are pending
Docs Deploy / build_and_deploy (push) Waiting to run
Generate Docs / cli (push) Waiting to run
Generate Config Doc / cli (push) Waiting to run
Go formatting / go-formatting (push) Waiting to run
Check links / markdown-link-check (push) Waiting to run
Integration / pre-test (push) Waiting to run
Integration / test on (push) Blocked by required conditions
Integration / status (push) Blocked by required conditions
Lint / Lint Go code (push) Waiting to run
Test / test (ubuntu-latest) (push) Waiting to run
1.6 KiB
1.6 KiB
| sidebar_position | title | slug |
|---|---|---|
| 1 | Blockchain Client (cosmosclient) | /packages/cosmosclient |
Blockchain Client (cosmosclient)
The cosmosclient package provides a high-level client for querying Cosmos SDK chains and building/signing/broadcasting transactions.
For full API details, see the
cosmosclient Go package documentation.
When to use
- Connect Ignite tooling to a running node for status and block queries.
- Build and broadcast SDK messages with shared gas/fees/keyring settings.
- Wait for transaction inclusion and inspect block transactions/events.
Key APIs
New(ctx context.Context, options ...Option) (Client, error)WithNodeAddress(addr string) OptionWithHome(path string) OptionWithKeyringBackend(backend cosmosaccount.KeyringBackend) OptionWithGas(gas string) OptionWithGasPrices(gasPrices string) Option(Client) BroadcastTx(ctx, account, msgs...) (Response, error)(Client) WaitForTx(ctx context.Context, hash string) (*ctypes.ResultTx, error)(Client) Status(ctx context.Context) (*ctypes.ResultStatus, error)(Client) LatestBlockHeight(ctx context.Context) (int64, error)
Common Tasks
- Initialize one
Clientinstance with node and keyring options, then reuse it across operations. - Call
CreateTxWithOptionsorBroadcastTxdepending on whether you need fine-grained tx overrides. - Use
WaitForTx,WaitForNextBlock, orWaitForBlockHeightfor deterministic flows in tests/automation.
Basic import
import "github.com/ignite/cli/v29/ignite/pkg/cosmosclient"