@rhinestone/deposit-modal 0.3.0-alpha.9 → 0.3.1

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 (47) hide show
  1. package/README.md +76 -0
  2. package/dist/{DepositModalReown-I7I3KLD2.mjs → DepositModalReown-G7UX4IBZ.mjs} +6 -4
  3. package/dist/{DepositModalReown-XUA47RYZ.cjs → DepositModalReown-MECHBE6P.cjs} +9 -7
  4. package/dist/{QRCode-KG47KTGX.cjs → QRCode-5DXFNKI2.cjs} +1 -1
  5. package/dist/{QRCode-YJ3EGWQS.mjs → QRCode-WUC652SH.mjs} +1 -1
  6. package/dist/{WithdrawModalReown-KN2DGOXR.mjs → WithdrawModalReown-CUJAFUQM.mjs} +5 -4
  7. package/dist/{WithdrawModalReown-JATYMQYP.cjs → WithdrawModalReown-WJ6VBZKK.cjs} +8 -7
  8. package/dist/{constants-DqVn968d.d.ts → caip-CsslyHGL.d.cts} +11 -1
  9. package/dist/{constants-DqVn968d.d.cts → caip-CsslyHGL.d.ts} +11 -1
  10. package/dist/{chunk-TJG2AFPS.mjs → chunk-3C35DVPE.mjs} +1048 -829
  11. package/dist/{chunk-SZIYS42B.mjs → chunk-6YRDD462.mjs} +63 -3
  12. package/dist/chunk-AJHFNHG3.cjs +295 -0
  13. package/dist/chunk-BAEB5AFZ.mjs +212 -0
  14. package/dist/{chunk-KE4MRCFN.mjs → chunk-DZQD3DAV.mjs} +26 -17
  15. package/dist/{chunk-G5Q4QBWX.cjs → chunk-LEL6GMEQ.cjs} +111 -102
  16. package/dist/{chunk-7JIDIX27.cjs → chunk-MILJQWPT.cjs} +73 -13
  17. package/dist/{chunk-MMXUBBGK.cjs → chunk-MQIJZNTP.cjs} +1026 -807
  18. package/dist/{chunk-4BUMVXPS.mjs → chunk-QYSCCX4K.mjs} +2237 -871
  19. package/dist/chunk-R5CPOBCF.cjs +212 -0
  20. package/dist/{chunk-OISMGA2L.mjs → chunk-R5WDHHVM.mjs} +2 -12
  21. package/dist/{chunk-ZVG4JDKZ.cjs → chunk-SPUZLWQS.cjs} +2285 -919
  22. package/dist/chunk-TQ2AYMWS.mjs +295 -0
  23. package/dist/{chunk-KIPKYPNF.cjs → chunk-ULEAK63T.cjs} +6 -16
  24. package/dist/constants.cjs +6 -2
  25. package/dist/constants.d.cts +1 -1
  26. package/dist/constants.d.ts +1 -1
  27. package/dist/constants.mjs +5 -1
  28. package/dist/deposit.cjs +6 -4
  29. package/dist/deposit.d.cts +4 -4
  30. package/dist/deposit.d.ts +4 -4
  31. package/dist/deposit.mjs +5 -3
  32. package/dist/index.cjs +21 -6
  33. package/dist/index.d.cts +4 -3
  34. package/dist/index.d.ts +4 -3
  35. package/dist/index.mjs +22 -7
  36. package/dist/polymarket.cjs +64 -0
  37. package/dist/polymarket.d.cts +57 -0
  38. package/dist/polymarket.d.ts +57 -0
  39. package/dist/polymarket.mjs +64 -0
  40. package/dist/styles.css +719 -75
  41. package/dist/{types-D8Q4TMk7.d.cts → types-RzfAD14B.d.cts} +65 -2
  42. package/dist/{types-D8Q4TMk7.d.ts → types-RzfAD14B.d.ts} +65 -2
  43. package/dist/withdraw.cjs +5 -4
  44. package/dist/withdraw.d.cts +4 -4
  45. package/dist/withdraw.d.ts +4 -4
  46. package/dist/withdraw.mjs +4 -3
  47. package/package.json +55 -18
@@ -1,6 +1,17 @@
1
+ import {
2
+ POLYMARKET_COLLATERAL_OFFRAMP_ADDRESS,
3
+ POLYMARKET_ICON_URL,
4
+ POLYMARKET_POLYGON_CHAIN_ID,
5
+ POLYMARKET_PUSD_ADDRESS,
6
+ POLYMARKET_USDCE_ADDRESS,
7
+ executePolymarketSafeTransfer,
8
+ fetchPolymarketProxyWallet,
9
+ readPolymarketBalances
10
+ } from "./chunk-BAEB5AFZ.mjs";
1
11
  import {
2
12
  AlertTriangleIcon,
3
13
  ArrowUpRightIcon,
14
+ BankIcon,
4
15
  BodyHeader,
5
16
  Button,
6
17
  Callout,
@@ -12,6 +23,7 @@ import {
12
23
  ConnectStep,
13
24
  CopyIcon,
14
25
  ExternalLinkIcon,
26
+ HandCoinsIcon,
15
27
  HistoryIcon,
16
28
  InfoIcon,
17
29
  Modal,
@@ -19,7 +31,6 @@ import {
19
31
  PlusCircleIcon,
20
32
  PoweredBy,
21
33
  ProcessingStep,
22
- SAFE_ABI,
23
34
  Spinner,
24
35
  Tooltip,
25
36
  TransferCryptoIcon,
@@ -32,28 +43,35 @@ import {
32
43
  currencyFormatter,
33
44
  debugError,
34
45
  debugLog,
46
+ failureMessageForEvent,
35
47
  formatUserError,
36
48
  getAssetId,
49
+ getEventSourceDetails,
37
50
  getEventTxHash,
51
+ getHyperEvmReadClient,
38
52
  getPublicClient,
39
53
  isDepositEvent,
54
+ isFailedEvent,
40
55
  isNativeAsset,
41
- isSolanaCaip2,
42
56
  loadSessionOwnerFromStorage,
43
- parseEvmChainId,
44
57
  portfolioToAssets,
45
58
  saveSessionOwnerToStorage,
46
- targetChainToCaip2,
47
59
  tokenFormatter,
48
60
  txRefsMatch,
49
61
  useLatestRef
50
- } from "./chunk-TJG2AFPS.mjs";
62
+ } from "./chunk-3C35DVPE.mjs";
63
+ import {
64
+ SAFE_ABI
65
+ } from "./chunk-TQ2AYMWS.mjs";
51
66
  import {
52
67
  DEFAULT_BACKEND_URL,
53
68
  DEFAULT_SIGNER_ADDRESS,
69
+ HYPERCORE_CHAIN_ID,
70
+ HYPERCORE_MIN_DEPOSIT_USD,
54
71
  NATIVE_TOKEN_ADDRESS,
55
72
  SOLANA_TOKENS,
56
73
  SOURCE_CHAINS,
74
+ findTokenDecimals,
57
75
  getChainBadge,
58
76
  getChainIcon,
59
77
  getChainId,
@@ -67,23 +85,36 @@ import {
67
85
  getTokenDecimalsByAddress,
68
86
  getTokenIcon,
69
87
  getTokenSymbol,
88
+ isContractBytecode,
70
89
  isNativeSol,
71
- isStablecoinSymbol
72
- } from "./chunk-SZIYS42B.mjs";
90
+ isSolanaCaip2,
91
+ isStablecoinSymbol,
92
+ isVirtualDestination,
93
+ parseEvmChainId,
94
+ targetChainToCaip2
95
+ } from "./chunk-6YRDD462.mjs";
73
96
 
74
97
  // src/DepositModal.tsx
75
98
  import {
76
- useMemo as useMemo8,
77
- useEffect as useEffect9,
78
- useRef as useRef8,
79
- useState as useState11,
80
- useCallback as useCallback6,
99
+ useMemo as useMemo9,
100
+ useEffect as useEffect11,
101
+ useRef as useRef9,
102
+ useState as useState13,
103
+ useCallback as useCallback9,
81
104
  lazy as lazy2,
82
105
  Suspense as Suspense2
83
106
  } from "react";
107
+ import { isAddress } from "viem";
84
108
 
85
109
  // src/DepositFlow.tsx
86
- import { useState as useState9, useCallback as useCallback4, useMemo as useMemo6, useEffect as useEffect8, useRef as useRef7 } from "react";
110
+ import {
111
+ useState as useState11,
112
+ useCallback as useCallback7,
113
+ useMemo as useMemo7,
114
+ useEffect as useEffect10,
115
+ useLayoutEffect as useLayoutEffect2,
116
+ useRef as useRef8
117
+ } from "react";
87
118
  import { formatUnits as formatUnits7 } from "viem";
88
119
 
89
120
  // src/components/steps/AssetSelectStep.tsx
@@ -113,8 +144,18 @@ function AssetSelectStep({
113
144
  token: defaultSourceToken
114
145
  });
115
146
  }, [defaultSourceChain, defaultSourceToken]);
147
+ const onTotalBalanceComputedRef = useLatestRef(onTotalBalanceComputed);
148
+ const onAssetsLoadedRef = useLatestRef(onAssetsLoaded);
116
149
  useEffect(() => {
117
150
  let active = true;
151
+ function emitAssetsUpdate(currentAssets) {
152
+ const total = currentAssets.reduce(
153
+ (sum, asset) => sum + (asset.balanceUsd ?? 0),
154
+ 0
155
+ );
156
+ onTotalBalanceComputedRef.current?.(total);
157
+ if (currentAssets.length > 0) onAssetsLoadedRef.current?.(currentAssets);
158
+ }
118
159
  async function loadPortfolio() {
119
160
  if (!address) {
120
161
  setLoading(false);
@@ -127,6 +168,7 @@ function AssetSelectStep({
127
168
  if (!active) return;
128
169
  const portfolioAssets = portfolioToAssets(portfolio.tokens);
129
170
  setAssets(portfolioAssets);
171
+ emitAssetsUpdate(portfolioAssets);
130
172
  const hasNative = portfolioAssets.some(
131
173
  (asset) => asset.token.toLowerCase() === NATIVE_TOKEN_ADDRESS
132
174
  );
@@ -138,7 +180,9 @@ function AssetSelectStep({
138
180
  );
139
181
  if (!active) return;
140
182
  if (nativeAssets.length > 0) {
141
- setAssets((prev) => mergeAssets(prev, nativeAssets));
183
+ const merged = mergeAssets(portfolioAssets, nativeAssets);
184
+ setAssets(merged);
185
+ emitAssetsUpdate(merged);
142
186
  }
143
187
  }
144
188
  } catch (err) {
@@ -154,21 +198,13 @@ function AssetSelectStep({
154
198
  return () => {
155
199
  active = false;
156
200
  };
157
- }, [address, publicClient, service]);
201
+ }, [address, publicClient, service, onTotalBalanceComputedRef, onAssetsLoadedRef]);
158
202
  useEffect(() => {
159
203
  if (!defaultAssetId || selectedAssetId) return;
160
204
  if (assets.some((asset) => asset.id === defaultAssetId)) {
161
205
  setSelectedAssetId(defaultAssetId);
162
206
  }
163
207
  }, [assets, defaultAssetId, selectedAssetId]);
164
- useEffect(() => {
165
- const total = assets.reduce(
166
- (sum, asset) => sum + (asset.balanceUsd ?? 0),
167
- 0
168
- );
169
- onTotalBalanceComputed?.(total);
170
- if (assets.length > 0) onAssetsLoaded?.(assets);
171
- }, [assets, onTotalBalanceComputed, onAssetsLoaded]);
172
208
  const allowedChainSet = useMemo(
173
209
  () => allowedRoutes?.sourceChains ? new Set(allowedRoutes.sourceChains) : null,
174
210
  [allowedRoutes?.sourceChains]
@@ -476,7 +512,6 @@ function AmountStep({
476
512
  uiConfig,
477
513
  tokenPriceUsdOverride,
478
514
  appBalanceUsd,
479
- onBalanceUsdChange,
480
515
  onContinue,
481
516
  onCtaClick,
482
517
  service
@@ -554,9 +589,6 @@ function AmountStep({
554
589
  return null;
555
590
  }
556
591
  }, [balance, tokenPriceUsd, asset.decimals]);
557
- useEffect2(() => {
558
- onBalanceUsdChange?.(balanceUsd ?? 0);
559
- }, [balanceUsd, onBalanceUsdChange]);
560
592
  useEffect2(() => {
561
593
  if (hasAppliedDefaultRef.current || !defaultAmount) return;
562
594
  if (isMaxDefault) {
@@ -612,7 +644,7 @@ function AmountStep({
612
644
  return null;
613
645
  }
614
646
  }, [numericAmount, isSourceStablecoin, hasPricing, tokenPriceUsd, asset.decimals]);
615
- const minDepositUsd = uiConfig?.minDepositUsd ?? null;
647
+ const minDepositUsd = targetChain === HYPERCORE_CHAIN_ID ? Math.max(HYPERCORE_MIN_DEPOSIT_USD, uiConfig?.minDepositUsd ?? 0) : uiConfig?.minDepositUsd ?? null;
616
648
  const maxDepositUsd = uiConfig?.maxDepositUsd ?? null;
617
649
  const isBelowMin = minDepositUsd !== null && numericAmount > 0 && amountUsd < minDepositUsd;
618
650
  const isAboveMax = maxDepositUsd !== null && amountUsd > maxDepositUsd;
@@ -782,6 +814,7 @@ function AmountStep({
782
814
  /* @__PURE__ */ jsx3("span", { className: "rs-amount-detail-value", children: currencyFormatter.format(balanceAfterUsd) })
783
815
  ] })
784
816
  ] }),
817
+ targetChain === HYPERCORE_CHAIN_ID && /* @__PURE__ */ jsx3(Callout, { variant: "warning", children: "First deposit to a new HyperCore account includes a ~1 USDC activation fee." }),
785
818
  error && /* @__PURE__ */ jsx3(Callout, { variant: "error", children: error }),
786
819
  /* @__PURE__ */ jsx3(
787
820
  Button,
@@ -821,6 +854,7 @@ function ConfirmStep({
821
854
  estimatedTime = "< 1 min",
822
855
  quotedFeeAmount = "0.1",
823
856
  quotedFeeSymbol,
857
+ service,
824
858
  onConfirm,
825
859
  onError,
826
860
  onDepositSubmitted,
@@ -828,6 +862,7 @@ function ConfirmStep({
828
862
  }) {
829
863
  const [isSubmitting, setIsSubmitting] = useState3(false);
830
864
  const [error, setError] = useState3(null);
865
+ const [quote, setQuote] = useState3(null);
831
866
  const hasAttemptedSwitch = useRef3(false);
832
867
  const chainMismatch = Boolean(
833
868
  walletClient?.chain?.id && walletClient.chain.id !== asset.chainId
@@ -840,7 +875,10 @@ function ConfirmStep({
840
875
  const targetChainIcon = getChainIcon(targetChain);
841
876
  const sourceTokenIcon = getTokenIcon(asset.symbol);
842
877
  const targetTokenIcon = getTokenIcon(targetSymbol);
843
- const formattedSendAmount = amount && !Number.isNaN(Number(amount)) ? Number(amount).toLocaleString("en-US", { maximumFractionDigits: 6 }) : "0";
878
+ const formattedSendAmount = amount && !Number.isNaN(Number(amount)) ? Number(amount).toLocaleString("en-US", {
879
+ minimumFractionDigits: 2,
880
+ maximumFractionDigits: 6
881
+ }) : "0";
844
882
  const formattedReceiveAmount = (() => {
845
883
  if (sameRoute) return formattedSendAmount;
846
884
  const dollarValue = Number(targetAmount);
@@ -848,13 +886,18 @@ function ConfirmStep({
848
886
  return formattedSendAmount;
849
887
  if (targetTokenPriceUsd !== null && targetTokenPriceUsd > 0) {
850
888
  const tokenAmount = dollarValue / targetTokenPriceUsd;
851
- return tokenAmount.toLocaleString("en-US", { maximumFractionDigits: 6 });
889
+ return tokenAmount.toLocaleString("en-US", {
890
+ minimumFractionDigits: 2,
891
+ maximumFractionDigits: 6
892
+ });
852
893
  }
853
894
  return formattedSendAmount;
854
895
  })();
855
896
  const receiveAmount = sameRoute ? formattedReceiveAmount : `~${formattedReceiveAmount}`;
856
897
  const feeSponsored = uiConfig?.feeSponsored ?? false;
857
898
  const feeTooltip = uiConfig?.feeTooltip ?? (feeSponsored ? "Network fees are sponsored for this deposit." : "Network fees apply.");
899
+ const feeDisplay = quote ? `$${quote.fees.totalUsd.toFixed(2)}` : null;
900
+ const estimatedTimeDisplay = quote ? quote.estimatedFillTimeSeconds < 60 ? "< 1 min" : `~${Math.round(quote.estimatedFillTimeSeconds / 60)} min` : estimatedTime;
858
901
  useEffect3(() => {
859
902
  if (chainMismatch && switchChain && !hasAttemptedSwitch.current) {
860
903
  hasAttemptedSwitch.current = true;
@@ -867,6 +910,39 @@ function ConfirmStep({
867
910
  useEffect3(() => {
868
911
  hasAttemptedSwitch.current = false;
869
912
  }, [asset.chainId]);
913
+ useEffect3(() => {
914
+ if (targetChain === "solana" && asset.chainId === void 0) return;
915
+ let cancelled = false;
916
+ let units;
917
+ try {
918
+ units = parseUnits2(amount, asset.decimals);
919
+ } catch {
920
+ return;
921
+ }
922
+ if (units <= 0n) return;
923
+ setQuote(null);
924
+ service.getQuotePreview({
925
+ account: smartAccount,
926
+ sourceChainId: asset.chainId,
927
+ sourceToken: asset.token,
928
+ amount: units.toString()
929
+ }).then((result) => {
930
+ if (!cancelled) setQuote(result);
931
+ }).catch(() => {
932
+ if (!cancelled) setQuote(null);
933
+ });
934
+ return () => {
935
+ cancelled = true;
936
+ };
937
+ }, [
938
+ service,
939
+ smartAccount,
940
+ asset.chainId,
941
+ asset.token,
942
+ asset.decimals,
943
+ amount,
944
+ targetChain
945
+ ]);
870
946
  const handleConfirm = async () => {
871
947
  if (!address || !walletClient) {
872
948
  setError("Wallet not connected");
@@ -955,7 +1031,7 @@ function ConfirmStep({
955
1031
  ] }),
956
1032
  /* @__PURE__ */ jsxs4("div", { className: "rs-review-detail-row", children: [
957
1033
  /* @__PURE__ */ jsx4("span", { children: "Estimated time" }),
958
- /* @__PURE__ */ jsx4("span", { className: "rs-review-detail-value", children: estimatedTime })
1034
+ /* @__PURE__ */ jsx4("span", { className: "rs-review-detail-value", children: estimatedTimeDisplay })
959
1035
  ] }),
960
1036
  /* @__PURE__ */ jsxs4("div", { className: "rs-review-detail-row", children: [
961
1037
  /* @__PURE__ */ jsx4("span", { children: "You send" }),
@@ -982,17 +1058,24 @@ function ConfirmStep({
982
1058
  /* @__PURE__ */ jsxs4("div", { className: "rs-review-detail-row", children: [
983
1059
  /* @__PURE__ */ jsx4("span", { children: "Fees" }),
984
1060
  /* @__PURE__ */ jsxs4("span", { className: "rs-review-detail-value", children: [
985
- /* @__PURE__ */ jsx4(
1061
+ feeDisplay === null ? /* @__PURE__ */ jsx4(
1062
+ "span",
1063
+ {
1064
+ className: "rs-skeleton rs-skeleton-fee",
1065
+ "aria-hidden": "true"
1066
+ }
1067
+ ) : /* @__PURE__ */ jsx4(
986
1068
  "span",
987
1069
  {
988
1070
  style: feeSponsored ? { textDecoration: "line-through" } : void 0,
989
- children: "$0.04"
1071
+ children: feeDisplay
990
1072
  }
991
1073
  ),
992
1074
  /* @__PURE__ */ jsx4(Tooltip, { content: feeTooltip, children: /* @__PURE__ */ jsx4("span", { className: "rs-review-detail-info", "aria-label": "Fee info", children: /* @__PURE__ */ jsx4(InfoIcon, {}) }) })
993
1075
  ] })
994
1076
  ] })
995
1077
  ] }),
1078
+ targetChain === HYPERCORE_CHAIN_ID && /* @__PURE__ */ jsx4(Callout, { variant: "warning", children: "First deposit to a new HyperCore account includes a ~1 USDC activation fee." }),
996
1079
  error && /* @__PURE__ */ jsx4(Callout, { variant: "error", children: error }),
997
1080
  /* @__PURE__ */ jsx4(
998
1081
  Button,
@@ -1088,14 +1171,21 @@ function DepositNotification({
1088
1171
  solanaDepositAddress,
1089
1172
  targetChain,
1090
1173
  targetToken,
1091
- waitForFinalTx,
1092
1174
  hasPostBridgeActions,
1093
1175
  service,
1094
1176
  onComplete,
1095
1177
  onFailed,
1096
1178
  onDismiss
1097
1179
  }) {
1098
- const { txHash, sourceChain, amount, token, detectedAt, directTransfer } = deposit;
1180
+ const {
1181
+ txHash,
1182
+ sourceChain,
1183
+ amount,
1184
+ token,
1185
+ sourceDecimals,
1186
+ detectedAt,
1187
+ directTransfer
1188
+ } = deposit;
1099
1189
  const [status, setStatus] = useState4(
1100
1190
  directTransfer ? "complete" : "processing"
1101
1191
  );
@@ -1113,9 +1203,9 @@ function DepositNotification({
1113
1203
  amount,
1114
1204
  sourceChain,
1115
1205
  sourceToken: token,
1206
+ sourceDecimals,
1116
1207
  targetChain,
1117
1208
  targetToken,
1118
- waitForFinalTx,
1119
1209
  hasPostBridgeActions
1120
1210
  });
1121
1211
  const onCompleteRef = useLatestRef(onComplete);
@@ -1132,6 +1222,7 @@ function DepositNotification({
1132
1222
  amount: context.amount,
1133
1223
  sourceChain: context.sourceChain,
1134
1224
  sourceToken: context.sourceToken,
1225
+ sourceDecimals: context.sourceDecimals,
1135
1226
  targetChain: context.targetChain,
1136
1227
  targetToken: context.targetToken
1137
1228
  });
@@ -1161,7 +1252,7 @@ function DepositNotification({
1161
1252
  if (!isMounted) return;
1162
1253
  const lastEvent = data.lastEvent;
1163
1254
  const eventForTx = isEventForTx(lastEvent, txHash) ? lastEvent : void 0;
1164
- const awaitingPostBridgeSwap = depositContextRef.current.waitForFinalTx && depositContextRef.current.hasPostBridgeActions;
1255
+ const awaitingPostBridgeSwap = depositContextRef.current.hasPostBridgeActions;
1165
1256
  if (eventForTx?.type === "post-bridge-swap-complete") {
1166
1257
  const swapTxHash = eventForTx.data?.swap?.transactionHash;
1167
1258
  handleComplete(swapTxHash);
@@ -1176,10 +1267,6 @@ function DepositNotification({
1176
1267
  handleComplete(destTx);
1177
1268
  return;
1178
1269
  }
1179
- if (!waitForFinalTx && eventForTx?.type === "bridge-started") {
1180
- handleComplete(void 0);
1181
- return;
1182
- }
1183
1270
  if (eventForTx?.type === "bridge-failed") {
1184
1271
  handleFailed(formatBridgeFailedMessage(eventForTx));
1185
1272
  return;
@@ -1227,7 +1314,38 @@ function DepositNotification({
1227
1314
  const destExplorerUrl = destinationTxHash ? getExplorerTxUrl(targetChain, destinationTxHash) : null;
1228
1315
  const title = status === "complete" ? "Deposit completed" : status === "failed" ? "Deposit failed" : "Deposit received and processing\u2026";
1229
1316
  const subtitle = status === "complete" ? "Your deposit has been credited to your account." : status === "failed" ? "Your deposit could not be processed." : "Your deposit will be credited to your account shortly.";
1230
- const statusIcon = status === "complete" ? /* @__PURE__ */ 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, {}) });
1317
+ 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__ */ jsxs5(
1318
+ "svg",
1319
+ {
1320
+ className: "rs-deposit-notification-spinner",
1321
+ viewBox: "0 0 44 44",
1322
+ fill: "none",
1323
+ xmlns: "http://www.w3.org/2000/svg",
1324
+ "aria-hidden": "true",
1325
+ children: [
1326
+ /* @__PURE__ */ jsx5(
1327
+ "path",
1328
+ {
1329
+ className: "rs-deposit-notification-spinner-track",
1330
+ d: "M21.5882 42.1765C32.9588 42.1765 42.1765 32.9588 42.1765 21.5882C42.1765 10.2177 32.9588 1 21.5882 1C10.2177 1 1 10.2177 1 21.5882C1 32.9588 10.2177 42.1765 21.5882 42.1765Z",
1331
+ stroke: "#D4D4D8",
1332
+ strokeWidth: "2",
1333
+ strokeLinecap: "round"
1334
+ }
1335
+ ),
1336
+ /* @__PURE__ */ jsx5(
1337
+ "path",
1338
+ {
1339
+ className: "rs-deposit-notification-spinner-head",
1340
+ d: "M28.0422 2.03186C31.4239 3.1515 34.458 5.1279 36.8489 7.76854C39.2398 10.4092 40.906 13.624 41.6852 17.1",
1341
+ stroke: "#52525C",
1342
+ strokeWidth: "2",
1343
+ strokeLinecap: "round"
1344
+ }
1345
+ )
1346
+ ]
1347
+ }
1348
+ ) });
1231
1349
  const showClose = status !== "processing";
1232
1350
  return /* @__PURE__ */ jsxs5(
1233
1351
  "div",
@@ -1316,7 +1434,7 @@ function DepositNotification({
1316
1434
  // src/components/steps/DepositAddressStep.tsx
1317
1435
  import { jsx as jsx6, jsxs as jsxs6 } from "react/jsx-runtime";
1318
1436
  var QRCode = lazy(
1319
- () => import("./QRCode-YJ3EGWQS.mjs").then((m) => ({ default: m.QRCode }))
1437
+ () => import("./QRCode-WUC652SH.mjs").then((m) => ({ default: m.QRCode }))
1320
1438
  );
1321
1439
  var POLL_INTERVAL_MS = 4e3;
1322
1440
  function isRecord(value) {
@@ -1375,14 +1493,15 @@ function getDepositEventDetails(event) {
1375
1493
  ...solanaMeta
1376
1494
  };
1377
1495
  }
1378
- if (event.type === "bridge-started") {
1379
- const source = isRecord(event.data.source) ? event.data.source : void 0;
1380
- const chainId = asChainId(source?.chain);
1381
- const token = asString(source?.asset);
1496
+ const source = isRecord(event.data.source) ? event.data.source : void 0;
1497
+ const deposit = isRecord(event.data.deposit) ? event.data.deposit : void 0;
1498
+ if (source || deposit) {
1499
+ const chainId = asChainId(source?.chain) ?? asChainId(deposit?.chain);
1500
+ const token = asString(source?.asset) ?? asString(deposit?.asset) ?? asString(deposit?.token);
1382
1501
  const solanaMeta = chainId === "solana" ? resolveSolanaTokenMeta(token) : {};
1383
1502
  return {
1384
1503
  chainId,
1385
- amount: asAmount(source?.amount),
1504
+ amount: asAmount(source?.amount) ?? asAmount(deposit?.amount),
1386
1505
  token,
1387
1506
  ...solanaMeta
1388
1507
  };
@@ -1392,15 +1511,22 @@ function getDepositEventDetails(event) {
1392
1511
  function isSameRoute(sourceChain, sourceToken, targetChain, targetToken) {
1393
1512
  return sourceChain === targetChain && sourceToken.toLowerCase() === targetToken.toLowerCase();
1394
1513
  }
1514
+ function computeTokensForChain(chainId, allowedTokenSet) {
1515
+ const all = chainId === "solana" ? SOLANA_TOKENS.map((t) => t.symbol) : getTargetTokenSymbolsForChain(chainId);
1516
+ return allowedTokenSet ? all.filter((s) => allowedTokenSet.has(s.toUpperCase())) : all;
1517
+ }
1518
+ function pickFallbackToken(tokens, current) {
1519
+ if (tokens.includes(current)) return current;
1520
+ if (tokens.includes("USDC")) return "USDC";
1521
+ return tokens[0] ?? "USDC";
1522
+ }
1395
1523
  function DepositAddressStep({
1396
1524
  smartAccount,
1397
1525
  solanaDepositAddress,
1398
- isUpdating = false,
1399
1526
  service,
1400
1527
  allowedRoutes,
1401
1528
  targetChain,
1402
1529
  targetToken,
1403
- waitForFinalTx,
1404
1530
  hasPostBridgeActions,
1405
1531
  uiConfig,
1406
1532
  onDepositSubmitted,
@@ -1428,22 +1554,16 @@ function DepositAddressStep({
1428
1554
  options.splice(1, 0, "solana");
1429
1555
  return options;
1430
1556
  }, [evmChainIds, hasSolana]);
1431
- const BASE_CHAIN_ID = 8453;
1432
- const defaultChainId = evmChainIds.includes(BASE_CHAIN_ID) ? BASE_CHAIN_ID : evmChainIds[0];
1557
+ const BASE_CHAIN_ID2 = 8453;
1558
+ const defaultChainId = evmChainIds.includes(BASE_CHAIN_ID2) ? BASE_CHAIN_ID2 : evmChainIds[0];
1433
1559
  const [sourceChainId, setSourceChainId] = useState5(defaultChainId);
1434
1560
  const isSolana = sourceChainId === "solana";
1435
- const tokensForChain = useMemo3(() => {
1436
- const all = isSolana ? SOLANA_TOKENS.map((t) => t.symbol) : getTargetTokenSymbolsForChain(sourceChainId);
1437
- return allowedTokenSet ? all.filter((s) => allowedTokenSet.has(s.toUpperCase())) : all;
1438
- }, [sourceChainId, isSolana, allowedTokenSet]);
1439
- const defaultToken = tokensForChain.includes("USDC") ? "USDC" : tokensForChain[0] ?? "USDC";
1561
+ const tokensForChain = useMemo3(
1562
+ () => computeTokensForChain(sourceChainId, allowedTokenSet),
1563
+ [sourceChainId, allowedTokenSet]
1564
+ );
1565
+ const defaultToken = pickFallbackToken(tokensForChain, "USDC");
1440
1566
  const [sourceTokenSymbol, setSourceTokenSymbol] = useState5(defaultToken);
1441
- useEffect5(() => {
1442
- if (!tokensForChain.includes(sourceTokenSymbol)) {
1443
- const fallback = tokensForChain.includes("USDC") ? "USDC" : tokensForChain[0] ?? "USDC";
1444
- setSourceTokenSymbol(fallback);
1445
- }
1446
- }, [tokensForChain, sourceTokenSymbol]);
1447
1567
  const [copied, setCopied] = useState5(false);
1448
1568
  const [pollingError, setPollingError] = useState5(null);
1449
1569
  const [chainDropdownOpen, setChainDropdownOpen] = useState5(false);
@@ -1455,28 +1575,6 @@ function DepositAddressStep({
1455
1575
  const isTrackingRef = useRef5(false);
1456
1576
  const baselineTxHashRef = useRef5(void 0);
1457
1577
  const notificationIdRef = useRef5(0);
1458
- const sourceSelectionRef = useRef5({
1459
- chainId: defaultChainId,
1460
- token: typeof defaultChainId === "number" ? getTokenAddress(defaultToken, defaultChainId) : void 0,
1461
- sourceSymbol: defaultToken
1462
- });
1463
- useEffect5(() => {
1464
- if (isSolana) {
1465
- const matched = SOLANA_TOKENS.find((t) => t.symbol === sourceTokenSymbol) ?? SOLANA_TOKENS[0];
1466
- sourceSelectionRef.current = {
1467
- chainId: "solana",
1468
- token: matched?.mint,
1469
- sourceSymbol: matched?.symbol,
1470
- sourceDecimals: matched?.decimals
1471
- };
1472
- return;
1473
- }
1474
- sourceSelectionRef.current = {
1475
- chainId: sourceChainId,
1476
- token: getTokenAddress(sourceTokenSymbol, sourceChainId),
1477
- sourceSymbol: sourceTokenSymbol
1478
- };
1479
- }, [sourceChainId, sourceTokenSymbol, isSolana]);
1480
1578
  const [liquidityHelper, setLiquidityHelper] = useState5({
1481
1579
  kind: "idle"
1482
1580
  });
@@ -1543,14 +1641,13 @@ function DepositAddressStep({
1543
1641
  setTokenDropdownOpen(false);
1544
1642
  }
1545
1643
  document.addEventListener("mousedown", handlePointerDown);
1546
- document.addEventListener("touchstart", handlePointerDown);
1644
+ document.addEventListener("touchstart", handlePointerDown, { passive: true });
1547
1645
  return () => {
1548
1646
  document.removeEventListener("mousedown", handlePointerDown);
1549
1647
  document.removeEventListener("touchstart", handlePointerDown);
1550
1648
  };
1551
1649
  }, [chainDropdownOpen, tokenDropdownOpen]);
1552
1650
  const handleCopy = useCallback2(async () => {
1553
- if (isUpdating) return;
1554
1651
  onCopyAddress?.();
1555
1652
  try {
1556
1653
  await navigator.clipboard.writeText(displayAddress);
@@ -1568,12 +1665,18 @@ function DepositAddressStep({
1568
1665
  setCopied(true);
1569
1666
  setTimeout(() => setCopied(false), 2e3);
1570
1667
  }
1571
- }, [displayAddress, onCopyAddress, isUpdating]);
1572
- useEffect5(() => {
1573
- setCopied(false);
1574
- setChainDropdownOpen(false);
1575
- setTokenDropdownOpen(false);
1576
- }, [sourceChainId]);
1668
+ }, [displayAddress, onCopyAddress]);
1669
+ const handleSelectChain = useCallback2(
1670
+ (nextChain) => {
1671
+ const nextTokens = computeTokensForChain(nextChain, allowedTokenSet);
1672
+ setSourceChainId(nextChain);
1673
+ setSourceTokenSymbol(pickFallbackToken(nextTokens, sourceTokenSymbol));
1674
+ setChainDropdownOpen(false);
1675
+ setTokenDropdownOpen(false);
1676
+ setCopied(false);
1677
+ },
1678
+ [allowedTokenSet, sourceTokenSymbol]
1679
+ );
1577
1680
  const onDepositSubmittedRef = useRef5(onDepositSubmitted);
1578
1681
  onDepositSubmittedRef.current = onDepositSubmitted;
1579
1682
  const onDepositCompleteRef = useRef5(onDepositComplete);
@@ -1589,7 +1692,6 @@ function DepositAddressStep({
1589
1692
  useEffect5(() => {
1590
1693
  baselineTxHashRef.current = void 0;
1591
1694
  isTrackingRef.current = false;
1592
- setPollingError(null);
1593
1695
  let timeoutId;
1594
1696
  let cancelled = false;
1595
1697
  async function poll() {
@@ -1634,10 +1736,13 @@ function DepositAddressStep({
1634
1736
  const amount = details.amount ?? "0";
1635
1737
  const token = details.token;
1636
1738
  const sourceSymbol = details.sourceSymbol;
1637
- const sourceDecimals = details.sourceDecimals;
1638
1739
  baselineTxHashRef.current = eventTxHash;
1639
1740
  isTrackingRef.current = true;
1640
1741
  const isEvmToken = token ? /^0x[a-fA-F0-9]{40}$/.test(token) : false;
1742
+ const sourceDecimals = details.sourceDecimals ?? (isEvmToken ? findTokenDecimals(
1743
+ token,
1744
+ typeof chainId === "number" ? chainId : void 0
1745
+ ) : void 0);
1641
1746
  const directTransfer = typeof chainId === "number" && isEvmToken && isSameRoute(
1642
1747
  chainId,
1643
1748
  token,
@@ -1660,7 +1765,8 @@ function DepositAddressStep({
1660
1765
  onDepositSubmittedRef.current?.({
1661
1766
  txHash: eventTxHash,
1662
1767
  sourceChain: chainId,
1663
- amount
1768
+ amount,
1769
+ sourceDecimals
1664
1770
  });
1665
1771
  }
1666
1772
  setPollingError(null);
@@ -1734,10 +1840,7 @@ function DepositAddressStep({
1734
1840
  {
1735
1841
  type: "button",
1736
1842
  className: `rs-deposit-address-dropdown-item ${chainId === sourceChainId ? "rs-deposit-address-dropdown-item--active" : ""}`,
1737
- onClick: () => {
1738
- setSourceChainId(chainId);
1739
- setChainDropdownOpen(false);
1740
- },
1843
+ onClick: () => handleSelectChain(chainId),
1741
1844
  children: [
1742
1845
  getChainIcon(chainId) && /* @__PURE__ */ jsx6(
1743
1846
  "img",
@@ -1758,7 +1861,7 @@ function DepositAddressStep({
1758
1861
  /* @__PURE__ */ jsx6("span", { children: "Supported token" }),
1759
1862
  /* @__PURE__ */ jsxs6("span", { className: "rs-deposit-address-min", children: [
1760
1863
  "Min.$",
1761
- (uiConfig?.minDepositUsd ?? 0.1).toFixed(2),
1864
+ (targetChain === HYPERCORE_CHAIN_ID ? Math.max(HYPERCORE_MIN_DEPOSIT_USD, uiConfig?.minDepositUsd ?? 0) : uiConfig?.minDepositUsd ?? 0.1).toFixed(2),
1762
1865
  /* @__PURE__ */ jsx6(Tooltip, { content: "Minimum deposit amount required for the selected chain.", children: /* @__PURE__ */ jsx6(
1763
1866
  InfoIcon,
1764
1867
  {
@@ -1822,38 +1925,17 @@ function DepositAddressStep({
1822
1925
  {
1823
1926
  style: { display: "flex", flexDirection: "column", gap: 4, width: "100%" },
1824
1927
  children: [
1928
+ /* @__PURE__ */ jsxs6("div", { className: "rs-deposit-address-well", children: [
1929
+ /* @__PURE__ */ jsx6("div", { className: "rs-deposit-address-qr", children: /* @__PURE__ */ jsx6(
1930
+ Suspense,
1931
+ {
1932
+ fallback: /* @__PURE__ */ jsx6("div", { className: "rs-skeleton rs-skeleton-qr", "aria-hidden": "true" }),
1933
+ children: /* @__PURE__ */ jsx6(QRCode, { value: displayAddress, size: 190, iconSrc: qrIconSrc })
1934
+ }
1935
+ ) }),
1936
+ /* @__PURE__ */ jsx6("div", { className: "rs-deposit-address-value", children: displayAddress })
1937
+ ] }),
1825
1938
  /* @__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,
1832
- {
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 })
1847
- }
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(
1857
1939
  "button",
1858
1940
  {
1859
1941
  type: "button",
@@ -1868,6 +1950,7 @@ function DepositAddressStep({
1868
1950
  ]
1869
1951
  }
1870
1952
  ),
1953
+ targetChain === HYPERCORE_CHAIN_ID && /* @__PURE__ */ jsx6(Callout, { variant: "warning", children: "HyperCore's first deposit to a new account includes a ~1 USDC activation fee \u2014 send at least 1 USDC or it will fail." }),
1871
1954
  /* @__PURE__ */ jsxs6(
1872
1955
  "div",
1873
1956
  {
@@ -1951,7 +2034,6 @@ function DepositAddressStep({
1951
2034
  solanaDepositAddress,
1952
2035
  targetChain,
1953
2036
  targetToken,
1954
- waitForFinalTx,
1955
2037
  hasPostBridgeActions,
1956
2038
  service,
1957
2039
  onComplete: handleNotificationComplete,
@@ -1965,97 +2047,884 @@ function DepositAddressStep({
1965
2047
  }
1966
2048
  DepositAddressStep.displayName = "DepositAddressStep";
1967
2049
 
1968
- // src/components/steps/SolanaTokenSelectStep.tsx
1969
- import { useState as useState6, useEffect as useEffect6, useMemo as useMemo4 } from "react";
1970
- import { formatUnits as formatUnits4 } from "viem";
2050
+ // src/components/steps/FiatOnrampStep.tsx
2051
+ import { useCallback as useCallback3 } from "react";
2052
+
2053
+ // src/components/steps/SwappedIframeStep.tsx
2054
+ import { useState as useState6, useEffect as useEffect6, useRef as useRef6, useMemo as useMemo4 } from "react";
2055
+
2056
+ // src/components/steps/SwappedOrderTracker.tsx
1971
2057
  import { jsx as jsx7, jsxs as jsxs7 } from "react/jsx-runtime";
1972
- function SolanaTokenSelectStep({
1973
- solanaAddress,
2058
+ var STEP_LABELS = [
2059
+ "Payment received",
2060
+ null,
2061
+ "Processing App deposit",
2062
+ "Deposit successful"
2063
+ ];
2064
+ function SwappedOrderTracker({
2065
+ amount,
2066
+ currency = "USDC",
2067
+ chainLabel = "Base",
2068
+ stepStates,
2069
+ terminal = null,
2070
+ onRetry
2071
+ }) {
2072
+ const formattedAmount = formatTrackerAmount(amount);
2073
+ const title = terminal ? terminal.kind === "cancelled" ? "Order cancelled" : "Deposit failed" : formattedAmount ? `Depositing ${formattedAmount} ${currency}` : `Depositing ${currency}`;
2074
+ const labels = [
2075
+ STEP_LABELS[0],
2076
+ `${currency} received on ${chainLabel}`,
2077
+ STEP_LABELS[2],
2078
+ STEP_LABELS[3]
2079
+ ];
2080
+ return /* @__PURE__ */ jsxs7("div", { className: "rs-screen rs-swapped-tracker", children: [
2081
+ /* @__PURE__ */ jsxs7("div", { className: "rs-screen-body rs-screen-body--gap-32", children: [
2082
+ /* @__PURE__ */ jsx7(BodyHeader, { icon: /* @__PURE__ */ jsx7(HandCoinsIcon, {}), title }),
2083
+ /* @__PURE__ */ jsx7("ol", { className: "rs-swapped-tracker-steps", children: labels.map((label, idx) => {
2084
+ const status = stepStates[idx];
2085
+ return /* @__PURE__ */ jsxs7(
2086
+ "li",
2087
+ {
2088
+ className: `rs-swapped-tracker-step rs-swapped-tracker-step--${status}`,
2089
+ children: [
2090
+ /* @__PURE__ */ jsx7("span", { className: "rs-swapped-tracker-step-label", children: label }),
2091
+ /* @__PURE__ */ jsx7(
2092
+ "span",
2093
+ {
2094
+ className: "rs-swapped-tracker-step-marker",
2095
+ "aria-hidden": "true",
2096
+ children: status === "complete" ? /* @__PURE__ */ jsx7(CheckIcon, {}) : status === "failed" ? /* @__PURE__ */ jsx7(CloseIcon, {}) : status === "active" ? /* @__PURE__ */ jsx7(Spinner, {}) : null
2097
+ }
2098
+ )
2099
+ ]
2100
+ },
2101
+ label
2102
+ );
2103
+ }) }),
2104
+ terminal && /* @__PURE__ */ jsxs7(
2105
+ "div",
2106
+ {
2107
+ className: `rs-swapped-tracker-terminal rs-swapped-tracker-terminal--${terminal.kind}`,
2108
+ children: [
2109
+ /* @__PURE__ */ jsx7("p", { className: "rs-swapped-tracker-terminal-message", children: terminal.message }),
2110
+ terminal.kind === "cancelled" && onRetry && /* @__PURE__ */ jsx7(
2111
+ "button",
2112
+ {
2113
+ type: "button",
2114
+ className: "rs-swapped-tracker-retry",
2115
+ onClick: onRetry,
2116
+ children: "Try again"
2117
+ }
2118
+ )
2119
+ ]
2120
+ }
2121
+ )
2122
+ ] }),
2123
+ /* @__PURE__ */ jsx7(PoweredBy, {})
2124
+ ] });
2125
+ }
2126
+ function formatTrackerAmount(amount) {
2127
+ if (!amount) return null;
2128
+ const num = Number(amount);
2129
+ if (!Number.isFinite(num)) return amount;
2130
+ return num.toFixed(2);
2131
+ }
2132
+ SwappedOrderTracker.displayName = "SwappedOrderTracker";
2133
+
2134
+ // src/components/steps/SwappedIframeStep.tsx
2135
+ import { jsx as jsx8, jsxs as jsxs8 } from "react/jsx-runtime";
2136
+ var STATUS_POLL_INTERVAL_MS = 2e3;
2137
+ var DEPOSIT_POLL_INTERVAL_MS = 2e3;
2138
+ var DEPOSIT_POLL_FAST_INITIAL_DELAY_MS = 1e3;
2139
+ var DEPOSIT_POLL_FAST_INTERVAL_MS = 500;
2140
+ var IFRAME_LOAD_TIMEOUT_MS = 15e3;
2141
+ var SWAPPED_IFRAME_ORIGINS = /* @__PURE__ */ new Set([
2142
+ "https://sandbox.swapped.com",
2143
+ "https://widget.swapped.com"
2144
+ ]);
2145
+ var SWAPPED_TERMINAL_STATUSES = /* @__PURE__ */ new Set([
2146
+ "order_completed",
2147
+ "order_broadcasted"
2148
+ ]);
2149
+ var SWAPPED_STATUS_VALUES = /* @__PURE__ */ new Set([
2150
+ "payment_pending",
2151
+ "order_completed",
2152
+ "order_broadcasted",
2153
+ "order_cancelled"
2154
+ ]);
2155
+ function parseSwappedIframeMessage(raw) {
2156
+ let data = raw;
2157
+ if (typeof data === "string") {
2158
+ try {
2159
+ data = JSON.parse(data);
2160
+ } catch {
2161
+ return null;
2162
+ }
2163
+ }
2164
+ if (!data || typeof data !== "object") return null;
2165
+ const obj = data;
2166
+ const inner = obj.data && typeof obj.data === "object" ? obj.data : obj;
2167
+ const rawStatus = inner.order_status ?? inner.status ?? obj.status;
2168
+ if (typeof rawStatus !== "string" || !SWAPPED_STATUS_VALUES.has(rawStatus)) {
2169
+ return null;
2170
+ }
2171
+ const asString2 = (v) => typeof v === "string" && v.length > 0 ? v : void 0;
2172
+ return {
2173
+ status: rawStatus,
2174
+ orderId: asString2(inner.order_id) ?? asString2(obj.orderId),
2175
+ orderCrypto: asString2(inner.order_crypto) ?? asString2(obj.orderCrypto),
2176
+ orderCryptoAmount: asString2(inner.order_crypto_amount) ?? asString2(obj.orderCryptoAmount),
2177
+ transactionId: asString2(inner.transaction_id) ?? asString2(obj.transactionId)
2178
+ };
2179
+ }
2180
+ function SwappedIframeStep({
2181
+ smartAccount,
1974
2182
  service,
1975
- onContinue,
1976
- onTotalBalanceComputed,
1977
- onDisconnect,
1978
- debug
2183
+ variant,
2184
+ loadUrl,
2185
+ iframeTitle,
2186
+ loadErrorCode,
2187
+ loadErrorFallback,
2188
+ bannerForStatus,
2189
+ onSwappedComplete,
2190
+ onSwappedFailed,
2191
+ onClose,
2192
+ onError
1979
2193
  }) {
1980
- const [tokenBalances, setTokenBalances] = useState6([]);
1981
- const [selectedSymbol, setSelectedSymbol] = useState6(null);
1982
- const [loading, setLoading] = useState6(true);
1983
- const [error, setError] = useState6(null);
2194
+ const [widgetUrl, setWidgetUrl] = useState6(null);
2195
+ const [loadError, setLoadError] = useState6(null);
2196
+ const [iframeLoaded, setIframeLoaded] = useState6(false);
2197
+ const [retryToken, setRetryToken] = useState6(0);
2198
+ const [orderState, setOrderState] = useState6(null);
2199
+ const [latestEvent, setLatestEvent] = useState6(null);
2200
+ const [phase, setPhase] = useState6("iframe");
2201
+ const completeFiredRef = useRef6(false);
2202
+ const failedFiredRef = useRef6(false);
2203
+ const expectedOrderUuidRef = useRef6(null);
2204
+ const baselineDepositTxHashRef = useRef6(void 0);
2205
+ const currentDepositTxHashRef = useRef6(null);
2206
+ const fastDepositPollEnabledRef = useRef6(false);
2207
+ const rescheduleDepositPollRef = useRef6(
2208
+ null
2209
+ );
2210
+ const onSwappedCompleteRef = useRef6(onSwappedComplete);
2211
+ onSwappedCompleteRef.current = onSwappedComplete;
2212
+ const onSwappedFailedRef = useRef6(onSwappedFailed);
2213
+ onSwappedFailedRef.current = onSwappedFailed;
2214
+ const onErrorRef = useRef6(onError);
2215
+ onErrorRef.current = onError;
2216
+ const loadUrlRef = useRef6(loadUrl);
2217
+ loadUrlRef.current = loadUrl;
1984
2218
  useEffect6(() => {
1985
- let active = true;
1986
- async function loadBalances() {
1987
- if (!solanaAddress) {
1988
- setLoading(false);
1989
- return;
1990
- }
1991
- setLoading(true);
1992
- setError(null);
1993
- const portfolioBySymbol = {};
2219
+ let cancelled = false;
2220
+ setLoadError(null);
2221
+ setIframeLoaded(false);
2222
+ setWidgetUrl(null);
2223
+ setOrderState(null);
2224
+ setLatestEvent(null);
2225
+ setPhase("iframe");
2226
+ expectedOrderUuidRef.current = null;
2227
+ completeFiredRef.current = false;
2228
+ failedFiredRef.current = false;
2229
+ baselineDepositTxHashRef.current = void 0;
2230
+ currentDepositTxHashRef.current = null;
2231
+ fastDepositPollEnabledRef.current = false;
2232
+ loadUrlRef.current().then((res) => {
2233
+ if (cancelled) return;
2234
+ setWidgetUrl(res.url);
2235
+ const sep = res.externalCustomerId.indexOf(":");
2236
+ expectedOrderUuidRef.current = sep >= 0 ? res.externalCustomerId.slice(sep + 1) : null;
2237
+ }).catch((err) => {
2238
+ if (cancelled) return;
2239
+ const message = err instanceof Error ? err.message : loadErrorFallback;
2240
+ setLoadError(message);
2241
+ onErrorRef.current?.(message, loadErrorCode);
2242
+ });
2243
+ return () => {
2244
+ cancelled = true;
2245
+ };
2246
+ }, [service, smartAccount, retryToken, loadErrorCode, loadErrorFallback]);
2247
+ useEffect6(() => {
2248
+ if (!widgetUrl || iframeLoaded || loadError) return;
2249
+ const timer = setTimeout(() => {
2250
+ setLoadError("Iframe took too long to load.");
2251
+ }, IFRAME_LOAD_TIMEOUT_MS);
2252
+ return () => clearTimeout(timer);
2253
+ }, [widgetUrl, iframeLoaded, loadError]);
2254
+ useEffect6(() => {
2255
+ let cancelled = false;
2256
+ let timeoutId;
2257
+ async function poll() {
2258
+ if (cancelled) return;
1994
2259
  try {
1995
- debugLog(debug, "solana-token-select", "portfolio:request", {
1996
- solanaAddress
1997
- });
1998
- const portfolio = await service.fetchSolanaPortfolio(solanaAddress);
1999
- if (!active) return;
2000
- for (const t of portfolio.tokens) {
2001
- const symbol = t.symbol.toUpperCase();
2002
- if (!SOLANA_TOKENS.some((st) => st.symbol === symbol)) continue;
2003
- let parsed = 0n;
2004
- try {
2005
- parsed = BigInt(t.balance || "0");
2006
- } catch {
2007
- parsed = 0n;
2008
- }
2009
- if (parsed <= 0n) continue;
2010
- const existing = portfolioBySymbol[symbol];
2011
- if (!existing || (t.balanceUsd ?? 0) > existing.balanceUsd) {
2012
- portfolioBySymbol[symbol] = {
2013
- balance: parsed,
2014
- balanceUsd: t.balanceUsd ?? 0
2015
- };
2016
- }
2260
+ const res = await service.fetchSwappedOrderStatus(smartAccount);
2261
+ if (cancelled) return;
2262
+ const isCurrentOrder = res !== null && expectedOrderUuidRef.current !== null && res.orderId === expectedOrderUuidRef.current;
2263
+ if (isCurrentOrder) {
2264
+ setOrderState(res);
2017
2265
  }
2018
- debugLog(debug, "solana-token-select", "portfolio:success", {
2019
- symbols: Object.keys(portfolioBySymbol)
2020
- });
2021
- } catch (err) {
2022
- if (!active) return;
2023
- debugError(debug, "solana-token-select", "portfolio:failure", err, {
2024
- solanaAddress
2025
- });
2026
- setError(
2027
- err instanceof Error ? err.message : "Failed to load balances"
2028
- );
2029
- setTokenBalances([]);
2030
- setLoading(false);
2031
- return;
2266
+ } catch {
2032
2267
  }
2033
- const results = [];
2034
- for (const token of SOLANA_TOKENS) {
2035
- const fromPortfolio = portfolioBySymbol[token.symbol];
2036
- if (fromPortfolio && fromPortfolio.balance > 0n) {
2037
- results.push({
2038
- token,
2039
- balance: fromPortfolio.balance,
2040
- balanceUsd: fromPortfolio.balanceUsd
2041
- });
2268
+ if (!cancelled) {
2269
+ timeoutId = setTimeout(poll, STATUS_POLL_INTERVAL_MS);
2270
+ }
2271
+ }
2272
+ poll();
2273
+ return () => {
2274
+ cancelled = true;
2275
+ clearTimeout(timeoutId);
2276
+ };
2277
+ }, [service, smartAccount]);
2278
+ useEffect6(() => {
2279
+ let cancelled = false;
2280
+ let timeoutId;
2281
+ async function pollDeposit() {
2282
+ if (cancelled) return;
2283
+ try {
2284
+ const status = await service.fetchLatestStatus(smartAccount);
2285
+ if (cancelled) return;
2286
+ const event = status.lastEvent;
2287
+ const eventTxHash = isDepositEvent(event) ? getEventTxHash(event) ?? null : null;
2288
+ if (baselineDepositTxHashRef.current === void 0) {
2289
+ baselineDepositTxHashRef.current = eventTxHash;
2290
+ } else if (eventTxHash && (!baselineDepositTxHashRef.current || !txRefsMatch(eventTxHash, baselineDepositTxHashRef.current))) {
2291
+ currentDepositTxHashRef.current = eventTxHash;
2292
+ setLatestEvent(event ?? null);
2042
2293
  }
2294
+ } catch {
2295
+ }
2296
+ if (!cancelled) {
2297
+ const nextInterval = fastDepositPollEnabledRef.current ? DEPOSIT_POLL_FAST_INTERVAL_MS : DEPOSIT_POLL_INTERVAL_MS;
2298
+ timeoutId = setTimeout(pollDeposit, nextInterval);
2043
2299
  }
2044
- if (!active) return;
2045
- setTokenBalances(results);
2046
- setLoading(false);
2047
- const totalUsd = results.reduce((sum, r) => sum + r.balanceUsd, 0);
2048
- onTotalBalanceComputed?.(totalUsd);
2049
2300
  }
2050
- void loadBalances();
2301
+ rescheduleDepositPollRef.current = (delayMs) => {
2302
+ if (cancelled) return;
2303
+ if (timeoutId !== void 0) clearTimeout(timeoutId);
2304
+ timeoutId = setTimeout(pollDeposit, delayMs);
2305
+ };
2306
+ pollDeposit();
2051
2307
  return () => {
2052
- active = false;
2308
+ cancelled = true;
2309
+ if (timeoutId !== void 0) clearTimeout(timeoutId);
2310
+ rescheduleDepositPollRef.current = null;
2053
2311
  };
2054
- }, [debug, solanaAddress, service, onTotalBalanceComputed]);
2055
- const rows = useMemo4(
2056
- () => [...tokenBalances].sort((a, b) => {
2057
- if (a.balanceUsd !== b.balanceUsd) return b.balanceUsd - a.balanceUsd;
2058
- if (b.balance > a.balance) return 1;
2312
+ }, [service, smartAccount]);
2313
+ useEffect6(() => {
2314
+ if (fastDepositPollEnabledRef.current) return;
2315
+ const status = orderState?.status;
2316
+ if (!status || !SWAPPED_TERMINAL_STATUSES.has(status)) return;
2317
+ fastDepositPollEnabledRef.current = true;
2318
+ rescheduleDepositPollRef.current?.(DEPOSIT_POLL_FAST_INITIAL_DELAY_MS);
2319
+ }, [orderState]);
2320
+ useEffect6(() => {
2321
+ function onMessage(e) {
2322
+ if (!SWAPPED_IFRAME_ORIGINS.has(e.origin)) return;
2323
+ const parsed = parseSwappedIframeMessage(e.data);
2324
+ if (!parsed) return;
2325
+ setOrderState((prev) => ({
2326
+ orderId: parsed.orderId ?? prev?.orderId ?? "",
2327
+ status: parsed.status,
2328
+ orderCrypto: parsed.orderCrypto ?? prev?.orderCrypto ?? null,
2329
+ orderCryptoAmount: parsed.orderCryptoAmount ?? prev?.orderCryptoAmount ?? null,
2330
+ transactionId: parsed.transactionId ?? prev?.transactionId ?? null,
2331
+ receivedAt: (/* @__PURE__ */ new Date()).toISOString(),
2332
+ paidAmountUsd: prev?.paidAmountUsd ?? null,
2333
+ paidAmountEur: prev?.paidAmountEur ?? null,
2334
+ onrampFeeUsd: prev?.onrampFeeUsd ?? null,
2335
+ paymentMethod: prev?.paymentMethod ?? null
2336
+ }));
2337
+ }
2338
+ window.addEventListener("message", onMessage);
2339
+ return () => window.removeEventListener("message", onMessage);
2340
+ }, []);
2341
+ useEffect6(() => {
2342
+ if (phase === "iframe" && orderState !== null) {
2343
+ setPhase("tracker");
2344
+ }
2345
+ }, [phase, orderState]);
2346
+ const stepStates = useMemo4(
2347
+ () => deriveStepStates(orderState?.status ?? null, latestEvent),
2348
+ [orderState, latestEvent]
2349
+ );
2350
+ const terminalState = useMemo4(() => {
2351
+ if (isFailedEvent(latestEvent ?? void 0)) {
2352
+ return {
2353
+ kind: "failed",
2354
+ message: failureMessageForEvent(latestEvent ?? void 0)
2355
+ };
2356
+ }
2357
+ if (orderState?.status === "order_cancelled") {
2358
+ const banner = bannerForStatus("order_cancelled", {});
2359
+ return { kind: "cancelled", message: banner.detail ?? banner.title };
2360
+ }
2361
+ return null;
2362
+ }, [latestEvent, orderState, bannerForStatus]);
2363
+ useEffect6(() => {
2364
+ if (completeFiredRef.current || failedFiredRef.current) return;
2365
+ const t = latestEvent?.type;
2366
+ const isSuccess = t === "bridge-complete" || t === "post-bridge-swap-complete";
2367
+ if (!isSuccess) return;
2368
+ const txHash = currentDepositTxHashRef.current;
2369
+ if (!txHash) return;
2370
+ completeFiredRef.current = true;
2371
+ onSwappedCompleteRef.current({
2372
+ txHash,
2373
+ orderCrypto: orderState?.orderCrypto ?? null,
2374
+ // Base-unit source amount from the deposit row/event, consistent with the
2375
+ // wallet/QR path. ProcessingStep + onLifecycle expect base units.
2376
+ amount: getEventSourceDetails(latestEvent ?? void 0).amount ?? null
2377
+ });
2378
+ }, [latestEvent, orderState]);
2379
+ useEffect6(() => {
2380
+ if (failedFiredRef.current || completeFiredRef.current) return;
2381
+ if (!isFailedEvent(latestEvent ?? void 0)) return;
2382
+ const txHash = currentDepositTxHashRef.current;
2383
+ if (!txHash) return;
2384
+ failedFiredRef.current = true;
2385
+ setPhase("tracker");
2386
+ onSwappedFailedRef.current?.(
2387
+ txHash,
2388
+ failureMessageForEvent(latestEvent ?? void 0)
2389
+ );
2390
+ }, [latestEvent]);
2391
+ if (phase === "tracker") {
2392
+ return /* @__PURE__ */ jsx8(
2393
+ SwappedOrderTracker,
2394
+ {
2395
+ amount: orderState?.orderCryptoAmount ?? null,
2396
+ currency: orderState?.orderCrypto ?? "USDC",
2397
+ stepStates,
2398
+ terminal: terminalState,
2399
+ onRetry: () => setRetryToken((n) => n + 1),
2400
+ onClose
2401
+ }
2402
+ );
2403
+ }
2404
+ return /* @__PURE__ */ jsxs8("div", { className: "rs-screen rs-fiat-onramp", "data-variant": variant, children: [
2405
+ /* @__PURE__ */ jsxs8("div", { className: "rs-screen-body rs-screen-body--gap-32", children: [
2406
+ /* @__PURE__ */ jsx8(
2407
+ BodyHeader,
2408
+ {
2409
+ icon: /* @__PURE__ */ jsx8(HandCoinsIcon, {}),
2410
+ title: "Deposit",
2411
+ subtitle: "Add money to your balance"
2412
+ }
2413
+ ),
2414
+ /* @__PURE__ */ jsxs8("div", { className: "rs-fiat-onramp-iframe-wrap", children: [
2415
+ loadError && /* @__PURE__ */ jsxs8("div", { className: "rs-fiat-onramp-error", children: [
2416
+ /* @__PURE__ */ jsx8("div", { children: loadError }),
2417
+ /* @__PURE__ */ jsx8(
2418
+ "button",
2419
+ {
2420
+ type: "button",
2421
+ className: "rs-fiat-onramp-retry",
2422
+ onClick: () => setRetryToken((n) => n + 1),
2423
+ children: "Retry"
2424
+ }
2425
+ )
2426
+ ] }),
2427
+ !loadError && !iframeLoaded && /* @__PURE__ */ jsx8("div", { className: "rs-fiat-onramp-loading", children: /* @__PURE__ */ jsx8(Spinner, {}) }),
2428
+ widgetUrl && !loadError && /* @__PURE__ */ jsx8(
2429
+ "iframe",
2430
+ {
2431
+ src: widgetUrl,
2432
+ title: iframeTitle,
2433
+ className: "rs-fiat-onramp-iframe",
2434
+ sandbox: "allow-scripts allow-forms allow-same-origin allow-popups allow-popups-to-escape-sandbox allow-top-navigation-by-user-activation",
2435
+ allow: "payment; camera; microphone; clipboard-write; geolocation",
2436
+ onLoad: () => setIframeLoaded(true)
2437
+ },
2438
+ retryToken
2439
+ )
2440
+ ] })
2441
+ ] }),
2442
+ /* @__PURE__ */ jsx8(PoweredBy, {})
2443
+ ] });
2444
+ }
2445
+ function deriveStepStates(swappedStatus, latestEvent) {
2446
+ if (isFailedEvent(latestEvent ?? void 0)) {
2447
+ return ["complete", "complete", "failed", "pending"];
2448
+ }
2449
+ if (swappedStatus === "order_cancelled") {
2450
+ return ["failed", "pending", "pending", "pending"];
2451
+ }
2452
+ const step1Complete = swappedStatus === "order_completed" || swappedStatus === "order_broadcasted";
2453
+ const step2Complete = latestEvent !== null;
2454
+ const step3Complete = latestEvent?.type === "bridge-complete" || latestEvent?.type === "post-bridge-swap-complete";
2455
+ if (step3Complete) {
2456
+ return ["complete", "complete", "complete", "pending"];
2457
+ }
2458
+ if (step2Complete) {
2459
+ return ["complete", "complete", "active", "pending"];
2460
+ }
2461
+ if (step1Complete) {
2462
+ return ["complete", "active", "pending", "pending"];
2463
+ }
2464
+ return ["active", "pending", "pending", "pending"];
2465
+ }
2466
+ SwappedIframeStep.displayName = "SwappedIframeStep";
2467
+
2468
+ // src/components/steps/FiatOnrampStep.tsx
2469
+ import { jsx as jsx9 } from "react/jsx-runtime";
2470
+ function fiatBannerForStatus(status, context) {
2471
+ if (context.currencyMismatch) {
2472
+ return {
2473
+ level: "warning",
2474
+ title: "Currency mismatch",
2475
+ detail: "Funds may not bridge automatically. Contact support if your balance does not arrive."
2476
+ };
2477
+ }
2478
+ switch (status) {
2479
+ case "payment_pending":
2480
+ return { level: "info", title: "Verifying payment\u2026" };
2481
+ case "order_completed":
2482
+ return { level: "success", title: "Payment received \u2014 sending crypto" };
2483
+ case "order_broadcasted":
2484
+ return {
2485
+ level: "success",
2486
+ title: "Crypto sent \u2014 confirming on-chain"
2487
+ };
2488
+ case "order_cancelled":
2489
+ return {
2490
+ level: "warning",
2491
+ title: "Order cancelled",
2492
+ detail: "If you were charged, Swapped will refund within 5 business days."
2493
+ };
2494
+ }
2495
+ }
2496
+ function FiatOnrampStep({
2497
+ smartAccount,
2498
+ service,
2499
+ paymentMethod,
2500
+ onSwappedComplete,
2501
+ onSwappedFailed,
2502
+ onClose,
2503
+ onError
2504
+ }) {
2505
+ const loadUrl = useCallback3(async () => {
2506
+ const res = await service.getSwappedWidgetUrl({
2507
+ smartAccount,
2508
+ method: paymentMethod
2509
+ });
2510
+ if (res.currencyCode !== "USDC_BASE") {
2511
+ console.warn(
2512
+ `[FiatOnrampStep] Expected backend to return currencyCode=USDC_BASE, got ${res.currencyCode}. Swapped purchases may not bridge as expected.`
2513
+ );
2514
+ }
2515
+ return res;
2516
+ }, [service, smartAccount, paymentMethod]);
2517
+ return /* @__PURE__ */ jsx9(
2518
+ SwappedIframeStep,
2519
+ {
2520
+ smartAccount,
2521
+ service,
2522
+ variant: "fiat",
2523
+ loadUrl,
2524
+ iframeTitle: "Buy crypto with Swapped",
2525
+ loadErrorCode: "SWAPPED_URL_FAILED",
2526
+ loadErrorFallback: "Failed to load on-ramp",
2527
+ bannerForStatus: fiatBannerForStatus,
2528
+ onSwappedComplete,
2529
+ onSwappedFailed,
2530
+ onClose,
2531
+ onError
2532
+ }
2533
+ );
2534
+ }
2535
+ FiatOnrampStep.displayName = "FiatOnrampStep";
2536
+
2537
+ // src/components/steps/ExchangeConnectStep.tsx
2538
+ import { useCallback as useCallback4 } from "react";
2539
+ import { jsx as jsx10 } from "react/jsx-runtime";
2540
+ function connectBannerForStatus(status, context) {
2541
+ if (context.currencyMismatch) {
2542
+ return {
2543
+ level: "warning",
2544
+ title: "Currency mismatch",
2545
+ detail: "Funds may not bridge automatically. Contact support if your balance does not arrive."
2546
+ };
2547
+ }
2548
+ switch (status) {
2549
+ case "payment_pending":
2550
+ return { level: "info", title: "Waiting for exchange transfer\u2026" };
2551
+ case "order_completed":
2552
+ return {
2553
+ level: "success",
2554
+ title: "Exchange transfer received \u2014 sending crypto"
2555
+ };
2556
+ case "order_broadcasted":
2557
+ return {
2558
+ level: "success",
2559
+ title: "Crypto sent \u2014 confirming on-chain"
2560
+ };
2561
+ case "order_cancelled":
2562
+ return {
2563
+ level: "warning",
2564
+ title: "Order cancelled",
2565
+ detail: "If your exchange already debited the funds, Swapped will refund within 5 business days."
2566
+ };
2567
+ }
2568
+ }
2569
+ function ExchangeConnectStep({
2570
+ smartAccount,
2571
+ service,
2572
+ connection,
2573
+ onSwappedComplete,
2574
+ onSwappedFailed,
2575
+ onClose,
2576
+ onError
2577
+ }) {
2578
+ const loadUrl = useCallback4(async () => {
2579
+ const res = await service.getSwappedConnectUrl({
2580
+ smartAccount,
2581
+ connection
2582
+ });
2583
+ if (res.currencyCode !== "USDC_BASE") {
2584
+ console.warn(
2585
+ `[ExchangeConnectStep] Expected backend to return currencyCode=USDC_BASE, got ${res.currencyCode}. Swapped Connect pulls may not bridge as expected.`
2586
+ );
2587
+ }
2588
+ return res;
2589
+ }, [service, smartAccount, connection]);
2590
+ return /* @__PURE__ */ jsx10(
2591
+ SwappedIframeStep,
2592
+ {
2593
+ smartAccount,
2594
+ service,
2595
+ variant: "connect",
2596
+ loadUrl,
2597
+ iframeTitle: "Fund from exchange via Swapped",
2598
+ loadErrorCode: "SWAPPED_CONNECT_URL_FAILED",
2599
+ loadErrorFallback: "Failed to load Connect",
2600
+ bannerForStatus: connectBannerForStatus,
2601
+ onSwappedComplete,
2602
+ onSwappedFailed,
2603
+ onClose,
2604
+ onError
2605
+ }
2606
+ );
2607
+ }
2608
+ ExchangeConnectStep.displayName = "ExchangeConnectStep";
2609
+
2610
+ // src/components/steps/ExchangeSelectStep.tsx
2611
+ import { useCallback as useCallback5, useEffect as useEffect7, useState as useState7 } from "react";
2612
+ import { jsx as jsx11, jsxs as jsxs9 } from "react/jsx-runtime";
2613
+ function ExchangeLogo({ exchange }) {
2614
+ const [failed, setFailed] = useState7(false);
2615
+ if (!exchange.logoUrl || failed) {
2616
+ return /* @__PURE__ */ jsx11(BankIcon, {});
2617
+ }
2618
+ return /* @__PURE__ */ jsx11(
2619
+ "img",
2620
+ {
2621
+ src: exchange.logoUrl,
2622
+ alt: "",
2623
+ onError: () => setFailed(true)
2624
+ }
2625
+ );
2626
+ }
2627
+ function ExchangeSelectStep({
2628
+ service,
2629
+ onSelectExchange,
2630
+ onError
2631
+ }) {
2632
+ const [exchanges, setExchanges] = useState7([]);
2633
+ const [loading, setLoading] = useState7(true);
2634
+ const [error, setError] = useState7(null);
2635
+ const [retryToken, setRetryToken] = useState7(0);
2636
+ const retry = useCallback5(() => {
2637
+ setRetryToken((n) => n + 1);
2638
+ }, []);
2639
+ useEffect7(() => {
2640
+ let cancelled = false;
2641
+ setLoading(true);
2642
+ setError(null);
2643
+ service.getSwappedConnectExchanges().then((res) => {
2644
+ if (cancelled) return;
2645
+ setExchanges(res.exchanges);
2646
+ }).catch((err) => {
2647
+ if (cancelled) return;
2648
+ const message = err instanceof Error ? err.message : "Failed to load exchanges";
2649
+ setExchanges([]);
2650
+ setError(message);
2651
+ onError?.(message, "SWAPPED_CONNECT_EXCHANGES_FAILED");
2652
+ }).finally(() => {
2653
+ if (!cancelled) setLoading(false);
2654
+ });
2655
+ return () => {
2656
+ cancelled = true;
2657
+ };
2658
+ }, [service, retryToken, onError]);
2659
+ return /* @__PURE__ */ jsxs9("div", { className: "rs-screen rs-exchange-select", children: [
2660
+ /* @__PURE__ */ jsxs9("div", { className: "rs-screen-body rs-screen-body--gap-32", children: [
2661
+ /* @__PURE__ */ jsx11(
2662
+ BodyHeader,
2663
+ {
2664
+ icon: /* @__PURE__ */ jsx11(BankIcon, {}),
2665
+ title: "Fund from Exchange",
2666
+ subtitle: "Choose your exchange"
2667
+ }
2668
+ ),
2669
+ loading && /* @__PURE__ */ jsx11("div", { className: "rs-exchange-select-state", "aria-live": "polite", children: /* @__PURE__ */ jsx11(Spinner, {}) }),
2670
+ !loading && error && /* @__PURE__ */ jsxs9("div", { className: "rs-exchange-select-state", "aria-live": "polite", children: [
2671
+ /* @__PURE__ */ jsx11("div", { className: "rs-exchange-select-state-title", children: "Couldn\u2019t load exchanges" }),
2672
+ /* @__PURE__ */ jsx11(
2673
+ "button",
2674
+ {
2675
+ type: "button",
2676
+ className: "rs-fiat-onramp-retry",
2677
+ onClick: retry,
2678
+ children: "Retry"
2679
+ }
2680
+ )
2681
+ ] }),
2682
+ !loading && !error && exchanges.length === 0 && /* @__PURE__ */ jsxs9("div", { className: "rs-exchange-select-state", "aria-live": "polite", children: [
2683
+ /* @__PURE__ */ jsx11("div", { className: "rs-exchange-select-state-title", children: "No exchanges available" }),
2684
+ /* @__PURE__ */ jsx11(
2685
+ "button",
2686
+ {
2687
+ type: "button",
2688
+ className: "rs-fiat-onramp-retry",
2689
+ onClick: retry,
2690
+ children: "Retry"
2691
+ }
2692
+ )
2693
+ ] }),
2694
+ !loading && !error && exchanges.length > 0 && /* @__PURE__ */ jsx11("div", { className: "rs-exchange-grid", children: exchanges.map((exchange) => /* @__PURE__ */ jsxs9(
2695
+ "button",
2696
+ {
2697
+ type: "button",
2698
+ className: "rs-exchange-card",
2699
+ onClick: () => onSelectExchange(exchange.connection),
2700
+ "aria-label": `Select ${exchange.name}`,
2701
+ children: [
2702
+ /* @__PURE__ */ jsx11("span", { className: "rs-exchange-card-logo", children: /* @__PURE__ */ jsx11(ExchangeLogo, { exchange }) }),
2703
+ /* @__PURE__ */ jsx11("span", { className: "rs-exchange-card-name", children: exchange.name })
2704
+ ]
2705
+ },
2706
+ exchange.connection
2707
+ )) })
2708
+ ] }),
2709
+ /* @__PURE__ */ jsx11(PoweredBy, {})
2710
+ ] });
2711
+ }
2712
+ ExchangeSelectStep.displayName = "ExchangeSelectStep";
2713
+
2714
+ // src/components/steps/DepositAddressSkeleton.tsx
2715
+ import { jsx as jsx12, jsxs as jsxs10 } from "react/jsx-runtime";
2716
+ var BASE_CHAIN_ID = 8453;
2717
+ function DepositAddressSkeleton({
2718
+ uiConfig,
2719
+ allowedRoutes
2720
+ }) {
2721
+ const allowedChainSet = allowedRoutes?.sourceChains ? new Set(allowedRoutes.sourceChains) : null;
2722
+ const allowedTokenSet = allowedRoutes?.sourceTokens ? new Set(allowedRoutes.sourceTokens.map((s) => s.toUpperCase())) : null;
2723
+ const evmChainIds = (() => {
2724
+ const all = getSupportedChainIds();
2725
+ return allowedChainSet ? all.filter((id) => allowedChainSet.has(id)) : all;
2726
+ })();
2727
+ const defaultChainId = evmChainIds.includes(BASE_CHAIN_ID) ? BASE_CHAIN_ID : evmChainIds[0];
2728
+ const tokensForChain = (() => {
2729
+ const all = getTargetTokenSymbolsForChain(defaultChainId);
2730
+ return allowedTokenSet ? all.filter((s) => allowedTokenSet.has(s.toUpperCase())) : all;
2731
+ })();
2732
+ const defaultToken = tokensForChain.includes("USDC") ? "USDC" : tokensForChain[0] ?? "USDC";
2733
+ const chainName = getChainName(defaultChainId);
2734
+ const chainIcon = getChainIcon(defaultChainId);
2735
+ const tokenIcon = getTokenIcon(defaultToken);
2736
+ return /* @__PURE__ */ jsxs10("div", { className: "rs-screen", "aria-busy": "true", children: [
2737
+ /* @__PURE__ */ jsx12("span", { className: "rs-sr-only", role: "status", children: "Preparing deposit details\u2026" }),
2738
+ /* @__PURE__ */ jsxs10("div", { className: "rs-screen-body", children: [
2739
+ /* @__PURE__ */ jsx12(BodyHeader, { icon: /* @__PURE__ */ jsx12(TransferCryptoIcon, {}), title: "Transfer crypto" }),
2740
+ /* @__PURE__ */ jsxs10("div", { className: "rs-deposit-address-selectors", "aria-hidden": "true", children: [
2741
+ /* @__PURE__ */ jsxs10("div", { className: "rs-deposit-address-dropdown", children: [
2742
+ /* @__PURE__ */ jsx12("div", { className: "rs-deposit-address-dropdown-label", children: "Supported chain" }),
2743
+ /* @__PURE__ */ jsxs10("div", { className: "rs-deposit-address-dropdown-trigger", children: [
2744
+ chainIcon && /* @__PURE__ */ jsx12(
2745
+ "img",
2746
+ {
2747
+ src: chainIcon,
2748
+ alt: "",
2749
+ className: "rs-deposit-address-dropdown-icon"
2750
+ }
2751
+ ),
2752
+ /* @__PURE__ */ jsx12("span", { children: chainName }),
2753
+ /* @__PURE__ */ jsx12(ChevronDownIcon, { className: "rs-deposit-address-dropdown-chevron" })
2754
+ ] })
2755
+ ] }),
2756
+ /* @__PURE__ */ jsxs10("div", { className: "rs-deposit-address-dropdown", children: [
2757
+ /* @__PURE__ */ jsxs10("div", { className: "rs-deposit-address-dropdown-label rs-deposit-address-dropdown-label--with-min", children: [
2758
+ /* @__PURE__ */ jsx12("span", { children: "Supported token" }),
2759
+ /* @__PURE__ */ jsxs10("span", { className: "rs-deposit-address-min", children: [
2760
+ "Min.$",
2761
+ (uiConfig?.minDepositUsd ?? 0.1).toFixed(2),
2762
+ /* @__PURE__ */ jsx12(Tooltip, { content: "Minimum deposit amount required for the selected chain.", children: /* @__PURE__ */ jsx12(
2763
+ InfoIcon,
2764
+ {
2765
+ className: "rs-deposit-address-min-icon",
2766
+ "aria-hidden": "true"
2767
+ }
2768
+ ) })
2769
+ ] })
2770
+ ] }),
2771
+ /* @__PURE__ */ jsxs10("div", { className: "rs-deposit-address-dropdown-trigger", children: [
2772
+ tokenIcon && /* @__PURE__ */ jsx12(
2773
+ "img",
2774
+ {
2775
+ src: tokenIcon,
2776
+ alt: "",
2777
+ className: "rs-deposit-address-dropdown-icon"
2778
+ }
2779
+ ),
2780
+ /* @__PURE__ */ jsx12("span", { children: defaultToken }),
2781
+ /* @__PURE__ */ jsx12(ChevronDownIcon, { className: "rs-deposit-address-dropdown-chevron" })
2782
+ ] })
2783
+ ] })
2784
+ ] }),
2785
+ /* @__PURE__ */ jsxs10(
2786
+ "div",
2787
+ {
2788
+ style: { display: "flex", flexDirection: "column", gap: 4, width: "100%" },
2789
+ children: [
2790
+ /* @__PURE__ */ jsxs10("div", { className: "rs-deposit-address-well", children: [
2791
+ /* @__PURE__ */ jsx12("div", { className: "rs-deposit-address-qr", children: /* @__PURE__ */ jsx12("div", { className: "rs-skeleton rs-skeleton-qr", "aria-hidden": "true" }) }),
2792
+ /* @__PURE__ */ jsx12("div", { className: "rs-skeleton rs-skeleton-address", "aria-hidden": "true" })
2793
+ ] }),
2794
+ /* @__PURE__ */ jsxs10(
2795
+ "button",
2796
+ {
2797
+ type: "button",
2798
+ className: "rs-deposit-address-copy",
2799
+ disabled: true,
2800
+ "aria-hidden": "true",
2801
+ children: [
2802
+ /* @__PURE__ */ jsx12(CopyIcon, {}),
2803
+ "Copy address"
2804
+ ]
2805
+ }
2806
+ )
2807
+ ]
2808
+ }
2809
+ ),
2810
+ /* @__PURE__ */ jsx12("div", { className: "rs-price-impact", "aria-hidden": "true", children: /* @__PURE__ */ jsxs10("div", { className: "rs-price-impact-header", children: [
2811
+ /* @__PURE__ */ jsxs10("span", { className: "rs-price-impact-header-left", children: [
2812
+ /* @__PURE__ */ jsx12("span", { className: "rs-price-impact-label", children: "Price impact" }),
2813
+ /* @__PURE__ */ jsx12("span", { className: "rs-price-impact-label", children: /* @__PURE__ */ jsx12("strong", { children: "0.00%" }) }),
2814
+ /* @__PURE__ */ jsx12(
2815
+ Tooltip,
2816
+ {
2817
+ className: "rs-price-impact-info",
2818
+ content: "Price impact is the difference between expected and execution price, due to trade size and liquidity.",
2819
+ children: /* @__PURE__ */ jsx12(InfoIcon, { "aria-hidden": "true" })
2820
+ }
2821
+ )
2822
+ ] }),
2823
+ /* @__PURE__ */ jsx12(
2824
+ ChevronDownIcon,
2825
+ {
2826
+ className: "rs-price-impact-chevron",
2827
+ "aria-hidden": "true"
2828
+ }
2829
+ )
2830
+ ] }) })
2831
+ ] }),
2832
+ /* @__PURE__ */ jsx12(PoweredBy, {})
2833
+ ] });
2834
+ }
2835
+ DepositAddressSkeleton.displayName = "DepositAddressSkeleton";
2836
+
2837
+ // src/components/steps/SolanaTokenSelectStep.tsx
2838
+ import { useState as useState8, useEffect as useEffect8, useMemo as useMemo5 } from "react";
2839
+ import { formatUnits as formatUnits4 } from "viem";
2840
+ import { jsx as jsx13, jsxs as jsxs11 } from "react/jsx-runtime";
2841
+ function SolanaTokenSelectStep({
2842
+ solanaAddress,
2843
+ service,
2844
+ onContinue,
2845
+ onTotalBalanceComputed,
2846
+ onDisconnect,
2847
+ debug
2848
+ }) {
2849
+ const [tokenBalances, setTokenBalances] = useState8([]);
2850
+ const [selectedSymbol, setSelectedSymbol] = useState8(null);
2851
+ const [loading, setLoading] = useState8(true);
2852
+ const [error, setError] = useState8(null);
2853
+ useEffect8(() => {
2854
+ let active = true;
2855
+ async function loadBalances() {
2856
+ if (!solanaAddress) {
2857
+ setLoading(false);
2858
+ return;
2859
+ }
2860
+ setLoading(true);
2861
+ setError(null);
2862
+ const portfolioBySymbol = {};
2863
+ try {
2864
+ debugLog(debug, "solana-token-select", "portfolio:request", {
2865
+ solanaAddress
2866
+ });
2867
+ const portfolio = await service.fetchSolanaPortfolio(solanaAddress);
2868
+ if (!active) return;
2869
+ for (const t of portfolio.tokens) {
2870
+ const symbol = t.symbol.toUpperCase();
2871
+ if (!SOLANA_TOKENS.some((st) => st.symbol === symbol)) continue;
2872
+ let parsed = 0n;
2873
+ try {
2874
+ parsed = BigInt(t.balance || "0");
2875
+ } catch {
2876
+ parsed = 0n;
2877
+ }
2878
+ if (parsed <= 0n) continue;
2879
+ const existing = portfolioBySymbol[symbol];
2880
+ if (!existing || (t.balanceUsd ?? 0) > existing.balanceUsd) {
2881
+ portfolioBySymbol[symbol] = {
2882
+ balance: parsed,
2883
+ balanceUsd: t.balanceUsd ?? 0
2884
+ };
2885
+ }
2886
+ }
2887
+ debugLog(debug, "solana-token-select", "portfolio:success", {
2888
+ symbols: Object.keys(portfolioBySymbol)
2889
+ });
2890
+ } catch (err) {
2891
+ if (!active) return;
2892
+ debugError(debug, "solana-token-select", "portfolio:failure", err, {
2893
+ solanaAddress
2894
+ });
2895
+ setError(
2896
+ err instanceof Error ? err.message : "Failed to load balances"
2897
+ );
2898
+ setTokenBalances([]);
2899
+ setLoading(false);
2900
+ return;
2901
+ }
2902
+ const results = [];
2903
+ for (const token of SOLANA_TOKENS) {
2904
+ const fromPortfolio = portfolioBySymbol[token.symbol];
2905
+ if (fromPortfolio && fromPortfolio.balance > 0n) {
2906
+ results.push({
2907
+ token,
2908
+ balance: fromPortfolio.balance,
2909
+ balanceUsd: fromPortfolio.balanceUsd
2910
+ });
2911
+ }
2912
+ }
2913
+ if (!active) return;
2914
+ setTokenBalances(results);
2915
+ setLoading(false);
2916
+ const totalUsd = results.reduce((sum, r) => sum + r.balanceUsd, 0);
2917
+ onTotalBalanceComputed?.(totalUsd);
2918
+ }
2919
+ void loadBalances();
2920
+ return () => {
2921
+ active = false;
2922
+ };
2923
+ }, [debug, solanaAddress, service, onTotalBalanceComputed]);
2924
+ const rows = useMemo5(
2925
+ () => [...tokenBalances].sort((a, b) => {
2926
+ if (a.balanceUsd !== b.balanceUsd) return b.balanceUsd - a.balanceUsd;
2927
+ if (b.balance > a.balance) return 1;
2059
2928
  if (b.balance < a.balance) return -1;
2060
2929
  return 0;
2061
2930
  }),
@@ -2074,30 +2943,30 @@ function SolanaTokenSelectStep({
2074
2943
  };
2075
2944
  const chainIcon = getChainIcon("solana");
2076
2945
  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(
2946
+ return /* @__PURE__ */ jsxs11("div", { className: "rs-screen", children: [
2947
+ /* @__PURE__ */ jsxs11("div", { className: "rs-screen-body", children: [
2948
+ /* @__PURE__ */ jsx13(
2080
2949
  BodyHeader,
2081
2950
  {
2082
- icon: /* @__PURE__ */ jsx7(WalletIcon, {}),
2951
+ icon: /* @__PURE__ */ jsx13(WalletIcon, {}),
2083
2952
  title: "Your assets",
2084
2953
  subtitle: "Select source assets to transfer"
2085
2954
  }
2086
2955
  ),
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" })
2956
+ loading && /* @__PURE__ */ jsxs11("div", { className: "rs-loading-state", style: { padding: "40px 12px" }, children: [
2957
+ /* @__PURE__ */ jsx13(Spinner, { className: "rs-text-tertiary" }),
2958
+ /* @__PURE__ */ jsx13("span", { className: "rs-text-sm rs-text-tertiary", children: "Loading balances" })
2090
2959
  ] }),
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: [
2960
+ error && /* @__PURE__ */ jsx13(Callout, { variant: "error", children: error }),
2961
+ !loading && !error && rows.length === 0 && /* @__PURE__ */ jsxs11("div", { className: "rs-empty-state", children: [
2962
+ /* @__PURE__ */ jsx13(WalletIcon, { className: "rs-empty-icon" }),
2963
+ /* @__PURE__ */ jsx13("div", { className: "rs-empty-text", children: "No funds in connected wallet" }),
2964
+ /* @__PURE__ */ jsxs11("div", { className: "rs-empty-address", children: [
2096
2965
  solanaAddress.slice(0, 6),
2097
2966
  "...",
2098
2967
  solanaAddress.slice(-4)
2099
2968
  ] }),
2100
- onDisconnect && /* @__PURE__ */ jsx7(
2969
+ onDisconnect && /* @__PURE__ */ jsx13(
2101
2970
  "button",
2102
2971
  {
2103
2972
  type: "button",
@@ -2107,11 +2976,11 @@ function SolanaTokenSelectStep({
2107
2976
  }
2108
2977
  )
2109
2978
  ] }),
2110
- !loading && !error && rows.length > 0 && /* @__PURE__ */ jsx7("div", { className: "rs-asset-list", children: rows.map((entry) => {
2979
+ !loading && !error && rows.length > 0 && /* @__PURE__ */ jsx13("div", { className: "rs-asset-list", children: rows.map((entry) => {
2111
2980
  const isSelected = selectedSymbol === entry.token.symbol;
2112
2981
  const tokenAmount = formatBalance(entry);
2113
2982
  const tokenIcon = getTokenIcon(entry.token.symbol);
2114
- return /* @__PURE__ */ jsxs7(
2983
+ return /* @__PURE__ */ jsxs11(
2115
2984
  "button",
2116
2985
  {
2117
2986
  type: "button",
@@ -2119,33 +2988,33 @@ function SolanaTokenSelectStep({
2119
2988
  className: `rs-asset-row ${isSelected ? "rs-asset-row--selected" : ""}`,
2120
2989
  "aria-pressed": isSelected,
2121
2990
  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 }) })
2991
+ /* @__PURE__ */ jsxs11("div", { className: "rs-asset-info", children: [
2992
+ /* @__PURE__ */ jsxs11("div", { className: "rs-asset-icon-wrapper", children: [
2993
+ tokenIcon ? /* @__PURE__ */ jsx13("span", { className: "rs-asset-icon", children: /* @__PURE__ */ jsx13("img", { src: tokenIcon, alt: entry.token.symbol }) }) : /* @__PURE__ */ jsx13("span", { className: "rs-asset-icon", children: entry.token.symbol.slice(0, 4) }),
2994
+ chainIcon && /* @__PURE__ */ jsx13("span", { className: "rs-asset-chain-badge", children: /* @__PURE__ */ jsx13("img", { src: chainIcon, alt: chainName }) })
2126
2995
  ] }),
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: [
2996
+ /* @__PURE__ */ jsxs11("div", { className: "rs-asset-text", children: [
2997
+ /* @__PURE__ */ jsxs11("div", { className: "rs-asset-name-row", children: [
2998
+ /* @__PURE__ */ jsx13("span", { className: "rs-asset-name", children: entry.token.symbol }),
2999
+ /* @__PURE__ */ jsxs11("span", { className: "rs-asset-chain", children: [
2131
3000
  "on ",
2132
3001
  chainName
2133
3002
  ] })
2134
3003
  ] }),
2135
- /* @__PURE__ */ jsxs7("div", { className: "rs-asset-balance-small", children: [
3004
+ /* @__PURE__ */ jsxs11("div", { className: "rs-asset-balance-small", children: [
2136
3005
  tokenAmount,
2137
3006
  " ",
2138
3007
  entry.token.symbol
2139
3008
  ] })
2140
3009
  ] })
2141
3010
  ] }),
2142
- /* @__PURE__ */ jsx7("div", { className: "rs-asset-balance", children: entry.balanceUsd > 0 ? currencyFormatter.format(entry.balanceUsd) : tokenAmount !== "--" ? `${tokenAmount} ${entry.token.symbol}` : "--" })
3011
+ /* @__PURE__ */ jsx13("div", { className: "rs-asset-balance", children: entry.balanceUsd > 0 ? currencyFormatter.format(entry.balanceUsd) : tokenAmount !== "--" ? `${tokenAmount} ${entry.token.symbol}` : "--" })
2143
3012
  ]
2144
3013
  },
2145
3014
  entry.token.symbol
2146
3015
  );
2147
3016
  }) }),
2148
- /* @__PURE__ */ jsx7(
3017
+ /* @__PURE__ */ jsx13(
2149
3018
  Button,
2150
3019
  {
2151
3020
  onClick: () => selectedEntry && onContinue(
@@ -2159,14 +3028,14 @@ function SolanaTokenSelectStep({
2159
3028
  }
2160
3029
  )
2161
3030
  ] }),
2162
- /* @__PURE__ */ jsx7(PoweredBy, {})
3031
+ /* @__PURE__ */ jsx13(PoweredBy, {})
2163
3032
  ] });
2164
3033
  }
2165
3034
 
2166
3035
  // src/components/steps/SolanaAmountStep.tsx
2167
- import { useCallback as useCallback3, useEffect as useEffect7, useMemo as useMemo5, useRef as useRef6, useState as useState7 } from "react";
3036
+ import { useCallback as useCallback6, useEffect as useEffect9, useMemo as useMemo6, useRef as useRef7, useState as useState9 } from "react";
2168
3037
  import { formatUnits as formatUnits5, parseUnits as parseUnits3 } from "viem";
2169
- import { Fragment as Fragment2, jsx as jsx8, jsxs as jsxs8 } from "react/jsx-runtime";
3038
+ import { Fragment as Fragment2, jsx as jsx14, jsxs as jsxs12 } from "react/jsx-runtime";
2170
3039
  var SOL_FEE_RESERVE_LAMPORTS = 1000000n;
2171
3040
  var PRESETS2 = [
2172
3041
  { value: 25, label: "25%" },
@@ -2180,6 +3049,7 @@ function SolanaAmountStep({
2180
3049
  balanceUsd,
2181
3050
  defaultAmount,
2182
3051
  uiConfig,
3052
+ targetChain,
2183
3053
  targetChainName,
2184
3054
  targetTokenSymbol,
2185
3055
  targetTokenIcon,
@@ -2187,12 +3057,12 @@ function SolanaAmountStep({
2187
3057
  onContinue,
2188
3058
  debug
2189
3059
  }) {
2190
- const [amount, setAmount] = useState7("");
2191
- const [error, setError] = useState7(null);
2192
- const hasAppliedDefaultRef = useRef6(false);
3060
+ const [amount, setAmount] = useState9("");
3061
+ const [error, setError] = useState9(null);
3062
+ const hasAppliedDefaultRef = useRef7(false);
2193
3063
  const isSourceStablecoin = isStablecoinSymbol(token.symbol);
2194
3064
  const isMaxDefault = defaultAmount?.trim().toLowerCase() === "max";
2195
- const tokenPriceUsd = useMemo5(() => {
3065
+ const tokenPriceUsd = useMemo6(() => {
2196
3066
  if (isSourceStablecoin) return 1;
2197
3067
  try {
2198
3068
  const balanceUnits = Number(formatUnits5(balance, token.decimals));
@@ -2206,7 +3076,7 @@ function SolanaAmountStep({
2206
3076
  }
2207
3077
  }, [isSourceStablecoin, balance, token.decimals, balanceUsd]);
2208
3078
  const hasPricing = tokenPriceUsd !== null;
2209
- const formattedBalance = useMemo5(() => {
3079
+ const formattedBalance = useMemo6(() => {
2210
3080
  try {
2211
3081
  const raw = formatUnits5(balance, token.decimals);
2212
3082
  const numeric = Number(raw);
@@ -2216,7 +3086,7 @@ function SolanaAmountStep({
2216
3086
  return "\u2026";
2217
3087
  }
2218
3088
  }, [balance, token.decimals]);
2219
- const computedBalanceUsd = useMemo5(() => {
3089
+ const computedBalanceUsd = useMemo6(() => {
2220
3090
  try {
2221
3091
  const balanceUnits = Number(formatUnits5(balance, token.decimals));
2222
3092
  if (!Number.isFinite(balanceUnits) || balanceUnits < 0) return null;
@@ -2227,11 +3097,11 @@ function SolanaAmountStep({
2227
3097
  return null;
2228
3098
  }
2229
3099
  }, [balance, token.decimals, tokenPriceUsd, balanceUsd]);
2230
- const spendableBalance = useMemo5(() => {
3100
+ const spendableBalance = useMemo6(() => {
2231
3101
  if (!isNativeSol(token)) return balance;
2232
3102
  return balance > SOL_FEE_RESERVE_LAMPORTS ? balance - SOL_FEE_RESERVE_LAMPORTS : 0n;
2233
3103
  }, [balance, token]);
2234
- const spendableBalanceUsd = useMemo5(() => {
3104
+ const spendableBalanceUsd = useMemo6(() => {
2235
3105
  try {
2236
3106
  const spendableUnits = Number(formatUnits5(spendableBalance, token.decimals));
2237
3107
  if (!Number.isFinite(spendableUnits) || spendableUnits < 0) return null;
@@ -2241,7 +3111,7 @@ function SolanaAmountStep({
2241
3111
  return null;
2242
3112
  }
2243
3113
  }, [spendableBalance, token.decimals, tokenPriceUsd]);
2244
- const computePresetAmount = useCallback3(
3114
+ const computePresetAmount = useCallback6(
2245
3115
  (percentage) => {
2246
3116
  try {
2247
3117
  const spendableUnits = Number(
@@ -2264,7 +3134,7 @@ function SolanaAmountStep({
2264
3134
  spendableBalanceUsd
2265
3135
  ]
2266
3136
  );
2267
- useEffect7(() => {
3137
+ useEffect9(() => {
2268
3138
  if (hasAppliedDefaultRef.current || !defaultAmount) return;
2269
3139
  if (isMaxDefault) {
2270
3140
  const next = computePresetAmount(100);
@@ -2280,11 +3150,11 @@ function SolanaAmountStep({
2280
3150
  hasAppliedDefaultRef.current = true;
2281
3151
  }
2282
3152
  }, [defaultAmount, isMaxDefault, computePresetAmount]);
2283
- const numericAmount = useMemo5(() => {
3153
+ const numericAmount = useMemo6(() => {
2284
3154
  const parsed = parseFloat(amount);
2285
3155
  return Number.isFinite(parsed) && parsed > 0 ? parsed : 0;
2286
3156
  }, [amount]);
2287
- const sourceAmountUnits = useMemo5(() => {
3157
+ const sourceAmountUnits = useMemo6(() => {
2288
3158
  if (numericAmount <= 0) return null;
2289
3159
  const raw = isSourceStablecoin || !hasPricing ? numericAmount : numericAmount / (tokenPriceUsd ?? 1);
2290
3160
  try {
@@ -2293,7 +3163,7 @@ function SolanaAmountStep({
2293
3163
  return null;
2294
3164
  }
2295
3165
  }, [numericAmount, isSourceStablecoin, hasPricing, tokenPriceUsd, token.decimals]);
2296
- const minDepositUsd = uiConfig?.minDepositUsd ?? null;
3166
+ const minDepositUsd = targetChain === HYPERCORE_CHAIN_ID ? Math.max(HYPERCORE_MIN_DEPOSIT_USD, uiConfig?.minDepositUsd ?? 0) : uiConfig?.minDepositUsd ?? null;
2297
3167
  const maxDepositUsd = uiConfig?.maxDepositUsd ?? null;
2298
3168
  const isBelowMin = minDepositUsd !== null && numericAmount > 0 && numericAmount < minDepositUsd;
2299
3169
  const isAboveMax = maxDepositUsd !== null && numericAmount > maxDepositUsd;
@@ -2366,12 +3236,12 @@ function SolanaAmountStep({
2366
3236
  const continueLabel = exceedsBalance ? "Insufficient balance" : isAboveMax ? "Continue with max allowed deposit" : isBelowMin ? "Continue with minimum deposit" : "Continue";
2367
3237
  const continueDisabled = exceedsBalance || numericAmount === 0 && !isBelowMin;
2368
3238
  const sourceTokenIcon = getTokenIcon(token.symbol);
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(
3239
+ return /* @__PURE__ */ jsxs12("div", { className: "rs-screen", children: [
3240
+ /* @__PURE__ */ jsxs12("div", { className: "rs-screen-body rs-screen-body--gap-32", children: [
3241
+ /* @__PURE__ */ jsx14(BodyHeader, { icon: /* @__PURE__ */ jsx14(WalletIcon, {}), title: "Wallet deposit" }),
3242
+ /* @__PURE__ */ jsxs12("div", { className: "rs-amount-section", children: [
3243
+ /* @__PURE__ */ jsxs12("div", { className: "rs-amount-display", children: [
3244
+ /* @__PURE__ */ jsx14(
2375
3245
  AnimatedAmountInput,
2376
3246
  {
2377
3247
  value: amount,
@@ -2380,25 +3250,25 @@ function SolanaAmountStep({
2380
3250
  autoFocus: true
2381
3251
  }
2382
3252
  ),
2383
- /* @__PURE__ */ jsxs8("div", { className: "rs-amount-meta", children: [
2384
- /* @__PURE__ */ jsxs8("span", { className: "rs-amount-meta-balance", children: [
3253
+ /* @__PURE__ */ jsxs12("div", { className: "rs-amount-meta", children: [
3254
+ /* @__PURE__ */ jsxs12("span", { className: "rs-amount-meta-balance", children: [
2385
3255
  formattedBalance,
2386
3256
  " ",
2387
3257
  token.symbol,
2388
3258
  " available",
2389
- computedBalanceUsd !== null && /* @__PURE__ */ jsxs8(Fragment2, { children: [
3259
+ computedBalanceUsd !== null && /* @__PURE__ */ jsxs12(Fragment2, { children: [
2390
3260
  " (~",
2391
3261
  currencyFormatter.format(computedBalanceUsd),
2392
3262
  ")"
2393
3263
  ] })
2394
3264
  ] }),
2395
- minDepositUsd !== null && /* @__PURE__ */ jsxs8("span", { className: "rs-amount-meta-minimum", children: [
3265
+ minDepositUsd !== null && /* @__PURE__ */ jsxs12("span", { className: "rs-amount-meta-minimum", children: [
2396
3266
  "Min. deposit ",
2397
3267
  currencyFormatter.format(minDepositUsd)
2398
3268
  ] })
2399
3269
  ] })
2400
3270
  ] }),
2401
- /* @__PURE__ */ jsx8("div", { className: "rs-amount-presets", children: PRESETS2.map((preset) => /* @__PURE__ */ jsx8(
3271
+ /* @__PURE__ */ jsx14("div", { className: "rs-amount-presets", children: PRESETS2.map((preset) => /* @__PURE__ */ jsx14(
2402
3272
  "button",
2403
3273
  {
2404
3274
  type: "button",
@@ -2409,35 +3279,36 @@ function SolanaAmountStep({
2409
3279
  preset.value
2410
3280
  )) })
2411
3281
  ] }),
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: [
3282
+ /* @__PURE__ */ jsxs12("div", { className: "rs-amount-details", children: [
3283
+ /* @__PURE__ */ jsxs12("div", { className: "rs-amount-detail-row", children: [
3284
+ /* @__PURE__ */ jsx14("span", { children: "You send" }),
3285
+ /* @__PURE__ */ jsxs12("span", { className: "rs-amount-detail-value", children: [
3286
+ /* @__PURE__ */ jsxs12("span", { children: [
2417
3287
  "Solana ",
2418
3288
  token.symbol
2419
3289
  ] }),
2420
- sourceTokenIcon && /* @__PURE__ */ jsx8("span", { className: "rs-amount-detail-icon", children: /* @__PURE__ */ jsx8("img", { src: sourceTokenIcon, alt: "" }) })
3290
+ sourceTokenIcon && /* @__PURE__ */ jsx14("span", { className: "rs-amount-detail-icon", children: /* @__PURE__ */ jsx14("img", { src: sourceTokenIcon, alt: "" }) })
2421
3291
  ] })
2422
3292
  ] }),
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: [
3293
+ targetChainName && targetTokenSymbol && /* @__PURE__ */ jsxs12("div", { className: "rs-amount-detail-row", children: [
3294
+ /* @__PURE__ */ jsx14("span", { children: "Receive" }),
3295
+ /* @__PURE__ */ jsxs12("span", { className: "rs-amount-detail-value", children: [
3296
+ /* @__PURE__ */ jsxs12("span", { children: [
2427
3297
  targetChainName,
2428
3298
  " ",
2429
3299
  targetTokenSymbol
2430
3300
  ] }),
2431
- targetTokenIcon && /* @__PURE__ */ jsx8("span", { className: "rs-amount-detail-icon", children: /* @__PURE__ */ jsx8("img", { src: targetTokenIcon, alt: "" }) })
3301
+ targetTokenIcon && /* @__PURE__ */ jsx14("span", { className: "rs-amount-detail-icon", children: /* @__PURE__ */ jsx14("img", { src: targetTokenIcon, alt: "" }) })
2432
3302
  ] })
2433
3303
  ] }),
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) })
3304
+ balanceAfterUsd !== null && /* @__PURE__ */ jsxs12("div", { className: "rs-amount-detail-row", children: [
3305
+ /* @__PURE__ */ jsx14("span", { children: "Balance after deposit" }),
3306
+ /* @__PURE__ */ jsx14("span", { className: "rs-amount-detail-value", children: currencyFormatter.format(balanceAfterUsd) })
2437
3307
  ] })
2438
3308
  ] }),
2439
- error && /* @__PURE__ */ jsx8(Callout, { variant: "error", children: error }),
2440
- /* @__PURE__ */ jsx8(
3309
+ targetChain === HYPERCORE_CHAIN_ID && /* @__PURE__ */ jsx14(Callout, { variant: "warning", children: "First deposit to a new HyperCore account includes a ~1 USDC activation fee." }),
3310
+ error && /* @__PURE__ */ jsx14(Callout, { variant: "error", children: error }),
3311
+ /* @__PURE__ */ jsx14(
2441
3312
  Button,
2442
3313
  {
2443
3314
  onClick: handleContinue,
@@ -2447,12 +3318,12 @@ function SolanaAmountStep({
2447
3318
  }
2448
3319
  )
2449
3320
  ] }),
2450
- /* @__PURE__ */ jsx8(PoweredBy, {})
3321
+ /* @__PURE__ */ jsx14(PoweredBy, {})
2451
3322
  ] });
2452
3323
  }
2453
3324
 
2454
3325
  // src/components/steps/SolanaConfirmStep.tsx
2455
- import { useState as useState8 } from "react";
3326
+ import { useState as useState10 } from "react";
2456
3327
  import { parseUnits as parseUnits4 } from "viem";
2457
3328
 
2458
3329
  // src/core/solana.ts
@@ -2560,7 +3431,7 @@ async function sendSolanaTransaction(provider, _connection, transaction) {
2560
3431
  }
2561
3432
 
2562
3433
  // src/components/steps/SolanaConfirmStep.tsx
2563
- import { jsx as jsx9, jsxs as jsxs9 } from "react/jsx-runtime";
3434
+ import { jsx as jsx15, jsxs as jsxs13 } from "react/jsx-runtime";
2564
3435
  function SolanaConfirmStep({
2565
3436
  smartAccount,
2566
3437
  solanaAddress,
@@ -2581,8 +3452,8 @@ function SolanaConfirmStep({
2581
3452
  onError,
2582
3453
  debug
2583
3454
  }) {
2584
- const [isSubmitting, setIsSubmitting] = useState8(false);
2585
- const [error, setError] = useState8(null);
3455
+ const [isSubmitting, setIsSubmitting] = useState10(false);
3456
+ const [error, setError] = useState10(null);
2586
3457
  const targetSymbol = getTargetTokenSymbol(targetToken, targetChain);
2587
3458
  const isSameToken = token.symbol.toUpperCase() === targetSymbol.toUpperCase();
2588
3459
  const sourceChainName = getChainName("solana");
@@ -2593,7 +3464,10 @@ function SolanaConfirmStep({
2593
3464
  const targetTokenIcon = getTokenIcon(targetSymbol);
2594
3465
  const feeSponsored = uiConfig?.feeSponsored ?? false;
2595
3466
  const feeTooltip = uiConfig?.feeTooltip ?? (feeSponsored ? "Network fees are sponsored for this deposit." : "Network fees apply.");
2596
- const formattedAmount = sourceAmount && !Number.isNaN(Number(sourceAmount)) ? Number(sourceAmount).toLocaleString("en-US", { maximumFractionDigits: 6 }) : "0";
3467
+ const formattedAmount = sourceAmount && !Number.isNaN(Number(sourceAmount)) ? Number(sourceAmount).toLocaleString("en-US", {
3468
+ minimumFractionDigits: 2,
3469
+ maximumFractionDigits: 6
3470
+ }) : "0";
2597
3471
  const formattedReceiveAmount = (() => {
2598
3472
  if (isSameToken) return formattedAmount;
2599
3473
  const dollarValue = Number(targetAmount);
@@ -2601,7 +3475,10 @@ function SolanaConfirmStep({
2601
3475
  return formattedAmount;
2602
3476
  if (targetTokenPriceUsd !== null && targetTokenPriceUsd > 0) {
2603
3477
  const tokenAmount = dollarValue / targetTokenPriceUsd;
2604
- return tokenAmount.toLocaleString("en-US", { maximumFractionDigits: 6 });
3478
+ return tokenAmount.toLocaleString("en-US", {
3479
+ minimumFractionDigits: 2,
3480
+ maximumFractionDigits: 6
3481
+ });
2605
3482
  }
2606
3483
  return formattedAmount;
2607
3484
  })();
@@ -2695,66 +3572,66 @@ function SolanaConfirmStep({
2695
3572
  setIsSubmitting(false);
2696
3573
  }
2697
3574
  };
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: "" }) })
3575
+ return /* @__PURE__ */ jsxs13("div", { className: "rs-screen", children: [
3576
+ /* @__PURE__ */ jsxs13("div", { className: "rs-screen-body rs-screen-body--gap-32", children: [
3577
+ /* @__PURE__ */ jsx15(BodyHeader, { icon: /* @__PURE__ */ jsx15(WalletIcon, {}), title: "Review deposit" }),
3578
+ /* @__PURE__ */ jsxs13("div", { className: "rs-review-details", children: [
3579
+ /* @__PURE__ */ jsxs13("div", { className: "rs-review-detail-row", children: [
3580
+ /* @__PURE__ */ jsx15("span", { children: "Source chain" }),
3581
+ /* @__PURE__ */ jsxs13("span", { className: "rs-review-detail-value", children: [
3582
+ /* @__PURE__ */ jsx15("span", { children: sourceChainName }),
3583
+ sourceChainIcon && /* @__PURE__ */ jsx15("span", { className: "rs-review-detail-icon", children: /* @__PURE__ */ jsx15("img", { src: sourceChainIcon, alt: "" }) })
2707
3584
  ] })
2708
3585
  ] }),
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: "" }) })
3586
+ /* @__PURE__ */ jsxs13("div", { className: "rs-review-detail-row", children: [
3587
+ /* @__PURE__ */ jsx15("span", { children: "Destination chain" }),
3588
+ /* @__PURE__ */ jsxs13("span", { className: "rs-review-detail-value", children: [
3589
+ /* @__PURE__ */ jsx15("span", { children: targetChainName }),
3590
+ targetChainIcon && /* @__PURE__ */ jsx15("span", { className: "rs-review-detail-icon", children: /* @__PURE__ */ jsx15("img", { src: targetChainIcon, alt: "" }) })
2714
3591
  ] })
2715
3592
  ] }),
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 })
3593
+ /* @__PURE__ */ jsxs13("div", { className: "rs-review-detail-row", children: [
3594
+ /* @__PURE__ */ jsx15("span", { children: "Estimated time" }),
3595
+ /* @__PURE__ */ jsx15("span", { className: "rs-review-detail-value", children: estimatedTime })
2719
3596
  ] }),
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: [
3597
+ /* @__PURE__ */ jsxs13("div", { className: "rs-review-detail-row", children: [
3598
+ /* @__PURE__ */ jsx15("span", { children: "You send" }),
3599
+ /* @__PURE__ */ jsxs13("span", { className: "rs-review-detail-value", children: [
3600
+ /* @__PURE__ */ jsxs13("span", { children: [
2724
3601
  formattedAmount,
2725
3602
  " ",
2726
3603
  token.symbol
2727
3604
  ] }),
2728
- sourceTokenIcon && /* @__PURE__ */ jsx9("span", { className: "rs-review-detail-icon", children: /* @__PURE__ */ jsx9("img", { src: sourceTokenIcon, alt: "" }) })
3605
+ sourceTokenIcon && /* @__PURE__ */ jsx15("span", { className: "rs-review-detail-icon", children: /* @__PURE__ */ jsx15("img", { src: sourceTokenIcon, alt: "" }) })
2729
3606
  ] })
2730
3607
  ] }),
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: [
3608
+ /* @__PURE__ */ jsxs13("div", { className: "rs-review-detail-row", children: [
3609
+ /* @__PURE__ */ jsx15("span", { children: "Receive" }),
3610
+ /* @__PURE__ */ jsxs13("span", { className: "rs-review-detail-value", children: [
3611
+ /* @__PURE__ */ jsxs13("span", { children: [
2735
3612
  receiveAmount,
2736
3613
  " ",
2737
3614
  targetSymbol
2738
3615
  ] }),
2739
- targetTokenIcon && /* @__PURE__ */ jsx9("span", { className: "rs-review-detail-icon", children: /* @__PURE__ */ jsx9("img", { src: targetTokenIcon, alt: "" }) })
3616
+ targetTokenIcon && /* @__PURE__ */ jsx15("span", { className: "rs-review-detail-icon", children: /* @__PURE__ */ jsx15("img", { src: targetTokenIcon, alt: "" }) })
2740
3617
  ] })
2741
3618
  ] }),
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(
3619
+ /* @__PURE__ */ jsxs13("div", { className: "rs-review-detail-row", children: [
3620
+ /* @__PURE__ */ jsx15("span", { children: "Fees" }),
3621
+ /* @__PURE__ */ jsxs13("span", { className: "rs-review-detail-value", children: [
3622
+ /* @__PURE__ */ jsx15(
2746
3623
  "span",
2747
3624
  {
2748
3625
  style: feeSponsored ? { textDecoration: "line-through" } : void 0,
2749
3626
  children: "$0.04"
2750
3627
  }
2751
3628
  ),
2752
- /* @__PURE__ */ jsx9(Tooltip, { content: feeTooltip, children: /* @__PURE__ */ jsx9("span", { className: "rs-review-detail-info", "aria-label": "Fee info", children: /* @__PURE__ */ jsx9(InfoIcon, {}) }) })
3629
+ /* @__PURE__ */ jsx15(Tooltip, { content: feeTooltip, children: /* @__PURE__ */ jsx15("span", { className: "rs-review-detail-info", "aria-label": "Fee info", children: /* @__PURE__ */ jsx15(InfoIcon, {}) }) })
2753
3630
  ] })
2754
3631
  ] })
2755
3632
  ] }),
2756
- error && /* @__PURE__ */ jsx9(Callout, { variant: "error", children: error }),
2757
- /* @__PURE__ */ jsx9(
3633
+ error && /* @__PURE__ */ jsx15(Callout, { variant: "error", children: error }),
3634
+ /* @__PURE__ */ jsx15(
2758
3635
  Button,
2759
3636
  {
2760
3637
  onClick: handleConfirm,
@@ -2766,28 +3643,28 @@ function SolanaConfirmStep({
2766
3643
  }
2767
3644
  )
2768
3645
  ] }),
2769
- /* @__PURE__ */ jsx9(PoweredBy, {})
3646
+ /* @__PURE__ */ jsx15(PoweredBy, {})
2770
3647
  ] });
2771
3648
  }
2772
3649
 
2773
3650
  // src/components/steps/DappImportAssetSelectStep.tsx
2774
- import { jsx as jsx10, jsxs as jsxs10 } from "react/jsx-runtime";
3651
+ import { jsx as jsx16, jsxs as jsxs14 } from "react/jsx-runtime";
2775
3652
  function DappImportAssetSelectStep({
2776
3653
  sourceLabel,
2777
3654
  assets,
2778
3655
  onSelect
2779
3656
  }) {
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(
3657
+ return /* @__PURE__ */ jsxs14("div", { className: "rs-screen", children: [
3658
+ /* @__PURE__ */ jsxs14("div", { className: "rs-screen-body rs-screen-body--gap-32", children: [
3659
+ /* @__PURE__ */ jsx16(
2783
3660
  BodyHeader,
2784
3661
  {
2785
- icon: /* @__PURE__ */ jsx10(WalletIcon, {}),
3662
+ icon: /* @__PURE__ */ jsx16(WalletIcon, {}),
2786
3663
  title: `Transfer from ${sourceLabel}`,
2787
3664
  subtitle: "Pick the balance to import"
2788
3665
  }
2789
3666
  ),
2790
- /* @__PURE__ */ jsx10("div", { className: "rs-asset-list", children: assets.map((asset) => {
3667
+ /* @__PURE__ */ jsx16("div", { className: "rs-asset-list", children: assets.map((asset) => {
2791
3668
  const tokenAmount = asset.balance ? tokenFormatter.format(
2792
3669
  Number(asset.balance) / 10 ** asset.decimals
2793
3670
  ) : "0";
@@ -2795,23 +3672,23 @@ function DappImportAssetSelectStep({
2795
3672
  const tokenIcon = asset.icon ?? getTokenIcon(asset.symbol);
2796
3673
  const chainIcon = getChainIcon(asset.chainId);
2797
3674
  const badge = getChainBadge(asset.chainId);
2798
- return /* @__PURE__ */ jsxs10(
3675
+ return /* @__PURE__ */ jsxs14(
2799
3676
  "button",
2800
3677
  {
2801
3678
  type: "button",
2802
3679
  className: "rs-asset-row",
2803
3680
  onClick: () => onSelect(asset),
2804
3681
  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(
3682
+ /* @__PURE__ */ jsxs14("div", { className: "rs-asset-info", children: [
3683
+ /* @__PURE__ */ jsxs14("div", { className: "rs-asset-icon-wrapper", children: [
3684
+ /* @__PURE__ */ jsx16("span", { className: "rs-asset-icon", children: tokenIcon ? /* @__PURE__ */ jsx16("img", { src: tokenIcon, alt: asset.symbol }) : asset.symbol.slice(0, 4) }),
3685
+ chainIcon ? /* @__PURE__ */ jsx16("span", { className: "rs-asset-chain-badge", children: /* @__PURE__ */ jsx16(
2809
3686
  "img",
2810
3687
  {
2811
3688
  src: chainIcon,
2812
3689
  alt: getChainName(asset.chainId)
2813
3690
  }
2814
- ) }) : /* @__PURE__ */ jsx10(
3691
+ ) }) : /* @__PURE__ */ jsx16(
2815
3692
  "span",
2816
3693
  {
2817
3694
  className: "rs-asset-chain-badge",
@@ -2820,46 +3697,94 @@ function DappImportAssetSelectStep({
2820
3697
  }
2821
3698
  )
2822
3699
  ] }),
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: [
3700
+ /* @__PURE__ */ jsxs14("div", { className: "rs-asset-text", children: [
3701
+ /* @__PURE__ */ jsxs14("div", { className: "rs-asset-name-row", children: [
3702
+ /* @__PURE__ */ jsx16("span", { className: "rs-asset-name", children: asset.symbol }),
3703
+ /* @__PURE__ */ jsxs14("span", { className: "rs-asset-chain", children: [
2827
3704
  "on ",
2828
3705
  asset.sourceLabel
2829
3706
  ] })
2830
3707
  ] }),
2831
- /* @__PURE__ */ jsxs10("div", { className: "rs-asset-balance-small", children: [
3708
+ /* @__PURE__ */ jsxs14("div", { className: "rs-asset-balance-small", children: [
2832
3709
  tokenAmount,
2833
3710
  " ",
2834
3711
  asset.symbol
2835
3712
  ] })
2836
3713
  ] })
2837
3714
  ] }),
2838
- /* @__PURE__ */ jsx10("div", { className: "rs-asset-balance", children: balanceUsd })
3715
+ /* @__PURE__ */ jsx16("div", { className: "rs-asset-balance", children: balanceUsd })
2839
3716
  ]
2840
3717
  },
2841
3718
  asset.id
2842
3719
  );
2843
3720
  }) })
2844
3721
  ] }),
2845
- /* @__PURE__ */ jsx10(PoweredBy, {})
3722
+ /* @__PURE__ */ jsx16(PoweredBy, {})
2846
3723
  ] });
2847
3724
  }
2848
3725
  DappImportAssetSelectStep.displayName = "DappImportAssetSelectStep";
2849
3726
 
3727
+ // src/components/steps/DappImportAssetSelectSkeleton.tsx
3728
+ import { jsx as jsx17, jsxs as jsxs15 } from "react/jsx-runtime";
3729
+ function DappImportAssetSelectSkeleton({
3730
+ sourceLabel,
3731
+ rowCount = 3,
3732
+ error = false,
3733
+ onRetry
3734
+ }) {
3735
+ return /* @__PURE__ */ jsxs15("div", { className: "rs-screen", "aria-busy": error ? "false" : "true", children: [
3736
+ /* @__PURE__ */ jsx17("span", { className: "rs-sr-only", role: "status", children: error ? "Couldn't load balances" : "Loading balances\u2026" }),
3737
+ /* @__PURE__ */ jsxs15("div", { className: "rs-screen-body rs-screen-body--gap-32", children: [
3738
+ /* @__PURE__ */ jsx17(
3739
+ BodyHeader,
3740
+ {
3741
+ icon: /* @__PURE__ */ jsx17(WalletIcon, {}),
3742
+ title: `Transfer from ${sourceLabel}`,
3743
+ subtitle: "Pick the balance to import"
3744
+ }
3745
+ ),
3746
+ error ? /* @__PURE__ */ jsx17("div", { className: "rs-loading-state", children: /* @__PURE__ */ jsxs15("div", { className: "rs-loading-text", children: [
3747
+ /* @__PURE__ */ jsx17("div", { className: "rs-loading-title rs-text-error", children: "Couldn\u2019t load your balances" }),
3748
+ /* @__PURE__ */ jsx17("div", { className: "rs-loading-subtitle", children: "Check your connection and try again." })
3749
+ ] }) }) : /* @__PURE__ */ jsx17("div", { className: "rs-asset-list", "aria-hidden": "true", children: Array.from({ length: rowCount }, (_, index) => /* @__PURE__ */ jsxs15(
3750
+ "div",
3751
+ {
3752
+ className: "rs-asset-row rs-asset-row--skeleton",
3753
+ children: [
3754
+ /* @__PURE__ */ jsxs15("div", { className: "rs-asset-info", children: [
3755
+ /* @__PURE__ */ jsxs15("div", { className: "rs-asset-icon-wrapper", children: [
3756
+ /* @__PURE__ */ jsx17("span", { className: "rs-asset-icon", children: /* @__PURE__ */ jsx17("span", { className: "rs-skeleton rs-skeleton-fill" }) }),
3757
+ /* @__PURE__ */ jsx17("span", { className: "rs-asset-chain-badge", children: /* @__PURE__ */ jsx17("span", { className: "rs-skeleton rs-skeleton-fill" }) })
3758
+ ] }),
3759
+ /* @__PURE__ */ jsxs15("div", { className: "rs-asset-text", children: [
3760
+ /* @__PURE__ */ jsx17("div", { className: "rs-asset-name-row", children: /* @__PURE__ */ jsx17("span", { className: "rs-skeleton rs-skeleton-text rs-skeleton-text--name" }) }),
3761
+ /* @__PURE__ */ jsx17("div", { className: "rs-asset-balance-small", children: /* @__PURE__ */ jsx17("span", { className: "rs-skeleton rs-skeleton-text rs-skeleton-text--balance" }) })
3762
+ ] })
3763
+ ] }),
3764
+ /* @__PURE__ */ jsx17("div", { className: "rs-asset-balance", children: /* @__PURE__ */ jsx17("span", { className: "rs-skeleton rs-skeleton-text rs-skeleton-text--usd" }) })
3765
+ ]
3766
+ },
3767
+ index
3768
+ )) })
3769
+ ] }),
3770
+ error && onRetry && /* @__PURE__ */ jsx17("div", { className: "rs-step-footer", children: /* @__PURE__ */ jsx17(
3771
+ "button",
3772
+ {
3773
+ type: "button",
3774
+ className: "rs-button rs-button--default rs-button--full-width",
3775
+ onClick: onRetry,
3776
+ children: /* @__PURE__ */ jsx17("span", { children: "Try again" })
3777
+ }
3778
+ ) }),
3779
+ /* @__PURE__ */ jsx17(PoweredBy, {})
3780
+ ] });
3781
+ }
3782
+ DappImportAssetSelectSkeleton.displayName = "DappImportAssetSelectSkeleton";
3783
+
2850
3784
  // src/core/dapp-imports/polymarket/index.ts
2851
3785
  import { createElement } from "react";
2852
3786
  import { formatUnits as formatUnits6 } from "viem";
2853
3787
 
2854
- // src/core/dapp-imports/polymarket/constants.ts
2855
- var POLYMARKET_POLYGON_CHAIN_ID = 137;
2856
- var POLYMARKET_PUSD_ADDRESS = "0xC011a7E12a19f7B1f670d46F03B03f3342E82DFB";
2857
- var POLYMARKET_USDCE_ADDRESS = "0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174";
2858
- var POLYMARKET_COLLATERAL_OFFRAMP_ADDRESS = "0x2957922Eb93258b93368531d39fAcCA3B4dC5854";
2859
- var SAFE_MULTI_SEND_CALL_ONLY_ADDRESS = "0x40A2aCCbd92BCA938b02010E17A5b8929b49130D";
2860
- var GAMMA_API_PUBLIC_PROFILE = "https://gamma-api.polymarket.com/public-profile";
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";
2862
-
2863
3788
  // src/core/dapp-imports/polymarket/deposit-wallet.ts
2864
3789
  import {
2865
3790
  encodeFunctionData,
@@ -3026,204 +3951,12 @@ function buildPusdUnwrapCalls(recipient, amount) {
3026
3951
  ];
3027
3952
  }
3028
3953
 
3029
- // src/core/dapp-imports/polymarket/gamma-api.ts
3030
- import { getAddress, isAddress, zeroAddress } from "viem";
3031
- async function fetchPolymarketProxyWallet(eoa, signal) {
3032
- const url = `${GAMMA_API_PUBLIC_PROFILE}?address=${eoa}`;
3033
- let response;
3034
- try {
3035
- response = await fetch(url, { signal });
3036
- } catch {
3037
- return null;
3038
- }
3039
- if (!response.ok) {
3040
- return null;
3041
- }
3042
- let payload;
3043
- try {
3044
- payload = await response.json();
3045
- } catch {
3046
- return null;
3047
- }
3048
- const raw = payload.proxyWallet;
3049
- if (!raw || !isAddress(raw)) {
3050
- return null;
3051
- }
3052
- const checksummed = getAddress(raw);
3053
- if (checksummed === zeroAddress) {
3054
- return null;
3055
- }
3056
- return checksummed;
3057
- }
3058
-
3059
- // src/core/dapp-imports/polymarket/safe.ts
3060
- import {
3061
- concat,
3062
- encodeFunctionData as encodeFunctionData2,
3063
- encodePacked,
3064
- erc20Abi as erc20Abi4,
3065
- pad,
3066
- parseAbi as parseAbi2,
3067
- parseEventLogs,
3068
- toHex,
3069
- zeroAddress as zeroAddress2
3070
- } from "viem";
3071
- var COLLATERAL_OFFRAMP_ABI2 = parseAbi2([
3072
- "function unwrap(address _asset, address _to, uint256 _amount)"
3073
- ]);
3074
- var MULTI_SEND_ABI = parseAbi2(["function multiSend(bytes transactions)"]);
3075
- async function readPolymarketBalances(params) {
3076
- const { publicClient, proxyWallet } = params;
3077
- try {
3078
- const results = await publicClient.multicall({
3079
- allowFailure: true,
3080
- contracts: [
3081
- {
3082
- address: POLYMARKET_PUSD_ADDRESS,
3083
- abi: erc20Abi4,
3084
- functionName: "balanceOf",
3085
- args: [proxyWallet]
3086
- },
3087
- {
3088
- address: POLYMARKET_USDCE_ADDRESS,
3089
- abi: erc20Abi4,
3090
- functionName: "balanceOf",
3091
- args: [proxyWallet]
3092
- }
3093
- ]
3094
- });
3095
- return {
3096
- pusd: results[0].status === "success" ? results[0].result : 0n,
3097
- usdce: results[1].status === "success" ? results[1].result : 0n
3098
- };
3099
- } catch {
3100
- return { pusd: 0n, usdce: 0n };
3101
- }
3102
- }
3103
- async function executePolymarketSafeTransfer(params) {
3104
- const {
3105
- walletClient,
3106
- publicClient,
3107
- safeAddress,
3108
- recipient,
3109
- amount,
3110
- tokenKind
3111
- } = params;
3112
- const account = walletClient.account;
3113
- const chain = walletClient.chain;
3114
- if (!account || !chain) {
3115
- throw new Error("Wallet not connected");
3116
- }
3117
- if (chain.id !== POLYMARKET_POLYGON_CHAIN_ID) {
3118
- throw new Error("Switch to Polygon to sign");
3119
- }
3120
- const isOwner = await publicClient.readContract({
3121
- address: safeAddress,
3122
- abi: SAFE_ABI,
3123
- functionName: "isOwner",
3124
- args: [account.address]
3125
- });
3126
- if (!isOwner) {
3127
- throw new Error("Connected wallet is not a Polymarket Safe owner");
3128
- }
3129
- const safeTx = tokenKind === "pusd" ? buildPusdUnwrapSafeTx(recipient, amount) : buildUsdceTransferSafeTx(recipient, amount);
3130
- const signature = concat([
3131
- pad(account.address, { size: 32 }),
3132
- pad(toHex(0), { size: 32 }),
3133
- toHex(1, { size: 1 })
3134
- ]);
3135
- const txHash = await walletClient.writeContract({
3136
- account,
3137
- chain,
3138
- address: safeAddress,
3139
- abi: SAFE_ABI,
3140
- functionName: "execTransaction",
3141
- args: [
3142
- safeTx.to,
3143
- 0n,
3144
- safeTx.data,
3145
- safeTx.operation,
3146
- 0n,
3147
- 0n,
3148
- 0n,
3149
- zeroAddress2,
3150
- zeroAddress2,
3151
- signature
3152
- ]
3153
- });
3154
- const receipt = await publicClient.waitForTransactionReceipt({
3155
- hash: txHash
3156
- });
3157
- const parsed = parseEventLogs({
3158
- abi: SAFE_ABI,
3159
- logs: receipt.logs.filter(
3160
- (log) => log.address.toLowerCase() === safeAddress.toLowerCase()
3161
- ),
3162
- strict: false
3163
- });
3164
- if (parsed.some((log) => log.eventName === "ExecutionFailure")) {
3165
- throw new Error("Polymarket Safe transaction failed");
3166
- }
3167
- if (!parsed.some((log) => log.eventName === "ExecutionSuccess")) {
3168
- throw new Error("Polymarket Safe transaction status unavailable");
3169
- }
3170
- return {
3171
- txHash,
3172
- // The smart account always receives USDC.e — pUSD is unwrapped to USDC.e
3173
- // before it lands at `recipient`.
3174
- sourceToken: POLYMARKET_USDCE_ADDRESS,
3175
- sourceSymbol: tokenKind === "pusd" ? "pUSD" : "USDC.e"
3176
- };
3177
- }
3178
- function buildUsdceTransferSafeTx(recipient, amount) {
3179
- return {
3180
- to: POLYMARKET_USDCE_ADDRESS,
3181
- data: encodeFunctionData2({
3182
- abi: erc20Abi4,
3183
- functionName: "transfer",
3184
- args: [recipient, amount]
3185
- }),
3186
- operation: 0
3187
- };
3188
- }
3189
- function buildPusdUnwrapSafeTx(recipient, amount) {
3190
- const approveData = encodeFunctionData2({
3191
- abi: erc20Abi4,
3192
- functionName: "approve",
3193
- args: [POLYMARKET_COLLATERAL_OFFRAMP_ADDRESS, amount]
3194
- });
3195
- const unwrapData = encodeFunctionData2({
3196
- abi: COLLATERAL_OFFRAMP_ABI2,
3197
- functionName: "unwrap",
3198
- args: [POLYMARKET_USDCE_ADDRESS, recipient, amount]
3199
- });
3200
- return {
3201
- to: SAFE_MULTI_SEND_CALL_ONLY_ADDRESS,
3202
- data: encodeFunctionData2({
3203
- abi: MULTI_SEND_ABI,
3204
- functionName: "multiSend",
3205
- args: [
3206
- concat([
3207
- encodeMultiSendCall(POLYMARKET_PUSD_ADDRESS, approveData),
3208
- encodeMultiSendCall(POLYMARKET_COLLATERAL_OFFRAMP_ADDRESS, unwrapData)
3209
- ])
3210
- ]
3211
- }),
3212
- operation: 1
3213
- };
3214
- }
3215
- function encodeMultiSendCall(to, data) {
3216
- return encodePacked(
3217
- ["uint8", "address", "uint256", "uint256", "bytes"],
3218
- [0, to, 0n, BigInt((data.length - 2) / 2), data]
3219
- );
3220
- }
3221
-
3222
3954
  // src/core/dapp-imports/polymarket/index.ts
3223
3955
  var PROVIDER_ID = "polymarket";
3224
3956
  var polymarketProvider = {
3225
3957
  id: PROVIDER_ID,
3226
3958
  label: "Transfer from Polymarket",
3959
+ sourceLabel: "Polymarket",
3227
3960
  icon: createElement("img", {
3228
3961
  src: POLYMARKET_ICON_URL,
3229
3962
  alt: "Polymarket",
@@ -3348,6 +4081,77 @@ function getEnabledProviders(config) {
3348
4081
  );
3349
4082
  }
3350
4083
 
4084
+ // src/store/selectors.ts
4085
+ var selectedWalletIdSelector = (state) => state.wallet.selectedWalletId;
4086
+ var IDLE_SETUP_ENTRY = {
4087
+ owner: null,
4088
+ requestKey: null,
4089
+ cacheKey: null,
4090
+ status: "idle",
4091
+ smartAccount: null,
4092
+ sessionOwnerAddress: null,
4093
+ solanaDepositAddress: null,
4094
+ message: null,
4095
+ cacheable: true,
4096
+ attemptNonce: 0
4097
+ };
4098
+ function readSetupForOwner(setup, owner) {
4099
+ if (!owner) return IDLE_SETUP_ENTRY;
4100
+ const entry = setup.byOwner[owner.toLowerCase()];
4101
+ return entry ?? { ...IDLE_SETUP_ENTRY, owner };
4102
+ }
4103
+
4104
+ // src/core/dapp-imports/status.ts
4105
+ function computeDappImportStatus(providerId, inputs) {
4106
+ const { owner, availability, availabilityOwner, setup } = inputs;
4107
+ if (!owner) return "needs-connect";
4108
+ const entry = availabilityOwner?.toLowerCase() === owner.toLowerCase() ? availability[providerId] : void 0;
4109
+ if (entry === "loading" || entry === void 0) return "loading";
4110
+ if (entry === "error") {
4111
+ return {
4112
+ enabled: false,
4113
+ reason: "Couldn't load balance \u2014 tap to retry",
4114
+ retryable: true
4115
+ };
4116
+ }
4117
+ if (entry === null) return { enabled: false, reason: "No balance" };
4118
+ const setupEntry = readSetupForOwner(setup, owner);
4119
+ if (setupEntry.status === "loading") return "loading";
4120
+ if (setupEntry.status === "error") {
4121
+ return {
4122
+ enabled: false,
4123
+ reason: "Couldn't prepare account \u2014 tap to retry",
4124
+ retryable: true
4125
+ };
4126
+ }
4127
+ return { enabled: true, balanceUsd: entry.totalUsd };
4128
+ }
4129
+ function resolveBootOutcome(params) {
4130
+ const { status, setupStatus, timedOut, walletHydrating, signerAvailable } = params;
4131
+ if (status === "needs-connect") {
4132
+ return walletHydrating && !timedOut ? "wait" : "unavailable";
4133
+ }
4134
+ if (status === "loading") return timedOut ? "error" : "wait";
4135
+ if (!status.enabled) {
4136
+ return status.retryable ? "error" : "unavailable";
4137
+ }
4138
+ if (setupStatus === "ready") {
4139
+ if (!signerAvailable) return timedOut ? "error" : "wait";
4140
+ return "ready";
4141
+ }
4142
+ if (setupStatus === "error") return "error";
4143
+ return timedOut ? "error" : "wait";
4144
+ }
4145
+ function bootRetryPlan(params) {
4146
+ const { setupStatus, availabilityEntry } = params;
4147
+ return {
4148
+ restartSetup: setupStatus !== "ready",
4149
+ // `null` is a delivered "no account" — only refetch when nothing
4150
+ // usable came back ("error", still "loading", or never recorded).
4151
+ refetchAvailability: availabilityEntry === "error" || availabilityEntry === "loading" || availabilityEntry === void 0
4152
+ };
4153
+ }
4154
+
3351
4155
  // src/core/dapp-imports/types.ts
3352
4156
  function isDappImportAsset(asset) {
3353
4157
  return typeof asset.source === "string" && typeof asset.sourceLabel === "string" && "providerMetadata" in asset;
@@ -3411,6 +4215,7 @@ function applyBack(state, hasWalletOptions) {
3411
4215
  targetAmount: null,
3412
4216
  targetTokenPriceUsd: null,
3413
4217
  balance: null,
4218
+ inputAmountUsd: null,
3414
4219
  liquidityWarning: null
3415
4220
  },
3416
4221
  flow: {
@@ -3456,9 +4261,21 @@ function applyBack(state, hasWalletOptions) {
3456
4261
  },
3457
4262
  flow: { ...state.flow, step: "solana-amount", hasNavigatedBack: true }
3458
4263
  };
4264
+ case "exchange-connect":
4265
+ return {
4266
+ ...state,
4267
+ flow: {
4268
+ ...state.flow,
4269
+ step: "exchange-select",
4270
+ hasNavigatedBack: true
4271
+ }
4272
+ };
3459
4273
  case "select-asset":
3460
4274
  case "deposit-address":
4275
+ case "fiat-onramp":
4276
+ case "exchange-select":
3461
4277
  case "solana-token-select":
4278
+ case "dapp-import-resolving":
3462
4279
  case "dapp-import-asset-select":
3463
4280
  return {
3464
4281
  ...state,
@@ -3473,8 +4290,10 @@ function applyBack(state, hasWalletOptions) {
3473
4290
  dappImport: {
3474
4291
  ...state.dappImport,
3475
4292
  activeProviderId: null,
3476
- selectedAsset: null
3477
- }
4293
+ selectedAsset: null,
4294
+ bootError: false
4295
+ },
4296
+ exchange: { selectedConnection: null }
3478
4297
  };
3479
4298
  case "connect":
3480
4299
  case "setup":
@@ -3487,7 +4306,8 @@ function applyBack(state, hasWalletOptions) {
3487
4306
  mode: null,
3488
4307
  isConnectSelectionConfirmed: false,
3489
4308
  hasNavigatedBack: hasWalletOptions || state.flow.hasNavigatedBack
3490
- }
4309
+ },
4310
+ exchange: { selectedConnection: null }
3491
4311
  };
3492
4312
  }
3493
4313
  return state;
@@ -3507,6 +4327,10 @@ function modeEntryStep(mode) {
3507
4327
  return "solana-token-select";
3508
4328
  case "dapp-import":
3509
4329
  return "dapp-import-asset-select";
4330
+ case "fiat-onramp":
4331
+ return "fiat-onramp";
4332
+ case "exchange-connect":
4333
+ return "exchange-select";
3510
4334
  }
3511
4335
  }
3512
4336
  function updateSetupEntry(state, owner, update) {
@@ -3552,7 +4376,8 @@ function applyAction(state, action) {
3552
4376
  ...state.dappImport,
3553
4377
  activeProviderId: null,
3554
4378
  selectedAsset: null
3555
- }
4379
+ },
4380
+ exchange: { selectedConnection: null }
3556
4381
  };
3557
4382
  case "connect/wallet-confirmed":
3558
4383
  if (!action.mode) return state;
@@ -3576,15 +4401,38 @@ function applyAction(state, action) {
3576
4401
  step: "deposit-address"
3577
4402
  }
3578
4403
  };
3579
- case "connect/auto-locked":
4404
+ case "connect/fiat-onramp-selected":
3580
4405
  return {
3581
4406
  ...state,
3582
4407
  flow: {
3583
4408
  ...state.flow,
3584
- mode: "wallet",
4409
+ mode: "fiat-onramp",
3585
4410
  isConnectSelectionConfirmed: true,
3586
- step: "select-asset"
3587
- }
4411
+ step: modeEntryStep("fiat-onramp")
4412
+ },
4413
+ fiat: { ...state.fiat, selectedMethod: action.paymentMethod ?? null }
4414
+ };
4415
+ case "connect/exchange-selected":
4416
+ return {
4417
+ ...state,
4418
+ flow: {
4419
+ ...state.flow,
4420
+ mode: "exchange-connect",
4421
+ isConnectSelectionConfirmed: true,
4422
+ step: modeEntryStep("exchange-connect")
4423
+ },
4424
+ exchange: { selectedConnection: null }
4425
+ };
4426
+ case "exchange/connection-selected":
4427
+ return {
4428
+ ...state,
4429
+ flow: {
4430
+ ...state.flow,
4431
+ mode: "exchange-connect",
4432
+ isConnectSelectionConfirmed: true,
4433
+ step: "exchange-connect"
4434
+ },
4435
+ exchange: { selectedConnection: action.connection }
3588
4436
  };
3589
4437
  case "connect/wallet-picker-requested":
3590
4438
  return {
@@ -3601,7 +4449,8 @@ function applyAction(state, action) {
3601
4449
  ...state.dappImport,
3602
4450
  activeProviderId: null,
3603
4451
  selectedAsset: null
3604
- }
4452
+ },
4453
+ exchange: { selectedConnection: null }
3605
4454
  };
3606
4455
  case "setup/started": {
3607
4456
  const existing = state.setup.byOwner[ownerKey(action.owner)];
@@ -3666,7 +4515,11 @@ function applyAction(state, action) {
3666
4515
  selectedAsset: action.asset,
3667
4516
  // Seed the user-facing amount input with the modal's defaultAmount
3668
4517
  // on first visit. Subsequent visits override via amount/entered.
3669
- amount: action.seedAmount ?? state.deposit.amount
4518
+ // `inputAmountUsd` is the USD-style value the input shows; it (not
4519
+ // the native `amount`) is what re-seeds the input on back, so seed
4520
+ // it here too and reset it on a fresh pick.
4521
+ amount: action.seedAmount ?? state.deposit.amount,
4522
+ inputAmountUsd: action.seedAmount ?? null
3670
4523
  },
3671
4524
  flow: { ...state.flow, step: "amount" }
3672
4525
  };
@@ -3679,6 +4532,11 @@ function applyAction(state, action) {
3679
4532
  targetAmount: action.targetAmount,
3680
4533
  targetTokenPriceUsd: action.targetTokenPriceUsd,
3681
4534
  balance: action.balance ?? null,
4535
+ // `targetAmount` is the USD-style value the user typed. Preserve it
4536
+ // as `inputAmountUsd` so back-from-confirm re-seeds the input with
4537
+ // the typed USD value rather than the converted native `amount`
4538
+ // (which corrupts the input for non-stablecoin priced tokens).
4539
+ inputAmountUsd: action.targetAmount,
3682
4540
  liquidityWarning: action.liquidityWarning ?? null
3683
4541
  },
3684
4542
  flow: { ...state.flow, step: "confirm" }
@@ -3719,7 +4577,11 @@ function applyAction(state, action) {
3719
4577
  sourceChain: action.sourceChain,
3720
4578
  sourceToken: action.sourceToken ?? null,
3721
4579
  sourceSymbol: action.sourceSymbol ?? null,
3722
- sourceDecimals: action.sourceDecimals ?? null
4580
+ sourceDecimals: action.sourceDecimals ?? null,
4581
+ // The submit site's declared USD value, not the lingering typed
4582
+ // input — a submit that doesn't know it (fiat onramp) must not
4583
+ // inherit one from an abandoned wallet attempt.
4584
+ inputAmountUsd: action.inputAmountUsd ?? null
3723
4585
  },
3724
4586
  processing: {
3725
4587
  ...state.processing,
@@ -3733,14 +4595,28 @@ function applyAction(state, action) {
3733
4595
  ...state,
3734
4596
  dappImport: {
3735
4597
  ...state.dappImport,
3736
- availabilityOwner: action.owner,
4598
+ availabilityOwner: action.owner,
4599
+ availability: {
4600
+ ...state.dappImport.availabilityOwner && ownerKey(state.dappImport.availabilityOwner) === ownerKey(action.owner) ? state.dappImport.availability : {},
4601
+ [action.providerId]: "loading"
4602
+ }
4603
+ }
4604
+ };
4605
+ case "dapp-import/availability-loaded":
4606
+ if (!state.dappImport.availabilityOwner || ownerKey(state.dappImport.availabilityOwner) !== ownerKey(action.owner)) {
4607
+ return state;
4608
+ }
4609
+ return {
4610
+ ...state,
4611
+ dappImport: {
4612
+ ...state.dappImport,
3737
4613
  availability: {
3738
- ...state.dappImport.availabilityOwner && ownerKey(state.dappImport.availabilityOwner) === ownerKey(action.owner) ? state.dappImport.availability : {},
3739
- [action.providerId]: "loading"
4614
+ ...state.dappImport.availability,
4615
+ [action.providerId]: action.availability
3740
4616
  }
3741
4617
  }
3742
4618
  };
3743
- case "dapp-import/availability-loaded":
4619
+ case "dapp-import/availability-failed":
3744
4620
  if (!state.dappImport.availabilityOwner || ownerKey(state.dappImport.availabilityOwner) !== ownerKey(action.owner)) {
3745
4621
  return state;
3746
4622
  }
@@ -3750,21 +4626,31 @@ function applyAction(state, action) {
3750
4626
  ...state.dappImport,
3751
4627
  availability: {
3752
4628
  ...state.dappImport.availability,
3753
- [action.providerId]: action.availability
4629
+ [action.providerId]: "error"
3754
4630
  }
3755
4631
  }
3756
4632
  };
3757
- case "dapp-import/availability-cleared":
4633
+ case "dapp-import/availability-retry-requested":
4634
+ return {
4635
+ ...state,
4636
+ dappImport: {
4637
+ ...state.dappImport,
4638
+ attemptNonce: state.dappImport.attemptNonce + 1
4639
+ }
4640
+ };
4641
+ case "dapp-import/availability-cleared": {
4642
+ const isBootResolving = state.flow.step === "dapp-import-resolving";
3758
4643
  return {
3759
4644
  ...state,
3760
4645
  dappImport: {
3761
4646
  ...state.dappImport,
3762
4647
  availabilityOwner: null,
3763
4648
  availability: {},
3764
- activeProviderId: null,
3765
- selectedAsset: null
4649
+ activeProviderId: isBootResolving ? state.dappImport.activeProviderId : null,
4650
+ selectedAsset: isBootResolving ? state.dappImport.selectedAsset : null
3766
4651
  }
3767
4652
  };
4653
+ }
3768
4654
  case "dapp-import/provider-selected":
3769
4655
  return {
3770
4656
  ...state,
@@ -3793,6 +4679,57 @@ function applyAction(state, action) {
3793
4679
  },
3794
4680
  flow: { ...state.flow, step: "amount" }
3795
4681
  };
4682
+ case "dapp-import/boot-requested":
4683
+ return {
4684
+ ...state,
4685
+ flow: {
4686
+ ...state.flow,
4687
+ mode: "dapp-import",
4688
+ isConnectSelectionConfirmed: true,
4689
+ step: "dapp-import-resolving"
4690
+ },
4691
+ dappImport: {
4692
+ ...state.dappImport,
4693
+ activeProviderId: action.providerId,
4694
+ selectedAsset: null,
4695
+ bootError: false
4696
+ }
4697
+ };
4698
+ case "dapp-import/boot-resolved": {
4699
+ if (state.flow.step !== "dapp-import-resolving" || state.dappImport.activeProviderId !== action.providerId) {
4700
+ return state;
4701
+ }
4702
+ switch (action.outcome) {
4703
+ case "ready":
4704
+ return {
4705
+ ...state,
4706
+ flow: { ...state.flow, step: "dapp-import-asset-select" },
4707
+ dappImport: { ...state.dappImport, bootError: false }
4708
+ };
4709
+ case "unavailable":
4710
+ return {
4711
+ ...state,
4712
+ flow: {
4713
+ ...state.flow,
4714
+ step: "connect",
4715
+ mode: null,
4716
+ isConnectSelectionConfirmed: false,
4717
+ hasNavigatedBack: true
4718
+ },
4719
+ dappImport: {
4720
+ ...state.dappImport,
4721
+ activeProviderId: null,
4722
+ selectedAsset: null,
4723
+ bootError: false
4724
+ }
4725
+ };
4726
+ case "error":
4727
+ return {
4728
+ ...state,
4729
+ dappImport: { ...state.dappImport, bootError: true }
4730
+ };
4731
+ }
4732
+ }
3796
4733
  case "back/requested":
3797
4734
  return applyBack(state, action.hasWalletOptions);
3798
4735
  case "flow/reset": {
@@ -3820,14 +4757,22 @@ function applyAction(state, action) {
3820
4757
  txHash: null,
3821
4758
  directTransfer: false
3822
4759
  },
3823
- // Preserve fetched availability for its recorded EOA — refetching on
3824
- // every modal close burns a request. Just clear active selection.
4760
+ // Drop fetched availability wholesale. The fetch effect refetches
4761
+ // unconditionally on remount (so keeping the map saves nothing),
4762
+ // and a preserved terminal entry (null / "error") could be consumed
4763
+ // by a fresh pre-routed boot before the refetch's loading update
4764
+ // lands — routing a now-funded account home off stale data.
3825
4765
  dappImport: {
3826
- ...state.dappImport,
3827
4766
  activeProviderId: null,
3828
- selectedAsset: null
4767
+ availabilityOwner: null,
4768
+ availability: {},
4769
+ selectedAsset: null,
4770
+ bootError: false,
4771
+ attemptNonce: 0
3829
4772
  },
3830
- setup: { byOwner: preservedByOwner }
4773
+ setup: { byOwner: preservedByOwner },
4774
+ fiat: { selectedMethod: null },
4775
+ exchange: { selectedConnection: null }
3831
4776
  };
3832
4777
  }
3833
4778
  case "target/changed": {
@@ -3897,34 +4842,22 @@ function createInitialState(overrides) {
3897
4842
  activeProviderId: null,
3898
4843
  availabilityOwner: null,
3899
4844
  availability: {},
3900
- selectedAsset: null
4845
+ selectedAsset: null,
4846
+ bootError: false,
4847
+ attemptNonce: 0
3901
4848
  },
3902
4849
  setup: {
3903
4850
  byOwner: {}
4851
+ },
4852
+ fiat: {
4853
+ selectedMethod: null
4854
+ },
4855
+ exchange: {
4856
+ selectedConnection: null
3904
4857
  }
3905
4858
  };
3906
4859
  }
3907
4860
 
3908
- // src/store/selectors.ts
3909
- var selectedWalletIdSelector = (state) => state.wallet.selectedWalletId;
3910
- var IDLE_SETUP_ENTRY = {
3911
- owner: null,
3912
- requestKey: null,
3913
- cacheKey: null,
3914
- status: "idle",
3915
- smartAccount: null,
3916
- sessionOwnerAddress: null,
3917
- solanaDepositAddress: null,
3918
- message: null,
3919
- cacheable: true,
3920
- attemptNonce: 0
3921
- };
3922
- function readSetupForOwner(setup, owner) {
3923
- if (!owner) return IDLE_SETUP_ENTRY;
3924
- const entry = setup.byOwner[owner.toLowerCase()];
3925
- return entry ?? { ...IDLE_SETUP_ENTRY, owner };
3926
- }
3927
-
3928
4861
  // src/store/index.ts
3929
4862
  function createDepositStore(overrides) {
3930
4863
  const store = createStore(() => createInitialState(overrides));
@@ -4203,35 +5136,39 @@ function mapError(error) {
4203
5136
  }
4204
5137
 
4205
5138
  // src/DepositFlow.tsx
4206
- import { Fragment as Fragment3, jsx as jsx11, jsxs as jsxs11 } from "react/jsx-runtime";
5139
+ import { Fragment as Fragment3, jsx as jsx18, jsxs as jsxs16 } from "react/jsx-runtime";
4207
5140
  function AccountPreparingSkeleton({
4208
5141
  errorMessage,
4209
5142
  onRetry
4210
5143
  }) {
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(
5144
+ return /* @__PURE__ */ jsxs16("div", { className: "rs-step", children: [
5145
+ /* @__PURE__ */ jsx18("div", { className: "rs-step-body", style: { paddingTop: 0 }, children: /* @__PURE__ */ jsx18("div", { className: "rs-loading-state", children: /* @__PURE__ */ jsx18("div", { className: "rs-loading-text", children: errorMessage ? /* @__PURE__ */ jsxs16(Fragment3, { children: [
5146
+ /* @__PURE__ */ jsx18("div", { className: "rs-loading-title rs-text-error", children: "Couldn\u2019t prepare account" }),
5147
+ /* @__PURE__ */ jsx18("div", { className: "rs-loading-subtitle", children: errorMessage })
5148
+ ] }) : /* @__PURE__ */ jsx18("div", { className: "rs-loading-title", children: "Preparing\u2026" }) }) }) }),
5149
+ errorMessage && onRetry && /* @__PURE__ */ jsx18("div", { className: "rs-step-footer", children: /* @__PURE__ */ jsx18(
4217
5150
  "button",
4218
5151
  {
4219
5152
  type: "button",
4220
5153
  className: "rs-button rs-button--default rs-button--full-width",
4221
5154
  onClick: onRetry,
4222
- children: /* @__PURE__ */ jsx11("span", { children: "Try again" })
5155
+ children: /* @__PURE__ */ jsx18("span", { children: "Try again" })
4223
5156
  }
4224
5157
  ) })
4225
5158
  ] });
4226
5159
  }
4227
5160
  var QR_AUTO_ADVANCE_HYDRATION_GRACE_MS = 1e3;
5161
+ var DAPP_IMPORT_RESOLVE_TIMEOUT_MS = 1e4;
4228
5162
  function isSameRoute2(sourceChain, sourceToken, targetChain, targetToken) {
4229
5163
  return sourceChain === targetChain && sourceToken.toLowerCase() === targetToken.toLowerCase();
4230
5164
  }
5165
+ var SWAPPED_SOURCE_CHAIN = 8453;
5166
+ var SWAPPED_SOURCE_TOKEN = "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913";
5167
+ var SWAPPED_SOURCE_DECIMALS = 6;
4231
5168
  function getAddressKey(address) {
4232
5169
  return address ? address.toLowerCase() : null;
4233
5170
  }
4234
- function deriveStep(flow, d, p, activeEntry) {
5171
+ function deriveStep(flow, d, p, activeEntry, fiat, exchange) {
4235
5172
  const flowStep = flow.step;
4236
5173
  const smartAccount = activeEntry.smartAccount;
4237
5174
  const solanaDepositAddress = activeEntry.solanaDepositAddress;
@@ -4246,6 +5183,23 @@ function deriveStep(flow, d, p, activeEntry) {
4246
5183
  smartAccount,
4247
5184
  solanaDepositAddress: solanaDepositAddress ?? void 0
4248
5185
  };
5186
+ case "fiat-onramp":
5187
+ if (!smartAccount) return { type: "setup" };
5188
+ return {
5189
+ type: "fiat-onramp",
5190
+ smartAccount,
5191
+ paymentMethod: fiat.selectedMethod ?? void 0
5192
+ };
5193
+ case "exchange-select":
5194
+ return { type: "exchange-select" };
5195
+ case "exchange-connect":
5196
+ if (!exchange.selectedConnection) return { type: "exchange-select" };
5197
+ if (!smartAccount) return { type: "setup" };
5198
+ return {
5199
+ type: "exchange-connect",
5200
+ smartAccount,
5201
+ connection: exchange.selectedConnection
5202
+ };
4249
5203
  case "select-asset":
4250
5204
  if (!smartAccount) return { type: "setup" };
4251
5205
  return { type: "select-asset", smartAccount };
@@ -4255,7 +5209,9 @@ function deriveStep(flow, d, p, activeEntry) {
4255
5209
  type: "amount",
4256
5210
  smartAccount,
4257
5211
  asset: d.selectedAsset,
4258
- amount: d.amount ?? void 0
5212
+ // Seed the input from the USD-style value the user typed, not the
5213
+ // native source `amount` (which would corrupt the input on back).
5214
+ inputAmountUsd: d.inputAmountUsd ?? void 0
4259
5215
  };
4260
5216
  case "confirm":
4261
5217
  if (!smartAccount || !d.selectedAsset || !d.amount || !d.targetAmount) {
@@ -4291,6 +5247,8 @@ function deriveStep(flow, d, p, activeEntry) {
4291
5247
  balanceUsd: d.balanceUsd,
4292
5248
  inputAmountUsd: d.inputAmountUsd ?? void 0
4293
5249
  };
5250
+ case "dapp-import-resolving":
5251
+ return { type: "dapp-import-resolving" };
4294
5252
  case "dapp-import-asset-select":
4295
5253
  if (!smartAccount) return { type: "setup" };
4296
5254
  return { type: "dapp-import-asset-select", smartAccount };
@@ -4324,6 +5282,7 @@ function deriveStep(flow, d, p, activeEntry) {
4324
5282
  amount: d.amount,
4325
5283
  sourceSymbol: d.sourceSymbol ?? void 0,
4326
5284
  sourceDecimals: d.sourceDecimals ?? void 0,
5285
+ inputAmountUsd: d.inputAmountUsd ?? void 0,
4327
5286
  directTransfer: p.directTransfer
4328
5287
  };
4329
5288
  }
@@ -4332,6 +5291,8 @@ function resolveOwnerForMode(mode, ctx) {
4332
5291
  switch (mode) {
4333
5292
  case "deposit-address":
4334
5293
  case "solana-wallet":
5294
+ case "fiat-onramp":
5295
+ case "exchange-connect":
4335
5296
  return ctx.dappAddress ?? null;
4336
5297
  case "wallet":
4337
5298
  return ctx.walletOwner ?? null;
@@ -4360,9 +5321,13 @@ function DepositFlow({
4360
5321
  signerAddress = DEFAULT_SIGNER_ADDRESS,
4361
5322
  sessionChainIds,
4362
5323
  forceRegister = false,
4363
- waitForFinalTx = true,
4364
5324
  enableSolana = true,
4365
5325
  dappImports,
5326
+ initialDappImport,
5327
+ enableFiatOnramp = false,
5328
+ enableQrTransfer = true,
5329
+ fiatOnrampMethods,
5330
+ enableExchangeConnect = false,
4366
5331
  reownWallet,
4367
5332
  onConnect,
4368
5333
  onDisconnect,
@@ -4391,31 +5356,33 @@ function DepositFlow({
4391
5356
  const depositSlice = useDepositStore((s) => s.deposit);
4392
5357
  const processingSlice = useDepositStore((s) => s.processing);
4393
5358
  const setupSlice = useDepositStore((s) => s.setup);
5359
+ const fiatSlice = useDepositStore((s) => s.fiat);
5360
+ const exchangeSlice = useDepositStore((s) => s.exchange);
4394
5361
  const flowMode = flowSlice.mode;
4395
5362
  const isConnectSelectionConfirmed = flowSlice.isConnectSelectionConfirmed;
4396
5363
  const hasNavigatedBack = flowSlice.hasNavigatedBack;
4397
5364
  const selectedWalletId = useDepositStore(selectedWalletIdSelector);
4398
- const [totalBalanceUsd, setTotalBalanceUsd] = useState9(0);
4399
- const [hasQrAutoAdvanceGraceElapsed, setHasQrAutoAdvanceGraceElapsed] = useState9(() => !hasInitialWalletHydrationPending);
4400
- const portfolioAssetsRef = useRef7([]);
4401
- const stableWalletSignerRef = useRef7(null);
4402
- const stableWalletSelectionKeyRef = useRef7(null);
4403
- const logFlow = useCallback4(
5365
+ const [totalBalanceUsd, setTotalBalanceUsd] = useState11(0);
5366
+ const [hasQrAutoAdvanceGraceElapsed, setHasQrAutoAdvanceGraceElapsed] = useState11(() => !hasInitialWalletHydrationPending);
5367
+ const portfolioAssetsRef = useRef8([]);
5368
+ const stableWalletSignerRef = useRef8(null);
5369
+ const stableWalletSelectionKeyRef = useRef8(null);
5370
+ const logFlow = useCallback7(
4404
5371
  (message, data) => {
4405
5372
  debugLog(debug, "deposit-flow", message, data);
4406
5373
  },
4407
5374
  [debug]
4408
5375
  );
4409
- const logFlowError = useCallback4(
5376
+ const logFlowError = useCallback7(
4410
5377
  (message, error, data) => {
4411
5378
  debugError(debug, "deposit-flow", message, error, data);
4412
5379
  },
4413
5380
  [debug]
4414
5381
  );
4415
- const handleAssetsLoaded = useCallback4((assets) => {
5382
+ const handleAssetsLoaded = useCallback7((assets) => {
4416
5383
  portfolioAssetsRef.current = assets;
4417
5384
  }, []);
4418
- const getTokenPriceUsd = useCallback4((symbol) => {
5385
+ const getTokenPriceUsd = useCallback7((symbol) => {
4419
5386
  const sym = symbol.toLowerCase();
4420
5387
  for (const asset of portfolioAssetsRef.current) {
4421
5388
  if (asset.symbol.toLowerCase() === sym && asset.balanceUsd && asset.balance) {
@@ -4430,14 +5397,14 @@ function DepositFlow({
4430
5397
  }
4431
5398
  return null;
4432
5399
  }, []);
4433
- const dappSwitchChain = useMemo6(() => {
5400
+ const dappSwitchChain = useMemo7(() => {
4434
5401
  if (!dappWalletClient?.switchChain) return void 0;
4435
5402
  return async (chainId) => {
4436
5403
  await dappWalletClient.switchChain?.({ id: chainId });
4437
5404
  };
4438
5405
  }, [dappWalletClient]);
4439
5406
  const connectedWalletAddress = dappWalletClient?.account?.address ?? null;
4440
- const walletOptions = useMemo6(() => {
5407
+ const walletOptions = useMemo7(() => {
4441
5408
  const options = [];
4442
5409
  const seen = /* @__PURE__ */ new Set();
4443
5410
  if (connectedWalletAddress && dappAddress) {
@@ -4489,7 +5456,7 @@ function DepositFlow({
4489
5456
  reownWallet?.solanaAddress,
4490
5457
  reownWallet?.caipAddress
4491
5458
  ]);
4492
- const canAutoLock = dappWalletClient?.account && dappAddress && !reownWallet;
5459
+ const canAutoLock = dappWalletClient?.account && dappAddress && !reownWallet && !enableFiatOnramp && !enableExchangeConnect;
4493
5460
  const hasWalletOptions = walletOptions.length > 0;
4494
5461
  const hasReownSession = Boolean(
4495
5462
  enableSolana ? reownWallet?.isConnected || reownWallet?.address : reownWallet?.address
@@ -4497,8 +5464,11 @@ function DepositFlow({
4497
5464
  const isWalletHydrationPending = Boolean(
4498
5465
  dappAddress && !hasWalletOptions && (hasDappWalletClientProp && dappWalletClient === void 0 || reownWallet && !hasReownSession && !reownWallet.isReady)
4499
5466
  );
5467
+ const isDappImportWalletHydrating = Boolean(
5468
+ hasDappWalletClientProp && dappWalletClient === void 0 || reownWallet && !hasReownSession && !reownWallet.isReady
5469
+ );
4500
5470
  const showConnectStep = flowMode === null && !isConnectSelectionConfirmed;
4501
- useEffect8(() => {
5471
+ useEffect10(() => {
4502
5472
  if (!isWalletHydrationPending) {
4503
5473
  setHasQrAutoAdvanceGraceElapsed(true);
4504
5474
  return;
@@ -4509,7 +5479,7 @@ function DepositFlow({
4509
5479
  }, QR_AUTO_ADVANCE_HYDRATION_GRACE_MS);
4510
5480
  return () => window.clearTimeout(timeout);
4511
5481
  }, [isWalletHydrationPending]);
4512
- const walletSelectionKey = useMemo6(() => {
5482
+ const walletSelectionKey = useMemo7(() => {
4513
5483
  if (flowMode !== "wallet" && flowMode !== "dapp-import") return null;
4514
5484
  if (canAutoLock) {
4515
5485
  return getAddressKey(connectedWalletAddress);
@@ -4523,11 +5493,11 @@ function DepositFlow({
4523
5493
  isConnectSelectionConfirmed,
4524
5494
  selectedWalletId
4525
5495
  ]);
4526
- const setupChainId = typeof targetChain === "number" ? targetChain : typeof defaultSourceChain === "number" ? defaultSourceChain : base.id;
5496
+ const setupChainId = typeof targetChain === "number" && !isVirtualDestination(targetChain) ? targetChain : typeof defaultSourceChain === "number" ? defaultSourceChain : base.id;
4527
5497
  const targetSymbol = getTargetTokenSymbol(targetToken, targetChain);
4528
5498
  const isTargetStablecoin = isStablecoinSymbol(targetSymbol);
4529
- const targetMarketPriceRef = useRef7(null);
4530
- useEffect8(() => {
5499
+ const targetMarketPriceRef = useRef8(null);
5500
+ useEffect10(() => {
4531
5501
  targetMarketPriceRef.current = null;
4532
5502
  if (isTargetStablecoin || targetSymbol === "Token") {
4533
5503
  return;
@@ -4542,7 +5512,7 @@ function DepositFlow({
4542
5512
  cancelled = true;
4543
5513
  };
4544
5514
  }, [service, targetSymbol, isTargetStablecoin]);
4545
- const walletSignerContext = useMemo6(() => {
5515
+ const walletSignerContext = useMemo7(() => {
4546
5516
  if (flowMode === "deposit-address") {
4547
5517
  return null;
4548
5518
  }
@@ -4608,7 +5578,7 @@ function DepositFlow({
4608
5578
  reownWallet,
4609
5579
  setupChainId
4610
5580
  ]);
4611
- useEffect8(() => {
5581
+ useEffect10(() => {
4612
5582
  if (flowMode !== "wallet" && flowMode !== "dapp-import") {
4613
5583
  stableWalletSelectionKeyRef.current = null;
4614
5584
  stableWalletSignerRef.current = null;
@@ -4623,7 +5593,7 @@ function DepositFlow({
4623
5593
  stableWalletSignerRef.current = walletSignerContext;
4624
5594
  }
4625
5595
  }, [flowMode, walletSelectionKey, walletSignerContext]);
4626
- const signerContext = useMemo6(() => {
5596
+ const signerContext = useMemo7(() => {
4627
5597
  if (flowMode === "deposit-address") {
4628
5598
  if (!dappAddress) return null;
4629
5599
  return {
@@ -4651,7 +5621,7 @@ function DepositFlow({
4651
5621
  walletSignerContext,
4652
5622
  walletSelectionKey
4653
5623
  ]);
4654
- const selectedEvmWalletOwner = useMemo6(() => {
5624
+ const selectedEvmWalletOwner = useMemo7(() => {
4655
5625
  if (!selectedWalletId) return null;
4656
5626
  const opt = walletOptions.find((o) => o.id === selectedWalletId);
4657
5627
  if (opt?.kind === "external" && opt.address) {
@@ -4662,7 +5632,7 @@ function DepositFlow({
4662
5632
  }
4663
5633
  return null;
4664
5634
  }, [selectedWalletId, walletOptions]);
4665
- const dappImportOwner = useMemo6(() => {
5635
+ const dappImportOwner = useMemo7(() => {
4666
5636
  if (selectedEvmWalletOwner) return selectedEvmWalletOwner;
4667
5637
  if (reownWallet?.address && reownWallet.isConnected) {
4668
5638
  return reownWallet.address;
@@ -4675,7 +5645,7 @@ function DepositFlow({
4675
5645
  reownWallet?.isConnected,
4676
5646
  connectedWalletAddress
4677
5647
  ]);
4678
- const activeOwner = useMemo6(
5648
+ const activeOwner = useMemo7(
4679
5649
  () => resolveOwnerForMode(flowMode, {
4680
5650
  dappAddress,
4681
5651
  walletOwner: signerContext?.ownerAddress ?? (canAutoLock ? connectedWalletAddress : selectedEvmWalletOwner),
@@ -4691,12 +5661,12 @@ function DepositFlow({
4691
5661
  dappImportOwner
4692
5662
  ]
4693
5663
  );
4694
- const activeEntry = useMemo6(
5664
+ const activeEntry = useMemo7(
4695
5665
  () => readSetupForOwner(setupSlice, activeOwner),
4696
5666
  [setupSlice, activeOwner]
4697
5667
  );
4698
- const lastActiveSetupLifecycleKeyRef = useRef7(null);
4699
- useEffect8(() => {
5668
+ const lastActiveSetupLifecycleKeyRef = useRef8(null);
5669
+ useEffect10(() => {
4700
5670
  if (!flowMode || !isConnectSelectionConfirmed) {
4701
5671
  lastActiveSetupLifecycleKeyRef.current = null;
4702
5672
  return;
@@ -4732,12 +5702,26 @@ function DepositFlow({
4732
5702
  activeEntry.solanaDepositAddress,
4733
5703
  onLifecycleRef
4734
5704
  ]);
4735
- const effectiveStep = useMemo6(
4736
- () => deriveStep(flowSlice, depositSlice, processingSlice, activeEntry),
4737
- [flowSlice, depositSlice, processingSlice, activeEntry]
5705
+ const effectiveStep = useMemo7(
5706
+ () => deriveStep(
5707
+ flowSlice,
5708
+ depositSlice,
5709
+ processingSlice,
5710
+ activeEntry,
5711
+ fiatSlice,
5712
+ exchangeSlice
5713
+ ),
5714
+ [
5715
+ flowSlice,
5716
+ depositSlice,
5717
+ processingSlice,
5718
+ activeEntry,
5719
+ fiatSlice,
5720
+ exchangeSlice
5721
+ ]
4738
5722
  );
4739
5723
  const step = effectiveStep;
4740
- const handleBack = useCallback4(() => {
5724
+ const handleBack = useCallback7(() => {
4741
5725
  const stepBeforeBack = storeApi.getState().flow.step;
4742
5726
  storeApi.dispatch({
4743
5727
  type: "back/requested",
@@ -4747,16 +5731,55 @@ function DepositFlow({
4747
5731
  portfolioAssetsRef.current = [];
4748
5732
  }
4749
5733
  }, [storeApi, hasWalletOptions, reownWallet]);
4750
- const canGoBackFromHere = effectiveStep.type === "deposit-address" || effectiveStep.type === "solana-token-select" || effectiveStep.type === "solana-amount" || effectiveStep.type === "solana-confirm" || effectiveStep.type === "amount" || effectiveStep.type === "confirm" || effectiveStep.type === "dapp-import-asset-select" || effectiveStep.type === "select-asset" && signerContext && !canAutoLock;
5734
+ const canGoBackFromHere = effectiveStep.type === "deposit-address" || effectiveStep.type === "solana-token-select" || effectiveStep.type === "solana-amount" || effectiveStep.type === "solana-confirm" || effectiveStep.type === "amount" || effectiveStep.type === "confirm" || // Escape hatch from a slow or stuck pre-routed resolve. Mode-gated so
5735
+ // the chevron doesn't linger if a disconnect cleared the mode out from
5736
+ // under the step.
5737
+ effectiveStep.type === "dapp-import-resolving" && flowMode === "dapp-import" || effectiveStep.type === "dapp-import-asset-select" || effectiveStep.type === "fiat-onramp" || effectiveStep.type === "exchange-select" || effectiveStep.type === "exchange-connect" || effectiveStep.type === "select-asset" && signerContext && !canAutoLock;
4751
5738
  const currentBackHandler = canGoBackFromHere ? handleBack : void 0;
4752
5739
  const currentScreen = showConnectStep ? "connect" : effectiveStep.type;
4753
- useEffect8(() => {
5740
+ useEffect10(() => {
4754
5741
  onStepChangeRef.current?.(currentBackHandler, currentScreen);
4755
5742
  }, [currentBackHandler, currentScreen, onStepChangeRef]);
5743
+ const lastModalHeightRef = useRef8(0);
5744
+ const modalContentElRef = useRef8(null);
5745
+ useEffect10(() => {
5746
+ const mc = document.querySelector(".rs-modal-content");
5747
+ if (!mc) return;
5748
+ modalContentElRef.current = mc;
5749
+ const ro = new ResizeObserver((entries) => {
5750
+ for (const entry of entries) {
5751
+ const border = entry.borderBoxSize?.[0]?.blockSize;
5752
+ lastModalHeightRef.current = typeof border === "number" ? border : entry.contentRect.height;
5753
+ }
5754
+ });
5755
+ ro.observe(mc);
5756
+ return () => {
5757
+ ro.disconnect();
5758
+ modalContentElRef.current = null;
5759
+ };
5760
+ }, []);
5761
+ const stepPinKey = `${flowMode ?? "none"}:${step.type}`;
5762
+ const prevStepPinKeyRef = useRef8(stepPinKey);
5763
+ useLayoutEffect2(() => {
5764
+ if (prevStepPinKeyRef.current === stepPinKey) return;
5765
+ prevStepPinKeyRef.current = stepPinKey;
5766
+ const mc = document.querySelector(".rs-modal-content");
5767
+ const lastHeight = lastModalHeightRef.current;
5768
+ if (!mc || lastHeight <= 0) return;
5769
+ const prevTransition = mc.style.transition;
5770
+ mc.style.transition = "none";
5771
+ mc.style.setProperty("min-height", `${lastHeight}px`, "important");
5772
+ void mc.offsetHeight;
5773
+ const rafId = requestAnimationFrame(() => {
5774
+ mc.style.transition = prevTransition;
5775
+ mc.style.removeProperty("min-height");
5776
+ });
5777
+ return () => cancelAnimationFrame(rafId);
5778
+ }, [stepPinKey]);
4756
5779
  const stepSendToken = effectiveStep.type === "amount" ? effectiveStep.asset.symbol : null;
4757
5780
  const stepOpenEventKey = effectiveStep.type === "select-asset" ? "select-asset" : effectiveStep.type === "deposit-address" ? "deposit-address" : effectiveStep.type === "amount" && stepSendToken ? `amount:${stepSendToken.toLowerCase()}` : null;
4758
- const lastStepOpenEventKeyRef = useRef7(null);
4759
- useEffect8(() => {
5781
+ const lastStepOpenEventKeyRef = useRef8(null);
5782
+ useEffect10(() => {
4760
5783
  if (!stepOpenEventKey) {
4761
5784
  lastStepOpenEventKeyRef.current = null;
4762
5785
  return;
@@ -4798,7 +5821,7 @@ function DepositFlow({
4798
5821
  totalBalanceUsd,
4799
5822
  onEventRef
4800
5823
  ]);
4801
- useEffect8(() => {
5824
+ useEffect10(() => {
4802
5825
  logFlow("state:changed", {
4803
5826
  step: effectiveStep.type,
4804
5827
  flowMode,
@@ -4814,7 +5837,7 @@ function DepositFlow({
4814
5837
  targetChain,
4815
5838
  targetToken
4816
5839
  ]);
4817
- useEffect8(() => {
5840
+ useEffect10(() => {
4818
5841
  onLifecycleRef.current?.({
4819
5842
  type: "balance-changed",
4820
5843
  totalUsd: totalBalanceUsd
@@ -4823,10 +5846,12 @@ function DepositFlow({
4823
5846
  const isDepositAddressMode = flowMode === "deposit-address";
4824
5847
  const isSolanaWalletMode = flowMode === "solana-wallet";
4825
5848
  const isDappImportMode = flowMode === "dapp-import";
4826
- const handleSelectTransferCrypto = useCallback4(() => {
5849
+ const isFiatOnrampMode = flowMode === "fiat-onramp";
5850
+ const isExchangeConnectMode = flowMode === "exchange-connect";
5851
+ const handleSelectTransferCrypto = useCallback7(() => {
4827
5852
  storeApi.dispatch({ type: "connect/transfer-crypto-selected" });
4828
5853
  }, [storeApi]);
4829
- const handleConfirmWallet = useCallback4(
5854
+ const handleConfirmWallet = useCallback7(
4830
5855
  (walletId) => {
4831
5856
  const selectedOption = walletOptions.find((o) => o.id === walletId);
4832
5857
  const mode = enableSolana && selectedOption?.kind === "solana" ? "solana-wallet" : "wallet";
@@ -4842,12 +5867,16 @@ function DepositFlow({
4842
5867
  enableSolana && reownWallet?.isConnected && reownWallet?.isSolana
4843
5868
  );
4844
5869
  const dappImportsKey = dappImports ? Object.keys(dappImports).filter((k) => dappImports[k]).sort().join(",") : "";
4845
- const enabledDappImportProviders = useMemo6(
5870
+ const enabledDappImportProviders = useMemo7(
4846
5871
  () => isSolanaWalletConnected ? [] : getEnabledProviders(dappImports),
4847
5872
  // eslint-disable-next-line react-hooks/exhaustive-deps -- intentional: keyed on dappImportsKey, not the dappImports object identity
4848
5873
  [dappImportsKey, isSolanaWalletConnected]
4849
5874
  );
4850
- const handleSelectDappImport = useCallback4(
5875
+ const initialDappImportProvider = useMemo7(
5876
+ () => initialDappImport ? enabledDappImportProviders.find((p) => p.id === initialDappImport) ?? null : null,
5877
+ [initialDappImport, enabledDappImportProviders]
5878
+ );
5879
+ const handleSelectDappImport = useCallback7(
4851
5880
  (providerId) => {
4852
5881
  const owner = dappImportOwner;
4853
5882
  if (owner) {
@@ -4868,13 +5897,16 @@ function DepositFlow({
4868
5897
  },
4869
5898
  [storeApi, walletOptions, dappImportOwner]
4870
5899
  );
4871
- const handleDappImportAssetSelected = useCallback4(
5900
+ const handleDappImportAssetSelected = useCallback7(
4872
5901
  (asset) => {
4873
5902
  storeApi.dispatch({ type: "dapp-import/asset-selected", asset });
4874
5903
  },
4875
5904
  [storeApi]
4876
5905
  );
4877
- useEffect8(() => {
5906
+ const dappImportAttemptNonce = useDepositStore(
5907
+ (s) => s.dappImport.attemptNonce
5908
+ );
5909
+ useEffect10(() => {
4878
5910
  if (!dappImportOwner || enabledDappImportProviders.length === 0) {
4879
5911
  storeApi.dispatch({ type: "dapp-import/availability-cleared" });
4880
5912
  return;
@@ -4907,15 +5939,29 @@ function DepositFlow({
4907
5939
  }).catch(() => {
4908
5940
  if (controller.signal.aborted) return;
4909
5941
  storeApi.dispatch({
4910
- type: "dapp-import/availability-loaded",
5942
+ type: "dapp-import/availability-failed",
4911
5943
  providerId: provider.id,
4912
- owner: dappImportOwner,
4913
- availability: null
5944
+ owner: dappImportOwner
4914
5945
  });
4915
5946
  });
4916
5947
  }
4917
5948
  return () => controller.abort();
4918
- }, [dappImportOwner, enabledDappImportProviders, storeApi]);
5949
+ }, [
5950
+ dappImportOwner,
5951
+ enabledDappImportProviders,
5952
+ dappImportAttemptNonce,
5953
+ storeApi
5954
+ ]);
5955
+ useLayoutEffect2(() => {
5956
+ if (!initialDappImportProvider) return;
5957
+ if (flowSlice.step !== "connect" || flowSlice.mode !== null || flowSlice.isConnectSelectionConfirmed || flowSlice.hasNavigatedBack) {
5958
+ return;
5959
+ }
5960
+ storeApi.dispatch({
5961
+ type: "dapp-import/boot-requested",
5962
+ providerId: initialDappImportProvider.id
5963
+ });
5964
+ }, [initialDappImportProvider, flowSlice, storeApi]);
4919
5965
  const dappImportAvailability = useDepositStore((s) => s.dappImport.availability);
4920
5966
  const dappImportAvailabilityOwner = useDepositStore(
4921
5967
  (s) => s.dappImport.availabilityOwner
@@ -4923,48 +5969,19 @@ function DepositFlow({
4923
5969
  const activeDappImportProviderId = useDepositStore(
4924
5970
  (s) => s.dappImport.activeProviderId
4925
5971
  );
4926
- const connectStepDappImports = useMemo6(
4927
- () => enabledDappImportProviders.map((provider) => {
4928
- const baseRow = {
4929
- id: provider.id,
4930
- label: provider.label,
4931
- icon: provider.icon
4932
- };
4933
- if (!dappImportOwner) {
4934
- return { ...baseRow, status: "needs-connect" };
4935
- }
4936
- const availabilityEntry = dappImportAvailabilityOwner?.toLowerCase() === dappImportOwner.toLowerCase() ? dappImportAvailability[provider.id] : void 0;
4937
- const dappImportSetup = readSetupForOwner(setupSlice, dappImportOwner);
4938
- if (availabilityEntry === "loading" || availabilityEntry === void 0) {
4939
- return { ...baseRow, status: "loading" };
4940
- }
4941
- if (availabilityEntry === null) {
4942
- return {
4943
- ...baseRow,
4944
- status: { enabled: false, reason: "No balance" }
4945
- };
4946
- }
4947
- if (dappImportSetup.status === "loading" || !dappImportOwner) {
4948
- return { ...baseRow, status: "loading" };
4949
- }
4950
- if (dappImportSetup.status === "error") {
4951
- return {
4952
- ...baseRow,
4953
- status: {
4954
- enabled: false,
4955
- reason: "Couldn't prepare account \u2014 tap to retry",
4956
- retryable: true
4957
- }
4958
- };
4959
- }
4960
- return {
4961
- ...baseRow,
4962
- status: {
4963
- enabled: true,
4964
- balanceUsd: availabilityEntry.totalUsd
4965
- }
4966
- };
4967
- }),
5972
+ const dappImportBootError = useDepositStore((s) => s.dappImport.bootError);
5973
+ const connectStepDappImports = useMemo7(
5974
+ () => enabledDappImportProviders.map((provider) => ({
5975
+ id: provider.id,
5976
+ label: provider.label,
5977
+ icon: provider.icon,
5978
+ status: computeDappImportStatus(provider.id, {
5979
+ owner: dappImportOwner,
5980
+ availability: dappImportAvailability,
5981
+ availabilityOwner: dappImportAvailabilityOwner,
5982
+ setup: setupSlice
5983
+ })
5984
+ })),
4968
5985
  [
4969
5986
  enabledDappImportProviders,
4970
5987
  dappImportAvailability,
@@ -4973,19 +5990,19 @@ function DepositFlow({
4973
5990
  dappImportOwner
4974
5991
  ]
4975
5992
  );
4976
- const activeDappImportProvider = useMemo6(() => {
5993
+ const activeDappImportProvider = useMemo7(() => {
4977
5994
  if (!activeDappImportProviderId) return null;
4978
5995
  return enabledDappImportProviders.find(
4979
5996
  (p) => p.id === activeDappImportProviderId
4980
5997
  ) ?? null;
4981
5998
  }, [activeDappImportProviderId, enabledDappImportProviders]);
4982
- const activeDappImportAvailability = useMemo6(() => {
5999
+ const activeDappImportAvailability = useMemo7(() => {
4983
6000
  if (!activeDappImportProviderId) return null;
4984
6001
  if (!dappImportOwner || dappImportAvailabilityOwner?.toLowerCase() !== dappImportOwner.toLowerCase()) {
4985
6002
  return null;
4986
6003
  }
4987
6004
  const entry = dappImportAvailability[activeDappImportProviderId];
4988
- if (!entry || entry === "loading") return null;
6005
+ if (!entry || entry === "loading" || entry === "error") return null;
4989
6006
  return entry;
4990
6007
  }, [
4991
6008
  activeDappImportProviderId,
@@ -4993,7 +6010,118 @@ function DepositFlow({
4993
6010
  dappImportAvailabilityOwner,
4994
6011
  dappImportOwner
4995
6012
  ]);
4996
- const handleNewDeposit = useCallback4(() => {
6013
+ const isBootResolving = isDappImportMode && flowSlice.step === "dapp-import-resolving";
6014
+ const [hasResolveDeadlinePassed, setHasResolveDeadlinePassed] = useState11(false);
6015
+ useEffect10(() => {
6016
+ setHasResolveDeadlinePassed(false);
6017
+ if (!isBootResolving || dappImportBootError) return;
6018
+ const timeout = window.setTimeout(() => {
6019
+ setHasResolveDeadlinePassed(true);
6020
+ }, DAPP_IMPORT_RESOLVE_TIMEOUT_MS);
6021
+ return () => window.clearTimeout(timeout);
6022
+ }, [isBootResolving, dappImportBootError]);
6023
+ useEffect10(() => {
6024
+ if (!isBootResolving || dappImportBootError) return;
6025
+ const providerId = activeDappImportProviderId;
6026
+ if (!providerId) return;
6027
+ if (!enabledDappImportProviders.some((p) => p.id === providerId)) {
6028
+ storeApi.dispatch({
6029
+ type: "dapp-import/boot-resolved",
6030
+ providerId,
6031
+ outcome: "unavailable"
6032
+ });
6033
+ return;
6034
+ }
6035
+ const status = computeDappImportStatus(providerId, {
6036
+ owner: dappImportOwner,
6037
+ availability: dappImportAvailability,
6038
+ availabilityOwner: dappImportAvailabilityOwner,
6039
+ setup: setupSlice
6040
+ });
6041
+ const pinnableWallet = dappImportOwner ? walletOptions.find(
6042
+ (o) => (o.address ?? null)?.toLowerCase() === dappImportOwner.toLowerCase()
6043
+ ) ?? null : null;
6044
+ const outcome = resolveBootOutcome({
6045
+ status,
6046
+ setupStatus: readSetupForOwner(setupSlice, dappImportOwner).status,
6047
+ timedOut: hasResolveDeadlinePassed,
6048
+ walletHydrating: isDappImportWalletHydrating,
6049
+ signerAvailable: pinnableWallet !== null
6050
+ });
6051
+ if (outcome === "wait") return;
6052
+ if (outcome === "ready" && pinnableWallet) {
6053
+ storeApi.dispatch({
6054
+ type: "wallet/id-selected",
6055
+ walletId: pinnableWallet.id
6056
+ });
6057
+ }
6058
+ storeApi.dispatch({
6059
+ type: "dapp-import/boot-resolved",
6060
+ providerId,
6061
+ outcome
6062
+ });
6063
+ }, [
6064
+ isBootResolving,
6065
+ dappImportBootError,
6066
+ activeDappImportProviderId,
6067
+ enabledDappImportProviders,
6068
+ dappImportOwner,
6069
+ dappImportAvailability,
6070
+ dappImportAvailabilityOwner,
6071
+ setupSlice,
6072
+ hasResolveDeadlinePassed,
6073
+ isDappImportWalletHydrating,
6074
+ walletOptions,
6075
+ storeApi
6076
+ ]);
6077
+ const handleBootRetry = useCallback7(() => {
6078
+ const snapshot = storeApi.getState();
6079
+ const providerId = snapshot.dappImport.activeProviderId;
6080
+ if (!providerId) return;
6081
+ if (dappImportOwner) {
6082
+ const plan = bootRetryPlan({
6083
+ setupStatus: readSetupForOwner(snapshot.setup, dappImportOwner).status,
6084
+ availabilityEntry: snapshot.dappImport.availabilityOwner?.toLowerCase() === dappImportOwner.toLowerCase() ? snapshot.dappImport.availability[providerId] : void 0
6085
+ });
6086
+ if (plan.restartSetup) {
6087
+ storeApi.dispatch({
6088
+ type: "setup/retry-requested",
6089
+ owner: dappImportOwner
6090
+ });
6091
+ }
6092
+ if (plan.refetchAvailability) {
6093
+ storeApi.dispatch({
6094
+ type: "dapp-import/availability-retry-requested"
6095
+ });
6096
+ }
6097
+ }
6098
+ storeApi.dispatch({
6099
+ type: "dapp-import/boot-requested",
6100
+ providerId
6101
+ });
6102
+ }, [storeApi, dappImportOwner]);
6103
+ const handleSelectFiatMethod = useCallback7(
6104
+ (paymentMethod) => {
6105
+ storeApi.dispatch({
6106
+ type: "connect/fiat-onramp-selected",
6107
+ paymentMethod
6108
+ });
6109
+ },
6110
+ [storeApi]
6111
+ );
6112
+ const handleSelectExchange = useCallback7(() => {
6113
+ storeApi.dispatch({ type: "connect/exchange-selected" });
6114
+ }, [storeApi]);
6115
+ const handleSelectExchangeConnection = useCallback7(
6116
+ (connection) => {
6117
+ storeApi.dispatch({
6118
+ type: "exchange/connection-selected",
6119
+ connection
6120
+ });
6121
+ },
6122
+ [storeApi]
6123
+ );
6124
+ const handleNewDeposit = useCallback7(() => {
4997
6125
  onLifecycleRef.current?.({
4998
6126
  type: "smart-account-changed",
4999
6127
  evm: null,
@@ -5004,7 +6132,7 @@ function DepositFlow({
5004
6132
  stableWalletSignerRef.current = null;
5005
6133
  stableWalletSelectionKeyRef.current = null;
5006
6134
  }, [onLifecycleRef, storeApi]);
5007
- const setupInputBase = useMemo6(
6135
+ const setupInputBase = useMemo7(
5008
6136
  () => ({
5009
6137
  targetChain,
5010
6138
  targetToken,
@@ -5030,7 +6158,7 @@ function DepositFlow({
5030
6158
  enableSolana
5031
6159
  ]
5032
6160
  );
5033
- const desiredOwnersKey = useMemo6(() => {
6161
+ const desiredOwnersKey = useMemo7(() => {
5034
6162
  const owners = [];
5035
6163
  const seen = /* @__PURE__ */ new Set();
5036
6164
  const push = (addr) => {
@@ -5051,7 +6179,7 @@ function DepositFlow({
5051
6179
  reownWallet?.address,
5052
6180
  dappImportOwner
5053
6181
  ]);
5054
- useEffect8(() => {
6182
+ useEffect10(() => {
5055
6183
  desiredOwnersKey.forEach((owner) => {
5056
6184
  void (async () => {
5057
6185
  const input = {
@@ -5146,7 +6274,7 @@ function DepositFlow({
5146
6274
  storeApi,
5147
6275
  setupSlice.byOwner
5148
6276
  ]);
5149
- const handleDepositAddressSubmitted = useCallback4(
6277
+ const handleDepositAddressSubmitted = useCallback7(
5150
6278
  (data) => {
5151
6279
  logFlow("deposit-address:detected", {
5152
6280
  txHash: data.txHash,
@@ -5157,7 +6285,7 @@ function DepositFlow({
5157
6285
  },
5158
6286
  [logFlow, onLifecycleRef]
5159
6287
  );
5160
- const handleSolanaTokenContinue = useCallback4(
6288
+ const handleSolanaTokenContinue = useCallback7(
5161
6289
  (token, balance, balanceUsd) => {
5162
6290
  logFlow("solana:token:continue", { token: token.symbol });
5163
6291
  storeApi.dispatch({
@@ -5170,7 +6298,7 @@ function DepositFlow({
5170
6298
  },
5171
6299
  [defaultAmount, logFlow, storeApi]
5172
6300
  );
5173
- const handleSolanaAmountContinue = useCallback4(
6301
+ const handleSolanaAmountContinue = useCallback7(
5174
6302
  (token, sourceAmount, inputAmountUsd) => {
5175
6303
  const targetSym = getTargetTokenSymbol(targetToken, targetChain);
5176
6304
  const isTargetStable = isStablecoinSymbol(targetSym);
@@ -5192,10 +6320,12 @@ function DepositFlow({
5192
6320
  },
5193
6321
  [targetToken, targetChain, getTokenPriceUsd, logFlow, storeApi]
5194
6322
  );
5195
- const handleSolanaConfirmed = useCallback4(
6323
+ const handleSolanaConfirmed = useCallback7(
5196
6324
  (txHash, amountUnits) => {
5197
- const tokenAtSubmit = storeApi.getState().deposit.selectedSolanaToken;
6325
+ const depositAtSubmit = storeApi.getState().deposit;
6326
+ const tokenAtSubmit = depositAtSubmit.selectedSolanaToken;
5198
6327
  if (!tokenAtSubmit) return;
6328
+ const amountUsd = depositAtSubmit.inputAmountUsd ?? void 0;
5199
6329
  logFlow("solana:submitted", {
5200
6330
  txHash,
5201
6331
  amountUnits,
@@ -5208,18 +6338,21 @@ function DepositFlow({
5208
6338
  sourceToken: tokenAtSubmit.mint,
5209
6339
  amount: amountUnits,
5210
6340
  sourceSymbol: tokenAtSubmit.symbol,
5211
- sourceDecimals: tokenAtSubmit.decimals
6341
+ sourceDecimals: tokenAtSubmit.decimals,
6342
+ inputAmountUsd: amountUsd
5212
6343
  });
5213
6344
  onLifecycleRef.current?.({
5214
6345
  type: "submitted",
5215
6346
  txHash,
5216
6347
  sourceChain: "solana",
5217
- amount: amountUnits
6348
+ amount: amountUnits,
6349
+ sourceDecimals: tokenAtSubmit.decimals,
6350
+ amountUsd
5218
6351
  });
5219
6352
  },
5220
6353
  [logFlow, onLifecycleRef, storeApi]
5221
6354
  );
5222
- const handleAssetContinue = useCallback4(
6355
+ const handleAssetContinue = useCallback7(
5223
6356
  (asset) => {
5224
6357
  onEventRef.current?.({
5225
6358
  type: "deposit_modal_connected_wallet_select_source_cta_click",
@@ -5237,7 +6370,7 @@ function DepositFlow({
5237
6370
  },
5238
6371
  [defaultAmount, onEventRef, totalBalanceUsd, storeApi]
5239
6372
  );
5240
- const handleAmountContinue = useCallback4(
6373
+ const handleAmountContinue = useCallback7(
5241
6374
  (amount, targetAmount, balance, liquidityWarning) => {
5242
6375
  const entry = readSetupForOwner(
5243
6376
  storeApi.getState().setup,
@@ -5258,7 +6391,7 @@ function DepositFlow({
5258
6391
  },
5259
6392
  [targetToken, targetChain, getTokenPriceUsd, storeApi, activeOwner]
5260
6393
  );
5261
- const handleDepositSubmitted = useCallback4(
6394
+ const handleDepositSubmitted = useCallback7(
5262
6395
  (txHash, chainId, amount, token) => {
5263
6396
  logFlow("evm:submitted", {
5264
6397
  txHash,
@@ -5266,7 +6399,8 @@ function DepositFlow({
5266
6399
  sourceToken: token,
5267
6400
  amount
5268
6401
  });
5269
- const asset = storeApi.getState().deposit.selectedAsset;
6402
+ const depositAtSubmit = storeApi.getState().deposit;
6403
+ const asset = depositAtSubmit.selectedAsset;
5270
6404
  const dappImport = asset && isDappImportAsset(asset) ? asset : null;
5271
6405
  storeApi.dispatch({
5272
6406
  type: "deposit/submitted",
@@ -5274,25 +6408,55 @@ function DepositFlow({
5274
6408
  sourceChain: chainId,
5275
6409
  sourceToken: token,
5276
6410
  amount,
5277
- sourceSymbol: dappImport?.symbol,
5278
- sourceDecimals: dappImport?.decimals,
6411
+ sourceSymbol: asset?.symbol,
6412
+ sourceDecimals: asset?.decimals,
6413
+ inputAmountUsd: depositAtSubmit.inputAmountUsd ?? void 0,
5279
6414
  directTransfer: !dappImport && isSameRoute2(chainId, token, targetChain, targetToken)
5280
6415
  });
5281
6416
  },
5282
6417
  [logFlow, storeApi, targetChain, targetToken]
5283
6418
  );
5284
- const handleDepositSubmittedCallback = useCallback4(
6419
+ const handleSwappedComplete = useCallback7(
6420
+ (info) => {
6421
+ logFlow("swapped:complete", {
6422
+ txHash: info.txHash,
6423
+ orderCrypto: info.orderCrypto
6424
+ });
6425
+ const amount = info.amount ?? "0";
6426
+ storeApi.dispatch({
6427
+ type: "deposit/submitted",
6428
+ txHash: info.txHash,
6429
+ sourceChain: SWAPPED_SOURCE_CHAIN,
6430
+ sourceToken: SWAPPED_SOURCE_TOKEN,
6431
+ amount,
6432
+ sourceSymbol: info.orderCrypto ?? "USDC",
6433
+ sourceDecimals: SWAPPED_SOURCE_DECIMALS
6434
+ });
6435
+ onLifecycleRef.current?.({
6436
+ type: "submitted",
6437
+ txHash: info.txHash,
6438
+ sourceChain: SWAPPED_SOURCE_CHAIN,
6439
+ amount,
6440
+ sourceDecimals: SWAPPED_SOURCE_DECIMALS
6441
+ });
6442
+ },
6443
+ [logFlow, storeApi, onLifecycleRef]
6444
+ );
6445
+ const handleDepositSubmittedCallback = useCallback7(
5285
6446
  (txHash, sourceChain, amount) => {
6447
+ const depositAtSubmit = storeApi.getState().deposit;
5286
6448
  onLifecycleRef.current?.({
5287
6449
  type: "submitted",
5288
6450
  txHash,
5289
6451
  sourceChain,
5290
- amount
6452
+ amount,
6453
+ sourceDecimals: depositAtSubmit.selectedAsset?.decimals,
6454
+ amountUsd: depositAtSubmit.inputAmountUsd ?? void 0
5291
6455
  });
5292
6456
  },
5293
- [onLifecycleRef]
6457
+ [onLifecycleRef, storeApi]
5294
6458
  );
5295
- const handleDepositComplete = useCallback4(
6459
+ const handleDepositComplete = useCallback7(
5296
6460
  (txHash, destinationTxHash, context) => {
5297
6461
  logFlow("deposit:complete", { txHash, destinationTxHash, ...context });
5298
6462
  onLifecycleRef.current?.({
@@ -5304,28 +6468,28 @@ function DepositFlow({
5304
6468
  },
5305
6469
  [logFlow, onLifecycleRef]
5306
6470
  );
5307
- const handleDepositFailed = useCallback4(
6471
+ const handleDepositFailed = useCallback7(
5308
6472
  (txHash, error) => {
5309
6473
  logFlowError("deposit:failed", error, { txHash });
5310
6474
  onLifecycleRef.current?.({ type: "failed", txHash, error });
5311
6475
  },
5312
6476
  [logFlowError, onLifecycleRef]
5313
6477
  );
5314
- const handleError = useCallback4(
6478
+ const handleError = useCallback7(
5315
6479
  (message, code) => {
5316
6480
  logFlowError("flow:error", message, { code });
5317
6481
  onErrorRef.current?.({ message, code });
5318
6482
  },
5319
6483
  [logFlowError, onErrorRef]
5320
6484
  );
5321
- const handleTotalBalanceComputed = useCallback4((total) => {
6485
+ const handleTotalBalanceComputed = useCallback7((total) => {
5322
6486
  setTotalBalanceUsd(total);
5323
6487
  }, []);
5324
- const walletOptionsKey = useMemo6(
6488
+ const walletOptionsKey = useMemo7(
5325
6489
  () => walletOptions.map((option) => option.id).join(","),
5326
6490
  [walletOptions]
5327
6491
  );
5328
- useEffect8(() => {
6492
+ useEffect10(() => {
5329
6493
  if (storeApi.getState().flow.mode) {
5330
6494
  return;
5331
6495
  }
@@ -5335,12 +6499,19 @@ function DepositFlow({
5335
6499
  storeApi.dispatch({ type: "flow/step-set", step: "connect" });
5336
6500
  }
5337
6501
  }, [walletOptionsKey]);
5338
- useEffect8(() => {
5339
- if (!showConnectStep && isConnectSelectionConfirmed && (flowMode === "wallet" || flowMode === "dapp-import") && !signerContext) {
6502
+ useEffect10(() => {
6503
+ if (!showConnectStep && isConnectSelectionConfirmed && (flowMode === "wallet" || flowMode === "dapp-import") && flowSlice.step !== "dapp-import-resolving" && !signerContext) {
5340
6504
  storeApi.dispatch({ type: "wallet/cleared" });
5341
6505
  }
5342
- }, [showConnectStep, isConnectSelectionConfirmed, flowMode, signerContext, storeApi]);
5343
- useEffect8(() => {
6506
+ }, [
6507
+ showConnectStep,
6508
+ isConnectSelectionConfirmed,
6509
+ flowMode,
6510
+ flowSlice.step,
6511
+ signerContext,
6512
+ storeApi
6513
+ ]);
6514
+ useEffect10(() => {
5344
6515
  if (enableSolana || flowMode !== "solana-wallet") {
5345
6516
  return;
5346
6517
  }
@@ -5349,14 +6520,15 @@ function DepositFlow({
5349
6520
  storeApi.dispatch({ type: "flow/step-set", step: "connect" });
5350
6521
  }
5351
6522
  }, [enableSolana, flowMode, storeApi]);
5352
- useEffect8(() => {
5353
- if (hasNavigatedBack || isConnectSelectionConfirmed || flowMode) {
6523
+ useEffect10(() => {
6524
+ if (hasNavigatedBack || isConnectSelectionConfirmed || flowMode || enableFiatOnramp || enableExchangeConnect || initialDappImportProvider) {
5354
6525
  return;
5355
6526
  }
5356
- if (!hasWalletOptions && dappAddress && !hasReownSession && !dappWalletClient && hasQrAutoAdvanceGraceElapsed) {
6527
+ if (enableQrTransfer && !hasWalletOptions && dappAddress && !hasReownSession && !dappWalletClient && hasQrAutoAdvanceGraceElapsed) {
5357
6528
  handleSelectTransferCrypto();
5358
6529
  }
5359
6530
  }, [
6531
+ enableQrTransfer,
5360
6532
  hasWalletOptions,
5361
6533
  hasReownSession,
5362
6534
  hasQrAutoAdvanceGraceElapsed,
@@ -5365,9 +6537,10 @@ function DepositFlow({
5365
6537
  hasNavigatedBack,
5366
6538
  dappAddress,
5367
6539
  dappWalletClient,
6540
+ initialDappImportProvider,
5368
6541
  handleSelectTransferCrypto
5369
6542
  ]);
5370
- const walletRows = useMemo6(() => {
6543
+ const walletRows = useMemo7(() => {
5371
6544
  return walletOptions.map((option) => {
5372
6545
  const ownerForRow = option.kind === "solana" ? dappAddress : option.address ?? null;
5373
6546
  const entry = readSetupForOwner(setupSlice, ownerForRow ?? null);
@@ -5383,32 +6556,35 @@ function DepositFlow({
5383
6556
  };
5384
6557
  });
5385
6558
  }, [walletOptions, setupSlice, dappAddress]);
5386
- const transferCryptoEntry = useMemo6(
6559
+ const transferCryptoEntry = useMemo7(
5387
6560
  () => readSetupForOwner(setupSlice, dappAddress),
5388
6561
  [setupSlice, dappAddress]
5389
6562
  );
5390
6563
  const transferCryptoState = transferCryptoEntry.status === "ready" ? "ready" : transferCryptoEntry.status === "error" ? "error" : "loading";
5391
- const handleRetrySetup = useCallback4(
6564
+ const handleRetrySetup = useCallback7(
5392
6565
  (owner) => {
5393
6566
  storeApi.dispatch({ type: "setup/retry-requested", owner });
5394
6567
  },
5395
6568
  [storeApi]
5396
6569
  );
5397
6570
  if (showConnectStep) {
5398
- return /* @__PURE__ */ jsx11("div", { className: "rs-modal-body", children: /* @__PURE__ */ jsx11(
6571
+ return /* @__PURE__ */ jsx18("div", { className: "rs-modal-body", children: /* @__PURE__ */ jsx18(
5399
6572
  ConnectStep,
5400
6573
  {
5401
6574
  walletRows,
5402
6575
  transferCryptoState: dappAddress ? transferCryptoState : void 0,
5403
6576
  transferCryptoErrorReason: dappAddress ? transferCryptoEntry.message ?? void 0 : void 0,
5404
- onSelectTransferCrypto: dappAddress ? () => {
6577
+ onSelectTransferCrypto: enableQrTransfer && dappAddress ? () => {
5405
6578
  if (transferCryptoState === "error") {
5406
6579
  handleRetrySetup(dappAddress);
5407
6580
  return;
5408
6581
  }
5409
- if (transferCryptoState !== "ready") return;
5410
6582
  handleSelectTransferCrypto();
5411
6583
  } : void 0,
6584
+ onSelectPayWithCard: enableFiatOnramp && dappAddress && (!fiatOnrampMethods || fiatOnrampMethods.length === 0) ? () => handleSelectFiatMethod() : void 0,
6585
+ fiatPaymentMethods: enableFiatOnramp && dappAddress ? fiatOnrampMethods : void 0,
6586
+ onSelectFiatMethod: enableFiatOnramp && dappAddress ? (method) => handleSelectFiatMethod(method) : void 0,
6587
+ onSelectFundFromExchange: enableExchangeConnect && dappAddress ? () => handleSelectExchange() : void 0,
5412
6588
  onRequestConnect,
5413
6589
  onConnect,
5414
6590
  onDisconnect,
@@ -5426,6 +6602,13 @@ function DepositFlow({
5426
6602
  },
5427
6603
  dappImports: connectStepDappImports,
5428
6604
  onSelectDappImport: (providerId) => {
6605
+ const availabilityEntry = dappImportOwner && dappImportAvailabilityOwner?.toLowerCase() === dappImportOwner.toLowerCase() ? dappImportAvailability[providerId] : void 0;
6606
+ if (availabilityEntry === "error") {
6607
+ storeApi.dispatch({
6608
+ type: "dapp-import/availability-retry-requested"
6609
+ });
6610
+ return;
6611
+ }
5429
6612
  const dappImportEntry = readSetupForOwner(
5430
6613
  setupSlice,
5431
6614
  dappImportOwner
@@ -5442,25 +6625,29 @@ function DepositFlow({
5442
6625
  }
5443
6626
  if (isDepositAddressMode) {
5444
6627
  if (!dappAddress) return null;
5445
- return /* @__PURE__ */ jsxs11("div", { className: "rs-modal-body", children: [
5446
- effectiveStep.type === "setup" && /* @__PURE__ */ jsx11(
6628
+ return /* @__PURE__ */ jsxs16("div", { className: "rs-modal-body", children: [
6629
+ effectiveStep.type === "setup" && (activeEntry.status === "error" ? /* @__PURE__ */ jsx18(
5447
6630
  AccountPreparingSkeleton,
5448
6631
  {
5449
- errorMessage: activeEntry.status === "error" ? activeEntry.message ?? void 0 : void 0,
5450
- onRetry: activeEntry.status === "error" ? () => handleRetrySetup(dappAddress) : void 0
6632
+ errorMessage: activeEntry.message ?? void 0,
6633
+ onRetry: () => handleRetrySetup(dappAddress)
5451
6634
  }
5452
- ),
5453
- effectiveStep.type === "deposit-address" && /* @__PURE__ */ jsx11(
6635
+ ) : /* @__PURE__ */ jsx18(
6636
+ DepositAddressSkeleton,
6637
+ {
6638
+ uiConfig,
6639
+ allowedRoutes
6640
+ }
6641
+ )),
6642
+ effectiveStep.type === "deposit-address" && /* @__PURE__ */ jsx18(
5454
6643
  DepositAddressStep,
5455
6644
  {
5456
6645
  smartAccount: effectiveStep.smartAccount,
5457
6646
  solanaDepositAddress: enableSolana ? effectiveStep.solanaDepositAddress : void 0,
5458
- isUpdating: activeEntry.status !== "ready",
5459
6647
  service,
5460
6648
  allowedRoutes,
5461
6649
  targetChain,
5462
6650
  targetToken,
5463
- waitForFinalTx,
5464
6651
  hasPostBridgeActions: Boolean(postBridgeActions?.length),
5465
6652
  uiConfig,
5466
6653
  onDepositSubmitted: handleDepositAddressSubmitted,
@@ -5483,19 +6670,145 @@ function DepositFlow({
5483
6670
  )
5484
6671
  ] });
5485
6672
  }
6673
+ if (isFiatOnrampMode) {
6674
+ if (!dappAddress) return null;
6675
+ return /* @__PURE__ */ jsxs16(
6676
+ "div",
6677
+ {
6678
+ className: "rs-modal-body",
6679
+ "data-flow-mode": "fiat-onramp",
6680
+ "data-step-type": step.type,
6681
+ children: [
6682
+ step.type === "setup" && /* @__PURE__ */ jsx18(
6683
+ AccountPreparingSkeleton,
6684
+ {
6685
+ errorMessage: activeEntry.status === "error" ? activeEntry.message ?? void 0 : void 0,
6686
+ onRetry: activeEntry.status === "error" ? () => handleRetrySetup(dappAddress) : void 0
6687
+ }
6688
+ ),
6689
+ step.type === "fiat-onramp" && /* @__PURE__ */ jsx18(
6690
+ FiatOnrampStep,
6691
+ {
6692
+ smartAccount: step.smartAccount,
6693
+ service,
6694
+ paymentMethod: step.paymentMethod,
6695
+ onSwappedComplete: handleSwappedComplete,
6696
+ onSwappedFailed: handleDepositFailed,
6697
+ onClose: onClose ?? (() => {
6698
+ }),
6699
+ onError: handleError
6700
+ }
6701
+ ),
6702
+ step.type === "processing" && /* @__PURE__ */ jsx18(
6703
+ ProcessingStep,
6704
+ {
6705
+ smartAccount: step.smartAccount,
6706
+ solanaDepositAddress: step.solanaDepositAddress,
6707
+ txHash: step.txHash,
6708
+ sourceChain: step.sourceChain,
6709
+ sourceToken: step.sourceToken,
6710
+ targetChain,
6711
+ targetToken,
6712
+ amount: step.amount,
6713
+ sourceSymbol: step.sourceSymbol,
6714
+ sourceDecimals: step.sourceDecimals,
6715
+ amountUsd: step.inputAmountUsd,
6716
+ hasPostBridgeActions: Boolean(postBridgeActions?.length),
6717
+ service,
6718
+ directTransfer: step.directTransfer,
6719
+ isSwappedOrder: true,
6720
+ onClose,
6721
+ onNewDeposit: handleNewDeposit,
6722
+ onDepositComplete: handleDepositComplete,
6723
+ onDepositFailed: handleDepositFailed,
6724
+ onError: handleError,
6725
+ debug
6726
+ }
6727
+ )
6728
+ ]
6729
+ }
6730
+ );
6731
+ }
6732
+ if (isExchangeConnectMode) {
6733
+ if (!dappAddress) return null;
6734
+ return /* @__PURE__ */ jsxs16(
6735
+ "div",
6736
+ {
6737
+ className: "rs-modal-body",
6738
+ "data-flow-mode": "exchange-connect",
6739
+ "data-step-type": step.type,
6740
+ children: [
6741
+ step.type === "setup" && /* @__PURE__ */ jsx18(
6742
+ AccountPreparingSkeleton,
6743
+ {
6744
+ errorMessage: activeEntry.status === "error" ? activeEntry.message ?? void 0 : void 0,
6745
+ onRetry: activeEntry.status === "error" ? () => handleRetrySetup(dappAddress) : void 0
6746
+ }
6747
+ ),
6748
+ step.type === "exchange-select" && /* @__PURE__ */ jsx18(
6749
+ ExchangeSelectStep,
6750
+ {
6751
+ service,
6752
+ onSelectExchange: handleSelectExchangeConnection,
6753
+ onError: handleError
6754
+ }
6755
+ ),
6756
+ step.type === "exchange-connect" && /* @__PURE__ */ jsx18(
6757
+ ExchangeConnectStep,
6758
+ {
6759
+ smartAccount: step.smartAccount,
6760
+ service,
6761
+ connection: step.connection,
6762
+ onSwappedComplete: handleSwappedComplete,
6763
+ onSwappedFailed: handleDepositFailed,
6764
+ onClose: onClose ?? (() => {
6765
+ }),
6766
+ onError: handleError
6767
+ }
6768
+ ),
6769
+ step.type === "processing" && /* @__PURE__ */ jsx18(
6770
+ ProcessingStep,
6771
+ {
6772
+ smartAccount: step.smartAccount,
6773
+ solanaDepositAddress: step.solanaDepositAddress,
6774
+ txHash: step.txHash,
6775
+ sourceChain: step.sourceChain,
6776
+ sourceToken: step.sourceToken,
6777
+ targetChain,
6778
+ targetToken,
6779
+ amount: step.amount,
6780
+ sourceSymbol: step.sourceSymbol,
6781
+ sourceDecimals: step.sourceDecimals,
6782
+ amountUsd: step.inputAmountUsd,
6783
+ hasPostBridgeActions: Boolean(postBridgeActions?.length),
6784
+ service,
6785
+ directTransfer: step.directTransfer,
6786
+ isSwappedOrder: true,
6787
+ onClose,
6788
+ onNewDeposit: handleNewDeposit,
6789
+ onDepositComplete: handleDepositComplete,
6790
+ onDepositFailed: handleDepositFailed,
6791
+ onError: handleError,
6792
+ debug
6793
+ }
6794
+ )
6795
+ ]
6796
+ }
6797
+ );
6798
+ }
5486
6799
  if (isSolanaWalletMode) {
5487
6800
  if (!dappAddress) return null;
5488
6801
  const solanaAddr = reownWallet?.solanaAddress;
5489
6802
  const solanaProvider = reownWallet?.solanaProvider;
5490
- return /* @__PURE__ */ jsxs11("div", { className: "rs-modal-body", children: [
5491
- effectiveStep.type === "setup" && /* @__PURE__ */ jsx11(
6803
+ return /* @__PURE__ */ jsxs16("div", { className: "rs-modal-body", children: [
6804
+ effectiveStep.type === "setup" && /* @__PURE__ */ jsx18(
5492
6805
  AccountPreparingSkeleton,
5493
6806
  {
5494
6807
  errorMessage: activeEntry.status === "error" ? activeEntry.message ?? void 0 : void 0,
5495
6808
  onRetry: activeEntry.status === "error" ? () => handleRetrySetup(dappAddress) : void 0
5496
6809
  }
5497
6810
  ),
5498
- effectiveStep.type === "solana-token-select" && solanaAddr && /* @__PURE__ */ jsx11(
6811
+ effectiveStep.type === "solana-token-select" && solanaAddr && /* @__PURE__ */ jsx18(
5499
6812
  SolanaTokenSelectStep,
5500
6813
  {
5501
6814
  solanaAddress: solanaAddr,
@@ -5509,7 +6822,7 @@ function DepositFlow({
5509
6822
  debug
5510
6823
  }
5511
6824
  ),
5512
- effectiveStep.type === "solana-amount" && /* @__PURE__ */ jsx11(
6825
+ effectiveStep.type === "solana-amount" && /* @__PURE__ */ jsx18(
5513
6826
  SolanaAmountStep,
5514
6827
  {
5515
6828
  token: effectiveStep.token,
@@ -5517,6 +6830,7 @@ function DepositFlow({
5517
6830
  balanceUsd: effectiveStep.balanceUsd,
5518
6831
  defaultAmount: effectiveStep.inputAmountUsd,
5519
6832
  uiConfig,
6833
+ targetChain,
5520
6834
  targetChainName: getChainName(targetChain),
5521
6835
  targetTokenSymbol: getTargetTokenSymbol(targetToken, targetChain),
5522
6836
  targetTokenIcon: getTokenIcon(
@@ -5527,7 +6841,7 @@ function DepositFlow({
5527
6841
  debug
5528
6842
  }
5529
6843
  ),
5530
- effectiveStep.type === "solana-confirm" && solanaAddr && solanaProvider ? /* @__PURE__ */ jsx11(
6844
+ effectiveStep.type === "solana-confirm" && solanaAddr && solanaProvider ? /* @__PURE__ */ jsx18(
5531
6845
  SolanaConfirmStep,
5532
6846
  {
5533
6847
  smartAccount: effectiveStep.smartAccount,
@@ -5548,16 +6862,16 @@ function DepositFlow({
5548
6862
  onError: handleError,
5549
6863
  debug
5550
6864
  }
5551
- ) : effectiveStep.type === "solana-confirm" ? /* @__PURE__ */ jsxs11("div", { className: "rs-step", children: [
5552
- /* @__PURE__ */ jsxs11("div", { className: "rs-loading-state", children: [
5553
- /* @__PURE__ */ jsx11("div", { className: "rs-step-icon rs-step-icon--error", children: /* @__PURE__ */ jsx11(
6865
+ ) : effectiveStep.type === "solana-confirm" ? /* @__PURE__ */ jsxs16("div", { className: "rs-step", children: [
6866
+ /* @__PURE__ */ jsxs16("div", { className: "rs-loading-state", children: [
6867
+ /* @__PURE__ */ jsx18("div", { className: "rs-step-icon rs-step-icon--error", children: /* @__PURE__ */ jsx18(
5554
6868
  "svg",
5555
6869
  {
5556
6870
  viewBox: "0 0 24 24",
5557
6871
  fill: "none",
5558
6872
  stroke: "currentColor",
5559
6873
  strokeWidth: "2",
5560
- children: /* @__PURE__ */ jsx11(
6874
+ children: /* @__PURE__ */ jsx18(
5561
6875
  "path",
5562
6876
  {
5563
6877
  strokeLinecap: "round",
@@ -5567,22 +6881,22 @@ function DepositFlow({
5567
6881
  )
5568
6882
  }
5569
6883
  ) }),
5570
- /* @__PURE__ */ jsxs11("div", { className: "rs-loading-text", children: [
5571
- /* @__PURE__ */ jsx11("div", { className: "rs-loading-title rs-text-error", children: "Wallet disconnected" }),
5572
- /* @__PURE__ */ jsx11("div", { className: "rs-loading-subtitle", children: "Please reconnect your Solana wallet to continue." })
6884
+ /* @__PURE__ */ jsxs16("div", { className: "rs-loading-text", children: [
6885
+ /* @__PURE__ */ jsx18("div", { className: "rs-loading-title rs-text-error", children: "Wallet disconnected" }),
6886
+ /* @__PURE__ */ jsx18("div", { className: "rs-loading-subtitle", children: "Please reconnect your Solana wallet to continue." })
5573
6887
  ] })
5574
6888
  ] }),
5575
- /* @__PURE__ */ jsx11("div", { className: "rs-step-footer", children: /* @__PURE__ */ jsx11(
6889
+ /* @__PURE__ */ jsx18("div", { className: "rs-step-footer", children: /* @__PURE__ */ jsx18(
5576
6890
  "button",
5577
6891
  {
5578
6892
  type: "button",
5579
6893
  className: "rs-button rs-button--default rs-button--full-width",
5580
6894
  onClick: handleBack,
5581
- children: /* @__PURE__ */ jsx11("span", { children: "Go Back" })
6895
+ children: /* @__PURE__ */ jsx18("span", { children: "Go Back" })
5582
6896
  }
5583
6897
  ) })
5584
6898
  ] }) : null,
5585
- effectiveStep.type === "processing" && /* @__PURE__ */ jsx11(
6899
+ effectiveStep.type === "processing" && /* @__PURE__ */ jsx18(
5586
6900
  ProcessingStep,
5587
6901
  {
5588
6902
  smartAccount: effectiveStep.smartAccount,
@@ -5595,7 +6909,7 @@ function DepositFlow({
5595
6909
  amount: effectiveStep.amount,
5596
6910
  sourceSymbol: effectiveStep.sourceSymbol,
5597
6911
  sourceDecimals: effectiveStep.sourceDecimals,
5598
- waitForFinalTx,
6912
+ amountUsd: effectiveStep.inputAmountUsd,
5599
6913
  hasPostBridgeActions: Boolean(postBridgeActions?.length),
5600
6914
  service,
5601
6915
  directTransfer: effectiveStep.directTransfer,
@@ -5609,8 +6923,26 @@ function DepositFlow({
5609
6923
  )
5610
6924
  ] });
5611
6925
  }
6926
+ if (isDappImportMode && effectiveStep.type === "dapp-import-resolving") {
6927
+ return /* @__PURE__ */ jsx18(
6928
+ "div",
6929
+ {
6930
+ className: "rs-modal-body",
6931
+ "data-flow-mode": "dapp-import",
6932
+ "data-step-type": effectiveStep.type,
6933
+ children: /* @__PURE__ */ jsx18(
6934
+ DappImportAssetSelectSkeleton,
6935
+ {
6936
+ sourceLabel: activeDappImportProvider?.sourceLabel ?? "",
6937
+ error: dappImportBootError,
6938
+ onRetry: handleBootRetry
6939
+ }
6940
+ )
6941
+ }
6942
+ );
6943
+ }
5612
6944
  if (!signerContext?.walletClient || !signerContext?.publicClient) {
5613
- 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..." }) }) }) }) });
6945
+ return /* @__PURE__ */ jsx18("div", { className: "rs-modal-body", children: /* @__PURE__ */ jsx18("div", { className: "rs-step", children: /* @__PURE__ */ jsx18("div", { className: "rs-loading-state", children: /* @__PURE__ */ jsx18("div", { className: "rs-loading-text", children: /* @__PURE__ */ jsx18("div", { className: "rs-loading-title", children: "Connecting wallet\u2026" }) }) }) }) });
5614
6946
  }
5615
6947
  const ownerAddress = signerContext.ownerAddress;
5616
6948
  const ownerChainId = signerContext.walletClient?.chain?.id ?? signerContext.publicClient.chain?.id ?? setupChainId;
@@ -5620,15 +6952,15 @@ function DepositFlow({
5620
6952
  }
5621
6953
  return getPublicClient(chainId);
5622
6954
  };
5623
- return /* @__PURE__ */ jsxs11("div", { className: "rs-modal-body", children: [
5624
- effectiveStep.type === "setup" && /* @__PURE__ */ jsx11(
6955
+ return /* @__PURE__ */ jsxs16("div", { className: "rs-modal-body", children: [
6956
+ effectiveStep.type === "setup" && /* @__PURE__ */ jsx18(
5625
6957
  AccountPreparingSkeleton,
5626
6958
  {
5627
6959
  errorMessage: activeEntry.status === "error" ? activeEntry.message ?? void 0 : void 0,
5628
6960
  onRetry: activeEntry.status === "error" ? () => handleRetrySetup(ownerAddress) : void 0
5629
6961
  }
5630
6962
  ),
5631
- effectiveStep.type === "select-asset" && /* @__PURE__ */ jsx11(
6963
+ effectiveStep.type === "select-asset" && /* @__PURE__ */ jsx18(
5632
6964
  AssetSelectStep,
5633
6965
  {
5634
6966
  address: ownerAddress,
@@ -5646,15 +6978,15 @@ function DepositFlow({
5646
6978
  } : void 0
5647
6979
  }
5648
6980
  ),
5649
- effectiveStep.type === "dapp-import-asset-select" && activeDappImportProvider && activeDappImportAvailability && /* @__PURE__ */ jsx11(
6981
+ effectiveStep.type === "dapp-import-asset-select" && activeDappImportProvider && activeDappImportAvailability && /* @__PURE__ */ jsx18(
5650
6982
  DappImportAssetSelectStep,
5651
6983
  {
5652
- sourceLabel: activeDappImportAvailability.assets[0]?.sourceLabel ?? activeDappImportProvider.label,
6984
+ sourceLabel: activeDappImportAvailability.assets[0]?.sourceLabel ?? activeDappImportProvider.sourceLabel,
5653
6985
  assets: activeDappImportAvailability.assets,
5654
6986
  onSelect: handleDappImportAssetSelected
5655
6987
  }
5656
6988
  ),
5657
- effectiveStep.type === "amount" && /* @__PURE__ */ jsx11(
6989
+ effectiveStep.type === "amount" && /* @__PURE__ */ jsx18(
5658
6990
  AmountStep,
5659
6991
  {
5660
6992
  walletClient: signerContext.walletClient,
@@ -5666,7 +6998,7 @@ function DepositFlow({
5666
6998
  chainId: effectiveStep.asset.depositChainId,
5667
6999
  token: effectiveStep.asset.depositToken
5668
7000
  } : void 0,
5669
- defaultAmount: effectiveStep.amount ?? defaultAmount,
7001
+ defaultAmount: effectiveStep.inputAmountUsd ?? defaultAmount,
5670
7002
  switchChain: signerContext.switchChain,
5671
7003
  targetChain,
5672
7004
  targetToken,
@@ -5686,7 +7018,7 @@ function DepositFlow({
5686
7018
  }
5687
7019
  }
5688
7020
  ),
5689
- effectiveStep.type === "confirm" && /* @__PURE__ */ jsx11(
7021
+ effectiveStep.type === "confirm" && /* @__PURE__ */ jsx18(
5690
7022
  ConfirmStep,
5691
7023
  {
5692
7024
  walletClient: signerContext.walletClient,
@@ -5703,6 +7035,7 @@ function DepositFlow({
5703
7035
  switchChain: signerContext.switchChain,
5704
7036
  liquidityWarning: effectiveStep.liquidityWarning,
5705
7037
  uiConfig,
7038
+ service,
5706
7039
  executeTransfer: isDappImportMode && activeDappImportProvider && isDappImportAsset(effectiveStep.asset) ? async (amountUnits) => {
5707
7040
  const result = await activeDappImportProvider.executeTransfer(
5708
7041
  {
@@ -5726,7 +7059,7 @@ function DepositFlow({
5726
7059
  onError: handleError
5727
7060
  }
5728
7061
  ),
5729
- effectiveStep.type === "processing" && /* @__PURE__ */ jsx11(
7062
+ effectiveStep.type === "processing" && /* @__PURE__ */ jsx18(
5730
7063
  ProcessingStep,
5731
7064
  {
5732
7065
  smartAccount: effectiveStep.smartAccount,
@@ -5739,7 +7072,7 @@ function DepositFlow({
5739
7072
  amount: effectiveStep.amount,
5740
7073
  sourceSymbol: effectiveStep.sourceSymbol,
5741
7074
  sourceDecimals: effectiveStep.sourceDecimals,
5742
- waitForFinalTx,
7075
+ amountUsd: effectiveStep.inputAmountUsd,
5743
7076
  hasPostBridgeActions: Boolean(postBridgeActions?.length),
5744
7077
  service,
5745
7078
  directTransfer: effectiveStep.directTransfer,
@@ -5757,8 +7090,8 @@ function DepositFlow({
5757
7090
  }
5758
7091
 
5759
7092
  // src/components/history/DepositHistoryPanel.tsx
5760
- import { useCallback as useCallback5, useMemo as useMemo7, useState as useState10 } from "react";
5761
- import { jsx as jsx12, jsxs as jsxs12 } from "react/jsx-runtime";
7093
+ import { useCallback as useCallback8, useMemo as useMemo8, useState as useState12 } from "react";
7094
+ import { jsx as jsx19, jsxs as jsxs17 } from "react/jsx-runtime";
5762
7095
  function shortenHash(hash) {
5763
7096
  if (hash.length <= 14) return hash;
5764
7097
  return `${hash.slice(0, 6)}\u2026${hash.slice(-4)}`;
@@ -5868,7 +7201,7 @@ function DepositHistoryPanel({
5868
7201
  onClose,
5869
7202
  onCloseModal
5870
7203
  }) {
5871
- const handleKeyDown = useCallback5(
7204
+ const handleKeyDown = useCallback8(
5872
7205
  (e) => {
5873
7206
  if (e.key === "Escape") {
5874
7207
  e.stopPropagation();
@@ -5877,7 +7210,7 @@ function DepositHistoryPanel({
5877
7210
  },
5878
7211
  [onClose]
5879
7212
  );
5880
- const visibleDeposits = useMemo7(() => {
7213
+ const visibleDeposits = useMemo8(() => {
5881
7214
  const sourceHashes = new Set(
5882
7215
  deposits.map((d) => d.sourceTxHash?.toLowerCase()).filter((h) => Boolean(h))
5883
7216
  );
@@ -5885,7 +7218,7 @@ function DepositHistoryPanel({
5885
7218
  (d) => !(d.txHash && sourceHashes.has(d.txHash.toLowerCase()))
5886
7219
  );
5887
7220
  }, [deposits]);
5888
- return /* @__PURE__ */ jsxs12(
7221
+ return /* @__PURE__ */ jsxs17(
5889
7222
  "div",
5890
7223
  {
5891
7224
  className: "rs-history-panel",
@@ -5893,55 +7226,55 @@ function DepositHistoryPanel({
5893
7226
  "aria-label": "Deposit history",
5894
7227
  onKeyDown: handleKeyDown,
5895
7228
  children: [
5896
- /* @__PURE__ */ jsxs12("div", { className: "rs-modal-header--redesigned", children: [
5897
- /* @__PURE__ */ jsx12("div", { className: "rs-modal-header-nav-left", children: /* @__PURE__ */ jsx12(
7229
+ /* @__PURE__ */ jsxs17("div", { className: "rs-modal-header--redesigned", children: [
7230
+ /* @__PURE__ */ jsx19("div", { className: "rs-modal-header-nav-left", children: /* @__PURE__ */ jsx19(
5898
7231
  "button",
5899
7232
  {
5900
7233
  type: "button",
5901
7234
  className: "rs-modal-header-back",
5902
7235
  "aria-label": "Back",
5903
7236
  onClick: onClose,
5904
- children: /* @__PURE__ */ jsx12(ChevronLeftIcon, {})
7237
+ children: /* @__PURE__ */ jsx19(ChevronLeftIcon, {})
5905
7238
  }
5906
7239
  ) }),
5907
- /* @__PURE__ */ jsx12("div", { className: "rs-modal-header-nav-right", children: onCloseModal && /* @__PURE__ */ jsx12(
7240
+ /* @__PURE__ */ jsx19("div", { className: "rs-modal-header-nav-right", children: onCloseModal && /* @__PURE__ */ jsx19(
5908
7241
  "button",
5909
7242
  {
5910
7243
  type: "button",
5911
7244
  className: "rs-modal-close",
5912
7245
  "aria-label": "Close",
5913
7246
  onClick: onCloseModal,
5914
- children: /* @__PURE__ */ jsx12(CloseIcon, {})
7247
+ children: /* @__PURE__ */ jsx19(CloseIcon, {})
5915
7248
  }
5916
7249
  ) })
5917
7250
  ] }),
5918
- /* @__PURE__ */ jsxs12("div", { className: "rs-history-screen", children: [
5919
- /* @__PURE__ */ jsxs12("div", { className: "rs-history-screen-body", children: [
5920
- /* @__PURE__ */ jsx12(BodyHeader, { icon: /* @__PURE__ */ jsx12(HistoryIcon, {}), title: "History" }),
5921
- isLoading && deposits.length === 0 && /* @__PURE__ */ jsxs12("div", { className: "rs-history-empty", children: [
5922
- /* @__PURE__ */ jsx12("span", { className: "rs-history-empty-glyph", "aria-hidden": "true", children: /* @__PURE__ */ jsx12(HistoryIcon, {}) }),
5923
- /* @__PURE__ */ jsxs12("div", { className: "rs-history-empty-text", children: [
5924
- /* @__PURE__ */ jsx12(Spinner, { className: "rs-spinner--sm" }),
5925
- /* @__PURE__ */ jsx12("span", { className: "rs-history-empty-hint", children: "Loading history\u2026" })
7251
+ /* @__PURE__ */ jsxs17("div", { className: "rs-history-screen", children: [
7252
+ /* @__PURE__ */ jsxs17("div", { className: "rs-history-screen-body", children: [
7253
+ /* @__PURE__ */ jsx19(BodyHeader, { icon: /* @__PURE__ */ jsx19(HistoryIcon, {}), title: "History" }),
7254
+ isLoading && deposits.length === 0 && /* @__PURE__ */ jsxs17("div", { className: "rs-history-empty", children: [
7255
+ /* @__PURE__ */ jsx19("span", { className: "rs-history-empty-glyph", "aria-hidden": "true", children: /* @__PURE__ */ jsx19(HistoryIcon, {}) }),
7256
+ /* @__PURE__ */ jsxs17("div", { className: "rs-history-empty-text", children: [
7257
+ /* @__PURE__ */ jsx19(Spinner, { className: "rs-spinner--sm" }),
7258
+ /* @__PURE__ */ jsx19("span", { className: "rs-history-empty-hint", children: "Loading history\u2026" })
5926
7259
  ] })
5927
7260
  ] }),
5928
- error && !isLoading && /* @__PURE__ */ jsxs12("div", { className: "rs-history-empty", children: [
5929
- /* @__PURE__ */ jsx12("span", { className: "rs-history-empty-glyph", "aria-hidden": "true", children: /* @__PURE__ */ jsx12(AlertTriangleIcon, {}) }),
5930
- /* @__PURE__ */ jsxs12("div", { className: "rs-history-empty-text", children: [
5931
- /* @__PURE__ */ jsx12("span", { className: "rs-history-empty-title", children: "Couldn't load history" }),
5932
- /* @__PURE__ */ jsx12("span", { className: "rs-history-empty-hint", children: error })
7261
+ error && !isLoading && /* @__PURE__ */ jsxs17("div", { className: "rs-history-empty", children: [
7262
+ /* @__PURE__ */ jsx19("span", { className: "rs-history-empty-glyph", "aria-hidden": "true", children: /* @__PURE__ */ jsx19(AlertTriangleIcon, {}) }),
7263
+ /* @__PURE__ */ jsxs17("div", { className: "rs-history-empty-text", children: [
7264
+ /* @__PURE__ */ jsx19("span", { className: "rs-history-empty-title", children: "Couldn't load history" }),
7265
+ /* @__PURE__ */ jsx19("span", { className: "rs-history-empty-hint", children: error })
5933
7266
  ] })
5934
7267
  ] }),
5935
- !isLoading && !error && visibleDeposits.length === 0 && /* @__PURE__ */ jsxs12("div", { className: "rs-history-empty", children: [
5936
- /* @__PURE__ */ jsx12("span", { className: "rs-history-empty-glyph", "aria-hidden": "true", children: /* @__PURE__ */ jsx12(HistoryIcon, {}) }),
5937
- /* @__PURE__ */ jsxs12("div", { className: "rs-history-empty-text", children: [
5938
- /* @__PURE__ */ jsx12("span", { className: "rs-history-empty-title", children: "No deposits yet" }),
5939
- /* @__PURE__ */ jsx12("span", { className: "rs-history-empty-hint", children: "Your deposit history will appear here" })
7268
+ !isLoading && !error && visibleDeposits.length === 0 && /* @__PURE__ */ jsxs17("div", { className: "rs-history-empty", children: [
7269
+ /* @__PURE__ */ jsx19("span", { className: "rs-history-empty-glyph", "aria-hidden": "true", children: /* @__PURE__ */ jsx19(HistoryIcon, {}) }),
7270
+ /* @__PURE__ */ jsxs17("div", { className: "rs-history-empty-text", children: [
7271
+ /* @__PURE__ */ jsx19("span", { className: "rs-history-empty-title", children: "No deposits yet" }),
7272
+ /* @__PURE__ */ jsx19("span", { className: "rs-history-empty-hint", children: "Your deposit history will appear here" })
5940
7273
  ] })
5941
7274
  ] }),
5942
- visibleDeposits.length > 0 && /* @__PURE__ */ jsxs12("div", { className: "rs-history-list", children: [
5943
- visibleDeposits.map((deposit, i) => /* @__PURE__ */ jsx12(HistoryCard, { deposit }, deposit.txHash || i)),
5944
- hasMore && /* @__PURE__ */ jsx12(
7275
+ visibleDeposits.length > 0 && /* @__PURE__ */ jsxs17("div", { className: "rs-history-list", children: [
7276
+ visibleDeposits.map((deposit, i) => /* @__PURE__ */ jsx19(HistoryCard, { deposit }, deposit.txHash || i)),
7277
+ hasMore && /* @__PURE__ */ jsx19(
5945
7278
  "button",
5946
7279
  {
5947
7280
  type: "button",
@@ -5953,14 +7286,14 @@ function DepositHistoryPanel({
5953
7286
  )
5954
7287
  ] })
5955
7288
  ] }),
5956
- /* @__PURE__ */ jsx12(PoweredBy, {})
7289
+ /* @__PURE__ */ jsx19(PoweredBy, {})
5957
7290
  ] })
5958
7291
  ]
5959
7292
  }
5960
7293
  );
5961
7294
  }
5962
7295
  function HistoryCard({ deposit }) {
5963
- const [expanded, setExpanded] = useState10(false);
7296
+ const [expanded, setExpanded] = useState12(false);
5964
7297
  const status = normalizeStatus(deposit.status, deposit.isSpam);
5965
7298
  const sourceChainId = resolveChainId(deposit.chain);
5966
7299
  const targetChainId = resolveChainId(deposit.targetChain);
@@ -5979,7 +7312,7 @@ function HistoryCard({ deposit }) {
5979
7312
  const date = deposit.createdAt ? formatDate(deposit.createdAt) : null;
5980
7313
  const txTypeLabel = `Deposit${sourceSymbol ? ` ${sourceSymbol}` : ""}`;
5981
7314
  const srcTxUrl = deposit.sourceTxHash ? getTxExplorerUrl(deposit.sourceTxHash, sourceChainId) : null;
5982
- return /* @__PURE__ */ jsxs12(
7315
+ return /* @__PURE__ */ jsxs17(
5983
7316
  "button",
5984
7317
  {
5985
7318
  type: "button",
@@ -5987,38 +7320,38 @@ function HistoryCard({ deposit }) {
5987
7320
  onClick: () => setExpanded((v) => !v),
5988
7321
  "aria-expanded": expanded,
5989
7322
  children: [
5990
- /* @__PURE__ */ jsxs12("div", { className: "rs-history-card-row", children: [
5991
- /* @__PURE__ */ jsxs12("div", { className: "rs-history-card-icons", children: [
5992
- /* @__PURE__ */ jsx12("span", { className: "rs-history-card-token", children: sourceTokenIcon ? /* @__PURE__ */ jsx12("img", { src: sourceTokenIcon, alt: "" }) : sourceSymbol.slice(0, 2) }),
5993
- sourceChainIcon && /* @__PURE__ */ jsx12("span", { className: "rs-history-card-chain", children: /* @__PURE__ */ jsx12("img", { src: sourceChainIcon, alt: "" }) })
7323
+ /* @__PURE__ */ jsxs17("div", { className: "rs-history-card-row", children: [
7324
+ /* @__PURE__ */ jsxs17("div", { className: "rs-history-card-icons", children: [
7325
+ /* @__PURE__ */ jsx19("span", { className: "rs-history-card-token", children: sourceTokenIcon ? /* @__PURE__ */ jsx19("img", { src: sourceTokenIcon, alt: "" }) : sourceSymbol.slice(0, 2) }),
7326
+ sourceChainIcon && /* @__PURE__ */ jsx19("span", { className: "rs-history-card-chain", children: /* @__PURE__ */ jsx19("img", { src: sourceChainIcon, alt: "" }) })
5994
7327
  ] }),
5995
- /* @__PURE__ */ jsxs12("div", { className: "rs-history-card-text", children: [
5996
- /* @__PURE__ */ jsx12("span", { className: "rs-history-card-title", children: txTypeLabel }),
5997
- date && /* @__PURE__ */ jsx12("span", { className: "rs-history-card-date", children: date })
7328
+ /* @__PURE__ */ jsxs17("div", { className: "rs-history-card-text", children: [
7329
+ /* @__PURE__ */ jsx19("span", { className: "rs-history-card-title", children: txTypeLabel }),
7330
+ date && /* @__PURE__ */ jsx19("span", { className: "rs-history-card-date", children: date })
5998
7331
  ] }),
5999
- /* @__PURE__ */ jsxs12("div", { className: "rs-history-card-side", children: [
6000
- /* @__PURE__ */ jsx12("span", { className: "rs-history-card-amount", children: displayAmount }),
6001
- /* @__PURE__ */ jsx12("span", { className: `rs-history-badge rs-history-badge--${status}`, children: STATUS_LABEL[status] })
7332
+ /* @__PURE__ */ jsxs17("div", { className: "rs-history-card-side", children: [
7333
+ /* @__PURE__ */ jsx19("span", { className: "rs-history-card-amount", children: displayAmount }),
7334
+ /* @__PURE__ */ jsx19("span", { className: `rs-history-badge rs-history-badge--${status}`, children: STATUS_LABEL[status] })
6002
7335
  ] })
6003
7336
  ] }),
6004
- expanded && /* @__PURE__ */ jsxs12("div", { className: "rs-history-card-details", children: [
6005
- sourceChainName && /* @__PURE__ */ jsxs12("div", { className: "rs-amount-detail-row", children: [
6006
- /* @__PURE__ */ jsx12("span", { children: "Source chain" }),
6007
- /* @__PURE__ */ jsxs12("span", { className: "rs-amount-detail-value", children: [
6008
- /* @__PURE__ */ jsx12("span", { children: sourceChainName }),
6009
- sourceChainIcon && /* @__PURE__ */ jsx12("span", { className: "rs-amount-detail-icon", children: /* @__PURE__ */ jsx12("img", { src: sourceChainIcon, alt: "" }) })
7337
+ /* @__PURE__ */ jsx19("div", { className: "rs-history-card-panel", children: /* @__PURE__ */ jsx19("div", { className: "rs-history-card-panel-inner", children: /* @__PURE__ */ jsxs17("div", { className: "rs-history-card-details", children: [
7338
+ sourceChainName && /* @__PURE__ */ jsxs17("div", { className: "rs-amount-detail-row", children: [
7339
+ /* @__PURE__ */ jsx19("span", { children: "Source chain" }),
7340
+ /* @__PURE__ */ jsxs17("span", { className: "rs-amount-detail-value", children: [
7341
+ /* @__PURE__ */ jsx19("span", { children: sourceChainName }),
7342
+ sourceChainIcon && /* @__PURE__ */ jsx19("span", { className: "rs-amount-detail-icon", children: /* @__PURE__ */ jsx19("img", { src: sourceChainIcon, alt: "" }) })
6010
7343
  ] })
6011
7344
  ] }),
6012
- targetChainName && /* @__PURE__ */ jsxs12("div", { className: "rs-amount-detail-row", children: [
6013
- /* @__PURE__ */ jsx12("span", { children: "Destination chain" }),
6014
- /* @__PURE__ */ jsxs12("span", { className: "rs-amount-detail-value", children: [
6015
- /* @__PURE__ */ jsx12("span", { children: targetChainName }),
6016
- targetChainIcon && /* @__PURE__ */ jsx12("span", { className: "rs-amount-detail-icon", children: /* @__PURE__ */ jsx12("img", { src: targetChainIcon, alt: "" }) })
7345
+ targetChainName && /* @__PURE__ */ jsxs17("div", { className: "rs-amount-detail-row", children: [
7346
+ /* @__PURE__ */ jsx19("span", { children: "Destination chain" }),
7347
+ /* @__PURE__ */ jsxs17("span", { className: "rs-amount-detail-value", children: [
7348
+ /* @__PURE__ */ jsx19("span", { children: targetChainName }),
7349
+ targetChainIcon && /* @__PURE__ */ jsx19("span", { className: "rs-amount-detail-icon", children: /* @__PURE__ */ jsx19("img", { src: targetChainIcon, alt: "" }) })
6017
7350
  ] })
6018
7351
  ] }),
6019
- srcTxUrl && deposit.sourceTxHash && /* @__PURE__ */ jsxs12("div", { className: "rs-amount-detail-row", children: [
6020
- /* @__PURE__ */ jsx12("span", { children: "Transaction details" }),
6021
- /* @__PURE__ */ jsxs12(
7352
+ srcTxUrl && deposit.sourceTxHash && /* @__PURE__ */ jsxs17("div", { className: "rs-amount-detail-row", children: [
7353
+ /* @__PURE__ */ jsx19("span", { children: "Transaction details" }),
7354
+ /* @__PURE__ */ jsxs17(
6022
7355
  "a",
6023
7356
  {
6024
7357
  href: srcTxUrl,
@@ -6027,13 +7360,13 @@ function HistoryCard({ deposit }) {
6027
7360
  className: "rs-history-card-link",
6028
7361
  onClick: (e) => e.stopPropagation(),
6029
7362
  children: [
6030
- /* @__PURE__ */ jsx12("span", { children: shortenHash(deposit.sourceTxHash) }),
6031
- /* @__PURE__ */ jsx12(ArrowUpRightIcon, {})
7363
+ /* @__PURE__ */ jsx19("span", { children: shortenHash(deposit.sourceTxHash) }),
7364
+ /* @__PURE__ */ jsx19(ArrowUpRightIcon, {})
6032
7365
  ]
6033
7366
  }
6034
7367
  )
6035
7368
  ] })
6036
- ] })
7369
+ ] }) }) })
6037
7370
  ]
6038
7371
  }
6039
7372
  );
@@ -6041,9 +7374,9 @@ function HistoryCard({ deposit }) {
6041
7374
  DepositHistoryPanel.displayName = "DepositHistoryPanel";
6042
7375
 
6043
7376
  // src/DepositModal.tsx
6044
- import { jsx as jsx13, jsxs as jsxs13 } from "react/jsx-runtime";
7377
+ import { jsx as jsx20, jsxs as jsxs18 } from "react/jsx-runtime";
6045
7378
  var ReownDepositInner = lazy2(
6046
- () => import("./DepositModalReown-I7I3KLD2.mjs").then((m) => ({ default: m.DepositModalReown }))
7379
+ () => import("./DepositModalReown-G7UX4IBZ.mjs").then((m) => ({ default: m.DepositModalReown }))
6047
7380
  );
6048
7381
  function sortByCreatedAtDesc(items) {
6049
7382
  return [...items].sort((a, b) => {
@@ -6059,7 +7392,7 @@ function DepositModal(props) {
6059
7392
  "dappWalletClient"
6060
7393
  );
6061
7394
  if (needsReown) {
6062
- return /* @__PURE__ */ jsx13(Suspense2, { fallback: null, children: /* @__PURE__ */ jsx13(
7395
+ return /* @__PURE__ */ jsx20(Suspense2, { fallback: null, children: /* @__PURE__ */ jsx20(
6063
7396
  ReownDepositInner,
6064
7397
  {
6065
7398
  ...props,
@@ -6067,7 +7400,7 @@ function DepositModal(props) {
6067
7400
  }
6068
7401
  ) });
6069
7402
  }
6070
- return /* @__PURE__ */ jsx13(
7403
+ return /* @__PURE__ */ jsx20(
6071
7404
  DepositModalInner,
6072
7405
  {
6073
7406
  ...props,
@@ -6097,9 +7430,13 @@ function DepositModalInner({
6097
7430
  signerAddress = DEFAULT_SIGNER_ADDRESS,
6098
7431
  sessionChainIds,
6099
7432
  forceRegister = false,
6100
- waitForFinalTx = true,
6101
7433
  enableSolana = true,
6102
7434
  dappImports,
7435
+ initialDappImport,
7436
+ enableFiatOnramp = false,
7437
+ enableQrTransfer = true,
7438
+ fiatOnrampMethods,
7439
+ enableExchangeConnect = false,
6103
7440
  postBridgeActions,
6104
7441
  outputTokenRules,
6105
7442
  rejectUnmapped,
@@ -6117,61 +7454,86 @@ function DepositModalInner({
6117
7454
  onError,
6118
7455
  debug
6119
7456
  }) {
6120
- const modalRef = useRef8(null);
7457
+ const modalRef = useRef9(null);
6121
7458
  const onReadyRef = useLatestRef(onReady);
6122
- const [currentScreen, setCurrentScreen] = useState11("connect");
6123
- const [backHandler, setBackHandler] = useState11(
7459
+ const [currentScreen, setCurrentScreen] = useState13("connect");
7460
+ const [backHandler, setBackHandler] = useState13(
6124
7461
  void 0
6125
7462
  );
6126
7463
  const showHistoryButton = uiConfig?.showHistoryButton ?? false;
6127
7464
  const historyButtonVisible = showHistoryButton && (currentScreen === "select-asset" || currentScreen === "deposit-address");
6128
- const [historyOpen, setHistoryOpen] = useState11(false);
6129
- const [historyDeposits, setHistoryDeposits] = useState11([]);
6130
- const [hasMoreHistory, setHasMoreHistory] = useState11(false);
6131
- const [historyLoading, setHistoryLoading] = useState11(false);
6132
- const [historyLoadingMore, setHistoryLoadingMore] = useState11(false);
6133
- const [historyError, setHistoryError] = useState11(null);
6134
- const cursorRef = useRef8(null);
6135
- const historyStaleRef = useRef8(false);
6136
- const historyLoadedRef = useRef8(false);
7465
+ const [historyOpen, setHistoryOpen] = useState13(false);
7466
+ const [historyDeposits, setHistoryDeposits] = useState13([]);
7467
+ const [hasMoreHistory, setHasMoreHistory] = useState13(false);
7468
+ const [historyLoading, setHistoryLoading] = useState13(false);
7469
+ const [historyLoadingMore, setHistoryLoadingMore] = useState13(false);
7470
+ const [historyError, setHistoryError] = useState13(null);
7471
+ const cursorRef = useRef9(null);
7472
+ const historyStaleRef = useRef9(false);
7473
+ const historyLoadedRef = useRef9(false);
6137
7474
  const targetChain = targetChainProp === "solana" ? "solana" : getChainId(targetChainProp);
6138
7475
  const sourceChain = sourceChainProp ? getChainId(sourceChainProp) : void 0;
6139
- const service = useMemo8(
7476
+ const [recipientIsContract, setRecipientIsContract] = useState13(false);
7477
+ const onErrorRef = useLatestRef(onError);
7478
+ useEffect11(() => {
7479
+ if (targetChain !== HYPERCORE_CHAIN_ID || !isAddress(recipient, { strict: false })) {
7480
+ setRecipientIsContract(false);
7481
+ return;
7482
+ }
7483
+ let cancelled = false;
7484
+ getHyperEvmReadClient().getCode({ address: recipient }).then((code) => {
7485
+ if (cancelled) return;
7486
+ const isContract = isContractBytecode(code);
7487
+ setRecipientIsContract(isContract);
7488
+ if (isContract) {
7489
+ onErrorRef.current?.({
7490
+ message: "HyperCore deposits require an EOA recipient; the configured recipient is a smart contract.",
7491
+ code: "HYPERCORE_RECIPIENT_NOT_EOA"
7492
+ });
7493
+ }
7494
+ }).catch(() => {
7495
+ if (!cancelled) setRecipientIsContract(false);
7496
+ });
7497
+ return () => {
7498
+ cancelled = true;
7499
+ };
7500
+ }, [targetChain, recipient, onErrorRef]);
7501
+ const service = useMemo9(
6140
7502
  () => createDepositService(backendUrl, {
6141
7503
  debug,
6142
7504
  debugScope: "service:deposit"
6143
7505
  }),
6144
7506
  [backendUrl, debug]
6145
7507
  );
6146
- const store = useMemo8(
7508
+ const store = useMemo9(
6147
7509
  () => createDepositStore({ targetChain, targetToken }),
6148
7510
  // eslint-disable-next-line react-hooks/exhaustive-deps
6149
7511
  []
6150
7512
  );
6151
- useEffect9(() => {
7513
+ useEffect11(() => {
6152
7514
  store.dispatch({ type: "target/changed", targetChain, targetToken });
6153
7515
  }, [store, targetChain, targetToken]);
6154
- useEffect9(() => {
7516
+ useEffect11(() => {
6155
7517
  if (isOpen && modalRef.current) {
6156
7518
  applyTheme(modalRef.current, theme);
6157
7519
  }
6158
7520
  }, [isOpen, theme]);
6159
- useEffect9(() => {
7521
+ useEffect11(() => {
6160
7522
  configureSolanaRpcUrl(solanaRpcUrl);
6161
7523
  }, [solanaRpcUrl]);
6162
- useEffect9(() => {
7524
+ useEffect11(() => {
6163
7525
  if (isOpen) {
6164
7526
  onReadyRef.current?.();
6165
7527
  }
6166
7528
  }, [isOpen, onReadyRef]);
6167
- const handleStepChange = useCallback6(
7529
+ const handleStepChange = useCallback9(
6168
7530
  (onBack, screen) => {
6169
7531
  setBackHandler(() => onBack);
6170
7532
  if (screen) setCurrentScreen(screen);
6171
7533
  },
6172
7534
  []
6173
7535
  );
6174
- const fetchHistory = useCallback6(
7536
+ const fetchHistory = useCallback9(
6175
7537
  async (mode = "initial") => {
6176
7538
  if (!recipient) return;
6177
7539
  const isInitial = mode === "initial";
@@ -6219,26 +7581,26 @@ function DepositModalInner({
6219
7581
  },
6220
7582
  [recipient, service]
6221
7583
  );
6222
- const handleHistoryOpen = useCallback6(() => {
7584
+ const handleHistoryOpen = useCallback9(() => {
6223
7585
  setHistoryOpen(true);
6224
7586
  if (!historyLoadedRef.current || historyStaleRef.current) {
6225
7587
  fetchHistory("initial");
6226
7588
  }
6227
7589
  }, [fetchHistory]);
6228
- const handleHistoryClose = useCallback6(() => {
7590
+ const handleHistoryClose = useCallback9(() => {
6229
7591
  setHistoryOpen(false);
6230
7592
  }, []);
6231
- const handleHistoryLoadMore = useCallback6(() => {
7593
+ const handleHistoryLoadMore = useCallback9(() => {
6232
7594
  fetchHistory("more");
6233
7595
  }, [fetchHistory]);
6234
- const markHistoryStale = useCallback6(() => {
7596
+ const markHistoryStale = useCallback9(() => {
6235
7597
  historyStaleRef.current = true;
6236
7598
  if (historyOpen) {
6237
7599
  fetchHistory("initial");
6238
7600
  }
6239
7601
  }, [historyOpen, fetchHistory]);
6240
7602
  const onLifecycleRef = useLatestRef(onLifecycle);
6241
- const handleLifecycle = useCallback6(
7603
+ const handleLifecycle = useCallback9(
6242
7604
  (event) => {
6243
7605
  onLifecycleRef.current?.(event);
6244
7606
  if (event.type === "smart-account-changed" && !event.evm && !event.solana) {
@@ -6250,7 +7612,7 @@ function DepositModalInner({
6250
7612
  },
6251
7613
  [onLifecycleRef, showHistoryButton, markHistoryStale]
6252
7614
  );
6253
- useEffect9(() => {
7615
+ useEffect11(() => {
6254
7616
  if (!isOpen) {
6255
7617
  setHistoryOpen(false);
6256
7618
  setHistoryDeposits([]);
@@ -6261,14 +7623,14 @@ function DepositModalInner({
6261
7623
  historyLoadedRef.current = false;
6262
7624
  }
6263
7625
  }, [isOpen]);
6264
- useEffect9(() => {
7626
+ useEffect11(() => {
6265
7627
  if (!isOpen) {
6266
7628
  store.dispatch({ type: "flow/reset" });
6267
7629
  }
6268
7630
  }, [isOpen, store]);
6269
7631
  const showBackButton = uiConfig?.showBackButton ?? true;
6270
7632
  const canGoBack = backHandler !== void 0;
6271
- return /* @__PURE__ */ jsx13(DepositStoreProvider, { store, children: /* @__PURE__ */ jsx13(
7633
+ return /* @__PURE__ */ jsx20(DepositStoreProvider, { store, children: /* @__PURE__ */ jsx20(
6272
7634
  Modal,
6273
7635
  {
6274
7636
  isOpen,
@@ -6276,20 +7638,20 @@ function DepositModalInner({
6276
7638
  className,
6277
7639
  inline,
6278
7640
  closeOnOverlayClick,
6279
- children: /* @__PURE__ */ jsxs13("div", { ref: modalRef, className: "rs-modal", children: [
6280
- /* @__PURE__ */ jsxs13("div", { className: "rs-modal-header--redesigned", children: [
6281
- /* @__PURE__ */ jsx13("div", { className: "rs-modal-header-nav-left", children: showBackButton && canGoBack && backHandler && /* @__PURE__ */ jsx13(
7641
+ children: /* @__PURE__ */ jsxs18("div", { ref: modalRef, className: "rs-modal", children: [
7642
+ /* @__PURE__ */ jsxs18("div", { className: "rs-modal-header--redesigned", children: [
7643
+ /* @__PURE__ */ jsx20("div", { className: "rs-modal-header-nav-left", children: showBackButton && canGoBack && backHandler && /* @__PURE__ */ jsx20(
6282
7644
  "button",
6283
7645
  {
6284
7646
  type: "button",
6285
7647
  className: "rs-modal-header-back",
6286
7648
  "aria-label": "Go back",
6287
7649
  onClick: backHandler,
6288
- children: /* @__PURE__ */ jsx13(ChevronLeftIcon, {})
7650
+ children: /* @__PURE__ */ jsx20(ChevronLeftIcon, {})
6289
7651
  }
6290
7652
  ) }),
6291
- /* @__PURE__ */ jsxs13("div", { className: "rs-modal-header-nav-right", children: [
6292
- historyButtonVisible && /* @__PURE__ */ jsx13(
7653
+ /* @__PURE__ */ jsxs18("div", { className: "rs-modal-header-nav-right", children: [
7654
+ historyButtonVisible && /* @__PURE__ */ jsx20(
6293
7655
  "button",
6294
7656
  {
6295
7657
  type: "button",
@@ -6297,22 +7659,22 @@ function DepositModalInner({
6297
7659
  "aria-label": "Deposit history",
6298
7660
  onClick: handleHistoryOpen,
6299
7661
  disabled: !recipient,
6300
- children: /* @__PURE__ */ jsx13(HistoryIcon, {})
7662
+ children: /* @__PURE__ */ jsx20(HistoryIcon, {})
6301
7663
  }
6302
7664
  ),
6303
- /* @__PURE__ */ jsx13(
7665
+ /* @__PURE__ */ jsx20(
6304
7666
  "button",
6305
7667
  {
6306
7668
  type: "button",
6307
7669
  onClick: onClose,
6308
7670
  className: "rs-modal-close",
6309
7671
  "aria-label": "Close",
6310
- children: /* @__PURE__ */ jsx13(CloseIcon, {})
7672
+ children: /* @__PURE__ */ jsx20(CloseIcon, {})
6311
7673
  }
6312
7674
  )
6313
7675
  ] })
6314
7676
  ] }),
6315
- /* @__PURE__ */ jsx13(
7677
+ recipientIsContract ? /* @__PURE__ */ jsx20("div", { className: "rs-modal-body", children: /* @__PURE__ */ jsx20(Callout, { variant: "error", children: "HyperCore deposits require an EOA recipient. The configured recipient is a smart contract, which is not supported." }) }) : /* @__PURE__ */ jsx20(
6316
7678
  DepositFlow,
6317
7679
  {
6318
7680
  dappWalletClient,
@@ -6333,9 +7695,13 @@ function DepositModalInner({
6333
7695
  signerAddress,
6334
7696
  sessionChainIds,
6335
7697
  forceRegister,
6336
- waitForFinalTx,
6337
7698
  enableSolana,
6338
7699
  dappImports,
7700
+ initialDappImport,
7701
+ enableFiatOnramp,
7702
+ enableQrTransfer,
7703
+ fiatOnrampMethods,
7704
+ enableExchangeConnect,
6339
7705
  reownWallet,
6340
7706
  onConnect,
6341
7707
  onDisconnect,
@@ -6350,7 +7716,7 @@ function DepositModalInner({
6350
7716
  debug
6351
7717
  }
6352
7718
  ),
6353
- showHistoryButton && historyOpen && /* @__PURE__ */ jsx13(
7719
+ showHistoryButton && historyOpen && /* @__PURE__ */ jsx20(
6354
7720
  DepositHistoryPanel,
6355
7721
  {
6356
7722
  deposits: historyDeposits,