Skip to content

Explain an unsigned MsgUniversalUpdateCollection transaction body in plain language with interpretTransaction in the bitbadges SDK.

interpretTransaction explains a raw MsgUniversalUpdateCollection body before it is signed. It is the transaction-side counterpart of Interpret a Collection.

Example

bash
bb explain ./tx.json
ts
import { readFileSync } from 'node:fs';
import { interpretTransaction } from 'bitbadges';

// tx.json is { "messages": [{ "typeUrl": "/tokenization.MsgUniversalUpdateCollection", "value": {} }] } from bb build or get_transaction
const tx = JSON.parse(readFileSync('./tx.json', 'utf8'));
const messages: { typeUrl: string; value: Record<string, any> }[] = tx.messages;
const txBody = messages[0].value;

// A new collection: describe every field
const created = interpretTransaction(txBody);

// An update: describe only the fields being changed
const updated = interpretTransaction(txBody, true, ['updateCollectionApprovals', 'updatePermissions']);

// A multi-message transaction: also explain bundled MsgTransferTokens
const bundle = interpretTransaction(txBody, false, [], messages);
console.log(bundle);

Fields

ParameterTypeRequiredDescription
txBodyRecord<string, any>yesThe value of a MsgUniversalUpdateCollection (or the message object itself)
isUpdatebooleannoDefault false. When true, limits the output to changed fields
activeUpdateFlagsstring[]noWhich update* flags are set, for example updateCollectionApprovals
messagesany[]noThe full message array, so bundled transfers are explained too

Returns one markdown string.

Behavior

interpretCollectioninterpretTransaction
InputHydrated BitBadgesCollection from the APIRaw message JSON
WhenExplaining an existing collectionReviewing a transaction before or after signing
ClaimsIncludes claim plugin detailsNo claim data (not part of the transaction)

Use it in a review step before signAndBroadcast, together with Simulation Balance Diffs for the numbers.

Edit this page on GitHub