@rhinestone/deposit-modal 0.1.66 → 0.1.68
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-RYCOXWMH.mjs} +3 -3
- package/dist/{DepositModalReown-WFXQKZDH.cjs → DepositModalReown-WXFTSZSK.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-5GN4QU67.cjs → chunk-J7ILKS5N.cjs} +1059 -447
- 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-OEB25YZ4.mjs} +1132 -520
- package/dist/{chunk-CIXHTOO3.mjs → chunk-SDZKKUCJ.mjs} +13 -1
- 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 +456 -32
- 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,472 @@ 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
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
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/Tooltip.tsx
|
|
1230
|
+
|
|
1231
|
+
|
|
1232
|
+
|
|
1233
|
+
|
|
1234
|
+
|
|
1235
|
+
|
|
1236
|
+
var _reactdom = require('react-dom');
|
|
1237
|
+
|
|
1238
|
+
function Tooltip({ content, children, className }) {
|
|
1239
|
+
const [open, setOpen] = _react.useState.call(void 0, false);
|
|
1240
|
+
const [position, setPosition] = _react.useState.call(void 0, null);
|
|
1241
|
+
const triggerRef = _react.useRef.call(void 0, null);
|
|
1242
|
+
const bubbleRef = _react.useRef.call(void 0, null);
|
|
1243
|
+
const updatePosition = _react.useCallback.call(void 0, () => {
|
|
1244
|
+
const trigger = triggerRef.current;
|
|
1245
|
+
if (!trigger) return;
|
|
1246
|
+
const rect = trigger.getBoundingClientRect();
|
|
1247
|
+
setPosition({
|
|
1248
|
+
top: rect.top,
|
|
1249
|
+
left: rect.left + rect.width / 2
|
|
1202
1250
|
});
|
|
1203
|
-
return () => {
|
|
1204
|
-
mounted = false;
|
|
1205
|
-
};
|
|
1206
1251
|
}, []);
|
|
1207
|
-
|
|
1208
|
-
if (!
|
|
1209
|
-
|
|
1252
|
+
_react.useEffect.call(void 0, () => {
|
|
1253
|
+
if (!open) return;
|
|
1254
|
+
updatePosition();
|
|
1255
|
+
function handleOutside(event) {
|
|
1256
|
+
const target = event.target;
|
|
1257
|
+
if (!target) return;
|
|
1258
|
+
if (_optionalChain([triggerRef, 'access', _27 => _27.current, 'optionalAccess', _28 => _28.contains, 'call', _29 => _29(target)])) return;
|
|
1259
|
+
if (_optionalChain([bubbleRef, 'access', _30 => _30.current, 'optionalAccess', _31 => _31.contains, 'call', _32 => _32(target)])) return;
|
|
1260
|
+
setOpen(false);
|
|
1210
1261
|
}
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
qr.make();
|
|
1214
|
-
const moduleCount = qr.getModuleCount();
|
|
1215
|
-
const cellSize = size / moduleCount;
|
|
1216
|
-
const paths = [];
|
|
1217
|
-
const iconCenterSize = iconSrc ? moduleCount * 0.22 : 0;
|
|
1218
|
-
const iconStart = (moduleCount - iconCenterSize) / 2;
|
|
1219
|
-
const iconEnd = (moduleCount + iconCenterSize) / 2;
|
|
1220
|
-
for (let row = 0; row < moduleCount; row++) {
|
|
1221
|
-
for (let col = 0; col < moduleCount; col++) {
|
|
1222
|
-
if (!qr.isDark(row, col)) continue;
|
|
1223
|
-
if (iconSrc && row >= iconStart && row < iconEnd && col >= iconStart && col < iconEnd) {
|
|
1224
|
-
continue;
|
|
1225
|
-
}
|
|
1226
|
-
const x = col * cellSize;
|
|
1227
|
-
const y = row * cellSize;
|
|
1228
|
-
paths.push(`M${x},${y}h${cellSize}v${cellSize}h${-cellSize}z`);
|
|
1229
|
-
}
|
|
1262
|
+
function handleKey(event) {
|
|
1263
|
+
if (event.key === "Escape") setOpen(false);
|
|
1230
1264
|
}
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1265
|
+
document.addEventListener("mousedown", handleOutside);
|
|
1266
|
+
document.addEventListener("touchstart", handleOutside);
|
|
1267
|
+
document.addEventListener("keydown", handleKey);
|
|
1268
|
+
window.addEventListener("scroll", updatePosition, true);
|
|
1269
|
+
window.addEventListener("resize", updatePosition);
|
|
1270
|
+
return () => {
|
|
1271
|
+
document.removeEventListener("mousedown", handleOutside);
|
|
1272
|
+
document.removeEventListener("touchstart", handleOutside);
|
|
1273
|
+
document.removeEventListener("keydown", handleKey);
|
|
1274
|
+
window.removeEventListener("scroll", updatePosition, true);
|
|
1275
|
+
window.removeEventListener("resize", updatePosition);
|
|
1276
|
+
};
|
|
1277
|
+
}, [open, updatePosition]);
|
|
1235
1278
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1236
|
-
"
|
|
1279
|
+
"span",
|
|
1237
1280
|
{
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
role: "img",
|
|
1243
|
-
"aria-label": "QR Code",
|
|
1281
|
+
ref: triggerRef,
|
|
1282
|
+
className: `rs-tooltip ${_nullishCoalesce(className, () => ( ""))}`,
|
|
1283
|
+
onMouseEnter: () => setOpen(true),
|
|
1284
|
+
onMouseLeave: () => setOpen(false),
|
|
1244
1285
|
children: [
|
|
1245
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1246
|
-
|
|
1247
|
-
|
|
1286
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1287
|
+
"span",
|
|
1288
|
+
{
|
|
1289
|
+
className: "rs-tooltip-trigger",
|
|
1290
|
+
role: "button",
|
|
1291
|
+
tabIndex: 0,
|
|
1292
|
+
"aria-label": content,
|
|
1293
|
+
onClick: (event) => {
|
|
1294
|
+
event.stopPropagation();
|
|
1295
|
+
event.preventDefault();
|
|
1296
|
+
setOpen((value) => !value);
|
|
1297
|
+
},
|
|
1298
|
+
onKeyDown: (event) => {
|
|
1299
|
+
if (event.key === "Enter" || event.key === " ") {
|
|
1300
|
+
event.preventDefault();
|
|
1301
|
+
setOpen((value) => !value);
|
|
1302
|
+
}
|
|
1303
|
+
},
|
|
1304
|
+
children
|
|
1305
|
+
}
|
|
1306
|
+
),
|
|
1307
|
+
open && position && typeof document !== "undefined" && _reactdom.createPortal.call(void 0,
|
|
1248
1308
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1249
|
-
"
|
|
1309
|
+
"span",
|
|
1250
1310
|
{
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
rx: 8
|
|
1311
|
+
ref: bubbleRef,
|
|
1312
|
+
className: "rs-tooltip-bubble",
|
|
1313
|
+
role: "tooltip",
|
|
1314
|
+
style: { top: position.top, left: position.left },
|
|
1315
|
+
children: content
|
|
1257
1316
|
}
|
|
1258
1317
|
),
|
|
1318
|
+
document.body
|
|
1319
|
+
)
|
|
1320
|
+
]
|
|
1321
|
+
}
|
|
1322
|
+
);
|
|
1323
|
+
}
|
|
1324
|
+
Tooltip.displayName = "Tooltip";
|
|
1325
|
+
|
|
1326
|
+
// src/components/ui/DepositNotification.tsx
|
|
1327
|
+
|
|
1328
|
+
|
|
1329
|
+
var INITIAL_POLL_INTERVAL = 3e3;
|
|
1330
|
+
var MAX_POLL_INTERVAL = 3e4;
|
|
1331
|
+
var BACKOFF_MULTIPLIER = 1.5;
|
|
1332
|
+
function isEventForTx(event, txHash) {
|
|
1333
|
+
const eventTxHash = _chunkFLVSQDP4cjs.getEventTxHash.call(void 0, event);
|
|
1334
|
+
if (!eventTxHash) return false;
|
|
1335
|
+
return _chunkFLVSQDP4cjs.txRefsMatch.call(void 0, eventTxHash, txHash);
|
|
1336
|
+
}
|
|
1337
|
+
function truncateHash(hash) {
|
|
1338
|
+
return `${hash.slice(0, 4)}\u2026${hash.slice(-4)}`;
|
|
1339
|
+
}
|
|
1340
|
+
function formatTimestamp(ms) {
|
|
1341
|
+
const date = new Date(ms);
|
|
1342
|
+
const months = [
|
|
1343
|
+
"Jan",
|
|
1344
|
+
"Feb",
|
|
1345
|
+
"Mar",
|
|
1346
|
+
"Apr",
|
|
1347
|
+
"May",
|
|
1348
|
+
"Jun",
|
|
1349
|
+
"Jul",
|
|
1350
|
+
"Aug",
|
|
1351
|
+
"Sep",
|
|
1352
|
+
"Oct",
|
|
1353
|
+
"Nov",
|
|
1354
|
+
"Dec"
|
|
1355
|
+
];
|
|
1356
|
+
const month = months[date.getMonth()];
|
|
1357
|
+
const day = date.getDate();
|
|
1358
|
+
const suffix = day % 10 === 1 && day !== 11 ? "st" : day % 10 === 2 && day !== 12 ? "nd" : day % 10 === 3 && day !== 13 ? "rd" : "th";
|
|
1359
|
+
const hours = String(date.getHours()).padStart(2, "0");
|
|
1360
|
+
const minutes = String(date.getMinutes()).padStart(2, "0");
|
|
1361
|
+
const seconds = String(date.getSeconds()).padStart(2, "0");
|
|
1362
|
+
return `${month} ${day}${suffix} \xB7 ${hours}:${minutes}:${seconds}`;
|
|
1363
|
+
}
|
|
1364
|
+
function formatBridgeFailedMessage(event) {
|
|
1365
|
+
const eventData = _nullishCoalesce(_optionalChain([event, 'optionalAccess', _33 => _33.data]), () => ( {}));
|
|
1366
|
+
const backendMessage = typeof eventData.message === "string" ? eventData.message.trim() : "";
|
|
1367
|
+
if (backendMessage.length > 0) {
|
|
1368
|
+
const lower = backendMessage.toLowerCase();
|
|
1369
|
+
if (lower.includes("insufficient funds")) {
|
|
1370
|
+
return "Deposit was received, but processing could not continue due to insufficient funds.";
|
|
1371
|
+
}
|
|
1372
|
+
if (lower.includes("no valid quote available")) {
|
|
1373
|
+
return "No bridge route is currently available for this transfer.";
|
|
1374
|
+
}
|
|
1375
|
+
if (lower.includes("simulation failed")) {
|
|
1376
|
+
return "Transfer processing failed during simulation.";
|
|
1377
|
+
}
|
|
1378
|
+
if (backendMessage.length > 220) {
|
|
1379
|
+
return "Transfer processing failed.";
|
|
1380
|
+
}
|
|
1381
|
+
return backendMessage;
|
|
1382
|
+
}
|
|
1383
|
+
return "Bridge failed";
|
|
1384
|
+
}
|
|
1385
|
+
var txLinkIcon = /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1386
|
+
"svg",
|
|
1387
|
+
{
|
|
1388
|
+
viewBox: "0 0 24 24",
|
|
1389
|
+
fill: "none",
|
|
1390
|
+
stroke: "currentColor",
|
|
1391
|
+
strokeWidth: "2.5",
|
|
1392
|
+
className: "rs-deposit-notification-link-icon",
|
|
1393
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1394
|
+
"path",
|
|
1395
|
+
{
|
|
1396
|
+
strokeLinecap: "round",
|
|
1397
|
+
strokeLinejoin: "round",
|
|
1398
|
+
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"
|
|
1399
|
+
}
|
|
1400
|
+
)
|
|
1401
|
+
}
|
|
1402
|
+
);
|
|
1403
|
+
function DepositNotification({
|
|
1404
|
+
deposit,
|
|
1405
|
+
smartAccount,
|
|
1406
|
+
targetChain,
|
|
1407
|
+
targetToken,
|
|
1408
|
+
waitForFinalTx,
|
|
1409
|
+
hasPostBridgeActions,
|
|
1410
|
+
service,
|
|
1411
|
+
onComplete,
|
|
1412
|
+
onFailed,
|
|
1413
|
+
onDismiss
|
|
1414
|
+
}) {
|
|
1415
|
+
const { txHash, sourceChain, amount, token, detectedAt, directTransfer } = deposit;
|
|
1416
|
+
const [status, setStatus] = _react.useState.call(void 0,
|
|
1417
|
+
directTransfer ? "complete" : "processing"
|
|
1418
|
+
);
|
|
1419
|
+
const [expanded, setExpanded] = _react.useState.call(void 0, false);
|
|
1420
|
+
const [completedAt, setCompletedAt] = _react.useState.call(void 0,
|
|
1421
|
+
directTransfer ? detectedAt : null
|
|
1422
|
+
);
|
|
1423
|
+
const [destinationTxHash, setDestinationTxHash] = _react.useState.call(void 0,
|
|
1424
|
+
null
|
|
1425
|
+
);
|
|
1426
|
+
const pollIntervalRef = _react.useRef.call(void 0, INITIAL_POLL_INTERVAL);
|
|
1427
|
+
const pollTimeoutRef = _react.useRef.call(void 0, null);
|
|
1428
|
+
const completedRef = _react.useRef.call(void 0, _nullishCoalesce(directTransfer, () => ( false)));
|
|
1429
|
+
const depositContextRef = _chunkFLVSQDP4cjs.useLatestRef.call(void 0, {
|
|
1430
|
+
amount,
|
|
1431
|
+
sourceChain,
|
|
1432
|
+
sourceToken: token,
|
|
1433
|
+
targetChain,
|
|
1434
|
+
targetToken,
|
|
1435
|
+
waitForFinalTx,
|
|
1436
|
+
hasPostBridgeActions
|
|
1437
|
+
});
|
|
1438
|
+
const onCompleteRef = _chunkFLVSQDP4cjs.useLatestRef.call(void 0, onComplete);
|
|
1439
|
+
const onFailedRef = _chunkFLVSQDP4cjs.useLatestRef.call(void 0, onFailed);
|
|
1440
|
+
const handleComplete = _react.useCallback.call(void 0,
|
|
1441
|
+
(destTxHash) => {
|
|
1442
|
+
if (completedRef.current) return;
|
|
1443
|
+
completedRef.current = true;
|
|
1444
|
+
setDestinationTxHash(_nullishCoalesce(destTxHash, () => ( null)));
|
|
1445
|
+
setCompletedAt(Date.now());
|
|
1446
|
+
setStatus("complete");
|
|
1447
|
+
const context = depositContextRef.current;
|
|
1448
|
+
_optionalChain([onCompleteRef, 'access', _34 => _34.current, 'optionalCall', _35 => _35(txHash, destTxHash, {
|
|
1449
|
+
amount: context.amount,
|
|
1450
|
+
sourceChain: context.sourceChain,
|
|
1451
|
+
sourceToken: context.sourceToken,
|
|
1452
|
+
targetChain: context.targetChain,
|
|
1453
|
+
targetToken: context.targetToken
|
|
1454
|
+
})]);
|
|
1455
|
+
},
|
|
1456
|
+
[depositContextRef, onCompleteRef, txHash]
|
|
1457
|
+
);
|
|
1458
|
+
const handleFailed = _react.useCallback.call(void 0,
|
|
1459
|
+
(error) => {
|
|
1460
|
+
if (completedRef.current) return;
|
|
1461
|
+
completedRef.current = true;
|
|
1462
|
+
setStatus("failed");
|
|
1463
|
+
_optionalChain([onFailedRef, 'access', _36 => _36.current, 'optionalCall', _37 => _37(txHash, error)]);
|
|
1464
|
+
},
|
|
1465
|
+
[onFailedRef, txHash]
|
|
1466
|
+
);
|
|
1467
|
+
_react.useEffect.call(void 0, () => {
|
|
1468
|
+
if (directTransfer) {
|
|
1469
|
+
handleComplete(void 0);
|
|
1470
|
+
return;
|
|
1471
|
+
}
|
|
1472
|
+
if (status !== "processing") return;
|
|
1473
|
+
let isMounted = true;
|
|
1474
|
+
async function pollStatus() {
|
|
1475
|
+
try {
|
|
1476
|
+
const data = await service.fetchStatus(smartAccount, txHash);
|
|
1477
|
+
if (!isMounted) return;
|
|
1478
|
+
const lastEvent = data.lastEvent;
|
|
1479
|
+
const eventForTx = isEventForTx(lastEvent, txHash) ? lastEvent : void 0;
|
|
1480
|
+
const awaitingPostBridgeSwap = depositContextRef.current.waitForFinalTx && depositContextRef.current.hasPostBridgeActions;
|
|
1481
|
+
if (_optionalChain([eventForTx, 'optionalAccess', _38 => _38.type]) === "post-bridge-swap-complete") {
|
|
1482
|
+
const swapTxHash = _optionalChain([eventForTx, 'access', _39 => _39.data, 'optionalAccess', _40 => _40.swap, 'optionalAccess', _41 => _41.transactionHash]);
|
|
1483
|
+
handleComplete(swapTxHash);
|
|
1484
|
+
return;
|
|
1485
|
+
}
|
|
1486
|
+
if (_optionalChain([eventForTx, 'optionalAccess', _42 => _42.type]) === "post-bridge-swap-failed") {
|
|
1487
|
+
handleFailed(formatBridgeFailedMessage(eventForTx));
|
|
1488
|
+
return;
|
|
1489
|
+
}
|
|
1490
|
+
if (_optionalChain([eventForTx, 'optionalAccess', _43 => _43.type]) === "bridge-complete" && !awaitingPostBridgeSwap) {
|
|
1491
|
+
const destTx = _optionalChain([eventForTx, 'access', _44 => _44.data, 'optionalAccess', _45 => _45.destination, 'optionalAccess', _46 => _46.transactionHash]);
|
|
1492
|
+
handleComplete(destTx);
|
|
1493
|
+
return;
|
|
1494
|
+
}
|
|
1495
|
+
if (!waitForFinalTx && _optionalChain([eventForTx, 'optionalAccess', _47 => _47.type]) === "bridge-started") {
|
|
1496
|
+
handleComplete(void 0);
|
|
1497
|
+
return;
|
|
1498
|
+
}
|
|
1499
|
+
if (_optionalChain([eventForTx, 'optionalAccess', _48 => _48.type]) === "bridge-failed") {
|
|
1500
|
+
handleFailed(formatBridgeFailedMessage(eventForTx));
|
|
1501
|
+
return;
|
|
1502
|
+
}
|
|
1503
|
+
if (_optionalChain([eventForTx, 'optionalAccess', _49 => _49.type]) === "error") {
|
|
1504
|
+
const errorMessage = _nullishCoalesce(_optionalChain([eventForTx, 'access', _50 => _50.data, 'optionalAccess', _51 => _51.message]), () => ( "Unknown error"));
|
|
1505
|
+
handleFailed(errorMessage);
|
|
1506
|
+
return;
|
|
1507
|
+
}
|
|
1508
|
+
scheduleNextPoll();
|
|
1509
|
+
} catch (e12) {
|
|
1510
|
+
scheduleNextPoll();
|
|
1511
|
+
}
|
|
1512
|
+
}
|
|
1513
|
+
function scheduleNextPoll() {
|
|
1514
|
+
if (!isMounted) return;
|
|
1515
|
+
pollTimeoutRef.current = setTimeout(() => {
|
|
1516
|
+
pollIntervalRef.current = Math.min(
|
|
1517
|
+
pollIntervalRef.current * BACKOFF_MULTIPLIER,
|
|
1518
|
+
MAX_POLL_INTERVAL
|
|
1519
|
+
);
|
|
1520
|
+
pollStatus();
|
|
1521
|
+
}, pollIntervalRef.current);
|
|
1522
|
+
}
|
|
1523
|
+
pollStatus();
|
|
1524
|
+
return () => {
|
|
1525
|
+
isMounted = false;
|
|
1526
|
+
if (pollTimeoutRef.current) {
|
|
1527
|
+
clearTimeout(pollTimeoutRef.current);
|
|
1528
|
+
}
|
|
1529
|
+
};
|
|
1530
|
+
}, [
|
|
1531
|
+
directTransfer,
|
|
1532
|
+
depositContextRef,
|
|
1533
|
+
handleComplete,
|
|
1534
|
+
handleFailed,
|
|
1535
|
+
service,
|
|
1536
|
+
smartAccount,
|
|
1537
|
+
status,
|
|
1538
|
+
txHash
|
|
1539
|
+
]);
|
|
1540
|
+
const sourceExplorerUrl = _chunkMUWVDVY4cjs.getExplorerTxUrl.call(void 0, sourceChain, txHash);
|
|
1541
|
+
const destExplorerUrl = destinationTxHash ? _chunkMUWVDVY4cjs.getExplorerTxUrl.call(void 0, targetChain, destinationTxHash) : null;
|
|
1542
|
+
const title = status === "complete" ? "Deposit completed" : status === "failed" ? "Deposit failed" : "Deposit received and processing\u2026";
|
|
1543
|
+
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.";
|
|
1544
|
+
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,
|
|
1545
|
+
"svg",
|
|
1546
|
+
{
|
|
1547
|
+
viewBox: "0 0 24 24",
|
|
1548
|
+
fill: "none",
|
|
1549
|
+
stroke: "currentColor",
|
|
1550
|
+
strokeWidth: "3",
|
|
1551
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1552
|
+
"path",
|
|
1553
|
+
{
|
|
1554
|
+
strokeLinecap: "round",
|
|
1555
|
+
strokeLinejoin: "round",
|
|
1556
|
+
d: "M5 12l5 5L20 7"
|
|
1557
|
+
}
|
|
1558
|
+
)
|
|
1559
|
+
}
|
|
1560
|
+
) }) : 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,
|
|
1561
|
+
"svg",
|
|
1562
|
+
{
|
|
1563
|
+
viewBox: "0 0 24 24",
|
|
1564
|
+
fill: "none",
|
|
1565
|
+
stroke: "currentColor",
|
|
1566
|
+
strokeWidth: "3",
|
|
1567
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1568
|
+
"path",
|
|
1569
|
+
{
|
|
1570
|
+
strokeLinecap: "round",
|
|
1571
|
+
strokeLinejoin: "round",
|
|
1572
|
+
d: "M6 18L18 6M6 6l12 12"
|
|
1573
|
+
}
|
|
1574
|
+
)
|
|
1575
|
+
}
|
|
1576
|
+
) }) : /* @__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, {}) });
|
|
1577
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1578
|
+
"div",
|
|
1579
|
+
{
|
|
1580
|
+
className: `rs-deposit-notification rs-deposit-notification--${status}`,
|
|
1581
|
+
children: [
|
|
1582
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-deposit-notification-header", children: [
|
|
1583
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-deposit-notification-icon", children: statusIcon }),
|
|
1584
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-deposit-notification-content", children: [
|
|
1585
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-deposit-notification-title", children: title }),
|
|
1586
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-deposit-notification-subtitle", children: subtitle })
|
|
1587
|
+
] }),
|
|
1259
1588
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1260
|
-
"
|
|
1589
|
+
"button",
|
|
1261
1590
|
{
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1591
|
+
type: "button",
|
|
1592
|
+
className: "rs-deposit-notification-close",
|
|
1593
|
+
onClick: () => onDismiss(deposit.id),
|
|
1594
|
+
"aria-label": "Dismiss",
|
|
1595
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1596
|
+
"svg",
|
|
1597
|
+
{
|
|
1598
|
+
viewBox: "0 0 24 24",
|
|
1599
|
+
fill: "none",
|
|
1600
|
+
stroke: "currentColor",
|
|
1601
|
+
strokeWidth: "2",
|
|
1602
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1603
|
+
"path",
|
|
1604
|
+
{
|
|
1605
|
+
strokeLinecap: "round",
|
|
1606
|
+
strokeLinejoin: "round",
|
|
1607
|
+
d: "M6 18L18 6M6 6l12 12"
|
|
1608
|
+
}
|
|
1609
|
+
)
|
|
1610
|
+
}
|
|
1611
|
+
)
|
|
1267
1612
|
}
|
|
1268
1613
|
)
|
|
1269
|
-
] })
|
|
1614
|
+
] }),
|
|
1615
|
+
expanded && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-deposit-notification-details", children: [
|
|
1616
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-deposit-notification-row", children: [
|
|
1617
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-deposit-notification-label", children: "Deposit tx" }),
|
|
1618
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-deposit-notification-value", children: sourceExplorerUrl ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1619
|
+
"a",
|
|
1620
|
+
{
|
|
1621
|
+
href: sourceExplorerUrl,
|
|
1622
|
+
target: "_blank",
|
|
1623
|
+
rel: "noopener noreferrer",
|
|
1624
|
+
className: "rs-deposit-notification-link",
|
|
1625
|
+
children: [
|
|
1626
|
+
truncateHash(txHash),
|
|
1627
|
+
txLinkIcon
|
|
1628
|
+
]
|
|
1629
|
+
}
|
|
1630
|
+
) : truncateHash(txHash) })
|
|
1631
|
+
] }),
|
|
1632
|
+
destinationTxHash && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-deposit-notification-row", children: [
|
|
1633
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-deposit-notification-label", children: "Completion tx" }),
|
|
1634
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-deposit-notification-value", children: destExplorerUrl ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1635
|
+
"a",
|
|
1636
|
+
{
|
|
1637
|
+
href: destExplorerUrl,
|
|
1638
|
+
target: "_blank",
|
|
1639
|
+
rel: "noopener noreferrer",
|
|
1640
|
+
className: "rs-deposit-notification-link",
|
|
1641
|
+
children: [
|
|
1642
|
+
truncateHash(destinationTxHash),
|
|
1643
|
+
txLinkIcon
|
|
1644
|
+
]
|
|
1645
|
+
}
|
|
1646
|
+
) : truncateHash(destinationTxHash) })
|
|
1647
|
+
] }),
|
|
1648
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-deposit-notification-row", children: [
|
|
1649
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-deposit-notification-label", children: "Order submitted" }),
|
|
1650
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-deposit-notification-value", children: formatTimestamp(detectedAt) })
|
|
1651
|
+
] }),
|
|
1652
|
+
completedAt && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-deposit-notification-row", children: [
|
|
1653
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-deposit-notification-label", children: "Order filled" }),
|
|
1654
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-deposit-notification-value", children: formatTimestamp(completedAt) })
|
|
1655
|
+
] })
|
|
1656
|
+
] }),
|
|
1657
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1658
|
+
"button",
|
|
1659
|
+
{
|
|
1660
|
+
type: "button",
|
|
1661
|
+
className: "rs-deposit-notification-toggle",
|
|
1662
|
+
onClick: () => setExpanded(!expanded),
|
|
1663
|
+
children: expanded ? "See less" : "See more"
|
|
1664
|
+
}
|
|
1665
|
+
)
|
|
1270
1666
|
]
|
|
1271
1667
|
}
|
|
1272
1668
|
);
|
|
1273
1669
|
}
|
|
1274
|
-
QRCode.displayName = "QRCode";
|
|
1275
1670
|
|
|
1276
1671
|
// src/core/solana.ts
|
|
1277
1672
|
|
|
@@ -1302,7 +1697,7 @@ var DEFAULT_SOLANA_RPC_URL = "https://api.mainnet.solana.com";
|
|
|
1302
1697
|
var configuredSolanaRpcUrl = null;
|
|
1303
1698
|
var cachedConnections = /* @__PURE__ */ new Map();
|
|
1304
1699
|
function configureSolanaRpcUrl(rpcUrl) {
|
|
1305
|
-
const normalized = _optionalChain([rpcUrl, 'optionalAccess',
|
|
1700
|
+
const normalized = _optionalChain([rpcUrl, 'optionalAccess', _52 => _52.trim, 'call', _53 => _53()]);
|
|
1306
1701
|
configuredSolanaRpcUrl = normalized ? normalized : null;
|
|
1307
1702
|
cachedConnections.clear();
|
|
1308
1703
|
}
|
|
@@ -1437,7 +1832,7 @@ function resolveSolanaTokenMeta(token) {
|
|
|
1437
1832
|
return {};
|
|
1438
1833
|
}
|
|
1439
1834
|
function getDepositEventDetails(event) {
|
|
1440
|
-
if (!_optionalChain([event, 'optionalAccess',
|
|
1835
|
+
if (!_optionalChain([event, 'optionalAccess', _54 => _54.type]) || !isRecord(event.data)) return {};
|
|
1441
1836
|
if (event.type === "deposit-received") {
|
|
1442
1837
|
const chainId = asChainId(event.data.chain);
|
|
1443
1838
|
const token = asString(event.data.token);
|
|
@@ -1451,50 +1846,62 @@ function getDepositEventDetails(event) {
|
|
|
1451
1846
|
}
|
|
1452
1847
|
if (event.type === "bridge-started") {
|
|
1453
1848
|
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',
|
|
1849
|
+
const chainId = asChainId(_optionalChain([source, 'optionalAccess', _55 => _55.chain]));
|
|
1850
|
+
const token = asString(_optionalChain([source, 'optionalAccess', _56 => _56.asset]));
|
|
1456
1851
|
const solanaMeta = chainId === "solana" ? resolveSolanaTokenMeta(token) : {};
|
|
1457
1852
|
return {
|
|
1458
1853
|
chainId,
|
|
1459
|
-
amount: asAmount(_optionalChain([source, 'optionalAccess',
|
|
1854
|
+
amount: asAmount(_optionalChain([source, 'optionalAccess', _57 => _57.amount])),
|
|
1460
1855
|
token,
|
|
1461
1856
|
...solanaMeta
|
|
1462
1857
|
};
|
|
1463
1858
|
}
|
|
1464
1859
|
return {};
|
|
1465
1860
|
}
|
|
1861
|
+
function isSameRoute(sourceChain, sourceToken, targetChain, targetToken) {
|
|
1862
|
+
return sourceChain === targetChain && sourceToken.toLowerCase() === targetToken.toLowerCase();
|
|
1863
|
+
}
|
|
1466
1864
|
function DepositAddressStep({
|
|
1467
1865
|
smartAccount,
|
|
1468
1866
|
solanaDepositAddress,
|
|
1469
1867
|
service,
|
|
1470
1868
|
allowedRoutes,
|
|
1471
|
-
|
|
1869
|
+
targetChain,
|
|
1870
|
+
targetToken,
|
|
1871
|
+
waitForFinalTx,
|
|
1872
|
+
hasPostBridgeActions,
|
|
1873
|
+
uiConfig,
|
|
1874
|
+
onDepositSubmitted,
|
|
1875
|
+
onDepositComplete,
|
|
1876
|
+
onDepositFailed,
|
|
1472
1877
|
onCopyAddress,
|
|
1473
1878
|
onError
|
|
1474
1879
|
}) {
|
|
1475
1880
|
const hasSolana = Boolean(solanaDepositAddress);
|
|
1476
1881
|
const allowedChainSet = _react.useMemo.call(void 0,
|
|
1477
|
-
() => _optionalChain([allowedRoutes, 'optionalAccess',
|
|
1478
|
-
[_optionalChain([allowedRoutes, 'optionalAccess',
|
|
1882
|
+
() => _optionalChain([allowedRoutes, 'optionalAccess', _58 => _58.sourceChains]) ? new Set(allowedRoutes.sourceChains) : null,
|
|
1883
|
+
[_optionalChain([allowedRoutes, 'optionalAccess', _59 => _59.sourceChains])]
|
|
1479
1884
|
);
|
|
1480
1885
|
const allowedTokenSet = _react.useMemo.call(void 0,
|
|
1481
|
-
() => _optionalChain([allowedRoutes, 'optionalAccess',
|
|
1482
|
-
[_optionalChain([allowedRoutes, 'optionalAccess',
|
|
1886
|
+
() => _optionalChain([allowedRoutes, 'optionalAccess', _60 => _60.sourceTokens]) ? new Set(allowedRoutes.sourceTokens.map((s) => s.toUpperCase())) : null,
|
|
1887
|
+
[_optionalChain([allowedRoutes, 'optionalAccess', _61 => _61.sourceTokens])]
|
|
1483
1888
|
);
|
|
1484
1889
|
const evmChainIds = _react.useMemo.call(void 0, () => {
|
|
1485
|
-
const all =
|
|
1890
|
+
const all = _chunkMUWVDVY4cjs.getSupportedChainIds.call(void 0, );
|
|
1486
1891
|
return allowedChainSet ? all.filter((id) => allowedChainSet.has(id)) : all;
|
|
1487
1892
|
}, [allowedChainSet]);
|
|
1488
|
-
const chainOptions = _react.useMemo.call(void 0,
|
|
1489
|
-
()
|
|
1490
|
-
[evmChainIds
|
|
1491
|
-
|
|
1893
|
+
const chainOptions = _react.useMemo.call(void 0, () => {
|
|
1894
|
+
if (!hasSolana) return evmChainIds;
|
|
1895
|
+
const options = [...evmChainIds];
|
|
1896
|
+
options.splice(1, 0, "solana");
|
|
1897
|
+
return options;
|
|
1898
|
+
}, [evmChainIds, hasSolana]);
|
|
1492
1899
|
const BASE_CHAIN_ID = 8453;
|
|
1493
1900
|
const defaultChainId = evmChainIds.includes(BASE_CHAIN_ID) ? BASE_CHAIN_ID : evmChainIds[0];
|
|
1494
1901
|
const [sourceChainId, setSourceChainId] = _react.useState.call(void 0, defaultChainId);
|
|
1495
1902
|
const isSolana = sourceChainId === "solana";
|
|
1496
1903
|
const tokensForChain = _react.useMemo.call(void 0, () => {
|
|
1497
|
-
const all = isSolana ? SOLANA_TOKENS.map((t) => t.symbol) :
|
|
1904
|
+
const all = isSolana ? SOLANA_TOKENS.map((t) => t.symbol) : _chunkMUWVDVY4cjs.getTargetTokenSymbolsForChain.call(void 0, sourceChainId);
|
|
1498
1905
|
return allowedTokenSet ? all.filter((s) => allowedTokenSet.has(s.toUpperCase())) : all;
|
|
1499
1906
|
}, [sourceChainId, isSolana, allowedTokenSet]);
|
|
1500
1907
|
const defaultToken = tokensForChain.includes("USDC") ? "USDC" : _nullishCoalesce(tokensForChain[0], () => ( "USDC"));
|
|
@@ -1509,12 +1916,16 @@ function DepositAddressStep({
|
|
|
1509
1916
|
const [pollingError, setPollingError] = _react.useState.call(void 0, null);
|
|
1510
1917
|
const [chainDropdownOpen, setChainDropdownOpen] = _react.useState.call(void 0, false);
|
|
1511
1918
|
const [tokenDropdownOpen, setTokenDropdownOpen] = _react.useState.call(void 0, false);
|
|
1919
|
+
const [priceImpactExpanded, setPriceImpactExpanded] = _react.useState.call(void 0, false);
|
|
1512
1920
|
const chainDropdownRef = _react.useRef.call(void 0, null);
|
|
1513
1921
|
const tokenDropdownRef = _react.useRef.call(void 0, null);
|
|
1514
|
-
const
|
|
1922
|
+
const [notifications, setNotifications] = _react.useState.call(void 0, []);
|
|
1923
|
+
const isTrackingRef = _react.useRef.call(void 0, false);
|
|
1924
|
+
const baselineTxHashRef = _react.useRef.call(void 0, void 0);
|
|
1925
|
+
const notificationIdRef = _react.useRef.call(void 0, 0);
|
|
1515
1926
|
const sourceSelectionRef = _react.useRef.call(void 0, {
|
|
1516
1927
|
chainId: defaultChainId,
|
|
1517
|
-
token: typeof defaultChainId === "number" ?
|
|
1928
|
+
token: typeof defaultChainId === "number" ? _chunkMUWVDVY4cjs.getTokenAddress.call(void 0, defaultToken, defaultChainId) : void 0,
|
|
1518
1929
|
sourceSymbol: defaultToken
|
|
1519
1930
|
});
|
|
1520
1931
|
_react.useEffect.call(void 0, () => {
|
|
@@ -1522,15 +1933,15 @@ function DepositAddressStep({
|
|
|
1522
1933
|
const matched = _nullishCoalesce(SOLANA_TOKENS.find((t) => t.symbol === sourceTokenSymbol), () => ( SOLANA_TOKENS[0]));
|
|
1523
1934
|
sourceSelectionRef.current = {
|
|
1524
1935
|
chainId: "solana",
|
|
1525
|
-
token: _optionalChain([matched, 'optionalAccess',
|
|
1526
|
-
sourceSymbol: _optionalChain([matched, 'optionalAccess',
|
|
1527
|
-
sourceDecimals: _optionalChain([matched, 'optionalAccess',
|
|
1936
|
+
token: _optionalChain([matched, 'optionalAccess', _62 => _62.mint]),
|
|
1937
|
+
sourceSymbol: _optionalChain([matched, 'optionalAccess', _63 => _63.symbol]),
|
|
1938
|
+
sourceDecimals: _optionalChain([matched, 'optionalAccess', _64 => _64.decimals])
|
|
1528
1939
|
};
|
|
1529
1940
|
return;
|
|
1530
1941
|
}
|
|
1531
1942
|
sourceSelectionRef.current = {
|
|
1532
1943
|
chainId: sourceChainId,
|
|
1533
|
-
token:
|
|
1944
|
+
token: _chunkMUWVDVY4cjs.getTokenAddress.call(void 0, sourceTokenSymbol, sourceChainId),
|
|
1534
1945
|
sourceSymbol: sourceTokenSymbol
|
|
1535
1946
|
};
|
|
1536
1947
|
}, [sourceChainId, sourceTokenSymbol, isSolana]);
|
|
@@ -1540,8 +1951,8 @@ function DepositAddressStep({
|
|
|
1540
1951
|
function handlePointerDown(event) {
|
|
1541
1952
|
const target = event.target;
|
|
1542
1953
|
if (!target) return;
|
|
1543
|
-
const clickedChainDropdown = _optionalChain([chainDropdownRef, 'access',
|
|
1544
|
-
const clickedTokenDropdown = _optionalChain([tokenDropdownRef, 'access',
|
|
1954
|
+
const clickedChainDropdown = _optionalChain([chainDropdownRef, 'access', _65 => _65.current, 'optionalAccess', _66 => _66.contains, 'call', _67 => _67(target)]);
|
|
1955
|
+
const clickedTokenDropdown = _optionalChain([tokenDropdownRef, 'access', _68 => _68.current, 'optionalAccess', _69 => _69.contains, 'call', _70 => _70(target)]);
|
|
1545
1956
|
if (clickedChainDropdown || clickedTokenDropdown) return;
|
|
1546
1957
|
setChainDropdownOpen(false);
|
|
1547
1958
|
setTokenDropdownOpen(false);
|
|
@@ -1554,12 +1965,12 @@ function DepositAddressStep({
|
|
|
1554
1965
|
};
|
|
1555
1966
|
}, [chainDropdownOpen, tokenDropdownOpen]);
|
|
1556
1967
|
const handleCopy = _react.useCallback.call(void 0, async () => {
|
|
1557
|
-
_optionalChain([onCopyAddress, 'optionalCall',
|
|
1968
|
+
_optionalChain([onCopyAddress, 'optionalCall', _71 => _71()]);
|
|
1558
1969
|
try {
|
|
1559
1970
|
await navigator.clipboard.writeText(displayAddress);
|
|
1560
1971
|
setCopied(true);
|
|
1561
1972
|
setTimeout(() => setCopied(false), 2e3);
|
|
1562
|
-
} catch (
|
|
1973
|
+
} catch (e13) {
|
|
1563
1974
|
const textarea = document.createElement("textarea");
|
|
1564
1975
|
textarea.value = displayAddress;
|
|
1565
1976
|
textarea.style.position = "fixed";
|
|
@@ -1577,22 +1988,46 @@ function DepositAddressStep({
|
|
|
1577
1988
|
setChainDropdownOpen(false);
|
|
1578
1989
|
setTokenDropdownOpen(false);
|
|
1579
1990
|
}, [sourceChainId]);
|
|
1991
|
+
const onDepositSubmittedRef = _react.useRef.call(void 0, onDepositSubmitted);
|
|
1992
|
+
onDepositSubmittedRef.current = onDepositSubmitted;
|
|
1993
|
+
const onDepositCompleteRef = _react.useRef.call(void 0, onDepositComplete);
|
|
1994
|
+
onDepositCompleteRef.current = onDepositComplete;
|
|
1995
|
+
const onDepositFailedRef = _react.useRef.call(void 0, onDepositFailed);
|
|
1996
|
+
onDepositFailedRef.current = onDepositFailed;
|
|
1997
|
+
const onErrorRef = _react.useRef.call(void 0, onError);
|
|
1998
|
+
onErrorRef.current = onError;
|
|
1999
|
+
const targetChainRef = _react.useRef.call(void 0, targetChain);
|
|
2000
|
+
targetChainRef.current = targetChain;
|
|
2001
|
+
const targetTokenRef = _react.useRef.call(void 0, targetToken);
|
|
2002
|
+
targetTokenRef.current = targetToken;
|
|
1580
2003
|
_react.useEffect.call(void 0, () => {
|
|
1581
|
-
|
|
2004
|
+
baselineTxHashRef.current = void 0;
|
|
2005
|
+
isTrackingRef.current = false;
|
|
1582
2006
|
setPollingError(null);
|
|
1583
2007
|
let timeoutId;
|
|
1584
2008
|
let cancelled = false;
|
|
1585
|
-
let baselineTxHash = void 0;
|
|
1586
2009
|
async function poll() {
|
|
1587
|
-
if (cancelled
|
|
2010
|
+
if (cancelled) return;
|
|
2011
|
+
if (isTrackingRef.current) {
|
|
2012
|
+
if (!cancelled) {
|
|
2013
|
+
timeoutId = setTimeout(poll, POLL_INTERVAL_MS);
|
|
2014
|
+
}
|
|
2015
|
+
return;
|
|
2016
|
+
}
|
|
1588
2017
|
try {
|
|
1589
2018
|
const status = await service.fetchLatestStatus(smartAccount);
|
|
1590
|
-
if (cancelled
|
|
2019
|
+
if (cancelled) return;
|
|
2020
|
+
if (isTrackingRef.current) {
|
|
2021
|
+
if (!cancelled) {
|
|
2022
|
+
timeoutId = setTimeout(poll, POLL_INTERVAL_MS);
|
|
2023
|
+
}
|
|
2024
|
+
return;
|
|
2025
|
+
}
|
|
1591
2026
|
const event = status.lastEvent;
|
|
1592
|
-
const eventTxHash =
|
|
1593
|
-
if (
|
|
1594
|
-
|
|
1595
|
-
} else if (eventTxHash && (!
|
|
2027
|
+
const eventTxHash = _chunkFLVSQDP4cjs.isDepositEvent.call(void 0, event) ? _nullishCoalesce(_chunkFLVSQDP4cjs.getEventTxHash.call(void 0, event), () => ( null)) : null;
|
|
2028
|
+
if (baselineTxHashRef.current === void 0) {
|
|
2029
|
+
baselineTxHashRef.current = eventTxHash;
|
|
2030
|
+
} else if (eventTxHash && (!baselineTxHashRef.current || !_chunkFLVSQDP4cjs.txRefsMatch.call(void 0, eventTxHash, baselineTxHashRef.current))) {
|
|
1596
2031
|
const details = getDepositEventDetails(event);
|
|
1597
2032
|
const fallback = sourceSelectionRef.current;
|
|
1598
2033
|
const chainId = _nullishCoalesce(details.chainId, () => ( fallback.chainId));
|
|
@@ -1601,16 +2036,33 @@ function DepositAddressStep({
|
|
|
1601
2036
|
const sourceSymbol = _nullishCoalesce(details.sourceSymbol, () => ( fallback.sourceSymbol));
|
|
1602
2037
|
const sourceDecimals = _nullishCoalesce(details.sourceDecimals, () => ( fallback.sourceDecimals));
|
|
1603
2038
|
if (token) {
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
2039
|
+
baselineTxHashRef.current = eventTxHash;
|
|
2040
|
+
isTrackingRef.current = true;
|
|
2041
|
+
const isEvmToken = /^0x[a-fA-F0-9]{40}$/.test(token);
|
|
2042
|
+
const directTransfer = typeof chainId === "number" && isEvmToken && isSameRoute(
|
|
1607
2043
|
chainId,
|
|
2044
|
+
token,
|
|
2045
|
+
targetChainRef.current,
|
|
2046
|
+
targetTokenRef.current
|
|
2047
|
+
);
|
|
2048
|
+
const id = String(++notificationIdRef.current);
|
|
2049
|
+
const notification = {
|
|
2050
|
+
id,
|
|
2051
|
+
txHash: eventTxHash,
|
|
2052
|
+
sourceChain: chainId,
|
|
1608
2053
|
amount,
|
|
1609
2054
|
token,
|
|
1610
2055
|
sourceSymbol,
|
|
1611
|
-
sourceDecimals
|
|
1612
|
-
|
|
1613
|
-
|
|
2056
|
+
sourceDecimals,
|
|
2057
|
+
detectedAt: Date.now(),
|
|
2058
|
+
directTransfer
|
|
2059
|
+
};
|
|
2060
|
+
setNotifications((prev) => [notification, ...prev]);
|
|
2061
|
+
_optionalChain([onDepositSubmittedRef, 'access', _72 => _72.current, 'optionalCall', _73 => _73({
|
|
2062
|
+
txHash: eventTxHash,
|
|
2063
|
+
sourceChain: chainId,
|
|
2064
|
+
amount
|
|
2065
|
+
})]);
|
|
1614
2066
|
}
|
|
1615
2067
|
}
|
|
1616
2068
|
setPollingError(null);
|
|
@@ -1618,10 +2070,10 @@ function DepositAddressStep({
|
|
|
1618
2070
|
if (!cancelled) {
|
|
1619
2071
|
const msg = err instanceof Error ? err.message : "Failed to check status";
|
|
1620
2072
|
setPollingError(msg);
|
|
1621
|
-
_optionalChain([
|
|
2073
|
+
_optionalChain([onErrorRef, 'access', _74 => _74.current, 'optionalCall', _75 => _75(msg, "STATUS_POLL_ERROR")]);
|
|
1622
2074
|
}
|
|
1623
2075
|
}
|
|
1624
|
-
if (!cancelled
|
|
2076
|
+
if (!cancelled) {
|
|
1625
2077
|
timeoutId = setTimeout(poll, POLL_INTERVAL_MS);
|
|
1626
2078
|
}
|
|
1627
2079
|
}
|
|
@@ -1630,13 +2082,30 @@ function DepositAddressStep({
|
|
|
1630
2082
|
cancelled = true;
|
|
1631
2083
|
clearTimeout(timeoutId);
|
|
1632
2084
|
};
|
|
1633
|
-
}, [smartAccount, service
|
|
1634
|
-
const
|
|
1635
|
-
|
|
2085
|
+
}, [smartAccount, service]);
|
|
2086
|
+
const handleNotificationComplete = _react.useCallback.call(void 0,
|
|
2087
|
+
(txHash, destinationTxHash, context) => {
|
|
2088
|
+
isTrackingRef.current = false;
|
|
2089
|
+
_optionalChain([onDepositCompleteRef, 'access', _76 => _76.current, 'optionalCall', _77 => _77(txHash, destinationTxHash, context)]);
|
|
2090
|
+
},
|
|
2091
|
+
[]
|
|
2092
|
+
);
|
|
2093
|
+
const handleNotificationFailed = _react.useCallback.call(void 0,
|
|
2094
|
+
(txHash, error) => {
|
|
2095
|
+
isTrackingRef.current = false;
|
|
2096
|
+
_optionalChain([onDepositFailedRef, 'access', _78 => _78.current, 'optionalCall', _79 => _79(txHash, error)]);
|
|
2097
|
+
},
|
|
2098
|
+
[]
|
|
2099
|
+
);
|
|
2100
|
+
const handleNotificationDismiss = _react.useCallback.call(void 0, (id) => {
|
|
2101
|
+
setNotifications((prev) => prev.filter((n) => n.id !== id));
|
|
2102
|
+
}, []);
|
|
2103
|
+
const qrIconSrc = _chunkMUWVDVY4cjs.getChainIcon.call(void 0, sourceChainId);
|
|
2104
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-step rs-step--with-notifications", children: [
|
|
1636
2105
|
/* @__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
2106
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-deposit-address-selectors", children: [
|
|
1638
2107
|
/* @__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: "
|
|
2108
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-deposit-address-dropdown-label", children: "Supported chain" }),
|
|
1640
2109
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1641
2110
|
"button",
|
|
1642
2111
|
{
|
|
@@ -1647,15 +2116,15 @@ function DepositAddressStep({
|
|
|
1647
2116
|
setTokenDropdownOpen(false);
|
|
1648
2117
|
},
|
|
1649
2118
|
children: [
|
|
1650
|
-
|
|
2119
|
+
_chunkMUWVDVY4cjs.getChainIcon.call(void 0, sourceChainId) && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1651
2120
|
"img",
|
|
1652
2121
|
{
|
|
1653
|
-
src:
|
|
2122
|
+
src: _chunkMUWVDVY4cjs.getChainIcon.call(void 0, sourceChainId),
|
|
1654
2123
|
alt: "",
|
|
1655
2124
|
className: "rs-deposit-address-dropdown-icon"
|
|
1656
2125
|
}
|
|
1657
2126
|
),
|
|
1658
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children:
|
|
2127
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: _chunkMUWVDVY4cjs.getChainName.call(void 0, sourceChainId) }),
|
|
1659
2128
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1660
2129
|
"svg",
|
|
1661
2130
|
{
|
|
@@ -1687,22 +2156,43 @@ function DepositAddressStep({
|
|
|
1687
2156
|
setChainDropdownOpen(false);
|
|
1688
2157
|
},
|
|
1689
2158
|
children: [
|
|
1690
|
-
|
|
2159
|
+
_chunkMUWVDVY4cjs.getChainIcon.call(void 0, chainId) && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1691
2160
|
"img",
|
|
1692
2161
|
{
|
|
1693
|
-
src:
|
|
2162
|
+
src: _chunkMUWVDVY4cjs.getChainIcon.call(void 0, chainId),
|
|
1694
2163
|
alt: "",
|
|
1695
2164
|
className: "rs-deposit-address-dropdown-icon"
|
|
1696
2165
|
}
|
|
1697
2166
|
),
|
|
1698
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children:
|
|
2167
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: _chunkMUWVDVY4cjs.getChainName.call(void 0, chainId) })
|
|
1699
2168
|
]
|
|
1700
2169
|
},
|
|
1701
2170
|
String(chainId)
|
|
1702
2171
|
)) })
|
|
1703
2172
|
] }),
|
|
1704
2173
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-deposit-address-dropdown", ref: tokenDropdownRef, children: [
|
|
1705
|
-
/* @__PURE__ */ _jsxruntime.
|
|
2174
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-deposit-address-dropdown-label rs-deposit-address-dropdown-label--with-min", children: [
|
|
2175
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: "Supported token" }),
|
|
2176
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "rs-deposit-address-min", children: [
|
|
2177
|
+
"Min $",
|
|
2178
|
+
_nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess', _80 => _80.minDepositUsd]), () => ( 0.1)),
|
|
2179
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Tooltip, { content: "Minimum deposit amount required for the selected chain.", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2180
|
+
"svg",
|
|
2181
|
+
{
|
|
2182
|
+
className: "rs-deposit-address-min-icon",
|
|
2183
|
+
viewBox: "0 0 24 24",
|
|
2184
|
+
fill: "none",
|
|
2185
|
+
stroke: "currentColor",
|
|
2186
|
+
strokeWidth: "2",
|
|
2187
|
+
"aria-hidden": "true",
|
|
2188
|
+
children: [
|
|
2189
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "circle", { cx: "12", cy: "12", r: "9" }),
|
|
2190
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M12 8h.01M11 12h1v4h1" })
|
|
2191
|
+
]
|
|
2192
|
+
}
|
|
2193
|
+
) })
|
|
2194
|
+
] })
|
|
2195
|
+
] }),
|
|
1706
2196
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1707
2197
|
"button",
|
|
1708
2198
|
{
|
|
@@ -1713,10 +2203,10 @@ function DepositAddressStep({
|
|
|
1713
2203
|
setChainDropdownOpen(false);
|
|
1714
2204
|
},
|
|
1715
2205
|
children: [
|
|
1716
|
-
|
|
2206
|
+
_chunkMUWVDVY4cjs.getTokenIcon.call(void 0, sourceTokenSymbol) && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1717
2207
|
"img",
|
|
1718
2208
|
{
|
|
1719
|
-
src:
|
|
2209
|
+
src: _chunkMUWVDVY4cjs.getTokenIcon.call(void 0, sourceTokenSymbol),
|
|
1720
2210
|
alt: "",
|
|
1721
2211
|
className: "rs-deposit-address-dropdown-icon"
|
|
1722
2212
|
}
|
|
@@ -1753,10 +2243,10 @@ function DepositAddressStep({
|
|
|
1753
2243
|
setTokenDropdownOpen(false);
|
|
1754
2244
|
},
|
|
1755
2245
|
children: [
|
|
1756
|
-
|
|
2246
|
+
_chunkMUWVDVY4cjs.getTokenIcon.call(void 0, symbol) && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1757
2247
|
"img",
|
|
1758
2248
|
{
|
|
1759
|
-
src:
|
|
2249
|
+
src: _chunkMUWVDVY4cjs.getTokenIcon.call(void 0, symbol),
|
|
1760
2250
|
alt: "",
|
|
1761
2251
|
className: "rs-deposit-address-dropdown-icon"
|
|
1762
2252
|
}
|
|
@@ -1768,7 +2258,7 @@ function DepositAddressStep({
|
|
|
1768
2258
|
)) })
|
|
1769
2259
|
] })
|
|
1770
2260
|
] }),
|
|
1771
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-deposit-address-qr", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, QRCode, { value: displayAddress, size:
|
|
2261
|
+
/* @__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
2262
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-deposit-address-info", children: [
|
|
1773
2263
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-deposit-address-label", children: [
|
|
1774
2264
|
"Your ",
|
|
@@ -1813,9 +2303,122 @@ function DepositAddressStep({
|
|
|
1813
2303
|
}
|
|
1814
2304
|
)
|
|
1815
2305
|
] }),
|
|
2306
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2307
|
+
"div",
|
|
2308
|
+
{
|
|
2309
|
+
className: `rs-price-impact ${priceImpactExpanded ? "rs-price-impact--open" : ""}`,
|
|
2310
|
+
children: [
|
|
2311
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2312
|
+
"button",
|
|
2313
|
+
{
|
|
2314
|
+
type: "button",
|
|
2315
|
+
className: "rs-price-impact-header",
|
|
2316
|
+
onClick: () => setPriceImpactExpanded((v) => !v),
|
|
2317
|
+
"aria-expanded": priceImpactExpanded,
|
|
2318
|
+
children: [
|
|
2319
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-price-impact-row-icon", "aria-hidden": "true", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.8", children: [
|
|
2320
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "circle", { cx: "12", cy: "12", r: "9" }),
|
|
2321
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2322
|
+
"path",
|
|
2323
|
+
{
|
|
2324
|
+
strokeLinecap: "round",
|
|
2325
|
+
strokeLinejoin: "round",
|
|
2326
|
+
d: "M15 9.5a2.5 2.5 0 00-2.5-2h-1A2 2 0 0011 11.5h2a2 2 0 010 4h-1a2.5 2.5 0 01-2.5-2M12 7v1m0 8v1"
|
|
2327
|
+
}
|
|
2328
|
+
)
|
|
2329
|
+
] }) }),
|
|
2330
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "rs-price-impact-label", children: [
|
|
2331
|
+
"Price impact: ",
|
|
2332
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "strong", { children: "0.00%" })
|
|
2333
|
+
] }),
|
|
2334
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2335
|
+
Tooltip,
|
|
2336
|
+
{
|
|
2337
|
+
className: "rs-price-impact-info",
|
|
2338
|
+
content: "Price impact is the difference between expected and execution price, due to trade size and liquidity.",
|
|
2339
|
+
children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", "aria-hidden": "true", children: [
|
|
2340
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "circle", { cx: "12", cy: "12", r: "9" }),
|
|
2341
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M12 8h.01M11 12h1v4h1" })
|
|
2342
|
+
] })
|
|
2343
|
+
}
|
|
2344
|
+
),
|
|
2345
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2346
|
+
"svg",
|
|
2347
|
+
{
|
|
2348
|
+
className: "rs-price-impact-chevron",
|
|
2349
|
+
viewBox: "0 0 24 24",
|
|
2350
|
+
fill: "none",
|
|
2351
|
+
stroke: "currentColor",
|
|
2352
|
+
strokeWidth: "2",
|
|
2353
|
+
"aria-hidden": "true",
|
|
2354
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M19.5 8.25l-7.5 7.5-7.5-7.5" })
|
|
2355
|
+
}
|
|
2356
|
+
)
|
|
2357
|
+
]
|
|
2358
|
+
}
|
|
2359
|
+
),
|
|
2360
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-price-impact-panel", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-price-impact-panel-inner", children: [
|
|
2361
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-price-impact-row", children: [
|
|
2362
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-price-impact-row-icon", "aria-hidden": "true", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.8", children: [
|
|
2363
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "circle", { cx: "12", cy: "12", r: "9" }),
|
|
2364
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2365
|
+
"path",
|
|
2366
|
+
{
|
|
2367
|
+
strokeLinecap: "round",
|
|
2368
|
+
strokeLinejoin: "round",
|
|
2369
|
+
d: "M8.5 15.5l7-7M9.5 9.5h.01M14.5 14.5h.01"
|
|
2370
|
+
}
|
|
2371
|
+
)
|
|
2372
|
+
] }) }),
|
|
2373
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "rs-price-impact-label", children: [
|
|
2374
|
+
"Max slippage: ",
|
|
2375
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "strong", { children: "Auto \u2022 0.1%" })
|
|
2376
|
+
] }),
|
|
2377
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2378
|
+
Tooltip,
|
|
2379
|
+
{
|
|
2380
|
+
className: "rs-price-impact-info",
|
|
2381
|
+
content: "Slippage accounts for price changes during execution. Slippage is adjusted per pair to ensure reliable execution.",
|
|
2382
|
+
children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", "aria-hidden": "true", children: [
|
|
2383
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "circle", { cx: "12", cy: "12", r: "9" }),
|
|
2384
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M12 8h.01M11 12h1v4h1" })
|
|
2385
|
+
] })
|
|
2386
|
+
}
|
|
2387
|
+
)
|
|
2388
|
+
] }),
|
|
2389
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-price-impact-row", children: [
|
|
2390
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-price-impact-row-icon", "aria-hidden": "true", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.8", children: [
|
|
2391
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "circle", { cx: "12", cy: "12", r: "9" }),
|
|
2392
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M12 7.5V12l2.5 2" })
|
|
2393
|
+
] }) }),
|
|
2394
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "rs-price-impact-label", children: [
|
|
2395
|
+
"Processing time: ",
|
|
2396
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "strong", { children: "< 1 min" })
|
|
2397
|
+
] })
|
|
2398
|
+
] })
|
|
2399
|
+
] }) })
|
|
2400
|
+
]
|
|
2401
|
+
}
|
|
2402
|
+
),
|
|
1816
2403
|
pollingError && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-deposit-address-error", children: pollingError })
|
|
1817
2404
|
] }) }),
|
|
1818
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2405
|
+
notifications.length > 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-deposit-notifications", children: notifications.map((deposit) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2406
|
+
DepositNotification,
|
|
2407
|
+
{
|
|
2408
|
+
deposit,
|
|
2409
|
+
smartAccount,
|
|
2410
|
+
targetChain,
|
|
2411
|
+
targetToken,
|
|
2412
|
+
waitForFinalTx,
|
|
2413
|
+
hasPostBridgeActions,
|
|
2414
|
+
service,
|
|
2415
|
+
onComplete: handleNotificationComplete,
|
|
2416
|
+
onFailed: handleNotificationFailed,
|
|
2417
|
+
onDismiss: handleNotificationDismiss
|
|
2418
|
+
},
|
|
2419
|
+
deposit.id
|
|
2420
|
+
)) }),
|
|
2421
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFLVSQDP4cjs.PoweredBy, {})
|
|
1819
2422
|
] });
|
|
1820
2423
|
}
|
|
1821
2424
|
DepositAddressStep.displayName = "DepositAddressStep";
|
|
@@ -1846,7 +2449,7 @@ function SolanaTokenSelectStep({
|
|
|
1846
2449
|
setError(null);
|
|
1847
2450
|
const portfolioBySymbol = {};
|
|
1848
2451
|
try {
|
|
1849
|
-
|
|
2452
|
+
_chunkFLVSQDP4cjs.debugLog.call(void 0, debug, "solana-token-select", "portfolio:request", {
|
|
1850
2453
|
solanaAddress
|
|
1851
2454
|
});
|
|
1852
2455
|
const portfolio = await service.fetchSolanaPortfolio(solanaAddress);
|
|
@@ -1857,7 +2460,7 @@ function SolanaTokenSelectStep({
|
|
|
1857
2460
|
let parsed = 0n;
|
|
1858
2461
|
try {
|
|
1859
2462
|
parsed = BigInt(t.balance || "0");
|
|
1860
|
-
} catch (
|
|
2463
|
+
} catch (e14) {
|
|
1861
2464
|
parsed = 0n;
|
|
1862
2465
|
}
|
|
1863
2466
|
if (parsed <= 0n) continue;
|
|
@@ -1869,12 +2472,12 @@ function SolanaTokenSelectStep({
|
|
|
1869
2472
|
};
|
|
1870
2473
|
}
|
|
1871
2474
|
}
|
|
1872
|
-
|
|
2475
|
+
_chunkFLVSQDP4cjs.debugLog.call(void 0, debug, "solana-token-select", "portfolio:success", {
|
|
1873
2476
|
symbols: Object.keys(portfolioBySymbol)
|
|
1874
2477
|
});
|
|
1875
2478
|
} catch (err) {
|
|
1876
2479
|
if (!active) return;
|
|
1877
|
-
|
|
2480
|
+
_chunkFLVSQDP4cjs.debugError.call(void 0, debug, "solana-token-select", "portfolio:failure", err, {
|
|
1878
2481
|
solanaAddress
|
|
1879
2482
|
});
|
|
1880
2483
|
setError(
|
|
@@ -1899,7 +2502,7 @@ function SolanaTokenSelectStep({
|
|
|
1899
2502
|
setTokenBalances(results);
|
|
1900
2503
|
setLoading(false);
|
|
1901
2504
|
const totalUsd = results.reduce((sum, r) => sum + r.balanceUsd, 0);
|
|
1902
|
-
_optionalChain([onTotalBalanceComputed, 'optionalCall',
|
|
2505
|
+
_optionalChain([onTotalBalanceComputed, 'optionalCall', _81 => _81(totalUsd)]);
|
|
1903
2506
|
}
|
|
1904
2507
|
void loadBalances();
|
|
1905
2508
|
return () => {
|
|
@@ -1928,7 +2531,7 @@ function SolanaTokenSelectStep({
|
|
|
1928
2531
|
style: { paddingTop: 4, overflow: "auto", maxHeight: 340 },
|
|
1929
2532
|
children: [
|
|
1930
2533
|
loading && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-loading-state", style: { padding: "40px 12px" }, children: [
|
|
1931
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2534
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFLVSQDP4cjs.Spinner, { className: "rs-text-tertiary" }),
|
|
1932
2535
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-text-sm rs-text-tertiary", children: "Loading balances" })
|
|
1933
2536
|
] }),
|
|
1934
2537
|
!loading && rows.length === 0 && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-empty-state", children: [
|
|
@@ -1959,14 +2562,14 @@ function SolanaTokenSelectStep({
|
|
|
1959
2562
|
] }),
|
|
1960
2563
|
!loading && rows.length > 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-asset-list", children: rows.map((entry) => {
|
|
1961
2564
|
const isSelected = selectedSymbol === entry.token.symbol;
|
|
1962
|
-
const tokenIcon =
|
|
1963
|
-
const chainIcon =
|
|
2565
|
+
const tokenIcon = _chunkMUWVDVY4cjs.getTokenIcon.call(void 0, entry.token.symbol);
|
|
2566
|
+
const chainIcon = _chunkMUWVDVY4cjs.getChainIcon.call(void 0, "solana");
|
|
1964
2567
|
let formattedBalance;
|
|
1965
2568
|
try {
|
|
1966
2569
|
const raw = _viem.formatUnits.call(void 0, entry.balance, entry.token.decimals);
|
|
1967
2570
|
const numeric = Number(raw);
|
|
1968
|
-
formattedBalance = Number.isFinite(numeric) ?
|
|
1969
|
-
} catch (
|
|
2571
|
+
formattedBalance = Number.isFinite(numeric) ? _chunkFLVSQDP4cjs.tokenFormatter.format(numeric) : raw;
|
|
2572
|
+
} catch (e15) {
|
|
1970
2573
|
formattedBalance = "...";
|
|
1971
2574
|
}
|
|
1972
2575
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
@@ -2009,7 +2612,7 @@ function SolanaTokenSelectStep({
|
|
|
2009
2612
|
] })
|
|
2010
2613
|
] })
|
|
2011
2614
|
] }),
|
|
2012
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-asset-balance", children: entry.balanceUsd > 0 ?
|
|
2615
|
+
/* @__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
2616
|
]
|
|
2014
2617
|
},
|
|
2015
2618
|
entry.token.symbol
|
|
@@ -2019,7 +2622,7 @@ function SolanaTokenSelectStep({
|
|
|
2019
2622
|
}
|
|
2020
2623
|
),
|
|
2021
2624
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-step-footer", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2022
|
-
|
|
2625
|
+
_chunkFLVSQDP4cjs.Button,
|
|
2023
2626
|
{
|
|
2024
2627
|
onClick: () => selectedEntry && onContinue(
|
|
2025
2628
|
selectedEntry.token,
|
|
@@ -2031,7 +2634,7 @@ function SolanaTokenSelectStep({
|
|
|
2031
2634
|
children: "Continue"
|
|
2032
2635
|
}
|
|
2033
2636
|
) }),
|
|
2034
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2637
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFLVSQDP4cjs.PoweredBy, {})
|
|
2035
2638
|
] });
|
|
2036
2639
|
}
|
|
2037
2640
|
|
|
@@ -2051,7 +2654,7 @@ function SolanaAmountStep({
|
|
|
2051
2654
|
}) {
|
|
2052
2655
|
const [amount, setAmount] = _react.useState.call(void 0, "");
|
|
2053
2656
|
const [error, setError] = _react.useState.call(void 0, null);
|
|
2054
|
-
const isSourceStablecoin =
|
|
2657
|
+
const isSourceStablecoin = _chunkMUWVDVY4cjs.isStablecoinSymbol.call(void 0, token.symbol);
|
|
2055
2658
|
const tokenPriceUsd = _react.useMemo.call(void 0, () => {
|
|
2056
2659
|
if (isSourceStablecoin) return 1;
|
|
2057
2660
|
try {
|
|
@@ -2061,7 +2664,7 @@ function SolanaAmountStep({
|
|
|
2061
2664
|
}
|
|
2062
2665
|
const price = balanceUsd / balanceUnits;
|
|
2063
2666
|
return price > 0 ? price : null;
|
|
2064
|
-
} catch (
|
|
2667
|
+
} catch (e16) {
|
|
2065
2668
|
return null;
|
|
2066
2669
|
}
|
|
2067
2670
|
}, [isSourceStablecoin, balance, token.decimals, balanceUsd]);
|
|
@@ -2079,8 +2682,8 @@ function SolanaAmountStep({
|
|
|
2079
2682
|
const raw = _viem.formatUnits.call(void 0, balance, token.decimals);
|
|
2080
2683
|
const numeric = Number(raw);
|
|
2081
2684
|
if (!Number.isFinite(numeric)) return raw;
|
|
2082
|
-
return
|
|
2083
|
-
} catch (
|
|
2685
|
+
return _chunkFLVSQDP4cjs.tokenFormatter.format(numeric);
|
|
2686
|
+
} catch (e17) {
|
|
2084
2687
|
return "...";
|
|
2085
2688
|
}
|
|
2086
2689
|
}, [balance, token.decimals]);
|
|
@@ -2091,13 +2694,13 @@ function SolanaAmountStep({
|
|
|
2091
2694
|
if (tokenPriceUsd !== null) return balanceUnits * tokenPriceUsd;
|
|
2092
2695
|
if (Number.isFinite(balanceUsd) && balanceUsd > 0) return balanceUsd;
|
|
2093
2696
|
return null;
|
|
2094
|
-
} catch (
|
|
2697
|
+
} catch (e18) {
|
|
2095
2698
|
return null;
|
|
2096
2699
|
}
|
|
2097
2700
|
}, [balance, token.decimals, tokenPriceUsd, balanceUsd]);
|
|
2098
2701
|
const formattedBalanceUsd = _react.useMemo.call(void 0, () => {
|
|
2099
2702
|
if (computedBalanceUsd === null || computedBalanceUsd <= 0) return null;
|
|
2100
|
-
return
|
|
2703
|
+
return _chunkFLVSQDP4cjs.currencyFormatter.format(computedBalanceUsd);
|
|
2101
2704
|
}, [computedBalanceUsd]);
|
|
2102
2705
|
const spendableBalance = _react.useMemo.call(void 0, () => {
|
|
2103
2706
|
if (!isNativeSol(token)) return balance;
|
|
@@ -2109,7 +2712,7 @@ function SolanaAmountStep({
|
|
|
2109
2712
|
if (!Number.isFinite(spendableUnits) || spendableUnits < 0) return null;
|
|
2110
2713
|
if (tokenPriceUsd !== null) return spendableUnits * tokenPriceUsd;
|
|
2111
2714
|
return null;
|
|
2112
|
-
} catch (
|
|
2715
|
+
} catch (e19) {
|
|
2113
2716
|
return null;
|
|
2114
2717
|
}
|
|
2115
2718
|
}, [spendableBalance, token.decimals, tokenPriceUsd]);
|
|
@@ -2122,13 +2725,13 @@ function SolanaAmountStep({
|
|
|
2122
2725
|
const factor = 10 ** maxDecimals;
|
|
2123
2726
|
const truncated = Math.floor(value * factor) / factor;
|
|
2124
2727
|
const formatted = truncated.toFixed(maxDecimals).replace(/\.?0+$/, "");
|
|
2125
|
-
|
|
2728
|
+
_chunkFLVSQDP4cjs.debugLog.call(void 0, debug, "solana-amount", "amount:preset", {
|
|
2126
2729
|
percentage,
|
|
2127
2730
|
symbol: token.symbol,
|
|
2128
2731
|
formatted
|
|
2129
2732
|
});
|
|
2130
2733
|
setAmount(formatted);
|
|
2131
|
-
} catch (
|
|
2734
|
+
} catch (e20) {
|
|
2132
2735
|
return;
|
|
2133
2736
|
}
|
|
2134
2737
|
if (error) setError(null);
|
|
@@ -2136,7 +2739,7 @@ function SolanaAmountStep({
|
|
|
2136
2739
|
const handleContinue = () => {
|
|
2137
2740
|
const numericAmount = parseFloat(amount);
|
|
2138
2741
|
if (isNaN(numericAmount) || numericAmount <= 0) {
|
|
2139
|
-
|
|
2742
|
+
_chunkFLVSQDP4cjs.debugLog.call(void 0, debug, "solana-amount", "amount:invalid", {
|
|
2140
2743
|
amount,
|
|
2141
2744
|
reason: "nan-or-non-positive"
|
|
2142
2745
|
});
|
|
@@ -2146,13 +2749,13 @@ function SolanaAmountStep({
|
|
|
2146
2749
|
const sourceAmount = isSourceStablecoin || !hasPricing ? numericAmount : numericAmount / tokenPriceUsd;
|
|
2147
2750
|
if (hasPricing) {
|
|
2148
2751
|
const usdValue = numericAmount;
|
|
2149
|
-
if (_optionalChain([uiConfig, 'optionalAccess',
|
|
2752
|
+
if (_optionalChain([uiConfig, 'optionalAccess', _82 => _82.maxDepositUsd]) && usdValue > uiConfig.maxDepositUsd) {
|
|
2150
2753
|
setError(
|
|
2151
|
-
`Maximum deposit is ${
|
|
2754
|
+
`Maximum deposit is ${_chunkFLVSQDP4cjs.currencyFormatter.format(uiConfig.maxDepositUsd)}`
|
|
2152
2755
|
);
|
|
2153
2756
|
return;
|
|
2154
2757
|
}
|
|
2155
|
-
if (_optionalChain([uiConfig, 'optionalAccess',
|
|
2758
|
+
if (_optionalChain([uiConfig, 'optionalAccess', _83 => _83.minDepositUsd]) && usdValue < uiConfig.minDepositUsd) {
|
|
2156
2759
|
setAmount(uiConfig.minDepositUsd.toString());
|
|
2157
2760
|
setError(null);
|
|
2158
2761
|
return;
|
|
@@ -2162,8 +2765,8 @@ function SolanaAmountStep({
|
|
|
2162
2765
|
let amountInUnits;
|
|
2163
2766
|
try {
|
|
2164
2767
|
amountInUnits = _viem.parseUnits.call(void 0, sourceAmountStr, token.decimals);
|
|
2165
|
-
} catch (
|
|
2166
|
-
|
|
2768
|
+
} catch (e21) {
|
|
2769
|
+
_chunkFLVSQDP4cjs.debugLog.call(void 0, debug, "solana-amount", "amount:invalid", {
|
|
2167
2770
|
amount,
|
|
2168
2771
|
sourceAmount: sourceAmountStr,
|
|
2169
2772
|
reason: "parse-units-failed"
|
|
@@ -2173,7 +2776,7 @@ function SolanaAmountStep({
|
|
|
2173
2776
|
}
|
|
2174
2777
|
if (amountInUnits > spendableBalance) {
|
|
2175
2778
|
const isReserveIssue = isNativeSol(token) && amountInUnits <= balance;
|
|
2176
|
-
|
|
2779
|
+
_chunkFLVSQDP4cjs.debugLog.call(void 0, debug, "solana-amount", "amount:invalid", {
|
|
2177
2780
|
amount,
|
|
2178
2781
|
balance: balance.toString(),
|
|
2179
2782
|
spendableBalance: spendableBalance.toString(),
|
|
@@ -2185,7 +2788,7 @@ function SolanaAmountStep({
|
|
|
2185
2788
|
);
|
|
2186
2789
|
return;
|
|
2187
2790
|
}
|
|
2188
|
-
|
|
2791
|
+
_chunkFLVSQDP4cjs.debugLog.call(void 0, debug, "solana-amount", "amount:continue", {
|
|
2189
2792
|
symbol: token.symbol,
|
|
2190
2793
|
inputAmountUsd: amount,
|
|
2191
2794
|
sourceAmount: sourceAmountStr,
|
|
@@ -2253,8 +2856,8 @@ function SolanaAmountStep({
|
|
|
2253
2856
|
}
|
|
2254
2857
|
)
|
|
2255
2858
|
] }),
|
|
2256
|
-
_optionalChain([uiConfig, 'optionalAccess',
|
|
2257
|
-
|
|
2859
|
+
_optionalChain([uiConfig, 'optionalAccess', _84 => _84.minDepositUsd]) && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-amount-minimum", children: [
|
|
2860
|
+
_chunkFLVSQDP4cjs.currencyFormatter.format(uiConfig.minDepositUsd),
|
|
2258
2861
|
" minimum deposit"
|
|
2259
2862
|
] }),
|
|
2260
2863
|
error && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-amount-error", children: [
|
|
@@ -2280,15 +2883,15 @@ function SolanaAmountStep({
|
|
|
2280
2883
|
] })
|
|
2281
2884
|
] }),
|
|
2282
2885
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-step-footer", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2283
|
-
|
|
2886
|
+
_chunkFLVSQDP4cjs.Button,
|
|
2284
2887
|
{
|
|
2285
2888
|
onClick: handleContinue,
|
|
2286
2889
|
fullWidth: true,
|
|
2287
2890
|
disabled: !amount,
|
|
2288
|
-
children: _optionalChain([uiConfig, 'optionalAccess',
|
|
2891
|
+
children: _optionalChain([uiConfig, 'optionalAccess', _85 => _85.minDepositUsd]) && parseFloat(amount) > 0 && parseFloat(amount) < uiConfig.minDepositUsd ? "Update order" : "Continue"
|
|
2289
2892
|
}
|
|
2290
2893
|
) }),
|
|
2291
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2894
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFLVSQDP4cjs.PoweredBy, {})
|
|
2292
2895
|
] });
|
|
2293
2896
|
}
|
|
2294
2897
|
|
|
@@ -2315,7 +2918,7 @@ function SolanaConfirmStep({
|
|
|
2315
2918
|
}) {
|
|
2316
2919
|
const [isSubmitting, setIsSubmitting] = _react.useState.call(void 0, false);
|
|
2317
2920
|
const [error, setError] = _react.useState.call(void 0, null);
|
|
2318
|
-
const targetSymbol =
|
|
2921
|
+
const targetSymbol = _chunkMUWVDVY4cjs.getTokenSymbol.call(void 0, targetToken, targetChain);
|
|
2319
2922
|
const isSameToken = token.symbol.toUpperCase() === targetSymbol.toUpperCase();
|
|
2320
2923
|
const formattedAmount = sourceAmount && !Number.isNaN(Number(sourceAmount)) ? Number(sourceAmount).toLocaleString("en-US", { maximumFractionDigits: 6 }) : "0";
|
|
2321
2924
|
const formattedReceiveAmount = (() => {
|
|
@@ -2332,7 +2935,7 @@ function SolanaConfirmStep({
|
|
|
2332
2935
|
const receiveAmount = isSameToken ? formattedReceiveAmount : `~ ${formattedReceiveAmount}`;
|
|
2333
2936
|
const handleConfirm = async () => {
|
|
2334
2937
|
if (!solanaProvider) {
|
|
2335
|
-
|
|
2938
|
+
_chunkFLVSQDP4cjs.debugLog.call(void 0, debug, "solana-confirm", "submit:blocked", {
|
|
2336
2939
|
reason: "missing-provider"
|
|
2337
2940
|
});
|
|
2338
2941
|
setError("Solana wallet not connected");
|
|
@@ -2340,7 +2943,7 @@ function SolanaConfirmStep({
|
|
|
2340
2943
|
}
|
|
2341
2944
|
const parsedAmount = parseFloat(sourceAmount);
|
|
2342
2945
|
if (isNaN(parsedAmount) || parsedAmount <= 0) {
|
|
2343
|
-
|
|
2946
|
+
_chunkFLVSQDP4cjs.debugLog.call(void 0, debug, "solana-confirm", "submit:blocked", {
|
|
2344
2947
|
reason: "invalid-amount",
|
|
2345
2948
|
sourceAmount
|
|
2346
2949
|
});
|
|
@@ -2349,7 +2952,7 @@ function SolanaConfirmStep({
|
|
|
2349
2952
|
}
|
|
2350
2953
|
setError(null);
|
|
2351
2954
|
setIsSubmitting(true);
|
|
2352
|
-
|
|
2955
|
+
_chunkFLVSQDP4cjs.debugLog.call(void 0, debug, "solana-confirm", "submit:start", {
|
|
2353
2956
|
smartAccount,
|
|
2354
2957
|
solanaAddress,
|
|
2355
2958
|
solanaDepositAddress,
|
|
@@ -2359,7 +2962,7 @@ function SolanaConfirmStep({
|
|
|
2359
2962
|
});
|
|
2360
2963
|
try {
|
|
2361
2964
|
const check = await service.checkAccount(smartAccount);
|
|
2362
|
-
|
|
2965
|
+
_chunkFLVSQDP4cjs.debugLog.call(void 0, debug, "solana-confirm", "check:success", {
|
|
2363
2966
|
smartAccount,
|
|
2364
2967
|
isRegistered: check.isRegistered,
|
|
2365
2968
|
targetChain: check.targetChain,
|
|
@@ -2372,7 +2975,7 @@ function SolanaConfirmStep({
|
|
|
2372
2975
|
}
|
|
2373
2976
|
const connection = getSolanaConnection();
|
|
2374
2977
|
const amountUnits = _viem.parseUnits.call(void 0, sourceAmount, token.decimals);
|
|
2375
|
-
|
|
2978
|
+
_chunkFLVSQDP4cjs.debugLog.call(void 0, debug, "solana-confirm", "tx:build:start", {
|
|
2376
2979
|
token: token.symbol,
|
|
2377
2980
|
sourceAmount,
|
|
2378
2981
|
amountUnits: amountUnits.toString()
|
|
@@ -2389,10 +2992,10 @@ function SolanaConfirmStep({
|
|
|
2389
2992
|
token.mint,
|
|
2390
2993
|
amountUnits
|
|
2391
2994
|
);
|
|
2392
|
-
|
|
2995
|
+
_chunkFLVSQDP4cjs.debugLog.call(void 0, debug, "solana-confirm", "tx:build:success", {
|
|
2393
2996
|
token: token.symbol,
|
|
2394
2997
|
instructionCount: transaction.instructions.length,
|
|
2395
|
-
feePayer: _optionalChain([transaction, 'access',
|
|
2998
|
+
feePayer: _optionalChain([transaction, 'access', _86 => _86.feePayer, 'optionalAccess', _87 => _87.toBase58, 'call', _88 => _88()]),
|
|
2396
2999
|
recentBlockhash: transaction.recentBlockhash
|
|
2397
3000
|
});
|
|
2398
3001
|
const txHash = await sendSolanaTransaction(
|
|
@@ -2400,21 +3003,21 @@ function SolanaConfirmStep({
|
|
|
2400
3003
|
connection,
|
|
2401
3004
|
transaction
|
|
2402
3005
|
);
|
|
2403
|
-
|
|
3006
|
+
_chunkFLVSQDP4cjs.debugLog.call(void 0, debug, "solana-confirm", "tx:sent", {
|
|
2404
3007
|
txHash,
|
|
2405
3008
|
amountUnits: amountUnits.toString()
|
|
2406
3009
|
});
|
|
2407
3010
|
onConfirm(txHash, amountUnits.toString());
|
|
2408
3011
|
} catch (err) {
|
|
2409
3012
|
const raw = err instanceof Error ? err.message : "Transfer failed";
|
|
2410
|
-
const message =
|
|
2411
|
-
|
|
3013
|
+
const message = _chunkFLVSQDP4cjs.formatUserError.call(void 0, raw);
|
|
3014
|
+
_chunkFLVSQDP4cjs.debugError.call(void 0, debug, "solana-confirm", "submit:failure", err, {
|
|
2412
3015
|
smartAccount,
|
|
2413
3016
|
token: token.symbol,
|
|
2414
3017
|
sourceAmount
|
|
2415
3018
|
});
|
|
2416
3019
|
setError(message);
|
|
2417
|
-
_optionalChain([onError, 'optionalCall',
|
|
3020
|
+
_optionalChain([onError, 'optionalCall', _89 => _89(message, "SOLANA_TRANSFER_ERROR")]);
|
|
2418
3021
|
} finally {
|
|
2419
3022
|
setIsSubmitting(false);
|
|
2420
3023
|
}
|
|
@@ -2431,15 +3034,15 @@ function SolanaConfirmStep({
|
|
|
2431
3034
|
className: "rs-card-value",
|
|
2432
3035
|
style: { display: "flex", alignItems: "center", gap: 8 },
|
|
2433
3036
|
children: [
|
|
2434
|
-
|
|
3037
|
+
_chunkMUWVDVY4cjs.getChainIcon.call(void 0, "solana") && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2435
3038
|
"img",
|
|
2436
3039
|
{
|
|
2437
|
-
src:
|
|
3040
|
+
src: _chunkMUWVDVY4cjs.getChainIcon.call(void 0, "solana"),
|
|
2438
3041
|
alt: "",
|
|
2439
3042
|
style: { width: 16, height: 16, borderRadius: 3 }
|
|
2440
3043
|
}
|
|
2441
3044
|
),
|
|
2442
|
-
|
|
3045
|
+
_chunkMUWVDVY4cjs.getChainName.call(void 0, "solana")
|
|
2443
3046
|
]
|
|
2444
3047
|
}
|
|
2445
3048
|
)
|
|
@@ -2452,15 +3055,15 @@ function SolanaConfirmStep({
|
|
|
2452
3055
|
className: "rs-card-value",
|
|
2453
3056
|
style: { display: "flex", alignItems: "center", gap: 8 },
|
|
2454
3057
|
children: [
|
|
2455
|
-
|
|
3058
|
+
_chunkMUWVDVY4cjs.getChainIcon.call(void 0, targetChain) && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2456
3059
|
"img",
|
|
2457
3060
|
{
|
|
2458
|
-
src:
|
|
3061
|
+
src: _chunkMUWVDVY4cjs.getChainIcon.call(void 0, targetChain),
|
|
2459
3062
|
alt: "",
|
|
2460
3063
|
style: { width: 16, height: 16, borderRadius: 3 }
|
|
2461
3064
|
}
|
|
2462
3065
|
),
|
|
2463
|
-
|
|
3066
|
+
_chunkMUWVDVY4cjs.getChainName.call(void 0, targetChain)
|
|
2464
3067
|
]
|
|
2465
3068
|
}
|
|
2466
3069
|
)
|
|
@@ -2479,10 +3082,10 @@ function SolanaConfirmStep({
|
|
|
2479
3082
|
className: "rs-card-value",
|
|
2480
3083
|
style: { display: "flex", alignItems: "center", gap: 6 },
|
|
2481
3084
|
children: [
|
|
2482
|
-
|
|
3085
|
+
_chunkMUWVDVY4cjs.getTokenIcon.call(void 0, token.symbol) && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2483
3086
|
"img",
|
|
2484
3087
|
{
|
|
2485
|
-
src:
|
|
3088
|
+
src: _chunkMUWVDVY4cjs.getTokenIcon.call(void 0, token.symbol),
|
|
2486
3089
|
alt: "",
|
|
2487
3090
|
style: { width: 16, height: 16, borderRadius: "50%" }
|
|
2488
3091
|
}
|
|
@@ -2502,10 +3105,10 @@ function SolanaConfirmStep({
|
|
|
2502
3105
|
className: "rs-card-value",
|
|
2503
3106
|
style: { display: "flex", alignItems: "center", gap: 6 },
|
|
2504
3107
|
children: [
|
|
2505
|
-
|
|
3108
|
+
_chunkMUWVDVY4cjs.getTokenIcon.call(void 0, targetSymbol) && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2506
3109
|
"img",
|
|
2507
3110
|
{
|
|
2508
|
-
src:
|
|
3111
|
+
src: _chunkMUWVDVY4cjs.getTokenIcon.call(void 0, targetSymbol),
|
|
2509
3112
|
alt: "",
|
|
2510
3113
|
style: { width: 16, height: 16, borderRadius: "50%" }
|
|
2511
3114
|
}
|
|
@@ -2541,7 +3144,7 @@ function SolanaConfirmStep({
|
|
|
2541
3144
|
] })
|
|
2542
3145
|
] }),
|
|
2543
3146
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-step-footer", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2544
|
-
|
|
3147
|
+
_chunkFLVSQDP4cjs.Button,
|
|
2545
3148
|
{
|
|
2546
3149
|
onClick: handleConfirm,
|
|
2547
3150
|
loading: isSubmitting,
|
|
@@ -2550,14 +3153,14 @@ function SolanaConfirmStep({
|
|
|
2550
3153
|
children: "Confirm Order"
|
|
2551
3154
|
}
|
|
2552
3155
|
) }),
|
|
2553
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3156
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFLVSQDP4cjs.PoweredBy, {})
|
|
2554
3157
|
] });
|
|
2555
3158
|
}
|
|
2556
3159
|
|
|
2557
3160
|
// src/DepositFlow.tsx
|
|
2558
3161
|
|
|
2559
3162
|
var QR_AUTO_ADVANCE_HYDRATION_GRACE_MS = 1e3;
|
|
2560
|
-
function
|
|
3163
|
+
function isSameRoute2(sourceChain, sourceToken, targetChain, targetToken) {
|
|
2561
3164
|
return sourceChain === targetChain && sourceToken.toLowerCase() === targetToken.toLowerCase();
|
|
2562
3165
|
}
|
|
2563
3166
|
function getAddressKey(address) {
|
|
@@ -2576,7 +3179,9 @@ function DepositFlow({
|
|
|
2576
3179
|
amount: defaultAmount,
|
|
2577
3180
|
recipient,
|
|
2578
3181
|
postBridgeActions,
|
|
2579
|
-
|
|
3182
|
+
outputTokenRules,
|
|
3183
|
+
rejectUnmapped,
|
|
3184
|
+
signerAddress = _chunkMUWVDVY4cjs.DEFAULT_SIGNER_ADDRESS,
|
|
2580
3185
|
sessionChainIds,
|
|
2581
3186
|
forceRegister = false,
|
|
2582
3187
|
waitForFinalTx = true,
|
|
@@ -2600,12 +3205,16 @@ function DepositFlow({
|
|
|
2600
3205
|
onError,
|
|
2601
3206
|
debug
|
|
2602
3207
|
}) {
|
|
2603
|
-
const onStepChangeRef =
|
|
2604
|
-
const onTotalBalanceChangeRef =
|
|
2605
|
-
const onSmartAccountChangeRef =
|
|
2606
|
-
const onEventRef =
|
|
3208
|
+
const onStepChangeRef = _chunkFLVSQDP4cjs.useLatestRef.call(void 0, onStepChange);
|
|
3209
|
+
const onTotalBalanceChangeRef = _chunkFLVSQDP4cjs.useLatestRef.call(void 0, onTotalBalanceChange);
|
|
3210
|
+
const onSmartAccountChangeRef = _chunkFLVSQDP4cjs.useLatestRef.call(void 0, onSmartAccountChange);
|
|
3211
|
+
const onEventRef = _chunkFLVSQDP4cjs.useLatestRef.call(void 0, onEvent);
|
|
3212
|
+
const onDepositSubmittedRef = _chunkFLVSQDP4cjs.useLatestRef.call(void 0, onDepositSubmitted);
|
|
3213
|
+
const onDepositCompleteRef = _chunkFLVSQDP4cjs.useLatestRef.call(void 0, onDepositComplete);
|
|
3214
|
+
const onDepositFailedRef = _chunkFLVSQDP4cjs.useLatestRef.call(void 0, onDepositFailed);
|
|
3215
|
+
const onErrorRef = _chunkFLVSQDP4cjs.useLatestRef.call(void 0, onError);
|
|
2607
3216
|
const hasInitialReownSession = Boolean(
|
|
2608
|
-
enableSolana ? _optionalChain([reownWallet, 'optionalAccess',
|
|
3217
|
+
enableSolana ? _optionalChain([reownWallet, 'optionalAccess', _90 => _90.isConnected]) || _optionalChain([reownWallet, 'optionalAccess', _91 => _91.address]) : _optionalChain([reownWallet, 'optionalAccess', _92 => _92.address])
|
|
2609
3218
|
);
|
|
2610
3219
|
const hasInitialWalletHydrationPending = Boolean(
|
|
2611
3220
|
dappAddress && (hasDappWalletClientProp && dappWalletClient === void 0 || reownWallet && !hasInitialReownSession && !reownWallet.isReady)
|
|
@@ -2623,13 +3232,13 @@ function DepositFlow({
|
|
|
2623
3232
|
flowModeRef.current = flowMode;
|
|
2624
3233
|
const logFlow = _react.useCallback.call(void 0,
|
|
2625
3234
|
(message, data) => {
|
|
2626
|
-
|
|
3235
|
+
_chunkFLVSQDP4cjs.debugLog.call(void 0, debug, "deposit-flow", message, data);
|
|
2627
3236
|
},
|
|
2628
3237
|
[debug]
|
|
2629
3238
|
);
|
|
2630
3239
|
const logFlowError = _react.useCallback.call(void 0,
|
|
2631
3240
|
(message, error, data) => {
|
|
2632
|
-
|
|
3241
|
+
_chunkFLVSQDP4cjs.debugError.call(void 0, debug, "deposit-flow", message, error, data);
|
|
2633
3242
|
},
|
|
2634
3243
|
[debug]
|
|
2635
3244
|
);
|
|
@@ -2641,21 +3250,23 @@ function DepositFlow({
|
|
|
2641
3250
|
for (const asset of portfolioAssetsRef.current) {
|
|
2642
3251
|
if (asset.symbol.toLowerCase() === sym && asset.balanceUsd && asset.balance) {
|
|
2643
3252
|
try {
|
|
2644
|
-
const balanceUnits = Number(
|
|
3253
|
+
const balanceUnits = Number(
|
|
3254
|
+
_viem.formatUnits.call(void 0, BigInt(asset.balance), asset.decimals)
|
|
3255
|
+
);
|
|
2645
3256
|
if (balanceUnits > 0) return asset.balanceUsd / balanceUnits;
|
|
2646
|
-
} catch (
|
|
3257
|
+
} catch (e22) {
|
|
2647
3258
|
}
|
|
2648
3259
|
}
|
|
2649
3260
|
}
|
|
2650
3261
|
return null;
|
|
2651
3262
|
}, []);
|
|
2652
3263
|
const dappSwitchChain = _react.useMemo.call(void 0, () => {
|
|
2653
|
-
if (!_optionalChain([dappWalletClient, 'optionalAccess',
|
|
3264
|
+
if (!_optionalChain([dappWalletClient, 'optionalAccess', _93 => _93.switchChain])) return void 0;
|
|
2654
3265
|
return async (chainId) => {
|
|
2655
|
-
await _optionalChain([dappWalletClient, 'access',
|
|
3266
|
+
await _optionalChain([dappWalletClient, 'access', _94 => _94.switchChain, 'optionalCall', _95 => _95({ id: chainId })]);
|
|
2656
3267
|
};
|
|
2657
3268
|
}, [dappWalletClient]);
|
|
2658
|
-
const connectedWalletAddress = _nullishCoalesce(_optionalChain([dappWalletClient, 'optionalAccess',
|
|
3269
|
+
const connectedWalletAddress = _nullishCoalesce(_optionalChain([dappWalletClient, 'optionalAccess', _96 => _96.account, 'optionalAccess', _97 => _97.address]), () => ( null));
|
|
2659
3270
|
const walletOptions = _react.useMemo.call(void 0, () => {
|
|
2660
3271
|
const options = [];
|
|
2661
3272
|
const seen = /* @__PURE__ */ new Set();
|
|
@@ -2669,7 +3280,7 @@ function DepositFlow({
|
|
|
2669
3280
|
});
|
|
2670
3281
|
seen.add(id);
|
|
2671
3282
|
}
|
|
2672
|
-
if (enableSolana && _optionalChain([reownWallet, 'optionalAccess',
|
|
3283
|
+
if (enableSolana && _optionalChain([reownWallet, 'optionalAccess', _98 => _98.isConnected]) && reownWallet.isSolana && reownWallet.solanaAddress && dappAddress) {
|
|
2673
3284
|
const id = _nullishCoalesce(reownWallet.caipAddress, () => ( `solana:${reownWallet.solanaAddress}`));
|
|
2674
3285
|
if (!seen.has(id)) {
|
|
2675
3286
|
options.push({
|
|
@@ -2681,7 +3292,7 @@ function DepositFlow({
|
|
|
2681
3292
|
});
|
|
2682
3293
|
seen.add(id);
|
|
2683
3294
|
}
|
|
2684
|
-
} else if (_optionalChain([reownWallet, 'optionalAccess',
|
|
3295
|
+
} else if (_optionalChain([reownWallet, 'optionalAccess', _99 => _99.address]) && reownWallet.isConnected && reownWallet.walletClient && reownWallet.publicClient && !seen.has(`evm:${reownWallet.address.toLowerCase()}`)) {
|
|
2685
3296
|
const id = `evm:${reownWallet.address.toLowerCase()}`;
|
|
2686
3297
|
if (!seen.has(id)) {
|
|
2687
3298
|
options.push({
|
|
@@ -2698,20 +3309,20 @@ function DepositFlow({
|
|
|
2698
3309
|
}, [
|
|
2699
3310
|
connectedWalletAddress,
|
|
2700
3311
|
dappAddress,
|
|
2701
|
-
_optionalChain([reownWallet, 'optionalAccess',
|
|
2702
|
-
_optionalChain([reownWallet, 'optionalAccess',
|
|
2703
|
-
_optionalChain([reownWallet, 'optionalAccess',
|
|
2704
|
-
_optionalChain([reownWallet, 'optionalAccess',
|
|
2705
|
-
_optionalChain([reownWallet, 'optionalAccess',
|
|
3312
|
+
_optionalChain([reownWallet, 'optionalAccess', _100 => _100.address]),
|
|
3313
|
+
_optionalChain([reownWallet, 'optionalAccess', _101 => _101.isConnected]),
|
|
3314
|
+
_optionalChain([reownWallet, 'optionalAccess', _102 => _102.walletClient]),
|
|
3315
|
+
_optionalChain([reownWallet, 'optionalAccess', _103 => _103.publicClient]),
|
|
3316
|
+
_optionalChain([reownWallet, 'optionalAccess', _104 => _104.icon]),
|
|
2706
3317
|
enableSolana,
|
|
2707
|
-
_optionalChain([reownWallet, 'optionalAccess',
|
|
2708
|
-
_optionalChain([reownWallet, 'optionalAccess',
|
|
2709
|
-
_optionalChain([reownWallet, 'optionalAccess',
|
|
3318
|
+
_optionalChain([reownWallet, 'optionalAccess', _105 => _105.isSolana]),
|
|
3319
|
+
_optionalChain([reownWallet, 'optionalAccess', _106 => _106.solanaAddress]),
|
|
3320
|
+
_optionalChain([reownWallet, 'optionalAccess', _107 => _107.caipAddress])
|
|
2710
3321
|
]);
|
|
2711
|
-
const canAutoLock = _optionalChain([dappWalletClient, 'optionalAccess',
|
|
3322
|
+
const canAutoLock = _optionalChain([dappWalletClient, 'optionalAccess', _108 => _108.account]) && dappAddress && !reownWallet;
|
|
2712
3323
|
const hasWalletOptions = walletOptions.length > 0;
|
|
2713
3324
|
const hasReownSession = Boolean(
|
|
2714
|
-
enableSolana ? _optionalChain([reownWallet, 'optionalAccess',
|
|
3325
|
+
enableSolana ? _optionalChain([reownWallet, 'optionalAccess', _109 => _109.isConnected]) || _optionalChain([reownWallet, 'optionalAccess', _110 => _110.address]) : _optionalChain([reownWallet, 'optionalAccess', _111 => _111.address])
|
|
2715
3326
|
);
|
|
2716
3327
|
const isWalletHydrationPending = Boolean(
|
|
2717
3328
|
dappAddress && !hasWalletOptions && (hasDappWalletClientProp && dappWalletClient === void 0 || reownWallet && !hasReownSession && !reownWallet.isReady)
|
|
@@ -2751,16 +3362,16 @@ function DepositFlow({
|
|
|
2751
3362
|
return {
|
|
2752
3363
|
ownerAddress: dappAddress,
|
|
2753
3364
|
walletClient: void 0,
|
|
2754
|
-
publicClient: _nullishCoalesce(dappPublicClient, () => (
|
|
3365
|
+
publicClient: _nullishCoalesce(dappPublicClient, () => ( _chunkFLVSQDP4cjs.getPublicClient.call(void 0, targetChain))),
|
|
2755
3366
|
switchChain: void 0
|
|
2756
3367
|
};
|
|
2757
3368
|
}
|
|
2758
3369
|
if (canAutoLock) {
|
|
2759
|
-
const fallbackChainId = _nullishCoalesce(_optionalChain([dappWalletClient, 'optionalAccess',
|
|
3370
|
+
const fallbackChainId = _nullishCoalesce(_optionalChain([dappWalletClient, 'optionalAccess', _112 => _112.chain, 'optionalAccess', _113 => _113.id]), () => ( targetChain));
|
|
2760
3371
|
return {
|
|
2761
3372
|
ownerAddress: dappWalletClient.account.address,
|
|
2762
3373
|
walletClient: dappWalletClient,
|
|
2763
|
-
publicClient: _nullishCoalesce(dappPublicClient, () => (
|
|
3374
|
+
publicClient: _nullishCoalesce(dappPublicClient, () => ( _chunkFLVSQDP4cjs.getPublicClient.call(void 0, fallbackChainId))),
|
|
2764
3375
|
switchChain: dappSwitchChain
|
|
2765
3376
|
};
|
|
2766
3377
|
}
|
|
@@ -2774,24 +3385,24 @@ function DepositFlow({
|
|
|
2774
3385
|
return {
|
|
2775
3386
|
ownerAddress: dappAddress,
|
|
2776
3387
|
walletClient: void 0,
|
|
2777
|
-
publicClient: _nullishCoalesce(dappPublicClient, () => (
|
|
3388
|
+
publicClient: _nullishCoalesce(dappPublicClient, () => ( _chunkFLVSQDP4cjs.getPublicClient.call(void 0, targetChain))),
|
|
2778
3389
|
switchChain: void 0
|
|
2779
3390
|
};
|
|
2780
3391
|
}
|
|
2781
|
-
if (selectedOption.kind === "connected" && _optionalChain([dappWalletClient, 'optionalAccess',
|
|
2782
|
-
const fallbackChainId = _nullishCoalesce(_optionalChain([dappWalletClient, 'optionalAccess',
|
|
3392
|
+
if (selectedOption.kind === "connected" && _optionalChain([dappWalletClient, 'optionalAccess', _114 => _114.account]) && selectedOption.address && dappWalletClient.account.address.toLowerCase() === selectedOption.address.toLowerCase()) {
|
|
3393
|
+
const fallbackChainId = _nullishCoalesce(_optionalChain([dappWalletClient, 'optionalAccess', _115 => _115.chain, 'optionalAccess', _116 => _116.id]), () => ( targetChain));
|
|
2783
3394
|
return {
|
|
2784
3395
|
ownerAddress: dappWalletClient.account.address,
|
|
2785
3396
|
walletClient: dappWalletClient,
|
|
2786
|
-
publicClient: _nullishCoalesce(dappPublicClient, () => (
|
|
3397
|
+
publicClient: _nullishCoalesce(dappPublicClient, () => ( _chunkFLVSQDP4cjs.getPublicClient.call(void 0, fallbackChainId))),
|
|
2787
3398
|
switchChain: dappSwitchChain
|
|
2788
3399
|
};
|
|
2789
3400
|
}
|
|
2790
|
-
if (selectedOption.kind === "external" && _optionalChain([reownWallet, 'optionalAccess',
|
|
3401
|
+
if (selectedOption.kind === "external" && _optionalChain([reownWallet, 'optionalAccess', _117 => _117.address]) && selectedOption.address && reownWallet.address.toLowerCase() === selectedOption.address.toLowerCase()) {
|
|
2791
3402
|
return {
|
|
2792
3403
|
ownerAddress: reownWallet.address,
|
|
2793
3404
|
walletClient: reownWallet.walletClient,
|
|
2794
|
-
publicClient: _nullishCoalesce(reownWallet.publicClient, () => (
|
|
3405
|
+
publicClient: _nullishCoalesce(reownWallet.publicClient, () => ( _chunkFLVSQDP4cjs.getPublicClient.call(void 0, targetChain))),
|
|
2795
3406
|
switchChain: reownWallet.switchChain
|
|
2796
3407
|
};
|
|
2797
3408
|
}
|
|
@@ -2829,7 +3440,7 @@ function DepositFlow({
|
|
|
2829
3440
|
return {
|
|
2830
3441
|
ownerAddress: dappAddress,
|
|
2831
3442
|
walletClient: void 0,
|
|
2832
|
-
publicClient: _nullishCoalesce(dappPublicClient, () => (
|
|
3443
|
+
publicClient: _nullishCoalesce(dappPublicClient, () => ( _chunkFLVSQDP4cjs.getPublicClient.call(void 0, targetChain))),
|
|
2833
3444
|
switchChain: void 0
|
|
2834
3445
|
};
|
|
2835
3446
|
}
|
|
@@ -2851,7 +3462,7 @@ function DepositFlow({
|
|
|
2851
3462
|
walletSignerContext,
|
|
2852
3463
|
walletSelectionKey
|
|
2853
3464
|
]);
|
|
2854
|
-
const sessionKeyAddress = _nullishCoalesce(_nullishCoalesce(dappAddress, () => ( _optionalChain([signerContext, 'optionalAccess',
|
|
3465
|
+
const sessionKeyAddress = _nullishCoalesce(_nullishCoalesce(dappAddress, () => ( _optionalChain([signerContext, 'optionalAccess', _118 => _118.ownerAddress]))), () => ( null));
|
|
2855
3466
|
const lastTargetRef = _react.useRef.call(void 0, null);
|
|
2856
3467
|
_react.useEffect.call(void 0, () => {
|
|
2857
3468
|
const prev = lastTargetRef.current;
|
|
@@ -2928,7 +3539,7 @@ function DepositFlow({
|
|
|
2928
3539
|
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
3540
|
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
3541
|
_react.useEffect.call(void 0, () => {
|
|
2931
|
-
_optionalChain([onStepChangeRef, 'access',
|
|
3542
|
+
_optionalChain([onStepChangeRef, 'access', _119 => _119.current, 'optionalCall', _120 => _120(stepIndex, currentBackHandler)]);
|
|
2932
3543
|
}, [stepIndex, currentBackHandler, onStepChangeRef]);
|
|
2933
3544
|
const stepSendToken = step.type === "amount" ? step.asset.symbol : null;
|
|
2934
3545
|
const stepOpenEventKey = step.type === "select-asset" ? "select-asset" : step.type === "deposit-address" ? "deposit-address" : step.type === "amount" && stepSendToken ? `amount:${stepSendToken.toLowerCase()}` : null;
|
|
@@ -2943,23 +3554,23 @@ function DepositFlow({
|
|
|
2943
3554
|
}
|
|
2944
3555
|
lastStepOpenEventKeyRef.current = stepOpenEventKey;
|
|
2945
3556
|
if (step.type === "select-asset") {
|
|
2946
|
-
_optionalChain([onEventRef, 'access',
|
|
3557
|
+
_optionalChain([onEventRef, 'access', _121 => _121.current, 'optionalCall', _122 => _122({
|
|
2947
3558
|
type: "deposit_modal_connected_wallet_select_source_open",
|
|
2948
3559
|
total_balance_in_external_wallet: totalBalanceUsd,
|
|
2949
3560
|
pred_balance: totalBalanceUsd
|
|
2950
3561
|
})]);
|
|
2951
3562
|
} else if (step.type === "deposit-address") {
|
|
2952
|
-
const chainName =
|
|
2953
|
-
const tokenSymbol =
|
|
2954
|
-
_optionalChain([onEventRef, 'access',
|
|
3563
|
+
const chainName = _chunkMUWVDVY4cjs.getChainName.call(void 0, targetChain);
|
|
3564
|
+
const tokenSymbol = _chunkMUWVDVY4cjs.getTokenSymbol.call(void 0, targetToken, targetChain);
|
|
3565
|
+
_optionalChain([onEventRef, 'access', _123 => _123.current, 'optionalCall', _124 => _124({
|
|
2955
3566
|
type: "deposit_modal_transfer_crypto_open",
|
|
2956
3567
|
default_chain: chainName,
|
|
2957
3568
|
default_token: tokenSymbol,
|
|
2958
3569
|
pred_balance: totalBalanceUsd
|
|
2959
3570
|
})]);
|
|
2960
3571
|
} else if (step.type === "amount" && stepSendToken) {
|
|
2961
|
-
const receiveSymbol =
|
|
2962
|
-
_optionalChain([onEventRef, 'access',
|
|
3572
|
+
const receiveSymbol = _chunkMUWVDVY4cjs.getTokenSymbol.call(void 0, targetToken, targetChain);
|
|
3573
|
+
_optionalChain([onEventRef, 'access', _125 => _125.current, 'optionalCall', _126 => _126({
|
|
2963
3574
|
type: "deposit_modal_connected_wallet_enter_value_open",
|
|
2964
3575
|
send_token: stepSendToken,
|
|
2965
3576
|
receive_token: receiveSymbol,
|
|
@@ -2992,7 +3603,7 @@ function DepositFlow({
|
|
|
2992
3603
|
targetToken
|
|
2993
3604
|
]);
|
|
2994
3605
|
_react.useEffect.call(void 0, () => {
|
|
2995
|
-
_optionalChain([onTotalBalanceChangeRef, 'access',
|
|
3606
|
+
_optionalChain([onTotalBalanceChangeRef, 'access', _127 => _127.current, 'optionalCall', _128 => _128(totalBalanceUsd)]);
|
|
2996
3607
|
}, [totalBalanceUsd, onTotalBalanceChangeRef]);
|
|
2997
3608
|
const isDepositAddressMode = flowMode === "deposit-address";
|
|
2998
3609
|
const isSolanaWalletMode = flowMode === "solana-wallet";
|
|
@@ -3007,7 +3618,7 @@ function DepositFlow({
|
|
|
3007
3618
|
setStep({ type: "setup" });
|
|
3008
3619
|
}, []);
|
|
3009
3620
|
const handleNewDeposit = _react.useCallback.call(void 0, () => {
|
|
3010
|
-
_optionalChain([onSmartAccountChangeRef, 'access',
|
|
3621
|
+
_optionalChain([onSmartAccountChangeRef, 'access', _129 => _129.current, 'optionalCall', _130 => _130(null)]);
|
|
3011
3622
|
setFlowMode(null);
|
|
3012
3623
|
setStep({ type: "setup" });
|
|
3013
3624
|
setIsConnectSelectionConfirmed(false);
|
|
@@ -3021,7 +3632,7 @@ function DepositFlow({
|
|
|
3021
3632
|
hasSolanaDepositAddress: Boolean(solanaDepositAddress),
|
|
3022
3633
|
flowMode: isDepositAddressMode ? "deposit-address" : isSolanaWalletMode ? "solana-wallet" : "wallet"
|
|
3023
3634
|
});
|
|
3024
|
-
_optionalChain([onSmartAccountChangeRef, 'access',
|
|
3635
|
+
_optionalChain([onSmartAccountChangeRef, 'access', _131 => _131.current, 'optionalCall', _132 => _132(smartAccount)]);
|
|
3025
3636
|
if (isDepositAddressMode) {
|
|
3026
3637
|
setStep({
|
|
3027
3638
|
type: "deposit-address",
|
|
@@ -3036,7 +3647,7 @@ function DepositFlow({
|
|
|
3036
3647
|
solanaDepositAddress
|
|
3037
3648
|
});
|
|
3038
3649
|
} else {
|
|
3039
|
-
_optionalChain([onError, 'optionalCall',
|
|
3650
|
+
_optionalChain([onError, 'optionalCall', _133 => _133({
|
|
3040
3651
|
message: "Solana deposit address not available. Please try again.",
|
|
3041
3652
|
code: "SOLANA_SETUP_FAILED"
|
|
3042
3653
|
})]);
|
|
@@ -3047,33 +3658,16 @@ function DepositFlow({
|
|
|
3047
3658
|
},
|
|
3048
3659
|
[isDepositAddressMode, isSolanaWalletMode, logFlow, onSmartAccountChangeRef]
|
|
3049
3660
|
);
|
|
3050
|
-
const
|
|
3051
|
-
(
|
|
3661
|
+
const handleDepositAddressSubmitted = _react.useCallback.call(void 0,
|
|
3662
|
+
(data) => {
|
|
3052
3663
|
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
|
-
};
|
|
3664
|
+
txHash: data.txHash,
|
|
3665
|
+
sourceChain: data.sourceChain,
|
|
3666
|
+
amount: data.amount
|
|
3073
3667
|
});
|
|
3074
|
-
_optionalChain([
|
|
3668
|
+
_optionalChain([onDepositSubmittedRef, 'access', _134 => _134.current, 'optionalCall', _135 => _135(data)]);
|
|
3075
3669
|
},
|
|
3076
|
-
[
|
|
3670
|
+
[logFlow, onDepositSubmittedRef]
|
|
3077
3671
|
);
|
|
3078
3672
|
const handleSolanaTokenContinue = _react.useCallback.call(void 0,
|
|
3079
3673
|
(token, balance, balanceUsd) => {
|
|
@@ -3095,8 +3689,8 @@ function DepositFlow({
|
|
|
3095
3689
|
);
|
|
3096
3690
|
const handleSolanaAmountContinue = _react.useCallback.call(void 0,
|
|
3097
3691
|
(token, sourceAmount, inputAmountUsd) => {
|
|
3098
|
-
const targetSym =
|
|
3099
|
-
const isTargetStable =
|
|
3692
|
+
const targetSym = _chunkMUWVDVY4cjs.getTokenSymbol.call(void 0, targetToken, targetChain);
|
|
3693
|
+
const isTargetStable = _chunkMUWVDVY4cjs.isStablecoinSymbol.call(void 0, targetSym);
|
|
3100
3694
|
const targetTokenPriceUsd = isTargetStable ? 1 : getTokenPriceUsd(targetSym);
|
|
3101
3695
|
logFlow("solana:amount:continue", {
|
|
3102
3696
|
token: token.symbol,
|
|
@@ -3143,7 +3737,7 @@ function DepositFlow({
|
|
|
3143
3737
|
sourceDecimals: prev.token.decimals
|
|
3144
3738
|
};
|
|
3145
3739
|
});
|
|
3146
|
-
_optionalChain([onDepositSubmitted, 'optionalCall',
|
|
3740
|
+
_optionalChain([onDepositSubmitted, 'optionalCall', _136 => _136({
|
|
3147
3741
|
txHash,
|
|
3148
3742
|
sourceChain: "solana",
|
|
3149
3743
|
amount: amountUnits
|
|
@@ -3153,13 +3747,13 @@ function DepositFlow({
|
|
|
3153
3747
|
);
|
|
3154
3748
|
const handleConnected = _react.useCallback.call(void 0,
|
|
3155
3749
|
(addr, smartAccount) => {
|
|
3156
|
-
_optionalChain([onConnected, 'optionalCall',
|
|
3750
|
+
_optionalChain([onConnected, 'optionalCall', _137 => _137({ address: addr, smartAccount })]);
|
|
3157
3751
|
},
|
|
3158
3752
|
[onConnected]
|
|
3159
3753
|
);
|
|
3160
3754
|
const handleAssetContinue = _react.useCallback.call(void 0,
|
|
3161
3755
|
(asset) => {
|
|
3162
|
-
_optionalChain([onEvent, 'optionalCall',
|
|
3756
|
+
_optionalChain([onEvent, 'optionalCall', _138 => _138({
|
|
3163
3757
|
type: "deposit_modal_connected_wallet_select_source_cta_click",
|
|
3164
3758
|
total_balance_in_external_wallet: totalBalanceUsd,
|
|
3165
3759
|
pred_balance: totalBalanceUsd,
|
|
@@ -3181,8 +3775,8 @@ function DepositFlow({
|
|
|
3181
3775
|
);
|
|
3182
3776
|
const handleAmountContinue = _react.useCallback.call(void 0,
|
|
3183
3777
|
(amount, targetAmount, balance) => {
|
|
3184
|
-
const targetSym =
|
|
3185
|
-
const isTargetStable =
|
|
3778
|
+
const targetSym = _chunkMUWVDVY4cjs.getTokenSymbol.call(void 0, targetToken, targetChain);
|
|
3779
|
+
const isTargetStable = _chunkMUWVDVY4cjs.isStablecoinSymbol.call(void 0, targetSym);
|
|
3186
3780
|
const targetTokenPriceUsd = isTargetStable ? 1 : getTokenPriceUsd(targetSym);
|
|
3187
3781
|
setStep((prev) => {
|
|
3188
3782
|
if (prev.type !== "amount") return prev;
|
|
@@ -3216,7 +3810,7 @@ function DepositFlow({
|
|
|
3216
3810
|
sourceChain: chainId,
|
|
3217
3811
|
sourceToken: token,
|
|
3218
3812
|
amount,
|
|
3219
|
-
directTransfer:
|
|
3813
|
+
directTransfer: isSameRoute2(chainId, token, targetChain, targetToken)
|
|
3220
3814
|
};
|
|
3221
3815
|
});
|
|
3222
3816
|
},
|
|
@@ -3224,30 +3818,30 @@ function DepositFlow({
|
|
|
3224
3818
|
);
|
|
3225
3819
|
const handleDepositSubmittedCallback = _react.useCallback.call(void 0,
|
|
3226
3820
|
(txHash, sourceChain, amount) => {
|
|
3227
|
-
_optionalChain([
|
|
3821
|
+
_optionalChain([onDepositSubmittedRef, 'access', _139 => _139.current, 'optionalCall', _140 => _140({ txHash, sourceChain, amount })]);
|
|
3228
3822
|
},
|
|
3229
|
-
[
|
|
3823
|
+
[onDepositSubmittedRef]
|
|
3230
3824
|
);
|
|
3231
3825
|
const handleDepositComplete = _react.useCallback.call(void 0,
|
|
3232
3826
|
(txHash, destinationTxHash, context) => {
|
|
3233
3827
|
logFlow("deposit:complete", { txHash, destinationTxHash, ...context });
|
|
3234
|
-
_optionalChain([
|
|
3828
|
+
_optionalChain([onDepositCompleteRef, 'access', _141 => _141.current, 'optionalCall', _142 => _142({ txHash, destinationTxHash, ...context })]);
|
|
3235
3829
|
},
|
|
3236
|
-
[logFlow,
|
|
3830
|
+
[logFlow, onDepositCompleteRef]
|
|
3237
3831
|
);
|
|
3238
3832
|
const handleDepositFailed = _react.useCallback.call(void 0,
|
|
3239
3833
|
(txHash, error) => {
|
|
3240
3834
|
logFlowError("deposit:failed", error, { txHash });
|
|
3241
|
-
_optionalChain([
|
|
3835
|
+
_optionalChain([onDepositFailedRef, 'access', _143 => _143.current, 'optionalCall', _144 => _144({ txHash, error })]);
|
|
3242
3836
|
},
|
|
3243
|
-
[logFlowError,
|
|
3837
|
+
[logFlowError, onDepositFailedRef]
|
|
3244
3838
|
);
|
|
3245
3839
|
const handleError = _react.useCallback.call(void 0,
|
|
3246
3840
|
(message, code) => {
|
|
3247
3841
|
logFlowError("flow:error", message, { code });
|
|
3248
|
-
_optionalChain([
|
|
3842
|
+
_optionalChain([onErrorRef, 'access', _145 => _145.current, 'optionalCall', _146 => _146({ message, code })]);
|
|
3249
3843
|
},
|
|
3250
|
-
[logFlowError,
|
|
3844
|
+
[logFlowError, onErrorRef]
|
|
3251
3845
|
);
|
|
3252
3846
|
const handleTotalBalanceComputed = _react.useCallback.call(void 0, (total) => {
|
|
3253
3847
|
setTotalBalanceUsd(total);
|
|
@@ -3302,7 +3896,7 @@ function DepositFlow({
|
|
|
3302
3896
|
if (walletId) {
|
|
3303
3897
|
const selectedOption = walletOptions.find((o) => o.id === walletId);
|
|
3304
3898
|
setSelectedWalletId(walletId);
|
|
3305
|
-
if (enableSolana && _optionalChain([selectedOption, 'optionalAccess',
|
|
3899
|
+
if (enableSolana && _optionalChain([selectedOption, 'optionalAccess', _147 => _147.kind]) === "solana") {
|
|
3306
3900
|
handleSelectSolanaWallet();
|
|
3307
3901
|
} else {
|
|
3308
3902
|
handleSelectProvider();
|
|
@@ -3332,7 +3926,7 @@ function DepositFlow({
|
|
|
3332
3926
|
]);
|
|
3333
3927
|
if (showConnectStep) {
|
|
3334
3928
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-modal-body", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3335
|
-
|
|
3929
|
+
_chunkFLVSQDP4cjs.ConnectStep,
|
|
3336
3930
|
{
|
|
3337
3931
|
walletOptions,
|
|
3338
3932
|
selectedWalletId: selectedWalletIdEffective,
|
|
@@ -3351,7 +3945,7 @@ function DepositFlow({
|
|
|
3351
3945
|
const selectedOption = walletOptions.find(
|
|
3352
3946
|
(o) => o.id === selectedWalletIdEffective
|
|
3353
3947
|
);
|
|
3354
|
-
if (enableSolana && _optionalChain([selectedOption, 'optionalAccess',
|
|
3948
|
+
if (enableSolana && _optionalChain([selectedOption, 'optionalAccess', _148 => _148.kind]) === "solana") {
|
|
3355
3949
|
handleSelectSolanaWallet();
|
|
3356
3950
|
} else {
|
|
3357
3951
|
handleSelectProvider();
|
|
@@ -3375,6 +3969,8 @@ function DepositFlow({
|
|
|
3375
3969
|
sessionChainIds,
|
|
3376
3970
|
recipient,
|
|
3377
3971
|
postBridgeActions,
|
|
3972
|
+
outputTokenRules,
|
|
3973
|
+
rejectUnmapped,
|
|
3378
3974
|
forceRegister,
|
|
3379
3975
|
enableSolana,
|
|
3380
3976
|
service,
|
|
@@ -3390,11 +3986,18 @@ function DepositFlow({
|
|
|
3390
3986
|
solanaDepositAddress: enableSolana ? step.solanaDepositAddress : void 0,
|
|
3391
3987
|
service,
|
|
3392
3988
|
allowedRoutes,
|
|
3393
|
-
|
|
3989
|
+
targetChain,
|
|
3990
|
+
targetToken,
|
|
3991
|
+
waitForFinalTx,
|
|
3992
|
+
hasPostBridgeActions: Boolean(_optionalChain([postBridgeActions, 'optionalAccess', _149 => _149.length])),
|
|
3993
|
+
uiConfig,
|
|
3994
|
+
onDepositSubmitted: handleDepositAddressSubmitted,
|
|
3995
|
+
onDepositComplete: handleDepositComplete,
|
|
3996
|
+
onDepositFailed: handleDepositFailed,
|
|
3394
3997
|
onCopyAddress: () => {
|
|
3395
|
-
const chainName =
|
|
3396
|
-
const tokenSymbol =
|
|
3397
|
-
_optionalChain([onEvent, 'optionalCall',
|
|
3998
|
+
const chainName = _chunkMUWVDVY4cjs.getChainName.call(void 0, targetChain);
|
|
3999
|
+
const tokenSymbol = _chunkMUWVDVY4cjs.getTokenSymbol.call(void 0, targetToken, targetChain);
|
|
4000
|
+
_optionalChain([onEvent, 'optionalCall', _150 => _150({
|
|
3398
4001
|
type: "deposit_modal_transfer_crypto_cta_click",
|
|
3399
4002
|
default_chain: chainName,
|
|
3400
4003
|
default_token: tokenSymbol,
|
|
@@ -3402,29 +4005,6 @@ function DepositFlow({
|
|
|
3402
4005
|
cta_name: "copy"
|
|
3403
4006
|
})]);
|
|
3404
4007
|
},
|
|
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
4008
|
onError: handleError,
|
|
3429
4009
|
debug
|
|
3430
4010
|
}
|
|
@@ -3433,8 +4013,8 @@ function DepositFlow({
|
|
|
3433
4013
|
}
|
|
3434
4014
|
if (isSolanaWalletMode) {
|
|
3435
4015
|
if (!sessionKeyAddress) return null;
|
|
3436
|
-
const solanaAddr = _optionalChain([reownWallet, 'optionalAccess',
|
|
3437
|
-
const solanaProvider = _optionalChain([reownWallet, 'optionalAccess',
|
|
4016
|
+
const solanaAddr = _optionalChain([reownWallet, 'optionalAccess', _151 => _151.solanaAddress]);
|
|
4017
|
+
const solanaProvider = _optionalChain([reownWallet, 'optionalAccess', _152 => _152.solanaProvider]);
|
|
3438
4018
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-modal-body", children: [
|
|
3439
4019
|
step.type === "setup" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3440
4020
|
SetupStep,
|
|
@@ -3446,6 +4026,8 @@ function DepositFlow({
|
|
|
3446
4026
|
sessionChainIds,
|
|
3447
4027
|
recipient,
|
|
3448
4028
|
postBridgeActions,
|
|
4029
|
+
outputTokenRules,
|
|
4030
|
+
rejectUnmapped,
|
|
3449
4031
|
forceRegister,
|
|
3450
4032
|
enableSolana,
|
|
3451
4033
|
service,
|
|
@@ -3530,7 +4112,7 @@ function DepositFlow({
|
|
|
3530
4112
|
) })
|
|
3531
4113
|
] }) : null,
|
|
3532
4114
|
step.type === "processing" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3533
|
-
|
|
4115
|
+
_chunkFLVSQDP4cjs.ProcessingStep,
|
|
3534
4116
|
{
|
|
3535
4117
|
smartAccount: step.smartAccount,
|
|
3536
4118
|
txHash: step.txHash,
|
|
@@ -3542,7 +4124,7 @@ function DepositFlow({
|
|
|
3542
4124
|
sourceSymbol: step.sourceSymbol,
|
|
3543
4125
|
sourceDecimals: step.sourceDecimals,
|
|
3544
4126
|
waitForFinalTx,
|
|
3545
|
-
hasPostBridgeActions: Boolean(_optionalChain([postBridgeActions, 'optionalAccess',
|
|
4127
|
+
hasPostBridgeActions: Boolean(_optionalChain([postBridgeActions, 'optionalAccess', _153 => _153.length])),
|
|
3546
4128
|
service,
|
|
3547
4129
|
directTransfer: step.directTransfer,
|
|
3548
4130
|
onClose,
|
|
@@ -3555,16 +4137,16 @@ function DepositFlow({
|
|
|
3555
4137
|
)
|
|
3556
4138
|
] });
|
|
3557
4139
|
}
|
|
3558
|
-
if (!_optionalChain([signerContext, 'optionalAccess',
|
|
4140
|
+
if (!_optionalChain([signerContext, 'optionalAccess', _154 => _154.walletClient]) || !_optionalChain([signerContext, 'optionalAccess', _155 => _155.publicClient])) {
|
|
3559
4141
|
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
4142
|
}
|
|
3561
4143
|
const ownerAddress = signerContext.ownerAddress;
|
|
3562
|
-
const ownerChainId = _nullishCoalesce(_nullishCoalesce(_optionalChain([signerContext, 'access',
|
|
4144
|
+
const ownerChainId = _nullishCoalesce(_nullishCoalesce(_optionalChain([signerContext, 'access', _156 => _156.walletClient, 'optionalAccess', _157 => _157.chain, 'optionalAccess', _158 => _158.id]), () => ( _optionalChain([signerContext, 'access', _159 => _159.publicClient, 'access', _160 => _160.chain, 'optionalAccess', _161 => _161.id]))), () => ( targetChain));
|
|
3563
4145
|
const getReadClientForChain = (chainId) => {
|
|
3564
|
-
if (_optionalChain([signerContext, 'access',
|
|
4146
|
+
if (_optionalChain([signerContext, 'access', _162 => _162.publicClient, 'access', _163 => _163.chain, 'optionalAccess', _164 => _164.id]) === chainId) {
|
|
3565
4147
|
return signerContext.publicClient;
|
|
3566
4148
|
}
|
|
3567
|
-
return
|
|
4149
|
+
return _chunkFLVSQDP4cjs.getPublicClient.call(void 0, chainId);
|
|
3568
4150
|
};
|
|
3569
4151
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-modal-body", children: [
|
|
3570
4152
|
step.type === "setup" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
@@ -3578,6 +4160,8 @@ function DepositFlow({
|
|
|
3578
4160
|
sessionChainIds,
|
|
3579
4161
|
recipient,
|
|
3580
4162
|
postBridgeActions,
|
|
4163
|
+
outputTokenRules,
|
|
4164
|
+
rejectUnmapped,
|
|
3581
4165
|
forceRegister,
|
|
3582
4166
|
enableSolana,
|
|
3583
4167
|
service,
|
|
@@ -3597,7 +4181,11 @@ function DepositFlow({
|
|
|
3597
4181
|
service,
|
|
3598
4182
|
onContinue: handleAssetContinue,
|
|
3599
4183
|
onTotalBalanceComputed: handleTotalBalanceComputed,
|
|
3600
|
-
onAssetsLoaded: handleAssetsLoaded
|
|
4184
|
+
onAssetsLoaded: handleAssetsLoaded,
|
|
4185
|
+
onDisconnect: onDisconnect ? () => {
|
|
4186
|
+
onDisconnect();
|
|
4187
|
+
handleBackFromSelectAsset();
|
|
4188
|
+
} : void 0
|
|
3601
4189
|
}
|
|
3602
4190
|
),
|
|
3603
4191
|
step.type === "amount" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
@@ -3614,8 +4202,8 @@ function DepositFlow({
|
|
|
3614
4202
|
uiConfig,
|
|
3615
4203
|
onContinue: handleAmountContinue,
|
|
3616
4204
|
onCtaClick: (ctaName) => {
|
|
3617
|
-
const receiveSymbol =
|
|
3618
|
-
_optionalChain([onEvent, 'optionalCall',
|
|
4205
|
+
const receiveSymbol = _chunkMUWVDVY4cjs.getTokenSymbol.call(void 0, targetToken, targetChain);
|
|
4206
|
+
_optionalChain([onEvent, 'optionalCall', _165 => _165({
|
|
3619
4207
|
type: "deposit_modal_connected_wallet_enter_value_cta_click",
|
|
3620
4208
|
send_token: step.asset.symbol,
|
|
3621
4209
|
receive_token: receiveSymbol,
|
|
@@ -3646,7 +4234,7 @@ function DepositFlow({
|
|
|
3646
4234
|
}
|
|
3647
4235
|
),
|
|
3648
4236
|
step.type === "processing" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3649
|
-
|
|
4237
|
+
_chunkFLVSQDP4cjs.ProcessingStep,
|
|
3650
4238
|
{
|
|
3651
4239
|
smartAccount: step.smartAccount,
|
|
3652
4240
|
txHash: step.txHash,
|
|
@@ -3658,7 +4246,7 @@ function DepositFlow({
|
|
|
3658
4246
|
sourceSymbol: step.sourceSymbol,
|
|
3659
4247
|
sourceDecimals: step.sourceDecimals,
|
|
3660
4248
|
waitForFinalTx,
|
|
3661
|
-
hasPostBridgeActions: Boolean(_optionalChain([postBridgeActions, 'optionalAccess',
|
|
4249
|
+
hasPostBridgeActions: Boolean(_optionalChain([postBridgeActions, 'optionalAccess', _166 => _166.length])),
|
|
3662
4250
|
service,
|
|
3663
4251
|
directTransfer: step.directTransfer,
|
|
3664
4252
|
onClose,
|
|
@@ -3679,7 +4267,7 @@ function shortenHash(hash) {
|
|
|
3679
4267
|
if (hash.length <= 14) return hash;
|
|
3680
4268
|
return `${hash.slice(0, 6)}\u2026${hash.slice(-4)}`;
|
|
3681
4269
|
}
|
|
3682
|
-
function
|
|
4270
|
+
function formatTimestamp2(iso) {
|
|
3683
4271
|
try {
|
|
3684
4272
|
const date = new Date(iso);
|
|
3685
4273
|
if (Number.isNaN(date.getTime())) return iso;
|
|
@@ -3696,23 +4284,33 @@ function formatTimestamp(iso) {
|
|
|
3696
4284
|
month: "short",
|
|
3697
4285
|
day: "numeric"
|
|
3698
4286
|
});
|
|
3699
|
-
} catch (
|
|
4287
|
+
} catch (e23) {
|
|
3700
4288
|
return iso;
|
|
3701
4289
|
}
|
|
3702
4290
|
}
|
|
3703
4291
|
function resolveChainId(value) {
|
|
3704
4292
|
if (value === void 0 || value === null) return null;
|
|
3705
4293
|
if (typeof value === "number") return value;
|
|
3706
|
-
if (
|
|
3707
|
-
const parsed =
|
|
4294
|
+
if (_chunkFLVSQDP4cjs.isSolanaCaip2.call(void 0, value) || value === "solana") return "solana";
|
|
4295
|
+
const parsed = _chunkFLVSQDP4cjs.parseEvmChainId.call(void 0, value);
|
|
3708
4296
|
if (parsed !== null) return parsed;
|
|
3709
4297
|
const num = Number(value);
|
|
3710
4298
|
return Number.isFinite(num) ? num : null;
|
|
3711
4299
|
}
|
|
3712
4300
|
function resolveTokenSymbol(token, chainId) {
|
|
3713
4301
|
if (!token) return "";
|
|
4302
|
+
if (chainId === "solana") {
|
|
4303
|
+
const normalized = token.toLowerCase();
|
|
4304
|
+
const matched = SOLANA_TOKENS.find(
|
|
4305
|
+
(entry) => entry.mint.toLowerCase() === normalized
|
|
4306
|
+
);
|
|
4307
|
+
if (matched) return matched.symbol;
|
|
4308
|
+
if (normalized === "native" || normalized === "11111111111111111111111111111111" || normalized === "so11111111111111111111111111111111111111112") {
|
|
4309
|
+
return "SOL";
|
|
4310
|
+
}
|
|
4311
|
+
}
|
|
3714
4312
|
if (chainId !== null && chainId !== void 0 && chainId !== "solana" && /^0x[a-fA-F0-9]{40}$/.test(token)) {
|
|
3715
|
-
const sym =
|
|
4313
|
+
const sym = _chunkMUWVDVY4cjs.getTokenSymbol.call(void 0, token, chainId);
|
|
3716
4314
|
if (sym !== "Token") return sym;
|
|
3717
4315
|
}
|
|
3718
4316
|
return shortenHash(token);
|
|
@@ -3720,12 +4318,24 @@ function resolveTokenSymbol(token, chainId) {
|
|
|
3720
4318
|
function formatAmount(rawAmount, token, chainId) {
|
|
3721
4319
|
if (!rawAmount) return "";
|
|
3722
4320
|
let decimals = 18;
|
|
3723
|
-
if (token && chainId !== null && chainId !== void 0
|
|
3724
|
-
|
|
4321
|
+
if (token && chainId !== null && chainId !== void 0) {
|
|
4322
|
+
if (chainId === "solana") {
|
|
4323
|
+
const normalized = token.toLowerCase();
|
|
4324
|
+
const matched = SOLANA_TOKENS.find(
|
|
4325
|
+
(entry) => entry.mint.toLowerCase() === normalized
|
|
4326
|
+
);
|
|
4327
|
+
if (matched) {
|
|
4328
|
+
decimals = matched.decimals;
|
|
4329
|
+
} else if (normalized === "native" || normalized === "11111111111111111111111111111111" || normalized === "so11111111111111111111111111111111111111112") {
|
|
4330
|
+
decimals = 9;
|
|
4331
|
+
}
|
|
4332
|
+
} else if (/^0x[a-fA-F0-9]{40}$/.test(token)) {
|
|
4333
|
+
decimals = _chunkMUWVDVY4cjs.getTokenDecimalsByAddress.call(void 0, token, chainId);
|
|
4334
|
+
}
|
|
3725
4335
|
}
|
|
3726
4336
|
try {
|
|
3727
4337
|
const raw = BigInt(rawAmount);
|
|
3728
|
-
const divisor =
|
|
4338
|
+
const divisor = 10n ** BigInt(decimals);
|
|
3729
4339
|
const whole = raw / divisor;
|
|
3730
4340
|
const remainder = raw % divisor;
|
|
3731
4341
|
if (remainder === 0n) return whole.toString();
|
|
@@ -3733,13 +4343,13 @@ function formatAmount(rawAmount, token, chainId) {
|
|
|
3733
4343
|
const trimmed = fracStr.slice(0, 6).replace(/0+$/, "");
|
|
3734
4344
|
if (!trimmed) return whole.toString();
|
|
3735
4345
|
return `${whole}.${trimmed}`;
|
|
3736
|
-
} catch (
|
|
4346
|
+
} catch (e24) {
|
|
3737
4347
|
return rawAmount;
|
|
3738
4348
|
}
|
|
3739
4349
|
}
|
|
3740
4350
|
function getTxExplorerUrl(txHash, chainId) {
|
|
3741
4351
|
if (!chainId) return null;
|
|
3742
|
-
const base =
|
|
4352
|
+
const base = _chunkMUWVDVY4cjs.getExplorerUrl.call(void 0, chainId);
|
|
3743
4353
|
if (!base) return null;
|
|
3744
4354
|
return `${base}/tx/${txHash}`;
|
|
3745
4355
|
}
|
|
@@ -3838,15 +4448,15 @@ function HistoryRow({ deposit }) {
|
|
|
3838
4448
|
const status = normalizeStatus(deposit.status);
|
|
3839
4449
|
const sourceChainId = resolveChainId(deposit.chain);
|
|
3840
4450
|
const targetChainId = resolveChainId(deposit.targetChain);
|
|
3841
|
-
const sourceChainName = sourceChainId ?
|
|
3842
|
-
const targetChainName = targetChainId ?
|
|
3843
|
-
const sourceChainIcon = sourceChainId ?
|
|
3844
|
-
const targetChainIcon = targetChainId ?
|
|
4451
|
+
const sourceChainName = sourceChainId ? _chunkMUWVDVY4cjs.getChainName.call(void 0, sourceChainId) : null;
|
|
4452
|
+
const targetChainName = targetChainId ? _chunkMUWVDVY4cjs.getChainName.call(void 0, targetChainId) : null;
|
|
4453
|
+
const sourceChainIcon = sourceChainId ? _chunkMUWVDVY4cjs.getChainIcon.call(void 0, sourceChainId) : void 0;
|
|
4454
|
+
const targetChainIcon = targetChainId ? _chunkMUWVDVY4cjs.getChainIcon.call(void 0, targetChainId) : void 0;
|
|
3845
4455
|
const sourceSymbol = resolveTokenSymbol(deposit.token, sourceChainId);
|
|
3846
4456
|
const targetSymbol = resolveTokenSymbol(deposit.targetToken, targetChainId);
|
|
3847
4457
|
const rawAmount = _nullishCoalesce(deposit.sourceAmount, () => ( deposit.amount));
|
|
3848
4458
|
const formattedAmount = rawAmount ? formatAmount(rawAmount, deposit.token, sourceChainId) : null;
|
|
3849
|
-
const timestamp = deposit.createdAt ?
|
|
4459
|
+
const timestamp = deposit.createdAt ? formatTimestamp2(deposit.createdAt) : null;
|
|
3850
4460
|
const srcTxUrl = deposit.sourceTxHash ? getTxExplorerUrl(deposit.sourceTxHash, sourceChainId) : null;
|
|
3851
4461
|
const dstTxUrl = deposit.destinationTxHash ? getTxExplorerUrl(deposit.destinationTxHash, targetChainId) : null;
|
|
3852
4462
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-history-row", children: [
|
|
@@ -3916,7 +4526,7 @@ DepositHistoryPanel.displayName = "DepositHistoryPanel";
|
|
|
3916
4526
|
// src/DepositModal.tsx
|
|
3917
4527
|
|
|
3918
4528
|
var ReownDepositInner = _react.lazy.call(void 0,
|
|
3919
|
-
() => Promise.resolve().then(() => _interopRequireWildcard(require("./DepositModalReown-
|
|
4529
|
+
() => Promise.resolve().then(() => _interopRequireWildcard(require("./DepositModalReown-WXFTSZSK.cjs"))).then((m) => ({ default: m.DepositModalReown }))
|
|
3920
4530
|
);
|
|
3921
4531
|
function DepositModal(props) {
|
|
3922
4532
|
const needsReown = !!props.reownAppId;
|
|
@@ -3957,14 +4567,16 @@ function DepositModalInner({
|
|
|
3957
4567
|
sourceToken,
|
|
3958
4568
|
defaultAmount,
|
|
3959
4569
|
recipient,
|
|
3960
|
-
backendUrl =
|
|
4570
|
+
backendUrl = _chunkMUWVDVY4cjs.DEFAULT_BACKEND_URL,
|
|
3961
4571
|
solanaRpcUrl,
|
|
3962
|
-
signerAddress =
|
|
4572
|
+
signerAddress = _chunkMUWVDVY4cjs.DEFAULT_SIGNER_ADDRESS,
|
|
3963
4573
|
sessionChainIds,
|
|
3964
4574
|
forceRegister = false,
|
|
3965
4575
|
waitForFinalTx = true,
|
|
3966
4576
|
enableSolana = true,
|
|
3967
4577
|
postBridgeActions,
|
|
4578
|
+
outputTokenRules,
|
|
4579
|
+
rejectUnmapped,
|
|
3968
4580
|
reownWallet,
|
|
3969
4581
|
onConnect,
|
|
3970
4582
|
onDisconnect,
|
|
@@ -3985,11 +4597,11 @@ function DepositModalInner({
|
|
|
3985
4597
|
debug
|
|
3986
4598
|
}) {
|
|
3987
4599
|
const modalRef = _react.useRef.call(void 0, null);
|
|
3988
|
-
const onReadyRef =
|
|
4600
|
+
const onReadyRef = _chunkFLVSQDP4cjs.useLatestRef.call(void 0, onReady);
|
|
3989
4601
|
const [currentStepIndex, setCurrentStepIndex] = _react.useState.call(void 0, 0);
|
|
3990
4602
|
const [totalBalanceUsd, setTotalBalanceUsd] = _react.useState.call(void 0, null);
|
|
3991
4603
|
const backHandlerRef = _react.useRef.call(void 0, void 0);
|
|
3992
|
-
const showHistoryButton = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess',
|
|
4604
|
+
const showHistoryButton = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess', _167 => _167.showHistoryButton]), () => ( false));
|
|
3993
4605
|
const [activeSmartAccount, setActiveSmartAccount] = _react.useState.call(void 0, null);
|
|
3994
4606
|
const [historyOpen, setHistoryOpen] = _react.useState.call(void 0, false);
|
|
3995
4607
|
const [historyDeposits, setHistoryDeposits] = _react.useState.call(void 0, []);
|
|
@@ -3999,10 +4611,10 @@ function DepositModalInner({
|
|
|
3999
4611
|
const [historyError, setHistoryError] = _react.useState.call(void 0, null);
|
|
4000
4612
|
const historyStaleRef = _react.useRef.call(void 0, false);
|
|
4001
4613
|
const historyLoadedRef = _react.useRef.call(void 0, false);
|
|
4002
|
-
const targetChain =
|
|
4003
|
-
const sourceChain = sourceChainProp ?
|
|
4614
|
+
const targetChain = _chunkMUWVDVY4cjs.getChainId.call(void 0, targetChainProp);
|
|
4615
|
+
const sourceChain = sourceChainProp ? _chunkMUWVDVY4cjs.getChainId.call(void 0, sourceChainProp) : void 0;
|
|
4004
4616
|
const service = _react.useMemo.call(void 0,
|
|
4005
|
-
() =>
|
|
4617
|
+
() => _chunkFLVSQDP4cjs.createDepositService.call(void 0, backendUrl, {
|
|
4006
4618
|
debug,
|
|
4007
4619
|
debugScope: "service:deposit"
|
|
4008
4620
|
}),
|
|
@@ -4010,17 +4622,15 @@ function DepositModalInner({
|
|
|
4010
4622
|
);
|
|
4011
4623
|
_react.useEffect.call(void 0, () => {
|
|
4012
4624
|
if (isOpen && modalRef.current) {
|
|
4013
|
-
|
|
4625
|
+
_chunkFLVSQDP4cjs.applyTheme.call(void 0, modalRef.current, theme);
|
|
4014
4626
|
}
|
|
4015
4627
|
}, [isOpen, theme]);
|
|
4016
4628
|
_react.useEffect.call(void 0, () => {
|
|
4017
4629
|
configureSolanaRpcUrl(solanaRpcUrl);
|
|
4018
4630
|
}, [solanaRpcUrl]);
|
|
4019
|
-
const hasCalledReady = _react.useRef.call(void 0, false);
|
|
4020
4631
|
_react.useEffect.call(void 0, () => {
|
|
4021
|
-
if (isOpen
|
|
4022
|
-
|
|
4023
|
-
_optionalChain([onReadyRef, 'access', _129 => _129.current, 'optionalCall', _130 => _130()]);
|
|
4632
|
+
if (isOpen) {
|
|
4633
|
+
_optionalChain([onReadyRef, 'access', _168 => _168.current, 'optionalCall', _169 => _169()]);
|
|
4024
4634
|
}
|
|
4025
4635
|
}, [isOpen, onReadyRef]);
|
|
4026
4636
|
_react.useEffect.call(void 0, () => {
|
|
@@ -4039,7 +4649,7 @@ function DepositModalInner({
|
|
|
4039
4649
|
setTotalBalanceUsd(balance2);
|
|
4040
4650
|
}, []);
|
|
4041
4651
|
const handleBack = _react.useCallback.call(void 0, () => {
|
|
4042
|
-
_optionalChain([backHandlerRef, 'access',
|
|
4652
|
+
_optionalChain([backHandlerRef, 'access', _170 => _170.current, 'optionalCall', _171 => _171()]);
|
|
4043
4653
|
}, []);
|
|
4044
4654
|
const handleSmartAccountChange = _react.useCallback.call(void 0,
|
|
4045
4655
|
(account) => {
|
|
@@ -4108,26 +4718,26 @@ function DepositModalInner({
|
|
|
4108
4718
|
fetchHistory();
|
|
4109
4719
|
}
|
|
4110
4720
|
}, [historyOpen, fetchHistory]);
|
|
4111
|
-
const onDepositSubmittedRef =
|
|
4112
|
-
const onDepositCompleteRef =
|
|
4113
|
-
const onDepositFailedRef =
|
|
4721
|
+
const onDepositSubmittedRef = _chunkFLVSQDP4cjs.useLatestRef.call(void 0, onDepositSubmitted);
|
|
4722
|
+
const onDepositCompleteRef = _chunkFLVSQDP4cjs.useLatestRef.call(void 0, onDepositComplete);
|
|
4723
|
+
const onDepositFailedRef = _chunkFLVSQDP4cjs.useLatestRef.call(void 0, onDepositFailed);
|
|
4114
4724
|
const handleDepositSubmitted = _react.useCallback.call(void 0,
|
|
4115
4725
|
(data) => {
|
|
4116
|
-
_optionalChain([onDepositSubmittedRef, 'access',
|
|
4726
|
+
_optionalChain([onDepositSubmittedRef, 'access', _172 => _172.current, 'optionalCall', _173 => _173(data)]);
|
|
4117
4727
|
if (showHistoryButton) markHistoryStale();
|
|
4118
4728
|
},
|
|
4119
4729
|
[onDepositSubmittedRef, showHistoryButton, markHistoryStale]
|
|
4120
4730
|
);
|
|
4121
4731
|
const handleDepositComplete = _react.useCallback.call(void 0,
|
|
4122
4732
|
(data) => {
|
|
4123
|
-
_optionalChain([onDepositCompleteRef, 'access',
|
|
4733
|
+
_optionalChain([onDepositCompleteRef, 'access', _174 => _174.current, 'optionalCall', _175 => _175(data)]);
|
|
4124
4734
|
if (showHistoryButton) markHistoryStale();
|
|
4125
4735
|
},
|
|
4126
4736
|
[onDepositCompleteRef, showHistoryButton, markHistoryStale]
|
|
4127
4737
|
);
|
|
4128
4738
|
const handleDepositFailed = _react.useCallback.call(void 0,
|
|
4129
4739
|
(data) => {
|
|
4130
|
-
_optionalChain([onDepositFailedRef, 'access',
|
|
4740
|
+
_optionalChain([onDepositFailedRef, 'access', _176 => _176.current, 'optionalCall', _177 => _177(data)]);
|
|
4131
4741
|
if (showHistoryButton) markHistoryStale();
|
|
4132
4742
|
},
|
|
4133
4743
|
[onDepositFailedRef, showHistoryButton, markHistoryStale]
|
|
@@ -4143,15 +4753,15 @@ function DepositModalInner({
|
|
|
4143
4753
|
historyLoadedRef.current = false;
|
|
4144
4754
|
}
|
|
4145
4755
|
}, [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',
|
|
4756
|
+
const showLogo = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess', _178 => _178.showLogo]), () => ( false));
|
|
4757
|
+
const showStepper = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess', _179 => _179.showStepper]), () => ( false));
|
|
4758
|
+
const showBackButton = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess', _180 => _180.showBackButton]), () => ( true));
|
|
4759
|
+
const balance = _optionalChain([uiConfig, 'optionalAccess', _181 => _181.balance]);
|
|
4760
|
+
const logoUrl = _nullishCoalesce(_optionalChain([branding, 'optionalAccess', _182 => _182.logoUrl]), () => ( "https://github.com/rhinestonewtf.png"));
|
|
4761
|
+
const title = _nullishCoalesce(_optionalChain([branding, 'optionalAccess', _183 => _183.title]), () => ( "Deposit"));
|
|
4152
4762
|
const canGoBack = currentStepIndex > 0 && currentStepIndex < 4 && backHandlerRef.current !== void 0;
|
|
4153
4763
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4154
|
-
|
|
4764
|
+
_chunkFLVSQDP4cjs.Modal,
|
|
4155
4765
|
{
|
|
4156
4766
|
isOpen,
|
|
4157
4767
|
onClose,
|
|
@@ -4244,7 +4854,7 @@ function DepositModalInner({
|
|
|
4244
4854
|
balance.title,
|
|
4245
4855
|
":"
|
|
4246
4856
|
] }),
|
|
4247
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-modal-header-balance-value", children: _nullishCoalesce(balance.amount, () => ( (totalBalanceUsd !== null ?
|
|
4857
|
+
/* @__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
4858
|
] })
|
|
4249
4859
|
] }),
|
|
4250
4860
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-modal-header-nav-right", children: [
|
|
@@ -4318,6 +4928,8 @@ function DepositModalInner({
|
|
|
4318
4928
|
amount: defaultAmount,
|
|
4319
4929
|
recipient,
|
|
4320
4930
|
postBridgeActions,
|
|
4931
|
+
outputTokenRules,
|
|
4932
|
+
rejectUnmapped,
|
|
4321
4933
|
signerAddress,
|
|
4322
4934
|
sessionChainIds,
|
|
4323
4935
|
forceRegister,
|