@rhinestone/deposit-modal 0.14.0 → 0.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +12 -12
- package/bridge-transcript.json +14 -0
- package/dist/ClaimModal-GFDBVCN5.cjs +11 -0
- package/dist/ClaimModal-VQS3AKEL.mjs +11 -0
- package/dist/{DepositModalReown-Q2JMLT47.mjs → DepositModalReown-KOJ7VEY7.mjs} +30 -29
- package/dist/{DepositModalReown-46LPVFB6.cjs → DepositModalReown-R37SSHUF.cjs} +79 -78
- package/dist/WithdrawModal-QVXHMH43.mjs +12 -0
- package/dist/WithdrawModal-RY2NMFLE.cjs +12 -0
- package/dist/{caip-D8aRWdEY.d.cts → caip-BMi-9t09.d.cts} +27 -3
- package/dist/{caip-D8aRWdEY.d.ts → caip-BMi-9t09.d.ts} +27 -3
- package/dist/{chunk-V2OBGLJD.cjs → chunk-3OOY67VJ.cjs} +1103 -253
- package/dist/{chunk-6KG642KH.cjs → chunk-5P2PVLS4.cjs} +1 -1
- package/dist/{chunk-IN77XSWO.mjs → chunk-5VONFVQN.mjs} +976 -126
- package/dist/chunk-6HUHVXCY.cjs +704 -0
- package/dist/{chunk-PKML3XVS.mjs → chunk-7UQ6OUEE.mjs} +166 -45
- package/dist/{chunk-K4H6TGBE.mjs → chunk-CXBMIZUF.mjs} +1 -1
- package/dist/{chunk-MTFJSE52.cjs → chunk-DTVZUBHI.cjs} +236 -115
- package/dist/{chunk-VUATPOWJ.mjs → chunk-EAGMY3QE.mjs} +74 -17
- package/dist/{chunk-RN5VKWI6.mjs → chunk-FTWKAJGN.mjs} +1 -1
- package/dist/{chunk-KTUVSKR4.mjs → chunk-IKUYZA7A.mjs} +265 -523
- package/dist/{chunk-DW2EQA2U.cjs → chunk-LVCD6RHF.cjs} +2 -2
- package/dist/{chunk-4KCSH4T3.cjs → chunk-OY5N3E6L.cjs} +86 -29
- package/dist/chunk-QJ7RCCU7.mjs +704 -0
- package/dist/chunk-UCBUCX2W.mjs +3169 -0
- package/dist/{chunk-YCQZJQO6.cjs → chunk-VPDCGD2D.cjs} +622 -880
- package/dist/{chunk-7ICSHJFE.cjs → chunk-X4D52IZK.cjs} +1501 -176
- package/dist/claim.cjs +5 -7
- package/dist/claim.d.cts +3 -3
- package/dist/claim.d.ts +3 -3
- package/dist/claim.mjs +4 -6
- package/dist/{constants-DBrWhJWE.d.cts → constants-BT4ctuHo.d.cts} +7 -6
- package/dist/{constants-DBrWhJWE.d.ts → constants-D21ZdNOP.d.ts} +7 -6
- package/dist/constants.cjs +3 -3
- package/dist/constants.d.cts +3 -3
- package/dist/constants.d.ts +3 -3
- package/dist/constants.mjs +2 -2
- package/dist/deposit.cjs +7 -8
- package/dist/deposit.d.cts +3 -3
- package/dist/deposit.d.ts +3 -3
- package/dist/deposit.mjs +6 -7
- package/dist/embed.cjs +135 -44
- package/dist/embed.d.cts +2 -2
- package/dist/embed.d.ts +2 -2
- package/dist/embed.mjs +116 -25
- package/dist/index.cjs +13 -11
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.mjs +12 -10
- package/dist/polymarket.cjs +6 -6
- package/dist/polymarket.mjs +2 -2
- package/dist/styles.css +132 -100
- package/dist/{types-Bho4OA03.d.ts → types-CQ0NHqCy.d.ts} +146 -11
- package/dist/{types-DP_3KwlD.d.cts → types-CxiLX5sv.d.cts} +146 -11
- package/dist/withdraw.cjs +6 -6
- package/dist/withdraw.d.cts +4 -4
- package/dist/withdraw.d.ts +4 -4
- package/dist/withdraw.mjs +5 -5
- package/package.json +7 -6
- package/dist/ClaimModal-IKTJU43Y.cjs +0 -13
- package/dist/ClaimModal-SEKNWRMA.mjs +0 -13
- package/dist/WithdrawModal-5ICGD4HJ.mjs +0 -12
- package/dist/WithdrawModal-VP6PMIRO.cjs +0 -12
- package/dist/chunk-7SR7ENVJ.mjs +0 -1844
- package/dist/chunk-CFKC77SV.mjs +0 -1062
- package/dist/chunk-LZFRL2AL.cjs +0 -81
- package/dist/chunk-WUJIKCFU.mjs +0 -81
- package/dist/chunk-X2IPAPXU.cjs +0 -163
- package/dist/chunk-YWMWI7PZ.cjs +0 -1062
- package/dist/chunk-ZEO6ADM3.mjs +0 -163
|
@@ -1,7 +1,7 @@
|
|
|
1
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
3
|
|
|
4
|
-
var
|
|
4
|
+
var _chunk5P2PVLS4cjs = require('./chunk-5P2PVLS4.cjs');
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
|
|
@@ -26,7 +26,12 @@ var _chunk6KG642KHcjs = require('./chunk-6KG642KH.cjs');
|
|
|
26
26
|
|
|
27
27
|
|
|
28
28
|
|
|
29
|
-
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
var _chunkOY5N3E6Lcjs = require('./chunk-OY5N3E6L.cjs');
|
|
30
35
|
|
|
31
36
|
// src/components/ui/Modal.tsx
|
|
32
37
|
|
|
@@ -50,7 +55,8 @@ function Modal({
|
|
|
50
55
|
children,
|
|
51
56
|
className = "",
|
|
52
57
|
inline = false,
|
|
53
|
-
closeOnOverlayClick = false
|
|
58
|
+
closeOnOverlayClick = false,
|
|
59
|
+
ariaLabel
|
|
54
60
|
}) {
|
|
55
61
|
const overlayRef = _react.useRef.call(void 0, null);
|
|
56
62
|
const contentRef = _react.useRef.call(void 0, null);
|
|
@@ -137,7 +143,7 @@ function Modal({
|
|
|
137
143
|
onKeyDown: handleKeyDown,
|
|
138
144
|
role: "dialog",
|
|
139
145
|
"aria-modal": "true",
|
|
140
|
-
"aria-
|
|
146
|
+
"aria-label": ariaLabel,
|
|
141
147
|
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
142
148
|
"div",
|
|
143
149
|
{
|
|
@@ -321,7 +327,7 @@ function preconnectIconCdn() {
|
|
|
321
327
|
const link = document.createElement("link");
|
|
322
328
|
link.id = "rs-icon-cdn-preconnect";
|
|
323
329
|
link.rel = "preconnect";
|
|
324
|
-
link.href =
|
|
330
|
+
link.href = _chunkOY5N3E6Lcjs.ICON_CDN;
|
|
325
331
|
link.crossOrigin = "anonymous";
|
|
326
332
|
document.head.appendChild(link);
|
|
327
333
|
}
|
|
@@ -360,6 +366,79 @@ function CdnIcon({
|
|
|
360
366
|
}
|
|
361
367
|
CdnIcon.displayName = "CdnIcon";
|
|
362
368
|
|
|
369
|
+
// src/components/ui/ListRow.tsx
|
|
370
|
+
|
|
371
|
+
function ListRow({
|
|
372
|
+
leading,
|
|
373
|
+
leadingMedia,
|
|
374
|
+
title,
|
|
375
|
+
subtitle,
|
|
376
|
+
meta,
|
|
377
|
+
trailing,
|
|
378
|
+
action,
|
|
379
|
+
className = "",
|
|
380
|
+
onClick,
|
|
381
|
+
disabled,
|
|
382
|
+
...props
|
|
383
|
+
}) {
|
|
384
|
+
const inner = /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
385
|
+
leadingMedia ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-list-row-leading rs-list-row-leading--media", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, CdnIcon, { src: leadingMedia }) }) : leading ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-list-row-leading", children: leading }) : null,
|
|
386
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-list-row-body", children: [
|
|
387
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-list-row-text", children: [
|
|
388
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-list-row-title", children: title }),
|
|
389
|
+
subtitle && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-list-row-subtitle", children: subtitle })
|
|
390
|
+
] }),
|
|
391
|
+
action ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
392
|
+
"button",
|
|
393
|
+
{
|
|
394
|
+
type: "button",
|
|
395
|
+
className: "rs-list-row-action",
|
|
396
|
+
disabled,
|
|
397
|
+
onClick: (e) => {
|
|
398
|
+
e.stopPropagation();
|
|
399
|
+
action.onClick();
|
|
400
|
+
},
|
|
401
|
+
children: action.label
|
|
402
|
+
}
|
|
403
|
+
) : meta && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-list-row-meta", children: meta })
|
|
404
|
+
] }),
|
|
405
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-list-row-chevron", children: _nullishCoalesce(trailing, () => ( (disabled ? null : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ChevronRightIcon, {})))) })
|
|
406
|
+
] });
|
|
407
|
+
if (action) {
|
|
408
|
+
const handleKey = (e) => {
|
|
409
|
+
if (disabled) return;
|
|
410
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
411
|
+
e.preventDefault();
|
|
412
|
+
_optionalChain([onClick, 'optionalCall', _2 => _2(e)]);
|
|
413
|
+
}
|
|
414
|
+
};
|
|
415
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
416
|
+
"div",
|
|
417
|
+
{
|
|
418
|
+
className: `rs-list-row ${className}`.trim(),
|
|
419
|
+
role: "button",
|
|
420
|
+
tabIndex: disabled ? -1 : 0,
|
|
421
|
+
"aria-disabled": disabled || void 0,
|
|
422
|
+
onClick: disabled ? void 0 : (e) => _optionalChain([onClick, 'optionalCall', _3 => _3(e)]),
|
|
423
|
+
onKeyDown: handleKey,
|
|
424
|
+
children: inner
|
|
425
|
+
}
|
|
426
|
+
);
|
|
427
|
+
}
|
|
428
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
429
|
+
"button",
|
|
430
|
+
{
|
|
431
|
+
type: "button",
|
|
432
|
+
className: `rs-list-row ${className}`.trim(),
|
|
433
|
+
onClick,
|
|
434
|
+
disabled,
|
|
435
|
+
...props,
|
|
436
|
+
children: inner
|
|
437
|
+
}
|
|
438
|
+
);
|
|
439
|
+
}
|
|
440
|
+
ListRow.displayName = "ListRow";
|
|
441
|
+
|
|
363
442
|
// src/components/ui/PoweredBy.tsx
|
|
364
443
|
|
|
365
444
|
var rhinestoneLogo = /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
@@ -505,7 +584,7 @@ function parseExplorer(value) {
|
|
|
505
584
|
return { url, addressPath, txPath };
|
|
506
585
|
}
|
|
507
586
|
function parseVmType(value) {
|
|
508
|
-
return value === "evm" || value === "svm" || value === "tvm" ? value : null;
|
|
587
|
+
return value === "evm" || value === "svm" || value === "tvm" || value === "stellar" ? value : null;
|
|
509
588
|
}
|
|
510
589
|
function parseOptionalString(value) {
|
|
511
590
|
return typeof value === "string" && value.trim() !== "" ? value.trim() : null;
|
|
@@ -539,7 +618,7 @@ function parseChain(caip2, value) {
|
|
|
539
618
|
// `parseEvmChainId` returns null for `solana:`/`tron:`/`hypercore:` keys,
|
|
540
619
|
// which is the intended answer — those chains have no numeric id, and the
|
|
541
620
|
// modal addresses them by their CAIP-2 string or a sentinel.
|
|
542
|
-
chainId:
|
|
621
|
+
chainId: _chunkOY5N3E6Lcjs.parseEvmChainId.call(void 0, caip2),
|
|
543
622
|
name,
|
|
544
623
|
testnet,
|
|
545
624
|
deposit,
|
|
@@ -572,19 +651,21 @@ function parseChainCatalog(body) {
|
|
|
572
651
|
return { all, byCaip2, byChainId };
|
|
573
652
|
}
|
|
574
653
|
function aliasHyperCoreOrigin(byCaip2, all) {
|
|
575
|
-
if (byCaip2.has(
|
|
576
|
-
const origin = _nullishCoalesce(all.find((c) =>
|
|
577
|
-
if (origin) byCaip2.set(
|
|
654
|
+
if (byCaip2.has(_chunkOY5N3E6Lcjs.HYPERCORE_SPOT_CAIP2)) return;
|
|
655
|
+
const origin = _nullishCoalesce(all.find((c) => _chunkOY5N3E6Lcjs.isHyperCoreCaip2.call(void 0, c.caip2) && c.deposit), () => ( all.find((c) => _chunkOY5N3E6Lcjs.isHyperCoreCaip2.call(void 0, c.caip2))));
|
|
656
|
+
if (origin) byCaip2.set(_chunkOY5N3E6Lcjs.HYPERCORE_SPOT_CAIP2, origin);
|
|
578
657
|
}
|
|
579
658
|
function catalogKeyForChain(chainId) {
|
|
580
|
-
if (chainId === "solana") return
|
|
581
|
-
if (chainId === "
|
|
582
|
-
|
|
659
|
+
if (chainId === "solana") return _chunkOY5N3E6Lcjs.SOLANA_MAINNET_CAIP2;
|
|
660
|
+
if (chainId === "tron") return _chunkOY5N3E6Lcjs.TRON_MAINNET_CAIP2;
|
|
661
|
+
if (chainId === "stellar") return _chunkOY5N3E6Lcjs.STELLAR_PUBNET_CAIP2;
|
|
662
|
+
if (chainId === "hypercore" || chainId === _chunkOY5N3E6Lcjs.HYPERCORE_CHAIN_ID) {
|
|
663
|
+
return _chunkOY5N3E6Lcjs.HYPERCORE_SPOT_CAIP2;
|
|
583
664
|
}
|
|
584
665
|
return chainId;
|
|
585
666
|
}
|
|
586
667
|
function catalogExplorerTxUrl(chain, txHash) {
|
|
587
|
-
if (!_optionalChain([chain, 'optionalAccess',
|
|
668
|
+
if (!_optionalChain([chain, 'optionalAccess', _4 => _4.explorer])) return void 0;
|
|
588
669
|
return `${chain.explorer.url}${chain.explorer.txPath}${txHash}`;
|
|
589
670
|
}
|
|
590
671
|
|
|
@@ -623,7 +704,7 @@ function safeBigInt(value) {
|
|
|
623
704
|
if (!value) return BigInt(0);
|
|
624
705
|
try {
|
|
625
706
|
return BigInt(value);
|
|
626
|
-
} catch (
|
|
707
|
+
} catch (e2) {
|
|
627
708
|
return BigInt(0);
|
|
628
709
|
}
|
|
629
710
|
}
|
|
@@ -704,7 +785,7 @@ function depositRowToEvent(row) {
|
|
|
704
785
|
function normalizeEvmAddress(value) {
|
|
705
786
|
try {
|
|
706
787
|
return _viem.getAddress.call(void 0, value);
|
|
707
|
-
} catch (
|
|
788
|
+
} catch (e3) {
|
|
708
789
|
return value;
|
|
709
790
|
}
|
|
710
791
|
}
|
|
@@ -732,7 +813,7 @@ function quoteFeeGroups(breakdown) {
|
|
|
732
813
|
const groups = /* @__PURE__ */ new Map();
|
|
733
814
|
for (const [category, line] of Object.entries(breakdown)) {
|
|
734
815
|
if (line.internal || !Number.isFinite(line.usd) || line.usd < 0) continue;
|
|
735
|
-
const label = _optionalChain([line, 'access',
|
|
816
|
+
const label = _optionalChain([line, 'access', _5 => _5.label, 'optionalAccess', _6 => _6.trim, 'call', _7 => _7()]) || titleCaseFeeCategory(category);
|
|
736
817
|
const group = _nullishCoalesce(groups.get(label), () => ( {
|
|
737
818
|
label,
|
|
738
819
|
chargedUsd: 0,
|
|
@@ -841,8 +922,8 @@ function isSupportedConnectExchange(exchange) {
|
|
|
841
922
|
return !UNSUPPORTED_CONNECT_EXCHANGES.has(exchange.connection.toLowerCase());
|
|
842
923
|
}
|
|
843
924
|
function resolveAppFeeBps(appFees, sourceChainCaip2, sourceToken) {
|
|
844
|
-
const override = _optionalChain([appFees, 'optionalAccess',
|
|
845
|
-
const bps = _nullishCoalesce(_nullishCoalesce(override, () => ( _optionalChain([appFees, 'optionalAccess',
|
|
925
|
+
const override = _optionalChain([appFees, 'optionalAccess', _8 => _8.tokens, 'optionalAccess', _9 => _9[sourceChainCaip2], 'optionalAccess', _10 => _10[sourceToken.toLowerCase()]]);
|
|
926
|
+
const bps = _nullishCoalesce(_nullishCoalesce(override, () => ( _optionalChain([appFees, 'optionalAccess', _11 => _11.feeBps]))), () => ( 0));
|
|
846
927
|
return bps > 0 ? bps : 0;
|
|
847
928
|
}
|
|
848
929
|
var PermitDepositSubmitError = class extends Error {
|
|
@@ -852,10 +933,17 @@ var PermitDepositSubmitError = class extends Error {
|
|
|
852
933
|
this.name = "PermitDepositSubmitError";
|
|
853
934
|
}
|
|
854
935
|
};
|
|
936
|
+
var RegistrationError = class extends Error {
|
|
937
|
+
constructor(message, status) {
|
|
938
|
+
super(message);
|
|
939
|
+
this.status = status;
|
|
940
|
+
this.name = "RegistrationError";
|
|
941
|
+
}
|
|
942
|
+
};
|
|
855
943
|
function createDepositService(baseUrl, options) {
|
|
856
944
|
const normalizedBaseUrl = baseUrl.replace(/\/$/, "");
|
|
857
|
-
const debug = _optionalChain([options, 'optionalAccess',
|
|
858
|
-
const scope = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
945
|
+
const debug = _optionalChain([options, 'optionalAccess', _12 => _12.debug]) === true;
|
|
946
|
+
const scope = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _13 => _13.debugScope]), () => ( "service"));
|
|
859
947
|
function apiUrl(path) {
|
|
860
948
|
const normalizedPath = path.startsWith("/") ? path : `/${path}`;
|
|
861
949
|
return `${normalizedBaseUrl}${normalizedPath}`;
|
|
@@ -892,7 +980,7 @@ function createDepositService(baseUrl, options) {
|
|
|
892
980
|
try {
|
|
893
981
|
const response = await fetch(apiUrl("/qr/tokens"), {
|
|
894
982
|
method: "GET",
|
|
895
|
-
headers:
|
|
983
|
+
headers: _chunk5P2PVLS4cjs.serviceHeaders.call(void 0, )
|
|
896
984
|
});
|
|
897
985
|
if (!response.ok) {
|
|
898
986
|
debugLog(debug, scope, "getTopTokens:unavailable", {
|
|
@@ -919,7 +1007,7 @@ function createDepositService(baseUrl, options) {
|
|
|
919
1007
|
try {
|
|
920
1008
|
const response = await fetch(apiUrl("/chains"), {
|
|
921
1009
|
method: "GET",
|
|
922
|
-
headers:
|
|
1010
|
+
headers: _chunk5P2PVLS4cjs.serviceHeaders.call(void 0, )
|
|
923
1011
|
});
|
|
924
1012
|
if (!response.ok) {
|
|
925
1013
|
debugLog(debug, scope, "getChains:unavailable", {
|
|
@@ -950,7 +1038,7 @@ function createDepositService(baseUrl, options) {
|
|
|
950
1038
|
}
|
|
951
1039
|
let promise;
|
|
952
1040
|
promise = fetcher().catch((err) => {
|
|
953
|
-
if (_optionalChain([portfolioCache, 'access',
|
|
1041
|
+
if (_optionalChain([portfolioCache, 'access', _14 => _14.get, 'call', _15 => _15(key), 'optionalAccess', _16 => _16.promise]) === promise) {
|
|
954
1042
|
portfolioCache.delete(key);
|
|
955
1043
|
}
|
|
956
1044
|
throw err;
|
|
@@ -973,7 +1061,7 @@ function createDepositService(baseUrl, options) {
|
|
|
973
1061
|
});
|
|
974
1062
|
const response = await fetch(url, {
|
|
975
1063
|
method: "POST",
|
|
976
|
-
headers:
|
|
1064
|
+
headers: _chunk5P2PVLS4cjs.serviceHeaders.call(void 0, ),
|
|
977
1065
|
body: JSON.stringify({ account: params })
|
|
978
1066
|
});
|
|
979
1067
|
if (!response.ok) {
|
|
@@ -982,19 +1070,22 @@ function createDepositService(baseUrl, options) {
|
|
|
982
1070
|
status: response.status,
|
|
983
1071
|
salt: params.salt
|
|
984
1072
|
});
|
|
985
|
-
const detail = Array.isArray(error.details) ? error.details.map((d) => _optionalChain([d, 'optionalAccess',
|
|
1073
|
+
const detail = Array.isArray(error.details) ? error.details.map((d) => _optionalChain([d, 'optionalAccess', _17 => _17.message])).filter(Boolean).join("; ") : void 0;
|
|
986
1074
|
const base = error.error || `Account registration failed: ${response.status}`;
|
|
987
|
-
throw new
|
|
1075
|
+
throw new RegistrationError(
|
|
1076
|
+
detail ? `${base}: ${detail}` : base,
|
|
1077
|
+
response.status
|
|
1078
|
+
);
|
|
988
1079
|
}
|
|
989
1080
|
const result = await response.json();
|
|
990
1081
|
debugLog(debug, scope, "registerManagedAccount:success", {
|
|
991
|
-
evmDepositAddress: _optionalChain([result, 'optionalAccess',
|
|
992
|
-
hasSolanaDepositAddress: Boolean(_optionalChain([result, 'optionalAccess',
|
|
993
|
-
hasTronDepositAddress: Boolean(_optionalChain([result, 'optionalAccess',
|
|
1082
|
+
evmDepositAddress: _optionalChain([result, 'optionalAccess', _18 => _18.evmDepositAddress]),
|
|
1083
|
+
hasSolanaDepositAddress: Boolean(_optionalChain([result, 'optionalAccess', _19 => _19.solanaDepositAddress])),
|
|
1084
|
+
hasTronDepositAddress: Boolean(_optionalChain([result, 'optionalAccess', _20 => _20.tronDepositAddress]))
|
|
994
1085
|
});
|
|
995
1086
|
return {
|
|
996
1087
|
...result,
|
|
997
|
-
evmDepositAddress: normalizeEvmAddress(_optionalChain([result, 'optionalAccess',
|
|
1088
|
+
evmDepositAddress: normalizeEvmAddress(_optionalChain([result, 'optionalAccess', _21 => _21.evmDepositAddress]))
|
|
998
1089
|
};
|
|
999
1090
|
},
|
|
1000
1091
|
async fetchPortfolio(address, options2) {
|
|
@@ -1005,7 +1096,7 @@ function createDepositService(baseUrl, options) {
|
|
|
1005
1096
|
debugLog(debug, scope, "fetchPortfolio:request", { url, address });
|
|
1006
1097
|
const response = await fetch(url, {
|
|
1007
1098
|
method: "GET",
|
|
1008
|
-
headers:
|
|
1099
|
+
headers: _chunk5P2PVLS4cjs.serviceHeaders.call(void 0, )
|
|
1009
1100
|
});
|
|
1010
1101
|
if (!response.ok) {
|
|
1011
1102
|
const error = await response.json().catch(() => ({ error: "Unknown error" }));
|
|
@@ -1042,7 +1133,7 @@ function createDepositService(baseUrl, options) {
|
|
|
1042
1133
|
debugLog(debug, scope, "fetchPortfolio:empty", { address });
|
|
1043
1134
|
return { tokens: [], totalUsd: 0 };
|
|
1044
1135
|
},
|
|
1045
|
-
_optionalChain([options2, 'optionalAccess',
|
|
1136
|
+
_optionalChain([options2, 'optionalAccess', _22 => _22.forceRefresh])
|
|
1046
1137
|
);
|
|
1047
1138
|
},
|
|
1048
1139
|
async fetchSolanaPortfolio(address, options2) {
|
|
@@ -1056,7 +1147,7 @@ function createDepositService(baseUrl, options) {
|
|
|
1056
1147
|
});
|
|
1057
1148
|
const response = await fetch(url, {
|
|
1058
1149
|
method: "GET",
|
|
1059
|
-
headers:
|
|
1150
|
+
headers: _chunk5P2PVLS4cjs.serviceHeaders.call(void 0, )
|
|
1060
1151
|
});
|
|
1061
1152
|
if (!response.ok) {
|
|
1062
1153
|
const error = await response.json().catch(() => ({ error: "Unknown error" }));
|
|
@@ -1077,7 +1168,7 @@ function createDepositService(baseUrl, options) {
|
|
|
1077
1168
|
});
|
|
1078
1169
|
return normalized;
|
|
1079
1170
|
},
|
|
1080
|
-
_optionalChain([options2, 'optionalAccess',
|
|
1171
|
+
_optionalChain([options2, 'optionalAccess', _23 => _23.forceRefresh])
|
|
1081
1172
|
);
|
|
1082
1173
|
},
|
|
1083
1174
|
async checkAccount(address) {
|
|
@@ -1085,7 +1176,7 @@ function createDepositService(baseUrl, options) {
|
|
|
1085
1176
|
debugLog(debug, scope, "checkAccount:request", { url, address });
|
|
1086
1177
|
const response = await fetch(url, {
|
|
1087
1178
|
method: "GET",
|
|
1088
|
-
headers:
|
|
1179
|
+
headers: _chunk5P2PVLS4cjs.serviceHeaders.call(void 0, )
|
|
1089
1180
|
});
|
|
1090
1181
|
if (!response.ok) {
|
|
1091
1182
|
const error = await response.json().catch(() => ({ error: "Unknown error" }));
|
|
@@ -1099,9 +1190,9 @@ function createDepositService(baseUrl, options) {
|
|
|
1099
1190
|
}
|
|
1100
1191
|
const data = await response.json();
|
|
1101
1192
|
const result = {
|
|
1102
|
-
isRegistered: _optionalChain([data, 'optionalAccess',
|
|
1103
|
-
targetChain: _optionalChain([data, 'optionalAccess',
|
|
1104
|
-
targetToken: _optionalChain([data, 'optionalAccess',
|
|
1193
|
+
isRegistered: _optionalChain([data, 'optionalAccess', _24 => _24.isRegistered]) === true,
|
|
1194
|
+
targetChain: _optionalChain([data, 'optionalAccess', _25 => _25.targetChain]),
|
|
1195
|
+
targetToken: _optionalChain([data, 'optionalAccess', _26 => _26.targetToken])
|
|
1105
1196
|
};
|
|
1106
1197
|
debugLog(debug, scope, "checkAccount:success", {
|
|
1107
1198
|
address,
|
|
@@ -1121,7 +1212,7 @@ function createDepositService(baseUrl, options) {
|
|
|
1121
1212
|
);
|
|
1122
1213
|
const response = await fetch(url, {
|
|
1123
1214
|
method: "GET",
|
|
1124
|
-
headers:
|
|
1215
|
+
headers: _chunk5P2PVLS4cjs.serviceHeaders.call(void 0, ),
|
|
1125
1216
|
cache: "no-store"
|
|
1126
1217
|
});
|
|
1127
1218
|
if (!response.ok) {
|
|
@@ -1133,12 +1224,12 @@ function createDepositService(baseUrl, options) {
|
|
|
1133
1224
|
return { lastEvent: void 0 };
|
|
1134
1225
|
}
|
|
1135
1226
|
const body = await response.json();
|
|
1136
|
-
const row = _optionalChain([body, 'access',
|
|
1227
|
+
const row = _optionalChain([body, 'access', _27 => _27.deposits, 'optionalAccess', _28 => _28[0]]);
|
|
1137
1228
|
const lastEvent = row ? depositRowToEvent(row) : void 0;
|
|
1138
1229
|
debugLog(debug, scope, "fetchStatus:success", {
|
|
1139
1230
|
address,
|
|
1140
1231
|
txHash: shortRef(normalized),
|
|
1141
|
-
eventType: _optionalChain([lastEvent, 'optionalAccess',
|
|
1232
|
+
eventType: _optionalChain([lastEvent, 'optionalAccess', _29 => _29.type])
|
|
1142
1233
|
});
|
|
1143
1234
|
return { lastEvent };
|
|
1144
1235
|
},
|
|
@@ -1149,7 +1240,7 @@ function createDepositService(baseUrl, options) {
|
|
|
1149
1240
|
);
|
|
1150
1241
|
const response = await fetch(url, {
|
|
1151
1242
|
method: "GET",
|
|
1152
|
-
headers:
|
|
1243
|
+
headers: _chunk5P2PVLS4cjs.serviceHeaders.call(void 0, ),
|
|
1153
1244
|
cache: "no-store"
|
|
1154
1245
|
});
|
|
1155
1246
|
if (!response.ok) {
|
|
@@ -1173,7 +1264,7 @@ function createDepositService(baseUrl, options) {
|
|
|
1173
1264
|
);
|
|
1174
1265
|
const response = await fetch(url, {
|
|
1175
1266
|
method: "GET",
|
|
1176
|
-
headers:
|
|
1267
|
+
headers: _chunk5P2PVLS4cjs.serviceHeaders.call(void 0, ),
|
|
1177
1268
|
cache: "no-store"
|
|
1178
1269
|
});
|
|
1179
1270
|
if (!response.ok) {
|
|
@@ -1184,18 +1275,18 @@ function createDepositService(baseUrl, options) {
|
|
|
1184
1275
|
return { lastEvent: void 0 };
|
|
1185
1276
|
}
|
|
1186
1277
|
const body = await response.json();
|
|
1187
|
-
const row = _optionalChain([body, 'access',
|
|
1278
|
+
const row = _optionalChain([body, 'access', _30 => _30.deposits, 'optionalAccess', _31 => _31[0]]);
|
|
1188
1279
|
const lastEvent = row ? depositRowToEvent(row) : void 0;
|
|
1189
1280
|
debugLog(debug, scope, "fetchLatestStatus:success", {
|
|
1190
1281
|
address,
|
|
1191
|
-
eventType: _optionalChain([lastEvent, 'optionalAccess',
|
|
1282
|
+
eventType: _optionalChain([lastEvent, 'optionalAccess', _32 => _32.type])
|
|
1192
1283
|
});
|
|
1193
1284
|
return { lastEvent };
|
|
1194
1285
|
},
|
|
1195
1286
|
async getPositions(address) {
|
|
1196
1287
|
const url = apiUrl(`/positions/${address}`);
|
|
1197
1288
|
debugLog(debug, scope, "getPositions:request", { url, address });
|
|
1198
|
-
const response = await fetch(url, { headers:
|
|
1289
|
+
const response = await fetch(url, { headers: _chunk5P2PVLS4cjs.serviceHeaders.call(void 0, ) });
|
|
1199
1290
|
if (!response.ok) {
|
|
1200
1291
|
const error = await response.json().catch(() => ({ error: "Unknown error" }));
|
|
1201
1292
|
debugError(debug, scope, "getPositions:failed", error, {
|
|
@@ -1209,9 +1300,9 @@ function createDepositService(baseUrl, options) {
|
|
|
1209
1300
|
const result = await response.json();
|
|
1210
1301
|
debugLog(debug, scope, "getPositions:success", {
|
|
1211
1302
|
address,
|
|
1212
|
-
count: _nullishCoalesce(_optionalChain([result, 'access',
|
|
1303
|
+
count: _nullishCoalesce(_optionalChain([result, 'access', _33 => _33.positions, 'optionalAccess', _34 => _34.length]), () => ( 0)),
|
|
1213
1304
|
totalUsd: result.totalUsd,
|
|
1214
|
-
failures: _optionalChain([result, 'access',
|
|
1305
|
+
failures: _optionalChain([result, 'access', _35 => _35.failures, 'optionalAccess', _36 => _36.map, 'call', _37 => _37((f) => f.venue)])
|
|
1215
1306
|
});
|
|
1216
1307
|
return result;
|
|
1217
1308
|
},
|
|
@@ -1229,7 +1320,7 @@ function createDepositService(baseUrl, options) {
|
|
|
1229
1320
|
});
|
|
1230
1321
|
const response = await fetch(url, {
|
|
1231
1322
|
method: "POST",
|
|
1232
|
-
headers:
|
|
1323
|
+
headers: _chunk5P2PVLS4cjs.serviceHeaders.call(void 0, ),
|
|
1233
1324
|
body: JSON.stringify({ account, market, chainId, asset, amount })
|
|
1234
1325
|
});
|
|
1235
1326
|
if (!response.ok) {
|
|
@@ -1265,7 +1356,7 @@ function createDepositService(baseUrl, options) {
|
|
|
1265
1356
|
});
|
|
1266
1357
|
const response = await fetch(url, {
|
|
1267
1358
|
method: "POST",
|
|
1268
|
-
headers:
|
|
1359
|
+
headers: _chunk5P2PVLS4cjs.serviceHeaders.call(void 0, ),
|
|
1269
1360
|
body: JSON.stringify({
|
|
1270
1361
|
depositWallet,
|
|
1271
1362
|
owner,
|
|
@@ -1289,7 +1380,7 @@ function createDepositService(baseUrl, options) {
|
|
|
1289
1380
|
const result = await response.json();
|
|
1290
1381
|
debugLog(debug, scope, "submitPolymarketWithdraw:success", {
|
|
1291
1382
|
depositWallet,
|
|
1292
|
-
txHash: _optionalChain([result, 'optionalAccess',
|
|
1383
|
+
txHash: _optionalChain([result, 'optionalAccess', _38 => _38.txHash]) ? shortRef(result.txHash) : void 0
|
|
1293
1384
|
});
|
|
1294
1385
|
return result;
|
|
1295
1386
|
},
|
|
@@ -1307,7 +1398,7 @@ function createDepositService(baseUrl, options) {
|
|
|
1307
1398
|
});
|
|
1308
1399
|
const response = await fetch(url, {
|
|
1309
1400
|
method: "GET",
|
|
1310
|
-
headers:
|
|
1401
|
+
headers: _chunk5P2PVLS4cjs.serviceHeaders.call(void 0, ),
|
|
1311
1402
|
cache: "no-store"
|
|
1312
1403
|
});
|
|
1313
1404
|
if (!response.ok) {
|
|
@@ -1321,8 +1412,8 @@ function createDepositService(baseUrl, options) {
|
|
|
1321
1412
|
);
|
|
1322
1413
|
}
|
|
1323
1414
|
const data = await response.json();
|
|
1324
|
-
const deposits = Array.isArray(_optionalChain([data, 'optionalAccess',
|
|
1325
|
-
const nextCursor = _nullishCoalesce(_nullishCoalesce(_optionalChain([data, 'optionalAccess',
|
|
1415
|
+
const deposits = Array.isArray(_optionalChain([data, 'optionalAccess', _39 => _39.deposits])) ? data.deposits : [];
|
|
1416
|
+
const nextCursor = _nullishCoalesce(_nullishCoalesce(_optionalChain([data, 'optionalAccess', _40 => _40.nextCursor]), () => ( _optionalChain([data, 'optionalAccess', _41 => _41.next_cursor]))), () => ( null));
|
|
1326
1417
|
debugLog(debug, scope, "fetchDepositHistory:success", {
|
|
1327
1418
|
recipient: shortRef(params.recipient),
|
|
1328
1419
|
count: deposits.length,
|
|
@@ -1331,18 +1422,18 @@ function createDepositService(baseUrl, options) {
|
|
|
1331
1422
|
return { deposits, nextCursor };
|
|
1332
1423
|
},
|
|
1333
1424
|
async checkLiquidity(params) {
|
|
1334
|
-
if (
|
|
1335
|
-
const token =
|
|
1425
|
+
if (_chunkOY5N3E6Lcjs.isSolanaCaip2.call(void 0, params.destinationChainId) || params.destinationChainId === "solana") {
|
|
1426
|
+
const token = _chunkOY5N3E6Lcjs.getSolanaTokenByMint.call(void 0, params.destinationToken);
|
|
1336
1427
|
return {
|
|
1337
1428
|
hasLiquidity: true,
|
|
1338
|
-
symbol: _nullishCoalesce(_optionalChain([token, 'optionalAccess',
|
|
1339
|
-
decimals: _nullishCoalesce(_optionalChain([token, 'optionalAccess',
|
|
1429
|
+
symbol: _nullishCoalesce(_optionalChain([token, 'optionalAccess', _42 => _42.symbol]), () => ( "Token")),
|
|
1430
|
+
decimals: _nullishCoalesce(_optionalChain([token, 'optionalAccess', _43 => _43.decimals]), () => ( 9)),
|
|
1340
1431
|
unlimited: true,
|
|
1341
1432
|
maxAmount: null
|
|
1342
1433
|
};
|
|
1343
1434
|
}
|
|
1344
1435
|
const searchParams = new URLSearchParams({
|
|
1345
|
-
sourceChainId:
|
|
1436
|
+
sourceChainId: _chunkOY5N3E6Lcjs.toEvmCaip2.call(void 0, params.sourceChainId),
|
|
1346
1437
|
sourceToken: params.sourceToken,
|
|
1347
1438
|
destinationChainId: params.destinationChainId,
|
|
1348
1439
|
destinationToken: params.destinationToken,
|
|
@@ -1357,7 +1448,7 @@ function createDepositService(baseUrl, options) {
|
|
|
1357
1448
|
});
|
|
1358
1449
|
const response = await fetch(url, {
|
|
1359
1450
|
method: "GET",
|
|
1360
|
-
headers:
|
|
1451
|
+
headers: _chunk5P2PVLS4cjs.serviceHeaders.call(void 0, ),
|
|
1361
1452
|
cache: "no-store"
|
|
1362
1453
|
});
|
|
1363
1454
|
if (!response.ok) {
|
|
@@ -1392,7 +1483,7 @@ function createDepositService(baseUrl, options) {
|
|
|
1392
1483
|
// The branch is unreachable against today's processor whatever venue it
|
|
1393
1484
|
// names: `sourceToken` is validated as a 20-byte 0x address on every
|
|
1394
1485
|
// chain, and a HyperCore source token is a 16-byte Core spot tokenId.
|
|
1395
|
-
sourceChainId: params.sourceChainId === "hypercore" ?
|
|
1486
|
+
sourceChainId: params.sourceChainId === "hypercore" ? _chunkOY5N3E6Lcjs.HYPERCORE_SPOT_CAIP2 : `eip155:${params.sourceChainId}`,
|
|
1396
1487
|
sourceToken: params.sourceToken,
|
|
1397
1488
|
amount: params.amount
|
|
1398
1489
|
};
|
|
@@ -1405,7 +1496,7 @@ function createDepositService(baseUrl, options) {
|
|
|
1405
1496
|
try {
|
|
1406
1497
|
const response = await fetch(url, {
|
|
1407
1498
|
method: "POST",
|
|
1408
|
-
headers:
|
|
1499
|
+
headers: _chunk5P2PVLS4cjs.serviceHeaders.call(void 0, ),
|
|
1409
1500
|
body: JSON.stringify(body),
|
|
1410
1501
|
cache: "no-store"
|
|
1411
1502
|
});
|
|
@@ -1445,7 +1536,7 @@ function createDepositService(baseUrl, options) {
|
|
|
1445
1536
|
try {
|
|
1446
1537
|
const response = await fetch(url, {
|
|
1447
1538
|
method: "POST",
|
|
1448
|
-
headers:
|
|
1539
|
+
headers: _chunk5P2PVLS4cjs.serviceHeaders.call(void 0, ),
|
|
1449
1540
|
body: JSON.stringify({ ...params, kind: "auto" }),
|
|
1450
1541
|
cache: "no-store"
|
|
1451
1542
|
});
|
|
@@ -1539,7 +1630,7 @@ function createDepositService(baseUrl, options) {
|
|
|
1539
1630
|
try {
|
|
1540
1631
|
response = await fetch(url, {
|
|
1541
1632
|
method: "POST",
|
|
1542
|
-
headers:
|
|
1633
|
+
headers: _chunk5P2PVLS4cjs.serviceHeaders.call(void 0, ),
|
|
1543
1634
|
body: JSON.stringify(params)
|
|
1544
1635
|
});
|
|
1545
1636
|
} catch (error) {
|
|
@@ -1561,7 +1652,7 @@ function createDepositService(baseUrl, options) {
|
|
|
1561
1652
|
);
|
|
1562
1653
|
}
|
|
1563
1654
|
const result = await response.json();
|
|
1564
|
-
if (typeof _optionalChain([result, 'optionalAccess',
|
|
1655
|
+
if (typeof _optionalChain([result, 'optionalAccess', _44 => _44.txHash]) !== "string" || result.txHash.length === 0) {
|
|
1565
1656
|
debugError(debug, scope, "submitPermitDeposit:failed", result, {
|
|
1566
1657
|
reason: "missing txHash"
|
|
1567
1658
|
});
|
|
@@ -1590,7 +1681,7 @@ function createDepositService(baseUrl, options) {
|
|
|
1590
1681
|
try {
|
|
1591
1682
|
const response = await fetch(url, {
|
|
1592
1683
|
method: "GET",
|
|
1593
|
-
headers:
|
|
1684
|
+
headers: _chunk5P2PVLS4cjs.serviceHeaders.call(void 0, ),
|
|
1594
1685
|
cache: "no-store"
|
|
1595
1686
|
});
|
|
1596
1687
|
if (!response.ok) {
|
|
@@ -1622,7 +1713,7 @@ function createDepositService(baseUrl, options) {
|
|
|
1622
1713
|
try {
|
|
1623
1714
|
const response = await fetch(url, {
|
|
1624
1715
|
method: "GET",
|
|
1625
|
-
headers:
|
|
1716
|
+
headers: _chunk5P2PVLS4cjs.serviceHeaders.call(void 0, ),
|
|
1626
1717
|
cache: "no-store"
|
|
1627
1718
|
});
|
|
1628
1719
|
if (!response.ok) {
|
|
@@ -1647,7 +1738,7 @@ function createDepositService(baseUrl, options) {
|
|
|
1647
1738
|
});
|
|
1648
1739
|
const response = await fetch(url, {
|
|
1649
1740
|
method: "POST",
|
|
1650
|
-
headers:
|
|
1741
|
+
headers: _chunk5P2PVLS4cjs.serviceHeaders.call(void 0, ),
|
|
1651
1742
|
body: JSON.stringify(params)
|
|
1652
1743
|
});
|
|
1653
1744
|
if (!response.ok) {
|
|
@@ -1679,7 +1770,7 @@ function createDepositService(baseUrl, options) {
|
|
|
1679
1770
|
});
|
|
1680
1771
|
const response = await fetch(url, {
|
|
1681
1772
|
method: "POST",
|
|
1682
|
-
headers:
|
|
1773
|
+
headers: _chunk5P2PVLS4cjs.serviceHeaders.call(void 0, ),
|
|
1683
1774
|
body: JSON.stringify(params)
|
|
1684
1775
|
});
|
|
1685
1776
|
if (!response.ok) {
|
|
@@ -1716,7 +1807,7 @@ function createDepositService(baseUrl, options) {
|
|
|
1716
1807
|
debugLog(debug, scope, "getSwappedConnectExchanges:request");
|
|
1717
1808
|
const response = await fetch(url, {
|
|
1718
1809
|
method: "GET",
|
|
1719
|
-
headers:
|
|
1810
|
+
headers: _chunk5P2PVLS4cjs.serviceHeaders.call(void 0, ),
|
|
1720
1811
|
cache: "no-store"
|
|
1721
1812
|
});
|
|
1722
1813
|
if (!response.ok) {
|
|
@@ -1769,7 +1860,7 @@ function createDepositService(baseUrl, options) {
|
|
|
1769
1860
|
try {
|
|
1770
1861
|
const response = await fetch(url, {
|
|
1771
1862
|
method: "GET",
|
|
1772
|
-
headers:
|
|
1863
|
+
headers: _chunk5P2PVLS4cjs.serviceHeaders.call(void 0, ),
|
|
1773
1864
|
cache: "no-store"
|
|
1774
1865
|
});
|
|
1775
1866
|
if (!response.ok) {
|
|
@@ -1855,7 +1946,7 @@ function createDepositService(baseUrl, options) {
|
|
|
1855
1946
|
try {
|
|
1856
1947
|
const response = await fetch(url, {
|
|
1857
1948
|
method: "GET",
|
|
1858
|
-
headers:
|
|
1949
|
+
headers: _chunk5P2PVLS4cjs.serviceHeaders.call(void 0, ),
|
|
1859
1950
|
cache: "no-store"
|
|
1860
1951
|
});
|
|
1861
1952
|
if (!response.ok) {
|
|
@@ -1882,14 +1973,14 @@ function createDepositService(baseUrl, options) {
|
|
|
1882
1973
|
);
|
|
1883
1974
|
const response = await fetch(url, {
|
|
1884
1975
|
method: "GET",
|
|
1885
|
-
headers:
|
|
1976
|
+
headers: _chunk5P2PVLS4cjs.serviceHeaders.call(void 0, ),
|
|
1886
1977
|
cache: "no-store"
|
|
1887
1978
|
});
|
|
1888
1979
|
if (!response.ok) return null;
|
|
1889
1980
|
let body = null;
|
|
1890
1981
|
try {
|
|
1891
1982
|
body = await response.json();
|
|
1892
|
-
} catch (
|
|
1983
|
+
} catch (e4) {
|
|
1893
1984
|
return null;
|
|
1894
1985
|
}
|
|
1895
1986
|
if (!body || body.ok !== true) return null;
|
|
@@ -1923,16 +2014,16 @@ function createDepositService(baseUrl, options) {
|
|
|
1923
2014
|
}
|
|
1924
2015
|
function normalizeDirectPortfolio(data) {
|
|
1925
2016
|
const rawTokens = _nullishCoalesce(_nullishCoalesce(extractArray(data, "tokens"), () => ( extractArray(
|
|
1926
|
-
_optionalChain([data, 'optionalAccess',
|
|
2017
|
+
_optionalChain([data, 'optionalAccess', _45 => _45.data]),
|
|
1927
2018
|
"tokens"
|
|
1928
2019
|
))), () => ( []));
|
|
1929
|
-
const totalUsd = _nullishCoalesce(_nullishCoalesce(extractNumber(data, "totalUsd"), () => ( extractNumber(_optionalChain([data, 'optionalAccess',
|
|
2020
|
+
const totalUsd = _nullishCoalesce(_nullishCoalesce(extractNumber(data, "totalUsd"), () => ( extractNumber(_optionalChain([data, 'optionalAccess', _46 => _46.data]), "totalUsd"))), () => ( 0));
|
|
1930
2021
|
const tokens = rawTokens.map((token) => normalizeDirectToken(token)).filter((token) => Boolean(token));
|
|
1931
2022
|
return { tokens, totalUsd };
|
|
1932
2023
|
}
|
|
1933
2024
|
function extractOrchestratorPortfolio(data) {
|
|
1934
2025
|
const portfolio = _nullishCoalesce(extractArray(data, "portfolio"), () => ( extractArray(
|
|
1935
|
-
_optionalChain([data, 'optionalAccess',
|
|
2026
|
+
_optionalChain([data, 'optionalAccess', _47 => _47.data]),
|
|
1936
2027
|
"portfolio"
|
|
1937
2028
|
)));
|
|
1938
2029
|
if (!portfolio || !Array.isArray(portfolio)) return null;
|
|
@@ -1943,20 +2034,20 @@ function normalizeOrchestratorPortfolio(data) {
|
|
|
1943
2034
|
for (const tokenData of data.portfolio || []) {
|
|
1944
2035
|
const chainBalances = _nullishCoalesce(_nullishCoalesce(tokenData.tokenChainBalance, () => ( tokenData.chainBalances)), () => ( []));
|
|
1945
2036
|
for (const chainBalance of chainBalances) {
|
|
1946
|
-
const unlocked = _nullishCoalesce(_optionalChain([chainBalance, 'access',
|
|
2037
|
+
const unlocked = _nullishCoalesce(_optionalChain([chainBalance, 'access', _48 => _48.balance, 'optionalAccess', _49 => _49.unlocked]), () => ( "0"));
|
|
1947
2038
|
const normalizedName = tokenData.tokenName.trim();
|
|
1948
2039
|
const isNativeSymbol = normalizedName.toUpperCase() === "ETH" || normalizedName.toUpperCase() === "ETHER";
|
|
1949
|
-
const tokenAddress = _nullishCoalesce(_nullishCoalesce(chainBalance.tokenAddress, () => ( extractTokenAddress(tokenData, chainBalance.chainId))), () => (
|
|
1950
|
-
const resolvedTokenAddress = isNativeSymbol ?
|
|
2040
|
+
const tokenAddress = _nullishCoalesce(_nullishCoalesce(chainBalance.tokenAddress, () => ( extractTokenAddress(tokenData, chainBalance.chainId))), () => ( _chunkOY5N3E6Lcjs.getTokenAddress.call(void 0, tokenData.tokenName, chainBalance.chainId)));
|
|
2041
|
+
const resolvedTokenAddress = isNativeSymbol ? _chunkOY5N3E6Lcjs.NATIVE_TOKEN_ADDRESS : tokenAddress;
|
|
1951
2042
|
if (!resolvedTokenAddress) {
|
|
1952
2043
|
continue;
|
|
1953
2044
|
}
|
|
1954
|
-
const registrySymbol =
|
|
2045
|
+
const registrySymbol = _chunkOY5N3E6Lcjs.getTokenSymbol.call(void 0,
|
|
1955
2046
|
resolvedTokenAddress,
|
|
1956
2047
|
chainBalance.chainId
|
|
1957
2048
|
);
|
|
1958
2049
|
const symbol = registrySymbol !== "Token" ? registrySymbol : normalizedName || "Token";
|
|
1959
|
-
const decimals = registrySymbol !== "Token" ?
|
|
2050
|
+
const decimals = registrySymbol !== "Token" ? _chunkOY5N3E6Lcjs.getTokenDecimalsByAddress.call(void 0,
|
|
1960
2051
|
resolvedTokenAddress,
|
|
1961
2052
|
chainBalance.chainId
|
|
1962
2053
|
) : _nullishCoalesce(tokenData.tokenDecimals, () => ( 18));
|
|
@@ -1979,28 +2070,28 @@ function normalizeOrchestratorPortfolio(data) {
|
|
|
1979
2070
|
function normalizeDirectToken(token) {
|
|
1980
2071
|
const rawChainId = _nullishCoalesce(extractNumber(token, "chainId"), () => ( extractNumber(token.chain, "id")));
|
|
1981
2072
|
const rawChainString = _nullishCoalesce(extractString(token, "chainId"), () => ( extractString(token.chain, "id")));
|
|
1982
|
-
const chainId = _nullishCoalesce(rawChainId, () => ( (rawChainString ?
|
|
2073
|
+
const chainId = _nullishCoalesce(rawChainId, () => ( (rawChainString ? _chunkOY5N3E6Lcjs.isSolanaCaip2.call(void 0, rawChainString) || rawChainString.toLowerCase() === "solana" ? "solana" : (
|
|
1983
2074
|
// HyperCore is a non-EVM source under its own namespace; keep its
|
|
1984
2075
|
// USDC instead of dropping it as an unparseable chain string.
|
|
1985
|
-
|
|
2076
|
+
_chunkOY5N3E6Lcjs.isHyperCoreCaip2.call(void 0, rawChainString) || rawChainString.toLowerCase() === "hypercore" ? "hypercore" : _chunkOY5N3E6Lcjs.parseEvmChainId.call(void 0, rawChainString)
|
|
1986
2077
|
) : null)));
|
|
1987
2078
|
if (chainId === null) return null;
|
|
1988
|
-
const registryChainId = typeof chainId === "number" ? chainId : chainId === "hypercore" ?
|
|
2079
|
+
const registryChainId = typeof chainId === "number" ? chainId : chainId === "hypercore" ? _chunkOY5N3E6Lcjs.HYPERCORE_CHAIN_ID : void 0;
|
|
1989
2080
|
const symbol = _nullishCoalesce(_nullishCoalesce(_nullishCoalesce(extractString(token, "symbol"), () => ( extractString(token, "tokenSymbol"))), () => ( extractString(token, "tokenName"))), () => ( extractString(token, "name")));
|
|
1990
2081
|
if (!symbol) return null;
|
|
1991
|
-
const balanceValue = _nullishCoalesce(_nullishCoalesce(_nullishCoalesce(_nullishCoalesce(_nullishCoalesce(_nullishCoalesce(_nullishCoalesce(extractString(token, "balance"), () => ( extractString(token, "amount"))), () => ( extractString(token, "value"))), () => ( extractString(token, "rawBalance"))), () => ( _optionalChain([extractNumber, 'call',
|
|
2082
|
+
const balanceValue = _nullishCoalesce(_nullishCoalesce(_nullishCoalesce(_nullishCoalesce(_nullishCoalesce(_nullishCoalesce(_nullishCoalesce(extractString(token, "balance"), () => ( extractString(token, "amount"))), () => ( extractString(token, "value"))), () => ( extractString(token, "rawBalance"))), () => ( _optionalChain([extractNumber, 'call', _50 => _50(token, "balance"), 'optionalAccess', _51 => _51.toString, 'call', _52 => _52()]))), () => ( _optionalChain([extractNumber, 'call', _53 => _53(token, "amount"), 'optionalAccess', _54 => _54.toString, 'call', _55 => _55()]))), () => ( _optionalChain([extractNumber, 'call', _56 => _56(token, "value"), 'optionalAccess', _57 => _57.toString, 'call', _58 => _58()]))), () => ( _optionalChain([extractNumber, 'call', _59 => _59(token, "rawBalance"), 'optionalAccess', _60 => _60.toString, 'call', _61 => _61()])));
|
|
1992
2083
|
if (!balanceValue) return null;
|
|
1993
2084
|
const address = _nullishCoalesce(_nullishCoalesce(_nullishCoalesce(extractString(token, "address"), () => ( extractString(token, "tokenAddress"))), () => ( extractString(
|
|
1994
2085
|
token.token,
|
|
1995
2086
|
"address"
|
|
1996
|
-
))), () => ( (registryChainId !== void 0 ?
|
|
2087
|
+
))), () => ( (registryChainId !== void 0 ? _chunkOY5N3E6Lcjs.getTokenAddress.call(void 0, symbol, registryChainId) : void 0)));
|
|
1997
2088
|
if (!address) return null;
|
|
1998
2089
|
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));
|
|
1999
2090
|
const isSolanaToken = chainId === "solana";
|
|
2000
|
-
const registrySymbol = isSolanaToken ? "Token" :
|
|
2091
|
+
const registrySymbol = isSolanaToken ? "Token" : _chunkOY5N3E6Lcjs.getTokenSymbol.call(void 0, address, registryChainId);
|
|
2001
2092
|
const resolvedSymbol = isSolanaToken ? symbol : registrySymbol !== "Token" ? registrySymbol : symbol;
|
|
2002
2093
|
const backendDecimals = _nullishCoalesce(extractNumber(token, "decimals"), () => ( extractNumber(token, "tokenDecimals")));
|
|
2003
|
-
const resolvedDecimals = !isSolanaToken && registrySymbol !== "Token" ?
|
|
2094
|
+
const resolvedDecimals = !isSolanaToken && registrySymbol !== "Token" ? _chunkOY5N3E6Lcjs.getTokenDecimalsByAddress.call(void 0, address, registryChainId) : _nullishCoalesce(backendDecimals, () => ( 18));
|
|
2004
2095
|
return {
|
|
2005
2096
|
chainId,
|
|
2006
2097
|
address,
|
|
@@ -2013,7 +2104,7 @@ function normalizeDirectToken(token) {
|
|
|
2013
2104
|
}
|
|
2014
2105
|
function extractTokenAddress(tokenData, chainId) {
|
|
2015
2106
|
const token = tokenData;
|
|
2016
|
-
return _nullishCoalesce(_nullishCoalesce(_nullishCoalesce(_nullishCoalesce(token.tokenAddress, () => ( token.address)), () => ( _optionalChain([token, 'access',
|
|
2107
|
+
return _nullishCoalesce(_nullishCoalesce(_nullishCoalesce(_nullishCoalesce(token.tokenAddress, () => ( token.address)), () => ( _optionalChain([token, 'access', _62 => _62.addresses, 'optionalAccess', _63 => _63[chainId]]))), () => ( _optionalChain([token, 'access', _64 => _64.token, 'optionalAccess', _65 => _65.address]))), () => ( _optionalChain([token, 'access', _66 => _66.token, 'optionalAccess', _67 => _67.addresses, 'optionalAccess', _68 => _68[chainId]])));
|
|
2017
2108
|
}
|
|
2018
2109
|
function extractArray(data, key) {
|
|
2019
2110
|
if (!data || typeof data !== "object") return null;
|
|
@@ -2043,7 +2134,7 @@ function extractNumericString(data, key) {
|
|
|
2043
2134
|
// src/core/rpc.ts
|
|
2044
2135
|
|
|
2045
2136
|
function rpcUrlFor(rpcUrls, chain) {
|
|
2046
|
-
const url = _optionalChain([rpcUrls, 'optionalAccess',
|
|
2137
|
+
const url = _optionalChain([rpcUrls, 'optionalAccess', _69 => _69[chain], 'optionalAccess', _70 => _70.trim, 'call', _71 => _71()]);
|
|
2047
2138
|
return url ? url : void 0;
|
|
2048
2139
|
}
|
|
2049
2140
|
var RpcUrlsContext = _react.createContext.call(void 0, void 0);
|
|
@@ -2053,7 +2144,7 @@ function useRpcUrls() {
|
|
|
2053
2144
|
}
|
|
2054
2145
|
function rpcUrlsKey(rpcUrls) {
|
|
2055
2146
|
if (!rpcUrls) return "";
|
|
2056
|
-
return Object.entries(rpcUrls).map(([chain, url]) => [chain, _nullishCoalesce(_optionalChain([url, 'optionalAccess',
|
|
2147
|
+
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("|");
|
|
2057
2148
|
}
|
|
2058
2149
|
function useStableRpcUrls(rpcUrls) {
|
|
2059
2150
|
const key = rpcUrlsKey(rpcUrls);
|
|
@@ -2141,7 +2232,7 @@ async function loadViemChains() {
|
|
|
2141
2232
|
viemChainsPromise = Promise.resolve().then(() => _interopRequireWildcard(require("viem/chains"))).then((module) => {
|
|
2142
2233
|
const map = /* @__PURE__ */ new Map();
|
|
2143
2234
|
for (const value of Object.values(module)) {
|
|
2144
|
-
if (value && typeof value === "object" && typeof value.id === "number" && _optionalChain([value, 'access',
|
|
2235
|
+
if (value && typeof value === "object" && typeof value.id === "number" && _optionalChain([value, 'access', _74 => _74.rpcUrls, 'optionalAccess', _75 => _75.default, 'optionalAccess', _76 => _76.http, 'optionalAccess', _77 => _77.length])) {
|
|
2145
2236
|
const chain = value;
|
|
2146
2237
|
const existing = map.get(chain.id);
|
|
2147
2238
|
if (existing) existing.push(chain);
|
|
@@ -2155,7 +2246,7 @@ async function loadViemChains() {
|
|
|
2155
2246
|
return viemChainsPromise;
|
|
2156
2247
|
}
|
|
2157
2248
|
function pickViemChain(candidates, chain) {
|
|
2158
|
-
if (!_optionalChain([candidates, 'optionalAccess',
|
|
2249
|
+
if (!_optionalChain([candidates, 'optionalAccess', _78 => _78.length])) return void 0;
|
|
2159
2250
|
if (candidates.length === 1) return candidates[0];
|
|
2160
2251
|
const sameNetworkClass = candidates.filter(
|
|
2161
2252
|
(candidate) => Boolean(candidate.testnet) === chain.testnet
|
|
@@ -2171,10 +2262,10 @@ function pickViemChain(candidates, chain) {
|
|
|
2171
2262
|
}
|
|
2172
2263
|
function resolveRpcUrls(chain, override, viemChains) {
|
|
2173
2264
|
const urls = [];
|
|
2174
|
-
if (_optionalChain([override, 'optionalAccess',
|
|
2265
|
+
if (_optionalChain([override, 'optionalAccess', _79 => _79.trim, 'call', _80 => _80()])) urls.push(override.trim());
|
|
2175
2266
|
if (chain.publicRpcUrl) urls.push(chain.publicRpcUrl);
|
|
2176
2267
|
if (chain.chainId !== null && chain.vmType === "evm") {
|
|
2177
|
-
const http2 = _optionalChain([pickViemChain, 'call',
|
|
2268
|
+
const http2 = _optionalChain([pickViemChain, 'call', _81 => _81(_optionalChain([viemChains, 'optionalAccess', _82 => _82.get, 'call', _83 => _83(chain.chainId)]), chain), 'optionalAccess', _84 => _84.rpcUrls, 'optionalAccess', _85 => _85.default, 'optionalAccess', _86 => _86.http]);
|
|
2178
2269
|
if (http2) urls.push(...http2);
|
|
2179
2270
|
}
|
|
2180
2271
|
return [...new Set(urls)];
|
|
@@ -2183,7 +2274,7 @@ function toViemChain(chain, override, viemChains) {
|
|
|
2183
2274
|
if (chain.vmType !== "evm" || chain.chainId === null) return null;
|
|
2184
2275
|
const rpcUrls = resolveRpcUrls(chain, override, viemChains);
|
|
2185
2276
|
if (rpcUrls.length === 0) return null;
|
|
2186
|
-
const bundled = pickViemChain(_optionalChain([viemChains, 'optionalAccess',
|
|
2277
|
+
const bundled = pickViemChain(_optionalChain([viemChains, 'optionalAccess', _87 => _87.get, 'call', _88 => _88(chain.chainId)]), chain);
|
|
2187
2278
|
if (bundled) {
|
|
2188
2279
|
if (rpcUrls[0] === bundled.rpcUrls.default.http[0]) return bundled;
|
|
2189
2280
|
return _viem.defineChain.call(void 0, {
|
|
@@ -2214,7 +2305,7 @@ function toViemChains(catalog, overrides, viemChains) {
|
|
|
2214
2305
|
for (const entry of catalog.all) {
|
|
2215
2306
|
const chain = toViemChain(
|
|
2216
2307
|
entry,
|
|
2217
|
-
entry.chainId === null ? void 0 : _optionalChain([overrides, 'optionalAccess',
|
|
2308
|
+
entry.chainId === null ? void 0 : _optionalChain([overrides, 'optionalAccess', _89 => _89[entry.chainId]]),
|
|
2218
2309
|
viemChains
|
|
2219
2310
|
);
|
|
2220
2311
|
if (chain) chains.push(chain);
|
|
@@ -2223,7 +2314,7 @@ function toViemChains(catalog, overrides, viemChains) {
|
|
|
2223
2314
|
}
|
|
2224
2315
|
function needsViemChains(catalog, overrides) {
|
|
2225
2316
|
return catalog.all.some(
|
|
2226
|
-
(chain) => chain.vmType === "evm" && chain.chainId !== null && !chain.publicRpcUrl && !_optionalChain([overrides, 'optionalAccess',
|
|
2317
|
+
(chain) => chain.vmType === "evm" && chain.chainId !== null && !chain.publicRpcUrl && !_optionalChain([overrides, 'optionalAccess', _90 => _90[chain.chainId], 'optionalAccess', _91 => _91.trim, 'call', _92 => _92()])
|
|
2227
2318
|
);
|
|
2228
2319
|
}
|
|
2229
2320
|
|
|
@@ -2264,29 +2355,44 @@ function peekRuntimeChains(backendUrl, overrides) {
|
|
|
2264
2355
|
return _nullishCoalesce(resolvedChainsByKey.get(runtimeChainsKey(backendUrl, overrides)), () => ( null));
|
|
2265
2356
|
}
|
|
2266
2357
|
function publishCatalogTokens(catalog) {
|
|
2267
|
-
|
|
2268
|
-
catalog.all.flatMap(
|
|
2269
|
-
|
|
2270
|
-
|
|
2358
|
+
_chunkOY5N3E6Lcjs.setRuntimeTokens.call(void 0,
|
|
2359
|
+
catalog.all.flatMap((chain) => {
|
|
2360
|
+
const chainId = _chunkOY5N3E6Lcjs.displayChainIdForCaip2.call(void 0, chain.caip2);
|
|
2361
|
+
if (chainId === null || !Array.isArray(chain.supportedTokens)) return [];
|
|
2362
|
+
const tokens = chain.supportedTokens.map((token) => ({
|
|
2363
|
+
chainId,
|
|
2271
2364
|
symbol: token.symbol,
|
|
2272
2365
|
address: token.address,
|
|
2273
2366
|
decimals: token.decimals
|
|
2274
|
-
}))
|
|
2275
|
-
|
|
2367
|
+
}));
|
|
2368
|
+
if (typeof chainId === "string") {
|
|
2369
|
+
tokens.push({
|
|
2370
|
+
chainId,
|
|
2371
|
+
symbol: chain.nativeToken.symbol,
|
|
2372
|
+
address: "native",
|
|
2373
|
+
decimals: chain.nativeToken.decimals
|
|
2374
|
+
});
|
|
2375
|
+
}
|
|
2376
|
+
return tokens;
|
|
2377
|
+
})
|
|
2276
2378
|
);
|
|
2277
2379
|
}
|
|
2278
2380
|
function publishRuntimeChainMeta(catalog) {
|
|
2279
|
-
|
|
2381
|
+
_chunkOY5N3E6Lcjs.setRuntimeChainMeta.call(void 0,
|
|
2280
2382
|
catalog.all.flatMap((chain) => {
|
|
2281
2383
|
const ids = [];
|
|
2282
2384
|
if (chain.chainId !== null) ids.push(chain.chainId);
|
|
2283
|
-
|
|
2385
|
+
const sentinel = _chunkOY5N3E6Lcjs.displayChainIdForCaip2.call(void 0, chain.caip2);
|
|
2386
|
+
if (sentinel !== null && sentinel !== chain.chainId) ids.push(sentinel);
|
|
2387
|
+
if (_chunkOY5N3E6Lcjs.isHyperCoreCaip2.call(void 0, chain.caip2)) ids.push(_chunkOY5N3E6Lcjs.HYPERCORE_CHAIN_ID);
|
|
2284
2388
|
return ids.map((chainId) => ({
|
|
2285
2389
|
chainId,
|
|
2286
2390
|
name: chain.name,
|
|
2287
2391
|
iconUrl: _nullishCoalesce(chain.iconUrl, () => ( void 0)),
|
|
2288
2392
|
nativeSymbol: chain.nativeToken.symbol,
|
|
2289
|
-
explorerUrl: _optionalChain([chain, 'access',
|
|
2393
|
+
explorerUrl: _optionalChain([chain, 'access', _93 => _93.explorer, 'optionalAccess', _94 => _94.url]),
|
|
2394
|
+
explorerTxPath: _optionalChain([chain, 'access', _95 => _95.explorer, 'optionalAccess', _96 => _96.txPath]),
|
|
2395
|
+
explorerAddressPath: _optionalChain([chain, 'access', _97 => _97.explorer, 'optionalAccess', _98 => _98.addressPath])
|
|
2290
2396
|
}));
|
|
2291
2397
|
})
|
|
2292
2398
|
);
|
|
@@ -2336,8 +2442,8 @@ function useDepositChainIds() {
|
|
|
2336
2442
|
!c.testnet
|
|
2337
2443
|
).map((c) => c.chainId);
|
|
2338
2444
|
const rank = (id) => {
|
|
2339
|
-
const i =
|
|
2340
|
-
return i === -1 ?
|
|
2445
|
+
const i = _chunkOY5N3E6Lcjs.CHAIN_DISPLAY_ORDER.indexOf(id);
|
|
2446
|
+
return i === -1 ? _chunkOY5N3E6Lcjs.CHAIN_DISPLAY_ORDER.length : i;
|
|
2341
2447
|
};
|
|
2342
2448
|
return ids.map((id, i) => ({ id, i })).sort((a, b) => rank(a.id) - rank(b.id) || a.i - b.i).map(({ id }) => id);
|
|
2343
2449
|
}, [catalog]);
|
|
@@ -2347,8 +2453,8 @@ function useDestinationChains() {
|
|
|
2347
2453
|
return _react.useMemo.call(void 0, () => {
|
|
2348
2454
|
if (!catalog) return [];
|
|
2349
2455
|
const rank = (id) => {
|
|
2350
|
-
const i =
|
|
2351
|
-
return i === -1 ?
|
|
2456
|
+
const i = _chunkOY5N3E6Lcjs.CHAIN_DISPLAY_ORDER.indexOf(id);
|
|
2457
|
+
return i === -1 ? _chunkOY5N3E6Lcjs.CHAIN_DISPLAY_ORDER.length : i;
|
|
2352
2458
|
};
|
|
2353
2459
|
return catalog.all.filter(
|
|
2354
2460
|
(c) => c.destination && c.vmType === "evm" && c.chainId !== null && !c.testnet
|
|
@@ -2359,7 +2465,7 @@ function useTargetTokens() {
|
|
|
2359
2465
|
const { catalog, shortlist } = useChainCatalog();
|
|
2360
2466
|
return _react.useMemo.call(void 0, () => {
|
|
2361
2467
|
return (chainId) => {
|
|
2362
|
-
const fromShortlist = _optionalChain([shortlist, 'optionalAccess',
|
|
2468
|
+
const fromShortlist = _optionalChain([shortlist, 'optionalAccess', _99 => _99[String(chainId)]]);
|
|
2363
2469
|
if (fromShortlist) {
|
|
2364
2470
|
return fromShortlist.map((token) => ({
|
|
2365
2471
|
symbol: token.symbol,
|
|
@@ -2367,8 +2473,8 @@ function useTargetTokens() {
|
|
|
2367
2473
|
decimals: token.decimals
|
|
2368
2474
|
}));
|
|
2369
2475
|
}
|
|
2370
|
-
const entry = _optionalChain([catalog, 'optionalAccess',
|
|
2371
|
-
return Array.isArray(_optionalChain([entry, 'optionalAccess',
|
|
2476
|
+
const entry = _optionalChain([catalog, 'optionalAccess', _100 => _100.byChainId, 'access', _101 => _101.get, 'call', _102 => _102(chainId)]);
|
|
2477
|
+
return Array.isArray(_optionalChain([entry, 'optionalAccess', _103 => _103.supportedTokens])) ? entry.supportedTokens.map((token) => ({
|
|
2372
2478
|
symbol: token.symbol,
|
|
2373
2479
|
address: token.address,
|
|
2374
2480
|
decimals: token.decimals
|
|
@@ -2388,10 +2494,10 @@ function useChainName() {
|
|
|
2388
2494
|
const { catalog } = useChainCatalog();
|
|
2389
2495
|
return _react.useMemo.call(void 0, () => {
|
|
2390
2496
|
return (chainId) => {
|
|
2391
|
-
if (!catalog) return
|
|
2497
|
+
if (!catalog) return _chunkOY5N3E6Lcjs.getChainName.call(void 0, chainId);
|
|
2392
2498
|
const key = catalogKeyForChain(chainId);
|
|
2393
2499
|
const entry = typeof key === "number" ? catalog.byChainId.get(key) : catalog.byCaip2.get(key);
|
|
2394
|
-
return _nullishCoalesce(_optionalChain([entry, 'optionalAccess',
|
|
2500
|
+
return _nullishCoalesce(_optionalChain([entry, 'optionalAccess', _104 => _104.name]), () => ( _chunkOY5N3E6Lcjs.getChainName.call(void 0, chainId)));
|
|
2395
2501
|
};
|
|
2396
2502
|
}, [catalog]);
|
|
2397
2503
|
}
|
|
@@ -2413,10 +2519,10 @@ function useExplorerTxUrl() {
|
|
|
2413
2519
|
const { catalog } = useChainCatalog();
|
|
2414
2520
|
return _react.useMemo.call(void 0, () => {
|
|
2415
2521
|
return (chainId, txHash) => {
|
|
2416
|
-
if (chainId === "hypercore") return
|
|
2522
|
+
if (chainId === "hypercore") return _chunkOY5N3E6Lcjs.getExplorerTxUrl.call(void 0, chainId, txHash);
|
|
2417
2523
|
const key = catalog ? catalogKeyForChain(chainId) : void 0;
|
|
2418
|
-
const entry = key === void 0 ? void 0 : typeof key === "number" ? _optionalChain([catalog, 'optionalAccess',
|
|
2419
|
-
return _nullishCoalesce(catalogExplorerTxUrl(entry, txHash), () => (
|
|
2524
|
+
const entry = key === void 0 ? void 0 : typeof key === "number" ? _optionalChain([catalog, 'optionalAccess', _105 => _105.byChainId, 'access', _106 => _106.get, 'call', _107 => _107(key)]) : _optionalChain([catalog, 'optionalAccess', _108 => _108.byCaip2, 'access', _109 => _109.get, 'call', _110 => _110(key)]);
|
|
2525
|
+
return _nullishCoalesce(catalogExplorerTxUrl(entry, txHash), () => ( _chunkOY5N3E6Lcjs.getExplorerTxUrl.call(void 0, chainId, txHash)));
|
|
2420
2526
|
};
|
|
2421
2527
|
}, [catalog]);
|
|
2422
2528
|
}
|
|
@@ -2474,7 +2580,7 @@ function ChainCatalogProvider({
|
|
|
2474
2580
|
setShortlist(null);
|
|
2475
2581
|
service.getTopTokens().then((tokens) => {
|
|
2476
2582
|
if (!active || !tokens) return;
|
|
2477
|
-
|
|
2583
|
+
_chunkOY5N3E6Lcjs.publishShortlistTokens.call(void 0, tokens);
|
|
2478
2584
|
setShortlist(tokens);
|
|
2479
2585
|
});
|
|
2480
2586
|
return () => {
|
|
@@ -2580,60 +2686,6 @@ function Button({
|
|
|
2580
2686
|
}
|
|
2581
2687
|
Button.displayName = "Button";
|
|
2582
2688
|
|
|
2583
|
-
// src/components/ui/Callout.tsx
|
|
2584
|
-
|
|
2585
|
-
function CircleAlertIcon() {
|
|
2586
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2587
|
-
"svg",
|
|
2588
|
-
{
|
|
2589
|
-
width: "16",
|
|
2590
|
-
height: "16",
|
|
2591
|
-
viewBox: "0 0 16 16",
|
|
2592
|
-
fill: "none",
|
|
2593
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
2594
|
-
"aria-hidden": "true",
|
|
2595
|
-
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2596
|
-
"path",
|
|
2597
|
-
{
|
|
2598
|
-
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",
|
|
2599
|
-
stroke: "currentColor",
|
|
2600
|
-
strokeWidth: "1.33",
|
|
2601
|
-
strokeLinecap: "round",
|
|
2602
|
-
strokeLinejoin: "round"
|
|
2603
|
-
}
|
|
2604
|
-
)
|
|
2605
|
-
}
|
|
2606
|
-
);
|
|
2607
|
-
}
|
|
2608
|
-
function Callout({ variant = "error", children, role }) {
|
|
2609
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2610
|
-
"div",
|
|
2611
|
-
{
|
|
2612
|
-
className: `rs-callout rs-callout--${variant}`,
|
|
2613
|
-
role: _nullishCoalesce(role, () => ( (variant === "error" ? "alert" : "status"))),
|
|
2614
|
-
children: [
|
|
2615
|
-
/* @__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, {}) }),
|
|
2616
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-callout-text", children })
|
|
2617
|
-
]
|
|
2618
|
-
}
|
|
2619
|
-
);
|
|
2620
|
-
}
|
|
2621
|
-
Callout.displayName = "Callout";
|
|
2622
|
-
|
|
2623
|
-
// src/components/ui/TokenIcon.tsx
|
|
2624
|
-
|
|
2625
|
-
function TokenIcon({ symbol, className, fallback }) {
|
|
2626
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2627
|
-
CdnIcon,
|
|
2628
|
-
{
|
|
2629
|
-
src: _chunk4KCSH4T3cjs.tokenIconUrl.call(void 0, symbol),
|
|
2630
|
-
className: `rs-token-icon ${_nullishCoalesce(className, () => ( ""))}`.trimEnd(),
|
|
2631
|
-
fallback
|
|
2632
|
-
}
|
|
2633
|
-
);
|
|
2634
|
-
}
|
|
2635
|
-
TokenIcon.displayName = "TokenIcon";
|
|
2636
|
-
|
|
2637
2689
|
// src/core/formatters.ts
|
|
2638
2690
|
var currencyFormatter = new Intl.NumberFormat("en-US", {
|
|
2639
2691
|
style: "currency",
|
|
@@ -2759,29 +2811,34 @@ var EVM_ADDRESS_RE = /^0x[a-fA-F0-9]{40}$/;
|
|
|
2759
2811
|
function resolveTokenDisplay(token, chain, fallback) {
|
|
2760
2812
|
if (token !== void 0) {
|
|
2761
2813
|
if (chain === "solana") {
|
|
2762
|
-
const solanaToken =
|
|
2814
|
+
const solanaToken = _chunkOY5N3E6Lcjs.getSolanaTokenByMint.call(void 0, token);
|
|
2763
2815
|
if (solanaToken) {
|
|
2764
2816
|
return { symbol: solanaToken.symbol, decimals: solanaToken.decimals };
|
|
2765
2817
|
}
|
|
2766
2818
|
} else if (chain === "hypercore") {
|
|
2767
|
-
const t =
|
|
2819
|
+
const t = _chunkOY5N3E6Lcjs.HYPERCORE_SOURCE_TOKENS.find(
|
|
2768
2820
|
(x) => x.address.toLowerCase() === token.toLowerCase()
|
|
2769
2821
|
);
|
|
2770
2822
|
if (t) return { symbol: t.symbol, decimals: t.decimals };
|
|
2823
|
+
} else if (chain === "tron" || chain === "stellar") {
|
|
2824
|
+
const published = _chunkOY5N3E6Lcjs.getRuntimeTokenByAddress.call(void 0, chain, token);
|
|
2825
|
+
if (published) {
|
|
2826
|
+
return { symbol: published.symbol, decimals: published.decimals };
|
|
2827
|
+
}
|
|
2771
2828
|
} else if (EVM_ADDRESS_RE.test(token)) {
|
|
2772
|
-
const symbol =
|
|
2773
|
-
const decimals =
|
|
2829
|
+
const symbol = _chunkOY5N3E6Lcjs.getTokenSymbol.call(void 0, token, chain);
|
|
2830
|
+
const decimals = _chunkOY5N3E6Lcjs.findTokenDecimals.call(void 0, token, chain);
|
|
2774
2831
|
if (symbol !== "Token" || decimals !== void 0) {
|
|
2775
2832
|
return {
|
|
2776
|
-
symbol: symbol !== "Token" ? symbol : _nullishCoalesce(_optionalChain([fallback, 'optionalAccess',
|
|
2777
|
-
decimals: _nullishCoalesce(decimals, () => ( _optionalChain([fallback, 'optionalAccess',
|
|
2833
|
+
symbol: symbol !== "Token" ? symbol : _nullishCoalesce(_optionalChain([fallback, 'optionalAccess', _111 => _111.symbol]), () => ( symbol)),
|
|
2834
|
+
decimals: _nullishCoalesce(decimals, () => ( _optionalChain([fallback, 'optionalAccess', _112 => _112.decimals])))
|
|
2778
2835
|
};
|
|
2779
2836
|
}
|
|
2780
2837
|
}
|
|
2781
2838
|
}
|
|
2782
2839
|
return {
|
|
2783
|
-
symbol: _nullishCoalesce(_optionalChain([fallback, 'optionalAccess',
|
|
2784
|
-
decimals: _optionalChain([fallback, 'optionalAccess',
|
|
2840
|
+
symbol: _nullishCoalesce(_optionalChain([fallback, 'optionalAccess', _113 => _113.symbol]), () => ( "Token")),
|
|
2841
|
+
decimals: _optionalChain([fallback, 'optionalAccess', _114 => _114.decimals])
|
|
2785
2842
|
};
|
|
2786
2843
|
}
|
|
2787
2844
|
function maxFractionDigitsFor(symbol) {
|
|
@@ -2800,7 +2857,7 @@ function tokenAmountToNumber(rawAmount, decimals) {
|
|
|
2800
2857
|
try {
|
|
2801
2858
|
const value = Number(_viem.formatUnits.call(void 0, BigInt(rawAmount), decimals));
|
|
2802
2859
|
return Number.isFinite(value) ? value : void 0;
|
|
2803
|
-
} catch (
|
|
2860
|
+
} catch (e5) {
|
|
2804
2861
|
return void 0;
|
|
2805
2862
|
}
|
|
2806
2863
|
}
|
|
@@ -2819,13 +2876,16 @@ function priceUsdFor(symbol, prices) {
|
|
|
2819
2876
|
}
|
|
2820
2877
|
function isRecognizedToken(address, chain) {
|
|
2821
2878
|
if (address === void 0 || chain === void 0) return false;
|
|
2822
|
-
if (chain === "solana") return
|
|
2879
|
+
if (chain === "solana") return _chunkOY5N3E6Lcjs.getSolanaTokenByMint.call(void 0, address) !== void 0;
|
|
2823
2880
|
if (chain === "hypercore") {
|
|
2824
|
-
return
|
|
2881
|
+
return _chunkOY5N3E6Lcjs.HYPERCORE_SOURCE_TOKENS.some(
|
|
2825
2882
|
(t) => t.address.toLowerCase() === address.toLowerCase()
|
|
2826
2883
|
);
|
|
2827
2884
|
}
|
|
2828
|
-
|
|
2885
|
+
if (chain === "tron" || chain === "stellar") {
|
|
2886
|
+
return _chunkOY5N3E6Lcjs.getRuntimeTokenByAddress.call(void 0, chain, address) !== void 0;
|
|
2887
|
+
}
|
|
2888
|
+
return EVM_ADDRESS_RE.test(address) && _chunkOY5N3E6Lcjs.isRegistryTokenOnChain.call(void 0, address, chain);
|
|
2829
2889
|
}
|
|
2830
2890
|
function estimateReceiveAmount(params) {
|
|
2831
2891
|
const {
|
|
@@ -2855,7 +2915,7 @@ function formatQuotedReceive(output, fallbackSymbol) {
|
|
|
2855
2915
|
let raw;
|
|
2856
2916
|
try {
|
|
2857
2917
|
raw = BigInt(output.amount);
|
|
2858
|
-
} catch (
|
|
2918
|
+
} catch (e6) {
|
|
2859
2919
|
return void 0;
|
|
2860
2920
|
}
|
|
2861
2921
|
if (raw <= 0n) return void 0;
|
|
@@ -2894,8 +2954,12 @@ var FLUSH_DELAY_MS = 5e3;
|
|
|
2894
2954
|
var MAX_BODY_BYTES = 48 * 1024;
|
|
2895
2955
|
var TOKEN_REFRESH_MARGIN_MS = 6e4;
|
|
2896
2956
|
var TOKEN_TIMEOUT_MS = 3e3;
|
|
2957
|
+
var CLOSE_MINT_WAIT_MS = 1500;
|
|
2897
2958
|
var MAX_ATTEMPTS = 3;
|
|
2898
2959
|
var MAX_BACKOFF_MS = 3e4;
|
|
2960
|
+
var IDLE = 0;
|
|
2961
|
+
var CLOSING = 1;
|
|
2962
|
+
var DISMISSAL = 2;
|
|
2899
2963
|
var ENVELOPE_FIELDS = /* @__PURE__ */ new Set([
|
|
2900
2964
|
"type",
|
|
2901
2965
|
"timestamp",
|
|
@@ -2930,14 +2994,15 @@ function createIngestTransport(options) {
|
|
|
2930
2994
|
let timer = null;
|
|
2931
2995
|
let sending = false;
|
|
2932
2996
|
let disposed = false;
|
|
2933
|
-
let
|
|
2934
|
-
let
|
|
2997
|
+
let pendingRun = false;
|
|
2998
|
+
let urgency = IDLE;
|
|
2999
|
+
let minting = null;
|
|
2935
3000
|
let mintAbort = null;
|
|
2936
3001
|
const sleepers = /* @__PURE__ */ new Set();
|
|
2937
3002
|
function report(reason, status) {
|
|
2938
3003
|
try {
|
|
2939
3004
|
onFailure({ reason, status, droppedEvents: dropped });
|
|
2940
|
-
} catch (
|
|
3005
|
+
} catch (e7) {
|
|
2941
3006
|
}
|
|
2942
3007
|
}
|
|
2943
3008
|
function drop(batch, reason, status) {
|
|
@@ -2991,10 +3056,10 @@ function createIngestTransport(options) {
|
|
|
2991
3056
|
}
|
|
2992
3057
|
function interruptForUnload() {
|
|
2993
3058
|
for (const wake of [...sleepers]) wake();
|
|
2994
|
-
_optionalChain([mintAbort, 'optionalAccess',
|
|
3059
|
+
_optionalChain([mintAbort, 'optionalAccess', _115 => _115.abort, 'call', _116 => _116()]);
|
|
2995
3060
|
}
|
|
2996
3061
|
function retryDelay(response, attempt) {
|
|
2997
|
-
const seconds = Number(_optionalChain([response, 'access',
|
|
3062
|
+
const seconds = Number(_optionalChain([response, 'access', _117 => _117.headers, 'optionalAccess', _118 => _118.get, 'optionalCall', _119 => _119("Retry-After")]));
|
|
2998
3063
|
if (Number.isFinite(seconds) && seconds > 0) {
|
|
2999
3064
|
return Math.min(seconds * 1e3, MAX_BACKOFF_MS);
|
|
3000
3065
|
}
|
|
@@ -3009,11 +3074,11 @@ function createIngestTransport(options) {
|
|
|
3009
3074
|
try {
|
|
3010
3075
|
response = await fetchImpl(mintUrl, {
|
|
3011
3076
|
method: "POST",
|
|
3012
|
-
headers:
|
|
3013
|
-
signal: _optionalChain([controller, 'optionalAccess',
|
|
3077
|
+
headers: _chunk5P2PVLS4cjs.serviceHeaders.call(void 0, ),
|
|
3078
|
+
signal: _optionalChain([controller, 'optionalAccess', _120 => _120.signal])
|
|
3014
3079
|
});
|
|
3015
|
-
} catch (
|
|
3016
|
-
if (
|
|
3080
|
+
} catch (e8) {
|
|
3081
|
+
if (urgency !== DISMISSAL) {
|
|
3017
3082
|
mintFailures += 1;
|
|
3018
3083
|
mintBackoffUntil = now() + backoff(mintFailures);
|
|
3019
3084
|
}
|
|
@@ -3040,24 +3105,33 @@ function createIngestTransport(options) {
|
|
|
3040
3105
|
token = { value, expiresAt };
|
|
3041
3106
|
mintFailures = 0;
|
|
3042
3107
|
mintBackoffUntil = 0;
|
|
3043
|
-
} catch (
|
|
3108
|
+
} catch (e9) {
|
|
3044
3109
|
mintUnavailable = true;
|
|
3045
3110
|
report("token_unavailable", response.status);
|
|
3046
3111
|
}
|
|
3047
3112
|
}
|
|
3048
|
-
|
|
3113
|
+
function startMint() {
|
|
3114
|
+
if (!minting) {
|
|
3115
|
+
minting = mintToken().finally(() => {
|
|
3116
|
+
minting = null;
|
|
3117
|
+
});
|
|
3118
|
+
}
|
|
3119
|
+
return minting;
|
|
3120
|
+
}
|
|
3121
|
+
async function ensureToken(maxWaitMs) {
|
|
3049
3122
|
if (mintUnavailable) return;
|
|
3050
3123
|
if (token && token.expiresAt - now() > TOKEN_REFRESH_MARGIN_MS) return;
|
|
3051
3124
|
if (now() < mintBackoffUntil) return;
|
|
3052
|
-
|
|
3125
|
+
const pending = startMint();
|
|
3126
|
+
await (maxWaitMs === void 0 ? pending : Promise.race([pending, sleep(maxWaitMs)]));
|
|
3053
3127
|
}
|
|
3054
|
-
async function deliver(batch
|
|
3128
|
+
async function deliver(batch) {
|
|
3055
3129
|
if (!fetchImpl) return drop(batch, "unsupported");
|
|
3056
3130
|
let attempt = 0;
|
|
3057
3131
|
let refreshed = false;
|
|
3058
3132
|
let unattributed = false;
|
|
3059
3133
|
for (; ; ) {
|
|
3060
|
-
const terminal =
|
|
3134
|
+
const terminal = urgency === DISMISSAL;
|
|
3061
3135
|
attempt += 1;
|
|
3062
3136
|
const headers = {
|
|
3063
3137
|
"Content-Type": "application/json"
|
|
@@ -3071,7 +3145,7 @@ function createIngestTransport(options) {
|
|
|
3071
3145
|
body: bodyOf(batch),
|
|
3072
3146
|
keepalive: true
|
|
3073
3147
|
});
|
|
3074
|
-
} catch (
|
|
3148
|
+
} catch (e10) {
|
|
3075
3149
|
if (terminal || attempt >= MAX_ATTEMPTS) {
|
|
3076
3150
|
return drop(batch, "network");
|
|
3077
3151
|
}
|
|
@@ -3084,7 +3158,7 @@ function createIngestTransport(options) {
|
|
|
3084
3158
|
token = null;
|
|
3085
3159
|
if (!refreshed && !terminal) {
|
|
3086
3160
|
refreshed = true;
|
|
3087
|
-
await
|
|
3161
|
+
await startMint();
|
|
3088
3162
|
if (token) continue;
|
|
3089
3163
|
}
|
|
3090
3164
|
if (!unattributed) {
|
|
@@ -3104,33 +3178,47 @@ function createIngestTransport(options) {
|
|
|
3104
3178
|
return drop(batch, "rejected", status);
|
|
3105
3179
|
}
|
|
3106
3180
|
}
|
|
3107
|
-
|
|
3108
|
-
if (
|
|
3181
|
+
function escalate(level) {
|
|
3182
|
+
if (level <= urgency) return;
|
|
3183
|
+
urgency = level;
|
|
3184
|
+
if (level === DISMISSAL) interruptForUnload();
|
|
3185
|
+
}
|
|
3186
|
+
function onDismissal(event) {
|
|
3187
|
+
if (event.type === "pagehide" || document.visibilityState === "hidden") {
|
|
3188
|
+
escalate(DISMISSAL);
|
|
3189
|
+
}
|
|
3190
|
+
}
|
|
3191
|
+
function dismissalGuard(attach) {
|
|
3192
|
+
if (typeof window === "undefined" || typeof document === "undefined") return;
|
|
3193
|
+
const bind = attach ? "addEventListener" : "removeEventListener";
|
|
3194
|
+
window[bind]("pagehide", onDismissal);
|
|
3195
|
+
document[bind]("visibilitychange", onDismissal);
|
|
3196
|
+
}
|
|
3197
|
+
async function run(level) {
|
|
3198
|
+
escalate(level);
|
|
3109
3199
|
if (sending) {
|
|
3110
|
-
|
|
3111
|
-
pendingTerminal = true;
|
|
3112
|
-
interruptForUnload();
|
|
3113
|
-
}
|
|
3200
|
+
pendingRun = true;
|
|
3114
3201
|
return;
|
|
3115
3202
|
}
|
|
3116
3203
|
sending = true;
|
|
3117
3204
|
try {
|
|
3118
3205
|
while (queue.length > 0) {
|
|
3119
|
-
const terminal = requestedTerminal || terminalRequested;
|
|
3120
3206
|
const batch = takeBatch();
|
|
3121
|
-
if (
|
|
3122
|
-
|
|
3123
|
-
|
|
3207
|
+
if (urgency !== DISMISSAL) {
|
|
3208
|
+
await ensureToken(urgency === CLOSING ? CLOSE_MINT_WAIT_MS : void 0);
|
|
3209
|
+
}
|
|
3210
|
+
await deliver(batch);
|
|
3124
3211
|
}
|
|
3125
3212
|
} finally {
|
|
3126
3213
|
sending = false;
|
|
3127
3214
|
}
|
|
3128
|
-
if (
|
|
3129
|
-
|
|
3130
|
-
await run(
|
|
3215
|
+
if (pendingRun) {
|
|
3216
|
+
pendingRun = false;
|
|
3217
|
+
await run(urgency);
|
|
3131
3218
|
return;
|
|
3132
3219
|
}
|
|
3133
|
-
if (!disposed
|
|
3220
|
+
if (!disposed) urgency = IDLE;
|
|
3221
|
+
else dismissalGuard(false);
|
|
3134
3222
|
}
|
|
3135
3223
|
function clearFlushTimer() {
|
|
3136
3224
|
if (timer !== null) {
|
|
@@ -3142,44 +3230,46 @@ function createIngestTransport(options) {
|
|
|
3142
3230
|
if (timer !== null || disposed) return;
|
|
3143
3231
|
timer = setTimeout(() => {
|
|
3144
3232
|
timer = null;
|
|
3145
|
-
void run(
|
|
3233
|
+
void run(IDLE);
|
|
3146
3234
|
}, FLUSH_DELAY_MS);
|
|
3147
3235
|
}
|
|
3148
3236
|
return {
|
|
3149
3237
|
enqueue(event) {
|
|
3150
3238
|
if (disposed) return;
|
|
3151
3239
|
queue.push(toWireEvent(event));
|
|
3240
|
+
if (sequence === 1) void ensureToken();
|
|
3152
3241
|
if (queue.length > MAX_QUEUE) {
|
|
3153
3242
|
dropped += queue.length - MAX_QUEUE;
|
|
3154
3243
|
queue.splice(0, queue.length - MAX_QUEUE);
|
|
3155
3244
|
}
|
|
3156
3245
|
if (queue.length >= MAX_BATCH) {
|
|
3157
3246
|
clearFlushTimer();
|
|
3158
|
-
void run(
|
|
3247
|
+
void run(IDLE);
|
|
3159
3248
|
} else {
|
|
3160
3249
|
scheduleFlush();
|
|
3161
3250
|
}
|
|
3162
3251
|
},
|
|
3163
3252
|
flush(flushOptions) {
|
|
3164
|
-
const
|
|
3165
|
-
if (disposed && !
|
|
3253
|
+
const dismissal = _nullishCoalesce(_optionalChain([flushOptions, 'optionalAccess', _121 => _121.terminal]), () => ( false));
|
|
3254
|
+
if (disposed && !dismissal) return;
|
|
3166
3255
|
clearFlushTimer();
|
|
3167
|
-
void run(
|
|
3256
|
+
void run(dismissal ? DISMISSAL : IDLE);
|
|
3168
3257
|
},
|
|
3169
3258
|
dispose() {
|
|
3170
3259
|
if (disposed) return;
|
|
3171
3260
|
disposed = true;
|
|
3172
3261
|
clearFlushTimer();
|
|
3173
|
-
|
|
3262
|
+
dismissalGuard(true);
|
|
3263
|
+
void run(CLOSING);
|
|
3174
3264
|
}
|
|
3175
3265
|
};
|
|
3176
3266
|
}
|
|
3177
3267
|
function randomUuid() {
|
|
3178
|
-
if (typeof _optionalChain([globalThis, 'access',
|
|
3268
|
+
if (typeof _optionalChain([globalThis, 'access', _122 => _122.crypto, 'optionalAccess', _123 => _123.randomUUID]) === "function") {
|
|
3179
3269
|
return globalThis.crypto.randomUUID();
|
|
3180
3270
|
}
|
|
3181
3271
|
const bytes = new Uint8Array(16);
|
|
3182
|
-
_optionalChain([globalThis, 'access',
|
|
3272
|
+
_optionalChain([globalThis, 'access', _124 => _124.crypto, 'optionalAccess', _125 => _125.getRandomValues, 'optionalCall', _126 => _126(bytes)]);
|
|
3183
3273
|
if (!bytes.some(Boolean)) {
|
|
3184
3274
|
for (let index = 0; index < bytes.length; index += 1) {
|
|
3185
3275
|
bytes[index] = Math.floor(Math.random() * 256);
|
|
@@ -3193,9 +3283,9 @@ function randomUuid() {
|
|
|
3193
3283
|
function resolveProxyOrigin(backendUrl) {
|
|
3194
3284
|
if (!backendUrl.trim()) return null;
|
|
3195
3285
|
try {
|
|
3196
|
-
const { origin } = new URL(backendUrl, _optionalChain([globalThis, 'access',
|
|
3286
|
+
const { origin } = new URL(backendUrl, _optionalChain([globalThis, 'access', _127 => _127.location, 'optionalAccess', _128 => _128.href]));
|
|
3197
3287
|
return origin.startsWith("http") ? origin : null;
|
|
3198
|
-
} catch (
|
|
3288
|
+
} catch (e11) {
|
|
3199
3289
|
return null;
|
|
3200
3290
|
}
|
|
3201
3291
|
}
|
|
@@ -3230,6 +3320,7 @@ function AnalyticsSession(props) {
|
|
|
3230
3320
|
if (sessionPropertiesRef.current === void 0) {
|
|
3231
3321
|
sessionPropertiesRef.current = cloneAndFreeze(props.sessionProperties);
|
|
3232
3322
|
}
|
|
3323
|
+
if (props.sessionIdRef) props.sessionIdRef.current = sessionIdRef.current;
|
|
3233
3324
|
const onEventRef = _react.useRef.call(void 0, props.onEvent);
|
|
3234
3325
|
onEventRef.current = props.onEvent;
|
|
3235
3326
|
const nowRef = _react.useRef.call(void 0, _nullishCoalesce(props.now, () => ( (() => /* @__PURE__ */ new Date()))));
|
|
@@ -3244,13 +3335,13 @@ function AnalyticsSession(props) {
|
|
|
3244
3335
|
type: "analytics_ingest_failure",
|
|
3245
3336
|
session_id: sessionIdRef.current,
|
|
3246
3337
|
modal,
|
|
3247
|
-
widget_version:
|
|
3338
|
+
widget_version: _chunk5P2PVLS4cjs.MODAL_VERSION,
|
|
3248
3339
|
timestamp: nowRef.current().toISOString(),
|
|
3249
3340
|
reason,
|
|
3250
3341
|
...status === void 0 ? {} : { status },
|
|
3251
3342
|
dropped_events: droppedEvents
|
|
3252
3343
|
};
|
|
3253
|
-
_optionalChain([onEventRef, 'access',
|
|
3344
|
+
_optionalChain([onEventRef, 'access', _129 => _129.current, 'optionalCall', _130 => _130(event)]);
|
|
3254
3345
|
},
|
|
3255
3346
|
[modal]
|
|
3256
3347
|
);
|
|
@@ -3272,7 +3363,7 @@ function AnalyticsSession(props) {
|
|
|
3272
3363
|
proxyOrigin,
|
|
3273
3364
|
sessionId: sessionIdRef.current,
|
|
3274
3365
|
modal,
|
|
3275
|
-
widgetVersion:
|
|
3366
|
+
widgetVersion: _chunk5P2PVLS4cjs.MODAL_VERSION,
|
|
3276
3367
|
sessionProperties: sessionPropertiesRef.current,
|
|
3277
3368
|
onFailure: (failure) => emitFailure(failure),
|
|
3278
3369
|
fetchImpl: props.fetchImpl,
|
|
@@ -3289,10 +3380,10 @@ function AnalyticsSession(props) {
|
|
|
3289
3380
|
const enqueue = _react.useCallback.call(void 0,
|
|
3290
3381
|
(event) => {
|
|
3291
3382
|
try {
|
|
3292
|
-
_optionalChain([ingestRef, 'access',
|
|
3383
|
+
_optionalChain([ingestRef, 'access', _131 => _131.current, 'optionalAccess', _132 => _132.transport, 'optionalAccess', _133 => _133.enqueue, 'call', _134 => _134(
|
|
3293
3384
|
event
|
|
3294
3385
|
)]);
|
|
3295
|
-
} catch (
|
|
3386
|
+
} catch (e12) {
|
|
3296
3387
|
}
|
|
3297
3388
|
},
|
|
3298
3389
|
[]
|
|
@@ -3328,12 +3419,12 @@ function AnalyticsSession(props) {
|
|
|
3328
3419
|
...payload,
|
|
3329
3420
|
session_id: sessionIdRef.current,
|
|
3330
3421
|
modal,
|
|
3331
|
-
widget_version:
|
|
3422
|
+
widget_version: _chunk5P2PVLS4cjs.MODAL_VERSION,
|
|
3332
3423
|
timestamp: nowRef.current().toISOString(),
|
|
3333
3424
|
session_properties: sessionPropertiesRef.current,
|
|
3334
3425
|
funding_method: fundingMethod
|
|
3335
3426
|
};
|
|
3336
|
-
_optionalChain([onEventRef, 'access',
|
|
3427
|
+
_optionalChain([onEventRef, 'access', _135 => _135.current, 'optionalCall', _136 => _136(
|
|
3337
3428
|
event
|
|
3338
3429
|
)]);
|
|
3339
3430
|
enqueue(event);
|
|
@@ -3347,11 +3438,11 @@ function AnalyticsSession(props) {
|
|
|
3347
3438
|
...payload,
|
|
3348
3439
|
session_id: sessionIdRef.current,
|
|
3349
3440
|
modal,
|
|
3350
|
-
widget_version:
|
|
3441
|
+
widget_version: _chunk5P2PVLS4cjs.MODAL_VERSION,
|
|
3351
3442
|
timestamp: nowRef.current().toISOString(),
|
|
3352
3443
|
session_properties: sessionPropertiesRef.current
|
|
3353
3444
|
};
|
|
3354
|
-
_optionalChain([onEventRef, 'access',
|
|
3445
|
+
_optionalChain([onEventRef, 'access', _137 => _137.current, 'optionalCall', _138 => _138(event)]);
|
|
3355
3446
|
enqueue(event);
|
|
3356
3447
|
},
|
|
3357
3448
|
[enqueue, modal, nowRef, onEventRef]
|
|
@@ -3363,11 +3454,11 @@ function AnalyticsSession(props) {
|
|
|
3363
3454
|
...payload,
|
|
3364
3455
|
session_id: sessionIdRef.current,
|
|
3365
3456
|
modal,
|
|
3366
|
-
widget_version:
|
|
3457
|
+
widget_version: _chunk5P2PVLS4cjs.MODAL_VERSION,
|
|
3367
3458
|
timestamp: nowRef.current().toISOString(),
|
|
3368
3459
|
session_properties: sessionPropertiesRef.current
|
|
3369
3460
|
};
|
|
3370
|
-
_optionalChain([onEventRef, 'access',
|
|
3461
|
+
_optionalChain([onEventRef, 'access', _139 => _139.current, 'optionalCall', _140 => _140(event)]);
|
|
3371
3462
|
enqueue(event);
|
|
3372
3463
|
},
|
|
3373
3464
|
[enqueue, modal, nowRef, onEventRef]
|
|
@@ -3394,6 +3485,747 @@ function useClaimAnalyticsEmitter() {
|
|
|
3394
3485
|
return context.emit;
|
|
3395
3486
|
}
|
|
3396
3487
|
|
|
3488
|
+
// src/core/history-recovery.ts
|
|
3489
|
+
|
|
3490
|
+
var RECOVERABLE_STATUSES = /* @__PURE__ */ new Set(["failed", "rejected"]);
|
|
3491
|
+
function recoverySigningChainId(row) {
|
|
3492
|
+
return _chunkOY5N3E6Lcjs.parseEvmChainId.call(void 0, row.targetChain);
|
|
3493
|
+
}
|
|
3494
|
+
function sourceDepositTxHash(row) {
|
|
3495
|
+
return _nullishCoalesce(row.sourceTxHash, () => ( row.txHash));
|
|
3496
|
+
}
|
|
3497
|
+
function toRecoverableDeposit(row, options = {}) {
|
|
3498
|
+
if (!row.id) return null;
|
|
3499
|
+
if (!RECOVERABLE_STATUSES.has((_nullishCoalesce(row.status, () => ( ""))).toLowerCase())) return null;
|
|
3500
|
+
const sourceChainId = _chunkOY5N3E6Lcjs.parseEvmChainId.call(void 0, row.chain);
|
|
3501
|
+
const targetChainId = recoverySigningChainId(row);
|
|
3502
|
+
if (sourceChainId === null || targetChainId === null) return null;
|
|
3503
|
+
const signer = row.recipient;
|
|
3504
|
+
if (!signer || !_viem.isAddress.call(void 0, signer)) return null;
|
|
3505
|
+
if (options.recipient && options.recipient.toLowerCase() !== signer.toLowerCase()) {
|
|
3506
|
+
return null;
|
|
3507
|
+
}
|
|
3508
|
+
return {
|
|
3509
|
+
depositId: row.id,
|
|
3510
|
+
signer,
|
|
3511
|
+
destinationPrefill: signer,
|
|
3512
|
+
sourceChainId,
|
|
3513
|
+
targetChainId,
|
|
3514
|
+
token: row.token,
|
|
3515
|
+
amountRaw: row.sourceAmount && row.sourceAmount !== "0" ? row.sourceAmount : row.amount,
|
|
3516
|
+
sourceTxHash: sourceDepositTxHash(row)
|
|
3517
|
+
};
|
|
3518
|
+
}
|
|
3519
|
+
function recoveryFailureCause(sourceChainName) {
|
|
3520
|
+
return sourceChainName ? `This deposit couldn't be completed. Your funds are still on ${sourceChainName}.` : "This deposit couldn't be completed and your funds were not moved.";
|
|
3521
|
+
}
|
|
3522
|
+
|
|
3523
|
+
// src/core/recovery-lookup.ts
|
|
3524
|
+
function isRecoveryTxHash(value) {
|
|
3525
|
+
return /^0x[a-fA-F0-9]{64}$/.test(value);
|
|
3526
|
+
}
|
|
3527
|
+
var RECOVERY_LOOKUP_MISS_COPY = {
|
|
3528
|
+
not_found: "No deposits found for this transaction.",
|
|
3529
|
+
none_eligible: "This transaction has no failed or rejected deposits available to recover."
|
|
3530
|
+
};
|
|
3531
|
+
function classifyRecoveryLookup(rows, options = {}) {
|
|
3532
|
+
const inScope = options.recipient ? rows.filter(
|
|
3533
|
+
(row) => _optionalChain([row, 'access', _141 => _141.recipient, 'optionalAccess', _142 => _142.toLowerCase, 'call', _143 => _143()]) === _optionalChain([options, 'access', _144 => _144.recipient, 'optionalAccess', _145 => _145.toLowerCase, 'call', _146 => _146()])
|
|
3534
|
+
) : rows;
|
|
3535
|
+
const eligible = inScope.map((row) => toRecoverableDeposit(row, options)).filter((deposit) => deposit !== null);
|
|
3536
|
+
return {
|
|
3537
|
+
rows: inScope,
|
|
3538
|
+
eligible,
|
|
3539
|
+
miss: inScope.length === 0 ? "not_found" : eligible.length === 0 ? "none_eligible" : null
|
|
3540
|
+
};
|
|
3541
|
+
}
|
|
3542
|
+
|
|
3543
|
+
// src/components/recovery/RecoveryLookupScreen.tsx
|
|
3544
|
+
|
|
3545
|
+
|
|
3546
|
+
// src/components/ui/Callout.tsx
|
|
3547
|
+
|
|
3548
|
+
function CircleAlertIcon() {
|
|
3549
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3550
|
+
"svg",
|
|
3551
|
+
{
|
|
3552
|
+
width: "16",
|
|
3553
|
+
height: "16",
|
|
3554
|
+
viewBox: "0 0 16 16",
|
|
3555
|
+
fill: "none",
|
|
3556
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
3557
|
+
"aria-hidden": "true",
|
|
3558
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3559
|
+
"path",
|
|
3560
|
+
{
|
|
3561
|
+
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",
|
|
3562
|
+
stroke: "currentColor",
|
|
3563
|
+
strokeWidth: "1.33",
|
|
3564
|
+
strokeLinecap: "round",
|
|
3565
|
+
strokeLinejoin: "round"
|
|
3566
|
+
}
|
|
3567
|
+
)
|
|
3568
|
+
}
|
|
3569
|
+
);
|
|
3570
|
+
}
|
|
3571
|
+
function Callout({ variant = "error", children, role }) {
|
|
3572
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3573
|
+
"div",
|
|
3574
|
+
{
|
|
3575
|
+
className: `rs-callout rs-callout--${variant}`,
|
|
3576
|
+
role: _nullishCoalesce(role, () => ( (variant === "error" ? "alert" : "status"))),
|
|
3577
|
+
children: [
|
|
3578
|
+
/* @__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, {}) }),
|
|
3579
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-callout-text", children })
|
|
3580
|
+
]
|
|
3581
|
+
}
|
|
3582
|
+
);
|
|
3583
|
+
}
|
|
3584
|
+
Callout.displayName = "Callout";
|
|
3585
|
+
|
|
3586
|
+
// src/components/ui/Input.tsx
|
|
3587
|
+
|
|
3588
|
+
|
|
3589
|
+
var Input = _react.forwardRef.call(void 0,
|
|
3590
|
+
({ label, error, hint, variant, className = "", ...props }, ref) => {
|
|
3591
|
+
const inputVariant = error ? "error" : variant || "default";
|
|
3592
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-input-wrapper", children: [
|
|
3593
|
+
label && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "label", { className: "rs-input-label", children: label }),
|
|
3594
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3595
|
+
"input",
|
|
3596
|
+
{
|
|
3597
|
+
ref,
|
|
3598
|
+
className: `rs-input rs-input--${inputVariant} ${className}`,
|
|
3599
|
+
...props
|
|
3600
|
+
}
|
|
3601
|
+
),
|
|
3602
|
+
error ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "p", { className: "rs-input-error", children: [
|
|
3603
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, AlertTriangleIcon, { className: "rs-input-error-icon" }),
|
|
3604
|
+
error
|
|
3605
|
+
] }) : hint && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "rs-input-hint", children: hint })
|
|
3606
|
+
] });
|
|
3607
|
+
}
|
|
3608
|
+
);
|
|
3609
|
+
Input.displayName = "Input";
|
|
3610
|
+
|
|
3611
|
+
// src/components/recovery/RecoveryLookupScreen.tsx
|
|
3612
|
+
|
|
3613
|
+
function RecoveryLookupScreen({
|
|
3614
|
+
title,
|
|
3615
|
+
subtitle,
|
|
3616
|
+
hint,
|
|
3617
|
+
submitLabel = "Find deposit",
|
|
3618
|
+
defaultTxHash,
|
|
3619
|
+
loading,
|
|
3620
|
+
error,
|
|
3621
|
+
onSubmit,
|
|
3622
|
+
onInvalid
|
|
3623
|
+
}) {
|
|
3624
|
+
const [txHash, setTxHash] = _react.useState.call(void 0, _nullishCoalesce(defaultTxHash, () => ( "")));
|
|
3625
|
+
const onInvalidRef = useLatestRef(onInvalid);
|
|
3626
|
+
const trimmed = txHash.trim();
|
|
3627
|
+
const valid = isRecoveryTxHash(trimmed);
|
|
3628
|
+
_react.useEffect.call(void 0, () => {
|
|
3629
|
+
if (trimmed.length > 0 && !valid) {
|
|
3630
|
+
_optionalChain([onInvalidRef, 'access', _147 => _147.current, 'optionalCall', _148 => _148()]);
|
|
3631
|
+
}
|
|
3632
|
+
}, [trimmed, valid, onInvalidRef]);
|
|
3633
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-screen", children: [
|
|
3634
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-screen-body rs-screen-body--gap-32", children: [
|
|
3635
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3636
|
+
BodyHeader,
|
|
3637
|
+
{
|
|
3638
|
+
icon: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, HandCoinsIcon, {}),
|
|
3639
|
+
title,
|
|
3640
|
+
subtitle
|
|
3641
|
+
}
|
|
3642
|
+
),
|
|
3643
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3644
|
+
Input,
|
|
3645
|
+
{
|
|
3646
|
+
label: "Transaction hash",
|
|
3647
|
+
placeholder: "0x\u2026",
|
|
3648
|
+
value: txHash,
|
|
3649
|
+
onChange: (e) => setTxHash(e.target.value),
|
|
3650
|
+
hint,
|
|
3651
|
+
error: trimmed.length > 0 && !valid ? "Enter a valid transaction hash" : void 0
|
|
3652
|
+
}
|
|
3653
|
+
),
|
|
3654
|
+
error && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Callout, { variant: "error", children: error }),
|
|
3655
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3656
|
+
Button,
|
|
3657
|
+
{
|
|
3658
|
+
onClick: () => valid && onSubmit(trimmed.startsWith("0x") ? trimmed.toLowerCase() : trimmed),
|
|
3659
|
+
loading,
|
|
3660
|
+
loadingText: "Searching\u2026",
|
|
3661
|
+
disabled: !valid,
|
|
3662
|
+
fullWidth: true,
|
|
3663
|
+
children: submitLabel
|
|
3664
|
+
}
|
|
3665
|
+
)
|
|
3666
|
+
] }),
|
|
3667
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, PoweredBy, {})
|
|
3668
|
+
] });
|
|
3669
|
+
}
|
|
3670
|
+
RecoveryLookupScreen.displayName = "RecoveryLookupScreen";
|
|
3671
|
+
|
|
3672
|
+
// src/components/recovery/recovery-display.ts
|
|
3673
|
+
|
|
3674
|
+
function describeRecoveryDeposit(params) {
|
|
3675
|
+
const token = _nullishCoalesce(params.token, () => ( "0x"));
|
|
3676
|
+
const decimals = _chunkOY5N3E6Lcjs.getTokenDecimalsByAddress.call(void 0, token, params.chainId);
|
|
3677
|
+
const symbol = _chunkOY5N3E6Lcjs.getTokenSymbol.call(void 0, token, params.chainId);
|
|
3678
|
+
const raw = toBigInt(params.amountRaw);
|
|
3679
|
+
const human = Number(_viem.formatUnits.call(void 0, raw, decimals));
|
|
3680
|
+
return {
|
|
3681
|
+
symbol,
|
|
3682
|
+
decimals,
|
|
3683
|
+
amount: _nullishCoalesce(formatTokenAmount(human, symbol), () => ( _viem.formatUnits.call(void 0, raw, decimals))),
|
|
3684
|
+
chainName: _chunkOY5N3E6Lcjs.getChainName.call(void 0, params.chainId),
|
|
3685
|
+
chainIcon: _chunkOY5N3E6Lcjs.getChainIcon.call(void 0, params.chainId)
|
|
3686
|
+
};
|
|
3687
|
+
}
|
|
3688
|
+
function formatRecoveryAmount(amountRaw, decimals, symbol) {
|
|
3689
|
+
const raw = toBigInt(amountRaw);
|
|
3690
|
+
return _nullishCoalesce(formatTokenAmount(Number(_viem.formatUnits.call(void 0, raw, decimals)), symbol), () => ( _viem.formatUnits.call(void 0, raw, decimals)));
|
|
3691
|
+
}
|
|
3692
|
+
function toBigInt(value) {
|
|
3693
|
+
try {
|
|
3694
|
+
return BigInt(value || "0");
|
|
3695
|
+
} catch (e13) {
|
|
3696
|
+
return 0n;
|
|
3697
|
+
}
|
|
3698
|
+
}
|
|
3699
|
+
function shortenHash(hash) {
|
|
3700
|
+
return `${hash.slice(0, 10)}\u2026${hash.slice(-8)}`;
|
|
3701
|
+
}
|
|
3702
|
+
function shortenAddress(addr) {
|
|
3703
|
+
return addr.length > 12 ? `${addr.slice(0, 6)}\u2026${addr.slice(-4)}` : addr;
|
|
3704
|
+
}
|
|
3705
|
+
|
|
3706
|
+
// src/core/recovery.ts
|
|
3707
|
+
var RECOVER_DOMAIN = {
|
|
3708
|
+
name: "Rhinestone Deposit Recovery",
|
|
3709
|
+
version: "1"
|
|
3710
|
+
};
|
|
3711
|
+
var RECOVER_TYPES = {
|
|
3712
|
+
RecoverDeposit: [
|
|
3713
|
+
{ name: "depositId", type: "uint256" },
|
|
3714
|
+
{ name: "destination", type: "address" }
|
|
3715
|
+
]
|
|
3716
|
+
};
|
|
3717
|
+
var RecoveryError = class extends Error {
|
|
3718
|
+
constructor(message, status, code, retryable = false, phase = "response") {
|
|
3719
|
+
super(message);
|
|
3720
|
+
this.name = "RecoveryError";
|
|
3721
|
+
this.status = status;
|
|
3722
|
+
this.code = code;
|
|
3723
|
+
this.retryable = retryable;
|
|
3724
|
+
this.phase = phase;
|
|
3725
|
+
}
|
|
3726
|
+
};
|
|
3727
|
+
function formatRecoveryError(status, code, serverMessage) {
|
|
3728
|
+
switch (code) {
|
|
3729
|
+
case "DEPOSIT_NOT_RECOVERABLE":
|
|
3730
|
+
return {
|
|
3731
|
+
message: "This deposit can't be recovered \u2014 it may already have been claimed.",
|
|
3732
|
+
retryable: false
|
|
3733
|
+
};
|
|
3734
|
+
case "RECOVERY_UNSUPPORTED":
|
|
3735
|
+
return {
|
|
3736
|
+
message: "This deposit can't be recovered automatically. Contact support to get your funds back.",
|
|
3737
|
+
retryable: false
|
|
3738
|
+
};
|
|
3739
|
+
case "SIGNATURE_INVALID":
|
|
3740
|
+
return {
|
|
3741
|
+
message: "That signature wasn't accepted for this wallet. Contact support to recover this deposit.",
|
|
3742
|
+
retryable: false
|
|
3743
|
+
};
|
|
3744
|
+
case "VERIFICATION_UNAVAILABLE":
|
|
3745
|
+
return {
|
|
3746
|
+
message: "Couldn't verify your signature just now. Try again shortly.",
|
|
3747
|
+
retryable: true
|
|
3748
|
+
};
|
|
3749
|
+
case "REFUND_RECONCILIATION_REQUIRED":
|
|
3750
|
+
return {
|
|
3751
|
+
message: "Your recovery is being reviewed. Contact support with this deposit if it doesn't arrive.",
|
|
3752
|
+
retryable: false
|
|
3753
|
+
};
|
|
3754
|
+
case "REFUND_FAILED":
|
|
3755
|
+
return {
|
|
3756
|
+
message: _nullishCoalesce(serverMessage, () => ( "The recovery couldn't be completed. Please try again or contact support.")),
|
|
3757
|
+
retryable: true
|
|
3758
|
+
};
|
|
3759
|
+
default:
|
|
3760
|
+
if (status === 0) {
|
|
3761
|
+
return {
|
|
3762
|
+
message: "Couldn't reach the recovery service. Check your connection and try again.",
|
|
3763
|
+
retryable: true
|
|
3764
|
+
};
|
|
3765
|
+
}
|
|
3766
|
+
return {
|
|
3767
|
+
message: _nullishCoalesce(serverMessage, () => ( "The recovery couldn't be completed. Please try again or contact support.")),
|
|
3768
|
+
retryable: true
|
|
3769
|
+
};
|
|
3770
|
+
}
|
|
3771
|
+
}
|
|
3772
|
+
async function submitSignedRecovery(params) {
|
|
3773
|
+
const { backendUrl, chainId, depositId, signer, destination, signRecovery, debug } = params;
|
|
3774
|
+
const scope = "service:recovery";
|
|
3775
|
+
const typedData = {
|
|
3776
|
+
domain: RECOVER_DOMAIN,
|
|
3777
|
+
types: RECOVER_TYPES,
|
|
3778
|
+
primaryType: "RecoverDeposit",
|
|
3779
|
+
message: { depositId: BigInt(depositId), destination }
|
|
3780
|
+
};
|
|
3781
|
+
let signature;
|
|
3782
|
+
try {
|
|
3783
|
+
signature = await signRecovery({
|
|
3784
|
+
typedData,
|
|
3785
|
+
chainId,
|
|
3786
|
+
signer,
|
|
3787
|
+
depositId,
|
|
3788
|
+
destination
|
|
3789
|
+
});
|
|
3790
|
+
} catch (error) {
|
|
3791
|
+
debugError(debug, scope, "signRecovery:failed", error);
|
|
3792
|
+
throw new RecoveryError(
|
|
3793
|
+
"Signature request was declined. Approve it in your wallet to recover this deposit.",
|
|
3794
|
+
0,
|
|
3795
|
+
void 0,
|
|
3796
|
+
true,
|
|
3797
|
+
"signature"
|
|
3798
|
+
);
|
|
3799
|
+
}
|
|
3800
|
+
if (!signature) {
|
|
3801
|
+
throw new RecoveryError(
|
|
3802
|
+
"Signature request was declined. Approve it in your wallet to recover this deposit.",
|
|
3803
|
+
0,
|
|
3804
|
+
void 0,
|
|
3805
|
+
true,
|
|
3806
|
+
"signature"
|
|
3807
|
+
);
|
|
3808
|
+
}
|
|
3809
|
+
const url = `${backendUrl.replace(/\/$/, "")}/deposits/recover`;
|
|
3810
|
+
debugLog(debug, scope, "submitSignedRecovery:request", {
|
|
3811
|
+
url,
|
|
3812
|
+
depositId,
|
|
3813
|
+
signer
|
|
3814
|
+
});
|
|
3815
|
+
let response;
|
|
3816
|
+
try {
|
|
3817
|
+
response = await fetch(url, {
|
|
3818
|
+
method: "POST",
|
|
3819
|
+
// The shared const, so recovery carries `x-deposit-modal-version` like
|
|
3820
|
+
// every other backend call. Without it this path would be invisible in the
|
|
3821
|
+
// per-client version telemetry the processor records.
|
|
3822
|
+
headers: _chunk5P2PVLS4cjs.serviceHeaders.call(void 0, ),
|
|
3823
|
+
// `depositId` as a string: it is a uint256 upstream and JSON numbers lose
|
|
3824
|
+
// precision well before that range.
|
|
3825
|
+
body: JSON.stringify({ depositId, destination, signature })
|
|
3826
|
+
});
|
|
3827
|
+
} catch (error) {
|
|
3828
|
+
debugError(debug, scope, "submitSignedRecovery:network", error);
|
|
3829
|
+
const { message, retryable } = formatRecoveryError(0);
|
|
3830
|
+
throw new RecoveryError(message, 0, void 0, retryable, "request");
|
|
3831
|
+
}
|
|
3832
|
+
if (!response.ok) {
|
|
3833
|
+
const body = await response.json().catch(() => ({}));
|
|
3834
|
+
debugError(debug, scope, "submitSignedRecovery:failed", body, {
|
|
3835
|
+
status: response.status
|
|
3836
|
+
});
|
|
3837
|
+
const { message, retryable } = formatRecoveryError(
|
|
3838
|
+
response.status,
|
|
3839
|
+
body.code,
|
|
3840
|
+
body.error
|
|
3841
|
+
);
|
|
3842
|
+
throw new RecoveryError(
|
|
3843
|
+
message,
|
|
3844
|
+
response.status,
|
|
3845
|
+
body.code,
|
|
3846
|
+
retryable,
|
|
3847
|
+
"response"
|
|
3848
|
+
);
|
|
3849
|
+
}
|
|
3850
|
+
const result = await response.json();
|
|
3851
|
+
debugLog(debug, scope, "submitSignedRecovery:success", {
|
|
3852
|
+
transactionHash: result.transactionHash
|
|
3853
|
+
});
|
|
3854
|
+
return result;
|
|
3855
|
+
}
|
|
3856
|
+
|
|
3857
|
+
// src/core/claim-analytics.tsx
|
|
3858
|
+
|
|
3859
|
+
|
|
3860
|
+
|
|
3861
|
+
|
|
3862
|
+
|
|
3863
|
+
|
|
3864
|
+
function claimFailureReasonForError(error) {
|
|
3865
|
+
if (!(error instanceof RecoveryError)) return "refund_failed";
|
|
3866
|
+
switch (error.code) {
|
|
3867
|
+
case "SIGNATURE_INVALID":
|
|
3868
|
+
return "signature_invalid";
|
|
3869
|
+
case "DEPOSIT_NOT_RECOVERABLE":
|
|
3870
|
+
return "recovery_deposit_not_recoverable";
|
|
3871
|
+
case "RECOVERY_UNSUPPORTED":
|
|
3872
|
+
return "recovery_unsupported";
|
|
3873
|
+
case "VERIFICATION_UNAVAILABLE":
|
|
3874
|
+
return "signature_verification_unavailable";
|
|
3875
|
+
case "REFUND_RECONCILIATION_REQUIRED":
|
|
3876
|
+
return "refund_reconciliation_required";
|
|
3877
|
+
case "REFUND_FAILED":
|
|
3878
|
+
return "refund_failed";
|
|
3879
|
+
default:
|
|
3880
|
+
if (error.phase === "signature") return "signature_rejected";
|
|
3881
|
+
if (error.phase === "request") return "refund_service_unreachable";
|
|
3882
|
+
return "refund_failed";
|
|
3883
|
+
}
|
|
3884
|
+
}
|
|
3885
|
+
function createClaimAnalyticsController(emit, correlation) {
|
|
3886
|
+
const emitCorrelated = correlation ? (payload) => emit({ ...payload, ...correlation }) : emit;
|
|
3887
|
+
let step = null;
|
|
3888
|
+
let afterHandoff = false;
|
|
3889
|
+
let opened = false;
|
|
3890
|
+
let closed = false;
|
|
3891
|
+
const dedupe = /* @__PURE__ */ new Set();
|
|
3892
|
+
const send = (payload) => {
|
|
3893
|
+
controller.openSession();
|
|
3894
|
+
emitCorrelated(payload);
|
|
3895
|
+
};
|
|
3896
|
+
const emitOnce = (key, payload) => {
|
|
3897
|
+
if (dedupe.has(key)) return;
|
|
3898
|
+
dedupe.add(key);
|
|
3899
|
+
send(payload);
|
|
3900
|
+
};
|
|
3901
|
+
const rearmStep = (rearmed) => {
|
|
3902
|
+
for (const key of [...dedupe]) {
|
|
3903
|
+
if (key.includes(`:${rearmed}:`)) dedupe.delete(key);
|
|
3904
|
+
}
|
|
3905
|
+
};
|
|
3906
|
+
const controller = {
|
|
3907
|
+
openSession() {
|
|
3908
|
+
if (opened) return;
|
|
3909
|
+
opened = true;
|
|
3910
|
+
emitCorrelated({ type: "claim_modal_open" });
|
|
3911
|
+
},
|
|
3912
|
+
openStep(nextStep) {
|
|
3913
|
+
controller.openSession();
|
|
3914
|
+
if (step === nextStep) return;
|
|
3915
|
+
step = nextStep;
|
|
3916
|
+
emitOnce(`step-open:${nextStep}`, {
|
|
3917
|
+
type: "claim_modal_step_open",
|
|
3918
|
+
step: nextStep
|
|
3919
|
+
});
|
|
3920
|
+
},
|
|
3921
|
+
completeStep(completedStep = _nullishCoalesce(step, () => ( void 0))) {
|
|
3922
|
+
if (!completedStep) return;
|
|
3923
|
+
emitOnce(`step-complete:${completedStep}`, {
|
|
3924
|
+
type: "claim_modal_step_complete",
|
|
3925
|
+
step: completedStep
|
|
3926
|
+
});
|
|
3927
|
+
},
|
|
3928
|
+
rearmStep(rearmed) {
|
|
3929
|
+
rearmStep(rearmed);
|
|
3930
|
+
},
|
|
3931
|
+
// One per submitted search, never deduplicated: the searched hash is
|
|
3932
|
+
// deliberately not in the stream, so collapsing two searches that returned
|
|
3933
|
+
// the same counts would make the second one unrecoverable.
|
|
3934
|
+
lookupResult(matches, eligible) {
|
|
3935
|
+
send({
|
|
3936
|
+
type: "claim_modal_lookup_result",
|
|
3937
|
+
matches,
|
|
3938
|
+
eligible
|
|
3939
|
+
});
|
|
3940
|
+
},
|
|
3941
|
+
selectDeposit({ depositId, transactionHash, autoSelected }) {
|
|
3942
|
+
emitOnce(`deposit-selected:${depositId}`, {
|
|
3943
|
+
type: "claim_modal_deposit_selected",
|
|
3944
|
+
deposit_id: depositId,
|
|
3945
|
+
transaction_hash: transactionHash,
|
|
3946
|
+
auto_selected: autoSelected
|
|
3947
|
+
});
|
|
3948
|
+
},
|
|
3949
|
+
friction(reason, eventStep = _nullishCoalesce(step, () => ( void 0))) {
|
|
3950
|
+
if (!eventStep) return;
|
|
3951
|
+
emitOnce(`friction:${eventStep}:${reason}`, {
|
|
3952
|
+
type: "claim_modal_friction",
|
|
3953
|
+
step: eventStep,
|
|
3954
|
+
reason
|
|
3955
|
+
});
|
|
3956
|
+
},
|
|
3957
|
+
failure(reason, retryable, eventStep = _nullishCoalesce(step, () => ( void 0))) {
|
|
3958
|
+
if (!eventStep) return;
|
|
3959
|
+
emitOnce(`failure:${eventStep}:${reason}`, {
|
|
3960
|
+
type: "claim_modal_failure",
|
|
3961
|
+
step: eventStep,
|
|
3962
|
+
reason,
|
|
3963
|
+
retryable
|
|
3964
|
+
});
|
|
3965
|
+
},
|
|
3966
|
+
retry(reason, eventStep = _nullishCoalesce(step, () => ( void 0))) {
|
|
3967
|
+
if (!eventStep) return;
|
|
3968
|
+
send({ type: "claim_modal_retry", step: eventStep, reason });
|
|
3969
|
+
rearmStep(eventStep);
|
|
3970
|
+
},
|
|
3971
|
+
handoff({ depositId, transactionHash, refundTransactionHash }, eventStep) {
|
|
3972
|
+
const handoffStep = _nullishCoalesce(_nullishCoalesce(eventStep, () => ( step)), () => ( "submit"));
|
|
3973
|
+
if (step !== handoffStep) controller.openStep(handoffStep);
|
|
3974
|
+
afterHandoff = true;
|
|
3975
|
+
emitOnce(`handoff:${refundTransactionHash}`, {
|
|
3976
|
+
type: "claim_modal_handoff",
|
|
3977
|
+
step: handoffStep,
|
|
3978
|
+
deposit_id: depositId,
|
|
3979
|
+
transaction_hash: transactionHash,
|
|
3980
|
+
refund_transaction_hash: refundTransactionHash
|
|
3981
|
+
});
|
|
3982
|
+
},
|
|
3983
|
+
// Keyed by step so a retry re-arms it: a second failed submit is a second
|
|
3984
|
+
// terminal outcome, not a duplicate of the first.
|
|
3985
|
+
outcome(outcome) {
|
|
3986
|
+
if (!step) return;
|
|
3987
|
+
emitOnce(`outcome:${step}:${outcome}`, {
|
|
3988
|
+
type: "claim_modal_ui_outcome",
|
|
3989
|
+
step,
|
|
3990
|
+
outcome
|
|
3991
|
+
});
|
|
3992
|
+
},
|
|
3993
|
+
abandon(reason) {
|
|
3994
|
+
if (!step || afterHandoff) return;
|
|
3995
|
+
emitOnce(`abandon:${step}:${reason}`, {
|
|
3996
|
+
type: "claim_modal_abandoned",
|
|
3997
|
+
step,
|
|
3998
|
+
reason
|
|
3999
|
+
});
|
|
4000
|
+
},
|
|
4001
|
+
close(source) {
|
|
4002
|
+
if (closed) return;
|
|
4003
|
+
closed = true;
|
|
4004
|
+
send({
|
|
4005
|
+
type: "claim_modal_close",
|
|
4006
|
+
source,
|
|
4007
|
+
step,
|
|
4008
|
+
after_handoff: afterHandoff
|
|
4009
|
+
});
|
|
4010
|
+
},
|
|
4011
|
+
/** "Claim another deposit" on the success screen: a fresh attempt in the
|
|
4012
|
+
* same session, so the envelope and its session id stay. */
|
|
4013
|
+
resetAttempt() {
|
|
4014
|
+
step = null;
|
|
4015
|
+
afterHandoff = false;
|
|
4016
|
+
dedupe.clear();
|
|
4017
|
+
},
|
|
4018
|
+
get step() {
|
|
4019
|
+
return step;
|
|
4020
|
+
},
|
|
4021
|
+
get afterHandoff() {
|
|
4022
|
+
return afterHandoff;
|
|
4023
|
+
}
|
|
4024
|
+
};
|
|
4025
|
+
return controller;
|
|
4026
|
+
}
|
|
4027
|
+
var ClaimAnalyticsControllerContext = _react.createContext.call(void 0, null);
|
|
4028
|
+
var noopController = createClaimAnalyticsController(() => {
|
|
4029
|
+
});
|
|
4030
|
+
function ClaimAnalyticsControllerProvider({
|
|
4031
|
+
children,
|
|
4032
|
+
controllerRef,
|
|
4033
|
+
correlation
|
|
4034
|
+
}) {
|
|
4035
|
+
const emit = useClaimAnalyticsEmitter();
|
|
4036
|
+
const controller = _react.useMemo.call(void 0,
|
|
4037
|
+
() => createClaimAnalyticsController(emit, correlation),
|
|
4038
|
+
[emit, correlation]
|
|
4039
|
+
);
|
|
4040
|
+
if (controllerRef) controllerRef.current = controller;
|
|
4041
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ClaimAnalyticsControllerContext.Provider, { value: controller, children });
|
|
4042
|
+
}
|
|
4043
|
+
function useClaimAnalyticsController() {
|
|
4044
|
+
return _nullishCoalesce(_react.useContext.call(void 0, ClaimAnalyticsControllerContext), () => ( noopController));
|
|
4045
|
+
}
|
|
4046
|
+
|
|
4047
|
+
// src/components/ui/TokenIcon.tsx
|
|
4048
|
+
|
|
4049
|
+
function TokenIcon({ symbol, className, fallback }) {
|
|
4050
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4051
|
+
CdnIcon,
|
|
4052
|
+
{
|
|
4053
|
+
src: _chunkOY5N3E6Lcjs.tokenIconUrl.call(void 0, symbol),
|
|
4054
|
+
className: `rs-token-icon ${_nullishCoalesce(className, () => ( ""))}`.trimEnd(),
|
|
4055
|
+
fallback
|
|
4056
|
+
}
|
|
4057
|
+
);
|
|
4058
|
+
}
|
|
4059
|
+
TokenIcon.displayName = "TokenIcon";
|
|
4060
|
+
|
|
4061
|
+
// src/components/recovery/RecoveryOutcomeScreen.tsx
|
|
4062
|
+
|
|
4063
|
+
function RecoveryOutcomeScreen({
|
|
4064
|
+
result,
|
|
4065
|
+
error,
|
|
4066
|
+
children
|
|
4067
|
+
}) {
|
|
4068
|
+
const success = !!result;
|
|
4069
|
+
const explorerTxUrl = useExplorerTxUrl();
|
|
4070
|
+
const txUrl = result ? explorerTxUrl(result.chainId, result.txHash) : null;
|
|
4071
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-screen", children: [
|
|
4072
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-screen-body rs-screen-body--gap-32", children: [
|
|
4073
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4074
|
+
BodyHeader,
|
|
4075
|
+
{
|
|
4076
|
+
icon: success ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, CheckIcon, {}) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, AlertTriangleIcon, {}),
|
|
4077
|
+
variant: success ? "success" : "error",
|
|
4078
|
+
title: success ? "Refund submitted" : "Refund failed",
|
|
4079
|
+
subtitle: success ? "Your funds are being returned on the source chain." : void 0
|
|
4080
|
+
}
|
|
4081
|
+
),
|
|
4082
|
+
result ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-review-details", children: [
|
|
4083
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-review-detail-row", children: [
|
|
4084
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: "Amount" }),
|
|
4085
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "rs-review-detail-value", children: [
|
|
4086
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { children: [
|
|
4087
|
+
result.amountDisplay,
|
|
4088
|
+
" ",
|
|
4089
|
+
result.symbol
|
|
4090
|
+
] }),
|
|
4091
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-review-detail-icon", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, TokenIcon, { symbol: result.symbol }) })
|
|
4092
|
+
] })
|
|
4093
|
+
] }),
|
|
4094
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-review-detail-row", children: [
|
|
4095
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: "Sent to" }),
|
|
4096
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-review-detail-value", children: shortenAddress(result.destination) })
|
|
4097
|
+
] }),
|
|
4098
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-review-detail-row", children: [
|
|
4099
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: "Refund transaction" }),
|
|
4100
|
+
txUrl ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
4101
|
+
"a",
|
|
4102
|
+
{
|
|
4103
|
+
className: "rs-review-detail-value rs-link",
|
|
4104
|
+
href: txUrl,
|
|
4105
|
+
target: "_blank",
|
|
4106
|
+
rel: "noreferrer",
|
|
4107
|
+
children: [
|
|
4108
|
+
shortenHash(result.txHash),
|
|
4109
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, ExternalLinkIcon, {})
|
|
4110
|
+
]
|
|
4111
|
+
}
|
|
4112
|
+
) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-review-detail-value", children: shortenHash(result.txHash) })
|
|
4113
|
+
] })
|
|
4114
|
+
] }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Callout, { variant: "error", children: error }),
|
|
4115
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-screen-button-row", children })
|
|
4116
|
+
] }),
|
|
4117
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, PoweredBy, {})
|
|
4118
|
+
] });
|
|
4119
|
+
}
|
|
4120
|
+
RecoveryOutcomeScreen.displayName = "RecoveryOutcomeScreen";
|
|
4121
|
+
|
|
4122
|
+
// src/components/recovery/RecoveryReviewScreen.tsx
|
|
4123
|
+
|
|
4124
|
+
|
|
4125
|
+
|
|
4126
|
+
function RecoveryReviewScreen({
|
|
4127
|
+
chainId,
|
|
4128
|
+
token,
|
|
4129
|
+
amountRaw,
|
|
4130
|
+
txHash,
|
|
4131
|
+
defaultDestination,
|
|
4132
|
+
destinationHint,
|
|
4133
|
+
submitting,
|
|
4134
|
+
onSubmit,
|
|
4135
|
+
onDestinationInvalid
|
|
4136
|
+
}) {
|
|
4137
|
+
const { symbol, amount, chainName, chainIcon } = describeRecoveryDeposit({
|
|
4138
|
+
chainId,
|
|
4139
|
+
token,
|
|
4140
|
+
amountRaw
|
|
4141
|
+
});
|
|
4142
|
+
const explorerTxUrl = useExplorerTxUrl();
|
|
4143
|
+
const [destination, setDestination] = _react.useState.call(void 0,
|
|
4144
|
+
_nullishCoalesce(defaultDestination, () => ( ""))
|
|
4145
|
+
);
|
|
4146
|
+
const destinationValid = _viem.isAddress.call(void 0, destination);
|
|
4147
|
+
const onDestinationInvalidRef = useLatestRef(onDestinationInvalid);
|
|
4148
|
+
_react.useEffect.call(void 0, () => {
|
|
4149
|
+
if (destination.length > 0 && !destinationValid) {
|
|
4150
|
+
_optionalChain([onDestinationInvalidRef, 'access', _149 => _149.current, 'optionalCall', _150 => _150()]);
|
|
4151
|
+
}
|
|
4152
|
+
}, [destination, destinationValid, onDestinationInvalidRef]);
|
|
4153
|
+
const txUrl = txHash ? explorerTxUrl(chainId, txHash) : null;
|
|
4154
|
+
const txShort = txHash ? shortenHash(txHash) : "\u2014";
|
|
4155
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-screen", children: [
|
|
4156
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-screen-body rs-screen-body--gap-32", children: [
|
|
4157
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4158
|
+
BodyHeader,
|
|
4159
|
+
{
|
|
4160
|
+
icon: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, HandCoinsIcon, {}),
|
|
4161
|
+
title: "Review refund",
|
|
4162
|
+
subtitle: "This returns the funds on the source chain. It does not retry the original deposit."
|
|
4163
|
+
}
|
|
4164
|
+
),
|
|
4165
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-review-details", children: [
|
|
4166
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-review-detail-row", children: [
|
|
4167
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: "Amount" }),
|
|
4168
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "rs-review-detail-value", children: [
|
|
4169
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { children: [
|
|
4170
|
+
amount,
|
|
4171
|
+
" ",
|
|
4172
|
+
symbol
|
|
4173
|
+
] }),
|
|
4174
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-review-detail-icon", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, TokenIcon, { symbol }) })
|
|
4175
|
+
] })
|
|
4176
|
+
] }),
|
|
4177
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-review-detail-row", children: [
|
|
4178
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: "Source chain" }),
|
|
4179
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "rs-review-detail-value", children: [
|
|
4180
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: chainName }),
|
|
4181
|
+
chainIcon && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-review-detail-icon", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, CdnIcon, { src: chainIcon }) })
|
|
4182
|
+
] })
|
|
4183
|
+
] }),
|
|
4184
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-review-detail-row", children: [
|
|
4185
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: "Deposit transaction" }),
|
|
4186
|
+
txUrl ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
4187
|
+
"a",
|
|
4188
|
+
{
|
|
4189
|
+
className: "rs-review-detail-value rs-link",
|
|
4190
|
+
href: txUrl,
|
|
4191
|
+
target: "_blank",
|
|
4192
|
+
rel: "noreferrer",
|
|
4193
|
+
children: [
|
|
4194
|
+
txShort,
|
|
4195
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, ExternalLinkIcon, {})
|
|
4196
|
+
]
|
|
4197
|
+
}
|
|
4198
|
+
) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-review-detail-value", children: txShort })
|
|
4199
|
+
] })
|
|
4200
|
+
] }),
|
|
4201
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4202
|
+
Input,
|
|
4203
|
+
{
|
|
4204
|
+
label: "Send to",
|
|
4205
|
+
placeholder: "0x\u2026",
|
|
4206
|
+
value: destination,
|
|
4207
|
+
onChange: (e) => setDestination(e.target.value),
|
|
4208
|
+
hint: destinationHint,
|
|
4209
|
+
error: destination.length > 0 && !destinationValid ? "Enter a valid address" : void 0
|
|
4210
|
+
}
|
|
4211
|
+
),
|
|
4212
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4213
|
+
Button,
|
|
4214
|
+
{
|
|
4215
|
+
onClick: () => destinationValid && onSubmit(destination),
|
|
4216
|
+
loading: submitting,
|
|
4217
|
+
loadingText: "Refunding\u2026",
|
|
4218
|
+
disabled: !destinationValid,
|
|
4219
|
+
fullWidth: true,
|
|
4220
|
+
children: "Claim refund"
|
|
4221
|
+
}
|
|
4222
|
+
)
|
|
4223
|
+
] }),
|
|
4224
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, PoweredBy, {})
|
|
4225
|
+
] });
|
|
4226
|
+
}
|
|
4227
|
+
RecoveryReviewScreen.displayName = "RecoveryReviewScreen";
|
|
4228
|
+
|
|
3397
4229
|
// src/core/theme.ts
|
|
3398
4230
|
var RADIUS_SCALE = {
|
|
3399
4231
|
none: { sm: "0", md: "0", lg: "0" },
|
|
@@ -3498,11 +4330,11 @@ var NOTHING_TO_STOP = () => {
|
|
|
3498
4330
|
};
|
|
3499
4331
|
function resolveThemeMode(mode) {
|
|
3500
4332
|
if (mode !== "system") return mode;
|
|
3501
|
-
return _optionalChain([globalThis, 'access',
|
|
4333
|
+
return _optionalChain([globalThis, 'access', _151 => _151.matchMedia, 'optionalCall', _152 => _152(DARK_SCHEME_QUERY), 'access', _153 => _153.matches]) ? "dark" : "light";
|
|
3502
4334
|
}
|
|
3503
4335
|
function followSystemAppearance(mode, onChange) {
|
|
3504
4336
|
if (mode !== "system") return NOTHING_TO_STOP;
|
|
3505
|
-
const query = _optionalChain([globalThis, 'access',
|
|
4337
|
+
const query = _optionalChain([globalThis, 'access', _154 => _154.matchMedia, 'optionalCall', _155 => _155(DARK_SCHEME_QUERY)]);
|
|
3506
4338
|
if (!query) return NOTHING_TO_STOP;
|
|
3507
4339
|
query.addEventListener("change", onChange);
|
|
3508
4340
|
return () => query.removeEventListener("change", onChange);
|
|
@@ -3510,22 +4342,22 @@ function followSystemAppearance(mode, onChange) {
|
|
|
3510
4342
|
function applyTheme(element, theme) {
|
|
3511
4343
|
if (!element) return NOTHING_TO_STOP;
|
|
3512
4344
|
const parent = element.parentElement;
|
|
3513
|
-
const targets = _optionalChain([parent, 'optionalAccess',
|
|
4345
|
+
const targets = _optionalChain([parent, 'optionalAccess', _156 => _156.classList, 'access', _157 => _157.contains, 'call', _158 => _158("rs-modal-content")]) ? [element, parent] : [element];
|
|
3514
4346
|
const paintMode = () => {
|
|
3515
|
-
const resolved = resolveThemeMode(_optionalChain([theme, 'optionalAccess',
|
|
4347
|
+
const resolved = resolveThemeMode(_optionalChain([theme, 'optionalAccess', _159 => _159.mode]));
|
|
3516
4348
|
for (const t of targets) {
|
|
3517
4349
|
if (resolved) t.setAttribute("data-theme", resolved);
|
|
3518
4350
|
else t.removeAttribute("data-theme");
|
|
3519
4351
|
}
|
|
3520
4352
|
};
|
|
3521
4353
|
paintMode();
|
|
3522
|
-
if (_optionalChain([theme, 'optionalAccess',
|
|
4354
|
+
if (_optionalChain([theme, 'optionalAccess', _160 => _160.fontColor])) {
|
|
3523
4355
|
setVar(targets, "--rs-foreground", theme.fontColor);
|
|
3524
4356
|
}
|
|
3525
|
-
if (_optionalChain([theme, 'optionalAccess',
|
|
4357
|
+
if (_optionalChain([theme, 'optionalAccess', _161 => _161.iconColor])) {
|
|
3526
4358
|
setVar(targets, "--rs-icon", theme.iconColor);
|
|
3527
4359
|
}
|
|
3528
|
-
if (_optionalChain([theme, 'optionalAccess',
|
|
4360
|
+
if (_optionalChain([theme, 'optionalAccess', _162 => _162.ctaColor])) {
|
|
3529
4361
|
const derived = deriveCustomPrimary(theme.ctaColor);
|
|
3530
4362
|
if (derived) {
|
|
3531
4363
|
setVar(targets, "--rs-primary", derived.base);
|
|
@@ -3550,25 +4382,25 @@ function applyTheme(element, theme) {
|
|
|
3550
4382
|
}
|
|
3551
4383
|
} else {
|
|
3552
4384
|
for (const v of CUSTOM_PRIMARY_VARS) clearVar(targets, v);
|
|
3553
|
-
if (_optionalChain([theme, 'optionalAccess',
|
|
4385
|
+
if (_optionalChain([theme, 'optionalAccess', _163 => _163.ctaHoverColor])) {
|
|
3554
4386
|
setVar(targets, "--rs-primary-hover", theme.ctaHoverColor);
|
|
3555
4387
|
}
|
|
3556
4388
|
}
|
|
3557
|
-
if (_optionalChain([theme, 'optionalAccess',
|
|
4389
|
+
if (_optionalChain([theme, 'optionalAccess', _164 => _164.borderColor])) {
|
|
3558
4390
|
setVar(targets, "--rs-border", theme.borderColor);
|
|
3559
4391
|
setVar(targets, "--rs-border-surface", theme.borderColor);
|
|
3560
4392
|
}
|
|
3561
|
-
if (_optionalChain([theme, 'optionalAccess',
|
|
4393
|
+
if (_optionalChain([theme, 'optionalAccess', _165 => _165.backgroundColor])) {
|
|
3562
4394
|
setVar(targets, "--rs-background", theme.backgroundColor);
|
|
3563
4395
|
}
|
|
3564
|
-
if (_optionalChain([theme, 'optionalAccess',
|
|
4396
|
+
if (_optionalChain([theme, 'optionalAccess', _166 => _166.radius])) {
|
|
3565
4397
|
const scale = RADIUS_SCALE[theme.radius];
|
|
3566
4398
|
setVar(targets, "--rs-radius-sm", scale.sm);
|
|
3567
4399
|
setVar(targets, "--rs-radius-md", scale.md);
|
|
3568
4400
|
setVar(targets, "--rs-radius-lg", scale.lg);
|
|
3569
4401
|
setVar(targets, "--rs-radius", scale.md);
|
|
3570
4402
|
}
|
|
3571
|
-
return followSystemAppearance(_optionalChain([theme, 'optionalAccess',
|
|
4403
|
+
return followSystemAppearance(_optionalChain([theme, 'optionalAccess', _167 => _167.mode]), paintMode);
|
|
3572
4404
|
}
|
|
3573
4405
|
|
|
3574
4406
|
// src/core/backend-url.ts
|
|
@@ -3666,4 +4498,22 @@ function checkBackendUrl(component, backendUrl) {
|
|
|
3666
4498
|
|
|
3667
4499
|
|
|
3668
4500
|
|
|
3669
|
-
|
|
4501
|
+
|
|
4502
|
+
|
|
4503
|
+
|
|
4504
|
+
|
|
4505
|
+
|
|
4506
|
+
|
|
4507
|
+
|
|
4508
|
+
|
|
4509
|
+
|
|
4510
|
+
|
|
4511
|
+
|
|
4512
|
+
|
|
4513
|
+
|
|
4514
|
+
|
|
4515
|
+
|
|
4516
|
+
|
|
4517
|
+
|
|
4518
|
+
|
|
4519
|
+
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.CircleArrowOutUpLeftIcon = CircleArrowOutUpLeftIcon; exports.CardIcon = CardIcon; exports.BankIcon = BankIcon; exports.UnplugIcon = UnplugIcon; exports.MigrateAssetsIcon = MigrateAssetsIcon; exports.AppleIcon = AppleIcon; exports.BodyHeader = BodyHeader; exports.CdnIcon = CdnIcon; exports.ListRow = ListRow; 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.PermitDepositSubmitError = PermitDepositSubmitError; exports.RegistrationError = RegistrationError; 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.useReadClient = useReadClient; 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.randomUuid = randomUuid; exports.AnalyticsSession = AnalyticsSession; exports.useDepositAnalyticsEmitter = useDepositAnalyticsEmitter; exports.useWithdrawAnalyticsEmitter = useWithdrawAnalyticsEmitter; exports.recoverySigningChainId = recoverySigningChainId; exports.sourceDepositTxHash = sourceDepositTxHash; exports.toRecoverableDeposit = toRecoverableDeposit; exports.recoveryFailureCause = recoveryFailureCause; exports.RECOVERY_LOOKUP_MISS_COPY = RECOVERY_LOOKUP_MISS_COPY; exports.classifyRecoveryLookup = classifyRecoveryLookup; exports.RecoveryLookupScreen = RecoveryLookupScreen; exports.describeRecoveryDeposit = describeRecoveryDeposit; exports.formatRecoveryAmount = formatRecoveryAmount; exports.RecoveryError = RecoveryError; exports.submitSignedRecovery = submitSignedRecovery; exports.claimFailureReasonForError = claimFailureReasonForError; exports.ClaimAnalyticsControllerProvider = ClaimAnalyticsControllerProvider; exports.useClaimAnalyticsController = useClaimAnalyticsController; exports.RecoveryOutcomeScreen = RecoveryOutcomeScreen; exports.RecoveryReviewScreen = RecoveryReviewScreen; exports.resolveThemeMode = resolveThemeMode; exports.followSystemAppearance = followSystemAppearance; exports.applyTheme = applyTheme; exports.checkBackendUrl = checkBackendUrl;
|