transfer()

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

ParamTypeDescription
signerethers.SignerThe user's wallet signer
tostringRecipient wallet address
tokenstringERC20 token address to send
amountstringHuman-readable amount e.g. "10.5"
decimalsnumber?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 zero
Tip
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.