@maskarajr/unrl 0.1.1 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  > One call. Name → address. TLD picks the module.
7
7
 
8
- **Status: `0.1.x` preview.** Thin TypeScript SDK — not a full identity/profile layer. Paste a name, get `{ address, resolver }`. Missing on-chain records → `address: null`. Unknown TLD / reverse miss → `resolver: null`.
8
+ **Status: `0.2.x` preview.** Thin TypeScript SDK — not a full identity/profile layer. Paste a name, get `{ address, resolver }`. Missing on-chain records → `address: null`. Unknown TLD / reverse miss → `resolver: null`.
9
9
 
10
10
  Install: [`@maskarajr/unrl`](https://www.npmjs.com/package/@maskarajr/unrl) (unscoped `unrl` is blocked on npm as too similar to existing names).
11
11
 
@@ -14,9 +14,9 @@ Install: [`@maskarajr/unrl`](https://www.npmjs.com/package/@maskarajr/unrl) (uns
14
14
  | TLD | Module | Address family |
15
15
  |-----|--------|----------------|
16
16
  | `.eth` | ENS (viem, Ethereum L1) | EVM |
17
- | `.sol` | SNS / Bonfida (proxy v2) | Solana |
17
+ | `.sol` `.sns` | SNS / Bonfida (proxy v2; `.sol` is rewritten to `.sns` on resolve) | Solana |
18
18
  | `.base` | Base Names as `*.base.eth` on L1 | EVM |
19
- | `.crypto` `.wallet` `.nft` `.x` `.polygon` `.dao` `.888` `.blockchain` | Unstoppable (on-chain ProxyReader; optional API key) | EVM |
19
+ | Unstoppable UNS/POL set (e.g. `.crypto` `.x` `.zil` `.bitcoin` `.anime` `.go`) | Unstoppable (Polygon ProxyReader, Ethereum fallback; optional API key). Source: [supported_tlds](https://api.unstoppabledomains.com/resolve/supported_tlds) filtered to `namingService === "UNS"` and `registrationBlockchain === "POL"` (not `udtest`, not DNS/ICANN, not BASE/SOL/SONIC). | EVM |
20
20
 
21
21
  ## Install
22
22
 
@@ -37,6 +37,7 @@ await unrl.resolve("vitalik.eth");
37
37
  // { address: "0xd8dA…", resolver: "ens" }
38
38
 
39
39
  await unrl.resolve("toly.sol"); // resolver: "sns"
40
+ await unrl.resolve("bonfida.sns"); // resolver: "sns"
40
41
  await unrl.resolve("jesse.base"); // resolver: "basenames"
41
42
  await unrl.resolve("brad.crypto"); // resolver: "unstoppable"
42
43
  // await unrl.resolve("vitalik.eh") // type error: not a valid name
package/dist/index.d.mts CHANGED
@@ -1,7 +1,10 @@
1
- type SupportedTLD = "eth" | "sol" | "base" | "crypto" | "wallet" | "nft" | "x" | "polygon" | "dao" | "888" | "blockchain";
1
+ /** https://api.unstoppabledomains.com/resolve/supported_tlds — namingService === "UNS" && registrationBlockchain === "POL", minus udtest */
2
+ declare const UD_TLDS: readonly ["888", "agent", "ai4", "altimist", "anime", "arculus", "austin", "awaken", "binanceus", "bitcoin", "bitget", "blockchain", "brave", "calicoin", "carbon", "cashme", "cgai", "chipper", "clay", "coin", "collect", "crypto", "dao", "dejay", "derad", "dfz", "digitalfuture", "doga", "donut", "dream", "dsci", "emir", "farms", "go", "graphics", "gripe", "grow", "guide", "hi", "hub", "imtoken", "kingdom", "klever", "kresus", "kryptic", "lfg", "ltc", "manga", "marketer", "metropolis", "miku", "ministry", "mobix", "moon", "nft", "nibi", "og", "openx", "pack", "pastor", "pbdx", "pilot", "pog", "polygon", "presearch", "pudgy", "pundi", "raiin", "realm", "secret", "shiksha", "stepn", "super", "supernova", "tball", "tea", "travel", "tribe", "twin", "ubu", "unstoppable", "vanity", "wallet", "web3", "wifi", "witg", "wrkx", "x", "xmr", "xz1", "yellow", "zil"];
3
+
4
+ type SupportedTLD = "eth" | "sol" | "sns" | "base" | (typeof UD_TLDS)[number];
2
5
  type ResolverName = "ens" | "sns" | "basenames" | "unstoppable";
3
6
  /** Literal names UNRL accepts (last label is a supported TLD). `foo.base.eth` matches `.eth`. */
4
- type SupportedName = `${string}.eth` | `${string}.sol` | `${string}.base` | `${string}.crypto` | `${string}.wallet` | `${string}.nft` | `${string}.x` | `${string}.polygon` | `${string}.dao` | `${string}.888` | `${string}.blockchain`;
7
+ type SupportedName = `${string}.${SupportedTLD}`;
5
8
  /**
6
9
  * Compile-time TLD check for string literals. Opaque `string` (user input) still allowed.
7
10
  * Mistyped suffix becomes `Not a valid name: …` so `resolve("vitalik.eh")` fails typecheck.
package/dist/index.d.ts CHANGED
@@ -1,7 +1,10 @@
1
- type SupportedTLD = "eth" | "sol" | "base" | "crypto" | "wallet" | "nft" | "x" | "polygon" | "dao" | "888" | "blockchain";
1
+ /** https://api.unstoppabledomains.com/resolve/supported_tlds — namingService === "UNS" && registrationBlockchain === "POL", minus udtest */
2
+ declare const UD_TLDS: readonly ["888", "agent", "ai4", "altimist", "anime", "arculus", "austin", "awaken", "binanceus", "bitcoin", "bitget", "blockchain", "brave", "calicoin", "carbon", "cashme", "cgai", "chipper", "clay", "coin", "collect", "crypto", "dao", "dejay", "derad", "dfz", "digitalfuture", "doga", "donut", "dream", "dsci", "emir", "farms", "go", "graphics", "gripe", "grow", "guide", "hi", "hub", "imtoken", "kingdom", "klever", "kresus", "kryptic", "lfg", "ltc", "manga", "marketer", "metropolis", "miku", "ministry", "mobix", "moon", "nft", "nibi", "og", "openx", "pack", "pastor", "pbdx", "pilot", "pog", "polygon", "presearch", "pudgy", "pundi", "raiin", "realm", "secret", "shiksha", "stepn", "super", "supernova", "tball", "tea", "travel", "tribe", "twin", "ubu", "unstoppable", "vanity", "wallet", "web3", "wifi", "witg", "wrkx", "x", "xmr", "xz1", "yellow", "zil"];
3
+
4
+ type SupportedTLD = "eth" | "sol" | "sns" | "base" | (typeof UD_TLDS)[number];
2
5
  type ResolverName = "ens" | "sns" | "basenames" | "unstoppable";
3
6
  /** Literal names UNRL accepts (last label is a supported TLD). `foo.base.eth` matches `.eth`. */
4
- type SupportedName = `${string}.eth` | `${string}.sol` | `${string}.base` | `${string}.crypto` | `${string}.wallet` | `${string}.nft` | `${string}.x` | `${string}.polygon` | `${string}.dao` | `${string}.888` | `${string}.blockchain`;
7
+ type SupportedName = `${string}.${SupportedTLD}`;
5
8
  /**
6
9
  * Compile-time TLD check for string literals. Opaque `string` (user input) still allowed.
7
10
  * Mistyped suffix becomes `Not a valid name: …` so `resolve("vitalik.eh")` fails typecheck.
package/dist/index.js CHANGED
@@ -141,10 +141,13 @@ function snsPrimaryLabel(result) {
141
141
  if (result && typeof result === "object") return nonempty(result.reverse);
142
142
  return null;
143
143
  }
144
+ function snsResolveDomain(name) {
145
+ return name.replace(/\.sol$/i, ".sns");
146
+ }
144
147
  var SNSResolver = class {
145
148
  constructor(rpcUrl) {
146
149
  this.name = "sns";
147
- this.supportedTLDs = ["sol"];
150
+ this.supportedTLDs = ["sol", "sns"];
148
151
  this.rpcUrl = rpcUrl;
149
152
  }
150
153
  endpoint(path) {
@@ -154,7 +157,9 @@ var SNSResolver = class {
154
157
  }
155
158
  async resolve(name) {
156
159
  try {
157
- const res = await fetch(this.endpoint(`resolve/${encodeURIComponent(name)}`));
160
+ const res = await fetch(
161
+ this.endpoint(`resolve/${encodeURIComponent(snsResolveDomain(name))}`)
162
+ );
158
163
  if (!res.ok) throw new Error("SNS resolve failed");
159
164
  const data = await res.json();
160
165
  if (data.s !== "ok") throw new Error("SNS resolve error");
@@ -276,7 +281,104 @@ var BaseNamesResolver = class {
276
281
  var import_viem3 = require("viem");
277
282
  var import_chains3 = require("viem/chains");
278
283
 
284
+ // src/utils/ud-tlds.ts
285
+ var UD_TLDS = [
286
+ "888",
287
+ "agent",
288
+ "ai4",
289
+ "altimist",
290
+ "anime",
291
+ "arculus",
292
+ "austin",
293
+ "awaken",
294
+ "binanceus",
295
+ "bitcoin",
296
+ "bitget",
297
+ "blockchain",
298
+ "brave",
299
+ "calicoin",
300
+ "carbon",
301
+ "cashme",
302
+ "cgai",
303
+ "chipper",
304
+ "clay",
305
+ "coin",
306
+ "collect",
307
+ "crypto",
308
+ "dao",
309
+ "dejay",
310
+ "derad",
311
+ "dfz",
312
+ "digitalfuture",
313
+ "doga",
314
+ "donut",
315
+ "dream",
316
+ "dsci",
317
+ "emir",
318
+ "farms",
319
+ "go",
320
+ "graphics",
321
+ "gripe",
322
+ "grow",
323
+ "guide",
324
+ "hi",
325
+ "hub",
326
+ "imtoken",
327
+ "kingdom",
328
+ "klever",
329
+ "kresus",
330
+ "kryptic",
331
+ "lfg",
332
+ "ltc",
333
+ "manga",
334
+ "marketer",
335
+ "metropolis",
336
+ "miku",
337
+ "ministry",
338
+ "mobix",
339
+ "moon",
340
+ "nft",
341
+ "nibi",
342
+ "og",
343
+ "openx",
344
+ "pack",
345
+ "pastor",
346
+ "pbdx",
347
+ "pilot",
348
+ "pog",
349
+ "polygon",
350
+ "presearch",
351
+ "pudgy",
352
+ "pundi",
353
+ "raiin",
354
+ "realm",
355
+ "secret",
356
+ "shiksha",
357
+ "stepn",
358
+ "super",
359
+ "supernova",
360
+ "tball",
361
+ "tea",
362
+ "travel",
363
+ "tribe",
364
+ "twin",
365
+ "ubu",
366
+ "unstoppable",
367
+ "vanity",
368
+ "wallet",
369
+ "web3",
370
+ "wifi",
371
+ "witg",
372
+ "wrkx",
373
+ "x",
374
+ "xmr",
375
+ "xz1",
376
+ "yellow",
377
+ "zil"
378
+ ];
379
+
279
380
  // src/utils/tld.ts
381
+ var CORE_TLDS = ["eth", "sol", "sns", "base"];
280
382
  function extractTLD(name) {
281
383
  const normalized = name.toLowerCase().trim();
282
384
  if (normalized.endsWith(".base.eth") || normalized === "base.eth") {
@@ -286,20 +388,7 @@ function extractTLD(name) {
286
388
  return parts[parts.length - 1] ?? "";
287
389
  }
288
390
  function isSupportedTLD(tld) {
289
- const supported = [
290
- "eth",
291
- "sol",
292
- "base",
293
- "crypto",
294
- "wallet",
295
- "nft",
296
- "x",
297
- "polygon",
298
- "dao",
299
- "888",
300
- "blockchain"
301
- ];
302
- return supported.includes(tld);
391
+ return CORE_TLDS.includes(tld) || UD_TLDS.includes(tld);
303
392
  }
304
393
  function hasNameAndTld(name) {
305
394
  const normalized = name.toLowerCase().trim();
@@ -392,16 +481,6 @@ var proxyReaderAbi = [
392
481
  ]
393
482
  }
394
483
  ];
395
- var UD_TLDS = [
396
- "crypto",
397
- "wallet",
398
- "nft",
399
- "x",
400
- "polygon",
401
- "dao",
402
- "888",
403
- "blockchain"
404
- ];
405
484
  var UnstoppableResolver = class {
406
485
  constructor(apiKey, rpcUrl) {
407
486
  this.name = "unstoppable";
package/dist/index.mjs CHANGED
@@ -114,10 +114,13 @@ function snsPrimaryLabel(result) {
114
114
  if (result && typeof result === "object") return nonempty(result.reverse);
115
115
  return null;
116
116
  }
117
+ function snsResolveDomain(name) {
118
+ return name.replace(/\.sol$/i, ".sns");
119
+ }
117
120
  var SNSResolver = class {
118
121
  constructor(rpcUrl) {
119
122
  this.name = "sns";
120
- this.supportedTLDs = ["sol"];
123
+ this.supportedTLDs = ["sol", "sns"];
121
124
  this.rpcUrl = rpcUrl;
122
125
  }
123
126
  endpoint(path) {
@@ -127,7 +130,9 @@ var SNSResolver = class {
127
130
  }
128
131
  async resolve(name) {
129
132
  try {
130
- const res = await fetch(this.endpoint(`resolve/${encodeURIComponent(name)}`));
133
+ const res = await fetch(
134
+ this.endpoint(`resolve/${encodeURIComponent(snsResolveDomain(name))}`)
135
+ );
131
136
  if (!res.ok) throw new Error("SNS resolve failed");
132
137
  const data = await res.json();
133
138
  if (data.s !== "ok") throw new Error("SNS resolve error");
@@ -249,7 +254,104 @@ var BaseNamesResolver = class {
249
254
  import { createPublicClient as createPublicClient3, http as http3, namehash } from "viem";
250
255
  import { mainnet as mainnet3, polygon } from "viem/chains";
251
256
 
257
+ // src/utils/ud-tlds.ts
258
+ var UD_TLDS = [
259
+ "888",
260
+ "agent",
261
+ "ai4",
262
+ "altimist",
263
+ "anime",
264
+ "arculus",
265
+ "austin",
266
+ "awaken",
267
+ "binanceus",
268
+ "bitcoin",
269
+ "bitget",
270
+ "blockchain",
271
+ "brave",
272
+ "calicoin",
273
+ "carbon",
274
+ "cashme",
275
+ "cgai",
276
+ "chipper",
277
+ "clay",
278
+ "coin",
279
+ "collect",
280
+ "crypto",
281
+ "dao",
282
+ "dejay",
283
+ "derad",
284
+ "dfz",
285
+ "digitalfuture",
286
+ "doga",
287
+ "donut",
288
+ "dream",
289
+ "dsci",
290
+ "emir",
291
+ "farms",
292
+ "go",
293
+ "graphics",
294
+ "gripe",
295
+ "grow",
296
+ "guide",
297
+ "hi",
298
+ "hub",
299
+ "imtoken",
300
+ "kingdom",
301
+ "klever",
302
+ "kresus",
303
+ "kryptic",
304
+ "lfg",
305
+ "ltc",
306
+ "manga",
307
+ "marketer",
308
+ "metropolis",
309
+ "miku",
310
+ "ministry",
311
+ "mobix",
312
+ "moon",
313
+ "nft",
314
+ "nibi",
315
+ "og",
316
+ "openx",
317
+ "pack",
318
+ "pastor",
319
+ "pbdx",
320
+ "pilot",
321
+ "pog",
322
+ "polygon",
323
+ "presearch",
324
+ "pudgy",
325
+ "pundi",
326
+ "raiin",
327
+ "realm",
328
+ "secret",
329
+ "shiksha",
330
+ "stepn",
331
+ "super",
332
+ "supernova",
333
+ "tball",
334
+ "tea",
335
+ "travel",
336
+ "tribe",
337
+ "twin",
338
+ "ubu",
339
+ "unstoppable",
340
+ "vanity",
341
+ "wallet",
342
+ "web3",
343
+ "wifi",
344
+ "witg",
345
+ "wrkx",
346
+ "x",
347
+ "xmr",
348
+ "xz1",
349
+ "yellow",
350
+ "zil"
351
+ ];
352
+
252
353
  // src/utils/tld.ts
354
+ var CORE_TLDS = ["eth", "sol", "sns", "base"];
253
355
  function extractTLD(name) {
254
356
  const normalized = name.toLowerCase().trim();
255
357
  if (normalized.endsWith(".base.eth") || normalized === "base.eth") {
@@ -259,20 +361,7 @@ function extractTLD(name) {
259
361
  return parts[parts.length - 1] ?? "";
260
362
  }
261
363
  function isSupportedTLD(tld) {
262
- const supported = [
263
- "eth",
264
- "sol",
265
- "base",
266
- "crypto",
267
- "wallet",
268
- "nft",
269
- "x",
270
- "polygon",
271
- "dao",
272
- "888",
273
- "blockchain"
274
- ];
275
- return supported.includes(tld);
364
+ return CORE_TLDS.includes(tld) || UD_TLDS.includes(tld);
276
365
  }
277
366
  function hasNameAndTld(name) {
278
367
  const normalized = name.toLowerCase().trim();
@@ -365,16 +454,6 @@ var proxyReaderAbi = [
365
454
  ]
366
455
  }
367
456
  ];
368
- var UD_TLDS = [
369
- "crypto",
370
- "wallet",
371
- "nft",
372
- "x",
373
- "polygon",
374
- "dao",
375
- "888",
376
- "blockchain"
377
- ];
378
457
  var UnstoppableResolver = class {
379
458
  constructor(apiKey, rpcUrl) {
380
459
  this.name = "unstoppable";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@maskarajr/unrl",
3
- "version": "0.1.1",
3
+ "version": "0.2.0",
4
4
  "description": "Preview: TLD-routed name resolution for ENS, SNS, Base Names, and Unstoppable Domains",
5
5
  "license": "MIT",
6
6
  "author": "maskarajr",
File without changes