> **Can't find what you're looking for?** Use `search_docs` on the docs MCP server at `https://v3.viem.sh/api/mcp` to find what you need.

# Watch Token Burns \[token.watchBurn]

Watches TIP-20 `Burn` events for a token.

## Usage

:::code-group
```ts twoslash [example.ts]
import { client } from './viem.config'

const watcher = client.token.watchBurn({
  token: '0x20c0000000000000000000000000000000000000',
})

watcher.onLogs((logs) => {
  for (const log of logs) console.log(log.args)
  // @log: { from: '0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266', amount: 50000000n }
})

// Later, tear down the watcher.
watcher.off()
```

```ts twoslash [viem.config.ts] filename="viem.config.ts"
// [!include ~/snippets/tempo/viem.config.ts:setup]
```
:::

Also callable standalone: `Actions.token.watchBurn(client, options)`, with `Actions` imported from `'viem/tempo'`.

## Recipes

### Reconcile Redemption Burns With Fiat Payouts

Filter `args.from` to your redemption wallet to confirm the burn behind each fiat payout, keeping issuance records aligned with the offchain ledger.

:::code-group
```ts twoslash [example.ts]
import { client } from './viem.config'

const watcher = client.token.watchBurn({
  args: { from: '0x8ba1f109551bD432803012645Ac136ddd64DBA72' }, // [!code focus]
  token: '0x20c0000000000000000000000000000000000000',
})

watcher.onLogs((logs) => {
  for (const log of logs) {
    // Match the burn to a pending payout by transaction hash.
    console.log('Redeemed:', log.args.amount, log.transactionHash) // [!code focus]
    // @log: Redeemed: 250000000n 0x59a1c...
  }
})
```

```ts twoslash [viem.config.ts] filename="viem.config.ts"
// [!include ~/snippets/tempo/viem.config.ts:setup]
```
:::

### Track Circulating Supply as Burns Land

Combine the watcher with [`token.getTotalSupply`](/tempo/actions/token.getTotalSupply) to keep a treasury dashboard's supply figure current after every burn.

:::code-group
```ts twoslash [example.ts]
import { client } from './viem.config'

const watcher = client.token.watchBurn({
  token: '0x20c0000000000000000000000000000000000000',
})

watcher.onLogs(async () => {
  const { formatted } = await client.token.getTotalSupply({ // [!code focus]
    token: '0x20c0000000000000000000000000000000000000', // [!code focus]
  }) // [!code focus]
  console.log('Circulating supply:', formatted)
  // @log: Circulating supply: 12500000
})
```

```ts twoslash [viem.config.ts] filename="viem.config.ts"
// [!include ~/snippets/tempo/viem.config.ts:setup]
```
:::

## Return Value

Returns a watcher handle. Watching starts when the first listener (or async iterator) attaches, and stops when `off` is called.

```ts
type ReturnType = {
  /** Registers a log listener. Starts the watcher on first registration. Returns an unregister function. */
  onLogs: (fn: (logs: readonly Log[]) => void) => () => void
  /** Registers an error listener. Returns an unregister function. */
  onError: (fn: (error: Error) => void) => () => void
  /** Tears down the watcher: removes listeners, ends iterators, stops the poll or subscription. */
  off: () => void
  /** Async-iterates emitted log batches (latest-only stream). */
  [Symbol.asyncIterator]: () => AsyncIterableIterator<{ logs: readonly Log[] }>
}
```

Each log is decoded, with the event arguments on `args`:

```ts
type Log = {
  /** Decoded `Burn` event arguments. */
  args: {
    /** Address whose tokens were burned. */
    from: Address
    /** Amount burned. */
    amount: bigint
  }
  /** Name of the emitted event. */
  eventName: 'Burn'
  // ...standard log fields (address, blockHash, blockNumber, logIndex, transactionHash, ...)
}
```

## Parameters

### args

* **Type:** `object`

```ts
type Args = {
  /** Filter by burner address. */
  from?: Address | Address[] | null
}
```

Indexed argument values to filter logs by.

### batch

* **Type:** `boolean`
* **Default:** `true`

Whether to batch the logs found within a poll interval into a single emission. When `false`, each log is emitted on its own.

### fromBlock

* **Type:** `bigint`

Block number from which to start watching for logs.

### poll

* **Type:** `boolean`

Whether to poll for new logs instead of using a subscription. Defaults to `true` when the transport cannot subscribe or `fromBlock` is provided.

### pollingInterval

* **Type:** `number`
* **Default:** `client.pollingInterval`

Polling frequency (in ms).

### token

* **Type:** `Address | bigint`

Token to operate on: a TIP-20 token id or a contract address.
