Skip to main content

Metadata

Struct Metadata 

Source
pub struct Metadata {
Show 13 fields pub referrer: Option<Referrer>, pub utm: Option<Utm>, pub quote: Option<Quote>, pub order_class: Option<OrderClass>, pub hooks: Option<OrderInteractionHooks>, pub widget: Option<Widget>, pub partner_fee: Option<PartnerFee>, pub replaced_order: Option<ReplacedOrder>, pub signer: Option<String>, pub bridging: Option<Bridging>, pub flashloan: Option<Flashloan>, pub wrappers: Option<Vec<WrapperEntry>>, pub user_consents: Option<Vec<UserConsent>>,
}
Expand description

Metadata container — all fields are optional.

Each field corresponds to a section of the CoW Protocol app-data schema. Fields are serialised only when Some (via #[serde(skip_serializing_if = "Option::is_none")]), keeping the JSON compact.

Use the builder methods (with_*) to populate fields, or the has_* predicates to check which fields are set.

§Example

use cow_rs::app_data::{Metadata, Quote, Referrer};

let meta = Metadata::default()
    .with_referrer(Referrer::code("COWRS-PARTNER"))
    .with_quote(Quote::new(50));

assert!(meta.has_referrer());
assert!(meta.has_quote());
assert!(!meta.has_hooks());

Fields§

§referrer: Option<Referrer>

Referrer address for partner attribution.

§utm: Option<Utm>

UTM tracking parameters.

§quote: Option<Quote>

Quote-level slippage settings.

§order_class: Option<OrderClass>

Classification of the order intent.

§hooks: Option<OrderInteractionHooks>

Pre- and post-interaction hooks.

§widget: Option<Widget>

Widget metadata when the order originates from a widget integration.

§partner_fee: Option<PartnerFee>

Protocol fee charged by an integration partner.

§replaced_order: Option<ReplacedOrder>

UID of a previous order that this order replaces.

§signer: Option<String>

Signer wallet address (for EIP-1271 or other non-EOA signers).

§bridging: Option<Bridging>

Cross-chain bridging metadata (if the order used a bridge).

§flashloan: Option<Flashloan>

Flash loan metadata (if the order used a flash loan).

§wrappers: Option<Vec<WrapperEntry>>

Token wrapper entries applied during execution.

§user_consents: Option<Vec<UserConsent>>

User consent records attached to this order.

Implementations§

Source§

impl Metadata

Source

pub fn with_referrer(self, referrer: Referrer) -> Self

Set the Referrer address for partner attribution.

§Parameters
  • referrer — the Referrer containing the partner address.
§Returns

self with referrer set.

Source

pub fn with_utm(self, utm: Utm) -> Self

Set the Utm campaign tracking parameters.

§Parameters
  • utm — the Utm parameters (source, medium, campaign, …).
§Returns

self with utm set.

Source

pub const fn with_quote(self, quote: Quote) -> Self

Set the quote-level slippage settings.

§Parameters
  • quote — the Quote containing the slippage tolerance in basis points and optional smart-slippage flag.
§Returns

self with quote set.

Source

pub const fn with_order_class(self, order_class: OrderClass) -> Self

Set the order class classification.

§Parameters
§Returns

self with order_class set.

Source

pub fn with_hooks(self, hooks: OrderInteractionHooks) -> Self

Set the pre- and post-settlement interaction hooks.

§Parameters
§Returns

self with hooks set.

Source

pub fn with_widget(self, widget: Widget) -> Self

Set the widget integration metadata.

§Parameters
  • widget — the Widget identifying the widget host.
§Returns

self with widget set.

Source

pub fn with_partner_fee(self, fee: PartnerFee) -> Self

Set the partner fee policy.

§Parameters
§Returns

self with partner_fee set.

Source

pub fn with_replaced_order(self, order: ReplacedOrder) -> Self

Set the replaced-order reference.

§Parameters
  • order — the ReplacedOrder containing the UID of the order being superseded.
§Returns

self with replaced_order set.

Source

pub fn with_signer(self, signer: impl Into<String>) -> Self

Set the signer address override for smart-contract wallets.

§Parameters
  • signer0x-prefixed Ethereum address of the signing contract.
§Returns

self with signer set.

Source

pub fn with_bridging(self, bridging: Bridging) -> Self

Set the cross-chain Bridging metadata.

§Parameters
§Returns

self with bridging set.

Source

pub fn with_flashloan(self, flashloan: Flashloan) -> Self

Set the Flashloan execution metadata.

§Parameters
§Returns

self with flashloan set.

Source

pub fn with_wrappers(self, wrappers: Vec<WrapperEntry>) -> Self

Set the token WrapperEntry records.

§Parameters
  • wrappers — list of wrapper entries applied during execution.
§Returns

self with wrappers set.

Source

pub fn with_user_consents(self, consents: Vec<UserConsent>) -> Self

Set the UserConsent records for terms of service acceptance.

§Parameters
  • consents — list of consent records.
§Returns

self with user_consents set.

Source

pub const fn has_referrer(&self) -> bool

Returns true if a referrer tracking code is set.

Source

pub const fn has_utm(&self) -> bool

Returns true if UTM campaign parameters are set.

Source

pub const fn has_quote(&self) -> bool

Returns true if quote-level slippage settings are set.

Source

pub const fn has_order_class(&self) -> bool

Returns true if an order class classification is set.

Source

pub const fn has_hooks(&self) -> bool

Returns true if pre/post interaction hooks are set.

Source

pub const fn has_widget(&self) -> bool

Returns true if widget integration metadata is set.

Source

pub const fn has_partner_fee(&self) -> bool

Returns true if a partner fee is set.

Source

pub const fn has_replaced_order(&self) -> bool

Returns true if a replaced-order reference is set.

Source

pub const fn has_signer(&self) -> bool

Returns true if a signer address override is set.

Source

pub const fn has_bridging(&self) -> bool

Returns true if cross-chain bridging metadata is set.

Source

pub const fn has_flashloan(&self) -> bool

Returns true if flash loan metadata is set.

Source

pub fn has_wrappers(&self) -> bool

Returns true if at least one token wrapper entry is set.

Source

pub fn has_user_consents(&self) -> bool

Returns true if at least one user consent record is set.

Trait Implementations§

Source§

impl Clone for Metadata

Source§

fn clone(&self) -> Metadata

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Metadata

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Metadata

Source§

fn default() -> Metadata

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for Metadata

Source§

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 Display for Metadata

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Serialize for Metadata

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T> ToStringFallible for T
where T: Display,

Source§

fn try_to_string(&self) -> Result<String, TryReserveError>

ToString::to_string, but without panic on OOM.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<S, T> Upcast<T> for S
where T: UpcastFrom<S> + ?Sized, S: ?Sized,

Source§

fn upcast(&self) -> &T
where Self: ErasableGeneric, T: ErasableGeneric<Repr = Self::Repr>,

Perform a zero-cost type-safe upcast to a wider ref type within the Wasm bindgen generics type system. Read more
Source§

fn upcast_into(self) -> T
where Self: Sized + ErasableGeneric, T: ErasableGeneric<Repr = Self::Repr>,

Perform a zero-cost type-safe upcast to a wider type within the Wasm bindgen generics type system. Read more
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<'de, T> BorrowedRpcObject<'de> for T
where T: RpcBorrow<'de> + RpcSend,

Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<'de, T> RpcBorrow<'de> for T
where T: Deserialize<'de> + Debug + Send + Sync + Unpin,

Source§

impl<T> RpcObject for T
where T: RpcSend + RpcRecv,

Source§

impl<T> RpcRecv for T
where T: DeserializeOwned + Debug + Send + Sync + Unpin + 'static,

Source§

impl<T> RpcSend for T
where T: Serialize + Clone + Debug + Send + Sync + Unpin,