"/cosmos.bank.v1beta1.MsgSend") and encoded as Protocol Buffers. The Registry in @cosmjs/proto-signing maps type URLs to their codec implementations so CosmJS can encode and decode messages.
Adding Types to the Registry
Start fromdefaultRegistryTypes, which includes all standard Cosmos SDK message types, and add your own:
signAndBroadcast can serialize MsgCreatePost messages:
Registering Multiple Types
When your module has several message types, define them as an array and spread into the registry:Supported Codec Formats
TheRegistry accepts types generated by any of these tools:
All four implement
encode and decode. Types with fromPartial (Telescope, ts-proto) are preferred because they allow constructing messages from partial objects without specifying every field.
See the Code Generation page for details on each tool.
Type-Safe Encode Objects
For large projects, define typed encode objects that narrow thetypeUrl to a string literal. This prevents typos and gives you autocomplete on the value field:
Decoding Transactions
TheRegistry also decodes incoming data. This is useful for parsing transactions from the blockchain or decoding responses:
registry.decode throws Unregistered type url for unknown message types. Register all types you expect to encounter before decoding.
Next Steps
Query Extensions
Build typed query methods for your custom module.
Amino Converters
Add Amino JSON signing support for wallets like Keplr and Leap.
Code Generation
Generate TypeScript codecs from protobuf definitions automatically.