Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.privy.io/llms.txt

Use this file to discover all available pages before exploring further.

This feature is experimental and may introduce breaking changes.
Funding overview

Overview

Privy provides a useDepositAddress hook in @privy-io/react-auth that opens a deposit address flow in the Privy modal. Your app can use this hook to let authenticated users fund a wallet by sending crypto from any supported source chain. Privy generates a unique deposit address, and when the user sends tokens to it, the funds are automatically bridged or swapped and delivered to the destination wallet. This is useful when users already hold crypto on a different chain than the one your app uses, or in a different wallet, app, or exchange.

Access the hook

Import and initialize useDepositAddress:
import {useDepositAddress} from '@privy-io/react-auth';

const {createDepositAddress} = useDepositAddress();

Start a deposit address flow

Call createDepositAddress with a destination chain, currency, and wallet address:
await createDepositAddress({
  destinationChain: 'eip155:8453',
  destinationCurrency: '0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913',
  destinationAddress: '0x1234...abcd'
});
The method opens the Privy modal where the user selects a source token and network. Privy displays a unique deposit address for the user to send funds to. Once the deposit is detected, the tokens will be bridged and swapped as needed and delivered to the destination address. createDepositAddress returns a Promise<void> that resolves when the deposit completes successfully, and rejects if an error occurs or the user exits the flow.
destinationChain accepts a CAIP-2 identifier (for example, eip155:8453 for Base or solana:mainnet for Solana).

Parameters

createDepositAddress accepts an object with the following fields:
destinationChain
string
required
CAIP-2 chain identifier for the destination (e.g. eip155:8453, solana:mainnet).
destinationCurrency
string
required
Token contract address on the destination chain. Use the zero address for native tokens.
destinationAddress
string
required
Wallet address to receive the deposited funds.

Returns

createDepositAddress returns a Promise<void> that resolves when the deposit completes successfully. The promise rejects if an error occurs or the user exits the flow.

Supported chains

Destination chains

Your app specifies the destination chain when calling createDepositAddress. The following destination chains are supported:
ChainCAIP-2 identifier
Baseeip155:8453
Ethereumeip155:1
Arbitrumeip155:42161
Optimismeip155:10
Polygoneip155:137
Solanasolana:mainnet
Trontron:20191129

Source chains

Users can deposit from a wide range of chains and assets, including Bitcoin, Solana, and other tokens. The Privy modal automatically presents available source options based on the destination configuration.

Example

import {useDepositAddress, useWallets} from '@privy-io/react-auth';

function FundWallet() {
  const {createDepositAddress} = useDepositAddress();

  const handleDeposit = async () => {
    try {
      await createDepositAddress({
        destinationAddress: '<your-wallet-address>'
        // Base
        destinationChain: 'eip155:8453',
        // USDC
        destinationCurrency: '0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913',
      });
      console.log('Deposit completed');
    } catch (error) {
      console.error('Deposit failed:', error);
    }
  };

  return <button onClick={handleDeposit}>Fund with crypto</button>;
}

Funding overview

All available methods for funding wallets.

Fiat onramp

Fund wallets with fiat via card, Apple Pay, or Google Pay.