CreateInstance

Creates the Instance PDA that anchors the escrow. Must be called before any other operation.

PDA Seeds

instance -> ["instance", instance_seed: Pubkey]
allowed_mint -> ["allowed_mint", instance_pda: Pubkey, mint: Pubkey]
operator -> ["operator", instance_pda: Pubkey, operator: Pubkey]
event_authority -> ["event_authority"]

Accounts

AccountWritableSignerDescription
payerFee payer and rent payer
adminInitial admin of the instance
instance_seedThrowaway keypair used only for PDA derivation; its pubkey becomes the seed
instanceInstance PDA (derived from ["instance", instance_seed.pubkey])
system_programSystem Program
event_authorityEvent authority PDA
private_channel_escrow_programEscrow Program

Parameters

ParameterTypeDescription
bumpu8Bump seed for the instance PDA. Optional: the Async client auto-derives it if omitted

The IDL contains a discriminator: u8 argument (value 0) that is auto-set by the generated client and should not be passed manually.

Important Notes

  • instance_seed is a throwaway keypair, used only to derive the Instance PDA. Its pubkey becomes the seed; the keypair itself is not stored or reused.
  • Use getCreateInstanceInstructionAsync; it auto-derives bump and instance from instance_seed when they are not provided. Pass your own bump only if you already computed it via Pubkey::find_program_address(&[b"instance", instance_seed_pubkey.as_ref()], &PROGRAM_ID)
  • Emits an event via EmitEvent CPI

Is this page helpful?

목차

페이지 편집