refactor!: deprecate sdk.Msg.GetSigners (#15284)

Co-authored-by: Matt Kocubinski <mkocubinski@gmail.com>
This commit is contained in:
Aaron Craelius
2023-05-25 18:35:09 +00:00
committed by GitHub
co-authored by Matt Kocubinski
parent b6613f9163
commit 82659a7477
60 changed files with 927 additions and 298 deletions
+10 -33
View File
@@ -19,6 +19,7 @@ import (
"cosmossdk.io/core/header"
"cosmossdk.io/core/store"
storetypes "cosmossdk.io/store/types"
"github.com/cosmos/cosmos-sdk/codec/address"
"github.com/cosmos/cosmos-sdk/baseapp"
"github.com/cosmos/cosmos-sdk/codec"
@@ -98,9 +99,15 @@ func ProvideApp() (
}
interfaceRegistry, err := codectypes.NewInterfaceRegistryWithOptions(codectypes.InterfaceRegistryOptions{
ProtoFiles: protoFiles,
AddressCodec: globalAccAddressCodec{},
ValidatorAddressCodec: globalValAddressCodec{},
ProtoFiles: proto.HybridResolver,
// using the global prefixes is a temporary solution until we refactor this
// to get the address.Codec's from the container
AddressCodec: address.Bech32Codec{
Bech32Prefix: sdk.GetConfig().GetBech32AccountAddrPrefix(),
},
ValidatorAddressCodec: address.Bech32Codec{
Bech32Prefix: sdk.GetConfig().GetBech32ValidatorAddrPrefix(),
},
})
if err != nil {
return nil, nil, nil, nil, nil, nil, nil, nil, nil, err
@@ -243,33 +250,3 @@ func ProvideHeaderInfoService(app *AppBuilder) header.Service {
func ProvideBasicManager(app *AppBuilder) module.BasicManager {
return app.app.basicManager
}
// globalAccAddressCodec is a temporary address codec that we will use until we
// can populate it with the correct bech32 prefixes without depending on the global.
type globalAccAddressCodec struct{}
func (g globalAccAddressCodec) StringToBytes(text string) ([]byte, error) {
if text == "" {
return nil, nil
}
return sdk.AccAddressFromBech32(text)
}
func (g globalAccAddressCodec) BytesToString(bz []byte) (string, error) {
if bz == nil {
return "", nil
}
return sdk.AccAddress(bz).String(), nil
}
// globalValAddressCodec is a temporary address codec that we will use until we
// can populate it with the correct bech32 prefixes without depending on the global.
type globalValAddressCodec struct{}
func (g globalValAddressCodec) StringToBytes(text string) ([]byte, error) {
return sdk.ValAddressFromBech32(text)
}
func (g globalValAddressCodec) BytesToString(bz []byte) (string, error) {
return sdk.ValAddress(bz).String(), nil
}