Skip to main content
The Withdraw component handles outbound crypto-to-crypto fund flows. Users specify an amount and destination; the SDK handles routing, fee calculation, and execution.
Withdraw is currently crypto to crypto only. Fiat off-ramps are not yet supported; once available, the destination will be able to settle to a bank account, card, or cash network through this same component.

Basic usage

import { Withdraw } from "0xtrails";

// Open UI, user fills in amount and destination
<Withdraw apiKey="YOUR_API_KEY" />

Pre-configured withdrawal

<Withdraw
  apiKey="YOUR_API_KEY"
  from={{
    token: "USDC",
    chain: "polygon",
  }}
  to={{
    recipient: "0xDESTINATION_ADDRESS",
    token: "USDC",
    chain: "ethereum",
  }}
  onWithdrawSuccess={(result) => console.log("Withdrawn:", result)}
/>

ENS resolution

The to.recipient field accepts .eth ENS names and resolves them automatically:
<Withdraw
  apiKey="YOUR_API_KEY"
  to={{
    recipient: "vitalik.eth",
    token: "USDC",
    chain: "ethereum",
  }}
/>

Props reference

PropTypeRequiredDescription
apiKeystringYesYour API key
from.tokenstringNoSource ERC20 symbol or address
from.chainstring | numberNoSource chain
from.amountstringNoPre-fill amount to withdraw
from.walletAddressstringNoSource wallet address
to.recipientstringNoDestination address or ENS name
to.tokenstringNoDestination ERC20 symbol or address
to.chainstring | numberNoDestination chain
to.calldatastringNoABI-encoded calldata to execute at the destination
onWithdrawStartfunctionNoCalled when the user begins
onWithdrawSuccessfunctionNoCalled on completion
onWithdrawErrorfunctionNoCalled on failure
For appearance and wallet options, see SDK configuration.