[][src]Trait sp_runtime::traits::AccountIdConversion

pub trait AccountIdConversion<AccountId>: Sized {
    pub fn into_sub_account<S: Encode>(&self, sub: S) -> AccountId;
pub fn try_from_sub_account<S: Decode>(x: &AccountId) -> Option<(Self, S)>; pub fn into_account(&self) -> AccountId { ... }
pub fn try_from_account(a: &AccountId) -> Option<Self> { ... } }

This type can be converted into and possibly from an AccountId (which itself is generic).

Required methods

pub fn into_sub_account<S: Encode>(&self, sub: S) -> AccountId[src]

Convert this value amalgamated with the a secondary "sub" value into an account ID. This is infallible.

NOTE: The account IDs from this and from into_account are not guaranteed to be distinct for any given value of self, nor are different invocations to this with different types T. For example, the following will all encode to the same account ID value:

  • self.into_sub_account(0u32)
  • self.into_sub_account(vec![0u8; 0])
  • self.into_account()

pub fn try_from_sub_account<S: Decode>(x: &AccountId) -> Option<(Self, S)>[src]

Try to convert an account ID into this type. Might not succeed.

Loading content...

Provided methods

pub fn into_account(&self) -> AccountId[src]

Convert into an account ID. This is infallible.

pub fn try_from_account(a: &AccountId) -> Option<Self>[src]

Try to convert an account ID into this type. Might not succeed.

Loading content...

Implementors

impl<T: Encode + Decode + Default, Id: Encode + Decode + TypeId> AccountIdConversion<T> for Id[src]

Format is TYPE_ID ++ encode(parachain ID) ++ 00.... where 00... is indefinite trailing zeroes to fill AccountId.

Loading content...