@rhinestone/deposit-modal 0.3.0-alpha.8 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +76 -0
- package/dist/{DepositModalReown-TYHATVOM.mjs → DepositModalReown-6SUEC5IU.mjs} +4 -4
- package/dist/{DepositModalReown-LWGABUOF.cjs → DepositModalReown-DNW4GH6L.cjs} +7 -7
- package/dist/{QRCode-SMMYPUQC.cjs → QRCode-5DXFNKI2.cjs} +2 -2
- package/dist/{QRCode-YMQTKSSK.mjs → QRCode-WUC652SH.mjs} +2 -2
- package/dist/{WithdrawModalReown-H7HA3JP3.mjs → WithdrawModalReown-7UAGSOSU.mjs} +4 -4
- package/dist/{WithdrawModalReown-FCWED55P.cjs → WithdrawModalReown-OUWBSKSM.cjs} +7 -7
- package/dist/{constants-DqVn968d.d.cts → caip-CrQ2KKU-.d.cts} +11 -1
- package/dist/{constants-DqVn968d.d.ts → caip-CrQ2KKU-.d.ts} +11 -1
- package/dist/{chunk-U3OLJZBT.cjs → chunk-2SMS542Q.cjs} +109 -102
- package/dist/{chunk-PKD7W5JG.cjs → chunk-33H6O5UU.cjs} +6 -16
- package/dist/{chunk-SZIYS42B.mjs → chunk-6YRDD462.mjs} +63 -3
- package/dist/{chunk-E46WOBZQ.mjs → chunk-GPSBM66J.mjs} +2 -12
- package/dist/{chunk-5ZS4ZJPW.mjs → chunk-KAWJABTW.mjs} +1071 -543
- package/dist/{chunk-H7QMSMM5.mjs → chunk-KJ2RR2D4.mjs} +1834 -586
- package/dist/{chunk-7JIDIX27.cjs → chunk-MILJQWPT.cjs} +73 -13
- package/dist/{chunk-UELVNPGE.cjs → chunk-RABZINV3.cjs} +1056 -528
- package/dist/{chunk-DW276H63.mjs → chunk-TKQYTBU6.mjs} +21 -14
- package/dist/{chunk-GBFOGYMH.cjs → chunk-VVJAIMKB.cjs} +1885 -637
- package/dist/constants.cjs +6 -2
- package/dist/constants.d.cts +1 -1
- package/dist/constants.d.ts +1 -1
- package/dist/constants.mjs +5 -1
- package/dist/deposit.cjs +4 -4
- package/dist/deposit.d.cts +2 -2
- package/dist/deposit.d.ts +2 -2
- package/dist/deposit.mjs +3 -3
- package/dist/index.cjs +19 -6
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.mjs +20 -7
- package/dist/styles.css +685 -75
- package/dist/{types-D8Q4TMk7.d.cts → types-BMcGO5k_.d.cts} +56 -2
- package/dist/{types-D8Q4TMk7.d.ts → types-BMcGO5k_.d.ts} +56 -2
- package/dist/withdraw.cjs +4 -4
- package/dist/withdraw.d.cts +2 -2
- package/dist/withdraw.d.ts +2 -2
- package/dist/withdraw.mjs +3 -3
- package/package.json +41 -17
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
AlertTriangleIcon,
|
|
3
3
|
ArrowUpRightIcon,
|
|
4
|
+
BankIcon,
|
|
4
5
|
BodyHeader,
|
|
5
6
|
Button,
|
|
6
7
|
Callout,
|
|
@@ -12,6 +13,7 @@ import {
|
|
|
12
13
|
ConnectStep,
|
|
13
14
|
CopyIcon,
|
|
14
15
|
ExternalLinkIcon,
|
|
16
|
+
HandCoinsIcon,
|
|
15
17
|
HistoryIcon,
|
|
16
18
|
InfoIcon,
|
|
17
19
|
Modal,
|
|
@@ -32,28 +34,32 @@ import {
|
|
|
32
34
|
currencyFormatter,
|
|
33
35
|
debugError,
|
|
34
36
|
debugLog,
|
|
37
|
+
failureMessageForEvent,
|
|
35
38
|
formatUserError,
|
|
36
39
|
getAssetId,
|
|
40
|
+
getEventSourceDetails,
|
|
37
41
|
getEventTxHash,
|
|
42
|
+
getHyperEvmReadClient,
|
|
38
43
|
getPublicClient,
|
|
39
44
|
isDepositEvent,
|
|
45
|
+
isFailedEvent,
|
|
40
46
|
isNativeAsset,
|
|
41
|
-
isSolanaCaip2,
|
|
42
47
|
loadSessionOwnerFromStorage,
|
|
43
|
-
parseEvmChainId,
|
|
44
48
|
portfolioToAssets,
|
|
45
49
|
saveSessionOwnerToStorage,
|
|
46
|
-
targetChainToCaip2,
|
|
47
50
|
tokenFormatter,
|
|
48
51
|
txRefsMatch,
|
|
49
52
|
useLatestRef
|
|
50
|
-
} from "./chunk-
|
|
53
|
+
} from "./chunk-KAWJABTW.mjs";
|
|
51
54
|
import {
|
|
52
55
|
DEFAULT_BACKEND_URL,
|
|
53
56
|
DEFAULT_SIGNER_ADDRESS,
|
|
57
|
+
HYPERCORE_CHAIN_ID,
|
|
58
|
+
HYPERCORE_MIN_DEPOSIT_USD,
|
|
54
59
|
NATIVE_TOKEN_ADDRESS,
|
|
55
60
|
SOLANA_TOKENS,
|
|
56
61
|
SOURCE_CHAINS,
|
|
62
|
+
findTokenDecimals,
|
|
57
63
|
getChainBadge,
|
|
58
64
|
getChainIcon,
|
|
59
65
|
getChainId,
|
|
@@ -67,23 +73,36 @@ import {
|
|
|
67
73
|
getTokenDecimalsByAddress,
|
|
68
74
|
getTokenIcon,
|
|
69
75
|
getTokenSymbol,
|
|
76
|
+
isContractBytecode,
|
|
70
77
|
isNativeSol,
|
|
71
|
-
|
|
72
|
-
|
|
78
|
+
isSolanaCaip2,
|
|
79
|
+
isStablecoinSymbol,
|
|
80
|
+
isVirtualDestination,
|
|
81
|
+
parseEvmChainId,
|
|
82
|
+
targetChainToCaip2
|
|
83
|
+
} from "./chunk-6YRDD462.mjs";
|
|
73
84
|
|
|
74
85
|
// src/DepositModal.tsx
|
|
75
86
|
import {
|
|
76
|
-
useMemo as
|
|
77
|
-
useEffect as
|
|
78
|
-
useRef as
|
|
79
|
-
useState as
|
|
80
|
-
useCallback as
|
|
87
|
+
useMemo as useMemo9,
|
|
88
|
+
useEffect as useEffect11,
|
|
89
|
+
useRef as useRef9,
|
|
90
|
+
useState as useState13,
|
|
91
|
+
useCallback as useCallback9,
|
|
81
92
|
lazy as lazy2,
|
|
82
93
|
Suspense as Suspense2
|
|
83
94
|
} from "react";
|
|
95
|
+
import { isAddress as isAddress2 } from "viem";
|
|
84
96
|
|
|
85
97
|
// src/DepositFlow.tsx
|
|
86
|
-
import {
|
|
98
|
+
import {
|
|
99
|
+
useState as useState11,
|
|
100
|
+
useCallback as useCallback7,
|
|
101
|
+
useMemo as useMemo7,
|
|
102
|
+
useEffect as useEffect10,
|
|
103
|
+
useLayoutEffect as useLayoutEffect2,
|
|
104
|
+
useRef as useRef8
|
|
105
|
+
} from "react";
|
|
87
106
|
import { formatUnits as formatUnits7 } from "viem";
|
|
88
107
|
|
|
89
108
|
// src/components/steps/AssetSelectStep.tsx
|
|
@@ -113,8 +132,18 @@ function AssetSelectStep({
|
|
|
113
132
|
token: defaultSourceToken
|
|
114
133
|
});
|
|
115
134
|
}, [defaultSourceChain, defaultSourceToken]);
|
|
135
|
+
const onTotalBalanceComputedRef = useLatestRef(onTotalBalanceComputed);
|
|
136
|
+
const onAssetsLoadedRef = useLatestRef(onAssetsLoaded);
|
|
116
137
|
useEffect(() => {
|
|
117
138
|
let active = true;
|
|
139
|
+
function emitAssetsUpdate(currentAssets) {
|
|
140
|
+
const total = currentAssets.reduce(
|
|
141
|
+
(sum, asset) => sum + (asset.balanceUsd ?? 0),
|
|
142
|
+
0
|
|
143
|
+
);
|
|
144
|
+
onTotalBalanceComputedRef.current?.(total);
|
|
145
|
+
if (currentAssets.length > 0) onAssetsLoadedRef.current?.(currentAssets);
|
|
146
|
+
}
|
|
118
147
|
async function loadPortfolio() {
|
|
119
148
|
if (!address) {
|
|
120
149
|
setLoading(false);
|
|
@@ -127,6 +156,7 @@ function AssetSelectStep({
|
|
|
127
156
|
if (!active) return;
|
|
128
157
|
const portfolioAssets = portfolioToAssets(portfolio.tokens);
|
|
129
158
|
setAssets(portfolioAssets);
|
|
159
|
+
emitAssetsUpdate(portfolioAssets);
|
|
130
160
|
const hasNative = portfolioAssets.some(
|
|
131
161
|
(asset) => asset.token.toLowerCase() === NATIVE_TOKEN_ADDRESS
|
|
132
162
|
);
|
|
@@ -138,7 +168,9 @@ function AssetSelectStep({
|
|
|
138
168
|
);
|
|
139
169
|
if (!active) return;
|
|
140
170
|
if (nativeAssets.length > 0) {
|
|
141
|
-
|
|
171
|
+
const merged = mergeAssets(portfolioAssets, nativeAssets);
|
|
172
|
+
setAssets(merged);
|
|
173
|
+
emitAssetsUpdate(merged);
|
|
142
174
|
}
|
|
143
175
|
}
|
|
144
176
|
} catch (err) {
|
|
@@ -154,21 +186,13 @@ function AssetSelectStep({
|
|
|
154
186
|
return () => {
|
|
155
187
|
active = false;
|
|
156
188
|
};
|
|
157
|
-
}, [address, publicClient, service]);
|
|
189
|
+
}, [address, publicClient, service, onTotalBalanceComputedRef, onAssetsLoadedRef]);
|
|
158
190
|
useEffect(() => {
|
|
159
191
|
if (!defaultAssetId || selectedAssetId) return;
|
|
160
192
|
if (assets.some((asset) => asset.id === defaultAssetId)) {
|
|
161
193
|
setSelectedAssetId(defaultAssetId);
|
|
162
194
|
}
|
|
163
195
|
}, [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
196
|
const allowedChainSet = useMemo(
|
|
173
197
|
() => allowedRoutes?.sourceChains ? new Set(allowedRoutes.sourceChains) : null,
|
|
174
198
|
[allowedRoutes?.sourceChains]
|
|
@@ -476,7 +500,6 @@ function AmountStep({
|
|
|
476
500
|
uiConfig,
|
|
477
501
|
tokenPriceUsdOverride,
|
|
478
502
|
appBalanceUsd,
|
|
479
|
-
onBalanceUsdChange,
|
|
480
503
|
onContinue,
|
|
481
504
|
onCtaClick,
|
|
482
505
|
service
|
|
@@ -554,9 +577,6 @@ function AmountStep({
|
|
|
554
577
|
return null;
|
|
555
578
|
}
|
|
556
579
|
}, [balance, tokenPriceUsd, asset.decimals]);
|
|
557
|
-
useEffect2(() => {
|
|
558
|
-
onBalanceUsdChange?.(balanceUsd ?? 0);
|
|
559
|
-
}, [balanceUsd, onBalanceUsdChange]);
|
|
560
580
|
useEffect2(() => {
|
|
561
581
|
if (hasAppliedDefaultRef.current || !defaultAmount) return;
|
|
562
582
|
if (isMaxDefault) {
|
|
@@ -612,7 +632,7 @@ function AmountStep({
|
|
|
612
632
|
return null;
|
|
613
633
|
}
|
|
614
634
|
}, [numericAmount, isSourceStablecoin, hasPricing, tokenPriceUsd, asset.decimals]);
|
|
615
|
-
const minDepositUsd = uiConfig?.minDepositUsd ?? null;
|
|
635
|
+
const minDepositUsd = targetChain === HYPERCORE_CHAIN_ID ? Math.max(HYPERCORE_MIN_DEPOSIT_USD, uiConfig?.minDepositUsd ?? 0) : uiConfig?.minDepositUsd ?? null;
|
|
616
636
|
const maxDepositUsd = uiConfig?.maxDepositUsd ?? null;
|
|
617
637
|
const isBelowMin = minDepositUsd !== null && numericAmount > 0 && amountUsd < minDepositUsd;
|
|
618
638
|
const isAboveMax = maxDepositUsd !== null && amountUsd > maxDepositUsd;
|
|
@@ -782,6 +802,7 @@ function AmountStep({
|
|
|
782
802
|
/* @__PURE__ */ jsx3("span", { className: "rs-amount-detail-value", children: currencyFormatter.format(balanceAfterUsd) })
|
|
783
803
|
] })
|
|
784
804
|
] }),
|
|
805
|
+
targetChain === HYPERCORE_CHAIN_ID && /* @__PURE__ */ jsx3(Callout, { variant: "warning", children: "First deposit to a new HyperCore account includes a ~1 USDC activation fee." }),
|
|
785
806
|
error && /* @__PURE__ */ jsx3(Callout, { variant: "error", children: error }),
|
|
786
807
|
/* @__PURE__ */ jsx3(
|
|
787
808
|
Button,
|
|
@@ -821,6 +842,7 @@ function ConfirmStep({
|
|
|
821
842
|
estimatedTime = "< 1 min",
|
|
822
843
|
quotedFeeAmount = "0.1",
|
|
823
844
|
quotedFeeSymbol,
|
|
845
|
+
service,
|
|
824
846
|
onConfirm,
|
|
825
847
|
onError,
|
|
826
848
|
onDepositSubmitted,
|
|
@@ -828,6 +850,7 @@ function ConfirmStep({
|
|
|
828
850
|
}) {
|
|
829
851
|
const [isSubmitting, setIsSubmitting] = useState3(false);
|
|
830
852
|
const [error, setError] = useState3(null);
|
|
853
|
+
const [quote, setQuote] = useState3(null);
|
|
831
854
|
const hasAttemptedSwitch = useRef3(false);
|
|
832
855
|
const chainMismatch = Boolean(
|
|
833
856
|
walletClient?.chain?.id && walletClient.chain.id !== asset.chainId
|
|
@@ -840,7 +863,10 @@ function ConfirmStep({
|
|
|
840
863
|
const targetChainIcon = getChainIcon(targetChain);
|
|
841
864
|
const sourceTokenIcon = getTokenIcon(asset.symbol);
|
|
842
865
|
const targetTokenIcon = getTokenIcon(targetSymbol);
|
|
843
|
-
const formattedSendAmount = amount && !Number.isNaN(Number(amount)) ? Number(amount).toLocaleString("en-US", {
|
|
866
|
+
const formattedSendAmount = amount && !Number.isNaN(Number(amount)) ? Number(amount).toLocaleString("en-US", {
|
|
867
|
+
minimumFractionDigits: 2,
|
|
868
|
+
maximumFractionDigits: 6
|
|
869
|
+
}) : "0";
|
|
844
870
|
const formattedReceiveAmount = (() => {
|
|
845
871
|
if (sameRoute) return formattedSendAmount;
|
|
846
872
|
const dollarValue = Number(targetAmount);
|
|
@@ -848,13 +874,18 @@ function ConfirmStep({
|
|
|
848
874
|
return formattedSendAmount;
|
|
849
875
|
if (targetTokenPriceUsd !== null && targetTokenPriceUsd > 0) {
|
|
850
876
|
const tokenAmount = dollarValue / targetTokenPriceUsd;
|
|
851
|
-
return tokenAmount.toLocaleString("en-US", {
|
|
877
|
+
return tokenAmount.toLocaleString("en-US", {
|
|
878
|
+
minimumFractionDigits: 2,
|
|
879
|
+
maximumFractionDigits: 6
|
|
880
|
+
});
|
|
852
881
|
}
|
|
853
882
|
return formattedSendAmount;
|
|
854
883
|
})();
|
|
855
884
|
const receiveAmount = sameRoute ? formattedReceiveAmount : `~${formattedReceiveAmount}`;
|
|
856
885
|
const feeSponsored = uiConfig?.feeSponsored ?? false;
|
|
857
886
|
const feeTooltip = uiConfig?.feeTooltip ?? (feeSponsored ? "Network fees are sponsored for this deposit." : "Network fees apply.");
|
|
887
|
+
const feeDisplay = quote ? `$${quote.fees.totalUsd.toFixed(2)}` : null;
|
|
888
|
+
const estimatedTimeDisplay = quote ? quote.estimatedFillTimeSeconds < 60 ? "< 1 min" : `~${Math.round(quote.estimatedFillTimeSeconds / 60)} min` : estimatedTime;
|
|
858
889
|
useEffect3(() => {
|
|
859
890
|
if (chainMismatch && switchChain && !hasAttemptedSwitch.current) {
|
|
860
891
|
hasAttemptedSwitch.current = true;
|
|
@@ -867,6 +898,39 @@ function ConfirmStep({
|
|
|
867
898
|
useEffect3(() => {
|
|
868
899
|
hasAttemptedSwitch.current = false;
|
|
869
900
|
}, [asset.chainId]);
|
|
901
|
+
useEffect3(() => {
|
|
902
|
+
if (targetChain === "solana" && asset.chainId === void 0) return;
|
|
903
|
+
let cancelled = false;
|
|
904
|
+
let units;
|
|
905
|
+
try {
|
|
906
|
+
units = parseUnits2(amount, asset.decimals);
|
|
907
|
+
} catch {
|
|
908
|
+
return;
|
|
909
|
+
}
|
|
910
|
+
if (units <= 0n) return;
|
|
911
|
+
setQuote(null);
|
|
912
|
+
service.getQuotePreview({
|
|
913
|
+
account: smartAccount,
|
|
914
|
+
sourceChainId: asset.chainId,
|
|
915
|
+
sourceToken: asset.token,
|
|
916
|
+
amount: units.toString()
|
|
917
|
+
}).then((result) => {
|
|
918
|
+
if (!cancelled) setQuote(result);
|
|
919
|
+
}).catch(() => {
|
|
920
|
+
if (!cancelled) setQuote(null);
|
|
921
|
+
});
|
|
922
|
+
return () => {
|
|
923
|
+
cancelled = true;
|
|
924
|
+
};
|
|
925
|
+
}, [
|
|
926
|
+
service,
|
|
927
|
+
smartAccount,
|
|
928
|
+
asset.chainId,
|
|
929
|
+
asset.token,
|
|
930
|
+
asset.decimals,
|
|
931
|
+
amount,
|
|
932
|
+
targetChain
|
|
933
|
+
]);
|
|
870
934
|
const handleConfirm = async () => {
|
|
871
935
|
if (!address || !walletClient) {
|
|
872
936
|
setError("Wallet not connected");
|
|
@@ -955,7 +1019,7 @@ function ConfirmStep({
|
|
|
955
1019
|
] }),
|
|
956
1020
|
/* @__PURE__ */ jsxs4("div", { className: "rs-review-detail-row", children: [
|
|
957
1021
|
/* @__PURE__ */ jsx4("span", { children: "Estimated time" }),
|
|
958
|
-
/* @__PURE__ */ jsx4("span", { className: "rs-review-detail-value", children:
|
|
1022
|
+
/* @__PURE__ */ jsx4("span", { className: "rs-review-detail-value", children: estimatedTimeDisplay })
|
|
959
1023
|
] }),
|
|
960
1024
|
/* @__PURE__ */ jsxs4("div", { className: "rs-review-detail-row", children: [
|
|
961
1025
|
/* @__PURE__ */ jsx4("span", { children: "You send" }),
|
|
@@ -982,17 +1046,24 @@ function ConfirmStep({
|
|
|
982
1046
|
/* @__PURE__ */ jsxs4("div", { className: "rs-review-detail-row", children: [
|
|
983
1047
|
/* @__PURE__ */ jsx4("span", { children: "Fees" }),
|
|
984
1048
|
/* @__PURE__ */ jsxs4("span", { className: "rs-review-detail-value", children: [
|
|
985
|
-
/* @__PURE__ */ jsx4(
|
|
1049
|
+
feeDisplay === null ? /* @__PURE__ */ jsx4(
|
|
1050
|
+
"span",
|
|
1051
|
+
{
|
|
1052
|
+
className: "rs-skeleton rs-skeleton-fee",
|
|
1053
|
+
"aria-hidden": "true"
|
|
1054
|
+
}
|
|
1055
|
+
) : /* @__PURE__ */ jsx4(
|
|
986
1056
|
"span",
|
|
987
1057
|
{
|
|
988
1058
|
style: feeSponsored ? { textDecoration: "line-through" } : void 0,
|
|
989
|
-
children:
|
|
1059
|
+
children: feeDisplay
|
|
990
1060
|
}
|
|
991
1061
|
),
|
|
992
1062
|
/* @__PURE__ */ jsx4(Tooltip, { content: feeTooltip, children: /* @__PURE__ */ jsx4("span", { className: "rs-review-detail-info", "aria-label": "Fee info", children: /* @__PURE__ */ jsx4(InfoIcon, {}) }) })
|
|
993
1063
|
] })
|
|
994
1064
|
] })
|
|
995
1065
|
] }),
|
|
1066
|
+
targetChain === HYPERCORE_CHAIN_ID && /* @__PURE__ */ jsx4(Callout, { variant: "warning", children: "First deposit to a new HyperCore account includes a ~1 USDC activation fee." }),
|
|
996
1067
|
error && /* @__PURE__ */ jsx4(Callout, { variant: "error", children: error }),
|
|
997
1068
|
/* @__PURE__ */ jsx4(
|
|
998
1069
|
Button,
|
|
@@ -1088,14 +1159,21 @@ function DepositNotification({
|
|
|
1088
1159
|
solanaDepositAddress,
|
|
1089
1160
|
targetChain,
|
|
1090
1161
|
targetToken,
|
|
1091
|
-
waitForFinalTx,
|
|
1092
1162
|
hasPostBridgeActions,
|
|
1093
1163
|
service,
|
|
1094
1164
|
onComplete,
|
|
1095
1165
|
onFailed,
|
|
1096
1166
|
onDismiss
|
|
1097
1167
|
}) {
|
|
1098
|
-
const {
|
|
1168
|
+
const {
|
|
1169
|
+
txHash,
|
|
1170
|
+
sourceChain,
|
|
1171
|
+
amount,
|
|
1172
|
+
token,
|
|
1173
|
+
sourceDecimals,
|
|
1174
|
+
detectedAt,
|
|
1175
|
+
directTransfer
|
|
1176
|
+
} = deposit;
|
|
1099
1177
|
const [status, setStatus] = useState4(
|
|
1100
1178
|
directTransfer ? "complete" : "processing"
|
|
1101
1179
|
);
|
|
@@ -1113,9 +1191,9 @@ function DepositNotification({
|
|
|
1113
1191
|
amount,
|
|
1114
1192
|
sourceChain,
|
|
1115
1193
|
sourceToken: token,
|
|
1194
|
+
sourceDecimals,
|
|
1116
1195
|
targetChain,
|
|
1117
1196
|
targetToken,
|
|
1118
|
-
waitForFinalTx,
|
|
1119
1197
|
hasPostBridgeActions
|
|
1120
1198
|
});
|
|
1121
1199
|
const onCompleteRef = useLatestRef(onComplete);
|
|
@@ -1132,6 +1210,7 @@ function DepositNotification({
|
|
|
1132
1210
|
amount: context.amount,
|
|
1133
1211
|
sourceChain: context.sourceChain,
|
|
1134
1212
|
sourceToken: context.sourceToken,
|
|
1213
|
+
sourceDecimals: context.sourceDecimals,
|
|
1135
1214
|
targetChain: context.targetChain,
|
|
1136
1215
|
targetToken: context.targetToken
|
|
1137
1216
|
});
|
|
@@ -1161,7 +1240,7 @@ function DepositNotification({
|
|
|
1161
1240
|
if (!isMounted) return;
|
|
1162
1241
|
const lastEvent = data.lastEvent;
|
|
1163
1242
|
const eventForTx = isEventForTx(lastEvent, txHash) ? lastEvent : void 0;
|
|
1164
|
-
const awaitingPostBridgeSwap = depositContextRef.current.
|
|
1243
|
+
const awaitingPostBridgeSwap = depositContextRef.current.hasPostBridgeActions;
|
|
1165
1244
|
if (eventForTx?.type === "post-bridge-swap-complete") {
|
|
1166
1245
|
const swapTxHash = eventForTx.data?.swap?.transactionHash;
|
|
1167
1246
|
handleComplete(swapTxHash);
|
|
@@ -1176,10 +1255,6 @@ function DepositNotification({
|
|
|
1176
1255
|
handleComplete(destTx);
|
|
1177
1256
|
return;
|
|
1178
1257
|
}
|
|
1179
|
-
if (!waitForFinalTx && eventForTx?.type === "bridge-started") {
|
|
1180
|
-
handleComplete(void 0);
|
|
1181
|
-
return;
|
|
1182
|
-
}
|
|
1183
1258
|
if (eventForTx?.type === "bridge-failed") {
|
|
1184
1259
|
handleFailed(formatBridgeFailedMessage(eventForTx));
|
|
1185
1260
|
return;
|
|
@@ -1227,7 +1302,38 @@ function DepositNotification({
|
|
|
1227
1302
|
const destExplorerUrl = destinationTxHash ? getExplorerTxUrl(targetChain, destinationTxHash) : null;
|
|
1228
1303
|
const title = status === "complete" ? "Deposit completed" : status === "failed" ? "Deposit failed" : "Deposit received and processing\u2026";
|
|
1229
1304
|
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__ */
|
|
1305
|
+
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(
|
|
1306
|
+
"svg",
|
|
1307
|
+
{
|
|
1308
|
+
className: "rs-deposit-notification-spinner",
|
|
1309
|
+
viewBox: "0 0 44 44",
|
|
1310
|
+
fill: "none",
|
|
1311
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1312
|
+
"aria-hidden": "true",
|
|
1313
|
+
children: [
|
|
1314
|
+
/* @__PURE__ */ jsx5(
|
|
1315
|
+
"path",
|
|
1316
|
+
{
|
|
1317
|
+
className: "rs-deposit-notification-spinner-track",
|
|
1318
|
+
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",
|
|
1319
|
+
stroke: "#D4D4D8",
|
|
1320
|
+
strokeWidth: "2",
|
|
1321
|
+
strokeLinecap: "round"
|
|
1322
|
+
}
|
|
1323
|
+
),
|
|
1324
|
+
/* @__PURE__ */ jsx5(
|
|
1325
|
+
"path",
|
|
1326
|
+
{
|
|
1327
|
+
className: "rs-deposit-notification-spinner-head",
|
|
1328
|
+
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",
|
|
1329
|
+
stroke: "#52525C",
|
|
1330
|
+
strokeWidth: "2",
|
|
1331
|
+
strokeLinecap: "round"
|
|
1332
|
+
}
|
|
1333
|
+
)
|
|
1334
|
+
]
|
|
1335
|
+
}
|
|
1336
|
+
) });
|
|
1231
1337
|
const showClose = status !== "processing";
|
|
1232
1338
|
return /* @__PURE__ */ jsxs5(
|
|
1233
1339
|
"div",
|
|
@@ -1316,7 +1422,7 @@ function DepositNotification({
|
|
|
1316
1422
|
// src/components/steps/DepositAddressStep.tsx
|
|
1317
1423
|
import { jsx as jsx6, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
1318
1424
|
var QRCode = lazy(
|
|
1319
|
-
() => import("./QRCode-
|
|
1425
|
+
() => import("./QRCode-WUC652SH.mjs").then((m) => ({ default: m.QRCode }))
|
|
1320
1426
|
);
|
|
1321
1427
|
var POLL_INTERVAL_MS = 4e3;
|
|
1322
1428
|
function isRecord(value) {
|
|
@@ -1375,14 +1481,15 @@ function getDepositEventDetails(event) {
|
|
|
1375
1481
|
...solanaMeta
|
|
1376
1482
|
};
|
|
1377
1483
|
}
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
const
|
|
1484
|
+
const source = isRecord(event.data.source) ? event.data.source : void 0;
|
|
1485
|
+
const deposit = isRecord(event.data.deposit) ? event.data.deposit : void 0;
|
|
1486
|
+
if (source || deposit) {
|
|
1487
|
+
const chainId = asChainId(source?.chain) ?? asChainId(deposit?.chain);
|
|
1488
|
+
const token = asString(source?.asset) ?? asString(deposit?.asset) ?? asString(deposit?.token);
|
|
1382
1489
|
const solanaMeta = chainId === "solana" ? resolveSolanaTokenMeta(token) : {};
|
|
1383
1490
|
return {
|
|
1384
1491
|
chainId,
|
|
1385
|
-
amount: asAmount(source?.amount),
|
|
1492
|
+
amount: asAmount(source?.amount) ?? asAmount(deposit?.amount),
|
|
1386
1493
|
token,
|
|
1387
1494
|
...solanaMeta
|
|
1388
1495
|
};
|
|
@@ -1392,15 +1499,22 @@ function getDepositEventDetails(event) {
|
|
|
1392
1499
|
function isSameRoute(sourceChain, sourceToken, targetChain, targetToken) {
|
|
1393
1500
|
return sourceChain === targetChain && sourceToken.toLowerCase() === targetToken.toLowerCase();
|
|
1394
1501
|
}
|
|
1502
|
+
function computeTokensForChain(chainId, allowedTokenSet) {
|
|
1503
|
+
const all = chainId === "solana" ? SOLANA_TOKENS.map((t) => t.symbol) : getTargetTokenSymbolsForChain(chainId);
|
|
1504
|
+
return allowedTokenSet ? all.filter((s) => allowedTokenSet.has(s.toUpperCase())) : all;
|
|
1505
|
+
}
|
|
1506
|
+
function pickFallbackToken(tokens, current) {
|
|
1507
|
+
if (tokens.includes(current)) return current;
|
|
1508
|
+
if (tokens.includes("USDC")) return "USDC";
|
|
1509
|
+
return tokens[0] ?? "USDC";
|
|
1510
|
+
}
|
|
1395
1511
|
function DepositAddressStep({
|
|
1396
1512
|
smartAccount,
|
|
1397
1513
|
solanaDepositAddress,
|
|
1398
|
-
isUpdating = false,
|
|
1399
1514
|
service,
|
|
1400
1515
|
allowedRoutes,
|
|
1401
1516
|
targetChain,
|
|
1402
1517
|
targetToken,
|
|
1403
|
-
waitForFinalTx,
|
|
1404
1518
|
hasPostBridgeActions,
|
|
1405
1519
|
uiConfig,
|
|
1406
1520
|
onDepositSubmitted,
|
|
@@ -1428,22 +1542,16 @@ function DepositAddressStep({
|
|
|
1428
1542
|
options.splice(1, 0, "solana");
|
|
1429
1543
|
return options;
|
|
1430
1544
|
}, [evmChainIds, hasSolana]);
|
|
1431
|
-
const
|
|
1432
|
-
const defaultChainId = evmChainIds.includes(
|
|
1545
|
+
const BASE_CHAIN_ID2 = 8453;
|
|
1546
|
+
const defaultChainId = evmChainIds.includes(BASE_CHAIN_ID2) ? BASE_CHAIN_ID2 : evmChainIds[0];
|
|
1433
1547
|
const [sourceChainId, setSourceChainId] = useState5(defaultChainId);
|
|
1434
1548
|
const isSolana = sourceChainId === "solana";
|
|
1435
|
-
const tokensForChain = useMemo3(
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
const defaultToken =
|
|
1549
|
+
const tokensForChain = useMemo3(
|
|
1550
|
+
() => computeTokensForChain(sourceChainId, allowedTokenSet),
|
|
1551
|
+
[sourceChainId, allowedTokenSet]
|
|
1552
|
+
);
|
|
1553
|
+
const defaultToken = pickFallbackToken(tokensForChain, "USDC");
|
|
1440
1554
|
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
1555
|
const [copied, setCopied] = useState5(false);
|
|
1448
1556
|
const [pollingError, setPollingError] = useState5(null);
|
|
1449
1557
|
const [chainDropdownOpen, setChainDropdownOpen] = useState5(false);
|
|
@@ -1455,28 +1563,6 @@ function DepositAddressStep({
|
|
|
1455
1563
|
const isTrackingRef = useRef5(false);
|
|
1456
1564
|
const baselineTxHashRef = useRef5(void 0);
|
|
1457
1565
|
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
1566
|
const [liquidityHelper, setLiquidityHelper] = useState5({
|
|
1481
1567
|
kind: "idle"
|
|
1482
1568
|
});
|
|
@@ -1543,14 +1629,13 @@ function DepositAddressStep({
|
|
|
1543
1629
|
setTokenDropdownOpen(false);
|
|
1544
1630
|
}
|
|
1545
1631
|
document.addEventListener("mousedown", handlePointerDown);
|
|
1546
|
-
document.addEventListener("touchstart", handlePointerDown);
|
|
1632
|
+
document.addEventListener("touchstart", handlePointerDown, { passive: true });
|
|
1547
1633
|
return () => {
|
|
1548
1634
|
document.removeEventListener("mousedown", handlePointerDown);
|
|
1549
1635
|
document.removeEventListener("touchstart", handlePointerDown);
|
|
1550
1636
|
};
|
|
1551
1637
|
}, [chainDropdownOpen, tokenDropdownOpen]);
|
|
1552
1638
|
const handleCopy = useCallback2(async () => {
|
|
1553
|
-
if (isUpdating) return;
|
|
1554
1639
|
onCopyAddress?.();
|
|
1555
1640
|
try {
|
|
1556
1641
|
await navigator.clipboard.writeText(displayAddress);
|
|
@@ -1568,12 +1653,18 @@ function DepositAddressStep({
|
|
|
1568
1653
|
setCopied(true);
|
|
1569
1654
|
setTimeout(() => setCopied(false), 2e3);
|
|
1570
1655
|
}
|
|
1571
|
-
}, [displayAddress, onCopyAddress
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1656
|
+
}, [displayAddress, onCopyAddress]);
|
|
1657
|
+
const handleSelectChain = useCallback2(
|
|
1658
|
+
(nextChain) => {
|
|
1659
|
+
const nextTokens = computeTokensForChain(nextChain, allowedTokenSet);
|
|
1660
|
+
setSourceChainId(nextChain);
|
|
1661
|
+
setSourceTokenSymbol(pickFallbackToken(nextTokens, sourceTokenSymbol));
|
|
1662
|
+
setChainDropdownOpen(false);
|
|
1663
|
+
setTokenDropdownOpen(false);
|
|
1664
|
+
setCopied(false);
|
|
1665
|
+
},
|
|
1666
|
+
[allowedTokenSet, sourceTokenSymbol]
|
|
1667
|
+
);
|
|
1577
1668
|
const onDepositSubmittedRef = useRef5(onDepositSubmitted);
|
|
1578
1669
|
onDepositSubmittedRef.current = onDepositSubmitted;
|
|
1579
1670
|
const onDepositCompleteRef = useRef5(onDepositComplete);
|
|
@@ -1589,7 +1680,6 @@ function DepositAddressStep({
|
|
|
1589
1680
|
useEffect5(() => {
|
|
1590
1681
|
baselineTxHashRef.current = void 0;
|
|
1591
1682
|
isTrackingRef.current = false;
|
|
1592
|
-
setPollingError(null);
|
|
1593
1683
|
let timeoutId;
|
|
1594
1684
|
let cancelled = false;
|
|
1595
1685
|
async function poll() {
|
|
@@ -1634,10 +1724,13 @@ function DepositAddressStep({
|
|
|
1634
1724
|
const amount = details.amount ?? "0";
|
|
1635
1725
|
const token = details.token;
|
|
1636
1726
|
const sourceSymbol = details.sourceSymbol;
|
|
1637
|
-
const sourceDecimals = details.sourceDecimals;
|
|
1638
1727
|
baselineTxHashRef.current = eventTxHash;
|
|
1639
1728
|
isTrackingRef.current = true;
|
|
1640
1729
|
const isEvmToken = token ? /^0x[a-fA-F0-9]{40}$/.test(token) : false;
|
|
1730
|
+
const sourceDecimals = details.sourceDecimals ?? (isEvmToken ? findTokenDecimals(
|
|
1731
|
+
token,
|
|
1732
|
+
typeof chainId === "number" ? chainId : void 0
|
|
1733
|
+
) : void 0);
|
|
1641
1734
|
const directTransfer = typeof chainId === "number" && isEvmToken && isSameRoute(
|
|
1642
1735
|
chainId,
|
|
1643
1736
|
token,
|
|
@@ -1660,7 +1753,8 @@ function DepositAddressStep({
|
|
|
1660
1753
|
onDepositSubmittedRef.current?.({
|
|
1661
1754
|
txHash: eventTxHash,
|
|
1662
1755
|
sourceChain: chainId,
|
|
1663
|
-
amount
|
|
1756
|
+
amount,
|
|
1757
|
+
sourceDecimals
|
|
1664
1758
|
});
|
|
1665
1759
|
}
|
|
1666
1760
|
setPollingError(null);
|
|
@@ -1734,10 +1828,7 @@ function DepositAddressStep({
|
|
|
1734
1828
|
{
|
|
1735
1829
|
type: "button",
|
|
1736
1830
|
className: `rs-deposit-address-dropdown-item ${chainId === sourceChainId ? "rs-deposit-address-dropdown-item--active" : ""}`,
|
|
1737
|
-
onClick: () =>
|
|
1738
|
-
setSourceChainId(chainId);
|
|
1739
|
-
setChainDropdownOpen(false);
|
|
1740
|
-
},
|
|
1831
|
+
onClick: () => handleSelectChain(chainId),
|
|
1741
1832
|
children: [
|
|
1742
1833
|
getChainIcon(chainId) && /* @__PURE__ */ jsx6(
|
|
1743
1834
|
"img",
|
|
@@ -1758,7 +1849,7 @@ function DepositAddressStep({
|
|
|
1758
1849
|
/* @__PURE__ */ jsx6("span", { children: "Supported token" }),
|
|
1759
1850
|
/* @__PURE__ */ jsxs6("span", { className: "rs-deposit-address-min", children: [
|
|
1760
1851
|
"Min.$",
|
|
1761
|
-
(uiConfig?.minDepositUsd ?? 0.1).toFixed(2),
|
|
1852
|
+
(targetChain === HYPERCORE_CHAIN_ID ? Math.max(HYPERCORE_MIN_DEPOSIT_USD, uiConfig?.minDepositUsd ?? 0) : uiConfig?.minDepositUsd ?? 0.1).toFixed(2),
|
|
1762
1853
|
/* @__PURE__ */ jsx6(Tooltip, { content: "Minimum deposit amount required for the selected chain.", children: /* @__PURE__ */ jsx6(
|
|
1763
1854
|
InfoIcon,
|
|
1764
1855
|
{
|
|
@@ -1822,38 +1913,17 @@ function DepositAddressStep({
|
|
|
1822
1913
|
{
|
|
1823
1914
|
style: { display: "flex", flexDirection: "column", gap: 4, width: "100%" },
|
|
1824
1915
|
children: [
|
|
1916
|
+
/* @__PURE__ */ jsxs6("div", { className: "rs-deposit-address-well", children: [
|
|
1917
|
+
/* @__PURE__ */ jsx6("div", { className: "rs-deposit-address-qr", children: /* @__PURE__ */ jsx6(
|
|
1918
|
+
Suspense,
|
|
1919
|
+
{
|
|
1920
|
+
fallback: /* @__PURE__ */ jsx6("div", { className: "rs-skeleton rs-skeleton-qr", "aria-hidden": "true" }),
|
|
1921
|
+
children: /* @__PURE__ */ jsx6(QRCode, { value: displayAddress, size: 190, iconSrc: qrIconSrc })
|
|
1922
|
+
}
|
|
1923
|
+
) }),
|
|
1924
|
+
/* @__PURE__ */ jsx6("div", { className: "rs-deposit-address-value", children: displayAddress })
|
|
1925
|
+
] }),
|
|
1825
1926
|
/* @__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
1927
|
"button",
|
|
1858
1928
|
{
|
|
1859
1929
|
type: "button",
|
|
@@ -1868,6 +1938,7 @@ function DepositAddressStep({
|
|
|
1868
1938
|
]
|
|
1869
1939
|
}
|
|
1870
1940
|
),
|
|
1941
|
+
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
1942
|
/* @__PURE__ */ jsxs6(
|
|
1872
1943
|
"div",
|
|
1873
1944
|
{
|
|
@@ -1881,94 +1952,880 @@ function DepositAddressStep({
|
|
|
1881
1952
|
onClick: () => setPriceImpactExpanded((v) => !v),
|
|
1882
1953
|
"aria-expanded": priceImpactExpanded,
|
|
1883
1954
|
children: [
|
|
1884
|
-
/* @__PURE__ */ jsxs6("span", { className: "rs-price-impact-header-left", children: [
|
|
1885
|
-
/* @__PURE__ */ jsx6("span", { className: "rs-price-impact-label", children: "Price impact" }),
|
|
1886
|
-
/* @__PURE__ */ jsx6("span", { className: "rs-price-impact-label", children: /* @__PURE__ */ jsx6("strong", { children: "0.00%" }) }),
|
|
1887
|
-
/* @__PURE__ */ jsx6(
|
|
1888
|
-
Tooltip,
|
|
1889
|
-
{
|
|
1890
|
-
className: "rs-price-impact-info",
|
|
1891
|
-
content: "Price impact is the difference between expected and execution price, due to trade size and liquidity.",
|
|
1892
|
-
children: /* @__PURE__ */ jsx6(InfoIcon, { "aria-hidden": "true" })
|
|
1893
|
-
}
|
|
1894
|
-
)
|
|
1895
|
-
] }),
|
|
1896
|
-
/* @__PURE__ */ jsx6(
|
|
1897
|
-
ChevronDownIcon,
|
|
1898
|
-
{
|
|
1899
|
-
className: "rs-price-impact-chevron",
|
|
1900
|
-
"aria-hidden": "true"
|
|
1901
|
-
}
|
|
1902
|
-
)
|
|
1955
|
+
/* @__PURE__ */ jsxs6("span", { className: "rs-price-impact-header-left", children: [
|
|
1956
|
+
/* @__PURE__ */ jsx6("span", { className: "rs-price-impact-label", children: "Price impact" }),
|
|
1957
|
+
/* @__PURE__ */ jsx6("span", { className: "rs-price-impact-label", children: /* @__PURE__ */ jsx6("strong", { children: "0.00%" }) }),
|
|
1958
|
+
/* @__PURE__ */ jsx6(
|
|
1959
|
+
Tooltip,
|
|
1960
|
+
{
|
|
1961
|
+
className: "rs-price-impact-info",
|
|
1962
|
+
content: "Price impact is the difference between expected and execution price, due to trade size and liquidity.",
|
|
1963
|
+
children: /* @__PURE__ */ jsx6(InfoIcon, { "aria-hidden": "true" })
|
|
1964
|
+
}
|
|
1965
|
+
)
|
|
1966
|
+
] }),
|
|
1967
|
+
/* @__PURE__ */ jsx6(
|
|
1968
|
+
ChevronDownIcon,
|
|
1969
|
+
{
|
|
1970
|
+
className: "rs-price-impact-chevron",
|
|
1971
|
+
"aria-hidden": "true"
|
|
1972
|
+
}
|
|
1973
|
+
)
|
|
1974
|
+
]
|
|
1975
|
+
}
|
|
1976
|
+
),
|
|
1977
|
+
/* @__PURE__ */ jsx6("div", { className: "rs-price-impact-panel", children: /* @__PURE__ */ jsxs6("div", { className: "rs-price-impact-panel-inner", children: [
|
|
1978
|
+
/* @__PURE__ */ jsxs6("div", { className: "rs-price-impact-row", children: [
|
|
1979
|
+
/* @__PURE__ */ jsx6("span", { className: "rs-price-impact-row-icon", "aria-hidden": "true", children: /* @__PURE__ */ jsx6(PercentIcon, {}) }),
|
|
1980
|
+
/* @__PURE__ */ jsxs6("span", { className: "rs-price-impact-label", children: [
|
|
1981
|
+
"Max slippage: ",
|
|
1982
|
+
/* @__PURE__ */ jsx6("strong", { children: "0.2%" })
|
|
1983
|
+
] }),
|
|
1984
|
+
/* @__PURE__ */ jsx6(
|
|
1985
|
+
Tooltip,
|
|
1986
|
+
{
|
|
1987
|
+
className: "rs-price-impact-info",
|
|
1988
|
+
content: "Slippage accounts for price changes during execution. Slippage is adjusted per pair to ensure reliable execution.",
|
|
1989
|
+
children: /* @__PURE__ */ jsx6(InfoIcon, { "aria-hidden": "true" })
|
|
1990
|
+
}
|
|
1991
|
+
)
|
|
1992
|
+
] }),
|
|
1993
|
+
/* @__PURE__ */ jsxs6("div", { className: "rs-price-impact-row", children: [
|
|
1994
|
+
/* @__PURE__ */ jsx6("span", { className: "rs-price-impact-row-icon", "aria-hidden": "true", children: /* @__PURE__ */ jsx6(ClockIcon, {}) }),
|
|
1995
|
+
/* @__PURE__ */ jsxs6("span", { className: "rs-price-impact-label", children: [
|
|
1996
|
+
"Processing time: ",
|
|
1997
|
+
/* @__PURE__ */ jsx6("strong", { children: "< 1 min" })
|
|
1998
|
+
] })
|
|
1999
|
+
] }),
|
|
2000
|
+
/* @__PURE__ */ jsxs6("div", { className: "rs-price-impact-row", children: [
|
|
2001
|
+
/* @__PURE__ */ jsx6("span", { className: "rs-price-impact-row-icon", "aria-hidden": "true", children: /* @__PURE__ */ jsx6(PlusCircleIcon, {}) }),
|
|
2002
|
+
/* @__PURE__ */ jsxs6("span", { className: "rs-price-impact-label", children: [
|
|
2003
|
+
"Max deposit:",
|
|
2004
|
+
" ",
|
|
2005
|
+
/* @__PURE__ */ jsx6("strong", { children: liquidityHelper.kind === "max" ? `${formatUnits3(
|
|
2006
|
+
BigInt(liquidityHelper.maxAmount),
|
|
2007
|
+
liquidityHelper.decimals
|
|
2008
|
+
)} ${liquidityHelper.symbol}` : liquidityHelper.kind === "unlimited" ? "Unlimited" : liquidityHelper.kind === "unavailable" ? "Unavailable" : liquidityHelper.kind === "error" ? "\u2014" : "\u2026" })
|
|
2009
|
+
] })
|
|
2010
|
+
] })
|
|
2011
|
+
] }) })
|
|
2012
|
+
]
|
|
2013
|
+
}
|
|
2014
|
+
),
|
|
2015
|
+
pollingError && /* @__PURE__ */ jsx6("div", { className: "rs-deposit-address-error", children: pollingError })
|
|
2016
|
+
] }),
|
|
2017
|
+
notifications.length > 0 && /* @__PURE__ */ jsx6("div", { className: "rs-deposit-notifications", children: notifications.map((deposit) => /* @__PURE__ */ jsx6(
|
|
2018
|
+
DepositNotification,
|
|
2019
|
+
{
|
|
2020
|
+
deposit,
|
|
2021
|
+
smartAccount,
|
|
2022
|
+
solanaDepositAddress,
|
|
2023
|
+
targetChain,
|
|
2024
|
+
targetToken,
|
|
2025
|
+
hasPostBridgeActions,
|
|
2026
|
+
service,
|
|
2027
|
+
onComplete: handleNotificationComplete,
|
|
2028
|
+
onFailed: handleNotificationFailed,
|
|
2029
|
+
onDismiss: handleNotificationDismiss
|
|
2030
|
+
},
|
|
2031
|
+
deposit.id
|
|
2032
|
+
)) }),
|
|
2033
|
+
/* @__PURE__ */ jsx6(PoweredBy, {})
|
|
2034
|
+
] });
|
|
2035
|
+
}
|
|
2036
|
+
DepositAddressStep.displayName = "DepositAddressStep";
|
|
2037
|
+
|
|
2038
|
+
// src/components/steps/FiatOnrampStep.tsx
|
|
2039
|
+
import { useCallback as useCallback3 } from "react";
|
|
2040
|
+
|
|
2041
|
+
// src/components/steps/SwappedIframeStep.tsx
|
|
2042
|
+
import { useState as useState6, useEffect as useEffect6, useRef as useRef6, useMemo as useMemo4 } from "react";
|
|
2043
|
+
|
|
2044
|
+
// src/components/steps/SwappedOrderTracker.tsx
|
|
2045
|
+
import { jsx as jsx7, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
2046
|
+
var STEP_LABELS = [
|
|
2047
|
+
"Payment received",
|
|
2048
|
+
null,
|
|
2049
|
+
"Processing App deposit",
|
|
2050
|
+
"Deposit successful"
|
|
2051
|
+
];
|
|
2052
|
+
function SwappedOrderTracker({
|
|
2053
|
+
amount,
|
|
2054
|
+
currency = "USDC",
|
|
2055
|
+
chainLabel = "Base",
|
|
2056
|
+
stepStates,
|
|
2057
|
+
terminal = null,
|
|
2058
|
+
onRetry
|
|
2059
|
+
}) {
|
|
2060
|
+
const formattedAmount = formatTrackerAmount(amount);
|
|
2061
|
+
const title = terminal ? terminal.kind === "cancelled" ? "Order cancelled" : "Deposit failed" : formattedAmount ? `Depositing ${formattedAmount} ${currency}` : `Depositing ${currency}`;
|
|
2062
|
+
const labels = [
|
|
2063
|
+
STEP_LABELS[0],
|
|
2064
|
+
`${currency} received on ${chainLabel}`,
|
|
2065
|
+
STEP_LABELS[2],
|
|
2066
|
+
STEP_LABELS[3]
|
|
2067
|
+
];
|
|
2068
|
+
return /* @__PURE__ */ jsxs7("div", { className: "rs-screen rs-swapped-tracker", children: [
|
|
2069
|
+
/* @__PURE__ */ jsxs7("div", { className: "rs-screen-body rs-screen-body--gap-32", children: [
|
|
2070
|
+
/* @__PURE__ */ jsx7(BodyHeader, { icon: /* @__PURE__ */ jsx7(HandCoinsIcon, {}), title }),
|
|
2071
|
+
/* @__PURE__ */ jsx7("ol", { className: "rs-swapped-tracker-steps", children: labels.map((label, idx) => {
|
|
2072
|
+
const status = stepStates[idx];
|
|
2073
|
+
return /* @__PURE__ */ jsxs7(
|
|
2074
|
+
"li",
|
|
2075
|
+
{
|
|
2076
|
+
className: `rs-swapped-tracker-step rs-swapped-tracker-step--${status}`,
|
|
2077
|
+
children: [
|
|
2078
|
+
/* @__PURE__ */ jsx7("span", { className: "rs-swapped-tracker-step-label", children: label }),
|
|
2079
|
+
/* @__PURE__ */ jsx7(
|
|
2080
|
+
"span",
|
|
2081
|
+
{
|
|
2082
|
+
className: "rs-swapped-tracker-step-marker",
|
|
2083
|
+
"aria-hidden": "true",
|
|
2084
|
+
children: status === "complete" ? /* @__PURE__ */ jsx7(CheckIcon, {}) : status === "failed" ? /* @__PURE__ */ jsx7(CloseIcon, {}) : status === "active" ? /* @__PURE__ */ jsx7(Spinner, {}) : null
|
|
2085
|
+
}
|
|
2086
|
+
)
|
|
2087
|
+
]
|
|
2088
|
+
},
|
|
2089
|
+
label
|
|
2090
|
+
);
|
|
2091
|
+
}) }),
|
|
2092
|
+
terminal && /* @__PURE__ */ jsxs7(
|
|
2093
|
+
"div",
|
|
2094
|
+
{
|
|
2095
|
+
className: `rs-swapped-tracker-terminal rs-swapped-tracker-terminal--${terminal.kind}`,
|
|
2096
|
+
children: [
|
|
2097
|
+
/* @__PURE__ */ jsx7("p", { className: "rs-swapped-tracker-terminal-message", children: terminal.message }),
|
|
2098
|
+
terminal.kind === "cancelled" && onRetry && /* @__PURE__ */ jsx7(
|
|
2099
|
+
"button",
|
|
2100
|
+
{
|
|
2101
|
+
type: "button",
|
|
2102
|
+
className: "rs-swapped-tracker-retry",
|
|
2103
|
+
onClick: onRetry,
|
|
2104
|
+
children: "Try again"
|
|
2105
|
+
}
|
|
2106
|
+
)
|
|
2107
|
+
]
|
|
2108
|
+
}
|
|
2109
|
+
)
|
|
2110
|
+
] }),
|
|
2111
|
+
/* @__PURE__ */ jsx7(PoweredBy, {})
|
|
2112
|
+
] });
|
|
2113
|
+
}
|
|
2114
|
+
function formatTrackerAmount(amount) {
|
|
2115
|
+
if (!amount) return null;
|
|
2116
|
+
const num = Number(amount);
|
|
2117
|
+
if (!Number.isFinite(num)) return amount;
|
|
2118
|
+
return num.toFixed(2);
|
|
2119
|
+
}
|
|
2120
|
+
SwappedOrderTracker.displayName = "SwappedOrderTracker";
|
|
2121
|
+
|
|
2122
|
+
// src/components/steps/SwappedIframeStep.tsx
|
|
2123
|
+
import { jsx as jsx8, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
2124
|
+
var STATUS_POLL_INTERVAL_MS = 2e3;
|
|
2125
|
+
var DEPOSIT_POLL_INTERVAL_MS = 2e3;
|
|
2126
|
+
var DEPOSIT_POLL_FAST_INITIAL_DELAY_MS = 1e3;
|
|
2127
|
+
var DEPOSIT_POLL_FAST_INTERVAL_MS = 500;
|
|
2128
|
+
var IFRAME_LOAD_TIMEOUT_MS = 15e3;
|
|
2129
|
+
var SWAPPED_IFRAME_ORIGINS = /* @__PURE__ */ new Set([
|
|
2130
|
+
"https://sandbox.swapped.com",
|
|
2131
|
+
"https://widget.swapped.com"
|
|
2132
|
+
]);
|
|
2133
|
+
var SWAPPED_TERMINAL_STATUSES = /* @__PURE__ */ new Set([
|
|
2134
|
+
"order_completed",
|
|
2135
|
+
"order_broadcasted"
|
|
2136
|
+
]);
|
|
2137
|
+
var SWAPPED_STATUS_VALUES = /* @__PURE__ */ new Set([
|
|
2138
|
+
"payment_pending",
|
|
2139
|
+
"order_completed",
|
|
2140
|
+
"order_broadcasted",
|
|
2141
|
+
"order_cancelled"
|
|
2142
|
+
]);
|
|
2143
|
+
function parseSwappedIframeMessage(raw) {
|
|
2144
|
+
let data = raw;
|
|
2145
|
+
if (typeof data === "string") {
|
|
2146
|
+
try {
|
|
2147
|
+
data = JSON.parse(data);
|
|
2148
|
+
} catch {
|
|
2149
|
+
return null;
|
|
2150
|
+
}
|
|
2151
|
+
}
|
|
2152
|
+
if (!data || typeof data !== "object") return null;
|
|
2153
|
+
const obj = data;
|
|
2154
|
+
const inner = obj.data && typeof obj.data === "object" ? obj.data : obj;
|
|
2155
|
+
const rawStatus = inner.order_status ?? inner.status ?? obj.status;
|
|
2156
|
+
if (typeof rawStatus !== "string" || !SWAPPED_STATUS_VALUES.has(rawStatus)) {
|
|
2157
|
+
return null;
|
|
2158
|
+
}
|
|
2159
|
+
const asString2 = (v) => typeof v === "string" && v.length > 0 ? v : void 0;
|
|
2160
|
+
return {
|
|
2161
|
+
status: rawStatus,
|
|
2162
|
+
orderId: asString2(inner.order_id) ?? asString2(obj.orderId),
|
|
2163
|
+
orderCrypto: asString2(inner.order_crypto) ?? asString2(obj.orderCrypto),
|
|
2164
|
+
orderCryptoAmount: asString2(inner.order_crypto_amount) ?? asString2(obj.orderCryptoAmount),
|
|
2165
|
+
transactionId: asString2(inner.transaction_id) ?? asString2(obj.transactionId)
|
|
2166
|
+
};
|
|
2167
|
+
}
|
|
2168
|
+
function SwappedIframeStep({
|
|
2169
|
+
smartAccount,
|
|
2170
|
+
service,
|
|
2171
|
+
variant,
|
|
2172
|
+
loadUrl,
|
|
2173
|
+
iframeTitle,
|
|
2174
|
+
loadErrorCode,
|
|
2175
|
+
loadErrorFallback,
|
|
2176
|
+
bannerForStatus,
|
|
2177
|
+
onSwappedComplete,
|
|
2178
|
+
onSwappedFailed,
|
|
2179
|
+
onClose,
|
|
2180
|
+
onError
|
|
2181
|
+
}) {
|
|
2182
|
+
const [widgetUrl, setWidgetUrl] = useState6(null);
|
|
2183
|
+
const [loadError, setLoadError] = useState6(null);
|
|
2184
|
+
const [iframeLoaded, setIframeLoaded] = useState6(false);
|
|
2185
|
+
const [retryToken, setRetryToken] = useState6(0);
|
|
2186
|
+
const [orderState, setOrderState] = useState6(null);
|
|
2187
|
+
const [latestEvent, setLatestEvent] = useState6(null);
|
|
2188
|
+
const [phase, setPhase] = useState6("iframe");
|
|
2189
|
+
const completeFiredRef = useRef6(false);
|
|
2190
|
+
const failedFiredRef = useRef6(false);
|
|
2191
|
+
const expectedOrderUuidRef = useRef6(null);
|
|
2192
|
+
const baselineDepositTxHashRef = useRef6(void 0);
|
|
2193
|
+
const currentDepositTxHashRef = useRef6(null);
|
|
2194
|
+
const fastDepositPollEnabledRef = useRef6(false);
|
|
2195
|
+
const rescheduleDepositPollRef = useRef6(
|
|
2196
|
+
null
|
|
2197
|
+
);
|
|
2198
|
+
const onSwappedCompleteRef = useRef6(onSwappedComplete);
|
|
2199
|
+
onSwappedCompleteRef.current = onSwappedComplete;
|
|
2200
|
+
const onSwappedFailedRef = useRef6(onSwappedFailed);
|
|
2201
|
+
onSwappedFailedRef.current = onSwappedFailed;
|
|
2202
|
+
const onErrorRef = useRef6(onError);
|
|
2203
|
+
onErrorRef.current = onError;
|
|
2204
|
+
const loadUrlRef = useRef6(loadUrl);
|
|
2205
|
+
loadUrlRef.current = loadUrl;
|
|
2206
|
+
useEffect6(() => {
|
|
2207
|
+
let cancelled = false;
|
|
2208
|
+
setLoadError(null);
|
|
2209
|
+
setIframeLoaded(false);
|
|
2210
|
+
setWidgetUrl(null);
|
|
2211
|
+
setOrderState(null);
|
|
2212
|
+
setLatestEvent(null);
|
|
2213
|
+
setPhase("iframe");
|
|
2214
|
+
expectedOrderUuidRef.current = null;
|
|
2215
|
+
completeFiredRef.current = false;
|
|
2216
|
+
failedFiredRef.current = false;
|
|
2217
|
+
baselineDepositTxHashRef.current = void 0;
|
|
2218
|
+
currentDepositTxHashRef.current = null;
|
|
2219
|
+
fastDepositPollEnabledRef.current = false;
|
|
2220
|
+
loadUrlRef.current().then((res) => {
|
|
2221
|
+
if (cancelled) return;
|
|
2222
|
+
setWidgetUrl(res.url);
|
|
2223
|
+
const sep = res.externalCustomerId.indexOf(":");
|
|
2224
|
+
expectedOrderUuidRef.current = sep >= 0 ? res.externalCustomerId.slice(sep + 1) : null;
|
|
2225
|
+
}).catch((err) => {
|
|
2226
|
+
if (cancelled) return;
|
|
2227
|
+
const message = err instanceof Error ? err.message : loadErrorFallback;
|
|
2228
|
+
setLoadError(message);
|
|
2229
|
+
onErrorRef.current?.(message, loadErrorCode);
|
|
2230
|
+
});
|
|
2231
|
+
return () => {
|
|
2232
|
+
cancelled = true;
|
|
2233
|
+
};
|
|
2234
|
+
}, [service, smartAccount, retryToken, loadErrorCode, loadErrorFallback]);
|
|
2235
|
+
useEffect6(() => {
|
|
2236
|
+
if (!widgetUrl || iframeLoaded || loadError) return;
|
|
2237
|
+
const timer = setTimeout(() => {
|
|
2238
|
+
setLoadError("Iframe took too long to load.");
|
|
2239
|
+
}, IFRAME_LOAD_TIMEOUT_MS);
|
|
2240
|
+
return () => clearTimeout(timer);
|
|
2241
|
+
}, [widgetUrl, iframeLoaded, loadError]);
|
|
2242
|
+
useEffect6(() => {
|
|
2243
|
+
let cancelled = false;
|
|
2244
|
+
let timeoutId;
|
|
2245
|
+
async function poll() {
|
|
2246
|
+
if (cancelled) return;
|
|
2247
|
+
try {
|
|
2248
|
+
const res = await service.fetchSwappedOrderStatus(smartAccount);
|
|
2249
|
+
if (cancelled) return;
|
|
2250
|
+
const isCurrentOrder = res !== null && expectedOrderUuidRef.current !== null && res.orderId === expectedOrderUuidRef.current;
|
|
2251
|
+
if (isCurrentOrder) {
|
|
2252
|
+
setOrderState(res);
|
|
2253
|
+
}
|
|
2254
|
+
} catch {
|
|
2255
|
+
}
|
|
2256
|
+
if (!cancelled) {
|
|
2257
|
+
timeoutId = setTimeout(poll, STATUS_POLL_INTERVAL_MS);
|
|
2258
|
+
}
|
|
2259
|
+
}
|
|
2260
|
+
poll();
|
|
2261
|
+
return () => {
|
|
2262
|
+
cancelled = true;
|
|
2263
|
+
clearTimeout(timeoutId);
|
|
2264
|
+
};
|
|
2265
|
+
}, [service, smartAccount]);
|
|
2266
|
+
useEffect6(() => {
|
|
2267
|
+
let cancelled = false;
|
|
2268
|
+
let timeoutId;
|
|
2269
|
+
async function pollDeposit() {
|
|
2270
|
+
if (cancelled) return;
|
|
2271
|
+
try {
|
|
2272
|
+
const status = await service.fetchLatestStatus(smartAccount);
|
|
2273
|
+
if (cancelled) return;
|
|
2274
|
+
const event = status.lastEvent;
|
|
2275
|
+
const eventTxHash = isDepositEvent(event) ? getEventTxHash(event) ?? null : null;
|
|
2276
|
+
if (baselineDepositTxHashRef.current === void 0) {
|
|
2277
|
+
baselineDepositTxHashRef.current = eventTxHash;
|
|
2278
|
+
} else if (eventTxHash && (!baselineDepositTxHashRef.current || !txRefsMatch(eventTxHash, baselineDepositTxHashRef.current))) {
|
|
2279
|
+
currentDepositTxHashRef.current = eventTxHash;
|
|
2280
|
+
setLatestEvent(event ?? null);
|
|
2281
|
+
}
|
|
2282
|
+
} catch {
|
|
2283
|
+
}
|
|
2284
|
+
if (!cancelled) {
|
|
2285
|
+
const nextInterval = fastDepositPollEnabledRef.current ? DEPOSIT_POLL_FAST_INTERVAL_MS : DEPOSIT_POLL_INTERVAL_MS;
|
|
2286
|
+
timeoutId = setTimeout(pollDeposit, nextInterval);
|
|
2287
|
+
}
|
|
2288
|
+
}
|
|
2289
|
+
rescheduleDepositPollRef.current = (delayMs) => {
|
|
2290
|
+
if (cancelled) return;
|
|
2291
|
+
if (timeoutId !== void 0) clearTimeout(timeoutId);
|
|
2292
|
+
timeoutId = setTimeout(pollDeposit, delayMs);
|
|
2293
|
+
};
|
|
2294
|
+
pollDeposit();
|
|
2295
|
+
return () => {
|
|
2296
|
+
cancelled = true;
|
|
2297
|
+
if (timeoutId !== void 0) clearTimeout(timeoutId);
|
|
2298
|
+
rescheduleDepositPollRef.current = null;
|
|
2299
|
+
};
|
|
2300
|
+
}, [service, smartAccount]);
|
|
2301
|
+
useEffect6(() => {
|
|
2302
|
+
if (fastDepositPollEnabledRef.current) return;
|
|
2303
|
+
const status = orderState?.status;
|
|
2304
|
+
if (!status || !SWAPPED_TERMINAL_STATUSES.has(status)) return;
|
|
2305
|
+
fastDepositPollEnabledRef.current = true;
|
|
2306
|
+
rescheduleDepositPollRef.current?.(DEPOSIT_POLL_FAST_INITIAL_DELAY_MS);
|
|
2307
|
+
}, [orderState]);
|
|
2308
|
+
useEffect6(() => {
|
|
2309
|
+
function onMessage(e) {
|
|
2310
|
+
if (!SWAPPED_IFRAME_ORIGINS.has(e.origin)) return;
|
|
2311
|
+
const parsed = parseSwappedIframeMessage(e.data);
|
|
2312
|
+
if (!parsed) return;
|
|
2313
|
+
setOrderState((prev) => ({
|
|
2314
|
+
orderId: parsed.orderId ?? prev?.orderId ?? "",
|
|
2315
|
+
status: parsed.status,
|
|
2316
|
+
orderCrypto: parsed.orderCrypto ?? prev?.orderCrypto ?? null,
|
|
2317
|
+
orderCryptoAmount: parsed.orderCryptoAmount ?? prev?.orderCryptoAmount ?? null,
|
|
2318
|
+
transactionId: parsed.transactionId ?? prev?.transactionId ?? null,
|
|
2319
|
+
receivedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
2320
|
+
paidAmountUsd: prev?.paidAmountUsd ?? null,
|
|
2321
|
+
paidAmountEur: prev?.paidAmountEur ?? null,
|
|
2322
|
+
onrampFeeUsd: prev?.onrampFeeUsd ?? null,
|
|
2323
|
+
paymentMethod: prev?.paymentMethod ?? null
|
|
2324
|
+
}));
|
|
2325
|
+
}
|
|
2326
|
+
window.addEventListener("message", onMessage);
|
|
2327
|
+
return () => window.removeEventListener("message", onMessage);
|
|
2328
|
+
}, []);
|
|
2329
|
+
useEffect6(() => {
|
|
2330
|
+
if (phase === "iframe" && orderState !== null) {
|
|
2331
|
+
setPhase("tracker");
|
|
2332
|
+
}
|
|
2333
|
+
}, [phase, orderState]);
|
|
2334
|
+
const stepStates = useMemo4(
|
|
2335
|
+
() => deriveStepStates(orderState?.status ?? null, latestEvent),
|
|
2336
|
+
[orderState, latestEvent]
|
|
2337
|
+
);
|
|
2338
|
+
const terminalState = useMemo4(() => {
|
|
2339
|
+
if (isFailedEvent(latestEvent ?? void 0)) {
|
|
2340
|
+
return {
|
|
2341
|
+
kind: "failed",
|
|
2342
|
+
message: failureMessageForEvent(latestEvent ?? void 0)
|
|
2343
|
+
};
|
|
2344
|
+
}
|
|
2345
|
+
if (orderState?.status === "order_cancelled") {
|
|
2346
|
+
const banner = bannerForStatus("order_cancelled", {});
|
|
2347
|
+
return { kind: "cancelled", message: banner.detail ?? banner.title };
|
|
2348
|
+
}
|
|
2349
|
+
return null;
|
|
2350
|
+
}, [latestEvent, orderState, bannerForStatus]);
|
|
2351
|
+
useEffect6(() => {
|
|
2352
|
+
if (completeFiredRef.current || failedFiredRef.current) return;
|
|
2353
|
+
const t = latestEvent?.type;
|
|
2354
|
+
const isSuccess = t === "bridge-complete" || t === "post-bridge-swap-complete";
|
|
2355
|
+
if (!isSuccess) return;
|
|
2356
|
+
const txHash = currentDepositTxHashRef.current;
|
|
2357
|
+
if (!txHash) return;
|
|
2358
|
+
completeFiredRef.current = true;
|
|
2359
|
+
onSwappedCompleteRef.current({
|
|
2360
|
+
txHash,
|
|
2361
|
+
orderCrypto: orderState?.orderCrypto ?? null,
|
|
2362
|
+
// Base-unit source amount from the deposit row/event, consistent with the
|
|
2363
|
+
// wallet/QR path. ProcessingStep + onLifecycle expect base units.
|
|
2364
|
+
amount: getEventSourceDetails(latestEvent ?? void 0).amount ?? null
|
|
2365
|
+
});
|
|
2366
|
+
}, [latestEvent, orderState]);
|
|
2367
|
+
useEffect6(() => {
|
|
2368
|
+
if (failedFiredRef.current || completeFiredRef.current) return;
|
|
2369
|
+
if (!isFailedEvent(latestEvent ?? void 0)) return;
|
|
2370
|
+
const txHash = currentDepositTxHashRef.current;
|
|
2371
|
+
if (!txHash) return;
|
|
2372
|
+
failedFiredRef.current = true;
|
|
2373
|
+
setPhase("tracker");
|
|
2374
|
+
onSwappedFailedRef.current?.(
|
|
2375
|
+
txHash,
|
|
2376
|
+
failureMessageForEvent(latestEvent ?? void 0)
|
|
2377
|
+
);
|
|
2378
|
+
}, [latestEvent]);
|
|
2379
|
+
if (phase === "tracker") {
|
|
2380
|
+
return /* @__PURE__ */ jsx8(
|
|
2381
|
+
SwappedOrderTracker,
|
|
2382
|
+
{
|
|
2383
|
+
amount: orderState?.orderCryptoAmount ?? null,
|
|
2384
|
+
currency: orderState?.orderCrypto ?? "USDC",
|
|
2385
|
+
stepStates,
|
|
2386
|
+
terminal: terminalState,
|
|
2387
|
+
onRetry: () => setRetryToken((n) => n + 1),
|
|
2388
|
+
onClose
|
|
2389
|
+
}
|
|
2390
|
+
);
|
|
2391
|
+
}
|
|
2392
|
+
return /* @__PURE__ */ jsxs8("div", { className: "rs-screen rs-fiat-onramp", "data-variant": variant, children: [
|
|
2393
|
+
/* @__PURE__ */ jsxs8("div", { className: "rs-screen-body rs-screen-body--gap-32", children: [
|
|
2394
|
+
/* @__PURE__ */ jsx8(
|
|
2395
|
+
BodyHeader,
|
|
2396
|
+
{
|
|
2397
|
+
icon: /* @__PURE__ */ jsx8(HandCoinsIcon, {}),
|
|
2398
|
+
title: "Deposit",
|
|
2399
|
+
subtitle: "Add money to your balance"
|
|
2400
|
+
}
|
|
2401
|
+
),
|
|
2402
|
+
/* @__PURE__ */ jsxs8("div", { className: "rs-fiat-onramp-iframe-wrap", children: [
|
|
2403
|
+
loadError && /* @__PURE__ */ jsxs8("div", { className: "rs-fiat-onramp-error", children: [
|
|
2404
|
+
/* @__PURE__ */ jsx8("div", { children: loadError }),
|
|
2405
|
+
/* @__PURE__ */ jsx8(
|
|
2406
|
+
"button",
|
|
2407
|
+
{
|
|
2408
|
+
type: "button",
|
|
2409
|
+
className: "rs-fiat-onramp-retry",
|
|
2410
|
+
onClick: () => setRetryToken((n) => n + 1),
|
|
2411
|
+
children: "Retry"
|
|
2412
|
+
}
|
|
2413
|
+
)
|
|
2414
|
+
] }),
|
|
2415
|
+
!loadError && !iframeLoaded && /* @__PURE__ */ jsx8("div", { className: "rs-fiat-onramp-loading", children: /* @__PURE__ */ jsx8(Spinner, {}) }),
|
|
2416
|
+
widgetUrl && !loadError && /* @__PURE__ */ jsx8(
|
|
2417
|
+
"iframe",
|
|
2418
|
+
{
|
|
2419
|
+
src: widgetUrl,
|
|
2420
|
+
title: iframeTitle,
|
|
2421
|
+
className: "rs-fiat-onramp-iframe",
|
|
2422
|
+
sandbox: "allow-scripts allow-forms allow-same-origin allow-popups allow-popups-to-escape-sandbox allow-top-navigation-by-user-activation",
|
|
2423
|
+
allow: "payment; camera; microphone; clipboard-write; geolocation",
|
|
2424
|
+
onLoad: () => setIframeLoaded(true)
|
|
2425
|
+
},
|
|
2426
|
+
retryToken
|
|
2427
|
+
)
|
|
2428
|
+
] })
|
|
2429
|
+
] }),
|
|
2430
|
+
/* @__PURE__ */ jsx8(PoweredBy, {})
|
|
2431
|
+
] });
|
|
2432
|
+
}
|
|
2433
|
+
function deriveStepStates(swappedStatus, latestEvent) {
|
|
2434
|
+
if (isFailedEvent(latestEvent ?? void 0)) {
|
|
2435
|
+
return ["complete", "complete", "failed", "pending"];
|
|
2436
|
+
}
|
|
2437
|
+
if (swappedStatus === "order_cancelled") {
|
|
2438
|
+
return ["failed", "pending", "pending", "pending"];
|
|
2439
|
+
}
|
|
2440
|
+
const step1Complete = swappedStatus === "order_completed" || swappedStatus === "order_broadcasted";
|
|
2441
|
+
const step2Complete = latestEvent !== null;
|
|
2442
|
+
const step3Complete = latestEvent?.type === "bridge-complete" || latestEvent?.type === "post-bridge-swap-complete";
|
|
2443
|
+
if (step3Complete) {
|
|
2444
|
+
return ["complete", "complete", "complete", "pending"];
|
|
2445
|
+
}
|
|
2446
|
+
if (step2Complete) {
|
|
2447
|
+
return ["complete", "complete", "active", "pending"];
|
|
2448
|
+
}
|
|
2449
|
+
if (step1Complete) {
|
|
2450
|
+
return ["complete", "active", "pending", "pending"];
|
|
2451
|
+
}
|
|
2452
|
+
return ["active", "pending", "pending", "pending"];
|
|
2453
|
+
}
|
|
2454
|
+
SwappedIframeStep.displayName = "SwappedIframeStep";
|
|
2455
|
+
|
|
2456
|
+
// src/components/steps/FiatOnrampStep.tsx
|
|
2457
|
+
import { jsx as jsx9 } from "react/jsx-runtime";
|
|
2458
|
+
function fiatBannerForStatus(status, context) {
|
|
2459
|
+
if (context.currencyMismatch) {
|
|
2460
|
+
return {
|
|
2461
|
+
level: "warning",
|
|
2462
|
+
title: "Currency mismatch",
|
|
2463
|
+
detail: "Funds may not bridge automatically. Contact support if your balance does not arrive."
|
|
2464
|
+
};
|
|
2465
|
+
}
|
|
2466
|
+
switch (status) {
|
|
2467
|
+
case "payment_pending":
|
|
2468
|
+
return { level: "info", title: "Verifying payment\u2026" };
|
|
2469
|
+
case "order_completed":
|
|
2470
|
+
return { level: "success", title: "Payment received \u2014 sending crypto" };
|
|
2471
|
+
case "order_broadcasted":
|
|
2472
|
+
return {
|
|
2473
|
+
level: "success",
|
|
2474
|
+
title: "Crypto sent \u2014 confirming on-chain"
|
|
2475
|
+
};
|
|
2476
|
+
case "order_cancelled":
|
|
2477
|
+
return {
|
|
2478
|
+
level: "warning",
|
|
2479
|
+
title: "Order cancelled",
|
|
2480
|
+
detail: "If you were charged, Swapped will refund within 5 business days."
|
|
2481
|
+
};
|
|
2482
|
+
}
|
|
2483
|
+
}
|
|
2484
|
+
function FiatOnrampStep({
|
|
2485
|
+
smartAccount,
|
|
2486
|
+
service,
|
|
2487
|
+
paymentMethod,
|
|
2488
|
+
onSwappedComplete,
|
|
2489
|
+
onSwappedFailed,
|
|
2490
|
+
onClose,
|
|
2491
|
+
onError
|
|
2492
|
+
}) {
|
|
2493
|
+
const loadUrl = useCallback3(async () => {
|
|
2494
|
+
const res = await service.getSwappedWidgetUrl({
|
|
2495
|
+
smartAccount,
|
|
2496
|
+
method: paymentMethod
|
|
2497
|
+
});
|
|
2498
|
+
if (res.currencyCode !== "USDC_BASE") {
|
|
2499
|
+
console.warn(
|
|
2500
|
+
`[FiatOnrampStep] Expected backend to return currencyCode=USDC_BASE, got ${res.currencyCode}. Swapped purchases may not bridge as expected.`
|
|
2501
|
+
);
|
|
2502
|
+
}
|
|
2503
|
+
return res;
|
|
2504
|
+
}, [service, smartAccount, paymentMethod]);
|
|
2505
|
+
return /* @__PURE__ */ jsx9(
|
|
2506
|
+
SwappedIframeStep,
|
|
2507
|
+
{
|
|
2508
|
+
smartAccount,
|
|
2509
|
+
service,
|
|
2510
|
+
variant: "fiat",
|
|
2511
|
+
loadUrl,
|
|
2512
|
+
iframeTitle: "Buy crypto with Swapped",
|
|
2513
|
+
loadErrorCode: "SWAPPED_URL_FAILED",
|
|
2514
|
+
loadErrorFallback: "Failed to load on-ramp",
|
|
2515
|
+
bannerForStatus: fiatBannerForStatus,
|
|
2516
|
+
onSwappedComplete,
|
|
2517
|
+
onSwappedFailed,
|
|
2518
|
+
onClose,
|
|
2519
|
+
onError
|
|
2520
|
+
}
|
|
2521
|
+
);
|
|
2522
|
+
}
|
|
2523
|
+
FiatOnrampStep.displayName = "FiatOnrampStep";
|
|
2524
|
+
|
|
2525
|
+
// src/components/steps/ExchangeConnectStep.tsx
|
|
2526
|
+
import { useCallback as useCallback4 } from "react";
|
|
2527
|
+
import { jsx as jsx10 } from "react/jsx-runtime";
|
|
2528
|
+
function connectBannerForStatus(status, context) {
|
|
2529
|
+
if (context.currencyMismatch) {
|
|
2530
|
+
return {
|
|
2531
|
+
level: "warning",
|
|
2532
|
+
title: "Currency mismatch",
|
|
2533
|
+
detail: "Funds may not bridge automatically. Contact support if your balance does not arrive."
|
|
2534
|
+
};
|
|
2535
|
+
}
|
|
2536
|
+
switch (status) {
|
|
2537
|
+
case "payment_pending":
|
|
2538
|
+
return { level: "info", title: "Waiting for exchange transfer\u2026" };
|
|
2539
|
+
case "order_completed":
|
|
2540
|
+
return {
|
|
2541
|
+
level: "success",
|
|
2542
|
+
title: "Exchange transfer received \u2014 sending crypto"
|
|
2543
|
+
};
|
|
2544
|
+
case "order_broadcasted":
|
|
2545
|
+
return {
|
|
2546
|
+
level: "success",
|
|
2547
|
+
title: "Crypto sent \u2014 confirming on-chain"
|
|
2548
|
+
};
|
|
2549
|
+
case "order_cancelled":
|
|
2550
|
+
return {
|
|
2551
|
+
level: "warning",
|
|
2552
|
+
title: "Order cancelled",
|
|
2553
|
+
detail: "If your exchange already debited the funds, Swapped will refund within 5 business days."
|
|
2554
|
+
};
|
|
2555
|
+
}
|
|
2556
|
+
}
|
|
2557
|
+
function ExchangeConnectStep({
|
|
2558
|
+
smartAccount,
|
|
2559
|
+
service,
|
|
2560
|
+
connection,
|
|
2561
|
+
onSwappedComplete,
|
|
2562
|
+
onSwappedFailed,
|
|
2563
|
+
onClose,
|
|
2564
|
+
onError
|
|
2565
|
+
}) {
|
|
2566
|
+
const loadUrl = useCallback4(async () => {
|
|
2567
|
+
const res = await service.getSwappedConnectUrl({
|
|
2568
|
+
smartAccount,
|
|
2569
|
+
connection
|
|
2570
|
+
});
|
|
2571
|
+
if (res.currencyCode !== "USDC_BASE") {
|
|
2572
|
+
console.warn(
|
|
2573
|
+
`[ExchangeConnectStep] Expected backend to return currencyCode=USDC_BASE, got ${res.currencyCode}. Swapped Connect pulls may not bridge as expected.`
|
|
2574
|
+
);
|
|
2575
|
+
}
|
|
2576
|
+
return res;
|
|
2577
|
+
}, [service, smartAccount, connection]);
|
|
2578
|
+
return /* @__PURE__ */ jsx10(
|
|
2579
|
+
SwappedIframeStep,
|
|
2580
|
+
{
|
|
2581
|
+
smartAccount,
|
|
2582
|
+
service,
|
|
2583
|
+
variant: "connect",
|
|
2584
|
+
loadUrl,
|
|
2585
|
+
iframeTitle: "Fund from exchange via Swapped",
|
|
2586
|
+
loadErrorCode: "SWAPPED_CONNECT_URL_FAILED",
|
|
2587
|
+
loadErrorFallback: "Failed to load Connect",
|
|
2588
|
+
bannerForStatus: connectBannerForStatus,
|
|
2589
|
+
onSwappedComplete,
|
|
2590
|
+
onSwappedFailed,
|
|
2591
|
+
onClose,
|
|
2592
|
+
onError
|
|
2593
|
+
}
|
|
2594
|
+
);
|
|
2595
|
+
}
|
|
2596
|
+
ExchangeConnectStep.displayName = "ExchangeConnectStep";
|
|
2597
|
+
|
|
2598
|
+
// src/components/steps/ExchangeSelectStep.tsx
|
|
2599
|
+
import { useCallback as useCallback5, useEffect as useEffect7, useState as useState7 } from "react";
|
|
2600
|
+
import { jsx as jsx11, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
2601
|
+
function ExchangeLogo({ exchange }) {
|
|
2602
|
+
const [failed, setFailed] = useState7(false);
|
|
2603
|
+
if (!exchange.logoUrl || failed) {
|
|
2604
|
+
return /* @__PURE__ */ jsx11(BankIcon, {});
|
|
2605
|
+
}
|
|
2606
|
+
return /* @__PURE__ */ jsx11(
|
|
2607
|
+
"img",
|
|
2608
|
+
{
|
|
2609
|
+
src: exchange.logoUrl,
|
|
2610
|
+
alt: "",
|
|
2611
|
+
onError: () => setFailed(true)
|
|
2612
|
+
}
|
|
2613
|
+
);
|
|
2614
|
+
}
|
|
2615
|
+
function ExchangeSelectStep({
|
|
2616
|
+
service,
|
|
2617
|
+
onSelectExchange,
|
|
2618
|
+
onError
|
|
2619
|
+
}) {
|
|
2620
|
+
const [exchanges, setExchanges] = useState7([]);
|
|
2621
|
+
const [loading, setLoading] = useState7(true);
|
|
2622
|
+
const [error, setError] = useState7(null);
|
|
2623
|
+
const [retryToken, setRetryToken] = useState7(0);
|
|
2624
|
+
const retry = useCallback5(() => {
|
|
2625
|
+
setRetryToken((n) => n + 1);
|
|
2626
|
+
}, []);
|
|
2627
|
+
useEffect7(() => {
|
|
2628
|
+
let cancelled = false;
|
|
2629
|
+
setLoading(true);
|
|
2630
|
+
setError(null);
|
|
2631
|
+
service.getSwappedConnectExchanges().then((res) => {
|
|
2632
|
+
if (cancelled) return;
|
|
2633
|
+
setExchanges(res.exchanges);
|
|
2634
|
+
}).catch((err) => {
|
|
2635
|
+
if (cancelled) return;
|
|
2636
|
+
const message = err instanceof Error ? err.message : "Failed to load exchanges";
|
|
2637
|
+
setExchanges([]);
|
|
2638
|
+
setError(message);
|
|
2639
|
+
onError?.(message, "SWAPPED_CONNECT_EXCHANGES_FAILED");
|
|
2640
|
+
}).finally(() => {
|
|
2641
|
+
if (!cancelled) setLoading(false);
|
|
2642
|
+
});
|
|
2643
|
+
return () => {
|
|
2644
|
+
cancelled = true;
|
|
2645
|
+
};
|
|
2646
|
+
}, [service, retryToken, onError]);
|
|
2647
|
+
return /* @__PURE__ */ jsxs9("div", { className: "rs-screen rs-exchange-select", children: [
|
|
2648
|
+
/* @__PURE__ */ jsxs9("div", { className: "rs-screen-body rs-screen-body--gap-32", children: [
|
|
2649
|
+
/* @__PURE__ */ jsx11(
|
|
2650
|
+
BodyHeader,
|
|
2651
|
+
{
|
|
2652
|
+
icon: /* @__PURE__ */ jsx11(BankIcon, {}),
|
|
2653
|
+
title: "Fund from Exchange",
|
|
2654
|
+
subtitle: "Choose your exchange"
|
|
2655
|
+
}
|
|
2656
|
+
),
|
|
2657
|
+
loading && /* @__PURE__ */ jsx11("div", { className: "rs-exchange-select-state", "aria-live": "polite", children: /* @__PURE__ */ jsx11(Spinner, {}) }),
|
|
2658
|
+
!loading && error && /* @__PURE__ */ jsxs9("div", { className: "rs-exchange-select-state", "aria-live": "polite", children: [
|
|
2659
|
+
/* @__PURE__ */ jsx11("div", { className: "rs-exchange-select-state-title", children: "Couldn\u2019t load exchanges" }),
|
|
2660
|
+
/* @__PURE__ */ jsx11(
|
|
2661
|
+
"button",
|
|
2662
|
+
{
|
|
2663
|
+
type: "button",
|
|
2664
|
+
className: "rs-fiat-onramp-retry",
|
|
2665
|
+
onClick: retry,
|
|
2666
|
+
children: "Retry"
|
|
2667
|
+
}
|
|
2668
|
+
)
|
|
2669
|
+
] }),
|
|
2670
|
+
!loading && !error && exchanges.length === 0 && /* @__PURE__ */ jsxs9("div", { className: "rs-exchange-select-state", "aria-live": "polite", children: [
|
|
2671
|
+
/* @__PURE__ */ jsx11("div", { className: "rs-exchange-select-state-title", children: "No exchanges available" }),
|
|
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__ */ jsx11("div", { className: "rs-exchange-grid", children: exchanges.map((exchange) => /* @__PURE__ */ jsxs9(
|
|
2683
|
+
"button",
|
|
2684
|
+
{
|
|
2685
|
+
type: "button",
|
|
2686
|
+
className: "rs-exchange-card",
|
|
2687
|
+
onClick: () => onSelectExchange(exchange.connection),
|
|
2688
|
+
"aria-label": `Select ${exchange.name}`,
|
|
2689
|
+
children: [
|
|
2690
|
+
/* @__PURE__ */ jsx11("span", { className: "rs-exchange-card-logo", children: /* @__PURE__ */ jsx11(ExchangeLogo, { exchange }) }),
|
|
2691
|
+
/* @__PURE__ */ jsx11("span", { className: "rs-exchange-card-name", children: exchange.name })
|
|
2692
|
+
]
|
|
2693
|
+
},
|
|
2694
|
+
exchange.connection
|
|
2695
|
+
)) })
|
|
2696
|
+
] }),
|
|
2697
|
+
/* @__PURE__ */ jsx11(PoweredBy, {})
|
|
2698
|
+
] });
|
|
2699
|
+
}
|
|
2700
|
+
ExchangeSelectStep.displayName = "ExchangeSelectStep";
|
|
2701
|
+
|
|
2702
|
+
// src/components/steps/DepositAddressSkeleton.tsx
|
|
2703
|
+
import { jsx as jsx12, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
2704
|
+
var BASE_CHAIN_ID = 8453;
|
|
2705
|
+
function DepositAddressSkeleton({
|
|
2706
|
+
uiConfig,
|
|
2707
|
+
allowedRoutes
|
|
2708
|
+
}) {
|
|
2709
|
+
const allowedChainSet = allowedRoutes?.sourceChains ? new Set(allowedRoutes.sourceChains) : null;
|
|
2710
|
+
const allowedTokenSet = allowedRoutes?.sourceTokens ? new Set(allowedRoutes.sourceTokens.map((s) => s.toUpperCase())) : null;
|
|
2711
|
+
const evmChainIds = (() => {
|
|
2712
|
+
const all = getSupportedChainIds();
|
|
2713
|
+
return allowedChainSet ? all.filter((id) => allowedChainSet.has(id)) : all;
|
|
2714
|
+
})();
|
|
2715
|
+
const defaultChainId = evmChainIds.includes(BASE_CHAIN_ID) ? BASE_CHAIN_ID : evmChainIds[0];
|
|
2716
|
+
const tokensForChain = (() => {
|
|
2717
|
+
const all = getTargetTokenSymbolsForChain(defaultChainId);
|
|
2718
|
+
return allowedTokenSet ? all.filter((s) => allowedTokenSet.has(s.toUpperCase())) : all;
|
|
2719
|
+
})();
|
|
2720
|
+
const defaultToken = tokensForChain.includes("USDC") ? "USDC" : tokensForChain[0] ?? "USDC";
|
|
2721
|
+
const chainName = getChainName(defaultChainId);
|
|
2722
|
+
const chainIcon = getChainIcon(defaultChainId);
|
|
2723
|
+
const tokenIcon = getTokenIcon(defaultToken);
|
|
2724
|
+
return /* @__PURE__ */ jsxs10("div", { className: "rs-screen", "aria-busy": "true", children: [
|
|
2725
|
+
/* @__PURE__ */ jsx12("span", { className: "rs-sr-only", role: "status", children: "Preparing deposit details\u2026" }),
|
|
2726
|
+
/* @__PURE__ */ jsxs10("div", { className: "rs-screen-body", children: [
|
|
2727
|
+
/* @__PURE__ */ jsx12(BodyHeader, { icon: /* @__PURE__ */ jsx12(TransferCryptoIcon, {}), title: "Transfer crypto" }),
|
|
2728
|
+
/* @__PURE__ */ jsxs10("div", { className: "rs-deposit-address-selectors", "aria-hidden": "true", children: [
|
|
2729
|
+
/* @__PURE__ */ jsxs10("div", { className: "rs-deposit-address-dropdown", children: [
|
|
2730
|
+
/* @__PURE__ */ jsx12("div", { className: "rs-deposit-address-dropdown-label", children: "Supported chain" }),
|
|
2731
|
+
/* @__PURE__ */ jsxs10("div", { className: "rs-deposit-address-dropdown-trigger", children: [
|
|
2732
|
+
chainIcon && /* @__PURE__ */ jsx12(
|
|
2733
|
+
"img",
|
|
2734
|
+
{
|
|
2735
|
+
src: chainIcon,
|
|
2736
|
+
alt: "",
|
|
2737
|
+
className: "rs-deposit-address-dropdown-icon"
|
|
2738
|
+
}
|
|
2739
|
+
),
|
|
2740
|
+
/* @__PURE__ */ jsx12("span", { children: chainName }),
|
|
2741
|
+
/* @__PURE__ */ jsx12(ChevronDownIcon, { className: "rs-deposit-address-dropdown-chevron" })
|
|
2742
|
+
] })
|
|
2743
|
+
] }),
|
|
2744
|
+
/* @__PURE__ */ jsxs10("div", { className: "rs-deposit-address-dropdown", children: [
|
|
2745
|
+
/* @__PURE__ */ jsxs10("div", { className: "rs-deposit-address-dropdown-label rs-deposit-address-dropdown-label--with-min", children: [
|
|
2746
|
+
/* @__PURE__ */ jsx12("span", { children: "Supported token" }),
|
|
2747
|
+
/* @__PURE__ */ jsxs10("span", { className: "rs-deposit-address-min", children: [
|
|
2748
|
+
"Min.$",
|
|
2749
|
+
(uiConfig?.minDepositUsd ?? 0.1).toFixed(2),
|
|
2750
|
+
/* @__PURE__ */ jsx12(Tooltip, { content: "Minimum deposit amount required for the selected chain.", children: /* @__PURE__ */ jsx12(
|
|
2751
|
+
InfoIcon,
|
|
2752
|
+
{
|
|
2753
|
+
className: "rs-deposit-address-min-icon",
|
|
2754
|
+
"aria-hidden": "true"
|
|
2755
|
+
}
|
|
2756
|
+
) })
|
|
2757
|
+
] })
|
|
2758
|
+
] }),
|
|
2759
|
+
/* @__PURE__ */ jsxs10("div", { className: "rs-deposit-address-dropdown-trigger", children: [
|
|
2760
|
+
tokenIcon && /* @__PURE__ */ jsx12(
|
|
2761
|
+
"img",
|
|
2762
|
+
{
|
|
2763
|
+
src: tokenIcon,
|
|
2764
|
+
alt: "",
|
|
2765
|
+
className: "rs-deposit-address-dropdown-icon"
|
|
2766
|
+
}
|
|
2767
|
+
),
|
|
2768
|
+
/* @__PURE__ */ jsx12("span", { children: defaultToken }),
|
|
2769
|
+
/* @__PURE__ */ jsx12(ChevronDownIcon, { className: "rs-deposit-address-dropdown-chevron" })
|
|
2770
|
+
] })
|
|
2771
|
+
] })
|
|
2772
|
+
] }),
|
|
2773
|
+
/* @__PURE__ */ jsxs10(
|
|
2774
|
+
"div",
|
|
2775
|
+
{
|
|
2776
|
+
style: { display: "flex", flexDirection: "column", gap: 4, width: "100%" },
|
|
2777
|
+
children: [
|
|
2778
|
+
/* @__PURE__ */ jsxs10("div", { className: "rs-deposit-address-well", children: [
|
|
2779
|
+
/* @__PURE__ */ jsx12("div", { className: "rs-deposit-address-qr", children: /* @__PURE__ */ jsx12("div", { className: "rs-skeleton rs-skeleton-qr", "aria-hidden": "true" }) }),
|
|
2780
|
+
/* @__PURE__ */ jsx12("div", { className: "rs-skeleton rs-skeleton-address", "aria-hidden": "true" })
|
|
2781
|
+
] }),
|
|
2782
|
+
/* @__PURE__ */ jsxs10(
|
|
2783
|
+
"button",
|
|
2784
|
+
{
|
|
2785
|
+
type: "button",
|
|
2786
|
+
className: "rs-deposit-address-copy",
|
|
2787
|
+
disabled: true,
|
|
2788
|
+
"aria-hidden": "true",
|
|
2789
|
+
children: [
|
|
2790
|
+
/* @__PURE__ */ jsx12(CopyIcon, {}),
|
|
2791
|
+
"Copy address"
|
|
1903
2792
|
]
|
|
1904
2793
|
}
|
|
1905
|
-
)
|
|
1906
|
-
/* @__PURE__ */ jsx6("div", { className: "rs-price-impact-panel", children: /* @__PURE__ */ jsxs6("div", { className: "rs-price-impact-panel-inner", children: [
|
|
1907
|
-
/* @__PURE__ */ jsxs6("div", { className: "rs-price-impact-row", children: [
|
|
1908
|
-
/* @__PURE__ */ jsx6("span", { className: "rs-price-impact-row-icon", "aria-hidden": "true", children: /* @__PURE__ */ jsx6(PercentIcon, {}) }),
|
|
1909
|
-
/* @__PURE__ */ jsxs6("span", { className: "rs-price-impact-label", children: [
|
|
1910
|
-
"Max slippage: ",
|
|
1911
|
-
/* @__PURE__ */ jsx6("strong", { children: "0.2%" })
|
|
1912
|
-
] }),
|
|
1913
|
-
/* @__PURE__ */ jsx6(
|
|
1914
|
-
Tooltip,
|
|
1915
|
-
{
|
|
1916
|
-
className: "rs-price-impact-info",
|
|
1917
|
-
content: "Slippage accounts for price changes during execution. Slippage is adjusted per pair to ensure reliable execution.",
|
|
1918
|
-
children: /* @__PURE__ */ jsx6(InfoIcon, { "aria-hidden": "true" })
|
|
1919
|
-
}
|
|
1920
|
-
)
|
|
1921
|
-
] }),
|
|
1922
|
-
/* @__PURE__ */ jsxs6("div", { className: "rs-price-impact-row", children: [
|
|
1923
|
-
/* @__PURE__ */ jsx6("span", { className: "rs-price-impact-row-icon", "aria-hidden": "true", children: /* @__PURE__ */ jsx6(ClockIcon, {}) }),
|
|
1924
|
-
/* @__PURE__ */ jsxs6("span", { className: "rs-price-impact-label", children: [
|
|
1925
|
-
"Processing time: ",
|
|
1926
|
-
/* @__PURE__ */ jsx6("strong", { children: "< 1 min" })
|
|
1927
|
-
] })
|
|
1928
|
-
] }),
|
|
1929
|
-
/* @__PURE__ */ jsxs6("div", { className: "rs-price-impact-row", children: [
|
|
1930
|
-
/* @__PURE__ */ jsx6("span", { className: "rs-price-impact-row-icon", "aria-hidden": "true", children: /* @__PURE__ */ jsx6(PlusCircleIcon, {}) }),
|
|
1931
|
-
/* @__PURE__ */ jsxs6("span", { className: "rs-price-impact-label", children: [
|
|
1932
|
-
"Max deposit:",
|
|
1933
|
-
" ",
|
|
1934
|
-
/* @__PURE__ */ jsx6("strong", { children: liquidityHelper.kind === "max" ? `${formatUnits3(
|
|
1935
|
-
BigInt(liquidityHelper.maxAmount),
|
|
1936
|
-
liquidityHelper.decimals
|
|
1937
|
-
)} ${liquidityHelper.symbol}` : liquidityHelper.kind === "unlimited" ? "Unlimited" : liquidityHelper.kind === "unavailable" ? "Unavailable" : liquidityHelper.kind === "error" ? "\u2014" : "\u2026" })
|
|
1938
|
-
] })
|
|
1939
|
-
] })
|
|
1940
|
-
] }) })
|
|
2794
|
+
)
|
|
1941
2795
|
]
|
|
1942
2796
|
}
|
|
1943
2797
|
),
|
|
1944
|
-
|
|
2798
|
+
/* @__PURE__ */ jsx12("div", { className: "rs-price-impact", "aria-hidden": "true", children: /* @__PURE__ */ jsxs10("div", { className: "rs-price-impact-header", children: [
|
|
2799
|
+
/* @__PURE__ */ jsxs10("span", { className: "rs-price-impact-header-left", children: [
|
|
2800
|
+
/* @__PURE__ */ jsx12("span", { className: "rs-price-impact-label", children: "Price impact" }),
|
|
2801
|
+
/* @__PURE__ */ jsx12("span", { className: "rs-price-impact-label", children: /* @__PURE__ */ jsx12("strong", { children: "0.00%" }) }),
|
|
2802
|
+
/* @__PURE__ */ jsx12(
|
|
2803
|
+
Tooltip,
|
|
2804
|
+
{
|
|
2805
|
+
className: "rs-price-impact-info",
|
|
2806
|
+
content: "Price impact is the difference between expected and execution price, due to trade size and liquidity.",
|
|
2807
|
+
children: /* @__PURE__ */ jsx12(InfoIcon, { "aria-hidden": "true" })
|
|
2808
|
+
}
|
|
2809
|
+
)
|
|
2810
|
+
] }),
|
|
2811
|
+
/* @__PURE__ */ jsx12(
|
|
2812
|
+
ChevronDownIcon,
|
|
2813
|
+
{
|
|
2814
|
+
className: "rs-price-impact-chevron",
|
|
2815
|
+
"aria-hidden": "true"
|
|
2816
|
+
}
|
|
2817
|
+
)
|
|
2818
|
+
] }) })
|
|
1945
2819
|
] }),
|
|
1946
|
-
|
|
1947
|
-
DepositNotification,
|
|
1948
|
-
{
|
|
1949
|
-
deposit,
|
|
1950
|
-
smartAccount,
|
|
1951
|
-
solanaDepositAddress,
|
|
1952
|
-
targetChain,
|
|
1953
|
-
targetToken,
|
|
1954
|
-
waitForFinalTx,
|
|
1955
|
-
hasPostBridgeActions,
|
|
1956
|
-
service,
|
|
1957
|
-
onComplete: handleNotificationComplete,
|
|
1958
|
-
onFailed: handleNotificationFailed,
|
|
1959
|
-
onDismiss: handleNotificationDismiss
|
|
1960
|
-
},
|
|
1961
|
-
deposit.id
|
|
1962
|
-
)) }),
|
|
1963
|
-
/* @__PURE__ */ jsx6(PoweredBy, {})
|
|
2820
|
+
/* @__PURE__ */ jsx12(PoweredBy, {})
|
|
1964
2821
|
] });
|
|
1965
2822
|
}
|
|
1966
|
-
|
|
2823
|
+
DepositAddressSkeleton.displayName = "DepositAddressSkeleton";
|
|
1967
2824
|
|
|
1968
2825
|
// src/components/steps/SolanaTokenSelectStep.tsx
|
|
1969
|
-
import { useState as
|
|
2826
|
+
import { useState as useState8, useEffect as useEffect8, useMemo as useMemo5 } from "react";
|
|
1970
2827
|
import { formatUnits as formatUnits4 } from "viem";
|
|
1971
|
-
import { jsx as
|
|
2828
|
+
import { jsx as jsx13, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
1972
2829
|
function SolanaTokenSelectStep({
|
|
1973
2830
|
solanaAddress,
|
|
1974
2831
|
service,
|
|
@@ -1977,11 +2834,11 @@ function SolanaTokenSelectStep({
|
|
|
1977
2834
|
onDisconnect,
|
|
1978
2835
|
debug
|
|
1979
2836
|
}) {
|
|
1980
|
-
const [tokenBalances, setTokenBalances] =
|
|
1981
|
-
const [selectedSymbol, setSelectedSymbol] =
|
|
1982
|
-
const [loading, setLoading] =
|
|
1983
|
-
const [error, setError] =
|
|
1984
|
-
|
|
2837
|
+
const [tokenBalances, setTokenBalances] = useState8([]);
|
|
2838
|
+
const [selectedSymbol, setSelectedSymbol] = useState8(null);
|
|
2839
|
+
const [loading, setLoading] = useState8(true);
|
|
2840
|
+
const [error, setError] = useState8(null);
|
|
2841
|
+
useEffect8(() => {
|
|
1985
2842
|
let active = true;
|
|
1986
2843
|
async function loadBalances() {
|
|
1987
2844
|
if (!solanaAddress) {
|
|
@@ -2052,7 +2909,7 @@ function SolanaTokenSelectStep({
|
|
|
2052
2909
|
active = false;
|
|
2053
2910
|
};
|
|
2054
2911
|
}, [debug, solanaAddress, service, onTotalBalanceComputed]);
|
|
2055
|
-
const rows =
|
|
2912
|
+
const rows = useMemo5(
|
|
2056
2913
|
() => [...tokenBalances].sort((a, b) => {
|
|
2057
2914
|
if (a.balanceUsd !== b.balanceUsd) return b.balanceUsd - a.balanceUsd;
|
|
2058
2915
|
if (b.balance > a.balance) return 1;
|
|
@@ -2074,30 +2931,30 @@ function SolanaTokenSelectStep({
|
|
|
2074
2931
|
};
|
|
2075
2932
|
const chainIcon = getChainIcon("solana");
|
|
2076
2933
|
const chainName = getChainName("solana");
|
|
2077
|
-
return /* @__PURE__ */
|
|
2078
|
-
/* @__PURE__ */
|
|
2079
|
-
/* @__PURE__ */
|
|
2934
|
+
return /* @__PURE__ */ jsxs11("div", { className: "rs-screen", children: [
|
|
2935
|
+
/* @__PURE__ */ jsxs11("div", { className: "rs-screen-body", children: [
|
|
2936
|
+
/* @__PURE__ */ jsx13(
|
|
2080
2937
|
BodyHeader,
|
|
2081
2938
|
{
|
|
2082
|
-
icon: /* @__PURE__ */
|
|
2939
|
+
icon: /* @__PURE__ */ jsx13(WalletIcon, {}),
|
|
2083
2940
|
title: "Your assets",
|
|
2084
2941
|
subtitle: "Select source assets to transfer"
|
|
2085
2942
|
}
|
|
2086
2943
|
),
|
|
2087
|
-
loading && /* @__PURE__ */
|
|
2088
|
-
/* @__PURE__ */
|
|
2089
|
-
/* @__PURE__ */
|
|
2944
|
+
loading && /* @__PURE__ */ jsxs11("div", { className: "rs-loading-state", style: { padding: "40px 12px" }, children: [
|
|
2945
|
+
/* @__PURE__ */ jsx13(Spinner, { className: "rs-text-tertiary" }),
|
|
2946
|
+
/* @__PURE__ */ jsx13("span", { className: "rs-text-sm rs-text-tertiary", children: "Loading balances" })
|
|
2090
2947
|
] }),
|
|
2091
|
-
error && /* @__PURE__ */
|
|
2092
|
-
!loading && !error && rows.length === 0 && /* @__PURE__ */
|
|
2093
|
-
/* @__PURE__ */
|
|
2094
|
-
/* @__PURE__ */
|
|
2095
|
-
/* @__PURE__ */
|
|
2948
|
+
error && /* @__PURE__ */ jsx13(Callout, { variant: "error", children: error }),
|
|
2949
|
+
!loading && !error && rows.length === 0 && /* @__PURE__ */ jsxs11("div", { className: "rs-empty-state", children: [
|
|
2950
|
+
/* @__PURE__ */ jsx13(WalletIcon, { className: "rs-empty-icon" }),
|
|
2951
|
+
/* @__PURE__ */ jsx13("div", { className: "rs-empty-text", children: "No funds in connected wallet" }),
|
|
2952
|
+
/* @__PURE__ */ jsxs11("div", { className: "rs-empty-address", children: [
|
|
2096
2953
|
solanaAddress.slice(0, 6),
|
|
2097
2954
|
"...",
|
|
2098
2955
|
solanaAddress.slice(-4)
|
|
2099
2956
|
] }),
|
|
2100
|
-
onDisconnect && /* @__PURE__ */
|
|
2957
|
+
onDisconnect && /* @__PURE__ */ jsx13(
|
|
2101
2958
|
"button",
|
|
2102
2959
|
{
|
|
2103
2960
|
type: "button",
|
|
@@ -2107,11 +2964,11 @@ function SolanaTokenSelectStep({
|
|
|
2107
2964
|
}
|
|
2108
2965
|
)
|
|
2109
2966
|
] }),
|
|
2110
|
-
!loading && !error && rows.length > 0 && /* @__PURE__ */
|
|
2967
|
+
!loading && !error && rows.length > 0 && /* @__PURE__ */ jsx13("div", { className: "rs-asset-list", children: rows.map((entry) => {
|
|
2111
2968
|
const isSelected = selectedSymbol === entry.token.symbol;
|
|
2112
2969
|
const tokenAmount = formatBalance(entry);
|
|
2113
2970
|
const tokenIcon = getTokenIcon(entry.token.symbol);
|
|
2114
|
-
return /* @__PURE__ */
|
|
2971
|
+
return /* @__PURE__ */ jsxs11(
|
|
2115
2972
|
"button",
|
|
2116
2973
|
{
|
|
2117
2974
|
type: "button",
|
|
@@ -2119,33 +2976,33 @@ function SolanaTokenSelectStep({
|
|
|
2119
2976
|
className: `rs-asset-row ${isSelected ? "rs-asset-row--selected" : ""}`,
|
|
2120
2977
|
"aria-pressed": isSelected,
|
|
2121
2978
|
children: [
|
|
2122
|
-
/* @__PURE__ */
|
|
2123
|
-
/* @__PURE__ */
|
|
2124
|
-
tokenIcon ? /* @__PURE__ */
|
|
2125
|
-
chainIcon && /* @__PURE__ */
|
|
2979
|
+
/* @__PURE__ */ jsxs11("div", { className: "rs-asset-info", children: [
|
|
2980
|
+
/* @__PURE__ */ jsxs11("div", { className: "rs-asset-icon-wrapper", children: [
|
|
2981
|
+
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) }),
|
|
2982
|
+
chainIcon && /* @__PURE__ */ jsx13("span", { className: "rs-asset-chain-badge", children: /* @__PURE__ */ jsx13("img", { src: chainIcon, alt: chainName }) })
|
|
2126
2983
|
] }),
|
|
2127
|
-
/* @__PURE__ */
|
|
2128
|
-
/* @__PURE__ */
|
|
2129
|
-
/* @__PURE__ */
|
|
2130
|
-
/* @__PURE__ */
|
|
2984
|
+
/* @__PURE__ */ jsxs11("div", { className: "rs-asset-text", children: [
|
|
2985
|
+
/* @__PURE__ */ jsxs11("div", { className: "rs-asset-name-row", children: [
|
|
2986
|
+
/* @__PURE__ */ jsx13("span", { className: "rs-asset-name", children: entry.token.symbol }),
|
|
2987
|
+
/* @__PURE__ */ jsxs11("span", { className: "rs-asset-chain", children: [
|
|
2131
2988
|
"on ",
|
|
2132
2989
|
chainName
|
|
2133
2990
|
] })
|
|
2134
2991
|
] }),
|
|
2135
|
-
/* @__PURE__ */
|
|
2992
|
+
/* @__PURE__ */ jsxs11("div", { className: "rs-asset-balance-small", children: [
|
|
2136
2993
|
tokenAmount,
|
|
2137
2994
|
" ",
|
|
2138
2995
|
entry.token.symbol
|
|
2139
2996
|
] })
|
|
2140
2997
|
] })
|
|
2141
2998
|
] }),
|
|
2142
|
-
/* @__PURE__ */
|
|
2999
|
+
/* @__PURE__ */ jsx13("div", { className: "rs-asset-balance", children: entry.balanceUsd > 0 ? currencyFormatter.format(entry.balanceUsd) : tokenAmount !== "--" ? `${tokenAmount} ${entry.token.symbol}` : "--" })
|
|
2143
3000
|
]
|
|
2144
3001
|
},
|
|
2145
3002
|
entry.token.symbol
|
|
2146
3003
|
);
|
|
2147
3004
|
}) }),
|
|
2148
|
-
/* @__PURE__ */
|
|
3005
|
+
/* @__PURE__ */ jsx13(
|
|
2149
3006
|
Button,
|
|
2150
3007
|
{
|
|
2151
3008
|
onClick: () => selectedEntry && onContinue(
|
|
@@ -2159,14 +3016,14 @@ function SolanaTokenSelectStep({
|
|
|
2159
3016
|
}
|
|
2160
3017
|
)
|
|
2161
3018
|
] }),
|
|
2162
|
-
/* @__PURE__ */
|
|
3019
|
+
/* @__PURE__ */ jsx13(PoweredBy, {})
|
|
2163
3020
|
] });
|
|
2164
3021
|
}
|
|
2165
3022
|
|
|
2166
3023
|
// src/components/steps/SolanaAmountStep.tsx
|
|
2167
|
-
import { useCallback as
|
|
3024
|
+
import { useCallback as useCallback6, useEffect as useEffect9, useMemo as useMemo6, useRef as useRef7, useState as useState9 } from "react";
|
|
2168
3025
|
import { formatUnits as formatUnits5, parseUnits as parseUnits3 } from "viem";
|
|
2169
|
-
import { Fragment as Fragment2, jsx as
|
|
3026
|
+
import { Fragment as Fragment2, jsx as jsx14, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
2170
3027
|
var SOL_FEE_RESERVE_LAMPORTS = 1000000n;
|
|
2171
3028
|
var PRESETS2 = [
|
|
2172
3029
|
{ value: 25, label: "25%" },
|
|
@@ -2180,6 +3037,7 @@ function SolanaAmountStep({
|
|
|
2180
3037
|
balanceUsd,
|
|
2181
3038
|
defaultAmount,
|
|
2182
3039
|
uiConfig,
|
|
3040
|
+
targetChain,
|
|
2183
3041
|
targetChainName,
|
|
2184
3042
|
targetTokenSymbol,
|
|
2185
3043
|
targetTokenIcon,
|
|
@@ -2187,12 +3045,12 @@ function SolanaAmountStep({
|
|
|
2187
3045
|
onContinue,
|
|
2188
3046
|
debug
|
|
2189
3047
|
}) {
|
|
2190
|
-
const [amount, setAmount] =
|
|
2191
|
-
const [error, setError] =
|
|
2192
|
-
const hasAppliedDefaultRef =
|
|
3048
|
+
const [amount, setAmount] = useState9("");
|
|
3049
|
+
const [error, setError] = useState9(null);
|
|
3050
|
+
const hasAppliedDefaultRef = useRef7(false);
|
|
2193
3051
|
const isSourceStablecoin = isStablecoinSymbol(token.symbol);
|
|
2194
3052
|
const isMaxDefault = defaultAmount?.trim().toLowerCase() === "max";
|
|
2195
|
-
const tokenPriceUsd =
|
|
3053
|
+
const tokenPriceUsd = useMemo6(() => {
|
|
2196
3054
|
if (isSourceStablecoin) return 1;
|
|
2197
3055
|
try {
|
|
2198
3056
|
const balanceUnits = Number(formatUnits5(balance, token.decimals));
|
|
@@ -2206,7 +3064,7 @@ function SolanaAmountStep({
|
|
|
2206
3064
|
}
|
|
2207
3065
|
}, [isSourceStablecoin, balance, token.decimals, balanceUsd]);
|
|
2208
3066
|
const hasPricing = tokenPriceUsd !== null;
|
|
2209
|
-
const formattedBalance =
|
|
3067
|
+
const formattedBalance = useMemo6(() => {
|
|
2210
3068
|
try {
|
|
2211
3069
|
const raw = formatUnits5(balance, token.decimals);
|
|
2212
3070
|
const numeric = Number(raw);
|
|
@@ -2216,7 +3074,7 @@ function SolanaAmountStep({
|
|
|
2216
3074
|
return "\u2026";
|
|
2217
3075
|
}
|
|
2218
3076
|
}, [balance, token.decimals]);
|
|
2219
|
-
const computedBalanceUsd =
|
|
3077
|
+
const computedBalanceUsd = useMemo6(() => {
|
|
2220
3078
|
try {
|
|
2221
3079
|
const balanceUnits = Number(formatUnits5(balance, token.decimals));
|
|
2222
3080
|
if (!Number.isFinite(balanceUnits) || balanceUnits < 0) return null;
|
|
@@ -2227,11 +3085,11 @@ function SolanaAmountStep({
|
|
|
2227
3085
|
return null;
|
|
2228
3086
|
}
|
|
2229
3087
|
}, [balance, token.decimals, tokenPriceUsd, balanceUsd]);
|
|
2230
|
-
const spendableBalance =
|
|
3088
|
+
const spendableBalance = useMemo6(() => {
|
|
2231
3089
|
if (!isNativeSol(token)) return balance;
|
|
2232
3090
|
return balance > SOL_FEE_RESERVE_LAMPORTS ? balance - SOL_FEE_RESERVE_LAMPORTS : 0n;
|
|
2233
3091
|
}, [balance, token]);
|
|
2234
|
-
const spendableBalanceUsd =
|
|
3092
|
+
const spendableBalanceUsd = useMemo6(() => {
|
|
2235
3093
|
try {
|
|
2236
3094
|
const spendableUnits = Number(formatUnits5(spendableBalance, token.decimals));
|
|
2237
3095
|
if (!Number.isFinite(spendableUnits) || spendableUnits < 0) return null;
|
|
@@ -2241,7 +3099,7 @@ function SolanaAmountStep({
|
|
|
2241
3099
|
return null;
|
|
2242
3100
|
}
|
|
2243
3101
|
}, [spendableBalance, token.decimals, tokenPriceUsd]);
|
|
2244
|
-
const computePresetAmount =
|
|
3102
|
+
const computePresetAmount = useCallback6(
|
|
2245
3103
|
(percentage) => {
|
|
2246
3104
|
try {
|
|
2247
3105
|
const spendableUnits = Number(
|
|
@@ -2264,7 +3122,7 @@ function SolanaAmountStep({
|
|
|
2264
3122
|
spendableBalanceUsd
|
|
2265
3123
|
]
|
|
2266
3124
|
);
|
|
2267
|
-
|
|
3125
|
+
useEffect9(() => {
|
|
2268
3126
|
if (hasAppliedDefaultRef.current || !defaultAmount) return;
|
|
2269
3127
|
if (isMaxDefault) {
|
|
2270
3128
|
const next = computePresetAmount(100);
|
|
@@ -2280,11 +3138,11 @@ function SolanaAmountStep({
|
|
|
2280
3138
|
hasAppliedDefaultRef.current = true;
|
|
2281
3139
|
}
|
|
2282
3140
|
}, [defaultAmount, isMaxDefault, computePresetAmount]);
|
|
2283
|
-
const numericAmount =
|
|
3141
|
+
const numericAmount = useMemo6(() => {
|
|
2284
3142
|
const parsed = parseFloat(amount);
|
|
2285
3143
|
return Number.isFinite(parsed) && parsed > 0 ? parsed : 0;
|
|
2286
3144
|
}, [amount]);
|
|
2287
|
-
const sourceAmountUnits =
|
|
3145
|
+
const sourceAmountUnits = useMemo6(() => {
|
|
2288
3146
|
if (numericAmount <= 0) return null;
|
|
2289
3147
|
const raw = isSourceStablecoin || !hasPricing ? numericAmount : numericAmount / (tokenPriceUsd ?? 1);
|
|
2290
3148
|
try {
|
|
@@ -2293,7 +3151,7 @@ function SolanaAmountStep({
|
|
|
2293
3151
|
return null;
|
|
2294
3152
|
}
|
|
2295
3153
|
}, [numericAmount, isSourceStablecoin, hasPricing, tokenPriceUsd, token.decimals]);
|
|
2296
|
-
const minDepositUsd = uiConfig?.minDepositUsd ?? null;
|
|
3154
|
+
const minDepositUsd = targetChain === HYPERCORE_CHAIN_ID ? Math.max(HYPERCORE_MIN_DEPOSIT_USD, uiConfig?.minDepositUsd ?? 0) : uiConfig?.minDepositUsd ?? null;
|
|
2297
3155
|
const maxDepositUsd = uiConfig?.maxDepositUsd ?? null;
|
|
2298
3156
|
const isBelowMin = minDepositUsd !== null && numericAmount > 0 && numericAmount < minDepositUsd;
|
|
2299
3157
|
const isAboveMax = maxDepositUsd !== null && numericAmount > maxDepositUsd;
|
|
@@ -2366,12 +3224,12 @@ function SolanaAmountStep({
|
|
|
2366
3224
|
const continueLabel = exceedsBalance ? "Insufficient balance" : isAboveMax ? "Continue with max allowed deposit" : isBelowMin ? "Continue with minimum deposit" : "Continue";
|
|
2367
3225
|
const continueDisabled = exceedsBalance || numericAmount === 0 && !isBelowMin;
|
|
2368
3226
|
const sourceTokenIcon = getTokenIcon(token.symbol);
|
|
2369
|
-
return /* @__PURE__ */
|
|
2370
|
-
/* @__PURE__ */
|
|
2371
|
-
/* @__PURE__ */
|
|
2372
|
-
/* @__PURE__ */
|
|
2373
|
-
/* @__PURE__ */
|
|
2374
|
-
/* @__PURE__ */
|
|
3227
|
+
return /* @__PURE__ */ jsxs12("div", { className: "rs-screen", children: [
|
|
3228
|
+
/* @__PURE__ */ jsxs12("div", { className: "rs-screen-body rs-screen-body--gap-32", children: [
|
|
3229
|
+
/* @__PURE__ */ jsx14(BodyHeader, { icon: /* @__PURE__ */ jsx14(WalletIcon, {}), title: "Wallet deposit" }),
|
|
3230
|
+
/* @__PURE__ */ jsxs12("div", { className: "rs-amount-section", children: [
|
|
3231
|
+
/* @__PURE__ */ jsxs12("div", { className: "rs-amount-display", children: [
|
|
3232
|
+
/* @__PURE__ */ jsx14(
|
|
2375
3233
|
AnimatedAmountInput,
|
|
2376
3234
|
{
|
|
2377
3235
|
value: amount,
|
|
@@ -2380,25 +3238,25 @@ function SolanaAmountStep({
|
|
|
2380
3238
|
autoFocus: true
|
|
2381
3239
|
}
|
|
2382
3240
|
),
|
|
2383
|
-
/* @__PURE__ */
|
|
2384
|
-
/* @__PURE__ */
|
|
3241
|
+
/* @__PURE__ */ jsxs12("div", { className: "rs-amount-meta", children: [
|
|
3242
|
+
/* @__PURE__ */ jsxs12("span", { className: "rs-amount-meta-balance", children: [
|
|
2385
3243
|
formattedBalance,
|
|
2386
3244
|
" ",
|
|
2387
3245
|
token.symbol,
|
|
2388
3246
|
" available",
|
|
2389
|
-
computedBalanceUsd !== null && /* @__PURE__ */
|
|
3247
|
+
computedBalanceUsd !== null && /* @__PURE__ */ jsxs12(Fragment2, { children: [
|
|
2390
3248
|
" (~",
|
|
2391
3249
|
currencyFormatter.format(computedBalanceUsd),
|
|
2392
3250
|
")"
|
|
2393
3251
|
] })
|
|
2394
3252
|
] }),
|
|
2395
|
-
minDepositUsd !== null && /* @__PURE__ */
|
|
3253
|
+
minDepositUsd !== null && /* @__PURE__ */ jsxs12("span", { className: "rs-amount-meta-minimum", children: [
|
|
2396
3254
|
"Min. deposit ",
|
|
2397
3255
|
currencyFormatter.format(minDepositUsd)
|
|
2398
3256
|
] })
|
|
2399
3257
|
] })
|
|
2400
3258
|
] }),
|
|
2401
|
-
/* @__PURE__ */
|
|
3259
|
+
/* @__PURE__ */ jsx14("div", { className: "rs-amount-presets", children: PRESETS2.map((preset) => /* @__PURE__ */ jsx14(
|
|
2402
3260
|
"button",
|
|
2403
3261
|
{
|
|
2404
3262
|
type: "button",
|
|
@@ -2409,35 +3267,36 @@ function SolanaAmountStep({
|
|
|
2409
3267
|
preset.value
|
|
2410
3268
|
)) })
|
|
2411
3269
|
] }),
|
|
2412
|
-
/* @__PURE__ */
|
|
2413
|
-
/* @__PURE__ */
|
|
2414
|
-
/* @__PURE__ */
|
|
2415
|
-
/* @__PURE__ */
|
|
2416
|
-
/* @__PURE__ */
|
|
3270
|
+
/* @__PURE__ */ jsxs12("div", { className: "rs-amount-details", children: [
|
|
3271
|
+
/* @__PURE__ */ jsxs12("div", { className: "rs-amount-detail-row", children: [
|
|
3272
|
+
/* @__PURE__ */ jsx14("span", { children: "You send" }),
|
|
3273
|
+
/* @__PURE__ */ jsxs12("span", { className: "rs-amount-detail-value", children: [
|
|
3274
|
+
/* @__PURE__ */ jsxs12("span", { children: [
|
|
2417
3275
|
"Solana ",
|
|
2418
3276
|
token.symbol
|
|
2419
3277
|
] }),
|
|
2420
|
-
sourceTokenIcon && /* @__PURE__ */
|
|
3278
|
+
sourceTokenIcon && /* @__PURE__ */ jsx14("span", { className: "rs-amount-detail-icon", children: /* @__PURE__ */ jsx14("img", { src: sourceTokenIcon, alt: "" }) })
|
|
2421
3279
|
] })
|
|
2422
3280
|
] }),
|
|
2423
|
-
targetChainName && targetTokenSymbol && /* @__PURE__ */
|
|
2424
|
-
/* @__PURE__ */
|
|
2425
|
-
/* @__PURE__ */
|
|
2426
|
-
/* @__PURE__ */
|
|
3281
|
+
targetChainName && targetTokenSymbol && /* @__PURE__ */ jsxs12("div", { className: "rs-amount-detail-row", children: [
|
|
3282
|
+
/* @__PURE__ */ jsx14("span", { children: "Receive" }),
|
|
3283
|
+
/* @__PURE__ */ jsxs12("span", { className: "rs-amount-detail-value", children: [
|
|
3284
|
+
/* @__PURE__ */ jsxs12("span", { children: [
|
|
2427
3285
|
targetChainName,
|
|
2428
3286
|
" ",
|
|
2429
3287
|
targetTokenSymbol
|
|
2430
3288
|
] }),
|
|
2431
|
-
targetTokenIcon && /* @__PURE__ */
|
|
3289
|
+
targetTokenIcon && /* @__PURE__ */ jsx14("span", { className: "rs-amount-detail-icon", children: /* @__PURE__ */ jsx14("img", { src: targetTokenIcon, alt: "" }) })
|
|
2432
3290
|
] })
|
|
2433
3291
|
] }),
|
|
2434
|
-
balanceAfterUsd !== null && /* @__PURE__ */
|
|
2435
|
-
/* @__PURE__ */
|
|
2436
|
-
/* @__PURE__ */
|
|
3292
|
+
balanceAfterUsd !== null && /* @__PURE__ */ jsxs12("div", { className: "rs-amount-detail-row", children: [
|
|
3293
|
+
/* @__PURE__ */ jsx14("span", { children: "Balance after deposit" }),
|
|
3294
|
+
/* @__PURE__ */ jsx14("span", { className: "rs-amount-detail-value", children: currencyFormatter.format(balanceAfterUsd) })
|
|
2437
3295
|
] })
|
|
2438
3296
|
] }),
|
|
2439
|
-
|
|
2440
|
-
/* @__PURE__ */
|
|
3297
|
+
targetChain === HYPERCORE_CHAIN_ID && /* @__PURE__ */ jsx14(Callout, { variant: "warning", children: "First deposit to a new HyperCore account includes a ~1 USDC activation fee." }),
|
|
3298
|
+
error && /* @__PURE__ */ jsx14(Callout, { variant: "error", children: error }),
|
|
3299
|
+
/* @__PURE__ */ jsx14(
|
|
2441
3300
|
Button,
|
|
2442
3301
|
{
|
|
2443
3302
|
onClick: handleContinue,
|
|
@@ -2447,12 +3306,12 @@ function SolanaAmountStep({
|
|
|
2447
3306
|
}
|
|
2448
3307
|
)
|
|
2449
3308
|
] }),
|
|
2450
|
-
/* @__PURE__ */
|
|
3309
|
+
/* @__PURE__ */ jsx14(PoweredBy, {})
|
|
2451
3310
|
] });
|
|
2452
3311
|
}
|
|
2453
3312
|
|
|
2454
3313
|
// src/components/steps/SolanaConfirmStep.tsx
|
|
2455
|
-
import { useState as
|
|
3314
|
+
import { useState as useState10 } from "react";
|
|
2456
3315
|
import { parseUnits as parseUnits4 } from "viem";
|
|
2457
3316
|
|
|
2458
3317
|
// src/core/solana.ts
|
|
@@ -2560,7 +3419,7 @@ async function sendSolanaTransaction(provider, _connection, transaction) {
|
|
|
2560
3419
|
}
|
|
2561
3420
|
|
|
2562
3421
|
// src/components/steps/SolanaConfirmStep.tsx
|
|
2563
|
-
import { jsx as
|
|
3422
|
+
import { jsx as jsx15, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
2564
3423
|
function SolanaConfirmStep({
|
|
2565
3424
|
smartAccount,
|
|
2566
3425
|
solanaAddress,
|
|
@@ -2581,8 +3440,8 @@ function SolanaConfirmStep({
|
|
|
2581
3440
|
onError,
|
|
2582
3441
|
debug
|
|
2583
3442
|
}) {
|
|
2584
|
-
const [isSubmitting, setIsSubmitting] =
|
|
2585
|
-
const [error, setError] =
|
|
3443
|
+
const [isSubmitting, setIsSubmitting] = useState10(false);
|
|
3444
|
+
const [error, setError] = useState10(null);
|
|
2586
3445
|
const targetSymbol = getTargetTokenSymbol(targetToken, targetChain);
|
|
2587
3446
|
const isSameToken = token.symbol.toUpperCase() === targetSymbol.toUpperCase();
|
|
2588
3447
|
const sourceChainName = getChainName("solana");
|
|
@@ -2593,7 +3452,10 @@ function SolanaConfirmStep({
|
|
|
2593
3452
|
const targetTokenIcon = getTokenIcon(targetSymbol);
|
|
2594
3453
|
const feeSponsored = uiConfig?.feeSponsored ?? false;
|
|
2595
3454
|
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", {
|
|
3455
|
+
const formattedAmount = sourceAmount && !Number.isNaN(Number(sourceAmount)) ? Number(sourceAmount).toLocaleString("en-US", {
|
|
3456
|
+
minimumFractionDigits: 2,
|
|
3457
|
+
maximumFractionDigits: 6
|
|
3458
|
+
}) : "0";
|
|
2597
3459
|
const formattedReceiveAmount = (() => {
|
|
2598
3460
|
if (isSameToken) return formattedAmount;
|
|
2599
3461
|
const dollarValue = Number(targetAmount);
|
|
@@ -2601,7 +3463,10 @@ function SolanaConfirmStep({
|
|
|
2601
3463
|
return formattedAmount;
|
|
2602
3464
|
if (targetTokenPriceUsd !== null && targetTokenPriceUsd > 0) {
|
|
2603
3465
|
const tokenAmount = dollarValue / targetTokenPriceUsd;
|
|
2604
|
-
return tokenAmount.toLocaleString("en-US", {
|
|
3466
|
+
return tokenAmount.toLocaleString("en-US", {
|
|
3467
|
+
minimumFractionDigits: 2,
|
|
3468
|
+
maximumFractionDigits: 6
|
|
3469
|
+
});
|
|
2605
3470
|
}
|
|
2606
3471
|
return formattedAmount;
|
|
2607
3472
|
})();
|
|
@@ -2695,66 +3560,66 @@ function SolanaConfirmStep({
|
|
|
2695
3560
|
setIsSubmitting(false);
|
|
2696
3561
|
}
|
|
2697
3562
|
};
|
|
2698
|
-
return /* @__PURE__ */
|
|
2699
|
-
/* @__PURE__ */
|
|
2700
|
-
/* @__PURE__ */
|
|
2701
|
-
/* @__PURE__ */
|
|
2702
|
-
/* @__PURE__ */
|
|
2703
|
-
/* @__PURE__ */
|
|
2704
|
-
/* @__PURE__ */
|
|
2705
|
-
/* @__PURE__ */
|
|
2706
|
-
sourceChainIcon && /* @__PURE__ */
|
|
3563
|
+
return /* @__PURE__ */ jsxs13("div", { className: "rs-screen", children: [
|
|
3564
|
+
/* @__PURE__ */ jsxs13("div", { className: "rs-screen-body rs-screen-body--gap-32", children: [
|
|
3565
|
+
/* @__PURE__ */ jsx15(BodyHeader, { icon: /* @__PURE__ */ jsx15(WalletIcon, {}), title: "Review deposit" }),
|
|
3566
|
+
/* @__PURE__ */ jsxs13("div", { className: "rs-review-details", children: [
|
|
3567
|
+
/* @__PURE__ */ jsxs13("div", { className: "rs-review-detail-row", children: [
|
|
3568
|
+
/* @__PURE__ */ jsx15("span", { children: "Source chain" }),
|
|
3569
|
+
/* @__PURE__ */ jsxs13("span", { className: "rs-review-detail-value", children: [
|
|
3570
|
+
/* @__PURE__ */ jsx15("span", { children: sourceChainName }),
|
|
3571
|
+
sourceChainIcon && /* @__PURE__ */ jsx15("span", { className: "rs-review-detail-icon", children: /* @__PURE__ */ jsx15("img", { src: sourceChainIcon, alt: "" }) })
|
|
2707
3572
|
] })
|
|
2708
3573
|
] }),
|
|
2709
|
-
/* @__PURE__ */
|
|
2710
|
-
/* @__PURE__ */
|
|
2711
|
-
/* @__PURE__ */
|
|
2712
|
-
/* @__PURE__ */
|
|
2713
|
-
targetChainIcon && /* @__PURE__ */
|
|
3574
|
+
/* @__PURE__ */ jsxs13("div", { className: "rs-review-detail-row", children: [
|
|
3575
|
+
/* @__PURE__ */ jsx15("span", { children: "Destination chain" }),
|
|
3576
|
+
/* @__PURE__ */ jsxs13("span", { className: "rs-review-detail-value", children: [
|
|
3577
|
+
/* @__PURE__ */ jsx15("span", { children: targetChainName }),
|
|
3578
|
+
targetChainIcon && /* @__PURE__ */ jsx15("span", { className: "rs-review-detail-icon", children: /* @__PURE__ */ jsx15("img", { src: targetChainIcon, alt: "" }) })
|
|
2714
3579
|
] })
|
|
2715
3580
|
] }),
|
|
2716
|
-
/* @__PURE__ */
|
|
2717
|
-
/* @__PURE__ */
|
|
2718
|
-
/* @__PURE__ */
|
|
3581
|
+
/* @__PURE__ */ jsxs13("div", { className: "rs-review-detail-row", children: [
|
|
3582
|
+
/* @__PURE__ */ jsx15("span", { children: "Estimated time" }),
|
|
3583
|
+
/* @__PURE__ */ jsx15("span", { className: "rs-review-detail-value", children: estimatedTime })
|
|
2719
3584
|
] }),
|
|
2720
|
-
/* @__PURE__ */
|
|
2721
|
-
/* @__PURE__ */
|
|
2722
|
-
/* @__PURE__ */
|
|
2723
|
-
/* @__PURE__ */
|
|
3585
|
+
/* @__PURE__ */ jsxs13("div", { className: "rs-review-detail-row", children: [
|
|
3586
|
+
/* @__PURE__ */ jsx15("span", { children: "You send" }),
|
|
3587
|
+
/* @__PURE__ */ jsxs13("span", { className: "rs-review-detail-value", children: [
|
|
3588
|
+
/* @__PURE__ */ jsxs13("span", { children: [
|
|
2724
3589
|
formattedAmount,
|
|
2725
3590
|
" ",
|
|
2726
3591
|
token.symbol
|
|
2727
3592
|
] }),
|
|
2728
|
-
sourceTokenIcon && /* @__PURE__ */
|
|
3593
|
+
sourceTokenIcon && /* @__PURE__ */ jsx15("span", { className: "rs-review-detail-icon", children: /* @__PURE__ */ jsx15("img", { src: sourceTokenIcon, alt: "" }) })
|
|
2729
3594
|
] })
|
|
2730
3595
|
] }),
|
|
2731
|
-
/* @__PURE__ */
|
|
2732
|
-
/* @__PURE__ */
|
|
2733
|
-
/* @__PURE__ */
|
|
2734
|
-
/* @__PURE__ */
|
|
3596
|
+
/* @__PURE__ */ jsxs13("div", { className: "rs-review-detail-row", children: [
|
|
3597
|
+
/* @__PURE__ */ jsx15("span", { children: "Receive" }),
|
|
3598
|
+
/* @__PURE__ */ jsxs13("span", { className: "rs-review-detail-value", children: [
|
|
3599
|
+
/* @__PURE__ */ jsxs13("span", { children: [
|
|
2735
3600
|
receiveAmount,
|
|
2736
3601
|
" ",
|
|
2737
3602
|
targetSymbol
|
|
2738
3603
|
] }),
|
|
2739
|
-
targetTokenIcon && /* @__PURE__ */
|
|
3604
|
+
targetTokenIcon && /* @__PURE__ */ jsx15("span", { className: "rs-review-detail-icon", children: /* @__PURE__ */ jsx15("img", { src: targetTokenIcon, alt: "" }) })
|
|
2740
3605
|
] })
|
|
2741
3606
|
] }),
|
|
2742
|
-
/* @__PURE__ */
|
|
2743
|
-
/* @__PURE__ */
|
|
2744
|
-
/* @__PURE__ */
|
|
2745
|
-
/* @__PURE__ */
|
|
3607
|
+
/* @__PURE__ */ jsxs13("div", { className: "rs-review-detail-row", children: [
|
|
3608
|
+
/* @__PURE__ */ jsx15("span", { children: "Fees" }),
|
|
3609
|
+
/* @__PURE__ */ jsxs13("span", { className: "rs-review-detail-value", children: [
|
|
3610
|
+
/* @__PURE__ */ jsx15(
|
|
2746
3611
|
"span",
|
|
2747
3612
|
{
|
|
2748
3613
|
style: feeSponsored ? { textDecoration: "line-through" } : void 0,
|
|
2749
3614
|
children: "$0.04"
|
|
2750
3615
|
}
|
|
2751
3616
|
),
|
|
2752
|
-
/* @__PURE__ */
|
|
3617
|
+
/* @__PURE__ */ jsx15(Tooltip, { content: feeTooltip, children: /* @__PURE__ */ jsx15("span", { className: "rs-review-detail-info", "aria-label": "Fee info", children: /* @__PURE__ */ jsx15(InfoIcon, {}) }) })
|
|
2753
3618
|
] })
|
|
2754
3619
|
] })
|
|
2755
3620
|
] }),
|
|
2756
|
-
error && /* @__PURE__ */
|
|
2757
|
-
/* @__PURE__ */
|
|
3621
|
+
error && /* @__PURE__ */ jsx15(Callout, { variant: "error", children: error }),
|
|
3622
|
+
/* @__PURE__ */ jsx15(
|
|
2758
3623
|
Button,
|
|
2759
3624
|
{
|
|
2760
3625
|
onClick: handleConfirm,
|
|
@@ -2766,28 +3631,28 @@ function SolanaConfirmStep({
|
|
|
2766
3631
|
}
|
|
2767
3632
|
)
|
|
2768
3633
|
] }),
|
|
2769
|
-
/* @__PURE__ */
|
|
3634
|
+
/* @__PURE__ */ jsx15(PoweredBy, {})
|
|
2770
3635
|
] });
|
|
2771
3636
|
}
|
|
2772
3637
|
|
|
2773
3638
|
// src/components/steps/DappImportAssetSelectStep.tsx
|
|
2774
|
-
import { jsx as
|
|
3639
|
+
import { jsx as jsx16, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
2775
3640
|
function DappImportAssetSelectStep({
|
|
2776
3641
|
sourceLabel,
|
|
2777
3642
|
assets,
|
|
2778
3643
|
onSelect
|
|
2779
3644
|
}) {
|
|
2780
|
-
return /* @__PURE__ */
|
|
2781
|
-
/* @__PURE__ */
|
|
2782
|
-
/* @__PURE__ */
|
|
3645
|
+
return /* @__PURE__ */ jsxs14("div", { className: "rs-screen", children: [
|
|
3646
|
+
/* @__PURE__ */ jsxs14("div", { className: "rs-screen-body rs-screen-body--gap-32", children: [
|
|
3647
|
+
/* @__PURE__ */ jsx16(
|
|
2783
3648
|
BodyHeader,
|
|
2784
3649
|
{
|
|
2785
|
-
icon: /* @__PURE__ */
|
|
3650
|
+
icon: /* @__PURE__ */ jsx16(WalletIcon, {}),
|
|
2786
3651
|
title: `Transfer from ${sourceLabel}`,
|
|
2787
3652
|
subtitle: "Pick the balance to import"
|
|
2788
3653
|
}
|
|
2789
3654
|
),
|
|
2790
|
-
/* @__PURE__ */
|
|
3655
|
+
/* @__PURE__ */ jsx16("div", { className: "rs-asset-list", children: assets.map((asset) => {
|
|
2791
3656
|
const tokenAmount = asset.balance ? tokenFormatter.format(
|
|
2792
3657
|
Number(asset.balance) / 10 ** asset.decimals
|
|
2793
3658
|
) : "0";
|
|
@@ -2795,23 +3660,23 @@ function DappImportAssetSelectStep({
|
|
|
2795
3660
|
const tokenIcon = asset.icon ?? getTokenIcon(asset.symbol);
|
|
2796
3661
|
const chainIcon = getChainIcon(asset.chainId);
|
|
2797
3662
|
const badge = getChainBadge(asset.chainId);
|
|
2798
|
-
return /* @__PURE__ */
|
|
3663
|
+
return /* @__PURE__ */ jsxs14(
|
|
2799
3664
|
"button",
|
|
2800
3665
|
{
|
|
2801
3666
|
type: "button",
|
|
2802
3667
|
className: "rs-asset-row",
|
|
2803
3668
|
onClick: () => onSelect(asset),
|
|
2804
3669
|
children: [
|
|
2805
|
-
/* @__PURE__ */
|
|
2806
|
-
/* @__PURE__ */
|
|
2807
|
-
/* @__PURE__ */
|
|
2808
|
-
chainIcon ? /* @__PURE__ */
|
|
3670
|
+
/* @__PURE__ */ jsxs14("div", { className: "rs-asset-info", children: [
|
|
3671
|
+
/* @__PURE__ */ jsxs14("div", { className: "rs-asset-icon-wrapper", children: [
|
|
3672
|
+
/* @__PURE__ */ jsx16("span", { className: "rs-asset-icon", children: tokenIcon ? /* @__PURE__ */ jsx16("img", { src: tokenIcon, alt: asset.symbol }) : asset.symbol.slice(0, 4) }),
|
|
3673
|
+
chainIcon ? /* @__PURE__ */ jsx16("span", { className: "rs-asset-chain-badge", children: /* @__PURE__ */ jsx16(
|
|
2809
3674
|
"img",
|
|
2810
3675
|
{
|
|
2811
3676
|
src: chainIcon,
|
|
2812
3677
|
alt: getChainName(asset.chainId)
|
|
2813
3678
|
}
|
|
2814
|
-
) }) : /* @__PURE__ */
|
|
3679
|
+
) }) : /* @__PURE__ */ jsx16(
|
|
2815
3680
|
"span",
|
|
2816
3681
|
{
|
|
2817
3682
|
className: "rs-asset-chain-badge",
|
|
@@ -2820,29 +3685,29 @@ function DappImportAssetSelectStep({
|
|
|
2820
3685
|
}
|
|
2821
3686
|
)
|
|
2822
3687
|
] }),
|
|
2823
|
-
/* @__PURE__ */
|
|
2824
|
-
/* @__PURE__ */
|
|
2825
|
-
/* @__PURE__ */
|
|
2826
|
-
/* @__PURE__ */
|
|
3688
|
+
/* @__PURE__ */ jsxs14("div", { className: "rs-asset-text", children: [
|
|
3689
|
+
/* @__PURE__ */ jsxs14("div", { className: "rs-asset-name-row", children: [
|
|
3690
|
+
/* @__PURE__ */ jsx16("span", { className: "rs-asset-name", children: asset.symbol }),
|
|
3691
|
+
/* @__PURE__ */ jsxs14("span", { className: "rs-asset-chain", children: [
|
|
2827
3692
|
"on ",
|
|
2828
3693
|
asset.sourceLabel
|
|
2829
3694
|
] })
|
|
2830
3695
|
] }),
|
|
2831
|
-
/* @__PURE__ */
|
|
3696
|
+
/* @__PURE__ */ jsxs14("div", { className: "rs-asset-balance-small", children: [
|
|
2832
3697
|
tokenAmount,
|
|
2833
3698
|
" ",
|
|
2834
3699
|
asset.symbol
|
|
2835
3700
|
] })
|
|
2836
3701
|
] })
|
|
2837
3702
|
] }),
|
|
2838
|
-
/* @__PURE__ */
|
|
3703
|
+
/* @__PURE__ */ jsx16("div", { className: "rs-asset-balance", children: balanceUsd })
|
|
2839
3704
|
]
|
|
2840
3705
|
},
|
|
2841
3706
|
asset.id
|
|
2842
3707
|
);
|
|
2843
3708
|
}) })
|
|
2844
3709
|
] }),
|
|
2845
|
-
/* @__PURE__ */
|
|
3710
|
+
/* @__PURE__ */ jsx16(PoweredBy, {})
|
|
2846
3711
|
] });
|
|
2847
3712
|
}
|
|
2848
3713
|
DappImportAssetSelectStep.displayName = "DappImportAssetSelectStep";
|
|
@@ -3411,6 +4276,7 @@ function applyBack(state, hasWalletOptions) {
|
|
|
3411
4276
|
targetAmount: null,
|
|
3412
4277
|
targetTokenPriceUsd: null,
|
|
3413
4278
|
balance: null,
|
|
4279
|
+
inputAmountUsd: null,
|
|
3414
4280
|
liquidityWarning: null
|
|
3415
4281
|
},
|
|
3416
4282
|
flow: {
|
|
@@ -3456,8 +4322,19 @@ function applyBack(state, hasWalletOptions) {
|
|
|
3456
4322
|
},
|
|
3457
4323
|
flow: { ...state.flow, step: "solana-amount", hasNavigatedBack: true }
|
|
3458
4324
|
};
|
|
4325
|
+
case "exchange-connect":
|
|
4326
|
+
return {
|
|
4327
|
+
...state,
|
|
4328
|
+
flow: {
|
|
4329
|
+
...state.flow,
|
|
4330
|
+
step: "exchange-select",
|
|
4331
|
+
hasNavigatedBack: true
|
|
4332
|
+
}
|
|
4333
|
+
};
|
|
3459
4334
|
case "select-asset":
|
|
3460
4335
|
case "deposit-address":
|
|
4336
|
+
case "fiat-onramp":
|
|
4337
|
+
case "exchange-select":
|
|
3461
4338
|
case "solana-token-select":
|
|
3462
4339
|
case "dapp-import-asset-select":
|
|
3463
4340
|
return {
|
|
@@ -3474,7 +4351,8 @@ function applyBack(state, hasWalletOptions) {
|
|
|
3474
4351
|
...state.dappImport,
|
|
3475
4352
|
activeProviderId: null,
|
|
3476
4353
|
selectedAsset: null
|
|
3477
|
-
}
|
|
4354
|
+
},
|
|
4355
|
+
exchange: { selectedConnection: null }
|
|
3478
4356
|
};
|
|
3479
4357
|
case "connect":
|
|
3480
4358
|
case "setup":
|
|
@@ -3487,7 +4365,8 @@ function applyBack(state, hasWalletOptions) {
|
|
|
3487
4365
|
mode: null,
|
|
3488
4366
|
isConnectSelectionConfirmed: false,
|
|
3489
4367
|
hasNavigatedBack: hasWalletOptions || state.flow.hasNavigatedBack
|
|
3490
|
-
}
|
|
4368
|
+
},
|
|
4369
|
+
exchange: { selectedConnection: null }
|
|
3491
4370
|
};
|
|
3492
4371
|
}
|
|
3493
4372
|
return state;
|
|
@@ -3507,6 +4386,10 @@ function modeEntryStep(mode) {
|
|
|
3507
4386
|
return "solana-token-select";
|
|
3508
4387
|
case "dapp-import":
|
|
3509
4388
|
return "dapp-import-asset-select";
|
|
4389
|
+
case "fiat-onramp":
|
|
4390
|
+
return "fiat-onramp";
|
|
4391
|
+
case "exchange-connect":
|
|
4392
|
+
return "exchange-select";
|
|
3510
4393
|
}
|
|
3511
4394
|
}
|
|
3512
4395
|
function updateSetupEntry(state, owner, update) {
|
|
@@ -3552,7 +4435,8 @@ function applyAction(state, action) {
|
|
|
3552
4435
|
...state.dappImport,
|
|
3553
4436
|
activeProviderId: null,
|
|
3554
4437
|
selectedAsset: null
|
|
3555
|
-
}
|
|
4438
|
+
},
|
|
4439
|
+
exchange: { selectedConnection: null }
|
|
3556
4440
|
};
|
|
3557
4441
|
case "connect/wallet-confirmed":
|
|
3558
4442
|
if (!action.mode) return state;
|
|
@@ -3576,6 +4460,39 @@ function applyAction(state, action) {
|
|
|
3576
4460
|
step: "deposit-address"
|
|
3577
4461
|
}
|
|
3578
4462
|
};
|
|
4463
|
+
case "connect/fiat-onramp-selected":
|
|
4464
|
+
return {
|
|
4465
|
+
...state,
|
|
4466
|
+
flow: {
|
|
4467
|
+
...state.flow,
|
|
4468
|
+
mode: "fiat-onramp",
|
|
4469
|
+
isConnectSelectionConfirmed: true,
|
|
4470
|
+
step: modeEntryStep("fiat-onramp")
|
|
4471
|
+
},
|
|
4472
|
+
fiat: { ...state.fiat, selectedMethod: action.paymentMethod ?? null }
|
|
4473
|
+
};
|
|
4474
|
+
case "connect/exchange-selected":
|
|
4475
|
+
return {
|
|
4476
|
+
...state,
|
|
4477
|
+
flow: {
|
|
4478
|
+
...state.flow,
|
|
4479
|
+
mode: "exchange-connect",
|
|
4480
|
+
isConnectSelectionConfirmed: true,
|
|
4481
|
+
step: modeEntryStep("exchange-connect")
|
|
4482
|
+
},
|
|
4483
|
+
exchange: { selectedConnection: null }
|
|
4484
|
+
};
|
|
4485
|
+
case "exchange/connection-selected":
|
|
4486
|
+
return {
|
|
4487
|
+
...state,
|
|
4488
|
+
flow: {
|
|
4489
|
+
...state.flow,
|
|
4490
|
+
mode: "exchange-connect",
|
|
4491
|
+
isConnectSelectionConfirmed: true,
|
|
4492
|
+
step: "exchange-connect"
|
|
4493
|
+
},
|
|
4494
|
+
exchange: { selectedConnection: action.connection }
|
|
4495
|
+
};
|
|
3579
4496
|
case "connect/auto-locked":
|
|
3580
4497
|
return {
|
|
3581
4498
|
...state,
|
|
@@ -3601,7 +4518,8 @@ function applyAction(state, action) {
|
|
|
3601
4518
|
...state.dappImport,
|
|
3602
4519
|
activeProviderId: null,
|
|
3603
4520
|
selectedAsset: null
|
|
3604
|
-
}
|
|
4521
|
+
},
|
|
4522
|
+
exchange: { selectedConnection: null }
|
|
3605
4523
|
};
|
|
3606
4524
|
case "setup/started": {
|
|
3607
4525
|
const existing = state.setup.byOwner[ownerKey(action.owner)];
|
|
@@ -3666,7 +4584,11 @@ function applyAction(state, action) {
|
|
|
3666
4584
|
selectedAsset: action.asset,
|
|
3667
4585
|
// Seed the user-facing amount input with the modal's defaultAmount
|
|
3668
4586
|
// on first visit. Subsequent visits override via amount/entered.
|
|
3669
|
-
|
|
4587
|
+
// `inputAmountUsd` is the USD-style value the input shows; it (not
|
|
4588
|
+
// the native `amount`) is what re-seeds the input on back, so seed
|
|
4589
|
+
// it here too and reset it on a fresh pick.
|
|
4590
|
+
amount: action.seedAmount ?? state.deposit.amount,
|
|
4591
|
+
inputAmountUsd: action.seedAmount ?? null
|
|
3670
4592
|
},
|
|
3671
4593
|
flow: { ...state.flow, step: "amount" }
|
|
3672
4594
|
};
|
|
@@ -3679,6 +4601,11 @@ function applyAction(state, action) {
|
|
|
3679
4601
|
targetAmount: action.targetAmount,
|
|
3680
4602
|
targetTokenPriceUsd: action.targetTokenPriceUsd,
|
|
3681
4603
|
balance: action.balance ?? null,
|
|
4604
|
+
// `targetAmount` is the USD-style value the user typed. Preserve it
|
|
4605
|
+
// as `inputAmountUsd` so back-from-confirm re-seeds the input with
|
|
4606
|
+
// the typed USD value rather than the converted native `amount`
|
|
4607
|
+
// (which corrupts the input for non-stablecoin priced tokens).
|
|
4608
|
+
inputAmountUsd: action.targetAmount,
|
|
3682
4609
|
liquidityWarning: action.liquidityWarning ?? null
|
|
3683
4610
|
},
|
|
3684
4611
|
flow: { ...state.flow, step: "confirm" }
|
|
@@ -3719,7 +4646,11 @@ function applyAction(state, action) {
|
|
|
3719
4646
|
sourceChain: action.sourceChain,
|
|
3720
4647
|
sourceToken: action.sourceToken ?? null,
|
|
3721
4648
|
sourceSymbol: action.sourceSymbol ?? null,
|
|
3722
|
-
sourceDecimals: action.sourceDecimals ?? null
|
|
4649
|
+
sourceDecimals: action.sourceDecimals ?? null,
|
|
4650
|
+
// The submit site's declared USD value, not the lingering typed
|
|
4651
|
+
// input — a submit that doesn't know it (fiat onramp) must not
|
|
4652
|
+
// inherit one from an abandoned wallet attempt.
|
|
4653
|
+
inputAmountUsd: action.inputAmountUsd ?? null
|
|
3723
4654
|
},
|
|
3724
4655
|
processing: {
|
|
3725
4656
|
...state.processing,
|
|
@@ -3827,7 +4758,9 @@ function applyAction(state, action) {
|
|
|
3827
4758
|
activeProviderId: null,
|
|
3828
4759
|
selectedAsset: null
|
|
3829
4760
|
},
|
|
3830
|
-
setup: { byOwner: preservedByOwner }
|
|
4761
|
+
setup: { byOwner: preservedByOwner },
|
|
4762
|
+
fiat: { selectedMethod: null },
|
|
4763
|
+
exchange: { selectedConnection: null }
|
|
3831
4764
|
};
|
|
3832
4765
|
}
|
|
3833
4766
|
case "target/changed": {
|
|
@@ -3901,6 +4834,12 @@ function createInitialState(overrides) {
|
|
|
3901
4834
|
},
|
|
3902
4835
|
setup: {
|
|
3903
4836
|
byOwner: {}
|
|
4837
|
+
},
|
|
4838
|
+
fiat: {
|
|
4839
|
+
selectedMethod: null
|
|
4840
|
+
},
|
|
4841
|
+
exchange: {
|
|
4842
|
+
selectedConnection: null
|
|
3904
4843
|
}
|
|
3905
4844
|
};
|
|
3906
4845
|
}
|
|
@@ -4203,23 +5142,23 @@ function mapError(error) {
|
|
|
4203
5142
|
}
|
|
4204
5143
|
|
|
4205
5144
|
// src/DepositFlow.tsx
|
|
4206
|
-
import { Fragment as Fragment3, jsx as
|
|
5145
|
+
import { Fragment as Fragment3, jsx as jsx17, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
4207
5146
|
function AccountPreparingSkeleton({
|
|
4208
5147
|
errorMessage,
|
|
4209
5148
|
onRetry
|
|
4210
5149
|
}) {
|
|
4211
|
-
return /* @__PURE__ */
|
|
4212
|
-
/* @__PURE__ */
|
|
4213
|
-
/* @__PURE__ */
|
|
4214
|
-
/* @__PURE__ */
|
|
4215
|
-
] }) : /* @__PURE__ */
|
|
4216
|
-
errorMessage && onRetry && /* @__PURE__ */
|
|
5150
|
+
return /* @__PURE__ */ jsxs15("div", { className: "rs-step", children: [
|
|
5151
|
+
/* @__PURE__ */ jsx17("div", { className: "rs-step-body", style: { paddingTop: 0 }, children: /* @__PURE__ */ jsx17("div", { className: "rs-loading-state", children: /* @__PURE__ */ jsx17("div", { className: "rs-loading-text", children: errorMessage ? /* @__PURE__ */ jsxs15(Fragment3, { children: [
|
|
5152
|
+
/* @__PURE__ */ jsx17("div", { className: "rs-loading-title rs-text-error", children: "Couldn\u2019t prepare account" }),
|
|
5153
|
+
/* @__PURE__ */ jsx17("div", { className: "rs-loading-subtitle", children: errorMessage })
|
|
5154
|
+
] }) : /* @__PURE__ */ jsx17("div", { className: "rs-loading-title", children: "Preparing\u2026" }) }) }) }),
|
|
5155
|
+
errorMessage && onRetry && /* @__PURE__ */ jsx17("div", { className: "rs-step-footer", children: /* @__PURE__ */ jsx17(
|
|
4217
5156
|
"button",
|
|
4218
5157
|
{
|
|
4219
5158
|
type: "button",
|
|
4220
5159
|
className: "rs-button rs-button--default rs-button--full-width",
|
|
4221
5160
|
onClick: onRetry,
|
|
4222
|
-
children: /* @__PURE__ */
|
|
5161
|
+
children: /* @__PURE__ */ jsx17("span", { children: "Try again" })
|
|
4223
5162
|
}
|
|
4224
5163
|
) })
|
|
4225
5164
|
] });
|
|
@@ -4228,10 +5167,13 @@ var QR_AUTO_ADVANCE_HYDRATION_GRACE_MS = 1e3;
|
|
|
4228
5167
|
function isSameRoute2(sourceChain, sourceToken, targetChain, targetToken) {
|
|
4229
5168
|
return sourceChain === targetChain && sourceToken.toLowerCase() === targetToken.toLowerCase();
|
|
4230
5169
|
}
|
|
5170
|
+
var SWAPPED_SOURCE_CHAIN = 8453;
|
|
5171
|
+
var SWAPPED_SOURCE_TOKEN = "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913";
|
|
5172
|
+
var SWAPPED_SOURCE_DECIMALS = 6;
|
|
4231
5173
|
function getAddressKey(address) {
|
|
4232
5174
|
return address ? address.toLowerCase() : null;
|
|
4233
5175
|
}
|
|
4234
|
-
function deriveStep(flow, d, p, activeEntry) {
|
|
5176
|
+
function deriveStep(flow, d, p, activeEntry, fiat, exchange) {
|
|
4235
5177
|
const flowStep = flow.step;
|
|
4236
5178
|
const smartAccount = activeEntry.smartAccount;
|
|
4237
5179
|
const solanaDepositAddress = activeEntry.solanaDepositAddress;
|
|
@@ -4246,6 +5188,23 @@ function deriveStep(flow, d, p, activeEntry) {
|
|
|
4246
5188
|
smartAccount,
|
|
4247
5189
|
solanaDepositAddress: solanaDepositAddress ?? void 0
|
|
4248
5190
|
};
|
|
5191
|
+
case "fiat-onramp":
|
|
5192
|
+
if (!smartAccount) return { type: "setup" };
|
|
5193
|
+
return {
|
|
5194
|
+
type: "fiat-onramp",
|
|
5195
|
+
smartAccount,
|
|
5196
|
+
paymentMethod: fiat.selectedMethod ?? void 0
|
|
5197
|
+
};
|
|
5198
|
+
case "exchange-select":
|
|
5199
|
+
return { type: "exchange-select" };
|
|
5200
|
+
case "exchange-connect":
|
|
5201
|
+
if (!exchange.selectedConnection) return { type: "exchange-select" };
|
|
5202
|
+
if (!smartAccount) return { type: "setup" };
|
|
5203
|
+
return {
|
|
5204
|
+
type: "exchange-connect",
|
|
5205
|
+
smartAccount,
|
|
5206
|
+
connection: exchange.selectedConnection
|
|
5207
|
+
};
|
|
4249
5208
|
case "select-asset":
|
|
4250
5209
|
if (!smartAccount) return { type: "setup" };
|
|
4251
5210
|
return { type: "select-asset", smartAccount };
|
|
@@ -4255,7 +5214,9 @@ function deriveStep(flow, d, p, activeEntry) {
|
|
|
4255
5214
|
type: "amount",
|
|
4256
5215
|
smartAccount,
|
|
4257
5216
|
asset: d.selectedAsset,
|
|
4258
|
-
|
|
5217
|
+
// Seed the input from the USD-style value the user typed, not the
|
|
5218
|
+
// native source `amount` (which would corrupt the input on back).
|
|
5219
|
+
inputAmountUsd: d.inputAmountUsd ?? void 0
|
|
4259
5220
|
};
|
|
4260
5221
|
case "confirm":
|
|
4261
5222
|
if (!smartAccount || !d.selectedAsset || !d.amount || !d.targetAmount) {
|
|
@@ -4324,6 +5285,7 @@ function deriveStep(flow, d, p, activeEntry) {
|
|
|
4324
5285
|
amount: d.amount,
|
|
4325
5286
|
sourceSymbol: d.sourceSymbol ?? void 0,
|
|
4326
5287
|
sourceDecimals: d.sourceDecimals ?? void 0,
|
|
5288
|
+
inputAmountUsd: d.inputAmountUsd ?? void 0,
|
|
4327
5289
|
directTransfer: p.directTransfer
|
|
4328
5290
|
};
|
|
4329
5291
|
}
|
|
@@ -4332,6 +5294,8 @@ function resolveOwnerForMode(mode, ctx) {
|
|
|
4332
5294
|
switch (mode) {
|
|
4333
5295
|
case "deposit-address":
|
|
4334
5296
|
case "solana-wallet":
|
|
5297
|
+
case "fiat-onramp":
|
|
5298
|
+
case "exchange-connect":
|
|
4335
5299
|
return ctx.dappAddress ?? null;
|
|
4336
5300
|
case "wallet":
|
|
4337
5301
|
return ctx.walletOwner ?? null;
|
|
@@ -4360,9 +5324,12 @@ function DepositFlow({
|
|
|
4360
5324
|
signerAddress = DEFAULT_SIGNER_ADDRESS,
|
|
4361
5325
|
sessionChainIds,
|
|
4362
5326
|
forceRegister = false,
|
|
4363
|
-
waitForFinalTx = true,
|
|
4364
5327
|
enableSolana = true,
|
|
4365
5328
|
dappImports,
|
|
5329
|
+
enableFiatOnramp = false,
|
|
5330
|
+
enableQrTransfer = true,
|
|
5331
|
+
fiatOnrampMethods,
|
|
5332
|
+
enableExchangeConnect = false,
|
|
4366
5333
|
reownWallet,
|
|
4367
5334
|
onConnect,
|
|
4368
5335
|
onDisconnect,
|
|
@@ -4391,31 +5358,33 @@ function DepositFlow({
|
|
|
4391
5358
|
const depositSlice = useDepositStore((s) => s.deposit);
|
|
4392
5359
|
const processingSlice = useDepositStore((s) => s.processing);
|
|
4393
5360
|
const setupSlice = useDepositStore((s) => s.setup);
|
|
5361
|
+
const fiatSlice = useDepositStore((s) => s.fiat);
|
|
5362
|
+
const exchangeSlice = useDepositStore((s) => s.exchange);
|
|
4394
5363
|
const flowMode = flowSlice.mode;
|
|
4395
5364
|
const isConnectSelectionConfirmed = flowSlice.isConnectSelectionConfirmed;
|
|
4396
5365
|
const hasNavigatedBack = flowSlice.hasNavigatedBack;
|
|
4397
5366
|
const selectedWalletId = useDepositStore(selectedWalletIdSelector);
|
|
4398
|
-
const [totalBalanceUsd, setTotalBalanceUsd] =
|
|
4399
|
-
const [hasQrAutoAdvanceGraceElapsed, setHasQrAutoAdvanceGraceElapsed] =
|
|
4400
|
-
const portfolioAssetsRef =
|
|
4401
|
-
const stableWalletSignerRef =
|
|
4402
|
-
const stableWalletSelectionKeyRef =
|
|
4403
|
-
const logFlow =
|
|
5367
|
+
const [totalBalanceUsd, setTotalBalanceUsd] = useState11(0);
|
|
5368
|
+
const [hasQrAutoAdvanceGraceElapsed, setHasQrAutoAdvanceGraceElapsed] = useState11(() => !hasInitialWalletHydrationPending);
|
|
5369
|
+
const portfolioAssetsRef = useRef8([]);
|
|
5370
|
+
const stableWalletSignerRef = useRef8(null);
|
|
5371
|
+
const stableWalletSelectionKeyRef = useRef8(null);
|
|
5372
|
+
const logFlow = useCallback7(
|
|
4404
5373
|
(message, data) => {
|
|
4405
5374
|
debugLog(debug, "deposit-flow", message, data);
|
|
4406
5375
|
},
|
|
4407
5376
|
[debug]
|
|
4408
5377
|
);
|
|
4409
|
-
const logFlowError =
|
|
5378
|
+
const logFlowError = useCallback7(
|
|
4410
5379
|
(message, error, data) => {
|
|
4411
5380
|
debugError(debug, "deposit-flow", message, error, data);
|
|
4412
5381
|
},
|
|
4413
5382
|
[debug]
|
|
4414
5383
|
);
|
|
4415
|
-
const handleAssetsLoaded =
|
|
5384
|
+
const handleAssetsLoaded = useCallback7((assets) => {
|
|
4416
5385
|
portfolioAssetsRef.current = assets;
|
|
4417
5386
|
}, []);
|
|
4418
|
-
const getTokenPriceUsd =
|
|
5387
|
+
const getTokenPriceUsd = useCallback7((symbol) => {
|
|
4419
5388
|
const sym = symbol.toLowerCase();
|
|
4420
5389
|
for (const asset of portfolioAssetsRef.current) {
|
|
4421
5390
|
if (asset.symbol.toLowerCase() === sym && asset.balanceUsd && asset.balance) {
|
|
@@ -4430,14 +5399,14 @@ function DepositFlow({
|
|
|
4430
5399
|
}
|
|
4431
5400
|
return null;
|
|
4432
5401
|
}, []);
|
|
4433
|
-
const dappSwitchChain =
|
|
5402
|
+
const dappSwitchChain = useMemo7(() => {
|
|
4434
5403
|
if (!dappWalletClient?.switchChain) return void 0;
|
|
4435
5404
|
return async (chainId) => {
|
|
4436
5405
|
await dappWalletClient.switchChain?.({ id: chainId });
|
|
4437
5406
|
};
|
|
4438
5407
|
}, [dappWalletClient]);
|
|
4439
5408
|
const connectedWalletAddress = dappWalletClient?.account?.address ?? null;
|
|
4440
|
-
const walletOptions =
|
|
5409
|
+
const walletOptions = useMemo7(() => {
|
|
4441
5410
|
const options = [];
|
|
4442
5411
|
const seen = /* @__PURE__ */ new Set();
|
|
4443
5412
|
if (connectedWalletAddress && dappAddress) {
|
|
@@ -4489,7 +5458,7 @@ function DepositFlow({
|
|
|
4489
5458
|
reownWallet?.solanaAddress,
|
|
4490
5459
|
reownWallet?.caipAddress
|
|
4491
5460
|
]);
|
|
4492
|
-
const canAutoLock = dappWalletClient?.account && dappAddress && !reownWallet;
|
|
5461
|
+
const canAutoLock = dappWalletClient?.account && dappAddress && !reownWallet && !enableFiatOnramp && !enableExchangeConnect;
|
|
4493
5462
|
const hasWalletOptions = walletOptions.length > 0;
|
|
4494
5463
|
const hasReownSession = Boolean(
|
|
4495
5464
|
enableSolana ? reownWallet?.isConnected || reownWallet?.address : reownWallet?.address
|
|
@@ -4498,7 +5467,7 @@ function DepositFlow({
|
|
|
4498
5467
|
dappAddress && !hasWalletOptions && (hasDappWalletClientProp && dappWalletClient === void 0 || reownWallet && !hasReownSession && !reownWallet.isReady)
|
|
4499
5468
|
);
|
|
4500
5469
|
const showConnectStep = flowMode === null && !isConnectSelectionConfirmed;
|
|
4501
|
-
|
|
5470
|
+
useEffect10(() => {
|
|
4502
5471
|
if (!isWalletHydrationPending) {
|
|
4503
5472
|
setHasQrAutoAdvanceGraceElapsed(true);
|
|
4504
5473
|
return;
|
|
@@ -4509,7 +5478,7 @@ function DepositFlow({
|
|
|
4509
5478
|
}, QR_AUTO_ADVANCE_HYDRATION_GRACE_MS);
|
|
4510
5479
|
return () => window.clearTimeout(timeout);
|
|
4511
5480
|
}, [isWalletHydrationPending]);
|
|
4512
|
-
const walletSelectionKey =
|
|
5481
|
+
const walletSelectionKey = useMemo7(() => {
|
|
4513
5482
|
if (flowMode !== "wallet" && flowMode !== "dapp-import") return null;
|
|
4514
5483
|
if (canAutoLock) {
|
|
4515
5484
|
return getAddressKey(connectedWalletAddress);
|
|
@@ -4523,11 +5492,11 @@ function DepositFlow({
|
|
|
4523
5492
|
isConnectSelectionConfirmed,
|
|
4524
5493
|
selectedWalletId
|
|
4525
5494
|
]);
|
|
4526
|
-
const setupChainId = typeof targetChain === "number" ? targetChain : typeof defaultSourceChain === "number" ? defaultSourceChain : base.id;
|
|
5495
|
+
const setupChainId = typeof targetChain === "number" && !isVirtualDestination(targetChain) ? targetChain : typeof defaultSourceChain === "number" ? defaultSourceChain : base.id;
|
|
4527
5496
|
const targetSymbol = getTargetTokenSymbol(targetToken, targetChain);
|
|
4528
5497
|
const isTargetStablecoin = isStablecoinSymbol(targetSymbol);
|
|
4529
|
-
const targetMarketPriceRef =
|
|
4530
|
-
|
|
5498
|
+
const targetMarketPriceRef = useRef8(null);
|
|
5499
|
+
useEffect10(() => {
|
|
4531
5500
|
targetMarketPriceRef.current = null;
|
|
4532
5501
|
if (isTargetStablecoin || targetSymbol === "Token") {
|
|
4533
5502
|
return;
|
|
@@ -4542,7 +5511,7 @@ function DepositFlow({
|
|
|
4542
5511
|
cancelled = true;
|
|
4543
5512
|
};
|
|
4544
5513
|
}, [service, targetSymbol, isTargetStablecoin]);
|
|
4545
|
-
const walletSignerContext =
|
|
5514
|
+
const walletSignerContext = useMemo7(() => {
|
|
4546
5515
|
if (flowMode === "deposit-address") {
|
|
4547
5516
|
return null;
|
|
4548
5517
|
}
|
|
@@ -4608,7 +5577,7 @@ function DepositFlow({
|
|
|
4608
5577
|
reownWallet,
|
|
4609
5578
|
setupChainId
|
|
4610
5579
|
]);
|
|
4611
|
-
|
|
5580
|
+
useEffect10(() => {
|
|
4612
5581
|
if (flowMode !== "wallet" && flowMode !== "dapp-import") {
|
|
4613
5582
|
stableWalletSelectionKeyRef.current = null;
|
|
4614
5583
|
stableWalletSignerRef.current = null;
|
|
@@ -4623,7 +5592,7 @@ function DepositFlow({
|
|
|
4623
5592
|
stableWalletSignerRef.current = walletSignerContext;
|
|
4624
5593
|
}
|
|
4625
5594
|
}, [flowMode, walletSelectionKey, walletSignerContext]);
|
|
4626
|
-
const signerContext =
|
|
5595
|
+
const signerContext = useMemo7(() => {
|
|
4627
5596
|
if (flowMode === "deposit-address") {
|
|
4628
5597
|
if (!dappAddress) return null;
|
|
4629
5598
|
return {
|
|
@@ -4651,7 +5620,7 @@ function DepositFlow({
|
|
|
4651
5620
|
walletSignerContext,
|
|
4652
5621
|
walletSelectionKey
|
|
4653
5622
|
]);
|
|
4654
|
-
const selectedEvmWalletOwner =
|
|
5623
|
+
const selectedEvmWalletOwner = useMemo7(() => {
|
|
4655
5624
|
if (!selectedWalletId) return null;
|
|
4656
5625
|
const opt = walletOptions.find((o) => o.id === selectedWalletId);
|
|
4657
5626
|
if (opt?.kind === "external" && opt.address) {
|
|
@@ -4662,7 +5631,7 @@ function DepositFlow({
|
|
|
4662
5631
|
}
|
|
4663
5632
|
return null;
|
|
4664
5633
|
}, [selectedWalletId, walletOptions]);
|
|
4665
|
-
const dappImportOwner =
|
|
5634
|
+
const dappImportOwner = useMemo7(() => {
|
|
4666
5635
|
if (selectedEvmWalletOwner) return selectedEvmWalletOwner;
|
|
4667
5636
|
if (reownWallet?.address && reownWallet.isConnected) {
|
|
4668
5637
|
return reownWallet.address;
|
|
@@ -4675,7 +5644,7 @@ function DepositFlow({
|
|
|
4675
5644
|
reownWallet?.isConnected,
|
|
4676
5645
|
connectedWalletAddress
|
|
4677
5646
|
]);
|
|
4678
|
-
const activeOwner =
|
|
5647
|
+
const activeOwner = useMemo7(
|
|
4679
5648
|
() => resolveOwnerForMode(flowMode, {
|
|
4680
5649
|
dappAddress,
|
|
4681
5650
|
walletOwner: signerContext?.ownerAddress ?? (canAutoLock ? connectedWalletAddress : selectedEvmWalletOwner),
|
|
@@ -4691,12 +5660,12 @@ function DepositFlow({
|
|
|
4691
5660
|
dappImportOwner
|
|
4692
5661
|
]
|
|
4693
5662
|
);
|
|
4694
|
-
const activeEntry =
|
|
5663
|
+
const activeEntry = useMemo7(
|
|
4695
5664
|
() => readSetupForOwner(setupSlice, activeOwner),
|
|
4696
5665
|
[setupSlice, activeOwner]
|
|
4697
5666
|
);
|
|
4698
|
-
const lastActiveSetupLifecycleKeyRef =
|
|
4699
|
-
|
|
5667
|
+
const lastActiveSetupLifecycleKeyRef = useRef8(null);
|
|
5668
|
+
useEffect10(() => {
|
|
4700
5669
|
if (!flowMode || !isConnectSelectionConfirmed) {
|
|
4701
5670
|
lastActiveSetupLifecycleKeyRef.current = null;
|
|
4702
5671
|
return;
|
|
@@ -4732,12 +5701,26 @@ function DepositFlow({
|
|
|
4732
5701
|
activeEntry.solanaDepositAddress,
|
|
4733
5702
|
onLifecycleRef
|
|
4734
5703
|
]);
|
|
4735
|
-
const effectiveStep =
|
|
4736
|
-
() => deriveStep(
|
|
4737
|
-
|
|
5704
|
+
const effectiveStep = useMemo7(
|
|
5705
|
+
() => deriveStep(
|
|
5706
|
+
flowSlice,
|
|
5707
|
+
depositSlice,
|
|
5708
|
+
processingSlice,
|
|
5709
|
+
activeEntry,
|
|
5710
|
+
fiatSlice,
|
|
5711
|
+
exchangeSlice
|
|
5712
|
+
),
|
|
5713
|
+
[
|
|
5714
|
+
flowSlice,
|
|
5715
|
+
depositSlice,
|
|
5716
|
+
processingSlice,
|
|
5717
|
+
activeEntry,
|
|
5718
|
+
fiatSlice,
|
|
5719
|
+
exchangeSlice
|
|
5720
|
+
]
|
|
4738
5721
|
);
|
|
4739
5722
|
const step = effectiveStep;
|
|
4740
|
-
const handleBack =
|
|
5723
|
+
const handleBack = useCallback7(() => {
|
|
4741
5724
|
const stepBeforeBack = storeApi.getState().flow.step;
|
|
4742
5725
|
storeApi.dispatch({
|
|
4743
5726
|
type: "back/requested",
|
|
@@ -4747,16 +5730,52 @@ function DepositFlow({
|
|
|
4747
5730
|
portfolioAssetsRef.current = [];
|
|
4748
5731
|
}
|
|
4749
5732
|
}, [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;
|
|
5733
|
+
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 === "fiat-onramp" || effectiveStep.type === "exchange-select" || effectiveStep.type === "exchange-connect" || effectiveStep.type === "select-asset" && signerContext && !canAutoLock;
|
|
4751
5734
|
const currentBackHandler = canGoBackFromHere ? handleBack : void 0;
|
|
4752
5735
|
const currentScreen = showConnectStep ? "connect" : effectiveStep.type;
|
|
4753
|
-
|
|
5736
|
+
useEffect10(() => {
|
|
4754
5737
|
onStepChangeRef.current?.(currentBackHandler, currentScreen);
|
|
4755
5738
|
}, [currentBackHandler, currentScreen, onStepChangeRef]);
|
|
5739
|
+
const lastModalHeightRef = useRef8(0);
|
|
5740
|
+
const modalContentElRef = useRef8(null);
|
|
5741
|
+
useEffect10(() => {
|
|
5742
|
+
const mc = document.querySelector(".rs-modal-content");
|
|
5743
|
+
if (!mc) return;
|
|
5744
|
+
modalContentElRef.current = mc;
|
|
5745
|
+
const ro = new ResizeObserver((entries) => {
|
|
5746
|
+
for (const entry of entries) {
|
|
5747
|
+
const border = entry.borderBoxSize?.[0]?.blockSize;
|
|
5748
|
+
lastModalHeightRef.current = typeof border === "number" ? border : entry.contentRect.height;
|
|
5749
|
+
}
|
|
5750
|
+
});
|
|
5751
|
+
ro.observe(mc);
|
|
5752
|
+
return () => {
|
|
5753
|
+
ro.disconnect();
|
|
5754
|
+
modalContentElRef.current = null;
|
|
5755
|
+
};
|
|
5756
|
+
}, []);
|
|
5757
|
+
const stepPinKey = `${flowMode ?? "none"}:${step.type}`;
|
|
5758
|
+
const prevStepPinKeyRef = useRef8(stepPinKey);
|
|
5759
|
+
useLayoutEffect2(() => {
|
|
5760
|
+
if (prevStepPinKeyRef.current === stepPinKey) return;
|
|
5761
|
+
prevStepPinKeyRef.current = stepPinKey;
|
|
5762
|
+
const mc = document.querySelector(".rs-modal-content");
|
|
5763
|
+
const lastHeight = lastModalHeightRef.current;
|
|
5764
|
+
if (!mc || lastHeight <= 0) return;
|
|
5765
|
+
const prevTransition = mc.style.transition;
|
|
5766
|
+
mc.style.transition = "none";
|
|
5767
|
+
mc.style.setProperty("min-height", `${lastHeight}px`, "important");
|
|
5768
|
+
void mc.offsetHeight;
|
|
5769
|
+
const rafId = requestAnimationFrame(() => {
|
|
5770
|
+
mc.style.transition = prevTransition;
|
|
5771
|
+
mc.style.removeProperty("min-height");
|
|
5772
|
+
});
|
|
5773
|
+
return () => cancelAnimationFrame(rafId);
|
|
5774
|
+
}, [stepPinKey]);
|
|
4756
5775
|
const stepSendToken = effectiveStep.type === "amount" ? effectiveStep.asset.symbol : null;
|
|
4757
5776
|
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 =
|
|
4759
|
-
|
|
5777
|
+
const lastStepOpenEventKeyRef = useRef8(null);
|
|
5778
|
+
useEffect10(() => {
|
|
4760
5779
|
if (!stepOpenEventKey) {
|
|
4761
5780
|
lastStepOpenEventKeyRef.current = null;
|
|
4762
5781
|
return;
|
|
@@ -4798,7 +5817,7 @@ function DepositFlow({
|
|
|
4798
5817
|
totalBalanceUsd,
|
|
4799
5818
|
onEventRef
|
|
4800
5819
|
]);
|
|
4801
|
-
|
|
5820
|
+
useEffect10(() => {
|
|
4802
5821
|
logFlow("state:changed", {
|
|
4803
5822
|
step: effectiveStep.type,
|
|
4804
5823
|
flowMode,
|
|
@@ -4814,7 +5833,7 @@ function DepositFlow({
|
|
|
4814
5833
|
targetChain,
|
|
4815
5834
|
targetToken
|
|
4816
5835
|
]);
|
|
4817
|
-
|
|
5836
|
+
useEffect10(() => {
|
|
4818
5837
|
onLifecycleRef.current?.({
|
|
4819
5838
|
type: "balance-changed",
|
|
4820
5839
|
totalUsd: totalBalanceUsd
|
|
@@ -4823,10 +5842,12 @@ function DepositFlow({
|
|
|
4823
5842
|
const isDepositAddressMode = flowMode === "deposit-address";
|
|
4824
5843
|
const isSolanaWalletMode = flowMode === "solana-wallet";
|
|
4825
5844
|
const isDappImportMode = flowMode === "dapp-import";
|
|
4826
|
-
const
|
|
5845
|
+
const isFiatOnrampMode = flowMode === "fiat-onramp";
|
|
5846
|
+
const isExchangeConnectMode = flowMode === "exchange-connect";
|
|
5847
|
+
const handleSelectTransferCrypto = useCallback7(() => {
|
|
4827
5848
|
storeApi.dispatch({ type: "connect/transfer-crypto-selected" });
|
|
4828
5849
|
}, [storeApi]);
|
|
4829
|
-
const handleConfirmWallet =
|
|
5850
|
+
const handleConfirmWallet = useCallback7(
|
|
4830
5851
|
(walletId) => {
|
|
4831
5852
|
const selectedOption = walletOptions.find((o) => o.id === walletId);
|
|
4832
5853
|
const mode = enableSolana && selectedOption?.kind === "solana" ? "solana-wallet" : "wallet";
|
|
@@ -4842,12 +5863,12 @@ function DepositFlow({
|
|
|
4842
5863
|
enableSolana && reownWallet?.isConnected && reownWallet?.isSolana
|
|
4843
5864
|
);
|
|
4844
5865
|
const dappImportsKey = dappImports ? Object.keys(dappImports).filter((k) => dappImports[k]).sort().join(",") : "";
|
|
4845
|
-
const enabledDappImportProviders =
|
|
5866
|
+
const enabledDappImportProviders = useMemo7(
|
|
4846
5867
|
() => isSolanaWalletConnected ? [] : getEnabledProviders(dappImports),
|
|
4847
5868
|
// eslint-disable-next-line react-hooks/exhaustive-deps -- intentional: keyed on dappImportsKey, not the dappImports object identity
|
|
4848
5869
|
[dappImportsKey, isSolanaWalletConnected]
|
|
4849
5870
|
);
|
|
4850
|
-
const handleSelectDappImport =
|
|
5871
|
+
const handleSelectDappImport = useCallback7(
|
|
4851
5872
|
(providerId) => {
|
|
4852
5873
|
const owner = dappImportOwner;
|
|
4853
5874
|
if (owner) {
|
|
@@ -4868,13 +5889,13 @@ function DepositFlow({
|
|
|
4868
5889
|
},
|
|
4869
5890
|
[storeApi, walletOptions, dappImportOwner]
|
|
4870
5891
|
);
|
|
4871
|
-
const handleDappImportAssetSelected =
|
|
5892
|
+
const handleDappImportAssetSelected = useCallback7(
|
|
4872
5893
|
(asset) => {
|
|
4873
5894
|
storeApi.dispatch({ type: "dapp-import/asset-selected", asset });
|
|
4874
5895
|
},
|
|
4875
5896
|
[storeApi]
|
|
4876
5897
|
);
|
|
4877
|
-
|
|
5898
|
+
useEffect10(() => {
|
|
4878
5899
|
if (!dappImportOwner || enabledDappImportProviders.length === 0) {
|
|
4879
5900
|
storeApi.dispatch({ type: "dapp-import/availability-cleared" });
|
|
4880
5901
|
return;
|
|
@@ -4923,15 +5944,18 @@ function DepositFlow({
|
|
|
4923
5944
|
const activeDappImportProviderId = useDepositStore(
|
|
4924
5945
|
(s) => s.dappImport.activeProviderId
|
|
4925
5946
|
);
|
|
4926
|
-
const connectStepDappImports =
|
|
5947
|
+
const connectStepDappImports = useMemo7(
|
|
4927
5948
|
() => enabledDappImportProviders.map((provider) => {
|
|
4928
|
-
const availabilityEntry = dappImportOwner && dappImportAvailabilityOwner?.toLowerCase() === dappImportOwner.toLowerCase() ? dappImportAvailability[provider.id] : void 0;
|
|
4929
|
-
const dappImportSetup = readSetupForOwner(setupSlice, dappImportOwner);
|
|
4930
5949
|
const baseRow = {
|
|
4931
5950
|
id: provider.id,
|
|
4932
5951
|
label: provider.label,
|
|
4933
5952
|
icon: provider.icon
|
|
4934
5953
|
};
|
|
5954
|
+
if (!dappImportOwner) {
|
|
5955
|
+
return { ...baseRow, status: "needs-connect" };
|
|
5956
|
+
}
|
|
5957
|
+
const availabilityEntry = dappImportAvailabilityOwner?.toLowerCase() === dappImportOwner.toLowerCase() ? dappImportAvailability[provider.id] : void 0;
|
|
5958
|
+
const dappImportSetup = readSetupForOwner(setupSlice, dappImportOwner);
|
|
4935
5959
|
if (availabilityEntry === "loading" || availabilityEntry === void 0) {
|
|
4936
5960
|
return { ...baseRow, status: "loading" };
|
|
4937
5961
|
}
|
|
@@ -4970,13 +5994,13 @@ function DepositFlow({
|
|
|
4970
5994
|
dappImportOwner
|
|
4971
5995
|
]
|
|
4972
5996
|
);
|
|
4973
|
-
const activeDappImportProvider =
|
|
5997
|
+
const activeDappImportProvider = useMemo7(() => {
|
|
4974
5998
|
if (!activeDappImportProviderId) return null;
|
|
4975
5999
|
return enabledDappImportProviders.find(
|
|
4976
6000
|
(p) => p.id === activeDappImportProviderId
|
|
4977
6001
|
) ?? null;
|
|
4978
6002
|
}, [activeDappImportProviderId, enabledDappImportProviders]);
|
|
4979
|
-
const activeDappImportAvailability =
|
|
6003
|
+
const activeDappImportAvailability = useMemo7(() => {
|
|
4980
6004
|
if (!activeDappImportProviderId) return null;
|
|
4981
6005
|
if (!dappImportOwner || dappImportAvailabilityOwner?.toLowerCase() !== dappImportOwner.toLowerCase()) {
|
|
4982
6006
|
return null;
|
|
@@ -4990,7 +6014,28 @@ function DepositFlow({
|
|
|
4990
6014
|
dappImportAvailabilityOwner,
|
|
4991
6015
|
dappImportOwner
|
|
4992
6016
|
]);
|
|
4993
|
-
const
|
|
6017
|
+
const handleSelectFiatMethod = useCallback7(
|
|
6018
|
+
(paymentMethod) => {
|
|
6019
|
+
storeApi.dispatch({
|
|
6020
|
+
type: "connect/fiat-onramp-selected",
|
|
6021
|
+
paymentMethod
|
|
6022
|
+
});
|
|
6023
|
+
},
|
|
6024
|
+
[storeApi]
|
|
6025
|
+
);
|
|
6026
|
+
const handleSelectExchange = useCallback7(() => {
|
|
6027
|
+
storeApi.dispatch({ type: "connect/exchange-selected" });
|
|
6028
|
+
}, [storeApi]);
|
|
6029
|
+
const handleSelectExchangeConnection = useCallback7(
|
|
6030
|
+
(connection) => {
|
|
6031
|
+
storeApi.dispatch({
|
|
6032
|
+
type: "exchange/connection-selected",
|
|
6033
|
+
connection
|
|
6034
|
+
});
|
|
6035
|
+
},
|
|
6036
|
+
[storeApi]
|
|
6037
|
+
);
|
|
6038
|
+
const handleNewDeposit = useCallback7(() => {
|
|
4994
6039
|
onLifecycleRef.current?.({
|
|
4995
6040
|
type: "smart-account-changed",
|
|
4996
6041
|
evm: null,
|
|
@@ -5001,7 +6046,7 @@ function DepositFlow({
|
|
|
5001
6046
|
stableWalletSignerRef.current = null;
|
|
5002
6047
|
stableWalletSelectionKeyRef.current = null;
|
|
5003
6048
|
}, [onLifecycleRef, storeApi]);
|
|
5004
|
-
const setupInputBase =
|
|
6049
|
+
const setupInputBase = useMemo7(
|
|
5005
6050
|
() => ({
|
|
5006
6051
|
targetChain,
|
|
5007
6052
|
targetToken,
|
|
@@ -5027,7 +6072,7 @@ function DepositFlow({
|
|
|
5027
6072
|
enableSolana
|
|
5028
6073
|
]
|
|
5029
6074
|
);
|
|
5030
|
-
const desiredOwnersKey =
|
|
6075
|
+
const desiredOwnersKey = useMemo7(() => {
|
|
5031
6076
|
const owners = [];
|
|
5032
6077
|
const seen = /* @__PURE__ */ new Set();
|
|
5033
6078
|
const push = (addr) => {
|
|
@@ -5048,7 +6093,7 @@ function DepositFlow({
|
|
|
5048
6093
|
reownWallet?.address,
|
|
5049
6094
|
dappImportOwner
|
|
5050
6095
|
]);
|
|
5051
|
-
|
|
6096
|
+
useEffect10(() => {
|
|
5052
6097
|
desiredOwnersKey.forEach((owner) => {
|
|
5053
6098
|
void (async () => {
|
|
5054
6099
|
const input = {
|
|
@@ -5143,7 +6188,7 @@ function DepositFlow({
|
|
|
5143
6188
|
storeApi,
|
|
5144
6189
|
setupSlice.byOwner
|
|
5145
6190
|
]);
|
|
5146
|
-
const handleDepositAddressSubmitted =
|
|
6191
|
+
const handleDepositAddressSubmitted = useCallback7(
|
|
5147
6192
|
(data) => {
|
|
5148
6193
|
logFlow("deposit-address:detected", {
|
|
5149
6194
|
txHash: data.txHash,
|
|
@@ -5154,7 +6199,7 @@ function DepositFlow({
|
|
|
5154
6199
|
},
|
|
5155
6200
|
[logFlow, onLifecycleRef]
|
|
5156
6201
|
);
|
|
5157
|
-
const handleSolanaTokenContinue =
|
|
6202
|
+
const handleSolanaTokenContinue = useCallback7(
|
|
5158
6203
|
(token, balance, balanceUsd) => {
|
|
5159
6204
|
logFlow("solana:token:continue", { token: token.symbol });
|
|
5160
6205
|
storeApi.dispatch({
|
|
@@ -5167,7 +6212,7 @@ function DepositFlow({
|
|
|
5167
6212
|
},
|
|
5168
6213
|
[defaultAmount, logFlow, storeApi]
|
|
5169
6214
|
);
|
|
5170
|
-
const handleSolanaAmountContinue =
|
|
6215
|
+
const handleSolanaAmountContinue = useCallback7(
|
|
5171
6216
|
(token, sourceAmount, inputAmountUsd) => {
|
|
5172
6217
|
const targetSym = getTargetTokenSymbol(targetToken, targetChain);
|
|
5173
6218
|
const isTargetStable = isStablecoinSymbol(targetSym);
|
|
@@ -5189,10 +6234,12 @@ function DepositFlow({
|
|
|
5189
6234
|
},
|
|
5190
6235
|
[targetToken, targetChain, getTokenPriceUsd, logFlow, storeApi]
|
|
5191
6236
|
);
|
|
5192
|
-
const handleSolanaConfirmed =
|
|
6237
|
+
const handleSolanaConfirmed = useCallback7(
|
|
5193
6238
|
(txHash, amountUnits) => {
|
|
5194
|
-
const
|
|
6239
|
+
const depositAtSubmit = storeApi.getState().deposit;
|
|
6240
|
+
const tokenAtSubmit = depositAtSubmit.selectedSolanaToken;
|
|
5195
6241
|
if (!tokenAtSubmit) return;
|
|
6242
|
+
const amountUsd = depositAtSubmit.inputAmountUsd ?? void 0;
|
|
5196
6243
|
logFlow("solana:submitted", {
|
|
5197
6244
|
txHash,
|
|
5198
6245
|
amountUnits,
|
|
@@ -5205,18 +6252,21 @@ function DepositFlow({
|
|
|
5205
6252
|
sourceToken: tokenAtSubmit.mint,
|
|
5206
6253
|
amount: amountUnits,
|
|
5207
6254
|
sourceSymbol: tokenAtSubmit.symbol,
|
|
5208
|
-
sourceDecimals: tokenAtSubmit.decimals
|
|
6255
|
+
sourceDecimals: tokenAtSubmit.decimals,
|
|
6256
|
+
inputAmountUsd: amountUsd
|
|
5209
6257
|
});
|
|
5210
6258
|
onLifecycleRef.current?.({
|
|
5211
6259
|
type: "submitted",
|
|
5212
6260
|
txHash,
|
|
5213
6261
|
sourceChain: "solana",
|
|
5214
|
-
amount: amountUnits
|
|
6262
|
+
amount: amountUnits,
|
|
6263
|
+
sourceDecimals: tokenAtSubmit.decimals,
|
|
6264
|
+
amountUsd
|
|
5215
6265
|
});
|
|
5216
6266
|
},
|
|
5217
6267
|
[logFlow, onLifecycleRef, storeApi]
|
|
5218
6268
|
);
|
|
5219
|
-
const handleAssetContinue =
|
|
6269
|
+
const handleAssetContinue = useCallback7(
|
|
5220
6270
|
(asset) => {
|
|
5221
6271
|
onEventRef.current?.({
|
|
5222
6272
|
type: "deposit_modal_connected_wallet_select_source_cta_click",
|
|
@@ -5234,7 +6284,7 @@ function DepositFlow({
|
|
|
5234
6284
|
},
|
|
5235
6285
|
[defaultAmount, onEventRef, totalBalanceUsd, storeApi]
|
|
5236
6286
|
);
|
|
5237
|
-
const handleAmountContinue =
|
|
6287
|
+
const handleAmountContinue = useCallback7(
|
|
5238
6288
|
(amount, targetAmount, balance, liquidityWarning) => {
|
|
5239
6289
|
const entry = readSetupForOwner(
|
|
5240
6290
|
storeApi.getState().setup,
|
|
@@ -5255,7 +6305,7 @@ function DepositFlow({
|
|
|
5255
6305
|
},
|
|
5256
6306
|
[targetToken, targetChain, getTokenPriceUsd, storeApi, activeOwner]
|
|
5257
6307
|
);
|
|
5258
|
-
const handleDepositSubmitted =
|
|
6308
|
+
const handleDepositSubmitted = useCallback7(
|
|
5259
6309
|
(txHash, chainId, amount, token) => {
|
|
5260
6310
|
logFlow("evm:submitted", {
|
|
5261
6311
|
txHash,
|
|
@@ -5263,7 +6313,8 @@ function DepositFlow({
|
|
|
5263
6313
|
sourceToken: token,
|
|
5264
6314
|
amount
|
|
5265
6315
|
});
|
|
5266
|
-
const
|
|
6316
|
+
const depositAtSubmit = storeApi.getState().deposit;
|
|
6317
|
+
const asset = depositAtSubmit.selectedAsset;
|
|
5267
6318
|
const dappImport = asset && isDappImportAsset(asset) ? asset : null;
|
|
5268
6319
|
storeApi.dispatch({
|
|
5269
6320
|
type: "deposit/submitted",
|
|
@@ -5271,25 +6322,55 @@ function DepositFlow({
|
|
|
5271
6322
|
sourceChain: chainId,
|
|
5272
6323
|
sourceToken: token,
|
|
5273
6324
|
amount,
|
|
5274
|
-
sourceSymbol:
|
|
5275
|
-
sourceDecimals:
|
|
6325
|
+
sourceSymbol: asset?.symbol,
|
|
6326
|
+
sourceDecimals: asset?.decimals,
|
|
6327
|
+
inputAmountUsd: depositAtSubmit.inputAmountUsd ?? void 0,
|
|
5276
6328
|
directTransfer: !dappImport && isSameRoute2(chainId, token, targetChain, targetToken)
|
|
5277
6329
|
});
|
|
5278
6330
|
},
|
|
5279
6331
|
[logFlow, storeApi, targetChain, targetToken]
|
|
5280
6332
|
);
|
|
5281
|
-
const
|
|
6333
|
+
const handleSwappedComplete = useCallback7(
|
|
6334
|
+
(info) => {
|
|
6335
|
+
logFlow("swapped:complete", {
|
|
6336
|
+
txHash: info.txHash,
|
|
6337
|
+
orderCrypto: info.orderCrypto
|
|
6338
|
+
});
|
|
6339
|
+
const amount = info.amount ?? "0";
|
|
6340
|
+
storeApi.dispatch({
|
|
6341
|
+
type: "deposit/submitted",
|
|
6342
|
+
txHash: info.txHash,
|
|
6343
|
+
sourceChain: SWAPPED_SOURCE_CHAIN,
|
|
6344
|
+
sourceToken: SWAPPED_SOURCE_TOKEN,
|
|
6345
|
+
amount,
|
|
6346
|
+
sourceSymbol: info.orderCrypto ?? "USDC",
|
|
6347
|
+
sourceDecimals: SWAPPED_SOURCE_DECIMALS
|
|
6348
|
+
});
|
|
6349
|
+
onLifecycleRef.current?.({
|
|
6350
|
+
type: "submitted",
|
|
6351
|
+
txHash: info.txHash,
|
|
6352
|
+
sourceChain: SWAPPED_SOURCE_CHAIN,
|
|
6353
|
+
amount,
|
|
6354
|
+
sourceDecimals: SWAPPED_SOURCE_DECIMALS
|
|
6355
|
+
});
|
|
6356
|
+
},
|
|
6357
|
+
[logFlow, storeApi, onLifecycleRef]
|
|
6358
|
+
);
|
|
6359
|
+
const handleDepositSubmittedCallback = useCallback7(
|
|
5282
6360
|
(txHash, sourceChain, amount) => {
|
|
6361
|
+
const depositAtSubmit = storeApi.getState().deposit;
|
|
5283
6362
|
onLifecycleRef.current?.({
|
|
5284
6363
|
type: "submitted",
|
|
5285
6364
|
txHash,
|
|
5286
6365
|
sourceChain,
|
|
5287
|
-
amount
|
|
6366
|
+
amount,
|
|
6367
|
+
sourceDecimals: depositAtSubmit.selectedAsset?.decimals,
|
|
6368
|
+
amountUsd: depositAtSubmit.inputAmountUsd ?? void 0
|
|
5288
6369
|
});
|
|
5289
6370
|
},
|
|
5290
|
-
[onLifecycleRef]
|
|
6371
|
+
[onLifecycleRef, storeApi]
|
|
5291
6372
|
);
|
|
5292
|
-
const handleDepositComplete =
|
|
6373
|
+
const handleDepositComplete = useCallback7(
|
|
5293
6374
|
(txHash, destinationTxHash, context) => {
|
|
5294
6375
|
logFlow("deposit:complete", { txHash, destinationTxHash, ...context });
|
|
5295
6376
|
onLifecycleRef.current?.({
|
|
@@ -5301,28 +6382,28 @@ function DepositFlow({
|
|
|
5301
6382
|
},
|
|
5302
6383
|
[logFlow, onLifecycleRef]
|
|
5303
6384
|
);
|
|
5304
|
-
const handleDepositFailed =
|
|
6385
|
+
const handleDepositFailed = useCallback7(
|
|
5305
6386
|
(txHash, error) => {
|
|
5306
6387
|
logFlowError("deposit:failed", error, { txHash });
|
|
5307
6388
|
onLifecycleRef.current?.({ type: "failed", txHash, error });
|
|
5308
6389
|
},
|
|
5309
6390
|
[logFlowError, onLifecycleRef]
|
|
5310
6391
|
);
|
|
5311
|
-
const handleError =
|
|
6392
|
+
const handleError = useCallback7(
|
|
5312
6393
|
(message, code) => {
|
|
5313
6394
|
logFlowError("flow:error", message, { code });
|
|
5314
6395
|
onErrorRef.current?.({ message, code });
|
|
5315
6396
|
},
|
|
5316
6397
|
[logFlowError, onErrorRef]
|
|
5317
6398
|
);
|
|
5318
|
-
const handleTotalBalanceComputed =
|
|
6399
|
+
const handleTotalBalanceComputed = useCallback7((total) => {
|
|
5319
6400
|
setTotalBalanceUsd(total);
|
|
5320
6401
|
}, []);
|
|
5321
|
-
const walletOptionsKey =
|
|
6402
|
+
const walletOptionsKey = useMemo7(
|
|
5322
6403
|
() => walletOptions.map((option) => option.id).join(","),
|
|
5323
6404
|
[walletOptions]
|
|
5324
6405
|
);
|
|
5325
|
-
|
|
6406
|
+
useEffect10(() => {
|
|
5326
6407
|
if (storeApi.getState().flow.mode) {
|
|
5327
6408
|
return;
|
|
5328
6409
|
}
|
|
@@ -5332,12 +6413,12 @@ function DepositFlow({
|
|
|
5332
6413
|
storeApi.dispatch({ type: "flow/step-set", step: "connect" });
|
|
5333
6414
|
}
|
|
5334
6415
|
}, [walletOptionsKey]);
|
|
5335
|
-
|
|
6416
|
+
useEffect10(() => {
|
|
5336
6417
|
if (!showConnectStep && isConnectSelectionConfirmed && (flowMode === "wallet" || flowMode === "dapp-import") && !signerContext) {
|
|
5337
6418
|
storeApi.dispatch({ type: "wallet/cleared" });
|
|
5338
6419
|
}
|
|
5339
6420
|
}, [showConnectStep, isConnectSelectionConfirmed, flowMode, signerContext, storeApi]);
|
|
5340
|
-
|
|
6421
|
+
useEffect10(() => {
|
|
5341
6422
|
if (enableSolana || flowMode !== "solana-wallet") {
|
|
5342
6423
|
return;
|
|
5343
6424
|
}
|
|
@@ -5346,14 +6427,15 @@ function DepositFlow({
|
|
|
5346
6427
|
storeApi.dispatch({ type: "flow/step-set", step: "connect" });
|
|
5347
6428
|
}
|
|
5348
6429
|
}, [enableSolana, flowMode, storeApi]);
|
|
5349
|
-
|
|
5350
|
-
if (hasNavigatedBack || isConnectSelectionConfirmed || flowMode) {
|
|
6430
|
+
useEffect10(() => {
|
|
6431
|
+
if (hasNavigatedBack || isConnectSelectionConfirmed || flowMode || enableFiatOnramp || enableExchangeConnect) {
|
|
5351
6432
|
return;
|
|
5352
6433
|
}
|
|
5353
|
-
if (!hasWalletOptions && dappAddress && !hasReownSession && !dappWalletClient && hasQrAutoAdvanceGraceElapsed) {
|
|
6434
|
+
if (enableQrTransfer && !hasWalletOptions && dappAddress && !hasReownSession && !dappWalletClient && hasQrAutoAdvanceGraceElapsed) {
|
|
5354
6435
|
handleSelectTransferCrypto();
|
|
5355
6436
|
}
|
|
5356
6437
|
}, [
|
|
6438
|
+
enableQrTransfer,
|
|
5357
6439
|
hasWalletOptions,
|
|
5358
6440
|
hasReownSession,
|
|
5359
6441
|
hasQrAutoAdvanceGraceElapsed,
|
|
@@ -5364,7 +6446,7 @@ function DepositFlow({
|
|
|
5364
6446
|
dappWalletClient,
|
|
5365
6447
|
handleSelectTransferCrypto
|
|
5366
6448
|
]);
|
|
5367
|
-
const walletRows =
|
|
6449
|
+
const walletRows = useMemo7(() => {
|
|
5368
6450
|
return walletOptions.map((option) => {
|
|
5369
6451
|
const ownerForRow = option.kind === "solana" ? dappAddress : option.address ?? null;
|
|
5370
6452
|
const entry = readSetupForOwner(setupSlice, ownerForRow ?? null);
|
|
@@ -5380,32 +6462,35 @@ function DepositFlow({
|
|
|
5380
6462
|
};
|
|
5381
6463
|
});
|
|
5382
6464
|
}, [walletOptions, setupSlice, dappAddress]);
|
|
5383
|
-
const transferCryptoEntry =
|
|
6465
|
+
const transferCryptoEntry = useMemo7(
|
|
5384
6466
|
() => readSetupForOwner(setupSlice, dappAddress),
|
|
5385
6467
|
[setupSlice, dappAddress]
|
|
5386
6468
|
);
|
|
5387
6469
|
const transferCryptoState = transferCryptoEntry.status === "ready" ? "ready" : transferCryptoEntry.status === "error" ? "error" : "loading";
|
|
5388
|
-
const handleRetrySetup =
|
|
6470
|
+
const handleRetrySetup = useCallback7(
|
|
5389
6471
|
(owner) => {
|
|
5390
6472
|
storeApi.dispatch({ type: "setup/retry-requested", owner });
|
|
5391
6473
|
},
|
|
5392
6474
|
[storeApi]
|
|
5393
6475
|
);
|
|
5394
6476
|
if (showConnectStep) {
|
|
5395
|
-
return /* @__PURE__ */
|
|
6477
|
+
return /* @__PURE__ */ jsx17("div", { className: "rs-modal-body", children: /* @__PURE__ */ jsx17(
|
|
5396
6478
|
ConnectStep,
|
|
5397
6479
|
{
|
|
5398
6480
|
walletRows,
|
|
5399
6481
|
transferCryptoState: dappAddress ? transferCryptoState : void 0,
|
|
5400
6482
|
transferCryptoErrorReason: dappAddress ? transferCryptoEntry.message ?? void 0 : void 0,
|
|
5401
|
-
onSelectTransferCrypto: dappAddress ? () => {
|
|
6483
|
+
onSelectTransferCrypto: enableQrTransfer && dappAddress ? () => {
|
|
5402
6484
|
if (transferCryptoState === "error") {
|
|
5403
6485
|
handleRetrySetup(dappAddress);
|
|
5404
6486
|
return;
|
|
5405
6487
|
}
|
|
5406
|
-
if (transferCryptoState !== "ready") return;
|
|
5407
6488
|
handleSelectTransferCrypto();
|
|
5408
6489
|
} : void 0,
|
|
6490
|
+
onSelectPayWithCard: enableFiatOnramp && dappAddress && (!fiatOnrampMethods || fiatOnrampMethods.length === 0) ? () => handleSelectFiatMethod() : void 0,
|
|
6491
|
+
fiatPaymentMethods: enableFiatOnramp && dappAddress ? fiatOnrampMethods : void 0,
|
|
6492
|
+
onSelectFiatMethod: enableFiatOnramp && dappAddress ? (method) => handleSelectFiatMethod(method) : void 0,
|
|
6493
|
+
onSelectFundFromExchange: enableExchangeConnect && dappAddress ? () => handleSelectExchange() : void 0,
|
|
5409
6494
|
onRequestConnect,
|
|
5410
6495
|
onConnect,
|
|
5411
6496
|
onDisconnect,
|
|
@@ -5439,25 +6524,29 @@ function DepositFlow({
|
|
|
5439
6524
|
}
|
|
5440
6525
|
if (isDepositAddressMode) {
|
|
5441
6526
|
if (!dappAddress) return null;
|
|
5442
|
-
return /* @__PURE__ */
|
|
5443
|
-
effectiveStep.type === "setup" && /* @__PURE__ */
|
|
6527
|
+
return /* @__PURE__ */ jsxs15("div", { className: "rs-modal-body", children: [
|
|
6528
|
+
effectiveStep.type === "setup" && (activeEntry.status === "error" ? /* @__PURE__ */ jsx17(
|
|
5444
6529
|
AccountPreparingSkeleton,
|
|
5445
6530
|
{
|
|
5446
|
-
errorMessage: activeEntry.
|
|
5447
|
-
onRetry:
|
|
6531
|
+
errorMessage: activeEntry.message ?? void 0,
|
|
6532
|
+
onRetry: () => handleRetrySetup(dappAddress)
|
|
5448
6533
|
}
|
|
5449
|
-
)
|
|
5450
|
-
|
|
6534
|
+
) : /* @__PURE__ */ jsx17(
|
|
6535
|
+
DepositAddressSkeleton,
|
|
6536
|
+
{
|
|
6537
|
+
uiConfig,
|
|
6538
|
+
allowedRoutes
|
|
6539
|
+
}
|
|
6540
|
+
)),
|
|
6541
|
+
effectiveStep.type === "deposit-address" && /* @__PURE__ */ jsx17(
|
|
5451
6542
|
DepositAddressStep,
|
|
5452
6543
|
{
|
|
5453
6544
|
smartAccount: effectiveStep.smartAccount,
|
|
5454
6545
|
solanaDepositAddress: enableSolana ? effectiveStep.solanaDepositAddress : void 0,
|
|
5455
|
-
isUpdating: activeEntry.status !== "ready",
|
|
5456
6546
|
service,
|
|
5457
6547
|
allowedRoutes,
|
|
5458
6548
|
targetChain,
|
|
5459
6549
|
targetToken,
|
|
5460
|
-
waitForFinalTx,
|
|
5461
6550
|
hasPostBridgeActions: Boolean(postBridgeActions?.length),
|
|
5462
6551
|
uiConfig,
|
|
5463
6552
|
onDepositSubmitted: handleDepositAddressSubmitted,
|
|
@@ -5480,19 +6569,145 @@ function DepositFlow({
|
|
|
5480
6569
|
)
|
|
5481
6570
|
] });
|
|
5482
6571
|
}
|
|
6572
|
+
if (isFiatOnrampMode) {
|
|
6573
|
+
if (!dappAddress) return null;
|
|
6574
|
+
return /* @__PURE__ */ jsxs15(
|
|
6575
|
+
"div",
|
|
6576
|
+
{
|
|
6577
|
+
className: "rs-modal-body",
|
|
6578
|
+
"data-flow-mode": "fiat-onramp",
|
|
6579
|
+
"data-step-type": step.type,
|
|
6580
|
+
children: [
|
|
6581
|
+
step.type === "setup" && /* @__PURE__ */ jsx17(
|
|
6582
|
+
AccountPreparingSkeleton,
|
|
6583
|
+
{
|
|
6584
|
+
errorMessage: activeEntry.status === "error" ? activeEntry.message ?? void 0 : void 0,
|
|
6585
|
+
onRetry: activeEntry.status === "error" ? () => handleRetrySetup(dappAddress) : void 0
|
|
6586
|
+
}
|
|
6587
|
+
),
|
|
6588
|
+
step.type === "fiat-onramp" && /* @__PURE__ */ jsx17(
|
|
6589
|
+
FiatOnrampStep,
|
|
6590
|
+
{
|
|
6591
|
+
smartAccount: step.smartAccount,
|
|
6592
|
+
service,
|
|
6593
|
+
paymentMethod: step.paymentMethod,
|
|
6594
|
+
onSwappedComplete: handleSwappedComplete,
|
|
6595
|
+
onSwappedFailed: handleDepositFailed,
|
|
6596
|
+
onClose: onClose ?? (() => {
|
|
6597
|
+
}),
|
|
6598
|
+
onError: handleError
|
|
6599
|
+
}
|
|
6600
|
+
),
|
|
6601
|
+
step.type === "processing" && /* @__PURE__ */ jsx17(
|
|
6602
|
+
ProcessingStep,
|
|
6603
|
+
{
|
|
6604
|
+
smartAccount: step.smartAccount,
|
|
6605
|
+
solanaDepositAddress: step.solanaDepositAddress,
|
|
6606
|
+
txHash: step.txHash,
|
|
6607
|
+
sourceChain: step.sourceChain,
|
|
6608
|
+
sourceToken: step.sourceToken,
|
|
6609
|
+
targetChain,
|
|
6610
|
+
targetToken,
|
|
6611
|
+
amount: step.amount,
|
|
6612
|
+
sourceSymbol: step.sourceSymbol,
|
|
6613
|
+
sourceDecimals: step.sourceDecimals,
|
|
6614
|
+
amountUsd: step.inputAmountUsd,
|
|
6615
|
+
hasPostBridgeActions: Boolean(postBridgeActions?.length),
|
|
6616
|
+
service,
|
|
6617
|
+
directTransfer: step.directTransfer,
|
|
6618
|
+
isSwappedOrder: true,
|
|
6619
|
+
onClose,
|
|
6620
|
+
onNewDeposit: handleNewDeposit,
|
|
6621
|
+
onDepositComplete: handleDepositComplete,
|
|
6622
|
+
onDepositFailed: handleDepositFailed,
|
|
6623
|
+
onError: handleError,
|
|
6624
|
+
debug
|
|
6625
|
+
}
|
|
6626
|
+
)
|
|
6627
|
+
]
|
|
6628
|
+
}
|
|
6629
|
+
);
|
|
6630
|
+
}
|
|
6631
|
+
if (isExchangeConnectMode) {
|
|
6632
|
+
if (!dappAddress) return null;
|
|
6633
|
+
return /* @__PURE__ */ jsxs15(
|
|
6634
|
+
"div",
|
|
6635
|
+
{
|
|
6636
|
+
className: "rs-modal-body",
|
|
6637
|
+
"data-flow-mode": "exchange-connect",
|
|
6638
|
+
"data-step-type": step.type,
|
|
6639
|
+
children: [
|
|
6640
|
+
step.type === "setup" && /* @__PURE__ */ jsx17(
|
|
6641
|
+
AccountPreparingSkeleton,
|
|
6642
|
+
{
|
|
6643
|
+
errorMessage: activeEntry.status === "error" ? activeEntry.message ?? void 0 : void 0,
|
|
6644
|
+
onRetry: activeEntry.status === "error" ? () => handleRetrySetup(dappAddress) : void 0
|
|
6645
|
+
}
|
|
6646
|
+
),
|
|
6647
|
+
step.type === "exchange-select" && /* @__PURE__ */ jsx17(
|
|
6648
|
+
ExchangeSelectStep,
|
|
6649
|
+
{
|
|
6650
|
+
service,
|
|
6651
|
+
onSelectExchange: handleSelectExchangeConnection,
|
|
6652
|
+
onError: handleError
|
|
6653
|
+
}
|
|
6654
|
+
),
|
|
6655
|
+
step.type === "exchange-connect" && /* @__PURE__ */ jsx17(
|
|
6656
|
+
ExchangeConnectStep,
|
|
6657
|
+
{
|
|
6658
|
+
smartAccount: step.smartAccount,
|
|
6659
|
+
service,
|
|
6660
|
+
connection: step.connection,
|
|
6661
|
+
onSwappedComplete: handleSwappedComplete,
|
|
6662
|
+
onSwappedFailed: handleDepositFailed,
|
|
6663
|
+
onClose: onClose ?? (() => {
|
|
6664
|
+
}),
|
|
6665
|
+
onError: handleError
|
|
6666
|
+
}
|
|
6667
|
+
),
|
|
6668
|
+
step.type === "processing" && /* @__PURE__ */ jsx17(
|
|
6669
|
+
ProcessingStep,
|
|
6670
|
+
{
|
|
6671
|
+
smartAccount: step.smartAccount,
|
|
6672
|
+
solanaDepositAddress: step.solanaDepositAddress,
|
|
6673
|
+
txHash: step.txHash,
|
|
6674
|
+
sourceChain: step.sourceChain,
|
|
6675
|
+
sourceToken: step.sourceToken,
|
|
6676
|
+
targetChain,
|
|
6677
|
+
targetToken,
|
|
6678
|
+
amount: step.amount,
|
|
6679
|
+
sourceSymbol: step.sourceSymbol,
|
|
6680
|
+
sourceDecimals: step.sourceDecimals,
|
|
6681
|
+
amountUsd: step.inputAmountUsd,
|
|
6682
|
+
hasPostBridgeActions: Boolean(postBridgeActions?.length),
|
|
6683
|
+
service,
|
|
6684
|
+
directTransfer: step.directTransfer,
|
|
6685
|
+
isSwappedOrder: true,
|
|
6686
|
+
onClose,
|
|
6687
|
+
onNewDeposit: handleNewDeposit,
|
|
6688
|
+
onDepositComplete: handleDepositComplete,
|
|
6689
|
+
onDepositFailed: handleDepositFailed,
|
|
6690
|
+
onError: handleError,
|
|
6691
|
+
debug
|
|
6692
|
+
}
|
|
6693
|
+
)
|
|
6694
|
+
]
|
|
6695
|
+
}
|
|
6696
|
+
);
|
|
6697
|
+
}
|
|
5483
6698
|
if (isSolanaWalletMode) {
|
|
5484
6699
|
if (!dappAddress) return null;
|
|
5485
6700
|
const solanaAddr = reownWallet?.solanaAddress;
|
|
5486
6701
|
const solanaProvider = reownWallet?.solanaProvider;
|
|
5487
|
-
return /* @__PURE__ */
|
|
5488
|
-
effectiveStep.type === "setup" && /* @__PURE__ */
|
|
6702
|
+
return /* @__PURE__ */ jsxs15("div", { className: "rs-modal-body", children: [
|
|
6703
|
+
effectiveStep.type === "setup" && /* @__PURE__ */ jsx17(
|
|
5489
6704
|
AccountPreparingSkeleton,
|
|
5490
6705
|
{
|
|
5491
6706
|
errorMessage: activeEntry.status === "error" ? activeEntry.message ?? void 0 : void 0,
|
|
5492
6707
|
onRetry: activeEntry.status === "error" ? () => handleRetrySetup(dappAddress) : void 0
|
|
5493
6708
|
}
|
|
5494
6709
|
),
|
|
5495
|
-
effectiveStep.type === "solana-token-select" && solanaAddr && /* @__PURE__ */
|
|
6710
|
+
effectiveStep.type === "solana-token-select" && solanaAddr && /* @__PURE__ */ jsx17(
|
|
5496
6711
|
SolanaTokenSelectStep,
|
|
5497
6712
|
{
|
|
5498
6713
|
solanaAddress: solanaAddr,
|
|
@@ -5506,7 +6721,7 @@ function DepositFlow({
|
|
|
5506
6721
|
debug
|
|
5507
6722
|
}
|
|
5508
6723
|
),
|
|
5509
|
-
effectiveStep.type === "solana-amount" && /* @__PURE__ */
|
|
6724
|
+
effectiveStep.type === "solana-amount" && /* @__PURE__ */ jsx17(
|
|
5510
6725
|
SolanaAmountStep,
|
|
5511
6726
|
{
|
|
5512
6727
|
token: effectiveStep.token,
|
|
@@ -5514,6 +6729,7 @@ function DepositFlow({
|
|
|
5514
6729
|
balanceUsd: effectiveStep.balanceUsd,
|
|
5515
6730
|
defaultAmount: effectiveStep.inputAmountUsd,
|
|
5516
6731
|
uiConfig,
|
|
6732
|
+
targetChain,
|
|
5517
6733
|
targetChainName: getChainName(targetChain),
|
|
5518
6734
|
targetTokenSymbol: getTargetTokenSymbol(targetToken, targetChain),
|
|
5519
6735
|
targetTokenIcon: getTokenIcon(
|
|
@@ -5524,7 +6740,7 @@ function DepositFlow({
|
|
|
5524
6740
|
debug
|
|
5525
6741
|
}
|
|
5526
6742
|
),
|
|
5527
|
-
effectiveStep.type === "solana-confirm" && solanaAddr && solanaProvider ? /* @__PURE__ */
|
|
6743
|
+
effectiveStep.type === "solana-confirm" && solanaAddr && solanaProvider ? /* @__PURE__ */ jsx17(
|
|
5528
6744
|
SolanaConfirmStep,
|
|
5529
6745
|
{
|
|
5530
6746
|
smartAccount: effectiveStep.smartAccount,
|
|
@@ -5545,16 +6761,16 @@ function DepositFlow({
|
|
|
5545
6761
|
onError: handleError,
|
|
5546
6762
|
debug
|
|
5547
6763
|
}
|
|
5548
|
-
) : effectiveStep.type === "solana-confirm" ? /* @__PURE__ */
|
|
5549
|
-
/* @__PURE__ */
|
|
5550
|
-
/* @__PURE__ */
|
|
6764
|
+
) : effectiveStep.type === "solana-confirm" ? /* @__PURE__ */ jsxs15("div", { className: "rs-step", children: [
|
|
6765
|
+
/* @__PURE__ */ jsxs15("div", { className: "rs-loading-state", children: [
|
|
6766
|
+
/* @__PURE__ */ jsx17("div", { className: "rs-step-icon rs-step-icon--error", children: /* @__PURE__ */ jsx17(
|
|
5551
6767
|
"svg",
|
|
5552
6768
|
{
|
|
5553
6769
|
viewBox: "0 0 24 24",
|
|
5554
6770
|
fill: "none",
|
|
5555
6771
|
stroke: "currentColor",
|
|
5556
6772
|
strokeWidth: "2",
|
|
5557
|
-
children: /* @__PURE__ */
|
|
6773
|
+
children: /* @__PURE__ */ jsx17(
|
|
5558
6774
|
"path",
|
|
5559
6775
|
{
|
|
5560
6776
|
strokeLinecap: "round",
|
|
@@ -5564,22 +6780,22 @@ function DepositFlow({
|
|
|
5564
6780
|
)
|
|
5565
6781
|
}
|
|
5566
6782
|
) }),
|
|
5567
|
-
/* @__PURE__ */
|
|
5568
|
-
/* @__PURE__ */
|
|
5569
|
-
/* @__PURE__ */
|
|
6783
|
+
/* @__PURE__ */ jsxs15("div", { className: "rs-loading-text", children: [
|
|
6784
|
+
/* @__PURE__ */ jsx17("div", { className: "rs-loading-title rs-text-error", children: "Wallet disconnected" }),
|
|
6785
|
+
/* @__PURE__ */ jsx17("div", { className: "rs-loading-subtitle", children: "Please reconnect your Solana wallet to continue." })
|
|
5570
6786
|
] })
|
|
5571
6787
|
] }),
|
|
5572
|
-
/* @__PURE__ */
|
|
6788
|
+
/* @__PURE__ */ jsx17("div", { className: "rs-step-footer", children: /* @__PURE__ */ jsx17(
|
|
5573
6789
|
"button",
|
|
5574
6790
|
{
|
|
5575
6791
|
type: "button",
|
|
5576
6792
|
className: "rs-button rs-button--default rs-button--full-width",
|
|
5577
6793
|
onClick: handleBack,
|
|
5578
|
-
children: /* @__PURE__ */
|
|
6794
|
+
children: /* @__PURE__ */ jsx17("span", { children: "Go Back" })
|
|
5579
6795
|
}
|
|
5580
6796
|
) })
|
|
5581
6797
|
] }) : null,
|
|
5582
|
-
effectiveStep.type === "processing" && /* @__PURE__ */
|
|
6798
|
+
effectiveStep.type === "processing" && /* @__PURE__ */ jsx17(
|
|
5583
6799
|
ProcessingStep,
|
|
5584
6800
|
{
|
|
5585
6801
|
smartAccount: effectiveStep.smartAccount,
|
|
@@ -5592,7 +6808,7 @@ function DepositFlow({
|
|
|
5592
6808
|
amount: effectiveStep.amount,
|
|
5593
6809
|
sourceSymbol: effectiveStep.sourceSymbol,
|
|
5594
6810
|
sourceDecimals: effectiveStep.sourceDecimals,
|
|
5595
|
-
|
|
6811
|
+
amountUsd: effectiveStep.inputAmountUsd,
|
|
5596
6812
|
hasPostBridgeActions: Boolean(postBridgeActions?.length),
|
|
5597
6813
|
service,
|
|
5598
6814
|
directTransfer: effectiveStep.directTransfer,
|
|
@@ -5607,7 +6823,7 @@ function DepositFlow({
|
|
|
5607
6823
|
] });
|
|
5608
6824
|
}
|
|
5609
6825
|
if (!signerContext?.walletClient || !signerContext?.publicClient) {
|
|
5610
|
-
return /* @__PURE__ */
|
|
6826
|
+
return /* @__PURE__ */ jsx17("div", { className: "rs-modal-body", children: /* @__PURE__ */ jsx17("div", { className: "rs-step", children: /* @__PURE__ */ jsx17("div", { className: "rs-loading-state", children: /* @__PURE__ */ jsx17("div", { className: "rs-loading-text", children: /* @__PURE__ */ jsx17("div", { className: "rs-loading-title", children: "Connecting wallet\u2026" }) }) }) }) });
|
|
5611
6827
|
}
|
|
5612
6828
|
const ownerAddress = signerContext.ownerAddress;
|
|
5613
6829
|
const ownerChainId = signerContext.walletClient?.chain?.id ?? signerContext.publicClient.chain?.id ?? setupChainId;
|
|
@@ -5617,15 +6833,15 @@ function DepositFlow({
|
|
|
5617
6833
|
}
|
|
5618
6834
|
return getPublicClient(chainId);
|
|
5619
6835
|
};
|
|
5620
|
-
return /* @__PURE__ */
|
|
5621
|
-
effectiveStep.type === "setup" && /* @__PURE__ */
|
|
6836
|
+
return /* @__PURE__ */ jsxs15("div", { className: "rs-modal-body", children: [
|
|
6837
|
+
effectiveStep.type === "setup" && /* @__PURE__ */ jsx17(
|
|
5622
6838
|
AccountPreparingSkeleton,
|
|
5623
6839
|
{
|
|
5624
6840
|
errorMessage: activeEntry.status === "error" ? activeEntry.message ?? void 0 : void 0,
|
|
5625
6841
|
onRetry: activeEntry.status === "error" ? () => handleRetrySetup(ownerAddress) : void 0
|
|
5626
6842
|
}
|
|
5627
6843
|
),
|
|
5628
|
-
effectiveStep.type === "select-asset" && /* @__PURE__ */
|
|
6844
|
+
effectiveStep.type === "select-asset" && /* @__PURE__ */ jsx17(
|
|
5629
6845
|
AssetSelectStep,
|
|
5630
6846
|
{
|
|
5631
6847
|
address: ownerAddress,
|
|
@@ -5643,7 +6859,7 @@ function DepositFlow({
|
|
|
5643
6859
|
} : void 0
|
|
5644
6860
|
}
|
|
5645
6861
|
),
|
|
5646
|
-
effectiveStep.type === "dapp-import-asset-select" && activeDappImportProvider && activeDappImportAvailability && /* @__PURE__ */
|
|
6862
|
+
effectiveStep.type === "dapp-import-asset-select" && activeDappImportProvider && activeDappImportAvailability && /* @__PURE__ */ jsx17(
|
|
5647
6863
|
DappImportAssetSelectStep,
|
|
5648
6864
|
{
|
|
5649
6865
|
sourceLabel: activeDappImportAvailability.assets[0]?.sourceLabel ?? activeDappImportProvider.label,
|
|
@@ -5651,7 +6867,7 @@ function DepositFlow({
|
|
|
5651
6867
|
onSelect: handleDappImportAssetSelected
|
|
5652
6868
|
}
|
|
5653
6869
|
),
|
|
5654
|
-
effectiveStep.type === "amount" && /* @__PURE__ */
|
|
6870
|
+
effectiveStep.type === "amount" && /* @__PURE__ */ jsx17(
|
|
5655
6871
|
AmountStep,
|
|
5656
6872
|
{
|
|
5657
6873
|
walletClient: signerContext.walletClient,
|
|
@@ -5663,7 +6879,7 @@ function DepositFlow({
|
|
|
5663
6879
|
chainId: effectiveStep.asset.depositChainId,
|
|
5664
6880
|
token: effectiveStep.asset.depositToken
|
|
5665
6881
|
} : void 0,
|
|
5666
|
-
defaultAmount: effectiveStep.
|
|
6882
|
+
defaultAmount: effectiveStep.inputAmountUsd ?? defaultAmount,
|
|
5667
6883
|
switchChain: signerContext.switchChain,
|
|
5668
6884
|
targetChain,
|
|
5669
6885
|
targetToken,
|
|
@@ -5683,7 +6899,7 @@ function DepositFlow({
|
|
|
5683
6899
|
}
|
|
5684
6900
|
}
|
|
5685
6901
|
),
|
|
5686
|
-
effectiveStep.type === "confirm" && /* @__PURE__ */
|
|
6902
|
+
effectiveStep.type === "confirm" && /* @__PURE__ */ jsx17(
|
|
5687
6903
|
ConfirmStep,
|
|
5688
6904
|
{
|
|
5689
6905
|
walletClient: signerContext.walletClient,
|
|
@@ -5700,6 +6916,7 @@ function DepositFlow({
|
|
|
5700
6916
|
switchChain: signerContext.switchChain,
|
|
5701
6917
|
liquidityWarning: effectiveStep.liquidityWarning,
|
|
5702
6918
|
uiConfig,
|
|
6919
|
+
service,
|
|
5703
6920
|
executeTransfer: isDappImportMode && activeDappImportProvider && isDappImportAsset(effectiveStep.asset) ? async (amountUnits) => {
|
|
5704
6921
|
const result = await activeDappImportProvider.executeTransfer(
|
|
5705
6922
|
{
|
|
@@ -5723,7 +6940,7 @@ function DepositFlow({
|
|
|
5723
6940
|
onError: handleError
|
|
5724
6941
|
}
|
|
5725
6942
|
),
|
|
5726
|
-
effectiveStep.type === "processing" && /* @__PURE__ */
|
|
6943
|
+
effectiveStep.type === "processing" && /* @__PURE__ */ jsx17(
|
|
5727
6944
|
ProcessingStep,
|
|
5728
6945
|
{
|
|
5729
6946
|
smartAccount: effectiveStep.smartAccount,
|
|
@@ -5736,7 +6953,7 @@ function DepositFlow({
|
|
|
5736
6953
|
amount: effectiveStep.amount,
|
|
5737
6954
|
sourceSymbol: effectiveStep.sourceSymbol,
|
|
5738
6955
|
sourceDecimals: effectiveStep.sourceDecimals,
|
|
5739
|
-
|
|
6956
|
+
amountUsd: effectiveStep.inputAmountUsd,
|
|
5740
6957
|
hasPostBridgeActions: Boolean(postBridgeActions?.length),
|
|
5741
6958
|
service,
|
|
5742
6959
|
directTransfer: effectiveStep.directTransfer,
|
|
@@ -5754,8 +6971,8 @@ function DepositFlow({
|
|
|
5754
6971
|
}
|
|
5755
6972
|
|
|
5756
6973
|
// src/components/history/DepositHistoryPanel.tsx
|
|
5757
|
-
import { useCallback as
|
|
5758
|
-
import { jsx as
|
|
6974
|
+
import { useCallback as useCallback8, useMemo as useMemo8, useState as useState12 } from "react";
|
|
6975
|
+
import { jsx as jsx18, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
5759
6976
|
function shortenHash(hash) {
|
|
5760
6977
|
if (hash.length <= 14) return hash;
|
|
5761
6978
|
return `${hash.slice(0, 6)}\u2026${hash.slice(-4)}`;
|
|
@@ -5865,7 +7082,7 @@ function DepositHistoryPanel({
|
|
|
5865
7082
|
onClose,
|
|
5866
7083
|
onCloseModal
|
|
5867
7084
|
}) {
|
|
5868
|
-
const handleKeyDown =
|
|
7085
|
+
const handleKeyDown = useCallback8(
|
|
5869
7086
|
(e) => {
|
|
5870
7087
|
if (e.key === "Escape") {
|
|
5871
7088
|
e.stopPropagation();
|
|
@@ -5874,7 +7091,7 @@ function DepositHistoryPanel({
|
|
|
5874
7091
|
},
|
|
5875
7092
|
[onClose]
|
|
5876
7093
|
);
|
|
5877
|
-
const visibleDeposits =
|
|
7094
|
+
const visibleDeposits = useMemo8(() => {
|
|
5878
7095
|
const sourceHashes = new Set(
|
|
5879
7096
|
deposits.map((d) => d.sourceTxHash?.toLowerCase()).filter((h) => Boolean(h))
|
|
5880
7097
|
);
|
|
@@ -5882,7 +7099,7 @@ function DepositHistoryPanel({
|
|
|
5882
7099
|
(d) => !(d.txHash && sourceHashes.has(d.txHash.toLowerCase()))
|
|
5883
7100
|
);
|
|
5884
7101
|
}, [deposits]);
|
|
5885
|
-
return /* @__PURE__ */
|
|
7102
|
+
return /* @__PURE__ */ jsxs16(
|
|
5886
7103
|
"div",
|
|
5887
7104
|
{
|
|
5888
7105
|
className: "rs-history-panel",
|
|
@@ -5890,55 +7107,55 @@ function DepositHistoryPanel({
|
|
|
5890
7107
|
"aria-label": "Deposit history",
|
|
5891
7108
|
onKeyDown: handleKeyDown,
|
|
5892
7109
|
children: [
|
|
5893
|
-
/* @__PURE__ */
|
|
5894
|
-
/* @__PURE__ */
|
|
7110
|
+
/* @__PURE__ */ jsxs16("div", { className: "rs-modal-header--redesigned", children: [
|
|
7111
|
+
/* @__PURE__ */ jsx18("div", { className: "rs-modal-header-nav-left", children: /* @__PURE__ */ jsx18(
|
|
5895
7112
|
"button",
|
|
5896
7113
|
{
|
|
5897
7114
|
type: "button",
|
|
5898
7115
|
className: "rs-modal-header-back",
|
|
5899
7116
|
"aria-label": "Back",
|
|
5900
7117
|
onClick: onClose,
|
|
5901
|
-
children: /* @__PURE__ */
|
|
7118
|
+
children: /* @__PURE__ */ jsx18(ChevronLeftIcon, {})
|
|
5902
7119
|
}
|
|
5903
7120
|
) }),
|
|
5904
|
-
/* @__PURE__ */
|
|
7121
|
+
/* @__PURE__ */ jsx18("div", { className: "rs-modal-header-nav-right", children: onCloseModal && /* @__PURE__ */ jsx18(
|
|
5905
7122
|
"button",
|
|
5906
7123
|
{
|
|
5907
7124
|
type: "button",
|
|
5908
7125
|
className: "rs-modal-close",
|
|
5909
7126
|
"aria-label": "Close",
|
|
5910
7127
|
onClick: onCloseModal,
|
|
5911
|
-
children: /* @__PURE__ */
|
|
7128
|
+
children: /* @__PURE__ */ jsx18(CloseIcon, {})
|
|
5912
7129
|
}
|
|
5913
7130
|
) })
|
|
5914
7131
|
] }),
|
|
5915
|
-
/* @__PURE__ */
|
|
5916
|
-
/* @__PURE__ */
|
|
5917
|
-
/* @__PURE__ */
|
|
5918
|
-
isLoading && deposits.length === 0 && /* @__PURE__ */
|
|
5919
|
-
/* @__PURE__ */
|
|
5920
|
-
/* @__PURE__ */
|
|
5921
|
-
/* @__PURE__ */
|
|
5922
|
-
/* @__PURE__ */
|
|
7132
|
+
/* @__PURE__ */ jsxs16("div", { className: "rs-history-screen", children: [
|
|
7133
|
+
/* @__PURE__ */ jsxs16("div", { className: "rs-history-screen-body", children: [
|
|
7134
|
+
/* @__PURE__ */ jsx18(BodyHeader, { icon: /* @__PURE__ */ jsx18(HistoryIcon, {}), title: "History" }),
|
|
7135
|
+
isLoading && deposits.length === 0 && /* @__PURE__ */ jsxs16("div", { className: "rs-history-empty", children: [
|
|
7136
|
+
/* @__PURE__ */ jsx18("span", { className: "rs-history-empty-glyph", "aria-hidden": "true", children: /* @__PURE__ */ jsx18(HistoryIcon, {}) }),
|
|
7137
|
+
/* @__PURE__ */ jsxs16("div", { className: "rs-history-empty-text", children: [
|
|
7138
|
+
/* @__PURE__ */ jsx18(Spinner, { className: "rs-spinner--sm" }),
|
|
7139
|
+
/* @__PURE__ */ jsx18("span", { className: "rs-history-empty-hint", children: "Loading history\u2026" })
|
|
5923
7140
|
] })
|
|
5924
7141
|
] }),
|
|
5925
|
-
error && !isLoading && /* @__PURE__ */
|
|
5926
|
-
/* @__PURE__ */
|
|
5927
|
-
/* @__PURE__ */
|
|
5928
|
-
/* @__PURE__ */
|
|
5929
|
-
/* @__PURE__ */
|
|
7142
|
+
error && !isLoading && /* @__PURE__ */ jsxs16("div", { className: "rs-history-empty", children: [
|
|
7143
|
+
/* @__PURE__ */ jsx18("span", { className: "rs-history-empty-glyph", "aria-hidden": "true", children: /* @__PURE__ */ jsx18(AlertTriangleIcon, {}) }),
|
|
7144
|
+
/* @__PURE__ */ jsxs16("div", { className: "rs-history-empty-text", children: [
|
|
7145
|
+
/* @__PURE__ */ jsx18("span", { className: "rs-history-empty-title", children: "Couldn't load history" }),
|
|
7146
|
+
/* @__PURE__ */ jsx18("span", { className: "rs-history-empty-hint", children: error })
|
|
5930
7147
|
] })
|
|
5931
7148
|
] }),
|
|
5932
|
-
!isLoading && !error && visibleDeposits.length === 0 && /* @__PURE__ */
|
|
5933
|
-
/* @__PURE__ */
|
|
5934
|
-
/* @__PURE__ */
|
|
5935
|
-
/* @__PURE__ */
|
|
5936
|
-
/* @__PURE__ */
|
|
7149
|
+
!isLoading && !error && visibleDeposits.length === 0 && /* @__PURE__ */ jsxs16("div", { className: "rs-history-empty", children: [
|
|
7150
|
+
/* @__PURE__ */ jsx18("span", { className: "rs-history-empty-glyph", "aria-hidden": "true", children: /* @__PURE__ */ jsx18(HistoryIcon, {}) }),
|
|
7151
|
+
/* @__PURE__ */ jsxs16("div", { className: "rs-history-empty-text", children: [
|
|
7152
|
+
/* @__PURE__ */ jsx18("span", { className: "rs-history-empty-title", children: "No deposits yet" }),
|
|
7153
|
+
/* @__PURE__ */ jsx18("span", { className: "rs-history-empty-hint", children: "Your deposit history will appear here" })
|
|
5937
7154
|
] })
|
|
5938
7155
|
] }),
|
|
5939
|
-
visibleDeposits.length > 0 && /* @__PURE__ */
|
|
5940
|
-
visibleDeposits.map((deposit, i) => /* @__PURE__ */
|
|
5941
|
-
hasMore && /* @__PURE__ */
|
|
7156
|
+
visibleDeposits.length > 0 && /* @__PURE__ */ jsxs16("div", { className: "rs-history-list", children: [
|
|
7157
|
+
visibleDeposits.map((deposit, i) => /* @__PURE__ */ jsx18(HistoryCard, { deposit }, deposit.txHash || i)),
|
|
7158
|
+
hasMore && /* @__PURE__ */ jsx18(
|
|
5942
7159
|
"button",
|
|
5943
7160
|
{
|
|
5944
7161
|
type: "button",
|
|
@@ -5950,14 +7167,14 @@ function DepositHistoryPanel({
|
|
|
5950
7167
|
)
|
|
5951
7168
|
] })
|
|
5952
7169
|
] }),
|
|
5953
|
-
/* @__PURE__ */
|
|
7170
|
+
/* @__PURE__ */ jsx18(PoweredBy, {})
|
|
5954
7171
|
] })
|
|
5955
7172
|
]
|
|
5956
7173
|
}
|
|
5957
7174
|
);
|
|
5958
7175
|
}
|
|
5959
7176
|
function HistoryCard({ deposit }) {
|
|
5960
|
-
const [expanded, setExpanded] =
|
|
7177
|
+
const [expanded, setExpanded] = useState12(false);
|
|
5961
7178
|
const status = normalizeStatus(deposit.status, deposit.isSpam);
|
|
5962
7179
|
const sourceChainId = resolveChainId(deposit.chain);
|
|
5963
7180
|
const targetChainId = resolveChainId(deposit.targetChain);
|
|
@@ -5976,7 +7193,7 @@ function HistoryCard({ deposit }) {
|
|
|
5976
7193
|
const date = deposit.createdAt ? formatDate(deposit.createdAt) : null;
|
|
5977
7194
|
const txTypeLabel = `Deposit${sourceSymbol ? ` ${sourceSymbol}` : ""}`;
|
|
5978
7195
|
const srcTxUrl = deposit.sourceTxHash ? getTxExplorerUrl(deposit.sourceTxHash, sourceChainId) : null;
|
|
5979
|
-
return /* @__PURE__ */
|
|
7196
|
+
return /* @__PURE__ */ jsxs16(
|
|
5980
7197
|
"button",
|
|
5981
7198
|
{
|
|
5982
7199
|
type: "button",
|
|
@@ -5984,38 +7201,38 @@ function HistoryCard({ deposit }) {
|
|
|
5984
7201
|
onClick: () => setExpanded((v) => !v),
|
|
5985
7202
|
"aria-expanded": expanded,
|
|
5986
7203
|
children: [
|
|
5987
|
-
/* @__PURE__ */
|
|
5988
|
-
/* @__PURE__ */
|
|
5989
|
-
/* @__PURE__ */
|
|
5990
|
-
sourceChainIcon && /* @__PURE__ */
|
|
7204
|
+
/* @__PURE__ */ jsxs16("div", { className: "rs-history-card-row", children: [
|
|
7205
|
+
/* @__PURE__ */ jsxs16("div", { className: "rs-history-card-icons", children: [
|
|
7206
|
+
/* @__PURE__ */ jsx18("span", { className: "rs-history-card-token", children: sourceTokenIcon ? /* @__PURE__ */ jsx18("img", { src: sourceTokenIcon, alt: "" }) : sourceSymbol.slice(0, 2) }),
|
|
7207
|
+
sourceChainIcon && /* @__PURE__ */ jsx18("span", { className: "rs-history-card-chain", children: /* @__PURE__ */ jsx18("img", { src: sourceChainIcon, alt: "" }) })
|
|
5991
7208
|
] }),
|
|
5992
|
-
/* @__PURE__ */
|
|
5993
|
-
/* @__PURE__ */
|
|
5994
|
-
date && /* @__PURE__ */
|
|
7209
|
+
/* @__PURE__ */ jsxs16("div", { className: "rs-history-card-text", children: [
|
|
7210
|
+
/* @__PURE__ */ jsx18("span", { className: "rs-history-card-title", children: txTypeLabel }),
|
|
7211
|
+
date && /* @__PURE__ */ jsx18("span", { className: "rs-history-card-date", children: date })
|
|
5995
7212
|
] }),
|
|
5996
|
-
/* @__PURE__ */
|
|
5997
|
-
/* @__PURE__ */
|
|
5998
|
-
/* @__PURE__ */
|
|
7213
|
+
/* @__PURE__ */ jsxs16("div", { className: "rs-history-card-side", children: [
|
|
7214
|
+
/* @__PURE__ */ jsx18("span", { className: "rs-history-card-amount", children: displayAmount }),
|
|
7215
|
+
/* @__PURE__ */ jsx18("span", { className: `rs-history-badge rs-history-badge--${status}`, children: STATUS_LABEL[status] })
|
|
5999
7216
|
] })
|
|
6000
7217
|
] }),
|
|
6001
|
-
|
|
6002
|
-
sourceChainName && /* @__PURE__ */
|
|
6003
|
-
/* @__PURE__ */
|
|
6004
|
-
/* @__PURE__ */
|
|
6005
|
-
/* @__PURE__ */
|
|
6006
|
-
sourceChainIcon && /* @__PURE__ */
|
|
7218
|
+
/* @__PURE__ */ jsx18("div", { className: "rs-history-card-panel", children: /* @__PURE__ */ jsx18("div", { className: "rs-history-card-panel-inner", children: /* @__PURE__ */ jsxs16("div", { className: "rs-history-card-details", children: [
|
|
7219
|
+
sourceChainName && /* @__PURE__ */ jsxs16("div", { className: "rs-amount-detail-row", children: [
|
|
7220
|
+
/* @__PURE__ */ jsx18("span", { children: "Source chain" }),
|
|
7221
|
+
/* @__PURE__ */ jsxs16("span", { className: "rs-amount-detail-value", children: [
|
|
7222
|
+
/* @__PURE__ */ jsx18("span", { children: sourceChainName }),
|
|
7223
|
+
sourceChainIcon && /* @__PURE__ */ jsx18("span", { className: "rs-amount-detail-icon", children: /* @__PURE__ */ jsx18("img", { src: sourceChainIcon, alt: "" }) })
|
|
6007
7224
|
] })
|
|
6008
7225
|
] }),
|
|
6009
|
-
targetChainName && /* @__PURE__ */
|
|
6010
|
-
/* @__PURE__ */
|
|
6011
|
-
/* @__PURE__ */
|
|
6012
|
-
/* @__PURE__ */
|
|
6013
|
-
targetChainIcon && /* @__PURE__ */
|
|
7226
|
+
targetChainName && /* @__PURE__ */ jsxs16("div", { className: "rs-amount-detail-row", children: [
|
|
7227
|
+
/* @__PURE__ */ jsx18("span", { children: "Destination chain" }),
|
|
7228
|
+
/* @__PURE__ */ jsxs16("span", { className: "rs-amount-detail-value", children: [
|
|
7229
|
+
/* @__PURE__ */ jsx18("span", { children: targetChainName }),
|
|
7230
|
+
targetChainIcon && /* @__PURE__ */ jsx18("span", { className: "rs-amount-detail-icon", children: /* @__PURE__ */ jsx18("img", { src: targetChainIcon, alt: "" }) })
|
|
6014
7231
|
] })
|
|
6015
7232
|
] }),
|
|
6016
|
-
srcTxUrl && deposit.sourceTxHash && /* @__PURE__ */
|
|
6017
|
-
/* @__PURE__ */
|
|
6018
|
-
/* @__PURE__ */
|
|
7233
|
+
srcTxUrl && deposit.sourceTxHash && /* @__PURE__ */ jsxs16("div", { className: "rs-amount-detail-row", children: [
|
|
7234
|
+
/* @__PURE__ */ jsx18("span", { children: "Transaction details" }),
|
|
7235
|
+
/* @__PURE__ */ jsxs16(
|
|
6019
7236
|
"a",
|
|
6020
7237
|
{
|
|
6021
7238
|
href: srcTxUrl,
|
|
@@ -6024,13 +7241,13 @@ function HistoryCard({ deposit }) {
|
|
|
6024
7241
|
className: "rs-history-card-link",
|
|
6025
7242
|
onClick: (e) => e.stopPropagation(),
|
|
6026
7243
|
children: [
|
|
6027
|
-
/* @__PURE__ */
|
|
6028
|
-
/* @__PURE__ */
|
|
7244
|
+
/* @__PURE__ */ jsx18("span", { children: shortenHash(deposit.sourceTxHash) }),
|
|
7245
|
+
/* @__PURE__ */ jsx18(ArrowUpRightIcon, {})
|
|
6029
7246
|
]
|
|
6030
7247
|
}
|
|
6031
7248
|
)
|
|
6032
7249
|
] })
|
|
6033
|
-
] })
|
|
7250
|
+
] }) }) })
|
|
6034
7251
|
]
|
|
6035
7252
|
}
|
|
6036
7253
|
);
|
|
@@ -6038,9 +7255,9 @@ function HistoryCard({ deposit }) {
|
|
|
6038
7255
|
DepositHistoryPanel.displayName = "DepositHistoryPanel";
|
|
6039
7256
|
|
|
6040
7257
|
// src/DepositModal.tsx
|
|
6041
|
-
import { jsx as
|
|
7258
|
+
import { jsx as jsx19, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
6042
7259
|
var ReownDepositInner = lazy2(
|
|
6043
|
-
() => import("./DepositModalReown-
|
|
7260
|
+
() => import("./DepositModalReown-6SUEC5IU.mjs").then((m) => ({ default: m.DepositModalReown }))
|
|
6044
7261
|
);
|
|
6045
7262
|
function sortByCreatedAtDesc(items) {
|
|
6046
7263
|
return [...items].sort((a, b) => {
|
|
@@ -6056,7 +7273,7 @@ function DepositModal(props) {
|
|
|
6056
7273
|
"dappWalletClient"
|
|
6057
7274
|
);
|
|
6058
7275
|
if (needsReown) {
|
|
6059
|
-
return /* @__PURE__ */
|
|
7276
|
+
return /* @__PURE__ */ jsx19(Suspense2, { fallback: null, children: /* @__PURE__ */ jsx19(
|
|
6060
7277
|
ReownDepositInner,
|
|
6061
7278
|
{
|
|
6062
7279
|
...props,
|
|
@@ -6064,7 +7281,7 @@ function DepositModal(props) {
|
|
|
6064
7281
|
}
|
|
6065
7282
|
) });
|
|
6066
7283
|
}
|
|
6067
|
-
return /* @__PURE__ */
|
|
7284
|
+
return /* @__PURE__ */ jsx19(
|
|
6068
7285
|
DepositModalInner,
|
|
6069
7286
|
{
|
|
6070
7287
|
...props,
|
|
@@ -6094,9 +7311,12 @@ function DepositModalInner({
|
|
|
6094
7311
|
signerAddress = DEFAULT_SIGNER_ADDRESS,
|
|
6095
7312
|
sessionChainIds,
|
|
6096
7313
|
forceRegister = false,
|
|
6097
|
-
waitForFinalTx = true,
|
|
6098
7314
|
enableSolana = true,
|
|
6099
7315
|
dappImports,
|
|
7316
|
+
enableFiatOnramp = false,
|
|
7317
|
+
enableQrTransfer = true,
|
|
7318
|
+
fiatOnrampMethods,
|
|
7319
|
+
enableExchangeConnect = false,
|
|
6100
7320
|
postBridgeActions,
|
|
6101
7321
|
outputTokenRules,
|
|
6102
7322
|
rejectUnmapped,
|
|
@@ -6114,61 +7334,86 @@ function DepositModalInner({
|
|
|
6114
7334
|
onError,
|
|
6115
7335
|
debug
|
|
6116
7336
|
}) {
|
|
6117
|
-
const modalRef =
|
|
7337
|
+
const modalRef = useRef9(null);
|
|
6118
7338
|
const onReadyRef = useLatestRef(onReady);
|
|
6119
|
-
const [currentScreen, setCurrentScreen] =
|
|
6120
|
-
const [backHandler, setBackHandler] =
|
|
7339
|
+
const [currentScreen, setCurrentScreen] = useState13("connect");
|
|
7340
|
+
const [backHandler, setBackHandler] = useState13(
|
|
6121
7341
|
void 0
|
|
6122
7342
|
);
|
|
6123
7343
|
const showHistoryButton = uiConfig?.showHistoryButton ?? false;
|
|
6124
7344
|
const historyButtonVisible = showHistoryButton && (currentScreen === "select-asset" || currentScreen === "deposit-address");
|
|
6125
|
-
const [historyOpen, setHistoryOpen] =
|
|
6126
|
-
const [historyDeposits, setHistoryDeposits] =
|
|
6127
|
-
const [hasMoreHistory, setHasMoreHistory] =
|
|
6128
|
-
const [historyLoading, setHistoryLoading] =
|
|
6129
|
-
const [historyLoadingMore, setHistoryLoadingMore] =
|
|
6130
|
-
const [historyError, setHistoryError] =
|
|
6131
|
-
const cursorRef =
|
|
6132
|
-
const historyStaleRef =
|
|
6133
|
-
const historyLoadedRef =
|
|
7345
|
+
const [historyOpen, setHistoryOpen] = useState13(false);
|
|
7346
|
+
const [historyDeposits, setHistoryDeposits] = useState13([]);
|
|
7347
|
+
const [hasMoreHistory, setHasMoreHistory] = useState13(false);
|
|
7348
|
+
const [historyLoading, setHistoryLoading] = useState13(false);
|
|
7349
|
+
const [historyLoadingMore, setHistoryLoadingMore] = useState13(false);
|
|
7350
|
+
const [historyError, setHistoryError] = useState13(null);
|
|
7351
|
+
const cursorRef = useRef9(null);
|
|
7352
|
+
const historyStaleRef = useRef9(false);
|
|
7353
|
+
const historyLoadedRef = useRef9(false);
|
|
6134
7354
|
const targetChain = targetChainProp === "solana" ? "solana" : getChainId(targetChainProp);
|
|
6135
7355
|
const sourceChain = sourceChainProp ? getChainId(sourceChainProp) : void 0;
|
|
6136
|
-
const
|
|
7356
|
+
const [recipientIsContract, setRecipientIsContract] = useState13(false);
|
|
7357
|
+
const onErrorRef = useLatestRef(onError);
|
|
7358
|
+
useEffect11(() => {
|
|
7359
|
+
if (targetChain !== HYPERCORE_CHAIN_ID || !isAddress2(recipient, { strict: false })) {
|
|
7360
|
+
setRecipientIsContract(false);
|
|
7361
|
+
return;
|
|
7362
|
+
}
|
|
7363
|
+
let cancelled = false;
|
|
7364
|
+
getHyperEvmReadClient().getCode({ address: recipient }).then((code) => {
|
|
7365
|
+
if (cancelled) return;
|
|
7366
|
+
const isContract = isContractBytecode(code);
|
|
7367
|
+
setRecipientIsContract(isContract);
|
|
7368
|
+
if (isContract) {
|
|
7369
|
+
onErrorRef.current?.({
|
|
7370
|
+
message: "HyperCore deposits require an EOA recipient; the configured recipient is a smart contract.",
|
|
7371
|
+
code: "HYPERCORE_RECIPIENT_NOT_EOA"
|
|
7372
|
+
});
|
|
7373
|
+
}
|
|
7374
|
+
}).catch(() => {
|
|
7375
|
+
if (!cancelled) setRecipientIsContract(false);
|
|
7376
|
+
});
|
|
7377
|
+
return () => {
|
|
7378
|
+
cancelled = true;
|
|
7379
|
+
};
|
|
7380
|
+
}, [targetChain, recipient, onErrorRef]);
|
|
7381
|
+
const service = useMemo9(
|
|
6137
7382
|
() => createDepositService(backendUrl, {
|
|
6138
7383
|
debug,
|
|
6139
7384
|
debugScope: "service:deposit"
|
|
6140
7385
|
}),
|
|
6141
7386
|
[backendUrl, debug]
|
|
6142
7387
|
);
|
|
6143
|
-
const store =
|
|
7388
|
+
const store = useMemo9(
|
|
6144
7389
|
() => createDepositStore({ targetChain, targetToken }),
|
|
6145
7390
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
6146
7391
|
[]
|
|
6147
7392
|
);
|
|
6148
|
-
|
|
7393
|
+
useEffect11(() => {
|
|
6149
7394
|
store.dispatch({ type: "target/changed", targetChain, targetToken });
|
|
6150
7395
|
}, [store, targetChain, targetToken]);
|
|
6151
|
-
|
|
7396
|
+
useEffect11(() => {
|
|
6152
7397
|
if (isOpen && modalRef.current) {
|
|
6153
7398
|
applyTheme(modalRef.current, theme);
|
|
6154
7399
|
}
|
|
6155
7400
|
}, [isOpen, theme]);
|
|
6156
|
-
|
|
7401
|
+
useEffect11(() => {
|
|
6157
7402
|
configureSolanaRpcUrl(solanaRpcUrl);
|
|
6158
7403
|
}, [solanaRpcUrl]);
|
|
6159
|
-
|
|
7404
|
+
useEffect11(() => {
|
|
6160
7405
|
if (isOpen) {
|
|
6161
7406
|
onReadyRef.current?.();
|
|
6162
7407
|
}
|
|
6163
7408
|
}, [isOpen, onReadyRef]);
|
|
6164
|
-
const handleStepChange =
|
|
7409
|
+
const handleStepChange = useCallback9(
|
|
6165
7410
|
(onBack, screen) => {
|
|
6166
7411
|
setBackHandler(() => onBack);
|
|
6167
7412
|
if (screen) setCurrentScreen(screen);
|
|
6168
7413
|
},
|
|
6169
7414
|
[]
|
|
6170
7415
|
);
|
|
6171
|
-
const fetchHistory =
|
|
7416
|
+
const fetchHistory = useCallback9(
|
|
6172
7417
|
async (mode = "initial") => {
|
|
6173
7418
|
if (!recipient) return;
|
|
6174
7419
|
const isInitial = mode === "initial";
|
|
@@ -6216,26 +7461,26 @@ function DepositModalInner({
|
|
|
6216
7461
|
},
|
|
6217
7462
|
[recipient, service]
|
|
6218
7463
|
);
|
|
6219
|
-
const handleHistoryOpen =
|
|
7464
|
+
const handleHistoryOpen = useCallback9(() => {
|
|
6220
7465
|
setHistoryOpen(true);
|
|
6221
7466
|
if (!historyLoadedRef.current || historyStaleRef.current) {
|
|
6222
7467
|
fetchHistory("initial");
|
|
6223
7468
|
}
|
|
6224
7469
|
}, [fetchHistory]);
|
|
6225
|
-
const handleHistoryClose =
|
|
7470
|
+
const handleHistoryClose = useCallback9(() => {
|
|
6226
7471
|
setHistoryOpen(false);
|
|
6227
7472
|
}, []);
|
|
6228
|
-
const handleHistoryLoadMore =
|
|
7473
|
+
const handleHistoryLoadMore = useCallback9(() => {
|
|
6229
7474
|
fetchHistory("more");
|
|
6230
7475
|
}, [fetchHistory]);
|
|
6231
|
-
const markHistoryStale =
|
|
7476
|
+
const markHistoryStale = useCallback9(() => {
|
|
6232
7477
|
historyStaleRef.current = true;
|
|
6233
7478
|
if (historyOpen) {
|
|
6234
7479
|
fetchHistory("initial");
|
|
6235
7480
|
}
|
|
6236
7481
|
}, [historyOpen, fetchHistory]);
|
|
6237
7482
|
const onLifecycleRef = useLatestRef(onLifecycle);
|
|
6238
|
-
const handleLifecycle =
|
|
7483
|
+
const handleLifecycle = useCallback9(
|
|
6239
7484
|
(event) => {
|
|
6240
7485
|
onLifecycleRef.current?.(event);
|
|
6241
7486
|
if (event.type === "smart-account-changed" && !event.evm && !event.solana) {
|
|
@@ -6247,7 +7492,7 @@ function DepositModalInner({
|
|
|
6247
7492
|
},
|
|
6248
7493
|
[onLifecycleRef, showHistoryButton, markHistoryStale]
|
|
6249
7494
|
);
|
|
6250
|
-
|
|
7495
|
+
useEffect11(() => {
|
|
6251
7496
|
if (!isOpen) {
|
|
6252
7497
|
setHistoryOpen(false);
|
|
6253
7498
|
setHistoryDeposits([]);
|
|
@@ -6258,14 +7503,14 @@ function DepositModalInner({
|
|
|
6258
7503
|
historyLoadedRef.current = false;
|
|
6259
7504
|
}
|
|
6260
7505
|
}, [isOpen]);
|
|
6261
|
-
|
|
7506
|
+
useEffect11(() => {
|
|
6262
7507
|
if (!isOpen) {
|
|
6263
7508
|
store.dispatch({ type: "flow/reset" });
|
|
6264
7509
|
}
|
|
6265
7510
|
}, [isOpen, store]);
|
|
6266
7511
|
const showBackButton = uiConfig?.showBackButton ?? true;
|
|
6267
7512
|
const canGoBack = backHandler !== void 0;
|
|
6268
|
-
return /* @__PURE__ */
|
|
7513
|
+
return /* @__PURE__ */ jsx19(DepositStoreProvider, { store, children: /* @__PURE__ */ jsx19(
|
|
6269
7514
|
Modal,
|
|
6270
7515
|
{
|
|
6271
7516
|
isOpen,
|
|
@@ -6273,20 +7518,20 @@ function DepositModalInner({
|
|
|
6273
7518
|
className,
|
|
6274
7519
|
inline,
|
|
6275
7520
|
closeOnOverlayClick,
|
|
6276
|
-
children: /* @__PURE__ */
|
|
6277
|
-
/* @__PURE__ */
|
|
6278
|
-
/* @__PURE__ */
|
|
7521
|
+
children: /* @__PURE__ */ jsxs17("div", { ref: modalRef, className: "rs-modal", children: [
|
|
7522
|
+
/* @__PURE__ */ jsxs17("div", { className: "rs-modal-header--redesigned", children: [
|
|
7523
|
+
/* @__PURE__ */ jsx19("div", { className: "rs-modal-header-nav-left", children: showBackButton && canGoBack && backHandler && /* @__PURE__ */ jsx19(
|
|
6279
7524
|
"button",
|
|
6280
7525
|
{
|
|
6281
7526
|
type: "button",
|
|
6282
7527
|
className: "rs-modal-header-back",
|
|
6283
7528
|
"aria-label": "Go back",
|
|
6284
7529
|
onClick: backHandler,
|
|
6285
|
-
children: /* @__PURE__ */
|
|
7530
|
+
children: /* @__PURE__ */ jsx19(ChevronLeftIcon, {})
|
|
6286
7531
|
}
|
|
6287
7532
|
) }),
|
|
6288
|
-
/* @__PURE__ */
|
|
6289
|
-
historyButtonVisible && /* @__PURE__ */
|
|
7533
|
+
/* @__PURE__ */ jsxs17("div", { className: "rs-modal-header-nav-right", children: [
|
|
7534
|
+
historyButtonVisible && /* @__PURE__ */ jsx19(
|
|
6290
7535
|
"button",
|
|
6291
7536
|
{
|
|
6292
7537
|
type: "button",
|
|
@@ -6294,22 +7539,22 @@ function DepositModalInner({
|
|
|
6294
7539
|
"aria-label": "Deposit history",
|
|
6295
7540
|
onClick: handleHistoryOpen,
|
|
6296
7541
|
disabled: !recipient,
|
|
6297
|
-
children: /* @__PURE__ */
|
|
7542
|
+
children: /* @__PURE__ */ jsx19(HistoryIcon, {})
|
|
6298
7543
|
}
|
|
6299
7544
|
),
|
|
6300
|
-
/* @__PURE__ */
|
|
7545
|
+
/* @__PURE__ */ jsx19(
|
|
6301
7546
|
"button",
|
|
6302
7547
|
{
|
|
6303
7548
|
type: "button",
|
|
6304
7549
|
onClick: onClose,
|
|
6305
7550
|
className: "rs-modal-close",
|
|
6306
7551
|
"aria-label": "Close",
|
|
6307
|
-
children: /* @__PURE__ */
|
|
7552
|
+
children: /* @__PURE__ */ jsx19(CloseIcon, {})
|
|
6308
7553
|
}
|
|
6309
7554
|
)
|
|
6310
7555
|
] })
|
|
6311
7556
|
] }),
|
|
6312
|
-
/* @__PURE__ */
|
|
7557
|
+
recipientIsContract ? /* @__PURE__ */ jsx19("div", { className: "rs-modal-body", children: /* @__PURE__ */ jsx19(Callout, { variant: "error", children: "HyperCore deposits require an EOA recipient. The configured recipient is a smart contract, which is not supported." }) }) : /* @__PURE__ */ jsx19(
|
|
6313
7558
|
DepositFlow,
|
|
6314
7559
|
{
|
|
6315
7560
|
dappWalletClient,
|
|
@@ -6330,9 +7575,12 @@ function DepositModalInner({
|
|
|
6330
7575
|
signerAddress,
|
|
6331
7576
|
sessionChainIds,
|
|
6332
7577
|
forceRegister,
|
|
6333
|
-
waitForFinalTx,
|
|
6334
7578
|
enableSolana,
|
|
6335
7579
|
dappImports,
|
|
7580
|
+
enableFiatOnramp,
|
|
7581
|
+
enableQrTransfer,
|
|
7582
|
+
fiatOnrampMethods,
|
|
7583
|
+
enableExchangeConnect,
|
|
6336
7584
|
reownWallet,
|
|
6337
7585
|
onConnect,
|
|
6338
7586
|
onDisconnect,
|
|
@@ -6347,7 +7595,7 @@ function DepositModalInner({
|
|
|
6347
7595
|
debug
|
|
6348
7596
|
}
|
|
6349
7597
|
),
|
|
6350
|
-
showHistoryButton && historyOpen && /* @__PURE__ */
|
|
7598
|
+
showHistoryButton && historyOpen && /* @__PURE__ */ jsx19(
|
|
6351
7599
|
DepositHistoryPanel,
|
|
6352
7600
|
{
|
|
6353
7601
|
deposits: historyDeposits,
|