Struct clarity_repl::clarity::codec::transaction::StacksTransaction
source · [−]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
sourceimpl StacksTransaction
impl StacksTransaction
pub fn tx_len(&self) -> u64
pub fn consensus_deserialize_with_len<R: Read>(
fd: &mut R
) -> Result<(StacksTransaction, u64), CodecError>
sourceimpl StacksTransaction
impl StacksTransaction
sourcepub fn new(
version: TransactionVersion,
auth: TransactionAuth,
payload: TransactionPayload
) -> StacksTransaction
pub fn new(
version: TransactionVersion,
auth: TransactionAuth,
payload: TransactionPayload
) -> StacksTransaction
Create a new, unsigned transaction and an empty STX fee with no post-conditions.
sourcepub fn get_tx_fee(&self) -> u64
pub fn get_tx_fee(&self) -> u64
Get fee rate
sourcepub fn set_tx_fee(&mut self, tx_fee: u64)
pub fn set_tx_fee(&mut self, tx_fee: u64)
Set fee rate
sourcepub fn get_origin_nonce(&self) -> u64
pub fn get_origin_nonce(&self) -> u64
Get origin nonce
sourcepub fn get_sponsor_nonce(&self) -> Option<u64>
pub fn get_sponsor_nonce(&self) -> Option<u64>
get sponsor nonce
sourcepub fn set_origin_nonce(&mut self, n: u64)
pub fn set_origin_nonce(&mut self, n: u64)
set origin nonce
sourcepub fn set_sponsor_nonce(&mut self, n: u64) -> Result<(), CodecError>
pub fn set_sponsor_nonce(&mut self, n: u64) -> Result<(), CodecError>
set sponsor nonce
sourcepub fn set_anchor_mode(&mut self, anchor_mode: TransactionAnchorMode)
pub fn set_anchor_mode(&mut self, anchor_mode: TransactionAnchorMode)
Set anchor mode
sourcepub fn set_post_condition_mode(
&mut self,
postcond_mode: TransactionPostConditionMode
)
pub fn set_post_condition_mode(
&mut self,
postcond_mode: TransactionPostConditionMode
)
Set post-condition mode
sourcepub fn add_post_condition(&mut self, post_condition: TransactionPostCondition)
pub fn add_post_condition(&mut self, post_condition: TransactionPostCondition)
Add a post-condition
sourcepub fn borrow_auth(&mut self) -> &mut TransactionAuth
pub fn borrow_auth(&mut self) -> &mut TransactionAuth
Get a mutable reference to the internal auth structure
sourcepub fn auth(&self) -> &TransactionAuth
pub fn auth(&self) -> &TransactionAuth
Get an immutable reference to the internal auth structure
sourcepub fn sign_next_origin(
&mut self,
cur_sighash: &Txid,
privk: &Secp256k1PrivateKey
) -> Result<Txid, CodecError>
pub fn sign_next_origin(
&mut self,
cur_sighash: &Txid,
privk: &Secp256k1PrivateKey
) -> Result<Txid, CodecError>
Append the next signature from the origin account authorization. Return the next sighash.
sourcepub fn append_next_origin(
&mut self,
pubk: &Secp256k1PublicKey
) -> Result<(), CodecError>
pub fn append_next_origin(
&mut self,
pubk: &Secp256k1PublicKey
) -> Result<(), CodecError>
Append the next public key to the origin account authorization.
sourcepub fn sign_next_sponsor(
&mut self,
cur_sighash: &Txid,
privk: &Secp256k1PrivateKey
) -> Result<Txid, CodecError>
pub fn sign_next_sponsor(
&mut self,
cur_sighash: &Txid,
privk: &Secp256k1PrivateKey
) -> Result<Txid, CodecError>
Append the next signature from the sponsoring account. Return the next sighash
sourcepub fn append_next_sponsor(
&mut self,
pubk: &Secp256k1PublicKey
) -> Result<(), CodecError>
pub fn append_next_sponsor(
&mut self,
pubk: &Secp256k1PublicKey
) -> Result<(), CodecError>
Append the next public key to the sponsor account authorization.
sourcepub fn verify(&self) -> Result<(), CodecError>
pub fn verify(&self) -> Result<(), CodecError>
Verify this transaction’s signatures
sourcepub fn verify_origin(&self) -> Result<Txid, CodecError>
pub fn verify_origin(&self) -> Result<Txid, CodecError>
Verify the transaction’s origin signatures only. Used by sponsors to get the next sig-hash to sign.
sourcepub fn origin_address(&self) -> StacksAddress
pub fn origin_address(&self) -> StacksAddress
Get the origin account’s address
sourcepub fn sponsor_address(&self) -> Option<StacksAddress>
pub fn sponsor_address(&self) -> Option<StacksAddress>
Get the sponsor account’s address, if this transaction is sponsored
sourcepub fn get_origin(&self) -> TransactionSpendingCondition
pub fn get_origin(&self) -> TransactionSpendingCondition
Get a copy of the origin spending condition
sourcepub fn get_payer(&self) -> TransactionSpendingCondition
pub fn get_payer(&self) -> TransactionSpendingCondition
Get a copy of the sending condition that will pay the tx fee
sourcepub fn is_mainnet(&self) -> bool
pub fn is_mainnet(&self) -> bool
Is this a mainnet transaction? false means ‘testnet’
Trait Implementations
sourceimpl Clone for StacksTransaction
impl Clone for StacksTransaction
sourcefn clone(&self) -> StacksTransaction
fn clone(&self) -> StacksTransaction
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 StacksTransaction
impl Debug for StacksTransaction
sourceimpl<'de> Deserialize<'de> for StacksTransaction
impl<'de> Deserialize<'de> for StacksTransaction
sourcefn 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
sourceimpl PartialEq<StacksTransaction> for StacksTransaction
impl PartialEq<StacksTransaction> for StacksTransaction
sourcefn eq(&self, other: &StacksTransaction) -> bool
fn eq(&self, other: &StacksTransaction) -> bool
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
sourcefn ne(&self, other: &StacksTransaction) -> bool
fn ne(&self, other: &StacksTransaction) -> bool
This method tests for !=
.
sourceimpl Serialize for StacksTransaction
impl Serialize for StacksTransaction
sourceimpl StacksMessageCodec for StacksTransaction
impl StacksMessageCodec for StacksTransaction
sourcefn consensus_serialize<W: Write>(&self, fd: &mut W) -> Result<(), CodecError>
fn consensus_serialize<W: Write>(&self, fd: &mut W) -> Result<(), CodecError>
serialize implementors should never error unless there is an underlying
failure in writing to the fd
Read more
fn consensus_deserialize<R: Read>(
fd: &mut R
) -> Result<StacksTransaction, CodecError>
impl StructuralPartialEq for StacksTransaction
Auto Trait Implementations
impl RefUnwindSafe for StacksTransaction
impl Send for StacksTransaction
impl Sync for StacksTransaction
impl Unpin for StacksTransaction
impl UnwindSafe for StacksTransaction
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> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
pub fn vzip(self) -> V
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
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
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more