Skip to main content

WPAXG Swap Integration

This guide walks through integrating the WPAXG swap REST API into your application.
Currently only available via REST API.

Prerequisites

  • A Paxos Labs API key
  • An Optimism RPC endpoint
  • A wallet library (viem, ethers, wagmi, etc.)

Supported Token Pairs

WPAXG must be either the offerAsset (sell) or wantAsset (buy) in every swap request. Supported stablecoins for the other side of the trade:
TokenAddress
USDC0x0b2C639c533813f4Aa9D7837CAf62653d097Ff85

Getting a Swap Quote

Request a quote by calling the /v1/wpaxg/swapQuotes endpoint:

Response Structure

The quote response includes:

Handling Token Approvals

Before executing the swap, ensure the user has approved sufficient tokens:

Executing the Swap

Once approved, execute the swap using the provided calldata:

Using Permit2 Authorization

For gasless approvals, use the permit2 auth method:

Error Handling

The API returns standard HTTP error codes:
StatusDescription
400Invalid parameters or insufficient liquidity
503DEX aggregator temporarily unavailable
Example error response:
Always validate the minBuyAmount before executing to protect against slippage. Consider showing users the expected output and allowing them to set slippage tolerance.