💳Pre Authorization
The Pre Authorization account (github) is the on-chain representation of a pre-authorization created for a token account by its owner and is debitable by a specific debit authority. Note that this entity is tied to a token account and NOT it's owner. This means that if you (as a token account owner) create a pre-authorization and then transfer the token account itself to someone else, this pre-authorization WILL be propagated also BUT it will not be active due to this mechanism where the delegate is unset by the SPL Token program. Hence, the new owner has to set the delegate to the smart-delegate once again to re-activate all the pre-authorizations and so the funds are not at risk in the interim.
This account let's the token account owner express 2 types of pre-authorizations:
One-time
Recurring
One-time pre-auths allow the debit authority to debit the authorized amount in the given window between activation and expiry (can be done in one IX or in batches).
Recurring pre-auths allow the debit authority to debit the authorized amount in each cycle. If the reset_every_cycle
flag is set to false
, the unused authorized amount will accrue across cycles until expiry (i.e. num_cycles
). Note that if there is no cycle limit and this flag is set to false, the amount available to the debit authority will increase forever, so proceed with caution if you decide to configure it with those parameters.
A pre-authorization can be created by the init_pre_authorization
instruction and it can be deactivated simply by closing it via the close_pre_authorization
instruction.
Multiple pre-authorizations for the same signer can be created by leveraging seeded accounts created from the master signer as unique derived debit authorities. Our SDK (WIP) will expose helper methods to do so.
Last updated