TransferForm component provides a complete interface for transferring tokens to other addresses across different blockchain networks. It handles recipient validation, quote fetching, and transfer execution.
Import
Overview
The TransferForm is a self-contained component that manages the complete token transfer workflow:- Asset Selection: Choose which token to transfer
- Amount Input: Specify transfer amount with balance validation
- Recipient Address: Enter destination wallet address
- Network Selection: Choose destination blockchain network
- Quote Fetching: Automatically calculates transfer costs
- Transaction Execution: Handles the complete transfer flow
Component Structure
This component does not accept props - it’s a standalone form that manages its own state.Key Features
Recipient Management
The component validates recipient addresses and supports ENS names:Cross-Chain Support
Users can select the destination network from all supported chains:Balance Validation
Built-in balance checking prevents insufficient balance errors:Usage Example
State Management
Asset State
string
default:"'ob:usdc'"
The aggregated asset ID of the token to transfer
string
The human-readable amount to transfer
string
The amount converted to the token’s base unit (wei for ETH, etc.)
Recipient State
string
The destination wallet address (supports 0x addresses and ENS names)
string
The CAIP-2 chain identifier for the destination network (e.g., ‘eip155:42161’ for Arbitrum)
Quote Lifecycle
1. Quote Request
Triggered when amount, asset, recipient address, or destination chain changes:2. Quote Display
Shows transfer quote details including:- Transfer cost
- Gas estimates
- Quote expiration countdown
- Net amount recipient receives
3. Quote Execution
Executes the transfer when the user confirms:User Interactions
Percentage Buttons
Quick-select buttons for common transfer amounts:Address Validation
Real-time validation feedback:Network Selection
Visual network selector with chain logos:Button States
The transfer button dynamically updates based on application state:Error Handling
Address Validation Errors
Quote Errors
API Errors
Transaction Completion
After a successful transfer:- Form inputs are cleared
- Quote state is reset
- User balances are refreshed
Onboarding Support
The component includes data attributes for onboarding tooltips:data-onboarding="transfer-card": Main card containerdata-onboarding="transfer-token": Token selection and amount inputdata-onboarding="transfer-recipient": Recipient address inputdata-onboarding="transfer-network": Network selection dropdowndata-onboarding="transfer-button": Execute transfer button
Dependencies
Address Format
The recipient address is formatted as a CAIP-10 account identifier:Network Support
All chains returned by theuseChains hook are supported as destination networks. The default network is Arbitrum (eip155:42161).
Related Components
- TokenInput - Asset selection and amount input
- QuoteDetails - Quote information display
- SwapForm - Token swap interface