pub enum ClientTransaction {
Script(Script),
Create(Create),
Mint(Mint),
}
Expand description
The fuel transaction entity https://github.com/FuelLabs/fuel-specs/blob/master/src/protocol/tx_format/transaction.md#transaction.
Variants§
Implementations§
§impl Transaction
impl Transaction
pub fn try_from_bytes(bytes: &[u8]) -> Result<(usize, Transaction), Error>
§impl Transaction
impl Transaction
pub fn default_test_tx() -> Transaction ⓘ
pub fn default_test_tx() -> Transaction ⓘ
Return default valid transaction useful for tests.
pub const fn script( gas_price: u64, gas_limit: u64, maturity: BlockHeight, script: Vec<u8>, script_data: Vec<u8>, inputs: Vec<Input>, outputs: Vec<Output>, witnesses: Vec<Witness> ) -> Script
pub fn create( gas_price: u64, gas_limit: u64, maturity: BlockHeight, bytecode_witness_index: u8, salt: Salt, storage_slots: Vec<StorageSlot>, inputs: Vec<Input>, outputs: Vec<Output>, witnesses: Vec<Witness> ) -> Create
pub fn mint(tx_pointer: TxPointer, outputs: Vec<Output>) -> Mint
pub fn to_json(&self) -> String
pub fn to_json(&self) -> String
Convert the type into a JSON string
This is implemented as infallible because serde_json will fail only if the type can’t serialize one of its attributes. We don’t have such case with the transaction because all of its attributes are trivially serialized.
If an error happens, a JSON string with the error description will be returned
pub fn from_json<J>(json: J) -> Option<Transaction>
pub fn from_json<J>(json: J) -> Option<Transaction>
Attempt to deserialize a transaction from a JSON string, returning None
if it
fails
pub const fn is_script(&self) -> bool
pub const fn is_create(&self) -> bool
pub const fn is_mint(&self) -> bool
pub const fn as_script(&self) -> Option<&Script>
pub fn as_script_mut(&mut self) -> Option<&mut Script>
pub const fn as_create(&self) -> Option<&Create>
pub fn as_create_mut(&mut self) -> Option<&mut Create>
pub const fn as_mint(&self) -> Option<&Mint>
pub fn as_mint_mut(&mut self) -> Option<&mut Mint>
Trait Implementations§
§impl Cacheable for Transaction
impl Cacheable for Transaction
§fn is_computed(&self) -> bool
fn is_computed(&self) -> bool
The cache is already computed. Read more
§fn precompute(&mut self, chain_id: &ChainId) -> Result<(), CheckError>
fn precompute(&mut self, chain_id: &ChainId) -> Result<(), CheckError>
Computes the cache for the entity.
§impl Clone for Transaction
impl Clone for Transaction
§fn clone(&self) -> Transaction ⓘ
fn clone(&self) -> Transaction ⓘ
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read more§impl Debug for Transaction
impl Debug for Transaction
§impl Default for Transaction
impl Default for Transaction
§fn default() -> Transaction ⓘ
fn default() -> Transaction ⓘ
Returns the “default value” for a type. Read more
§impl<'de> Deserialize<'de> for Transaction
impl<'de> Deserialize<'de> for Transaction
§fn deserialize<__D>(
__deserializer: __D
) -> Result<Transaction, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D
) -> Result<Transaction, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
§impl EnumCount for Transaction
impl EnumCount for Transaction
§impl EstimatePredicates for Transaction
impl EstimatePredicates for Transaction
§fn estimate_predicates(
&mut self,
params: &ConsensusParameters,
gas_costs: &GasCosts
) -> Result<(), CheckError>
fn estimate_predicates( &mut self, params: &ConsensusParameters, gas_costs: &GasCosts ) -> Result<(), CheckError>
Estimates predicates of the transaction.
§fn estimate_predicates_async<'life0, 'life1, 'life2, 'async_trait, E>(
&'life0 mut self,
params: &'life1 ConsensusParameters,
gas_costs: &'life2 GasCosts
) -> Pin<Box<dyn Future<Output = Result<(), CheckError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
E: 'async_trait + ParallelExecutor,
Transaction: 'async_trait,
fn estimate_predicates_async<'life0, 'life1, 'life2, 'async_trait, E>(
&'life0 mut self,
params: &'life1 ConsensusParameters,
gas_costs: &'life2 GasCosts
) -> Pin<Box<dyn Future<Output = Result<(), CheckError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
E: 'async_trait + ParallelExecutor,
Transaction: 'async_trait,
Estimates predicates of the transaction in parallel.
§impl FormatValidityChecks for Transaction
impl FormatValidityChecks for Transaction
§fn check_signatures(&self, chain_id: &ChainId) -> Result<(), CheckError>
fn check_signatures(&self, chain_id: &ChainId) -> Result<(), CheckError>
Validates that all required signatures are set in the transaction and that they
are valid.
§fn check_without_signatures(
&self,
block_height: BlockHeight,
parameters: &ConsensusParameters
) -> Result<(), CheckError>
fn check_without_signatures( &self, block_height: BlockHeight, parameters: &ConsensusParameters ) -> Result<(), CheckError>
Validates the transactions according to rules from the specification:
https://github.com/FuelLabs/fuel-specs/blob/master/src/protocol/tx_format/transaction.md#transaction
§fn check(
&self,
block_height: BlockHeight,
parameters: &ConsensusParameters
) -> Result<(), CheckError>
fn check( &self, block_height: BlockHeight, parameters: &ConsensusParameters ) -> Result<(), CheckError>
Performs all stateless transaction validity checks. This includes the validity
of fields according to rules in the specification and validity of signatures.
§impl From<&Transaction> for TransactionRepr
impl From<&Transaction> for TransactionRepr
§fn from(tx: &Transaction) -> TransactionRepr
fn from(tx: &Transaction) -> TransactionRepr
Converts to this type from the input type.
§impl From<Create> for Transaction
impl From<Create> for Transaction
§fn from(create: Create) -> Transaction ⓘ
fn from(create: Create) -> Transaction ⓘ
Converts to this type from the input type.
§impl From<CreateTransaction> for Transaction
impl From<CreateTransaction> for Transaction
§fn from(tx: CreateTransaction) -> Transaction ⓘ
fn from(tx: CreateTransaction) -> Transaction ⓘ
Converts to this type from the input type.
§impl From<Mint> for Transaction
impl From<Mint> for Transaction
§fn from(mint: Mint) -> Transaction ⓘ
fn from(mint: Mint) -> Transaction ⓘ
Converts to this type from the input type.
§impl From<Script> for Transaction
impl From<Script> for Transaction
§fn from(script: Script) -> Transaction ⓘ
fn from(script: Script) -> Transaction ⓘ
Converts to this type from the input type.
§impl From<ScriptTransaction> for Transaction
impl From<ScriptTransaction> for Transaction
§fn from(tx: ScriptTransaction) -> Transaction ⓘ
fn from(tx: ScriptTransaction) -> Transaction ⓘ
Converts to this type from the input type.
§impl From<TransactionType> for Transaction
impl From<TransactionType> for Transaction
§fn from(value: TransactionType) -> Transaction ⓘ
fn from(value: TransactionType) -> Transaction ⓘ
Converts to this type from the input type.
§impl Hash for Transaction
impl Hash for Transaction
§impl IntoChecked for Transaction
impl IntoChecked for Transaction
§fn into_checked_basic(
self,
block_height: BlockHeight,
params: &ConsensusParameters
) -> Result<Checked<Transaction>, CheckError>
fn into_checked_basic( self, block_height: BlockHeight, params: &ConsensusParameters ) -> Result<Checked<Transaction>, CheckError>
Returns transaction that passed only
Checks::Basic
.§fn into_checked(
self,
block_height: BlockHeight,
params: &ConsensusParameters,
gas_costs: &GasCosts
) -> Result<Checked<Self>, CheckError>where
Checked<Self>: CheckPredicates,
fn into_checked(
self,
block_height: BlockHeight,
params: &ConsensusParameters,
gas_costs: &GasCosts
) -> Result<Checked<Self>, CheckError>where
Checked<Self>: CheckPredicates,
Returns transaction that passed all
Checks
.§impl PartialEq for Transaction
impl PartialEq for Transaction
§fn eq(&self, other: &Transaction) -> bool
fn eq(&self, other: &Transaction) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.§impl Read for Transaction
impl Read for Transaction
§fn read(&mut self, buf: &mut [u8]) -> Result<usize, Error>
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 · source§fn 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 moresource§fn is_read_vectored(&self) -> bool
fn is_read_vectored(&self) -> bool
🔬This is a nightly-only experimental API. (
can_vector
)1.0.0 · source§fn read_to_end(&mut self, buf: &mut Vec<u8>) -> Result<usize, Error>
fn read_to_end(&mut self, buf: &mut Vec<u8>) -> Result<usize, Error>
Read all bytes until EOF in this source, placing them into
buf
. Read more1.0.0 · source§fn 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 more1.6.0 · source§fn 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 moresource§fn read_buf(&mut self, buf: BorrowedCursor<'_>) -> Result<(), Error>
fn read_buf(&mut self, buf: BorrowedCursor<'_>) -> Result<(), Error>
🔬This is a nightly-only experimental API. (
read_buf
)Pull some bytes from this source into the specified buffer. Read more
source§fn read_buf_exact(&mut self, cursor: BorrowedCursor<'_>) -> Result<(), Error>
fn read_buf_exact(&mut self, cursor: BorrowedCursor<'_>) -> Result<(), Error>
🔬This is a nightly-only experimental API. (
read_buf
)Read the exact number of bytes required to fill
cursor
. Read more1.0.0 · source§fn by_ref(&mut self) -> &mut Selfwhere
Self: Sized,
fn by_ref(&mut self) -> &mut Selfwhere
Self: Sized,
Creates a “by reference” adaptor for this instance of
Read
. Read more§impl Serialize for Transaction
impl Serialize for Transaction
§fn serialize<__S>(
&self,
__serializer: __S
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
§impl SizedBytes for Transaction
impl SizedBytes for Transaction
§fn serialized_size(&self) -> usize
fn serialized_size(&self) -> usize
Return the expected serialized size for an instance of the type.
§impl TryFrom<&Transaction> for Contract
impl TryFrom<&Transaction> for Contract
§fn try_from(
tx: &Transaction
) -> Result<Contract, <Contract as TryFrom<&Transaction>>::Error>
fn try_from( tx: &Transaction ) -> Result<Contract, <Contract as TryFrom<&Transaction>>::Error>
Performs the conversion.
§impl UniqueIdentifier for Transaction
impl UniqueIdentifier for Transaction
§impl Write for Transaction
impl Write for Transaction
§fn write(&mut self, full_buf: &[u8]) -> Result<usize, Error>
fn write(&mut self, full_buf: &[u8]) -> Result<usize, Error>
Write a buffer into this writer, returning how many bytes were written. Read more
§fn flush(&mut self) -> Result<(), Error>
fn flush(&mut self) -> Result<(), Error>
Flush this output stream, ensuring that all intermediately buffered
contents reach their destination. Read more
source§fn is_write_vectored(&self) -> bool
fn is_write_vectored(&self) -> bool
🔬This is a nightly-only experimental API. (
can_vector
)1.0.0 · source§fn 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
source§fn write_all_vectored(&mut self, bufs: &mut [IoSlice<'_>]) -> Result<(), Error>
fn write_all_vectored(&mut self, bufs: &mut [IoSlice<'_>]) -> Result<(), Error>
🔬This is a nightly-only experimental API. (
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§
§impl<T> AnyDebug for T
impl<T> AnyDebug for T
§fn as_any_ref(&self) -> &(dyn Any + 'static)
fn as_any_ref(&self) -> &(dyn Any + 'static)
Returns a reference to the underlying type as
Any
.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
§impl<T> Conv for T
impl<T> Conv for T
§impl<T> Deserializable for T
impl<T> Deserializable for T
§fn from_bytes(bytes: &[u8]) -> Result<T, Error>
fn from_bytes(bytes: &[u8]) -> Result<T, Error>
Deserialization from variable length slices of bytes.
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
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
Compare self to
key
and return true
if they are equal.§impl<T> FmtForward for T
impl<T> FmtForward for T
§fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
Causes
self
to use its Binary
implementation when Debug
-formatted.§fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
Causes
self
to use its Display
implementation when
Debug
-formatted.§fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
Causes
self
to use its LowerExp
implementation when
Debug
-formatted.§fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
Causes
self
to use its LowerHex
implementation when
Debug
-formatted.§fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
Causes
self
to use its Octal
implementation when Debug
-formatted.§fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
Causes
self
to use its Pointer
implementation when
Debug
-formatted.§fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
Causes
self
to use its UpperExp
implementation when
Debug
-formatted.§fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
Causes
self
to use its UpperHex
implementation when
Debug
-formatted.§fn fmt_list(self) -> FmtList<Self>where
&'a Self: for<'a> IntoIterator,
fn fmt_list(self) -> FmtList<Self>where
&'a Self: for<'a> IntoIterator,
Formats each item in a sequence. Read more
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
Pipes by value. This is generally the method you want to use. Read more
§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
Borrows
self
and passes that borrow into the pipe function. Read more§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
Mutably borrows
self
and passes that borrow into the pipe function. Read more§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R ) -> R
§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
Borrows
self
, then passes self.as_ref()
into the pipe function.§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
Mutably borrows
self
, then passes self.as_mut()
into the pipe
function.§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
Borrows
self
, then passes self.deref()
into the pipe function.§impl<T> StorageAsMut for T
impl<T> StorageAsMut for T
fn storage<Type>(&mut self) -> StorageMut<'_, Self, Type>where
Type: Mappable,
fn storage_as_mut<Type>(&mut self) -> StorageMut<'_, Self, Type>where
Type: Mappable,
§impl<T> StorageAsRef for T
impl<T> StorageAsRef for T
fn storage<Type>(&self) -> StorageRef<'_, Self, Type>where
Type: Mappable,
fn storage_as_ref<Type>(&self) -> StorageRef<'_, Self, Type>where
Type: Mappable,
§impl<T> Tap for T
impl<T> Tap for T
§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Immutable access to the
Borrow<B>
of a value. Read more§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
Mutable access to the
BorrowMut<B>
of a value. Read more§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
Immutable access to the
AsRef<R>
view of a value. Read more§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
Mutable access to the
AsMut<R>
view of a value. Read more§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Immutable access to the
Deref::Target
of a value. Read more§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Mutable access to the
Deref::Target
of a value. Read more§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
Calls
.tap()
only in debug builds, and is erased in release builds.§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
Calls
.tap_mut()
only in debug builds, and is erased in release
builds.§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
Calls
.tap_borrow()
only in debug builds, and is erased in release
builds.§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
Calls
.tap_borrow_mut()
only in debug builds, and is erased in release
builds.§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
Calls
.tap_ref()
only in debug builds, and is erased in release
builds.§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
Calls
.tap_ref_mut()
only in debug builds, and is erased in release
builds.§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
Calls
.tap_deref()
only in debug builds, and is erased in release
builds.