common_primitives::signatures

Trait AccountAddressMapper

Source
pub trait AccountAddressMapper<AccountId> {
    // Required methods
    fn to_account_id(public_key_or_address: &[u8]) -> AccountId;
    fn to_bytes32(public_key_or_address: &[u8]) -> [u8; 32];
    fn to_ethereum_address(account_id: AccountId) -> H160;
    fn is_ethereum_address(account_id: &AccountId) -> bool;
}
Expand description

A trait that allows mapping of raw bytes to AccountIds

Required Methods§

Source

fn to_account_id(public_key_or_address: &[u8]) -> AccountId

mapping to the desired address

Source

fn to_bytes32(public_key_or_address: &[u8]) -> [u8; 32]

mapping to bytes of a public key or an address

Source

fn to_ethereum_address(account_id: AccountId) -> H160

reverses an accountId to it’s 20 byte ethereum address

Source

fn is_ethereum_address(account_id: &AccountId) -> bool

returns whether account_id converts to a valid Ethereum address

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§