1.0.4 • Published 1 year ago
@testprotocol/reverse-records v1.0.4
@testprotocol/reverse-records
Getting started
Prerequisites
- Have your web3 provider ready (infura, etc)
- You must have both a MATIC and ETH Provider
And you're good to go!
Installation
# npm
npm install @testprotocol/reverse-records
# yarn
yarn add @testprotocol/reverse-records
Usage
import { Reverse } from "@testprotocol/reverse-records";
const reverse = new Reverse(
"https://polygon-mainnet.infura.io/v3/<API_KEY>", // MATIC Provider
"https://mainnet.infura.io/v3/<API_KEY>" // ETH Provider
);
async function getName() {
const reverseName = await avatar.getName(
"0x123abc123abc123abc123abc123abc123abc123a"
);
// reverseName = example.name
}
async function getReverse() {
const reverse = await avatar.getReverse(
"0x123abc123abc123abc123abc123abc123abc123a"
);
// name = { name: "example.name" , avatar: ... }
}
Functions
getName
Returns reverse name of a given address. If the given address does not have a reverse record, it returns null.
async getName(address: string) => Promise<string | null>;
getReverse
Returns an object with the reverse name and the avatar. If the given address does not have a reverse record, it returns null.
async getReverse(address: string) => Promise< { name: string; avatar: null; } | { name: string; avatar: string; } | null >;