Struct avalanche_types::txs::Tx
source · [−]pub struct Tx {
pub metadata: Option<Metadata>,
pub network_id: u32,
pub blockchain_id: Id,
pub transferable_outputs: Option<Vec<Output>>,
pub transferable_inputs: Option<Vec<Input>>,
pub memo: Option<Vec<u8>>,
}
Expand description
ref. https://pkg.go.dev/github.com/ava-labs/avalanchego/vms/components/avax#BaseTx
Fields
metadata: Option<Metadata>
network_id: u32
blockchain_id: Id
transferable_outputs: Option<Vec<Output>>
transferable_inputs: Option<Vec<Input>>
memo: Option<Vec<u8>>
Implementations
sourceimpl Tx
impl Tx
pub fn default() -> Self
pub fn type_name() -> String
pub fn type_id() -> u32
sourcepub fn pack(&self, codec_version: u16, type_id: u32) -> Result<Packer>
pub fn pack(&self, codec_version: u16, type_id: u32) -> Result<Packer>
“Tx.Unsigned” is implemented by “avax.BaseTx” but for marshal, it’s passed as an interface. Then marshaled via “avalanchego/codec/linearcodec.linearCodec” which then calls “genericCodec.marshal”. ref. “avalanchego/vms/avm.Tx.SignSECP256K1Fx” ref. “avalanchego/codec.manager.Marshal” ref. “avalanchego/codec.manager.Marshal(codecVersion, &t.UnsignedTx)” ref. “avalanchego/codec/linearcodec.linearCodec.MarshalInto” ref. “avalanchego/codec/reflectcodec.genericCodec.MarshalInto” ref. “avalanchego/codec/reflectcodec.genericCodec.marshal”
Returns the packer itself so that the following marshals can reuse.
“BaseTx” is an interface in Go (reflect.Interface) thus the underlying type must be specified by the caller TODO: can we do better in Rust? Go does so with reflect… e.g., pack prefix with the type ID for “avm.BaseTx” (linearCodec.PackPrefix) ref. “avalanchego/codec/linearcodec.linearCodec.MarshalInto” ref. “avalanchego/codec/reflectcodec.genericCodec.MarshalInto”
Trait Implementations
sourceimpl<'de> Deserialize<'de> for Tx
impl<'de> Deserialize<'de> for Tx
sourcefn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl Eq for Tx
impl StructuralEq for Tx
impl StructuralPartialEq for Tx
Auto Trait Implementations
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
sourceimpl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
sourcefn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
sourcefn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T
in a tonic::Request