ERC20 Approval on Actions
When an action needs to spend ERC20 tokens from Signer, the Signer must first approve the ERC20 token transfer.
If the required approval is missing, the system returns a SignerErc20ApprovalRequired error that indicates which token needs approval before the action can proceed.
Approval for a given Signer/Token pair for an authenticated Account can be prepared in two ways:
Infinite Approval - approve unlimited amount of tokens (only once per token).
Exact Approval - approve a specific amount of tokens to spend.
- TypeScript
- GraphQL
- React
Use the prepareSignerErc20Approval action to prepare an approval transaction.
- TypeScript
- GraphQL
- React
Then, handle the result using the adapter for the library of your choice:
See the Transaction Lifecycle guide for more information on how to determine the status of the transaction.