Developer Guide
@vechain/sdk

@vechain/sdk-network

The VeChain SDK contains utility functions to lookup names and addresses provided by vnsUtils.

Resolve Names to Addresses

import { ThorClient, vnsUtils } from '@vechain/sdk-network';
const thor = ThorClient.fromUrl('https://mainnet.vechain.org');
 
// single name
console.log('resolveName', await vnsUtils.resolveName(thor, 'hello.vet'));
 
// multiple names in one request
console.log('resolveNames', await vnsUtils.resolveNames(thor, ['hello.vet']));

Get Primary Names for Addresses

import { ThorClient, vnsUtils } from '@vechain/sdk-network';
const thor = ThorClient.fromUrl('https://mainnet.vechain.org');
 
// single address
console.log(
  'lookupAddress',
  await vnsUtils.lookupAddress(
    thor,
    '0x981ebf8F1F98465F93fd0208a0b5e531DdC37815'
  )
);
 
// multiple addreses in one request
console.log(
  'lookupAddresses',
  await vnsUtils.lookupAddresses(thor, [
    '0x981ebf8F1F98465F93fd0208a0b5e531DdC37815',
  ])
);