Struct gekko::common::AccountId [−][src]
pub struct AccountId(_);
Expand description
An opaque 32-byte identifier of an on-chain account.
Usually contains the public key (or its hash in case of ECDSA). This is a
simpler implementation of Substrates
AccountId32
with some convenience methods
(which can be used instead, if desired). It also implements the necessary
encode/decode functionality to make it suitable to be used in transactions
without having to wrap it in MultiAddress
.
Note: This type should only be used to encode transactions, not decode
those. Officially, Kusama and Polkadot support multiple account
identifiers and MultiAddress
should therefore be used for decoding.
use gekko::common::{*, sp_core::crypto::AccountId32}; let account_id = AccountId::from_ss58_address("D12RroVkrWavttGJ1g3iHNmDa68kyMsSeXvoZ1xPm8828kk") .unwrap(); // Convert this type into Substrates `AccountId32` let sub: AccountId32 = account_id.into(); // Convert it back into the native type. let account_id: AccountId = sub.into();
Implementations
Creates a new account identifier from a SS58 encoded string.
Example
use gekko::common::*; let account_id = AccountId::from_ss58_address("D12RroVkrWavttGJ1g3iHNmDa68kyMsSeXvoZ1xPm8828kk") .unwrap();
Creates a new account identifier from a SS58 encoded string and returns the identified SS58 Address format.
Example
use gekko::common::*; use gekko::common::sp_core::crypto::Ss58AddressFormat; let (account_id, version) = AccountId::from_ss58_address_with_version("D12RroVkrWavttGJ1g3iHNmDa68kyMsSeXvoZ1xPm8828kk") .unwrap(); assert_eq!(version, Ss58AddressFormat::KusamaAccount);
Returns the SS58 encoded representation of the account identifiers, based on the specified format.
Trait Implementations
Performs the conversion.
Performs the conversion.
A format filterer, can be used to ensure that from_ss58check
family only decode for
allowed identifiers. By default just refuses the two reserved identifiers. Read more
Some if the string is a properly encoded SS58Check address.
Some if the string is a properly encoded SS58Check address.
Some if the string is a properly encoded SS58Check address, optionally with a derivation path following. Read more
Return the ss58-check string for this key.
Return the ss58-check string for this key.
Some if the string is a properly encoded SS58Check address, optionally with a derivation path following. Read more
Auto Trait Implementations
impl RefUnwindSafe for AccountId
impl UnwindSafe for AccountId
Blanket Implementations
pub fn as_byte_slice(&self) -> &[u8]
pub fn as_mut_byte_slice(&mut self) -> &mut [u8]
pub fn as_mut_slice_of<T>(&mut self) -> Result<&mut [T], Error> where
T: FromByteSlice,
pub fn as_slice_of<T>(&self) -> Result<&[T], Error> where
T: FromByteSlice,
Mutably borrows from an owned value. Read more
Instruments this type with the provided Span
, returning an
Instrumented
wrapper. Read more
type Output = T
type Output = T
Should always be Self
The counterpart to unchecked_from
.