pub struct ConditionalOrderFactory;Expand description
Instantiates conditional orders from ConditionalOrderParams.
Mirrors ConditionalOrderFactory from the TypeScript SDK.
Extend by matching additional handler addresses in from_params.
Implementations§
Source§impl ConditionalOrderFactory
impl ConditionalOrderFactory
Sourcepub const fn new() -> Self
pub const fn new() -> Self
Create a new factory.
§Returns
A zero-sized ConditionalOrderFactory instance that can decode
ConditionalOrderParams via from_params.
Sourcepub fn from_params(
&self,
params: ConditionalOrderParams,
) -> Result<ConditionalOrderKind, CowError>
pub fn from_params( &self, params: ConditionalOrderParams, ) -> Result<ConditionalOrderKind, CowError>
Decode ConditionalOrderParams into a typed ConditionalOrderKind.
Handler addresses are matched exactly. Unknown handlers return
ConditionalOrderKind::Unknown rather than an error.
Recognised handlers:
TWAP_HANDLER_ADDRESS→ConditionalOrderKind::TwapSTOP_LOSS_HANDLER_ADDRESS→ConditionalOrderKind::StopLoss
Note: the GoodAfterTime handler (GAT_HANDLER_ADDRESS) shares the
same on-chain address as the TWAP handler, so TWAP decoding takes
priority for that address.
§Errors
Returns CowError::AppData only if a known handler’s static input
fails ABI decoding.
Trait Implementations§
Source§impl Clone for ConditionalOrderFactory
impl Clone for ConditionalOrderFactory
Source§fn clone(&self) -> ConditionalOrderFactory
fn clone(&self) -> ConditionalOrderFactory
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ConditionalOrderFactory
impl Debug for ConditionalOrderFactory
Source§impl Default for ConditionalOrderFactory
impl Default for ConditionalOrderFactory
Source§fn default() -> ConditionalOrderFactory
fn default() -> ConditionalOrderFactory
Auto Trait Implementations§
impl Freeze for ConditionalOrderFactory
impl RefUnwindSafe for ConditionalOrderFactory
impl Send for ConditionalOrderFactory
impl Sync for ConditionalOrderFactory
impl Unpin for ConditionalOrderFactory
impl UnsafeUnpin for ConditionalOrderFactory
impl UnwindSafe for ConditionalOrderFactory
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.