Struct solders_instruction::AccountMeta
source · pub struct AccountMeta(/* private fields */);
Expand description
Describes a single account read or written by a program during instruction execution.
When constructing an :class:Instruction
, a list of all accounts that may be
read or written during the execution of that instruction must be supplied.
Any account that may be mutated by the program during execution, either its
data or metadata such as held lamports, must be writable.
Note that because the Solana runtime schedules parallel transaction execution around which accounts are writable, care should be taken that only accounts which actually may be mutated are specified as writable.
Args:
pubkey (Pubkey): An account’s public key.
is_signer (bool): True if an :class:Instruction
requires a :class:~solders.transaction.Transaction
signature matching pubkey
.
is_writable (bool): True if the account data or metadata may be mutated during program execution.
Example: >>> from solders.pubkey import Pubkey >>> from solders.instruction import AccountMeta, Instruction >>> from_pubkey = Pubkey.new_unique() >>> to_pubkey = Pubkey.new_unique() >>> program_id = Pubkey.new_unique() >>> instruction_data = bytes([1]) >>> accs = [AccountMeta(from_pubkey, is_signer=True, is_writable=True), AccountMeta(to_pubkey, is_signer=True, is_writable=True)] >>> instruction = Instruction(program_id, instruction_data, accs)
Implementations§
source§impl AccountMeta
impl AccountMeta
pub fn new(pubkey: &Pubkey, is_signer: bool, is_writable: bool) -> Self
pub fn pubkey(&self) -> Pubkey
pub fn is_signer(&self) -> bool
pub fn is_writable(&self) -> bool
sourcepub fn from_bytes(data: &[u8]) -> PyResult<Self>
pub fn from_bytes(data: &[u8]) -> PyResult<Self>
Deserialize a serialized AccountMeta
object.
Args:
data (bytes): the serialized AccountMeta
.
Returns:
AccountMeta: the deserialized AccountMeta
.
pub fn __hash__(&self) -> u64
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)>
Trait Implementations§
source§impl Clone for AccountMeta
impl Clone for AccountMeta
source§fn clone(&self) -> AccountMeta
fn clone(&self) -> AccountMeta
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl CommonMethods<'_> for AccountMeta
impl CommonMethods<'_> for AccountMeta
fn py_to_json(&self) -> String
fn py_from_json(raw: &'a str) -> Result<Self, PyErr>
source§impl CommonMethodsCore for AccountMeta
impl CommonMethodsCore for AccountMeta
source§impl Debug for AccountMeta
impl Debug for AccountMeta
source§impl<'de> Deserialize<'de> for AccountMeta
impl<'de> Deserialize<'de> for AccountMeta
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 AccountMeta
impl Display for AccountMeta
source§impl From<AccountMeta> for AccountMeta
impl From<AccountMeta> for AccountMeta
source§fn from(original: AccountMetaOriginal) -> AccountMeta
fn from(original: AccountMetaOriginal) -> AccountMeta
source§impl From<AccountMeta> for AccountMeta
impl From<AccountMeta> for AccountMeta
source§fn from(original: AccountMeta) -> Self
fn from(original: AccountMeta) -> Self
source§impl Hash for AccountMeta
impl Hash for AccountMeta
source§impl PartialEq for AccountMeta
impl PartialEq for AccountMeta
source§fn eq(&self, other: &AccountMeta) -> bool
fn eq(&self, other: &AccountMeta) -> bool
self
and other
values to be equal, and is used
by ==
.source§impl PyBytesBincode for AccountMeta
impl PyBytesBincode for AccountMeta
fn pybytes_bincode<'a>(&self, py: Python<'a>) -> &'a PyBytes
source§impl PyBytesGeneral for AccountMeta
impl PyBytesGeneral for AccountMeta
fn pybytes_general<'a>(&self, py: Python<'a>) -> &'a PyBytes
source§impl PyClassImpl for AccountMeta
impl PyClassImpl for AccountMeta
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<AccountMeta>
type Layout = PyCell<AccountMeta>
§type ThreadChecker = ThreadCheckerStub<AccountMeta>
type ThreadChecker = ThreadCheckerStub<AccountMeta>
§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<AccountMeta> for PyClassImplCollector<AccountMeta>
impl PyClassNewTextSignature<AccountMeta> for PyClassImplCollector<AccountMeta>
fn new_text_signature(self) -> Option<&'static str>
source§impl PyFromBytesBincode<'_> for AccountMeta
impl PyFromBytesBincode<'_> for AccountMeta
source§impl PyFromBytesGeneral for AccountMeta
impl PyFromBytesGeneral for AccountMeta
fn py_from_bytes_general(raw: &[u8]) -> PyResult<Self>
source§impl<'a, 'py> PyFunctionArgument<'a, 'py> for &'a AccountMeta
impl<'a, 'py> PyFunctionArgument<'a, 'py> for &'a AccountMeta
source§impl<'a, 'py> PyFunctionArgument<'a, 'py> for &'a mut AccountMeta
impl<'a, 'py> PyFunctionArgument<'a, 'py> for &'a mut AccountMeta
source§impl PyMethods<AccountMeta> for PyClassImplCollector<AccountMeta>
impl PyMethods<AccountMeta> for PyClassImplCollector<AccountMeta>
fn py_methods(self) -> &'static PyClassItems
source§impl PyTypeInfo for AccountMeta
impl PyTypeInfo for AccountMeta
§type AsRefTarget = PyCell<AccountMeta>
type AsRefTarget = PyCell<AccountMeta>
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.