### Install Dependencies and Start Vue App Source: https://github.com/ignite/cli/blob/main/docs/versioned_docs/version-v29/04-clients/03-vue.md Navigate to the 'vue' directory and run these commands to install project dependencies and start the Vue development server. Ensure pnpm is installed. ```bash pnpm install && pnpm dev ``` -------------------------------- ### Install Project Dependencies Source: https://github.com/ignite/cli/blob/main/docs/readme.md Run this command to install all necessary project dependencies. ```bash yarn ``` -------------------------------- ### Start Local Development Server Source: https://github.com/ignite/cli/blob/main/docs/readme.md Starts a local development server for live preview. Changes are reflected without server restart. ```bash yarn serve ``` -------------------------------- ### Install and Show Usage for gen-mig-diffs Source: https://github.com/ignite/cli/blob/main/docs/versioned_docs/version-v29/06-migration/readme.md Install the `gen-mig-diffs` tool globally using `go install` and then display its help message to understand available flags and options. ```shell go install . && gen-mig-diffs -h ``` -------------------------------- ### Install IGNITE CLI Manually with Curl Source: https://github.com/ignite/cli/blob/main/docs/versioned_docs/version-v29/01-welcome/02-install.md Download and execute the installation script using curl and bash for manual installation. The binary is typically installed in /usr/local/bin. ```bash curl https://get.ignite.com/cli! | bash ``` -------------------------------- ### Start the Blockchain Source: https://github.com/ignite/cli/blob/main/docs/versioned_docs/version-v29/02-guide/03-hello-world.md Run this command to start your local blockchain node. This allows you to serve and test your blockchain application. ```bash ignite chain serve ``` -------------------------------- ### Install an IGNITE App from Git Source: https://github.com/ignite/cli/blob/main/docs/versioned_docs/version-v29/apps/02-developing-apps.md Publish your app to a Git repository and allow the community to install it using this command. Replace 'github.com/foo/my-app' with your app's repository path. ```sh ignite app install github.com/foo/my-app ``` -------------------------------- ### Install IGNITE CLI with Sudo Permissions Source: https://github.com/ignite/cli/blob/main/docs/versioned_docs/version-v29/01-welcome/02-install.md If permission errors occur during manual installation, use sudo with both curl and bash to execute the installation script. ```bash sudo curl https://get.ignite.com/cli | sudo bash ``` -------------------------------- ### Setup Simulation Environment Source: https://github.com/ignite/cli/blob/main/docs/versioned_docs/version-v29/06-migration/v0.27.1.md Sets up the simulation environment, including configuration, database, directory, and logger. It also configures simulation-specific flags. ```go simcli.FlagSeedValue = time.Now().Unix() simcli.FlagVerboseValue = true simcli.FlagCommitValue = true simcli.FlagEnabledValue = true config := simcli.NewConfigFromFlags() config.ChainID = "mars-simapp" db, dir, logger, _, err := simtestutil.SetupSimulation( config, "leveldb-bApp-sim", "Simulation", simcli.FlagVerboseValue, simcli.FlagEnabledValue, ) ``` -------------------------------- ### Start the Chain Source: https://github.com/ignite/cli/blob/main/docs/versioned_docs/version-v29/06-migration/v29.0.0.md Use 'ignite chain serve' to start your blockchain after completing the migration and configuration updates. ```bash ignite chain serve ``` -------------------------------- ### Install Ignite CLI from Source Source: https://github.com/ignite/cli/blob/main/readme.md Installs the Ignite CLI after cloning the repository, typically used for development or custom builds. ```sh make install ``` -------------------------------- ### Basic Cosmosclient Import Source: https://github.com/ignite/cli/blob/main/docs/versioned_docs/version-v29/07-packages/cosmosclient.md Import the cosmosclient package to start using its functionalities. ```go import "github.com/ignite/cli/v29/ignite/pkg/cosmosclient" ``` -------------------------------- ### Install an Ignite App from a GitHub Repository Source: https://github.com/ignite/cli/blob/main/readme.md Use this command to install an Ignite App directly from a specified GitHub repository. Replace '[app-name]' with the actual name of the app. ```bash ignite app install -g github.com/ignite/apps/[app-name] ``` -------------------------------- ### Example config.yml File Source: https://github.com/ignite/cli/blob/main/integration/doctor/testdata/config-ok.txt A sample configuration file for Ignite CLI, specifying the version. ```yaml version: 1 ``` -------------------------------- ### Example go.mod File Source: https://github.com/ignite/cli/blob/main/integration/doctor/testdata/config-ok.txt The go.mod file defining the module path and Go version for the project. ```go module github.com/ignite/cli go 1.20 ``` -------------------------------- ### Install Ignite App Source: https://github.com/ignite/cli/blob/main/docs/versioned_docs/version-v29/03-CLI-Commands/01-cli-commands.md Installs an Ignite App from a given path. You can also specify key-value pairs to be added to the generated configuration definition. Use the `--global` flag to use global plugins configuration. ```bash ignite app install [path] [key=value]... [flags] ``` ```bash ignite app install github.com/org/my-app/ foo=bar baz=qux ``` -------------------------------- ### Install a Locally Scaffolding Ignite App Source: https://github.com/ignite/cli/blob/main/readme.md After scaffolding a new app locally, use this command to install it. This is typically used for development or testing of custom apps. ```bash ignite app install -g path/to/your/app ``` -------------------------------- ### Example: Scaffold Single Todo Source: https://github.com/ignite/cli/blob/main/docs/versioned_docs/version-v29/03-CLI-Commands/01-cli-commands.md An example of scaffolding a 'todo-single' with 'title' of type string and 'done' of type boolean. ```bash ignite scaffold single todo-single title:string done:bool ``` -------------------------------- ### Install Global App Source: https://github.com/ignite/cli/blob/main/docs/versioned_docs/version-v29/apps/01-using-apps.md Installs an app globally, making it immediately available to the `ignite` command list from any directory. This command compiles the app for global use. ```sh ignite app install -g github.com/project/cli-app ``` -------------------------------- ### Create /usr/local/bin Directory and Set Permissions Source: https://github.com/ignite/cli/blob/main/readme.md Execute these commands if the /usr/local/bin directory does not exist or lacks the necessary permissions for Ignite installation. ```sh mkdir /usr/local/bin sudo chown -R $(whoami) /usr/local/bin ``` -------------------------------- ### Install and Audit Ignite CLI with Homebrew Source: https://github.com/ignite/cli/blob/main/packaging/readme.md Use these commands to install the Ignite CLI interactively with Homebrew and audit the formula. Ensure Homebrew is set up correctly before running. ```bash HOMEBREW_NO_INSTALL_FROM_API=1 brew install --interactive ignite ``` ```bash brew audit --new-formula ignite ``` -------------------------------- ### Start the 'earth' blockchain network Source: https://github.com/ignite/cli/blob/main/docs/versioned_docs/version-v29/02-guide/04-ibc.md Execute this command in a terminal to launch the 'earth' blockchain using its specified configuration file. This command starts the genesis node for the 'earth' network. ```bash ignite chain serve -c earth.yml ``` -------------------------------- ### ignite app describe Source: https://github.com/ignite/cli/blob/main/docs/versioned_docs/version-v29/03-CLI-Commands/01-cli-commands.md Print information about installed apps. ```APIDOC ## ignite app describe ### Description Print information about installed Ignite Apps, including their commands and hooks. ### Method CLI COMMAND ### Endpoint N/A ### Parameters #### Path Parameters - **path** (string) - Required - The path to the Ignite App (e.g., github.com/org/my-app/). #### Query Parameters - **help** (boolean) - Optional - help for describe. ### Request Example ```bash ignite app describe github.com/org/my-app/ ``` ### Response #### Success Response (200) Information about the specified Ignite App. #### Response Example ```json { "name": "my-app", "path": "github.com/org/my-app/", "commands": [...], "hooks": [...] } ``` ``` -------------------------------- ### Build a Blockchain Node Binary Source: https://github.com/ignite/cli/blob/main/docs/versioned_docs/version-v29/03-CLI-Commands/01-cli-commands.md Builds the chain's binary. This command identifies the main package, installs dependencies, sets build flags, and compiles the project into an installable binary. Useful for releasing binaries or manual chain initialization. ```bash ignite chain build [flags] ``` -------------------------------- ### Build IGNITE CLI from Source Source: https://github.com/ignite/cli/blob/main/docs/versioned_docs/version-v29/01-welcome/02-install.md Clone the IGNITE CLI repository and use make to build and install the CLI from the source code. ```bash git clone https://github.com/ignite/cli --depth=1 cd cli && make install ``` -------------------------------- ### Build a Node Binary with Ignite CLI Source: https://github.com/ignite/cli/blob/main/docs/versioned_docs/version-v29/03-CLI-Commands/01-cli-commands.md Compiles the project source code into a binary and installs it. Customize output directory, skip proto compilation, or verify dependencies. ```bash ignite chain build --output dist ``` ```bash ignite chain build --skip-proto ``` ```bash ignite chain build --check-dependencies ``` ```yaml build: main: custom/path/to/main ``` ```yaml build: binary: mychaind ``` ```yaml build: ldflags: - "-X main.Version=development" - "-X main.Date=01/05/2022T19:54" ``` ```bash ignite chain build --release -t linux:amd64 -t darwin:amd64 -t darwin:arm64 ``` ```bash ignite chain build [flags] ``` -------------------------------- ### Tidy Go Module Dependencies Source: https://github.com/ignite/cli/blob/main/docs/versioned_docs/version-v29/04-clients/01-go-client.md Install and tidy all dependencies required for the Go client project. ```bash go mod tidy ``` -------------------------------- ### Setup Mars Keeper (IBC-Enabled) Source: https://github.com/ignite/cli/blob/main/docs/versioned_docs/version-v29/06-migration/v0.18.md Initializes a Mars keeper and context for testing, including IBC dependencies. Use this when the module is IBC-enabled. ```go package keeper import ( testing "testing" "github.com/cosmos/cosmos-sdk/codec" codectypes "github.com/cosmos/cosmos-sdk/codec/types" "github.com/cosmos/cosmos-sdk/store" storetypes "github.com/cosmos/cosmos-sdk/store/types" sdk "github.com/cosmos/cosmos-sdk/types" capabilitykeeper "github.com/cosmos/cosmos-sdk/x/capability/keeper" typesparams "github.com/cosmos/cosmos-sdk/x/params/types" ibckeeper "github.com/cosmos/ibc-go/modules/core/keeper" "github.com/stretchr/testify/require" "github.com/tendermint/tendermint/libs/log" tmproto "github.com/tendermint/tendermint/proto/tendermint/types" tmdb "github.com/tendermint/tm-db" "github.com/username/test/x/mars/keeper" "github.com/username/test/x/mars/types" ) func MarsKeeper(t testing.TB) (*keeper.Keeper, sdk.Context) { logger := log.NewNopLogger() storeKey := sdk.NewKVStoreKey(types.StoreKey) memStoreKey := storetypes.NewMemoryStoreKey(types.MemStoreKey) db := tmdb.NewMemDB() stateStore := store.NewCommitMultiStore(db) stateStore.MountStoreWithDB(storeKey, sdk.StoreTypeIAVL, db) stateStore.MountStoreWithDB(memStoreKey, sdk.StoreTypeMemory, nil) require.NoError(t, stateStore.LoadLatestVersion()) registry := codectypes.NewInterfaceRegistry() appCodec := codec.NewProtoCodec(registry) capabilityKeeper := capabilitykeeper.NewKeeper(appCodec, storeKey, memStoreKey) amino := codec.NewLegacyAmino() ss := typesparams.NewSubspace(appCodec, amino, storeKey, memStoreKey, "MarsSubSpace", ) IBCKeeper := ibckeeper.NewKeeper( appCodec, storeKey, ss, nil, nil, capabilityKeeper.ScopeToModule("MarsIBCKeeper"), ) k := keeper.NewKeeper( codec.NewProtoCodec(registry), storeKey, memStoreKey, IBCKeeper.ChannelKeeper, &IBCKeeper.PortKeeper, capabilityKeeper.ScopeToModule("MarsScopedKeeper"), ) ctx := sdk.NewContext(stateStore, tmproto.Header{}, false, logger) return k, ctx } ``` -------------------------------- ### Create Vite Vanilla TS Project Source: https://github.com/ignite/cli/blob/main/docs/versioned_docs/version-v29/04-clients/02-typescript.md Set up a new frontend application using Vite with the vanilla-ts template. This command installs necessary dependencies for polyfilling. ```bash npm create vite@latest my-frontend-app -- --template vanilla-ts cd my-frontend-app npm install --save-dev @esbuild-plugins/node-globals-polyfill @rollup/plugin-node-resolve ``` -------------------------------- ### List Posts Output Example Source: https://github.com/ignite/cli/blob/main/docs/versioned_docs/version-v29/04-clients/01-go-client.md This YAML output displays the list of posts on the chain, confirming the successful creation of the 'Hello!' post. ```yaml Post: - body: This is the first post creator: cosmos1dzemw76wzt7p0gj7w3427a4xx724dz03wxg8hd id: "0" title: Hello! pagination: next_key: null total: "0" ``` -------------------------------- ### Setup Mars Keeper (Non-IBC) Source: https://github.com/ignite/cli/blob/main/docs/versioned_docs/version-v29/06-migration/v0.18.md Initializes a Mars keeper and context for testing. Use this when the module is not IBC-enabled. ```go package keeper import ( testing "testing" "github.com/cosmos/cosmos-sdk/codec" codectypes "github.com/cosmos/cosmos-sdk/codec/types" "github.com/cosmos/cosmos-sdk/store" storetypes "github.com/cosmos/cosmos-sdk/store/types" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/stretchr/testify/require" "github.com/tendermint/tendermint/libs/log" tmproto "github.com/tendermint/tendermint/proto/tendermint/types" tmdb "github.com/tendermint/tm-db" "github.com/username/mars/x/mars/keeper" "github.com/username/mars/x/mars/types" ) func MarsKeeper(t testing.TB) (*keeper.Keeper, sdk.Context) { storeKey := sdk.NewKVStoreKey(types.StoreKey) memStoreKey := storetypes.NewMemoryStoreKey(types.MemStoreKey) db := tmdb.NewMemDB() stateStore := store.NewCommitMultiStore(db) stateStore.MountStoreWithDB(storeKey, sdk.StoreTypeIAVL, db) stateStore.MountStoreWithDB(memStoreKey, sdk.StoreTypeMemory, nil) require.NoError(t, stateStore.LoadLatestVersion()) registry := codectypes.NewInterfaceRegistry() k := keeper.NewKeeper( codec.NewProtoCodec(registry), storeKey, memStoreKey, ) ctx := sdk.NewContext(stateStore, tmproto.Header{}, false, log.NewNopLogger()) return k, ctx } ``` -------------------------------- ### Quick Start GitHub Actions Workflow Source: https://github.com/ignite/cli/blob/main/actions/cli/readme.md Use this workflow to make the ignite CLI available in your GitHub Actions. Ensure you have the 'actions/checkout@v2' action to checkout your repository. ```yaml on: push jobs: help: runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v2 - name: Print Help uses: ignite/cli/actions/cli@main with: args: -h ``` -------------------------------- ### Create and Query Blog Posts with Go Client Source: https://github.com/ignite/cli/blob/main/docs/versioned_docs/version-v29/04-clients/01-go-client.md This Go program initializes a Cosmos client, creates a post via transaction, and then queries all posts. Ensure the 'blog' module types are imported correctly. The account 'alice' must exist in the keyring. ```go package main import ( "context" "fmt" "log" // Importing the general purpose Cosmos blockchain client "github.com/ignite/cli/v29/ignite/pkg/cosmosclient" // Importing the types package of your blog blockchain "blog/x/blog/types" ) func main() { ctx := context.Background() addressPrefix := "cosmos" // Create a Cosmos client instance client, err := cosmosclient.New(ctx, cosmosclient.WithAddressPrefix(addressPrefix)) if err != nil { log.Fatal(err) } // Account `alice` was initialized during `ignite chain serve` accountName := "alice" // Get account from the keyring account, err := client.Account(accountName) if err != nil { log.Fatal(err) } addr, err := account.Address(addressPrefix) if err != nil { log.Fatal(err) } // Define a message to create a post msg := &types.MsgCreatePost{ Creator: addr, Title: "Hello!", Body: "This is the first post", } // Broadcast a transaction from account `alice` with the message // to create a post store response in txResp txResp, err := client.BroadcastTx(ctx, account, msg) if err != nil { log.Fatal(err) } // Print response from broadcasting a transaction fmt.Print("MsgCreatePost:\n\n") fmt.Println(txResp) // Instantiate a query client for your `blog` blockchain queryClient := types.NewQueryClient(client.Context()) // Query the blockchain using the client's `PostAll` method // to get all posts store all posts in queryResp queryResp, err := queryClient.PostAll(ctx, &types.QueryAllPostRequest{}) if err != nil { log.Fatal(err) } // Print response from querying all the posts fmt.Print("\n\nAll posts:\n\n") fmt.Println(queryResp) } ``` -------------------------------- ### ignite app install Source: https://github.com/ignite/cli/blob/main/docs/versioned_docs/version-v29/03-CLI-Commands/01-cli-commands.md Install an Ignite App. ```APIDOC ## ignite app install ### Description Installs an Ignite App. Respects key value pairs declared after the app path to be added to the generated configuration definition. ### Method CLI COMMAND ### Endpoint N/A ### Parameters #### Path Parameters - **path** (string) - Required - The path to the Ignite App (e.g., github.com/org/my-app/). - **key=value** (string) - Optional - Key-value pairs to be added to the generated configuration definition. #### Query Parameters - **global** (boolean) - Optional - Use global plugins configuration ($HOME/.ignite/apps/igniteapps.yml). - **help** (boolean) - Optional - help for install. ### Request Example ```bash ignite app install github.com/org/my-app/ foo=bar baz=qux ``` ### Response #### Success Response (200) App installed successfully. #### Response Example ```json { "message": "App 'github.com/org/my-app/' installed successfully." } ``` ``` -------------------------------- ### List Installed Ignite Apps Source: https://github.com/ignite/cli/blob/main/docs/versioned_docs/version-v29/03-CLI-Commands/01-cli-commands.md This command lists all installed Ignite Apps, displaying their status and relevant information. It helps in managing your installed applications. ```bash ignite app list [flags] ``` -------------------------------- ### Cosmosclient Initialization Source: https://github.com/ignite/cli/blob/main/docs/versioned_docs/version-v29/07-packages/cosmosclient.md Demonstrates how to initialize the cosmosclient with various options. ```APIDOC ## Cosmosclient Initialization ### Description Initializes a new `Client` instance for interacting with a Cosmos SDK chain. Various options can be provided to configure the connection and transaction settings. ### Key APIs - `New(ctx context.Context, options ...Option) (Client, error)`: Creates a new client instance. - `WithNodeAddress(addr string) Option`: Sets the node address. - `WithHome(path string) Option`: Sets the home directory path. - `WithKeyringBackend(backend cosmosaccount.KeyringBackend) Option`: Sets the keyring backend. - `WithGas(gas string) Option`: Sets the gas limit. - `WithGasPrices(gasPrices string) Option`: Sets the gas prices. ### Request Example ```go import ( "context" "github.com/ignite/cli/v29/ignite/pkg/cosmosclient" "github.com/cosmos/cosmos-sdk/crypto/keyring" ) func main() { ctx := context.Background() client, err := cosmosclient.New(ctx, cosmosclient.WithNodeAddress("http://localhost:26657"), cosmosclient.WithKeyringBackend(keyring.CoinType(0)), ) if err != nil { panic(err) } // Use the client for further operations } ``` ### Response #### Success Response (Client) - `Client`: An initialized client object that can be used to interact with the blockchain. - `error`: An error if the client initialization fails. ``` -------------------------------- ### v0.25.0 Protobuf Directory Structure Source: https://github.com/ignite/cli/blob/main/docs/versioned_docs/version-v29/06-migration/v0.25.0.md Example of the new directory structure for scaffolded .proto files in v0.25.0. Proto files are now located under ./proto/{appName}/{moduleName}/. ```tree ├── app ├── cmd ├── docs ├── proto │ ├── planet │ │ ├── mars ├── x │ ├── mars ├── README.md ├── config.yml ├── go.mod ├── go.sum └── .gitignore ``` -------------------------------- ### Initialize SDK Configuration Source: https://github.com/ignite/cli/blob/main/docs/versioned_docs/version-v29/06-migration/v0.25.0.md Sets up Bech32 prefixes for accounts, validators, and consensus nodes. Ensure to replace `{binaryNamePrefix}` with your blockchain's binary name. ```go package cmd import ( sdk "github.com/cosmos/cosmos-sdk/types" "{ModulePath}/app" ) func initSDKConfig() { // Set prefixes accountPubKeyPrefix := app.AccountAddressPrefix + "pub" validatorAddressPrefix := app.AccountAddressPrefix + "valoper" validatorPubKeyPrefix := app.AccountAddressPrefix + "valoperpub" consNodeAddressPrefix := app.AccountAddressPrefix + "valcons" consNodePubKeyPrefix := app.AccountAddressPrefix + "valconspub" // Set and seal config config := sdk.GetConfig() config.SetBech32PrefixForAccount(app.AccountAddressPrefix, accountPubKeyPrefix) config.SetBech32PrefixForValidator(validatorAddressPrefix, validatorPubKeyPrefix) config.SetBech32PrefixForConsensusNode(consNodeAddressPrefix, consNodePubKeyPrefix) config.Seal() } ``` -------------------------------- ### Create New Application Instance Source: https://github.com/ignite/cli/blob/main/docs/versioned_docs/version-v29/06-migration/v0.25.0.md Initializes a new application instance with specified parameters, including logger, database, trace store, and various configuration options. Used within the application creation flow. ```go snapshotDB, err := dbm.NewDB("metadata", dbm.GoLevelDBBackend, snapshotDir) if err != nil { panic(err) } snapshotStore, err := snapshots.NewStore(snapshotDB, snapshotDir) if err != nil { panic(err) } snapshotOptions := snapshottypes.NewSnapshotOptions( cast.ToUint64(appOpts.Get(server.FlagStateSyncSnapshotInterval)), cast.ToUint32(appOpts.Get(server.FlagStateSyncSnapshotKeepRecent)), ) return app.New( logger, db, traceStore, true, skipUpgradeHeights, cast.ToString(appOpts.Get(flags.FlagHome)), cast.ToUint(appOpts.Get(server.FlagInvCheckPeriod)), a.encodingConfig, appOpts, baseapp.SetPruning(pruningOpts), baseapp.SetMinGasPrices(cast.ToString(appOpts.Get(server.FlagMinGasPrices))), baseapp.SetMinRetainBlocks(cast.ToUint64(appOpts.Get(server.FlagMinRetainBlocks))), baseapp.SetHaltHeight(cast.ToUint64(appOpts.Get(server.FlagHaltHeight))), baseapp.SetHaltTime(cast.ToUint64(appOpts.Get(server.FlagHaltTime))), baseapp.SetInterBlockCache(cache), baseapp.SetTrace(cast.ToBool(appOpts.Get(server.FlagTrace))), baseapp.SetIndexEvents(cast.ToStringSlice(appOpts.Get(server.FlagIndexEvents))), baseapp.SetSnapshot(snapshotStore, snapshotOptions), ) } ``` -------------------------------- ### Getting Latest Block Height Source: https://github.com/ignite/cli/blob/main/docs/versioned_docs/version-v29/07-packages/cosmosclient.md Provides information on how to get the height of the latest block. ```APIDOC ## Getting Latest Block Height ### Description Retrieves the height of the latest block that has been committed to the Cosmos SDK chain. ### Method `LatestBlockHeight(ctx context.Context) (int64, error)` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - `ctx` (context.Context): The context for the request. ### Request Example ```go import ( "context" "github.com/ignite/cli/v29/ignite/pkg/cosmosclient" ) func latestBlockHeightExample(client cosmosclient.Client) { ctx := context.Background() // Assume 'client' is an initialized cosmosclient.Client height, err := client.LatestBlockHeight(ctx) if err != nil { panic(err) } // Use the latest block height _ = height } ``` ### Response #### Success Response (int64) - `int64`: The height of the latest block. - `error`: An error if retrieving the block height fails. ``` -------------------------------- ### Build Init Command with Chain Options Source: https://github.com/ignite/cli/blob/main/docs/versioned_docs/version-v29/07-packages/chaincmd.md Constructs an initialization command for a chain binary with specified home directory and chain ID. Use this to prepare the command for execution by a command runner. ```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) } ``` -------------------------------- ### Example Manifest Method for Adding Commands Source: https://github.com/ignite/cli/blob/main/docs/versioned_docs/version-v29/apps/02-developing-apps.md Demonstrates how to implement the Manifest method in Go to define a new 'oracle' command for 'ignite scaffold'. It includes command usage, short and long descriptions, flags, and specifies where the command should be placed. ```go func (app) Manifest(context.Context) (*plugin.Manifest, error) { return &plugin.Manifest{ Name: "oracle", Commands: []*plugin.Command{ { Use: "oracle [name]", Short: "Scaffold an oracle module", Long: "Long description goes here...", // Optional flags is required Flags: []*plugin.Flag{ {Name: "source", Type: plugin.FlagTypeString, Usage: "the oracle source"}, }, // Attach the command to `scaffold` PlaceCommandUnder: "ignite scaffold", }, }, }, nil } ``` -------------------------------- ### Test Custom Query via CLI Source: https://github.com/ignite/cli/blob/main/docs/versioned_docs/version-v29/02-guide/03-hello-world.md Submit a query to your running blockchain using the hellod CLI. This example queries the 'say-hello' endpoint with the input 'world'. ```bash hellod q hello say-hello world ``` -------------------------------- ### Configure Application Options for Simulation Source: https://github.com/ignite/cli/blob/main/docs/versioned_docs/version-v29/06-migration/v0.27.1.md Sets up application options specific to the simulation, such as the home directory and the period for invariant checks. ```go appOptions := make(simtestutil.AppOptionsMap, 0) appOptions[flags.FlagHome] = app.DefaultNodeHome appOptions[server.FlagInvCheckPeriod] = simcli.FlagPeriodValue ``` -------------------------------- ### Initialize Go Module Source: https://github.com/ignite/cli/blob/main/docs/versioned_docs/version-v29/04-clients/01-go-client.md Initialize a new Go module within the client directory. ```bash cd blogclient go mod init blogclient ``` -------------------------------- ### Install ts-client Dependencies Source: https://github.com/ignite/cli/blob/main/docs/versioned_docs/version-v29/04-clients/02-typescript.md Navigate to the ts-client directory and install its npm dependencies. This is required before you can use the generated client code. ```bash cd ts-client npm install ``` -------------------------------- ### Install IGNITE CLI with Homebrew Source: https://github.com/ignite/cli/blob/main/docs/versioned_docs/version-v29/01-welcome/02-install.md Use Homebrew to install the latest version of IGNITE CLI on macOS and GNU/Linux systems. ```bash brew install ignite ``` -------------------------------- ### Initialize Auth Module Source: https://github.com/ignite/cli/blob/main/docs/versioned_docs/version-v29/06-migration/v0.27.1.md Initializes the authentication module with the application codec, account keeper, and subspace. ```go // remove-next-line auth.NewAppModule(appCodec, app.AccountKeeper, nil), // highlight-next-line auth.NewAppModule(appCodec, app.AccountKeeper, authsims.RandomGenesisAccounts, app.GetSubspace(authtypes.ModuleName)), ``` -------------------------------- ### Install Hermes relayer app Source: https://github.com/ignite/cli/blob/main/docs/versioned_docs/version-v29/02-guide/04-ibc.md Installs the Hermes relayer application from a GitHub repository. This is a prerequisite for configuring and managing IBC connections. ```bash ignite app install -g github.com/ignite/apps/hermes ``` -------------------------------- ### Setup Mars Message Server Source: https://github.com/ignite/cli/blob/main/docs/versioned_docs/version-v29/06-migration/v0.18.md Replaces the existing keeper setup with a new one using MarsKeeper for testing the message server. ```go package keeper_test import ( //... // Add the following: keepertest "github.com/username/mars/testutil/keeper" "github.com/username/mars/x/mars/keeper" ) func setupMsgServer(t testing.TB) (types.MsgServer, context.Context) { // Replace // keeper, ctx := setupKeeper(t) // return NewMsgServerImpl(*keeper), sdk.WrapSDKContext(ctx) // With the following: k, ctx := keepertest.MarsKeeper(t) return keeper.NewMsgServerImpl(*k), sdk.WrapSDKContext(ctx) } ``` -------------------------------- ### Install Project-Specific App Source: https://github.com/ignite/cli/blob/main/docs/versioned_docs/version-v29/apps/01-using-apps.md Installs an app from a remote repository into the current project. The app will only be available when running `ignite` within this project directory. ```sh ignite app install github.com/project/cli-app ``` -------------------------------- ### Command Execution Logic Source: https://github.com/ignite/cli/blob/main/docs/versioned_docs/version-v29/apps/02-developing-apps.md Provides an example of the Execute method for a custom command. It shows how to handle arguments, parse flags, retrieve chain information, and includes a placeholder for further logic. ```go func (app) Execute(_ context.Context, cmd *plugin.ExecutedCommand, _ plugin.ClientAPI) error { if len(cmd.Args) == 0 { return fmt.Errorf("oracle name missing") } flags, err := cmd.NewFlags() if err != nil { return err } var ( name, _ = flags.GetString("source") ) // Read chain information c, err := getChain(cmd) if err != nil { return err } //... } ``` -------------------------------- ### Describe Installed Ignite App Source: https://github.com/ignite/cli/blob/main/docs/versioned_docs/version-v29/03-CLI-Commands/01-cli-commands.md Prints detailed information about an installed Ignite App, including its commands and hooks. Provide the path to the app to describe. ```bash ignite app describe [path] [flags] ``` ```bash ignite app describe github.com/org/my-app/ ``` -------------------------------- ### Example config.yml Source: https://github.com/ignite/cli/blob/main/docs/versioned_docs/version-v29/08-configuration/02-config_example.md This YAML configuration file outlines parameters for building, account management, faucet settings, client code generation, and validator configurations. It includes options for including other config files, validation types, build paths, account details, faucet distribution, and OpenAPI/TypeScript generation. ```yaml include: (string list) # Include incorporate a separate config.yml file directly in your current config file. validation: (string) # Specifies the type of validation the blockchain uses (e.g., sovereign). version: (uint) # Defines the configuration version number. build: # Contains build configuration options. main: (string) # Path to the main build file. binary: (string) # Path to the binary file. ldflags: (string list) # List of custom linker flags for building the binary. proto: # Contains proto build configuration options. path: (string) # Relative path where the application's proto files are located. accounts: (list) # Lists the options for setting up Cosmos Accounts. name: (string) # Local name associated with the Account's key pair. coins: (string list) # List of token balances for the account. mnemonic: (string) # Mnemonic phrase for the account. address: (string) # Address of the account. cointype: (string) # Coin type number for HD derivation (default is 118). account_number: (string) # Account number for HD derivation (must be ≤ 2147483647). address_index: (string) # Address index number for HD derivation (must be ≤ 2147483647). faucet: # Configuration for the faucet. name: (string) # Name of the faucet account. coins: (string list) # Types and amounts of coins the faucet distributes. coins_max: (string list) # Maximum amounts of coins that can be transferred to a single user. rate_limit_window: (string) # Timeframe after which the limit will be refreshed. host: (string) # Host address of the faucet server. port: (uint) # Port number for the faucet server. tx_fee: (string) # Tx fee the faucet needs to pay for each transaction. client: # Configures client code generation. typescript: # Relative path where the application's Typescript files are located. path: (string) # Relative path where the application's Typescript files are located. composables: # Configures Vue 3 composables code generation. path: (string) # Relative path where the application's composable files are located. openapi: # Configures OpenAPI spec generation for the API. path: (string) # Relative path where the application's OpenAPI files are located. genesis: (key/value) # Custom genesis block modifications. Follow the nesting of the genesis file here to access all the parameters. default_denom: (string) # Default staking denom (default is stake). validators: (list) # Contains information related to the list of validators and settings. name: (string) # Name of the validator. bonded: (string) # Amount staked by the validator. app: (key/value) # Overwrites the appd's config/app.toml configurations. config: (key/value) # Overwrites the appd's config/config.toml configurations. client: (key/value) # Overwrites the appd's config/client.toml configurations. home: (string) # Overwrites the default home directory used for the application. gentx: # Overwrites the appd's config/gentx.toml configurations. amount: (string) # Amount for the current Gentx. moniker: (string) # Optional moniker for the validator. keyring-backend: (string) # Backend for the keyring. chain-id: (string) # Network chain ID. commission-max-change-rate: (string) # Maximum commission change rate percentage per day. commission-max-rate: (string) # Maximum commission rate percentage (e.g., 0.01 = 1%). commission-rate: (string) # Initial commission rate percentage (e.g., 0.01 = 1%). details: (string) # Optional details about the validator. security-contact: (string) # Optional security contact email for the validator. website: (string) # Optional website for the validator. account-number: (int) # Account number of the signing account (offline mode only). broadcast-mode: (string) # Transaction broadcasting mode (sync|async|block) (default is 'sync'). dry-run: (bool) # Simulates the transaction without actually performing it, ignoring the --gas flag. fee-account: (string) # Account that pays the transaction fees instead of the signer. fee: (string) # Fee to pay with the transaction (e.g.: 10uatom). from: (string) # Name or address of the private key used to sign the transaction. gas: (string) # Gas limit per transaction; set to 'auto' to calculate sufficient gas automatically (default is 200000). gas-adjustment: (string) # Factor to multiply against the estimated gas (default is 1). gas-prices: (string) # Gas prices in decimal format to determine the transaction fee (e.g., 0.1uatom). generate-only: (bool) # Creates an unsigned transaction and writes it to STDOUT. identity: (string) # Identity signature (e.g., UPort or Keybase). ``` -------------------------------- ### Query Command Setup Source: https://github.com/ignite/cli/blob/main/docs/versioned_docs/version-v29/06-migration/v0.25.0.md Defines the 'query' subcommand for interacting with the application's state. It includes aliases and sets up default query commands for accounts, validators, blocks, and transactions. ```go // queryCommand returns the sub-command to send queries to the app func queryCommand() *cobra.Command { cmd := &cobra.Command{ Use: "query", Aliases: []string{"q"}, Short: "Querying subcommands", DisableFlagParsing: true, SuggestionsMinimumDistance: 2, RunE: client.ValidateCmd, } cmd.AddCommand( authcmd.GetAccountCmd(), rpc.ValidatorCommand(), rpc.BlockCommand(), authcmd.QueryTxsByEventsCmd(), authcmd.QueryTxCmd(), ) app.ModuleBasics.AddQueryCommands(cmd) cmd.PersistentFlags().String(flags.FlagChainID, "", "The network chain ID") return cmd } ``` -------------------------------- ### Initialize New App Instance Source: https://github.com/ignite/cli/blob/main/docs/versioned_docs/version-v29/06-migration/v0.25.0.md Initializes a new blockchain application instance. Requires logger, database, trace store, load latest flag, skip upgrade heights map, home path, check period, encoding configuration, app options, and optional base app options. ```go func New( logger log.Logger, db dbm.DB, traceStore io.Writer, loadLatest bool, skipUpgradeHeights map[int64]bool, homePath string, invCheckPeriod uint, // highlight-next-line encodingConfig appparams.EncodingConfig, appOpts servertypes.AppOptions, baseAppOptions ...func(*baseapp.BaseApp), // highlight-next-line ) *App { appCodec := encodingConfig.Marshaler cdc := encodingConfig.Amino interfaceRegistry := encodingConfig.InterfaceRegistry bApp := baseapp.NewBaseApp( Name, logger, db, encodingConfig.TxConfig.TxDecoder(), baseAppOptions..., ) // ... } ``` -------------------------------- ### List Installed Apps Source: https://github.com/ignite/cli/blob/main/docs/versioned_docs/version-v29/apps/01-using-apps.md Lists all installed IGNITE® Apps and their statuses within the current project. This command is executed from within an IGNITE® scaffolded blockchain project. ```sh ignite app list ``` -------------------------------- ### Create a New Directory for the Client Source: https://github.com/ignite/cli/blob/main/docs/versioned_docs/version-v29/04-clients/01-go-client.md Create a new directory to house the standalone Go client program. ```bash mkdir blogclient ``` -------------------------------- ### Root Command Setup in Cosmos SDK Application Source: https://github.com/ignite/cli/blob/main/docs/versioned_docs/version-v29/06-migration/v0.25.0.md This Go code sets up the root command for a Cosmos SDK application, including client context initialization, module imports, and persistent pre-run execution logic. It's a foundational part of the application's CLI interface. ```go package cmd import ( "errors" "io" "os" "path/filepath" "strings" "github.com/cosmos/cosmos-sdk/baseapp" "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/config" "github.com/cosmos/cosmos-sdk/client/debug" "github.com/cosmos/cosmos-sdk/client/flags" "github.com/cosmos/cosmos-sdk/client/keys" "github.com/cosmos/cosmos-sdk/client/rpc" "github.com/cosmos/cosmos-sdk/server" serverconfig "github.com/cosmos/cosmos-sdk/server/config" servertypes "github.com/cosmos/cosmos-sdk/server/types" "github.com/cosmos/cosmos-sdk/snapshots" snapshottypes "github.com/cosmos/cosmos-sdk/snapshots/types" "github.com/cosmos/cosmos-sdk/store" sdk "github.com/cosmos/cosmos-sdk/types" authcmd "github.com/cosmos/cosmos-sdk/x/auth/client/cli" "github.com/cosmos/cosmos-sdk/x/auth/types" banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" "github.com/cosmos/cosmos-sdk/x/crisis" genutilcli "github.com/cosmos/cosmos-sdk/x/genutil/client/cli" "github.com/ignite/cli/ignite/services/network" "github.com/spf13/cast" "github.com/spf13/cobra" "github.com/spf13/pflag" tmcfg "github.com/tendermint/tendermint/config" tmcli "github.com/tendermint/tendermint/libs/cli" "github.com/tendermint/tendermint/libs/log" dbm "github.com/tendermint/tm-db" // this line is used by starport scaffolding # root/moduleImport "{ModulePath}/app" appparams "{ModulePath}/app/params" ) // NewRootCmd creates a new root command for a Cosmos SDK application func NewRootCmd() (*cobra.Command, appparams.EncodingConfig) { encodingConfig := app.MakeEncodingConfig() initClientCtx := client.Context{}. WithCodec(encodingConfig.Marshaler). WithInterfaceRegistry(encodingConfig.InterfaceRegistry). WithTxConfig(encodingConfig.TxConfig). WithLegacyAmino(encodingConfig.Amino). WithInput(os.Stdin). WithAccountRetriever(types.AccountRetriever{}). WithHomeDir(app.DefaultNodeHome). WithViper("") rootCmd := &cobra.Command{ Use: app.Name + "d", Short: "Stargate CosmosHub App", PersistentPreRunE: func(cmd *cobra.Command, _ []string) error { ``` -------------------------------- ### Start the 'mars' blockchain network Source: https://github.com/ignite/cli/blob/main/docs/versioned_docs/version-v29/02-guide/04-ibc.md Run this command in a separate terminal to launch the 'mars' blockchain using its configuration. This command starts the genesis node for the 'mars' network. ```bash ignite chain serve -c mars.yml ``` -------------------------------- ### Start Ignite Chain Debug Server with Custom Address Source: https://github.com/ignite/cli/blob/main/docs/versioned_docs/version-v29/02-guide/05-debug.md Starts a debug server on a custom network address. This allows you to specify a different host and port for the debugger. ```bash ignite chain debug --server --server-address 127.0.0.1:30500 ``` -------------------------------- ### Install ts-proto Locally Source: https://github.com/ignite/cli/blob/main/docs/versioned_docs/version-v29/04-clients/02-typescript.md Install the ts-proto binary globally using npm to avoid relying on the remote buf.build service. This binary is used by IGNITE for TypeScript code generation. ```sh npm install -g ts-proto ``` -------------------------------- ### Run Full Code Generation Pipeline Source: https://github.com/ignite/cli/blob/main/docs/versioned_docs/version-v29/07-packages/cosmosgen.md Execute a comprehensive code generation process for Go and OpenAPI outputs. Ensure necessary imports and cache storage are initialized. This example demonstrates setting up the generation context and specifying output paths. ```go package main import ( "context" "log" "os" "path/filepath" "github.com/ignite/cli/v29/ignite/pkg/cache" "github.com/ignite/cli/v29/ignite/pkg/cosmosgen" ) func main() { storage, err := cache.NewStorage(filepath.Join(os.TempDir(), "ignite-cache.db")) if err != nil { log.Fatal(err) } err = cosmosgen.Generate( context.Background(), storage, ".", "proto", "github.com/acme/my-chain", "./web", cosmosgen.WithGoGeneration(), cosmosgen.WithOpenAPIGeneration("./api/openapi.yml", nil), ) if err != nil { log.Fatal(err) } } ``` -------------------------------- ### Initializing Client for Keplr Usage Source: https://github.com/ignite/cli/blob/main/docs/versioned_docs/version-v29/04-clients/02-typescript.md Instantiate the client with API and RPC URLs, and a prefix. This setup is required before calling `useKeplr()` to enable transacting via the Keplr browser extension. ```typescript import { Client } from '../../ts-client'; const client = new Client({ apiURL: "http://localhost:1317", rpcURL: "http://localhost:26657", prefix: "cosmos" } ); await client.useKeplr(); ``` -------------------------------- ### Start Ignite Chain Debug Server Source: https://github.com/ignite/cli/blob/main/docs/versioned_docs/version-v29/02-guide/05-debug.md Starts a debug server that listens for client connections. The default address is tcp://127.0.0.1:30500. Accepts JSON-RPC or DAP client connections. ```bash ignite chain debug --server ``` -------------------------------- ### Start the Hermes relayer between 'earth' and 'mars' Source: https://github.com/ignite/cli/blob/main/docs/versioned_docs/version-v29/02-guide/04-ibc.md Starts the Hermes relayer process to manage communication between the 'earth' and 'mars' blockchain networks. This command initiates the relayer's active state. ```bash ignite relayer hermes start "earth" "mars" ``` -------------------------------- ### Switching Wallets on an Instantiated Client Source: https://github.com/ignite/cli/blob/main/docs/versioned_docs/version-v29/04-clients/02-typescript.md Switch the active wallet on an already instantiated client. This example shows initializing with Keplr, then switching to a wallet created from a mnemonic. Use `client.useSigner(newWallet)` to change the signing wallet. ```typescript import { Client } from '../../ts-client'; import { DirectSecp256k1HdWallet } from "@cosmjs/proto-signing"; const mnemonic = 'play butter frown city voyage pupil rabbit wheat thrive mind skate turkey helmet thrive door either differ gate exhibit impose city swallow goat faint' const wallet = await DirectSecp256k1HdWallet.fromMnemonic(mnemonic); const client = new Client({ apiURL: "http://localhost:1317", rpcURL: "http://localhost:26657", prefix: "cosmos" } ); await client.useKeplr(); // broadcast transactions using the Keplr wallet client.useSigner(wallet); // broadcast transactions using the CosmJS wallet ``` -------------------------------- ### ignite app list Source: https://github.com/ignite/cli/blob/main/docs/versioned_docs/version-v29/03-CLI-Commands/01-cli-commands.md List installed apps. ```APIDOC ## ignite app list ### Description Prints status and information of all installed Ignite Apps. ### Method CLI COMMAND ### Endpoint N/A ### Parameters #### Query Parameters - **help** (boolean) - Optional - help for list. ### Request Example ```bash ignite app list ``` ### Response #### Success Response (200) A list of installed Ignite Apps. #### Response Example ```json [ { "name": "my-app", "path": "github.com/org/my-app/", "status": "installed" } ] ``` ``` -------------------------------- ### Import Cosmos Faucet Package Source: https://github.com/ignite/cli/blob/main/docs/versioned_docs/version-v29/07-packages/cosmosfaucet.md Import the necessary cosmosfaucet package for using its functionalities. ```go import "github.com/ignite/cli/v29/ignite/pkg/cosmosfaucet" ``` -------------------------------- ### Ignite CLI Help Options Source: https://github.com/ignite/cli/blob/main/docs/versioned_docs/version-v29/03-CLI-Commands/01-cli-commands.md Displays help information for the ignite command. Use this to see available global options. ```bash -h, --help help for ignite ``` -------------------------------- ### Run Blockchain Simulation Testing Source: https://github.com/ignite/cli/blob/main/docs/versioned_docs/version-v29/03-CLI-Commands/01-cli-commands.md Starts a simulation testing process for your chain. ```bash ignite chain simulate [flags] ``` -------------------------------- ### Get App Name Source: https://github.com/ignite/cli/blob/main/docs/versioned_docs/version-v29/06-migration/v0.25.0.md Returns the name of the App. This method is part of the App struct. ```go func (app *App) Name() string { return app.BaseApp.Name() } ``` -------------------------------- ### Initialize Bank Module Source: https://github.com/ignite/cli/blob/main/docs/versioned_docs/version-v29/06-migration/v0.27.1.md Initializes the bank module with the application codec, account keeper, and subspace. ```go // remove-start bank.NewAppModule(appCodec, app.BankKeeper, app.AccountKeeper), capability.NewAppModule(appCodec, *app.CapabilityKeeper), // remove-end // highlight-start bank.NewAppModule(appCodec, app.BankKeeper, app.AccountKeeper, app.GetSubspace(banktypes.ModuleName)), capability.NewAppModule(appCodec, *app.CapabilityKeeper, false), // highlight-end ``` -------------------------------- ### Get BaseApp Instance Source: https://github.com/ignite/cli/blob/main/docs/versioned_docs/version-v29/06-migration/v0.25.0.md Returns the base app of the application. This is a direct accessor to the underlying baseapp.BaseApp. ```go func (app App) GetBaseApp() *baseapp.BaseApp { return app.BaseApp } ``` -------------------------------- ### Print Build Information Source: https://github.com/ignite/cli/blob/main/docs/versioned_docs/version-v29/03-CLI-Commands/01-cli-commands.md Use this command to display the current build information for the Ignite CLI. ```bash ignite version [flags] ``` -------------------------------- ### Initialize Simulation Manager Source: https://github.com/ignite/cli/blob/main/docs/versioned_docs/version-v29/06-migration/v0.27.1.md Sets up the simulation manager for the application, allowing for module overrides and deterministic simulation runs. It registers store decoders for simulation. ```go overrideModules := map[string]module.AppModuleSimulation{ authtypes.ModuleName: auth.NewAppModule(app.appCodec, app.AccountKeeper, authsims.RandomGenesisAccounts, app.GetSubspace(authtypes.ModuleName)), } app.sm = module.NewSimulationManagerFromAppModules(app.mm.Modules, overrideModules) app.sm.RegisterStoreDecoders() ``` -------------------------------- ### Import Chain Registry Package Source: https://github.com/ignite/cli/blob/main/docs/versioned_docs/version-v29/07-packages/chainregistry.md Import the chainregistry package to start using its types and functionalities. ```go import "github.com/ignite/cli/v29/ignite/pkg/chainregistry" ``` -------------------------------- ### Scaffold Uint64 Type Source: https://github.com/ignite/cli/blob/main/docs/versioned_docs/version-v29/03-CLI-Commands/01-cli-commands.md Use ':uint' to scaffold uint64 types, for example '111'. ```bash use ':uint' ``` -------------------------------- ### Scaffold Int64 Type Source: https://github.com/ignite/cli/blob/main/docs/versioned_docs/version-v29/03-CLI-Commands/01-cli-commands.md Use ':int' to scaffold int64 types, for example '111'. ```bash use ':int' ```