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 here for all proto Msg definitions.
import { proto } from 'bitbadgesjs-sdk';
//proto.cosmos.module for standard Cosmos
//proto.badges for BitBadges x/badges
const MsgDeleteCollection = proto.badges.MsgDeleteCollection;
const MsgCreateCollection = proto.badges.MsgCreateCollection;
const MsgUpdateCollection = proto.badges.MsgUpdateCollection;
const MsgTransferTokens = proto.badges.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.
export interface TransactionPayload {
legacyAmino: {
body: TxBody;
authInfo: AuthInfo;
signBytes: string;
};
signDirect: {
body: TxBody;
authInfo: AuthInfo;
signBytes: string;
};
txnString: string;
txnJson: Record<string, any>;
}Last updated