> For the complete documentation index, see [llms.txt](https://docs.metanames.app/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.metanames.app/developers/getting-started.md).

# Getting started

Integrate Meta Names into your application

For the full API surface, check out the [auto-generated documentation](https://metanames.github.io/sdk/).

### Installation

To use the Meta Names SDK in your project, install it via npm or yarn:

```
npm install @metanames/sdk
# or
yarn add @metanames/sdk
```

### Usage

Import the SDK and create an instance:

```typescript
import { MetaNamesSdk, Enviroment } from '@metanames/sdk'

const metaNamesSdk = new MetaNamesSdk(Enviroment.mainnet)
```

{% hint style="warning" %}
The constructor defaults to **testnet** when no environment is passed. Pass `Enviroment.mainnet` explicitly to work against production domains.

`Enviroment` is spelled without the second `n` in the SDK. This is intentional in the current release.
{% endhint %}

### Signing transactions

Read operations such as `find` and `calculateMintFees` work straight away. Any operation that writes to the blockchain — registering, renewing, transferring, or changing records — requires a signing strategy to be set first, otherwise the transaction cannot be submitted.

```typescript
import PartisiaSdk from 'partisia-blockchain-applications-sdk'
import type { PermissionTypes } from 'partisia-blockchain-applications-sdk/lib/sdk-listeners'

const client = new PartisiaSdk()
await client.connect({
  permissions: ['sign'] as PermissionTypes[],
  dappName: 'My application',
  chainId: 'Partisia Blockchain', // 'Partisia Blockchain Testnet' on testnet
})

metaNamesSdk.setSigningStrategy('partisiaSdk', client)
```

The following strategies are supported:

| Strategy      | Value to pass                                      |
| ------------- | -------------------------------------------------- |
| `partisiaSdk` | A connected `PartisiaSdk` client                   |
| `MetaMask`    | The injected Ethereum provider (`window.ethereum`) |
| `Ledger`      | An open WebUSB transport                           |
| `privateKey`  | A 64-character hex private key                     |

Call `metaNamesSdk.resetSigningStrategy()` to disconnect.

### Supported payment tokens

Domains are paid for with BYOC (Bring Your Own Coin) tokens. The available symbols depend on the environment:

* **Mainnet**: `ETH`, `BNB`, `MATIC`, `ETHEREUM_USDT`, `POLYGON_USDC`
* **Testnet**: `ETH_GOERLI`, `TEST_COIN`

Passing a symbol that is not available in the current environment throws `BYOC <symbol> not handled`.
