@rhinestone/deposit-modal 0.3.0-alpha.12 → 0.3.0-alpha.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +59 -0
- package/dist/{DepositModalReown-EC4DJ3EC.cjs → DepositModalReown-CXPRZRXL.cjs} +6 -6
- package/dist/{DepositModalReown-QOTUF4JC.mjs → DepositModalReown-HBAWSK6K.mjs} +3 -3
- package/dist/{WithdrawModalReown-QEQPCSWT.mjs → WithdrawModalReown-EEWQRENY.mjs} +3 -3
- package/dist/{WithdrawModalReown-Z5JVENP6.cjs → WithdrawModalReown-T3TPJIME.cjs} +6 -6
- package/dist/{chunk-WVE3JN3C.mjs → chunk-6K4JHM2D.mjs} +343 -50
- package/dist/{chunk-YI63OMXN.cjs → chunk-6RCOF3XU.cjs} +57 -57
- package/dist/{chunk-2TWQGPPB.cjs → chunk-DZNXG5JK.cjs} +372 -79
- package/dist/{chunk-7MZNQ4C2.mjs → chunk-EC63ZHY4.mjs} +2 -2
- package/dist/{chunk-HR6BABPX.mjs → chunk-HZBO2SIZ.mjs} +1389 -393
- package/dist/{chunk-FGVSNARE.cjs → chunk-PWV2UJP3.cjs} +2 -2
- package/dist/{chunk-I5G5ULRP.cjs → chunk-SEOQ66FW.cjs} +1281 -285
- package/dist/{chunk-QXIJLRKC.mjs → chunk-YB3JPWJW.mjs} +1 -1
- package/dist/deposit.cjs +3 -3
- package/dist/deposit.d.cts +2 -2
- package/dist/deposit.d.ts +2 -2
- package/dist/deposit.mjs +2 -2
- package/dist/index.cjs +4 -4
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.mjs +3 -3
- package/dist/styles.css +465 -1
- package/dist/{types-D6wrO4Ow.d.cts → types-C8i2ebY1.d.cts} +25 -0
- package/dist/{types-D6wrO4Ow.d.ts → types-C8i2ebY1.d.ts} +25 -0
- package/dist/withdraw.cjs +3 -3
- package/dist/withdraw.d.cts +2 -2
- package/dist/withdraw.d.ts +2 -2
- package/dist/withdraw.mjs +2 -2
- package/package.json +3 -3
|
@@ -47,7 +47,12 @@
|
|
|
47
47
|
|
|
48
48
|
|
|
49
49
|
|
|
50
|
-
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
var _chunkDZNXG5JKcjs = require('./chunk-DZNXG5JK.cjs');
|
|
51
56
|
|
|
52
57
|
|
|
53
58
|
|
|
@@ -84,6 +89,13 @@ var _react = require('react');
|
|
|
84
89
|
|
|
85
90
|
// src/DepositFlow.tsx
|
|
86
91
|
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
|
|
87
99
|
var _viem = require('viem');
|
|
88
100
|
|
|
89
101
|
// src/components/steps/AssetSelectStep.tsx
|
|
@@ -108,13 +120,13 @@ function AssetSelectStep({
|
|
|
108
120
|
const [error, setError] = _react.useState.call(void 0, null);
|
|
109
121
|
const defaultAssetId = _react.useMemo.call(void 0, () => {
|
|
110
122
|
if (!defaultSourceChain || !defaultSourceToken) return null;
|
|
111
|
-
return
|
|
123
|
+
return _chunkDZNXG5JKcjs.getAssetId.call(void 0, {
|
|
112
124
|
chainId: defaultSourceChain,
|
|
113
125
|
token: defaultSourceToken
|
|
114
126
|
});
|
|
115
127
|
}, [defaultSourceChain, defaultSourceToken]);
|
|
116
|
-
const onTotalBalanceComputedRef =
|
|
117
|
-
const onAssetsLoadedRef =
|
|
128
|
+
const onTotalBalanceComputedRef = _chunkDZNXG5JKcjs.useLatestRef.call(void 0, onTotalBalanceComputed);
|
|
129
|
+
const onAssetsLoadedRef = _chunkDZNXG5JKcjs.useLatestRef.call(void 0, onAssetsLoaded);
|
|
118
130
|
_react.useEffect.call(void 0, () => {
|
|
119
131
|
let active = true;
|
|
120
132
|
function emitAssetsUpdate(currentAssets) {
|
|
@@ -135,7 +147,7 @@ function AssetSelectStep({
|
|
|
135
147
|
try {
|
|
136
148
|
const portfolio = await service.fetchPortfolio(address);
|
|
137
149
|
if (!active) return;
|
|
138
|
-
const portfolioAssets =
|
|
150
|
+
const portfolioAssets = _chunkDZNXG5JKcjs.portfolioToAssets.call(void 0, portfolio.tokens);
|
|
139
151
|
setAssets(portfolioAssets);
|
|
140
152
|
emitAssetsUpdate(portfolioAssets);
|
|
141
153
|
const hasNative = portfolioAssets.some(
|
|
@@ -211,7 +223,7 @@ function AssetSelectStep({
|
|
|
211
223
|
const raw = _viem.formatUnits.call(void 0, BigInt(asset.balance), asset.decimals);
|
|
212
224
|
const numeric = Number(raw);
|
|
213
225
|
if (!Number.isFinite(numeric)) return raw;
|
|
214
|
-
return
|
|
226
|
+
return _chunkDZNXG5JKcjs.tokenFormatter.format(numeric);
|
|
215
227
|
} catch (e3) {
|
|
216
228
|
return asset.balance;
|
|
217
229
|
}
|
|
@@ -219,20 +231,20 @@ function AssetSelectStep({
|
|
|
219
231
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-screen", children: [
|
|
220
232
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-screen-body", children: [
|
|
221
233
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
222
|
-
|
|
234
|
+
_chunkDZNXG5JKcjs.BodyHeader,
|
|
223
235
|
{
|
|
224
|
-
icon: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
236
|
+
icon: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkDZNXG5JKcjs.WalletIcon, {}),
|
|
225
237
|
title: "Your assets",
|
|
226
238
|
subtitle: "Select source assets to transfer"
|
|
227
239
|
}
|
|
228
240
|
),
|
|
229
241
|
loading && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-loading-state", style: { padding: "40px 12px" }, children: [
|
|
230
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
242
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkDZNXG5JKcjs.Spinner, { className: "rs-text-tertiary" }),
|
|
231
243
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-text-sm rs-text-tertiary", children: "Loading balances" })
|
|
232
244
|
] }),
|
|
233
|
-
error && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
245
|
+
error && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkDZNXG5JKcjs.Callout, { variant: "error", children: error }),
|
|
234
246
|
!loading && !error && rows.length === 0 && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-empty-state", children: [
|
|
235
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
247
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkDZNXG5JKcjs.WalletIcon, { className: "rs-empty-icon" }),
|
|
236
248
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-empty-text", children: "No funds in connected wallet" }),
|
|
237
249
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-empty-address", children: [
|
|
238
250
|
address.slice(0, 6),
|
|
@@ -299,14 +311,14 @@ function AssetSelectStep({
|
|
|
299
311
|
] })
|
|
300
312
|
] })
|
|
301
313
|
] }),
|
|
302
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-asset-balance", children: asset.balanceUsd !== void 0 && asset.balanceUsd > 0 ?
|
|
314
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-asset-balance", children: asset.balanceUsd !== void 0 && asset.balanceUsd > 0 ? _chunkDZNXG5JKcjs.currencyFormatter.format(asset.balanceUsd) : tokenAmount !== "--" ? `${tokenAmount} ${asset.symbol}` : "--" })
|
|
303
315
|
]
|
|
304
316
|
},
|
|
305
317
|
asset.id
|
|
306
318
|
);
|
|
307
319
|
}) }),
|
|
308
320
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
309
|
-
|
|
321
|
+
_chunkDZNXG5JKcjs.Button,
|
|
310
322
|
{
|
|
311
323
|
onClick: () => selectedAsset && onContinue(selectedAsset),
|
|
312
324
|
disabled: !selectedAsset,
|
|
@@ -315,7 +327,7 @@ function AssetSelectStep({
|
|
|
315
327
|
}
|
|
316
328
|
)
|
|
317
329
|
] }),
|
|
318
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
330
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkDZNXG5JKcjs.PoweredBy, {})
|
|
319
331
|
] });
|
|
320
332
|
}
|
|
321
333
|
async function fetchNativeAssets(address, publicClient, existing) {
|
|
@@ -323,7 +335,7 @@ async function fetchNativeAssets(address, publicClient, existing) {
|
|
|
323
335
|
const connectedChainId = _optionalChain([publicClient, 'access', _9 => _9.chain, 'optionalAccess', _10 => _10.id]);
|
|
324
336
|
if (!connectedChainId) return [];
|
|
325
337
|
if (!_chunk7JIDIX27cjs.SOURCE_CHAINS.some((chain) => chain.id === connectedChainId)) return [];
|
|
326
|
-
const id =
|
|
338
|
+
const id = _chunkDZNXG5JKcjs.getAssetId.call(void 0, {
|
|
327
339
|
chainId: connectedChainId,
|
|
328
340
|
token: _chunk7JIDIX27cjs.NATIVE_TOKEN_ADDRESS
|
|
329
341
|
});
|
|
@@ -520,7 +532,7 @@ function AmountStep({
|
|
|
520
532
|
const balanceTarget = _nullishCoalesce(balanceAddress, () => ( address));
|
|
521
533
|
if (!balanceTarget || !publicClient) return;
|
|
522
534
|
try {
|
|
523
|
-
const bal =
|
|
535
|
+
const bal = _chunkDZNXG5JKcjs.isNativeAsset.call(void 0, asset) ? await publicClient.getBalance({ address: balanceTarget }) : await publicClient.readContract({
|
|
524
536
|
address: asset.token,
|
|
525
537
|
abi: _viem.erc20Abi,
|
|
526
538
|
functionName: "balanceOf",
|
|
@@ -541,7 +553,7 @@ function AmountStep({
|
|
|
541
553
|
hasAttemptedSwitch.current = true;
|
|
542
554
|
switchChain(asset.chainId).catch((err) => {
|
|
543
555
|
const raw = err instanceof Error ? err.message : "Failed to switch chain";
|
|
544
|
-
setError(
|
|
556
|
+
setError(_chunkDZNXG5JKcjs.formatUserError.call(void 0, raw));
|
|
545
557
|
});
|
|
546
558
|
}
|
|
547
559
|
}, [chainMismatch, switchChain, asset.chainId]);
|
|
@@ -594,7 +606,7 @@ function AmountStep({
|
|
|
594
606
|
const raw = _viem.formatUnits.call(void 0, balance, asset.decimals);
|
|
595
607
|
const numeric = Number(raw);
|
|
596
608
|
if (!Number.isFinite(numeric)) return raw;
|
|
597
|
-
return
|
|
609
|
+
return _chunkDZNXG5JKcjs.tokenFormatter.format(numeric);
|
|
598
610
|
} catch (e8) {
|
|
599
611
|
return "\u2026";
|
|
600
612
|
}
|
|
@@ -713,7 +725,7 @@ function AmountStep({
|
|
|
713
725
|
const targetTokenIcon = _chunk7JIDIX27cjs.getTokenIcon.call(void 0, targetSymbol);
|
|
714
726
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-screen", children: [
|
|
715
727
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-screen-body rs-screen-body--gap-32", children: [
|
|
716
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
728
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkDZNXG5JKcjs.BodyHeader, { icon: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkDZNXG5JKcjs.WalletIcon, {}), title: "Wallet deposit" }),
|
|
717
729
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-amount-section", children: [
|
|
718
730
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-amount-display", children: [
|
|
719
731
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
@@ -733,13 +745,13 @@ function AmountStep({
|
|
|
733
745
|
" available",
|
|
734
746
|
balanceUsd !== null && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
735
747
|
" (~",
|
|
736
|
-
|
|
748
|
+
_chunkDZNXG5JKcjs.currencyFormatter.format(balanceUsd),
|
|
737
749
|
")"
|
|
738
750
|
] })
|
|
739
751
|
] }),
|
|
740
752
|
minDepositUsd !== null && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "rs-amount-meta-minimum", children: [
|
|
741
753
|
"Min. deposit ",
|
|
742
|
-
|
|
754
|
+
_chunkDZNXG5JKcjs.currencyFormatter.format(minDepositUsd)
|
|
743
755
|
] })
|
|
744
756
|
] })
|
|
745
757
|
] }),
|
|
@@ -780,12 +792,12 @@ function AmountStep({
|
|
|
780
792
|
] }),
|
|
781
793
|
balanceAfterUsd !== null && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-amount-detail-row", children: [
|
|
782
794
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: "Balance after deposit" }),
|
|
783
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-amount-detail-value", children:
|
|
795
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-amount-detail-value", children: _chunkDZNXG5JKcjs.currencyFormatter.format(balanceAfterUsd) })
|
|
784
796
|
] })
|
|
785
797
|
] }),
|
|
786
|
-
error && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
798
|
+
error && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkDZNXG5JKcjs.Callout, { variant: "error", children: error }),
|
|
787
799
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
788
|
-
|
|
800
|
+
_chunkDZNXG5JKcjs.Button,
|
|
789
801
|
{
|
|
790
802
|
onClick: handleContinue,
|
|
791
803
|
fullWidth: true,
|
|
@@ -796,7 +808,7 @@ function AmountStep({
|
|
|
796
808
|
}
|
|
797
809
|
)
|
|
798
810
|
] }),
|
|
799
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
811
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkDZNXG5JKcjs.PoweredBy, {})
|
|
800
812
|
] });
|
|
801
813
|
}
|
|
802
814
|
|
|
@@ -867,7 +879,7 @@ function ConfirmStep({
|
|
|
867
879
|
hasAttemptedSwitch.current = true;
|
|
868
880
|
switchChain(asset.chainId).catch((err) => {
|
|
869
881
|
const raw = err instanceof Error ? err.message : "Failed to switch chain";
|
|
870
|
-
setError(
|
|
882
|
+
setError(_chunkDZNXG5JKcjs.formatUserError.call(void 0, raw));
|
|
871
883
|
});
|
|
872
884
|
}
|
|
873
885
|
}, [chainMismatch, switchChain, asset.chainId]);
|
|
@@ -914,7 +926,7 @@ function ConfirmStep({
|
|
|
914
926
|
const result = await executeTransfer(amountUnits);
|
|
915
927
|
hash = result.txHash;
|
|
916
928
|
resolvedSourceToken = result.sourceToken;
|
|
917
|
-
} else if (
|
|
929
|
+
} else if (_chunkDZNXG5JKcjs.isNativeAsset.call(void 0, asset)) {
|
|
918
930
|
hash = await walletClient.sendTransaction({
|
|
919
931
|
account,
|
|
920
932
|
chain,
|
|
@@ -935,7 +947,7 @@ function ConfirmStep({
|
|
|
935
947
|
onConfirm(hash, asset.chainId, amountUnits.toString(), resolvedSourceToken);
|
|
936
948
|
} catch (err) {
|
|
937
949
|
const raw = err instanceof Error ? err.message : "Transfer failed";
|
|
938
|
-
const message =
|
|
950
|
+
const message = _chunkDZNXG5JKcjs.formatUserError.call(void 0, raw);
|
|
939
951
|
setError(message);
|
|
940
952
|
_optionalChain([onError, 'optionalCall', _28 => _28(message, "TRANSFER_ERROR")]);
|
|
941
953
|
} finally {
|
|
@@ -944,7 +956,7 @@ function ConfirmStep({
|
|
|
944
956
|
};
|
|
945
957
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-screen", children: [
|
|
946
958
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-screen-body rs-screen-body--gap-32", children: [
|
|
947
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
959
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkDZNXG5JKcjs.BodyHeader, { icon: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkDZNXG5JKcjs.WalletIcon, {}), title: "Review deposit" }),
|
|
948
960
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-review-details", children: [
|
|
949
961
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-review-detail-row", children: [
|
|
950
962
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: "Source chain" }),
|
|
@@ -996,13 +1008,13 @@ function ConfirmStep({
|
|
|
996
1008
|
children: "$0.04"
|
|
997
1009
|
}
|
|
998
1010
|
),
|
|
999
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1011
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkDZNXG5JKcjs.Tooltip, { content: feeTooltip, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-review-detail-info", "aria-label": "Fee info", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkDZNXG5JKcjs.InfoIcon, {}) }) })
|
|
1000
1012
|
] })
|
|
1001
1013
|
] })
|
|
1002
1014
|
] }),
|
|
1003
|
-
error && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1015
|
+
error && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkDZNXG5JKcjs.Callout, { variant: "error", children: error }),
|
|
1004
1016
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1005
|
-
|
|
1017
|
+
_chunkDZNXG5JKcjs.Button,
|
|
1006
1018
|
{
|
|
1007
1019
|
onClick: handleConfirm,
|
|
1008
1020
|
loading: isSubmitting,
|
|
@@ -1013,7 +1025,7 @@ function ConfirmStep({
|
|
|
1013
1025
|
}
|
|
1014
1026
|
)
|
|
1015
1027
|
] }),
|
|
1016
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1028
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkDZNXG5JKcjs.PoweredBy, {})
|
|
1017
1029
|
] });
|
|
1018
1030
|
}
|
|
1019
1031
|
|
|
@@ -1036,9 +1048,9 @@ var INITIAL_POLL_INTERVAL = 3e3;
|
|
|
1036
1048
|
var MAX_POLL_INTERVAL = 3e4;
|
|
1037
1049
|
var BACKOFF_MULTIPLIER = 1.5;
|
|
1038
1050
|
function isEventForTx(event, txHash) {
|
|
1039
|
-
const eventTxHash =
|
|
1051
|
+
const eventTxHash = _chunkDZNXG5JKcjs.getEventTxHash.call(void 0, event);
|
|
1040
1052
|
if (!eventTxHash) return false;
|
|
1041
|
-
return
|
|
1053
|
+
return _chunkDZNXG5JKcjs.txRefsMatch.call(void 0, eventTxHash, txHash);
|
|
1042
1054
|
}
|
|
1043
1055
|
function truncateHash(hash) {
|
|
1044
1056
|
return `${hash.slice(0, 4)}\u2026${hash.slice(-4)}`;
|
|
@@ -1088,7 +1100,7 @@ function formatBridgeFailedMessage(event) {
|
|
|
1088
1100
|
}
|
|
1089
1101
|
return "Bridge failed";
|
|
1090
1102
|
}
|
|
1091
|
-
var txLinkIcon = /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1103
|
+
var txLinkIcon = /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkDZNXG5JKcjs.ExternalLinkIcon, { className: "rs-deposit-notification-link-icon" });
|
|
1092
1104
|
function DepositNotification({
|
|
1093
1105
|
deposit,
|
|
1094
1106
|
smartAccount,
|
|
@@ -1115,7 +1127,7 @@ function DepositNotification({
|
|
|
1115
1127
|
const pollIntervalRef = _react.useRef.call(void 0, INITIAL_POLL_INTERVAL);
|
|
1116
1128
|
const pollTimeoutRef = _react.useRef.call(void 0, null);
|
|
1117
1129
|
const completedRef = _react.useRef.call(void 0, _nullishCoalesce(directTransfer, () => ( false)));
|
|
1118
|
-
const depositContextRef =
|
|
1130
|
+
const depositContextRef = _chunkDZNXG5JKcjs.useLatestRef.call(void 0, {
|
|
1119
1131
|
amount,
|
|
1120
1132
|
sourceChain,
|
|
1121
1133
|
sourceToken: token,
|
|
@@ -1123,8 +1135,8 @@ function DepositNotification({
|
|
|
1123
1135
|
targetToken,
|
|
1124
1136
|
hasPostBridgeActions
|
|
1125
1137
|
});
|
|
1126
|
-
const onCompleteRef =
|
|
1127
|
-
const onFailedRef =
|
|
1138
|
+
const onCompleteRef = _chunkDZNXG5JKcjs.useLatestRef.call(void 0, onComplete);
|
|
1139
|
+
const onFailedRef = _chunkDZNXG5JKcjs.useLatestRef.call(void 0, onFailed);
|
|
1128
1140
|
const handleComplete = _react.useCallback.call(void 0,
|
|
1129
1141
|
(destTxHash) => {
|
|
1130
1142
|
if (completedRef.current) return;
|
|
@@ -1228,7 +1240,7 @@ function DepositNotification({
|
|
|
1228
1240
|
const destExplorerUrl = destinationTxHash ? _chunk7JIDIX27cjs.getExplorerTxUrl.call(void 0, targetChain, destinationTxHash) : null;
|
|
1229
1241
|
const title = status === "complete" ? "Deposit completed" : status === "failed" ? "Deposit failed" : "Deposit received and processing\u2026";
|
|
1230
1242
|
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.";
|
|
1231
|
-
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,
|
|
1243
|
+
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, _chunkDZNXG5JKcjs.CheckIcon, {}) }) : status === "failed" ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-deposit-notification-badge rs-deposit-notification-badge--failed", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkDZNXG5JKcjs.CloseIcon, {}) }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-deposit-notification-badge rs-deposit-notification-badge--processing", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkDZNXG5JKcjs.Spinner, {}) });
|
|
1232
1244
|
const showClose = status !== "processing";
|
|
1233
1245
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1234
1246
|
"div",
|
|
@@ -1247,7 +1259,7 @@ function DepositNotification({
|
|
|
1247
1259
|
className: "rs-deposit-notification-close",
|
|
1248
1260
|
onClick: () => onDismiss(deposit.id),
|
|
1249
1261
|
"aria-label": "Dismiss",
|
|
1250
|
-
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1262
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkDZNXG5JKcjs.CloseIcon, {})
|
|
1251
1263
|
}
|
|
1252
1264
|
)
|
|
1253
1265
|
] }),
|
|
@@ -1263,7 +1275,7 @@ function DepositNotification({
|
|
|
1263
1275
|
"aria-expanded": expanded,
|
|
1264
1276
|
children: [
|
|
1265
1277
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: expanded ? "See less details" : "See more details" }),
|
|
1266
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1278
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkDZNXG5JKcjs.ChevronDownIcon, { className: "rs-deposit-notification-toggle-chevron" })
|
|
1267
1279
|
]
|
|
1268
1280
|
}
|
|
1269
1281
|
),
|
|
@@ -1612,10 +1624,10 @@ function DepositAddressStep({
|
|
|
1612
1624
|
return;
|
|
1613
1625
|
}
|
|
1614
1626
|
const event = status.lastEvent;
|
|
1615
|
-
const eventTxHash =
|
|
1627
|
+
const eventTxHash = _chunkDZNXG5JKcjs.isDepositEvent.call(void 0, event) ? _nullishCoalesce(_chunkDZNXG5JKcjs.getEventTxHash.call(void 0, event), () => ( null)) : null;
|
|
1616
1628
|
if (baselineTxHashRef.current === void 0) {
|
|
1617
1629
|
baselineTxHashRef.current = eventTxHash;
|
|
1618
|
-
} else if (eventTxHash && (!baselineTxHashRef.current || !
|
|
1630
|
+
} else if (eventTxHash && (!baselineTxHashRef.current || !_chunkDZNXG5JKcjs.txRefsMatch.call(void 0, eventTxHash, baselineTxHashRef.current))) {
|
|
1619
1631
|
const details = getDepositEventDetails(event);
|
|
1620
1632
|
const chainId = _nullishCoalesce(details.chainId, () => ( "unknown"));
|
|
1621
1633
|
const amount = _nullishCoalesce(details.amount, () => ( "0"));
|
|
@@ -1688,7 +1700,7 @@ function DepositAddressStep({
|
|
|
1688
1700
|
const qrIconSrc = _chunk7JIDIX27cjs.getChainIcon.call(void 0, sourceChainId);
|
|
1689
1701
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-screen rs-step--with-notifications", children: [
|
|
1690
1702
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-screen-body", children: [
|
|
1691
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1703
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkDZNXG5JKcjs.BodyHeader, { icon: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkDZNXG5JKcjs.TransferCryptoIcon, {}), title: "Transfer crypto" }),
|
|
1692
1704
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-deposit-address-selectors", children: [
|
|
1693
1705
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-deposit-address-dropdown", ref: chainDropdownRef, children: [
|
|
1694
1706
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-deposit-address-dropdown-label", children: "Supported chain" }),
|
|
@@ -1712,7 +1724,7 @@ function DepositAddressStep({
|
|
|
1712
1724
|
}
|
|
1713
1725
|
),
|
|
1714
1726
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: _chunk7JIDIX27cjs.getChainName.call(void 0, sourceChainId) }),
|
|
1715
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1727
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkDZNXG5JKcjs.ChevronDownIcon, { className: "rs-deposit-address-dropdown-chevron" })
|
|
1716
1728
|
]
|
|
1717
1729
|
}
|
|
1718
1730
|
),
|
|
@@ -1743,8 +1755,8 @@ function DepositAddressStep({
|
|
|
1743
1755
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "rs-deposit-address-min", children: [
|
|
1744
1756
|
"Min.$",
|
|
1745
1757
|
(_nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess', _74 => _74.minDepositUsd]), () => ( 0.1))).toFixed(2),
|
|
1746
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1747
|
-
|
|
1758
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkDZNXG5JKcjs.Tooltip, { content: "Minimum deposit amount required for the selected chain.", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1759
|
+
_chunkDZNXG5JKcjs.InfoIcon,
|
|
1748
1760
|
{
|
|
1749
1761
|
className: "rs-deposit-address-min-icon",
|
|
1750
1762
|
"aria-hidden": "true"
|
|
@@ -1772,7 +1784,7 @@ function DepositAddressStep({
|
|
|
1772
1784
|
}
|
|
1773
1785
|
),
|
|
1774
1786
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: sourceTokenSymbol }),
|
|
1775
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1787
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkDZNXG5JKcjs.ChevronDownIcon, { className: "rs-deposit-address-dropdown-chevron" })
|
|
1776
1788
|
]
|
|
1777
1789
|
}
|
|
1778
1790
|
),
|
|
@@ -1824,7 +1836,7 @@ function DepositAddressStep({
|
|
|
1824
1836
|
alignItems: "center",
|
|
1825
1837
|
justifyContent: "center"
|
|
1826
1838
|
},
|
|
1827
|
-
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1839
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkDZNXG5JKcjs.Spinner, {})
|
|
1828
1840
|
}
|
|
1829
1841
|
),
|
|
1830
1842
|
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, QRCode, { value: displayAddress, size: 200, iconSrc: qrIconSrc })
|
|
@@ -1835,7 +1847,7 @@ function DepositAddressStep({
|
|
|
1835
1847
|
}
|
|
1836
1848
|
),
|
|
1837
1849
|
isUpdating ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "output", { className: "rs-deposit-address-updating", children: [
|
|
1838
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1850
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkDZNXG5JKcjs.Spinner, { className: "rs-spinner--sm" }),
|
|
1839
1851
|
"Updating deposit details\u2026"
|
|
1840
1852
|
] }) : /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1841
1853
|
"button",
|
|
@@ -1844,7 +1856,7 @@ function DepositAddressStep({
|
|
|
1844
1856
|
className: "rs-deposit-address-copy",
|
|
1845
1857
|
onClick: handleCopy,
|
|
1846
1858
|
children: [
|
|
1847
|
-
copied ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1859
|
+
copied ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkDZNXG5JKcjs.CheckIcon, {}) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkDZNXG5JKcjs.CopyIcon, {}),
|
|
1848
1860
|
copied ? "Copied!" : "Copy address"
|
|
1849
1861
|
]
|
|
1850
1862
|
}
|
|
@@ -1869,16 +1881,16 @@ function DepositAddressStep({
|
|
|
1869
1881
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-price-impact-label", children: "Price impact" }),
|
|
1870
1882
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-price-impact-label", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "strong", { children: "0.00%" }) }),
|
|
1871
1883
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1872
|
-
|
|
1884
|
+
_chunkDZNXG5JKcjs.Tooltip,
|
|
1873
1885
|
{
|
|
1874
1886
|
className: "rs-price-impact-info",
|
|
1875
1887
|
content: "Price impact is the difference between expected and execution price, due to trade size and liquidity.",
|
|
1876
|
-
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1888
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkDZNXG5JKcjs.InfoIcon, { "aria-hidden": "true" })
|
|
1877
1889
|
}
|
|
1878
1890
|
)
|
|
1879
1891
|
] }),
|
|
1880
1892
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1881
|
-
|
|
1893
|
+
_chunkDZNXG5JKcjs.ChevronDownIcon,
|
|
1882
1894
|
{
|
|
1883
1895
|
className: "rs-price-impact-chevron",
|
|
1884
1896
|
"aria-hidden": "true"
|
|
@@ -1889,29 +1901,29 @@ function DepositAddressStep({
|
|
|
1889
1901
|
),
|
|
1890
1902
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-price-impact-panel", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-price-impact-panel-inner", children: [
|
|
1891
1903
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-price-impact-row", children: [
|
|
1892
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-price-impact-row-icon", "aria-hidden": "true", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1904
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-price-impact-row-icon", "aria-hidden": "true", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkDZNXG5JKcjs.PercentIcon, {}) }),
|
|
1893
1905
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "rs-price-impact-label", children: [
|
|
1894
1906
|
"Max slippage: ",
|
|
1895
1907
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "strong", { children: "0.2%" })
|
|
1896
1908
|
] }),
|
|
1897
1909
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1898
|
-
|
|
1910
|
+
_chunkDZNXG5JKcjs.Tooltip,
|
|
1899
1911
|
{
|
|
1900
1912
|
className: "rs-price-impact-info",
|
|
1901
1913
|
content: "Slippage accounts for price changes during execution. Slippage is adjusted per pair to ensure reliable execution.",
|
|
1902
|
-
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1914
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkDZNXG5JKcjs.InfoIcon, { "aria-hidden": "true" })
|
|
1903
1915
|
}
|
|
1904
1916
|
)
|
|
1905
1917
|
] }),
|
|
1906
1918
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-price-impact-row", children: [
|
|
1907
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-price-impact-row-icon", "aria-hidden": "true", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1919
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-price-impact-row-icon", "aria-hidden": "true", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkDZNXG5JKcjs.ClockIcon, {}) }),
|
|
1908
1920
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "rs-price-impact-label", children: [
|
|
1909
1921
|
"Processing time: ",
|
|
1910
1922
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "strong", { children: "< 1 min" })
|
|
1911
1923
|
] })
|
|
1912
1924
|
] }),
|
|
1913
1925
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-price-impact-row", children: [
|
|
1914
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-price-impact-row-icon", "aria-hidden": "true", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1926
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-price-impact-row-icon", "aria-hidden": "true", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkDZNXG5JKcjs.PlusCircleIcon, {}) }),
|
|
1915
1927
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "rs-price-impact-label", children: [
|
|
1916
1928
|
"Max deposit:",
|
|
1917
1929
|
" ",
|
|
@@ -1943,11 +1955,675 @@ function DepositAddressStep({
|
|
|
1943
1955
|
},
|
|
1944
1956
|
deposit.id
|
|
1945
1957
|
)) }),
|
|
1946
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1958
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkDZNXG5JKcjs.PoweredBy, {})
|
|
1947
1959
|
] });
|
|
1948
1960
|
}
|
|
1949
1961
|
DepositAddressStep.displayName = "DepositAddressStep";
|
|
1950
1962
|
|
|
1963
|
+
// src/components/steps/FiatOnrampStep.tsx
|
|
1964
|
+
|
|
1965
|
+
|
|
1966
|
+
// src/components/steps/SwappedIframeStep.tsx
|
|
1967
|
+
|
|
1968
|
+
|
|
1969
|
+
// src/components/steps/SwappedOrderTracker.tsx
|
|
1970
|
+
|
|
1971
|
+
var STEP_LABELS = [
|
|
1972
|
+
"Payment received",
|
|
1973
|
+
null,
|
|
1974
|
+
"Processing App deposit",
|
|
1975
|
+
"Deposit successful"
|
|
1976
|
+
];
|
|
1977
|
+
function SwappedOrderTracker({
|
|
1978
|
+
amount,
|
|
1979
|
+
currency = "USDC",
|
|
1980
|
+
chainLabel = "Base",
|
|
1981
|
+
stepStates,
|
|
1982
|
+
terminal = null,
|
|
1983
|
+
onRetry
|
|
1984
|
+
}) {
|
|
1985
|
+
const formattedAmount = formatTrackerAmount(amount);
|
|
1986
|
+
const title = terminal ? terminal.kind === "cancelled" ? "Order cancelled" : "Deposit failed" : formattedAmount ? `Depositing ${formattedAmount} ${currency}` : `Depositing ${currency}`;
|
|
1987
|
+
const labels = [
|
|
1988
|
+
STEP_LABELS[0],
|
|
1989
|
+
`${currency} received on ${chainLabel}`,
|
|
1990
|
+
STEP_LABELS[2],
|
|
1991
|
+
STEP_LABELS[3]
|
|
1992
|
+
];
|
|
1993
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-screen rs-swapped-tracker", children: [
|
|
1994
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-screen-body rs-screen-body--gap-32", children: [
|
|
1995
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkDZNXG5JKcjs.BodyHeader, { icon: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkDZNXG5JKcjs.HandCoinsIcon, {}), title }),
|
|
1996
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "ol", { className: "rs-swapped-tracker-steps", children: labels.map((label, idx) => {
|
|
1997
|
+
const status = stepStates[idx];
|
|
1998
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1999
|
+
"li",
|
|
2000
|
+
{
|
|
2001
|
+
className: `rs-swapped-tracker-step rs-swapped-tracker-step--${status}`,
|
|
2002
|
+
children: [
|
|
2003
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-swapped-tracker-step-label", children: label }),
|
|
2004
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2005
|
+
"span",
|
|
2006
|
+
{
|
|
2007
|
+
className: "rs-swapped-tracker-step-marker",
|
|
2008
|
+
"aria-hidden": "true",
|
|
2009
|
+
children: status === "complete" ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkDZNXG5JKcjs.CheckIcon, {}) : status === "failed" ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkDZNXG5JKcjs.CloseIcon, {}) : status === "active" ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkDZNXG5JKcjs.Spinner, {}) : null
|
|
2010
|
+
}
|
|
2011
|
+
)
|
|
2012
|
+
]
|
|
2013
|
+
},
|
|
2014
|
+
label
|
|
2015
|
+
);
|
|
2016
|
+
}) }),
|
|
2017
|
+
terminal && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2018
|
+
"div",
|
|
2019
|
+
{
|
|
2020
|
+
className: `rs-swapped-tracker-terminal rs-swapped-tracker-terminal--${terminal.kind}`,
|
|
2021
|
+
children: [
|
|
2022
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "rs-swapped-tracker-terminal-message", children: terminal.message }),
|
|
2023
|
+
terminal.kind === "cancelled" && onRetry && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2024
|
+
"button",
|
|
2025
|
+
{
|
|
2026
|
+
type: "button",
|
|
2027
|
+
className: "rs-swapped-tracker-retry",
|
|
2028
|
+
onClick: onRetry,
|
|
2029
|
+
children: "Try again"
|
|
2030
|
+
}
|
|
2031
|
+
)
|
|
2032
|
+
]
|
|
2033
|
+
}
|
|
2034
|
+
)
|
|
2035
|
+
] }),
|
|
2036
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkDZNXG5JKcjs.PoweredBy, {})
|
|
2037
|
+
] });
|
|
2038
|
+
}
|
|
2039
|
+
function formatTrackerAmount(amount) {
|
|
2040
|
+
if (!amount) return null;
|
|
2041
|
+
const num = Number(amount);
|
|
2042
|
+
if (!Number.isFinite(num)) return amount;
|
|
2043
|
+
return num.toFixed(2);
|
|
2044
|
+
}
|
|
2045
|
+
SwappedOrderTracker.displayName = "SwappedOrderTracker";
|
|
2046
|
+
|
|
2047
|
+
// src/components/steps/SwappedIframeStep.tsx
|
|
2048
|
+
|
|
2049
|
+
var STATUS_POLL_INTERVAL_MS = 2e3;
|
|
2050
|
+
var DEPOSIT_POLL_INTERVAL_MS = 2e3;
|
|
2051
|
+
var DEPOSIT_POLL_FAST_INITIAL_DELAY_MS = 1e3;
|
|
2052
|
+
var DEPOSIT_POLL_FAST_INTERVAL_MS = 500;
|
|
2053
|
+
var IFRAME_LOAD_TIMEOUT_MS = 15e3;
|
|
2054
|
+
var SWAPPED_IFRAME_ORIGINS = /* @__PURE__ */ new Set([
|
|
2055
|
+
"https://sandbox.swapped.com",
|
|
2056
|
+
"https://widget.swapped.com"
|
|
2057
|
+
]);
|
|
2058
|
+
var SWAPPED_TERMINAL_STATUSES = /* @__PURE__ */ new Set([
|
|
2059
|
+
"order_completed",
|
|
2060
|
+
"order_broadcasted"
|
|
2061
|
+
]);
|
|
2062
|
+
var SWAPPED_STATUS_VALUES = /* @__PURE__ */ new Set([
|
|
2063
|
+
"payment_pending",
|
|
2064
|
+
"order_completed",
|
|
2065
|
+
"order_broadcasted",
|
|
2066
|
+
"order_cancelled"
|
|
2067
|
+
]);
|
|
2068
|
+
function parseSwappedIframeMessage(raw) {
|
|
2069
|
+
let data = raw;
|
|
2070
|
+
if (typeof data === "string") {
|
|
2071
|
+
try {
|
|
2072
|
+
data = JSON.parse(data);
|
|
2073
|
+
} catch (e15) {
|
|
2074
|
+
return null;
|
|
2075
|
+
}
|
|
2076
|
+
}
|
|
2077
|
+
if (!data || typeof data !== "object") return null;
|
|
2078
|
+
const obj = data;
|
|
2079
|
+
const inner = obj.data && typeof obj.data === "object" ? obj.data : obj;
|
|
2080
|
+
const rawStatus = _nullishCoalesce(_nullishCoalesce(inner.order_status, () => ( inner.status)), () => ( obj.status));
|
|
2081
|
+
if (typeof rawStatus !== "string" || !SWAPPED_STATUS_VALUES.has(rawStatus)) {
|
|
2082
|
+
return null;
|
|
2083
|
+
}
|
|
2084
|
+
const asString2 = (v) => typeof v === "string" && v.length > 0 ? v : void 0;
|
|
2085
|
+
return {
|
|
2086
|
+
status: rawStatus,
|
|
2087
|
+
orderId: _nullishCoalesce(asString2(inner.order_id), () => ( asString2(obj.orderId))),
|
|
2088
|
+
orderCrypto: _nullishCoalesce(asString2(inner.order_crypto), () => ( asString2(obj.orderCrypto))),
|
|
2089
|
+
orderCryptoAmount: _nullishCoalesce(asString2(inner.order_crypto_amount), () => ( asString2(obj.orderCryptoAmount))),
|
|
2090
|
+
transactionId: _nullishCoalesce(asString2(inner.transaction_id), () => ( asString2(obj.transactionId)))
|
|
2091
|
+
};
|
|
2092
|
+
}
|
|
2093
|
+
function SwappedIframeStep({
|
|
2094
|
+
smartAccount,
|
|
2095
|
+
service,
|
|
2096
|
+
variant,
|
|
2097
|
+
loadUrl,
|
|
2098
|
+
iframeTitle,
|
|
2099
|
+
loadErrorCode,
|
|
2100
|
+
loadErrorFallback,
|
|
2101
|
+
bannerForStatus,
|
|
2102
|
+
onSwappedComplete,
|
|
2103
|
+
onSwappedFailed,
|
|
2104
|
+
onClose,
|
|
2105
|
+
onError
|
|
2106
|
+
}) {
|
|
2107
|
+
const [widgetUrl, setWidgetUrl] = _react.useState.call(void 0, null);
|
|
2108
|
+
const [loadError, setLoadError] = _react.useState.call(void 0, null);
|
|
2109
|
+
const [iframeLoaded, setIframeLoaded] = _react.useState.call(void 0, false);
|
|
2110
|
+
const [retryToken, setRetryToken] = _react.useState.call(void 0, 0);
|
|
2111
|
+
const [orderState, setOrderState] = _react.useState.call(void 0, null);
|
|
2112
|
+
const [latestEvent, setLatestEvent] = _react.useState.call(void 0, null);
|
|
2113
|
+
const [phase, setPhase] = _react.useState.call(void 0, "iframe");
|
|
2114
|
+
const completeFiredRef = _react.useRef.call(void 0, false);
|
|
2115
|
+
const failedFiredRef = _react.useRef.call(void 0, false);
|
|
2116
|
+
const expectedOrderUuidRef = _react.useRef.call(void 0, null);
|
|
2117
|
+
const baselineDepositTxHashRef = _react.useRef.call(void 0, void 0);
|
|
2118
|
+
const currentDepositTxHashRef = _react.useRef.call(void 0, null);
|
|
2119
|
+
const fastDepositPollEnabledRef = _react.useRef.call(void 0, false);
|
|
2120
|
+
const rescheduleDepositPollRef = _react.useRef.call(void 0,
|
|
2121
|
+
null
|
|
2122
|
+
);
|
|
2123
|
+
const onSwappedCompleteRef = _react.useRef.call(void 0, onSwappedComplete);
|
|
2124
|
+
onSwappedCompleteRef.current = onSwappedComplete;
|
|
2125
|
+
const onSwappedFailedRef = _react.useRef.call(void 0, onSwappedFailed);
|
|
2126
|
+
onSwappedFailedRef.current = onSwappedFailed;
|
|
2127
|
+
const onErrorRef = _react.useRef.call(void 0, onError);
|
|
2128
|
+
onErrorRef.current = onError;
|
|
2129
|
+
const loadUrlRef = _react.useRef.call(void 0, loadUrl);
|
|
2130
|
+
loadUrlRef.current = loadUrl;
|
|
2131
|
+
_react.useEffect.call(void 0, () => {
|
|
2132
|
+
let cancelled = false;
|
|
2133
|
+
setLoadError(null);
|
|
2134
|
+
setIframeLoaded(false);
|
|
2135
|
+
setWidgetUrl(null);
|
|
2136
|
+
setOrderState(null);
|
|
2137
|
+
setLatestEvent(null);
|
|
2138
|
+
setPhase("iframe");
|
|
2139
|
+
expectedOrderUuidRef.current = null;
|
|
2140
|
+
completeFiredRef.current = false;
|
|
2141
|
+
failedFiredRef.current = false;
|
|
2142
|
+
baselineDepositTxHashRef.current = void 0;
|
|
2143
|
+
currentDepositTxHashRef.current = null;
|
|
2144
|
+
fastDepositPollEnabledRef.current = false;
|
|
2145
|
+
loadUrlRef.current().then((res) => {
|
|
2146
|
+
if (cancelled) return;
|
|
2147
|
+
setWidgetUrl(res.url);
|
|
2148
|
+
const sep = res.externalCustomerId.indexOf(":");
|
|
2149
|
+
expectedOrderUuidRef.current = sep >= 0 ? res.externalCustomerId.slice(sep + 1) : null;
|
|
2150
|
+
}).catch((err) => {
|
|
2151
|
+
if (cancelled) return;
|
|
2152
|
+
const message = err instanceof Error ? err.message : loadErrorFallback;
|
|
2153
|
+
setLoadError(message);
|
|
2154
|
+
_optionalChain([onErrorRef, 'access', _75 => _75.current, 'optionalCall', _76 => _76(message, loadErrorCode)]);
|
|
2155
|
+
});
|
|
2156
|
+
return () => {
|
|
2157
|
+
cancelled = true;
|
|
2158
|
+
};
|
|
2159
|
+
}, [service, smartAccount, retryToken, loadErrorCode, loadErrorFallback]);
|
|
2160
|
+
_react.useEffect.call(void 0, () => {
|
|
2161
|
+
if (!widgetUrl || iframeLoaded || loadError) return;
|
|
2162
|
+
const timer = setTimeout(() => {
|
|
2163
|
+
setLoadError("Iframe took too long to load.");
|
|
2164
|
+
}, IFRAME_LOAD_TIMEOUT_MS);
|
|
2165
|
+
return () => clearTimeout(timer);
|
|
2166
|
+
}, [widgetUrl, iframeLoaded, loadError]);
|
|
2167
|
+
_react.useEffect.call(void 0, () => {
|
|
2168
|
+
let cancelled = false;
|
|
2169
|
+
let timeoutId;
|
|
2170
|
+
async function poll() {
|
|
2171
|
+
if (cancelled) return;
|
|
2172
|
+
try {
|
|
2173
|
+
const res = await service.fetchSwappedOrderStatus(smartAccount);
|
|
2174
|
+
if (cancelled) return;
|
|
2175
|
+
const isCurrentOrder = res !== null && expectedOrderUuidRef.current !== null && res.orderId === expectedOrderUuidRef.current;
|
|
2176
|
+
if (isCurrentOrder) {
|
|
2177
|
+
setOrderState(res);
|
|
2178
|
+
}
|
|
2179
|
+
} catch (e16) {
|
|
2180
|
+
}
|
|
2181
|
+
if (!cancelled) {
|
|
2182
|
+
timeoutId = setTimeout(poll, STATUS_POLL_INTERVAL_MS);
|
|
2183
|
+
}
|
|
2184
|
+
}
|
|
2185
|
+
poll();
|
|
2186
|
+
return () => {
|
|
2187
|
+
cancelled = true;
|
|
2188
|
+
clearTimeout(timeoutId);
|
|
2189
|
+
};
|
|
2190
|
+
}, [service, smartAccount]);
|
|
2191
|
+
_react.useEffect.call(void 0, () => {
|
|
2192
|
+
let cancelled = false;
|
|
2193
|
+
let timeoutId;
|
|
2194
|
+
async function pollDeposit() {
|
|
2195
|
+
if (cancelled) return;
|
|
2196
|
+
try {
|
|
2197
|
+
const status = await service.fetchLatestStatus(smartAccount);
|
|
2198
|
+
if (cancelled) return;
|
|
2199
|
+
const event = status.lastEvent;
|
|
2200
|
+
const eventTxHash = _chunkDZNXG5JKcjs.isDepositEvent.call(void 0, event) ? _nullishCoalesce(_chunkDZNXG5JKcjs.getEventTxHash.call(void 0, event), () => ( null)) : null;
|
|
2201
|
+
if (baselineDepositTxHashRef.current === void 0) {
|
|
2202
|
+
baselineDepositTxHashRef.current = eventTxHash;
|
|
2203
|
+
} else if (eventTxHash && (!baselineDepositTxHashRef.current || !_chunkDZNXG5JKcjs.txRefsMatch.call(void 0, eventTxHash, baselineDepositTxHashRef.current))) {
|
|
2204
|
+
currentDepositTxHashRef.current = eventTxHash;
|
|
2205
|
+
setLatestEvent(_nullishCoalesce(event, () => ( null)));
|
|
2206
|
+
}
|
|
2207
|
+
} catch (e17) {
|
|
2208
|
+
}
|
|
2209
|
+
if (!cancelled) {
|
|
2210
|
+
const nextInterval = fastDepositPollEnabledRef.current ? DEPOSIT_POLL_FAST_INTERVAL_MS : DEPOSIT_POLL_INTERVAL_MS;
|
|
2211
|
+
timeoutId = setTimeout(pollDeposit, nextInterval);
|
|
2212
|
+
}
|
|
2213
|
+
}
|
|
2214
|
+
rescheduleDepositPollRef.current = (delayMs) => {
|
|
2215
|
+
if (cancelled) return;
|
|
2216
|
+
if (timeoutId !== void 0) clearTimeout(timeoutId);
|
|
2217
|
+
timeoutId = setTimeout(pollDeposit, delayMs);
|
|
2218
|
+
};
|
|
2219
|
+
pollDeposit();
|
|
2220
|
+
return () => {
|
|
2221
|
+
cancelled = true;
|
|
2222
|
+
if (timeoutId !== void 0) clearTimeout(timeoutId);
|
|
2223
|
+
rescheduleDepositPollRef.current = null;
|
|
2224
|
+
};
|
|
2225
|
+
}, [service, smartAccount]);
|
|
2226
|
+
_react.useEffect.call(void 0, () => {
|
|
2227
|
+
if (fastDepositPollEnabledRef.current) return;
|
|
2228
|
+
const status = _optionalChain([orderState, 'optionalAccess', _77 => _77.status]);
|
|
2229
|
+
if (!status || !SWAPPED_TERMINAL_STATUSES.has(status)) return;
|
|
2230
|
+
fastDepositPollEnabledRef.current = true;
|
|
2231
|
+
_optionalChain([rescheduleDepositPollRef, 'access', _78 => _78.current, 'optionalCall', _79 => _79(DEPOSIT_POLL_FAST_INITIAL_DELAY_MS)]);
|
|
2232
|
+
}, [orderState]);
|
|
2233
|
+
_react.useEffect.call(void 0, () => {
|
|
2234
|
+
function onMessage(e) {
|
|
2235
|
+
if (!SWAPPED_IFRAME_ORIGINS.has(e.origin)) return;
|
|
2236
|
+
const parsed = parseSwappedIframeMessage(e.data);
|
|
2237
|
+
if (!parsed) return;
|
|
2238
|
+
setOrderState((prev) => ({
|
|
2239
|
+
orderId: _nullishCoalesce(_nullishCoalesce(parsed.orderId, () => ( _optionalChain([prev, 'optionalAccess', _80 => _80.orderId]))), () => ( "")),
|
|
2240
|
+
status: parsed.status,
|
|
2241
|
+
orderCrypto: _nullishCoalesce(_nullishCoalesce(parsed.orderCrypto, () => ( _optionalChain([prev, 'optionalAccess', _81 => _81.orderCrypto]))), () => ( null)),
|
|
2242
|
+
orderCryptoAmount: _nullishCoalesce(_nullishCoalesce(parsed.orderCryptoAmount, () => ( _optionalChain([prev, 'optionalAccess', _82 => _82.orderCryptoAmount]))), () => ( null)),
|
|
2243
|
+
transactionId: _nullishCoalesce(_nullishCoalesce(parsed.transactionId, () => ( _optionalChain([prev, 'optionalAccess', _83 => _83.transactionId]))), () => ( null)),
|
|
2244
|
+
receivedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
2245
|
+
paidAmountUsd: _nullishCoalesce(_optionalChain([prev, 'optionalAccess', _84 => _84.paidAmountUsd]), () => ( null)),
|
|
2246
|
+
paidAmountEur: _nullishCoalesce(_optionalChain([prev, 'optionalAccess', _85 => _85.paidAmountEur]), () => ( null)),
|
|
2247
|
+
onrampFeeUsd: _nullishCoalesce(_optionalChain([prev, 'optionalAccess', _86 => _86.onrampFeeUsd]), () => ( null)),
|
|
2248
|
+
paymentMethod: _nullishCoalesce(_optionalChain([prev, 'optionalAccess', _87 => _87.paymentMethod]), () => ( null))
|
|
2249
|
+
}));
|
|
2250
|
+
}
|
|
2251
|
+
window.addEventListener("message", onMessage);
|
|
2252
|
+
return () => window.removeEventListener("message", onMessage);
|
|
2253
|
+
}, []);
|
|
2254
|
+
_react.useEffect.call(void 0, () => {
|
|
2255
|
+
if (phase === "iframe" && orderState !== null) {
|
|
2256
|
+
setPhase("tracker");
|
|
2257
|
+
}
|
|
2258
|
+
}, [phase, orderState]);
|
|
2259
|
+
const stepStates = _react.useMemo.call(void 0,
|
|
2260
|
+
() => deriveStepStates(_nullishCoalesce(_optionalChain([orderState, 'optionalAccess', _88 => _88.status]), () => ( null)), latestEvent),
|
|
2261
|
+
[orderState, latestEvent]
|
|
2262
|
+
);
|
|
2263
|
+
const terminalState = _react.useMemo.call(void 0, () => {
|
|
2264
|
+
if (_chunkDZNXG5JKcjs.isFailedEvent.call(void 0, _nullishCoalesce(latestEvent, () => ( void 0)))) {
|
|
2265
|
+
return {
|
|
2266
|
+
kind: "failed",
|
|
2267
|
+
message: _chunkDZNXG5JKcjs.failureMessageForEvent.call(void 0, _nullishCoalesce(latestEvent, () => ( void 0)))
|
|
2268
|
+
};
|
|
2269
|
+
}
|
|
2270
|
+
if (_optionalChain([orderState, 'optionalAccess', _89 => _89.status]) === "order_cancelled") {
|
|
2271
|
+
const banner = bannerForStatus("order_cancelled", {});
|
|
2272
|
+
return { kind: "cancelled", message: _nullishCoalesce(banner.detail, () => ( banner.title)) };
|
|
2273
|
+
}
|
|
2274
|
+
return null;
|
|
2275
|
+
}, [latestEvent, orderState, bannerForStatus]);
|
|
2276
|
+
_react.useEffect.call(void 0, () => {
|
|
2277
|
+
if (completeFiredRef.current || failedFiredRef.current) return;
|
|
2278
|
+
const t = _optionalChain([latestEvent, 'optionalAccess', _90 => _90.type]);
|
|
2279
|
+
const isSuccess = t === "bridge-complete" || t === "post-bridge-swap-complete";
|
|
2280
|
+
if (!isSuccess) return;
|
|
2281
|
+
const txHash = currentDepositTxHashRef.current;
|
|
2282
|
+
if (!txHash) return;
|
|
2283
|
+
completeFiredRef.current = true;
|
|
2284
|
+
onSwappedCompleteRef.current({
|
|
2285
|
+
txHash,
|
|
2286
|
+
orderCrypto: _nullishCoalesce(_optionalChain([orderState, 'optionalAccess', _91 => _91.orderCrypto]), () => ( null)),
|
|
2287
|
+
// Base-unit source amount from the deposit row/event, consistent with the
|
|
2288
|
+
// wallet/QR path. ProcessingStep + onLifecycle expect base units.
|
|
2289
|
+
amount: _nullishCoalesce(_chunkDZNXG5JKcjs.getEventSourceDetails.call(void 0, _nullishCoalesce(latestEvent, () => ( void 0))).amount, () => ( null))
|
|
2290
|
+
});
|
|
2291
|
+
}, [latestEvent, orderState]);
|
|
2292
|
+
_react.useEffect.call(void 0, () => {
|
|
2293
|
+
if (failedFiredRef.current || completeFiredRef.current) return;
|
|
2294
|
+
if (!_chunkDZNXG5JKcjs.isFailedEvent.call(void 0, _nullishCoalesce(latestEvent, () => ( void 0)))) return;
|
|
2295
|
+
const txHash = currentDepositTxHashRef.current;
|
|
2296
|
+
if (!txHash) return;
|
|
2297
|
+
failedFiredRef.current = true;
|
|
2298
|
+
setPhase("tracker");
|
|
2299
|
+
_optionalChain([onSwappedFailedRef, 'access', _92 => _92.current, 'optionalCall', _93 => _93(
|
|
2300
|
+
txHash,
|
|
2301
|
+
_chunkDZNXG5JKcjs.failureMessageForEvent.call(void 0, _nullishCoalesce(latestEvent, () => ( void 0)))
|
|
2302
|
+
)]);
|
|
2303
|
+
}, [latestEvent]);
|
|
2304
|
+
if (phase === "tracker") {
|
|
2305
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2306
|
+
SwappedOrderTracker,
|
|
2307
|
+
{
|
|
2308
|
+
amount: _nullishCoalesce(_optionalChain([orderState, 'optionalAccess', _94 => _94.orderCryptoAmount]), () => ( null)),
|
|
2309
|
+
currency: _nullishCoalesce(_optionalChain([orderState, 'optionalAccess', _95 => _95.orderCrypto]), () => ( "USDC")),
|
|
2310
|
+
stepStates,
|
|
2311
|
+
terminal: terminalState,
|
|
2312
|
+
onRetry: () => setRetryToken((n) => n + 1),
|
|
2313
|
+
onClose
|
|
2314
|
+
}
|
|
2315
|
+
);
|
|
2316
|
+
}
|
|
2317
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-screen rs-fiat-onramp", "data-variant": variant, children: [
|
|
2318
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-screen-body rs-screen-body--gap-32", children: [
|
|
2319
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2320
|
+
_chunkDZNXG5JKcjs.BodyHeader,
|
|
2321
|
+
{
|
|
2322
|
+
icon: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkDZNXG5JKcjs.HandCoinsIcon, {}),
|
|
2323
|
+
title: "Deposit",
|
|
2324
|
+
subtitle: "Add money to your balance"
|
|
2325
|
+
}
|
|
2326
|
+
),
|
|
2327
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-fiat-onramp-iframe-wrap", children: [
|
|
2328
|
+
loadError && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-fiat-onramp-error", children: [
|
|
2329
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { children: loadError }),
|
|
2330
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2331
|
+
"button",
|
|
2332
|
+
{
|
|
2333
|
+
type: "button",
|
|
2334
|
+
className: "rs-fiat-onramp-retry",
|
|
2335
|
+
onClick: () => setRetryToken((n) => n + 1),
|
|
2336
|
+
children: "Retry"
|
|
2337
|
+
}
|
|
2338
|
+
)
|
|
2339
|
+
] }),
|
|
2340
|
+
!loadError && !iframeLoaded && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-fiat-onramp-loading", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkDZNXG5JKcjs.Spinner, {}) }),
|
|
2341
|
+
widgetUrl && !loadError && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2342
|
+
"iframe",
|
|
2343
|
+
{
|
|
2344
|
+
src: widgetUrl,
|
|
2345
|
+
title: iframeTitle,
|
|
2346
|
+
className: "rs-fiat-onramp-iframe",
|
|
2347
|
+
sandbox: "allow-scripts allow-forms allow-same-origin allow-popups allow-popups-to-escape-sandbox allow-top-navigation-by-user-activation",
|
|
2348
|
+
allow: "payment; camera; microphone; clipboard-write; geolocation",
|
|
2349
|
+
onLoad: () => setIframeLoaded(true)
|
|
2350
|
+
},
|
|
2351
|
+
retryToken
|
|
2352
|
+
)
|
|
2353
|
+
] })
|
|
2354
|
+
] }),
|
|
2355
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkDZNXG5JKcjs.PoweredBy, {})
|
|
2356
|
+
] });
|
|
2357
|
+
}
|
|
2358
|
+
function deriveStepStates(swappedStatus, latestEvent) {
|
|
2359
|
+
if (_chunkDZNXG5JKcjs.isFailedEvent.call(void 0, _nullishCoalesce(latestEvent, () => ( void 0)))) {
|
|
2360
|
+
return ["complete", "complete", "failed", "pending"];
|
|
2361
|
+
}
|
|
2362
|
+
if (swappedStatus === "order_cancelled") {
|
|
2363
|
+
return ["failed", "pending", "pending", "pending"];
|
|
2364
|
+
}
|
|
2365
|
+
const step1Complete = swappedStatus === "order_completed" || swappedStatus === "order_broadcasted";
|
|
2366
|
+
const step2Complete = latestEvent !== null;
|
|
2367
|
+
const step3Complete = _optionalChain([latestEvent, 'optionalAccess', _96 => _96.type]) === "bridge-complete" || _optionalChain([latestEvent, 'optionalAccess', _97 => _97.type]) === "post-bridge-swap-complete";
|
|
2368
|
+
if (step3Complete) {
|
|
2369
|
+
return ["complete", "complete", "complete", "pending"];
|
|
2370
|
+
}
|
|
2371
|
+
if (step2Complete) {
|
|
2372
|
+
return ["complete", "complete", "active", "pending"];
|
|
2373
|
+
}
|
|
2374
|
+
if (step1Complete) {
|
|
2375
|
+
return ["complete", "active", "pending", "pending"];
|
|
2376
|
+
}
|
|
2377
|
+
return ["active", "pending", "pending", "pending"];
|
|
2378
|
+
}
|
|
2379
|
+
SwappedIframeStep.displayName = "SwappedIframeStep";
|
|
2380
|
+
|
|
2381
|
+
// src/components/steps/FiatOnrampStep.tsx
|
|
2382
|
+
|
|
2383
|
+
function fiatBannerForStatus(status, context) {
|
|
2384
|
+
if (context.currencyMismatch) {
|
|
2385
|
+
return {
|
|
2386
|
+
level: "warning",
|
|
2387
|
+
title: "Currency mismatch",
|
|
2388
|
+
detail: "Funds may not bridge automatically. Contact support if your balance does not arrive."
|
|
2389
|
+
};
|
|
2390
|
+
}
|
|
2391
|
+
switch (status) {
|
|
2392
|
+
case "payment_pending":
|
|
2393
|
+
return { level: "info", title: "Verifying payment\u2026" };
|
|
2394
|
+
case "order_completed":
|
|
2395
|
+
return { level: "success", title: "Payment received \u2014 sending crypto" };
|
|
2396
|
+
case "order_broadcasted":
|
|
2397
|
+
return {
|
|
2398
|
+
level: "success",
|
|
2399
|
+
title: "Crypto sent \u2014 confirming on-chain"
|
|
2400
|
+
};
|
|
2401
|
+
case "order_cancelled":
|
|
2402
|
+
return {
|
|
2403
|
+
level: "warning",
|
|
2404
|
+
title: "Order cancelled",
|
|
2405
|
+
detail: "If you were charged, Swapped will refund within 5 business days."
|
|
2406
|
+
};
|
|
2407
|
+
}
|
|
2408
|
+
}
|
|
2409
|
+
function FiatOnrampStep({
|
|
2410
|
+
smartAccount,
|
|
2411
|
+
service,
|
|
2412
|
+
paymentMethod,
|
|
2413
|
+
onSwappedComplete,
|
|
2414
|
+
onSwappedFailed,
|
|
2415
|
+
onClose,
|
|
2416
|
+
onError
|
|
2417
|
+
}) {
|
|
2418
|
+
const loadUrl = _react.useCallback.call(void 0, async () => {
|
|
2419
|
+
const res = await service.getSwappedWidgetUrl({
|
|
2420
|
+
smartAccount,
|
|
2421
|
+
method: paymentMethod
|
|
2422
|
+
});
|
|
2423
|
+
if (res.currencyCode !== "USDC_BASE") {
|
|
2424
|
+
console.warn(
|
|
2425
|
+
`[FiatOnrampStep] Expected backend to return currencyCode=USDC_BASE, got ${res.currencyCode}. Swapped purchases may not bridge as expected.`
|
|
2426
|
+
);
|
|
2427
|
+
}
|
|
2428
|
+
return res;
|
|
2429
|
+
}, [service, smartAccount, paymentMethod]);
|
|
2430
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2431
|
+
SwappedIframeStep,
|
|
2432
|
+
{
|
|
2433
|
+
smartAccount,
|
|
2434
|
+
service,
|
|
2435
|
+
variant: "fiat",
|
|
2436
|
+
loadUrl,
|
|
2437
|
+
iframeTitle: "Buy crypto with Swapped",
|
|
2438
|
+
loadErrorCode: "SWAPPED_URL_FAILED",
|
|
2439
|
+
loadErrorFallback: "Failed to load on-ramp",
|
|
2440
|
+
bannerForStatus: fiatBannerForStatus,
|
|
2441
|
+
onSwappedComplete,
|
|
2442
|
+
onSwappedFailed,
|
|
2443
|
+
onClose,
|
|
2444
|
+
onError
|
|
2445
|
+
}
|
|
2446
|
+
);
|
|
2447
|
+
}
|
|
2448
|
+
FiatOnrampStep.displayName = "FiatOnrampStep";
|
|
2449
|
+
|
|
2450
|
+
// src/components/steps/ExchangeConnectStep.tsx
|
|
2451
|
+
|
|
2452
|
+
|
|
2453
|
+
function connectBannerForStatus(status, context) {
|
|
2454
|
+
if (context.currencyMismatch) {
|
|
2455
|
+
return {
|
|
2456
|
+
level: "warning",
|
|
2457
|
+
title: "Currency mismatch",
|
|
2458
|
+
detail: "Funds may not bridge automatically. Contact support if your balance does not arrive."
|
|
2459
|
+
};
|
|
2460
|
+
}
|
|
2461
|
+
switch (status) {
|
|
2462
|
+
case "payment_pending":
|
|
2463
|
+
return { level: "info", title: "Waiting for exchange transfer\u2026" };
|
|
2464
|
+
case "order_completed":
|
|
2465
|
+
return {
|
|
2466
|
+
level: "success",
|
|
2467
|
+
title: "Exchange transfer received \u2014 sending crypto"
|
|
2468
|
+
};
|
|
2469
|
+
case "order_broadcasted":
|
|
2470
|
+
return {
|
|
2471
|
+
level: "success",
|
|
2472
|
+
title: "Crypto sent \u2014 confirming on-chain"
|
|
2473
|
+
};
|
|
2474
|
+
case "order_cancelled":
|
|
2475
|
+
return {
|
|
2476
|
+
level: "warning",
|
|
2477
|
+
title: "Order cancelled",
|
|
2478
|
+
detail: "If your exchange already debited the funds, Swapped will refund within 5 business days."
|
|
2479
|
+
};
|
|
2480
|
+
}
|
|
2481
|
+
}
|
|
2482
|
+
function ExchangeConnectStep({
|
|
2483
|
+
smartAccount,
|
|
2484
|
+
service,
|
|
2485
|
+
connection,
|
|
2486
|
+
onSwappedComplete,
|
|
2487
|
+
onSwappedFailed,
|
|
2488
|
+
onClose,
|
|
2489
|
+
onError
|
|
2490
|
+
}) {
|
|
2491
|
+
const loadUrl = _react.useCallback.call(void 0, async () => {
|
|
2492
|
+
const res = await service.getSwappedConnectUrl({
|
|
2493
|
+
smartAccount,
|
|
2494
|
+
connection
|
|
2495
|
+
});
|
|
2496
|
+
if (res.currencyCode !== "USDC_BASE") {
|
|
2497
|
+
console.warn(
|
|
2498
|
+
`[ExchangeConnectStep] Expected backend to return currencyCode=USDC_BASE, got ${res.currencyCode}. Swapped Connect pulls may not bridge as expected.`
|
|
2499
|
+
);
|
|
2500
|
+
}
|
|
2501
|
+
return res;
|
|
2502
|
+
}, [service, smartAccount, connection]);
|
|
2503
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2504
|
+
SwappedIframeStep,
|
|
2505
|
+
{
|
|
2506
|
+
smartAccount,
|
|
2507
|
+
service,
|
|
2508
|
+
variant: "connect",
|
|
2509
|
+
loadUrl,
|
|
2510
|
+
iframeTitle: "Fund from exchange via Swapped",
|
|
2511
|
+
loadErrorCode: "SWAPPED_CONNECT_URL_FAILED",
|
|
2512
|
+
loadErrorFallback: "Failed to load Connect",
|
|
2513
|
+
bannerForStatus: connectBannerForStatus,
|
|
2514
|
+
onSwappedComplete,
|
|
2515
|
+
onSwappedFailed,
|
|
2516
|
+
onClose,
|
|
2517
|
+
onError
|
|
2518
|
+
}
|
|
2519
|
+
);
|
|
2520
|
+
}
|
|
2521
|
+
ExchangeConnectStep.displayName = "ExchangeConnectStep";
|
|
2522
|
+
|
|
2523
|
+
// src/components/steps/ExchangeSelectStep.tsx
|
|
2524
|
+
|
|
2525
|
+
|
|
2526
|
+
function ExchangeLogo({ exchange }) {
|
|
2527
|
+
const [failed, setFailed] = _react.useState.call(void 0, false);
|
|
2528
|
+
if (!exchange.logoUrl || failed) {
|
|
2529
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkDZNXG5JKcjs.BankIcon, {});
|
|
2530
|
+
}
|
|
2531
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2532
|
+
"img",
|
|
2533
|
+
{
|
|
2534
|
+
src: exchange.logoUrl,
|
|
2535
|
+
alt: "",
|
|
2536
|
+
onError: () => setFailed(true)
|
|
2537
|
+
}
|
|
2538
|
+
);
|
|
2539
|
+
}
|
|
2540
|
+
function ExchangeSelectStep({
|
|
2541
|
+
service,
|
|
2542
|
+
onSelectExchange,
|
|
2543
|
+
onError
|
|
2544
|
+
}) {
|
|
2545
|
+
const [exchanges, setExchanges] = _react.useState.call(void 0, []);
|
|
2546
|
+
const [loading, setLoading] = _react.useState.call(void 0, true);
|
|
2547
|
+
const [error, setError] = _react.useState.call(void 0, null);
|
|
2548
|
+
const [retryToken, setRetryToken] = _react.useState.call(void 0, 0);
|
|
2549
|
+
const retry = _react.useCallback.call(void 0, () => {
|
|
2550
|
+
setRetryToken((n) => n + 1);
|
|
2551
|
+
}, []);
|
|
2552
|
+
_react.useEffect.call(void 0, () => {
|
|
2553
|
+
let cancelled = false;
|
|
2554
|
+
setLoading(true);
|
|
2555
|
+
setError(null);
|
|
2556
|
+
service.getSwappedConnectExchanges().then((res) => {
|
|
2557
|
+
if (cancelled) return;
|
|
2558
|
+
setExchanges(res.exchanges);
|
|
2559
|
+
}).catch((err) => {
|
|
2560
|
+
if (cancelled) return;
|
|
2561
|
+
const message = err instanceof Error ? err.message : "Failed to load exchanges";
|
|
2562
|
+
setExchanges([]);
|
|
2563
|
+
setError(message);
|
|
2564
|
+
_optionalChain([onError, 'optionalCall', _98 => _98(message, "SWAPPED_CONNECT_EXCHANGES_FAILED")]);
|
|
2565
|
+
}).finally(() => {
|
|
2566
|
+
if (!cancelled) setLoading(false);
|
|
2567
|
+
});
|
|
2568
|
+
return () => {
|
|
2569
|
+
cancelled = true;
|
|
2570
|
+
};
|
|
2571
|
+
}, [service, retryToken, onError]);
|
|
2572
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-screen rs-exchange-select", children: [
|
|
2573
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-screen-body rs-screen-body--gap-32", children: [
|
|
2574
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2575
|
+
_chunkDZNXG5JKcjs.BodyHeader,
|
|
2576
|
+
{
|
|
2577
|
+
icon: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkDZNXG5JKcjs.BankIcon, {}),
|
|
2578
|
+
title: "Fund from Exchange",
|
|
2579
|
+
subtitle: "Choose your exchange"
|
|
2580
|
+
}
|
|
2581
|
+
),
|
|
2582
|
+
loading && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-exchange-select-state", "aria-live": "polite", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkDZNXG5JKcjs.Spinner, {}) }),
|
|
2583
|
+
!loading && error && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-exchange-select-state", "aria-live": "polite", children: [
|
|
2584
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-exchange-select-state-title", children: "Couldn\u2019t load exchanges" }),
|
|
2585
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2586
|
+
"button",
|
|
2587
|
+
{
|
|
2588
|
+
type: "button",
|
|
2589
|
+
className: "rs-fiat-onramp-retry",
|
|
2590
|
+
onClick: retry,
|
|
2591
|
+
children: "Retry"
|
|
2592
|
+
}
|
|
2593
|
+
)
|
|
2594
|
+
] }),
|
|
2595
|
+
!loading && !error && exchanges.length === 0 && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-exchange-select-state", "aria-live": "polite", children: [
|
|
2596
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-exchange-select-state-title", children: "No exchanges available" }),
|
|
2597
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2598
|
+
"button",
|
|
2599
|
+
{
|
|
2600
|
+
type: "button",
|
|
2601
|
+
className: "rs-fiat-onramp-retry",
|
|
2602
|
+
onClick: retry,
|
|
2603
|
+
children: "Retry"
|
|
2604
|
+
}
|
|
2605
|
+
)
|
|
2606
|
+
] }),
|
|
2607
|
+
!loading && !error && exchanges.length > 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-exchange-grid", children: exchanges.map((exchange) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2608
|
+
"button",
|
|
2609
|
+
{
|
|
2610
|
+
type: "button",
|
|
2611
|
+
className: "rs-exchange-card",
|
|
2612
|
+
onClick: () => onSelectExchange(exchange.connection),
|
|
2613
|
+
"aria-label": `Select ${exchange.name}`,
|
|
2614
|
+
children: [
|
|
2615
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-exchange-card-logo", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ExchangeLogo, { exchange }) }),
|
|
2616
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-exchange-card-name", children: exchange.name })
|
|
2617
|
+
]
|
|
2618
|
+
},
|
|
2619
|
+
exchange.connection
|
|
2620
|
+
)) })
|
|
2621
|
+
] }),
|
|
2622
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkDZNXG5JKcjs.PoweredBy, {})
|
|
2623
|
+
] });
|
|
2624
|
+
}
|
|
2625
|
+
ExchangeSelectStep.displayName = "ExchangeSelectStep";
|
|
2626
|
+
|
|
1951
2627
|
// src/components/steps/DepositAddressSkeleton.tsx
|
|
1952
2628
|
|
|
1953
2629
|
var BASE_CHAIN_ID = 8453;
|
|
@@ -1955,8 +2631,8 @@ function DepositAddressSkeleton({
|
|
|
1955
2631
|
uiConfig,
|
|
1956
2632
|
allowedRoutes
|
|
1957
2633
|
}) {
|
|
1958
|
-
const allowedChainSet = _optionalChain([allowedRoutes, 'optionalAccess',
|
|
1959
|
-
const allowedTokenSet = _optionalChain([allowedRoutes, 'optionalAccess',
|
|
2634
|
+
const allowedChainSet = _optionalChain([allowedRoutes, 'optionalAccess', _99 => _99.sourceChains]) ? new Set(allowedRoutes.sourceChains) : null;
|
|
2635
|
+
const allowedTokenSet = _optionalChain([allowedRoutes, 'optionalAccess', _100 => _100.sourceTokens]) ? new Set(allowedRoutes.sourceTokens.map((s) => s.toUpperCase())) : null;
|
|
1960
2636
|
const evmChainIds = (() => {
|
|
1961
2637
|
const all = _chunk7JIDIX27cjs.getSupportedChainIds.call(void 0, );
|
|
1962
2638
|
return allowedChainSet ? all.filter((id) => allowedChainSet.has(id)) : all;
|
|
@@ -1973,7 +2649,7 @@ function DepositAddressSkeleton({
|
|
|
1973
2649
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-screen", "aria-busy": "true", children: [
|
|
1974
2650
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-sr-only", role: "status", children: "Preparing deposit details\u2026" }),
|
|
1975
2651
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-screen-body", children: [
|
|
1976
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2652
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkDZNXG5JKcjs.BodyHeader, { icon: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkDZNXG5JKcjs.TransferCryptoIcon, {}), title: "Transfer crypto" }),
|
|
1977
2653
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-deposit-address-selectors", "aria-hidden": "true", children: [
|
|
1978
2654
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-deposit-address-dropdown", children: [
|
|
1979
2655
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-deposit-address-dropdown-label", children: "Supported chain" }),
|
|
@@ -1987,7 +2663,7 @@ function DepositAddressSkeleton({
|
|
|
1987
2663
|
}
|
|
1988
2664
|
),
|
|
1989
2665
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: chainName }),
|
|
1990
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2666
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkDZNXG5JKcjs.ChevronDownIcon, { className: "rs-deposit-address-dropdown-chevron" })
|
|
1991
2667
|
] })
|
|
1992
2668
|
] }),
|
|
1993
2669
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-deposit-address-dropdown", children: [
|
|
@@ -1995,9 +2671,9 @@ function DepositAddressSkeleton({
|
|
|
1995
2671
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: "Supported token" }),
|
|
1996
2672
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "rs-deposit-address-min", children: [
|
|
1997
2673
|
"Min.$",
|
|
1998
|
-
(_nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess',
|
|
1999
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2000
|
-
|
|
2674
|
+
(_nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess', _101 => _101.minDepositUsd]), () => ( 0.1))).toFixed(2),
|
|
2675
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkDZNXG5JKcjs.Tooltip, { content: "Minimum deposit amount required for the selected chain.", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2676
|
+
_chunkDZNXG5JKcjs.InfoIcon,
|
|
2001
2677
|
{
|
|
2002
2678
|
className: "rs-deposit-address-min-icon",
|
|
2003
2679
|
"aria-hidden": "true"
|
|
@@ -2015,7 +2691,7 @@ function DepositAddressSkeleton({
|
|
|
2015
2691
|
}
|
|
2016
2692
|
),
|
|
2017
2693
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: defaultToken }),
|
|
2018
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2694
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkDZNXG5JKcjs.ChevronDownIcon, { className: "rs-deposit-address-dropdown-chevron" })
|
|
2019
2695
|
] })
|
|
2020
2696
|
] })
|
|
2021
2697
|
] }),
|
|
@@ -2036,7 +2712,7 @@ function DepositAddressSkeleton({
|
|
|
2036
2712
|
disabled: true,
|
|
2037
2713
|
"aria-hidden": "true",
|
|
2038
2714
|
children: [
|
|
2039
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2715
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkDZNXG5JKcjs.CopyIcon, {}),
|
|
2040
2716
|
"Copy address"
|
|
2041
2717
|
]
|
|
2042
2718
|
}
|
|
@@ -2049,16 +2725,16 @@ function DepositAddressSkeleton({
|
|
|
2049
2725
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-price-impact-label", children: "Price impact" }),
|
|
2050
2726
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-price-impact-label", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "strong", { children: "0.00%" }) }),
|
|
2051
2727
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2052
|
-
|
|
2728
|
+
_chunkDZNXG5JKcjs.Tooltip,
|
|
2053
2729
|
{
|
|
2054
2730
|
className: "rs-price-impact-info",
|
|
2055
2731
|
content: "Price impact is the difference between expected and execution price, due to trade size and liquidity.",
|
|
2056
|
-
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2732
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkDZNXG5JKcjs.InfoIcon, { "aria-hidden": "true" })
|
|
2057
2733
|
}
|
|
2058
2734
|
)
|
|
2059
2735
|
] }),
|
|
2060
2736
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2061
|
-
|
|
2737
|
+
_chunkDZNXG5JKcjs.ChevronDownIcon,
|
|
2062
2738
|
{
|
|
2063
2739
|
className: "rs-price-impact-chevron",
|
|
2064
2740
|
"aria-hidden": "true"
|
|
@@ -2066,7 +2742,7 @@ function DepositAddressSkeleton({
|
|
|
2066
2742
|
)
|
|
2067
2743
|
] }) })
|
|
2068
2744
|
] }),
|
|
2069
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2745
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkDZNXG5JKcjs.PoweredBy, {})
|
|
2070
2746
|
] });
|
|
2071
2747
|
}
|
|
2072
2748
|
DepositAddressSkeleton.displayName = "DepositAddressSkeleton";
|
|
@@ -2098,7 +2774,7 @@ function SolanaTokenSelectStep({
|
|
|
2098
2774
|
setError(null);
|
|
2099
2775
|
const portfolioBySymbol = {};
|
|
2100
2776
|
try {
|
|
2101
|
-
|
|
2777
|
+
_chunkDZNXG5JKcjs.debugLog.call(void 0, debug, "solana-token-select", "portfolio:request", {
|
|
2102
2778
|
solanaAddress
|
|
2103
2779
|
});
|
|
2104
2780
|
const portfolio = await service.fetchSolanaPortfolio(solanaAddress);
|
|
@@ -2109,7 +2785,7 @@ function SolanaTokenSelectStep({
|
|
|
2109
2785
|
let parsed = 0n;
|
|
2110
2786
|
try {
|
|
2111
2787
|
parsed = BigInt(t.balance || "0");
|
|
2112
|
-
} catch (
|
|
2788
|
+
} catch (e18) {
|
|
2113
2789
|
parsed = 0n;
|
|
2114
2790
|
}
|
|
2115
2791
|
if (parsed <= 0n) continue;
|
|
@@ -2121,12 +2797,12 @@ function SolanaTokenSelectStep({
|
|
|
2121
2797
|
};
|
|
2122
2798
|
}
|
|
2123
2799
|
}
|
|
2124
|
-
|
|
2800
|
+
_chunkDZNXG5JKcjs.debugLog.call(void 0, debug, "solana-token-select", "portfolio:success", {
|
|
2125
2801
|
symbols: Object.keys(portfolioBySymbol)
|
|
2126
2802
|
});
|
|
2127
2803
|
} catch (err) {
|
|
2128
2804
|
if (!active) return;
|
|
2129
|
-
|
|
2805
|
+
_chunkDZNXG5JKcjs.debugError.call(void 0, debug, "solana-token-select", "portfolio:failure", err, {
|
|
2130
2806
|
solanaAddress
|
|
2131
2807
|
});
|
|
2132
2808
|
setError(
|
|
@@ -2151,7 +2827,7 @@ function SolanaTokenSelectStep({
|
|
|
2151
2827
|
setTokenBalances(results);
|
|
2152
2828
|
setLoading(false);
|
|
2153
2829
|
const totalUsd = results.reduce((sum, r) => sum + r.balanceUsd, 0);
|
|
2154
|
-
_optionalChain([onTotalBalanceComputed, 'optionalCall',
|
|
2830
|
+
_optionalChain([onTotalBalanceComputed, 'optionalCall', _102 => _102(totalUsd)]);
|
|
2155
2831
|
}
|
|
2156
2832
|
void loadBalances();
|
|
2157
2833
|
return () => {
|
|
@@ -2173,8 +2849,8 @@ function SolanaTokenSelectStep({
|
|
|
2173
2849
|
const raw = _viem.formatUnits.call(void 0, entry.balance, entry.token.decimals);
|
|
2174
2850
|
const numeric = Number(raw);
|
|
2175
2851
|
if (!Number.isFinite(numeric)) return raw;
|
|
2176
|
-
return
|
|
2177
|
-
} catch (
|
|
2852
|
+
return _chunkDZNXG5JKcjs.tokenFormatter.format(numeric);
|
|
2853
|
+
} catch (e19) {
|
|
2178
2854
|
return "--";
|
|
2179
2855
|
}
|
|
2180
2856
|
};
|
|
@@ -2183,20 +2859,20 @@ function SolanaTokenSelectStep({
|
|
|
2183
2859
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-screen", children: [
|
|
2184
2860
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-screen-body", children: [
|
|
2185
2861
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2186
|
-
|
|
2862
|
+
_chunkDZNXG5JKcjs.BodyHeader,
|
|
2187
2863
|
{
|
|
2188
|
-
icon: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2864
|
+
icon: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkDZNXG5JKcjs.WalletIcon, {}),
|
|
2189
2865
|
title: "Your assets",
|
|
2190
2866
|
subtitle: "Select source assets to transfer"
|
|
2191
2867
|
}
|
|
2192
2868
|
),
|
|
2193
2869
|
loading && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-loading-state", style: { padding: "40px 12px" }, children: [
|
|
2194
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2870
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkDZNXG5JKcjs.Spinner, { className: "rs-text-tertiary" }),
|
|
2195
2871
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-text-sm rs-text-tertiary", children: "Loading balances" })
|
|
2196
2872
|
] }),
|
|
2197
|
-
error && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2873
|
+
error && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkDZNXG5JKcjs.Callout, { variant: "error", children: error }),
|
|
2198
2874
|
!loading && !error && rows.length === 0 && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-empty-state", children: [
|
|
2199
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2875
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkDZNXG5JKcjs.WalletIcon, { className: "rs-empty-icon" }),
|
|
2200
2876
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-empty-text", children: "No funds in connected wallet" }),
|
|
2201
2877
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-empty-address", children: [
|
|
2202
2878
|
solanaAddress.slice(0, 6),
|
|
@@ -2245,14 +2921,14 @@ function SolanaTokenSelectStep({
|
|
|
2245
2921
|
] })
|
|
2246
2922
|
] })
|
|
2247
2923
|
] }),
|
|
2248
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-asset-balance", children: entry.balanceUsd > 0 ?
|
|
2924
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-asset-balance", children: entry.balanceUsd > 0 ? _chunkDZNXG5JKcjs.currencyFormatter.format(entry.balanceUsd) : tokenAmount !== "--" ? `${tokenAmount} ${entry.token.symbol}` : "--" })
|
|
2249
2925
|
]
|
|
2250
2926
|
},
|
|
2251
2927
|
entry.token.symbol
|
|
2252
2928
|
);
|
|
2253
2929
|
}) }),
|
|
2254
2930
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2255
|
-
|
|
2931
|
+
_chunkDZNXG5JKcjs.Button,
|
|
2256
2932
|
{
|
|
2257
2933
|
onClick: () => selectedEntry && onContinue(
|
|
2258
2934
|
selectedEntry.token,
|
|
@@ -2265,7 +2941,7 @@ function SolanaTokenSelectStep({
|
|
|
2265
2941
|
}
|
|
2266
2942
|
)
|
|
2267
2943
|
] }),
|
|
2268
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2944
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkDZNXG5JKcjs.PoweredBy, {})
|
|
2269
2945
|
] });
|
|
2270
2946
|
}
|
|
2271
2947
|
|
|
@@ -2297,7 +2973,7 @@ function SolanaAmountStep({
|
|
|
2297
2973
|
const [error, setError] = _react.useState.call(void 0, null);
|
|
2298
2974
|
const hasAppliedDefaultRef = _react.useRef.call(void 0, false);
|
|
2299
2975
|
const isSourceStablecoin = _chunk7JIDIX27cjs.isStablecoinSymbol.call(void 0, token.symbol);
|
|
2300
|
-
const isMaxDefault = _optionalChain([defaultAmount, 'optionalAccess',
|
|
2976
|
+
const isMaxDefault = _optionalChain([defaultAmount, 'optionalAccess', _103 => _103.trim, 'call', _104 => _104(), 'access', _105 => _105.toLowerCase, 'call', _106 => _106()]) === "max";
|
|
2301
2977
|
const tokenPriceUsd = _react.useMemo.call(void 0, () => {
|
|
2302
2978
|
if (isSourceStablecoin) return 1;
|
|
2303
2979
|
try {
|
|
@@ -2307,7 +2983,7 @@ function SolanaAmountStep({
|
|
|
2307
2983
|
}
|
|
2308
2984
|
const price = balanceUsd / balanceUnits;
|
|
2309
2985
|
return price > 0 ? price : null;
|
|
2310
|
-
} catch (
|
|
2986
|
+
} catch (e20) {
|
|
2311
2987
|
return null;
|
|
2312
2988
|
}
|
|
2313
2989
|
}, [isSourceStablecoin, balance, token.decimals, balanceUsd]);
|
|
@@ -2317,8 +2993,8 @@ function SolanaAmountStep({
|
|
|
2317
2993
|
const raw = _viem.formatUnits.call(void 0, balance, token.decimals);
|
|
2318
2994
|
const numeric = Number(raw);
|
|
2319
2995
|
if (!Number.isFinite(numeric)) return raw;
|
|
2320
|
-
return
|
|
2321
|
-
} catch (
|
|
2996
|
+
return _chunkDZNXG5JKcjs.tokenFormatter.format(numeric);
|
|
2997
|
+
} catch (e21) {
|
|
2322
2998
|
return "\u2026";
|
|
2323
2999
|
}
|
|
2324
3000
|
}, [balance, token.decimals]);
|
|
@@ -2329,7 +3005,7 @@ function SolanaAmountStep({
|
|
|
2329
3005
|
if (tokenPriceUsd !== null) return balanceUnits * tokenPriceUsd;
|
|
2330
3006
|
if (Number.isFinite(balanceUsd) && balanceUsd > 0) return balanceUsd;
|
|
2331
3007
|
return null;
|
|
2332
|
-
} catch (
|
|
3008
|
+
} catch (e22) {
|
|
2333
3009
|
return null;
|
|
2334
3010
|
}
|
|
2335
3011
|
}, [balance, token.decimals, tokenPriceUsd, balanceUsd]);
|
|
@@ -2343,7 +3019,7 @@ function SolanaAmountStep({
|
|
|
2343
3019
|
if (!Number.isFinite(spendableUnits) || spendableUnits < 0) return null;
|
|
2344
3020
|
if (tokenPriceUsd !== null) return spendableUnits * tokenPriceUsd;
|
|
2345
3021
|
return null;
|
|
2346
|
-
} catch (
|
|
3022
|
+
} catch (e23) {
|
|
2347
3023
|
return null;
|
|
2348
3024
|
}
|
|
2349
3025
|
}, [spendableBalance, token.decimals, tokenPriceUsd]);
|
|
@@ -2358,7 +3034,7 @@ function SolanaAmountStep({
|
|
|
2358
3034
|
const factor = 1e3;
|
|
2359
3035
|
const truncated = Math.floor(value * factor) / factor;
|
|
2360
3036
|
return truncated.toFixed(3).replace(/\.?0+$/, "");
|
|
2361
|
-
} catch (
|
|
3037
|
+
} catch (e24) {
|
|
2362
3038
|
return "";
|
|
2363
3039
|
}
|
|
2364
3040
|
},
|
|
@@ -2395,12 +3071,12 @@ function SolanaAmountStep({
|
|
|
2395
3071
|
const raw = isSourceStablecoin || !hasPricing ? numericAmount : numericAmount / (_nullishCoalesce(tokenPriceUsd, () => ( 1)));
|
|
2396
3072
|
try {
|
|
2397
3073
|
return _viem.parseUnits.call(void 0, raw.toString(), token.decimals);
|
|
2398
|
-
} catch (
|
|
3074
|
+
} catch (e25) {
|
|
2399
3075
|
return null;
|
|
2400
3076
|
}
|
|
2401
3077
|
}, [numericAmount, isSourceStablecoin, hasPricing, tokenPriceUsd, token.decimals]);
|
|
2402
|
-
const minDepositUsd = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess',
|
|
2403
|
-
const maxDepositUsd = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess',
|
|
3078
|
+
const minDepositUsd = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess', _107 => _107.minDepositUsd]), () => ( null));
|
|
3079
|
+
const maxDepositUsd = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess', _108 => _108.maxDepositUsd]), () => ( null));
|
|
2404
3080
|
const isBelowMin = minDepositUsd !== null && numericAmount > 0 && numericAmount < minDepositUsd;
|
|
2405
3081
|
const isAboveMax = maxDepositUsd !== null && numericAmount > maxDepositUsd;
|
|
2406
3082
|
const exceedsBalance = Boolean(
|
|
@@ -2410,7 +3086,7 @@ function SolanaAmountStep({
|
|
|
2410
3086
|
const handlePresetClick = (percentage) => {
|
|
2411
3087
|
const formatted = computePresetAmount(percentage);
|
|
2412
3088
|
if (!formatted) return;
|
|
2413
|
-
|
|
3089
|
+
_chunkDZNXG5JKcjs.debugLog.call(void 0, debug, "solana-amount", "amount:preset", {
|
|
2414
3090
|
percentage,
|
|
2415
3091
|
symbol: token.symbol,
|
|
2416
3092
|
formatted
|
|
@@ -2444,8 +3120,8 @@ function SolanaAmountStep({
|
|
|
2444
3120
|
let amountInUnits;
|
|
2445
3121
|
try {
|
|
2446
3122
|
amountInUnits = _viem.parseUnits.call(void 0, sourceAmountStr, token.decimals);
|
|
2447
|
-
} catch (
|
|
2448
|
-
|
|
3123
|
+
} catch (e26) {
|
|
3124
|
+
_chunkDZNXG5JKcjs.debugLog.call(void 0, debug, "solana-amount", "amount:invalid", {
|
|
2449
3125
|
amount,
|
|
2450
3126
|
sourceAmount: sourceAmountStr,
|
|
2451
3127
|
reason: "parse-units-failed"
|
|
@@ -2460,7 +3136,7 @@ function SolanaAmountStep({
|
|
|
2460
3136
|
);
|
|
2461
3137
|
return;
|
|
2462
3138
|
}
|
|
2463
|
-
|
|
3139
|
+
_chunkDZNXG5JKcjs.debugLog.call(void 0, debug, "solana-amount", "amount:continue", {
|
|
2464
3140
|
symbol: token.symbol,
|
|
2465
3141
|
inputAmountUsd: amount,
|
|
2466
3142
|
sourceAmount: sourceAmountStr,
|
|
@@ -2474,7 +3150,7 @@ function SolanaAmountStep({
|
|
|
2474
3150
|
const sourceTokenIcon = _chunk7JIDIX27cjs.getTokenIcon.call(void 0, token.symbol);
|
|
2475
3151
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-screen", children: [
|
|
2476
3152
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-screen-body rs-screen-body--gap-32", children: [
|
|
2477
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3153
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkDZNXG5JKcjs.BodyHeader, { icon: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkDZNXG5JKcjs.WalletIcon, {}), title: "Wallet deposit" }),
|
|
2478
3154
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-amount-section", children: [
|
|
2479
3155
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-amount-display", children: [
|
|
2480
3156
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
@@ -2494,13 +3170,13 @@ function SolanaAmountStep({
|
|
|
2494
3170
|
" available",
|
|
2495
3171
|
computedBalanceUsd !== null && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
2496
3172
|
" (~",
|
|
2497
|
-
|
|
3173
|
+
_chunkDZNXG5JKcjs.currencyFormatter.format(computedBalanceUsd),
|
|
2498
3174
|
")"
|
|
2499
3175
|
] })
|
|
2500
3176
|
] }),
|
|
2501
3177
|
minDepositUsd !== null && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "rs-amount-meta-minimum", children: [
|
|
2502
3178
|
"Min. deposit ",
|
|
2503
|
-
|
|
3179
|
+
_chunkDZNXG5JKcjs.currencyFormatter.format(minDepositUsd)
|
|
2504
3180
|
] })
|
|
2505
3181
|
] })
|
|
2506
3182
|
] }),
|
|
@@ -2539,12 +3215,12 @@ function SolanaAmountStep({
|
|
|
2539
3215
|
] }),
|
|
2540
3216
|
balanceAfterUsd !== null && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-amount-detail-row", children: [
|
|
2541
3217
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: "Balance after deposit" }),
|
|
2542
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-amount-detail-value", children:
|
|
3218
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-amount-detail-value", children: _chunkDZNXG5JKcjs.currencyFormatter.format(balanceAfterUsd) })
|
|
2543
3219
|
] })
|
|
2544
3220
|
] }),
|
|
2545
|
-
error && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3221
|
+
error && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkDZNXG5JKcjs.Callout, { variant: "error", children: error }),
|
|
2546
3222
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2547
|
-
|
|
3223
|
+
_chunkDZNXG5JKcjs.Button,
|
|
2548
3224
|
{
|
|
2549
3225
|
onClick: handleContinue,
|
|
2550
3226
|
fullWidth: true,
|
|
@@ -2553,7 +3229,7 @@ function SolanaAmountStep({
|
|
|
2553
3229
|
}
|
|
2554
3230
|
)
|
|
2555
3231
|
] }),
|
|
2556
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3232
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkDZNXG5JKcjs.PoweredBy, {})
|
|
2557
3233
|
] });
|
|
2558
3234
|
}
|
|
2559
3235
|
|
|
@@ -2577,7 +3253,7 @@ var DEFAULT_SOLANA_RPC_URL = "https://api.mainnet.solana.com";
|
|
|
2577
3253
|
var configuredSolanaRpcUrl = null;
|
|
2578
3254
|
var cachedConnections = /* @__PURE__ */ new Map();
|
|
2579
3255
|
function configureSolanaRpcUrl(rpcUrl) {
|
|
2580
|
-
const normalized = _optionalChain([rpcUrl, 'optionalAccess',
|
|
3256
|
+
const normalized = _optionalChain([rpcUrl, 'optionalAccess', _109 => _109.trim, 'call', _110 => _110()]);
|
|
2581
3257
|
configuredSolanaRpcUrl = normalized ? normalized : null;
|
|
2582
3258
|
cachedConnections.clear();
|
|
2583
3259
|
}
|
|
@@ -2697,8 +3373,8 @@ function SolanaConfirmStep({
|
|
|
2697
3373
|
const targetChainIcon = _chunk7JIDIX27cjs.getChainIcon.call(void 0, targetChain);
|
|
2698
3374
|
const sourceTokenIcon = _chunk7JIDIX27cjs.getTokenIcon.call(void 0, token.symbol);
|
|
2699
3375
|
const targetTokenIcon = _chunk7JIDIX27cjs.getTokenIcon.call(void 0, targetSymbol);
|
|
2700
|
-
const feeSponsored = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess',
|
|
2701
|
-
const feeTooltip = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess',
|
|
3376
|
+
const feeSponsored = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess', _111 => _111.feeSponsored]), () => ( false));
|
|
3377
|
+
const feeTooltip = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess', _112 => _112.feeTooltip]), () => ( (feeSponsored ? "Network fees are sponsored for this deposit." : "Network fees apply.")));
|
|
2702
3378
|
const formattedAmount = sourceAmount && !Number.isNaN(Number(sourceAmount)) ? Number(sourceAmount).toLocaleString("en-US", {
|
|
2703
3379
|
minimumFractionDigits: 2,
|
|
2704
3380
|
maximumFractionDigits: 6
|
|
@@ -2720,7 +3396,7 @@ function SolanaConfirmStep({
|
|
|
2720
3396
|
const receiveAmount = isSameToken ? formattedReceiveAmount : `~${formattedReceiveAmount}`;
|
|
2721
3397
|
const handleConfirm = async () => {
|
|
2722
3398
|
if (!solanaProvider) {
|
|
2723
|
-
|
|
3399
|
+
_chunkDZNXG5JKcjs.debugLog.call(void 0, debug, "solana-confirm", "submit:blocked", {
|
|
2724
3400
|
reason: "missing-provider"
|
|
2725
3401
|
});
|
|
2726
3402
|
setError("Solana wallet not connected");
|
|
@@ -2728,7 +3404,7 @@ function SolanaConfirmStep({
|
|
|
2728
3404
|
}
|
|
2729
3405
|
const parsedAmount = parseFloat(sourceAmount);
|
|
2730
3406
|
if (isNaN(parsedAmount) || parsedAmount <= 0) {
|
|
2731
|
-
|
|
3407
|
+
_chunkDZNXG5JKcjs.debugLog.call(void 0, debug, "solana-confirm", "submit:blocked", {
|
|
2732
3408
|
reason: "invalid-amount",
|
|
2733
3409
|
sourceAmount
|
|
2734
3410
|
});
|
|
@@ -2737,7 +3413,7 @@ function SolanaConfirmStep({
|
|
|
2737
3413
|
}
|
|
2738
3414
|
setError(null);
|
|
2739
3415
|
setIsSubmitting(true);
|
|
2740
|
-
|
|
3416
|
+
_chunkDZNXG5JKcjs.debugLog.call(void 0, debug, "solana-confirm", "submit:start", {
|
|
2741
3417
|
smartAccount,
|
|
2742
3418
|
solanaAddress,
|
|
2743
3419
|
solanaDepositAddress,
|
|
@@ -2747,7 +3423,7 @@ function SolanaConfirmStep({
|
|
|
2747
3423
|
});
|
|
2748
3424
|
try {
|
|
2749
3425
|
const check = await service.checkAccount(smartAccount);
|
|
2750
|
-
|
|
3426
|
+
_chunkDZNXG5JKcjs.debugLog.call(void 0, debug, "solana-confirm", "check:success", {
|
|
2751
3427
|
smartAccount,
|
|
2752
3428
|
isRegistered: check.isRegistered,
|
|
2753
3429
|
targetChain: check.targetChain,
|
|
@@ -2760,7 +3436,7 @@ function SolanaConfirmStep({
|
|
|
2760
3436
|
}
|
|
2761
3437
|
const connection = hasConfiguredSolanaRpcUrl() ? getSolanaConnection() : _nullishCoalesce(solanaConnection, () => ( getSolanaConnection()));
|
|
2762
3438
|
const amountUnits = _viem.parseUnits.call(void 0, sourceAmount, token.decimals);
|
|
2763
|
-
|
|
3439
|
+
_chunkDZNXG5JKcjs.debugLog.call(void 0, debug, "solana-confirm", "tx:build:start", {
|
|
2764
3440
|
token: token.symbol,
|
|
2765
3441
|
sourceAmount,
|
|
2766
3442
|
amountUnits: amountUnits.toString()
|
|
@@ -2777,10 +3453,10 @@ function SolanaConfirmStep({
|
|
|
2777
3453
|
token.mint,
|
|
2778
3454
|
amountUnits
|
|
2779
3455
|
);
|
|
2780
|
-
|
|
3456
|
+
_chunkDZNXG5JKcjs.debugLog.call(void 0, debug, "solana-confirm", "tx:build:success", {
|
|
2781
3457
|
token: token.symbol,
|
|
2782
3458
|
instructionCount: transaction.instructions.length,
|
|
2783
|
-
feePayer: _optionalChain([transaction, 'access',
|
|
3459
|
+
feePayer: _optionalChain([transaction, 'access', _113 => _113.feePayer, 'optionalAccess', _114 => _114.toBase58, 'call', _115 => _115()]),
|
|
2784
3460
|
recentBlockhash: transaction.recentBlockhash
|
|
2785
3461
|
});
|
|
2786
3462
|
const txHash = await sendSolanaTransaction(
|
|
@@ -2788,28 +3464,28 @@ function SolanaConfirmStep({
|
|
|
2788
3464
|
connection,
|
|
2789
3465
|
transaction
|
|
2790
3466
|
);
|
|
2791
|
-
|
|
3467
|
+
_chunkDZNXG5JKcjs.debugLog.call(void 0, debug, "solana-confirm", "tx:sent", {
|
|
2792
3468
|
txHash,
|
|
2793
3469
|
amountUnits: amountUnits.toString()
|
|
2794
3470
|
});
|
|
2795
3471
|
onConfirm(txHash, amountUnits.toString());
|
|
2796
3472
|
} catch (err) {
|
|
2797
3473
|
const raw = err instanceof Error ? err.message : "Transfer failed";
|
|
2798
|
-
const message =
|
|
2799
|
-
|
|
3474
|
+
const message = _chunkDZNXG5JKcjs.formatUserError.call(void 0, raw);
|
|
3475
|
+
_chunkDZNXG5JKcjs.debugError.call(void 0, debug, "solana-confirm", "submit:failure", err, {
|
|
2800
3476
|
smartAccount,
|
|
2801
3477
|
token: token.symbol,
|
|
2802
3478
|
sourceAmount
|
|
2803
3479
|
});
|
|
2804
3480
|
setError(message);
|
|
2805
|
-
_optionalChain([onError, 'optionalCall',
|
|
3481
|
+
_optionalChain([onError, 'optionalCall', _116 => _116(message, "SOLANA_TRANSFER_ERROR")]);
|
|
2806
3482
|
} finally {
|
|
2807
3483
|
setIsSubmitting(false);
|
|
2808
3484
|
}
|
|
2809
3485
|
};
|
|
2810
3486
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-screen", children: [
|
|
2811
3487
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-screen-body rs-screen-body--gap-32", children: [
|
|
2812
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3488
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkDZNXG5JKcjs.BodyHeader, { icon: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkDZNXG5JKcjs.WalletIcon, {}), title: "Review deposit" }),
|
|
2813
3489
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-review-details", children: [
|
|
2814
3490
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-review-detail-row", children: [
|
|
2815
3491
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: "Source chain" }),
|
|
@@ -2861,13 +3537,13 @@ function SolanaConfirmStep({
|
|
|
2861
3537
|
children: "$0.04"
|
|
2862
3538
|
}
|
|
2863
3539
|
),
|
|
2864
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3540
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkDZNXG5JKcjs.Tooltip, { content: feeTooltip, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-review-detail-info", "aria-label": "Fee info", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkDZNXG5JKcjs.InfoIcon, {}) }) })
|
|
2865
3541
|
] })
|
|
2866
3542
|
] })
|
|
2867
3543
|
] }),
|
|
2868
|
-
error && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3544
|
+
error && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkDZNXG5JKcjs.Callout, { variant: "error", children: error }),
|
|
2869
3545
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2870
|
-
|
|
3546
|
+
_chunkDZNXG5JKcjs.Button,
|
|
2871
3547
|
{
|
|
2872
3548
|
onClick: handleConfirm,
|
|
2873
3549
|
loading: isSubmitting,
|
|
@@ -2878,7 +3554,7 @@ function SolanaConfirmStep({
|
|
|
2878
3554
|
}
|
|
2879
3555
|
)
|
|
2880
3556
|
] }),
|
|
2881
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3557
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkDZNXG5JKcjs.PoweredBy, {})
|
|
2882
3558
|
] });
|
|
2883
3559
|
}
|
|
2884
3560
|
|
|
@@ -2892,18 +3568,18 @@ function DappImportAssetSelectStep({
|
|
|
2892
3568
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-screen", children: [
|
|
2893
3569
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-screen-body rs-screen-body--gap-32", children: [
|
|
2894
3570
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2895
|
-
|
|
3571
|
+
_chunkDZNXG5JKcjs.BodyHeader,
|
|
2896
3572
|
{
|
|
2897
|
-
icon: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3573
|
+
icon: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkDZNXG5JKcjs.WalletIcon, {}),
|
|
2898
3574
|
title: `Transfer from ${sourceLabel}`,
|
|
2899
3575
|
subtitle: "Pick the balance to import"
|
|
2900
3576
|
}
|
|
2901
3577
|
),
|
|
2902
3578
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-asset-list", children: assets.map((asset) => {
|
|
2903
|
-
const tokenAmount = asset.balance ?
|
|
3579
|
+
const tokenAmount = asset.balance ? _chunkDZNXG5JKcjs.tokenFormatter.format(
|
|
2904
3580
|
Number(asset.balance) / 10 ** asset.decimals
|
|
2905
3581
|
) : "0";
|
|
2906
|
-
const balanceUsd = asset.balanceUsd && asset.balanceUsd > 0 ?
|
|
3582
|
+
const balanceUsd = asset.balanceUsd && asset.balanceUsd > 0 ? _chunkDZNXG5JKcjs.currencyFormatter.format(asset.balanceUsd) : `${tokenAmount} ${asset.symbol}`;
|
|
2907
3583
|
const tokenIcon = _nullishCoalesce(asset.icon, () => ( _chunk7JIDIX27cjs.getTokenIcon.call(void 0, asset.symbol)));
|
|
2908
3584
|
const chainIcon = _chunk7JIDIX27cjs.getChainIcon.call(void 0, asset.chainId);
|
|
2909
3585
|
const badge = _chunk7JIDIX27cjs.getChainBadge.call(void 0, asset.chainId);
|
|
@@ -2954,7 +3630,7 @@ function DappImportAssetSelectStep({
|
|
|
2954
3630
|
);
|
|
2955
3631
|
}) })
|
|
2956
3632
|
] }),
|
|
2957
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3633
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkDZNXG5JKcjs.PoweredBy, {})
|
|
2958
3634
|
] });
|
|
2959
3635
|
}
|
|
2960
3636
|
DappImportAssetSelectStep.displayName = "DappImportAssetSelectStep";
|
|
@@ -3020,7 +3696,7 @@ async function detectPolymarketWalletKind(params) {
|
|
|
3020
3696
|
contracts: [
|
|
3021
3697
|
{
|
|
3022
3698
|
address: proxyWallet,
|
|
3023
|
-
abi:
|
|
3699
|
+
abi: _chunkDZNXG5JKcjs.SAFE_ABI,
|
|
3024
3700
|
functionName: "isOwner",
|
|
3025
3701
|
args: [eoa]
|
|
3026
3702
|
},
|
|
@@ -3145,7 +3821,7 @@ async function fetchPolymarketProxyWallet(eoa, signal) {
|
|
|
3145
3821
|
let response;
|
|
3146
3822
|
try {
|
|
3147
3823
|
response = await fetch(url, { signal });
|
|
3148
|
-
} catch (
|
|
3824
|
+
} catch (e27) {
|
|
3149
3825
|
return null;
|
|
3150
3826
|
}
|
|
3151
3827
|
if (!response.ok) {
|
|
@@ -3154,7 +3830,7 @@ async function fetchPolymarketProxyWallet(eoa, signal) {
|
|
|
3154
3830
|
let payload;
|
|
3155
3831
|
try {
|
|
3156
3832
|
payload = await response.json();
|
|
3157
|
-
} catch (
|
|
3833
|
+
} catch (e28) {
|
|
3158
3834
|
return null;
|
|
3159
3835
|
}
|
|
3160
3836
|
const raw = payload.proxyWallet;
|
|
@@ -3208,7 +3884,7 @@ async function readPolymarketBalances(params) {
|
|
|
3208
3884
|
pusd: results[0].status === "success" ? results[0].result : 0n,
|
|
3209
3885
|
usdce: results[1].status === "success" ? results[1].result : 0n
|
|
3210
3886
|
};
|
|
3211
|
-
} catch (
|
|
3887
|
+
} catch (e29) {
|
|
3212
3888
|
return { pusd: 0n, usdce: 0n };
|
|
3213
3889
|
}
|
|
3214
3890
|
}
|
|
@@ -3231,7 +3907,7 @@ async function executePolymarketSafeTransfer(params) {
|
|
|
3231
3907
|
}
|
|
3232
3908
|
const isOwner = await publicClient.readContract({
|
|
3233
3909
|
address: safeAddress,
|
|
3234
|
-
abi:
|
|
3910
|
+
abi: _chunkDZNXG5JKcjs.SAFE_ABI,
|
|
3235
3911
|
functionName: "isOwner",
|
|
3236
3912
|
args: [account.address]
|
|
3237
3913
|
});
|
|
@@ -3248,7 +3924,7 @@ async function executePolymarketSafeTransfer(params) {
|
|
|
3248
3924
|
account,
|
|
3249
3925
|
chain,
|
|
3250
3926
|
address: safeAddress,
|
|
3251
|
-
abi:
|
|
3927
|
+
abi: _chunkDZNXG5JKcjs.SAFE_ABI,
|
|
3252
3928
|
functionName: "execTransaction",
|
|
3253
3929
|
args: [
|
|
3254
3930
|
safeTx.to,
|
|
@@ -3267,7 +3943,7 @@ async function executePolymarketSafeTransfer(params) {
|
|
|
3267
3943
|
hash: txHash
|
|
3268
3944
|
});
|
|
3269
3945
|
const parsed = _viem.parseEventLogs.call(void 0, {
|
|
3270
|
-
abi:
|
|
3946
|
+
abi: _chunkDZNXG5JKcjs.SAFE_ABI,
|
|
3271
3947
|
logs: receipt.logs.filter(
|
|
3272
3948
|
(log) => log.address.toLowerCase() === safeAddress.toLowerCase()
|
|
3273
3949
|
),
|
|
@@ -3345,21 +4021,21 @@ var polymarketProvider = {
|
|
|
3345
4021
|
async fetchAvailability({ eoa, getPublicClient: getPublicClient2, signal }) {
|
|
3346
4022
|
const proxyWallet = await fetchPolymarketProxyWallet(eoa, signal);
|
|
3347
4023
|
if (!proxyWallet) return null;
|
|
3348
|
-
if (_optionalChain([signal, 'optionalAccess',
|
|
4024
|
+
if (_optionalChain([signal, 'optionalAccess', _117 => _117.aborted])) return null;
|
|
3349
4025
|
const polygonClient = getPublicClient2(POLYMARKET_POLYGON_CHAIN_ID);
|
|
3350
4026
|
if (!polygonClient) return null;
|
|
3351
4027
|
const balances = await readPolymarketBalances({
|
|
3352
4028
|
publicClient: polygonClient,
|
|
3353
4029
|
proxyWallet
|
|
3354
4030
|
});
|
|
3355
|
-
if (_optionalChain([signal, 'optionalAccess',
|
|
4031
|
+
if (_optionalChain([signal, 'optionalAccess', _118 => _118.aborted])) return null;
|
|
3356
4032
|
if (balances.pusd === 0n && balances.usdce === 0n) return null;
|
|
3357
4033
|
const walletKind = await detectPolymarketWalletKind({
|
|
3358
4034
|
publicClient: polygonClient,
|
|
3359
4035
|
proxyWallet,
|
|
3360
4036
|
eoa
|
|
3361
4037
|
});
|
|
3362
|
-
if (_optionalChain([signal, 'optionalAccess',
|
|
4038
|
+
if (_optionalChain([signal, 'optionalAccess', _119 => _119.aborted])) return null;
|
|
3363
4039
|
if (!walletKind) return null;
|
|
3364
4040
|
const assets = [];
|
|
3365
4041
|
if (balances.pusd > 0n) {
|
|
@@ -3569,8 +4245,19 @@ function applyBack(state, hasWalletOptions) {
|
|
|
3569
4245
|
},
|
|
3570
4246
|
flow: { ...state.flow, step: "solana-amount", hasNavigatedBack: true }
|
|
3571
4247
|
};
|
|
4248
|
+
case "exchange-connect":
|
|
4249
|
+
return {
|
|
4250
|
+
...state,
|
|
4251
|
+
flow: {
|
|
4252
|
+
...state.flow,
|
|
4253
|
+
step: "exchange-select",
|
|
4254
|
+
hasNavigatedBack: true
|
|
4255
|
+
}
|
|
4256
|
+
};
|
|
3572
4257
|
case "select-asset":
|
|
3573
4258
|
case "deposit-address":
|
|
4259
|
+
case "fiat-onramp":
|
|
4260
|
+
case "exchange-select":
|
|
3574
4261
|
case "solana-token-select":
|
|
3575
4262
|
case "dapp-import-asset-select":
|
|
3576
4263
|
return {
|
|
@@ -3587,7 +4274,8 @@ function applyBack(state, hasWalletOptions) {
|
|
|
3587
4274
|
...state.dappImport,
|
|
3588
4275
|
activeProviderId: null,
|
|
3589
4276
|
selectedAsset: null
|
|
3590
|
-
}
|
|
4277
|
+
},
|
|
4278
|
+
exchange: { selectedConnection: null }
|
|
3591
4279
|
};
|
|
3592
4280
|
case "connect":
|
|
3593
4281
|
case "setup":
|
|
@@ -3600,7 +4288,8 @@ function applyBack(state, hasWalletOptions) {
|
|
|
3600
4288
|
mode: null,
|
|
3601
4289
|
isConnectSelectionConfirmed: false,
|
|
3602
4290
|
hasNavigatedBack: hasWalletOptions || state.flow.hasNavigatedBack
|
|
3603
|
-
}
|
|
4291
|
+
},
|
|
4292
|
+
exchange: { selectedConnection: null }
|
|
3604
4293
|
};
|
|
3605
4294
|
}
|
|
3606
4295
|
return state;
|
|
@@ -3620,6 +4309,10 @@ function modeEntryStep(mode) {
|
|
|
3620
4309
|
return "solana-token-select";
|
|
3621
4310
|
case "dapp-import":
|
|
3622
4311
|
return "dapp-import-asset-select";
|
|
4312
|
+
case "fiat-onramp":
|
|
4313
|
+
return "fiat-onramp";
|
|
4314
|
+
case "exchange-connect":
|
|
4315
|
+
return "exchange-select";
|
|
3623
4316
|
}
|
|
3624
4317
|
}
|
|
3625
4318
|
function updateSetupEntry(state, owner, update) {
|
|
@@ -3665,7 +4358,8 @@ function applyAction(state, action) {
|
|
|
3665
4358
|
...state.dappImport,
|
|
3666
4359
|
activeProviderId: null,
|
|
3667
4360
|
selectedAsset: null
|
|
3668
|
-
}
|
|
4361
|
+
},
|
|
4362
|
+
exchange: { selectedConnection: null }
|
|
3669
4363
|
};
|
|
3670
4364
|
case "connect/wallet-confirmed":
|
|
3671
4365
|
if (!action.mode) return state;
|
|
@@ -3689,6 +4383,39 @@ function applyAction(state, action) {
|
|
|
3689
4383
|
step: "deposit-address"
|
|
3690
4384
|
}
|
|
3691
4385
|
};
|
|
4386
|
+
case "connect/fiat-onramp-selected":
|
|
4387
|
+
return {
|
|
4388
|
+
...state,
|
|
4389
|
+
flow: {
|
|
4390
|
+
...state.flow,
|
|
4391
|
+
mode: "fiat-onramp",
|
|
4392
|
+
isConnectSelectionConfirmed: true,
|
|
4393
|
+
step: modeEntryStep("fiat-onramp")
|
|
4394
|
+
},
|
|
4395
|
+
fiat: { ...state.fiat, selectedMethod: _nullishCoalesce(action.paymentMethod, () => ( null)) }
|
|
4396
|
+
};
|
|
4397
|
+
case "connect/exchange-selected":
|
|
4398
|
+
return {
|
|
4399
|
+
...state,
|
|
4400
|
+
flow: {
|
|
4401
|
+
...state.flow,
|
|
4402
|
+
mode: "exchange-connect",
|
|
4403
|
+
isConnectSelectionConfirmed: true,
|
|
4404
|
+
step: modeEntryStep("exchange-connect")
|
|
4405
|
+
},
|
|
4406
|
+
exchange: { selectedConnection: null }
|
|
4407
|
+
};
|
|
4408
|
+
case "exchange/connection-selected":
|
|
4409
|
+
return {
|
|
4410
|
+
...state,
|
|
4411
|
+
flow: {
|
|
4412
|
+
...state.flow,
|
|
4413
|
+
mode: "exchange-connect",
|
|
4414
|
+
isConnectSelectionConfirmed: true,
|
|
4415
|
+
step: "exchange-connect"
|
|
4416
|
+
},
|
|
4417
|
+
exchange: { selectedConnection: action.connection }
|
|
4418
|
+
};
|
|
3692
4419
|
case "connect/auto-locked":
|
|
3693
4420
|
return {
|
|
3694
4421
|
...state,
|
|
@@ -3714,7 +4441,8 @@ function applyAction(state, action) {
|
|
|
3714
4441
|
...state.dappImport,
|
|
3715
4442
|
activeProviderId: null,
|
|
3716
4443
|
selectedAsset: null
|
|
3717
|
-
}
|
|
4444
|
+
},
|
|
4445
|
+
exchange: { selectedConnection: null }
|
|
3718
4446
|
};
|
|
3719
4447
|
case "setup/started": {
|
|
3720
4448
|
const existing = state.setup.byOwner[ownerKey(action.owner)];
|
|
@@ -3723,12 +4451,12 @@ function applyAction(state, action) {
|
|
|
3723
4451
|
requestKey: action.requestKey,
|
|
3724
4452
|
cacheKey: action.cacheKey,
|
|
3725
4453
|
status: "loading",
|
|
3726
|
-
smartAccount: _nullishCoalesce(_optionalChain([existing, 'optionalAccess',
|
|
3727
|
-
sessionOwnerAddress: _nullishCoalesce(_optionalChain([existing, 'optionalAccess',
|
|
3728
|
-
solanaDepositAddress: _nullishCoalesce(_optionalChain([existing, 'optionalAccess',
|
|
4454
|
+
smartAccount: _nullishCoalesce(_optionalChain([existing, 'optionalAccess', _120 => _120.smartAccount]), () => ( null)),
|
|
4455
|
+
sessionOwnerAddress: _nullishCoalesce(_optionalChain([existing, 'optionalAccess', _121 => _121.sessionOwnerAddress]), () => ( null)),
|
|
4456
|
+
solanaDepositAddress: _nullishCoalesce(_optionalChain([existing, 'optionalAccess', _122 => _122.solanaDepositAddress]), () => ( null)),
|
|
3729
4457
|
message: null,
|
|
3730
4458
|
cacheable: action.cacheable,
|
|
3731
|
-
attemptNonce: _nullishCoalesce(_optionalChain([existing, 'optionalAccess',
|
|
4459
|
+
attemptNonce: _nullishCoalesce(_optionalChain([existing, 'optionalAccess', _123 => _123.attemptNonce]), () => ( 0))
|
|
3732
4460
|
}));
|
|
3733
4461
|
}
|
|
3734
4462
|
case "setup/ready": {
|
|
@@ -3949,7 +4677,9 @@ function applyAction(state, action) {
|
|
|
3949
4677
|
activeProviderId: null,
|
|
3950
4678
|
selectedAsset: null
|
|
3951
4679
|
},
|
|
3952
|
-
setup: { byOwner: preservedByOwner }
|
|
4680
|
+
setup: { byOwner: preservedByOwner },
|
|
4681
|
+
fiat: { selectedMethod: null },
|
|
4682
|
+
exchange: { selectedConnection: null }
|
|
3953
4683
|
};
|
|
3954
4684
|
}
|
|
3955
4685
|
case "target/changed": {
|
|
@@ -4023,6 +4753,12 @@ function createInitialState(overrides) {
|
|
|
4023
4753
|
},
|
|
4024
4754
|
setup: {
|
|
4025
4755
|
byOwner: {}
|
|
4756
|
+
},
|
|
4757
|
+
fiat: {
|
|
4758
|
+
selectedMethod: null
|
|
4759
|
+
},
|
|
4760
|
+
exchange: {
|
|
4761
|
+
selectedConnection: null
|
|
4026
4762
|
}
|
|
4027
4763
|
};
|
|
4028
4764
|
}
|
|
@@ -4091,15 +4827,15 @@ var SetupError = class extends Error {
|
|
|
4091
4827
|
}
|
|
4092
4828
|
};
|
|
4093
4829
|
async function resolveSessionOwner(eoaAddress) {
|
|
4094
|
-
const local =
|
|
4830
|
+
const local = _chunkDZNXG5JKcjs.loadSessionOwnerFromStorage.call(void 0, eoaAddress);
|
|
4095
4831
|
if (local) {
|
|
4096
4832
|
return {
|
|
4097
|
-
account:
|
|
4833
|
+
account: _chunkDZNXG5JKcjs.accountFromPrivateKey.call(void 0, local.privateKey),
|
|
4098
4834
|
address: local.address
|
|
4099
4835
|
};
|
|
4100
4836
|
}
|
|
4101
|
-
const created =
|
|
4102
|
-
|
|
4837
|
+
const created = _chunkDZNXG5JKcjs.createSessionOwnerKey.call(void 0, );
|
|
4838
|
+
_chunkDZNXG5JKcjs.saveSessionOwnerToStorage.call(void 0, eoaAddress, created.privateKey, created.address);
|
|
4103
4839
|
return { account: created.account, address: created.address };
|
|
4104
4840
|
}
|
|
4105
4841
|
function stableStringify(value) {
|
|
@@ -4149,14 +4885,14 @@ function computeCacheKey(input, sessionOwnerAddress) {
|
|
|
4149
4885
|
});
|
|
4150
4886
|
}
|
|
4151
4887
|
function computeIsCacheable(input) {
|
|
4152
|
-
return !input.forceRegister && !(_nullishCoalesce(_optionalChain([input, 'access',
|
|
4888
|
+
return !input.forceRegister && !(_nullishCoalesce(_optionalChain([input, 'access', _124 => _124.postBridgeActions, 'optionalAccess', _125 => _125.length]), () => ( 0)));
|
|
4153
4889
|
}
|
|
4154
4890
|
var SETUP_REQUEST_DEDUPE_TTL_MS = 3e4;
|
|
4155
4891
|
var setupRequestDedupe = /* @__PURE__ */ new Map();
|
|
4156
4892
|
function readDedupedAccountSetupResult(requestKey) {
|
|
4157
4893
|
const now = Date.now();
|
|
4158
4894
|
const existing = setupRequestDedupe.get(requestKey);
|
|
4159
|
-
if (_optionalChain([existing, 'optionalAccess',
|
|
4895
|
+
if (_optionalChain([existing, 'optionalAccess', _126 => _126.settled]) && existing.expiresAt > now && existing.result) {
|
|
4160
4896
|
return existing.result;
|
|
4161
4897
|
}
|
|
4162
4898
|
return null;
|
|
@@ -4167,16 +4903,16 @@ async function runAccountSetup(input, deps) {
|
|
|
4167
4903
|
try {
|
|
4168
4904
|
const sessionOwner = await resolveSessionOwner(input.ownerAddress);
|
|
4169
4905
|
const cacheKey = computeCacheKey(input, sessionOwner.address);
|
|
4170
|
-
|
|
4906
|
+
_chunkDZNXG5JKcjs.debugLog.call(void 0, debug, "account-setup", "setup:start", {
|
|
4171
4907
|
owner: input.ownerAddress,
|
|
4172
4908
|
sessionOwner: sessionOwner.address,
|
|
4173
|
-
hasPostBridgeActions: Boolean(_optionalChain([input, 'access',
|
|
4909
|
+
hasPostBridgeActions: Boolean(_optionalChain([input, 'access', _127 => _127.postBridgeActions, 'optionalAccess', _128 => _128.length])),
|
|
4174
4910
|
forceRegister: _nullishCoalesce(input.forceRegister, () => ( false))
|
|
4175
4911
|
});
|
|
4176
4912
|
const setup = await service.setupAccount({
|
|
4177
4913
|
ownerAddress: input.ownerAddress,
|
|
4178
4914
|
sessionOwnerAddress: sessionOwner.address,
|
|
4179
|
-
targetChain:
|
|
4915
|
+
targetChain: _chunkDZNXG5JKcjs.targetChainToCaip2.call(void 0, input.targetChain),
|
|
4180
4916
|
targetToken: input.targetToken,
|
|
4181
4917
|
recipient: input.recipient,
|
|
4182
4918
|
postBridgeActions: input.postBridgeActions,
|
|
@@ -4215,7 +4951,7 @@ async function runAccountSetup(input, deps) {
|
|
|
4215
4951
|
primaryType: typedData.primaryType,
|
|
4216
4952
|
message: typedData.message
|
|
4217
4953
|
});
|
|
4218
|
-
const sessionDetails =
|
|
4954
|
+
const sessionDetails = _chunkDZNXG5JKcjs.buildSessionDetails.call(void 0,
|
|
4219
4955
|
setup.sessionDetailsUnsigned,
|
|
4220
4956
|
signature
|
|
4221
4957
|
);
|
|
@@ -4229,13 +4965,13 @@ async function runAccountSetup(input, deps) {
|
|
|
4229
4965
|
eoaAddress: input.ownerAddress,
|
|
4230
4966
|
sessionOwner: sessionOwner.address,
|
|
4231
4967
|
target: {
|
|
4232
|
-
chain:
|
|
4968
|
+
chain: _chunkDZNXG5JKcjs.targetChainToCaip2.call(void 0, input.targetChain),
|
|
4233
4969
|
token: input.targetToken,
|
|
4234
4970
|
...input.recipient && { recipient: input.recipient },
|
|
4235
|
-
..._optionalChain([input, 'access',
|
|
4971
|
+
..._optionalChain([input, 'access', _129 => _129.postBridgeActions, 'optionalAccess', _130 => _130.length]) && {
|
|
4236
4972
|
postBridgeActions: input.postBridgeActions
|
|
4237
4973
|
},
|
|
4238
|
-
..._optionalChain([input, 'access',
|
|
4974
|
+
..._optionalChain([input, 'access', _131 => _131.outputTokenRules, 'optionalAccess', _132 => _132.length]) && {
|
|
4239
4975
|
outputTokenRules: input.outputTokenRules
|
|
4240
4976
|
},
|
|
4241
4977
|
...input.rejectUnmapped != null && {
|
|
@@ -4251,7 +4987,7 @@ async function runAccountSetup(input, deps) {
|
|
|
4251
4987
|
isRegistered: true
|
|
4252
4988
|
};
|
|
4253
4989
|
} catch (error) {
|
|
4254
|
-
|
|
4990
|
+
_chunkDZNXG5JKcjs.debugError.call(void 0, debug, "account-setup", "setup:failed", error, {
|
|
4255
4991
|
owner: input.ownerAddress
|
|
4256
4992
|
});
|
|
4257
4993
|
if (error instanceof SetupError) throw error;
|
|
@@ -4262,7 +4998,7 @@ function runAccountSetupDeduped(input, deps, requestKey) {
|
|
|
4262
4998
|
const now = Date.now();
|
|
4263
4999
|
const existing = setupRequestDedupe.get(requestKey);
|
|
4264
5000
|
if (existing && (!existing.settled || existing.expiresAt > now)) {
|
|
4265
|
-
|
|
5001
|
+
_chunkDZNXG5JKcjs.debugLog.call(void 0, deps.debug, "account-setup", "setup:dedupe-hit", {
|
|
4266
5002
|
owner: input.ownerAddress,
|
|
4267
5003
|
forceRegister: _nullishCoalesce(input.forceRegister, () => ( false))
|
|
4268
5004
|
});
|
|
@@ -4350,10 +5086,12 @@ var QR_AUTO_ADVANCE_HYDRATION_GRACE_MS = 1e3;
|
|
|
4350
5086
|
function isSameRoute2(sourceChain, sourceToken, targetChain, targetToken) {
|
|
4351
5087
|
return sourceChain === targetChain && sourceToken.toLowerCase() === targetToken.toLowerCase();
|
|
4352
5088
|
}
|
|
5089
|
+
var SWAPPED_SOURCE_CHAIN = 8453;
|
|
5090
|
+
var SWAPPED_SOURCE_TOKEN = "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913";
|
|
4353
5091
|
function getAddressKey(address) {
|
|
4354
5092
|
return address ? address.toLowerCase() : null;
|
|
4355
5093
|
}
|
|
4356
|
-
function deriveStep(flow, d, p, activeEntry) {
|
|
5094
|
+
function deriveStep(flow, d, p, activeEntry, fiat, exchange) {
|
|
4357
5095
|
const flowStep = flow.step;
|
|
4358
5096
|
const smartAccount = activeEntry.smartAccount;
|
|
4359
5097
|
const solanaDepositAddress = activeEntry.solanaDepositAddress;
|
|
@@ -4368,6 +5106,23 @@ function deriveStep(flow, d, p, activeEntry) {
|
|
|
4368
5106
|
smartAccount,
|
|
4369
5107
|
solanaDepositAddress: _nullishCoalesce(solanaDepositAddress, () => ( void 0))
|
|
4370
5108
|
};
|
|
5109
|
+
case "fiat-onramp":
|
|
5110
|
+
if (!smartAccount) return { type: "setup" };
|
|
5111
|
+
return {
|
|
5112
|
+
type: "fiat-onramp",
|
|
5113
|
+
smartAccount,
|
|
5114
|
+
paymentMethod: _nullishCoalesce(fiat.selectedMethod, () => ( void 0))
|
|
5115
|
+
};
|
|
5116
|
+
case "exchange-select":
|
|
5117
|
+
return { type: "exchange-select" };
|
|
5118
|
+
case "exchange-connect":
|
|
5119
|
+
if (!exchange.selectedConnection) return { type: "exchange-select" };
|
|
5120
|
+
if (!smartAccount) return { type: "setup" };
|
|
5121
|
+
return {
|
|
5122
|
+
type: "exchange-connect",
|
|
5123
|
+
smartAccount,
|
|
5124
|
+
connection: exchange.selectedConnection
|
|
5125
|
+
};
|
|
4371
5126
|
case "select-asset":
|
|
4372
5127
|
if (!smartAccount) return { type: "setup" };
|
|
4373
5128
|
return { type: "select-asset", smartAccount };
|
|
@@ -4456,6 +5211,8 @@ function resolveOwnerForMode(mode, ctx) {
|
|
|
4456
5211
|
switch (mode) {
|
|
4457
5212
|
case "deposit-address":
|
|
4458
5213
|
case "solana-wallet":
|
|
5214
|
+
case "fiat-onramp":
|
|
5215
|
+
case "exchange-connect":
|
|
4459
5216
|
return _nullishCoalesce(ctx.dappAddress, () => ( null));
|
|
4460
5217
|
case "wallet":
|
|
4461
5218
|
return _nullishCoalesce(ctx.walletOwner, () => ( null));
|
|
@@ -4486,6 +5243,10 @@ function DepositFlow({
|
|
|
4486
5243
|
forceRegister = false,
|
|
4487
5244
|
enableSolana = true,
|
|
4488
5245
|
dappImports,
|
|
5246
|
+
enableFiatOnramp = false,
|
|
5247
|
+
enableQrTransfer = true,
|
|
5248
|
+
fiatOnrampMethods,
|
|
5249
|
+
enableExchangeConnect = false,
|
|
4489
5250
|
reownWallet,
|
|
4490
5251
|
onConnect,
|
|
4491
5252
|
onDisconnect,
|
|
@@ -4499,12 +5260,12 @@ function DepositFlow({
|
|
|
4499
5260
|
onError,
|
|
4500
5261
|
debug
|
|
4501
5262
|
}) {
|
|
4502
|
-
const onStepChangeRef =
|
|
4503
|
-
const onEventRef =
|
|
4504
|
-
const onLifecycleRef =
|
|
4505
|
-
const onErrorRef =
|
|
5263
|
+
const onStepChangeRef = _chunkDZNXG5JKcjs.useLatestRef.call(void 0, onStepChange);
|
|
5264
|
+
const onEventRef = _chunkDZNXG5JKcjs.useLatestRef.call(void 0, onEvent);
|
|
5265
|
+
const onLifecycleRef = _chunkDZNXG5JKcjs.useLatestRef.call(void 0, onLifecycle);
|
|
5266
|
+
const onErrorRef = _chunkDZNXG5JKcjs.useLatestRef.call(void 0, onError);
|
|
4506
5267
|
const hasInitialReownSession = Boolean(
|
|
4507
|
-
enableSolana ? _optionalChain([reownWallet, 'optionalAccess',
|
|
5268
|
+
enableSolana ? _optionalChain([reownWallet, 'optionalAccess', _133 => _133.isConnected]) || _optionalChain([reownWallet, 'optionalAccess', _134 => _134.address]) : _optionalChain([reownWallet, 'optionalAccess', _135 => _135.address])
|
|
4508
5269
|
);
|
|
4509
5270
|
const hasInitialWalletHydrationPending = Boolean(
|
|
4510
5271
|
dappAddress && (hasDappWalletClientProp && dappWalletClient === void 0 || reownWallet && !hasInitialReownSession && !reownWallet.isReady)
|
|
@@ -4514,6 +5275,8 @@ function DepositFlow({
|
|
|
4514
5275
|
const depositSlice = useDepositStore((s) => s.deposit);
|
|
4515
5276
|
const processingSlice = useDepositStore((s) => s.processing);
|
|
4516
5277
|
const setupSlice = useDepositStore((s) => s.setup);
|
|
5278
|
+
const fiatSlice = useDepositStore((s) => s.fiat);
|
|
5279
|
+
const exchangeSlice = useDepositStore((s) => s.exchange);
|
|
4517
5280
|
const flowMode = flowSlice.mode;
|
|
4518
5281
|
const isConnectSelectionConfirmed = flowSlice.isConnectSelectionConfirmed;
|
|
4519
5282
|
const hasNavigatedBack = flowSlice.hasNavigatedBack;
|
|
@@ -4525,13 +5288,13 @@ function DepositFlow({
|
|
|
4525
5288
|
const stableWalletSelectionKeyRef = _react.useRef.call(void 0, null);
|
|
4526
5289
|
const logFlow = _react.useCallback.call(void 0,
|
|
4527
5290
|
(message, data) => {
|
|
4528
|
-
|
|
5291
|
+
_chunkDZNXG5JKcjs.debugLog.call(void 0, debug, "deposit-flow", message, data);
|
|
4529
5292
|
},
|
|
4530
5293
|
[debug]
|
|
4531
5294
|
);
|
|
4532
5295
|
const logFlowError = _react.useCallback.call(void 0,
|
|
4533
5296
|
(message, error, data) => {
|
|
4534
|
-
|
|
5297
|
+
_chunkDZNXG5JKcjs.debugError.call(void 0, debug, "deposit-flow", message, error, data);
|
|
4535
5298
|
},
|
|
4536
5299
|
[debug]
|
|
4537
5300
|
);
|
|
@@ -4547,19 +5310,19 @@ function DepositFlow({
|
|
|
4547
5310
|
_viem.formatUnits.call(void 0, BigInt(asset.balance), asset.decimals)
|
|
4548
5311
|
);
|
|
4549
5312
|
if (balanceUnits > 0) return asset.balanceUsd / balanceUnits;
|
|
4550
|
-
} catch (
|
|
5313
|
+
} catch (e30) {
|
|
4551
5314
|
}
|
|
4552
5315
|
}
|
|
4553
5316
|
}
|
|
4554
5317
|
return null;
|
|
4555
5318
|
}, []);
|
|
4556
5319
|
const dappSwitchChain = _react.useMemo.call(void 0, () => {
|
|
4557
|
-
if (!_optionalChain([dappWalletClient, 'optionalAccess',
|
|
5320
|
+
if (!_optionalChain([dappWalletClient, 'optionalAccess', _136 => _136.switchChain])) return void 0;
|
|
4558
5321
|
return async (chainId) => {
|
|
4559
|
-
await _optionalChain([dappWalletClient, 'access',
|
|
5322
|
+
await _optionalChain([dappWalletClient, 'access', _137 => _137.switchChain, 'optionalCall', _138 => _138({ id: chainId })]);
|
|
4560
5323
|
};
|
|
4561
5324
|
}, [dappWalletClient]);
|
|
4562
|
-
const connectedWalletAddress = _nullishCoalesce(_optionalChain([dappWalletClient, 'optionalAccess',
|
|
5325
|
+
const connectedWalletAddress = _nullishCoalesce(_optionalChain([dappWalletClient, 'optionalAccess', _139 => _139.account, 'optionalAccess', _140 => _140.address]), () => ( null));
|
|
4563
5326
|
const walletOptions = _react.useMemo.call(void 0, () => {
|
|
4564
5327
|
const options = [];
|
|
4565
5328
|
const seen = /* @__PURE__ */ new Set();
|
|
@@ -4573,7 +5336,7 @@ function DepositFlow({
|
|
|
4573
5336
|
});
|
|
4574
5337
|
seen.add(id);
|
|
4575
5338
|
}
|
|
4576
|
-
if (enableSolana && _optionalChain([reownWallet, 'optionalAccess',
|
|
5339
|
+
if (enableSolana && _optionalChain([reownWallet, 'optionalAccess', _141 => _141.isConnected]) && reownWallet.isSolana && reownWallet.solanaAddress && dappAddress) {
|
|
4577
5340
|
const id = _nullishCoalesce(reownWallet.caipAddress, () => ( `solana:${reownWallet.solanaAddress}`));
|
|
4578
5341
|
if (!seen.has(id)) {
|
|
4579
5342
|
options.push({
|
|
@@ -4585,7 +5348,7 @@ function DepositFlow({
|
|
|
4585
5348
|
});
|
|
4586
5349
|
seen.add(id);
|
|
4587
5350
|
}
|
|
4588
|
-
} else if (_optionalChain([reownWallet, 'optionalAccess',
|
|
5351
|
+
} else if (_optionalChain([reownWallet, 'optionalAccess', _142 => _142.address]) && reownWallet.isConnected && reownWallet.walletClient && reownWallet.publicClient && !seen.has(`evm:${reownWallet.address.toLowerCase()}`)) {
|
|
4589
5352
|
const id = `evm:${reownWallet.address.toLowerCase()}`;
|
|
4590
5353
|
if (!seen.has(id)) {
|
|
4591
5354
|
options.push({
|
|
@@ -4602,20 +5365,20 @@ function DepositFlow({
|
|
|
4602
5365
|
}, [
|
|
4603
5366
|
connectedWalletAddress,
|
|
4604
5367
|
dappAddress,
|
|
4605
|
-
_optionalChain([reownWallet, 'optionalAccess',
|
|
4606
|
-
_optionalChain([reownWallet, 'optionalAccess',
|
|
4607
|
-
_optionalChain([reownWallet, 'optionalAccess',
|
|
4608
|
-
_optionalChain([reownWallet, 'optionalAccess',
|
|
4609
|
-
_optionalChain([reownWallet, 'optionalAccess',
|
|
5368
|
+
_optionalChain([reownWallet, 'optionalAccess', _143 => _143.address]),
|
|
5369
|
+
_optionalChain([reownWallet, 'optionalAccess', _144 => _144.isConnected]),
|
|
5370
|
+
_optionalChain([reownWallet, 'optionalAccess', _145 => _145.walletClient]),
|
|
5371
|
+
_optionalChain([reownWallet, 'optionalAccess', _146 => _146.publicClient]),
|
|
5372
|
+
_optionalChain([reownWallet, 'optionalAccess', _147 => _147.icon]),
|
|
4610
5373
|
enableSolana,
|
|
4611
|
-
_optionalChain([reownWallet, 'optionalAccess',
|
|
4612
|
-
_optionalChain([reownWallet, 'optionalAccess',
|
|
4613
|
-
_optionalChain([reownWallet, 'optionalAccess',
|
|
5374
|
+
_optionalChain([reownWallet, 'optionalAccess', _148 => _148.isSolana]),
|
|
5375
|
+
_optionalChain([reownWallet, 'optionalAccess', _149 => _149.solanaAddress]),
|
|
5376
|
+
_optionalChain([reownWallet, 'optionalAccess', _150 => _150.caipAddress])
|
|
4614
5377
|
]);
|
|
4615
|
-
const canAutoLock = _optionalChain([dappWalletClient, 'optionalAccess',
|
|
5378
|
+
const canAutoLock = _optionalChain([dappWalletClient, 'optionalAccess', _151 => _151.account]) && dappAddress && !reownWallet && !enableFiatOnramp && !enableExchangeConnect;
|
|
4616
5379
|
const hasWalletOptions = walletOptions.length > 0;
|
|
4617
5380
|
const hasReownSession = Boolean(
|
|
4618
|
-
enableSolana ? _optionalChain([reownWallet, 'optionalAccess',
|
|
5381
|
+
enableSolana ? _optionalChain([reownWallet, 'optionalAccess', _152 => _152.isConnected]) || _optionalChain([reownWallet, 'optionalAccess', _153 => _153.address]) : _optionalChain([reownWallet, 'optionalAccess', _154 => _154.address])
|
|
4619
5382
|
);
|
|
4620
5383
|
const isWalletHydrationPending = Boolean(
|
|
4621
5384
|
dappAddress && !hasWalletOptions && (hasDappWalletClientProp && dappWalletClient === void 0 || reownWallet && !hasReownSession && !reownWallet.isReady)
|
|
@@ -4674,16 +5437,16 @@ function DepositFlow({
|
|
|
4674
5437
|
return {
|
|
4675
5438
|
ownerAddress: dappAddress,
|
|
4676
5439
|
walletClient: void 0,
|
|
4677
|
-
publicClient: _nullishCoalesce(dappPublicClient, () => (
|
|
5440
|
+
publicClient: _nullishCoalesce(dappPublicClient, () => ( _chunkDZNXG5JKcjs.getPublicClient.call(void 0, setupChainId))),
|
|
4678
5441
|
switchChain: void 0
|
|
4679
5442
|
};
|
|
4680
5443
|
}
|
|
4681
5444
|
if (canAutoLock) {
|
|
4682
|
-
const fallbackChainId = _nullishCoalesce(_optionalChain([dappWalletClient, 'optionalAccess',
|
|
5445
|
+
const fallbackChainId = _nullishCoalesce(_optionalChain([dappWalletClient, 'optionalAccess', _155 => _155.chain, 'optionalAccess', _156 => _156.id]), () => ( setupChainId));
|
|
4683
5446
|
return {
|
|
4684
5447
|
ownerAddress: dappWalletClient.account.address,
|
|
4685
5448
|
walletClient: dappWalletClient,
|
|
4686
|
-
publicClient: _nullishCoalesce(dappPublicClient, () => (
|
|
5449
|
+
publicClient: _nullishCoalesce(dappPublicClient, () => ( _chunkDZNXG5JKcjs.getPublicClient.call(void 0, fallbackChainId))),
|
|
4687
5450
|
switchChain: dappSwitchChain
|
|
4688
5451
|
};
|
|
4689
5452
|
}
|
|
@@ -4697,24 +5460,24 @@ function DepositFlow({
|
|
|
4697
5460
|
return {
|
|
4698
5461
|
ownerAddress: dappAddress,
|
|
4699
5462
|
walletClient: void 0,
|
|
4700
|
-
publicClient: _nullishCoalesce(dappPublicClient, () => (
|
|
5463
|
+
publicClient: _nullishCoalesce(dappPublicClient, () => ( _chunkDZNXG5JKcjs.getPublicClient.call(void 0, setupChainId))),
|
|
4701
5464
|
switchChain: void 0
|
|
4702
5465
|
};
|
|
4703
5466
|
}
|
|
4704
|
-
if (selectedOption.kind === "connected" && _optionalChain([dappWalletClient, 'optionalAccess',
|
|
4705
|
-
const fallbackChainId = _nullishCoalesce(_optionalChain([dappWalletClient, 'optionalAccess',
|
|
5467
|
+
if (selectedOption.kind === "connected" && _optionalChain([dappWalletClient, 'optionalAccess', _157 => _157.account]) && selectedOption.address && dappWalletClient.account.address.toLowerCase() === selectedOption.address.toLowerCase()) {
|
|
5468
|
+
const fallbackChainId = _nullishCoalesce(_optionalChain([dappWalletClient, 'optionalAccess', _158 => _158.chain, 'optionalAccess', _159 => _159.id]), () => ( setupChainId));
|
|
4706
5469
|
return {
|
|
4707
5470
|
ownerAddress: dappWalletClient.account.address,
|
|
4708
5471
|
walletClient: dappWalletClient,
|
|
4709
|
-
publicClient: _nullishCoalesce(dappPublicClient, () => (
|
|
5472
|
+
publicClient: _nullishCoalesce(dappPublicClient, () => ( _chunkDZNXG5JKcjs.getPublicClient.call(void 0, fallbackChainId))),
|
|
4710
5473
|
switchChain: dappSwitchChain
|
|
4711
5474
|
};
|
|
4712
5475
|
}
|
|
4713
|
-
if (selectedOption.kind === "external" && _optionalChain([reownWallet, 'optionalAccess',
|
|
5476
|
+
if (selectedOption.kind === "external" && _optionalChain([reownWallet, 'optionalAccess', _160 => _160.address]) && selectedOption.address && reownWallet.address.toLowerCase() === selectedOption.address.toLowerCase()) {
|
|
4714
5477
|
return {
|
|
4715
5478
|
ownerAddress: reownWallet.address,
|
|
4716
5479
|
walletClient: reownWallet.walletClient,
|
|
4717
|
-
publicClient: _nullishCoalesce(reownWallet.publicClient, () => (
|
|
5480
|
+
publicClient: _nullishCoalesce(reownWallet.publicClient, () => ( _chunkDZNXG5JKcjs.getPublicClient.call(void 0, setupChainId))),
|
|
4718
5481
|
switchChain: reownWallet.switchChain
|
|
4719
5482
|
};
|
|
4720
5483
|
}
|
|
@@ -4752,7 +5515,7 @@ function DepositFlow({
|
|
|
4752
5515
|
return {
|
|
4753
5516
|
ownerAddress: dappAddress,
|
|
4754
5517
|
walletClient: void 0,
|
|
4755
|
-
publicClient: _nullishCoalesce(dappPublicClient, () => (
|
|
5518
|
+
publicClient: _nullishCoalesce(dappPublicClient, () => ( _chunkDZNXG5JKcjs.getPublicClient.call(void 0, setupChainId))),
|
|
4756
5519
|
switchChain: void 0
|
|
4757
5520
|
};
|
|
4758
5521
|
}
|
|
@@ -4777,37 +5540,37 @@ function DepositFlow({
|
|
|
4777
5540
|
const selectedEvmWalletOwner = _react.useMemo.call(void 0, () => {
|
|
4778
5541
|
if (!selectedWalletId) return null;
|
|
4779
5542
|
const opt = walletOptions.find((o) => o.id === selectedWalletId);
|
|
4780
|
-
if (_optionalChain([opt, 'optionalAccess',
|
|
5543
|
+
if (_optionalChain([opt, 'optionalAccess', _161 => _161.kind]) === "external" && opt.address) {
|
|
4781
5544
|
return opt.address;
|
|
4782
5545
|
}
|
|
4783
|
-
if (_optionalChain([opt, 'optionalAccess',
|
|
5546
|
+
if (_optionalChain([opt, 'optionalAccess', _162 => _162.kind]) === "connected" && opt.address) {
|
|
4784
5547
|
return opt.address;
|
|
4785
5548
|
}
|
|
4786
5549
|
return null;
|
|
4787
5550
|
}, [selectedWalletId, walletOptions]);
|
|
4788
5551
|
const dappImportOwner = _react.useMemo.call(void 0, () => {
|
|
4789
5552
|
if (selectedEvmWalletOwner) return selectedEvmWalletOwner;
|
|
4790
|
-
if (_optionalChain([reownWallet, 'optionalAccess',
|
|
5553
|
+
if (_optionalChain([reownWallet, 'optionalAccess', _163 => _163.address]) && reownWallet.isConnected) {
|
|
4791
5554
|
return reownWallet.address;
|
|
4792
5555
|
}
|
|
4793
5556
|
if (connectedWalletAddress) return connectedWalletAddress;
|
|
4794
5557
|
return null;
|
|
4795
5558
|
}, [
|
|
4796
5559
|
selectedEvmWalletOwner,
|
|
4797
|
-
_optionalChain([reownWallet, 'optionalAccess',
|
|
4798
|
-
_optionalChain([reownWallet, 'optionalAccess',
|
|
5560
|
+
_optionalChain([reownWallet, 'optionalAccess', _164 => _164.address]),
|
|
5561
|
+
_optionalChain([reownWallet, 'optionalAccess', _165 => _165.isConnected]),
|
|
4799
5562
|
connectedWalletAddress
|
|
4800
5563
|
]);
|
|
4801
5564
|
const activeOwner = _react.useMemo.call(void 0,
|
|
4802
5565
|
() => resolveOwnerForMode(flowMode, {
|
|
4803
5566
|
dappAddress,
|
|
4804
|
-
walletOwner: _nullishCoalesce(_optionalChain([signerContext, 'optionalAccess',
|
|
5567
|
+
walletOwner: _nullishCoalesce(_optionalChain([signerContext, 'optionalAccess', _166 => _166.ownerAddress]), () => ( (canAutoLock ? connectedWalletAddress : selectedEvmWalletOwner))),
|
|
4805
5568
|
dappImportOwner
|
|
4806
5569
|
}),
|
|
4807
5570
|
[
|
|
4808
5571
|
flowMode,
|
|
4809
5572
|
dappAddress,
|
|
4810
|
-
_optionalChain([signerContext, 'optionalAccess',
|
|
5573
|
+
_optionalChain([signerContext, 'optionalAccess', _167 => _167.ownerAddress]),
|
|
4811
5574
|
canAutoLock,
|
|
4812
5575
|
connectedWalletAddress,
|
|
4813
5576
|
selectedEvmWalletOwner,
|
|
@@ -4836,12 +5599,12 @@ function DepositFlow({
|
|
|
4836
5599
|
return;
|
|
4837
5600
|
}
|
|
4838
5601
|
lastActiveSetupLifecycleKeyRef.current = lifecycleKey;
|
|
4839
|
-
_optionalChain([onLifecycleRef, 'access',
|
|
5602
|
+
_optionalChain([onLifecycleRef, 'access', _168 => _168.current, 'optionalCall', _169 => _169({
|
|
4840
5603
|
type: "smart-account-changed",
|
|
4841
5604
|
evm: activeEntry.smartAccount,
|
|
4842
5605
|
solana: _nullishCoalesce(activeEntry.solanaDepositAddress, () => ( null))
|
|
4843
5606
|
})]);
|
|
4844
|
-
_optionalChain([onLifecycleRef, 'access',
|
|
5607
|
+
_optionalChain([onLifecycleRef, 'access', _170 => _170.current, 'optionalCall', _171 => _171({
|
|
4845
5608
|
type: "connected",
|
|
4846
5609
|
address: activeOwner,
|
|
4847
5610
|
smartAccount: activeEntry.smartAccount
|
|
@@ -4856,8 +5619,22 @@ function DepositFlow({
|
|
|
4856
5619
|
onLifecycleRef
|
|
4857
5620
|
]);
|
|
4858
5621
|
const effectiveStep = _react.useMemo.call(void 0,
|
|
4859
|
-
() => deriveStep(
|
|
4860
|
-
|
|
5622
|
+
() => deriveStep(
|
|
5623
|
+
flowSlice,
|
|
5624
|
+
depositSlice,
|
|
5625
|
+
processingSlice,
|
|
5626
|
+
activeEntry,
|
|
5627
|
+
fiatSlice,
|
|
5628
|
+
exchangeSlice
|
|
5629
|
+
),
|
|
5630
|
+
[
|
|
5631
|
+
flowSlice,
|
|
5632
|
+
depositSlice,
|
|
5633
|
+
processingSlice,
|
|
5634
|
+
activeEntry,
|
|
5635
|
+
fiatSlice,
|
|
5636
|
+
exchangeSlice
|
|
5637
|
+
]
|
|
4861
5638
|
);
|
|
4862
5639
|
const step = effectiveStep;
|
|
4863
5640
|
const handleBack = _react.useCallback.call(void 0, () => {
|
|
@@ -4870,12 +5647,48 @@ function DepositFlow({
|
|
|
4870
5647
|
portfolioAssetsRef.current = [];
|
|
4871
5648
|
}
|
|
4872
5649
|
}, [storeApi, hasWalletOptions, reownWallet]);
|
|
4873
|
-
const canGoBackFromHere = effectiveStep.type === "deposit-address" || effectiveStep.type === "solana-token-select" || effectiveStep.type === "solana-amount" || effectiveStep.type === "solana-confirm" || effectiveStep.type === "amount" || effectiveStep.type === "confirm" || effectiveStep.type === "dapp-import-asset-select" || effectiveStep.type === "select-asset" && signerContext && !canAutoLock;
|
|
5650
|
+
const canGoBackFromHere = effectiveStep.type === "deposit-address" || effectiveStep.type === "solana-token-select" || effectiveStep.type === "solana-amount" || effectiveStep.type === "solana-confirm" || effectiveStep.type === "amount" || effectiveStep.type === "confirm" || effectiveStep.type === "dapp-import-asset-select" || effectiveStep.type === "fiat-onramp" || effectiveStep.type === "exchange-select" || effectiveStep.type === "exchange-connect" || effectiveStep.type === "select-asset" && signerContext && !canAutoLock;
|
|
4874
5651
|
const currentBackHandler = canGoBackFromHere ? handleBack : void 0;
|
|
4875
5652
|
const currentScreen = showConnectStep ? "connect" : effectiveStep.type;
|
|
4876
5653
|
_react.useEffect.call(void 0, () => {
|
|
4877
|
-
_optionalChain([onStepChangeRef, 'access',
|
|
5654
|
+
_optionalChain([onStepChangeRef, 'access', _172 => _172.current, 'optionalCall', _173 => _173(currentBackHandler, currentScreen)]);
|
|
4878
5655
|
}, [currentBackHandler, currentScreen, onStepChangeRef]);
|
|
5656
|
+
const lastModalHeightRef = _react.useRef.call(void 0, 0);
|
|
5657
|
+
const modalContentElRef = _react.useRef.call(void 0, null);
|
|
5658
|
+
_react.useEffect.call(void 0, () => {
|
|
5659
|
+
const mc = document.querySelector(".rs-modal-content");
|
|
5660
|
+
if (!mc) return;
|
|
5661
|
+
modalContentElRef.current = mc;
|
|
5662
|
+
const ro = new ResizeObserver((entries) => {
|
|
5663
|
+
for (const entry of entries) {
|
|
5664
|
+
const border = _optionalChain([entry, 'access', _174 => _174.borderBoxSize, 'optionalAccess', _175 => _175[0], 'optionalAccess', _176 => _176.blockSize]);
|
|
5665
|
+
lastModalHeightRef.current = typeof border === "number" ? border : entry.contentRect.height;
|
|
5666
|
+
}
|
|
5667
|
+
});
|
|
5668
|
+
ro.observe(mc);
|
|
5669
|
+
return () => {
|
|
5670
|
+
ro.disconnect();
|
|
5671
|
+
modalContentElRef.current = null;
|
|
5672
|
+
};
|
|
5673
|
+
}, []);
|
|
5674
|
+
const stepPinKey = `${_nullishCoalesce(flowMode, () => ( "none"))}:${step.type}`;
|
|
5675
|
+
const prevStepPinKeyRef = _react.useRef.call(void 0, stepPinKey);
|
|
5676
|
+
_react.useLayoutEffect.call(void 0, () => {
|
|
5677
|
+
if (prevStepPinKeyRef.current === stepPinKey) return;
|
|
5678
|
+
prevStepPinKeyRef.current = stepPinKey;
|
|
5679
|
+
const mc = document.querySelector(".rs-modal-content");
|
|
5680
|
+
const lastHeight = lastModalHeightRef.current;
|
|
5681
|
+
if (!mc || lastHeight <= 0) return;
|
|
5682
|
+
const prevTransition = mc.style.transition;
|
|
5683
|
+
mc.style.transition = "none";
|
|
5684
|
+
mc.style.setProperty("min-height", `${lastHeight}px`, "important");
|
|
5685
|
+
void mc.offsetHeight;
|
|
5686
|
+
const rafId = requestAnimationFrame(() => {
|
|
5687
|
+
mc.style.transition = prevTransition;
|
|
5688
|
+
mc.style.removeProperty("min-height");
|
|
5689
|
+
});
|
|
5690
|
+
return () => cancelAnimationFrame(rafId);
|
|
5691
|
+
}, [stepPinKey]);
|
|
4879
5692
|
const stepSendToken = effectiveStep.type === "amount" ? effectiveStep.asset.symbol : null;
|
|
4880
5693
|
const stepOpenEventKey = effectiveStep.type === "select-asset" ? "select-asset" : effectiveStep.type === "deposit-address" ? "deposit-address" : effectiveStep.type === "amount" && stepSendToken ? `amount:${stepSendToken.toLowerCase()}` : null;
|
|
4881
5694
|
const lastStepOpenEventKeyRef = _react.useRef.call(void 0, null);
|
|
@@ -4889,7 +5702,7 @@ function DepositFlow({
|
|
|
4889
5702
|
}
|
|
4890
5703
|
lastStepOpenEventKeyRef.current = stepOpenEventKey;
|
|
4891
5704
|
if (effectiveStep.type === "select-asset") {
|
|
4892
|
-
_optionalChain([onEventRef, 'access',
|
|
5705
|
+
_optionalChain([onEventRef, 'access', _177 => _177.current, 'optionalCall', _178 => _178({
|
|
4893
5706
|
type: "deposit_modal_connected_wallet_select_source_open",
|
|
4894
5707
|
total_balance_in_external_wallet: totalBalanceUsd,
|
|
4895
5708
|
pred_balance: totalBalanceUsd
|
|
@@ -4897,7 +5710,7 @@ function DepositFlow({
|
|
|
4897
5710
|
} else if (effectiveStep.type === "deposit-address") {
|
|
4898
5711
|
const chainName = _chunk7JIDIX27cjs.getChainName.call(void 0, targetChain);
|
|
4899
5712
|
const tokenSymbol = _chunk7JIDIX27cjs.getTargetTokenSymbol.call(void 0, targetToken, targetChain);
|
|
4900
|
-
_optionalChain([onEventRef, 'access',
|
|
5713
|
+
_optionalChain([onEventRef, 'access', _179 => _179.current, 'optionalCall', _180 => _180({
|
|
4901
5714
|
type: "deposit_modal_transfer_crypto_open",
|
|
4902
5715
|
default_chain: chainName,
|
|
4903
5716
|
default_token: tokenSymbol,
|
|
@@ -4905,7 +5718,7 @@ function DepositFlow({
|
|
|
4905
5718
|
})]);
|
|
4906
5719
|
} else if (effectiveStep.type === "amount" && stepSendToken) {
|
|
4907
5720
|
const receiveSymbol = _chunk7JIDIX27cjs.getTargetTokenSymbol.call(void 0, targetToken, targetChain);
|
|
4908
|
-
_optionalChain([onEventRef, 'access',
|
|
5721
|
+
_optionalChain([onEventRef, 'access', _181 => _181.current, 'optionalCall', _182 => _182({
|
|
4909
5722
|
type: "deposit_modal_connected_wallet_enter_value_open",
|
|
4910
5723
|
send_token: stepSendToken,
|
|
4911
5724
|
receive_token: receiveSymbol,
|
|
@@ -4938,7 +5751,7 @@ function DepositFlow({
|
|
|
4938
5751
|
targetToken
|
|
4939
5752
|
]);
|
|
4940
5753
|
_react.useEffect.call(void 0, () => {
|
|
4941
|
-
_optionalChain([onLifecycleRef, 'access',
|
|
5754
|
+
_optionalChain([onLifecycleRef, 'access', _183 => _183.current, 'optionalCall', _184 => _184({
|
|
4942
5755
|
type: "balance-changed",
|
|
4943
5756
|
totalUsd: totalBalanceUsd
|
|
4944
5757
|
})]);
|
|
@@ -4946,13 +5759,15 @@ function DepositFlow({
|
|
|
4946
5759
|
const isDepositAddressMode = flowMode === "deposit-address";
|
|
4947
5760
|
const isSolanaWalletMode = flowMode === "solana-wallet";
|
|
4948
5761
|
const isDappImportMode = flowMode === "dapp-import";
|
|
5762
|
+
const isFiatOnrampMode = flowMode === "fiat-onramp";
|
|
5763
|
+
const isExchangeConnectMode = flowMode === "exchange-connect";
|
|
4949
5764
|
const handleSelectTransferCrypto = _react.useCallback.call(void 0, () => {
|
|
4950
5765
|
storeApi.dispatch({ type: "connect/transfer-crypto-selected" });
|
|
4951
5766
|
}, [storeApi]);
|
|
4952
5767
|
const handleConfirmWallet = _react.useCallback.call(void 0,
|
|
4953
5768
|
(walletId) => {
|
|
4954
5769
|
const selectedOption = walletOptions.find((o) => o.id === walletId);
|
|
4955
|
-
const mode = enableSolana && _optionalChain([selectedOption, 'optionalAccess',
|
|
5770
|
+
const mode = enableSolana && _optionalChain([selectedOption, 'optionalAccess', _185 => _185.kind]) === "solana" ? "solana-wallet" : "wallet";
|
|
4956
5771
|
storeApi.dispatch({
|
|
4957
5772
|
type: "connect/wallet-confirmed",
|
|
4958
5773
|
walletId,
|
|
@@ -4962,7 +5777,7 @@ function DepositFlow({
|
|
|
4962
5777
|
[walletOptions, enableSolana, storeApi]
|
|
4963
5778
|
);
|
|
4964
5779
|
const isSolanaWalletConnected = Boolean(
|
|
4965
|
-
enableSolana && _optionalChain([reownWallet, 'optionalAccess',
|
|
5780
|
+
enableSolana && _optionalChain([reownWallet, 'optionalAccess', _186 => _186.isConnected]) && _optionalChain([reownWallet, 'optionalAccess', _187 => _187.isSolana])
|
|
4966
5781
|
);
|
|
4967
5782
|
const dappImportsKey = dappImports ? Object.keys(dappImports).filter((k) => dappImports[k]).sort().join(",") : "";
|
|
4968
5783
|
const enabledDappImportProviders = _react.useMemo.call(void 0,
|
|
@@ -4975,7 +5790,7 @@ function DepositFlow({
|
|
|
4975
5790
|
const owner = dappImportOwner;
|
|
4976
5791
|
if (owner) {
|
|
4977
5792
|
const wallet = walletOptions.find(
|
|
4978
|
-
(o) => _optionalChain([(_nullishCoalesce(o.address, () => ( null))), 'optionalAccess',
|
|
5793
|
+
(o) => _optionalChain([(_nullishCoalesce(o.address, () => ( null))), 'optionalAccess', _188 => _188.toLowerCase, 'call', _189 => _189()]) === owner.toLowerCase()
|
|
4979
5794
|
);
|
|
4980
5795
|
if (wallet) {
|
|
4981
5796
|
storeApi.dispatch({
|
|
@@ -5013,8 +5828,8 @@ function DepositFlow({
|
|
|
5013
5828
|
eoa: dappImportOwner,
|
|
5014
5829
|
getPublicClient: (chainId) => {
|
|
5015
5830
|
try {
|
|
5016
|
-
return
|
|
5017
|
-
} catch (
|
|
5831
|
+
return _chunkDZNXG5JKcjs.getPublicClient.call(void 0, chainId);
|
|
5832
|
+
} catch (e31) {
|
|
5018
5833
|
return null;
|
|
5019
5834
|
}
|
|
5020
5835
|
},
|
|
@@ -5056,7 +5871,7 @@ function DepositFlow({
|
|
|
5056
5871
|
if (!dappImportOwner) {
|
|
5057
5872
|
return { ...baseRow, status: "needs-connect" };
|
|
5058
5873
|
}
|
|
5059
|
-
const availabilityEntry = _optionalChain([dappImportAvailabilityOwner, 'optionalAccess',
|
|
5874
|
+
const availabilityEntry = _optionalChain([dappImportAvailabilityOwner, 'optionalAccess', _190 => _190.toLowerCase, 'call', _191 => _191()]) === dappImportOwner.toLowerCase() ? dappImportAvailability[provider.id] : void 0;
|
|
5060
5875
|
const dappImportSetup = readSetupForOwner(setupSlice, dappImportOwner);
|
|
5061
5876
|
if (availabilityEntry === "loading" || availabilityEntry === void 0) {
|
|
5062
5877
|
return { ...baseRow, status: "loading" };
|
|
@@ -5104,7 +5919,7 @@ function DepositFlow({
|
|
|
5104
5919
|
}, [activeDappImportProviderId, enabledDappImportProviders]);
|
|
5105
5920
|
const activeDappImportAvailability = _react.useMemo.call(void 0, () => {
|
|
5106
5921
|
if (!activeDappImportProviderId) return null;
|
|
5107
|
-
if (!dappImportOwner || _optionalChain([dappImportAvailabilityOwner, 'optionalAccess',
|
|
5922
|
+
if (!dappImportOwner || _optionalChain([dappImportAvailabilityOwner, 'optionalAccess', _192 => _192.toLowerCase, 'call', _193 => _193()]) !== dappImportOwner.toLowerCase()) {
|
|
5108
5923
|
return null;
|
|
5109
5924
|
}
|
|
5110
5925
|
const entry = dappImportAvailability[activeDappImportProviderId];
|
|
@@ -5116,8 +5931,29 @@ function DepositFlow({
|
|
|
5116
5931
|
dappImportAvailabilityOwner,
|
|
5117
5932
|
dappImportOwner
|
|
5118
5933
|
]);
|
|
5934
|
+
const handleSelectFiatMethod = _react.useCallback.call(void 0,
|
|
5935
|
+
(paymentMethod) => {
|
|
5936
|
+
storeApi.dispatch({
|
|
5937
|
+
type: "connect/fiat-onramp-selected",
|
|
5938
|
+
paymentMethod
|
|
5939
|
+
});
|
|
5940
|
+
},
|
|
5941
|
+
[storeApi]
|
|
5942
|
+
);
|
|
5943
|
+
const handleSelectExchange = _react.useCallback.call(void 0, () => {
|
|
5944
|
+
storeApi.dispatch({ type: "connect/exchange-selected" });
|
|
5945
|
+
}, [storeApi]);
|
|
5946
|
+
const handleSelectExchangeConnection = _react.useCallback.call(void 0,
|
|
5947
|
+
(connection) => {
|
|
5948
|
+
storeApi.dispatch({
|
|
5949
|
+
type: "exchange/connection-selected",
|
|
5950
|
+
connection
|
|
5951
|
+
});
|
|
5952
|
+
},
|
|
5953
|
+
[storeApi]
|
|
5954
|
+
);
|
|
5119
5955
|
const handleNewDeposit = _react.useCallback.call(void 0, () => {
|
|
5120
|
-
_optionalChain([onLifecycleRef, 'access',
|
|
5956
|
+
_optionalChain([onLifecycleRef, 'access', _194 => _194.current, 'optionalCall', _195 => _195({
|
|
5121
5957
|
type: "smart-account-changed",
|
|
5122
5958
|
evm: null,
|
|
5123
5959
|
solana: null
|
|
@@ -5165,13 +6001,13 @@ function DepositFlow({
|
|
|
5165
6001
|
};
|
|
5166
6002
|
push(dappAddress);
|
|
5167
6003
|
push(connectedWalletAddress);
|
|
5168
|
-
push(_optionalChain([reownWallet, 'optionalAccess',
|
|
6004
|
+
push(_optionalChain([reownWallet, 'optionalAccess', _196 => _196.address]));
|
|
5169
6005
|
push(dappImportOwner);
|
|
5170
6006
|
return owners;
|
|
5171
6007
|
}, [
|
|
5172
6008
|
dappAddress,
|
|
5173
6009
|
connectedWalletAddress,
|
|
5174
|
-
_optionalChain([reownWallet, 'optionalAccess',
|
|
6010
|
+
_optionalChain([reownWallet, 'optionalAccess', _197 => _197.address]),
|
|
5175
6011
|
dappImportOwner
|
|
5176
6012
|
]);
|
|
5177
6013
|
_react.useEffect.call(void 0, () => {
|
|
@@ -5185,7 +6021,7 @@ function DepositFlow({
|
|
|
5185
6021
|
try {
|
|
5186
6022
|
sessionOwner = await resolveSessionOwner(owner);
|
|
5187
6023
|
} catch (error) {
|
|
5188
|
-
|
|
6024
|
+
_chunkDZNXG5JKcjs.debugError.call(void 0,
|
|
5189
6025
|
debug,
|
|
5190
6026
|
"deposit-flow",
|
|
5191
6027
|
"session-owner:resolve-failed",
|
|
@@ -5276,7 +6112,7 @@ function DepositFlow({
|
|
|
5276
6112
|
sourceChain: data.sourceChain,
|
|
5277
6113
|
amount: data.amount
|
|
5278
6114
|
});
|
|
5279
|
-
_optionalChain([onLifecycleRef, 'access',
|
|
6115
|
+
_optionalChain([onLifecycleRef, 'access', _198 => _198.current, 'optionalCall', _199 => _199({ type: "submitted", ...data })]);
|
|
5280
6116
|
},
|
|
5281
6117
|
[logFlow, onLifecycleRef]
|
|
5282
6118
|
);
|
|
@@ -5333,7 +6169,7 @@ function DepositFlow({
|
|
|
5333
6169
|
sourceSymbol: tokenAtSubmit.symbol,
|
|
5334
6170
|
sourceDecimals: tokenAtSubmit.decimals
|
|
5335
6171
|
});
|
|
5336
|
-
_optionalChain([onLifecycleRef, 'access',
|
|
6172
|
+
_optionalChain([onLifecycleRef, 'access', _200 => _200.current, 'optionalCall', _201 => _201({
|
|
5337
6173
|
type: "submitted",
|
|
5338
6174
|
txHash,
|
|
5339
6175
|
sourceChain: "solana",
|
|
@@ -5344,7 +6180,7 @@ function DepositFlow({
|
|
|
5344
6180
|
);
|
|
5345
6181
|
const handleAssetContinue = _react.useCallback.call(void 0,
|
|
5346
6182
|
(asset) => {
|
|
5347
|
-
_optionalChain([onEventRef, 'access',
|
|
6183
|
+
_optionalChain([onEventRef, 'access', _202 => _202.current, 'optionalCall', _203 => _203({
|
|
5348
6184
|
type: "deposit_modal_connected_wallet_select_source_cta_click",
|
|
5349
6185
|
total_balance_in_external_wallet: totalBalanceUsd,
|
|
5350
6186
|
pred_balance: totalBalanceUsd,
|
|
@@ -5397,16 +6233,41 @@ function DepositFlow({
|
|
|
5397
6233
|
sourceChain: chainId,
|
|
5398
6234
|
sourceToken: token,
|
|
5399
6235
|
amount,
|
|
5400
|
-
sourceSymbol: _optionalChain([dappImport, 'optionalAccess',
|
|
5401
|
-
sourceDecimals: _optionalChain([dappImport, 'optionalAccess',
|
|
6236
|
+
sourceSymbol: _optionalChain([dappImport, 'optionalAccess', _204 => _204.symbol]),
|
|
6237
|
+
sourceDecimals: _optionalChain([dappImport, 'optionalAccess', _205 => _205.decimals]),
|
|
5402
6238
|
directTransfer: !dappImport && isSameRoute2(chainId, token, targetChain, targetToken)
|
|
5403
6239
|
});
|
|
5404
6240
|
},
|
|
5405
6241
|
[logFlow, storeApi, targetChain, targetToken]
|
|
5406
6242
|
);
|
|
6243
|
+
const handleSwappedComplete = _react.useCallback.call(void 0,
|
|
6244
|
+
(info) => {
|
|
6245
|
+
logFlow("swapped:complete", {
|
|
6246
|
+
txHash: info.txHash,
|
|
6247
|
+
orderCrypto: info.orderCrypto
|
|
6248
|
+
});
|
|
6249
|
+
const amount = _nullishCoalesce(info.amount, () => ( "0"));
|
|
6250
|
+
storeApi.dispatch({
|
|
6251
|
+
type: "deposit/submitted",
|
|
6252
|
+
txHash: info.txHash,
|
|
6253
|
+
sourceChain: SWAPPED_SOURCE_CHAIN,
|
|
6254
|
+
sourceToken: SWAPPED_SOURCE_TOKEN,
|
|
6255
|
+
amount,
|
|
6256
|
+
sourceSymbol: _nullishCoalesce(info.orderCrypto, () => ( "USDC")),
|
|
6257
|
+
sourceDecimals: 6
|
|
6258
|
+
});
|
|
6259
|
+
_optionalChain([onLifecycleRef, 'access', _206 => _206.current, 'optionalCall', _207 => _207({
|
|
6260
|
+
type: "submitted",
|
|
6261
|
+
txHash: info.txHash,
|
|
6262
|
+
sourceChain: SWAPPED_SOURCE_CHAIN,
|
|
6263
|
+
amount
|
|
6264
|
+
})]);
|
|
6265
|
+
},
|
|
6266
|
+
[logFlow, storeApi, onLifecycleRef]
|
|
6267
|
+
);
|
|
5407
6268
|
const handleDepositSubmittedCallback = _react.useCallback.call(void 0,
|
|
5408
6269
|
(txHash, sourceChain, amount) => {
|
|
5409
|
-
_optionalChain([onLifecycleRef, 'access',
|
|
6270
|
+
_optionalChain([onLifecycleRef, 'access', _208 => _208.current, 'optionalCall', _209 => _209({
|
|
5410
6271
|
type: "submitted",
|
|
5411
6272
|
txHash,
|
|
5412
6273
|
sourceChain,
|
|
@@ -5418,7 +6279,7 @@ function DepositFlow({
|
|
|
5418
6279
|
const handleDepositComplete = _react.useCallback.call(void 0,
|
|
5419
6280
|
(txHash, destinationTxHash, context) => {
|
|
5420
6281
|
logFlow("deposit:complete", { txHash, destinationTxHash, ...context });
|
|
5421
|
-
_optionalChain([onLifecycleRef, 'access',
|
|
6282
|
+
_optionalChain([onLifecycleRef, 'access', _210 => _210.current, 'optionalCall', _211 => _211({
|
|
5422
6283
|
type: "complete",
|
|
5423
6284
|
txHash,
|
|
5424
6285
|
destinationTxHash,
|
|
@@ -5430,14 +6291,14 @@ function DepositFlow({
|
|
|
5430
6291
|
const handleDepositFailed = _react.useCallback.call(void 0,
|
|
5431
6292
|
(txHash, error) => {
|
|
5432
6293
|
logFlowError("deposit:failed", error, { txHash });
|
|
5433
|
-
_optionalChain([onLifecycleRef, 'access',
|
|
6294
|
+
_optionalChain([onLifecycleRef, 'access', _212 => _212.current, 'optionalCall', _213 => _213({ type: "failed", txHash, error })]);
|
|
5434
6295
|
},
|
|
5435
6296
|
[logFlowError, onLifecycleRef]
|
|
5436
6297
|
);
|
|
5437
6298
|
const handleError = _react.useCallback.call(void 0,
|
|
5438
6299
|
(message, code) => {
|
|
5439
6300
|
logFlowError("flow:error", message, { code });
|
|
5440
|
-
_optionalChain([onErrorRef, 'access',
|
|
6301
|
+
_optionalChain([onErrorRef, 'access', _214 => _214.current, 'optionalCall', _215 => _215({ message, code })]);
|
|
5441
6302
|
},
|
|
5442
6303
|
[logFlowError, onErrorRef]
|
|
5443
6304
|
);
|
|
@@ -5473,13 +6334,14 @@ function DepositFlow({
|
|
|
5473
6334
|
}
|
|
5474
6335
|
}, [enableSolana, flowMode, storeApi]);
|
|
5475
6336
|
_react.useEffect.call(void 0, () => {
|
|
5476
|
-
if (hasNavigatedBack || isConnectSelectionConfirmed || flowMode) {
|
|
6337
|
+
if (hasNavigatedBack || isConnectSelectionConfirmed || flowMode || enableFiatOnramp || enableExchangeConnect) {
|
|
5477
6338
|
return;
|
|
5478
6339
|
}
|
|
5479
|
-
if (!hasWalletOptions && dappAddress && !hasReownSession && !dappWalletClient && hasQrAutoAdvanceGraceElapsed) {
|
|
6340
|
+
if (enableQrTransfer && !hasWalletOptions && dappAddress && !hasReownSession && !dappWalletClient && hasQrAutoAdvanceGraceElapsed) {
|
|
5480
6341
|
handleSelectTransferCrypto();
|
|
5481
6342
|
}
|
|
5482
6343
|
}, [
|
|
6344
|
+
enableQrTransfer,
|
|
5483
6345
|
hasWalletOptions,
|
|
5484
6346
|
hasReownSession,
|
|
5485
6347
|
hasQrAutoAdvanceGraceElapsed,
|
|
@@ -5519,12 +6381,12 @@ function DepositFlow({
|
|
|
5519
6381
|
);
|
|
5520
6382
|
if (showConnectStep) {
|
|
5521
6383
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-modal-body", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
5522
|
-
|
|
6384
|
+
_chunkDZNXG5JKcjs.ConnectStep,
|
|
5523
6385
|
{
|
|
5524
6386
|
walletRows,
|
|
5525
6387
|
transferCryptoState: dappAddress ? transferCryptoState : void 0,
|
|
5526
6388
|
transferCryptoErrorReason: dappAddress ? _nullishCoalesce(transferCryptoEntry.message, () => ( void 0)) : void 0,
|
|
5527
|
-
onSelectTransferCrypto: dappAddress ? () => {
|
|
6389
|
+
onSelectTransferCrypto: enableQrTransfer && dappAddress ? () => {
|
|
5528
6390
|
if (transferCryptoState === "error") {
|
|
5529
6391
|
handleRetrySetup(dappAddress);
|
|
5530
6392
|
return;
|
|
@@ -5532,6 +6394,10 @@ function DepositFlow({
|
|
|
5532
6394
|
if (transferCryptoState !== "ready") return;
|
|
5533
6395
|
handleSelectTransferCrypto();
|
|
5534
6396
|
} : void 0,
|
|
6397
|
+
onSelectPayWithCard: enableFiatOnramp && dappAddress && (!fiatOnrampMethods || fiatOnrampMethods.length === 0) ? () => handleSelectFiatMethod() : void 0,
|
|
6398
|
+
fiatPaymentMethods: enableFiatOnramp && dappAddress ? fiatOnrampMethods : void 0,
|
|
6399
|
+
onSelectFiatMethod: enableFiatOnramp && dappAddress ? (method) => handleSelectFiatMethod(method) : void 0,
|
|
6400
|
+
onSelectFundFromExchange: enableExchangeConnect && dappAddress ? () => handleSelectExchange() : void 0,
|
|
5535
6401
|
onRequestConnect,
|
|
5536
6402
|
onConnect,
|
|
5537
6403
|
onDisconnect,
|
|
@@ -5589,7 +6455,7 @@ function DepositFlow({
|
|
|
5589
6455
|
allowedRoutes,
|
|
5590
6456
|
targetChain,
|
|
5591
6457
|
targetToken,
|
|
5592
|
-
hasPostBridgeActions: Boolean(_optionalChain([postBridgeActions, 'optionalAccess',
|
|
6458
|
+
hasPostBridgeActions: Boolean(_optionalChain([postBridgeActions, 'optionalAccess', _216 => _216.length])),
|
|
5593
6459
|
uiConfig,
|
|
5594
6460
|
onDepositSubmitted: handleDepositAddressSubmitted,
|
|
5595
6461
|
onDepositComplete: handleDepositComplete,
|
|
@@ -5597,7 +6463,7 @@ function DepositFlow({
|
|
|
5597
6463
|
onCopyAddress: () => {
|
|
5598
6464
|
const chainName = _chunk7JIDIX27cjs.getChainName.call(void 0, targetChain);
|
|
5599
6465
|
const tokenSymbol = _chunk7JIDIX27cjs.getTargetTokenSymbol.call(void 0, targetToken, targetChain);
|
|
5600
|
-
_optionalChain([onEvent, 'optionalCall',
|
|
6466
|
+
_optionalChain([onEvent, 'optionalCall', _217 => _217({
|
|
5601
6467
|
type: "deposit_modal_transfer_crypto_cta_click",
|
|
5602
6468
|
default_chain: chainName,
|
|
5603
6469
|
default_token: tokenSymbol,
|
|
@@ -5611,10 +6477,132 @@ function DepositFlow({
|
|
|
5611
6477
|
)
|
|
5612
6478
|
] });
|
|
5613
6479
|
}
|
|
6480
|
+
if (isFiatOnrampMode) {
|
|
6481
|
+
if (!dappAddress) return null;
|
|
6482
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
6483
|
+
"div",
|
|
6484
|
+
{
|
|
6485
|
+
className: "rs-modal-body",
|
|
6486
|
+
"data-flow-mode": "fiat-onramp",
|
|
6487
|
+
"data-step-type": step.type,
|
|
6488
|
+
children: [
|
|
6489
|
+
step.type === "setup" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
6490
|
+
AccountPreparingSkeleton,
|
|
6491
|
+
{
|
|
6492
|
+
errorMessage: activeEntry.status === "error" ? _nullishCoalesce(activeEntry.message, () => ( void 0)) : void 0,
|
|
6493
|
+
onRetry: activeEntry.status === "error" ? () => handleRetrySetup(dappAddress) : void 0
|
|
6494
|
+
}
|
|
6495
|
+
),
|
|
6496
|
+
step.type === "fiat-onramp" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
6497
|
+
FiatOnrampStep,
|
|
6498
|
+
{
|
|
6499
|
+
smartAccount: step.smartAccount,
|
|
6500
|
+
service,
|
|
6501
|
+
paymentMethod: step.paymentMethod,
|
|
6502
|
+
onSwappedComplete: handleSwappedComplete,
|
|
6503
|
+
onSwappedFailed: handleDepositFailed,
|
|
6504
|
+
onClose: _nullishCoalesce(onClose, () => ( (() => {
|
|
6505
|
+
}))),
|
|
6506
|
+
onError: handleError
|
|
6507
|
+
}
|
|
6508
|
+
),
|
|
6509
|
+
step.type === "processing" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
6510
|
+
_chunkDZNXG5JKcjs.ProcessingStep,
|
|
6511
|
+
{
|
|
6512
|
+
smartAccount: step.smartAccount,
|
|
6513
|
+
solanaDepositAddress: step.solanaDepositAddress,
|
|
6514
|
+
txHash: step.txHash,
|
|
6515
|
+
sourceChain: step.sourceChain,
|
|
6516
|
+
sourceToken: step.sourceToken,
|
|
6517
|
+
targetChain,
|
|
6518
|
+
targetToken,
|
|
6519
|
+
amount: step.amount,
|
|
6520
|
+
sourceSymbol: step.sourceSymbol,
|
|
6521
|
+
sourceDecimals: step.sourceDecimals,
|
|
6522
|
+
hasPostBridgeActions: Boolean(_optionalChain([postBridgeActions, 'optionalAccess', _218 => _218.length])),
|
|
6523
|
+
service,
|
|
6524
|
+
directTransfer: step.directTransfer,
|
|
6525
|
+
onClose,
|
|
6526
|
+
onNewDeposit: handleNewDeposit,
|
|
6527
|
+
onDepositComplete: handleDepositComplete,
|
|
6528
|
+
onDepositFailed: handleDepositFailed,
|
|
6529
|
+
onError: handleError,
|
|
6530
|
+
debug
|
|
6531
|
+
}
|
|
6532
|
+
)
|
|
6533
|
+
]
|
|
6534
|
+
}
|
|
6535
|
+
);
|
|
6536
|
+
}
|
|
6537
|
+
if (isExchangeConnectMode) {
|
|
6538
|
+
if (!dappAddress) return null;
|
|
6539
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
6540
|
+
"div",
|
|
6541
|
+
{
|
|
6542
|
+
className: "rs-modal-body",
|
|
6543
|
+
"data-flow-mode": "exchange-connect",
|
|
6544
|
+
"data-step-type": step.type,
|
|
6545
|
+
children: [
|
|
6546
|
+
step.type === "setup" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
6547
|
+
AccountPreparingSkeleton,
|
|
6548
|
+
{
|
|
6549
|
+
errorMessage: activeEntry.status === "error" ? _nullishCoalesce(activeEntry.message, () => ( void 0)) : void 0,
|
|
6550
|
+
onRetry: activeEntry.status === "error" ? () => handleRetrySetup(dappAddress) : void 0
|
|
6551
|
+
}
|
|
6552
|
+
),
|
|
6553
|
+
step.type === "exchange-select" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
6554
|
+
ExchangeSelectStep,
|
|
6555
|
+
{
|
|
6556
|
+
service,
|
|
6557
|
+
onSelectExchange: handleSelectExchangeConnection,
|
|
6558
|
+
onError: handleError
|
|
6559
|
+
}
|
|
6560
|
+
),
|
|
6561
|
+
step.type === "exchange-connect" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
6562
|
+
ExchangeConnectStep,
|
|
6563
|
+
{
|
|
6564
|
+
smartAccount: step.smartAccount,
|
|
6565
|
+
service,
|
|
6566
|
+
connection: step.connection,
|
|
6567
|
+
onSwappedComplete: handleSwappedComplete,
|
|
6568
|
+
onSwappedFailed: handleDepositFailed,
|
|
6569
|
+
onClose: _nullishCoalesce(onClose, () => ( (() => {
|
|
6570
|
+
}))),
|
|
6571
|
+
onError: handleError
|
|
6572
|
+
}
|
|
6573
|
+
),
|
|
6574
|
+
step.type === "processing" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
6575
|
+
_chunkDZNXG5JKcjs.ProcessingStep,
|
|
6576
|
+
{
|
|
6577
|
+
smartAccount: step.smartAccount,
|
|
6578
|
+
solanaDepositAddress: step.solanaDepositAddress,
|
|
6579
|
+
txHash: step.txHash,
|
|
6580
|
+
sourceChain: step.sourceChain,
|
|
6581
|
+
sourceToken: step.sourceToken,
|
|
6582
|
+
targetChain,
|
|
6583
|
+
targetToken,
|
|
6584
|
+
amount: step.amount,
|
|
6585
|
+
sourceSymbol: step.sourceSymbol,
|
|
6586
|
+
sourceDecimals: step.sourceDecimals,
|
|
6587
|
+
hasPostBridgeActions: Boolean(_optionalChain([postBridgeActions, 'optionalAccess', _219 => _219.length])),
|
|
6588
|
+
service,
|
|
6589
|
+
directTransfer: step.directTransfer,
|
|
6590
|
+
onClose,
|
|
6591
|
+
onNewDeposit: handleNewDeposit,
|
|
6592
|
+
onDepositComplete: handleDepositComplete,
|
|
6593
|
+
onDepositFailed: handleDepositFailed,
|
|
6594
|
+
onError: handleError,
|
|
6595
|
+
debug
|
|
6596
|
+
}
|
|
6597
|
+
)
|
|
6598
|
+
]
|
|
6599
|
+
}
|
|
6600
|
+
);
|
|
6601
|
+
}
|
|
5614
6602
|
if (isSolanaWalletMode) {
|
|
5615
6603
|
if (!dappAddress) return null;
|
|
5616
|
-
const solanaAddr = _optionalChain([reownWallet, 'optionalAccess',
|
|
5617
|
-
const solanaProvider = _optionalChain([reownWallet, 'optionalAccess',
|
|
6604
|
+
const solanaAddr = _optionalChain([reownWallet, 'optionalAccess', _220 => _220.solanaAddress]);
|
|
6605
|
+
const solanaProvider = _optionalChain([reownWallet, 'optionalAccess', _221 => _221.solanaProvider]);
|
|
5618
6606
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-modal-body", children: [
|
|
5619
6607
|
effectiveStep.type === "setup" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
5620
6608
|
AccountPreparingSkeleton,
|
|
@@ -5670,7 +6658,7 @@ function DepositFlow({
|
|
|
5670
6658
|
targetToken,
|
|
5671
6659
|
service,
|
|
5672
6660
|
solanaProvider,
|
|
5673
|
-
solanaConnection: _optionalChain([reownWallet, 'optionalAccess',
|
|
6661
|
+
solanaConnection: _optionalChain([reownWallet, 'optionalAccess', _222 => _222.solanaConnection]),
|
|
5674
6662
|
uiConfig,
|
|
5675
6663
|
onConfirm: handleSolanaConfirmed,
|
|
5676
6664
|
onError: handleError,
|
|
@@ -5711,7 +6699,7 @@ function DepositFlow({
|
|
|
5711
6699
|
) })
|
|
5712
6700
|
] }) : null,
|
|
5713
6701
|
effectiveStep.type === "processing" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
5714
|
-
|
|
6702
|
+
_chunkDZNXG5JKcjs.ProcessingStep,
|
|
5715
6703
|
{
|
|
5716
6704
|
smartAccount: effectiveStep.smartAccount,
|
|
5717
6705
|
solanaDepositAddress: effectiveStep.solanaDepositAddress,
|
|
@@ -5723,7 +6711,7 @@ function DepositFlow({
|
|
|
5723
6711
|
amount: effectiveStep.amount,
|
|
5724
6712
|
sourceSymbol: effectiveStep.sourceSymbol,
|
|
5725
6713
|
sourceDecimals: effectiveStep.sourceDecimals,
|
|
5726
|
-
hasPostBridgeActions: Boolean(_optionalChain([postBridgeActions, 'optionalAccess',
|
|
6714
|
+
hasPostBridgeActions: Boolean(_optionalChain([postBridgeActions, 'optionalAccess', _223 => _223.length])),
|
|
5727
6715
|
service,
|
|
5728
6716
|
directTransfer: effectiveStep.directTransfer,
|
|
5729
6717
|
onClose,
|
|
@@ -5736,16 +6724,16 @@ function DepositFlow({
|
|
|
5736
6724
|
)
|
|
5737
6725
|
] });
|
|
5738
6726
|
}
|
|
5739
|
-
if (!_optionalChain([signerContext, 'optionalAccess',
|
|
6727
|
+
if (!_optionalChain([signerContext, 'optionalAccess', _224 => _224.walletClient]) || !_optionalChain([signerContext, 'optionalAccess', _225 => _225.publicClient])) {
|
|
5740
6728
|
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\u2026" }) }) }) }) });
|
|
5741
6729
|
}
|
|
5742
6730
|
const ownerAddress = signerContext.ownerAddress;
|
|
5743
|
-
const ownerChainId = _nullishCoalesce(_nullishCoalesce(_optionalChain([signerContext, 'access',
|
|
6731
|
+
const ownerChainId = _nullishCoalesce(_nullishCoalesce(_optionalChain([signerContext, 'access', _226 => _226.walletClient, 'optionalAccess', _227 => _227.chain, 'optionalAccess', _228 => _228.id]), () => ( _optionalChain([signerContext, 'access', _229 => _229.publicClient, 'access', _230 => _230.chain, 'optionalAccess', _231 => _231.id]))), () => ( setupChainId));
|
|
5744
6732
|
const getReadClientForChain = (chainId) => {
|
|
5745
|
-
if (_optionalChain([signerContext, 'access',
|
|
6733
|
+
if (_optionalChain([signerContext, 'access', _232 => _232.publicClient, 'access', _233 => _233.chain, 'optionalAccess', _234 => _234.id]) === chainId) {
|
|
5746
6734
|
return signerContext.publicClient;
|
|
5747
6735
|
}
|
|
5748
|
-
return
|
|
6736
|
+
return _chunkDZNXG5JKcjs.getPublicClient.call(void 0, chainId);
|
|
5749
6737
|
};
|
|
5750
6738
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-modal-body", children: [
|
|
5751
6739
|
effectiveStep.type === "setup" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
@@ -5776,7 +6764,7 @@ function DepositFlow({
|
|
|
5776
6764
|
effectiveStep.type === "dapp-import-asset-select" && activeDappImportProvider && activeDappImportAvailability && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
5777
6765
|
DappImportAssetSelectStep,
|
|
5778
6766
|
{
|
|
5779
|
-
sourceLabel: _nullishCoalesce(_optionalChain([activeDappImportAvailability, 'access',
|
|
6767
|
+
sourceLabel: _nullishCoalesce(_optionalChain([activeDappImportAvailability, 'access', _235 => _235.assets, 'access', _236 => _236[0], 'optionalAccess', _237 => _237.sourceLabel]), () => ( activeDappImportProvider.label)),
|
|
5780
6768
|
assets: activeDappImportAvailability.assets,
|
|
5781
6769
|
onSelect: handleDappImportAssetSelected
|
|
5782
6770
|
}
|
|
@@ -5803,7 +6791,7 @@ function DepositFlow({
|
|
|
5803
6791
|
onContinue: handleAmountContinue,
|
|
5804
6792
|
onCtaClick: (ctaName) => {
|
|
5805
6793
|
const receiveSymbol = _chunk7JIDIX27cjs.getTargetTokenSymbol.call(void 0, targetToken, targetChain);
|
|
5806
|
-
_optionalChain([onEvent, 'optionalCall',
|
|
6794
|
+
_optionalChain([onEvent, 'optionalCall', _238 => _238({
|
|
5807
6795
|
type: "deposit_modal_connected_wallet_enter_value_cta_click",
|
|
5808
6796
|
send_token: effectiveStep.asset.symbol,
|
|
5809
6797
|
receive_token: receiveSymbol,
|
|
@@ -5854,7 +6842,7 @@ function DepositFlow({
|
|
|
5854
6842
|
}
|
|
5855
6843
|
),
|
|
5856
6844
|
effectiveStep.type === "processing" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
5857
|
-
|
|
6845
|
+
_chunkDZNXG5JKcjs.ProcessingStep,
|
|
5858
6846
|
{
|
|
5859
6847
|
smartAccount: effectiveStep.smartAccount,
|
|
5860
6848
|
solanaDepositAddress: effectiveStep.solanaDepositAddress,
|
|
@@ -5866,7 +6854,7 @@ function DepositFlow({
|
|
|
5866
6854
|
amount: effectiveStep.amount,
|
|
5867
6855
|
sourceSymbol: effectiveStep.sourceSymbol,
|
|
5868
6856
|
sourceDecimals: effectiveStep.sourceDecimals,
|
|
5869
|
-
hasPostBridgeActions: Boolean(_optionalChain([postBridgeActions, 'optionalAccess',
|
|
6857
|
+
hasPostBridgeActions: Boolean(_optionalChain([postBridgeActions, 'optionalAccess', _239 => _239.length])),
|
|
5870
6858
|
service,
|
|
5871
6859
|
directTransfer: effectiveStep.directTransfer,
|
|
5872
6860
|
uiConfig,
|
|
@@ -5898,15 +6886,15 @@ function formatDate(iso) {
|
|
|
5898
6886
|
month: "short",
|
|
5899
6887
|
year: "numeric"
|
|
5900
6888
|
});
|
|
5901
|
-
} catch (
|
|
6889
|
+
} catch (e32) {
|
|
5902
6890
|
return iso;
|
|
5903
6891
|
}
|
|
5904
6892
|
}
|
|
5905
6893
|
function resolveChainId(value) {
|
|
5906
6894
|
if (value === void 0 || value === null) return null;
|
|
5907
6895
|
if (typeof value === "number") return value;
|
|
5908
|
-
if (
|
|
5909
|
-
const parsed =
|
|
6896
|
+
if (_chunkDZNXG5JKcjs.isSolanaCaip2.call(void 0, value) || value === "solana") return "solana";
|
|
6897
|
+
const parsed = _chunkDZNXG5JKcjs.parseEvmChainId.call(void 0, value);
|
|
5910
6898
|
if (parsed !== null) return parsed;
|
|
5911
6899
|
const num = Number(value);
|
|
5912
6900
|
return Number.isFinite(num) ? num : null;
|
|
@@ -5956,7 +6944,7 @@ function formatAmount(rawAmount, token, chainId) {
|
|
|
5956
6944
|
let frac = fracStr.slice(0, 5).replace(/0+$/, "");
|
|
5957
6945
|
if (frac.length < 2) frac = frac.padEnd(2, "0");
|
|
5958
6946
|
return `${whole}.${frac}`;
|
|
5959
|
-
} catch (
|
|
6947
|
+
} catch (e33) {
|
|
5960
6948
|
return rawAmount;
|
|
5961
6949
|
}
|
|
5962
6950
|
}
|
|
@@ -6005,7 +6993,7 @@ function DepositHistoryPanel({
|
|
|
6005
6993
|
);
|
|
6006
6994
|
const visibleDeposits = _react.useMemo.call(void 0, () => {
|
|
6007
6995
|
const sourceHashes = new Set(
|
|
6008
|
-
deposits.map((d) => _optionalChain([d, 'access',
|
|
6996
|
+
deposits.map((d) => _optionalChain([d, 'access', _240 => _240.sourceTxHash, 'optionalAccess', _241 => _241.toLowerCase, 'call', _242 => _242()])).filter((h) => Boolean(h))
|
|
6009
6997
|
);
|
|
6010
6998
|
return deposits.filter(
|
|
6011
6999
|
(d) => !(d.txHash && sourceHashes.has(d.txHash.toLowerCase()))
|
|
@@ -6027,7 +7015,7 @@ function DepositHistoryPanel({
|
|
|
6027
7015
|
className: "rs-modal-header-back",
|
|
6028
7016
|
"aria-label": "Back",
|
|
6029
7017
|
onClick: onClose,
|
|
6030
|
-
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
7018
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkDZNXG5JKcjs.ChevronLeftIcon, {})
|
|
6031
7019
|
}
|
|
6032
7020
|
) }),
|
|
6033
7021
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-modal-header-nav-right", children: onCloseModal && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
@@ -6037,29 +7025,29 @@ function DepositHistoryPanel({
|
|
|
6037
7025
|
className: "rs-modal-close",
|
|
6038
7026
|
"aria-label": "Close",
|
|
6039
7027
|
onClick: onCloseModal,
|
|
6040
|
-
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
7028
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkDZNXG5JKcjs.CloseIcon, {})
|
|
6041
7029
|
}
|
|
6042
7030
|
) })
|
|
6043
7031
|
] }),
|
|
6044
7032
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-history-screen", children: [
|
|
6045
7033
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-history-screen-body", children: [
|
|
6046
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
7034
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkDZNXG5JKcjs.BodyHeader, { icon: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkDZNXG5JKcjs.HistoryIcon, {}), title: "History" }),
|
|
6047
7035
|
isLoading && deposits.length === 0 && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-history-empty", children: [
|
|
6048
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-history-empty-glyph", "aria-hidden": "true", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
7036
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-history-empty-glyph", "aria-hidden": "true", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkDZNXG5JKcjs.HistoryIcon, {}) }),
|
|
6049
7037
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-history-empty-text", children: [
|
|
6050
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
7038
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkDZNXG5JKcjs.Spinner, { className: "rs-spinner--sm" }),
|
|
6051
7039
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-history-empty-hint", children: "Loading history\u2026" })
|
|
6052
7040
|
] })
|
|
6053
7041
|
] }),
|
|
6054
7042
|
error && !isLoading && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-history-empty", children: [
|
|
6055
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-history-empty-glyph", "aria-hidden": "true", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
7043
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-history-empty-glyph", "aria-hidden": "true", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkDZNXG5JKcjs.AlertTriangleIcon, {}) }),
|
|
6056
7044
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-history-empty-text", children: [
|
|
6057
7045
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-history-empty-title", children: "Couldn't load history" }),
|
|
6058
7046
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-history-empty-hint", children: error })
|
|
6059
7047
|
] })
|
|
6060
7048
|
] }),
|
|
6061
7049
|
!isLoading && !error && visibleDeposits.length === 0 && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-history-empty", children: [
|
|
6062
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-history-empty-glyph", "aria-hidden": "true", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
7050
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-history-empty-glyph", "aria-hidden": "true", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkDZNXG5JKcjs.HistoryIcon, {}) }),
|
|
6063
7051
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-history-empty-text", children: [
|
|
6064
7052
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-history-empty-title", children: "No deposits yet" }),
|
|
6065
7053
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-history-empty-hint", children: "Your deposit history will appear here" })
|
|
@@ -6079,7 +7067,7 @@ function DepositHistoryPanel({
|
|
|
6079
7067
|
)
|
|
6080
7068
|
] })
|
|
6081
7069
|
] }),
|
|
6082
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
7070
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkDZNXG5JKcjs.PoweredBy, {})
|
|
6083
7071
|
] })
|
|
6084
7072
|
]
|
|
6085
7073
|
}
|
|
@@ -6154,7 +7142,7 @@ function HistoryCard({ deposit }) {
|
|
|
6154
7142
|
onClick: (e) => e.stopPropagation(),
|
|
6155
7143
|
children: [
|
|
6156
7144
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: shortenHash(deposit.sourceTxHash) }),
|
|
6157
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
7145
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkDZNXG5JKcjs.ArrowUpRightIcon, {})
|
|
6158
7146
|
]
|
|
6159
7147
|
}
|
|
6160
7148
|
)
|
|
@@ -6169,7 +7157,7 @@ DepositHistoryPanel.displayName = "DepositHistoryPanel";
|
|
|
6169
7157
|
// src/DepositModal.tsx
|
|
6170
7158
|
|
|
6171
7159
|
var ReownDepositInner = _react.lazy.call(void 0,
|
|
6172
|
-
() => Promise.resolve().then(() => _interopRequireWildcard(require("./DepositModalReown-
|
|
7160
|
+
() => Promise.resolve().then(() => _interopRequireWildcard(require("./DepositModalReown-CXPRZRXL.cjs"))).then((m) => ({ default: m.DepositModalReown }))
|
|
6173
7161
|
);
|
|
6174
7162
|
function sortByCreatedAtDesc(items) {
|
|
6175
7163
|
return [...items].sort((a, b) => {
|
|
@@ -6225,6 +7213,10 @@ function DepositModalInner({
|
|
|
6225
7213
|
forceRegister = false,
|
|
6226
7214
|
enableSolana = true,
|
|
6227
7215
|
dappImports,
|
|
7216
|
+
enableFiatOnramp = false,
|
|
7217
|
+
enableQrTransfer = true,
|
|
7218
|
+
fiatOnrampMethods,
|
|
7219
|
+
enableExchangeConnect = false,
|
|
6228
7220
|
postBridgeActions,
|
|
6229
7221
|
outputTokenRules,
|
|
6230
7222
|
rejectUnmapped,
|
|
@@ -6243,12 +7235,12 @@ function DepositModalInner({
|
|
|
6243
7235
|
debug
|
|
6244
7236
|
}) {
|
|
6245
7237
|
const modalRef = _react.useRef.call(void 0, null);
|
|
6246
|
-
const onReadyRef =
|
|
7238
|
+
const onReadyRef = _chunkDZNXG5JKcjs.useLatestRef.call(void 0, onReady);
|
|
6247
7239
|
const [currentScreen, setCurrentScreen] = _react.useState.call(void 0, "connect");
|
|
6248
7240
|
const [backHandler, setBackHandler] = _react.useState.call(void 0,
|
|
6249
7241
|
void 0
|
|
6250
7242
|
);
|
|
6251
|
-
const showHistoryButton = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess',
|
|
7243
|
+
const showHistoryButton = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess', _243 => _243.showHistoryButton]), () => ( false));
|
|
6252
7244
|
const historyButtonVisible = showHistoryButton && (currentScreen === "select-asset" || currentScreen === "deposit-address");
|
|
6253
7245
|
const [historyOpen, setHistoryOpen] = _react.useState.call(void 0, false);
|
|
6254
7246
|
const [historyDeposits, setHistoryDeposits] = _react.useState.call(void 0, []);
|
|
@@ -6262,7 +7254,7 @@ function DepositModalInner({
|
|
|
6262
7254
|
const targetChain = targetChainProp === "solana" ? "solana" : _chunk7JIDIX27cjs.getChainId.call(void 0, targetChainProp);
|
|
6263
7255
|
const sourceChain = sourceChainProp ? _chunk7JIDIX27cjs.getChainId.call(void 0, sourceChainProp) : void 0;
|
|
6264
7256
|
const service = _react.useMemo.call(void 0,
|
|
6265
|
-
() =>
|
|
7257
|
+
() => _chunkDZNXG5JKcjs.createDepositService.call(void 0, backendUrl, {
|
|
6266
7258
|
debug,
|
|
6267
7259
|
debugScope: "service:deposit"
|
|
6268
7260
|
}),
|
|
@@ -6278,7 +7270,7 @@ function DepositModalInner({
|
|
|
6278
7270
|
}, [store, targetChain, targetToken]);
|
|
6279
7271
|
_react.useEffect.call(void 0, () => {
|
|
6280
7272
|
if (isOpen && modalRef.current) {
|
|
6281
|
-
|
|
7273
|
+
_chunkDZNXG5JKcjs.applyTheme.call(void 0, modalRef.current, theme);
|
|
6282
7274
|
}
|
|
6283
7275
|
}, [isOpen, theme]);
|
|
6284
7276
|
_react.useEffect.call(void 0, () => {
|
|
@@ -6286,7 +7278,7 @@ function DepositModalInner({
|
|
|
6286
7278
|
}, [solanaRpcUrl]);
|
|
6287
7279
|
_react.useEffect.call(void 0, () => {
|
|
6288
7280
|
if (isOpen) {
|
|
6289
|
-
_optionalChain([onReadyRef, 'access',
|
|
7281
|
+
_optionalChain([onReadyRef, 'access', _244 => _244.current, 'optionalCall', _245 => _245()]);
|
|
6290
7282
|
}
|
|
6291
7283
|
}, [isOpen, onReadyRef]);
|
|
6292
7284
|
const handleStepChange = _react.useCallback.call(void 0,
|
|
@@ -6362,10 +7354,10 @@ function DepositModalInner({
|
|
|
6362
7354
|
fetchHistory("initial");
|
|
6363
7355
|
}
|
|
6364
7356
|
}, [historyOpen, fetchHistory]);
|
|
6365
|
-
const onLifecycleRef =
|
|
7357
|
+
const onLifecycleRef = _chunkDZNXG5JKcjs.useLatestRef.call(void 0, onLifecycle);
|
|
6366
7358
|
const handleLifecycle = _react.useCallback.call(void 0,
|
|
6367
7359
|
(event) => {
|
|
6368
|
-
_optionalChain([onLifecycleRef, 'access',
|
|
7360
|
+
_optionalChain([onLifecycleRef, 'access', _246 => _246.current, 'optionalCall', _247 => _247(event)]);
|
|
6369
7361
|
if (event.type === "smart-account-changed" && !event.evm && !event.solana) {
|
|
6370
7362
|
historyStaleRef.current = true;
|
|
6371
7363
|
}
|
|
@@ -6391,10 +7383,10 @@ function DepositModalInner({
|
|
|
6391
7383
|
store.dispatch({ type: "flow/reset" });
|
|
6392
7384
|
}
|
|
6393
7385
|
}, [isOpen, store]);
|
|
6394
|
-
const showBackButton = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess',
|
|
7386
|
+
const showBackButton = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess', _248 => _248.showBackButton]), () => ( true));
|
|
6395
7387
|
const canGoBack = backHandler !== void 0;
|
|
6396
7388
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, DepositStoreProvider, { store, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
6397
|
-
|
|
7389
|
+
_chunkDZNXG5JKcjs.Modal,
|
|
6398
7390
|
{
|
|
6399
7391
|
isOpen,
|
|
6400
7392
|
onClose,
|
|
@@ -6410,7 +7402,7 @@ function DepositModalInner({
|
|
|
6410
7402
|
className: "rs-modal-header-back",
|
|
6411
7403
|
"aria-label": "Go back",
|
|
6412
7404
|
onClick: backHandler,
|
|
6413
|
-
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
7405
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkDZNXG5JKcjs.ChevronLeftIcon, {})
|
|
6414
7406
|
}
|
|
6415
7407
|
) }),
|
|
6416
7408
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-modal-header-nav-right", children: [
|
|
@@ -6422,7 +7414,7 @@ function DepositModalInner({
|
|
|
6422
7414
|
"aria-label": "Deposit history",
|
|
6423
7415
|
onClick: handleHistoryOpen,
|
|
6424
7416
|
disabled: !recipient,
|
|
6425
|
-
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
7417
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkDZNXG5JKcjs.HistoryIcon, {})
|
|
6426
7418
|
}
|
|
6427
7419
|
),
|
|
6428
7420
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
@@ -6432,7 +7424,7 @@ function DepositModalInner({
|
|
|
6432
7424
|
onClick: onClose,
|
|
6433
7425
|
className: "rs-modal-close",
|
|
6434
7426
|
"aria-label": "Close",
|
|
6435
|
-
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
7427
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkDZNXG5JKcjs.CloseIcon, {})
|
|
6436
7428
|
}
|
|
6437
7429
|
)
|
|
6438
7430
|
] })
|
|
@@ -6460,6 +7452,10 @@ function DepositModalInner({
|
|
|
6460
7452
|
forceRegister,
|
|
6461
7453
|
enableSolana,
|
|
6462
7454
|
dappImports,
|
|
7455
|
+
enableFiatOnramp,
|
|
7456
|
+
enableQrTransfer,
|
|
7457
|
+
fiatOnrampMethods,
|
|
7458
|
+
enableExchangeConnect,
|
|
6463
7459
|
reownWallet,
|
|
6464
7460
|
onConnect,
|
|
6465
7461
|
onDisconnect,
|