@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.
Files changed (36) hide show
  1. package/dist/{DepositModalReown-3VZ5AKV2.mjs → DepositModalReown-42D5V5II.mjs} +8 -5
  2. package/dist/{DepositModalReown-PPX34UAK.cjs → DepositModalReown-ABLVMYFL.cjs} +9 -6
  3. package/dist/{WithdrawModalReown-BB3MZAIO.mjs → WithdrawModalReown-EVHN5NOF.mjs} +3 -3
  4. package/dist/{WithdrawModalReown-4B6IMTBB.cjs → WithdrawModalReown-FJP3XTQ5.cjs} +4 -4
  5. package/dist/{chunk-QI6Q7V6O.mjs → chunk-3FHYC3K7.mjs} +26 -34
  6. package/dist/{chunk-ZUWAIMMH.mjs → chunk-44IFH7DZ.mjs} +1247 -917
  7. package/dist/{chunk-CTYKQ4B4.mjs → chunk-7VKAUBZ7.mjs} +201 -81
  8. package/dist/{chunk-BB6UVRAV.cjs → chunk-CPXERFGC.cjs} +110 -118
  9. package/dist/{chunk-DX2D2TRZ.cjs → chunk-ENMIKNXS.cjs} +241 -121
  10. package/dist/{chunk-TTD2FEA2.cjs → chunk-LEVCOJD6.cjs} +1193 -863
  11. package/dist/chunk-MHKHSCIA.cjs +554 -0
  12. package/dist/chunk-UCZXBHLH.mjs +554 -0
  13. package/dist/constants-DqVn968d.d.cts +52 -0
  14. package/dist/constants-DqVn968d.d.ts +52 -0
  15. package/dist/constants.cjs +8 -2
  16. package/dist/constants.d.cts +17 -48
  17. package/dist/constants.d.ts +17 -48
  18. package/dist/constants.mjs +7 -1
  19. package/dist/deposit.cjs +4 -4
  20. package/dist/deposit.d.cts +2 -2
  21. package/dist/deposit.d.ts +2 -2
  22. package/dist/deposit.mjs +3 -3
  23. package/dist/index.cjs +5 -5
  24. package/dist/index.d.cts +2 -2
  25. package/dist/index.d.ts +2 -2
  26. package/dist/index.mjs +4 -4
  27. package/dist/styles.css +185 -37
  28. package/dist/{types-xSHZSlrT.d.cts → types-D8Q4TMk7.d.cts} +17 -5
  29. package/dist/{types-xSHZSlrT.d.ts → types-D8Q4TMk7.d.ts} +17 -5
  30. package/dist/withdraw.cjs +4 -4
  31. package/dist/withdraw.d.cts +2 -2
  32. package/dist/withdraw.d.ts +2 -2
  33. package/dist/withdraw.mjs +3 -3
  34. package/package.json +1 -1
  35. package/dist/chunk-IVTXEYB2.cjs +0 -507
  36. package/dist/chunk-VA3ANS7D.mjs +0 -507
@@ -3,19 +3,17 @@ import {
3
3
  ArrowUpRightIcon,
4
4
  BodyHeader,
5
5
  Button,
6
+ Callout,
6
7
  CheckIcon,
7
8
  ChevronDownIcon,
8
9
  ChevronLeftIcon,
9
10
  ClockIcon,
10
11
  CloseIcon,
11
- CoinsIcon,
12
12
  ConnectStep,
13
13
  CopyIcon,
14
14
  ExternalLinkIcon,
15
- HandCoinsIcon,
16
15
  HistoryIcon,
17
16
  InfoIcon,
18
- ListRow,
19
17
  Modal,
20
18
  PercentIcon,
21
19
  PlusCircleIcon,
@@ -24,6 +22,7 @@ import {
24
22
  SAFE_ABI,
25
23
  Spinner,
26
24
  Tooltip,
25
+ TransferCryptoIcon,
27
26
  WalletIcon,
28
27
  accountFromPrivateKey,
29
28
  applyTheme,
@@ -44,15 +43,16 @@ import {
44
43
  parseEvmChainId,
45
44
  portfolioToAssets,
46
45
  saveSessionOwnerToStorage,
47
- toEvmCaip2,
46
+ targetChainToCaip2,
48
47
  tokenFormatter,
49
48
  txRefsMatch,
50
49
  useLatestRef
51
- } from "./chunk-CTYKQ4B4.mjs";
50
+ } from "./chunk-7VKAUBZ7.mjs";
52
51
  import {
53
52
  DEFAULT_BACKEND_URL,
54
53
  DEFAULT_SIGNER_ADDRESS,
55
54
  NATIVE_TOKEN_ADDRESS,
55
+ SOLANA_TOKENS,
56
56
  SOURCE_CHAINS,
57
57
  getChainBadge,
58
58
  getChainIcon,
@@ -61,27 +61,29 @@ import {
61
61
  getExplorerTxUrl,
62
62
  getExplorerUrl,
63
63
  getSupportedChainIds,
64
+ getTargetTokenSymbol,
64
65
  getTargetTokenSymbolsForChain,
65
66
  getTokenAddress,
66
67
  getTokenDecimalsByAddress,
67
68
  getTokenIcon,
68
69
  getTokenSymbol,
70
+ isNativeSol,
69
71
  isStablecoinSymbol
70
- } from "./chunk-VA3ANS7D.mjs";
72
+ } from "./chunk-UCZXBHLH.mjs";
71
73
 
72
74
  // src/DepositModal.tsx
73
75
  import {
74
- useMemo as useMemo7,
76
+ useMemo as useMemo8,
75
77
  useEffect as useEffect9,
76
- useRef as useRef6,
78
+ useRef as useRef8,
77
79
  useState as useState11,
78
- useCallback as useCallback5,
80
+ useCallback as useCallback6,
79
81
  lazy as lazy2,
80
82
  Suspense as Suspense2
81
83
  } from "react";
82
84
 
83
85
  // src/DepositFlow.tsx
84
- import { useState as useState9, useCallback as useCallback3, useMemo as useMemo6, useEffect as useEffect8, useRef as useRef5 } from "react";
86
+ import { useState as useState9, useCallback as useCallback4, useMemo as useMemo6, useEffect as useEffect8, useRef as useRef7 } from "react";
85
87
  import { formatUnits as formatUnits7 } from "viem";
86
88
 
87
89
  // src/components/steps/AssetSelectStep.tsx
@@ -223,7 +225,7 @@ function AssetSelectStep({
223
225
  /* @__PURE__ */ jsx(Spinner, { className: "rs-text-tertiary" }),
224
226
  /* @__PURE__ */ jsx("span", { className: "rs-text-sm rs-text-tertiary", children: "Loading balances" })
225
227
  ] }),
226
- error && /* @__PURE__ */ jsx("div", { className: "rs-alert rs-alert--error", children: /* @__PURE__ */ jsx("span", { className: "rs-alert-text", children: error }) }),
228
+ error && /* @__PURE__ */ jsx(Callout, { variant: "error", children: error }),
227
229
  !loading && !error && rows.length === 0 && /* @__PURE__ */ jsxs("div", { className: "rs-empty-state", children: [
228
230
  /* @__PURE__ */ jsx(WalletIcon, { className: "rs-empty-icon" }),
229
231
  /* @__PURE__ */ jsx("div", { className: "rs-empty-text", children: "No funds in connected wallet" }),
@@ -351,9 +353,101 @@ function mergeAssets(existing, incoming) {
351
353
  }
352
354
 
353
355
  // src/components/steps/AmountStep.tsx
354
- import { useEffect as useEffect2, useMemo as useMemo2, useRef, useState as useState2 } from "react";
356
+ import { useEffect as useEffect2, useMemo as useMemo2, useRef as useRef2, useState as useState2 } from "react";
355
357
  import { erc20Abi, formatUnits as formatUnits2, parseUnits } from "viem";
356
- import { Fragment, jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
358
+
359
+ // src/components/ui/AnimatedAmountInput.tsx
360
+ import { useLayoutEffect, useRef } from "react";
361
+ import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
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 = useRef("");
375
+ const isFirstRenderRef = useRef(true);
376
+ const slotRefs = useRef([]);
377
+ const isEmpty = value.length === 0;
378
+ const chars = isEmpty ? [placeholder] : value.split("");
379
+ useLayoutEffect(() => {
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__ */ jsxs2("div", { className: "rs-amount-input-row", children: [
413
+ /* @__PURE__ */ jsx2("span", { className: "rs-amount-prefix", "aria-hidden": "true", children: prefix }),
414
+ /* @__PURE__ */ jsxs2("span", { className: "rs-amount-number-wrap", children: [
415
+ /* @__PURE__ */ jsx2(
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__ */ jsx2(
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__ */ jsx2("span", { className: "rs-amount-char-slot", children: /* @__PURE__ */ jsx2(
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
+ import { Fragment, jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
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
- targetBalanceUsd,
478
+ appBalanceUsd,
385
479
  onBalanceUsdChange,
386
480
  onContinue,
387
481
  onCtaClick,
@@ -391,11 +485,13 @@ function AmountStep({
391
485
  const [balance, setBalance] = useState2(null);
392
486
  const [error, setError] = useState2(null);
393
487
  const [isCheckingLiquidity, setIsCheckingLiquidity] = useState2(false);
394
- const hasAttemptedSwitch = useRef(false);
488
+ const hasAttemptedSwitch = useRef2(false);
489
+ const hasAppliedDefaultRef = useRef2(false);
490
+ const isMaxDefault = defaultAmount?.trim().toLowerCase() === "max";
395
491
  const chainMismatch = Boolean(
396
492
  walletClient?.chain?.id && walletClient.chain.id !== asset.chainId
397
493
  );
398
- const targetSymbol = getTokenSymbol(targetToken, targetChain);
494
+ const targetSymbol = getTargetTokenSymbol(targetToken, targetChain);
399
495
  const isSourceStablecoin = isStablecoinSymbol(asset.symbol);
400
496
  const tokenPriceUsd = useMemo2(() => {
401
497
  if (tokenPriceUsdOverride !== void 0 && tokenPriceUsdOverride > 0)
@@ -448,14 +544,6 @@ function AmountStep({
448
544
  useEffect2(() => {
449
545
  hasAttemptedSwitch.current = false;
450
546
  }, [asset.chainId]);
451
- useEffect2(() => {
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 = useMemo2(() => {
460
548
  if (balance === null || tokenPriceUsd === null) return null;
461
549
  try {
@@ -469,6 +557,36 @@ function AmountStep({
469
557
  useEffect2(() => {
470
558
  onBalanceUsdChange?.(balanceUsd ?? 0);
471
559
  }, [balanceUsd, onBalanceUsdChange]);
560
+ useEffect2(() => {
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 = useMemo2(() => {
473
591
  if (balance === null) return "\u2026";
474
592
  try {
@@ -501,7 +619,7 @@ function AmountStep({
501
619
  const exceedsBalance = Boolean(
502
620
  sourceAmountUnits !== null && balance !== null && sourceAmountUnits > balance
503
621
  );
504
- const balanceAfterUsd = targetBalanceUsd !== void 0 ? targetBalanceUsd + numericAmount : null;
622
+ const balanceAfterUsd = appBalanceUsd !== void 0 ? appBalanceUsd + numericAmount : null;
505
623
  const handlePresetClick = (percentage) => {
506
624
  if (balance === null) return;
507
625
  onCtaClick?.(percentage === 100 ? "Max" : `${percentage}%`);
@@ -592,45 +710,39 @@ function AmountStep({
592
710
  const targetChainName = getChainName(targetChain);
593
711
  const sourceTokenIcon = getTokenIcon(asset.symbol);
594
712
  const targetTokenIcon = getTokenIcon(targetSymbol);
595
- return /* @__PURE__ */ jsxs2("div", { className: "rs-screen", children: [
596
- /* @__PURE__ */ jsxs2("div", { className: "rs-screen-body rs-screen-body--gap-32", children: [
597
- /* @__PURE__ */ jsx2(BodyHeader, { icon: /* @__PURE__ */ jsx2(WalletIcon, {}), title: "Wallet deposit" }),
598
- /* @__PURE__ */ jsxs2("div", { className: "rs-amount-section", children: [
599
- /* @__PURE__ */ jsxs2("div", { className: "rs-amount-display", children: [
600
- /* @__PURE__ */ jsxs2("div", { className: "rs-amount-input-row", children: [
601
- /* @__PURE__ */ jsx2("span", { "aria-hidden": "true", children: "$" }),
602
- /* @__PURE__ */ jsx2(
603
- "input",
604
- {
605
- type: "text",
606
- inputMode: "decimal",
607
- placeholder: "0",
608
- value: amount,
609
- onChange: (e) => handleAmountChange(e.target.value),
610
- "aria-label": "Deposit amount",
611
- autoFocus: true
612
- }
613
- )
614
- ] }),
615
- /* @__PURE__ */ jsxs2("div", { className: "rs-amount-meta", children: [
616
- /* @__PURE__ */ jsxs2("span", { className: "rs-amount-meta-balance", children: [
713
+ return /* @__PURE__ */ jsxs3("div", { className: "rs-screen", children: [
714
+ /* @__PURE__ */ jsxs3("div", { className: "rs-screen-body rs-screen-body--gap-32", children: [
715
+ /* @__PURE__ */ jsx3(BodyHeader, { icon: /* @__PURE__ */ jsx3(WalletIcon, {}), title: "Wallet deposit" }),
716
+ /* @__PURE__ */ jsxs3("div", { className: "rs-amount-section", children: [
717
+ /* @__PURE__ */ jsxs3("div", { className: "rs-amount-display", children: [
718
+ /* @__PURE__ */ jsx3(
719
+ AnimatedAmountInput,
720
+ {
721
+ value: amount,
722
+ onChange: handleAmountChange,
723
+ ariaLabel: "Deposit amount",
724
+ autoFocus: true
725
+ }
726
+ ),
727
+ /* @__PURE__ */ jsxs3("div", { className: "rs-amount-meta", children: [
728
+ /* @__PURE__ */ jsxs3("span", { className: "rs-amount-meta-balance", children: [
617
729
  formattedBalance,
618
730
  " ",
619
731
  asset.symbol,
620
732
  " available",
621
- balanceUsd !== null && /* @__PURE__ */ jsxs2(Fragment, { children: [
733
+ balanceUsd !== null && /* @__PURE__ */ jsxs3(Fragment, { children: [
622
734
  " (~",
623
735
  currencyFormatter.format(balanceUsd),
624
736
  ")"
625
737
  ] })
626
738
  ] }),
627
- minDepositUsd !== null && /* @__PURE__ */ jsxs2("span", { className: "rs-amount-meta-minimum", children: [
739
+ minDepositUsd !== null && /* @__PURE__ */ jsxs3("span", { className: "rs-amount-meta-minimum", children: [
628
740
  "Min. deposit ",
629
741
  currencyFormatter.format(minDepositUsd)
630
742
  ] })
631
743
  ] })
632
744
  ] }),
633
- /* @__PURE__ */ jsx2("div", { className: "rs-amount-presets", children: PRESETS.map((preset) => /* @__PURE__ */ jsx2(
745
+ /* @__PURE__ */ jsx3("div", { className: "rs-amount-presets", children: PRESETS.map((preset) => /* @__PURE__ */ jsx3(
634
746
  "button",
635
747
  {
636
748
  type: "button",
@@ -642,65 +754,55 @@ function AmountStep({
642
754
  preset.value
643
755
  )) })
644
756
  ] }),
645
- /* @__PURE__ */ jsxs2("div", { className: "rs-amount-details", children: [
646
- /* @__PURE__ */ jsxs2("div", { className: "rs-amount-detail-row", children: [
647
- /* @__PURE__ */ jsx2("span", { children: "You send" }),
648
- /* @__PURE__ */ jsxs2("span", { className: "rs-amount-detail-value", children: [
649
- /* @__PURE__ */ jsxs2("span", { children: [
757
+ /* @__PURE__ */ jsxs3("div", { className: "rs-amount-details", children: [
758
+ /* @__PURE__ */ jsxs3("div", { className: "rs-amount-detail-row", children: [
759
+ /* @__PURE__ */ jsx3("span", { children: "You send" }),
760
+ /* @__PURE__ */ jsxs3("span", { className: "rs-amount-detail-value", children: [
761
+ /* @__PURE__ */ jsxs3("span", { children: [
650
762
  sourceChainName,
651
763
  " ",
652
764
  asset.symbol
653
765
  ] }),
654
- sourceTokenIcon && /* @__PURE__ */ jsx2("span", { className: "rs-amount-detail-icon", children: /* @__PURE__ */ jsx2("img", { src: sourceTokenIcon, alt: "" }) })
766
+ sourceTokenIcon && /* @__PURE__ */ jsx3("span", { className: "rs-amount-detail-icon", children: /* @__PURE__ */ jsx3("img", { src: sourceTokenIcon, alt: "" }) })
655
767
  ] })
656
768
  ] }),
657
- /* @__PURE__ */ jsxs2("div", { className: "rs-amount-detail-row", children: [
658
- /* @__PURE__ */ jsx2("span", { children: "Receive" }),
659
- /* @__PURE__ */ jsxs2("span", { className: "rs-amount-detail-value", children: [
660
- /* @__PURE__ */ jsxs2("span", { children: [
769
+ /* @__PURE__ */ jsxs3("div", { className: "rs-amount-detail-row", children: [
770
+ /* @__PURE__ */ jsx3("span", { children: "Receive" }),
771
+ /* @__PURE__ */ jsxs3("span", { className: "rs-amount-detail-value", children: [
772
+ /* @__PURE__ */ jsxs3("span", { children: [
661
773
  targetChainName,
662
774
  " ",
663
775
  targetSymbol
664
776
  ] }),
665
- targetTokenIcon && /* @__PURE__ */ jsx2("span", { className: "rs-amount-detail-icon", children: /* @__PURE__ */ jsx2("img", { src: targetTokenIcon, alt: "" }) })
777
+ targetTokenIcon && /* @__PURE__ */ jsx3("span", { className: "rs-amount-detail-icon", children: /* @__PURE__ */ jsx3("img", { src: targetTokenIcon, alt: "" }) })
666
778
  ] })
667
779
  ] }),
668
- balanceAfterUsd !== null && /* @__PURE__ */ jsxs2("div", { className: "rs-amount-detail-row", children: [
669
- /* @__PURE__ */ jsx2("span", { children: "Balance after deposit" }),
670
- /* @__PURE__ */ jsx2("span", { className: "rs-amount-detail-value", children: currencyFormatter.format(balanceAfterUsd) })
780
+ balanceAfterUsd !== null && /* @__PURE__ */ jsxs3("div", { className: "rs-amount-detail-row", children: [
781
+ /* @__PURE__ */ jsx3("span", { children: "Balance after deposit" }),
782
+ /* @__PURE__ */ jsx3("span", { className: "rs-amount-detail-value", children: currencyFormatter.format(balanceAfterUsd) })
671
783
  ] })
672
784
  ] }),
673
- error && /* @__PURE__ */ jsxs2("div", { className: "rs-amount-error", role: "alert", children: [
674
- /* @__PURE__ */ jsx2(AlertTriangleIcon, { style: { width: 16, height: 16, flexShrink: 0 } }),
675
- /* @__PURE__ */ jsx2("span", { children: error })
676
- ] }),
677
- /* @__PURE__ */ jsx2(
785
+ error && /* @__PURE__ */ jsx3(Callout, { variant: "error", children: error }),
786
+ /* @__PURE__ */ jsx3(
678
787
  Button,
679
788
  {
680
789
  onClick: handleContinue,
681
790
  fullWidth: true,
682
791
  loading: isCheckingLiquidity,
683
- loadingText: "Checking liquidity\u2026",
792
+ loadingText: "Fetching route",
684
793
  disabled: continueDisabled,
685
794
  children: continueLabel
686
795
  }
687
796
  )
688
797
  ] }),
689
- /* @__PURE__ */ jsx2(PoweredBy, {})
798
+ /* @__PURE__ */ jsx3(PoweredBy, {})
690
799
  ] });
691
800
  }
692
801
 
693
802
  // src/components/steps/ConfirmStep.tsx
694
- import { useEffect as useEffect3, useRef as useRef2, useState as useState3 } from "react";
803
+ import { useEffect as useEffect3, useRef as useRef3, useState as useState3 } from "react";
695
804
  import { erc20Abi as erc20Abi2, parseUnits as parseUnits2 } from "viem";
696
-
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
- import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
805
+ import { jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
704
806
  function ConfirmStep({
705
807
  walletClient,
706
808
  address,
@@ -726,12 +828,12 @@ function ConfirmStep({
726
828
  }) {
727
829
  const [isSubmitting, setIsSubmitting] = useState3(false);
728
830
  const [error, setError] = useState3(null);
729
- const hasAttemptedSwitch = useRef2(false);
831
+ const hasAttemptedSwitch = useRef3(false);
730
832
  const chainMismatch = Boolean(
731
833
  walletClient?.chain?.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 : getTokenSymbol(targetToken, targetChain);
836
+ const targetSymbol = sameRoute ? asset.symbol : getTargetTokenSymbol(targetToken, targetChain);
735
837
  const sourceChainName = getChainName(asset.chainId);
736
838
  const targetChainName = getChainName(targetChain);
737
839
  const sourceChainIcon = getChainIcon(asset.chainId);
@@ -833,83 +935,66 @@ function ConfirmStep({
833
935
  setIsSubmitting(false);
834
936
  }
835
937
  };
836
- return /* @__PURE__ */ jsxs3("div", { className: "rs-screen", children: [
837
- /* @__PURE__ */ jsxs3("div", { className: "rs-screen-body rs-screen-body--gap-32", children: [
838
- /* @__PURE__ */ jsx3(BodyHeader, { icon: /* @__PURE__ */ jsx3(WalletIcon, {}), title: "Review deposit" }),
839
- /* @__PURE__ */ jsxs3("div", { className: "rs-review-details", children: [
840
- /* @__PURE__ */ jsxs3("div", { className: "rs-review-detail-row", children: [
841
- /* @__PURE__ */ jsx3("span", { children: "Source chain" }),
842
- /* @__PURE__ */ jsxs3("span", { className: "rs-review-detail-value", children: [
843
- /* @__PURE__ */ jsx3("span", { children: sourceChainName }),
844
- sourceChainIcon && /* @__PURE__ */ jsx3("span", { className: "rs-review-detail-icon", children: /* @__PURE__ */ jsx3("img", { src: sourceChainIcon, alt: "" }) })
938
+ return /* @__PURE__ */ jsxs4("div", { className: "rs-screen", children: [
939
+ /* @__PURE__ */ jsxs4("div", { className: "rs-screen-body rs-screen-body--gap-32", children: [
940
+ /* @__PURE__ */ jsx4(BodyHeader, { icon: /* @__PURE__ */ jsx4(WalletIcon, {}), title: "Review deposit" }),
941
+ /* @__PURE__ */ jsxs4("div", { className: "rs-review-details", children: [
942
+ /* @__PURE__ */ jsxs4("div", { className: "rs-review-detail-row", children: [
943
+ /* @__PURE__ */ jsx4("span", { children: "Source chain" }),
944
+ /* @__PURE__ */ jsxs4("span", { className: "rs-review-detail-value", children: [
945
+ /* @__PURE__ */ jsx4("span", { children: sourceChainName }),
946
+ sourceChainIcon && /* @__PURE__ */ jsx4("span", { className: "rs-review-detail-icon", children: /* @__PURE__ */ jsx4("img", { src: sourceChainIcon, alt: "" }) })
845
947
  ] })
846
948
  ] }),
847
- /* @__PURE__ */ jsxs3("div", { className: "rs-review-detail-row", children: [
848
- /* @__PURE__ */ jsx3("span", { children: "Destination chain" }),
849
- /* @__PURE__ */ jsxs3("span", { className: "rs-review-detail-value", children: [
850
- /* @__PURE__ */ jsx3("span", { children: targetChainName }),
851
- targetChainIcon && /* @__PURE__ */ jsx3("span", { className: "rs-review-detail-icon", children: /* @__PURE__ */ jsx3("img", { src: targetChainIcon, alt: "" }) })
949
+ /* @__PURE__ */ jsxs4("div", { className: "rs-review-detail-row", children: [
950
+ /* @__PURE__ */ jsx4("span", { children: "Destination chain" }),
951
+ /* @__PURE__ */ jsxs4("span", { className: "rs-review-detail-value", children: [
952
+ /* @__PURE__ */ jsx4("span", { children: targetChainName }),
953
+ targetChainIcon && /* @__PURE__ */ jsx4("span", { className: "rs-review-detail-icon", children: /* @__PURE__ */ jsx4("img", { src: targetChainIcon, alt: "" }) })
852
954
  ] })
853
955
  ] }),
854
- /* @__PURE__ */ jsxs3("div", { className: "rs-review-detail-row", children: [
855
- /* @__PURE__ */ jsx3("span", { children: "Estimated time" }),
856
- /* @__PURE__ */ jsx3("span", { className: "rs-review-detail-value", children: estimatedTime })
956
+ /* @__PURE__ */ jsxs4("div", { className: "rs-review-detail-row", children: [
957
+ /* @__PURE__ */ jsx4("span", { children: "Estimated time" }),
958
+ /* @__PURE__ */ jsx4("span", { className: "rs-review-detail-value", children: estimatedTime })
857
959
  ] }),
858
- /* @__PURE__ */ jsxs3("div", { className: "rs-review-detail-row", children: [
859
- /* @__PURE__ */ jsx3("span", { children: "You send" }),
860
- /* @__PURE__ */ jsxs3("span", { className: "rs-review-detail-value", children: [
861
- /* @__PURE__ */ jsxs3("span", { children: [
960
+ /* @__PURE__ */ jsxs4("div", { className: "rs-review-detail-row", children: [
961
+ /* @__PURE__ */ jsx4("span", { children: "You send" }),
962
+ /* @__PURE__ */ jsxs4("span", { className: "rs-review-detail-value", children: [
963
+ /* @__PURE__ */ jsxs4("span", { children: [
862
964
  formattedSendAmount,
863
965
  " ",
864
966
  asset.symbol
865
967
  ] }),
866
- sourceTokenIcon && /* @__PURE__ */ jsx3("span", { className: "rs-review-detail-icon", children: /* @__PURE__ */ jsx3("img", { src: sourceTokenIcon, alt: "" }) })
968
+ sourceTokenIcon && /* @__PURE__ */ jsx4("span", { className: "rs-review-detail-icon", children: /* @__PURE__ */ jsx4("img", { src: sourceTokenIcon, alt: "" }) })
867
969
  ] })
868
970
  ] }),
869
- /* @__PURE__ */ jsxs3("div", { className: "rs-review-detail-row", children: [
870
- /* @__PURE__ */ jsx3("span", { children: "Receive" }),
871
- /* @__PURE__ */ jsxs3("span", { className: "rs-review-detail-value", children: [
872
- /* @__PURE__ */ jsxs3("span", { children: [
971
+ /* @__PURE__ */ jsxs4("div", { className: "rs-review-detail-row", children: [
972
+ /* @__PURE__ */ jsx4("span", { children: "Receive" }),
973
+ /* @__PURE__ */ jsxs4("span", { className: "rs-review-detail-value", children: [
974
+ /* @__PURE__ */ jsxs4("span", { children: [
873
975
  receiveAmount,
874
976
  " ",
875
977
  targetSymbol
876
978
  ] }),
877
- targetTokenIcon && /* @__PURE__ */ jsx3("span", { className: "rs-review-detail-icon", children: /* @__PURE__ */ jsx3("img", { src: targetTokenIcon, alt: "" }) })
979
+ targetTokenIcon && /* @__PURE__ */ jsx4("span", { className: "rs-review-detail-icon", children: /* @__PURE__ */ jsx4("img", { src: targetTokenIcon, alt: "" }) })
878
980
  ] })
879
981
  ] }),
880
- /* @__PURE__ */ jsxs3("div", { className: "rs-review-detail-row", children: [
881
- /* @__PURE__ */ jsx3("span", { children: "Fees" }),
882
- /* @__PURE__ */ jsxs3("span", { className: "rs-review-detail-value", children: [
883
- /* @__PURE__ */ jsx3(
982
+ /* @__PURE__ */ jsxs4("div", { className: "rs-review-detail-row", children: [
983
+ /* @__PURE__ */ jsx4("span", { children: "Fees" }),
984
+ /* @__PURE__ */ jsxs4("span", { className: "rs-review-detail-value", children: [
985
+ /* @__PURE__ */ jsx4(
884
986
  "span",
885
987
  {
886
988
  style: feeSponsored ? { textDecoration: "line-through" } : void 0,
887
- children: "$0.05"
989
+ children: "$0.04"
888
990
  }
889
991
  ),
890
- /* @__PURE__ */ jsx3(Tooltip, { content: feeTooltip, children: /* @__PURE__ */ jsx3("span", { className: "rs-review-detail-info", "aria-label": "Fee info", children: /* @__PURE__ */ jsx3(InfoIcon, {}) }) })
992
+ /* @__PURE__ */ jsx4(Tooltip, { content: feeTooltip, children: /* @__PURE__ */ jsx4("span", { className: "rs-review-detail-info", "aria-label": "Fee info", children: /* @__PURE__ */ jsx4(InfoIcon, {}) }) })
891
993
  ] })
892
994
  ] })
893
995
  ] }),
894
- liquidityWarning && (liquidityWarning.kind === "unavailable" || liquidityWarning.kind === "check-failed") && (isDappImportAsset(asset) ? (
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__ */ jsxs3("div", { className: "rs-amount-error rs-amount-error--warning", role: "status", children: [
901
- /* @__PURE__ */ jsx3(AlertTriangleIcon, { style: { width: 16, height: 16, flexShrink: 0 } }),
902
- /* @__PURE__ */ jsx3("span", { children: "Low liquidity detected \u2014 deposit may take longer" })
903
- ] })
904
- ) : /* @__PURE__ */ jsxs3("div", { className: "rs-amount-error", role: "status", children: [
905
- /* @__PURE__ */ jsx3(AlertTriangleIcon, { style: { width: 16, height: 16, flexShrink: 0 } }),
906
- /* @__PURE__ */ jsx3("span", { children: liquidityWarning.kind === "unavailable" ? "Route may be unavailable" : "Liquidity check failed" })
907
- ] })),
908
- error && /* @__PURE__ */ jsxs3("div", { className: "rs-amount-error", role: "alert", children: [
909
- /* @__PURE__ */ jsx3(AlertTriangleIcon, { style: { width: 16, height: 16, flexShrink: 0 } }),
910
- /* @__PURE__ */ jsx3("span", { children: error })
911
- ] }),
912
- /* @__PURE__ */ jsx3(
996
+ error && /* @__PURE__ */ jsx4(Callout, { variant: "error", children: error }),
997
+ /* @__PURE__ */ jsx4(
913
998
  Button,
914
999
  {
915
1000
  onClick: handleConfirm,
@@ -921,7 +1006,7 @@ function ConfirmStep({
921
1006
  }
922
1007
  )
923
1008
  ] }),
924
- /* @__PURE__ */ jsx3(PoweredBy, {})
1009
+ /* @__PURE__ */ jsx4(PoweredBy, {})
925
1010
  ] });
926
1011
  }
927
1012
 
@@ -930,7 +1015,7 @@ import {
930
1015
  useState as useState5,
931
1016
  useEffect as useEffect5,
932
1017
  useCallback as useCallback2,
933
- useRef as useRef4,
1018
+ useRef as useRef5,
934
1019
  useMemo as useMemo3,
935
1020
  lazy,
936
1021
  Suspense
@@ -938,8 +1023,8 @@ import {
938
1023
  import { formatUnits as formatUnits3 } from "viem";
939
1024
 
940
1025
  // src/components/ui/DepositNotification.tsx
941
- import { useState as useState4, useEffect as useEffect4, useRef as useRef3, useCallback } from "react";
942
- import { jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
1026
+ import { useState as useState4, useEffect as useEffect4, useRef as useRef4, useCallback } from "react";
1027
+ import { jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
943
1028
  var INITIAL_POLL_INTERVAL = 3e3;
944
1029
  var MAX_POLL_INTERVAL = 3e4;
945
1030
  var BACKOFF_MULTIPLIER = 1.5;
@@ -996,7 +1081,7 @@ function formatBridgeFailedMessage(event) {
996
1081
  }
997
1082
  return "Bridge failed";
998
1083
  }
999
- var txLinkIcon = /* @__PURE__ */ jsx4(ExternalLinkIcon, { className: "rs-deposit-notification-link-icon" });
1084
+ var txLinkIcon = /* @__PURE__ */ jsx5(ExternalLinkIcon, { className: "rs-deposit-notification-link-icon" });
1000
1085
  function DepositNotification({
1001
1086
  deposit,
1002
1087
  smartAccount,
@@ -1021,9 +1106,9 @@ function DepositNotification({
1021
1106
  const [destinationTxHash, setDestinationTxHash] = useState4(
1022
1107
  null
1023
1108
  );
1024
- const pollIntervalRef = useRef3(INITIAL_POLL_INTERVAL);
1025
- const pollTimeoutRef = useRef3(null);
1026
- const completedRef = useRef3(directTransfer ?? false);
1109
+ const pollIntervalRef = useRef4(INITIAL_POLL_INTERVAL);
1110
+ const pollTimeoutRef = useRef4(null);
1111
+ const completedRef = useRef4(directTransfer ?? false);
1027
1112
  const depositContextRef = useLatestRef({
1028
1113
  amount,
1029
1114
  sourceChain,
@@ -1142,33 +1227,33 @@ function DepositNotification({
1142
1227
  const destExplorerUrl = destinationTxHash ? getExplorerTxUrl(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__ */ jsx4("div", { className: "rs-deposit-notification-badge rs-deposit-notification-badge--complete", children: /* @__PURE__ */ jsx4(CheckIcon, {}) }) : status === "failed" ? /* @__PURE__ */ jsx4("div", { className: "rs-deposit-notification-badge rs-deposit-notification-badge--failed", children: /* @__PURE__ */ jsx4(CloseIcon, {}) }) : /* @__PURE__ */ jsx4("div", { className: "rs-deposit-notification-badge rs-deposit-notification-badge--processing", children: /* @__PURE__ */ jsx4(Spinner, {}) });
1230
+ const statusIcon = status === "complete" ? /* @__PURE__ */ jsx5("div", { className: "rs-deposit-notification-badge rs-deposit-notification-badge--complete", children: /* @__PURE__ */ jsx5(CheckIcon, {}) }) : status === "failed" ? /* @__PURE__ */ jsx5("div", { className: "rs-deposit-notification-badge rs-deposit-notification-badge--failed", children: /* @__PURE__ */ jsx5(CloseIcon, {}) }) : /* @__PURE__ */ jsx5("div", { className: "rs-deposit-notification-badge rs-deposit-notification-badge--processing", children: /* @__PURE__ */ jsx5(Spinner, {}) });
1146
1231
  const showClose = status !== "processing";
1147
- return /* @__PURE__ */ jsxs4(
1232
+ return /* @__PURE__ */ jsxs5(
1148
1233
  "div",
1149
1234
  {
1150
1235
  className: `rs-deposit-notification rs-deposit-notification--${status} ${expanded ? "rs-deposit-notification--expanded" : ""}`,
1151
1236
  children: [
1152
- /* @__PURE__ */ jsxs4("div", { className: "rs-deposit-notification-header", children: [
1153
- /* @__PURE__ */ jsx4("div", { className: "rs-deposit-notification-icon", children: statusIcon }),
1154
- /* @__PURE__ */ jsxs4("div", { className: "rs-deposit-notification-content", children: [
1155
- /* @__PURE__ */ jsxs4("div", { className: "rs-deposit-notification-title-row", children: [
1156
- /* @__PURE__ */ jsx4("span", { className: "rs-deposit-notification-title", children: title }),
1157
- showClose && /* @__PURE__ */ jsx4(
1237
+ /* @__PURE__ */ jsxs5("div", { className: "rs-deposit-notification-header", children: [
1238
+ /* @__PURE__ */ jsx5("div", { className: "rs-deposit-notification-icon", children: statusIcon }),
1239
+ /* @__PURE__ */ jsxs5("div", { className: "rs-deposit-notification-content", children: [
1240
+ /* @__PURE__ */ jsxs5("div", { className: "rs-deposit-notification-title-row", children: [
1241
+ /* @__PURE__ */ jsx5("span", { className: "rs-deposit-notification-title", children: title }),
1242
+ showClose && /* @__PURE__ */ jsx5(
1158
1243
  "button",
1159
1244
  {
1160
1245
  type: "button",
1161
1246
  className: "rs-deposit-notification-close",
1162
1247
  onClick: () => onDismiss(deposit.id),
1163
1248
  "aria-label": "Dismiss",
1164
- children: /* @__PURE__ */ jsx4(CloseIcon, {})
1249
+ children: /* @__PURE__ */ jsx5(CloseIcon, {})
1165
1250
  }
1166
1251
  )
1167
1252
  ] }),
1168
- /* @__PURE__ */ jsx4("div", { className: "rs-deposit-notification-subtitle", children: subtitle })
1253
+ /* @__PURE__ */ jsx5("div", { className: "rs-deposit-notification-subtitle", children: subtitle })
1169
1254
  ] })
1170
1255
  ] }),
1171
- /* @__PURE__ */ jsxs4(
1256
+ /* @__PURE__ */ jsxs5(
1172
1257
  "button",
1173
1258
  {
1174
1259
  type: "button",
@@ -1176,15 +1261,15 @@ function DepositNotification({
1176
1261
  onClick: () => setExpanded(!expanded),
1177
1262
  "aria-expanded": expanded,
1178
1263
  children: [
1179
- /* @__PURE__ */ jsx4("span", { children: expanded ? "See less details" : "See more details" }),
1180
- /* @__PURE__ */ jsx4(ChevronDownIcon, { className: "rs-deposit-notification-toggle-chevron" })
1264
+ /* @__PURE__ */ jsx5("span", { children: expanded ? "See less details" : "See more details" }),
1265
+ /* @__PURE__ */ jsx5(ChevronDownIcon, { className: "rs-deposit-notification-toggle-chevron" })
1181
1266
  ]
1182
1267
  }
1183
1268
  ),
1184
- expanded && /* @__PURE__ */ jsxs4("div", { className: "rs-deposit-notification-details", children: [
1185
- /* @__PURE__ */ jsxs4("div", { className: "rs-deposit-notification-row", children: [
1186
- /* @__PURE__ */ jsx4("span", { className: "rs-deposit-notification-label", children: "Deposit tx" }),
1187
- /* @__PURE__ */ jsx4("span", { className: "rs-deposit-notification-value", children: sourceExplorerUrl ? /* @__PURE__ */ jsxs4(
1269
+ expanded && /* @__PURE__ */ jsxs5("div", { className: "rs-deposit-notification-details", children: [
1270
+ /* @__PURE__ */ jsxs5("div", { className: "rs-deposit-notification-row", children: [
1271
+ /* @__PURE__ */ jsx5("span", { className: "rs-deposit-notification-label", children: "Deposit tx" }),
1272
+ /* @__PURE__ */ jsx5("span", { className: "rs-deposit-notification-value", children: sourceExplorerUrl ? /* @__PURE__ */ jsxs5(
1188
1273
  "a",
1189
1274
  {
1190
1275
  href: sourceExplorerUrl,
@@ -1198,9 +1283,9 @@ function DepositNotification({
1198
1283
  }
1199
1284
  ) : truncateHash(txHash) })
1200
1285
  ] }),
1201
- destinationTxHash && /* @__PURE__ */ jsxs4("div", { className: "rs-deposit-notification-row", children: [
1202
- /* @__PURE__ */ jsx4("span", { className: "rs-deposit-notification-label", children: "Completion tx" }),
1203
- /* @__PURE__ */ jsx4("span", { className: "rs-deposit-notification-value", children: destExplorerUrl ? /* @__PURE__ */ jsxs4(
1286
+ destinationTxHash && /* @__PURE__ */ jsxs5("div", { className: "rs-deposit-notification-row", children: [
1287
+ /* @__PURE__ */ jsx5("span", { className: "rs-deposit-notification-label", children: "Completion tx" }),
1288
+ /* @__PURE__ */ jsx5("span", { className: "rs-deposit-notification-value", children: destExplorerUrl ? /* @__PURE__ */ jsxs5(
1204
1289
  "a",
1205
1290
  {
1206
1291
  href: destExplorerUrl,
@@ -1214,13 +1299,13 @@ function DepositNotification({
1214
1299
  }
1215
1300
  ) : truncateHash(destinationTxHash) })
1216
1301
  ] }),
1217
- /* @__PURE__ */ jsxs4("div", { className: "rs-deposit-notification-row", children: [
1218
- /* @__PURE__ */ jsx4("span", { className: "rs-deposit-notification-label", children: "Order submitted" }),
1219
- /* @__PURE__ */ jsx4("span", { className: "rs-deposit-notification-value", children: formatTimestamp(detectedAt) })
1302
+ /* @__PURE__ */ jsxs5("div", { className: "rs-deposit-notification-row", children: [
1303
+ /* @__PURE__ */ jsx5("span", { className: "rs-deposit-notification-label", children: "Order submitted" }),
1304
+ /* @__PURE__ */ jsx5("span", { className: "rs-deposit-notification-value", children: formatTimestamp(detectedAt) })
1220
1305
  ] }),
1221
- completedAt && /* @__PURE__ */ jsxs4("div", { className: "rs-deposit-notification-row", children: [
1222
- /* @__PURE__ */ jsx4("span", { className: "rs-deposit-notification-label", children: "Order filled" }),
1223
- /* @__PURE__ */ jsx4("span", { className: "rs-deposit-notification-value", children: formatTimestamp(completedAt) })
1306
+ completedAt && /* @__PURE__ */ jsxs5("div", { className: "rs-deposit-notification-row", children: [
1307
+ /* @__PURE__ */ jsx5("span", { className: "rs-deposit-notification-label", children: "Order filled" }),
1308
+ /* @__PURE__ */ jsx5("span", { className: "rs-deposit-notification-value", children: formatTimestamp(completedAt) })
1224
1309
  ] })
1225
1310
  ] })
1226
1311
  ]
@@ -1228,125 +1313,8 @@ function DepositNotification({
1228
1313
  );
1229
1314
  }
1230
1315
 
1231
- // src/core/solana.ts
1232
- import {
1233
- Connection,
1234
- PublicKey,
1235
- SystemProgram,
1236
- Transaction
1237
- } from "@solana/web3.js";
1238
- import {
1239
- getAssociatedTokenAddress,
1240
- createAssociatedTokenAccountInstruction,
1241
- createTransferInstruction
1242
- } from "@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 = rpcUrl?.trim();
1261
- configuredSolanaRpcUrl = normalized ? normalized : null;
1262
- cachedConnections.clear();
1263
- }
1264
- function getSolanaRpcUrl() {
1265
- return 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 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 PublicKey(from);
1282
- const toPubkey = new PublicKey(to);
1283
- const tx = new Transaction().add(
1284
- 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 PublicKey(from);
1298
- const toPubkey = new PublicKey(to);
1299
- const mintPubkey = new PublicKey(mint);
1300
- const fromAta = await getAssociatedTokenAddress(mintPubkey, fromPubkey);
1301
- const toAta = await getAssociatedTokenAddress(mintPubkey, toPubkey, true);
1302
- const tx = new Transaction();
1303
- const toAtaInfo = await connection.getAccountInfo(toAta);
1304
- if (!toAtaInfo) {
1305
- tx.add(
1306
- createAssociatedTokenAccountInstruction(
1307
- fromPubkey,
1308
- toAta,
1309
- toPubkey,
1310
- mintPubkey
1311
- )
1312
- );
1313
- }
1314
- tx.add(createTransferInstruction(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
- import { jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
1317
+ import { jsx as jsx6, jsxs as jsxs6 } from "react/jsx-runtime";
1350
1318
  var QRCode = lazy(
1351
1319
  () => import("./QRCode-YMQTKSSK.mjs").then((m) => ({ default: m.QRCode }))
1352
1320
  );
@@ -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,
@@ -1480,13 +1449,13 @@ function DepositAddressStep({
1480
1449
  const [chainDropdownOpen, setChainDropdownOpen] = useState5(false);
1481
1450
  const [tokenDropdownOpen, setTokenDropdownOpen] = useState5(false);
1482
1451
  const [priceImpactExpanded, setPriceImpactExpanded] = useState5(false);
1483
- const chainDropdownRef = useRef4(null);
1484
- const tokenDropdownRef = useRef4(null);
1452
+ const chainDropdownRef = useRef5(null);
1453
+ const tokenDropdownRef = useRef5(null);
1485
1454
  const [notifications, setNotifications] = useState5([]);
1486
- const isTrackingRef = useRef4(false);
1487
- const baselineTxHashRef = useRef4(void 0);
1488
- const notificationIdRef = useRef4(0);
1489
- const sourceSelectionRef = useRef4({
1455
+ const isTrackingRef = useRef5(false);
1456
+ const baselineTxHashRef = useRef5(void 0);
1457
+ const notificationIdRef = useRef5(0);
1458
+ const sourceSelectionRef = useRef5({
1490
1459
  chainId: defaultChainId,
1491
1460
  token: typeof defaultChainId === "number" ? getTokenAddress(defaultToken, defaultChainId) : void 0,
1492
1461
  sourceSymbol: defaultToken
@@ -1581,6 +1550,7 @@ function DepositAddressStep({
1581
1550
  };
1582
1551
  }, [chainDropdownOpen, tokenDropdownOpen]);
1583
1552
  const handleCopy = useCallback2(async () => {
1553
+ if (isUpdating) return;
1584
1554
  onCopyAddress?.();
1585
1555
  try {
1586
1556
  await navigator.clipboard.writeText(displayAddress);
@@ -1598,23 +1568,23 @@ function DepositAddressStep({
1598
1568
  setCopied(true);
1599
1569
  setTimeout(() => setCopied(false), 2e3);
1600
1570
  }
1601
- }, [displayAddress, onCopyAddress]);
1571
+ }, [displayAddress, onCopyAddress, isUpdating]);
1602
1572
  useEffect5(() => {
1603
1573
  setCopied(false);
1604
1574
  setChainDropdownOpen(false);
1605
1575
  setTokenDropdownOpen(false);
1606
1576
  }, [sourceChainId]);
1607
- const onDepositSubmittedRef = useRef4(onDepositSubmitted);
1577
+ const onDepositSubmittedRef = useRef5(onDepositSubmitted);
1608
1578
  onDepositSubmittedRef.current = onDepositSubmitted;
1609
- const onDepositCompleteRef = useRef4(onDepositComplete);
1579
+ const onDepositCompleteRef = useRef5(onDepositComplete);
1610
1580
  onDepositCompleteRef.current = onDepositComplete;
1611
- const onDepositFailedRef = useRef4(onDepositFailed);
1581
+ const onDepositFailedRef = useRef5(onDepositFailed);
1612
1582
  onDepositFailedRef.current = onDepositFailed;
1613
- const onErrorRef = useRef4(onError);
1583
+ const onErrorRef = useRef5(onError);
1614
1584
  onErrorRef.current = onError;
1615
- const targetChainRef = useRef4(targetChain);
1585
+ const targetChainRef = useRef5(targetChain);
1616
1586
  targetChainRef.current = targetChain;
1617
- const targetTokenRef = useRef4(targetToken);
1587
+ const targetTokenRef = useRef5(targetToken);
1618
1588
  targetTokenRef.current = targetToken;
1619
1589
  useEffect5(() => {
1620
1590
  baselineTxHashRef.current = void 0;
@@ -1729,13 +1699,13 @@ function DepositAddressStep({
1729
1699
  setNotifications((prev) => prev.filter((n) => n.id !== id));
1730
1700
  }, []);
1731
1701
  const qrIconSrc = getChainIcon(sourceChainId);
1732
- return /* @__PURE__ */ jsxs5("div", { className: "rs-screen rs-step--with-notifications", children: [
1733
- /* @__PURE__ */ jsxs5("div", { className: "rs-screen-body", children: [
1734
- /* @__PURE__ */ jsx5(BodyHeader, { icon: /* @__PURE__ */ jsx5(HandCoinsIcon, {}), title: "Transfer crypto" }),
1735
- /* @__PURE__ */ jsxs5("div", { className: "rs-deposit-address-selectors", children: [
1736
- /* @__PURE__ */ jsxs5("div", { className: "rs-deposit-address-dropdown", ref: chainDropdownRef, children: [
1737
- /* @__PURE__ */ jsx5("div", { className: "rs-deposit-address-dropdown-label", children: "Supported chain" }),
1738
- /* @__PURE__ */ jsxs5(
1702
+ return /* @__PURE__ */ jsxs6("div", { className: "rs-screen rs-step--with-notifications", children: [
1703
+ /* @__PURE__ */ jsxs6("div", { className: "rs-screen-body", children: [
1704
+ /* @__PURE__ */ jsx6(BodyHeader, { icon: /* @__PURE__ */ jsx6(TransferCryptoIcon, {}), title: "Transfer crypto" }),
1705
+ /* @__PURE__ */ jsxs6("div", { className: "rs-deposit-address-selectors", children: [
1706
+ /* @__PURE__ */ jsxs6("div", { className: "rs-deposit-address-dropdown", ref: chainDropdownRef, children: [
1707
+ /* @__PURE__ */ jsx6("div", { className: "rs-deposit-address-dropdown-label", children: "Supported chain" }),
1708
+ /* @__PURE__ */ jsxs6(
1739
1709
  "button",
1740
1710
  {
1741
1711
  type: "button",
@@ -1746,7 +1716,7 @@ function DepositAddressStep({
1746
1716
  setTokenDropdownOpen(false);
1747
1717
  },
1748
1718
  children: [
1749
- getChainIcon(sourceChainId) && /* @__PURE__ */ jsx5(
1719
+ getChainIcon(sourceChainId) && /* @__PURE__ */ jsx6(
1750
1720
  "img",
1751
1721
  {
1752
1722
  src: getChainIcon(sourceChainId),
@@ -1754,12 +1724,12 @@ function DepositAddressStep({
1754
1724
  className: "rs-deposit-address-dropdown-icon"
1755
1725
  }
1756
1726
  ),
1757
- /* @__PURE__ */ jsx5("span", { children: getChainName(sourceChainId) }),
1758
- /* @__PURE__ */ jsx5(ChevronDownIcon, { className: "rs-deposit-address-dropdown-chevron" })
1727
+ /* @__PURE__ */ jsx6("span", { children: getChainName(sourceChainId) }),
1728
+ /* @__PURE__ */ jsx6(ChevronDownIcon, { className: "rs-deposit-address-dropdown-chevron" })
1759
1729
  ]
1760
1730
  }
1761
1731
  ),
1762
- chainDropdownOpen && /* @__PURE__ */ jsx5("div", { className: "rs-deposit-address-dropdown-menu", children: chainOptions.map((chainId) => /* @__PURE__ */ jsxs5(
1732
+ chainDropdownOpen && /* @__PURE__ */ jsx6("div", { className: "rs-deposit-address-dropdown-menu", children: chainOptions.map((chainId) => /* @__PURE__ */ jsxs6(
1763
1733
  "button",
1764
1734
  {
1765
1735
  type: "button",
@@ -1769,7 +1739,7 @@ function DepositAddressStep({
1769
1739
  setChainDropdownOpen(false);
1770
1740
  },
1771
1741
  children: [
1772
- getChainIcon(chainId) && /* @__PURE__ */ jsx5(
1742
+ getChainIcon(chainId) && /* @__PURE__ */ jsx6(
1773
1743
  "img",
1774
1744
  {
1775
1745
  src: getChainIcon(chainId),
@@ -1777,19 +1747,19 @@ function DepositAddressStep({
1777
1747
  className: "rs-deposit-address-dropdown-icon"
1778
1748
  }
1779
1749
  ),
1780
- /* @__PURE__ */ jsx5("span", { children: getChainName(chainId) })
1750
+ /* @__PURE__ */ jsx6("span", { children: getChainName(chainId) })
1781
1751
  ]
1782
1752
  },
1783
1753
  String(chainId)
1784
1754
  )) })
1785
1755
  ] }),
1786
- /* @__PURE__ */ jsxs5("div", { className: "rs-deposit-address-dropdown", ref: tokenDropdownRef, children: [
1787
- /* @__PURE__ */ jsxs5("div", { className: "rs-deposit-address-dropdown-label rs-deposit-address-dropdown-label--with-min", children: [
1788
- /* @__PURE__ */ jsx5("span", { children: "Supported token" }),
1789
- /* @__PURE__ */ jsxs5("span", { className: "rs-deposit-address-min", children: [
1756
+ /* @__PURE__ */ jsxs6("div", { className: "rs-deposit-address-dropdown", ref: tokenDropdownRef, children: [
1757
+ /* @__PURE__ */ jsxs6("div", { className: "rs-deposit-address-dropdown-label rs-deposit-address-dropdown-label--with-min", children: [
1758
+ /* @__PURE__ */ jsx6("span", { children: "Supported token" }),
1759
+ /* @__PURE__ */ jsxs6("span", { className: "rs-deposit-address-min", children: [
1790
1760
  "Min.$",
1791
1761
  (uiConfig?.minDepositUsd ?? 0.1).toFixed(2),
1792
- /* @__PURE__ */ jsx5(Tooltip, { content: "Minimum deposit amount required for the selected chain.", children: /* @__PURE__ */ jsx5(
1762
+ /* @__PURE__ */ jsx6(Tooltip, { content: "Minimum deposit amount required for the selected chain.", children: /* @__PURE__ */ jsx6(
1793
1763
  InfoIcon,
1794
1764
  {
1795
1765
  className: "rs-deposit-address-min-icon",
@@ -1798,7 +1768,7 @@ function DepositAddressStep({
1798
1768
  ) })
1799
1769
  ] })
1800
1770
  ] }),
1801
- /* @__PURE__ */ jsxs5(
1771
+ /* @__PURE__ */ jsxs6(
1802
1772
  "button",
1803
1773
  {
1804
1774
  type: "button",
@@ -1809,7 +1779,7 @@ function DepositAddressStep({
1809
1779
  setChainDropdownOpen(false);
1810
1780
  },
1811
1781
  children: [
1812
- getTokenIcon(sourceTokenSymbol) && /* @__PURE__ */ jsx5(
1782
+ getTokenIcon(sourceTokenSymbol) && /* @__PURE__ */ jsx6(
1813
1783
  "img",
1814
1784
  {
1815
1785
  src: getTokenIcon(sourceTokenSymbol),
@@ -1817,12 +1787,12 @@ function DepositAddressStep({
1817
1787
  className: "rs-deposit-address-dropdown-icon"
1818
1788
  }
1819
1789
  ),
1820
- /* @__PURE__ */ jsx5("span", { children: sourceTokenSymbol }),
1821
- /* @__PURE__ */ jsx5(ChevronDownIcon, { className: "rs-deposit-address-dropdown-chevron" })
1790
+ /* @__PURE__ */ jsx6("span", { children: sourceTokenSymbol }),
1791
+ /* @__PURE__ */ jsx6(ChevronDownIcon, { className: "rs-deposit-address-dropdown-chevron" })
1822
1792
  ]
1823
1793
  }
1824
1794
  ),
1825
- tokenDropdownOpen && /* @__PURE__ */ jsx5("div", { className: "rs-deposit-address-dropdown-menu", children: tokensForChain.map((symbol) => /* @__PURE__ */ jsxs5(
1795
+ tokenDropdownOpen && /* @__PURE__ */ jsx6("div", { className: "rs-deposit-address-dropdown-menu", children: tokensForChain.map((symbol) => /* @__PURE__ */ jsxs6(
1826
1796
  "button",
1827
1797
  {
1828
1798
  type: "button",
@@ -1832,7 +1802,7 @@ function DepositAddressStep({
1832
1802
  setTokenDropdownOpen(false);
1833
1803
  },
1834
1804
  children: [
1835
- getTokenIcon(symbol) && /* @__PURE__ */ jsx5(
1805
+ getTokenIcon(symbol) && /* @__PURE__ */ jsx6(
1836
1806
  "img",
1837
1807
  {
1838
1808
  src: getTokenIcon(symbol),
@@ -1840,48 +1810,57 @@ function DepositAddressStep({
1840
1810
  className: "rs-deposit-address-dropdown-icon"
1841
1811
  }
1842
1812
  ),
1843
- /* @__PURE__ */ jsx5("span", { children: symbol })
1813
+ /* @__PURE__ */ jsx6("span", { children: symbol })
1844
1814
  ]
1845
1815
  },
1846
1816
  symbol
1847
1817
  )) })
1848
1818
  ] })
1849
1819
  ] }),
1850
- /* @__PURE__ */ jsxs5(
1820
+ /* @__PURE__ */ jsxs6(
1851
1821
  "div",
1852
1822
  {
1853
1823
  style: { display: "flex", flexDirection: "column", gap: 4, width: "100%" },
1854
1824
  children: [
1855
- /* @__PURE__ */ jsxs5("div", { className: "rs-deposit-address-well", children: [
1856
- /* @__PURE__ */ jsx5("div", { className: "rs-deposit-address-qr", children: /* @__PURE__ */ jsx5(
1857
- Suspense,
1858
- {
1859
- fallback: /* @__PURE__ */ jsx5(
1860
- "div",
1825
+ /* @__PURE__ */ jsxs6(
1826
+ "div",
1827
+ {
1828
+ className: `rs-deposit-address-well ${isUpdating ? "rs-deposit-address-well--updating" : ""}`,
1829
+ children: [
1830
+ /* @__PURE__ */ jsx6("div", { className: "rs-deposit-address-qr", children: /* @__PURE__ */ jsx6(
1831
+ Suspense,
1861
1832
  {
1862
- style: {
1863
- width: 200,
1864
- height: 200,
1865
- display: "flex",
1866
- alignItems: "center",
1867
- justifyContent: "center"
1868
- },
1869
- children: /* @__PURE__ */ jsx5(Spinner, {})
1833
+ fallback: /* @__PURE__ */ jsx6(
1834
+ "div",
1835
+ {
1836
+ style: {
1837
+ width: 200,
1838
+ height: 200,
1839
+ display: "flex",
1840
+ alignItems: "center",
1841
+ justifyContent: "center"
1842
+ },
1843
+ children: /* @__PURE__ */ jsx6(Spinner, {})
1844
+ }
1845
+ ),
1846
+ children: /* @__PURE__ */ jsx6(QRCode, { value: displayAddress, size: 200, iconSrc: qrIconSrc })
1870
1847
  }
1871
- ),
1872
- children: /* @__PURE__ */ jsx5(QRCode, { value: displayAddress, size: 200, iconSrc: qrIconSrc })
1873
- }
1874
- ) }),
1875
- /* @__PURE__ */ jsx5("div", { className: "rs-deposit-address-value", children: displayAddress })
1876
- ] }),
1877
- /* @__PURE__ */ jsxs5(
1848
+ ) }),
1849
+ /* @__PURE__ */ jsx6("div", { className: "rs-deposit-address-value", children: displayAddress })
1850
+ ]
1851
+ }
1852
+ ),
1853
+ isUpdating ? /* @__PURE__ */ jsxs6("div", { className: "rs-deposit-address-updating", role: "status", children: [
1854
+ /* @__PURE__ */ jsx6(Spinner, { className: "rs-spinner--sm" }),
1855
+ "Updating deposit details\u2026"
1856
+ ] }) : /* @__PURE__ */ jsxs6(
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__ */ jsx5(CheckIcon, {}) : /* @__PURE__ */ jsx5(CopyIcon, {}),
1863
+ copied ? /* @__PURE__ */ jsx6(CheckIcon, {}) : /* @__PURE__ */ jsx6(CopyIcon, {}),
1885
1864
  copied ? "Copied!" : "Copy address"
1886
1865
  ]
1887
1866
  }
@@ -1889,12 +1868,12 @@ function DepositAddressStep({
1889
1868
  ]
1890
1869
  }
1891
1870
  ),
1892
- /* @__PURE__ */ jsxs5(
1871
+ /* @__PURE__ */ jsxs6(
1893
1872
  "div",
1894
1873
  {
1895
1874
  className: `rs-price-impact ${priceImpactExpanded ? "rs-price-impact--open" : ""}`,
1896
1875
  children: [
1897
- /* @__PURE__ */ jsxs5(
1876
+ /* @__PURE__ */ jsxs6(
1898
1877
  "button",
1899
1878
  {
1900
1879
  type: "button",
@@ -1902,19 +1881,19 @@ function DepositAddressStep({
1902
1881
  onClick: () => setPriceImpactExpanded((v) => !v),
1903
1882
  "aria-expanded": priceImpactExpanded,
1904
1883
  children: [
1905
- /* @__PURE__ */ jsxs5("span", { className: "rs-price-impact-header-left", children: [
1906
- /* @__PURE__ */ jsx5("span", { className: "rs-price-impact-label", children: "Price impact" }),
1907
- /* @__PURE__ */ jsx5("span", { className: "rs-price-impact-label", children: /* @__PURE__ */ jsx5("strong", { children: "0.00%" }) }),
1908
- /* @__PURE__ */ jsx5(
1884
+ /* @__PURE__ */ jsxs6("span", { className: "rs-price-impact-header-left", children: [
1885
+ /* @__PURE__ */ jsx6("span", { className: "rs-price-impact-label", children: "Price impact" }),
1886
+ /* @__PURE__ */ jsx6("span", { className: "rs-price-impact-label", children: /* @__PURE__ */ jsx6("strong", { children: "0.00%" }) }),
1887
+ /* @__PURE__ */ jsx6(
1909
1888
  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__ */ jsx5(InfoIcon, { "aria-hidden": "true" })
1892
+ children: /* @__PURE__ */ jsx6(InfoIcon, { "aria-hidden": "true" })
1914
1893
  }
1915
1894
  )
1916
1895
  ] }),
1917
- /* @__PURE__ */ jsx5(
1896
+ /* @__PURE__ */ jsx6(
1918
1897
  ChevronDownIcon,
1919
1898
  {
1920
1899
  className: "rs-price-impact-chevron",
@@ -1924,35 +1903,35 @@ function DepositAddressStep({
1924
1903
  ]
1925
1904
  }
1926
1905
  ),
1927
- /* @__PURE__ */ jsx5("div", { className: "rs-price-impact-panel", children: /* @__PURE__ */ jsxs5("div", { className: "rs-price-impact-panel-inner", children: [
1928
- /* @__PURE__ */ jsxs5("div", { className: "rs-price-impact-row", children: [
1929
- /* @__PURE__ */ jsx5("span", { className: "rs-price-impact-row-icon", "aria-hidden": "true", children: /* @__PURE__ */ jsx5(PercentIcon, {}) }),
1930
- /* @__PURE__ */ jsxs5("span", { className: "rs-price-impact-label", children: [
1906
+ /* @__PURE__ */ jsx6("div", { className: "rs-price-impact-panel", children: /* @__PURE__ */ jsxs6("div", { className: "rs-price-impact-panel-inner", children: [
1907
+ /* @__PURE__ */ jsxs6("div", { className: "rs-price-impact-row", children: [
1908
+ /* @__PURE__ */ jsx6("span", { className: "rs-price-impact-row-icon", "aria-hidden": "true", children: /* @__PURE__ */ jsx6(PercentIcon, {}) }),
1909
+ /* @__PURE__ */ jsxs6("span", { className: "rs-price-impact-label", children: [
1931
1910
  "Max slippage: ",
1932
- /* @__PURE__ */ jsx5("strong", { children: "0.2%" })
1911
+ /* @__PURE__ */ jsx6("strong", { children: "0.2%" })
1933
1912
  ] }),
1934
- /* @__PURE__ */ jsx5(
1913
+ /* @__PURE__ */ jsx6(
1935
1914
  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__ */ jsx5(InfoIcon, { "aria-hidden": "true" })
1918
+ children: /* @__PURE__ */ jsx6(InfoIcon, { "aria-hidden": "true" })
1940
1919
  }
1941
1920
  )
1942
1921
  ] }),
1943
- /* @__PURE__ */ jsxs5("div", { className: "rs-price-impact-row", children: [
1944
- /* @__PURE__ */ jsx5("span", { className: "rs-price-impact-row-icon", "aria-hidden": "true", children: /* @__PURE__ */ jsx5(ClockIcon, {}) }),
1945
- /* @__PURE__ */ jsxs5("span", { className: "rs-price-impact-label", children: [
1922
+ /* @__PURE__ */ jsxs6("div", { className: "rs-price-impact-row", children: [
1923
+ /* @__PURE__ */ jsx6("span", { className: "rs-price-impact-row-icon", "aria-hidden": "true", children: /* @__PURE__ */ jsx6(ClockIcon, {}) }),
1924
+ /* @__PURE__ */ jsxs6("span", { className: "rs-price-impact-label", children: [
1946
1925
  "Processing time: ",
1947
- /* @__PURE__ */ jsx5("strong", { children: "< 1 min" })
1926
+ /* @__PURE__ */ jsx6("strong", { children: "< 1 min" })
1948
1927
  ] })
1949
1928
  ] }),
1950
- /* @__PURE__ */ jsxs5("div", { className: "rs-price-impact-row", children: [
1951
- /* @__PURE__ */ jsx5("span", { className: "rs-price-impact-row-icon", "aria-hidden": "true", children: /* @__PURE__ */ jsx5(PlusCircleIcon, {}) }),
1952
- /* @__PURE__ */ jsxs5("span", { className: "rs-price-impact-label", children: [
1929
+ /* @__PURE__ */ jsxs6("div", { className: "rs-price-impact-row", children: [
1930
+ /* @__PURE__ */ jsx6("span", { className: "rs-price-impact-row-icon", "aria-hidden": "true", children: /* @__PURE__ */ jsx6(PlusCircleIcon, {}) }),
1931
+ /* @__PURE__ */ jsxs6("span", { className: "rs-price-impact-label", children: [
1953
1932
  "Max deposit:",
1954
1933
  " ",
1955
- /* @__PURE__ */ jsx5("strong", { children: liquidityHelper.kind === "max" ? `${formatUnits3(
1934
+ /* @__PURE__ */ jsx6("strong", { children: liquidityHelper.kind === "max" ? `${formatUnits3(
1956
1935
  BigInt(liquidityHelper.maxAmount),
1957
1936
  liquidityHelper.decimals
1958
1937
  )} ${liquidityHelper.symbol}` : liquidityHelper.kind === "unlimited" ? "Unlimited" : liquidityHelper.kind === "unavailable" ? "Unavailable" : liquidityHelper.kind === "error" ? "\u2014" : "\u2026" })
@@ -1962,9 +1941,9 @@ function DepositAddressStep({
1962
1941
  ]
1963
1942
  }
1964
1943
  ),
1965
- pollingError && /* @__PURE__ */ jsx5("div", { className: "rs-deposit-address-error", children: pollingError })
1944
+ pollingError && /* @__PURE__ */ jsx6("div", { className: "rs-deposit-address-error", children: pollingError })
1966
1945
  ] }),
1967
- notifications.length > 0 && /* @__PURE__ */ jsx5("div", { className: "rs-deposit-notifications", children: notifications.map((deposit) => /* @__PURE__ */ jsx5(
1946
+ notifications.length > 0 && /* @__PURE__ */ jsx6("div", { className: "rs-deposit-notifications", children: notifications.map((deposit) => /* @__PURE__ */ jsx6(
1968
1947
  DepositNotification,
1969
1948
  {
1970
1949
  deposit,
@@ -1981,7 +1960,7 @@ function DepositAddressStep({
1981
1960
  },
1982
1961
  deposit.id
1983
1962
  )) }),
1984
- /* @__PURE__ */ jsx5(PoweredBy, {})
1963
+ /* @__PURE__ */ jsx6(PoweredBy, {})
1985
1964
  ] });
1986
1965
  }
1987
1966
  DepositAddressStep.displayName = "DepositAddressStep";
@@ -1989,12 +1968,13 @@ DepositAddressStep.displayName = "DepositAddressStep";
1989
1968
  // src/components/steps/SolanaTokenSelectStep.tsx
1990
1969
  import { useState as useState6, useEffect as useEffect6, useMemo as useMemo4 } from "react";
1991
1970
  import { formatUnits as formatUnits4 } from "viem";
1992
- import { jsx as jsx6, jsxs as jsxs6 } from "react/jsx-runtime";
1971
+ import { jsx as jsx7, jsxs as jsxs7 } from "react/jsx-runtime";
1993
1972
  function SolanaTokenSelectStep({
1994
1973
  solanaAddress,
1995
1974
  service,
1996
1975
  onContinue,
1997
1976
  onTotalBalanceComputed,
1977
+ onDisconnect,
1998
1978
  debug
1999
1979
  }) {
2000
1980
  const [tokenBalances, setTokenBalances] = useState6([]);
@@ -2082,119 +2062,111 @@ function SolanaTokenSelectStep({
2082
2062
  [tokenBalances]
2083
2063
  );
2084
2064
  const selectedEntry = selectedSymbol ? rows.find((r) => r.token.symbol === selectedSymbol) : null;
2085
- if (error) {
2086
- return /* @__PURE__ */ jsx6("div", { className: "rs-step", children: /* @__PURE__ */ jsx6("div", { className: "rs-step-body", children: /* @__PURE__ */ jsx6("div", { className: "rs-alert rs-alert--error", children: /* @__PURE__ */ jsx6("span", { className: "rs-alert-text", children: error }) }) }) });
2087
- }
2088
- return /* @__PURE__ */ jsxs6("div", { className: "rs-step", children: [
2089
- /* @__PURE__ */ jsx6("div", { style: { padding: "0 12px 12px" }, children: /* @__PURE__ */ jsx6(
2090
- BodyHeader,
2091
- {
2092
- icon: /* @__PURE__ */ jsx6(CoinsIcon, {}),
2093
- title: "Select asset",
2094
- subtitle: "Pick a Solana token to deposit"
2095
- }
2096
- ) }),
2097
- /* @__PURE__ */ jsxs6(
2098
- "div",
2099
- {
2100
- className: "rs-step-body",
2101
- style: { paddingTop: 4, overflow: "auto", maxHeight: 340 },
2102
- children: [
2103
- loading && /* @__PURE__ */ jsxs6("div", { className: "rs-loading-state", style: { padding: "40px 12px" }, children: [
2104
- /* @__PURE__ */ jsx6(Spinner, { className: "rs-text-tertiary" }),
2105
- /* @__PURE__ */ jsx6("span", { className: "rs-text-sm rs-text-tertiary", children: "Loading balances" })
2106
- ] }),
2107
- !loading && rows.length === 0 && /* @__PURE__ */ jsxs6("div", { className: "rs-empty-state", children: [
2108
- /* @__PURE__ */ jsx6(WalletIcon, { className: "rs-empty-icon" }),
2109
- /* @__PURE__ */ jsx6("div", { className: "rs-empty-text", children: "No funds in connected wallet" }),
2110
- /* @__PURE__ */ jsxs6("div", { className: "rs-empty-address", children: [
2111
- solanaAddress.slice(0, 6),
2112
- "...",
2113
- solanaAddress.slice(-4)
2114
- ] })
2115
- ] }),
2116
- !loading && rows.length > 0 && /* @__PURE__ */ jsx6("div", { className: "rs-asset-list", children: rows.map((entry) => {
2117
- const isSelected = selectedSymbol === entry.token.symbol;
2118
- const tokenIcon = getTokenIcon(entry.token.symbol);
2119
- const chainIcon = getChainIcon("solana");
2120
- let formattedBalance;
2121
- try {
2122
- const raw = formatUnits4(entry.balance, entry.token.decimals);
2123
- const numeric = Number(raw);
2124
- formattedBalance = Number.isFinite(numeric) ? tokenFormatter.format(numeric) : raw;
2125
- } catch {
2126
- formattedBalance = "...";
2127
- }
2128
- return /* @__PURE__ */ jsxs6(
2129
- "button",
2130
- {
2131
- type: "button",
2132
- onClick: () => setSelectedSymbol(entry.token.symbol),
2133
- className: `rs-asset-row ${isSelected ? "rs-asset-row--selected" : ""}`,
2134
- style: { textAlign: "left" },
2135
- children: [
2136
- /* @__PURE__ */ jsxs6("div", { className: "rs-asset-info", children: [
2137
- /* @__PURE__ */ jsxs6("div", { className: "rs-asset-icon-wrapper", children: [
2138
- tokenIcon ? /* @__PURE__ */ jsx6(
2139
- "img",
2140
- {
2141
- src: tokenIcon,
2142
- alt: entry.token.symbol,
2143
- className: "rs-asset-icon",
2144
- style: { background: "transparent" }
2145
- }
2146
- ) : /* @__PURE__ */ jsx6("div", { className: "rs-asset-icon", children: entry.token.symbol.slice(0, 4) }),
2147
- chainIcon && /* @__PURE__ */ jsx6(
2148
- "img",
2149
- {
2150
- src: chainIcon,
2151
- alt: "Solana",
2152
- className: "rs-asset-chain-badge"
2153
- }
2154
- )
2155
- ] }),
2156
- /* @__PURE__ */ jsxs6("div", { children: [
2157
- /* @__PURE__ */ jsxs6("div", { className: "rs-asset-name", children: [
2158
- entry.token.symbol,
2159
- /* @__PURE__ */ jsx6("span", { className: "rs-asset-chain", children: " on Solana" })
2160
- ] }),
2161
- /* @__PURE__ */ jsxs6("div", { className: "rs-asset-balance-small", children: [
2162
- formattedBalance,
2163
- " ",
2164
- entry.token.symbol
2165
- ] })
2065
+ const formatBalance = (entry) => {
2066
+ try {
2067
+ const raw = formatUnits4(entry.balance, entry.token.decimals);
2068
+ const numeric = Number(raw);
2069
+ if (!Number.isFinite(numeric)) return raw;
2070
+ return tokenFormatter.format(numeric);
2071
+ } catch {
2072
+ return "--";
2073
+ }
2074
+ };
2075
+ const chainIcon = getChainIcon("solana");
2076
+ const chainName = getChainName("solana");
2077
+ return /* @__PURE__ */ jsxs7("div", { className: "rs-screen", children: [
2078
+ /* @__PURE__ */ jsxs7("div", { className: "rs-screen-body", children: [
2079
+ /* @__PURE__ */ jsx7(
2080
+ BodyHeader,
2081
+ {
2082
+ icon: /* @__PURE__ */ jsx7(WalletIcon, {}),
2083
+ title: "Your assets",
2084
+ subtitle: "Select source assets to transfer"
2085
+ }
2086
+ ),
2087
+ loading && /* @__PURE__ */ jsxs7("div", { className: "rs-loading-state", style: { padding: "40px 12px" }, children: [
2088
+ /* @__PURE__ */ jsx7(Spinner, { className: "rs-text-tertiary" }),
2089
+ /* @__PURE__ */ jsx7("span", { className: "rs-text-sm rs-text-tertiary", children: "Loading balances" })
2090
+ ] }),
2091
+ error && /* @__PURE__ */ jsx7(Callout, { variant: "error", children: error }),
2092
+ !loading && !error && rows.length === 0 && /* @__PURE__ */ jsxs7("div", { className: "rs-empty-state", children: [
2093
+ /* @__PURE__ */ jsx7(WalletIcon, { className: "rs-empty-icon" }),
2094
+ /* @__PURE__ */ jsx7("div", { className: "rs-empty-text", children: "No funds in connected wallet" }),
2095
+ /* @__PURE__ */ jsxs7("div", { className: "rs-empty-address", children: [
2096
+ solanaAddress.slice(0, 6),
2097
+ "...",
2098
+ solanaAddress.slice(-4)
2099
+ ] }),
2100
+ onDisconnect && /* @__PURE__ */ jsx7(
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__ */ jsx7("div", { className: "rs-asset-list", children: rows.map((entry) => {
2111
+ const isSelected = selectedSymbol === entry.token.symbol;
2112
+ const tokenAmount = formatBalance(entry);
2113
+ const tokenIcon = getTokenIcon(entry.token.symbol);
2114
+ return /* @__PURE__ */ jsxs7(
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__ */ jsxs7("div", { className: "rs-asset-info", children: [
2123
+ /* @__PURE__ */ jsxs7("div", { className: "rs-asset-icon-wrapper", children: [
2124
+ tokenIcon ? /* @__PURE__ */ jsx7("span", { className: "rs-asset-icon", children: /* @__PURE__ */ jsx7("img", { src: tokenIcon, alt: entry.token.symbol }) }) : /* @__PURE__ */ jsx7("span", { className: "rs-asset-icon", children: entry.token.symbol.slice(0, 4) }),
2125
+ chainIcon && /* @__PURE__ */ jsx7("span", { className: "rs-asset-chain-badge", children: /* @__PURE__ */ jsx7("img", { src: chainIcon, alt: chainName }) })
2126
+ ] }),
2127
+ /* @__PURE__ */ jsxs7("div", { className: "rs-asset-text", children: [
2128
+ /* @__PURE__ */ jsxs7("div", { className: "rs-asset-name-row", children: [
2129
+ /* @__PURE__ */ jsx7("span", { className: "rs-asset-name", children: entry.token.symbol }),
2130
+ /* @__PURE__ */ jsxs7("span", { className: "rs-asset-chain", children: [
2131
+ "on ",
2132
+ chainName
2166
2133
  ] })
2167
2134
  ] }),
2168
- /* @__PURE__ */ jsx6("div", { className: "rs-asset-balance", children: entry.balanceUsd > 0 ? currencyFormatter.format(entry.balanceUsd) : `${formattedBalance} ${entry.token.symbol}` })
2169
- ]
2170
- },
2171
- entry.token.symbol
2172
- );
2173
- }) })
2174
- ]
2175
- }
2176
- ),
2177
- /* @__PURE__ */ jsx6("div", { className: "rs-step-footer", children: /* @__PURE__ */ jsx6(
2178
- Button,
2179
- {
2180
- onClick: () => selectedEntry && onContinue(
2181
- selectedEntry.token,
2182
- selectedEntry.balance,
2183
- selectedEntry.balanceUsd
2184
- ),
2185
- disabled: !selectedEntry,
2186
- fullWidth: true,
2187
- children: "Continue"
2188
- }
2189
- ) }),
2190
- /* @__PURE__ */ jsx6(PoweredBy, {})
2135
+ /* @__PURE__ */ jsxs7("div", { className: "rs-asset-balance-small", children: [
2136
+ tokenAmount,
2137
+ " ",
2138
+ entry.token.symbol
2139
+ ] })
2140
+ ] })
2141
+ ] }),
2142
+ /* @__PURE__ */ jsx7("div", { className: "rs-asset-balance", children: entry.balanceUsd > 0 ? currencyFormatter.format(entry.balanceUsd) : tokenAmount !== "--" ? `${tokenAmount} ${entry.token.symbol}` : "--" })
2143
+ ]
2144
+ },
2145
+ entry.token.symbol
2146
+ );
2147
+ }) }),
2148
+ /* @__PURE__ */ jsx7(
2149
+ 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__ */ jsx7(PoweredBy, {})
2191
2163
  ] });
2192
2164
  }
2193
2165
 
2194
2166
  // src/components/steps/SolanaAmountStep.tsx
2195
- import { useEffect as useEffect7, useMemo as useMemo5, useState as useState7 } from "react";
2167
+ import { useCallback as useCallback3, useEffect as useEffect7, useMemo as useMemo5, useRef as useRef6, useState as useState7 } from "react";
2196
2168
  import { formatUnits as formatUnits5, parseUnits as parseUnits3 } from "viem";
2197
- import { Fragment as Fragment2, jsx as jsx7, jsxs as jsxs7 } from "react/jsx-runtime";
2169
+ import { Fragment as Fragment2, jsx as jsx8, jsxs as jsxs8 } from "react/jsx-runtime";
2198
2170
  var SOL_FEE_RESERVE_LAMPORTS = 1000000n;
2199
2171
  var PRESETS2 = [
2200
2172
  { value: 25, label: "25%" },
@@ -2211,13 +2183,15 @@ function SolanaAmountStep({
2211
2183
  targetChainName,
2212
2184
  targetTokenSymbol,
2213
2185
  targetTokenIcon,
2214
- targetBalanceUsd,
2186
+ appBalanceUsd,
2215
2187
  onContinue,
2216
2188
  debug
2217
2189
  }) {
2218
2190
  const [amount, setAmount] = useState7("");
2219
2191
  const [error, setError] = useState7(null);
2192
+ const hasAppliedDefaultRef = useRef6(false);
2220
2193
  const isSourceStablecoin = isStablecoinSymbol(token.symbol);
2194
+ const isMaxDefault = defaultAmount?.trim().toLowerCase() === "max";
2221
2195
  const tokenPriceUsd = useMemo5(() => {
2222
2196
  if (isSourceStablecoin) return 1;
2223
2197
  try {
@@ -2232,14 +2206,6 @@ function SolanaAmountStep({
2232
2206
  }
2233
2207
  }, [isSourceStablecoin, balance, token.decimals, balanceUsd]);
2234
2208
  const hasPricing = tokenPriceUsd !== null;
2235
- useEffect7(() => {
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 = useMemo5(() => {
2244
2210
  try {
2245
2211
  const raw = formatUnits5(balance, token.decimals);
@@ -2275,6 +2241,45 @@ function SolanaAmountStep({
2275
2241
  return null;
2276
2242
  }
2277
2243
  }, [spendableBalance, token.decimals, tokenPriceUsd]);
2244
+ const computePresetAmount = useCallback3(
2245
+ (percentage) => {
2246
+ try {
2247
+ const spendableUnits = Number(
2248
+ formatUnits5(spendableBalance, token.decimals)
2249
+ );
2250
+ if (!Number.isFinite(spendableUnits) || spendableUnits <= 0) return "";
2251
+ const value = isSourceStablecoin || !hasPricing ? spendableUnits * percentage / 100 : (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 {
2256
+ return "";
2257
+ }
2258
+ },
2259
+ [
2260
+ spendableBalance,
2261
+ token.decimals,
2262
+ isSourceStablecoin,
2263
+ hasPricing,
2264
+ spendableBalanceUsd
2265
+ ]
2266
+ );
2267
+ useEffect7(() => {
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 = useMemo5(() => {
2279
2284
  const parsed = parseFloat(amount);
2280
2285
  return Number.isFinite(parsed) && parsed > 0 ? parsed : 0;
@@ -2295,24 +2300,16 @@ function SolanaAmountStep({
2295
2300
  const exceedsBalance = Boolean(
2296
2301
  sourceAmountUnits !== null && sourceAmountUnits > spendableBalance
2297
2302
  );
2298
- const balanceAfterUsd = targetBalanceUsd !== void 0 ? targetBalanceUsd + numericAmount : null;
2303
+ const balanceAfterUsd = appBalanceUsd !== void 0 ? appBalanceUsd + numericAmount : null;
2299
2304
  const handlePresetClick = (percentage) => {
2300
- try {
2301
- const spendableUnits = Number(formatUnits5(spendableBalance, token.decimals));
2302
- if (!Number.isFinite(spendableUnits) || spendableUnits <= 0) return;
2303
- const value = isSourceStablecoin || !hasPricing ? spendableUnits * percentage / 100 : (spendableBalanceUsd ?? 0) * percentage / 100;
2304
- const factor = 1e3;
2305
- const truncated = Math.floor(value * factor) / factor;
2306
- const formatted = truncated.toFixed(3).replace(/\.?0+$/, "");
2307
- debugLog(debug, "solana-amount", "amount:preset", {
2308
- percentage,
2309
- symbol: token.symbol,
2310
- formatted
2311
- });
2312
- setAmount(formatted);
2313
- } catch {
2314
- return;
2315
- }
2305
+ const formatted = computePresetAmount(percentage);
2306
+ if (!formatted) return;
2307
+ debugLog(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) => {
@@ -2369,45 +2366,39 @@ function SolanaAmountStep({
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
2368
  const sourceTokenIcon = getTokenIcon(token.symbol);
2372
- return /* @__PURE__ */ jsxs7("div", { className: "rs-screen", children: [
2373
- /* @__PURE__ */ jsxs7("div", { className: "rs-screen-body rs-screen-body--gap-32", children: [
2374
- /* @__PURE__ */ jsx7(BodyHeader, { icon: /* @__PURE__ */ jsx7(WalletIcon, {}), title: "Wallet deposit" }),
2375
- /* @__PURE__ */ jsxs7("div", { className: "rs-amount-section", children: [
2376
- /* @__PURE__ */ jsxs7("div", { className: "rs-amount-display", children: [
2377
- /* @__PURE__ */ jsxs7("div", { className: "rs-amount-input-row", children: [
2378
- /* @__PURE__ */ jsx7("span", { "aria-hidden": "true", children: "$" }),
2379
- /* @__PURE__ */ jsx7(
2380
- "input",
2381
- {
2382
- type: "text",
2383
- inputMode: "decimal",
2384
- placeholder: "0",
2385
- value: amount,
2386
- onChange: (e) => handleAmountChange(e.target.value),
2387
- "aria-label": "Deposit amount",
2388
- autoFocus: true
2389
- }
2390
- )
2391
- ] }),
2392
- /* @__PURE__ */ jsxs7("div", { className: "rs-amount-meta", children: [
2393
- /* @__PURE__ */ jsxs7("span", { className: "rs-amount-meta-balance", children: [
2369
+ return /* @__PURE__ */ jsxs8("div", { className: "rs-screen", children: [
2370
+ /* @__PURE__ */ jsxs8("div", { className: "rs-screen-body rs-screen-body--gap-32", children: [
2371
+ /* @__PURE__ */ jsx8(BodyHeader, { icon: /* @__PURE__ */ jsx8(WalletIcon, {}), title: "Wallet deposit" }),
2372
+ /* @__PURE__ */ jsxs8("div", { className: "rs-amount-section", children: [
2373
+ /* @__PURE__ */ jsxs8("div", { className: "rs-amount-display", children: [
2374
+ /* @__PURE__ */ jsx8(
2375
+ AnimatedAmountInput,
2376
+ {
2377
+ value: amount,
2378
+ onChange: handleAmountChange,
2379
+ ariaLabel: "Deposit amount",
2380
+ autoFocus: true
2381
+ }
2382
+ ),
2383
+ /* @__PURE__ */ jsxs8("div", { className: "rs-amount-meta", children: [
2384
+ /* @__PURE__ */ jsxs8("span", { className: "rs-amount-meta-balance", children: [
2394
2385
  formattedBalance,
2395
2386
  " ",
2396
2387
  token.symbol,
2397
2388
  " available",
2398
- computedBalanceUsd !== null && /* @__PURE__ */ jsxs7(Fragment2, { children: [
2389
+ computedBalanceUsd !== null && /* @__PURE__ */ jsxs8(Fragment2, { children: [
2399
2390
  " (~",
2400
2391
  currencyFormatter.format(computedBalanceUsd),
2401
2392
  ")"
2402
2393
  ] })
2403
2394
  ] }),
2404
- minDepositUsd !== null && /* @__PURE__ */ jsxs7("span", { className: "rs-amount-meta-minimum", children: [
2395
+ minDepositUsd !== null && /* @__PURE__ */ jsxs8("span", { className: "rs-amount-meta-minimum", children: [
2405
2396
  "Min. deposit ",
2406
2397
  currencyFormatter.format(minDepositUsd)
2407
2398
  ] })
2408
2399
  ] })
2409
2400
  ] }),
2410
- /* @__PURE__ */ jsx7("div", { className: "rs-amount-presets", children: PRESETS2.map((preset) => /* @__PURE__ */ jsx7(
2401
+ /* @__PURE__ */ jsx8("div", { className: "rs-amount-presets", children: PRESETS2.map((preset) => /* @__PURE__ */ jsx8(
2411
2402
  "button",
2412
2403
  {
2413
2404
  type: "button",
@@ -2418,38 +2409,35 @@ function SolanaAmountStep({
2418
2409
  preset.value
2419
2410
  )) })
2420
2411
  ] }),
2421
- /* @__PURE__ */ jsxs7("div", { className: "rs-amount-details", children: [
2422
- /* @__PURE__ */ jsxs7("div", { className: "rs-amount-detail-row", children: [
2423
- /* @__PURE__ */ jsx7("span", { children: "You send" }),
2424
- /* @__PURE__ */ jsxs7("span", { className: "rs-amount-detail-value", children: [
2425
- /* @__PURE__ */ jsxs7("span", { children: [
2412
+ /* @__PURE__ */ jsxs8("div", { className: "rs-amount-details", children: [
2413
+ /* @__PURE__ */ jsxs8("div", { className: "rs-amount-detail-row", children: [
2414
+ /* @__PURE__ */ jsx8("span", { children: "You send" }),
2415
+ /* @__PURE__ */ jsxs8("span", { className: "rs-amount-detail-value", children: [
2416
+ /* @__PURE__ */ jsxs8("span", { children: [
2426
2417
  "Solana ",
2427
2418
  token.symbol
2428
2419
  ] }),
2429
- sourceTokenIcon && /* @__PURE__ */ jsx7("span", { className: "rs-amount-detail-icon", children: /* @__PURE__ */ jsx7("img", { src: sourceTokenIcon, alt: "" }) })
2420
+ sourceTokenIcon && /* @__PURE__ */ jsx8("span", { className: "rs-amount-detail-icon", children: /* @__PURE__ */ jsx8("img", { src: sourceTokenIcon, alt: "" }) })
2430
2421
  ] })
2431
2422
  ] }),
2432
- targetChainName && targetTokenSymbol && /* @__PURE__ */ jsxs7("div", { className: "rs-amount-detail-row", children: [
2433
- /* @__PURE__ */ jsx7("span", { children: "Receive" }),
2434
- /* @__PURE__ */ jsxs7("span", { className: "rs-amount-detail-value", children: [
2435
- /* @__PURE__ */ jsxs7("span", { children: [
2423
+ targetChainName && targetTokenSymbol && /* @__PURE__ */ jsxs8("div", { className: "rs-amount-detail-row", children: [
2424
+ /* @__PURE__ */ jsx8("span", { children: "Receive" }),
2425
+ /* @__PURE__ */ jsxs8("span", { className: "rs-amount-detail-value", children: [
2426
+ /* @__PURE__ */ jsxs8("span", { children: [
2436
2427
  targetChainName,
2437
2428
  " ",
2438
2429
  targetTokenSymbol
2439
2430
  ] }),
2440
- targetTokenIcon && /* @__PURE__ */ jsx7("span", { className: "rs-amount-detail-icon", children: /* @__PURE__ */ jsx7("img", { src: targetTokenIcon, alt: "" }) })
2431
+ targetTokenIcon && /* @__PURE__ */ jsx8("span", { className: "rs-amount-detail-icon", children: /* @__PURE__ */ jsx8("img", { src: targetTokenIcon, alt: "" }) })
2441
2432
  ] })
2442
2433
  ] }),
2443
- balanceAfterUsd !== null && /* @__PURE__ */ jsxs7("div", { className: "rs-amount-detail-row", children: [
2444
- /* @__PURE__ */ jsx7("span", { children: "Balance after deposit" }),
2445
- /* @__PURE__ */ jsx7("span", { className: "rs-amount-detail-value", children: currencyFormatter.format(balanceAfterUsd) })
2434
+ balanceAfterUsd !== null && /* @__PURE__ */ jsxs8("div", { className: "rs-amount-detail-row", children: [
2435
+ /* @__PURE__ */ jsx8("span", { children: "Balance after deposit" }),
2436
+ /* @__PURE__ */ jsx8("span", { className: "rs-amount-detail-value", children: currencyFormatter.format(balanceAfterUsd) })
2446
2437
  ] })
2447
2438
  ] }),
2448
- error && /* @__PURE__ */ jsxs7("div", { className: "rs-amount-error", role: "alert", children: [
2449
- /* @__PURE__ */ jsx7(AlertTriangleIcon, { style: { width: 16, height: 16, flexShrink: 0 } }),
2450
- /* @__PURE__ */ jsx7("span", { children: error })
2451
- ] }),
2452
- /* @__PURE__ */ jsx7(
2439
+ error && /* @__PURE__ */ jsx8(Callout, { variant: "error", children: error }),
2440
+ /* @__PURE__ */ jsx8(
2453
2441
  Button,
2454
2442
  {
2455
2443
  onClick: handleContinue,
@@ -2459,14 +2447,120 @@ function SolanaAmountStep({
2459
2447
  }
2460
2448
  )
2461
2449
  ] }),
2462
- /* @__PURE__ */ jsx7(PoweredBy, {})
2450
+ /* @__PURE__ */ jsx8(PoweredBy, {})
2463
2451
  ] });
2464
2452
  }
2465
2453
 
2466
2454
  // src/components/steps/SolanaConfirmStep.tsx
2467
- import { useState as useState8 } from "react";
2468
- import { parseUnits as parseUnits4 } from "viem";
2469
- import { jsx as jsx8, jsxs as jsxs8 } from "react/jsx-runtime";
2455
+ import { useState as useState8 } from "react";
2456
+ import { parseUnits as parseUnits4 } from "viem";
2457
+
2458
+ // src/core/solana.ts
2459
+ import {
2460
+ Connection,
2461
+ PublicKey,
2462
+ SystemProgram,
2463
+ Transaction
2464
+ } from "@solana/web3.js";
2465
+ import {
2466
+ getAssociatedTokenAddress,
2467
+ createAssociatedTokenAccountInstruction,
2468
+ createTransferInstruction
2469
+ } from "@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 = rpcUrl?.trim();
2475
+ configuredSolanaRpcUrl = normalized ? normalized : null;
2476
+ cachedConnections.clear();
2477
+ }
2478
+ function getSolanaRpcUrl() {
2479
+ return 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 Connection(rpcUrl, "confirmed");
2491
+ cachedConnections.set(rpcUrl, next);
2492
+ return next;
2493
+ }
2494
+ async function buildSolTransferTransaction(connection, from, to, lamports) {
2495
+ const fromPubkey = new PublicKey(from);
2496
+ const toPubkey = new PublicKey(to);
2497
+ const tx = new Transaction().add(
2498
+ 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 PublicKey(from);
2512
+ const toPubkey = new PublicKey(to);
2513
+ const mintPubkey = new PublicKey(mint);
2514
+ const fromAta = await getAssociatedTokenAddress(mintPubkey, fromPubkey);
2515
+ const toAta = await getAssociatedTokenAddress(mintPubkey, toPubkey, true);
2516
+ const tx = new Transaction();
2517
+ const toAtaInfo = await connection.getAccountInfo(toAta);
2518
+ if (!toAtaInfo) {
2519
+ tx.add(
2520
+ createAssociatedTokenAccountInstruction(
2521
+ fromPubkey,
2522
+ toAta,
2523
+ toPubkey,
2524
+ mintPubkey
2525
+ )
2526
+ );
2527
+ }
2528
+ tx.add(createTransferInstruction(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
+ import { jsx as jsx9, jsxs as jsxs9 } from "react/jsx-runtime";
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] = useState8(false);
2488
2585
  const [error, setError] = useState8(null);
2489
- const targetSymbol = getTokenSymbol(targetToken, targetChain);
2586
+ const targetSymbol = getTargetTokenSymbol(targetToken, targetChain);
2490
2587
  const isSameToken = token.symbol.toUpperCase() === targetSymbol.toUpperCase();
2588
+ const sourceChainName = getChainName("solana");
2589
+ const targetChainName = getChainName(targetChain);
2590
+ const sourceChainIcon = getChainIcon("solana");
2591
+ const targetChainIcon = getChainIcon(targetChain);
2592
+ const sourceTokenIcon = getTokenIcon(token.symbol);
2593
+ const targetTokenIcon = getTokenIcon(targetSymbol);
2594
+ const feeSponsored = uiConfig?.feeSponsored ?? false;
2595
+ const feeTooltip = uiConfig?.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,7 +2605,7 @@ function SolanaConfirmStep({
2500
2605
  }
2501
2606
  return formattedAmount;
2502
2607
  })();
2503
- const receiveAmount = isSameToken ? formattedReceiveAmount : `~ ${formattedReceiveAmount}`;
2608
+ const receiveAmount = isSameToken ? formattedReceiveAmount : `~${formattedReceiveAmount}`;
2504
2609
  const handleConfirm = async () => {
2505
2610
  if (!solanaProvider) {
2506
2611
  debugLog(debug, "solana-confirm", "submit:blocked", {
@@ -2541,7 +2646,7 @@ 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() : solanaConnection ?? getSolanaConnection();
2545
2650
  const amountUnits = parseUnits4(sourceAmount, token.decimals);
2546
2651
  debugLog(debug, "solana-confirm", "tx:build:start", {
2547
2652
  token: token.symbol,
@@ -2590,162 +2695,154 @@ function SolanaConfirmStep({
2590
2695
  setIsSubmitting(false);
2591
2696
  }
2592
2697
  };
2593
- return /* @__PURE__ */ jsxs8("div", { className: "rs-step", children: [
2594
- /* @__PURE__ */ jsx8("div", { style: { padding: "0 12px 12px" }, children: /* @__PURE__ */ jsx8(BodyHeader, { icon: /* @__PURE__ */ jsx8(WalletIcon, {}), title: "Review deposit" }) }),
2595
- /* @__PURE__ */ jsxs8("div", { className: "rs-step-body rs-space-y-3", style: { paddingTop: 0 }, children: [
2596
- /* @__PURE__ */ jsxs8("div", { className: "rs-card", children: [
2597
- /* @__PURE__ */ jsxs8("div", { className: "rs-card-row", children: [
2598
- /* @__PURE__ */ jsx8("span", { className: "rs-card-label", children: "Source" }),
2599
- /* @__PURE__ */ jsxs8(
2600
- "span",
2601
- {
2602
- className: "rs-card-value",
2603
- style: { display: "flex", alignItems: "center", gap: 8 },
2604
- children: [
2605
- getChainIcon("solana") && /* @__PURE__ */ jsx8(
2606
- "img",
2607
- {
2608
- src: getChainIcon("solana"),
2609
- alt: "",
2610
- style: { width: 16, height: 16, borderRadius: 3 }
2611
- }
2612
- ),
2613
- getChainName("solana")
2614
- ]
2615
- }
2616
- )
2698
+ return /* @__PURE__ */ jsxs9("div", { className: "rs-screen", children: [
2699
+ /* @__PURE__ */ jsxs9("div", { className: "rs-screen-body rs-screen-body--gap-32", children: [
2700
+ /* @__PURE__ */ jsx9(BodyHeader, { icon: /* @__PURE__ */ jsx9(WalletIcon, {}), title: "Review deposit" }),
2701
+ /* @__PURE__ */ jsxs9("div", { className: "rs-review-details", children: [
2702
+ /* @__PURE__ */ jsxs9("div", { className: "rs-review-detail-row", children: [
2703
+ /* @__PURE__ */ jsx9("span", { children: "Source chain" }),
2704
+ /* @__PURE__ */ jsxs9("span", { className: "rs-review-detail-value", children: [
2705
+ /* @__PURE__ */ jsx9("span", { children: sourceChainName }),
2706
+ sourceChainIcon && /* @__PURE__ */ jsx9("span", { className: "rs-review-detail-icon", children: /* @__PURE__ */ jsx9("img", { src: sourceChainIcon, alt: "" }) })
2707
+ ] })
2617
2708
  ] }),
2618
- /* @__PURE__ */ jsxs8("div", { className: "rs-card-row", children: [
2619
- /* @__PURE__ */ jsx8("span", { className: "rs-card-label", children: "Destination" }),
2620
- /* @__PURE__ */ jsxs8(
2621
- "span",
2622
- {
2623
- className: "rs-card-value",
2624
- style: { display: "flex", alignItems: "center", gap: 8 },
2625
- children: [
2626
- getChainIcon(targetChain) && /* @__PURE__ */ jsx8(
2627
- "img",
2628
- {
2629
- src: getChainIcon(targetChain),
2630
- alt: "",
2631
- style: { width: 16, height: 16, borderRadius: 3 }
2632
- }
2633
- ),
2634
- getChainName(targetChain)
2635
- ]
2636
- }
2637
- )
2709
+ /* @__PURE__ */ jsxs9("div", { className: "rs-review-detail-row", children: [
2710
+ /* @__PURE__ */ jsx9("span", { children: "Destination chain" }),
2711
+ /* @__PURE__ */ jsxs9("span", { className: "rs-review-detail-value", children: [
2712
+ /* @__PURE__ */ jsx9("span", { children: targetChainName }),
2713
+ targetChainIcon && /* @__PURE__ */ jsx9("span", { className: "rs-review-detail-icon", children: /* @__PURE__ */ jsx9("img", { src: targetChainIcon, alt: "" }) })
2714
+ ] })
2638
2715
  ] }),
2639
- /* @__PURE__ */ jsxs8("div", { className: "rs-card-row", children: [
2640
- /* @__PURE__ */ jsx8("span", { className: "rs-card-label", children: "Estimated time" }),
2641
- /* @__PURE__ */ jsx8("span", { className: "rs-card-value", children: "< 1 min" })
2642
- ] })
2643
- ] }),
2644
- /* @__PURE__ */ jsxs8("div", { className: "rs-card", children: [
2645
- /* @__PURE__ */ jsxs8("div", { className: "rs-card-row", children: [
2646
- /* @__PURE__ */ jsx8("span", { className: "rs-card-label", children: "You send" }),
2647
- /* @__PURE__ */ jsxs8(
2648
- "span",
2649
- {
2650
- className: "rs-card-value",
2651
- style: { display: "flex", alignItems: "center", gap: 6 },
2652
- children: [
2653
- getTokenIcon(token.symbol) && /* @__PURE__ */ jsx8(
2654
- "img",
2655
- {
2656
- src: getTokenIcon(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__ */ jsxs9("div", { className: "rs-review-detail-row", children: [
2717
+ /* @__PURE__ */ jsx9("span", { children: "Estimated time" }),
2718
+ /* @__PURE__ */ jsx9("span", { className: "rs-review-detail-value", children: estimatedTime })
2667
2719
  ] }),
2668
- /* @__PURE__ */ jsxs8("div", { className: "rs-card-row", children: [
2669
- /* @__PURE__ */ jsx8("span", { className: "rs-card-label", children: "You receive" }),
2670
- /* @__PURE__ */ jsxs8(
2671
- "span",
2672
- {
2673
- className: "rs-card-value",
2674
- style: { display: "flex", alignItems: "center", gap: 6 },
2675
- children: [
2676
- getTokenIcon(targetSymbol) && /* @__PURE__ */ jsx8(
2677
- "img",
2678
- {
2679
- src: getTokenIcon(targetSymbol),
2680
- alt: "",
2681
- style: { width: 16, height: 16, borderRadius: "50%" }
2682
- }
2683
- ),
2684
- receiveAmount,
2685
- " ",
2686
- targetSymbol
2687
- ]
2688
- }
2689
- )
2720
+ /* @__PURE__ */ jsxs9("div", { className: "rs-review-detail-row", children: [
2721
+ /* @__PURE__ */ jsx9("span", { children: "You send" }),
2722
+ /* @__PURE__ */ jsxs9("span", { className: "rs-review-detail-value", children: [
2723
+ /* @__PURE__ */ jsxs9("span", { children: [
2724
+ formattedAmount,
2725
+ " ",
2726
+ token.symbol
2727
+ ] }),
2728
+ sourceTokenIcon && /* @__PURE__ */ jsx9("span", { className: "rs-review-detail-icon", children: /* @__PURE__ */ jsx9("img", { src: sourceTokenIcon, alt: "" }) })
2729
+ ] })
2730
+ ] }),
2731
+ /* @__PURE__ */ jsxs9("div", { className: "rs-review-detail-row", children: [
2732
+ /* @__PURE__ */ jsx9("span", { children: "Receive" }),
2733
+ /* @__PURE__ */ jsxs9("span", { className: "rs-review-detail-value", children: [
2734
+ /* @__PURE__ */ jsxs9("span", { children: [
2735
+ receiveAmount,
2736
+ " ",
2737
+ targetSymbol
2738
+ ] }),
2739
+ targetTokenIcon && /* @__PURE__ */ jsx9("span", { className: "rs-review-detail-icon", children: /* @__PURE__ */ jsx9("img", { src: targetTokenIcon, alt: "" }) })
2740
+ ] })
2741
+ ] }),
2742
+ /* @__PURE__ */ jsxs9("div", { className: "rs-review-detail-row", children: [
2743
+ /* @__PURE__ */ jsx9("span", { children: "Fees" }),
2744
+ /* @__PURE__ */ jsxs9("span", { className: "rs-review-detail-value", children: [
2745
+ /* @__PURE__ */ jsx9(
2746
+ "span",
2747
+ {
2748
+ style: feeSponsored ? { textDecoration: "line-through" } : void 0,
2749
+ children: "$0.04"
2750
+ }
2751
+ ),
2752
+ /* @__PURE__ */ jsx9(Tooltip, { content: feeTooltip, children: /* @__PURE__ */ jsx9("span", { className: "rs-review-detail-info", "aria-label": "Fee info", children: /* @__PURE__ */ jsx9(InfoIcon, {}) }) })
2753
+ ] })
2690
2754
  ] })
2691
2755
  ] }),
2692
- error && /* @__PURE__ */ jsxs8("div", { className: "rs-alert rs-alert--error", children: [
2693
- /* @__PURE__ */ jsx8(AlertTriangleIcon, { className: "rs-alert-icon" }),
2694
- /* @__PURE__ */ jsx8("span", { className: "rs-alert-text", children: error })
2695
- ] })
2756
+ error && /* @__PURE__ */ jsx9(Callout, { variant: "error", children: error }),
2757
+ /* @__PURE__ */ jsx9(
2758
+ 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__ */ jsx8("div", { className: "rs-step-footer", children: /* @__PURE__ */ jsx8(
2698
- Button,
2699
- {
2700
- onClick: handleConfirm,
2701
- loading: isSubmitting,
2702
- disabled: !sourceAmount || Number(sourceAmount) <= 0,
2703
- fullWidth: true,
2704
- children: "Continue"
2705
- }
2706
- ) }),
2707
- /* @__PURE__ */ jsx8(PoweredBy, {})
2769
+ /* @__PURE__ */ jsx9(PoweredBy, {})
2708
2770
  ] });
2709
2771
  }
2710
2772
 
2711
2773
  // src/components/steps/DappImportAssetSelectStep.tsx
2712
- import { jsx as jsx9, jsxs as jsxs9 } from "react/jsx-runtime";
2774
+ import { jsx as jsx10, jsxs as jsxs10 } from "react/jsx-runtime";
2713
2775
  function DappImportAssetSelectStep({
2714
2776
  sourceLabel,
2715
2777
  assets,
2716
2778
  onSelect
2717
2779
  }) {
2718
- return /* @__PURE__ */ jsxs9("div", { className: "rs-screen", children: [
2719
- /* @__PURE__ */ jsxs9("div", { className: "rs-screen-body rs-screen-body--gap-32", children: [
2720
- /* @__PURE__ */ jsx9(
2780
+ return /* @__PURE__ */ jsxs10("div", { className: "rs-screen", children: [
2781
+ /* @__PURE__ */ jsxs10("div", { className: "rs-screen-body rs-screen-body--gap-32", children: [
2782
+ /* @__PURE__ */ jsx10(
2721
2783
  BodyHeader,
2722
2784
  {
2723
- icon: /* @__PURE__ */ jsx9(HandCoinsIcon, {}),
2785
+ icon: /* @__PURE__ */ jsx10(WalletIcon, {}),
2724
2786
  title: `Transfer from ${sourceLabel}`,
2725
2787
  subtitle: "Pick the balance to import"
2726
2788
  }
2727
2789
  ),
2728
- /* @__PURE__ */ jsx9("div", { className: "rs-list", children: assets.map((asset) => {
2729
- const balanceTokens = asset.balance ? tokenFormatter.format(
2790
+ /* @__PURE__ */ jsx10("div", { className: "rs-asset-list", children: assets.map((asset) => {
2791
+ const tokenAmount = asset.balance ? tokenFormatter.format(
2730
2792
  Number(asset.balance) / 10 ** asset.decimals
2731
2793
  ) : "0";
2732
- const balanceUsd = asset.balanceUsd && asset.balanceUsd > 0 ? currencyFormatter.format(asset.balanceUsd) : `${balanceTokens} ${asset.symbol}`;
2733
- const iconSrc = getTokenIcon(asset.symbol);
2734
- return /* @__PURE__ */ jsx9(
2735
- ListRow,
2794
+ const balanceUsd = asset.balanceUsd && asset.balanceUsd > 0 ? currencyFormatter.format(asset.balanceUsd) : `${tokenAmount} ${asset.symbol}`;
2795
+ const tokenIcon = asset.icon ?? getTokenIcon(asset.symbol);
2796
+ const chainIcon = getChainIcon(asset.chainId);
2797
+ const badge = getChainBadge(asset.chainId);
2798
+ return /* @__PURE__ */ jsxs10(
2799
+ "button",
2736
2800
  {
2737
- leadingMedia: iconSrc || void 0,
2738
- leading: iconSrc ? void 0 : /* @__PURE__ */ jsx9(HandCoinsIcon, {}),
2739
- title: asset.symbol,
2740
- subtitle: `${balanceTokens} on ${getChainName(asset.chainId)}`,
2741
- meta: balanceUsd,
2742
- onClick: () => onSelect(asset)
2801
+ type: "button",
2802
+ className: "rs-asset-row",
2803
+ onClick: () => onSelect(asset),
2804
+ children: [
2805
+ /* @__PURE__ */ jsxs10("div", { className: "rs-asset-info", children: [
2806
+ /* @__PURE__ */ jsxs10("div", { className: "rs-asset-icon-wrapper", children: [
2807
+ /* @__PURE__ */ jsx10("span", { className: "rs-asset-icon", children: tokenIcon ? /* @__PURE__ */ jsx10("img", { src: tokenIcon, alt: asset.symbol }) : asset.symbol.slice(0, 4) }),
2808
+ chainIcon ? /* @__PURE__ */ jsx10("span", { className: "rs-asset-chain-badge", children: /* @__PURE__ */ jsx10(
2809
+ "img",
2810
+ {
2811
+ src: chainIcon,
2812
+ alt: getChainName(asset.chainId)
2813
+ }
2814
+ ) }) : /* @__PURE__ */ jsx10(
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__ */ jsxs10("div", { className: "rs-asset-text", children: [
2824
+ /* @__PURE__ */ jsxs10("div", { className: "rs-asset-name-row", children: [
2825
+ /* @__PURE__ */ jsx10("span", { className: "rs-asset-name", children: asset.symbol }),
2826
+ /* @__PURE__ */ jsxs10("span", { className: "rs-asset-chain", children: [
2827
+ "on ",
2828
+ asset.sourceLabel
2829
+ ] })
2830
+ ] }),
2831
+ /* @__PURE__ */ jsxs10("div", { className: "rs-asset-balance-small", children: [
2832
+ tokenAmount,
2833
+ " ",
2834
+ asset.symbol
2835
+ ] })
2836
+ ] })
2837
+ ] }),
2838
+ /* @__PURE__ */ jsx10("div", { className: "rs-asset-balance", children: balanceUsd })
2839
+ ]
2743
2840
  },
2744
2841
  asset.id
2745
2842
  );
2746
2843
  }) })
2747
2844
  ] }),
2748
- /* @__PURE__ */ jsx9(PoweredBy, {})
2845
+ /* @__PURE__ */ jsx10(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
+ import {
2865
+ encodeFunctionData,
2866
+ erc20Abi as erc20Abi3,
2867
+ parseAbi
2868
+ } from "viem";
2869
+ var COLLATERAL_OFFRAMP_ABI = parseAbi([
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: 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: encodeFunctionData({
2999
+ abi: erc20Abi3,
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: encodeFunctionData({
3012
+ abi: erc20Abi3,
3013
+ functionName: "approve",
3014
+ args: [POLYMARKET_COLLATERAL_OFFRAMP_ADDRESS, amount]
3015
+ })
3016
+ },
3017
+ {
3018
+ target: POLYMARKET_COLLATERAL_OFFRAMP_ADDRESS,
3019
+ value: 0n,
3020
+ data: encodeFunctionData({
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
  import { getAddress, isAddress, zeroAddress } from "viem";
2768
3031
  async function fetchPolymarketProxyWallet(eoa, signal) {
@@ -2796,19 +3059,19 @@ async function fetchPolymarketProxyWallet(eoa, signal) {
2796
3059
  // src/core/dapp-imports/polymarket/safe.ts
2797
3060
  import {
2798
3061
  concat,
2799
- encodeFunctionData,
3062
+ encodeFunctionData as encodeFunctionData2,
2800
3063
  encodePacked,
2801
- erc20Abi as erc20Abi3,
3064
+ erc20Abi as erc20Abi4,
2802
3065
  pad,
2803
- parseAbi,
3066
+ parseAbi as parseAbi2,
2804
3067
  parseEventLogs,
2805
3068
  toHex,
2806
3069
  zeroAddress as zeroAddress2
2807
3070
  } from "viem";
2808
- var COLLATERAL_OFFRAMP_ABI = parseAbi([
3071
+ var COLLATERAL_OFFRAMP_ABI2 = parseAbi2([
2809
3072
  "function unwrap(address _asset, address _to, uint256 _amount)"
2810
3073
  ]);
2811
- var MULTI_SEND_ABI = parseAbi(["function multiSend(bytes transactions)"]);
3074
+ var MULTI_SEND_ABI = parseAbi2(["function multiSend(bytes transactions)"]);
2812
3075
  async function readPolymarketBalances(params) {
2813
3076
  const { publicClient, proxyWallet } = params;
2814
3077
  try {
@@ -2817,13 +3080,13 @@ async function readPolymarketBalances(params) {
2817
3080
  contracts: [
2818
3081
  {
2819
3082
  address: POLYMARKET_PUSD_ADDRESS,
2820
- abi: erc20Abi3,
3083
+ abi: erc20Abi4,
2821
3084
  functionName: "balanceOf",
2822
3085
  args: [proxyWallet]
2823
3086
  },
2824
3087
  {
2825
3088
  address: POLYMARKET_USDCE_ADDRESS,
2826
- abi: erc20Abi3,
3089
+ abi: erc20Abi4,
2827
3090
  functionName: "balanceOf",
2828
3091
  args: [proxyWallet]
2829
3092
  }
@@ -2915,8 +3178,8 @@ async function executePolymarketSafeTransfer(params) {
2915
3178
  function buildUsdceTransferSafeTx(recipient, amount) {
2916
3179
  return {
2917
3180
  to: POLYMARKET_USDCE_ADDRESS,
2918
- data: encodeFunctionData({
2919
- abi: erc20Abi3,
3181
+ data: encodeFunctionData2({
3182
+ abi: erc20Abi4,
2920
3183
  functionName: "transfer",
2921
3184
  args: [recipient, amount]
2922
3185
  }),
@@ -2924,19 +3187,19 @@ function buildUsdceTransferSafeTx(recipient, amount) {
2924
3187
  };
2925
3188
  }
2926
3189
  function buildPusdUnwrapSafeTx(recipient, amount) {
2927
- const approveData = encodeFunctionData({
2928
- abi: erc20Abi3,
3190
+ const approveData = encodeFunctionData2({
3191
+ abi: erc20Abi4,
2929
3192
  functionName: "approve",
2930
3193
  args: [POLYMARKET_COLLATERAL_OFFRAMP_ADDRESS, amount]
2931
3194
  });
2932
- const unwrapData = encodeFunctionData({
2933
- abi: COLLATERAL_OFFRAMP_ABI,
3195
+ const unwrapData = encodeFunctionData2({
3196
+ abi: COLLATERAL_OFFRAMP_ABI2,
2934
3197
  functionName: "unwrap",
2935
3198
  args: [POLYMARKET_USDCE_ADDRESS, recipient, amount]
2936
3199
  });
2937
3200
  return {
2938
3201
  to: SAFE_MULTI_SEND_CALL_ONLY_ADDRESS,
2939
- data: encodeFunctionData({
3202
+ data: encodeFunctionData2({
2940
3203
  abi: MULTI_SEND_ABI,
2941
3204
  functionName: "multiSend",
2942
3205
  args: [
@@ -2979,12 +3242,23 @@ var polymarketProvider = {
2979
3242
  });
2980
3243
  if (signal?.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 (signal?.aborted) return null;
3251
+ if (!walletKind) return null;
2982
3252
  const assets = [];
2983
3253
  if (balances.pusd > 0n) {
2984
- assets.push(buildAsset({ tokenKind: "pusd", proxyWallet, balance: balances.pusd }));
3254
+ assets.push(
3255
+ buildAsset({ tokenKind: "pusd", proxyWallet, walletKind, balance: balances.pusd })
3256
+ );
2985
3257
  }
2986
3258
  if (balances.usdce > 0n) {
2987
- assets.push(buildAsset({ tokenKind: "usdce", proxyWallet, balance: balances.usdce }));
3259
+ assets.push(
3260
+ buildAsset({ tokenKind: "usdce", proxyWallet, walletKind, balance: balances.usdce })
3261
+ );
2988
3262
  }
2989
3263
  const totalUsd = assets.reduce((sum, a) => sum + (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({ walletClient, publicClient, recipient, asset, amount }) {
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(formatUnits6(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
+ import { base } from "viem/chains";
3358
+
3052
3359
  // src/store/index.ts
3053
3360
  import { createContext, createElement as createElement2, useContext } from "react";
3054
3361
  import { useStore } from "zustand";
@@ -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.toLowerCase(),
3694
- recipient: input.recipient?.toLowerCase(),
4004
+ targetToken: normalizeKeyToken(input.targetToken),
4005
+ recipient: normalizeKeyToken(input.recipient),
3695
4006
  outputTokenRules: input.outputTokenRules ?? null,
3696
4007
  rejectUnmapped: 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.toLowerCase(),
3710
- recipient: input.recipient?.toLowerCase(),
4020
+ targetToken: normalizeKeyToken(input.targetToken),
4021
+ recipient: normalizeKeyToken(input.recipient),
3711
4022
  outputTokenRules: input.outputTokenRules ?? null,
3712
4023
  rejectUnmapped: input.rejectUnmapped ?? null,
3713
4024
  signerAddress: input.signerAddress.toLowerCase(),
@@ -3743,7 +4054,7 @@ async function runAccountSetup(input, deps) {
3743
4054
  const setup = await service.setupAccount({
3744
4055
  ownerAddress: input.ownerAddress,
3745
4056
  sessionOwnerAddress: sessionOwner.address,
3746
- targetChain: toEvmCaip2(input.targetChain),
4057
+ targetChain: targetChainToCaip2(input.targetChain),
3747
4058
  targetToken: input.targetToken,
3748
4059
  recipient: input.recipient,
3749
4060
  postBridgeActions: input.postBridgeActions,
@@ -3796,7 +4107,7 @@ async function runAccountSetup(input, deps) {
3796
4107
  eoaAddress: input.ownerAddress,
3797
4108
  sessionOwner: sessionOwner.address,
3798
4109
  target: {
3799
- chain: toEvmCaip2(input.targetChain),
4110
+ chain: targetChainToCaip2(input.targetChain),
3800
4111
  token: input.targetToken,
3801
4112
  ...input.recipient && { recipient: input.recipient },
3802
4113
  ...input.postBridgeActions?.length && {
@@ -3878,7 +4189,7 @@ function mapError(error) {
3878
4189
  "server"
3879
4190
  );
3880
4191
  }
3881
- return new SetupError("Couldn't prepare account.", "client");
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.",
@@ -3892,23 +4203,23 @@ function mapError(error) {
3892
4203
  }
3893
4204
 
3894
4205
  // src/DepositFlow.tsx
3895
- import { Fragment as Fragment3, jsx as jsx10, jsxs as jsxs10 } from "react/jsx-runtime";
4206
+ import { Fragment as Fragment3, jsx as jsx11, jsxs as jsxs11 } from "react/jsx-runtime";
3896
4207
  function AccountPreparingSkeleton({
3897
4208
  errorMessage,
3898
4209
  onRetry
3899
4210
  }) {
3900
- return /* @__PURE__ */ jsxs10("div", { className: "rs-step", children: [
3901
- /* @__PURE__ */ jsx10("div", { className: "rs-step-body", style: { paddingTop: 0 }, children: /* @__PURE__ */ jsx10("div", { className: "rs-loading-state", children: /* @__PURE__ */ jsx10("div", { className: "rs-loading-text", children: errorMessage ? /* @__PURE__ */ jsxs10(Fragment3, { children: [
3902
- /* @__PURE__ */ jsx10("div", { className: "rs-loading-title rs-text-error", children: "Couldn\u2019t prepare account" }),
3903
- /* @__PURE__ */ jsx10("div", { className: "rs-loading-subtitle", children: errorMessage })
3904
- ] }) : /* @__PURE__ */ jsx10("div", { className: "rs-loading-title", children: "Preparing\u2026" }) }) }) }),
3905
- errorMessage && onRetry && /* @__PURE__ */ jsx10("div", { className: "rs-step-footer", children: /* @__PURE__ */ jsx10(
4211
+ return /* @__PURE__ */ jsxs11("div", { className: "rs-step", children: [
4212
+ /* @__PURE__ */ jsx11("div", { className: "rs-step-body", style: { paddingTop: 0 }, children: /* @__PURE__ */ jsx11("div", { className: "rs-loading-state", children: /* @__PURE__ */ jsx11("div", { className: "rs-loading-text", children: errorMessage ? /* @__PURE__ */ jsxs11(Fragment3, { children: [
4213
+ /* @__PURE__ */ jsx11("div", { className: "rs-loading-title rs-text-error", children: "Couldn\u2019t prepare account" }),
4214
+ /* @__PURE__ */ jsx11("div", { className: "rs-loading-subtitle", children: errorMessage })
4215
+ ] }) : /* @__PURE__ */ jsx11("div", { className: "rs-loading-title", children: "Preparing\u2026" }) }) }) }),
4216
+ errorMessage && onRetry && /* @__PURE__ */ jsx11("div", { className: "rs-step-footer", children: /* @__PURE__ */ jsx11(
3906
4217
  "button",
3907
4218
  {
3908
4219
  type: "button",
3909
4220
  className: "rs-button rs-button--default rs-button--full-width",
3910
4221
  onClick: onRetry,
3911
- children: /* @__PURE__ */ jsx10("span", { children: "Try again" })
4222
+ children: /* @__PURE__ */ jsx11("span", { children: "Try again" })
3912
4223
  }
3913
4224
  ) })
3914
4225
  ] });
@@ -4042,6 +4353,7 @@ function DepositFlow({
4042
4353
  sourceToken: defaultSourceToken,
4043
4354
  amount: defaultAmount,
4044
4355
  recipient,
4356
+ appBalanceUsd,
4045
4357
  postBridgeActions,
4046
4358
  outputTokenRules,
4047
4359
  rejectUnmapped,
@@ -4084,29 +4396,26 @@ function DepositFlow({
4084
4396
  const hasNavigatedBack = flowSlice.hasNavigatedBack;
4085
4397
  const selectedWalletId = useDepositStore(selectedWalletIdSelector);
4086
4398
  const [totalBalanceUsd, setTotalBalanceUsd] = useState9(0);
4087
- const [targetBalanceUsd, setTargetBalanceUsd] = useState9(
4088
- void 0
4089
- );
4090
4399
  const [hasQrAutoAdvanceGraceElapsed, setHasQrAutoAdvanceGraceElapsed] = useState9(() => !hasInitialWalletHydrationPending);
4091
- const portfolioAssetsRef = useRef5([]);
4092
- const stableWalletSignerRef = useRef5(null);
4093
- const stableWalletSelectionKeyRef = useRef5(null);
4094
- const logFlow = useCallback3(
4400
+ const portfolioAssetsRef = useRef7([]);
4401
+ const stableWalletSignerRef = useRef7(null);
4402
+ const stableWalletSelectionKeyRef = useRef7(null);
4403
+ const logFlow = useCallback4(
4095
4404
  (message, data) => {
4096
4405
  debugLog(debug, "deposit-flow", message, data);
4097
4406
  },
4098
4407
  [debug]
4099
4408
  );
4100
- const logFlowError = useCallback3(
4409
+ const logFlowError = useCallback4(
4101
4410
  (message, error, data) => {
4102
4411
  debugError(debug, "deposit-flow", message, error, data);
4103
4412
  },
4104
4413
  [debug]
4105
4414
  );
4106
- const handleAssetsLoaded = useCallback3((assets) => {
4415
+ const handleAssetsLoaded = useCallback4((assets) => {
4107
4416
  portfolioAssetsRef.current = assets;
4108
4417
  }, []);
4109
- const getTokenPriceUsd = useCallback3((symbol) => {
4418
+ const getTokenPriceUsd = useCallback4((symbol) => {
4110
4419
  const sym = symbol.toLowerCase();
4111
4420
  for (const asset of portfolioAssetsRef.current) {
4112
4421
  if (asset.symbol.toLowerCase() === sym && asset.balanceUsd && asset.balance) {
@@ -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 : base.id;
4527
+ const targetSymbol = getTargetTokenSymbol(targetToken, targetChain);
4528
+ const isTargetStablecoin = isStablecoinSymbol(targetSymbol);
4529
+ const targetMarketPriceRef = useRef7(null);
4530
+ useEffect8(() => {
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 = useMemo6(() => {
4218
4546
  if (flowMode === "deposit-address") {
4219
4547
  return null;
@@ -4223,12 +4551,12 @@ function DepositFlow({
4223
4551
  return {
4224
4552
  ownerAddress: dappAddress,
4225
4553
  walletClient: void 0,
4226
- publicClient: dappPublicClient ?? getPublicClient(targetChain),
4554
+ publicClient: dappPublicClient ?? getPublicClient(setupChainId),
4227
4555
  switchChain: void 0
4228
4556
  };
4229
4557
  }
4230
4558
  if (canAutoLock) {
4231
- const fallbackChainId = dappWalletClient?.chain?.id ?? targetChain;
4559
+ const fallbackChainId = dappWalletClient?.chain?.id ?? setupChainId;
4232
4560
  return {
4233
4561
  ownerAddress: dappWalletClient.account.address,
4234
4562
  walletClient: dappWalletClient,
@@ -4246,12 +4574,12 @@ function DepositFlow({
4246
4574
  return {
4247
4575
  ownerAddress: dappAddress,
4248
4576
  walletClient: void 0,
4249
- publicClient: dappPublicClient ?? getPublicClient(targetChain),
4577
+ publicClient: dappPublicClient ?? getPublicClient(setupChainId),
4250
4578
  switchChain: void 0
4251
4579
  };
4252
4580
  }
4253
4581
  if (selectedOption.kind === "connected" && dappWalletClient?.account && selectedOption.address && dappWalletClient.account.address.toLowerCase() === selectedOption.address.toLowerCase()) {
4254
- const fallbackChainId = dappWalletClient?.chain?.id ?? targetChain;
4582
+ const fallbackChainId = dappWalletClient?.chain?.id ?? setupChainId;
4255
4583
  return {
4256
4584
  ownerAddress: dappWalletClient.account.address,
4257
4585
  walletClient: dappWalletClient,
@@ -4263,7 +4591,7 @@ function DepositFlow({
4263
4591
  return {
4264
4592
  ownerAddress: reownWallet.address,
4265
4593
  walletClient: reownWallet.walletClient,
4266
- publicClient: reownWallet.publicClient ?? getPublicClient(targetChain),
4594
+ publicClient: reownWallet.publicClient ?? getPublicClient(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
- targetChain
4609
+ setupChainId
4282
4610
  ]);
4283
4611
  useEffect8(() => {
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: dappPublicClient ?? getPublicClient(targetChain),
4632
+ publicClient: dappPublicClient ?? getPublicClient(setupChainId),
4305
4633
  switchChain: void 0
4306
4634
  };
4307
4635
  }
@@ -4319,7 +4647,7 @@ function DepositFlow({
4319
4647
  flowMode,
4320
4648
  dappAddress,
4321
4649
  dappPublicClient,
4322
- targetChain,
4650
+ setupChainId,
4323
4651
  walletSignerContext,
4324
4652
  walletSelectionKey
4325
4653
  ]);
@@ -4367,27 +4695,7 @@ function DepositFlow({
4367
4695
  () => readSetupForOwner(setupSlice, activeOwner),
4368
4696
  [setupSlice, activeOwner]
4369
4697
  );
4370
- const activeSmartAccount = activeEntry.smartAccount;
4371
- useEffect8(() => {
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(target?.balanceUsd ?? 0);
4383
- }).catch(() => {
4384
- if (active) setTargetBalanceUsd(0);
4385
- });
4386
- return () => {
4387
- active = false;
4388
- };
4389
- }, [activeSmartAccount, targetChain, targetToken, service]);
4390
- const lastActiveSetupLifecycleKeyRef = useRef5(null);
4698
+ const lastActiveSetupLifecycleKeyRef = useRef7(null);
4391
4699
  useEffect8(() => {
4392
4700
  if (!flowMode || !isConnectSelectionConfirmed) {
4393
4701
  lastActiveSetupLifecycleKeyRef.current = null;
@@ -4429,7 +4737,7 @@ function DepositFlow({
4429
4737
  [flowSlice, depositSlice, processingSlice, activeEntry]
4430
4738
  );
4431
4739
  const step = effectiveStep;
4432
- const handleBack = useCallback3(() => {
4740
+ const handleBack = useCallback4(() => {
4433
4741
  const stepBeforeBack = storeApi.getState().flow.step;
4434
4742
  storeApi.dispatch({
4435
4743
  type: "back/requested",
@@ -4447,7 +4755,7 @@ function DepositFlow({
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;
4450
- const lastStepOpenEventKeyRef = useRef5(null);
4758
+ const lastStepOpenEventKeyRef = useRef7(null);
4451
4759
  useEffect8(() => {
4452
4760
  if (!stepOpenEventKey) {
4453
4761
  lastStepOpenEventKeyRef.current = null;
@@ -4465,7 +4773,7 @@ function DepositFlow({
4465
4773
  });
4466
4774
  } else if (effectiveStep.type === "deposit-address") {
4467
4775
  const chainName = getChainName(targetChain);
4468
- const tokenSymbol = getTokenSymbol(targetToken, targetChain);
4776
+ const tokenSymbol = getTargetTokenSymbol(targetToken, targetChain);
4469
4777
  onEventRef.current?.({
4470
4778
  type: "deposit_modal_transfer_crypto_open",
4471
4779
  default_chain: chainName,
@@ -4473,7 +4781,7 @@ function DepositFlow({
4473
4781
  pred_balance: totalBalanceUsd
4474
4782
  });
4475
4783
  } else if (effectiveStep.type === "amount" && stepSendToken) {
4476
- const receiveSymbol = getTokenSymbol(targetToken, targetChain);
4784
+ const receiveSymbol = getTargetTokenSymbol(targetToken, targetChain);
4477
4785
  onEventRef.current?.({
4478
4786
  type: "deposit_modal_connected_wallet_enter_value_open",
4479
4787
  send_token: stepSendToken,
@@ -4515,10 +4823,10 @@ function DepositFlow({
4515
4823
  const isDepositAddressMode = flowMode === "deposit-address";
4516
4824
  const isSolanaWalletMode = flowMode === "solana-wallet";
4517
4825
  const isDappImportMode = flowMode === "dapp-import";
4518
- const handleSelectTransferCrypto = useCallback3(() => {
4826
+ const handleSelectTransferCrypto = useCallback4(() => {
4519
4827
  storeApi.dispatch({ type: "connect/transfer-crypto-selected" });
4520
4828
  }, [storeApi]);
4521
- const handleConfirmWallet = useCallback3(
4829
+ const handleConfirmWallet = useCallback4(
4522
4830
  (walletId) => {
4523
4831
  const selectedOption = walletOptions.find((o) => o.id === walletId);
4524
4832
  const mode = enableSolana && selectedOption?.kind === "solana" ? "solana-wallet" : "wallet";
@@ -4530,11 +4838,16 @@ function DepositFlow({
4530
4838
  },
4531
4839
  [walletOptions, enableSolana, storeApi]
4532
4840
  );
4841
+ const isSolanaWalletConnected = Boolean(
4842
+ enableSolana && reownWallet?.isConnected && reownWallet?.isSolana
4843
+ );
4844
+ const dappImportsKey = dappImports ? Object.keys(dappImports).filter((k) => dappImports[k]).sort().join(",") : "";
4533
4845
  const enabledDappImportProviders = useMemo6(
4534
- () => getEnabledProviders(dappImports),
4535
- [dappImports]
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
- const handleSelectDappImport = useCallback3(
4850
+ const handleSelectDappImport = useCallback4(
4538
4851
  (providerId) => {
4539
4852
  const owner = dappImportOwner;
4540
4853
  if (owner) {
@@ -4555,7 +4868,7 @@ function DepositFlow({
4555
4868
  },
4556
4869
  [storeApi, walletOptions, dappImportOwner]
4557
4870
  );
4558
- const handleDappImportAssetSelected = useCallback3(
4871
+ const handleDappImportAssetSelected = useCallback4(
4559
4872
  (asset) => {
4560
4873
  storeApi.dispatch({ type: "dapp-import/asset-selected", asset });
4561
4874
  },
@@ -4677,7 +4990,7 @@ function DepositFlow({
4677
4990
  dappImportAvailabilityOwner,
4678
4991
  dappImportOwner
4679
4992
  ]);
4680
- const handleNewDeposit = useCallback3(() => {
4993
+ const handleNewDeposit = useCallback4(() => {
4681
4994
  onLifecycleRef.current?.({
4682
4995
  type: "smart-account-changed",
4683
4996
  evm: null,
@@ -4830,7 +5143,7 @@ function DepositFlow({
4830
5143
  storeApi,
4831
5144
  setupSlice.byOwner
4832
5145
  ]);
4833
- const handleDepositAddressSubmitted = useCallback3(
5146
+ const handleDepositAddressSubmitted = useCallback4(
4834
5147
  (data) => {
4835
5148
  logFlow("deposit-address:detected", {
4836
5149
  txHash: data.txHash,
@@ -4841,7 +5154,7 @@ function DepositFlow({
4841
5154
  },
4842
5155
  [logFlow, onLifecycleRef]
4843
5156
  );
4844
- const handleSolanaTokenContinue = useCallback3(
5157
+ const handleSolanaTokenContinue = useCallback4(
4845
5158
  (token, balance, balanceUsd) => {
4846
5159
  logFlow("solana:token:continue", { token: token.symbol });
4847
5160
  storeApi.dispatch({
@@ -4854,11 +5167,11 @@ function DepositFlow({
4854
5167
  },
4855
5168
  [defaultAmount, logFlow, storeApi]
4856
5169
  );
4857
- const handleSolanaAmountContinue = useCallback3(
5170
+ const handleSolanaAmountContinue = useCallback4(
4858
5171
  (token, sourceAmount, inputAmountUsd) => {
4859
- const targetSym = getTokenSymbol(targetToken, targetChain);
5172
+ const targetSym = getTargetTokenSymbol(targetToken, targetChain);
4860
5173
  const isTargetStable = isStablecoinSymbol(targetSym);
4861
- const targetTokenPriceUsd = isTargetStable ? 1 : getTokenPriceUsd(targetSym);
5174
+ const targetTokenPriceUsd = isTargetStable ? 1 : getTokenPriceUsd(targetSym) ?? targetMarketPriceRef.current;
4862
5175
  logFlow("solana:amount:continue", {
4863
5176
  token: token.symbol,
4864
5177
  sourceAmount,
@@ -4876,7 +5189,7 @@ function DepositFlow({
4876
5189
  },
4877
5190
  [targetToken, targetChain, getTokenPriceUsd, logFlow, storeApi]
4878
5191
  );
4879
- const handleSolanaConfirmed = useCallback3(
5192
+ const handleSolanaConfirmed = useCallback4(
4880
5193
  (txHash, amountUnits) => {
4881
5194
  const tokenAtSubmit = storeApi.getState().deposit.selectedSolanaToken;
4882
5195
  if (!tokenAtSubmit) return;
@@ -4903,7 +5216,7 @@ function DepositFlow({
4903
5216
  },
4904
5217
  [logFlow, onLifecycleRef, storeApi]
4905
5218
  );
4906
- const handleAssetContinue = useCallback3(
5219
+ const handleAssetContinue = useCallback4(
4907
5220
  (asset) => {
4908
5221
  onEventRef.current?.({
4909
5222
  type: "deposit_modal_connected_wallet_select_source_cta_click",
@@ -4921,16 +5234,16 @@ function DepositFlow({
4921
5234
  },
4922
5235
  [defaultAmount, onEventRef, totalBalanceUsd, storeApi]
4923
5236
  );
4924
- const handleAmountContinue = useCallback3(
5237
+ const handleAmountContinue = useCallback4(
4925
5238
  (amount, targetAmount, balance, liquidityWarning) => {
4926
5239
  const entry = readSetupForOwner(
4927
5240
  storeApi.getState().setup,
4928
5241
  activeOwner
4929
5242
  );
4930
5243
  if (entry.status !== "ready") return;
4931
- const targetSym = getTokenSymbol(targetToken, targetChain);
5244
+ const targetSym = getTargetTokenSymbol(targetToken, targetChain);
4932
5245
  const isTargetStable = isStablecoinSymbol(targetSym);
4933
- const targetTokenPriceUsd = isTargetStable ? 1 : getTokenPriceUsd(targetSym);
5246
+ const targetTokenPriceUsd = isTargetStable ? 1 : getTokenPriceUsd(targetSym) ?? targetMarketPriceRef.current;
4934
5247
  storeApi.dispatch({
4935
5248
  type: "amount/entered",
4936
5249
  amount,
@@ -4942,7 +5255,7 @@ function DepositFlow({
4942
5255
  },
4943
5256
  [targetToken, targetChain, getTokenPriceUsd, storeApi, activeOwner]
4944
5257
  );
4945
- const handleDepositSubmitted = useCallback3(
5258
+ const handleDepositSubmitted = useCallback4(
4946
5259
  (txHash, chainId, amount, token) => {
4947
5260
  logFlow("evm:submitted", {
4948
5261
  txHash,
@@ -4965,7 +5278,7 @@ function DepositFlow({
4965
5278
  },
4966
5279
  [logFlow, storeApi, targetChain, targetToken]
4967
5280
  );
4968
- const handleDepositSubmittedCallback = useCallback3(
5281
+ const handleDepositSubmittedCallback = useCallback4(
4969
5282
  (txHash, sourceChain, amount) => {
4970
5283
  onLifecycleRef.current?.({
4971
5284
  type: "submitted",
@@ -4976,7 +5289,7 @@ function DepositFlow({
4976
5289
  },
4977
5290
  [onLifecycleRef]
4978
5291
  );
4979
- const handleDepositComplete = useCallback3(
5292
+ const handleDepositComplete = useCallback4(
4980
5293
  (txHash, destinationTxHash, context) => {
4981
5294
  logFlow("deposit:complete", { txHash, destinationTxHash, ...context });
4982
5295
  onLifecycleRef.current?.({
@@ -4988,21 +5301,21 @@ function DepositFlow({
4988
5301
  },
4989
5302
  [logFlow, onLifecycleRef]
4990
5303
  );
4991
- const handleDepositFailed = useCallback3(
5304
+ const handleDepositFailed = useCallback4(
4992
5305
  (txHash, error) => {
4993
5306
  logFlowError("deposit:failed", error, { txHash });
4994
5307
  onLifecycleRef.current?.({ type: "failed", txHash, error });
4995
5308
  },
4996
5309
  [logFlowError, onLifecycleRef]
4997
5310
  );
4998
- const handleError = useCallback3(
5311
+ const handleError = useCallback4(
4999
5312
  (message, code) => {
5000
5313
  logFlowError("flow:error", message, { code });
5001
5314
  onErrorRef.current?.({ message, code });
5002
5315
  },
5003
5316
  [logFlowError, onErrorRef]
5004
5317
  );
5005
- const handleTotalBalanceComputed = useCallback3((total) => {
5318
+ const handleTotalBalanceComputed = useCallback4((total) => {
5006
5319
  setTotalBalanceUsd(total);
5007
5320
  }, []);
5008
5321
  const walletOptionsKey = useMemo6(
@@ -5072,14 +5385,14 @@ function DepositFlow({
5072
5385
  [setupSlice, dappAddress]
5073
5386
  );
5074
5387
  const transferCryptoState = transferCryptoEntry.status === "ready" ? "ready" : transferCryptoEntry.status === "error" ? "error" : "loading";
5075
- const handleRetrySetup = useCallback3(
5388
+ const handleRetrySetup = useCallback4(
5076
5389
  (owner) => {
5077
5390
  storeApi.dispatch({ type: "setup/retry-requested", owner });
5078
5391
  },
5079
5392
  [storeApi]
5080
5393
  );
5081
5394
  if (showConnectStep) {
5082
- return /* @__PURE__ */ jsx10("div", { className: "rs-modal-body", children: /* @__PURE__ */ jsx10(
5395
+ return /* @__PURE__ */ jsx11("div", { className: "rs-modal-body", children: /* @__PURE__ */ jsx11(
5083
5396
  ConnectStep,
5084
5397
  {
5085
5398
  walletRows,
@@ -5126,19 +5439,20 @@ function DepositFlow({
5126
5439
  }
5127
5440
  if (isDepositAddressMode) {
5128
5441
  if (!dappAddress) return null;
5129
- return /* @__PURE__ */ jsxs10("div", { className: "rs-modal-body", children: [
5130
- effectiveStep.type === "setup" && /* @__PURE__ */ jsx10(
5442
+ return /* @__PURE__ */ jsxs11("div", { className: "rs-modal-body", children: [
5443
+ effectiveStep.type === "setup" && /* @__PURE__ */ jsx11(
5131
5444
  AccountPreparingSkeleton,
5132
5445
  {
5133
5446
  errorMessage: activeEntry.status === "error" ? activeEntry.message ?? void 0 : void 0,
5134
5447
  onRetry: activeEntry.status === "error" ? () => handleRetrySetup(dappAddress) : void 0
5135
5448
  }
5136
5449
  ),
5137
- effectiveStep.type === "deposit-address" && /* @__PURE__ */ jsx10(
5450
+ effectiveStep.type === "deposit-address" && /* @__PURE__ */ jsx11(
5138
5451
  DepositAddressStep,
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,
@@ -5151,7 +5465,7 @@ function DepositFlow({
5151
5465
  onDepositFailed: handleDepositFailed,
5152
5466
  onCopyAddress: () => {
5153
5467
  const chainName = getChainName(targetChain);
5154
- const tokenSymbol = getTokenSymbol(targetToken, targetChain);
5468
+ const tokenSymbol = getTargetTokenSymbol(targetToken, targetChain);
5155
5469
  onEvent?.({
5156
5470
  type: "deposit_modal_transfer_crypto_cta_click",
5157
5471
  default_chain: chainName,
@@ -5170,25 +5484,29 @@ function DepositFlow({
5170
5484
  if (!dappAddress) return null;
5171
5485
  const solanaAddr = reownWallet?.solanaAddress;
5172
5486
  const solanaProvider = reownWallet?.solanaProvider;
5173
- return /* @__PURE__ */ jsxs10("div", { className: "rs-modal-body", children: [
5174
- effectiveStep.type === "setup" && /* @__PURE__ */ jsx10(
5487
+ return /* @__PURE__ */ jsxs11("div", { className: "rs-modal-body", children: [
5488
+ effectiveStep.type === "setup" && /* @__PURE__ */ jsx11(
5175
5489
  AccountPreparingSkeleton,
5176
5490
  {
5177
5491
  errorMessage: activeEntry.status === "error" ? activeEntry.message ?? void 0 : void 0,
5178
5492
  onRetry: activeEntry.status === "error" ? () => handleRetrySetup(dappAddress) : void 0
5179
5493
  }
5180
5494
  ),
5181
- effectiveStep.type === "solana-token-select" && solanaAddr && /* @__PURE__ */ jsx10(
5495
+ effectiveStep.type === "solana-token-select" && solanaAddr && /* @__PURE__ */ jsx11(
5182
5496
  SolanaTokenSelectStep,
5183
5497
  {
5184
5498
  solanaAddress: solanaAddr,
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
  ),
5191
- effectiveStep.type === "solana-amount" && /* @__PURE__ */ jsx10(
5509
+ effectiveStep.type === "solana-amount" && /* @__PURE__ */ jsx11(
5192
5510
  SolanaAmountStep,
5193
5511
  {
5194
5512
  token: effectiveStep.token,
@@ -5197,16 +5515,16 @@ function DepositFlow({
5197
5515
  defaultAmount: effectiveStep.inputAmountUsd,
5198
5516
  uiConfig,
5199
5517
  targetChainName: getChainName(targetChain),
5200
- targetTokenSymbol: getTokenSymbol(targetToken, targetChain),
5518
+ targetTokenSymbol: getTargetTokenSymbol(targetToken, targetChain),
5201
5519
  targetTokenIcon: getTokenIcon(
5202
- getTokenSymbol(targetToken, targetChain)
5520
+ getTargetTokenSymbol(targetToken, targetChain)
5203
5521
  ),
5204
- targetBalanceUsd,
5522
+ appBalanceUsd,
5205
5523
  onContinue: handleSolanaAmountContinue,
5206
5524
  debug
5207
5525
  }
5208
5526
  ),
5209
- effectiveStep.type === "solana-confirm" && solanaAddr && solanaProvider ? /* @__PURE__ */ jsx10(
5527
+ effectiveStep.type === "solana-confirm" && solanaAddr && solanaProvider ? /* @__PURE__ */ jsx11(
5210
5528
  SolanaConfirmStep,
5211
5529
  {
5212
5530
  smartAccount: effectiveStep.smartAccount,
@@ -5221,20 +5539,22 @@ function DepositFlow({
5221
5539
  targetToken,
5222
5540
  service,
5223
5541
  solanaProvider,
5542
+ solanaConnection: reownWallet?.solanaConnection,
5543
+ uiConfig,
5224
5544
  onConfirm: handleSolanaConfirmed,
5225
5545
  onError: handleError,
5226
5546
  debug
5227
5547
  }
5228
- ) : effectiveStep.type === "solana-confirm" ? /* @__PURE__ */ jsxs10("div", { className: "rs-step", children: [
5229
- /* @__PURE__ */ jsxs10("div", { className: "rs-loading-state", children: [
5230
- /* @__PURE__ */ jsx10("div", { className: "rs-step-icon rs-step-icon--error", children: /* @__PURE__ */ jsx10(
5548
+ ) : effectiveStep.type === "solana-confirm" ? /* @__PURE__ */ jsxs11("div", { className: "rs-step", children: [
5549
+ /* @__PURE__ */ jsxs11("div", { className: "rs-loading-state", children: [
5550
+ /* @__PURE__ */ jsx11("div", { className: "rs-step-icon rs-step-icon--error", children: /* @__PURE__ */ jsx11(
5231
5551
  "svg",
5232
5552
  {
5233
5553
  viewBox: "0 0 24 24",
5234
5554
  fill: "none",
5235
5555
  stroke: "currentColor",
5236
5556
  strokeWidth: "2",
5237
- children: /* @__PURE__ */ jsx10(
5557
+ children: /* @__PURE__ */ jsx11(
5238
5558
  "path",
5239
5559
  {
5240
5560
  strokeLinecap: "round",
@@ -5244,22 +5564,22 @@ function DepositFlow({
5244
5564
  )
5245
5565
  }
5246
5566
  ) }),
5247
- /* @__PURE__ */ jsxs10("div", { className: "rs-loading-text", children: [
5248
- /* @__PURE__ */ jsx10("div", { className: "rs-loading-title rs-text-error", children: "Wallet disconnected" }),
5249
- /* @__PURE__ */ jsx10("div", { className: "rs-loading-subtitle", children: "Please reconnect your Solana wallet to continue." })
5567
+ /* @__PURE__ */ jsxs11("div", { className: "rs-loading-text", children: [
5568
+ /* @__PURE__ */ jsx11("div", { className: "rs-loading-title rs-text-error", children: "Wallet disconnected" }),
5569
+ /* @__PURE__ */ jsx11("div", { className: "rs-loading-subtitle", children: "Please reconnect your Solana wallet to continue." })
5250
5570
  ] })
5251
5571
  ] }),
5252
- /* @__PURE__ */ jsx10("div", { className: "rs-step-footer", children: /* @__PURE__ */ jsx10(
5572
+ /* @__PURE__ */ jsx11("div", { className: "rs-step-footer", children: /* @__PURE__ */ jsx11(
5253
5573
  "button",
5254
5574
  {
5255
5575
  type: "button",
5256
5576
  className: "rs-button rs-button--default rs-button--full-width",
5257
5577
  onClick: handleBack,
5258
- children: /* @__PURE__ */ jsx10("span", { children: "Go Back" })
5578
+ children: /* @__PURE__ */ jsx11("span", { children: "Go Back" })
5259
5579
  }
5260
5580
  ) })
5261
5581
  ] }) : null,
5262
- effectiveStep.type === "processing" && /* @__PURE__ */ jsx10(
5582
+ effectiveStep.type === "processing" && /* @__PURE__ */ jsx11(
5263
5583
  ProcessingStep,
5264
5584
  {
5265
5585
  smartAccount: effectiveStep.smartAccount,
@@ -5287,25 +5607,25 @@ function DepositFlow({
5287
5607
  ] });
5288
5608
  }
5289
5609
  if (!signerContext?.walletClient || !signerContext?.publicClient) {
5290
- return /* @__PURE__ */ jsx10("div", { className: "rs-modal-body", children: /* @__PURE__ */ jsx10("div", { className: "rs-step", children: /* @__PURE__ */ jsx10("div", { className: "rs-loading-state", children: /* @__PURE__ */ jsx10("div", { className: "rs-loading-text", children: /* @__PURE__ */ jsx10("div", { className: "rs-loading-title", children: "Connecting wallet..." }) }) }) }) });
5610
+ return /* @__PURE__ */ jsx11("div", { className: "rs-modal-body", children: /* @__PURE__ */ jsx11("div", { className: "rs-step", children: /* @__PURE__ */ jsx11("div", { className: "rs-loading-state", children: /* @__PURE__ */ jsx11("div", { className: "rs-loading-text", children: /* @__PURE__ */ jsx11("div", { className: "rs-loading-title", children: "Connecting wallet..." }) }) }) }) });
5291
5611
  }
5292
5612
  const ownerAddress = signerContext.ownerAddress;
5293
- const ownerChainId = signerContext.walletClient?.chain?.id ?? signerContext.publicClient.chain?.id ?? targetChain;
5613
+ const ownerChainId = signerContext.walletClient?.chain?.id ?? signerContext.publicClient.chain?.id ?? setupChainId;
5294
5614
  const getReadClientForChain = (chainId) => {
5295
5615
  if (signerContext.publicClient.chain?.id === chainId) {
5296
5616
  return signerContext.publicClient;
5297
5617
  }
5298
5618
  return getPublicClient(chainId);
5299
5619
  };
5300
- return /* @__PURE__ */ jsxs10("div", { className: "rs-modal-body", children: [
5301
- effectiveStep.type === "setup" && /* @__PURE__ */ jsx10(
5620
+ return /* @__PURE__ */ jsxs11("div", { className: "rs-modal-body", children: [
5621
+ effectiveStep.type === "setup" && /* @__PURE__ */ jsx11(
5302
5622
  AccountPreparingSkeleton,
5303
5623
  {
5304
5624
  errorMessage: activeEntry.status === "error" ? activeEntry.message ?? void 0 : void 0,
5305
5625
  onRetry: activeEntry.status === "error" ? () => handleRetrySetup(ownerAddress) : void 0
5306
5626
  }
5307
5627
  ),
5308
- effectiveStep.type === "select-asset" && /* @__PURE__ */ jsx10(
5628
+ effectiveStep.type === "select-asset" && /* @__PURE__ */ jsx11(
5309
5629
  AssetSelectStep,
5310
5630
  {
5311
5631
  address: ownerAddress,
@@ -5323,7 +5643,7 @@ function DepositFlow({
5323
5643
  } : void 0
5324
5644
  }
5325
5645
  ),
5326
- effectiveStep.type === "dapp-import-asset-select" && activeDappImportProvider && activeDappImportAvailability && /* @__PURE__ */ jsx10(
5646
+ effectiveStep.type === "dapp-import-asset-select" && activeDappImportProvider && activeDappImportAvailability && /* @__PURE__ */ jsx11(
5327
5647
  DappImportAssetSelectStep,
5328
5648
  {
5329
5649
  sourceLabel: activeDappImportAvailability.assets[0]?.sourceLabel ?? activeDappImportProvider.label,
@@ -5331,7 +5651,7 @@ function DepositFlow({
5331
5651
  onSelect: handleDappImportAssetSelected
5332
5652
  }
5333
5653
  ),
5334
- effectiveStep.type === "amount" && /* @__PURE__ */ jsx10(
5654
+ effectiveStep.type === "amount" && /* @__PURE__ */ jsx11(
5335
5655
  AmountStep,
5336
5656
  {
5337
5657
  walletClient: signerContext.walletClient,
@@ -5348,11 +5668,11 @@ function DepositFlow({
5348
5668
  targetChain,
5349
5669
  targetToken,
5350
5670
  uiConfig,
5351
- targetBalanceUsd,
5671
+ appBalanceUsd,
5352
5672
  service,
5353
5673
  onContinue: handleAmountContinue,
5354
5674
  onCtaClick: (ctaName) => {
5355
- const receiveSymbol = getTokenSymbol(targetToken, targetChain);
5675
+ const receiveSymbol = getTargetTokenSymbol(targetToken, targetChain);
5356
5676
  onEvent?.({
5357
5677
  type: "deposit_modal_connected_wallet_enter_value_cta_click",
5358
5678
  send_token: effectiveStep.asset.symbol,
@@ -5363,7 +5683,7 @@ function DepositFlow({
5363
5683
  }
5364
5684
  }
5365
5685
  ),
5366
- effectiveStep.type === "confirm" && /* @__PURE__ */ jsx10(
5686
+ effectiveStep.type === "confirm" && /* @__PURE__ */ jsx11(
5367
5687
  ConfirmStep,
5368
5688
  {
5369
5689
  walletClient: signerContext.walletClient,
@@ -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 {
@@ -5402,7 +5723,7 @@ function DepositFlow({
5402
5723
  onError: handleError
5403
5724
  }
5404
5725
  ),
5405
- effectiveStep.type === "processing" && /* @__PURE__ */ jsx10(
5726
+ effectiveStep.type === "processing" && /* @__PURE__ */ jsx11(
5406
5727
  ProcessingStep,
5407
5728
  {
5408
5729
  smartAccount: effectiveStep.smartAccount,
@@ -5433,8 +5754,8 @@ function DepositFlow({
5433
5754
  }
5434
5755
 
5435
5756
  // src/components/history/DepositHistoryPanel.tsx
5436
- import { useCallback as useCallback4, useState as useState10 } from "react";
5437
- import { jsx as jsx11, jsxs as jsxs11 } from "react/jsx-runtime";
5757
+ import { useCallback as useCallback5, useMemo as useMemo7, useState as useState10 } from "react";
5758
+ import { jsx as jsx12, jsxs as jsxs12 } from "react/jsx-runtime";
5438
5759
  function shortenHash(hash) {
5439
5760
  if (hash.length <= 14) return hash;
5440
5761
  return `${hash.slice(0, 6)}\u2026${hash.slice(-4)}`;
@@ -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
- const trimmed = fracStr.slice(0, 6).replace(/0+$/, "");
5508
- if (!trimmed) return whole.toString();
5509
- return `${whole}.${trimmed}`;
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 {
5511
5831
  return rawAmount;
5512
5832
  }
5513
5833
  }
5514
5834
  function getTxExplorerUrl(txHash, chainId) {
5515
5835
  if (!chainId) return null;
5516
- const base = getExplorerUrl(chainId);
5517
- if (!base) return null;
5518
- return `${base}/tx/${txHash}`;
5836
+ const base2 = getExplorerUrl(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();
@@ -5545,7 +5865,7 @@ function DepositHistoryPanel({
5545
5865
  onClose,
5546
5866
  onCloseModal
5547
5867
  }) {
5548
- const handleKeyDown = useCallback4(
5868
+ const handleKeyDown = useCallback5(
5549
5869
  (e) => {
5550
5870
  if (e.key === "Escape") {
5551
5871
  e.stopPropagation();
@@ -5554,7 +5874,15 @@ function DepositHistoryPanel({
5554
5874
  },
5555
5875
  [onClose]
5556
5876
  );
5557
- return /* @__PURE__ */ jsxs11(
5877
+ const visibleDeposits = useMemo7(() => {
5878
+ const sourceHashes = new Set(
5879
+ deposits.map((d) => d.sourceTxHash?.toLowerCase()).filter((h) => Boolean(h))
5880
+ );
5881
+ return deposits.filter(
5882
+ (d) => !(d.txHash && sourceHashes.has(d.txHash.toLowerCase()))
5883
+ );
5884
+ }, [deposits]);
5885
+ return /* @__PURE__ */ jsxs12(
5558
5886
  "div",
5559
5887
  {
5560
5888
  className: "rs-history-panel",
@@ -5562,56 +5890,55 @@ function DepositHistoryPanel({
5562
5890
  "aria-label": "Deposit history",
5563
5891
  onKeyDown: handleKeyDown,
5564
5892
  children: [
5565
- /* @__PURE__ */ jsxs11("div", { className: "rs-modal-header--redesigned", children: [
5566
- /* @__PURE__ */ jsx11("div", { className: "rs-modal-header-nav-left", children: /* @__PURE__ */ jsx11(
5893
+ /* @__PURE__ */ jsxs12("div", { className: "rs-modal-header--redesigned", children: [
5894
+ /* @__PURE__ */ jsx12("div", { className: "rs-modal-header-nav-left", children: /* @__PURE__ */ jsx12(
5567
5895
  "button",
5568
5896
  {
5569
5897
  type: "button",
5570
5898
  className: "rs-modal-header-back",
5571
5899
  "aria-label": "Back",
5572
5900
  onClick: onClose,
5573
- children: /* @__PURE__ */ jsx11(ChevronLeftIcon, {})
5901
+ children: /* @__PURE__ */ jsx12(ChevronLeftIcon, {})
5574
5902
  }
5575
5903
  ) }),
5576
- /* @__PURE__ */ jsx11("div", { className: "rs-modal-header-nav-center" }),
5577
- /* @__PURE__ */ jsx11("div", { className: "rs-modal-header-nav-right", children: onCloseModal && /* @__PURE__ */ jsx11(
5904
+ /* @__PURE__ */ jsx12("div", { className: "rs-modal-header-nav-right", children: onCloseModal && /* @__PURE__ */ jsx12(
5578
5905
  "button",
5579
5906
  {
5580
5907
  type: "button",
5581
5908
  className: "rs-modal-close",
5582
5909
  "aria-label": "Close",
5583
5910
  onClick: onCloseModal,
5584
- children: /* @__PURE__ */ jsx11(CloseIcon, {})
5911
+ children: /* @__PURE__ */ jsx12(CloseIcon, {})
5585
5912
  }
5586
5913
  ) })
5587
5914
  ] }),
5588
- /* @__PURE__ */ jsxs11("div", { className: "rs-history-screen", children: [
5589
- /* @__PURE__ */ jsxs11("div", { className: "rs-history-screen-body", children: [
5590
- /* @__PURE__ */ jsx11(BodyHeader, { icon: /* @__PURE__ */ jsx11(HistoryIcon, {}), title: "History" }),
5591
- isLoading && deposits.length === 0 && /* @__PURE__ */ jsxs11("div", { className: "rs-history-empty", children: [
5592
- /* @__PURE__ */ jsx11("span", { className: "rs-history-empty-glyph", "aria-hidden": "true", children: /* @__PURE__ */ jsx11(HistoryIcon, {}) }),
5593
- /* @__PURE__ */ jsxs11("div", { className: "rs-history-empty-text", children: [
5594
- /* @__PURE__ */ jsx11(Spinner, { className: "rs-spinner--sm" }),
5595
- /* @__PURE__ */ jsx11("span", { className: "rs-history-empty-hint", children: "Loading history\u2026" })
5915
+ /* @__PURE__ */ jsxs12("div", { className: "rs-history-screen", children: [
5916
+ /* @__PURE__ */ jsxs12("div", { className: "rs-history-screen-body", children: [
5917
+ /* @__PURE__ */ jsx12(BodyHeader, { icon: /* @__PURE__ */ jsx12(HistoryIcon, {}), title: "History" }),
5918
+ isLoading && deposits.length === 0 && /* @__PURE__ */ jsxs12("div", { className: "rs-history-empty", children: [
5919
+ /* @__PURE__ */ jsx12("span", { className: "rs-history-empty-glyph", "aria-hidden": "true", children: /* @__PURE__ */ jsx12(HistoryIcon, {}) }),
5920
+ /* @__PURE__ */ jsxs12("div", { className: "rs-history-empty-text", children: [
5921
+ /* @__PURE__ */ jsx12(Spinner, { className: "rs-spinner--sm" }),
5922
+ /* @__PURE__ */ jsx12("span", { className: "rs-history-empty-hint", children: "Loading history\u2026" })
5596
5923
  ] })
5597
5924
  ] }),
5598
- error && !isLoading && /* @__PURE__ */ jsxs11("div", { className: "rs-history-empty", children: [
5599
- /* @__PURE__ */ jsx11("span", { className: "rs-history-empty-glyph", "aria-hidden": "true", children: /* @__PURE__ */ jsx11(AlertTriangleIcon, {}) }),
5600
- /* @__PURE__ */ jsxs11("div", { className: "rs-history-empty-text", children: [
5601
- /* @__PURE__ */ jsx11("span", { className: "rs-history-empty-title", children: "Couldn't load history" }),
5602
- /* @__PURE__ */ jsx11("span", { className: "rs-history-empty-hint", children: error })
5925
+ error && !isLoading && /* @__PURE__ */ jsxs12("div", { className: "rs-history-empty", children: [
5926
+ /* @__PURE__ */ jsx12("span", { className: "rs-history-empty-glyph", "aria-hidden": "true", children: /* @__PURE__ */ jsx12(AlertTriangleIcon, {}) }),
5927
+ /* @__PURE__ */ jsxs12("div", { className: "rs-history-empty-text", children: [
5928
+ /* @__PURE__ */ jsx12("span", { className: "rs-history-empty-title", children: "Couldn't load history" }),
5929
+ /* @__PURE__ */ jsx12("span", { className: "rs-history-empty-hint", children: error })
5603
5930
  ] })
5604
5931
  ] }),
5605
- !isLoading && !error && deposits.length === 0 && /* @__PURE__ */ jsxs11("div", { className: "rs-history-empty", children: [
5606
- /* @__PURE__ */ jsx11("span", { className: "rs-history-empty-glyph", "aria-hidden": "true", children: /* @__PURE__ */ jsx11(HistoryIcon, {}) }),
5607
- /* @__PURE__ */ jsxs11("div", { className: "rs-history-empty-text", children: [
5608
- /* @__PURE__ */ jsx11("span", { className: "rs-history-empty-title", children: "No deposits yet" }),
5609
- /* @__PURE__ */ jsx11("span", { className: "rs-history-empty-hint", children: "Your deposit history will appear here" })
5932
+ !isLoading && !error && visibleDeposits.length === 0 && /* @__PURE__ */ jsxs12("div", { className: "rs-history-empty", children: [
5933
+ /* @__PURE__ */ jsx12("span", { className: "rs-history-empty-glyph", "aria-hidden": "true", children: /* @__PURE__ */ jsx12(HistoryIcon, {}) }),
5934
+ /* @__PURE__ */ jsxs12("div", { className: "rs-history-empty-text", children: [
5935
+ /* @__PURE__ */ jsx12("span", { className: "rs-history-empty-title", children: "No deposits yet" }),
5936
+ /* @__PURE__ */ jsx12("span", { className: "rs-history-empty-hint", children: "Your deposit history will appear here" })
5610
5937
  ] })
5611
5938
  ] }),
5612
- deposits.length > 0 && /* @__PURE__ */ jsxs11("div", { className: "rs-history-list", children: [
5613
- deposits.map((deposit, i) => /* @__PURE__ */ jsx11(HistoryCard, { deposit }, deposit.txHash || i)),
5614
- hasMore && /* @__PURE__ */ jsx11(
5939
+ visibleDeposits.length > 0 && /* @__PURE__ */ jsxs12("div", { className: "rs-history-list", children: [
5940
+ visibleDeposits.map((deposit, i) => /* @__PURE__ */ jsx12(HistoryCard, { deposit }, deposit.txHash || i)),
5941
+ hasMore && /* @__PURE__ */ jsx12(
5615
5942
  "button",
5616
5943
  {
5617
5944
  type: "button",
@@ -5623,7 +5950,7 @@ function DepositHistoryPanel({
5623
5950
  )
5624
5951
  ] })
5625
5952
  ] }),
5626
- /* @__PURE__ */ jsx11(PoweredBy, {})
5953
+ /* @__PURE__ */ jsx12(PoweredBy, {})
5627
5954
  ] })
5628
5955
  ]
5629
5956
  }
@@ -5640,15 +5967,16 @@ function HistoryCard({ deposit }) {
5640
5967
  const targetChainIcon = targetChainId ? getChainIcon(targetChainId) : void 0;
5641
5968
  const sourceSymbol = resolveTokenSymbol(deposit.token, sourceChainId);
5642
5969
  const sourceTokenIcon = sourceSymbol ? getTokenIcon(sourceSymbol) : void 0;
5643
- const rawAmount = deposit.sourceAmount ?? deposit.amount;
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;
5649
5977
  const txTypeLabel = `Deposit${sourceSymbol ? ` ${sourceSymbol}` : ""}`;
5650
5978
  const srcTxUrl = deposit.sourceTxHash ? getTxExplorerUrl(deposit.sourceTxHash, sourceChainId) : null;
5651
- return /* @__PURE__ */ jsxs11(
5979
+ return /* @__PURE__ */ jsxs12(
5652
5980
  "button",
5653
5981
  {
5654
5982
  type: "button",
@@ -5656,38 +5984,38 @@ function HistoryCard({ deposit }) {
5656
5984
  onClick: () => setExpanded((v) => !v),
5657
5985
  "aria-expanded": expanded,
5658
5986
  children: [
5659
- /* @__PURE__ */ jsxs11("div", { className: "rs-history-card-row", children: [
5660
- /* @__PURE__ */ jsxs11("div", { className: "rs-history-card-icons", children: [
5661
- /* @__PURE__ */ jsx11("span", { className: "rs-history-card-token", children: sourceTokenIcon ? /* @__PURE__ */ jsx11("img", { src: sourceTokenIcon, alt: "" }) : sourceSymbol.slice(0, 2) }),
5662
- sourceChainIcon && /* @__PURE__ */ jsx11("span", { className: "rs-history-card-chain", children: /* @__PURE__ */ jsx11("img", { src: sourceChainIcon, alt: "" }) })
5987
+ /* @__PURE__ */ jsxs12("div", { className: "rs-history-card-row", children: [
5988
+ /* @__PURE__ */ jsxs12("div", { className: "rs-history-card-icons", children: [
5989
+ /* @__PURE__ */ jsx12("span", { className: "rs-history-card-token", children: sourceTokenIcon ? /* @__PURE__ */ jsx12("img", { src: sourceTokenIcon, alt: "" }) : sourceSymbol.slice(0, 2) }),
5990
+ sourceChainIcon && /* @__PURE__ */ jsx12("span", { className: "rs-history-card-chain", children: /* @__PURE__ */ jsx12("img", { src: sourceChainIcon, alt: "" }) })
5663
5991
  ] }),
5664
- /* @__PURE__ */ jsxs11("div", { className: "rs-history-card-text", children: [
5665
- /* @__PURE__ */ jsx11("span", { className: "rs-history-card-title", children: txTypeLabel }),
5666
- date && /* @__PURE__ */ jsx11("span", { className: "rs-history-card-date", children: date })
5992
+ /* @__PURE__ */ jsxs12("div", { className: "rs-history-card-text", children: [
5993
+ /* @__PURE__ */ jsx12("span", { className: "rs-history-card-title", children: txTypeLabel }),
5994
+ date && /* @__PURE__ */ jsx12("span", { className: "rs-history-card-date", children: date })
5667
5995
  ] }),
5668
- /* @__PURE__ */ jsxs11("div", { className: "rs-history-card-side", children: [
5669
- /* @__PURE__ */ jsx11("span", { className: "rs-history-card-amount", children: displayAmount }),
5670
- /* @__PURE__ */ jsx11("span", { className: `rs-history-badge rs-history-badge--${status}`, children: STATUS_LABEL[status] })
5996
+ /* @__PURE__ */ jsxs12("div", { className: "rs-history-card-side", children: [
5997
+ /* @__PURE__ */ jsx12("span", { className: "rs-history-card-amount", children: displayAmount }),
5998
+ /* @__PURE__ */ jsx12("span", { className: `rs-history-badge rs-history-badge--${status}`, children: STATUS_LABEL[status] })
5671
5999
  ] })
5672
6000
  ] }),
5673
- expanded && /* @__PURE__ */ jsxs11("div", { className: "rs-history-card-details", children: [
5674
- sourceChainName && /* @__PURE__ */ jsxs11("div", { className: "rs-amount-detail-row", children: [
5675
- /* @__PURE__ */ jsx11("span", { children: "Source chain" }),
5676
- /* @__PURE__ */ jsxs11("span", { className: "rs-amount-detail-value", children: [
5677
- /* @__PURE__ */ jsx11("span", { children: sourceChainName }),
5678
- sourceChainIcon && /* @__PURE__ */ jsx11("span", { className: "rs-amount-detail-icon", children: /* @__PURE__ */ jsx11("img", { src: sourceChainIcon, alt: "" }) })
6001
+ expanded && /* @__PURE__ */ jsxs12("div", { className: "rs-history-card-details", children: [
6002
+ sourceChainName && /* @__PURE__ */ jsxs12("div", { className: "rs-amount-detail-row", children: [
6003
+ /* @__PURE__ */ jsx12("span", { children: "Source chain" }),
6004
+ /* @__PURE__ */ jsxs12("span", { className: "rs-amount-detail-value", children: [
6005
+ /* @__PURE__ */ jsx12("span", { children: sourceChainName }),
6006
+ sourceChainIcon && /* @__PURE__ */ jsx12("span", { className: "rs-amount-detail-icon", children: /* @__PURE__ */ jsx12("img", { src: sourceChainIcon, alt: "" }) })
5679
6007
  ] })
5680
6008
  ] }),
5681
- targetChainName && /* @__PURE__ */ jsxs11("div", { className: "rs-amount-detail-row", children: [
5682
- /* @__PURE__ */ jsx11("span", { children: "Destination chain" }),
5683
- /* @__PURE__ */ jsxs11("span", { className: "rs-amount-detail-value", children: [
5684
- /* @__PURE__ */ jsx11("span", { children: targetChainName }),
5685
- targetChainIcon && /* @__PURE__ */ jsx11("span", { className: "rs-amount-detail-icon", children: /* @__PURE__ */ jsx11("img", { src: targetChainIcon, alt: "" }) })
6009
+ targetChainName && /* @__PURE__ */ jsxs12("div", { className: "rs-amount-detail-row", children: [
6010
+ /* @__PURE__ */ jsx12("span", { children: "Destination chain" }),
6011
+ /* @__PURE__ */ jsxs12("span", { className: "rs-amount-detail-value", children: [
6012
+ /* @__PURE__ */ jsx12("span", { children: targetChainName }),
6013
+ targetChainIcon && /* @__PURE__ */ jsx12("span", { className: "rs-amount-detail-icon", children: /* @__PURE__ */ jsx12("img", { src: targetChainIcon, alt: "" }) })
5686
6014
  ] })
5687
6015
  ] }),
5688
- srcTxUrl && deposit.sourceTxHash && /* @__PURE__ */ jsxs11("div", { className: "rs-amount-detail-row", children: [
5689
- /* @__PURE__ */ jsx11("span", { children: "Transaction details" }),
5690
- /* @__PURE__ */ jsxs11(
6016
+ srcTxUrl && deposit.sourceTxHash && /* @__PURE__ */ jsxs12("div", { className: "rs-amount-detail-row", children: [
6017
+ /* @__PURE__ */ jsx12("span", { children: "Transaction details" }),
6018
+ /* @__PURE__ */ jsxs12(
5691
6019
  "a",
5692
6020
  {
5693
6021
  href: srcTxUrl,
@@ -5696,8 +6024,8 @@ function HistoryCard({ deposit }) {
5696
6024
  className: "rs-history-card-link",
5697
6025
  onClick: (e) => e.stopPropagation(),
5698
6026
  children: [
5699
- /* @__PURE__ */ jsx11("span", { children: shortenHash(deposit.sourceTxHash) }),
5700
- /* @__PURE__ */ jsx11(ArrowUpRightIcon, {})
6027
+ /* @__PURE__ */ jsx12("span", { children: shortenHash(deposit.sourceTxHash) }),
6028
+ /* @__PURE__ */ jsx12(ArrowUpRightIcon, {})
5701
6029
  ]
5702
6030
  }
5703
6031
  )
@@ -5710,9 +6038,9 @@ function HistoryCard({ deposit }) {
5710
6038
  DepositHistoryPanel.displayName = "DepositHistoryPanel";
5711
6039
 
5712
6040
  // src/DepositModal.tsx
5713
- import { jsx as jsx12, jsxs as jsxs12 } from "react/jsx-runtime";
6041
+ import { jsx as jsx13, jsxs as jsxs13 } from "react/jsx-runtime";
5714
6042
  var ReownDepositInner = lazy2(
5715
- () => import("./DepositModalReown-3VZ5AKV2.mjs").then((m) => ({ default: m.DepositModalReown }))
6043
+ () => import("./DepositModalReown-42D5V5II.mjs").then((m) => ({ default: m.DepositModalReown }))
5716
6044
  );
5717
6045
  function sortByCreatedAtDesc(items) {
5718
6046
  return [...items].sort((a, b) => {
@@ -5728,7 +6056,7 @@ function DepositModal(props) {
5728
6056
  "dappWalletClient"
5729
6057
  );
5730
6058
  if (needsReown) {
5731
- return /* @__PURE__ */ jsx12(Suspense2, { fallback: null, children: /* @__PURE__ */ jsx12(
6059
+ return /* @__PURE__ */ jsx13(Suspense2, { fallback: null, children: /* @__PURE__ */ jsx13(
5732
6060
  ReownDepositInner,
5733
6061
  {
5734
6062
  ...props,
@@ -5736,7 +6064,7 @@ function DepositModal(props) {
5736
6064
  }
5737
6065
  ) });
5738
6066
  }
5739
- return /* @__PURE__ */ jsx12(
6067
+ return /* @__PURE__ */ jsx13(
5740
6068
  DepositModalInner,
5741
6069
  {
5742
6070
  ...props,
@@ -5760,6 +6088,7 @@ function DepositModalInner({
5760
6088
  sourceToken,
5761
6089
  defaultAmount,
5762
6090
  recipient,
6091
+ appBalanceUsd,
5763
6092
  backendUrl = DEFAULT_BACKEND_URL,
5764
6093
  solanaRpcUrl,
5765
6094
  signerAddress = DEFAULT_SIGNER_ADDRESS,
@@ -5785,7 +6114,7 @@ function DepositModalInner({
5785
6114
  onError,
5786
6115
  debug
5787
6116
  }) {
5788
- const modalRef = useRef6(null);
6117
+ const modalRef = useRef8(null);
5789
6118
  const onReadyRef = useLatestRef(onReady);
5790
6119
  const [currentScreen, setCurrentScreen] = useState11("connect");
5791
6120
  const [backHandler, setBackHandler] = useState11(
@@ -5799,19 +6128,19 @@ function DepositModalInner({
5799
6128
  const [historyLoading, setHistoryLoading] = useState11(false);
5800
6129
  const [historyLoadingMore, setHistoryLoadingMore] = useState11(false);
5801
6130
  const [historyError, setHistoryError] = useState11(null);
5802
- const cursorRef = useRef6(null);
5803
- const historyStaleRef = useRef6(false);
5804
- const historyLoadedRef = useRef6(false);
5805
- const targetChain = getChainId(targetChainProp);
6131
+ const cursorRef = useRef8(null);
6132
+ const historyStaleRef = useRef8(false);
6133
+ const historyLoadedRef = useRef8(false);
6134
+ const targetChain = targetChainProp === "solana" ? "solana" : getChainId(targetChainProp);
5806
6135
  const sourceChain = sourceChainProp ? getChainId(sourceChainProp) : void 0;
5807
- const service = useMemo7(
6136
+ const service = useMemo8(
5808
6137
  () => createDepositService(backendUrl, {
5809
6138
  debug,
5810
6139
  debugScope: "service:deposit"
5811
6140
  }),
5812
6141
  [backendUrl, debug]
5813
6142
  );
5814
- const store = useMemo7(
6143
+ const store = useMemo8(
5815
6144
  () => createDepositStore({ targetChain, targetToken }),
5816
6145
  // eslint-disable-next-line react-hooks/exhaustive-deps
5817
6146
  []
@@ -5832,14 +6161,14 @@ function DepositModalInner({
5832
6161
  onReadyRef.current?.();
5833
6162
  }
5834
6163
  }, [isOpen, onReadyRef]);
5835
- const handleStepChange = useCallback5(
6164
+ const handleStepChange = useCallback6(
5836
6165
  (onBack, screen) => {
5837
6166
  setBackHandler(() => onBack);
5838
6167
  if (screen) setCurrentScreen(screen);
5839
6168
  },
5840
6169
  []
5841
6170
  );
5842
- const fetchHistory = useCallback5(
6171
+ const fetchHistory = useCallback6(
5843
6172
  async (mode = "initial") => {
5844
6173
  if (!recipient) return;
5845
6174
  const isInitial = mode === "initial";
@@ -5887,26 +6216,26 @@ function DepositModalInner({
5887
6216
  },
5888
6217
  [recipient, service]
5889
6218
  );
5890
- const handleHistoryOpen = useCallback5(() => {
6219
+ const handleHistoryOpen = useCallback6(() => {
5891
6220
  setHistoryOpen(true);
5892
6221
  if (!historyLoadedRef.current || historyStaleRef.current) {
5893
6222
  fetchHistory("initial");
5894
6223
  }
5895
6224
  }, [fetchHistory]);
5896
- const handleHistoryClose = useCallback5(() => {
6225
+ const handleHistoryClose = useCallback6(() => {
5897
6226
  setHistoryOpen(false);
5898
6227
  }, []);
5899
- const handleHistoryLoadMore = useCallback5(() => {
6228
+ const handleHistoryLoadMore = useCallback6(() => {
5900
6229
  fetchHistory("more");
5901
6230
  }, [fetchHistory]);
5902
- const markHistoryStale = useCallback5(() => {
6231
+ const markHistoryStale = useCallback6(() => {
5903
6232
  historyStaleRef.current = true;
5904
6233
  if (historyOpen) {
5905
6234
  fetchHistory("initial");
5906
6235
  }
5907
6236
  }, [historyOpen, fetchHistory]);
5908
6237
  const onLifecycleRef = useLatestRef(onLifecycle);
5909
- const handleLifecycle = useCallback5(
6238
+ const handleLifecycle = useCallback6(
5910
6239
  (event) => {
5911
6240
  onLifecycleRef.current?.(event);
5912
6241
  if (event.type === "smart-account-changed" && !event.evm && !event.solana) {
@@ -5936,7 +6265,7 @@ function DepositModalInner({
5936
6265
  }, [isOpen, store]);
5937
6266
  const showBackButton = uiConfig?.showBackButton ?? true;
5938
6267
  const canGoBack = backHandler !== void 0;
5939
- return /* @__PURE__ */ jsx12(DepositStoreProvider, { store, children: /* @__PURE__ */ jsx12(
6268
+ return /* @__PURE__ */ jsx13(DepositStoreProvider, { store, children: /* @__PURE__ */ jsx13(
5940
6269
  Modal,
5941
6270
  {
5942
6271
  isOpen,
@@ -5944,20 +6273,20 @@ function DepositModalInner({
5944
6273
  className,
5945
6274
  inline,
5946
6275
  closeOnOverlayClick,
5947
- children: /* @__PURE__ */ jsxs12("div", { ref: modalRef, className: "rs-modal", children: [
5948
- /* @__PURE__ */ jsxs12("div", { className: "rs-modal-header--redesigned", children: [
5949
- /* @__PURE__ */ jsx12("div", { className: "rs-modal-header-nav-left", children: showBackButton && canGoBack && backHandler && /* @__PURE__ */ jsx12(
6276
+ children: /* @__PURE__ */ jsxs13("div", { ref: modalRef, className: "rs-modal", children: [
6277
+ /* @__PURE__ */ jsxs13("div", { className: "rs-modal-header--redesigned", children: [
6278
+ /* @__PURE__ */ jsx13("div", { className: "rs-modal-header-nav-left", children: showBackButton && canGoBack && backHandler && /* @__PURE__ */ jsx13(
5950
6279
  "button",
5951
6280
  {
5952
6281
  type: "button",
5953
6282
  className: "rs-modal-header-back",
5954
6283
  "aria-label": "Go back",
5955
6284
  onClick: backHandler,
5956
- children: /* @__PURE__ */ jsx12(ChevronLeftIcon, {})
6285
+ children: /* @__PURE__ */ jsx13(ChevronLeftIcon, {})
5957
6286
  }
5958
6287
  ) }),
5959
- /* @__PURE__ */ jsxs12("div", { className: "rs-modal-header-nav-right", children: [
5960
- historyButtonVisible && /* @__PURE__ */ jsx12(
6288
+ /* @__PURE__ */ jsxs13("div", { className: "rs-modal-header-nav-right", children: [
6289
+ historyButtonVisible && /* @__PURE__ */ jsx13(
5961
6290
  "button",
5962
6291
  {
5963
6292
  type: "button",
@@ -5965,22 +6294,22 @@ function DepositModalInner({
5965
6294
  "aria-label": "Deposit history",
5966
6295
  onClick: handleHistoryOpen,
5967
6296
  disabled: !recipient,
5968
- children: /* @__PURE__ */ jsx12(HistoryIcon, {})
6297
+ children: /* @__PURE__ */ jsx13(HistoryIcon, {})
5969
6298
  }
5970
6299
  ),
5971
- /* @__PURE__ */ jsx12(
6300
+ /* @__PURE__ */ jsx13(
5972
6301
  "button",
5973
6302
  {
5974
6303
  type: "button",
5975
6304
  onClick: onClose,
5976
6305
  className: "rs-modal-close",
5977
6306
  "aria-label": "Close",
5978
- children: /* @__PURE__ */ jsx12(CloseIcon, {})
6307
+ children: /* @__PURE__ */ jsx13(CloseIcon, {})
5979
6308
  }
5980
6309
  )
5981
6310
  ] })
5982
6311
  ] }),
5983
- /* @__PURE__ */ jsx12(
6312
+ /* @__PURE__ */ jsx13(
5984
6313
  DepositFlow,
5985
6314
  {
5986
6315
  dappWalletClient,
@@ -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,
@@ -6017,7 +6347,7 @@ function DepositModalInner({
6017
6347
  debug
6018
6348
  }
6019
6349
  ),
6020
- showHistoryButton && historyOpen && /* @__PURE__ */ jsx12(
6350
+ showHistoryButton && historyOpen && /* @__PURE__ */ jsx13(
6021
6351
  DepositHistoryPanel,
6022
6352
  {
6023
6353
  deposits: historyDeposits,