.Play Name Service Integration


This guide provides instructions for integrating the .Play Name Service (PNS) into your application using our JavaScript SDK. It allows your app to resolve domain names to Ethereum Virtual Machine (EVM) wallet addresses and to retrieve domain names associated with a user's EVM wallet address.

Use Cases

In any scenario where a user would normally encounter an EVM wallet address, your application can now present a more user-friendly PNS name. This integration primarily enhances your app in two ways:

  1. Displaying PNS Names Instead of EVM Wallet Addresses: In the user interface of your application, replace the raw display of EVM wallet addresses with corresponding PNS names. This substitution can occur wherever an address typically appears, making the interface more intuitive and user-friendly.

  2. Enabling PNS Name Entry in Input Fields: Modify input fields that traditionally require an EVM wallet address, allowing users to input PNS names instead. This feature simplifies user interactions, particularly in situations where memorizing or copying lengthy EVM wallet addresses can be cumbersome.

Getting Started


npm install @carv-protocol/pns-js

Set up

import { getNames, getAddress} from '@carv-protocol/pns-js'

Forward Resolution

You can get address from domain name using the following method.

  const testDomain = "carv-engineer.play"
  const address = await getAddress(testDomain);

Reverse Resolution

You can get a list of domain names associated with an address. Note that the 'Primary Domain' feature is not yet released where a user can choose one domain name (from multiple) an address resolves to. This method will simply return all the associated domain names in ascending order by length.

const testAddress = "0x25dC11C90349024C083e34f3f749ffAb7AEd0e48";
const names = await getNames(testAddress);

Last updated