transfer()
Send any ERC20 token without holding FLR. The fee is deducted automatically from the user's fee token.
Usage
typescript
import { Zedkr } from "zedkr";
const client = await Zedkr.create({ provider });
const result = await client.transfer(signer, "0xRecipient", "0xToken", "10", 6);
console.log(result.txHash);Parameters
| Param | Type | Description |
|---|---|---|
| signer | ethers.Signer | The user's wallet signer |
| to | string | Recipient wallet address |
| token | string | ERC20 token address to send |
| amount | string | Human-readable amount e.g. "10.5" |
| decimals | number? | Token decimals, defaults to 18 |
Example: send FXRP
typescript
const result = await client.transfer(
signer,
"0xRecipient",
"0x0b6A3645c240605887a5532109323A3E12273dc7", // FXRP
"50",
6
);Note
Approve the router once for each token before the first transfer. See Getting Started for the one-time approval step.
Draining the full balance
When you need to send a user's entire token balance, use transferAll(). The SDK reads the on-chain balance, subtracts the fee, and sends the remainder so the wallet lands at exactly zero. No manual math needed.
typescript
// Send entire balance — fee auto-deducted from same token
const result = await client.transferAll(signer, "0xRecipient", "0xUSDT", 6);
console.log(result.sentAmount); // balance minus fee, wallet hits zeroTip
Same-token fee deduction: if the fee token and send token are the same (e.g. USDT fee, USDT send),
transferAll() handles it automatically. The wallet empties to zero.