Skip to main content
Relay deposit addresses allow users to bridge and swap assets instantly simply by sending tokens to a deposit address. Request a deposit address for your bridging/swapping pair, send your source asset to that address, and Relay automatically bridges and swaps them to the target asset on the destination chain. This works seamlessly for wallet funding with Privy’s client-side SDKs, server-side SDKs, and REST API.

Resources


Prerequisites

If you have not set up Privy yet, choose the SDK of your choice to integrate Privy in your project.

Integrating Relay deposit addresses

1

1. Request deposit address from Relay API

Request a deposit address from Relay’s API by making a POST request to https://api.relay.link/quote with deposit address enabled. This generates a unique deposit address that cannot be reused.
curl --request POST \
  --url 'https://api.relay.link/quote' \
  --header 'Content-Type: application/json' \
  --data '{
    "user": "0xF0AE622e463fa757Cf72243569E18Be7Df1996cd",
    "originChainId": 8453,
    "originCurrency": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
    "destinationChainId": 10,
    "destinationCurrency": "0x0b2C639c533813f4Aa9D7837CAf62653d097Ff85",
    "tradeType": "EXACT_INPUT",
    "recipient": "0xF0AE622e463fa757Cf72243569E18Be7Df1996cd",
    "amount": "100000000",
    "usePermit": false,
    "useExternalLiquidity": false,
    "referrer": "privy.io",
    "useDepositAddress": true,
    "refundTo": "0xF0AE622e463fa757Cf72243569E18Be7Df1996cd"
  }'
See the body parameters for this request below.
When using deposit addresses, set useDepositAddress to true, refundTo to the refund recipient address, and tradeType to EXACT_INPUT. Only exact input bridging is supported for deposit addresses.
2

2. Extract deposit address and requestId

The quote response contains a steps array with information for how to execute your bridge/swap.Specifically, extract the depositAddress from quote.steps[0].depositAddress and the requestId from quote.steps[0].requestId. The depositAddress is where you send tokens, and the requestId is used to track the bridge status.
const depositAddress = quote.steps[0].depositAddress;
const requestId = quote.steps[0].requestId;
3

3. Send funds to deposit address

Send tokens to the deposit address. They will be bridged or swapped and sent to the recipient address on the destination chain.

Check bridge status

After sending funds to the deposit address, your app can monitor the bridge status using the requestId from the quote response.

Conclusion

With Privy and Relay deposit addresses, your app can enable seamless cross-chain funding for your users’ embedded wallets. Users can fund wallets on any chain from any supported chain, making the onboarding and funding experience frictionless. For limitations, edge cases, and advanced use cases, refer to the Relay deposit addresses documentation, or reach out to us in Slack.