> For the complete documentation index, see [llms.txt](https://docs.sns.id/dev/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.sns.id/dev/sns-sdk/quick-start-integration.md).

# Quick Start - Integration

Quickly integrate SNS domains into your dApps to build a more personalized, and secure user experience. The methods below can be used to integrate the most popular SNS functionalities. \
\
1.) **Resolve domains** - As outlined in our [resolve](/dev/sns-sdk/editor.md) section, resolution allows a user entered .sol domain to resolve to its corresponding wallet address. Use this for functionality like transfers, tracking, sharing, etc.&#x20;

{% tabs %}
{% tab title="web3.js v1" %}

```typescript
import { resolve } from "@bonfida/spl-name-service";

const domain = "sns.sol" // With or without .sol

// The config argument to resolve is optional
// If allowPDA is true, a list of program IDs is required
const resolveConfig = { allowPda: true, programIds: ["..."] }

const resolvedAddress = await resolve(connection, domain, resolveConfig)
```

{% endtab %}

{% tab title="web3.js v2 (@solana/kit)" %}

<pre class="language-typescript"><code class="lang-typescript"><strong>import { resolveDomain } from "@solana-name-service/sns-sdk-kit";
</strong>
const domain = "sns.sol" // With or without .sol

// The options argument is not required to be passed
// If allowPDA is true, a list of program IDs is required.
const resolveOptions = { allowPda: true, programIds: ["..."] }

const resolvedAddress = await resolveDomain({ rpc, domain, options:resolveOptions });
</code></pre>

{% endtab %}
{% endtabs %}

2.) **Primary domains** - In identity elements of your dApp, we always recommend that you use primary domains as outlined in our [primary domains](/dev/sns-sdk/integrations.md) section. Primary domains are specifically set by users are their preferred on chain identity.&#x20;

{% tabs %}
{% tab title="web3.js v1" %}

```typescript
import { getPrimaryDomain } from "@bonfida/spl-name-service";

const { domain, reverse } = await getPrimaryDomain(connection, domainOwnerPublicKey);
```

{% endtab %}

{% tab title="web3.js v2 (@solana/kit)" %}

<pre class="language-typescript"><code class="lang-typescript">import { getPrimaryDomain } from "@solana-name-service/sns-sdk-kit";
import { Address } from "@solana/kit";

const userWallet = "36Dn3RWhB8x4c83W6ebQ2C2eH9sh5bQX2nMdkP2cWaA4" as Address

const { 
  domainAddress, // Address of domain account, not the user wallet address
<strong>  domainName: primaryDomain, 
</strong>  stale: isPrimaryDomainStale 
} = await getPrimaryDomain({ rpc, walletAddress:userWallet });
</code></pre>

{% endtab %}
{% endtabs %}

3.) **Domain records** - Domain records can be used as a powerful tool in social graphing and bridging a traditional social presence to Web3 identities. Records are feature rich, and the methods below are a quick integration guide, a full breakdown can be found in the [records](/dev/domain-records.md) section.&#x20;

{% tabs %}
{% tab title="web3.js v1" %}

```typescript
import { Record, getMultipleRecordsV2, verifyStaleness } from "@bonfida/spl-name-service";

const domain = "sns.sol"

const recordsToFetch = [Record.Discord, Record.Twitter, Record.Telegram];

const recordOptions = { deserialize: true };

const domainRecords = getMultipleRecordsV2(
  connection,
  domain,
  recordsToFetch,
  recordOptions,
 );

// This example arbitrarily selects the first record of the list
// In practice you should filter based on your needs
const isFreshRecord = await verifyStaleness(connection, domainRecords[0], domain);
```

{% endtab %}

{% tab title="web3.js v2 (@solana/kit)" %}

```typescript
import {
  Record,
  getDomainRecords,
} from "@solana-name-service/sns-sdk-kit";

const domain = "sns.sol"

const recordsToFetch = [Record.Discord, Record.Twitter, Record.Telegram];

// Optionally chose to deserialize the returned content
// Optionally pass verifiers to use custom oracle during right of association verification
const recordOptions = { deserialize: true, verifiers: undefined }; 

const domainRecords = getRecords({
  rpc,
  domain,
  records: recordsToFetch,
  options: recordOptions,
 });
 
// This example arbitrarily selects the first record of the list 
// In practice you should filter based on your needs
const recordToCheck = domainRecords[0];

const recordContent = recordToCheck.deserializedContent;
const isRecordVerified = recordToCheck.verification.roa;
const isRecordStale = recordToCheck.verification.staleness;
```

{% endtab %}
{% endtabs %}
