pub struct Transaction;Expand description
Transaction construction and serialization.
Use Transaction::builder() for signed transactions, or
UnsignedTransaction::builder() for external signing.
Implementations§
Source§impl Transaction
impl Transaction
Sourcepub fn from_parts(
tx: UnsignedTransaction,
signature: [u8; 64],
pub_key: [u8; 32],
) -> SignedTransaction
pub fn from_parts( tx: UnsignedTransaction, signature: [u8; 64], pub_key: [u8; 32], ) -> SignedTransaction
Assemble a signed transaction from an unsigned transaction, a 64-byte Ed25519 signature, and a 32-byte public key.
Use after signing the bytes from UnsignedTransaction::to_bytes.
Sourcepub fn to_bytes(signed: &SignedTransaction) -> SDKResult<Vec<u8>>
pub fn to_bytes(signed: &SignedTransaction) -> SDKResult<Vec<u8>>
Borsh-serialize a signed transaction to bytes.
Useful for byte-level comparison of two signed transactions.
Sourcepub fn to_base64(signed: &SignedTransaction) -> SDKResult<String>
pub fn to_base64(signed: &SignedTransaction) -> SDKResult<String>
Borsh-serialize and base64-encode a signed transaction.
Sourcepub fn builder<'f1, 'f2>() -> TransactionBuilder<'f1, 'f2>
pub fn builder<'f1, 'f2>() -> TransactionBuilder<'f1, 'f2>
Build a signed transaction.
Internally builds an unsigned transaction, serializes it, signs with the provided keypair, and assembles the result.
§Example
ⓘ
let signed = Transaction::builder()
.call_message(call_msg)
.max_fee(10_000_000)
.signer(&keypair)
.client(&client)
.build()?;
client.send_transaction(&signed).await?;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