@adadomains/resolver-sdk
TypeScript icon, indicating that this package has built-in type declarations

0.1.20 • Public • Published

Resolver SDK

Adadomains resolver SDK is a TypeScript library which allows you to query on-chain domain attributes from adadomains project

Install

npm

npm i @adadomains/resolver-sdk

Usage

import { BlockfrostProvider, AdaDomainsResolver } from '@adadomains/resolver-sdk'
import type { Provider, DomainResolver, PredefinedAttribute, CustomAttribute } from '@adadomains/resolver-sdk'


const provider: Provider = new BlockfrostProvider({
  Preprod: {
    projectId: "<blockfrostProjectId>",
    baseUrl: "<blockfrostBaseUrl>",
  },
});

const domainResolver: DomainResolver = new AdaDomainsResolver(provider);

const predefinedAttributes: Array<PredefinedAttribute> = await domainResolver.resolvePredefinedAttributes({
  domain: "test-domain-1.ada",
  network: "Preprod",
});

const filteredPredefinedAttributes: Array<PredefinedAttribute>= await domainResolver.resolvePredefinedAttributes({
  domain: "test-domain-1.ada",
  network: "Preprod",
  attributes: ["socials.discord.invitelink", "socials.youtube"],
});

const predefinedAttribute: PredefinedAttribute | undefined = await domainResolver.resolvePredefinedAttribute({
  domain: "test-domain-1.ada",
  network: "Preprod",
  attribute: "socials.discord.invitelink",
});

const customAttributes: Array<CustomAttribute> = await domainResolver.resolveCustomAttributes({
  domain: "test-domain-1.ada",
  network: "Preprod",
});

const customAttribute: CustomAttribute | undefined = await domainResolver.resolveCustomAttribute({
  domain: "test-domain-1.ada",
  network: "Preprod",
  attribute: "cus.mycustomkey",
});

const allAttributes: Array<PredefinedAttribute | CustomAttribute> = await domainResolver.resolveAllAttributes({
  domain: "test-domain-1.ada",
  network: "Preprod",
});

const cardanoAddress: string = await domainResolver.resolveToCardanoAddress({
  domain: "test-domain-1.ada",
  network: "Preprod"
});
const uri: string | undefined = await domainResolver.resolveToUri({
  domain: "test-domain-1.ada",
  network: "Preprod"
});


console.log(allAttributes)

Readme

Keywords

none

Package Sidebar

Install

npm i @adadomains/resolver-sdk

Weekly Downloads

122

Version

0.1.20

License

MIT

Unpacked Size

38.4 kB

Total Files

44

Last publish

Collaborators

  • adadomains