CreateInstance

Tạo PDA Instance neo giữ escrow. Phải được gọi trước bất kỳ thao tác nào khác.

Seeds của PDA

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"]

Tài khoản

Tài khoảnCó thể ghiNgười kýMô tả
payer✓✓Người trả phí giao dịch và rent
admin✓Admin ban đầu của instance
instance_seed✓keypair dùng một lần chỉ để dẫn xuất PDA; pubkey của nó trở thành seed
instance✓PDA Instance (dẫn xuất từ ["instance", instance_seed.pubkey])
system_programSystem Program
event_authorityPDA quyền hạn sự kiện
private_channel_escrow_programChương trình Escrow

Tham số

Tham sốKiểuMô tả
bumpu8bump seed cho PDA instance. Tùy chọn: client Async tự dẫn xuất nếu bỏ qua

IDL chứa một đối số discriminator: u8 (giá trị 0) được tự động thiết lập bởi client được tạo ra và không nên truyền thủ công.

Lưu ý quan trọng

  • instance_seed là một keypair dùng một lần, chỉ dùng để dẫn xuất PDA Instance. pubkey của nó trở thành seed; bản thân keypair không được lưu trữ hay tái sử dụng.
  • Hãy dùng getCreateInstanceInstructionAsync; nó tự dẫn xuất bump và instance từ instance_seed khi chúng không được cung cấp. Chỉ truyền bump của bạn nếu bạn đã tính toán nó qua Pubkey::find_program_address(&[b"instance", instance_seed_pubkey.as_ref()], &PROGRAM_ID)
  • Phát ra một sự kiện thông qua CPI EmitEvent

Is this page helpful?

Mục lục

Chỉnh sửa trang