Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(auth): make address codec pluggable #16621

Merged
merged 12 commits into from
Jun 28, 2023
Prev Previous commit
Next Next commit
address comment
  • Loading branch information
tac0turtle committed Jun 20, 2023
commit bd243f0fb8483f61d9022bd5a57f80a2207e37f7
7 changes: 4 additions & 3 deletions x/auth/keeper/keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,9 +137,6 @@ func NewAccountKeeper(
AccountNumber: collections.NewSequence(sb, types.GlobalAccountNumberKey, "account_number"),
Accounts: collections.NewIndexedMap(sb, types.AddressStoreKeyPrefix, "accounts", sdk.AccAddressKey, codec.CollInterfaceValue[sdk.AccountI](cdc), NewAccountIndexes(sb)),
}
if bech32Prefix == "" {
ak.bech32Prefix = "bech32 is not used on this chain"
}
schema, err := sb.Build()
if err != nil {
panic(err)
Expand Down Expand Up @@ -271,6 +268,10 @@ func (ak AccountKeeper) SetModuleAccount(ctx context.Context, macc sdk.ModuleAcc

// add getter for bech32Prefix
func (ak AccountKeeper) getBech32Prefix() (string, error) {
if ak.bech32Prefix == "" {
return "bech32 is not used on this chain", nil
}

return ak.bech32Prefix, nil
}

Expand Down
4 changes: 0 additions & 4 deletions x/auth/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -245,10 +245,6 @@ func ProvideModule(in ModuleInputs) ModuleOutputs {
in.AddressCodec = authcodec.NewBech32Codec(in.Config.Bech32Prefix)
}

if in.Config.Bech32Prefix == "" {
in.Config.Bech32Prefix = ""
}

if in.RandomGenesisAccountsFn == nil {
in.RandomGenesisAccountsFn = simulation.RandomGenesisAccounts
}
Expand Down
Loading