Enum fuel_vm::prelude::Transaction
source · [−]pub enum Transaction {
Script {
gas_price: u64,
gas_limit: u64,
byte_price: u64,
maturity: u64,
receipts_root: Bytes32,
script: Vec<u8, Global>,
script_data: Vec<u8, Global>,
inputs: Vec<Input, Global>,
outputs: Vec<Output, Global>,
witnesses: Vec<Witness, Global>,
metadata: Option<Metadata>,
},
Create {
gas_price: u64,
gas_limit: u64,
byte_price: u64,
maturity: u64,
bytecode_witness_index: u8,
salt: Salt,
static_contracts: Vec<ContractId, Global>,
storage_slots: Vec<StorageSlot, Global>,
inputs: Vec<Input, Global>,
outputs: Vec<Output, Global>,
witnesses: Vec<Witness, Global>,
metadata: Option<Metadata>,
},
}
Variants
Script
Create
Fields
gas_price: u64
gas_limit: u64
byte_price: u64
maturity: u64
bytecode_witness_index: u8
salt: Salt
static_contracts: Vec<ContractId, Global>
storage_slots: Vec<StorageSlot, Global>
Implementations
sourceimpl Transaction
impl Transaction
sourceimpl Transaction
impl Transaction
pub fn precompute_metadata(&mut self)
sourceimpl Transaction
impl Transaction
sourcepub const fn script_offset() -> usize
pub const fn script_offset() -> usize
For a serialized transaction of type Script
, return the bytes offset
of the script
sourcepub fn script_data_offset(&self) -> Option<usize>
pub fn script_data_offset(&self) -> Option<usize>
For a serialized transaction of type Script
, return the bytes offset
of the script data
sourcepub fn input_coin_predicate_offset(&self, index: usize) -> Option<usize>
pub fn input_coin_predicate_offset(&self, index: usize) -> Option<usize>
For a transaction of type Create
, return the offset of the data
relative to the serialized transaction for a given index of inputs,
if this input is of type Coin
.
sourcepub fn input_offset(&self, index: usize) -> Option<usize>
pub fn input_offset(&self, index: usize) -> Option<usize>
Return the serialized bytes offset of the input with the provided index
Return None
if index
is invalid
sourcepub fn output_offset(&self, index: usize) -> Option<usize>
pub fn output_offset(&self, index: usize) -> Option<usize>
Return the serialized bytes offset of the output with the provided index
Return None
if index
is invalid
sourcepub fn witness_offset(&self, index: usize) -> Option<usize>
pub fn witness_offset(&self, index: usize) -> Option<usize>
Return the serialized bytes offset of the witness with the provided index
Return None
if index
is invalid
sourceimpl Transaction
impl Transaction
sourceimpl Transaction
impl Transaction
pub const fn script(
gas_price: u64,
gas_limit: u64,
byte_price: u64,
maturity: u64,
script: Vec<u8, Global>,
script_data: Vec<u8, Global>,
inputs: Vec<Input, Global>,
outputs: Vec<Output, Global>,
witnesses: Vec<Witness, Global>
) -> TransactionⓘNotable traits for Transactionimpl Read for Transactionimpl Write for Transaction
pub const fn create(
gas_price: u64,
gas_limit: u64,
byte_price: u64,
maturity: u64,
bytecode_witness_index: u8,
salt: Salt,
static_contracts: Vec<ContractId, Global>,
storage_slots: Vec<StorageSlot, Global>,
inputs: Vec<Input, Global>,
outputs: Vec<Output, Global>,
witnesses: Vec<Witness, Global>
) -> TransactionⓘNotable traits for Transactionimpl Read for Transactionimpl Write for Transaction
pub fn input_colors(&self) -> impl Iterator<Item = &Color>
pub fn input_contracts(&self) -> impl Iterator<Item = &ContractId>
pub const fn gas_price(&self) -> u64
pub fn set_gas_price(&mut self, price: u64)
pub const fn gas_limit(&self) -> u64
pub fn set_gas_limit(&mut self, limit: u64)
pub const fn byte_price(&self) -> u64
pub fn set_byte_price(&mut self, price: u64)
pub const fn maturity(&self) -> u64
pub fn set_maturity(&mut self, mat: u64)
pub const fn is_script(&self) -> bool
pub const fn metadata(&self) -> Option<&Metadata>
pub fn inputs(&self) -> &[Input]
pub fn outputs(&self) -> &[Output]
pub fn witnesses(&self) -> &[Witness]
pub fn set_witnesses(&mut self, new_witnesses: Vec<Witness, Global>)
pub fn try_from_bytes(bytes: &[u8]) -> Result<(usize, Transaction), Error>
pub const fn receipts_root(&self) -> Option<&Bytes32>
pub fn set_receipts_root(&mut self, root: Bytes32) -> Option<Bytes32>
sourcepub fn metered_bytes_size(&self) -> usize
pub fn metered_bytes_size(&self) -> usize
Used for accounting purposes when charging byte based fees
Trait Implementations
sourceimpl Clone for Transaction
impl Clone for Transaction
sourcepub fn clone(&self) -> TransactionⓘNotable traits for Transactionimpl Read for Transactionimpl Write for Transaction
pub fn clone(&self) -> TransactionⓘNotable traits for Transactionimpl Read for Transactionimpl Write for Transaction
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl Debug for Transaction
impl Debug for Transaction
sourceimpl Default for Transaction
impl Default for Transaction
sourcepub fn default() -> TransactionⓘNotable traits for Transactionimpl Read for Transactionimpl Write for Transaction
pub fn default() -> TransactionⓘNotable traits for Transactionimpl Read for Transactionimpl Write for Transaction
Returns the “default value” for a type. Read more
sourceimpl From<&'_ Transaction> for Context
impl From<&'_ Transaction> for Context
sourcefn from(tx: &Transaction) -> Self
fn from(tx: &Transaction) -> Self
Performs the conversion.
sourceimpl<S> From<Interpreter<S>> for Transaction
impl<S> From<Interpreter<S>> for Transaction
sourcefn from(vm: Interpreter<S>) -> Self
fn from(vm: Interpreter<S>) -> Self
Performs the conversion.
sourceimpl Hash for Transaction
impl Hash for Transaction
sourceimpl PartialEq<Transaction> for Transaction
impl PartialEq<Transaction> for Transaction
sourcepub fn eq(&self, other: &Transaction) -> bool
pub fn eq(&self, other: &Transaction) -> bool
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
sourcepub fn ne(&self, other: &Transaction) -> bool
pub fn ne(&self, other: &Transaction) -> bool
This method tests for !=
.
sourceimpl Read for Transaction
impl Read for Transaction
sourcepub fn read(&mut self, buf: &mut [u8]) -> Result<usize, Error>
pub fn read(&mut self, buf: &mut [u8]) -> Result<usize, Error>
Pull some bytes from this source into the specified buffer, returning how many bytes were read. Read more
1.36.0 · sourcefn read_vectored(&mut self, bufs: &mut [IoSliceMut<'_>]) -> Result<usize, Error>
fn read_vectored(&mut self, bufs: &mut [IoSliceMut<'_>]) -> Result<usize, Error>
Like read
, except that it reads into a slice of buffers. Read more
sourcefn is_read_vectored(&self) -> bool
fn is_read_vectored(&self) -> bool
can_vector
)Determines if this Read
er has an efficient read_vectored
implementation. Read more
1.0.0 · sourcefn read_to_end(&mut self, buf: &mut Vec<u8, Global>) -> Result<usize, Error>
fn read_to_end(&mut self, buf: &mut Vec<u8, Global>) -> Result<usize, Error>
Read all bytes until EOF in this source, placing them into buf
. Read more
1.0.0 · sourcefn read_to_string(&mut self, buf: &mut String) -> Result<usize, Error>
fn read_to_string(&mut self, buf: &mut String) -> Result<usize, Error>
Read all bytes until EOF in this source, appending them to buf
. Read more
1.6.0 · sourcefn read_exact(&mut self, buf: &mut [u8]) -> Result<(), Error>
fn read_exact(&mut self, buf: &mut [u8]) -> Result<(), Error>
Read the exact number of bytes required to fill buf
. Read more
sourcefn read_buf(&mut self, buf: &mut ReadBuf<'_>) -> Result<(), Error>
fn read_buf(&mut self, buf: &mut ReadBuf<'_>) -> Result<(), Error>
read_buf
)Pull some bytes from this source into the specified buffer. Read more
sourcefn read_buf_exact(&mut self, buf: &mut ReadBuf<'_>) -> Result<(), Error>
fn read_buf_exact(&mut self, buf: &mut ReadBuf<'_>) -> Result<(), Error>
read_buf
)Read the exact number of bytes required to fill buf
. Read more
1.0.0 · sourcefn by_ref(&mut self) -> &mut Self
fn by_ref(&mut self) -> &mut Self
Creates a “by reference” adaptor for this instance of Read
. Read more
sourceimpl SizedBytes for Transaction
impl SizedBytes for Transaction
sourcepub fn serialized_size(&self) -> usize
pub fn serialized_size(&self) -> usize
Return the expected serialized size for an instance of the type.
sourceimpl TryFrom<&'_ Transaction> for Contract
impl TryFrom<&'_ Transaction> for Contract
type Error = InterpreterError
type Error = InterpreterError
The type returned in the event of a conversion error.
sourcefn try_from(tx: &Transaction) -> Result<Self, Self::Error>
fn try_from(tx: &Transaction) -> Result<Self, Self::Error>
Performs the conversion.
sourceimpl Write for Transaction
impl Write for Transaction
sourcepub fn write(&mut self, buf: &[u8]) -> Result<usize, Error>
pub fn write(&mut self, buf: &[u8]) -> Result<usize, Error>
Write a buffer into this writer, returning how many bytes were written. Read more
sourcepub fn flush(&mut self) -> Result<(), Error>
pub fn flush(&mut self) -> Result<(), Error>
Flush this output stream, ensuring that all intermediately buffered contents reach their destination. Read more
sourcefn is_write_vectored(&self) -> bool
fn is_write_vectored(&self) -> bool
can_vector
)Determines if this Write
r has an efficient write_vectored
implementation. Read more
1.0.0 · sourcefn write_all(&mut self, buf: &[u8]) -> Result<(), Error>
fn write_all(&mut self, buf: &[u8]) -> Result<(), Error>
Attempts to write an entire buffer into this writer. Read more
sourcefn write_all_vectored(&mut self, bufs: &mut [IoSlice<'_>]) -> Result<(), Error>
fn write_all_vectored(&mut self, bufs: &mut [IoSlice<'_>]) -> Result<(), Error>
write_all_vectored
)Attempts to write multiple buffers into this writer. Read more
impl Eq for Transaction
impl StructuralEq for Transaction
impl StructuralPartialEq for Transaction
Auto Trait Implementations
impl RefUnwindSafe for Transaction
impl Send for Transaction
impl Sync for Transaction
impl Unpin for Transaction
impl UnwindSafe for Transaction
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Deserializable for T where
T: Default + Write,
impl<T> Deserializable for T where
T: Default + Write,
sourceimpl<T> SerializableVec for T where
T: SizedBytes + Read,
impl<T> SerializableVec for T where
T: SizedBytes + Read,
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcepub fn to_owned(&self) -> T
pub fn to_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. Read more
sourcepub fn clone_into(&self, target: &mut T)
pub fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more