@rhinestone/deposit-modal 0.3.0-alpha.12 → 0.3.0-alpha.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (31) hide show
  1. package/README.md +59 -0
  2. package/dist/{DepositModalReown-EC4DJ3EC.cjs → DepositModalReown-4I47KSPN.cjs} +6 -6
  3. package/dist/{DepositModalReown-QOTUF4JC.mjs → DepositModalReown-DIUIB3MU.mjs} +3 -3
  4. package/dist/{QRCode-KG47KTGX.cjs → QRCode-5DXFNKI2.cjs} +1 -1
  5. package/dist/{QRCode-YJ3EGWQS.mjs → QRCode-WUC652SH.mjs} +1 -1
  6. package/dist/{WithdrawModalReown-QEQPCSWT.mjs → WithdrawModalReown-WRUEALDP.mjs} +3 -3
  7. package/dist/{WithdrawModalReown-Z5JVENP6.cjs → WithdrawModalReown-Y3NRAKXJ.cjs} +6 -6
  8. package/dist/{chunk-YI63OMXN.cjs → chunk-2NUXDEEO.cjs} +57 -57
  9. package/dist/{chunk-I5G5ULRP.cjs → chunk-3CYGTYMY.cjs} +1322 -320
  10. package/dist/{chunk-WVE3JN3C.mjs → chunk-4ZN726P5.mjs} +345 -54
  11. package/dist/{chunk-QXIJLRKC.mjs → chunk-JTMGFWXO.mjs} +1 -1
  12. package/dist/{chunk-FGVSNARE.cjs → chunk-JTULAFMU.cjs} +2 -2
  13. package/dist/{chunk-2TWQGPPB.cjs → chunk-N4XRQPVA.cjs} +374 -83
  14. package/dist/{chunk-7MZNQ4C2.mjs → chunk-VD4WTEHP.mjs} +2 -2
  15. package/dist/{chunk-HR6BABPX.mjs → chunk-XG474KUR.mjs} +1433 -431
  16. package/dist/deposit.cjs +3 -3
  17. package/dist/deposit.d.cts +2 -2
  18. package/dist/deposit.d.ts +2 -2
  19. package/dist/deposit.mjs +2 -2
  20. package/dist/index.cjs +4 -4
  21. package/dist/index.d.cts +1 -1
  22. package/dist/index.d.ts +1 -1
  23. package/dist/index.mjs +3 -3
  24. package/dist/styles.css +525 -66
  25. package/dist/{types-D6wrO4Ow.d.cts → types-C8i2ebY1.d.cts} +25 -0
  26. package/dist/{types-D6wrO4Ow.d.ts → types-C8i2ebY1.d.ts} +25 -0
  27. package/dist/withdraw.cjs +3 -3
  28. package/dist/withdraw.d.cts +2 -2
  29. package/dist/withdraw.d.ts +2 -2
  30. package/dist/withdraw.mjs +2 -2
  31. package/package.json +3 -3
@@ -62,14 +62,14 @@ function Modal({
62
62
  }
63
63
  }, [isOpen]);
64
64
  useEffect(() => {
65
- if (isOpen) {
65
+ if (isOpen && !inline) {
66
66
  const originalOverflow = document.body.style.overflow;
67
67
  document.body.style.overflow = "hidden";
68
68
  return () => {
69
69
  document.body.style.overflow = originalOverflow;
70
70
  };
71
71
  }
72
- }, [isOpen]);
72
+ }, [isOpen, inline]);
73
73
  const handleKeyDown = useCallback(
74
74
  (event) => {
75
75
  if (event.key === "Escape") {
@@ -164,7 +164,10 @@ import {
164
164
  Percent,
165
165
  Clock,
166
166
  CirclePlus,
167
- CircleArrowOutUpLeft
167
+ CircleArrowOutUpLeft,
168
+ CreditCard,
169
+ Landmark,
170
+ Apple
168
171
  } from "lucide-react";
169
172
  import { jsx as jsx2 } from "react/jsx-runtime";
170
173
  var WalletIcon = Wallet;
@@ -207,6 +210,9 @@ var PercentIcon = Percent;
207
210
  var ClockIcon = Clock;
208
211
  var PlusCircleIcon = CirclePlus;
209
212
  var CircleArrowOutUpLeftIcon = CircleArrowOutUpLeft;
213
+ var CardIcon = CreditCard;
214
+ var BankIcon = Landmark;
215
+ var AppleIcon = Apple;
210
216
 
211
217
  // src/core/useLatestRef.ts
212
218
  import { useEffect as useEffect2, useRef as useRef2 } from "react";
@@ -972,6 +978,150 @@ function createDepositService(baseUrl, options) {
972
978
  debugError(debug, scope, "fetchPrices:error", err);
973
979
  return {};
974
980
  }
981
+ },
982
+ async getSwappedWidgetUrl(params) {
983
+ const url = apiUrl("/onramp/swapped/widget-url");
984
+ debugLog(debug, scope, "getSwappedWidgetUrl:request", {
985
+ smartAccount: shortRef(params.smartAccount),
986
+ method: params.method
987
+ });
988
+ const response = await fetch(url, {
989
+ method: "POST",
990
+ headers: { "Content-Type": "application/json" },
991
+ body: JSON.stringify(params)
992
+ });
993
+ if (!response.ok) {
994
+ const error = await response.json().catch(() => ({ error: "Unknown error" }));
995
+ debugError(debug, scope, "getSwappedWidgetUrl:failed", error, {
996
+ status: response.status
997
+ });
998
+ throw new Error(
999
+ error.error || `Swapped widget URL failed: ${response.status}`
1000
+ );
1001
+ }
1002
+ const body = await response.json();
1003
+ if (typeof body.url !== "string" || typeof body.currencyCode !== "string" || typeof body.externalCustomerId !== "string") {
1004
+ throw new Error("Swapped widget URL: malformed response");
1005
+ }
1006
+ return {
1007
+ url: body.url,
1008
+ currencyCode: body.currencyCode,
1009
+ sandbox: body.sandbox === true,
1010
+ externalCustomerId: body.externalCustomerId,
1011
+ expiresAt: body.expiresAt
1012
+ };
1013
+ },
1014
+ async getSwappedConnectUrl(params) {
1015
+ const url = apiUrl("/onramp/swapped/connect-url");
1016
+ debugLog(debug, scope, "getSwappedConnectUrl:request", {
1017
+ smartAccount: shortRef(params.smartAccount),
1018
+ connection: params.connection
1019
+ });
1020
+ const response = await fetch(url, {
1021
+ method: "POST",
1022
+ headers: { "Content-Type": "application/json" },
1023
+ body: JSON.stringify(params)
1024
+ });
1025
+ if (!response.ok) {
1026
+ const error = await response.json().catch(() => ({ error: "Unknown error" }));
1027
+ debugError(debug, scope, "getSwappedConnectUrl:failed", error, {
1028
+ status: response.status
1029
+ });
1030
+ throw new Error(
1031
+ error.error || `Swapped Connect URL failed: ${response.status}`
1032
+ );
1033
+ }
1034
+ const body = await response.json();
1035
+ if (typeof body.url !== "string" || typeof body.currencyCode !== "string" || typeof body.externalCustomerId !== "string") {
1036
+ throw new Error("Swapped Connect URL: malformed response");
1037
+ }
1038
+ return {
1039
+ url: body.url,
1040
+ currencyCode: body.currencyCode,
1041
+ sandbox: body.sandbox === true,
1042
+ externalCustomerId: body.externalCustomerId,
1043
+ expiresAt: body.expiresAt
1044
+ };
1045
+ },
1046
+ async getSwappedConnectExchanges() {
1047
+ const url = apiUrl("/onramp/swapped/connect-exchanges");
1048
+ debugLog(debug, scope, "getSwappedConnectExchanges:request");
1049
+ const response = await fetch(url, {
1050
+ method: "GET",
1051
+ headers: { "Content-Type": "application/json" },
1052
+ cache: "no-store"
1053
+ });
1054
+ if (!response.ok) {
1055
+ const error = await response.json().catch(() => ({ error: "Unknown error" }));
1056
+ debugError(debug, scope, "getSwappedConnectExchanges:failed", error, {
1057
+ status: response.status
1058
+ });
1059
+ throw new Error(
1060
+ error.error || `Swapped Connect exchanges failed: ${response.status}`
1061
+ );
1062
+ }
1063
+ const body = await response.json();
1064
+ const rawExchanges = Array.isArray(body.exchanges) ? body.exchanges : null;
1065
+ const exchanges = [];
1066
+ let hasMalformedExchange = rawExchanges === null;
1067
+ for (const exchange of rawExchanges ?? []) {
1068
+ if (!exchange || typeof exchange !== "object") {
1069
+ hasMalformedExchange = true;
1070
+ continue;
1071
+ }
1072
+ const raw = exchange;
1073
+ const connection = typeof raw.connection === "string" ? raw.connection : "";
1074
+ const name = typeof raw.name === "string" ? raw.name : "";
1075
+ const logoUrl = typeof raw.logoUrl === "string" || raw.logoUrl === null ? raw.logoUrl : null;
1076
+ if (!connection || !name) {
1077
+ hasMalformedExchange = true;
1078
+ continue;
1079
+ }
1080
+ exchanges.push({ connection, name, logoUrl });
1081
+ }
1082
+ if (hasMalformedExchange || typeof body.fetchedAt !== "string" || typeof body.expiresAt !== "string") {
1083
+ throw new Error("Swapped Connect exchanges: malformed response");
1084
+ }
1085
+ return {
1086
+ exchanges,
1087
+ fetchedAt: body.fetchedAt,
1088
+ expiresAt: body.expiresAt,
1089
+ stale: body.stale === true ? true : void 0
1090
+ };
1091
+ },
1092
+ async fetchSwappedOrderStatus(smartAccount) {
1093
+ const url = apiUrl(
1094
+ `/onramp/swapped/status/${encodeURIComponent(smartAccount)}`
1095
+ );
1096
+ const response = await fetch(url, {
1097
+ method: "GET",
1098
+ headers: { "Content-Type": "application/json" },
1099
+ cache: "no-store"
1100
+ });
1101
+ if (!response.ok) return null;
1102
+ let body = null;
1103
+ try {
1104
+ body = await response.json();
1105
+ } catch {
1106
+ return null;
1107
+ }
1108
+ if (!body || body.ok !== true) return null;
1109
+ const status = typeof body.status === "string" ? body.status : null;
1110
+ const orderId = typeof body.orderId === "string" ? body.orderId : null;
1111
+ if (!status || !orderId) return null;
1112
+ const numericOrNull = (v) => typeof v === "number" && Number.isFinite(v) ? v : null;
1113
+ return {
1114
+ orderId,
1115
+ status,
1116
+ orderCrypto: typeof body.orderCrypto === "string" ? body.orderCrypto : null,
1117
+ orderCryptoAmount: typeof body.orderCryptoAmount === "string" ? body.orderCryptoAmount : null,
1118
+ transactionId: typeof body.transactionId === "string" ? body.transactionId : null,
1119
+ receivedAt: typeof body.receivedAt === "string" ? body.receivedAt : null,
1120
+ paidAmountUsd: numericOrNull(body.paidAmountUsd),
1121
+ paidAmountEur: numericOrNull(body.paidAmountEur),
1122
+ onrampFeeUsd: numericOrNull(body.onrampFeeUsd),
1123
+ paymentMethod: typeof body.paymentMethod === "string" ? body.paymentMethod : null
1124
+ };
975
1125
  }
976
1126
  };
977
1127
  }
@@ -1833,6 +1983,11 @@ function formatBalanceUsd(value) {
1833
1983
  if (!Number.isFinite(value) || value <= 0) return "$0.00";
1834
1984
  return `$${value.toFixed(2)}`;
1835
1985
  }
1986
+ function fiatIcon(name) {
1987
+ if (name === "apple") return /* @__PURE__ */ jsx14(AppleIcon, {});
1988
+ if (name === "bank") return /* @__PURE__ */ jsx14(BankIcon, {});
1989
+ return /* @__PURE__ */ jsx14(CardIcon, {});
1990
+ }
1836
1991
  function shorten(addr) {
1837
1992
  return addr.length > 12 ? `${addr.slice(0, 6)}...${addr.slice(-4)}` : addr;
1838
1993
  }
@@ -1873,6 +2028,10 @@ function ConnectStep({
1873
2028
  onSelectTransferCrypto,
1874
2029
  transferCryptoState,
1875
2030
  transferCryptoErrorReason,
2031
+ onSelectPayWithCard,
2032
+ fiatPaymentMethods,
2033
+ onSelectFiatMethod,
2034
+ onSelectFundFromExchange,
1876
2035
  onRequestConnect,
1877
2036
  onConnect,
1878
2037
  onDisconnect,
@@ -1904,11 +2063,36 @@ function ConnectStep({
1904
2063
  {
1905
2064
  leading: TRANSFER_CRYPTO_LEADING,
1906
2065
  title: "Transfer crypto",
1907
- subtitle: transferCryptoState === "loading" ? "Preparing\u2026" : transferCryptoState === "error" ? transferCryptoErrorReason ?? "Couldn't prepare account \u2014 tap to retry" : "Instant - No limit",
2066
+ subtitle: transferCryptoState === "error" ? transferCryptoErrorReason ?? "Couldn't prepare account \u2014 tap to retry" : "Instant - No limit",
1908
2067
  meta: CHAIN_BADGE_META,
1909
- onClick: onSelectTransferCrypto,
1910
- disabled: transferCryptoState === "loading",
1911
- trailing: transferCryptoState === "loading" ? SMALL_SPINNER : void 0
2068
+ onClick: onSelectTransferCrypto
2069
+ }
2070
+ ),
2071
+ fiatPaymentMethods && fiatPaymentMethods.length > 0 && onSelectFiatMethod ? fiatPaymentMethods.map((opt) => /* @__PURE__ */ jsx14(
2072
+ ListRow,
2073
+ {
2074
+ leading: fiatIcon(opt.icon),
2075
+ title: opt.label,
2076
+ subtitle: opt.sublabel,
2077
+ onClick: () => onSelectFiatMethod(opt.method)
2078
+ },
2079
+ opt.method
2080
+ )) : onSelectPayWithCard && /* @__PURE__ */ jsx14(
2081
+ ListRow,
2082
+ {
2083
+ leading: /* @__PURE__ */ jsx14(CardIcon, {}),
2084
+ title: "Pay with Card",
2085
+ subtitle: "Buy crypto with card or bank",
2086
+ onClick: onSelectPayWithCard
2087
+ }
2088
+ ),
2089
+ onSelectFundFromExchange && /* @__PURE__ */ jsx14(
2090
+ ListRow,
2091
+ {
2092
+ leading: /* @__PURE__ */ jsx14(BankIcon, {}),
2093
+ title: "Fund from Exchange",
2094
+ subtitle: "Use Coinbase, Binance, MetaMask\u2026",
2095
+ onClick: onSelectFundFromExchange
1912
2096
  }
1913
2097
  ),
1914
2098
  rows.map((row) => {
@@ -2271,6 +2455,9 @@ function getEventSourceDetails(event) {
2271
2455
  function isDepositEvent(event) {
2272
2456
  return event?.type === "deposit-received" || event?.type === "bridge-started" || event?.type === "bridge-complete" || event?.type === "bridge-failed" || event?.type === "post-bridge-swap-complete" || event?.type === "post-bridge-swap-failed" || event?.type === "error";
2273
2457
  }
2458
+ function isFailedEvent(event) {
2459
+ return event?.type === "bridge-failed" || event?.type === "post-bridge-swap-failed" || event?.type === "error";
2460
+ }
2274
2461
  function isHexString(value) {
2275
2462
  return value.startsWith("0x") || value.startsWith("0X");
2276
2463
  }
@@ -2280,6 +2467,41 @@ function txRefsMatch(a, b) {
2280
2467
  }
2281
2468
  return a === b;
2282
2469
  }
2470
+ function formatBridgeFailedMessage(event) {
2471
+ const eventData = event?.data ?? {};
2472
+ const code = typeof eventData.errorCode === "string" ? eventData.errorCode : void 0;
2473
+ const backendMessage = typeof eventData.message === "string" ? eventData.message.trim() : "";
2474
+ function toUserFacingFailure(raw) {
2475
+ const lower = raw.toLowerCase();
2476
+ if (lower.includes("insufficient funds")) {
2477
+ return "Deposit was received, but processing could not continue due to insufficient funds. Please retry.";
2478
+ }
2479
+ if (lower.includes("no valid quote available")) {
2480
+ return "No bridge route is currently available for this transfer. Please try again shortly.";
2481
+ }
2482
+ if (lower.includes("simulation failed")) {
2483
+ return "Transfer processing failed during simulation. Please retry.";
2484
+ }
2485
+ if (raw.length > 220) {
2486
+ return "Transfer processing failed. Please retry.";
2487
+ }
2488
+ return raw;
2489
+ }
2490
+ if (backendMessage.length > 0) {
2491
+ return { message: toUserFacingFailure(backendMessage), code };
2492
+ }
2493
+ if (code) {
2494
+ return { message: `Bridge failed (${code})`, code };
2495
+ }
2496
+ return { message: "Bridge failed" };
2497
+ }
2498
+ function failureMessageForEvent(event) {
2499
+ if (event?.type === "error") {
2500
+ const message = isRecord(event.data) ? asString(event.data.message) : void 0;
2501
+ return message ?? "Unknown error";
2502
+ }
2503
+ return formatBridgeFailedMessage(event).message;
2504
+ }
2283
2505
 
2284
2506
  // src/components/steps/ProcessingStep.tsx
2285
2507
  import { jsx as jsx18, jsxs as jsxs16 } from "react/jsx-runtime";
@@ -2353,6 +2575,24 @@ var SOFT_DELAY_MS = {
2353
2575
  bridging: 4 * 60 * 1e3
2354
2576
  };
2355
2577
  var PHASE_TIMINGS_PREFIX = "rhinestone:phase-timings";
2578
+ var STABLECOIN_SYMBOLS = /* @__PURE__ */ new Set([
2579
+ "USDC",
2580
+ "USDT",
2581
+ "DAI",
2582
+ "FRAX",
2583
+ "PYUSD",
2584
+ "USDP",
2585
+ "TUSD",
2586
+ "GUSD",
2587
+ "USDS",
2588
+ "LUSD",
2589
+ "BUSD",
2590
+ "USDE"
2591
+ ]);
2592
+ function maxFractionDigitsFor(symbol) {
2593
+ if (!symbol) return 6;
2594
+ return STABLECOIN_SYMBOLS.has(symbol.toUpperCase()) ? 3 : 6;
2595
+ }
2356
2596
  function loadPhaseTimings(txHash) {
2357
2597
  if (typeof window === "undefined") return null;
2358
2598
  try {
@@ -2380,38 +2620,6 @@ function isEventForTx(event, txHash) {
2380
2620
  if (!eventTxHash) return false;
2381
2621
  return txRefsMatch(eventTxHash, txHash);
2382
2622
  }
2383
- function formatBridgeFailedMessage(event) {
2384
- const eventData = event?.data ?? {};
2385
- const code = typeof eventData.errorCode === "string" ? eventData.errorCode : void 0;
2386
- const backendMessage = typeof eventData.message === "string" ? eventData.message.trim() : "";
2387
- function toUserFacingFailure(raw) {
2388
- const lower = raw.toLowerCase();
2389
- if (lower.includes("insufficient funds")) {
2390
- return "Deposit was received, but processing could not continue due to insufficient funds. Please retry.";
2391
- }
2392
- if (lower.includes("no valid quote available")) {
2393
- return "No bridge route is currently available for this transfer. Please try again shortly.";
2394
- }
2395
- if (lower.includes("simulation failed")) {
2396
- return "Transfer processing failed during simulation. Please retry.";
2397
- }
2398
- if (raw.length > 220) {
2399
- return "Transfer processing failed. Please retry.";
2400
- }
2401
- return raw;
2402
- }
2403
- if (backendMessage.length > 0) {
2404
- const userMessage = toUserFacingFailure(backendMessage);
2405
- return {
2406
- message: userMessage,
2407
- code
2408
- };
2409
- }
2410
- if (code) {
2411
- return { message: `Bridge failed (${code})`, code };
2412
- }
2413
- return { message: "Bridge failed" };
2414
- }
2415
2623
  function parseWebhookTimestamp(event) {
2416
2624
  if (typeof event?.time !== "string") return void 0;
2417
2625
  const timestamp = Date.parse(event.time);
@@ -2502,7 +2710,7 @@ function ProcessingStep({
2502
2710
  debug,
2503
2711
  targetToken,
2504
2712
  uiConfig,
2505
- quotedFeeAmount = "0.1",
2713
+ quotedFeeAmount,
2506
2714
  quotedFeeSymbol,
2507
2715
  balanceAfterUsd,
2508
2716
  onClose,
@@ -2604,6 +2812,25 @@ function ProcessingStep({
2604
2812
  (previous) => syncPhaseTimings(previous, state.lastEvent)
2605
2813
  );
2606
2814
  }, [state.lastEvent?.time, state.lastEvent?.type, updatePhaseTimings]);
2815
+ const [swappedFiatContext, setSwappedFiatContext] = useState2(null);
2816
+ useEffect4(() => {
2817
+ let cancelled = false;
2818
+ service.fetchSwappedOrderStatus(smartAccount).then((res) => {
2819
+ if (cancelled || !res) return;
2820
+ if (!res.transactionId) return;
2821
+ if (res.transactionId.toLowerCase() !== txHash.toLowerCase()) return;
2822
+ setSwappedFiatContext({
2823
+ paidAmountUsd: res.paidAmountUsd,
2824
+ paidAmountEur: res.paidAmountEur,
2825
+ onrampFeeUsd: res.onrampFeeUsd,
2826
+ paymentMethod: res.paymentMethod
2827
+ });
2828
+ }).catch(() => {
2829
+ });
2830
+ return () => {
2831
+ cancelled = true;
2832
+ };
2833
+ }, [service, smartAccount, txHash]);
2607
2834
  useEffect4(() => {
2608
2835
  if (directTransfer) return;
2609
2836
  if (state.type !== "processing") {
@@ -2797,6 +3024,7 @@ function ProcessingStep({
2797
3024
  displaySourceToken,
2798
3025
  displaySourceChain
2799
3026
  ) : providedSourceDecimals ?? 18;
3027
+ const amountMaxDigits = maxFractionDigitsFor(sourceSymbol);
2800
3028
  const formattedReceivedAmount = (() => {
2801
3029
  try {
2802
3030
  const raw = formatUnits(BigInt(displayAmount), sourceDecimals);
@@ -2804,15 +3032,56 @@ function ProcessingStep({
2804
3032
  if (!Number.isFinite(numeric)) return raw;
2805
3033
  return numeric.toLocaleString("en-US", {
2806
3034
  minimumFractionDigits: 2,
2807
- maximumFractionDigits: 6
3035
+ maximumFractionDigits: amountMaxDigits
2808
3036
  });
2809
3037
  } catch {
2810
3038
  return Number(displayAmount).toLocaleString("en-US", {
2811
3039
  minimumFractionDigits: 2,
2812
- maximumFractionDigits: 6
3040
+ maximumFractionDigits: amountMaxDigits
2813
3041
  });
2814
3042
  }
2815
3043
  })();
3044
+ const destinationAmountRaw = (() => {
3045
+ const dest = lastEvent?.data?.destination;
3046
+ if (!dest || dest.amount === void 0) return void 0;
3047
+ try {
3048
+ return BigInt(dest.amount);
3049
+ } catch {
3050
+ return void 0;
3051
+ }
3052
+ })();
3053
+ const sourceAmountRaw = (() => {
3054
+ try {
3055
+ return BigInt(displayAmount);
3056
+ } catch {
3057
+ return void 0;
3058
+ }
3059
+ })();
3060
+ const bridgingCostRaw = sourceAmountRaw !== void 0 && destinationAmountRaw !== void 0 && sourceAmountRaw > destinationAmountRaw ? sourceAmountRaw - destinationAmountRaw : void 0;
3061
+ const formattedDestinationAmount = destinationAmountRaw !== void 0 ? (() => {
3062
+ try {
3063
+ const raw = formatUnits(destinationAmountRaw, sourceDecimals);
3064
+ const numeric = Number(raw);
3065
+ if (!Number.isFinite(numeric)) return raw;
3066
+ return numeric.toLocaleString("en-US", {
3067
+ maximumFractionDigits: amountMaxDigits
3068
+ });
3069
+ } catch {
3070
+ return void 0;
3071
+ }
3072
+ })() : void 0;
3073
+ const formattedBridgingCost = bridgingCostRaw !== void 0 ? (() => {
3074
+ try {
3075
+ const raw = formatUnits(bridgingCostRaw, sourceDecimals);
3076
+ const numeric = Number(raw);
3077
+ if (!Number.isFinite(numeric)) return raw;
3078
+ return numeric.toLocaleString("en-US", {
3079
+ maximumFractionDigits: amountMaxDigits
3080
+ });
3081
+ } catch {
3082
+ return void 0;
3083
+ }
3084
+ })() : void 0;
2816
3085
  const currentPhaseId = getCurrentPhaseId(state, phaseTimings);
2817
3086
  const activePhaseStartedAt = currentPhaseId ? getPhaseStartTime(currentPhaseId, phaseTimings) : void 0;
2818
3087
  const activePhaseElapsedMs = isProcessing && activePhaseStartedAt !== void 0 ? timelineNowMs - activePhaseStartedAt : 0;
@@ -2885,11 +3154,29 @@ function ProcessingStep({
2885
3154
  /* @__PURE__ */ jsx18("span", { children: isProcessing ? "Time elapsed" : "Total time" }),
2886
3155
  /* @__PURE__ */ jsx18("span", { className: "rs-review-detail-value", children: /* @__PURE__ */ jsx18(Ticker, { value: timerText }) })
2887
3156
  ] }),
2888
- /* @__PURE__ */ jsxs16("div", { className: "rs-review-detail-row", children: [
2889
- /* @__PURE__ */ jsx18("span", { children: "You send" }),
3157
+ swappedFiatContext?.paidAmountUsd != null && /* @__PURE__ */ jsxs16("div", { className: "rs-review-detail-row", children: [
3158
+ /* @__PURE__ */ jsx18("span", { children: "Paid" }),
3159
+ /* @__PURE__ */ jsxs16("span", { className: "rs-review-detail-value", children: [
3160
+ "$",
3161
+ swappedFiatContext.paidAmountUsd.toFixed(2),
3162
+ swappedFiatContext.paymentMethod && /* @__PURE__ */ jsxs16("span", { style: { color: "#71717b", marginLeft: 6 }, children: [
3163
+ "via ",
3164
+ swappedFiatContext.paymentMethod
3165
+ ] })
3166
+ ] })
3167
+ ] }),
3168
+ swappedFiatContext?.onrampFeeUsd != null && /* @__PURE__ */ jsxs16("div", { className: "rs-review-detail-row", children: [
3169
+ /* @__PURE__ */ jsx18("span", { children: "On-ramp fee" }),
3170
+ /* @__PURE__ */ jsxs16("span", { className: "rs-review-detail-value", children: [
3171
+ "$",
3172
+ swappedFiatContext.onrampFeeUsd.toFixed(2)
3173
+ ] })
3174
+ ] }),
3175
+ formattedBridgingCost && /* @__PURE__ */ jsxs16("div", { className: "rs-review-detail-row", children: [
3176
+ /* @__PURE__ */ jsx18("span", { children: "Bridging cost" }),
2890
3177
  /* @__PURE__ */ jsxs16("span", { className: "rs-review-detail-value", children: [
2891
3178
  /* @__PURE__ */ jsxs16("span", { children: [
2892
- formattedReceivedAmount,
3179
+ formattedBridgingCost,
2893
3180
  " ",
2894
3181
  sourceSymbol
2895
3182
  ] }),
@@ -2899,12 +3186,7 @@ function ProcessingStep({
2899
3186
  /* @__PURE__ */ jsxs16("div", { className: "rs-review-detail-row", children: [
2900
3187
  /* @__PURE__ */ jsx18("span", { children: "Receive" }),
2901
3188
  /* @__PURE__ */ jsxs16("span", { className: "rs-review-detail-value", children: [
2902
- /* @__PURE__ */ jsxs16("span", { children: [
2903
- "~",
2904
- formattedReceivedAmount,
2905
- " ",
2906
- targetSymbol
2907
- ] }),
3189
+ /* @__PURE__ */ jsx18("span", { children: formattedDestinationAmount ? `${formattedDestinationAmount} ${targetSymbol}` : `~${formattedReceivedAmount} ${targetSymbol}` }),
2908
3190
  targetTokenIcon && /* @__PURE__ */ jsx18("span", { className: "rs-review-detail-icon", children: /* @__PURE__ */ jsx18("img", { src: targetTokenIcon, alt: "" }) })
2909
3191
  ] })
2910
3192
  ] }),
@@ -2915,14 +3197,18 @@ function ProcessingStep({
2915
3197
  balanceAfterUsd.toFixed(2)
2916
3198
  ] })
2917
3199
  ] }),
2918
- /* @__PURE__ */ jsxs16("div", { className: "rs-review-detail-row", children: [
3200
+ quotedFeeAmount !== void 0 && /* @__PURE__ */ jsxs16("div", { className: "rs-review-detail-row", children: [
2919
3201
  /* @__PURE__ */ jsx18("span", { children: "Fees" }),
2920
3202
  /* @__PURE__ */ jsxs16("span", { className: "rs-review-detail-value", children: [
2921
- /* @__PURE__ */ jsx18(
3203
+ /* @__PURE__ */ jsxs16(
2922
3204
  "span",
2923
3205
  {
2924
3206
  style: feeSponsored ? { textDecoration: "line-through" } : void 0,
2925
- children: "$0.04"
3207
+ children: [
3208
+ quotedFeeAmount,
3209
+ " ",
3210
+ quotedFeeSymbol ?? sourceSymbol
3211
+ ]
2926
3212
  }
2927
3213
  ),
2928
3214
  /* @__PURE__ */ jsx18(Tooltip, { content: feeTooltip, children: /* @__PURE__ */ jsx18("span", { className: "rs-review-detail-info", "aria-label": "Fee info", children: /* @__PURE__ */ jsx18(InfoIcon, {}) }) })
@@ -3315,6 +3601,7 @@ export {
3315
3601
  ChevronLeftIcon,
3316
3602
  ChevronDownIcon,
3317
3603
  CloseIcon,
3604
+ HandCoinsIcon,
3318
3605
  HistoryIcon,
3319
3606
  InfoIcon,
3320
3607
  CopyIcon,
@@ -3324,6 +3611,7 @@ export {
3324
3611
  ClockIcon,
3325
3612
  PlusCircleIcon,
3326
3613
  CircleArrowOutUpLeftIcon,
3614
+ BankIcon,
3327
3615
  BodyHeader,
3328
3616
  PoweredBy,
3329
3617
  Spinner,
@@ -3348,8 +3636,11 @@ export {
3348
3636
  formatUserError,
3349
3637
  Tooltip,
3350
3638
  getEventTxHash,
3639
+ getEventSourceDetails,
3351
3640
  isDepositEvent,
3641
+ isFailedEvent,
3352
3642
  txRefsMatch,
3643
+ failureMessageForEvent,
3353
3644
  ProcessingStep,
3354
3645
  SAFE_ABI,
3355
3646
  executeSafeEthTransfer,
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  isUnsupportedChainSwitchError
3
- } from "./chunk-WVE3JN3C.mjs";
3
+ } from "./chunk-4ZN726P5.mjs";
4
4
  import {
5
5
  SUPPORTED_CHAINS,
6
6
  getChainName
@@ -1,6 +1,6 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
2
2
 
3
- var _chunk2TWQGPPBcjs = require('./chunk-2TWQGPPB.cjs');
3
+ var _chunkN4XRQPVAcjs = require('./chunk-N4XRQPVA.cjs');
4
4
 
5
5
 
6
6
 
@@ -145,7 +145,7 @@ function useReownWallet() {
145
145
  await switchChainAsync({ chainId });
146
146
  }
147
147
  } catch (err) {
148
- if (_chunk2TWQGPPBcjs.isUnsupportedChainSwitchError.call(void 0, err)) {
148
+ if (_chunkN4XRQPVAcjs.isUnsupportedChainSwitchError.call(void 0, err)) {
149
149
  throw new Error(
150
150
  `Switch to ${_chunk7JIDIX27cjs.getChainName.call(void 0, chainId)} in your wallet to continue`
151
151
  );