@rhinestone/deposit-modal 0.2.3 → 0.2.5-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{DepositModalReown-SJHEU6RQ.mjs → DepositModalReown-GIODYNOK.mjs} +5 -3
- package/dist/{DepositModalReown-QPJ5TT57.cjs → DepositModalReown-SVVA3OZ6.cjs} +6 -4
- package/dist/{WithdrawModalReown-RUJZCQ4C.mjs → WithdrawModalReown-HTEB4XGU.mjs} +4 -3
- package/dist/{WithdrawModalReown-KGKKBTC7.cjs → WithdrawModalReown-VNTKGALT.cjs} +5 -4
- package/dist/{chunk-5EU7N73M.cjs → chunk-4S262VLP.cjs} +83 -367
- package/dist/{chunk-TYJEZX6S.cjs → chunk-AHQY2O3U.cjs} +595 -323
- package/dist/{chunk-JRNGXHWQ.mjs → chunk-DUGDAMAF.mjs} +135 -133
- package/dist/chunk-J2SWZSXL.mjs +295 -0
- package/dist/{chunk-T2KOQH57.cjs → chunk-KE6CJVOV.cjs} +109 -107
- package/dist/chunk-LHOHM67Z.mjs +234 -0
- package/dist/{chunk-MUWVDVY4.cjs → chunk-R2HP743T.cjs} +14 -1
- package/dist/{chunk-DGT2DZXN.mjs → chunk-RQ2VCKLS.mjs} +452 -180
- package/dist/{chunk-MKO5TNVQ.mjs → chunk-WA4RA4HB.mjs} +15 -299
- package/dist/{chunk-SDZKKUCJ.mjs → chunk-WHW3ZMOT.mjs} +14 -1
- package/dist/chunk-YKGL66EF.cjs +295 -0
- package/dist/chunk-ZHLQMSQM.cjs +234 -0
- package/dist/constants.cjs +2 -2
- package/dist/constants.mjs +1 -1
- package/dist/deposit.cjs +6 -4
- package/dist/deposit.d.cts +3 -3
- package/dist/deposit.d.ts +3 -3
- package/dist/deposit.mjs +5 -3
- package/dist/index.cjs +7 -5
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.mjs +6 -4
- package/dist/reown.cjs +7 -5
- package/dist/reown.d.cts +2 -2
- package/dist/reown.d.ts +2 -2
- package/dist/reown.mjs +6 -4
- package/dist/safe-CB7TvRCc.d.cts +62 -0
- package/dist/safe-CB7TvRCc.d.ts +62 -0
- package/dist/safe.cjs +22 -1
- package/dist/safe.d.cts +11 -59
- package/dist/safe.d.ts +11 -59
- package/dist/safe.mjs +22 -0
- package/dist/{types-DGQzvl6v.d.ts → types-CeFbJ-MW.d.ts} +8 -1
- package/dist/{types-DJ1fzNC7.d.cts → types-D0NawmZ8.d.cts} +8 -1
- package/dist/withdraw.cjs +5 -4
- package/dist/withdraw.d.cts +3 -3
- package/dist/withdraw.d.ts +3 -3
- package/dist/withdraw.mjs +4 -3
- package/package.json +1 -1
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
|
|
5
5
|
|
|
6
|
+
var _chunkZHLQMSQMcjs = require('./chunk-ZHLQMSQM.cjs');
|
|
6
7
|
|
|
7
8
|
|
|
8
9
|
|
|
@@ -28,12 +29,12 @@
|
|
|
28
29
|
|
|
29
30
|
|
|
30
31
|
|
|
31
|
-
var _chunkT2KOQH57cjs = require('./chunk-T2KOQH57.cjs');
|
|
32
32
|
|
|
33
33
|
|
|
34
34
|
|
|
35
35
|
|
|
36
36
|
|
|
37
|
+
var _chunkKE6CJVOVcjs = require('./chunk-KE6CJVOV.cjs');
|
|
37
38
|
|
|
38
39
|
|
|
39
40
|
|
|
@@ -47,7 +48,12 @@ var _chunkT2KOQH57cjs = require('./chunk-T2KOQH57.cjs');
|
|
|
47
48
|
|
|
48
49
|
|
|
49
50
|
|
|
50
|
-
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
var _chunkR2HP743Tcjs = require('./chunk-R2HP743T.cjs');
|
|
51
57
|
|
|
52
58
|
// src/DepositModal.tsx
|
|
53
59
|
|
|
@@ -68,15 +74,15 @@ var _viem = require('viem');
|
|
|
68
74
|
|
|
69
75
|
var _jsxruntime = require('react/jsx-runtime');
|
|
70
76
|
async function resolveSessionOwner(eoaAddress) {
|
|
71
|
-
const localOwner =
|
|
77
|
+
const localOwner = _chunkKE6CJVOVcjs.loadSessionOwnerFromStorage.call(void 0, eoaAddress);
|
|
72
78
|
if (localOwner) {
|
|
73
79
|
return {
|
|
74
|
-
account:
|
|
80
|
+
account: _chunkKE6CJVOVcjs.accountFromPrivateKey.call(void 0, localOwner.privateKey),
|
|
75
81
|
address: localOwner.address
|
|
76
82
|
};
|
|
77
83
|
}
|
|
78
|
-
const created =
|
|
79
|
-
|
|
84
|
+
const created = _chunkKE6CJVOVcjs.createSessionOwnerKey.call(void 0, );
|
|
85
|
+
_chunkKE6CJVOVcjs.saveSessionOwnerToStorage.call(void 0, eoaAddress, created.privateKey, created.address);
|
|
80
86
|
return {
|
|
81
87
|
account: created.account,
|
|
82
88
|
address: created.address
|
|
@@ -115,7 +121,7 @@ function SetupStep({
|
|
|
115
121
|
const setup = await service.setupAccount({
|
|
116
122
|
ownerAddress: address,
|
|
117
123
|
sessionOwnerAddress: sessionOwner.address,
|
|
118
|
-
targetChain:
|
|
124
|
+
targetChain: _chunkKE6CJVOVcjs.toEvmCaip2.call(void 0, targetChain),
|
|
119
125
|
targetToken,
|
|
120
126
|
recipient,
|
|
121
127
|
postBridgeActions,
|
|
@@ -149,7 +155,7 @@ function SetupStep({
|
|
|
149
155
|
primaryType: typedData.primaryType,
|
|
150
156
|
message: typedData.message
|
|
151
157
|
});
|
|
152
|
-
const sessionDetails =
|
|
158
|
+
const sessionDetails = _chunkKE6CJVOVcjs.buildSessionDetails.call(void 0, setup.sessionDetailsUnsigned, signature);
|
|
153
159
|
setState({ type: "registering" });
|
|
154
160
|
const registerResult = await service.registerAccount({
|
|
155
161
|
address: smartAccount,
|
|
@@ -161,7 +167,7 @@ function SetupStep({
|
|
|
161
167
|
eoaAddress: address,
|
|
162
168
|
sessionOwner: sessionOwner.address,
|
|
163
169
|
target: {
|
|
164
|
-
chain:
|
|
170
|
+
chain: _chunkKE6CJVOVcjs.toEvmCaip2.call(void 0, targetChain),
|
|
165
171
|
token: targetToken,
|
|
166
172
|
...recipient && { recipient },
|
|
167
173
|
..._optionalChain([postBridgeActions, 'optionalAccess', _2 => _2.length]) && { postBridgeActions },
|
|
@@ -230,7 +236,7 @@ function SetupStep({
|
|
|
230
236
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-step", children: [
|
|
231
237
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-loading-state", children: [
|
|
232
238
|
isLoading && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
233
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
239
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkKE6CJVOVcjs.Spinner, { className: "rs-spinner--lg rs-text-accent" }),
|
|
234
240
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-loading-text", children: [
|
|
235
241
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-loading-title", children: renderStateMessage() }),
|
|
236
242
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-loading-subtitle", children: "This may take a moment" })
|
|
@@ -267,7 +273,7 @@ function SetupStep({
|
|
|
267
273
|
] })
|
|
268
274
|
] })
|
|
269
275
|
] }),
|
|
270
|
-
isError && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-step-footer", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
276
|
+
isError && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-step-footer", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkKE6CJVOVcjs.Button, { onClick: handleRetry, variant: "default", fullWidth: true, children: "Try Again" }) })
|
|
271
277
|
] });
|
|
272
278
|
}
|
|
273
279
|
|
|
@@ -293,7 +299,7 @@ function AssetSelectStep({
|
|
|
293
299
|
const [error, setError] = _react.useState.call(void 0, null);
|
|
294
300
|
const defaultAssetId = _react.useMemo.call(void 0, () => {
|
|
295
301
|
if (!defaultSourceChain || !defaultSourceToken) return null;
|
|
296
|
-
return
|
|
302
|
+
return _chunkKE6CJVOVcjs.getAssetId.call(void 0, {
|
|
297
303
|
chainId: defaultSourceChain,
|
|
298
304
|
token: defaultSourceToken
|
|
299
305
|
});
|
|
@@ -310,10 +316,10 @@ function AssetSelectStep({
|
|
|
310
316
|
try {
|
|
311
317
|
const portfolio = await service.fetchPortfolio(address);
|
|
312
318
|
if (!active) return;
|
|
313
|
-
const portfolioAssets =
|
|
319
|
+
const portfolioAssets = _chunkKE6CJVOVcjs.portfolioToAssets.call(void 0, portfolio.tokens);
|
|
314
320
|
setAssets(portfolioAssets);
|
|
315
321
|
const hasNative = portfolioAssets.some(
|
|
316
|
-
(asset) => asset.token.toLowerCase() ===
|
|
322
|
+
(asset) => asset.token.toLowerCase() === _chunkR2HP743Tcjs.NATIVE_TOKEN_ADDRESS
|
|
317
323
|
);
|
|
318
324
|
if (!hasNative) {
|
|
319
325
|
const nativeAssets = await fetchNativeAssets(
|
|
@@ -391,7 +397,7 @@ function AssetSelectStep({
|
|
|
391
397
|
const raw = _viem.formatUnits.call(void 0, BigInt(asset.balance), asset.decimals);
|
|
392
398
|
const numeric = Number(raw);
|
|
393
399
|
if (!Number.isFinite(numeric)) return raw;
|
|
394
|
-
return
|
|
400
|
+
return _chunkKE6CJVOVcjs.tokenFormatter.format(numeric);
|
|
395
401
|
} catch (e3) {
|
|
396
402
|
return asset.balance;
|
|
397
403
|
}
|
|
@@ -405,7 +411,7 @@ function AssetSelectStep({
|
|
|
405
411
|
style: { paddingTop: 4, overflow: "auto", maxHeight: 340 },
|
|
406
412
|
children: [
|
|
407
413
|
loading && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-loading-state", style: { padding: "40px 12px" }, children: [
|
|
408
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
414
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkKE6CJVOVcjs.Spinner, { className: "rs-text-tertiary" }),
|
|
409
415
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-text-sm rs-text-tertiary", children: "Loading balances" })
|
|
410
416
|
] }),
|
|
411
417
|
error && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-alert rs-alert--error", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-alert-text", children: error }) }),
|
|
@@ -447,9 +453,9 @@ function AssetSelectStep({
|
|
|
447
453
|
!loading && !error && rows.length > 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-asset-list", children: rows.map((asset) => {
|
|
448
454
|
const isSelected = selectedAssetId === asset.id;
|
|
449
455
|
const tokenAmount = formatBalance(asset);
|
|
450
|
-
const badge =
|
|
451
|
-
const tokenIcon =
|
|
452
|
-
const chainIcon =
|
|
456
|
+
const badge = _chunkR2HP743Tcjs.getChainBadge.call(void 0, asset.chainId);
|
|
457
|
+
const tokenIcon = _chunkR2HP743Tcjs.getTokenIcon.call(void 0, asset.symbol);
|
|
458
|
+
const chainIcon = _chunkR2HP743Tcjs.getChainIcon.call(void 0, asset.chainId);
|
|
453
459
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
454
460
|
"button",
|
|
455
461
|
{
|
|
@@ -473,7 +479,7 @@ function AssetSelectStep({
|
|
|
473
479
|
"img",
|
|
474
480
|
{
|
|
475
481
|
src: chainIcon,
|
|
476
|
-
alt:
|
|
482
|
+
alt: _chunkR2HP743Tcjs.getChainName.call(void 0, asset.chainId),
|
|
477
483
|
className: "rs-asset-chain-badge"
|
|
478
484
|
}
|
|
479
485
|
) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
@@ -494,7 +500,7 @@ function AssetSelectStep({
|
|
|
494
500
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "rs-asset-chain", children: [
|
|
495
501
|
" ",
|
|
496
502
|
"on ",
|
|
497
|
-
|
|
503
|
+
_chunkR2HP743Tcjs.getChainName.call(void 0, asset.chainId)
|
|
498
504
|
] })
|
|
499
505
|
] }),
|
|
500
506
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-asset-balance-small", children: [
|
|
@@ -504,7 +510,7 @@ function AssetSelectStep({
|
|
|
504
510
|
] })
|
|
505
511
|
] })
|
|
506
512
|
] }),
|
|
507
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-asset-balance", children: asset.balanceUsd !== void 0 && asset.balanceUsd > 0 ?
|
|
513
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-asset-balance", children: asset.balanceUsd !== void 0 && asset.balanceUsd > 0 ? _chunkKE6CJVOVcjs.currencyFormatter.format(asset.balanceUsd) : tokenAmount !== "--" ? `${tokenAmount} ${asset.symbol}` : "--" })
|
|
508
514
|
]
|
|
509
515
|
},
|
|
510
516
|
asset.id
|
|
@@ -514,7 +520,7 @@ function AssetSelectStep({
|
|
|
514
520
|
}
|
|
515
521
|
),
|
|
516
522
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-step-footer", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
517
|
-
|
|
523
|
+
_chunkKE6CJVOVcjs.Button,
|
|
518
524
|
{
|
|
519
525
|
onClick: () => selectedAsset && onContinue(selectedAsset),
|
|
520
526
|
disabled: !selectedAsset,
|
|
@@ -522,17 +528,17 @@ function AssetSelectStep({
|
|
|
522
528
|
children: "Continue"
|
|
523
529
|
}
|
|
524
530
|
) }),
|
|
525
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
531
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkKE6CJVOVcjs.PoweredBy, {})
|
|
526
532
|
] });
|
|
527
533
|
}
|
|
528
534
|
async function fetchNativeAssets(address, publicClient, existing) {
|
|
529
535
|
const existingIds = new Set(existing.map((asset) => asset.id));
|
|
530
536
|
const connectedChainId = _optionalChain([publicClient, 'access', _12 => _12.chain, 'optionalAccess', _13 => _13.id]);
|
|
531
537
|
if (!connectedChainId) return [];
|
|
532
|
-
if (!
|
|
533
|
-
const id =
|
|
538
|
+
if (!_chunkR2HP743Tcjs.SOURCE_CHAINS.some((chain) => chain.id === connectedChainId)) return [];
|
|
539
|
+
const id = _chunkKE6CJVOVcjs.getAssetId.call(void 0, {
|
|
534
540
|
chainId: connectedChainId,
|
|
535
|
-
token:
|
|
541
|
+
token: _chunkR2HP743Tcjs.NATIVE_TOKEN_ADDRESS
|
|
536
542
|
});
|
|
537
543
|
if (existingIds.has(id)) return [];
|
|
538
544
|
try {
|
|
@@ -541,7 +547,7 @@ async function fetchNativeAssets(address, publicClient, existing) {
|
|
|
541
547
|
{
|
|
542
548
|
id,
|
|
543
549
|
chainId: connectedChainId,
|
|
544
|
-
token:
|
|
550
|
+
token: _chunkR2HP743Tcjs.NATIVE_TOKEN_ADDRESS,
|
|
545
551
|
symbol: "ETH",
|
|
546
552
|
name: "Ethereum",
|
|
547
553
|
decimals: 18,
|
|
@@ -594,8 +600,8 @@ function AmountStep({
|
|
|
594
600
|
const chainMismatch = Boolean(
|
|
595
601
|
_optionalChain([walletClient, 'optionalAccess', _14 => _14.chain, 'optionalAccess', _15 => _15.id]) && walletClient.chain.id !== asset.chainId
|
|
596
602
|
);
|
|
597
|
-
const targetSymbol =
|
|
598
|
-
const isSourceStablecoin =
|
|
603
|
+
const targetSymbol = _chunkR2HP743Tcjs.getTokenSymbol.call(void 0, targetToken, targetChain);
|
|
604
|
+
const isSourceStablecoin = _chunkR2HP743Tcjs.isStablecoinSymbol.call(void 0, asset.symbol);
|
|
599
605
|
const tokenPriceUsd = _react.useMemo.call(void 0, () => {
|
|
600
606
|
if (tokenPriceUsdOverride !== void 0 && tokenPriceUsdOverride > 0)
|
|
601
607
|
return tokenPriceUsdOverride;
|
|
@@ -619,7 +625,7 @@ function AmountStep({
|
|
|
619
625
|
const balanceTarget = _nullishCoalesce(balanceAddress, () => ( address));
|
|
620
626
|
if (!balanceTarget || !publicClient) return;
|
|
621
627
|
try {
|
|
622
|
-
const bal =
|
|
628
|
+
const bal = _chunkKE6CJVOVcjs.isNativeAsset.call(void 0, asset) ? await publicClient.getBalance({ address: balanceTarget }) : await publicClient.readContract({
|
|
623
629
|
address: asset.token,
|
|
624
630
|
abi: _viem.erc20Abi,
|
|
625
631
|
functionName: "balanceOf",
|
|
@@ -645,7 +651,7 @@ function AmountStep({
|
|
|
645
651
|
setIsSwitching(true);
|
|
646
652
|
switchChain(asset.chainId).catch((err) => {
|
|
647
653
|
const raw = err instanceof Error ? err.message : "Failed to switch chain";
|
|
648
|
-
setError(
|
|
654
|
+
setError(_chunkKE6CJVOVcjs.formatUserError.call(void 0, raw));
|
|
649
655
|
}).finally(() => {
|
|
650
656
|
setIsSwitching(false);
|
|
651
657
|
});
|
|
@@ -681,7 +687,7 @@ function AmountStep({
|
|
|
681
687
|
const raw = _viem.formatUnits.call(void 0, balance, asset.decimals);
|
|
682
688
|
const numeric = Number(raw);
|
|
683
689
|
if (!Number.isFinite(numeric)) return raw;
|
|
684
|
-
return
|
|
690
|
+
return _chunkKE6CJVOVcjs.tokenFormatter.format(numeric);
|
|
685
691
|
} catch (e8) {
|
|
686
692
|
return "...";
|
|
687
693
|
}
|
|
@@ -725,7 +731,7 @@ function AmountStep({
|
|
|
725
731
|
const usdValue = numericAmount;
|
|
726
732
|
if (_optionalChain([uiConfig, 'optionalAccess', _18 => _18.maxDepositUsd]) && usdValue > uiConfig.maxDepositUsd) {
|
|
727
733
|
setError(
|
|
728
|
-
`Maximum deposit is ${
|
|
734
|
+
`Maximum deposit is ${_chunkKE6CJVOVcjs.currencyFormatter.format(uiConfig.maxDepositUsd)}`
|
|
729
735
|
);
|
|
730
736
|
return;
|
|
731
737
|
}
|
|
@@ -754,7 +760,7 @@ function AmountStep({
|
|
|
754
760
|
try {
|
|
755
761
|
const liquidity = await service.checkLiquidity({
|
|
756
762
|
sourceChainId: asset.chainId,
|
|
757
|
-
sourceToken: asset.token,
|
|
763
|
+
sourceToken: _nullishCoalesce(asset.depositToken, () => ( asset.token)),
|
|
758
764
|
destinationChainId: targetChain,
|
|
759
765
|
destinationToken: targetToken,
|
|
760
766
|
amount: amountInUnits.toString()
|
|
@@ -807,7 +813,7 @@ function AmountStep({
|
|
|
807
813
|
hasPricing && balanceUsd !== null && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { style: { color: "var(--rs-muted-foreground)" }, children: [
|
|
808
814
|
" ",
|
|
809
815
|
"(",
|
|
810
|
-
|
|
816
|
+
_chunkKE6CJVOVcjs.currencyFormatter.format(balanceUsd),
|
|
811
817
|
")"
|
|
812
818
|
] })
|
|
813
819
|
] }) })
|
|
@@ -821,26 +827,26 @@ function AmountStep({
|
|
|
821
827
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-flow-pill-label", children: "You send" }),
|
|
822
828
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-flow-pill-token", children: [
|
|
823
829
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-flow-pill-token-icon-wrapper", children: [
|
|
824
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-flow-pill-token-icon", children:
|
|
830
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-flow-pill-token-icon", children: _chunkR2HP743Tcjs.getTokenIcon.call(void 0, asset.symbol) ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
825
831
|
"img",
|
|
826
832
|
{
|
|
827
|
-
src:
|
|
833
|
+
src: _chunkR2HP743Tcjs.getTokenIcon.call(void 0, asset.symbol),
|
|
828
834
|
alt: asset.symbol
|
|
829
835
|
}
|
|
830
836
|
) : asset.symbol.slice(0, 2) }),
|
|
831
837
|
(() => {
|
|
832
|
-
const chainIcon =
|
|
838
|
+
const chainIcon = _chunkR2HP743Tcjs.getChainIcon.call(void 0, asset.chainId);
|
|
833
839
|
if (chainIcon) {
|
|
834
840
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
835
841
|
"img",
|
|
836
842
|
{
|
|
837
843
|
src: chainIcon,
|
|
838
|
-
alt:
|
|
844
|
+
alt: _chunkR2HP743Tcjs.getChainName.call(void 0, asset.chainId),
|
|
839
845
|
className: "rs-flow-pill-chain-badge"
|
|
840
846
|
}
|
|
841
847
|
);
|
|
842
848
|
}
|
|
843
|
-
const badge =
|
|
849
|
+
const badge = _chunkR2HP743Tcjs.getChainBadge.call(void 0, asset.chainId);
|
|
844
850
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
845
851
|
"div",
|
|
846
852
|
{
|
|
@@ -878,26 +884,26 @@ function AmountStep({
|
|
|
878
884
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-flow-pill-label", children: "You receive" }),
|
|
879
885
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-flow-pill-token", children: [
|
|
880
886
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-flow-pill-token-icon-wrapper", children: [
|
|
881
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-flow-pill-token-icon", children:
|
|
887
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-flow-pill-token-icon", children: _chunkR2HP743Tcjs.getTokenIcon.call(void 0, targetSymbol) ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
882
888
|
"img",
|
|
883
889
|
{
|
|
884
|
-
src:
|
|
890
|
+
src: _chunkR2HP743Tcjs.getTokenIcon.call(void 0, targetSymbol),
|
|
885
891
|
alt: targetSymbol
|
|
886
892
|
}
|
|
887
893
|
) : targetSymbol.slice(0, 2) }),
|
|
888
894
|
(() => {
|
|
889
|
-
const chainIcon =
|
|
895
|
+
const chainIcon = _chunkR2HP743Tcjs.getChainIcon.call(void 0, targetChain);
|
|
890
896
|
if (chainIcon) {
|
|
891
897
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
892
898
|
"img",
|
|
893
899
|
{
|
|
894
900
|
src: chainIcon,
|
|
895
|
-
alt:
|
|
901
|
+
alt: _chunkR2HP743Tcjs.getChainName.call(void 0, targetChain),
|
|
896
902
|
className: "rs-flow-pill-chain-badge"
|
|
897
903
|
}
|
|
898
904
|
);
|
|
899
905
|
}
|
|
900
|
-
const badge =
|
|
906
|
+
const badge = _chunkR2HP743Tcjs.getChainBadge.call(void 0, targetChain);
|
|
901
907
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
902
908
|
"div",
|
|
903
909
|
{
|
|
@@ -944,7 +950,7 @@ function AmountStep({
|
|
|
944
950
|
)
|
|
945
951
|
] }),
|
|
946
952
|
_optionalChain([uiConfig, 'optionalAccess', _21 => _21.minDepositUsd]) && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-amount-minimum", children: [
|
|
947
|
-
|
|
953
|
+
_chunkKE6CJVOVcjs.currencyFormatter.format(uiConfig.minDepositUsd),
|
|
948
954
|
" minimum deposit"
|
|
949
955
|
] }),
|
|
950
956
|
error && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-amount-error", children: [
|
|
@@ -970,7 +976,7 @@ function AmountStep({
|
|
|
970
976
|
] })
|
|
971
977
|
] }),
|
|
972
978
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-step-footer", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
973
|
-
|
|
979
|
+
_chunkKE6CJVOVcjs.Button,
|
|
974
980
|
{
|
|
975
981
|
onClick: handleContinue,
|
|
976
982
|
fullWidth: true,
|
|
@@ -978,7 +984,7 @@ function AmountStep({
|
|
|
978
984
|
children: isCheckingLiquidity ? "Checking liquidity\u2026" : _optionalChain([uiConfig, 'optionalAccess', _22 => _22.minDepositUsd]) && parseFloat(amount) > 0 && parseFloat(amount) < uiConfig.minDepositUsd ? "Update order" : "Continue"
|
|
979
985
|
}
|
|
980
986
|
) }),
|
|
981
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
987
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkKE6CJVOVcjs.PoweredBy, {})
|
|
982
988
|
] });
|
|
983
989
|
}
|
|
984
990
|
|
|
@@ -1002,7 +1008,8 @@ function ConfirmStep({
|
|
|
1002
1008
|
liquidityWarning,
|
|
1003
1009
|
onConfirm,
|
|
1004
1010
|
onError,
|
|
1005
|
-
onDepositSubmitted
|
|
1011
|
+
onDepositSubmitted,
|
|
1012
|
+
onExecuteTransfer
|
|
1006
1013
|
}) {
|
|
1007
1014
|
const [isSubmitting, setIsSubmitting] = _react.useState.call(void 0, false);
|
|
1008
1015
|
const [error, setError] = _react.useState.call(void 0, null);
|
|
@@ -1010,7 +1017,7 @@ function ConfirmStep({
|
|
|
1010
1017
|
const hasAttemptedSwitch = _react.useRef.call(void 0, false);
|
|
1011
1018
|
const chainMismatch = _optionalChain([walletClient, 'optionalAccess', _23 => _23.chain, 'optionalAccess', _24 => _24.id]) && walletClient.chain.id !== asset.chainId;
|
|
1012
1019
|
const sameRoute = targetChain === asset.chainId && targetToken.toLowerCase() === asset.token.toLowerCase();
|
|
1013
|
-
const targetSymbol = sameRoute ? asset.symbol :
|
|
1020
|
+
const targetSymbol = sameRoute ? asset.symbol : _chunkR2HP743Tcjs.getTokenSymbol.call(void 0, targetToken, targetChain);
|
|
1014
1021
|
const formattedSendAmount = amount && !Number.isNaN(Number(amount)) ? Number(amount).toLocaleString("en-US", { maximumFractionDigits: 6 }) : "0";
|
|
1015
1022
|
const formattedReceiveAmount = (() => {
|
|
1016
1023
|
if (sameRoute) return formattedSendAmount;
|
|
@@ -1029,7 +1036,7 @@ function ConfirmStep({
|
|
|
1029
1036
|
setIsSwitching(true);
|
|
1030
1037
|
switchChain(asset.chainId).catch((err) => {
|
|
1031
1038
|
const raw = err instanceof Error ? err.message : "Failed to switch chain";
|
|
1032
|
-
setError(
|
|
1039
|
+
setError(_chunkKE6CJVOVcjs.formatUserError.call(void 0, raw));
|
|
1033
1040
|
}).finally(() => {
|
|
1034
1041
|
setIsSwitching(false);
|
|
1035
1042
|
});
|
|
@@ -1044,7 +1051,7 @@ function ConfirmStep({
|
|
|
1044
1051
|
return;
|
|
1045
1052
|
}
|
|
1046
1053
|
if (chainMismatch) {
|
|
1047
|
-
setError(`Switch to ${
|
|
1054
|
+
setError(`Switch to ${_chunkR2HP743Tcjs.getChainName.call(void 0, asset.chainId)} to sign`);
|
|
1048
1055
|
return;
|
|
1049
1056
|
}
|
|
1050
1057
|
const parsedAmount = parseFloat(amount);
|
|
@@ -1071,8 +1078,24 @@ function ConfirmStep({
|
|
|
1071
1078
|
if (!account || !chain) {
|
|
1072
1079
|
throw new Error("Wallet not properly connected");
|
|
1073
1080
|
}
|
|
1081
|
+
if (onExecuteTransfer) {
|
|
1082
|
+
const result = await onExecuteTransfer(amountUnits);
|
|
1083
|
+
_optionalChain([onDepositSubmitted, 'optionalCall', _25 => _25(result.txHash, asset.chainId, amountUnits.toString())]);
|
|
1084
|
+
onConfirm(
|
|
1085
|
+
result.txHash,
|
|
1086
|
+
asset.chainId,
|
|
1087
|
+
amountUnits.toString(),
|
|
1088
|
+
result.sourceToken,
|
|
1089
|
+
{
|
|
1090
|
+
directTransfer: result.directTransfer,
|
|
1091
|
+
sourceSymbol: result.sourceSymbol,
|
|
1092
|
+
sourceDecimals: result.sourceDecimals
|
|
1093
|
+
}
|
|
1094
|
+
);
|
|
1095
|
+
return;
|
|
1096
|
+
}
|
|
1074
1097
|
const transferTo = sameRoute ? recipient : smartAccount;
|
|
1075
|
-
const hash =
|
|
1098
|
+
const hash = _chunkKE6CJVOVcjs.isNativeAsset.call(void 0, asset) ? await walletClient.sendTransaction({
|
|
1076
1099
|
account,
|
|
1077
1100
|
chain,
|
|
1078
1101
|
to: transferTo,
|
|
@@ -1085,13 +1108,13 @@ function ConfirmStep({
|
|
|
1085
1108
|
functionName: "transfer",
|
|
1086
1109
|
args: [transferTo, amountUnits]
|
|
1087
1110
|
});
|
|
1088
|
-
_optionalChain([onDepositSubmitted, 'optionalCall',
|
|
1111
|
+
_optionalChain([onDepositSubmitted, 'optionalCall', _26 => _26(hash, asset.chainId, amountUnits.toString())]);
|
|
1089
1112
|
onConfirm(hash, asset.chainId, amountUnits.toString(), asset.token);
|
|
1090
1113
|
} catch (err) {
|
|
1091
1114
|
const raw = err instanceof Error ? err.message : "Transfer failed";
|
|
1092
|
-
const message =
|
|
1115
|
+
const message = _chunkKE6CJVOVcjs.formatUserError.call(void 0, raw);
|
|
1093
1116
|
setError(message);
|
|
1094
|
-
_optionalChain([onError, 'optionalCall',
|
|
1117
|
+
_optionalChain([onError, 'optionalCall', _27 => _27(message, "TRANSFER_ERROR")]);
|
|
1095
1118
|
} finally {
|
|
1096
1119
|
setIsSubmitting(false);
|
|
1097
1120
|
}
|
|
@@ -1108,15 +1131,15 @@ function ConfirmStep({
|
|
|
1108
1131
|
className: "rs-card-value",
|
|
1109
1132
|
style: { display: "flex", alignItems: "center", gap: 8 },
|
|
1110
1133
|
children: [
|
|
1111
|
-
|
|
1134
|
+
_chunkR2HP743Tcjs.getChainIcon.call(void 0, asset.chainId) && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1112
1135
|
"img",
|
|
1113
1136
|
{
|
|
1114
|
-
src:
|
|
1137
|
+
src: _chunkR2HP743Tcjs.getChainIcon.call(void 0, asset.chainId),
|
|
1115
1138
|
alt: "",
|
|
1116
1139
|
style: { width: 16, height: 16, borderRadius: 3 }
|
|
1117
1140
|
}
|
|
1118
1141
|
),
|
|
1119
|
-
|
|
1142
|
+
_chunkR2HP743Tcjs.getChainName.call(void 0, asset.chainId)
|
|
1120
1143
|
]
|
|
1121
1144
|
}
|
|
1122
1145
|
)
|
|
@@ -1129,15 +1152,15 @@ function ConfirmStep({
|
|
|
1129
1152
|
className: "rs-card-value",
|
|
1130
1153
|
style: { display: "flex", alignItems: "center", gap: 8 },
|
|
1131
1154
|
children: [
|
|
1132
|
-
|
|
1155
|
+
_chunkR2HP743Tcjs.getChainIcon.call(void 0, targetChain) && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1133
1156
|
"img",
|
|
1134
1157
|
{
|
|
1135
|
-
src:
|
|
1158
|
+
src: _chunkR2HP743Tcjs.getChainIcon.call(void 0, targetChain),
|
|
1136
1159
|
alt: "",
|
|
1137
1160
|
style: { width: 16, height: 16, borderRadius: 3 }
|
|
1138
1161
|
}
|
|
1139
1162
|
),
|
|
1140
|
-
|
|
1163
|
+
_chunkR2HP743Tcjs.getChainName.call(void 0, targetChain)
|
|
1141
1164
|
]
|
|
1142
1165
|
}
|
|
1143
1166
|
)
|
|
@@ -1149,17 +1172,17 @@ function ConfirmStep({
|
|
|
1149
1172
|
] }),
|
|
1150
1173
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-card", children: [
|
|
1151
1174
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-card-row", children: [
|
|
1152
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-card-label", children: "You send" }),
|
|
1175
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-card-label", children: _nullishCoalesce(asset.reviewLabel, () => ( "You send")) }),
|
|
1153
1176
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1154
1177
|
"span",
|
|
1155
1178
|
{
|
|
1156
1179
|
className: "rs-card-value",
|
|
1157
1180
|
style: { display: "flex", alignItems: "center", gap: 6 },
|
|
1158
1181
|
children: [
|
|
1159
|
-
|
|
1182
|
+
_chunkR2HP743Tcjs.getTokenIcon.call(void 0, asset.symbol) && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1160
1183
|
"img",
|
|
1161
1184
|
{
|
|
1162
|
-
src:
|
|
1185
|
+
src: _chunkR2HP743Tcjs.getTokenIcon.call(void 0, asset.symbol),
|
|
1163
1186
|
alt: "",
|
|
1164
1187
|
style: { width: 16, height: 16, borderRadius: "50%" }
|
|
1165
1188
|
}
|
|
@@ -1171,6 +1194,18 @@ function ConfirmStep({
|
|
|
1171
1194
|
}
|
|
1172
1195
|
)
|
|
1173
1196
|
] }),
|
|
1197
|
+
asset.reviewHelperText && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1198
|
+
"div",
|
|
1199
|
+
{
|
|
1200
|
+
style: {
|
|
1201
|
+
fontSize: 11,
|
|
1202
|
+
color: "var(--rs-muted-foreground)",
|
|
1203
|
+
lineHeight: 1.4,
|
|
1204
|
+
marginTop: 8
|
|
1205
|
+
},
|
|
1206
|
+
children: asset.reviewHelperText
|
|
1207
|
+
}
|
|
1208
|
+
),
|
|
1174
1209
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-card-row", children: [
|
|
1175
1210
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-card-label", children: "You receive" }),
|
|
1176
1211
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
@@ -1179,10 +1214,10 @@ function ConfirmStep({
|
|
|
1179
1214
|
className: "rs-card-value",
|
|
1180
1215
|
style: { display: "flex", alignItems: "center", gap: 6 },
|
|
1181
1216
|
children: [
|
|
1182
|
-
|
|
1217
|
+
_chunkR2HP743Tcjs.getTokenIcon.call(void 0, targetSymbol) && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1183
1218
|
"img",
|
|
1184
1219
|
{
|
|
1185
|
-
src:
|
|
1220
|
+
src: _chunkR2HP743Tcjs.getTokenIcon.call(void 0, targetSymbol),
|
|
1186
1221
|
alt: "",
|
|
1187
1222
|
style: { width: 16, height: 16, borderRadius: "50%" }
|
|
1188
1223
|
}
|
|
@@ -1231,7 +1266,7 @@ function ConfirmStep({
|
|
|
1231
1266
|
] })
|
|
1232
1267
|
] }),
|
|
1233
1268
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-step-footer", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1234
|
-
|
|
1269
|
+
_chunkKE6CJVOVcjs.Button,
|
|
1235
1270
|
{
|
|
1236
1271
|
onClick: handleConfirm,
|
|
1237
1272
|
loading: isSubmitting,
|
|
@@ -1240,7 +1275,7 @@ function ConfirmStep({
|
|
|
1240
1275
|
children: "Confirm Order"
|
|
1241
1276
|
}
|
|
1242
1277
|
) }),
|
|
1243
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1278
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkKE6CJVOVcjs.PoweredBy, {})
|
|
1244
1279
|
] });
|
|
1245
1280
|
}
|
|
1246
1281
|
|
|
@@ -1303,8 +1338,8 @@ function Tooltip({ content, children, className }) {
|
|
|
1303
1338
|
function handleOutside(event) {
|
|
1304
1339
|
const target = event.target;
|
|
1305
1340
|
if (!target) return;
|
|
1306
|
-
if (_optionalChain([triggerRef, 'access',
|
|
1307
|
-
if (_optionalChain([bubbleRef, 'access',
|
|
1341
|
+
if (_optionalChain([triggerRef, 'access', _28 => _28.current, 'optionalAccess', _29 => _29.contains, 'call', _30 => _30(target)])) return;
|
|
1342
|
+
if (_optionalChain([bubbleRef, 'access', _31 => _31.current, 'optionalAccess', _32 => _32.contains, 'call', _33 => _33(target)])) return;
|
|
1308
1343
|
setOpen(false);
|
|
1309
1344
|
}
|
|
1310
1345
|
function handleKey(event) {
|
|
@@ -1378,9 +1413,9 @@ var INITIAL_POLL_INTERVAL = 3e3;
|
|
|
1378
1413
|
var MAX_POLL_INTERVAL = 3e4;
|
|
1379
1414
|
var BACKOFF_MULTIPLIER = 1.5;
|
|
1380
1415
|
function isEventForTx(event, txHash) {
|
|
1381
|
-
const eventTxHash =
|
|
1416
|
+
const eventTxHash = _chunkKE6CJVOVcjs.getEventTxHash.call(void 0, event);
|
|
1382
1417
|
if (!eventTxHash) return false;
|
|
1383
|
-
return
|
|
1418
|
+
return _chunkKE6CJVOVcjs.txRefsMatch.call(void 0, eventTxHash, txHash);
|
|
1384
1419
|
}
|
|
1385
1420
|
function truncateHash(hash) {
|
|
1386
1421
|
return `${hash.slice(0, 4)}\u2026${hash.slice(-4)}`;
|
|
@@ -1410,7 +1445,7 @@ function formatTimestamp(ms) {
|
|
|
1410
1445
|
return `${month} ${day}${suffix} \xB7 ${hours}:${minutes}:${seconds}`;
|
|
1411
1446
|
}
|
|
1412
1447
|
function formatBridgeFailedMessage(event) {
|
|
1413
|
-
const eventData = _nullishCoalesce(_optionalChain([event, 'optionalAccess',
|
|
1448
|
+
const eventData = _nullishCoalesce(_optionalChain([event, 'optionalAccess', _34 => _34.data]), () => ( {}));
|
|
1414
1449
|
const backendMessage = typeof eventData.message === "string" ? eventData.message.trim() : "";
|
|
1415
1450
|
if (backendMessage.length > 0) {
|
|
1416
1451
|
const lower = backendMessage.toLowerCase();
|
|
@@ -1475,7 +1510,7 @@ function DepositNotification({
|
|
|
1475
1510
|
const pollIntervalRef = _react.useRef.call(void 0, INITIAL_POLL_INTERVAL);
|
|
1476
1511
|
const pollTimeoutRef = _react.useRef.call(void 0, null);
|
|
1477
1512
|
const completedRef = _react.useRef.call(void 0, _nullishCoalesce(directTransfer, () => ( false)));
|
|
1478
|
-
const depositContextRef =
|
|
1513
|
+
const depositContextRef = _chunkKE6CJVOVcjs.useLatestRef.call(void 0, {
|
|
1479
1514
|
amount,
|
|
1480
1515
|
sourceChain,
|
|
1481
1516
|
sourceToken: token,
|
|
@@ -1484,8 +1519,8 @@ function DepositNotification({
|
|
|
1484
1519
|
waitForFinalTx,
|
|
1485
1520
|
hasPostBridgeActions
|
|
1486
1521
|
});
|
|
1487
|
-
const onCompleteRef =
|
|
1488
|
-
const onFailedRef =
|
|
1522
|
+
const onCompleteRef = _chunkKE6CJVOVcjs.useLatestRef.call(void 0, onComplete);
|
|
1523
|
+
const onFailedRef = _chunkKE6CJVOVcjs.useLatestRef.call(void 0, onFailed);
|
|
1489
1524
|
const handleComplete = _react.useCallback.call(void 0,
|
|
1490
1525
|
(destTxHash) => {
|
|
1491
1526
|
if (completedRef.current) return;
|
|
@@ -1494,7 +1529,7 @@ function DepositNotification({
|
|
|
1494
1529
|
setCompletedAt(Date.now());
|
|
1495
1530
|
setStatus("complete");
|
|
1496
1531
|
const context = depositContextRef.current;
|
|
1497
|
-
_optionalChain([onCompleteRef, 'access',
|
|
1532
|
+
_optionalChain([onCompleteRef, 'access', _35 => _35.current, 'optionalCall', _36 => _36(txHash, destTxHash, {
|
|
1498
1533
|
amount: context.amount,
|
|
1499
1534
|
sourceChain: context.sourceChain,
|
|
1500
1535
|
sourceToken: context.sourceToken,
|
|
@@ -1509,7 +1544,7 @@ function DepositNotification({
|
|
|
1509
1544
|
if (completedRef.current) return;
|
|
1510
1545
|
completedRef.current = true;
|
|
1511
1546
|
setStatus("failed");
|
|
1512
|
-
_optionalChain([onFailedRef, 'access',
|
|
1547
|
+
_optionalChain([onFailedRef, 'access', _37 => _37.current, 'optionalCall', _38 => _38(txHash, error)]);
|
|
1513
1548
|
},
|
|
1514
1549
|
[onFailedRef, txHash]
|
|
1515
1550
|
);
|
|
@@ -1528,30 +1563,30 @@ function DepositNotification({
|
|
|
1528
1563
|
const lastEvent = data.lastEvent;
|
|
1529
1564
|
const eventForTx = isEventForTx(lastEvent, txHash) ? lastEvent : void 0;
|
|
1530
1565
|
const awaitingPostBridgeSwap = depositContextRef.current.waitForFinalTx && depositContextRef.current.hasPostBridgeActions;
|
|
1531
|
-
if (_optionalChain([eventForTx, 'optionalAccess',
|
|
1532
|
-
const swapTxHash = _optionalChain([eventForTx, 'access',
|
|
1566
|
+
if (_optionalChain([eventForTx, 'optionalAccess', _39 => _39.type]) === "post-bridge-swap-complete") {
|
|
1567
|
+
const swapTxHash = _optionalChain([eventForTx, 'access', _40 => _40.data, 'optionalAccess', _41 => _41.swap, 'optionalAccess', _42 => _42.transactionHash]);
|
|
1533
1568
|
handleComplete(swapTxHash);
|
|
1534
1569
|
return;
|
|
1535
1570
|
}
|
|
1536
|
-
if (_optionalChain([eventForTx, 'optionalAccess',
|
|
1571
|
+
if (_optionalChain([eventForTx, 'optionalAccess', _43 => _43.type]) === "post-bridge-swap-failed") {
|
|
1537
1572
|
handleFailed(formatBridgeFailedMessage(eventForTx));
|
|
1538
1573
|
return;
|
|
1539
1574
|
}
|
|
1540
|
-
if (_optionalChain([eventForTx, 'optionalAccess',
|
|
1541
|
-
const destTx = _optionalChain([eventForTx, 'access',
|
|
1575
|
+
if (_optionalChain([eventForTx, 'optionalAccess', _44 => _44.type]) === "bridge-complete" && !awaitingPostBridgeSwap) {
|
|
1576
|
+
const destTx = _optionalChain([eventForTx, 'access', _45 => _45.data, 'optionalAccess', _46 => _46.destination, 'optionalAccess', _47 => _47.transactionHash]);
|
|
1542
1577
|
handleComplete(destTx);
|
|
1543
1578
|
return;
|
|
1544
1579
|
}
|
|
1545
|
-
if (!waitForFinalTx && _optionalChain([eventForTx, 'optionalAccess',
|
|
1580
|
+
if (!waitForFinalTx && _optionalChain([eventForTx, 'optionalAccess', _48 => _48.type]) === "bridge-started") {
|
|
1546
1581
|
handleComplete(void 0);
|
|
1547
1582
|
return;
|
|
1548
1583
|
}
|
|
1549
|
-
if (_optionalChain([eventForTx, 'optionalAccess',
|
|
1584
|
+
if (_optionalChain([eventForTx, 'optionalAccess', _49 => _49.type]) === "bridge-failed") {
|
|
1550
1585
|
handleFailed(formatBridgeFailedMessage(eventForTx));
|
|
1551
1586
|
return;
|
|
1552
1587
|
}
|
|
1553
|
-
if (_optionalChain([eventForTx, 'optionalAccess',
|
|
1554
|
-
const errorMessage = _nullishCoalesce(_optionalChain([eventForTx, 'access',
|
|
1588
|
+
if (_optionalChain([eventForTx, 'optionalAccess', _50 => _50.type]) === "error") {
|
|
1589
|
+
const errorMessage = _nullishCoalesce(_optionalChain([eventForTx, 'access', _51 => _51.data, 'optionalAccess', _52 => _52.message]), () => ( "Unknown error"));
|
|
1555
1590
|
handleFailed(errorMessage);
|
|
1556
1591
|
return;
|
|
1557
1592
|
}
|
|
@@ -1589,8 +1624,8 @@ function DepositNotification({
|
|
|
1589
1624
|
status,
|
|
1590
1625
|
txHash
|
|
1591
1626
|
]);
|
|
1592
|
-
const sourceExplorerUrl =
|
|
1593
|
-
const destExplorerUrl = destinationTxHash ?
|
|
1627
|
+
const sourceExplorerUrl = _chunkR2HP743Tcjs.getExplorerTxUrl.call(void 0, sourceChain, txHash);
|
|
1628
|
+
const destExplorerUrl = destinationTxHash ? _chunkR2HP743Tcjs.getExplorerTxUrl.call(void 0, targetChain, destinationTxHash) : null;
|
|
1594
1629
|
const title = status === "complete" ? "Deposit completed" : status === "failed" ? "Deposit failed" : "Deposit received and processing\u2026";
|
|
1595
1630
|
const subtitle = status === "complete" ? "Your deposit has been credited to your account." : status === "failed" ? "Your deposit could not be processed." : "Your deposit will be credited to your account shortly.";
|
|
1596
1631
|
const statusIcon = status === "complete" ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-deposit-notification-badge rs-deposit-notification-badge--complete", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
@@ -1625,7 +1660,7 @@ function DepositNotification({
|
|
|
1625
1660
|
}
|
|
1626
1661
|
)
|
|
1627
1662
|
}
|
|
1628
|
-
) }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-deposit-notification-badge rs-deposit-notification-badge--processing", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1663
|
+
) }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-deposit-notification-badge rs-deposit-notification-badge--processing", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkKE6CJVOVcjs.Spinner, {}) });
|
|
1629
1664
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1630
1665
|
"div",
|
|
1631
1666
|
{
|
|
@@ -1749,7 +1784,7 @@ var DEFAULT_SOLANA_RPC_URL = "https://api.mainnet.solana.com";
|
|
|
1749
1784
|
var configuredSolanaRpcUrl = null;
|
|
1750
1785
|
var cachedConnections = /* @__PURE__ */ new Map();
|
|
1751
1786
|
function configureSolanaRpcUrl(rpcUrl) {
|
|
1752
|
-
const normalized = _optionalChain([rpcUrl, 'optionalAccess',
|
|
1787
|
+
const normalized = _optionalChain([rpcUrl, 'optionalAccess', _53 => _53.trim, 'call', _54 => _54()]);
|
|
1753
1788
|
configuredSolanaRpcUrl = normalized ? normalized : null;
|
|
1754
1789
|
cachedConnections.clear();
|
|
1755
1790
|
}
|
|
@@ -1884,7 +1919,7 @@ function resolveSolanaTokenMeta(token) {
|
|
|
1884
1919
|
return {};
|
|
1885
1920
|
}
|
|
1886
1921
|
function getDepositEventDetails(event) {
|
|
1887
|
-
if (!_optionalChain([event, 'optionalAccess',
|
|
1922
|
+
if (!_optionalChain([event, 'optionalAccess', _55 => _55.type]) || !isRecord(event.data)) return {};
|
|
1888
1923
|
if (event.type === "deposit-received") {
|
|
1889
1924
|
const chainId = asChainId(event.data.chain);
|
|
1890
1925
|
const token = asString(event.data.token);
|
|
@@ -1898,12 +1933,12 @@ function getDepositEventDetails(event) {
|
|
|
1898
1933
|
}
|
|
1899
1934
|
if (event.type === "bridge-started") {
|
|
1900
1935
|
const source = isRecord(event.data.source) ? event.data.source : void 0;
|
|
1901
|
-
const chainId = asChainId(_optionalChain([source, 'optionalAccess',
|
|
1902
|
-
const token = asString(_optionalChain([source, 'optionalAccess',
|
|
1936
|
+
const chainId = asChainId(_optionalChain([source, 'optionalAccess', _56 => _56.chain]));
|
|
1937
|
+
const token = asString(_optionalChain([source, 'optionalAccess', _57 => _57.asset]));
|
|
1903
1938
|
const solanaMeta = chainId === "solana" ? resolveSolanaTokenMeta(token) : {};
|
|
1904
1939
|
return {
|
|
1905
1940
|
chainId,
|
|
1906
|
-
amount: asAmount(_optionalChain([source, 'optionalAccess',
|
|
1941
|
+
amount: asAmount(_optionalChain([source, 'optionalAccess', _58 => _58.amount])),
|
|
1907
1942
|
token,
|
|
1908
1943
|
...solanaMeta
|
|
1909
1944
|
};
|
|
@@ -1931,15 +1966,15 @@ function DepositAddressStep({
|
|
|
1931
1966
|
}) {
|
|
1932
1967
|
const hasSolana = Boolean(solanaDepositAddress);
|
|
1933
1968
|
const allowedChainSet = _react.useMemo.call(void 0,
|
|
1934
|
-
() => _optionalChain([allowedRoutes, 'optionalAccess',
|
|
1935
|
-
[_optionalChain([allowedRoutes, 'optionalAccess',
|
|
1969
|
+
() => _optionalChain([allowedRoutes, 'optionalAccess', _59 => _59.sourceChains]) ? new Set(allowedRoutes.sourceChains) : null,
|
|
1970
|
+
[_optionalChain([allowedRoutes, 'optionalAccess', _60 => _60.sourceChains])]
|
|
1936
1971
|
);
|
|
1937
1972
|
const allowedTokenSet = _react.useMemo.call(void 0,
|
|
1938
|
-
() => _optionalChain([allowedRoutes, 'optionalAccess',
|
|
1939
|
-
[_optionalChain([allowedRoutes, 'optionalAccess',
|
|
1973
|
+
() => _optionalChain([allowedRoutes, 'optionalAccess', _61 => _61.sourceTokens]) ? new Set(allowedRoutes.sourceTokens.map((s) => s.toUpperCase())) : null,
|
|
1974
|
+
[_optionalChain([allowedRoutes, 'optionalAccess', _62 => _62.sourceTokens])]
|
|
1940
1975
|
);
|
|
1941
1976
|
const evmChainIds = _react.useMemo.call(void 0, () => {
|
|
1942
|
-
const all =
|
|
1977
|
+
const all = _chunkR2HP743Tcjs.getSupportedChainIds.call(void 0, );
|
|
1943
1978
|
return allowedChainSet ? all.filter((id) => allowedChainSet.has(id)) : all;
|
|
1944
1979
|
}, [allowedChainSet]);
|
|
1945
1980
|
const chainOptions = _react.useMemo.call(void 0, () => {
|
|
@@ -1953,7 +1988,7 @@ function DepositAddressStep({
|
|
|
1953
1988
|
const [sourceChainId, setSourceChainId] = _react.useState.call(void 0, defaultChainId);
|
|
1954
1989
|
const isSolana = sourceChainId === "solana";
|
|
1955
1990
|
const tokensForChain = _react.useMemo.call(void 0, () => {
|
|
1956
|
-
const all = isSolana ? SOLANA_TOKENS.map((t) => t.symbol) :
|
|
1991
|
+
const all = isSolana ? SOLANA_TOKENS.map((t) => t.symbol) : _chunkR2HP743Tcjs.getTargetTokenSymbolsForChain.call(void 0, sourceChainId);
|
|
1957
1992
|
return allowedTokenSet ? all.filter((s) => allowedTokenSet.has(s.toUpperCase())) : all;
|
|
1958
1993
|
}, [sourceChainId, isSolana, allowedTokenSet]);
|
|
1959
1994
|
const defaultToken = tokensForChain.includes("USDC") ? "USDC" : _nullishCoalesce(tokensForChain[0], () => ( "USDC"));
|
|
@@ -1977,7 +2012,7 @@ function DepositAddressStep({
|
|
|
1977
2012
|
const notificationIdRef = _react.useRef.call(void 0, 0);
|
|
1978
2013
|
const sourceSelectionRef = _react.useRef.call(void 0, {
|
|
1979
2014
|
chainId: defaultChainId,
|
|
1980
|
-
token: typeof defaultChainId === "number" ?
|
|
2015
|
+
token: typeof defaultChainId === "number" ? _chunkR2HP743Tcjs.getTokenAddress.call(void 0, defaultToken, defaultChainId) : void 0,
|
|
1981
2016
|
sourceSymbol: defaultToken
|
|
1982
2017
|
});
|
|
1983
2018
|
_react.useEffect.call(void 0, () => {
|
|
@@ -1985,15 +2020,15 @@ function DepositAddressStep({
|
|
|
1985
2020
|
const matched = _nullishCoalesce(SOLANA_TOKENS.find((t) => t.symbol === sourceTokenSymbol), () => ( SOLANA_TOKENS[0]));
|
|
1986
2021
|
sourceSelectionRef.current = {
|
|
1987
2022
|
chainId: "solana",
|
|
1988
|
-
token: _optionalChain([matched, 'optionalAccess',
|
|
1989
|
-
sourceSymbol: _optionalChain([matched, 'optionalAccess',
|
|
1990
|
-
sourceDecimals: _optionalChain([matched, 'optionalAccess',
|
|
2023
|
+
token: _optionalChain([matched, 'optionalAccess', _63 => _63.mint]),
|
|
2024
|
+
sourceSymbol: _optionalChain([matched, 'optionalAccess', _64 => _64.symbol]),
|
|
2025
|
+
sourceDecimals: _optionalChain([matched, 'optionalAccess', _65 => _65.decimals])
|
|
1991
2026
|
};
|
|
1992
2027
|
return;
|
|
1993
2028
|
}
|
|
1994
2029
|
sourceSelectionRef.current = {
|
|
1995
2030
|
chainId: sourceChainId,
|
|
1996
|
-
token:
|
|
2031
|
+
token: _chunkR2HP743Tcjs.getTokenAddress.call(void 0, sourceTokenSymbol, sourceChainId),
|
|
1997
2032
|
sourceSymbol: sourceTokenSymbol
|
|
1998
2033
|
};
|
|
1999
2034
|
}, [sourceChainId, sourceTokenSymbol, isSolana]);
|
|
@@ -2005,7 +2040,7 @@ function DepositAddressStep({
|
|
|
2005
2040
|
setLiquidityHelper({ kind: "idle" });
|
|
2006
2041
|
return;
|
|
2007
2042
|
}
|
|
2008
|
-
const sourceTokenAddress =
|
|
2043
|
+
const sourceTokenAddress = _chunkR2HP743Tcjs.getTokenAddress.call(void 0,
|
|
2009
2044
|
sourceTokenSymbol,
|
|
2010
2045
|
sourceChainId
|
|
2011
2046
|
);
|
|
@@ -2056,8 +2091,8 @@ function DepositAddressStep({
|
|
|
2056
2091
|
function handlePointerDown(event) {
|
|
2057
2092
|
const target = event.target;
|
|
2058
2093
|
if (!target) return;
|
|
2059
|
-
const clickedChainDropdown = _optionalChain([chainDropdownRef, 'access',
|
|
2060
|
-
const clickedTokenDropdown = _optionalChain([tokenDropdownRef, 'access',
|
|
2094
|
+
const clickedChainDropdown = _optionalChain([chainDropdownRef, 'access', _66 => _66.current, 'optionalAccess', _67 => _67.contains, 'call', _68 => _68(target)]);
|
|
2095
|
+
const clickedTokenDropdown = _optionalChain([tokenDropdownRef, 'access', _69 => _69.current, 'optionalAccess', _70 => _70.contains, 'call', _71 => _71(target)]);
|
|
2061
2096
|
if (clickedChainDropdown || clickedTokenDropdown) return;
|
|
2062
2097
|
setChainDropdownOpen(false);
|
|
2063
2098
|
setTokenDropdownOpen(false);
|
|
@@ -2070,7 +2105,7 @@ function DepositAddressStep({
|
|
|
2070
2105
|
};
|
|
2071
2106
|
}, [chainDropdownOpen, tokenDropdownOpen]);
|
|
2072
2107
|
const handleCopy = _react.useCallback.call(void 0, async () => {
|
|
2073
|
-
_optionalChain([onCopyAddress, 'optionalCall',
|
|
2108
|
+
_optionalChain([onCopyAddress, 'optionalCall', _72 => _72()]);
|
|
2074
2109
|
try {
|
|
2075
2110
|
await navigator.clipboard.writeText(displayAddress);
|
|
2076
2111
|
setCopied(true);
|
|
@@ -2144,10 +2179,10 @@ function DepositAddressStep({
|
|
|
2144
2179
|
return;
|
|
2145
2180
|
}
|
|
2146
2181
|
const event = status.lastEvent;
|
|
2147
|
-
const eventTxHash =
|
|
2182
|
+
const eventTxHash = _chunkKE6CJVOVcjs.isDepositEvent.call(void 0, event) ? _nullishCoalesce(_chunkKE6CJVOVcjs.getEventTxHash.call(void 0, event), () => ( null)) : null;
|
|
2148
2183
|
if (baselineTxHashRef.current === void 0) {
|
|
2149
2184
|
baselineTxHashRef.current = eventTxHash;
|
|
2150
|
-
} else if (eventTxHash && (!baselineTxHashRef.current || !
|
|
2185
|
+
} else if (eventTxHash && (!baselineTxHashRef.current || !_chunkKE6CJVOVcjs.txRefsMatch.call(void 0, eventTxHash, baselineTxHashRef.current))) {
|
|
2151
2186
|
const details = getDepositEventDetails(event);
|
|
2152
2187
|
const fallback = sourceSelectionRef.current;
|
|
2153
2188
|
const chainId = _nullishCoalesce(details.chainId, () => ( fallback.chainId));
|
|
@@ -2178,7 +2213,7 @@ function DepositAddressStep({
|
|
|
2178
2213
|
directTransfer
|
|
2179
2214
|
};
|
|
2180
2215
|
setNotifications((prev) => [notification, ...prev]);
|
|
2181
|
-
_optionalChain([onDepositSubmittedRef, 'access',
|
|
2216
|
+
_optionalChain([onDepositSubmittedRef, 'access', _73 => _73.current, 'optionalCall', _74 => _74({
|
|
2182
2217
|
txHash: eventTxHash,
|
|
2183
2218
|
sourceChain: chainId,
|
|
2184
2219
|
amount
|
|
@@ -2190,7 +2225,7 @@ function DepositAddressStep({
|
|
|
2190
2225
|
if (!cancelled) {
|
|
2191
2226
|
const msg = err instanceof Error ? err.message : "Failed to check status";
|
|
2192
2227
|
setPollingError(msg);
|
|
2193
|
-
_optionalChain([onErrorRef, 'access',
|
|
2228
|
+
_optionalChain([onErrorRef, 'access', _75 => _75.current, 'optionalCall', _76 => _76(msg, "STATUS_POLL_ERROR")]);
|
|
2194
2229
|
}
|
|
2195
2230
|
}
|
|
2196
2231
|
if (!cancelled) {
|
|
@@ -2206,21 +2241,21 @@ function DepositAddressStep({
|
|
|
2206
2241
|
const handleNotificationComplete = _react.useCallback.call(void 0,
|
|
2207
2242
|
(txHash, destinationTxHash, context) => {
|
|
2208
2243
|
isTrackingRef.current = false;
|
|
2209
|
-
_optionalChain([onDepositCompleteRef, 'access',
|
|
2244
|
+
_optionalChain([onDepositCompleteRef, 'access', _77 => _77.current, 'optionalCall', _78 => _78(txHash, destinationTxHash, context)]);
|
|
2210
2245
|
},
|
|
2211
2246
|
[]
|
|
2212
2247
|
);
|
|
2213
2248
|
const handleNotificationFailed = _react.useCallback.call(void 0,
|
|
2214
2249
|
(txHash, error) => {
|
|
2215
2250
|
isTrackingRef.current = false;
|
|
2216
|
-
_optionalChain([onDepositFailedRef, 'access',
|
|
2251
|
+
_optionalChain([onDepositFailedRef, 'access', _79 => _79.current, 'optionalCall', _80 => _80(txHash, error)]);
|
|
2217
2252
|
},
|
|
2218
2253
|
[]
|
|
2219
2254
|
);
|
|
2220
2255
|
const handleNotificationDismiss = _react.useCallback.call(void 0, (id) => {
|
|
2221
2256
|
setNotifications((prev) => prev.filter((n) => n.id !== id));
|
|
2222
2257
|
}, []);
|
|
2223
|
-
const qrIconSrc =
|
|
2258
|
+
const qrIconSrc = _chunkR2HP743Tcjs.getChainIcon.call(void 0, sourceChainId);
|
|
2224
2259
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-step rs-step--with-notifications", children: [
|
|
2225
2260
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-step-body", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-deposit-address", children: [
|
|
2226
2261
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-deposit-address-selectors", children: [
|
|
@@ -2236,15 +2271,15 @@ function DepositAddressStep({
|
|
|
2236
2271
|
setTokenDropdownOpen(false);
|
|
2237
2272
|
},
|
|
2238
2273
|
children: [
|
|
2239
|
-
|
|
2274
|
+
_chunkR2HP743Tcjs.getChainIcon.call(void 0, sourceChainId) && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2240
2275
|
"img",
|
|
2241
2276
|
{
|
|
2242
|
-
src:
|
|
2277
|
+
src: _chunkR2HP743Tcjs.getChainIcon.call(void 0, sourceChainId),
|
|
2243
2278
|
alt: "",
|
|
2244
2279
|
className: "rs-deposit-address-dropdown-icon"
|
|
2245
2280
|
}
|
|
2246
2281
|
),
|
|
2247
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children:
|
|
2282
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: _chunkR2HP743Tcjs.getChainName.call(void 0, sourceChainId) }),
|
|
2248
2283
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2249
2284
|
"svg",
|
|
2250
2285
|
{
|
|
@@ -2276,15 +2311,15 @@ function DepositAddressStep({
|
|
|
2276
2311
|
setChainDropdownOpen(false);
|
|
2277
2312
|
},
|
|
2278
2313
|
children: [
|
|
2279
|
-
|
|
2314
|
+
_chunkR2HP743Tcjs.getChainIcon.call(void 0, chainId) && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2280
2315
|
"img",
|
|
2281
2316
|
{
|
|
2282
|
-
src:
|
|
2317
|
+
src: _chunkR2HP743Tcjs.getChainIcon.call(void 0, chainId),
|
|
2283
2318
|
alt: "",
|
|
2284
2319
|
className: "rs-deposit-address-dropdown-icon"
|
|
2285
2320
|
}
|
|
2286
2321
|
),
|
|
2287
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children:
|
|
2322
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: _chunkR2HP743Tcjs.getChainName.call(void 0, chainId) })
|
|
2288
2323
|
]
|
|
2289
2324
|
},
|
|
2290
2325
|
String(chainId)
|
|
@@ -2295,7 +2330,7 @@ function DepositAddressStep({
|
|
|
2295
2330
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: "Supported token" }),
|
|
2296
2331
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "rs-deposit-address-min", children: [
|
|
2297
2332
|
"Min $",
|
|
2298
|
-
_nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess',
|
|
2333
|
+
_nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess', _81 => _81.minDepositUsd]), () => ( 0.1)),
|
|
2299
2334
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Tooltip, { content: "Minimum deposit amount required for the selected chain.", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2300
2335
|
"svg",
|
|
2301
2336
|
{
|
|
@@ -2323,10 +2358,10 @@ function DepositAddressStep({
|
|
|
2323
2358
|
setChainDropdownOpen(false);
|
|
2324
2359
|
},
|
|
2325
2360
|
children: [
|
|
2326
|
-
|
|
2361
|
+
_chunkR2HP743Tcjs.getTokenIcon.call(void 0, sourceTokenSymbol) && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2327
2362
|
"img",
|
|
2328
2363
|
{
|
|
2329
|
-
src:
|
|
2364
|
+
src: _chunkR2HP743Tcjs.getTokenIcon.call(void 0, sourceTokenSymbol),
|
|
2330
2365
|
alt: "",
|
|
2331
2366
|
className: "rs-deposit-address-dropdown-icon"
|
|
2332
2367
|
}
|
|
@@ -2363,10 +2398,10 @@ function DepositAddressStep({
|
|
|
2363
2398
|
setTokenDropdownOpen(false);
|
|
2364
2399
|
},
|
|
2365
2400
|
children: [
|
|
2366
|
-
|
|
2401
|
+
_chunkR2HP743Tcjs.getTokenIcon.call(void 0, symbol) && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2367
2402
|
"img",
|
|
2368
2403
|
{
|
|
2369
|
-
src:
|
|
2404
|
+
src: _chunkR2HP743Tcjs.getTokenIcon.call(void 0, symbol),
|
|
2370
2405
|
alt: "",
|
|
2371
2406
|
className: "rs-deposit-address-dropdown-icon"
|
|
2372
2407
|
}
|
|
@@ -2580,7 +2615,7 @@ function DepositAddressStep({
|
|
|
2580
2615
|
},
|
|
2581
2616
|
deposit.id
|
|
2582
2617
|
)) }),
|
|
2583
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2618
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkKE6CJVOVcjs.PoweredBy, {})
|
|
2584
2619
|
] });
|
|
2585
2620
|
}
|
|
2586
2621
|
DepositAddressStep.displayName = "DepositAddressStep";
|
|
@@ -2611,7 +2646,7 @@ function SolanaTokenSelectStep({
|
|
|
2611
2646
|
setError(null);
|
|
2612
2647
|
const portfolioBySymbol = {};
|
|
2613
2648
|
try {
|
|
2614
|
-
|
|
2649
|
+
_chunkKE6CJVOVcjs.debugLog.call(void 0, debug, "solana-token-select", "portfolio:request", {
|
|
2615
2650
|
solanaAddress
|
|
2616
2651
|
});
|
|
2617
2652
|
const portfolio = await service.fetchSolanaPortfolio(solanaAddress);
|
|
@@ -2634,12 +2669,12 @@ function SolanaTokenSelectStep({
|
|
|
2634
2669
|
};
|
|
2635
2670
|
}
|
|
2636
2671
|
}
|
|
2637
|
-
|
|
2672
|
+
_chunkKE6CJVOVcjs.debugLog.call(void 0, debug, "solana-token-select", "portfolio:success", {
|
|
2638
2673
|
symbols: Object.keys(portfolioBySymbol)
|
|
2639
2674
|
});
|
|
2640
2675
|
} catch (err) {
|
|
2641
2676
|
if (!active) return;
|
|
2642
|
-
|
|
2677
|
+
_chunkKE6CJVOVcjs.debugError.call(void 0, debug, "solana-token-select", "portfolio:failure", err, {
|
|
2643
2678
|
solanaAddress
|
|
2644
2679
|
});
|
|
2645
2680
|
setError(
|
|
@@ -2664,7 +2699,7 @@ function SolanaTokenSelectStep({
|
|
|
2664
2699
|
setTokenBalances(results);
|
|
2665
2700
|
setLoading(false);
|
|
2666
2701
|
const totalUsd = results.reduce((sum, r) => sum + r.balanceUsd, 0);
|
|
2667
|
-
_optionalChain([onTotalBalanceComputed, 'optionalCall',
|
|
2702
|
+
_optionalChain([onTotalBalanceComputed, 'optionalCall', _82 => _82(totalUsd)]);
|
|
2668
2703
|
}
|
|
2669
2704
|
void loadBalances();
|
|
2670
2705
|
return () => {
|
|
@@ -2693,7 +2728,7 @@ function SolanaTokenSelectStep({
|
|
|
2693
2728
|
style: { paddingTop: 4, overflow: "auto", maxHeight: 340 },
|
|
2694
2729
|
children: [
|
|
2695
2730
|
loading && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-loading-state", style: { padding: "40px 12px" }, children: [
|
|
2696
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2731
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkKE6CJVOVcjs.Spinner, { className: "rs-text-tertiary" }),
|
|
2697
2732
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-text-sm rs-text-tertiary", children: "Loading balances" })
|
|
2698
2733
|
] }),
|
|
2699
2734
|
!loading && rows.length === 0 && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-empty-state", children: [
|
|
@@ -2724,13 +2759,13 @@ function SolanaTokenSelectStep({
|
|
|
2724
2759
|
] }),
|
|
2725
2760
|
!loading && rows.length > 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-asset-list", children: rows.map((entry) => {
|
|
2726
2761
|
const isSelected = selectedSymbol === entry.token.symbol;
|
|
2727
|
-
const tokenIcon =
|
|
2728
|
-
const chainIcon =
|
|
2762
|
+
const tokenIcon = _chunkR2HP743Tcjs.getTokenIcon.call(void 0, entry.token.symbol);
|
|
2763
|
+
const chainIcon = _chunkR2HP743Tcjs.getChainIcon.call(void 0, "solana");
|
|
2729
2764
|
let formattedBalance;
|
|
2730
2765
|
try {
|
|
2731
2766
|
const raw = _viem.formatUnits.call(void 0, entry.balance, entry.token.decimals);
|
|
2732
2767
|
const numeric = Number(raw);
|
|
2733
|
-
formattedBalance = Number.isFinite(numeric) ?
|
|
2768
|
+
formattedBalance = Number.isFinite(numeric) ? _chunkKE6CJVOVcjs.tokenFormatter.format(numeric) : raw;
|
|
2734
2769
|
} catch (e16) {
|
|
2735
2770
|
formattedBalance = "...";
|
|
2736
2771
|
}
|
|
@@ -2774,7 +2809,7 @@ function SolanaTokenSelectStep({
|
|
|
2774
2809
|
] })
|
|
2775
2810
|
] })
|
|
2776
2811
|
] }),
|
|
2777
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-asset-balance", children: entry.balanceUsd > 0 ?
|
|
2812
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-asset-balance", children: entry.balanceUsd > 0 ? _chunkKE6CJVOVcjs.currencyFormatter.format(entry.balanceUsd) : `${formattedBalance} ${entry.token.symbol}` })
|
|
2778
2813
|
]
|
|
2779
2814
|
},
|
|
2780
2815
|
entry.token.symbol
|
|
@@ -2784,7 +2819,7 @@ function SolanaTokenSelectStep({
|
|
|
2784
2819
|
}
|
|
2785
2820
|
),
|
|
2786
2821
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-step-footer", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2787
|
-
|
|
2822
|
+
_chunkKE6CJVOVcjs.Button,
|
|
2788
2823
|
{
|
|
2789
2824
|
onClick: () => selectedEntry && onContinue(
|
|
2790
2825
|
selectedEntry.token,
|
|
@@ -2796,7 +2831,7 @@ function SolanaTokenSelectStep({
|
|
|
2796
2831
|
children: "Continue"
|
|
2797
2832
|
}
|
|
2798
2833
|
) }),
|
|
2799
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2834
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkKE6CJVOVcjs.PoweredBy, {})
|
|
2800
2835
|
] });
|
|
2801
2836
|
}
|
|
2802
2837
|
|
|
@@ -2816,7 +2851,7 @@ function SolanaAmountStep({
|
|
|
2816
2851
|
}) {
|
|
2817
2852
|
const [amount, setAmount] = _react.useState.call(void 0, "");
|
|
2818
2853
|
const [error, setError] = _react.useState.call(void 0, null);
|
|
2819
|
-
const isSourceStablecoin =
|
|
2854
|
+
const isSourceStablecoin = _chunkR2HP743Tcjs.isStablecoinSymbol.call(void 0, token.symbol);
|
|
2820
2855
|
const tokenPriceUsd = _react.useMemo.call(void 0, () => {
|
|
2821
2856
|
if (isSourceStablecoin) return 1;
|
|
2822
2857
|
try {
|
|
@@ -2844,7 +2879,7 @@ function SolanaAmountStep({
|
|
|
2844
2879
|
const raw = _viem.formatUnits.call(void 0, balance, token.decimals);
|
|
2845
2880
|
const numeric = Number(raw);
|
|
2846
2881
|
if (!Number.isFinite(numeric)) return raw;
|
|
2847
|
-
return
|
|
2882
|
+
return _chunkKE6CJVOVcjs.tokenFormatter.format(numeric);
|
|
2848
2883
|
} catch (e18) {
|
|
2849
2884
|
return "...";
|
|
2850
2885
|
}
|
|
@@ -2862,7 +2897,7 @@ function SolanaAmountStep({
|
|
|
2862
2897
|
}, [balance, token.decimals, tokenPriceUsd, balanceUsd]);
|
|
2863
2898
|
const formattedBalanceUsd = _react.useMemo.call(void 0, () => {
|
|
2864
2899
|
if (computedBalanceUsd === null || computedBalanceUsd <= 0) return null;
|
|
2865
|
-
return
|
|
2900
|
+
return _chunkKE6CJVOVcjs.currencyFormatter.format(computedBalanceUsd);
|
|
2866
2901
|
}, [computedBalanceUsd]);
|
|
2867
2902
|
const spendableBalance = _react.useMemo.call(void 0, () => {
|
|
2868
2903
|
if (!isNativeSol(token)) return balance;
|
|
@@ -2887,7 +2922,7 @@ function SolanaAmountStep({
|
|
|
2887
2922
|
const factor = 10 ** maxDecimals;
|
|
2888
2923
|
const truncated = Math.floor(value * factor) / factor;
|
|
2889
2924
|
const formatted = truncated.toFixed(maxDecimals).replace(/\.?0+$/, "");
|
|
2890
|
-
|
|
2925
|
+
_chunkKE6CJVOVcjs.debugLog.call(void 0, debug, "solana-amount", "amount:preset", {
|
|
2891
2926
|
percentage,
|
|
2892
2927
|
symbol: token.symbol,
|
|
2893
2928
|
formatted
|
|
@@ -2901,7 +2936,7 @@ function SolanaAmountStep({
|
|
|
2901
2936
|
const handleContinue = () => {
|
|
2902
2937
|
const numericAmount = parseFloat(amount);
|
|
2903
2938
|
if (isNaN(numericAmount) || numericAmount <= 0) {
|
|
2904
|
-
|
|
2939
|
+
_chunkKE6CJVOVcjs.debugLog.call(void 0, debug, "solana-amount", "amount:invalid", {
|
|
2905
2940
|
amount,
|
|
2906
2941
|
reason: "nan-or-non-positive"
|
|
2907
2942
|
});
|
|
@@ -2911,13 +2946,13 @@ function SolanaAmountStep({
|
|
|
2911
2946
|
const sourceAmount = isSourceStablecoin || !hasPricing ? numericAmount : numericAmount / tokenPriceUsd;
|
|
2912
2947
|
if (hasPricing) {
|
|
2913
2948
|
const usdValue = numericAmount;
|
|
2914
|
-
if (_optionalChain([uiConfig, 'optionalAccess',
|
|
2949
|
+
if (_optionalChain([uiConfig, 'optionalAccess', _83 => _83.maxDepositUsd]) && usdValue > uiConfig.maxDepositUsd) {
|
|
2915
2950
|
setError(
|
|
2916
|
-
`Maximum deposit is ${
|
|
2951
|
+
`Maximum deposit is ${_chunkKE6CJVOVcjs.currencyFormatter.format(uiConfig.maxDepositUsd)}`
|
|
2917
2952
|
);
|
|
2918
2953
|
return;
|
|
2919
2954
|
}
|
|
2920
|
-
if (_optionalChain([uiConfig, 'optionalAccess',
|
|
2955
|
+
if (_optionalChain([uiConfig, 'optionalAccess', _84 => _84.minDepositUsd]) && usdValue < uiConfig.minDepositUsd) {
|
|
2921
2956
|
setAmount(uiConfig.minDepositUsd.toString());
|
|
2922
2957
|
setError(null);
|
|
2923
2958
|
return;
|
|
@@ -2928,7 +2963,7 @@ function SolanaAmountStep({
|
|
|
2928
2963
|
try {
|
|
2929
2964
|
amountInUnits = _viem.parseUnits.call(void 0, sourceAmountStr, token.decimals);
|
|
2930
2965
|
} catch (e22) {
|
|
2931
|
-
|
|
2966
|
+
_chunkKE6CJVOVcjs.debugLog.call(void 0, debug, "solana-amount", "amount:invalid", {
|
|
2932
2967
|
amount,
|
|
2933
2968
|
sourceAmount: sourceAmountStr,
|
|
2934
2969
|
reason: "parse-units-failed"
|
|
@@ -2938,7 +2973,7 @@ function SolanaAmountStep({
|
|
|
2938
2973
|
}
|
|
2939
2974
|
if (amountInUnits > spendableBalance) {
|
|
2940
2975
|
const isReserveIssue = isNativeSol(token) && amountInUnits <= balance;
|
|
2941
|
-
|
|
2976
|
+
_chunkKE6CJVOVcjs.debugLog.call(void 0, debug, "solana-amount", "amount:invalid", {
|
|
2942
2977
|
amount,
|
|
2943
2978
|
balance: balance.toString(),
|
|
2944
2979
|
spendableBalance: spendableBalance.toString(),
|
|
@@ -2950,7 +2985,7 @@ function SolanaAmountStep({
|
|
|
2950
2985
|
);
|
|
2951
2986
|
return;
|
|
2952
2987
|
}
|
|
2953
|
-
|
|
2988
|
+
_chunkKE6CJVOVcjs.debugLog.call(void 0, debug, "solana-amount", "amount:continue", {
|
|
2954
2989
|
symbol: token.symbol,
|
|
2955
2990
|
inputAmountUsd: amount,
|
|
2956
2991
|
sourceAmount: sourceAmountStr,
|
|
@@ -3018,8 +3053,8 @@ function SolanaAmountStep({
|
|
|
3018
3053
|
}
|
|
3019
3054
|
)
|
|
3020
3055
|
] }),
|
|
3021
|
-
_optionalChain([uiConfig, 'optionalAccess',
|
|
3022
|
-
|
|
3056
|
+
_optionalChain([uiConfig, 'optionalAccess', _85 => _85.minDepositUsd]) && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-amount-minimum", children: [
|
|
3057
|
+
_chunkKE6CJVOVcjs.currencyFormatter.format(uiConfig.minDepositUsd),
|
|
3023
3058
|
" minimum deposit"
|
|
3024
3059
|
] }),
|
|
3025
3060
|
error && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-amount-error", children: [
|
|
@@ -3045,15 +3080,15 @@ function SolanaAmountStep({
|
|
|
3045
3080
|
] })
|
|
3046
3081
|
] }),
|
|
3047
3082
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-step-footer", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3048
|
-
|
|
3083
|
+
_chunkKE6CJVOVcjs.Button,
|
|
3049
3084
|
{
|
|
3050
3085
|
onClick: handleContinue,
|
|
3051
3086
|
fullWidth: true,
|
|
3052
3087
|
disabled: !amount,
|
|
3053
|
-
children: _optionalChain([uiConfig, 'optionalAccess',
|
|
3088
|
+
children: _optionalChain([uiConfig, 'optionalAccess', _86 => _86.minDepositUsd]) && parseFloat(amount) > 0 && parseFloat(amount) < uiConfig.minDepositUsd ? "Update order" : "Continue"
|
|
3054
3089
|
}
|
|
3055
3090
|
) }),
|
|
3056
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3091
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkKE6CJVOVcjs.PoweredBy, {})
|
|
3057
3092
|
] });
|
|
3058
3093
|
}
|
|
3059
3094
|
|
|
@@ -3080,7 +3115,7 @@ function SolanaConfirmStep({
|
|
|
3080
3115
|
}) {
|
|
3081
3116
|
const [isSubmitting, setIsSubmitting] = _react.useState.call(void 0, false);
|
|
3082
3117
|
const [error, setError] = _react.useState.call(void 0, null);
|
|
3083
|
-
const targetSymbol =
|
|
3118
|
+
const targetSymbol = _chunkR2HP743Tcjs.getTokenSymbol.call(void 0, targetToken, targetChain);
|
|
3084
3119
|
const isSameToken = token.symbol.toUpperCase() === targetSymbol.toUpperCase();
|
|
3085
3120
|
const formattedAmount = sourceAmount && !Number.isNaN(Number(sourceAmount)) ? Number(sourceAmount).toLocaleString("en-US", { maximumFractionDigits: 6 }) : "0";
|
|
3086
3121
|
const formattedReceiveAmount = (() => {
|
|
@@ -3097,7 +3132,7 @@ function SolanaConfirmStep({
|
|
|
3097
3132
|
const receiveAmount = isSameToken ? formattedReceiveAmount : `~ ${formattedReceiveAmount}`;
|
|
3098
3133
|
const handleConfirm = async () => {
|
|
3099
3134
|
if (!solanaProvider) {
|
|
3100
|
-
|
|
3135
|
+
_chunkKE6CJVOVcjs.debugLog.call(void 0, debug, "solana-confirm", "submit:blocked", {
|
|
3101
3136
|
reason: "missing-provider"
|
|
3102
3137
|
});
|
|
3103
3138
|
setError("Solana wallet not connected");
|
|
@@ -3105,7 +3140,7 @@ function SolanaConfirmStep({
|
|
|
3105
3140
|
}
|
|
3106
3141
|
const parsedAmount = parseFloat(sourceAmount);
|
|
3107
3142
|
if (isNaN(parsedAmount) || parsedAmount <= 0) {
|
|
3108
|
-
|
|
3143
|
+
_chunkKE6CJVOVcjs.debugLog.call(void 0, debug, "solana-confirm", "submit:blocked", {
|
|
3109
3144
|
reason: "invalid-amount",
|
|
3110
3145
|
sourceAmount
|
|
3111
3146
|
});
|
|
@@ -3114,7 +3149,7 @@ function SolanaConfirmStep({
|
|
|
3114
3149
|
}
|
|
3115
3150
|
setError(null);
|
|
3116
3151
|
setIsSubmitting(true);
|
|
3117
|
-
|
|
3152
|
+
_chunkKE6CJVOVcjs.debugLog.call(void 0, debug, "solana-confirm", "submit:start", {
|
|
3118
3153
|
smartAccount,
|
|
3119
3154
|
solanaAddress,
|
|
3120
3155
|
solanaDepositAddress,
|
|
@@ -3124,7 +3159,7 @@ function SolanaConfirmStep({
|
|
|
3124
3159
|
});
|
|
3125
3160
|
try {
|
|
3126
3161
|
const check = await service.checkAccount(smartAccount);
|
|
3127
|
-
|
|
3162
|
+
_chunkKE6CJVOVcjs.debugLog.call(void 0, debug, "solana-confirm", "check:success", {
|
|
3128
3163
|
smartAccount,
|
|
3129
3164
|
isRegistered: check.isRegistered,
|
|
3130
3165
|
targetChain: check.targetChain,
|
|
@@ -3137,7 +3172,7 @@ function SolanaConfirmStep({
|
|
|
3137
3172
|
}
|
|
3138
3173
|
const connection = getSolanaConnection();
|
|
3139
3174
|
const amountUnits = _viem.parseUnits.call(void 0, sourceAmount, token.decimals);
|
|
3140
|
-
|
|
3175
|
+
_chunkKE6CJVOVcjs.debugLog.call(void 0, debug, "solana-confirm", "tx:build:start", {
|
|
3141
3176
|
token: token.symbol,
|
|
3142
3177
|
sourceAmount,
|
|
3143
3178
|
amountUnits: amountUnits.toString()
|
|
@@ -3154,10 +3189,10 @@ function SolanaConfirmStep({
|
|
|
3154
3189
|
token.mint,
|
|
3155
3190
|
amountUnits
|
|
3156
3191
|
);
|
|
3157
|
-
|
|
3192
|
+
_chunkKE6CJVOVcjs.debugLog.call(void 0, debug, "solana-confirm", "tx:build:success", {
|
|
3158
3193
|
token: token.symbol,
|
|
3159
3194
|
instructionCount: transaction.instructions.length,
|
|
3160
|
-
feePayer: _optionalChain([transaction, 'access',
|
|
3195
|
+
feePayer: _optionalChain([transaction, 'access', _87 => _87.feePayer, 'optionalAccess', _88 => _88.toBase58, 'call', _89 => _89()]),
|
|
3161
3196
|
recentBlockhash: transaction.recentBlockhash
|
|
3162
3197
|
});
|
|
3163
3198
|
const txHash = await sendSolanaTransaction(
|
|
@@ -3165,21 +3200,21 @@ function SolanaConfirmStep({
|
|
|
3165
3200
|
connection,
|
|
3166
3201
|
transaction
|
|
3167
3202
|
);
|
|
3168
|
-
|
|
3203
|
+
_chunkKE6CJVOVcjs.debugLog.call(void 0, debug, "solana-confirm", "tx:sent", {
|
|
3169
3204
|
txHash,
|
|
3170
3205
|
amountUnits: amountUnits.toString()
|
|
3171
3206
|
});
|
|
3172
3207
|
onConfirm(txHash, amountUnits.toString());
|
|
3173
3208
|
} catch (err) {
|
|
3174
3209
|
const raw = err instanceof Error ? err.message : "Transfer failed";
|
|
3175
|
-
const message =
|
|
3176
|
-
|
|
3210
|
+
const message = _chunkKE6CJVOVcjs.formatUserError.call(void 0, raw);
|
|
3211
|
+
_chunkKE6CJVOVcjs.debugError.call(void 0, debug, "solana-confirm", "submit:failure", err, {
|
|
3177
3212
|
smartAccount,
|
|
3178
3213
|
token: token.symbol,
|
|
3179
3214
|
sourceAmount
|
|
3180
3215
|
});
|
|
3181
3216
|
setError(message);
|
|
3182
|
-
_optionalChain([onError, 'optionalCall',
|
|
3217
|
+
_optionalChain([onError, 'optionalCall', _90 => _90(message, "SOLANA_TRANSFER_ERROR")]);
|
|
3183
3218
|
} finally {
|
|
3184
3219
|
setIsSubmitting(false);
|
|
3185
3220
|
}
|
|
@@ -3196,15 +3231,15 @@ function SolanaConfirmStep({
|
|
|
3196
3231
|
className: "rs-card-value",
|
|
3197
3232
|
style: { display: "flex", alignItems: "center", gap: 8 },
|
|
3198
3233
|
children: [
|
|
3199
|
-
|
|
3234
|
+
_chunkR2HP743Tcjs.getChainIcon.call(void 0, "solana") && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3200
3235
|
"img",
|
|
3201
3236
|
{
|
|
3202
|
-
src:
|
|
3237
|
+
src: _chunkR2HP743Tcjs.getChainIcon.call(void 0, "solana"),
|
|
3203
3238
|
alt: "",
|
|
3204
3239
|
style: { width: 16, height: 16, borderRadius: 3 }
|
|
3205
3240
|
}
|
|
3206
3241
|
),
|
|
3207
|
-
|
|
3242
|
+
_chunkR2HP743Tcjs.getChainName.call(void 0, "solana")
|
|
3208
3243
|
]
|
|
3209
3244
|
}
|
|
3210
3245
|
)
|
|
@@ -3217,15 +3252,15 @@ function SolanaConfirmStep({
|
|
|
3217
3252
|
className: "rs-card-value",
|
|
3218
3253
|
style: { display: "flex", alignItems: "center", gap: 8 },
|
|
3219
3254
|
children: [
|
|
3220
|
-
|
|
3255
|
+
_chunkR2HP743Tcjs.getChainIcon.call(void 0, targetChain) && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3221
3256
|
"img",
|
|
3222
3257
|
{
|
|
3223
|
-
src:
|
|
3258
|
+
src: _chunkR2HP743Tcjs.getChainIcon.call(void 0, targetChain),
|
|
3224
3259
|
alt: "",
|
|
3225
3260
|
style: { width: 16, height: 16, borderRadius: 3 }
|
|
3226
3261
|
}
|
|
3227
3262
|
),
|
|
3228
|
-
|
|
3263
|
+
_chunkR2HP743Tcjs.getChainName.call(void 0, targetChain)
|
|
3229
3264
|
]
|
|
3230
3265
|
}
|
|
3231
3266
|
)
|
|
@@ -3244,10 +3279,10 @@ function SolanaConfirmStep({
|
|
|
3244
3279
|
className: "rs-card-value",
|
|
3245
3280
|
style: { display: "flex", alignItems: "center", gap: 6 },
|
|
3246
3281
|
children: [
|
|
3247
|
-
|
|
3282
|
+
_chunkR2HP743Tcjs.getTokenIcon.call(void 0, token.symbol) && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3248
3283
|
"img",
|
|
3249
3284
|
{
|
|
3250
|
-
src:
|
|
3285
|
+
src: _chunkR2HP743Tcjs.getTokenIcon.call(void 0, token.symbol),
|
|
3251
3286
|
alt: "",
|
|
3252
3287
|
style: { width: 16, height: 16, borderRadius: "50%" }
|
|
3253
3288
|
}
|
|
@@ -3267,10 +3302,10 @@ function SolanaConfirmStep({
|
|
|
3267
3302
|
className: "rs-card-value",
|
|
3268
3303
|
style: { display: "flex", alignItems: "center", gap: 6 },
|
|
3269
3304
|
children: [
|
|
3270
|
-
|
|
3305
|
+
_chunkR2HP743Tcjs.getTokenIcon.call(void 0, targetSymbol) && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3271
3306
|
"img",
|
|
3272
3307
|
{
|
|
3273
|
-
src:
|
|
3308
|
+
src: _chunkR2HP743Tcjs.getTokenIcon.call(void 0, targetSymbol),
|
|
3274
3309
|
alt: "",
|
|
3275
3310
|
style: { width: 16, height: 16, borderRadius: "50%" }
|
|
3276
3311
|
}
|
|
@@ -3306,7 +3341,7 @@ function SolanaConfirmStep({
|
|
|
3306
3341
|
] })
|
|
3307
3342
|
] }),
|
|
3308
3343
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-step-footer", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3309
|
-
|
|
3344
|
+
_chunkKE6CJVOVcjs.Button,
|
|
3310
3345
|
{
|
|
3311
3346
|
onClick: handleConfirm,
|
|
3312
3347
|
loading: isSubmitting,
|
|
@@ -3315,7 +3350,102 @@ function SolanaConfirmStep({
|
|
|
3315
3350
|
children: "Confirm Order"
|
|
3316
3351
|
}
|
|
3317
3352
|
) }),
|
|
3318
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3353
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkKE6CJVOVcjs.PoweredBy, {})
|
|
3354
|
+
] });
|
|
3355
|
+
}
|
|
3356
|
+
|
|
3357
|
+
// src/components/steps/PolymarketMigrationStep.tsx
|
|
3358
|
+
|
|
3359
|
+
|
|
3360
|
+
|
|
3361
|
+
function PolymarketMigrationStep({
|
|
3362
|
+
safeAddress,
|
|
3363
|
+
assets,
|
|
3364
|
+
loading,
|
|
3365
|
+
error,
|
|
3366
|
+
onContinue
|
|
3367
|
+
}) {
|
|
3368
|
+
const [selectedAssetId, setSelectedAssetId] = _react.useState.call(void 0, null);
|
|
3369
|
+
_react.useEffect.call(void 0, () => {
|
|
3370
|
+
if (selectedAssetId && assets.some((asset) => asset.id === selectedAssetId))
|
|
3371
|
+
return;
|
|
3372
|
+
setSelectedAssetId(_nullishCoalesce(_optionalChain([assets, 'access', _91 => _91[0], 'optionalAccess', _92 => _92.id]), () => ( null)));
|
|
3373
|
+
}, [assets, selectedAssetId]);
|
|
3374
|
+
const selectedAsset = assets.find((asset) => asset.id === selectedAssetId);
|
|
3375
|
+
const shortSafe = safeAddress ? `${safeAddress.slice(0, 6)}...${safeAddress.slice(-4)}` : null;
|
|
3376
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-step", children: [
|
|
3377
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { style: { padding: "12px 12px 8px" }, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-step-title", children: "Migrate from Polymarket" }) }),
|
|
3378
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-step-body rs-space-y-3", style: { paddingTop: 0 }, children: [
|
|
3379
|
+
loading && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-loading-state", style: { padding: "28px 12px" }, children: [
|
|
3380
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkKE6CJVOVcjs.Spinner, { className: "rs-text-tertiary" }),
|
|
3381
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-text-sm rs-text-tertiary", children: "Checking Polymarket balance" })
|
|
3382
|
+
] }),
|
|
3383
|
+
!loading && error && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-alert rs-alert--error", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-alert-text", children: error }) }),
|
|
3384
|
+
!loading && !error && assets.length === 0 && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-empty-state", children: [
|
|
3385
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-empty-text", children: "No Polymarket balance found" }),
|
|
3386
|
+
shortSafe && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-empty-address", children: shortSafe })
|
|
3387
|
+
] }),
|
|
3388
|
+
!loading && !error && assets.length > 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-asset-list", children: assets.map((asset) => {
|
|
3389
|
+
const selected = asset.id === selectedAssetId;
|
|
3390
|
+
const raw = _viem.formatUnits.call(void 0, BigInt(_nullishCoalesce(asset.balance, () => ( "0"))), 6);
|
|
3391
|
+
const numeric = Number(raw);
|
|
3392
|
+
const tokenAmount = Number.isFinite(numeric) ? _chunkKE6CJVOVcjs.tokenFormatter.format(numeric) : raw;
|
|
3393
|
+
const tokenIcon = _chunkR2HP743Tcjs.getTokenIcon.call(void 0, asset.symbol);
|
|
3394
|
+
const chainIcon = _chunkR2HP743Tcjs.getChainIcon.call(void 0, asset.chainId);
|
|
3395
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3396
|
+
"button",
|
|
3397
|
+
{
|
|
3398
|
+
type: "button",
|
|
3399
|
+
className: `rs-asset-row ${selected ? "rs-asset-row--selected" : ""}`,
|
|
3400
|
+
onClick: () => setSelectedAssetId(asset.id),
|
|
3401
|
+
style: { textAlign: "left" },
|
|
3402
|
+
children: [
|
|
3403
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-asset-info", children: [
|
|
3404
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-asset-icon-wrapper", children: [
|
|
3405
|
+
tokenIcon ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3406
|
+
"img",
|
|
3407
|
+
{
|
|
3408
|
+
src: tokenIcon,
|
|
3409
|
+
alt: asset.symbol,
|
|
3410
|
+
className: "rs-asset-icon",
|
|
3411
|
+
style: { background: "transparent" }
|
|
3412
|
+
}
|
|
3413
|
+
) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-asset-icon", children: asset.symbol.slice(0, 4) }),
|
|
3414
|
+
chainIcon && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3415
|
+
"img",
|
|
3416
|
+
{
|
|
3417
|
+
src: chainIcon,
|
|
3418
|
+
alt: _chunkR2HP743Tcjs.getChainName.call(void 0, asset.chainId),
|
|
3419
|
+
className: "rs-asset-chain-badge"
|
|
3420
|
+
}
|
|
3421
|
+
)
|
|
3422
|
+
] }),
|
|
3423
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { children: [
|
|
3424
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-asset-name", children: asset.symbol }),
|
|
3425
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-asset-balance-small", children: [
|
|
3426
|
+
tokenAmount,
|
|
3427
|
+
" ",
|
|
3428
|
+
asset.symbol
|
|
3429
|
+
] })
|
|
3430
|
+
] })
|
|
3431
|
+
] }),
|
|
3432
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-asset-balance", children: _chunkKE6CJVOVcjs.currencyFormatter.format(_nullishCoalesce(asset.balanceUsd, () => ( 0))) })
|
|
3433
|
+
]
|
|
3434
|
+
},
|
|
3435
|
+
asset.id
|
|
3436
|
+
);
|
|
3437
|
+
}) })
|
|
3438
|
+
] }),
|
|
3439
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-step-footer", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3440
|
+
_chunkKE6CJVOVcjs.Button,
|
|
3441
|
+
{
|
|
3442
|
+
fullWidth: true,
|
|
3443
|
+
onClick: () => selectedAsset && onContinue(selectedAsset),
|
|
3444
|
+
disabled: !selectedAsset || loading,
|
|
3445
|
+
children: "Continue"
|
|
3446
|
+
}
|
|
3447
|
+
) }),
|
|
3448
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkKE6CJVOVcjs.PoweredBy, {})
|
|
3319
3449
|
] });
|
|
3320
3450
|
}
|
|
3321
3451
|
|
|
@@ -3343,11 +3473,12 @@ function DepositFlow({
|
|
|
3343
3473
|
postBridgeActions,
|
|
3344
3474
|
outputTokenRules,
|
|
3345
3475
|
rejectUnmapped,
|
|
3346
|
-
signerAddress =
|
|
3476
|
+
signerAddress = _chunkR2HP743Tcjs.DEFAULT_SIGNER_ADDRESS,
|
|
3347
3477
|
sessionChainIds,
|
|
3348
3478
|
forceRegister = false,
|
|
3349
3479
|
waitForFinalTx = true,
|
|
3350
3480
|
enableSolana = true,
|
|
3481
|
+
enablePolymarketMigration = false,
|
|
3351
3482
|
reownWallet,
|
|
3352
3483
|
onConnect,
|
|
3353
3484
|
onDisconnect,
|
|
@@ -3367,16 +3498,16 @@ function DepositFlow({
|
|
|
3367
3498
|
onError,
|
|
3368
3499
|
debug
|
|
3369
3500
|
}) {
|
|
3370
|
-
const onStepChangeRef =
|
|
3371
|
-
const onTotalBalanceChangeRef =
|
|
3372
|
-
const onSmartAccountChangeRef =
|
|
3373
|
-
const onEventRef =
|
|
3374
|
-
const onDepositSubmittedRef =
|
|
3375
|
-
const onDepositCompleteRef =
|
|
3376
|
-
const onDepositFailedRef =
|
|
3377
|
-
const onErrorRef =
|
|
3501
|
+
const onStepChangeRef = _chunkKE6CJVOVcjs.useLatestRef.call(void 0, onStepChange);
|
|
3502
|
+
const onTotalBalanceChangeRef = _chunkKE6CJVOVcjs.useLatestRef.call(void 0, onTotalBalanceChange);
|
|
3503
|
+
const onSmartAccountChangeRef = _chunkKE6CJVOVcjs.useLatestRef.call(void 0, onSmartAccountChange);
|
|
3504
|
+
const onEventRef = _chunkKE6CJVOVcjs.useLatestRef.call(void 0, onEvent);
|
|
3505
|
+
const onDepositSubmittedRef = _chunkKE6CJVOVcjs.useLatestRef.call(void 0, onDepositSubmitted);
|
|
3506
|
+
const onDepositCompleteRef = _chunkKE6CJVOVcjs.useLatestRef.call(void 0, onDepositComplete);
|
|
3507
|
+
const onDepositFailedRef = _chunkKE6CJVOVcjs.useLatestRef.call(void 0, onDepositFailed);
|
|
3508
|
+
const onErrorRef = _chunkKE6CJVOVcjs.useLatestRef.call(void 0, onError);
|
|
3378
3509
|
const hasInitialReownSession = Boolean(
|
|
3379
|
-
enableSolana ? _optionalChain([reownWallet, 'optionalAccess',
|
|
3510
|
+
enableSolana ? _optionalChain([reownWallet, 'optionalAccess', _93 => _93.isConnected]) || _optionalChain([reownWallet, 'optionalAccess', _94 => _94.address]) : _optionalChain([reownWallet, 'optionalAccess', _95 => _95.address])
|
|
3380
3511
|
);
|
|
3381
3512
|
const hasInitialWalletHydrationPending = Boolean(
|
|
3382
3513
|
dappAddress && (hasDappWalletClientProp && dappWalletClient === void 0 || reownWallet && !hasInitialReownSession && !reownWallet.isReady)
|
|
@@ -3386,21 +3517,25 @@ function DepositFlow({
|
|
|
3386
3517
|
const [totalBalanceUsd, setTotalBalanceUsd] = _react.useState.call(void 0, 0);
|
|
3387
3518
|
const [isConnectSelectionConfirmed, setIsConnectSelectionConfirmed] = _react.useState.call(void 0, false);
|
|
3388
3519
|
const [selectedWalletId, setSelectedWalletId] = _react.useState.call(void 0, null);
|
|
3520
|
+
const [polymarketBalances, setPolymarketBalances] = _react.useState.call(void 0, null);
|
|
3521
|
+
const [isPolymarketLoading, setIsPolymarketLoading] = _react.useState.call(void 0, false);
|
|
3522
|
+
const [polymarketError, setPolymarketError] = _react.useState.call(void 0, null);
|
|
3389
3523
|
const [hasQrAutoAdvanceGraceElapsed, setHasQrAutoAdvanceGraceElapsed] = _react.useState.call(void 0, () => !hasInitialWalletHydrationPending);
|
|
3390
3524
|
const flowModeRef = _react.useRef.call(void 0, null);
|
|
3525
|
+
const pendingPolymarketConnectRef = _react.useRef.call(void 0, false);
|
|
3391
3526
|
const portfolioAssetsRef = _react.useRef.call(void 0, []);
|
|
3392
3527
|
const stableWalletSignerRef = _react.useRef.call(void 0, null);
|
|
3393
3528
|
const stableWalletSelectionKeyRef = _react.useRef.call(void 0, null);
|
|
3394
3529
|
flowModeRef.current = flowMode;
|
|
3395
3530
|
const logFlow = _react.useCallback.call(void 0,
|
|
3396
3531
|
(message, data) => {
|
|
3397
|
-
|
|
3532
|
+
_chunkKE6CJVOVcjs.debugLog.call(void 0, debug, "deposit-flow", message, data);
|
|
3398
3533
|
},
|
|
3399
3534
|
[debug]
|
|
3400
3535
|
);
|
|
3401
3536
|
const logFlowError = _react.useCallback.call(void 0,
|
|
3402
3537
|
(message, error, data) => {
|
|
3403
|
-
|
|
3538
|
+
_chunkKE6CJVOVcjs.debugError.call(void 0, debug, "deposit-flow", message, error, data);
|
|
3404
3539
|
},
|
|
3405
3540
|
[debug]
|
|
3406
3541
|
);
|
|
@@ -3423,12 +3558,45 @@ function DepositFlow({
|
|
|
3423
3558
|
return null;
|
|
3424
3559
|
}, []);
|
|
3425
3560
|
const dappSwitchChain = _react.useMemo.call(void 0, () => {
|
|
3426
|
-
if (!_optionalChain([dappWalletClient, 'optionalAccess',
|
|
3561
|
+
if (!_optionalChain([dappWalletClient, 'optionalAccess', _96 => _96.switchChain])) return void 0;
|
|
3427
3562
|
return async (chainId) => {
|
|
3428
|
-
await _optionalChain([dappWalletClient, 'access',
|
|
3563
|
+
await _optionalChain([dappWalletClient, 'access', _97 => _97.switchChain, 'optionalCall', _98 => _98({ id: chainId })]);
|
|
3429
3564
|
};
|
|
3430
3565
|
}, [dappWalletClient]);
|
|
3431
|
-
const connectedWalletAddress = _nullishCoalesce(_optionalChain([dappWalletClient, 'optionalAccess',
|
|
3566
|
+
const connectedWalletAddress = _nullishCoalesce(_optionalChain([dappWalletClient, 'optionalAccess', _99 => _99.account, 'optionalAccess', _100 => _100.address]), () => ( null));
|
|
3567
|
+
const connectedPolymarketOwner = _nullishCoalesce(_nullishCoalesce(connectedWalletAddress, () => ( _optionalChain([reownWallet, 'optionalAccess', _101 => _101.address]))), () => ( null));
|
|
3568
|
+
_react.useEffect.call(void 0, () => {
|
|
3569
|
+
let active = true;
|
|
3570
|
+
async function loadPolymarketBalance(owner) {
|
|
3571
|
+
setIsPolymarketLoading(true);
|
|
3572
|
+
setPolymarketError(null);
|
|
3573
|
+
try {
|
|
3574
|
+
const balances = await _chunkZHLQMSQMcjs.fetchPolymarketBalances.call(void 0, {
|
|
3575
|
+
publicClient: _chunkKE6CJVOVcjs.getPublicClient.call(void 0, _chunkZHLQMSQMcjs.POLYMARKET_POLYGON_CHAIN_ID),
|
|
3576
|
+
owner
|
|
3577
|
+
});
|
|
3578
|
+
if (active) setPolymarketBalances(balances);
|
|
3579
|
+
} catch (err) {
|
|
3580
|
+
if (!active) return;
|
|
3581
|
+
setPolymarketBalances(null);
|
|
3582
|
+
setPolymarketError(
|
|
3583
|
+
err instanceof Error ? err.message : "Failed to load Polymarket balance"
|
|
3584
|
+
);
|
|
3585
|
+
} finally {
|
|
3586
|
+
if (active) setIsPolymarketLoading(false);
|
|
3587
|
+
}
|
|
3588
|
+
}
|
|
3589
|
+
if (!enablePolymarketMigration || !connectedPolymarketOwner) {
|
|
3590
|
+
setPolymarketBalances(null);
|
|
3591
|
+
setPolymarketError(null);
|
|
3592
|
+
setIsPolymarketLoading(false);
|
|
3593
|
+
return;
|
|
3594
|
+
}
|
|
3595
|
+
loadPolymarketBalance(connectedPolymarketOwner);
|
|
3596
|
+
return () => {
|
|
3597
|
+
active = false;
|
|
3598
|
+
};
|
|
3599
|
+
}, [enablePolymarketMigration, connectedPolymarketOwner]);
|
|
3432
3600
|
const walletOptions = _react.useMemo.call(void 0, () => {
|
|
3433
3601
|
const options = [];
|
|
3434
3602
|
const seen = /* @__PURE__ */ new Set();
|
|
@@ -3442,7 +3610,7 @@ function DepositFlow({
|
|
|
3442
3610
|
});
|
|
3443
3611
|
seen.add(id);
|
|
3444
3612
|
}
|
|
3445
|
-
if (enableSolana && _optionalChain([reownWallet, 'optionalAccess',
|
|
3613
|
+
if (enableSolana && _optionalChain([reownWallet, 'optionalAccess', _102 => _102.isConnected]) && reownWallet.isSolana && reownWallet.solanaAddress && dappAddress) {
|
|
3446
3614
|
const id = _nullishCoalesce(reownWallet.caipAddress, () => ( `solana:${reownWallet.solanaAddress}`));
|
|
3447
3615
|
if (!seen.has(id)) {
|
|
3448
3616
|
options.push({
|
|
@@ -3454,7 +3622,7 @@ function DepositFlow({
|
|
|
3454
3622
|
});
|
|
3455
3623
|
seen.add(id);
|
|
3456
3624
|
}
|
|
3457
|
-
} else if (_optionalChain([reownWallet, 'optionalAccess',
|
|
3625
|
+
} else if (_optionalChain([reownWallet, 'optionalAccess', _103 => _103.address]) && reownWallet.isConnected && reownWallet.walletClient && reownWallet.publicClient && !seen.has(`evm:${reownWallet.address.toLowerCase()}`)) {
|
|
3458
3626
|
const id = `evm:${reownWallet.address.toLowerCase()}`;
|
|
3459
3627
|
if (!seen.has(id)) {
|
|
3460
3628
|
options.push({
|
|
@@ -3471,20 +3639,20 @@ function DepositFlow({
|
|
|
3471
3639
|
}, [
|
|
3472
3640
|
connectedWalletAddress,
|
|
3473
3641
|
dappAddress,
|
|
3474
|
-
_optionalChain([reownWallet, 'optionalAccess',
|
|
3475
|
-
_optionalChain([reownWallet, 'optionalAccess',
|
|
3476
|
-
_optionalChain([reownWallet, 'optionalAccess',
|
|
3477
|
-
_optionalChain([reownWallet, 'optionalAccess',
|
|
3478
|
-
_optionalChain([reownWallet, 'optionalAccess',
|
|
3642
|
+
_optionalChain([reownWallet, 'optionalAccess', _104 => _104.address]),
|
|
3643
|
+
_optionalChain([reownWallet, 'optionalAccess', _105 => _105.isConnected]),
|
|
3644
|
+
_optionalChain([reownWallet, 'optionalAccess', _106 => _106.walletClient]),
|
|
3645
|
+
_optionalChain([reownWallet, 'optionalAccess', _107 => _107.publicClient]),
|
|
3646
|
+
_optionalChain([reownWallet, 'optionalAccess', _108 => _108.icon]),
|
|
3479
3647
|
enableSolana,
|
|
3480
|
-
_optionalChain([reownWallet, 'optionalAccess',
|
|
3481
|
-
_optionalChain([reownWallet, 'optionalAccess',
|
|
3482
|
-
_optionalChain([reownWallet, 'optionalAccess',
|
|
3648
|
+
_optionalChain([reownWallet, 'optionalAccess', _109 => _109.isSolana]),
|
|
3649
|
+
_optionalChain([reownWallet, 'optionalAccess', _110 => _110.solanaAddress]),
|
|
3650
|
+
_optionalChain([reownWallet, 'optionalAccess', _111 => _111.caipAddress])
|
|
3483
3651
|
]);
|
|
3484
|
-
const canAutoLock = _optionalChain([dappWalletClient, 'optionalAccess',
|
|
3652
|
+
const canAutoLock = _optionalChain([dappWalletClient, 'optionalAccess', _112 => _112.account]) && dappAddress && !reownWallet && !enablePolymarketMigration;
|
|
3485
3653
|
const hasWalletOptions = walletOptions.length > 0;
|
|
3486
3654
|
const hasReownSession = Boolean(
|
|
3487
|
-
enableSolana ? _optionalChain([reownWallet, 'optionalAccess',
|
|
3655
|
+
enableSolana ? _optionalChain([reownWallet, 'optionalAccess', _113 => _113.isConnected]) || _optionalChain([reownWallet, 'optionalAccess', _114 => _114.address]) : _optionalChain([reownWallet, 'optionalAccess', _115 => _115.address])
|
|
3488
3656
|
);
|
|
3489
3657
|
const isWalletHydrationPending = Boolean(
|
|
3490
3658
|
dappAddress && !hasWalletOptions && (hasDappWalletClientProp && dappWalletClient === void 0 || reownWallet && !hasReownSession && !reownWallet.isReady)
|
|
@@ -3502,7 +3670,7 @@ function DepositFlow({
|
|
|
3502
3670
|
return () => window.clearTimeout(timeout);
|
|
3503
3671
|
}, [isWalletHydrationPending]);
|
|
3504
3672
|
const walletSelectionKey = _react.useMemo.call(void 0, () => {
|
|
3505
|
-
if (flowMode !== "wallet") return null;
|
|
3673
|
+
if (flowMode !== "wallet" && flowMode !== "polymarket") return null;
|
|
3506
3674
|
if (canAutoLock) {
|
|
3507
3675
|
return getAddressKey(connectedWalletAddress);
|
|
3508
3676
|
}
|
|
@@ -3524,16 +3692,16 @@ function DepositFlow({
|
|
|
3524
3692
|
return {
|
|
3525
3693
|
ownerAddress: dappAddress,
|
|
3526
3694
|
walletClient: void 0,
|
|
3527
|
-
publicClient: _nullishCoalesce(dappPublicClient, () => (
|
|
3695
|
+
publicClient: _nullishCoalesce(dappPublicClient, () => ( _chunkKE6CJVOVcjs.getPublicClient.call(void 0, targetChain))),
|
|
3528
3696
|
switchChain: void 0
|
|
3529
3697
|
};
|
|
3530
3698
|
}
|
|
3531
3699
|
if (canAutoLock) {
|
|
3532
|
-
const fallbackChainId = _nullishCoalesce(_optionalChain([dappWalletClient, 'optionalAccess',
|
|
3700
|
+
const fallbackChainId = _nullishCoalesce(_optionalChain([dappWalletClient, 'optionalAccess', _116 => _116.chain, 'optionalAccess', _117 => _117.id]), () => ( targetChain));
|
|
3533
3701
|
return {
|
|
3534
3702
|
ownerAddress: dappWalletClient.account.address,
|
|
3535
3703
|
walletClient: dappWalletClient,
|
|
3536
|
-
publicClient: _nullishCoalesce(dappPublicClient, () => (
|
|
3704
|
+
publicClient: _nullishCoalesce(dappPublicClient, () => ( _chunkKE6CJVOVcjs.getPublicClient.call(void 0, fallbackChainId))),
|
|
3537
3705
|
switchChain: dappSwitchChain
|
|
3538
3706
|
};
|
|
3539
3707
|
}
|
|
@@ -3547,24 +3715,24 @@ function DepositFlow({
|
|
|
3547
3715
|
return {
|
|
3548
3716
|
ownerAddress: dappAddress,
|
|
3549
3717
|
walletClient: void 0,
|
|
3550
|
-
publicClient: _nullishCoalesce(dappPublicClient, () => (
|
|
3718
|
+
publicClient: _nullishCoalesce(dappPublicClient, () => ( _chunkKE6CJVOVcjs.getPublicClient.call(void 0, targetChain))),
|
|
3551
3719
|
switchChain: void 0
|
|
3552
3720
|
};
|
|
3553
3721
|
}
|
|
3554
|
-
if (selectedOption.kind === "connected" && _optionalChain([dappWalletClient, 'optionalAccess',
|
|
3555
|
-
const fallbackChainId = _nullishCoalesce(_optionalChain([dappWalletClient, 'optionalAccess',
|
|
3722
|
+
if (selectedOption.kind === "connected" && _optionalChain([dappWalletClient, 'optionalAccess', _118 => _118.account]) && selectedOption.address && dappWalletClient.account.address.toLowerCase() === selectedOption.address.toLowerCase()) {
|
|
3723
|
+
const fallbackChainId = _nullishCoalesce(_optionalChain([dappWalletClient, 'optionalAccess', _119 => _119.chain, 'optionalAccess', _120 => _120.id]), () => ( targetChain));
|
|
3556
3724
|
return {
|
|
3557
3725
|
ownerAddress: dappWalletClient.account.address,
|
|
3558
3726
|
walletClient: dappWalletClient,
|
|
3559
|
-
publicClient: _nullishCoalesce(dappPublicClient, () => (
|
|
3727
|
+
publicClient: _nullishCoalesce(dappPublicClient, () => ( _chunkKE6CJVOVcjs.getPublicClient.call(void 0, fallbackChainId))),
|
|
3560
3728
|
switchChain: dappSwitchChain
|
|
3561
3729
|
};
|
|
3562
3730
|
}
|
|
3563
|
-
if (selectedOption.kind === "external" && _optionalChain([reownWallet, 'optionalAccess',
|
|
3731
|
+
if (selectedOption.kind === "external" && _optionalChain([reownWallet, 'optionalAccess', _121 => _121.address]) && selectedOption.address && reownWallet.address.toLowerCase() === selectedOption.address.toLowerCase()) {
|
|
3564
3732
|
return {
|
|
3565
3733
|
ownerAddress: reownWallet.address,
|
|
3566
3734
|
walletClient: reownWallet.walletClient,
|
|
3567
|
-
publicClient: _nullishCoalesce(reownWallet.publicClient, () => (
|
|
3735
|
+
publicClient: _nullishCoalesce(reownWallet.publicClient, () => ( _chunkKE6CJVOVcjs.getPublicClient.call(void 0, targetChain))),
|
|
3568
3736
|
switchChain: reownWallet.switchChain
|
|
3569
3737
|
};
|
|
3570
3738
|
}
|
|
@@ -3582,7 +3750,7 @@ function DepositFlow({
|
|
|
3582
3750
|
targetChain
|
|
3583
3751
|
]);
|
|
3584
3752
|
_react.useEffect.call(void 0, () => {
|
|
3585
|
-
if (flowMode !== "wallet") {
|
|
3753
|
+
if (flowMode !== "wallet" && flowMode !== "polymarket") {
|
|
3586
3754
|
stableWalletSelectionKeyRef.current = null;
|
|
3587
3755
|
stableWalletSignerRef.current = null;
|
|
3588
3756
|
return;
|
|
@@ -3602,11 +3770,11 @@ function DepositFlow({
|
|
|
3602
3770
|
return {
|
|
3603
3771
|
ownerAddress: dappAddress,
|
|
3604
3772
|
walletClient: void 0,
|
|
3605
|
-
publicClient: _nullishCoalesce(dappPublicClient, () => (
|
|
3773
|
+
publicClient: _nullishCoalesce(dappPublicClient, () => ( _chunkKE6CJVOVcjs.getPublicClient.call(void 0, targetChain))),
|
|
3606
3774
|
switchChain: void 0
|
|
3607
3775
|
};
|
|
3608
3776
|
}
|
|
3609
|
-
if (flowMode !== "wallet") {
|
|
3777
|
+
if (flowMode !== "wallet" && flowMode !== "polymarket") {
|
|
3610
3778
|
return null;
|
|
3611
3779
|
}
|
|
3612
3780
|
if (walletSignerContext) {
|
|
@@ -3624,7 +3792,7 @@ function DepositFlow({
|
|
|
3624
3792
|
walletSignerContext,
|
|
3625
3793
|
walletSelectionKey
|
|
3626
3794
|
]);
|
|
3627
|
-
const sessionKeyAddress = _nullishCoalesce(_nullishCoalesce(dappAddress, () => ( _optionalChain([signerContext, 'optionalAccess',
|
|
3795
|
+
const sessionKeyAddress = _nullishCoalesce(_nullishCoalesce(dappAddress, () => ( _optionalChain([signerContext, 'optionalAccess', _122 => _122.ownerAddress]))), () => ( null));
|
|
3628
3796
|
const lastTargetRef = _react.useRef.call(void 0, null);
|
|
3629
3797
|
_react.useEffect.call(void 0, () => {
|
|
3630
3798
|
const prev = lastTargetRef.current;
|
|
@@ -3638,6 +3806,9 @@ function DepositFlow({
|
|
|
3638
3806
|
const handleBackFromAmount = _react.useCallback.call(void 0, () => {
|
|
3639
3807
|
setStep((prev) => {
|
|
3640
3808
|
if (prev.type !== "amount") return prev;
|
|
3809
|
+
if (_chunkZHLQMSQMcjs.isPolymarketAsset.call(void 0, prev.asset)) {
|
|
3810
|
+
return { type: "polymarket-source", smartAccount: prev.smartAccount };
|
|
3811
|
+
}
|
|
3641
3812
|
return { type: "select-asset", smartAccount: prev.smartAccount };
|
|
3642
3813
|
});
|
|
3643
3814
|
}, []);
|
|
@@ -3664,6 +3835,14 @@ function DepositFlow({
|
|
|
3664
3835
|
setIsConnectSelectionConfirmed(false);
|
|
3665
3836
|
}
|
|
3666
3837
|
}, [hasWalletOptions, reownWallet]);
|
|
3838
|
+
const handleBackFromPolymarketSource = _react.useCallback.call(void 0, () => {
|
|
3839
|
+
setFlowMode(null);
|
|
3840
|
+
setStep({ type: "setup" });
|
|
3841
|
+
if (hasWalletOptions || reownWallet) {
|
|
3842
|
+
hasNavigatedBackRef.current = true;
|
|
3843
|
+
setIsConnectSelectionConfirmed(false);
|
|
3844
|
+
}
|
|
3845
|
+
}, [hasWalletOptions, reownWallet]);
|
|
3667
3846
|
const handleBackFromSolanaAmount = _react.useCallback.call(void 0, () => {
|
|
3668
3847
|
setStep((prev) => {
|
|
3669
3848
|
if (prev.type !== "solana-amount") return prev;
|
|
@@ -3698,10 +3877,10 @@ function DepositFlow({
|
|
|
3698
3877
|
};
|
|
3699
3878
|
});
|
|
3700
3879
|
}, []);
|
|
3701
|
-
const stepIndex = step.type === "setup" ? 0 : step.type === "deposit-address" ? 1 : step.type === "select-asset" ? 1 : step.type === "solana-token-select" ? 1 : step.type === "solana-amount" ? 2 : step.type === "amount" ? 2 : step.type === "confirm" ? 3 : step.type === "solana-confirm" ? 3 : 4;
|
|
3702
|
-
const currentBackHandler = step.type === "deposit-address" ? handleBackFromDepositAddress : step.type === "select-asset" && signerContext && !canAutoLock ? handleBackFromSelectAsset : step.type === "solana-token-select" ? handleBackFromSolanaTokenSelect : step.type === "solana-amount" ? handleBackFromSolanaAmount : step.type === "solana-confirm" ? handleBackFromSolanaConfirm : step.type === "amount" ? handleBackFromAmount : step.type === "confirm" ? handleBackFromConfirm : void 0;
|
|
3880
|
+
const stepIndex = step.type === "setup" ? 0 : step.type === "deposit-address" ? 1 : step.type === "select-asset" ? 1 : step.type === "polymarket-source" ? 1 : step.type === "solana-token-select" ? 1 : step.type === "solana-amount" ? 2 : step.type === "amount" ? 2 : step.type === "confirm" ? 3 : step.type === "solana-confirm" ? 3 : 4;
|
|
3881
|
+
const currentBackHandler = step.type === "deposit-address" ? handleBackFromDepositAddress : step.type === "select-asset" && signerContext && !canAutoLock ? handleBackFromSelectAsset : step.type === "polymarket-source" ? handleBackFromPolymarketSource : step.type === "solana-token-select" ? handleBackFromSolanaTokenSelect : step.type === "solana-amount" ? handleBackFromSolanaAmount : step.type === "solana-confirm" ? handleBackFromSolanaConfirm : step.type === "amount" ? handleBackFromAmount : step.type === "confirm" ? handleBackFromConfirm : void 0;
|
|
3703
3882
|
_react.useEffect.call(void 0, () => {
|
|
3704
|
-
_optionalChain([onStepChangeRef, 'access',
|
|
3883
|
+
_optionalChain([onStepChangeRef, 'access', _123 => _123.current, 'optionalCall', _124 => _124(stepIndex, currentBackHandler)]);
|
|
3705
3884
|
}, [stepIndex, currentBackHandler, onStepChangeRef]);
|
|
3706
3885
|
const stepSendToken = step.type === "amount" ? step.asset.symbol : null;
|
|
3707
3886
|
const stepOpenEventKey = step.type === "select-asset" ? "select-asset" : step.type === "deposit-address" ? "deposit-address" : step.type === "amount" && stepSendToken ? `amount:${stepSendToken.toLowerCase()}` : null;
|
|
@@ -3716,23 +3895,23 @@ function DepositFlow({
|
|
|
3716
3895
|
}
|
|
3717
3896
|
lastStepOpenEventKeyRef.current = stepOpenEventKey;
|
|
3718
3897
|
if (step.type === "select-asset") {
|
|
3719
|
-
_optionalChain([onEventRef, 'access',
|
|
3898
|
+
_optionalChain([onEventRef, 'access', _125 => _125.current, 'optionalCall', _126 => _126({
|
|
3720
3899
|
type: "deposit_modal_connected_wallet_select_source_open",
|
|
3721
3900
|
total_balance_in_external_wallet: totalBalanceUsd,
|
|
3722
3901
|
pred_balance: totalBalanceUsd
|
|
3723
3902
|
})]);
|
|
3724
3903
|
} else if (step.type === "deposit-address") {
|
|
3725
|
-
const chainName =
|
|
3726
|
-
const tokenSymbol =
|
|
3727
|
-
_optionalChain([onEventRef, 'access',
|
|
3904
|
+
const chainName = _chunkR2HP743Tcjs.getChainName.call(void 0, targetChain);
|
|
3905
|
+
const tokenSymbol = _chunkR2HP743Tcjs.getTokenSymbol.call(void 0, targetToken, targetChain);
|
|
3906
|
+
_optionalChain([onEventRef, 'access', _127 => _127.current, 'optionalCall', _128 => _128({
|
|
3728
3907
|
type: "deposit_modal_transfer_crypto_open",
|
|
3729
3908
|
default_chain: chainName,
|
|
3730
3909
|
default_token: tokenSymbol,
|
|
3731
3910
|
pred_balance: totalBalanceUsd
|
|
3732
3911
|
})]);
|
|
3733
3912
|
} else if (step.type === "amount" && stepSendToken) {
|
|
3734
|
-
const receiveSymbol =
|
|
3735
|
-
_optionalChain([onEventRef, 'access',
|
|
3913
|
+
const receiveSymbol = _chunkR2HP743Tcjs.getTokenSymbol.call(void 0, targetToken, targetChain);
|
|
3914
|
+
_optionalChain([onEventRef, 'access', _129 => _129.current, 'optionalCall', _130 => _130({
|
|
3736
3915
|
type: "deposit_modal_connected_wallet_enter_value_open",
|
|
3737
3916
|
send_token: stepSendToken,
|
|
3738
3917
|
receive_token: receiveSymbol,
|
|
@@ -3765,13 +3944,17 @@ function DepositFlow({
|
|
|
3765
3944
|
targetToken
|
|
3766
3945
|
]);
|
|
3767
3946
|
_react.useEffect.call(void 0, () => {
|
|
3768
|
-
_optionalChain([onTotalBalanceChangeRef, 'access',
|
|
3947
|
+
_optionalChain([onTotalBalanceChangeRef, 'access', _131 => _131.current, 'optionalCall', _132 => _132(totalBalanceUsd)]);
|
|
3769
3948
|
}, [totalBalanceUsd, onTotalBalanceChangeRef]);
|
|
3770
3949
|
const isDepositAddressMode = flowMode === "deposit-address";
|
|
3771
3950
|
const isSolanaWalletMode = flowMode === "solana-wallet";
|
|
3951
|
+
const isPolymarketMode = flowMode === "polymarket";
|
|
3772
3952
|
const handleSelectProvider = _react.useCallback.call(void 0, () => {
|
|
3773
3953
|
setFlowMode("wallet");
|
|
3774
3954
|
}, []);
|
|
3955
|
+
const handleSelectPolymarket = _react.useCallback.call(void 0, () => {
|
|
3956
|
+
setFlowMode("polymarket");
|
|
3957
|
+
}, []);
|
|
3775
3958
|
const handleSelectSolanaWallet = _react.useCallback.call(void 0, () => {
|
|
3776
3959
|
setFlowMode("solana-wallet");
|
|
3777
3960
|
}, []);
|
|
@@ -3780,7 +3963,7 @@ function DepositFlow({
|
|
|
3780
3963
|
setStep({ type: "setup" });
|
|
3781
3964
|
}, []);
|
|
3782
3965
|
const handleNewDeposit = _react.useCallback.call(void 0, () => {
|
|
3783
|
-
_optionalChain([onSmartAccountChangeRef, 'access',
|
|
3966
|
+
_optionalChain([onSmartAccountChangeRef, 'access', _133 => _133.current, 'optionalCall', _134 => _134({ evm: null, solana: null })]);
|
|
3784
3967
|
setFlowMode(null);
|
|
3785
3968
|
setStep({ type: "setup" });
|
|
3786
3969
|
setIsConnectSelectionConfirmed(false);
|
|
@@ -3792,9 +3975,9 @@ function DepositFlow({
|
|
|
3792
3975
|
logFlow("setup:complete", {
|
|
3793
3976
|
smartAccount,
|
|
3794
3977
|
hasSolanaDepositAddress: Boolean(solanaDepositAddress),
|
|
3795
|
-
flowMode: isDepositAddressMode ? "deposit-address" : isSolanaWalletMode ? "solana-wallet" : "wallet"
|
|
3978
|
+
flowMode: isDepositAddressMode ? "deposit-address" : isSolanaWalletMode ? "solana-wallet" : isPolymarketMode ? "polymarket" : "wallet"
|
|
3796
3979
|
});
|
|
3797
|
-
_optionalChain([onSmartAccountChangeRef, 'access',
|
|
3980
|
+
_optionalChain([onSmartAccountChangeRef, 'access', _135 => _135.current, 'optionalCall', _136 => _136({
|
|
3798
3981
|
evm: smartAccount,
|
|
3799
3982
|
solana: _nullishCoalesce(solanaDepositAddress, () => ( null))
|
|
3800
3983
|
})]);
|
|
@@ -3812,16 +3995,27 @@ function DepositFlow({
|
|
|
3812
3995
|
solanaDepositAddress
|
|
3813
3996
|
});
|
|
3814
3997
|
} else {
|
|
3815
|
-
_optionalChain([onError, 'optionalCall',
|
|
3998
|
+
_optionalChain([onError, 'optionalCall', _137 => _137({
|
|
3816
3999
|
message: "Solana deposit address not available. Please try again.",
|
|
3817
4000
|
code: "SOLANA_SETUP_FAILED"
|
|
3818
4001
|
})]);
|
|
3819
4002
|
}
|
|
4003
|
+
} else if (isPolymarketMode) {
|
|
4004
|
+
setStep({
|
|
4005
|
+
type: "polymarket-source",
|
|
4006
|
+
smartAccount
|
|
4007
|
+
});
|
|
3820
4008
|
} else {
|
|
3821
4009
|
setStep({ type: "select-asset", smartAccount });
|
|
3822
4010
|
}
|
|
3823
4011
|
},
|
|
3824
|
-
[
|
|
4012
|
+
[
|
|
4013
|
+
isDepositAddressMode,
|
|
4014
|
+
isSolanaWalletMode,
|
|
4015
|
+
isPolymarketMode,
|
|
4016
|
+
logFlow,
|
|
4017
|
+
onSmartAccountChangeRef
|
|
4018
|
+
]
|
|
3825
4019
|
);
|
|
3826
4020
|
const handleDepositAddressSubmitted = _react.useCallback.call(void 0,
|
|
3827
4021
|
(data) => {
|
|
@@ -3830,7 +4024,7 @@ function DepositFlow({
|
|
|
3830
4024
|
sourceChain: data.sourceChain,
|
|
3831
4025
|
amount: data.amount
|
|
3832
4026
|
});
|
|
3833
|
-
_optionalChain([onDepositSubmittedRef, 'access',
|
|
4027
|
+
_optionalChain([onDepositSubmittedRef, 'access', _138 => _138.current, 'optionalCall', _139 => _139(data)]);
|
|
3834
4028
|
},
|
|
3835
4029
|
[logFlow, onDepositSubmittedRef]
|
|
3836
4030
|
);
|
|
@@ -3854,8 +4048,8 @@ function DepositFlow({
|
|
|
3854
4048
|
);
|
|
3855
4049
|
const handleSolanaAmountContinue = _react.useCallback.call(void 0,
|
|
3856
4050
|
(token, sourceAmount, inputAmountUsd) => {
|
|
3857
|
-
const targetSym =
|
|
3858
|
-
const isTargetStable =
|
|
4051
|
+
const targetSym = _chunkR2HP743Tcjs.getTokenSymbol.call(void 0, targetToken, targetChain);
|
|
4052
|
+
const isTargetStable = _chunkR2HP743Tcjs.isStablecoinSymbol.call(void 0, targetSym);
|
|
3859
4053
|
const targetTokenPriceUsd = isTargetStable ? 1 : getTokenPriceUsd(targetSym);
|
|
3860
4054
|
logFlow("solana:amount:continue", {
|
|
3861
4055
|
token: token.symbol,
|
|
@@ -3903,7 +4097,7 @@ function DepositFlow({
|
|
|
3903
4097
|
sourceDecimals: prev.token.decimals
|
|
3904
4098
|
};
|
|
3905
4099
|
});
|
|
3906
|
-
_optionalChain([onDepositSubmitted, 'optionalCall',
|
|
4100
|
+
_optionalChain([onDepositSubmitted, 'optionalCall', _140 => _140({
|
|
3907
4101
|
txHash,
|
|
3908
4102
|
sourceChain: "solana",
|
|
3909
4103
|
amount: amountUnits
|
|
@@ -3913,13 +4107,13 @@ function DepositFlow({
|
|
|
3913
4107
|
);
|
|
3914
4108
|
const handleConnected = _react.useCallback.call(void 0,
|
|
3915
4109
|
(addr, smartAccount) => {
|
|
3916
|
-
_optionalChain([onConnected, 'optionalCall',
|
|
4110
|
+
_optionalChain([onConnected, 'optionalCall', _141 => _141({ address: addr, smartAccount })]);
|
|
3917
4111
|
},
|
|
3918
4112
|
[onConnected]
|
|
3919
4113
|
);
|
|
3920
4114
|
const handleAssetContinue = _react.useCallback.call(void 0,
|
|
3921
4115
|
(asset) => {
|
|
3922
|
-
_optionalChain([onEvent, 'optionalCall',
|
|
4116
|
+
_optionalChain([onEvent, 'optionalCall', _142 => _142({
|
|
3923
4117
|
type: "deposit_modal_connected_wallet_select_source_cta_click",
|
|
3924
4118
|
total_balance_in_external_wallet: totalBalanceUsd,
|
|
3925
4119
|
pred_balance: totalBalanceUsd,
|
|
@@ -3939,10 +4133,24 @@ function DepositFlow({
|
|
|
3939
4133
|
},
|
|
3940
4134
|
[defaultAmount, onEvent, totalBalanceUsd]
|
|
3941
4135
|
);
|
|
4136
|
+
const handlePolymarketAssetContinue = _react.useCallback.call(void 0,
|
|
4137
|
+
(asset) => {
|
|
4138
|
+
setStep((prev) => {
|
|
4139
|
+
if (prev.type !== "polymarket-source") return prev;
|
|
4140
|
+
return {
|
|
4141
|
+
type: "amount",
|
|
4142
|
+
smartAccount: prev.smartAccount,
|
|
4143
|
+
asset,
|
|
4144
|
+
amount: defaultAmount
|
|
4145
|
+
};
|
|
4146
|
+
});
|
|
4147
|
+
},
|
|
4148
|
+
[defaultAmount]
|
|
4149
|
+
);
|
|
3942
4150
|
const handleAmountContinue = _react.useCallback.call(void 0,
|
|
3943
4151
|
(amount, targetAmount, balance, liquidityWarning) => {
|
|
3944
|
-
const targetSym =
|
|
3945
|
-
const isTargetStable =
|
|
4152
|
+
const targetSym = _chunkR2HP743Tcjs.getTokenSymbol.call(void 0, targetToken, targetChain);
|
|
4153
|
+
const isTargetStable = _chunkR2HP743Tcjs.isStablecoinSymbol.call(void 0, targetSym);
|
|
3946
4154
|
const targetTokenPriceUsd = isTargetStable ? 1 : getTokenPriceUsd(targetSym);
|
|
3947
4155
|
setStep((prev) => {
|
|
3948
4156
|
if (prev.type !== "amount") return prev;
|
|
@@ -3961,7 +4169,7 @@ function DepositFlow({
|
|
|
3961
4169
|
[targetToken, targetChain, getTokenPriceUsd]
|
|
3962
4170
|
);
|
|
3963
4171
|
const handleDepositSubmitted = _react.useCallback.call(void 0,
|
|
3964
|
-
(txHash, chainId, amount, token) => {
|
|
4172
|
+
(txHash, chainId, amount, token, options) => {
|
|
3965
4173
|
logFlow("evm:submitted", {
|
|
3966
4174
|
txHash,
|
|
3967
4175
|
sourceChain: chainId,
|
|
@@ -3977,7 +4185,9 @@ function DepositFlow({
|
|
|
3977
4185
|
sourceChain: chainId,
|
|
3978
4186
|
sourceToken: token,
|
|
3979
4187
|
amount,
|
|
3980
|
-
|
|
4188
|
+
sourceSymbol: _optionalChain([options, 'optionalAccess', _143 => _143.sourceSymbol]),
|
|
4189
|
+
sourceDecimals: _optionalChain([options, 'optionalAccess', _144 => _144.sourceDecimals]),
|
|
4190
|
+
directTransfer: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _145 => _145.directTransfer]), () => ( isSameRoute2(chainId, token, targetChain, targetToken)))
|
|
3981
4191
|
};
|
|
3982
4192
|
});
|
|
3983
4193
|
},
|
|
@@ -3985,28 +4195,28 @@ function DepositFlow({
|
|
|
3985
4195
|
);
|
|
3986
4196
|
const handleDepositSubmittedCallback = _react.useCallback.call(void 0,
|
|
3987
4197
|
(txHash, sourceChain, amount) => {
|
|
3988
|
-
_optionalChain([onDepositSubmittedRef, 'access',
|
|
4198
|
+
_optionalChain([onDepositSubmittedRef, 'access', _146 => _146.current, 'optionalCall', _147 => _147({ txHash, sourceChain, amount })]);
|
|
3989
4199
|
},
|
|
3990
4200
|
[onDepositSubmittedRef]
|
|
3991
4201
|
);
|
|
3992
4202
|
const handleDepositComplete = _react.useCallback.call(void 0,
|
|
3993
4203
|
(txHash, destinationTxHash, context) => {
|
|
3994
4204
|
logFlow("deposit:complete", { txHash, destinationTxHash, ...context });
|
|
3995
|
-
_optionalChain([onDepositCompleteRef, 'access',
|
|
4205
|
+
_optionalChain([onDepositCompleteRef, 'access', _148 => _148.current, 'optionalCall', _149 => _149({ txHash, destinationTxHash, ...context })]);
|
|
3996
4206
|
},
|
|
3997
4207
|
[logFlow, onDepositCompleteRef]
|
|
3998
4208
|
);
|
|
3999
4209
|
const handleDepositFailed = _react.useCallback.call(void 0,
|
|
4000
4210
|
(txHash, error) => {
|
|
4001
4211
|
logFlowError("deposit:failed", error, { txHash });
|
|
4002
|
-
_optionalChain([onDepositFailedRef, 'access',
|
|
4212
|
+
_optionalChain([onDepositFailedRef, 'access', _150 => _150.current, 'optionalCall', _151 => _151({ txHash, error })]);
|
|
4003
4213
|
},
|
|
4004
4214
|
[logFlowError, onDepositFailedRef]
|
|
4005
4215
|
);
|
|
4006
4216
|
const handleError = _react.useCallback.call(void 0,
|
|
4007
4217
|
(message, code) => {
|
|
4008
4218
|
logFlowError("flow:error", message, { code });
|
|
4009
|
-
_optionalChain([onErrorRef, 'access',
|
|
4219
|
+
_optionalChain([onErrorRef, 'access', _152 => _152.current, 'optionalCall', _153 => _153({ message, code })]);
|
|
4010
4220
|
},
|
|
4011
4221
|
[logFlowError, onErrorRef]
|
|
4012
4222
|
);
|
|
@@ -4020,6 +4230,30 @@ function DepositFlow({
|
|
|
4020
4230
|
}
|
|
4021
4231
|
return null;
|
|
4022
4232
|
}, [selectedWalletId, walletOptions]);
|
|
4233
|
+
const polymarketWalletId = _react.useMemo.call(void 0, () => {
|
|
4234
|
+
if (selectedWalletIdEffective && _optionalChain([walletOptions, 'access', _154 => _154.find, 'call', _155 => _155((option) => option.id === selectedWalletIdEffective), 'optionalAccess', _156 => _156.kind]) !== "solana") {
|
|
4235
|
+
return selectedWalletIdEffective;
|
|
4236
|
+
}
|
|
4237
|
+
return _nullishCoalesce(_optionalChain([walletOptions, 'access', _157 => _157.find, 'call', _158 => _158((option) => option.kind !== "solana"), 'optionalAccess', _159 => _159.id]), () => ( null));
|
|
4238
|
+
}, [selectedWalletIdEffective, walletOptions]);
|
|
4239
|
+
const handleConnectPolymarket = _react.useCallback.call(void 0, () => {
|
|
4240
|
+
pendingPolymarketConnectRef.current = true;
|
|
4241
|
+
if (hasWalletOptions && polymarketWalletId) {
|
|
4242
|
+
setSelectedWalletId(polymarketWalletId);
|
|
4243
|
+
handleSelectPolymarket();
|
|
4244
|
+
setIsConnectSelectionConfirmed(true);
|
|
4245
|
+
pendingPolymarketConnectRef.current = false;
|
|
4246
|
+
return;
|
|
4247
|
+
}
|
|
4248
|
+
const connect = _nullishCoalesce(onConnect, () => ( onRequestConnect));
|
|
4249
|
+
_optionalChain([connect, 'optionalCall', _160 => _160()]);
|
|
4250
|
+
}, [
|
|
4251
|
+
hasWalletOptions,
|
|
4252
|
+
polymarketWalletId,
|
|
4253
|
+
handleSelectPolymarket,
|
|
4254
|
+
onConnect,
|
|
4255
|
+
onRequestConnect
|
|
4256
|
+
]);
|
|
4023
4257
|
const walletOptionsKey = _react.useMemo.call(void 0,
|
|
4024
4258
|
() => walletOptions.map((option) => option.id).join(","),
|
|
4025
4259
|
[walletOptions]
|
|
@@ -4037,7 +4271,7 @@ function DepositFlow({
|
|
|
4037
4271
|
}
|
|
4038
4272
|
}, [walletOptionsKey]);
|
|
4039
4273
|
_react.useEffect.call(void 0, () => {
|
|
4040
|
-
if (!showConnectStep && isConnectSelectionConfirmed && flowMode === "wallet" && !signerContext) {
|
|
4274
|
+
if (!showConnectStep && isConnectSelectionConfirmed && (flowMode === "wallet" || flowMode === "polymarket") && !signerContext) {
|
|
4041
4275
|
setSelectedWalletId(null);
|
|
4042
4276
|
setIsConnectSelectionConfirmed(false);
|
|
4043
4277
|
setFlowMode(null);
|
|
@@ -4059,11 +4293,17 @@ function DepositFlow({
|
|
|
4059
4293
|
return;
|
|
4060
4294
|
}
|
|
4061
4295
|
if (hasWalletOptions) {
|
|
4062
|
-
const walletId = selectedWalletIdEffective;
|
|
4296
|
+
const walletId = pendingPolymarketConnectRef.current ? polymarketWalletId : selectedWalletIdEffective;
|
|
4063
4297
|
if (walletId) {
|
|
4298
|
+
if (enablePolymarketMigration && !pendingPolymarketConnectRef.current) {
|
|
4299
|
+
return;
|
|
4300
|
+
}
|
|
4064
4301
|
const selectedOption = walletOptions.find((o) => o.id === walletId);
|
|
4065
4302
|
setSelectedWalletId(walletId);
|
|
4066
|
-
if (
|
|
4303
|
+
if (pendingPolymarketConnectRef.current) {
|
|
4304
|
+
pendingPolymarketConnectRef.current = false;
|
|
4305
|
+
handleSelectPolymarket();
|
|
4306
|
+
} else if (enableSolana && _optionalChain([selectedOption, 'optionalAccess', _161 => _161.kind]) === "solana") {
|
|
4067
4307
|
handleSelectSolanaWallet();
|
|
4068
4308
|
} else {
|
|
4069
4309
|
handleSelectProvider();
|
|
@@ -4072,7 +4312,7 @@ function DepositFlow({
|
|
|
4072
4312
|
return;
|
|
4073
4313
|
}
|
|
4074
4314
|
}
|
|
4075
|
-
if (!hasWalletOptions && dappAddress && !hasReownSession && !dappWalletClient && hasQrAutoAdvanceGraceElapsed) {
|
|
4315
|
+
if (!enablePolymarketMigration && !hasWalletOptions && dappAddress && !hasReownSession && !dappWalletClient && hasQrAutoAdvanceGraceElapsed) {
|
|
4076
4316
|
handleSelectTransferCrypto();
|
|
4077
4317
|
setIsConnectSelectionConfirmed(true);
|
|
4078
4318
|
}
|
|
@@ -4081,23 +4321,35 @@ function DepositFlow({
|
|
|
4081
4321
|
hasReownSession,
|
|
4082
4322
|
hasQrAutoAdvanceGraceElapsed,
|
|
4083
4323
|
enableSolana,
|
|
4324
|
+
enablePolymarketMigration,
|
|
4084
4325
|
isConnectSelectionConfirmed,
|
|
4085
4326
|
flowMode,
|
|
4086
4327
|
selectedWalletIdEffective,
|
|
4328
|
+
polymarketWalletId,
|
|
4087
4329
|
dappAddress,
|
|
4088
4330
|
dappWalletClient,
|
|
4089
4331
|
walletOptions,
|
|
4090
4332
|
handleSelectProvider,
|
|
4333
|
+
handleSelectPolymarket,
|
|
4091
4334
|
handleSelectSolanaWallet,
|
|
4092
4335
|
handleSelectTransferCrypto
|
|
4093
4336
|
]);
|
|
4094
4337
|
if (showConnectStep) {
|
|
4095
4338
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-modal-body", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4096
|
-
|
|
4339
|
+
_chunkKE6CJVOVcjs.ConnectStep,
|
|
4097
4340
|
{
|
|
4098
4341
|
walletOptions,
|
|
4099
|
-
|
|
4100
|
-
onSelectWallet:
|
|
4342
|
+
enablePolymarketMigration,
|
|
4343
|
+
onSelectWallet: (walletId) => {
|
|
4344
|
+
setSelectedWalletId(walletId);
|
|
4345
|
+
const selectedOption = walletOptions.find((o) => o.id === walletId);
|
|
4346
|
+
if (enableSolana && _optionalChain([selectedOption, 'optionalAccess', _162 => _162.kind]) === "solana") {
|
|
4347
|
+
handleSelectSolanaWallet();
|
|
4348
|
+
} else {
|
|
4349
|
+
handleSelectProvider();
|
|
4350
|
+
}
|
|
4351
|
+
setIsConnectSelectionConfirmed(true);
|
|
4352
|
+
},
|
|
4101
4353
|
onSelectTransferCrypto: dappAddress ? () => {
|
|
4102
4354
|
handleSelectTransferCrypto();
|
|
4103
4355
|
setIsConnectSelectionConfirmed(true);
|
|
@@ -4105,20 +4357,7 @@ function DepositFlow({
|
|
|
4105
4357
|
onRequestConnect,
|
|
4106
4358
|
onConnect,
|
|
4107
4359
|
onDisconnect,
|
|
4108
|
-
|
|
4109
|
-
if (selectedWalletIdEffective) {
|
|
4110
|
-
setSelectedWalletId(selectedWalletIdEffective);
|
|
4111
|
-
}
|
|
4112
|
-
const selectedOption = walletOptions.find(
|
|
4113
|
-
(o) => o.id === selectedWalletIdEffective
|
|
4114
|
-
);
|
|
4115
|
-
if (enableSolana && _optionalChain([selectedOption, 'optionalAccess', _148 => _148.kind]) === "solana") {
|
|
4116
|
-
handleSelectSolanaWallet();
|
|
4117
|
-
} else {
|
|
4118
|
-
handleSelectProvider();
|
|
4119
|
-
}
|
|
4120
|
-
setIsConnectSelectionConfirmed(true);
|
|
4121
|
-
},
|
|
4360
|
+
onSelectPolymarket: handleConnectPolymarket,
|
|
4122
4361
|
connectButtonLabel
|
|
4123
4362
|
}
|
|
4124
4363
|
) });
|
|
@@ -4156,15 +4395,15 @@ function DepositFlow({
|
|
|
4156
4395
|
targetChain,
|
|
4157
4396
|
targetToken,
|
|
4158
4397
|
waitForFinalTx,
|
|
4159
|
-
hasPostBridgeActions: Boolean(_optionalChain([postBridgeActions, 'optionalAccess',
|
|
4398
|
+
hasPostBridgeActions: Boolean(_optionalChain([postBridgeActions, 'optionalAccess', _163 => _163.length])),
|
|
4160
4399
|
uiConfig,
|
|
4161
4400
|
onDepositSubmitted: handleDepositAddressSubmitted,
|
|
4162
4401
|
onDepositComplete: handleDepositComplete,
|
|
4163
4402
|
onDepositFailed: handleDepositFailed,
|
|
4164
4403
|
onCopyAddress: () => {
|
|
4165
|
-
const chainName =
|
|
4166
|
-
const tokenSymbol =
|
|
4167
|
-
_optionalChain([onEvent, 'optionalCall',
|
|
4404
|
+
const chainName = _chunkR2HP743Tcjs.getChainName.call(void 0, targetChain);
|
|
4405
|
+
const tokenSymbol = _chunkR2HP743Tcjs.getTokenSymbol.call(void 0, targetToken, targetChain);
|
|
4406
|
+
_optionalChain([onEvent, 'optionalCall', _164 => _164({
|
|
4168
4407
|
type: "deposit_modal_transfer_crypto_cta_click",
|
|
4169
4408
|
default_chain: chainName,
|
|
4170
4409
|
default_token: tokenSymbol,
|
|
@@ -4180,8 +4419,8 @@ function DepositFlow({
|
|
|
4180
4419
|
}
|
|
4181
4420
|
if (isSolanaWalletMode) {
|
|
4182
4421
|
if (!sessionKeyAddress) return null;
|
|
4183
|
-
const solanaAddr = _optionalChain([reownWallet, 'optionalAccess',
|
|
4184
|
-
const solanaProvider = _optionalChain([reownWallet, 'optionalAccess',
|
|
4422
|
+
const solanaAddr = _optionalChain([reownWallet, 'optionalAccess', _165 => _165.solanaAddress]);
|
|
4423
|
+
const solanaProvider = _optionalChain([reownWallet, 'optionalAccess', _166 => _166.solanaProvider]);
|
|
4185
4424
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-modal-body", children: [
|
|
4186
4425
|
step.type === "setup" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4187
4426
|
SetupStep,
|
|
@@ -4279,7 +4518,7 @@ function DepositFlow({
|
|
|
4279
4518
|
) })
|
|
4280
4519
|
] }) : null,
|
|
4281
4520
|
step.type === "processing" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4282
|
-
|
|
4521
|
+
_chunkKE6CJVOVcjs.ProcessingStep,
|
|
4283
4522
|
{
|
|
4284
4523
|
smartAccount: step.smartAccount,
|
|
4285
4524
|
solanaDepositAddress: step.solanaDepositAddress,
|
|
@@ -4292,7 +4531,7 @@ function DepositFlow({
|
|
|
4292
4531
|
sourceSymbol: step.sourceSymbol,
|
|
4293
4532
|
sourceDecimals: step.sourceDecimals,
|
|
4294
4533
|
waitForFinalTx,
|
|
4295
|
-
hasPostBridgeActions: Boolean(_optionalChain([postBridgeActions, 'optionalAccess',
|
|
4534
|
+
hasPostBridgeActions: Boolean(_optionalChain([postBridgeActions, 'optionalAccess', _167 => _167.length])),
|
|
4296
4535
|
service,
|
|
4297
4536
|
directTransfer: step.directTransfer,
|
|
4298
4537
|
onClose,
|
|
@@ -4305,17 +4544,18 @@ function DepositFlow({
|
|
|
4305
4544
|
)
|
|
4306
4545
|
] });
|
|
4307
4546
|
}
|
|
4308
|
-
if (!_optionalChain([signerContext, 'optionalAccess',
|
|
4547
|
+
if (!_optionalChain([signerContext, 'optionalAccess', _168 => _168.walletClient]) || !_optionalChain([signerContext, 'optionalAccess', _169 => _169.publicClient])) {
|
|
4309
4548
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-modal-body", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-step", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-loading-state", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-loading-text", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-loading-title", children: "Connecting wallet..." }) }) }) }) });
|
|
4310
4549
|
}
|
|
4311
4550
|
const ownerAddress = signerContext.ownerAddress;
|
|
4312
|
-
const ownerChainId = _nullishCoalesce(_nullishCoalesce(_optionalChain([signerContext, 'access',
|
|
4551
|
+
const ownerChainId = _nullishCoalesce(_nullishCoalesce(_optionalChain([signerContext, 'access', _170 => _170.walletClient, 'optionalAccess', _171 => _171.chain, 'optionalAccess', _172 => _172.id]), () => ( _optionalChain([signerContext, 'access', _173 => _173.publicClient, 'access', _174 => _174.chain, 'optionalAccess', _175 => _175.id]))), () => ( targetChain));
|
|
4313
4552
|
const getReadClientForChain = (chainId) => {
|
|
4314
|
-
if (_optionalChain([signerContext, 'access',
|
|
4553
|
+
if (_optionalChain([signerContext, 'access', _176 => _176.publicClient, 'access', _177 => _177.chain, 'optionalAccess', _178 => _178.id]) === chainId) {
|
|
4315
4554
|
return signerContext.publicClient;
|
|
4316
4555
|
}
|
|
4317
|
-
return
|
|
4556
|
+
return _chunkKE6CJVOVcjs.getPublicClient.call(void 0, chainId);
|
|
4318
4557
|
};
|
|
4558
|
+
const confirmPolymarketAsset = step.type === "confirm" && _chunkZHLQMSQMcjs.isPolymarketAsset.call(void 0, step.asset) ? step.asset : null;
|
|
4319
4559
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-modal-body", children: [
|
|
4320
4560
|
step.type === "setup" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4321
4561
|
SetupStep,
|
|
@@ -4356,12 +4596,23 @@ function DepositFlow({
|
|
|
4356
4596
|
} : void 0
|
|
4357
4597
|
}
|
|
4358
4598
|
),
|
|
4599
|
+
step.type === "polymarket-source" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4600
|
+
PolymarketMigrationStep,
|
|
4601
|
+
{
|
|
4602
|
+
safeAddress: _nullishCoalesce(_optionalChain([polymarketBalances, 'optionalAccess', _179 => _179.safeAddress]), () => ( null)),
|
|
4603
|
+
assets: _nullishCoalesce(_optionalChain([polymarketBalances, 'optionalAccess', _180 => _180.assets]), () => ( [])),
|
|
4604
|
+
loading: isPolymarketLoading,
|
|
4605
|
+
error: polymarketError,
|
|
4606
|
+
onContinue: handlePolymarketAssetContinue
|
|
4607
|
+
}
|
|
4608
|
+
),
|
|
4359
4609
|
step.type === "amount" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4360
4610
|
AmountStep,
|
|
4361
4611
|
{
|
|
4362
4612
|
walletClient: signerContext.walletClient,
|
|
4363
4613
|
publicClient: getReadClientForChain(step.asset.chainId),
|
|
4364
4614
|
address: ownerAddress,
|
|
4615
|
+
balanceAddress: step.asset.balanceAddress,
|
|
4365
4616
|
asset: step.asset,
|
|
4366
4617
|
defaultAmount: _nullishCoalesce(step.amount, () => ( defaultAmount)),
|
|
4367
4618
|
switchChain: signerContext.switchChain,
|
|
@@ -4371,8 +4622,8 @@ function DepositFlow({
|
|
|
4371
4622
|
service,
|
|
4372
4623
|
onContinue: handleAmountContinue,
|
|
4373
4624
|
onCtaClick: (ctaName) => {
|
|
4374
|
-
const receiveSymbol =
|
|
4375
|
-
_optionalChain([onEvent, 'optionalCall',
|
|
4625
|
+
const receiveSymbol = _chunkR2HP743Tcjs.getTokenSymbol.call(void 0, targetToken, targetChain);
|
|
4626
|
+
_optionalChain([onEvent, 'optionalCall', _181 => _181({
|
|
4376
4627
|
type: "deposit_modal_connected_wallet_enter_value_cta_click",
|
|
4377
4628
|
send_token: step.asset.symbol,
|
|
4378
4629
|
receive_token: receiveSymbol,
|
|
@@ -4398,13 +4649,32 @@ function DepositFlow({
|
|
|
4398
4649
|
targetToken,
|
|
4399
4650
|
switchChain: signerContext.switchChain,
|
|
4400
4651
|
liquidityWarning: step.liquidityWarning,
|
|
4652
|
+
onExecuteTransfer: confirmPolymarketAsset ? async (amountUnits) => {
|
|
4653
|
+
const result = await _chunkZHLQMSQMcjs.executePolymarketSafeTransfer.call(void 0, {
|
|
4654
|
+
walletClient: signerContext.walletClient,
|
|
4655
|
+
publicClient: getReadClientForChain(
|
|
4656
|
+
_chunkZHLQMSQMcjs.POLYMARKET_POLYGON_CHAIN_ID
|
|
4657
|
+
),
|
|
4658
|
+
safeAddress: confirmPolymarketAsset.polymarketSafeAddress,
|
|
4659
|
+
recipient: step.smartAccount,
|
|
4660
|
+
amount: amountUnits,
|
|
4661
|
+
tokenKind: confirmPolymarketAsset.polymarketTokenKind
|
|
4662
|
+
});
|
|
4663
|
+
return {
|
|
4664
|
+
txHash: result.txHash,
|
|
4665
|
+
sourceToken: result.sourceToken,
|
|
4666
|
+
sourceSymbol: result.sourceSymbol,
|
|
4667
|
+
sourceDecimals: 6,
|
|
4668
|
+
directTransfer: false
|
|
4669
|
+
};
|
|
4670
|
+
} : void 0,
|
|
4401
4671
|
onConfirm: handleDepositSubmitted,
|
|
4402
4672
|
onDepositSubmitted: handleDepositSubmittedCallback,
|
|
4403
4673
|
onError: handleError
|
|
4404
4674
|
}
|
|
4405
4675
|
),
|
|
4406
4676
|
step.type === "processing" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4407
|
-
|
|
4677
|
+
_chunkKE6CJVOVcjs.ProcessingStep,
|
|
4408
4678
|
{
|
|
4409
4679
|
smartAccount: step.smartAccount,
|
|
4410
4680
|
solanaDepositAddress: step.solanaDepositAddress,
|
|
@@ -4417,7 +4687,7 @@ function DepositFlow({
|
|
|
4417
4687
|
sourceSymbol: step.sourceSymbol,
|
|
4418
4688
|
sourceDecimals: step.sourceDecimals,
|
|
4419
4689
|
waitForFinalTx,
|
|
4420
|
-
hasPostBridgeActions: Boolean(_optionalChain([postBridgeActions, 'optionalAccess',
|
|
4690
|
+
hasPostBridgeActions: Boolean(_optionalChain([postBridgeActions, 'optionalAccess', _182 => _182.length])),
|
|
4421
4691
|
service,
|
|
4422
4692
|
directTransfer: step.directTransfer,
|
|
4423
4693
|
onClose,
|
|
@@ -4462,8 +4732,8 @@ function formatTimestamp2(iso) {
|
|
|
4462
4732
|
function resolveChainId(value) {
|
|
4463
4733
|
if (value === void 0 || value === null) return null;
|
|
4464
4734
|
if (typeof value === "number") return value;
|
|
4465
|
-
if (
|
|
4466
|
-
const parsed =
|
|
4735
|
+
if (_chunkKE6CJVOVcjs.isSolanaCaip2.call(void 0, value) || value === "solana") return "solana";
|
|
4736
|
+
const parsed = _chunkKE6CJVOVcjs.parseEvmChainId.call(void 0, value);
|
|
4467
4737
|
if (parsed !== null) return parsed;
|
|
4468
4738
|
const num = Number(value);
|
|
4469
4739
|
return Number.isFinite(num) ? num : null;
|
|
@@ -4481,7 +4751,7 @@ function resolveTokenSymbol(token, chainId) {
|
|
|
4481
4751
|
}
|
|
4482
4752
|
}
|
|
4483
4753
|
if (chainId !== null && chainId !== void 0 && chainId !== "solana" && /^0x[a-fA-F0-9]{40}$/.test(token)) {
|
|
4484
|
-
const sym =
|
|
4754
|
+
const sym = _chunkR2HP743Tcjs.getTokenSymbol.call(void 0, token, chainId);
|
|
4485
4755
|
if (sym !== "Token") return sym;
|
|
4486
4756
|
}
|
|
4487
4757
|
return shortenHash(token);
|
|
@@ -4501,7 +4771,7 @@ function formatAmount(rawAmount, token, chainId) {
|
|
|
4501
4771
|
decimals = 9;
|
|
4502
4772
|
}
|
|
4503
4773
|
} else if (/^0x[a-fA-F0-9]{40}$/.test(token)) {
|
|
4504
|
-
decimals =
|
|
4774
|
+
decimals = _chunkR2HP743Tcjs.getTokenDecimalsByAddress.call(void 0, token, chainId);
|
|
4505
4775
|
}
|
|
4506
4776
|
}
|
|
4507
4777
|
try {
|
|
@@ -4520,7 +4790,7 @@ function formatAmount(rawAmount, token, chainId) {
|
|
|
4520
4790
|
}
|
|
4521
4791
|
function getTxExplorerUrl(txHash, chainId) {
|
|
4522
4792
|
if (!chainId) return null;
|
|
4523
|
-
const base =
|
|
4793
|
+
const base = _chunkR2HP743Tcjs.getExplorerUrl.call(void 0, chainId);
|
|
4524
4794
|
if (!base) return null;
|
|
4525
4795
|
return `${base}/tx/${txHash}`;
|
|
4526
4796
|
}
|
|
@@ -4622,10 +4892,10 @@ function HistoryRow({ deposit }) {
|
|
|
4622
4892
|
const status = normalizeStatus(deposit.status, deposit.isSpam);
|
|
4623
4893
|
const sourceChainId = resolveChainId(deposit.chain);
|
|
4624
4894
|
const targetChainId = resolveChainId(deposit.targetChain);
|
|
4625
|
-
const sourceChainName = sourceChainId ?
|
|
4626
|
-
const targetChainName = targetChainId ?
|
|
4627
|
-
const sourceChainIcon = sourceChainId ?
|
|
4628
|
-
const targetChainIcon = targetChainId ?
|
|
4895
|
+
const sourceChainName = sourceChainId ? _chunkR2HP743Tcjs.getChainName.call(void 0, sourceChainId) : null;
|
|
4896
|
+
const targetChainName = targetChainId ? _chunkR2HP743Tcjs.getChainName.call(void 0, targetChainId) : null;
|
|
4897
|
+
const sourceChainIcon = sourceChainId ? _chunkR2HP743Tcjs.getChainIcon.call(void 0, sourceChainId) : void 0;
|
|
4898
|
+
const targetChainIcon = targetChainId ? _chunkR2HP743Tcjs.getChainIcon.call(void 0, targetChainId) : void 0;
|
|
4629
4899
|
const sourceSymbol = resolveTokenSymbol(deposit.token, sourceChainId);
|
|
4630
4900
|
const targetSymbol = resolveTokenSymbol(deposit.targetToken, targetChainId);
|
|
4631
4901
|
const rawAmount = _nullishCoalesce(deposit.sourceAmount, () => ( deposit.amount));
|
|
@@ -4700,7 +4970,7 @@ DepositHistoryPanel.displayName = "DepositHistoryPanel";
|
|
|
4700
4970
|
// src/DepositModal.tsx
|
|
4701
4971
|
|
|
4702
4972
|
var ReownDepositInner = _react.lazy.call(void 0,
|
|
4703
|
-
() => Promise.resolve().then(() => _interopRequireWildcard(require("./DepositModalReown-
|
|
4973
|
+
() => Promise.resolve().then(() => _interopRequireWildcard(require("./DepositModalReown-SVVA3OZ6.cjs"))).then((m) => ({ default: m.DepositModalReown }))
|
|
4704
4974
|
);
|
|
4705
4975
|
function sortByCreatedAtDesc(items) {
|
|
4706
4976
|
return [...items].sort((a, b) => {
|
|
@@ -4748,13 +5018,14 @@ function DepositModalInner({
|
|
|
4748
5018
|
sourceToken,
|
|
4749
5019
|
defaultAmount,
|
|
4750
5020
|
recipient,
|
|
4751
|
-
backendUrl =
|
|
5021
|
+
backendUrl = _chunkR2HP743Tcjs.DEFAULT_BACKEND_URL,
|
|
4752
5022
|
solanaRpcUrl,
|
|
4753
|
-
signerAddress =
|
|
5023
|
+
signerAddress = _chunkR2HP743Tcjs.DEFAULT_SIGNER_ADDRESS,
|
|
4754
5024
|
sessionChainIds,
|
|
4755
5025
|
forceRegister = false,
|
|
4756
5026
|
waitForFinalTx = true,
|
|
4757
5027
|
enableSolana = true,
|
|
5028
|
+
enablePolymarketMigration = false,
|
|
4758
5029
|
postBridgeActions,
|
|
4759
5030
|
outputTokenRules,
|
|
4760
5031
|
rejectUnmapped,
|
|
@@ -4778,11 +5049,11 @@ function DepositModalInner({
|
|
|
4778
5049
|
debug
|
|
4779
5050
|
}) {
|
|
4780
5051
|
const modalRef = _react.useRef.call(void 0, null);
|
|
4781
|
-
const onReadyRef =
|
|
5052
|
+
const onReadyRef = _chunkKE6CJVOVcjs.useLatestRef.call(void 0, onReady);
|
|
4782
5053
|
const [currentStepIndex, setCurrentStepIndex] = _react.useState.call(void 0, 0);
|
|
4783
5054
|
const [totalBalanceUsd, setTotalBalanceUsd] = _react.useState.call(void 0, null);
|
|
4784
5055
|
const backHandlerRef = _react.useRef.call(void 0, void 0);
|
|
4785
|
-
const showHistoryButton = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess',
|
|
5056
|
+
const showHistoryButton = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess', _183 => _183.showHistoryButton]), () => ( false));
|
|
4786
5057
|
const [activeEvmAccount, setActiveEvmAccount] = _react.useState.call(void 0, null);
|
|
4787
5058
|
const [activeSolanaAccount, setActiveSolanaAccount] = _react.useState.call(void 0,
|
|
4788
5059
|
null
|
|
@@ -4797,10 +5068,10 @@ function DepositModalInner({
|
|
|
4797
5068
|
const solanaCursorRef = _react.useRef.call(void 0, null);
|
|
4798
5069
|
const historyStaleRef = _react.useRef.call(void 0, false);
|
|
4799
5070
|
const historyLoadedRef = _react.useRef.call(void 0, false);
|
|
4800
|
-
const targetChain =
|
|
4801
|
-
const sourceChain = sourceChainProp ?
|
|
5071
|
+
const targetChain = _chunkR2HP743Tcjs.getChainId.call(void 0, targetChainProp);
|
|
5072
|
+
const sourceChain = sourceChainProp ? _chunkR2HP743Tcjs.getChainId.call(void 0, sourceChainProp) : void 0;
|
|
4802
5073
|
const service = _react.useMemo.call(void 0,
|
|
4803
|
-
() =>
|
|
5074
|
+
() => _chunkKE6CJVOVcjs.createDepositService.call(void 0, backendUrl, {
|
|
4804
5075
|
debug,
|
|
4805
5076
|
debugScope: "service:deposit"
|
|
4806
5077
|
}),
|
|
@@ -4808,7 +5079,7 @@ function DepositModalInner({
|
|
|
4808
5079
|
);
|
|
4809
5080
|
_react.useEffect.call(void 0, () => {
|
|
4810
5081
|
if (isOpen && modalRef.current) {
|
|
4811
|
-
|
|
5082
|
+
_chunkKE6CJVOVcjs.applyTheme.call(void 0, modalRef.current, theme);
|
|
4812
5083
|
}
|
|
4813
5084
|
}, [isOpen, theme]);
|
|
4814
5085
|
_react.useEffect.call(void 0, () => {
|
|
@@ -4816,7 +5087,7 @@ function DepositModalInner({
|
|
|
4816
5087
|
}, [solanaRpcUrl]);
|
|
4817
5088
|
_react.useEffect.call(void 0, () => {
|
|
4818
5089
|
if (isOpen) {
|
|
4819
|
-
_optionalChain([onReadyRef, 'access',
|
|
5090
|
+
_optionalChain([onReadyRef, 'access', _184 => _184.current, 'optionalCall', _185 => _185()]);
|
|
4820
5091
|
}
|
|
4821
5092
|
}, [isOpen, onReadyRef]);
|
|
4822
5093
|
_react.useEffect.call(void 0, () => {
|
|
@@ -4835,7 +5106,7 @@ function DepositModalInner({
|
|
|
4835
5106
|
setTotalBalanceUsd(balance2);
|
|
4836
5107
|
}, []);
|
|
4837
5108
|
const handleBack = _react.useCallback.call(void 0, () => {
|
|
4838
|
-
_optionalChain([backHandlerRef, 'access',
|
|
5109
|
+
_optionalChain([backHandlerRef, 'access', _186 => _186.current, 'optionalCall', _187 => _187()]);
|
|
4839
5110
|
}, []);
|
|
4840
5111
|
const handleSmartAccountChange = _react.useCallback.call(void 0,
|
|
4841
5112
|
({ evm, solana }) => {
|
|
@@ -4940,26 +5211,26 @@ function DepositModalInner({
|
|
|
4940
5211
|
fetchHistory("initial");
|
|
4941
5212
|
}
|
|
4942
5213
|
}, [historyOpen, fetchHistory]);
|
|
4943
|
-
const onDepositSubmittedRef =
|
|
4944
|
-
const onDepositCompleteRef =
|
|
4945
|
-
const onDepositFailedRef =
|
|
5214
|
+
const onDepositSubmittedRef = _chunkKE6CJVOVcjs.useLatestRef.call(void 0, onDepositSubmitted);
|
|
5215
|
+
const onDepositCompleteRef = _chunkKE6CJVOVcjs.useLatestRef.call(void 0, onDepositComplete);
|
|
5216
|
+
const onDepositFailedRef = _chunkKE6CJVOVcjs.useLatestRef.call(void 0, onDepositFailed);
|
|
4946
5217
|
const handleDepositSubmitted = _react.useCallback.call(void 0,
|
|
4947
5218
|
(data) => {
|
|
4948
|
-
_optionalChain([onDepositSubmittedRef, 'access',
|
|
5219
|
+
_optionalChain([onDepositSubmittedRef, 'access', _188 => _188.current, 'optionalCall', _189 => _189(data)]);
|
|
4949
5220
|
if (showHistoryButton) markHistoryStale();
|
|
4950
5221
|
},
|
|
4951
5222
|
[onDepositSubmittedRef, showHistoryButton, markHistoryStale]
|
|
4952
5223
|
);
|
|
4953
5224
|
const handleDepositComplete = _react.useCallback.call(void 0,
|
|
4954
5225
|
(data) => {
|
|
4955
|
-
_optionalChain([onDepositCompleteRef, 'access',
|
|
5226
|
+
_optionalChain([onDepositCompleteRef, 'access', _190 => _190.current, 'optionalCall', _191 => _191(data)]);
|
|
4956
5227
|
if (showHistoryButton) markHistoryStale();
|
|
4957
5228
|
},
|
|
4958
5229
|
[onDepositCompleteRef, showHistoryButton, markHistoryStale]
|
|
4959
5230
|
);
|
|
4960
5231
|
const handleDepositFailed = _react.useCallback.call(void 0,
|
|
4961
5232
|
(data) => {
|
|
4962
|
-
_optionalChain([onDepositFailedRef, 'access',
|
|
5233
|
+
_optionalChain([onDepositFailedRef, 'access', _192 => _192.current, 'optionalCall', _193 => _193(data)]);
|
|
4963
5234
|
if (showHistoryButton) markHistoryStale();
|
|
4964
5235
|
},
|
|
4965
5236
|
[onDepositFailedRef, showHistoryButton, markHistoryStale]
|
|
@@ -4978,15 +5249,15 @@ function DepositModalInner({
|
|
|
4978
5249
|
historyLoadedRef.current = false;
|
|
4979
5250
|
}
|
|
4980
5251
|
}, [isOpen]);
|
|
4981
|
-
const showLogo = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess',
|
|
4982
|
-
const showStepper = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess',
|
|
4983
|
-
const showBackButton = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess',
|
|
4984
|
-
const balance = _optionalChain([uiConfig, 'optionalAccess',
|
|
4985
|
-
const logoUrl = _nullishCoalesce(_optionalChain([branding, 'optionalAccess',
|
|
4986
|
-
const title = _nullishCoalesce(_optionalChain([branding, 'optionalAccess',
|
|
5252
|
+
const showLogo = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess', _194 => _194.showLogo]), () => ( false));
|
|
5253
|
+
const showStepper = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess', _195 => _195.showStepper]), () => ( false));
|
|
5254
|
+
const showBackButton = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess', _196 => _196.showBackButton]), () => ( true));
|
|
5255
|
+
const balance = _optionalChain([uiConfig, 'optionalAccess', _197 => _197.balance]);
|
|
5256
|
+
const logoUrl = _nullishCoalesce(_optionalChain([branding, 'optionalAccess', _198 => _198.logoUrl]), () => ( "https://github.com/rhinestonewtf.png"));
|
|
5257
|
+
const title = _nullishCoalesce(_optionalChain([branding, 'optionalAccess', _199 => _199.title]), () => ( "Deposit"));
|
|
4987
5258
|
const canGoBack = currentStepIndex > 0 && currentStepIndex < 4 && backHandlerRef.current !== void 0;
|
|
4988
5259
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4989
|
-
|
|
5260
|
+
_chunkKE6CJVOVcjs.Modal,
|
|
4990
5261
|
{
|
|
4991
5262
|
isOpen,
|
|
4992
5263
|
onClose,
|
|
@@ -5079,7 +5350,7 @@ function DepositModalInner({
|
|
|
5079
5350
|
balance.title,
|
|
5080
5351
|
":"
|
|
5081
5352
|
] }),
|
|
5082
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-modal-header-balance-value", children: _nullishCoalesce(balance.amount, () => ( (totalBalanceUsd !== null ?
|
|
5353
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-modal-header-balance-value", children: _nullishCoalesce(balance.amount, () => ( (totalBalanceUsd !== null ? _chunkKE6CJVOVcjs.currencyFormatter.format(totalBalanceUsd) : null))) })
|
|
5083
5354
|
] })
|
|
5084
5355
|
] }),
|
|
5085
5356
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-modal-header-nav-right", children: [
|
|
@@ -5160,6 +5431,7 @@ function DepositModalInner({
|
|
|
5160
5431
|
forceRegister,
|
|
5161
5432
|
waitForFinalTx,
|
|
5162
5433
|
enableSolana,
|
|
5434
|
+
enablePolymarketMigration,
|
|
5163
5435
|
reownWallet,
|
|
5164
5436
|
onConnect,
|
|
5165
5437
|
onDisconnect,
|