pub struct StacksTransaction {
    pub version: TransactionVersion,
    pub chain_id: u32,
    pub auth: TransactionAuth,
    pub anchor_mode: TransactionAnchorMode,
    pub post_condition_mode: TransactionPostConditionMode,
    pub post_conditions: Vec<TransactionPostCondition>,
    pub payload: TransactionPayload,
}

Fields§

§version: TransactionVersion§chain_id: u32§auth: TransactionAuth§anchor_mode: TransactionAnchorMode§post_condition_mode: TransactionPostConditionMode§post_conditions: Vec<TransactionPostCondition>§payload: TransactionPayload

Implementations§

source§

impl StacksTransaction

source

pub fn new( version: TransactionVersion, auth: TransactionAuth, payload: TransactionPayload ) -> StacksTransaction

Create a new, unsigned transaction and an empty STX fee with no post-conditions.

source

pub fn get_tx_fee(&self) -> u64

Get fee rate

source

pub fn set_tx_fee(&mut self, tx_fee: u64)

Set fee rate

source

pub fn get_origin_nonce(&self) -> u64

Get origin nonce

source

pub fn get_sponsor_nonce(&self) -> Option<u64>

get sponsor nonce

source

pub fn set_origin_nonce(&mut self, n: u64)

set origin nonce

source

pub fn set_sponsor_nonce(&mut self, n: u64) -> Result<(), Error>

set sponsor nonce

source

pub fn set_anchor_mode(&mut self, anchor_mode: TransactionAnchorMode)

Set anchor mode

source

pub fn set_post_condition_mode( &mut self, postcond_mode: TransactionPostConditionMode )

Set post-condition mode

source

pub fn add_post_condition(&mut self, post_condition: TransactionPostCondition)

Add a post-condition

source

pub fn txid(&self) -> Txid

a txid of a stacks transaction is its sha512/256 hash

source

pub fn borrow_auth(&mut self) -> &mut TransactionAuth

Get a mutable reference to the internal auth structure

source

pub fn auth(&self) -> &TransactionAuth

Get an immutable reference to the internal auth structure

source

pub fn sign_next_origin( &mut self, cur_sighash: &Txid, privk: &Secp256k1PrivateKey ) -> Result<Txid, Error>

Append the next signature from the origin account authorization. Return the next sighash.

source

pub fn append_next_origin( &mut self, pubk: &Secp256k1PublicKey ) -> Result<(), Error>

Append the next public key to the origin account authorization.

source

pub fn sign_next_sponsor( &mut self, cur_sighash: &Txid, privk: &Secp256k1PrivateKey ) -> Result<Txid, Error>

Append the next signature from the sponsoring account. Return the next sighash

source

pub fn append_next_sponsor( &mut self, pubk: &Secp256k1PublicKey ) -> Result<(), Error>

Append the next public key to the sponsor account authorization.

source

pub fn verify(&self) -> Result<(), Error>

Verify this transaction’s signatures

source

pub fn verify_origin(&self) -> Result<Txid, Error>

Verify the transaction’s origin signatures only. Used by sponsors to get the next sig-hash to sign.

source

pub fn origin_address(&self) -> StacksAddress

Get the origin account’s address

source

pub fn sponsor_address(&self) -> Option<StacksAddress>

Get the sponsor account’s address, if this transaction is sponsored

source

pub fn get_origin(&self) -> TransactionSpendingCondition

Get a copy of the origin spending condition

source

pub fn get_payer(&self) -> TransactionSpendingCondition

Get a copy of the sending condition that will pay the tx fee

source

pub fn is_mainnet(&self) -> bool

Is this a mainnet transaction? false means ‘testnet’

source

pub fn tx_len(&self) -> u64

source

pub fn consensus_deserialize_with_len<R>( fd: &mut R ) -> Result<(StacksTransaction, u64), Error>where R: Read,

Trait Implementations§

source§

impl Clone for StacksTransaction

source§

fn clone(&self) -> StacksTransaction

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for StacksTransaction

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
source§

impl<'de> Deserialize<'de> for StacksTransaction

source§

fn deserialize<__D>( __deserializer: __D ) -> Result<StacksTransaction, <__D as Deserializer<'de>>::Error>where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
source§

impl PartialEq for StacksTransaction

source§

fn eq(&self, other: &StacksTransaction) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Serialize for StacksTransaction

source§

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
source§

impl StacksMessageCodec for StacksTransaction

source§

fn consensus_serialize<W>(&self, fd: &mut W) -> Result<(), Error>where W: Write,

serialize implementors should never error unless there is an underlying failure in writing to the fd
source§

fn consensus_deserialize<R>(fd: &mut R) -> Result<StacksTransaction, Error>where R: Read,

§

fn serialize_to_vec(&self) -> Vec<u8> where Self: Sized,

Convenience for serialization to a vec. this function unwraps any underlying serialization error
source§

impl StructuralPartialEq for StacksTransaction

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for Twhere V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
source§

impl<T> DeserializeOwned for Twhere T: for<'de> Deserialize<'de>,