pub struct FullOrder {
pub nonce: u64,
pub maker: Pubkey,
pub market: Pubkey,
pub base_mint: Pubkey,
pub quote_mint: Pubkey,
pub side: OrderSide,
pub maker_amount: u64,
pub taker_amount: u64,
pub expiration: i64,
pub signature: [u8; 64],
}Expand description
Full order structure with signature.
Layout (225 bytes):
- [0..8] nonce (8 bytes)
- [8..40] maker (32 bytes)
- [40..72] market (32 bytes)
- [72..104] base_mint (32 bytes)
- [104..136] quote_mint (32 bytes)
- [136] side (1 byte)
- [137..145] maker_amount (8 bytes)
- [145..153] taker_amount (8 bytes)
- [153..161] expiration (8 bytes)
- [161..225] signature (64 bytes)
Fields§
§nonce: u64Unique order ID and replay protection
maker: PubkeyOrder maker’s pubkey
market: PubkeyMarket pubkey
base_mint: PubkeyBase mint (token being bought/sold)
quote_mint: PubkeyQuote mint (token used for payment)
side: OrderSideOrder side (0 = Bid, 1 = Ask)
maker_amount: u64Amount maker gives
taker_amount: u64Amount maker receives
expiration: i64Expiration timestamp (0 = no expiration)
signature: [u8; 64]Ed25519 signature
Implementations§
Source§impl FullOrder
impl FullOrder
Sourcepub fn new_bid(params: BidOrderParams) -> Self
pub fn new_bid(params: BidOrderParams) -> Self
Create a new bid order (maker buys base, gives quote)
Sourcepub fn new_ask(params: AskOrderParams) -> Self
pub fn new_ask(params: AskOrderParams) -> Self
Create a new ask order (maker sells base, receives quote)
Sourcepub fn hash(&self) -> [u8; 32]
pub fn hash(&self) -> [u8; 32]
Compute the Keccak256 hash of the order (excludes signature).
Hash layout (161 bytes):
- nonce (8)
- maker (32)
- market (32)
- base_mint (32)
- quote_mint (32)
- side (1)
- maker_amount (8)
- taker_amount (8)
- expiration (8)
Sourcepub fn new_bid_signed(params: BidOrderParams, keypair: &Keypair) -> Self
pub fn new_bid_signed(params: BidOrderParams, keypair: &Keypair) -> Self
Create and sign an order in one step.
Sourcepub fn new_ask_signed(params: AskOrderParams, keypair: &Keypair) -> Self
pub fn new_ask_signed(params: AskOrderParams, keypair: &Keypair) -> Self
Create and sign an ask order in one step.
Sourcepub fn verify_signature(&self) -> SdkResult<bool>
pub fn verify_signature(&self) -> SdkResult<bool>
Verify the signature against the maker’s pubkey.
Sourcepub fn deserialize(data: &[u8]) -> SdkResult<Self>
pub fn deserialize(data: &[u8]) -> SdkResult<Self>
Deserialize from bytes.
Sourcepub fn to_compact(&self) -> CompactOrder
pub fn to_compact(&self) -> CompactOrder
Convert to compact order format.
Sourcepub fn to_submit_request(
&self,
orderbook_id: impl Into<String>,
) -> SubmitOrderRequest
pub fn to_submit_request( &self, orderbook_id: impl Into<String>, ) -> SubmitOrderRequest
Convert a signed order to an API SubmitOrderRequest.
This bridges on-chain order creation with REST API submission.
§Arguments
orderbook_id- Target orderbook (get from market API or usederive_orderbook_id())
§Panics
Panics if the order has not been signed (signature is all zeros).
§Example
let mut order = FullOrder::new_bid(params);
order.sign(&keypair);
let request = order.to_submit_request(order.derive_orderbook_id());
let response = api_client.submit_order(request).await?;Sourcepub fn derive_orderbook_id(&self) -> String
pub fn derive_orderbook_id(&self) -> String
Derive the orderbook ID for this order.
Format: {base_token[0:8]}_{quote_token[0:8]}
Sourcepub fn signature_hex(&self) -> String
pub fn signature_hex(&self) -> String
Get the signature as a hex string (128 chars).
Trait Implementations§
Auto Trait Implementations§
impl Freeze for FullOrder
impl RefUnwindSafe for FullOrder
impl Send for FullOrder
impl Sync for FullOrder
impl Unpin for FullOrder
impl UnwindSafe for FullOrder
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more