refactor(client): use address codec (#17503)

This commit is contained in:
Julien Robert
2023-08-23 10:43:47 +00:00
committed by GitHub
parent 029f9ed71e
commit c6b0bb62ac
42 changed files with 428 additions and 224 deletions
+7 -4
View File
@@ -17,7 +17,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/hd"
"github.com/cosmos/cosmos-sdk/crypto/keyring"
svrcmd "github.com/cosmos/cosmos-sdk/server/cmd"
@@ -57,7 +57,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"))
s.commonFlags = []string{
fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation),
@@ -89,7 +92,7 @@ func (s *CLITestSuite) SetupSuite() {
s.clientCtx,
val.Address,
account,
sdk.NewCoins(sdk.NewCoin("stake", sdkmath.NewInt(2000))), address.NewBech32Codec("cosmos"), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation),
sdk.NewCoins(sdk.NewCoin("stake", sdkmath.NewInt(2000))), addresscodec.NewBech32Codec("cosmos"), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation),
fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync),
fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin("stake", sdkmath.NewInt(10))).String()),
)
@@ -942,7 +945,7 @@ func (s *CLITestSuite) TestTxUpdateGroupPolicyDecisionPolicy() {
thresholdDecisionPolicy := testutil.WriteToNewTempFile(s.T(), `{"@type":"/cosmos.group.v1.ThresholdDecisionPolicy", "threshold":"1", "windows":{"voting_period":"40000s"}}`)
percentageDecisionPolicy := testutil.WriteToNewTempFile(s.T(), `{"@type":"/cosmos.group.v1.PercentageDecisionPolicy", "percentage":"0.5", "windows":{"voting_period":"40000s"}}`)
cmd := groupcli.MsgUpdateGroupPolicyDecisionPolicyCmd(address.NewBech32Codec("cosmos"))
cmd := groupcli.MsgUpdateGroupPolicyDecisionPolicyCmd(addresscodec.NewBech32Codec("cosmos"))
cmd.SetOutput(io.Discard)
testCases := []struct {