pub struct VersionedTransaction(pub VersionedTransaction);
Expand description
An atomic transaction
The __init__
method signs a versioned message to
create a signed transaction.
Args: message (Message | MessageV0): The message to sign. keypairs (Sequence[Keypair | Presigner]): The keypairs that are to sign the transaction.
Tuple Fields§
§0: VersionedTransaction
Implementations§
Source§impl VersionedTransaction
impl VersionedTransaction
pub fn new(message: VersionedMessage, keypairs: Vec<Signer>) -> PyResult<Self>
Sourcepub fn message(&self) -> VersionedMessage
pub fn message(&self) -> VersionedMessage
Message | MessageV0: The transaction message.
Sourcepub fn signatures(&self) -> Vec<Signature>
pub fn signatures(&self) -> Vec<Signature>
ListSignature: The transaction signatures.
Sourcepub fn populate(message: VersionedMessage, signatures: Vec<Signature>) -> Self
pub fn populate(message: VersionedMessage, signatures: Vec<Signature>) -> Self
Create a fully-signed transaction from a message and its signatures.
Args: message (Message | MessageV0): The transaction message. signatures (SequenceSignature): The message’s signatures.
Returns: Transaction: The signed transaction.
Example:
>>> from solders.pubkey import Pubkey
>>> from solders.instruction import Instruction
>>> from solders.message import MessageV0
>>> from solders.hash import Hash
>>> from solders.keypair import Keypair
>>> from solders.transaction import VersionedTransaction
>>> payer = Keypair()
>>> program_id = Pubkey.default()
>>> instructions = [Instruction(program_id, bytes([]), [])]
>>> recent_blockhash = Hash.new_unique()
>>> message = MessageV0.try_compile(payer.pubkey(), instructions, [], recent_blockhash)
>>> tx = VersionedTransaction(message, [payer])
>>> assert VersionedTransaction.populate(message, tx.signatures) == tx
Sourcepub fn version(&self) -> TransactionVersion
pub fn version(&self) -> TransactionVersion
Returns the version of the transaction.
Returns: Legacy | int: Transaction version.
Sourcepub fn into_legacy_transaction(&self) -> Option<Transaction>
pub fn into_legacy_transaction(&self) -> Option<Transaction>
Returns a legacy transaction if the transaction message is legacy.
Returns: OptionalTransaction: The legacy transaction.
Sourcepub fn verify_and_hash_message(&self) -> PyResult<SolderHash>
pub fn verify_and_hash_message(&self) -> PyResult<SolderHash>
Verify the transaction and hash its message
Sourcepub fn verify_with_results(&self) -> Vec<bool>
pub fn verify_with_results(&self) -> Vec<bool>
Verify the transaction and return a list of verification results
Sourcepub fn new_default() -> Self
pub fn new_default() -> Self
Return a new default transaction.
Returns: VersionedTransaction: The default transaction.
Sourcepub fn from_legacy(tx: Transaction) -> Self
pub fn from_legacy(tx: Transaction) -> Self
Convert a legacy transaction to a VersionedTransaction.
Returns: VersionedTransaction: The versioned tx.
Sourcepub fn uses_durable_nonce(&self) -> bool
pub fn uses_durable_nonce(&self) -> bool
Returns true if transaction begins with a valid advance nonce instruction.
Returns: bool
pub fn __richcmp__(&self, other: &Self, op: CompareOp) -> PyResult<bool>
pub fn __bytes__<'a>(&self, py: Python<'a>) -> &'a PyBytes
pub fn __str__(&self) -> String
pub fn __repr__(&self) -> String
pub fn __reduce__(&self) -> PyResult<(PyObject, PyObject)>
Sourcepub fn from_bytes(data: &[u8]) -> PyResult<Self>
pub fn from_bytes(data: &[u8]) -> PyResult<Self>
Deserialize from bytes.
Args: data (bytes): the serialized object.
Returns: the deserialized object.
Trait Implementations§
Source§impl Clone for VersionedTransaction
impl Clone for VersionedTransaction
Source§fn clone(&self) -> VersionedTransaction
fn clone(&self) -> VersionedTransaction
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl CommonMethods<'_> for VersionedTransaction
impl CommonMethods<'_> for VersionedTransaction
fn py_to_json(&self) -> String
fn py_from_json(raw: &'a str) -> Result<Self, PyErr>
Source§impl Debug for VersionedTransaction
impl Debug for VersionedTransaction
Source§impl Default for VersionedTransaction
impl Default for VersionedTransaction
Source§fn default() -> VersionedTransaction
fn default() -> VersionedTransaction
Source§impl<'de> Deserialize<'de> for VersionedTransaction
impl<'de> Deserialize<'de> for VersionedTransaction
Source§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>,
Source§impl Display for VersionedTransaction
impl Display for VersionedTransaction
Source§impl From<Transaction> for VersionedTransaction
impl From<Transaction> for VersionedTransaction
Source§fn from(t: Transaction) -> Self
fn from(t: Transaction) -> Self
Source§impl From<VersionedTransaction> for VersionedTransaction
impl From<VersionedTransaction> for VersionedTransaction
Source§fn from(original: VersionedTransactionOriginal) -> VersionedTransaction
fn from(original: VersionedTransactionOriginal) -> VersionedTransaction
Source§impl From<VersionedTransaction> for VersionedTransaction
impl From<VersionedTransaction> for VersionedTransaction
Source§fn from(original: VersionedTransaction) -> Self
fn from(original: VersionedTransaction) -> Self
Source§impl PartialEq for VersionedTransaction
impl PartialEq for VersionedTransaction
Source§impl PyBytesBincode for VersionedTransaction
impl PyBytesBincode for VersionedTransaction
fn pybytes_bincode<'a>(&self, py: Python<'a>) -> &'a PyBytes
Source§impl PyBytesGeneral for VersionedTransaction
impl PyBytesGeneral for VersionedTransaction
fn pybytes_general<'a>(&self, py: Python<'a>) -> &'a PyBytes
Source§impl PyClass for VersionedTransaction
impl PyClass for VersionedTransaction
Source§impl PyClassImpl for VersionedTransaction
impl PyClassImpl for VersionedTransaction
Source§const IS_BASETYPE: bool = true
const IS_BASETYPE: bool = true
Source§const IS_SUBCLASS: bool = false
const IS_SUBCLASS: bool = false
Source§const IS_MAPPING: bool = false
const IS_MAPPING: bool = false
Source§const IS_SEQUENCE: bool = false
const IS_SEQUENCE: bool = false
Source§type ThreadChecker = SendablePyClass<VersionedTransaction>
type ThreadChecker = SendablePyClass<VersionedTransaction>
Source§type PyClassMutability = <<PyAny as PyClassBaseType>::PyClassMutability as PyClassMutability>::MutableChild
type PyClassMutability = <<PyAny as PyClassBaseType>::PyClassMutability as PyClassMutability>::MutableChild
Source§type BaseNativeType = PyAny
type BaseNativeType = PyAny
PyAny
by default, and when you declare
#[pyclass(extends=PyDict)]
, it’s PyDict
.fn items_iter() -> PyClassItemsIter
fn lazy_type_object() -> &'static LazyTypeObject<Self>
fn dict_offset() -> Option<isize>
fn weaklist_offset() -> Option<isize>
Source§impl PyClassNewTextSignature<VersionedTransaction> for PyClassImplCollector<VersionedTransaction>
impl PyClassNewTextSignature<VersionedTransaction> for PyClassImplCollector<VersionedTransaction>
fn new_text_signature(self) -> Option<&'static str>
Source§impl PyFromBytesBincode<'_> for VersionedTransaction
impl PyFromBytesBincode<'_> for VersionedTransaction
Source§impl PyFromBytesGeneral for VersionedTransaction
impl PyFromBytesGeneral for VersionedTransaction
fn py_from_bytes_general(raw: &[u8]) -> PyResult<Self>
Source§impl<'a, 'py> PyFunctionArgument<'a, 'py> for &'a VersionedTransaction
impl<'a, 'py> PyFunctionArgument<'a, 'py> for &'a VersionedTransaction
Source§impl<'a, 'py> PyFunctionArgument<'a, 'py> for &'a mut VersionedTransaction
impl<'a, 'py> PyFunctionArgument<'a, 'py> for &'a mut VersionedTransaction
Source§impl PyMethods<VersionedTransaction> for PyClassImplCollector<VersionedTransaction>
impl PyMethods<VersionedTransaction> for PyClassImplCollector<VersionedTransaction>
fn py_methods(self) -> &'static PyClassItems
Source§impl PyTypeInfo for VersionedTransaction
impl PyTypeInfo for VersionedTransaction
Source§type AsRefTarget = PyCell<VersionedTransaction>
type AsRefTarget = PyCell<VersionedTransaction>
Source§fn type_object_raw(py: Python<'_>) -> *mut PyTypeObject
fn type_object_raw(py: Python<'_>) -> *mut PyTypeObject
Source§fn type_object(py: Python<'_>) -> &PyType
fn type_object(py: Python<'_>) -> &PyType
Source§fn is_type_of(object: &PyAny) -> bool
fn is_type_of(object: &PyAny) -> bool
object
is an instance of this type or a subclass of this type.Source§fn is_exact_type_of(object: &PyAny) -> bool
fn is_exact_type_of(object: &PyAny) -> bool
object
is an instance of this type.Source§impl Serialize for VersionedTransaction
impl Serialize for VersionedTransaction
impl Eq for VersionedTransaction
impl StructuralPartialEq for VersionedTransaction
Auto Trait Implementations§
impl Freeze for VersionedTransaction
impl RefUnwindSafe for VersionedTransaction
impl Send for VersionedTransaction
impl Sync for VersionedTransaction
impl Unpin for VersionedTransaction
impl UnwindSafe for VersionedTransaction
Blanket Implementations§
Source§impl<T> AbiEnumVisitor for T
impl<T> AbiEnumVisitor for T
default fn visit_for_abi( &self, _digester: &mut AbiDigester, ) -> Result<AbiDigester, DigestError>
Source§impl<T> AbiEnumVisitor for T
impl<T> AbiEnumVisitor for T
default fn visit_for_abi( &self, digester: &mut AbiDigester, ) -> Result<AbiDigester, DigestError>
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
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<'a, T> FromPyObject<'a> for T
impl<'a, T> FromPyObject<'a> for T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more