Quick Start - Integration
import { resolve } from "@bonfida/spl-name-service";
const domain = "sns.sol" // With or without .sol
// The config argument to resolve is optional
// If allowPDA is true, a list of program IDs is required
const resolveConfig = { allowPda: true, programIds: ["..."] }
const resolvedAddress = await resolve(connection, domain, resolveConfig)import { resolveDomain } from "@solana-name-service/sns-sdk-kit";
const domain = "sns.sol" // With or without .sol
// The options argument is not required to be passed
// If allowPDA is true, a list of program IDs is required.
const resolveOptions = { allowPda: true, programIds: ["..."] }
const resolvedAddress = await resolveDomain({ rpc, domain, options:resolveOptions });import { getPrimaryDomain } from "@bonfida/spl-name-service";
const { domain, reverse } = await getPrimaryDomain(connection, domainOwnerPublicKey);import { getPrimaryDomain } from "@solana-name-service/sns-sdk-kit";
import { Address } from "@solana/kit";
const userWallet = "36Dn3RWhB8x4c83W6ebQ2C2eH9sh5bQX2nMdkP2cWaA4" as Address
const {
domainAddress, // Address of domain account, not the user wallet address
domainName: primaryDomain,
stale: isPrimaryDomainStale
} = await getPrimaryDomain({ rpc, walletAddress:userWallet });import { Record, getMultipleRecordsV2, verifyStaleness } from "@bonfida/spl-name-service";
const domain = "sns.sol"
const recordsToFetch = [Record.Discord, Record.Twitter, Record.Telegram];
const recordOptions = { deserialize: true };
const domainRecords = getMultipleRecordsV2(
connection,
domain,
recordsToFetch,
recordOptions,
);
// This example arbitrarily selects the first record of the list
// In practice you should filter based on your needs
const isFreshRecord = await verifyStaleness(connection, domainRecords[0], domain);import {
Record,
getDomainRecords,
} from "@solana-name-service/sns-sdk-kit";
const domain = "sns.sol"
const recordsToFetch = [Record.Discord, Record.Twitter, Record.Telegram];
// Optionally chose to deserialize the returned content
// Optionally pass verifiers to use custom oracle during right of association verification
const recordOptions = { deserialize: true, verifiers: undefined };
const domainRecords = getRecords({
rpc,
domain,
records: recordsToFetch,
options: recordOptions,
});
// This example arbitrarily selects the first record of the list
// In practice you should filter based on your needs
const recordToCheck = domainRecords[0];
const recordContent = recordToCheck.deserializedContent;
const isRecordVerified = recordToCheck.verification.roa;
const isRecordStale = recordToCheck.verification.staleness;Last updated