refactor(client): use address codec (#17503)
This commit is contained in:
@@ -15,7 +15,7 @@ import (
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/client"
|
||||
"github.com/cosmos/cosmos-sdk/client/flags"
|
||||
"github.com/cosmos/cosmos-sdk/codec/address"
|
||||
addresscodec "github.com/cosmos/cosmos-sdk/codec/address"
|
||||
"github.com/cosmos/cosmos-sdk/crypto/keyring"
|
||||
svrcmd "github.com/cosmos/cosmos-sdk/server/cmd"
|
||||
"github.com/cosmos/cosmos-sdk/testutil"
|
||||
@@ -52,7 +52,10 @@ func (s *CLITestSuite) SetupSuite() {
|
||||
WithClient(clitestutil.MockCometRPC{Client: rpcclientmock.Client{}}).
|
||||
WithAccountRetriever(client.MockAccountRetriever{}).
|
||||
WithOutput(io.Discard).
|
||||
WithChainID("test-chain")
|
||||
WithChainID("test-chain").
|
||||
WithAddressCodec(addresscodec.NewBech32Codec("cosmos")).
|
||||
WithValidatorAddressCodec(addresscodec.NewBech32Codec("cosmosvaloper")).
|
||||
WithConsensusAddressCodec(addresscodec.NewBech32Codec("cosmosvalcons"))
|
||||
|
||||
ctxGen := func() client.Context {
|
||||
bz, _ := s.encCfg.Codec.Marshal(&sdk.TxResponse{})
|
||||
@@ -133,7 +136,7 @@ func (s *CLITestSuite) TestTxWithdrawRewardsCmd() {
|
||||
args := append([]string{tc.valAddr.String()}, tc.args...)
|
||||
|
||||
ctx := svrcmd.CreateExecuteContext(context.Background())
|
||||
cmd := cli.NewWithdrawRewardsCmd(address.NewBech32Codec("cosmosvaloper"), address.NewBech32Codec("cosmos"))
|
||||
cmd := cli.NewWithdrawRewardsCmd(addresscodec.NewBech32Codec("cosmosvaloper"), addresscodec.NewBech32Codec("cosmos"))
|
||||
cmd.SetContext(ctx)
|
||||
cmd.SetArgs(args)
|
||||
s.Require().NoError(client.SetCmdClientContextHandler(s.clientCtx, cmd))
|
||||
@@ -185,7 +188,7 @@ func (s *CLITestSuite) TestTxWithdrawAllRewardsCmd() {
|
||||
tc := tc
|
||||
|
||||
s.Run(tc.name, func() {
|
||||
cmd := cli.NewWithdrawAllRewardsCmd(address.NewBech32Codec("cosmosvaloper"), address.NewBech32Codec("cosmos"))
|
||||
cmd := cli.NewWithdrawAllRewardsCmd(addresscodec.NewBech32Codec("cosmosvaloper"), addresscodec.NewBech32Codec("cosmos"))
|
||||
|
||||
out, err := clitestutil.ExecTestCLICmd(s.clientCtx, cmd, tc.args)
|
||||
if tc.expectErrMsg != "" {
|
||||
@@ -237,7 +240,7 @@ func (s *CLITestSuite) TestTxSetWithdrawAddrCmd() {
|
||||
tc := tc
|
||||
|
||||
s.Run(tc.name, func() {
|
||||
cmd := cli.NewSetWithdrawAddrCmd(address.NewBech32Codec("cosmos"))
|
||||
cmd := cli.NewSetWithdrawAddrCmd(addresscodec.NewBech32Codec("cosmos"))
|
||||
|
||||
out, err := clitestutil.ExecTestCLICmd(s.clientCtx, cmd, tc.args)
|
||||
if tc.expectErr {
|
||||
@@ -287,7 +290,7 @@ func (s *CLITestSuite) TestTxFundCommunityPoolCmd() {
|
||||
tc := tc
|
||||
|
||||
s.Run(tc.name, func() {
|
||||
cmd := cli.NewFundCommunityPoolCmd(address.NewBech32Codec("cosmos"))
|
||||
cmd := cli.NewFundCommunityPoolCmd(addresscodec.NewBech32Codec("cosmos"))
|
||||
|
||||
out, err := clitestutil.ExecTestCLICmd(s.clientCtx, cmd, tc.args)
|
||||
if tc.expectErr {
|
||||
|
||||
Reference in New Issue
Block a user