# VirtualAddress

TIP-1022 virtual address encoding and parsing utilities.

[TIP-1022](https://docs.tempo.xyz/protocol/tips/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

```ts twoslash
import { 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
})
```

## Functions

| Name                | Description                         |
| ------------------- | ----------------------------------- |
| [`VirtualAddress.from`](/tempo/reference/VirtualAddress/from) | Builds a TIP-1022 virtual address from a `masterId` and `userTag`. |
| [`VirtualAddress.isVirtual`](/tempo/reference/VirtualAddress/isVirtual) | Checks whether an address matches the TIP-1022 virtual address format. |
| [`VirtualAddress.parse`](/tempo/reference/VirtualAddress/parse) | Parses a TIP-1022 virtual address into its `masterId` and `userTag` parts. |
| [`VirtualAddress.validate`](/tempo/reference/VirtualAddress/validate) | Validates that an address matches the TIP-1022 virtual address format. |

## Errors

| Name                | Description                         |
| ------------------- | ----------------------------------- |
| [`VirtualAddress.InvalidMagicError`](/tempo/reference/VirtualAddress/errors#virtualaddressinvalidmagicerror) | Thrown when an address does not contain the TIP-1022 virtual marker. |

## Types

| Name                | Description                         |
| ------------------- | ----------------------------------- |
| [`VirtualAddress.Part`](/tempo/reference/VirtualAddress/types#virtualaddresspart) | A fixed-width virtual address component. |
