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 whosekeccak256equalsapp_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: StringIPFS CIDv1 string for the order’s app-data.
app_data_content: StringCanonical JSON string whose keccak256 equals Self::app_data_hex.
app_data_hex: String0x-prefixed 32-byte hex used as appData in the on-chain order struct.
Implementations§
Source§impl AppDataInfo
impl AppDataInfo
Sourcepub fn new(
cid: impl Into<String>,
app_data_content: impl Into<String>,
app_data_hex: impl Into<String>,
) -> Self
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 IPFSCIDv1base16 string.app_data_content— the canonical JSON string.app_data_hex— the0x-prefixed 32-bytekeccak256hex.
§Returns
A new AppDataInfo instance.
Trait Implementations§
Source§impl Clone for AppDataInfo
impl Clone for AppDataInfo
Source§fn clone(&self) -> AppDataInfo
fn clone(&self) -> AppDataInfo
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 AppDataInfo
impl Debug for AppDataInfo
Auto Trait Implementations§
impl Freeze for AppDataInfo
impl RefUnwindSafe for AppDataInfo
impl Send for AppDataInfo
impl Sync for AppDataInfo
impl Unpin for AppDataInfo
impl UnsafeUnpin for AppDataInfo
impl UnwindSafe for AppDataInfo
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> 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.