pub struct ContractMessageTranscoder { /* private fields */ }
Expand description
Encode strings to SCALE encoded smart contract calls.
Decode SCALE encoded smart contract events and return values into Value
objects.
Implementations§
Source§impl ContractMessageTranscoder
impl ContractMessageTranscoder
pub fn new(metadata: InkProject) -> Self
Sourcepub fn load<P>(metadata_path: P) -> Result<Self>
pub fn load<P>(metadata_path: P) -> Result<Self>
Attempt to create a ContractMessageTranscoder
from the metadata file at the
given path.
pub fn encode<I, S>(&self, name: &str, args: I) -> Result<Vec<u8>>
pub fn decode(&self, type_id: u32, input: &mut &[u8]) -> Result<Value>
pub fn metadata(&self) -> &InkProject
pub fn decode_contract_event<Hash>( &self, event_sig_topic: &Hash, data: &mut &[u8], ) -> Result<Value>
pub fn decode_contract_message(&self, data: &mut &[u8]) -> Result<Value>
pub fn decode_contract_constructor(&self, data: &mut &[u8]) -> Result<Value>
pub fn decode_constructor_return( &self, name: &str, data: &mut &[u8], ) -> Result<Value>
pub fn decode_message_return( &self, name: &str, data: &mut &[u8], ) -> Result<Value>
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ContractMessageTranscoder
impl !RefUnwindSafe for ContractMessageTranscoder
impl Send for ContractMessageTranscoder
impl Sync for ContractMessageTranscoder
impl Unpin for ContractMessageTranscoder
impl !UnwindSafe for ContractMessageTranscoder
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<I, T> ExtractContext<I, ()> for T
impl<I, T> ExtractContext<I, ()> for T
Source§fn extract_context(self, _original_input: I)
fn extract_context(self, _original_input: I)
Given the context attached to a nom error, and given the original
input to the nom parser, extract more the useful context information. Read more
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> 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>
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 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>
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 moreSource§impl<I> RecreateContext<I> for I
impl<I> RecreateContext<I> for I
Source§fn recreate_context(_original_input: I, tail: I) -> I
fn recreate_context(_original_input: I, tail: I) -> I
Given the original input, as well as the context reported by nom,
recreate a context in the original string where the error occurred. Read more
Source§impl<T> SaturatedConversion for T
impl<T> SaturatedConversion for T
Source§fn saturated_from<T>(t: T) -> Selfwhere
Self: UniqueSaturatedFrom<T>,
fn saturated_from<T>(t: T) -> Selfwhere
Self: UniqueSaturatedFrom<T>,
Source§fn saturated_into<T>(self) -> Twhere
Self: UniqueSaturatedInto<T>,
fn saturated_into<T>(self) -> Twhere
Self: UniqueSaturatedInto<T>,
Consume self to return an equivalent value of
T
. Read moreSource§impl<T, S> UniqueSaturatedInto<T> for S
impl<T, S> UniqueSaturatedInto<T> for S
Source§fn unique_saturated_into(self) -> T
fn unique_saturated_into(self) -> T
Consume self to return an equivalent value of
T
.