Usage
Parameters
Parameter | Type | Required | Description |
---|---|---|---|
to | PublicKey | Yes | Recipient’s wallet address |
amount | number | Yes | Amount to transfer |
mint | PublicKey | No | Token mint address (omit for SOL) |
Example Prompts
Natural Language Prompts
LangChain Tool Prompts
Example Implementation
Here’s a complete example showing different types of transfers:Implementation Details
- Automatically detects SOL vs SPL token transfers
- Handles decimal adjustment for SPL tokens
- Creates Associated Token Accounts if needed
- Uses single-instruction transactions for efficiency
Error Handling
Best Practices
-
Amount Validation
- Always verify token decimals
- Check balances before transfer
- Account for transaction fees
-
Address Validation
- Validate recipient addresses
- Double-check mint addresses
- Use address checksums
-
Transaction Management
- Monitor transaction status
- Implement retry logic
- Handle timeouts appropriately
-
Security
- Verify recipient addresses carefully
- Implement confirmation dialogs
- Consider using transaction previews
Common Token Addresses
- SOL: Native token (no mint address needed)
- USDC:
EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v
- USDT:
Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB
- BONK:
DezXAZ8z7PnrnRJjz3wXBoRgixCa6xjnB7YaB1pPB263