Skip to content

VirtualAddress

TIP-1022 virtual address encoding and parsing utilities.

TIP-1022

Virtual addresses reserve the following 20-byte layout: [4-byte masterId][10-byte VIRTUAL_MAGIC][6-byte userTag]. These helpers only operate on the reserved byte layout and do not query onchain registration state.

Examples

import { TempoAddress, VirtualAddress } from 'ox/tempo'
 
const masterId = '0x58e21090' // derived when the master registers
const userTag = '0x010203040506' // operator-defined deposit identifier
 
const address = VirtualAddress.from({
  masterId,
  userTag,
})
 
const tempoAddress = TempoAddress.format(address) // optional display format

Functions

NameDescription
VirtualAddress.fromBuilds a TIP-1022 virtual address from a masterId and userTag.
VirtualAddress.isVirtualChecks whether an address matches the TIP-1022 virtual address format.
VirtualAddress.parseParses a TIP-1022 virtual address into its masterId and userTag parts.
VirtualAddress.validateValidates that an address matches the TIP-1022 virtual address format.

Errors

NameDescription
VirtualAddress.InvalidMagicErrorThrown when an address does not contain the TIP-1022 virtual marker.

Types

NameDescription
VirtualAddress.PartA fixed-width virtual address component.