Allowance Module SDK Reference
This page documents all methods available on the AllowanceModule class in AbstractionKit. For a step-by-step implementation guide, see How to Enable Spend Permissions.
AbstractionKit provides two types of methods:
- Recommended methods: Simplified interfaces with clear naming, documented under Methods below.
- Advanced methods: Prefixed with
createBase, these match exact contract method names and parameters. Documented under Advanced Methods.
The recommended methods cover most use cases. Use the advanced methods only when you need direct contract-level control.
Methods
Creates a MetaTransaction to enable the Allowance Module for a Safe account. This only needs to be called once per Safe.
| key | type | description |
|---|
accountAddress | string | The target Safe Account address to enable the module for. |
| key | type | description |
|---|
MetaTransaction | | key | type | description |
|---|
to | string | To address, or the the target contract address for the transaction | value | BigNumberish | Value transfered if making a native token transfer. (usually 0n for contract interaction with non-native tokens like erc-20 tokens) | data | BytesLike | The call data for the transaction | operation | Operation: enum | Default to 0 for a Call. 1 for a Delegate Call. (Optional) |
| MetaTransaction is the type of transaction to construct a Safe operation. |
Creates a MetaTransaction that adds a delegate to the account. The delegate can then be granted allowances to spend tokens.
| key | type | description |
|---|
delegate | string | The delegate address that should be added. |
| key | type | description |
|---|
MetaTransaction | | key | type | description |
|---|
to | string | To address, or the the target contract address for the transaction | value | BigNumberish | Value transfered if making a native token transfer. (usually 0n for contract interaction with non-native tokens like erc-20 tokens) | data | BytesLike | The call data for the transaction | operation | Operation: enum | Default to 0 for a Call. 1 for a Delegate Call. (Optional) |
| MetaTransaction is the type of transaction to construct a Safe operation. |
Creates a MetaTransaction that sets a one-time allowance for a delegate. The allowance does not reset after use. An optional start delay can be configured.
| key | type | description |
|---|
delegate | string | The address of the delegate to whom the allowance is given. |
token | string | The address of the token for which the allowance is set. |
allowanceAmount | bigint | The amount of the token allowed for the delegate. |
startAfterInMinutes | bigint | The delay in minutes before the allowance can be used. |
| key | type | description |
|---|
MetaTransaction | | key | type | description |
|---|
to | string | To address, or the the target contract address for the transaction | value | BigNumberish | Value transfered if making a native token transfer. (usually 0n for contract interaction with non-native tokens like erc-20 tokens) | data | BytesLike | The call data for the transaction | operation | Operation: enum | Default to 0 for a Call. 1 for a Delegate Call. (Optional) |
| MetaTransaction is the type of transaction to construct a Safe operation. |
Creates a MetaTransaction that sets a recurring allowance for a delegate. The allowance automatically resets after the specified validity period. An optional start delay can be configured.
| key | type | description |
|---|
delegate | string | The address of the delegate to whom the recurring allowance is given. |
token | string | The address of the token for which the allowance is set. |
allowanceAmount | bigint | The amount of the token allowed for the delegate. |
recurringAllowanceValidityPeriodInMinutes | bigint | The time period (in minutes) after which the allowance resets. |
startAfterInMinutes | bigint | The delay in minutes before the allowance can be used. |
| key | type | description |
|---|
MetaTransaction | | key | type | description |
|---|
to | string | To address, or the the target contract address for the transaction | value | BigNumberish | Value transfered if making a native token transfer. (usually 0n for contract interaction with non-native tokens like erc-20 tokens) | data | BytesLike | The call data for the transaction | operation | Operation: enum | Default to 0 for a Call. 1 for a Delegate Call. (Optional) |
| MetaTransaction is the type of transaction to construct a Safe operation. |
Creates a MetaTransaction that executes a token transfer using the delegate's allowance. The delegate calls this to move tokens from the source Safe to a recipient.
| key | type | description |
|---|
allowanceSourceSafeAddress | string | The safe address from which the allowance is being transferred. |
token | string | The token address being transferred. |
to | string | The recipient address of the allowance transfer. |
amount | bigint | The amount of tokens to be transferred. |
delegate | string | The delegate address managing the transfer. |
overrides | | key | type | description |
|---|
delegateSignature | string | The signature of the delegate. Optional. | paymentToken | string | An optional payment token address. Defaults to the zero address. | paymentAmount | bigint | The amount of the payment token to be transferred. Required if paymentToken is specified. |
| Optional overrides including delegate signature, payment token, and payment amount. |
| key | type | description |
|---|
MetaTransaction | | key | type | description |
|---|
to | string | To address, or the the target contract address for the transaction | value | BigNumberish | Value transfered if making a native token transfer. (usually 0n for contract interaction with non-native tokens like erc-20 tokens) | data | BytesLike | The call data for the transaction | operation | Operation: enum | Default to 0 for a Call. 1 for a Delegate Call. (Optional) |
| MetaTransaction is the type of transaction to construct a Safe operation. |
Creates a MetaTransaction that resets (renews) the allowance for a specific delegate and token. This lets the account owner extend the delegate's allowance without deleting and recreating it.
| key | type | description |
|---|
delegate | string | The address of the delegate whose allowance should be reset. |
token | string | The address of the token for which the allowance is set. |
| key | type | description |
|---|
MetaTransaction | | key | type | description |
|---|
to | string | To address, or the the target contract address for the transaction | value | BigNumberish | Value transfered if making a native token transfer. (usually 0n for contract interaction with non-native tokens like erc-20 tokens) | data | BytesLike | The call data for the transaction | operation | Operation: enum | Default to 0 for a Call. 1 for a Delegate Call. (Optional) |
| MetaTransaction is the type of transaction to construct a Safe operation. |
Creates a MetaTransaction that removes the allowance for a specific delegate and token. This sets all values except the nonce to 0, revoking the delegate's permission.
| key | type | description |
|---|
delegate | string | The address of the delegate whose allowance should be removed. |
token | string | The address of the token for which the allowance is set. |
| key | type | description |
|---|
MetaTransaction | | key | type | description |
|---|
to | string | To address, or the the target contract address for the transaction | value | BigNumberish | Value transfered if making a native token transfer. (usually 0n for contract interaction with non-native tokens like erc-20 tokens) | data | BytesLike | The call data for the transaction | operation | Operation: enum | Default to 0 for a Call. 1 for a Delegate Call. (Optional) |
| MetaTransaction is the type of transaction to construct a Safe operation. |
Helpers
getDelegates
Retrieves a list of delegates associated with a Safe account. Supports pagination for large sets of delegates.
| key | type | description |
|---|
nodeRpcUrl | string | The JSON-RPC API URL for the target chain. |
safeAddress | string | The target account address. |
overrides | | key | type | description |
|---|
start | bigint | The starting point for fetching delegates. Defaults to 0. | maxNumberOfResults | bigint | The maximum number of results to return. If specified, overrides pagination. |
| Optional parameters for pagination. |
| key | type | description |
|---|
Delegate Addresses | string[] | A promise that resolves to a list of delegate addresses. |
getTokensAllowance
Retrieves the allowance details for a specific delegate and token. Returns the amount, spent, reset time, last reset time, and nonce.
| key | type | description |
|---|
nodeRpcUrl | string | The JSON-RPC API URL for the target chain. |
safeAddress | string | The target account address. |
delegate | string | The address of the target delegate. |
token | string | The address of the token for which the allowance is being queried. |
| key | type | description |
|---|
Allowance | | key | type | description |
|---|
amount | bigint | The total allowance amount. | spent | bigint | The amount spent from the allowance. | resetTimeMin | bigint | The time in minutes after which the allowance resets. | lastResetMin | bigint | The time in minutes when the allowance was last reset. | nonce | bigint | The nonce for the allowance. |
| A promise that resolves to the allowance details for the specified token. |
getTokens
Retrieves the list of delegated token addresses for a specific delegate on a Safe account.
| key | type | description |
|---|
nodeRpcUrl | string | The JSON-RPC API URL for the target chain. |
safeAddress | string | The target account address. |
delegate | string | The address of the target delegate. |
| type | description |
|---|
string[] | A promise that resolves to a list of delegated token addresses. |
IsModuleEnabled
Checks if a specified module is enabled for a given Safe account. Returns a boolean.
See the method IsModuleEnabled in the Safe Account reference.
Creates a MetaTransaction that removes a delegate from the Safe account. Can also remove all associated allowances if specified.
| key | type | description |
|---|
delegate | string | The delegate address that should be removed. |
removeAllowances | boolean | Indicator if allowances should also be removed. Set to true unless this causes an out of gas. |
| key | type | description |
|---|
MetaTransaction | | key | type | description |
|---|
to | string | To address, or the the target contract address for the transaction | value | BigNumberish | Value transfered if making a native token transfer. (usually 0n for contract interaction with non-native tokens like erc-20 tokens) | data | BytesLike | The call data for the transaction | operation | Operation: enum | Default to 0 for a Call. 1 for a Delegate Call. (Optional) |
| MetaTransaction is the type of transaction to construct a Safe operation. |
Advanced Methods
Creates a MetaTransaction to update the allowance for a specified token. This can only be executed via a Safe transaction. Use this when you need direct control over the resetTimeMin and resetBaseMin parameters.
| key | type | description |
|---|
delegate | string | The address of the delegate whose allowance should be updated. |
token | string | The address of the token for which the allowance is set. |
allowanceAmount | bigint | The amount of the token allowed for the delegate. |
resetTimeMin | bigint | Time in minutes after which the allowance resets. |
resetBaseMin | bigint | Time interval to increase the reset time. |
| key | type | description |
|---|
MetaTransaction | | key | type | description |
|---|
to | string | To address, or the the target contract address for the transaction | value | BigNumberish | Value transfered if making a native token transfer. (usually 0n for contract interaction with non-native tokens like erc-20 tokens) | data | BytesLike | The call data for the transaction | operation | Operation: enum | Default to 0 for a Call. 1 for a Delegate Call. (Optional) |
| MetaTransaction is the type of transaction to construct a Safe operation. |
Creates a MetaTransaction that executes a transfer using the allowance. This is the low-level version of createAllowanceTransferMetaTransaction with explicit payment token and delegate signature parameters.
| key | type | description |
|---|
safeAddress | string | The Safe address whose funds should be used. |
token | string | The token contract address being transferred. |
to | string | The recipient address of the token transfer. |
amount | bigint | The amount of tokens to be transferred. |
paymentToken | string | The token that should be used to pay for the execution of the transfer. |
payment | bigint | The amount to be paid for executing the transfer. |
delegate | string | The delegate whose allowance should be updated. |
delegateSignature | string | Signature generated by the delegate to authorize the transfer. |
| key | type | description |
|---|
MetaTransaction | | key | type | description |
|---|
to | string | To address, or the the target contract address for the transaction | value | BigNumberish | Value transfered if making a native token transfer. (usually 0n for contract interaction with non-native tokens like erc-20 tokens) | data | BytesLike | The call data for the transaction | operation | Operation: enum | Default to 0 for a Call. 1 for a Delegate Call. (Optional) |
| MetaTransaction is the type of transaction to construct a Safe operation. |
Advanced Helpers
baseGetDelegates
Retrieves a list of delegates associated with a Safe account. This is the low-level version with explicit pagination parameters (start and pageSize).
| key | type | description |
|---|
nodeRpcUrl | string | The JSON-RPC API URL for the target chain. |
safeAddress | string | The target account address. |
start | bigint | The starting point for fetching delegates. |
pageSize | bigint | The number of delegates to return in one call. |
| key | description | type |
|---|
{ results: string[], next: bigint } | A promise that resolves to an object containing the list of delegate addresses and the next starting point for pagination. | | key | type | description |
|---|
results | string[] | A list of delegate addresses. | next | bigint | The next starting point for pagination. Returns 0 if there are no more delegates. |
|