Skip to main content

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:

  1. Recommended methods: Simplified interfaces with clear naming, documented under Methods below.
  2. 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

createEnableModuleMetaTransaction

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

keytypedescription
accountAddressstringThe target Safe Account address to enable the module for.

createAddDelegateMetaTransaction

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

keytypedescription
delegatestringThe delegate address that should be added.

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.

keytypedescription
delegatestringThe address of the delegate to whom the allowance is given.
tokenstringThe address of the token for which the allowance is set.
allowanceAmountbigintThe amount of the token allowed for the delegate.
startAfterInMinutesbigintThe delay in minutes before the allowance can be used.

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.

keytypedescription
delegatestringThe address of the delegate to whom the recurring allowance is given.
tokenstringThe address of the token for which the allowance is set.
allowanceAmountbigintThe amount of the token allowed for the delegate.
recurringAllowanceValidityPeriodInMinutesbigintThe time period (in minutes) after which the allowance resets.
startAfterInMinutesbigintThe delay in minutes before the allowance can be used.

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.

keytypedescription
allowanceSourceSafeAddressstringThe safe address from which the allowance is being transferred.
tokenstringThe token address being transferred.
tostringThe recipient address of the allowance transfer.
amountbigintThe amount of tokens to be transferred.
delegatestringThe delegate address managing the transfer.
overrides
keytypedescription
delegateSignaturestringThe signature of the delegate. Optional.
paymentTokenstringAn optional payment token address. Defaults to the zero address.
paymentAmountbigintThe amount of the payment token to be transferred. Required if paymentToken is specified.
Optional overrides including delegate signature, payment token, and payment amount.

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.

keytypedescription
delegatestringThe address of the delegate whose allowance should be reset.
tokenstringThe address of the token for which the allowance is set.

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.

keytypedescription
delegatestringThe address of the delegate whose allowance should be removed.
tokenstringThe address of the token for which the allowance is set.

Helpers

getDelegates

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

keytypedescription
nodeRpcUrlstringThe JSON-RPC API URL for the target chain.
safeAddressstringThe target account address.
overrides
keytypedescription
startbigintThe starting point for fetching delegates. Defaults to 0.
maxNumberOfResultsbigintThe maximum number of results to return. If specified, overrides pagination.
Optional parameters for pagination.

getTokensAllowance

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

keytypedescription
nodeRpcUrlstringThe JSON-RPC API URL for the target chain.
safeAddressstringThe target account address.
delegatestringThe address of the target delegate.
tokenstringThe address of the token for which the allowance is being queried.

getTokens

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

keytypedescription
nodeRpcUrlstringThe JSON-RPC API URL for the target chain.
safeAddressstringThe target account address.
delegatestringThe address of the target delegate.

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.

createRemoveDelegateMetaTransaction

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

keytypedescription
delegatestringThe delegate address that should be removed.
removeAllowancesbooleanIndicator if allowances should also be removed. Set to true unless this causes an out of gas.

Advanced Methods

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.

keytypedescription
delegatestringThe address of the delegate whose allowance should be updated.
tokenstringThe address of the token for which the allowance is set.
allowanceAmountbigintThe amount of the token allowed for the delegate.
resetTimeMinbigintTime in minutes after which the allowance resets.
resetBaseMinbigintTime interval to increase the reset time.

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.

keytypedescription
safeAddressstringThe Safe address whose funds should be used.
tokenstringThe token contract address being transferred.
tostringThe recipient address of the token transfer.
amountbigintThe amount of tokens to be transferred.
paymentTokenstringThe token that should be used to pay for the execution of the transfer.
paymentbigintThe amount to be paid for executing the transfer.
delegatestringThe delegate whose allowance should be updated.
delegateSignaturestringSignature generated by the delegate to authorize the transfer.

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

keytypedescription
nodeRpcUrlstringThe JSON-RPC API URL for the target chain.
safeAddressstringThe target account address.
startbigintThe starting point for fetching delegates.
pageSizebigintThe number of delegates to return in one call.