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(x/ecocredit): codec and server registration #765

Merged
merged 4 commits into from
Feb 14, 2022
Merged
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
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)
}
aaronc marked this conversation as resolved.
Show resolved Hide resolved

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)
aaronc marked this conversation as resolved.
Show resolved Hide resolved
}
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)
}