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

refactor: fix spelling of Adaptor #15465

Merged
merged 1 commit into from
Mar 20, 2023
Merged
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
52 changes: 26 additions & 26 deletions types/module/core_module.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,46 +19,46 @@ import (
// UseCoreAPIModule wraps the core API module as an AppModule that this version
// of the SDK can use.
func UseCoreAPIModule(name string, module appmodule.AppModule) AppModule {
return coreAppModuleAdapator{
return coreAppModuleAdaptor{
name: name,
module: module,
}
}

var (
_ AppModuleBasic = coreAppModuleAdapator{}
_ AppModule = coreAppModuleAdapator{}
_ AppModuleGenesis = coreAppModuleAdapator{}
_ BeginBlockAppModule = coreAppModuleAdapator{}
_ EndBlockAppModule = coreAppModuleAdapator{}
_ AppModuleBasic = coreAppModuleAdaptor{}
_ AppModule = coreAppModuleAdaptor{}
_ AppModuleGenesis = coreAppModuleAdaptor{}
_ BeginBlockAppModule = coreAppModuleAdaptor{}
_ EndBlockAppModule = coreAppModuleAdaptor{}
)

type coreAppModuleAdapator struct {
type coreAppModuleAdaptor struct {
name string
module appmodule.AppModule
}

func (c coreAppModuleAdapator) Name() string {
func (c coreAppModuleAdaptor) Name() string {
return c.name
}

func (c coreAppModuleAdapator) RegisterLegacyAminoCodec(amino *codec.LegacyAmino) {
func (c coreAppModuleAdaptor) RegisterLegacyAminoCodec(amino *codec.LegacyAmino) {
if mod, ok := c.module.(interface {
RegisterLegacyAminoCodec(amino *codec.LegacyAmino)
}); ok {
mod.RegisterLegacyAminoCodec(amino)
}
}

func (c coreAppModuleAdapator) RegisterInterfaces(registry types.InterfaceRegistry) {
func (c coreAppModuleAdaptor) RegisterInterfaces(registry types.InterfaceRegistry) {
if mod, ok := c.module.(interface {
RegisterInterfaces(registry types.InterfaceRegistry)
}); ok {
mod.RegisterInterfaces(registry)
}
}

func (c coreAppModuleAdapator) DefaultGenesis(codec.JSONCodec) json.RawMessage {
func (c coreAppModuleAdaptor) DefaultGenesis(codec.JSONCodec) json.RawMessage {
if mod, ok := c.module.(appmodule.HasGenesis); ok {
target := genesis.RawJSONTarget{}
err := mod.DefaultGenesis(target.Target())
Expand All @@ -77,7 +77,7 @@ func (c coreAppModuleAdapator) DefaultGenesis(codec.JSONCodec) json.RawMessage {
return nil
}

func (c coreAppModuleAdapator) ValidateGenesis(codec codec.JSONCodec, config client.TxEncodingConfig, message json.RawMessage) error {
func (c coreAppModuleAdaptor) ValidateGenesis(codec codec.JSONCodec, config client.TxEncodingConfig, message json.RawMessage) error {
if mod, ok := c.module.(appmodule.HasGenesis); ok {
source, err := genesis.SourceFromRawJSON(message)
if err != nil {
Expand All @@ -90,23 +90,23 @@ func (c coreAppModuleAdapator) ValidateGenesis(codec codec.JSONCodec, config cli
return nil
}

func (c coreAppModuleAdapator) RegisterRESTRoutes(context client.Context, router *mux.Router) {
func (c coreAppModuleAdaptor) RegisterRESTRoutes(context client.Context, router *mux.Router) {
if mod, ok := c.module.(interface {
RegisterRESTRoutes(context client.Context, router *mux.Router)
}); ok {
mod.RegisterRESTRoutes(context, router)
}
}

func (c coreAppModuleAdapator) RegisterGRPCGatewayRoutes(context client.Context, mux *runtime.ServeMux) {
func (c coreAppModuleAdaptor) RegisterGRPCGatewayRoutes(context client.Context, mux *runtime.ServeMux) {
if mod, ok := c.module.(interface {
RegisterGRPCGatewayRoutes(context client.Context, mux *runtime.ServeMux)
}); ok {
mod.RegisterGRPCGatewayRoutes(context, mux)
}
}

func (c coreAppModuleAdapator) GetTxCmd() *cobra.Command {
func (c coreAppModuleAdaptor) GetTxCmd() *cobra.Command {
if mod, ok := c.module.(interface {
GetTxCmd() *cobra.Command
}); ok {
Expand All @@ -116,7 +116,7 @@ func (c coreAppModuleAdapator) GetTxCmd() *cobra.Command {
return nil
}

func (c coreAppModuleAdapator) GetQueryCmd() *cobra.Command {
func (c coreAppModuleAdaptor) GetQueryCmd() *cobra.Command {
if mod, ok := c.module.(interface {
GetQueryCmd() *cobra.Command
}); ok {
Expand All @@ -126,7 +126,7 @@ func (c coreAppModuleAdapator) GetQueryCmd() *cobra.Command {
return nil
}

func (c coreAppModuleAdapator) InitGenesis(context sdk.Context, codec codec.JSONCodec, message json.RawMessage) []abci.ValidatorUpdate {
func (c coreAppModuleAdaptor) InitGenesis(context sdk.Context, codec codec.JSONCodec, message json.RawMessage) []abci.ValidatorUpdate {
if mod, ok := c.module.(appmodule.HasGenesis); ok {
source, err := genesis.SourceFromRawJSON(message)
if err != nil {
Expand All @@ -141,7 +141,7 @@ func (c coreAppModuleAdapator) InitGenesis(context sdk.Context, codec codec.JSON
return nil
}

func (c coreAppModuleAdapator) ExportGenesis(context sdk.Context, codec codec.JSONCodec) json.RawMessage {
func (c coreAppModuleAdaptor) ExportGenesis(context sdk.Context, codec codec.JSONCodec) json.RawMessage {
if mod, ok := c.module.(appmodule.HasGenesis); ok {
target := genesis.RawJSONTarget{}
err := mod.ExportGenesis(sdk.WrapSDKContext(context), target.Target())
Expand All @@ -160,15 +160,15 @@ func (c coreAppModuleAdapator) ExportGenesis(context sdk.Context, codec codec.JS
return nil
}

func (c coreAppModuleAdapator) RegisterInvariants(registry sdk.InvariantRegistry) {
func (c coreAppModuleAdaptor) RegisterInvariants(registry sdk.InvariantRegistry) {
if mod, ok := c.module.(interface {
RegisterInvariants(registry sdk.InvariantRegistry)
}); ok {
mod.RegisterInvariants(registry)
}
}

func (c coreAppModuleAdapator) Route() sdk.Route {
func (c coreAppModuleAdaptor) Route() sdk.Route {
if mod, ok := c.module.(interface {
Route() sdk.Route
}); ok {
Expand All @@ -178,7 +178,7 @@ func (c coreAppModuleAdapator) Route() sdk.Route {
return sdk.Route{}
}

func (c coreAppModuleAdapator) QuerierRoute() string {
func (c coreAppModuleAdaptor) QuerierRoute() string {
if mod, ok := c.module.(interface {
QuerierRoute() string
}); ok {
Expand All @@ -188,19 +188,19 @@ func (c coreAppModuleAdapator) QuerierRoute() string {
return ""
}

func (c coreAppModuleAdapator) LegacyQuerierHandler(amino *codec.LegacyAmino) sdk.Querier {
func (c coreAppModuleAdaptor) LegacyQuerierHandler(amino *codec.LegacyAmino) sdk.Querier {
return nil
}

func (c coreAppModuleAdapator) RegisterServices(c2 Configurator) {
func (c coreAppModuleAdaptor) RegisterServices(c2 Configurator) {
if mod, ok := c.module.(interface {
RegisterServices(c2 Configurator)
}); ok {
mod.RegisterServices(c2)
}
}

func (c coreAppModuleAdapator) ConsensusVersion() uint64 {
func (c coreAppModuleAdaptor) ConsensusVersion() uint64 {
if mod, ok := c.module.(interface {
ConsensusVersion() uint64
}); ok {
Expand All @@ -210,13 +210,13 @@ func (c coreAppModuleAdapator) ConsensusVersion() uint64 {
return 0
}

func (c coreAppModuleAdapator) BeginBlock(ctx sdk.Context, _ abci.RequestBeginBlock) {
func (c coreAppModuleAdaptor) BeginBlock(ctx sdk.Context, _ abci.RequestBeginBlock) {
if mod, ok := c.module.(appmodule.HasBeginBlocker); ok {
mod.BeginBlock(sdk.WrapSDKContext(ctx))
}
}

func (c coreAppModuleAdapator) EndBlock(ctx sdk.Context, _ abci.RequestEndBlock) []abci.ValidatorUpdate {
func (c coreAppModuleAdaptor) EndBlock(ctx sdk.Context, _ abci.RequestEndBlock) []abci.ValidatorUpdate {
if mod, ok := c.module.(appmodule.HasEndBlocker); ok {
mod.EndBlock(sdk.WrapSDKContext(ctx))
}
Expand Down