# Registration

### SNS Widget

Easily integrate SNS domain registrations into your applications using our SNS Widget React Component. See a default usage example below. You can also customize the widget to fit your unique needs. More information is available at the link below -

* <https://github.com/Bonfida/sns-widget>

```typescript
import Widget from "@bonfida/sns-widget";
// Apart from the component itself, you also need to import styles separately
import "@bonfida/sns-widget/style.css";

// Link to public RPC for Solana connection. Solana provides free public RPCs
// with rate limiters, so you might want to use your own RPC Node provider
const PUBLIC_RPC = "https://api.mainnet-beta.solana.com";

export const Component = () => {
  return <Widget endpoint={PUBLIC_RPC} />;
};
```

### SNS Widget Walkthrough

The video walk through below details integration using the SNS Widget.&#x20;

{% embed url="<https://youtu.be/ZlBZjNUvuxc?feature=shared>" %}

### Register Domain Name

If you opt not to use our out of the box SNS Widget React component, the `registerDomainNameV2`function can be used instead.&#x20;

The last 2 arguments to the function are optional in both  the web.js v1 and v2 (@solana/kit) versions. The fifth argument is the token mint to purchase the domain, which defaults to USDC. The sixth argument is the referrers key. If you've been approved as a registration referrer, add the approved public key as the last argument.

If you'd like to integrate registrations into your dApp and would like to discuss becoming a referrer, please reach out to the SNS team via [Discord](http://discord.sns.id) or [Twitter](https://x.com/sns).&#x20;

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

```typescript
import { registerDomainNameV2, USDC_MINT } from "@bonfida/spl-name-service";

const name = "sns"; // We want to register sns.sol
const space = 0; // Default to 0 (Max 10kb)

const buyer = new PublicKey("..."); // Publickey of the buyer
const buyerTokenAccount = new PublicKey("..."); // Publickey of the token account of the buyer (USDC)
const refKey = new PublicKey("...") // If approved as a registration referrer, add your referral key

const ix = await registerDomainNameV2(
connection,
name, 
space, 
buyer, 
buyerTokenAccount, 
USDC_MINT, 
refKey
);

// sign and send the instruction
```

{% endtab %}

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

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

const domain = "sns"; // We want to register sns.sol
const space = 0; // Default to 0 (Max 10kb)

const buyer = new PublicKey("..."); // Publickey of the buyer
const buyerTokenAccount = new PublicKey("..."); // Publickey of the token account of the buyer (USDC)
const refKey = new PublicKey("...") // If approved as a registration referrer, add your referral key

const ix = await registerDomain({
rpc, 
domain,
space,
buyer,
buyerTokenAccount,
});
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions: 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.sns.id/dev/sns-sdk/registration.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.
