Skip to content
LogoLogo

virtualAddress.resolve

Resolves an address to its effective recipient. Learn more about virtual addresses

  • Non-virtual addresses are returned unchanged.
  • Virtual addresses with a registered master return the master address.
  • Virtual addresses with an unregistered master return null.

Usage

import { client } from './viem.config'
 
const recipient = await client.virtualAddress.resolve({
  address: '0x58e21090fdfdfdfdfdfdfdfdfdfd010203040506',
})
 
console.log('Resolved to:', recipient)
Resolved to: 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266

Return Type

type ReturnType = Address | null

Returns null if the address is virtual and the master ID is not registered. Returns the address unchanged if it is not a virtual address.

Parameters

address

  • Type: Address

The address to resolve. Can be a regular address or a TIP-1022 virtual address.

blockNumber (optional)

  • Type: bigint

Block number to read the state from.

blockOverrides (optional)

  • Type: BlockOverrides

Block overrides to apply to the state.

blockTag (optional)

  • Type: BlockTag

Block tag to read the state from.

stateOverride (optional)

  • Type: StateOverride

State override to apply.