@rhinestone/deposit-modal 0.3.0-alpha.9 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +76 -0
- package/dist/{DepositModalReown-I7I3KLD2.mjs → DepositModalReown-6SUEC5IU.mjs} +4 -4
- package/dist/{DepositModalReown-XUA47RYZ.cjs → DepositModalReown-DNW4GH6L.cjs} +7 -7
- package/dist/{QRCode-KG47KTGX.cjs → QRCode-5DXFNKI2.cjs} +1 -1
- package/dist/{QRCode-YJ3EGWQS.mjs → QRCode-WUC652SH.mjs} +1 -1
- package/dist/{WithdrawModalReown-KN2DGOXR.mjs → WithdrawModalReown-7UAGSOSU.mjs} +4 -4
- package/dist/{WithdrawModalReown-JATYMQYP.cjs → WithdrawModalReown-OUWBSKSM.cjs} +7 -7
- package/dist/{constants-DqVn968d.d.ts → caip-CrQ2KKU-.d.cts} +11 -1
- package/dist/{constants-DqVn968d.d.cts → caip-CrQ2KKU-.d.ts} +11 -1
- package/dist/{chunk-G5Q4QBWX.cjs → chunk-2SMS542Q.cjs} +109 -102
- package/dist/{chunk-KIPKYPNF.cjs → chunk-33H6O5UU.cjs} +6 -16
- package/dist/{chunk-SZIYS42B.mjs → chunk-6YRDD462.mjs} +63 -3
- package/dist/{chunk-OISMGA2L.mjs → chunk-GPSBM66J.mjs} +2 -12
- package/dist/{chunk-TJG2AFPS.mjs → chunk-KAWJABTW.mjs} +1048 -540
- package/dist/{chunk-4BUMVXPS.mjs → chunk-KJ2RR2D4.mjs} +1829 -584
- package/dist/{chunk-7JIDIX27.cjs → chunk-MILJQWPT.cjs} +73 -13
- package/dist/{chunk-MMXUBBGK.cjs → chunk-RABZINV3.cjs} +1032 -524
- package/dist/{chunk-KE4MRCFN.mjs → chunk-TKQYTBU6.mjs} +21 -14
- package/dist/{chunk-ZVG4JDKZ.cjs → chunk-VVJAIMKB.cjs} +1881 -636
- package/dist/constants.cjs +6 -2
- package/dist/constants.d.cts +1 -1
- package/dist/constants.d.ts +1 -1
- package/dist/constants.mjs +5 -1
- package/dist/deposit.cjs +4 -4
- package/dist/deposit.d.cts +2 -2
- package/dist/deposit.d.ts +2 -2
- package/dist/deposit.mjs +3 -3
- package/dist/index.cjs +19 -6
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.mjs +20 -7
- package/dist/styles.css +685 -75
- package/dist/{types-D8Q4TMk7.d.cts → types-BMcGO5k_.d.cts} +56 -2
- package/dist/{types-D8Q4TMk7.d.ts → types-BMcGO5k_.d.ts} +56 -2
- package/dist/withdraw.cjs +4 -4
- package/dist/withdraw.d.cts +2 -2
- package/dist/withdraw.d.ts +2 -2
- package/dist/withdraw.mjs +3 -3
- package/package.json +41 -17
|
@@ -47,10 +47,10 @@
|
|
|
47
47
|
|
|
48
48
|
|
|
49
49
|
|
|
50
|
-
var _chunkMMXUBBGKcjs = require('./chunk-MMXUBBGK.cjs');
|
|
51
50
|
|
|
52
51
|
|
|
53
52
|
|
|
53
|
+
var _chunkRABZINV3cjs = require('./chunk-RABZINV3.cjs');
|
|
54
54
|
|
|
55
55
|
|
|
56
56
|
|
|
@@ -69,7 +69,18 @@ var _chunkMMXUBBGKcjs = require('./chunk-MMXUBBGK.cjs');
|
|
|
69
69
|
|
|
70
70
|
|
|
71
71
|
|
|
72
|
-
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
var _chunkMILJQWPTcjs = require('./chunk-MILJQWPT.cjs');
|
|
73
84
|
|
|
74
85
|
// src/DepositModal.tsx
|
|
75
86
|
|
|
@@ -81,10 +92,18 @@ var _chunk7JIDIX27cjs = require('./chunk-7JIDIX27.cjs');
|
|
|
81
92
|
|
|
82
93
|
|
|
83
94
|
var _react = require('react');
|
|
95
|
+
var _viem = require('viem');
|
|
84
96
|
|
|
85
97
|
// src/DepositFlow.tsx
|
|
86
98
|
|
|
87
|
-
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
|
|
88
107
|
|
|
89
108
|
// src/components/steps/AssetSelectStep.tsx
|
|
90
109
|
|
|
@@ -108,13 +127,23 @@ function AssetSelectStep({
|
|
|
108
127
|
const [error, setError] = _react.useState.call(void 0, null);
|
|
109
128
|
const defaultAssetId = _react.useMemo.call(void 0, () => {
|
|
110
129
|
if (!defaultSourceChain || !defaultSourceToken) return null;
|
|
111
|
-
return
|
|
130
|
+
return _chunkRABZINV3cjs.getAssetId.call(void 0, {
|
|
112
131
|
chainId: defaultSourceChain,
|
|
113
132
|
token: defaultSourceToken
|
|
114
133
|
});
|
|
115
134
|
}, [defaultSourceChain, defaultSourceToken]);
|
|
135
|
+
const onTotalBalanceComputedRef = _chunkRABZINV3cjs.useLatestRef.call(void 0, onTotalBalanceComputed);
|
|
136
|
+
const onAssetsLoadedRef = _chunkRABZINV3cjs.useLatestRef.call(void 0, onAssetsLoaded);
|
|
116
137
|
_react.useEffect.call(void 0, () => {
|
|
117
138
|
let active = true;
|
|
139
|
+
function emitAssetsUpdate(currentAssets) {
|
|
140
|
+
const total = currentAssets.reduce(
|
|
141
|
+
(sum, asset) => sum + (_nullishCoalesce(asset.balanceUsd, () => ( 0))),
|
|
142
|
+
0
|
|
143
|
+
);
|
|
144
|
+
_optionalChain([onTotalBalanceComputedRef, 'access', _ => _.current, 'optionalCall', _2 => _2(total)]);
|
|
145
|
+
if (currentAssets.length > 0) _optionalChain([onAssetsLoadedRef, 'access', _3 => _3.current, 'optionalCall', _4 => _4(currentAssets)]);
|
|
146
|
+
}
|
|
118
147
|
async function loadPortfolio() {
|
|
119
148
|
if (!address) {
|
|
120
149
|
setLoading(false);
|
|
@@ -125,10 +154,11 @@ function AssetSelectStep({
|
|
|
125
154
|
try {
|
|
126
155
|
const portfolio = await service.fetchPortfolio(address);
|
|
127
156
|
if (!active) return;
|
|
128
|
-
const portfolioAssets =
|
|
157
|
+
const portfolioAssets = _chunkRABZINV3cjs.portfolioToAssets.call(void 0, portfolio.tokens);
|
|
129
158
|
setAssets(portfolioAssets);
|
|
159
|
+
emitAssetsUpdate(portfolioAssets);
|
|
130
160
|
const hasNative = portfolioAssets.some(
|
|
131
|
-
(asset) => asset.token.toLowerCase() ===
|
|
161
|
+
(asset) => asset.token.toLowerCase() === _chunkMILJQWPTcjs.NATIVE_TOKEN_ADDRESS
|
|
132
162
|
);
|
|
133
163
|
if (!hasNative) {
|
|
134
164
|
const nativeAssets = await fetchNativeAssets(
|
|
@@ -138,7 +168,9 @@ function AssetSelectStep({
|
|
|
138
168
|
);
|
|
139
169
|
if (!active) return;
|
|
140
170
|
if (nativeAssets.length > 0) {
|
|
141
|
-
|
|
171
|
+
const merged = mergeAssets(portfolioAssets, nativeAssets);
|
|
172
|
+
setAssets(merged);
|
|
173
|
+
emitAssetsUpdate(merged);
|
|
142
174
|
}
|
|
143
175
|
}
|
|
144
176
|
} catch (err) {
|
|
@@ -154,28 +186,20 @@ function AssetSelectStep({
|
|
|
154
186
|
return () => {
|
|
155
187
|
active = false;
|
|
156
188
|
};
|
|
157
|
-
}, [address, publicClient, service]);
|
|
189
|
+
}, [address, publicClient, service, onTotalBalanceComputedRef, onAssetsLoadedRef]);
|
|
158
190
|
_react.useEffect.call(void 0, () => {
|
|
159
191
|
if (!defaultAssetId || selectedAssetId) return;
|
|
160
192
|
if (assets.some((asset) => asset.id === defaultAssetId)) {
|
|
161
193
|
setSelectedAssetId(defaultAssetId);
|
|
162
194
|
}
|
|
163
195
|
}, [assets, defaultAssetId, selectedAssetId]);
|
|
164
|
-
_react.useEffect.call(void 0, () => {
|
|
165
|
-
const total = assets.reduce(
|
|
166
|
-
(sum, asset) => sum + (_nullishCoalesce(asset.balanceUsd, () => ( 0))),
|
|
167
|
-
0
|
|
168
|
-
);
|
|
169
|
-
_optionalChain([onTotalBalanceComputed, 'optionalCall', _ => _(total)]);
|
|
170
|
-
if (assets.length > 0) _optionalChain([onAssetsLoaded, 'optionalCall', _2 => _2(assets)]);
|
|
171
|
-
}, [assets, onTotalBalanceComputed, onAssetsLoaded]);
|
|
172
196
|
const allowedChainSet = _react.useMemo.call(void 0,
|
|
173
|
-
() => _optionalChain([allowedRoutes, 'optionalAccess',
|
|
174
|
-
[_optionalChain([allowedRoutes, 'optionalAccess',
|
|
197
|
+
() => _optionalChain([allowedRoutes, 'optionalAccess', _5 => _5.sourceChains]) ? new Set(allowedRoutes.sourceChains) : null,
|
|
198
|
+
[_optionalChain([allowedRoutes, 'optionalAccess', _6 => _6.sourceChains])]
|
|
175
199
|
);
|
|
176
200
|
const allowedTokenSet = _react.useMemo.call(void 0,
|
|
177
|
-
() => _optionalChain([allowedRoutes, 'optionalAccess',
|
|
178
|
-
[_optionalChain([allowedRoutes, 'optionalAccess',
|
|
201
|
+
() => _optionalChain([allowedRoutes, 'optionalAccess', _7 => _7.sourceTokens]) ? new Set(allowedRoutes.sourceTokens.map((s) => s.toUpperCase())) : null,
|
|
202
|
+
[_optionalChain([allowedRoutes, 'optionalAccess', _8 => _8.sourceTokens])]
|
|
179
203
|
);
|
|
180
204
|
const rows = _react.useMemo.call(void 0, () => {
|
|
181
205
|
return assets.filter((a) => {
|
|
@@ -206,7 +230,7 @@ function AssetSelectStep({
|
|
|
206
230
|
const raw = _viem.formatUnits.call(void 0, BigInt(asset.balance), asset.decimals);
|
|
207
231
|
const numeric = Number(raw);
|
|
208
232
|
if (!Number.isFinite(numeric)) return raw;
|
|
209
|
-
return
|
|
233
|
+
return _chunkRABZINV3cjs.tokenFormatter.format(numeric);
|
|
210
234
|
} catch (e3) {
|
|
211
235
|
return asset.balance;
|
|
212
236
|
}
|
|
@@ -214,20 +238,20 @@ function AssetSelectStep({
|
|
|
214
238
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-screen", children: [
|
|
215
239
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-screen-body", children: [
|
|
216
240
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
217
|
-
|
|
241
|
+
_chunkRABZINV3cjs.BodyHeader,
|
|
218
242
|
{
|
|
219
|
-
icon: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
243
|
+
icon: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkRABZINV3cjs.WalletIcon, {}),
|
|
220
244
|
title: "Your assets",
|
|
221
245
|
subtitle: "Select source assets to transfer"
|
|
222
246
|
}
|
|
223
247
|
),
|
|
224
248
|
loading && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-loading-state", style: { padding: "40px 12px" }, children: [
|
|
225
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
249
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkRABZINV3cjs.Spinner, { className: "rs-text-tertiary" }),
|
|
226
250
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-text-sm rs-text-tertiary", children: "Loading balances" })
|
|
227
251
|
] }),
|
|
228
|
-
error && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
252
|
+
error && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkRABZINV3cjs.Callout, { variant: "error", children: error }),
|
|
229
253
|
!loading && !error && rows.length === 0 && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-empty-state", children: [
|
|
230
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
254
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkRABZINV3cjs.WalletIcon, { className: "rs-empty-icon" }),
|
|
231
255
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-empty-text", children: "No funds in connected wallet" }),
|
|
232
256
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-empty-address", children: [
|
|
233
257
|
address.slice(0, 6),
|
|
@@ -247,9 +271,9 @@ function AssetSelectStep({
|
|
|
247
271
|
!loading && !error && rows.length > 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-asset-list", children: rows.map((asset) => {
|
|
248
272
|
const isSelected = selectedAssetId === asset.id;
|
|
249
273
|
const tokenAmount = formatBalance(asset);
|
|
250
|
-
const badge =
|
|
251
|
-
const tokenIcon =
|
|
252
|
-
const chainIcon =
|
|
274
|
+
const badge = _chunkMILJQWPTcjs.getChainBadge.call(void 0, asset.chainId);
|
|
275
|
+
const tokenIcon = _chunkMILJQWPTcjs.getTokenIcon.call(void 0, asset.symbol);
|
|
276
|
+
const chainIcon = _chunkMILJQWPTcjs.getChainIcon.call(void 0, asset.chainId);
|
|
253
277
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
254
278
|
"button",
|
|
255
279
|
{
|
|
@@ -265,7 +289,7 @@ function AssetSelectStep({
|
|
|
265
289
|
"img",
|
|
266
290
|
{
|
|
267
291
|
src: chainIcon,
|
|
268
|
-
alt:
|
|
292
|
+
alt: _chunkMILJQWPTcjs.getChainName.call(void 0, asset.chainId)
|
|
269
293
|
}
|
|
270
294
|
) }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
271
295
|
"span",
|
|
@@ -284,7 +308,7 @@ function AssetSelectStep({
|
|
|
284
308
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-asset-name", children: asset.symbol }),
|
|
285
309
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "rs-asset-chain", children: [
|
|
286
310
|
"on ",
|
|
287
|
-
|
|
311
|
+
_chunkMILJQWPTcjs.getChainName.call(void 0, asset.chainId)
|
|
288
312
|
] })
|
|
289
313
|
] }),
|
|
290
314
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-asset-balance-small", children: [
|
|
@@ -294,14 +318,14 @@ function AssetSelectStep({
|
|
|
294
318
|
] })
|
|
295
319
|
] })
|
|
296
320
|
] }),
|
|
297
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-asset-balance", children: asset.balanceUsd !== void 0 && asset.balanceUsd > 0 ?
|
|
321
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-asset-balance", children: asset.balanceUsd !== void 0 && asset.balanceUsd > 0 ? _chunkRABZINV3cjs.currencyFormatter.format(asset.balanceUsd) : tokenAmount !== "--" ? `${tokenAmount} ${asset.symbol}` : "--" })
|
|
298
322
|
]
|
|
299
323
|
},
|
|
300
324
|
asset.id
|
|
301
325
|
);
|
|
302
326
|
}) }),
|
|
303
327
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
304
|
-
|
|
328
|
+
_chunkRABZINV3cjs.Button,
|
|
305
329
|
{
|
|
306
330
|
onClick: () => selectedAsset && onContinue(selectedAsset),
|
|
307
331
|
disabled: !selectedAsset,
|
|
@@ -310,17 +334,17 @@ function AssetSelectStep({
|
|
|
310
334
|
}
|
|
311
335
|
)
|
|
312
336
|
] }),
|
|
313
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
337
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkRABZINV3cjs.PoweredBy, {})
|
|
314
338
|
] });
|
|
315
339
|
}
|
|
316
340
|
async function fetchNativeAssets(address, publicClient, existing) {
|
|
317
341
|
const existingIds = new Set(existing.map((asset) => asset.id));
|
|
318
|
-
const connectedChainId = _optionalChain([publicClient, 'access',
|
|
342
|
+
const connectedChainId = _optionalChain([publicClient, 'access', _9 => _9.chain, 'optionalAccess', _10 => _10.id]);
|
|
319
343
|
if (!connectedChainId) return [];
|
|
320
|
-
if (!
|
|
321
|
-
const id =
|
|
344
|
+
if (!_chunkMILJQWPTcjs.SOURCE_CHAINS.some((chain) => chain.id === connectedChainId)) return [];
|
|
345
|
+
const id = _chunkRABZINV3cjs.getAssetId.call(void 0, {
|
|
322
346
|
chainId: connectedChainId,
|
|
323
|
-
token:
|
|
347
|
+
token: _chunkMILJQWPTcjs.NATIVE_TOKEN_ADDRESS
|
|
324
348
|
});
|
|
325
349
|
if (existingIds.has(id)) return [];
|
|
326
350
|
try {
|
|
@@ -329,7 +353,7 @@ async function fetchNativeAssets(address, publicClient, existing) {
|
|
|
329
353
|
{
|
|
330
354
|
id,
|
|
331
355
|
chainId: connectedChainId,
|
|
332
|
-
token:
|
|
356
|
+
token: _chunkMILJQWPTcjs.NATIVE_TOKEN_ADDRESS,
|
|
333
357
|
symbol: "ETH",
|
|
334
358
|
name: "Ethereum",
|
|
335
359
|
decimals: 18,
|
|
@@ -476,7 +500,6 @@ function AmountStep({
|
|
|
476
500
|
uiConfig,
|
|
477
501
|
tokenPriceUsdOverride,
|
|
478
502
|
appBalanceUsd,
|
|
479
|
-
onBalanceUsdChange,
|
|
480
503
|
onContinue,
|
|
481
504
|
onCtaClick,
|
|
482
505
|
service
|
|
@@ -487,12 +510,12 @@ function AmountStep({
|
|
|
487
510
|
const [isCheckingLiquidity, setIsCheckingLiquidity] = _react.useState.call(void 0, false);
|
|
488
511
|
const hasAttemptedSwitch = _react.useRef.call(void 0, false);
|
|
489
512
|
const hasAppliedDefaultRef = _react.useRef.call(void 0, false);
|
|
490
|
-
const isMaxDefault = _optionalChain([defaultAmount, 'optionalAccess',
|
|
513
|
+
const isMaxDefault = _optionalChain([defaultAmount, 'optionalAccess', _11 => _11.trim, 'call', _12 => _12(), 'access', _13 => _13.toLowerCase, 'call', _14 => _14()]) === "max";
|
|
491
514
|
const chainMismatch = Boolean(
|
|
492
|
-
_optionalChain([walletClient, 'optionalAccess',
|
|
515
|
+
_optionalChain([walletClient, 'optionalAccess', _15 => _15.chain, 'optionalAccess', _16 => _16.id]) && walletClient.chain.id !== asset.chainId
|
|
493
516
|
);
|
|
494
|
-
const targetSymbol =
|
|
495
|
-
const isSourceStablecoin =
|
|
517
|
+
const targetSymbol = _chunkMILJQWPTcjs.getTargetTokenSymbol.call(void 0, targetToken, targetChain);
|
|
518
|
+
const isSourceStablecoin = _chunkMILJQWPTcjs.isStablecoinSymbol.call(void 0, asset.symbol);
|
|
496
519
|
const tokenPriceUsd = _react.useMemo.call(void 0, () => {
|
|
497
520
|
if (tokenPriceUsdOverride !== void 0 && tokenPriceUsdOverride > 0)
|
|
498
521
|
return tokenPriceUsdOverride;
|
|
@@ -516,7 +539,7 @@ function AmountStep({
|
|
|
516
539
|
const balanceTarget = _nullishCoalesce(balanceAddress, () => ( address));
|
|
517
540
|
if (!balanceTarget || !publicClient) return;
|
|
518
541
|
try {
|
|
519
|
-
const bal =
|
|
542
|
+
const bal = _chunkRABZINV3cjs.isNativeAsset.call(void 0, asset) ? await publicClient.getBalance({ address: balanceTarget }) : await publicClient.readContract({
|
|
520
543
|
address: asset.token,
|
|
521
544
|
abi: _viem.erc20Abi,
|
|
522
545
|
functionName: "balanceOf",
|
|
@@ -537,7 +560,7 @@ function AmountStep({
|
|
|
537
560
|
hasAttemptedSwitch.current = true;
|
|
538
561
|
switchChain(asset.chainId).catch((err) => {
|
|
539
562
|
const raw = err instanceof Error ? err.message : "Failed to switch chain";
|
|
540
|
-
setError(
|
|
563
|
+
setError(_chunkRABZINV3cjs.formatUserError.call(void 0, raw));
|
|
541
564
|
});
|
|
542
565
|
}
|
|
543
566
|
}, [chainMismatch, switchChain, asset.chainId]);
|
|
@@ -554,9 +577,6 @@ function AmountStep({
|
|
|
554
577
|
return null;
|
|
555
578
|
}
|
|
556
579
|
}, [balance, tokenPriceUsd, asset.decimals]);
|
|
557
|
-
_react.useEffect.call(void 0, () => {
|
|
558
|
-
_optionalChain([onBalanceUsdChange, 'optionalCall', _15 => _15(_nullishCoalesce(balanceUsd, () => ( 0)))]);
|
|
559
|
-
}, [balanceUsd, onBalanceUsdChange]);
|
|
560
580
|
_react.useEffect.call(void 0, () => {
|
|
561
581
|
if (hasAppliedDefaultRef.current || !defaultAmount) return;
|
|
562
582
|
if (isMaxDefault) {
|
|
@@ -593,7 +613,7 @@ function AmountStep({
|
|
|
593
613
|
const raw = _viem.formatUnits.call(void 0, balance, asset.decimals);
|
|
594
614
|
const numeric = Number(raw);
|
|
595
615
|
if (!Number.isFinite(numeric)) return raw;
|
|
596
|
-
return
|
|
616
|
+
return _chunkRABZINV3cjs.tokenFormatter.format(numeric);
|
|
597
617
|
} catch (e8) {
|
|
598
618
|
return "\u2026";
|
|
599
619
|
}
|
|
@@ -612,8 +632,8 @@ function AmountStep({
|
|
|
612
632
|
return null;
|
|
613
633
|
}
|
|
614
634
|
}, [numericAmount, isSourceStablecoin, hasPricing, tokenPriceUsd, asset.decimals]);
|
|
615
|
-
const minDepositUsd = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess',
|
|
616
|
-
const maxDepositUsd = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess',
|
|
635
|
+
const minDepositUsd = targetChain === _chunkMILJQWPTcjs.HYPERCORE_CHAIN_ID ? Math.max(_chunkMILJQWPTcjs.HYPERCORE_MIN_DEPOSIT_USD, _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess', _17 => _17.minDepositUsd]), () => ( 0))) : _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess', _18 => _18.minDepositUsd]), () => ( null));
|
|
636
|
+
const maxDepositUsd = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess', _19 => _19.maxDepositUsd]), () => ( null));
|
|
617
637
|
const isBelowMin = minDepositUsd !== null && numericAmount > 0 && amountUsd < minDepositUsd;
|
|
618
638
|
const isAboveMax = maxDepositUsd !== null && amountUsd > maxDepositUsd;
|
|
619
639
|
const exceedsBalance = Boolean(
|
|
@@ -622,7 +642,7 @@ function AmountStep({
|
|
|
622
642
|
const balanceAfterUsd = appBalanceUsd !== void 0 ? appBalanceUsd + numericAmount : null;
|
|
623
643
|
const handlePresetClick = (percentage) => {
|
|
624
644
|
if (balance === null) return;
|
|
625
|
-
_optionalChain([onCtaClick, 'optionalCall',
|
|
645
|
+
_optionalChain([onCtaClick, 'optionalCall', _20 => _20(percentage === 100 ? "Max" : `${percentage}%`)]);
|
|
626
646
|
const next = formatAmountFromBalance(
|
|
627
647
|
balance,
|
|
628
648
|
asset.decimals,
|
|
@@ -669,13 +689,13 @@ function AmountStep({
|
|
|
669
689
|
return;
|
|
670
690
|
}
|
|
671
691
|
setError(null);
|
|
672
|
-
_optionalChain([onCtaClick, 'optionalCall',
|
|
692
|
+
_optionalChain([onCtaClick, 'optionalCall', _21 => _21("continue")]);
|
|
673
693
|
setIsCheckingLiquidity(true);
|
|
674
694
|
let liquidityWarning;
|
|
675
695
|
try {
|
|
676
696
|
const liquidity = await service.checkLiquidity({
|
|
677
|
-
sourceChainId: _nullishCoalesce(_optionalChain([liquiditySource, 'optionalAccess',
|
|
678
|
-
sourceToken: _nullishCoalesce(_optionalChain([liquiditySource, 'optionalAccess',
|
|
697
|
+
sourceChainId: _nullishCoalesce(_optionalChain([liquiditySource, 'optionalAccess', _22 => _22.chainId]), () => ( asset.chainId)),
|
|
698
|
+
sourceToken: _nullishCoalesce(_optionalChain([liquiditySource, 'optionalAccess', _23 => _23.token]), () => ( asset.token)),
|
|
679
699
|
destinationChainId: targetChain,
|
|
680
700
|
destinationToken: targetToken,
|
|
681
701
|
amount: amountInUnits.toString()
|
|
@@ -706,13 +726,13 @@ function AmountStep({
|
|
|
706
726
|
};
|
|
707
727
|
const continueLabel = exceedsBalance ? "Insufficient balance" : isAboveMax ? "Continue with max allowed deposit" : isBelowMin ? "Continue with minimum deposit" : "Continue";
|
|
708
728
|
const continueDisabled = chainMismatch || isCheckingLiquidity || exceedsBalance || numericAmount === 0 && !isBelowMin || balance === null;
|
|
709
|
-
const sourceChainName =
|
|
710
|
-
const targetChainName =
|
|
711
|
-
const sourceTokenIcon =
|
|
712
|
-
const targetTokenIcon =
|
|
729
|
+
const sourceChainName = _chunkMILJQWPTcjs.getChainName.call(void 0, asset.chainId);
|
|
730
|
+
const targetChainName = _chunkMILJQWPTcjs.getChainName.call(void 0, targetChain);
|
|
731
|
+
const sourceTokenIcon = _chunkMILJQWPTcjs.getTokenIcon.call(void 0, asset.symbol);
|
|
732
|
+
const targetTokenIcon = _chunkMILJQWPTcjs.getTokenIcon.call(void 0, targetSymbol);
|
|
713
733
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-screen", children: [
|
|
714
734
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-screen-body rs-screen-body--gap-32", children: [
|
|
715
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
735
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkRABZINV3cjs.BodyHeader, { icon: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkRABZINV3cjs.WalletIcon, {}), title: "Wallet deposit" }),
|
|
716
736
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-amount-section", children: [
|
|
717
737
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-amount-display", children: [
|
|
718
738
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
@@ -732,13 +752,13 @@ function AmountStep({
|
|
|
732
752
|
" available",
|
|
733
753
|
balanceUsd !== null && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
734
754
|
" (~",
|
|
735
|
-
|
|
755
|
+
_chunkRABZINV3cjs.currencyFormatter.format(balanceUsd),
|
|
736
756
|
")"
|
|
737
757
|
] })
|
|
738
758
|
] }),
|
|
739
759
|
minDepositUsd !== null && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "rs-amount-meta-minimum", children: [
|
|
740
760
|
"Min. deposit ",
|
|
741
|
-
|
|
761
|
+
_chunkRABZINV3cjs.currencyFormatter.format(minDepositUsd)
|
|
742
762
|
] })
|
|
743
763
|
] })
|
|
744
764
|
] }),
|
|
@@ -779,12 +799,13 @@ function AmountStep({
|
|
|
779
799
|
] }),
|
|
780
800
|
balanceAfterUsd !== null && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-amount-detail-row", children: [
|
|
781
801
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: "Balance after deposit" }),
|
|
782
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-amount-detail-value", children:
|
|
802
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-amount-detail-value", children: _chunkRABZINV3cjs.currencyFormatter.format(balanceAfterUsd) })
|
|
783
803
|
] })
|
|
784
804
|
] }),
|
|
785
|
-
|
|
805
|
+
targetChain === _chunkMILJQWPTcjs.HYPERCORE_CHAIN_ID && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkRABZINV3cjs.Callout, { variant: "warning", children: "First deposit to a new HyperCore account includes a ~1 USDC activation fee." }),
|
|
806
|
+
error && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkRABZINV3cjs.Callout, { variant: "error", children: error }),
|
|
786
807
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
787
|
-
|
|
808
|
+
_chunkRABZINV3cjs.Button,
|
|
788
809
|
{
|
|
789
810
|
onClick: handleContinue,
|
|
790
811
|
fullWidth: true,
|
|
@@ -795,7 +816,7 @@ function AmountStep({
|
|
|
795
816
|
}
|
|
796
817
|
)
|
|
797
818
|
] }),
|
|
798
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
819
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkRABZINV3cjs.PoweredBy, {})
|
|
799
820
|
] });
|
|
800
821
|
}
|
|
801
822
|
|
|
@@ -821,6 +842,7 @@ function ConfirmStep({
|
|
|
821
842
|
estimatedTime = "< 1 min",
|
|
822
843
|
quotedFeeAmount = "0.1",
|
|
823
844
|
quotedFeeSymbol,
|
|
845
|
+
service,
|
|
824
846
|
onConfirm,
|
|
825
847
|
onError,
|
|
826
848
|
onDepositSubmitted,
|
|
@@ -828,19 +850,23 @@ function ConfirmStep({
|
|
|
828
850
|
}) {
|
|
829
851
|
const [isSubmitting, setIsSubmitting] = _react.useState.call(void 0, false);
|
|
830
852
|
const [error, setError] = _react.useState.call(void 0, null);
|
|
853
|
+
const [quote, setQuote] = _react.useState.call(void 0, null);
|
|
831
854
|
const hasAttemptedSwitch = _react.useRef.call(void 0, false);
|
|
832
855
|
const chainMismatch = Boolean(
|
|
833
|
-
_optionalChain([walletClient, 'optionalAccess',
|
|
856
|
+
_optionalChain([walletClient, 'optionalAccess', _24 => _24.chain, 'optionalAccess', _25 => _25.id]) && walletClient.chain.id !== asset.chainId
|
|
834
857
|
);
|
|
835
858
|
const sameRoute = targetChain === asset.chainId && targetToken.toLowerCase() === asset.token.toLowerCase();
|
|
836
|
-
const targetSymbol = sameRoute ? asset.symbol :
|
|
837
|
-
const sourceChainName =
|
|
838
|
-
const targetChainName =
|
|
839
|
-
const sourceChainIcon =
|
|
840
|
-
const targetChainIcon =
|
|
841
|
-
const sourceTokenIcon =
|
|
842
|
-
const targetTokenIcon =
|
|
843
|
-
const formattedSendAmount = amount && !Number.isNaN(Number(amount)) ? Number(amount).toLocaleString("en-US", {
|
|
859
|
+
const targetSymbol = sameRoute ? asset.symbol : _chunkMILJQWPTcjs.getTargetTokenSymbol.call(void 0, targetToken, targetChain);
|
|
860
|
+
const sourceChainName = _chunkMILJQWPTcjs.getChainName.call(void 0, asset.chainId);
|
|
861
|
+
const targetChainName = _chunkMILJQWPTcjs.getChainName.call(void 0, targetChain);
|
|
862
|
+
const sourceChainIcon = _chunkMILJQWPTcjs.getChainIcon.call(void 0, asset.chainId);
|
|
863
|
+
const targetChainIcon = _chunkMILJQWPTcjs.getChainIcon.call(void 0, targetChain);
|
|
864
|
+
const sourceTokenIcon = _chunkMILJQWPTcjs.getTokenIcon.call(void 0, asset.symbol);
|
|
865
|
+
const targetTokenIcon = _chunkMILJQWPTcjs.getTokenIcon.call(void 0, targetSymbol);
|
|
866
|
+
const formattedSendAmount = amount && !Number.isNaN(Number(amount)) ? Number(amount).toLocaleString("en-US", {
|
|
867
|
+
minimumFractionDigits: 2,
|
|
868
|
+
maximumFractionDigits: 6
|
|
869
|
+
}) : "0";
|
|
844
870
|
const formattedReceiveAmount = (() => {
|
|
845
871
|
if (sameRoute) return formattedSendAmount;
|
|
846
872
|
const dollarValue = Number(targetAmount);
|
|
@@ -848,25 +874,63 @@ function ConfirmStep({
|
|
|
848
874
|
return formattedSendAmount;
|
|
849
875
|
if (targetTokenPriceUsd !== null && targetTokenPriceUsd > 0) {
|
|
850
876
|
const tokenAmount = dollarValue / targetTokenPriceUsd;
|
|
851
|
-
return tokenAmount.toLocaleString("en-US", {
|
|
877
|
+
return tokenAmount.toLocaleString("en-US", {
|
|
878
|
+
minimumFractionDigits: 2,
|
|
879
|
+
maximumFractionDigits: 6
|
|
880
|
+
});
|
|
852
881
|
}
|
|
853
882
|
return formattedSendAmount;
|
|
854
883
|
})();
|
|
855
884
|
const receiveAmount = sameRoute ? formattedReceiveAmount : `~${formattedReceiveAmount}`;
|
|
856
|
-
const feeSponsored = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess',
|
|
857
|
-
const feeTooltip = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess',
|
|
885
|
+
const feeSponsored = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess', _26 => _26.feeSponsored]), () => ( false));
|
|
886
|
+
const feeTooltip = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess', _27 => _27.feeTooltip]), () => ( (feeSponsored ? "Network fees are sponsored for this deposit." : "Network fees apply.")));
|
|
887
|
+
const feeDisplay = quote ? `$${quote.fees.totalUsd.toFixed(2)}` : null;
|
|
888
|
+
const estimatedTimeDisplay = quote ? quote.estimatedFillTimeSeconds < 60 ? "< 1 min" : `~${Math.round(quote.estimatedFillTimeSeconds / 60)} min` : estimatedTime;
|
|
858
889
|
_react.useEffect.call(void 0, () => {
|
|
859
890
|
if (chainMismatch && switchChain && !hasAttemptedSwitch.current) {
|
|
860
891
|
hasAttemptedSwitch.current = true;
|
|
861
892
|
switchChain(asset.chainId).catch((err) => {
|
|
862
893
|
const raw = err instanceof Error ? err.message : "Failed to switch chain";
|
|
863
|
-
setError(
|
|
894
|
+
setError(_chunkRABZINV3cjs.formatUserError.call(void 0, raw));
|
|
864
895
|
});
|
|
865
896
|
}
|
|
866
897
|
}, [chainMismatch, switchChain, asset.chainId]);
|
|
867
898
|
_react.useEffect.call(void 0, () => {
|
|
868
899
|
hasAttemptedSwitch.current = false;
|
|
869
900
|
}, [asset.chainId]);
|
|
901
|
+
_react.useEffect.call(void 0, () => {
|
|
902
|
+
if (targetChain === "solana" && asset.chainId === void 0) return;
|
|
903
|
+
let cancelled = false;
|
|
904
|
+
let units;
|
|
905
|
+
try {
|
|
906
|
+
units = _viem.parseUnits.call(void 0, amount, asset.decimals);
|
|
907
|
+
} catch (e12) {
|
|
908
|
+
return;
|
|
909
|
+
}
|
|
910
|
+
if (units <= 0n) return;
|
|
911
|
+
setQuote(null);
|
|
912
|
+
service.getQuotePreview({
|
|
913
|
+
account: smartAccount,
|
|
914
|
+
sourceChainId: asset.chainId,
|
|
915
|
+
sourceToken: asset.token,
|
|
916
|
+
amount: units.toString()
|
|
917
|
+
}).then((result) => {
|
|
918
|
+
if (!cancelled) setQuote(result);
|
|
919
|
+
}).catch(() => {
|
|
920
|
+
if (!cancelled) setQuote(null);
|
|
921
|
+
});
|
|
922
|
+
return () => {
|
|
923
|
+
cancelled = true;
|
|
924
|
+
};
|
|
925
|
+
}, [
|
|
926
|
+
service,
|
|
927
|
+
smartAccount,
|
|
928
|
+
asset.chainId,
|
|
929
|
+
asset.token,
|
|
930
|
+
asset.decimals,
|
|
931
|
+
amount,
|
|
932
|
+
targetChain
|
|
933
|
+
]);
|
|
870
934
|
const handleConfirm = async () => {
|
|
871
935
|
if (!address || !walletClient) {
|
|
872
936
|
setError("Wallet not connected");
|
|
@@ -884,7 +948,7 @@ function ConfirmStep({
|
|
|
884
948
|
let amountUnits;
|
|
885
949
|
try {
|
|
886
950
|
amountUnits = _viem.parseUnits.call(void 0, amount, asset.decimals);
|
|
887
|
-
} catch (
|
|
951
|
+
} catch (e13) {
|
|
888
952
|
setError("Please enter a valid amount");
|
|
889
953
|
return;
|
|
890
954
|
}
|
|
@@ -907,7 +971,7 @@ function ConfirmStep({
|
|
|
907
971
|
const result = await executeTransfer(amountUnits);
|
|
908
972
|
hash = result.txHash;
|
|
909
973
|
resolvedSourceToken = result.sourceToken;
|
|
910
|
-
} else if (
|
|
974
|
+
} else if (_chunkRABZINV3cjs.isNativeAsset.call(void 0, asset)) {
|
|
911
975
|
hash = await walletClient.sendTransaction({
|
|
912
976
|
account,
|
|
913
977
|
chain,
|
|
@@ -924,20 +988,20 @@ function ConfirmStep({
|
|
|
924
988
|
args: [transferTo, amountUnits]
|
|
925
989
|
});
|
|
926
990
|
}
|
|
927
|
-
_optionalChain([onDepositSubmitted, 'optionalCall',
|
|
991
|
+
_optionalChain([onDepositSubmitted, 'optionalCall', _28 => _28(hash, asset.chainId, amountUnits.toString())]);
|
|
928
992
|
onConfirm(hash, asset.chainId, amountUnits.toString(), resolvedSourceToken);
|
|
929
993
|
} catch (err) {
|
|
930
994
|
const raw = err instanceof Error ? err.message : "Transfer failed";
|
|
931
|
-
const message =
|
|
995
|
+
const message = _chunkRABZINV3cjs.formatUserError.call(void 0, raw);
|
|
932
996
|
setError(message);
|
|
933
|
-
_optionalChain([onError, 'optionalCall',
|
|
997
|
+
_optionalChain([onError, 'optionalCall', _29 => _29(message, "TRANSFER_ERROR")]);
|
|
934
998
|
} finally {
|
|
935
999
|
setIsSubmitting(false);
|
|
936
1000
|
}
|
|
937
1001
|
};
|
|
938
1002
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-screen", children: [
|
|
939
1003
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-screen-body rs-screen-body--gap-32", children: [
|
|
940
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1004
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkRABZINV3cjs.BodyHeader, { icon: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkRABZINV3cjs.WalletIcon, {}), title: "Review deposit" }),
|
|
941
1005
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-review-details", children: [
|
|
942
1006
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-review-detail-row", children: [
|
|
943
1007
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: "Source chain" }),
|
|
@@ -955,7 +1019,7 @@ function ConfirmStep({
|
|
|
955
1019
|
] }),
|
|
956
1020
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-review-detail-row", children: [
|
|
957
1021
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: "Estimated time" }),
|
|
958
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-review-detail-value", children:
|
|
1022
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-review-detail-value", children: estimatedTimeDisplay })
|
|
959
1023
|
] }),
|
|
960
1024
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-review-detail-row", children: [
|
|
961
1025
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: "You send" }),
|
|
@@ -982,20 +1046,27 @@ function ConfirmStep({
|
|
|
982
1046
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-review-detail-row", children: [
|
|
983
1047
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: "Fees" }),
|
|
984
1048
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "rs-review-detail-value", children: [
|
|
985
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1049
|
+
feeDisplay === null ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1050
|
+
"span",
|
|
1051
|
+
{
|
|
1052
|
+
className: "rs-skeleton rs-skeleton-fee",
|
|
1053
|
+
"aria-hidden": "true"
|
|
1054
|
+
}
|
|
1055
|
+
) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
986
1056
|
"span",
|
|
987
1057
|
{
|
|
988
1058
|
style: feeSponsored ? { textDecoration: "line-through" } : void 0,
|
|
989
|
-
children:
|
|
1059
|
+
children: feeDisplay
|
|
990
1060
|
}
|
|
991
1061
|
),
|
|
992
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1062
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkRABZINV3cjs.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, _chunkRABZINV3cjs.InfoIcon, {}) }) })
|
|
993
1063
|
] })
|
|
994
1064
|
] })
|
|
995
1065
|
] }),
|
|
996
|
-
|
|
1066
|
+
targetChain === _chunkMILJQWPTcjs.HYPERCORE_CHAIN_ID && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkRABZINV3cjs.Callout, { variant: "warning", children: "First deposit to a new HyperCore account includes a ~1 USDC activation fee." }),
|
|
1067
|
+
error && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkRABZINV3cjs.Callout, { variant: "error", children: error }),
|
|
997
1068
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
998
|
-
|
|
1069
|
+
_chunkRABZINV3cjs.Button,
|
|
999
1070
|
{
|
|
1000
1071
|
onClick: handleConfirm,
|
|
1001
1072
|
loading: isSubmitting,
|
|
@@ -1006,7 +1077,7 @@ function ConfirmStep({
|
|
|
1006
1077
|
}
|
|
1007
1078
|
)
|
|
1008
1079
|
] }),
|
|
1009
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1080
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkRABZINV3cjs.PoweredBy, {})
|
|
1010
1081
|
] });
|
|
1011
1082
|
}
|
|
1012
1083
|
|
|
@@ -1029,9 +1100,9 @@ var INITIAL_POLL_INTERVAL = 3e3;
|
|
|
1029
1100
|
var MAX_POLL_INTERVAL = 3e4;
|
|
1030
1101
|
var BACKOFF_MULTIPLIER = 1.5;
|
|
1031
1102
|
function isEventForTx(event, txHash) {
|
|
1032
|
-
const eventTxHash =
|
|
1103
|
+
const eventTxHash = _chunkRABZINV3cjs.getEventTxHash.call(void 0, event);
|
|
1033
1104
|
if (!eventTxHash) return false;
|
|
1034
|
-
return
|
|
1105
|
+
return _chunkRABZINV3cjs.txRefsMatch.call(void 0, eventTxHash, txHash);
|
|
1035
1106
|
}
|
|
1036
1107
|
function truncateHash(hash) {
|
|
1037
1108
|
return `${hash.slice(0, 4)}\u2026${hash.slice(-4)}`;
|
|
@@ -1061,7 +1132,7 @@ function formatTimestamp(ms) {
|
|
|
1061
1132
|
return `${month} ${day}${suffix} \xB7 ${hours}:${minutes}:${seconds}`;
|
|
1062
1133
|
}
|
|
1063
1134
|
function formatBridgeFailedMessage(event) {
|
|
1064
|
-
const eventData = _nullishCoalesce(_optionalChain([event, 'optionalAccess',
|
|
1135
|
+
const eventData = _nullishCoalesce(_optionalChain([event, 'optionalAccess', _30 => _30.data]), () => ( {}));
|
|
1065
1136
|
const backendMessage = typeof eventData.message === "string" ? eventData.message.trim() : "";
|
|
1066
1137
|
if (backendMessage.length > 0) {
|
|
1067
1138
|
const lower = backendMessage.toLowerCase();
|
|
@@ -1081,21 +1152,28 @@ function formatBridgeFailedMessage(event) {
|
|
|
1081
1152
|
}
|
|
1082
1153
|
return "Bridge failed";
|
|
1083
1154
|
}
|
|
1084
|
-
var txLinkIcon = /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1155
|
+
var txLinkIcon = /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkRABZINV3cjs.ExternalLinkIcon, { className: "rs-deposit-notification-link-icon" });
|
|
1085
1156
|
function DepositNotification({
|
|
1086
1157
|
deposit,
|
|
1087
1158
|
smartAccount,
|
|
1088
1159
|
solanaDepositAddress,
|
|
1089
1160
|
targetChain,
|
|
1090
1161
|
targetToken,
|
|
1091
|
-
waitForFinalTx,
|
|
1092
1162
|
hasPostBridgeActions,
|
|
1093
1163
|
service,
|
|
1094
1164
|
onComplete,
|
|
1095
1165
|
onFailed,
|
|
1096
1166
|
onDismiss
|
|
1097
1167
|
}) {
|
|
1098
|
-
const {
|
|
1168
|
+
const {
|
|
1169
|
+
txHash,
|
|
1170
|
+
sourceChain,
|
|
1171
|
+
amount,
|
|
1172
|
+
token,
|
|
1173
|
+
sourceDecimals,
|
|
1174
|
+
detectedAt,
|
|
1175
|
+
directTransfer
|
|
1176
|
+
} = deposit;
|
|
1099
1177
|
const [status, setStatus] = _react.useState.call(void 0,
|
|
1100
1178
|
directTransfer ? "complete" : "processing"
|
|
1101
1179
|
);
|
|
@@ -1109,17 +1187,17 @@ function DepositNotification({
|
|
|
1109
1187
|
const pollIntervalRef = _react.useRef.call(void 0, INITIAL_POLL_INTERVAL);
|
|
1110
1188
|
const pollTimeoutRef = _react.useRef.call(void 0, null);
|
|
1111
1189
|
const completedRef = _react.useRef.call(void 0, _nullishCoalesce(directTransfer, () => ( false)));
|
|
1112
|
-
const depositContextRef =
|
|
1190
|
+
const depositContextRef = _chunkRABZINV3cjs.useLatestRef.call(void 0, {
|
|
1113
1191
|
amount,
|
|
1114
1192
|
sourceChain,
|
|
1115
1193
|
sourceToken: token,
|
|
1194
|
+
sourceDecimals,
|
|
1116
1195
|
targetChain,
|
|
1117
1196
|
targetToken,
|
|
1118
|
-
waitForFinalTx,
|
|
1119
1197
|
hasPostBridgeActions
|
|
1120
1198
|
});
|
|
1121
|
-
const onCompleteRef =
|
|
1122
|
-
const onFailedRef =
|
|
1199
|
+
const onCompleteRef = _chunkRABZINV3cjs.useLatestRef.call(void 0, onComplete);
|
|
1200
|
+
const onFailedRef = _chunkRABZINV3cjs.useLatestRef.call(void 0, onFailed);
|
|
1123
1201
|
const handleComplete = _react.useCallback.call(void 0,
|
|
1124
1202
|
(destTxHash) => {
|
|
1125
1203
|
if (completedRef.current) return;
|
|
@@ -1128,10 +1206,11 @@ function DepositNotification({
|
|
|
1128
1206
|
setCompletedAt(Date.now());
|
|
1129
1207
|
setStatus("complete");
|
|
1130
1208
|
const context = depositContextRef.current;
|
|
1131
|
-
_optionalChain([onCompleteRef, 'access',
|
|
1209
|
+
_optionalChain([onCompleteRef, 'access', _31 => _31.current, 'optionalCall', _32 => _32(txHash, destTxHash, {
|
|
1132
1210
|
amount: context.amount,
|
|
1133
1211
|
sourceChain: context.sourceChain,
|
|
1134
1212
|
sourceToken: context.sourceToken,
|
|
1213
|
+
sourceDecimals: context.sourceDecimals,
|
|
1135
1214
|
targetChain: context.targetChain,
|
|
1136
1215
|
targetToken: context.targetToken
|
|
1137
1216
|
})]);
|
|
@@ -1143,7 +1222,7 @@ function DepositNotification({
|
|
|
1143
1222
|
if (completedRef.current) return;
|
|
1144
1223
|
completedRef.current = true;
|
|
1145
1224
|
setStatus("failed");
|
|
1146
|
-
_optionalChain([onFailedRef, 'access',
|
|
1225
|
+
_optionalChain([onFailedRef, 'access', _33 => _33.current, 'optionalCall', _34 => _34(txHash, error)]);
|
|
1147
1226
|
},
|
|
1148
1227
|
[onFailedRef, txHash]
|
|
1149
1228
|
);
|
|
@@ -1161,36 +1240,32 @@ function DepositNotification({
|
|
|
1161
1240
|
if (!isMounted) return;
|
|
1162
1241
|
const lastEvent = data.lastEvent;
|
|
1163
1242
|
const eventForTx = isEventForTx(lastEvent, txHash) ? lastEvent : void 0;
|
|
1164
|
-
const awaitingPostBridgeSwap = depositContextRef.current.
|
|
1165
|
-
if (_optionalChain([eventForTx, 'optionalAccess',
|
|
1166
|
-
const swapTxHash = _optionalChain([eventForTx, 'access',
|
|
1243
|
+
const awaitingPostBridgeSwap = depositContextRef.current.hasPostBridgeActions;
|
|
1244
|
+
if (_optionalChain([eventForTx, 'optionalAccess', _35 => _35.type]) === "post-bridge-swap-complete") {
|
|
1245
|
+
const swapTxHash = _optionalChain([eventForTx, 'access', _36 => _36.data, 'optionalAccess', _37 => _37.swap, 'optionalAccess', _38 => _38.transactionHash]);
|
|
1167
1246
|
handleComplete(swapTxHash);
|
|
1168
1247
|
return;
|
|
1169
1248
|
}
|
|
1170
|
-
if (_optionalChain([eventForTx, 'optionalAccess',
|
|
1249
|
+
if (_optionalChain([eventForTx, 'optionalAccess', _39 => _39.type]) === "post-bridge-swap-failed") {
|
|
1171
1250
|
handleFailed(formatBridgeFailedMessage(eventForTx));
|
|
1172
1251
|
return;
|
|
1173
1252
|
}
|
|
1174
|
-
if (_optionalChain([eventForTx, 'optionalAccess',
|
|
1175
|
-
const destTx = _optionalChain([eventForTx, 'access',
|
|
1253
|
+
if (_optionalChain([eventForTx, 'optionalAccess', _40 => _40.type]) === "bridge-complete" && !awaitingPostBridgeSwap) {
|
|
1254
|
+
const destTx = _optionalChain([eventForTx, 'access', _41 => _41.data, 'optionalAccess', _42 => _42.destination, 'optionalAccess', _43 => _43.transactionHash]);
|
|
1176
1255
|
handleComplete(destTx);
|
|
1177
1256
|
return;
|
|
1178
1257
|
}
|
|
1179
|
-
if (
|
|
1180
|
-
handleComplete(void 0);
|
|
1181
|
-
return;
|
|
1182
|
-
}
|
|
1183
|
-
if (_optionalChain([eventForTx, 'optionalAccess', _43 => _43.type]) === "bridge-failed") {
|
|
1258
|
+
if (_optionalChain([eventForTx, 'optionalAccess', _44 => _44.type]) === "bridge-failed") {
|
|
1184
1259
|
handleFailed(formatBridgeFailedMessage(eventForTx));
|
|
1185
1260
|
return;
|
|
1186
1261
|
}
|
|
1187
|
-
if (_optionalChain([eventForTx, 'optionalAccess',
|
|
1188
|
-
const errorMessage = _nullishCoalesce(_optionalChain([eventForTx, 'access',
|
|
1262
|
+
if (_optionalChain([eventForTx, 'optionalAccess', _45 => _45.type]) === "error") {
|
|
1263
|
+
const errorMessage = _nullishCoalesce(_optionalChain([eventForTx, 'access', _46 => _46.data, 'optionalAccess', _47 => _47.message]), () => ( "Unknown error"));
|
|
1189
1264
|
handleFailed(errorMessage);
|
|
1190
1265
|
return;
|
|
1191
1266
|
}
|
|
1192
1267
|
scheduleNextPoll();
|
|
1193
|
-
} catch (
|
|
1268
|
+
} catch (e14) {
|
|
1194
1269
|
scheduleNextPoll();
|
|
1195
1270
|
}
|
|
1196
1271
|
}
|
|
@@ -1223,11 +1298,42 @@ function DepositNotification({
|
|
|
1223
1298
|
status,
|
|
1224
1299
|
txHash
|
|
1225
1300
|
]);
|
|
1226
|
-
const sourceExplorerUrl = sourceChain === "unknown" ? void 0 :
|
|
1227
|
-
const destExplorerUrl = destinationTxHash ?
|
|
1301
|
+
const sourceExplorerUrl = sourceChain === "unknown" ? void 0 : _chunkMILJQWPTcjs.getExplorerTxUrl.call(void 0, sourceChain, txHash);
|
|
1302
|
+
const destExplorerUrl = destinationTxHash ? _chunkMILJQWPTcjs.getExplorerTxUrl.call(void 0, targetChain, destinationTxHash) : null;
|
|
1228
1303
|
const title = status === "complete" ? "Deposit completed" : status === "failed" ? "Deposit failed" : "Deposit received and processing\u2026";
|
|
1229
1304
|
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.";
|
|
1230
|
-
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,
|
|
1305
|
+
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, _chunkRABZINV3cjs.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, _chunkRABZINV3cjs.CloseIcon, {}) }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-deposit-notification-badge rs-deposit-notification-badge--processing", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1306
|
+
"svg",
|
|
1307
|
+
{
|
|
1308
|
+
className: "rs-deposit-notification-spinner",
|
|
1309
|
+
viewBox: "0 0 44 44",
|
|
1310
|
+
fill: "none",
|
|
1311
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1312
|
+
"aria-hidden": "true",
|
|
1313
|
+
children: [
|
|
1314
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1315
|
+
"path",
|
|
1316
|
+
{
|
|
1317
|
+
className: "rs-deposit-notification-spinner-track",
|
|
1318
|
+
d: "M21.5882 42.1765C32.9588 42.1765 42.1765 32.9588 42.1765 21.5882C42.1765 10.2177 32.9588 1 21.5882 1C10.2177 1 1 10.2177 1 21.5882C1 32.9588 10.2177 42.1765 21.5882 42.1765Z",
|
|
1319
|
+
stroke: "#D4D4D8",
|
|
1320
|
+
strokeWidth: "2",
|
|
1321
|
+
strokeLinecap: "round"
|
|
1322
|
+
}
|
|
1323
|
+
),
|
|
1324
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1325
|
+
"path",
|
|
1326
|
+
{
|
|
1327
|
+
className: "rs-deposit-notification-spinner-head",
|
|
1328
|
+
d: "M28.0422 2.03186C31.4239 3.1515 34.458 5.1279 36.8489 7.76854C39.2398 10.4092 40.906 13.624 41.6852 17.1",
|
|
1329
|
+
stroke: "#52525C",
|
|
1330
|
+
strokeWidth: "2",
|
|
1331
|
+
strokeLinecap: "round"
|
|
1332
|
+
}
|
|
1333
|
+
)
|
|
1334
|
+
]
|
|
1335
|
+
}
|
|
1336
|
+
) });
|
|
1231
1337
|
const showClose = status !== "processing";
|
|
1232
1338
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1233
1339
|
"div",
|
|
@@ -1246,7 +1352,7 @@ function DepositNotification({
|
|
|
1246
1352
|
className: "rs-deposit-notification-close",
|
|
1247
1353
|
onClick: () => onDismiss(deposit.id),
|
|
1248
1354
|
"aria-label": "Dismiss",
|
|
1249
|
-
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1355
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkRABZINV3cjs.CloseIcon, {})
|
|
1250
1356
|
}
|
|
1251
1357
|
)
|
|
1252
1358
|
] }),
|
|
@@ -1262,7 +1368,7 @@ function DepositNotification({
|
|
|
1262
1368
|
"aria-expanded": expanded,
|
|
1263
1369
|
children: [
|
|
1264
1370
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: expanded ? "See less details" : "See more details" }),
|
|
1265
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1371
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkRABZINV3cjs.ChevronDownIcon, { className: "rs-deposit-notification-toggle-chevron" })
|
|
1266
1372
|
]
|
|
1267
1373
|
}
|
|
1268
1374
|
),
|
|
@@ -1316,7 +1422,7 @@ function DepositNotification({
|
|
|
1316
1422
|
// src/components/steps/DepositAddressStep.tsx
|
|
1317
1423
|
|
|
1318
1424
|
var QRCode = _react.lazy.call(void 0,
|
|
1319
|
-
() => Promise.resolve().then(() => _interopRequireWildcard(require("./QRCode-
|
|
1425
|
+
() => Promise.resolve().then(() => _interopRequireWildcard(require("./QRCode-5DXFNKI2.cjs"))).then((m) => ({ default: m.QRCode }))
|
|
1320
1426
|
);
|
|
1321
1427
|
var POLL_INTERVAL_MS = 4e3;
|
|
1322
1428
|
function isRecord(value) {
|
|
@@ -1351,7 +1457,7 @@ function asString(value) {
|
|
|
1351
1457
|
function resolveSolanaTokenMeta(token) {
|
|
1352
1458
|
if (!token) return {};
|
|
1353
1459
|
const normalized = token.toLowerCase();
|
|
1354
|
-
const matched =
|
|
1460
|
+
const matched = _chunkMILJQWPTcjs.SOLANA_TOKENS.find(
|
|
1355
1461
|
(entry) => entry.mint.toLowerCase() === normalized
|
|
1356
1462
|
);
|
|
1357
1463
|
if (matched) {
|
|
@@ -1363,7 +1469,7 @@ function resolveSolanaTokenMeta(token) {
|
|
|
1363
1469
|
return {};
|
|
1364
1470
|
}
|
|
1365
1471
|
function getDepositEventDetails(event) {
|
|
1366
|
-
if (!_optionalChain([event, 'optionalAccess',
|
|
1472
|
+
if (!_optionalChain([event, 'optionalAccess', _48 => _48.type]) || !isRecord(event.data)) return {};
|
|
1367
1473
|
if (event.type === "deposit-received") {
|
|
1368
1474
|
const chainId = asChainId(event.data.chain);
|
|
1369
1475
|
const token = asString(event.data.token);
|
|
@@ -1375,14 +1481,15 @@ function getDepositEventDetails(event) {
|
|
|
1375
1481
|
...solanaMeta
|
|
1376
1482
|
};
|
|
1377
1483
|
}
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
const
|
|
1484
|
+
const source = isRecord(event.data.source) ? event.data.source : void 0;
|
|
1485
|
+
const deposit = isRecord(event.data.deposit) ? event.data.deposit : void 0;
|
|
1486
|
+
if (source || deposit) {
|
|
1487
|
+
const chainId = _nullishCoalesce(asChainId(_optionalChain([source, 'optionalAccess', _49 => _49.chain])), () => ( asChainId(_optionalChain([deposit, 'optionalAccess', _50 => _50.chain]))));
|
|
1488
|
+
const token = _nullishCoalesce(_nullishCoalesce(asString(_optionalChain([source, 'optionalAccess', _51 => _51.asset])), () => ( asString(_optionalChain([deposit, 'optionalAccess', _52 => _52.asset])))), () => ( asString(_optionalChain([deposit, 'optionalAccess', _53 => _53.token]))));
|
|
1382
1489
|
const solanaMeta = chainId === "solana" ? resolveSolanaTokenMeta(token) : {};
|
|
1383
1490
|
return {
|
|
1384
1491
|
chainId,
|
|
1385
|
-
amount: asAmount(_optionalChain([source, 'optionalAccess',
|
|
1492
|
+
amount: _nullishCoalesce(asAmount(_optionalChain([source, 'optionalAccess', _54 => _54.amount])), () => ( asAmount(_optionalChain([deposit, 'optionalAccess', _55 => _55.amount])))),
|
|
1386
1493
|
token,
|
|
1387
1494
|
...solanaMeta
|
|
1388
1495
|
};
|
|
@@ -1392,15 +1499,22 @@ function getDepositEventDetails(event) {
|
|
|
1392
1499
|
function isSameRoute(sourceChain, sourceToken, targetChain, targetToken) {
|
|
1393
1500
|
return sourceChain === targetChain && sourceToken.toLowerCase() === targetToken.toLowerCase();
|
|
1394
1501
|
}
|
|
1502
|
+
function computeTokensForChain(chainId, allowedTokenSet) {
|
|
1503
|
+
const all = chainId === "solana" ? _chunkMILJQWPTcjs.SOLANA_TOKENS.map((t) => t.symbol) : _chunkMILJQWPTcjs.getTargetTokenSymbolsForChain.call(void 0, chainId);
|
|
1504
|
+
return allowedTokenSet ? all.filter((s) => allowedTokenSet.has(s.toUpperCase())) : all;
|
|
1505
|
+
}
|
|
1506
|
+
function pickFallbackToken(tokens, current) {
|
|
1507
|
+
if (tokens.includes(current)) return current;
|
|
1508
|
+
if (tokens.includes("USDC")) return "USDC";
|
|
1509
|
+
return _nullishCoalesce(tokens[0], () => ( "USDC"));
|
|
1510
|
+
}
|
|
1395
1511
|
function DepositAddressStep({
|
|
1396
1512
|
smartAccount,
|
|
1397
1513
|
solanaDepositAddress,
|
|
1398
|
-
isUpdating = false,
|
|
1399
1514
|
service,
|
|
1400
1515
|
allowedRoutes,
|
|
1401
1516
|
targetChain,
|
|
1402
1517
|
targetToken,
|
|
1403
|
-
waitForFinalTx,
|
|
1404
1518
|
hasPostBridgeActions,
|
|
1405
1519
|
uiConfig,
|
|
1406
1520
|
onDepositSubmitted,
|
|
@@ -1411,15 +1525,15 @@ function DepositAddressStep({
|
|
|
1411
1525
|
}) {
|
|
1412
1526
|
const hasSolana = Boolean(solanaDepositAddress);
|
|
1413
1527
|
const allowedChainSet = _react.useMemo.call(void 0,
|
|
1414
|
-
() => _optionalChain([allowedRoutes, 'optionalAccess',
|
|
1415
|
-
[_optionalChain([allowedRoutes, 'optionalAccess',
|
|
1528
|
+
() => _optionalChain([allowedRoutes, 'optionalAccess', _56 => _56.sourceChains]) ? new Set(allowedRoutes.sourceChains) : null,
|
|
1529
|
+
[_optionalChain([allowedRoutes, 'optionalAccess', _57 => _57.sourceChains])]
|
|
1416
1530
|
);
|
|
1417
1531
|
const allowedTokenSet = _react.useMemo.call(void 0,
|
|
1418
|
-
() => _optionalChain([allowedRoutes, 'optionalAccess',
|
|
1419
|
-
[_optionalChain([allowedRoutes, 'optionalAccess',
|
|
1532
|
+
() => _optionalChain([allowedRoutes, 'optionalAccess', _58 => _58.sourceTokens]) ? new Set(allowedRoutes.sourceTokens.map((s) => s.toUpperCase())) : null,
|
|
1533
|
+
[_optionalChain([allowedRoutes, 'optionalAccess', _59 => _59.sourceTokens])]
|
|
1420
1534
|
);
|
|
1421
1535
|
const evmChainIds = _react.useMemo.call(void 0, () => {
|
|
1422
|
-
const all =
|
|
1536
|
+
const all = _chunkMILJQWPTcjs.getSupportedChainIds.call(void 0, );
|
|
1423
1537
|
return allowedChainSet ? all.filter((id) => allowedChainSet.has(id)) : all;
|
|
1424
1538
|
}, [allowedChainSet]);
|
|
1425
1539
|
const chainOptions = _react.useMemo.call(void 0, () => {
|
|
@@ -1428,22 +1542,16 @@ function DepositAddressStep({
|
|
|
1428
1542
|
options.splice(1, 0, "solana");
|
|
1429
1543
|
return options;
|
|
1430
1544
|
}, [evmChainIds, hasSolana]);
|
|
1431
|
-
const
|
|
1432
|
-
const defaultChainId = evmChainIds.includes(
|
|
1545
|
+
const BASE_CHAIN_ID2 = 8453;
|
|
1546
|
+
const defaultChainId = evmChainIds.includes(BASE_CHAIN_ID2) ? BASE_CHAIN_ID2 : evmChainIds[0];
|
|
1433
1547
|
const [sourceChainId, setSourceChainId] = _react.useState.call(void 0, defaultChainId);
|
|
1434
1548
|
const isSolana = sourceChainId === "solana";
|
|
1435
|
-
const tokensForChain = _react.useMemo.call(void 0,
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
const defaultToken =
|
|
1549
|
+
const tokensForChain = _react.useMemo.call(void 0,
|
|
1550
|
+
() => computeTokensForChain(sourceChainId, allowedTokenSet),
|
|
1551
|
+
[sourceChainId, allowedTokenSet]
|
|
1552
|
+
);
|
|
1553
|
+
const defaultToken = pickFallbackToken(tokensForChain, "USDC");
|
|
1440
1554
|
const [sourceTokenSymbol, setSourceTokenSymbol] = _react.useState.call(void 0, defaultToken);
|
|
1441
|
-
_react.useEffect.call(void 0, () => {
|
|
1442
|
-
if (!tokensForChain.includes(sourceTokenSymbol)) {
|
|
1443
|
-
const fallback = tokensForChain.includes("USDC") ? "USDC" : _nullishCoalesce(tokensForChain[0], () => ( "USDC"));
|
|
1444
|
-
setSourceTokenSymbol(fallback);
|
|
1445
|
-
}
|
|
1446
|
-
}, [tokensForChain, sourceTokenSymbol]);
|
|
1447
1555
|
const [copied, setCopied] = _react.useState.call(void 0, false);
|
|
1448
1556
|
const [pollingError, setPollingError] = _react.useState.call(void 0, null);
|
|
1449
1557
|
const [chainDropdownOpen, setChainDropdownOpen] = _react.useState.call(void 0, false);
|
|
@@ -1455,28 +1563,6 @@ function DepositAddressStep({
|
|
|
1455
1563
|
const isTrackingRef = _react.useRef.call(void 0, false);
|
|
1456
1564
|
const baselineTxHashRef = _react.useRef.call(void 0, void 0);
|
|
1457
1565
|
const notificationIdRef = _react.useRef.call(void 0, 0);
|
|
1458
|
-
const sourceSelectionRef = _react.useRef.call(void 0, {
|
|
1459
|
-
chainId: defaultChainId,
|
|
1460
|
-
token: typeof defaultChainId === "number" ? _chunk7JIDIX27cjs.getTokenAddress.call(void 0, defaultToken, defaultChainId) : void 0,
|
|
1461
|
-
sourceSymbol: defaultToken
|
|
1462
|
-
});
|
|
1463
|
-
_react.useEffect.call(void 0, () => {
|
|
1464
|
-
if (isSolana) {
|
|
1465
|
-
const matched = _nullishCoalesce(_chunk7JIDIX27cjs.SOLANA_TOKENS.find((t) => t.symbol === sourceTokenSymbol), () => ( _chunk7JIDIX27cjs.SOLANA_TOKENS[0]));
|
|
1466
|
-
sourceSelectionRef.current = {
|
|
1467
|
-
chainId: "solana",
|
|
1468
|
-
token: _optionalChain([matched, 'optionalAccess', _55 => _55.mint]),
|
|
1469
|
-
sourceSymbol: _optionalChain([matched, 'optionalAccess', _56 => _56.symbol]),
|
|
1470
|
-
sourceDecimals: _optionalChain([matched, 'optionalAccess', _57 => _57.decimals])
|
|
1471
|
-
};
|
|
1472
|
-
return;
|
|
1473
|
-
}
|
|
1474
|
-
sourceSelectionRef.current = {
|
|
1475
|
-
chainId: sourceChainId,
|
|
1476
|
-
token: _chunk7JIDIX27cjs.getTokenAddress.call(void 0, sourceTokenSymbol, sourceChainId),
|
|
1477
|
-
sourceSymbol: sourceTokenSymbol
|
|
1478
|
-
};
|
|
1479
|
-
}, [sourceChainId, sourceTokenSymbol, isSolana]);
|
|
1480
1566
|
const [liquidityHelper, setLiquidityHelper] = _react.useState.call(void 0, {
|
|
1481
1567
|
kind: "idle"
|
|
1482
1568
|
});
|
|
@@ -1485,7 +1571,7 @@ function DepositAddressStep({
|
|
|
1485
1571
|
setLiquidityHelper({ kind: "idle" });
|
|
1486
1572
|
return;
|
|
1487
1573
|
}
|
|
1488
|
-
const sourceTokenAddress =
|
|
1574
|
+
const sourceTokenAddress = _chunkMILJQWPTcjs.getTokenAddress.call(void 0,
|
|
1489
1575
|
sourceTokenSymbol,
|
|
1490
1576
|
sourceChainId
|
|
1491
1577
|
);
|
|
@@ -1536,27 +1622,26 @@ function DepositAddressStep({
|
|
|
1536
1622
|
function handlePointerDown(event) {
|
|
1537
1623
|
const target = event.target;
|
|
1538
1624
|
if (!target) return;
|
|
1539
|
-
const clickedChainDropdown = _optionalChain([chainDropdownRef, 'access',
|
|
1540
|
-
const clickedTokenDropdown = _optionalChain([tokenDropdownRef, 'access',
|
|
1625
|
+
const clickedChainDropdown = _optionalChain([chainDropdownRef, 'access', _60 => _60.current, 'optionalAccess', _61 => _61.contains, 'call', _62 => _62(target)]);
|
|
1626
|
+
const clickedTokenDropdown = _optionalChain([tokenDropdownRef, 'access', _63 => _63.current, 'optionalAccess', _64 => _64.contains, 'call', _65 => _65(target)]);
|
|
1541
1627
|
if (clickedChainDropdown || clickedTokenDropdown) return;
|
|
1542
1628
|
setChainDropdownOpen(false);
|
|
1543
1629
|
setTokenDropdownOpen(false);
|
|
1544
1630
|
}
|
|
1545
1631
|
document.addEventListener("mousedown", handlePointerDown);
|
|
1546
|
-
document.addEventListener("touchstart", handlePointerDown);
|
|
1632
|
+
document.addEventListener("touchstart", handlePointerDown, { passive: true });
|
|
1547
1633
|
return () => {
|
|
1548
1634
|
document.removeEventListener("mousedown", handlePointerDown);
|
|
1549
1635
|
document.removeEventListener("touchstart", handlePointerDown);
|
|
1550
1636
|
};
|
|
1551
1637
|
}, [chainDropdownOpen, tokenDropdownOpen]);
|
|
1552
1638
|
const handleCopy = _react.useCallback.call(void 0, async () => {
|
|
1553
|
-
|
|
1554
|
-
_optionalChain([onCopyAddress, 'optionalCall', _64 => _64()]);
|
|
1639
|
+
_optionalChain([onCopyAddress, 'optionalCall', _66 => _66()]);
|
|
1555
1640
|
try {
|
|
1556
1641
|
await navigator.clipboard.writeText(displayAddress);
|
|
1557
1642
|
setCopied(true);
|
|
1558
1643
|
setTimeout(() => setCopied(false), 2e3);
|
|
1559
|
-
} catch (
|
|
1644
|
+
} catch (e15) {
|
|
1560
1645
|
const textarea = document.createElement("textarea");
|
|
1561
1646
|
textarea.value = displayAddress;
|
|
1562
1647
|
textarea.style.position = "fixed";
|
|
@@ -1568,12 +1653,18 @@ function DepositAddressStep({
|
|
|
1568
1653
|
setCopied(true);
|
|
1569
1654
|
setTimeout(() => setCopied(false), 2e3);
|
|
1570
1655
|
}
|
|
1571
|
-
}, [displayAddress, onCopyAddress
|
|
1572
|
-
_react.
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1656
|
+
}, [displayAddress, onCopyAddress]);
|
|
1657
|
+
const handleSelectChain = _react.useCallback.call(void 0,
|
|
1658
|
+
(nextChain) => {
|
|
1659
|
+
const nextTokens = computeTokensForChain(nextChain, allowedTokenSet);
|
|
1660
|
+
setSourceChainId(nextChain);
|
|
1661
|
+
setSourceTokenSymbol(pickFallbackToken(nextTokens, sourceTokenSymbol));
|
|
1662
|
+
setChainDropdownOpen(false);
|
|
1663
|
+
setTokenDropdownOpen(false);
|
|
1664
|
+
setCopied(false);
|
|
1665
|
+
},
|
|
1666
|
+
[allowedTokenSet, sourceTokenSymbol]
|
|
1667
|
+
);
|
|
1577
1668
|
const onDepositSubmittedRef = _react.useRef.call(void 0, onDepositSubmitted);
|
|
1578
1669
|
onDepositSubmittedRef.current = onDepositSubmitted;
|
|
1579
1670
|
const onDepositCompleteRef = _react.useRef.call(void 0, onDepositComplete);
|
|
@@ -1589,7 +1680,6 @@ function DepositAddressStep({
|
|
|
1589
1680
|
_react.useEffect.call(void 0, () => {
|
|
1590
1681
|
baselineTxHashRef.current = void 0;
|
|
1591
1682
|
isTrackingRef.current = false;
|
|
1592
|
-
setPollingError(null);
|
|
1593
1683
|
let timeoutId;
|
|
1594
1684
|
let cancelled = false;
|
|
1595
1685
|
async function poll() {
|
|
@@ -1625,19 +1715,22 @@ function DepositAddressStep({
|
|
|
1625
1715
|
return;
|
|
1626
1716
|
}
|
|
1627
1717
|
const event = status.lastEvent;
|
|
1628
|
-
const eventTxHash =
|
|
1718
|
+
const eventTxHash = _chunkRABZINV3cjs.isDepositEvent.call(void 0, event) ? _nullishCoalesce(_chunkRABZINV3cjs.getEventTxHash.call(void 0, event), () => ( null)) : null;
|
|
1629
1719
|
if (baselineTxHashRef.current === void 0) {
|
|
1630
1720
|
baselineTxHashRef.current = eventTxHash;
|
|
1631
|
-
} else if (eventTxHash && (!baselineTxHashRef.current || !
|
|
1721
|
+
} else if (eventTxHash && (!baselineTxHashRef.current || !_chunkRABZINV3cjs.txRefsMatch.call(void 0, eventTxHash, baselineTxHashRef.current))) {
|
|
1632
1722
|
const details = getDepositEventDetails(event);
|
|
1633
1723
|
const chainId = _nullishCoalesce(details.chainId, () => ( "unknown"));
|
|
1634
1724
|
const amount = _nullishCoalesce(details.amount, () => ( "0"));
|
|
1635
1725
|
const token = details.token;
|
|
1636
1726
|
const sourceSymbol = details.sourceSymbol;
|
|
1637
|
-
const sourceDecimals = details.sourceDecimals;
|
|
1638
1727
|
baselineTxHashRef.current = eventTxHash;
|
|
1639
1728
|
isTrackingRef.current = true;
|
|
1640
1729
|
const isEvmToken = token ? /^0x[a-fA-F0-9]{40}$/.test(token) : false;
|
|
1730
|
+
const sourceDecimals = _nullishCoalesce(details.sourceDecimals, () => ( (isEvmToken ? _chunkMILJQWPTcjs.findTokenDecimals.call(void 0,
|
|
1731
|
+
token,
|
|
1732
|
+
typeof chainId === "number" ? chainId : void 0
|
|
1733
|
+
) : void 0)));
|
|
1641
1734
|
const directTransfer = typeof chainId === "number" && isEvmToken && isSameRoute(
|
|
1642
1735
|
chainId,
|
|
1643
1736
|
token,
|
|
@@ -1657,10 +1750,11 @@ function DepositAddressStep({
|
|
|
1657
1750
|
directTransfer
|
|
1658
1751
|
};
|
|
1659
1752
|
setNotifications((prev) => [notification, ...prev]);
|
|
1660
|
-
_optionalChain([onDepositSubmittedRef, 'access',
|
|
1753
|
+
_optionalChain([onDepositSubmittedRef, 'access', _67 => _67.current, 'optionalCall', _68 => _68({
|
|
1661
1754
|
txHash: eventTxHash,
|
|
1662
1755
|
sourceChain: chainId,
|
|
1663
|
-
amount
|
|
1756
|
+
amount,
|
|
1757
|
+
sourceDecimals
|
|
1664
1758
|
})]);
|
|
1665
1759
|
}
|
|
1666
1760
|
setPollingError(null);
|
|
@@ -1668,7 +1762,7 @@ function DepositAddressStep({
|
|
|
1668
1762
|
if (!cancelled) {
|
|
1669
1763
|
const msg = err instanceof Error ? err.message : "Failed to check status";
|
|
1670
1764
|
setPollingError(msg);
|
|
1671
|
-
_optionalChain([onErrorRef, 'access',
|
|
1765
|
+
_optionalChain([onErrorRef, 'access', _69 => _69.current, 'optionalCall', _70 => _70(msg, "STATUS_POLL_ERROR")]);
|
|
1672
1766
|
}
|
|
1673
1767
|
}
|
|
1674
1768
|
if (!cancelled) {
|
|
@@ -1684,24 +1778,24 @@ function DepositAddressStep({
|
|
|
1684
1778
|
const handleNotificationComplete = _react.useCallback.call(void 0,
|
|
1685
1779
|
(txHash, destinationTxHash, context) => {
|
|
1686
1780
|
isTrackingRef.current = false;
|
|
1687
|
-
_optionalChain([onDepositCompleteRef, 'access',
|
|
1781
|
+
_optionalChain([onDepositCompleteRef, 'access', _71 => _71.current, 'optionalCall', _72 => _72(txHash, destinationTxHash, context)]);
|
|
1688
1782
|
},
|
|
1689
1783
|
[]
|
|
1690
1784
|
);
|
|
1691
1785
|
const handleNotificationFailed = _react.useCallback.call(void 0,
|
|
1692
1786
|
(txHash, error) => {
|
|
1693
1787
|
isTrackingRef.current = false;
|
|
1694
|
-
_optionalChain([onDepositFailedRef, 'access',
|
|
1788
|
+
_optionalChain([onDepositFailedRef, 'access', _73 => _73.current, 'optionalCall', _74 => _74(txHash, error)]);
|
|
1695
1789
|
},
|
|
1696
1790
|
[]
|
|
1697
1791
|
);
|
|
1698
1792
|
const handleNotificationDismiss = _react.useCallback.call(void 0, (id) => {
|
|
1699
1793
|
setNotifications((prev) => prev.filter((n) => n.id !== id));
|
|
1700
1794
|
}, []);
|
|
1701
|
-
const qrIconSrc =
|
|
1795
|
+
const qrIconSrc = _chunkMILJQWPTcjs.getChainIcon.call(void 0, sourceChainId);
|
|
1702
1796
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-screen rs-step--with-notifications", children: [
|
|
1703
1797
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-screen-body", children: [
|
|
1704
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1798
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkRABZINV3cjs.BodyHeader, { icon: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkRABZINV3cjs.TransferCryptoIcon, {}), title: "Transfer crypto" }),
|
|
1705
1799
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-deposit-address-selectors", children: [
|
|
1706
1800
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-deposit-address-dropdown", ref: chainDropdownRef, children: [
|
|
1707
1801
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-deposit-address-dropdown-label", children: "Supported chain" }),
|
|
@@ -1716,16 +1810,16 @@ function DepositAddressStep({
|
|
|
1716
1810
|
setTokenDropdownOpen(false);
|
|
1717
1811
|
},
|
|
1718
1812
|
children: [
|
|
1719
|
-
|
|
1813
|
+
_chunkMILJQWPTcjs.getChainIcon.call(void 0, sourceChainId) && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1720
1814
|
"img",
|
|
1721
1815
|
{
|
|
1722
|
-
src:
|
|
1816
|
+
src: _chunkMILJQWPTcjs.getChainIcon.call(void 0, sourceChainId),
|
|
1723
1817
|
alt: "",
|
|
1724
1818
|
className: "rs-deposit-address-dropdown-icon"
|
|
1725
1819
|
}
|
|
1726
1820
|
),
|
|
1727
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children:
|
|
1728
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1821
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: _chunkMILJQWPTcjs.getChainName.call(void 0, sourceChainId) }),
|
|
1822
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkRABZINV3cjs.ChevronDownIcon, { className: "rs-deposit-address-dropdown-chevron" })
|
|
1729
1823
|
]
|
|
1730
1824
|
}
|
|
1731
1825
|
),
|
|
@@ -1734,20 +1828,17 @@ function DepositAddressStep({
|
|
|
1734
1828
|
{
|
|
1735
1829
|
type: "button",
|
|
1736
1830
|
className: `rs-deposit-address-dropdown-item ${chainId === sourceChainId ? "rs-deposit-address-dropdown-item--active" : ""}`,
|
|
1737
|
-
onClick: () =>
|
|
1738
|
-
setSourceChainId(chainId);
|
|
1739
|
-
setChainDropdownOpen(false);
|
|
1740
|
-
},
|
|
1831
|
+
onClick: () => handleSelectChain(chainId),
|
|
1741
1832
|
children: [
|
|
1742
|
-
|
|
1833
|
+
_chunkMILJQWPTcjs.getChainIcon.call(void 0, chainId) && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1743
1834
|
"img",
|
|
1744
1835
|
{
|
|
1745
|
-
src:
|
|
1836
|
+
src: _chunkMILJQWPTcjs.getChainIcon.call(void 0, chainId),
|
|
1746
1837
|
alt: "",
|
|
1747
1838
|
className: "rs-deposit-address-dropdown-icon"
|
|
1748
1839
|
}
|
|
1749
1840
|
),
|
|
1750
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children:
|
|
1841
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: _chunkMILJQWPTcjs.getChainName.call(void 0, chainId) })
|
|
1751
1842
|
]
|
|
1752
1843
|
},
|
|
1753
1844
|
String(chainId)
|
|
@@ -1758,9 +1849,9 @@ function DepositAddressStep({
|
|
|
1758
1849
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: "Supported token" }),
|
|
1759
1850
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "rs-deposit-address-min", children: [
|
|
1760
1851
|
"Min.$",
|
|
1761
|
-
(_nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess',
|
|
1762
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1763
|
-
|
|
1852
|
+
(targetChain === _chunkMILJQWPTcjs.HYPERCORE_CHAIN_ID ? Math.max(_chunkMILJQWPTcjs.HYPERCORE_MIN_DEPOSIT_USD, _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess', _75 => _75.minDepositUsd]), () => ( 0))) : _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess', _76 => _76.minDepositUsd]), () => ( 0.1))).toFixed(2),
|
|
1853
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkRABZINV3cjs.Tooltip, { content: "Minimum deposit amount required for the selected chain.", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1854
|
+
_chunkRABZINV3cjs.InfoIcon,
|
|
1764
1855
|
{
|
|
1765
1856
|
className: "rs-deposit-address-min-icon",
|
|
1766
1857
|
"aria-hidden": "true"
|
|
@@ -1779,16 +1870,16 @@ function DepositAddressStep({
|
|
|
1779
1870
|
setChainDropdownOpen(false);
|
|
1780
1871
|
},
|
|
1781
1872
|
children: [
|
|
1782
|
-
|
|
1873
|
+
_chunkMILJQWPTcjs.getTokenIcon.call(void 0, sourceTokenSymbol) && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1783
1874
|
"img",
|
|
1784
1875
|
{
|
|
1785
|
-
src:
|
|
1876
|
+
src: _chunkMILJQWPTcjs.getTokenIcon.call(void 0, sourceTokenSymbol),
|
|
1786
1877
|
alt: "",
|
|
1787
1878
|
className: "rs-deposit-address-dropdown-icon"
|
|
1788
1879
|
}
|
|
1789
1880
|
),
|
|
1790
1881
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: sourceTokenSymbol }),
|
|
1791
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1882
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkRABZINV3cjs.ChevronDownIcon, { className: "rs-deposit-address-dropdown-chevron" })
|
|
1792
1883
|
]
|
|
1793
1884
|
}
|
|
1794
1885
|
),
|
|
@@ -1802,10 +1893,10 @@ function DepositAddressStep({
|
|
|
1802
1893
|
setTokenDropdownOpen(false);
|
|
1803
1894
|
},
|
|
1804
1895
|
children: [
|
|
1805
|
-
|
|
1896
|
+
_chunkMILJQWPTcjs.getTokenIcon.call(void 0, symbol) && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1806
1897
|
"img",
|
|
1807
1898
|
{
|
|
1808
|
-
src:
|
|
1899
|
+
src: _chunkMILJQWPTcjs.getTokenIcon.call(void 0, symbol),
|
|
1809
1900
|
alt: "",
|
|
1810
1901
|
className: "rs-deposit-address-dropdown-icon"
|
|
1811
1902
|
}
|
|
@@ -1822,148 +1913,914 @@ function DepositAddressStep({
|
|
|
1822
1913
|
{
|
|
1823
1914
|
style: { display: "flex", flexDirection: "column", gap: 4, width: "100%" },
|
|
1824
1915
|
children: [
|
|
1916
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-deposit-address-well", children: [
|
|
1917
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-deposit-address-qr", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1918
|
+
_react.Suspense,
|
|
1919
|
+
{
|
|
1920
|
+
fallback: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-skeleton rs-skeleton-qr", "aria-hidden": "true" }),
|
|
1921
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, QRCode, { value: displayAddress, size: 190, iconSrc: qrIconSrc })
|
|
1922
|
+
}
|
|
1923
|
+
) }),
|
|
1924
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-deposit-address-value", children: displayAddress })
|
|
1925
|
+
] }),
|
|
1926
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1927
|
+
"button",
|
|
1928
|
+
{
|
|
1929
|
+
type: "button",
|
|
1930
|
+
className: "rs-deposit-address-copy",
|
|
1931
|
+
onClick: handleCopy,
|
|
1932
|
+
children: [
|
|
1933
|
+
copied ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkRABZINV3cjs.CheckIcon, {}) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkRABZINV3cjs.CopyIcon, {}),
|
|
1934
|
+
copied ? "Copied!" : "Copy address"
|
|
1935
|
+
]
|
|
1936
|
+
}
|
|
1937
|
+
)
|
|
1938
|
+
]
|
|
1939
|
+
}
|
|
1940
|
+
),
|
|
1941
|
+
targetChain === _chunkMILJQWPTcjs.HYPERCORE_CHAIN_ID && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkRABZINV3cjs.Callout, { variant: "warning", children: "HyperCore's first deposit to a new account includes a ~1 USDC activation fee \u2014 send at least 1 USDC or it will fail." }),
|
|
1942
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1943
|
+
"div",
|
|
1944
|
+
{
|
|
1945
|
+
className: `rs-price-impact ${priceImpactExpanded ? "rs-price-impact--open" : ""}`,
|
|
1946
|
+
children: [
|
|
1947
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1948
|
+
"button",
|
|
1949
|
+
{
|
|
1950
|
+
type: "button",
|
|
1951
|
+
className: "rs-price-impact-header",
|
|
1952
|
+
onClick: () => setPriceImpactExpanded((v) => !v),
|
|
1953
|
+
"aria-expanded": priceImpactExpanded,
|
|
1954
|
+
children: [
|
|
1955
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "rs-price-impact-header-left", children: [
|
|
1956
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-price-impact-label", children: "Price impact" }),
|
|
1957
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-price-impact-label", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "strong", { children: "0.00%" }) }),
|
|
1958
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1959
|
+
_chunkRABZINV3cjs.Tooltip,
|
|
1960
|
+
{
|
|
1961
|
+
className: "rs-price-impact-info",
|
|
1962
|
+
content: "Price impact is the difference between expected and execution price, due to trade size and liquidity.",
|
|
1963
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkRABZINV3cjs.InfoIcon, { "aria-hidden": "true" })
|
|
1964
|
+
}
|
|
1965
|
+
)
|
|
1966
|
+
] }),
|
|
1967
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1968
|
+
_chunkRABZINV3cjs.ChevronDownIcon,
|
|
1969
|
+
{
|
|
1970
|
+
className: "rs-price-impact-chevron",
|
|
1971
|
+
"aria-hidden": "true"
|
|
1972
|
+
}
|
|
1973
|
+
)
|
|
1974
|
+
]
|
|
1975
|
+
}
|
|
1976
|
+
),
|
|
1977
|
+
/* @__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: [
|
|
1978
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-price-impact-row", children: [
|
|
1979
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-price-impact-row-icon", "aria-hidden": "true", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkRABZINV3cjs.PercentIcon, {}) }),
|
|
1980
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "rs-price-impact-label", children: [
|
|
1981
|
+
"Max slippage: ",
|
|
1982
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "strong", { children: "0.2%" })
|
|
1983
|
+
] }),
|
|
1984
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1985
|
+
_chunkRABZINV3cjs.Tooltip,
|
|
1986
|
+
{
|
|
1987
|
+
className: "rs-price-impact-info",
|
|
1988
|
+
content: "Slippage accounts for price changes during execution. Slippage is adjusted per pair to ensure reliable execution.",
|
|
1989
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkRABZINV3cjs.InfoIcon, { "aria-hidden": "true" })
|
|
1990
|
+
}
|
|
1991
|
+
)
|
|
1992
|
+
] }),
|
|
1993
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-price-impact-row", children: [
|
|
1994
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-price-impact-row-icon", "aria-hidden": "true", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkRABZINV3cjs.ClockIcon, {}) }),
|
|
1995
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "rs-price-impact-label", children: [
|
|
1996
|
+
"Processing time: ",
|
|
1997
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "strong", { children: "< 1 min" })
|
|
1998
|
+
] })
|
|
1999
|
+
] }),
|
|
2000
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-price-impact-row", children: [
|
|
2001
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-price-impact-row-icon", "aria-hidden": "true", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkRABZINV3cjs.PlusCircleIcon, {}) }),
|
|
2002
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "rs-price-impact-label", children: [
|
|
2003
|
+
"Max deposit:",
|
|
2004
|
+
" ",
|
|
2005
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "strong", { children: liquidityHelper.kind === "max" ? `${_viem.formatUnits.call(void 0,
|
|
2006
|
+
BigInt(liquidityHelper.maxAmount),
|
|
2007
|
+
liquidityHelper.decimals
|
|
2008
|
+
)} ${liquidityHelper.symbol}` : liquidityHelper.kind === "unlimited" ? "Unlimited" : liquidityHelper.kind === "unavailable" ? "Unavailable" : liquidityHelper.kind === "error" ? "\u2014" : "\u2026" })
|
|
2009
|
+
] })
|
|
2010
|
+
] })
|
|
2011
|
+
] }) })
|
|
2012
|
+
]
|
|
2013
|
+
}
|
|
2014
|
+
),
|
|
2015
|
+
pollingError && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-deposit-address-error", children: pollingError })
|
|
2016
|
+
] }),
|
|
2017
|
+
notifications.length > 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-deposit-notifications", children: notifications.map((deposit) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2018
|
+
DepositNotification,
|
|
2019
|
+
{
|
|
2020
|
+
deposit,
|
|
2021
|
+
smartAccount,
|
|
2022
|
+
solanaDepositAddress,
|
|
2023
|
+
targetChain,
|
|
2024
|
+
targetToken,
|
|
2025
|
+
hasPostBridgeActions,
|
|
2026
|
+
service,
|
|
2027
|
+
onComplete: handleNotificationComplete,
|
|
2028
|
+
onFailed: handleNotificationFailed,
|
|
2029
|
+
onDismiss: handleNotificationDismiss
|
|
2030
|
+
},
|
|
2031
|
+
deposit.id
|
|
2032
|
+
)) }),
|
|
2033
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkRABZINV3cjs.PoweredBy, {})
|
|
2034
|
+
] });
|
|
2035
|
+
}
|
|
2036
|
+
DepositAddressStep.displayName = "DepositAddressStep";
|
|
2037
|
+
|
|
2038
|
+
// src/components/steps/FiatOnrampStep.tsx
|
|
2039
|
+
|
|
2040
|
+
|
|
2041
|
+
// src/components/steps/SwappedIframeStep.tsx
|
|
2042
|
+
|
|
2043
|
+
|
|
2044
|
+
// src/components/steps/SwappedOrderTracker.tsx
|
|
2045
|
+
|
|
2046
|
+
var STEP_LABELS = [
|
|
2047
|
+
"Payment received",
|
|
2048
|
+
null,
|
|
2049
|
+
"Processing App deposit",
|
|
2050
|
+
"Deposit successful"
|
|
2051
|
+
];
|
|
2052
|
+
function SwappedOrderTracker({
|
|
2053
|
+
amount,
|
|
2054
|
+
currency = "USDC",
|
|
2055
|
+
chainLabel = "Base",
|
|
2056
|
+
stepStates,
|
|
2057
|
+
terminal = null,
|
|
2058
|
+
onRetry
|
|
2059
|
+
}) {
|
|
2060
|
+
const formattedAmount = formatTrackerAmount(amount);
|
|
2061
|
+
const title = terminal ? terminal.kind === "cancelled" ? "Order cancelled" : "Deposit failed" : formattedAmount ? `Depositing ${formattedAmount} ${currency}` : `Depositing ${currency}`;
|
|
2062
|
+
const labels = [
|
|
2063
|
+
STEP_LABELS[0],
|
|
2064
|
+
`${currency} received on ${chainLabel}`,
|
|
2065
|
+
STEP_LABELS[2],
|
|
2066
|
+
STEP_LABELS[3]
|
|
2067
|
+
];
|
|
2068
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-screen rs-swapped-tracker", children: [
|
|
2069
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-screen-body rs-screen-body--gap-32", children: [
|
|
2070
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkRABZINV3cjs.BodyHeader, { icon: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkRABZINV3cjs.HandCoinsIcon, {}), title }),
|
|
2071
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "ol", { className: "rs-swapped-tracker-steps", children: labels.map((label, idx) => {
|
|
2072
|
+
const status = stepStates[idx];
|
|
2073
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2074
|
+
"li",
|
|
2075
|
+
{
|
|
2076
|
+
className: `rs-swapped-tracker-step rs-swapped-tracker-step--${status}`,
|
|
2077
|
+
children: [
|
|
2078
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-swapped-tracker-step-label", children: label }),
|
|
2079
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2080
|
+
"span",
|
|
2081
|
+
{
|
|
2082
|
+
className: "rs-swapped-tracker-step-marker",
|
|
2083
|
+
"aria-hidden": "true",
|
|
2084
|
+
children: status === "complete" ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkRABZINV3cjs.CheckIcon, {}) : status === "failed" ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkRABZINV3cjs.CloseIcon, {}) : status === "active" ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkRABZINV3cjs.Spinner, {}) : null
|
|
2085
|
+
}
|
|
2086
|
+
)
|
|
2087
|
+
]
|
|
2088
|
+
},
|
|
2089
|
+
label
|
|
2090
|
+
);
|
|
2091
|
+
}) }),
|
|
2092
|
+
terminal && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2093
|
+
"div",
|
|
2094
|
+
{
|
|
2095
|
+
className: `rs-swapped-tracker-terminal rs-swapped-tracker-terminal--${terminal.kind}`,
|
|
2096
|
+
children: [
|
|
2097
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "rs-swapped-tracker-terminal-message", children: terminal.message }),
|
|
2098
|
+
terminal.kind === "cancelled" && onRetry && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2099
|
+
"button",
|
|
2100
|
+
{
|
|
2101
|
+
type: "button",
|
|
2102
|
+
className: "rs-swapped-tracker-retry",
|
|
2103
|
+
onClick: onRetry,
|
|
2104
|
+
children: "Try again"
|
|
2105
|
+
}
|
|
2106
|
+
)
|
|
2107
|
+
]
|
|
2108
|
+
}
|
|
2109
|
+
)
|
|
2110
|
+
] }),
|
|
2111
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkRABZINV3cjs.PoweredBy, {})
|
|
2112
|
+
] });
|
|
2113
|
+
}
|
|
2114
|
+
function formatTrackerAmount(amount) {
|
|
2115
|
+
if (!amount) return null;
|
|
2116
|
+
const num = Number(amount);
|
|
2117
|
+
if (!Number.isFinite(num)) return amount;
|
|
2118
|
+
return num.toFixed(2);
|
|
2119
|
+
}
|
|
2120
|
+
SwappedOrderTracker.displayName = "SwappedOrderTracker";
|
|
2121
|
+
|
|
2122
|
+
// src/components/steps/SwappedIframeStep.tsx
|
|
2123
|
+
|
|
2124
|
+
var STATUS_POLL_INTERVAL_MS = 2e3;
|
|
2125
|
+
var DEPOSIT_POLL_INTERVAL_MS = 2e3;
|
|
2126
|
+
var DEPOSIT_POLL_FAST_INITIAL_DELAY_MS = 1e3;
|
|
2127
|
+
var DEPOSIT_POLL_FAST_INTERVAL_MS = 500;
|
|
2128
|
+
var IFRAME_LOAD_TIMEOUT_MS = 15e3;
|
|
2129
|
+
var SWAPPED_IFRAME_ORIGINS = /* @__PURE__ */ new Set([
|
|
2130
|
+
"https://sandbox.swapped.com",
|
|
2131
|
+
"https://widget.swapped.com"
|
|
2132
|
+
]);
|
|
2133
|
+
var SWAPPED_TERMINAL_STATUSES = /* @__PURE__ */ new Set([
|
|
2134
|
+
"order_completed",
|
|
2135
|
+
"order_broadcasted"
|
|
2136
|
+
]);
|
|
2137
|
+
var SWAPPED_STATUS_VALUES = /* @__PURE__ */ new Set([
|
|
2138
|
+
"payment_pending",
|
|
2139
|
+
"order_completed",
|
|
2140
|
+
"order_broadcasted",
|
|
2141
|
+
"order_cancelled"
|
|
2142
|
+
]);
|
|
2143
|
+
function parseSwappedIframeMessage(raw) {
|
|
2144
|
+
let data = raw;
|
|
2145
|
+
if (typeof data === "string") {
|
|
2146
|
+
try {
|
|
2147
|
+
data = JSON.parse(data);
|
|
2148
|
+
} catch (e16) {
|
|
2149
|
+
return null;
|
|
2150
|
+
}
|
|
2151
|
+
}
|
|
2152
|
+
if (!data || typeof data !== "object") return null;
|
|
2153
|
+
const obj = data;
|
|
2154
|
+
const inner = obj.data && typeof obj.data === "object" ? obj.data : obj;
|
|
2155
|
+
const rawStatus = _nullishCoalesce(_nullishCoalesce(inner.order_status, () => ( inner.status)), () => ( obj.status));
|
|
2156
|
+
if (typeof rawStatus !== "string" || !SWAPPED_STATUS_VALUES.has(rawStatus)) {
|
|
2157
|
+
return null;
|
|
2158
|
+
}
|
|
2159
|
+
const asString2 = (v) => typeof v === "string" && v.length > 0 ? v : void 0;
|
|
2160
|
+
return {
|
|
2161
|
+
status: rawStatus,
|
|
2162
|
+
orderId: _nullishCoalesce(asString2(inner.order_id), () => ( asString2(obj.orderId))),
|
|
2163
|
+
orderCrypto: _nullishCoalesce(asString2(inner.order_crypto), () => ( asString2(obj.orderCrypto))),
|
|
2164
|
+
orderCryptoAmount: _nullishCoalesce(asString2(inner.order_crypto_amount), () => ( asString2(obj.orderCryptoAmount))),
|
|
2165
|
+
transactionId: _nullishCoalesce(asString2(inner.transaction_id), () => ( asString2(obj.transactionId)))
|
|
2166
|
+
};
|
|
2167
|
+
}
|
|
2168
|
+
function SwappedIframeStep({
|
|
2169
|
+
smartAccount,
|
|
2170
|
+
service,
|
|
2171
|
+
variant,
|
|
2172
|
+
loadUrl,
|
|
2173
|
+
iframeTitle,
|
|
2174
|
+
loadErrorCode,
|
|
2175
|
+
loadErrorFallback,
|
|
2176
|
+
bannerForStatus,
|
|
2177
|
+
onSwappedComplete,
|
|
2178
|
+
onSwappedFailed,
|
|
2179
|
+
onClose,
|
|
2180
|
+
onError
|
|
2181
|
+
}) {
|
|
2182
|
+
const [widgetUrl, setWidgetUrl] = _react.useState.call(void 0, null);
|
|
2183
|
+
const [loadError, setLoadError] = _react.useState.call(void 0, null);
|
|
2184
|
+
const [iframeLoaded, setIframeLoaded] = _react.useState.call(void 0, false);
|
|
2185
|
+
const [retryToken, setRetryToken] = _react.useState.call(void 0, 0);
|
|
2186
|
+
const [orderState, setOrderState] = _react.useState.call(void 0, null);
|
|
2187
|
+
const [latestEvent, setLatestEvent] = _react.useState.call(void 0, null);
|
|
2188
|
+
const [phase, setPhase] = _react.useState.call(void 0, "iframe");
|
|
2189
|
+
const completeFiredRef = _react.useRef.call(void 0, false);
|
|
2190
|
+
const failedFiredRef = _react.useRef.call(void 0, false);
|
|
2191
|
+
const expectedOrderUuidRef = _react.useRef.call(void 0, null);
|
|
2192
|
+
const baselineDepositTxHashRef = _react.useRef.call(void 0, void 0);
|
|
2193
|
+
const currentDepositTxHashRef = _react.useRef.call(void 0, null);
|
|
2194
|
+
const fastDepositPollEnabledRef = _react.useRef.call(void 0, false);
|
|
2195
|
+
const rescheduleDepositPollRef = _react.useRef.call(void 0,
|
|
2196
|
+
null
|
|
2197
|
+
);
|
|
2198
|
+
const onSwappedCompleteRef = _react.useRef.call(void 0, onSwappedComplete);
|
|
2199
|
+
onSwappedCompleteRef.current = onSwappedComplete;
|
|
2200
|
+
const onSwappedFailedRef = _react.useRef.call(void 0, onSwappedFailed);
|
|
2201
|
+
onSwappedFailedRef.current = onSwappedFailed;
|
|
2202
|
+
const onErrorRef = _react.useRef.call(void 0, onError);
|
|
2203
|
+
onErrorRef.current = onError;
|
|
2204
|
+
const loadUrlRef = _react.useRef.call(void 0, loadUrl);
|
|
2205
|
+
loadUrlRef.current = loadUrl;
|
|
2206
|
+
_react.useEffect.call(void 0, () => {
|
|
2207
|
+
let cancelled = false;
|
|
2208
|
+
setLoadError(null);
|
|
2209
|
+
setIframeLoaded(false);
|
|
2210
|
+
setWidgetUrl(null);
|
|
2211
|
+
setOrderState(null);
|
|
2212
|
+
setLatestEvent(null);
|
|
2213
|
+
setPhase("iframe");
|
|
2214
|
+
expectedOrderUuidRef.current = null;
|
|
2215
|
+
completeFiredRef.current = false;
|
|
2216
|
+
failedFiredRef.current = false;
|
|
2217
|
+
baselineDepositTxHashRef.current = void 0;
|
|
2218
|
+
currentDepositTxHashRef.current = null;
|
|
2219
|
+
fastDepositPollEnabledRef.current = false;
|
|
2220
|
+
loadUrlRef.current().then((res) => {
|
|
2221
|
+
if (cancelled) return;
|
|
2222
|
+
setWidgetUrl(res.url);
|
|
2223
|
+
const sep = res.externalCustomerId.indexOf(":");
|
|
2224
|
+
expectedOrderUuidRef.current = sep >= 0 ? res.externalCustomerId.slice(sep + 1) : null;
|
|
2225
|
+
}).catch((err) => {
|
|
2226
|
+
if (cancelled) return;
|
|
2227
|
+
const message = err instanceof Error ? err.message : loadErrorFallback;
|
|
2228
|
+
setLoadError(message);
|
|
2229
|
+
_optionalChain([onErrorRef, 'access', _77 => _77.current, 'optionalCall', _78 => _78(message, loadErrorCode)]);
|
|
2230
|
+
});
|
|
2231
|
+
return () => {
|
|
2232
|
+
cancelled = true;
|
|
2233
|
+
};
|
|
2234
|
+
}, [service, smartAccount, retryToken, loadErrorCode, loadErrorFallback]);
|
|
2235
|
+
_react.useEffect.call(void 0, () => {
|
|
2236
|
+
if (!widgetUrl || iframeLoaded || loadError) return;
|
|
2237
|
+
const timer = setTimeout(() => {
|
|
2238
|
+
setLoadError("Iframe took too long to load.");
|
|
2239
|
+
}, IFRAME_LOAD_TIMEOUT_MS);
|
|
2240
|
+
return () => clearTimeout(timer);
|
|
2241
|
+
}, [widgetUrl, iframeLoaded, loadError]);
|
|
2242
|
+
_react.useEffect.call(void 0, () => {
|
|
2243
|
+
let cancelled = false;
|
|
2244
|
+
let timeoutId;
|
|
2245
|
+
async function poll() {
|
|
2246
|
+
if (cancelled) return;
|
|
2247
|
+
try {
|
|
2248
|
+
const res = await service.fetchSwappedOrderStatus(smartAccount);
|
|
2249
|
+
if (cancelled) return;
|
|
2250
|
+
const isCurrentOrder = res !== null && expectedOrderUuidRef.current !== null && res.orderId === expectedOrderUuidRef.current;
|
|
2251
|
+
if (isCurrentOrder) {
|
|
2252
|
+
setOrderState(res);
|
|
2253
|
+
}
|
|
2254
|
+
} catch (e17) {
|
|
2255
|
+
}
|
|
2256
|
+
if (!cancelled) {
|
|
2257
|
+
timeoutId = setTimeout(poll, STATUS_POLL_INTERVAL_MS);
|
|
2258
|
+
}
|
|
2259
|
+
}
|
|
2260
|
+
poll();
|
|
2261
|
+
return () => {
|
|
2262
|
+
cancelled = true;
|
|
2263
|
+
clearTimeout(timeoutId);
|
|
2264
|
+
};
|
|
2265
|
+
}, [service, smartAccount]);
|
|
2266
|
+
_react.useEffect.call(void 0, () => {
|
|
2267
|
+
let cancelled = false;
|
|
2268
|
+
let timeoutId;
|
|
2269
|
+
async function pollDeposit() {
|
|
2270
|
+
if (cancelled) return;
|
|
2271
|
+
try {
|
|
2272
|
+
const status = await service.fetchLatestStatus(smartAccount);
|
|
2273
|
+
if (cancelled) return;
|
|
2274
|
+
const event = status.lastEvent;
|
|
2275
|
+
const eventTxHash = _chunkRABZINV3cjs.isDepositEvent.call(void 0, event) ? _nullishCoalesce(_chunkRABZINV3cjs.getEventTxHash.call(void 0, event), () => ( null)) : null;
|
|
2276
|
+
if (baselineDepositTxHashRef.current === void 0) {
|
|
2277
|
+
baselineDepositTxHashRef.current = eventTxHash;
|
|
2278
|
+
} else if (eventTxHash && (!baselineDepositTxHashRef.current || !_chunkRABZINV3cjs.txRefsMatch.call(void 0, eventTxHash, baselineDepositTxHashRef.current))) {
|
|
2279
|
+
currentDepositTxHashRef.current = eventTxHash;
|
|
2280
|
+
setLatestEvent(_nullishCoalesce(event, () => ( null)));
|
|
2281
|
+
}
|
|
2282
|
+
} catch (e18) {
|
|
2283
|
+
}
|
|
2284
|
+
if (!cancelled) {
|
|
2285
|
+
const nextInterval = fastDepositPollEnabledRef.current ? DEPOSIT_POLL_FAST_INTERVAL_MS : DEPOSIT_POLL_INTERVAL_MS;
|
|
2286
|
+
timeoutId = setTimeout(pollDeposit, nextInterval);
|
|
2287
|
+
}
|
|
2288
|
+
}
|
|
2289
|
+
rescheduleDepositPollRef.current = (delayMs) => {
|
|
2290
|
+
if (cancelled) return;
|
|
2291
|
+
if (timeoutId !== void 0) clearTimeout(timeoutId);
|
|
2292
|
+
timeoutId = setTimeout(pollDeposit, delayMs);
|
|
2293
|
+
};
|
|
2294
|
+
pollDeposit();
|
|
2295
|
+
return () => {
|
|
2296
|
+
cancelled = true;
|
|
2297
|
+
if (timeoutId !== void 0) clearTimeout(timeoutId);
|
|
2298
|
+
rescheduleDepositPollRef.current = null;
|
|
2299
|
+
};
|
|
2300
|
+
}, [service, smartAccount]);
|
|
2301
|
+
_react.useEffect.call(void 0, () => {
|
|
2302
|
+
if (fastDepositPollEnabledRef.current) return;
|
|
2303
|
+
const status = _optionalChain([orderState, 'optionalAccess', _79 => _79.status]);
|
|
2304
|
+
if (!status || !SWAPPED_TERMINAL_STATUSES.has(status)) return;
|
|
2305
|
+
fastDepositPollEnabledRef.current = true;
|
|
2306
|
+
_optionalChain([rescheduleDepositPollRef, 'access', _80 => _80.current, 'optionalCall', _81 => _81(DEPOSIT_POLL_FAST_INITIAL_DELAY_MS)]);
|
|
2307
|
+
}, [orderState]);
|
|
2308
|
+
_react.useEffect.call(void 0, () => {
|
|
2309
|
+
function onMessage(e) {
|
|
2310
|
+
if (!SWAPPED_IFRAME_ORIGINS.has(e.origin)) return;
|
|
2311
|
+
const parsed = parseSwappedIframeMessage(e.data);
|
|
2312
|
+
if (!parsed) return;
|
|
2313
|
+
setOrderState((prev) => ({
|
|
2314
|
+
orderId: _nullishCoalesce(_nullishCoalesce(parsed.orderId, () => ( _optionalChain([prev, 'optionalAccess', _82 => _82.orderId]))), () => ( "")),
|
|
2315
|
+
status: parsed.status,
|
|
2316
|
+
orderCrypto: _nullishCoalesce(_nullishCoalesce(parsed.orderCrypto, () => ( _optionalChain([prev, 'optionalAccess', _83 => _83.orderCrypto]))), () => ( null)),
|
|
2317
|
+
orderCryptoAmount: _nullishCoalesce(_nullishCoalesce(parsed.orderCryptoAmount, () => ( _optionalChain([prev, 'optionalAccess', _84 => _84.orderCryptoAmount]))), () => ( null)),
|
|
2318
|
+
transactionId: _nullishCoalesce(_nullishCoalesce(parsed.transactionId, () => ( _optionalChain([prev, 'optionalAccess', _85 => _85.transactionId]))), () => ( null)),
|
|
2319
|
+
receivedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
2320
|
+
paidAmountUsd: _nullishCoalesce(_optionalChain([prev, 'optionalAccess', _86 => _86.paidAmountUsd]), () => ( null)),
|
|
2321
|
+
paidAmountEur: _nullishCoalesce(_optionalChain([prev, 'optionalAccess', _87 => _87.paidAmountEur]), () => ( null)),
|
|
2322
|
+
onrampFeeUsd: _nullishCoalesce(_optionalChain([prev, 'optionalAccess', _88 => _88.onrampFeeUsd]), () => ( null)),
|
|
2323
|
+
paymentMethod: _nullishCoalesce(_optionalChain([prev, 'optionalAccess', _89 => _89.paymentMethod]), () => ( null))
|
|
2324
|
+
}));
|
|
2325
|
+
}
|
|
2326
|
+
window.addEventListener("message", onMessage);
|
|
2327
|
+
return () => window.removeEventListener("message", onMessage);
|
|
2328
|
+
}, []);
|
|
2329
|
+
_react.useEffect.call(void 0, () => {
|
|
2330
|
+
if (phase === "iframe" && orderState !== null) {
|
|
2331
|
+
setPhase("tracker");
|
|
2332
|
+
}
|
|
2333
|
+
}, [phase, orderState]);
|
|
2334
|
+
const stepStates = _react.useMemo.call(void 0,
|
|
2335
|
+
() => deriveStepStates(_nullishCoalesce(_optionalChain([orderState, 'optionalAccess', _90 => _90.status]), () => ( null)), latestEvent),
|
|
2336
|
+
[orderState, latestEvent]
|
|
2337
|
+
);
|
|
2338
|
+
const terminalState = _react.useMemo.call(void 0, () => {
|
|
2339
|
+
if (_chunkRABZINV3cjs.isFailedEvent.call(void 0, _nullishCoalesce(latestEvent, () => ( void 0)))) {
|
|
2340
|
+
return {
|
|
2341
|
+
kind: "failed",
|
|
2342
|
+
message: _chunkRABZINV3cjs.failureMessageForEvent.call(void 0, _nullishCoalesce(latestEvent, () => ( void 0)))
|
|
2343
|
+
};
|
|
2344
|
+
}
|
|
2345
|
+
if (_optionalChain([orderState, 'optionalAccess', _91 => _91.status]) === "order_cancelled") {
|
|
2346
|
+
const banner = bannerForStatus("order_cancelled", {});
|
|
2347
|
+
return { kind: "cancelled", message: _nullishCoalesce(banner.detail, () => ( banner.title)) };
|
|
2348
|
+
}
|
|
2349
|
+
return null;
|
|
2350
|
+
}, [latestEvent, orderState, bannerForStatus]);
|
|
2351
|
+
_react.useEffect.call(void 0, () => {
|
|
2352
|
+
if (completeFiredRef.current || failedFiredRef.current) return;
|
|
2353
|
+
const t = _optionalChain([latestEvent, 'optionalAccess', _92 => _92.type]);
|
|
2354
|
+
const isSuccess = t === "bridge-complete" || t === "post-bridge-swap-complete";
|
|
2355
|
+
if (!isSuccess) return;
|
|
2356
|
+
const txHash = currentDepositTxHashRef.current;
|
|
2357
|
+
if (!txHash) return;
|
|
2358
|
+
completeFiredRef.current = true;
|
|
2359
|
+
onSwappedCompleteRef.current({
|
|
2360
|
+
txHash,
|
|
2361
|
+
orderCrypto: _nullishCoalesce(_optionalChain([orderState, 'optionalAccess', _93 => _93.orderCrypto]), () => ( null)),
|
|
2362
|
+
// Base-unit source amount from the deposit row/event, consistent with the
|
|
2363
|
+
// wallet/QR path. ProcessingStep + onLifecycle expect base units.
|
|
2364
|
+
amount: _nullishCoalesce(_chunkRABZINV3cjs.getEventSourceDetails.call(void 0, _nullishCoalesce(latestEvent, () => ( void 0))).amount, () => ( null))
|
|
2365
|
+
});
|
|
2366
|
+
}, [latestEvent, orderState]);
|
|
2367
|
+
_react.useEffect.call(void 0, () => {
|
|
2368
|
+
if (failedFiredRef.current || completeFiredRef.current) return;
|
|
2369
|
+
if (!_chunkRABZINV3cjs.isFailedEvent.call(void 0, _nullishCoalesce(latestEvent, () => ( void 0)))) return;
|
|
2370
|
+
const txHash = currentDepositTxHashRef.current;
|
|
2371
|
+
if (!txHash) return;
|
|
2372
|
+
failedFiredRef.current = true;
|
|
2373
|
+
setPhase("tracker");
|
|
2374
|
+
_optionalChain([onSwappedFailedRef, 'access', _94 => _94.current, 'optionalCall', _95 => _95(
|
|
2375
|
+
txHash,
|
|
2376
|
+
_chunkRABZINV3cjs.failureMessageForEvent.call(void 0, _nullishCoalesce(latestEvent, () => ( void 0)))
|
|
2377
|
+
)]);
|
|
2378
|
+
}, [latestEvent]);
|
|
2379
|
+
if (phase === "tracker") {
|
|
2380
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2381
|
+
SwappedOrderTracker,
|
|
2382
|
+
{
|
|
2383
|
+
amount: _nullishCoalesce(_optionalChain([orderState, 'optionalAccess', _96 => _96.orderCryptoAmount]), () => ( null)),
|
|
2384
|
+
currency: _nullishCoalesce(_optionalChain([orderState, 'optionalAccess', _97 => _97.orderCrypto]), () => ( "USDC")),
|
|
2385
|
+
stepStates,
|
|
2386
|
+
terminal: terminalState,
|
|
2387
|
+
onRetry: () => setRetryToken((n) => n + 1),
|
|
2388
|
+
onClose
|
|
2389
|
+
}
|
|
2390
|
+
);
|
|
2391
|
+
}
|
|
2392
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-screen rs-fiat-onramp", "data-variant": variant, children: [
|
|
2393
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-screen-body rs-screen-body--gap-32", children: [
|
|
2394
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2395
|
+
_chunkRABZINV3cjs.BodyHeader,
|
|
2396
|
+
{
|
|
2397
|
+
icon: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkRABZINV3cjs.HandCoinsIcon, {}),
|
|
2398
|
+
title: "Deposit",
|
|
2399
|
+
subtitle: "Add money to your balance"
|
|
2400
|
+
}
|
|
2401
|
+
),
|
|
2402
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-fiat-onramp-iframe-wrap", children: [
|
|
2403
|
+
loadError && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-fiat-onramp-error", children: [
|
|
2404
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { children: loadError }),
|
|
2405
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2406
|
+
"button",
|
|
2407
|
+
{
|
|
2408
|
+
type: "button",
|
|
2409
|
+
className: "rs-fiat-onramp-retry",
|
|
2410
|
+
onClick: () => setRetryToken((n) => n + 1),
|
|
2411
|
+
children: "Retry"
|
|
2412
|
+
}
|
|
2413
|
+
)
|
|
2414
|
+
] }),
|
|
2415
|
+
!loadError && !iframeLoaded && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-fiat-onramp-loading", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkRABZINV3cjs.Spinner, {}) }),
|
|
2416
|
+
widgetUrl && !loadError && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2417
|
+
"iframe",
|
|
2418
|
+
{
|
|
2419
|
+
src: widgetUrl,
|
|
2420
|
+
title: iframeTitle,
|
|
2421
|
+
className: "rs-fiat-onramp-iframe",
|
|
2422
|
+
sandbox: "allow-scripts allow-forms allow-same-origin allow-popups allow-popups-to-escape-sandbox allow-top-navigation-by-user-activation",
|
|
2423
|
+
allow: "payment; camera; microphone; clipboard-write; geolocation",
|
|
2424
|
+
onLoad: () => setIframeLoaded(true)
|
|
2425
|
+
},
|
|
2426
|
+
retryToken
|
|
2427
|
+
)
|
|
2428
|
+
] })
|
|
2429
|
+
] }),
|
|
2430
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkRABZINV3cjs.PoweredBy, {})
|
|
2431
|
+
] });
|
|
2432
|
+
}
|
|
2433
|
+
function deriveStepStates(swappedStatus, latestEvent) {
|
|
2434
|
+
if (_chunkRABZINV3cjs.isFailedEvent.call(void 0, _nullishCoalesce(latestEvent, () => ( void 0)))) {
|
|
2435
|
+
return ["complete", "complete", "failed", "pending"];
|
|
2436
|
+
}
|
|
2437
|
+
if (swappedStatus === "order_cancelled") {
|
|
2438
|
+
return ["failed", "pending", "pending", "pending"];
|
|
2439
|
+
}
|
|
2440
|
+
const step1Complete = swappedStatus === "order_completed" || swappedStatus === "order_broadcasted";
|
|
2441
|
+
const step2Complete = latestEvent !== null;
|
|
2442
|
+
const step3Complete = _optionalChain([latestEvent, 'optionalAccess', _98 => _98.type]) === "bridge-complete" || _optionalChain([latestEvent, 'optionalAccess', _99 => _99.type]) === "post-bridge-swap-complete";
|
|
2443
|
+
if (step3Complete) {
|
|
2444
|
+
return ["complete", "complete", "complete", "pending"];
|
|
2445
|
+
}
|
|
2446
|
+
if (step2Complete) {
|
|
2447
|
+
return ["complete", "complete", "active", "pending"];
|
|
2448
|
+
}
|
|
2449
|
+
if (step1Complete) {
|
|
2450
|
+
return ["complete", "active", "pending", "pending"];
|
|
2451
|
+
}
|
|
2452
|
+
return ["active", "pending", "pending", "pending"];
|
|
2453
|
+
}
|
|
2454
|
+
SwappedIframeStep.displayName = "SwappedIframeStep";
|
|
2455
|
+
|
|
2456
|
+
// src/components/steps/FiatOnrampStep.tsx
|
|
2457
|
+
|
|
2458
|
+
function fiatBannerForStatus(status, context) {
|
|
2459
|
+
if (context.currencyMismatch) {
|
|
2460
|
+
return {
|
|
2461
|
+
level: "warning",
|
|
2462
|
+
title: "Currency mismatch",
|
|
2463
|
+
detail: "Funds may not bridge automatically. Contact support if your balance does not arrive."
|
|
2464
|
+
};
|
|
2465
|
+
}
|
|
2466
|
+
switch (status) {
|
|
2467
|
+
case "payment_pending":
|
|
2468
|
+
return { level: "info", title: "Verifying payment\u2026" };
|
|
2469
|
+
case "order_completed":
|
|
2470
|
+
return { level: "success", title: "Payment received \u2014 sending crypto" };
|
|
2471
|
+
case "order_broadcasted":
|
|
2472
|
+
return {
|
|
2473
|
+
level: "success",
|
|
2474
|
+
title: "Crypto sent \u2014 confirming on-chain"
|
|
2475
|
+
};
|
|
2476
|
+
case "order_cancelled":
|
|
2477
|
+
return {
|
|
2478
|
+
level: "warning",
|
|
2479
|
+
title: "Order cancelled",
|
|
2480
|
+
detail: "If you were charged, Swapped will refund within 5 business days."
|
|
2481
|
+
};
|
|
2482
|
+
}
|
|
2483
|
+
}
|
|
2484
|
+
function FiatOnrampStep({
|
|
2485
|
+
smartAccount,
|
|
2486
|
+
service,
|
|
2487
|
+
paymentMethod,
|
|
2488
|
+
onSwappedComplete,
|
|
2489
|
+
onSwappedFailed,
|
|
2490
|
+
onClose,
|
|
2491
|
+
onError
|
|
2492
|
+
}) {
|
|
2493
|
+
const loadUrl = _react.useCallback.call(void 0, async () => {
|
|
2494
|
+
const res = await service.getSwappedWidgetUrl({
|
|
2495
|
+
smartAccount,
|
|
2496
|
+
method: paymentMethod
|
|
2497
|
+
});
|
|
2498
|
+
if (res.currencyCode !== "USDC_BASE") {
|
|
2499
|
+
console.warn(
|
|
2500
|
+
`[FiatOnrampStep] Expected backend to return currencyCode=USDC_BASE, got ${res.currencyCode}. Swapped purchases may not bridge as expected.`
|
|
2501
|
+
);
|
|
2502
|
+
}
|
|
2503
|
+
return res;
|
|
2504
|
+
}, [service, smartAccount, paymentMethod]);
|
|
2505
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2506
|
+
SwappedIframeStep,
|
|
2507
|
+
{
|
|
2508
|
+
smartAccount,
|
|
2509
|
+
service,
|
|
2510
|
+
variant: "fiat",
|
|
2511
|
+
loadUrl,
|
|
2512
|
+
iframeTitle: "Buy crypto with Swapped",
|
|
2513
|
+
loadErrorCode: "SWAPPED_URL_FAILED",
|
|
2514
|
+
loadErrorFallback: "Failed to load on-ramp",
|
|
2515
|
+
bannerForStatus: fiatBannerForStatus,
|
|
2516
|
+
onSwappedComplete,
|
|
2517
|
+
onSwappedFailed,
|
|
2518
|
+
onClose,
|
|
2519
|
+
onError
|
|
2520
|
+
}
|
|
2521
|
+
);
|
|
2522
|
+
}
|
|
2523
|
+
FiatOnrampStep.displayName = "FiatOnrampStep";
|
|
2524
|
+
|
|
2525
|
+
// src/components/steps/ExchangeConnectStep.tsx
|
|
2526
|
+
|
|
2527
|
+
|
|
2528
|
+
function connectBannerForStatus(status, context) {
|
|
2529
|
+
if (context.currencyMismatch) {
|
|
2530
|
+
return {
|
|
2531
|
+
level: "warning",
|
|
2532
|
+
title: "Currency mismatch",
|
|
2533
|
+
detail: "Funds may not bridge automatically. Contact support if your balance does not arrive."
|
|
2534
|
+
};
|
|
2535
|
+
}
|
|
2536
|
+
switch (status) {
|
|
2537
|
+
case "payment_pending":
|
|
2538
|
+
return { level: "info", title: "Waiting for exchange transfer\u2026" };
|
|
2539
|
+
case "order_completed":
|
|
2540
|
+
return {
|
|
2541
|
+
level: "success",
|
|
2542
|
+
title: "Exchange transfer received \u2014 sending crypto"
|
|
2543
|
+
};
|
|
2544
|
+
case "order_broadcasted":
|
|
2545
|
+
return {
|
|
2546
|
+
level: "success",
|
|
2547
|
+
title: "Crypto sent \u2014 confirming on-chain"
|
|
2548
|
+
};
|
|
2549
|
+
case "order_cancelled":
|
|
2550
|
+
return {
|
|
2551
|
+
level: "warning",
|
|
2552
|
+
title: "Order cancelled",
|
|
2553
|
+
detail: "If your exchange already debited the funds, Swapped will refund within 5 business days."
|
|
2554
|
+
};
|
|
2555
|
+
}
|
|
2556
|
+
}
|
|
2557
|
+
function ExchangeConnectStep({
|
|
2558
|
+
smartAccount,
|
|
2559
|
+
service,
|
|
2560
|
+
connection,
|
|
2561
|
+
onSwappedComplete,
|
|
2562
|
+
onSwappedFailed,
|
|
2563
|
+
onClose,
|
|
2564
|
+
onError
|
|
2565
|
+
}) {
|
|
2566
|
+
const loadUrl = _react.useCallback.call(void 0, async () => {
|
|
2567
|
+
const res = await service.getSwappedConnectUrl({
|
|
2568
|
+
smartAccount,
|
|
2569
|
+
connection
|
|
2570
|
+
});
|
|
2571
|
+
if (res.currencyCode !== "USDC_BASE") {
|
|
2572
|
+
console.warn(
|
|
2573
|
+
`[ExchangeConnectStep] Expected backend to return currencyCode=USDC_BASE, got ${res.currencyCode}. Swapped Connect pulls may not bridge as expected.`
|
|
2574
|
+
);
|
|
2575
|
+
}
|
|
2576
|
+
return res;
|
|
2577
|
+
}, [service, smartAccount, connection]);
|
|
2578
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2579
|
+
SwappedIframeStep,
|
|
2580
|
+
{
|
|
2581
|
+
smartAccount,
|
|
2582
|
+
service,
|
|
2583
|
+
variant: "connect",
|
|
2584
|
+
loadUrl,
|
|
2585
|
+
iframeTitle: "Fund from exchange via Swapped",
|
|
2586
|
+
loadErrorCode: "SWAPPED_CONNECT_URL_FAILED",
|
|
2587
|
+
loadErrorFallback: "Failed to load Connect",
|
|
2588
|
+
bannerForStatus: connectBannerForStatus,
|
|
2589
|
+
onSwappedComplete,
|
|
2590
|
+
onSwappedFailed,
|
|
2591
|
+
onClose,
|
|
2592
|
+
onError
|
|
2593
|
+
}
|
|
2594
|
+
);
|
|
2595
|
+
}
|
|
2596
|
+
ExchangeConnectStep.displayName = "ExchangeConnectStep";
|
|
2597
|
+
|
|
2598
|
+
// src/components/steps/ExchangeSelectStep.tsx
|
|
2599
|
+
|
|
2600
|
+
|
|
2601
|
+
function ExchangeLogo({ exchange }) {
|
|
2602
|
+
const [failed, setFailed] = _react.useState.call(void 0, false);
|
|
2603
|
+
if (!exchange.logoUrl || failed) {
|
|
2604
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkRABZINV3cjs.BankIcon, {});
|
|
2605
|
+
}
|
|
2606
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2607
|
+
"img",
|
|
2608
|
+
{
|
|
2609
|
+
src: exchange.logoUrl,
|
|
2610
|
+
alt: "",
|
|
2611
|
+
onError: () => setFailed(true)
|
|
2612
|
+
}
|
|
2613
|
+
);
|
|
2614
|
+
}
|
|
2615
|
+
function ExchangeSelectStep({
|
|
2616
|
+
service,
|
|
2617
|
+
onSelectExchange,
|
|
2618
|
+
onError
|
|
2619
|
+
}) {
|
|
2620
|
+
const [exchanges, setExchanges] = _react.useState.call(void 0, []);
|
|
2621
|
+
const [loading, setLoading] = _react.useState.call(void 0, true);
|
|
2622
|
+
const [error, setError] = _react.useState.call(void 0, null);
|
|
2623
|
+
const [retryToken, setRetryToken] = _react.useState.call(void 0, 0);
|
|
2624
|
+
const retry = _react.useCallback.call(void 0, () => {
|
|
2625
|
+
setRetryToken((n) => n + 1);
|
|
2626
|
+
}, []);
|
|
2627
|
+
_react.useEffect.call(void 0, () => {
|
|
2628
|
+
let cancelled = false;
|
|
2629
|
+
setLoading(true);
|
|
2630
|
+
setError(null);
|
|
2631
|
+
service.getSwappedConnectExchanges().then((res) => {
|
|
2632
|
+
if (cancelled) return;
|
|
2633
|
+
setExchanges(res.exchanges);
|
|
2634
|
+
}).catch((err) => {
|
|
2635
|
+
if (cancelled) return;
|
|
2636
|
+
const message = err instanceof Error ? err.message : "Failed to load exchanges";
|
|
2637
|
+
setExchanges([]);
|
|
2638
|
+
setError(message);
|
|
2639
|
+
_optionalChain([onError, 'optionalCall', _100 => _100(message, "SWAPPED_CONNECT_EXCHANGES_FAILED")]);
|
|
2640
|
+
}).finally(() => {
|
|
2641
|
+
if (!cancelled) setLoading(false);
|
|
2642
|
+
});
|
|
2643
|
+
return () => {
|
|
2644
|
+
cancelled = true;
|
|
2645
|
+
};
|
|
2646
|
+
}, [service, retryToken, onError]);
|
|
2647
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-screen rs-exchange-select", children: [
|
|
2648
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-screen-body rs-screen-body--gap-32", children: [
|
|
2649
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2650
|
+
_chunkRABZINV3cjs.BodyHeader,
|
|
2651
|
+
{
|
|
2652
|
+
icon: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkRABZINV3cjs.BankIcon, {}),
|
|
2653
|
+
title: "Fund from Exchange",
|
|
2654
|
+
subtitle: "Choose your exchange"
|
|
2655
|
+
}
|
|
2656
|
+
),
|
|
2657
|
+
loading && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-exchange-select-state", "aria-live": "polite", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkRABZINV3cjs.Spinner, {}) }),
|
|
2658
|
+
!loading && error && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-exchange-select-state", "aria-live": "polite", children: [
|
|
2659
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-exchange-select-state-title", children: "Couldn\u2019t load exchanges" }),
|
|
2660
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2661
|
+
"button",
|
|
2662
|
+
{
|
|
2663
|
+
type: "button",
|
|
2664
|
+
className: "rs-fiat-onramp-retry",
|
|
2665
|
+
onClick: retry,
|
|
2666
|
+
children: "Retry"
|
|
2667
|
+
}
|
|
2668
|
+
)
|
|
2669
|
+
] }),
|
|
2670
|
+
!loading && !error && exchanges.length === 0 && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-exchange-select-state", "aria-live": "polite", children: [
|
|
2671
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-exchange-select-state-title", children: "No exchanges available" }),
|
|
2672
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2673
|
+
"button",
|
|
2674
|
+
{
|
|
2675
|
+
type: "button",
|
|
2676
|
+
className: "rs-fiat-onramp-retry",
|
|
2677
|
+
onClick: retry,
|
|
2678
|
+
children: "Retry"
|
|
2679
|
+
}
|
|
2680
|
+
)
|
|
2681
|
+
] }),
|
|
2682
|
+
!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,
|
|
2683
|
+
"button",
|
|
2684
|
+
{
|
|
2685
|
+
type: "button",
|
|
2686
|
+
className: "rs-exchange-card",
|
|
2687
|
+
onClick: () => onSelectExchange(exchange.connection),
|
|
2688
|
+
"aria-label": `Select ${exchange.name}`,
|
|
2689
|
+
children: [
|
|
2690
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-exchange-card-logo", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ExchangeLogo, { exchange }) }),
|
|
2691
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-exchange-card-name", children: exchange.name })
|
|
2692
|
+
]
|
|
2693
|
+
},
|
|
2694
|
+
exchange.connection
|
|
2695
|
+
)) })
|
|
2696
|
+
] }),
|
|
2697
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkRABZINV3cjs.PoweredBy, {})
|
|
2698
|
+
] });
|
|
2699
|
+
}
|
|
2700
|
+
ExchangeSelectStep.displayName = "ExchangeSelectStep";
|
|
2701
|
+
|
|
2702
|
+
// src/components/steps/DepositAddressSkeleton.tsx
|
|
2703
|
+
|
|
2704
|
+
var BASE_CHAIN_ID = 8453;
|
|
2705
|
+
function DepositAddressSkeleton({
|
|
2706
|
+
uiConfig,
|
|
2707
|
+
allowedRoutes
|
|
2708
|
+
}) {
|
|
2709
|
+
const allowedChainSet = _optionalChain([allowedRoutes, 'optionalAccess', _101 => _101.sourceChains]) ? new Set(allowedRoutes.sourceChains) : null;
|
|
2710
|
+
const allowedTokenSet = _optionalChain([allowedRoutes, 'optionalAccess', _102 => _102.sourceTokens]) ? new Set(allowedRoutes.sourceTokens.map((s) => s.toUpperCase())) : null;
|
|
2711
|
+
const evmChainIds = (() => {
|
|
2712
|
+
const all = _chunkMILJQWPTcjs.getSupportedChainIds.call(void 0, );
|
|
2713
|
+
return allowedChainSet ? all.filter((id) => allowedChainSet.has(id)) : all;
|
|
2714
|
+
})();
|
|
2715
|
+
const defaultChainId = evmChainIds.includes(BASE_CHAIN_ID) ? BASE_CHAIN_ID : evmChainIds[0];
|
|
2716
|
+
const tokensForChain = (() => {
|
|
2717
|
+
const all = _chunkMILJQWPTcjs.getTargetTokenSymbolsForChain.call(void 0, defaultChainId);
|
|
2718
|
+
return allowedTokenSet ? all.filter((s) => allowedTokenSet.has(s.toUpperCase())) : all;
|
|
2719
|
+
})();
|
|
2720
|
+
const defaultToken = tokensForChain.includes("USDC") ? "USDC" : _nullishCoalesce(tokensForChain[0], () => ( "USDC"));
|
|
2721
|
+
const chainName = _chunkMILJQWPTcjs.getChainName.call(void 0, defaultChainId);
|
|
2722
|
+
const chainIcon = _chunkMILJQWPTcjs.getChainIcon.call(void 0, defaultChainId);
|
|
2723
|
+
const tokenIcon = _chunkMILJQWPTcjs.getTokenIcon.call(void 0, defaultToken);
|
|
2724
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-screen", "aria-busy": "true", children: [
|
|
2725
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-sr-only", role: "status", children: "Preparing deposit details\u2026" }),
|
|
2726
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-screen-body", children: [
|
|
2727
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkRABZINV3cjs.BodyHeader, { icon: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkRABZINV3cjs.TransferCryptoIcon, {}), title: "Transfer crypto" }),
|
|
2728
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-deposit-address-selectors", "aria-hidden": "true", children: [
|
|
2729
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-deposit-address-dropdown", children: [
|
|
2730
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-deposit-address-dropdown-label", children: "Supported chain" }),
|
|
2731
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-deposit-address-dropdown-trigger", children: [
|
|
2732
|
+
chainIcon && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2733
|
+
"img",
|
|
2734
|
+
{
|
|
2735
|
+
src: chainIcon,
|
|
2736
|
+
alt: "",
|
|
2737
|
+
className: "rs-deposit-address-dropdown-icon"
|
|
2738
|
+
}
|
|
2739
|
+
),
|
|
2740
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: chainName }),
|
|
2741
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkRABZINV3cjs.ChevronDownIcon, { className: "rs-deposit-address-dropdown-chevron" })
|
|
2742
|
+
] })
|
|
2743
|
+
] }),
|
|
2744
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-deposit-address-dropdown", children: [
|
|
2745
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-deposit-address-dropdown-label rs-deposit-address-dropdown-label--with-min", children: [
|
|
2746
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: "Supported token" }),
|
|
2747
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "rs-deposit-address-min", children: [
|
|
2748
|
+
"Min.$",
|
|
2749
|
+
(_nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess', _103 => _103.minDepositUsd]), () => ( 0.1))).toFixed(2),
|
|
2750
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkRABZINV3cjs.Tooltip, { content: "Minimum deposit amount required for the selected chain.", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2751
|
+
_chunkRABZINV3cjs.InfoIcon,
|
|
2752
|
+
{
|
|
2753
|
+
className: "rs-deposit-address-min-icon",
|
|
2754
|
+
"aria-hidden": "true"
|
|
2755
|
+
}
|
|
2756
|
+
) })
|
|
2757
|
+
] })
|
|
2758
|
+
] }),
|
|
2759
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-deposit-address-dropdown-trigger", children: [
|
|
2760
|
+
tokenIcon && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2761
|
+
"img",
|
|
2762
|
+
{
|
|
2763
|
+
src: tokenIcon,
|
|
2764
|
+
alt: "",
|
|
2765
|
+
className: "rs-deposit-address-dropdown-icon"
|
|
2766
|
+
}
|
|
2767
|
+
),
|
|
2768
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: defaultToken }),
|
|
2769
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkRABZINV3cjs.ChevronDownIcon, { className: "rs-deposit-address-dropdown-chevron" })
|
|
2770
|
+
] })
|
|
2771
|
+
] })
|
|
2772
|
+
] }),
|
|
2773
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2774
|
+
"div",
|
|
2775
|
+
{
|
|
2776
|
+
style: { display: "flex", flexDirection: "column", gap: 4, width: "100%" },
|
|
2777
|
+
children: [
|
|
2778
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-deposit-address-well", children: [
|
|
2779
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-deposit-address-qr", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-skeleton rs-skeleton-qr", "aria-hidden": "true" }) }),
|
|
2780
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-skeleton rs-skeleton-address", "aria-hidden": "true" })
|
|
2781
|
+
] }),
|
|
1825
2782
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1826
|
-
"div",
|
|
1827
|
-
{
|
|
1828
|
-
className: `rs-deposit-address-well ${isUpdating ? "rs-deposit-address-well--updating" : ""}`,
|
|
1829
|
-
children: [
|
|
1830
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-deposit-address-qr", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1831
|
-
_react.Suspense,
|
|
1832
|
-
{
|
|
1833
|
-
fallback: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1834
|
-
"div",
|
|
1835
|
-
{
|
|
1836
|
-
style: {
|
|
1837
|
-
width: 200,
|
|
1838
|
-
height: 200,
|
|
1839
|
-
display: "flex",
|
|
1840
|
-
alignItems: "center",
|
|
1841
|
-
justifyContent: "center"
|
|
1842
|
-
},
|
|
1843
|
-
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkMMXUBBGKcjs.Spinner, {})
|
|
1844
|
-
}
|
|
1845
|
-
),
|
|
1846
|
-
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, QRCode, { value: displayAddress, size: 200, iconSrc: qrIconSrc })
|
|
1847
|
-
}
|
|
1848
|
-
) }),
|
|
1849
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-deposit-address-value", children: displayAddress })
|
|
1850
|
-
]
|
|
1851
|
-
}
|
|
1852
|
-
),
|
|
1853
|
-
isUpdating ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-deposit-address-updating", role: "status", children: [
|
|
1854
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkMMXUBBGKcjs.Spinner, { className: "rs-spinner--sm" }),
|
|
1855
|
-
"Updating deposit details\u2026"
|
|
1856
|
-
] }) : /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1857
2783
|
"button",
|
|
1858
2784
|
{
|
|
1859
2785
|
type: "button",
|
|
1860
2786
|
className: "rs-deposit-address-copy",
|
|
1861
|
-
|
|
2787
|
+
disabled: true,
|
|
2788
|
+
"aria-hidden": "true",
|
|
1862
2789
|
children: [
|
|
1863
|
-
|
|
1864
|
-
|
|
2790
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkRABZINV3cjs.CopyIcon, {}),
|
|
2791
|
+
"Copy address"
|
|
1865
2792
|
]
|
|
1866
2793
|
}
|
|
1867
2794
|
)
|
|
1868
2795
|
]
|
|
1869
2796
|
}
|
|
1870
2797
|
),
|
|
1871
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1872
|
-
"
|
|
1873
|
-
|
|
1874
|
-
className:
|
|
1875
|
-
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
|
|
1879
|
-
|
|
1880
|
-
|
|
1881
|
-
|
|
1882
|
-
|
|
1883
|
-
|
|
1884
|
-
|
|
1885
|
-
|
|
1886
|
-
|
|
1887
|
-
|
|
1888
|
-
|
|
1889
|
-
|
|
1890
|
-
|
|
1891
|
-
|
|
1892
|
-
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkMMXUBBGKcjs.InfoIcon, { "aria-hidden": "true" })
|
|
1893
|
-
}
|
|
1894
|
-
)
|
|
1895
|
-
] }),
|
|
1896
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1897
|
-
_chunkMMXUBBGKcjs.ChevronDownIcon,
|
|
1898
|
-
{
|
|
1899
|
-
className: "rs-price-impact-chevron",
|
|
1900
|
-
"aria-hidden": "true"
|
|
1901
|
-
}
|
|
1902
|
-
)
|
|
1903
|
-
]
|
|
1904
|
-
}
|
|
1905
|
-
),
|
|
1906
|
-
/* @__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: [
|
|
1907
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-price-impact-row", children: [
|
|
1908
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-price-impact-row-icon", "aria-hidden": "true", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkMMXUBBGKcjs.PercentIcon, {}) }),
|
|
1909
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "rs-price-impact-label", children: [
|
|
1910
|
-
"Max slippage: ",
|
|
1911
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "strong", { children: "0.2%" })
|
|
1912
|
-
] }),
|
|
1913
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1914
|
-
_chunkMMXUBBGKcjs.Tooltip,
|
|
1915
|
-
{
|
|
1916
|
-
className: "rs-price-impact-info",
|
|
1917
|
-
content: "Slippage accounts for price changes during execution. Slippage is adjusted per pair to ensure reliable execution.",
|
|
1918
|
-
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkMMXUBBGKcjs.InfoIcon, { "aria-hidden": "true" })
|
|
1919
|
-
}
|
|
1920
|
-
)
|
|
1921
|
-
] }),
|
|
1922
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-price-impact-row", children: [
|
|
1923
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-price-impact-row-icon", "aria-hidden": "true", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkMMXUBBGKcjs.ClockIcon, {}) }),
|
|
1924
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "rs-price-impact-label", children: [
|
|
1925
|
-
"Processing time: ",
|
|
1926
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "strong", { children: "< 1 min" })
|
|
1927
|
-
] })
|
|
1928
|
-
] }),
|
|
1929
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-price-impact-row", children: [
|
|
1930
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-price-impact-row-icon", "aria-hidden": "true", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkMMXUBBGKcjs.PlusCircleIcon, {}) }),
|
|
1931
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "rs-price-impact-label", children: [
|
|
1932
|
-
"Max deposit:",
|
|
1933
|
-
" ",
|
|
1934
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "strong", { children: liquidityHelper.kind === "max" ? `${_viem.formatUnits.call(void 0,
|
|
1935
|
-
BigInt(liquidityHelper.maxAmount),
|
|
1936
|
-
liquidityHelper.decimals
|
|
1937
|
-
)} ${liquidityHelper.symbol}` : liquidityHelper.kind === "unlimited" ? "Unlimited" : liquidityHelper.kind === "unavailable" ? "Unavailable" : liquidityHelper.kind === "error" ? "\u2014" : "\u2026" })
|
|
1938
|
-
] })
|
|
1939
|
-
] })
|
|
1940
|
-
] }) })
|
|
1941
|
-
]
|
|
1942
|
-
}
|
|
1943
|
-
),
|
|
1944
|
-
pollingError && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-deposit-address-error", children: pollingError })
|
|
2798
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-price-impact", "aria-hidden": "true", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-price-impact-header", children: [
|
|
2799
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "rs-price-impact-header-left", children: [
|
|
2800
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-price-impact-label", children: "Price impact" }),
|
|
2801
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-price-impact-label", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "strong", { children: "0.00%" }) }),
|
|
2802
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2803
|
+
_chunkRABZINV3cjs.Tooltip,
|
|
2804
|
+
{
|
|
2805
|
+
className: "rs-price-impact-info",
|
|
2806
|
+
content: "Price impact is the difference between expected and execution price, due to trade size and liquidity.",
|
|
2807
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkRABZINV3cjs.InfoIcon, { "aria-hidden": "true" })
|
|
2808
|
+
}
|
|
2809
|
+
)
|
|
2810
|
+
] }),
|
|
2811
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2812
|
+
_chunkRABZINV3cjs.ChevronDownIcon,
|
|
2813
|
+
{
|
|
2814
|
+
className: "rs-price-impact-chevron",
|
|
2815
|
+
"aria-hidden": "true"
|
|
2816
|
+
}
|
|
2817
|
+
)
|
|
2818
|
+
] }) })
|
|
1945
2819
|
] }),
|
|
1946
|
-
|
|
1947
|
-
DepositNotification,
|
|
1948
|
-
{
|
|
1949
|
-
deposit,
|
|
1950
|
-
smartAccount,
|
|
1951
|
-
solanaDepositAddress,
|
|
1952
|
-
targetChain,
|
|
1953
|
-
targetToken,
|
|
1954
|
-
waitForFinalTx,
|
|
1955
|
-
hasPostBridgeActions,
|
|
1956
|
-
service,
|
|
1957
|
-
onComplete: handleNotificationComplete,
|
|
1958
|
-
onFailed: handleNotificationFailed,
|
|
1959
|
-
onDismiss: handleNotificationDismiss
|
|
1960
|
-
},
|
|
1961
|
-
deposit.id
|
|
1962
|
-
)) }),
|
|
1963
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkMMXUBBGKcjs.PoweredBy, {})
|
|
2820
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkRABZINV3cjs.PoweredBy, {})
|
|
1964
2821
|
] });
|
|
1965
2822
|
}
|
|
1966
|
-
|
|
2823
|
+
DepositAddressSkeleton.displayName = "DepositAddressSkeleton";
|
|
1967
2824
|
|
|
1968
2825
|
// src/components/steps/SolanaTokenSelectStep.tsx
|
|
1969
2826
|
|
|
@@ -1992,18 +2849,18 @@ function SolanaTokenSelectStep({
|
|
|
1992
2849
|
setError(null);
|
|
1993
2850
|
const portfolioBySymbol = {};
|
|
1994
2851
|
try {
|
|
1995
|
-
|
|
2852
|
+
_chunkRABZINV3cjs.debugLog.call(void 0, debug, "solana-token-select", "portfolio:request", {
|
|
1996
2853
|
solanaAddress
|
|
1997
2854
|
});
|
|
1998
2855
|
const portfolio = await service.fetchSolanaPortfolio(solanaAddress);
|
|
1999
2856
|
if (!active) return;
|
|
2000
2857
|
for (const t of portfolio.tokens) {
|
|
2001
2858
|
const symbol = t.symbol.toUpperCase();
|
|
2002
|
-
if (!
|
|
2859
|
+
if (!_chunkMILJQWPTcjs.SOLANA_TOKENS.some((st) => st.symbol === symbol)) continue;
|
|
2003
2860
|
let parsed = 0n;
|
|
2004
2861
|
try {
|
|
2005
2862
|
parsed = BigInt(t.balance || "0");
|
|
2006
|
-
} catch (
|
|
2863
|
+
} catch (e19) {
|
|
2007
2864
|
parsed = 0n;
|
|
2008
2865
|
}
|
|
2009
2866
|
if (parsed <= 0n) continue;
|
|
@@ -2015,12 +2872,12 @@ function SolanaTokenSelectStep({
|
|
|
2015
2872
|
};
|
|
2016
2873
|
}
|
|
2017
2874
|
}
|
|
2018
|
-
|
|
2875
|
+
_chunkRABZINV3cjs.debugLog.call(void 0, debug, "solana-token-select", "portfolio:success", {
|
|
2019
2876
|
symbols: Object.keys(portfolioBySymbol)
|
|
2020
2877
|
});
|
|
2021
2878
|
} catch (err) {
|
|
2022
2879
|
if (!active) return;
|
|
2023
|
-
|
|
2880
|
+
_chunkRABZINV3cjs.debugError.call(void 0, debug, "solana-token-select", "portfolio:failure", err, {
|
|
2024
2881
|
solanaAddress
|
|
2025
2882
|
});
|
|
2026
2883
|
setError(
|
|
@@ -2031,7 +2888,7 @@ function SolanaTokenSelectStep({
|
|
|
2031
2888
|
return;
|
|
2032
2889
|
}
|
|
2033
2890
|
const results = [];
|
|
2034
|
-
for (const token of
|
|
2891
|
+
for (const token of _chunkMILJQWPTcjs.SOLANA_TOKENS) {
|
|
2035
2892
|
const fromPortfolio = portfolioBySymbol[token.symbol];
|
|
2036
2893
|
if (fromPortfolio && fromPortfolio.balance > 0n) {
|
|
2037
2894
|
results.push({
|
|
@@ -2045,7 +2902,7 @@ function SolanaTokenSelectStep({
|
|
|
2045
2902
|
setTokenBalances(results);
|
|
2046
2903
|
setLoading(false);
|
|
2047
2904
|
const totalUsd = results.reduce((sum, r) => sum + r.balanceUsd, 0);
|
|
2048
|
-
_optionalChain([onTotalBalanceComputed, 'optionalCall',
|
|
2905
|
+
_optionalChain([onTotalBalanceComputed, 'optionalCall', _104 => _104(totalUsd)]);
|
|
2049
2906
|
}
|
|
2050
2907
|
void loadBalances();
|
|
2051
2908
|
return () => {
|
|
@@ -2067,30 +2924,30 @@ function SolanaTokenSelectStep({
|
|
|
2067
2924
|
const raw = _viem.formatUnits.call(void 0, entry.balance, entry.token.decimals);
|
|
2068
2925
|
const numeric = Number(raw);
|
|
2069
2926
|
if (!Number.isFinite(numeric)) return raw;
|
|
2070
|
-
return
|
|
2071
|
-
} catch (
|
|
2927
|
+
return _chunkRABZINV3cjs.tokenFormatter.format(numeric);
|
|
2928
|
+
} catch (e20) {
|
|
2072
2929
|
return "--";
|
|
2073
2930
|
}
|
|
2074
2931
|
};
|
|
2075
|
-
const chainIcon =
|
|
2076
|
-
const chainName =
|
|
2932
|
+
const chainIcon = _chunkMILJQWPTcjs.getChainIcon.call(void 0, "solana");
|
|
2933
|
+
const chainName = _chunkMILJQWPTcjs.getChainName.call(void 0, "solana");
|
|
2077
2934
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-screen", children: [
|
|
2078
2935
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-screen-body", children: [
|
|
2079
2936
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2080
|
-
|
|
2937
|
+
_chunkRABZINV3cjs.BodyHeader,
|
|
2081
2938
|
{
|
|
2082
|
-
icon: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2939
|
+
icon: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkRABZINV3cjs.WalletIcon, {}),
|
|
2083
2940
|
title: "Your assets",
|
|
2084
2941
|
subtitle: "Select source assets to transfer"
|
|
2085
2942
|
}
|
|
2086
2943
|
),
|
|
2087
2944
|
loading && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-loading-state", style: { padding: "40px 12px" }, children: [
|
|
2088
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2945
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkRABZINV3cjs.Spinner, { className: "rs-text-tertiary" }),
|
|
2089
2946
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-text-sm rs-text-tertiary", children: "Loading balances" })
|
|
2090
2947
|
] }),
|
|
2091
|
-
error && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2948
|
+
error && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkRABZINV3cjs.Callout, { variant: "error", children: error }),
|
|
2092
2949
|
!loading && !error && rows.length === 0 && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-empty-state", children: [
|
|
2093
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2950
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkRABZINV3cjs.WalletIcon, { className: "rs-empty-icon" }),
|
|
2094
2951
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-empty-text", children: "No funds in connected wallet" }),
|
|
2095
2952
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-empty-address", children: [
|
|
2096
2953
|
solanaAddress.slice(0, 6),
|
|
@@ -2110,7 +2967,7 @@ function SolanaTokenSelectStep({
|
|
|
2110
2967
|
!loading && !error && rows.length > 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-asset-list", children: rows.map((entry) => {
|
|
2111
2968
|
const isSelected = selectedSymbol === entry.token.symbol;
|
|
2112
2969
|
const tokenAmount = formatBalance(entry);
|
|
2113
|
-
const tokenIcon =
|
|
2970
|
+
const tokenIcon = _chunkMILJQWPTcjs.getTokenIcon.call(void 0, entry.token.symbol);
|
|
2114
2971
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2115
2972
|
"button",
|
|
2116
2973
|
{
|
|
@@ -2139,14 +2996,14 @@ function SolanaTokenSelectStep({
|
|
|
2139
2996
|
] })
|
|
2140
2997
|
] })
|
|
2141
2998
|
] }),
|
|
2142
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-asset-balance", children: entry.balanceUsd > 0 ?
|
|
2999
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-asset-balance", children: entry.balanceUsd > 0 ? _chunkRABZINV3cjs.currencyFormatter.format(entry.balanceUsd) : tokenAmount !== "--" ? `${tokenAmount} ${entry.token.symbol}` : "--" })
|
|
2143
3000
|
]
|
|
2144
3001
|
},
|
|
2145
3002
|
entry.token.symbol
|
|
2146
3003
|
);
|
|
2147
3004
|
}) }),
|
|
2148
3005
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2149
|
-
|
|
3006
|
+
_chunkRABZINV3cjs.Button,
|
|
2150
3007
|
{
|
|
2151
3008
|
onClick: () => selectedEntry && onContinue(
|
|
2152
3009
|
selectedEntry.token,
|
|
@@ -2159,7 +3016,7 @@ function SolanaTokenSelectStep({
|
|
|
2159
3016
|
}
|
|
2160
3017
|
)
|
|
2161
3018
|
] }),
|
|
2162
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3019
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkRABZINV3cjs.PoweredBy, {})
|
|
2163
3020
|
] });
|
|
2164
3021
|
}
|
|
2165
3022
|
|
|
@@ -2180,6 +3037,7 @@ function SolanaAmountStep({
|
|
|
2180
3037
|
balanceUsd,
|
|
2181
3038
|
defaultAmount,
|
|
2182
3039
|
uiConfig,
|
|
3040
|
+
targetChain,
|
|
2183
3041
|
targetChainName,
|
|
2184
3042
|
targetTokenSymbol,
|
|
2185
3043
|
targetTokenIcon,
|
|
@@ -2190,8 +3048,8 @@ function SolanaAmountStep({
|
|
|
2190
3048
|
const [amount, setAmount] = _react.useState.call(void 0, "");
|
|
2191
3049
|
const [error, setError] = _react.useState.call(void 0, null);
|
|
2192
3050
|
const hasAppliedDefaultRef = _react.useRef.call(void 0, false);
|
|
2193
|
-
const isSourceStablecoin =
|
|
2194
|
-
const isMaxDefault = _optionalChain([defaultAmount, 'optionalAccess',
|
|
3051
|
+
const isSourceStablecoin = _chunkMILJQWPTcjs.isStablecoinSymbol.call(void 0, token.symbol);
|
|
3052
|
+
const isMaxDefault = _optionalChain([defaultAmount, 'optionalAccess', _105 => _105.trim, 'call', _106 => _106(), 'access', _107 => _107.toLowerCase, 'call', _108 => _108()]) === "max";
|
|
2195
3053
|
const tokenPriceUsd = _react.useMemo.call(void 0, () => {
|
|
2196
3054
|
if (isSourceStablecoin) return 1;
|
|
2197
3055
|
try {
|
|
@@ -2201,7 +3059,7 @@ function SolanaAmountStep({
|
|
|
2201
3059
|
}
|
|
2202
3060
|
const price = balanceUsd / balanceUnits;
|
|
2203
3061
|
return price > 0 ? price : null;
|
|
2204
|
-
} catch (
|
|
3062
|
+
} catch (e21) {
|
|
2205
3063
|
return null;
|
|
2206
3064
|
}
|
|
2207
3065
|
}, [isSourceStablecoin, balance, token.decimals, balanceUsd]);
|
|
@@ -2211,8 +3069,8 @@ function SolanaAmountStep({
|
|
|
2211
3069
|
const raw = _viem.formatUnits.call(void 0, balance, token.decimals);
|
|
2212
3070
|
const numeric = Number(raw);
|
|
2213
3071
|
if (!Number.isFinite(numeric)) return raw;
|
|
2214
|
-
return
|
|
2215
|
-
} catch (
|
|
3072
|
+
return _chunkRABZINV3cjs.tokenFormatter.format(numeric);
|
|
3073
|
+
} catch (e22) {
|
|
2216
3074
|
return "\u2026";
|
|
2217
3075
|
}
|
|
2218
3076
|
}, [balance, token.decimals]);
|
|
@@ -2223,12 +3081,12 @@ function SolanaAmountStep({
|
|
|
2223
3081
|
if (tokenPriceUsd !== null) return balanceUnits * tokenPriceUsd;
|
|
2224
3082
|
if (Number.isFinite(balanceUsd) && balanceUsd > 0) return balanceUsd;
|
|
2225
3083
|
return null;
|
|
2226
|
-
} catch (
|
|
3084
|
+
} catch (e23) {
|
|
2227
3085
|
return null;
|
|
2228
3086
|
}
|
|
2229
3087
|
}, [balance, token.decimals, tokenPriceUsd, balanceUsd]);
|
|
2230
3088
|
const spendableBalance = _react.useMemo.call(void 0, () => {
|
|
2231
|
-
if (!
|
|
3089
|
+
if (!_chunkMILJQWPTcjs.isNativeSol.call(void 0, token)) return balance;
|
|
2232
3090
|
return balance > SOL_FEE_RESERVE_LAMPORTS ? balance - SOL_FEE_RESERVE_LAMPORTS : 0n;
|
|
2233
3091
|
}, [balance, token]);
|
|
2234
3092
|
const spendableBalanceUsd = _react.useMemo.call(void 0, () => {
|
|
@@ -2237,7 +3095,7 @@ function SolanaAmountStep({
|
|
|
2237
3095
|
if (!Number.isFinite(spendableUnits) || spendableUnits < 0) return null;
|
|
2238
3096
|
if (tokenPriceUsd !== null) return spendableUnits * tokenPriceUsd;
|
|
2239
3097
|
return null;
|
|
2240
|
-
} catch (
|
|
3098
|
+
} catch (e24) {
|
|
2241
3099
|
return null;
|
|
2242
3100
|
}
|
|
2243
3101
|
}, [spendableBalance, token.decimals, tokenPriceUsd]);
|
|
@@ -2252,7 +3110,7 @@ function SolanaAmountStep({
|
|
|
2252
3110
|
const factor = 1e3;
|
|
2253
3111
|
const truncated = Math.floor(value * factor) / factor;
|
|
2254
3112
|
return truncated.toFixed(3).replace(/\.?0+$/, "");
|
|
2255
|
-
} catch (
|
|
3113
|
+
} catch (e25) {
|
|
2256
3114
|
return "";
|
|
2257
3115
|
}
|
|
2258
3116
|
},
|
|
@@ -2289,12 +3147,12 @@ function SolanaAmountStep({
|
|
|
2289
3147
|
const raw = isSourceStablecoin || !hasPricing ? numericAmount : numericAmount / (_nullishCoalesce(tokenPriceUsd, () => ( 1)));
|
|
2290
3148
|
try {
|
|
2291
3149
|
return _viem.parseUnits.call(void 0, raw.toString(), token.decimals);
|
|
2292
|
-
} catch (
|
|
3150
|
+
} catch (e26) {
|
|
2293
3151
|
return null;
|
|
2294
3152
|
}
|
|
2295
3153
|
}, [numericAmount, isSourceStablecoin, hasPricing, tokenPriceUsd, token.decimals]);
|
|
2296
|
-
const minDepositUsd = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess',
|
|
2297
|
-
const maxDepositUsd = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess',
|
|
3154
|
+
const minDepositUsd = targetChain === _chunkMILJQWPTcjs.HYPERCORE_CHAIN_ID ? Math.max(_chunkMILJQWPTcjs.HYPERCORE_MIN_DEPOSIT_USD, _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess', _109 => _109.minDepositUsd]), () => ( 0))) : _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess', _110 => _110.minDepositUsd]), () => ( null));
|
|
3155
|
+
const maxDepositUsd = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess', _111 => _111.maxDepositUsd]), () => ( null));
|
|
2298
3156
|
const isBelowMin = minDepositUsd !== null && numericAmount > 0 && numericAmount < minDepositUsd;
|
|
2299
3157
|
const isAboveMax = maxDepositUsd !== null && numericAmount > maxDepositUsd;
|
|
2300
3158
|
const exceedsBalance = Boolean(
|
|
@@ -2304,7 +3162,7 @@ function SolanaAmountStep({
|
|
|
2304
3162
|
const handlePresetClick = (percentage) => {
|
|
2305
3163
|
const formatted = computePresetAmount(percentage);
|
|
2306
3164
|
if (!formatted) return;
|
|
2307
|
-
|
|
3165
|
+
_chunkRABZINV3cjs.debugLog.call(void 0, debug, "solana-amount", "amount:preset", {
|
|
2308
3166
|
percentage,
|
|
2309
3167
|
symbol: token.symbol,
|
|
2310
3168
|
formatted
|
|
@@ -2338,8 +3196,8 @@ function SolanaAmountStep({
|
|
|
2338
3196
|
let amountInUnits;
|
|
2339
3197
|
try {
|
|
2340
3198
|
amountInUnits = _viem.parseUnits.call(void 0, sourceAmountStr, token.decimals);
|
|
2341
|
-
} catch (
|
|
2342
|
-
|
|
3199
|
+
} catch (e27) {
|
|
3200
|
+
_chunkRABZINV3cjs.debugLog.call(void 0, debug, "solana-amount", "amount:invalid", {
|
|
2343
3201
|
amount,
|
|
2344
3202
|
sourceAmount: sourceAmountStr,
|
|
2345
3203
|
reason: "parse-units-failed"
|
|
@@ -2348,13 +3206,13 @@ function SolanaAmountStep({
|
|
|
2348
3206
|
return;
|
|
2349
3207
|
}
|
|
2350
3208
|
if (amountInUnits > spendableBalance) {
|
|
2351
|
-
const isReserveIssue =
|
|
3209
|
+
const isReserveIssue = _chunkMILJQWPTcjs.isNativeSol.call(void 0, token) && amountInUnits <= balance;
|
|
2352
3210
|
setError(
|
|
2353
3211
|
isReserveIssue ? "Use a bit less than your full SOL balance" : "Insufficient balance"
|
|
2354
3212
|
);
|
|
2355
3213
|
return;
|
|
2356
3214
|
}
|
|
2357
|
-
|
|
3215
|
+
_chunkRABZINV3cjs.debugLog.call(void 0, debug, "solana-amount", "amount:continue", {
|
|
2358
3216
|
symbol: token.symbol,
|
|
2359
3217
|
inputAmountUsd: amount,
|
|
2360
3218
|
sourceAmount: sourceAmountStr,
|
|
@@ -2365,10 +3223,10 @@ function SolanaAmountStep({
|
|
|
2365
3223
|
};
|
|
2366
3224
|
const continueLabel = exceedsBalance ? "Insufficient balance" : isAboveMax ? "Continue with max allowed deposit" : isBelowMin ? "Continue with minimum deposit" : "Continue";
|
|
2367
3225
|
const continueDisabled = exceedsBalance || numericAmount === 0 && !isBelowMin;
|
|
2368
|
-
const sourceTokenIcon =
|
|
3226
|
+
const sourceTokenIcon = _chunkMILJQWPTcjs.getTokenIcon.call(void 0, token.symbol);
|
|
2369
3227
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-screen", children: [
|
|
2370
3228
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-screen-body rs-screen-body--gap-32", children: [
|
|
2371
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3229
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkRABZINV3cjs.BodyHeader, { icon: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkRABZINV3cjs.WalletIcon, {}), title: "Wallet deposit" }),
|
|
2372
3230
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-amount-section", children: [
|
|
2373
3231
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-amount-display", children: [
|
|
2374
3232
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
@@ -2388,13 +3246,13 @@ function SolanaAmountStep({
|
|
|
2388
3246
|
" available",
|
|
2389
3247
|
computedBalanceUsd !== null && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
2390
3248
|
" (~",
|
|
2391
|
-
|
|
3249
|
+
_chunkRABZINV3cjs.currencyFormatter.format(computedBalanceUsd),
|
|
2392
3250
|
")"
|
|
2393
3251
|
] })
|
|
2394
3252
|
] }),
|
|
2395
3253
|
minDepositUsd !== null && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "rs-amount-meta-minimum", children: [
|
|
2396
3254
|
"Min. deposit ",
|
|
2397
|
-
|
|
3255
|
+
_chunkRABZINV3cjs.currencyFormatter.format(minDepositUsd)
|
|
2398
3256
|
] })
|
|
2399
3257
|
] })
|
|
2400
3258
|
] }),
|
|
@@ -2433,12 +3291,13 @@ function SolanaAmountStep({
|
|
|
2433
3291
|
] }),
|
|
2434
3292
|
balanceAfterUsd !== null && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-amount-detail-row", children: [
|
|
2435
3293
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: "Balance after deposit" }),
|
|
2436
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-amount-detail-value", children:
|
|
3294
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-amount-detail-value", children: _chunkRABZINV3cjs.currencyFormatter.format(balanceAfterUsd) })
|
|
2437
3295
|
] })
|
|
2438
3296
|
] }),
|
|
2439
|
-
|
|
3297
|
+
targetChain === _chunkMILJQWPTcjs.HYPERCORE_CHAIN_ID && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkRABZINV3cjs.Callout, { variant: "warning", children: "First deposit to a new HyperCore account includes a ~1 USDC activation fee." }),
|
|
3298
|
+
error && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkRABZINV3cjs.Callout, { variant: "error", children: error }),
|
|
2440
3299
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2441
|
-
|
|
3300
|
+
_chunkRABZINV3cjs.Button,
|
|
2442
3301
|
{
|
|
2443
3302
|
onClick: handleContinue,
|
|
2444
3303
|
fullWidth: true,
|
|
@@ -2447,7 +3306,7 @@ function SolanaAmountStep({
|
|
|
2447
3306
|
}
|
|
2448
3307
|
)
|
|
2449
3308
|
] }),
|
|
2450
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3309
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkRABZINV3cjs.PoweredBy, {})
|
|
2451
3310
|
] });
|
|
2452
3311
|
}
|
|
2453
3312
|
|
|
@@ -2471,7 +3330,7 @@ var DEFAULT_SOLANA_RPC_URL = "https://api.mainnet.solana.com";
|
|
|
2471
3330
|
var configuredSolanaRpcUrl = null;
|
|
2472
3331
|
var cachedConnections = /* @__PURE__ */ new Map();
|
|
2473
3332
|
function configureSolanaRpcUrl(rpcUrl) {
|
|
2474
|
-
const normalized = _optionalChain([rpcUrl, 'optionalAccess',
|
|
3333
|
+
const normalized = _optionalChain([rpcUrl, 'optionalAccess', _112 => _112.trim, 'call', _113 => _113()]);
|
|
2475
3334
|
configuredSolanaRpcUrl = normalized ? normalized : null;
|
|
2476
3335
|
cachedConnections.clear();
|
|
2477
3336
|
}
|
|
@@ -2583,17 +3442,20 @@ function SolanaConfirmStep({
|
|
|
2583
3442
|
}) {
|
|
2584
3443
|
const [isSubmitting, setIsSubmitting] = _react.useState.call(void 0, false);
|
|
2585
3444
|
const [error, setError] = _react.useState.call(void 0, null);
|
|
2586
|
-
const targetSymbol =
|
|
3445
|
+
const targetSymbol = _chunkMILJQWPTcjs.getTargetTokenSymbol.call(void 0, targetToken, targetChain);
|
|
2587
3446
|
const isSameToken = token.symbol.toUpperCase() === targetSymbol.toUpperCase();
|
|
2588
|
-
const sourceChainName =
|
|
2589
|
-
const targetChainName =
|
|
2590
|
-
const sourceChainIcon =
|
|
2591
|
-
const targetChainIcon =
|
|
2592
|
-
const sourceTokenIcon =
|
|
2593
|
-
const targetTokenIcon =
|
|
2594
|
-
const feeSponsored = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess',
|
|
2595
|
-
const feeTooltip = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess',
|
|
2596
|
-
const formattedAmount = sourceAmount && !Number.isNaN(Number(sourceAmount)) ? Number(sourceAmount).toLocaleString("en-US", {
|
|
3447
|
+
const sourceChainName = _chunkMILJQWPTcjs.getChainName.call(void 0, "solana");
|
|
3448
|
+
const targetChainName = _chunkMILJQWPTcjs.getChainName.call(void 0, targetChain);
|
|
3449
|
+
const sourceChainIcon = _chunkMILJQWPTcjs.getChainIcon.call(void 0, "solana");
|
|
3450
|
+
const targetChainIcon = _chunkMILJQWPTcjs.getChainIcon.call(void 0, targetChain);
|
|
3451
|
+
const sourceTokenIcon = _chunkMILJQWPTcjs.getTokenIcon.call(void 0, token.symbol);
|
|
3452
|
+
const targetTokenIcon = _chunkMILJQWPTcjs.getTokenIcon.call(void 0, targetSymbol);
|
|
3453
|
+
const feeSponsored = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess', _114 => _114.feeSponsored]), () => ( false));
|
|
3454
|
+
const feeTooltip = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess', _115 => _115.feeTooltip]), () => ( (feeSponsored ? "Network fees are sponsored for this deposit." : "Network fees apply.")));
|
|
3455
|
+
const formattedAmount = sourceAmount && !Number.isNaN(Number(sourceAmount)) ? Number(sourceAmount).toLocaleString("en-US", {
|
|
3456
|
+
minimumFractionDigits: 2,
|
|
3457
|
+
maximumFractionDigits: 6
|
|
3458
|
+
}) : "0";
|
|
2597
3459
|
const formattedReceiveAmount = (() => {
|
|
2598
3460
|
if (isSameToken) return formattedAmount;
|
|
2599
3461
|
const dollarValue = Number(targetAmount);
|
|
@@ -2601,14 +3463,17 @@ function SolanaConfirmStep({
|
|
|
2601
3463
|
return formattedAmount;
|
|
2602
3464
|
if (targetTokenPriceUsd !== null && targetTokenPriceUsd > 0) {
|
|
2603
3465
|
const tokenAmount = dollarValue / targetTokenPriceUsd;
|
|
2604
|
-
return tokenAmount.toLocaleString("en-US", {
|
|
3466
|
+
return tokenAmount.toLocaleString("en-US", {
|
|
3467
|
+
minimumFractionDigits: 2,
|
|
3468
|
+
maximumFractionDigits: 6
|
|
3469
|
+
});
|
|
2605
3470
|
}
|
|
2606
3471
|
return formattedAmount;
|
|
2607
3472
|
})();
|
|
2608
3473
|
const receiveAmount = isSameToken ? formattedReceiveAmount : `~${formattedReceiveAmount}`;
|
|
2609
3474
|
const handleConfirm = async () => {
|
|
2610
3475
|
if (!solanaProvider) {
|
|
2611
|
-
|
|
3476
|
+
_chunkRABZINV3cjs.debugLog.call(void 0, debug, "solana-confirm", "submit:blocked", {
|
|
2612
3477
|
reason: "missing-provider"
|
|
2613
3478
|
});
|
|
2614
3479
|
setError("Solana wallet not connected");
|
|
@@ -2616,7 +3481,7 @@ function SolanaConfirmStep({
|
|
|
2616
3481
|
}
|
|
2617
3482
|
const parsedAmount = parseFloat(sourceAmount);
|
|
2618
3483
|
if (isNaN(parsedAmount) || parsedAmount <= 0) {
|
|
2619
|
-
|
|
3484
|
+
_chunkRABZINV3cjs.debugLog.call(void 0, debug, "solana-confirm", "submit:blocked", {
|
|
2620
3485
|
reason: "invalid-amount",
|
|
2621
3486
|
sourceAmount
|
|
2622
3487
|
});
|
|
@@ -2625,7 +3490,7 @@ function SolanaConfirmStep({
|
|
|
2625
3490
|
}
|
|
2626
3491
|
setError(null);
|
|
2627
3492
|
setIsSubmitting(true);
|
|
2628
|
-
|
|
3493
|
+
_chunkRABZINV3cjs.debugLog.call(void 0, debug, "solana-confirm", "submit:start", {
|
|
2629
3494
|
smartAccount,
|
|
2630
3495
|
solanaAddress,
|
|
2631
3496
|
solanaDepositAddress,
|
|
@@ -2635,7 +3500,7 @@ function SolanaConfirmStep({
|
|
|
2635
3500
|
});
|
|
2636
3501
|
try {
|
|
2637
3502
|
const check = await service.checkAccount(smartAccount);
|
|
2638
|
-
|
|
3503
|
+
_chunkRABZINV3cjs.debugLog.call(void 0, debug, "solana-confirm", "check:success", {
|
|
2639
3504
|
smartAccount,
|
|
2640
3505
|
isRegistered: check.isRegistered,
|
|
2641
3506
|
targetChain: check.targetChain,
|
|
@@ -2648,12 +3513,12 @@ function SolanaConfirmStep({
|
|
|
2648
3513
|
}
|
|
2649
3514
|
const connection = hasConfiguredSolanaRpcUrl() ? getSolanaConnection() : _nullishCoalesce(solanaConnection, () => ( getSolanaConnection()));
|
|
2650
3515
|
const amountUnits = _viem.parseUnits.call(void 0, sourceAmount, token.decimals);
|
|
2651
|
-
|
|
3516
|
+
_chunkRABZINV3cjs.debugLog.call(void 0, debug, "solana-confirm", "tx:build:start", {
|
|
2652
3517
|
token: token.symbol,
|
|
2653
3518
|
sourceAmount,
|
|
2654
3519
|
amountUnits: amountUnits.toString()
|
|
2655
3520
|
});
|
|
2656
|
-
const transaction =
|
|
3521
|
+
const transaction = _chunkMILJQWPTcjs.isNativeSol.call(void 0, token) ? await buildSolTransferTransaction(
|
|
2657
3522
|
connection,
|
|
2658
3523
|
solanaAddress,
|
|
2659
3524
|
solanaDepositAddress,
|
|
@@ -2665,10 +3530,10 @@ function SolanaConfirmStep({
|
|
|
2665
3530
|
token.mint,
|
|
2666
3531
|
amountUnits
|
|
2667
3532
|
);
|
|
2668
|
-
|
|
3533
|
+
_chunkRABZINV3cjs.debugLog.call(void 0, debug, "solana-confirm", "tx:build:success", {
|
|
2669
3534
|
token: token.symbol,
|
|
2670
3535
|
instructionCount: transaction.instructions.length,
|
|
2671
|
-
feePayer: _optionalChain([transaction, 'access',
|
|
3536
|
+
feePayer: _optionalChain([transaction, 'access', _116 => _116.feePayer, 'optionalAccess', _117 => _117.toBase58, 'call', _118 => _118()]),
|
|
2672
3537
|
recentBlockhash: transaction.recentBlockhash
|
|
2673
3538
|
});
|
|
2674
3539
|
const txHash = await sendSolanaTransaction(
|
|
@@ -2676,28 +3541,28 @@ function SolanaConfirmStep({
|
|
|
2676
3541
|
connection,
|
|
2677
3542
|
transaction
|
|
2678
3543
|
);
|
|
2679
|
-
|
|
3544
|
+
_chunkRABZINV3cjs.debugLog.call(void 0, debug, "solana-confirm", "tx:sent", {
|
|
2680
3545
|
txHash,
|
|
2681
3546
|
amountUnits: amountUnits.toString()
|
|
2682
3547
|
});
|
|
2683
3548
|
onConfirm(txHash, amountUnits.toString());
|
|
2684
3549
|
} catch (err) {
|
|
2685
3550
|
const raw = err instanceof Error ? err.message : "Transfer failed";
|
|
2686
|
-
const message =
|
|
2687
|
-
|
|
3551
|
+
const message = _chunkRABZINV3cjs.formatUserError.call(void 0, raw);
|
|
3552
|
+
_chunkRABZINV3cjs.debugError.call(void 0, debug, "solana-confirm", "submit:failure", err, {
|
|
2688
3553
|
smartAccount,
|
|
2689
3554
|
token: token.symbol,
|
|
2690
3555
|
sourceAmount
|
|
2691
3556
|
});
|
|
2692
3557
|
setError(message);
|
|
2693
|
-
_optionalChain([onError, 'optionalCall',
|
|
3558
|
+
_optionalChain([onError, 'optionalCall', _119 => _119(message, "SOLANA_TRANSFER_ERROR")]);
|
|
2694
3559
|
} finally {
|
|
2695
3560
|
setIsSubmitting(false);
|
|
2696
3561
|
}
|
|
2697
3562
|
};
|
|
2698
3563
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-screen", children: [
|
|
2699
3564
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-screen-body rs-screen-body--gap-32", children: [
|
|
2700
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3565
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkRABZINV3cjs.BodyHeader, { icon: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkRABZINV3cjs.WalletIcon, {}), title: "Review deposit" }),
|
|
2701
3566
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-review-details", children: [
|
|
2702
3567
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-review-detail-row", children: [
|
|
2703
3568
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: "Source chain" }),
|
|
@@ -2749,13 +3614,13 @@ function SolanaConfirmStep({
|
|
|
2749
3614
|
children: "$0.04"
|
|
2750
3615
|
}
|
|
2751
3616
|
),
|
|
2752
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3617
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkRABZINV3cjs.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, _chunkRABZINV3cjs.InfoIcon, {}) }) })
|
|
2753
3618
|
] })
|
|
2754
3619
|
] })
|
|
2755
3620
|
] }),
|
|
2756
|
-
error && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3621
|
+
error && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkRABZINV3cjs.Callout, { variant: "error", children: error }),
|
|
2757
3622
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2758
|
-
|
|
3623
|
+
_chunkRABZINV3cjs.Button,
|
|
2759
3624
|
{
|
|
2760
3625
|
onClick: handleConfirm,
|
|
2761
3626
|
loading: isSubmitting,
|
|
@@ -2766,7 +3631,7 @@ function SolanaConfirmStep({
|
|
|
2766
3631
|
}
|
|
2767
3632
|
)
|
|
2768
3633
|
] }),
|
|
2769
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3634
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkRABZINV3cjs.PoweredBy, {})
|
|
2770
3635
|
] });
|
|
2771
3636
|
}
|
|
2772
3637
|
|
|
@@ -2780,21 +3645,21 @@ function DappImportAssetSelectStep({
|
|
|
2780
3645
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-screen", children: [
|
|
2781
3646
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-screen-body rs-screen-body--gap-32", children: [
|
|
2782
3647
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2783
|
-
|
|
3648
|
+
_chunkRABZINV3cjs.BodyHeader,
|
|
2784
3649
|
{
|
|
2785
|
-
icon: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3650
|
+
icon: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkRABZINV3cjs.WalletIcon, {}),
|
|
2786
3651
|
title: `Transfer from ${sourceLabel}`,
|
|
2787
3652
|
subtitle: "Pick the balance to import"
|
|
2788
3653
|
}
|
|
2789
3654
|
),
|
|
2790
3655
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-asset-list", children: assets.map((asset) => {
|
|
2791
|
-
const tokenAmount = asset.balance ?
|
|
3656
|
+
const tokenAmount = asset.balance ? _chunkRABZINV3cjs.tokenFormatter.format(
|
|
2792
3657
|
Number(asset.balance) / 10 ** asset.decimals
|
|
2793
3658
|
) : "0";
|
|
2794
|
-
const balanceUsd = asset.balanceUsd && asset.balanceUsd > 0 ?
|
|
2795
|
-
const tokenIcon = _nullishCoalesce(asset.icon, () => (
|
|
2796
|
-
const chainIcon =
|
|
2797
|
-
const badge =
|
|
3659
|
+
const balanceUsd = asset.balanceUsd && asset.balanceUsd > 0 ? _chunkRABZINV3cjs.currencyFormatter.format(asset.balanceUsd) : `${tokenAmount} ${asset.symbol}`;
|
|
3660
|
+
const tokenIcon = _nullishCoalesce(asset.icon, () => ( _chunkMILJQWPTcjs.getTokenIcon.call(void 0, asset.symbol)));
|
|
3661
|
+
const chainIcon = _chunkMILJQWPTcjs.getChainIcon.call(void 0, asset.chainId);
|
|
3662
|
+
const badge = _chunkMILJQWPTcjs.getChainBadge.call(void 0, asset.chainId);
|
|
2798
3663
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2799
3664
|
"button",
|
|
2800
3665
|
{
|
|
@@ -2809,7 +3674,7 @@ function DappImportAssetSelectStep({
|
|
|
2809
3674
|
"img",
|
|
2810
3675
|
{
|
|
2811
3676
|
src: chainIcon,
|
|
2812
|
-
alt:
|
|
3677
|
+
alt: _chunkMILJQWPTcjs.getChainName.call(void 0, asset.chainId)
|
|
2813
3678
|
}
|
|
2814
3679
|
) }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2815
3680
|
"span",
|
|
@@ -2842,7 +3707,7 @@ function DappImportAssetSelectStep({
|
|
|
2842
3707
|
);
|
|
2843
3708
|
}) })
|
|
2844
3709
|
] }),
|
|
2845
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3710
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkRABZINV3cjs.PoweredBy, {})
|
|
2846
3711
|
] });
|
|
2847
3712
|
}
|
|
2848
3713
|
DappImportAssetSelectStep.displayName = "DappImportAssetSelectStep";
|
|
@@ -2908,7 +3773,7 @@ async function detectPolymarketWalletKind(params) {
|
|
|
2908
3773
|
contracts: [
|
|
2909
3774
|
{
|
|
2910
3775
|
address: proxyWallet,
|
|
2911
|
-
abi:
|
|
3776
|
+
abi: _chunkRABZINV3cjs.SAFE_ABI,
|
|
2912
3777
|
functionName: "isOwner",
|
|
2913
3778
|
args: [eoa]
|
|
2914
3779
|
},
|
|
@@ -3033,7 +3898,7 @@ async function fetchPolymarketProxyWallet(eoa, signal) {
|
|
|
3033
3898
|
let response;
|
|
3034
3899
|
try {
|
|
3035
3900
|
response = await fetch(url, { signal });
|
|
3036
|
-
} catch (
|
|
3901
|
+
} catch (e28) {
|
|
3037
3902
|
return null;
|
|
3038
3903
|
}
|
|
3039
3904
|
if (!response.ok) {
|
|
@@ -3042,7 +3907,7 @@ async function fetchPolymarketProxyWallet(eoa, signal) {
|
|
|
3042
3907
|
let payload;
|
|
3043
3908
|
try {
|
|
3044
3909
|
payload = await response.json();
|
|
3045
|
-
} catch (
|
|
3910
|
+
} catch (e29) {
|
|
3046
3911
|
return null;
|
|
3047
3912
|
}
|
|
3048
3913
|
const raw = payload.proxyWallet;
|
|
@@ -3096,7 +3961,7 @@ async function readPolymarketBalances(params) {
|
|
|
3096
3961
|
pusd: results[0].status === "success" ? results[0].result : 0n,
|
|
3097
3962
|
usdce: results[1].status === "success" ? results[1].result : 0n
|
|
3098
3963
|
};
|
|
3099
|
-
} catch (
|
|
3964
|
+
} catch (e30) {
|
|
3100
3965
|
return { pusd: 0n, usdce: 0n };
|
|
3101
3966
|
}
|
|
3102
3967
|
}
|
|
@@ -3119,7 +3984,7 @@ async function executePolymarketSafeTransfer(params) {
|
|
|
3119
3984
|
}
|
|
3120
3985
|
const isOwner = await publicClient.readContract({
|
|
3121
3986
|
address: safeAddress,
|
|
3122
|
-
abi:
|
|
3987
|
+
abi: _chunkRABZINV3cjs.SAFE_ABI,
|
|
3123
3988
|
functionName: "isOwner",
|
|
3124
3989
|
args: [account.address]
|
|
3125
3990
|
});
|
|
@@ -3136,7 +4001,7 @@ async function executePolymarketSafeTransfer(params) {
|
|
|
3136
4001
|
account,
|
|
3137
4002
|
chain,
|
|
3138
4003
|
address: safeAddress,
|
|
3139
|
-
abi:
|
|
4004
|
+
abi: _chunkRABZINV3cjs.SAFE_ABI,
|
|
3140
4005
|
functionName: "execTransaction",
|
|
3141
4006
|
args: [
|
|
3142
4007
|
safeTx.to,
|
|
@@ -3155,7 +4020,7 @@ async function executePolymarketSafeTransfer(params) {
|
|
|
3155
4020
|
hash: txHash
|
|
3156
4021
|
});
|
|
3157
4022
|
const parsed = _viem.parseEventLogs.call(void 0, {
|
|
3158
|
-
abi:
|
|
4023
|
+
abi: _chunkRABZINV3cjs.SAFE_ABI,
|
|
3159
4024
|
logs: receipt.logs.filter(
|
|
3160
4025
|
(log) => log.address.toLowerCase() === safeAddress.toLowerCase()
|
|
3161
4026
|
),
|
|
@@ -3233,21 +4098,21 @@ var polymarketProvider = {
|
|
|
3233
4098
|
async fetchAvailability({ eoa, getPublicClient: getPublicClient2, signal }) {
|
|
3234
4099
|
const proxyWallet = await fetchPolymarketProxyWallet(eoa, signal);
|
|
3235
4100
|
if (!proxyWallet) return null;
|
|
3236
|
-
if (_optionalChain([signal, 'optionalAccess',
|
|
4101
|
+
if (_optionalChain([signal, 'optionalAccess', _120 => _120.aborted])) return null;
|
|
3237
4102
|
const polygonClient = getPublicClient2(POLYMARKET_POLYGON_CHAIN_ID);
|
|
3238
4103
|
if (!polygonClient) return null;
|
|
3239
4104
|
const balances = await readPolymarketBalances({
|
|
3240
4105
|
publicClient: polygonClient,
|
|
3241
4106
|
proxyWallet
|
|
3242
4107
|
});
|
|
3243
|
-
if (_optionalChain([signal, 'optionalAccess',
|
|
4108
|
+
if (_optionalChain([signal, 'optionalAccess', _121 => _121.aborted])) return null;
|
|
3244
4109
|
if (balances.pusd === 0n && balances.usdce === 0n) return null;
|
|
3245
4110
|
const walletKind = await detectPolymarketWalletKind({
|
|
3246
4111
|
publicClient: polygonClient,
|
|
3247
4112
|
proxyWallet,
|
|
3248
4113
|
eoa
|
|
3249
4114
|
});
|
|
3250
|
-
if (_optionalChain([signal, 'optionalAccess',
|
|
4115
|
+
if (_optionalChain([signal, 'optionalAccess', _122 => _122.aborted])) return null;
|
|
3251
4116
|
if (!walletKind) return null;
|
|
3252
4117
|
const assets = [];
|
|
3253
4118
|
if (balances.pusd > 0n) {
|
|
@@ -3411,6 +4276,7 @@ function applyBack(state, hasWalletOptions) {
|
|
|
3411
4276
|
targetAmount: null,
|
|
3412
4277
|
targetTokenPriceUsd: null,
|
|
3413
4278
|
balance: null,
|
|
4279
|
+
inputAmountUsd: null,
|
|
3414
4280
|
liquidityWarning: null
|
|
3415
4281
|
},
|
|
3416
4282
|
flow: {
|
|
@@ -3456,8 +4322,19 @@ function applyBack(state, hasWalletOptions) {
|
|
|
3456
4322
|
},
|
|
3457
4323
|
flow: { ...state.flow, step: "solana-amount", hasNavigatedBack: true }
|
|
3458
4324
|
};
|
|
4325
|
+
case "exchange-connect":
|
|
4326
|
+
return {
|
|
4327
|
+
...state,
|
|
4328
|
+
flow: {
|
|
4329
|
+
...state.flow,
|
|
4330
|
+
step: "exchange-select",
|
|
4331
|
+
hasNavigatedBack: true
|
|
4332
|
+
}
|
|
4333
|
+
};
|
|
3459
4334
|
case "select-asset":
|
|
3460
4335
|
case "deposit-address":
|
|
4336
|
+
case "fiat-onramp":
|
|
4337
|
+
case "exchange-select":
|
|
3461
4338
|
case "solana-token-select":
|
|
3462
4339
|
case "dapp-import-asset-select":
|
|
3463
4340
|
return {
|
|
@@ -3474,7 +4351,8 @@ function applyBack(state, hasWalletOptions) {
|
|
|
3474
4351
|
...state.dappImport,
|
|
3475
4352
|
activeProviderId: null,
|
|
3476
4353
|
selectedAsset: null
|
|
3477
|
-
}
|
|
4354
|
+
},
|
|
4355
|
+
exchange: { selectedConnection: null }
|
|
3478
4356
|
};
|
|
3479
4357
|
case "connect":
|
|
3480
4358
|
case "setup":
|
|
@@ -3487,7 +4365,8 @@ function applyBack(state, hasWalletOptions) {
|
|
|
3487
4365
|
mode: null,
|
|
3488
4366
|
isConnectSelectionConfirmed: false,
|
|
3489
4367
|
hasNavigatedBack: hasWalletOptions || state.flow.hasNavigatedBack
|
|
3490
|
-
}
|
|
4368
|
+
},
|
|
4369
|
+
exchange: { selectedConnection: null }
|
|
3491
4370
|
};
|
|
3492
4371
|
}
|
|
3493
4372
|
return state;
|
|
@@ -3507,6 +4386,10 @@ function modeEntryStep(mode) {
|
|
|
3507
4386
|
return "solana-token-select";
|
|
3508
4387
|
case "dapp-import":
|
|
3509
4388
|
return "dapp-import-asset-select";
|
|
4389
|
+
case "fiat-onramp":
|
|
4390
|
+
return "fiat-onramp";
|
|
4391
|
+
case "exchange-connect":
|
|
4392
|
+
return "exchange-select";
|
|
3510
4393
|
}
|
|
3511
4394
|
}
|
|
3512
4395
|
function updateSetupEntry(state, owner, update) {
|
|
@@ -3552,7 +4435,8 @@ function applyAction(state, action) {
|
|
|
3552
4435
|
...state.dappImport,
|
|
3553
4436
|
activeProviderId: null,
|
|
3554
4437
|
selectedAsset: null
|
|
3555
|
-
}
|
|
4438
|
+
},
|
|
4439
|
+
exchange: { selectedConnection: null }
|
|
3556
4440
|
};
|
|
3557
4441
|
case "connect/wallet-confirmed":
|
|
3558
4442
|
if (!action.mode) return state;
|
|
@@ -3576,6 +4460,39 @@ function applyAction(state, action) {
|
|
|
3576
4460
|
step: "deposit-address"
|
|
3577
4461
|
}
|
|
3578
4462
|
};
|
|
4463
|
+
case "connect/fiat-onramp-selected":
|
|
4464
|
+
return {
|
|
4465
|
+
...state,
|
|
4466
|
+
flow: {
|
|
4467
|
+
...state.flow,
|
|
4468
|
+
mode: "fiat-onramp",
|
|
4469
|
+
isConnectSelectionConfirmed: true,
|
|
4470
|
+
step: modeEntryStep("fiat-onramp")
|
|
4471
|
+
},
|
|
4472
|
+
fiat: { ...state.fiat, selectedMethod: _nullishCoalesce(action.paymentMethod, () => ( null)) }
|
|
4473
|
+
};
|
|
4474
|
+
case "connect/exchange-selected":
|
|
4475
|
+
return {
|
|
4476
|
+
...state,
|
|
4477
|
+
flow: {
|
|
4478
|
+
...state.flow,
|
|
4479
|
+
mode: "exchange-connect",
|
|
4480
|
+
isConnectSelectionConfirmed: true,
|
|
4481
|
+
step: modeEntryStep("exchange-connect")
|
|
4482
|
+
},
|
|
4483
|
+
exchange: { selectedConnection: null }
|
|
4484
|
+
};
|
|
4485
|
+
case "exchange/connection-selected":
|
|
4486
|
+
return {
|
|
4487
|
+
...state,
|
|
4488
|
+
flow: {
|
|
4489
|
+
...state.flow,
|
|
4490
|
+
mode: "exchange-connect",
|
|
4491
|
+
isConnectSelectionConfirmed: true,
|
|
4492
|
+
step: "exchange-connect"
|
|
4493
|
+
},
|
|
4494
|
+
exchange: { selectedConnection: action.connection }
|
|
4495
|
+
};
|
|
3579
4496
|
case "connect/auto-locked":
|
|
3580
4497
|
return {
|
|
3581
4498
|
...state,
|
|
@@ -3601,7 +4518,8 @@ function applyAction(state, action) {
|
|
|
3601
4518
|
...state.dappImport,
|
|
3602
4519
|
activeProviderId: null,
|
|
3603
4520
|
selectedAsset: null
|
|
3604
|
-
}
|
|
4521
|
+
},
|
|
4522
|
+
exchange: { selectedConnection: null }
|
|
3605
4523
|
};
|
|
3606
4524
|
case "setup/started": {
|
|
3607
4525
|
const existing = state.setup.byOwner[ownerKey(action.owner)];
|
|
@@ -3610,12 +4528,12 @@ function applyAction(state, action) {
|
|
|
3610
4528
|
requestKey: action.requestKey,
|
|
3611
4529
|
cacheKey: action.cacheKey,
|
|
3612
4530
|
status: "loading",
|
|
3613
|
-
smartAccount: _nullishCoalesce(_optionalChain([existing, 'optionalAccess',
|
|
3614
|
-
sessionOwnerAddress: _nullishCoalesce(_optionalChain([existing, 'optionalAccess',
|
|
3615
|
-
solanaDepositAddress: _nullishCoalesce(_optionalChain([existing, 'optionalAccess',
|
|
4531
|
+
smartAccount: _nullishCoalesce(_optionalChain([existing, 'optionalAccess', _123 => _123.smartAccount]), () => ( null)),
|
|
4532
|
+
sessionOwnerAddress: _nullishCoalesce(_optionalChain([existing, 'optionalAccess', _124 => _124.sessionOwnerAddress]), () => ( null)),
|
|
4533
|
+
solanaDepositAddress: _nullishCoalesce(_optionalChain([existing, 'optionalAccess', _125 => _125.solanaDepositAddress]), () => ( null)),
|
|
3616
4534
|
message: null,
|
|
3617
4535
|
cacheable: action.cacheable,
|
|
3618
|
-
attemptNonce: _nullishCoalesce(_optionalChain([existing, 'optionalAccess',
|
|
4536
|
+
attemptNonce: _nullishCoalesce(_optionalChain([existing, 'optionalAccess', _126 => _126.attemptNonce]), () => ( 0))
|
|
3619
4537
|
}));
|
|
3620
4538
|
}
|
|
3621
4539
|
case "setup/ready": {
|
|
@@ -3666,7 +4584,11 @@ function applyAction(state, action) {
|
|
|
3666
4584
|
selectedAsset: action.asset,
|
|
3667
4585
|
// Seed the user-facing amount input with the modal's defaultAmount
|
|
3668
4586
|
// on first visit. Subsequent visits override via amount/entered.
|
|
3669
|
-
|
|
4587
|
+
// `inputAmountUsd` is the USD-style value the input shows; it (not
|
|
4588
|
+
// the native `amount`) is what re-seeds the input on back, so seed
|
|
4589
|
+
// it here too and reset it on a fresh pick.
|
|
4590
|
+
amount: _nullishCoalesce(action.seedAmount, () => ( state.deposit.amount)),
|
|
4591
|
+
inputAmountUsd: _nullishCoalesce(action.seedAmount, () => ( null))
|
|
3670
4592
|
},
|
|
3671
4593
|
flow: { ...state.flow, step: "amount" }
|
|
3672
4594
|
};
|
|
@@ -3679,6 +4601,11 @@ function applyAction(state, action) {
|
|
|
3679
4601
|
targetAmount: action.targetAmount,
|
|
3680
4602
|
targetTokenPriceUsd: action.targetTokenPriceUsd,
|
|
3681
4603
|
balance: _nullishCoalesce(action.balance, () => ( null)),
|
|
4604
|
+
// `targetAmount` is the USD-style value the user typed. Preserve it
|
|
4605
|
+
// as `inputAmountUsd` so back-from-confirm re-seeds the input with
|
|
4606
|
+
// the typed USD value rather than the converted native `amount`
|
|
4607
|
+
// (which corrupts the input for non-stablecoin priced tokens).
|
|
4608
|
+
inputAmountUsd: action.targetAmount,
|
|
3682
4609
|
liquidityWarning: _nullishCoalesce(action.liquidityWarning, () => ( null))
|
|
3683
4610
|
},
|
|
3684
4611
|
flow: { ...state.flow, step: "confirm" }
|
|
@@ -3719,7 +4646,11 @@ function applyAction(state, action) {
|
|
|
3719
4646
|
sourceChain: action.sourceChain,
|
|
3720
4647
|
sourceToken: _nullishCoalesce(action.sourceToken, () => ( null)),
|
|
3721
4648
|
sourceSymbol: _nullishCoalesce(action.sourceSymbol, () => ( null)),
|
|
3722
|
-
sourceDecimals: _nullishCoalesce(action.sourceDecimals, () => ( null))
|
|
4649
|
+
sourceDecimals: _nullishCoalesce(action.sourceDecimals, () => ( null)),
|
|
4650
|
+
// The submit site's declared USD value, not the lingering typed
|
|
4651
|
+
// input — a submit that doesn't know it (fiat onramp) must not
|
|
4652
|
+
// inherit one from an abandoned wallet attempt.
|
|
4653
|
+
inputAmountUsd: _nullishCoalesce(action.inputAmountUsd, () => ( null))
|
|
3723
4654
|
},
|
|
3724
4655
|
processing: {
|
|
3725
4656
|
...state.processing,
|
|
@@ -3827,7 +4758,9 @@ function applyAction(state, action) {
|
|
|
3827
4758
|
activeProviderId: null,
|
|
3828
4759
|
selectedAsset: null
|
|
3829
4760
|
},
|
|
3830
|
-
setup: { byOwner: preservedByOwner }
|
|
4761
|
+
setup: { byOwner: preservedByOwner },
|
|
4762
|
+
fiat: { selectedMethod: null },
|
|
4763
|
+
exchange: { selectedConnection: null }
|
|
3831
4764
|
};
|
|
3832
4765
|
}
|
|
3833
4766
|
case "target/changed": {
|
|
@@ -3901,6 +4834,12 @@ function createInitialState(overrides) {
|
|
|
3901
4834
|
},
|
|
3902
4835
|
setup: {
|
|
3903
4836
|
byOwner: {}
|
|
4837
|
+
},
|
|
4838
|
+
fiat: {
|
|
4839
|
+
selectedMethod: null
|
|
4840
|
+
},
|
|
4841
|
+
exchange: {
|
|
4842
|
+
selectedConnection: null
|
|
3904
4843
|
}
|
|
3905
4844
|
};
|
|
3906
4845
|
}
|
|
@@ -3969,15 +4908,15 @@ var SetupError = class extends Error {
|
|
|
3969
4908
|
}
|
|
3970
4909
|
};
|
|
3971
4910
|
async function resolveSessionOwner(eoaAddress) {
|
|
3972
|
-
const local =
|
|
4911
|
+
const local = _chunkRABZINV3cjs.loadSessionOwnerFromStorage.call(void 0, eoaAddress);
|
|
3973
4912
|
if (local) {
|
|
3974
4913
|
return {
|
|
3975
|
-
account:
|
|
4914
|
+
account: _chunkRABZINV3cjs.accountFromPrivateKey.call(void 0, local.privateKey),
|
|
3976
4915
|
address: local.address
|
|
3977
4916
|
};
|
|
3978
4917
|
}
|
|
3979
|
-
const created =
|
|
3980
|
-
|
|
4918
|
+
const created = _chunkRABZINV3cjs.createSessionOwnerKey.call(void 0, );
|
|
4919
|
+
_chunkRABZINV3cjs.saveSessionOwnerToStorage.call(void 0, eoaAddress, created.privateKey, created.address);
|
|
3981
4920
|
return { account: created.account, address: created.address };
|
|
3982
4921
|
}
|
|
3983
4922
|
function stableStringify(value) {
|
|
@@ -4027,14 +4966,14 @@ function computeCacheKey(input, sessionOwnerAddress) {
|
|
|
4027
4966
|
});
|
|
4028
4967
|
}
|
|
4029
4968
|
function computeIsCacheable(input) {
|
|
4030
|
-
return !input.forceRegister && !(_nullishCoalesce(_optionalChain([input, 'access',
|
|
4969
|
+
return !input.forceRegister && !(_nullishCoalesce(_optionalChain([input, 'access', _127 => _127.postBridgeActions, 'optionalAccess', _128 => _128.length]), () => ( 0)));
|
|
4031
4970
|
}
|
|
4032
4971
|
var SETUP_REQUEST_DEDUPE_TTL_MS = 3e4;
|
|
4033
4972
|
var setupRequestDedupe = /* @__PURE__ */ new Map();
|
|
4034
4973
|
function readDedupedAccountSetupResult(requestKey) {
|
|
4035
4974
|
const now = Date.now();
|
|
4036
4975
|
const existing = setupRequestDedupe.get(requestKey);
|
|
4037
|
-
if (_optionalChain([existing, 'optionalAccess',
|
|
4976
|
+
if (_optionalChain([existing, 'optionalAccess', _129 => _129.settled]) && existing.expiresAt > now && existing.result) {
|
|
4038
4977
|
return existing.result;
|
|
4039
4978
|
}
|
|
4040
4979
|
return null;
|
|
@@ -4045,16 +4984,16 @@ async function runAccountSetup(input, deps) {
|
|
|
4045
4984
|
try {
|
|
4046
4985
|
const sessionOwner = await resolveSessionOwner(input.ownerAddress);
|
|
4047
4986
|
const cacheKey = computeCacheKey(input, sessionOwner.address);
|
|
4048
|
-
|
|
4987
|
+
_chunkRABZINV3cjs.debugLog.call(void 0, debug, "account-setup", "setup:start", {
|
|
4049
4988
|
owner: input.ownerAddress,
|
|
4050
4989
|
sessionOwner: sessionOwner.address,
|
|
4051
|
-
hasPostBridgeActions: Boolean(_optionalChain([input, 'access',
|
|
4990
|
+
hasPostBridgeActions: Boolean(_optionalChain([input, 'access', _130 => _130.postBridgeActions, 'optionalAccess', _131 => _131.length])),
|
|
4052
4991
|
forceRegister: _nullishCoalesce(input.forceRegister, () => ( false))
|
|
4053
4992
|
});
|
|
4054
4993
|
const setup = await service.setupAccount({
|
|
4055
4994
|
ownerAddress: input.ownerAddress,
|
|
4056
4995
|
sessionOwnerAddress: sessionOwner.address,
|
|
4057
|
-
targetChain:
|
|
4996
|
+
targetChain: _chunkMILJQWPTcjs.targetChainToCaip2.call(void 0, input.targetChain),
|
|
4058
4997
|
targetToken: input.targetToken,
|
|
4059
4998
|
recipient: input.recipient,
|
|
4060
4999
|
postBridgeActions: input.postBridgeActions,
|
|
@@ -4093,7 +5032,7 @@ async function runAccountSetup(input, deps) {
|
|
|
4093
5032
|
primaryType: typedData.primaryType,
|
|
4094
5033
|
message: typedData.message
|
|
4095
5034
|
});
|
|
4096
|
-
const sessionDetails =
|
|
5035
|
+
const sessionDetails = _chunkRABZINV3cjs.buildSessionDetails.call(void 0,
|
|
4097
5036
|
setup.sessionDetailsUnsigned,
|
|
4098
5037
|
signature
|
|
4099
5038
|
);
|
|
@@ -4107,13 +5046,13 @@ async function runAccountSetup(input, deps) {
|
|
|
4107
5046
|
eoaAddress: input.ownerAddress,
|
|
4108
5047
|
sessionOwner: sessionOwner.address,
|
|
4109
5048
|
target: {
|
|
4110
|
-
chain:
|
|
5049
|
+
chain: _chunkMILJQWPTcjs.targetChainToCaip2.call(void 0, input.targetChain),
|
|
4111
5050
|
token: input.targetToken,
|
|
4112
5051
|
...input.recipient && { recipient: input.recipient },
|
|
4113
|
-
..._optionalChain([input, 'access',
|
|
5052
|
+
..._optionalChain([input, 'access', _132 => _132.postBridgeActions, 'optionalAccess', _133 => _133.length]) && {
|
|
4114
5053
|
postBridgeActions: input.postBridgeActions
|
|
4115
5054
|
},
|
|
4116
|
-
..._optionalChain([input, 'access',
|
|
5055
|
+
..._optionalChain([input, 'access', _134 => _134.outputTokenRules, 'optionalAccess', _135 => _135.length]) && {
|
|
4117
5056
|
outputTokenRules: input.outputTokenRules
|
|
4118
5057
|
},
|
|
4119
5058
|
...input.rejectUnmapped != null && {
|
|
@@ -4129,7 +5068,7 @@ async function runAccountSetup(input, deps) {
|
|
|
4129
5068
|
isRegistered: true
|
|
4130
5069
|
};
|
|
4131
5070
|
} catch (error) {
|
|
4132
|
-
|
|
5071
|
+
_chunkRABZINV3cjs.debugError.call(void 0, debug, "account-setup", "setup:failed", error, {
|
|
4133
5072
|
owner: input.ownerAddress
|
|
4134
5073
|
});
|
|
4135
5074
|
if (error instanceof SetupError) throw error;
|
|
@@ -4140,7 +5079,7 @@ function runAccountSetupDeduped(input, deps, requestKey) {
|
|
|
4140
5079
|
const now = Date.now();
|
|
4141
5080
|
const existing = setupRequestDedupe.get(requestKey);
|
|
4142
5081
|
if (existing && (!existing.settled || existing.expiresAt > now)) {
|
|
4143
|
-
|
|
5082
|
+
_chunkRABZINV3cjs.debugLog.call(void 0, deps.debug, "account-setup", "setup:dedupe-hit", {
|
|
4144
5083
|
owner: input.ownerAddress,
|
|
4145
5084
|
forceRegister: _nullishCoalesce(input.forceRegister, () => ( false))
|
|
4146
5085
|
});
|
|
@@ -4228,10 +5167,13 @@ var QR_AUTO_ADVANCE_HYDRATION_GRACE_MS = 1e3;
|
|
|
4228
5167
|
function isSameRoute2(sourceChain, sourceToken, targetChain, targetToken) {
|
|
4229
5168
|
return sourceChain === targetChain && sourceToken.toLowerCase() === targetToken.toLowerCase();
|
|
4230
5169
|
}
|
|
5170
|
+
var SWAPPED_SOURCE_CHAIN = 8453;
|
|
5171
|
+
var SWAPPED_SOURCE_TOKEN = "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913";
|
|
5172
|
+
var SWAPPED_SOURCE_DECIMALS = 6;
|
|
4231
5173
|
function getAddressKey(address) {
|
|
4232
5174
|
return address ? address.toLowerCase() : null;
|
|
4233
5175
|
}
|
|
4234
|
-
function deriveStep(flow, d, p, activeEntry) {
|
|
5176
|
+
function deriveStep(flow, d, p, activeEntry, fiat, exchange) {
|
|
4235
5177
|
const flowStep = flow.step;
|
|
4236
5178
|
const smartAccount = activeEntry.smartAccount;
|
|
4237
5179
|
const solanaDepositAddress = activeEntry.solanaDepositAddress;
|
|
@@ -4246,6 +5188,23 @@ function deriveStep(flow, d, p, activeEntry) {
|
|
|
4246
5188
|
smartAccount,
|
|
4247
5189
|
solanaDepositAddress: _nullishCoalesce(solanaDepositAddress, () => ( void 0))
|
|
4248
5190
|
};
|
|
5191
|
+
case "fiat-onramp":
|
|
5192
|
+
if (!smartAccount) return { type: "setup" };
|
|
5193
|
+
return {
|
|
5194
|
+
type: "fiat-onramp",
|
|
5195
|
+
smartAccount,
|
|
5196
|
+
paymentMethod: _nullishCoalesce(fiat.selectedMethod, () => ( void 0))
|
|
5197
|
+
};
|
|
5198
|
+
case "exchange-select":
|
|
5199
|
+
return { type: "exchange-select" };
|
|
5200
|
+
case "exchange-connect":
|
|
5201
|
+
if (!exchange.selectedConnection) return { type: "exchange-select" };
|
|
5202
|
+
if (!smartAccount) return { type: "setup" };
|
|
5203
|
+
return {
|
|
5204
|
+
type: "exchange-connect",
|
|
5205
|
+
smartAccount,
|
|
5206
|
+
connection: exchange.selectedConnection
|
|
5207
|
+
};
|
|
4249
5208
|
case "select-asset":
|
|
4250
5209
|
if (!smartAccount) return { type: "setup" };
|
|
4251
5210
|
return { type: "select-asset", smartAccount };
|
|
@@ -4255,7 +5214,9 @@ function deriveStep(flow, d, p, activeEntry) {
|
|
|
4255
5214
|
type: "amount",
|
|
4256
5215
|
smartAccount,
|
|
4257
5216
|
asset: d.selectedAsset,
|
|
4258
|
-
|
|
5217
|
+
// Seed the input from the USD-style value the user typed, not the
|
|
5218
|
+
// native source `amount` (which would corrupt the input on back).
|
|
5219
|
+
inputAmountUsd: _nullishCoalesce(d.inputAmountUsd, () => ( void 0))
|
|
4259
5220
|
};
|
|
4260
5221
|
case "confirm":
|
|
4261
5222
|
if (!smartAccount || !d.selectedAsset || !d.amount || !d.targetAmount) {
|
|
@@ -4324,6 +5285,7 @@ function deriveStep(flow, d, p, activeEntry) {
|
|
|
4324
5285
|
amount: d.amount,
|
|
4325
5286
|
sourceSymbol: _nullishCoalesce(d.sourceSymbol, () => ( void 0)),
|
|
4326
5287
|
sourceDecimals: _nullishCoalesce(d.sourceDecimals, () => ( void 0)),
|
|
5288
|
+
inputAmountUsd: _nullishCoalesce(d.inputAmountUsd, () => ( void 0)),
|
|
4327
5289
|
directTransfer: p.directTransfer
|
|
4328
5290
|
};
|
|
4329
5291
|
}
|
|
@@ -4332,6 +5294,8 @@ function resolveOwnerForMode(mode, ctx) {
|
|
|
4332
5294
|
switch (mode) {
|
|
4333
5295
|
case "deposit-address":
|
|
4334
5296
|
case "solana-wallet":
|
|
5297
|
+
case "fiat-onramp":
|
|
5298
|
+
case "exchange-connect":
|
|
4335
5299
|
return _nullishCoalesce(ctx.dappAddress, () => ( null));
|
|
4336
5300
|
case "wallet":
|
|
4337
5301
|
return _nullishCoalesce(ctx.walletOwner, () => ( null));
|
|
@@ -4357,12 +5321,15 @@ function DepositFlow({
|
|
|
4357
5321
|
postBridgeActions,
|
|
4358
5322
|
outputTokenRules,
|
|
4359
5323
|
rejectUnmapped,
|
|
4360
|
-
signerAddress =
|
|
5324
|
+
signerAddress = _chunkMILJQWPTcjs.DEFAULT_SIGNER_ADDRESS,
|
|
4361
5325
|
sessionChainIds,
|
|
4362
5326
|
forceRegister = false,
|
|
4363
|
-
waitForFinalTx = true,
|
|
4364
5327
|
enableSolana = true,
|
|
4365
5328
|
dappImports,
|
|
5329
|
+
enableFiatOnramp = false,
|
|
5330
|
+
enableQrTransfer = true,
|
|
5331
|
+
fiatOnrampMethods,
|
|
5332
|
+
enableExchangeConnect = false,
|
|
4366
5333
|
reownWallet,
|
|
4367
5334
|
onConnect,
|
|
4368
5335
|
onDisconnect,
|
|
@@ -4376,12 +5343,12 @@ function DepositFlow({
|
|
|
4376
5343
|
onError,
|
|
4377
5344
|
debug
|
|
4378
5345
|
}) {
|
|
4379
|
-
const onStepChangeRef =
|
|
4380
|
-
const onEventRef =
|
|
4381
|
-
const onLifecycleRef =
|
|
4382
|
-
const onErrorRef =
|
|
5346
|
+
const onStepChangeRef = _chunkRABZINV3cjs.useLatestRef.call(void 0, onStepChange);
|
|
5347
|
+
const onEventRef = _chunkRABZINV3cjs.useLatestRef.call(void 0, onEvent);
|
|
5348
|
+
const onLifecycleRef = _chunkRABZINV3cjs.useLatestRef.call(void 0, onLifecycle);
|
|
5349
|
+
const onErrorRef = _chunkRABZINV3cjs.useLatestRef.call(void 0, onError);
|
|
4383
5350
|
const hasInitialReownSession = Boolean(
|
|
4384
|
-
enableSolana ? _optionalChain([reownWallet, 'optionalAccess',
|
|
5351
|
+
enableSolana ? _optionalChain([reownWallet, 'optionalAccess', _136 => _136.isConnected]) || _optionalChain([reownWallet, 'optionalAccess', _137 => _137.address]) : _optionalChain([reownWallet, 'optionalAccess', _138 => _138.address])
|
|
4385
5352
|
);
|
|
4386
5353
|
const hasInitialWalletHydrationPending = Boolean(
|
|
4387
5354
|
dappAddress && (hasDappWalletClientProp && dappWalletClient === void 0 || reownWallet && !hasInitialReownSession && !reownWallet.isReady)
|
|
@@ -4391,6 +5358,8 @@ function DepositFlow({
|
|
|
4391
5358
|
const depositSlice = useDepositStore((s) => s.deposit);
|
|
4392
5359
|
const processingSlice = useDepositStore((s) => s.processing);
|
|
4393
5360
|
const setupSlice = useDepositStore((s) => s.setup);
|
|
5361
|
+
const fiatSlice = useDepositStore((s) => s.fiat);
|
|
5362
|
+
const exchangeSlice = useDepositStore((s) => s.exchange);
|
|
4394
5363
|
const flowMode = flowSlice.mode;
|
|
4395
5364
|
const isConnectSelectionConfirmed = flowSlice.isConnectSelectionConfirmed;
|
|
4396
5365
|
const hasNavigatedBack = flowSlice.hasNavigatedBack;
|
|
@@ -4402,13 +5371,13 @@ function DepositFlow({
|
|
|
4402
5371
|
const stableWalletSelectionKeyRef = _react.useRef.call(void 0, null);
|
|
4403
5372
|
const logFlow = _react.useCallback.call(void 0,
|
|
4404
5373
|
(message, data) => {
|
|
4405
|
-
|
|
5374
|
+
_chunkRABZINV3cjs.debugLog.call(void 0, debug, "deposit-flow", message, data);
|
|
4406
5375
|
},
|
|
4407
5376
|
[debug]
|
|
4408
5377
|
);
|
|
4409
5378
|
const logFlowError = _react.useCallback.call(void 0,
|
|
4410
5379
|
(message, error, data) => {
|
|
4411
|
-
|
|
5380
|
+
_chunkRABZINV3cjs.debugError.call(void 0, debug, "deposit-flow", message, error, data);
|
|
4412
5381
|
},
|
|
4413
5382
|
[debug]
|
|
4414
5383
|
);
|
|
@@ -4424,19 +5393,19 @@ function DepositFlow({
|
|
|
4424
5393
|
_viem.formatUnits.call(void 0, BigInt(asset.balance), asset.decimals)
|
|
4425
5394
|
);
|
|
4426
5395
|
if (balanceUnits > 0) return asset.balanceUsd / balanceUnits;
|
|
4427
|
-
} catch (
|
|
5396
|
+
} catch (e31) {
|
|
4428
5397
|
}
|
|
4429
5398
|
}
|
|
4430
5399
|
}
|
|
4431
5400
|
return null;
|
|
4432
5401
|
}, []);
|
|
4433
5402
|
const dappSwitchChain = _react.useMemo.call(void 0, () => {
|
|
4434
|
-
if (!_optionalChain([dappWalletClient, 'optionalAccess',
|
|
5403
|
+
if (!_optionalChain([dappWalletClient, 'optionalAccess', _139 => _139.switchChain])) return void 0;
|
|
4435
5404
|
return async (chainId) => {
|
|
4436
|
-
await _optionalChain([dappWalletClient, 'access',
|
|
5405
|
+
await _optionalChain([dappWalletClient, 'access', _140 => _140.switchChain, 'optionalCall', _141 => _141({ id: chainId })]);
|
|
4437
5406
|
};
|
|
4438
5407
|
}, [dappWalletClient]);
|
|
4439
|
-
const connectedWalletAddress = _nullishCoalesce(_optionalChain([dappWalletClient, 'optionalAccess',
|
|
5408
|
+
const connectedWalletAddress = _nullishCoalesce(_optionalChain([dappWalletClient, 'optionalAccess', _142 => _142.account, 'optionalAccess', _143 => _143.address]), () => ( null));
|
|
4440
5409
|
const walletOptions = _react.useMemo.call(void 0, () => {
|
|
4441
5410
|
const options = [];
|
|
4442
5411
|
const seen = /* @__PURE__ */ new Set();
|
|
@@ -4450,7 +5419,7 @@ function DepositFlow({
|
|
|
4450
5419
|
});
|
|
4451
5420
|
seen.add(id);
|
|
4452
5421
|
}
|
|
4453
|
-
if (enableSolana && _optionalChain([reownWallet, 'optionalAccess',
|
|
5422
|
+
if (enableSolana && _optionalChain([reownWallet, 'optionalAccess', _144 => _144.isConnected]) && reownWallet.isSolana && reownWallet.solanaAddress && dappAddress) {
|
|
4454
5423
|
const id = _nullishCoalesce(reownWallet.caipAddress, () => ( `solana:${reownWallet.solanaAddress}`));
|
|
4455
5424
|
if (!seen.has(id)) {
|
|
4456
5425
|
options.push({
|
|
@@ -4462,7 +5431,7 @@ function DepositFlow({
|
|
|
4462
5431
|
});
|
|
4463
5432
|
seen.add(id);
|
|
4464
5433
|
}
|
|
4465
|
-
} else if (_optionalChain([reownWallet, 'optionalAccess',
|
|
5434
|
+
} else if (_optionalChain([reownWallet, 'optionalAccess', _145 => _145.address]) && reownWallet.isConnected && reownWallet.walletClient && reownWallet.publicClient && !seen.has(`evm:${reownWallet.address.toLowerCase()}`)) {
|
|
4466
5435
|
const id = `evm:${reownWallet.address.toLowerCase()}`;
|
|
4467
5436
|
if (!seen.has(id)) {
|
|
4468
5437
|
options.push({
|
|
@@ -4479,20 +5448,20 @@ function DepositFlow({
|
|
|
4479
5448
|
}, [
|
|
4480
5449
|
connectedWalletAddress,
|
|
4481
5450
|
dappAddress,
|
|
4482
|
-
_optionalChain([reownWallet, 'optionalAccess',
|
|
4483
|
-
_optionalChain([reownWallet, 'optionalAccess',
|
|
4484
|
-
_optionalChain([reownWallet, 'optionalAccess',
|
|
4485
|
-
_optionalChain([reownWallet, 'optionalAccess',
|
|
4486
|
-
_optionalChain([reownWallet, 'optionalAccess',
|
|
5451
|
+
_optionalChain([reownWallet, 'optionalAccess', _146 => _146.address]),
|
|
5452
|
+
_optionalChain([reownWallet, 'optionalAccess', _147 => _147.isConnected]),
|
|
5453
|
+
_optionalChain([reownWallet, 'optionalAccess', _148 => _148.walletClient]),
|
|
5454
|
+
_optionalChain([reownWallet, 'optionalAccess', _149 => _149.publicClient]),
|
|
5455
|
+
_optionalChain([reownWallet, 'optionalAccess', _150 => _150.icon]),
|
|
4487
5456
|
enableSolana,
|
|
4488
|
-
_optionalChain([reownWallet, 'optionalAccess',
|
|
4489
|
-
_optionalChain([reownWallet, 'optionalAccess',
|
|
4490
|
-
_optionalChain([reownWallet, 'optionalAccess',
|
|
5457
|
+
_optionalChain([reownWallet, 'optionalAccess', _151 => _151.isSolana]),
|
|
5458
|
+
_optionalChain([reownWallet, 'optionalAccess', _152 => _152.solanaAddress]),
|
|
5459
|
+
_optionalChain([reownWallet, 'optionalAccess', _153 => _153.caipAddress])
|
|
4491
5460
|
]);
|
|
4492
|
-
const canAutoLock = _optionalChain([dappWalletClient, 'optionalAccess',
|
|
5461
|
+
const canAutoLock = _optionalChain([dappWalletClient, 'optionalAccess', _154 => _154.account]) && dappAddress && !reownWallet && !enableFiatOnramp && !enableExchangeConnect;
|
|
4493
5462
|
const hasWalletOptions = walletOptions.length > 0;
|
|
4494
5463
|
const hasReownSession = Boolean(
|
|
4495
|
-
enableSolana ? _optionalChain([reownWallet, 'optionalAccess',
|
|
5464
|
+
enableSolana ? _optionalChain([reownWallet, 'optionalAccess', _155 => _155.isConnected]) || _optionalChain([reownWallet, 'optionalAccess', _156 => _156.address]) : _optionalChain([reownWallet, 'optionalAccess', _157 => _157.address])
|
|
4496
5465
|
);
|
|
4497
5466
|
const isWalletHydrationPending = Boolean(
|
|
4498
5467
|
dappAddress && !hasWalletOptions && (hasDappWalletClientProp && dappWalletClient === void 0 || reownWallet && !hasReownSession && !reownWallet.isReady)
|
|
@@ -4523,9 +5492,9 @@ function DepositFlow({
|
|
|
4523
5492
|
isConnectSelectionConfirmed,
|
|
4524
5493
|
selectedWalletId
|
|
4525
5494
|
]);
|
|
4526
|
-
const setupChainId = typeof targetChain === "number" ? targetChain : typeof defaultSourceChain === "number" ? defaultSourceChain : _chains.base.id;
|
|
4527
|
-
const targetSymbol =
|
|
4528
|
-
const isTargetStablecoin =
|
|
5495
|
+
const setupChainId = typeof targetChain === "number" && !_chunkMILJQWPTcjs.isVirtualDestination.call(void 0, targetChain) ? targetChain : typeof defaultSourceChain === "number" ? defaultSourceChain : _chains.base.id;
|
|
5496
|
+
const targetSymbol = _chunkMILJQWPTcjs.getTargetTokenSymbol.call(void 0, targetToken, targetChain);
|
|
5497
|
+
const isTargetStablecoin = _chunkMILJQWPTcjs.isStablecoinSymbol.call(void 0, targetSymbol);
|
|
4529
5498
|
const targetMarketPriceRef = _react.useRef.call(void 0, null);
|
|
4530
5499
|
_react.useEffect.call(void 0, () => {
|
|
4531
5500
|
targetMarketPriceRef.current = null;
|
|
@@ -4551,16 +5520,16 @@ function DepositFlow({
|
|
|
4551
5520
|
return {
|
|
4552
5521
|
ownerAddress: dappAddress,
|
|
4553
5522
|
walletClient: void 0,
|
|
4554
|
-
publicClient: _nullishCoalesce(dappPublicClient, () => (
|
|
5523
|
+
publicClient: _nullishCoalesce(dappPublicClient, () => ( _chunkRABZINV3cjs.getPublicClient.call(void 0, setupChainId))),
|
|
4555
5524
|
switchChain: void 0
|
|
4556
5525
|
};
|
|
4557
5526
|
}
|
|
4558
5527
|
if (canAutoLock) {
|
|
4559
|
-
const fallbackChainId = _nullishCoalesce(_optionalChain([dappWalletClient, 'optionalAccess',
|
|
5528
|
+
const fallbackChainId = _nullishCoalesce(_optionalChain([dappWalletClient, 'optionalAccess', _158 => _158.chain, 'optionalAccess', _159 => _159.id]), () => ( setupChainId));
|
|
4560
5529
|
return {
|
|
4561
5530
|
ownerAddress: dappWalletClient.account.address,
|
|
4562
5531
|
walletClient: dappWalletClient,
|
|
4563
|
-
publicClient: _nullishCoalesce(dappPublicClient, () => (
|
|
5532
|
+
publicClient: _nullishCoalesce(dappPublicClient, () => ( _chunkRABZINV3cjs.getPublicClient.call(void 0, fallbackChainId))),
|
|
4564
5533
|
switchChain: dappSwitchChain
|
|
4565
5534
|
};
|
|
4566
5535
|
}
|
|
@@ -4574,24 +5543,24 @@ function DepositFlow({
|
|
|
4574
5543
|
return {
|
|
4575
5544
|
ownerAddress: dappAddress,
|
|
4576
5545
|
walletClient: void 0,
|
|
4577
|
-
publicClient: _nullishCoalesce(dappPublicClient, () => (
|
|
5546
|
+
publicClient: _nullishCoalesce(dappPublicClient, () => ( _chunkRABZINV3cjs.getPublicClient.call(void 0, setupChainId))),
|
|
4578
5547
|
switchChain: void 0
|
|
4579
5548
|
};
|
|
4580
5549
|
}
|
|
4581
|
-
if (selectedOption.kind === "connected" && _optionalChain([dappWalletClient, 'optionalAccess',
|
|
4582
|
-
const fallbackChainId = _nullishCoalesce(_optionalChain([dappWalletClient, 'optionalAccess',
|
|
5550
|
+
if (selectedOption.kind === "connected" && _optionalChain([dappWalletClient, 'optionalAccess', _160 => _160.account]) && selectedOption.address && dappWalletClient.account.address.toLowerCase() === selectedOption.address.toLowerCase()) {
|
|
5551
|
+
const fallbackChainId = _nullishCoalesce(_optionalChain([dappWalletClient, 'optionalAccess', _161 => _161.chain, 'optionalAccess', _162 => _162.id]), () => ( setupChainId));
|
|
4583
5552
|
return {
|
|
4584
5553
|
ownerAddress: dappWalletClient.account.address,
|
|
4585
5554
|
walletClient: dappWalletClient,
|
|
4586
|
-
publicClient: _nullishCoalesce(dappPublicClient, () => (
|
|
5555
|
+
publicClient: _nullishCoalesce(dappPublicClient, () => ( _chunkRABZINV3cjs.getPublicClient.call(void 0, fallbackChainId))),
|
|
4587
5556
|
switchChain: dappSwitchChain
|
|
4588
5557
|
};
|
|
4589
5558
|
}
|
|
4590
|
-
if (selectedOption.kind === "external" && _optionalChain([reownWallet, 'optionalAccess',
|
|
5559
|
+
if (selectedOption.kind === "external" && _optionalChain([reownWallet, 'optionalAccess', _163 => _163.address]) && selectedOption.address && reownWallet.address.toLowerCase() === selectedOption.address.toLowerCase()) {
|
|
4591
5560
|
return {
|
|
4592
5561
|
ownerAddress: reownWallet.address,
|
|
4593
5562
|
walletClient: reownWallet.walletClient,
|
|
4594
|
-
publicClient: _nullishCoalesce(reownWallet.publicClient, () => (
|
|
5563
|
+
publicClient: _nullishCoalesce(reownWallet.publicClient, () => ( _chunkRABZINV3cjs.getPublicClient.call(void 0, setupChainId))),
|
|
4595
5564
|
switchChain: reownWallet.switchChain
|
|
4596
5565
|
};
|
|
4597
5566
|
}
|
|
@@ -4629,7 +5598,7 @@ function DepositFlow({
|
|
|
4629
5598
|
return {
|
|
4630
5599
|
ownerAddress: dappAddress,
|
|
4631
5600
|
walletClient: void 0,
|
|
4632
|
-
publicClient: _nullishCoalesce(dappPublicClient, () => (
|
|
5601
|
+
publicClient: _nullishCoalesce(dappPublicClient, () => ( _chunkRABZINV3cjs.getPublicClient.call(void 0, setupChainId))),
|
|
4633
5602
|
switchChain: void 0
|
|
4634
5603
|
};
|
|
4635
5604
|
}
|
|
@@ -4654,37 +5623,37 @@ function DepositFlow({
|
|
|
4654
5623
|
const selectedEvmWalletOwner = _react.useMemo.call(void 0, () => {
|
|
4655
5624
|
if (!selectedWalletId) return null;
|
|
4656
5625
|
const opt = walletOptions.find((o) => o.id === selectedWalletId);
|
|
4657
|
-
if (_optionalChain([opt, 'optionalAccess',
|
|
5626
|
+
if (_optionalChain([opt, 'optionalAccess', _164 => _164.kind]) === "external" && opt.address) {
|
|
4658
5627
|
return opt.address;
|
|
4659
5628
|
}
|
|
4660
|
-
if (_optionalChain([opt, 'optionalAccess',
|
|
5629
|
+
if (_optionalChain([opt, 'optionalAccess', _165 => _165.kind]) === "connected" && opt.address) {
|
|
4661
5630
|
return opt.address;
|
|
4662
5631
|
}
|
|
4663
5632
|
return null;
|
|
4664
5633
|
}, [selectedWalletId, walletOptions]);
|
|
4665
5634
|
const dappImportOwner = _react.useMemo.call(void 0, () => {
|
|
4666
5635
|
if (selectedEvmWalletOwner) return selectedEvmWalletOwner;
|
|
4667
|
-
if (_optionalChain([reownWallet, 'optionalAccess',
|
|
5636
|
+
if (_optionalChain([reownWallet, 'optionalAccess', _166 => _166.address]) && reownWallet.isConnected) {
|
|
4668
5637
|
return reownWallet.address;
|
|
4669
5638
|
}
|
|
4670
5639
|
if (connectedWalletAddress) return connectedWalletAddress;
|
|
4671
5640
|
return null;
|
|
4672
5641
|
}, [
|
|
4673
5642
|
selectedEvmWalletOwner,
|
|
4674
|
-
_optionalChain([reownWallet, 'optionalAccess',
|
|
4675
|
-
_optionalChain([reownWallet, 'optionalAccess',
|
|
5643
|
+
_optionalChain([reownWallet, 'optionalAccess', _167 => _167.address]),
|
|
5644
|
+
_optionalChain([reownWallet, 'optionalAccess', _168 => _168.isConnected]),
|
|
4676
5645
|
connectedWalletAddress
|
|
4677
5646
|
]);
|
|
4678
5647
|
const activeOwner = _react.useMemo.call(void 0,
|
|
4679
5648
|
() => resolveOwnerForMode(flowMode, {
|
|
4680
5649
|
dappAddress,
|
|
4681
|
-
walletOwner: _nullishCoalesce(_optionalChain([signerContext, 'optionalAccess',
|
|
5650
|
+
walletOwner: _nullishCoalesce(_optionalChain([signerContext, 'optionalAccess', _169 => _169.ownerAddress]), () => ( (canAutoLock ? connectedWalletAddress : selectedEvmWalletOwner))),
|
|
4682
5651
|
dappImportOwner
|
|
4683
5652
|
}),
|
|
4684
5653
|
[
|
|
4685
5654
|
flowMode,
|
|
4686
5655
|
dappAddress,
|
|
4687
|
-
_optionalChain([signerContext, 'optionalAccess',
|
|
5656
|
+
_optionalChain([signerContext, 'optionalAccess', _170 => _170.ownerAddress]),
|
|
4688
5657
|
canAutoLock,
|
|
4689
5658
|
connectedWalletAddress,
|
|
4690
5659
|
selectedEvmWalletOwner,
|
|
@@ -4713,12 +5682,12 @@ function DepositFlow({
|
|
|
4713
5682
|
return;
|
|
4714
5683
|
}
|
|
4715
5684
|
lastActiveSetupLifecycleKeyRef.current = lifecycleKey;
|
|
4716
|
-
_optionalChain([onLifecycleRef, 'access',
|
|
5685
|
+
_optionalChain([onLifecycleRef, 'access', _171 => _171.current, 'optionalCall', _172 => _172({
|
|
4717
5686
|
type: "smart-account-changed",
|
|
4718
5687
|
evm: activeEntry.smartAccount,
|
|
4719
5688
|
solana: _nullishCoalesce(activeEntry.solanaDepositAddress, () => ( null))
|
|
4720
5689
|
})]);
|
|
4721
|
-
_optionalChain([onLifecycleRef, 'access',
|
|
5690
|
+
_optionalChain([onLifecycleRef, 'access', _173 => _173.current, 'optionalCall', _174 => _174({
|
|
4722
5691
|
type: "connected",
|
|
4723
5692
|
address: activeOwner,
|
|
4724
5693
|
smartAccount: activeEntry.smartAccount
|
|
@@ -4733,8 +5702,22 @@ function DepositFlow({
|
|
|
4733
5702
|
onLifecycleRef
|
|
4734
5703
|
]);
|
|
4735
5704
|
const effectiveStep = _react.useMemo.call(void 0,
|
|
4736
|
-
() => deriveStep(
|
|
4737
|
-
|
|
5705
|
+
() => deriveStep(
|
|
5706
|
+
flowSlice,
|
|
5707
|
+
depositSlice,
|
|
5708
|
+
processingSlice,
|
|
5709
|
+
activeEntry,
|
|
5710
|
+
fiatSlice,
|
|
5711
|
+
exchangeSlice
|
|
5712
|
+
),
|
|
5713
|
+
[
|
|
5714
|
+
flowSlice,
|
|
5715
|
+
depositSlice,
|
|
5716
|
+
processingSlice,
|
|
5717
|
+
activeEntry,
|
|
5718
|
+
fiatSlice,
|
|
5719
|
+
exchangeSlice
|
|
5720
|
+
]
|
|
4738
5721
|
);
|
|
4739
5722
|
const step = effectiveStep;
|
|
4740
5723
|
const handleBack = _react.useCallback.call(void 0, () => {
|
|
@@ -4747,12 +5730,48 @@ function DepositFlow({
|
|
|
4747
5730
|
portfolioAssetsRef.current = [];
|
|
4748
5731
|
}
|
|
4749
5732
|
}, [storeApi, hasWalletOptions, reownWallet]);
|
|
4750
|
-
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;
|
|
5733
|
+
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;
|
|
4751
5734
|
const currentBackHandler = canGoBackFromHere ? handleBack : void 0;
|
|
4752
5735
|
const currentScreen = showConnectStep ? "connect" : effectiveStep.type;
|
|
4753
5736
|
_react.useEffect.call(void 0, () => {
|
|
4754
|
-
_optionalChain([onStepChangeRef, 'access',
|
|
5737
|
+
_optionalChain([onStepChangeRef, 'access', _175 => _175.current, 'optionalCall', _176 => _176(currentBackHandler, currentScreen)]);
|
|
4755
5738
|
}, [currentBackHandler, currentScreen, onStepChangeRef]);
|
|
5739
|
+
const lastModalHeightRef = _react.useRef.call(void 0, 0);
|
|
5740
|
+
const modalContentElRef = _react.useRef.call(void 0, null);
|
|
5741
|
+
_react.useEffect.call(void 0, () => {
|
|
5742
|
+
const mc = document.querySelector(".rs-modal-content");
|
|
5743
|
+
if (!mc) return;
|
|
5744
|
+
modalContentElRef.current = mc;
|
|
5745
|
+
const ro = new ResizeObserver((entries) => {
|
|
5746
|
+
for (const entry of entries) {
|
|
5747
|
+
const border = _optionalChain([entry, 'access', _177 => _177.borderBoxSize, 'optionalAccess', _178 => _178[0], 'optionalAccess', _179 => _179.blockSize]);
|
|
5748
|
+
lastModalHeightRef.current = typeof border === "number" ? border : entry.contentRect.height;
|
|
5749
|
+
}
|
|
5750
|
+
});
|
|
5751
|
+
ro.observe(mc);
|
|
5752
|
+
return () => {
|
|
5753
|
+
ro.disconnect();
|
|
5754
|
+
modalContentElRef.current = null;
|
|
5755
|
+
};
|
|
5756
|
+
}, []);
|
|
5757
|
+
const stepPinKey = `${_nullishCoalesce(flowMode, () => ( "none"))}:${step.type}`;
|
|
5758
|
+
const prevStepPinKeyRef = _react.useRef.call(void 0, stepPinKey);
|
|
5759
|
+
_react.useLayoutEffect.call(void 0, () => {
|
|
5760
|
+
if (prevStepPinKeyRef.current === stepPinKey) return;
|
|
5761
|
+
prevStepPinKeyRef.current = stepPinKey;
|
|
5762
|
+
const mc = document.querySelector(".rs-modal-content");
|
|
5763
|
+
const lastHeight = lastModalHeightRef.current;
|
|
5764
|
+
if (!mc || lastHeight <= 0) return;
|
|
5765
|
+
const prevTransition = mc.style.transition;
|
|
5766
|
+
mc.style.transition = "none";
|
|
5767
|
+
mc.style.setProperty("min-height", `${lastHeight}px`, "important");
|
|
5768
|
+
void mc.offsetHeight;
|
|
5769
|
+
const rafId = requestAnimationFrame(() => {
|
|
5770
|
+
mc.style.transition = prevTransition;
|
|
5771
|
+
mc.style.removeProperty("min-height");
|
|
5772
|
+
});
|
|
5773
|
+
return () => cancelAnimationFrame(rafId);
|
|
5774
|
+
}, [stepPinKey]);
|
|
4756
5775
|
const stepSendToken = effectiveStep.type === "amount" ? effectiveStep.asset.symbol : null;
|
|
4757
5776
|
const stepOpenEventKey = effectiveStep.type === "select-asset" ? "select-asset" : effectiveStep.type === "deposit-address" ? "deposit-address" : effectiveStep.type === "amount" && stepSendToken ? `amount:${stepSendToken.toLowerCase()}` : null;
|
|
4758
5777
|
const lastStepOpenEventKeyRef = _react.useRef.call(void 0, null);
|
|
@@ -4766,23 +5785,23 @@ function DepositFlow({
|
|
|
4766
5785
|
}
|
|
4767
5786
|
lastStepOpenEventKeyRef.current = stepOpenEventKey;
|
|
4768
5787
|
if (effectiveStep.type === "select-asset") {
|
|
4769
|
-
_optionalChain([onEventRef, 'access',
|
|
5788
|
+
_optionalChain([onEventRef, 'access', _180 => _180.current, 'optionalCall', _181 => _181({
|
|
4770
5789
|
type: "deposit_modal_connected_wallet_select_source_open",
|
|
4771
5790
|
total_balance_in_external_wallet: totalBalanceUsd,
|
|
4772
5791
|
pred_balance: totalBalanceUsd
|
|
4773
5792
|
})]);
|
|
4774
5793
|
} else if (effectiveStep.type === "deposit-address") {
|
|
4775
|
-
const chainName =
|
|
4776
|
-
const tokenSymbol =
|
|
4777
|
-
_optionalChain([onEventRef, 'access',
|
|
5794
|
+
const chainName = _chunkMILJQWPTcjs.getChainName.call(void 0, targetChain);
|
|
5795
|
+
const tokenSymbol = _chunkMILJQWPTcjs.getTargetTokenSymbol.call(void 0, targetToken, targetChain);
|
|
5796
|
+
_optionalChain([onEventRef, 'access', _182 => _182.current, 'optionalCall', _183 => _183({
|
|
4778
5797
|
type: "deposit_modal_transfer_crypto_open",
|
|
4779
5798
|
default_chain: chainName,
|
|
4780
5799
|
default_token: tokenSymbol,
|
|
4781
5800
|
pred_balance: totalBalanceUsd
|
|
4782
5801
|
})]);
|
|
4783
5802
|
} else if (effectiveStep.type === "amount" && stepSendToken) {
|
|
4784
|
-
const receiveSymbol =
|
|
4785
|
-
_optionalChain([onEventRef, 'access',
|
|
5803
|
+
const receiveSymbol = _chunkMILJQWPTcjs.getTargetTokenSymbol.call(void 0, targetToken, targetChain);
|
|
5804
|
+
_optionalChain([onEventRef, 'access', _184 => _184.current, 'optionalCall', _185 => _185({
|
|
4786
5805
|
type: "deposit_modal_connected_wallet_enter_value_open",
|
|
4787
5806
|
send_token: stepSendToken,
|
|
4788
5807
|
receive_token: receiveSymbol,
|
|
@@ -4815,7 +5834,7 @@ function DepositFlow({
|
|
|
4815
5834
|
targetToken
|
|
4816
5835
|
]);
|
|
4817
5836
|
_react.useEffect.call(void 0, () => {
|
|
4818
|
-
_optionalChain([onLifecycleRef, 'access',
|
|
5837
|
+
_optionalChain([onLifecycleRef, 'access', _186 => _186.current, 'optionalCall', _187 => _187({
|
|
4819
5838
|
type: "balance-changed",
|
|
4820
5839
|
totalUsd: totalBalanceUsd
|
|
4821
5840
|
})]);
|
|
@@ -4823,13 +5842,15 @@ function DepositFlow({
|
|
|
4823
5842
|
const isDepositAddressMode = flowMode === "deposit-address";
|
|
4824
5843
|
const isSolanaWalletMode = flowMode === "solana-wallet";
|
|
4825
5844
|
const isDappImportMode = flowMode === "dapp-import";
|
|
5845
|
+
const isFiatOnrampMode = flowMode === "fiat-onramp";
|
|
5846
|
+
const isExchangeConnectMode = flowMode === "exchange-connect";
|
|
4826
5847
|
const handleSelectTransferCrypto = _react.useCallback.call(void 0, () => {
|
|
4827
5848
|
storeApi.dispatch({ type: "connect/transfer-crypto-selected" });
|
|
4828
5849
|
}, [storeApi]);
|
|
4829
5850
|
const handleConfirmWallet = _react.useCallback.call(void 0,
|
|
4830
5851
|
(walletId) => {
|
|
4831
5852
|
const selectedOption = walletOptions.find((o) => o.id === walletId);
|
|
4832
|
-
const mode = enableSolana && _optionalChain([selectedOption, 'optionalAccess',
|
|
5853
|
+
const mode = enableSolana && _optionalChain([selectedOption, 'optionalAccess', _188 => _188.kind]) === "solana" ? "solana-wallet" : "wallet";
|
|
4833
5854
|
storeApi.dispatch({
|
|
4834
5855
|
type: "connect/wallet-confirmed",
|
|
4835
5856
|
walletId,
|
|
@@ -4839,7 +5860,7 @@ function DepositFlow({
|
|
|
4839
5860
|
[walletOptions, enableSolana, storeApi]
|
|
4840
5861
|
);
|
|
4841
5862
|
const isSolanaWalletConnected = Boolean(
|
|
4842
|
-
enableSolana && _optionalChain([reownWallet, 'optionalAccess',
|
|
5863
|
+
enableSolana && _optionalChain([reownWallet, 'optionalAccess', _189 => _189.isConnected]) && _optionalChain([reownWallet, 'optionalAccess', _190 => _190.isSolana])
|
|
4843
5864
|
);
|
|
4844
5865
|
const dappImportsKey = dappImports ? Object.keys(dappImports).filter((k) => dappImports[k]).sort().join(",") : "";
|
|
4845
5866
|
const enabledDappImportProviders = _react.useMemo.call(void 0,
|
|
@@ -4852,7 +5873,7 @@ function DepositFlow({
|
|
|
4852
5873
|
const owner = dappImportOwner;
|
|
4853
5874
|
if (owner) {
|
|
4854
5875
|
const wallet = walletOptions.find(
|
|
4855
|
-
(o) => _optionalChain([(_nullishCoalesce(o.address, () => ( null))), 'optionalAccess',
|
|
5876
|
+
(o) => _optionalChain([(_nullishCoalesce(o.address, () => ( null))), 'optionalAccess', _191 => _191.toLowerCase, 'call', _192 => _192()]) === owner.toLowerCase()
|
|
4856
5877
|
);
|
|
4857
5878
|
if (wallet) {
|
|
4858
5879
|
storeApi.dispatch({
|
|
@@ -4890,8 +5911,8 @@ function DepositFlow({
|
|
|
4890
5911
|
eoa: dappImportOwner,
|
|
4891
5912
|
getPublicClient: (chainId) => {
|
|
4892
5913
|
try {
|
|
4893
|
-
return
|
|
4894
|
-
} catch (
|
|
5914
|
+
return _chunkRABZINV3cjs.getPublicClient.call(void 0, chainId);
|
|
5915
|
+
} catch (e32) {
|
|
4895
5916
|
return null;
|
|
4896
5917
|
}
|
|
4897
5918
|
},
|
|
@@ -4933,7 +5954,7 @@ function DepositFlow({
|
|
|
4933
5954
|
if (!dappImportOwner) {
|
|
4934
5955
|
return { ...baseRow, status: "needs-connect" };
|
|
4935
5956
|
}
|
|
4936
|
-
const availabilityEntry = _optionalChain([dappImportAvailabilityOwner, 'optionalAccess',
|
|
5957
|
+
const availabilityEntry = _optionalChain([dappImportAvailabilityOwner, 'optionalAccess', _193 => _193.toLowerCase, 'call', _194 => _194()]) === dappImportOwner.toLowerCase() ? dappImportAvailability[provider.id] : void 0;
|
|
4937
5958
|
const dappImportSetup = readSetupForOwner(setupSlice, dappImportOwner);
|
|
4938
5959
|
if (availabilityEntry === "loading" || availabilityEntry === void 0) {
|
|
4939
5960
|
return { ...baseRow, status: "loading" };
|
|
@@ -4981,7 +6002,7 @@ function DepositFlow({
|
|
|
4981
6002
|
}, [activeDappImportProviderId, enabledDappImportProviders]);
|
|
4982
6003
|
const activeDappImportAvailability = _react.useMemo.call(void 0, () => {
|
|
4983
6004
|
if (!activeDappImportProviderId) return null;
|
|
4984
|
-
if (!dappImportOwner || _optionalChain([dappImportAvailabilityOwner, 'optionalAccess',
|
|
6005
|
+
if (!dappImportOwner || _optionalChain([dappImportAvailabilityOwner, 'optionalAccess', _195 => _195.toLowerCase, 'call', _196 => _196()]) !== dappImportOwner.toLowerCase()) {
|
|
4985
6006
|
return null;
|
|
4986
6007
|
}
|
|
4987
6008
|
const entry = dappImportAvailability[activeDappImportProviderId];
|
|
@@ -4993,8 +6014,29 @@ function DepositFlow({
|
|
|
4993
6014
|
dappImportAvailabilityOwner,
|
|
4994
6015
|
dappImportOwner
|
|
4995
6016
|
]);
|
|
6017
|
+
const handleSelectFiatMethod = _react.useCallback.call(void 0,
|
|
6018
|
+
(paymentMethod) => {
|
|
6019
|
+
storeApi.dispatch({
|
|
6020
|
+
type: "connect/fiat-onramp-selected",
|
|
6021
|
+
paymentMethod
|
|
6022
|
+
});
|
|
6023
|
+
},
|
|
6024
|
+
[storeApi]
|
|
6025
|
+
);
|
|
6026
|
+
const handleSelectExchange = _react.useCallback.call(void 0, () => {
|
|
6027
|
+
storeApi.dispatch({ type: "connect/exchange-selected" });
|
|
6028
|
+
}, [storeApi]);
|
|
6029
|
+
const handleSelectExchangeConnection = _react.useCallback.call(void 0,
|
|
6030
|
+
(connection) => {
|
|
6031
|
+
storeApi.dispatch({
|
|
6032
|
+
type: "exchange/connection-selected",
|
|
6033
|
+
connection
|
|
6034
|
+
});
|
|
6035
|
+
},
|
|
6036
|
+
[storeApi]
|
|
6037
|
+
);
|
|
4996
6038
|
const handleNewDeposit = _react.useCallback.call(void 0, () => {
|
|
4997
|
-
_optionalChain([onLifecycleRef, 'access',
|
|
6039
|
+
_optionalChain([onLifecycleRef, 'access', _197 => _197.current, 'optionalCall', _198 => _198({
|
|
4998
6040
|
type: "smart-account-changed",
|
|
4999
6041
|
evm: null,
|
|
5000
6042
|
solana: null
|
|
@@ -5042,13 +6084,13 @@ function DepositFlow({
|
|
|
5042
6084
|
};
|
|
5043
6085
|
push(dappAddress);
|
|
5044
6086
|
push(connectedWalletAddress);
|
|
5045
|
-
push(_optionalChain([reownWallet, 'optionalAccess',
|
|
6087
|
+
push(_optionalChain([reownWallet, 'optionalAccess', _199 => _199.address]));
|
|
5046
6088
|
push(dappImportOwner);
|
|
5047
6089
|
return owners;
|
|
5048
6090
|
}, [
|
|
5049
6091
|
dappAddress,
|
|
5050
6092
|
connectedWalletAddress,
|
|
5051
|
-
_optionalChain([reownWallet, 'optionalAccess',
|
|
6093
|
+
_optionalChain([reownWallet, 'optionalAccess', _200 => _200.address]),
|
|
5052
6094
|
dappImportOwner
|
|
5053
6095
|
]);
|
|
5054
6096
|
_react.useEffect.call(void 0, () => {
|
|
@@ -5062,7 +6104,7 @@ function DepositFlow({
|
|
|
5062
6104
|
try {
|
|
5063
6105
|
sessionOwner = await resolveSessionOwner(owner);
|
|
5064
6106
|
} catch (error) {
|
|
5065
|
-
|
|
6107
|
+
_chunkRABZINV3cjs.debugError.call(void 0,
|
|
5066
6108
|
debug,
|
|
5067
6109
|
"deposit-flow",
|
|
5068
6110
|
"session-owner:resolve-failed",
|
|
@@ -5153,7 +6195,7 @@ function DepositFlow({
|
|
|
5153
6195
|
sourceChain: data.sourceChain,
|
|
5154
6196
|
amount: data.amount
|
|
5155
6197
|
});
|
|
5156
|
-
_optionalChain([onLifecycleRef, 'access',
|
|
6198
|
+
_optionalChain([onLifecycleRef, 'access', _201 => _201.current, 'optionalCall', _202 => _202({ type: "submitted", ...data })]);
|
|
5157
6199
|
},
|
|
5158
6200
|
[logFlow, onLifecycleRef]
|
|
5159
6201
|
);
|
|
@@ -5172,8 +6214,8 @@ function DepositFlow({
|
|
|
5172
6214
|
);
|
|
5173
6215
|
const handleSolanaAmountContinue = _react.useCallback.call(void 0,
|
|
5174
6216
|
(token, sourceAmount, inputAmountUsd) => {
|
|
5175
|
-
const targetSym =
|
|
5176
|
-
const isTargetStable =
|
|
6217
|
+
const targetSym = _chunkMILJQWPTcjs.getTargetTokenSymbol.call(void 0, targetToken, targetChain);
|
|
6218
|
+
const isTargetStable = _chunkMILJQWPTcjs.isStablecoinSymbol.call(void 0, targetSym);
|
|
5177
6219
|
const targetTokenPriceUsd = isTargetStable ? 1 : _nullishCoalesce(getTokenPriceUsd(targetSym), () => ( targetMarketPriceRef.current));
|
|
5178
6220
|
logFlow("solana:amount:continue", {
|
|
5179
6221
|
token: token.symbol,
|
|
@@ -5194,8 +6236,10 @@ function DepositFlow({
|
|
|
5194
6236
|
);
|
|
5195
6237
|
const handleSolanaConfirmed = _react.useCallback.call(void 0,
|
|
5196
6238
|
(txHash, amountUnits) => {
|
|
5197
|
-
const
|
|
6239
|
+
const depositAtSubmit = storeApi.getState().deposit;
|
|
6240
|
+
const tokenAtSubmit = depositAtSubmit.selectedSolanaToken;
|
|
5198
6241
|
if (!tokenAtSubmit) return;
|
|
6242
|
+
const amountUsd = _nullishCoalesce(depositAtSubmit.inputAmountUsd, () => ( void 0));
|
|
5199
6243
|
logFlow("solana:submitted", {
|
|
5200
6244
|
txHash,
|
|
5201
6245
|
amountUnits,
|
|
@@ -5208,20 +6252,23 @@ function DepositFlow({
|
|
|
5208
6252
|
sourceToken: tokenAtSubmit.mint,
|
|
5209
6253
|
amount: amountUnits,
|
|
5210
6254
|
sourceSymbol: tokenAtSubmit.symbol,
|
|
5211
|
-
sourceDecimals: tokenAtSubmit.decimals
|
|
6255
|
+
sourceDecimals: tokenAtSubmit.decimals,
|
|
6256
|
+
inputAmountUsd: amountUsd
|
|
5212
6257
|
});
|
|
5213
|
-
_optionalChain([onLifecycleRef, 'access',
|
|
6258
|
+
_optionalChain([onLifecycleRef, 'access', _203 => _203.current, 'optionalCall', _204 => _204({
|
|
5214
6259
|
type: "submitted",
|
|
5215
6260
|
txHash,
|
|
5216
6261
|
sourceChain: "solana",
|
|
5217
|
-
amount: amountUnits
|
|
6262
|
+
amount: amountUnits,
|
|
6263
|
+
sourceDecimals: tokenAtSubmit.decimals,
|
|
6264
|
+
amountUsd
|
|
5218
6265
|
})]);
|
|
5219
6266
|
},
|
|
5220
6267
|
[logFlow, onLifecycleRef, storeApi]
|
|
5221
6268
|
);
|
|
5222
6269
|
const handleAssetContinue = _react.useCallback.call(void 0,
|
|
5223
6270
|
(asset) => {
|
|
5224
|
-
_optionalChain([onEventRef, 'access',
|
|
6271
|
+
_optionalChain([onEventRef, 'access', _205 => _205.current, 'optionalCall', _206 => _206({
|
|
5225
6272
|
type: "deposit_modal_connected_wallet_select_source_cta_click",
|
|
5226
6273
|
total_balance_in_external_wallet: totalBalanceUsd,
|
|
5227
6274
|
pred_balance: totalBalanceUsd,
|
|
@@ -5244,8 +6291,8 @@ function DepositFlow({
|
|
|
5244
6291
|
activeOwner
|
|
5245
6292
|
);
|
|
5246
6293
|
if (entry.status !== "ready") return;
|
|
5247
|
-
const targetSym =
|
|
5248
|
-
const isTargetStable =
|
|
6294
|
+
const targetSym = _chunkMILJQWPTcjs.getTargetTokenSymbol.call(void 0, targetToken, targetChain);
|
|
6295
|
+
const isTargetStable = _chunkMILJQWPTcjs.isStablecoinSymbol.call(void 0, targetSym);
|
|
5249
6296
|
const targetTokenPriceUsd = isTargetStable ? 1 : _nullishCoalesce(getTokenPriceUsd(targetSym), () => ( targetMarketPriceRef.current));
|
|
5250
6297
|
storeApi.dispatch({
|
|
5251
6298
|
type: "amount/entered",
|
|
@@ -5266,7 +6313,8 @@ function DepositFlow({
|
|
|
5266
6313
|
sourceToken: token,
|
|
5267
6314
|
amount
|
|
5268
6315
|
});
|
|
5269
|
-
const
|
|
6316
|
+
const depositAtSubmit = storeApi.getState().deposit;
|
|
6317
|
+
const asset = depositAtSubmit.selectedAsset;
|
|
5270
6318
|
const dappImport = asset && isDappImportAsset(asset) ? asset : null;
|
|
5271
6319
|
storeApi.dispatch({
|
|
5272
6320
|
type: "deposit/submitted",
|
|
@@ -5274,28 +6322,58 @@ function DepositFlow({
|
|
|
5274
6322
|
sourceChain: chainId,
|
|
5275
6323
|
sourceToken: token,
|
|
5276
6324
|
amount,
|
|
5277
|
-
sourceSymbol: _optionalChain([
|
|
5278
|
-
sourceDecimals: _optionalChain([
|
|
6325
|
+
sourceSymbol: _optionalChain([asset, 'optionalAccess', _207 => _207.symbol]),
|
|
6326
|
+
sourceDecimals: _optionalChain([asset, 'optionalAccess', _208 => _208.decimals]),
|
|
6327
|
+
inputAmountUsd: _nullishCoalesce(depositAtSubmit.inputAmountUsd, () => ( void 0)),
|
|
5279
6328
|
directTransfer: !dappImport && isSameRoute2(chainId, token, targetChain, targetToken)
|
|
5280
6329
|
});
|
|
5281
6330
|
},
|
|
5282
6331
|
[logFlow, storeApi, targetChain, targetToken]
|
|
5283
6332
|
);
|
|
6333
|
+
const handleSwappedComplete = _react.useCallback.call(void 0,
|
|
6334
|
+
(info) => {
|
|
6335
|
+
logFlow("swapped:complete", {
|
|
6336
|
+
txHash: info.txHash,
|
|
6337
|
+
orderCrypto: info.orderCrypto
|
|
6338
|
+
});
|
|
6339
|
+
const amount = _nullishCoalesce(info.amount, () => ( "0"));
|
|
6340
|
+
storeApi.dispatch({
|
|
6341
|
+
type: "deposit/submitted",
|
|
6342
|
+
txHash: info.txHash,
|
|
6343
|
+
sourceChain: SWAPPED_SOURCE_CHAIN,
|
|
6344
|
+
sourceToken: SWAPPED_SOURCE_TOKEN,
|
|
6345
|
+
amount,
|
|
6346
|
+
sourceSymbol: _nullishCoalesce(info.orderCrypto, () => ( "USDC")),
|
|
6347
|
+
sourceDecimals: SWAPPED_SOURCE_DECIMALS
|
|
6348
|
+
});
|
|
6349
|
+
_optionalChain([onLifecycleRef, 'access', _209 => _209.current, 'optionalCall', _210 => _210({
|
|
6350
|
+
type: "submitted",
|
|
6351
|
+
txHash: info.txHash,
|
|
6352
|
+
sourceChain: SWAPPED_SOURCE_CHAIN,
|
|
6353
|
+
amount,
|
|
6354
|
+
sourceDecimals: SWAPPED_SOURCE_DECIMALS
|
|
6355
|
+
})]);
|
|
6356
|
+
},
|
|
6357
|
+
[logFlow, storeApi, onLifecycleRef]
|
|
6358
|
+
);
|
|
5284
6359
|
const handleDepositSubmittedCallback = _react.useCallback.call(void 0,
|
|
5285
6360
|
(txHash, sourceChain, amount) => {
|
|
5286
|
-
|
|
6361
|
+
const depositAtSubmit = storeApi.getState().deposit;
|
|
6362
|
+
_optionalChain([onLifecycleRef, 'access', _211 => _211.current, 'optionalCall', _212 => _212({
|
|
5287
6363
|
type: "submitted",
|
|
5288
6364
|
txHash,
|
|
5289
6365
|
sourceChain,
|
|
5290
|
-
amount
|
|
6366
|
+
amount,
|
|
6367
|
+
sourceDecimals: _optionalChain([depositAtSubmit, 'access', _213 => _213.selectedAsset, 'optionalAccess', _214 => _214.decimals]),
|
|
6368
|
+
amountUsd: _nullishCoalesce(depositAtSubmit.inputAmountUsd, () => ( void 0))
|
|
5291
6369
|
})]);
|
|
5292
6370
|
},
|
|
5293
|
-
[onLifecycleRef]
|
|
6371
|
+
[onLifecycleRef, storeApi]
|
|
5294
6372
|
);
|
|
5295
6373
|
const handleDepositComplete = _react.useCallback.call(void 0,
|
|
5296
6374
|
(txHash, destinationTxHash, context) => {
|
|
5297
6375
|
logFlow("deposit:complete", { txHash, destinationTxHash, ...context });
|
|
5298
|
-
_optionalChain([onLifecycleRef, 'access',
|
|
6376
|
+
_optionalChain([onLifecycleRef, 'access', _215 => _215.current, 'optionalCall', _216 => _216({
|
|
5299
6377
|
type: "complete",
|
|
5300
6378
|
txHash,
|
|
5301
6379
|
destinationTxHash,
|
|
@@ -5307,14 +6385,14 @@ function DepositFlow({
|
|
|
5307
6385
|
const handleDepositFailed = _react.useCallback.call(void 0,
|
|
5308
6386
|
(txHash, error) => {
|
|
5309
6387
|
logFlowError("deposit:failed", error, { txHash });
|
|
5310
|
-
_optionalChain([onLifecycleRef, 'access',
|
|
6388
|
+
_optionalChain([onLifecycleRef, 'access', _217 => _217.current, 'optionalCall', _218 => _218({ type: "failed", txHash, error })]);
|
|
5311
6389
|
},
|
|
5312
6390
|
[logFlowError, onLifecycleRef]
|
|
5313
6391
|
);
|
|
5314
6392
|
const handleError = _react.useCallback.call(void 0,
|
|
5315
6393
|
(message, code) => {
|
|
5316
6394
|
logFlowError("flow:error", message, { code });
|
|
5317
|
-
_optionalChain([onErrorRef, 'access',
|
|
6395
|
+
_optionalChain([onErrorRef, 'access', _219 => _219.current, 'optionalCall', _220 => _220({ message, code })]);
|
|
5318
6396
|
},
|
|
5319
6397
|
[logFlowError, onErrorRef]
|
|
5320
6398
|
);
|
|
@@ -5350,13 +6428,14 @@ function DepositFlow({
|
|
|
5350
6428
|
}
|
|
5351
6429
|
}, [enableSolana, flowMode, storeApi]);
|
|
5352
6430
|
_react.useEffect.call(void 0, () => {
|
|
5353
|
-
if (hasNavigatedBack || isConnectSelectionConfirmed || flowMode) {
|
|
6431
|
+
if (hasNavigatedBack || isConnectSelectionConfirmed || flowMode || enableFiatOnramp || enableExchangeConnect) {
|
|
5354
6432
|
return;
|
|
5355
6433
|
}
|
|
5356
|
-
if (!hasWalletOptions && dappAddress && !hasReownSession && !dappWalletClient && hasQrAutoAdvanceGraceElapsed) {
|
|
6434
|
+
if (enableQrTransfer && !hasWalletOptions && dappAddress && !hasReownSession && !dappWalletClient && hasQrAutoAdvanceGraceElapsed) {
|
|
5357
6435
|
handleSelectTransferCrypto();
|
|
5358
6436
|
}
|
|
5359
6437
|
}, [
|
|
6438
|
+
enableQrTransfer,
|
|
5360
6439
|
hasWalletOptions,
|
|
5361
6440
|
hasReownSession,
|
|
5362
6441
|
hasQrAutoAdvanceGraceElapsed,
|
|
@@ -5396,19 +6475,22 @@ function DepositFlow({
|
|
|
5396
6475
|
);
|
|
5397
6476
|
if (showConnectStep) {
|
|
5398
6477
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-modal-body", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
5399
|
-
|
|
6478
|
+
_chunkRABZINV3cjs.ConnectStep,
|
|
5400
6479
|
{
|
|
5401
6480
|
walletRows,
|
|
5402
6481
|
transferCryptoState: dappAddress ? transferCryptoState : void 0,
|
|
5403
6482
|
transferCryptoErrorReason: dappAddress ? _nullishCoalesce(transferCryptoEntry.message, () => ( void 0)) : void 0,
|
|
5404
|
-
onSelectTransferCrypto: dappAddress ? () => {
|
|
6483
|
+
onSelectTransferCrypto: enableQrTransfer && dappAddress ? () => {
|
|
5405
6484
|
if (transferCryptoState === "error") {
|
|
5406
6485
|
handleRetrySetup(dappAddress);
|
|
5407
6486
|
return;
|
|
5408
6487
|
}
|
|
5409
|
-
if (transferCryptoState !== "ready") return;
|
|
5410
6488
|
handleSelectTransferCrypto();
|
|
5411
6489
|
} : void 0,
|
|
6490
|
+
onSelectPayWithCard: enableFiatOnramp && dappAddress && (!fiatOnrampMethods || fiatOnrampMethods.length === 0) ? () => handleSelectFiatMethod() : void 0,
|
|
6491
|
+
fiatPaymentMethods: enableFiatOnramp && dappAddress ? fiatOnrampMethods : void 0,
|
|
6492
|
+
onSelectFiatMethod: enableFiatOnramp && dappAddress ? (method) => handleSelectFiatMethod(method) : void 0,
|
|
6493
|
+
onSelectFundFromExchange: enableExchangeConnect && dappAddress ? () => handleSelectExchange() : void 0,
|
|
5412
6494
|
onRequestConnect,
|
|
5413
6495
|
onConnect,
|
|
5414
6496
|
onDisconnect,
|
|
@@ -5443,33 +6525,37 @@ function DepositFlow({
|
|
|
5443
6525
|
if (isDepositAddressMode) {
|
|
5444
6526
|
if (!dappAddress) return null;
|
|
5445
6527
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-modal-body", children: [
|
|
5446
|
-
effectiveStep.type === "setup" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
6528
|
+
effectiveStep.type === "setup" && (activeEntry.status === "error" ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
5447
6529
|
AccountPreparingSkeleton,
|
|
5448
6530
|
{
|
|
5449
|
-
errorMessage:
|
|
5450
|
-
onRetry:
|
|
6531
|
+
errorMessage: _nullishCoalesce(activeEntry.message, () => ( void 0)),
|
|
6532
|
+
onRetry: () => handleRetrySetup(dappAddress)
|
|
5451
6533
|
}
|
|
5452
|
-
),
|
|
6534
|
+
) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
6535
|
+
DepositAddressSkeleton,
|
|
6536
|
+
{
|
|
6537
|
+
uiConfig,
|
|
6538
|
+
allowedRoutes
|
|
6539
|
+
}
|
|
6540
|
+
)),
|
|
5453
6541
|
effectiveStep.type === "deposit-address" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
5454
6542
|
DepositAddressStep,
|
|
5455
6543
|
{
|
|
5456
6544
|
smartAccount: effectiveStep.smartAccount,
|
|
5457
6545
|
solanaDepositAddress: enableSolana ? effectiveStep.solanaDepositAddress : void 0,
|
|
5458
|
-
isUpdating: activeEntry.status !== "ready",
|
|
5459
6546
|
service,
|
|
5460
6547
|
allowedRoutes,
|
|
5461
6548
|
targetChain,
|
|
5462
6549
|
targetToken,
|
|
5463
|
-
|
|
5464
|
-
hasPostBridgeActions: Boolean(_optionalChain([postBridgeActions, 'optionalAccess', _183 => _183.length])),
|
|
6550
|
+
hasPostBridgeActions: Boolean(_optionalChain([postBridgeActions, 'optionalAccess', _221 => _221.length])),
|
|
5465
6551
|
uiConfig,
|
|
5466
6552
|
onDepositSubmitted: handleDepositAddressSubmitted,
|
|
5467
6553
|
onDepositComplete: handleDepositComplete,
|
|
5468
6554
|
onDepositFailed: handleDepositFailed,
|
|
5469
6555
|
onCopyAddress: () => {
|
|
5470
|
-
const chainName =
|
|
5471
|
-
const tokenSymbol =
|
|
5472
|
-
_optionalChain([onEvent, 'optionalCall',
|
|
6556
|
+
const chainName = _chunkMILJQWPTcjs.getChainName.call(void 0, targetChain);
|
|
6557
|
+
const tokenSymbol = _chunkMILJQWPTcjs.getTargetTokenSymbol.call(void 0, targetToken, targetChain);
|
|
6558
|
+
_optionalChain([onEvent, 'optionalCall', _222 => _222({
|
|
5473
6559
|
type: "deposit_modal_transfer_crypto_cta_click",
|
|
5474
6560
|
default_chain: chainName,
|
|
5475
6561
|
default_token: tokenSymbol,
|
|
@@ -5483,10 +6569,136 @@ function DepositFlow({
|
|
|
5483
6569
|
)
|
|
5484
6570
|
] });
|
|
5485
6571
|
}
|
|
6572
|
+
if (isFiatOnrampMode) {
|
|
6573
|
+
if (!dappAddress) return null;
|
|
6574
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
6575
|
+
"div",
|
|
6576
|
+
{
|
|
6577
|
+
className: "rs-modal-body",
|
|
6578
|
+
"data-flow-mode": "fiat-onramp",
|
|
6579
|
+
"data-step-type": step.type,
|
|
6580
|
+
children: [
|
|
6581
|
+
step.type === "setup" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
6582
|
+
AccountPreparingSkeleton,
|
|
6583
|
+
{
|
|
6584
|
+
errorMessage: activeEntry.status === "error" ? _nullishCoalesce(activeEntry.message, () => ( void 0)) : void 0,
|
|
6585
|
+
onRetry: activeEntry.status === "error" ? () => handleRetrySetup(dappAddress) : void 0
|
|
6586
|
+
}
|
|
6587
|
+
),
|
|
6588
|
+
step.type === "fiat-onramp" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
6589
|
+
FiatOnrampStep,
|
|
6590
|
+
{
|
|
6591
|
+
smartAccount: step.smartAccount,
|
|
6592
|
+
service,
|
|
6593
|
+
paymentMethod: step.paymentMethod,
|
|
6594
|
+
onSwappedComplete: handleSwappedComplete,
|
|
6595
|
+
onSwappedFailed: handleDepositFailed,
|
|
6596
|
+
onClose: _nullishCoalesce(onClose, () => ( (() => {
|
|
6597
|
+
}))),
|
|
6598
|
+
onError: handleError
|
|
6599
|
+
}
|
|
6600
|
+
),
|
|
6601
|
+
step.type === "processing" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
6602
|
+
_chunkRABZINV3cjs.ProcessingStep,
|
|
6603
|
+
{
|
|
6604
|
+
smartAccount: step.smartAccount,
|
|
6605
|
+
solanaDepositAddress: step.solanaDepositAddress,
|
|
6606
|
+
txHash: step.txHash,
|
|
6607
|
+
sourceChain: step.sourceChain,
|
|
6608
|
+
sourceToken: step.sourceToken,
|
|
6609
|
+
targetChain,
|
|
6610
|
+
targetToken,
|
|
6611
|
+
amount: step.amount,
|
|
6612
|
+
sourceSymbol: step.sourceSymbol,
|
|
6613
|
+
sourceDecimals: step.sourceDecimals,
|
|
6614
|
+
amountUsd: step.inputAmountUsd,
|
|
6615
|
+
hasPostBridgeActions: Boolean(_optionalChain([postBridgeActions, 'optionalAccess', _223 => _223.length])),
|
|
6616
|
+
service,
|
|
6617
|
+
directTransfer: step.directTransfer,
|
|
6618
|
+
isSwappedOrder: true,
|
|
6619
|
+
onClose,
|
|
6620
|
+
onNewDeposit: handleNewDeposit,
|
|
6621
|
+
onDepositComplete: handleDepositComplete,
|
|
6622
|
+
onDepositFailed: handleDepositFailed,
|
|
6623
|
+
onError: handleError,
|
|
6624
|
+
debug
|
|
6625
|
+
}
|
|
6626
|
+
)
|
|
6627
|
+
]
|
|
6628
|
+
}
|
|
6629
|
+
);
|
|
6630
|
+
}
|
|
6631
|
+
if (isExchangeConnectMode) {
|
|
6632
|
+
if (!dappAddress) return null;
|
|
6633
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
6634
|
+
"div",
|
|
6635
|
+
{
|
|
6636
|
+
className: "rs-modal-body",
|
|
6637
|
+
"data-flow-mode": "exchange-connect",
|
|
6638
|
+
"data-step-type": step.type,
|
|
6639
|
+
children: [
|
|
6640
|
+
step.type === "setup" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
6641
|
+
AccountPreparingSkeleton,
|
|
6642
|
+
{
|
|
6643
|
+
errorMessage: activeEntry.status === "error" ? _nullishCoalesce(activeEntry.message, () => ( void 0)) : void 0,
|
|
6644
|
+
onRetry: activeEntry.status === "error" ? () => handleRetrySetup(dappAddress) : void 0
|
|
6645
|
+
}
|
|
6646
|
+
),
|
|
6647
|
+
step.type === "exchange-select" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
6648
|
+
ExchangeSelectStep,
|
|
6649
|
+
{
|
|
6650
|
+
service,
|
|
6651
|
+
onSelectExchange: handleSelectExchangeConnection,
|
|
6652
|
+
onError: handleError
|
|
6653
|
+
}
|
|
6654
|
+
),
|
|
6655
|
+
step.type === "exchange-connect" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
6656
|
+
ExchangeConnectStep,
|
|
6657
|
+
{
|
|
6658
|
+
smartAccount: step.smartAccount,
|
|
6659
|
+
service,
|
|
6660
|
+
connection: step.connection,
|
|
6661
|
+
onSwappedComplete: handleSwappedComplete,
|
|
6662
|
+
onSwappedFailed: handleDepositFailed,
|
|
6663
|
+
onClose: _nullishCoalesce(onClose, () => ( (() => {
|
|
6664
|
+
}))),
|
|
6665
|
+
onError: handleError
|
|
6666
|
+
}
|
|
6667
|
+
),
|
|
6668
|
+
step.type === "processing" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
6669
|
+
_chunkRABZINV3cjs.ProcessingStep,
|
|
6670
|
+
{
|
|
6671
|
+
smartAccount: step.smartAccount,
|
|
6672
|
+
solanaDepositAddress: step.solanaDepositAddress,
|
|
6673
|
+
txHash: step.txHash,
|
|
6674
|
+
sourceChain: step.sourceChain,
|
|
6675
|
+
sourceToken: step.sourceToken,
|
|
6676
|
+
targetChain,
|
|
6677
|
+
targetToken,
|
|
6678
|
+
amount: step.amount,
|
|
6679
|
+
sourceSymbol: step.sourceSymbol,
|
|
6680
|
+
sourceDecimals: step.sourceDecimals,
|
|
6681
|
+
amountUsd: step.inputAmountUsd,
|
|
6682
|
+
hasPostBridgeActions: Boolean(_optionalChain([postBridgeActions, 'optionalAccess', _224 => _224.length])),
|
|
6683
|
+
service,
|
|
6684
|
+
directTransfer: step.directTransfer,
|
|
6685
|
+
isSwappedOrder: true,
|
|
6686
|
+
onClose,
|
|
6687
|
+
onNewDeposit: handleNewDeposit,
|
|
6688
|
+
onDepositComplete: handleDepositComplete,
|
|
6689
|
+
onDepositFailed: handleDepositFailed,
|
|
6690
|
+
onError: handleError,
|
|
6691
|
+
debug
|
|
6692
|
+
}
|
|
6693
|
+
)
|
|
6694
|
+
]
|
|
6695
|
+
}
|
|
6696
|
+
);
|
|
6697
|
+
}
|
|
5486
6698
|
if (isSolanaWalletMode) {
|
|
5487
6699
|
if (!dappAddress) return null;
|
|
5488
|
-
const solanaAddr = _optionalChain([reownWallet, 'optionalAccess',
|
|
5489
|
-
const solanaProvider = _optionalChain([reownWallet, 'optionalAccess',
|
|
6700
|
+
const solanaAddr = _optionalChain([reownWallet, 'optionalAccess', _225 => _225.solanaAddress]);
|
|
6701
|
+
const solanaProvider = _optionalChain([reownWallet, 'optionalAccess', _226 => _226.solanaProvider]);
|
|
5490
6702
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-modal-body", children: [
|
|
5491
6703
|
effectiveStep.type === "setup" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
5492
6704
|
AccountPreparingSkeleton,
|
|
@@ -5517,10 +6729,11 @@ function DepositFlow({
|
|
|
5517
6729
|
balanceUsd: effectiveStep.balanceUsd,
|
|
5518
6730
|
defaultAmount: effectiveStep.inputAmountUsd,
|
|
5519
6731
|
uiConfig,
|
|
5520
|
-
|
|
5521
|
-
|
|
5522
|
-
|
|
5523
|
-
|
|
6732
|
+
targetChain,
|
|
6733
|
+
targetChainName: _chunkMILJQWPTcjs.getChainName.call(void 0, targetChain),
|
|
6734
|
+
targetTokenSymbol: _chunkMILJQWPTcjs.getTargetTokenSymbol.call(void 0, targetToken, targetChain),
|
|
6735
|
+
targetTokenIcon: _chunkMILJQWPTcjs.getTokenIcon.call(void 0,
|
|
6736
|
+
_chunkMILJQWPTcjs.getTargetTokenSymbol.call(void 0, targetToken, targetChain)
|
|
5524
6737
|
),
|
|
5525
6738
|
appBalanceUsd,
|
|
5526
6739
|
onContinue: handleSolanaAmountContinue,
|
|
@@ -5542,7 +6755,7 @@ function DepositFlow({
|
|
|
5542
6755
|
targetToken,
|
|
5543
6756
|
service,
|
|
5544
6757
|
solanaProvider,
|
|
5545
|
-
solanaConnection: _optionalChain([reownWallet, 'optionalAccess',
|
|
6758
|
+
solanaConnection: _optionalChain([reownWallet, 'optionalAccess', _227 => _227.solanaConnection]),
|
|
5546
6759
|
uiConfig,
|
|
5547
6760
|
onConfirm: handleSolanaConfirmed,
|
|
5548
6761
|
onError: handleError,
|
|
@@ -5583,7 +6796,7 @@ function DepositFlow({
|
|
|
5583
6796
|
) })
|
|
5584
6797
|
] }) : null,
|
|
5585
6798
|
effectiveStep.type === "processing" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
5586
|
-
|
|
6799
|
+
_chunkRABZINV3cjs.ProcessingStep,
|
|
5587
6800
|
{
|
|
5588
6801
|
smartAccount: effectiveStep.smartAccount,
|
|
5589
6802
|
solanaDepositAddress: effectiveStep.solanaDepositAddress,
|
|
@@ -5595,8 +6808,8 @@ function DepositFlow({
|
|
|
5595
6808
|
amount: effectiveStep.amount,
|
|
5596
6809
|
sourceSymbol: effectiveStep.sourceSymbol,
|
|
5597
6810
|
sourceDecimals: effectiveStep.sourceDecimals,
|
|
5598
|
-
|
|
5599
|
-
hasPostBridgeActions: Boolean(_optionalChain([postBridgeActions, 'optionalAccess',
|
|
6811
|
+
amountUsd: effectiveStep.inputAmountUsd,
|
|
6812
|
+
hasPostBridgeActions: Boolean(_optionalChain([postBridgeActions, 'optionalAccess', _228 => _228.length])),
|
|
5600
6813
|
service,
|
|
5601
6814
|
directTransfer: effectiveStep.directTransfer,
|
|
5602
6815
|
onClose,
|
|
@@ -5609,16 +6822,16 @@ function DepositFlow({
|
|
|
5609
6822
|
)
|
|
5610
6823
|
] });
|
|
5611
6824
|
}
|
|
5612
|
-
if (!_optionalChain([signerContext, 'optionalAccess',
|
|
5613
|
-
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
|
|
6825
|
+
if (!_optionalChain([signerContext, 'optionalAccess', _229 => _229.walletClient]) || !_optionalChain([signerContext, 'optionalAccess', _230 => _230.publicClient])) {
|
|
6826
|
+
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" }) }) }) }) });
|
|
5614
6827
|
}
|
|
5615
6828
|
const ownerAddress = signerContext.ownerAddress;
|
|
5616
|
-
const ownerChainId = _nullishCoalesce(_nullishCoalesce(_optionalChain([signerContext, 'access',
|
|
6829
|
+
const ownerChainId = _nullishCoalesce(_nullishCoalesce(_optionalChain([signerContext, 'access', _231 => _231.walletClient, 'optionalAccess', _232 => _232.chain, 'optionalAccess', _233 => _233.id]), () => ( _optionalChain([signerContext, 'access', _234 => _234.publicClient, 'access', _235 => _235.chain, 'optionalAccess', _236 => _236.id]))), () => ( setupChainId));
|
|
5617
6830
|
const getReadClientForChain = (chainId) => {
|
|
5618
|
-
if (_optionalChain([signerContext, 'access',
|
|
6831
|
+
if (_optionalChain([signerContext, 'access', _237 => _237.publicClient, 'access', _238 => _238.chain, 'optionalAccess', _239 => _239.id]) === chainId) {
|
|
5619
6832
|
return signerContext.publicClient;
|
|
5620
6833
|
}
|
|
5621
|
-
return
|
|
6834
|
+
return _chunkRABZINV3cjs.getPublicClient.call(void 0, chainId);
|
|
5622
6835
|
};
|
|
5623
6836
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-modal-body", children: [
|
|
5624
6837
|
effectiveStep.type === "setup" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
@@ -5649,7 +6862,7 @@ function DepositFlow({
|
|
|
5649
6862
|
effectiveStep.type === "dapp-import-asset-select" && activeDappImportProvider && activeDappImportAvailability && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
5650
6863
|
DappImportAssetSelectStep,
|
|
5651
6864
|
{
|
|
5652
|
-
sourceLabel: _nullishCoalesce(_optionalChain([activeDappImportAvailability, 'access',
|
|
6865
|
+
sourceLabel: _nullishCoalesce(_optionalChain([activeDappImportAvailability, 'access', _240 => _240.assets, 'access', _241 => _241[0], 'optionalAccess', _242 => _242.sourceLabel]), () => ( activeDappImportProvider.label)),
|
|
5653
6866
|
assets: activeDappImportAvailability.assets,
|
|
5654
6867
|
onSelect: handleDappImportAssetSelected
|
|
5655
6868
|
}
|
|
@@ -5666,7 +6879,7 @@ function DepositFlow({
|
|
|
5666
6879
|
chainId: effectiveStep.asset.depositChainId,
|
|
5667
6880
|
token: effectiveStep.asset.depositToken
|
|
5668
6881
|
} : void 0,
|
|
5669
|
-
defaultAmount: _nullishCoalesce(effectiveStep.
|
|
6882
|
+
defaultAmount: _nullishCoalesce(effectiveStep.inputAmountUsd, () => ( defaultAmount)),
|
|
5670
6883
|
switchChain: signerContext.switchChain,
|
|
5671
6884
|
targetChain,
|
|
5672
6885
|
targetToken,
|
|
@@ -5675,8 +6888,8 @@ function DepositFlow({
|
|
|
5675
6888
|
service,
|
|
5676
6889
|
onContinue: handleAmountContinue,
|
|
5677
6890
|
onCtaClick: (ctaName) => {
|
|
5678
|
-
const receiveSymbol =
|
|
5679
|
-
_optionalChain([onEvent, 'optionalCall',
|
|
6891
|
+
const receiveSymbol = _chunkMILJQWPTcjs.getTargetTokenSymbol.call(void 0, targetToken, targetChain);
|
|
6892
|
+
_optionalChain([onEvent, 'optionalCall', _243 => _243({
|
|
5680
6893
|
type: "deposit_modal_connected_wallet_enter_value_cta_click",
|
|
5681
6894
|
send_token: effectiveStep.asset.symbol,
|
|
5682
6895
|
receive_token: receiveSymbol,
|
|
@@ -5703,6 +6916,7 @@ function DepositFlow({
|
|
|
5703
6916
|
switchChain: signerContext.switchChain,
|
|
5704
6917
|
liquidityWarning: effectiveStep.liquidityWarning,
|
|
5705
6918
|
uiConfig,
|
|
6919
|
+
service,
|
|
5706
6920
|
executeTransfer: isDappImportMode && activeDappImportProvider && isDappImportAsset(effectiveStep.asset) ? async (amountUnits) => {
|
|
5707
6921
|
const result = await activeDappImportProvider.executeTransfer(
|
|
5708
6922
|
{
|
|
@@ -5727,7 +6941,7 @@ function DepositFlow({
|
|
|
5727
6941
|
}
|
|
5728
6942
|
),
|
|
5729
6943
|
effectiveStep.type === "processing" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
5730
|
-
|
|
6944
|
+
_chunkRABZINV3cjs.ProcessingStep,
|
|
5731
6945
|
{
|
|
5732
6946
|
smartAccount: effectiveStep.smartAccount,
|
|
5733
6947
|
solanaDepositAddress: effectiveStep.solanaDepositAddress,
|
|
@@ -5739,8 +6953,8 @@ function DepositFlow({
|
|
|
5739
6953
|
amount: effectiveStep.amount,
|
|
5740
6954
|
sourceSymbol: effectiveStep.sourceSymbol,
|
|
5741
6955
|
sourceDecimals: effectiveStep.sourceDecimals,
|
|
5742
|
-
|
|
5743
|
-
hasPostBridgeActions: Boolean(_optionalChain([postBridgeActions, 'optionalAccess',
|
|
6956
|
+
amountUsd: effectiveStep.inputAmountUsd,
|
|
6957
|
+
hasPostBridgeActions: Boolean(_optionalChain([postBridgeActions, 'optionalAccess', _244 => _244.length])),
|
|
5744
6958
|
service,
|
|
5745
6959
|
directTransfer: effectiveStep.directTransfer,
|
|
5746
6960
|
uiConfig,
|
|
@@ -5772,15 +6986,15 @@ function formatDate(iso) {
|
|
|
5772
6986
|
month: "short",
|
|
5773
6987
|
year: "numeric"
|
|
5774
6988
|
});
|
|
5775
|
-
} catch (
|
|
6989
|
+
} catch (e33) {
|
|
5776
6990
|
return iso;
|
|
5777
6991
|
}
|
|
5778
6992
|
}
|
|
5779
6993
|
function resolveChainId(value) {
|
|
5780
6994
|
if (value === void 0 || value === null) return null;
|
|
5781
6995
|
if (typeof value === "number") return value;
|
|
5782
|
-
if (
|
|
5783
|
-
const parsed =
|
|
6996
|
+
if (_chunkMILJQWPTcjs.isSolanaCaip2.call(void 0, value) || value === "solana") return "solana";
|
|
6997
|
+
const parsed = _chunkMILJQWPTcjs.parseEvmChainId.call(void 0, value);
|
|
5784
6998
|
if (parsed !== null) return parsed;
|
|
5785
6999
|
const num = Number(value);
|
|
5786
7000
|
return Number.isFinite(num) ? num : null;
|
|
@@ -5789,7 +7003,7 @@ function resolveTokenSymbol(token, chainId) {
|
|
|
5789
7003
|
if (!token) return "";
|
|
5790
7004
|
if (chainId === "solana") {
|
|
5791
7005
|
const normalized = token.toLowerCase();
|
|
5792
|
-
const matched =
|
|
7006
|
+
const matched = _chunkMILJQWPTcjs.SOLANA_TOKENS.find(
|
|
5793
7007
|
(entry) => entry.mint.toLowerCase() === normalized
|
|
5794
7008
|
);
|
|
5795
7009
|
if (matched) return matched.symbol;
|
|
@@ -5798,7 +7012,7 @@ function resolveTokenSymbol(token, chainId) {
|
|
|
5798
7012
|
}
|
|
5799
7013
|
}
|
|
5800
7014
|
if (chainId !== null && chainId !== void 0 && chainId !== "solana" && /^0x[a-fA-F0-9]{40}$/.test(token)) {
|
|
5801
|
-
const sym =
|
|
7015
|
+
const sym = _chunkMILJQWPTcjs.getTokenSymbol.call(void 0, token, chainId);
|
|
5802
7016
|
if (sym !== "Token") return sym;
|
|
5803
7017
|
}
|
|
5804
7018
|
return shortenHash(token);
|
|
@@ -5809,7 +7023,7 @@ function formatAmount(rawAmount, token, chainId) {
|
|
|
5809
7023
|
if (token && chainId !== null && chainId !== void 0) {
|
|
5810
7024
|
if (chainId === "solana") {
|
|
5811
7025
|
const normalized = token.toLowerCase();
|
|
5812
|
-
const matched =
|
|
7026
|
+
const matched = _chunkMILJQWPTcjs.SOLANA_TOKENS.find(
|
|
5813
7027
|
(entry) => entry.mint.toLowerCase() === normalized
|
|
5814
7028
|
);
|
|
5815
7029
|
if (matched) {
|
|
@@ -5818,7 +7032,7 @@ function formatAmount(rawAmount, token, chainId) {
|
|
|
5818
7032
|
decimals = 9;
|
|
5819
7033
|
}
|
|
5820
7034
|
} else if (/^0x[a-fA-F0-9]{40}$/.test(token)) {
|
|
5821
|
-
decimals =
|
|
7035
|
+
decimals = _chunkMILJQWPTcjs.getTokenDecimalsByAddress.call(void 0, token, chainId);
|
|
5822
7036
|
}
|
|
5823
7037
|
}
|
|
5824
7038
|
try {
|
|
@@ -5830,13 +7044,13 @@ function formatAmount(rawAmount, token, chainId) {
|
|
|
5830
7044
|
let frac = fracStr.slice(0, 5).replace(/0+$/, "");
|
|
5831
7045
|
if (frac.length < 2) frac = frac.padEnd(2, "0");
|
|
5832
7046
|
return `${whole}.${frac}`;
|
|
5833
|
-
} catch (
|
|
7047
|
+
} catch (e34) {
|
|
5834
7048
|
return rawAmount;
|
|
5835
7049
|
}
|
|
5836
7050
|
}
|
|
5837
7051
|
function getTxExplorerUrl(txHash, chainId) {
|
|
5838
7052
|
if (!chainId) return null;
|
|
5839
|
-
const base2 =
|
|
7053
|
+
const base2 = _chunkMILJQWPTcjs.getExplorerUrl.call(void 0, chainId);
|
|
5840
7054
|
if (!base2) return null;
|
|
5841
7055
|
return `${base2}/tx/${txHash}`;
|
|
5842
7056
|
}
|
|
@@ -5879,7 +7093,7 @@ function DepositHistoryPanel({
|
|
|
5879
7093
|
);
|
|
5880
7094
|
const visibleDeposits = _react.useMemo.call(void 0, () => {
|
|
5881
7095
|
const sourceHashes = new Set(
|
|
5882
|
-
deposits.map((d) => _optionalChain([d, 'access',
|
|
7096
|
+
deposits.map((d) => _optionalChain([d, 'access', _245 => _245.sourceTxHash, 'optionalAccess', _246 => _246.toLowerCase, 'call', _247 => _247()])).filter((h) => Boolean(h))
|
|
5883
7097
|
);
|
|
5884
7098
|
return deposits.filter(
|
|
5885
7099
|
(d) => !(d.txHash && sourceHashes.has(d.txHash.toLowerCase()))
|
|
@@ -5901,7 +7115,7 @@ function DepositHistoryPanel({
|
|
|
5901
7115
|
className: "rs-modal-header-back",
|
|
5902
7116
|
"aria-label": "Back",
|
|
5903
7117
|
onClick: onClose,
|
|
5904
|
-
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
7118
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkRABZINV3cjs.ChevronLeftIcon, {})
|
|
5905
7119
|
}
|
|
5906
7120
|
) }),
|
|
5907
7121
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-modal-header-nav-right", children: onCloseModal && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
@@ -5911,29 +7125,29 @@ function DepositHistoryPanel({
|
|
|
5911
7125
|
className: "rs-modal-close",
|
|
5912
7126
|
"aria-label": "Close",
|
|
5913
7127
|
onClick: onCloseModal,
|
|
5914
|
-
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
7128
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkRABZINV3cjs.CloseIcon, {})
|
|
5915
7129
|
}
|
|
5916
7130
|
) })
|
|
5917
7131
|
] }),
|
|
5918
7132
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-history-screen", children: [
|
|
5919
7133
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-history-screen-body", children: [
|
|
5920
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
7134
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkRABZINV3cjs.BodyHeader, { icon: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkRABZINV3cjs.HistoryIcon, {}), title: "History" }),
|
|
5921
7135
|
isLoading && deposits.length === 0 && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-history-empty", children: [
|
|
5922
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-history-empty-glyph", "aria-hidden": "true", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
7136
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-history-empty-glyph", "aria-hidden": "true", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkRABZINV3cjs.HistoryIcon, {}) }),
|
|
5923
7137
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-history-empty-text", children: [
|
|
5924
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
7138
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkRABZINV3cjs.Spinner, { className: "rs-spinner--sm" }),
|
|
5925
7139
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-history-empty-hint", children: "Loading history\u2026" })
|
|
5926
7140
|
] })
|
|
5927
7141
|
] }),
|
|
5928
7142
|
error && !isLoading && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-history-empty", children: [
|
|
5929
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-history-empty-glyph", "aria-hidden": "true", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
7143
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-history-empty-glyph", "aria-hidden": "true", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkRABZINV3cjs.AlertTriangleIcon, {}) }),
|
|
5930
7144
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-history-empty-text", children: [
|
|
5931
7145
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-history-empty-title", children: "Couldn't load history" }),
|
|
5932
7146
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-history-empty-hint", children: error })
|
|
5933
7147
|
] })
|
|
5934
7148
|
] }),
|
|
5935
7149
|
!isLoading && !error && visibleDeposits.length === 0 && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-history-empty", children: [
|
|
5936
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-history-empty-glyph", "aria-hidden": "true", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
7150
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-history-empty-glyph", "aria-hidden": "true", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkRABZINV3cjs.HistoryIcon, {}) }),
|
|
5937
7151
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-history-empty-text", children: [
|
|
5938
7152
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-history-empty-title", children: "No deposits yet" }),
|
|
5939
7153
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-history-empty-hint", children: "Your deposit history will appear here" })
|
|
@@ -5953,7 +7167,7 @@ function DepositHistoryPanel({
|
|
|
5953
7167
|
)
|
|
5954
7168
|
] })
|
|
5955
7169
|
] }),
|
|
5956
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
7170
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkRABZINV3cjs.PoweredBy, {})
|
|
5957
7171
|
] })
|
|
5958
7172
|
]
|
|
5959
7173
|
}
|
|
@@ -5964,12 +7178,12 @@ function HistoryCard({ deposit }) {
|
|
|
5964
7178
|
const status = normalizeStatus(deposit.status, deposit.isSpam);
|
|
5965
7179
|
const sourceChainId = resolveChainId(deposit.chain);
|
|
5966
7180
|
const targetChainId = resolveChainId(deposit.targetChain);
|
|
5967
|
-
const sourceChainName = sourceChainId ?
|
|
5968
|
-
const targetChainName = targetChainId ?
|
|
5969
|
-
const sourceChainIcon = sourceChainId ?
|
|
5970
|
-
const targetChainIcon = targetChainId ?
|
|
7181
|
+
const sourceChainName = sourceChainId ? _chunkMILJQWPTcjs.getChainName.call(void 0, sourceChainId) : null;
|
|
7182
|
+
const targetChainName = targetChainId ? _chunkMILJQWPTcjs.getChainName.call(void 0, targetChainId) : null;
|
|
7183
|
+
const sourceChainIcon = sourceChainId ? _chunkMILJQWPTcjs.getChainIcon.call(void 0, sourceChainId) : void 0;
|
|
7184
|
+
const targetChainIcon = targetChainId ? _chunkMILJQWPTcjs.getChainIcon.call(void 0, targetChainId) : void 0;
|
|
5971
7185
|
const sourceSymbol = resolveTokenSymbol(deposit.token, sourceChainId);
|
|
5972
|
-
const sourceTokenIcon = sourceSymbol ?
|
|
7186
|
+
const sourceTokenIcon = sourceSymbol ? _chunkMILJQWPTcjs.getTokenIcon.call(void 0, sourceSymbol) : void 0;
|
|
5973
7187
|
const rawAmount = deposit.sourceAmount && deposit.sourceAmount !== "0" ? deposit.sourceAmount : deposit.amount;
|
|
5974
7188
|
const formattedAmount = rawAmount ? formatAmount(rawAmount, deposit.token, sourceChainId) : null;
|
|
5975
7189
|
const displayAmount = formattedAmount ? sourceSymbol && /^USD/.test(sourceSymbol) ? `$${Number(formattedAmount).toLocaleString("en-US", {
|
|
@@ -6001,7 +7215,7 @@ function HistoryCard({ deposit }) {
|
|
|
6001
7215
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: `rs-history-badge rs-history-badge--${status}`, children: STATUS_LABEL[status] })
|
|
6002
7216
|
] })
|
|
6003
7217
|
] }),
|
|
6004
|
-
|
|
7218
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-history-card-panel", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-history-card-panel-inner", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-history-card-details", children: [
|
|
6005
7219
|
sourceChainName && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-amount-detail-row", children: [
|
|
6006
7220
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: "Source chain" }),
|
|
6007
7221
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "rs-amount-detail-value", children: [
|
|
@@ -6028,12 +7242,12 @@ function HistoryCard({ deposit }) {
|
|
|
6028
7242
|
onClick: (e) => e.stopPropagation(),
|
|
6029
7243
|
children: [
|
|
6030
7244
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: shortenHash(deposit.sourceTxHash) }),
|
|
6031
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
7245
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkRABZINV3cjs.ArrowUpRightIcon, {})
|
|
6032
7246
|
]
|
|
6033
7247
|
}
|
|
6034
7248
|
)
|
|
6035
7249
|
] })
|
|
6036
|
-
] })
|
|
7250
|
+
] }) }) })
|
|
6037
7251
|
]
|
|
6038
7252
|
}
|
|
6039
7253
|
);
|
|
@@ -6043,7 +7257,7 @@ DepositHistoryPanel.displayName = "DepositHistoryPanel";
|
|
|
6043
7257
|
// src/DepositModal.tsx
|
|
6044
7258
|
|
|
6045
7259
|
var ReownDepositInner = _react.lazy.call(void 0,
|
|
6046
|
-
() => Promise.resolve().then(() => _interopRequireWildcard(require("./DepositModalReown-
|
|
7260
|
+
() => Promise.resolve().then(() => _interopRequireWildcard(require("./DepositModalReown-DNW4GH6L.cjs"))).then((m) => ({ default: m.DepositModalReown }))
|
|
6047
7261
|
);
|
|
6048
7262
|
function sortByCreatedAtDesc(items) {
|
|
6049
7263
|
return [...items].sort((a, b) => {
|
|
@@ -6092,14 +7306,17 @@ function DepositModalInner({
|
|
|
6092
7306
|
defaultAmount,
|
|
6093
7307
|
recipient,
|
|
6094
7308
|
appBalanceUsd,
|
|
6095
|
-
backendUrl =
|
|
7309
|
+
backendUrl = _chunkMILJQWPTcjs.DEFAULT_BACKEND_URL,
|
|
6096
7310
|
solanaRpcUrl,
|
|
6097
|
-
signerAddress =
|
|
7311
|
+
signerAddress = _chunkMILJQWPTcjs.DEFAULT_SIGNER_ADDRESS,
|
|
6098
7312
|
sessionChainIds,
|
|
6099
7313
|
forceRegister = false,
|
|
6100
|
-
waitForFinalTx = true,
|
|
6101
7314
|
enableSolana = true,
|
|
6102
7315
|
dappImports,
|
|
7316
|
+
enableFiatOnramp = false,
|
|
7317
|
+
enableQrTransfer = true,
|
|
7318
|
+
fiatOnrampMethods,
|
|
7319
|
+
enableExchangeConnect = false,
|
|
6103
7320
|
postBridgeActions,
|
|
6104
7321
|
outputTokenRules,
|
|
6105
7322
|
rejectUnmapped,
|
|
@@ -6118,12 +7335,12 @@ function DepositModalInner({
|
|
|
6118
7335
|
debug
|
|
6119
7336
|
}) {
|
|
6120
7337
|
const modalRef = _react.useRef.call(void 0, null);
|
|
6121
|
-
const onReadyRef =
|
|
7338
|
+
const onReadyRef = _chunkRABZINV3cjs.useLatestRef.call(void 0, onReady);
|
|
6122
7339
|
const [currentScreen, setCurrentScreen] = _react.useState.call(void 0, "connect");
|
|
6123
7340
|
const [backHandler, setBackHandler] = _react.useState.call(void 0,
|
|
6124
7341
|
void 0
|
|
6125
7342
|
);
|
|
6126
|
-
const showHistoryButton = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess',
|
|
7343
|
+
const showHistoryButton = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess', _248 => _248.showHistoryButton]), () => ( false));
|
|
6127
7344
|
const historyButtonVisible = showHistoryButton && (currentScreen === "select-asset" || currentScreen === "deposit-address");
|
|
6128
7345
|
const [historyOpen, setHistoryOpen] = _react.useState.call(void 0, false);
|
|
6129
7346
|
const [historyDeposits, setHistoryDeposits] = _react.useState.call(void 0, []);
|
|
@@ -6134,10 +7351,35 @@ function DepositModalInner({
|
|
|
6134
7351
|
const cursorRef = _react.useRef.call(void 0, null);
|
|
6135
7352
|
const historyStaleRef = _react.useRef.call(void 0, false);
|
|
6136
7353
|
const historyLoadedRef = _react.useRef.call(void 0, false);
|
|
6137
|
-
const targetChain = targetChainProp === "solana" ? "solana" :
|
|
6138
|
-
const sourceChain = sourceChainProp ?
|
|
7354
|
+
const targetChain = targetChainProp === "solana" ? "solana" : _chunkMILJQWPTcjs.getChainId.call(void 0, targetChainProp);
|
|
7355
|
+
const sourceChain = sourceChainProp ? _chunkMILJQWPTcjs.getChainId.call(void 0, sourceChainProp) : void 0;
|
|
7356
|
+
const [recipientIsContract, setRecipientIsContract] = _react.useState.call(void 0, false);
|
|
7357
|
+
const onErrorRef = _chunkRABZINV3cjs.useLatestRef.call(void 0, onError);
|
|
7358
|
+
_react.useEffect.call(void 0, () => {
|
|
7359
|
+
if (targetChain !== _chunkMILJQWPTcjs.HYPERCORE_CHAIN_ID || !_viem.isAddress.call(void 0, recipient, { strict: false })) {
|
|
7360
|
+
setRecipientIsContract(false);
|
|
7361
|
+
return;
|
|
7362
|
+
}
|
|
7363
|
+
let cancelled = false;
|
|
7364
|
+
_chunkRABZINV3cjs.getHyperEvmReadClient.call(void 0, ).getCode({ address: recipient }).then((code) => {
|
|
7365
|
+
if (cancelled) return;
|
|
7366
|
+
const isContract = _chunkMILJQWPTcjs.isContractBytecode.call(void 0, code);
|
|
7367
|
+
setRecipientIsContract(isContract);
|
|
7368
|
+
if (isContract) {
|
|
7369
|
+
_optionalChain([onErrorRef, 'access', _249 => _249.current, 'optionalCall', _250 => _250({
|
|
7370
|
+
message: "HyperCore deposits require an EOA recipient; the configured recipient is a smart contract.",
|
|
7371
|
+
code: "HYPERCORE_RECIPIENT_NOT_EOA"
|
|
7372
|
+
})]);
|
|
7373
|
+
}
|
|
7374
|
+
}).catch(() => {
|
|
7375
|
+
if (!cancelled) setRecipientIsContract(false);
|
|
7376
|
+
});
|
|
7377
|
+
return () => {
|
|
7378
|
+
cancelled = true;
|
|
7379
|
+
};
|
|
7380
|
+
}, [targetChain, recipient, onErrorRef]);
|
|
6139
7381
|
const service = _react.useMemo.call(void 0,
|
|
6140
|
-
() =>
|
|
7382
|
+
() => _chunkRABZINV3cjs.createDepositService.call(void 0, backendUrl, {
|
|
6141
7383
|
debug,
|
|
6142
7384
|
debugScope: "service:deposit"
|
|
6143
7385
|
}),
|
|
@@ -6153,7 +7395,7 @@ function DepositModalInner({
|
|
|
6153
7395
|
}, [store, targetChain, targetToken]);
|
|
6154
7396
|
_react.useEffect.call(void 0, () => {
|
|
6155
7397
|
if (isOpen && modalRef.current) {
|
|
6156
|
-
|
|
7398
|
+
_chunkRABZINV3cjs.applyTheme.call(void 0, modalRef.current, theme);
|
|
6157
7399
|
}
|
|
6158
7400
|
}, [isOpen, theme]);
|
|
6159
7401
|
_react.useEffect.call(void 0, () => {
|
|
@@ -6161,7 +7403,7 @@ function DepositModalInner({
|
|
|
6161
7403
|
}, [solanaRpcUrl]);
|
|
6162
7404
|
_react.useEffect.call(void 0, () => {
|
|
6163
7405
|
if (isOpen) {
|
|
6164
|
-
_optionalChain([onReadyRef, 'access',
|
|
7406
|
+
_optionalChain([onReadyRef, 'access', _251 => _251.current, 'optionalCall', _252 => _252()]);
|
|
6165
7407
|
}
|
|
6166
7408
|
}, [isOpen, onReadyRef]);
|
|
6167
7409
|
const handleStepChange = _react.useCallback.call(void 0,
|
|
@@ -6237,10 +7479,10 @@ function DepositModalInner({
|
|
|
6237
7479
|
fetchHistory("initial");
|
|
6238
7480
|
}
|
|
6239
7481
|
}, [historyOpen, fetchHistory]);
|
|
6240
|
-
const onLifecycleRef =
|
|
7482
|
+
const onLifecycleRef = _chunkRABZINV3cjs.useLatestRef.call(void 0, onLifecycle);
|
|
6241
7483
|
const handleLifecycle = _react.useCallback.call(void 0,
|
|
6242
7484
|
(event) => {
|
|
6243
|
-
_optionalChain([onLifecycleRef, 'access',
|
|
7485
|
+
_optionalChain([onLifecycleRef, 'access', _253 => _253.current, 'optionalCall', _254 => _254(event)]);
|
|
6244
7486
|
if (event.type === "smart-account-changed" && !event.evm && !event.solana) {
|
|
6245
7487
|
historyStaleRef.current = true;
|
|
6246
7488
|
}
|
|
@@ -6266,10 +7508,10 @@ function DepositModalInner({
|
|
|
6266
7508
|
store.dispatch({ type: "flow/reset" });
|
|
6267
7509
|
}
|
|
6268
7510
|
}, [isOpen, store]);
|
|
6269
|
-
const showBackButton = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess',
|
|
7511
|
+
const showBackButton = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess', _255 => _255.showBackButton]), () => ( true));
|
|
6270
7512
|
const canGoBack = backHandler !== void 0;
|
|
6271
7513
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, DepositStoreProvider, { store, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
6272
|
-
|
|
7514
|
+
_chunkRABZINV3cjs.Modal,
|
|
6273
7515
|
{
|
|
6274
7516
|
isOpen,
|
|
6275
7517
|
onClose,
|
|
@@ -6285,7 +7527,7 @@ function DepositModalInner({
|
|
|
6285
7527
|
className: "rs-modal-header-back",
|
|
6286
7528
|
"aria-label": "Go back",
|
|
6287
7529
|
onClick: backHandler,
|
|
6288
|
-
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
7530
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkRABZINV3cjs.ChevronLeftIcon, {})
|
|
6289
7531
|
}
|
|
6290
7532
|
) }),
|
|
6291
7533
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-modal-header-nav-right", children: [
|
|
@@ -6297,7 +7539,7 @@ function DepositModalInner({
|
|
|
6297
7539
|
"aria-label": "Deposit history",
|
|
6298
7540
|
onClick: handleHistoryOpen,
|
|
6299
7541
|
disabled: !recipient,
|
|
6300
|
-
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
7542
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkRABZINV3cjs.HistoryIcon, {})
|
|
6301
7543
|
}
|
|
6302
7544
|
),
|
|
6303
7545
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
@@ -6307,12 +7549,12 @@ function DepositModalInner({
|
|
|
6307
7549
|
onClick: onClose,
|
|
6308
7550
|
className: "rs-modal-close",
|
|
6309
7551
|
"aria-label": "Close",
|
|
6310
|
-
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
7552
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkRABZINV3cjs.CloseIcon, {})
|
|
6311
7553
|
}
|
|
6312
7554
|
)
|
|
6313
7555
|
] })
|
|
6314
7556
|
] }),
|
|
6315
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
7557
|
+
recipientIsContract ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-modal-body", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkRABZINV3cjs.Callout, { variant: "error", children: "HyperCore deposits require an EOA recipient. The configured recipient is a smart contract, which is not supported." }) }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
6316
7558
|
DepositFlow,
|
|
6317
7559
|
{
|
|
6318
7560
|
dappWalletClient,
|
|
@@ -6333,9 +7575,12 @@ function DepositModalInner({
|
|
|
6333
7575
|
signerAddress,
|
|
6334
7576
|
sessionChainIds,
|
|
6335
7577
|
forceRegister,
|
|
6336
|
-
waitForFinalTx,
|
|
6337
7578
|
enableSolana,
|
|
6338
7579
|
dappImports,
|
|
7580
|
+
enableFiatOnramp,
|
|
7581
|
+
enableQrTransfer,
|
|
7582
|
+
fiatOnrampMethods,
|
|
7583
|
+
enableExchangeConnect,
|
|
6339
7584
|
reownWallet,
|
|
6340
7585
|
onConnect,
|
|
6341
7586
|
onDisconnect,
|