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: VersionedTransaction) -> Self
fn from(original: VersionedTransaction) -> 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 PartialEq for VersionedTransaction
impl PartialEq for VersionedTransaction
source§fn eq(&self, other: &VersionedTransaction) -> bool
fn eq(&self, other: &VersionedTransaction) -> bool
self
and other
values to be equal, and is used
by ==
.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
§type Layout = PyCell<VersionedTransaction>
type Layout = PyCell<VersionedTransaction>
§type ThreadChecker = ThreadCheckerStub<VersionedTransaction>
type ThreadChecker = ThreadCheckerStub<VersionedTransaction>
§type PyClassMutability = <<PyAny as PyClassBaseType>::PyClassMutability as PyClassMutability>::MutableChild
type PyClassMutability = <<PyAny as PyClassBaseType>::PyClassMutability as PyClassMutability>::MutableChild
§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
§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.