transfer(params)
Use the transfer
function to send funds from the unified balance to any wallet (EOA) on any chain using approved source chain funds.
Parameters
Typescript
interface TransferParams {
token: SUPPORTED_TOKENS;
amount: number | string;
chainId: SUPPORTED_CHAINS_IDS;
recipient: `0x${string}`;
}
Transfer Example
⚠️
Please go through the overview page to understand how to set up the SDK and the required hooks before using any SDK function that moves around user funds.
Here are some minimal examples of how to use the transfer
function:
Typescript
// Transfer to specific recipient
await sdk.transfer({
token: 'ETH',
amount: 1,
chainId: 1, // on Ethereum
recipient: '0x742d35Cc6634C0532925a3b8D4C9db96c4b4Db45',
});
// Transfer USDC on Polygon
await sdk.transfer({
token: 'USDC',
amount: '250.75',
chainId: 137,
recipient: '0xRecipientAddress',
});
Return Value
Typescript
interface TransferResult {
success: boolean;
error?: string;
explorerUrl?: string;
}
ADVANCED EXAMPLES
- You can also use the
transferSimulation
function to sanity check your transfer intent before executing it. You can go through the docs here - For a complete example on how to set up hooks and handle errors, you can go through the docs here
Last updated on