KID Domain jsSDK
KID jsSDK
- [ √ ] The KID domain name is resolved using the address
- [ √ ] The address is reversely resolved based on the KID name and the specified chain
- [ √ ] Based on the KID name, the IP addresses of different chains are resolved in reverse
Installation
npm
npm install -S @knowhereio/kidjs web3
yarn
yarn add @knowhereio/kidjs web3
Exports
default - KID
getKidName
getKidResolver
Example
1.The KID domain name is resolved using the address
const KID = require('@knowhereio/kidjs')
const Web3 = require('web3')
let provider
let kid
provider = new Web3(new Web3.providers.HttpProvider('https://goerli.infura.io/v3/xxxxx'))
kid = new KID({ provider, networkId: 5 })
kid.getKidName('0x0000000000000000000000000000000000000000').then((res) => {
console.log('res')
}).catch((err) => {
console.log('Error:', err)
})
2.The address is reversely resolved based on the KID name and the specified chain
const KID = require('@knowhereio/kidjs')
const Web3 = require('web3')
let provider
let kid
provider = new Web3(new Web3.providers.HttpProvider('https://goerli.infura.io/v3/xxxxx'))
kid = new KID({ provider, networkId: 5 })
kid.getKidResolver('hello','ETH').then((res) => {
console.log(res)
}).catch((err) => {
console.log('Error:', err)
})
3.Based on the KID name, the IP addresses of different chains are resolved in reverse
const KID = require('@knowhereio/kidjs')
const Web3 = require('web3')
let provider
let kid
provider = new Web3(new Web3.providers.HttpProvider('https://goerli.infura.io/v3/xxxxx'))
kid = new KID({ provider, networkId: 5 })
kid.getKidResolver('hello').then((res) => {
console.log(res)
}).catch((err) => {
console.log('Error:', err)
})