pub struct Transaction {
pub signer_id: AccountId,
pub public_key: PublicKey,
pub nonce: u64,
pub receiver_id: AccountId,
pub block_hash: CryptoHash,
pub actions: Vec<Action>,
}Expand description
An unsigned transaction.
Fields§
§signer_id: AccountIdThe account that signs and pays for the transaction.
public_key: PublicKeyThe public key of the signer.
nonce: u64Nonce for replay protection (must be greater than previous nonce).
receiver_id: AccountIdThe account that receives the transaction.
block_hash: CryptoHashA recent block hash for transaction validity.
actions: Vec<Action>The actions to execute.
Implementations§
Source§impl Transaction
impl Transaction
Sourcepub fn new(
signer_id: AccountId,
public_key: PublicKey,
nonce: u64,
receiver_id: AccountId,
block_hash: CryptoHash,
actions: Vec<Action>,
) -> Self
pub fn new( signer_id: AccountId, public_key: PublicKey, nonce: u64, receiver_id: AccountId, block_hash: CryptoHash, actions: Vec<Action>, ) -> Self
Create a new transaction.
Sourcepub fn get_hash(&self) -> CryptoHash
pub fn get_hash(&self) -> CryptoHash
Get the hash of this transaction (for signing).
Sourcepub fn get_hash_and_size(&self) -> (CryptoHash, usize)
pub fn get_hash_and_size(&self) -> (CryptoHash, usize)
Get the raw bytes of this transaction (for signing).
Sourcepub fn sign(self, signer: &SecretKey) -> SignedTransaction
pub fn sign(self, signer: &SecretKey) -> SignedTransaction
Sign this transaction with a secret key.
Trait Implementations§
Source§impl BorshDeserialize for Transaction
impl BorshDeserialize for Transaction
fn deserialize_reader<__R: Read>(reader: &mut __R) -> Result<Self, Error>
Source§fn deserialize(buf: &mut &[u8]) -> Result<Self, Error>
fn deserialize(buf: &mut &[u8]) -> Result<Self, Error>
Deserializes this instance from a given slice of bytes.
Updates the buffer to point at the remaining bytes.
Source§fn try_from_slice(v: &[u8]) -> Result<Self, Error>
fn try_from_slice(v: &[u8]) -> Result<Self, Error>
Deserialize this instance from a slice of bytes.
fn try_from_reader<R>(reader: &mut R) -> Result<Self, Error>where
R: Read,
Source§impl BorshSerialize for Transaction
impl BorshSerialize for Transaction
Source§impl Clone for Transaction
impl Clone for Transaction
Source§fn clone(&self) -> Transaction
fn clone(&self) -> Transaction
Returns a duplicate 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 moreSource§impl Debug for Transaction
impl Debug for Transaction
Source§impl PartialEq for Transaction
impl PartialEq for Transaction
impl Eq for Transaction
impl StructuralPartialEq for Transaction
Auto Trait Implementations§
impl Freeze for Transaction
impl RefUnwindSafe for Transaction
impl Send for Transaction
impl Sync for Transaction
impl Unpin for Transaction
impl UnsafeUnpin for Transaction
impl UnwindSafe for Transaction
Blanket Implementations§
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
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.