pub struct NEP6Account {
pub address: Address,
pub label: Option<String>,
pub is_default: bool,
pub lock: bool,
pub key: Option<String>,
pub contract: Option<NEP6Contract>,
pub extra: Option<HashMap<String, String>>,
}Expand description
Represents an account in the NEP-6 format.
Fields§
§address: AddressThe address of the account.
label: Option<String>An optional label for the account.
is_default: boolIndicates whether the account is set as default.
lock: boolIndicates whether the account is locked.
key: Option<String>An optional private key associated with the account.
contract: Option<NEP6Contract>An optional NEP-6 contract associated with the account.
extra: Option<HashMap<String, String>>An optional additional data associated with the account.
Implementations§
Source§impl NEP6Account
impl NEP6Account
Sourcepub fn is_default(&self) -> &bool
pub fn is_default(&self) -> &bool
Indicates whether the account is set as default.
Sourcepub fn contract(&self) -> &Option<NEP6Contract>
pub fn contract(&self) -> &Option<NEP6Contract>
An optional NEP-6 contract associated with the account.
Source§impl NEP6Account
impl NEP6Account
Sourcepub fn new(
address: Address,
label: Option<String>,
is_default: bool,
lock: bool,
key: Option<String>,
contract: Option<NEP6Contract>,
extra: Option<HashMap<String, String>>,
) -> Self
pub fn new( address: Address, label: Option<String>, is_default: bool, lock: bool, key: Option<String>, contract: Option<NEP6Contract>, extra: Option<HashMap<String, String>>, ) -> Self
Creates a new NEP-6 account with the given parameters.
§Arguments
address- The address of the account.label- An optional label for the account.is_default- Indicates whether the account is set as default.lock- Indicates whether the account is locked.key- An optional private key associated with the account.contract- An optional NEP-6 contract associated with the account.extra- An optional additional data associated with the account.
§Example
use std::collections::HashMap;
use neo3::prelude::*;
let address = "example_address".to_string();
let label = Some("My Account".to_string());
let is_default = true;
let lock = false;
let key = Some("example_private_key".to_string());
let contract = None; // NEP6Contract::new() is not directly available
let extra = Some(HashMap::new());
let account = wallets::NEP6Account::new(address, label, is_default, lock, key, contract, extra);Sourcepub fn from_account(account: &Account) -> Result<NEP6Account, WalletError>
pub fn from_account(account: &Account) -> Result<NEP6Account, WalletError>
Converts an Account into a NEP6Account.
§Arguments
account- The account to convert.
§Errors
Returns a WalletError if there is an issue converting the account.
§Example
use neo3::prelude::*;
use neo3::neo_protocol::AccountTrait;
let account = protocol::Account::create().unwrap();
let nep6_account = wallets::NEP6Account::from_account(&account);Sourcepub fn to_account(&self) -> Result<Account, WalletError>
pub fn to_account(&self) -> Result<Account, WalletError>
Trait Implementations§
Source§impl Clone for NEP6Account
impl Clone for NEP6Account
Source§fn clone(&self) -> NEP6Account
fn clone(&self) -> NEP6Account
Returns a copy 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 NEP6Account
impl Debug for NEP6Account
Source§impl<'de> Deserialize<'de> for NEP6Account
impl<'de> Deserialize<'de> for NEP6Account
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>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl PartialEq for NEP6Account
impl PartialEq for NEP6Account
Source§fn eq(&self, other: &Self) -> bool
fn eq(&self, other: &Self) -> bool
Checks if two NEP6Account instances are equal based on their addresses.
§Example
use neo3::prelude::*;
let account1 = wallets::NEP6Account::new(String::new(), None, false, false, None, None, None);
let account2 = wallets::NEP6Account::new(String::new(), None, false, false, None, None, None);
assert_eq!(account1, account2);Auto Trait Implementations§
impl Freeze for NEP6Account
impl RefUnwindSafe for NEP6Account
impl Send for NEP6Account
impl Sync for NEP6Account
impl Unpin for NEP6Account
impl UnwindSafe for NEP6Account
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,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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>
Converts
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>
Converts
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