Returns a single spend permission by its unique hash identifier. This is useful when you have a permission hash from a previous operation and need to retrieve its current details.
Parameters
The unique hash identifier of the permission to retrieve.
Optional. EIP-1193 compliant Ethereum provider instance. Get this from
sdk.getProvider()
. If not provided, uses the default SDK provider.Returns
The spend permission matching the hash, or null if not found.
Error Handling
The function returnsnull
if the permission is not found rather than throwing an error. Always check for null values:
Usage Notes
This function is particularly useful when:
- You have a permission hash from a previous operation (e.g., from
requestSpendPermission
) - You want to verify the current state of a specific permission
- You need to look up permission details without knowing the account or spender information
- You’re tracking specific permissions across sessions
fetchPermissions
, this function:
- Returns a single permission instead of an array
- Does not require account, chain, or spender parameters
- Provides direct access via the permission’s unique identifier
- Returns
null
instead of an empty array when no permission is found