VirtualAddress
TIP-1022 virtual address encoding and parsing utilities.
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 formatFunctions
| Name | Description |
|---|---|
VirtualAddress.from | Builds a TIP-1022 virtual address from a masterId and userTag. |
VirtualAddress.isVirtual | Checks whether an address matches the TIP-1022 virtual address format. |
VirtualAddress.parse | Parses a TIP-1022 virtual address into its masterId and userTag parts. |
VirtualAddress.validate | Validates that an address matches the TIP-1022 virtual address format. |
Errors
| Name | Description |
|---|---|
VirtualAddress.InvalidMagicError | Thrown when an address does not contain the TIP-1022 virtual marker. |
Types
| Name | Description |
|---|---|
VirtualAddress.Part | A fixed-width virtual address component. |

