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 byte array.

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.

Returns the underlying byte array of the account identifier. Usually the public key of the account.

Trait Implementations

Performs the conversion.

Performs the conversion.

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Attempt to deserialise the value from input.

Attempt to skip the encoded value from input. Read more

Returns the fixed encoded size of the type. Read more

Returns the “default value” for a type. Read more

Convert self to a slice and then invoke the given closure with it.

If possible give a hint of expected size of the encoding. Read more

Convert self to a slice and append it to the destination.

Convert self to an owned vector.

Calculates the encoded size. Read more

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

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

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Decode Self and consume all of the given input data. Read more

Decode Self and consume all of the given input data. Read more

Decode Self with the given maximum recursion depth. Read more

Performs the conversion.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Performs the conversion.

Get a reference to the inner from the outer.

Get a mutable reference to the inner from the outer.

Return an encoding of Self prepended by given slice.

Should always be Self

Encode the hex strict representing self into the result. Lower case letters are used (e.g. f9b4ca) Read more

Encode the hex strict representing self into the result. Upper case letters are used (e.g. F9B4CA) Read more

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The counterpart to unchecked_from.