close

Function close 

Source
pub fn close(signer: Pubkey) -> Instruction
Expand description

Builds a social claim instruction.

This instruction allows users to claim social marketing rewards based on their social media engagement. Social rewards require payment activity in the same epoch and are verified through oracle signatures to prevent gaming.

§Parameters

  • signer: The wallet signing the transaction
  • beneficiary: The wallet receiving the rewards
  • epoch: The epoch number for the claim (payment activity required)
  • merkle_root: Merkle root for payment verification
  • merkle_path: Merkle proof path for payment activity
  • path_indices: Merkle proof path indices (true = right, false = left)
  • participant_type: 0 for customer, 1 for merchant
  • social_data: Social media verification data

§Returns

  • Instruction for claiming social rewards

§Requirements

Builds a close instruction.

This instruction allows a user to close their Proof account and recover the rent. The Proof account can only be closed if:

  1. The signer is the Proof account owner (authority)
  2. No rewards have been claimed (total_claimed_rewards == 0)

§Accounts

  • signer: The Proof account owner (must be a signer)
  • proof: The Proof account to close (PDA derived from signer)
  • system_program: System program for rent recovery

§Safety Features

  • Owner-only: Only the Proof account owner can close it
  • No claims allowed: Cannot close if rewards have been claimed
  • Rent recovery: All rent is returned to the signer

§Use Cases

  • Recovering rent when no longer participating
  • Clean account management
  • Reopening with a fresh Proof account later

§Returns

  • Instruction for closing the Proof account