@rhinestone/deposit-modal 0.0.0-dev-20260727165236 → 0.0.0-dev-20260727172000
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 +18 -0
- package/dist/{DepositModalReown-EI63MROO.cjs → DepositModalReown-2VJFCAUT.cjs} +13 -12
- package/dist/{DepositModalReown-ZU3CPDTC.mjs → DepositModalReown-XIJUAOYR.mjs} +7 -6
- package/dist/{chunk-O35FIERS.cjs → chunk-4ALOTMS6.cjs} +119 -49
- package/dist/{chunk-VXYJ432Q.mjs → chunk-5S7WGG7V.mjs} +122 -52
- package/dist/chunk-62PQAA3X.mjs +6 -0
- package/dist/{chunk-YVI7Q7P7.mjs → chunk-7PLFGGXC.mjs} +921 -1181
- package/dist/chunk-7RZPE5KV.cjs +6 -0
- package/dist/chunk-EGB3NWML.cjs +809 -0
- package/dist/{chunk-YNRJ643P.mjs → chunk-ESWMFZEV.mjs} +22 -17
- package/dist/{chunk-UOO6V5WZ.cjs → chunk-H7TD7XE5.cjs} +83 -82
- package/dist/chunk-KZGITCZT.mjs +809 -0
- package/dist/{chunk-QYYGX36T.cjs → chunk-ONPO2OFC.cjs} +828 -1088
- package/dist/{chunk-GQXT6UL7.mjs → chunk-PGBW524J.mjs} +3 -2
- package/dist/{chunk-CU65HAN5.cjs → chunk-U2SADOVK.cjs} +73 -80
- package/dist/{chunk-L4EOEP42.mjs → chunk-UI3JRDXX.mjs} +10 -9
- package/dist/{chunk-VULYPMCV.cjs → chunk-UIN4SMPX.cjs} +88 -83
- package/dist/{chunk-UKN74GQZ.cjs → chunk-UKS5VK74.cjs} +4 -3
- package/dist/{chunk-WRSITJQ2.mjs → chunk-VZKUD5IN.mjs} +8 -15
- package/dist/{chunk-XBNXKZHQ.cjs → chunk-W3WWC4LD.cjs} +6 -2
- package/dist/{chunk-OMREKQB2.mjs → chunk-YJP274QC.mjs} +5 -1
- package/dist/claim.cjs +6 -5
- package/dist/claim.mjs +5 -4
- package/dist/constants.cjs +4 -2
- package/dist/constants.d.cts +1 -1
- package/dist/constants.d.ts +1 -1
- package/dist/constants.mjs +4 -2
- package/dist/deposit.cjs +8 -7
- package/dist/deposit.mjs +7 -6
- package/dist/index.cjs +10 -9
- package/dist/index.mjs +9 -8
- package/dist/polymarket.cjs +5 -4
- package/dist/polymarket.mjs +2 -1
- package/dist/styles.css +16 -2
- package/dist/withdraw.cjs +6 -5
- package/dist/withdraw.mjs +5 -4
- package/package.json +1 -1
- package/dist/chunk-G5JWMTDR.mjs +0 -802
- package/dist/chunk-YGBHFYTW.cjs +0 -802
package/README.md
CHANGED
|
@@ -8,6 +8,24 @@ React modal for cross-chain deposits and withdrawals via Rhinestone smart accoun
|
|
|
8
8
|
npm install @rhinestone/deposit-modal viem
|
|
9
9
|
```
|
|
10
10
|
|
|
11
|
+
### Content Security Policy
|
|
12
|
+
|
|
13
|
+
Every logo the modal renders — chain, token, exchange, card-network, wallet and
|
|
14
|
+
dapp marks — is served from Rhinestone's public asset CDN. **A host with an
|
|
15
|
+
explicit `img-src` policy must allow it:**
|
|
16
|
+
|
|
17
|
+
```
|
|
18
|
+
img-src 'self' data: https://s3.rhinestone.dev;
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
Omit this and icons render blank — image loads fail silently, so there is no
|
|
22
|
+
console error pointing at the CSP. Hosts without an explicit `img-src` (or with
|
|
23
|
+
`img-src *`) need no change.
|
|
24
|
+
|
|
25
|
+
> Before v0.9 these marks were inlined as `data:` URIs, so `data:` alone was
|
|
26
|
+
> sufficient. They now come from the CDN, which drops ~20 kB (brotli) from the
|
|
27
|
+
> bundle and gives every Rhinestone surface one source of truth.
|
|
28
|
+
|
|
11
29
|
## Example
|
|
12
30
|
|
|
13
31
|
```tsx
|
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
require('./chunk-
|
|
5
|
-
require('./chunk-
|
|
3
|
+
var _chunkONPO2OFCcjs = require('./chunk-ONPO2OFC.cjs');
|
|
4
|
+
require('./chunk-UIN4SMPX.cjs');
|
|
5
|
+
require('./chunk-UKS5VK74.cjs');
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
|
|
9
|
-
var
|
|
9
|
+
var _chunk4ALOTMS6cjs = require('./chunk-4ALOTMS6.cjs');
|
|
10
|
+
require('./chunk-7RZPE5KV.cjs');
|
|
11
|
+
require('./chunk-W3WWC4LD.cjs');
|
|
10
12
|
|
|
11
13
|
|
|
12
14
|
|
|
13
|
-
var
|
|
14
|
-
require('./chunk-XBNXKZHQ.cjs');
|
|
15
|
+
var _chunkEGB3NWMLcjs = require('./chunk-EGB3NWML.cjs');
|
|
15
16
|
|
|
16
17
|
// src/DepositModalReown.tsx
|
|
17
18
|
var _react = require('react');
|
|
@@ -68,7 +69,7 @@ var APPKIT_NETWORK_BY_ID = {
|
|
|
68
69
|
[_networks.katana.id]: _networks.katana,
|
|
69
70
|
[_networks.hyperEvm.id]: _networks.hyperEvm
|
|
70
71
|
};
|
|
71
|
-
var EVM_NETWORKS =
|
|
72
|
+
var EVM_NETWORKS = _chunkEGB3NWMLcjs.SUPPORTED_CHAINS.map((chain) => {
|
|
72
73
|
const network = APPKIT_NETWORK_BY_ID[chain.id];
|
|
73
74
|
if (!network) {
|
|
74
75
|
throw new Error(
|
|
@@ -87,14 +88,14 @@ function buildTransports(rpcUrls) {
|
|
|
87
88
|
const transports = {};
|
|
88
89
|
for (const network of EVM_NETWORKS) {
|
|
89
90
|
const id = Number(network.id);
|
|
90
|
-
transports[id] = _viem.http.call(void 0,
|
|
91
|
+
transports[id] = _viem.http.call(void 0, _chunk4ALOTMS6cjs.rpcUrlFor.call(void 0, rpcUrls, id));
|
|
91
92
|
}
|
|
92
93
|
return transports;
|
|
93
94
|
}
|
|
94
95
|
function getEvmRpcFingerprint(rpcUrls) {
|
|
95
96
|
return EVM_NETWORKS.map((network) => {
|
|
96
97
|
const id = Number(network.id);
|
|
97
|
-
return `${id}=${_nullishCoalesce(
|
|
98
|
+
return `${id}=${_nullishCoalesce(_chunk4ALOTMS6cjs.rpcUrlFor.call(void 0, rpcUrls, id), () => ( ""))}`;
|
|
98
99
|
}).join("|");
|
|
99
100
|
}
|
|
100
101
|
var cachedAdapter = null;
|
|
@@ -188,9 +189,9 @@ function useReownWallet() {
|
|
|
188
189
|
await switchChainAsync({ chainId });
|
|
189
190
|
}
|
|
190
191
|
} catch (err) {
|
|
191
|
-
if (
|
|
192
|
+
if (_chunk4ALOTMS6cjs.isUnsupportedChainSwitchError.call(void 0, err)) {
|
|
192
193
|
throw new Error(
|
|
193
|
-
`Switch to ${
|
|
194
|
+
`Switch to ${_chunkEGB3NWMLcjs.getChainName.call(void 0, chainId)} in your wallet to continue`
|
|
194
195
|
);
|
|
195
196
|
}
|
|
196
197
|
throw err;
|
|
@@ -225,7 +226,7 @@ function DepositModalWithReown(props) {
|
|
|
225
226
|
reown.disconnect();
|
|
226
227
|
}, [reown.disconnect]);
|
|
227
228
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
228
|
-
|
|
229
|
+
_chunkONPO2OFCcjs.DepositModalInner,
|
|
229
230
|
{
|
|
230
231
|
...props,
|
|
231
232
|
reownWallet: reownWithSolana,
|
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
import {
|
|
2
2
|
DepositModalInner
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import "./chunk-
|
|
5
|
-
import "./chunk-
|
|
3
|
+
} from "./chunk-7PLFGGXC.mjs";
|
|
4
|
+
import "./chunk-ESWMFZEV.mjs";
|
|
5
|
+
import "./chunk-PGBW524J.mjs";
|
|
6
6
|
import {
|
|
7
7
|
isUnsupportedChainSwitchError,
|
|
8
8
|
rpcUrlFor
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-5S7WGG7V.mjs";
|
|
10
|
+
import "./chunk-62PQAA3X.mjs";
|
|
11
|
+
import "./chunk-YJP274QC.mjs";
|
|
10
12
|
import {
|
|
11
13
|
SUPPORTED_CHAINS,
|
|
12
14
|
getChainName
|
|
13
|
-
} from "./chunk-
|
|
14
|
-
import "./chunk-OMREKQB2.mjs";
|
|
15
|
+
} from "./chunk-KZGITCZT.mjs";
|
|
15
16
|
|
|
16
17
|
// src/DepositModalReown.tsx
|
|
17
18
|
import { useCallback, useMemo } from "react";
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
2
2
|
|
|
3
|
+
var _chunk7RZPE5KVcjs = require('./chunk-7RZPE5KV.cjs');
|
|
3
4
|
|
|
4
5
|
|
|
5
6
|
|
|
@@ -14,7 +15,9 @@
|
|
|
14
15
|
|
|
15
16
|
|
|
16
17
|
|
|
17
|
-
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
var _chunkEGB3NWMLcjs = require('./chunk-EGB3NWML.cjs');
|
|
18
21
|
|
|
19
22
|
// src/components/ui/Modal.tsx
|
|
20
23
|
|
|
@@ -217,6 +220,39 @@ var CircleArrowOutUpLeftIcon = _lucidereact.CircleArrowOutUpLeft;
|
|
|
217
220
|
var CardIcon = _lucidereact.CreditCard;
|
|
218
221
|
var BankIcon = _lucidereact.Landmark;
|
|
219
222
|
var UnplugIcon = _lucidereact.Unplug;
|
|
223
|
+
function MigrateAssetsIcon() {
|
|
224
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
225
|
+
"svg",
|
|
226
|
+
{
|
|
227
|
+
width: "24",
|
|
228
|
+
height: "24",
|
|
229
|
+
viewBox: "0 0 24 24",
|
|
230
|
+
fill: "none",
|
|
231
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
232
|
+
"aria-hidden": "true",
|
|
233
|
+
children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
234
|
+
"g",
|
|
235
|
+
{
|
|
236
|
+
stroke: "currentColor",
|
|
237
|
+
strokeWidth: "2",
|
|
238
|
+
strokeLinecap: "round",
|
|
239
|
+
strokeLinejoin: "round",
|
|
240
|
+
children: [
|
|
241
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
242
|
+
"path",
|
|
243
|
+
{
|
|
244
|
+
d: "M19 4.344V3C19 2.46957 18.7893 1.96086 18.4142 1.58579C18.0391 1.21071 17.5304 1 17 1H3C2.46957 1 1.96086 1.21071 1.58579 1.58579C1.21071 1.96086 1 2.46957 1 3V17C1 17.5304 1.21071 18.0391 1.58579 18.4142C1.96086 18.7893 2.46957 19 3 19H17C17.5304 19 18.0391 18.7893 18.4142 18.4142C18.7893 18.0391 19 17.5304 19 17V15.656",
|
|
245
|
+
transform: "translate(2 2)"
|
|
246
|
+
}
|
|
247
|
+
),
|
|
248
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "path", { d: "M1 1H12", transform: "translate(9 11)" }),
|
|
249
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "path", { d: "M1 9L5 5L1 1", transform: "translate(16 7)" })
|
|
250
|
+
]
|
|
251
|
+
}
|
|
252
|
+
)
|
|
253
|
+
}
|
|
254
|
+
);
|
|
255
|
+
}
|
|
220
256
|
function AppleIcon() {
|
|
221
257
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
222
258
|
"svg",
|
|
@@ -318,6 +354,50 @@ function BodyHeader({
|
|
|
318
354
|
}
|
|
319
355
|
BodyHeader.displayName = "BodyHeader";
|
|
320
356
|
|
|
357
|
+
// src/components/ui/CdnIcon.tsx
|
|
358
|
+
|
|
359
|
+
|
|
360
|
+
function preconnectIconCdn() {
|
|
361
|
+
if (typeof document === "undefined") return;
|
|
362
|
+
if (document.getElementById("rs-icon-cdn-preconnect")) return;
|
|
363
|
+
const link = document.createElement("link");
|
|
364
|
+
link.id = "rs-icon-cdn-preconnect";
|
|
365
|
+
link.rel = "preconnect";
|
|
366
|
+
link.href = _chunkEGB3NWMLcjs.ICON_CDN;
|
|
367
|
+
link.crossOrigin = "anonymous";
|
|
368
|
+
document.head.appendChild(link);
|
|
369
|
+
}
|
|
370
|
+
preconnectIconCdn();
|
|
371
|
+
function CdnIcon({
|
|
372
|
+
src,
|
|
373
|
+
alt = "",
|
|
374
|
+
className,
|
|
375
|
+
fallback,
|
|
376
|
+
loading = "eager"
|
|
377
|
+
}) {
|
|
378
|
+
const [loadedSrc, setLoadedSrc] = _react.useState.call(void 0, null);
|
|
379
|
+
const [erroredSrc, setErroredSrc] = _react.useState.call(void 0, null);
|
|
380
|
+
if (!src || erroredSrc === src) {
|
|
381
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _jsxruntime.Fragment, { children: fallback });
|
|
382
|
+
}
|
|
383
|
+
const isLoading = loadedSrc !== src;
|
|
384
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
385
|
+
"img",
|
|
386
|
+
{
|
|
387
|
+
src,
|
|
388
|
+
alt,
|
|
389
|
+
className: `rs-cdn-icon ${_nullishCoalesce(className, () => ( ""))}`.trimEnd(),
|
|
390
|
+
loading,
|
|
391
|
+
decoding: "async",
|
|
392
|
+
"data-loading": isLoading ? "" : void 0,
|
|
393
|
+
onLoad: () => setLoadedSrc(src),
|
|
394
|
+
onError: () => setErroredSrc(src)
|
|
395
|
+
},
|
|
396
|
+
src
|
|
397
|
+
);
|
|
398
|
+
}
|
|
399
|
+
CdnIcon.displayName = "CdnIcon";
|
|
400
|
+
|
|
321
401
|
// src/components/ui/PoweredBy.tsx
|
|
322
402
|
|
|
323
403
|
var rhinestoneLogo = /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
@@ -471,37 +551,14 @@ Button.displayName = "Button";
|
|
|
471
551
|
|
|
472
552
|
// src/components/ui/TokenIcon.tsx
|
|
473
553
|
|
|
474
|
-
|
|
475
|
-
function preconnectIconCdn() {
|
|
476
|
-
if (typeof document === "undefined") return;
|
|
477
|
-
if (document.getElementById("rs-icon-cdn-preconnect")) return;
|
|
478
|
-
const link = document.createElement("link");
|
|
479
|
-
link.id = "rs-icon-cdn-preconnect";
|
|
480
|
-
link.rel = "preconnect";
|
|
481
|
-
link.href = "https://s3.rhinestone.dev";
|
|
482
|
-
link.crossOrigin = "anonymous";
|
|
483
|
-
document.head.appendChild(link);
|
|
484
|
-
}
|
|
485
|
-
preconnectIconCdn();
|
|
486
554
|
function TokenIcon({ symbol, className, fallback }) {
|
|
487
|
-
const [loadedSymbol, setLoadedSymbol] = _react.useState.call(void 0, null);
|
|
488
|
-
const [erroredSymbol, setErroredSymbol] = _react.useState.call(void 0, null);
|
|
489
|
-
if (erroredSymbol === symbol) {
|
|
490
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _jsxruntime.Fragment, { children: fallback });
|
|
491
|
-
}
|
|
492
|
-
const loading = loadedSymbol !== symbol;
|
|
493
555
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
494
|
-
|
|
556
|
+
CdnIcon,
|
|
495
557
|
{
|
|
496
|
-
src:
|
|
497
|
-
alt: "",
|
|
558
|
+
src: _chunkEGB3NWMLcjs.tokenIconUrl.call(void 0, symbol),
|
|
498
559
|
className: `rs-token-icon ${_nullishCoalesce(className, () => ( ""))}`.trimEnd(),
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
onLoad: () => setLoadedSymbol(symbol),
|
|
502
|
-
onError: () => setErroredSymbol(symbol)
|
|
503
|
-
},
|
|
504
|
-
symbol
|
|
560
|
+
fallback
|
|
561
|
+
}
|
|
505
562
|
);
|
|
506
563
|
}
|
|
507
564
|
TokenIcon.displayName = "TokenIcon";
|
|
@@ -566,6 +623,16 @@ function debugError(enabled, scope, message, error, data) {
|
|
|
566
623
|
function getAssetId(asset) {
|
|
567
624
|
return `${asset.chainId}:${asset.token.toLowerCase()}`;
|
|
568
625
|
}
|
|
626
|
+
function chainIdsByValue(tokens) {
|
|
627
|
+
const usdByChain = /* @__PURE__ */ new Map();
|
|
628
|
+
for (const token of tokens) {
|
|
629
|
+
if (typeof token.chainId !== "number") continue;
|
|
630
|
+
const usd = Number.isFinite(token.balanceUsd) ? token.balanceUsd : 0;
|
|
631
|
+
if (usd <= 0) continue;
|
|
632
|
+
usdByChain.set(token.chainId, (_nullishCoalesce(usdByChain.get(token.chainId), () => ( 0))) + usd);
|
|
633
|
+
}
|
|
634
|
+
return [...usdByChain.entries()].sort((a, b) => b[1] - a[1]).map(([chainId]) => chainId);
|
|
635
|
+
}
|
|
569
636
|
function isEvmAddress(value) {
|
|
570
637
|
return /^0x[a-fA-F0-9]{40}$/.test(value);
|
|
571
638
|
}
|
|
@@ -607,7 +674,7 @@ function isNativeAsset(asset) {
|
|
|
607
674
|
// src/core/deposit-service.ts
|
|
608
675
|
var SERVICE_HEADERS = {
|
|
609
676
|
"Content-Type": "application/json",
|
|
610
|
-
"x-deposit-modal-version":
|
|
677
|
+
"x-deposit-modal-version": _chunk7RZPE5KVcjs.MODAL_VERSION
|
|
611
678
|
};
|
|
612
679
|
function depositRowToEvent(row) {
|
|
613
680
|
const status = row.status;
|
|
@@ -1022,7 +1089,7 @@ function createDepositService(baseUrl, options) {
|
|
|
1022
1089
|
},
|
|
1023
1090
|
async checkLiquidity(params) {
|
|
1024
1091
|
if (params.destinationChainId === "solana") {
|
|
1025
|
-
const token =
|
|
1092
|
+
const token = _chunkEGB3NWMLcjs.getSolanaTokenByMint.call(void 0, params.destinationToken);
|
|
1026
1093
|
return {
|
|
1027
1094
|
hasLiquidity: true,
|
|
1028
1095
|
symbol: _nullishCoalesce(_optionalChain([token, 'optionalAccess', _26 => _26.symbol]), () => ( "Token")),
|
|
@@ -1079,7 +1146,7 @@ function createDepositService(baseUrl, options) {
|
|
|
1079
1146
|
const body = {
|
|
1080
1147
|
account: params.account,
|
|
1081
1148
|
// HyperCore has its own CAIP-2 namespace — never the eip155 placeholder.
|
|
1082
|
-
sourceChainId: params.sourceChainId === "hypercore" ?
|
|
1149
|
+
sourceChainId: params.sourceChainId === "hypercore" ? _chunkEGB3NWMLcjs.HYPERCORE_MAINNET_CAIP2 : `eip155:${params.sourceChainId}`,
|
|
1083
1150
|
sourceToken: params.sourceToken,
|
|
1084
1151
|
amount: params.amount
|
|
1085
1152
|
};
|
|
@@ -1402,14 +1469,14 @@ function normalizeOrchestratorPortfolio(data) {
|
|
|
1402
1469
|
const unlocked = _nullishCoalesce(_optionalChain([chainBalance, 'access', _33 => _33.balance, 'optionalAccess', _34 => _34.unlocked]), () => ( "0"));
|
|
1403
1470
|
const normalizedName = tokenData.tokenName.trim();
|
|
1404
1471
|
const isNativeSymbol = normalizedName.toUpperCase() === "ETH" || normalizedName.toUpperCase() === "ETHER";
|
|
1405
|
-
const tokenAddress = _nullishCoalesce(_nullishCoalesce(chainBalance.tokenAddress, () => ( extractTokenAddress(tokenData, chainBalance.chainId))), () => (
|
|
1406
|
-
const resolvedTokenAddress = isNativeSymbol ?
|
|
1472
|
+
const tokenAddress = _nullishCoalesce(_nullishCoalesce(chainBalance.tokenAddress, () => ( extractTokenAddress(tokenData, chainBalance.chainId))), () => ( _chunkEGB3NWMLcjs.getTokenAddress.call(void 0, tokenData.tokenName, chainBalance.chainId)));
|
|
1473
|
+
const resolvedTokenAddress = isNativeSymbol ? _chunkEGB3NWMLcjs.NATIVE_TOKEN_ADDRESS : tokenAddress;
|
|
1407
1474
|
if (!resolvedTokenAddress) {
|
|
1408
1475
|
continue;
|
|
1409
1476
|
}
|
|
1410
|
-
const registrySymbol =
|
|
1477
|
+
const registrySymbol = _chunkEGB3NWMLcjs.getTokenSymbol.call(void 0, resolvedTokenAddress, chainBalance.chainId);
|
|
1411
1478
|
const symbol = registrySymbol !== "Token" ? registrySymbol : normalizedName || "Token";
|
|
1412
|
-
const decimals = registrySymbol !== "Token" ?
|
|
1479
|
+
const decimals = registrySymbol !== "Token" ? _chunkEGB3NWMLcjs.getTokenDecimalsByAddress.call(void 0, resolvedTokenAddress, chainBalance.chainId) : _nullishCoalesce(tokenData.tokenDecimals, () => ( 18));
|
|
1413
1480
|
tokens.push({
|
|
1414
1481
|
chainId: chainBalance.chainId,
|
|
1415
1482
|
address: resolvedTokenAddress,
|
|
@@ -1429,13 +1496,13 @@ function normalizeOrchestratorPortfolio(data) {
|
|
|
1429
1496
|
function normalizeDirectToken(token) {
|
|
1430
1497
|
const rawChainId = _nullishCoalesce(extractNumber(token, "chainId"), () => ( extractNumber(token.chain, "id")));
|
|
1431
1498
|
const rawChainString = _nullishCoalesce(extractString(token, "chainId"), () => ( extractString(token.chain, "id")));
|
|
1432
|
-
const chainId = _nullishCoalesce(rawChainId, () => ( (rawChainString ?
|
|
1499
|
+
const chainId = _nullishCoalesce(rawChainId, () => ( (rawChainString ? _chunkEGB3NWMLcjs.isSolanaCaip2.call(void 0, rawChainString) || rawChainString.toLowerCase() === "solana" ? "solana" : (
|
|
1433
1500
|
// HyperCore (`hypercore:mainnet`) is a non-EVM source; keep its USDC
|
|
1434
1501
|
// instead of dropping it as an unparseable chain string.
|
|
1435
|
-
|
|
1502
|
+
_chunkEGB3NWMLcjs.isHyperCoreCaip2.call(void 0, rawChainString) || rawChainString.toLowerCase() === "hypercore" ? "hypercore" : _chunkEGB3NWMLcjs.parseEvmChainId.call(void 0, rawChainString)
|
|
1436
1503
|
) : null)));
|
|
1437
1504
|
if (chainId === null) return null;
|
|
1438
|
-
const registryChainId = typeof chainId === "number" ? chainId : chainId === "hypercore" ?
|
|
1505
|
+
const registryChainId = typeof chainId === "number" ? chainId : chainId === "hypercore" ? _chunkEGB3NWMLcjs.HYPERCORE_CHAIN_ID : void 0;
|
|
1439
1506
|
const symbol = _nullishCoalesce(_nullishCoalesce(_nullishCoalesce(extractString(token, "symbol"), () => ( extractString(token, "tokenSymbol"))), () => ( extractString(token, "tokenName"))), () => ( extractString(token, "name")));
|
|
1440
1507
|
if (!symbol) return null;
|
|
1441
1508
|
const balanceValue = _nullishCoalesce(_nullishCoalesce(_nullishCoalesce(_nullishCoalesce(_nullishCoalesce(_nullishCoalesce(_nullishCoalesce(extractString(token, "balance"), () => ( extractString(token, "amount"))), () => ( extractString(token, "value"))), () => ( extractString(token, "rawBalance"))), () => ( _optionalChain([extractNumber, 'call', _35 => _35(token, "balance"), 'optionalAccess', _36 => _36.toString, 'call', _37 => _37()]))), () => ( _optionalChain([extractNumber, 'call', _38 => _38(token, "amount"), 'optionalAccess', _39 => _39.toString, 'call', _40 => _40()]))), () => ( _optionalChain([extractNumber, 'call', _41 => _41(token, "value"), 'optionalAccess', _42 => _42.toString, 'call', _43 => _43()]))), () => ( _optionalChain([extractNumber, 'call', _44 => _44(token, "rawBalance"), 'optionalAccess', _45 => _45.toString, 'call', _46 => _46()])));
|
|
@@ -1443,14 +1510,14 @@ function normalizeDirectToken(token) {
|
|
|
1443
1510
|
const address = _nullishCoalesce(_nullishCoalesce(_nullishCoalesce(extractString(token, "address"), () => ( extractString(token, "tokenAddress"))), () => ( extractString(
|
|
1444
1511
|
token.token,
|
|
1445
1512
|
"address"
|
|
1446
|
-
))), () => ( (registryChainId !== void 0 ?
|
|
1513
|
+
))), () => ( (registryChainId !== void 0 ? _chunkEGB3NWMLcjs.getTokenAddress.call(void 0, symbol, registryChainId) : void 0)));
|
|
1447
1514
|
if (!address) return null;
|
|
1448
1515
|
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));
|
|
1449
1516
|
const isSolanaToken = chainId === "solana";
|
|
1450
|
-
const registrySymbol = isSolanaToken ? "Token" :
|
|
1517
|
+
const registrySymbol = isSolanaToken ? "Token" : _chunkEGB3NWMLcjs.getTokenSymbol.call(void 0, address, registryChainId);
|
|
1451
1518
|
const resolvedSymbol = isSolanaToken ? symbol : registrySymbol !== "Token" ? registrySymbol : symbol;
|
|
1452
1519
|
const backendDecimals = _nullishCoalesce(extractNumber(token, "decimals"), () => ( extractNumber(token, "tokenDecimals")));
|
|
1453
|
-
const resolvedDecimals = !isSolanaToken && registrySymbol !== "Token" ?
|
|
1520
|
+
const resolvedDecimals = !isSolanaToken && registrySymbol !== "Token" ? _chunkEGB3NWMLcjs.getTokenDecimalsByAddress.call(void 0, address, registryChainId) : _nullishCoalesce(backendDecimals, () => ( 18));
|
|
1454
1521
|
return {
|
|
1455
1522
|
chainId,
|
|
1456
1523
|
address,
|
|
@@ -1583,18 +1650,18 @@ var EVM_ADDRESS_RE = /^0x[a-fA-F0-9]{40}$/;
|
|
|
1583
1650
|
function resolveTokenDisplay(token, chain, fallback) {
|
|
1584
1651
|
if (token !== void 0) {
|
|
1585
1652
|
if (chain === "solana") {
|
|
1586
|
-
const solanaToken =
|
|
1653
|
+
const solanaToken = _chunkEGB3NWMLcjs.getSolanaTokenByMint.call(void 0, token);
|
|
1587
1654
|
if (solanaToken) {
|
|
1588
1655
|
return { symbol: solanaToken.symbol, decimals: solanaToken.decimals };
|
|
1589
1656
|
}
|
|
1590
1657
|
} else if (chain === "hypercore") {
|
|
1591
|
-
const t =
|
|
1658
|
+
const t = _chunkEGB3NWMLcjs.HYPERCORE_SOURCE_TOKENS.find(
|
|
1592
1659
|
(x) => x.address.toLowerCase() === token.toLowerCase()
|
|
1593
1660
|
);
|
|
1594
1661
|
if (t) return { symbol: t.symbol, decimals: t.decimals };
|
|
1595
1662
|
} else if (EVM_ADDRESS_RE.test(token)) {
|
|
1596
|
-
const symbol =
|
|
1597
|
-
const decimals =
|
|
1663
|
+
const symbol = _chunkEGB3NWMLcjs.getTokenSymbol.call(void 0, token, chain);
|
|
1664
|
+
const decimals = _chunkEGB3NWMLcjs.findTokenDecimals.call(void 0, token, chain);
|
|
1598
1665
|
if (symbol !== "Token" || decimals !== void 0) {
|
|
1599
1666
|
return {
|
|
1600
1667
|
symbol: symbol !== "Token" ? symbol : _nullishCoalesce(_optionalChain([fallback, 'optionalAccess', _54 => _54.symbol]), () => ( symbol)),
|
|
@@ -1643,13 +1710,13 @@ function priceUsdFor(symbol, prices) {
|
|
|
1643
1710
|
}
|
|
1644
1711
|
function isRecognizedToken(address, chain) {
|
|
1645
1712
|
if (address === void 0 || chain === void 0) return false;
|
|
1646
|
-
if (chain === "solana") return
|
|
1713
|
+
if (chain === "solana") return _chunkEGB3NWMLcjs.getSolanaTokenByMint.call(void 0, address) !== void 0;
|
|
1647
1714
|
if (chain === "hypercore") {
|
|
1648
|
-
return
|
|
1715
|
+
return _chunkEGB3NWMLcjs.HYPERCORE_SOURCE_TOKENS.some(
|
|
1649
1716
|
(t) => t.address.toLowerCase() === address.toLowerCase()
|
|
1650
1717
|
);
|
|
1651
1718
|
}
|
|
1652
|
-
return EVM_ADDRESS_RE.test(address) &&
|
|
1719
|
+
return EVM_ADDRESS_RE.test(address) && _chunkEGB3NWMLcjs.isRegistryTokenOnChain.call(void 0, address, chain);
|
|
1653
1720
|
}
|
|
1654
1721
|
function estimateReceiveAmount(params) {
|
|
1655
1722
|
const {
|
|
@@ -1935,4 +2002,7 @@ function applyTheme(element, theme) {
|
|
|
1935
2002
|
|
|
1936
2003
|
|
|
1937
2004
|
|
|
1938
|
-
|
|
2005
|
+
|
|
2006
|
+
|
|
2007
|
+
|
|
2008
|
+
exports.Modal = Modal; exports.WalletIcon = WalletIcon; exports.ExternalLinkIcon = ExternalLinkIcon; exports.CheckIcon = CheckIcon; exports.TransferCryptoIcon = TransferCryptoIcon; exports.ChevronRightIcon = ChevronRightIcon; exports.ChevronLeftIcon = ChevronLeftIcon; exports.ChevronDownIcon = ChevronDownIcon; exports.CloseIcon = CloseIcon; exports.HandCoinsIcon = HandCoinsIcon; exports.CoinsIcon = CoinsIcon; exports.HistoryIcon = HistoryIcon; exports.InfoIcon = InfoIcon; exports.CopyIcon = CopyIcon; exports.ArrowUpRightIcon = ArrowUpRightIcon; exports.AlertTriangleIcon = AlertTriangleIcon; exports.PercentIcon = PercentIcon; exports.ClockIcon = ClockIcon; exports.PlusCircleIcon = PlusCircleIcon; exports.CircleArrowOutUpLeftIcon = CircleArrowOutUpLeftIcon; exports.CardIcon = CardIcon; exports.BankIcon = BankIcon; exports.UnplugIcon = UnplugIcon; exports.MigrateAssetsIcon = MigrateAssetsIcon; exports.AppleIcon = AppleIcon; exports.Callout = Callout; exports.BodyHeader = BodyHeader; exports.CdnIcon = CdnIcon; exports.PoweredBy = PoweredBy; exports.Spinner = Spinner; exports.useLatestRef = useLatestRef; exports.Button = Button; exports.TokenIcon = TokenIcon; exports.debugLog = debugLog; exports.debugError = debugError; exports.getAssetId = getAssetId; exports.chainIdsByValue = chainIdsByValue; exports.portfolioToAssets = portfolioToAssets; exports.isNativeAsset = isNativeAsset; exports.createDepositService = createDepositService; 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.rpcUrlFor = rpcUrlFor; exports.RpcUrlsProvider = RpcUrlsProvider; exports.useRpcUrls = useRpcUrls; exports.useStableRpcUrls = useStableRpcUrls; exports.applyTheme = applyTheme;
|