Skip to content

Commit

Permalink
feat(x/ecocredit): codec and server registration (#765)
Browse files Browse the repository at this point in the history
* feat(x/ecocredit): codec and server registration

* amino
  • Loading branch information
aaronc authored Feb 14, 2022
1 parent ac73e6f commit eff0e4a
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 3 deletions.
17 changes: 17 additions & 0 deletions x/ecocredit/basket/codec.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package basket

import (
"github.com/cosmos/cosmos-sdk/codec"
codectypes "github.com/cosmos/cosmos-sdk/codec/types"
"github.com/cosmos/cosmos-sdk/types/msgservice"
)

func RegisterTypes(registry codectypes.InterfaceRegistry) {
msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc)
}

func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) {
cdc.RegisterConcrete(&MsgCreate{}, "regen.basket/MsgCreate", nil)
cdc.RegisterConcrete(&MsgPut{}, "regen.basket/MsgPut", nil)
cdc.RegisterConcrete(&MsgTake{}, "regen.basket/MsgTake", nil)
}
1 change: 0 additions & 1 deletion x/ecocredit/codec.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package ecocredit
import (
"github.com/cosmos/cosmos-sdk/codec"
codectypes "github.com/cosmos/cosmos-sdk/codec/types"

"github.com/cosmos/cosmos-sdk/types/msgservice"
)

Expand Down
4 changes: 4 additions & 0 deletions x/ecocredit/module/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import (
"fmt"
"math/rand"

baskettypes "github.com/regen-network/regen-ledger/x/ecocredit/basket"

sdkclient "github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/codec"
"github.com/cosmos/cosmos-sdk/codec/types"
Expand Down Expand Up @@ -57,6 +59,7 @@ func (a Module) Name() string {

func (a Module) RegisterInterfaces(registry types.InterfaceRegistry) {
ecocredit.RegisterTypes(registry)
baskettypes.RegisterTypes(registry)
}

func (a Module) RegisterServices(configurator servermodule.Configurator) {
Expand Down Expand Up @@ -96,6 +99,7 @@ func (Module) ConsensusVersion() uint64 { return 1 }
func (a Module) RegisterRESTRoutes(sdkclient.Context, *mux.Router) {}
func (a Module) RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) {
ecocredit.RegisterLegacyAminoCodec(cdc)
baskettypes.RegisterLegacyAminoCodec(cdc)
}

// AppModuleSimulation functions
Expand Down
5 changes: 3 additions & 2 deletions x/ecocredit/server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
sdk "github.com/cosmos/cosmos-sdk/types"
paramtypes "github.com/cosmos/cosmos-sdk/x/params/types"
basketv1 "github.com/regen-network/regen-ledger/api/regen/ecocredit/basket/v1"
baskettypes "github.com/regen-network/regen-ledger/x/ecocredit/basket"
"github.com/regen-network/regen-ledger/x/ecocredit/server/basket"
"github.com/regen-network/regen-ledger/x/ecocredit/server/ormutil"
"google.golang.org/protobuf/reflect/protoreflect"
Expand Down Expand Up @@ -81,6 +82,6 @@ func RegisterServices(configurator server.Configurator, paramSpace paramtypes.Su
configurator.RegisterGenesisHandlers(impl.InitGenesis, impl.ExportGenesis)
configurator.RegisterWeightedOperationsHandler(impl.WeightedOperations)
configurator.RegisterInvariantsHandler(impl.RegisterInvariants)

// TODO Msg and Query server registration
baskettypes.RegisterMsgServer(configurator.MsgServer(), impl.basketKeeper)
baskettypes.RegisterQueryServer(configurator.QueryServer(), impl.basketKeeper)
}

0 comments on commit eff0e4a

Please sign in to comment.