Files
metamask/snap.config.ts
eskimo e90426ff43 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
2026-08-09 15:05:18 -04:00

19 lines
602 B
TypeScript

import type { SnapConfig } from '@metamask/snaps-cli';
/**
* tr46 pulls in the Node `punycode` builtin and Buffer - and punycode is the exact code path that
* turns a stored xn-- label back into the emoji a user typed. Without these polyfills the bundle
* still loads and still evaluates cleanly; it just fails to resolve any non-ASCII name at runtime.
* Do not "clean up" these flags because the build is quiet without them.
*/
const config: SnapConfig = {
input: './src/index.ts',
server: { port: 8080 },
polyfills: {
buffer: true,
punycode: true,
},
};
export default config;