Skip to main content

TempoAddressExt

Trait TempoAddressExt 

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§

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.

const VIRTUAL_MAGIC: [u8; 10]

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

Required Methods§

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.

fn is_virtual(&self) -> bool

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

fn is_valid_master(&self) -> bool

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

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.

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".

Implementations on Foreign Types§

§

impl TempoAddressExt for Address

§

const TIP20_PREFIX: [u8; 12] = TIP20_TOKEN_PREFIX

§

const VIRTUAL_MAGIC: [u8; 10]

§

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>) -> Address

Implementors§