useApproveERC20
Last updated
useApproveERC20(
tokenAddress,contractAddress,amount?,chainId?,enabled?):object
A custom hook for managing ERC-20 token approval to a specific contract. This hook includes functionality to check the current allowance, simulate the approval transaction, execute the approval, and track its status.
`0x${string}`
The address of the ERC-20 token to be approved.
`0x${string}`
The address of the contract to which the token is being approved.
bigint
The amount of tokens to approve. If not provided, it defaults to 0n.
number
The ID of the blockchain network where the ERC-20 token resides.
boolean = true
A flag to enable or disable the hook's functionality. When false, all queries and actions are disabled.
object
An object containing the following
allowance:
undefined|bigint
approve: () =>
void
Returns
void
approveError:
null|WriteContractErrorType
approveLoading:
boolean
approveSuccess:
boolean
approveTxLoading:
boolean
approveTxSuccess:
boolean
Last updated