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 and is active as soon as the Safe executes the transaction. The module cannot delay activation of a one-time allowance.

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.

createRecurringAllowanceMetaTransaction​

Creates a MetaTransaction that sets a recurring allowance for a delegate. The allowance automatically resets after the specified validity period and is spendable as soon as the Safe executes the transaction. The optional inThePastPeriodStartBaseTimeStamp (unix seconds, in the past) only aligns when each period resets. It does not delay activation.

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. Must be between 0 and 65535 (the contract's uint16), otherwise a RangeError is thrown.
inThePastPeriodStartBaseTimeStampbigint?Optional unix timestamp in seconds that must be in the past. It only aligns the period boundaries (for example, any previous Saturday 10am to reset every Saturday 10am) and does not delay activation: the allowance is spendable as soon as the Safe executes the transaction. Converted to minutes internally. A millisecond timestamp throws a RangeError. Defaults to 0n, which starts the period accounting when the transaction executes for a new allowance, and keeps the current anchor when updating an existing one.

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.
overridesobjectOptional overrides including delegate signature, payment token, and payment amount.
overrides.delegateSignaturestringThe signature of the delegate. Optional.
overrides.paymentTokenstringAn optional payment token address. Defaults to the zero address.
overrides.paymentAmountbigintThe amount of the payment token to be transferred. Required if paymentToken is specified.

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.
overridesobjectOptional parameters for pagination.
overrides.startbigintThe starting point for fetching delegates. Defaults to 0.
overrides.maxNumberOfResultsbigintThe maximum number of results to return, between 0 and 255 (the module's page size is a uint8). If specified, disables automatic pagination. Omit it to fetch all delegates.

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.