pub struct SmallOrder {Show 15 fields
pub id: Option<Uuid>,
pub kind: Option<Kind>,
pub status: Option<Status>,
pub amount: i64,
pub fiat_code: String,
pub min_amount: Option<i64>,
pub max_amount: Option<i64>,
pub fiat_amount: i64,
pub payment_method: String,
pub premium: i64,
pub buyer_trade_pubkey: Option<String>,
pub seller_trade_pubkey: Option<String>,
pub buyer_invoice: Option<String>,
pub created_at: Option<i64>,
pub expires_at: Option<i64>,
}
Expand description
We use this struct to create a new order
Fields§
§id: Option<Uuid>
§kind: Option<Kind>
§status: Option<Status>
§amount: i64
§fiat_code: String
§min_amount: Option<i64>
§max_amount: Option<i64>
§fiat_amount: i64
§payment_method: String
§buyer_trade_pubkey: Option<String>
§seller_trade_pubkey: Option<String>
§buyer_invoice: Option<String>
§created_at: Option<i64>
§expires_at: Option<i64>
Implementations§
Source§impl SmallOrder
impl SmallOrder
pub fn new( id: Option<Uuid>, kind: Option<Kind>, status: Option<Status>, amount: i64, fiat_code: String, min_amount: Option<i64>, max_amount: Option<i64>, fiat_amount: i64, payment_method: String, premium: i64, buyer_trade_pubkey: Option<String>, seller_trade_pubkey: Option<String>, buyer_invoice: Option<String>, created_at: Option<i64>, expires_at: Option<i64>, ) -> Self
Sourcepub fn from_json(json: &str) -> Result<Self, ServiceError>
pub fn from_json(json: &str) -> Result<Self, ServiceError>
New order from json string
Sourcepub fn as_json(&self) -> Result<String, ServiceError>
pub fn as_json(&self) -> Result<String, ServiceError>
Get order as json string
Sourcepub fn sats_amount(&self) -> String
pub fn sats_amount(&self) -> String
Get the amount of sats or the string “Market price”
Check if the order has a zero amount and a premium or fiat amount
Sourcepub fn check_range_order_limits(
&self,
amounts: &mut Vec<i64>,
) -> Result<(), CantDoReason>
pub fn check_range_order_limits( &self, amounts: &mut Vec<i64>, ) -> Result<(), CantDoReason>
Check if the order is a range order and if the amount is zero
Trait Implementations§
Source§impl Clone for SmallOrder
impl Clone for SmallOrder
Source§fn clone(&self) -> SmallOrder
fn clone(&self) -> SmallOrder
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for SmallOrder
impl Debug for SmallOrder
Source§impl Default for SmallOrder
impl Default for SmallOrder
Source§fn default() -> SmallOrder
fn default() -> SmallOrder
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for SmallOrder
impl<'de> Deserialize<'de> for SmallOrder
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl From<Order> for SmallOrder
impl From<Order> for SmallOrder
Source§impl From<SmallOrder> for Order
impl From<SmallOrder> for Order
Source§fn from(small_order: SmallOrder) -> Self
fn from(small_order: SmallOrder) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl Freeze for SmallOrder
impl RefUnwindSafe for SmallOrder
impl Send for SmallOrder
impl Sync for SmallOrder
impl Unpin for SmallOrder
impl UnwindSafe for SmallOrder
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
Mutably borrows from an owned value. Read more
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>
Converts
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>
Converts
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