💳Update Pause Pre Authorization
#[instruction(params: UpdatePausePreAuthorizationParams)] // only for documentation
pub struct UpdatePausePreAuthorization<'info> {
pub owner: Signer<'info>,
#[account(
has_one = owner @ CustomProgramError::PausePreAuthorizationUnauthorized
)]
pub token_account: InterfaceAccount<'info, TokenAccount>,
#[account(
mut,
seeds = [
b"pre-authorization",
token_account.key().as_ref(),
pre_authorization.debit_authority.as_ref(),
],
bump = pre_authorization.bump,
has_one = token_account @ CustomProgramError::PreAuthorizationTokenAccountMismatch,
)]
pub pre_authorization: Account<'info, PreAuthorization>,
}
pub struct UpdatePausePreAuthorizationParams {
pub pause: bool,
}
This instruction can be used to pause or unpause a pre-authorization.
Any pre-authorization can be paused. While paused, the debit authority will not be able to debit funds via the pre-auth (this is the only restriction during the paused state). Only the pre-auth's token account's owner can pause or unpause a pre-auth.
Note that for recurring pre-auths that have reset_every_cycle
set to false (i.e. cumulative), they will continue to accumulate the available amount across cycles as time progresses. If you wish to prevent that, closing that pre-auth and recreating it with a different configuration would be recommended.
Last updated