pepunamessdk
v1.0.0
Published
TypeScript SDK for Pepu Name Service - Simple domain name resolution to wallet addresses
Maintainers
Readme
Pepu Name Service SDK
Ultra-simple SDK to resolve Pepu domain names to wallet addresses and get domain information.
Installation
npm install pepunamessdkUsage
Basic Domain Resolution
import { PNS } from 'pepunamessdk';
const pns = new PNS();
const address = await pns.resolve('teck.pepu');
console.log(address); // 0xD1B77E5BE43d705549E38a23b59CF5365f17E227Get Domain Status
const status = await pns.getDomainStatus('teck.pepu');
console.log('Exists:', status.exists);
console.log('Expired:', status.expired);
console.log('Remaining days:', status.remainingDays.toString());
console.log('Fee:', ethers.formatUnits(status.fee, 6), 'USDC/year');Get Detailed Domain Info
const info = await pns.getDomainInfo('teck.pepu');
if (info) {
console.log('Wallet:', info.walletAddress);
console.log('Owner:', info.owner);
console.log('Registration date:', new Date(Number(info.registrationTimestamp) * 1000));
console.log('Expiry date:', new Date(Number(info.expiryTimestamp) * 1000));
console.log('TLD:', info.tld);
}API
resolve(domain)
Resolves a domain name to a wallet address.
- domain (string): Domain name (e.g., "teck.pepu")
- returns (Promise): Wallet address or empty string if not found
getDomainStatus(domain)
Gets domain status information.
- domain (string): Domain name (e.g., "teck.pepu")
- returns (Promise): Status object with exists, expired, remainingDays, fee
getDomainInfo(domain)
Gets detailed domain information.
- domain (string): Domain name (e.g., "teck.pepu")
- returns (Promise<object|null>): Detailed info object or null if not found
Examples
import { PNS } from 'pepunamessdk';
const pns = new PNS();
// Resolve a domain
const address = await pns.resolve('example.pepu');
if (address) {
console.log('Domain resolves to:', address);
} else {
console.log('Domain not found');
}
// Check domain status
const status = await pns.getDomainStatus('example.pepu');
if (status.exists && !status.expired) {
console.log('Domain is active with', status.remainingDays.toString(), 'days remaining');
}License
MIT
