@jaw.id/ui 0.4.7 → 0.4.9

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/dist/index.js CHANGED
@@ -54649,15 +54649,13 @@ async function gz(e) {
54649
54649
  let t = e.replace(/[₮]/g, "T").toUpperCase(), n = mz.get(t);
54650
54650
  if (n && Date.now() - n.timestamp < hz) return n.price;
54651
54651
  try {
54652
- let e = await fetch(`https://min-api.cryptocompare.com/data/price?fsym=${t}&tsyms=USD`);
54653
- if (!e.ok) throw Error(`CryptoCompare API error: ${e.status}`);
54654
- let r = await e.json();
54655
- if (r.Response === "Error") return console.warn(`CryptoCompare error for ${t}:`, r.Message), n?.price ?? 0;
54656
- let i = r.USD ?? 0;
54652
+ let e = await fetch(`https://data-api.binance.vision/api/v3/ticker/price?symbol=${t}USD`);
54653
+ if (!e.ok) throw Error(`Binance API error: ${e.status}`);
54654
+ let n = await e.json(), r = Number(n.price) || 0;
54657
54655
  return mz.set(t, {
54658
- price: i,
54656
+ price: r,
54659
54657
  timestamp: Date.now()
54660
- }), i;
54658
+ }), r;
54661
54659
  } catch (e) {
54662
54660
  return console.warn(`Failed to fetch ${t} price:`, e), n?.price ?? 0;
54663
54661
  }
@@ -57248,9 +57246,9 @@ function aU(e, t, n) {
57248
57246
  }
57249
57247
  //#endregion
57250
57248
  //#region src/utils/reverseResolve.ts
57251
- var oU = "https://api.justaname.id/ens/v2/reverse", sU = 50, cU = "https://ipfs.io/ipfs/";
57249
+ var oU = "https://api.justaname.id/ens/v2/reverse", sU = 50, cU = "https://metadata.ens.domains/mainnet/avatar/";
57252
57250
  function lU(e) {
57253
- return e ? e.startsWith("https://") || e.startsWith("http://") || e.startsWith("data:image/") ? e : e.startsWith("ipfs://") ? cU + e.slice(7).replace(/^ipfs\//, "") : null : null;
57251
+ return cU + encodeURIComponent(e);
57254
57252
  }
57255
57253
  async function uU(e, t, n) {
57256
57254
  let r = new URL(oU);
@@ -57263,11 +57261,7 @@ async function uU(e, t, n) {
57263
57261
  for (let e of o) {
57264
57262
  if (!e?.name) continue;
57265
57263
  let t = { name: e.name };
57266
- if (n) {
57267
- let n = lU(e.records?.records?.texts?.find((e) => e.key === "avatar")?.value);
57268
- n && (t.avatar = n);
57269
- }
57270
- s[e.address.toLowerCase()] = t;
57264
+ n && e.records?.records?.texts?.find((e) => e.key === "avatar")?.value && (t.avatar = lU(e.name)), s[e.address.toLowerCase()] = t;
57271
57265
  }
57272
57266
  return s;
57273
57267
  }
@@ -1 +1 @@
1
- {"version":3,"file":"reverseResolve.d.ts","sourceRoot":"","sources":["../../src/utils/reverseResolve.ts"],"names":[],"mappings":"AAIA,MAAM,WAAW,YAAY;IAC3B,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAiFD,6LAA6L;AAC7L,wBAAsB,uBAAuB,CAAC,MAAM,EAAE,YAAY,EAAE,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAOrH;AAED,2KAA2K;AAC3K,wBAAsB,yBAAyB,CAC7C,MAAM,EAAE,YAAY,EAAE,EACtB,MAAM,EAAE,MAAM,GACb,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC,CAE3C"}
1
+ {"version":3,"file":"reverseResolve.d.ts","sourceRoot":"","sources":["../../src/utils/reverseResolve.ts"],"names":[],"mappings":"AAaA,MAAM,WAAW,YAAY;IAC3B,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAwED,6LAA6L;AAC7L,wBAAsB,uBAAuB,CAAC,MAAM,EAAE,YAAY,EAAE,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAOrH;AAED,2KAA2K;AAC3K,wBAAsB,yBAAyB,CAC7C,MAAM,EAAE,YAAY,EAAE,EACtB,MAAM,EAAE,MAAM,GACb,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC,CAE3C"}
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Fetches the current price in USD for a token by its symbol from CryptoCompare API
2
+ * Fetches the current price in USD for a token by its symbol from Binance API
3
3
  * Results are cached for 5 minutes per symbol to reduce API calls
4
4
  * @param symbol - The token symbol (ETH, AVAX, BNB, USDC, etc.)
5
5
  * @returns Promise<number> - The token price in USD, or 0 if fetch fails
@@ -1 +1 @@
1
- {"version":3,"file":"tokenPrice.d.ts","sourceRoot":"","sources":["../../src/utils/tokenPrice.ts"],"names":[],"mappings":"AAQA;;;;;GAKG;AACH,wBAAsB,eAAe,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAkCrE;AAED;;GAEG;AACH,wBAAgB,oBAAoB,IAAI,IAAI,CAE3C"}
1
+ {"version":3,"file":"tokenPrice.d.ts","sourceRoot":"","sources":["../../src/utils/tokenPrice.ts"],"names":[],"mappings":"AAQA;;;;;GAKG;AACH,wBAAsB,eAAe,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CA6BrE;AAED;;GAEG;AACH,wBAAgB,oBAAoB,IAAI,IAAI,CAE3C"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@jaw.id/ui",
3
3
  "description": "Pre-built React dialogs for JAW.id",
4
- "version": "0.4.7",
4
+ "version": "0.4.9",
5
5
  "license": "MIT",
6
6
  "type": "module",
7
7
  "sideEffects": [
@@ -35,6 +35,23 @@
35
35
  "default": "./dist/index.js"
36
36
  }
37
37
  },
38
+ "nx": {
39
+ "targets": {
40
+ "test": {
41
+ "cache": true,
42
+ "inputs": [
43
+ "default",
44
+ "^production",
45
+ "{projectRoot}/vitest.config.ts"
46
+ ],
47
+ "executor": "nx:run-commands",
48
+ "options": {
49
+ "cwd": "{projectRoot}",
50
+ "command": "bunx vitest run"
51
+ }
52
+ }
53
+ }
54
+ },
38
55
  "peerDependencies": {
39
56
  "react": ">=18.0.0",
40
57
  "react-dom": ">=18.0.0"