# 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](https://docs.candide.dev/wallet/plugins/allowance.md).

AbstractionKit provides two types of methods:

1. **Recommended methods**: Simplified interfaces with clear naming, documented under [Methods](#methods) below.
2. **Advanced methods**: Prefixed with `createBase`, these match exact contract method names and parameters. Documented under [Advanced Methods](#advanced-methods).

The recommended methods cover most use cases. Use the advanced methods only when you need direct contract-level control.

## Methods[​](#methods "Direct link to Methods")

### createEnableModuleMetaTransaction[​](#createenablemodulemetatransaction "Direct link to createEnableModuleMetaTransaction")

Creates a MetaTransaction to enable the Allowance Module for a Safe account. This only needs to be called once per Safe.

* Param Types
* Return Types

| key              | type     | description                                               |
| :--------------- | :------- | :-------------------------------------------------------- |
| `accountAddress` | `string` | The target Safe Account address to enable the module for. |

| key               | type                                                                                                                                                                                                                                                                                                                                                                               | description                                                               |
| :---------------- | :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :------------------------------------------------------------------------ |
| `MetaTransaction` | `key	type	descriptionto	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. |

### createAddDelegateMetaTransaction[​](#createadddelegatemetatransaction "Direct link to createAddDelegateMetaTransaction")

Creates a MetaTransaction that adds a delegate to the account. The delegate can then be granted allowances to spend tokens.

* Param Types
* Return Types

| key        | type     | description                                |
| :--------- | :------- | :----------------------------------------- |
| `delegate` | `string` | The delegate address that should be added. |

| key               | type                                                                                                                                                                                                                                                                                                                                                                               | description                                                               |
| :---------------- | :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :------------------------------------------------------------------------ |
| `MetaTransaction` | `key	type	descriptionto	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. |

### createOneTimeAllowanceMetaTransaction[​](#createonetimeallowancemetatransaction "Direct link to createOneTimeAllowanceMetaTransaction")

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.

* Param Types
* Return Types

| 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	descriptionto	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. |

### createRecurringAllowanceMetaTransaction[​](#createrecurringallowancemetatransaction "Direct link to createRecurringAllowanceMetaTransaction")

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.

* Param Types
* Return Types

| 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	descriptionto	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. |

### createAllowanceTransferMetaTransaction[​](#createallowancetransfermetatransaction "Direct link to createAllowanceTransferMetaTransaction")

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.

* Param Types
* Return Types

| 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	descriptiondelegateSignature	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	descriptionto	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. |

### createRenewAllowanceMetaTransaction[​](#createrenewallowancemetatransaction "Direct link to createRenewAllowanceMetaTransaction")

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.

* Param Types
* Return Types

| 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	descriptionto	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. |

### createDeleteAllowanceMetaTransaction[​](#createdeleteallowancemetatransaction "Direct link to createDeleteAllowanceMetaTransaction")

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.

* Param Types
* Return Types

| 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	descriptionto	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[​](#helpers "Direct link to Helpers")

### getDelegates[​](#getdelegates "Direct link to getDelegates")

Retrieves a list of delegates associated with a Safe account. Supports pagination for large sets of delegates.

* Param Types
* Return Types

| key           | type                                                                                                                                                                                         | description                                |
| :------------ | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :----------------------------------------- |
| `nodeRpcUrl`  | `string`                                                                                                                                                                                     | The JSON-RPC API URL for the target chain. |
| `safeAddress` | `string`                                                                                                                                                                                     | The target account address.                |
| `overrides`   | `key	type	descriptionstart	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[​](#gettokensallowance "Direct link to getTokensAllowance")

Retrieves the allowance details for a specific delegate and token. Returns the amount, spent, reset time, last reset time, and nonce.

* Param Types
* Return Types

| 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	descriptionamount	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[​](#gettokens "Direct link to getTokens")

Retrieves the list of delegated token addresses for a specific delegate on a Safe account.

* Param Types
* Return Types

| 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[​](#ismoduleenabled "Direct link to IsModuleEnabled")

Checks if a specified module is enabled for a given Safe account. Returns a boolean.

See the method [IsModuleEnabled](https://docs.candide.dev/wallet/abstractionkit/safe-account-v3/.md#ismoduleenabled) in the Safe Account reference.

### createRemoveDelegateMetaTransaction[​](#createremovedelegatemetatransaction "Direct link to createRemoveDelegateMetaTransaction")

Creates a MetaTransaction that removes a delegate from the Safe account. Can also remove all associated allowances if specified.

* Param Types
* Return Types

| 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	descriptionto	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[​](#advanced-methods "Direct link to Advanced Methods")

### createBaseSetAllowanceMetaTransaction[​](#createbasesetallowancemetatransaction "Direct link to createBaseSetAllowanceMetaTransaction")

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.

* Param Types
* Return Types

| 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	descriptionto	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. |

### createBaseExecuteAllowanceTransferMetaTransaction[​](#createbaseexecuteallowancetransfermetatransaction "Direct link to createBaseExecuteAllowanceTransferMetaTransaction")

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.

* Param Types
* Return Types

| 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	descriptionto	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[​](#advanced-helpers "Direct link to Advanced Helpers")

### baseGetDelegates[​](#basegetdelegates "Direct link to baseGetDelegates")

Retrieves a list of delegates associated with a Safe account. This is the low-level version with explicit pagination parameters (`start` and `pageSize`).

* Param Types
* Return Types

| 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	descriptionresults	string[]	A list of delegate addresses.
next	bigint	The next starting point for pagination. Returns 0 if there are no more delegates.` |
