Skip to main content

TempoAddressExt

Trait TempoAddressExt 

Source
pub trait TempoAddressExt {
    const TIP20_PREFIX: [u8; 12];
    const VIRTUAL_MAGIC: [u8; 10];

    // Required methods
    fn is_tip20(&self) -> bool;
    fn is_virtual(&self) -> bool;
    fn is_valid_master(&self) -> bool;
    fn decode_virtual(&self) -> Option<(FixedBytes<4>, FixedBytes<6>)>;
    fn new_virtual(master_id: FixedBytes<4>, user_tag: FixedBytes<6>) -> Self;
}
Expand description

Extension trait with helper functions for Tempo addresses.

Required Associated Constants§

Source

const TIP20_PREFIX: [u8; 12]

12-byte prefix shared by all TIP-20 token addresses.

NOTE: prefix alone does not prove a token exists — use TIP20Factory::is_tip20() for that.

Source

const VIRTUAL_MAGIC: [u8; 10]

10-byte magic value occupying bytes [4:14] of every TIP-1022 virtual address.

Required Methods§

Source

fn is_tip20(&self) -> bool

Returns true if the address has the TIP-20 token prefix.

NOTE: This only checks the prefix, not whether the token was actually created. Use TIP20Factory::is_tip20() for full validation.

Source

fn is_virtual(&self) -> bool

Returns true if the address matches the TIP-1022 virtual-address format (bytes [4:14] == Self::VIRTUAL_MAGIC).

Source

fn is_valid_master(&self) -> bool

Returns true if the address is eligible to be a virtual-address master per TIP-1022.

Source

fn decode_virtual(&self) -> Option<(FixedBytes<4>, FixedBytes<6>)>

Decodes a virtual address into its (masterId, userTag) components.

Returns None if the address does not match the virtual-address format.

Source

fn new_virtual(master_id: FixedBytes<4>, user_tag: FixedBytes<6>) -> Self

Builds a TIP-1022 virtual address from a masterId and userTag.

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.

Implementations on Foreign Types§

Source§

impl TempoAddressExt for Address

Source§

const TIP20_PREFIX: [u8; 12] = TIP20_TOKEN_PREFIX

Source§

const VIRTUAL_MAGIC: [u8; 10]

Source§

fn is_tip20(&self) -> bool

Source§

fn is_virtual(&self) -> bool

Source§

fn is_valid_master(&self) -> bool

Source§

fn decode_virtual(&self) -> Option<(FixedBytes<4>, FixedBytes<6>)>

Source§

fn new_virtual(master_id: FixedBytes<4>, user_tag: FixedBytes<6>) -> Address

Implementors§