@rhinestone/deposit-modal 0.12.1 → 0.13.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 +30 -16
- package/dist/ClaimModal-CREZO27I.mjs +11 -0
- package/dist/ClaimModal-JRIA32U2.cjs +11 -0
- package/dist/{DepositModalReown-SXAXHYTN.mjs → DepositModalReown-3H75G3XQ.mjs} +44 -22
- package/dist/{DepositModalReown-CH6FUTCR.cjs → DepositModalReown-YNNHLAV2.cjs} +57 -35
- package/dist/{QRCode-WUC652SH.mjs → QRCode-5RGIZZHL.mjs} +1 -1
- package/dist/{QRCode-5DXFNKI2.cjs → QRCode-JKXG4RHN.cjs} +2 -2
- package/dist/WithdrawModal-NVRX44IZ.mjs +10 -0
- package/dist/WithdrawModal-YYSBPCJJ.cjs +10 -0
- package/dist/{chunk-2BOEUV6B.cjs → chunk-2G2EIN4A.cjs} +1510 -896
- package/dist/{chunk-O7BCVQ6L.cjs → chunk-4KCSH4T3.cjs} +157 -199
- package/dist/{chunk-UGK4JRK6.cjs → chunk-5NUIKYSF.cjs} +83 -209
- package/dist/{chunk-ZLCY33FQ.cjs → chunk-7N77GIP4.cjs} +102 -88
- package/dist/{chunk-PVWZN66D.mjs → chunk-COCBCQQC.mjs} +121 -86
- package/dist/chunk-CVGNCUVU.cjs +154 -0
- package/dist/{chunk-KPWB2JAX.mjs → chunk-DSIZNRWA.mjs} +1540 -926
- package/dist/{chunk-75DVGSAX.cjs → chunk-DW2EQA2U.cjs} +6 -3
- package/dist/{chunk-2K44IE3V.mjs → chunk-EOMT5LKX.mjs} +374 -151
- package/dist/chunk-FZ5FZFIG.mjs +31 -0
- package/dist/chunk-GACIGCSN.cjs +31 -0
- package/dist/{chunk-TYBMAUGH.cjs → chunk-HOGZKHHY.cjs} +3 -3
- package/dist/{chunk-TQWEGW3A.mjs → chunk-LTMMETAB.mjs} +29 -15
- package/dist/{chunk-O4AXBFHU.mjs → chunk-OLCD75JK.mjs} +20 -146
- package/dist/{chunk-FKHPVLJY.cjs → chunk-RAADLTSW.cjs} +240 -205
- package/dist/{chunk-4ZXQPFNU.mjs → chunk-RN5VKWI6.mjs} +4 -1
- package/dist/{chunk-3STTWRAN.mjs → chunk-VUATPOWJ.mjs} +147 -189
- package/dist/{chunk-NHGFU3WC.mjs → chunk-XYJFEN5D.mjs} +1 -1
- package/dist/chunk-YREVFB64.mjs +154 -0
- package/dist/{chunk-65MLWUQD.cjs → chunk-ZMT4ATHR.cjs} +437 -214
- package/dist/claim.cjs +7 -6
- package/dist/claim.d.cts +11 -3
- package/dist/claim.d.ts +11 -3
- package/dist/claim.mjs +6 -5
- package/dist/{constants-FuzG3h4m.d.cts → constants-DBrWhJWE.d.cts} +12 -7
- package/dist/{constants-FuzG3h4m.d.ts → constants-DBrWhJWE.d.ts} +12 -7
- package/dist/constants.cjs +3 -9
- package/dist/constants.d.cts +2 -3
- package/dist/constants.d.ts +2 -3
- package/dist/constants.mjs +4 -10
- package/dist/deposit.cjs +8 -8
- package/dist/deposit.d.cts +2 -2
- package/dist/deposit.d.ts +2 -2
- package/dist/deposit.mjs +7 -7
- package/dist/embed.cjs +1268 -0
- package/dist/embed.d.cts +177 -0
- package/dist/embed.d.ts +177 -0
- package/dist/embed.mjs +1268 -0
- package/dist/index.cjs +11 -16
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.mjs +14 -19
- package/dist/modal-ui-state-OD1RmKkK.d.cts +30 -0
- package/dist/modal-ui-state-OD1RmKkK.d.ts +30 -0
- package/dist/polymarket.cjs +17 -7
- package/dist/polymarket.mjs +13 -3
- package/dist/styles.css +133 -98
- package/dist/{types-oFblf65g.d.ts → types-B89I8_8H.d.ts} +27 -1
- package/dist/{types-BO4iP6fG.d.cts → types-nnDR4tqA.d.cts} +27 -1
- package/dist/withdraw.cjs +6 -6
- package/dist/withdraw.d.cts +11 -3
- package/dist/withdraw.d.ts +11 -3
- package/dist/withdraw.mjs +5 -5
- package/package.json +33 -1
- package/dist/chunk-DMYA7U53.cjs +0 -11
- package/dist/chunk-O2TQLD4I.mjs +0 -11
|
@@ -1,6 +1,6 @@
|
|
|
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
|
-
var
|
|
3
|
+
var _chunkGACIGCSNcjs = require('./chunk-GACIGCSN.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
@@ -25,9 +25,7 @@ var _chunkDMYA7U53cjs = require('./chunk-DMYA7U53.cjs');
|
|
|
25
25
|
|
|
26
26
|
|
|
27
27
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
var _chunkO7BCVQ6Lcjs = require('./chunk-O7BCVQ6L.cjs');
|
|
28
|
+
var _chunk4KCSH4T3cjs = require('./chunk-4KCSH4T3.cjs');
|
|
31
29
|
|
|
32
30
|
// src/components/ui/Modal.tsx
|
|
33
31
|
|
|
@@ -173,9 +171,6 @@ Modal.displayName = "Modal";
|
|
|
173
171
|
|
|
174
172
|
|
|
175
173
|
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
174
|
|
|
180
175
|
|
|
181
176
|
|
|
@@ -218,9 +213,6 @@ var InfoIcon = _lucidereact.Info;
|
|
|
218
213
|
var CopyIcon = _lucidereact.Copy;
|
|
219
214
|
var ArrowUpRightIcon = _lucidereact.ArrowUpRight;
|
|
220
215
|
var AlertTriangleIcon = _lucidereact.AlertTriangle;
|
|
221
|
-
var PercentIcon = _lucidereact.Percent;
|
|
222
|
-
var ClockIcon = _lucidereact.Clock;
|
|
223
|
-
var PlusCircleIcon = _lucidereact.CirclePlus;
|
|
224
216
|
var CircleArrowOutUpLeftIcon = _lucidereact.CircleArrowOutUpLeft;
|
|
225
217
|
var CardIcon = _lucidereact.CreditCard;
|
|
226
218
|
var BankIcon = _lucidereact.Landmark;
|
|
@@ -328,7 +320,7 @@ function preconnectIconCdn() {
|
|
|
328
320
|
const link = document.createElement("link");
|
|
329
321
|
link.id = "rs-icon-cdn-preconnect";
|
|
330
322
|
link.rel = "preconnect";
|
|
331
|
-
link.href =
|
|
323
|
+
link.href = _chunk4KCSH4T3cjs.ICON_CDN;
|
|
332
324
|
link.crossOrigin = "anonymous";
|
|
333
325
|
document.head.appendChild(link);
|
|
334
326
|
}
|
|
@@ -467,7 +459,7 @@ function normalizeForLog(value, depth = 0) {
|
|
|
467
459
|
const output = {};
|
|
468
460
|
for (const [key, raw] of Object.entries(input)) {
|
|
469
461
|
const keyLower = key.toLowerCase();
|
|
470
|
-
if (keyLower.includes("signature") || keyLower.includes("privatekey") || keyLower.includes("sessiondetails")) {
|
|
462
|
+
if (keyLower.includes("signature") || keyLower.includes("privatekey") || keyLower.includes("sessiondetails") || keyLower.includes("rpcurl") || keyLower.includes("apikey") || keyLower.includes("authorization")) {
|
|
471
463
|
output[key] = "[Redacted]";
|
|
472
464
|
continue;
|
|
473
465
|
}
|
|
@@ -546,7 +538,7 @@ function parseChain(caip2, value) {
|
|
|
546
538
|
// `parseEvmChainId` returns null for `solana:`/`tron:`/`hypercore:` keys,
|
|
547
539
|
// which is the intended answer — those chains have no numeric id, and the
|
|
548
540
|
// modal addresses them by their CAIP-2 string or a sentinel.
|
|
549
|
-
chainId:
|
|
541
|
+
chainId: _chunk4KCSH4T3cjs.parseEvmChainId.call(void 0, caip2),
|
|
550
542
|
name,
|
|
551
543
|
testnet,
|
|
552
544
|
deposit,
|
|
@@ -579,17 +571,14 @@ function parseChainCatalog(body) {
|
|
|
579
571
|
return { all, byCaip2, byChainId };
|
|
580
572
|
}
|
|
581
573
|
function aliasHyperCoreOrigin(byCaip2, all) {
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
byCaip2.set(
|
|
585
|
-
if (!byCaip2.has(_chunkO7BCVQ6Lcjs.HYPERCORE_SPOT_CAIP2)) {
|
|
586
|
-
byCaip2.set(_chunkO7BCVQ6Lcjs.HYPERCORE_SPOT_CAIP2, origin);
|
|
587
|
-
}
|
|
574
|
+
if (byCaip2.has(_chunk4KCSH4T3cjs.HYPERCORE_SPOT_CAIP2)) return;
|
|
575
|
+
const origin = _nullishCoalesce(all.find((c) => _chunk4KCSH4T3cjs.isHyperCoreCaip2.call(void 0, c.caip2) && c.deposit), () => ( all.find((c) => _chunk4KCSH4T3cjs.isHyperCoreCaip2.call(void 0, c.caip2))));
|
|
576
|
+
if (origin) byCaip2.set(_chunk4KCSH4T3cjs.HYPERCORE_SPOT_CAIP2, origin);
|
|
588
577
|
}
|
|
589
578
|
function catalogKeyForChain(chainId) {
|
|
590
|
-
if (chainId === "solana") return
|
|
591
|
-
if (chainId === "hypercore" || chainId ===
|
|
592
|
-
return
|
|
579
|
+
if (chainId === "solana") return _chunk4KCSH4T3cjs.SOLANA_MAINNET_CAIP2;
|
|
580
|
+
if (chainId === "hypercore" || chainId === _chunk4KCSH4T3cjs.HYPERCORE_CHAIN_ID) {
|
|
581
|
+
return _chunk4KCSH4T3cjs.HYPERCORE_SPOT_CAIP2;
|
|
593
582
|
}
|
|
594
583
|
return chainId;
|
|
595
584
|
}
|
|
@@ -817,7 +806,8 @@ function parseQuoteOutput(raw) {
|
|
|
817
806
|
};
|
|
818
807
|
}
|
|
819
808
|
function parseFeeLine(raw) {
|
|
820
|
-
if (typeof raw !== "object" || raw === null || Array.isArray(raw))
|
|
809
|
+
if (typeof raw !== "object" || raw === null || Array.isArray(raw))
|
|
810
|
+
return null;
|
|
821
811
|
const line = raw;
|
|
822
812
|
const usd = line.usd;
|
|
823
813
|
if (typeof usd !== "number" || !Number.isFinite(usd) || usd < 0) return null;
|
|
@@ -854,6 +844,13 @@ function resolveAppFeeBps(appFees, sourceChainCaip2, sourceToken) {
|
|
|
854
844
|
const bps = _nullishCoalesce(_nullishCoalesce(override, () => ( _optionalChain([appFees, 'optionalAccess', _9 => _9.feeBps]))), () => ( 0));
|
|
855
845
|
return bps > 0 ? bps : 0;
|
|
856
846
|
}
|
|
847
|
+
var PermitDepositSubmitError = class extends Error {
|
|
848
|
+
constructor(message, safeToTransfer) {
|
|
849
|
+
super(message);
|
|
850
|
+
this.safeToTransfer = safeToTransfer;
|
|
851
|
+
this.name = "PermitDepositSubmitError";
|
|
852
|
+
}
|
|
853
|
+
};
|
|
857
854
|
function createDepositService(baseUrl, options) {
|
|
858
855
|
const normalizedBaseUrl = baseUrl.replace(/\/$/, "");
|
|
859
856
|
const debug = _optionalChain([options, 'optionalAccess', _10 => _10.debug]) === true;
|
|
@@ -894,7 +891,7 @@ function createDepositService(baseUrl, options) {
|
|
|
894
891
|
try {
|
|
895
892
|
const response = await fetch(apiUrl("/qr/tokens"), {
|
|
896
893
|
method: "GET",
|
|
897
|
-
headers:
|
|
894
|
+
headers: _chunkGACIGCSNcjs.serviceHeaders.call(void 0, )
|
|
898
895
|
});
|
|
899
896
|
if (!response.ok) {
|
|
900
897
|
debugLog(debug, scope, "getTopTokens:unavailable", {
|
|
@@ -921,7 +918,7 @@ function createDepositService(baseUrl, options) {
|
|
|
921
918
|
try {
|
|
922
919
|
const response = await fetch(apiUrl("/chains"), {
|
|
923
920
|
method: "GET",
|
|
924
|
-
headers:
|
|
921
|
+
headers: _chunkGACIGCSNcjs.serviceHeaders.call(void 0, )
|
|
925
922
|
});
|
|
926
923
|
if (!response.ok) {
|
|
927
924
|
debugLog(debug, scope, "getChains:unavailable", {
|
|
@@ -975,18 +972,15 @@ function createDepositService(baseUrl, options) {
|
|
|
975
972
|
});
|
|
976
973
|
const response = await fetch(url, {
|
|
977
974
|
method: "POST",
|
|
978
|
-
headers:
|
|
975
|
+
headers: _chunkGACIGCSNcjs.serviceHeaders.call(void 0, ),
|
|
979
976
|
body: JSON.stringify({ account: params })
|
|
980
977
|
});
|
|
981
978
|
if (!response.ok) {
|
|
982
979
|
const error = await response.json().catch(() => ({ error: "Unknown error" }));
|
|
983
|
-
debugError(
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
error,
|
|
988
|
-
{ status: response.status, salt: params.salt }
|
|
989
|
-
);
|
|
980
|
+
debugError(debug, scope, "registerManagedAccount:failed", error, {
|
|
981
|
+
status: response.status,
|
|
982
|
+
salt: params.salt
|
|
983
|
+
});
|
|
990
984
|
const detail = Array.isArray(error.details) ? error.details.map((d) => _optionalChain([d, 'optionalAccess', _15 => _15.message])).filter(Boolean).join("; ") : void 0;
|
|
991
985
|
const base = error.error || `Account registration failed: ${response.status}`;
|
|
992
986
|
throw new Error(detail ? `${base}: ${detail}` : base);
|
|
@@ -1003,100 +997,104 @@ function createDepositService(baseUrl, options) {
|
|
|
1003
997
|
};
|
|
1004
998
|
},
|
|
1005
999
|
async fetchPortfolio(address, options2) {
|
|
1006
|
-
return cachedPortfolio(
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
const error = await response.json().catch(() => ({ error: "Unknown error" }));
|
|
1015
|
-
debugError(
|
|
1016
|
-
debug,
|
|
1017
|
-
scope,
|
|
1018
|
-
"fetchPortfolio:failed",
|
|
1019
|
-
error,
|
|
1020
|
-
{ status: response.status, address }
|
|
1021
|
-
);
|
|
1022
|
-
throw new Error(
|
|
1023
|
-
error.error || `Portfolio fetch failed: ${response.status}`
|
|
1024
|
-
);
|
|
1025
|
-
}
|
|
1026
|
-
const data = await response.json();
|
|
1027
|
-
const direct = normalizeDirectPortfolio(data);
|
|
1028
|
-
if (direct.tokens.length > 0) {
|
|
1029
|
-
debugLog(debug, scope, "fetchPortfolio:success", {
|
|
1030
|
-
address,
|
|
1031
|
-
source: "direct",
|
|
1032
|
-
tokenCount: direct.tokens.length,
|
|
1033
|
-
totalUsd: direct.totalUsd
|
|
1000
|
+
return cachedPortfolio(
|
|
1001
|
+
`evm:${address.toLowerCase()}`,
|
|
1002
|
+
async () => {
|
|
1003
|
+
const url = apiUrl(`/portfolio/${address}?includeUnsupported=true`);
|
|
1004
|
+
debugLog(debug, scope, "fetchPortfolio:request", { url, address });
|
|
1005
|
+
const response = await fetch(url, {
|
|
1006
|
+
method: "GET",
|
|
1007
|
+
headers: _chunkGACIGCSNcjs.serviceHeaders.call(void 0, )
|
|
1034
1008
|
});
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1009
|
+
if (!response.ok) {
|
|
1010
|
+
const error = await response.json().catch(() => ({ error: "Unknown error" }));
|
|
1011
|
+
debugError(debug, scope, "fetchPortfolio:failed", error, {
|
|
1012
|
+
status: response.status,
|
|
1013
|
+
address
|
|
1014
|
+
});
|
|
1015
|
+
throw new Error(
|
|
1016
|
+
error.error || `Portfolio fetch failed: ${response.status}`
|
|
1017
|
+
);
|
|
1018
|
+
}
|
|
1019
|
+
const data = await response.json();
|
|
1020
|
+
const direct = normalizeDirectPortfolio(data);
|
|
1021
|
+
if (direct.tokens.length > 0) {
|
|
1022
|
+
debugLog(debug, scope, "fetchPortfolio:success", {
|
|
1023
|
+
address,
|
|
1024
|
+
source: "direct",
|
|
1025
|
+
tokenCount: direct.tokens.length,
|
|
1026
|
+
totalUsd: direct.totalUsd
|
|
1027
|
+
});
|
|
1028
|
+
return direct;
|
|
1029
|
+
}
|
|
1030
|
+
const portfolioData = extractOrchestratorPortfolio(data);
|
|
1031
|
+
if (portfolioData) {
|
|
1032
|
+
const normalized = normalizeOrchestratorPortfolio(portfolioData);
|
|
1033
|
+
debugLog(debug, scope, "fetchPortfolio:success", {
|
|
1034
|
+
address,
|
|
1035
|
+
source: "orchestrator",
|
|
1036
|
+
tokenCount: normalized.tokens.length,
|
|
1037
|
+
totalUsd: normalized.totalUsd
|
|
1038
|
+
});
|
|
1039
|
+
return normalized;
|
|
1040
|
+
}
|
|
1041
|
+
debugLog(debug, scope, "fetchPortfolio:empty", { address });
|
|
1042
|
+
return { tokens: [], totalUsd: 0 };
|
|
1043
|
+
},
|
|
1044
|
+
_optionalChain([options2, 'optionalAccess', _20 => _20.forceRefresh])
|
|
1045
|
+
);
|
|
1046
|
+
},
|
|
1047
|
+
async fetchSolanaPortfolio(address, options2) {
|
|
1048
|
+
return cachedPortfolio(
|
|
1049
|
+
`sol:${address}`,
|
|
1050
|
+
async () => {
|
|
1051
|
+
const url = apiUrl(`/portfolio/solana/${address}`);
|
|
1052
|
+
debugLog(debug, scope, "fetchSolanaPortfolio:request", {
|
|
1053
|
+
url,
|
|
1054
|
+
address
|
|
1055
|
+
});
|
|
1056
|
+
const response = await fetch(url, {
|
|
1057
|
+
method: "GET",
|
|
1058
|
+
headers: _chunkGACIGCSNcjs.serviceHeaders.call(void 0, )
|
|
1059
|
+
});
|
|
1060
|
+
if (!response.ok) {
|
|
1061
|
+
const error = await response.json().catch(() => ({ error: "Unknown error" }));
|
|
1062
|
+
debugError(debug, scope, "fetchSolanaPortfolio:failed", error, {
|
|
1063
|
+
status: response.status,
|
|
1064
|
+
address
|
|
1065
|
+
});
|
|
1066
|
+
throw new Error(
|
|
1067
|
+
error.error || `Solana portfolio fetch failed: ${response.status}`
|
|
1068
|
+
);
|
|
1069
|
+
}
|
|
1070
|
+
const data = await response.json();
|
|
1071
|
+
const normalized = normalizeDirectPortfolio(data);
|
|
1072
|
+
debugLog(debug, scope, "fetchSolanaPortfolio:success", {
|
|
1041
1073
|
address,
|
|
1042
|
-
source: "orchestrator",
|
|
1043
1074
|
tokenCount: normalized.tokens.length,
|
|
1044
1075
|
totalUsd: normalized.totalUsd
|
|
1045
1076
|
});
|
|
1046
1077
|
return normalized;
|
|
1047
|
-
}
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
}, _optionalChain([options2, 'optionalAccess', _20 => _20.forceRefresh]));
|
|
1051
|
-
},
|
|
1052
|
-
async fetchSolanaPortfolio(address, options2) {
|
|
1053
|
-
return cachedPortfolio(`sol:${address}`, async () => {
|
|
1054
|
-
const url = apiUrl(`/portfolio/solana/${address}`);
|
|
1055
|
-
debugLog(debug, scope, "fetchSolanaPortfolio:request", { url, address });
|
|
1056
|
-
const response = await fetch(url, {
|
|
1057
|
-
method: "GET",
|
|
1058
|
-
headers: _chunkDMYA7U53cjs.SERVICE_HEADERS
|
|
1059
|
-
});
|
|
1060
|
-
if (!response.ok) {
|
|
1061
|
-
const error = await response.json().catch(() => ({ error: "Unknown error" }));
|
|
1062
|
-
debugError(
|
|
1063
|
-
debug,
|
|
1064
|
-
scope,
|
|
1065
|
-
"fetchSolanaPortfolio:failed",
|
|
1066
|
-
error,
|
|
1067
|
-
{ status: response.status, address }
|
|
1068
|
-
);
|
|
1069
|
-
throw new Error(
|
|
1070
|
-
error.error || `Solana portfolio fetch failed: ${response.status}`
|
|
1071
|
-
);
|
|
1072
|
-
}
|
|
1073
|
-
const data = await response.json();
|
|
1074
|
-
const normalized = normalizeDirectPortfolio(data);
|
|
1075
|
-
debugLog(debug, scope, "fetchSolanaPortfolio:success", {
|
|
1076
|
-
address,
|
|
1077
|
-
tokenCount: normalized.tokens.length,
|
|
1078
|
-
totalUsd: normalized.totalUsd
|
|
1079
|
-
});
|
|
1080
|
-
return normalized;
|
|
1081
|
-
}, _optionalChain([options2, 'optionalAccess', _21 => _21.forceRefresh]));
|
|
1078
|
+
},
|
|
1079
|
+
_optionalChain([options2, 'optionalAccess', _21 => _21.forceRefresh])
|
|
1080
|
+
);
|
|
1082
1081
|
},
|
|
1083
1082
|
async checkAccount(address) {
|
|
1084
1083
|
const url = apiUrl(`/check/${address}`);
|
|
1085
1084
|
debugLog(debug, scope, "checkAccount:request", { url, address });
|
|
1086
1085
|
const response = await fetch(url, {
|
|
1087
1086
|
method: "GET",
|
|
1088
|
-
headers:
|
|
1087
|
+
headers: _chunkGACIGCSNcjs.serviceHeaders.call(void 0, )
|
|
1089
1088
|
});
|
|
1090
1089
|
if (!response.ok) {
|
|
1091
1090
|
const error = await response.json().catch(() => ({ error: "Unknown error" }));
|
|
1092
|
-
debugError(
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1091
|
+
debugError(debug, scope, "checkAccount:failed", error, {
|
|
1092
|
+
status: response.status,
|
|
1093
|
+
address
|
|
1094
|
+
});
|
|
1095
|
+
throw new Error(
|
|
1096
|
+
error.error || `Account check failed: ${response.status}`
|
|
1098
1097
|
);
|
|
1099
|
-
throw new Error(error.error || `Account check failed: ${response.status}`);
|
|
1100
1098
|
}
|
|
1101
1099
|
const data = await response.json();
|
|
1102
1100
|
const result = {
|
|
@@ -1116,11 +1114,13 @@ function createDepositService(baseUrl, options) {
|
|
|
1116
1114
|
const normalized = txHash.startsWith("0x") || txHash.startsWith("0X") ? txHash.toLowerCase() : txHash;
|
|
1117
1115
|
const txHashParam = encodeURIComponent(normalized);
|
|
1118
1116
|
const url = apiUrl(
|
|
1119
|
-
`/deposits?account=${encodeURIComponent(
|
|
1117
|
+
`/deposits?account=${encodeURIComponent(
|
|
1118
|
+
address
|
|
1119
|
+
)}&txHash=${txHashParam}&limit=1`
|
|
1120
1120
|
);
|
|
1121
1121
|
const response = await fetch(url, {
|
|
1122
1122
|
method: "GET",
|
|
1123
|
-
headers:
|
|
1123
|
+
headers: _chunkGACIGCSNcjs.serviceHeaders.call(void 0, ),
|
|
1124
1124
|
cache: "no-store"
|
|
1125
1125
|
});
|
|
1126
1126
|
if (!response.ok) {
|
|
@@ -1148,7 +1148,7 @@ function createDepositService(baseUrl, options) {
|
|
|
1148
1148
|
);
|
|
1149
1149
|
const response = await fetch(url, {
|
|
1150
1150
|
method: "GET",
|
|
1151
|
-
headers:
|
|
1151
|
+
headers: _chunkGACIGCSNcjs.serviceHeaders.call(void 0, ),
|
|
1152
1152
|
cache: "no-store"
|
|
1153
1153
|
});
|
|
1154
1154
|
if (!response.ok) {
|
|
@@ -1172,7 +1172,7 @@ function createDepositService(baseUrl, options) {
|
|
|
1172
1172
|
);
|
|
1173
1173
|
const response = await fetch(url, {
|
|
1174
1174
|
method: "GET",
|
|
1175
|
-
headers:
|
|
1175
|
+
headers: _chunkGACIGCSNcjs.serviceHeaders.call(void 0, ),
|
|
1176
1176
|
cache: "no-store"
|
|
1177
1177
|
});
|
|
1178
1178
|
if (!response.ok) {
|
|
@@ -1194,7 +1194,7 @@ function createDepositService(baseUrl, options) {
|
|
|
1194
1194
|
async getPositions(address) {
|
|
1195
1195
|
const url = apiUrl(`/positions/${address}`);
|
|
1196
1196
|
debugLog(debug, scope, "getPositions:request", { url, address });
|
|
1197
|
-
const response = await fetch(url, { headers:
|
|
1197
|
+
const response = await fetch(url, { headers: _chunkGACIGCSNcjs.serviceHeaders.call(void 0, ) });
|
|
1198
1198
|
if (!response.ok) {
|
|
1199
1199
|
const error = await response.json().catch(() => ({ error: "Unknown error" }));
|
|
1200
1200
|
debugError(debug, scope, "getPositions:failed", error, {
|
|
@@ -1228,7 +1228,7 @@ function createDepositService(baseUrl, options) {
|
|
|
1228
1228
|
});
|
|
1229
1229
|
const response = await fetch(url, {
|
|
1230
1230
|
method: "POST",
|
|
1231
|
-
headers:
|
|
1231
|
+
headers: _chunkGACIGCSNcjs.serviceHeaders.call(void 0, ),
|
|
1232
1232
|
body: JSON.stringify({ account, market, chainId, asset, amount })
|
|
1233
1233
|
});
|
|
1234
1234
|
if (!response.ok) {
|
|
@@ -1264,7 +1264,7 @@ function createDepositService(baseUrl, options) {
|
|
|
1264
1264
|
});
|
|
1265
1265
|
const response = await fetch(url, {
|
|
1266
1266
|
method: "POST",
|
|
1267
|
-
headers:
|
|
1267
|
+
headers: _chunkGACIGCSNcjs.serviceHeaders.call(void 0, ),
|
|
1268
1268
|
body: JSON.stringify({
|
|
1269
1269
|
depositWallet,
|
|
1270
1270
|
owner,
|
|
@@ -1306,18 +1306,15 @@ function createDepositService(baseUrl, options) {
|
|
|
1306
1306
|
});
|
|
1307
1307
|
const response = await fetch(url, {
|
|
1308
1308
|
method: "GET",
|
|
1309
|
-
headers:
|
|
1309
|
+
headers: _chunkGACIGCSNcjs.serviceHeaders.call(void 0, ),
|
|
1310
1310
|
cache: "no-store"
|
|
1311
1311
|
});
|
|
1312
1312
|
if (!response.ok) {
|
|
1313
1313
|
const error = await response.json().catch(() => ({ error: "Unknown error" }));
|
|
1314
|
-
debugError(
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
error,
|
|
1319
|
-
{ status: response.status, recipient: shortRef(params.recipient) }
|
|
1320
|
-
);
|
|
1314
|
+
debugError(debug, scope, "fetchDepositHistory:failed", error, {
|
|
1315
|
+
status: response.status,
|
|
1316
|
+
recipient: shortRef(params.recipient)
|
|
1317
|
+
});
|
|
1321
1318
|
throw new Error(
|
|
1322
1319
|
error.error || `Deposit history fetch failed: ${response.status}`
|
|
1323
1320
|
);
|
|
@@ -1333,8 +1330,8 @@ function createDepositService(baseUrl, options) {
|
|
|
1333
1330
|
return { deposits, nextCursor };
|
|
1334
1331
|
},
|
|
1335
1332
|
async checkLiquidity(params) {
|
|
1336
|
-
if (
|
|
1337
|
-
const token =
|
|
1333
|
+
if (_chunk4KCSH4T3cjs.isSolanaCaip2.call(void 0, params.destinationChainId) || params.destinationChainId === "solana") {
|
|
1334
|
+
const token = _chunk4KCSH4T3cjs.getSolanaTokenByMint.call(void 0, params.destinationToken);
|
|
1338
1335
|
return {
|
|
1339
1336
|
hasLiquidity: true,
|
|
1340
1337
|
symbol: _nullishCoalesce(_optionalChain([token, 'optionalAccess', _40 => _40.symbol]), () => ( "Token")),
|
|
@@ -1344,7 +1341,7 @@ function createDepositService(baseUrl, options) {
|
|
|
1344
1341
|
};
|
|
1345
1342
|
}
|
|
1346
1343
|
const searchParams = new URLSearchParams({
|
|
1347
|
-
sourceChainId:
|
|
1344
|
+
sourceChainId: _chunk4KCSH4T3cjs.toEvmCaip2.call(void 0, params.sourceChainId),
|
|
1348
1345
|
sourceToken: params.sourceToken,
|
|
1349
1346
|
destinationChainId: params.destinationChainId,
|
|
1350
1347
|
destinationToken: params.destinationToken,
|
|
@@ -1359,7 +1356,7 @@ function createDepositService(baseUrl, options) {
|
|
|
1359
1356
|
});
|
|
1360
1357
|
const response = await fetch(url, {
|
|
1361
1358
|
method: "GET",
|
|
1362
|
-
headers:
|
|
1359
|
+
headers: _chunkGACIGCSNcjs.serviceHeaders.call(void 0, ),
|
|
1363
1360
|
cache: "no-store"
|
|
1364
1361
|
});
|
|
1365
1362
|
if (!response.ok) {
|
|
@@ -1391,7 +1388,10 @@ function createDepositService(baseUrl, options) {
|
|
|
1391
1388
|
const body = {
|
|
1392
1389
|
account: params.account,
|
|
1393
1390
|
// HyperCore has its own CAIP-2 namespace — never the eip155 placeholder.
|
|
1394
|
-
|
|
1391
|
+
// The branch is unreachable against today's processor whatever venue it
|
|
1392
|
+
// names: `sourceToken` is validated as a 20-byte 0x address on every
|
|
1393
|
+
// chain, and a HyperCore source token is a 16-byte Core spot tokenId.
|
|
1394
|
+
sourceChainId: params.sourceChainId === "hypercore" ? _chunk4KCSH4T3cjs.HYPERCORE_SPOT_CAIP2 : `eip155:${params.sourceChainId}`,
|
|
1395
1395
|
sourceToken: params.sourceToken,
|
|
1396
1396
|
amount: params.amount
|
|
1397
1397
|
};
|
|
@@ -1404,7 +1404,7 @@ function createDepositService(baseUrl, options) {
|
|
|
1404
1404
|
try {
|
|
1405
1405
|
const response = await fetch(url, {
|
|
1406
1406
|
method: "POST",
|
|
1407
|
-
headers:
|
|
1407
|
+
headers: _chunkGACIGCSNcjs.serviceHeaders.call(void 0, ),
|
|
1408
1408
|
body: JSON.stringify(body),
|
|
1409
1409
|
cache: "no-store"
|
|
1410
1410
|
});
|
|
@@ -1432,6 +1432,154 @@ function createDepositService(baseUrl, options) {
|
|
|
1432
1432
|
return null;
|
|
1433
1433
|
}
|
|
1434
1434
|
},
|
|
1435
|
+
async preparePermitDeposit(params) {
|
|
1436
|
+
const url = apiUrl("/deposits/permit/prepare");
|
|
1437
|
+
debugLog(debug, scope, "preparePermitDeposit:request", {
|
|
1438
|
+
url,
|
|
1439
|
+
account: shortRef(params.account),
|
|
1440
|
+
sourceChain: params.sourceChain,
|
|
1441
|
+
token: params.token,
|
|
1442
|
+
amount: params.amount
|
|
1443
|
+
});
|
|
1444
|
+
try {
|
|
1445
|
+
const response = await fetch(url, {
|
|
1446
|
+
method: "POST",
|
|
1447
|
+
headers: _chunkGACIGCSNcjs.serviceHeaders.call(void 0, ),
|
|
1448
|
+
body: JSON.stringify({ ...params, kind: "auto" }),
|
|
1449
|
+
cache: "no-store"
|
|
1450
|
+
});
|
|
1451
|
+
if (!response.ok) {
|
|
1452
|
+
debugLog(debug, scope, "preparePermitDeposit:unavailable", {
|
|
1453
|
+
status: response.status
|
|
1454
|
+
});
|
|
1455
|
+
return null;
|
|
1456
|
+
}
|
|
1457
|
+
const data = await response.json();
|
|
1458
|
+
if (!data || typeof data.available !== "boolean") {
|
|
1459
|
+
debugLog(debug, scope, "preparePermitDeposit:unavailable", {
|
|
1460
|
+
status: response.status,
|
|
1461
|
+
reason: "malformed"
|
|
1462
|
+
});
|
|
1463
|
+
return null;
|
|
1464
|
+
}
|
|
1465
|
+
if (data.available === false) {
|
|
1466
|
+
const reason = data.reason;
|
|
1467
|
+
if (reason !== "permit2-approval-required" && reason !== "unsupported-token" && reason !== "unsupported-owner") {
|
|
1468
|
+
return null;
|
|
1469
|
+
}
|
|
1470
|
+
debugLog(debug, scope, "preparePermitDeposit:unavailable", {
|
|
1471
|
+
status: response.status,
|
|
1472
|
+
reason
|
|
1473
|
+
});
|
|
1474
|
+
const approval = data.approval;
|
|
1475
|
+
const parsedApproval = approval && typeof approval.token === "string" && typeof approval.spender === "string" && typeof approval.minimumAmount === "string" ? {
|
|
1476
|
+
token: approval.token,
|
|
1477
|
+
spender: approval.spender,
|
|
1478
|
+
minimumAmount: approval.minimumAmount
|
|
1479
|
+
} : void 0;
|
|
1480
|
+
return {
|
|
1481
|
+
available: false,
|
|
1482
|
+
reason,
|
|
1483
|
+
...parsedApproval && { approval: parsedApproval }
|
|
1484
|
+
};
|
|
1485
|
+
}
|
|
1486
|
+
const authorization = data.authorization;
|
|
1487
|
+
if (!authorization || typeof authorization.typedData !== "object" || authorization.typedData === null || typeof authorization.nonce !== "string") {
|
|
1488
|
+
return null;
|
|
1489
|
+
}
|
|
1490
|
+
if (authorization.kind === "erc3009" && typeof authorization.validAfter === "string" && typeof authorization.validBefore === "string") {
|
|
1491
|
+
debugLog(debug, scope, "preparePermitDeposit:success", {
|
|
1492
|
+
kind: authorization.kind,
|
|
1493
|
+
nonce: authorization.nonce
|
|
1494
|
+
});
|
|
1495
|
+
return {
|
|
1496
|
+
available: true,
|
|
1497
|
+
authorization: {
|
|
1498
|
+
kind: "erc3009",
|
|
1499
|
+
typedData: authorization.typedData,
|
|
1500
|
+
nonce: authorization.nonce,
|
|
1501
|
+
validAfter: authorization.validAfter,
|
|
1502
|
+
validBefore: authorization.validBefore
|
|
1503
|
+
}
|
|
1504
|
+
};
|
|
1505
|
+
}
|
|
1506
|
+
if ((authorization.kind === "erc2612" || authorization.kind === "permit2") && typeof authorization.deadline === "string") {
|
|
1507
|
+
debugLog(debug, scope, "preparePermitDeposit:success", {
|
|
1508
|
+
kind: authorization.kind,
|
|
1509
|
+
nonce: authorization.nonce
|
|
1510
|
+
});
|
|
1511
|
+
return {
|
|
1512
|
+
available: true,
|
|
1513
|
+
authorization: {
|
|
1514
|
+
kind: authorization.kind,
|
|
1515
|
+
typedData: authorization.typedData,
|
|
1516
|
+
nonce: authorization.nonce,
|
|
1517
|
+
deadline: authorization.deadline
|
|
1518
|
+
}
|
|
1519
|
+
};
|
|
1520
|
+
}
|
|
1521
|
+
return null;
|
|
1522
|
+
} catch (error) {
|
|
1523
|
+
debugError(debug, scope, "preparePermitDeposit:error", error);
|
|
1524
|
+
return null;
|
|
1525
|
+
}
|
|
1526
|
+
},
|
|
1527
|
+
async submitPermitDeposit(params) {
|
|
1528
|
+
const url = apiUrl("/deposits/permit");
|
|
1529
|
+
debugLog(debug, scope, "submitPermitDeposit:request", {
|
|
1530
|
+
url,
|
|
1531
|
+
account: shortRef(params.account),
|
|
1532
|
+
sourceChain: params.sourceChain,
|
|
1533
|
+
token: params.token,
|
|
1534
|
+
amount: params.amount,
|
|
1535
|
+
nonce: params.nonce
|
|
1536
|
+
});
|
|
1537
|
+
let response;
|
|
1538
|
+
try {
|
|
1539
|
+
response = await fetch(url, {
|
|
1540
|
+
method: "POST",
|
|
1541
|
+
headers: _chunkGACIGCSNcjs.serviceHeaders.call(void 0, ),
|
|
1542
|
+
body: JSON.stringify(params)
|
|
1543
|
+
});
|
|
1544
|
+
} catch (error) {
|
|
1545
|
+
const message = error instanceof Error ? error.message : "Network error";
|
|
1546
|
+
throw new PermitDepositSubmitError(message, false);
|
|
1547
|
+
}
|
|
1548
|
+
if (!response.ok) {
|
|
1549
|
+
const error = await response.json().catch(() => ({ error: "Unknown error" }));
|
|
1550
|
+
debugError(debug, scope, "submitPermitDeposit:failed", error, {
|
|
1551
|
+
status: response.status,
|
|
1552
|
+
account: shortRef(params.account)
|
|
1553
|
+
});
|
|
1554
|
+
const safeToTransfer = [400, 401, 403, 404, 422].includes(
|
|
1555
|
+
response.status
|
|
1556
|
+
);
|
|
1557
|
+
throw new PermitDepositSubmitError(
|
|
1558
|
+
error.error || `Permit deposit failed: ${response.status}`,
|
|
1559
|
+
safeToTransfer
|
|
1560
|
+
);
|
|
1561
|
+
}
|
|
1562
|
+
const result = await response.json();
|
|
1563
|
+
if (typeof _optionalChain([result, 'optionalAccess', _42 => _42.txHash]) !== "string" || result.txHash.length === 0) {
|
|
1564
|
+
debugError(debug, scope, "submitPermitDeposit:failed", result, {
|
|
1565
|
+
reason: "missing txHash"
|
|
1566
|
+
});
|
|
1567
|
+
throw new PermitDepositSubmitError(
|
|
1568
|
+
"Permit deposit response missing txHash",
|
|
1569
|
+
false
|
|
1570
|
+
);
|
|
1571
|
+
}
|
|
1572
|
+
debugLog(debug, scope, "submitPermitDeposit:success", {
|
|
1573
|
+
depositId: result.depositId,
|
|
1574
|
+
txHash: shortRef(result.txHash),
|
|
1575
|
+
status: result.status
|
|
1576
|
+
});
|
|
1577
|
+
return {
|
|
1578
|
+
depositId: _nullishCoalesce(result.depositId, () => ( "")),
|
|
1579
|
+
txHash: result.txHash,
|
|
1580
|
+
status: _nullishCoalesce(result.status, () => ( "processing"))
|
|
1581
|
+
};
|
|
1582
|
+
},
|
|
1435
1583
|
async fetchPrices(symbols) {
|
|
1436
1584
|
const list = symbols.filter((s) => s.length > 0);
|
|
1437
1585
|
if (list.length === 0) return {};
|
|
@@ -1441,7 +1589,7 @@ function createDepositService(baseUrl, options) {
|
|
|
1441
1589
|
try {
|
|
1442
1590
|
const response = await fetch(url, {
|
|
1443
1591
|
method: "GET",
|
|
1444
|
-
headers:
|
|
1592
|
+
headers: _chunkGACIGCSNcjs.serviceHeaders.call(void 0, ),
|
|
1445
1593
|
cache: "no-store"
|
|
1446
1594
|
});
|
|
1447
1595
|
if (!response.ok) {
|
|
@@ -1466,12 +1614,14 @@ function createDepositService(baseUrl, options) {
|
|
|
1466
1614
|
const list = caip2Ids.filter((id) => id.length > 0);
|
|
1467
1615
|
if (list.length === 0) return {};
|
|
1468
1616
|
const url = apiUrl(
|
|
1469
|
-
`/prices?${new URLSearchParams({
|
|
1617
|
+
`/prices?${new URLSearchParams({
|
|
1618
|
+
addresses: list.join(",")
|
|
1619
|
+
}).toString()}`
|
|
1470
1620
|
);
|
|
1471
1621
|
try {
|
|
1472
1622
|
const response = await fetch(url, {
|
|
1473
1623
|
method: "GET",
|
|
1474
|
-
headers:
|
|
1624
|
+
headers: _chunkGACIGCSNcjs.serviceHeaders.call(void 0, ),
|
|
1475
1625
|
cache: "no-store"
|
|
1476
1626
|
});
|
|
1477
1627
|
if (!response.ok) {
|
|
@@ -1496,7 +1646,7 @@ function createDepositService(baseUrl, options) {
|
|
|
1496
1646
|
});
|
|
1497
1647
|
const response = await fetch(url, {
|
|
1498
1648
|
method: "POST",
|
|
1499
|
-
headers:
|
|
1649
|
+
headers: _chunkGACIGCSNcjs.serviceHeaders.call(void 0, ),
|
|
1500
1650
|
body: JSON.stringify(params)
|
|
1501
1651
|
});
|
|
1502
1652
|
if (!response.ok) {
|
|
@@ -1528,7 +1678,7 @@ function createDepositService(baseUrl, options) {
|
|
|
1528
1678
|
});
|
|
1529
1679
|
const response = await fetch(url, {
|
|
1530
1680
|
method: "POST",
|
|
1531
|
-
headers:
|
|
1681
|
+
headers: _chunkGACIGCSNcjs.serviceHeaders.call(void 0, ),
|
|
1532
1682
|
body: JSON.stringify(params)
|
|
1533
1683
|
});
|
|
1534
1684
|
if (!response.ok) {
|
|
@@ -1565,7 +1715,7 @@ function createDepositService(baseUrl, options) {
|
|
|
1565
1715
|
debugLog(debug, scope, "getSwappedConnectExchanges:request");
|
|
1566
1716
|
const response = await fetch(url, {
|
|
1567
1717
|
method: "GET",
|
|
1568
|
-
headers:
|
|
1718
|
+
headers: _chunkGACIGCSNcjs.serviceHeaders.call(void 0, ),
|
|
1569
1719
|
cache: "no-store"
|
|
1570
1720
|
});
|
|
1571
1721
|
if (!response.ok) {
|
|
@@ -1618,7 +1768,7 @@ function createDepositService(baseUrl, options) {
|
|
|
1618
1768
|
try {
|
|
1619
1769
|
const response = await fetch(url, {
|
|
1620
1770
|
method: "GET",
|
|
1621
|
-
headers:
|
|
1771
|
+
headers: _chunkGACIGCSNcjs.serviceHeaders.call(void 0, ),
|
|
1622
1772
|
cache: "no-store"
|
|
1623
1773
|
});
|
|
1624
1774
|
if (!response.ok) {
|
|
@@ -1704,7 +1854,7 @@ function createDepositService(baseUrl, options) {
|
|
|
1704
1854
|
try {
|
|
1705
1855
|
const response = await fetch(url, {
|
|
1706
1856
|
method: "GET",
|
|
1707
|
-
headers:
|
|
1857
|
+
headers: _chunkGACIGCSNcjs.serviceHeaders.call(void 0, ),
|
|
1708
1858
|
cache: "no-store"
|
|
1709
1859
|
});
|
|
1710
1860
|
if (!response.ok) {
|
|
@@ -1731,7 +1881,7 @@ function createDepositService(baseUrl, options) {
|
|
|
1731
1881
|
);
|
|
1732
1882
|
const response = await fetch(url, {
|
|
1733
1883
|
method: "GET",
|
|
1734
|
-
headers:
|
|
1884
|
+
headers: _chunkGACIGCSNcjs.serviceHeaders.call(void 0, ),
|
|
1735
1885
|
cache: "no-store"
|
|
1736
1886
|
});
|
|
1737
1887
|
if (!response.ok) return null;
|
|
@@ -1772,16 +1922,16 @@ function createDepositService(baseUrl, options) {
|
|
|
1772
1922
|
}
|
|
1773
1923
|
function normalizeDirectPortfolio(data) {
|
|
1774
1924
|
const rawTokens = _nullishCoalesce(_nullishCoalesce(extractArray(data, "tokens"), () => ( extractArray(
|
|
1775
|
-
_optionalChain([data, 'optionalAccess',
|
|
1925
|
+
_optionalChain([data, 'optionalAccess', _43 => _43.data]),
|
|
1776
1926
|
"tokens"
|
|
1777
1927
|
))), () => ( []));
|
|
1778
|
-
const totalUsd = _nullishCoalesce(_nullishCoalesce(extractNumber(data, "totalUsd"), () => ( extractNumber(_optionalChain([data, 'optionalAccess',
|
|
1928
|
+
const totalUsd = _nullishCoalesce(_nullishCoalesce(extractNumber(data, "totalUsd"), () => ( extractNumber(_optionalChain([data, 'optionalAccess', _44 => _44.data]), "totalUsd"))), () => ( 0));
|
|
1779
1929
|
const tokens = rawTokens.map((token) => normalizeDirectToken(token)).filter((token) => Boolean(token));
|
|
1780
1930
|
return { tokens, totalUsd };
|
|
1781
1931
|
}
|
|
1782
1932
|
function extractOrchestratorPortfolio(data) {
|
|
1783
1933
|
const portfolio = _nullishCoalesce(extractArray(data, "portfolio"), () => ( extractArray(
|
|
1784
|
-
_optionalChain([data, 'optionalAccess',
|
|
1934
|
+
_optionalChain([data, 'optionalAccess', _45 => _45.data]),
|
|
1785
1935
|
"portfolio"
|
|
1786
1936
|
)));
|
|
1787
1937
|
if (!portfolio || !Array.isArray(portfolio)) return null;
|
|
@@ -1792,17 +1942,23 @@ function normalizeOrchestratorPortfolio(data) {
|
|
|
1792
1942
|
for (const tokenData of data.portfolio || []) {
|
|
1793
1943
|
const chainBalances = _nullishCoalesce(_nullishCoalesce(tokenData.tokenChainBalance, () => ( tokenData.chainBalances)), () => ( []));
|
|
1794
1944
|
for (const chainBalance of chainBalances) {
|
|
1795
|
-
const unlocked = _nullishCoalesce(_optionalChain([chainBalance, 'access',
|
|
1945
|
+
const unlocked = _nullishCoalesce(_optionalChain([chainBalance, 'access', _46 => _46.balance, 'optionalAccess', _47 => _47.unlocked]), () => ( "0"));
|
|
1796
1946
|
const normalizedName = tokenData.tokenName.trim();
|
|
1797
1947
|
const isNativeSymbol = normalizedName.toUpperCase() === "ETH" || normalizedName.toUpperCase() === "ETHER";
|
|
1798
|
-
const tokenAddress = _nullishCoalesce(_nullishCoalesce(chainBalance.tokenAddress, () => ( extractTokenAddress(tokenData, chainBalance.chainId))), () => (
|
|
1799
|
-
const resolvedTokenAddress = isNativeSymbol ?
|
|
1948
|
+
const tokenAddress = _nullishCoalesce(_nullishCoalesce(chainBalance.tokenAddress, () => ( extractTokenAddress(tokenData, chainBalance.chainId))), () => ( _chunk4KCSH4T3cjs.getTokenAddress.call(void 0, tokenData.tokenName, chainBalance.chainId)));
|
|
1949
|
+
const resolvedTokenAddress = isNativeSymbol ? _chunk4KCSH4T3cjs.NATIVE_TOKEN_ADDRESS : tokenAddress;
|
|
1800
1950
|
if (!resolvedTokenAddress) {
|
|
1801
1951
|
continue;
|
|
1802
1952
|
}
|
|
1803
|
-
const registrySymbol =
|
|
1953
|
+
const registrySymbol = _chunk4KCSH4T3cjs.getTokenSymbol.call(void 0,
|
|
1954
|
+
resolvedTokenAddress,
|
|
1955
|
+
chainBalance.chainId
|
|
1956
|
+
);
|
|
1804
1957
|
const symbol = registrySymbol !== "Token" ? registrySymbol : normalizedName || "Token";
|
|
1805
|
-
const decimals = registrySymbol !== "Token" ?
|
|
1958
|
+
const decimals = registrySymbol !== "Token" ? _chunk4KCSH4T3cjs.getTokenDecimalsByAddress.call(void 0,
|
|
1959
|
+
resolvedTokenAddress,
|
|
1960
|
+
chainBalance.chainId
|
|
1961
|
+
) : _nullishCoalesce(tokenData.tokenDecimals, () => ( 18));
|
|
1806
1962
|
tokens.push({
|
|
1807
1963
|
chainId: chainBalance.chainId,
|
|
1808
1964
|
address: resolvedTokenAddress,
|
|
@@ -1822,28 +1978,28 @@ function normalizeOrchestratorPortfolio(data) {
|
|
|
1822
1978
|
function normalizeDirectToken(token) {
|
|
1823
1979
|
const rawChainId = _nullishCoalesce(extractNumber(token, "chainId"), () => ( extractNumber(token.chain, "id")));
|
|
1824
1980
|
const rawChainString = _nullishCoalesce(extractString(token, "chainId"), () => ( extractString(token.chain, "id")));
|
|
1825
|
-
const chainId = _nullishCoalesce(rawChainId, () => ( (rawChainString ?
|
|
1826
|
-
// HyperCore
|
|
1827
|
-
// instead of dropping it as an unparseable chain string.
|
|
1828
|
-
|
|
1981
|
+
const chainId = _nullishCoalesce(rawChainId, () => ( (rawChainString ? _chunk4KCSH4T3cjs.isSolanaCaip2.call(void 0, rawChainString) || rawChainString.toLowerCase() === "solana" ? "solana" : (
|
|
1982
|
+
// HyperCore is a non-EVM source under its own namespace; keep its
|
|
1983
|
+
// USDC instead of dropping it as an unparseable chain string.
|
|
1984
|
+
_chunk4KCSH4T3cjs.isHyperCoreCaip2.call(void 0, rawChainString) || rawChainString.toLowerCase() === "hypercore" ? "hypercore" : _chunk4KCSH4T3cjs.parseEvmChainId.call(void 0, rawChainString)
|
|
1829
1985
|
) : null)));
|
|
1830
1986
|
if (chainId === null) return null;
|
|
1831
|
-
const registryChainId = typeof chainId === "number" ? chainId : chainId === "hypercore" ?
|
|
1987
|
+
const registryChainId = typeof chainId === "number" ? chainId : chainId === "hypercore" ? _chunk4KCSH4T3cjs.HYPERCORE_CHAIN_ID : void 0;
|
|
1832
1988
|
const symbol = _nullishCoalesce(_nullishCoalesce(_nullishCoalesce(extractString(token, "symbol"), () => ( extractString(token, "tokenSymbol"))), () => ( extractString(token, "tokenName"))), () => ( extractString(token, "name")));
|
|
1833
1989
|
if (!symbol) return null;
|
|
1834
|
-
const balanceValue = _nullishCoalesce(_nullishCoalesce(_nullishCoalesce(_nullishCoalesce(_nullishCoalesce(_nullishCoalesce(_nullishCoalesce(extractString(token, "balance"), () => ( extractString(token, "amount"))), () => ( extractString(token, "value"))), () => ( extractString(token, "rawBalance"))), () => ( _optionalChain([extractNumber, 'call',
|
|
1990
|
+
const balanceValue = _nullishCoalesce(_nullishCoalesce(_nullishCoalesce(_nullishCoalesce(_nullishCoalesce(_nullishCoalesce(_nullishCoalesce(extractString(token, "balance"), () => ( extractString(token, "amount"))), () => ( extractString(token, "value"))), () => ( extractString(token, "rawBalance"))), () => ( _optionalChain([extractNumber, 'call', _48 => _48(token, "balance"), 'optionalAccess', _49 => _49.toString, 'call', _50 => _50()]))), () => ( _optionalChain([extractNumber, 'call', _51 => _51(token, "amount"), 'optionalAccess', _52 => _52.toString, 'call', _53 => _53()]))), () => ( _optionalChain([extractNumber, 'call', _54 => _54(token, "value"), 'optionalAccess', _55 => _55.toString, 'call', _56 => _56()]))), () => ( _optionalChain([extractNumber, 'call', _57 => _57(token, "rawBalance"), 'optionalAccess', _58 => _58.toString, 'call', _59 => _59()])));
|
|
1835
1991
|
if (!balanceValue) return null;
|
|
1836
1992
|
const address = _nullishCoalesce(_nullishCoalesce(_nullishCoalesce(extractString(token, "address"), () => ( extractString(token, "tokenAddress"))), () => ( extractString(
|
|
1837
1993
|
token.token,
|
|
1838
1994
|
"address"
|
|
1839
|
-
))), () => ( (registryChainId !== void 0 ?
|
|
1995
|
+
))), () => ( (registryChainId !== void 0 ? _chunk4KCSH4T3cjs.getTokenAddress.call(void 0, symbol, registryChainId) : void 0)));
|
|
1840
1996
|
if (!address) return null;
|
|
1841
1997
|
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));
|
|
1842
1998
|
const isSolanaToken = chainId === "solana";
|
|
1843
|
-
const registrySymbol = isSolanaToken ? "Token" :
|
|
1999
|
+
const registrySymbol = isSolanaToken ? "Token" : _chunk4KCSH4T3cjs.getTokenSymbol.call(void 0, address, registryChainId);
|
|
1844
2000
|
const resolvedSymbol = isSolanaToken ? symbol : registrySymbol !== "Token" ? registrySymbol : symbol;
|
|
1845
2001
|
const backendDecimals = _nullishCoalesce(extractNumber(token, "decimals"), () => ( extractNumber(token, "tokenDecimals")));
|
|
1846
|
-
const resolvedDecimals = !isSolanaToken && registrySymbol !== "Token" ?
|
|
2002
|
+
const resolvedDecimals = !isSolanaToken && registrySymbol !== "Token" ? _chunk4KCSH4T3cjs.getTokenDecimalsByAddress.call(void 0, address, registryChainId) : _nullishCoalesce(backendDecimals, () => ( 18));
|
|
1847
2003
|
return {
|
|
1848
2004
|
chainId,
|
|
1849
2005
|
address,
|
|
@@ -1856,7 +2012,7 @@ function normalizeDirectToken(token) {
|
|
|
1856
2012
|
}
|
|
1857
2013
|
function extractTokenAddress(tokenData, chainId) {
|
|
1858
2014
|
const token = tokenData;
|
|
1859
|
-
return _nullishCoalesce(_nullishCoalesce(_nullishCoalesce(_nullishCoalesce(token.tokenAddress, () => ( token.address)), () => ( _optionalChain([token, 'access',
|
|
2015
|
+
return _nullishCoalesce(_nullishCoalesce(_nullishCoalesce(_nullishCoalesce(token.tokenAddress, () => ( token.address)), () => ( _optionalChain([token, 'access', _60 => _60.addresses, 'optionalAccess', _61 => _61[chainId]]))), () => ( _optionalChain([token, 'access', _62 => _62.token, 'optionalAccess', _63 => _63.address]))), () => ( _optionalChain([token, 'access', _64 => _64.token, 'optionalAccess', _65 => _65.addresses, 'optionalAccess', _66 => _66[chainId]])));
|
|
1860
2016
|
}
|
|
1861
2017
|
function extractArray(data, key) {
|
|
1862
2018
|
if (!data || typeof data !== "object") return null;
|
|
@@ -1886,7 +2042,7 @@ function extractNumericString(data, key) {
|
|
|
1886
2042
|
// src/core/rpc.ts
|
|
1887
2043
|
|
|
1888
2044
|
function rpcUrlFor(rpcUrls, chain) {
|
|
1889
|
-
const url = _optionalChain([rpcUrls, 'optionalAccess',
|
|
2045
|
+
const url = _optionalChain([rpcUrls, 'optionalAccess', _67 => _67[chain], 'optionalAccess', _68 => _68.trim, 'call', _69 => _69()]);
|
|
1890
2046
|
return url ? url : void 0;
|
|
1891
2047
|
}
|
|
1892
2048
|
var RpcUrlsContext = _react.createContext.call(void 0, void 0);
|
|
@@ -1896,7 +2052,7 @@ function useRpcUrls() {
|
|
|
1896
2052
|
}
|
|
1897
2053
|
function rpcUrlsKey(rpcUrls) {
|
|
1898
2054
|
if (!rpcUrls) return "";
|
|
1899
|
-
return Object.entries(rpcUrls).map(([chain, url]) => [chain, _nullishCoalesce(_optionalChain([url, 'optionalAccess',
|
|
2055
|
+
return Object.entries(rpcUrls).map(([chain, url]) => [chain, _nullishCoalesce(_optionalChain([url, 'optionalAccess', _70 => _70.trim, 'call', _71 => _71()]), () => ( ""))]).filter(([, url]) => url !== "").map(([chain, url]) => `${chain}=${url}`).sort().join("|");
|
|
1900
2056
|
}
|
|
1901
2057
|
function useStableRpcUrls(rpcUrls) {
|
|
1902
2058
|
const key = rpcUrlsKey(rpcUrls);
|
|
@@ -1912,29 +2068,62 @@ function useStableRpcUrls(rpcUrls) {
|
|
|
1912
2068
|
|
|
1913
2069
|
|
|
1914
2070
|
|
|
2071
|
+
|
|
1915
2072
|
// src/core/public-client.ts
|
|
1916
2073
|
|
|
1917
2074
|
var clientCache = /* @__PURE__ */ new Map();
|
|
1918
2075
|
var runtimeChainById = /* @__PURE__ */ new Map();
|
|
2076
|
+
var BOOTSTRAP_RPC_URL = {
|
|
2077
|
+
1: "https://eth.merkle.io",
|
|
2078
|
+
10: "https://mainnet.optimism.io",
|
|
2079
|
+
56: "https://56.rpc.thirdweb.com",
|
|
2080
|
+
100: "https://rpc.gnosischain.com",
|
|
2081
|
+
130: "https://mainnet.unichain.org",
|
|
2082
|
+
137: "https://polygon.drpc.org",
|
|
2083
|
+
143: "https://rpc.monad.xyz",
|
|
2084
|
+
146: "https://rpc.soniclabs.com",
|
|
2085
|
+
999: "https://rpc.hyperliquid.xyz/evm",
|
|
2086
|
+
1868: "https://rpc.soneium.org",
|
|
2087
|
+
8453: "https://mainnet.base.org",
|
|
2088
|
+
9745: "https://rpc.plasma.to",
|
|
2089
|
+
42161: "https://arb1.arbitrum.io/rpc",
|
|
2090
|
+
747474: "https://rpc.katana.network"
|
|
2091
|
+
};
|
|
2092
|
+
var runtimeChainsVersion = 0;
|
|
2093
|
+
var runtimeChainListeners = /* @__PURE__ */ new Set();
|
|
2094
|
+
function subscribeToRuntimeChains(listener) {
|
|
2095
|
+
runtimeChainListeners.add(listener);
|
|
2096
|
+
return () => {
|
|
2097
|
+
runtimeChainListeners.delete(listener);
|
|
2098
|
+
};
|
|
2099
|
+
}
|
|
2100
|
+
function getRuntimeChainsVersion() {
|
|
2101
|
+
return runtimeChainsVersion;
|
|
2102
|
+
}
|
|
1919
2103
|
function setRuntimeChains(chains) {
|
|
2104
|
+
let changed = false;
|
|
1920
2105
|
for (const chain of chains) {
|
|
1921
2106
|
const known = runtimeChainById.get(chain.id);
|
|
1922
2107
|
if (known === chain) continue;
|
|
1923
2108
|
runtimeChainById.set(chain.id, chain);
|
|
2109
|
+
changed = true;
|
|
1924
2110
|
for (const key of clientCache.keys()) {
|
|
1925
2111
|
if (key.startsWith(`${chain.id}|`)) clientCache.delete(key);
|
|
1926
2112
|
}
|
|
1927
2113
|
}
|
|
2114
|
+
if (!changed) return;
|
|
2115
|
+
runtimeChainsVersion += 1;
|
|
2116
|
+
for (const listener of runtimeChainListeners) listener();
|
|
1928
2117
|
}
|
|
1929
2118
|
function getPublicClient(chainId, rpcUrls) {
|
|
1930
2119
|
const url = rpcUrlFor(rpcUrls, chainId);
|
|
1931
2120
|
const cacheKey = `${chainId}|${_nullishCoalesce(url, () => ( ""))}`;
|
|
1932
2121
|
let client = clientCache.get(cacheKey);
|
|
1933
2122
|
if (!client) {
|
|
1934
|
-
const chain =
|
|
2123
|
+
const chain = runtimeChainById.get(chainId);
|
|
1935
2124
|
client = _viem.createPublicClient.call(void 0, {
|
|
1936
2125
|
chain,
|
|
1937
|
-
transport: _viem.http.call(void 0, url)
|
|
2126
|
+
transport: _viem.http.call(void 0, _nullishCoalesce(url, () => ( (chain ? void 0 : BOOTSTRAP_RPC_URL[chainId]))))
|
|
1938
2127
|
});
|
|
1939
2128
|
clientCache.set(cacheKey, client);
|
|
1940
2129
|
}
|
|
@@ -1951,7 +2140,7 @@ async function loadViemChains() {
|
|
|
1951
2140
|
viemChainsPromise = Promise.resolve().then(() => _interopRequireWildcard(require("viem/chains"))).then((module) => {
|
|
1952
2141
|
const map = /* @__PURE__ */ new Map();
|
|
1953
2142
|
for (const value of Object.values(module)) {
|
|
1954
|
-
if (value && typeof value === "object" && typeof value.id === "number" && _optionalChain([value, 'access',
|
|
2143
|
+
if (value && typeof value === "object" && typeof value.id === "number" && _optionalChain([value, 'access', _72 => _72.rpcUrls, 'optionalAccess', _73 => _73.default, 'optionalAccess', _74 => _74.http, 'optionalAccess', _75 => _75.length])) {
|
|
1955
2144
|
const chain = value;
|
|
1956
2145
|
const existing = map.get(chain.id);
|
|
1957
2146
|
if (existing) existing.push(chain);
|
|
@@ -1965,7 +2154,7 @@ async function loadViemChains() {
|
|
|
1965
2154
|
return viemChainsPromise;
|
|
1966
2155
|
}
|
|
1967
2156
|
function pickViemChain(candidates, chain) {
|
|
1968
|
-
if (!_optionalChain([candidates, 'optionalAccess',
|
|
2157
|
+
if (!_optionalChain([candidates, 'optionalAccess', _76 => _76.length])) return void 0;
|
|
1969
2158
|
if (candidates.length === 1) return candidates[0];
|
|
1970
2159
|
const sameNetworkClass = candidates.filter(
|
|
1971
2160
|
(candidate) => Boolean(candidate.testnet) === chain.testnet
|
|
@@ -1981,10 +2170,10 @@ function pickViemChain(candidates, chain) {
|
|
|
1981
2170
|
}
|
|
1982
2171
|
function resolveRpcUrls(chain, override, viemChains) {
|
|
1983
2172
|
const urls = [];
|
|
1984
|
-
if (_optionalChain([override, 'optionalAccess',
|
|
2173
|
+
if (_optionalChain([override, 'optionalAccess', _77 => _77.trim, 'call', _78 => _78()])) urls.push(override.trim());
|
|
1985
2174
|
if (chain.publicRpcUrl) urls.push(chain.publicRpcUrl);
|
|
1986
2175
|
if (chain.chainId !== null && chain.vmType === "evm") {
|
|
1987
|
-
const http2 = _optionalChain([pickViemChain, 'call',
|
|
2176
|
+
const http2 = _optionalChain([pickViemChain, 'call', _79 => _79(_optionalChain([viemChains, 'optionalAccess', _80 => _80.get, 'call', _81 => _81(chain.chainId)]), chain), 'optionalAccess', _82 => _82.rpcUrls, 'optionalAccess', _83 => _83.default, 'optionalAccess', _84 => _84.http]);
|
|
1988
2177
|
if (http2) urls.push(...http2);
|
|
1989
2178
|
}
|
|
1990
2179
|
return [...new Set(urls)];
|
|
@@ -1993,7 +2182,7 @@ function toViemChain(chain, override, viemChains) {
|
|
|
1993
2182
|
if (chain.vmType !== "evm" || chain.chainId === null) return null;
|
|
1994
2183
|
const rpcUrls = resolveRpcUrls(chain, override, viemChains);
|
|
1995
2184
|
if (rpcUrls.length === 0) return null;
|
|
1996
|
-
const bundled = pickViemChain(_optionalChain([viemChains, 'optionalAccess',
|
|
2185
|
+
const bundled = pickViemChain(_optionalChain([viemChains, 'optionalAccess', _85 => _85.get, 'call', _86 => _86(chain.chainId)]), chain);
|
|
1997
2186
|
if (bundled) {
|
|
1998
2187
|
if (rpcUrls[0] === bundled.rpcUrls.default.http[0]) return bundled;
|
|
1999
2188
|
return _viem.defineChain.call(void 0, {
|
|
@@ -2024,7 +2213,7 @@ function toViemChains(catalog, overrides, viemChains) {
|
|
|
2024
2213
|
for (const entry of catalog.all) {
|
|
2025
2214
|
const chain = toViemChain(
|
|
2026
2215
|
entry,
|
|
2027
|
-
entry.chainId === null ? void 0 : _optionalChain([overrides, 'optionalAccess',
|
|
2216
|
+
entry.chainId === null ? void 0 : _optionalChain([overrides, 'optionalAccess', _87 => _87[entry.chainId]]),
|
|
2028
2217
|
viemChains
|
|
2029
2218
|
);
|
|
2030
2219
|
if (chain) chains.push(chain);
|
|
@@ -2033,7 +2222,7 @@ function toViemChains(catalog, overrides, viemChains) {
|
|
|
2033
2222
|
}
|
|
2034
2223
|
function needsViemChains(catalog, overrides) {
|
|
2035
2224
|
return catalog.all.some(
|
|
2036
|
-
(chain) => chain.vmType === "evm" && chain.chainId !== null && !chain.publicRpcUrl && !_optionalChain([overrides, 'optionalAccess',
|
|
2225
|
+
(chain) => chain.vmType === "evm" && chain.chainId !== null && !chain.publicRpcUrl && !_optionalChain([overrides, 'optionalAccess', _88 => _88[chain.chainId], 'optionalAccess', _89 => _89.trim, 'call', _90 => _90()])
|
|
2037
2226
|
);
|
|
2038
2227
|
}
|
|
2039
2228
|
|
|
@@ -2074,7 +2263,7 @@ function peekRuntimeChains(backendUrl, overrides) {
|
|
|
2074
2263
|
return _nullishCoalesce(resolvedChainsByKey.get(runtimeChainsKey(backendUrl, overrides)), () => ( null));
|
|
2075
2264
|
}
|
|
2076
2265
|
function publishCatalogTokens(catalog) {
|
|
2077
|
-
|
|
2266
|
+
_chunk4KCSH4T3cjs.setRuntimeTokens.call(void 0,
|
|
2078
2267
|
catalog.all.flatMap(
|
|
2079
2268
|
(chain) => chain.chainId === null || !Array.isArray(chain.supportedTokens) ? [] : chain.supportedTokens.map((token) => ({
|
|
2080
2269
|
chainId: chain.chainId,
|
|
@@ -2086,16 +2275,17 @@ function publishCatalogTokens(catalog) {
|
|
|
2086
2275
|
);
|
|
2087
2276
|
}
|
|
2088
2277
|
function publishRuntimeChainMeta(catalog) {
|
|
2089
|
-
|
|
2278
|
+
_chunk4KCSH4T3cjs.setRuntimeChainMeta.call(void 0,
|
|
2090
2279
|
catalog.all.flatMap((chain) => {
|
|
2091
2280
|
const ids = [];
|
|
2092
2281
|
if (chain.chainId !== null) ids.push(chain.chainId);
|
|
2093
|
-
if (
|
|
2282
|
+
if (_chunk4KCSH4T3cjs.isHyperCoreCaip2.call(void 0, chain.caip2)) ids.push(_chunk4KCSH4T3cjs.HYPERCORE_CHAIN_ID);
|
|
2094
2283
|
return ids.map((chainId) => ({
|
|
2095
2284
|
chainId,
|
|
2096
2285
|
name: chain.name,
|
|
2097
2286
|
iconUrl: _nullishCoalesce(chain.iconUrl, () => ( void 0)),
|
|
2098
|
-
nativeSymbol: chain.nativeToken.symbol
|
|
2287
|
+
nativeSymbol: chain.nativeToken.symbol,
|
|
2288
|
+
explorerUrl: _optionalChain([chain, 'access', _91 => _91.explorer, 'optionalAccess', _92 => _92.url])
|
|
2099
2289
|
}));
|
|
2100
2290
|
})
|
|
2101
2291
|
);
|
|
@@ -2145,8 +2335,8 @@ function useDepositChainIds() {
|
|
|
2145
2335
|
!c.testnet
|
|
2146
2336
|
).map((c) => c.chainId);
|
|
2147
2337
|
const rank = (id) => {
|
|
2148
|
-
const i =
|
|
2149
|
-
return i === -1 ?
|
|
2338
|
+
const i = _chunk4KCSH4T3cjs.CHAIN_DISPLAY_ORDER.indexOf(id);
|
|
2339
|
+
return i === -1 ? _chunk4KCSH4T3cjs.CHAIN_DISPLAY_ORDER.length : i;
|
|
2150
2340
|
};
|
|
2151
2341
|
return ids.map((id, i) => ({ id, i })).sort((a, b) => rank(a.id) - rank(b.id) || a.i - b.i).map(({ id }) => id);
|
|
2152
2342
|
}, [catalog]);
|
|
@@ -2156,8 +2346,8 @@ function useDestinationChains() {
|
|
|
2156
2346
|
return _react.useMemo.call(void 0, () => {
|
|
2157
2347
|
if (!catalog) return [];
|
|
2158
2348
|
const rank = (id) => {
|
|
2159
|
-
const i =
|
|
2160
|
-
return i === -1 ?
|
|
2349
|
+
const i = _chunk4KCSH4T3cjs.CHAIN_DISPLAY_ORDER.indexOf(id);
|
|
2350
|
+
return i === -1 ? _chunk4KCSH4T3cjs.CHAIN_DISPLAY_ORDER.length : i;
|
|
2161
2351
|
};
|
|
2162
2352
|
return catalog.all.filter(
|
|
2163
2353
|
(c) => c.destination && c.vmType === "evm" && c.chainId !== null && !c.testnet
|
|
@@ -2168,7 +2358,7 @@ function useTargetTokens() {
|
|
|
2168
2358
|
const { catalog, shortlist } = useChainCatalog();
|
|
2169
2359
|
return _react.useMemo.call(void 0, () => {
|
|
2170
2360
|
return (chainId) => {
|
|
2171
|
-
const fromShortlist = _optionalChain([shortlist, 'optionalAccess',
|
|
2361
|
+
const fromShortlist = _optionalChain([shortlist, 'optionalAccess', _93 => _93[String(chainId)]]);
|
|
2172
2362
|
if (fromShortlist) {
|
|
2173
2363
|
return fromShortlist.map((token) => ({
|
|
2174
2364
|
symbol: token.symbol,
|
|
@@ -2176,8 +2366,8 @@ function useTargetTokens() {
|
|
|
2176
2366
|
decimals: token.decimals
|
|
2177
2367
|
}));
|
|
2178
2368
|
}
|
|
2179
|
-
const entry = _optionalChain([catalog, 'optionalAccess',
|
|
2180
|
-
return Array.isArray(_optionalChain([entry, 'optionalAccess',
|
|
2369
|
+
const entry = _optionalChain([catalog, 'optionalAccess', _94 => _94.byChainId, 'access', _95 => _95.get, 'call', _96 => _96(chainId)]);
|
|
2370
|
+
return Array.isArray(_optionalChain([entry, 'optionalAccess', _97 => _97.supportedTokens])) ? entry.supportedTokens.map((token) => ({
|
|
2181
2371
|
symbol: token.symbol,
|
|
2182
2372
|
address: token.address,
|
|
2183
2373
|
decimals: token.decimals
|
|
@@ -2197,21 +2387,35 @@ function useChainName() {
|
|
|
2197
2387
|
const { catalog } = useChainCatalog();
|
|
2198
2388
|
return _react.useMemo.call(void 0, () => {
|
|
2199
2389
|
return (chainId) => {
|
|
2200
|
-
if (!catalog) return
|
|
2390
|
+
if (!catalog) return _chunk4KCSH4T3cjs.getChainName.call(void 0, chainId);
|
|
2201
2391
|
const key = catalogKeyForChain(chainId);
|
|
2202
2392
|
const entry = typeof key === "number" ? catalog.byChainId.get(key) : catalog.byCaip2.get(key);
|
|
2203
|
-
return _nullishCoalesce(_optionalChain([entry, 'optionalAccess',
|
|
2393
|
+
return _nullishCoalesce(_optionalChain([entry, 'optionalAccess', _98 => _98.name]), () => ( _chunk4KCSH4T3cjs.getChainName.call(void 0, chainId)));
|
|
2204
2394
|
};
|
|
2205
2395
|
}, [catalog]);
|
|
2206
2396
|
}
|
|
2397
|
+
function useRuntimeChainsVersion() {
|
|
2398
|
+
return _react.useSyncExternalStore.call(void 0,
|
|
2399
|
+
subscribeToRuntimeChains,
|
|
2400
|
+
getRuntimeChainsVersion,
|
|
2401
|
+
getRuntimeChainsVersion
|
|
2402
|
+
);
|
|
2403
|
+
}
|
|
2404
|
+
function useReadClient(chainId, rpcUrls) {
|
|
2405
|
+
const version = useRuntimeChainsVersion();
|
|
2406
|
+
return _react.useMemo.call(void 0,
|
|
2407
|
+
() => getPublicClient(chainId, rpcUrls),
|
|
2408
|
+
[chainId, rpcUrls, version]
|
|
2409
|
+
);
|
|
2410
|
+
}
|
|
2207
2411
|
function useExplorerTxUrl() {
|
|
2208
2412
|
const { catalog } = useChainCatalog();
|
|
2209
2413
|
return _react.useMemo.call(void 0, () => {
|
|
2210
2414
|
return (chainId, txHash) => {
|
|
2211
|
-
if (chainId === "hypercore") return
|
|
2415
|
+
if (chainId === "hypercore") return _chunk4KCSH4T3cjs.getExplorerTxUrl.call(void 0, chainId, txHash);
|
|
2212
2416
|
const key = catalog ? catalogKeyForChain(chainId) : void 0;
|
|
2213
|
-
const entry = key === void 0 ? void 0 : typeof key === "number" ? _optionalChain([catalog, 'optionalAccess',
|
|
2214
|
-
return _nullishCoalesce(catalogExplorerTxUrl(entry, txHash), () => (
|
|
2417
|
+
const entry = key === void 0 ? void 0 : typeof key === "number" ? _optionalChain([catalog, 'optionalAccess', _99 => _99.byChainId, 'access', _100 => _100.get, 'call', _101 => _101(key)]) : _optionalChain([catalog, 'optionalAccess', _102 => _102.byCaip2, 'access', _103 => _103.get, 'call', _104 => _104(key)]);
|
|
2418
|
+
return _nullishCoalesce(catalogExplorerTxUrl(entry, txHash), () => ( _chunk4KCSH4T3cjs.getExplorerTxUrl.call(void 0, chainId, txHash)));
|
|
2215
2419
|
};
|
|
2216
2420
|
}, [catalog]);
|
|
2217
2421
|
}
|
|
@@ -2269,7 +2473,7 @@ function ChainCatalogProvider({
|
|
|
2269
2473
|
setShortlist(null);
|
|
2270
2474
|
service.getTopTokens().then((tokens) => {
|
|
2271
2475
|
if (!active || !tokens) return;
|
|
2272
|
-
|
|
2476
|
+
_chunk4KCSH4T3cjs.publishShortlistTokens.call(void 0, tokens);
|
|
2273
2477
|
setShortlist(tokens);
|
|
2274
2478
|
});
|
|
2275
2479
|
return () => {
|
|
@@ -2421,7 +2625,7 @@ function TokenIcon({ symbol, className, fallback }) {
|
|
|
2421
2625
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2422
2626
|
CdnIcon,
|
|
2423
2627
|
{
|
|
2424
|
-
src:
|
|
2628
|
+
src: _chunk4KCSH4T3cjs.tokenIconUrl.call(void 0, symbol),
|
|
2425
2629
|
className: `rs-token-icon ${_nullishCoalesce(className, () => ( ""))}`.trimEnd(),
|
|
2426
2630
|
fallback
|
|
2427
2631
|
}
|
|
@@ -2554,29 +2758,29 @@ var EVM_ADDRESS_RE = /^0x[a-fA-F0-9]{40}$/;
|
|
|
2554
2758
|
function resolveTokenDisplay(token, chain, fallback) {
|
|
2555
2759
|
if (token !== void 0) {
|
|
2556
2760
|
if (chain === "solana") {
|
|
2557
|
-
const solanaToken =
|
|
2761
|
+
const solanaToken = _chunk4KCSH4T3cjs.getSolanaTokenByMint.call(void 0, token);
|
|
2558
2762
|
if (solanaToken) {
|
|
2559
2763
|
return { symbol: solanaToken.symbol, decimals: solanaToken.decimals };
|
|
2560
2764
|
}
|
|
2561
2765
|
} else if (chain === "hypercore") {
|
|
2562
|
-
const t =
|
|
2766
|
+
const t = _chunk4KCSH4T3cjs.HYPERCORE_SOURCE_TOKENS.find(
|
|
2563
2767
|
(x) => x.address.toLowerCase() === token.toLowerCase()
|
|
2564
2768
|
);
|
|
2565
2769
|
if (t) return { symbol: t.symbol, decimals: t.decimals };
|
|
2566
2770
|
} else if (EVM_ADDRESS_RE.test(token)) {
|
|
2567
|
-
const symbol =
|
|
2568
|
-
const decimals =
|
|
2771
|
+
const symbol = _chunk4KCSH4T3cjs.getTokenSymbol.call(void 0, token, chain);
|
|
2772
|
+
const decimals = _chunk4KCSH4T3cjs.findTokenDecimals.call(void 0, token, chain);
|
|
2569
2773
|
if (symbol !== "Token" || decimals !== void 0) {
|
|
2570
2774
|
return {
|
|
2571
|
-
symbol: symbol !== "Token" ? symbol : _nullishCoalesce(_optionalChain([fallback, 'optionalAccess',
|
|
2572
|
-
decimals: _nullishCoalesce(decimals, () => ( _optionalChain([fallback, 'optionalAccess',
|
|
2775
|
+
symbol: symbol !== "Token" ? symbol : _nullishCoalesce(_optionalChain([fallback, 'optionalAccess', _105 => _105.symbol]), () => ( symbol)),
|
|
2776
|
+
decimals: _nullishCoalesce(decimals, () => ( _optionalChain([fallback, 'optionalAccess', _106 => _106.decimals])))
|
|
2573
2777
|
};
|
|
2574
2778
|
}
|
|
2575
2779
|
}
|
|
2576
2780
|
}
|
|
2577
2781
|
return {
|
|
2578
|
-
symbol: _nullishCoalesce(_optionalChain([fallback, 'optionalAccess',
|
|
2579
|
-
decimals: _optionalChain([fallback, 'optionalAccess',
|
|
2782
|
+
symbol: _nullishCoalesce(_optionalChain([fallback, 'optionalAccess', _107 => _107.symbol]), () => ( "Token")),
|
|
2783
|
+
decimals: _optionalChain([fallback, 'optionalAccess', _108 => _108.decimals])
|
|
2580
2784
|
};
|
|
2581
2785
|
}
|
|
2582
2786
|
function maxFractionDigitsFor(symbol) {
|
|
@@ -2614,13 +2818,13 @@ function priceUsdFor(symbol, prices) {
|
|
|
2614
2818
|
}
|
|
2615
2819
|
function isRecognizedToken(address, chain) {
|
|
2616
2820
|
if (address === void 0 || chain === void 0) return false;
|
|
2617
|
-
if (chain === "solana") return
|
|
2821
|
+
if (chain === "solana") return _chunk4KCSH4T3cjs.getSolanaTokenByMint.call(void 0, address) !== void 0;
|
|
2618
2822
|
if (chain === "hypercore") {
|
|
2619
|
-
return
|
|
2823
|
+
return _chunk4KCSH4T3cjs.HYPERCORE_SOURCE_TOKENS.some(
|
|
2620
2824
|
(t) => t.address.toLowerCase() === address.toLowerCase()
|
|
2621
2825
|
);
|
|
2622
2826
|
}
|
|
2623
|
-
return EVM_ADDRESS_RE.test(address) &&
|
|
2827
|
+
return EVM_ADDRESS_RE.test(address) && _chunk4KCSH4T3cjs.isRegistryTokenOnChain.call(void 0, address, chain);
|
|
2624
2828
|
}
|
|
2625
2829
|
function estimateReceiveAmount(params) {
|
|
2626
2830
|
const {
|
|
@@ -2770,22 +2974,39 @@ var CUSTOM_PRIMARY_VARS = [
|
|
|
2770
2974
|
"--rs-primary-foreground",
|
|
2771
2975
|
"--rs-border-accent"
|
|
2772
2976
|
];
|
|
2977
|
+
var DARK_SCHEME_QUERY = "(prefers-color-scheme: dark)";
|
|
2978
|
+
var NOTHING_TO_STOP = () => {
|
|
2979
|
+
};
|
|
2980
|
+
function resolveThemeMode(mode) {
|
|
2981
|
+
if (mode !== "system") return mode;
|
|
2982
|
+
return _optionalChain([globalThis, 'access', _109 => _109.matchMedia, 'optionalCall', _110 => _110(DARK_SCHEME_QUERY), 'access', _111 => _111.matches]) ? "dark" : "light";
|
|
2983
|
+
}
|
|
2984
|
+
function followSystemAppearance(mode, onChange) {
|
|
2985
|
+
if (mode !== "system") return NOTHING_TO_STOP;
|
|
2986
|
+
const query = _optionalChain([globalThis, 'access', _112 => _112.matchMedia, 'optionalCall', _113 => _113(DARK_SCHEME_QUERY)]);
|
|
2987
|
+
if (!query) return NOTHING_TO_STOP;
|
|
2988
|
+
query.addEventListener("change", onChange);
|
|
2989
|
+
return () => query.removeEventListener("change", onChange);
|
|
2990
|
+
}
|
|
2773
2991
|
function applyTheme(element, theme) {
|
|
2774
|
-
if (!element) return;
|
|
2992
|
+
if (!element) return NOTHING_TO_STOP;
|
|
2775
2993
|
const parent = element.parentElement;
|
|
2776
|
-
const targets = _optionalChain([parent, 'optionalAccess',
|
|
2777
|
-
|
|
2778
|
-
|
|
2779
|
-
|
|
2780
|
-
|
|
2781
|
-
|
|
2782
|
-
|
|
2994
|
+
const targets = _optionalChain([parent, 'optionalAccess', _114 => _114.classList, 'access', _115 => _115.contains, 'call', _116 => _116("rs-modal-content")]) ? [element, parent] : [element];
|
|
2995
|
+
const paintMode = () => {
|
|
2996
|
+
const resolved = resolveThemeMode(_optionalChain([theme, 'optionalAccess', _117 => _117.mode]));
|
|
2997
|
+
for (const t of targets) {
|
|
2998
|
+
if (resolved) t.setAttribute("data-theme", resolved);
|
|
2999
|
+
else t.removeAttribute("data-theme");
|
|
3000
|
+
}
|
|
3001
|
+
};
|
|
3002
|
+
paintMode();
|
|
3003
|
+
if (_optionalChain([theme, 'optionalAccess', _118 => _118.fontColor])) {
|
|
2783
3004
|
setVar(targets, "--rs-foreground", theme.fontColor);
|
|
2784
3005
|
}
|
|
2785
|
-
if (_optionalChain([theme, 'optionalAccess',
|
|
3006
|
+
if (_optionalChain([theme, 'optionalAccess', _119 => _119.iconColor])) {
|
|
2786
3007
|
setVar(targets, "--rs-icon", theme.iconColor);
|
|
2787
3008
|
}
|
|
2788
|
-
if (_optionalChain([theme, 'optionalAccess',
|
|
3009
|
+
if (_optionalChain([theme, 'optionalAccess', _120 => _120.ctaColor])) {
|
|
2789
3010
|
const derived = deriveCustomPrimary(theme.ctaColor);
|
|
2790
3011
|
if (derived) {
|
|
2791
3012
|
setVar(targets, "--rs-primary", derived.base);
|
|
@@ -2810,24 +3031,25 @@ function applyTheme(element, theme) {
|
|
|
2810
3031
|
}
|
|
2811
3032
|
} else {
|
|
2812
3033
|
for (const v of CUSTOM_PRIMARY_VARS) clearVar(targets, v);
|
|
2813
|
-
if (_optionalChain([theme, 'optionalAccess',
|
|
3034
|
+
if (_optionalChain([theme, 'optionalAccess', _121 => _121.ctaHoverColor])) {
|
|
2814
3035
|
setVar(targets, "--rs-primary-hover", theme.ctaHoverColor);
|
|
2815
3036
|
}
|
|
2816
3037
|
}
|
|
2817
|
-
if (_optionalChain([theme, 'optionalAccess',
|
|
3038
|
+
if (_optionalChain([theme, 'optionalAccess', _122 => _122.borderColor])) {
|
|
2818
3039
|
setVar(targets, "--rs-border", theme.borderColor);
|
|
2819
3040
|
setVar(targets, "--rs-border-surface", theme.borderColor);
|
|
2820
3041
|
}
|
|
2821
|
-
if (_optionalChain([theme, 'optionalAccess',
|
|
3042
|
+
if (_optionalChain([theme, 'optionalAccess', _123 => _123.backgroundColor])) {
|
|
2822
3043
|
setVar(targets, "--rs-background", theme.backgroundColor);
|
|
2823
3044
|
}
|
|
2824
|
-
if (_optionalChain([theme, 'optionalAccess',
|
|
3045
|
+
if (_optionalChain([theme, 'optionalAccess', _124 => _124.radius])) {
|
|
2825
3046
|
const scale = RADIUS_SCALE[theme.radius];
|
|
2826
3047
|
setVar(targets, "--rs-radius-sm", scale.sm);
|
|
2827
3048
|
setVar(targets, "--rs-radius-md", scale.md);
|
|
2828
3049
|
setVar(targets, "--rs-radius-lg", scale.lg);
|
|
2829
3050
|
setVar(targets, "--rs-radius", scale.md);
|
|
2830
3051
|
}
|
|
3052
|
+
return followSystemAppearance(_optionalChain([theme, 'optionalAccess', _125 => _125.mode]), paintMode);
|
|
2831
3053
|
}
|
|
2832
3054
|
|
|
2833
3055
|
// src/core/backend-url.ts
|
|
@@ -2920,4 +3142,5 @@ function checkBackendUrl(component, backendUrl) {
|
|
|
2920
3142
|
|
|
2921
3143
|
|
|
2922
3144
|
|
|
2923
|
-
|
|
3145
|
+
|
|
3146
|
+
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.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.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.resolveThemeMode = resolveThemeMode; exports.followSystemAppearance = followSystemAppearance; exports.applyTheme = applyTheme; exports.checkBackendUrl = checkBackendUrl;
|