# Quick Start (SDK)

The Somnia SDK lets you resolve `.som` names using just one function. It works anywhere you can use TypeScript or JavaScript.

***

### 📁 1. Copy the SDK file

Add this file to your project:

```typescript
lib/sds.ts
```

#### sds.ts content:

```typescript
import { ethers } from "ethers";

const RPC_URL = "https://dream-rpc.somnia.network";
const CONTRACT_ADDRESS = "0xDB4e0A5E7b0d03aA41cBB7940c5e9Bab06cc7157";
const CONTRACT_ABI = [
  {
    inputs: [{ internalType: "address", name: "owner", type: "address" }],
    name: "reverseLookup",
    outputs: [{ internalType: "string", name: "", type: "string" }],
    stateMutability: "view",
    type: "function"
  }
];

const provider = new ethers.JsonRpcProvider(RPC_URL);
const contract = new ethers.Contract(CONTRACT_ADDRESS, CONTRACT_ABI, provider);

export async function getPrimarySomName(walletAddress: string): Promise<string | null> {
  try {
    const name = await contract.reverseLookup(walletAddress);
    return name;
  } catch (err) {
    console.error("Somnia name lookup failed:", err);
    return null;
  }
}
```

### 💻 2. Usage

Anywhere in your app:

```typescript
import { getPrimarySomName } from "./lib/sds";

const somniaName = await getPrimarySomName("0x1234...abcd"); // Or the string wallet address variable of the wallet API you are using 
console.log(somniaName); // "test.som" or null
```

### 🔄 Use Case

Display `.som` names instead of addresses:

```typescript
const label = somniaName || walletAddress;
```
