> ## Documentation Index
> Fetch the complete documentation index at: https://docs.polynode.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Redemption Watcher

> Track wallet positions and receive an alert when an oracle resolution makes them redeemable.

`RedemptionWatcher` loads positions for selected wallets, watches oracle resolutions, and emits a `RedeemableAlert` for matching positions. It can also follow live position changes and periodically refresh positions.

Use the direct `redemptions` event preset when you need the raw redemption stream. Use this helper when you want wallet-aware position matching and an estimated payout in one object.

## Start

<CodeGroup>
  ```typescript TypeScript theme={null}
  import { RedemptionWatcher } from 'polynode-sdk';

  const watcher = new RedemptionWatcher({
    apiKey: process.env.POLYNODE_API_KEY!,
  });

  watcher.on('alert', (alert) => {
    console.log(alert.wallet, alert.marketTitle, alert.isWinner,
      alert.estimatedPayoutUsd);
  });
  watcher.on('error', console.error);

  await watcher.start(['0xabc...']);
  ```

  ```python Python theme={null}
  import asyncio
  import os
  from polynode import RedemptionWatcher

  async def main() -> None:
      watcher = RedemptionWatcher(os.environ["POLYNODE_API_KEY"])
      watcher.on("alert", lambda alert: print(
          alert.wallet,
          alert.market_title,
          alert.is_winner,
          alert.estimated_payout_usd,
      ))

      await watcher.start(["0xabc..."])
      try:
          async for alert in watcher:
              print(alert.condition_id, alert.token_id)
      finally:
          watcher.close()

  asyncio.run(main())
  ```

  ```rust Rust theme={null}
  use polynode::{PolyNodeClient, RedemptionWatcher, RedemptionWatcherConfig};
  use std::sync::Arc;

  #[tokio::main]
  async fn main() -> polynode::Result<()> {
      let client = Arc::new(PolyNodeClient::new(
          std::env::var("POLYNODE_API_KEY").expect("Set POLYNODE_API_KEY")
      )?);
      let mut watcher = RedemptionWatcher::new(
          client,
          RedemptionWatcherConfig::default(),
      );
      watcher.start(&["0xabc..."]).await?;

      while let Some(alert) = watcher.next_alert().await {
          println!("{} {} {}", alert.wallet, alert.market_title,
              alert.estimated_payout_usd);
      }
      watcher.close();
      Ok(())
  }
  ```
</CodeGroup>

## Alert fields

An alert identifies the wallet, condition and token, held and winning outcomes, whether the position won, size, estimated payout, market title and slug, resolution price and payouts, block number, and timestamp.

An alert is a notification to inspect a position. Your application should verify current position state before submitting a redemption transaction.

## Lifecycle

Register handlers before `start` so early alerts are not missed. The TypeScript and Python helpers support adding and removing wallets at runtime. All languages expose the tracked wallet/position state and a close method.

Close the watcher during shutdown to stop refresh work and release its subscriptions. Reconnect delivery is best effort; the periodic refresh is useful as a reconciliation layer, not a promise of exactly-once alerts.

See [Oracle events](/websocket/events/oracle) and [Redemption events](/websocket/events/redemption) for the underlying payloads.
