pub struct Order {Show 33 fields
pub uid: String,
pub owner: Address,
pub creation_date: String,
pub status: OrderStatus,
pub class: Option<OrderClass>,
pub sell_token: Address,
pub buy_token: Address,
pub receiver: Option<Address>,
pub sell_amount: String,
pub buy_amount: String,
pub valid_to: u32,
pub app_data: String,
pub full_app_data: Option<String>,
pub fee_amount: String,
pub kind: OrderKind,
pub partially_fillable: bool,
pub executed_sell_amount: String,
pub executed_buy_amount: String,
pub executed_sell_amount_before_fees: String,
pub executed_fee_amount: String,
pub invalidated: bool,
pub is_liquidity_order: Option<bool>,
pub signing_scheme: SigningScheme,
pub signature: String,
pub interactions: Option<OrderInteractions>,
pub total_fee: Option<String>,
pub full_fee_amount: Option<String>,
pub available_balance: Option<String>,
pub quote_id: Option<i64>,
pub executed_fee: Option<String>,
pub ethflow_data: Option<EthflowData>,
pub onchain_order_data: Option<OnchainOrderData>,
pub onchain_user: Option<Address>,
}Expand description
A full order record returned by GET /api/v1/orders/{uid}.
Fields§
§uid: StringUnique order identifier.
owner: AddressOwner / signer address.
creation_date: StringWhen the order was submitted (ISO 8601).
status: OrderStatusCurrent lifecycle status.
class: Option<OrderClass>Market, limit, or liquidity.
sell_token: AddressToken to sell.
buy_token: AddressToken to buy.
receiver: Option<Address>Receiver address.
sell_amount: StringRequested sell amount.
buy_amount: StringMinimum buy amount.
valid_to: u32Order expiry.
app_data: StringApp-data hash (bytes32 hex).
full_app_data: Option<String>Full app-data JSON, if it was previously uploaded to the orderbook.
fee_amount: StringProtocol fee.
kind: OrderKindSell or buy.
partially_fillable: boolPartial fill flag.
executed_sell_amount: StringAmount of sell token executed so far.
executed_buy_amount: StringAmount of buy token executed so far.
executed_sell_amount_before_fees: StringSell amount executed before fees.
executed_fee_amount: StringFee amount executed so far.
invalidated: boolWhether the order has been invalidated on-chain.
is_liquidity_order: Option<bool>Whether this is a liquidity (solver-internal) order rather than an active user order.
signing_scheme: SigningSchemeSigning scheme.
signature: StringHex-encoded signature.
interactions: Option<OrderInteractions>On-chain interaction hooks attached to this order.
total_fee: Option<String>Total fee paid by the order (network + protocol fees, in sell-token atoms).
Present on enriched order responses (EnrichedOrder in the TypeScript SDK).
full_fee_amount: Option<String>Unsubsidised fee amount (what the fee would be without CoW subsidies).
available_balance: Option<String>Available sell-token balance of the order owner at the time of query.
quote_id: Option<i64>Quote ID used when placing the order (for analytics / fee attribution).
executed_fee: Option<String>Fee actually executed by the solver (separate from executed_fee_amount
for orders with both network and protocol fee components).
ethflow_data: Option<EthflowData>For EthFlow orders: metadata set by the EthFlow contract.
onchain_order_data: Option<OnchainOrderData>For on-chain placed orders: the sender address and any placement error.
onchain_user: Option<Address>For EthFlow orders: the true user address (the EthFlow contract is
the technical owner; onchain_user is the human behind it).
Implementations§
Source§impl Order
impl Order
Sourcepub fn effective_receiver(&self) -> Address
pub fn effective_receiver(&self) -> Address
Returns the effective receiver: receiver if set, otherwise owner.
When an order omits the explicit receiver the protocol routes proceeds back to the order owner.
Sourcepub fn has_interactions(&self) -> bool
pub fn has_interactions(&self) -> bool
Returns true if this order has at least one on-chain interaction hook.
Sourcepub const fn has_surplus(&self) -> bool
pub const fn has_surplus(&self) -> bool
Returns true if a surplus value is available (enriched order response).
Sourcepub const fn has_executed_fee(&self) -> bool
pub const fn has_executed_fee(&self) -> bool
Returns true if the executed fee is available (enriched order response).
Sourcepub const fn has_available_balance(&self) -> bool
pub const fn has_available_balance(&self) -> bool
Returns true if the available sell-token balance of the owner is populated.
Sourcepub const fn is_invalidated(&self) -> bool
pub const fn is_invalidated(&self) -> bool
Returns true if this order has been invalidated on-chain.
Sourcepub const fn has_full_app_data(&self) -> bool
pub const fn has_full_app_data(&self) -> bool
Returns true if the full app-data JSON is available.
Sourcepub const fn has_ethflow_data(&self) -> bool
pub const fn has_ethflow_data(&self) -> bool
Returns true if this order carries EthFlow metadata.
Sourcepub const fn has_onchain_data(&self) -> bool
pub const fn has_onchain_data(&self) -> bool
Returns true if this order carries on-chain placement metadata.
Sourcepub const fn has_onchain_user(&self) -> bool
pub const fn has_onchain_user(&self) -> bool
Returns true if the onchain_user address (real user behind an EthFlow order) is set.
Sourcepub const fn has_receiver(&self) -> bool
pub const fn has_receiver(&self) -> bool
Returns true if a custom receiver address is set.
When false, proceeds are routed to owner (see Self::effective_receiver).
Sourcepub const fn has_quote_id(&self) -> bool
pub const fn has_quote_id(&self) -> bool
Returns true if a quote ID is attached to this order.
Sourcepub const fn has_full_fee_amount(&self) -> bool
pub const fn has_full_fee_amount(&self) -> bool
Returns true if the unsubsidised fee amount is available (enriched order response).
Sourcepub const fn is_partially_fillable(&self) -> bool
pub const fn is_partially_fillable(&self) -> bool
Returns true if this order may be partially filled.
Sourcepub fn is_liquidity_order(&self) -> bool
pub fn is_liquidity_order(&self) -> bool
Returns true if this order is explicitly marked as a liquidity (solver-internal) order.
Returns false when the is_liquidity_order field is absent or false.
Sourcepub const fn is_eth_flow(&self) -> bool
pub const fn is_eth_flow(&self) -> bool
Returns true if this is an EthFlow (native sell) order.
An order is considered an EthFlow order when it carries on-chain
placement metadata (Self::onchain_order_data is Some).
use alloy_primitives::Address;
use cow_orderbook::{OnchainOrderData, Order};
// Minimal Order construction is not possible without a full JSON fixture,
// so we just assert the predicate's behaviour here.
let data = OnchainOrderData::new(Address::ZERO);
assert!(!data.has_placement_error()); // just checking it's accessibleSourcepub fn total_executed_fee(&self) -> Option<Uint<256, 4>>
pub fn total_executed_fee(&self) -> Option<Uint<256, 4>>
Compute the total executed fee for this order, if available.
Returns Some(executed_fee_amount + executed_fee) when both fields can
be parsed as U256. Returns None when either field is missing or
unparsable.
The executed fee is the sum of:
executed_fee_amount— the network (gas) fee taken from the sell tokenexecuted_fee— the additional protocol fee (present on enriched responses)
use alloy_primitives::U256;
use cow_orderbook::Order;
// Verify we can access total_executed_fee without panicking.
// Full Order construction requires a JSON fixture; just check the return type.
fn _typecheck(order: &Order) -> Option<U256> {
order.total_executed_fee()
}Sourcepub const fn transform_eth_flow(self, _chain_id: u64) -> Order
pub const fn transform_eth_flow(self, _chain_id: u64) -> Order
Normalise an EthFlow order so it looks like a regular order.
Applies the following transformations:
sell_tokenis replaced with the native-currency sentinel address forchain_id(currently always0xEeee…EeEe).owneris replaced withonchain_user(the real user behind theEthFlowcontract), if present.
This mirrors transformEthFlowOrder from the TypeScript SDK.
Non-EthFlow orders are returned unchanged.
use cow_orderbook::Order;
// Verify the method is accessible; full construction requires a JSON fixture.
fn _typecheck(order: Order) -> Order {
order.transform_eth_flow(1)
}Trait Implementations§
Source§impl<'de> Deserialize<'de> for Order
impl<'de> Deserialize<'de> for Order
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<Order, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<Order, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Source§impl Serialize for Order
impl Serialize for Order
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Auto Trait Implementations§
impl Freeze for Order
impl RefUnwindSafe for Order
impl Send for Order
impl Sync for Order
impl Unpin for Order
impl UnsafeUnpin for Order
impl UnwindSafe for Order
Blanket Implementations§
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 moreSource§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
Source§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string, but without panic on OOM.