#[non_exhaustive]pub enum PartnerFee {
Single(PartnerFeePolicy),
Multiple(Vec<PartnerFeePolicy>),
}Expand description
Typed partner-fee metadata accepted by app-data and trading helpers.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Single(PartnerFeePolicy)
Single fee policy object.
Multiple(Vec<PartnerFeePolicy>)
Ordered fee policy list.
Implementations§
Source§impl PartnerFee
impl PartnerFee
Sourcepub fn volume_bps(&self) -> Option<u16>
pub fn volume_bps(&self) -> Option<u16>
Returns the first supported volume-basis-point fee in this value, if one exists.
Sourcepub fn validate(&self) -> Result<(), AppDataError>
pub fn validate(&self) -> Result<(), AppDataError>
Validates every policy carried by this payload against the published bounds for the partner-fee schema.
§Errors
Returns AppDataError::InvalidPartnerFee on the first policy whose
basis-point values fall outside the documented [1..=9999] range, or
whose recipient address is the zero address.
Sourcepub fn to_value(&self) -> Value
pub fn to_value(&self) -> Value
Serializes this typed partner-fee payload into the app-data metadata shape.
§Panics
Panics only if the compile-time partner-fee schema types stop being serializable to JSON.
Sourcepub fn from_value(value: Value) -> Result<Self, AppDataError>
pub fn from_value(value: Value) -> Result<Self, AppDataError>
Parses partner-fee metadata from an app-data metadata value.
Accepts every in-scope shape — Volume { volumeBps, recipient },
Surplus { surplusBps, maxVolumeBps, recipient },
PriceImprovement { priceImprovementBps, maxVolumeBps, recipient },
arrays of the above — and the legacy { bps, recipient } object which
is promoted to a Volume policy for wire parity with the reviewed
services parser.
§Errors
Returns AppDataError::Serialization when the JSON value does not match any
supported partner-fee schema shape. Bounds validation is not performed
here — call PartnerFee::validate on the parsed value to enforce the
documented basis-point ranges.
Trait Implementations§
Source§impl Clone for PartnerFee
impl Clone for PartnerFee
Source§fn clone(&self) -> PartnerFee
fn clone(&self) -> PartnerFee
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for PartnerFee
impl Debug for PartnerFee
Source§impl<'de> Deserialize<'de> for PartnerFee
impl<'de> Deserialize<'de> for PartnerFee
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>,
impl Eq for PartnerFee
Source§impl From<PartnerFeePolicy> for PartnerFee
impl From<PartnerFeePolicy> for PartnerFee
Source§fn from(value: PartnerFeePolicy) -> Self
fn from(value: PartnerFeePolicy) -> Self
Source§impl From<Vec<PartnerFeePolicy>> for PartnerFee
impl From<Vec<PartnerFeePolicy>> for PartnerFee
Source§fn from(value: Vec<PartnerFeePolicy>) -> Self
fn from(value: Vec<PartnerFeePolicy>) -> Self
Source§impl PartialEq for PartnerFee
impl PartialEq for PartnerFee
Source§fn eq(&self, other: &PartnerFee) -> bool
fn eq(&self, other: &PartnerFee) -> bool
self and other values to be equal, and is used by ==.Source§impl Serialize for PartnerFee
impl Serialize for PartnerFee
impl StructuralPartialEq for PartnerFee
Auto Trait Implementations§
impl Freeze for PartnerFee
impl RefUnwindSafe for PartnerFee
impl Send for PartnerFee
impl Sync for PartnerFee
impl Unpin for PartnerFee
impl UnsafeUnpin for PartnerFee
impl UnwindSafe for PartnerFee
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,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.