Transfer Tokens
Thexyz token transfer command sends CW20 tokens from your account to another address.
Usage
Arguments
| Argument | Description |
|---|---|
contract | Token contract address |
recipient | Destination address |
amount | Amount to send (in smallest unit) |
Flags
| Flag | Description | Required |
|---|---|---|
--from | Your signing key | Yes |
--dry-run | Simulate only | No |
Examples
Basic Transfer
Transfer All Tokens
First check your balance:Dry Run
Output
Successful transfer:Verify Transfer
Check balances after transfer:Amount Calculation
Amount is in the token’s smallest unit. For 6 decimals:| Display | Amount (base) |
|---|---|
| 1 MTK | 1,000,000 |
| 0.5 MTK | 500,000 |
| 100 MTK | 100,000,000 |
Batch Transfers
Sequential
Script
Error Handling
| Error | Meaning | Solution |
|---|---|---|
| ”insufficient token balance” | Not enough tokens | Check balance first |
| ”invalid address” | Bad recipient format | Verify address format (xyz1…) |
| “contract not found” | Wrong contract address | Verify contract exists |
Check Balance Before Transfer
Under the Hood
xyz token transfer executes a MsgExecuteContract:
Transfer vs Send
CW20 has two transfer methods:| Method | Use Case |
|---|---|
transfer | Send to regular address |
send | Send to contract with callback |
xyz token transfer command uses transfer. For contract interactions, use xyz program execute.
Troubleshooting
Insufficient balance
Insufficient balance
Check your current balance:You can only transfer what you have.
Invalid recipient
Invalid recipient
Ensure the address:
- Starts with
xyz1 - Is the correct length
- Has valid checksum
Transaction timeout
Transaction timeout
The node may be slow. Check status:Retry the transfer if needed.