pub struct CIP25Metadata(/* private fields */);
Expand description
This is the entire metadata schema for CIP-25 It can be parsed by passing in the CBOR bytes of the entire transaction metadata or by passing in an existing Metadata struct. Parsing from CBOR bytes should be marginally faster.
Implementations§
Source§impl CIP25Metadata
impl CIP25Metadata
Sourcepub fn to_metadata(&self) -> Result<Metadata, JsError>
pub fn to_metadata(&self) -> Result<Metadata, JsError>
Create a Metadata containing only the CIP25 schema
Sourcepub fn from_metadata(metadata: &Metadata) -> Result<CIP25Metadata, JsError>
pub fn from_metadata(metadata: &Metadata) -> Result<CIP25Metadata, JsError>
Read the CIP25 schema from a Metadata. Ignores all other data besides CIP25 Can fail if the Metadata does not conform to CIP25
Source§impl CIP25Metadata
impl CIP25Metadata
Source§impl CIP25Metadata
impl CIP25Metadata
Sourcepub fn to_cbor_bytes(&self) -> Vec<u8> ⓘ
pub fn to_cbor_bytes(&self) -> Vec<u8> ⓘ
Serialize to CBOR bytes compatible with tx metadata Does not guarantee any specific type of CBOR format and should NOT be used with round-tripping. It will ignore all non-CIP25 keys. Use cml_cip25::metadate crate for round-tripping metadata.
Sourcepub fn from_cbor_bytes(data: Vec<u8>) -> Result<CIP25Metadata, JsValue>
pub fn from_cbor_bytes(data: Vec<u8>) -> Result<CIP25Metadata, JsValue>
Deserialize from CBOR bytes compatible with tx metadata Does not guarantee any specific type of CBOR format and should NOT be used with round-tripping. It will ignore all non-CIP25 keys. Use cml_cip25::metadate crate for round-tripping metadata.
Sourcepub fn key_721(&self) -> CIP25LabelMetadata
pub fn key_721(&self) -> CIP25LabelMetadata
The core details of the CIP25 spec
pub fn new(key_721: &CIP25LabelMetadata) -> CIP25Metadata
Trait Implementations§
Source§impl AsRef<CIP25Metadata> for CIP25Metadata
impl AsRef<CIP25Metadata> for CIP25Metadata
Source§fn as_ref(&self) -> &CIP25Metadata
fn as_ref(&self) -> &CIP25Metadata
Source§impl Clone for CIP25Metadata
impl Clone for CIP25Metadata
Source§fn clone(&self) -> CIP25Metadata
fn clone(&self) -> CIP25Metadata
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for CIP25Metadata
impl Debug for CIP25Metadata
Source§impl From<CIP25Metadata> for CIP25Metadata
impl From<CIP25Metadata> for CIP25Metadata
Source§fn from(native: CIP25Metadata) -> CIP25Metadata
fn from(native: CIP25Metadata) -> CIP25Metadata
Source§impl From<CIP25Metadata> for JsValue
impl From<CIP25Metadata> for JsValue
Source§fn from(value: CIP25Metadata) -> JsValue
fn from(value: CIP25Metadata) -> JsValue
Source§impl FromWasmAbi for CIP25Metadata
impl FromWasmAbi for CIP25Metadata
Source§impl Into<CIP25Metadata> for CIP25Metadata
impl Into<CIP25Metadata> for CIP25Metadata
Source§fn into(self) -> CIP25Metadata
fn into(self) -> CIP25Metadata
Source§impl IntoWasmAbi for CIP25Metadata
impl IntoWasmAbi for CIP25Metadata
Source§impl LongRefFromWasmAbi for CIP25Metadata
impl LongRefFromWasmAbi for CIP25Metadata
Source§type Anchor = RcRef<CIP25Metadata>
type Anchor = RcRef<CIP25Metadata>
RefFromWasmAbi::Anchor
Source§unsafe fn long_ref_from_abi(
js: <CIP25Metadata as LongRefFromWasmAbi>::Abi,
) -> <CIP25Metadata as LongRefFromWasmAbi>::Anchor
unsafe fn long_ref_from_abi( js: <CIP25Metadata as LongRefFromWasmAbi>::Abi, ) -> <CIP25Metadata as LongRefFromWasmAbi>::Anchor
RefFromWasmAbi::ref_from_abi
Source§impl OptionFromWasmAbi for CIP25Metadata
impl OptionFromWasmAbi for CIP25Metadata
Source§fn is_none(abi: &<CIP25Metadata as FromWasmAbi>::Abi) -> bool
fn is_none(abi: &<CIP25Metadata as FromWasmAbi>::Abi) -> bool
None
, and otherwise it will be passed to
FromWasmAbi
.Source§impl OptionIntoWasmAbi for CIP25Metadata
impl OptionIntoWasmAbi for CIP25Metadata
Source§fn none() -> <CIP25Metadata as IntoWasmAbi>::Abi
fn none() -> <CIP25Metadata as IntoWasmAbi>::Abi
None
branch of this option. Read moreSource§impl RefFromWasmAbi for CIP25Metadata
impl RefFromWasmAbi for CIP25Metadata
Source§type Anchor = RcRef<CIP25Metadata>
type Anchor = RcRef<CIP25Metadata>
Self
for the duration of the
invocation of the function that has an &Self
parameter. This is
required to ensure that the lifetimes don’t persist beyond one function
call, and so that they remain anonymous.Source§unsafe fn ref_from_abi(
js: <CIP25Metadata as RefFromWasmAbi>::Abi,
) -> <CIP25Metadata as RefFromWasmAbi>::Anchor
unsafe fn ref_from_abi( js: <CIP25Metadata as RefFromWasmAbi>::Abi, ) -> <CIP25Metadata as RefFromWasmAbi>::Anchor
Source§impl RefMutFromWasmAbi for CIP25Metadata
impl RefMutFromWasmAbi for CIP25Metadata
Source§type Anchor = RcRefMut<CIP25Metadata>
type Anchor = RcRefMut<CIP25Metadata>
RefFromWasmAbi::Anchor
Source§unsafe fn ref_mut_from_abi(
js: <CIP25Metadata as RefMutFromWasmAbi>::Abi,
) -> <CIP25Metadata as RefMutFromWasmAbi>::Anchor
unsafe fn ref_mut_from_abi( js: <CIP25Metadata as RefMutFromWasmAbi>::Abi, ) -> <CIP25Metadata as RefMutFromWasmAbi>::Anchor
RefFromWasmAbi::ref_from_abi
Source§impl TryFromJsValue for CIP25Metadata
impl TryFromJsValue for CIP25Metadata
Source§fn try_from_js_value(
value: JsValue,
) -> Result<CIP25Metadata, <CIP25Metadata as TryFromJsValue>::Error>
fn try_from_js_value( value: JsValue, ) -> Result<CIP25Metadata, <CIP25Metadata as TryFromJsValue>::Error>
Source§impl VectorFromWasmAbi for CIP25Metadata
impl VectorFromWasmAbi for CIP25Metadata
type Abi = <Box<[JsValue]> as FromWasmAbi>::Abi
unsafe fn vector_from_abi( js: <CIP25Metadata as VectorFromWasmAbi>::Abi, ) -> Box<[CIP25Metadata]>
Source§impl VectorIntoWasmAbi for CIP25Metadata
impl VectorIntoWasmAbi for CIP25Metadata
type Abi = <Box<[JsValue]> as IntoWasmAbi>::Abi
fn vector_into_abi( vector: Box<[CIP25Metadata]>, ) -> <CIP25Metadata as VectorIntoWasmAbi>::Abi
Auto Trait Implementations§
impl Freeze for CIP25Metadata
impl RefUnwindSafe for CIP25Metadata
impl Send for CIP25Metadata
impl Sync for CIP25Metadata
impl Unpin for CIP25Metadata
impl UnwindSafe for CIP25Metadata
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> 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> ReturnWasmAbi for Twhere
T: IntoWasmAbi,
impl<T> ReturnWasmAbi for Twhere
T: IntoWasmAbi,
Source§type Abi = <T as IntoWasmAbi>::Abi
type Abi = <T as IntoWasmAbi>::Abi
IntoWasmAbi::Abi
Source§fn return_abi(self) -> <T as ReturnWasmAbi>::Abi
fn return_abi(self) -> <T as ReturnWasmAbi>::Abi
IntoWasmAbi::into_abi
, except that it may throw and never
return in the case of Err
.