Resolve Virtual Address
virtualAddress.resolve
Resolves a virtual address to its master address.
Usage
import { } from './viem.config'
const = await ..({
: '0x0000000000000000000000000000000000000001',
})
.('Recipient:', )
Recipient: 0x0000000000000000000000000000000000000001import { , } from 'viem/tempo'
export const = .({
: .('0x...'),
})Recipes
Screen a Withdrawal Destination
Resolve a customer-supplied withdrawal address, then screen the beneficial owner against your denylist before sending with token.transferSync.
import { } from './viem.config'
const = new (['0x8ba1f109551bd432803012645ac136ddd64dba72'])
const = '0x58e21090fdfdfdfdfdfdfdfdfdfd010203040506'
const = await ..({ : })
if (!) throw new ('destination forwards to an unregistered master')
if (.(.()))
throw new (`beneficial owner ${} is denied`)
const { } = await ..({
: { : '2500' },
: ,
: '0x20c0000000000000000000000000000000000000',
})import { , } from 'viem/tempo'
export const = .({
: .('0x...'),
})Group Ledger Entries by Beneficial Owner
Normalize every counterparty through resolve when reconciling: virtual aliases collapse to their master, and regular addresses pass through unchanged.
import { } from './viem.config'
const = [
'0x58e21090fdfdfdfdfdfdfdfdfdfd010203040506',
'0x58e21090fdfdfdfdfdfdfdfdfdfd010203040507',
'0x742d35Cc6634C0532925a3b844Bc9e7595f0bEbb',
] as
const = await .(
.(() => ..({ })),
)
.()
[ '0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266', '0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266', '0x742d35Cc6634C0532925a3b844Bc9e7595f0bEbb']import { , } from 'viem/tempo'
export const = .({
: .('0x...'),
})Return Value
type ReturnType = Address | nullThe resolved address, or null if virtual and unregistered.
Parameters
address
- Type:
Address
Address to resolve.
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.