pub struct OrderIntent {
pub owner: Pubkey,
pub sell: TokenAsset,
pub buy: Asset,
pub sell_amount: u64,
pub buy_amount: u64,
pub valid_to: u32,
pub flags: Flags,
pub app_data: [u8; 32],
}Expand description
Order intent. Its canonical encoding, EncodedOrderIntent, is the exact wire format of create_order’s intent
argument and the exact bytes hashed (SHA-256) to produce the order UID used in the order PDA’s seeds.
Fields§
§owner: PubkeyAccount authorized to create and invalidate this order and whose signature authenticates it. For off-chain orders this is the Ed25519 signer; for on-chain creation it must be the transaction signer.
sell: TokenAssetWhat the order sells, and the token account the funds are pulled from.
That account implicitly encodes the spender: the settlement state PDA
must hold the SPL delegate on it for the order to be settleable, and
it must be owned by the intent owner. An intent that doesn’t satisfy
this property will be rejected.
buy: AssetWhat the order buys, and the account that receives the proceeds. That account implicitly encodes the recipient
sell_amount: u64Amount of the sell token. For Sell orders this is the exact
amount to be sold (subject to partially_fillable); for Buy
orders it is the maximum the user is willing to spend.
buy_amount: u64Amount of the buy token. For Buy orders this is the exact amount
to be received (subject to partially_fillable); for Sell
orders it is the minimum the user is willing to receive.
valid_to: u32Unix timestamp after which the order expires. The order cannot be executed after expiration.
flags: FlagsThe settings the encoding packs bit by bit into a single byte; see
Flags.
app_data: [u8; 32]Opaque 32 bytes set by the order creator. Not interpreted by the settlement program; used off-chain for metadata such as the frontend version, slippage hints, or attribution.
Implementations§
Trait Implementations§
Source§impl Clone for OrderIntent
impl Clone for OrderIntent
Source§impl Debug for OrderIntent
impl Debug for OrderIntent
impl Eq for OrderIntent
Source§impl From<&OrderIntent> for EncodedOrderIntent
impl From<&OrderIntent> for EncodedOrderIntent
Source§fn from(intent: &OrderIntent) -> Self
fn from(intent: &OrderIntent) -> Self
Lays each side out the way the wire spells it.
Source§impl PartialEq for OrderIntent
impl PartialEq for OrderIntent
impl StructuralPartialEq for OrderIntent
Source§impl TryFrom<&[u8; 213]> for OrderIntent
impl TryFrom<&[u8; 213]> for OrderIntent
Source§fn try_from(bytes: &[u8; 213]) -> Result<Self, Self::Error>
fn try_from(bytes: &[u8; 213]) -> Result<Self, Self::Error>
Decode an intent’s canonical bytes. Fails with
ProgramError::InvalidInstructionData if the flags byte sets a
reserved bit; every other byte combination decodes.