@rhinestone/deposit-modal 0.1.66 → 0.1.67
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{DepositModalReown-RXIVPSEE.mjs → DepositModalReown-EYIV6APK.mjs} +3 -3
- package/dist/{DepositModalReown-WFXQKZDH.cjs → DepositModalReown-UPYZN2XA.cjs} +4 -4
- package/dist/{WithdrawModalReown-MME7VSKX.mjs → WithdrawModalReown-6VYKKKJN.mjs} +3 -3
- package/dist/{WithdrawModalReown-PXS44GZO.cjs → WithdrawModalReown-WHPQDJJJ.cjs} +4 -4
- package/dist/{chunk-CULXRW6U.mjs → chunk-5FDIQNJJ.mjs} +22 -19
- package/dist/{chunk-JZWCK7C3.cjs → chunk-FLVSQDP4.cjs} +98 -91
- package/dist/{chunk-FWGLRTWF.mjs → chunk-IUW3SJQT.mjs} +61 -54
- package/dist/{chunk-75LRORPO.cjs → chunk-LTLFJPHO.cjs} +106 -103
- package/dist/{chunk-R6U6BHCV.cjs → chunk-MUWVDVY4.cjs} +13 -1
- package/dist/{chunk-JDO7QPPH.mjs → chunk-NFE5ZLD3.mjs} +786 -392
- package/dist/{chunk-CIXHTOO3.mjs → chunk-SDZKKUCJ.mjs} +13 -1
- package/dist/{chunk-5GN4QU67.cjs → chunk-UDKZWFCM.cjs} +842 -448
- package/dist/constants.cjs +2 -2
- package/dist/constants.mjs +1 -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 +5 -5
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.mjs +4 -4
- package/dist/reown.cjs +5 -5
- package/dist/reown.d.cts +1 -1
- package/dist/reown.d.ts +1 -1
- package/dist/reown.mjs +4 -4
- package/dist/styles.css +264 -33
- package/dist/{types-ymKENnUK.d.ts → types-DGQzvl6v.d.ts} +11 -1
- package/dist/{types-DjaZ9sa8.d.cts → types-DJ1fzNC7.d.cts} +11 -1
- 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 +5 -5
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
|
|
29
29
|
|
|
30
30
|
|
|
31
|
-
var
|
|
31
|
+
var _chunkFLVSQDP4cjs = require('./chunk-FLVSQDP4.cjs');
|
|
32
32
|
|
|
33
33
|
|
|
34
34
|
|
|
@@ -46,7 +46,8 @@ var _chunkJZWCK7C3cjs = require('./chunk-JZWCK7C3.cjs');
|
|
|
46
46
|
|
|
47
47
|
|
|
48
48
|
|
|
49
|
-
|
|
49
|
+
|
|
50
|
+
var _chunkMUWVDVY4cjs = require('./chunk-MUWVDVY4.cjs');
|
|
50
51
|
|
|
51
52
|
// src/DepositModal.tsx
|
|
52
53
|
|
|
@@ -61,20 +62,21 @@ var _react = require('react');
|
|
|
61
62
|
|
|
62
63
|
// src/DepositFlow.tsx
|
|
63
64
|
|
|
65
|
+
var _viem = require('viem');
|
|
64
66
|
|
|
65
67
|
// src/components/steps/SetupStep.tsx
|
|
66
68
|
|
|
67
69
|
var _jsxruntime = require('react/jsx-runtime');
|
|
68
70
|
async function resolveSessionOwner(eoaAddress) {
|
|
69
|
-
const localOwner =
|
|
71
|
+
const localOwner = _chunkFLVSQDP4cjs.loadSessionOwnerFromStorage.call(void 0, eoaAddress);
|
|
70
72
|
if (localOwner) {
|
|
71
73
|
return {
|
|
72
|
-
account:
|
|
74
|
+
account: _chunkFLVSQDP4cjs.accountFromPrivateKey.call(void 0, localOwner.privateKey),
|
|
73
75
|
address: localOwner.address
|
|
74
76
|
};
|
|
75
77
|
}
|
|
76
|
-
const created =
|
|
77
|
-
|
|
78
|
+
const created = _chunkFLVSQDP4cjs.createSessionOwnerKey.call(void 0, );
|
|
79
|
+
_chunkFLVSQDP4cjs.saveSessionOwnerToStorage.call(void 0, eoaAddress, created.privateKey, created.address);
|
|
78
80
|
return {
|
|
79
81
|
account: created.account,
|
|
80
82
|
address: created.address
|
|
@@ -89,6 +91,8 @@ function SetupStep({
|
|
|
89
91
|
sessionChainIds,
|
|
90
92
|
recipient,
|
|
91
93
|
postBridgeActions,
|
|
94
|
+
outputTokenRules,
|
|
95
|
+
rejectUnmapped,
|
|
92
96
|
forceRegister,
|
|
93
97
|
enableSolana = true,
|
|
94
98
|
service,
|
|
@@ -111,7 +115,7 @@ function SetupStep({
|
|
|
111
115
|
const setup = await service.setupAccount({
|
|
112
116
|
ownerAddress: address,
|
|
113
117
|
sessionOwnerAddress: sessionOwner.address,
|
|
114
|
-
targetChain:
|
|
118
|
+
targetChain: _chunkFLVSQDP4cjs.toEvmCaip2.call(void 0, targetChain),
|
|
115
119
|
targetToken,
|
|
116
120
|
recipient,
|
|
117
121
|
postBridgeActions,
|
|
@@ -143,7 +147,7 @@ function SetupStep({
|
|
|
143
147
|
primaryType: typedData.primaryType,
|
|
144
148
|
message: typedData.message
|
|
145
149
|
});
|
|
146
|
-
const sessionDetails =
|
|
150
|
+
const sessionDetails = _chunkFLVSQDP4cjs.buildSessionDetails.call(void 0, setup.sessionDetailsUnsigned, signature);
|
|
147
151
|
setState({ type: "registering" });
|
|
148
152
|
const registerResult = await service.registerAccount({
|
|
149
153
|
address: smartAccount,
|
|
@@ -155,14 +159,16 @@ function SetupStep({
|
|
|
155
159
|
eoaAddress: address,
|
|
156
160
|
sessionOwner: sessionOwner.address,
|
|
157
161
|
target: {
|
|
158
|
-
chain:
|
|
162
|
+
chain: _chunkFLVSQDP4cjs.toEvmCaip2.call(void 0, targetChain),
|
|
159
163
|
token: targetToken,
|
|
160
164
|
...recipient && { recipient },
|
|
161
|
-
..._optionalChain([postBridgeActions, 'optionalAccess', _2 => _2.length]) && { postBridgeActions }
|
|
165
|
+
..._optionalChain([postBridgeActions, 'optionalAccess', _2 => _2.length]) && { postBridgeActions },
|
|
166
|
+
..._optionalChain([outputTokenRules, 'optionalAccess', _3 => _3.length]) && { outputTokenRules },
|
|
167
|
+
...rejectUnmapped != null && { rejectUnmapped }
|
|
162
168
|
}
|
|
163
169
|
});
|
|
164
170
|
setState({ type: "ready", smartAccount });
|
|
165
|
-
_optionalChain([onConnected, 'optionalCall',
|
|
171
|
+
_optionalChain([onConnected, 'optionalCall', _4 => _4(address, smartAccount)]);
|
|
166
172
|
onSetupComplete(
|
|
167
173
|
smartAccount,
|
|
168
174
|
enableSolana ? registerResult.solanaDepositAddress : void 0
|
|
@@ -170,7 +176,7 @@ function SetupStep({
|
|
|
170
176
|
} catch (error) {
|
|
171
177
|
const message = error instanceof Error ? error.message : "Setup failed";
|
|
172
178
|
setState({ type: "error", message });
|
|
173
|
-
_optionalChain([onError, 'optionalCall',
|
|
179
|
+
_optionalChain([onError, 'optionalCall', _5 => _5(message, "SETUP_ERROR")]);
|
|
174
180
|
}
|
|
175
181
|
}, [
|
|
176
182
|
address,
|
|
@@ -220,7 +226,7 @@ function SetupStep({
|
|
|
220
226
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-step", children: [
|
|
221
227
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-loading-state", children: [
|
|
222
228
|
isLoading && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
223
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
229
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFLVSQDP4cjs.Spinner, { className: "rs-spinner--lg rs-text-accent" }),
|
|
224
230
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-loading-text", children: [
|
|
225
231
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-loading-title", children: renderStateMessage() }),
|
|
226
232
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-loading-subtitle", children: "This may take a moment" })
|
|
@@ -257,13 +263,13 @@ function SetupStep({
|
|
|
257
263
|
] })
|
|
258
264
|
] })
|
|
259
265
|
] }),
|
|
260
|
-
isError && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-step-footer", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
266
|
+
isError && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-step-footer", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFLVSQDP4cjs.Button, { onClick: handleRetry, variant: "default", fullWidth: true, children: "Try Again" }) })
|
|
261
267
|
] });
|
|
262
268
|
}
|
|
263
269
|
|
|
264
270
|
// src/components/steps/AssetSelectStep.tsx
|
|
265
271
|
|
|
266
|
-
|
|
272
|
+
|
|
267
273
|
|
|
268
274
|
function AssetSelectStep({
|
|
269
275
|
address,
|
|
@@ -274,7 +280,8 @@ function AssetSelectStep({
|
|
|
274
280
|
service,
|
|
275
281
|
onContinue,
|
|
276
282
|
onTotalBalanceComputed,
|
|
277
|
-
onAssetsLoaded
|
|
283
|
+
onAssetsLoaded,
|
|
284
|
+
onDisconnect
|
|
278
285
|
}) {
|
|
279
286
|
const [assets, setAssets] = _react.useState.call(void 0, []);
|
|
280
287
|
const [selectedAssetId, setSelectedAssetId] = _react.useState.call(void 0, null);
|
|
@@ -282,7 +289,7 @@ function AssetSelectStep({
|
|
|
282
289
|
const [error, setError] = _react.useState.call(void 0, null);
|
|
283
290
|
const defaultAssetId = _react.useMemo.call(void 0, () => {
|
|
284
291
|
if (!defaultSourceChain || !defaultSourceToken) return null;
|
|
285
|
-
return
|
|
292
|
+
return _chunkFLVSQDP4cjs.getAssetId.call(void 0, {
|
|
286
293
|
chainId: defaultSourceChain,
|
|
287
294
|
token: defaultSourceToken
|
|
288
295
|
});
|
|
@@ -299,10 +306,10 @@ function AssetSelectStep({
|
|
|
299
306
|
try {
|
|
300
307
|
const portfolio = await service.fetchPortfolio(address);
|
|
301
308
|
if (!active) return;
|
|
302
|
-
const portfolioAssets =
|
|
309
|
+
const portfolioAssets = _chunkFLVSQDP4cjs.portfolioToAssets.call(void 0, portfolio.tokens);
|
|
303
310
|
setAssets(portfolioAssets);
|
|
304
311
|
const hasNative = portfolioAssets.some(
|
|
305
|
-
(asset) => asset.token.toLowerCase() ===
|
|
312
|
+
(asset) => asset.token.toLowerCase() === _chunkMUWVDVY4cjs.NATIVE_TOKEN_ADDRESS
|
|
306
313
|
);
|
|
307
314
|
if (!hasNative) {
|
|
308
315
|
const nativeAssets = await fetchNativeAssets(
|
|
@@ -340,16 +347,16 @@ function AssetSelectStep({
|
|
|
340
347
|
(sum, asset) => sum + (_nullishCoalesce(asset.balanceUsd, () => ( 0))),
|
|
341
348
|
0
|
|
342
349
|
);
|
|
343
|
-
_optionalChain([onTotalBalanceComputed, 'optionalCall',
|
|
344
|
-
if (assets.length > 0) _optionalChain([onAssetsLoaded, 'optionalCall',
|
|
350
|
+
_optionalChain([onTotalBalanceComputed, 'optionalCall', _6 => _6(total)]);
|
|
351
|
+
if (assets.length > 0) _optionalChain([onAssetsLoaded, 'optionalCall', _7 => _7(assets)]);
|
|
345
352
|
}, [assets, onTotalBalanceComputed, onAssetsLoaded]);
|
|
346
353
|
const allowedChainSet = _react.useMemo.call(void 0,
|
|
347
|
-
() => _optionalChain([allowedRoutes, 'optionalAccess',
|
|
348
|
-
[_optionalChain([allowedRoutes, 'optionalAccess',
|
|
354
|
+
() => _optionalChain([allowedRoutes, 'optionalAccess', _8 => _8.sourceChains]) ? new Set(allowedRoutes.sourceChains) : null,
|
|
355
|
+
[_optionalChain([allowedRoutes, 'optionalAccess', _9 => _9.sourceChains])]
|
|
349
356
|
);
|
|
350
357
|
const allowedTokenSet = _react.useMemo.call(void 0,
|
|
351
|
-
() => _optionalChain([allowedRoutes, 'optionalAccess',
|
|
352
|
-
[_optionalChain([allowedRoutes, 'optionalAccess',
|
|
358
|
+
() => _optionalChain([allowedRoutes, 'optionalAccess', _10 => _10.sourceTokens]) ? new Set(allowedRoutes.sourceTokens.map((s) => s.toUpperCase())) : null,
|
|
359
|
+
[_optionalChain([allowedRoutes, 'optionalAccess', _11 => _11.sourceTokens])]
|
|
353
360
|
);
|
|
354
361
|
const rows = _react.useMemo.call(void 0, () => {
|
|
355
362
|
return assets.filter((a) => {
|
|
@@ -380,7 +387,7 @@ function AssetSelectStep({
|
|
|
380
387
|
const raw = _viem.formatUnits.call(void 0, BigInt(asset.balance), asset.decimals);
|
|
381
388
|
const numeric = Number(raw);
|
|
382
389
|
if (!Number.isFinite(numeric)) return raw;
|
|
383
|
-
return
|
|
390
|
+
return _chunkFLVSQDP4cjs.tokenFormatter.format(numeric);
|
|
384
391
|
} catch (e3) {
|
|
385
392
|
return asset.balance;
|
|
386
393
|
}
|
|
@@ -394,7 +401,7 @@ function AssetSelectStep({
|
|
|
394
401
|
style: { paddingTop: 4, overflow: "auto", maxHeight: 340 },
|
|
395
402
|
children: [
|
|
396
403
|
loading && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-loading-state", style: { padding: "40px 12px" }, children: [
|
|
397
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
404
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFLVSQDP4cjs.Spinner, { className: "rs-text-tertiary" }),
|
|
398
405
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-text-sm rs-text-tertiary", children: "Loading balances" })
|
|
399
406
|
] }),
|
|
400
407
|
error && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-alert rs-alert--error", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-alert-text", children: error }) }),
|
|
@@ -422,14 +429,23 @@ function AssetSelectStep({
|
|
|
422
429
|
address.slice(0, 6),
|
|
423
430
|
"...",
|
|
424
431
|
address.slice(-4)
|
|
425
|
-
] })
|
|
432
|
+
] }),
|
|
433
|
+
onDisconnect && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
434
|
+
"button",
|
|
435
|
+
{
|
|
436
|
+
type: "button",
|
|
437
|
+
className: "rs-empty-disconnect",
|
|
438
|
+
onClick: onDisconnect,
|
|
439
|
+
children: "Disconnect wallet"
|
|
440
|
+
}
|
|
441
|
+
)
|
|
426
442
|
] }),
|
|
427
443
|
!loading && !error && rows.length > 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-asset-list", children: rows.map((asset) => {
|
|
428
444
|
const isSelected = selectedAssetId === asset.id;
|
|
429
445
|
const tokenAmount = formatBalance(asset);
|
|
430
|
-
const badge =
|
|
431
|
-
const tokenIcon =
|
|
432
|
-
const chainIcon =
|
|
446
|
+
const badge = _chunkMUWVDVY4cjs.getChainBadge.call(void 0, asset.chainId);
|
|
447
|
+
const tokenIcon = _chunkMUWVDVY4cjs.getTokenIcon.call(void 0, asset.symbol);
|
|
448
|
+
const chainIcon = _chunkMUWVDVY4cjs.getChainIcon.call(void 0, asset.chainId);
|
|
433
449
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
434
450
|
"button",
|
|
435
451
|
{
|
|
@@ -453,7 +469,7 @@ function AssetSelectStep({
|
|
|
453
469
|
"img",
|
|
454
470
|
{
|
|
455
471
|
src: chainIcon,
|
|
456
|
-
alt:
|
|
472
|
+
alt: _chunkMUWVDVY4cjs.getChainName.call(void 0, asset.chainId),
|
|
457
473
|
className: "rs-asset-chain-badge"
|
|
458
474
|
}
|
|
459
475
|
) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
@@ -474,7 +490,7 @@ function AssetSelectStep({
|
|
|
474
490
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "rs-asset-chain", children: [
|
|
475
491
|
" ",
|
|
476
492
|
"on ",
|
|
477
|
-
|
|
493
|
+
_chunkMUWVDVY4cjs.getChainName.call(void 0, asset.chainId)
|
|
478
494
|
] })
|
|
479
495
|
] }),
|
|
480
496
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-asset-balance-small", children: [
|
|
@@ -484,7 +500,7 @@ function AssetSelectStep({
|
|
|
484
500
|
] })
|
|
485
501
|
] })
|
|
486
502
|
] }),
|
|
487
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-asset-balance", children: asset.balanceUsd !== void 0 && asset.balanceUsd > 0 ?
|
|
503
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-asset-balance", children: asset.balanceUsd !== void 0 && asset.balanceUsd > 0 ? _chunkFLVSQDP4cjs.currencyFormatter.format(asset.balanceUsd) : tokenAmount !== "--" ? `${tokenAmount} ${asset.symbol}` : "--" })
|
|
488
504
|
]
|
|
489
505
|
},
|
|
490
506
|
asset.id
|
|
@@ -494,7 +510,7 @@ function AssetSelectStep({
|
|
|
494
510
|
}
|
|
495
511
|
),
|
|
496
512
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-step-footer", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
497
|
-
|
|
513
|
+
_chunkFLVSQDP4cjs.Button,
|
|
498
514
|
{
|
|
499
515
|
onClick: () => selectedAsset && onContinue(selectedAsset),
|
|
500
516
|
disabled: !selectedAsset,
|
|
@@ -502,17 +518,17 @@ function AssetSelectStep({
|
|
|
502
518
|
children: "Continue"
|
|
503
519
|
}
|
|
504
520
|
) }),
|
|
505
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
521
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFLVSQDP4cjs.PoweredBy, {})
|
|
506
522
|
] });
|
|
507
523
|
}
|
|
508
524
|
async function fetchNativeAssets(address, publicClient, existing) {
|
|
509
525
|
const existingIds = new Set(existing.map((asset) => asset.id));
|
|
510
|
-
const connectedChainId = _optionalChain([publicClient, 'access',
|
|
526
|
+
const connectedChainId = _optionalChain([publicClient, 'access', _12 => _12.chain, 'optionalAccess', _13 => _13.id]);
|
|
511
527
|
if (!connectedChainId) return [];
|
|
512
|
-
if (!
|
|
513
|
-
const id =
|
|
528
|
+
if (!_chunkMUWVDVY4cjs.SOURCE_CHAINS.some((chain) => chain.id === connectedChainId)) return [];
|
|
529
|
+
const id = _chunkFLVSQDP4cjs.getAssetId.call(void 0, {
|
|
514
530
|
chainId: connectedChainId,
|
|
515
|
-
token:
|
|
531
|
+
token: _chunkMUWVDVY4cjs.NATIVE_TOKEN_ADDRESS
|
|
516
532
|
});
|
|
517
533
|
if (existingIds.has(id)) return [];
|
|
518
534
|
try {
|
|
@@ -521,7 +537,7 @@ async function fetchNativeAssets(address, publicClient, existing) {
|
|
|
521
537
|
{
|
|
522
538
|
id,
|
|
523
539
|
chainId: connectedChainId,
|
|
524
|
-
token:
|
|
540
|
+
token: _chunkMUWVDVY4cjs.NATIVE_TOKEN_ADDRESS,
|
|
525
541
|
symbol: "ETH",
|
|
526
542
|
name: "Ethereum",
|
|
527
543
|
decimals: 18,
|
|
@@ -570,10 +586,10 @@ function AmountStep({
|
|
|
570
586
|
const [isSwitching, setIsSwitching] = _react.useState.call(void 0, false);
|
|
571
587
|
const hasAttemptedSwitch = _react.useRef.call(void 0, false);
|
|
572
588
|
const chainMismatch = Boolean(
|
|
573
|
-
_optionalChain([walletClient, 'optionalAccess',
|
|
589
|
+
_optionalChain([walletClient, 'optionalAccess', _14 => _14.chain, 'optionalAccess', _15 => _15.id]) && walletClient.chain.id !== asset.chainId
|
|
574
590
|
);
|
|
575
|
-
const targetSymbol =
|
|
576
|
-
const isSourceStablecoin =
|
|
591
|
+
const targetSymbol = _chunkMUWVDVY4cjs.getTokenSymbol.call(void 0, targetToken, targetChain);
|
|
592
|
+
const isSourceStablecoin = _chunkMUWVDVY4cjs.isStablecoinSymbol.call(void 0, asset.symbol);
|
|
577
593
|
const tokenPriceUsd = _react.useMemo.call(void 0, () => {
|
|
578
594
|
if (tokenPriceUsdOverride !== void 0 && tokenPriceUsdOverride > 0)
|
|
579
595
|
return tokenPriceUsdOverride;
|
|
@@ -597,7 +613,7 @@ function AmountStep({
|
|
|
597
613
|
const balanceTarget = _nullishCoalesce(balanceAddress, () => ( address));
|
|
598
614
|
if (!balanceTarget || !publicClient) return;
|
|
599
615
|
try {
|
|
600
|
-
const bal =
|
|
616
|
+
const bal = _chunkFLVSQDP4cjs.isNativeAsset.call(void 0, asset) ? await publicClient.getBalance({ address: balanceTarget }) : await publicClient.readContract({
|
|
601
617
|
address: asset.token,
|
|
602
618
|
abi: _viem.erc20Abi,
|
|
603
619
|
functionName: "balanceOf",
|
|
@@ -623,7 +639,7 @@ function AmountStep({
|
|
|
623
639
|
setIsSwitching(true);
|
|
624
640
|
switchChain(asset.chainId).catch((err) => {
|
|
625
641
|
const raw = err instanceof Error ? err.message : "Failed to switch chain";
|
|
626
|
-
setError(
|
|
642
|
+
setError(_chunkFLVSQDP4cjs.formatUserError.call(void 0, raw));
|
|
627
643
|
}).finally(() => {
|
|
628
644
|
setIsSwitching(false);
|
|
629
645
|
});
|
|
@@ -651,7 +667,7 @@ function AmountStep({
|
|
|
651
667
|
}
|
|
652
668
|
}, [balance, tokenPriceUsd, asset.decimals]);
|
|
653
669
|
_react.useEffect.call(void 0, () => {
|
|
654
|
-
_optionalChain([onBalanceUsdChange, 'optionalCall',
|
|
670
|
+
_optionalChain([onBalanceUsdChange, 'optionalCall', _16 => _16(_nullishCoalesce(balanceUsd, () => ( 0)))]);
|
|
655
671
|
}, [balanceUsd, onBalanceUsdChange]);
|
|
656
672
|
const formattedBalance = _react.useMemo.call(void 0, () => {
|
|
657
673
|
if (balance === null) return "...";
|
|
@@ -659,7 +675,7 @@ function AmountStep({
|
|
|
659
675
|
const raw = _viem.formatUnits.call(void 0, balance, asset.decimals);
|
|
660
676
|
const numeric = Number(raw);
|
|
661
677
|
if (!Number.isFinite(numeric)) return raw;
|
|
662
|
-
return
|
|
678
|
+
return _chunkFLVSQDP4cjs.tokenFormatter.format(numeric);
|
|
663
679
|
} catch (e8) {
|
|
664
680
|
return "...";
|
|
665
681
|
}
|
|
@@ -667,7 +683,7 @@ function AmountStep({
|
|
|
667
683
|
const handlePresetClick = (percentage) => {
|
|
668
684
|
if (balance === null) return;
|
|
669
685
|
const ctaName = percentage === 100 ? "Max" : `${percentage}%`;
|
|
670
|
-
_optionalChain([onCtaClick, 'optionalCall',
|
|
686
|
+
_optionalChain([onCtaClick, 'optionalCall', _17 => _17(ctaName)]);
|
|
671
687
|
try {
|
|
672
688
|
const balanceUnits = Number(_viem.formatUnits.call(void 0, balance, asset.decimals));
|
|
673
689
|
if (!Number.isFinite(balanceUnits)) return;
|
|
@@ -701,13 +717,13 @@ function AmountStep({
|
|
|
701
717
|
}
|
|
702
718
|
if (hasPricing) {
|
|
703
719
|
const usdValue = numericAmount;
|
|
704
|
-
if (_optionalChain([uiConfig, 'optionalAccess',
|
|
720
|
+
if (_optionalChain([uiConfig, 'optionalAccess', _18 => _18.maxDepositUsd]) && usdValue > uiConfig.maxDepositUsd) {
|
|
705
721
|
setError(
|
|
706
|
-
`Maximum deposit is ${
|
|
722
|
+
`Maximum deposit is ${_chunkFLVSQDP4cjs.currencyFormatter.format(uiConfig.maxDepositUsd)}`
|
|
707
723
|
);
|
|
708
724
|
return;
|
|
709
725
|
}
|
|
710
|
-
if (_optionalChain([uiConfig, 'optionalAccess',
|
|
726
|
+
if (_optionalChain([uiConfig, 'optionalAccess', _19 => _19.minDepositUsd]) && usdValue < uiConfig.minDepositUsd) {
|
|
711
727
|
setAmount(uiConfig.minDepositUsd.toString());
|
|
712
728
|
setError(null);
|
|
713
729
|
return;
|
|
@@ -726,7 +742,7 @@ function AmountStep({
|
|
|
726
742
|
return;
|
|
727
743
|
}
|
|
728
744
|
setError(null);
|
|
729
|
-
_optionalChain([onCtaClick, 'optionalCall',
|
|
745
|
+
_optionalChain([onCtaClick, 'optionalCall', _20 => _20("continue")]);
|
|
730
746
|
onContinue(tokenAmountStr, amount, _nullishCoalesce(balance, () => ( void 0)));
|
|
731
747
|
};
|
|
732
748
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-step", children: [
|
|
@@ -758,7 +774,7 @@ function AmountStep({
|
|
|
758
774
|
hasPricing && balanceUsd !== null && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { style: { color: "var(--rs-muted-foreground)" }, children: [
|
|
759
775
|
" ",
|
|
760
776
|
"(",
|
|
761
|
-
|
|
777
|
+
_chunkFLVSQDP4cjs.currencyFormatter.format(balanceUsd),
|
|
762
778
|
")"
|
|
763
779
|
] })
|
|
764
780
|
] }) })
|
|
@@ -772,26 +788,26 @@ function AmountStep({
|
|
|
772
788
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-flow-pill-label", children: "You send" }),
|
|
773
789
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-flow-pill-token", children: [
|
|
774
790
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-flow-pill-token-icon-wrapper", children: [
|
|
775
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-flow-pill-token-icon", children:
|
|
791
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-flow-pill-token-icon", children: _chunkMUWVDVY4cjs.getTokenIcon.call(void 0, asset.symbol) ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
776
792
|
"img",
|
|
777
793
|
{
|
|
778
|
-
src:
|
|
794
|
+
src: _chunkMUWVDVY4cjs.getTokenIcon.call(void 0, asset.symbol),
|
|
779
795
|
alt: asset.symbol
|
|
780
796
|
}
|
|
781
797
|
) : asset.symbol.slice(0, 2) }),
|
|
782
798
|
(() => {
|
|
783
|
-
const chainIcon =
|
|
799
|
+
const chainIcon = _chunkMUWVDVY4cjs.getChainIcon.call(void 0, asset.chainId);
|
|
784
800
|
if (chainIcon) {
|
|
785
801
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
786
802
|
"img",
|
|
787
803
|
{
|
|
788
804
|
src: chainIcon,
|
|
789
|
-
alt:
|
|
805
|
+
alt: _chunkMUWVDVY4cjs.getChainName.call(void 0, asset.chainId),
|
|
790
806
|
className: "rs-flow-pill-chain-badge"
|
|
791
807
|
}
|
|
792
808
|
);
|
|
793
809
|
}
|
|
794
|
-
const badge =
|
|
810
|
+
const badge = _chunkMUWVDVY4cjs.getChainBadge.call(void 0, asset.chainId);
|
|
795
811
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
796
812
|
"div",
|
|
797
813
|
{
|
|
@@ -829,26 +845,26 @@ function AmountStep({
|
|
|
829
845
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-flow-pill-label", children: "You receive" }),
|
|
830
846
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-flow-pill-token", children: [
|
|
831
847
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-flow-pill-token-icon-wrapper", children: [
|
|
832
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-flow-pill-token-icon", children:
|
|
848
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-flow-pill-token-icon", children: _chunkMUWVDVY4cjs.getTokenIcon.call(void 0, targetSymbol) ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
833
849
|
"img",
|
|
834
850
|
{
|
|
835
|
-
src:
|
|
851
|
+
src: _chunkMUWVDVY4cjs.getTokenIcon.call(void 0, targetSymbol),
|
|
836
852
|
alt: targetSymbol
|
|
837
853
|
}
|
|
838
854
|
) : targetSymbol.slice(0, 2) }),
|
|
839
855
|
(() => {
|
|
840
|
-
const chainIcon =
|
|
856
|
+
const chainIcon = _chunkMUWVDVY4cjs.getChainIcon.call(void 0, targetChain);
|
|
841
857
|
if (chainIcon) {
|
|
842
858
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
843
859
|
"img",
|
|
844
860
|
{
|
|
845
861
|
src: chainIcon,
|
|
846
|
-
alt:
|
|
862
|
+
alt: _chunkMUWVDVY4cjs.getChainName.call(void 0, targetChain),
|
|
847
863
|
className: "rs-flow-pill-chain-badge"
|
|
848
864
|
}
|
|
849
865
|
);
|
|
850
866
|
}
|
|
851
|
-
const badge =
|
|
867
|
+
const badge = _chunkMUWVDVY4cjs.getChainBadge.call(void 0, targetChain);
|
|
852
868
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
853
869
|
"div",
|
|
854
870
|
{
|
|
@@ -894,8 +910,8 @@ function AmountStep({
|
|
|
894
910
|
}
|
|
895
911
|
)
|
|
896
912
|
] }),
|
|
897
|
-
_optionalChain([uiConfig, 'optionalAccess',
|
|
898
|
-
|
|
913
|
+
_optionalChain([uiConfig, 'optionalAccess', _21 => _21.minDepositUsd]) && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-amount-minimum", children: [
|
|
914
|
+
_chunkFLVSQDP4cjs.currencyFormatter.format(uiConfig.minDepositUsd),
|
|
899
915
|
" minimum deposit"
|
|
900
916
|
] }),
|
|
901
917
|
error && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-amount-error", children: [
|
|
@@ -921,15 +937,15 @@ function AmountStep({
|
|
|
921
937
|
] })
|
|
922
938
|
] }),
|
|
923
939
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-step-footer", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
924
|
-
|
|
940
|
+
_chunkFLVSQDP4cjs.Button,
|
|
925
941
|
{
|
|
926
942
|
onClick: handleContinue,
|
|
927
943
|
fullWidth: true,
|
|
928
944
|
disabled: !amount || chainMismatch,
|
|
929
|
-
children: _optionalChain([uiConfig, 'optionalAccess',
|
|
945
|
+
children: _optionalChain([uiConfig, 'optionalAccess', _22 => _22.minDepositUsd]) && parseFloat(amount) > 0 && parseFloat(amount) < uiConfig.minDepositUsd ? "Update order" : "Continue"
|
|
930
946
|
}
|
|
931
947
|
) }),
|
|
932
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
948
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFLVSQDP4cjs.PoweredBy, {})
|
|
933
949
|
] });
|
|
934
950
|
}
|
|
935
951
|
|
|
@@ -958,9 +974,9 @@ function ConfirmStep({
|
|
|
958
974
|
const [error, setError] = _react.useState.call(void 0, null);
|
|
959
975
|
const [isSwitching, setIsSwitching] = _react.useState.call(void 0, false);
|
|
960
976
|
const hasAttemptedSwitch = _react.useRef.call(void 0, false);
|
|
961
|
-
const chainMismatch = _optionalChain([walletClient, 'optionalAccess',
|
|
977
|
+
const chainMismatch = _optionalChain([walletClient, 'optionalAccess', _23 => _23.chain, 'optionalAccess', _24 => _24.id]) && walletClient.chain.id !== asset.chainId;
|
|
962
978
|
const sameRoute = targetChain === asset.chainId && targetToken.toLowerCase() === asset.token.toLowerCase();
|
|
963
|
-
const targetSymbol = sameRoute ? asset.symbol :
|
|
979
|
+
const targetSymbol = sameRoute ? asset.symbol : _chunkMUWVDVY4cjs.getTokenSymbol.call(void 0, targetToken, targetChain);
|
|
964
980
|
const formattedSendAmount = amount && !Number.isNaN(Number(amount)) ? Number(amount).toLocaleString("en-US", { maximumFractionDigits: 6 }) : "0";
|
|
965
981
|
const formattedReceiveAmount = (() => {
|
|
966
982
|
if (sameRoute) return formattedSendAmount;
|
|
@@ -979,7 +995,7 @@ function ConfirmStep({
|
|
|
979
995
|
setIsSwitching(true);
|
|
980
996
|
switchChain(asset.chainId).catch((err) => {
|
|
981
997
|
const raw = err instanceof Error ? err.message : "Failed to switch chain";
|
|
982
|
-
setError(
|
|
998
|
+
setError(_chunkFLVSQDP4cjs.formatUserError.call(void 0, raw));
|
|
983
999
|
}).finally(() => {
|
|
984
1000
|
setIsSwitching(false);
|
|
985
1001
|
});
|
|
@@ -994,7 +1010,7 @@ function ConfirmStep({
|
|
|
994
1010
|
return;
|
|
995
1011
|
}
|
|
996
1012
|
if (chainMismatch) {
|
|
997
|
-
setError(`Switch to ${
|
|
1013
|
+
setError(`Switch to ${_chunkMUWVDVY4cjs.getChainName.call(void 0, asset.chainId)} to sign`);
|
|
998
1014
|
return;
|
|
999
1015
|
}
|
|
1000
1016
|
const parsedAmount = parseFloat(amount);
|
|
@@ -1022,7 +1038,7 @@ function ConfirmStep({
|
|
|
1022
1038
|
throw new Error("Wallet not properly connected");
|
|
1023
1039
|
}
|
|
1024
1040
|
const transferTo = sameRoute ? recipient : smartAccount;
|
|
1025
|
-
const hash =
|
|
1041
|
+
const hash = _chunkFLVSQDP4cjs.isNativeAsset.call(void 0, asset) ? await walletClient.sendTransaction({
|
|
1026
1042
|
account,
|
|
1027
1043
|
chain,
|
|
1028
1044
|
to: transferTo,
|
|
@@ -1035,13 +1051,13 @@ function ConfirmStep({
|
|
|
1035
1051
|
functionName: "transfer",
|
|
1036
1052
|
args: [transferTo, amountUnits]
|
|
1037
1053
|
});
|
|
1038
|
-
_optionalChain([onDepositSubmitted, 'optionalCall',
|
|
1054
|
+
_optionalChain([onDepositSubmitted, 'optionalCall', _25 => _25(hash, asset.chainId, amountUnits.toString())]);
|
|
1039
1055
|
onConfirm(hash, asset.chainId, amountUnits.toString(), asset.token);
|
|
1040
1056
|
} catch (err) {
|
|
1041
1057
|
const raw = err instanceof Error ? err.message : "Transfer failed";
|
|
1042
|
-
const message =
|
|
1058
|
+
const message = _chunkFLVSQDP4cjs.formatUserError.call(void 0, raw);
|
|
1043
1059
|
setError(message);
|
|
1044
|
-
_optionalChain([onError, 'optionalCall',
|
|
1060
|
+
_optionalChain([onError, 'optionalCall', _26 => _26(message, "TRANSFER_ERROR")]);
|
|
1045
1061
|
} finally {
|
|
1046
1062
|
setIsSubmitting(false);
|
|
1047
1063
|
}
|
|
@@ -1058,15 +1074,15 @@ function ConfirmStep({
|
|
|
1058
1074
|
className: "rs-card-value",
|
|
1059
1075
|
style: { display: "flex", alignItems: "center", gap: 8 },
|
|
1060
1076
|
children: [
|
|
1061
|
-
|
|
1077
|
+
_chunkMUWVDVY4cjs.getChainIcon.call(void 0, asset.chainId) && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1062
1078
|
"img",
|
|
1063
1079
|
{
|
|
1064
|
-
src:
|
|
1080
|
+
src: _chunkMUWVDVY4cjs.getChainIcon.call(void 0, asset.chainId),
|
|
1065
1081
|
alt: "",
|
|
1066
1082
|
style: { width: 16, height: 16, borderRadius: 3 }
|
|
1067
1083
|
}
|
|
1068
1084
|
),
|
|
1069
|
-
|
|
1085
|
+
_chunkMUWVDVY4cjs.getChainName.call(void 0, asset.chainId)
|
|
1070
1086
|
]
|
|
1071
1087
|
}
|
|
1072
1088
|
)
|
|
@@ -1079,15 +1095,15 @@ function ConfirmStep({
|
|
|
1079
1095
|
className: "rs-card-value",
|
|
1080
1096
|
style: { display: "flex", alignItems: "center", gap: 8 },
|
|
1081
1097
|
children: [
|
|
1082
|
-
|
|
1098
|
+
_chunkMUWVDVY4cjs.getChainIcon.call(void 0, targetChain) && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1083
1099
|
"img",
|
|
1084
1100
|
{
|
|
1085
|
-
src:
|
|
1101
|
+
src: _chunkMUWVDVY4cjs.getChainIcon.call(void 0, targetChain),
|
|
1086
1102
|
alt: "",
|
|
1087
1103
|
style: { width: 16, height: 16, borderRadius: 3 }
|
|
1088
1104
|
}
|
|
1089
1105
|
),
|
|
1090
|
-
|
|
1106
|
+
_chunkMUWVDVY4cjs.getChainName.call(void 0, targetChain)
|
|
1091
1107
|
]
|
|
1092
1108
|
}
|
|
1093
1109
|
)
|
|
@@ -1106,10 +1122,10 @@ function ConfirmStep({
|
|
|
1106
1122
|
className: "rs-card-value",
|
|
1107
1123
|
style: { display: "flex", alignItems: "center", gap: 6 },
|
|
1108
1124
|
children: [
|
|
1109
|
-
|
|
1125
|
+
_chunkMUWVDVY4cjs.getTokenIcon.call(void 0, asset.symbol) && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1110
1126
|
"img",
|
|
1111
1127
|
{
|
|
1112
|
-
src:
|
|
1128
|
+
src: _chunkMUWVDVY4cjs.getTokenIcon.call(void 0, asset.symbol),
|
|
1113
1129
|
alt: "",
|
|
1114
1130
|
style: { width: 16, height: 16, borderRadius: "50%" }
|
|
1115
1131
|
}
|
|
@@ -1129,10 +1145,10 @@ function ConfirmStep({
|
|
|
1129
1145
|
className: "rs-card-value",
|
|
1130
1146
|
style: { display: "flex", alignItems: "center", gap: 6 },
|
|
1131
1147
|
children: [
|
|
1132
|
-
|
|
1148
|
+
_chunkMUWVDVY4cjs.getTokenIcon.call(void 0, targetSymbol) && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1133
1149
|
"img",
|
|
1134
1150
|
{
|
|
1135
|
-
src:
|
|
1151
|
+
src: _chunkMUWVDVY4cjs.getTokenIcon.call(void 0, targetSymbol),
|
|
1136
1152
|
alt: "",
|
|
1137
1153
|
style: { width: 16, height: 16, borderRadius: "50%" }
|
|
1138
1154
|
}
|
|
@@ -1168,7 +1184,7 @@ function ConfirmStep({
|
|
|
1168
1184
|
] })
|
|
1169
1185
|
] }),
|
|
1170
1186
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-step-footer", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1171
|
-
|
|
1187
|
+
_chunkFLVSQDP4cjs.Button,
|
|
1172
1188
|
{
|
|
1173
1189
|
onClick: handleConfirm,
|
|
1174
1190
|
loading: isSubmitting,
|
|
@@ -1177,7 +1193,7 @@ function ConfirmStep({
|
|
|
1177
1193
|
children: "Confirm Order"
|
|
1178
1194
|
}
|
|
1179
1195
|
) }),
|
|
1180
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1196
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFLVSQDP4cjs.PoweredBy, {})
|
|
1181
1197
|
] });
|
|
1182
1198
|
}
|
|
1183
1199
|
|
|
@@ -1185,93 +1201,375 @@ function ConfirmStep({
|
|
|
1185
1201
|
|
|
1186
1202
|
|
|
1187
1203
|
// src/components/ui/QRCode.tsx
|
|
1188
|
-
|
|
1204
|
+
var _reactqrcodelogo = require('react-qrcode-logo');
|
|
1189
1205
|
|
|
1190
1206
|
function QRCode({ value, size = 200, iconSrc, className }) {
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1207
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className, role: "img", "aria-label": "QR Code", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1208
|
+
_reactqrcodelogo.QRCode,
|
|
1209
|
+
{
|
|
1210
|
+
value,
|
|
1211
|
+
size,
|
|
1212
|
+
qrStyle: "dots",
|
|
1213
|
+
eyeRadius: [10, 10, 10],
|
|
1214
|
+
ecLevel: "H",
|
|
1215
|
+
logoImage: iconSrc,
|
|
1216
|
+
logoWidth: size * 0.22,
|
|
1217
|
+
logoHeight: size * 0.22,
|
|
1218
|
+
logoPaddingStyle: "circle",
|
|
1219
|
+
logoPadding: 5,
|
|
1220
|
+
removeQrCodeBehindLogo: true,
|
|
1221
|
+
quietZone: 10,
|
|
1222
|
+
bgColor: "#ffffff",
|
|
1223
|
+
fgColor: "#000000"
|
|
1224
|
+
}
|
|
1225
|
+
) });
|
|
1226
|
+
}
|
|
1227
|
+
QRCode.displayName = "QRCode";
|
|
1228
|
+
|
|
1229
|
+
// src/components/ui/DepositNotification.tsx
|
|
1230
|
+
|
|
1231
|
+
|
|
1232
|
+
var INITIAL_POLL_INTERVAL = 3e3;
|
|
1233
|
+
var MAX_POLL_INTERVAL = 3e4;
|
|
1234
|
+
var BACKOFF_MULTIPLIER = 1.5;
|
|
1235
|
+
function isEventForTx(event, txHash) {
|
|
1236
|
+
const eventTxHash = _chunkFLVSQDP4cjs.getEventTxHash.call(void 0, event);
|
|
1237
|
+
if (!eventTxHash) return false;
|
|
1238
|
+
return _chunkFLVSQDP4cjs.txRefsMatch.call(void 0, eventTxHash, txHash);
|
|
1239
|
+
}
|
|
1240
|
+
function truncateHash(hash) {
|
|
1241
|
+
return `${hash.slice(0, 4)}\u2026${hash.slice(-4)}`;
|
|
1242
|
+
}
|
|
1243
|
+
function formatTimestamp(ms) {
|
|
1244
|
+
const date = new Date(ms);
|
|
1245
|
+
const months = [
|
|
1246
|
+
"Jan",
|
|
1247
|
+
"Feb",
|
|
1248
|
+
"Mar",
|
|
1249
|
+
"Apr",
|
|
1250
|
+
"May",
|
|
1251
|
+
"Jun",
|
|
1252
|
+
"Jul",
|
|
1253
|
+
"Aug",
|
|
1254
|
+
"Sep",
|
|
1255
|
+
"Oct",
|
|
1256
|
+
"Nov",
|
|
1257
|
+
"Dec"
|
|
1258
|
+
];
|
|
1259
|
+
const month = months[date.getMonth()];
|
|
1260
|
+
const day = date.getDate();
|
|
1261
|
+
const suffix = day % 10 === 1 && day !== 11 ? "st" : day % 10 === 2 && day !== 12 ? "nd" : day % 10 === 3 && day !== 13 ? "rd" : "th";
|
|
1262
|
+
const hours = String(date.getHours()).padStart(2, "0");
|
|
1263
|
+
const minutes = String(date.getMinutes()).padStart(2, "0");
|
|
1264
|
+
const seconds = String(date.getSeconds()).padStart(2, "0");
|
|
1265
|
+
return `${month} ${day}${suffix} \xB7 ${hours}:${minutes}:${seconds}`;
|
|
1266
|
+
}
|
|
1267
|
+
function formatBridgeFailedMessage(event) {
|
|
1268
|
+
const eventData = _nullishCoalesce(_optionalChain([event, 'optionalAccess', _27 => _27.data]), () => ( {}));
|
|
1269
|
+
const backendMessage = typeof eventData.message === "string" ? eventData.message.trim() : "";
|
|
1270
|
+
if (backendMessage.length > 0) {
|
|
1271
|
+
const lower = backendMessage.toLowerCase();
|
|
1272
|
+
if (lower.includes("insufficient funds")) {
|
|
1273
|
+
return "Deposit was received, but processing could not continue due to insufficient funds.";
|
|
1274
|
+
}
|
|
1275
|
+
if (lower.includes("no valid quote available")) {
|
|
1276
|
+
return "No bridge route is currently available for this transfer.";
|
|
1277
|
+
}
|
|
1278
|
+
if (lower.includes("simulation failed")) {
|
|
1279
|
+
return "Transfer processing failed during simulation.";
|
|
1280
|
+
}
|
|
1281
|
+
if (backendMessage.length > 220) {
|
|
1282
|
+
return "Transfer processing failed.";
|
|
1283
|
+
}
|
|
1284
|
+
return backendMessage;
|
|
1285
|
+
}
|
|
1286
|
+
return "Bridge failed";
|
|
1287
|
+
}
|
|
1288
|
+
var txLinkIcon = /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1289
|
+
"svg",
|
|
1290
|
+
{
|
|
1291
|
+
viewBox: "0 0 24 24",
|
|
1292
|
+
fill: "none",
|
|
1293
|
+
stroke: "currentColor",
|
|
1294
|
+
strokeWidth: "2.5",
|
|
1295
|
+
className: "rs-deposit-notification-link-icon",
|
|
1296
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1297
|
+
"path",
|
|
1298
|
+
{
|
|
1299
|
+
strokeLinecap: "round",
|
|
1300
|
+
strokeLinejoin: "round",
|
|
1301
|
+
d: "M13.5 6H5.25A2.25 2.25 0 003 8.25v10.5A2.25 2.25 0 005.25 21h10.5A2.25 2.25 0 0018 18.75V10.5m-10.5 6L21 3m0 0h-5.25M21 3v5.25"
|
|
1197
1302
|
}
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1303
|
+
)
|
|
1304
|
+
}
|
|
1305
|
+
);
|
|
1306
|
+
function DepositNotification({
|
|
1307
|
+
deposit,
|
|
1308
|
+
smartAccount,
|
|
1309
|
+
targetChain,
|
|
1310
|
+
targetToken,
|
|
1311
|
+
waitForFinalTx,
|
|
1312
|
+
hasPostBridgeActions,
|
|
1313
|
+
service,
|
|
1314
|
+
onComplete,
|
|
1315
|
+
onFailed,
|
|
1316
|
+
onDismiss
|
|
1317
|
+
}) {
|
|
1318
|
+
const { txHash, sourceChain, amount, token, detectedAt, directTransfer } = deposit;
|
|
1319
|
+
const [status, setStatus] = _react.useState.call(void 0,
|
|
1320
|
+
directTransfer ? "complete" : "processing"
|
|
1321
|
+
);
|
|
1322
|
+
const [expanded, setExpanded] = _react.useState.call(void 0, false);
|
|
1323
|
+
const [completedAt, setCompletedAt] = _react.useState.call(void 0,
|
|
1324
|
+
directTransfer ? detectedAt : null
|
|
1325
|
+
);
|
|
1326
|
+
const [destinationTxHash, setDestinationTxHash] = _react.useState.call(void 0,
|
|
1327
|
+
null
|
|
1328
|
+
);
|
|
1329
|
+
const pollIntervalRef = _react.useRef.call(void 0, INITIAL_POLL_INTERVAL);
|
|
1330
|
+
const pollTimeoutRef = _react.useRef.call(void 0, null);
|
|
1331
|
+
const completedRef = _react.useRef.call(void 0, _nullishCoalesce(directTransfer, () => ( false)));
|
|
1332
|
+
const depositContextRef = _chunkFLVSQDP4cjs.useLatestRef.call(void 0, {
|
|
1333
|
+
amount,
|
|
1334
|
+
sourceChain,
|
|
1335
|
+
sourceToken: token,
|
|
1336
|
+
targetChain,
|
|
1337
|
+
targetToken,
|
|
1338
|
+
waitForFinalTx,
|
|
1339
|
+
hasPostBridgeActions
|
|
1340
|
+
});
|
|
1341
|
+
const onCompleteRef = _chunkFLVSQDP4cjs.useLatestRef.call(void 0, onComplete);
|
|
1342
|
+
const onFailedRef = _chunkFLVSQDP4cjs.useLatestRef.call(void 0, onFailed);
|
|
1343
|
+
const handleComplete = _react.useCallback.call(void 0,
|
|
1344
|
+
(destTxHash) => {
|
|
1345
|
+
if (completedRef.current) return;
|
|
1346
|
+
completedRef.current = true;
|
|
1347
|
+
setDestinationTxHash(_nullishCoalesce(destTxHash, () => ( null)));
|
|
1348
|
+
setCompletedAt(Date.now());
|
|
1349
|
+
setStatus("complete");
|
|
1350
|
+
const context = depositContextRef.current;
|
|
1351
|
+
_optionalChain([onCompleteRef, 'access', _28 => _28.current, 'optionalCall', _29 => _29(txHash, destTxHash, {
|
|
1352
|
+
amount: context.amount,
|
|
1353
|
+
sourceChain: context.sourceChain,
|
|
1354
|
+
sourceToken: context.sourceToken,
|
|
1355
|
+
targetChain: context.targetChain,
|
|
1356
|
+
targetToken: context.targetToken
|
|
1357
|
+
})]);
|
|
1358
|
+
},
|
|
1359
|
+
[depositContextRef, onCompleteRef, txHash]
|
|
1360
|
+
);
|
|
1361
|
+
const handleFailed = _react.useCallback.call(void 0,
|
|
1362
|
+
(error) => {
|
|
1363
|
+
if (completedRef.current) return;
|
|
1364
|
+
completedRef.current = true;
|
|
1365
|
+
setStatus("failed");
|
|
1366
|
+
_optionalChain([onFailedRef, 'access', _30 => _30.current, 'optionalCall', _31 => _31(txHash, error)]);
|
|
1367
|
+
},
|
|
1368
|
+
[onFailedRef, txHash]
|
|
1369
|
+
);
|
|
1370
|
+
_react.useEffect.call(void 0, () => {
|
|
1371
|
+
if (directTransfer) {
|
|
1372
|
+
handleComplete(void 0);
|
|
1373
|
+
return;
|
|
1374
|
+
}
|
|
1375
|
+
if (status !== "processing") return;
|
|
1376
|
+
let isMounted = true;
|
|
1377
|
+
async function pollStatus() {
|
|
1378
|
+
try {
|
|
1379
|
+
const data = await service.fetchStatus(smartAccount, txHash);
|
|
1380
|
+
if (!isMounted) return;
|
|
1381
|
+
const lastEvent = data.lastEvent;
|
|
1382
|
+
const eventForTx = isEventForTx(lastEvent, txHash) ? lastEvent : void 0;
|
|
1383
|
+
const awaitingPostBridgeSwap = depositContextRef.current.waitForFinalTx && depositContextRef.current.hasPostBridgeActions;
|
|
1384
|
+
if (_optionalChain([eventForTx, 'optionalAccess', _32 => _32.type]) === "post-bridge-swap-complete") {
|
|
1385
|
+
const swapTxHash = _optionalChain([eventForTx, 'access', _33 => _33.data, 'optionalAccess', _34 => _34.swap, 'optionalAccess', _35 => _35.transactionHash]);
|
|
1386
|
+
handleComplete(swapTxHash);
|
|
1387
|
+
return;
|
|
1388
|
+
}
|
|
1389
|
+
if (_optionalChain([eventForTx, 'optionalAccess', _36 => _36.type]) === "post-bridge-swap-failed") {
|
|
1390
|
+
handleFailed(formatBridgeFailedMessage(eventForTx));
|
|
1391
|
+
return;
|
|
1392
|
+
}
|
|
1393
|
+
if (_optionalChain([eventForTx, 'optionalAccess', _37 => _37.type]) === "bridge-complete" && !awaitingPostBridgeSwap) {
|
|
1394
|
+
const destTx = _optionalChain([eventForTx, 'access', _38 => _38.data, 'optionalAccess', _39 => _39.destination, 'optionalAccess', _40 => _40.transactionHash]);
|
|
1395
|
+
handleComplete(destTx);
|
|
1396
|
+
return;
|
|
1397
|
+
}
|
|
1398
|
+
if (!waitForFinalTx && _optionalChain([eventForTx, 'optionalAccess', _41 => _41.type]) === "bridge-started") {
|
|
1399
|
+
handleComplete(void 0);
|
|
1400
|
+
return;
|
|
1401
|
+
}
|
|
1402
|
+
if (_optionalChain([eventForTx, 'optionalAccess', _42 => _42.type]) === "bridge-failed") {
|
|
1403
|
+
handleFailed(formatBridgeFailedMessage(eventForTx));
|
|
1404
|
+
return;
|
|
1405
|
+
}
|
|
1406
|
+
if (_optionalChain([eventForTx, 'optionalAccess', _43 => _43.type]) === "error") {
|
|
1407
|
+
const errorMessage = _nullishCoalesce(_optionalChain([eventForTx, 'access', _44 => _44.data, 'optionalAccess', _45 => _45.message]), () => ( "Unknown error"));
|
|
1408
|
+
handleFailed(errorMessage);
|
|
1409
|
+
return;
|
|
1410
|
+
}
|
|
1411
|
+
scheduleNextPoll();
|
|
1412
|
+
} catch (e12) {
|
|
1413
|
+
scheduleNextPoll();
|
|
1201
1414
|
}
|
|
1202
|
-
}
|
|
1415
|
+
}
|
|
1416
|
+
function scheduleNextPoll() {
|
|
1417
|
+
if (!isMounted) return;
|
|
1418
|
+
pollTimeoutRef.current = setTimeout(() => {
|
|
1419
|
+
pollIntervalRef.current = Math.min(
|
|
1420
|
+
pollIntervalRef.current * BACKOFF_MULTIPLIER,
|
|
1421
|
+
MAX_POLL_INTERVAL
|
|
1422
|
+
);
|
|
1423
|
+
pollStatus();
|
|
1424
|
+
}, pollIntervalRef.current);
|
|
1425
|
+
}
|
|
1426
|
+
pollStatus();
|
|
1203
1427
|
return () => {
|
|
1204
|
-
|
|
1428
|
+
isMounted = false;
|
|
1429
|
+
if (pollTimeoutRef.current) {
|
|
1430
|
+
clearTimeout(pollTimeoutRef.current);
|
|
1431
|
+
}
|
|
1205
1432
|
};
|
|
1206
|
-
}, [
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1433
|
+
}, [
|
|
1434
|
+
directTransfer,
|
|
1435
|
+
depositContextRef,
|
|
1436
|
+
handleComplete,
|
|
1437
|
+
handleFailed,
|
|
1438
|
+
service,
|
|
1439
|
+
smartAccount,
|
|
1440
|
+
status,
|
|
1441
|
+
txHash
|
|
1442
|
+
]);
|
|
1443
|
+
const sourceExplorerUrl = _chunkMUWVDVY4cjs.getExplorerTxUrl.call(void 0, sourceChain, txHash);
|
|
1444
|
+
const destExplorerUrl = destinationTxHash ? _chunkMUWVDVY4cjs.getExplorerTxUrl.call(void 0, targetChain, destinationTxHash) : null;
|
|
1445
|
+
const title = status === "complete" ? "Deposit completed" : status === "failed" ? "Deposit failed" : "Deposit received and processing\u2026";
|
|
1446
|
+
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.";
|
|
1447
|
+
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,
|
|
1448
|
+
"svg",
|
|
1449
|
+
{
|
|
1450
|
+
viewBox: "0 0 24 24",
|
|
1451
|
+
fill: "none",
|
|
1452
|
+
stroke: "currentColor",
|
|
1453
|
+
strokeWidth: "3",
|
|
1454
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1455
|
+
"path",
|
|
1456
|
+
{
|
|
1457
|
+
strokeLinecap: "round",
|
|
1458
|
+
strokeLinejoin: "round",
|
|
1459
|
+
d: "M5 12l5 5L20 7"
|
|
1460
|
+
}
|
|
1461
|
+
)
|
|
1210
1462
|
}
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
continue;
|
|
1463
|
+
) }) : 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,
|
|
1464
|
+
"svg",
|
|
1465
|
+
{
|
|
1466
|
+
viewBox: "0 0 24 24",
|
|
1467
|
+
fill: "none",
|
|
1468
|
+
stroke: "currentColor",
|
|
1469
|
+
strokeWidth: "3",
|
|
1470
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1471
|
+
"path",
|
|
1472
|
+
{
|
|
1473
|
+
strokeLinecap: "round",
|
|
1474
|
+
strokeLinejoin: "round",
|
|
1475
|
+
d: "M6 18L18 6M6 6l12 12"
|
|
1225
1476
|
}
|
|
1226
|
-
|
|
1227
|
-
const y = row * cellSize;
|
|
1228
|
-
paths.push(`M${x},${y}h${cellSize}v${cellSize}h${-cellSize}z`);
|
|
1229
|
-
}
|
|
1477
|
+
)
|
|
1230
1478
|
}
|
|
1231
|
-
|
|
1232
|
-
}, [createQrCode, value, size, iconSrc]);
|
|
1233
|
-
const iconSize = size * 0.22;
|
|
1234
|
-
const iconOffset = (size - iconSize) / 2;
|
|
1479
|
+
) }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-deposit-notification-badge rs-deposit-notification-badge--processing", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFLVSQDP4cjs.Spinner, {}) });
|
|
1235
1480
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1236
|
-
"
|
|
1481
|
+
"div",
|
|
1237
1482
|
{
|
|
1238
|
-
|
|
1239
|
-
width: size,
|
|
1240
|
-
height: size,
|
|
1241
|
-
className,
|
|
1242
|
-
role: "img",
|
|
1243
|
-
"aria-label": "QR Code",
|
|
1483
|
+
className: `rs-deposit-notification rs-deposit-notification--${status}`,
|
|
1244
1484
|
children: [
|
|
1245
|
-
/* @__PURE__ */ _jsxruntime.
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
"
|
|
1250
|
-
|
|
1251
|
-
x: iconOffset - 4,
|
|
1252
|
-
y: iconOffset - 4,
|
|
1253
|
-
width: iconSize + 8,
|
|
1254
|
-
height: iconSize + 8,
|
|
1255
|
-
fill: "white",
|
|
1256
|
-
rx: 8
|
|
1257
|
-
}
|
|
1258
|
-
),
|
|
1485
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-deposit-notification-header", children: [
|
|
1486
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-deposit-notification-icon", children: statusIcon }),
|
|
1487
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-deposit-notification-content", children: [
|
|
1488
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-deposit-notification-title", children: title }),
|
|
1489
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-deposit-notification-subtitle", children: subtitle })
|
|
1490
|
+
] }),
|
|
1259
1491
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1260
|
-
"
|
|
1492
|
+
"button",
|
|
1261
1493
|
{
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1494
|
+
type: "button",
|
|
1495
|
+
className: "rs-deposit-notification-close",
|
|
1496
|
+
onClick: () => onDismiss(deposit.id),
|
|
1497
|
+
"aria-label": "Dismiss",
|
|
1498
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1499
|
+
"svg",
|
|
1500
|
+
{
|
|
1501
|
+
viewBox: "0 0 24 24",
|
|
1502
|
+
fill: "none",
|
|
1503
|
+
stroke: "currentColor",
|
|
1504
|
+
strokeWidth: "2",
|
|
1505
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1506
|
+
"path",
|
|
1507
|
+
{
|
|
1508
|
+
strokeLinecap: "round",
|
|
1509
|
+
strokeLinejoin: "round",
|
|
1510
|
+
d: "M6 18L18 6M6 6l12 12"
|
|
1511
|
+
}
|
|
1512
|
+
)
|
|
1513
|
+
}
|
|
1514
|
+
)
|
|
1267
1515
|
}
|
|
1268
1516
|
)
|
|
1269
|
-
] })
|
|
1517
|
+
] }),
|
|
1518
|
+
expanded && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-deposit-notification-details", children: [
|
|
1519
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-deposit-notification-row", children: [
|
|
1520
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-deposit-notification-label", children: "Deposit tx" }),
|
|
1521
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-deposit-notification-value", children: sourceExplorerUrl ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1522
|
+
"a",
|
|
1523
|
+
{
|
|
1524
|
+
href: sourceExplorerUrl,
|
|
1525
|
+
target: "_blank",
|
|
1526
|
+
rel: "noopener noreferrer",
|
|
1527
|
+
className: "rs-deposit-notification-link",
|
|
1528
|
+
children: [
|
|
1529
|
+
truncateHash(txHash),
|
|
1530
|
+
txLinkIcon
|
|
1531
|
+
]
|
|
1532
|
+
}
|
|
1533
|
+
) : truncateHash(txHash) })
|
|
1534
|
+
] }),
|
|
1535
|
+
destinationTxHash && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-deposit-notification-row", children: [
|
|
1536
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-deposit-notification-label", children: "Completion tx" }),
|
|
1537
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-deposit-notification-value", children: destExplorerUrl ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1538
|
+
"a",
|
|
1539
|
+
{
|
|
1540
|
+
href: destExplorerUrl,
|
|
1541
|
+
target: "_blank",
|
|
1542
|
+
rel: "noopener noreferrer",
|
|
1543
|
+
className: "rs-deposit-notification-link",
|
|
1544
|
+
children: [
|
|
1545
|
+
truncateHash(destinationTxHash),
|
|
1546
|
+
txLinkIcon
|
|
1547
|
+
]
|
|
1548
|
+
}
|
|
1549
|
+
) : truncateHash(destinationTxHash) })
|
|
1550
|
+
] }),
|
|
1551
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-deposit-notification-row", children: [
|
|
1552
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-deposit-notification-label", children: "Order submitted" }),
|
|
1553
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-deposit-notification-value", children: formatTimestamp(detectedAt) })
|
|
1554
|
+
] }),
|
|
1555
|
+
completedAt && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-deposit-notification-row", children: [
|
|
1556
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-deposit-notification-label", children: "Order filled" }),
|
|
1557
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-deposit-notification-value", children: formatTimestamp(completedAt) })
|
|
1558
|
+
] })
|
|
1559
|
+
] }),
|
|
1560
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1561
|
+
"button",
|
|
1562
|
+
{
|
|
1563
|
+
type: "button",
|
|
1564
|
+
className: "rs-deposit-notification-toggle",
|
|
1565
|
+
onClick: () => setExpanded(!expanded),
|
|
1566
|
+
children: expanded ? "See less" : "See more"
|
|
1567
|
+
}
|
|
1568
|
+
)
|
|
1270
1569
|
]
|
|
1271
1570
|
}
|
|
1272
1571
|
);
|
|
1273
1572
|
}
|
|
1274
|
-
QRCode.displayName = "QRCode";
|
|
1275
1573
|
|
|
1276
1574
|
// src/core/solana.ts
|
|
1277
1575
|
|
|
@@ -1302,7 +1600,7 @@ var DEFAULT_SOLANA_RPC_URL = "https://api.mainnet.solana.com";
|
|
|
1302
1600
|
var configuredSolanaRpcUrl = null;
|
|
1303
1601
|
var cachedConnections = /* @__PURE__ */ new Map();
|
|
1304
1602
|
function configureSolanaRpcUrl(rpcUrl) {
|
|
1305
|
-
const normalized = _optionalChain([rpcUrl, 'optionalAccess',
|
|
1603
|
+
const normalized = _optionalChain([rpcUrl, 'optionalAccess', _46 => _46.trim, 'call', _47 => _47()]);
|
|
1306
1604
|
configuredSolanaRpcUrl = normalized ? normalized : null;
|
|
1307
1605
|
cachedConnections.clear();
|
|
1308
1606
|
}
|
|
@@ -1437,7 +1735,7 @@ function resolveSolanaTokenMeta(token) {
|
|
|
1437
1735
|
return {};
|
|
1438
1736
|
}
|
|
1439
1737
|
function getDepositEventDetails(event) {
|
|
1440
|
-
if (!_optionalChain([event, 'optionalAccess',
|
|
1738
|
+
if (!_optionalChain([event, 'optionalAccess', _48 => _48.type]) || !isRecord(event.data)) return {};
|
|
1441
1739
|
if (event.type === "deposit-received") {
|
|
1442
1740
|
const chainId = asChainId(event.data.chain);
|
|
1443
1741
|
const token = asString(event.data.token);
|
|
@@ -1451,50 +1749,61 @@ function getDepositEventDetails(event) {
|
|
|
1451
1749
|
}
|
|
1452
1750
|
if (event.type === "bridge-started") {
|
|
1453
1751
|
const source = isRecord(event.data.source) ? event.data.source : void 0;
|
|
1454
|
-
const chainId = asChainId(_optionalChain([source, 'optionalAccess',
|
|
1455
|
-
const token = asString(_optionalChain([source, 'optionalAccess',
|
|
1752
|
+
const chainId = asChainId(_optionalChain([source, 'optionalAccess', _49 => _49.chain]));
|
|
1753
|
+
const token = asString(_optionalChain([source, 'optionalAccess', _50 => _50.asset]));
|
|
1456
1754
|
const solanaMeta = chainId === "solana" ? resolveSolanaTokenMeta(token) : {};
|
|
1457
1755
|
return {
|
|
1458
1756
|
chainId,
|
|
1459
|
-
amount: asAmount(_optionalChain([source, 'optionalAccess',
|
|
1757
|
+
amount: asAmount(_optionalChain([source, 'optionalAccess', _51 => _51.amount])),
|
|
1460
1758
|
token,
|
|
1461
1759
|
...solanaMeta
|
|
1462
1760
|
};
|
|
1463
1761
|
}
|
|
1464
1762
|
return {};
|
|
1465
1763
|
}
|
|
1764
|
+
function isSameRoute(sourceChain, sourceToken, targetChain, targetToken) {
|
|
1765
|
+
return sourceChain === targetChain && sourceToken.toLowerCase() === targetToken.toLowerCase();
|
|
1766
|
+
}
|
|
1466
1767
|
function DepositAddressStep({
|
|
1467
1768
|
smartAccount,
|
|
1468
1769
|
solanaDepositAddress,
|
|
1469
1770
|
service,
|
|
1470
1771
|
allowedRoutes,
|
|
1471
|
-
|
|
1772
|
+
targetChain,
|
|
1773
|
+
targetToken,
|
|
1774
|
+
waitForFinalTx,
|
|
1775
|
+
hasPostBridgeActions,
|
|
1776
|
+
onDepositSubmitted,
|
|
1777
|
+
onDepositComplete,
|
|
1778
|
+
onDepositFailed,
|
|
1472
1779
|
onCopyAddress,
|
|
1473
1780
|
onError
|
|
1474
1781
|
}) {
|
|
1475
1782
|
const hasSolana = Boolean(solanaDepositAddress);
|
|
1476
1783
|
const allowedChainSet = _react.useMemo.call(void 0,
|
|
1477
|
-
() => _optionalChain([allowedRoutes, 'optionalAccess',
|
|
1478
|
-
[_optionalChain([allowedRoutes, 'optionalAccess',
|
|
1784
|
+
() => _optionalChain([allowedRoutes, 'optionalAccess', _52 => _52.sourceChains]) ? new Set(allowedRoutes.sourceChains) : null,
|
|
1785
|
+
[_optionalChain([allowedRoutes, 'optionalAccess', _53 => _53.sourceChains])]
|
|
1479
1786
|
);
|
|
1480
1787
|
const allowedTokenSet = _react.useMemo.call(void 0,
|
|
1481
|
-
() => _optionalChain([allowedRoutes, 'optionalAccess',
|
|
1482
|
-
[_optionalChain([allowedRoutes, 'optionalAccess',
|
|
1788
|
+
() => _optionalChain([allowedRoutes, 'optionalAccess', _54 => _54.sourceTokens]) ? new Set(allowedRoutes.sourceTokens.map((s) => s.toUpperCase())) : null,
|
|
1789
|
+
[_optionalChain([allowedRoutes, 'optionalAccess', _55 => _55.sourceTokens])]
|
|
1483
1790
|
);
|
|
1484
1791
|
const evmChainIds = _react.useMemo.call(void 0, () => {
|
|
1485
|
-
const all =
|
|
1792
|
+
const all = _chunkMUWVDVY4cjs.getSupportedChainIds.call(void 0, );
|
|
1486
1793
|
return allowedChainSet ? all.filter((id) => allowedChainSet.has(id)) : all;
|
|
1487
1794
|
}, [allowedChainSet]);
|
|
1488
|
-
const chainOptions = _react.useMemo.call(void 0,
|
|
1489
|
-
()
|
|
1490
|
-
[evmChainIds
|
|
1491
|
-
|
|
1795
|
+
const chainOptions = _react.useMemo.call(void 0, () => {
|
|
1796
|
+
if (!hasSolana) return evmChainIds;
|
|
1797
|
+
const options = [...evmChainIds];
|
|
1798
|
+
options.splice(1, 0, "solana");
|
|
1799
|
+
return options;
|
|
1800
|
+
}, [evmChainIds, hasSolana]);
|
|
1492
1801
|
const BASE_CHAIN_ID = 8453;
|
|
1493
1802
|
const defaultChainId = evmChainIds.includes(BASE_CHAIN_ID) ? BASE_CHAIN_ID : evmChainIds[0];
|
|
1494
1803
|
const [sourceChainId, setSourceChainId] = _react.useState.call(void 0, defaultChainId);
|
|
1495
1804
|
const isSolana = sourceChainId === "solana";
|
|
1496
1805
|
const tokensForChain = _react.useMemo.call(void 0, () => {
|
|
1497
|
-
const all = isSolana ? SOLANA_TOKENS.map((t) => t.symbol) :
|
|
1806
|
+
const all = isSolana ? SOLANA_TOKENS.map((t) => t.symbol) : _chunkMUWVDVY4cjs.getTargetTokenSymbolsForChain.call(void 0, sourceChainId);
|
|
1498
1807
|
return allowedTokenSet ? all.filter((s) => allowedTokenSet.has(s.toUpperCase())) : all;
|
|
1499
1808
|
}, [sourceChainId, isSolana, allowedTokenSet]);
|
|
1500
1809
|
const defaultToken = tokensForChain.includes("USDC") ? "USDC" : _nullishCoalesce(tokensForChain[0], () => ( "USDC"));
|
|
@@ -1511,10 +1820,13 @@ function DepositAddressStep({
|
|
|
1511
1820
|
const [tokenDropdownOpen, setTokenDropdownOpen] = _react.useState.call(void 0, false);
|
|
1512
1821
|
const chainDropdownRef = _react.useRef.call(void 0, null);
|
|
1513
1822
|
const tokenDropdownRef = _react.useRef.call(void 0, null);
|
|
1514
|
-
const
|
|
1823
|
+
const [notifications, setNotifications] = _react.useState.call(void 0, []);
|
|
1824
|
+
const isTrackingRef = _react.useRef.call(void 0, false);
|
|
1825
|
+
const baselineTxHashRef = _react.useRef.call(void 0, void 0);
|
|
1826
|
+
const notificationIdRef = _react.useRef.call(void 0, 0);
|
|
1515
1827
|
const sourceSelectionRef = _react.useRef.call(void 0, {
|
|
1516
1828
|
chainId: defaultChainId,
|
|
1517
|
-
token: typeof defaultChainId === "number" ?
|
|
1829
|
+
token: typeof defaultChainId === "number" ? _chunkMUWVDVY4cjs.getTokenAddress.call(void 0, defaultToken, defaultChainId) : void 0,
|
|
1518
1830
|
sourceSymbol: defaultToken
|
|
1519
1831
|
});
|
|
1520
1832
|
_react.useEffect.call(void 0, () => {
|
|
@@ -1522,15 +1834,15 @@ function DepositAddressStep({
|
|
|
1522
1834
|
const matched = _nullishCoalesce(SOLANA_TOKENS.find((t) => t.symbol === sourceTokenSymbol), () => ( SOLANA_TOKENS[0]));
|
|
1523
1835
|
sourceSelectionRef.current = {
|
|
1524
1836
|
chainId: "solana",
|
|
1525
|
-
token: _optionalChain([matched, 'optionalAccess',
|
|
1526
|
-
sourceSymbol: _optionalChain([matched, 'optionalAccess',
|
|
1527
|
-
sourceDecimals: _optionalChain([matched, 'optionalAccess',
|
|
1837
|
+
token: _optionalChain([matched, 'optionalAccess', _56 => _56.mint]),
|
|
1838
|
+
sourceSymbol: _optionalChain([matched, 'optionalAccess', _57 => _57.symbol]),
|
|
1839
|
+
sourceDecimals: _optionalChain([matched, 'optionalAccess', _58 => _58.decimals])
|
|
1528
1840
|
};
|
|
1529
1841
|
return;
|
|
1530
1842
|
}
|
|
1531
1843
|
sourceSelectionRef.current = {
|
|
1532
1844
|
chainId: sourceChainId,
|
|
1533
|
-
token:
|
|
1845
|
+
token: _chunkMUWVDVY4cjs.getTokenAddress.call(void 0, sourceTokenSymbol, sourceChainId),
|
|
1534
1846
|
sourceSymbol: sourceTokenSymbol
|
|
1535
1847
|
};
|
|
1536
1848
|
}, [sourceChainId, sourceTokenSymbol, isSolana]);
|
|
@@ -1540,8 +1852,8 @@ function DepositAddressStep({
|
|
|
1540
1852
|
function handlePointerDown(event) {
|
|
1541
1853
|
const target = event.target;
|
|
1542
1854
|
if (!target) return;
|
|
1543
|
-
const clickedChainDropdown = _optionalChain([chainDropdownRef, 'access',
|
|
1544
|
-
const clickedTokenDropdown = _optionalChain([tokenDropdownRef, 'access',
|
|
1855
|
+
const clickedChainDropdown = _optionalChain([chainDropdownRef, 'access', _59 => _59.current, 'optionalAccess', _60 => _60.contains, 'call', _61 => _61(target)]);
|
|
1856
|
+
const clickedTokenDropdown = _optionalChain([tokenDropdownRef, 'access', _62 => _62.current, 'optionalAccess', _63 => _63.contains, 'call', _64 => _64(target)]);
|
|
1545
1857
|
if (clickedChainDropdown || clickedTokenDropdown) return;
|
|
1546
1858
|
setChainDropdownOpen(false);
|
|
1547
1859
|
setTokenDropdownOpen(false);
|
|
@@ -1554,12 +1866,12 @@ function DepositAddressStep({
|
|
|
1554
1866
|
};
|
|
1555
1867
|
}, [chainDropdownOpen, tokenDropdownOpen]);
|
|
1556
1868
|
const handleCopy = _react.useCallback.call(void 0, async () => {
|
|
1557
|
-
_optionalChain([onCopyAddress, 'optionalCall',
|
|
1869
|
+
_optionalChain([onCopyAddress, 'optionalCall', _65 => _65()]);
|
|
1558
1870
|
try {
|
|
1559
1871
|
await navigator.clipboard.writeText(displayAddress);
|
|
1560
1872
|
setCopied(true);
|
|
1561
1873
|
setTimeout(() => setCopied(false), 2e3);
|
|
1562
|
-
} catch (
|
|
1874
|
+
} catch (e13) {
|
|
1563
1875
|
const textarea = document.createElement("textarea");
|
|
1564
1876
|
textarea.value = displayAddress;
|
|
1565
1877
|
textarea.style.position = "fixed";
|
|
@@ -1577,22 +1889,46 @@ function DepositAddressStep({
|
|
|
1577
1889
|
setChainDropdownOpen(false);
|
|
1578
1890
|
setTokenDropdownOpen(false);
|
|
1579
1891
|
}, [sourceChainId]);
|
|
1892
|
+
const onDepositSubmittedRef = _react.useRef.call(void 0, onDepositSubmitted);
|
|
1893
|
+
onDepositSubmittedRef.current = onDepositSubmitted;
|
|
1894
|
+
const onDepositCompleteRef = _react.useRef.call(void 0, onDepositComplete);
|
|
1895
|
+
onDepositCompleteRef.current = onDepositComplete;
|
|
1896
|
+
const onDepositFailedRef = _react.useRef.call(void 0, onDepositFailed);
|
|
1897
|
+
onDepositFailedRef.current = onDepositFailed;
|
|
1898
|
+
const onErrorRef = _react.useRef.call(void 0, onError);
|
|
1899
|
+
onErrorRef.current = onError;
|
|
1900
|
+
const targetChainRef = _react.useRef.call(void 0, targetChain);
|
|
1901
|
+
targetChainRef.current = targetChain;
|
|
1902
|
+
const targetTokenRef = _react.useRef.call(void 0, targetToken);
|
|
1903
|
+
targetTokenRef.current = targetToken;
|
|
1580
1904
|
_react.useEffect.call(void 0, () => {
|
|
1581
|
-
|
|
1905
|
+
baselineTxHashRef.current = void 0;
|
|
1906
|
+
isTrackingRef.current = false;
|
|
1582
1907
|
setPollingError(null);
|
|
1583
1908
|
let timeoutId;
|
|
1584
1909
|
let cancelled = false;
|
|
1585
|
-
let baselineTxHash = void 0;
|
|
1586
1910
|
async function poll() {
|
|
1587
|
-
if (cancelled
|
|
1911
|
+
if (cancelled) return;
|
|
1912
|
+
if (isTrackingRef.current) {
|
|
1913
|
+
if (!cancelled) {
|
|
1914
|
+
timeoutId = setTimeout(poll, POLL_INTERVAL_MS);
|
|
1915
|
+
}
|
|
1916
|
+
return;
|
|
1917
|
+
}
|
|
1588
1918
|
try {
|
|
1589
1919
|
const status = await service.fetchLatestStatus(smartAccount);
|
|
1590
|
-
if (cancelled
|
|
1920
|
+
if (cancelled) return;
|
|
1921
|
+
if (isTrackingRef.current) {
|
|
1922
|
+
if (!cancelled) {
|
|
1923
|
+
timeoutId = setTimeout(poll, POLL_INTERVAL_MS);
|
|
1924
|
+
}
|
|
1925
|
+
return;
|
|
1926
|
+
}
|
|
1591
1927
|
const event = status.lastEvent;
|
|
1592
|
-
const eventTxHash =
|
|
1593
|
-
if (
|
|
1594
|
-
|
|
1595
|
-
} else if (eventTxHash && (!
|
|
1928
|
+
const eventTxHash = _chunkFLVSQDP4cjs.isDepositEvent.call(void 0, event) ? _nullishCoalesce(_chunkFLVSQDP4cjs.getEventTxHash.call(void 0, event), () => ( null)) : null;
|
|
1929
|
+
if (baselineTxHashRef.current === void 0) {
|
|
1930
|
+
baselineTxHashRef.current = eventTxHash;
|
|
1931
|
+
} else if (eventTxHash && (!baselineTxHashRef.current || !_chunkFLVSQDP4cjs.txRefsMatch.call(void 0, eventTxHash, baselineTxHashRef.current))) {
|
|
1596
1932
|
const details = getDepositEventDetails(event);
|
|
1597
1933
|
const fallback = sourceSelectionRef.current;
|
|
1598
1934
|
const chainId = _nullishCoalesce(details.chainId, () => ( fallback.chainId));
|
|
@@ -1601,16 +1937,33 @@ function DepositAddressStep({
|
|
|
1601
1937
|
const sourceSymbol = _nullishCoalesce(details.sourceSymbol, () => ( fallback.sourceSymbol));
|
|
1602
1938
|
const sourceDecimals = _nullishCoalesce(details.sourceDecimals, () => ( fallback.sourceDecimals));
|
|
1603
1939
|
if (token) {
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
1940
|
+
baselineTxHashRef.current = eventTxHash;
|
|
1941
|
+
isTrackingRef.current = true;
|
|
1942
|
+
const isEvmToken = /^0x[a-fA-F0-9]{40}$/.test(token);
|
|
1943
|
+
const directTransfer = typeof chainId === "number" && isEvmToken && isSameRoute(
|
|
1607
1944
|
chainId,
|
|
1945
|
+
token,
|
|
1946
|
+
targetChainRef.current,
|
|
1947
|
+
targetTokenRef.current
|
|
1948
|
+
);
|
|
1949
|
+
const id = String(++notificationIdRef.current);
|
|
1950
|
+
const notification = {
|
|
1951
|
+
id,
|
|
1952
|
+
txHash: eventTxHash,
|
|
1953
|
+
sourceChain: chainId,
|
|
1608
1954
|
amount,
|
|
1609
1955
|
token,
|
|
1610
1956
|
sourceSymbol,
|
|
1611
|
-
sourceDecimals
|
|
1612
|
-
|
|
1613
|
-
|
|
1957
|
+
sourceDecimals,
|
|
1958
|
+
detectedAt: Date.now(),
|
|
1959
|
+
directTransfer
|
|
1960
|
+
};
|
|
1961
|
+
setNotifications((prev) => [notification, ...prev]);
|
|
1962
|
+
_optionalChain([onDepositSubmittedRef, 'access', _66 => _66.current, 'optionalCall', _67 => _67({
|
|
1963
|
+
txHash: eventTxHash,
|
|
1964
|
+
sourceChain: chainId,
|
|
1965
|
+
amount
|
|
1966
|
+
})]);
|
|
1614
1967
|
}
|
|
1615
1968
|
}
|
|
1616
1969
|
setPollingError(null);
|
|
@@ -1618,10 +1971,10 @@ function DepositAddressStep({
|
|
|
1618
1971
|
if (!cancelled) {
|
|
1619
1972
|
const msg = err instanceof Error ? err.message : "Failed to check status";
|
|
1620
1973
|
setPollingError(msg);
|
|
1621
|
-
_optionalChain([
|
|
1974
|
+
_optionalChain([onErrorRef, 'access', _68 => _68.current, 'optionalCall', _69 => _69(msg, "STATUS_POLL_ERROR")]);
|
|
1622
1975
|
}
|
|
1623
1976
|
}
|
|
1624
|
-
if (!cancelled
|
|
1977
|
+
if (!cancelled) {
|
|
1625
1978
|
timeoutId = setTimeout(poll, POLL_INTERVAL_MS);
|
|
1626
1979
|
}
|
|
1627
1980
|
}
|
|
@@ -1630,13 +1983,30 @@ function DepositAddressStep({
|
|
|
1630
1983
|
cancelled = true;
|
|
1631
1984
|
clearTimeout(timeoutId);
|
|
1632
1985
|
};
|
|
1633
|
-
}, [smartAccount, service
|
|
1634
|
-
const
|
|
1635
|
-
|
|
1986
|
+
}, [smartAccount, service]);
|
|
1987
|
+
const handleNotificationComplete = _react.useCallback.call(void 0,
|
|
1988
|
+
(txHash, destinationTxHash, context) => {
|
|
1989
|
+
isTrackingRef.current = false;
|
|
1990
|
+
_optionalChain([onDepositCompleteRef, 'access', _70 => _70.current, 'optionalCall', _71 => _71(txHash, destinationTxHash, context)]);
|
|
1991
|
+
},
|
|
1992
|
+
[]
|
|
1993
|
+
);
|
|
1994
|
+
const handleNotificationFailed = _react.useCallback.call(void 0,
|
|
1995
|
+
(txHash, error) => {
|
|
1996
|
+
isTrackingRef.current = false;
|
|
1997
|
+
_optionalChain([onDepositFailedRef, 'access', _72 => _72.current, 'optionalCall', _73 => _73(txHash, error)]);
|
|
1998
|
+
},
|
|
1999
|
+
[]
|
|
2000
|
+
);
|
|
2001
|
+
const handleNotificationDismiss = _react.useCallback.call(void 0, (id) => {
|
|
2002
|
+
setNotifications((prev) => prev.filter((n) => n.id !== id));
|
|
2003
|
+
}, []);
|
|
2004
|
+
const qrIconSrc = _chunkMUWVDVY4cjs.getChainIcon.call(void 0, sourceChainId);
|
|
2005
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-step rs-step--with-notifications", children: [
|
|
1636
2006
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-step-body", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-deposit-address", children: [
|
|
1637
2007
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-deposit-address-selectors", children: [
|
|
1638
2008
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-deposit-address-dropdown", ref: chainDropdownRef, children: [
|
|
1639
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-deposit-address-dropdown-label", children: "
|
|
2009
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-deposit-address-dropdown-label", children: "Supported chain" }),
|
|
1640
2010
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1641
2011
|
"button",
|
|
1642
2012
|
{
|
|
@@ -1647,15 +2017,15 @@ function DepositAddressStep({
|
|
|
1647
2017
|
setTokenDropdownOpen(false);
|
|
1648
2018
|
},
|
|
1649
2019
|
children: [
|
|
1650
|
-
|
|
2020
|
+
_chunkMUWVDVY4cjs.getChainIcon.call(void 0, sourceChainId) && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1651
2021
|
"img",
|
|
1652
2022
|
{
|
|
1653
|
-
src:
|
|
2023
|
+
src: _chunkMUWVDVY4cjs.getChainIcon.call(void 0, sourceChainId),
|
|
1654
2024
|
alt: "",
|
|
1655
2025
|
className: "rs-deposit-address-dropdown-icon"
|
|
1656
2026
|
}
|
|
1657
2027
|
),
|
|
1658
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children:
|
|
2028
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: _chunkMUWVDVY4cjs.getChainName.call(void 0, sourceChainId) }),
|
|
1659
2029
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1660
2030
|
"svg",
|
|
1661
2031
|
{
|
|
@@ -1687,22 +2057,22 @@ function DepositAddressStep({
|
|
|
1687
2057
|
setChainDropdownOpen(false);
|
|
1688
2058
|
},
|
|
1689
2059
|
children: [
|
|
1690
|
-
|
|
2060
|
+
_chunkMUWVDVY4cjs.getChainIcon.call(void 0, chainId) && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1691
2061
|
"img",
|
|
1692
2062
|
{
|
|
1693
|
-
src:
|
|
2063
|
+
src: _chunkMUWVDVY4cjs.getChainIcon.call(void 0, chainId),
|
|
1694
2064
|
alt: "",
|
|
1695
2065
|
className: "rs-deposit-address-dropdown-icon"
|
|
1696
2066
|
}
|
|
1697
2067
|
),
|
|
1698
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children:
|
|
2068
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: _chunkMUWVDVY4cjs.getChainName.call(void 0, chainId) })
|
|
1699
2069
|
]
|
|
1700
2070
|
},
|
|
1701
2071
|
String(chainId)
|
|
1702
2072
|
)) })
|
|
1703
2073
|
] }),
|
|
1704
2074
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-deposit-address-dropdown", ref: tokenDropdownRef, children: [
|
|
1705
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-deposit-address-dropdown-label", children: "
|
|
2075
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-deposit-address-dropdown-label", children: "Supported token" }),
|
|
1706
2076
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1707
2077
|
"button",
|
|
1708
2078
|
{
|
|
@@ -1713,10 +2083,10 @@ function DepositAddressStep({
|
|
|
1713
2083
|
setChainDropdownOpen(false);
|
|
1714
2084
|
},
|
|
1715
2085
|
children: [
|
|
1716
|
-
|
|
2086
|
+
_chunkMUWVDVY4cjs.getTokenIcon.call(void 0, sourceTokenSymbol) && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1717
2087
|
"img",
|
|
1718
2088
|
{
|
|
1719
|
-
src:
|
|
2089
|
+
src: _chunkMUWVDVY4cjs.getTokenIcon.call(void 0, sourceTokenSymbol),
|
|
1720
2090
|
alt: "",
|
|
1721
2091
|
className: "rs-deposit-address-dropdown-icon"
|
|
1722
2092
|
}
|
|
@@ -1753,10 +2123,10 @@ function DepositAddressStep({
|
|
|
1753
2123
|
setTokenDropdownOpen(false);
|
|
1754
2124
|
},
|
|
1755
2125
|
children: [
|
|
1756
|
-
|
|
2126
|
+
_chunkMUWVDVY4cjs.getTokenIcon.call(void 0, symbol) && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1757
2127
|
"img",
|
|
1758
2128
|
{
|
|
1759
|
-
src:
|
|
2129
|
+
src: _chunkMUWVDVY4cjs.getTokenIcon.call(void 0, symbol),
|
|
1760
2130
|
alt: "",
|
|
1761
2131
|
className: "rs-deposit-address-dropdown-icon"
|
|
1762
2132
|
}
|
|
@@ -1768,7 +2138,7 @@ function DepositAddressStep({
|
|
|
1768
2138
|
)) })
|
|
1769
2139
|
] })
|
|
1770
2140
|
] }),
|
|
1771
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-deposit-address-qr", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, QRCode, { value: displayAddress, size:
|
|
2141
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-deposit-address-qr", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, QRCode, { value: displayAddress, size: 150, iconSrc: qrIconSrc }) }),
|
|
1772
2142
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-deposit-address-info", children: [
|
|
1773
2143
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-deposit-address-label", children: [
|
|
1774
2144
|
"Your ",
|
|
@@ -1815,7 +2185,23 @@ function DepositAddressStep({
|
|
|
1815
2185
|
] }),
|
|
1816
2186
|
pollingError && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-deposit-address-error", children: pollingError })
|
|
1817
2187
|
] }) }),
|
|
1818
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2188
|
+
notifications.length > 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-deposit-notifications", children: notifications.map((deposit) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2189
|
+
DepositNotification,
|
|
2190
|
+
{
|
|
2191
|
+
deposit,
|
|
2192
|
+
smartAccount,
|
|
2193
|
+
targetChain,
|
|
2194
|
+
targetToken,
|
|
2195
|
+
waitForFinalTx,
|
|
2196
|
+
hasPostBridgeActions,
|
|
2197
|
+
service,
|
|
2198
|
+
onComplete: handleNotificationComplete,
|
|
2199
|
+
onFailed: handleNotificationFailed,
|
|
2200
|
+
onDismiss: handleNotificationDismiss
|
|
2201
|
+
},
|
|
2202
|
+
deposit.id
|
|
2203
|
+
)) }),
|
|
2204
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFLVSQDP4cjs.PoweredBy, {})
|
|
1819
2205
|
] });
|
|
1820
2206
|
}
|
|
1821
2207
|
DepositAddressStep.displayName = "DepositAddressStep";
|
|
@@ -1846,7 +2232,7 @@ function SolanaTokenSelectStep({
|
|
|
1846
2232
|
setError(null);
|
|
1847
2233
|
const portfolioBySymbol = {};
|
|
1848
2234
|
try {
|
|
1849
|
-
|
|
2235
|
+
_chunkFLVSQDP4cjs.debugLog.call(void 0, debug, "solana-token-select", "portfolio:request", {
|
|
1850
2236
|
solanaAddress
|
|
1851
2237
|
});
|
|
1852
2238
|
const portfolio = await service.fetchSolanaPortfolio(solanaAddress);
|
|
@@ -1857,7 +2243,7 @@ function SolanaTokenSelectStep({
|
|
|
1857
2243
|
let parsed = 0n;
|
|
1858
2244
|
try {
|
|
1859
2245
|
parsed = BigInt(t.balance || "0");
|
|
1860
|
-
} catch (
|
|
2246
|
+
} catch (e14) {
|
|
1861
2247
|
parsed = 0n;
|
|
1862
2248
|
}
|
|
1863
2249
|
if (parsed <= 0n) continue;
|
|
@@ -1869,12 +2255,12 @@ function SolanaTokenSelectStep({
|
|
|
1869
2255
|
};
|
|
1870
2256
|
}
|
|
1871
2257
|
}
|
|
1872
|
-
|
|
2258
|
+
_chunkFLVSQDP4cjs.debugLog.call(void 0, debug, "solana-token-select", "portfolio:success", {
|
|
1873
2259
|
symbols: Object.keys(portfolioBySymbol)
|
|
1874
2260
|
});
|
|
1875
2261
|
} catch (err) {
|
|
1876
2262
|
if (!active) return;
|
|
1877
|
-
|
|
2263
|
+
_chunkFLVSQDP4cjs.debugError.call(void 0, debug, "solana-token-select", "portfolio:failure", err, {
|
|
1878
2264
|
solanaAddress
|
|
1879
2265
|
});
|
|
1880
2266
|
setError(
|
|
@@ -1899,7 +2285,7 @@ function SolanaTokenSelectStep({
|
|
|
1899
2285
|
setTokenBalances(results);
|
|
1900
2286
|
setLoading(false);
|
|
1901
2287
|
const totalUsd = results.reduce((sum, r) => sum + r.balanceUsd, 0);
|
|
1902
|
-
_optionalChain([onTotalBalanceComputed, 'optionalCall',
|
|
2288
|
+
_optionalChain([onTotalBalanceComputed, 'optionalCall', _74 => _74(totalUsd)]);
|
|
1903
2289
|
}
|
|
1904
2290
|
void loadBalances();
|
|
1905
2291
|
return () => {
|
|
@@ -1928,7 +2314,7 @@ function SolanaTokenSelectStep({
|
|
|
1928
2314
|
style: { paddingTop: 4, overflow: "auto", maxHeight: 340 },
|
|
1929
2315
|
children: [
|
|
1930
2316
|
loading && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-loading-state", style: { padding: "40px 12px" }, children: [
|
|
1931
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2317
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFLVSQDP4cjs.Spinner, { className: "rs-text-tertiary" }),
|
|
1932
2318
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-text-sm rs-text-tertiary", children: "Loading balances" })
|
|
1933
2319
|
] }),
|
|
1934
2320
|
!loading && rows.length === 0 && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-empty-state", children: [
|
|
@@ -1959,14 +2345,14 @@ function SolanaTokenSelectStep({
|
|
|
1959
2345
|
] }),
|
|
1960
2346
|
!loading && rows.length > 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-asset-list", children: rows.map((entry) => {
|
|
1961
2347
|
const isSelected = selectedSymbol === entry.token.symbol;
|
|
1962
|
-
const tokenIcon =
|
|
1963
|
-
const chainIcon =
|
|
2348
|
+
const tokenIcon = _chunkMUWVDVY4cjs.getTokenIcon.call(void 0, entry.token.symbol);
|
|
2349
|
+
const chainIcon = _chunkMUWVDVY4cjs.getChainIcon.call(void 0, "solana");
|
|
1964
2350
|
let formattedBalance;
|
|
1965
2351
|
try {
|
|
1966
2352
|
const raw = _viem.formatUnits.call(void 0, entry.balance, entry.token.decimals);
|
|
1967
2353
|
const numeric = Number(raw);
|
|
1968
|
-
formattedBalance = Number.isFinite(numeric) ?
|
|
1969
|
-
} catch (
|
|
2354
|
+
formattedBalance = Number.isFinite(numeric) ? _chunkFLVSQDP4cjs.tokenFormatter.format(numeric) : raw;
|
|
2355
|
+
} catch (e15) {
|
|
1970
2356
|
formattedBalance = "...";
|
|
1971
2357
|
}
|
|
1972
2358
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
@@ -2009,7 +2395,7 @@ function SolanaTokenSelectStep({
|
|
|
2009
2395
|
] })
|
|
2010
2396
|
] })
|
|
2011
2397
|
] }),
|
|
2012
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-asset-balance", children: entry.balanceUsd > 0 ?
|
|
2398
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-asset-balance", children: entry.balanceUsd > 0 ? _chunkFLVSQDP4cjs.currencyFormatter.format(entry.balanceUsd) : `${formattedBalance} ${entry.token.symbol}` })
|
|
2013
2399
|
]
|
|
2014
2400
|
},
|
|
2015
2401
|
entry.token.symbol
|
|
@@ -2019,7 +2405,7 @@ function SolanaTokenSelectStep({
|
|
|
2019
2405
|
}
|
|
2020
2406
|
),
|
|
2021
2407
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-step-footer", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2022
|
-
|
|
2408
|
+
_chunkFLVSQDP4cjs.Button,
|
|
2023
2409
|
{
|
|
2024
2410
|
onClick: () => selectedEntry && onContinue(
|
|
2025
2411
|
selectedEntry.token,
|
|
@@ -2031,7 +2417,7 @@ function SolanaTokenSelectStep({
|
|
|
2031
2417
|
children: "Continue"
|
|
2032
2418
|
}
|
|
2033
2419
|
) }),
|
|
2034
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2420
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFLVSQDP4cjs.PoweredBy, {})
|
|
2035
2421
|
] });
|
|
2036
2422
|
}
|
|
2037
2423
|
|
|
@@ -2051,7 +2437,7 @@ function SolanaAmountStep({
|
|
|
2051
2437
|
}) {
|
|
2052
2438
|
const [amount, setAmount] = _react.useState.call(void 0, "");
|
|
2053
2439
|
const [error, setError] = _react.useState.call(void 0, null);
|
|
2054
|
-
const isSourceStablecoin =
|
|
2440
|
+
const isSourceStablecoin = _chunkMUWVDVY4cjs.isStablecoinSymbol.call(void 0, token.symbol);
|
|
2055
2441
|
const tokenPriceUsd = _react.useMemo.call(void 0, () => {
|
|
2056
2442
|
if (isSourceStablecoin) return 1;
|
|
2057
2443
|
try {
|
|
@@ -2061,7 +2447,7 @@ function SolanaAmountStep({
|
|
|
2061
2447
|
}
|
|
2062
2448
|
const price = balanceUsd / balanceUnits;
|
|
2063
2449
|
return price > 0 ? price : null;
|
|
2064
|
-
} catch (
|
|
2450
|
+
} catch (e16) {
|
|
2065
2451
|
return null;
|
|
2066
2452
|
}
|
|
2067
2453
|
}, [isSourceStablecoin, balance, token.decimals, balanceUsd]);
|
|
@@ -2079,8 +2465,8 @@ function SolanaAmountStep({
|
|
|
2079
2465
|
const raw = _viem.formatUnits.call(void 0, balance, token.decimals);
|
|
2080
2466
|
const numeric = Number(raw);
|
|
2081
2467
|
if (!Number.isFinite(numeric)) return raw;
|
|
2082
|
-
return
|
|
2083
|
-
} catch (
|
|
2468
|
+
return _chunkFLVSQDP4cjs.tokenFormatter.format(numeric);
|
|
2469
|
+
} catch (e17) {
|
|
2084
2470
|
return "...";
|
|
2085
2471
|
}
|
|
2086
2472
|
}, [balance, token.decimals]);
|
|
@@ -2091,13 +2477,13 @@ function SolanaAmountStep({
|
|
|
2091
2477
|
if (tokenPriceUsd !== null) return balanceUnits * tokenPriceUsd;
|
|
2092
2478
|
if (Number.isFinite(balanceUsd) && balanceUsd > 0) return balanceUsd;
|
|
2093
2479
|
return null;
|
|
2094
|
-
} catch (
|
|
2480
|
+
} catch (e18) {
|
|
2095
2481
|
return null;
|
|
2096
2482
|
}
|
|
2097
2483
|
}, [balance, token.decimals, tokenPriceUsd, balanceUsd]);
|
|
2098
2484
|
const formattedBalanceUsd = _react.useMemo.call(void 0, () => {
|
|
2099
2485
|
if (computedBalanceUsd === null || computedBalanceUsd <= 0) return null;
|
|
2100
|
-
return
|
|
2486
|
+
return _chunkFLVSQDP4cjs.currencyFormatter.format(computedBalanceUsd);
|
|
2101
2487
|
}, [computedBalanceUsd]);
|
|
2102
2488
|
const spendableBalance = _react.useMemo.call(void 0, () => {
|
|
2103
2489
|
if (!isNativeSol(token)) return balance;
|
|
@@ -2109,7 +2495,7 @@ function SolanaAmountStep({
|
|
|
2109
2495
|
if (!Number.isFinite(spendableUnits) || spendableUnits < 0) return null;
|
|
2110
2496
|
if (tokenPriceUsd !== null) return spendableUnits * tokenPriceUsd;
|
|
2111
2497
|
return null;
|
|
2112
|
-
} catch (
|
|
2498
|
+
} catch (e19) {
|
|
2113
2499
|
return null;
|
|
2114
2500
|
}
|
|
2115
2501
|
}, [spendableBalance, token.decimals, tokenPriceUsd]);
|
|
@@ -2122,13 +2508,13 @@ function SolanaAmountStep({
|
|
|
2122
2508
|
const factor = 10 ** maxDecimals;
|
|
2123
2509
|
const truncated = Math.floor(value * factor) / factor;
|
|
2124
2510
|
const formatted = truncated.toFixed(maxDecimals).replace(/\.?0+$/, "");
|
|
2125
|
-
|
|
2511
|
+
_chunkFLVSQDP4cjs.debugLog.call(void 0, debug, "solana-amount", "amount:preset", {
|
|
2126
2512
|
percentage,
|
|
2127
2513
|
symbol: token.symbol,
|
|
2128
2514
|
formatted
|
|
2129
2515
|
});
|
|
2130
2516
|
setAmount(formatted);
|
|
2131
|
-
} catch (
|
|
2517
|
+
} catch (e20) {
|
|
2132
2518
|
return;
|
|
2133
2519
|
}
|
|
2134
2520
|
if (error) setError(null);
|
|
@@ -2136,7 +2522,7 @@ function SolanaAmountStep({
|
|
|
2136
2522
|
const handleContinue = () => {
|
|
2137
2523
|
const numericAmount = parseFloat(amount);
|
|
2138
2524
|
if (isNaN(numericAmount) || numericAmount <= 0) {
|
|
2139
|
-
|
|
2525
|
+
_chunkFLVSQDP4cjs.debugLog.call(void 0, debug, "solana-amount", "amount:invalid", {
|
|
2140
2526
|
amount,
|
|
2141
2527
|
reason: "nan-or-non-positive"
|
|
2142
2528
|
});
|
|
@@ -2146,13 +2532,13 @@ function SolanaAmountStep({
|
|
|
2146
2532
|
const sourceAmount = isSourceStablecoin || !hasPricing ? numericAmount : numericAmount / tokenPriceUsd;
|
|
2147
2533
|
if (hasPricing) {
|
|
2148
2534
|
const usdValue = numericAmount;
|
|
2149
|
-
if (_optionalChain([uiConfig, 'optionalAccess',
|
|
2535
|
+
if (_optionalChain([uiConfig, 'optionalAccess', _75 => _75.maxDepositUsd]) && usdValue > uiConfig.maxDepositUsd) {
|
|
2150
2536
|
setError(
|
|
2151
|
-
`Maximum deposit is ${
|
|
2537
|
+
`Maximum deposit is ${_chunkFLVSQDP4cjs.currencyFormatter.format(uiConfig.maxDepositUsd)}`
|
|
2152
2538
|
);
|
|
2153
2539
|
return;
|
|
2154
2540
|
}
|
|
2155
|
-
if (_optionalChain([uiConfig, 'optionalAccess',
|
|
2541
|
+
if (_optionalChain([uiConfig, 'optionalAccess', _76 => _76.minDepositUsd]) && usdValue < uiConfig.minDepositUsd) {
|
|
2156
2542
|
setAmount(uiConfig.minDepositUsd.toString());
|
|
2157
2543
|
setError(null);
|
|
2158
2544
|
return;
|
|
@@ -2162,8 +2548,8 @@ function SolanaAmountStep({
|
|
|
2162
2548
|
let amountInUnits;
|
|
2163
2549
|
try {
|
|
2164
2550
|
amountInUnits = _viem.parseUnits.call(void 0, sourceAmountStr, token.decimals);
|
|
2165
|
-
} catch (
|
|
2166
|
-
|
|
2551
|
+
} catch (e21) {
|
|
2552
|
+
_chunkFLVSQDP4cjs.debugLog.call(void 0, debug, "solana-amount", "amount:invalid", {
|
|
2167
2553
|
amount,
|
|
2168
2554
|
sourceAmount: sourceAmountStr,
|
|
2169
2555
|
reason: "parse-units-failed"
|
|
@@ -2173,7 +2559,7 @@ function SolanaAmountStep({
|
|
|
2173
2559
|
}
|
|
2174
2560
|
if (amountInUnits > spendableBalance) {
|
|
2175
2561
|
const isReserveIssue = isNativeSol(token) && amountInUnits <= balance;
|
|
2176
|
-
|
|
2562
|
+
_chunkFLVSQDP4cjs.debugLog.call(void 0, debug, "solana-amount", "amount:invalid", {
|
|
2177
2563
|
amount,
|
|
2178
2564
|
balance: balance.toString(),
|
|
2179
2565
|
spendableBalance: spendableBalance.toString(),
|
|
@@ -2185,7 +2571,7 @@ function SolanaAmountStep({
|
|
|
2185
2571
|
);
|
|
2186
2572
|
return;
|
|
2187
2573
|
}
|
|
2188
|
-
|
|
2574
|
+
_chunkFLVSQDP4cjs.debugLog.call(void 0, debug, "solana-amount", "amount:continue", {
|
|
2189
2575
|
symbol: token.symbol,
|
|
2190
2576
|
inputAmountUsd: amount,
|
|
2191
2577
|
sourceAmount: sourceAmountStr,
|
|
@@ -2253,8 +2639,8 @@ function SolanaAmountStep({
|
|
|
2253
2639
|
}
|
|
2254
2640
|
)
|
|
2255
2641
|
] }),
|
|
2256
|
-
_optionalChain([uiConfig, 'optionalAccess',
|
|
2257
|
-
|
|
2642
|
+
_optionalChain([uiConfig, 'optionalAccess', _77 => _77.minDepositUsd]) && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-amount-minimum", children: [
|
|
2643
|
+
_chunkFLVSQDP4cjs.currencyFormatter.format(uiConfig.minDepositUsd),
|
|
2258
2644
|
" minimum deposit"
|
|
2259
2645
|
] }),
|
|
2260
2646
|
error && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-amount-error", children: [
|
|
@@ -2280,15 +2666,15 @@ function SolanaAmountStep({
|
|
|
2280
2666
|
] })
|
|
2281
2667
|
] }),
|
|
2282
2668
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-step-footer", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2283
|
-
|
|
2669
|
+
_chunkFLVSQDP4cjs.Button,
|
|
2284
2670
|
{
|
|
2285
2671
|
onClick: handleContinue,
|
|
2286
2672
|
fullWidth: true,
|
|
2287
2673
|
disabled: !amount,
|
|
2288
|
-
children: _optionalChain([uiConfig, 'optionalAccess',
|
|
2674
|
+
children: _optionalChain([uiConfig, 'optionalAccess', _78 => _78.minDepositUsd]) && parseFloat(amount) > 0 && parseFloat(amount) < uiConfig.minDepositUsd ? "Update order" : "Continue"
|
|
2289
2675
|
}
|
|
2290
2676
|
) }),
|
|
2291
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2677
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFLVSQDP4cjs.PoweredBy, {})
|
|
2292
2678
|
] });
|
|
2293
2679
|
}
|
|
2294
2680
|
|
|
@@ -2315,7 +2701,7 @@ function SolanaConfirmStep({
|
|
|
2315
2701
|
}) {
|
|
2316
2702
|
const [isSubmitting, setIsSubmitting] = _react.useState.call(void 0, false);
|
|
2317
2703
|
const [error, setError] = _react.useState.call(void 0, null);
|
|
2318
|
-
const targetSymbol =
|
|
2704
|
+
const targetSymbol = _chunkMUWVDVY4cjs.getTokenSymbol.call(void 0, targetToken, targetChain);
|
|
2319
2705
|
const isSameToken = token.symbol.toUpperCase() === targetSymbol.toUpperCase();
|
|
2320
2706
|
const formattedAmount = sourceAmount && !Number.isNaN(Number(sourceAmount)) ? Number(sourceAmount).toLocaleString("en-US", { maximumFractionDigits: 6 }) : "0";
|
|
2321
2707
|
const formattedReceiveAmount = (() => {
|
|
@@ -2332,7 +2718,7 @@ function SolanaConfirmStep({
|
|
|
2332
2718
|
const receiveAmount = isSameToken ? formattedReceiveAmount : `~ ${formattedReceiveAmount}`;
|
|
2333
2719
|
const handleConfirm = async () => {
|
|
2334
2720
|
if (!solanaProvider) {
|
|
2335
|
-
|
|
2721
|
+
_chunkFLVSQDP4cjs.debugLog.call(void 0, debug, "solana-confirm", "submit:blocked", {
|
|
2336
2722
|
reason: "missing-provider"
|
|
2337
2723
|
});
|
|
2338
2724
|
setError("Solana wallet not connected");
|
|
@@ -2340,7 +2726,7 @@ function SolanaConfirmStep({
|
|
|
2340
2726
|
}
|
|
2341
2727
|
const parsedAmount = parseFloat(sourceAmount);
|
|
2342
2728
|
if (isNaN(parsedAmount) || parsedAmount <= 0) {
|
|
2343
|
-
|
|
2729
|
+
_chunkFLVSQDP4cjs.debugLog.call(void 0, debug, "solana-confirm", "submit:blocked", {
|
|
2344
2730
|
reason: "invalid-amount",
|
|
2345
2731
|
sourceAmount
|
|
2346
2732
|
});
|
|
@@ -2349,7 +2735,7 @@ function SolanaConfirmStep({
|
|
|
2349
2735
|
}
|
|
2350
2736
|
setError(null);
|
|
2351
2737
|
setIsSubmitting(true);
|
|
2352
|
-
|
|
2738
|
+
_chunkFLVSQDP4cjs.debugLog.call(void 0, debug, "solana-confirm", "submit:start", {
|
|
2353
2739
|
smartAccount,
|
|
2354
2740
|
solanaAddress,
|
|
2355
2741
|
solanaDepositAddress,
|
|
@@ -2359,7 +2745,7 @@ function SolanaConfirmStep({
|
|
|
2359
2745
|
});
|
|
2360
2746
|
try {
|
|
2361
2747
|
const check = await service.checkAccount(smartAccount);
|
|
2362
|
-
|
|
2748
|
+
_chunkFLVSQDP4cjs.debugLog.call(void 0, debug, "solana-confirm", "check:success", {
|
|
2363
2749
|
smartAccount,
|
|
2364
2750
|
isRegistered: check.isRegistered,
|
|
2365
2751
|
targetChain: check.targetChain,
|
|
@@ -2372,7 +2758,7 @@ function SolanaConfirmStep({
|
|
|
2372
2758
|
}
|
|
2373
2759
|
const connection = getSolanaConnection();
|
|
2374
2760
|
const amountUnits = _viem.parseUnits.call(void 0, sourceAmount, token.decimals);
|
|
2375
|
-
|
|
2761
|
+
_chunkFLVSQDP4cjs.debugLog.call(void 0, debug, "solana-confirm", "tx:build:start", {
|
|
2376
2762
|
token: token.symbol,
|
|
2377
2763
|
sourceAmount,
|
|
2378
2764
|
amountUnits: amountUnits.toString()
|
|
@@ -2389,10 +2775,10 @@ function SolanaConfirmStep({
|
|
|
2389
2775
|
token.mint,
|
|
2390
2776
|
amountUnits
|
|
2391
2777
|
);
|
|
2392
|
-
|
|
2778
|
+
_chunkFLVSQDP4cjs.debugLog.call(void 0, debug, "solana-confirm", "tx:build:success", {
|
|
2393
2779
|
token: token.symbol,
|
|
2394
2780
|
instructionCount: transaction.instructions.length,
|
|
2395
|
-
feePayer: _optionalChain([transaction, 'access',
|
|
2781
|
+
feePayer: _optionalChain([transaction, 'access', _79 => _79.feePayer, 'optionalAccess', _80 => _80.toBase58, 'call', _81 => _81()]),
|
|
2396
2782
|
recentBlockhash: transaction.recentBlockhash
|
|
2397
2783
|
});
|
|
2398
2784
|
const txHash = await sendSolanaTransaction(
|
|
@@ -2400,21 +2786,21 @@ function SolanaConfirmStep({
|
|
|
2400
2786
|
connection,
|
|
2401
2787
|
transaction
|
|
2402
2788
|
);
|
|
2403
|
-
|
|
2789
|
+
_chunkFLVSQDP4cjs.debugLog.call(void 0, debug, "solana-confirm", "tx:sent", {
|
|
2404
2790
|
txHash,
|
|
2405
2791
|
amountUnits: amountUnits.toString()
|
|
2406
2792
|
});
|
|
2407
2793
|
onConfirm(txHash, amountUnits.toString());
|
|
2408
2794
|
} catch (err) {
|
|
2409
2795
|
const raw = err instanceof Error ? err.message : "Transfer failed";
|
|
2410
|
-
const message =
|
|
2411
|
-
|
|
2796
|
+
const message = _chunkFLVSQDP4cjs.formatUserError.call(void 0, raw);
|
|
2797
|
+
_chunkFLVSQDP4cjs.debugError.call(void 0, debug, "solana-confirm", "submit:failure", err, {
|
|
2412
2798
|
smartAccount,
|
|
2413
2799
|
token: token.symbol,
|
|
2414
2800
|
sourceAmount
|
|
2415
2801
|
});
|
|
2416
2802
|
setError(message);
|
|
2417
|
-
_optionalChain([onError, 'optionalCall',
|
|
2803
|
+
_optionalChain([onError, 'optionalCall', _82 => _82(message, "SOLANA_TRANSFER_ERROR")]);
|
|
2418
2804
|
} finally {
|
|
2419
2805
|
setIsSubmitting(false);
|
|
2420
2806
|
}
|
|
@@ -2431,15 +2817,15 @@ function SolanaConfirmStep({
|
|
|
2431
2817
|
className: "rs-card-value",
|
|
2432
2818
|
style: { display: "flex", alignItems: "center", gap: 8 },
|
|
2433
2819
|
children: [
|
|
2434
|
-
|
|
2820
|
+
_chunkMUWVDVY4cjs.getChainIcon.call(void 0, "solana") && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2435
2821
|
"img",
|
|
2436
2822
|
{
|
|
2437
|
-
src:
|
|
2823
|
+
src: _chunkMUWVDVY4cjs.getChainIcon.call(void 0, "solana"),
|
|
2438
2824
|
alt: "",
|
|
2439
2825
|
style: { width: 16, height: 16, borderRadius: 3 }
|
|
2440
2826
|
}
|
|
2441
2827
|
),
|
|
2442
|
-
|
|
2828
|
+
_chunkMUWVDVY4cjs.getChainName.call(void 0, "solana")
|
|
2443
2829
|
]
|
|
2444
2830
|
}
|
|
2445
2831
|
)
|
|
@@ -2452,15 +2838,15 @@ function SolanaConfirmStep({
|
|
|
2452
2838
|
className: "rs-card-value",
|
|
2453
2839
|
style: { display: "flex", alignItems: "center", gap: 8 },
|
|
2454
2840
|
children: [
|
|
2455
|
-
|
|
2841
|
+
_chunkMUWVDVY4cjs.getChainIcon.call(void 0, targetChain) && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2456
2842
|
"img",
|
|
2457
2843
|
{
|
|
2458
|
-
src:
|
|
2844
|
+
src: _chunkMUWVDVY4cjs.getChainIcon.call(void 0, targetChain),
|
|
2459
2845
|
alt: "",
|
|
2460
2846
|
style: { width: 16, height: 16, borderRadius: 3 }
|
|
2461
2847
|
}
|
|
2462
2848
|
),
|
|
2463
|
-
|
|
2849
|
+
_chunkMUWVDVY4cjs.getChainName.call(void 0, targetChain)
|
|
2464
2850
|
]
|
|
2465
2851
|
}
|
|
2466
2852
|
)
|
|
@@ -2479,10 +2865,10 @@ function SolanaConfirmStep({
|
|
|
2479
2865
|
className: "rs-card-value",
|
|
2480
2866
|
style: { display: "flex", alignItems: "center", gap: 6 },
|
|
2481
2867
|
children: [
|
|
2482
|
-
|
|
2868
|
+
_chunkMUWVDVY4cjs.getTokenIcon.call(void 0, token.symbol) && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2483
2869
|
"img",
|
|
2484
2870
|
{
|
|
2485
|
-
src:
|
|
2871
|
+
src: _chunkMUWVDVY4cjs.getTokenIcon.call(void 0, token.symbol),
|
|
2486
2872
|
alt: "",
|
|
2487
2873
|
style: { width: 16, height: 16, borderRadius: "50%" }
|
|
2488
2874
|
}
|
|
@@ -2502,10 +2888,10 @@ function SolanaConfirmStep({
|
|
|
2502
2888
|
className: "rs-card-value",
|
|
2503
2889
|
style: { display: "flex", alignItems: "center", gap: 6 },
|
|
2504
2890
|
children: [
|
|
2505
|
-
|
|
2891
|
+
_chunkMUWVDVY4cjs.getTokenIcon.call(void 0, targetSymbol) && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2506
2892
|
"img",
|
|
2507
2893
|
{
|
|
2508
|
-
src:
|
|
2894
|
+
src: _chunkMUWVDVY4cjs.getTokenIcon.call(void 0, targetSymbol),
|
|
2509
2895
|
alt: "",
|
|
2510
2896
|
style: { width: 16, height: 16, borderRadius: "50%" }
|
|
2511
2897
|
}
|
|
@@ -2541,7 +2927,7 @@ function SolanaConfirmStep({
|
|
|
2541
2927
|
] })
|
|
2542
2928
|
] }),
|
|
2543
2929
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-step-footer", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2544
|
-
|
|
2930
|
+
_chunkFLVSQDP4cjs.Button,
|
|
2545
2931
|
{
|
|
2546
2932
|
onClick: handleConfirm,
|
|
2547
2933
|
loading: isSubmitting,
|
|
@@ -2550,14 +2936,14 @@ function SolanaConfirmStep({
|
|
|
2550
2936
|
children: "Confirm Order"
|
|
2551
2937
|
}
|
|
2552
2938
|
) }),
|
|
2553
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2939
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFLVSQDP4cjs.PoweredBy, {})
|
|
2554
2940
|
] });
|
|
2555
2941
|
}
|
|
2556
2942
|
|
|
2557
2943
|
// src/DepositFlow.tsx
|
|
2558
2944
|
|
|
2559
2945
|
var QR_AUTO_ADVANCE_HYDRATION_GRACE_MS = 1e3;
|
|
2560
|
-
function
|
|
2946
|
+
function isSameRoute2(sourceChain, sourceToken, targetChain, targetToken) {
|
|
2561
2947
|
return sourceChain === targetChain && sourceToken.toLowerCase() === targetToken.toLowerCase();
|
|
2562
2948
|
}
|
|
2563
2949
|
function getAddressKey(address) {
|
|
@@ -2576,7 +2962,9 @@ function DepositFlow({
|
|
|
2576
2962
|
amount: defaultAmount,
|
|
2577
2963
|
recipient,
|
|
2578
2964
|
postBridgeActions,
|
|
2579
|
-
|
|
2965
|
+
outputTokenRules,
|
|
2966
|
+
rejectUnmapped,
|
|
2967
|
+
signerAddress = _chunkMUWVDVY4cjs.DEFAULT_SIGNER_ADDRESS,
|
|
2580
2968
|
sessionChainIds,
|
|
2581
2969
|
forceRegister = false,
|
|
2582
2970
|
waitForFinalTx = true,
|
|
@@ -2600,12 +2988,16 @@ function DepositFlow({
|
|
|
2600
2988
|
onError,
|
|
2601
2989
|
debug
|
|
2602
2990
|
}) {
|
|
2603
|
-
const onStepChangeRef =
|
|
2604
|
-
const onTotalBalanceChangeRef =
|
|
2605
|
-
const onSmartAccountChangeRef =
|
|
2606
|
-
const onEventRef =
|
|
2991
|
+
const onStepChangeRef = _chunkFLVSQDP4cjs.useLatestRef.call(void 0, onStepChange);
|
|
2992
|
+
const onTotalBalanceChangeRef = _chunkFLVSQDP4cjs.useLatestRef.call(void 0, onTotalBalanceChange);
|
|
2993
|
+
const onSmartAccountChangeRef = _chunkFLVSQDP4cjs.useLatestRef.call(void 0, onSmartAccountChange);
|
|
2994
|
+
const onEventRef = _chunkFLVSQDP4cjs.useLatestRef.call(void 0, onEvent);
|
|
2995
|
+
const onDepositSubmittedRef = _chunkFLVSQDP4cjs.useLatestRef.call(void 0, onDepositSubmitted);
|
|
2996
|
+
const onDepositCompleteRef = _chunkFLVSQDP4cjs.useLatestRef.call(void 0, onDepositComplete);
|
|
2997
|
+
const onDepositFailedRef = _chunkFLVSQDP4cjs.useLatestRef.call(void 0, onDepositFailed);
|
|
2998
|
+
const onErrorRef = _chunkFLVSQDP4cjs.useLatestRef.call(void 0, onError);
|
|
2607
2999
|
const hasInitialReownSession = Boolean(
|
|
2608
|
-
enableSolana ? _optionalChain([reownWallet, 'optionalAccess',
|
|
3000
|
+
enableSolana ? _optionalChain([reownWallet, 'optionalAccess', _83 => _83.isConnected]) || _optionalChain([reownWallet, 'optionalAccess', _84 => _84.address]) : _optionalChain([reownWallet, 'optionalAccess', _85 => _85.address])
|
|
2609
3001
|
);
|
|
2610
3002
|
const hasInitialWalletHydrationPending = Boolean(
|
|
2611
3003
|
dappAddress && (hasDappWalletClientProp && dappWalletClient === void 0 || reownWallet && !hasInitialReownSession && !reownWallet.isReady)
|
|
@@ -2623,13 +3015,13 @@ function DepositFlow({
|
|
|
2623
3015
|
flowModeRef.current = flowMode;
|
|
2624
3016
|
const logFlow = _react.useCallback.call(void 0,
|
|
2625
3017
|
(message, data) => {
|
|
2626
|
-
|
|
3018
|
+
_chunkFLVSQDP4cjs.debugLog.call(void 0, debug, "deposit-flow", message, data);
|
|
2627
3019
|
},
|
|
2628
3020
|
[debug]
|
|
2629
3021
|
);
|
|
2630
3022
|
const logFlowError = _react.useCallback.call(void 0,
|
|
2631
3023
|
(message, error, data) => {
|
|
2632
|
-
|
|
3024
|
+
_chunkFLVSQDP4cjs.debugError.call(void 0, debug, "deposit-flow", message, error, data);
|
|
2633
3025
|
},
|
|
2634
3026
|
[debug]
|
|
2635
3027
|
);
|
|
@@ -2641,21 +3033,23 @@ function DepositFlow({
|
|
|
2641
3033
|
for (const asset of portfolioAssetsRef.current) {
|
|
2642
3034
|
if (asset.symbol.toLowerCase() === sym && asset.balanceUsd && asset.balance) {
|
|
2643
3035
|
try {
|
|
2644
|
-
const balanceUnits = Number(
|
|
3036
|
+
const balanceUnits = Number(
|
|
3037
|
+
_viem.formatUnits.call(void 0, BigInt(asset.balance), asset.decimals)
|
|
3038
|
+
);
|
|
2645
3039
|
if (balanceUnits > 0) return asset.balanceUsd / balanceUnits;
|
|
2646
|
-
} catch (
|
|
3040
|
+
} catch (e22) {
|
|
2647
3041
|
}
|
|
2648
3042
|
}
|
|
2649
3043
|
}
|
|
2650
3044
|
return null;
|
|
2651
3045
|
}, []);
|
|
2652
3046
|
const dappSwitchChain = _react.useMemo.call(void 0, () => {
|
|
2653
|
-
if (!_optionalChain([dappWalletClient, 'optionalAccess',
|
|
3047
|
+
if (!_optionalChain([dappWalletClient, 'optionalAccess', _86 => _86.switchChain])) return void 0;
|
|
2654
3048
|
return async (chainId) => {
|
|
2655
|
-
await _optionalChain([dappWalletClient, 'access',
|
|
3049
|
+
await _optionalChain([dappWalletClient, 'access', _87 => _87.switchChain, 'optionalCall', _88 => _88({ id: chainId })]);
|
|
2656
3050
|
};
|
|
2657
3051
|
}, [dappWalletClient]);
|
|
2658
|
-
const connectedWalletAddress = _nullishCoalesce(_optionalChain([dappWalletClient, 'optionalAccess',
|
|
3052
|
+
const connectedWalletAddress = _nullishCoalesce(_optionalChain([dappWalletClient, 'optionalAccess', _89 => _89.account, 'optionalAccess', _90 => _90.address]), () => ( null));
|
|
2659
3053
|
const walletOptions = _react.useMemo.call(void 0, () => {
|
|
2660
3054
|
const options = [];
|
|
2661
3055
|
const seen = /* @__PURE__ */ new Set();
|
|
@@ -2669,7 +3063,7 @@ function DepositFlow({
|
|
|
2669
3063
|
});
|
|
2670
3064
|
seen.add(id);
|
|
2671
3065
|
}
|
|
2672
|
-
if (enableSolana && _optionalChain([reownWallet, 'optionalAccess',
|
|
3066
|
+
if (enableSolana && _optionalChain([reownWallet, 'optionalAccess', _91 => _91.isConnected]) && reownWallet.isSolana && reownWallet.solanaAddress && dappAddress) {
|
|
2673
3067
|
const id = _nullishCoalesce(reownWallet.caipAddress, () => ( `solana:${reownWallet.solanaAddress}`));
|
|
2674
3068
|
if (!seen.has(id)) {
|
|
2675
3069
|
options.push({
|
|
@@ -2681,7 +3075,7 @@ function DepositFlow({
|
|
|
2681
3075
|
});
|
|
2682
3076
|
seen.add(id);
|
|
2683
3077
|
}
|
|
2684
|
-
} else if (_optionalChain([reownWallet, 'optionalAccess',
|
|
3078
|
+
} else if (_optionalChain([reownWallet, 'optionalAccess', _92 => _92.address]) && reownWallet.isConnected && reownWallet.walletClient && reownWallet.publicClient && !seen.has(`evm:${reownWallet.address.toLowerCase()}`)) {
|
|
2685
3079
|
const id = `evm:${reownWallet.address.toLowerCase()}`;
|
|
2686
3080
|
if (!seen.has(id)) {
|
|
2687
3081
|
options.push({
|
|
@@ -2698,20 +3092,20 @@ function DepositFlow({
|
|
|
2698
3092
|
}, [
|
|
2699
3093
|
connectedWalletAddress,
|
|
2700
3094
|
dappAddress,
|
|
2701
|
-
_optionalChain([reownWallet, 'optionalAccess',
|
|
2702
|
-
_optionalChain([reownWallet, 'optionalAccess',
|
|
2703
|
-
_optionalChain([reownWallet, 'optionalAccess',
|
|
2704
|
-
_optionalChain([reownWallet, 'optionalAccess',
|
|
2705
|
-
_optionalChain([reownWallet, 'optionalAccess',
|
|
3095
|
+
_optionalChain([reownWallet, 'optionalAccess', _93 => _93.address]),
|
|
3096
|
+
_optionalChain([reownWallet, 'optionalAccess', _94 => _94.isConnected]),
|
|
3097
|
+
_optionalChain([reownWallet, 'optionalAccess', _95 => _95.walletClient]),
|
|
3098
|
+
_optionalChain([reownWallet, 'optionalAccess', _96 => _96.publicClient]),
|
|
3099
|
+
_optionalChain([reownWallet, 'optionalAccess', _97 => _97.icon]),
|
|
2706
3100
|
enableSolana,
|
|
2707
|
-
_optionalChain([reownWallet, 'optionalAccess',
|
|
2708
|
-
_optionalChain([reownWallet, 'optionalAccess',
|
|
2709
|
-
_optionalChain([reownWallet, 'optionalAccess',
|
|
3101
|
+
_optionalChain([reownWallet, 'optionalAccess', _98 => _98.isSolana]),
|
|
3102
|
+
_optionalChain([reownWallet, 'optionalAccess', _99 => _99.solanaAddress]),
|
|
3103
|
+
_optionalChain([reownWallet, 'optionalAccess', _100 => _100.caipAddress])
|
|
2710
3104
|
]);
|
|
2711
|
-
const canAutoLock = _optionalChain([dappWalletClient, 'optionalAccess',
|
|
3105
|
+
const canAutoLock = _optionalChain([dappWalletClient, 'optionalAccess', _101 => _101.account]) && dappAddress && !reownWallet;
|
|
2712
3106
|
const hasWalletOptions = walletOptions.length > 0;
|
|
2713
3107
|
const hasReownSession = Boolean(
|
|
2714
|
-
enableSolana ? _optionalChain([reownWallet, 'optionalAccess',
|
|
3108
|
+
enableSolana ? _optionalChain([reownWallet, 'optionalAccess', _102 => _102.isConnected]) || _optionalChain([reownWallet, 'optionalAccess', _103 => _103.address]) : _optionalChain([reownWallet, 'optionalAccess', _104 => _104.address])
|
|
2715
3109
|
);
|
|
2716
3110
|
const isWalletHydrationPending = Boolean(
|
|
2717
3111
|
dappAddress && !hasWalletOptions && (hasDappWalletClientProp && dappWalletClient === void 0 || reownWallet && !hasReownSession && !reownWallet.isReady)
|
|
@@ -2751,16 +3145,16 @@ function DepositFlow({
|
|
|
2751
3145
|
return {
|
|
2752
3146
|
ownerAddress: dappAddress,
|
|
2753
3147
|
walletClient: void 0,
|
|
2754
|
-
publicClient: _nullishCoalesce(dappPublicClient, () => (
|
|
3148
|
+
publicClient: _nullishCoalesce(dappPublicClient, () => ( _chunkFLVSQDP4cjs.getPublicClient.call(void 0, targetChain))),
|
|
2755
3149
|
switchChain: void 0
|
|
2756
3150
|
};
|
|
2757
3151
|
}
|
|
2758
3152
|
if (canAutoLock) {
|
|
2759
|
-
const fallbackChainId = _nullishCoalesce(_optionalChain([dappWalletClient, 'optionalAccess',
|
|
3153
|
+
const fallbackChainId = _nullishCoalesce(_optionalChain([dappWalletClient, 'optionalAccess', _105 => _105.chain, 'optionalAccess', _106 => _106.id]), () => ( targetChain));
|
|
2760
3154
|
return {
|
|
2761
3155
|
ownerAddress: dappWalletClient.account.address,
|
|
2762
3156
|
walletClient: dappWalletClient,
|
|
2763
|
-
publicClient: _nullishCoalesce(dappPublicClient, () => (
|
|
3157
|
+
publicClient: _nullishCoalesce(dappPublicClient, () => ( _chunkFLVSQDP4cjs.getPublicClient.call(void 0, fallbackChainId))),
|
|
2764
3158
|
switchChain: dappSwitchChain
|
|
2765
3159
|
};
|
|
2766
3160
|
}
|
|
@@ -2774,24 +3168,24 @@ function DepositFlow({
|
|
|
2774
3168
|
return {
|
|
2775
3169
|
ownerAddress: dappAddress,
|
|
2776
3170
|
walletClient: void 0,
|
|
2777
|
-
publicClient: _nullishCoalesce(dappPublicClient, () => (
|
|
3171
|
+
publicClient: _nullishCoalesce(dappPublicClient, () => ( _chunkFLVSQDP4cjs.getPublicClient.call(void 0, targetChain))),
|
|
2778
3172
|
switchChain: void 0
|
|
2779
3173
|
};
|
|
2780
3174
|
}
|
|
2781
|
-
if (selectedOption.kind === "connected" && _optionalChain([dappWalletClient, 'optionalAccess',
|
|
2782
|
-
const fallbackChainId = _nullishCoalesce(_optionalChain([dappWalletClient, 'optionalAccess',
|
|
3175
|
+
if (selectedOption.kind === "connected" && _optionalChain([dappWalletClient, 'optionalAccess', _107 => _107.account]) && selectedOption.address && dappWalletClient.account.address.toLowerCase() === selectedOption.address.toLowerCase()) {
|
|
3176
|
+
const fallbackChainId = _nullishCoalesce(_optionalChain([dappWalletClient, 'optionalAccess', _108 => _108.chain, 'optionalAccess', _109 => _109.id]), () => ( targetChain));
|
|
2783
3177
|
return {
|
|
2784
3178
|
ownerAddress: dappWalletClient.account.address,
|
|
2785
3179
|
walletClient: dappWalletClient,
|
|
2786
|
-
publicClient: _nullishCoalesce(dappPublicClient, () => (
|
|
3180
|
+
publicClient: _nullishCoalesce(dappPublicClient, () => ( _chunkFLVSQDP4cjs.getPublicClient.call(void 0, fallbackChainId))),
|
|
2787
3181
|
switchChain: dappSwitchChain
|
|
2788
3182
|
};
|
|
2789
3183
|
}
|
|
2790
|
-
if (selectedOption.kind === "external" && _optionalChain([reownWallet, 'optionalAccess',
|
|
3184
|
+
if (selectedOption.kind === "external" && _optionalChain([reownWallet, 'optionalAccess', _110 => _110.address]) && selectedOption.address && reownWallet.address.toLowerCase() === selectedOption.address.toLowerCase()) {
|
|
2791
3185
|
return {
|
|
2792
3186
|
ownerAddress: reownWallet.address,
|
|
2793
3187
|
walletClient: reownWallet.walletClient,
|
|
2794
|
-
publicClient: _nullishCoalesce(reownWallet.publicClient, () => (
|
|
3188
|
+
publicClient: _nullishCoalesce(reownWallet.publicClient, () => ( _chunkFLVSQDP4cjs.getPublicClient.call(void 0, targetChain))),
|
|
2795
3189
|
switchChain: reownWallet.switchChain
|
|
2796
3190
|
};
|
|
2797
3191
|
}
|
|
@@ -2829,7 +3223,7 @@ function DepositFlow({
|
|
|
2829
3223
|
return {
|
|
2830
3224
|
ownerAddress: dappAddress,
|
|
2831
3225
|
walletClient: void 0,
|
|
2832
|
-
publicClient: _nullishCoalesce(dappPublicClient, () => (
|
|
3226
|
+
publicClient: _nullishCoalesce(dappPublicClient, () => ( _chunkFLVSQDP4cjs.getPublicClient.call(void 0, targetChain))),
|
|
2833
3227
|
switchChain: void 0
|
|
2834
3228
|
};
|
|
2835
3229
|
}
|
|
@@ -2851,7 +3245,7 @@ function DepositFlow({
|
|
|
2851
3245
|
walletSignerContext,
|
|
2852
3246
|
walletSelectionKey
|
|
2853
3247
|
]);
|
|
2854
|
-
const sessionKeyAddress = _nullishCoalesce(_nullishCoalesce(dappAddress, () => ( _optionalChain([signerContext, 'optionalAccess',
|
|
3248
|
+
const sessionKeyAddress = _nullishCoalesce(_nullishCoalesce(dappAddress, () => ( _optionalChain([signerContext, 'optionalAccess', _111 => _111.ownerAddress]))), () => ( null));
|
|
2855
3249
|
const lastTargetRef = _react.useRef.call(void 0, null);
|
|
2856
3250
|
_react.useEffect.call(void 0, () => {
|
|
2857
3251
|
const prev = lastTargetRef.current;
|
|
@@ -2928,7 +3322,7 @@ function DepositFlow({
|
|
|
2928
3322
|
const stepIndex = step.type === "setup" ? 0 : step.type === "deposit-address" ? 1 : step.type === "select-asset" ? 1 : step.type === "solana-token-select" ? 1 : step.type === "solana-amount" ? 2 : step.type === "amount" ? 2 : step.type === "confirm" ? 3 : step.type === "solana-confirm" ? 3 : 4;
|
|
2929
3323
|
const currentBackHandler = step.type === "deposit-address" ? handleBackFromDepositAddress : step.type === "select-asset" && signerContext && !canAutoLock ? handleBackFromSelectAsset : step.type === "solana-token-select" ? handleBackFromSolanaTokenSelect : step.type === "solana-amount" ? handleBackFromSolanaAmount : step.type === "solana-confirm" ? handleBackFromSolanaConfirm : step.type === "amount" ? handleBackFromAmount : step.type === "confirm" ? handleBackFromConfirm : void 0;
|
|
2930
3324
|
_react.useEffect.call(void 0, () => {
|
|
2931
|
-
_optionalChain([onStepChangeRef, 'access',
|
|
3325
|
+
_optionalChain([onStepChangeRef, 'access', _112 => _112.current, 'optionalCall', _113 => _113(stepIndex, currentBackHandler)]);
|
|
2932
3326
|
}, [stepIndex, currentBackHandler, onStepChangeRef]);
|
|
2933
3327
|
const stepSendToken = step.type === "amount" ? step.asset.symbol : null;
|
|
2934
3328
|
const stepOpenEventKey = step.type === "select-asset" ? "select-asset" : step.type === "deposit-address" ? "deposit-address" : step.type === "amount" && stepSendToken ? `amount:${stepSendToken.toLowerCase()}` : null;
|
|
@@ -2943,23 +3337,23 @@ function DepositFlow({
|
|
|
2943
3337
|
}
|
|
2944
3338
|
lastStepOpenEventKeyRef.current = stepOpenEventKey;
|
|
2945
3339
|
if (step.type === "select-asset") {
|
|
2946
|
-
_optionalChain([onEventRef, 'access',
|
|
3340
|
+
_optionalChain([onEventRef, 'access', _114 => _114.current, 'optionalCall', _115 => _115({
|
|
2947
3341
|
type: "deposit_modal_connected_wallet_select_source_open",
|
|
2948
3342
|
total_balance_in_external_wallet: totalBalanceUsd,
|
|
2949
3343
|
pred_balance: totalBalanceUsd
|
|
2950
3344
|
})]);
|
|
2951
3345
|
} else if (step.type === "deposit-address") {
|
|
2952
|
-
const chainName =
|
|
2953
|
-
const tokenSymbol =
|
|
2954
|
-
_optionalChain([onEventRef, 'access',
|
|
3346
|
+
const chainName = _chunkMUWVDVY4cjs.getChainName.call(void 0, targetChain);
|
|
3347
|
+
const tokenSymbol = _chunkMUWVDVY4cjs.getTokenSymbol.call(void 0, targetToken, targetChain);
|
|
3348
|
+
_optionalChain([onEventRef, 'access', _116 => _116.current, 'optionalCall', _117 => _117({
|
|
2955
3349
|
type: "deposit_modal_transfer_crypto_open",
|
|
2956
3350
|
default_chain: chainName,
|
|
2957
3351
|
default_token: tokenSymbol,
|
|
2958
3352
|
pred_balance: totalBalanceUsd
|
|
2959
3353
|
})]);
|
|
2960
3354
|
} else if (step.type === "amount" && stepSendToken) {
|
|
2961
|
-
const receiveSymbol =
|
|
2962
|
-
_optionalChain([onEventRef, 'access',
|
|
3355
|
+
const receiveSymbol = _chunkMUWVDVY4cjs.getTokenSymbol.call(void 0, targetToken, targetChain);
|
|
3356
|
+
_optionalChain([onEventRef, 'access', _118 => _118.current, 'optionalCall', _119 => _119({
|
|
2963
3357
|
type: "deposit_modal_connected_wallet_enter_value_open",
|
|
2964
3358
|
send_token: stepSendToken,
|
|
2965
3359
|
receive_token: receiveSymbol,
|
|
@@ -2992,7 +3386,7 @@ function DepositFlow({
|
|
|
2992
3386
|
targetToken
|
|
2993
3387
|
]);
|
|
2994
3388
|
_react.useEffect.call(void 0, () => {
|
|
2995
|
-
_optionalChain([onTotalBalanceChangeRef, 'access',
|
|
3389
|
+
_optionalChain([onTotalBalanceChangeRef, 'access', _120 => _120.current, 'optionalCall', _121 => _121(totalBalanceUsd)]);
|
|
2996
3390
|
}, [totalBalanceUsd, onTotalBalanceChangeRef]);
|
|
2997
3391
|
const isDepositAddressMode = flowMode === "deposit-address";
|
|
2998
3392
|
const isSolanaWalletMode = flowMode === "solana-wallet";
|
|
@@ -3007,7 +3401,7 @@ function DepositFlow({
|
|
|
3007
3401
|
setStep({ type: "setup" });
|
|
3008
3402
|
}, []);
|
|
3009
3403
|
const handleNewDeposit = _react.useCallback.call(void 0, () => {
|
|
3010
|
-
_optionalChain([onSmartAccountChangeRef, 'access',
|
|
3404
|
+
_optionalChain([onSmartAccountChangeRef, 'access', _122 => _122.current, 'optionalCall', _123 => _123(null)]);
|
|
3011
3405
|
setFlowMode(null);
|
|
3012
3406
|
setStep({ type: "setup" });
|
|
3013
3407
|
setIsConnectSelectionConfirmed(false);
|
|
@@ -3021,7 +3415,7 @@ function DepositFlow({
|
|
|
3021
3415
|
hasSolanaDepositAddress: Boolean(solanaDepositAddress),
|
|
3022
3416
|
flowMode: isDepositAddressMode ? "deposit-address" : isSolanaWalletMode ? "solana-wallet" : "wallet"
|
|
3023
3417
|
});
|
|
3024
|
-
_optionalChain([onSmartAccountChangeRef, 'access',
|
|
3418
|
+
_optionalChain([onSmartAccountChangeRef, 'access', _124 => _124.current, 'optionalCall', _125 => _125(smartAccount)]);
|
|
3025
3419
|
if (isDepositAddressMode) {
|
|
3026
3420
|
setStep({
|
|
3027
3421
|
type: "deposit-address",
|
|
@@ -3036,7 +3430,7 @@ function DepositFlow({
|
|
|
3036
3430
|
solanaDepositAddress
|
|
3037
3431
|
});
|
|
3038
3432
|
} else {
|
|
3039
|
-
_optionalChain([onError, 'optionalCall',
|
|
3433
|
+
_optionalChain([onError, 'optionalCall', _126 => _126({
|
|
3040
3434
|
message: "Solana deposit address not available. Please try again.",
|
|
3041
3435
|
code: "SOLANA_SETUP_FAILED"
|
|
3042
3436
|
})]);
|
|
@@ -3047,33 +3441,16 @@ function DepositFlow({
|
|
|
3047
3441
|
},
|
|
3048
3442
|
[isDepositAddressMode, isSolanaWalletMode, logFlow, onSmartAccountChangeRef]
|
|
3049
3443
|
);
|
|
3050
|
-
const
|
|
3051
|
-
(
|
|
3444
|
+
const handleDepositAddressSubmitted = _react.useCallback.call(void 0,
|
|
3445
|
+
(data) => {
|
|
3052
3446
|
logFlow("deposit-address:detected", {
|
|
3053
|
-
txHash,
|
|
3054
|
-
sourceChain:
|
|
3055
|
-
|
|
3056
|
-
amount
|
|
3057
|
-
});
|
|
3058
|
-
setStep((prev) => {
|
|
3059
|
-
if (prev.type !== "deposit-address") return prev;
|
|
3060
|
-
const isEvmToken = /^0x[a-fA-F0-9]{40}$/.test(token);
|
|
3061
|
-
const directTransfer = typeof chainId === "number" && isEvmToken && isSameRoute(chainId, token, targetChain, targetToken);
|
|
3062
|
-
return {
|
|
3063
|
-
type: "processing",
|
|
3064
|
-
smartAccount: prev.smartAccount,
|
|
3065
|
-
txHash,
|
|
3066
|
-
sourceChain: chainId,
|
|
3067
|
-
sourceToken: token,
|
|
3068
|
-
amount,
|
|
3069
|
-
sourceSymbol,
|
|
3070
|
-
sourceDecimals,
|
|
3071
|
-
directTransfer
|
|
3072
|
-
};
|
|
3447
|
+
txHash: data.txHash,
|
|
3448
|
+
sourceChain: data.sourceChain,
|
|
3449
|
+
amount: data.amount
|
|
3073
3450
|
});
|
|
3074
|
-
_optionalChain([
|
|
3451
|
+
_optionalChain([onDepositSubmittedRef, 'access', _127 => _127.current, 'optionalCall', _128 => _128(data)]);
|
|
3075
3452
|
},
|
|
3076
|
-
[
|
|
3453
|
+
[logFlow, onDepositSubmittedRef]
|
|
3077
3454
|
);
|
|
3078
3455
|
const handleSolanaTokenContinue = _react.useCallback.call(void 0,
|
|
3079
3456
|
(token, balance, balanceUsd) => {
|
|
@@ -3095,8 +3472,8 @@ function DepositFlow({
|
|
|
3095
3472
|
);
|
|
3096
3473
|
const handleSolanaAmountContinue = _react.useCallback.call(void 0,
|
|
3097
3474
|
(token, sourceAmount, inputAmountUsd) => {
|
|
3098
|
-
const targetSym =
|
|
3099
|
-
const isTargetStable =
|
|
3475
|
+
const targetSym = _chunkMUWVDVY4cjs.getTokenSymbol.call(void 0, targetToken, targetChain);
|
|
3476
|
+
const isTargetStable = _chunkMUWVDVY4cjs.isStablecoinSymbol.call(void 0, targetSym);
|
|
3100
3477
|
const targetTokenPriceUsd = isTargetStable ? 1 : getTokenPriceUsd(targetSym);
|
|
3101
3478
|
logFlow("solana:amount:continue", {
|
|
3102
3479
|
token: token.symbol,
|
|
@@ -3143,7 +3520,7 @@ function DepositFlow({
|
|
|
3143
3520
|
sourceDecimals: prev.token.decimals
|
|
3144
3521
|
};
|
|
3145
3522
|
});
|
|
3146
|
-
_optionalChain([onDepositSubmitted, 'optionalCall',
|
|
3523
|
+
_optionalChain([onDepositSubmitted, 'optionalCall', _129 => _129({
|
|
3147
3524
|
txHash,
|
|
3148
3525
|
sourceChain: "solana",
|
|
3149
3526
|
amount: amountUnits
|
|
@@ -3153,13 +3530,13 @@ function DepositFlow({
|
|
|
3153
3530
|
);
|
|
3154
3531
|
const handleConnected = _react.useCallback.call(void 0,
|
|
3155
3532
|
(addr, smartAccount) => {
|
|
3156
|
-
_optionalChain([onConnected, 'optionalCall',
|
|
3533
|
+
_optionalChain([onConnected, 'optionalCall', _130 => _130({ address: addr, smartAccount })]);
|
|
3157
3534
|
},
|
|
3158
3535
|
[onConnected]
|
|
3159
3536
|
);
|
|
3160
3537
|
const handleAssetContinue = _react.useCallback.call(void 0,
|
|
3161
3538
|
(asset) => {
|
|
3162
|
-
_optionalChain([onEvent, 'optionalCall',
|
|
3539
|
+
_optionalChain([onEvent, 'optionalCall', _131 => _131({
|
|
3163
3540
|
type: "deposit_modal_connected_wallet_select_source_cta_click",
|
|
3164
3541
|
total_balance_in_external_wallet: totalBalanceUsd,
|
|
3165
3542
|
pred_balance: totalBalanceUsd,
|
|
@@ -3181,8 +3558,8 @@ function DepositFlow({
|
|
|
3181
3558
|
);
|
|
3182
3559
|
const handleAmountContinue = _react.useCallback.call(void 0,
|
|
3183
3560
|
(amount, targetAmount, balance) => {
|
|
3184
|
-
const targetSym =
|
|
3185
|
-
const isTargetStable =
|
|
3561
|
+
const targetSym = _chunkMUWVDVY4cjs.getTokenSymbol.call(void 0, targetToken, targetChain);
|
|
3562
|
+
const isTargetStable = _chunkMUWVDVY4cjs.isStablecoinSymbol.call(void 0, targetSym);
|
|
3186
3563
|
const targetTokenPriceUsd = isTargetStable ? 1 : getTokenPriceUsd(targetSym);
|
|
3187
3564
|
setStep((prev) => {
|
|
3188
3565
|
if (prev.type !== "amount") return prev;
|
|
@@ -3216,7 +3593,7 @@ function DepositFlow({
|
|
|
3216
3593
|
sourceChain: chainId,
|
|
3217
3594
|
sourceToken: token,
|
|
3218
3595
|
amount,
|
|
3219
|
-
directTransfer:
|
|
3596
|
+
directTransfer: isSameRoute2(chainId, token, targetChain, targetToken)
|
|
3220
3597
|
};
|
|
3221
3598
|
});
|
|
3222
3599
|
},
|
|
@@ -3224,30 +3601,30 @@ function DepositFlow({
|
|
|
3224
3601
|
);
|
|
3225
3602
|
const handleDepositSubmittedCallback = _react.useCallback.call(void 0,
|
|
3226
3603
|
(txHash, sourceChain, amount) => {
|
|
3227
|
-
_optionalChain([
|
|
3604
|
+
_optionalChain([onDepositSubmittedRef, 'access', _132 => _132.current, 'optionalCall', _133 => _133({ txHash, sourceChain, amount })]);
|
|
3228
3605
|
},
|
|
3229
|
-
[
|
|
3606
|
+
[onDepositSubmittedRef]
|
|
3230
3607
|
);
|
|
3231
3608
|
const handleDepositComplete = _react.useCallback.call(void 0,
|
|
3232
3609
|
(txHash, destinationTxHash, context) => {
|
|
3233
3610
|
logFlow("deposit:complete", { txHash, destinationTxHash, ...context });
|
|
3234
|
-
_optionalChain([
|
|
3611
|
+
_optionalChain([onDepositCompleteRef, 'access', _134 => _134.current, 'optionalCall', _135 => _135({ txHash, destinationTxHash, ...context })]);
|
|
3235
3612
|
},
|
|
3236
|
-
[logFlow,
|
|
3613
|
+
[logFlow, onDepositCompleteRef]
|
|
3237
3614
|
);
|
|
3238
3615
|
const handleDepositFailed = _react.useCallback.call(void 0,
|
|
3239
3616
|
(txHash, error) => {
|
|
3240
3617
|
logFlowError("deposit:failed", error, { txHash });
|
|
3241
|
-
_optionalChain([
|
|
3618
|
+
_optionalChain([onDepositFailedRef, 'access', _136 => _136.current, 'optionalCall', _137 => _137({ txHash, error })]);
|
|
3242
3619
|
},
|
|
3243
|
-
[logFlowError,
|
|
3620
|
+
[logFlowError, onDepositFailedRef]
|
|
3244
3621
|
);
|
|
3245
3622
|
const handleError = _react.useCallback.call(void 0,
|
|
3246
3623
|
(message, code) => {
|
|
3247
3624
|
logFlowError("flow:error", message, { code });
|
|
3248
|
-
_optionalChain([
|
|
3625
|
+
_optionalChain([onErrorRef, 'access', _138 => _138.current, 'optionalCall', _139 => _139({ message, code })]);
|
|
3249
3626
|
},
|
|
3250
|
-
[logFlowError,
|
|
3627
|
+
[logFlowError, onErrorRef]
|
|
3251
3628
|
);
|
|
3252
3629
|
const handleTotalBalanceComputed = _react.useCallback.call(void 0, (total) => {
|
|
3253
3630
|
setTotalBalanceUsd(total);
|
|
@@ -3302,7 +3679,7 @@ function DepositFlow({
|
|
|
3302
3679
|
if (walletId) {
|
|
3303
3680
|
const selectedOption = walletOptions.find((o) => o.id === walletId);
|
|
3304
3681
|
setSelectedWalletId(walletId);
|
|
3305
|
-
if (enableSolana && _optionalChain([selectedOption, 'optionalAccess',
|
|
3682
|
+
if (enableSolana && _optionalChain([selectedOption, 'optionalAccess', _140 => _140.kind]) === "solana") {
|
|
3306
3683
|
handleSelectSolanaWallet();
|
|
3307
3684
|
} else {
|
|
3308
3685
|
handleSelectProvider();
|
|
@@ -3332,7 +3709,7 @@ function DepositFlow({
|
|
|
3332
3709
|
]);
|
|
3333
3710
|
if (showConnectStep) {
|
|
3334
3711
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-modal-body", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3335
|
-
|
|
3712
|
+
_chunkFLVSQDP4cjs.ConnectStep,
|
|
3336
3713
|
{
|
|
3337
3714
|
walletOptions,
|
|
3338
3715
|
selectedWalletId: selectedWalletIdEffective,
|
|
@@ -3351,7 +3728,7 @@ function DepositFlow({
|
|
|
3351
3728
|
const selectedOption = walletOptions.find(
|
|
3352
3729
|
(o) => o.id === selectedWalletIdEffective
|
|
3353
3730
|
);
|
|
3354
|
-
if (enableSolana && _optionalChain([selectedOption, 'optionalAccess',
|
|
3731
|
+
if (enableSolana && _optionalChain([selectedOption, 'optionalAccess', _141 => _141.kind]) === "solana") {
|
|
3355
3732
|
handleSelectSolanaWallet();
|
|
3356
3733
|
} else {
|
|
3357
3734
|
handleSelectProvider();
|
|
@@ -3375,6 +3752,8 @@ function DepositFlow({
|
|
|
3375
3752
|
sessionChainIds,
|
|
3376
3753
|
recipient,
|
|
3377
3754
|
postBridgeActions,
|
|
3755
|
+
outputTokenRules,
|
|
3756
|
+
rejectUnmapped,
|
|
3378
3757
|
forceRegister,
|
|
3379
3758
|
enableSolana,
|
|
3380
3759
|
service,
|
|
@@ -3390,11 +3769,17 @@ function DepositFlow({
|
|
|
3390
3769
|
solanaDepositAddress: enableSolana ? step.solanaDepositAddress : void 0,
|
|
3391
3770
|
service,
|
|
3392
3771
|
allowedRoutes,
|
|
3393
|
-
|
|
3772
|
+
targetChain,
|
|
3773
|
+
targetToken,
|
|
3774
|
+
waitForFinalTx,
|
|
3775
|
+
hasPostBridgeActions: Boolean(_optionalChain([postBridgeActions, 'optionalAccess', _142 => _142.length])),
|
|
3776
|
+
onDepositSubmitted: handleDepositAddressSubmitted,
|
|
3777
|
+
onDepositComplete: handleDepositComplete,
|
|
3778
|
+
onDepositFailed: handleDepositFailed,
|
|
3394
3779
|
onCopyAddress: () => {
|
|
3395
|
-
const chainName =
|
|
3396
|
-
const tokenSymbol =
|
|
3397
|
-
_optionalChain([onEvent, 'optionalCall',
|
|
3780
|
+
const chainName = _chunkMUWVDVY4cjs.getChainName.call(void 0, targetChain);
|
|
3781
|
+
const tokenSymbol = _chunkMUWVDVY4cjs.getTokenSymbol.call(void 0, targetToken, targetChain);
|
|
3782
|
+
_optionalChain([onEvent, 'optionalCall', _143 => _143({
|
|
3398
3783
|
type: "deposit_modal_transfer_crypto_cta_click",
|
|
3399
3784
|
default_chain: chainName,
|
|
3400
3785
|
default_token: tokenSymbol,
|
|
@@ -3402,29 +3787,6 @@ function DepositFlow({
|
|
|
3402
3787
|
cta_name: "copy"
|
|
3403
3788
|
})]);
|
|
3404
3789
|
},
|
|
3405
|
-
onError: handleError
|
|
3406
|
-
}
|
|
3407
|
-
),
|
|
3408
|
-
step.type === "processing" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3409
|
-
_chunkJZWCK7C3cjs.ProcessingStep,
|
|
3410
|
-
{
|
|
3411
|
-
smartAccount: step.smartAccount,
|
|
3412
|
-
txHash: step.txHash,
|
|
3413
|
-
sourceChain: step.sourceChain,
|
|
3414
|
-
sourceToken: step.sourceToken,
|
|
3415
|
-
targetChain,
|
|
3416
|
-
targetToken,
|
|
3417
|
-
amount: step.amount,
|
|
3418
|
-
sourceSymbol: step.sourceSymbol,
|
|
3419
|
-
sourceDecimals: step.sourceDecimals,
|
|
3420
|
-
waitForFinalTx,
|
|
3421
|
-
hasPostBridgeActions: Boolean(_optionalChain([postBridgeActions, 'optionalAccess', _111 => _111.length])),
|
|
3422
|
-
service,
|
|
3423
|
-
directTransfer: step.directTransfer,
|
|
3424
|
-
onClose,
|
|
3425
|
-
onNewDeposit: handleNewDeposit,
|
|
3426
|
-
onDepositComplete: handleDepositComplete,
|
|
3427
|
-
onDepositFailed: handleDepositFailed,
|
|
3428
3790
|
onError: handleError,
|
|
3429
3791
|
debug
|
|
3430
3792
|
}
|
|
@@ -3433,8 +3795,8 @@ function DepositFlow({
|
|
|
3433
3795
|
}
|
|
3434
3796
|
if (isSolanaWalletMode) {
|
|
3435
3797
|
if (!sessionKeyAddress) return null;
|
|
3436
|
-
const solanaAddr = _optionalChain([reownWallet, 'optionalAccess',
|
|
3437
|
-
const solanaProvider = _optionalChain([reownWallet, 'optionalAccess',
|
|
3798
|
+
const solanaAddr = _optionalChain([reownWallet, 'optionalAccess', _144 => _144.solanaAddress]);
|
|
3799
|
+
const solanaProvider = _optionalChain([reownWallet, 'optionalAccess', _145 => _145.solanaProvider]);
|
|
3438
3800
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-modal-body", children: [
|
|
3439
3801
|
step.type === "setup" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3440
3802
|
SetupStep,
|
|
@@ -3446,6 +3808,8 @@ function DepositFlow({
|
|
|
3446
3808
|
sessionChainIds,
|
|
3447
3809
|
recipient,
|
|
3448
3810
|
postBridgeActions,
|
|
3811
|
+
outputTokenRules,
|
|
3812
|
+
rejectUnmapped,
|
|
3449
3813
|
forceRegister,
|
|
3450
3814
|
enableSolana,
|
|
3451
3815
|
service,
|
|
@@ -3530,7 +3894,7 @@ function DepositFlow({
|
|
|
3530
3894
|
) })
|
|
3531
3895
|
] }) : null,
|
|
3532
3896
|
step.type === "processing" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3533
|
-
|
|
3897
|
+
_chunkFLVSQDP4cjs.ProcessingStep,
|
|
3534
3898
|
{
|
|
3535
3899
|
smartAccount: step.smartAccount,
|
|
3536
3900
|
txHash: step.txHash,
|
|
@@ -3542,7 +3906,7 @@ function DepositFlow({
|
|
|
3542
3906
|
sourceSymbol: step.sourceSymbol,
|
|
3543
3907
|
sourceDecimals: step.sourceDecimals,
|
|
3544
3908
|
waitForFinalTx,
|
|
3545
|
-
hasPostBridgeActions: Boolean(_optionalChain([postBridgeActions, 'optionalAccess',
|
|
3909
|
+
hasPostBridgeActions: Boolean(_optionalChain([postBridgeActions, 'optionalAccess', _146 => _146.length])),
|
|
3546
3910
|
service,
|
|
3547
3911
|
directTransfer: step.directTransfer,
|
|
3548
3912
|
onClose,
|
|
@@ -3555,16 +3919,16 @@ function DepositFlow({
|
|
|
3555
3919
|
)
|
|
3556
3920
|
] });
|
|
3557
3921
|
}
|
|
3558
|
-
if (!_optionalChain([signerContext, 'optionalAccess',
|
|
3922
|
+
if (!_optionalChain([signerContext, 'optionalAccess', _147 => _147.walletClient]) || !_optionalChain([signerContext, 'optionalAccess', _148 => _148.publicClient])) {
|
|
3559
3923
|
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..." }) }) }) }) });
|
|
3560
3924
|
}
|
|
3561
3925
|
const ownerAddress = signerContext.ownerAddress;
|
|
3562
|
-
const ownerChainId = _nullishCoalesce(_nullishCoalesce(_optionalChain([signerContext, 'access',
|
|
3926
|
+
const ownerChainId = _nullishCoalesce(_nullishCoalesce(_optionalChain([signerContext, 'access', _149 => _149.walletClient, 'optionalAccess', _150 => _150.chain, 'optionalAccess', _151 => _151.id]), () => ( _optionalChain([signerContext, 'access', _152 => _152.publicClient, 'access', _153 => _153.chain, 'optionalAccess', _154 => _154.id]))), () => ( targetChain));
|
|
3563
3927
|
const getReadClientForChain = (chainId) => {
|
|
3564
|
-
if (_optionalChain([signerContext, 'access',
|
|
3928
|
+
if (_optionalChain([signerContext, 'access', _155 => _155.publicClient, 'access', _156 => _156.chain, 'optionalAccess', _157 => _157.id]) === chainId) {
|
|
3565
3929
|
return signerContext.publicClient;
|
|
3566
3930
|
}
|
|
3567
|
-
return
|
|
3931
|
+
return _chunkFLVSQDP4cjs.getPublicClient.call(void 0, chainId);
|
|
3568
3932
|
};
|
|
3569
3933
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-modal-body", children: [
|
|
3570
3934
|
step.type === "setup" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
@@ -3578,6 +3942,8 @@ function DepositFlow({
|
|
|
3578
3942
|
sessionChainIds,
|
|
3579
3943
|
recipient,
|
|
3580
3944
|
postBridgeActions,
|
|
3945
|
+
outputTokenRules,
|
|
3946
|
+
rejectUnmapped,
|
|
3581
3947
|
forceRegister,
|
|
3582
3948
|
enableSolana,
|
|
3583
3949
|
service,
|
|
@@ -3597,7 +3963,11 @@ function DepositFlow({
|
|
|
3597
3963
|
service,
|
|
3598
3964
|
onContinue: handleAssetContinue,
|
|
3599
3965
|
onTotalBalanceComputed: handleTotalBalanceComputed,
|
|
3600
|
-
onAssetsLoaded: handleAssetsLoaded
|
|
3966
|
+
onAssetsLoaded: handleAssetsLoaded,
|
|
3967
|
+
onDisconnect: onDisconnect ? () => {
|
|
3968
|
+
onDisconnect();
|
|
3969
|
+
handleBackFromSelectAsset();
|
|
3970
|
+
} : void 0
|
|
3601
3971
|
}
|
|
3602
3972
|
),
|
|
3603
3973
|
step.type === "amount" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
@@ -3614,8 +3984,8 @@ function DepositFlow({
|
|
|
3614
3984
|
uiConfig,
|
|
3615
3985
|
onContinue: handleAmountContinue,
|
|
3616
3986
|
onCtaClick: (ctaName) => {
|
|
3617
|
-
const receiveSymbol =
|
|
3618
|
-
_optionalChain([onEvent, 'optionalCall',
|
|
3987
|
+
const receiveSymbol = _chunkMUWVDVY4cjs.getTokenSymbol.call(void 0, targetToken, targetChain);
|
|
3988
|
+
_optionalChain([onEvent, 'optionalCall', _158 => _158({
|
|
3619
3989
|
type: "deposit_modal_connected_wallet_enter_value_cta_click",
|
|
3620
3990
|
send_token: step.asset.symbol,
|
|
3621
3991
|
receive_token: receiveSymbol,
|
|
@@ -3646,7 +4016,7 @@ function DepositFlow({
|
|
|
3646
4016
|
}
|
|
3647
4017
|
),
|
|
3648
4018
|
step.type === "processing" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3649
|
-
|
|
4019
|
+
_chunkFLVSQDP4cjs.ProcessingStep,
|
|
3650
4020
|
{
|
|
3651
4021
|
smartAccount: step.smartAccount,
|
|
3652
4022
|
txHash: step.txHash,
|
|
@@ -3658,7 +4028,7 @@ function DepositFlow({
|
|
|
3658
4028
|
sourceSymbol: step.sourceSymbol,
|
|
3659
4029
|
sourceDecimals: step.sourceDecimals,
|
|
3660
4030
|
waitForFinalTx,
|
|
3661
|
-
hasPostBridgeActions: Boolean(_optionalChain([postBridgeActions, 'optionalAccess',
|
|
4031
|
+
hasPostBridgeActions: Boolean(_optionalChain([postBridgeActions, 'optionalAccess', _159 => _159.length])),
|
|
3662
4032
|
service,
|
|
3663
4033
|
directTransfer: step.directTransfer,
|
|
3664
4034
|
onClose,
|
|
@@ -3679,7 +4049,7 @@ function shortenHash(hash) {
|
|
|
3679
4049
|
if (hash.length <= 14) return hash;
|
|
3680
4050
|
return `${hash.slice(0, 6)}\u2026${hash.slice(-4)}`;
|
|
3681
4051
|
}
|
|
3682
|
-
function
|
|
4052
|
+
function formatTimestamp2(iso) {
|
|
3683
4053
|
try {
|
|
3684
4054
|
const date = new Date(iso);
|
|
3685
4055
|
if (Number.isNaN(date.getTime())) return iso;
|
|
@@ -3696,23 +4066,33 @@ function formatTimestamp(iso) {
|
|
|
3696
4066
|
month: "short",
|
|
3697
4067
|
day: "numeric"
|
|
3698
4068
|
});
|
|
3699
|
-
} catch (
|
|
4069
|
+
} catch (e23) {
|
|
3700
4070
|
return iso;
|
|
3701
4071
|
}
|
|
3702
4072
|
}
|
|
3703
4073
|
function resolveChainId(value) {
|
|
3704
4074
|
if (value === void 0 || value === null) return null;
|
|
3705
4075
|
if (typeof value === "number") return value;
|
|
3706
|
-
if (
|
|
3707
|
-
const parsed =
|
|
4076
|
+
if (_chunkFLVSQDP4cjs.isSolanaCaip2.call(void 0, value) || value === "solana") return "solana";
|
|
4077
|
+
const parsed = _chunkFLVSQDP4cjs.parseEvmChainId.call(void 0, value);
|
|
3708
4078
|
if (parsed !== null) return parsed;
|
|
3709
4079
|
const num = Number(value);
|
|
3710
4080
|
return Number.isFinite(num) ? num : null;
|
|
3711
4081
|
}
|
|
3712
4082
|
function resolveTokenSymbol(token, chainId) {
|
|
3713
4083
|
if (!token) return "";
|
|
4084
|
+
if (chainId === "solana") {
|
|
4085
|
+
const normalized = token.toLowerCase();
|
|
4086
|
+
const matched = SOLANA_TOKENS.find(
|
|
4087
|
+
(entry) => entry.mint.toLowerCase() === normalized
|
|
4088
|
+
);
|
|
4089
|
+
if (matched) return matched.symbol;
|
|
4090
|
+
if (normalized === "native" || normalized === "11111111111111111111111111111111" || normalized === "so11111111111111111111111111111111111111112") {
|
|
4091
|
+
return "SOL";
|
|
4092
|
+
}
|
|
4093
|
+
}
|
|
3714
4094
|
if (chainId !== null && chainId !== void 0 && chainId !== "solana" && /^0x[a-fA-F0-9]{40}$/.test(token)) {
|
|
3715
|
-
const sym =
|
|
4095
|
+
const sym = _chunkMUWVDVY4cjs.getTokenSymbol.call(void 0, token, chainId);
|
|
3716
4096
|
if (sym !== "Token") return sym;
|
|
3717
4097
|
}
|
|
3718
4098
|
return shortenHash(token);
|
|
@@ -3720,12 +4100,24 @@ function resolveTokenSymbol(token, chainId) {
|
|
|
3720
4100
|
function formatAmount(rawAmount, token, chainId) {
|
|
3721
4101
|
if (!rawAmount) return "";
|
|
3722
4102
|
let decimals = 18;
|
|
3723
|
-
if (token && chainId !== null && chainId !== void 0
|
|
3724
|
-
|
|
4103
|
+
if (token && chainId !== null && chainId !== void 0) {
|
|
4104
|
+
if (chainId === "solana") {
|
|
4105
|
+
const normalized = token.toLowerCase();
|
|
4106
|
+
const matched = SOLANA_TOKENS.find(
|
|
4107
|
+
(entry) => entry.mint.toLowerCase() === normalized
|
|
4108
|
+
);
|
|
4109
|
+
if (matched) {
|
|
4110
|
+
decimals = matched.decimals;
|
|
4111
|
+
} else if (normalized === "native" || normalized === "11111111111111111111111111111111" || normalized === "so11111111111111111111111111111111111111112") {
|
|
4112
|
+
decimals = 9;
|
|
4113
|
+
}
|
|
4114
|
+
} else if (/^0x[a-fA-F0-9]{40}$/.test(token)) {
|
|
4115
|
+
decimals = _chunkMUWVDVY4cjs.getTokenDecimalsByAddress.call(void 0, token, chainId);
|
|
4116
|
+
}
|
|
3725
4117
|
}
|
|
3726
4118
|
try {
|
|
3727
4119
|
const raw = BigInt(rawAmount);
|
|
3728
|
-
const divisor =
|
|
4120
|
+
const divisor = 10n ** BigInt(decimals);
|
|
3729
4121
|
const whole = raw / divisor;
|
|
3730
4122
|
const remainder = raw % divisor;
|
|
3731
4123
|
if (remainder === 0n) return whole.toString();
|
|
@@ -3733,13 +4125,13 @@ function formatAmount(rawAmount, token, chainId) {
|
|
|
3733
4125
|
const trimmed = fracStr.slice(0, 6).replace(/0+$/, "");
|
|
3734
4126
|
if (!trimmed) return whole.toString();
|
|
3735
4127
|
return `${whole}.${trimmed}`;
|
|
3736
|
-
} catch (
|
|
4128
|
+
} catch (e24) {
|
|
3737
4129
|
return rawAmount;
|
|
3738
4130
|
}
|
|
3739
4131
|
}
|
|
3740
4132
|
function getTxExplorerUrl(txHash, chainId) {
|
|
3741
4133
|
if (!chainId) return null;
|
|
3742
|
-
const base =
|
|
4134
|
+
const base = _chunkMUWVDVY4cjs.getExplorerUrl.call(void 0, chainId);
|
|
3743
4135
|
if (!base) return null;
|
|
3744
4136
|
return `${base}/tx/${txHash}`;
|
|
3745
4137
|
}
|
|
@@ -3838,15 +4230,15 @@ function HistoryRow({ deposit }) {
|
|
|
3838
4230
|
const status = normalizeStatus(deposit.status);
|
|
3839
4231
|
const sourceChainId = resolveChainId(deposit.chain);
|
|
3840
4232
|
const targetChainId = resolveChainId(deposit.targetChain);
|
|
3841
|
-
const sourceChainName = sourceChainId ?
|
|
3842
|
-
const targetChainName = targetChainId ?
|
|
3843
|
-
const sourceChainIcon = sourceChainId ?
|
|
3844
|
-
const targetChainIcon = targetChainId ?
|
|
4233
|
+
const sourceChainName = sourceChainId ? _chunkMUWVDVY4cjs.getChainName.call(void 0, sourceChainId) : null;
|
|
4234
|
+
const targetChainName = targetChainId ? _chunkMUWVDVY4cjs.getChainName.call(void 0, targetChainId) : null;
|
|
4235
|
+
const sourceChainIcon = sourceChainId ? _chunkMUWVDVY4cjs.getChainIcon.call(void 0, sourceChainId) : void 0;
|
|
4236
|
+
const targetChainIcon = targetChainId ? _chunkMUWVDVY4cjs.getChainIcon.call(void 0, targetChainId) : void 0;
|
|
3845
4237
|
const sourceSymbol = resolveTokenSymbol(deposit.token, sourceChainId);
|
|
3846
4238
|
const targetSymbol = resolveTokenSymbol(deposit.targetToken, targetChainId);
|
|
3847
4239
|
const rawAmount = _nullishCoalesce(deposit.sourceAmount, () => ( deposit.amount));
|
|
3848
4240
|
const formattedAmount = rawAmount ? formatAmount(rawAmount, deposit.token, sourceChainId) : null;
|
|
3849
|
-
const timestamp = deposit.createdAt ?
|
|
4241
|
+
const timestamp = deposit.createdAt ? formatTimestamp2(deposit.createdAt) : null;
|
|
3850
4242
|
const srcTxUrl = deposit.sourceTxHash ? getTxExplorerUrl(deposit.sourceTxHash, sourceChainId) : null;
|
|
3851
4243
|
const dstTxUrl = deposit.destinationTxHash ? getTxExplorerUrl(deposit.destinationTxHash, targetChainId) : null;
|
|
3852
4244
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-history-row", children: [
|
|
@@ -3916,7 +4308,7 @@ DepositHistoryPanel.displayName = "DepositHistoryPanel";
|
|
|
3916
4308
|
// src/DepositModal.tsx
|
|
3917
4309
|
|
|
3918
4310
|
var ReownDepositInner = _react.lazy.call(void 0,
|
|
3919
|
-
() => Promise.resolve().then(() => _interopRequireWildcard(require("./DepositModalReown-
|
|
4311
|
+
() => Promise.resolve().then(() => _interopRequireWildcard(require("./DepositModalReown-UPYZN2XA.cjs"))).then((m) => ({ default: m.DepositModalReown }))
|
|
3920
4312
|
);
|
|
3921
4313
|
function DepositModal(props) {
|
|
3922
4314
|
const needsReown = !!props.reownAppId;
|
|
@@ -3957,14 +4349,16 @@ function DepositModalInner({
|
|
|
3957
4349
|
sourceToken,
|
|
3958
4350
|
defaultAmount,
|
|
3959
4351
|
recipient,
|
|
3960
|
-
backendUrl =
|
|
4352
|
+
backendUrl = _chunkMUWVDVY4cjs.DEFAULT_BACKEND_URL,
|
|
3961
4353
|
solanaRpcUrl,
|
|
3962
|
-
signerAddress =
|
|
4354
|
+
signerAddress = _chunkMUWVDVY4cjs.DEFAULT_SIGNER_ADDRESS,
|
|
3963
4355
|
sessionChainIds,
|
|
3964
4356
|
forceRegister = false,
|
|
3965
4357
|
waitForFinalTx = true,
|
|
3966
4358
|
enableSolana = true,
|
|
3967
4359
|
postBridgeActions,
|
|
4360
|
+
outputTokenRules,
|
|
4361
|
+
rejectUnmapped,
|
|
3968
4362
|
reownWallet,
|
|
3969
4363
|
onConnect,
|
|
3970
4364
|
onDisconnect,
|
|
@@ -3985,11 +4379,11 @@ function DepositModalInner({
|
|
|
3985
4379
|
debug
|
|
3986
4380
|
}) {
|
|
3987
4381
|
const modalRef = _react.useRef.call(void 0, null);
|
|
3988
|
-
const onReadyRef =
|
|
4382
|
+
const onReadyRef = _chunkFLVSQDP4cjs.useLatestRef.call(void 0, onReady);
|
|
3989
4383
|
const [currentStepIndex, setCurrentStepIndex] = _react.useState.call(void 0, 0);
|
|
3990
4384
|
const [totalBalanceUsd, setTotalBalanceUsd] = _react.useState.call(void 0, null);
|
|
3991
4385
|
const backHandlerRef = _react.useRef.call(void 0, void 0);
|
|
3992
|
-
const showHistoryButton = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess',
|
|
4386
|
+
const showHistoryButton = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess', _160 => _160.showHistoryButton]), () => ( false));
|
|
3993
4387
|
const [activeSmartAccount, setActiveSmartAccount] = _react.useState.call(void 0, null);
|
|
3994
4388
|
const [historyOpen, setHistoryOpen] = _react.useState.call(void 0, false);
|
|
3995
4389
|
const [historyDeposits, setHistoryDeposits] = _react.useState.call(void 0, []);
|
|
@@ -3999,10 +4393,10 @@ function DepositModalInner({
|
|
|
3999
4393
|
const [historyError, setHistoryError] = _react.useState.call(void 0, null);
|
|
4000
4394
|
const historyStaleRef = _react.useRef.call(void 0, false);
|
|
4001
4395
|
const historyLoadedRef = _react.useRef.call(void 0, false);
|
|
4002
|
-
const targetChain =
|
|
4003
|
-
const sourceChain = sourceChainProp ?
|
|
4396
|
+
const targetChain = _chunkMUWVDVY4cjs.getChainId.call(void 0, targetChainProp);
|
|
4397
|
+
const sourceChain = sourceChainProp ? _chunkMUWVDVY4cjs.getChainId.call(void 0, sourceChainProp) : void 0;
|
|
4004
4398
|
const service = _react.useMemo.call(void 0,
|
|
4005
|
-
() =>
|
|
4399
|
+
() => _chunkFLVSQDP4cjs.createDepositService.call(void 0, backendUrl, {
|
|
4006
4400
|
debug,
|
|
4007
4401
|
debugScope: "service:deposit"
|
|
4008
4402
|
}),
|
|
@@ -4010,17 +4404,15 @@ function DepositModalInner({
|
|
|
4010
4404
|
);
|
|
4011
4405
|
_react.useEffect.call(void 0, () => {
|
|
4012
4406
|
if (isOpen && modalRef.current) {
|
|
4013
|
-
|
|
4407
|
+
_chunkFLVSQDP4cjs.applyTheme.call(void 0, modalRef.current, theme);
|
|
4014
4408
|
}
|
|
4015
4409
|
}, [isOpen, theme]);
|
|
4016
4410
|
_react.useEffect.call(void 0, () => {
|
|
4017
4411
|
configureSolanaRpcUrl(solanaRpcUrl);
|
|
4018
4412
|
}, [solanaRpcUrl]);
|
|
4019
|
-
const hasCalledReady = _react.useRef.call(void 0, false);
|
|
4020
4413
|
_react.useEffect.call(void 0, () => {
|
|
4021
|
-
if (isOpen
|
|
4022
|
-
|
|
4023
|
-
_optionalChain([onReadyRef, 'access', _129 => _129.current, 'optionalCall', _130 => _130()]);
|
|
4414
|
+
if (isOpen) {
|
|
4415
|
+
_optionalChain([onReadyRef, 'access', _161 => _161.current, 'optionalCall', _162 => _162()]);
|
|
4024
4416
|
}
|
|
4025
4417
|
}, [isOpen, onReadyRef]);
|
|
4026
4418
|
_react.useEffect.call(void 0, () => {
|
|
@@ -4039,7 +4431,7 @@ function DepositModalInner({
|
|
|
4039
4431
|
setTotalBalanceUsd(balance2);
|
|
4040
4432
|
}, []);
|
|
4041
4433
|
const handleBack = _react.useCallback.call(void 0, () => {
|
|
4042
|
-
_optionalChain([backHandlerRef, 'access',
|
|
4434
|
+
_optionalChain([backHandlerRef, 'access', _163 => _163.current, 'optionalCall', _164 => _164()]);
|
|
4043
4435
|
}, []);
|
|
4044
4436
|
const handleSmartAccountChange = _react.useCallback.call(void 0,
|
|
4045
4437
|
(account) => {
|
|
@@ -4108,26 +4500,26 @@ function DepositModalInner({
|
|
|
4108
4500
|
fetchHistory();
|
|
4109
4501
|
}
|
|
4110
4502
|
}, [historyOpen, fetchHistory]);
|
|
4111
|
-
const onDepositSubmittedRef =
|
|
4112
|
-
const onDepositCompleteRef =
|
|
4113
|
-
const onDepositFailedRef =
|
|
4503
|
+
const onDepositSubmittedRef = _chunkFLVSQDP4cjs.useLatestRef.call(void 0, onDepositSubmitted);
|
|
4504
|
+
const onDepositCompleteRef = _chunkFLVSQDP4cjs.useLatestRef.call(void 0, onDepositComplete);
|
|
4505
|
+
const onDepositFailedRef = _chunkFLVSQDP4cjs.useLatestRef.call(void 0, onDepositFailed);
|
|
4114
4506
|
const handleDepositSubmitted = _react.useCallback.call(void 0,
|
|
4115
4507
|
(data) => {
|
|
4116
|
-
_optionalChain([onDepositSubmittedRef, 'access',
|
|
4508
|
+
_optionalChain([onDepositSubmittedRef, 'access', _165 => _165.current, 'optionalCall', _166 => _166(data)]);
|
|
4117
4509
|
if (showHistoryButton) markHistoryStale();
|
|
4118
4510
|
},
|
|
4119
4511
|
[onDepositSubmittedRef, showHistoryButton, markHistoryStale]
|
|
4120
4512
|
);
|
|
4121
4513
|
const handleDepositComplete = _react.useCallback.call(void 0,
|
|
4122
4514
|
(data) => {
|
|
4123
|
-
_optionalChain([onDepositCompleteRef, 'access',
|
|
4515
|
+
_optionalChain([onDepositCompleteRef, 'access', _167 => _167.current, 'optionalCall', _168 => _168(data)]);
|
|
4124
4516
|
if (showHistoryButton) markHistoryStale();
|
|
4125
4517
|
},
|
|
4126
4518
|
[onDepositCompleteRef, showHistoryButton, markHistoryStale]
|
|
4127
4519
|
);
|
|
4128
4520
|
const handleDepositFailed = _react.useCallback.call(void 0,
|
|
4129
4521
|
(data) => {
|
|
4130
|
-
_optionalChain([onDepositFailedRef, 'access',
|
|
4522
|
+
_optionalChain([onDepositFailedRef, 'access', _169 => _169.current, 'optionalCall', _170 => _170(data)]);
|
|
4131
4523
|
if (showHistoryButton) markHistoryStale();
|
|
4132
4524
|
},
|
|
4133
4525
|
[onDepositFailedRef, showHistoryButton, markHistoryStale]
|
|
@@ -4143,15 +4535,15 @@ function DepositModalInner({
|
|
|
4143
4535
|
historyLoadedRef.current = false;
|
|
4144
4536
|
}
|
|
4145
4537
|
}, [isOpen]);
|
|
4146
|
-
const showLogo = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess',
|
|
4147
|
-
const showStepper = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess',
|
|
4148
|
-
const showBackButton = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess',
|
|
4149
|
-
const balance = _optionalChain([uiConfig, 'optionalAccess',
|
|
4150
|
-
const logoUrl = _nullishCoalesce(_optionalChain([branding, 'optionalAccess',
|
|
4151
|
-
const title = _nullishCoalesce(_optionalChain([branding, 'optionalAccess',
|
|
4538
|
+
const showLogo = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess', _171 => _171.showLogo]), () => ( false));
|
|
4539
|
+
const showStepper = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess', _172 => _172.showStepper]), () => ( false));
|
|
4540
|
+
const showBackButton = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess', _173 => _173.showBackButton]), () => ( true));
|
|
4541
|
+
const balance = _optionalChain([uiConfig, 'optionalAccess', _174 => _174.balance]);
|
|
4542
|
+
const logoUrl = _nullishCoalesce(_optionalChain([branding, 'optionalAccess', _175 => _175.logoUrl]), () => ( "https://github.com/rhinestonewtf.png"));
|
|
4543
|
+
const title = _nullishCoalesce(_optionalChain([branding, 'optionalAccess', _176 => _176.title]), () => ( "Deposit"));
|
|
4152
4544
|
const canGoBack = currentStepIndex > 0 && currentStepIndex < 4 && backHandlerRef.current !== void 0;
|
|
4153
4545
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4154
|
-
|
|
4546
|
+
_chunkFLVSQDP4cjs.Modal,
|
|
4155
4547
|
{
|
|
4156
4548
|
isOpen,
|
|
4157
4549
|
onClose,
|
|
@@ -4244,7 +4636,7 @@ function DepositModalInner({
|
|
|
4244
4636
|
balance.title,
|
|
4245
4637
|
":"
|
|
4246
4638
|
] }),
|
|
4247
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-modal-header-balance-value", children: _nullishCoalesce(balance.amount, () => ( (totalBalanceUsd !== null ?
|
|
4639
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-modal-header-balance-value", children: _nullishCoalesce(balance.amount, () => ( (totalBalanceUsd !== null ? _chunkFLVSQDP4cjs.currencyFormatter.format(totalBalanceUsd) : null))) })
|
|
4248
4640
|
] })
|
|
4249
4641
|
] }),
|
|
4250
4642
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-modal-header-nav-right", children: [
|
|
@@ -4318,6 +4710,8 @@ function DepositModalInner({
|
|
|
4318
4710
|
amount: defaultAmount,
|
|
4319
4711
|
recipient,
|
|
4320
4712
|
postBridgeActions,
|
|
4713
|
+
outputTokenRules,
|
|
4714
|
+
rejectUnmapped,
|
|
4321
4715
|
signerAddress,
|
|
4322
4716
|
sessionChainIds,
|
|
4323
4717
|
forceRegister,
|