| description | Integrate Meta Names into your application |
|---|
For the full API surface, check out the auto-generated documentation.
To use the Meta Names SDK in your project, install it via npm or yarn:
npm install @metanames/sdk
# or
yarn add @metanames/sdk
Import the SDK and create an instance:
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 %}
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.
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.
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.