@naculus/connect-appkit-core 0.5.0 → 0.6.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/dist/index.cjs CHANGED
@@ -1535,18 +1535,25 @@ async function withRetry(fn, options) {
1535
1535
  }
1536
1536
  function normalizeEip155ChainId(value) {
1537
1537
  if (typeof value !== "string") return void 0;
1538
+ let raw;
1539
+ if (value.startsWith("eip155:")) {
1540
+ raw = value.slice("eip155:".length);
1541
+ if (!/^\d+$/.test(raw)) return void 0;
1542
+ } else if (/^0x[0-9a-f]+$/i.test(value) || /^\d+$/.test(value)) {
1543
+ raw = value;
1544
+ } else {
1545
+ return void 0;
1546
+ }
1547
+ let numeric;
1538
1548
  try {
1539
- if (value.startsWith("eip155:")) {
1540
- const reference = value.slice("eip155:".length);
1541
- if (!/^\d+$/.test(reference)) return void 0;
1542
- return `eip155:${BigInt(reference).toString(10)}`;
1543
- }
1544
- if (/^0x[0-9a-f]+$/i.test(value) || /^\d+$/.test(value)) {
1545
- return `eip155:${BigInt(value).toString(10)}`;
1546
- }
1549
+ numeric = BigInt(raw);
1547
1550
  } catch {
1551
+ return void 0;
1548
1552
  }
1549
- return void 0;
1553
+ if (numeric <= 0n || numeric > BigInt(Number.MAX_SAFE_INTEGER)) {
1554
+ return void 0;
1555
+ }
1556
+ return `eip155:${numeric.toString(10)}`;
1550
1557
  }
1551
1558
  function toEip155Accounts(accounts, chainId) {
1552
1559
  const reference = chainId.split(":")[1];