Make sure to install the following packages before installing xrplidjs: xrpl and verify-xrpl-signature.
npm install xrpl verify-xrpl-signature
const xrplidjs = require('xrplidjs');
const config =
{
rpcUrl: "wss://xrplcluster.com/",
Issuer: "raAyazbgEkwzLByXipQuPLWFfnsPS1v1q9",
}
async function main() {
const sdk = xrplidjs.SDK(config);
// your xrp domain
const domain = "xrpdomains.xrp";
// your address
const address = "rLhi87aSCyNW88tW4632yLiwinbghFZNue";
// resolve name to get the address of the owner.
const objOwner = await sdk.getAddress(domain);
console.log(objOwner);
//Reverse Resolve Names
const objDomain = await sdk.getName(address);
console.log(objDomain);
//Get All Names
const objAllDomains = await sdk.getAllNames(address);
console.log(objAllDomains);
}
main();