use {
anchor_lang::prelude::*,
crate::state::*,
};
#[derive(Accounts)]
pub struct DeletePointer<'info> {
#[account(
mut,
seeds = [
SEED_INDEX,
index.owner.key().as_ref(),
index.namespace.as_ref()
],
bump = index.bump,
has_one = owner,
)]
pub index: Account<'info, Index>,
#[account(mut)]
pub owner: Signer<'info>,
#[account(
mut,
seeds = [
SEED_POINTER,
index.key().as_ref(),
pointer.name.as_bytes(),
],
bump = pointer.bump,
close = owner
)]
pub pointer: Account<'info, Pointer>,
#[account(
mut,
seeds = [
SEED_PROOF,
index.key().as_ref(),
pointer.value.as_ref(),
],
bump = proof.bump,
close = owner
)]
pub proof: Account<'info, Proof>,
}
pub fn handler(ctx: Context<DeletePointer>) -> ProgramResult {
let index = &mut ctx.accounts.index;
index.count -= 1;
return Ok(());
}