Integration

Dapps on arbitrum can use our resolve code ,to resolve wallet address to domain


const ethers = require('ethers');
const abi = require('./abi.json');

// Create a provider that connects to a JSON-RPC endpoint
const provider = new ethers.providers.JsonRpcProvider("https://endpoints.omniatech.io/v1/arbitrum/one/public");

// Create a random wallet
const wallet = ethers.Wallet.createRandom();

// Add the wallet to the provider's wallet
provider.getSigner(wallet.address);

// Create an instance of the contract interface
const contractAddress = "0x0b06b6d238A51BEf2Ad016a610C13A3bF3433003";
const contractABI = abi;
const contract = new ethers.Contract(contractAddress, contractABI.abi, provider);

async function getAllNames(wallet) {
  const contract = new ethers.Contract(contractAddress, contractABI.abi, provider);
  const names = await contract.getAllNames();
  var domains=[]
  var ans="NULL"
  for (let i = 0; i < names.length; i++) {
    if(wallet == await contract.ownerOf(i)){
        domains.push(names[i])
    }
  }
  for (let i = 0; i < domains.length; i++) {
    if(wallet == await contract.getRecord(domains[i])){
        
        ans=domains[i]
        break;
    }
  }

  return (ans+".arb")

 }

getAllNames("wallet_address_var").then(console.log).catch(console.error);

Last updated