pub struct AccountId {
pub shard: u64,
pub realm: u64,
pub num: u64,
pub alias: Option<PublicKey>,
pub evm_address: Option<EvmAddress>,
pub checksum: Option<Checksum>,
}
Expand description
A unique identifier for a cryptocurrency account on Hedera.
Fields§
§shard: u64
A non-negative number identifying the shard containing this account.
realm: u64
A non-negative number identifying the realm within the shard containing this account.
num: u64
A non-negative number identifying the entity within the realm containing this account.
alias: Option<PublicKey>
An alias for num
if the account was created from a public key directly.
evm_address: Option<EvmAddress>
The last 20 bytes of the keccak-256 hash of a ECDSA_SECP256K1 primitive key.
checksum: Option<Checksum>
A checksum if the account ID was read from a user inputted string which inclueded a checksum
Implementations§
source§impl AccountId
impl AccountId
sourcepub fn from_bytes(bytes: &[u8]) -> Result<Self>
pub fn from_bytes(bytes: &[u8]) -> Result<Self>
Create a new AccountId
from protobuf-encoded bytes
.
§Errors
Error::FromProtobuf
if decoding the bytes fails to produce a valid protobuf.Error::FromProtobuf
if decoding the protobuf fails.
sourcepub fn from_solidity_address(address: &str) -> Result<Self>
pub fn from_solidity_address(address: &str) -> Result<Self>
Create an AccountId
from a solidity address.
§Errors
Error::BasicParse
ifaddress
cannot be parsed as a solidity address.
sourcepub fn from_evm_address(address: &EvmAddress) -> Self
pub fn from_evm_address(address: &EvmAddress) -> Self
Create an AccountId
from an evm address.
Accepts “0x___” Ethereum public address.
sourcepub fn to_solidity_address(&self) -> Result<String>
pub fn to_solidity_address(&self) -> Result<String>
Convert self
into a solidity address
.
§Errors
Error::BasicParse
ifself.shard
is larger thanu32::MAX
.
sourcepub fn to_string_with_checksum(&self, client: &Client) -> Result<String, Error>
pub fn to_string_with_checksum(&self, client: &Client) -> Result<String, Error>
Convert self
to a string with a valid checksum.
§Errors
Error::CannotCreateChecksum
if self has analias
orevm_address
.
sourcepub fn validate_checksum(&self, client: &Client) -> Result<()>
pub fn validate_checksum(&self, client: &Client) -> Result<()>
Validates self.checksum
(if it exists) for client
.
§Errors
Error::BadEntityId
if there is a checksum, and the checksum is not valid for the client’sledger_id
.
Trait Implementations§
source§impl PartialEq for AccountId
impl PartialEq for AccountId
impl Copy for AccountId
impl Eq for AccountId
impl StructuralPartialEq for AccountId
Auto Trait Implementations§
impl Freeze for AccountId
impl RefUnwindSafe for AccountId
impl Send for AccountId
impl Sync for AccountId
impl Unpin for AccountId
impl UnwindSafe for AccountId
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
source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.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> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T
in a tonic::Request