> For the complete documentation index, see [llms.txt](https://docs.carv.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.carv.io/carv-ecosystem/carv-play/carv-intro/.play-name-service-integration.md).

# .Play Name Service Integration

### Overview

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

#### Install

```Python
npm install @carv-protocol/pns-js
```

#### Set up

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

#### Forward Resolution

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

```Python
  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.

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


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.carv.io/carv-ecosystem/carv-play/carv-intro/.play-name-service-integration.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
