A hook to transfer native token (of the active chain) to another wallet
const Component = () => { const { mutate: transferNativeToken, isLoading, error, } = useTransferNativeToken(); if (error) { console.error("failed to transfer tokens", error); } return ( <button disabled={isLoading} onClick={() => transferNativeToken({ to: "{{wallet_address}}", amount: "0.1", }) } > Transfer </button> );};
function useTransferNativeToken(): UseMutationResult< Omit<TransactionResultWithMetadata<unknown>, "data">, unknown, TokenParams, unknown>;
let returnType: UseMutationResult< Omit<TransactionResultWithMetadata<unknown>, "data">, unknown, TokenParams, unknown>;
A Mutation object to transfer native tokens
const { mutateAsync, isLoading, error } = useTransferNativeToken();
The mutation function takes an object containing to and amount properties.
to
amount
to - The wallet address to transfer tokens to. Must be a string .
string
amount - The amount of tokens to transfer. Must be a number .
number