Struct bsv_wasm::transaction::Transaction [−][src]
pub struct Transaction { /* fields omitted */ }Implementations
(hashPrevouts) https://github.com/bitcoincashorg/bitcoincash.org/blob/master/spec/replay-protected-sighash.md Checks the hash cache to see if there already are hashed inputs, otherwise calculates the hash and adds it to the cache.
Logic:
- If SigHash does not contain ANYONECANPAY, SHA256d all input outpoints
- Else 32 bytes of zeroes
pub fn sign(
&mut self,
priv_key: &PrivateKey,
sighash: SigHash,
n_tx_in: usize,
unsigned_script: &Script,
value: u64
) -> Result<SighashSignature, BSVErrors>
Platform Agnostic Functions ie. Don’t need Result<T, E>
Creates a new empty transaction where you need to add inputs and outputs Transaction.add_input(TxIn) and Transaction.add_output(TxOut)
Returns the first output index that matches the given parameters, returns None or null if not found.
Returns a list of outputs indexes that match the given parameters
Returns the first input index that matches the given parameters, returns None or null if not found.
Returns a list of input indexes that match the given parameters
XT Method: Returns the combined sum of all input satoshis. If any of the inputs dont have satoshis defined, this returns None or null
Returns the combined sum of all output satoshis.
Native Specific Functions
Gets the ID of the current transaction as a hex string.
Gets the ID of the current transaction as a Vec
Get size of current serialised Transaction object
Serialises this entire transaction to CBOR, preserving all fields from the standard Transaction format + TX+
Trait Implementations
Returns the “default value” for a type. Read more
fn 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>,
Deserialize this value from the given Serde deserializer. Read more
Performs the conversion.
This method tests for self and other values to be equal, and is used
by ==. Read more
This method tests for !=.
type Anchor = Ref<'static, Transaction>
type Anchor = Ref<'static, Transaction>
The type that holds the reference to Self for the duration of the
invocation of the function that has an &Self parameter. This is
required to ensure that the lifetimes don’t persist beyond one function
call, and so that they remain anonymous. Read more
Recover a Self::Anchor from Self::Abi. Read more
type Anchor = RefMut<'static, Transaction>
type Anchor = RefMut<'static, Transaction>
Same as RefFromWasmAbi::Anchor
Same as RefFromWasmAbi::ref_from_abi
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
Mutably borrows from an owned value. Read more
type Abi = <T as IntoWasmAbi>::Abi
type Abi = <T as IntoWasmAbi>::Abi
Same as IntoWasmAbi::Abi
Same as IntoWasmAbi::into_abi, except that it may throw and never
return in the case of Err. Read more