initializing an escrow. Just wondering if just sending an NFT can initialize an escrow or if we need both users interacting with escrow program to init. I want to be able to have an escrow initialize with just an NFT being sent so that users can see what tickets are open to rent
1 Answer
You you transfer the NFT to a token account owned by a PDA.
#[account(
seeds = [
AUTHORITY_PREFIX.as_bytes(),
],
bump
)]
pub authority: AccountInfo<'info>,
pub mint: Box<Account<'info, Mint>>,
#[account(
init_if_needed,
payer = payer,
associated_token::mint = mint,
associated_token::authority = authority,
)]
pub mint_account: Box<Account<'info, TokenAccount>>,
Now, you can use the authority
account from within the program to transfer to token back to someone else.