Register new messages in a subdirectory in the folder that you created for your new module, as shown in the following example:
src/core/greeting/msgs
For this example, let's assume that you are creating a two new messages, MsgHello and MsgGoodbye. The following example shows the code for MsgHello, and you can extrapolate from it the way to implement MsgGoodbye.
Create the following file, which will index your new messages.
src/core/greeting/msgs/index.ts
import{MsgHello}from'./MsgHello';
import{MsgGoodbye}from'./MsgGoodbye';
export*from'./MsgHello';
export*from'./MsgGoodbye';
exporttypeGreetingMsg=MsgHello|MsgGoodbye;
exportnamespaceGreetingMsg{
exporttypeData=MsgHello.Data|MsgGoodbye.Data;
}
Register the messages in src/core/Msg.ts so that they can be parsed correctly.
src/core/Msg.ts
// import greeting module messages
...
import{
MsgHello,
MsgGoodbye,
GreetingMsg
}from'./greeting/msgs';
...
// register GreetingMsg
exporttypeMsg=
|BankMsg
|DistributionMsg
|GovMsg
|GreetingMsg// ADD HERE
|MsgAuthMsg
|SlashingMsg
|StakingMsg
|WasmMsg;
...
// register GreetingMsg.Data
exportnamespaceMsg{
exporttypeData=
|BankMsg.Data
|DistributionMsg.Data
|GovMsg.Data
|Greeting.Data// ADD HERE
|MsgAuthMsg.Data
|SlashingMsg.Data
|StakingMsg.Data
|WasmMsg.Data;
...
// register deserializer in Msg.fromData(...)
exportfunctionfromData(data:Msg.Data):Msg{
...
// greeting
case'greeting/MsgHello':
returnMsgHello.fromData(data);
case'greeting/MsgGoodbye':
returnMsgGoodbye.fromData(data);
...
}
}
Register the messages to be exported in src/core/index.ts:
...
// greeting
export'greeting/msgs';
Add parameter changes.
feather.js provides an easy way to generate ParameterChangeProposals, which is a proposal for changing the blockchain parameters associated with a module. If your module has parameters that can be changed via proposal, you should create the following files: