Simulation Balance Diffs

Parse chain simulation events into structured balance changes β€” see exactly what coins and tokens move in each direction before signing.

Quick Start: simulateAndReview()

import { BitBadgesSigningClient } from 'bitbadgesjs-sdk';

const client = new BitBadgesSigningClient({ adapter });
const review = await client.simulateAndReview(messages);

console.log('Gas used:', review.gasUsed);
console.log('Fee:', review.fee);

// See what moves
for (const [address, denoms] of Object.entries(review.netChanges.coinChanges)) {
  for (const [denom, amount] of Object.entries(denoms)) {
    console.log(`${address}: ${amount > 0n ? '+' : ''}${amount} ${denom}`);
  }
}

// If acceptable, broadcast
if (agentApprovesChanges(review.netChanges)) {
  const result = await client.signAndBroadcast(messages);
}

Low-Level: parseSimulationEvents + calculateNetChanges

What Events Are Parsed

  • Coin transfers (send, delegate, redelegate)

  • Mint and burn events

  • Badge/token transfers

  • IBC transfers

  • Protocol fees

Also Available Via

  • MCP: The simulate_transaction tool returns structured parsedEvents and netChanges

  • Frontend: The TxModal "Net Changes" tab uses this under the hood

Last updated