@rhinestone/deposit-modal 0.5.0 → 0.6.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.
@@ -414,15 +414,12 @@ function depositRowToEvent(row) {
414
414
  const time = row.completedAt ?? row.createdAt ?? void 0;
415
415
  if (status === "completed") {
416
416
  return {
417
- type: "post-bridge-swap-complete",
417
+ type: "bridge-complete",
418
418
  time: time ?? void 0,
419
419
  data: {
420
420
  deposit,
421
421
  source,
422
- ...destination && { destination },
423
- ...destination && {
424
- swap: { transactionHash: destination.transactionHash }
425
- }
422
+ ...destination && { destination }
426
423
  }
427
424
  };
428
425
  }
@@ -541,15 +538,18 @@ function createDepositService(baseUrl, options) {
541
538
  }
542
539
  const PORTFOLIO_CACHE_TTL_MS = 3e4;
543
540
  const portfolioCache = /* @__PURE__ */ new Map();
544
- function cachedPortfolio(key, fetcher) {
541
+ function cachedPortfolio(key, fetcher, forceRefresh = false) {
545
542
  const now = Date.now();
546
543
  const entry = portfolioCache.get(key);
547
- if (entry && entry.expiresAt > now) {
544
+ if (!forceRefresh && entry && entry.expiresAt > now) {
548
545
  debugLog(debug, scope, "portfolio:cache-hit", { key });
549
546
  return entry.promise;
550
547
  }
551
- const promise = fetcher().catch((err) => {
552
- portfolioCache.delete(key);
548
+ let promise;
549
+ promise = fetcher().catch((err) => {
550
+ if (portfolioCache.get(key)?.promise === promise) {
551
+ portfolioCache.delete(key);
552
+ }
553
553
  throw err;
554
554
  });
555
555
  portfolioCache.set(key, {
@@ -567,7 +567,6 @@ function createDepositService(baseUrl, options) {
567
567
  targetChain: params.targetChain,
568
568
  targetToken: params.targetToken,
569
569
  recipient: params.recipient ? shortRef(params.recipient) : void 0,
570
- postBridgeActionCount: params.postBridgeActions?.length ?? 0,
571
570
  forceRegister: params.forceRegister
572
571
  });
573
572
  const response = await fetch(url, {
@@ -641,7 +640,7 @@ function createDepositService(baseUrl, options) {
641
640
  });
642
641
  return result;
643
642
  },
644
- async fetchPortfolio(address) {
643
+ async fetchPortfolio(address, options2) {
645
644
  return cachedPortfolio(`evm:${address.toLowerCase()}`, async () => {
646
645
  const url = apiUrl(`/portfolio/${address}`);
647
646
  debugLog(debug, scope, "fetchPortfolio:request", { url, address });
@@ -686,9 +685,9 @@ function createDepositService(baseUrl, options) {
686
685
  }
687
686
  debugLog(debug, scope, "fetchPortfolio:empty", { address });
688
687
  return { tokens: [], totalUsd: 0 };
689
- });
688
+ }, options2?.forceRefresh);
690
689
  },
691
- async fetchSolanaPortfolio(address) {
690
+ async fetchSolanaPortfolio(address, options2) {
692
691
  return cachedPortfolio(`sol:${address}`, async () => {
693
692
  const url = apiUrl(`/portfolio/solana/${address}`);
694
693
  debugLog(debug, scope, "fetchSolanaPortfolio:request", { url, address });
@@ -717,7 +716,7 @@ function createDepositService(baseUrl, options) {
717
716
  totalUsd: normalized.totalUsd
718
717
  });
719
718
  return normalized;
720
- });
719
+ }, options2?.forceRefresh);
721
720
  },
722
721
  async checkAccount(address) {
723
722
  const url = apiUrl(`/check/${address}`);
@@ -1396,7 +1395,7 @@ function formatUserError(raw) {
1396
1395
  }
1397
1396
 
1398
1397
  // src/core/rpc.ts
1399
- import { createContext, useContext } from "react";
1398
+ import { createContext, useContext, useMemo } from "react";
1400
1399
  function rpcUrlFor(rpcUrls, chain) {
1401
1400
  const url = rpcUrls?.[chain]?.trim();
1402
1401
  return url ? url : void 0;
@@ -1406,6 +1405,14 @@ var RpcUrlsProvider = RpcUrlsContext.Provider;
1406
1405
  function useRpcUrls() {
1407
1406
  return useContext(RpcUrlsContext);
1408
1407
  }
1408
+ function rpcUrlsKey(rpcUrls) {
1409
+ if (!rpcUrls) return "";
1410
+ return Object.entries(rpcUrls).map(([chain, url]) => [chain, url?.trim() ?? ""]).filter(([, url]) => url !== "").map(([chain, url]) => `${chain}=${url}`).sort().join("|");
1411
+ }
1412
+ function useStableRpcUrls(rpcUrls) {
1413
+ const key = rpcUrlsKey(rpcUrls);
1414
+ return useMemo(() => rpcUrls, [key]);
1415
+ }
1409
1416
 
1410
1417
  // src/core/public-client.ts
1411
1418
  import { createPublicClient, http } from "viem";
@@ -1728,7 +1735,7 @@ function Spinner({ className }) {
1728
1735
  }
1729
1736
 
1730
1737
  // src/components/steps/ConnectStep.tsx
1731
- import { useState } from "react";
1738
+ import { useEffect as useEffect3, useState } from "react";
1732
1739
 
1733
1740
  // src/components/ui/ListRow.tsx
1734
1741
  import { Fragment, jsx as jsx7, jsxs as jsxs6 } from "react/jsx-runtime";
@@ -2332,6 +2339,24 @@ function formatBalanceUsd(value) {
2332
2339
  if (!Number.isFinite(value) || value <= 0) return "$0.00";
2333
2340
  return `$${value.toFixed(2)}`;
2334
2341
  }
2342
+ function rankUsd(value) {
2343
+ return typeof value === "number" && Number.isFinite(value) && value > 0 ? value : 0;
2344
+ }
2345
+ function rankCryptoRows(descriptors) {
2346
+ return descriptors.map((descriptor, index) => ({ descriptor, index })).sort((a, b) => {
2347
+ const first = a.descriptor;
2348
+ const second = b.descriptor;
2349
+ if (first.isBalanceSource !== second.isBalanceSource) {
2350
+ return first.isBalanceSource ? -1 : 1;
2351
+ }
2352
+ if (!first.isBalanceSource) return a.index - b.index;
2353
+ if (first.resolved !== second.resolved) return first.resolved ? -1 : 1;
2354
+ if (first.resolved && first.balanceUsd !== second.balanceUsd) {
2355
+ return second.balanceUsd - first.balanceUsd;
2356
+ }
2357
+ return a.index - b.index;
2358
+ }).map(({ descriptor }) => descriptor.node);
2359
+ }
2335
2360
  function fiatIcon(name) {
2336
2361
  if (name === "apple") return /* @__PURE__ */ jsx18(AppleIcon, {});
2337
2362
  if (name === "bank") return /* @__PURE__ */ jsx18(BankIcon, {});
@@ -2389,6 +2414,7 @@ function ConnectStep({
2389
2414
  onSelectPayWithCard,
2390
2415
  fiatPaymentMethods,
2391
2416
  onSelectFiatMethod,
2417
+ onPrefetchFiatMethod,
2392
2418
  onSelectFundFromExchange,
2393
2419
  onRequestConnect,
2394
2420
  onConnect,
@@ -2406,9 +2432,21 @@ function ConnectStep({
2406
2432
  );
2407
2433
  const showDappImports = (dappImports?.length ?? 0) > 0;
2408
2434
  const defaultSubtitle = onSelectTransferCrypto ? "Add money to your balance" : "Choose a wallet to continue";
2409
- const cryptoRows = [];
2435
+ const cryptoDescriptors = [];
2436
+ const pushAction = (node) => cryptoDescriptors.push({
2437
+ node,
2438
+ isBalanceSource: false,
2439
+ resolved: false,
2440
+ balanceUsd: 0
2441
+ });
2442
+ const pushBalanceSource = (node, resolved, balanceUsd) => cryptoDescriptors.push({
2443
+ node,
2444
+ isBalanceSource: true,
2445
+ resolved,
2446
+ balanceUsd: rankUsd(balanceUsd)
2447
+ });
2410
2448
  if (onSelectTransferCrypto) {
2411
- cryptoRows.push(
2449
+ pushAction(
2412
2450
  /* @__PURE__ */ jsx18(
2413
2451
  ListRow,
2414
2452
  {
@@ -2424,8 +2462,8 @@ function ConnectStep({
2424
2462
  }
2425
2463
  for (const row of rows) {
2426
2464
  const collapseToExternal = Boolean(onSelectTransferCrypto) && row.kind !== "solana";
2427
- const subtitleText = row.state === "loading" ? "Preparing\u2026" : row.state === "error" ? row.errorReason ?? "Couldn't prepare wallet \u2014 tap to retry" : shorten(row.address);
2428
- cryptoRows.push(
2465
+ const subtitleText = row.state === "loading" ? "Preparing\u2026" : row.state === "error" ? row.errorReason ?? "Couldn't prepare wallet \u2014 tap to retry" : row.balanceStatus === "ready" && row.balanceUsd != null ? formatBalanceUsd(row.balanceUsd) : row.balanceStatus === "loading" ? "Checking balance\u2026" : shorten(row.address);
2466
+ pushBalanceSource(
2429
2467
  /* @__PURE__ */ jsx18(
2430
2468
  ListRow,
2431
2469
  {
@@ -2437,11 +2475,13 @@ function ConnectStep({
2437
2475
  trailing: renderRowTrailing(row.state)
2438
2476
  },
2439
2477
  row.id
2440
- )
2478
+ ),
2479
+ row.balanceStatus === "ready",
2480
+ row.balanceUsd ?? 0
2441
2481
  );
2442
2482
  }
2443
2483
  if (!hasReownWallet && handleConnect) {
2444
- cryptoRows.push(
2484
+ pushAction(
2445
2485
  /* @__PURE__ */ jsx18(
2446
2486
  ListRow,
2447
2487
  {
@@ -2456,7 +2496,7 @@ function ConnectStep({
2456
2496
  );
2457
2497
  }
2458
2498
  if (onSelectFundFromExchange) {
2459
- cryptoRows.push(
2499
+ pushAction(
2460
2500
  /* @__PURE__ */ jsx18(
2461
2501
  ListRow,
2462
2502
  {
@@ -2473,7 +2513,7 @@ function ConnectStep({
2473
2513
  if (showDappImports) {
2474
2514
  for (const row of dappImports ?? []) {
2475
2515
  if (!hasReownWallet) {
2476
- cryptoRows.push(
2516
+ pushBalanceSource(
2477
2517
  /* @__PURE__ */ jsx18(
2478
2518
  ListRow,
2479
2519
  {
@@ -2484,12 +2524,14 @@ function ConnectStep({
2484
2524
  disabled: !handleConnect
2485
2525
  },
2486
2526
  row.id
2487
- )
2527
+ ),
2528
+ false,
2529
+ 0
2488
2530
  );
2489
2531
  continue;
2490
2532
  }
2491
2533
  if (row.status === "loading" || row.status === "needs-connect") {
2492
- cryptoRows.push(
2534
+ pushBalanceSource(
2493
2535
  /* @__PURE__ */ jsx18(
2494
2536
  ListRow,
2495
2537
  {
@@ -2500,12 +2542,14 @@ function ConnectStep({
2500
2542
  trailing: SMALL_SPINNER
2501
2543
  },
2502
2544
  row.id
2503
- )
2545
+ ),
2546
+ false,
2547
+ 0
2504
2548
  );
2505
2549
  continue;
2506
2550
  }
2507
2551
  if (row.status.enabled) {
2508
- cryptoRows.push(
2552
+ pushBalanceSource(
2509
2553
  /* @__PURE__ */ jsx18(
2510
2554
  ListRow,
2511
2555
  {
@@ -2515,12 +2559,14 @@ function ConnectStep({
2515
2559
  onClick: () => onSelectDappImport?.(row.id)
2516
2560
  },
2517
2561
  row.id
2518
- )
2562
+ ),
2563
+ true,
2564
+ row.status.balanceUsd
2519
2565
  );
2520
2566
  continue;
2521
2567
  }
2522
2568
  if (row.status.retryable) {
2523
- cryptoRows.push(
2569
+ pushBalanceSource(
2524
2570
  /* @__PURE__ */ jsx18(
2525
2571
  ListRow,
2526
2572
  {
@@ -2530,11 +2576,13 @@ function ConnectStep({
2530
2576
  onClick: () => onSelectDappImport?.(row.id)
2531
2577
  },
2532
2578
  row.id
2533
- )
2579
+ ),
2580
+ false,
2581
+ 0
2534
2582
  );
2535
2583
  continue;
2536
2584
  }
2537
- cryptoRows.push(
2585
+ pushBalanceSource(
2538
2586
  /* @__PURE__ */ jsx18(
2539
2587
  ListRow,
2540
2588
  {
@@ -2544,10 +2592,13 @@ function ConnectStep({
2544
2592
  disabled: true
2545
2593
  },
2546
2594
  row.id
2547
- )
2595
+ ),
2596
+ false,
2597
+ 0
2548
2598
  );
2549
2599
  }
2550
2600
  }
2601
+ const cryptoRows = rankCryptoRows(cryptoDescriptors);
2551
2602
  const cashRows = [];
2552
2603
  if (fiatPaymentMethods && fiatPaymentMethods.length > 0 && onSelectFiatMethod) {
2553
2604
  for (const opt of fiatPaymentMethods) {
@@ -2586,6 +2637,14 @@ function ConnectStep({
2586
2637
  const [tab, setTab] = useState(defaultMethodTab);
2587
2638
  const activeTab = showToggle ? tab : hasCash && !hasCrypto ? "cash" : "crypto";
2588
2639
  const activeRows = activeTab === "cash" ? cashRows : cryptoRows;
2640
+ useEffect3(() => {
2641
+ if (activeTab !== "cash" || !onPrefetchFiatMethod || !fiatPaymentMethods) {
2642
+ return;
2643
+ }
2644
+ for (const opt of fiatPaymentMethods) {
2645
+ onPrefetchFiatMethod(opt.method);
2646
+ }
2647
+ }, [activeTab, onPrefetchFiatMethod, fiatPaymentMethods]);
2589
2648
  return /* @__PURE__ */ jsxs16("div", { className: "rs-screen", children: [
2590
2649
  /* @__PURE__ */ jsxs16("div", { className: "rs-screen-body rs-screen-body--gap-32", children: [
2591
2650
  /* @__PURE__ */ jsx18(
@@ -2625,7 +2684,7 @@ function ConnectStep({
2625
2684
  ConnectStep.displayName = "ConnectStep";
2626
2685
 
2627
2686
  // src/components/steps/ProcessingStep.tsx
2628
- import { useCallback as useCallback3, useEffect as useEffect5, useRef as useRef4, useState as useState5 } from "react";
2687
+ import { useCallback as useCallback3, useEffect as useEffect6, useRef as useRef4, useState as useState5 } from "react";
2629
2688
 
2630
2689
  // src/components/ui/Button.tsx
2631
2690
  import { Fragment as Fragment3, jsx as jsx19, jsxs as jsxs17 } from "react/jsx-runtime";
@@ -2671,7 +2730,7 @@ Button.displayName = "Button";
2671
2730
  import {
2672
2731
  useState as useState2,
2673
2732
  useRef as useRef3,
2674
- useEffect as useEffect3,
2733
+ useEffect as useEffect4,
2675
2734
  useCallback as useCallback2
2676
2735
  } from "react";
2677
2736
  import { createPortal as createPortal2 } from "react-dom";
@@ -2690,7 +2749,7 @@ function Tooltip({ content, children, className }) {
2690
2749
  left: rect.left + rect.width / 2
2691
2750
  });
2692
2751
  }, []);
2693
- useEffect3(() => {
2752
+ useEffect4(() => {
2694
2753
  if (!open) return;
2695
2754
  updatePosition();
2696
2755
  function handleOutside(event) {
@@ -2897,10 +2956,6 @@ function getEventTxHash(event) {
2897
2956
  const source = isRecord(event.data?.source) ? event.data.source : void 0;
2898
2957
  return asString(deposit?.transactionHash) ?? asString(source?.transactionHash);
2899
2958
  }
2900
- if (event.type === "post-bridge-swap-complete" || event.type === "post-bridge-swap-failed") {
2901
- const deposit = isRecord(event.data?.deposit) ? event.data.deposit : void 0;
2902
- return asString(deposit?.transactionHash);
2903
- }
2904
2959
  return void 0;
2905
2960
  }
2906
2961
  function getEventSourceDetails(event) {
@@ -2914,7 +2969,7 @@ function getEventSourceDetails(event) {
2914
2969
  }
2915
2970
  const source = isRecord(event.data.source) ? event.data.source : void 0;
2916
2971
  const deposit = isRecord(event.data.deposit) ? event.data.deposit : void 0;
2917
- if (event.type === "bridge-started" || event.type === "bridge-complete" || event.type === "bridge-failed" || event.type === "error" || event.type === "post-bridge-swap-complete" || event.type === "post-bridge-swap-failed") {
2972
+ if (event.type === "bridge-started" || event.type === "bridge-complete" || event.type === "bridge-failed" || event.type === "error") {
2918
2973
  return {
2919
2974
  chainId: asNumber(source?.chain) ?? asNumber(deposit?.chain),
2920
2975
  amount: asAmount(source?.amount) ?? asAmount(deposit?.amount),
@@ -2931,7 +2986,7 @@ function asChain(value) {
2931
2986
  }
2932
2987
  function getEventDestinationDetails(event) {
2933
2988
  if (!event?.type || !isRecord(event.data)) return {};
2934
- if (event.type !== "bridge-started" && event.type !== "bridge-complete" && event.type !== "post-bridge-swap-complete") {
2989
+ if (event.type !== "bridge-started" && event.type !== "bridge-complete") {
2935
2990
  return {};
2936
2991
  }
2937
2992
  const destination = isRecord(event.data.destination) ? event.data.destination : void 0;
@@ -2944,10 +2999,10 @@ function getEventDestinationDetails(event) {
2944
2999
  };
2945
3000
  }
2946
3001
  function isDepositEvent(event) {
2947
- 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";
3002
+ return event?.type === "deposit-received" || event?.type === "bridge-started" || event?.type === "bridge-complete" || event?.type === "bridge-failed" || event?.type === "error";
2948
3003
  }
2949
3004
  function isFailedEvent(event) {
2950
- return event?.type === "bridge-failed" || event?.type === "post-bridge-swap-failed" || event?.type === "error";
3005
+ return event?.type === "bridge-failed" || event?.type === "error";
2951
3006
  }
2952
3007
  function isHexString(value) {
2953
3008
  return value.startsWith("0x") || value.startsWith("0X");
@@ -3108,7 +3163,7 @@ function formatReceiveEstimate(params) {
3108
3163
  }
3109
3164
 
3110
3165
  // src/core/useTokenPrices.ts
3111
- import { useEffect as useEffect4, useState as useState4 } from "react";
3166
+ import { useEffect as useEffect5, useState as useState4 } from "react";
3112
3167
  function useTokenPrices(service, symbols) {
3113
3168
  const [prices, setPrices] = useState4({});
3114
3169
  const symbolsKey = [
@@ -3116,7 +3171,7 @@ function useTokenPrices(service, symbols) {
3116
3171
  symbols.filter((symbol) => Boolean(symbol)).map((symbol) => symbol.toUpperCase())
3117
3172
  )
3118
3173
  ].sort().join(",");
3119
- useEffect4(() => {
3174
+ useEffect5(() => {
3120
3175
  if (!symbolsKey) return;
3121
3176
  let cancelled = false;
3122
3177
  service.fetchPrices(symbolsKey.split(",")).then((result) => {
@@ -3262,9 +3317,9 @@ function parseWebhookTimestamp(event) {
3262
3317
  function syncPhaseTimings(previous, event) {
3263
3318
  if (!event?.type) return previous;
3264
3319
  const timestamp = parseWebhookTimestamp(event) ?? Date.now();
3265
- const setReceived = (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") && previous.receivedAt === void 0;
3266
- const setBridging = (event.type === "bridge-started" || event.type === "bridge-complete" || event.type === "post-bridge-swap-complete") && previous.bridgingAt === void 0;
3267
- const setCompleted = (event.type === "bridge-complete" || event.type === "post-bridge-swap-complete") && previous.completedAt === void 0;
3320
+ const setReceived = (event.type === "deposit-received" || event.type === "bridge-started" || event.type === "bridge-complete" || event.type === "bridge-failed" || event.type === "error") && previous.receivedAt === void 0;
3321
+ const setBridging = (event.type === "bridge-started" || event.type === "bridge-complete") && previous.bridgingAt === void 0;
3322
+ const setCompleted = event.type === "bridge-complete" && previous.completedAt === void 0;
3268
3323
  if (!setReceived && !setBridging && !setCompleted) return previous;
3269
3324
  return {
3270
3325
  ...previous,
@@ -3283,7 +3338,7 @@ function TickerChar({ value }) {
3283
3338
  const [current, setCurrent] = useState5(value);
3284
3339
  const [previous, setPrevious] = useState5(null);
3285
3340
  const [animKey, setAnimKey] = useState5(0);
3286
- useEffect5(() => {
3341
+ useEffect6(() => {
3287
3342
  if (value === current) return;
3288
3343
  setPrevious(current);
3289
3344
  setCurrent(value);
@@ -3338,7 +3393,6 @@ function ProcessingStep({
3338
3393
  sourceSymbol: providedSourceSymbol,
3339
3394
  sourceDecimals: providedSourceDecimals,
3340
3395
  amountUsd,
3341
- hasPostBridgeActions,
3342
3396
  service,
3343
3397
  directTransfer,
3344
3398
  flowLabel = "deposit",
@@ -3368,8 +3422,7 @@ function ProcessingStep({
3368
3422
  sourceDecimals: providedSourceDecimals,
3369
3423
  amountUsd,
3370
3424
  targetChain,
3371
- targetToken,
3372
- hasPostBridgeActions
3425
+ targetToken
3373
3426
  });
3374
3427
  const onDepositCompleteRef = useLatestRef(onDepositComplete);
3375
3428
  const onDepositFailedRef = useLatestRef(onDepositFailed);
@@ -3397,7 +3450,7 @@ function ProcessingStep({
3397
3450
  },
3398
3451
  [txHash]
3399
3452
  );
3400
- useEffect5(() => {
3453
+ useEffect6(() => {
3401
3454
  if (!directTransfer) return;
3402
3455
  const completedAt = Date.now();
3403
3456
  updatePhaseTimings(() => ({
@@ -3428,7 +3481,7 @@ function ProcessingStep({
3428
3481
  txHash,
3429
3482
  updatePhaseTimings
3430
3483
  ]);
3431
- useEffect5(() => {
3484
+ useEffect6(() => {
3432
3485
  if (directTransfer || state.type !== "processing") return;
3433
3486
  const updateElapsed = () => {
3434
3487
  setElapsedSeconds(
@@ -3439,7 +3492,7 @@ function ProcessingStep({
3439
3492
  const intervalId = setInterval(updateElapsed, 1e3);
3440
3493
  return () => clearInterval(intervalId);
3441
3494
  }, [directTransfer, state.type]);
3442
- useEffect5(() => {
3495
+ useEffect6(() => {
3443
3496
  if (state.type === "processing") return;
3444
3497
  const endedAt = state.type === "complete" ? phaseTimings.completedAt ?? Date.now() : Date.now();
3445
3498
  setElapsedSeconds(Math.floor((endedAt - startTimeRef.current) / 1e3));
@@ -3447,14 +3500,14 @@ function ProcessingStep({
3447
3500
  (previous) => previous.endedAt !== void 0 ? previous : { ...previous, endedAt }
3448
3501
  );
3449
3502
  }, [phaseTimings.completedAt, state.type, updatePhaseTimings]);
3450
- useEffect5(() => {
3503
+ useEffect6(() => {
3451
3504
  if (!state.lastEvent) return;
3452
3505
  updatePhaseTimings(
3453
3506
  (previous) => syncPhaseTimings(previous, state.lastEvent)
3454
3507
  );
3455
3508
  }, [state.lastEvent?.time, state.lastEvent?.type, updatePhaseTimings]);
3456
3509
  const [swappedFiatContext, setSwappedFiatContext] = useState5(null);
3457
- useEffect5(() => {
3510
+ useEffect6(() => {
3458
3511
  let cancelled = false;
3459
3512
  service.fetchSwappedOrderStatus(smartAccount).then((res) => {
3460
3513
  if (cancelled || !res) return;
@@ -3477,7 +3530,7 @@ function ProcessingStep({
3477
3530
  cancelled = true;
3478
3531
  };
3479
3532
  }, [service, smartAccount, txHash, isSwappedOrder, swappedContext?.variant]);
3480
- useEffect5(() => {
3533
+ useEffect6(() => {
3481
3534
  if (directTransfer) return;
3482
3535
  if (state.type !== "processing") {
3483
3536
  pollIntervalRef.current = INITIAL_POLL_INTERVAL;
@@ -3505,43 +3558,7 @@ function ProcessingStep({
3505
3558
  });
3506
3559
  }
3507
3560
  if (!isMounted) return;
3508
- const awaitingPostBridgeSwap = processingContextRef.current.hasPostBridgeActions;
3509
- if (eventForCurrentTx?.type === "post-bridge-swap-complete") {
3510
- setState({ type: "complete", lastEvent: eventForCurrentTx });
3511
- const swapTxHash = eventForCurrentTx.data?.swap?.transactionHash;
3512
- debugLog(debug, "processing", "state:complete", {
3513
- txHash,
3514
- destinationTxHash: swapTxHash,
3515
- event: eventForCurrentTx.type
3516
- });
3517
- const context = processingContextRef.current;
3518
- onDepositCompleteRef.current?.(txHash, swapTxHash, {
3519
- amount: context.amount,
3520
- sourceChain: context.sourceChain,
3521
- sourceToken: context.sourceToken,
3522
- sourceDecimals: context.sourceDecimals,
3523
- amountUsd: context.amountUsd,
3524
- targetChain: context.targetChain,
3525
- targetToken: context.targetToken
3526
- });
3527
- return;
3528
- }
3529
- if (eventForCurrentTx?.type === "post-bridge-swap-failed") {
3530
- const formatted = formatBridgeFailedMessage(eventForCurrentTx);
3531
- setState({
3532
- type: "failed",
3533
- message: formatted.message,
3534
- lastEvent: eventForCurrentTx
3535
- });
3536
- debugLog(debug, "processing", "state:failed", {
3537
- txHash,
3538
- message: formatted.message,
3539
- code: formatted.code
3540
- });
3541
- onDepositFailedRef.current?.(txHash, formatted.message);
3542
- return;
3543
- }
3544
- if (eventForCurrentTx?.type === "bridge-complete" && !awaitingPostBridgeSwap) {
3561
+ if (eventForCurrentTx?.type === "bridge-complete") {
3545
3562
  setState({ type: "complete", lastEvent: eventForCurrentTx });
3546
3563
  const destinationTxHash2 = eventForCurrentTx.data?.destination?.transactionHash;
3547
3564
  debugLog(debug, "processing", "state:complete", {
@@ -3637,7 +3654,7 @@ function ProcessingStep({
3637
3654
  state.type,
3638
3655
  txHash
3639
3656
  ]);
3640
- useEffect5(() => {
3657
+ useEffect6(() => {
3641
3658
  if (directTransfer || state.type !== "processing") return;
3642
3659
  const timeoutId = setTimeout(() => {
3643
3660
  if (escalatedDelayRef.current) return;
@@ -3660,8 +3677,7 @@ function ProcessingStep({
3660
3677
  const timelineNowMs = phaseTimings.endedAt ?? Date.now();
3661
3678
  const flowNoun = flowLabel === "withdraw" ? "withdrawal" : "deposit";
3662
3679
  const flowCapitalized = flowLabel === "withdraw" ? "Withdrawal" : "Deposit";
3663
- const isPostBridgeSwapEvent = lastEvent?.type === "post-bridge-swap-complete" || lastEvent?.type === "post-bridge-swap-failed";
3664
- const destinationTxHash = isPostBridgeSwapEvent ? lastEvent?.data?.swap?.transactionHash || null : lastEvent?.data?.destination?.transactionHash || null;
3680
+ const destinationTxHash = lastEvent?.data?.destination?.transactionHash || null;
3665
3681
  const sourceDetails = getEventSourceDetails(lastEvent);
3666
3682
  const displaySourceChain = sourceDetails.chainId ?? sourceChain;
3667
3683
  const displaySourceToken = sourceDetails.token ?? sourceToken;
@@ -3681,8 +3697,7 @@ function ProcessingStep({
3681
3697
  const sourceSymbol = sourceDisplay.symbol;
3682
3698
  const formattedSentAmount = formatRawTokenAmount(displayAmount, sourceDisplay) ?? // Not raw base units (e.g. a decimal string) — render the number as-is.
3683
3699
  formatTokenAmount(Number(displayAmount), sourceDisplay.symbol) ?? displayAmount;
3684
- const isBridgeHopDestination = hasPostBridgeActions && (lastEvent?.type === "bridge-started" || lastEvent?.type === "bridge-complete");
3685
- const eventDestination = isBridgeHopDestination ? {} : getEventDestinationDetails(lastEvent);
3700
+ const eventDestination = getEventDestinationDetails(lastEvent);
3686
3701
  const targetDisplay = resolveTokenDisplay(
3687
3702
  eventDestination.token ?? targetToken,
3688
3703
  eventDestination.chainId ?? targetChain,
@@ -4076,6 +4091,7 @@ export {
4076
4091
  rpcUrlFor,
4077
4092
  RpcUrlsProvider,
4078
4093
  useRpcUrls,
4094
+ useStableRpcUrls,
4079
4095
  getPublicClient,
4080
4096
  getHyperEvmReadClient,
4081
4097
  loadSessionOwnerFromStorage,