diff --git a/cmd/onomyd/cmd/cmd.go b/cmd/onomyd/cmd/cmd.go index e1be043f..527f62da 100644 --- a/cmd/onomyd/cmd/cmd.go +++ b/cmd/onomyd/cmd/cmd.go @@ -3,6 +3,7 @@ package cmd import ( gravitycmd "github.com/althea-net/cosmos-gravity-bridge/module/cmd/gravity/cmd" + cosmossimappcmd "github.com/cosmos/cosmos-sdk/simapp/simd/cmd" banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" "github.com/spf13/cobra" "github.com/tendermint/spm/cosmoscmd" @@ -22,16 +23,23 @@ func NewRootCmd() (*cobra.Command, cosmoscmd.EncodingConfig) { ) // customize gentx and collect-gentxs commands + cmdsToReplace := map[string]*cobra.Command{ + "gentx [key_name] [amount]": gravitycmd.GenTxCmd(app.ModuleBasics, encodingConfig.TxConfig, banktypes.GenesisBalancesIterator{}, app.DefaultNodeHome), + "collect-gentxs": gravitycmd.CollectGenTxsCmd(banktypes.GenesisBalancesIterator{}, app.DefaultNodeHome), + "add-genesis-account [address_or_key_name] [coin][,[coin]]": cosmossimappcmd.AddGenesisAccountCmd(app.DefaultNodeHome), + } + for _, v := range rootCmd.Commands() { - if v.Use == "gentx [key_name] [amount]" { + cmd, ok := cmdsToReplace[v.Use] + if ok { rootCmd.RemoveCommand(v) - rootCmd.AddCommand(gravitycmd.GenTxCmd(app.ModuleBasics, encodingConfig.TxConfig, banktypes.GenesisBalancesIterator{}, app.DefaultNodeHome)) - } - if v.Use == "collect-gentxs" { - rootCmd.RemoveCommand(v) - rootCmd.AddCommand(gravitycmd.CollectGenTxsCmd(banktypes.GenesisBalancesIterator{}, app.DefaultNodeHome)) + rootCmd.AddCommand(cmd) + delete(cmdsToReplace, v.Use) } } + if len(cmdsToReplace) != 0 { + panic("on onomy cmd replacements, not all of the commands were replaced") + } // eth_keys cmd rootCmd.AddCommand(gravitycmd.Commands(app.DefaultNodeHome)) diff --git a/go.mod b/go.mod index 7ec7ae9c..8132248a 100644 --- a/go.mod +++ b/go.mod @@ -34,4 +34,4 @@ replace github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alp replace github.com/althea-net/cosmos-gravity-bridge/module => github.com/onomyprotocol/cosmos-gravity-bridge/module v0.0.0-20211125165615-060eb3403d3c -replace github.com/cosmos/cosmos-sdk => github.com/onomyprotocol/onomy-sdk v0.42.10-0.20211223174849-c96bdff3bf1e +replace github.com/cosmos/cosmos-sdk => github.com/onomyprotocol/onomy-sdk v0.42.10-0.20211228140704-1a3046991600 diff --git a/go.sum b/go.sum index 89b5bd48..396d50b1 100644 --- a/go.sum +++ b/go.sum @@ -861,8 +861,8 @@ github.com/olekukonko/tablewriter v0.0.5 h1:P2Ga83D34wi1o9J6Wh1mRuqd4mF/x/lgBS7N github.com/olekukonko/tablewriter v0.0.5/go.mod h1:hPp6KlRPjbx+hW8ykQs1w3UBbZlj6HuIJcUGPhkA7kY= github.com/onomyprotocol/cosmos-gravity-bridge/module v0.0.0-20211125165615-060eb3403d3c h1:B9FWZAYfuIImYx/sQN/LbZmTKrdyNFVjJP02fVPKGGI= github.com/onomyprotocol/cosmos-gravity-bridge/module v0.0.0-20211125165615-060eb3403d3c/go.mod h1:kf96o2kMPivom+2SGkkExANrG7uA8cOFxb1+Ns4/hc0= -github.com/onomyprotocol/onomy-sdk v0.42.10-0.20211223174849-c96bdff3bf1e h1:tQIVEuNkQaIub4ws78x6FVoi1wBncXsXmskkz4QaifU= -github.com/onomyprotocol/onomy-sdk v0.42.10-0.20211223174849-c96bdff3bf1e/go.mod h1:SrclJP9lMXxz2fCbngxb0brsPNuZXqoQQ9VHuQ3Tpf4= +github.com/onomyprotocol/onomy-sdk v0.42.10-0.20211228140704-1a3046991600 h1:jPOKcqqPXGgl5T+B8+yl1WWOapDkHjycxEy/Oi2QAPs= +github.com/onomyprotocol/onomy-sdk v0.42.10-0.20211228140704-1a3046991600/go.mod h1:SrclJP9lMXxz2fCbngxb0brsPNuZXqoQQ9VHuQ3Tpf4= github.com/onomyprotocol/tm-load-test v0.9.1-0.20211101093435-b38e68e11c01 h1:+B99URBdjbxtLuKUCSdOpyZ+Q6OpXNvQPsjXGgSBPRo= github.com/onomyprotocol/tm-load-test v0.9.1-0.20211101093435-b38e68e11c01/go.mod h1:KRiRasq+MPZHPAFx5VPkdkvXZTNW62ePuMn0+B5mrig= github.com/onsi/ginkgo v0.0.0-20151202141238-7f8ab55aaf3b/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=