Skip to main content

useTransferBatchToken() function

This feature is currently in beta and may change based on feedback that we receive.

Use this to transfer batch tokens on your contract

Example

const Component = () => {
const { contract } = useContract(<ContractAddress>);
const {
mutate: transferBatchTokens,
isLoading,
error,
} = useTransferToken(contract);

if (error) {
console.error("failed to transfer batch tokens", error);
}

return (
<button
disabled={isLoading}
onClick={() => transferBatchTokens([{ to: "0x...", amount: 1000 }, { to: "0x...", amount: 2000 }])}
>
Transfer Batch
</button>
);
};

Signature:

export declare function useTransferBatchToken(
contract: RequiredParam<TokenContract>,
): import("@tanstack/react-query").UseMutationResult<
void,
unknown,
TokenParams[],
unknown
>;

Parameters

ParameterTypeDescription
contractRequiredParam<TokenContract>an instance of a TokenContract

Returns:

import("@tanstack/react-query").UseMutationResult<void, unknown, TokenParams[], unknown>

a mutation object that can be used to transfer batch tokens