hooddomains
v0.1.1
Published
TypeScript SDK for Hood Domains — resolve, look up, and register .hood names on Robinhood Chain. All on-chain, no backend.
Maintainers
Readme
hooddomains
TypeScript SDK for Hood Domains — resolve, look up, and register
.hood names on Robinhood Chain. Everything is on-chain; the SDK is a thin wrapper over
viem. No backend, no API keys beyond your own RPC.
Hood Domains · www.hood.domains · app · docs · npm · GitHub · X @hooddomains
npm i hooddomains viemRead (only needs an RPC)
import { Hood } from "hooddomains";
const hood = new Hood({ rpcUrl: "https://robinhood-mainnet.g.alchemy.com/v2/YOUR_KEY" });
await hood.resolve("alice.hood"); // -> "0x…" | null (name -> wallet)
await hood.reverse("0x1234…abcd"); // -> "alice.hood" | null (wallet -> name)
await hood.text("alice.hood", "twitter"); // -> string | null
await hood.records("alice.hood"); // -> { address, records: { twitter, url, … }, resolver }
await hood.available("mynew"); // -> boolean
await hood.price("mynew", 1); // -> { wei, eth }
await hood.nameInfo("alice.hood"); // -> { registered, owner, expiry, resolver, tokenId }Write (needs a signer)
Pass a privateKey or a viem walletClient:
const hood = new Hood({ rpcUrl, privateKey: "0x…" });
// commit -> wait ~60s -> register, paid in native ETH (overpayment refunded on-chain)
const res = await hood.register("mynew", { years: 1 });
// -> { name, owner, tokenId, paid: { eth }, commitTx, registerTx }
await hood.setAddr("mynew.hood", "0x…"); // point it at a wallet
await hood.setText("mynew.hood", "twitter", "hood"); // any key/value
await hood.setPrimary("mynew.hood"); // make it your primary namesetAddr / setText deploy a per-owner resolver (granting addr + text roles) on first use, then
reuse it.
Options
new Hood({
rpcUrl, // Robinhood Chain (chainId 4663) RPC
publicClient, // or bring your own viem PublicClient
walletClient, // or bring your own signer
privateKey, // or a private key for writes
contracts, // override addresses (defaults to the live v2 deployment)
deployBlock, // lower bound for record-key discovery
});Notes
registertakes ~70s (the ~60s commit-reveal front-run protection).records()discovers custom text keys fromTextChangedevents (not just a fixed list).- Reading works with any RPC. For a server key, don't use a browser origin-allowlisted key.
- Contracts default to the live deployment on Robinhood Chain (chainId 4663). Import
DEFAULT_CONTRACTS,robinhoodChain, etc. from the package if you need them.
