> 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/registration.md).

# 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 %}
