@rhinestone/deposit-modal 0.3.0-alpha.5 → 0.3.0-alpha.7
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-3VZ5AKV2.mjs → DepositModalReown-42D5V5II.mjs} +8 -5
- package/dist/{DepositModalReown-PPX34UAK.cjs → DepositModalReown-ABLVMYFL.cjs} +9 -6
- package/dist/{WithdrawModalReown-BB3MZAIO.mjs → WithdrawModalReown-EVHN5NOF.mjs} +3 -3
- package/dist/{WithdrawModalReown-4B6IMTBB.cjs → WithdrawModalReown-FJP3XTQ5.cjs} +4 -4
- package/dist/{chunk-QI6Q7V6O.mjs → chunk-3FHYC3K7.mjs} +26 -34
- package/dist/{chunk-ZUWAIMMH.mjs → chunk-44IFH7DZ.mjs} +1247 -917
- package/dist/{chunk-CTYKQ4B4.mjs → chunk-7VKAUBZ7.mjs} +201 -81
- package/dist/{chunk-BB6UVRAV.cjs → chunk-CPXERFGC.cjs} +110 -118
- package/dist/{chunk-DX2D2TRZ.cjs → chunk-ENMIKNXS.cjs} +241 -121
- package/dist/{chunk-TTD2FEA2.cjs → chunk-LEVCOJD6.cjs} +1193 -863
- package/dist/chunk-MHKHSCIA.cjs +554 -0
- package/dist/chunk-UCZXBHLH.mjs +554 -0
- package/dist/constants-DqVn968d.d.cts +52 -0
- package/dist/constants-DqVn968d.d.ts +52 -0
- package/dist/constants.cjs +8 -2
- package/dist/constants.d.cts +17 -48
- package/dist/constants.d.ts +17 -48
- package/dist/constants.mjs +7 -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 +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.mjs +4 -4
- package/dist/styles.css +185 -37
- package/dist/{types-xSHZSlrT.d.cts → types-D8Q4TMk7.d.cts} +17 -5
- package/dist/{types-xSHZSlrT.d.ts → types-D8Q4TMk7.d.ts} +17 -5
- 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 +1 -1
- package/dist/chunk-IVTXEYB2.cjs +0 -507
- package/dist/chunk-VA3ANS7D.mjs +0 -507
|
@@ -47,8 +47,8 @@
|
|
|
47
47
|
|
|
48
48
|
|
|
49
49
|
|
|
50
|
+
var _chunkENMIKNXScjs = require('./chunk-ENMIKNXS.cjs');
|
|
50
51
|
|
|
51
|
-
var _chunkDX2D2TRZcjs = require('./chunk-DX2D2TRZ.cjs');
|
|
52
52
|
|
|
53
53
|
|
|
54
54
|
|
|
@@ -67,7 +67,9 @@ var _chunkDX2D2TRZcjs = require('./chunk-DX2D2TRZ.cjs');
|
|
|
67
67
|
|
|
68
68
|
|
|
69
69
|
|
|
70
|
-
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
var _chunkMHKHSCIAcjs = require('./chunk-MHKHSCIA.cjs');
|
|
71
73
|
|
|
72
74
|
// src/DepositModal.tsx
|
|
73
75
|
|
|
@@ -106,7 +108,7 @@ function AssetSelectStep({
|
|
|
106
108
|
const [error, setError] = _react.useState.call(void 0, null);
|
|
107
109
|
const defaultAssetId = _react.useMemo.call(void 0, () => {
|
|
108
110
|
if (!defaultSourceChain || !defaultSourceToken) return null;
|
|
109
|
-
return
|
|
111
|
+
return _chunkENMIKNXScjs.getAssetId.call(void 0, {
|
|
110
112
|
chainId: defaultSourceChain,
|
|
111
113
|
token: defaultSourceToken
|
|
112
114
|
});
|
|
@@ -123,10 +125,10 @@ function AssetSelectStep({
|
|
|
123
125
|
try {
|
|
124
126
|
const portfolio = await service.fetchPortfolio(address);
|
|
125
127
|
if (!active) return;
|
|
126
|
-
const portfolioAssets =
|
|
128
|
+
const portfolioAssets = _chunkENMIKNXScjs.portfolioToAssets.call(void 0, portfolio.tokens);
|
|
127
129
|
setAssets(portfolioAssets);
|
|
128
130
|
const hasNative = portfolioAssets.some(
|
|
129
|
-
(asset) => asset.token.toLowerCase() ===
|
|
131
|
+
(asset) => asset.token.toLowerCase() === _chunkMHKHSCIAcjs.NATIVE_TOKEN_ADDRESS
|
|
130
132
|
);
|
|
131
133
|
if (!hasNative) {
|
|
132
134
|
const nativeAssets = await fetchNativeAssets(
|
|
@@ -204,7 +206,7 @@ function AssetSelectStep({
|
|
|
204
206
|
const raw = _viem.formatUnits.call(void 0, BigInt(asset.balance), asset.decimals);
|
|
205
207
|
const numeric = Number(raw);
|
|
206
208
|
if (!Number.isFinite(numeric)) return raw;
|
|
207
|
-
return
|
|
209
|
+
return _chunkENMIKNXScjs.tokenFormatter.format(numeric);
|
|
208
210
|
} catch (e3) {
|
|
209
211
|
return asset.balance;
|
|
210
212
|
}
|
|
@@ -212,20 +214,20 @@ function AssetSelectStep({
|
|
|
212
214
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-screen", children: [
|
|
213
215
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-screen-body", children: [
|
|
214
216
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
215
|
-
|
|
217
|
+
_chunkENMIKNXScjs.BodyHeader,
|
|
216
218
|
{
|
|
217
|
-
icon: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
219
|
+
icon: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkENMIKNXScjs.WalletIcon, {}),
|
|
218
220
|
title: "Your assets",
|
|
219
221
|
subtitle: "Select source assets to transfer"
|
|
220
222
|
}
|
|
221
223
|
),
|
|
222
224
|
loading && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-loading-state", style: { padding: "40px 12px" }, children: [
|
|
223
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
225
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkENMIKNXScjs.Spinner, { className: "rs-text-tertiary" }),
|
|
224
226
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-text-sm rs-text-tertiary", children: "Loading balances" })
|
|
225
227
|
] }),
|
|
226
|
-
error && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
228
|
+
error && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkENMIKNXScjs.Callout, { variant: "error", children: error }),
|
|
227
229
|
!loading && !error && rows.length === 0 && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-empty-state", children: [
|
|
228
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
230
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkENMIKNXScjs.WalletIcon, { className: "rs-empty-icon" }),
|
|
229
231
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-empty-text", children: "No funds in connected wallet" }),
|
|
230
232
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-empty-address", children: [
|
|
231
233
|
address.slice(0, 6),
|
|
@@ -245,9 +247,9 @@ function AssetSelectStep({
|
|
|
245
247
|
!loading && !error && rows.length > 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-asset-list", children: rows.map((asset) => {
|
|
246
248
|
const isSelected = selectedAssetId === asset.id;
|
|
247
249
|
const tokenAmount = formatBalance(asset);
|
|
248
|
-
const badge =
|
|
249
|
-
const tokenIcon =
|
|
250
|
-
const chainIcon =
|
|
250
|
+
const badge = _chunkMHKHSCIAcjs.getChainBadge.call(void 0, asset.chainId);
|
|
251
|
+
const tokenIcon = _chunkMHKHSCIAcjs.getTokenIcon.call(void 0, asset.symbol);
|
|
252
|
+
const chainIcon = _chunkMHKHSCIAcjs.getChainIcon.call(void 0, asset.chainId);
|
|
251
253
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
252
254
|
"button",
|
|
253
255
|
{
|
|
@@ -263,7 +265,7 @@ function AssetSelectStep({
|
|
|
263
265
|
"img",
|
|
264
266
|
{
|
|
265
267
|
src: chainIcon,
|
|
266
|
-
alt:
|
|
268
|
+
alt: _chunkMHKHSCIAcjs.getChainName.call(void 0, asset.chainId)
|
|
267
269
|
}
|
|
268
270
|
) }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
269
271
|
"span",
|
|
@@ -282,7 +284,7 @@ function AssetSelectStep({
|
|
|
282
284
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-asset-name", children: asset.symbol }),
|
|
283
285
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "rs-asset-chain", children: [
|
|
284
286
|
"on ",
|
|
285
|
-
|
|
287
|
+
_chunkMHKHSCIAcjs.getChainName.call(void 0, asset.chainId)
|
|
286
288
|
] })
|
|
287
289
|
] }),
|
|
288
290
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-asset-balance-small", children: [
|
|
@@ -292,14 +294,14 @@ function AssetSelectStep({
|
|
|
292
294
|
] })
|
|
293
295
|
] })
|
|
294
296
|
] }),
|
|
295
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-asset-balance", children: asset.balanceUsd !== void 0 && asset.balanceUsd > 0 ?
|
|
297
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-asset-balance", children: asset.balanceUsd !== void 0 && asset.balanceUsd > 0 ? _chunkENMIKNXScjs.currencyFormatter.format(asset.balanceUsd) : tokenAmount !== "--" ? `${tokenAmount} ${asset.symbol}` : "--" })
|
|
296
298
|
]
|
|
297
299
|
},
|
|
298
300
|
asset.id
|
|
299
301
|
);
|
|
300
302
|
}) }),
|
|
301
303
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
302
|
-
|
|
304
|
+
_chunkENMIKNXScjs.Button,
|
|
303
305
|
{
|
|
304
306
|
onClick: () => selectedAsset && onContinue(selectedAsset),
|
|
305
307
|
disabled: !selectedAsset,
|
|
@@ -308,17 +310,17 @@ function AssetSelectStep({
|
|
|
308
310
|
}
|
|
309
311
|
)
|
|
310
312
|
] }),
|
|
311
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
313
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkENMIKNXScjs.PoweredBy, {})
|
|
312
314
|
] });
|
|
313
315
|
}
|
|
314
316
|
async function fetchNativeAssets(address, publicClient, existing) {
|
|
315
317
|
const existingIds = new Set(existing.map((asset) => asset.id));
|
|
316
318
|
const connectedChainId = _optionalChain([publicClient, 'access', _7 => _7.chain, 'optionalAccess', _8 => _8.id]);
|
|
317
319
|
if (!connectedChainId) return [];
|
|
318
|
-
if (!
|
|
319
|
-
const id =
|
|
320
|
+
if (!_chunkMHKHSCIAcjs.SOURCE_CHAINS.some((chain) => chain.id === connectedChainId)) return [];
|
|
321
|
+
const id = _chunkENMIKNXScjs.getAssetId.call(void 0, {
|
|
320
322
|
chainId: connectedChainId,
|
|
321
|
-
token:
|
|
323
|
+
token: _chunkMHKHSCIAcjs.NATIVE_TOKEN_ADDRESS
|
|
322
324
|
});
|
|
323
325
|
if (existingIds.has(id)) return [];
|
|
324
326
|
try {
|
|
@@ -327,7 +329,7 @@ async function fetchNativeAssets(address, publicClient, existing) {
|
|
|
327
329
|
{
|
|
328
330
|
id,
|
|
329
331
|
chainId: connectedChainId,
|
|
330
|
-
token:
|
|
332
|
+
token: _chunkMHKHSCIAcjs.NATIVE_TOKEN_ADDRESS,
|
|
331
333
|
symbol: "ETH",
|
|
332
334
|
name: "Ethereum",
|
|
333
335
|
decimals: 18,
|
|
@@ -354,6 +356,98 @@ function mergeAssets(existing, incoming) {
|
|
|
354
356
|
|
|
355
357
|
|
|
356
358
|
|
|
359
|
+
// src/components/ui/AnimatedAmountInput.tsx
|
|
360
|
+
|
|
361
|
+
|
|
362
|
+
var ENTER_TRANSITION = "transform 0.18s cubic-bezier(0.34, 1.2, 0.64, 1), opacity 0.18s ease";
|
|
363
|
+
function prefersReducedMotion() {
|
|
364
|
+
return typeof window !== "undefined" && typeof window.matchMedia === "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
365
|
+
}
|
|
366
|
+
function AnimatedAmountInput({
|
|
367
|
+
value,
|
|
368
|
+
onChange,
|
|
369
|
+
prefix = "$",
|
|
370
|
+
placeholder = "0",
|
|
371
|
+
ariaLabel,
|
|
372
|
+
autoFocus
|
|
373
|
+
}) {
|
|
374
|
+
const prevValueRef = _react.useRef.call(void 0, "");
|
|
375
|
+
const isFirstRenderRef = _react.useRef.call(void 0, true);
|
|
376
|
+
const slotRefs = _react.useRef.call(void 0, []);
|
|
377
|
+
const isEmpty = value.length === 0;
|
|
378
|
+
const chars = isEmpty ? [placeholder] : value.split("");
|
|
379
|
+
_react.useLayoutEffect.call(void 0, () => {
|
|
380
|
+
const prev = prevValueRef.current;
|
|
381
|
+
const animate = !isFirstRenderRef.current && !prefersReducedMotion();
|
|
382
|
+
const oldChars = prev ? prev.split("") : [placeholder];
|
|
383
|
+
const newChars = value ? value.split("") : [placeholder];
|
|
384
|
+
const goingUp = (parseFloat(value) || 0) >= (parseFloat(prev) || 0);
|
|
385
|
+
const isIncrementalEdit = value.startsWith(prev) && value.length === prev.length + 1 || prev.startsWith(value) && prev.length === value.length + 1;
|
|
386
|
+
if (animate) {
|
|
387
|
+
newChars.forEach((char, i) => {
|
|
388
|
+
const inner = slotRefs.current[i];
|
|
389
|
+
if (!inner) return;
|
|
390
|
+
const isChanged = i >= oldChars.length || char !== oldChars[i];
|
|
391
|
+
if (isIncrementalEdit && !isChanged) return;
|
|
392
|
+
const startY = goingUp ? "100%" : "-100%";
|
|
393
|
+
inner.style.transition = "none";
|
|
394
|
+
inner.style.transform = `translateY(${startY})`;
|
|
395
|
+
inner.style.opacity = "0";
|
|
396
|
+
requestAnimationFrame(() => {
|
|
397
|
+
requestAnimationFrame(() => {
|
|
398
|
+
inner.style.transition = ENTER_TRANSITION;
|
|
399
|
+
inner.style.transform = "translateY(0)";
|
|
400
|
+
inner.style.opacity = "1";
|
|
401
|
+
});
|
|
402
|
+
});
|
|
403
|
+
});
|
|
404
|
+
}
|
|
405
|
+
prevValueRef.current = value;
|
|
406
|
+
isFirstRenderRef.current = false;
|
|
407
|
+
}, [value, placeholder]);
|
|
408
|
+
const handleChange = (e) => {
|
|
409
|
+
onChange(e.target.value);
|
|
410
|
+
};
|
|
411
|
+
slotRefs.current = [];
|
|
412
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-amount-input-row", children: [
|
|
413
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-amount-prefix", "aria-hidden": "true", children: prefix }),
|
|
414
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "rs-amount-number-wrap", children: [
|
|
415
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
416
|
+
"input",
|
|
417
|
+
{
|
|
418
|
+
type: "text",
|
|
419
|
+
inputMode: "decimal",
|
|
420
|
+
placeholder,
|
|
421
|
+
value,
|
|
422
|
+
onChange: handleChange,
|
|
423
|
+
"aria-label": ariaLabel,
|
|
424
|
+
autoComplete: "off",
|
|
425
|
+
autoFocus
|
|
426
|
+
}
|
|
427
|
+
),
|
|
428
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
429
|
+
"span",
|
|
430
|
+
{
|
|
431
|
+
className: isEmpty ? "rs-amount-visual rs-amount-visual--placeholder" : "rs-amount-visual",
|
|
432
|
+
"aria-hidden": "true",
|
|
433
|
+
children: chars.map((char, i) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-amount-char-slot", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
434
|
+
"span",
|
|
435
|
+
{
|
|
436
|
+
className: "rs-amount-char-inner",
|
|
437
|
+
ref: (el) => {
|
|
438
|
+
slotRefs.current[i] = el;
|
|
439
|
+
},
|
|
440
|
+
children: char
|
|
441
|
+
}
|
|
442
|
+
) }, i))
|
|
443
|
+
}
|
|
444
|
+
)
|
|
445
|
+
] })
|
|
446
|
+
] });
|
|
447
|
+
}
|
|
448
|
+
|
|
449
|
+
// src/components/steps/AmountStep.tsx
|
|
450
|
+
|
|
357
451
|
var PRESETS = [
|
|
358
452
|
{ value: 25, label: "25%" },
|
|
359
453
|
{ value: 50, label: "50%" },
|
|
@@ -381,7 +475,7 @@ function AmountStep({
|
|
|
381
475
|
targetToken,
|
|
382
476
|
uiConfig,
|
|
383
477
|
tokenPriceUsdOverride,
|
|
384
|
-
|
|
478
|
+
appBalanceUsd,
|
|
385
479
|
onBalanceUsdChange,
|
|
386
480
|
onContinue,
|
|
387
481
|
onCtaClick,
|
|
@@ -392,11 +486,13 @@ function AmountStep({
|
|
|
392
486
|
const [error, setError] = _react.useState.call(void 0, null);
|
|
393
487
|
const [isCheckingLiquidity, setIsCheckingLiquidity] = _react.useState.call(void 0, false);
|
|
394
488
|
const hasAttemptedSwitch = _react.useRef.call(void 0, false);
|
|
489
|
+
const hasAppliedDefaultRef = _react.useRef.call(void 0, false);
|
|
490
|
+
const isMaxDefault = _optionalChain([defaultAmount, 'optionalAccess', _9 => _9.trim, 'call', _10 => _10(), 'access', _11 => _11.toLowerCase, 'call', _12 => _12()]) === "max";
|
|
395
491
|
const chainMismatch = Boolean(
|
|
396
|
-
_optionalChain([walletClient, 'optionalAccess',
|
|
492
|
+
_optionalChain([walletClient, 'optionalAccess', _13 => _13.chain, 'optionalAccess', _14 => _14.id]) && walletClient.chain.id !== asset.chainId
|
|
397
493
|
);
|
|
398
|
-
const targetSymbol =
|
|
399
|
-
const isSourceStablecoin =
|
|
494
|
+
const targetSymbol = _chunkMHKHSCIAcjs.getTargetTokenSymbol.call(void 0, targetToken, targetChain);
|
|
495
|
+
const isSourceStablecoin = _chunkMHKHSCIAcjs.isStablecoinSymbol.call(void 0, asset.symbol);
|
|
400
496
|
const tokenPriceUsd = _react.useMemo.call(void 0, () => {
|
|
401
497
|
if (tokenPriceUsdOverride !== void 0 && tokenPriceUsdOverride > 0)
|
|
402
498
|
return tokenPriceUsdOverride;
|
|
@@ -420,7 +516,7 @@ function AmountStep({
|
|
|
420
516
|
const balanceTarget = _nullishCoalesce(balanceAddress, () => ( address));
|
|
421
517
|
if (!balanceTarget || !publicClient) return;
|
|
422
518
|
try {
|
|
423
|
-
const bal =
|
|
519
|
+
const bal = _chunkENMIKNXScjs.isNativeAsset.call(void 0, asset) ? await publicClient.getBalance({ address: balanceTarget }) : await publicClient.readContract({
|
|
424
520
|
address: asset.token,
|
|
425
521
|
abi: _viem.erc20Abi,
|
|
426
522
|
functionName: "balanceOf",
|
|
@@ -441,21 +537,13 @@ function AmountStep({
|
|
|
441
537
|
hasAttemptedSwitch.current = true;
|
|
442
538
|
switchChain(asset.chainId).catch((err) => {
|
|
443
539
|
const raw = err instanceof Error ? err.message : "Failed to switch chain";
|
|
444
|
-
setError(
|
|
540
|
+
setError(_chunkENMIKNXScjs.formatUserError.call(void 0, raw));
|
|
445
541
|
});
|
|
446
542
|
}
|
|
447
543
|
}, [chainMismatch, switchChain, asset.chainId]);
|
|
448
544
|
_react.useEffect.call(void 0, () => {
|
|
449
545
|
hasAttemptedSwitch.current = false;
|
|
450
546
|
}, [asset.chainId]);
|
|
451
|
-
_react.useEffect.call(void 0, () => {
|
|
452
|
-
if (defaultAmount && !amount) {
|
|
453
|
-
const parsed = Number(defaultAmount);
|
|
454
|
-
if (Number.isFinite(parsed) && parsed > 0) {
|
|
455
|
-
setAmount(parsed.toString());
|
|
456
|
-
}
|
|
457
|
-
}
|
|
458
|
-
}, [defaultAmount, amount]);
|
|
459
547
|
const balanceUsd = _react.useMemo.call(void 0, () => {
|
|
460
548
|
if (balance === null || tokenPriceUsd === null) return null;
|
|
461
549
|
try {
|
|
@@ -467,15 +555,45 @@ function AmountStep({
|
|
|
467
555
|
}
|
|
468
556
|
}, [balance, tokenPriceUsd, asset.decimals]);
|
|
469
557
|
_react.useEffect.call(void 0, () => {
|
|
470
|
-
_optionalChain([onBalanceUsdChange, 'optionalCall',
|
|
558
|
+
_optionalChain([onBalanceUsdChange, 'optionalCall', _15 => _15(_nullishCoalesce(balanceUsd, () => ( 0)))]);
|
|
471
559
|
}, [balanceUsd, onBalanceUsdChange]);
|
|
560
|
+
_react.useEffect.call(void 0, () => {
|
|
561
|
+
if (hasAppliedDefaultRef.current || !defaultAmount) return;
|
|
562
|
+
if (isMaxDefault) {
|
|
563
|
+
if (balance === null) return;
|
|
564
|
+
const next = formatAmountFromBalance(
|
|
565
|
+
balance,
|
|
566
|
+
asset.decimals,
|
|
567
|
+
100,
|
|
568
|
+
balanceUsd,
|
|
569
|
+
isSourceStablecoin
|
|
570
|
+
);
|
|
571
|
+
if (next) {
|
|
572
|
+
setAmount(next);
|
|
573
|
+
hasAppliedDefaultRef.current = true;
|
|
574
|
+
}
|
|
575
|
+
return;
|
|
576
|
+
}
|
|
577
|
+
const parsed = Number(defaultAmount);
|
|
578
|
+
if (Number.isFinite(parsed) && parsed > 0) {
|
|
579
|
+
setAmount(parsed.toString());
|
|
580
|
+
hasAppliedDefaultRef.current = true;
|
|
581
|
+
}
|
|
582
|
+
}, [
|
|
583
|
+
defaultAmount,
|
|
584
|
+
isMaxDefault,
|
|
585
|
+
balance,
|
|
586
|
+
balanceUsd,
|
|
587
|
+
asset.decimals,
|
|
588
|
+
isSourceStablecoin
|
|
589
|
+
]);
|
|
472
590
|
const formattedBalance = _react.useMemo.call(void 0, () => {
|
|
473
591
|
if (balance === null) return "\u2026";
|
|
474
592
|
try {
|
|
475
593
|
const raw = _viem.formatUnits.call(void 0, balance, asset.decimals);
|
|
476
594
|
const numeric = Number(raw);
|
|
477
595
|
if (!Number.isFinite(numeric)) return raw;
|
|
478
|
-
return
|
|
596
|
+
return _chunkENMIKNXScjs.tokenFormatter.format(numeric);
|
|
479
597
|
} catch (e8) {
|
|
480
598
|
return "\u2026";
|
|
481
599
|
}
|
|
@@ -494,17 +612,17 @@ function AmountStep({
|
|
|
494
612
|
return null;
|
|
495
613
|
}
|
|
496
614
|
}, [numericAmount, isSourceStablecoin, hasPricing, tokenPriceUsd, asset.decimals]);
|
|
497
|
-
const minDepositUsd = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess',
|
|
498
|
-
const maxDepositUsd = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess',
|
|
615
|
+
const minDepositUsd = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess', _16 => _16.minDepositUsd]), () => ( null));
|
|
616
|
+
const maxDepositUsd = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess', _17 => _17.maxDepositUsd]), () => ( null));
|
|
499
617
|
const isBelowMin = minDepositUsd !== null && numericAmount > 0 && amountUsd < minDepositUsd;
|
|
500
618
|
const isAboveMax = maxDepositUsd !== null && amountUsd > maxDepositUsd;
|
|
501
619
|
const exceedsBalance = Boolean(
|
|
502
620
|
sourceAmountUnits !== null && balance !== null && sourceAmountUnits > balance
|
|
503
621
|
);
|
|
504
|
-
const balanceAfterUsd =
|
|
622
|
+
const balanceAfterUsd = appBalanceUsd !== void 0 ? appBalanceUsd + numericAmount : null;
|
|
505
623
|
const handlePresetClick = (percentage) => {
|
|
506
624
|
if (balance === null) return;
|
|
507
|
-
_optionalChain([onCtaClick, 'optionalCall',
|
|
625
|
+
_optionalChain([onCtaClick, 'optionalCall', _18 => _18(percentage === 100 ? "Max" : `${percentage}%`)]);
|
|
508
626
|
const next = formatAmountFromBalance(
|
|
509
627
|
balance,
|
|
510
628
|
asset.decimals,
|
|
@@ -551,13 +669,13 @@ function AmountStep({
|
|
|
551
669
|
return;
|
|
552
670
|
}
|
|
553
671
|
setError(null);
|
|
554
|
-
_optionalChain([onCtaClick, 'optionalCall',
|
|
672
|
+
_optionalChain([onCtaClick, 'optionalCall', _19 => _19("continue")]);
|
|
555
673
|
setIsCheckingLiquidity(true);
|
|
556
674
|
let liquidityWarning;
|
|
557
675
|
try {
|
|
558
676
|
const liquidity = await service.checkLiquidity({
|
|
559
|
-
sourceChainId: _nullishCoalesce(_optionalChain([liquiditySource, 'optionalAccess',
|
|
560
|
-
sourceToken: _nullishCoalesce(_optionalChain([liquiditySource, 'optionalAccess',
|
|
677
|
+
sourceChainId: _nullishCoalesce(_optionalChain([liquiditySource, 'optionalAccess', _20 => _20.chainId]), () => ( asset.chainId)),
|
|
678
|
+
sourceToken: _nullishCoalesce(_optionalChain([liquiditySource, 'optionalAccess', _21 => _21.token]), () => ( asset.token)),
|
|
561
679
|
destinationChainId: targetChain,
|
|
562
680
|
destinationToken: targetToken,
|
|
563
681
|
amount: amountInUnits.toString()
|
|
@@ -588,30 +706,24 @@ function AmountStep({
|
|
|
588
706
|
};
|
|
589
707
|
const continueLabel = exceedsBalance ? "Insufficient balance" : isAboveMax ? "Continue with max allowed deposit" : isBelowMin ? "Continue with minimum deposit" : "Continue";
|
|
590
708
|
const continueDisabled = chainMismatch || isCheckingLiquidity || exceedsBalance || numericAmount === 0 && !isBelowMin || balance === null;
|
|
591
|
-
const sourceChainName =
|
|
592
|
-
const targetChainName =
|
|
593
|
-
const sourceTokenIcon =
|
|
594
|
-
const targetTokenIcon =
|
|
709
|
+
const sourceChainName = _chunkMHKHSCIAcjs.getChainName.call(void 0, asset.chainId);
|
|
710
|
+
const targetChainName = _chunkMHKHSCIAcjs.getChainName.call(void 0, targetChain);
|
|
711
|
+
const sourceTokenIcon = _chunkMHKHSCIAcjs.getTokenIcon.call(void 0, asset.symbol);
|
|
712
|
+
const targetTokenIcon = _chunkMHKHSCIAcjs.getTokenIcon.call(void 0, targetSymbol);
|
|
595
713
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-screen", children: [
|
|
596
714
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-screen-body rs-screen-body--gap-32", children: [
|
|
597
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
715
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkENMIKNXScjs.BodyHeader, { icon: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkENMIKNXScjs.WalletIcon, {}), title: "Wallet deposit" }),
|
|
598
716
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-amount-section", children: [
|
|
599
717
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-amount-display", children: [
|
|
600
|
-
/* @__PURE__ */ _jsxruntime.
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
onChange: (e) => handleAmountChange(e.target.value),
|
|
610
|
-
"aria-label": "Deposit amount",
|
|
611
|
-
autoFocus: true
|
|
612
|
-
}
|
|
613
|
-
)
|
|
614
|
-
] }),
|
|
718
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
719
|
+
AnimatedAmountInput,
|
|
720
|
+
{
|
|
721
|
+
value: amount,
|
|
722
|
+
onChange: handleAmountChange,
|
|
723
|
+
ariaLabel: "Deposit amount",
|
|
724
|
+
autoFocus: true
|
|
725
|
+
}
|
|
726
|
+
),
|
|
615
727
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-amount-meta", children: [
|
|
616
728
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "rs-amount-meta-balance", children: [
|
|
617
729
|
formattedBalance,
|
|
@@ -620,13 +732,13 @@ function AmountStep({
|
|
|
620
732
|
" available",
|
|
621
733
|
balanceUsd !== null && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
622
734
|
" (~",
|
|
623
|
-
|
|
735
|
+
_chunkENMIKNXScjs.currencyFormatter.format(balanceUsd),
|
|
624
736
|
")"
|
|
625
737
|
] })
|
|
626
738
|
] }),
|
|
627
739
|
minDepositUsd !== null && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "rs-amount-meta-minimum", children: [
|
|
628
740
|
"Min. deposit ",
|
|
629
|
-
|
|
741
|
+
_chunkENMIKNXScjs.currencyFormatter.format(minDepositUsd)
|
|
630
742
|
] })
|
|
631
743
|
] })
|
|
632
744
|
] }),
|
|
@@ -667,26 +779,23 @@ function AmountStep({
|
|
|
667
779
|
] }),
|
|
668
780
|
balanceAfterUsd !== null && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-amount-detail-row", children: [
|
|
669
781
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: "Balance after deposit" }),
|
|
670
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-amount-detail-value", children:
|
|
782
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-amount-detail-value", children: _chunkENMIKNXScjs.currencyFormatter.format(balanceAfterUsd) })
|
|
671
783
|
] })
|
|
672
784
|
] }),
|
|
673
|
-
error && /* @__PURE__ */ _jsxruntime.
|
|
674
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkDX2D2TRZcjs.AlertTriangleIcon, { style: { width: 16, height: 16, flexShrink: 0 } }),
|
|
675
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: error })
|
|
676
|
-
] }),
|
|
785
|
+
error && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkENMIKNXScjs.Callout, { variant: "error", children: error }),
|
|
677
786
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
678
|
-
|
|
787
|
+
_chunkENMIKNXScjs.Button,
|
|
679
788
|
{
|
|
680
789
|
onClick: handleContinue,
|
|
681
790
|
fullWidth: true,
|
|
682
791
|
loading: isCheckingLiquidity,
|
|
683
|
-
loadingText: "
|
|
792
|
+
loadingText: "Fetching route",
|
|
684
793
|
disabled: continueDisabled,
|
|
685
794
|
children: continueLabel
|
|
686
795
|
}
|
|
687
796
|
)
|
|
688
797
|
] }),
|
|
689
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
798
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkENMIKNXScjs.PoweredBy, {})
|
|
690
799
|
] });
|
|
691
800
|
}
|
|
692
801
|
|
|
@@ -694,13 +803,6 @@ function AmountStep({
|
|
|
694
803
|
|
|
695
804
|
|
|
696
805
|
|
|
697
|
-
// src/core/dapp-imports/types.ts
|
|
698
|
-
function isDappImportAsset(asset) {
|
|
699
|
-
return typeof asset.source === "string" && typeof asset.sourceLabel === "string" && "providerMetadata" in asset;
|
|
700
|
-
}
|
|
701
|
-
|
|
702
|
-
// src/components/steps/ConfirmStep.tsx
|
|
703
|
-
|
|
704
806
|
function ConfirmStep({
|
|
705
807
|
walletClient,
|
|
706
808
|
address,
|
|
@@ -728,16 +830,16 @@ function ConfirmStep({
|
|
|
728
830
|
const [error, setError] = _react.useState.call(void 0, null);
|
|
729
831
|
const hasAttemptedSwitch = _react.useRef.call(void 0, false);
|
|
730
832
|
const chainMismatch = Boolean(
|
|
731
|
-
_optionalChain([walletClient, 'optionalAccess',
|
|
833
|
+
_optionalChain([walletClient, 'optionalAccess', _22 => _22.chain, 'optionalAccess', _23 => _23.id]) && walletClient.chain.id !== asset.chainId
|
|
732
834
|
);
|
|
733
835
|
const sameRoute = targetChain === asset.chainId && targetToken.toLowerCase() === asset.token.toLowerCase();
|
|
734
|
-
const targetSymbol = sameRoute ? asset.symbol :
|
|
735
|
-
const sourceChainName =
|
|
736
|
-
const targetChainName =
|
|
737
|
-
const sourceChainIcon =
|
|
738
|
-
const targetChainIcon =
|
|
739
|
-
const sourceTokenIcon =
|
|
740
|
-
const targetTokenIcon =
|
|
836
|
+
const targetSymbol = sameRoute ? asset.symbol : _chunkMHKHSCIAcjs.getTargetTokenSymbol.call(void 0, targetToken, targetChain);
|
|
837
|
+
const sourceChainName = _chunkMHKHSCIAcjs.getChainName.call(void 0, asset.chainId);
|
|
838
|
+
const targetChainName = _chunkMHKHSCIAcjs.getChainName.call(void 0, targetChain);
|
|
839
|
+
const sourceChainIcon = _chunkMHKHSCIAcjs.getChainIcon.call(void 0, asset.chainId);
|
|
840
|
+
const targetChainIcon = _chunkMHKHSCIAcjs.getChainIcon.call(void 0, targetChain);
|
|
841
|
+
const sourceTokenIcon = _chunkMHKHSCIAcjs.getTokenIcon.call(void 0, asset.symbol);
|
|
842
|
+
const targetTokenIcon = _chunkMHKHSCIAcjs.getTokenIcon.call(void 0, targetSymbol);
|
|
741
843
|
const formattedSendAmount = amount && !Number.isNaN(Number(amount)) ? Number(amount).toLocaleString("en-US", { maximumFractionDigits: 6 }) : "0";
|
|
742
844
|
const formattedReceiveAmount = (() => {
|
|
743
845
|
if (sameRoute) return formattedSendAmount;
|
|
@@ -751,14 +853,14 @@ function ConfirmStep({
|
|
|
751
853
|
return formattedSendAmount;
|
|
752
854
|
})();
|
|
753
855
|
const receiveAmount = sameRoute ? formattedReceiveAmount : `~${formattedReceiveAmount}`;
|
|
754
|
-
const feeSponsored = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess',
|
|
755
|
-
const feeTooltip = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess',
|
|
856
|
+
const feeSponsored = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess', _24 => _24.feeSponsored]), () => ( false));
|
|
857
|
+
const feeTooltip = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess', _25 => _25.feeTooltip]), () => ( (feeSponsored ? "Network fees are sponsored for this deposit." : "Network fees apply.")));
|
|
756
858
|
_react.useEffect.call(void 0, () => {
|
|
757
859
|
if (chainMismatch && switchChain && !hasAttemptedSwitch.current) {
|
|
758
860
|
hasAttemptedSwitch.current = true;
|
|
759
861
|
switchChain(asset.chainId).catch((err) => {
|
|
760
862
|
const raw = err instanceof Error ? err.message : "Failed to switch chain";
|
|
761
|
-
setError(
|
|
863
|
+
setError(_chunkENMIKNXScjs.formatUserError.call(void 0, raw));
|
|
762
864
|
});
|
|
763
865
|
}
|
|
764
866
|
}, [chainMismatch, switchChain, asset.chainId]);
|
|
@@ -805,7 +907,7 @@ function ConfirmStep({
|
|
|
805
907
|
const result = await executeTransfer(amountUnits);
|
|
806
908
|
hash = result.txHash;
|
|
807
909
|
resolvedSourceToken = result.sourceToken;
|
|
808
|
-
} else if (
|
|
910
|
+
} else if (_chunkENMIKNXScjs.isNativeAsset.call(void 0, asset)) {
|
|
809
911
|
hash = await walletClient.sendTransaction({
|
|
810
912
|
account,
|
|
811
913
|
chain,
|
|
@@ -822,20 +924,20 @@ function ConfirmStep({
|
|
|
822
924
|
args: [transferTo, amountUnits]
|
|
823
925
|
});
|
|
824
926
|
}
|
|
825
|
-
_optionalChain([onDepositSubmitted, 'optionalCall',
|
|
927
|
+
_optionalChain([onDepositSubmitted, 'optionalCall', _26 => _26(hash, asset.chainId, amountUnits.toString())]);
|
|
826
928
|
onConfirm(hash, asset.chainId, amountUnits.toString(), resolvedSourceToken);
|
|
827
929
|
} catch (err) {
|
|
828
930
|
const raw = err instanceof Error ? err.message : "Transfer failed";
|
|
829
|
-
const message =
|
|
931
|
+
const message = _chunkENMIKNXScjs.formatUserError.call(void 0, raw);
|
|
830
932
|
setError(message);
|
|
831
|
-
_optionalChain([onError, 'optionalCall',
|
|
933
|
+
_optionalChain([onError, 'optionalCall', _27 => _27(message, "TRANSFER_ERROR")]);
|
|
832
934
|
} finally {
|
|
833
935
|
setIsSubmitting(false);
|
|
834
936
|
}
|
|
835
937
|
};
|
|
836
938
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-screen", children: [
|
|
837
939
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-screen-body rs-screen-body--gap-32", children: [
|
|
838
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
940
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkENMIKNXScjs.BodyHeader, { icon: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkENMIKNXScjs.WalletIcon, {}), title: "Review deposit" }),
|
|
839
941
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-review-details", children: [
|
|
840
942
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-review-detail-row", children: [
|
|
841
943
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: "Source chain" }),
|
|
@@ -884,33 +986,16 @@ function ConfirmStep({
|
|
|
884
986
|
"span",
|
|
885
987
|
{
|
|
886
988
|
style: feeSponsored ? { textDecoration: "line-through" } : void 0,
|
|
887
|
-
children: "$0.
|
|
989
|
+
children: "$0.04"
|
|
888
990
|
}
|
|
889
991
|
),
|
|
890
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
992
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkENMIKNXScjs.Tooltip, { content: feeTooltip, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-review-detail-info", "aria-label": "Fee info", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkENMIKNXScjs.InfoIcon, {}) }) })
|
|
891
993
|
] })
|
|
892
994
|
] })
|
|
893
995
|
] }),
|
|
894
|
-
|
|
895
|
-
// Dapp-import sources route through an unwrap before the
|
|
896
|
-
// orchestrator sees funds; the upstream route check often
|
|
897
|
-
// returns "unavailable" for the source token even though the
|
|
898
|
-
// post-unwrap route works. Surface as a soft warning rather
|
|
899
|
-
// than a red blocker until the orchestrator handles it.
|
|
900
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-amount-error rs-amount-error--warning", role: "status", children: [
|
|
901
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkDX2D2TRZcjs.AlertTriangleIcon, { style: { width: 16, height: 16, flexShrink: 0 } }),
|
|
902
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: "Low liquidity detected \u2014 deposit may take longer" })
|
|
903
|
-
] })
|
|
904
|
-
) : /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-amount-error", role: "status", children: [
|
|
905
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkDX2D2TRZcjs.AlertTriangleIcon, { style: { width: 16, height: 16, flexShrink: 0 } }),
|
|
906
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: liquidityWarning.kind === "unavailable" ? "Route may be unavailable" : "Liquidity check failed" })
|
|
907
|
-
] })),
|
|
908
|
-
error && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-amount-error", role: "alert", children: [
|
|
909
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkDX2D2TRZcjs.AlertTriangleIcon, { style: { width: 16, height: 16, flexShrink: 0 } }),
|
|
910
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: error })
|
|
911
|
-
] }),
|
|
996
|
+
error && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkENMIKNXScjs.Callout, { variant: "error", children: error }),
|
|
912
997
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
913
|
-
|
|
998
|
+
_chunkENMIKNXScjs.Button,
|
|
914
999
|
{
|
|
915
1000
|
onClick: handleConfirm,
|
|
916
1001
|
loading: isSubmitting,
|
|
@@ -921,7 +1006,7 @@ function ConfirmStep({
|
|
|
921
1006
|
}
|
|
922
1007
|
)
|
|
923
1008
|
] }),
|
|
924
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1009
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkENMIKNXScjs.PoweredBy, {})
|
|
925
1010
|
] });
|
|
926
1011
|
}
|
|
927
1012
|
|
|
@@ -944,9 +1029,9 @@ var INITIAL_POLL_INTERVAL = 3e3;
|
|
|
944
1029
|
var MAX_POLL_INTERVAL = 3e4;
|
|
945
1030
|
var BACKOFF_MULTIPLIER = 1.5;
|
|
946
1031
|
function isEventForTx(event, txHash) {
|
|
947
|
-
const eventTxHash =
|
|
1032
|
+
const eventTxHash = _chunkENMIKNXScjs.getEventTxHash.call(void 0, event);
|
|
948
1033
|
if (!eventTxHash) return false;
|
|
949
|
-
return
|
|
1034
|
+
return _chunkENMIKNXScjs.txRefsMatch.call(void 0, eventTxHash, txHash);
|
|
950
1035
|
}
|
|
951
1036
|
function truncateHash(hash) {
|
|
952
1037
|
return `${hash.slice(0, 4)}\u2026${hash.slice(-4)}`;
|
|
@@ -976,7 +1061,7 @@ function formatTimestamp(ms) {
|
|
|
976
1061
|
return `${month} ${day}${suffix} \xB7 ${hours}:${minutes}:${seconds}`;
|
|
977
1062
|
}
|
|
978
1063
|
function formatBridgeFailedMessage(event) {
|
|
979
|
-
const eventData = _nullishCoalesce(_optionalChain([event, 'optionalAccess',
|
|
1064
|
+
const eventData = _nullishCoalesce(_optionalChain([event, 'optionalAccess', _28 => _28.data]), () => ( {}));
|
|
980
1065
|
const backendMessage = typeof eventData.message === "string" ? eventData.message.trim() : "";
|
|
981
1066
|
if (backendMessage.length > 0) {
|
|
982
1067
|
const lower = backendMessage.toLowerCase();
|
|
@@ -996,7 +1081,7 @@ function formatBridgeFailedMessage(event) {
|
|
|
996
1081
|
}
|
|
997
1082
|
return "Bridge failed";
|
|
998
1083
|
}
|
|
999
|
-
var txLinkIcon = /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1084
|
+
var txLinkIcon = /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkENMIKNXScjs.ExternalLinkIcon, { className: "rs-deposit-notification-link-icon" });
|
|
1000
1085
|
function DepositNotification({
|
|
1001
1086
|
deposit,
|
|
1002
1087
|
smartAccount,
|
|
@@ -1024,7 +1109,7 @@ function DepositNotification({
|
|
|
1024
1109
|
const pollIntervalRef = _react.useRef.call(void 0, INITIAL_POLL_INTERVAL);
|
|
1025
1110
|
const pollTimeoutRef = _react.useRef.call(void 0, null);
|
|
1026
1111
|
const completedRef = _react.useRef.call(void 0, _nullishCoalesce(directTransfer, () => ( false)));
|
|
1027
|
-
const depositContextRef =
|
|
1112
|
+
const depositContextRef = _chunkENMIKNXScjs.useLatestRef.call(void 0, {
|
|
1028
1113
|
amount,
|
|
1029
1114
|
sourceChain,
|
|
1030
1115
|
sourceToken: token,
|
|
@@ -1033,8 +1118,8 @@ function DepositNotification({
|
|
|
1033
1118
|
waitForFinalTx,
|
|
1034
1119
|
hasPostBridgeActions
|
|
1035
1120
|
});
|
|
1036
|
-
const onCompleteRef =
|
|
1037
|
-
const onFailedRef =
|
|
1121
|
+
const onCompleteRef = _chunkENMIKNXScjs.useLatestRef.call(void 0, onComplete);
|
|
1122
|
+
const onFailedRef = _chunkENMIKNXScjs.useLatestRef.call(void 0, onFailed);
|
|
1038
1123
|
const handleComplete = _react.useCallback.call(void 0,
|
|
1039
1124
|
(destTxHash) => {
|
|
1040
1125
|
if (completedRef.current) return;
|
|
@@ -1043,7 +1128,7 @@ function DepositNotification({
|
|
|
1043
1128
|
setCompletedAt(Date.now());
|
|
1044
1129
|
setStatus("complete");
|
|
1045
1130
|
const context = depositContextRef.current;
|
|
1046
|
-
_optionalChain([onCompleteRef, 'access',
|
|
1131
|
+
_optionalChain([onCompleteRef, 'access', _29 => _29.current, 'optionalCall', _30 => _30(txHash, destTxHash, {
|
|
1047
1132
|
amount: context.amount,
|
|
1048
1133
|
sourceChain: context.sourceChain,
|
|
1049
1134
|
sourceToken: context.sourceToken,
|
|
@@ -1058,7 +1143,7 @@ function DepositNotification({
|
|
|
1058
1143
|
if (completedRef.current) return;
|
|
1059
1144
|
completedRef.current = true;
|
|
1060
1145
|
setStatus("failed");
|
|
1061
|
-
_optionalChain([onFailedRef, 'access',
|
|
1146
|
+
_optionalChain([onFailedRef, 'access', _31 => _31.current, 'optionalCall', _32 => _32(txHash, error)]);
|
|
1062
1147
|
},
|
|
1063
1148
|
[onFailedRef, txHash]
|
|
1064
1149
|
);
|
|
@@ -1077,30 +1162,30 @@ function DepositNotification({
|
|
|
1077
1162
|
const lastEvent = data.lastEvent;
|
|
1078
1163
|
const eventForTx = isEventForTx(lastEvent, txHash) ? lastEvent : void 0;
|
|
1079
1164
|
const awaitingPostBridgeSwap = depositContextRef.current.waitForFinalTx && depositContextRef.current.hasPostBridgeActions;
|
|
1080
|
-
if (_optionalChain([eventForTx, 'optionalAccess',
|
|
1081
|
-
const swapTxHash = _optionalChain([eventForTx, 'access',
|
|
1165
|
+
if (_optionalChain([eventForTx, 'optionalAccess', _33 => _33.type]) === "post-bridge-swap-complete") {
|
|
1166
|
+
const swapTxHash = _optionalChain([eventForTx, 'access', _34 => _34.data, 'optionalAccess', _35 => _35.swap, 'optionalAccess', _36 => _36.transactionHash]);
|
|
1082
1167
|
handleComplete(swapTxHash);
|
|
1083
1168
|
return;
|
|
1084
1169
|
}
|
|
1085
|
-
if (_optionalChain([eventForTx, 'optionalAccess',
|
|
1170
|
+
if (_optionalChain([eventForTx, 'optionalAccess', _37 => _37.type]) === "post-bridge-swap-failed") {
|
|
1086
1171
|
handleFailed(formatBridgeFailedMessage(eventForTx));
|
|
1087
1172
|
return;
|
|
1088
1173
|
}
|
|
1089
|
-
if (_optionalChain([eventForTx, 'optionalAccess',
|
|
1090
|
-
const destTx = _optionalChain([eventForTx, 'access',
|
|
1174
|
+
if (_optionalChain([eventForTx, 'optionalAccess', _38 => _38.type]) === "bridge-complete" && !awaitingPostBridgeSwap) {
|
|
1175
|
+
const destTx = _optionalChain([eventForTx, 'access', _39 => _39.data, 'optionalAccess', _40 => _40.destination, 'optionalAccess', _41 => _41.transactionHash]);
|
|
1091
1176
|
handleComplete(destTx);
|
|
1092
1177
|
return;
|
|
1093
1178
|
}
|
|
1094
|
-
if (!waitForFinalTx && _optionalChain([eventForTx, 'optionalAccess',
|
|
1179
|
+
if (!waitForFinalTx && _optionalChain([eventForTx, 'optionalAccess', _42 => _42.type]) === "bridge-started") {
|
|
1095
1180
|
handleComplete(void 0);
|
|
1096
1181
|
return;
|
|
1097
1182
|
}
|
|
1098
|
-
if (_optionalChain([eventForTx, 'optionalAccess',
|
|
1183
|
+
if (_optionalChain([eventForTx, 'optionalAccess', _43 => _43.type]) === "bridge-failed") {
|
|
1099
1184
|
handleFailed(formatBridgeFailedMessage(eventForTx));
|
|
1100
1185
|
return;
|
|
1101
1186
|
}
|
|
1102
|
-
if (_optionalChain([eventForTx, 'optionalAccess',
|
|
1103
|
-
const errorMessage = _nullishCoalesce(_optionalChain([eventForTx, 'access',
|
|
1187
|
+
if (_optionalChain([eventForTx, 'optionalAccess', _44 => _44.type]) === "error") {
|
|
1188
|
+
const errorMessage = _nullishCoalesce(_optionalChain([eventForTx, 'access', _45 => _45.data, 'optionalAccess', _46 => _46.message]), () => ( "Unknown error"));
|
|
1104
1189
|
handleFailed(errorMessage);
|
|
1105
1190
|
return;
|
|
1106
1191
|
}
|
|
@@ -1138,11 +1223,11 @@ function DepositNotification({
|
|
|
1138
1223
|
status,
|
|
1139
1224
|
txHash
|
|
1140
1225
|
]);
|
|
1141
|
-
const sourceExplorerUrl = sourceChain === "unknown" ? void 0 :
|
|
1142
|
-
const destExplorerUrl = destinationTxHash ?
|
|
1226
|
+
const sourceExplorerUrl = sourceChain === "unknown" ? void 0 : _chunkMHKHSCIAcjs.getExplorerTxUrl.call(void 0, sourceChain, txHash);
|
|
1227
|
+
const destExplorerUrl = destinationTxHash ? _chunkMHKHSCIAcjs.getExplorerTxUrl.call(void 0, targetChain, destinationTxHash) : null;
|
|
1143
1228
|
const title = status === "complete" ? "Deposit completed" : status === "failed" ? "Deposit failed" : "Deposit received and processing\u2026";
|
|
1144
1229
|
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.";
|
|
1145
|
-
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,
|
|
1230
|
+
const statusIcon = status === "complete" ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-deposit-notification-badge rs-deposit-notification-badge--complete", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkENMIKNXScjs.CheckIcon, {}) }) : status === "failed" ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-deposit-notification-badge rs-deposit-notification-badge--failed", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkENMIKNXScjs.CloseIcon, {}) }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-deposit-notification-badge rs-deposit-notification-badge--processing", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkENMIKNXScjs.Spinner, {}) });
|
|
1146
1231
|
const showClose = status !== "processing";
|
|
1147
1232
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1148
1233
|
"div",
|
|
@@ -1161,7 +1246,7 @@ function DepositNotification({
|
|
|
1161
1246
|
className: "rs-deposit-notification-close",
|
|
1162
1247
|
onClick: () => onDismiss(deposit.id),
|
|
1163
1248
|
"aria-label": "Dismiss",
|
|
1164
|
-
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1249
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkENMIKNXScjs.CloseIcon, {})
|
|
1165
1250
|
}
|
|
1166
1251
|
)
|
|
1167
1252
|
] }),
|
|
@@ -1177,7 +1262,7 @@ function DepositNotification({
|
|
|
1177
1262
|
"aria-expanded": expanded,
|
|
1178
1263
|
children: [
|
|
1179
1264
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: expanded ? "See less details" : "See more details" }),
|
|
1180
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1265
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkENMIKNXScjs.ChevronDownIcon, { className: "rs-deposit-notification-toggle-chevron" })
|
|
1181
1266
|
]
|
|
1182
1267
|
}
|
|
1183
1268
|
),
|
|
@@ -1228,123 +1313,6 @@ function DepositNotification({
|
|
|
1228
1313
|
);
|
|
1229
1314
|
}
|
|
1230
1315
|
|
|
1231
|
-
// src/core/solana.ts
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
var _web3js = require('@solana/web3.js');
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
var _spltoken = require('@solana/spl-token');
|
|
1243
|
-
var SOLANA_TOKENS = [
|
|
1244
|
-
{ symbol: "SOL", mint: "native", decimals: 9 },
|
|
1245
|
-
{
|
|
1246
|
-
symbol: "USDC",
|
|
1247
|
-
mint: "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
|
|
1248
|
-
decimals: 6
|
|
1249
|
-
},
|
|
1250
|
-
{
|
|
1251
|
-
symbol: "USDT",
|
|
1252
|
-
mint: "Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB",
|
|
1253
|
-
decimals: 6
|
|
1254
|
-
}
|
|
1255
|
-
];
|
|
1256
|
-
var DEFAULT_SOLANA_RPC_URL = "https://api.mainnet.solana.com";
|
|
1257
|
-
var configuredSolanaRpcUrl = null;
|
|
1258
|
-
var cachedConnections = /* @__PURE__ */ new Map();
|
|
1259
|
-
function configureSolanaRpcUrl(rpcUrl) {
|
|
1260
|
-
const normalized = _optionalChain([rpcUrl, 'optionalAccess', _43 => _43.trim, 'call', _44 => _44()]);
|
|
1261
|
-
configuredSolanaRpcUrl = normalized ? normalized : null;
|
|
1262
|
-
cachedConnections.clear();
|
|
1263
|
-
}
|
|
1264
|
-
function getSolanaRpcUrl() {
|
|
1265
|
-
return _nullishCoalesce(configuredSolanaRpcUrl, () => ( DEFAULT_SOLANA_RPC_URL));
|
|
1266
|
-
}
|
|
1267
|
-
function getSolanaConnection() {
|
|
1268
|
-
const rpcUrl = getSolanaRpcUrl();
|
|
1269
|
-
const cached = cachedConnections.get(rpcUrl);
|
|
1270
|
-
if (cached) {
|
|
1271
|
-
return cached;
|
|
1272
|
-
}
|
|
1273
|
-
const next = new (0, _web3js.Connection)(rpcUrl, "confirmed");
|
|
1274
|
-
cachedConnections.set(rpcUrl, next);
|
|
1275
|
-
return next;
|
|
1276
|
-
}
|
|
1277
|
-
function isNativeSol(token) {
|
|
1278
|
-
return token.mint === "native";
|
|
1279
|
-
}
|
|
1280
|
-
async function buildSolTransferTransaction(connection, from, to, lamports) {
|
|
1281
|
-
const fromPubkey = new (0, _web3js.PublicKey)(from);
|
|
1282
|
-
const toPubkey = new (0, _web3js.PublicKey)(to);
|
|
1283
|
-
const tx = new (0, _web3js.Transaction)().add(
|
|
1284
|
-
_web3js.SystemProgram.transfer({
|
|
1285
|
-
fromPubkey,
|
|
1286
|
-
toPubkey,
|
|
1287
|
-
lamports
|
|
1288
|
-
})
|
|
1289
|
-
);
|
|
1290
|
-
const { blockhash, lastValidBlockHeight } = await connection.getLatestBlockhash();
|
|
1291
|
-
tx.recentBlockhash = blockhash;
|
|
1292
|
-
tx.lastValidBlockHeight = lastValidBlockHeight;
|
|
1293
|
-
tx.feePayer = fromPubkey;
|
|
1294
|
-
return tx;
|
|
1295
|
-
}
|
|
1296
|
-
async function buildSplTransferTransaction(connection, from, to, mint, amount) {
|
|
1297
|
-
const fromPubkey = new (0, _web3js.PublicKey)(from);
|
|
1298
|
-
const toPubkey = new (0, _web3js.PublicKey)(to);
|
|
1299
|
-
const mintPubkey = new (0, _web3js.PublicKey)(mint);
|
|
1300
|
-
const fromAta = await _spltoken.getAssociatedTokenAddress.call(void 0, mintPubkey, fromPubkey);
|
|
1301
|
-
const toAta = await _spltoken.getAssociatedTokenAddress.call(void 0, mintPubkey, toPubkey, true);
|
|
1302
|
-
const tx = new (0, _web3js.Transaction)();
|
|
1303
|
-
const toAtaInfo = await connection.getAccountInfo(toAta);
|
|
1304
|
-
if (!toAtaInfo) {
|
|
1305
|
-
tx.add(
|
|
1306
|
-
_spltoken.createAssociatedTokenAccountInstruction.call(void 0,
|
|
1307
|
-
fromPubkey,
|
|
1308
|
-
toAta,
|
|
1309
|
-
toPubkey,
|
|
1310
|
-
mintPubkey
|
|
1311
|
-
)
|
|
1312
|
-
);
|
|
1313
|
-
}
|
|
1314
|
-
tx.add(_spltoken.createTransferInstruction.call(void 0, fromAta, toAta, fromPubkey, amount));
|
|
1315
|
-
const { blockhash, lastValidBlockHeight } = await connection.getLatestBlockhash();
|
|
1316
|
-
tx.recentBlockhash = blockhash;
|
|
1317
|
-
tx.lastValidBlockHeight = lastValidBlockHeight;
|
|
1318
|
-
tx.feePayer = fromPubkey;
|
|
1319
|
-
return tx;
|
|
1320
|
-
}
|
|
1321
|
-
function extractSignature(value) {
|
|
1322
|
-
if (typeof value === "string") {
|
|
1323
|
-
return value.length > 0 ? value : null;
|
|
1324
|
-
}
|
|
1325
|
-
if (typeof value.signature === "string" && value.signature.length > 0) {
|
|
1326
|
-
return value.signature;
|
|
1327
|
-
}
|
|
1328
|
-
if (typeof value.hash === "string" && value.hash.length > 0) {
|
|
1329
|
-
return value.hash;
|
|
1330
|
-
}
|
|
1331
|
-
if (typeof value.txid === "string" && value.txid.length > 0) {
|
|
1332
|
-
return value.txid;
|
|
1333
|
-
}
|
|
1334
|
-
if (typeof value.transactionId === "string" && value.transactionId.length > 0) {
|
|
1335
|
-
return value.transactionId;
|
|
1336
|
-
}
|
|
1337
|
-
return null;
|
|
1338
|
-
}
|
|
1339
|
-
async function sendSolanaTransaction(provider, _connection, transaction) {
|
|
1340
|
-
const result = await provider.signAndSendTransaction(transaction);
|
|
1341
|
-
const signature = extractSignature(result);
|
|
1342
|
-
if (!signature) {
|
|
1343
|
-
throw new Error("Transaction sent but wallet did not return a signature");
|
|
1344
|
-
}
|
|
1345
|
-
return signature;
|
|
1346
|
-
}
|
|
1347
|
-
|
|
1348
1316
|
// src/components/steps/DepositAddressStep.tsx
|
|
1349
1317
|
|
|
1350
1318
|
var QRCode = _react.lazy.call(void 0,
|
|
@@ -1383,7 +1351,7 @@ function asString(value) {
|
|
|
1383
1351
|
function resolveSolanaTokenMeta(token) {
|
|
1384
1352
|
if (!token) return {};
|
|
1385
1353
|
const normalized = token.toLowerCase();
|
|
1386
|
-
const matched = SOLANA_TOKENS.find(
|
|
1354
|
+
const matched = _chunkMHKHSCIAcjs.SOLANA_TOKENS.find(
|
|
1387
1355
|
(entry) => entry.mint.toLowerCase() === normalized
|
|
1388
1356
|
);
|
|
1389
1357
|
if (matched) {
|
|
@@ -1395,7 +1363,7 @@ function resolveSolanaTokenMeta(token) {
|
|
|
1395
1363
|
return {};
|
|
1396
1364
|
}
|
|
1397
1365
|
function getDepositEventDetails(event) {
|
|
1398
|
-
if (!_optionalChain([event, 'optionalAccess',
|
|
1366
|
+
if (!_optionalChain([event, 'optionalAccess', _47 => _47.type]) || !isRecord(event.data)) return {};
|
|
1399
1367
|
if (event.type === "deposit-received") {
|
|
1400
1368
|
const chainId = asChainId(event.data.chain);
|
|
1401
1369
|
const token = asString(event.data.token);
|
|
@@ -1409,12 +1377,12 @@ function getDepositEventDetails(event) {
|
|
|
1409
1377
|
}
|
|
1410
1378
|
if (event.type === "bridge-started") {
|
|
1411
1379
|
const source = isRecord(event.data.source) ? event.data.source : void 0;
|
|
1412
|
-
const chainId = asChainId(_optionalChain([source, 'optionalAccess',
|
|
1413
|
-
const token = asString(_optionalChain([source, 'optionalAccess',
|
|
1380
|
+
const chainId = asChainId(_optionalChain([source, 'optionalAccess', _48 => _48.chain]));
|
|
1381
|
+
const token = asString(_optionalChain([source, 'optionalAccess', _49 => _49.asset]));
|
|
1414
1382
|
const solanaMeta = chainId === "solana" ? resolveSolanaTokenMeta(token) : {};
|
|
1415
1383
|
return {
|
|
1416
1384
|
chainId,
|
|
1417
|
-
amount: asAmount(_optionalChain([source, 'optionalAccess',
|
|
1385
|
+
amount: asAmount(_optionalChain([source, 'optionalAccess', _50 => _50.amount])),
|
|
1418
1386
|
token,
|
|
1419
1387
|
...solanaMeta
|
|
1420
1388
|
};
|
|
@@ -1427,6 +1395,7 @@ function isSameRoute(sourceChain, sourceToken, targetChain, targetToken) {
|
|
|
1427
1395
|
function DepositAddressStep({
|
|
1428
1396
|
smartAccount,
|
|
1429
1397
|
solanaDepositAddress,
|
|
1398
|
+
isUpdating = false,
|
|
1430
1399
|
service,
|
|
1431
1400
|
allowedRoutes,
|
|
1432
1401
|
targetChain,
|
|
@@ -1442,15 +1411,15 @@ function DepositAddressStep({
|
|
|
1442
1411
|
}) {
|
|
1443
1412
|
const hasSolana = Boolean(solanaDepositAddress);
|
|
1444
1413
|
const allowedChainSet = _react.useMemo.call(void 0,
|
|
1445
|
-
() => _optionalChain([allowedRoutes, 'optionalAccess',
|
|
1446
|
-
[_optionalChain([allowedRoutes, 'optionalAccess',
|
|
1414
|
+
() => _optionalChain([allowedRoutes, 'optionalAccess', _51 => _51.sourceChains]) ? new Set(allowedRoutes.sourceChains) : null,
|
|
1415
|
+
[_optionalChain([allowedRoutes, 'optionalAccess', _52 => _52.sourceChains])]
|
|
1447
1416
|
);
|
|
1448
1417
|
const allowedTokenSet = _react.useMemo.call(void 0,
|
|
1449
|
-
() => _optionalChain([allowedRoutes, 'optionalAccess',
|
|
1450
|
-
[_optionalChain([allowedRoutes, 'optionalAccess',
|
|
1418
|
+
() => _optionalChain([allowedRoutes, 'optionalAccess', _53 => _53.sourceTokens]) ? new Set(allowedRoutes.sourceTokens.map((s) => s.toUpperCase())) : null,
|
|
1419
|
+
[_optionalChain([allowedRoutes, 'optionalAccess', _54 => _54.sourceTokens])]
|
|
1451
1420
|
);
|
|
1452
1421
|
const evmChainIds = _react.useMemo.call(void 0, () => {
|
|
1453
|
-
const all =
|
|
1422
|
+
const all = _chunkMHKHSCIAcjs.getSupportedChainIds.call(void 0, );
|
|
1454
1423
|
return allowedChainSet ? all.filter((id) => allowedChainSet.has(id)) : all;
|
|
1455
1424
|
}, [allowedChainSet]);
|
|
1456
1425
|
const chainOptions = _react.useMemo.call(void 0, () => {
|
|
@@ -1464,7 +1433,7 @@ function DepositAddressStep({
|
|
|
1464
1433
|
const [sourceChainId, setSourceChainId] = _react.useState.call(void 0, defaultChainId);
|
|
1465
1434
|
const isSolana = sourceChainId === "solana";
|
|
1466
1435
|
const tokensForChain = _react.useMemo.call(void 0, () => {
|
|
1467
|
-
const all = isSolana ? SOLANA_TOKENS.map((t) => t.symbol) :
|
|
1436
|
+
const all = isSolana ? _chunkMHKHSCIAcjs.SOLANA_TOKENS.map((t) => t.symbol) : _chunkMHKHSCIAcjs.getTargetTokenSymbolsForChain.call(void 0, sourceChainId);
|
|
1468
1437
|
return allowedTokenSet ? all.filter((s) => allowedTokenSet.has(s.toUpperCase())) : all;
|
|
1469
1438
|
}, [sourceChainId, isSolana, allowedTokenSet]);
|
|
1470
1439
|
const defaultToken = tokensForChain.includes("USDC") ? "USDC" : _nullishCoalesce(tokensForChain[0], () => ( "USDC"));
|
|
@@ -1488,23 +1457,23 @@ function DepositAddressStep({
|
|
|
1488
1457
|
const notificationIdRef = _react.useRef.call(void 0, 0);
|
|
1489
1458
|
const sourceSelectionRef = _react.useRef.call(void 0, {
|
|
1490
1459
|
chainId: defaultChainId,
|
|
1491
|
-
token: typeof defaultChainId === "number" ?
|
|
1460
|
+
token: typeof defaultChainId === "number" ? _chunkMHKHSCIAcjs.getTokenAddress.call(void 0, defaultToken, defaultChainId) : void 0,
|
|
1492
1461
|
sourceSymbol: defaultToken
|
|
1493
1462
|
});
|
|
1494
1463
|
_react.useEffect.call(void 0, () => {
|
|
1495
1464
|
if (isSolana) {
|
|
1496
|
-
const matched = _nullishCoalesce(SOLANA_TOKENS.find((t) => t.symbol === sourceTokenSymbol), () => ( SOLANA_TOKENS[0]));
|
|
1465
|
+
const matched = _nullishCoalesce(_chunkMHKHSCIAcjs.SOLANA_TOKENS.find((t) => t.symbol === sourceTokenSymbol), () => ( _chunkMHKHSCIAcjs.SOLANA_TOKENS[0]));
|
|
1497
1466
|
sourceSelectionRef.current = {
|
|
1498
1467
|
chainId: "solana",
|
|
1499
|
-
token: _optionalChain([matched, 'optionalAccess',
|
|
1500
|
-
sourceSymbol: _optionalChain([matched, 'optionalAccess',
|
|
1501
|
-
sourceDecimals: _optionalChain([matched, 'optionalAccess',
|
|
1468
|
+
token: _optionalChain([matched, 'optionalAccess', _55 => _55.mint]),
|
|
1469
|
+
sourceSymbol: _optionalChain([matched, 'optionalAccess', _56 => _56.symbol]),
|
|
1470
|
+
sourceDecimals: _optionalChain([matched, 'optionalAccess', _57 => _57.decimals])
|
|
1502
1471
|
};
|
|
1503
1472
|
return;
|
|
1504
1473
|
}
|
|
1505
1474
|
sourceSelectionRef.current = {
|
|
1506
1475
|
chainId: sourceChainId,
|
|
1507
|
-
token:
|
|
1476
|
+
token: _chunkMHKHSCIAcjs.getTokenAddress.call(void 0, sourceTokenSymbol, sourceChainId),
|
|
1508
1477
|
sourceSymbol: sourceTokenSymbol
|
|
1509
1478
|
};
|
|
1510
1479
|
}, [sourceChainId, sourceTokenSymbol, isSolana]);
|
|
@@ -1516,7 +1485,7 @@ function DepositAddressStep({
|
|
|
1516
1485
|
setLiquidityHelper({ kind: "idle" });
|
|
1517
1486
|
return;
|
|
1518
1487
|
}
|
|
1519
|
-
const sourceTokenAddress =
|
|
1488
|
+
const sourceTokenAddress = _chunkMHKHSCIAcjs.getTokenAddress.call(void 0,
|
|
1520
1489
|
sourceTokenSymbol,
|
|
1521
1490
|
sourceChainId
|
|
1522
1491
|
);
|
|
@@ -1567,8 +1536,8 @@ function DepositAddressStep({
|
|
|
1567
1536
|
function handlePointerDown(event) {
|
|
1568
1537
|
const target = event.target;
|
|
1569
1538
|
if (!target) return;
|
|
1570
|
-
const clickedChainDropdown = _optionalChain([chainDropdownRef, 'access',
|
|
1571
|
-
const clickedTokenDropdown = _optionalChain([tokenDropdownRef, 'access',
|
|
1539
|
+
const clickedChainDropdown = _optionalChain([chainDropdownRef, 'access', _58 => _58.current, 'optionalAccess', _59 => _59.contains, 'call', _60 => _60(target)]);
|
|
1540
|
+
const clickedTokenDropdown = _optionalChain([tokenDropdownRef, 'access', _61 => _61.current, 'optionalAccess', _62 => _62.contains, 'call', _63 => _63(target)]);
|
|
1572
1541
|
if (clickedChainDropdown || clickedTokenDropdown) return;
|
|
1573
1542
|
setChainDropdownOpen(false);
|
|
1574
1543
|
setTokenDropdownOpen(false);
|
|
@@ -1581,7 +1550,8 @@ function DepositAddressStep({
|
|
|
1581
1550
|
};
|
|
1582
1551
|
}, [chainDropdownOpen, tokenDropdownOpen]);
|
|
1583
1552
|
const handleCopy = _react.useCallback.call(void 0, async () => {
|
|
1584
|
-
|
|
1553
|
+
if (isUpdating) return;
|
|
1554
|
+
_optionalChain([onCopyAddress, 'optionalCall', _64 => _64()]);
|
|
1585
1555
|
try {
|
|
1586
1556
|
await navigator.clipboard.writeText(displayAddress);
|
|
1587
1557
|
setCopied(true);
|
|
@@ -1598,7 +1568,7 @@ function DepositAddressStep({
|
|
|
1598
1568
|
setCopied(true);
|
|
1599
1569
|
setTimeout(() => setCopied(false), 2e3);
|
|
1600
1570
|
}
|
|
1601
|
-
}, [displayAddress, onCopyAddress]);
|
|
1571
|
+
}, [displayAddress, onCopyAddress, isUpdating]);
|
|
1602
1572
|
_react.useEffect.call(void 0, () => {
|
|
1603
1573
|
setCopied(false);
|
|
1604
1574
|
setChainDropdownOpen(false);
|
|
@@ -1655,10 +1625,10 @@ function DepositAddressStep({
|
|
|
1655
1625
|
return;
|
|
1656
1626
|
}
|
|
1657
1627
|
const event = status.lastEvent;
|
|
1658
|
-
const eventTxHash =
|
|
1628
|
+
const eventTxHash = _chunkENMIKNXScjs.isDepositEvent.call(void 0, event) ? _nullishCoalesce(_chunkENMIKNXScjs.getEventTxHash.call(void 0, event), () => ( null)) : null;
|
|
1659
1629
|
if (baselineTxHashRef.current === void 0) {
|
|
1660
1630
|
baselineTxHashRef.current = eventTxHash;
|
|
1661
|
-
} else if (eventTxHash && (!baselineTxHashRef.current || !
|
|
1631
|
+
} else if (eventTxHash && (!baselineTxHashRef.current || !_chunkENMIKNXScjs.txRefsMatch.call(void 0, eventTxHash, baselineTxHashRef.current))) {
|
|
1662
1632
|
const details = getDepositEventDetails(event);
|
|
1663
1633
|
const chainId = _nullishCoalesce(details.chainId, () => ( "unknown"));
|
|
1664
1634
|
const amount = _nullishCoalesce(details.amount, () => ( "0"));
|
|
@@ -1687,7 +1657,7 @@ function DepositAddressStep({
|
|
|
1687
1657
|
directTransfer
|
|
1688
1658
|
};
|
|
1689
1659
|
setNotifications((prev) => [notification, ...prev]);
|
|
1690
|
-
_optionalChain([onDepositSubmittedRef, 'access',
|
|
1660
|
+
_optionalChain([onDepositSubmittedRef, 'access', _65 => _65.current, 'optionalCall', _66 => _66({
|
|
1691
1661
|
txHash: eventTxHash,
|
|
1692
1662
|
sourceChain: chainId,
|
|
1693
1663
|
amount
|
|
@@ -1698,7 +1668,7 @@ function DepositAddressStep({
|
|
|
1698
1668
|
if (!cancelled) {
|
|
1699
1669
|
const msg = err instanceof Error ? err.message : "Failed to check status";
|
|
1700
1670
|
setPollingError(msg);
|
|
1701
|
-
_optionalChain([onErrorRef, 'access',
|
|
1671
|
+
_optionalChain([onErrorRef, 'access', _67 => _67.current, 'optionalCall', _68 => _68(msg, "STATUS_POLL_ERROR")]);
|
|
1702
1672
|
}
|
|
1703
1673
|
}
|
|
1704
1674
|
if (!cancelled) {
|
|
@@ -1714,24 +1684,24 @@ function DepositAddressStep({
|
|
|
1714
1684
|
const handleNotificationComplete = _react.useCallback.call(void 0,
|
|
1715
1685
|
(txHash, destinationTxHash, context) => {
|
|
1716
1686
|
isTrackingRef.current = false;
|
|
1717
|
-
_optionalChain([onDepositCompleteRef, 'access',
|
|
1687
|
+
_optionalChain([onDepositCompleteRef, 'access', _69 => _69.current, 'optionalCall', _70 => _70(txHash, destinationTxHash, context)]);
|
|
1718
1688
|
},
|
|
1719
1689
|
[]
|
|
1720
1690
|
);
|
|
1721
1691
|
const handleNotificationFailed = _react.useCallback.call(void 0,
|
|
1722
1692
|
(txHash, error) => {
|
|
1723
1693
|
isTrackingRef.current = false;
|
|
1724
|
-
_optionalChain([onDepositFailedRef, 'access',
|
|
1694
|
+
_optionalChain([onDepositFailedRef, 'access', _71 => _71.current, 'optionalCall', _72 => _72(txHash, error)]);
|
|
1725
1695
|
},
|
|
1726
1696
|
[]
|
|
1727
1697
|
);
|
|
1728
1698
|
const handleNotificationDismiss = _react.useCallback.call(void 0, (id) => {
|
|
1729
1699
|
setNotifications((prev) => prev.filter((n) => n.id !== id));
|
|
1730
1700
|
}, []);
|
|
1731
|
-
const qrIconSrc =
|
|
1701
|
+
const qrIconSrc = _chunkMHKHSCIAcjs.getChainIcon.call(void 0, sourceChainId);
|
|
1732
1702
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-screen rs-step--with-notifications", children: [
|
|
1733
1703
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-screen-body", children: [
|
|
1734
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1704
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkENMIKNXScjs.BodyHeader, { icon: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkENMIKNXScjs.TransferCryptoIcon, {}), title: "Transfer crypto" }),
|
|
1735
1705
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-deposit-address-selectors", children: [
|
|
1736
1706
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-deposit-address-dropdown", ref: chainDropdownRef, children: [
|
|
1737
1707
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-deposit-address-dropdown-label", children: "Supported chain" }),
|
|
@@ -1746,16 +1716,16 @@ function DepositAddressStep({
|
|
|
1746
1716
|
setTokenDropdownOpen(false);
|
|
1747
1717
|
},
|
|
1748
1718
|
children: [
|
|
1749
|
-
|
|
1719
|
+
_chunkMHKHSCIAcjs.getChainIcon.call(void 0, sourceChainId) && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1750
1720
|
"img",
|
|
1751
1721
|
{
|
|
1752
|
-
src:
|
|
1722
|
+
src: _chunkMHKHSCIAcjs.getChainIcon.call(void 0, sourceChainId),
|
|
1753
1723
|
alt: "",
|
|
1754
1724
|
className: "rs-deposit-address-dropdown-icon"
|
|
1755
1725
|
}
|
|
1756
1726
|
),
|
|
1757
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children:
|
|
1758
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1727
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: _chunkMHKHSCIAcjs.getChainName.call(void 0, sourceChainId) }),
|
|
1728
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkENMIKNXScjs.ChevronDownIcon, { className: "rs-deposit-address-dropdown-chevron" })
|
|
1759
1729
|
]
|
|
1760
1730
|
}
|
|
1761
1731
|
),
|
|
@@ -1769,15 +1739,15 @@ function DepositAddressStep({
|
|
|
1769
1739
|
setChainDropdownOpen(false);
|
|
1770
1740
|
},
|
|
1771
1741
|
children: [
|
|
1772
|
-
|
|
1742
|
+
_chunkMHKHSCIAcjs.getChainIcon.call(void 0, chainId) && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1773
1743
|
"img",
|
|
1774
1744
|
{
|
|
1775
|
-
src:
|
|
1745
|
+
src: _chunkMHKHSCIAcjs.getChainIcon.call(void 0, chainId),
|
|
1776
1746
|
alt: "",
|
|
1777
1747
|
className: "rs-deposit-address-dropdown-icon"
|
|
1778
1748
|
}
|
|
1779
1749
|
),
|
|
1780
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children:
|
|
1750
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: _chunkMHKHSCIAcjs.getChainName.call(void 0, chainId) })
|
|
1781
1751
|
]
|
|
1782
1752
|
},
|
|
1783
1753
|
String(chainId)
|
|
@@ -1788,9 +1758,9 @@ function DepositAddressStep({
|
|
|
1788
1758
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: "Supported token" }),
|
|
1789
1759
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "rs-deposit-address-min", children: [
|
|
1790
1760
|
"Min.$",
|
|
1791
|
-
(_nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess',
|
|
1792
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1793
|
-
|
|
1761
|
+
(_nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess', _73 => _73.minDepositUsd]), () => ( 0.1))).toFixed(2),
|
|
1762
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkENMIKNXScjs.Tooltip, { content: "Minimum deposit amount required for the selected chain.", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1763
|
+
_chunkENMIKNXScjs.InfoIcon,
|
|
1794
1764
|
{
|
|
1795
1765
|
className: "rs-deposit-address-min-icon",
|
|
1796
1766
|
"aria-hidden": "true"
|
|
@@ -1809,16 +1779,16 @@ function DepositAddressStep({
|
|
|
1809
1779
|
setChainDropdownOpen(false);
|
|
1810
1780
|
},
|
|
1811
1781
|
children: [
|
|
1812
|
-
|
|
1782
|
+
_chunkMHKHSCIAcjs.getTokenIcon.call(void 0, sourceTokenSymbol) && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1813
1783
|
"img",
|
|
1814
1784
|
{
|
|
1815
|
-
src:
|
|
1785
|
+
src: _chunkMHKHSCIAcjs.getTokenIcon.call(void 0, sourceTokenSymbol),
|
|
1816
1786
|
alt: "",
|
|
1817
1787
|
className: "rs-deposit-address-dropdown-icon"
|
|
1818
1788
|
}
|
|
1819
1789
|
),
|
|
1820
1790
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: sourceTokenSymbol }),
|
|
1821
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1791
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkENMIKNXScjs.ChevronDownIcon, { className: "rs-deposit-address-dropdown-chevron" })
|
|
1822
1792
|
]
|
|
1823
1793
|
}
|
|
1824
1794
|
),
|
|
@@ -1832,10 +1802,10 @@ function DepositAddressStep({
|
|
|
1832
1802
|
setTokenDropdownOpen(false);
|
|
1833
1803
|
},
|
|
1834
1804
|
children: [
|
|
1835
|
-
|
|
1805
|
+
_chunkMHKHSCIAcjs.getTokenIcon.call(void 0, symbol) && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1836
1806
|
"img",
|
|
1837
1807
|
{
|
|
1838
|
-
src:
|
|
1808
|
+
src: _chunkMHKHSCIAcjs.getTokenIcon.call(void 0, symbol),
|
|
1839
1809
|
alt: "",
|
|
1840
1810
|
className: "rs-deposit-address-dropdown-icon"
|
|
1841
1811
|
}
|
|
@@ -1852,36 +1822,45 @@ function DepositAddressStep({
|
|
|
1852
1822
|
{
|
|
1853
1823
|
style: { display: "flex", flexDirection: "column", gap: 4, width: "100%" },
|
|
1854
1824
|
children: [
|
|
1855
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1856
|
-
|
|
1857
|
-
|
|
1858
|
-
{
|
|
1859
|
-
|
|
1860
|
-
|
|
1825
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1826
|
+
"div",
|
|
1827
|
+
{
|
|
1828
|
+
className: `rs-deposit-address-well ${isUpdating ? "rs-deposit-address-well--updating" : ""}`,
|
|
1829
|
+
children: [
|
|
1830
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-deposit-address-qr", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1831
|
+
_react.Suspense,
|
|
1861
1832
|
{
|
|
1862
|
-
|
|
1863
|
-
|
|
1864
|
-
|
|
1865
|
-
|
|
1866
|
-
|
|
1867
|
-
|
|
1868
|
-
|
|
1869
|
-
|
|
1833
|
+
fallback: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1834
|
+
"div",
|
|
1835
|
+
{
|
|
1836
|
+
style: {
|
|
1837
|
+
width: 200,
|
|
1838
|
+
height: 200,
|
|
1839
|
+
display: "flex",
|
|
1840
|
+
alignItems: "center",
|
|
1841
|
+
justifyContent: "center"
|
|
1842
|
+
},
|
|
1843
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkENMIKNXScjs.Spinner, {})
|
|
1844
|
+
}
|
|
1845
|
+
),
|
|
1846
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, QRCode, { value: displayAddress, size: 200, iconSrc: qrIconSrc })
|
|
1870
1847
|
}
|
|
1871
|
-
),
|
|
1872
|
-
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
|
|
1877
|
-
|
|
1848
|
+
) }),
|
|
1849
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-deposit-address-value", children: displayAddress })
|
|
1850
|
+
]
|
|
1851
|
+
}
|
|
1852
|
+
),
|
|
1853
|
+
isUpdating ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-deposit-address-updating", role: "status", children: [
|
|
1854
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkENMIKNXScjs.Spinner, { className: "rs-spinner--sm" }),
|
|
1855
|
+
"Updating deposit details\u2026"
|
|
1856
|
+
] }) : /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1878
1857
|
"button",
|
|
1879
1858
|
{
|
|
1880
1859
|
type: "button",
|
|
1881
1860
|
className: "rs-deposit-address-copy",
|
|
1882
1861
|
onClick: handleCopy,
|
|
1883
1862
|
children: [
|
|
1884
|
-
copied ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1863
|
+
copied ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkENMIKNXScjs.CheckIcon, {}) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkENMIKNXScjs.CopyIcon, {}),
|
|
1885
1864
|
copied ? "Copied!" : "Copy address"
|
|
1886
1865
|
]
|
|
1887
1866
|
}
|
|
@@ -1906,16 +1885,16 @@ function DepositAddressStep({
|
|
|
1906
1885
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-price-impact-label", children: "Price impact" }),
|
|
1907
1886
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-price-impact-label", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "strong", { children: "0.00%" }) }),
|
|
1908
1887
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1909
|
-
|
|
1888
|
+
_chunkENMIKNXScjs.Tooltip,
|
|
1910
1889
|
{
|
|
1911
1890
|
className: "rs-price-impact-info",
|
|
1912
1891
|
content: "Price impact is the difference between expected and execution price, due to trade size and liquidity.",
|
|
1913
|
-
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1892
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkENMIKNXScjs.InfoIcon, { "aria-hidden": "true" })
|
|
1914
1893
|
}
|
|
1915
1894
|
)
|
|
1916
1895
|
] }),
|
|
1917
1896
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1918
|
-
|
|
1897
|
+
_chunkENMIKNXScjs.ChevronDownIcon,
|
|
1919
1898
|
{
|
|
1920
1899
|
className: "rs-price-impact-chevron",
|
|
1921
1900
|
"aria-hidden": "true"
|
|
@@ -1926,29 +1905,29 @@ function DepositAddressStep({
|
|
|
1926
1905
|
),
|
|
1927
1906
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-price-impact-panel", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-price-impact-panel-inner", children: [
|
|
1928
1907
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-price-impact-row", children: [
|
|
1929
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-price-impact-row-icon", "aria-hidden": "true", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1908
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-price-impact-row-icon", "aria-hidden": "true", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkENMIKNXScjs.PercentIcon, {}) }),
|
|
1930
1909
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "rs-price-impact-label", children: [
|
|
1931
1910
|
"Max slippage: ",
|
|
1932
1911
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "strong", { children: "0.2%" })
|
|
1933
1912
|
] }),
|
|
1934
1913
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1935
|
-
|
|
1914
|
+
_chunkENMIKNXScjs.Tooltip,
|
|
1936
1915
|
{
|
|
1937
1916
|
className: "rs-price-impact-info",
|
|
1938
1917
|
content: "Slippage accounts for price changes during execution. Slippage is adjusted per pair to ensure reliable execution.",
|
|
1939
|
-
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1918
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkENMIKNXScjs.InfoIcon, { "aria-hidden": "true" })
|
|
1940
1919
|
}
|
|
1941
1920
|
)
|
|
1942
1921
|
] }),
|
|
1943
1922
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-price-impact-row", children: [
|
|
1944
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-price-impact-row-icon", "aria-hidden": "true", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1923
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-price-impact-row-icon", "aria-hidden": "true", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkENMIKNXScjs.ClockIcon, {}) }),
|
|
1945
1924
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "rs-price-impact-label", children: [
|
|
1946
1925
|
"Processing time: ",
|
|
1947
1926
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "strong", { children: "< 1 min" })
|
|
1948
1927
|
] })
|
|
1949
1928
|
] }),
|
|
1950
1929
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-price-impact-row", children: [
|
|
1951
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-price-impact-row-icon", "aria-hidden": "true", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1930
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-price-impact-row-icon", "aria-hidden": "true", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkENMIKNXScjs.PlusCircleIcon, {}) }),
|
|
1952
1931
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "rs-price-impact-label", children: [
|
|
1953
1932
|
"Max deposit:",
|
|
1954
1933
|
" ",
|
|
@@ -1981,7 +1960,7 @@ function DepositAddressStep({
|
|
|
1981
1960
|
},
|
|
1982
1961
|
deposit.id
|
|
1983
1962
|
)) }),
|
|
1984
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1963
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkENMIKNXScjs.PoweredBy, {})
|
|
1985
1964
|
] });
|
|
1986
1965
|
}
|
|
1987
1966
|
DepositAddressStep.displayName = "DepositAddressStep";
|
|
@@ -1995,6 +1974,7 @@ function SolanaTokenSelectStep({
|
|
|
1995
1974
|
service,
|
|
1996
1975
|
onContinue,
|
|
1997
1976
|
onTotalBalanceComputed,
|
|
1977
|
+
onDisconnect,
|
|
1998
1978
|
debug
|
|
1999
1979
|
}) {
|
|
2000
1980
|
const [tokenBalances, setTokenBalances] = _react.useState.call(void 0, []);
|
|
@@ -2012,14 +1992,14 @@ function SolanaTokenSelectStep({
|
|
|
2012
1992
|
setError(null);
|
|
2013
1993
|
const portfolioBySymbol = {};
|
|
2014
1994
|
try {
|
|
2015
|
-
|
|
1995
|
+
_chunkENMIKNXScjs.debugLog.call(void 0, debug, "solana-token-select", "portfolio:request", {
|
|
2016
1996
|
solanaAddress
|
|
2017
1997
|
});
|
|
2018
1998
|
const portfolio = await service.fetchSolanaPortfolio(solanaAddress);
|
|
2019
1999
|
if (!active) return;
|
|
2020
2000
|
for (const t of portfolio.tokens) {
|
|
2021
2001
|
const symbol = t.symbol.toUpperCase();
|
|
2022
|
-
if (!SOLANA_TOKENS.some((st) => st.symbol === symbol)) continue;
|
|
2002
|
+
if (!_chunkMHKHSCIAcjs.SOLANA_TOKENS.some((st) => st.symbol === symbol)) continue;
|
|
2023
2003
|
let parsed = 0n;
|
|
2024
2004
|
try {
|
|
2025
2005
|
parsed = BigInt(t.balance || "0");
|
|
@@ -2035,12 +2015,12 @@ function SolanaTokenSelectStep({
|
|
|
2035
2015
|
};
|
|
2036
2016
|
}
|
|
2037
2017
|
}
|
|
2038
|
-
|
|
2018
|
+
_chunkENMIKNXScjs.debugLog.call(void 0, debug, "solana-token-select", "portfolio:success", {
|
|
2039
2019
|
symbols: Object.keys(portfolioBySymbol)
|
|
2040
2020
|
});
|
|
2041
2021
|
} catch (err) {
|
|
2042
2022
|
if (!active) return;
|
|
2043
|
-
|
|
2023
|
+
_chunkENMIKNXScjs.debugError.call(void 0, debug, "solana-token-select", "portfolio:failure", err, {
|
|
2044
2024
|
solanaAddress
|
|
2045
2025
|
});
|
|
2046
2026
|
setError(
|
|
@@ -2051,7 +2031,7 @@ function SolanaTokenSelectStep({
|
|
|
2051
2031
|
return;
|
|
2052
2032
|
}
|
|
2053
2033
|
const results = [];
|
|
2054
|
-
for (const token of SOLANA_TOKENS) {
|
|
2034
|
+
for (const token of _chunkMHKHSCIAcjs.SOLANA_TOKENS) {
|
|
2055
2035
|
const fromPortfolio = portfolioBySymbol[token.symbol];
|
|
2056
2036
|
if (fromPortfolio && fromPortfolio.balance > 0n) {
|
|
2057
2037
|
results.push({
|
|
@@ -2065,7 +2045,7 @@ function SolanaTokenSelectStep({
|
|
|
2065
2045
|
setTokenBalances(results);
|
|
2066
2046
|
setLoading(false);
|
|
2067
2047
|
const totalUsd = results.reduce((sum, r) => sum + r.balanceUsd, 0);
|
|
2068
|
-
_optionalChain([onTotalBalanceComputed, 'optionalCall',
|
|
2048
|
+
_optionalChain([onTotalBalanceComputed, 'optionalCall', _74 => _74(totalUsd)]);
|
|
2069
2049
|
}
|
|
2070
2050
|
void loadBalances();
|
|
2071
2051
|
return () => {
|
|
@@ -2082,112 +2062,104 @@ function SolanaTokenSelectStep({
|
|
|
2082
2062
|
[tokenBalances]
|
|
2083
2063
|
);
|
|
2084
2064
|
const selectedEntry = selectedSymbol ? rows.find((r) => r.token.symbol === selectedSymbol) : null;
|
|
2085
|
-
|
|
2086
|
-
|
|
2087
|
-
|
|
2088
|
-
|
|
2089
|
-
|
|
2090
|
-
|
|
2091
|
-
|
|
2092
|
-
|
|
2093
|
-
|
|
2094
|
-
|
|
2095
|
-
|
|
2096
|
-
|
|
2097
|
-
|
|
2098
|
-
|
|
2099
|
-
|
|
2100
|
-
|
|
2101
|
-
|
|
2102
|
-
|
|
2103
|
-
|
|
2104
|
-
|
|
2105
|
-
|
|
2106
|
-
|
|
2107
|
-
|
|
2108
|
-
|
|
2109
|
-
|
|
2110
|
-
|
|
2111
|
-
|
|
2112
|
-
|
|
2113
|
-
|
|
2114
|
-
|
|
2115
|
-
|
|
2116
|
-
|
|
2117
|
-
|
|
2118
|
-
|
|
2119
|
-
|
|
2120
|
-
|
|
2121
|
-
|
|
2122
|
-
|
|
2123
|
-
|
|
2124
|
-
|
|
2125
|
-
|
|
2126
|
-
|
|
2127
|
-
|
|
2128
|
-
|
|
2129
|
-
|
|
2130
|
-
|
|
2131
|
-
|
|
2132
|
-
|
|
2133
|
-
|
|
2134
|
-
|
|
2135
|
-
|
|
2136
|
-
|
|
2137
|
-
|
|
2138
|
-
|
|
2139
|
-
|
|
2140
|
-
|
|
2141
|
-
|
|
2142
|
-
|
|
2143
|
-
|
|
2144
|
-
|
|
2145
|
-
|
|
2146
|
-
|
|
2147
|
-
|
|
2148
|
-
|
|
2149
|
-
|
|
2150
|
-
|
|
2151
|
-
|
|
2152
|
-
|
|
2153
|
-
}
|
|
2154
|
-
)
|
|
2155
|
-
] }),
|
|
2156
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { children: [
|
|
2157
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-asset-name", children: [
|
|
2158
|
-
entry.token.symbol,
|
|
2159
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-asset-chain", children: " on Solana" })
|
|
2160
|
-
] }),
|
|
2161
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-asset-balance-small", children: [
|
|
2162
|
-
formattedBalance,
|
|
2163
|
-
" ",
|
|
2164
|
-
entry.token.symbol
|
|
2165
|
-
] })
|
|
2065
|
+
const formatBalance = (entry) => {
|
|
2066
|
+
try {
|
|
2067
|
+
const raw = _viem.formatUnits.call(void 0, entry.balance, entry.token.decimals);
|
|
2068
|
+
const numeric = Number(raw);
|
|
2069
|
+
if (!Number.isFinite(numeric)) return raw;
|
|
2070
|
+
return _chunkENMIKNXScjs.tokenFormatter.format(numeric);
|
|
2071
|
+
} catch (e16) {
|
|
2072
|
+
return "--";
|
|
2073
|
+
}
|
|
2074
|
+
};
|
|
2075
|
+
const chainIcon = _chunkMHKHSCIAcjs.getChainIcon.call(void 0, "solana");
|
|
2076
|
+
const chainName = _chunkMHKHSCIAcjs.getChainName.call(void 0, "solana");
|
|
2077
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-screen", children: [
|
|
2078
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-screen-body", children: [
|
|
2079
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2080
|
+
_chunkENMIKNXScjs.BodyHeader,
|
|
2081
|
+
{
|
|
2082
|
+
icon: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkENMIKNXScjs.WalletIcon, {}),
|
|
2083
|
+
title: "Your assets",
|
|
2084
|
+
subtitle: "Select source assets to transfer"
|
|
2085
|
+
}
|
|
2086
|
+
),
|
|
2087
|
+
loading && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-loading-state", style: { padding: "40px 12px" }, children: [
|
|
2088
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkENMIKNXScjs.Spinner, { className: "rs-text-tertiary" }),
|
|
2089
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-text-sm rs-text-tertiary", children: "Loading balances" })
|
|
2090
|
+
] }),
|
|
2091
|
+
error && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkENMIKNXScjs.Callout, { variant: "error", children: error }),
|
|
2092
|
+
!loading && !error && rows.length === 0 && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-empty-state", children: [
|
|
2093
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkENMIKNXScjs.WalletIcon, { className: "rs-empty-icon" }),
|
|
2094
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-empty-text", children: "No funds in connected wallet" }),
|
|
2095
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-empty-address", children: [
|
|
2096
|
+
solanaAddress.slice(0, 6),
|
|
2097
|
+
"...",
|
|
2098
|
+
solanaAddress.slice(-4)
|
|
2099
|
+
] }),
|
|
2100
|
+
onDisconnect && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2101
|
+
"button",
|
|
2102
|
+
{
|
|
2103
|
+
type: "button",
|
|
2104
|
+
className: "rs-empty-disconnect",
|
|
2105
|
+
onClick: onDisconnect,
|
|
2106
|
+
children: "Disconnect wallet"
|
|
2107
|
+
}
|
|
2108
|
+
)
|
|
2109
|
+
] }),
|
|
2110
|
+
!loading && !error && rows.length > 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-asset-list", children: rows.map((entry) => {
|
|
2111
|
+
const isSelected = selectedSymbol === entry.token.symbol;
|
|
2112
|
+
const tokenAmount = formatBalance(entry);
|
|
2113
|
+
const tokenIcon = _chunkMHKHSCIAcjs.getTokenIcon.call(void 0, entry.token.symbol);
|
|
2114
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2115
|
+
"button",
|
|
2116
|
+
{
|
|
2117
|
+
type: "button",
|
|
2118
|
+
onClick: () => setSelectedSymbol(entry.token.symbol),
|
|
2119
|
+
className: `rs-asset-row ${isSelected ? "rs-asset-row--selected" : ""}`,
|
|
2120
|
+
"aria-pressed": isSelected,
|
|
2121
|
+
children: [
|
|
2122
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-asset-info", children: [
|
|
2123
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-asset-icon-wrapper", children: [
|
|
2124
|
+
tokenIcon ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-asset-icon", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "img", { src: tokenIcon, alt: entry.token.symbol }) }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-asset-icon", children: entry.token.symbol.slice(0, 4) }),
|
|
2125
|
+
chainIcon && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-asset-chain-badge", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "img", { src: chainIcon, alt: chainName }) })
|
|
2126
|
+
] }),
|
|
2127
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-asset-text", children: [
|
|
2128
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-asset-name-row", children: [
|
|
2129
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-asset-name", children: entry.token.symbol }),
|
|
2130
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "rs-asset-chain", children: [
|
|
2131
|
+
"on ",
|
|
2132
|
+
chainName
|
|
2166
2133
|
] })
|
|
2167
2134
|
] }),
|
|
2168
|
-
/* @__PURE__ */ _jsxruntime.
|
|
2169
|
-
|
|
2170
|
-
|
|
2171
|
-
|
|
2172
|
-
|
|
2173
|
-
|
|
2174
|
-
|
|
2175
|
-
|
|
2176
|
-
|
|
2177
|
-
|
|
2178
|
-
|
|
2179
|
-
|
|
2180
|
-
|
|
2181
|
-
|
|
2182
|
-
|
|
2183
|
-
|
|
2184
|
-
|
|
2185
|
-
|
|
2186
|
-
|
|
2187
|
-
|
|
2188
|
-
|
|
2189
|
-
|
|
2190
|
-
|
|
2135
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-asset-balance-small", children: [
|
|
2136
|
+
tokenAmount,
|
|
2137
|
+
" ",
|
|
2138
|
+
entry.token.symbol
|
|
2139
|
+
] })
|
|
2140
|
+
] })
|
|
2141
|
+
] }),
|
|
2142
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-asset-balance", children: entry.balanceUsd > 0 ? _chunkENMIKNXScjs.currencyFormatter.format(entry.balanceUsd) : tokenAmount !== "--" ? `${tokenAmount} ${entry.token.symbol}` : "--" })
|
|
2143
|
+
]
|
|
2144
|
+
},
|
|
2145
|
+
entry.token.symbol
|
|
2146
|
+
);
|
|
2147
|
+
}) }),
|
|
2148
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2149
|
+
_chunkENMIKNXScjs.Button,
|
|
2150
|
+
{
|
|
2151
|
+
onClick: () => selectedEntry && onContinue(
|
|
2152
|
+
selectedEntry.token,
|
|
2153
|
+
selectedEntry.balance,
|
|
2154
|
+
selectedEntry.balanceUsd
|
|
2155
|
+
),
|
|
2156
|
+
disabled: !selectedEntry,
|
|
2157
|
+
fullWidth: true,
|
|
2158
|
+
children: "Continue"
|
|
2159
|
+
}
|
|
2160
|
+
)
|
|
2161
|
+
] }),
|
|
2162
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkENMIKNXScjs.PoweredBy, {})
|
|
2191
2163
|
] });
|
|
2192
2164
|
}
|
|
2193
2165
|
|
|
@@ -2211,13 +2183,15 @@ function SolanaAmountStep({
|
|
|
2211
2183
|
targetChainName,
|
|
2212
2184
|
targetTokenSymbol,
|
|
2213
2185
|
targetTokenIcon,
|
|
2214
|
-
|
|
2186
|
+
appBalanceUsd,
|
|
2215
2187
|
onContinue,
|
|
2216
2188
|
debug
|
|
2217
2189
|
}) {
|
|
2218
2190
|
const [amount, setAmount] = _react.useState.call(void 0, "");
|
|
2219
2191
|
const [error, setError] = _react.useState.call(void 0, null);
|
|
2220
|
-
const
|
|
2192
|
+
const hasAppliedDefaultRef = _react.useRef.call(void 0, false);
|
|
2193
|
+
const isSourceStablecoin = _chunkMHKHSCIAcjs.isStablecoinSymbol.call(void 0, token.symbol);
|
|
2194
|
+
const isMaxDefault = _optionalChain([defaultAmount, 'optionalAccess', _75 => _75.trim, 'call', _76 => _76(), 'access', _77 => _77.toLowerCase, 'call', _78 => _78()]) === "max";
|
|
2221
2195
|
const tokenPriceUsd = _react.useMemo.call(void 0, () => {
|
|
2222
2196
|
if (isSourceStablecoin) return 1;
|
|
2223
2197
|
try {
|
|
@@ -2232,20 +2206,12 @@ function SolanaAmountStep({
|
|
|
2232
2206
|
}
|
|
2233
2207
|
}, [isSourceStablecoin, balance, token.decimals, balanceUsd]);
|
|
2234
2208
|
const hasPricing = tokenPriceUsd !== null;
|
|
2235
|
-
_react.useEffect.call(void 0, () => {
|
|
2236
|
-
if (defaultAmount && !amount) {
|
|
2237
|
-
const parsed = Number(defaultAmount);
|
|
2238
|
-
if (Number.isFinite(parsed) && parsed > 0) {
|
|
2239
|
-
setAmount(parsed.toString());
|
|
2240
|
-
}
|
|
2241
|
-
}
|
|
2242
|
-
}, [defaultAmount, amount]);
|
|
2243
2209
|
const formattedBalance = _react.useMemo.call(void 0, () => {
|
|
2244
2210
|
try {
|
|
2245
2211
|
const raw = _viem.formatUnits.call(void 0, balance, token.decimals);
|
|
2246
2212
|
const numeric = Number(raw);
|
|
2247
2213
|
if (!Number.isFinite(numeric)) return raw;
|
|
2248
|
-
return
|
|
2214
|
+
return _chunkENMIKNXScjs.tokenFormatter.format(numeric);
|
|
2249
2215
|
} catch (e18) {
|
|
2250
2216
|
return "\u2026";
|
|
2251
2217
|
}
|
|
@@ -2262,7 +2228,7 @@ function SolanaAmountStep({
|
|
|
2262
2228
|
}
|
|
2263
2229
|
}, [balance, token.decimals, tokenPriceUsd, balanceUsd]);
|
|
2264
2230
|
const spendableBalance = _react.useMemo.call(void 0, () => {
|
|
2265
|
-
if (!isNativeSol(token)) return balance;
|
|
2231
|
+
if (!_chunkMHKHSCIAcjs.isNativeSol.call(void 0, token)) return balance;
|
|
2266
2232
|
return balance > SOL_FEE_RESERVE_LAMPORTS ? balance - SOL_FEE_RESERVE_LAMPORTS : 0n;
|
|
2267
2233
|
}, [balance, token]);
|
|
2268
2234
|
const spendableBalanceUsd = _react.useMemo.call(void 0, () => {
|
|
@@ -2275,6 +2241,45 @@ function SolanaAmountStep({
|
|
|
2275
2241
|
return null;
|
|
2276
2242
|
}
|
|
2277
2243
|
}, [spendableBalance, token.decimals, tokenPriceUsd]);
|
|
2244
|
+
const computePresetAmount = _react.useCallback.call(void 0,
|
|
2245
|
+
(percentage) => {
|
|
2246
|
+
try {
|
|
2247
|
+
const spendableUnits = Number(
|
|
2248
|
+
_viem.formatUnits.call(void 0, spendableBalance, token.decimals)
|
|
2249
|
+
);
|
|
2250
|
+
if (!Number.isFinite(spendableUnits) || spendableUnits <= 0) return "";
|
|
2251
|
+
const value = isSourceStablecoin || !hasPricing ? spendableUnits * percentage / 100 : (_nullishCoalesce(spendableBalanceUsd, () => ( 0))) * percentage / 100;
|
|
2252
|
+
const factor = 1e3;
|
|
2253
|
+
const truncated = Math.floor(value * factor) / factor;
|
|
2254
|
+
return truncated.toFixed(3).replace(/\.?0+$/, "");
|
|
2255
|
+
} catch (e21) {
|
|
2256
|
+
return "";
|
|
2257
|
+
}
|
|
2258
|
+
},
|
|
2259
|
+
[
|
|
2260
|
+
spendableBalance,
|
|
2261
|
+
token.decimals,
|
|
2262
|
+
isSourceStablecoin,
|
|
2263
|
+
hasPricing,
|
|
2264
|
+
spendableBalanceUsd
|
|
2265
|
+
]
|
|
2266
|
+
);
|
|
2267
|
+
_react.useEffect.call(void 0, () => {
|
|
2268
|
+
if (hasAppliedDefaultRef.current || !defaultAmount) return;
|
|
2269
|
+
if (isMaxDefault) {
|
|
2270
|
+
const next = computePresetAmount(100);
|
|
2271
|
+
if (next) {
|
|
2272
|
+
setAmount(next);
|
|
2273
|
+
hasAppliedDefaultRef.current = true;
|
|
2274
|
+
}
|
|
2275
|
+
return;
|
|
2276
|
+
}
|
|
2277
|
+
const parsed = Number(defaultAmount);
|
|
2278
|
+
if (Number.isFinite(parsed) && parsed > 0) {
|
|
2279
|
+
setAmount(parsed.toString());
|
|
2280
|
+
hasAppliedDefaultRef.current = true;
|
|
2281
|
+
}
|
|
2282
|
+
}, [defaultAmount, isMaxDefault, computePresetAmount]);
|
|
2278
2283
|
const numericAmount = _react.useMemo.call(void 0, () => {
|
|
2279
2284
|
const parsed = parseFloat(amount);
|
|
2280
2285
|
return Number.isFinite(parsed) && parsed > 0 ? parsed : 0;
|
|
@@ -2284,35 +2289,27 @@ function SolanaAmountStep({
|
|
|
2284
2289
|
const raw = isSourceStablecoin || !hasPricing ? numericAmount : numericAmount / (_nullishCoalesce(tokenPriceUsd, () => ( 1)));
|
|
2285
2290
|
try {
|
|
2286
2291
|
return _viem.parseUnits.call(void 0, raw.toString(), token.decimals);
|
|
2287
|
-
} catch (
|
|
2292
|
+
} catch (e22) {
|
|
2288
2293
|
return null;
|
|
2289
2294
|
}
|
|
2290
2295
|
}, [numericAmount, isSourceStablecoin, hasPricing, tokenPriceUsd, token.decimals]);
|
|
2291
|
-
const minDepositUsd = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess',
|
|
2292
|
-
const maxDepositUsd = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess',
|
|
2296
|
+
const minDepositUsd = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess', _79 => _79.minDepositUsd]), () => ( null));
|
|
2297
|
+
const maxDepositUsd = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess', _80 => _80.maxDepositUsd]), () => ( null));
|
|
2293
2298
|
const isBelowMin = minDepositUsd !== null && numericAmount > 0 && numericAmount < minDepositUsd;
|
|
2294
2299
|
const isAboveMax = maxDepositUsd !== null && numericAmount > maxDepositUsd;
|
|
2295
2300
|
const exceedsBalance = Boolean(
|
|
2296
2301
|
sourceAmountUnits !== null && sourceAmountUnits > spendableBalance
|
|
2297
2302
|
);
|
|
2298
|
-
const balanceAfterUsd =
|
|
2303
|
+
const balanceAfterUsd = appBalanceUsd !== void 0 ? appBalanceUsd + numericAmount : null;
|
|
2299
2304
|
const handlePresetClick = (percentage) => {
|
|
2300
|
-
|
|
2301
|
-
|
|
2302
|
-
|
|
2303
|
-
|
|
2304
|
-
|
|
2305
|
-
|
|
2306
|
-
|
|
2307
|
-
|
|
2308
|
-
percentage,
|
|
2309
|
-
symbol: token.symbol,
|
|
2310
|
-
formatted
|
|
2311
|
-
});
|
|
2312
|
-
setAmount(formatted);
|
|
2313
|
-
} catch (e22) {
|
|
2314
|
-
return;
|
|
2315
|
-
}
|
|
2305
|
+
const formatted = computePresetAmount(percentage);
|
|
2306
|
+
if (!formatted) return;
|
|
2307
|
+
_chunkENMIKNXScjs.debugLog.call(void 0, debug, "solana-amount", "amount:preset", {
|
|
2308
|
+
percentage,
|
|
2309
|
+
symbol: token.symbol,
|
|
2310
|
+
formatted
|
|
2311
|
+
});
|
|
2312
|
+
setAmount(formatted);
|
|
2316
2313
|
if (error) setError(null);
|
|
2317
2314
|
};
|
|
2318
2315
|
const handleAmountChange = (raw) => {
|
|
@@ -2342,7 +2339,7 @@ function SolanaAmountStep({
|
|
|
2342
2339
|
try {
|
|
2343
2340
|
amountInUnits = _viem.parseUnits.call(void 0, sourceAmountStr, token.decimals);
|
|
2344
2341
|
} catch (e23) {
|
|
2345
|
-
|
|
2342
|
+
_chunkENMIKNXScjs.debugLog.call(void 0, debug, "solana-amount", "amount:invalid", {
|
|
2346
2343
|
amount,
|
|
2347
2344
|
sourceAmount: sourceAmountStr,
|
|
2348
2345
|
reason: "parse-units-failed"
|
|
@@ -2351,13 +2348,13 @@ function SolanaAmountStep({
|
|
|
2351
2348
|
return;
|
|
2352
2349
|
}
|
|
2353
2350
|
if (amountInUnits > spendableBalance) {
|
|
2354
|
-
const isReserveIssue = isNativeSol(token) && amountInUnits <= balance;
|
|
2351
|
+
const isReserveIssue = _chunkMHKHSCIAcjs.isNativeSol.call(void 0, token) && amountInUnits <= balance;
|
|
2355
2352
|
setError(
|
|
2356
2353
|
isReserveIssue ? "Use a bit less than your full SOL balance" : "Insufficient balance"
|
|
2357
2354
|
);
|
|
2358
2355
|
return;
|
|
2359
2356
|
}
|
|
2360
|
-
|
|
2357
|
+
_chunkENMIKNXScjs.debugLog.call(void 0, debug, "solana-amount", "amount:continue", {
|
|
2361
2358
|
symbol: token.symbol,
|
|
2362
2359
|
inputAmountUsd: amount,
|
|
2363
2360
|
sourceAmount: sourceAmountStr,
|
|
@@ -2368,27 +2365,21 @@ function SolanaAmountStep({
|
|
|
2368
2365
|
};
|
|
2369
2366
|
const continueLabel = exceedsBalance ? "Insufficient balance" : isAboveMax ? "Continue with max allowed deposit" : isBelowMin ? "Continue with minimum deposit" : "Continue";
|
|
2370
2367
|
const continueDisabled = exceedsBalance || numericAmount === 0 && !isBelowMin;
|
|
2371
|
-
const sourceTokenIcon =
|
|
2368
|
+
const sourceTokenIcon = _chunkMHKHSCIAcjs.getTokenIcon.call(void 0, token.symbol);
|
|
2372
2369
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-screen", children: [
|
|
2373
2370
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-screen-body rs-screen-body--gap-32", children: [
|
|
2374
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2371
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkENMIKNXScjs.BodyHeader, { icon: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkENMIKNXScjs.WalletIcon, {}), title: "Wallet deposit" }),
|
|
2375
2372
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-amount-section", children: [
|
|
2376
2373
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-amount-display", children: [
|
|
2377
|
-
/* @__PURE__ */ _jsxruntime.
|
|
2378
|
-
|
|
2379
|
-
|
|
2380
|
-
|
|
2381
|
-
|
|
2382
|
-
|
|
2383
|
-
|
|
2384
|
-
|
|
2385
|
-
|
|
2386
|
-
onChange: (e) => handleAmountChange(e.target.value),
|
|
2387
|
-
"aria-label": "Deposit amount",
|
|
2388
|
-
autoFocus: true
|
|
2389
|
-
}
|
|
2390
|
-
)
|
|
2391
|
-
] }),
|
|
2374
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2375
|
+
AnimatedAmountInput,
|
|
2376
|
+
{
|
|
2377
|
+
value: amount,
|
|
2378
|
+
onChange: handleAmountChange,
|
|
2379
|
+
ariaLabel: "Deposit amount",
|
|
2380
|
+
autoFocus: true
|
|
2381
|
+
}
|
|
2382
|
+
),
|
|
2392
2383
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-amount-meta", children: [
|
|
2393
2384
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "rs-amount-meta-balance", children: [
|
|
2394
2385
|
formattedBalance,
|
|
@@ -2397,13 +2388,13 @@ function SolanaAmountStep({
|
|
|
2397
2388
|
" available",
|
|
2398
2389
|
computedBalanceUsd !== null && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
2399
2390
|
" (~",
|
|
2400
|
-
|
|
2391
|
+
_chunkENMIKNXScjs.currencyFormatter.format(computedBalanceUsd),
|
|
2401
2392
|
")"
|
|
2402
2393
|
] })
|
|
2403
2394
|
] }),
|
|
2404
2395
|
minDepositUsd !== null && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "rs-amount-meta-minimum", children: [
|
|
2405
2396
|
"Min. deposit ",
|
|
2406
|
-
|
|
2397
|
+
_chunkENMIKNXScjs.currencyFormatter.format(minDepositUsd)
|
|
2407
2398
|
] })
|
|
2408
2399
|
] })
|
|
2409
2400
|
] }),
|
|
@@ -2442,15 +2433,12 @@ function SolanaAmountStep({
|
|
|
2442
2433
|
] }),
|
|
2443
2434
|
balanceAfterUsd !== null && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-amount-detail-row", children: [
|
|
2444
2435
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: "Balance after deposit" }),
|
|
2445
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-amount-detail-value", children:
|
|
2436
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-amount-detail-value", children: _chunkENMIKNXScjs.currencyFormatter.format(balanceAfterUsd) })
|
|
2446
2437
|
] })
|
|
2447
2438
|
] }),
|
|
2448
|
-
error && /* @__PURE__ */ _jsxruntime.
|
|
2449
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkDX2D2TRZcjs.AlertTriangleIcon, { style: { width: 16, height: 16, flexShrink: 0 } }),
|
|
2450
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: error })
|
|
2451
|
-
] }),
|
|
2439
|
+
error && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkENMIKNXScjs.Callout, { variant: "error", children: error }),
|
|
2452
2440
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2453
|
-
|
|
2441
|
+
_chunkENMIKNXScjs.Button,
|
|
2454
2442
|
{
|
|
2455
2443
|
onClick: handleContinue,
|
|
2456
2444
|
fullWidth: true,
|
|
@@ -2459,7 +2447,7 @@ function SolanaAmountStep({
|
|
|
2459
2447
|
}
|
|
2460
2448
|
)
|
|
2461
2449
|
] }),
|
|
2462
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2450
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkENMIKNXScjs.PoweredBy, {})
|
|
2463
2451
|
] });
|
|
2464
2452
|
}
|
|
2465
2453
|
|
|
@@ -2467,6 +2455,112 @@ function SolanaAmountStep({
|
|
|
2467
2455
|
|
|
2468
2456
|
|
|
2469
2457
|
|
|
2458
|
+
// src/core/solana.ts
|
|
2459
|
+
|
|
2460
|
+
|
|
2461
|
+
|
|
2462
|
+
|
|
2463
|
+
|
|
2464
|
+
var _web3js = require('@solana/web3.js');
|
|
2465
|
+
|
|
2466
|
+
|
|
2467
|
+
|
|
2468
|
+
|
|
2469
|
+
var _spltoken = require('@solana/spl-token');
|
|
2470
|
+
var DEFAULT_SOLANA_RPC_URL = "https://api.mainnet.solana.com";
|
|
2471
|
+
var configuredSolanaRpcUrl = null;
|
|
2472
|
+
var cachedConnections = /* @__PURE__ */ new Map();
|
|
2473
|
+
function configureSolanaRpcUrl(rpcUrl) {
|
|
2474
|
+
const normalized = _optionalChain([rpcUrl, 'optionalAccess', _81 => _81.trim, 'call', _82 => _82()]);
|
|
2475
|
+
configuredSolanaRpcUrl = normalized ? normalized : null;
|
|
2476
|
+
cachedConnections.clear();
|
|
2477
|
+
}
|
|
2478
|
+
function getSolanaRpcUrl() {
|
|
2479
|
+
return _nullishCoalesce(configuredSolanaRpcUrl, () => ( DEFAULT_SOLANA_RPC_URL));
|
|
2480
|
+
}
|
|
2481
|
+
function hasConfiguredSolanaRpcUrl() {
|
|
2482
|
+
return configuredSolanaRpcUrl !== null;
|
|
2483
|
+
}
|
|
2484
|
+
function getSolanaConnection() {
|
|
2485
|
+
const rpcUrl = getSolanaRpcUrl();
|
|
2486
|
+
const cached = cachedConnections.get(rpcUrl);
|
|
2487
|
+
if (cached) {
|
|
2488
|
+
return cached;
|
|
2489
|
+
}
|
|
2490
|
+
const next = new (0, _web3js.Connection)(rpcUrl, "confirmed");
|
|
2491
|
+
cachedConnections.set(rpcUrl, next);
|
|
2492
|
+
return next;
|
|
2493
|
+
}
|
|
2494
|
+
async function buildSolTransferTransaction(connection, from, to, lamports) {
|
|
2495
|
+
const fromPubkey = new (0, _web3js.PublicKey)(from);
|
|
2496
|
+
const toPubkey = new (0, _web3js.PublicKey)(to);
|
|
2497
|
+
const tx = new (0, _web3js.Transaction)().add(
|
|
2498
|
+
_web3js.SystemProgram.transfer({
|
|
2499
|
+
fromPubkey,
|
|
2500
|
+
toPubkey,
|
|
2501
|
+
lamports
|
|
2502
|
+
})
|
|
2503
|
+
);
|
|
2504
|
+
const { blockhash, lastValidBlockHeight } = await connection.getLatestBlockhash();
|
|
2505
|
+
tx.recentBlockhash = blockhash;
|
|
2506
|
+
tx.lastValidBlockHeight = lastValidBlockHeight;
|
|
2507
|
+
tx.feePayer = fromPubkey;
|
|
2508
|
+
return tx;
|
|
2509
|
+
}
|
|
2510
|
+
async function buildSplTransferTransaction(connection, from, to, mint, amount) {
|
|
2511
|
+
const fromPubkey = new (0, _web3js.PublicKey)(from);
|
|
2512
|
+
const toPubkey = new (0, _web3js.PublicKey)(to);
|
|
2513
|
+
const mintPubkey = new (0, _web3js.PublicKey)(mint);
|
|
2514
|
+
const fromAta = await _spltoken.getAssociatedTokenAddress.call(void 0, mintPubkey, fromPubkey);
|
|
2515
|
+
const toAta = await _spltoken.getAssociatedTokenAddress.call(void 0, mintPubkey, toPubkey, true);
|
|
2516
|
+
const tx = new (0, _web3js.Transaction)();
|
|
2517
|
+
const toAtaInfo = await connection.getAccountInfo(toAta);
|
|
2518
|
+
if (!toAtaInfo) {
|
|
2519
|
+
tx.add(
|
|
2520
|
+
_spltoken.createAssociatedTokenAccountInstruction.call(void 0,
|
|
2521
|
+
fromPubkey,
|
|
2522
|
+
toAta,
|
|
2523
|
+
toPubkey,
|
|
2524
|
+
mintPubkey
|
|
2525
|
+
)
|
|
2526
|
+
);
|
|
2527
|
+
}
|
|
2528
|
+
tx.add(_spltoken.createTransferInstruction.call(void 0, fromAta, toAta, fromPubkey, amount));
|
|
2529
|
+
const { blockhash, lastValidBlockHeight } = await connection.getLatestBlockhash();
|
|
2530
|
+
tx.recentBlockhash = blockhash;
|
|
2531
|
+
tx.lastValidBlockHeight = lastValidBlockHeight;
|
|
2532
|
+
tx.feePayer = fromPubkey;
|
|
2533
|
+
return tx;
|
|
2534
|
+
}
|
|
2535
|
+
function extractSignature(value) {
|
|
2536
|
+
if (typeof value === "string") {
|
|
2537
|
+
return value.length > 0 ? value : null;
|
|
2538
|
+
}
|
|
2539
|
+
if (typeof value.signature === "string" && value.signature.length > 0) {
|
|
2540
|
+
return value.signature;
|
|
2541
|
+
}
|
|
2542
|
+
if (typeof value.hash === "string" && value.hash.length > 0) {
|
|
2543
|
+
return value.hash;
|
|
2544
|
+
}
|
|
2545
|
+
if (typeof value.txid === "string" && value.txid.length > 0) {
|
|
2546
|
+
return value.txid;
|
|
2547
|
+
}
|
|
2548
|
+
if (typeof value.transactionId === "string" && value.transactionId.length > 0) {
|
|
2549
|
+
return value.transactionId;
|
|
2550
|
+
}
|
|
2551
|
+
return null;
|
|
2552
|
+
}
|
|
2553
|
+
async function sendSolanaTransaction(provider, _connection, transaction) {
|
|
2554
|
+
const result = await provider.signAndSendTransaction(transaction);
|
|
2555
|
+
const signature = extractSignature(result);
|
|
2556
|
+
if (!signature) {
|
|
2557
|
+
throw new Error("Transaction sent but wallet did not return a signature");
|
|
2558
|
+
}
|
|
2559
|
+
return signature;
|
|
2560
|
+
}
|
|
2561
|
+
|
|
2562
|
+
// src/components/steps/SolanaConfirmStep.tsx
|
|
2563
|
+
|
|
2470
2564
|
function SolanaConfirmStep({
|
|
2471
2565
|
smartAccount,
|
|
2472
2566
|
solanaAddress,
|
|
@@ -2480,14 +2574,25 @@ function SolanaConfirmStep({
|
|
|
2480
2574
|
targetToken,
|
|
2481
2575
|
service,
|
|
2482
2576
|
solanaProvider,
|
|
2577
|
+
solanaConnection,
|
|
2578
|
+
uiConfig,
|
|
2579
|
+
estimatedTime = "< 1 min",
|
|
2483
2580
|
onConfirm,
|
|
2484
2581
|
onError,
|
|
2485
2582
|
debug
|
|
2486
2583
|
}) {
|
|
2487
2584
|
const [isSubmitting, setIsSubmitting] = _react.useState.call(void 0, false);
|
|
2488
2585
|
const [error, setError] = _react.useState.call(void 0, null);
|
|
2489
|
-
const targetSymbol =
|
|
2586
|
+
const targetSymbol = _chunkMHKHSCIAcjs.getTargetTokenSymbol.call(void 0, targetToken, targetChain);
|
|
2490
2587
|
const isSameToken = token.symbol.toUpperCase() === targetSymbol.toUpperCase();
|
|
2588
|
+
const sourceChainName = _chunkMHKHSCIAcjs.getChainName.call(void 0, "solana");
|
|
2589
|
+
const targetChainName = _chunkMHKHSCIAcjs.getChainName.call(void 0, targetChain);
|
|
2590
|
+
const sourceChainIcon = _chunkMHKHSCIAcjs.getChainIcon.call(void 0, "solana");
|
|
2591
|
+
const targetChainIcon = _chunkMHKHSCIAcjs.getChainIcon.call(void 0, targetChain);
|
|
2592
|
+
const sourceTokenIcon = _chunkMHKHSCIAcjs.getTokenIcon.call(void 0, token.symbol);
|
|
2593
|
+
const targetTokenIcon = _chunkMHKHSCIAcjs.getTokenIcon.call(void 0, targetSymbol);
|
|
2594
|
+
const feeSponsored = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess', _83 => _83.feeSponsored]), () => ( false));
|
|
2595
|
+
const feeTooltip = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess', _84 => _84.feeTooltip]), () => ( (feeSponsored ? "Network fees are sponsored for this deposit." : "Network fees apply.")));
|
|
2491
2596
|
const formattedAmount = sourceAmount && !Number.isNaN(Number(sourceAmount)) ? Number(sourceAmount).toLocaleString("en-US", { maximumFractionDigits: 6 }) : "0";
|
|
2492
2597
|
const formattedReceiveAmount = (() => {
|
|
2493
2598
|
if (isSameToken) return formattedAmount;
|
|
@@ -2500,10 +2605,10 @@ function SolanaConfirmStep({
|
|
|
2500
2605
|
}
|
|
2501
2606
|
return formattedAmount;
|
|
2502
2607
|
})();
|
|
2503
|
-
const receiveAmount = isSameToken ? formattedReceiveAmount :
|
|
2608
|
+
const receiveAmount = isSameToken ? formattedReceiveAmount : `~${formattedReceiveAmount}`;
|
|
2504
2609
|
const handleConfirm = async () => {
|
|
2505
2610
|
if (!solanaProvider) {
|
|
2506
|
-
|
|
2611
|
+
_chunkENMIKNXScjs.debugLog.call(void 0, debug, "solana-confirm", "submit:blocked", {
|
|
2507
2612
|
reason: "missing-provider"
|
|
2508
2613
|
});
|
|
2509
2614
|
setError("Solana wallet not connected");
|
|
@@ -2511,7 +2616,7 @@ function SolanaConfirmStep({
|
|
|
2511
2616
|
}
|
|
2512
2617
|
const parsedAmount = parseFloat(sourceAmount);
|
|
2513
2618
|
if (isNaN(parsedAmount) || parsedAmount <= 0) {
|
|
2514
|
-
|
|
2619
|
+
_chunkENMIKNXScjs.debugLog.call(void 0, debug, "solana-confirm", "submit:blocked", {
|
|
2515
2620
|
reason: "invalid-amount",
|
|
2516
2621
|
sourceAmount
|
|
2517
2622
|
});
|
|
@@ -2520,7 +2625,7 @@ function SolanaConfirmStep({
|
|
|
2520
2625
|
}
|
|
2521
2626
|
setError(null);
|
|
2522
2627
|
setIsSubmitting(true);
|
|
2523
|
-
|
|
2628
|
+
_chunkENMIKNXScjs.debugLog.call(void 0, debug, "solana-confirm", "submit:start", {
|
|
2524
2629
|
smartAccount,
|
|
2525
2630
|
solanaAddress,
|
|
2526
2631
|
solanaDepositAddress,
|
|
@@ -2530,7 +2635,7 @@ function SolanaConfirmStep({
|
|
|
2530
2635
|
});
|
|
2531
2636
|
try {
|
|
2532
2637
|
const check = await service.checkAccount(smartAccount);
|
|
2533
|
-
|
|
2638
|
+
_chunkENMIKNXScjs.debugLog.call(void 0, debug, "solana-confirm", "check:success", {
|
|
2534
2639
|
smartAccount,
|
|
2535
2640
|
isRegistered: check.isRegistered,
|
|
2536
2641
|
targetChain: check.targetChain,
|
|
@@ -2541,14 +2646,14 @@ function SolanaConfirmStep({
|
|
|
2541
2646
|
"Deposit account is not registered yet. Please restart setup and try again."
|
|
2542
2647
|
);
|
|
2543
2648
|
}
|
|
2544
|
-
const connection = getSolanaConnection();
|
|
2649
|
+
const connection = hasConfiguredSolanaRpcUrl() ? getSolanaConnection() : _nullishCoalesce(solanaConnection, () => ( getSolanaConnection()));
|
|
2545
2650
|
const amountUnits = _viem.parseUnits.call(void 0, sourceAmount, token.decimals);
|
|
2546
|
-
|
|
2651
|
+
_chunkENMIKNXScjs.debugLog.call(void 0, debug, "solana-confirm", "tx:build:start", {
|
|
2547
2652
|
token: token.symbol,
|
|
2548
2653
|
sourceAmount,
|
|
2549
2654
|
amountUnits: amountUnits.toString()
|
|
2550
2655
|
});
|
|
2551
|
-
const transaction = isNativeSol(token) ? await buildSolTransferTransaction(
|
|
2656
|
+
const transaction = _chunkMHKHSCIAcjs.isNativeSol.call(void 0, token) ? await buildSolTransferTransaction(
|
|
2552
2657
|
connection,
|
|
2553
2658
|
solanaAddress,
|
|
2554
2659
|
solanaDepositAddress,
|
|
@@ -2560,10 +2665,10 @@ function SolanaConfirmStep({
|
|
|
2560
2665
|
token.mint,
|
|
2561
2666
|
amountUnits
|
|
2562
2667
|
);
|
|
2563
|
-
|
|
2668
|
+
_chunkENMIKNXScjs.debugLog.call(void 0, debug, "solana-confirm", "tx:build:success", {
|
|
2564
2669
|
token: token.symbol,
|
|
2565
2670
|
instructionCount: transaction.instructions.length,
|
|
2566
|
-
feePayer: _optionalChain([transaction, 'access',
|
|
2671
|
+
feePayer: _optionalChain([transaction, 'access', _85 => _85.feePayer, 'optionalAccess', _86 => _86.toBase58, 'call', _87 => _87()]),
|
|
2567
2672
|
recentBlockhash: transaction.recentBlockhash
|
|
2568
2673
|
});
|
|
2569
2674
|
const txHash = await sendSolanaTransaction(
|
|
@@ -2571,140 +2676,97 @@ function SolanaConfirmStep({
|
|
|
2571
2676
|
connection,
|
|
2572
2677
|
transaction
|
|
2573
2678
|
);
|
|
2574
|
-
|
|
2679
|
+
_chunkENMIKNXScjs.debugLog.call(void 0, debug, "solana-confirm", "tx:sent", {
|
|
2575
2680
|
txHash,
|
|
2576
2681
|
amountUnits: amountUnits.toString()
|
|
2577
2682
|
});
|
|
2578
2683
|
onConfirm(txHash, amountUnits.toString());
|
|
2579
2684
|
} catch (err) {
|
|
2580
2685
|
const raw = err instanceof Error ? err.message : "Transfer failed";
|
|
2581
|
-
const message =
|
|
2582
|
-
|
|
2686
|
+
const message = _chunkENMIKNXScjs.formatUserError.call(void 0, raw);
|
|
2687
|
+
_chunkENMIKNXScjs.debugError.call(void 0, debug, "solana-confirm", "submit:failure", err, {
|
|
2583
2688
|
smartAccount,
|
|
2584
2689
|
token: token.symbol,
|
|
2585
2690
|
sourceAmount
|
|
2586
2691
|
});
|
|
2587
|
-
setError(message);
|
|
2588
|
-
_optionalChain([onError, 'optionalCall',
|
|
2589
|
-
} finally {
|
|
2590
|
-
setIsSubmitting(false);
|
|
2591
|
-
}
|
|
2592
|
-
};
|
|
2593
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-
|
|
2594
|
-
/* @__PURE__ */ _jsxruntime.
|
|
2595
|
-
|
|
2596
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-
|
|
2597
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-
|
|
2598
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", {
|
|
2599
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2600
|
-
"span",
|
|
2601
|
-
{
|
|
2602
|
-
|
|
2603
|
-
style: { display: "flex", alignItems: "center", gap: 8 },
|
|
2604
|
-
children: [
|
|
2605
|
-
_chunkIVTXEYB2cjs.getChainIcon.call(void 0, "solana") && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2606
|
-
"img",
|
|
2607
|
-
{
|
|
2608
|
-
src: _chunkIVTXEYB2cjs.getChainIcon.call(void 0, "solana"),
|
|
2609
|
-
alt: "",
|
|
2610
|
-
style: { width: 16, height: 16, borderRadius: 3 }
|
|
2611
|
-
}
|
|
2612
|
-
),
|
|
2613
|
-
_chunkIVTXEYB2cjs.getChainName.call(void 0, "solana")
|
|
2614
|
-
]
|
|
2615
|
-
}
|
|
2616
|
-
)
|
|
2692
|
+
setError(message);
|
|
2693
|
+
_optionalChain([onError, 'optionalCall', _88 => _88(message, "SOLANA_TRANSFER_ERROR")]);
|
|
2694
|
+
} finally {
|
|
2695
|
+
setIsSubmitting(false);
|
|
2696
|
+
}
|
|
2697
|
+
};
|
|
2698
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-screen", children: [
|
|
2699
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-screen-body rs-screen-body--gap-32", children: [
|
|
2700
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkENMIKNXScjs.BodyHeader, { icon: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkENMIKNXScjs.WalletIcon, {}), title: "Review deposit" }),
|
|
2701
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-review-details", children: [
|
|
2702
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-review-detail-row", children: [
|
|
2703
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: "Source chain" }),
|
|
2704
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "rs-review-detail-value", children: [
|
|
2705
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: sourceChainName }),
|
|
2706
|
+
sourceChainIcon && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-review-detail-icon", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "img", { src: sourceChainIcon, alt: "" }) })
|
|
2707
|
+
] })
|
|
2617
2708
|
] }),
|
|
2618
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-
|
|
2619
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", {
|
|
2620
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2621
|
-
"span",
|
|
2622
|
-
{
|
|
2623
|
-
|
|
2624
|
-
style: { display: "flex", alignItems: "center", gap: 8 },
|
|
2625
|
-
children: [
|
|
2626
|
-
_chunkIVTXEYB2cjs.getChainIcon.call(void 0, targetChain) && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2627
|
-
"img",
|
|
2628
|
-
{
|
|
2629
|
-
src: _chunkIVTXEYB2cjs.getChainIcon.call(void 0, targetChain),
|
|
2630
|
-
alt: "",
|
|
2631
|
-
style: { width: 16, height: 16, borderRadius: 3 }
|
|
2632
|
-
}
|
|
2633
|
-
),
|
|
2634
|
-
_chunkIVTXEYB2cjs.getChainName.call(void 0, targetChain)
|
|
2635
|
-
]
|
|
2636
|
-
}
|
|
2637
|
-
)
|
|
2709
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-review-detail-row", children: [
|
|
2710
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: "Destination chain" }),
|
|
2711
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "rs-review-detail-value", children: [
|
|
2712
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: targetChainName }),
|
|
2713
|
+
targetChainIcon && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-review-detail-icon", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "img", { src: targetChainIcon, alt: "" }) })
|
|
2714
|
+
] })
|
|
2638
2715
|
] }),
|
|
2639
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-
|
|
2640
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", {
|
|
2641
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-
|
|
2642
|
-
] })
|
|
2643
|
-
] }),
|
|
2644
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-card", children: [
|
|
2645
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-card-row", children: [
|
|
2646
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-card-label", children: "You send" }),
|
|
2647
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2648
|
-
"span",
|
|
2649
|
-
{
|
|
2650
|
-
className: "rs-card-value",
|
|
2651
|
-
style: { display: "flex", alignItems: "center", gap: 6 },
|
|
2652
|
-
children: [
|
|
2653
|
-
_chunkIVTXEYB2cjs.getTokenIcon.call(void 0, token.symbol) && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2654
|
-
"img",
|
|
2655
|
-
{
|
|
2656
|
-
src: _chunkIVTXEYB2cjs.getTokenIcon.call(void 0, token.symbol),
|
|
2657
|
-
alt: "",
|
|
2658
|
-
style: { width: 16, height: 16, borderRadius: "50%" }
|
|
2659
|
-
}
|
|
2660
|
-
),
|
|
2661
|
-
formattedAmount,
|
|
2662
|
-
" ",
|
|
2663
|
-
token.symbol
|
|
2664
|
-
]
|
|
2665
|
-
}
|
|
2666
|
-
)
|
|
2716
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-review-detail-row", children: [
|
|
2717
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: "Estimated time" }),
|
|
2718
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-review-detail-value", children: estimatedTime })
|
|
2667
2719
|
] }),
|
|
2668
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-
|
|
2669
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", {
|
|
2670
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2671
|
-
"span",
|
|
2672
|
-
|
|
2673
|
-
|
|
2674
|
-
|
|
2675
|
-
|
|
2676
|
-
|
|
2677
|
-
|
|
2678
|
-
|
|
2679
|
-
|
|
2680
|
-
|
|
2681
|
-
|
|
2682
|
-
|
|
2683
|
-
|
|
2684
|
-
|
|
2685
|
-
|
|
2686
|
-
|
|
2687
|
-
|
|
2688
|
-
|
|
2689
|
-
|
|
2720
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-review-detail-row", children: [
|
|
2721
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: "You send" }),
|
|
2722
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "rs-review-detail-value", children: [
|
|
2723
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { children: [
|
|
2724
|
+
formattedAmount,
|
|
2725
|
+
" ",
|
|
2726
|
+
token.symbol
|
|
2727
|
+
] }),
|
|
2728
|
+
sourceTokenIcon && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-review-detail-icon", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "img", { src: sourceTokenIcon, alt: "" }) })
|
|
2729
|
+
] })
|
|
2730
|
+
] }),
|
|
2731
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-review-detail-row", children: [
|
|
2732
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: "Receive" }),
|
|
2733
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "rs-review-detail-value", children: [
|
|
2734
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { children: [
|
|
2735
|
+
receiveAmount,
|
|
2736
|
+
" ",
|
|
2737
|
+
targetSymbol
|
|
2738
|
+
] }),
|
|
2739
|
+
targetTokenIcon && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-review-detail-icon", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "img", { src: targetTokenIcon, alt: "" }) })
|
|
2740
|
+
] })
|
|
2741
|
+
] }),
|
|
2742
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-review-detail-row", children: [
|
|
2743
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: "Fees" }),
|
|
2744
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "rs-review-detail-value", children: [
|
|
2745
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2746
|
+
"span",
|
|
2747
|
+
{
|
|
2748
|
+
style: feeSponsored ? { textDecoration: "line-through" } : void 0,
|
|
2749
|
+
children: "$0.04"
|
|
2750
|
+
}
|
|
2751
|
+
),
|
|
2752
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkENMIKNXScjs.Tooltip, { content: feeTooltip, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-review-detail-info", "aria-label": "Fee info", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkENMIKNXScjs.InfoIcon, {}) }) })
|
|
2753
|
+
] })
|
|
2690
2754
|
] })
|
|
2691
2755
|
] }),
|
|
2692
|
-
error && /* @__PURE__ */ _jsxruntime.
|
|
2693
|
-
|
|
2694
|
-
|
|
2695
|
-
|
|
2756
|
+
error && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkENMIKNXScjs.Callout, { variant: "error", children: error }),
|
|
2757
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2758
|
+
_chunkENMIKNXScjs.Button,
|
|
2759
|
+
{
|
|
2760
|
+
onClick: handleConfirm,
|
|
2761
|
+
loading: isSubmitting,
|
|
2762
|
+
loadingText: "Submitting transaction...",
|
|
2763
|
+
disabled: !sourceAmount || Number(sourceAmount) <= 0,
|
|
2764
|
+
fullWidth: true,
|
|
2765
|
+
children: "Continue"
|
|
2766
|
+
}
|
|
2767
|
+
)
|
|
2696
2768
|
] }),
|
|
2697
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2698
|
-
_chunkDX2D2TRZcjs.Button,
|
|
2699
|
-
{
|
|
2700
|
-
onClick: handleConfirm,
|
|
2701
|
-
loading: isSubmitting,
|
|
2702
|
-
disabled: !sourceAmount || Number(sourceAmount) <= 0,
|
|
2703
|
-
fullWidth: true,
|
|
2704
|
-
children: "Continue"
|
|
2705
|
-
}
|
|
2706
|
-
) }),
|
|
2707
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkDX2D2TRZcjs.PoweredBy, {})
|
|
2769
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkENMIKNXScjs.PoweredBy, {})
|
|
2708
2770
|
] });
|
|
2709
2771
|
}
|
|
2710
2772
|
|
|
@@ -2718,34 +2780,69 @@ function DappImportAssetSelectStep({
|
|
|
2718
2780
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-screen", children: [
|
|
2719
2781
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-screen-body rs-screen-body--gap-32", children: [
|
|
2720
2782
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2721
|
-
|
|
2783
|
+
_chunkENMIKNXScjs.BodyHeader,
|
|
2722
2784
|
{
|
|
2723
|
-
icon: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2785
|
+
icon: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkENMIKNXScjs.WalletIcon, {}),
|
|
2724
2786
|
title: `Transfer from ${sourceLabel}`,
|
|
2725
2787
|
subtitle: "Pick the balance to import"
|
|
2726
2788
|
}
|
|
2727
2789
|
),
|
|
2728
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-list", children: assets.map((asset) => {
|
|
2729
|
-
const
|
|
2790
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-asset-list", children: assets.map((asset) => {
|
|
2791
|
+
const tokenAmount = asset.balance ? _chunkENMIKNXScjs.tokenFormatter.format(
|
|
2730
2792
|
Number(asset.balance) / 10 ** asset.decimals
|
|
2731
2793
|
) : "0";
|
|
2732
|
-
const balanceUsd = asset.balanceUsd && asset.balanceUsd > 0 ?
|
|
2733
|
-
const
|
|
2734
|
-
|
|
2735
|
-
|
|
2794
|
+
const balanceUsd = asset.balanceUsd && asset.balanceUsd > 0 ? _chunkENMIKNXScjs.currencyFormatter.format(asset.balanceUsd) : `${tokenAmount} ${asset.symbol}`;
|
|
2795
|
+
const tokenIcon = _nullishCoalesce(asset.icon, () => ( _chunkMHKHSCIAcjs.getTokenIcon.call(void 0, asset.symbol)));
|
|
2796
|
+
const chainIcon = _chunkMHKHSCIAcjs.getChainIcon.call(void 0, asset.chainId);
|
|
2797
|
+
const badge = _chunkMHKHSCIAcjs.getChainBadge.call(void 0, asset.chainId);
|
|
2798
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2799
|
+
"button",
|
|
2736
2800
|
{
|
|
2737
|
-
|
|
2738
|
-
|
|
2739
|
-
|
|
2740
|
-
|
|
2741
|
-
|
|
2742
|
-
|
|
2801
|
+
type: "button",
|
|
2802
|
+
className: "rs-asset-row",
|
|
2803
|
+
onClick: () => onSelect(asset),
|
|
2804
|
+
children: [
|
|
2805
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-asset-info", children: [
|
|
2806
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-asset-icon-wrapper", children: [
|
|
2807
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-asset-icon", children: tokenIcon ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "img", { src: tokenIcon, alt: asset.symbol }) : asset.symbol.slice(0, 4) }),
|
|
2808
|
+
chainIcon ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-asset-chain-badge", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2809
|
+
"img",
|
|
2810
|
+
{
|
|
2811
|
+
src: chainIcon,
|
|
2812
|
+
alt: _chunkMHKHSCIAcjs.getChainName.call(void 0, asset.chainId)
|
|
2813
|
+
}
|
|
2814
|
+
) }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2815
|
+
"span",
|
|
2816
|
+
{
|
|
2817
|
+
className: "rs-asset-chain-badge",
|
|
2818
|
+
style: { backgroundColor: badge.bg, color: badge.color },
|
|
2819
|
+
children: badge.shortLabel.charAt(0)
|
|
2820
|
+
}
|
|
2821
|
+
)
|
|
2822
|
+
] }),
|
|
2823
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-asset-text", children: [
|
|
2824
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-asset-name-row", children: [
|
|
2825
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-asset-name", children: asset.symbol }),
|
|
2826
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "rs-asset-chain", children: [
|
|
2827
|
+
"on ",
|
|
2828
|
+
asset.sourceLabel
|
|
2829
|
+
] })
|
|
2830
|
+
] }),
|
|
2831
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-asset-balance-small", children: [
|
|
2832
|
+
tokenAmount,
|
|
2833
|
+
" ",
|
|
2834
|
+
asset.symbol
|
|
2835
|
+
] })
|
|
2836
|
+
] })
|
|
2837
|
+
] }),
|
|
2838
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-asset-balance", children: balanceUsd })
|
|
2839
|
+
]
|
|
2743
2840
|
},
|
|
2744
2841
|
asset.id
|
|
2745
2842
|
);
|
|
2746
2843
|
}) })
|
|
2747
2844
|
] }),
|
|
2748
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2845
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkENMIKNXScjs.PoweredBy, {})
|
|
2749
2846
|
] });
|
|
2750
2847
|
}
|
|
2751
2848
|
DappImportAssetSelectStep.displayName = "DappImportAssetSelectStep";
|
|
@@ -2763,6 +2860,172 @@ var SAFE_MULTI_SEND_CALL_ONLY_ADDRESS = "0x40A2aCCbd92BCA938b02010E17A5b8929b491
|
|
|
2763
2860
|
var GAMMA_API_PUBLIC_PROFILE = "https://gamma-api.polymarket.com/public-profile";
|
|
2764
2861
|
var POLYMARKET_ICON_URL = "data:image/svg+xml,%3Csvg width='512' height='512' viewBox='0 0 512 512' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Crect width='512' height='512' fill='%232E5CFF'/%3E%3Cpath d='M375.84 389.422C375.84 403.572 375.84 410.647 371.212 414.154C366.585 417.662 359.773 415.75 346.15 411.927L127.22 350.493C119.012 348.19 114.907 347.038 112.534 343.907C110.161 340.776 110.161 336.513 110.161 327.988V184.012C110.161 175.487 110.161 171.224 112.534 168.093C114.907 164.962 119.012 163.81 127.22 161.507L346.15 100.072C359.773 96.2495 366.585 94.338 371.212 97.8455C375.84 101.353 375.84 108.428 375.84 122.578V389.422ZM164.761 330.463L346.035 381.337V279.595L164.761 330.463ZM139.963 306.862L321.201 256L139.963 205.138V306.862ZM164.759 181.537L346.035 232.406V130.663L164.759 181.537Z' fill='white'/%3E%3C/svg%3E";
|
|
2765
2862
|
|
|
2863
|
+
// src/core/dapp-imports/polymarket/deposit-wallet.ts
|
|
2864
|
+
|
|
2865
|
+
|
|
2866
|
+
|
|
2867
|
+
|
|
2868
|
+
|
|
2869
|
+
var COLLATERAL_OFFRAMP_ABI = _viem.parseAbi.call(void 0, [
|
|
2870
|
+
"function unwrap(address _asset, address _to, uint256 _amount)"
|
|
2871
|
+
]);
|
|
2872
|
+
var POLYMARKET_DEPOSIT_WALLET_ABI = [
|
|
2873
|
+
{
|
|
2874
|
+
type: "function",
|
|
2875
|
+
name: "owner",
|
|
2876
|
+
stateMutability: "view",
|
|
2877
|
+
inputs: [],
|
|
2878
|
+
outputs: [{ name: "result", type: "address" }]
|
|
2879
|
+
},
|
|
2880
|
+
{
|
|
2881
|
+
type: "function",
|
|
2882
|
+
name: "nonce",
|
|
2883
|
+
stateMutability: "view",
|
|
2884
|
+
inputs: [],
|
|
2885
|
+
outputs: [{ name: "", type: "uint256" }]
|
|
2886
|
+
}
|
|
2887
|
+
];
|
|
2888
|
+
var DEPOSIT_WALLET_EXECUTE_TYPES = {
|
|
2889
|
+
Batch: [
|
|
2890
|
+
{ name: "wallet", type: "address" },
|
|
2891
|
+
{ name: "nonce", type: "uint256" },
|
|
2892
|
+
{ name: "deadline", type: "uint256" },
|
|
2893
|
+
{ name: "calls", type: "Call[]" }
|
|
2894
|
+
],
|
|
2895
|
+
Call: [
|
|
2896
|
+
{ name: "target", type: "address" },
|
|
2897
|
+
{ name: "value", type: "uint256" },
|
|
2898
|
+
{ name: "data", type: "bytes" }
|
|
2899
|
+
]
|
|
2900
|
+
};
|
|
2901
|
+
var DEPOSIT_WALLET_DOMAIN_NAME = "DepositWallet";
|
|
2902
|
+
var DEPOSIT_WALLET_DOMAIN_VERSION = "1";
|
|
2903
|
+
var EXECUTE_DEADLINE_SECONDS = 300;
|
|
2904
|
+
async function detectPolymarketWalletKind(params) {
|
|
2905
|
+
const { publicClient, proxyWallet, eoa } = params;
|
|
2906
|
+
const results = await publicClient.multicall({
|
|
2907
|
+
allowFailure: true,
|
|
2908
|
+
contracts: [
|
|
2909
|
+
{
|
|
2910
|
+
address: proxyWallet,
|
|
2911
|
+
abi: _chunkENMIKNXScjs.SAFE_ABI,
|
|
2912
|
+
functionName: "isOwner",
|
|
2913
|
+
args: [eoa]
|
|
2914
|
+
},
|
|
2915
|
+
{
|
|
2916
|
+
address: proxyWallet,
|
|
2917
|
+
abi: POLYMARKET_DEPOSIT_WALLET_ABI,
|
|
2918
|
+
functionName: "owner"
|
|
2919
|
+
}
|
|
2920
|
+
]
|
|
2921
|
+
});
|
|
2922
|
+
const isSafeOwner = results[0].status === "success" && results[0].result === true;
|
|
2923
|
+
if (isSafeOwner) return "safe";
|
|
2924
|
+
if (results[1].status === "success") {
|
|
2925
|
+
const owner = results[1].result;
|
|
2926
|
+
if (owner.toLowerCase() === eoa.toLowerCase()) return "deposit-wallet";
|
|
2927
|
+
}
|
|
2928
|
+
return null;
|
|
2929
|
+
}
|
|
2930
|
+
async function buildSignedDepositWalletBatch(params) {
|
|
2931
|
+
const {
|
|
2932
|
+
walletClient,
|
|
2933
|
+
publicClient,
|
|
2934
|
+
walletAddress,
|
|
2935
|
+
recipient,
|
|
2936
|
+
amount,
|
|
2937
|
+
tokenKind
|
|
2938
|
+
} = params;
|
|
2939
|
+
const account = walletClient.account;
|
|
2940
|
+
const chain = walletClient.chain;
|
|
2941
|
+
if (!account || !chain) {
|
|
2942
|
+
throw new Error("Wallet not connected");
|
|
2943
|
+
}
|
|
2944
|
+
if (chain.id !== POLYMARKET_POLYGON_CHAIN_ID) {
|
|
2945
|
+
throw new Error("Switch to Polygon to sign");
|
|
2946
|
+
}
|
|
2947
|
+
const owner = await publicClient.readContract({
|
|
2948
|
+
address: walletAddress,
|
|
2949
|
+
abi: POLYMARKET_DEPOSIT_WALLET_ABI,
|
|
2950
|
+
functionName: "owner"
|
|
2951
|
+
});
|
|
2952
|
+
if (owner.toLowerCase() !== account.address.toLowerCase()) {
|
|
2953
|
+
throw new Error("Connected wallet is not the Polymarket wallet owner");
|
|
2954
|
+
}
|
|
2955
|
+
const nonce = await publicClient.readContract({
|
|
2956
|
+
address: walletAddress,
|
|
2957
|
+
abi: POLYMARKET_DEPOSIT_WALLET_ABI,
|
|
2958
|
+
functionName: "nonce"
|
|
2959
|
+
});
|
|
2960
|
+
const calls = tokenKind === "usdce" ? buildUsdceTransferCalls(recipient, amount) : buildPusdUnwrapCalls(recipient, amount);
|
|
2961
|
+
const deadline = BigInt(
|
|
2962
|
+
Math.floor(Date.now() / 1e3) + EXECUTE_DEADLINE_SECONDS
|
|
2963
|
+
);
|
|
2964
|
+
const signature = await walletClient.signTypedData({
|
|
2965
|
+
account,
|
|
2966
|
+
domain: {
|
|
2967
|
+
name: DEPOSIT_WALLET_DOMAIN_NAME,
|
|
2968
|
+
version: DEPOSIT_WALLET_DOMAIN_VERSION,
|
|
2969
|
+
chainId: chain.id,
|
|
2970
|
+
verifyingContract: walletAddress
|
|
2971
|
+
},
|
|
2972
|
+
types: DEPOSIT_WALLET_EXECUTE_TYPES,
|
|
2973
|
+
primaryType: "Batch",
|
|
2974
|
+
message: { wallet: walletAddress, nonce, deadline, calls }
|
|
2975
|
+
});
|
|
2976
|
+
return {
|
|
2977
|
+
payload: {
|
|
2978
|
+
depositWallet: walletAddress,
|
|
2979
|
+
owner: account.address,
|
|
2980
|
+
nonce: nonce.toString(),
|
|
2981
|
+
deadline: deadline.toString(),
|
|
2982
|
+
calls: calls.map((call) => ({
|
|
2983
|
+
target: call.target,
|
|
2984
|
+
value: call.value.toString(),
|
|
2985
|
+
data: call.data
|
|
2986
|
+
})),
|
|
2987
|
+
signature
|
|
2988
|
+
},
|
|
2989
|
+
sourceToken: POLYMARKET_USDCE_ADDRESS,
|
|
2990
|
+
sourceSymbol: tokenKind === "pusd" ? "pUSD" : "USDC.e"
|
|
2991
|
+
};
|
|
2992
|
+
}
|
|
2993
|
+
function buildUsdceTransferCalls(recipient, amount) {
|
|
2994
|
+
return [
|
|
2995
|
+
{
|
|
2996
|
+
target: POLYMARKET_USDCE_ADDRESS,
|
|
2997
|
+
value: 0n,
|
|
2998
|
+
data: _viem.encodeFunctionData.call(void 0, {
|
|
2999
|
+
abi: _viem.erc20Abi,
|
|
3000
|
+
functionName: "transfer",
|
|
3001
|
+
args: [recipient, amount]
|
|
3002
|
+
})
|
|
3003
|
+
}
|
|
3004
|
+
];
|
|
3005
|
+
}
|
|
3006
|
+
function buildPusdUnwrapCalls(recipient, amount) {
|
|
3007
|
+
return [
|
|
3008
|
+
{
|
|
3009
|
+
target: POLYMARKET_PUSD_ADDRESS,
|
|
3010
|
+
value: 0n,
|
|
3011
|
+
data: _viem.encodeFunctionData.call(void 0, {
|
|
3012
|
+
abi: _viem.erc20Abi,
|
|
3013
|
+
functionName: "approve",
|
|
3014
|
+
args: [POLYMARKET_COLLATERAL_OFFRAMP_ADDRESS, amount]
|
|
3015
|
+
})
|
|
3016
|
+
},
|
|
3017
|
+
{
|
|
3018
|
+
target: POLYMARKET_COLLATERAL_OFFRAMP_ADDRESS,
|
|
3019
|
+
value: 0n,
|
|
3020
|
+
data: _viem.encodeFunctionData.call(void 0, {
|
|
3021
|
+
abi: COLLATERAL_OFFRAMP_ABI,
|
|
3022
|
+
functionName: "unwrap",
|
|
3023
|
+
args: [POLYMARKET_USDCE_ADDRESS, recipient, amount]
|
|
3024
|
+
})
|
|
3025
|
+
}
|
|
3026
|
+
];
|
|
3027
|
+
}
|
|
3028
|
+
|
|
2766
3029
|
// src/core/dapp-imports/polymarket/gamma-api.ts
|
|
2767
3030
|
|
|
2768
3031
|
async function fetchPolymarketProxyWallet(eoa, signal) {
|
|
@@ -2805,7 +3068,7 @@ async function fetchPolymarketProxyWallet(eoa, signal) {
|
|
|
2805
3068
|
|
|
2806
3069
|
|
|
2807
3070
|
|
|
2808
|
-
var
|
|
3071
|
+
var COLLATERAL_OFFRAMP_ABI2 = _viem.parseAbi.call(void 0, [
|
|
2809
3072
|
"function unwrap(address _asset, address _to, uint256 _amount)"
|
|
2810
3073
|
]);
|
|
2811
3074
|
var MULTI_SEND_ABI = _viem.parseAbi.call(void 0, ["function multiSend(bytes transactions)"]);
|
|
@@ -2856,7 +3119,7 @@ async function executePolymarketSafeTransfer(params) {
|
|
|
2856
3119
|
}
|
|
2857
3120
|
const isOwner = await publicClient.readContract({
|
|
2858
3121
|
address: safeAddress,
|
|
2859
|
-
abi:
|
|
3122
|
+
abi: _chunkENMIKNXScjs.SAFE_ABI,
|
|
2860
3123
|
functionName: "isOwner",
|
|
2861
3124
|
args: [account.address]
|
|
2862
3125
|
});
|
|
@@ -2873,7 +3136,7 @@ async function executePolymarketSafeTransfer(params) {
|
|
|
2873
3136
|
account,
|
|
2874
3137
|
chain,
|
|
2875
3138
|
address: safeAddress,
|
|
2876
|
-
abi:
|
|
3139
|
+
abi: _chunkENMIKNXScjs.SAFE_ABI,
|
|
2877
3140
|
functionName: "execTransaction",
|
|
2878
3141
|
args: [
|
|
2879
3142
|
safeTx.to,
|
|
@@ -2892,7 +3155,7 @@ async function executePolymarketSafeTransfer(params) {
|
|
|
2892
3155
|
hash: txHash
|
|
2893
3156
|
});
|
|
2894
3157
|
const parsed = _viem.parseEventLogs.call(void 0, {
|
|
2895
|
-
abi:
|
|
3158
|
+
abi: _chunkENMIKNXScjs.SAFE_ABI,
|
|
2896
3159
|
logs: receipt.logs.filter(
|
|
2897
3160
|
(log) => log.address.toLowerCase() === safeAddress.toLowerCase()
|
|
2898
3161
|
),
|
|
@@ -2930,7 +3193,7 @@ function buildPusdUnwrapSafeTx(recipient, amount) {
|
|
|
2930
3193
|
args: [POLYMARKET_COLLATERAL_OFFRAMP_ADDRESS, amount]
|
|
2931
3194
|
});
|
|
2932
3195
|
const unwrapData = _viem.encodeFunctionData.call(void 0, {
|
|
2933
|
-
abi:
|
|
3196
|
+
abi: COLLATERAL_OFFRAMP_ABI2,
|
|
2934
3197
|
functionName: "unwrap",
|
|
2935
3198
|
args: [POLYMARKET_USDCE_ADDRESS, recipient, amount]
|
|
2936
3199
|
});
|
|
@@ -2970,21 +3233,32 @@ var polymarketProvider = {
|
|
|
2970
3233
|
async fetchAvailability({ eoa, getPublicClient: getPublicClient2, signal }) {
|
|
2971
3234
|
const proxyWallet = await fetchPolymarketProxyWallet(eoa, signal);
|
|
2972
3235
|
if (!proxyWallet) return null;
|
|
2973
|
-
if (_optionalChain([signal, 'optionalAccess',
|
|
3236
|
+
if (_optionalChain([signal, 'optionalAccess', _89 => _89.aborted])) return null;
|
|
2974
3237
|
const polygonClient = getPublicClient2(POLYMARKET_POLYGON_CHAIN_ID);
|
|
2975
3238
|
if (!polygonClient) return null;
|
|
2976
3239
|
const balances = await readPolymarketBalances({
|
|
2977
3240
|
publicClient: polygonClient,
|
|
2978
3241
|
proxyWallet
|
|
2979
3242
|
});
|
|
2980
|
-
if (_optionalChain([signal, 'optionalAccess',
|
|
3243
|
+
if (_optionalChain([signal, 'optionalAccess', _90 => _90.aborted])) return null;
|
|
2981
3244
|
if (balances.pusd === 0n && balances.usdce === 0n) return null;
|
|
3245
|
+
const walletKind = await detectPolymarketWalletKind({
|
|
3246
|
+
publicClient: polygonClient,
|
|
3247
|
+
proxyWallet,
|
|
3248
|
+
eoa
|
|
3249
|
+
});
|
|
3250
|
+
if (_optionalChain([signal, 'optionalAccess', _91 => _91.aborted])) return null;
|
|
3251
|
+
if (!walletKind) return null;
|
|
2982
3252
|
const assets = [];
|
|
2983
3253
|
if (balances.pusd > 0n) {
|
|
2984
|
-
assets.push(
|
|
3254
|
+
assets.push(
|
|
3255
|
+
buildAsset({ tokenKind: "pusd", proxyWallet, walletKind, balance: balances.pusd })
|
|
3256
|
+
);
|
|
2985
3257
|
}
|
|
2986
3258
|
if (balances.usdce > 0n) {
|
|
2987
|
-
assets.push(
|
|
3259
|
+
assets.push(
|
|
3260
|
+
buildAsset({ tokenKind: "usdce", proxyWallet, walletKind, balance: balances.usdce })
|
|
3261
|
+
);
|
|
2988
3262
|
}
|
|
2989
3263
|
const totalUsd = assets.reduce((sum, a) => sum + (_nullishCoalesce(a.balanceUsd, () => ( 0))), 0);
|
|
2990
3264
|
const availability = {
|
|
@@ -2994,8 +3268,32 @@ var polymarketProvider = {
|
|
|
2994
3268
|
};
|
|
2995
3269
|
return availability;
|
|
2996
3270
|
},
|
|
2997
|
-
async executeTransfer({
|
|
3271
|
+
async executeTransfer({
|
|
3272
|
+
walletClient,
|
|
3273
|
+
publicClient,
|
|
3274
|
+
recipient,
|
|
3275
|
+
asset,
|
|
3276
|
+
amount,
|
|
3277
|
+
backend
|
|
3278
|
+
}) {
|
|
2998
3279
|
const metadata = asset.providerMetadata;
|
|
3280
|
+
if (metadata.walletKind === "deposit-wallet") {
|
|
3281
|
+
if (!backend) {
|
|
3282
|
+
throw new Error(
|
|
3283
|
+
"Polymarket deposit-wallet transfers require a backend connection"
|
|
3284
|
+
);
|
|
3285
|
+
}
|
|
3286
|
+
const { payload, sourceToken, sourceSymbol } = await buildSignedDepositWalletBatch({
|
|
3287
|
+
walletClient,
|
|
3288
|
+
publicClient,
|
|
3289
|
+
walletAddress: metadata.proxyWallet,
|
|
3290
|
+
recipient,
|
|
3291
|
+
amount,
|
|
3292
|
+
tokenKind: metadata.tokenKind
|
|
3293
|
+
});
|
|
3294
|
+
const { txHash } = await backend.submitPolymarketWithdraw(payload);
|
|
3295
|
+
return { txHash, sourceToken, sourceSymbol, sourceDecimals: 6 };
|
|
3296
|
+
}
|
|
2999
3297
|
const result = await executePolymarketSafeTransfer({
|
|
3000
3298
|
walletClient,
|
|
3001
3299
|
publicClient,
|
|
@@ -3013,18 +3311,19 @@ var polymarketProvider = {
|
|
|
3013
3311
|
}
|
|
3014
3312
|
};
|
|
3015
3313
|
function buildAsset(params) {
|
|
3016
|
-
const { tokenKind, proxyWallet, balance } = params;
|
|
3314
|
+
const { tokenKind, proxyWallet, walletKind, balance } = params;
|
|
3017
3315
|
const isPusd = tokenKind === "pusd";
|
|
3018
3316
|
const tokenAddress = isPusd ? POLYMARKET_PUSD_ADDRESS : POLYMARKET_USDCE_ADDRESS;
|
|
3019
3317
|
const symbol = isPusd ? "pUSD" : "USDC.e";
|
|
3020
3318
|
const balanceUsd = Number(_viem.formatUnits.call(void 0, balance, 6));
|
|
3021
|
-
const metadata = { proxyWallet, tokenKind };
|
|
3319
|
+
const metadata = { proxyWallet, tokenKind, walletKind };
|
|
3022
3320
|
return {
|
|
3023
3321
|
id: `polymarket:${tokenKind}`,
|
|
3024
3322
|
chainId: POLYMARKET_POLYGON_CHAIN_ID,
|
|
3025
3323
|
token: tokenAddress,
|
|
3026
3324
|
symbol,
|
|
3027
3325
|
name: isPusd ? "Polymarket USD" : "Polygon USDC.e",
|
|
3326
|
+
icon: isPusd ? POLYMARKET_ICON_URL : void 0,
|
|
3028
3327
|
decimals: 6,
|
|
3029
3328
|
balance: balance.toString(),
|
|
3030
3329
|
balanceUsd: Number.isFinite(balanceUsd) ? balanceUsd : 0,
|
|
@@ -3049,6 +3348,14 @@ function getEnabledProviders(config) {
|
|
|
3049
3348
|
);
|
|
3050
3349
|
}
|
|
3051
3350
|
|
|
3351
|
+
// src/core/dapp-imports/types.ts
|
|
3352
|
+
function isDappImportAsset(asset) {
|
|
3353
|
+
return typeof asset.source === "string" && typeof asset.sourceLabel === "string" && "providerMetadata" in asset;
|
|
3354
|
+
}
|
|
3355
|
+
|
|
3356
|
+
// src/DepositFlow.tsx
|
|
3357
|
+
var _chains = require('viem/chains');
|
|
3358
|
+
|
|
3052
3359
|
// src/store/index.ts
|
|
3053
3360
|
|
|
3054
3361
|
var _zustand = require('zustand');
|
|
@@ -3303,12 +3610,12 @@ function applyAction(state, action) {
|
|
|
3303
3610
|
requestKey: action.requestKey,
|
|
3304
3611
|
cacheKey: action.cacheKey,
|
|
3305
3612
|
status: "loading",
|
|
3306
|
-
smartAccount: _nullishCoalesce(_optionalChain([existing, 'optionalAccess',
|
|
3307
|
-
sessionOwnerAddress: _nullishCoalesce(_optionalChain([existing, 'optionalAccess',
|
|
3308
|
-
solanaDepositAddress: _nullishCoalesce(_optionalChain([existing, 'optionalAccess',
|
|
3613
|
+
smartAccount: _nullishCoalesce(_optionalChain([existing, 'optionalAccess', _92 => _92.smartAccount]), () => ( null)),
|
|
3614
|
+
sessionOwnerAddress: _nullishCoalesce(_optionalChain([existing, 'optionalAccess', _93 => _93.sessionOwnerAddress]), () => ( null)),
|
|
3615
|
+
solanaDepositAddress: _nullishCoalesce(_optionalChain([existing, 'optionalAccess', _94 => _94.solanaDepositAddress]), () => ( null)),
|
|
3309
3616
|
message: null,
|
|
3310
3617
|
cacheable: action.cacheable,
|
|
3311
|
-
attemptNonce: _nullishCoalesce(_optionalChain([existing, 'optionalAccess',
|
|
3618
|
+
attemptNonce: _nullishCoalesce(_optionalChain([existing, 'optionalAccess', _95 => _95.attemptNonce]), () => ( 0))
|
|
3312
3619
|
}));
|
|
3313
3620
|
}
|
|
3314
3621
|
case "setup/ready": {
|
|
@@ -3662,15 +3969,15 @@ var SetupError = class extends Error {
|
|
|
3662
3969
|
}
|
|
3663
3970
|
};
|
|
3664
3971
|
async function resolveSessionOwner(eoaAddress) {
|
|
3665
|
-
const local =
|
|
3972
|
+
const local = _chunkENMIKNXScjs.loadSessionOwnerFromStorage.call(void 0, eoaAddress);
|
|
3666
3973
|
if (local) {
|
|
3667
3974
|
return {
|
|
3668
|
-
account:
|
|
3975
|
+
account: _chunkENMIKNXScjs.accountFromPrivateKey.call(void 0, local.privateKey),
|
|
3669
3976
|
address: local.address
|
|
3670
3977
|
};
|
|
3671
3978
|
}
|
|
3672
|
-
const created =
|
|
3673
|
-
|
|
3979
|
+
const created = _chunkENMIKNXScjs.createSessionOwnerKey.call(void 0, );
|
|
3980
|
+
_chunkENMIKNXScjs.saveSessionOwnerToStorage.call(void 0, eoaAddress, created.privateKey, created.address);
|
|
3674
3981
|
return { account: created.account, address: created.address };
|
|
3675
3982
|
}
|
|
3676
3983
|
function stableStringify(value) {
|
|
@@ -3685,13 +3992,17 @@ function stableStringify(value) {
|
|
|
3685
3992
|
const entries = keys.filter((k) => obj[k] !== void 0).map((k) => `${JSON.stringify(k)}:${stableStringify(obj[k])}`);
|
|
3686
3993
|
return `{${entries.join(",")}}`;
|
|
3687
3994
|
}
|
|
3995
|
+
function normalizeKeyToken(value) {
|
|
3996
|
+
if (value === void 0) return void 0;
|
|
3997
|
+
return value.startsWith("0x") ? value.toLowerCase() : value;
|
|
3998
|
+
}
|
|
3688
3999
|
function computeRequestKey(input, sessionOwnerAddress) {
|
|
3689
4000
|
return stableStringify({
|
|
3690
4001
|
ownerAddress: input.ownerAddress.toLowerCase(),
|
|
3691
4002
|
sessionOwnerAddress: sessionOwnerAddress.toLowerCase(),
|
|
3692
4003
|
targetChain: input.targetChain,
|
|
3693
|
-
targetToken: input.targetToken
|
|
3694
|
-
recipient:
|
|
4004
|
+
targetToken: normalizeKeyToken(input.targetToken),
|
|
4005
|
+
recipient: normalizeKeyToken(input.recipient),
|
|
3695
4006
|
outputTokenRules: _nullishCoalesce(input.outputTokenRules, () => ( null)),
|
|
3696
4007
|
rejectUnmapped: _nullishCoalesce(input.rejectUnmapped, () => ( null)),
|
|
3697
4008
|
signerAddress: input.signerAddress.toLowerCase(),
|
|
@@ -3706,8 +4017,8 @@ function computeCacheKey(input, sessionOwnerAddress) {
|
|
|
3706
4017
|
ownerAddress: input.ownerAddress.toLowerCase(),
|
|
3707
4018
|
sessionOwnerAddress: sessionOwnerAddress.toLowerCase(),
|
|
3708
4019
|
targetChain: input.targetChain,
|
|
3709
|
-
targetToken: input.targetToken
|
|
3710
|
-
recipient:
|
|
4020
|
+
targetToken: normalizeKeyToken(input.targetToken),
|
|
4021
|
+
recipient: normalizeKeyToken(input.recipient),
|
|
3711
4022
|
outputTokenRules: _nullishCoalesce(input.outputTokenRules, () => ( null)),
|
|
3712
4023
|
rejectUnmapped: _nullishCoalesce(input.rejectUnmapped, () => ( null)),
|
|
3713
4024
|
signerAddress: input.signerAddress.toLowerCase(),
|
|
@@ -3716,14 +4027,14 @@ function computeCacheKey(input, sessionOwnerAddress) {
|
|
|
3716
4027
|
});
|
|
3717
4028
|
}
|
|
3718
4029
|
function computeIsCacheable(input) {
|
|
3719
|
-
return !input.forceRegister && !(_nullishCoalesce(_optionalChain([input, 'access',
|
|
4030
|
+
return !input.forceRegister && !(_nullishCoalesce(_optionalChain([input, 'access', _96 => _96.postBridgeActions, 'optionalAccess', _97 => _97.length]), () => ( 0)));
|
|
3720
4031
|
}
|
|
3721
4032
|
var SETUP_REQUEST_DEDUPE_TTL_MS = 3e4;
|
|
3722
4033
|
var setupRequestDedupe = /* @__PURE__ */ new Map();
|
|
3723
4034
|
function readDedupedAccountSetupResult(requestKey) {
|
|
3724
4035
|
const now = Date.now();
|
|
3725
4036
|
const existing = setupRequestDedupe.get(requestKey);
|
|
3726
|
-
if (_optionalChain([existing, 'optionalAccess',
|
|
4037
|
+
if (_optionalChain([existing, 'optionalAccess', _98 => _98.settled]) && existing.expiresAt > now && existing.result) {
|
|
3727
4038
|
return existing.result;
|
|
3728
4039
|
}
|
|
3729
4040
|
return null;
|
|
@@ -3734,16 +4045,16 @@ async function runAccountSetup(input, deps) {
|
|
|
3734
4045
|
try {
|
|
3735
4046
|
const sessionOwner = await resolveSessionOwner(input.ownerAddress);
|
|
3736
4047
|
const cacheKey = computeCacheKey(input, sessionOwner.address);
|
|
3737
|
-
|
|
4048
|
+
_chunkENMIKNXScjs.debugLog.call(void 0, debug, "account-setup", "setup:start", {
|
|
3738
4049
|
owner: input.ownerAddress,
|
|
3739
4050
|
sessionOwner: sessionOwner.address,
|
|
3740
|
-
hasPostBridgeActions: Boolean(_optionalChain([input, 'access',
|
|
4051
|
+
hasPostBridgeActions: Boolean(_optionalChain([input, 'access', _99 => _99.postBridgeActions, 'optionalAccess', _100 => _100.length])),
|
|
3741
4052
|
forceRegister: _nullishCoalesce(input.forceRegister, () => ( false))
|
|
3742
4053
|
});
|
|
3743
4054
|
const setup = await service.setupAccount({
|
|
3744
4055
|
ownerAddress: input.ownerAddress,
|
|
3745
4056
|
sessionOwnerAddress: sessionOwner.address,
|
|
3746
|
-
targetChain:
|
|
4057
|
+
targetChain: _chunkENMIKNXScjs.targetChainToCaip2.call(void 0, input.targetChain),
|
|
3747
4058
|
targetToken: input.targetToken,
|
|
3748
4059
|
recipient: input.recipient,
|
|
3749
4060
|
postBridgeActions: input.postBridgeActions,
|
|
@@ -3782,7 +4093,7 @@ async function runAccountSetup(input, deps) {
|
|
|
3782
4093
|
primaryType: typedData.primaryType,
|
|
3783
4094
|
message: typedData.message
|
|
3784
4095
|
});
|
|
3785
|
-
const sessionDetails =
|
|
4096
|
+
const sessionDetails = _chunkENMIKNXScjs.buildSessionDetails.call(void 0,
|
|
3786
4097
|
setup.sessionDetailsUnsigned,
|
|
3787
4098
|
signature
|
|
3788
4099
|
);
|
|
@@ -3796,13 +4107,13 @@ async function runAccountSetup(input, deps) {
|
|
|
3796
4107
|
eoaAddress: input.ownerAddress,
|
|
3797
4108
|
sessionOwner: sessionOwner.address,
|
|
3798
4109
|
target: {
|
|
3799
|
-
chain:
|
|
4110
|
+
chain: _chunkENMIKNXScjs.targetChainToCaip2.call(void 0, input.targetChain),
|
|
3800
4111
|
token: input.targetToken,
|
|
3801
4112
|
...input.recipient && { recipient: input.recipient },
|
|
3802
|
-
..._optionalChain([input, 'access',
|
|
4113
|
+
..._optionalChain([input, 'access', _101 => _101.postBridgeActions, 'optionalAccess', _102 => _102.length]) && {
|
|
3803
4114
|
postBridgeActions: input.postBridgeActions
|
|
3804
4115
|
},
|
|
3805
|
-
..._optionalChain([input, 'access',
|
|
4116
|
+
..._optionalChain([input, 'access', _103 => _103.outputTokenRules, 'optionalAccess', _104 => _104.length]) && {
|
|
3806
4117
|
outputTokenRules: input.outputTokenRules
|
|
3807
4118
|
},
|
|
3808
4119
|
...input.rejectUnmapped != null && {
|
|
@@ -3818,7 +4129,7 @@ async function runAccountSetup(input, deps) {
|
|
|
3818
4129
|
isRegistered: true
|
|
3819
4130
|
};
|
|
3820
4131
|
} catch (error) {
|
|
3821
|
-
|
|
4132
|
+
_chunkENMIKNXScjs.debugError.call(void 0, debug, "account-setup", "setup:failed", error, {
|
|
3822
4133
|
owner: input.ownerAddress
|
|
3823
4134
|
});
|
|
3824
4135
|
if (error instanceof SetupError) throw error;
|
|
@@ -3829,7 +4140,7 @@ function runAccountSetupDeduped(input, deps, requestKey) {
|
|
|
3829
4140
|
const now = Date.now();
|
|
3830
4141
|
const existing = setupRequestDedupe.get(requestKey);
|
|
3831
4142
|
if (existing && (!existing.settled || existing.expiresAt > now)) {
|
|
3832
|
-
|
|
4143
|
+
_chunkENMIKNXScjs.debugLog.call(void 0, deps.debug, "account-setup", "setup:dedupe-hit", {
|
|
3833
4144
|
owner: input.ownerAddress,
|
|
3834
4145
|
forceRegister: _nullishCoalesce(input.forceRegister, () => ( false))
|
|
3835
4146
|
});
|
|
@@ -3878,7 +4189,7 @@ function mapError(error) {
|
|
|
3878
4189
|
"server"
|
|
3879
4190
|
);
|
|
3880
4191
|
}
|
|
3881
|
-
return new SetupError(
|
|
4192
|
+
return new SetupError(error.message, "client");
|
|
3882
4193
|
}
|
|
3883
4194
|
return new SetupError(
|
|
3884
4195
|
"Deposit service is temporarily unavailable. Please try again shortly.",
|
|
@@ -4042,10 +4353,11 @@ function DepositFlow({
|
|
|
4042
4353
|
sourceToken: defaultSourceToken,
|
|
4043
4354
|
amount: defaultAmount,
|
|
4044
4355
|
recipient,
|
|
4356
|
+
appBalanceUsd,
|
|
4045
4357
|
postBridgeActions,
|
|
4046
4358
|
outputTokenRules,
|
|
4047
4359
|
rejectUnmapped,
|
|
4048
|
-
signerAddress =
|
|
4360
|
+
signerAddress = _chunkMHKHSCIAcjs.DEFAULT_SIGNER_ADDRESS,
|
|
4049
4361
|
sessionChainIds,
|
|
4050
4362
|
forceRegister = false,
|
|
4051
4363
|
waitForFinalTx = true,
|
|
@@ -4064,12 +4376,12 @@ function DepositFlow({
|
|
|
4064
4376
|
onError,
|
|
4065
4377
|
debug
|
|
4066
4378
|
}) {
|
|
4067
|
-
const onStepChangeRef =
|
|
4068
|
-
const onEventRef =
|
|
4069
|
-
const onLifecycleRef =
|
|
4070
|
-
const onErrorRef =
|
|
4379
|
+
const onStepChangeRef = _chunkENMIKNXScjs.useLatestRef.call(void 0, onStepChange);
|
|
4380
|
+
const onEventRef = _chunkENMIKNXScjs.useLatestRef.call(void 0, onEvent);
|
|
4381
|
+
const onLifecycleRef = _chunkENMIKNXScjs.useLatestRef.call(void 0, onLifecycle);
|
|
4382
|
+
const onErrorRef = _chunkENMIKNXScjs.useLatestRef.call(void 0, onError);
|
|
4071
4383
|
const hasInitialReownSession = Boolean(
|
|
4072
|
-
enableSolana ? _optionalChain([reownWallet, 'optionalAccess',
|
|
4384
|
+
enableSolana ? _optionalChain([reownWallet, 'optionalAccess', _105 => _105.isConnected]) || _optionalChain([reownWallet, 'optionalAccess', _106 => _106.address]) : _optionalChain([reownWallet, 'optionalAccess', _107 => _107.address])
|
|
4073
4385
|
);
|
|
4074
4386
|
const hasInitialWalletHydrationPending = Boolean(
|
|
4075
4387
|
dappAddress && (hasDappWalletClientProp && dappWalletClient === void 0 || reownWallet && !hasInitialReownSession && !reownWallet.isReady)
|
|
@@ -4084,22 +4396,19 @@ function DepositFlow({
|
|
|
4084
4396
|
const hasNavigatedBack = flowSlice.hasNavigatedBack;
|
|
4085
4397
|
const selectedWalletId = useDepositStore(selectedWalletIdSelector);
|
|
4086
4398
|
const [totalBalanceUsd, setTotalBalanceUsd] = _react.useState.call(void 0, 0);
|
|
4087
|
-
const [targetBalanceUsd, setTargetBalanceUsd] = _react.useState.call(void 0,
|
|
4088
|
-
void 0
|
|
4089
|
-
);
|
|
4090
4399
|
const [hasQrAutoAdvanceGraceElapsed, setHasQrAutoAdvanceGraceElapsed] = _react.useState.call(void 0, () => !hasInitialWalletHydrationPending);
|
|
4091
4400
|
const portfolioAssetsRef = _react.useRef.call(void 0, []);
|
|
4092
4401
|
const stableWalletSignerRef = _react.useRef.call(void 0, null);
|
|
4093
4402
|
const stableWalletSelectionKeyRef = _react.useRef.call(void 0, null);
|
|
4094
4403
|
const logFlow = _react.useCallback.call(void 0,
|
|
4095
4404
|
(message, data) => {
|
|
4096
|
-
|
|
4405
|
+
_chunkENMIKNXScjs.debugLog.call(void 0, debug, "deposit-flow", message, data);
|
|
4097
4406
|
},
|
|
4098
4407
|
[debug]
|
|
4099
4408
|
);
|
|
4100
4409
|
const logFlowError = _react.useCallback.call(void 0,
|
|
4101
4410
|
(message, error, data) => {
|
|
4102
|
-
|
|
4411
|
+
_chunkENMIKNXScjs.debugError.call(void 0, debug, "deposit-flow", message, error, data);
|
|
4103
4412
|
},
|
|
4104
4413
|
[debug]
|
|
4105
4414
|
);
|
|
@@ -4122,12 +4431,12 @@ function DepositFlow({
|
|
|
4122
4431
|
return null;
|
|
4123
4432
|
}, []);
|
|
4124
4433
|
const dappSwitchChain = _react.useMemo.call(void 0, () => {
|
|
4125
|
-
if (!_optionalChain([dappWalletClient, 'optionalAccess',
|
|
4434
|
+
if (!_optionalChain([dappWalletClient, 'optionalAccess', _108 => _108.switchChain])) return void 0;
|
|
4126
4435
|
return async (chainId) => {
|
|
4127
|
-
await _optionalChain([dappWalletClient, 'access',
|
|
4436
|
+
await _optionalChain([dappWalletClient, 'access', _109 => _109.switchChain, 'optionalCall', _110 => _110({ id: chainId })]);
|
|
4128
4437
|
};
|
|
4129
4438
|
}, [dappWalletClient]);
|
|
4130
|
-
const connectedWalletAddress = _nullishCoalesce(_optionalChain([dappWalletClient, 'optionalAccess',
|
|
4439
|
+
const connectedWalletAddress = _nullishCoalesce(_optionalChain([dappWalletClient, 'optionalAccess', _111 => _111.account, 'optionalAccess', _112 => _112.address]), () => ( null));
|
|
4131
4440
|
const walletOptions = _react.useMemo.call(void 0, () => {
|
|
4132
4441
|
const options = [];
|
|
4133
4442
|
const seen = /* @__PURE__ */ new Set();
|
|
@@ -4141,7 +4450,7 @@ function DepositFlow({
|
|
|
4141
4450
|
});
|
|
4142
4451
|
seen.add(id);
|
|
4143
4452
|
}
|
|
4144
|
-
if (enableSolana && _optionalChain([reownWallet, 'optionalAccess',
|
|
4453
|
+
if (enableSolana && _optionalChain([reownWallet, 'optionalAccess', _113 => _113.isConnected]) && reownWallet.isSolana && reownWallet.solanaAddress && dappAddress) {
|
|
4145
4454
|
const id = _nullishCoalesce(reownWallet.caipAddress, () => ( `solana:${reownWallet.solanaAddress}`));
|
|
4146
4455
|
if (!seen.has(id)) {
|
|
4147
4456
|
options.push({
|
|
@@ -4153,7 +4462,7 @@ function DepositFlow({
|
|
|
4153
4462
|
});
|
|
4154
4463
|
seen.add(id);
|
|
4155
4464
|
}
|
|
4156
|
-
} else if (_optionalChain([reownWallet, 'optionalAccess',
|
|
4465
|
+
} else if (_optionalChain([reownWallet, 'optionalAccess', _114 => _114.address]) && reownWallet.isConnected && reownWallet.walletClient && reownWallet.publicClient && !seen.has(`evm:${reownWallet.address.toLowerCase()}`)) {
|
|
4157
4466
|
const id = `evm:${reownWallet.address.toLowerCase()}`;
|
|
4158
4467
|
if (!seen.has(id)) {
|
|
4159
4468
|
options.push({
|
|
@@ -4170,20 +4479,20 @@ function DepositFlow({
|
|
|
4170
4479
|
}, [
|
|
4171
4480
|
connectedWalletAddress,
|
|
4172
4481
|
dappAddress,
|
|
4173
|
-
_optionalChain([reownWallet, 'optionalAccess',
|
|
4174
|
-
_optionalChain([reownWallet, 'optionalAccess',
|
|
4175
|
-
_optionalChain([reownWallet, 'optionalAccess',
|
|
4176
|
-
_optionalChain([reownWallet, 'optionalAccess',
|
|
4177
|
-
_optionalChain([reownWallet, 'optionalAccess',
|
|
4482
|
+
_optionalChain([reownWallet, 'optionalAccess', _115 => _115.address]),
|
|
4483
|
+
_optionalChain([reownWallet, 'optionalAccess', _116 => _116.isConnected]),
|
|
4484
|
+
_optionalChain([reownWallet, 'optionalAccess', _117 => _117.walletClient]),
|
|
4485
|
+
_optionalChain([reownWallet, 'optionalAccess', _118 => _118.publicClient]),
|
|
4486
|
+
_optionalChain([reownWallet, 'optionalAccess', _119 => _119.icon]),
|
|
4178
4487
|
enableSolana,
|
|
4179
|
-
_optionalChain([reownWallet, 'optionalAccess',
|
|
4180
|
-
_optionalChain([reownWallet, 'optionalAccess',
|
|
4181
|
-
_optionalChain([reownWallet, 'optionalAccess',
|
|
4488
|
+
_optionalChain([reownWallet, 'optionalAccess', _120 => _120.isSolana]),
|
|
4489
|
+
_optionalChain([reownWallet, 'optionalAccess', _121 => _121.solanaAddress]),
|
|
4490
|
+
_optionalChain([reownWallet, 'optionalAccess', _122 => _122.caipAddress])
|
|
4182
4491
|
]);
|
|
4183
|
-
const canAutoLock = _optionalChain([dappWalletClient, 'optionalAccess',
|
|
4492
|
+
const canAutoLock = _optionalChain([dappWalletClient, 'optionalAccess', _123 => _123.account]) && dappAddress && !reownWallet;
|
|
4184
4493
|
const hasWalletOptions = walletOptions.length > 0;
|
|
4185
4494
|
const hasReownSession = Boolean(
|
|
4186
|
-
enableSolana ? _optionalChain([reownWallet, 'optionalAccess',
|
|
4495
|
+
enableSolana ? _optionalChain([reownWallet, 'optionalAccess', _124 => _124.isConnected]) || _optionalChain([reownWallet, 'optionalAccess', _125 => _125.address]) : _optionalChain([reownWallet, 'optionalAccess', _126 => _126.address])
|
|
4187
4496
|
);
|
|
4188
4497
|
const isWalletHydrationPending = Boolean(
|
|
4189
4498
|
dappAddress && !hasWalletOptions && (hasDappWalletClientProp && dappWalletClient === void 0 || reownWallet && !hasReownSession && !reownWallet.isReady)
|
|
@@ -4214,6 +4523,25 @@ function DepositFlow({
|
|
|
4214
4523
|
isConnectSelectionConfirmed,
|
|
4215
4524
|
selectedWalletId
|
|
4216
4525
|
]);
|
|
4526
|
+
const setupChainId = typeof targetChain === "number" ? targetChain : typeof defaultSourceChain === "number" ? defaultSourceChain : _chains.base.id;
|
|
4527
|
+
const targetSymbol = _chunkMHKHSCIAcjs.getTargetTokenSymbol.call(void 0, targetToken, targetChain);
|
|
4528
|
+
const isTargetStablecoin = _chunkMHKHSCIAcjs.isStablecoinSymbol.call(void 0, targetSymbol);
|
|
4529
|
+
const targetMarketPriceRef = _react.useRef.call(void 0, null);
|
|
4530
|
+
_react.useEffect.call(void 0, () => {
|
|
4531
|
+
targetMarketPriceRef.current = null;
|
|
4532
|
+
if (isTargetStablecoin || targetSymbol === "Token") {
|
|
4533
|
+
return;
|
|
4534
|
+
}
|
|
4535
|
+
let cancelled = false;
|
|
4536
|
+
service.fetchPrices([targetSymbol]).then((prices) => {
|
|
4537
|
+
if (cancelled) return;
|
|
4538
|
+
const price = prices[targetSymbol.toUpperCase()];
|
|
4539
|
+
targetMarketPriceRef.current = typeof price === "number" && price > 0 ? price : null;
|
|
4540
|
+
});
|
|
4541
|
+
return () => {
|
|
4542
|
+
cancelled = true;
|
|
4543
|
+
};
|
|
4544
|
+
}, [service, targetSymbol, isTargetStablecoin]);
|
|
4217
4545
|
const walletSignerContext = _react.useMemo.call(void 0, () => {
|
|
4218
4546
|
if (flowMode === "deposit-address") {
|
|
4219
4547
|
return null;
|
|
@@ -4223,16 +4551,16 @@ function DepositFlow({
|
|
|
4223
4551
|
return {
|
|
4224
4552
|
ownerAddress: dappAddress,
|
|
4225
4553
|
walletClient: void 0,
|
|
4226
|
-
publicClient: _nullishCoalesce(dappPublicClient, () => (
|
|
4554
|
+
publicClient: _nullishCoalesce(dappPublicClient, () => ( _chunkENMIKNXScjs.getPublicClient.call(void 0, setupChainId))),
|
|
4227
4555
|
switchChain: void 0
|
|
4228
4556
|
};
|
|
4229
4557
|
}
|
|
4230
4558
|
if (canAutoLock) {
|
|
4231
|
-
const fallbackChainId = _nullishCoalesce(_optionalChain([dappWalletClient, 'optionalAccess',
|
|
4559
|
+
const fallbackChainId = _nullishCoalesce(_optionalChain([dappWalletClient, 'optionalAccess', _127 => _127.chain, 'optionalAccess', _128 => _128.id]), () => ( setupChainId));
|
|
4232
4560
|
return {
|
|
4233
4561
|
ownerAddress: dappWalletClient.account.address,
|
|
4234
4562
|
walletClient: dappWalletClient,
|
|
4235
|
-
publicClient: _nullishCoalesce(dappPublicClient, () => (
|
|
4563
|
+
publicClient: _nullishCoalesce(dappPublicClient, () => ( _chunkENMIKNXScjs.getPublicClient.call(void 0, fallbackChainId))),
|
|
4236
4564
|
switchChain: dappSwitchChain
|
|
4237
4565
|
};
|
|
4238
4566
|
}
|
|
@@ -4246,24 +4574,24 @@ function DepositFlow({
|
|
|
4246
4574
|
return {
|
|
4247
4575
|
ownerAddress: dappAddress,
|
|
4248
4576
|
walletClient: void 0,
|
|
4249
|
-
publicClient: _nullishCoalesce(dappPublicClient, () => (
|
|
4577
|
+
publicClient: _nullishCoalesce(dappPublicClient, () => ( _chunkENMIKNXScjs.getPublicClient.call(void 0, setupChainId))),
|
|
4250
4578
|
switchChain: void 0
|
|
4251
4579
|
};
|
|
4252
4580
|
}
|
|
4253
|
-
if (selectedOption.kind === "connected" && _optionalChain([dappWalletClient, 'optionalAccess',
|
|
4254
|
-
const fallbackChainId = _nullishCoalesce(_optionalChain([dappWalletClient, 'optionalAccess',
|
|
4581
|
+
if (selectedOption.kind === "connected" && _optionalChain([dappWalletClient, 'optionalAccess', _129 => _129.account]) && selectedOption.address && dappWalletClient.account.address.toLowerCase() === selectedOption.address.toLowerCase()) {
|
|
4582
|
+
const fallbackChainId = _nullishCoalesce(_optionalChain([dappWalletClient, 'optionalAccess', _130 => _130.chain, 'optionalAccess', _131 => _131.id]), () => ( setupChainId));
|
|
4255
4583
|
return {
|
|
4256
4584
|
ownerAddress: dappWalletClient.account.address,
|
|
4257
4585
|
walletClient: dappWalletClient,
|
|
4258
|
-
publicClient: _nullishCoalesce(dappPublicClient, () => (
|
|
4586
|
+
publicClient: _nullishCoalesce(dappPublicClient, () => ( _chunkENMIKNXScjs.getPublicClient.call(void 0, fallbackChainId))),
|
|
4259
4587
|
switchChain: dappSwitchChain
|
|
4260
4588
|
};
|
|
4261
4589
|
}
|
|
4262
|
-
if (selectedOption.kind === "external" && _optionalChain([reownWallet, 'optionalAccess',
|
|
4590
|
+
if (selectedOption.kind === "external" && _optionalChain([reownWallet, 'optionalAccess', _132 => _132.address]) && selectedOption.address && reownWallet.address.toLowerCase() === selectedOption.address.toLowerCase()) {
|
|
4263
4591
|
return {
|
|
4264
4592
|
ownerAddress: reownWallet.address,
|
|
4265
4593
|
walletClient: reownWallet.walletClient,
|
|
4266
|
-
publicClient: _nullishCoalesce(reownWallet.publicClient, () => (
|
|
4594
|
+
publicClient: _nullishCoalesce(reownWallet.publicClient, () => ( _chunkENMIKNXScjs.getPublicClient.call(void 0, setupChainId))),
|
|
4267
4595
|
switchChain: reownWallet.switchChain
|
|
4268
4596
|
};
|
|
4269
4597
|
}
|
|
@@ -4278,7 +4606,7 @@ function DepositFlow({
|
|
|
4278
4606
|
dappSwitchChain,
|
|
4279
4607
|
dappAddress,
|
|
4280
4608
|
reownWallet,
|
|
4281
|
-
|
|
4609
|
+
setupChainId
|
|
4282
4610
|
]);
|
|
4283
4611
|
_react.useEffect.call(void 0, () => {
|
|
4284
4612
|
if (flowMode !== "wallet" && flowMode !== "dapp-import") {
|
|
@@ -4301,7 +4629,7 @@ function DepositFlow({
|
|
|
4301
4629
|
return {
|
|
4302
4630
|
ownerAddress: dappAddress,
|
|
4303
4631
|
walletClient: void 0,
|
|
4304
|
-
publicClient: _nullishCoalesce(dappPublicClient, () => (
|
|
4632
|
+
publicClient: _nullishCoalesce(dappPublicClient, () => ( _chunkENMIKNXScjs.getPublicClient.call(void 0, setupChainId))),
|
|
4305
4633
|
switchChain: void 0
|
|
4306
4634
|
};
|
|
4307
4635
|
}
|
|
@@ -4319,44 +4647,44 @@ function DepositFlow({
|
|
|
4319
4647
|
flowMode,
|
|
4320
4648
|
dappAddress,
|
|
4321
4649
|
dappPublicClient,
|
|
4322
|
-
|
|
4650
|
+
setupChainId,
|
|
4323
4651
|
walletSignerContext,
|
|
4324
4652
|
walletSelectionKey
|
|
4325
4653
|
]);
|
|
4326
4654
|
const selectedEvmWalletOwner = _react.useMemo.call(void 0, () => {
|
|
4327
4655
|
if (!selectedWalletId) return null;
|
|
4328
4656
|
const opt = walletOptions.find((o) => o.id === selectedWalletId);
|
|
4329
|
-
if (_optionalChain([opt, 'optionalAccess',
|
|
4657
|
+
if (_optionalChain([opt, 'optionalAccess', _133 => _133.kind]) === "external" && opt.address) {
|
|
4330
4658
|
return opt.address;
|
|
4331
4659
|
}
|
|
4332
|
-
if (_optionalChain([opt, 'optionalAccess',
|
|
4660
|
+
if (_optionalChain([opt, 'optionalAccess', _134 => _134.kind]) === "connected" && opt.address) {
|
|
4333
4661
|
return opt.address;
|
|
4334
4662
|
}
|
|
4335
4663
|
return null;
|
|
4336
4664
|
}, [selectedWalletId, walletOptions]);
|
|
4337
4665
|
const dappImportOwner = _react.useMemo.call(void 0, () => {
|
|
4338
4666
|
if (selectedEvmWalletOwner) return selectedEvmWalletOwner;
|
|
4339
|
-
if (_optionalChain([reownWallet, 'optionalAccess',
|
|
4667
|
+
if (_optionalChain([reownWallet, 'optionalAccess', _135 => _135.address]) && reownWallet.isConnected) {
|
|
4340
4668
|
return reownWallet.address;
|
|
4341
4669
|
}
|
|
4342
4670
|
if (connectedWalletAddress) return connectedWalletAddress;
|
|
4343
4671
|
return null;
|
|
4344
4672
|
}, [
|
|
4345
4673
|
selectedEvmWalletOwner,
|
|
4346
|
-
_optionalChain([reownWallet, 'optionalAccess',
|
|
4347
|
-
_optionalChain([reownWallet, 'optionalAccess',
|
|
4674
|
+
_optionalChain([reownWallet, 'optionalAccess', _136 => _136.address]),
|
|
4675
|
+
_optionalChain([reownWallet, 'optionalAccess', _137 => _137.isConnected]),
|
|
4348
4676
|
connectedWalletAddress
|
|
4349
4677
|
]);
|
|
4350
4678
|
const activeOwner = _react.useMemo.call(void 0,
|
|
4351
4679
|
() => resolveOwnerForMode(flowMode, {
|
|
4352
4680
|
dappAddress,
|
|
4353
|
-
walletOwner: _nullishCoalesce(_optionalChain([signerContext, 'optionalAccess',
|
|
4681
|
+
walletOwner: _nullishCoalesce(_optionalChain([signerContext, 'optionalAccess', _138 => _138.ownerAddress]), () => ( (canAutoLock ? connectedWalletAddress : selectedEvmWalletOwner))),
|
|
4354
4682
|
dappImportOwner
|
|
4355
4683
|
}),
|
|
4356
4684
|
[
|
|
4357
4685
|
flowMode,
|
|
4358
4686
|
dappAddress,
|
|
4359
|
-
_optionalChain([signerContext, 'optionalAccess',
|
|
4687
|
+
_optionalChain([signerContext, 'optionalAccess', _139 => _139.ownerAddress]),
|
|
4360
4688
|
canAutoLock,
|
|
4361
4689
|
connectedWalletAddress,
|
|
4362
4690
|
selectedEvmWalletOwner,
|
|
@@ -4367,26 +4695,6 @@ function DepositFlow({
|
|
|
4367
4695
|
() => readSetupForOwner(setupSlice, activeOwner),
|
|
4368
4696
|
[setupSlice, activeOwner]
|
|
4369
4697
|
);
|
|
4370
|
-
const activeSmartAccount = activeEntry.smartAccount;
|
|
4371
|
-
_react.useEffect.call(void 0, () => {
|
|
4372
|
-
if (!activeSmartAccount) {
|
|
4373
|
-
setTargetBalanceUsd(void 0);
|
|
4374
|
-
return;
|
|
4375
|
-
}
|
|
4376
|
-
let active = true;
|
|
4377
|
-
service.fetchPortfolio(activeSmartAccount).then((portfolio) => {
|
|
4378
|
-
if (!active) return;
|
|
4379
|
-
const target = portfolio.tokens.find(
|
|
4380
|
-
(t) => t.chainId === targetChain && typeof t.address === "string" && t.address.toLowerCase() === targetToken.toLowerCase()
|
|
4381
|
-
);
|
|
4382
|
-
setTargetBalanceUsd(_nullishCoalesce(_optionalChain([target, 'optionalAccess', _135 => _135.balanceUsd]), () => ( 0)));
|
|
4383
|
-
}).catch(() => {
|
|
4384
|
-
if (active) setTargetBalanceUsd(0);
|
|
4385
|
-
});
|
|
4386
|
-
return () => {
|
|
4387
|
-
active = false;
|
|
4388
|
-
};
|
|
4389
|
-
}, [activeSmartAccount, targetChain, targetToken, service]);
|
|
4390
4698
|
const lastActiveSetupLifecycleKeyRef = _react.useRef.call(void 0, null);
|
|
4391
4699
|
_react.useEffect.call(void 0, () => {
|
|
4392
4700
|
if (!flowMode || !isConnectSelectionConfirmed) {
|
|
@@ -4405,12 +4713,12 @@ function DepositFlow({
|
|
|
4405
4713
|
return;
|
|
4406
4714
|
}
|
|
4407
4715
|
lastActiveSetupLifecycleKeyRef.current = lifecycleKey;
|
|
4408
|
-
_optionalChain([onLifecycleRef, 'access',
|
|
4716
|
+
_optionalChain([onLifecycleRef, 'access', _140 => _140.current, 'optionalCall', _141 => _141({
|
|
4409
4717
|
type: "smart-account-changed",
|
|
4410
4718
|
evm: activeEntry.smartAccount,
|
|
4411
4719
|
solana: _nullishCoalesce(activeEntry.solanaDepositAddress, () => ( null))
|
|
4412
4720
|
})]);
|
|
4413
|
-
_optionalChain([onLifecycleRef, 'access',
|
|
4721
|
+
_optionalChain([onLifecycleRef, 'access', _142 => _142.current, 'optionalCall', _143 => _143({
|
|
4414
4722
|
type: "connected",
|
|
4415
4723
|
address: activeOwner,
|
|
4416
4724
|
smartAccount: activeEntry.smartAccount
|
|
@@ -4443,7 +4751,7 @@ function DepositFlow({
|
|
|
4443
4751
|
const currentBackHandler = canGoBackFromHere ? handleBack : void 0;
|
|
4444
4752
|
const currentScreen = showConnectStep ? "connect" : effectiveStep.type;
|
|
4445
4753
|
_react.useEffect.call(void 0, () => {
|
|
4446
|
-
_optionalChain([onStepChangeRef, 'access',
|
|
4754
|
+
_optionalChain([onStepChangeRef, 'access', _144 => _144.current, 'optionalCall', _145 => _145(currentBackHandler, currentScreen)]);
|
|
4447
4755
|
}, [currentBackHandler, currentScreen, onStepChangeRef]);
|
|
4448
4756
|
const stepSendToken = effectiveStep.type === "amount" ? effectiveStep.asset.symbol : null;
|
|
4449
4757
|
const stepOpenEventKey = effectiveStep.type === "select-asset" ? "select-asset" : effectiveStep.type === "deposit-address" ? "deposit-address" : effectiveStep.type === "amount" && stepSendToken ? `amount:${stepSendToken.toLowerCase()}` : null;
|
|
@@ -4458,23 +4766,23 @@ function DepositFlow({
|
|
|
4458
4766
|
}
|
|
4459
4767
|
lastStepOpenEventKeyRef.current = stepOpenEventKey;
|
|
4460
4768
|
if (effectiveStep.type === "select-asset") {
|
|
4461
|
-
_optionalChain([onEventRef, 'access',
|
|
4769
|
+
_optionalChain([onEventRef, 'access', _146 => _146.current, 'optionalCall', _147 => _147({
|
|
4462
4770
|
type: "deposit_modal_connected_wallet_select_source_open",
|
|
4463
4771
|
total_balance_in_external_wallet: totalBalanceUsd,
|
|
4464
4772
|
pred_balance: totalBalanceUsd
|
|
4465
4773
|
})]);
|
|
4466
4774
|
} else if (effectiveStep.type === "deposit-address") {
|
|
4467
|
-
const chainName =
|
|
4468
|
-
const tokenSymbol =
|
|
4469
|
-
_optionalChain([onEventRef, 'access',
|
|
4775
|
+
const chainName = _chunkMHKHSCIAcjs.getChainName.call(void 0, targetChain);
|
|
4776
|
+
const tokenSymbol = _chunkMHKHSCIAcjs.getTargetTokenSymbol.call(void 0, targetToken, targetChain);
|
|
4777
|
+
_optionalChain([onEventRef, 'access', _148 => _148.current, 'optionalCall', _149 => _149({
|
|
4470
4778
|
type: "deposit_modal_transfer_crypto_open",
|
|
4471
4779
|
default_chain: chainName,
|
|
4472
4780
|
default_token: tokenSymbol,
|
|
4473
4781
|
pred_balance: totalBalanceUsd
|
|
4474
4782
|
})]);
|
|
4475
4783
|
} else if (effectiveStep.type === "amount" && stepSendToken) {
|
|
4476
|
-
const receiveSymbol =
|
|
4477
|
-
_optionalChain([onEventRef, 'access',
|
|
4784
|
+
const receiveSymbol = _chunkMHKHSCIAcjs.getTargetTokenSymbol.call(void 0, targetToken, targetChain);
|
|
4785
|
+
_optionalChain([onEventRef, 'access', _150 => _150.current, 'optionalCall', _151 => _151({
|
|
4478
4786
|
type: "deposit_modal_connected_wallet_enter_value_open",
|
|
4479
4787
|
send_token: stepSendToken,
|
|
4480
4788
|
receive_token: receiveSymbol,
|
|
@@ -4507,7 +4815,7 @@ function DepositFlow({
|
|
|
4507
4815
|
targetToken
|
|
4508
4816
|
]);
|
|
4509
4817
|
_react.useEffect.call(void 0, () => {
|
|
4510
|
-
_optionalChain([onLifecycleRef, 'access',
|
|
4818
|
+
_optionalChain([onLifecycleRef, 'access', _152 => _152.current, 'optionalCall', _153 => _153({
|
|
4511
4819
|
type: "balance-changed",
|
|
4512
4820
|
totalUsd: totalBalanceUsd
|
|
4513
4821
|
})]);
|
|
@@ -4521,7 +4829,7 @@ function DepositFlow({
|
|
|
4521
4829
|
const handleConfirmWallet = _react.useCallback.call(void 0,
|
|
4522
4830
|
(walletId) => {
|
|
4523
4831
|
const selectedOption = walletOptions.find((o) => o.id === walletId);
|
|
4524
|
-
const mode = enableSolana && _optionalChain([selectedOption, 'optionalAccess',
|
|
4832
|
+
const mode = enableSolana && _optionalChain([selectedOption, 'optionalAccess', _154 => _154.kind]) === "solana" ? "solana-wallet" : "wallet";
|
|
4525
4833
|
storeApi.dispatch({
|
|
4526
4834
|
type: "connect/wallet-confirmed",
|
|
4527
4835
|
walletId,
|
|
@@ -4530,16 +4838,21 @@ function DepositFlow({
|
|
|
4530
4838
|
},
|
|
4531
4839
|
[walletOptions, enableSolana, storeApi]
|
|
4532
4840
|
);
|
|
4841
|
+
const isSolanaWalletConnected = Boolean(
|
|
4842
|
+
enableSolana && _optionalChain([reownWallet, 'optionalAccess', _155 => _155.isConnected]) && _optionalChain([reownWallet, 'optionalAccess', _156 => _156.isSolana])
|
|
4843
|
+
);
|
|
4844
|
+
const dappImportsKey = dappImports ? Object.keys(dappImports).filter((k) => dappImports[k]).sort().join(",") : "";
|
|
4533
4845
|
const enabledDappImportProviders = _react.useMemo.call(void 0,
|
|
4534
|
-
() => getEnabledProviders(dappImports),
|
|
4535
|
-
|
|
4846
|
+
() => isSolanaWalletConnected ? [] : getEnabledProviders(dappImports),
|
|
4847
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps -- intentional: keyed on dappImportsKey, not the dappImports object identity
|
|
4848
|
+
[dappImportsKey, isSolanaWalletConnected]
|
|
4536
4849
|
);
|
|
4537
4850
|
const handleSelectDappImport = _react.useCallback.call(void 0,
|
|
4538
4851
|
(providerId) => {
|
|
4539
4852
|
const owner = dappImportOwner;
|
|
4540
4853
|
if (owner) {
|
|
4541
4854
|
const wallet = walletOptions.find(
|
|
4542
|
-
(o) => _optionalChain([(_nullishCoalesce(o.address, () => ( null))), 'optionalAccess',
|
|
4855
|
+
(o) => _optionalChain([(_nullishCoalesce(o.address, () => ( null))), 'optionalAccess', _157 => _157.toLowerCase, 'call', _158 => _158()]) === owner.toLowerCase()
|
|
4543
4856
|
);
|
|
4544
4857
|
if (wallet) {
|
|
4545
4858
|
storeApi.dispatch({
|
|
@@ -4577,7 +4890,7 @@ function DepositFlow({
|
|
|
4577
4890
|
eoa: dappImportOwner,
|
|
4578
4891
|
getPublicClient: (chainId) => {
|
|
4579
4892
|
try {
|
|
4580
|
-
return
|
|
4893
|
+
return _chunkENMIKNXScjs.getPublicClient.call(void 0, chainId);
|
|
4581
4894
|
} catch (e28) {
|
|
4582
4895
|
return null;
|
|
4583
4896
|
}
|
|
@@ -4612,7 +4925,7 @@ function DepositFlow({
|
|
|
4612
4925
|
);
|
|
4613
4926
|
const connectStepDappImports = _react.useMemo.call(void 0,
|
|
4614
4927
|
() => enabledDappImportProviders.map((provider) => {
|
|
4615
|
-
const availabilityEntry = dappImportOwner && _optionalChain([dappImportAvailabilityOwner, 'optionalAccess',
|
|
4928
|
+
const availabilityEntry = dappImportOwner && _optionalChain([dappImportAvailabilityOwner, 'optionalAccess', _159 => _159.toLowerCase, 'call', _160 => _160()]) === dappImportOwner.toLowerCase() ? dappImportAvailability[provider.id] : void 0;
|
|
4616
4929
|
const dappImportSetup = readSetupForOwner(setupSlice, dappImportOwner);
|
|
4617
4930
|
const baseRow = {
|
|
4618
4931
|
id: provider.id,
|
|
@@ -4665,7 +4978,7 @@ function DepositFlow({
|
|
|
4665
4978
|
}, [activeDappImportProviderId, enabledDappImportProviders]);
|
|
4666
4979
|
const activeDappImportAvailability = _react.useMemo.call(void 0, () => {
|
|
4667
4980
|
if (!activeDappImportProviderId) return null;
|
|
4668
|
-
if (!dappImportOwner || _optionalChain([dappImportAvailabilityOwner, 'optionalAccess',
|
|
4981
|
+
if (!dappImportOwner || _optionalChain([dappImportAvailabilityOwner, 'optionalAccess', _161 => _161.toLowerCase, 'call', _162 => _162()]) !== dappImportOwner.toLowerCase()) {
|
|
4669
4982
|
return null;
|
|
4670
4983
|
}
|
|
4671
4984
|
const entry = dappImportAvailability[activeDappImportProviderId];
|
|
@@ -4678,7 +4991,7 @@ function DepositFlow({
|
|
|
4678
4991
|
dappImportOwner
|
|
4679
4992
|
]);
|
|
4680
4993
|
const handleNewDeposit = _react.useCallback.call(void 0, () => {
|
|
4681
|
-
_optionalChain([onLifecycleRef, 'access',
|
|
4994
|
+
_optionalChain([onLifecycleRef, 'access', _163 => _163.current, 'optionalCall', _164 => _164({
|
|
4682
4995
|
type: "smart-account-changed",
|
|
4683
4996
|
evm: null,
|
|
4684
4997
|
solana: null
|
|
@@ -4726,13 +5039,13 @@ function DepositFlow({
|
|
|
4726
5039
|
};
|
|
4727
5040
|
push(dappAddress);
|
|
4728
5041
|
push(connectedWalletAddress);
|
|
4729
|
-
push(_optionalChain([reownWallet, 'optionalAccess',
|
|
5042
|
+
push(_optionalChain([reownWallet, 'optionalAccess', _165 => _165.address]));
|
|
4730
5043
|
push(dappImportOwner);
|
|
4731
5044
|
return owners;
|
|
4732
5045
|
}, [
|
|
4733
5046
|
dappAddress,
|
|
4734
5047
|
connectedWalletAddress,
|
|
4735
|
-
_optionalChain([reownWallet, 'optionalAccess',
|
|
5048
|
+
_optionalChain([reownWallet, 'optionalAccess', _166 => _166.address]),
|
|
4736
5049
|
dappImportOwner
|
|
4737
5050
|
]);
|
|
4738
5051
|
_react.useEffect.call(void 0, () => {
|
|
@@ -4746,7 +5059,7 @@ function DepositFlow({
|
|
|
4746
5059
|
try {
|
|
4747
5060
|
sessionOwner = await resolveSessionOwner(owner);
|
|
4748
5061
|
} catch (error) {
|
|
4749
|
-
|
|
5062
|
+
_chunkENMIKNXScjs.debugError.call(void 0,
|
|
4750
5063
|
debug,
|
|
4751
5064
|
"deposit-flow",
|
|
4752
5065
|
"session-owner:resolve-failed",
|
|
@@ -4837,7 +5150,7 @@ function DepositFlow({
|
|
|
4837
5150
|
sourceChain: data.sourceChain,
|
|
4838
5151
|
amount: data.amount
|
|
4839
5152
|
});
|
|
4840
|
-
_optionalChain([onLifecycleRef, 'access',
|
|
5153
|
+
_optionalChain([onLifecycleRef, 'access', _167 => _167.current, 'optionalCall', _168 => _168({ type: "submitted", ...data })]);
|
|
4841
5154
|
},
|
|
4842
5155
|
[logFlow, onLifecycleRef]
|
|
4843
5156
|
);
|
|
@@ -4856,9 +5169,9 @@ function DepositFlow({
|
|
|
4856
5169
|
);
|
|
4857
5170
|
const handleSolanaAmountContinue = _react.useCallback.call(void 0,
|
|
4858
5171
|
(token, sourceAmount, inputAmountUsd) => {
|
|
4859
|
-
const targetSym =
|
|
4860
|
-
const isTargetStable =
|
|
4861
|
-
const targetTokenPriceUsd = isTargetStable ? 1 : getTokenPriceUsd(targetSym);
|
|
5172
|
+
const targetSym = _chunkMHKHSCIAcjs.getTargetTokenSymbol.call(void 0, targetToken, targetChain);
|
|
5173
|
+
const isTargetStable = _chunkMHKHSCIAcjs.isStablecoinSymbol.call(void 0, targetSym);
|
|
5174
|
+
const targetTokenPriceUsd = isTargetStable ? 1 : _nullishCoalesce(getTokenPriceUsd(targetSym), () => ( targetMarketPriceRef.current));
|
|
4862
5175
|
logFlow("solana:amount:continue", {
|
|
4863
5176
|
token: token.symbol,
|
|
4864
5177
|
sourceAmount,
|
|
@@ -4894,7 +5207,7 @@ function DepositFlow({
|
|
|
4894
5207
|
sourceSymbol: tokenAtSubmit.symbol,
|
|
4895
5208
|
sourceDecimals: tokenAtSubmit.decimals
|
|
4896
5209
|
});
|
|
4897
|
-
_optionalChain([onLifecycleRef, 'access',
|
|
5210
|
+
_optionalChain([onLifecycleRef, 'access', _169 => _169.current, 'optionalCall', _170 => _170({
|
|
4898
5211
|
type: "submitted",
|
|
4899
5212
|
txHash,
|
|
4900
5213
|
sourceChain: "solana",
|
|
@@ -4905,7 +5218,7 @@ function DepositFlow({
|
|
|
4905
5218
|
);
|
|
4906
5219
|
const handleAssetContinue = _react.useCallback.call(void 0,
|
|
4907
5220
|
(asset) => {
|
|
4908
|
-
_optionalChain([onEventRef, 'access',
|
|
5221
|
+
_optionalChain([onEventRef, 'access', _171 => _171.current, 'optionalCall', _172 => _172({
|
|
4909
5222
|
type: "deposit_modal_connected_wallet_select_source_cta_click",
|
|
4910
5223
|
total_balance_in_external_wallet: totalBalanceUsd,
|
|
4911
5224
|
pred_balance: totalBalanceUsd,
|
|
@@ -4928,9 +5241,9 @@ function DepositFlow({
|
|
|
4928
5241
|
activeOwner
|
|
4929
5242
|
);
|
|
4930
5243
|
if (entry.status !== "ready") return;
|
|
4931
|
-
const targetSym =
|
|
4932
|
-
const isTargetStable =
|
|
4933
|
-
const targetTokenPriceUsd = isTargetStable ? 1 : getTokenPriceUsd(targetSym);
|
|
5244
|
+
const targetSym = _chunkMHKHSCIAcjs.getTargetTokenSymbol.call(void 0, targetToken, targetChain);
|
|
5245
|
+
const isTargetStable = _chunkMHKHSCIAcjs.isStablecoinSymbol.call(void 0, targetSym);
|
|
5246
|
+
const targetTokenPriceUsd = isTargetStable ? 1 : _nullishCoalesce(getTokenPriceUsd(targetSym), () => ( targetMarketPriceRef.current));
|
|
4934
5247
|
storeApi.dispatch({
|
|
4935
5248
|
type: "amount/entered",
|
|
4936
5249
|
amount,
|
|
@@ -4958,8 +5271,8 @@ function DepositFlow({
|
|
|
4958
5271
|
sourceChain: chainId,
|
|
4959
5272
|
sourceToken: token,
|
|
4960
5273
|
amount,
|
|
4961
|
-
sourceSymbol: _optionalChain([dappImport, 'optionalAccess',
|
|
4962
|
-
sourceDecimals: _optionalChain([dappImport, 'optionalAccess',
|
|
5274
|
+
sourceSymbol: _optionalChain([dappImport, 'optionalAccess', _173 => _173.symbol]),
|
|
5275
|
+
sourceDecimals: _optionalChain([dappImport, 'optionalAccess', _174 => _174.decimals]),
|
|
4963
5276
|
directTransfer: !dappImport && isSameRoute2(chainId, token, targetChain, targetToken)
|
|
4964
5277
|
});
|
|
4965
5278
|
},
|
|
@@ -4967,7 +5280,7 @@ function DepositFlow({
|
|
|
4967
5280
|
);
|
|
4968
5281
|
const handleDepositSubmittedCallback = _react.useCallback.call(void 0,
|
|
4969
5282
|
(txHash, sourceChain, amount) => {
|
|
4970
|
-
_optionalChain([onLifecycleRef, 'access',
|
|
5283
|
+
_optionalChain([onLifecycleRef, 'access', _175 => _175.current, 'optionalCall', _176 => _176({
|
|
4971
5284
|
type: "submitted",
|
|
4972
5285
|
txHash,
|
|
4973
5286
|
sourceChain,
|
|
@@ -4979,7 +5292,7 @@ function DepositFlow({
|
|
|
4979
5292
|
const handleDepositComplete = _react.useCallback.call(void 0,
|
|
4980
5293
|
(txHash, destinationTxHash, context) => {
|
|
4981
5294
|
logFlow("deposit:complete", { txHash, destinationTxHash, ...context });
|
|
4982
|
-
_optionalChain([onLifecycleRef, 'access',
|
|
5295
|
+
_optionalChain([onLifecycleRef, 'access', _177 => _177.current, 'optionalCall', _178 => _178({
|
|
4983
5296
|
type: "complete",
|
|
4984
5297
|
txHash,
|
|
4985
5298
|
destinationTxHash,
|
|
@@ -4991,14 +5304,14 @@ function DepositFlow({
|
|
|
4991
5304
|
const handleDepositFailed = _react.useCallback.call(void 0,
|
|
4992
5305
|
(txHash, error) => {
|
|
4993
5306
|
logFlowError("deposit:failed", error, { txHash });
|
|
4994
|
-
_optionalChain([onLifecycleRef, 'access',
|
|
5307
|
+
_optionalChain([onLifecycleRef, 'access', _179 => _179.current, 'optionalCall', _180 => _180({ type: "failed", txHash, error })]);
|
|
4995
5308
|
},
|
|
4996
5309
|
[logFlowError, onLifecycleRef]
|
|
4997
5310
|
);
|
|
4998
5311
|
const handleError = _react.useCallback.call(void 0,
|
|
4999
5312
|
(message, code) => {
|
|
5000
5313
|
logFlowError("flow:error", message, { code });
|
|
5001
|
-
_optionalChain([onErrorRef, 'access',
|
|
5314
|
+
_optionalChain([onErrorRef, 'access', _181 => _181.current, 'optionalCall', _182 => _182({ message, code })]);
|
|
5002
5315
|
},
|
|
5003
5316
|
[logFlowError, onErrorRef]
|
|
5004
5317
|
);
|
|
@@ -5080,7 +5393,7 @@ function DepositFlow({
|
|
|
5080
5393
|
);
|
|
5081
5394
|
if (showConnectStep) {
|
|
5082
5395
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-modal-body", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
5083
|
-
|
|
5396
|
+
_chunkENMIKNXScjs.ConnectStep,
|
|
5084
5397
|
{
|
|
5085
5398
|
walletRows,
|
|
5086
5399
|
transferCryptoState: dappAddress ? transferCryptoState : void 0,
|
|
@@ -5139,20 +5452,21 @@ function DepositFlow({
|
|
|
5139
5452
|
{
|
|
5140
5453
|
smartAccount: effectiveStep.smartAccount,
|
|
5141
5454
|
solanaDepositAddress: enableSolana ? effectiveStep.solanaDepositAddress : void 0,
|
|
5455
|
+
isUpdating: activeEntry.status !== "ready",
|
|
5142
5456
|
service,
|
|
5143
5457
|
allowedRoutes,
|
|
5144
5458
|
targetChain,
|
|
5145
5459
|
targetToken,
|
|
5146
5460
|
waitForFinalTx,
|
|
5147
|
-
hasPostBridgeActions: Boolean(_optionalChain([postBridgeActions, 'optionalAccess',
|
|
5461
|
+
hasPostBridgeActions: Boolean(_optionalChain([postBridgeActions, 'optionalAccess', _183 => _183.length])),
|
|
5148
5462
|
uiConfig,
|
|
5149
5463
|
onDepositSubmitted: handleDepositAddressSubmitted,
|
|
5150
5464
|
onDepositComplete: handleDepositComplete,
|
|
5151
5465
|
onDepositFailed: handleDepositFailed,
|
|
5152
5466
|
onCopyAddress: () => {
|
|
5153
|
-
const chainName =
|
|
5154
|
-
const tokenSymbol =
|
|
5155
|
-
_optionalChain([onEvent, 'optionalCall',
|
|
5467
|
+
const chainName = _chunkMHKHSCIAcjs.getChainName.call(void 0, targetChain);
|
|
5468
|
+
const tokenSymbol = _chunkMHKHSCIAcjs.getTargetTokenSymbol.call(void 0, targetToken, targetChain);
|
|
5469
|
+
_optionalChain([onEvent, 'optionalCall', _184 => _184({
|
|
5156
5470
|
type: "deposit_modal_transfer_crypto_cta_click",
|
|
5157
5471
|
default_chain: chainName,
|
|
5158
5472
|
default_token: tokenSymbol,
|
|
@@ -5168,8 +5482,8 @@ function DepositFlow({
|
|
|
5168
5482
|
}
|
|
5169
5483
|
if (isSolanaWalletMode) {
|
|
5170
5484
|
if (!dappAddress) return null;
|
|
5171
|
-
const solanaAddr = _optionalChain([reownWallet, 'optionalAccess',
|
|
5172
|
-
const solanaProvider = _optionalChain([reownWallet, 'optionalAccess',
|
|
5485
|
+
const solanaAddr = _optionalChain([reownWallet, 'optionalAccess', _185 => _185.solanaAddress]);
|
|
5486
|
+
const solanaProvider = _optionalChain([reownWallet, 'optionalAccess', _186 => _186.solanaProvider]);
|
|
5173
5487
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-modal-body", children: [
|
|
5174
5488
|
effectiveStep.type === "setup" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
5175
5489
|
AccountPreparingSkeleton,
|
|
@@ -5185,6 +5499,10 @@ function DepositFlow({
|
|
|
5185
5499
|
service,
|
|
5186
5500
|
onContinue: handleSolanaTokenContinue,
|
|
5187
5501
|
onTotalBalanceComputed: handleTotalBalanceComputed,
|
|
5502
|
+
onDisconnect: onDisconnect ? () => {
|
|
5503
|
+
onDisconnect();
|
|
5504
|
+
handleBack();
|
|
5505
|
+
} : void 0,
|
|
5188
5506
|
debug
|
|
5189
5507
|
}
|
|
5190
5508
|
),
|
|
@@ -5196,12 +5514,12 @@ function DepositFlow({
|
|
|
5196
5514
|
balanceUsd: effectiveStep.balanceUsd,
|
|
5197
5515
|
defaultAmount: effectiveStep.inputAmountUsd,
|
|
5198
5516
|
uiConfig,
|
|
5199
|
-
targetChainName:
|
|
5200
|
-
targetTokenSymbol:
|
|
5201
|
-
targetTokenIcon:
|
|
5202
|
-
|
|
5517
|
+
targetChainName: _chunkMHKHSCIAcjs.getChainName.call(void 0, targetChain),
|
|
5518
|
+
targetTokenSymbol: _chunkMHKHSCIAcjs.getTargetTokenSymbol.call(void 0, targetToken, targetChain),
|
|
5519
|
+
targetTokenIcon: _chunkMHKHSCIAcjs.getTokenIcon.call(void 0,
|
|
5520
|
+
_chunkMHKHSCIAcjs.getTargetTokenSymbol.call(void 0, targetToken, targetChain)
|
|
5203
5521
|
),
|
|
5204
|
-
|
|
5522
|
+
appBalanceUsd,
|
|
5205
5523
|
onContinue: handleSolanaAmountContinue,
|
|
5206
5524
|
debug
|
|
5207
5525
|
}
|
|
@@ -5221,6 +5539,8 @@ function DepositFlow({
|
|
|
5221
5539
|
targetToken,
|
|
5222
5540
|
service,
|
|
5223
5541
|
solanaProvider,
|
|
5542
|
+
solanaConnection: _optionalChain([reownWallet, 'optionalAccess', _187 => _187.solanaConnection]),
|
|
5543
|
+
uiConfig,
|
|
5224
5544
|
onConfirm: handleSolanaConfirmed,
|
|
5225
5545
|
onError: handleError,
|
|
5226
5546
|
debug
|
|
@@ -5260,7 +5580,7 @@ function DepositFlow({
|
|
|
5260
5580
|
) })
|
|
5261
5581
|
] }) : null,
|
|
5262
5582
|
effectiveStep.type === "processing" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
5263
|
-
|
|
5583
|
+
_chunkENMIKNXScjs.ProcessingStep,
|
|
5264
5584
|
{
|
|
5265
5585
|
smartAccount: effectiveStep.smartAccount,
|
|
5266
5586
|
solanaDepositAddress: effectiveStep.solanaDepositAddress,
|
|
@@ -5273,7 +5593,7 @@ function DepositFlow({
|
|
|
5273
5593
|
sourceSymbol: effectiveStep.sourceSymbol,
|
|
5274
5594
|
sourceDecimals: effectiveStep.sourceDecimals,
|
|
5275
5595
|
waitForFinalTx,
|
|
5276
|
-
hasPostBridgeActions: Boolean(_optionalChain([postBridgeActions, 'optionalAccess',
|
|
5596
|
+
hasPostBridgeActions: Boolean(_optionalChain([postBridgeActions, 'optionalAccess', _188 => _188.length])),
|
|
5277
5597
|
service,
|
|
5278
5598
|
directTransfer: effectiveStep.directTransfer,
|
|
5279
5599
|
onClose,
|
|
@@ -5286,16 +5606,16 @@ function DepositFlow({
|
|
|
5286
5606
|
)
|
|
5287
5607
|
] });
|
|
5288
5608
|
}
|
|
5289
|
-
if (!_optionalChain([signerContext, 'optionalAccess',
|
|
5609
|
+
if (!_optionalChain([signerContext, 'optionalAccess', _189 => _189.walletClient]) || !_optionalChain([signerContext, 'optionalAccess', _190 => _190.publicClient])) {
|
|
5290
5610
|
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..." }) }) }) }) });
|
|
5291
5611
|
}
|
|
5292
5612
|
const ownerAddress = signerContext.ownerAddress;
|
|
5293
|
-
const ownerChainId = _nullishCoalesce(_nullishCoalesce(_optionalChain([signerContext, 'access',
|
|
5613
|
+
const ownerChainId = _nullishCoalesce(_nullishCoalesce(_optionalChain([signerContext, 'access', _191 => _191.walletClient, 'optionalAccess', _192 => _192.chain, 'optionalAccess', _193 => _193.id]), () => ( _optionalChain([signerContext, 'access', _194 => _194.publicClient, 'access', _195 => _195.chain, 'optionalAccess', _196 => _196.id]))), () => ( setupChainId));
|
|
5294
5614
|
const getReadClientForChain = (chainId) => {
|
|
5295
|
-
if (_optionalChain([signerContext, 'access',
|
|
5615
|
+
if (_optionalChain([signerContext, 'access', _197 => _197.publicClient, 'access', _198 => _198.chain, 'optionalAccess', _199 => _199.id]) === chainId) {
|
|
5296
5616
|
return signerContext.publicClient;
|
|
5297
5617
|
}
|
|
5298
|
-
return
|
|
5618
|
+
return _chunkENMIKNXScjs.getPublicClient.call(void 0, chainId);
|
|
5299
5619
|
};
|
|
5300
5620
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-modal-body", children: [
|
|
5301
5621
|
effectiveStep.type === "setup" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
@@ -5326,7 +5646,7 @@ function DepositFlow({
|
|
|
5326
5646
|
effectiveStep.type === "dapp-import-asset-select" && activeDappImportProvider && activeDappImportAvailability && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
5327
5647
|
DappImportAssetSelectStep,
|
|
5328
5648
|
{
|
|
5329
|
-
sourceLabel: _nullishCoalesce(_optionalChain([activeDappImportAvailability, 'access',
|
|
5649
|
+
sourceLabel: _nullishCoalesce(_optionalChain([activeDappImportAvailability, 'access', _200 => _200.assets, 'access', _201 => _201[0], 'optionalAccess', _202 => _202.sourceLabel]), () => ( activeDappImportProvider.label)),
|
|
5330
5650
|
assets: activeDappImportAvailability.assets,
|
|
5331
5651
|
onSelect: handleDappImportAssetSelected
|
|
5332
5652
|
}
|
|
@@ -5348,12 +5668,12 @@ function DepositFlow({
|
|
|
5348
5668
|
targetChain,
|
|
5349
5669
|
targetToken,
|
|
5350
5670
|
uiConfig,
|
|
5351
|
-
|
|
5671
|
+
appBalanceUsd,
|
|
5352
5672
|
service,
|
|
5353
5673
|
onContinue: handleAmountContinue,
|
|
5354
5674
|
onCtaClick: (ctaName) => {
|
|
5355
|
-
const receiveSymbol =
|
|
5356
|
-
_optionalChain([onEvent, 'optionalCall',
|
|
5675
|
+
const receiveSymbol = _chunkMHKHSCIAcjs.getTargetTokenSymbol.call(void 0, targetToken, targetChain);
|
|
5676
|
+
_optionalChain([onEvent, 'optionalCall', _203 => _203({
|
|
5357
5677
|
type: "deposit_modal_connected_wallet_enter_value_cta_click",
|
|
5358
5678
|
send_token: effectiveStep.asset.symbol,
|
|
5359
5679
|
receive_token: receiveSymbol,
|
|
@@ -5389,7 +5709,8 @@ function DepositFlow({
|
|
|
5389
5709
|
),
|
|
5390
5710
|
recipient: effectiveStep.smartAccount,
|
|
5391
5711
|
asset: effectiveStep.asset,
|
|
5392
|
-
amount: amountUnits
|
|
5712
|
+
amount: amountUnits,
|
|
5713
|
+
backend: service
|
|
5393
5714
|
}
|
|
5394
5715
|
);
|
|
5395
5716
|
return {
|
|
@@ -5403,7 +5724,7 @@ function DepositFlow({
|
|
|
5403
5724
|
}
|
|
5404
5725
|
),
|
|
5405
5726
|
effectiveStep.type === "processing" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
5406
|
-
|
|
5727
|
+
_chunkENMIKNXScjs.ProcessingStep,
|
|
5407
5728
|
{
|
|
5408
5729
|
smartAccount: effectiveStep.smartAccount,
|
|
5409
5730
|
solanaDepositAddress: effectiveStep.solanaDepositAddress,
|
|
@@ -5416,7 +5737,7 @@ function DepositFlow({
|
|
|
5416
5737
|
sourceSymbol: effectiveStep.sourceSymbol,
|
|
5417
5738
|
sourceDecimals: effectiveStep.sourceDecimals,
|
|
5418
5739
|
waitForFinalTx,
|
|
5419
|
-
hasPostBridgeActions: Boolean(_optionalChain([postBridgeActions, 'optionalAccess',
|
|
5740
|
+
hasPostBridgeActions: Boolean(_optionalChain([postBridgeActions, 'optionalAccess', _204 => _204.length])),
|
|
5420
5741
|
service,
|
|
5421
5742
|
directTransfer: effectiveStep.directTransfer,
|
|
5422
5743
|
uiConfig,
|
|
@@ -5455,8 +5776,8 @@ function formatDate(iso) {
|
|
|
5455
5776
|
function resolveChainId(value) {
|
|
5456
5777
|
if (value === void 0 || value === null) return null;
|
|
5457
5778
|
if (typeof value === "number") return value;
|
|
5458
|
-
if (
|
|
5459
|
-
const parsed =
|
|
5779
|
+
if (_chunkENMIKNXScjs.isSolanaCaip2.call(void 0, value) || value === "solana") return "solana";
|
|
5780
|
+
const parsed = _chunkENMIKNXScjs.parseEvmChainId.call(void 0, value);
|
|
5460
5781
|
if (parsed !== null) return parsed;
|
|
5461
5782
|
const num = Number(value);
|
|
5462
5783
|
return Number.isFinite(num) ? num : null;
|
|
@@ -5465,7 +5786,7 @@ function resolveTokenSymbol(token, chainId) {
|
|
|
5465
5786
|
if (!token) return "";
|
|
5466
5787
|
if (chainId === "solana") {
|
|
5467
5788
|
const normalized = token.toLowerCase();
|
|
5468
|
-
const matched = SOLANA_TOKENS.find(
|
|
5789
|
+
const matched = _chunkMHKHSCIAcjs.SOLANA_TOKENS.find(
|
|
5469
5790
|
(entry) => entry.mint.toLowerCase() === normalized
|
|
5470
5791
|
);
|
|
5471
5792
|
if (matched) return matched.symbol;
|
|
@@ -5474,7 +5795,7 @@ function resolveTokenSymbol(token, chainId) {
|
|
|
5474
5795
|
}
|
|
5475
5796
|
}
|
|
5476
5797
|
if (chainId !== null && chainId !== void 0 && chainId !== "solana" && /^0x[a-fA-F0-9]{40}$/.test(token)) {
|
|
5477
|
-
const sym =
|
|
5798
|
+
const sym = _chunkMHKHSCIAcjs.getTokenSymbol.call(void 0, token, chainId);
|
|
5478
5799
|
if (sym !== "Token") return sym;
|
|
5479
5800
|
}
|
|
5480
5801
|
return shortenHash(token);
|
|
@@ -5485,7 +5806,7 @@ function formatAmount(rawAmount, token, chainId) {
|
|
|
5485
5806
|
if (token && chainId !== null && chainId !== void 0) {
|
|
5486
5807
|
if (chainId === "solana") {
|
|
5487
5808
|
const normalized = token.toLowerCase();
|
|
5488
|
-
const matched = SOLANA_TOKENS.find(
|
|
5809
|
+
const matched = _chunkMHKHSCIAcjs.SOLANA_TOKENS.find(
|
|
5489
5810
|
(entry) => entry.mint.toLowerCase() === normalized
|
|
5490
5811
|
);
|
|
5491
5812
|
if (matched) {
|
|
@@ -5494,7 +5815,7 @@ function formatAmount(rawAmount, token, chainId) {
|
|
|
5494
5815
|
decimals = 9;
|
|
5495
5816
|
}
|
|
5496
5817
|
} else if (/^0x[a-fA-F0-9]{40}$/.test(token)) {
|
|
5497
|
-
decimals =
|
|
5818
|
+
decimals = _chunkMHKHSCIAcjs.getTokenDecimalsByAddress.call(void 0, token, chainId);
|
|
5498
5819
|
}
|
|
5499
5820
|
}
|
|
5500
5821
|
try {
|
|
@@ -5502,20 +5823,19 @@ function formatAmount(rawAmount, token, chainId) {
|
|
|
5502
5823
|
const divisor = 10n ** BigInt(decimals);
|
|
5503
5824
|
const whole = raw / divisor;
|
|
5504
5825
|
const remainder = raw % divisor;
|
|
5505
|
-
if (remainder === 0n) return whole.toString();
|
|
5506
5826
|
const fracStr = remainder.toString().padStart(decimals, "0");
|
|
5507
|
-
|
|
5508
|
-
if (
|
|
5509
|
-
return `${whole}.${
|
|
5827
|
+
let frac = fracStr.slice(0, 5).replace(/0+$/, "");
|
|
5828
|
+
if (frac.length < 2) frac = frac.padEnd(2, "0");
|
|
5829
|
+
return `${whole}.${frac}`;
|
|
5510
5830
|
} catch (e30) {
|
|
5511
5831
|
return rawAmount;
|
|
5512
5832
|
}
|
|
5513
5833
|
}
|
|
5514
5834
|
function getTxExplorerUrl(txHash, chainId) {
|
|
5515
5835
|
if (!chainId) return null;
|
|
5516
|
-
const
|
|
5517
|
-
if (!
|
|
5518
|
-
return `${
|
|
5836
|
+
const base2 = _chunkMHKHSCIAcjs.getExplorerUrl.call(void 0, chainId);
|
|
5837
|
+
if (!base2) return null;
|
|
5838
|
+
return `${base2}/tx/${txHash}`;
|
|
5519
5839
|
}
|
|
5520
5840
|
function normalizeStatus(raw, isSpam) {
|
|
5521
5841
|
const lower = raw.toLowerCase();
|
|
@@ -5554,6 +5874,14 @@ function DepositHistoryPanel({
|
|
|
5554
5874
|
},
|
|
5555
5875
|
[onClose]
|
|
5556
5876
|
);
|
|
5877
|
+
const visibleDeposits = _react.useMemo.call(void 0, () => {
|
|
5878
|
+
const sourceHashes = new Set(
|
|
5879
|
+
deposits.map((d) => _optionalChain([d, 'access', _205 => _205.sourceTxHash, 'optionalAccess', _206 => _206.toLowerCase, 'call', _207 => _207()])).filter((h) => Boolean(h))
|
|
5880
|
+
);
|
|
5881
|
+
return deposits.filter(
|
|
5882
|
+
(d) => !(d.txHash && sourceHashes.has(d.txHash.toLowerCase()))
|
|
5883
|
+
);
|
|
5884
|
+
}, [deposits]);
|
|
5557
5885
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
5558
5886
|
"div",
|
|
5559
5887
|
{
|
|
@@ -5570,10 +5898,9 @@ function DepositHistoryPanel({
|
|
|
5570
5898
|
className: "rs-modal-header-back",
|
|
5571
5899
|
"aria-label": "Back",
|
|
5572
5900
|
onClick: onClose,
|
|
5573
|
-
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
5901
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkENMIKNXScjs.ChevronLeftIcon, {})
|
|
5574
5902
|
}
|
|
5575
5903
|
) }),
|
|
5576
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-modal-header-nav-center" }),
|
|
5577
5904
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-modal-header-nav-right", children: onCloseModal && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
5578
5905
|
"button",
|
|
5579
5906
|
{
|
|
@@ -5581,36 +5908,36 @@ function DepositHistoryPanel({
|
|
|
5581
5908
|
className: "rs-modal-close",
|
|
5582
5909
|
"aria-label": "Close",
|
|
5583
5910
|
onClick: onCloseModal,
|
|
5584
|
-
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
5911
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkENMIKNXScjs.CloseIcon, {})
|
|
5585
5912
|
}
|
|
5586
5913
|
) })
|
|
5587
5914
|
] }),
|
|
5588
5915
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-history-screen", children: [
|
|
5589
5916
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-history-screen-body", children: [
|
|
5590
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
5917
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkENMIKNXScjs.BodyHeader, { icon: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkENMIKNXScjs.HistoryIcon, {}), title: "History" }),
|
|
5591
5918
|
isLoading && deposits.length === 0 && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-history-empty", children: [
|
|
5592
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-history-empty-glyph", "aria-hidden": "true", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
5919
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-history-empty-glyph", "aria-hidden": "true", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkENMIKNXScjs.HistoryIcon, {}) }),
|
|
5593
5920
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-history-empty-text", children: [
|
|
5594
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
5921
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkENMIKNXScjs.Spinner, { className: "rs-spinner--sm" }),
|
|
5595
5922
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-history-empty-hint", children: "Loading history\u2026" })
|
|
5596
5923
|
] })
|
|
5597
5924
|
] }),
|
|
5598
5925
|
error && !isLoading && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-history-empty", children: [
|
|
5599
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-history-empty-glyph", "aria-hidden": "true", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
5926
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-history-empty-glyph", "aria-hidden": "true", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkENMIKNXScjs.AlertTriangleIcon, {}) }),
|
|
5600
5927
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-history-empty-text", children: [
|
|
5601
5928
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-history-empty-title", children: "Couldn't load history" }),
|
|
5602
5929
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-history-empty-hint", children: error })
|
|
5603
5930
|
] })
|
|
5604
5931
|
] }),
|
|
5605
|
-
!isLoading && !error &&
|
|
5606
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-history-empty-glyph", "aria-hidden": "true", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
5932
|
+
!isLoading && !error && visibleDeposits.length === 0 && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-history-empty", children: [
|
|
5933
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-history-empty-glyph", "aria-hidden": "true", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkENMIKNXScjs.HistoryIcon, {}) }),
|
|
5607
5934
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-history-empty-text", children: [
|
|
5608
5935
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-history-empty-title", children: "No deposits yet" }),
|
|
5609
5936
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-history-empty-hint", children: "Your deposit history will appear here" })
|
|
5610
5937
|
] })
|
|
5611
5938
|
] }),
|
|
5612
|
-
|
|
5613
|
-
|
|
5939
|
+
visibleDeposits.length > 0 && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-history-list", children: [
|
|
5940
|
+
visibleDeposits.map((deposit, i) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, HistoryCard, { deposit }, deposit.txHash || i)),
|
|
5614
5941
|
hasMore && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
5615
5942
|
"button",
|
|
5616
5943
|
{
|
|
@@ -5623,7 +5950,7 @@ function DepositHistoryPanel({
|
|
|
5623
5950
|
)
|
|
5624
5951
|
] })
|
|
5625
5952
|
] }),
|
|
5626
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
5953
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkENMIKNXScjs.PoweredBy, {})
|
|
5627
5954
|
] })
|
|
5628
5955
|
]
|
|
5629
5956
|
}
|
|
@@ -5634,15 +5961,16 @@ function HistoryCard({ deposit }) {
|
|
|
5634
5961
|
const status = normalizeStatus(deposit.status, deposit.isSpam);
|
|
5635
5962
|
const sourceChainId = resolveChainId(deposit.chain);
|
|
5636
5963
|
const targetChainId = resolveChainId(deposit.targetChain);
|
|
5637
|
-
const sourceChainName = sourceChainId ?
|
|
5638
|
-
const targetChainName = targetChainId ?
|
|
5639
|
-
const sourceChainIcon = sourceChainId ?
|
|
5640
|
-
const targetChainIcon = targetChainId ?
|
|
5964
|
+
const sourceChainName = sourceChainId ? _chunkMHKHSCIAcjs.getChainName.call(void 0, sourceChainId) : null;
|
|
5965
|
+
const targetChainName = targetChainId ? _chunkMHKHSCIAcjs.getChainName.call(void 0, targetChainId) : null;
|
|
5966
|
+
const sourceChainIcon = sourceChainId ? _chunkMHKHSCIAcjs.getChainIcon.call(void 0, sourceChainId) : void 0;
|
|
5967
|
+
const targetChainIcon = targetChainId ? _chunkMHKHSCIAcjs.getChainIcon.call(void 0, targetChainId) : void 0;
|
|
5641
5968
|
const sourceSymbol = resolveTokenSymbol(deposit.token, sourceChainId);
|
|
5642
|
-
const sourceTokenIcon = sourceSymbol ?
|
|
5643
|
-
const rawAmount =
|
|
5969
|
+
const sourceTokenIcon = sourceSymbol ? _chunkMHKHSCIAcjs.getTokenIcon.call(void 0, sourceSymbol) : void 0;
|
|
5970
|
+
const rawAmount = deposit.sourceAmount && deposit.sourceAmount !== "0" ? deposit.sourceAmount : deposit.amount;
|
|
5644
5971
|
const formattedAmount = rawAmount ? formatAmount(rawAmount, deposit.token, sourceChainId) : null;
|
|
5645
5972
|
const displayAmount = formattedAmount ? sourceSymbol && /^USD/.test(sourceSymbol) ? `$${Number(formattedAmount).toLocaleString("en-US", {
|
|
5973
|
+
minimumFractionDigits: 2,
|
|
5646
5974
|
maximumFractionDigits: 2
|
|
5647
5975
|
})}` : `${formattedAmount} ${sourceSymbol}` : "\u2014";
|
|
5648
5976
|
const date = deposit.createdAt ? formatDate(deposit.createdAt) : null;
|
|
@@ -5697,7 +6025,7 @@ function HistoryCard({ deposit }) {
|
|
|
5697
6025
|
onClick: (e) => e.stopPropagation(),
|
|
5698
6026
|
children: [
|
|
5699
6027
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: shortenHash(deposit.sourceTxHash) }),
|
|
5700
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
6028
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkENMIKNXScjs.ArrowUpRightIcon, {})
|
|
5701
6029
|
]
|
|
5702
6030
|
}
|
|
5703
6031
|
)
|
|
@@ -5712,7 +6040,7 @@ DepositHistoryPanel.displayName = "DepositHistoryPanel";
|
|
|
5712
6040
|
// src/DepositModal.tsx
|
|
5713
6041
|
|
|
5714
6042
|
var ReownDepositInner = _react.lazy.call(void 0,
|
|
5715
|
-
() => Promise.resolve().then(() => _interopRequireWildcard(require("./DepositModalReown-
|
|
6043
|
+
() => Promise.resolve().then(() => _interopRequireWildcard(require("./DepositModalReown-ABLVMYFL.cjs"))).then((m) => ({ default: m.DepositModalReown }))
|
|
5716
6044
|
);
|
|
5717
6045
|
function sortByCreatedAtDesc(items) {
|
|
5718
6046
|
return [...items].sort((a, b) => {
|
|
@@ -5760,9 +6088,10 @@ function DepositModalInner({
|
|
|
5760
6088
|
sourceToken,
|
|
5761
6089
|
defaultAmount,
|
|
5762
6090
|
recipient,
|
|
5763
|
-
|
|
6091
|
+
appBalanceUsd,
|
|
6092
|
+
backendUrl = _chunkMHKHSCIAcjs.DEFAULT_BACKEND_URL,
|
|
5764
6093
|
solanaRpcUrl,
|
|
5765
|
-
signerAddress =
|
|
6094
|
+
signerAddress = _chunkMHKHSCIAcjs.DEFAULT_SIGNER_ADDRESS,
|
|
5766
6095
|
sessionChainIds,
|
|
5767
6096
|
forceRegister = false,
|
|
5768
6097
|
waitForFinalTx = true,
|
|
@@ -5786,12 +6115,12 @@ function DepositModalInner({
|
|
|
5786
6115
|
debug
|
|
5787
6116
|
}) {
|
|
5788
6117
|
const modalRef = _react.useRef.call(void 0, null);
|
|
5789
|
-
const onReadyRef =
|
|
6118
|
+
const onReadyRef = _chunkENMIKNXScjs.useLatestRef.call(void 0, onReady);
|
|
5790
6119
|
const [currentScreen, setCurrentScreen] = _react.useState.call(void 0, "connect");
|
|
5791
6120
|
const [backHandler, setBackHandler] = _react.useState.call(void 0,
|
|
5792
6121
|
void 0
|
|
5793
6122
|
);
|
|
5794
|
-
const showHistoryButton = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess',
|
|
6123
|
+
const showHistoryButton = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess', _208 => _208.showHistoryButton]), () => ( false));
|
|
5795
6124
|
const historyButtonVisible = showHistoryButton && (currentScreen === "select-asset" || currentScreen === "deposit-address");
|
|
5796
6125
|
const [historyOpen, setHistoryOpen] = _react.useState.call(void 0, false);
|
|
5797
6126
|
const [historyDeposits, setHistoryDeposits] = _react.useState.call(void 0, []);
|
|
@@ -5802,10 +6131,10 @@ function DepositModalInner({
|
|
|
5802
6131
|
const cursorRef = _react.useRef.call(void 0, null);
|
|
5803
6132
|
const historyStaleRef = _react.useRef.call(void 0, false);
|
|
5804
6133
|
const historyLoadedRef = _react.useRef.call(void 0, false);
|
|
5805
|
-
const targetChain =
|
|
5806
|
-
const sourceChain = sourceChainProp ?
|
|
6134
|
+
const targetChain = targetChainProp === "solana" ? "solana" : _chunkMHKHSCIAcjs.getChainId.call(void 0, targetChainProp);
|
|
6135
|
+
const sourceChain = sourceChainProp ? _chunkMHKHSCIAcjs.getChainId.call(void 0, sourceChainProp) : void 0;
|
|
5807
6136
|
const service = _react.useMemo.call(void 0,
|
|
5808
|
-
() =>
|
|
6137
|
+
() => _chunkENMIKNXScjs.createDepositService.call(void 0, backendUrl, {
|
|
5809
6138
|
debug,
|
|
5810
6139
|
debugScope: "service:deposit"
|
|
5811
6140
|
}),
|
|
@@ -5821,7 +6150,7 @@ function DepositModalInner({
|
|
|
5821
6150
|
}, [store, targetChain, targetToken]);
|
|
5822
6151
|
_react.useEffect.call(void 0, () => {
|
|
5823
6152
|
if (isOpen && modalRef.current) {
|
|
5824
|
-
|
|
6153
|
+
_chunkENMIKNXScjs.applyTheme.call(void 0, modalRef.current, theme);
|
|
5825
6154
|
}
|
|
5826
6155
|
}, [isOpen, theme]);
|
|
5827
6156
|
_react.useEffect.call(void 0, () => {
|
|
@@ -5829,7 +6158,7 @@ function DepositModalInner({
|
|
|
5829
6158
|
}, [solanaRpcUrl]);
|
|
5830
6159
|
_react.useEffect.call(void 0, () => {
|
|
5831
6160
|
if (isOpen) {
|
|
5832
|
-
_optionalChain([onReadyRef, 'access',
|
|
6161
|
+
_optionalChain([onReadyRef, 'access', _209 => _209.current, 'optionalCall', _210 => _210()]);
|
|
5833
6162
|
}
|
|
5834
6163
|
}, [isOpen, onReadyRef]);
|
|
5835
6164
|
const handleStepChange = _react.useCallback.call(void 0,
|
|
@@ -5905,10 +6234,10 @@ function DepositModalInner({
|
|
|
5905
6234
|
fetchHistory("initial");
|
|
5906
6235
|
}
|
|
5907
6236
|
}, [historyOpen, fetchHistory]);
|
|
5908
|
-
const onLifecycleRef =
|
|
6237
|
+
const onLifecycleRef = _chunkENMIKNXScjs.useLatestRef.call(void 0, onLifecycle);
|
|
5909
6238
|
const handleLifecycle = _react.useCallback.call(void 0,
|
|
5910
6239
|
(event) => {
|
|
5911
|
-
_optionalChain([onLifecycleRef, 'access',
|
|
6240
|
+
_optionalChain([onLifecycleRef, 'access', _211 => _211.current, 'optionalCall', _212 => _212(event)]);
|
|
5912
6241
|
if (event.type === "smart-account-changed" && !event.evm && !event.solana) {
|
|
5913
6242
|
historyStaleRef.current = true;
|
|
5914
6243
|
}
|
|
@@ -5934,10 +6263,10 @@ function DepositModalInner({
|
|
|
5934
6263
|
store.dispatch({ type: "flow/reset" });
|
|
5935
6264
|
}
|
|
5936
6265
|
}, [isOpen, store]);
|
|
5937
|
-
const showBackButton = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess',
|
|
6266
|
+
const showBackButton = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess', _213 => _213.showBackButton]), () => ( true));
|
|
5938
6267
|
const canGoBack = backHandler !== void 0;
|
|
5939
6268
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, DepositStoreProvider, { store, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
5940
|
-
|
|
6269
|
+
_chunkENMIKNXScjs.Modal,
|
|
5941
6270
|
{
|
|
5942
6271
|
isOpen,
|
|
5943
6272
|
onClose,
|
|
@@ -5953,7 +6282,7 @@ function DepositModalInner({
|
|
|
5953
6282
|
className: "rs-modal-header-back",
|
|
5954
6283
|
"aria-label": "Go back",
|
|
5955
6284
|
onClick: backHandler,
|
|
5956
|
-
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
6285
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkENMIKNXScjs.ChevronLeftIcon, {})
|
|
5957
6286
|
}
|
|
5958
6287
|
) }),
|
|
5959
6288
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-modal-header-nav-right", children: [
|
|
@@ -5965,7 +6294,7 @@ function DepositModalInner({
|
|
|
5965
6294
|
"aria-label": "Deposit history",
|
|
5966
6295
|
onClick: handleHistoryOpen,
|
|
5967
6296
|
disabled: !recipient,
|
|
5968
|
-
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
6297
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkENMIKNXScjs.HistoryIcon, {})
|
|
5969
6298
|
}
|
|
5970
6299
|
),
|
|
5971
6300
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
@@ -5975,7 +6304,7 @@ function DepositModalInner({
|
|
|
5975
6304
|
onClick: onClose,
|
|
5976
6305
|
className: "rs-modal-close",
|
|
5977
6306
|
"aria-label": "Close",
|
|
5978
|
-
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
6307
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkENMIKNXScjs.CloseIcon, {})
|
|
5979
6308
|
}
|
|
5980
6309
|
)
|
|
5981
6310
|
] })
|
|
@@ -5994,6 +6323,7 @@ function DepositModalInner({
|
|
|
5994
6323
|
sourceToken,
|
|
5995
6324
|
amount: defaultAmount,
|
|
5996
6325
|
recipient,
|
|
6326
|
+
appBalanceUsd,
|
|
5997
6327
|
postBridgeActions,
|
|
5998
6328
|
outputTokenRules,
|
|
5999
6329
|
rejectUnmapped,
|