mukan-ignite/docs/versioned_docs/version-v29/07-packages/cosmosclient.md
Mukan Erkin Törük 26b204bd04
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
feat: fork Ignite CLI v29 as Mukan Ignite — remove cosmos-sdk restrictions
2026-05-11 03:31:37 +03:00

43 lines
1.6 KiB
Markdown

---
sidebar_position: 1
title: Blockchain Client (cosmosclient)
slug: /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](https://pkg.go.dev/github.com/ignite/cli/v29/ignite/pkg/cosmosclient).
## 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) Option`
- `WithHome(path string) Option`
- `WithKeyringBackend(backend cosmosaccount.KeyringBackend) Option`
- `WithGas(gas string) Option`
- `WithGasPrices(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 `Client` instance with node and keyring options, then reuse it across operations.
- Call `CreateTxWithOptions` or `BroadcastTx` depending on whether you need fine-grained tx overrides.
- Use `WaitForTx`, `WaitForNextBlock`, or `WaitForBlockHeight` for deterministic flows in tests/automation.
## Basic import
```go
import "github.com/ignite/cli/v29/ignite/pkg/cosmosclient"
```