Defined in the Base Account SDK
Validates a permission against current time and revocation state and returns
remaining spend and next period start.
Parameters
Signed permission to evaluate. This should be a SpendPermission object returned from requestSpendPermission or fetched via fetchPermissions.Show SpendPermission properties
Deterministic EIP-712 hash of the permission.
Signature for the EIP-712 payload.
Underlying permission fields.
Unix timestamp (seconds).
Unix timestamp (seconds).
Returns
status
GetPermissionStatusResponse
Status details for the permission.Show GetPermissionStatusResponse properties
Remaining allowance in wei for the current period.
When the next allowance period begins.
True if approved and not revoked or expired.
import { getPermissionStatus } from "@base-org/account/spend-permission";
const { isActive, remainingSpend } = await getPermissionStatus(permission);
{
remainingSpend: 1000000000000000000n,
nextPeriodStart: new Date("2024-01-31T00:00:00Z"),
isActive: true
}
Error Handling
Always wrap the call in a try-catch block to handle these errors gracefully.