import type { Chain } from '../providers/circle-wallets/index.js'; import type { Account, Address, Contract, ControlFlowOptions, NativeUnits, BaseUnits, FeeValuesEIP1559 } from '../types.js'; import type { Abi, Client } from 'viem'; /** * Parameters for the {@link transfer} function. */ export type TransferParams = { /** * The sender's address or account. Can be a single address/account or an array of addresses/accounts. * */ from: Address | Account | (Address | Account)[]; /** * The recipient's address or account. * */ to: Address | Account; /** * The amount to be transferred. Can be specified directly or as a function that returns a promise resolving to the amount. * */ amount: NativeUnits | BaseUnits | ((account: Account) => Promise); /** * The address of the token or chain contract, if applicable. * */ token?: Address | { address: Address; abi?: Abi; } | null; /** * The gas limit for the transaction. * */ gas?: bigint; /** * The fee values for the transaction. Can be specified directly or as a function that returns a promise resolving to the fee values. * */ fees?: FeeValuesEIP1559 | ((params: EstimateFeesPerGasParams) => Promise); /** * The blockchain network on which the transaction will be executed. * */ chain?: Chain; }; /** * Return type for the transfer function. */ export type TransferReturnType = { /** Transaction Hash */ hash: Address; }[]; /** * Parameters for estimating fees per gas. */ export type EstimateFeesPerGasParams = { client: Client; request: { from: Account; to: Account; token?: Contract; amount: BaseUnits; chain: Chain; }; }; /** * Transfers tokens or native currency from one account to another. * @param client - The client instance. * @param params - The transfer parameters. * @returns An array of transfer return types containing transaction hashes. * * @example * Transferring native tokens * ```typescript * await client.transfer({ * from: '0x0000000000000000000000000000000000000000', * to: '0x0000000000000000000000000000000000000000', * amount: 1n, * }) * ``` * * @example * Transferring `USDC` tokens on default chain * ```typescript * await client.transfer({ * from: '0x0000000000000000000000000000000000000000', * to: '0x0000000000000000000000000000000000000000', * amount: 1n, * token: client.chain.contracts.USDC, * }) * ``` * * @example * Specifying gas fees. Default is to use `HIGH` fee level * ```typescript * await client.transfer({ * from: '0x0000000000000000000000000000000000000000', * to: '0x0000000000000000000000000000000000000000', * amount: 1n, * gas: 100n, * fees: { maxFeePerGas: 200n, maxPriorityFeePerGas: 300n }, * }) * ``` * * @example * Usage with [LOW](../variables/providers_circle-wallets.LOW.html) * ```typescript * await client.transfer({ * from: '0x0000000000000000000000000000000000000000', * to: '0x0000000000000000000000000000000000000000', * amount: 1n, * fees: LOW, * }) * ``` * * @example * Transfer USDC cross-chain using CCTP * ```typescript * const [ account_1 ] = await client.getAccounts({ address: '0x123', chain: ETH_SEPOLIA }) * const [ account_2 ] = await client.getAccounts({ address: '0x321', chain: MATIC_AMOY }) * * await client.transfer({ * from: account_1, * to: account_2, * amount: '20', * token: ETH_SEPOLIA.contracts.USDC, * }) * ``` */ export declare function transfer(client: Client, params: TransferParams & ControlFlowOptions): Promise;