@rhinestone/deposit-modal 0.0.0-dev-20260611141108 → 0.0.0-dev-20260617120607

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 (29) hide show
  1. package/dist/{DepositModalReown-QVVFHL2N.cjs → DepositModalReown-KFTMS2WX.cjs} +9 -9
  2. package/dist/{DepositModalReown-O4VWVJYG.mjs → DepositModalReown-PC7EX5VK.mjs} +6 -6
  3. package/dist/{WithdrawModalReown-GLOHYSUG.mjs → WithdrawModalReown-BE23LUMT.mjs} +5 -5
  4. package/dist/{WithdrawModalReown-3GK2F2AF.cjs → WithdrawModalReown-Z2YF2FSJ.cjs} +8 -8
  5. package/dist/{chunk-7KHWMSID.cjs → chunk-3MXWIYAT.cjs} +16 -6
  6. package/dist/{chunk-NWCRGZG3.mjs → chunk-3PVDRSJ7.mjs} +36 -52
  7. package/dist/{chunk-MMPRPDLS.cjs → chunk-7MP2UWIQ.cjs} +349 -365
  8. package/dist/{chunk-MILJQWPT.cjs → chunk-ABVRVW3P.cjs} +133 -8
  9. package/dist/{chunk-7AADPL52.cjs → chunk-AE5LHTPM.cjs} +121 -101
  10. package/dist/{chunk-TQ2AYMWS.mjs → chunk-F7P4MV72.mjs} +1 -1
  11. package/dist/{chunk-BAEB5AFZ.mjs → chunk-FJWLC4AM.mjs} +1 -1
  12. package/dist/{chunk-E25DOT37.mjs → chunk-GKC22JC4.mjs} +217 -103
  13. package/dist/{chunk-R5CPOBCF.cjs → chunk-NRNJAQUA.cjs} +4 -4
  14. package/dist/{chunk-GQCEQZGF.cjs → chunk-OQVLEVNR.cjs} +256 -142
  15. package/dist/{chunk-AJHFNHG3.cjs → chunk-UEKPBRBY.cjs} +3 -3
  16. package/dist/{chunk-KAYBLYUS.mjs → chunk-UFKFSGT3.mjs} +14 -4
  17. package/dist/{chunk-RVBLNCWE.mjs → chunk-WCIGOV34.mjs} +32 -12
  18. package/dist/{chunk-6YRDD462.mjs → chunk-WJX3TJFK.mjs} +135 -10
  19. package/dist/constants.cjs +2 -2
  20. package/dist/constants.mjs +1 -1
  21. package/dist/deposit.cjs +6 -6
  22. package/dist/deposit.mjs +5 -5
  23. package/dist/index.cjs +7 -7
  24. package/dist/index.mjs +6 -6
  25. package/dist/polymarket.cjs +6 -6
  26. package/dist/polymarket.mjs +3 -3
  27. package/dist/withdraw.cjs +5 -5
  28. package/dist/withdraw.mjs +4 -4
  29. package/package.json +1 -1
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  getChainName
3
- } from "./chunk-6YRDD462.mjs";
3
+ } from "./chunk-WJX3TJFK.mjs";
4
4
 
5
5
  // src/core/safe.ts
6
6
  import {
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  SAFE_ABI
3
- } from "./chunk-TQ2AYMWS.mjs";
3
+ } from "./chunk-F7P4MV72.mjs";
4
4
 
5
5
  // src/core/dapp-imports/polymarket/constants.ts
6
6
  var POLYMARKET_POLYGON_CHAIN_ID = 137;
@@ -1,19 +1,19 @@
1
1
  import {
2
2
  CHAIN_BY_ID,
3
3
  NATIVE_TOKEN_ADDRESS,
4
+ findTokenDecimals,
4
5
  getChainIcon,
5
6
  getChainName,
6
7
  getExplorerTxUrl,
7
8
  getSolanaTokenByMint,
8
9
  getSupportedChainIds,
9
- getTargetTokenSymbol,
10
10
  getTokenAddress,
11
11
  getTokenDecimalsByAddress,
12
12
  getTokenIcon,
13
13
  getTokenSymbol,
14
14
  isSolanaCaip2,
15
15
  parseEvmChainId
16
- } from "./chunk-6YRDD462.mjs";
16
+ } from "./chunk-WJX3TJFK.mjs";
17
17
 
18
18
  // src/components/ui/Modal.tsx
19
19
  import {
@@ -2524,8 +2524,7 @@ function ConnectStep({
2524
2524
  ConnectStep.displayName = "ConnectStep";
2525
2525
 
2526
2526
  // src/components/steps/ProcessingStep.tsx
2527
- import { useCallback as useCallback3, useEffect as useEffect4, useRef as useRef4, useState as useState4 } from "react";
2528
- import { formatUnits } from "viem";
2527
+ import { useCallback as useCallback3, useEffect as useEffect5, useRef as useRef4, useState as useState5 } from "react";
2529
2528
 
2530
2529
  // src/components/ui/Button.tsx
2531
2530
  import { Fragment as Fragment3, jsx as jsx18, jsxs as jsxs16 } from "react/jsx-runtime";
@@ -2819,6 +2818,26 @@ function getEventSourceDetails(event) {
2819
2818
  }
2820
2819
  return {};
2821
2820
  }
2821
+ function asChain(value) {
2822
+ if (typeof value === "string" && value.trim().startsWith("solana")) {
2823
+ return "solana";
2824
+ }
2825
+ return asNumber(value);
2826
+ }
2827
+ function getEventDestinationDetails(event) {
2828
+ if (!event?.type || !isRecord(event.data)) return {};
2829
+ if (event.type !== "bridge-started" && event.type !== "bridge-complete" && event.type !== "post-bridge-swap-complete") {
2830
+ return {};
2831
+ }
2832
+ const destination = isRecord(event.data.destination) ? event.data.destination : void 0;
2833
+ if (!destination) return {};
2834
+ const token = asString(destination.asset);
2835
+ return {
2836
+ chainId: asChain(destination.chain),
2837
+ amount: asAmount(destination.amount),
2838
+ token: token?.trim() || void 0
2839
+ };
2840
+ }
2822
2841
  function isDepositEvent(event) {
2823
2842
  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";
2824
2843
  }
@@ -2870,6 +2889,127 @@ function failureMessageForEvent(event) {
2870
2889
  return formatBridgeFailedMessage(event).message;
2871
2890
  }
2872
2891
 
2892
+ // src/core/token-amount.ts
2893
+ import { formatUnits } from "viem";
2894
+ var STABLECOIN_SYMBOLS = /* @__PURE__ */ new Set([
2895
+ "USDC",
2896
+ "USDT",
2897
+ "USDT0",
2898
+ "DAI",
2899
+ "FRAX",
2900
+ "PYUSD",
2901
+ "USDP",
2902
+ "TUSD",
2903
+ "GUSD",
2904
+ "USDS",
2905
+ "LUSD",
2906
+ "BUSD",
2907
+ "USDE"
2908
+ ]);
2909
+ var EVM_ADDRESS_RE = /^0x[a-fA-F0-9]{40}$/;
2910
+ function resolveTokenDisplay(token, chain, fallback) {
2911
+ if (token !== void 0) {
2912
+ if (chain === "solana") {
2913
+ const solanaToken = getSolanaTokenByMint(token);
2914
+ if (solanaToken) {
2915
+ return { symbol: solanaToken.symbol, decimals: solanaToken.decimals };
2916
+ }
2917
+ } else if (EVM_ADDRESS_RE.test(token)) {
2918
+ const symbol = getTokenSymbol(token, chain);
2919
+ const decimals = findTokenDecimals(token, chain);
2920
+ if (symbol !== "Token" || decimals !== void 0) {
2921
+ return {
2922
+ symbol: symbol !== "Token" ? symbol : fallback?.symbol ?? symbol,
2923
+ decimals: decimals ?? fallback?.decimals
2924
+ };
2925
+ }
2926
+ }
2927
+ }
2928
+ return {
2929
+ symbol: fallback?.symbol ?? "Token",
2930
+ decimals: fallback?.decimals
2931
+ };
2932
+ }
2933
+ function maxFractionDigitsFor(symbol) {
2934
+ if (!symbol) return 6;
2935
+ return STABLECOIN_SYMBOLS.has(symbol.toUpperCase()) ? 3 : 6;
2936
+ }
2937
+ function formatTokenAmount(amount, symbol) {
2938
+ if (!Number.isFinite(amount)) return void 0;
2939
+ return amount.toLocaleString("en-US", {
2940
+ minimumFractionDigits: 2,
2941
+ maximumFractionDigits: maxFractionDigitsFor(symbol)
2942
+ });
2943
+ }
2944
+ function tokenAmountToNumber(rawAmount, decimals) {
2945
+ if (decimals === void 0) return void 0;
2946
+ try {
2947
+ const value = Number(formatUnits(BigInt(rawAmount), decimals));
2948
+ return Number.isFinite(value) ? value : void 0;
2949
+ } catch {
2950
+ return void 0;
2951
+ }
2952
+ }
2953
+ function formatRawTokenAmount(rawAmount, token) {
2954
+ const value = tokenAmountToNumber(rawAmount, token.decimals);
2955
+ if (value === void 0) return void 0;
2956
+ return formatTokenAmount(value, token.symbol);
2957
+ }
2958
+ function priceUsdFor(symbol, prices) {
2959
+ if (!symbol) return void 0;
2960
+ const upper = symbol.toUpperCase();
2961
+ const quoted = prices[upper];
2962
+ if (typeof quoted === "number" && quoted > 0) return quoted;
2963
+ return STABLECOIN_SYMBOLS.has(upper) ? 1 : void 0;
2964
+ }
2965
+ function estimateReceiveAmount(params) {
2966
+ const { sourceAmount, sourceSymbol, targetSymbol, sourceAmountUsd, prices } = params;
2967
+ if (sourceSymbol !== void 0 && sourceSymbol.toUpperCase() === targetSymbol.toUpperCase()) {
2968
+ return sourceAmount;
2969
+ }
2970
+ const usdValue = sourceAmountUsd !== void 0 && Number.isFinite(sourceAmountUsd) ? sourceAmountUsd : sourceAmount !== void 0 ? (() => {
2971
+ const sourcePrice = priceUsdFor(sourceSymbol, prices);
2972
+ return sourcePrice !== void 0 ? sourceAmount * sourcePrice : void 0;
2973
+ })() : void 0;
2974
+ if (usdValue === void 0) return void 0;
2975
+ const targetPrice = priceUsdFor(targetSymbol, prices);
2976
+ if (targetPrice === void 0) return void 0;
2977
+ return usdValue / targetPrice;
2978
+ }
2979
+ function formatReceiveEstimate(params) {
2980
+ const estimate = estimateReceiveAmount(params);
2981
+ if (estimate === void 0) return void 0;
2982
+ const formatted = formatTokenAmount(estimate, params.targetSymbol);
2983
+ if (formatted === void 0) return void 0;
2984
+ const sameSymbol = params.sourceSymbol.toUpperCase() === params.targetSymbol.toUpperCase();
2985
+ return sameSymbol ? `${formatted} ${params.targetSymbol}` : `~${formatted} ${params.targetSymbol}`;
2986
+ }
2987
+
2988
+ // src/core/useTokenPrices.ts
2989
+ import { useEffect as useEffect4, useState as useState4 } from "react";
2990
+ function useTokenPrices(service, symbols) {
2991
+ const [prices, setPrices] = useState4({});
2992
+ const symbolsKey = [
2993
+ ...new Set(
2994
+ symbols.filter((symbol) => Boolean(symbol)).map((symbol) => symbol.toUpperCase())
2995
+ )
2996
+ ].sort().join(",");
2997
+ useEffect4(() => {
2998
+ if (!symbolsKey) return;
2999
+ let cancelled = false;
3000
+ service.fetchPrices(symbolsKey.split(",")).then((result) => {
3001
+ if (!cancelled && result && Object.keys(result).length > 0) {
3002
+ setPrices(result);
3003
+ }
3004
+ }).catch(() => {
3005
+ });
3006
+ return () => {
3007
+ cancelled = true;
3008
+ };
3009
+ }, [service, symbolsKey]);
3010
+ return prices;
3011
+ }
3012
+
2873
3013
  // src/components/steps/ProcessingStep.tsx
2874
3014
  import { Fragment as Fragment4, jsx as jsx22, jsxs as jsxs20 } from "react/jsx-runtime";
2875
3015
  function SuccessBadge() {
@@ -2942,24 +3082,6 @@ var SOFT_DELAY_MS = {
2942
3082
  bridging: 4 * 60 * 1e3
2943
3083
  };
2944
3084
  var PHASE_TIMINGS_PREFIX = "rhinestone:phase-timings";
2945
- var STABLECOIN_SYMBOLS = /* @__PURE__ */ new Set([
2946
- "USDC",
2947
- "USDT",
2948
- "DAI",
2949
- "FRAX",
2950
- "PYUSD",
2951
- "USDP",
2952
- "TUSD",
2953
- "GUSD",
2954
- "USDS",
2955
- "LUSD",
2956
- "BUSD",
2957
- "USDE"
2958
- ]);
2959
- function maxFractionDigitsFor(symbol) {
2960
- if (!symbol) return 6;
2961
- return STABLECOIN_SYMBOLS.has(symbol.toUpperCase()) ? 3 : 6;
2962
- }
2963
3085
  var PAYMENT_METHOD_LABELS = {
2964
3086
  creditcard: "Card",
2965
3087
  debitcard: "Card",
@@ -3036,10 +3158,10 @@ function formatTimer(seconds) {
3036
3158
  return `${mins}:${String(secs).padStart(2, "0")}`;
3037
3159
  }
3038
3160
  function TickerChar({ value }) {
3039
- const [current, setCurrent] = useState4(value);
3040
- const [previous, setPrevious] = useState4(null);
3041
- const [animKey, setAnimKey] = useState4(0);
3042
- useEffect4(() => {
3161
+ const [current, setCurrent] = useState5(value);
3162
+ const [previous, setPrevious] = useState5(null);
3163
+ const [animKey, setAnimKey] = useState5(0);
3164
+ useEffect5(() => {
3043
3165
  if (value === current) return;
3044
3166
  setPrevious(current);
3045
3167
  setCurrent(value);
@@ -3129,11 +3251,11 @@ function ProcessingStep({
3129
3251
  const onDepositCompleteRef = useLatestRef(onDepositComplete);
3130
3252
  const onDepositFailedRef = useLatestRef(onDepositFailed);
3131
3253
  const onErrorRef = useLatestRef(onError);
3132
- const [state, setState] = useState4(
3254
+ const [state, setState] = useState5(
3133
3255
  directTransfer ? { type: "complete" } : { type: "processing" }
3134
3256
  );
3135
- const [elapsedSeconds, setElapsedSeconds] = useState4(0);
3136
- const [phaseTimings, setPhaseTimings] = useState4(() => {
3257
+ const [elapsedSeconds, setElapsedSeconds] = useState5(0);
3258
+ const [phaseTimings, setPhaseTimings] = useState5(() => {
3137
3259
  const saved = loadPhaseTimings(txHash);
3138
3260
  if (saved) {
3139
3261
  startTimeRef.current = saved.startedAt;
@@ -3141,7 +3263,7 @@ function ProcessingStep({
3141
3263
  }
3142
3264
  return { startedAt: startTimeRef.current };
3143
3265
  });
3144
- const [hasEscalatedDelay, setHasEscalatedDelay] = useState4(false);
3266
+ const [hasEscalatedDelay, setHasEscalatedDelay] = useState5(false);
3145
3267
  const updatePhaseTimings = useCallback3(
3146
3268
  (updater) => {
3147
3269
  setPhaseTimings((previous) => {
@@ -3152,7 +3274,7 @@ function ProcessingStep({
3152
3274
  },
3153
3275
  [txHash]
3154
3276
  );
3155
- useEffect4(() => {
3277
+ useEffect5(() => {
3156
3278
  if (!directTransfer) return;
3157
3279
  const completedAt = Date.now();
3158
3280
  updatePhaseTimings(() => ({
@@ -3183,7 +3305,7 @@ function ProcessingStep({
3183
3305
  txHash,
3184
3306
  updatePhaseTimings
3185
3307
  ]);
3186
- useEffect4(() => {
3308
+ useEffect5(() => {
3187
3309
  if (directTransfer || state.type !== "processing") return;
3188
3310
  const updateElapsed = () => {
3189
3311
  setElapsedSeconds(
@@ -3194,7 +3316,7 @@ function ProcessingStep({
3194
3316
  const intervalId = setInterval(updateElapsed, 1e3);
3195
3317
  return () => clearInterval(intervalId);
3196
3318
  }, [directTransfer, state.type]);
3197
- useEffect4(() => {
3319
+ useEffect5(() => {
3198
3320
  if (state.type === "processing") return;
3199
3321
  const endedAt = state.type === "complete" ? phaseTimings.completedAt ?? Date.now() : Date.now();
3200
3322
  setElapsedSeconds(Math.floor((endedAt - startTimeRef.current) / 1e3));
@@ -3202,14 +3324,14 @@ function ProcessingStep({
3202
3324
  (previous) => previous.endedAt !== void 0 ? previous : { ...previous, endedAt }
3203
3325
  );
3204
3326
  }, [phaseTimings.completedAt, state.type, updatePhaseTimings]);
3205
- useEffect4(() => {
3327
+ useEffect5(() => {
3206
3328
  if (!state.lastEvent) return;
3207
3329
  updatePhaseTimings(
3208
3330
  (previous) => syncPhaseTimings(previous, state.lastEvent)
3209
3331
  );
3210
3332
  }, [state.lastEvent?.time, state.lastEvent?.type, updatePhaseTimings]);
3211
- const [swappedFiatContext, setSwappedFiatContext] = useState4(null);
3212
- useEffect4(() => {
3333
+ const [swappedFiatContext, setSwappedFiatContext] = useState5(null);
3334
+ useEffect5(() => {
3213
3335
  let cancelled = false;
3214
3336
  service.fetchSwappedOrderStatus(smartAccount).then((res) => {
3215
3337
  if (cancelled || !res) return;
@@ -3230,7 +3352,7 @@ function ProcessingStep({
3230
3352
  cancelled = true;
3231
3353
  };
3232
3354
  }, [service, smartAccount, txHash, isSwappedOrder]);
3233
- useEffect4(() => {
3355
+ useEffect5(() => {
3234
3356
  if (directTransfer) return;
3235
3357
  if (state.type !== "processing") {
3236
3358
  pollIntervalRef.current = INITIAL_POLL_INTERVAL;
@@ -3390,7 +3512,7 @@ function ProcessingStep({
3390
3512
  state.type,
3391
3513
  txHash
3392
3514
  ]);
3393
- useEffect4(() => {
3515
+ useEffect5(() => {
3394
3516
  if (directTransfer || state.type !== "processing") return;
3395
3517
  const timeoutId = setTimeout(() => {
3396
3518
  if (escalatedDelayRef.current) return;
@@ -3421,82 +3543,71 @@ function ProcessingStep({
3421
3543
  const displayAmount = sourceDetails.amount ?? amount;
3422
3544
  const sourceExplorerUrl = getExplorerTxUrl(displaySourceChain, txHash);
3423
3545
  const destExplorerUrl = destinationTxHash ? getExplorerTxUrl(targetChain, destinationTxHash) : null;
3424
- const isEvmSourceToken = /^0x[a-fA-F0-9]{40}$/.test(displaySourceToken);
3425
- const sourceSymbol = displaySourceChain === "solana" ? providedSourceSymbol ?? "SOL" : isEvmSourceToken ? getTokenSymbol(displaySourceToken, displaySourceChain) : providedSourceSymbol ?? "Token";
3426
- const sourceDecimals = displaySourceChain === "solana" ? providedSourceDecimals ?? 9 : isEvmSourceToken ? getTokenDecimalsByAddress(
3427
- displaySourceToken,
3428
- displaySourceChain
3429
- ) : providedSourceDecimals ?? 18;
3430
- const amountMaxDigits = maxFractionDigitsFor(sourceSymbol);
3431
- const formattedReceivedAmount = (() => {
3432
- try {
3433
- const raw = formatUnits(BigInt(displayAmount), sourceDecimals);
3434
- const numeric = Number(raw);
3435
- if (!Number.isFinite(numeric)) return raw;
3436
- return numeric.toLocaleString("en-US", {
3437
- minimumFractionDigits: 2,
3438
- maximumFractionDigits: amountMaxDigits
3439
- });
3440
- } catch {
3441
- return Number(displayAmount).toLocaleString("en-US", {
3442
- minimumFractionDigits: 2,
3443
- maximumFractionDigits: amountMaxDigits
3444
- });
3445
- }
3546
+ const sourceDisplay = (() => {
3547
+ const resolved = resolveTokenDisplay(displaySourceToken, displaySourceChain, {
3548
+ symbol: providedSourceSymbol ?? (displaySourceChain === "solana" ? "SOL" : "Token"),
3549
+ decimals: providedSourceDecimals
3550
+ });
3551
+ return {
3552
+ symbol: resolved.symbol,
3553
+ decimals: resolved.decimals ?? (displaySourceChain === "solana" ? 9 : 18)
3554
+ };
3446
3555
  })();
3447
- const destinationAmountRaw = (() => {
3448
- const dest = lastEvent?.data?.destination;
3449
- if (!dest || dest.amount === void 0) return void 0;
3450
- try {
3451
- return BigInt(dest.amount);
3452
- } catch {
3453
- return void 0;
3454
- }
3556
+ const sourceSymbol = sourceDisplay.symbol;
3557
+ const formattedSentAmount = formatRawTokenAmount(displayAmount, sourceDisplay) ?? // Not raw base units (e.g. a decimal string) — render the number as-is.
3558
+ formatTokenAmount(Number(displayAmount), sourceDisplay.symbol) ?? displayAmount;
3559
+ const isBridgeHopDestination = hasPostBridgeActions && (lastEvent?.type === "bridge-started" || lastEvent?.type === "bridge-complete");
3560
+ const eventDestination = isBridgeHopDestination ? {} : getEventDestinationDetails(lastEvent);
3561
+ const targetDisplay = resolveTokenDisplay(
3562
+ eventDestination.token ?? targetToken,
3563
+ eventDestination.chainId ?? targetChain,
3564
+ // Dapp deposits default to USDC targets; mirror the source symbol last so
3565
+ // unresolvable same-token routes still label sensibly.
3566
+ { symbol: providedSourceSymbol ?? "USDC" }
3567
+ );
3568
+ const targetSymbol = targetDisplay.symbol;
3569
+ const formattedDestinationAmount = eventDestination.amount !== void 0 ? formatRawTokenAmount(eventDestination.amount, targetDisplay) : void 0;
3570
+ const amountUsdNumber = amountUsd !== void 0 && Number(amountUsd) > 0 ? Number(amountUsd) : void 0;
3571
+ const prices = useTokenPrices(service, [
3572
+ sourceDisplay.symbol,
3573
+ targetDisplay.symbol
3574
+ ]);
3575
+ const estimatedReceiveAmount = (() => {
3576
+ const estimate = estimateReceiveAmount({
3577
+ sourceAmount: tokenAmountToNumber(displayAmount, sourceDisplay.decimals),
3578
+ sourceSymbol: sourceDisplay.symbol,
3579
+ targetSymbol: targetDisplay.symbol,
3580
+ sourceAmountUsd: amountUsdNumber,
3581
+ prices
3582
+ });
3583
+ return estimate !== void 0 ? formatTokenAmount(estimate, targetDisplay.symbol) : void 0;
3455
3584
  })();
3456
- const sourceAmountRaw = (() => {
3457
- try {
3458
- return BigInt(displayAmount);
3459
- } catch {
3585
+ const receiveDisplay = formattedDestinationAmount ? `${formattedDestinationAmount} ${targetSymbol}` : estimatedReceiveAmount !== void 0 ? `~${estimatedReceiveAmount} ${targetSymbol}` : amountUsdNumber !== void 0 ? `~$${amountUsdNumber.toFixed(2)}` : (
3586
+ // Cross-token with no price and no USD context (rare QR case):
3587
+ // an honest dash beats a wrong number.
3588
+ "\u2014"
3589
+ );
3590
+ const formattedBridgingCost = (() => {
3591
+ if (sourceSymbol.toUpperCase() !== targetSymbol.toUpperCase()) {
3460
3592
  return void 0;
3461
3593
  }
3462
- })();
3463
- const bridgingCostRaw = sourceAmountRaw !== void 0 && destinationAmountRaw !== void 0 && sourceAmountRaw > destinationAmountRaw ? sourceAmountRaw - destinationAmountRaw : void 0;
3464
- const formattedDestinationAmount = destinationAmountRaw !== void 0 ? (() => {
3465
- try {
3466
- const raw = formatUnits(destinationAmountRaw, sourceDecimals);
3467
- const numeric = Number(raw);
3468
- if (!Number.isFinite(numeric)) return raw;
3469
- return numeric.toLocaleString("en-US", {
3470
- minimumFractionDigits: 2,
3471
- maximumFractionDigits: amountMaxDigits
3472
- });
3473
- } catch {
3594
+ const sentValue = tokenAmountToNumber(displayAmount, sourceDisplay.decimals);
3595
+ const receivedValue = eventDestination.amount !== void 0 ? tokenAmountToNumber(eventDestination.amount, targetDisplay.decimals) : void 0;
3596
+ if (sentValue === void 0 || receivedValue === void 0 || sentValue <= receivedValue) {
3474
3597
  return void 0;
3475
3598
  }
3476
- })() : void 0;
3477
- const formattedBridgingCost = bridgingCostRaw !== void 0 ? (() => {
3478
- try {
3479
- const raw = formatUnits(bridgingCostRaw, sourceDecimals);
3480
- const numeric = Number(raw);
3481
- if (!Number.isFinite(numeric)) return raw;
3482
- return numeric.toLocaleString("en-US", {
3483
- minimumFractionDigits: 2,
3484
- maximumFractionDigits: amountMaxDigits
3485
- });
3486
- } catch {
3599
+ const formatted = formatTokenAmount(sentValue - receivedValue, sourceSymbol);
3600
+ if (formatted === void 0 || Number(formatted.replace(/,/g, "")) === 0) {
3487
3601
  return void 0;
3488
3602
  }
3489
- })() : void 0;
3603
+ return formatted;
3604
+ })();
3490
3605
  const currentPhaseId = getCurrentPhaseId(state, phaseTimings);
3491
3606
  const activePhaseStartedAt = currentPhaseId ? getPhaseStartTime(currentPhaseId, phaseTimings) : void 0;
3492
3607
  const activePhaseElapsedMs = isProcessing && activePhaseStartedAt !== void 0 ? timelineNowMs - activePhaseStartedAt : 0;
3493
3608
  const delayPhaseId = isProcessing && currentPhaseId && activePhaseElapsedMs >= SOFT_DELAY_MS[currentPhaseId] ? currentPhaseId : void 0;
3494
3609
  void delayPhaseId;
3495
3610
  void hasEscalatedDelay;
3496
- const targetSymbol = (() => {
3497
- const resolved = getTargetTokenSymbol(targetToken, targetChain);
3498
- return resolved !== "Token" ? resolved : providedSourceSymbol ?? "USDC";
3499
- })();
3500
3611
  const targetTokenIcon = getTokenIcon(targetSymbol);
3501
3612
  const sourceChainIcon = getChainIcon(displaySourceChain);
3502
3613
  const targetChainIcon = getChainIcon(targetChain);
@@ -3518,7 +3629,7 @@ function ProcessingStep({
3518
3629
  if (isComplete && isSwappedOrder) {
3519
3630
  const onrampMethod = swappedFiatContext?.paymentMethod ? formatPaymentMethod(swappedFiatContext.paymentMethod) : null;
3520
3631
  const amountPaid = swappedFiatContext?.paidAmountUsd != null ? `$${swappedFiatContext.paidAmountUsd.toFixed(2)}` : null;
3521
- const depositedAmount = formattedDestinationAmount ? `${formattedDestinationAmount} ${targetSymbol}` : `~${formattedReceivedAmount} ${targetSymbol}`;
3632
+ const depositedAmount = receiveDisplay;
3522
3633
  const onrampFeeUsd = swappedFiatContext?.onrampFeeUsd ?? null;
3523
3634
  const networkFeeUsd = quotedFeeAmount !== void 0 && Number.isFinite(Number(quotedFeeAmount)) ? Number(quotedFeeAmount) : null;
3524
3635
  const feeRows = [];
@@ -3629,7 +3740,7 @@ function ProcessingStep({
3629
3740
  /* @__PURE__ */ jsx22("span", { children: isProcessing ? "You send" : "You sent" }),
3630
3741
  /* @__PURE__ */ jsxs20("span", { className: "rs-review-detail-value", children: [
3631
3742
  /* @__PURE__ */ jsxs20("span", { children: [
3632
- formattedReceivedAmount,
3743
+ formattedSentAmount,
3633
3744
  " ",
3634
3745
  sourceSymbol
3635
3746
  ] }),
@@ -3639,7 +3750,7 @@ function ProcessingStep({
3639
3750
  /* @__PURE__ */ jsxs20("div", { className: "rs-review-detail-row", children: [
3640
3751
  /* @__PURE__ */ jsx22("span", { children: isProcessing ? "Receive" : "Received" }),
3641
3752
  /* @__PURE__ */ jsxs20("span", { className: "rs-review-detail-value", children: [
3642
- /* @__PURE__ */ jsx22("span", { children: formattedDestinationAmount ? `${formattedDestinationAmount} ${targetSymbol}` : `~${formattedReceivedAmount} ${targetSymbol}` }),
3753
+ /* @__PURE__ */ jsx22("span", { children: receiveDisplay }),
3643
3754
  targetTokenIcon && /* @__PURE__ */ jsx22("span", { className: "rs-review-detail-icon", children: /* @__PURE__ */ jsx22("img", { src: targetTokenIcon, alt: "" }) })
3644
3755
  ] })
3645
3756
  ] }),
@@ -3818,12 +3929,15 @@ export {
3818
3929
  isUnsupportedChainSwitchError,
3819
3930
  formatUserError,
3820
3931
  Tooltip,
3932
+ formatTokenAmount,
3933
+ formatReceiveEstimate,
3821
3934
  getEventTxHash,
3822
3935
  getEventSourceDetails,
3823
3936
  isDepositEvent,
3824
3937
  isFailedEvent,
3825
3938
  txRefsMatch,
3826
3939
  failureMessageForEvent,
3940
+ useTokenPrices,
3827
3941
  ProcessingStep,
3828
3942
  getPublicClient,
3829
3943
  getHyperEvmReadClient,
@@ -1,6 +1,6 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _chunkAJHFNHG3cjs = require('./chunk-AJHFNHG3.cjs');
3
+ var _chunkUEKPBRBYcjs = require('./chunk-UEKPBRBY.cjs');
4
4
 
5
5
  // src/core/dapp-imports/polymarket/constants.ts
6
6
  var POLYMARKET_POLYGON_CHAIN_ID = 137;
@@ -100,7 +100,7 @@ async function executePolymarketSafeTransfer(params) {
100
100
  }
101
101
  const isOwner = await publicClient.readContract({
102
102
  address: safeAddress,
103
- abi: _chunkAJHFNHG3cjs.SAFE_ABI,
103
+ abi: _chunkUEKPBRBYcjs.SAFE_ABI,
104
104
  functionName: "isOwner",
105
105
  args: [account.address]
106
106
  });
@@ -117,7 +117,7 @@ async function executePolymarketSafeTransfer(params) {
117
117
  account,
118
118
  chain,
119
119
  address: safeAddress,
120
- abi: _chunkAJHFNHG3cjs.SAFE_ABI,
120
+ abi: _chunkUEKPBRBYcjs.SAFE_ABI,
121
121
  functionName: "execTransaction",
122
122
  args: [
123
123
  safeTx.to,
@@ -136,7 +136,7 @@ async function executePolymarketSafeTransfer(params) {
136
136
  hash: txHash
137
137
  });
138
138
  const parsed = _viem.parseEventLogs.call(void 0, {
139
- abi: _chunkAJHFNHG3cjs.SAFE_ABI,
139
+ abi: _chunkUEKPBRBYcjs.SAFE_ABI,
140
140
  logs: receipt.logs.filter(
141
141
  (log) => log.address.toLowerCase() === safeAddress.toLowerCase()
142
142
  ),