Skip to main content

Overview

Configure webhooks to receive real-time status updates for your transfers.

Setup

Pass a webhookUrl when creating a transfer:
const result = await bridge.transfer({
  from: 'BASE',
  to: 'SOLANA',
  amount: '100.00',
  recipient: '5abc123...',
  permit: signedPermit,
  webhookUrl: 'https://your-server.com/webhook/sw4p'
})

Webhook Payload

{
  "intent_id": "int_abc123",
  "status": "complete",
  "source_chain": "BASE",
  "destination_chain": "SOLANA",
  "source_tx": "0x...",
  "destination_tx": "5a...",
  "amount": "100.00",
  "timestamp": "2024-01-01T00:01:05Z"
}

Status Events

StatusDescription
detectedBurn confirmed on source
mintedMint executed on destination
completeTransfer complete
failedTransfer failed

Verification

Verify webhook signatures using the X-Sw4p-Signature header.
import crypto from 'crypto'

function verifyWebhook(payload: string, signature: string, secret: string) {
  const expected = crypto
    .createHmac('sha256', secret)
    .update(payload)
    .digest('hex')
  return signature === expected
}