Skip to main content
You need a partner key with swap permission. DM @rapidssh if you do not have one.

1. Quote and build in one call

Add recipient to a quote request and the response includes the transaction. This example swaps 25 USDG for native ETH.
Amounts are raw token units. USDG has 6 decimals, so 25000000 is 25 USDG. The zero address means native ETH.
Response (trimmed)
  • swap.netOut is what the recipient gets at the quoted price, after the Route fee.
  • swap.minOut is the least the recipient can get. Below that the transaction reverts.
  • tx is the transaction to sign.

2. Approve the input token

Skip this for native ETH input. For an ERC-20, the signing wallet must allow swap.spender to pull amountIn. Approve before you request the transaction you will send, so the quote is fresh when the user signs.

3. Sign and send

Send tx from the wallet that holds the input tokens. That wallet pays; recipient receives the output and can be a different address.

Full example (TypeScript, viem)

Next: execute a swap covers approvals, deadlines and failed swaps in more detail.