Resolve Namebase decentralized domains in MetaMask

Namebase domains are Handshake names minted onto Ethereum as non-expiring
ERC-721s. MetaMask cannot resolve them on its own: it asks the ENS registry,
which has never heard of them. This snap knows where to look instead.

It talks to no server. Whatever a name resolves to is where the user's money
goes, so it is read from the chain through the user's own provider - which is
also why no network permission is needed. addr() falls back to whoever holds
the token, so a name keeps paying the right person after a sale.

The manifest declares chains only and carries no TLD list, so enabling minting
on a new TLD needs no change here. Two rules in src/index.ts filter instead:
stay out of TLDs another naming system is authoritative for, and ignore
anything without two labels. When in doubt the answer is null, never an
address.

Hashing mirrors the registry's dsld_node() and every test vector is generated
from it. Two requirements are pinned because breaking either is silent: UTS-46
must be transitional, and it must not be ENSIP-15. Either mistake yields a
valid-looking node with no records and a name that never resolves. The built
bundle is tested separately from the source because tr46 reaches for the Node
punycode builtin - without that polyfill the build is clean and every
non-ASCII name fails at runtime.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01YUVyawKbjSWw57md791LUu
This commit is contained in:
2026-08-09 14:45:29 -04:00
commit e90426ff43
14 changed files with 8231 additions and 0 deletions

28
snap.manifest.json Normal file
View File

@@ -0,0 +1,28 @@
{
"version": "0.1.1",
"description": "Resolve Namebase decentralized domains to the address their holder is paid at, read straight from Ethereum.",
"proposedName": "Namebase",
"repository": {
"type": "git",
"url": "https://git.eskimo.dev/namebase/metamask.git"
},
"source": {
"shasum": "FWoRKTN/csXGg7tCXRyoLltTBgFWO5UO6tjyUjDFlWU=",
"location": {
"npm": {
"filePath": "dist/bundle.js",
"iconPath": "images/icon.svg",
"packageName": "@namebase.io/metamask",
"registry": "https://registry.npmjs.org"
}
}
},
"initialPermissions": {
"endowment:name-lookup": {
"chains": ["eip155:1"]
},
"endowment:ethereum-provider": {}
},
"platformVersion": "11.2.0",
"manifestVersion": "0.1"
}