pub trait LighterTx {
// Required methods
fn tx_type(&self) -> LighterTxType;
fn context(&self) -> TxContext;
fn push_body_elements(&self, elems: &mut Vec<Fp>);
// Provided methods
fn attributes(&self) -> L2TxAttributes { ... }
fn hash_elements(&self, chain_id: u32) -> Vec<Fp> { ... }
}Expand description
Marker trait every signed L2 transaction implements.
The hash preimage is [chain_id, tx_type, nonce, expired_at, account_index, api_key_index, ...body]. Implementations are responsible for appending the
per-type body elements after the preamble.
Required Methods§
Sourcefn tx_type(&self) -> LighterTxType
fn tx_type(&self) -> LighterTxType
L2 transaction type discriminant emitted on the wire.
Sourcefn push_body_elements(&self, elems: &mut Vec<Fp>)
fn push_body_elements(&self, elems: &mut Vec<Fp>)
Append the body field elements after the preamble. Caller pushes the preamble; implementations push the body in the upstream-fixed order.
Provided Methods§
Sourcefn attributes(&self) -> L2TxAttributes
fn attributes(&self) -> L2TxAttributes
Per-transaction attributes; defaults to an empty set.
Sourcefn hash_elements(&self, chain_id: u32) -> Vec<Fp>
fn hash_elements(&self, chain_id: u32) -> Vec<Fp>
Build the full hash preimage [preamble || body] ready to feed to
hash_to_quintic_extension.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".