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: ability to provide custom interfaces&codec register in Provide #54

Open
wants to merge 1 commit into
base: evmos/v0.50.9
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 15 additions & 3 deletions runtime/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,11 @@ func init() {
)
}

func ProvideApp(interfaceRegistry codectypes.InterfaceRegistry) (
func ProvideApp(
interfaceRegistry codectypes.InterfaceRegistry,
customRegisterInterfaces CustomRegisterInterfaces,
customRegisterLegacyAminoCodec CustomRegisterLegacyAminoCodec,
) (
codec.Codec,
*codec.LegacyAmino,
*AppBuilder,
Expand All @@ -104,8 +108,16 @@ func ProvideApp(interfaceRegistry codectypes.InterfaceRegistry) (

amino := codec.NewLegacyAmino()

std.RegisterInterfaces(interfaceRegistry)
std.RegisterLegacyAminoCodec(amino)
if customRegisterInterfaces != nil {
customRegisterInterfaces(interfaceRegistry)
} else {
std.RegisterInterfaces(interfaceRegistry)
}
if customRegisterLegacyAminoCodec != nil {
customRegisterLegacyAminoCodec(amino)
} else {
std.RegisterLegacyAminoCodec(amino)
}

cdc := codec.NewProtoCodec(interfaceRegistry)
msgServiceRouter := baseapp.NewMsgServiceRouter()
Expand Down
5 changes: 5 additions & 0 deletions runtime/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
abci "github.com/cometbft/cometbft/abci/types"

"github.com/cosmos/cosmos-sdk/codec"
codectypes "github.com/cosmos/cosmos-sdk/codec/types"
"github.com/cosmos/cosmos-sdk/server/types"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/module"
Expand Down Expand Up @@ -39,3 +40,7 @@ type AppI interface {
// Helper for the simulation framework.
SimulationManager() *module.SimulationManager
}

type CustomRegisterInterfaces func(codectypes.InterfaceRegistry)

type CustomRegisterLegacyAminoCodec func(*codec.LegacyAmino)
Loading