Querying
Use the SuinsClient
that was previously created to query on-chain data.
Querying a NameRecord
You can query a name record's latest state by calling the getNameRecord
method on the SuinsClient
instance.
const nameRecord = await suinsClient.getNameRecord('demo.sui');
console.log(nameRecord);
// Example output
// {
// name: 'demo.sui',
// nftId: '0xMyNftId',
// targetAddress: '0xTargetAddress',
// expirationTimestampMs: '1746018571863',
// data: {
// avatar: '0xAvatarObjectId',
// contentHash: 'content',
// walrusSiteId: '0xWalrusSiteId',
// },
// avatar: '0xAvatarObjectId',
// contentHash: 'content',
// walrusSiteId: '0xWalrusSiteId',
// }
Query active pricing
Call the getPricelist
method on the SuinsClient
instance to query the active names price list.
const priceList = await suinsClient.getPriceList();
console.log(priceList);
// ([domain_length_from, domain_length_to]: price. Prices are in USDC MIST; 1 USDC = 1_000_000 MIST)
// Example output:
// {
// [ 3, 3 ] => 500000000,
// [ 4, 4 ] => 100000000,
// [ 5, 63 ] => 20000000
// }
Query active renewals pricing
Call the getRenewalPricelist
method on the SuinsClient
instance to query the active renewals price list.
const renewalPriceList = await suinsClient.getRenewalPricelist();
console.log(renewalPriceList);
// ([domain_length_from, domain_length_to]: price. Prices are in USDC MIST; 1 USDC = 1_000_000 MIST)
// Example output:
// {
// [ 3, 3 ] => 500000000,
// [ 4, 4 ] => 100000000,
// [ 5, 63 ] => 20000000
// }