Skip to main content
The Arbiter SDK provides three subscription methods for monitoring dispute activity in real-time. Each returns an object with an unsubscribe function you call to stop watching.

Watch New Cases

Subscribe to RefundRequested events — these are new refund requests that need your attention:
import type { RefundRequestEventLog } from '@x402r/core';

const { unsubscribe } = arbiter.watchNewCases((event: RefundRequestEventLog) => {
  console.log('New refund request!');
  console.log('Payment hash:', event.args.paymentInfoHash);
  console.log('Payer:', event.args.payer);
  console.log('Receiver:', event.args.receiver);
  console.log('Amount:', event.args.amount);
  console.log('Nonce:', event.args.nonce);
  console.log('Block:', event.blockNumber);
});

// Later: stop watching
unsubscribe();

Watch Decisions

Subscribe to RefundRequestStatusUpdated events — these fire when a refund request is approved or denied:
import type { RefundRequestEventLog } from '@x402r/core';

const { unsubscribe } = arbiter.watchDecisions((event: RefundRequestEventLog) => {
  console.log('Decision made!');
  console.log('Payment hash:', event.args.paymentInfoHash);
  console.log('New status:', event.args.status);
  console.log('Transaction:', event.transactionHash);
});

Watch Freeze Events

Subscribe to PaymentFrozen and PaymentUnfrozen events from a Freeze condition contract:
import type { FreezeEventLog } from '@x402r/core';

const freezeAddress = '0xFreezeContractAddress...' as `0x${string}`;

const { unsubscribe } = arbiter.watchFreezeEvents(
  freezeAddress,
  (event: FreezeEventLog) => {
    if (event.eventName === 'PaymentFrozen') {
      console.log('Payment frozen:', event.args.paymentInfoHash);
      console.log('Frozen by:', event.args.caller);
    } else if (event.eventName === 'PaymentUnfrozen') {
      console.log('Payment unfrozen:', event.args.paymentInfoHash);
    }
  }
);

Event Type Reference

MethodContract EventFires When
watchNewCasesRefundRequestedA payer submits a new refund request
watchDecisionsRefundRequestStatusUpdatedAn arbiter or receiver approves/denies a request
watchFreezeEventsPaymentFrozen / PaymentUnfrozenA payment is frozen or unfrozen

Event Log Types

Both watchNewCases and watchDecisions emit RefundRequestEventLog events:
interface RefundRequestEventLog {
  eventName: 'RefundRequested' | 'RefundRequestStatusUpdated' | 'RefundRequestCancelled';
  args: {
    paymentInfoHash?: `0x${string}`;
    payer?: `0x${string}`;
    receiver?: `0x${string}`;
    amount?: bigint;
    nonce?: bigint;
    status?: number;
  };
  address: `0x${string}`;
  blockNumber: bigint;
  transactionHash: `0x${string}`;
  logIndex: number;
}
The watchFreezeEvents method emits FreezeEventLog events:
interface FreezeEventLog {
  eventName: 'PaymentFrozen' | 'PaymentUnfrozen';
  args: {
    paymentInfoHash?: `0x${string}`;
    caller?: `0x${string}`;
  };
  address: `0x${string}`;
  blockNumber: bigint;
  transactionHash: `0x${string}`;
  logIndex: number;
}
All subscription methods use viem’s watchContractEvent under the hood. For reliable real-time delivery, configure your publicClient with a WebSocket transport.

Next Steps

AI Integration

Automate case evaluation with AI hooks.

Arbiter Quickstart

Review the complete arbiter setup guide.

Batch Operations

Process multiple queued cases efficiently.

Client Subscriptions

See how clients subscribe to the same events.