refactor(authz):remove global bech32 (#15662)

This commit is contained in:
Marko
2023-04-03 13:55:32 +02:00
committed by GitHub
parent b4d1109efc
commit 521aa4bfdd
20 changed files with 141 additions and 64 deletions
+3
View File
@@ -59,6 +59,9 @@ func TestExpiredGrantsQueue(t *testing.T) {
accountKeeper.EXPECT().GetAccount(gomock.Any(), grantee3).Return(authtypes.NewBaseAccountWithAddress(grantee3)).AnyTimes()
accountKeeper.EXPECT().GetAccount(gomock.Any(), grantee4).Return(authtypes.NewBaseAccountWithAddress(grantee4)).AnyTimes()
accountKeeper.EXPECT().StringToBytes(granter.String()).Return(granter, nil).AnyTimes()
accountKeeper.EXPECT().BytesToString(granter).Return(granter.String(), nil).AnyTimes()
authzKeeper := keeper.NewKeeper(key, encCfg.Codec, baseApp.MsgServiceRouter(), accountKeeper)
save := func(grantee sdk.AccAddress, exp *time.Time) {
+7 -5
View File
@@ -10,6 +10,7 @@ import (
"github.com/spf13/cobra"
modulev1 "cosmossdk.io/api/cosmos/authz/module/v1"
"cosmossdk.io/core/address"
"cosmossdk.io/core/appmodule"
"cosmossdk.io/depinject"
@@ -38,6 +39,7 @@ var (
// AppModuleBasic defines the basic application module used by the authz module.
type AppModuleBasic struct {
cdc codec.Codec
ac address.Codec
}
// Name returns the authz module's name.
@@ -91,13 +93,13 @@ func (a AppModuleBasic) RegisterGRPCGatewayRoutes(clientCtx sdkclient.Context, m
}
// GetQueryCmd returns the cli query commands for the authz module
func (AppModuleBasic) GetQueryCmd() *cobra.Command {
return cli.GetQueryCmd()
func (ab AppModuleBasic) GetQueryCmd() *cobra.Command {
return cli.GetQueryCmd(ab.ac)
}
// GetTxCmd returns the transaction commands for the authz module
func (AppModuleBasic) GetTxCmd() *cobra.Command {
return cli.GetTxCmd()
func (ab AppModuleBasic) GetTxCmd() *cobra.Command {
return cli.GetTxCmd(ab.ac)
}
// AppModule implements the sdk.AppModule interface
@@ -112,7 +114,7 @@ type AppModule struct {
// NewAppModule creates a new AppModule object
func NewAppModule(cdc codec.Codec, keeper keeper.Keeper, ak authz.AccountKeeper, bk authz.BankKeeper, registry cdctypes.InterfaceRegistry) AppModule {
return AppModule{
AppModuleBasic: AppModuleBasic{cdc: cdc},
AppModuleBasic: AppModuleBasic{cdc: cdc, ac: ak},
keeper: keeper,
accountKeeper: ak,
bankKeeper: bk,