Skip to content

Latest commit

 

History

History
19 lines (14 loc) · 868 Bytes

File metadata and controls

19 lines (14 loc) · 868 Bytes

Codec File

To register your types with Amino so that they can be encoded/decoded, there is a bit of code that needs to be placed in ./x/nameservice/codec.go. Any interface you create and any struct that implements an interface needs to be declared in the RegisterCodec function. In this module the two Msg implementations (SetName and BuyName) need to be registered, but your Whois query return type does not:

package nameservice

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

// RegisterCodec registers concrete types on wire codec
func RegisterCodec(cdc *codec.Codec) {
	cdc.RegisterConcrete(MsgSetName{}, "nameservice/SetName", nil)
	cdc.RegisterConcrete(MsgBuyName{}, "nameservice/BuyName", nil)
}

Next you need to define CLI interactions with your module.