Skip to main content
Defined in the Base Account SDK
Constructs an EIP-712 payload for a spend permission and prompts the user to sign it. Returns a SpendPermission object containing the signature and normalized permission data you can later use to spend or register onchain.

Parameters

address
required
Smart account that this spend permission applies to.
address
required
The spender that can move funds from account within the configured limits.
address
required
Token address. Supports ERC-7528 native token address and ERC-20 contracts.
number
required
Chain ID where this permission is valid.
bigint
required
Maximum amount that can be spent during each period (in wei).
number
required
Length of each allowance period in days.
Date
Start time when the spend permission becomes valid. Defaults to now.
Date
Time when the spend permission expires. Defaults to never.
string
Arbitrary salt to differentiate otherwise identical permissions. Hex string. Defaults to a random value.
string
Arbitrary data to attach to the permission. Hex string. Defaults to 0x.
EIP1193Provider
required
EIP-1193 compliant Ethereum provider instance. Get this from sdk.getProvider().

Returns

SpendPermission
Signed spend permission payload.

Error Handling

Always wrap the call in a try-catch block to handle these errors gracefully.