Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/docs/02-guide/08-state.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ In blockchain applications, state refers to the current data stored on the block

## Collections Package

IGNITE® scaffolds using the [`collections`](http://pkg.go.dev/cosmossdk.io/collections) package for module code. This package provides a type-safe and efficient way to set and query values from the module store.
IGNITE® scaffolds using the [`collections`](https://pkg.go.dev/cosmossdk.io/collections) package for module code. This package provides a type-safe and efficient way to set and query values from the module store.

### Key Features of Collections

Expand Down
51 changes: 51 additions & 0 deletions docs/docs/07-packages/chaincmd.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
---
sidebar_position: 7
title: Chain Command Builder (chaincmd)
slug: /packages/chaincmd
---

# Chain Command Builder (chaincmd)

The `chaincmd` package builds `step.Option` command definitions for Cosmos SDK daemon binaries (`simd`, `gaiad`, and others). It does not execute commands directly.

For full API details, see the
[`chaincmd` Go package documentation](https://pkg.go.dev/github.com/ignite/cli/v29/ignite/pkg/chaincmd).

## When to use

- Build consistent daemon command lines from typed options.
- Reuse command composition across services and tests.
- Keep chain binary-specific flags centralized.

## Key APIs

- `New(appCmd string, options ...Option) ChainCmd`
- `WithHome(home string) Option`
- `WithChainID(chainID string) Option`
- `InitCommand(moniker string, options ...string) step.Option`
- `BankSendCommand(fromAddress, toAddress, amount string, options ...BankSendOption) step.Option`

## Example

```go
package main

import (
"fmt"

"github.com/ignite/cli/v29/ignite/pkg/chaincmd"
"github.com/ignite/cli/v29/ignite/pkg/cmdrunner/step"
)

func main() {
cmd := chaincmd.New(
"simd",
chaincmd.WithHome("./.simapp"),
chaincmd.WithChainID("demo-1"),
)

initStep := step.New(cmd.InitCommand("validator"))
fmt.Println(initStep.Exec.Command)
fmt.Println(initStep.Exec.Args)
}
```
40 changes: 40 additions & 0 deletions docs/docs/07-packages/chaincmdrunner.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
---
sidebar_position: 4
title: Chain Command Runner (chaincmd/runner)
slug: /packages/chaincmdrunner
---

# Chain Command Runner (chaincmd/runner)

The `chaincmdrunner` package wraps chain binary commands into typed, higher-level operations (accounts, genesis setup, tx queries, node control).

For full API details, see the
[`chaincmdrunner` Go package documentation](https://pkg.go.dev/github.com/ignite/cli/v29/ignite/pkg/chaincmd/runner).

## When to use

- Execute chain lifecycle commands without manually assembling CLI arguments.
- Manage accounts and genesis setup from automation/test flows.
- Query transaction events using typed selectors instead of raw command output parsing.

## Key APIs

- `New(ctx context.Context, chainCmd chaincmd.ChainCmd, options ...Option) (Runner, error)`
- `(Runner) Init(ctx context.Context, moniker string, args ...string) error`
- `(Runner) Start(ctx context.Context, args ...string) error`
- `(Runner) AddAccount(ctx context.Context, name, mnemonic, coinType, accountNumber, addressIndex string) (Account, error)`
- `(Runner) AddGenesisAccount(ctx context.Context, address, coins string) error`
- `(Runner) QueryTxByEvents(ctx context.Context, selectors ...EventSelector) ([]Event, error)`
- `(Runner) WaitTx(ctx context.Context, txHash string, retryDelay time.Duration, maxRetry int) error`

## Common Tasks

- Build a `Runner` from a configured `chaincmd.ChainCmd` and then call `Init`/`Start` for local node workflows.
- Use `AddAccount`, `ListAccounts`, and `ShowAccount` to manage keyring state in scripted flows.
- Query and filter tx events with `NewEventSelector` plus `QueryTxByEvents`.

## Basic import

```go
import chaincmdrunner "github.com/ignite/cli/v29/ignite/pkg/chaincmd/runner"
```
43 changes: 43 additions & 0 deletions docs/docs/07-packages/chainregistry.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
---
sidebar_position: 3
title: Chain Registry Types (chainregistry)
slug: /packages/chainregistry
---

# Chain Registry Types (chainregistry)

The `chainregistry` package defines strongly-typed Go structs for Cosmos chain-registry data (`chain.json` and `assetlist.json`).

For full API details, see the
[`chainregistry` Go package documentation](https://pkg.go.dev/github.com/ignite/cli/v29/ignite/pkg/chainregistry).

## When to use

- Parse chain-registry JSON into typed values.
- Build tooling that reads chain metadata (APIs, fees, staking tokens, assets).
- Validate or transform registry documents before writing them back.

## Key APIs

- `type Chain struct{ ... }`
- `type APIs struct{ ... }`
- `type APIProvider struct{ ... }`
- `type AssetList struct{ ... }`
- `type Asset struct{ ... }`
- `type Fees struct{ ... }`
- `type Staking struct{ ... }`
- `type Codebase struct{ ... }`
- `type ChainStatus string`
- `type ChainType string`

## Common Tasks

- Decode `chain.json` data into a `Chain` value and inspect RPC/REST metadata.
- Decode `assetlist.json` into `AssetList` to access denom units and logo URIs.
- Use enum-like types (`ChainStatus`, `NetworkType`, `ChainType`) to keep metadata checks explicit.

## Basic import

```go
import "github.com/ignite/cli/v29/ignite/pkg/chainregistry"
```
43 changes: 43 additions & 0 deletions docs/docs/07-packages/cosmosaccount.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
---
sidebar_position: 2
title: Account Registry (cosmosaccount)
slug: /packages/cosmosaccount
---

# Account Registry (cosmosaccount)

The `cosmosaccount` package manages Cosmos keyring accounts (create/import/export/list/delete) with configurable backend and Bech32 settings.

For full API details, see the
[`cosmosaccount` Go package documentation](https://pkg.go.dev/github.com/ignite/cli/v29/ignite/pkg/cosmosaccount).

## When to use

- Manage CLI account keys in Ignite services and commands.
- Switch between `test`, `os`, and `memory` keyring backends.
- Resolve addresses/public keys from named keyring entries.

## Key APIs

- `New(options ...Option) (Registry, error)`
- `NewInMemory(options ...Option) (Registry, error)`
- `WithKeyringBackend(backend KeyringBackend) Option`
- `WithHome(path string) Option`
- `(Registry) Create(name string) (Account, mnemonic string, err error)`
- `(Registry) Import(name, secret, passphrase string) (Account, error)`
- `(Registry) Export(name, passphrase string) (key string, err error)`
- `(Registry) GetByName(name string) (Account, error)`
- `(Registry) List() ([]Account, error)`
- `(Account) Address(accPrefix string) (string, error)`

## Common Tasks

- Instantiate one `Registry` with backend/home options and reuse it for all key operations.
- Call `EnsureDefaultAccount` in setup paths that require a predictable signer account.
- Resolve addresses with `Account.Address(prefix)` when your app uses non-default Bech32 prefixes.

## Basic import

```go
import "github.com/ignite/cli/v29/ignite/pkg/cosmosaccount"
```
40 changes: 40 additions & 0 deletions docs/docs/07-packages/cosmosanalysis.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
---
sidebar_position: 13
title: Cosmos Source Analysis (cosmosanalysis)
slug: /packages/cosmosanalysis
---

# Cosmos Source Analysis (cosmosanalysis)

The `cosmosanalysis` package provides static analysis helpers for Cosmos SDK-based projects, especially for app structure and interface/embed discovery.

For full API details, see the
[`cosmosanalysis` Go package documentation](https://pkg.go.dev/github.com/ignite/cli/v29/ignite/pkg/cosmosanalysis).

## When to use

- Validate that a directory is a Cosmos chain project before running codegen.
- Locate key app files and embedded types in Cosmos app sources.
- Detect interface implementations across module files.

## Key APIs

- `IsChainPath(path string) error`
- `FindAppFilePath(chainRoot string) (path string, err error)`
- `ValidateGoMod(module *modfile.File) error`
- `FindImplementation(modulePath string, interfaceList []string) (found []string, err error)`
- `DeepFindImplementation(modulePath string, interfaceList []string) (found []string, err error)`
- `FindEmbed(modulePath string, targetEmbeddedTypes []string) (found []string, err error)`
- `FindEmbedInFile(n ast.Node, targetEmbeddedTypes []string) (found []string)`

## Common Tasks

- Call `IsChainPath` early to fail fast on unsupported project layouts.
- Use `FindAppFilePath` before AST transformations that require the chain app entrypoint.
- Use `FindImplementation`/`DeepFindImplementation` to verify generated modules are wired as expected.

## Basic import

```go
import "github.com/ignite/cli/v29/ignite/pkg/cosmosanalysis"
```
58 changes: 58 additions & 0 deletions docs/docs/07-packages/cosmosbuf.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
---
sidebar_position: 14
title: Buf Integration (cosmosbuf)
slug: /packages/cosmosbuf
---

# Buf Integration (cosmosbuf)

The `cosmosbuf` package wraps Buf workflows (`generate`, `export`, `format`, `migrate`, `dep update`) used by Ignite's protobuf pipelines.

For full API details, see the
[`cosmosbuf` Go package documentation](https://pkg.go.dev/github.com/ignite/cli/v29/ignite/pkg/cosmosbuf).

## When to use

- Trigger Buf code generation from Go services.
- Keep Buf invocation flags and error handling consistent.
- Reuse cache-aware generation behavior.

## Key APIs

- `New(cacheStorage cache.Storage, goModPath string) (Buf, error)`
- `(Buf) Generate(ctx, protoPath, output, template, options...)`
- `(Buf) Format(ctx, path)`
- `(Buf) Export(ctx, protoDir, output)`
- `Version(ctx context.Context) (string, error)`

## Example

```go
package main

import (
"context"
"log"
"os"
"path/filepath"

"github.com/ignite/cli/v29/ignite/pkg/cache"
"github.com/ignite/cli/v29/ignite/pkg/cosmosbuf"
)

func main() {
storage, err := cache.NewStorage(filepath.Join(os.TempDir(), "ignite-cache.db"))
if err != nil {
log.Fatal(err)
}

buf, err := cosmosbuf.New(storage, "github.com/acme/my-chain")
if err != nil {
log.Fatal(err)
}

if err := buf.Format(context.Background(), "./proto"); err != nil {
log.Fatal(err)
}
}
```
43 changes: 43 additions & 0 deletions docs/docs/07-packages/cosmosclient.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
---
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"
```
40 changes: 40 additions & 0 deletions docs/docs/07-packages/cosmosfaucet.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
---
sidebar_position: 5
title: Token Faucet (cosmosfaucet)
slug: /packages/cosmosfaucet
---

# Token Faucet (cosmosfaucet)

The `cosmosfaucet` package provides a local faucet service and client helpers to fund Cosmos accounts during development and tests.

For full API details, see the
[`cosmosfaucet` Go package documentation](https://pkg.go.dev/github.com/ignite/cli/v29/ignite/pkg/cosmosfaucet).

## When to use

- Automatically fund accounts in local/devnet environments.
- Expose a faucet HTTP endpoint backed by a chain key.
- Request funds from an existing faucet endpoint from automation code.

## Key APIs

- `New(ctx context.Context, ccr chaincmdrunner.Runner, options ...Option) (Faucet, error)`
- `TryRetrieve(ctx context.Context, chainID, rpcAddress, faucetAddress, accountAddress string) (string, error)`
- `OpenAPI(apiAddress string) Option`
- `Coin(amount, maxAmount sdkmath.Int, denom string) Option`
- `FeeAmount(amount sdkmath.Int, denom string) Option`
- `RefreshWindow(refreshWindow time.Duration) Option`
- `NewTransferRequest(accountAddress string, coins []string) TransferRequest`

## Common Tasks

- Construct a `Faucet` with chain runner + options, then expose transfer endpoints for local users.
- Use `TryRetrieve` in tests before broadcasting txs to ensure accounts have spendable balance.
- Tune coin amount, max amount, and refresh window to limit faucet abuse.

## Basic import

```go
import "github.com/ignite/cli/v29/ignite/pkg/cosmosfaucet"
```
Loading