Get Virtual Master Address
virtualAddress.getMasterAddress
Gets the master address for a virtual-address master ID.
Usage
import { } from './viem.config'
const = await ..({
: '0xdeadbeef',
})
.('Address:', )
Address: 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266import { , } from 'viem/tempo'
export const = .({
: .('0x...'),
})Recipes
Guard Deposit Address Issuance
Confirm a master ID still resolves to a registered master before deriving per-customer deposit addresses from it with VirtualAddress.from.
import { } from 'viem/tempo'
import { } from './viem.config'
const = '0x58e21090' // from your deployment records
const = await ..({ })
if (!) throw new (`master ID ${} is not registered`)
const = .({ , : 4821n })
.('Deposit address for customer 4821:', )
Deposit address for customer 4821: 0x58e21090fdfdfdfdfdfdfdfdfdfd0000000012d5import { , } from 'viem/tempo'
export const = .({
: .('0x...'),
})Return Value
type ReturnType = Address | nullThe master address, or null if unregistered.
Parameters
masterId
- Type:
Hex
Master ID bytes.
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.