Skip to main content

AppDataInfo

Struct AppDataInfo 

Source
pub struct AppDataInfo {
    pub cid: String,
    pub app_data_content: String,
    pub app_data_hex: String,
}
Expand description

Full app-data information derived from an AppDataDoc.

Bundles the three representations of an order’s app-data that are needed at different stages of the order lifecycle:

  • cid — used to store/retrieve the document on IPFS.
  • app_data_content — the canonical JSON whose keccak256 equals app_data_hex. Pin this string on IPFS so solvers can read the metadata.
  • app_data_hex — the 32-byte value placed in the on-chain order struct.

Obtain an instance via get_app_data_info or MetadataApi::get_app_data_info.

§Example

use cow_app_data::{AppDataDoc, get_app_data_info};

let doc = AppDataDoc::new("MyDApp");
let info = get_app_data_info(&doc).unwrap();
assert!(info.app_data_hex.starts_with("0x"));
assert!(info.cid.starts_with('f'));
assert!(info.app_data_content.contains("MyDApp"));

Fields§

§cid: String

IPFS CIDv1 string for the order’s app-data.

§app_data_content: String

Canonical JSON string whose keccak256 equals Self::app_data_hex.

§app_data_hex: String

0x-prefixed 32-byte hex used as appData in the on-chain order struct.

Implementations§

Source§

impl AppDataInfo

Source

pub fn new( cid: impl Into<String>, app_data_content: impl Into<String>, app_data_hex: impl Into<String>, ) -> Self

Construct an AppDataInfo from its three constituent fields.

Prefer get_app_data_info to derive all three values from an AppDataDoc automatically. Use this constructor only when you already have the CID, JSON content, and hex hash from an external source.

§Parameters
  • cid — the IPFS CIDv1 base16 string.
  • app_data_content — the canonical JSON string.
  • app_data_hex — the 0x-prefixed 32-byte keccak256 hex.
§Returns

A new AppDataInfo instance.

Trait Implementations§

Source§

impl Clone for AppDataInfo

Source§

fn clone(&self) -> AppDataInfo

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 AppDataInfo

Source§

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

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

impl Display for AppDataInfo

Source§

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

Formats the value using the given formatter. 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> 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<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