@rhinestone/deposit-modal 0.10.0 → 0.11.1
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/{DepositModalReown-MTWT6Y66.mjs → DepositModalReown-MO5QDLIT.mjs} +96 -26
- package/dist/{DepositModalReown-S3DSFXTX.cjs → DepositModalReown-YGB73NMW.cjs} +97 -27
- package/dist/caip-D8aRWdEY.d.cts +40 -0
- package/dist/caip-D8aRWdEY.d.ts +40 -0
- package/dist/{chunk-NF4NBRUP.cjs → chunk-4FTI3GTB.cjs} +1 -1
- package/dist/{chunk-A223BLVC.mjs → chunk-53IFZGSF.mjs} +177 -21
- package/dist/{chunk-VDGT6NZQ.mjs → chunk-5746YXKC.mjs} +14 -31
- package/dist/{chunk-7TV7GLJB.mjs → chunk-CWGUBFJL.mjs} +763 -169
- package/dist/{chunk-LR7MKHYV.mjs → chunk-EIWOVX53.mjs} +27 -25
- package/dist/{chunk-VTVOHNXM.cjs → chunk-FVUXJ3RP.cjs} +3 -3
- package/dist/{chunk-A42XAHIB.cjs → chunk-HUHBNYD3.cjs} +84 -101
- package/dist/{chunk-YEBXUUH3.cjs → chunk-JPRV36DT.cjs} +2 -2
- package/dist/{chunk-UMCDZJMG.cjs → chunk-LQGYPM5B.cjs} +96 -94
- package/dist/{chunk-ILT2PITN.mjs → chunk-MZ53PDIX.mjs} +1 -1
- package/dist/{chunk-5NJYW5FT.mjs → chunk-OWYPKCYD.mjs} +12 -9
- package/dist/{chunk-W4YAOJPG.cjs → chunk-SSQ27YFB.cjs} +625 -568
- package/dist/{chunk-H577RJN5.cjs → chunk-TENL4H64.cjs} +186 -30
- package/dist/{chunk-5OEWGJR4.mjs → chunk-URFSTNRS.mjs} +1 -1
- package/dist/{chunk-KW32UBUQ.mjs → chunk-V6T7LORJ.mjs} +1 -1
- package/dist/{chunk-MHIOMTMM.mjs → chunk-YELNYILK.mjs} +391 -334
- package/dist/{chunk-PUJHXHRA.cjs → chunk-ZQR36NCV.cjs} +845 -251
- package/dist/{chunk-DEF767BA.cjs → chunk-ZRIRCIQM.cjs} +66 -63
- package/dist/claim.cjs +6 -6
- package/dist/claim.d.cts +3 -2
- package/dist/claim.d.ts +3 -2
- package/dist/claim.mjs +5 -5
- package/dist/{caip-523Zrc3r.d.cts → constants-FuzG3h4m.d.cts} +1 -18
- package/dist/{caip-523Zrc3r.d.ts → constants-FuzG3h4m.d.ts} +1 -18
- package/dist/constants.cjs +5 -3
- package/dist/constants.d.cts +3 -2
- package/dist/constants.d.ts +3 -2
- package/dist/constants.mjs +4 -2
- package/dist/deposit.cjs +8 -8
- package/dist/deposit.d.cts +3 -2
- package/dist/deposit.d.ts +3 -2
- package/dist/deposit.mjs +7 -7
- package/dist/index.cjs +12 -10
- package/dist/index.d.cts +3 -2
- package/dist/index.d.ts +3 -2
- package/dist/index.mjs +11 -9
- package/dist/polymarket.cjs +5 -5
- package/dist/polymarket.mjs +2 -2
- package/dist/{types-C0SGf-21.d.cts → types-CsGa-HxD.d.cts} +10 -3
- package/dist/{types-C0SGf-21.d.ts → types-DdS8OySJ.d.ts} +10 -3
- package/dist/withdraw.cjs +6 -6
- package/dist/withdraw.d.cts +3 -2
- package/dist/withdraw.d.ts +3 -2
- package/dist/withdraw.mjs +5 -5
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunk4FTI3GTBcjs = require('./chunk-4FTI3GTB.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
@@ -17,7 +17,20 @@ var _chunkNF4NBRUPcjs = require('./chunk-NF4NBRUP.cjs');
|
|
|
17
17
|
|
|
18
18
|
|
|
19
19
|
|
|
20
|
-
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
var _chunkTENL4H64cjs = require('./chunk-TENL4H64.cjs');
|
|
21
34
|
|
|
22
35
|
// src/components/ui/Modal.tsx
|
|
23
36
|
|
|
@@ -323,7 +336,7 @@ function preconnectIconCdn() {
|
|
|
323
336
|
const link = document.createElement("link");
|
|
324
337
|
link.id = "rs-icon-cdn-preconnect";
|
|
325
338
|
link.rel = "preconnect";
|
|
326
|
-
link.href =
|
|
339
|
+
link.href = _chunkTENL4H64cjs.ICON_CDN;
|
|
327
340
|
link.crossOrigin = "anonymous";
|
|
328
341
|
document.head.appendChild(link);
|
|
329
342
|
}
|
|
@@ -433,140 +446,6 @@ function PoweredBy() {
|
|
|
433
446
|
}
|
|
434
447
|
PoweredBy.displayName = "PoweredBy";
|
|
435
448
|
|
|
436
|
-
// src/core/useLatestRef.ts
|
|
437
|
-
|
|
438
|
-
function useLatestRef(value) {
|
|
439
|
-
const ref = _react.useRef.call(void 0, value);
|
|
440
|
-
_react.useEffect.call(void 0, () => {
|
|
441
|
-
ref.current = value;
|
|
442
|
-
}, [value]);
|
|
443
|
-
return ref;
|
|
444
|
-
}
|
|
445
|
-
|
|
446
|
-
// src/components/ui/Spinner.tsx
|
|
447
|
-
|
|
448
|
-
function Spinner({ className }) {
|
|
449
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
450
|
-
"svg",
|
|
451
|
-
{
|
|
452
|
-
className: `rs-spinner ${className || ""}`,
|
|
453
|
-
fill: "none",
|
|
454
|
-
viewBox: "0 0 20 21",
|
|
455
|
-
children: [
|
|
456
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
457
|
-
"path",
|
|
458
|
-
{
|
|
459
|
-
d: "M10 0.5C8.02 0.5 6.08 1.08 4.44 2.18C2.79 3.28 1.51 4.84 0.76 6.67C0.00 8.50 -0.19 10.51 0.19 12.45C0.57 14.39 1.53 16.17 2.92 17.57C4.32 18.96 6.10 19.92 8.04 20.30C9.98 20.69 11.99 20.49 13.82 19.73C15.65 18.98 17.21 17.70 18.31 16.05C19.41 14.41 20 12.47 20 10.5C20 7.84 18.94 5.30 17.07 3.42C15.19 1.55 12.65 0.5 10 0.5ZM10 17.77C8.56 17.77 7.15 17.34 5.95 16.54C4.76 15.74 3.83 14.61 3.28 13.28C2.73 11.95 2.58 10.49 2.86 9.08C3.14 7.67 3.84 6.37 4.85 5.35C5.87 4.34 7.17 3.64 8.58 3.36C9.99 3.08 11.45 3.23 12.78 3.78C14.11 4.33 15.24 5.26 16.04 6.45C16.84 7.65 17.27 9.06 17.27 10.5C17.27 12.42 16.50 14.27 15.14 15.64C13.77 17.00 11.92 17.77 10 17.77Z",
|
|
460
|
-
fill: "currentColor",
|
|
461
|
-
opacity: 0.3
|
|
462
|
-
}
|
|
463
|
-
),
|
|
464
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
465
|
-
"path",
|
|
466
|
-
{
|
|
467
|
-
d: "M10 3.22C11.74 3.22 13.42 3.84 14.75 4.95C16.08 6.07 16.96 7.61 17.25 9.31C17.30 9.64 17.46 9.94 17.71 10.15C17.96 10.37 18.28 10.49 18.62 10.5C18.82 10.50 19.01 10.45 19.20 10.37C19.38 10.29 19.54 10.16 19.67 10.01C19.80 9.86 19.89 9.68 19.95 9.49C20.00 9.30 20.01 9.10 19.98 8.90C19.59 6.56 18.38 4.42 16.55 2.88C14.72 1.34 12.40 0.5 10 0.5C7.59 0.5 5.27 1.34 3.44 2.88C1.61 4.42 0.40 6.56 0.01 8.90C-0.01 9.10 -0.00 9.30 0.04 9.49C0.10 9.68 0.19 9.86 0.32 10.01C0.45 10.16 0.61 10.29 0.79 10.37C0.98 10.45 1.17 10.50 1.37 10.5C1.71 10.49 2.03 10.37 2.28 10.15C2.53 9.94 2.69 9.64 2.74 9.31C3.03 7.61 3.91 6.07 5.24 4.95C6.57 3.84 8.25 3.22 10 3.22Z",
|
|
468
|
-
fill: "currentColor"
|
|
469
|
-
}
|
|
470
|
-
)
|
|
471
|
-
]
|
|
472
|
-
}
|
|
473
|
-
);
|
|
474
|
-
}
|
|
475
|
-
|
|
476
|
-
// src/components/ui/Button.tsx
|
|
477
|
-
|
|
478
|
-
function Button({
|
|
479
|
-
children,
|
|
480
|
-
variant = "accent",
|
|
481
|
-
size = "default",
|
|
482
|
-
loading = false,
|
|
483
|
-
loadingText,
|
|
484
|
-
fullWidth = false,
|
|
485
|
-
disabled,
|
|
486
|
-
className = "",
|
|
487
|
-
...props
|
|
488
|
-
}) {
|
|
489
|
-
const classes = [
|
|
490
|
-
"rs-button",
|
|
491
|
-
`rs-button--${variant}`,
|
|
492
|
-
`rs-button--size-${size}`,
|
|
493
|
-
fullWidth ? "rs-button--full-width" : "",
|
|
494
|
-
className
|
|
495
|
-
].filter(Boolean).join(" ");
|
|
496
|
-
const showInlineLoadingText = loading && loadingText !== void 0;
|
|
497
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
498
|
-
"button",
|
|
499
|
-
{
|
|
500
|
-
className: classes,
|
|
501
|
-
disabled: disabled || loading,
|
|
502
|
-
"aria-busy": loading || void 0,
|
|
503
|
-
...props,
|
|
504
|
-
children: showInlineLoadingText ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "rs-button__loading-row", children: [
|
|
505
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Spinner, { className: "rs-spinner--sm" }),
|
|
506
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: loadingText })
|
|
507
|
-
] }) : /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
508
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: loading ? "rs-button__content--hidden" : "", children }),
|
|
509
|
-
loading && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-button__spinner", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Spinner, { className: "rs-spinner--sm" }) })
|
|
510
|
-
] })
|
|
511
|
-
}
|
|
512
|
-
);
|
|
513
|
-
}
|
|
514
|
-
Button.displayName = "Button";
|
|
515
|
-
|
|
516
|
-
// src/components/ui/Callout.tsx
|
|
517
|
-
|
|
518
|
-
function CircleAlertIcon() {
|
|
519
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
520
|
-
"svg",
|
|
521
|
-
{
|
|
522
|
-
width: "16",
|
|
523
|
-
height: "16",
|
|
524
|
-
viewBox: "0 0 16 16",
|
|
525
|
-
fill: "none",
|
|
526
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
527
|
-
"aria-hidden": "true",
|
|
528
|
-
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
529
|
-
"path",
|
|
530
|
-
{
|
|
531
|
-
d: "M10 5.99L6 9.99M6 5.99L10 9.99M14.66 7.99C14.66 11.68 11.68 14.66 8 14.66C4.31 14.66 1.33 11.68 1.33 7.99C1.33 4.31 4.31 1.33 8 1.33C11.68 1.33 14.66 4.31 14.66 7.99Z",
|
|
532
|
-
stroke: "currentColor",
|
|
533
|
-
strokeWidth: "1.33",
|
|
534
|
-
strokeLinecap: "round",
|
|
535
|
-
strokeLinejoin: "round"
|
|
536
|
-
}
|
|
537
|
-
)
|
|
538
|
-
}
|
|
539
|
-
);
|
|
540
|
-
}
|
|
541
|
-
function Callout({ variant = "error", children, role }) {
|
|
542
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
543
|
-
"div",
|
|
544
|
-
{
|
|
545
|
-
className: `rs-callout rs-callout--${variant}`,
|
|
546
|
-
role: _nullishCoalesce(role, () => ( (variant === "error" ? "alert" : "status"))),
|
|
547
|
-
children: [
|
|
548
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-callout-icon", children: variant === "error" ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, CircleAlertIcon, {}) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, AlertTriangleIcon, {}) }),
|
|
549
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-callout-text", children })
|
|
550
|
-
]
|
|
551
|
-
}
|
|
552
|
-
);
|
|
553
|
-
}
|
|
554
|
-
Callout.displayName = "Callout";
|
|
555
|
-
|
|
556
|
-
// src/components/ui/TokenIcon.tsx
|
|
557
|
-
|
|
558
|
-
function TokenIcon({ symbol, className, fallback }) {
|
|
559
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
560
|
-
CdnIcon,
|
|
561
|
-
{
|
|
562
|
-
src: _chunkH577RJN5cjs.tokenIconUrl.call(void 0, symbol),
|
|
563
|
-
className: `rs-token-icon ${_nullishCoalesce(className, () => ( ""))}`.trimEnd(),
|
|
564
|
-
fallback
|
|
565
|
-
}
|
|
566
|
-
);
|
|
567
|
-
}
|
|
568
|
-
TokenIcon.displayName = "TokenIcon";
|
|
569
|
-
|
|
570
449
|
// src/core/deposit-service.ts
|
|
571
450
|
var _viem = require('viem');
|
|
572
451
|
|
|
@@ -623,6 +502,101 @@ function debugError(enabled, scope, message, error, data) {
|
|
|
623
502
|
console.error(`[deposit-modal:${scope}] ${message}`, payload);
|
|
624
503
|
}
|
|
625
504
|
|
|
505
|
+
// src/core/chain-catalog.ts
|
|
506
|
+
function parseToken(value) {
|
|
507
|
+
if (typeof value !== "object" || value === null) return null;
|
|
508
|
+
const { symbol, address, decimals } = value;
|
|
509
|
+
if (typeof symbol !== "string" || typeof address !== "string" || typeof decimals !== "number") {
|
|
510
|
+
return null;
|
|
511
|
+
}
|
|
512
|
+
return { symbol, address, decimals };
|
|
513
|
+
}
|
|
514
|
+
function parseExplorer(value) {
|
|
515
|
+
if (typeof value !== "object" || value === null) return null;
|
|
516
|
+
const { url, addressPath, txPath } = value;
|
|
517
|
+
if (typeof url !== "string" || typeof addressPath !== "string" || typeof txPath !== "string") {
|
|
518
|
+
return null;
|
|
519
|
+
}
|
|
520
|
+
return { url, addressPath, txPath };
|
|
521
|
+
}
|
|
522
|
+
function parseVmType(value) {
|
|
523
|
+
return value === "evm" || value === "svm" || value === "tvm" ? value : null;
|
|
524
|
+
}
|
|
525
|
+
function parseOptionalString(value) {
|
|
526
|
+
return typeof value === "string" && value.trim() !== "" ? value.trim() : null;
|
|
527
|
+
}
|
|
528
|
+
function parseChain(caip2, value) {
|
|
529
|
+
if (typeof value !== "object" || value === null) return null;
|
|
530
|
+
const raw = value;
|
|
531
|
+
const { name, testnet, deposit, destination, refund } = raw;
|
|
532
|
+
if (typeof name !== "string" || typeof testnet !== "boolean" || typeof deposit !== "boolean" || typeof destination !== "boolean" || typeof refund !== "boolean") {
|
|
533
|
+
return null;
|
|
534
|
+
}
|
|
535
|
+
const vmType = parseVmType(raw.vmType);
|
|
536
|
+
const nativeToken = parseToken(raw.nativeToken);
|
|
537
|
+
if (!vmType || !nativeToken) return null;
|
|
538
|
+
let supportedTokens;
|
|
539
|
+
if (raw.supportedTokens === "all") {
|
|
540
|
+
supportedTokens = "all";
|
|
541
|
+
} else if (Array.isArray(raw.supportedTokens)) {
|
|
542
|
+
const tokens = [];
|
|
543
|
+
for (const entry of raw.supportedTokens) {
|
|
544
|
+
const token = parseToken(entry);
|
|
545
|
+
if (!token) return null;
|
|
546
|
+
tokens.push(token);
|
|
547
|
+
}
|
|
548
|
+
supportedTokens = tokens;
|
|
549
|
+
} else {
|
|
550
|
+
return null;
|
|
551
|
+
}
|
|
552
|
+
return {
|
|
553
|
+
caip2,
|
|
554
|
+
// `parseEvmChainId` returns null for `solana:`/`tron:`/`hypercore:` keys,
|
|
555
|
+
// which is the intended answer — those chains have no numeric id, and the
|
|
556
|
+
// modal addresses them by their CAIP-2 string or a sentinel.
|
|
557
|
+
chainId: _chunkTENL4H64cjs.parseEvmChainId.call(void 0, caip2),
|
|
558
|
+
name,
|
|
559
|
+
testnet,
|
|
560
|
+
deposit,
|
|
561
|
+
destination,
|
|
562
|
+
refund,
|
|
563
|
+
vmType,
|
|
564
|
+
nativeToken,
|
|
565
|
+
explorer: parseExplorer(raw.explorer),
|
|
566
|
+
supportedTokens,
|
|
567
|
+
publicRpcUrl: parseOptionalString(raw.publicRpcUrl),
|
|
568
|
+
iconUrl: parseOptionalString(raw.iconUrl)
|
|
569
|
+
};
|
|
570
|
+
}
|
|
571
|
+
function parseChainCatalog(body) {
|
|
572
|
+
if (typeof body !== "object" || body === null || Array.isArray(body)) {
|
|
573
|
+
return null;
|
|
574
|
+
}
|
|
575
|
+
const all = [];
|
|
576
|
+
const byCaip2 = /* @__PURE__ */ new Map();
|
|
577
|
+
const byChainId = /* @__PURE__ */ new Map();
|
|
578
|
+
for (const [caip2, value] of Object.entries(body)) {
|
|
579
|
+
const chain = parseChain(caip2, value);
|
|
580
|
+
if (!chain) continue;
|
|
581
|
+
all.push(chain);
|
|
582
|
+
byCaip2.set(chain.caip2, chain);
|
|
583
|
+
if (chain.chainId !== null) byChainId.set(chain.chainId, chain);
|
|
584
|
+
}
|
|
585
|
+
if (all.length === 0) return null;
|
|
586
|
+
return { all, byCaip2, byChainId };
|
|
587
|
+
}
|
|
588
|
+
function catalogKeyForChain(chainId) {
|
|
589
|
+
if (chainId === "solana") return _chunkTENL4H64cjs.SOLANA_MAINNET_CAIP2;
|
|
590
|
+
if (chainId === "hypercore" || chainId === _chunkTENL4H64cjs.HYPERCORE_CHAIN_ID) {
|
|
591
|
+
return _chunkTENL4H64cjs.HYPERCORE_MAINNET_CAIP2;
|
|
592
|
+
}
|
|
593
|
+
return chainId;
|
|
594
|
+
}
|
|
595
|
+
function catalogExplorerTxUrl(chain, txHash) {
|
|
596
|
+
if (!_optionalChain([chain, 'optionalAccess', _2 => _2.explorer])) return void 0;
|
|
597
|
+
return `${chain.explorer.url}${chain.explorer.txPath}${txHash}`;
|
|
598
|
+
}
|
|
599
|
+
|
|
626
600
|
// src/core/deposit-asset-helpers.ts
|
|
627
601
|
function getAssetId(asset) {
|
|
628
602
|
return `${asset.chainId}:${asset.token.toLowerCase()}`;
|
|
@@ -767,7 +741,7 @@ function quoteFeeGroups(breakdown) {
|
|
|
767
741
|
const groups = /* @__PURE__ */ new Map();
|
|
768
742
|
for (const [category, line] of Object.entries(breakdown)) {
|
|
769
743
|
if (line.internal || !Number.isFinite(line.usd) || line.usd < 0) continue;
|
|
770
|
-
const label = _optionalChain([line, 'access',
|
|
744
|
+
const label = _optionalChain([line, 'access', _3 => _3.label, 'optionalAccess', _4 => _4.trim, 'call', _5 => _5()]) || titleCaseFeeCategory(category);
|
|
771
745
|
const group = _nullishCoalesce(groups.get(label), () => ( {
|
|
772
746
|
label,
|
|
773
747
|
chargedUsd: 0,
|
|
@@ -869,15 +843,20 @@ var SwappedConnectFeeChangedError = class extends Error {
|
|
|
869
843
|
function parseExchangeFeeBps(value) {
|
|
870
844
|
return typeof value === "number" && Number.isInteger(value) && value >= 0 && value <= 1e4 ? value : void 0;
|
|
871
845
|
}
|
|
846
|
+
var UNSUPPORTED_CONNECT_EXCHANGES = /* @__PURE__ */ new Set(["kraken", "htx"]);
|
|
847
|
+
var SUPPORTED_CONNECT_EXCHANGE_COUNT = 7;
|
|
848
|
+
function isSupportedConnectExchange(exchange) {
|
|
849
|
+
return !UNSUPPORTED_CONNECT_EXCHANGES.has(exchange.connection.toLowerCase());
|
|
850
|
+
}
|
|
872
851
|
function resolveAppFeeBps(appFees, sourceChainCaip2, sourceToken) {
|
|
873
|
-
const override = _optionalChain([appFees, 'optionalAccess',
|
|
874
|
-
const bps = _nullishCoalesce(_nullishCoalesce(override, () => ( _optionalChain([appFees, 'optionalAccess',
|
|
852
|
+
const override = _optionalChain([appFees, 'optionalAccess', _6 => _6.tokens, 'optionalAccess', _7 => _7[sourceChainCaip2], 'optionalAccess', _8 => _8[sourceToken.toLowerCase()]]);
|
|
853
|
+
const bps = _nullishCoalesce(_nullishCoalesce(override, () => ( _optionalChain([appFees, 'optionalAccess', _9 => _9.feeBps]))), () => ( 0));
|
|
875
854
|
return bps > 0 ? bps : 0;
|
|
876
855
|
}
|
|
877
856
|
function createDepositService(baseUrl, options) {
|
|
878
857
|
const normalizedBaseUrl = baseUrl.replace(/\/$/, "");
|
|
879
|
-
const debug = _optionalChain([options, 'optionalAccess',
|
|
880
|
-
const scope = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
858
|
+
const debug = _optionalChain([options, 'optionalAccess', _10 => _10.debug]) === true;
|
|
859
|
+
const scope = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _11 => _11.debugScope]), () => ( "service"));
|
|
881
860
|
function apiUrl(path) {
|
|
882
861
|
const normalizedPath = path.startsWith("/") ? path : `/${path}`;
|
|
883
862
|
return `${normalizedBaseUrl}${normalizedPath}`;
|
|
@@ -889,6 +868,7 @@ function createDepositService(baseUrl, options) {
|
|
|
889
868
|
const PORTFOLIO_CACHE_TTL_MS = 3e4;
|
|
890
869
|
const portfolioCache = /* @__PURE__ */ new Map();
|
|
891
870
|
let topTokensPromise = null;
|
|
871
|
+
let chainsPromise = null;
|
|
892
872
|
function parseTopTokens(value) {
|
|
893
873
|
if (typeof value !== "object" || value === null || Array.isArray(value)) {
|
|
894
874
|
return null;
|
|
@@ -913,7 +893,7 @@ function createDepositService(baseUrl, options) {
|
|
|
913
893
|
try {
|
|
914
894
|
const response = await fetch(apiUrl("/qr/tokens"), {
|
|
915
895
|
method: "GET",
|
|
916
|
-
headers:
|
|
896
|
+
headers: _chunk4FTI3GTBcjs.SERVICE_HEADERS
|
|
917
897
|
});
|
|
918
898
|
if (!response.ok) {
|
|
919
899
|
debugLog(debug, scope, "getTopTokens:unavailable", {
|
|
@@ -936,6 +916,32 @@ function createDepositService(baseUrl, options) {
|
|
|
936
916
|
return null;
|
|
937
917
|
}
|
|
938
918
|
}
|
|
919
|
+
async function requestChains() {
|
|
920
|
+
try {
|
|
921
|
+
const response = await fetch(apiUrl("/chains"), {
|
|
922
|
+
method: "GET",
|
|
923
|
+
headers: _chunk4FTI3GTBcjs.SERVICE_HEADERS
|
|
924
|
+
});
|
|
925
|
+
if (!response.ok) {
|
|
926
|
+
debugLog(debug, scope, "getChains:unavailable", {
|
|
927
|
+
status: response.status
|
|
928
|
+
});
|
|
929
|
+
return null;
|
|
930
|
+
}
|
|
931
|
+
const catalog = parseChainCatalog(await response.json());
|
|
932
|
+
if (!catalog) {
|
|
933
|
+
debugLog(debug, scope, "getChains:malformed");
|
|
934
|
+
return null;
|
|
935
|
+
}
|
|
936
|
+
debugLog(debug, scope, "getChains:success", {
|
|
937
|
+
chains: catalog.all.length
|
|
938
|
+
});
|
|
939
|
+
return catalog;
|
|
940
|
+
} catch (error) {
|
|
941
|
+
debugError(debug, scope, "getChains:error", error);
|
|
942
|
+
return null;
|
|
943
|
+
}
|
|
944
|
+
}
|
|
939
945
|
function cachedPortfolio(key, fetcher, forceRefresh = false) {
|
|
940
946
|
const now = Date.now();
|
|
941
947
|
const entry = portfolioCache.get(key);
|
|
@@ -945,7 +951,7 @@ function createDepositService(baseUrl, options) {
|
|
|
945
951
|
}
|
|
946
952
|
let promise;
|
|
947
953
|
promise = fetcher().catch((err) => {
|
|
948
|
-
if (_optionalChain([portfolioCache, 'access',
|
|
954
|
+
if (_optionalChain([portfolioCache, 'access', _12 => _12.get, 'call', _13 => _13(key), 'optionalAccess', _14 => _14.promise]) === promise) {
|
|
949
955
|
portfolioCache.delete(key);
|
|
950
956
|
}
|
|
951
957
|
throw err;
|
|
@@ -968,7 +974,7 @@ function createDepositService(baseUrl, options) {
|
|
|
968
974
|
});
|
|
969
975
|
const response = await fetch(url, {
|
|
970
976
|
method: "POST",
|
|
971
|
-
headers:
|
|
977
|
+
headers: _chunk4FTI3GTBcjs.SERVICE_HEADERS,
|
|
972
978
|
body: JSON.stringify({ account: params })
|
|
973
979
|
});
|
|
974
980
|
if (!response.ok) {
|
|
@@ -980,19 +986,19 @@ function createDepositService(baseUrl, options) {
|
|
|
980
986
|
error,
|
|
981
987
|
{ status: response.status, salt: params.salt }
|
|
982
988
|
);
|
|
983
|
-
const detail = Array.isArray(error.details) ? error.details.map((d) => _optionalChain([d, 'optionalAccess',
|
|
989
|
+
const detail = Array.isArray(error.details) ? error.details.map((d) => _optionalChain([d, 'optionalAccess', _15 => _15.message])).filter(Boolean).join("; ") : void 0;
|
|
984
990
|
const base = error.error || `Account registration failed: ${response.status}`;
|
|
985
991
|
throw new Error(detail ? `${base}: ${detail}` : base);
|
|
986
992
|
}
|
|
987
993
|
const result = await response.json();
|
|
988
994
|
debugLog(debug, scope, "registerManagedAccount:success", {
|
|
989
|
-
evmDepositAddress: _optionalChain([result, 'optionalAccess',
|
|
990
|
-
hasSolanaDepositAddress: Boolean(_optionalChain([result, 'optionalAccess',
|
|
991
|
-
hasTronDepositAddress: Boolean(_optionalChain([result, 'optionalAccess',
|
|
995
|
+
evmDepositAddress: _optionalChain([result, 'optionalAccess', _16 => _16.evmDepositAddress]),
|
|
996
|
+
hasSolanaDepositAddress: Boolean(_optionalChain([result, 'optionalAccess', _17 => _17.solanaDepositAddress])),
|
|
997
|
+
hasTronDepositAddress: Boolean(_optionalChain([result, 'optionalAccess', _18 => _18.tronDepositAddress]))
|
|
992
998
|
});
|
|
993
999
|
return {
|
|
994
1000
|
...result,
|
|
995
|
-
evmDepositAddress: normalizeEvmAddress(_optionalChain([result, 'optionalAccess',
|
|
1001
|
+
evmDepositAddress: normalizeEvmAddress(_optionalChain([result, 'optionalAccess', _19 => _19.evmDepositAddress]))
|
|
996
1002
|
};
|
|
997
1003
|
},
|
|
998
1004
|
async fetchPortfolio(address, options2) {
|
|
@@ -1001,7 +1007,7 @@ function createDepositService(baseUrl, options) {
|
|
|
1001
1007
|
debugLog(debug, scope, "fetchPortfolio:request", { url, address });
|
|
1002
1008
|
const response = await fetch(url, {
|
|
1003
1009
|
method: "GET",
|
|
1004
|
-
headers:
|
|
1010
|
+
headers: _chunk4FTI3GTBcjs.SERVICE_HEADERS
|
|
1005
1011
|
});
|
|
1006
1012
|
if (!response.ok) {
|
|
1007
1013
|
const error = await response.json().catch(() => ({ error: "Unknown error" }));
|
|
@@ -1040,7 +1046,7 @@ function createDepositService(baseUrl, options) {
|
|
|
1040
1046
|
}
|
|
1041
1047
|
debugLog(debug, scope, "fetchPortfolio:empty", { address });
|
|
1042
1048
|
return { tokens: [], totalUsd: 0 };
|
|
1043
|
-
}, _optionalChain([options2, 'optionalAccess',
|
|
1049
|
+
}, _optionalChain([options2, 'optionalAccess', _20 => _20.forceRefresh]));
|
|
1044
1050
|
},
|
|
1045
1051
|
async fetchSolanaPortfolio(address, options2) {
|
|
1046
1052
|
return cachedPortfolio(`sol:${address}`, async () => {
|
|
@@ -1048,7 +1054,7 @@ function createDepositService(baseUrl, options) {
|
|
|
1048
1054
|
debugLog(debug, scope, "fetchSolanaPortfolio:request", { url, address });
|
|
1049
1055
|
const response = await fetch(url, {
|
|
1050
1056
|
method: "GET",
|
|
1051
|
-
headers:
|
|
1057
|
+
headers: _chunk4FTI3GTBcjs.SERVICE_HEADERS
|
|
1052
1058
|
});
|
|
1053
1059
|
if (!response.ok) {
|
|
1054
1060
|
const error = await response.json().catch(() => ({ error: "Unknown error" }));
|
|
@@ -1071,14 +1077,14 @@ function createDepositService(baseUrl, options) {
|
|
|
1071
1077
|
totalUsd: normalized.totalUsd
|
|
1072
1078
|
});
|
|
1073
1079
|
return normalized;
|
|
1074
|
-
}, _optionalChain([options2, 'optionalAccess',
|
|
1080
|
+
}, _optionalChain([options2, 'optionalAccess', _21 => _21.forceRefresh]));
|
|
1075
1081
|
},
|
|
1076
1082
|
async checkAccount(address) {
|
|
1077
1083
|
const url = apiUrl(`/check/${address}`);
|
|
1078
1084
|
debugLog(debug, scope, "checkAccount:request", { url, address });
|
|
1079
1085
|
const response = await fetch(url, {
|
|
1080
1086
|
method: "GET",
|
|
1081
|
-
headers:
|
|
1087
|
+
headers: _chunk4FTI3GTBcjs.SERVICE_HEADERS
|
|
1082
1088
|
});
|
|
1083
1089
|
if (!response.ok) {
|
|
1084
1090
|
const error = await response.json().catch(() => ({ error: "Unknown error" }));
|
|
@@ -1093,9 +1099,9 @@ function createDepositService(baseUrl, options) {
|
|
|
1093
1099
|
}
|
|
1094
1100
|
const data = await response.json();
|
|
1095
1101
|
const result = {
|
|
1096
|
-
isRegistered: _optionalChain([data, 'optionalAccess',
|
|
1097
|
-
targetChain: _optionalChain([data, 'optionalAccess',
|
|
1098
|
-
targetToken: _optionalChain([data, 'optionalAccess',
|
|
1102
|
+
isRegistered: _optionalChain([data, 'optionalAccess', _22 => _22.isRegistered]) === true,
|
|
1103
|
+
targetChain: _optionalChain([data, 'optionalAccess', _23 => _23.targetChain]),
|
|
1104
|
+
targetToken: _optionalChain([data, 'optionalAccess', _24 => _24.targetToken])
|
|
1099
1105
|
};
|
|
1100
1106
|
debugLog(debug, scope, "checkAccount:success", {
|
|
1101
1107
|
address,
|
|
@@ -1113,7 +1119,7 @@ function createDepositService(baseUrl, options) {
|
|
|
1113
1119
|
);
|
|
1114
1120
|
const response = await fetch(url, {
|
|
1115
1121
|
method: "GET",
|
|
1116
|
-
headers:
|
|
1122
|
+
headers: _chunk4FTI3GTBcjs.SERVICE_HEADERS,
|
|
1117
1123
|
cache: "no-store"
|
|
1118
1124
|
});
|
|
1119
1125
|
if (!response.ok) {
|
|
@@ -1125,12 +1131,12 @@ function createDepositService(baseUrl, options) {
|
|
|
1125
1131
|
return { lastEvent: void 0 };
|
|
1126
1132
|
}
|
|
1127
1133
|
const body = await response.json();
|
|
1128
|
-
const row = _optionalChain([body, 'access',
|
|
1134
|
+
const row = _optionalChain([body, 'access', _25 => _25.deposits, 'optionalAccess', _26 => _26[0]]);
|
|
1129
1135
|
const lastEvent = row ? depositRowToEvent(row) : void 0;
|
|
1130
1136
|
debugLog(debug, scope, "fetchStatus:success", {
|
|
1131
1137
|
address,
|
|
1132
1138
|
txHash: shortRef(normalized),
|
|
1133
|
-
eventType: _optionalChain([lastEvent, 'optionalAccess',
|
|
1139
|
+
eventType: _optionalChain([lastEvent, 'optionalAccess', _27 => _27.type])
|
|
1134
1140
|
});
|
|
1135
1141
|
return { lastEvent };
|
|
1136
1142
|
},
|
|
@@ -1141,7 +1147,7 @@ function createDepositService(baseUrl, options) {
|
|
|
1141
1147
|
);
|
|
1142
1148
|
const response = await fetch(url, {
|
|
1143
1149
|
method: "GET",
|
|
1144
|
-
headers:
|
|
1150
|
+
headers: _chunk4FTI3GTBcjs.SERVICE_HEADERS,
|
|
1145
1151
|
cache: "no-store"
|
|
1146
1152
|
});
|
|
1147
1153
|
if (!response.ok) {
|
|
@@ -1165,7 +1171,7 @@ function createDepositService(baseUrl, options) {
|
|
|
1165
1171
|
);
|
|
1166
1172
|
const response = await fetch(url, {
|
|
1167
1173
|
method: "GET",
|
|
1168
|
-
headers:
|
|
1174
|
+
headers: _chunk4FTI3GTBcjs.SERVICE_HEADERS,
|
|
1169
1175
|
cache: "no-store"
|
|
1170
1176
|
});
|
|
1171
1177
|
if (!response.ok) {
|
|
@@ -1176,18 +1182,18 @@ function createDepositService(baseUrl, options) {
|
|
|
1176
1182
|
return { lastEvent: void 0 };
|
|
1177
1183
|
}
|
|
1178
1184
|
const body = await response.json();
|
|
1179
|
-
const row = _optionalChain([body, 'access',
|
|
1185
|
+
const row = _optionalChain([body, 'access', _28 => _28.deposits, 'optionalAccess', _29 => _29[0]]);
|
|
1180
1186
|
const lastEvent = row ? depositRowToEvent(row) : void 0;
|
|
1181
1187
|
debugLog(debug, scope, "fetchLatestStatus:success", {
|
|
1182
1188
|
address,
|
|
1183
|
-
eventType: _optionalChain([lastEvent, 'optionalAccess',
|
|
1189
|
+
eventType: _optionalChain([lastEvent, 'optionalAccess', _30 => _30.type])
|
|
1184
1190
|
});
|
|
1185
1191
|
return { lastEvent };
|
|
1186
1192
|
},
|
|
1187
1193
|
async getPositions(address) {
|
|
1188
1194
|
const url = apiUrl(`/positions/${address}`);
|
|
1189
1195
|
debugLog(debug, scope, "getPositions:request", { url, address });
|
|
1190
|
-
const response = await fetch(url, { headers:
|
|
1196
|
+
const response = await fetch(url, { headers: _chunk4FTI3GTBcjs.SERVICE_HEADERS });
|
|
1191
1197
|
if (!response.ok) {
|
|
1192
1198
|
const error = await response.json().catch(() => ({ error: "Unknown error" }));
|
|
1193
1199
|
debugError(debug, scope, "getPositions:failed", error, {
|
|
@@ -1201,9 +1207,9 @@ function createDepositService(baseUrl, options) {
|
|
|
1201
1207
|
const result = await response.json();
|
|
1202
1208
|
debugLog(debug, scope, "getPositions:success", {
|
|
1203
1209
|
address,
|
|
1204
|
-
count: _nullishCoalesce(_optionalChain([result, 'access',
|
|
1210
|
+
count: _nullishCoalesce(_optionalChain([result, 'access', _31 => _31.positions, 'optionalAccess', _32 => _32.length]), () => ( 0)),
|
|
1205
1211
|
totalUsd: result.totalUsd,
|
|
1206
|
-
failures: _optionalChain([result, 'access',
|
|
1212
|
+
failures: _optionalChain([result, 'access', _33 => _33.failures, 'optionalAccess', _34 => _34.map, 'call', _35 => _35((f) => f.venue)])
|
|
1207
1213
|
});
|
|
1208
1214
|
return result;
|
|
1209
1215
|
},
|
|
@@ -1221,7 +1227,7 @@ function createDepositService(baseUrl, options) {
|
|
|
1221
1227
|
});
|
|
1222
1228
|
const response = await fetch(url, {
|
|
1223
1229
|
method: "POST",
|
|
1224
|
-
headers:
|
|
1230
|
+
headers: _chunk4FTI3GTBcjs.SERVICE_HEADERS,
|
|
1225
1231
|
body: JSON.stringify({ account, market, chainId, asset, amount })
|
|
1226
1232
|
});
|
|
1227
1233
|
if (!response.ok) {
|
|
@@ -1257,7 +1263,7 @@ function createDepositService(baseUrl, options) {
|
|
|
1257
1263
|
});
|
|
1258
1264
|
const response = await fetch(url, {
|
|
1259
1265
|
method: "POST",
|
|
1260
|
-
headers:
|
|
1266
|
+
headers: _chunk4FTI3GTBcjs.SERVICE_HEADERS,
|
|
1261
1267
|
body: JSON.stringify({
|
|
1262
1268
|
depositWallet,
|
|
1263
1269
|
owner,
|
|
@@ -1281,7 +1287,7 @@ function createDepositService(baseUrl, options) {
|
|
|
1281
1287
|
const result = await response.json();
|
|
1282
1288
|
debugLog(debug, scope, "submitPolymarketWithdraw:success", {
|
|
1283
1289
|
depositWallet,
|
|
1284
|
-
txHash: _optionalChain([result, 'optionalAccess',
|
|
1290
|
+
txHash: _optionalChain([result, 'optionalAccess', _36 => _36.txHash]) ? shortRef(result.txHash) : void 0
|
|
1285
1291
|
});
|
|
1286
1292
|
return result;
|
|
1287
1293
|
},
|
|
@@ -1299,7 +1305,7 @@ function createDepositService(baseUrl, options) {
|
|
|
1299
1305
|
});
|
|
1300
1306
|
const response = await fetch(url, {
|
|
1301
1307
|
method: "GET",
|
|
1302
|
-
headers:
|
|
1308
|
+
headers: _chunk4FTI3GTBcjs.SERVICE_HEADERS,
|
|
1303
1309
|
cache: "no-store"
|
|
1304
1310
|
});
|
|
1305
1311
|
if (!response.ok) {
|
|
@@ -1316,8 +1322,8 @@ function createDepositService(baseUrl, options) {
|
|
|
1316
1322
|
);
|
|
1317
1323
|
}
|
|
1318
1324
|
const data = await response.json();
|
|
1319
|
-
const deposits = Array.isArray(_optionalChain([data, 'optionalAccess',
|
|
1320
|
-
const nextCursor = _nullishCoalesce(_nullishCoalesce(_optionalChain([data, 'optionalAccess',
|
|
1325
|
+
const deposits = Array.isArray(_optionalChain([data, 'optionalAccess', _37 => _37.deposits])) ? data.deposits : [];
|
|
1326
|
+
const nextCursor = _nullishCoalesce(_nullishCoalesce(_optionalChain([data, 'optionalAccess', _38 => _38.nextCursor]), () => ( _optionalChain([data, 'optionalAccess', _39 => _39.next_cursor]))), () => ( null));
|
|
1321
1327
|
debugLog(debug, scope, "fetchDepositHistory:success", {
|
|
1322
1328
|
recipient: shortRef(params.recipient),
|
|
1323
1329
|
count: deposits.length,
|
|
@@ -1326,20 +1332,20 @@ function createDepositService(baseUrl, options) {
|
|
|
1326
1332
|
return { deposits, nextCursor };
|
|
1327
1333
|
},
|
|
1328
1334
|
async checkLiquidity(params) {
|
|
1329
|
-
if (params.destinationChainId === "solana") {
|
|
1330
|
-
const token =
|
|
1335
|
+
if (_chunkTENL4H64cjs.isSolanaCaip2.call(void 0, params.destinationChainId) || params.destinationChainId === "solana") {
|
|
1336
|
+
const token = _chunkTENL4H64cjs.getSolanaTokenByMint.call(void 0, params.destinationToken);
|
|
1331
1337
|
return {
|
|
1332
1338
|
hasLiquidity: true,
|
|
1333
|
-
symbol: _nullishCoalesce(_optionalChain([token, 'optionalAccess',
|
|
1334
|
-
decimals: _nullishCoalesce(_optionalChain([token, 'optionalAccess',
|
|
1339
|
+
symbol: _nullishCoalesce(_optionalChain([token, 'optionalAccess', _40 => _40.symbol]), () => ( "Token")),
|
|
1340
|
+
decimals: _nullishCoalesce(_optionalChain([token, 'optionalAccess', _41 => _41.decimals]), () => ( 9)),
|
|
1335
1341
|
unlimited: true,
|
|
1336
1342
|
maxAmount: null
|
|
1337
1343
|
};
|
|
1338
1344
|
}
|
|
1339
1345
|
const searchParams = new URLSearchParams({
|
|
1340
|
-
sourceChainId:
|
|
1346
|
+
sourceChainId: _chunkTENL4H64cjs.toEvmCaip2.call(void 0, params.sourceChainId),
|
|
1341
1347
|
sourceToken: params.sourceToken,
|
|
1342
|
-
destinationChainId:
|
|
1348
|
+
destinationChainId: params.destinationChainId,
|
|
1343
1349
|
destinationToken: params.destinationToken,
|
|
1344
1350
|
amount: params.amount
|
|
1345
1351
|
});
|
|
@@ -1352,7 +1358,7 @@ function createDepositService(baseUrl, options) {
|
|
|
1352
1358
|
});
|
|
1353
1359
|
const response = await fetch(url, {
|
|
1354
1360
|
method: "GET",
|
|
1355
|
-
headers:
|
|
1361
|
+
headers: _chunk4FTI3GTBcjs.SERVICE_HEADERS,
|
|
1356
1362
|
cache: "no-store"
|
|
1357
1363
|
});
|
|
1358
1364
|
if (!response.ok) {
|
|
@@ -1384,7 +1390,7 @@ function createDepositService(baseUrl, options) {
|
|
|
1384
1390
|
const body = {
|
|
1385
1391
|
account: params.account,
|
|
1386
1392
|
// HyperCore has its own CAIP-2 namespace — never the eip155 placeholder.
|
|
1387
|
-
sourceChainId: params.sourceChainId === "hypercore" ?
|
|
1393
|
+
sourceChainId: params.sourceChainId === "hypercore" ? _chunkTENL4H64cjs.HYPERCORE_MAINNET_CAIP2 : `eip155:${params.sourceChainId}`,
|
|
1388
1394
|
sourceToken: params.sourceToken,
|
|
1389
1395
|
amount: params.amount
|
|
1390
1396
|
};
|
|
@@ -1397,7 +1403,7 @@ function createDepositService(baseUrl, options) {
|
|
|
1397
1403
|
try {
|
|
1398
1404
|
const response = await fetch(url, {
|
|
1399
1405
|
method: "POST",
|
|
1400
|
-
headers:
|
|
1406
|
+
headers: _chunk4FTI3GTBcjs.SERVICE_HEADERS,
|
|
1401
1407
|
body: JSON.stringify(body),
|
|
1402
1408
|
cache: "no-store"
|
|
1403
1409
|
});
|
|
@@ -1434,7 +1440,7 @@ function createDepositService(baseUrl, options) {
|
|
|
1434
1440
|
try {
|
|
1435
1441
|
const response = await fetch(url, {
|
|
1436
1442
|
method: "GET",
|
|
1437
|
-
headers:
|
|
1443
|
+
headers: _chunk4FTI3GTBcjs.SERVICE_HEADERS,
|
|
1438
1444
|
cache: "no-store"
|
|
1439
1445
|
});
|
|
1440
1446
|
if (!response.ok) {
|
|
@@ -1464,7 +1470,7 @@ function createDepositService(baseUrl, options) {
|
|
|
1464
1470
|
try {
|
|
1465
1471
|
const response = await fetch(url, {
|
|
1466
1472
|
method: "GET",
|
|
1467
|
-
headers:
|
|
1473
|
+
headers: _chunk4FTI3GTBcjs.SERVICE_HEADERS,
|
|
1468
1474
|
cache: "no-store"
|
|
1469
1475
|
});
|
|
1470
1476
|
if (!response.ok) {
|
|
@@ -1489,7 +1495,7 @@ function createDepositService(baseUrl, options) {
|
|
|
1489
1495
|
});
|
|
1490
1496
|
const response = await fetch(url, {
|
|
1491
1497
|
method: "POST",
|
|
1492
|
-
headers:
|
|
1498
|
+
headers: _chunk4FTI3GTBcjs.SERVICE_HEADERS,
|
|
1493
1499
|
body: JSON.stringify(params)
|
|
1494
1500
|
});
|
|
1495
1501
|
if (!response.ok) {
|
|
@@ -1521,7 +1527,7 @@ function createDepositService(baseUrl, options) {
|
|
|
1521
1527
|
});
|
|
1522
1528
|
const response = await fetch(url, {
|
|
1523
1529
|
method: "POST",
|
|
1524
|
-
headers:
|
|
1530
|
+
headers: _chunk4FTI3GTBcjs.SERVICE_HEADERS,
|
|
1525
1531
|
body: JSON.stringify(params)
|
|
1526
1532
|
});
|
|
1527
1533
|
if (!response.ok) {
|
|
@@ -1558,7 +1564,7 @@ function createDepositService(baseUrl, options) {
|
|
|
1558
1564
|
debugLog(debug, scope, "getSwappedConnectExchanges:request");
|
|
1559
1565
|
const response = await fetch(url, {
|
|
1560
1566
|
method: "GET",
|
|
1561
|
-
headers:
|
|
1567
|
+
headers: _chunk4FTI3GTBcjs.SERVICE_HEADERS,
|
|
1562
1568
|
cache: "no-store"
|
|
1563
1569
|
});
|
|
1564
1570
|
if (!response.ok) {
|
|
@@ -1593,7 +1599,7 @@ function createDepositService(baseUrl, options) {
|
|
|
1593
1599
|
throw new Error("Swapped Connect exchanges: malformed response");
|
|
1594
1600
|
}
|
|
1595
1601
|
return {
|
|
1596
|
-
exchanges,
|
|
1602
|
+
exchanges: exchanges.filter(isSupportedConnectExchange),
|
|
1597
1603
|
fetchedAt: body.fetchedAt,
|
|
1598
1604
|
expiresAt: body.expiresAt,
|
|
1599
1605
|
stale: body.stale === true ? true : void 0,
|
|
@@ -1611,7 +1617,7 @@ function createDepositService(baseUrl, options) {
|
|
|
1611
1617
|
try {
|
|
1612
1618
|
const response = await fetch(url, {
|
|
1613
1619
|
method: "GET",
|
|
1614
|
-
headers:
|
|
1620
|
+
headers: _chunk4FTI3GTBcjs.SERVICE_HEADERS,
|
|
1615
1621
|
cache: "no-store"
|
|
1616
1622
|
});
|
|
1617
1623
|
if (!response.ok) {
|
|
@@ -1682,12 +1688,22 @@ function createDepositService(baseUrl, options) {
|
|
|
1682
1688
|
}
|
|
1683
1689
|
return topTokensPromise;
|
|
1684
1690
|
},
|
|
1691
|
+
getChains() {
|
|
1692
|
+
if (!chainsPromise) {
|
|
1693
|
+
const attempt = requestChains().then((catalog) => {
|
|
1694
|
+
if (!catalog && chainsPromise === attempt) chainsPromise = null;
|
|
1695
|
+
return catalog;
|
|
1696
|
+
});
|
|
1697
|
+
chainsPromise = attempt;
|
|
1698
|
+
}
|
|
1699
|
+
return chainsPromise;
|
|
1700
|
+
},
|
|
1685
1701
|
async getSetup() {
|
|
1686
1702
|
const url = apiUrl("/setup");
|
|
1687
1703
|
try {
|
|
1688
1704
|
const response = await fetch(url, {
|
|
1689
1705
|
method: "GET",
|
|
1690
|
-
headers:
|
|
1706
|
+
headers: _chunk4FTI3GTBcjs.SERVICE_HEADERS,
|
|
1691
1707
|
cache: "no-store"
|
|
1692
1708
|
});
|
|
1693
1709
|
if (!response.ok) {
|
|
@@ -1714,7 +1730,7 @@ function createDepositService(baseUrl, options) {
|
|
|
1714
1730
|
);
|
|
1715
1731
|
const response = await fetch(url, {
|
|
1716
1732
|
method: "GET",
|
|
1717
|
-
headers:
|
|
1733
|
+
headers: _chunk4FTI3GTBcjs.SERVICE_HEADERS,
|
|
1718
1734
|
cache: "no-store"
|
|
1719
1735
|
});
|
|
1720
1736
|
if (!response.ok) return null;
|
|
@@ -1755,16 +1771,16 @@ function createDepositService(baseUrl, options) {
|
|
|
1755
1771
|
}
|
|
1756
1772
|
function normalizeDirectPortfolio(data) {
|
|
1757
1773
|
const rawTokens = _nullishCoalesce(_nullishCoalesce(extractArray(data, "tokens"), () => ( extractArray(
|
|
1758
|
-
_optionalChain([data, 'optionalAccess',
|
|
1774
|
+
_optionalChain([data, 'optionalAccess', _42 => _42.data]),
|
|
1759
1775
|
"tokens"
|
|
1760
1776
|
))), () => ( []));
|
|
1761
|
-
const totalUsd = _nullishCoalesce(_nullishCoalesce(extractNumber(data, "totalUsd"), () => ( extractNumber(_optionalChain([data, 'optionalAccess',
|
|
1777
|
+
const totalUsd = _nullishCoalesce(_nullishCoalesce(extractNumber(data, "totalUsd"), () => ( extractNumber(_optionalChain([data, 'optionalAccess', _43 => _43.data]), "totalUsd"))), () => ( 0));
|
|
1762
1778
|
const tokens = rawTokens.map((token) => normalizeDirectToken(token)).filter((token) => Boolean(token));
|
|
1763
1779
|
return { tokens, totalUsd };
|
|
1764
1780
|
}
|
|
1765
1781
|
function extractOrchestratorPortfolio(data) {
|
|
1766
1782
|
const portfolio = _nullishCoalesce(extractArray(data, "portfolio"), () => ( extractArray(
|
|
1767
|
-
_optionalChain([data, 'optionalAccess',
|
|
1783
|
+
_optionalChain([data, 'optionalAccess', _44 => _44.data]),
|
|
1768
1784
|
"portfolio"
|
|
1769
1785
|
)));
|
|
1770
1786
|
if (!portfolio || !Array.isArray(portfolio)) return null;
|
|
@@ -1775,17 +1791,17 @@ function normalizeOrchestratorPortfolio(data) {
|
|
|
1775
1791
|
for (const tokenData of data.portfolio || []) {
|
|
1776
1792
|
const chainBalances = _nullishCoalesce(_nullishCoalesce(tokenData.tokenChainBalance, () => ( tokenData.chainBalances)), () => ( []));
|
|
1777
1793
|
for (const chainBalance of chainBalances) {
|
|
1778
|
-
const unlocked = _nullishCoalesce(_optionalChain([chainBalance, 'access',
|
|
1794
|
+
const unlocked = _nullishCoalesce(_optionalChain([chainBalance, 'access', _45 => _45.balance, 'optionalAccess', _46 => _46.unlocked]), () => ( "0"));
|
|
1779
1795
|
const normalizedName = tokenData.tokenName.trim();
|
|
1780
1796
|
const isNativeSymbol = normalizedName.toUpperCase() === "ETH" || normalizedName.toUpperCase() === "ETHER";
|
|
1781
|
-
const tokenAddress = _nullishCoalesce(_nullishCoalesce(chainBalance.tokenAddress, () => ( extractTokenAddress(tokenData, chainBalance.chainId))), () => (
|
|
1782
|
-
const resolvedTokenAddress = isNativeSymbol ?
|
|
1797
|
+
const tokenAddress = _nullishCoalesce(_nullishCoalesce(chainBalance.tokenAddress, () => ( extractTokenAddress(tokenData, chainBalance.chainId))), () => ( _chunkTENL4H64cjs.getTokenAddress.call(void 0, tokenData.tokenName, chainBalance.chainId)));
|
|
1798
|
+
const resolvedTokenAddress = isNativeSymbol ? _chunkTENL4H64cjs.NATIVE_TOKEN_ADDRESS : tokenAddress;
|
|
1783
1799
|
if (!resolvedTokenAddress) {
|
|
1784
1800
|
continue;
|
|
1785
1801
|
}
|
|
1786
|
-
const registrySymbol =
|
|
1802
|
+
const registrySymbol = _chunkTENL4H64cjs.getTokenSymbol.call(void 0, resolvedTokenAddress, chainBalance.chainId);
|
|
1787
1803
|
const symbol = registrySymbol !== "Token" ? registrySymbol : normalizedName || "Token";
|
|
1788
|
-
const decimals = registrySymbol !== "Token" ?
|
|
1804
|
+
const decimals = registrySymbol !== "Token" ? _chunkTENL4H64cjs.getTokenDecimalsByAddress.call(void 0, resolvedTokenAddress, chainBalance.chainId) : _nullishCoalesce(tokenData.tokenDecimals, () => ( 18));
|
|
1789
1805
|
tokens.push({
|
|
1790
1806
|
chainId: chainBalance.chainId,
|
|
1791
1807
|
address: resolvedTokenAddress,
|
|
@@ -1805,28 +1821,28 @@ function normalizeOrchestratorPortfolio(data) {
|
|
|
1805
1821
|
function normalizeDirectToken(token) {
|
|
1806
1822
|
const rawChainId = _nullishCoalesce(extractNumber(token, "chainId"), () => ( extractNumber(token.chain, "id")));
|
|
1807
1823
|
const rawChainString = _nullishCoalesce(extractString(token, "chainId"), () => ( extractString(token.chain, "id")));
|
|
1808
|
-
const chainId = _nullishCoalesce(rawChainId, () => ( (rawChainString ?
|
|
1824
|
+
const chainId = _nullishCoalesce(rawChainId, () => ( (rawChainString ? _chunkTENL4H64cjs.isSolanaCaip2.call(void 0, rawChainString) || rawChainString.toLowerCase() === "solana" ? "solana" : (
|
|
1809
1825
|
// HyperCore (`hypercore:mainnet`) is a non-EVM source; keep its USDC
|
|
1810
1826
|
// instead of dropping it as an unparseable chain string.
|
|
1811
|
-
|
|
1827
|
+
_chunkTENL4H64cjs.isHyperCoreCaip2.call(void 0, rawChainString) || rawChainString.toLowerCase() === "hypercore" ? "hypercore" : _chunkTENL4H64cjs.parseEvmChainId.call(void 0, rawChainString)
|
|
1812
1828
|
) : null)));
|
|
1813
1829
|
if (chainId === null) return null;
|
|
1814
|
-
const registryChainId = typeof chainId === "number" ? chainId : chainId === "hypercore" ?
|
|
1830
|
+
const registryChainId = typeof chainId === "number" ? chainId : chainId === "hypercore" ? _chunkTENL4H64cjs.HYPERCORE_CHAIN_ID : void 0;
|
|
1815
1831
|
const symbol = _nullishCoalesce(_nullishCoalesce(_nullishCoalesce(extractString(token, "symbol"), () => ( extractString(token, "tokenSymbol"))), () => ( extractString(token, "tokenName"))), () => ( extractString(token, "name")));
|
|
1816
1832
|
if (!symbol) return null;
|
|
1817
|
-
const balanceValue = _nullishCoalesce(_nullishCoalesce(_nullishCoalesce(_nullishCoalesce(_nullishCoalesce(_nullishCoalesce(_nullishCoalesce(extractString(token, "balance"), () => ( extractString(token, "amount"))), () => ( extractString(token, "value"))), () => ( extractString(token, "rawBalance"))), () => ( _optionalChain([extractNumber, 'call',
|
|
1833
|
+
const balanceValue = _nullishCoalesce(_nullishCoalesce(_nullishCoalesce(_nullishCoalesce(_nullishCoalesce(_nullishCoalesce(_nullishCoalesce(extractString(token, "balance"), () => ( extractString(token, "amount"))), () => ( extractString(token, "value"))), () => ( extractString(token, "rawBalance"))), () => ( _optionalChain([extractNumber, 'call', _47 => _47(token, "balance"), 'optionalAccess', _48 => _48.toString, 'call', _49 => _49()]))), () => ( _optionalChain([extractNumber, 'call', _50 => _50(token, "amount"), 'optionalAccess', _51 => _51.toString, 'call', _52 => _52()]))), () => ( _optionalChain([extractNumber, 'call', _53 => _53(token, "value"), 'optionalAccess', _54 => _54.toString, 'call', _55 => _55()]))), () => ( _optionalChain([extractNumber, 'call', _56 => _56(token, "rawBalance"), 'optionalAccess', _57 => _57.toString, 'call', _58 => _58()])));
|
|
1818
1834
|
if (!balanceValue) return null;
|
|
1819
1835
|
const address = _nullishCoalesce(_nullishCoalesce(_nullishCoalesce(extractString(token, "address"), () => ( extractString(token, "tokenAddress"))), () => ( extractString(
|
|
1820
1836
|
token.token,
|
|
1821
1837
|
"address"
|
|
1822
|
-
))), () => ( (registryChainId !== void 0 ?
|
|
1838
|
+
))), () => ( (registryChainId !== void 0 ? _chunkTENL4H64cjs.getTokenAddress.call(void 0, symbol, registryChainId) : void 0)));
|
|
1823
1839
|
if (!address) return null;
|
|
1824
1840
|
const balanceUsd = _nullishCoalesce(_nullishCoalesce(_nullishCoalesce(_nullishCoalesce(_nullishCoalesce(_nullishCoalesce(extractNumber(token, "balanceUsd"), () => ( extractNumber(token, "usdValue"))), () => ( extractNumber(token, "valueUsd"))), () => ( extractNumericString(token, "balanceUsd"))), () => ( extractNumericString(token, "usdValue"))), () => ( extractNumericString(token, "valueUsd"))), () => ( 0));
|
|
1825
1841
|
const isSolanaToken = chainId === "solana";
|
|
1826
|
-
const registrySymbol = isSolanaToken ? "Token" :
|
|
1842
|
+
const registrySymbol = isSolanaToken ? "Token" : _chunkTENL4H64cjs.getTokenSymbol.call(void 0, address, registryChainId);
|
|
1827
1843
|
const resolvedSymbol = isSolanaToken ? symbol : registrySymbol !== "Token" ? registrySymbol : symbol;
|
|
1828
1844
|
const backendDecimals = _nullishCoalesce(extractNumber(token, "decimals"), () => ( extractNumber(token, "tokenDecimals")));
|
|
1829
|
-
const resolvedDecimals = !isSolanaToken && registrySymbol !== "Token" ?
|
|
1845
|
+
const resolvedDecimals = !isSolanaToken && registrySymbol !== "Token" ? _chunkTENL4H64cjs.getTokenDecimalsByAddress.call(void 0, address, registryChainId) : _nullishCoalesce(backendDecimals, () => ( 18));
|
|
1830
1846
|
return {
|
|
1831
1847
|
chainId,
|
|
1832
1848
|
address,
|
|
@@ -1839,7 +1855,7 @@ function normalizeDirectToken(token) {
|
|
|
1839
1855
|
}
|
|
1840
1856
|
function extractTokenAddress(tokenData, chainId) {
|
|
1841
1857
|
const token = tokenData;
|
|
1842
|
-
return _nullishCoalesce(_nullishCoalesce(_nullishCoalesce(_nullishCoalesce(token.tokenAddress, () => ( token.address)), () => ( _optionalChain([token, 'access',
|
|
1858
|
+
return _nullishCoalesce(_nullishCoalesce(_nullishCoalesce(_nullishCoalesce(token.tokenAddress, () => ( token.address)), () => ( _optionalChain([token, 'access', _59 => _59.addresses, 'optionalAccess', _60 => _60[chainId]]))), () => ( _optionalChain([token, 'access', _61 => _61.token, 'optionalAccess', _62 => _62.address]))), () => ( _optionalChain([token, 'access', _63 => _63.token, 'optionalAccess', _64 => _64.addresses, 'optionalAccess', _65 => _65[chainId]])));
|
|
1843
1859
|
}
|
|
1844
1860
|
function extractArray(data, key) {
|
|
1845
1861
|
if (!data || typeof data !== "object") return null;
|
|
@@ -1866,6 +1882,558 @@ function extractNumericString(data, key) {
|
|
|
1866
1882
|
return Number.isFinite(parsed) ? parsed : null;
|
|
1867
1883
|
}
|
|
1868
1884
|
|
|
1885
|
+
// src/core/rpc.ts
|
|
1886
|
+
|
|
1887
|
+
function rpcUrlFor(rpcUrls, chain) {
|
|
1888
|
+
const url = _optionalChain([rpcUrls, 'optionalAccess', _66 => _66[chain], 'optionalAccess', _67 => _67.trim, 'call', _68 => _68()]);
|
|
1889
|
+
return url ? url : void 0;
|
|
1890
|
+
}
|
|
1891
|
+
var RpcUrlsContext = _react.createContext.call(void 0, void 0);
|
|
1892
|
+
var RpcUrlsProvider = RpcUrlsContext.Provider;
|
|
1893
|
+
function useRpcUrls() {
|
|
1894
|
+
return _react.useContext.call(void 0, RpcUrlsContext);
|
|
1895
|
+
}
|
|
1896
|
+
function rpcUrlsKey(rpcUrls) {
|
|
1897
|
+
if (!rpcUrls) return "";
|
|
1898
|
+
return Object.entries(rpcUrls).map(([chain, url]) => [chain, _nullishCoalesce(_optionalChain([url, 'optionalAccess', _69 => _69.trim, 'call', _70 => _70()]), () => ( ""))]).filter(([, url]) => url !== "").map(([chain, url]) => `${chain}=${url}`).sort().join("|");
|
|
1899
|
+
}
|
|
1900
|
+
function useStableRpcUrls(rpcUrls) {
|
|
1901
|
+
const key = rpcUrlsKey(rpcUrls);
|
|
1902
|
+
return _react.useMemo.call(void 0, () => rpcUrls, [key]);
|
|
1903
|
+
}
|
|
1904
|
+
|
|
1905
|
+
// src/core/chain-catalog-context.tsx
|
|
1906
|
+
|
|
1907
|
+
|
|
1908
|
+
|
|
1909
|
+
|
|
1910
|
+
|
|
1911
|
+
|
|
1912
|
+
|
|
1913
|
+
|
|
1914
|
+
// src/core/public-client.ts
|
|
1915
|
+
|
|
1916
|
+
var clientCache = /* @__PURE__ */ new Map();
|
|
1917
|
+
var runtimeChainById = /* @__PURE__ */ new Map();
|
|
1918
|
+
function setRuntimeChains(chains) {
|
|
1919
|
+
for (const chain of chains) {
|
|
1920
|
+
const known = runtimeChainById.get(chain.id);
|
|
1921
|
+
if (known === chain) continue;
|
|
1922
|
+
runtimeChainById.set(chain.id, chain);
|
|
1923
|
+
for (const key of clientCache.keys()) {
|
|
1924
|
+
if (key.startsWith(`${chain.id}|`)) clientCache.delete(key);
|
|
1925
|
+
}
|
|
1926
|
+
}
|
|
1927
|
+
}
|
|
1928
|
+
function getPublicClient(chainId, rpcUrls) {
|
|
1929
|
+
const url = rpcUrlFor(rpcUrls, chainId);
|
|
1930
|
+
const cacheKey = `${chainId}|${_nullishCoalesce(url, () => ( ""))}`;
|
|
1931
|
+
let client = clientCache.get(cacheKey);
|
|
1932
|
+
if (!client) {
|
|
1933
|
+
const chain = _nullishCoalesce(_chunkTENL4H64cjs.CHAIN_BY_ID[chainId], () => ( runtimeChainById.get(chainId)));
|
|
1934
|
+
client = _viem.createPublicClient.call(void 0, {
|
|
1935
|
+
chain,
|
|
1936
|
+
transport: _viem.http.call(void 0, url)
|
|
1937
|
+
});
|
|
1938
|
+
clientCache.set(cacheKey, client);
|
|
1939
|
+
}
|
|
1940
|
+
return client;
|
|
1941
|
+
}
|
|
1942
|
+
|
|
1943
|
+
// src/core/chain-objects.ts
|
|
1944
|
+
|
|
1945
|
+
var viemChainsById = null;
|
|
1946
|
+
var viemChainsPromise = null;
|
|
1947
|
+
async function loadViemChains() {
|
|
1948
|
+
if (viemChainsById) return viemChainsById;
|
|
1949
|
+
if (!viemChainsPromise) {
|
|
1950
|
+
viemChainsPromise = Promise.resolve().then(() => _interopRequireWildcard(require("viem/chains"))).then((module) => {
|
|
1951
|
+
const map = /* @__PURE__ */ new Map();
|
|
1952
|
+
for (const value of Object.values(module)) {
|
|
1953
|
+
if (value && typeof value === "object" && typeof value.id === "number" && _optionalChain([value, 'access', _71 => _71.rpcUrls, 'optionalAccess', _72 => _72.default, 'optionalAccess', _73 => _73.http, 'optionalAccess', _74 => _74.length])) {
|
|
1954
|
+
const chain = value;
|
|
1955
|
+
const existing = map.get(chain.id);
|
|
1956
|
+
if (existing) existing.push(chain);
|
|
1957
|
+
else map.set(chain.id, [chain]);
|
|
1958
|
+
}
|
|
1959
|
+
}
|
|
1960
|
+
viemChainsById = map;
|
|
1961
|
+
return map;
|
|
1962
|
+
});
|
|
1963
|
+
}
|
|
1964
|
+
return viemChainsPromise;
|
|
1965
|
+
}
|
|
1966
|
+
function pickViemChain(candidates, chain) {
|
|
1967
|
+
if (!_optionalChain([candidates, 'optionalAccess', _75 => _75.length])) return void 0;
|
|
1968
|
+
if (candidates.length === 1) return candidates[0];
|
|
1969
|
+
const sameNetworkClass = candidates.filter(
|
|
1970
|
+
(candidate) => Boolean(candidate.testnet) === chain.testnet
|
|
1971
|
+
);
|
|
1972
|
+
if (sameNetworkClass.length === 1) return sameNetworkClass[0];
|
|
1973
|
+
const pool = sameNetworkClass.length > 0 ? sameNetworkClass : candidates;
|
|
1974
|
+
const normalized = chain.name.toLowerCase().replace(/\s+/g, "");
|
|
1975
|
+
const byName = pool.find(
|
|
1976
|
+
(candidate) => candidate.name.toLowerCase().replace(/\s+/g, "") === normalized
|
|
1977
|
+
);
|
|
1978
|
+
if (byName) return byName;
|
|
1979
|
+
return void 0;
|
|
1980
|
+
}
|
|
1981
|
+
function resolveRpcUrls(chain, override, viemChains) {
|
|
1982
|
+
const urls = [];
|
|
1983
|
+
if (_optionalChain([override, 'optionalAccess', _76 => _76.trim, 'call', _77 => _77()])) urls.push(override.trim());
|
|
1984
|
+
if (chain.publicRpcUrl) urls.push(chain.publicRpcUrl);
|
|
1985
|
+
if (chain.chainId !== null && chain.vmType === "evm") {
|
|
1986
|
+
const http2 = _optionalChain([pickViemChain, 'call', _78 => _78(_optionalChain([viemChains, 'optionalAccess', _79 => _79.get, 'call', _80 => _80(chain.chainId)]), chain), 'optionalAccess', _81 => _81.rpcUrls, 'optionalAccess', _82 => _82.default, 'optionalAccess', _83 => _83.http]);
|
|
1987
|
+
if (http2) urls.push(...http2);
|
|
1988
|
+
}
|
|
1989
|
+
return [...new Set(urls)];
|
|
1990
|
+
}
|
|
1991
|
+
function toViemChain(chain, override, viemChains) {
|
|
1992
|
+
if (chain.vmType !== "evm" || chain.chainId === null) return null;
|
|
1993
|
+
const rpcUrls = resolveRpcUrls(chain, override, viemChains);
|
|
1994
|
+
if (rpcUrls.length === 0) return null;
|
|
1995
|
+
const bundled = pickViemChain(_optionalChain([viemChains, 'optionalAccess', _84 => _84.get, 'call', _85 => _85(chain.chainId)]), chain);
|
|
1996
|
+
if (bundled) {
|
|
1997
|
+
if (rpcUrls[0] === bundled.rpcUrls.default.http[0]) return bundled;
|
|
1998
|
+
return _viem.defineChain.call(void 0, {
|
|
1999
|
+
...bundled,
|
|
2000
|
+
rpcUrls: { ...bundled.rpcUrls, default: { http: rpcUrls } }
|
|
2001
|
+
});
|
|
2002
|
+
}
|
|
2003
|
+
return _viem.defineChain.call(void 0, {
|
|
2004
|
+
id: chain.chainId,
|
|
2005
|
+
name: chain.name,
|
|
2006
|
+
nativeCurrency: {
|
|
2007
|
+
name: chain.nativeToken.symbol,
|
|
2008
|
+
symbol: chain.nativeToken.symbol,
|
|
2009
|
+
decimals: chain.nativeToken.decimals
|
|
2010
|
+
},
|
|
2011
|
+
rpcUrls: { default: { http: rpcUrls } },
|
|
2012
|
+
blockExplorers: chain.explorer ? {
|
|
2013
|
+
default: {
|
|
2014
|
+
name: "Explorer",
|
|
2015
|
+
url: chain.explorer.url
|
|
2016
|
+
}
|
|
2017
|
+
} : void 0,
|
|
2018
|
+
testnet: chain.testnet
|
|
2019
|
+
});
|
|
2020
|
+
}
|
|
2021
|
+
function toViemChains(catalog, overrides, viemChains) {
|
|
2022
|
+
const chains = [];
|
|
2023
|
+
for (const entry of catalog.all) {
|
|
2024
|
+
const chain = toViemChain(
|
|
2025
|
+
entry,
|
|
2026
|
+
entry.chainId === null ? void 0 : _optionalChain([overrides, 'optionalAccess', _86 => _86[entry.chainId]]),
|
|
2027
|
+
viemChains
|
|
2028
|
+
);
|
|
2029
|
+
if (chain) chains.push(chain);
|
|
2030
|
+
}
|
|
2031
|
+
return chains;
|
|
2032
|
+
}
|
|
2033
|
+
function needsViemChains(catalog, overrides) {
|
|
2034
|
+
return catalog.all.some(
|
|
2035
|
+
(chain) => chain.vmType === "evm" && chain.chainId !== null && !chain.publicRpcUrl && !_optionalChain([overrides, 'optionalAccess', _87 => _87[chain.chainId], 'optionalAccess', _88 => _88.trim, 'call', _89 => _89()])
|
|
2036
|
+
);
|
|
2037
|
+
}
|
|
2038
|
+
|
|
2039
|
+
// src/core/chain-catalog-context.tsx
|
|
2040
|
+
|
|
2041
|
+
var EMPTY = {
|
|
2042
|
+
catalog: null,
|
|
2043
|
+
viemChains: null,
|
|
2044
|
+
isLoading: true,
|
|
2045
|
+
shortlist: null,
|
|
2046
|
+
clientCapableChainIds: null
|
|
2047
|
+
};
|
|
2048
|
+
var ChainCatalogContext = _react.createContext.call(void 0, EMPTY);
|
|
2049
|
+
var resolvedChainsByKey = /* @__PURE__ */ new Map();
|
|
2050
|
+
function overridesKey(overrides) {
|
|
2051
|
+
return Object.entries(_nullishCoalesce(overrides, () => ( {}))).map(([id, override]) => `${id}=${_nullishCoalesce(override, () => ( ""))}`).sort().join("|");
|
|
2052
|
+
}
|
|
2053
|
+
function runtimeChainsKey(backendUrl, overrides) {
|
|
2054
|
+
return [backendUrl.replace(/\/$/, ""), overridesKey(overrides)].join("#");
|
|
2055
|
+
}
|
|
2056
|
+
var catalogByBackend = /* @__PURE__ */ new Map();
|
|
2057
|
+
function primeChainCatalog(backendUrl, debug = false) {
|
|
2058
|
+
const key = backendUrl.replace(/\/$/, "");
|
|
2059
|
+
let promise = catalogByBackend.get(key);
|
|
2060
|
+
if (!promise) {
|
|
2061
|
+
promise = createDepositService(key, {
|
|
2062
|
+
debug,
|
|
2063
|
+
debugScope: "service:chains"
|
|
2064
|
+
}).getChains();
|
|
2065
|
+
catalogByBackend.set(key, promise);
|
|
2066
|
+
promise.then((catalog) => {
|
|
2067
|
+
if (!catalog) catalogByBackend.delete(key);
|
|
2068
|
+
});
|
|
2069
|
+
}
|
|
2070
|
+
return promise;
|
|
2071
|
+
}
|
|
2072
|
+
function peekRuntimeChains(backendUrl, overrides) {
|
|
2073
|
+
return _nullishCoalesce(resolvedChainsByKey.get(runtimeChainsKey(backendUrl, overrides)), () => ( null));
|
|
2074
|
+
}
|
|
2075
|
+
function publishCatalogTokens(catalog) {
|
|
2076
|
+
_chunkTENL4H64cjs.setRuntimeTokens.call(void 0,
|
|
2077
|
+
catalog.all.flatMap(
|
|
2078
|
+
(chain) => chain.chainId === null || !Array.isArray(chain.supportedTokens) ? [] : chain.supportedTokens.map((token) => ({
|
|
2079
|
+
chainId: chain.chainId,
|
|
2080
|
+
symbol: token.symbol,
|
|
2081
|
+
address: token.address,
|
|
2082
|
+
decimals: token.decimals
|
|
2083
|
+
}))
|
|
2084
|
+
)
|
|
2085
|
+
);
|
|
2086
|
+
}
|
|
2087
|
+
function publishRuntimeChainMeta(catalog) {
|
|
2088
|
+
_chunkTENL4H64cjs.setRuntimeChainMeta.call(void 0,
|
|
2089
|
+
catalog.all.flatMap((chain) => {
|
|
2090
|
+
const ids = [];
|
|
2091
|
+
if (chain.chainId !== null) ids.push(chain.chainId);
|
|
2092
|
+
if (chain.caip2 === _chunkTENL4H64cjs.HYPERCORE_MAINNET_CAIP2) ids.push(_chunkTENL4H64cjs.HYPERCORE_CHAIN_ID);
|
|
2093
|
+
return ids.map((chainId) => ({
|
|
2094
|
+
chainId,
|
|
2095
|
+
name: chain.name,
|
|
2096
|
+
iconUrl: _nullishCoalesce(chain.iconUrl, () => ( void 0)),
|
|
2097
|
+
nativeSymbol: chain.nativeToken.symbol
|
|
2098
|
+
}));
|
|
2099
|
+
})
|
|
2100
|
+
);
|
|
2101
|
+
}
|
|
2102
|
+
var runtimeChainsByBackend = /* @__PURE__ */ new Map();
|
|
2103
|
+
function primeRuntimeChains(backendUrl, overrides, debug = false) {
|
|
2104
|
+
const url = backendUrl.replace(/\/$/, "");
|
|
2105
|
+
const key = runtimeChainsKey(url, overrides);
|
|
2106
|
+
let promise = runtimeChainsByBackend.get(key);
|
|
2107
|
+
if (!promise) {
|
|
2108
|
+
promise = primeChainCatalog(url, debug).then(async (catalog) => {
|
|
2109
|
+
if (!catalog) return [];
|
|
2110
|
+
publishRuntimeChainMeta(catalog);
|
|
2111
|
+
publishCatalogTokens(catalog);
|
|
2112
|
+
const viemChains = needsViemChains(catalog, overrides) ? await loadViemChains() : null;
|
|
2113
|
+
const chains = toViemChains(catalog, overrides, viemChains);
|
|
2114
|
+
if (chains.length > 0) {
|
|
2115
|
+
setRuntimeChains(chains);
|
|
2116
|
+
resolvedChainsByKey.set(key, chains);
|
|
2117
|
+
}
|
|
2118
|
+
return chains;
|
|
2119
|
+
}).catch(() => []);
|
|
2120
|
+
runtimeChainsByBackend.set(key, promise);
|
|
2121
|
+
promise.then((chains) => {
|
|
2122
|
+
if (chains.length === 0) runtimeChainsByBackend.delete(key);
|
|
2123
|
+
});
|
|
2124
|
+
}
|
|
2125
|
+
return promise;
|
|
2126
|
+
}
|
|
2127
|
+
function useChainCatalog() {
|
|
2128
|
+
return _react.useContext.call(void 0, ChainCatalogContext);
|
|
2129
|
+
}
|
|
2130
|
+
function useCatalogChain(chainId) {
|
|
2131
|
+
const { catalog } = useChainCatalog();
|
|
2132
|
+
if (!catalog || chainId == null) return void 0;
|
|
2133
|
+
return typeof chainId === "number" ? catalog.byChainId.get(chainId) : catalog.byCaip2.get(chainId);
|
|
2134
|
+
}
|
|
2135
|
+
function useDepositChainIds() {
|
|
2136
|
+
const { catalog } = useChainCatalog();
|
|
2137
|
+
return _react.useMemo.call(void 0, () => {
|
|
2138
|
+
if (!catalog) return _chunkTENL4H64cjs.getSupportedChainIds.call(void 0, );
|
|
2139
|
+
const ids = catalog.all.filter(
|
|
2140
|
+
(c) => c.deposit && c.vmType === "evm" && c.chainId !== null && // `/chains` enumerates testnets; the bundled list never did, and a
|
|
2141
|
+
// production picker offering Sepolia next to Ethereum is a way to
|
|
2142
|
+
// lose funds. Reading the set at runtime must not quietly widen it
|
|
2143
|
+
// to a different KIND of chain.
|
|
2144
|
+
!c.testnet
|
|
2145
|
+
).map((c) => c.chainId);
|
|
2146
|
+
const rank = (id) => {
|
|
2147
|
+
const i = _chunkTENL4H64cjs.CHAIN_DISPLAY_ORDER.indexOf(id);
|
|
2148
|
+
return i === -1 ? _chunkTENL4H64cjs.CHAIN_DISPLAY_ORDER.length : i;
|
|
2149
|
+
};
|
|
2150
|
+
return ids.map((id, i) => ({ id, i })).sort((a, b) => rank(a.id) - rank(b.id) || a.i - b.i).map(({ id }) => id);
|
|
2151
|
+
}, [catalog]);
|
|
2152
|
+
}
|
|
2153
|
+
function useDestinationChains() {
|
|
2154
|
+
const { catalog } = useChainCatalog();
|
|
2155
|
+
return _react.useMemo.call(void 0, () => {
|
|
2156
|
+
if (!catalog) {
|
|
2157
|
+
return _chunkTENL4H64cjs.SOURCE_CHAINS.filter(
|
|
2158
|
+
(chain) => _chunkTENL4H64cjs.getSupportedTargetTokens.call(void 0, chain.id).length > 0
|
|
2159
|
+
).map((chain) => ({ id: chain.id, name: chain.name }));
|
|
2160
|
+
}
|
|
2161
|
+
const rank = (id) => {
|
|
2162
|
+
const i = _chunkTENL4H64cjs.CHAIN_DISPLAY_ORDER.indexOf(id);
|
|
2163
|
+
return i === -1 ? _chunkTENL4H64cjs.CHAIN_DISPLAY_ORDER.length : i;
|
|
2164
|
+
};
|
|
2165
|
+
return catalog.all.filter(
|
|
2166
|
+
(c) => c.destination && c.vmType === "evm" && c.chainId !== null && !c.testnet
|
|
2167
|
+
).map((c, i) => ({ id: c.chainId, name: c.name, i })).sort((a, b) => rank(a.id) - rank(b.id) || a.i - b.i).map(({ id, name }) => ({ id, name }));
|
|
2168
|
+
}, [catalog]);
|
|
2169
|
+
}
|
|
2170
|
+
function useTargetTokens() {
|
|
2171
|
+
const { catalog, shortlist } = useChainCatalog();
|
|
2172
|
+
return _react.useMemo.call(void 0, () => {
|
|
2173
|
+
return (chainId) => {
|
|
2174
|
+
const bundled = _chunkTENL4H64cjs.getBundledTargetTokens.call(void 0, chainId);
|
|
2175
|
+
if (bundled.length > 0) return bundled;
|
|
2176
|
+
const fromShortlist = _optionalChain([shortlist, 'optionalAccess', _90 => _90[String(chainId)]]);
|
|
2177
|
+
if (_optionalChain([fromShortlist, 'optionalAccess', _91 => _91.length])) {
|
|
2178
|
+
return fromShortlist.map((token) => ({
|
|
2179
|
+
symbol: token.symbol,
|
|
2180
|
+
address: token.address,
|
|
2181
|
+
decimals: token.decimals
|
|
2182
|
+
}));
|
|
2183
|
+
}
|
|
2184
|
+
const entry = _optionalChain([catalog, 'optionalAccess', _92 => _92.byChainId, 'access', _93 => _93.get, 'call', _94 => _94(chainId)]);
|
|
2185
|
+
return Array.isArray(_optionalChain([entry, 'optionalAccess', _95 => _95.supportedTokens])) ? entry.supportedTokens.map((token) => ({
|
|
2186
|
+
symbol: token.symbol,
|
|
2187
|
+
address: token.address,
|
|
2188
|
+
decimals: token.decimals
|
|
2189
|
+
})) : [];
|
|
2190
|
+
};
|
|
2191
|
+
}, [catalog, shortlist]);
|
|
2192
|
+
}
|
|
2193
|
+
function useIsDepositChain() {
|
|
2194
|
+
const ids = useDepositChainIds();
|
|
2195
|
+
const { clientCapableChainIds } = useChainCatalog();
|
|
2196
|
+
return _react.useMemo.call(void 0, () => {
|
|
2197
|
+
const set = new Set(ids);
|
|
2198
|
+
return (chainId) => set.has(chainId) && (clientCapableChainIds === null || clientCapableChainIds.has(chainId));
|
|
2199
|
+
}, [ids, clientCapableChainIds]);
|
|
2200
|
+
}
|
|
2201
|
+
function useChainName() {
|
|
2202
|
+
const { catalog } = useChainCatalog();
|
|
2203
|
+
return _react.useMemo.call(void 0, () => {
|
|
2204
|
+
return (chainId) => {
|
|
2205
|
+
if (!catalog) return _chunkTENL4H64cjs.getChainName.call(void 0, chainId);
|
|
2206
|
+
const key = catalogKeyForChain(chainId);
|
|
2207
|
+
const entry = typeof key === "number" ? catalog.byChainId.get(key) : catalog.byCaip2.get(key);
|
|
2208
|
+
return _nullishCoalesce(_optionalChain([entry, 'optionalAccess', _96 => _96.name]), () => ( _chunkTENL4H64cjs.getChainName.call(void 0, chainId)));
|
|
2209
|
+
};
|
|
2210
|
+
}, [catalog]);
|
|
2211
|
+
}
|
|
2212
|
+
function useExplorerTxUrl() {
|
|
2213
|
+
const { catalog } = useChainCatalog();
|
|
2214
|
+
return _react.useMemo.call(void 0, () => {
|
|
2215
|
+
return (chainId, txHash) => {
|
|
2216
|
+
if (chainId === "hypercore") return _chunkTENL4H64cjs.getExplorerTxUrl.call(void 0, chainId, txHash);
|
|
2217
|
+
const key = catalog ? catalogKeyForChain(chainId) : void 0;
|
|
2218
|
+
const entry = key === void 0 ? void 0 : typeof key === "number" ? _optionalChain([catalog, 'optionalAccess', _97 => _97.byChainId, 'access', _98 => _98.get, 'call', _99 => _99(key)]) : _optionalChain([catalog, 'optionalAccess', _100 => _100.byCaip2, 'access', _101 => _101.get, 'call', _102 => _102(key)]);
|
|
2219
|
+
return _nullishCoalesce(catalogExplorerTxUrl(entry, txHash), () => ( _chunkTENL4H64cjs.getExplorerTxUrl.call(void 0, chainId, txHash)));
|
|
2220
|
+
};
|
|
2221
|
+
}, [catalog]);
|
|
2222
|
+
}
|
|
2223
|
+
function ChainCatalogProvider({
|
|
2224
|
+
service,
|
|
2225
|
+
rpcUrls,
|
|
2226
|
+
children
|
|
2227
|
+
}) {
|
|
2228
|
+
const [catalog, setCatalog] = _react.useState.call(void 0, null);
|
|
2229
|
+
const [viemChains, setViemChains] = _react.useState.call(void 0, null);
|
|
2230
|
+
const [isLoading, setIsLoading] = _react.useState.call(void 0, true);
|
|
2231
|
+
_react.useEffect.call(void 0, () => {
|
|
2232
|
+
let active = true;
|
|
2233
|
+
setIsLoading(true);
|
|
2234
|
+
service.getChains().then((next) => {
|
|
2235
|
+
if (!active) return;
|
|
2236
|
+
setCatalog(next);
|
|
2237
|
+
setIsLoading(false);
|
|
2238
|
+
});
|
|
2239
|
+
return () => {
|
|
2240
|
+
active = false;
|
|
2241
|
+
};
|
|
2242
|
+
}, [service]);
|
|
2243
|
+
const overrides = _react.useMemo.call(void 0, () => {
|
|
2244
|
+
if (!rpcUrls) return void 0;
|
|
2245
|
+
const out = {};
|
|
2246
|
+
for (const [key, url] of Object.entries(rpcUrls)) {
|
|
2247
|
+
const id = Number(key);
|
|
2248
|
+
if (Number.isFinite(id) && typeof url === "string") out[id] = url;
|
|
2249
|
+
}
|
|
2250
|
+
return out;
|
|
2251
|
+
}, [rpcUrls]);
|
|
2252
|
+
const overrideKey = overridesKey(overrides);
|
|
2253
|
+
_react.useEffect.call(void 0, () => {
|
|
2254
|
+
if (!catalog || viemChains) return;
|
|
2255
|
+
if (!needsViemChains(catalog, overrides)) return;
|
|
2256
|
+
let active = true;
|
|
2257
|
+
loadViemChains().then((chains) => {
|
|
2258
|
+
if (active) setViemChains(chains);
|
|
2259
|
+
});
|
|
2260
|
+
return () => {
|
|
2261
|
+
active = false;
|
|
2262
|
+
};
|
|
2263
|
+
}, [catalog, viemChains, overrideKey]);
|
|
2264
|
+
_react.useEffect.call(void 0, () => {
|
|
2265
|
+
if (!catalog) return;
|
|
2266
|
+
publishRuntimeChainMeta(catalog);
|
|
2267
|
+
publishCatalogTokens(catalog);
|
|
2268
|
+
const chains = toViemChains(catalog, overrides, viemChains);
|
|
2269
|
+
if (chains.length > 0) setRuntimeChains(chains);
|
|
2270
|
+
}, [catalog, viemChains, overrides]);
|
|
2271
|
+
const [shortlist, setShortlist] = _react.useState.call(void 0, null);
|
|
2272
|
+
_react.useEffect.call(void 0, () => {
|
|
2273
|
+
let active = true;
|
|
2274
|
+
setShortlist(null);
|
|
2275
|
+
service.getTopTokens().then((tokens) => {
|
|
2276
|
+
if (!active || !tokens) return;
|
|
2277
|
+
_chunkTENL4H64cjs.publishShortlistTokens.call(void 0, tokens);
|
|
2278
|
+
setShortlist(tokens);
|
|
2279
|
+
});
|
|
2280
|
+
return () => {
|
|
2281
|
+
active = false;
|
|
2282
|
+
};
|
|
2283
|
+
}, [service]);
|
|
2284
|
+
const clientCapableChainIds = _react.useMemo.call(void 0, () => {
|
|
2285
|
+
if (!catalog) return null;
|
|
2286
|
+
return new Set(
|
|
2287
|
+
toViemChains(catalog, overrides, viemChains).map((c) => c.id)
|
|
2288
|
+
);
|
|
2289
|
+
}, [catalog, viemChains, overrideKey]);
|
|
2290
|
+
const value = _react.useMemo.call(void 0,
|
|
2291
|
+
() => ({
|
|
2292
|
+
catalog,
|
|
2293
|
+
viemChains,
|
|
2294
|
+
isLoading,
|
|
2295
|
+
shortlist,
|
|
2296
|
+
clientCapableChainIds
|
|
2297
|
+
}),
|
|
2298
|
+
[catalog, viemChains, isLoading, shortlist, clientCapableChainIds]
|
|
2299
|
+
);
|
|
2300
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ChainCatalogContext.Provider, { value, children });
|
|
2301
|
+
}
|
|
2302
|
+
|
|
2303
|
+
// src/core/useLatestRef.ts
|
|
2304
|
+
|
|
2305
|
+
function useLatestRef(value) {
|
|
2306
|
+
const ref = _react.useRef.call(void 0, value);
|
|
2307
|
+
_react.useEffect.call(void 0, () => {
|
|
2308
|
+
ref.current = value;
|
|
2309
|
+
}, [value]);
|
|
2310
|
+
return ref;
|
|
2311
|
+
}
|
|
2312
|
+
|
|
2313
|
+
// src/components/ui/Spinner.tsx
|
|
2314
|
+
|
|
2315
|
+
function Spinner({ className }) {
|
|
2316
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2317
|
+
"svg",
|
|
2318
|
+
{
|
|
2319
|
+
className: `rs-spinner ${className || ""}`,
|
|
2320
|
+
fill: "none",
|
|
2321
|
+
viewBox: "0 0 20 21",
|
|
2322
|
+
children: [
|
|
2323
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2324
|
+
"path",
|
|
2325
|
+
{
|
|
2326
|
+
d: "M10 0.5C8.02 0.5 6.08 1.08 4.44 2.18C2.79 3.28 1.51 4.84 0.76 6.67C0.00 8.50 -0.19 10.51 0.19 12.45C0.57 14.39 1.53 16.17 2.92 17.57C4.32 18.96 6.10 19.92 8.04 20.30C9.98 20.69 11.99 20.49 13.82 19.73C15.65 18.98 17.21 17.70 18.31 16.05C19.41 14.41 20 12.47 20 10.5C20 7.84 18.94 5.30 17.07 3.42C15.19 1.55 12.65 0.5 10 0.5ZM10 17.77C8.56 17.77 7.15 17.34 5.95 16.54C4.76 15.74 3.83 14.61 3.28 13.28C2.73 11.95 2.58 10.49 2.86 9.08C3.14 7.67 3.84 6.37 4.85 5.35C5.87 4.34 7.17 3.64 8.58 3.36C9.99 3.08 11.45 3.23 12.78 3.78C14.11 4.33 15.24 5.26 16.04 6.45C16.84 7.65 17.27 9.06 17.27 10.5C17.27 12.42 16.50 14.27 15.14 15.64C13.77 17.00 11.92 17.77 10 17.77Z",
|
|
2327
|
+
fill: "currentColor",
|
|
2328
|
+
opacity: 0.3
|
|
2329
|
+
}
|
|
2330
|
+
),
|
|
2331
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2332
|
+
"path",
|
|
2333
|
+
{
|
|
2334
|
+
d: "M10 3.22C11.74 3.22 13.42 3.84 14.75 4.95C16.08 6.07 16.96 7.61 17.25 9.31C17.30 9.64 17.46 9.94 17.71 10.15C17.96 10.37 18.28 10.49 18.62 10.5C18.82 10.50 19.01 10.45 19.20 10.37C19.38 10.29 19.54 10.16 19.67 10.01C19.80 9.86 19.89 9.68 19.95 9.49C20.00 9.30 20.01 9.10 19.98 8.90C19.59 6.56 18.38 4.42 16.55 2.88C14.72 1.34 12.40 0.5 10 0.5C7.59 0.5 5.27 1.34 3.44 2.88C1.61 4.42 0.40 6.56 0.01 8.90C-0.01 9.10 -0.00 9.30 0.04 9.49C0.10 9.68 0.19 9.86 0.32 10.01C0.45 10.16 0.61 10.29 0.79 10.37C0.98 10.45 1.17 10.50 1.37 10.5C1.71 10.49 2.03 10.37 2.28 10.15C2.53 9.94 2.69 9.64 2.74 9.31C3.03 7.61 3.91 6.07 5.24 4.95C6.57 3.84 8.25 3.22 10 3.22Z",
|
|
2335
|
+
fill: "currentColor"
|
|
2336
|
+
}
|
|
2337
|
+
)
|
|
2338
|
+
]
|
|
2339
|
+
}
|
|
2340
|
+
);
|
|
2341
|
+
}
|
|
2342
|
+
|
|
2343
|
+
// src/components/ui/Button.tsx
|
|
2344
|
+
|
|
2345
|
+
function Button({
|
|
2346
|
+
children,
|
|
2347
|
+
variant = "accent",
|
|
2348
|
+
size = "default",
|
|
2349
|
+
loading = false,
|
|
2350
|
+
loadingText,
|
|
2351
|
+
fullWidth = false,
|
|
2352
|
+
disabled,
|
|
2353
|
+
className = "",
|
|
2354
|
+
...props
|
|
2355
|
+
}) {
|
|
2356
|
+
const classes = [
|
|
2357
|
+
"rs-button",
|
|
2358
|
+
`rs-button--${variant}`,
|
|
2359
|
+
`rs-button--size-${size}`,
|
|
2360
|
+
fullWidth ? "rs-button--full-width" : "",
|
|
2361
|
+
className
|
|
2362
|
+
].filter(Boolean).join(" ");
|
|
2363
|
+
const showInlineLoadingText = loading && loadingText !== void 0;
|
|
2364
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2365
|
+
"button",
|
|
2366
|
+
{
|
|
2367
|
+
className: classes,
|
|
2368
|
+
disabled: disabled || loading,
|
|
2369
|
+
"aria-busy": loading || void 0,
|
|
2370
|
+
...props,
|
|
2371
|
+
children: showInlineLoadingText ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "rs-button__loading-row", children: [
|
|
2372
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Spinner, { className: "rs-spinner--sm" }),
|
|
2373
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: loadingText })
|
|
2374
|
+
] }) : /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
2375
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: loading ? "rs-button__content--hidden" : "", children }),
|
|
2376
|
+
loading && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-button__spinner", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Spinner, { className: "rs-spinner--sm" }) })
|
|
2377
|
+
] })
|
|
2378
|
+
}
|
|
2379
|
+
);
|
|
2380
|
+
}
|
|
2381
|
+
Button.displayName = "Button";
|
|
2382
|
+
|
|
2383
|
+
// src/components/ui/Callout.tsx
|
|
2384
|
+
|
|
2385
|
+
function CircleAlertIcon() {
|
|
2386
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2387
|
+
"svg",
|
|
2388
|
+
{
|
|
2389
|
+
width: "16",
|
|
2390
|
+
height: "16",
|
|
2391
|
+
viewBox: "0 0 16 16",
|
|
2392
|
+
fill: "none",
|
|
2393
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
2394
|
+
"aria-hidden": "true",
|
|
2395
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2396
|
+
"path",
|
|
2397
|
+
{
|
|
2398
|
+
d: "M10 5.99L6 9.99M6 5.99L10 9.99M14.66 7.99C14.66 11.68 11.68 14.66 8 14.66C4.31 14.66 1.33 11.68 1.33 7.99C1.33 4.31 4.31 1.33 8 1.33C11.68 1.33 14.66 4.31 14.66 7.99Z",
|
|
2399
|
+
stroke: "currentColor",
|
|
2400
|
+
strokeWidth: "1.33",
|
|
2401
|
+
strokeLinecap: "round",
|
|
2402
|
+
strokeLinejoin: "round"
|
|
2403
|
+
}
|
|
2404
|
+
)
|
|
2405
|
+
}
|
|
2406
|
+
);
|
|
2407
|
+
}
|
|
2408
|
+
function Callout({ variant = "error", children, role }) {
|
|
2409
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2410
|
+
"div",
|
|
2411
|
+
{
|
|
2412
|
+
className: `rs-callout rs-callout--${variant}`,
|
|
2413
|
+
role: _nullishCoalesce(role, () => ( (variant === "error" ? "alert" : "status"))),
|
|
2414
|
+
children: [
|
|
2415
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-callout-icon", children: variant === "error" ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, CircleAlertIcon, {}) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, AlertTriangleIcon, {}) }),
|
|
2416
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-callout-text", children })
|
|
2417
|
+
]
|
|
2418
|
+
}
|
|
2419
|
+
);
|
|
2420
|
+
}
|
|
2421
|
+
Callout.displayName = "Callout";
|
|
2422
|
+
|
|
2423
|
+
// src/components/ui/TokenIcon.tsx
|
|
2424
|
+
|
|
2425
|
+
function TokenIcon({ symbol, className, fallback }) {
|
|
2426
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2427
|
+
CdnIcon,
|
|
2428
|
+
{
|
|
2429
|
+
src: _chunkTENL4H64cjs.tokenIconUrl.call(void 0, symbol),
|
|
2430
|
+
className: `rs-token-icon ${_nullishCoalesce(className, () => ( ""))}`.trimEnd(),
|
|
2431
|
+
fallback
|
|
2432
|
+
}
|
|
2433
|
+
);
|
|
2434
|
+
}
|
|
2435
|
+
TokenIcon.displayName = "TokenIcon";
|
|
2436
|
+
|
|
1869
2437
|
// src/core/formatters.ts
|
|
1870
2438
|
var currencyFormatter = new Intl.NumberFormat("en-US", {
|
|
1871
2439
|
style: "currency",
|
|
@@ -1882,6 +2450,22 @@ function isUnsupportedChainSwitchError(error) {
|
|
|
1882
2450
|
const message = (error instanceof Error ? error.message : String(error)).toLowerCase();
|
|
1883
2451
|
return name === "SwitchChainNotSupportedError" || message.includes("does not support programmatic chain switching") || message.includes("switch chain not supported") || message.includes("method not found") || message.includes("does not exist") || message.includes("is not available");
|
|
1884
2452
|
}
|
|
2453
|
+
var OPAQUE_REVERT_REASONS = [
|
|
2454
|
+
"unexpected error",
|
|
2455
|
+
"internal error",
|
|
2456
|
+
"unknown error",
|
|
2457
|
+
"internal json-rpc error"
|
|
2458
|
+
];
|
|
2459
|
+
var DETAIL_SECTION_HEADINGS = [
|
|
2460
|
+
"Request Arguments:",
|
|
2461
|
+
"Raw Call Arguments:",
|
|
2462
|
+
"Request body:",
|
|
2463
|
+
"Contract Call:",
|
|
2464
|
+
"Docs:",
|
|
2465
|
+
"Details:",
|
|
2466
|
+
"Version:",
|
|
2467
|
+
"URL:"
|
|
2468
|
+
];
|
|
1885
2469
|
function formatUserError(raw) {
|
|
1886
2470
|
const lower = raw.toLowerCase();
|
|
1887
2471
|
if (lower.includes("user rejected") || lower.includes("user denied")) {
|
|
@@ -1893,6 +2477,22 @@ function formatUserError(raw) {
|
|
|
1893
2477
|
if (lower.includes("nonce too low") || lower.includes("nonce too high")) {
|
|
1894
2478
|
return "Transaction conflict \u2014 please try again";
|
|
1895
2479
|
}
|
|
2480
|
+
const revertMarker = "reverted with the following reason:";
|
|
2481
|
+
const revertIdx = lower.indexOf(revertMarker);
|
|
2482
|
+
const revertReason = revertIdx === -1 ? null : _nullishCoalesce(raw.slice(revertIdx + revertMarker.length).split(/\n[^\S\n]*\n/)[0].split("\n").map((line) => line.trim()).find(
|
|
2483
|
+
(line) => line.length > 0 && !DETAIL_SECTION_HEADINGS.some(
|
|
2484
|
+
(heading) => line.startsWith(heading)
|
|
2485
|
+
)
|
|
2486
|
+
), () => ( ""));
|
|
2487
|
+
if (revertReason !== null) {
|
|
2488
|
+
const reasonLower = revertReason.toLowerCase();
|
|
2489
|
+
if (reasonLower.includes("execution reverted")) {
|
|
2490
|
+
return "Transaction would fail on-chain";
|
|
2491
|
+
}
|
|
2492
|
+
if (revertReason === "" || revertReason === "0x" || OPAQUE_REVERT_REASONS.some((opaque) => reasonLower.includes(opaque))) {
|
|
2493
|
+
return "Your wallet couldn't send the transaction \u2014 please try again";
|
|
2494
|
+
}
|
|
2495
|
+
}
|
|
1896
2496
|
if (lower.includes("execution reverted")) {
|
|
1897
2497
|
return "Transaction would fail on-chain";
|
|
1898
2498
|
}
|
|
@@ -1911,7 +2511,7 @@ function formatUserError(raw) {
|
|
|
1911
2511
|
if (lower.includes("rate limit") || lower.includes("429")) {
|
|
1912
2512
|
return "Rate limited \u2014 please try again shortly";
|
|
1913
2513
|
}
|
|
1914
|
-
let cleaned = raw;
|
|
2514
|
+
let cleaned = revertReason || raw;
|
|
1915
2515
|
const stripMarkers = [
|
|
1916
2516
|
"\n\nRequest Arguments:",
|
|
1917
2517
|
"\nRaw Call Arguments:",
|
|
@@ -1959,29 +2559,29 @@ var EVM_ADDRESS_RE = /^0x[a-fA-F0-9]{40}$/;
|
|
|
1959
2559
|
function resolveTokenDisplay(token, chain, fallback) {
|
|
1960
2560
|
if (token !== void 0) {
|
|
1961
2561
|
if (chain === "solana") {
|
|
1962
|
-
const solanaToken =
|
|
2562
|
+
const solanaToken = _chunkTENL4H64cjs.getSolanaTokenByMint.call(void 0, token);
|
|
1963
2563
|
if (solanaToken) {
|
|
1964
2564
|
return { symbol: solanaToken.symbol, decimals: solanaToken.decimals };
|
|
1965
2565
|
}
|
|
1966
2566
|
} else if (chain === "hypercore") {
|
|
1967
|
-
const t =
|
|
2567
|
+
const t = _chunkTENL4H64cjs.HYPERCORE_SOURCE_TOKENS.find(
|
|
1968
2568
|
(x) => x.address.toLowerCase() === token.toLowerCase()
|
|
1969
2569
|
);
|
|
1970
2570
|
if (t) return { symbol: t.symbol, decimals: t.decimals };
|
|
1971
2571
|
} else if (EVM_ADDRESS_RE.test(token)) {
|
|
1972
|
-
const symbol =
|
|
1973
|
-
const decimals =
|
|
2572
|
+
const symbol = _chunkTENL4H64cjs.getTokenSymbol.call(void 0, token, chain);
|
|
2573
|
+
const decimals = _chunkTENL4H64cjs.findTokenDecimals.call(void 0, token, chain);
|
|
1974
2574
|
if (symbol !== "Token" || decimals !== void 0) {
|
|
1975
2575
|
return {
|
|
1976
|
-
symbol: symbol !== "Token" ? symbol : _nullishCoalesce(_optionalChain([fallback, 'optionalAccess',
|
|
1977
|
-
decimals: _nullishCoalesce(decimals, () => ( _optionalChain([fallback, 'optionalAccess',
|
|
2576
|
+
symbol: symbol !== "Token" ? symbol : _nullishCoalesce(_optionalChain([fallback, 'optionalAccess', _103 => _103.symbol]), () => ( symbol)),
|
|
2577
|
+
decimals: _nullishCoalesce(decimals, () => ( _optionalChain([fallback, 'optionalAccess', _104 => _104.decimals])))
|
|
1978
2578
|
};
|
|
1979
2579
|
}
|
|
1980
2580
|
}
|
|
1981
2581
|
}
|
|
1982
2582
|
return {
|
|
1983
|
-
symbol: _nullishCoalesce(_optionalChain([fallback, 'optionalAccess',
|
|
1984
|
-
decimals: _optionalChain([fallback, 'optionalAccess',
|
|
2583
|
+
symbol: _nullishCoalesce(_optionalChain([fallback, 'optionalAccess', _105 => _105.symbol]), () => ( "Token")),
|
|
2584
|
+
decimals: _optionalChain([fallback, 'optionalAccess', _106 => _106.decimals])
|
|
1985
2585
|
};
|
|
1986
2586
|
}
|
|
1987
2587
|
function maxFractionDigitsFor(symbol) {
|
|
@@ -2019,13 +2619,13 @@ function priceUsdFor(symbol, prices) {
|
|
|
2019
2619
|
}
|
|
2020
2620
|
function isRecognizedToken(address, chain) {
|
|
2021
2621
|
if (address === void 0 || chain === void 0) return false;
|
|
2022
|
-
if (chain === "solana") return
|
|
2622
|
+
if (chain === "solana") return _chunkTENL4H64cjs.getSolanaTokenByMint.call(void 0, address) !== void 0;
|
|
2023
2623
|
if (chain === "hypercore") {
|
|
2024
|
-
return
|
|
2624
|
+
return _chunkTENL4H64cjs.HYPERCORE_SOURCE_TOKENS.some(
|
|
2025
2625
|
(t) => t.address.toLowerCase() === address.toLowerCase()
|
|
2026
2626
|
);
|
|
2027
2627
|
}
|
|
2028
|
-
return EVM_ADDRESS_RE.test(address) &&
|
|
2628
|
+
return EVM_ADDRESS_RE.test(address) && _chunkTENL4H64cjs.isRegistryTokenOnChain.call(void 0, address, chain);
|
|
2029
2629
|
}
|
|
2030
2630
|
function estimateReceiveAmount(params) {
|
|
2031
2631
|
const {
|
|
@@ -2076,26 +2676,6 @@ function formatReceiveEstimate(params) {
|
|
|
2076
2676
|
return sameSymbol ? `${formatted} ${params.targetSymbol}` : `~${formatted} ${params.targetSymbol}`;
|
|
2077
2677
|
}
|
|
2078
2678
|
|
|
2079
|
-
// src/core/rpc.ts
|
|
2080
|
-
|
|
2081
|
-
function rpcUrlFor(rpcUrls, chain) {
|
|
2082
|
-
const url = _optionalChain([rpcUrls, 'optionalAccess', _69 => _69[chain], 'optionalAccess', _70 => _70.trim, 'call', _71 => _71()]);
|
|
2083
|
-
return url ? url : void 0;
|
|
2084
|
-
}
|
|
2085
|
-
var RpcUrlsContext = _react.createContext.call(void 0, void 0);
|
|
2086
|
-
var RpcUrlsProvider = RpcUrlsContext.Provider;
|
|
2087
|
-
function useRpcUrls() {
|
|
2088
|
-
return _react.useContext.call(void 0, RpcUrlsContext);
|
|
2089
|
-
}
|
|
2090
|
-
function rpcUrlsKey(rpcUrls) {
|
|
2091
|
-
if (!rpcUrls) return "";
|
|
2092
|
-
return Object.entries(rpcUrls).map(([chain, url]) => [chain, _nullishCoalesce(_optionalChain([url, 'optionalAccess', _72 => _72.trim, 'call', _73 => _73()]), () => ( ""))]).filter(([, url]) => url !== "").map(([chain, url]) => `${chain}=${url}`).sort().join("|");
|
|
2093
|
-
}
|
|
2094
|
-
function useStableRpcUrls(rpcUrls) {
|
|
2095
|
-
const key = rpcUrlsKey(rpcUrls);
|
|
2096
|
-
return _react.useMemo.call(void 0, () => rpcUrls, [key]);
|
|
2097
|
-
}
|
|
2098
|
-
|
|
2099
2679
|
// src/core/theme.ts
|
|
2100
2680
|
var RADIUS_SCALE = {
|
|
2101
2681
|
none: { sm: "0", md: "0", lg: "0" },
|
|
@@ -2198,19 +2778,19 @@ var CUSTOM_PRIMARY_VARS = [
|
|
|
2198
2778
|
function applyTheme(element, theme) {
|
|
2199
2779
|
if (!element) return;
|
|
2200
2780
|
const parent = element.parentElement;
|
|
2201
|
-
const targets = _optionalChain([parent, 'optionalAccess',
|
|
2202
|
-
if (_optionalChain([theme, 'optionalAccess',
|
|
2781
|
+
const targets = _optionalChain([parent, 'optionalAccess', _107 => _107.classList, 'access', _108 => _108.contains, 'call', _109 => _109("rs-modal-content")]) ? [element, parent] : [element];
|
|
2782
|
+
if (_optionalChain([theme, 'optionalAccess', _110 => _110.mode])) {
|
|
2203
2783
|
for (const t of targets) t.setAttribute("data-theme", theme.mode);
|
|
2204
2784
|
} else {
|
|
2205
2785
|
for (const t of targets) t.removeAttribute("data-theme");
|
|
2206
2786
|
}
|
|
2207
|
-
if (_optionalChain([theme, 'optionalAccess',
|
|
2787
|
+
if (_optionalChain([theme, 'optionalAccess', _111 => _111.fontColor])) {
|
|
2208
2788
|
setVar(targets, "--rs-foreground", theme.fontColor);
|
|
2209
2789
|
}
|
|
2210
|
-
if (_optionalChain([theme, 'optionalAccess',
|
|
2790
|
+
if (_optionalChain([theme, 'optionalAccess', _112 => _112.iconColor])) {
|
|
2211
2791
|
setVar(targets, "--rs-icon", theme.iconColor);
|
|
2212
2792
|
}
|
|
2213
|
-
if (_optionalChain([theme, 'optionalAccess',
|
|
2793
|
+
if (_optionalChain([theme, 'optionalAccess', _113 => _113.ctaColor])) {
|
|
2214
2794
|
const derived = deriveCustomPrimary(theme.ctaColor);
|
|
2215
2795
|
if (derived) {
|
|
2216
2796
|
setVar(targets, "--rs-primary", derived.base);
|
|
@@ -2235,18 +2815,18 @@ function applyTheme(element, theme) {
|
|
|
2235
2815
|
}
|
|
2236
2816
|
} else {
|
|
2237
2817
|
for (const v of CUSTOM_PRIMARY_VARS) clearVar(targets, v);
|
|
2238
|
-
if (_optionalChain([theme, 'optionalAccess',
|
|
2818
|
+
if (_optionalChain([theme, 'optionalAccess', _114 => _114.ctaHoverColor])) {
|
|
2239
2819
|
setVar(targets, "--rs-primary-hover", theme.ctaHoverColor);
|
|
2240
2820
|
}
|
|
2241
2821
|
}
|
|
2242
|
-
if (_optionalChain([theme, 'optionalAccess',
|
|
2822
|
+
if (_optionalChain([theme, 'optionalAccess', _115 => _115.borderColor])) {
|
|
2243
2823
|
setVar(targets, "--rs-border", theme.borderColor);
|
|
2244
2824
|
setVar(targets, "--rs-border-surface", theme.borderColor);
|
|
2245
2825
|
}
|
|
2246
|
-
if (_optionalChain([theme, 'optionalAccess',
|
|
2826
|
+
if (_optionalChain([theme, 'optionalAccess', _116 => _116.backgroundColor])) {
|
|
2247
2827
|
setVar(targets, "--rs-background", theme.backgroundColor);
|
|
2248
2828
|
}
|
|
2249
|
-
if (_optionalChain([theme, 'optionalAccess',
|
|
2829
|
+
if (_optionalChain([theme, 'optionalAccess', _117 => _117.radius])) {
|
|
2250
2830
|
const scale = RADIUS_SCALE[theme.radius];
|
|
2251
2831
|
setVar(targets, "--rs-radius-sm", scale.sm);
|
|
2252
2832
|
setVar(targets, "--rs-radius-md", scale.md);
|
|
@@ -2331,4 +2911,18 @@ function checkBackendUrl(component, backendUrl) {
|
|
|
2331
2911
|
|
|
2332
2912
|
|
|
2333
2913
|
|
|
2334
|
-
|
|
2914
|
+
|
|
2915
|
+
|
|
2916
|
+
|
|
2917
|
+
|
|
2918
|
+
|
|
2919
|
+
|
|
2920
|
+
|
|
2921
|
+
|
|
2922
|
+
|
|
2923
|
+
|
|
2924
|
+
|
|
2925
|
+
|
|
2926
|
+
|
|
2927
|
+
|
|
2928
|
+
exports.Modal = Modal; exports.WalletIcon = WalletIcon; exports.ExternalLinkIcon = ExternalLinkIcon; exports.CheckIcon = CheckIcon; exports.TransferCryptoIcon = TransferCryptoIcon; exports.ChevronRightIcon = ChevronRightIcon; exports.ChevronLeftIcon = ChevronLeftIcon; exports.ChevronDownIcon = ChevronDownIcon; exports.CloseIcon = CloseIcon; exports.HandCoinsIcon = HandCoinsIcon; exports.CoinsIcon = CoinsIcon; exports.HistoryIcon = HistoryIcon; exports.InfoIcon = InfoIcon; exports.CopyIcon = CopyIcon; exports.ArrowUpRightIcon = ArrowUpRightIcon; exports.AlertTriangleIcon = AlertTriangleIcon; exports.PercentIcon = PercentIcon; exports.ClockIcon = ClockIcon; exports.PlusCircleIcon = PlusCircleIcon; exports.CircleArrowOutUpLeftIcon = CircleArrowOutUpLeftIcon; exports.CardIcon = CardIcon; exports.BankIcon = BankIcon; exports.UnplugIcon = UnplugIcon; exports.MigrateAssetsIcon = MigrateAssetsIcon; exports.AppleIcon = AppleIcon; exports.BodyHeader = BodyHeader; exports.CdnIcon = CdnIcon; exports.PoweredBy = PoweredBy; exports.Spinner = Spinner; exports.catalogKeyForChain = catalogKeyForChain; exports.debugLog = debugLog; exports.debugError = debugError; exports.getAssetId = getAssetId; exports.chainIdsByValue = chainIdsByValue; exports.portfolioToAssets = portfolioToAssets; exports.isNativeAsset = isNativeAsset; exports.formatFeeUsd = formatFeeUsd; exports.quoteFeeRow = quoteFeeRow; exports.quoteFeeGroups = quoteFeeGroups; exports.SwappedConnectFeeChangedError = SwappedConnectFeeChangedError; exports.SUPPORTED_CONNECT_EXCHANGE_COUNT = SUPPORTED_CONNECT_EXCHANGE_COUNT; exports.resolveAppFeeBps = resolveAppFeeBps; exports.createDepositService = createDepositService; exports.rpcUrlFor = rpcUrlFor; exports.RpcUrlsProvider = RpcUrlsProvider; exports.useRpcUrls = useRpcUrls; exports.useStableRpcUrls = useStableRpcUrls; exports.getPublicClient = getPublicClient; exports.peekRuntimeChains = peekRuntimeChains; exports.primeRuntimeChains = primeRuntimeChains; exports.useChainCatalog = useChainCatalog; exports.useCatalogChain = useCatalogChain; exports.useDepositChainIds = useDepositChainIds; exports.useDestinationChains = useDestinationChains; exports.useTargetTokens = useTargetTokens; exports.useIsDepositChain = useIsDepositChain; exports.useChainName = useChainName; exports.useExplorerTxUrl = useExplorerTxUrl; exports.ChainCatalogProvider = ChainCatalogProvider; exports.useLatestRef = useLatestRef; exports.Button = Button; exports.Callout = Callout; exports.TokenIcon = TokenIcon; exports.currencyFormatter = currencyFormatter; exports.tokenFormatter = tokenFormatter; exports.isUnsupportedChainSwitchError = isUnsupportedChainSwitchError; exports.formatUserError = formatUserError; exports.resolveTokenDisplay = resolveTokenDisplay; exports.formatTokenAmount = formatTokenAmount; exports.tokenAmountToNumber = tokenAmountToNumber; exports.formatRawTokenAmount = formatRawTokenAmount; exports.isDisplayStablecoinSymbol = isDisplayStablecoinSymbol; exports.isRecognizedToken = isRecognizedToken; exports.estimateReceiveAmount = estimateReceiveAmount; exports.formatQuotedReceive = formatQuotedReceive; exports.formatReceiveEstimate = formatReceiveEstimate; exports.applyTheme = applyTheme; exports.checkBackendUrl = checkBackendUrl;
|