pub struct Transaction {Show 17 fields
pub nonce: u64,
pub value: Bytes,
pub rcv_addr: Bytes,
pub rcv_user_name: Bytes,
pub snd_addr: Bytes,
pub snd_user_name: Bytes,
pub gas_price: u64,
pub gas_limit: u64,
pub data: Bytes,
pub chain_id: Bytes,
pub version: u32,
pub signature: Bytes,
pub options: u32,
pub guardian_addr: Bytes,
pub guardian_signature: Bytes,
pub relayer_addr: Bytes,
pub relayer_signature: Bytes,
}Expand description
Transaction holds all the data needed for a value transfer or SC call
Fields§
§nonce: u64§value: Bytes§rcv_addr: Bytes§rcv_user_name: Bytes§snd_addr: Bytes§snd_user_name: Bytes§gas_price: u64§gas_limit: u64§data: Bytes§chain_id: Bytes§version: u32§signature: Bytes§options: u32§guardian_addr: Bytes§guardian_signature: Bytes§relayer_addr: Bytes§relayer_signature: BytesImplementations§
Source§impl Transaction
impl Transaction
Sourcepub fn signing_bytes(&self) -> Result<Vec<u8>, ConversionError>
pub fn signing_bytes(&self) -> Result<Vec<u8>, ConversionError>
Serializes a protobuf transaction into the canonical JSON payload used for signing.
Source§impl Transaction
impl Transaction
Sourcepub const HASH_SIZE: usize = 32
pub const HASH_SIZE: usize = 32
Length in bytes of the transaction hash computed by the network (BLAKE2b-256).
Sourcepub fn compute_hash(&self) -> [u8; 32]
pub fn compute_hash(&self) -> [u8; 32]
Computes the canonical transaction hash by re-encoding the message and hashing it with BLAKE2b-256, mirroring the logic from the Go implementation.
Sourcepub fn get_tx_hash(&self) -> [u8; 32]
pub fn get_tx_hash(&self) -> [u8; 32]
Computes the canonical transaction hash by re-encoding the message and hashing it with BLAKE2b-256.
Sourcepub fn hash_bytes(bytes: &[u8]) -> [u8; 32]
pub fn hash_bytes(bytes: &[u8]) -> [u8; 32]
Hashes an already serialized transaction buffer with BLAKE2b-256.
Sourcepub fn sender_address_bech32(&self) -> Result<Option<String>, EncodeError>
pub fn sender_address_bech32(&self) -> Result<Option<String>, EncodeError>
Returns the sender address encoded as an erd Bech32 string if present.
Sourcepub fn sender_bech32(&self) -> Result<Option<String>, EncodeError>
pub fn sender_bech32(&self) -> Result<Option<String>, EncodeError>
Returns the sender address encoded as an erd Bech32 string if present.
Sourcepub fn receiver_address_bech32(&self) -> Result<Option<String>, EncodeError>
pub fn receiver_address_bech32(&self) -> Result<Option<String>, EncodeError>
Returns the receiver address encoded as an erd Bech32 string if present.
Sourcepub fn receiver_bech32(&self) -> Result<Option<String>, EncodeError>
pub fn receiver_bech32(&self) -> Result<Option<String>, EncodeError>
Returns the receiver address encoded as an erd Bech32 string if present.
Sourcepub fn guardian_address_bech32(&self) -> Result<Option<String>, EncodeError>
pub fn guardian_address_bech32(&self) -> Result<Option<String>, EncodeError>
Returns the guardian address encoded as an erd Bech32 string if present.
Sourcepub fn guardian_bech32(&self) -> Result<Option<String>, EncodeError>
pub fn guardian_bech32(&self) -> Result<Option<String>, EncodeError>
Returns the guardian address encoded as an erd Bech32 string if present.
Sourcepub fn relayer_address_bech32(&self) -> Result<Option<String>, EncodeError>
pub fn relayer_address_bech32(&self) -> Result<Option<String>, EncodeError>
Returns the relayer address encoded as an erd Bech32 string if present.
Sourcepub fn relayer_bech32(&self) -> Result<Option<String>, EncodeError>
pub fn relayer_bech32(&self) -> Result<Option<String>, EncodeError>
Returns the relayer address encoded as an erd Bech32 string if present.
Trait Implementations§
Source§impl Clone for Transaction
impl Clone for Transaction
Source§fn clone(&self) -> Transaction
fn clone(&self) -> Transaction
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for Transaction
impl Debug for Transaction
Source§impl Default for Transaction
impl Default for Transaction
Source§impl Hash for Transaction
impl Hash for Transaction
Source§impl Message for Transaction
impl Message for Transaction
Source§fn encoded_len(&self) -> usize
fn encoded_len(&self) -> usize
Source§fn encode(&self, buf: &mut impl BufMut) -> Result<(), EncodeError>where
Self: Sized,
fn encode(&self, buf: &mut impl BufMut) -> Result<(), EncodeError>where
Self: Sized,
Source§fn encode_to_vec(&self) -> Vec<u8> ⓘwhere
Self: Sized,
fn encode_to_vec(&self) -> Vec<u8> ⓘwhere
Self: Sized,
Source§fn encode_length_delimited(
&self,
buf: &mut impl BufMut,
) -> Result<(), EncodeError>where
Self: Sized,
fn encode_length_delimited(
&self,
buf: &mut impl BufMut,
) -> Result<(), EncodeError>where
Self: Sized,
Source§fn encode_length_delimited_to_vec(&self) -> Vec<u8> ⓘwhere
Self: Sized,
fn encode_length_delimited_to_vec(&self) -> Vec<u8> ⓘwhere
Self: Sized,
Source§fn decode(buf: impl Buf) -> Result<Self, DecodeError>where
Self: Default,
fn decode(buf: impl Buf) -> Result<Self, DecodeError>where
Self: Default,
Source§fn decode_length_delimited(buf: impl Buf) -> Result<Self, DecodeError>where
Self: Default,
fn decode_length_delimited(buf: impl Buf) -> Result<Self, DecodeError>where
Self: Default,
Source§fn merge(&mut self, buf: impl Buf) -> Result<(), DecodeError>where
Self: Sized,
fn merge(&mut self, buf: impl Buf) -> Result<(), DecodeError>where
Self: Sized,
self. Read moreSource§fn merge_length_delimited(&mut self, buf: impl Buf) -> Result<(), DecodeError>where
Self: Sized,
fn merge_length_delimited(&mut self, buf: impl Buf) -> Result<(), DecodeError>where
Self: Sized,
self.Source§impl PartialEq for Transaction
impl PartialEq for Transaction
Source§impl TryFrom<&Transaction> for Transaction
impl TryFrom<&Transaction> for Transaction
Source§type Error = ConversionError
type Error = ConversionError
Source§impl TryFrom<&Transaction> for Transaction
impl TryFrom<&Transaction> for Transaction
Source§type Error = ConversionError
type Error = ConversionError
Source§impl TryFrom<Transaction> for Transaction
impl TryFrom<Transaction> for Transaction
Source§type Error = ConversionError
type Error = ConversionError
Source§impl TryFrom<Transaction> for Transaction
impl TryFrom<Transaction> for Transaction
Source§type Error = ConversionError
type Error = ConversionError
impl Eq for Transaction
impl StructuralPartialEq for Transaction
Auto Trait Implementations§
impl !Freeze for Transaction
impl RefUnwindSafe for Transaction
impl Send for Transaction
impl Sync for Transaction
impl Unpin for Transaction
impl UnsafeUnpin for Transaction
impl UnwindSafe for Transaction
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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.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> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request