# Transaction Interpreter

`interpretTransaction` generates a human-readable markdown explanation of a raw `MsgUniversalUpdateCollection` transaction body — the transaction-level counterpart to `interpretCollection`.

## Usage

```typescript
import { interpretTransaction } from 'bitbadges';

// New collection creation
const explanation = interpretTransaction(txBody);

// Update — only describes changed fields
const explanation = interpretTransaction(txBody, true, ['updateCollectionApprovals', 'updatePermissions']);

// Multi-message — also explains bundled MsgTransferTokens
const explanation = interpretTransaction(txBody, false, [], messages);
```

## Parameters

| Parameter           | Type                  | Default | Description                                                       |
| ------------------- | --------------------- | ------- | ----------------------------------------------------------------- |
| `txBody`            | `Record<string, any>` | —       | Raw `value` from `MsgUniversalUpdateCollection`                   |
| `isUpdate`          | `boolean`             | `false` | Scope output to only changed fields                               |
| `activeUpdateFlags` | `string[]`            | `[]`    | Which fields are being updated (e.g. `updateCollectionApprovals`) |
| `messages`          | `any[]`               | —       | Full messages array to explain bundled transfers                  |

## vs interpretCollection

| Aspect | `interpretCollection`                      | `interpretTransaction`                        |
| ------ | ------------------------------------------ | --------------------------------------------- |
| Input  | Hydrated `BitBadgesCollection` from API    | Raw `MsgUniversalUpdateCollection` JSON value |
| When   | Explaining an existing on-chain collection | Reviewing a transaction before/after signing  |
| Claims | Includes claim plugin details              | No claim data (not in the transaction)        |


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.bitbadges.io/for-developers/bitbadges-sdk/common-snippets/interpret-transaction.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
