mukan-ignite/ignite/services/chain/testnet.go
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

77 lines
1.6 KiB
Go

package chain
import (
"context"
"fmt"
"os"
"strings"
chainconfig "github.com/ignite/cli/v29/ignite/config/chain"
)
type InPlaceArgs struct {
NewChainID string
NewOperatorAddress string
PrvKeyValidator string
AccountsToFund string
}
func (c Chain) TestnetInPlace(ctx context.Context, args InPlaceArgs) error {
commands, err := c.Commands(ctx)
if err != nil {
return err
}
// make sure that config.yml exists
if c.options.ConfigFile != "" {
if _, err := os.Stat(c.options.ConfigFile); err != nil {
return err
}
} else if _, err := chainconfig.LocateDefault(c.app.Path); err != nil {
return err
}
err = c.InPlace(ctx, commands, args)
if err != nil {
return err
}
return nil
}
type MultiNodeArgs struct {
OutputDir string
NumValidator string
ValidatorsStakeAmount string
NodeDirPrefix string
ListPorts []uint
}
func (m MultiNodeArgs) ConvertPorts() string {
var result []string
for _, port := range m.ListPorts {
result = append(result, fmt.Sprintf("%d", port))
}
return strings.Join(result, ",")
}
// If the app state still exists, TestnetMultiNode will reuse it.
// Otherwise, it will automatically re-initialize the app state from the beginning.
func (c Chain) TestnetMultiNode(ctx context.Context, args MultiNodeArgs) error {
commands, err := c.Commands(ctx)
if err != nil {
return err
}
// make sure that config.yml exists
if c.options.ConfigFile != "" {
if _, err := os.Stat(c.options.ConfigFile); err != nil {
return err
}
} else if _, err := chainconfig.LocateDefault(c.app.Path); err != nil {
return err
}
return c.MultiNode(ctx, commands, args)
}