pub struct CreateOrder {
pub program_id: Pubkey,
pub owner: Pubkey,
pub created_by: Pubkey,
pub order_pda: Pubkey,
pub intent_bytes: [u8; 213],
}Expand description
Builder for a CreateOrder instruction.
intent_bytes is the canonical byte encoding (see
EncodedOrderIntent). order_pda must be the canonical PDA returned
by crate::pda::order::find_order_pda for the same UID; the program
derives the bump itself and rejects any other address.
owner signs the instruction and must match the intent owner; this is
what authenticates the order. The intent must also be flagged
created_on_chain, the authentication scheme this instruction implements,
or the program rejects it. It may be a normal user account or a PDA,
the program does not check is_on_curve. A parent program that wants to
create orders on behalf of its own PDA can invoke_signed into the
settlement program using this instruction directly.
created_by funds the new order PDA’s rent and is recorded as the
created_by address in its body. Keeping it separate from owner lets
the rent cost be delegated to another account, which is handy when
owner is a PDA. created_by and owner may be the same account.
The order doesn’t need to be executable for it to be created. For example, the sell token account doesn’t need to belong to the user or be an SPL token account in the first place. This is checked at execution time.
An order can exist only once: if order_pda is already initialized, the
instruction reverts with AccountAlreadyInitialized. Recreating the same
order is only possible after its PDA has been closed.
Wire format: [discriminator=2, ..149 intent bytes], 150 bytes.
Required accounts:
[owner (S), created_by (W,S), order_pda (W), system_program (R)].
The system program needs to be available but doesn’t need to be at that
specific position in the instruction, unlike the others.
Fields§
§program_id: Pubkey§owner: Pubkey§created_by: Pubkey§order_pda: Pubkey§intent_bytes: [u8; 213]