Cronos ID
  • Welcome to Cronos ID
  • What is Cronos ID?
    • Cronos ID Domains
    • Cronos ID Notifications
      • How Cronos ID Notifications Work?
      • Partner with Cronos ID Notifications
      • Terms & Conditions
    • Cronos ID Messaging
  • Core Utility Modules
  • Tokenomics
  • Domains Pricing Model
  • Roadmap
  • Release Notes
  • Our Partners
  • Get Involved
  • User Guides
    • Getting Started
      • Tokens Needed
      • Bridging Funds to Cronos
      • Connecting Wallet
    • Cronos ID Domains
      • Checking domain availability
      • Checking domain user profile
      • Minting domain
      • Managing domain profile
        • Editing domain profile
        • Adding cryptocurrency addresses
        • Transferring your domain
      • Adding domains to "My Favourite"
      • Claiming domains from direct transfer/NFT marketplace
      • Setting Default Domain
      • Renewing Domain
      • Sub-domain
        • Creating sub-domain
        • Editing controller of sub-domain
        • Managing sub-domain
      • FAQ
    • $CROID Staking Vaults
      • Staking $CROID into Vault
      • Claiming Vault Rewards
      • Staking Additional $CROID into Vaults
      • Upgrading Vaults
      • Unstaking $CROID from Vault
      • FAQ
  • Using Cronos ID on Crypto.com Onchain
    • Crypto.com Onchain Integration
    • For Crypto.com Onchain mobile app users
      • Setting wallet name
      • Sending token
      • Receiving token
      • Sending NFT
      • Receiving NFT
    • For Crypto.com Onchain Extension (Chrome) users
      • Setting wallet name
      • Sending token
      • Receiving token
    • FAQ
  • Fundamentals
    • Team Wallets
    • Tokens Supported
    • Smart Contracts
    • Security
  • Developers Resources
    • Github
    • Domain Integration
      • Use Cases
      • Integrating using ethers.js
      • Integrating using our SDK
    • Notification Integration
      • Submit Your DApp Info
      • Send notifications via our API
      • Integrating using our SDK
    • Metadata Service Guide
  • Extras
    • Protected Domains Policy
    • Community Guidelines
    • Cronos Labs Incubation
    • Risk Disclosure
  • Community Links
    • Twitter
    • Discord
    • Medium
Powered by GitBook
On this page
  • How to access our domain SDK?
  • How to set up the Domain SDK?
  • Resolving a name to a Cronos address
  • Reverse Resolution
  • Exports
  • CROID Interface
  • Name Interface
  • Resolver Interface
  • Who should I contact for support?
  1. Developers Resources
  2. Domain Integration

Integrating using our SDK

PreviousIntegrating using ethers.jsNextNotification Integration

Last updated 2 years ago

How to access our domain SDK?

You can access the package at this link:

How to set up the Domain SDK?

Before you can begin interacting with Cronos ID, you will need to obtain a reference to the CROID registry.

import CROID, { getCroidAddress } from '@cronosid/croidjs'



 croid = new CROID({ provider, croidAddress: getCroidAddress('25') }) // Cronos Mainnet Chain Id

croid.name('cronos.cro').getAddress() // 0x123

Resolving a name to a Cronos address

var address = await croid.name('cronos.cro').getAddress();

Reverse Resolution

While 'regular' resolution involves mapping from a name to an address, reverse resolution maps from an address back to a name. Cronos ID supports reverse resolution to allow applications to display Cronos ID names in place of hexadecimal addresses.

const address = '0x1234...';
let croidName = null;
({ name: croidName } = await croid.getName(address))
// Check to be sure the reverse record is correct. skip check if the name is null
if(croidName == null || address != await croid.name(croidName).getAddress()) {
  croidName = null;
}

Exports

default - CROID
getCroidAddress
getResolverContract
getCROIDContract
namehash
labelhash

CROID Interface

name(name: String) => Name
  • Returns a Name Object, that allows you to make record queries.

resolver(address: CronosAddress) => Resolver
  • Returns a Resolver Object, allowing you to query names from this specific resolver. Most useful when querying a different resolver that is different than is currently recorded on the registry. E.g. migrating to a new resolver

async getName(address: CronosAddress) => Promise<Name>
  • Returns the reverse record for a particular Cronos address.

Name Interface

async getOwner() => Promise<CronosAddress>
  • Returns the owner/controller for the current CROID name.

async getResolver() => Promise<CronosAddress>
  • Returns the resolver for the current CROID name.

async getAddress(coinId: String) => Promise<CronosAddress>
  • Returns the address for the current CROID name for the coinId provided.

async getContent() => Promise<ContentHash>
  • Returns the contentHash for the current CROID name.

async getText(key: String) => Promise<String>
  • Returns the text record for a given key for the current CROID name.

Resolver Interface

address
  • Static property that returns current resolver address

name(name) => Name
  • Returns a Name Object that hardcodes the resolver

Who should I contact for support?

If you have any questions about the integration with Cronos ID Domain, drop us a message on our and we will get in touch with you!

https://www.npmjs.com/package/@cronosid/croidjs?activeTab=code
Discord server