Generate Msg Contents

Building the Msgs

You can build out the transaction from the exported Proto type definitions from our SDK. This allows you to create transactions with multiple Msg types in one tx. See herearrow-up-right for all proto Msg definitions.

import { proto } from 'bitbadgesjs-sdk';

//proto.cosmos.module for standard Cosmos
//proto.tokenization for BitBadges x/tokenization
const MsgDeleteCollection = proto.tokenization.MsgDeleteCollection;
const MsgCreateCollection = proto.tokenization.MsgCreateCollection;
const MsgUpdateCollection = proto.tokenization.MsgUpdateCollection;
const MsgTransferTokens = proto.tokenization.MsgTransferTokens;

const protoMsgs = [
    new MsgDeleteCollection({ collectionId: '1', creator: 'bb...' }),
    //Add more here (executed in order)
];

Building the Transaction

import { TxContext, createTransactionPayload } from 'bitbadgesjs-sdk';

const txContext: TxContext = { ... } //See prior page

const txnPayload = createTransactionPayload(txContext, protoMsgs);

The outputted payload will be in the following format.

EVM Support:

When you provide an evmAddress in the TxContext, the SDK automatically converts supported messages to EVM precompile calls. The evmTx field will be populated with the EVM transaction details. See Signing - Ethereum for complete details.

Last updated