Explorer Integration
Events RPC
The indexer’s events method returns the activity log newest-first, with each event carrying its txid, height, signature, and the relevant address. To poll for new events, track the highest height you have ingested and pass it as since_height on the next call.
import { createClient } from "zcashname-sdk";
const client = await createClient("https://light.zcash.me/zns-mainnet-test");
let lastSeen = 0;
const { events, total } = await client.events({
since_height: lastSeen,
limit: 100,
});
if (events.length > 0) {
lastSeen = Math.max(...events.map((e) => e.height));
}The indexer does not push: clients poll. A reasonable cadence is every block (~75 seconds on mainnet). Use total to detect when more results are available than your limit and page with offset.
since_height is strict: height > since_height. To start from a specific block inclusively, pass block - 1.
Rendering an event
Each event maps to one line in a transaction feed.
function describe(e: Event): string {
switch (e.action) {
case "CLAIM": return `Claimed ${e.name} for ${e.ua}`;
case "UPDATE": return `Updated ${e.name} → ${e.ua}`;
case "LIST": return `Listed ${e.name} for ${e.price! / 1e8} ZEC`;
case "DELIST": return `Delisted ${e.name}`;
case "BUY": return `Bought ${e.name}, new owner ${e.ua}`;
case "RELEASE": return `Released ${e.name}`;
case "SETPRICE": return `Updated pricing tiers`;
}
}SETPRICE events have an empty name field and a null ua. All others have a non-empty name.
Showing names alongside addresses
When rendering a Zcash address, call resolve with it as the query. By-address resolution returns an array.
const names = await client.resolve("u1gphl7vrklduuv96kpw4eetx4vrs8nnk7…");
const label = names.length > 0
? names.sort((a, b) => a.name.localeCompare(b.name))[0].name
: null;An empty array means no registered names. Cache briefly (5–10 seconds) or refetch on focus.