๐ณInit Pre Authorization
#[instruction(params: InitPreAuthorizationParams)]
pub struct InitPreAuthorization<'info> {
#[account(mut)]
pub payer: Signer<'info>,
pub owner: Signer<'info>,
#[account(
seeds = [
b"smart-delegate",
],
bump = smart_delegate.bump,
)]
pub smart_delegate: Account<'info, SmartDelegate>,
#[account(
mut,
has_one = owner @ CustomProgramError::InitPreAuthorizationUnauthorized
)]
pub token_account: InterfaceAccount<'info, TokenAccount>,
#[account(
init,
space = 8 + PreAuthorization::INIT_SPACE,
seeds = [
b"pre-authorization",
token_account.key().as_ref(),
params.debit_authority.as_ref(),
],
bump,
payer = payer,
)]
pub pre_authorization: Account<'info, PreAuthorization>,
pub token_program: Interface<'info, TokenInterface>,
pub system_program: Program<'info, System>,
}
pub struct InitPreAuthorizationParams {
pub variant: InitPreAuthorizationVariant,
pub debit_authority: Pubkey,
pub activation_unix_timestamp: i64,
}Last updated