Skip to content

Latest commit

 

History

History

examples

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 

BNS Example

Get Start

node {path}/index.js

Function examples

HTML examples

ENS Registry

getResolver

Get resolver address by ENS.

Function Example

const config = {
  provider: 'https://mainnet.infura.io' // Endpoint provider url
};
const BNS = require("../../../lib/BNS").default;
const bns = new BNS(config);

(async () => {
  try {
    const resolver = await bns.ENSResolver.getResolver('facebook.eth');
    console.log(resolver);  // 0x5807A8B404C71cf22Eb0BaC2e5F2a6c202eBE0a1
  } catch (error) {
    console.error(error);
  }
})()

HTML Example

<script src="../../dist/BNS.js"></script>
<script>
  var BNS = require('BNS');
  
  // initial BNS with configuration
  var bns = new BNS.default({
    restURL: `https://mainnet.infura.io`, // Set provider endpoint
  });
  bns.ENSRegistry.getOwner('facebook.eth').then(function(owner) {
    document.getElementById("owner").innerHTML = owner;
  });
</script>