useWaasFeeOptions
Hook for handling WaaS fee options for gas payments
Import
Usage
Parameters
The hook accepts an optional configuration object with the following properties:
Parameter | Type | Description |
---|---|---|
skipFeeBalanceCheck | boolean | Whether to skip checking token balances (default: false ) |
Return Type: UseWaasFeeOptionsReturnType
The hook returns a tuple with the following elements:
Properties
pendingFeeOptionConfirmation
WaasFeeOptionConfirmation | undefined
Object containing the current fee confirmation details if a transaction is pending, or undefined
if no transaction is pending confirmation.
When skipFeeBalanceCheck
is false
, the options will be of type FeeOptionExtended
, which includes balance information:
confirmPendingFeeOption
(id: string, feeTokenAddress: string | null) => void
Function to confirm the selected fee option.
Parameter | Type | Description |
---|---|---|
id | string | The fee confirmation ID |
feeTokenAddress | string | null | The address of the token to use for fee payment (use null for native token) |
rejectPendingFeeOption
(id: string) => void
Function to reject the current fee option selection.
Parameter | Type | Description |
---|---|---|
id | string | The fee confirmation ID to reject |
Notes
This hook provides functionality for handling WaaS (Wallet as a Service) fee options for unsponsored transactions.
Key features:
- Get available fee options for a transaction in Native Token and ERC20 tokens
- Automatically fetch user wallet balances for each fee option (unless
skipFeeBalanceCheck
istrue
) - Allow users to select their preferred fee token
- Confirm or reject fee selections
The hook integrates with the Sequence WaaS provider to intercept fee confirmation requests and presents a user interface to allow selection of the fee token.
For a detailed guide on how to use the hook, see the Pay gas in ERC20 guide.
Was this page helpful?