@fluent.xyz/connect 0.6.0 → 0.6.2-rc.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -27,7 +27,7 @@ import { signerToEcdsaValidator } from '@zerodev/ecdsa-validator';
27
27
  import { deserializePermissionAccount } from '@zerodev/permissions';
28
28
  import '@zerodev/permissions/policies';
29
29
  import { toECDSASigner } from '@zerodev/permissions/signers';
30
- import { createKernelAccount, createKernelAccountClient, getERC20PaymasterApproveCall, createZeroDevPaymasterClient } from '@zerodev/sdk';
30
+ import { createKernelAccount, createKernelAccountClient, createZeroDevPaymasterClient } from '@zerodev/sdk';
31
31
  import { getEntryPoint, KERNEL_V3_3 } from '@zerodev/sdk/constants';
32
32
  import { privateKeyToAccount, toAccount } from 'viem/accounts';
33
33
  import { WaitForUserOperationReceiptTimeoutError, estimateUserOperationGas, getPaymasterData, getPaymasterStubData } from 'viem/account-abstraction';
@@ -5007,6 +5007,22 @@ function getFluentGasTokenAddress(symbol, network) {
5007
5007
  if (!token || isFluentNativeToken(token)) return void 0;
5008
5008
  return token.address;
5009
5009
  }
5010
+ var FLUENT_GAS_TOKEN_APPROVALS = {
5011
+ USDNR: { amount: "1", refreshBelow: "0.1" },
5012
+ BLEND: { amount: "10", refreshBelow: "1" }
5013
+ };
5014
+ function getFluentGasTokenApproval(gasToken, network) {
5015
+ const wanted = gasToken.toLowerCase();
5016
+ const token = getFluentDefaultWidgetGasTokens(network).find(
5017
+ (candidate) => !isFluentNativeToken(candidate) && candidate.address?.toLowerCase() === wanted
5018
+ );
5019
+ const approval = token && FLUENT_GAS_TOKEN_APPROVALS[token.symbol.toUpperCase()];
5020
+ if (!token || !approval) return void 0;
5021
+ return {
5022
+ amount: parseUnits(approval.amount, token.decimals),
5023
+ refreshBelow: parseUnits(approval.refreshBelow, token.decimals)
5024
+ };
5025
+ }
5010
5026
  var FLUENT_GAS_PAYMENT_DEFAULT_ETH_RATES = {
5011
5027
  ETH: "1"
5012
5028
  };
@@ -5596,7 +5612,7 @@ function createFluentConnectForWidget(config) {
5596
5612
  }
5597
5613
 
5598
5614
  // package.json
5599
- var version = "0.6.0";
5615
+ var version = "0.6.2-rc.1";
5600
5616
 
5601
5617
  // src/core/analytics.ts
5602
5618
  var INSTANCE_NAME = "fluent";
@@ -5729,10 +5745,21 @@ var TOP_LAYER_STYLE_SCOPE = "fluent-root dark text-foreground";
5729
5745
  var FluentPortalContainerContext = createContext(null);
5730
5746
  var FluentTopLayerContext = createContext(null);
5731
5747
  var FluentToastLayerContext = createContext(null);
5748
+ var FluentOpenSurfaceContext = createContext(null);
5749
+ var OPEN_SURFACE_SELECTOR = '[data-slot="dialog-content"][data-open], [data-slot="drawer-popup"][data-open]';
5750
+ function findOpenSurface(roots) {
5751
+ let found = null;
5752
+ for (const root of roots) {
5753
+ const matches2 = root.querySelectorAll(OPEN_SURFACE_SELECTOR);
5754
+ found = matches2[matches2.length - 1] ?? found;
5755
+ }
5756
+ return found;
5757
+ }
5732
5758
  function FluentPortalContainerProvider({ children }) {
5733
5759
  const [container, setContainer] = useState(null);
5734
5760
  const [topLayer, setTopLayer] = useState(null);
5735
5761
  const [toastLayer, setToastLayer] = useState(null);
5762
+ const [openSurface, setOpenSurface] = useState(null);
5736
5763
  const holdsRef = useRef(0);
5737
5764
  useLayoutEffect(() => {
5738
5765
  const element = document.createElement("div");
@@ -5750,6 +5777,13 @@ function FluentPortalContainerProvider({ children }) {
5750
5777
  } catch {
5751
5778
  }
5752
5779
  setToastLayer(toasts);
5780
+ const promoteToasts = () => {
5781
+ try {
5782
+ toasts.hidePopover?.();
5783
+ toasts.showPopover?.();
5784
+ } catch {
5785
+ }
5786
+ };
5753
5787
  const dialog = document.createElement("dialog");
5754
5788
  dialog.setAttribute("data-fluent-top-layer", "");
5755
5789
  dialog.className = TOP_LAYER_STYLE_SCOPE;
@@ -5758,6 +5792,7 @@ function FluentPortalContainerProvider({ children }) {
5758
5792
  if (holdsRef.current > 0 && dialog.isConnected && !dialog.open) {
5759
5793
  try {
5760
5794
  dialog.showModal();
5795
+ promoteToasts();
5761
5796
  } catch {
5762
5797
  }
5763
5798
  }
@@ -5778,6 +5813,7 @@ function FluentPortalContainerProvider({ children }) {
5778
5813
  if (holdsRef.current === 1 && dialog.isConnected && !dialog.open) {
5779
5814
  try {
5780
5815
  dialog.showModal();
5816
+ promoteToasts();
5781
5817
  } catch {
5782
5818
  }
5783
5819
  placeToasts(dialog);
@@ -5797,7 +5833,20 @@ function FluentPortalContainerProvider({ children }) {
5797
5833
  };
5798
5834
  };
5799
5835
  setTopLayer({ element: dialog, acquire });
5836
+ const roots = [element, dialog];
5837
+ const trackOpenSurface = () => setOpenSurface(findOpenSurface(roots));
5838
+ const surfaceObserver = new MutationObserver(trackOpenSurface);
5839
+ for (const root of roots) {
5840
+ surfaceObserver.observe(root, {
5841
+ subtree: true,
5842
+ childList: true,
5843
+ attributes: true,
5844
+ attributeFilter: ["data-open"]
5845
+ });
5846
+ }
5800
5847
  return () => {
5848
+ surfaceObserver.disconnect();
5849
+ setOpenSurface(null);
5801
5850
  element.remove();
5802
5851
  setContainer(null);
5803
5852
  toasts.remove();
@@ -5808,7 +5857,7 @@ function FluentPortalContainerProvider({ children }) {
5808
5857
  setTopLayer(null);
5809
5858
  };
5810
5859
  }, []);
5811
- return /* @__PURE__ */ jsx(FluentPortalContainerContext.Provider, { value: container, children: /* @__PURE__ */ jsx(FluentTopLayerContext.Provider, { value: topLayer, children: /* @__PURE__ */ jsx(FluentToastLayerContext.Provider, { value: toastLayer, children }) }) });
5860
+ return /* @__PURE__ */ jsx(FluentPortalContainerContext.Provider, { value: container, children: /* @__PURE__ */ jsx(FluentTopLayerContext.Provider, { value: topLayer, children: /* @__PURE__ */ jsx(FluentToastLayerContext.Provider, { value: toastLayer, children: /* @__PURE__ */ jsx(FluentOpenSurfaceContext.Provider, { value: openSurface, children }) }) }) });
5812
5861
  }
5813
5862
  function useFluentPortalContainer(override) {
5814
5863
  const container = useContext(FluentPortalContainerContext);
@@ -5825,10 +5874,14 @@ function useFluentTopLayer() {
5825
5874
  function useFluentToastLayer() {
5826
5875
  return useContext(FluentToastLayerContext);
5827
5876
  }
5877
+ function useFluentOpenSurface() {
5878
+ return useContext(FluentOpenSurfaceContext);
5879
+ }
5828
5880
  function useFluentToastPortalContainer(override) {
5881
+ const openSurface = useContext(FluentOpenSurfaceContext);
5829
5882
  const toastLayer = useContext(FluentToastLayerContext);
5830
5883
  const container = useContext(FluentPortalContainerContext);
5831
- return override ?? toastLayer ?? container ?? void 0;
5884
+ return override ?? openSurface ?? toastLayer ?? container ?? void 0;
5832
5885
  }
5833
5886
  function FluentTopLayerSlot({
5834
5887
  children,
@@ -5908,16 +5961,19 @@ function ToastPortal({ container, ...props }) {
5908
5961
  }
5909
5962
  );
5910
5963
  }
5911
- function ToastViewport({ className, ...props }) {
5964
+ function ToastViewport({ className, children, ...props }) {
5965
+ const inSurface = useFluentOpenSurface() !== null;
5912
5966
  return /* @__PURE__ */ jsx(
5913
5967
  Toast$1.Viewport,
5914
5968
  {
5915
5969
  "data-slot": "toast-viewport",
5916
5970
  className: cn(
5917
- "dark pointer-events-none fixed inset-x-4 bottom-4 z-[100] mx-auto w-[min(100%,368px)] max-w-[368px] text-foreground outline-none sm:right-4 sm:left-auto sm:mx-0",
5971
+ "dark pointer-events-none fixed z-[100] text-foreground outline-none",
5972
+ inSurface ? "inset-0 overflow-hidden rounded-[inherit]" : "inset-x-4 bottom-4 mx-auto w-[min(100%,368px)] max-w-[368px] sm:right-4 sm:left-auto sm:mx-0",
5918
5973
  className
5919
5974
  ),
5920
- ...props
5975
+ ...props,
5976
+ children: inSurface ? /* @__PURE__ */ jsx("div", { className: "absolute inset-x-4 bottom-4 mx-auto max-w-[368px]", children }) : children
5921
5977
  }
5922
5978
  );
5923
5979
  }
@@ -6278,6 +6334,13 @@ function toastFaucetError(error) {
6278
6334
  });
6279
6335
  }
6280
6336
 
6337
+ // src/utils/fluentAmountFractionDigits.ts
6338
+ var FLUENT_AMOUNT_FRACTION_DIGITS = 6;
6339
+ var USD_PEGGED_SYMBOLS = /* @__PURE__ */ new Set(["USDnr", "USDC"]);
6340
+ function fluentAmountFractionDigits(symbol) {
6341
+ return USD_PEGGED_SYMBOLS.has(symbol) ? 2 : FLUENT_AMOUNT_FRACTION_DIGITS;
6342
+ }
6343
+
6281
6344
  // src/utils/formatExternalWallet.ts
6282
6345
  function formatExternalWallet(wallet, status) {
6283
6346
  return JSON.stringify(
@@ -6827,8 +6890,6 @@ var icons = {
6827
6890
  "arrow-up-down-line": (props) => /* @__PURE__ */ jsx("svg", { viewBox: "0 0 24 24", fill: "currentColor", xmlns: "http://www.w3.org/2000/svg", ...props, children: /* @__PURE__ */ jsx("path", { d: "M11.9498 7.94975L10.5356 9.36396L8.00079 6.828L8.00004 20H6.00004L6.00079 6.828L3.46451 9.36396L2.05029 7.94975L7.00004 3L11.9498 7.94975ZM21.9498 16.0503L17 21L12.0503 16.0503L13.4645 14.636L16.0008 17.172L16 4H18L18.0008 17.172L20.5356 14.636L21.9498 16.0503Z" }) }),
6828
6891
  "arrow-right-up-line": (props) => /* @__PURE__ */ jsx("svg", { viewBox: "0 0 24 24", fill: "currentColor", xmlns: "http://www.w3.org/2000/svg", ...props, children: /* @__PURE__ */ jsx("path", { d: "M16.0037 9.41421L7.39712 18.0208L5.98291 16.6066L14.5895 8H7.00373V6H18.0037V17H16.0037V9.41421Z" }) }),
6829
6892
  "arrow-up-line": (props) => /* @__PURE__ */ jsx("svg", { viewBox: "0 0 24 24", fill: "currentColor", xmlns: "http://www.w3.org/2000/svg", ...props, children: /* @__PURE__ */ jsx("path", { d: "M13 7.82843V20H11V7.82843L5.63604 13.1924L4.22183 11.7782L12 4L19.7782 11.7782L18.364 13.1924L13 7.82843Z" }) }),
6830
- "arrow-up-s-fill": (props) => /* @__PURE__ */ jsx("svg", { viewBox: "0 0 24 24", fill: "currentColor", xmlns: "http://www.w3.org/2000/svg", ...props, children: /* @__PURE__ */ jsx("path", { d: "M12 8L18 14H6L12 8Z" }) }),
6831
- "arrow-down-s-fill": (props) => /* @__PURE__ */ jsx("svg", { viewBox: "0 0 24 24", fill: "currentColor", xmlns: "http://www.w3.org/2000/svg", ...props, children: /* @__PURE__ */ jsx("path", { d: "M12 16L6 10H18L12 16Z" }) }),
6832
6893
  plus: (props) => /* @__PURE__ */ jsx("svg", { viewBox: "0 0 24 24", fill: "currentColor", xmlns: "http://www.w3.org/2000/svg", ...props, children: /* @__PURE__ */ jsx("path", { d: "M11 11V5H13V11H19V13H13V19H11V13H5V11H11Z" }) }),
6833
6894
  eth: (props) => /* @__PURE__ */ jsxs("svg", { viewBox: "0 0 24 24", fill: "currentColor", xmlns: "http://www.w3.org/2000/svg", ...props, children: [
6834
6895
  /* @__PURE__ */ jsx("path", { d: "M11.944 1.5v7.908l6.722 3.004L11.944 1.5z", opacity: "0.6" }),
@@ -6850,10 +6911,6 @@ var icons = {
6850
6911
  /* @__PURE__ */ jsx("path", { d: "M38.2,16.77c.18,.12,.36,.24,.53,.36l.34,.24L40.46,.15l-.23-.03c-.34-.04-.68-.08-1.02-.1l-.25-.02-.89,16.69,.12,.08Zm-2.73-1.55c.14,.07,.29,.14,.43,.21l.37,.19L35.41,0l-.25,.02c-.31,.03-.62,.06-.93,.1l-.23,.03,1.2,14.95,.13,.06,.14,.07Zm5.17,3.37c.16,.14,.32,.28,.48,.42l.31,.28L45.37,1.3l-.21-.07c-.35-.12-.7-.23-1.05-.33l-.25-.07-3.33,17.67,.11,.09Zm-8.46-4.67c.15,.05,.29,.09,.44,.14l.39,.13L30.44,.88l-.25,.07c-.27,.08-.54,.16-.81,.25l-.2,.07,2.72,12.56,.14,.04,.15,.05Zm-3.68-.85c.15,.02,.29,.05,.44,.07l.4,.07-3.56-10.49-.25,.13c-.22,.12-.44,.24-.66,.36l-.18,.1,3.52,9.71,.14,.02,.15,.02Zm15.82,9.4c.13,.16,.25,.33,.37,.5l.23,.31L53.91,6.35l-.14-.13c-.31-.28-.63-.55-.95-.81l-.23-.19-8.36,17.13,.09,.12ZM24.35,12.81c.18,0,.68,0,.87,0h.41s-4.02-7.36-4.02-7.36l-.22,.18c-.17,.14-.34,.28-.5,.43l-.14,.13,3.47,6.62h.15Zm21.28,11.59c.11,.17,.21,.35,.31,.52l.19,.32,11.05-15.3-.11-.14c-.26-.34-.53-.68-.81-1.02l-.21-.24-10.5,15.73,.08,.13ZM17.58,9.55l-.11,.14,2.55,3.59,.15-.03c.17-.03,.33-.06,.5-.09l.37-.06-2.9-4.24-.2,.25c-.12,.15-.24,.29-.35,.44Zm29.11,16.75c.09,.18,.18,.36,.27,.55l.15,.32,12.54-13.16-.07-.15c-.2-.4-.41-.8-.63-1.19l-.17-.3-12.16,13.79,.07,.15ZM14.99,13.65l.82,.89,.15-.06c.14-.05,.28-.11,.42-.16l.48-.19-1.23-1.63c-.08,.14-.58,1.01-.65,1.15Zm32.54,14.53c.07,.19,.15,.37,.22,.56l.12,.31,13.39-10.73-.04-.15c-.12-.44-.26-.89-.41-1.32l-.11-.34-13.23,11.51,.06,.16Zm.64,1.8c.06,.19,.11,.38,.17,.57l.09,.3,13.61-8.15v-.15c-.06-.47-.11-.93-.18-1.39l-.06-.37-13.68,9.02,.05,.17Zm.46,1.72c.04,.19,.09,.38,.13,.57l.06,.29,13.22-5.63v-.15c.05-.47,.07-.93,.08-1.4v-.39s-13.53,6.51-13.53,6.51l.04,.19Zm.33,1.67c.03,.2,.06,.39,.09,.59l.04,.27,12.3-3.35,.03-.14c.11-.45,.21-.91,.29-1.36l.07-.4-12.86,4.17,.03,.2Zm.21,1.65c.02,.21,.04,.41,.05,.62l.02,.26,10.98-1.43,.05-.13c.17-.42,.34-.85,.49-1.28l.14-.39-11.73,2.13,.02,.22Zm.04,3.95l-.02,.22,7.59,1.08,.09-.11c.27-.34,.52-.68,.76-1.03l.24-.34-8.62-.75v.25c-.02,.22-.03,.45-.05,.67Zm-.18,1.68l-.03,.21,5.79,1.65,.1-.1c.29-.29,.57-.59,.84-.89l.28-.31-6.87-1.53-.03,.27c-.03,.24-.05,.47-.09,.71Zm-.3,1.7l-.04,.19,4.07,1.78,.11-.09c.3-.24,.6-.5,.89-.75l.3-.27-5.13-1.89-.05,.28c-.04,.25-.09,.5-.15,.75Zm-.44,1.73l-.05,.18,2.49,1.53,.13-.08c.31-.2,.61-.41,.91-.63l.31-.23-3.5-1.86-.07,.3c-.07,.27-.14,.53-.22,.79Zm-.6,1.79l-.06,.16,1.11,.91,.14-.07c.31-.17,.62-.34,.93-.52l.32-.19-2.03-1.46-.1,.31c-.1,.29-.2,.57-.3,.86Zm-.38,.95c-.06,.14-.12,.29-.19,.43l-.26,.58,.58-.26c.15-.07,.29-.13,.44-.2l.32-.15-.76-.71-.13,.32Zm1.95-10.17c0,.22,0,.43,0,.65v.24l9.36,.06,.07-.12s.01-.02,.02-.03c0-.01,.02-.03,.05-.09h0c.2-.35,.39-.69,.57-1.04l.19-.37-10.28,.48v.24Zm-6.16-15.65c-.14-.16-.28-.31-.43-.47l-.1-.1L48.46,2.61l.25,.13c.35,.18,.69,.37,1.03,.57l.17,.1-6.56,17.88-.27-.3Z" }),
6851
6912
  /* @__PURE__ */ jsx("path", { d: "M16.74,36.74c.12-.18,.24-.36,.36-.53l.24-.34L.15,34.48l-.03,.23c-.04,.34-.08,.68-.1,1.02l-.02,.25,16.67,.89,.08-.12Zm-1.54,2.74c.07-.14,.14-.29,.21-.43l.19-.37L0,39.54l.02,.25c.03,.31,.06,.62,.1,.93l.03,.23,14.92-1.2,.06-.13,.07-.14Zm3.36-5.18c.14-.16,.28-.32,.42-.49l.28-.31L1.3,29.56l-.07,.21c-.12,.35-.23,.7-.33,1.06l-.07,.25,17.64,3.33,.09-.11Zm-4.66,8.48c.05-.15,.09-.3,.14-.44l.13-.39L.88,44.52l.07,.25c.08,.27,.16,.54,.25,.81l.07,.21,12.54-2.72,.04-.14,.05-.15Zm-.85,3.69c.02-.15,.05-.29,.07-.44l.07-.4-10.47,3.56,.13,.25c.12,.22,.24,.44,.36,.66l.1,.18,9.7-3.52,.02-.14,.02-.15Zm9.39-15.85c.16-.13,.33-.25,.5-.37l.31-.23L6.34,21.01l-.13,.14c-.28,.31-.55,.63-.81,.95l-.19,.24,17.1,8.37,.12-.09Zm-9.65,19.99c0-.18,0-.68,0-.87v-.41s-7.35,4.03-7.35,4.03l.18,.22c.14,.17,.28,.34,.43,.5l.12,.14,6.61-3.47v-.15Zm11.57-21.32c.17-.11,.35-.21,.52-.31l.32-.19-15.28-11.07-.14,.11c-.34,.26-.68,.53-1.02,.82l-.24,.21,15.7,10.52,.13-.08Zm-14.83,28.1l.14,.11,3.59-2.55-.03-.15c-.03-.17-.06-.34-.09-.5l-.06-.37-4.23,2.91,.25,.2c.15,.12,.29,.24,.44,.35ZM26.26,28.24c.18-.09,.36-.18,.54-.27l.32-.15L13.98,15.26l-.15,.07c-.4,.2-.8,.41-1.19,.63l-.3,.17,13.77,12.18,.15-.07Zm-12.64,31.76l.88-.82-.06-.15c-.05-.14-.11-.28-.16-.42l-.19-.49-1.62,1.24c.14,.08,1.01,.58,1.15,.65ZM28.13,27.4c.19-.07,.37-.15,.56-.22l.31-.12-10.71-13.42-.15,.04c-.44,.12-.88,.26-1.32,.41l-.34,.12,11.49,13.25,.16-.06Zm1.79-.64c.19-.06,.38-.11,.57-.17l.3-.09-8.13-13.63h-.15c-.46,.06-.93,.11-1.39,.18l-.37,.06,9.01,13.7,.17-.05Zm1.72-.47c.19-.04,.38-.09,.57-.13l.29-.06-5.62-13.24h-.15c-.47-.05-.93-.07-1.4-.08h-.39s6.5,13.55,6.5,13.55l.19-.04Zm1.67-.33c.2-.03,.39-.06,.59-.09l.27-.04-3.34-12.32-.14-.03c-.45-.11-.9-.21-1.36-.29l-.4-.07,4.17,12.88,.2-.03Zm1.64-.21c.21-.02,.41-.04,.61-.05l.26-.02-1.43-10.99-.13-.05c-.42-.17-.85-.34-1.28-.49l-.39-.14,2.13,11.75,.22-.02Zm3.95-.04l.22,.02,1.08-7.6-.11-.09c-.34-.27-.68-.52-1.03-.77l-.34-.24-.75,8.63h.25c.22,.02,.45,.03,.67,.05Zm1.68,.18l.21,.03,1.64-5.8-.1-.1c-.29-.29-.59-.57-.89-.84l-.31-.28-1.53,6.88,.27,.03c.24,.03,.47,.05,.71,.09Zm1.69,.3l.19,.04,1.78-4.08-.09-.11c-.24-.3-.49-.6-.75-.89l-.27-.3-1.89,5.14,.28,.05c.25,.04,.5,.09,.74,.15Zm1.73,.44l.18,.05,1.53-2.49-.08-.13c-.2-.31-.41-.61-.63-.91l-.23-.31-1.86,3.51,.3,.07c.27,.07,.53,.14,.79,.22Zm1.79,.6l.16,.06,.91-1.11-.07-.14c-.17-.31-.34-.62-.52-.93l-.19-.32-1.45,2.03,.31,.1c.29,.1,.57,.2,.85,.31Zm.95,.38c.14,.06,.29,.12,.43,.19l.58,.26-.26-.58c-.07-.15-.13-.29-.2-.44l-.15-.32-.71,.76,.32,.13Zm-10.15-1.95c.22,0,.43,0,.65,0h.24l.06-9.37-.12-.07s-.02-.01-.03-.02c-.01,0-.03-.02-.09-.05h0c-.34-.2-.69-.39-1.04-.57l-.37-.19,.48,10.29h.23Zm-15.63,6.17c-.16,.14-.31,.28-.47,.43l-.1,.1L2.6,26.47l.13-.25c.18-.35,.37-.69,.57-1.04l.1-.18,17.85,6.57-.3,.27Z" })
6852
6913
  ] }),
6853
- blend: (props) => /* @__PURE__ */ jsxs("svg", { viewBox: "0 0 24 24", fill: "currentColor", xmlns: "http://www.w3.org/2000/svg", ...props, children: [
6854
- /* @__PURE__ */ jsx("path", { d: "M12 3.5 4.5 8v8L12 20.5 19.5 16V8L12 3.5zm0 1.75 5.25 3.15v6.2L12 17.75l-5.25-3.15v-6.2L12 5.25z" }),
6855
- /* @__PURE__ */ jsx("path", { d: "M12 8.25 8.5 10.3v3.4L12 15.75l3.5-2.05v-3.4L12 8.25z" })
6856
- ] }),
6857
6914
  fluent: (props) => /* @__PURE__ */ jsx("svg", { viewBox: "0 0 26 24", fill: "currentColor", xmlns: "http://www.w3.org/2000/svg", ...props, children: /* @__PURE__ */ jsx("path", { d: "M25.973 3.5405V0H0.0274556V3.5405H11.5738C9.39481 4.86942 7.44796 6.53554 5.79813 8.4595H0V12H3.2797C1.21554 15.5331 0.0274556 19.6314 0.0274556 24H3.59169C3.59169 19.5198 5.05433 15.3719 7.52284 11.9975H14.257C10.7975 14.8364 8.58862 19.1306 8.58862 23.9256H12.1529C12.1529 17.3479 17.5392 11.9975 24.1609 11.9975H25.9431V8.45702H10.815C14.4167 5.39504 19.0867 3.53802 24.1884 3.53802H25.9705L25.973 3.5405Z" }) }),
6858
6915
  fluentLogomark: (props) => /* @__PURE__ */ jsx("svg", { viewBox: "0 0 18 16", fill: "currentColor", xmlns: "http://www.w3.org/2000/svg", ...props, children: /* @__PURE__ */ jsx("path", { d: "M17.6591 2.36033V0H0.362054V2.36033H8.05961C6.60696 3.24628 5.30906 4.35702 4.20917 5.63967H0.34375V8H2.53022C1.15411 10.3554 0.362054 13.0876 0.362054 16H2.73821C2.73821 13.0132 3.7133 10.2479 5.35898 7.99835H9.84839C7.54212 9.89091 6.0695 12.7537 6.0695 15.9504H8.44565C8.44565 11.5653 12.0365 7.99835 16.451 7.99835H17.6391V5.63802H7.55376C9.95488 3.59669 13.0682 2.35868 16.4694 2.35868H17.6574L17.6591 2.36033Z" }) }),
6859
6916
  fluentLogotype: (props) => /* @__PURE__ */ jsx("svg", { viewBox: "0 0 63 16", fill: "currentColor", xmlns: "http://www.w3.org/2000/svg", ...props, children: /* @__PURE__ */ jsx("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M0.3125 4.63636V6.75207H2.1878V15.8529H4.85017V6.75207H7.89691V4.63636H4.7653V3.95868C4.7653 3.35207 4.90674 2.89752 5.19128 2.59339C5.47582 2.29091 5.89514 2.13884 6.44925 2.13884C6.71881 2.13884 6.98172 2.17851 7.23797 2.2562C7.49423 2.33388 7.72053 2.44959 7.9202 2.60496L8.64404 0.614876C8.3595 0.403306 8.00839 0.247934 7.58907 0.14876C7.16975 0.0495868 6.72713 0 6.25789 0C4.95 0 3.94663 0.357025 3.24276 1.06942C2.5389 1.78182 2.1878 2.73058 2.1878 3.9157V4.63636H0.3125ZM10.1198 0.148438V15.8526H12.7838V0.148438H10.1198ZM20.1296 15.9991C19.1628 15.9991 18.3109 15.8189 17.5721 15.4586C16.8333 15.0982 16.2575 14.5478 15.8465 13.8073C15.4339 13.0668 15.2292 12.1313 15.2292 11.0024V4.54948H17.8932V10.6454C17.8932 11.6619 18.1245 12.4206 18.5854 12.9197C19.0463 13.4206 19.7036 13.6718 20.5556 13.6718C21.1812 13.6718 21.7237 13.5445 22.1863 13.2916C22.6472 13.0371 23.0099 12.6569 23.2729 12.1478C23.5358 11.6404 23.6672 11.0123 23.6672 10.2635V4.54948H26.3312V15.852H23.7953V14.417C23.4615 14.8264 23.049 15.1596 22.559 15.4173C21.8202 15.8057 21.0098 15.9991 20.1296 15.9991ZM31.0708 15.2467C32.0143 15.7475 33.1192 15.9987 34.3838 15.9987H34.3871C35.3805 15.9987 36.2657 15.8401 37.0395 15.5227C37.8132 15.2053 38.4572 14.7491 38.968 14.1574L37.5403 12.5277C37.1427 12.9508 36.6884 13.2615 36.1775 13.4582C35.6667 13.6549 35.091 13.7541 34.452 13.7541C33.7132 13.7541 33.0593 13.6136 32.4918 13.331C31.9228 13.0483 31.4835 12.6467 31.1706 12.1244C30.9733 11.796 30.8383 11.4361 30.7654 11.045H39.6919C39.7052 10.9177 39.7168 10.7839 39.7235 10.6434C39.7301 10.5029 39.7335 10.3756 39.7335 10.2632C39.7335 9.07642 39.4855 8.04667 38.988 7.17229C38.4905 6.29791 37.8099 5.62022 36.943 5.14088C36.076 4.66154 35.1176 4.42188 33.9811 4.42188C32.8446 4.42188 31.8312 4.66816 30.9443 5.16237C30.0558 5.65659 29.3602 6.33758 28.8561 7.20535C28.3502 8.07311 28.0989 9.08634 28.0989 10.2004C28.0989 11.3144 28.3569 12.3095 28.876 13.1839C29.3952 14.0582 30.1257 14.7458 31.0708 15.2467ZM30.743 9.28799C30.8032 8.86257 30.9283 8.47873 31.1174 8.13592C31.3936 7.6351 31.7763 7.24336 32.2672 6.96072C32.7581 6.67807 33.3438 6.53758 33.9828 6.53758C34.6217 6.53758 35.1858 6.67807 35.6767 6.96072C36.1676 7.24336 36.5536 7.63014 36.8381 8.12435C37.0382 8.47383 37.1642 8.86131 37.2161 9.28799H30.743ZM48.0256 4.42188C48.9341 4.42188 49.7478 4.59873 50.465 4.9508C51.1821 5.30287 51.7462 5.84336 52.1589 6.56898C52.5716 7.29626 52.7762 8.23014 52.7762 9.37394V15.85H50.1122V9.71278C50.1122 8.71113 49.8743 7.96402 49.3984 7.46981C48.9225 6.97559 48.2585 6.72931 47.4066 6.72931C46.7809 6.72931 46.2268 6.85659 45.7443 7.10948C45.2617 7.36402 44.889 7.74088 44.6261 8.24171C44.3632 8.74254 44.2317 9.37394 44.2317 10.1359V15.85H41.5677V4.54915H44.1036V6.01502C44.4512 5.60349 44.8811 5.26694 45.3932 5.00535C46.1536 4.61692 47.0305 4.42353 48.0239 4.42353L48.0256 4.42188ZM53.875 4.63555V6.75125H55.7486V12.1893C55.7486 13.4455 56.0914 14.3926 56.772 15.0355C57.4526 15.6785 58.4193 15.9992 59.669 15.9992H59.6706C60.1532 15.9992 60.6224 15.9364 61.0767 15.8091C61.531 15.6818 61.9137 15.4917 62.2265 15.2372L61.481 13.3529C61.0833 13.6636 60.5858 13.819 59.9901 13.819C59.4926 13.819 59.1065 13.6703 58.8287 13.3744C58.5508 13.0785 58.4127 12.6636 58.4127 12.1265V6.75125H61.4594V4.63555H58.4127V2.05208H55.7486V4.63555H53.875Z" }) }),
@@ -7047,6 +7104,11 @@ function InlineConnectModal(props) {
7047
7104
  const connecting = step !== "choice" && authenticated;
7048
7105
  const screen = connecting ? "connecting" : step;
7049
7106
  const shownError = error || captchaError || (connecting ? signInRefusal || loginError : "");
7107
+ React.useEffect(() => {
7108
+ if (!open || !shownError) return;
7109
+ const id = toast.add({ type: "error", title: shownError });
7110
+ return () => toast.close(id);
7111
+ }, [open, shownError]);
7050
7112
  React.useEffect(() => {
7051
7113
  if (!open) {
7052
7114
  generation.current++;
@@ -7544,9 +7606,9 @@ function InlineConnectModal(props) {
7544
7606
  {
7545
7607
  "aria-describedby": void 0,
7546
7608
  initialFocus: heading,
7547
- className: "dark flex max-h-[calc(100dvh-2rem)] flex-col overflow-hidden text-white antialiased",
7609
+ className: "dark flex max-h-[calc(100dvh-2rem)] flex-col overflow-visible text-white antialiased",
7548
7610
  children: [
7549
- /* @__PURE__ */ jsxs("div", { className: "relative z-20 -m-4 min-h-0 overflow-x-hidden overflow-y-auto overscroll-contain p-4", children: [
7611
+ /* @__PURE__ */ jsxs("div", { className: "relative z-20 -m-4 min-h-0 overflow-x-hidden overflow-y-auto overscroll-contain rounded-[inherit] p-4", children: [
7550
7612
  /* @__PURE__ */ jsxs(
7551
7613
  "div",
7552
7614
  {
@@ -7570,7 +7632,6 @@ function InlineConnectModal(props) {
7570
7632
  ] }),
7571
7633
  /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-2 p-2.5", children: [
7572
7634
  content,
7573
- shownError && /* @__PURE__ */ jsx("p", { className: "px-2.5 text-xs text-[#ff8fda]", role: "alert", children: shownError }),
7574
7635
  captchaError && button(
7575
7636
  "Retry verification",
7576
7637
  () => {
@@ -7612,7 +7673,11 @@ function InlineConnectModal(props) {
7612
7673
  backgroundRepeat: "no-repeat"
7613
7674
  }
7614
7675
  }
7615
- )
7676
+ ),
7677
+ /* @__PURE__ */ jsxs("span", { className: "pointer-events-none absolute top-full left-1/2 mt-2.5 -translate-x-1/2 rounded-full bg-white/5 px-1.5 text-[9px] font-medium leading-[14px] text-white/35 backdrop-blur-md select-none", children: [
7678
+ "v",
7679
+ version
7680
+ ] })
7616
7681
  ]
7617
7682
  }
7618
7683
  )
@@ -7704,7 +7769,7 @@ function SelectItem({
7704
7769
  {
7705
7770
  "data-slot": "select-item",
7706
7771
  className: cn(
7707
- "relative flex w-full cursor-default items-center gap-2 rounded-lg py-2 pr-8 pl-2.5 text-sm outline-hidden select-none focus:bg-foreground/10 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",
7772
+ "relative flex w-full cursor-default items-center gap-2 rounded-lg py-2 pr-8 pl-2.5 text-sm font-medium outline-hidden select-none focus:bg-foreground/10 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",
7708
7773
  className
7709
7774
  ),
7710
7775
  ...props,
@@ -7914,10 +7979,15 @@ var STATUS_LABELS = {
7914
7979
  var activityTimeFormat = new Intl.DateTimeFormat(void 0, { timeStyle: "short" });
7915
7980
  function formatRowAmount(row) {
7916
7981
  if (row.amount === void 0 || row.decimals === void 0 || !row.tokenSymbol) return void 0;
7982
+ const digits = Math.min(4, fluentAmountFractionDigits(row.tokenSymbol));
7917
7983
  const [whole = "0", fraction = ""] = formatUnits(row.amount, row.decimals).split(".");
7918
- const trimmed = fraction.slice(0, 4).replace(/0+$/, "");
7984
+ const trimmed = fraction.slice(0, digits).replace(/0+$/, "");
7919
7985
  return `${trimmed ? `${whole}.${trimmed}` : whole} ${row.tokenSymbol}`;
7920
7986
  }
7987
+ function formatRowExactAmount(row) {
7988
+ if (row.amount === void 0 || row.decimals === void 0 || !row.tokenSymbol) return void 0;
7989
+ return `${formatUnits(row.amount, row.decimals)} ${row.tokenSymbol}`;
7990
+ }
7921
7991
  function HistoryRow({
7922
7992
  row,
7923
7993
  usd,
@@ -7952,7 +8022,14 @@ function HistoryRow({
7952
8022
  ] })
7953
8023
  ] }),
7954
8024
  /* @__PURE__ */ jsxs("span", { className: "flex shrink-0 flex-col items-end gap-1", children: [
7955
- amount ? /* @__PURE__ */ jsx("span", { className: `text-sm font-medium leading-4 ${inFlight ? "opacity-70" : ""}`, children: amount }) : null,
8025
+ amount ? /* @__PURE__ */ jsx(
8026
+ "span",
8027
+ {
8028
+ className: `text-sm font-medium leading-4 ${inFlight ? "opacity-70" : ""}`,
8029
+ title: formatRowExactAmount(row),
8030
+ children: amount
8031
+ }
8032
+ ) : null,
7956
8033
  amount && usd ? /* @__PURE__ */ jsx(
7957
8034
  "span",
7958
8035
  {
@@ -8043,7 +8120,7 @@ function BridgeActivityDetail({
8043
8120
  /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center gap-3 py-3", children: [
8044
8121
  /* @__PURE__ */ jsx(ActivityTokenTile, { tokenSymbol: row.tokenSymbol, badge: row.direction }),
8045
8122
  /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center gap-0", children: [
8046
- /* @__PURE__ */ jsx("span", { className: "min-w-0 truncate text-2xl font-medium", children: amount ?? rowTitle(row) }),
8123
+ /* @__PURE__ */ jsx("span", { className: "min-w-0 truncate text-2xl font-medium", title: formatRowExactAmount(row), children: amount ?? rowTitle(row) }),
8047
8124
  amount && usd ? /* @__PURE__ */ jsx(
8048
8125
  "span",
8049
8126
  {
@@ -8132,10 +8209,14 @@ function TooltipContent({
8132
8209
  }
8133
8210
  ) });
8134
8211
  }
8135
- function formatAmount(value, decimals) {
8212
+ function formatAmount(value, decimals, symbol) {
8136
8213
  if (value === void 0) return "\u2014";
8214
+ const digits = symbol ? fluentAmountFractionDigits(symbol) : FLUENT_AMOUNT_FRACTION_DIGITS;
8137
8215
  const [whole = "0", fraction = ""] = formatUnits(value, decimals).split(".");
8138
- const trimmed = fraction.slice(0, 6).replace(/0+$/, "");
8216
+ const trimmed = fraction.slice(0, digits).replace(/0+$/, "");
8217
+ if (!trimmed && whole === "0" && value > 0n && digits < FLUENT_AMOUNT_FRACTION_DIGITS) {
8218
+ return `<0.${"1".padStart(digits, "0")}`;
8219
+ }
8139
8220
  return trimmed ? `${whole}.${trimmed}` : whole;
8140
8221
  }
8141
8222
  function formatUsd(usd) {
@@ -8169,7 +8250,8 @@ function SummaryRow({
8169
8250
  label,
8170
8251
  value,
8171
8252
  secondary,
8172
- tooltip
8253
+ tooltip,
8254
+ valueTitle
8173
8255
  }) {
8174
8256
  return /* @__PURE__ */ jsxs("div", { className: "flex items-start justify-between gap-5 text-sm", children: [
8175
8257
  /* @__PURE__ */ jsxs("span", { className: "inline-flex items-center gap-1 text-foreground/80", children: [
@@ -8188,7 +8270,7 @@ function SummaryRow({
8188
8270
  ] }) : null
8189
8271
  ] }),
8190
8272
  /* @__PURE__ */ jsxs("span", { className: "flex items-center gap-2 text-right", children: [
8191
- /* @__PURE__ */ jsx("span", { className: "text-foreground", children: value }),
8273
+ /* @__PURE__ */ jsx("span", { className: "text-foreground", title: valueTitle, children: value }),
8192
8274
  secondary ? /* @__PURE__ */ jsx("span", { className: "size-0.5 rounded-full bg-foreground/50" }) : null,
8193
8275
  secondary ? /* @__PURE__ */ jsx("span", { className: "text-foreground/60", children: secondary }) : null
8194
8276
  ] })
@@ -8485,18 +8567,17 @@ function sortFluentTransactionHistory(entries) {
8485
8567
  (left, right) => right.timestamp - left.timestamp || left.id.localeCompare(right.id)
8486
8568
  );
8487
8569
  }
8488
- var AMOUNT_FRACTION_DIGITS = 6;
8489
- var SMALLEST_SHOWN_AMOUNT = 10 ** -AMOUNT_FRACTION_DIGITS;
8490
- function isFluentDustAmount(amount) {
8570
+ function isFluentDustAmount(amount, fractionDigits = FLUENT_AMOUNT_FRACTION_DIGITS) {
8491
8571
  const numeric = Number(amount);
8492
- return Number.isFinite(numeric) && numeric > 0 && numeric < SMALLEST_SHOWN_AMOUNT;
8572
+ return Number.isFinite(numeric) && numeric > 0 && numeric < 10 ** -fractionDigits;
8493
8573
  }
8494
8574
  function formatFluentTransactionAmount(entry) {
8495
8575
  const sign = entry.direction === "sent" ? "\u2212" : "+";
8496
- if (isFluentDustAmount(entry.amount)) {
8497
- return `${sign}<0${FLUENT_DECIMAL_SEPARATOR}000001 ${entry.symbol}`;
8576
+ const digits = fluentAmountFractionDigits(entry.symbol);
8577
+ if (isFluentDustAmount(entry.amount, digits)) {
8578
+ return `${sign}<0${FLUENT_DECIMAL_SEPARATOR}${"1".padStart(digits, "0")} ${entry.symbol}`;
8498
8579
  }
8499
- return `${sign}${formatFluentLocaleAmount(entry.amount, AMOUNT_FRACTION_DIGITS)} ${entry.symbol}`;
8580
+ return `${sign}${formatFluentLocaleAmount(entry.amount, digits)} ${entry.symbol}`;
8500
8581
  }
8501
8582
  var HYPERLANE_GRAPHQL_ENDPOINT = "https://api.hyperlane.xyz/v1/graphql";
8502
8583
  var HYPERLANE_HISTORY_LIMIT = 25;
@@ -8968,12 +9049,14 @@ function PendingActivityRow({
8968
9049
  ] })
8969
9050
  ] }),
8970
9051
  /* @__PURE__ */ jsxs("span", { className: "flex shrink-0 flex-col items-end gap-1", children: [
8971
- /* @__PURE__ */ jsxs("span", { className: "text-sm font-medium leading-4 tabular-nums opacity-70", children: [
8972
- "\u2212",
8973
- formatFluentLocaleAmount(transfer.amount, 6),
8974
- " ",
8975
- transfer.symbol
8976
- ] }),
9052
+ /* @__PURE__ */ jsx(
9053
+ "span",
9054
+ {
9055
+ className: "text-sm font-medium leading-4 tabular-nums opacity-70",
9056
+ title: `${transfer.amount} ${transfer.symbol}`,
9057
+ children: formatFluentTransactionAmount({ ...transfer, direction: "sent" })
9058
+ }
9059
+ ),
8977
9060
  /* @__PURE__ */ jsx(ActivityUsd, { usd })
8978
9061
  ] })
8979
9062
  ] }) });
@@ -9063,6 +9146,7 @@ function ActivityAmount({
9063
9146
  return /* @__PURE__ */ jsx(
9064
9147
  "span",
9065
9148
  {
9149
+ title: `${movement.amount} ${movement.symbol}`,
9066
9150
  className: cn(
9067
9151
  "text-sm leading-4 tabular-nums",
9068
9152
  !secondary && "font-medium",
@@ -9312,7 +9396,7 @@ function FluentActivityDetail({
9312
9396
  const movements = entry.kind === "movement" ? [entry] : entry.movements;
9313
9397
  const swap = splitFluentSwap(movements);
9314
9398
  const headed = swap ? swap.received : movements;
9315
- const heading = headed.length > 0 ? headed.map(formatFluentTransactionAmount).join(", ") : FLUENT_TRANSACTION_OPERATION_LABEL;
9399
+ const heading = headed.length > 0 ? /* @__PURE__ */ jsx("span", { title: headed.map((movement) => `${movement.amount} ${movement.symbol}`).join(", "), children: headed.map(formatFluentTransactionAmount).join(", ") }) : FLUENT_TRANSACTION_OPERATION_LABEL;
9316
9400
  const rate = swap?.received.length === 1 && swap.paid.length === 1 ? formatSwapRate(swap.paid[0], swap.received[0]) : void 0;
9317
9401
  const openExplorer = explorerOpener(track);
9318
9402
  const transactionHash = entry.kind === "operation" ? entry.transactionHash : entry.hash;
@@ -9468,7 +9552,7 @@ function SwapSideRow({
9468
9552
  approximate = false
9469
9553
  }) {
9470
9554
  const usd = formatActivityUsd(movement.amount, priceOf(movement));
9471
- return /* @__PURE__ */ jsx(DetailRow, { label, children: /* @__PURE__ */ jsxs("span", { className: "tabular-nums", children: [
9555
+ return /* @__PURE__ */ jsx(DetailRow, { label, children: /* @__PURE__ */ jsxs("span", { className: "tabular-nums", title: `${movement.amount} ${movement.symbol}`, children: [
9472
9556
  approximate ? "\u2248 " : null,
9473
9557
  formatFluentTransactionAmount(movement).slice(1),
9474
9558
  usd ? /* @__PURE__ */ jsxs("span", { className: "font-normal text-muted-foreground", children: [
@@ -9568,7 +9652,7 @@ function DepositSwapActivityDetail({
9568
9652
  ActivityDetailHeader,
9569
9653
  {
9570
9654
  symbol: to.symbol,
9571
- heading: received ? `\u2248 ${formatFluentTransactionAmount(received)}` : `${formatFluentTransactionAmount(paid).slice(1)} \u2192 ${to.symbol}`,
9655
+ heading: /* @__PURE__ */ jsx("span", { title: `${(received ?? paid).amount} ${(received ?? paid).symbol}`, children: received ? `\u2248 ${formatFluentTransactionAmount(received)}` : `${formatFluentTransactionAmount(paid).slice(1)} \u2192 ${to.symbol}` }),
9572
9656
  usd: usd ? `${received ? "\u2248 " : ""}${usd}` : void 0,
9573
9657
  subtitle: `Deposit ${from.symbol} \u2192 ${to.symbol}`,
9574
9658
  timestamp: startedAt ?? Date.now(),
@@ -9633,6 +9717,76 @@ function DepositSwapActivityDetail({
9633
9717
  actionable ? /* @__PURE__ */ jsx(Button, { className: cn("w-full", riseIn("delay-500")), onClick: onOpenSwapPage, children: state.phase === "declined" || state.phase === "error" ? `Swap to ${to.symbol}` : "Open the Swap page" }) : null
9634
9718
  ] });
9635
9719
  }
9720
+ function SentTransferDetail({
9721
+ transfer,
9722
+ account,
9723
+ network,
9724
+ priceOf,
9725
+ track
9726
+ }) {
9727
+ const openExplorer = explorerOpener(track);
9728
+ const movement = { amount: transfer.amount, direction: "sent", symbol: transfer.symbol };
9729
+ return /* @__PURE__ */ jsxs("div", { className: "flex w-full flex-col gap-2.5", children: [
9730
+ /* @__PURE__ */ jsx(
9731
+ ActivityDetailHeader,
9732
+ {
9733
+ symbol: transfer.symbol,
9734
+ heading: /* @__PURE__ */ jsx("span", { title: `${transfer.amount} ${transfer.symbol}`, children: formatFluentTransactionAmount(movement) }),
9735
+ usd: formatActivityUsd(
9736
+ transfer.amount,
9737
+ priceOf({ identity: transfer.tokenIdentity, symbol: transfer.symbol })
9738
+ ),
9739
+ subtitle: "Sent",
9740
+ timestamp: transfer.startedAt,
9741
+ entrance: true
9742
+ }
9743
+ ),
9744
+ /* @__PURE__ */ jsxs(
9745
+ "dl",
9746
+ {
9747
+ className: cn("flex flex-col gap-5 text-sm bg-white/5 p-4 rounded-2xl", riseIn("delay-300")),
9748
+ children: [
9749
+ /* @__PURE__ */ jsx(DetailRow, { label: "Status", children: /* @__PURE__ */ jsx(
9750
+ "span",
9751
+ {
9752
+ className: "inline-flex items-center gap-1.5 animate-in fade-in-0 zoom-in-90 duration-300 ease-out motion-reduce:animate-none",
9753
+ children: transfer.hash ? /* @__PURE__ */ jsx("span", { className: "text-green-400", children: "Confirmed" }) : /* @__PURE__ */ jsxs(Fragment, { children: [
9754
+ /* @__PURE__ */ jsx(Spinner, { className: "size-3.5 text-muted-foreground" }),
9755
+ /* @__PURE__ */ jsx("span", { className: "text-foreground/70", children: "Pending" })
9756
+ ] })
9757
+ },
9758
+ transfer.hash ? "confirmed" : "pending"
9759
+ ) }),
9760
+ /* @__PURE__ */ jsx(DetailRow, { label: "From", children: /* @__PURE__ */ jsx("span", { title: account, children: formatAddress(account) }) }),
9761
+ /* @__PURE__ */ jsx(DetailRow, { label: "To", children: /* @__PURE__ */ jsx(
9762
+ HashMenu,
9763
+ {
9764
+ hash: transfer.to,
9765
+ url: explorerAddress(transfer.to, network),
9766
+ onOpen: (url) => openExplorer(url, "explorer"),
9767
+ label: "Address"
9768
+ }
9769
+ ) }),
9770
+ /* @__PURE__ */ jsx(FluentNetworkRow, { network })
9771
+ ]
9772
+ }
9773
+ ),
9774
+ transfer.hash ? /* @__PURE__ */ jsx(
9775
+ "dl",
9776
+ {
9777
+ className: cn("flex flex-col gap-5 text-sm bg-white/5 p-4 rounded-2xl", riseIn("delay-100")),
9778
+ children: /* @__PURE__ */ jsx(DetailRow, { label: "Transaction ID", children: /* @__PURE__ */ jsx(
9779
+ HashMenu,
9780
+ {
9781
+ hash: transfer.hash,
9782
+ url: explorerTransaction(transfer.hash, network),
9783
+ onOpen: (url) => openExplorer(url, "transaction")
9784
+ }
9785
+ ) })
9786
+ }
9787
+ ) : null
9788
+ ] });
9789
+ }
9636
9790
  var FLUENT_RPC_TIMEOUT_MS = 3e4;
9637
9791
  var FLUENT_RPC_RETRY_COUNT = 3;
9638
9792
  var FLUENT_RPC_RETRY_DELAY_MS = 300;
@@ -9763,11 +9917,6 @@ function validateBridgeAmount({
9763
9917
  }
9764
9918
  return { wei, incomplete: false };
9765
9919
  }
9766
- var TOKEN_ICONS = {
9767
- ETH: "eth",
9768
- USDnr: "usdnr",
9769
- USDC: "usdc"
9770
- };
9771
9920
  function TokenChainIcon({
9772
9921
  symbol,
9773
9922
  chain,
@@ -9777,7 +9926,7 @@ function TokenChainIcon({
9777
9926
  }) {
9778
9927
  const visual = trusted ? VISUAL_BY_DEFAULT_SYMBOL[symbol] : void 0;
9779
9928
  const badge = chain === "source" ? CHAIN_BADGE.l1_to_l2 : CHAIN_BADGE.l2_to_l1;
9780
- const icon = trusted ? TOKEN_ICONS[symbol] ?? visual?.icon : void 0;
9929
+ const icon = visual?.icon;
9781
9930
  const onBrandTile = visual?.iconClassName.includes("text-white");
9782
9931
  const large = size === "lg";
9783
9932
  const glyph = large ? "size-5" : "size-4";
@@ -9974,8 +10123,9 @@ function formatEstimatedFee(params) {
9974
10123
  };
9975
10124
  }
9976
10125
  return {
9977
- value: `\u2248 ${formatAmount(inFeeToken, feeToken.decimals)} ${feeToken.symbol}`,
9978
- secondary: usdOf(inFeeToken, feeToken.decimals, usdPrices[feeToken.identity])
10126
+ value: `\u2248 ${formatAmount(inFeeToken, feeToken.decimals, feeToken.symbol)} ${feeToken.symbol}`,
10127
+ secondary: usdOf(inFeeToken, feeToken.decimals, usdPrices[feeToken.identity]),
10128
+ exact: `${formatUnits(inFeeToken, feeToken.decimals)} ${feeToken.symbol}`
9979
10129
  };
9980
10130
  }
9981
10131
  function SendTokenForm({
@@ -10028,7 +10178,7 @@ function SendTokenForm({
10028
10178
  decimals: token.decimals,
10029
10179
  balance: rawBalance
10030
10180
  }) : null;
10031
- const balanceNote = token && rawBalance !== null ? `${formatAmount(rawBalance, token.decimals)} ${token.symbol}` : balancesBusy ? "Loading balance..." : "Balance unavailable";
10181
+ const balanceNote = token && rawBalance !== null ? `${formatAmount(rawBalance, token.decimals, token.symbol)} ${token.symbol}` : balancesBusy ? "Loading balance..." : "Balance unavailable";
10032
10182
  const amountUsd = token ? formatAmountUsd(amount, usdPrices[token.identity]) : void 0;
10033
10183
  const fee = feeToken ? checkFluentTransferFee({
10034
10184
  feeToken,
@@ -10058,9 +10208,15 @@ function SendTokenForm({
10058
10208
  const feeSponsored = Boolean(feeToken && isFluentNativeToken(feeToken) && sponsorshipAvailable);
10059
10209
  const feeBalanceLabel = (candidate) => {
10060
10210
  const entry = balanceByIdentity.get(candidate.identity);
10061
- if (entry?.status === "ready" && entry.raw !== null) return formatAmount(entry.raw, candidate.decimals);
10211
+ if (entry?.status === "ready" && entry.raw !== null) {
10212
+ return formatAmount(entry.raw, candidate.decimals, candidate.symbol);
10213
+ }
10062
10214
  return balancesBusy ? "\u2026" : "\u2014";
10063
10215
  };
10216
+ const feeBalanceExact = (candidate) => {
10217
+ const entry = balanceByIdentity.get(candidate.identity);
10218
+ return entry?.status === "ready" && entry.raw !== null ? formatUnits(entry.raw, candidate.decimals) : void 0;
10219
+ };
10064
10220
  const ready = Boolean(token) && recipientCheck.status === "ok" && amountCheck?.status === "ok" && fee.status !== "blocked" && !sending;
10065
10221
  const handleSend = async () => {
10066
10222
  if (!token || !feeToken) return;
@@ -10229,7 +10385,14 @@ function SendTokenForm({
10229
10385
  /* @__PURE__ */ jsx(SelectContent, { align: "end", alignItemWithTrigger: false, className: "min-w-52", children: gasTokens.map((candidate) => /* @__PURE__ */ jsxs(SelectItem, { value: candidate.identity, children: [
10230
10386
  /* @__PURE__ */ jsx(TokenGlyph, { token: candidate, className: "size-5" }),
10231
10387
  /* @__PURE__ */ jsx("span", { children: candidate.symbol }),
10232
- /* @__PURE__ */ jsx("span", { className: "ml-auto pl-4 text-foreground/60", children: feeBalanceLabel(candidate) })
10388
+ /* @__PURE__ */ jsx(
10389
+ "span",
10390
+ {
10391
+ className: "ml-auto pl-4 text-foreground/60",
10392
+ title: feeBalanceExact(candidate),
10393
+ children: feeBalanceLabel(candidate)
10394
+ }
10395
+ )
10233
10396
  ] }, candidate.identity)) })
10234
10397
  ]
10235
10398
  }
@@ -10243,6 +10406,7 @@ function SendTokenForm({
10243
10406
  {
10244
10407
  label: "Est. network fee",
10245
10408
  value: estimatedFee.value,
10409
+ valueTitle: estimatedFee.exact,
10246
10410
  secondary: estimatedFee.secondary,
10247
10411
  tooltip: feeSponsored ? "What the network charges for this transfer. The app may cover it; the review shows the exact amount." : "What the network charges for this transfer, converted to the fee token at today's rate. The review shows the exact amount."
10248
10412
  }
@@ -10732,6 +10896,7 @@ function useFluentUserTokens(options) {
10732
10896
  }
10733
10897
 
10734
10898
  // src/hooks/useFluentTokenBalances.ts
10899
+ var FLUENT_BALANCE_POLL_INTERVAL_MS = 1e4;
10735
10900
  function useFluentTokenBalances(params) {
10736
10901
  const { network, chain } = useFluentWidgetNetwork();
10737
10902
  const defaultTokens = useMemo(
@@ -10763,35 +10928,43 @@ function useFluentTokenBalances(params) {
10763
10928
  const [busy, setBusy] = useState(false);
10764
10929
  const [status, setStatus] = useState("Connect a Fluent account");
10765
10930
  const inFlight = useRef(null);
10766
- const refresh = useCallback(async () => {
10767
- inFlight.current?.abort();
10768
- const controller = new AbortController();
10769
- inFlight.current = controller;
10770
- const { signal } = controller;
10771
- if (!params.accountAddress) {
10772
- setBalances([]);
10773
- setStatus("Connect a Fluent account");
10774
- return;
10775
- }
10776
- setBusy(true);
10777
- setStatus("Checking token balances");
10778
- try {
10779
- const next = await readFluentTokenBalances({
10780
- client: publicClient,
10781
- account: params.accountAddress,
10782
- tokens: displayTokens
10783
- });
10784
- if (signal.aborted) return;
10785
- setBalances(next);
10786
- setStatus("Balances updated");
10787
- } catch {
10788
- if (signal.aborted) return;
10789
- setBalances([]);
10790
- setStatus("Could not load balances");
10791
- } finally {
10792
- if (!signal.aborted) setBusy(false);
10793
- }
10794
- }, [displayTokens, params.accountAddress, publicClient]);
10931
+ const refresh = useCallback(
10932
+ async (options) => {
10933
+ if (options?.quiet && inFlight.current) return;
10934
+ inFlight.current?.abort();
10935
+ const controller = new AbortController();
10936
+ inFlight.current = controller;
10937
+ const { signal } = controller;
10938
+ if (!params.accountAddress) {
10939
+ setBalances([]);
10940
+ setStatus("Connect a Fluent account");
10941
+ return;
10942
+ }
10943
+ if (!options?.quiet) {
10944
+ setBusy(true);
10945
+ setStatus("Checking token balances");
10946
+ }
10947
+ try {
10948
+ const next = await readFluentTokenBalances({
10949
+ client: publicClient,
10950
+ account: params.accountAddress,
10951
+ tokens: displayTokens
10952
+ });
10953
+ if (signal.aborted) return;
10954
+ setBalances(next);
10955
+ setStatus("Balances updated");
10956
+ } catch {
10957
+ if (signal.aborted) return;
10958
+ if (options?.quiet) return;
10959
+ setBalances([]);
10960
+ setStatus("Could not load balances");
10961
+ } finally {
10962
+ if (inFlight.current === controller) inFlight.current = null;
10963
+ if (!signal.aborted && !options?.quiet) setBusy(false);
10964
+ }
10965
+ },
10966
+ [displayTokens, params.accountAddress, publicClient]
10967
+ );
10795
10968
  useEffect(() => {
10796
10969
  setBalances([]);
10797
10970
  setStatus(
@@ -10802,6 +10975,15 @@ function useFluentTokenBalances(params) {
10802
10975
  refresh();
10803
10976
  return () => inFlight.current?.abort();
10804
10977
  }, [refresh, params.revisionCounter]);
10978
+ const { pollIntervalMs } = params;
10979
+ useEffect(() => {
10980
+ if (!pollIntervalMs || !params.accountAddress) return;
10981
+ const timer = setInterval(() => {
10982
+ if (typeof document !== "undefined" && document.visibilityState === "hidden") return;
10983
+ void refresh({ quiet: true });
10984
+ }, pollIntervalMs);
10985
+ return () => clearInterval(timer);
10986
+ }, [pollIntervalMs, params.accountAddress, refresh]);
10805
10987
  return {
10806
10988
  /** Balances for every display token, in display order. */
10807
10989
  balances,
@@ -10848,11 +11030,15 @@ function formatFluentPortfolioPnlAbsolute(delta) {
10848
11030
  return `$ ${sign}${whole}${separator}${fraction}`;
10849
11031
  }
10850
11032
  function formatFluentPortfolioPnlPercent(percent) {
10851
- return `${formatFluentLocaleAmount(Math.abs(percent), 2)}%`;
11033
+ const sign = percent >= 0 ? "+" : "\u2212";
11034
+ return `${sign}${formatFluentLocaleAmount(Math.abs(percent), 2)}%`;
10852
11035
  }
10853
11036
 
10854
11037
  // src/core/tokenPrices.ts
10855
11038
  var COINGECKO_API = "https://api.coingecko.com/api/v3";
11039
+ var DEFILLAMA_COINS_API = "https://coins.llama.fi";
11040
+ var FLUENT_PRICE_REQUEST_TIMEOUT_MS = 5e3;
11041
+ var DEFILLAMA_FLUENT_MAINNET_CHAIN = "fluent";
10856
11042
  var FIXED_USD_PRICES = {
10857
11043
  USDnr: 1
10858
11044
  };
@@ -10874,21 +11060,44 @@ function getCoinGeckoMarketChartRangeUrl(coinId, fromUnixSeconds, toUnixSeconds)
10874
11060
  url.searchParams.set("to", String(toUnixSeconds));
10875
11061
  return url.toString();
10876
11062
  }
11063
+ function getDefiLlamaCurrentPricesUrl(coinKeys) {
11064
+ return `${DEFILLAMA_COINS_API}/prices/current/${coinKeys.join(",")}`;
11065
+ }
11066
+ function getDefiLlamaHistoricalPricesUrl(coinKeys, unixSeconds) {
11067
+ return `${DEFILLAMA_COINS_API}/prices/historical/${unixSeconds}/${coinKeys.join(",")}`;
11068
+ }
10877
11069
  function resolveCoinbaseBaseSymbol(symbol) {
10878
11070
  return COINBASE_BASE_BY_SYMBOL[symbol] ?? null;
10879
11071
  }
10880
11072
  function resolveCoinGeckoCoinId(symbol) {
10881
11073
  return COINGECKO_COIN_ID_BY_SYMBOL[symbol] ?? null;
10882
11074
  }
11075
+ function resolveDefiLlamaCoinKey(token) {
11076
+ if (!token.native && token.address && token.chainId === fluentMainnet.id) {
11077
+ return `${DEFILLAMA_FLUENT_MAINNET_CHAIN}:${token.address}`;
11078
+ }
11079
+ const coinId = resolveCoinGeckoCoinId(token.symbol);
11080
+ return coinId ? `coingecko:${coinId}` : null;
11081
+ }
10883
11082
  function getFixedUsdPrice(symbol) {
10884
11083
  return FIXED_USD_PRICES[symbol] ?? null;
10885
11084
  }
11085
+ async function fetchWithTimeout(url) {
11086
+ const controller = new AbortController();
11087
+ const timer = setTimeout(() => controller.abort(), FLUENT_PRICE_REQUEST_TIMEOUT_MS);
11088
+ try {
11089
+ return await fetch(url, {
11090
+ headers: {
11091
+ Accept: "application/json"
11092
+ },
11093
+ signal: controller.signal
11094
+ });
11095
+ } finally {
11096
+ clearTimeout(timer);
11097
+ }
11098
+ }
10886
11099
  async function fetchJson(url, provider) {
10887
- const response = await fetch(url, {
10888
- headers: {
10889
- Accept: "application/json"
10890
- }
10891
- });
11100
+ const response = await fetchWithTimeout(url);
10892
11101
  if (!response.ok) {
10893
11102
  const body = await response.text();
10894
11103
  throw new Error(`${provider} request failed: ${response.status} ${body}`);
@@ -10897,12 +11106,13 @@ async function fetchJson(url, provider) {
10897
11106
  }
10898
11107
  async function fetchCoinbaseSpotUsdPrice(coinbaseSymbol) {
10899
11108
  try {
10900
- const response = await fetch(getCoinbaseSpotPriceUrl(coinbaseSymbol));
11109
+ const response = await fetchWithTimeout(getCoinbaseSpotPriceUrl(coinbaseSymbol));
10901
11110
  if (!response.ok) return null;
10902
11111
  const payload = await response.json();
10903
11112
  const amount = Number(payload.data?.amount);
10904
11113
  return Number.isFinite(amount) ? amount : null;
10905
- } catch {
11114
+ } catch (error) {
11115
+ debugWarn("[fluent-connect] Coinbase spot price request failed", coinbaseSymbol, error);
10906
11116
  return null;
10907
11117
  }
10908
11118
  }
@@ -10931,97 +11141,222 @@ async function fetchCoinGeckoPrice24hAgo(coinId) {
10931
11141
  }
10932
11142
  return price24hAgo;
10933
11143
  }
10934
- async function fetchFluentTokenUsdPricePoints(symbols2) {
10935
- const unique = [...new Set(symbols2)];
10936
- const entries = await Promise.all(
10937
- unique.map(async (symbol) => {
10938
- const fixed = getFixedUsdPrice(symbol);
10939
- if (fixed !== null) {
10940
- return [symbol, { current: fixed, price24hAgo: fixed }];
10941
- }
10942
- const coinbaseSymbol = resolveCoinbaseBaseSymbol(symbol);
10943
- const coinGeckoCoinId = resolveCoinGeckoCoinId(symbol);
10944
- if (!coinbaseSymbol || !coinGeckoCoinId) return null;
10945
- try {
10946
- const current = await fetchCoinbaseSpotUsdPrice(coinbaseSymbol);
10947
- if (current === null) return null;
10948
- let price24hAgo = current;
10949
- try {
10950
- price24hAgo = await fetchCoinGeckoPrice24hAgo(coinGeckoCoinId);
10951
- } catch {
10952
- }
10953
- return [symbol, { current, price24hAgo }];
10954
- } catch {
10955
- return null;
10956
- }
11144
+ async function fetchDefiLlamaUsdPrices(url) {
11145
+ const prices = /* @__PURE__ */ new Map();
11146
+ try {
11147
+ const payload = await fetchJson(url, "DefiLlama");
11148
+ for (const [coinKey, coin] of Object.entries(payload.coins ?? {})) {
11149
+ const price = coin?.price;
11150
+ if (typeof price !== "number" || !Number.isFinite(price)) continue;
11151
+ prices.set(coinKey.toLowerCase(), price);
11152
+ }
11153
+ } catch (error) {
11154
+ debugWarn("[fluent-connect] DefiLlama price request failed", error);
11155
+ }
11156
+ return prices;
11157
+ }
11158
+ function getFluentPriceableTokens(tokens) {
11159
+ return tokens.filter((token) => isFluentDefaultToken(token));
11160
+ }
11161
+ async function fetchFluentTokenUsdPricePoints(tokens) {
11162
+ const subjects = /* @__PURE__ */ new Map();
11163
+ for (const token of getFluentPriceableTokens(tokens)) {
11164
+ subjects.set(fluentTokenIdentity(token), token);
11165
+ }
11166
+ const current = /* @__PURE__ */ new Map();
11167
+ const price24hAgo = /* @__PURE__ */ new Map();
11168
+ const fetched = [];
11169
+ for (const [identity, token] of subjects) {
11170
+ const fixed = getFixedUsdPrice(token.symbol);
11171
+ if (fixed !== null) {
11172
+ current.set(identity, fixed);
11173
+ price24hAgo.set(identity, fixed);
11174
+ } else {
11175
+ fetched.push([identity, token]);
11176
+ }
11177
+ }
11178
+ await Promise.all(
11179
+ fetched.map(async ([identity, token]) => {
11180
+ const coinbaseSymbol = resolveCoinbaseBaseSymbol(token.symbol);
11181
+ const coinGeckoCoinId = resolveCoinGeckoCoinId(token.symbol);
11182
+ const [spot, chart] = await Promise.all([
11183
+ coinbaseSymbol ? fetchCoinbaseSpotUsdPrice(coinbaseSymbol) : null,
11184
+ coinGeckoCoinId ? fetchCoinGeckoPrice24hAgo(coinGeckoCoinId).catch((error) => {
11185
+ debugWarn("[fluent-connect] CoinGecko chart request failed", coinGeckoCoinId, error);
11186
+ return null;
11187
+ }) : null
11188
+ ]);
11189
+ if (spot !== null) current.set(identity, spot);
11190
+ if (chart !== null) price24hAgo.set(identity, chart);
10957
11191
  })
10958
11192
  );
11193
+ const missingCurrent = coinKeysOf(fetched.filter(([identity]) => !current.has(identity)));
11194
+ const missing24hAgo = coinKeysOf(fetched.filter(([identity]) => !price24hAgo.has(identity)));
11195
+ const nowUnixSeconds = Math.floor(Date.now() / 1e3);
11196
+ const [llamaCurrent, llama24hAgo] = await Promise.all([
11197
+ missingCurrent.size > 0 ? fetchDefiLlamaUsdPrices(getDefiLlamaCurrentPricesUrl(uniqueCoinKeys(missingCurrent))) : /* @__PURE__ */ new Map(),
11198
+ missing24hAgo.size > 0 ? fetchDefiLlamaUsdPrices(
11199
+ getDefiLlamaHistoricalPricesUrl(
11200
+ uniqueCoinKeys(missing24hAgo),
11201
+ nowUnixSeconds - 24 * 60 * 60
11202
+ )
11203
+ ) : /* @__PURE__ */ new Map()
11204
+ ]);
11205
+ applyDefiLlamaPrices(missingCurrent, llamaCurrent, current);
11206
+ applyDefiLlamaPrices(missing24hAgo, llama24hAgo, price24hAgo);
11207
+ const points = {};
11208
+ for (const identity of subjects.keys()) {
11209
+ const currentPrice = current.get(identity);
11210
+ if (currentPrice === void 0) continue;
11211
+ points[identity] = {
11212
+ current: currentPrice,
11213
+ price24hAgo: price24hAgo.get(identity) ?? currentPrice
11214
+ };
11215
+ }
11216
+ return points;
11217
+ }
11218
+ function coinKeysOf(entries) {
11219
+ const keys = /* @__PURE__ */ new Map();
11220
+ for (const [identity, token] of entries) {
11221
+ const coinKey = resolveDefiLlamaCoinKey(token);
11222
+ if (coinKey) keys.set(identity, coinKey);
11223
+ }
11224
+ return keys;
11225
+ }
11226
+ function uniqueCoinKeys(keysByIdentity) {
11227
+ return [...new Set(keysByIdentity.values())];
11228
+ }
11229
+ function applyDefiLlamaPrices(keysByIdentity, pricesByCoinKey, target) {
11230
+ for (const [identity, coinKey] of keysByIdentity) {
11231
+ const price = pricesByCoinKey.get(coinKey.toLowerCase());
11232
+ if (price !== void 0) target.set(identity, price);
11233
+ }
11234
+ }
11235
+ var FLUENT_TOKEN_PRICE_TTL_MS = 5 * 6e4;
11236
+ var priceCache = /* @__PURE__ */ new Map();
11237
+ var priceInFlight = /* @__PURE__ */ new Map();
11238
+ function isFreshPriceEntry(entry, now) {
11239
+ return entry !== void 0 && now - entry.readAt < FLUENT_TOKEN_PRICE_TTL_MS;
11240
+ }
11241
+ function peekFluentTokenUsdPricePoints(tokens, now = Date.now()) {
10959
11242
  const prices = {};
10960
- for (const entry of entries) {
10961
- if (!entry) continue;
10962
- prices[entry[0]] = entry[1];
11243
+ for (const token of getFluentPriceableTokens(tokens)) {
11244
+ const identity = fluentTokenIdentity(token);
11245
+ const fixed = getFixedUsdPrice(token.symbol);
11246
+ if (fixed !== null) {
11247
+ prices[identity] = { current: fixed, price24hAgo: fixed };
11248
+ continue;
11249
+ }
11250
+ const entry = priceCache.get(identity);
11251
+ if (isFreshPriceEntry(entry, now) && entry?.point) prices[identity] = entry.point;
10963
11252
  }
10964
11253
  return prices;
10965
11254
  }
11255
+ function getFluentTokenUsdPriceExpiry(tokens) {
11256
+ let expiry = null;
11257
+ for (const token of getFluentPriceableTokens(tokens)) {
11258
+ const entry = priceCache.get(fluentTokenIdentity(token));
11259
+ if (!entry) continue;
11260
+ const at = entry.readAt + FLUENT_TOKEN_PRICE_TTL_MS;
11261
+ if (expiry === null || at < expiry) expiry = at;
11262
+ }
11263
+ return expiry;
11264
+ }
11265
+ async function readFluentTokenUsdPricePoints(tokens, now = Date.now()) {
11266
+ const points = {};
11267
+ const awaited = [];
11268
+ const toAsk = /* @__PURE__ */ new Map();
11269
+ for (const token of getFluentPriceableTokens(tokens)) {
11270
+ const identity = fluentTokenIdentity(token);
11271
+ const fixed = getFixedUsdPrice(token.symbol);
11272
+ if (fixed !== null) {
11273
+ points[identity] = { current: fixed, price24hAgo: fixed };
11274
+ continue;
11275
+ }
11276
+ const cached = priceCache.get(identity);
11277
+ if (isFreshPriceEntry(cached, now)) {
11278
+ if (cached?.point) points[identity] = cached.point;
11279
+ continue;
11280
+ }
11281
+ const inFlight = priceInFlight.get(identity);
11282
+ if (inFlight) {
11283
+ awaited.push([identity, inFlight]);
11284
+ continue;
11285
+ }
11286
+ toAsk.set(identity, token);
11287
+ }
11288
+ if (toAsk.size > 0) {
11289
+ const batch = fetchFluentTokenUsdPricePoints([...toAsk.values()]);
11290
+ for (const identity of toAsk.keys()) {
11291
+ const pending2 = batch.then((fetched) => {
11292
+ const point = fetched[identity] ?? null;
11293
+ priceCache.set(identity, { point, readAt: Date.now() });
11294
+ return point;
11295
+ });
11296
+ priceInFlight.set(identity, pending2);
11297
+ void pending2.finally(() => {
11298
+ if (priceInFlight.get(identity) === pending2) priceInFlight.delete(identity);
11299
+ });
11300
+ awaited.push([identity, pending2]);
11301
+ }
11302
+ }
11303
+ for (const [identity, pending2] of awaited) {
11304
+ const point = await pending2;
11305
+ if (point) points[identity] = point;
11306
+ }
11307
+ return points;
11308
+ }
10966
11309
  function splitFluentTokenUsdPricePoints(points) {
10967
11310
  const prices = {};
10968
11311
  const prices24hAgo = {};
10969
- for (const [symbol, point] of Object.entries(points)) {
10970
- prices[symbol] = point.current;
10971
- prices24hAgo[symbol] = point.price24hAgo;
11312
+ for (const [identity, point] of Object.entries(points)) {
11313
+ prices[identity] = point.current;
11314
+ prices24hAgo[identity] = point.price24hAgo;
10972
11315
  }
10973
11316
  return { prices, prices24hAgo };
10974
11317
  }
10975
- function getFluentPriceableSymbols(tokens) {
10976
- return tokens.filter(isFluentDefaultToken).map((token) => token.symbol);
10977
- }
10978
- function mapFluentPricesToTokenIdentities(tokens, pricesBySymbol) {
10979
- const byIdentity = {};
10980
- for (const token of tokens) {
10981
- if (!isFluentDefaultToken(token)) continue;
10982
- const price = pricesBySymbol[token.symbol];
10983
- if (price === void 0) continue;
10984
- byIdentity[fluentTokenIdentity(token)] = price;
10985
- }
10986
- return byIdentity;
10987
- }
10988
11318
 
10989
11319
  // src/hooks/useFluentTokenUsdPrices.ts
10990
11320
  function useFluentTokenUsdPrices(tokens) {
10991
- const symbolKey = useMemo(
10992
- () => getFluentPriceableSymbols(tokens).sort().join(","),
11321
+ const subjectKey = useMemo(
11322
+ () => getFluentPriceableTokens(tokens).map(fluentTokenIdentity).sort().join(","),
10993
11323
  [tokens]
10994
11324
  );
10995
- const [pricesBySymbol, setPricesBySymbol] = useState({});
10996
- const [pricesBySymbolYesterday, setPricesBySymbolYesterday] = useState({});
10997
- const [busy, setBusy] = useState(() => Boolean(symbolKey));
11325
+ const [points, setPoints] = useState({});
11326
+ const [busy, setBusy] = useState(() => Boolean(subjectKey));
10998
11327
  useEffect(() => {
10999
- if (!symbolKey) {
11000
- setPricesBySymbol({});
11001
- setPricesBySymbolYesterday({});
11328
+ if (!subjectKey) {
11329
+ setPoints({});
11002
11330
  setBusy(false);
11003
11331
  return;
11004
11332
  }
11333
+ const subjects = getFluentPriceableTokens(tokens);
11005
11334
  let active = true;
11006
- setBusy(true);
11007
- fetchFluentTokenUsdPricePoints(symbolKey.split(",")).then((points) => {
11008
- if (!active) return;
11009
- const next = splitFluentTokenUsdPricePoints(points);
11010
- setPricesBySymbol(next.prices);
11011
- setPricesBySymbolYesterday(next.prices24hAgo);
11335
+ let timer;
11336
+ const apply = (next) => {
11337
+ setPoints(next);
11012
11338
  setBusy(false);
11013
- });
11339
+ };
11340
+ const load = async () => {
11341
+ const next = await readFluentTokenUsdPricePoints(subjects);
11342
+ if (!active) return;
11343
+ apply(next);
11344
+ const expiry = getFluentTokenUsdPriceExpiry(subjects);
11345
+ if (expiry !== null) timer = setTimeout(load, Math.max(0, expiry - Date.now()));
11346
+ };
11347
+ const cached = peekFluentTokenUsdPricePoints(subjects);
11348
+ const everyCached = subjects.every((token) => fluentTokenIdentity(token) in cached);
11349
+ if (everyCached) apply(cached);
11350
+ else setBusy(true);
11351
+ void load();
11014
11352
  return () => {
11015
11353
  active = false;
11354
+ if (timer !== void 0) clearTimeout(timer);
11016
11355
  };
11017
- }, [symbolKey]);
11018
- const prices = useMemo(
11019
- () => mapFluentPricesToTokenIdentities(tokens, pricesBySymbol),
11020
- [tokens, pricesBySymbol]
11021
- );
11022
- const pricesYesterday = useMemo(
11023
- () => mapFluentPricesToTokenIdentities(tokens, pricesBySymbolYesterday),
11024
- [tokens, pricesBySymbolYesterday]
11356
+ }, [subjectKey]);
11357
+ const { prices, prices24hAgo: pricesYesterday } = useMemo(
11358
+ () => splitFluentTokenUsdPricePoints(points),
11359
+ [points]
11025
11360
  );
11026
11361
  return { prices, pricesYesterday, busy };
11027
11362
  }
@@ -11145,12 +11480,14 @@ function useFluentTransactionHistory(params) {
11145
11480
 
11146
11481
  // src/widget/walletMenuSubPages.ts
11147
11482
  var DEPOSIT_SWAP_TAB = "deposit-swap";
11483
+ var SENT_TRANSFER_TAB = "sent-transfer";
11148
11484
  var WALLET_MENU_SUB_PAGES = {
11149
11485
  settings: { title: "Settings" },
11150
11486
  send: { title: "Send" },
11151
11487
  bridge: { title: "Swap" },
11152
11488
  activity: { title: "Transfer" },
11153
11489
  [DEPOSIT_SWAP_TAB]: { title: "Transfer" },
11490
+ [SENT_TRANSFER_TAB]: { title: "Transfer" },
11154
11491
  // Closed with an X, not walked back from: leaving it is the rejection.
11155
11492
  review: { title: "Confirm transaction", dismiss: "close" }
11156
11493
  };
@@ -11617,7 +11954,7 @@ function ReputationFamilyCard({ family, tier }) {
11617
11954
  const accent = FLUENT_FAMILY_ACCENTS[family] ?? FLUENT_FAMILY_FALLBACK_ACCENT;
11618
11955
  const labels = FLUENT_FAMILY_LABELS[family];
11619
11956
  const progress = FLUENT_FAMILY_TIER_PROGRESS[tier] ?? 0;
11620
- return /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-2.5 rounded-xl border border-foreground/15 bg-background/40 p-3", children: [
11957
+ return /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-2.5 rounded-xl bg-white/5 p-3", children: [
11621
11958
  /* @__PURE__ */ jsx("span", { className: "text-[10px] font-medium uppercase tracking-[0.06em] text-foreground/60", children: FLUENT_FAMILY_DISPLAY_NAMES[family] ?? family }),
11622
11959
  /* @__PURE__ */ jsx(
11623
11960
  "div",
@@ -11691,6 +12028,7 @@ function WalletMenuActionCard({
11691
12028
  tokenListError = null,
11692
12029
  onSendToken,
11693
12030
  pendingTransfers,
12031
+ sentTransfer,
11694
12032
  sentDeposits,
11695
12033
  depositSwap,
11696
12034
  onMintUsdnr,
@@ -11703,7 +12041,8 @@ function WalletMenuActionCard({
11703
12041
  }) {
11704
12042
  const resolvedConfig = resolveFluentWidgetConfig(config);
11705
12043
  const [ownPanel, setOwnPanel] = useState("tokens");
11706
- const homePanel = panel ?? ownPanel;
12044
+ const requestedPanel = panel ?? ownPanel;
12045
+ const homePanel = requestedPanel === "reputation" && !resolvedConfig.reputationEnabled ? "tokens" : requestedPanel;
11707
12046
  const setHomePanel = onPanelChange ?? setOwnPanel;
11708
12047
  const queryClient2 = useContext(QueryClientContext);
11709
12048
  const [historyRevision, setHistoryRevision] = useState(0);
@@ -11862,7 +12201,12 @@ function WalletMenuActionCard({
11862
12201
  accountAddress,
11863
12202
  tokens,
11864
12203
  revisionCounter: balanceRevisionCounter,
11865
- userTokenStore
12204
+ userTokenStore,
12205
+ // The account drawer unmounts its content when it closes, so this card is
12206
+ // mounted exactly while the wallet menu is open: the mount reads once for
12207
+ // the opening, and the schedule catches transfers that arrive from outside
12208
+ // the widget while it stays open.
12209
+ pollIntervalMs: FLUENT_BALANCE_POLL_INTERVAL_MS
11866
12210
  });
11867
12211
  const { prices, pricesYesterday, busy: pricesBusy } = useFluentTokenUsdPrices(displayTokens);
11868
12212
  const activityPriceOf = useActivityPrices(prices, displayTokens);
@@ -12052,12 +12396,25 @@ function WalletMenuActionCard({
12052
12396
  onSend: onSendToken,
12053
12397
  onSent: () => {
12054
12398
  setHomePanel("activity");
12055
- onTabChange("home");
12399
+ onTabChange(SENT_TRANSFER_TAB);
12056
12400
  onRevealAccount?.();
12057
12401
  }
12058
12402
  }
12059
12403
  );
12060
12404
  }
12405
+ if (tab === SENT_TRANSFER_TAB) {
12406
+ if (!sentTransfer || !accountAddress) return null;
12407
+ return /* @__PURE__ */ jsx(
12408
+ SentTransferDetail,
12409
+ {
12410
+ transfer: sentTransfer,
12411
+ account: accountAddress,
12412
+ network: resolvedConfig.network,
12413
+ priceOf: activityPriceOf,
12414
+ track
12415
+ }
12416
+ );
12417
+ }
12061
12418
  if (tab === DEPOSIT_SWAP_TAB) {
12062
12419
  if (!depositSwap || !accountAddress) return null;
12063
12420
  return /* @__PURE__ */ jsx(
@@ -12092,283 +12449,238 @@ function WalletMenuActionCard({
12092
12449
  }
12093
12450
  );
12094
12451
  }
12095
- return (
12096
- // With Reputation off, Home is the only panel: the strip goes away, and the
12097
- // active value is pinned so a `tab` left on "reputation" can't blank the card.
12098
- /* @__PURE__ */ jsxs(
12099
- Tabs,
12100
- {
12101
- value: reputationEnabled ? tab : "home",
12102
- onValueChange: onTabChange,
12103
- className: "w-full flex flex-col",
12104
- children: [
12105
- reputationEnabled ? /* @__PURE__ */ jsxs(TabsList, { className: "w-full", children: [
12106
- /* @__PURE__ */ jsx(TabsTrigger, { value: "home", children: "Home" }),
12107
- /* @__PURE__ */ jsx(TabsTrigger, { value: "reputation", children: "Reputation" })
12108
- ] }) : null,
12109
- /* @__PURE__ */ jsxs(
12110
- TabsContent,
12111
- {
12112
- value: "home",
12113
- className: `flex flex-col gap-4${reputationEnabled ? " pt-2" : ""}`,
12114
- children: [
12115
- /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-2", children: [
12116
- /* @__PURE__ */ jsx("div", { className: "relative overflow-hidden px-4 py-8", children: /* @__PURE__ */ jsxs("div", { className: "relative z-10 flex flex-col items-center gap-1", children: [
12117
- /* @__PURE__ */ jsx("div", { className: "tracking-[.05em] leading-none", children: portfolioDisplay ? /* @__PURE__ */ jsxs(Fragment, { children: [
12118
- /* @__PURE__ */ jsx("span", { className: "mr-1 text-3xl font-semibold", children: "$" }),
12119
- /* @__PURE__ */ jsx("span", { className: "text-3xl font-semibold", children: portfolioDisplay.whole }),
12120
- /* @__PURE__ */ jsxs("span", { className: "text-lg font-semibold opacity-50", children: [
12121
- portfolioDisplay.separator,
12122
- portfolioDisplay.fraction
12123
- ] })
12124
- ] }) : portfolioLoading ? /* @__PURE__ */ jsxs(
12125
- "span",
12126
- {
12127
- className: "relative inline-flex items-baseline",
12128
- "aria-busy": "true",
12129
- "aria-label": "Loading portfolio total",
12130
- children: [
12131
- /* @__PURE__ */ jsxs("span", { className: "invisible", "aria-hidden": "true", children: [
12132
- /* @__PURE__ */ jsx("span", { className: "mr-1 text-3xl font-semibold", children: "$" }),
12133
- /* @__PURE__ */ jsx("span", { className: "text-3xl font-semibold", children: "0" }),
12134
- /* @__PURE__ */ jsxs("span", { className: "text-lg font-semibold", children: [
12135
- FLUENT_DECIMAL_SEPARATOR,
12136
- "00"
12137
- ] })
12138
- ] }),
12139
- /* @__PURE__ */ jsx("span", { className: "absolute inset-0 animate-pulse rounded-md bg-foreground/10" })
12140
- ]
12141
- }
12142
- ) : portfolioUnavailable ? /* @__PURE__ */ jsxs(Fragment, { children: [
12143
- /* @__PURE__ */ jsx("span", { className: "mr-1 text-3xl font-semibold", children: "$" }),
12144
- /* @__PURE__ */ jsx("span", { className: "text-3xl font-semibold", children: "\u2014" })
12145
- ] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
12146
- /* @__PURE__ */ jsx("span", { className: "mr-1 text-3xl font-semibold", children: "$" }),
12147
- /* @__PURE__ */ jsx("span", { className: "text-3xl font-semibold", children: "0" }),
12148
- /* @__PURE__ */ jsxs("span", { className: "text-lg font-semibold opacity-50", children: [
12149
- FLUENT_DECIMAL_SEPARATOR,
12150
- "00"
12151
- ] })
12152
- ] }) }),
12153
- /* @__PURE__ */ jsx("div", { className: "flex min-h-4 items-center gap-1.5 text-xs font-medium leading-none", children: portfolioPnl ? /* @__PURE__ */ jsxs(Fragment, { children: [
12154
- /* @__PURE__ */ jsx("span", { className: "inline-flex items-center gap-0.5", children: formatFluentPortfolioPnlAbsolute(portfolioPnl.delta) }),
12155
- portfolioPnl.percent !== null ? /* @__PURE__ */ jsxs(
12156
- "span",
12157
- {
12158
- className: `inline-flex items-center ${portfolioPnl.delta >= 0 ? "text-green-400" : "text-red-400"}`,
12159
- children: [
12160
- /* @__PURE__ */ jsx(
12161
- Icon,
12162
- {
12163
- name: portfolioPnl.delta >= 0 ? "arrow-up-s-fill" : "arrow-down-s-fill",
12164
- className: "size-3.5"
12165
- }
12166
- ),
12167
- /* @__PURE__ */ jsx("span", { children: formatFluentPortfolioPnlPercent(portfolioPnl.percent) })
12168
- ]
12169
- }
12170
- ) : null
12171
- ] }) : portfolioLoading ? /* @__PURE__ */ jsxs(
12172
- "span",
12173
- {
12174
- className: "relative inline-flex items-center gap-1.5",
12175
- "aria-busy": "true",
12176
- "aria-label": "Loading portfolio pnl",
12177
- children: [
12178
- /* @__PURE__ */ jsxs("span", { className: "invisible inline-flex items-center gap-1.5", "aria-hidden": "true", children: [
12179
- /* @__PURE__ */ jsxs("span", { className: "inline-flex items-center gap-0.5", children: [
12180
- "$ +0",
12181
- FLUENT_DECIMAL_SEPARATOR,
12182
- "00"
12183
- ] }),
12184
- /* @__PURE__ */ jsxs("span", { className: "inline-flex items-center", children: [
12185
- /* @__PURE__ */ jsx(Icon, { name: "arrow-up-s-fill", className: "size-3.5" }),
12186
- /* @__PURE__ */ jsxs("span", { children: [
12187
- "0",
12188
- FLUENT_DECIMAL_SEPARATOR,
12189
- "00%"
12190
- ] })
12191
- ] })
12192
- ] }),
12193
- /* @__PURE__ */ jsx("span", { className: "absolute inset-0 animate-pulse rounded-md bg-foreground/10" })
12194
- ]
12195
- }
12196
- ) : /* @__PURE__ */ jsxs(Fragment, { children: [
12197
- /* @__PURE__ */ jsxs("span", { className: "inline-flex items-center gap-0.5", children: [
12198
- "$ +0",
12199
- FLUENT_DECIMAL_SEPARATOR,
12200
- "00"
12201
- ] }),
12202
- /* @__PURE__ */ jsxs("span", { className: "inline-flex items-center text-green-400", children: [
12203
- /* @__PURE__ */ jsx(Icon, { name: "arrow-up-s-fill", className: "size-3.5" }),
12204
- /* @__PURE__ */ jsxs("span", { children: [
12205
- "0",
12206
- FLUENT_DECIMAL_SEPARATOR,
12207
- "00%"
12208
- ] })
12209
- ] })
12210
- ] }) })
12211
- ] }) }),
12212
- /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-3 gap-2", children: [
12213
- /* @__PURE__ */ jsx(
12214
- Button,
12215
- {
12216
- variant: "secondary",
12217
- className: "h-16 w-full",
12218
- disabled: usdnrMinter ? mintUsdnrBusy : !actionAddress || !swapperReady,
12219
- title: usdnrMinter || swapperReady ? void 0 : "Not configured for this app",
12220
- onClick: usdnrMinter ? () => handleMintUsdnr(usdnrMinter) : handleSwapper,
12221
- children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center gap-1", children: [
12222
- /* @__PURE__ */ jsx(Icon, { name: "plus", className: "size-4" }),
12223
- /* @__PURE__ */ jsx("span", { children: "Get USDnr" })
12224
- ] })
12225
- }
12226
- ),
12227
- /* @__PURE__ */ jsx(SwapperOnRampDialog, { config: swapperConfig, onClose: closeSwapper }),
12228
- /* @__PURE__ */ jsx(
12229
- Button,
12230
- {
12231
- variant: "secondary",
12232
- className: "h-16 w-full",
12233
- disabled: !accountAddress || !onSendToken,
12234
- onClick: handleSend,
12235
- children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center gap-1", children: [
12236
- /* @__PURE__ */ jsx(Icon, { name: "arrow-right-up-line", className: "size-4" }),
12237
- /* @__PURE__ */ jsx("span", { children: "Send" })
12238
- ] })
12239
- }
12240
- ),
12241
- /* @__PURE__ */ jsx(
12242
- Button,
12243
- {
12244
- variant: "secondary",
12245
- className: "h-16 w-full",
12246
- onClick: () => onTabChange("bridge"),
12247
- children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center gap-1", children: [
12248
- /* @__PURE__ */ jsx(Icon, { name: "arrow-up-down-line", className: "size-4" }),
12249
- /* @__PURE__ */ jsx("span", { children: "Swap" })
12250
- ] })
12251
- }
12252
- )
12253
- ] })
12452
+ return /* @__PURE__ */ jsxs("div", { className: "flex w-full flex-col gap-4", children: [
12453
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-2", children: [
12454
+ /* @__PURE__ */ jsx("div", { className: "relative overflow-hidden px-4 py-8", children: /* @__PURE__ */ jsxs("div", { className: "relative z-10 flex flex-col items-center gap-1", children: [
12455
+ /* @__PURE__ */ jsx("div", { className: "tracking-tight leading-none", children: portfolioDisplay ? /* @__PURE__ */ jsxs(Fragment, { children: [
12456
+ /* @__PURE__ */ jsx("span", { className: "mr-1 text-3xl font-semibold", children: "$" }),
12457
+ /* @__PURE__ */ jsx("span", { className: "text-3xl font-semibold", children: portfolioDisplay.whole }),
12458
+ /* @__PURE__ */ jsxs("span", { className: "text-3xl font-semibold", children: [
12459
+ portfolioDisplay.separator,
12460
+ portfolioDisplay.fraction
12461
+ ] })
12462
+ ] }) : portfolioLoading ? /* @__PURE__ */ jsxs(
12463
+ "span",
12464
+ {
12465
+ className: "relative inline-flex items-baseline",
12466
+ "aria-busy": "true",
12467
+ "aria-label": "Loading portfolio total",
12468
+ children: [
12469
+ /* @__PURE__ */ jsxs("span", { className: "invisible", "aria-hidden": "true", children: [
12470
+ /* @__PURE__ */ jsx("span", { className: "mr-1 text-3xl font-semibold", children: "$" }),
12471
+ /* @__PURE__ */ jsx("span", { className: "text-3xl font-semibold", children: "0" }),
12472
+ /* @__PURE__ */ jsxs("span", { className: "text-3xl font-semibold", children: [
12473
+ FLUENT_DECIMAL_SEPARATOR,
12474
+ "00"
12475
+ ] })
12476
+ ] }),
12477
+ /* @__PURE__ */ jsx("span", { className: "absolute inset-0 animate-pulse rounded-md bg-foreground/10" })
12478
+ ]
12479
+ }
12480
+ ) : portfolioUnavailable ? /* @__PURE__ */ jsxs(Fragment, { children: [
12481
+ /* @__PURE__ */ jsx("span", { className: "mr-1 text-3xl font-semibold", children: "$" }),
12482
+ /* @__PURE__ */ jsx("span", { className: "text-3xl font-semibold", children: "\u2014" })
12483
+ ] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
12484
+ /* @__PURE__ */ jsx("span", { className: "mr-1 text-3xl font-semibold", children: "$" }),
12485
+ /* @__PURE__ */ jsx("span", { className: "text-3xl font-semibold", children: "0" }),
12486
+ /* @__PURE__ */ jsxs("span", { className: "text-3xl font-semibold", children: [
12487
+ FLUENT_DECIMAL_SEPARATOR,
12488
+ "00"
12489
+ ] })
12490
+ ] }) }),
12491
+ /* @__PURE__ */ jsx("div", { className: "flex min-h-4 items-center gap-1.5 text-sm font-medium leading-none", children: portfolioPnl ? /* @__PURE__ */ jsxs(Fragment, { children: [
12492
+ /* @__PURE__ */ jsx("span", { className: "inline-flex items-center gap-0.5", children: formatFluentPortfolioPnlAbsolute(portfolioPnl.delta) }),
12493
+ portfolioPnl.percent !== null ? /* @__PURE__ */ jsx("span", { className: portfolioPnl.delta >= 0 ? "text-green-400" : "text-red-400", children: formatFluentPortfolioPnlPercent(portfolioPnl.percent) }) : null
12494
+ ] }) : portfolioLoading ? /* @__PURE__ */ jsxs(
12495
+ "span",
12496
+ {
12497
+ className: "relative inline-flex items-center gap-1.5",
12498
+ "aria-busy": "true",
12499
+ "aria-label": "Loading portfolio pnl",
12500
+ children: [
12501
+ /* @__PURE__ */ jsxs("span", { className: "invisible inline-flex items-center gap-1.5", "aria-hidden": "true", children: [
12502
+ /* @__PURE__ */ jsxs("span", { className: "inline-flex items-center gap-0.5", children: [
12503
+ "$ +0",
12504
+ FLUENT_DECIMAL_SEPARATOR,
12505
+ "00"
12254
12506
  ] }),
12255
- /* @__PURE__ */ jsxs(Tabs, { value: homePanel, onValueChange: setHomePanel, className: "flex w-full flex-col", children: [
12256
- /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between", children: [
12257
- /* @__PURE__ */ jsxs(TabsList, { variant: "line", children: [
12258
- /* @__PURE__ */ jsx(TabsTrigger, { value: "tokens", children: "Tokens" }),
12259
- /* @__PURE__ */ jsx(TabsTrigger, { value: "activity", children: "Activity" })
12260
- ] }),
12261
- homePanel === "activity" ? /* @__PURE__ */ jsx(
12262
- Button,
12263
- {
12264
- variant: "ghost",
12265
- size: "icon-sm",
12266
- "aria-label": "Refresh activity",
12267
- className: "rounded-full",
12268
- disabled: transactionsBusy || refreshingActivity,
12269
- onClick: refreshActivity,
12270
- children: /* @__PURE__ */ jsx(
12271
- RefreshCw,
12272
- {
12273
- className: cn("size-3.5", refreshingActivity && "animate-spin"),
12274
- "aria-hidden": true
12275
- }
12276
- )
12277
- }
12278
- ) : null
12279
- ] }),
12280
- /* @__PURE__ */ jsx(TabsContent, { value: "tokens", className: "pt-2", children: /* @__PURE__ */ jsx(
12281
- WalletMenuTokenList,
12282
- {
12283
- accountAddress,
12284
- balances,
12285
- busy: balancesBusy,
12286
- usdPrices: prices,
12287
- tokens: displayTokens,
12288
- selectedSymbol: gasPaymentToken,
12289
- onRemoveUserToken: removeUserToken,
12290
- actionsDisabled: settingsPending,
12291
- error: tokenListError
12292
- }
12293
- ) }),
12294
- /* @__PURE__ */ jsx(TabsContent, { value: "activity", className: "pt-2", children: /* @__PURE__ */ jsx(
12295
- WalletMenuActivity,
12296
- {
12297
- network: resolvedConfig.network,
12298
- fluent: {
12299
- address: accountAddress,
12300
- entries: transactions,
12301
- pending: pendingTransfers,
12302
- busy: transactionsBusy,
12303
- loadingMore: transactionsLoadingMore,
12304
- hasMore: hasMoreTransactions,
12305
- loadMore: loadMoreTransactions,
12306
- error: transactionsError
12307
- },
12308
- externalWalletAddress,
12309
- usdPrices: prices,
12310
- tokens: displayTokens,
12311
- depositSwap: depositSwap?.state,
12312
- sentDeposits,
12313
- onOpenDepositSwap: () => onTabChange(DEPOSIT_SWAP_TAB),
12314
- onOpenBridgeRow: (selection) => {
12315
- setActivity({ kind: "bridge", selection });
12316
- onTabChange("activity");
12317
- },
12318
- onOpenFluentEntry: (entry) => {
12319
- if (!accountAddress) return;
12320
- setActivity({ kind: "fluent", selection: { entry, account: accountAddress } });
12321
- onTabChange("activity");
12322
- }
12323
- }
12324
- ) })
12507
+ /* @__PURE__ */ jsxs("span", { children: [
12508
+ "+0",
12509
+ FLUENT_DECIMAL_SEPARATOR,
12510
+ "00%"
12325
12511
  ] })
12326
- ]
12327
- }
12328
- ),
12329
- reputationEnabled ? /* @__PURE__ */ jsxs(TabsContent, { value: "reputation", className: "flex flex-col gap-2 pt-2", children: [
12330
- reputation.phase === "ready" ? /* @__PURE__ */ jsx("div", { className: "flex flex-col gap-2", children: orderedFamilyKeys(reputation.families.families).map((name) => /* @__PURE__ */ jsx(
12331
- ReputationFamilyCard,
12332
- {
12333
- family: name,
12334
- tier: reputation.families.families[name].tier
12335
- },
12336
- name
12337
- )) }) : null,
12338
- reputation.phase === "loading" ? /* @__PURE__ */ jsx(
12339
- "div",
12340
- {
12341
- className: "flex items-center justify-center rounded-xl bg-foreground/5 px-4 py-8",
12342
- "aria-busy": "true",
12343
- "aria-label": "Loading reputation",
12344
- children: /* @__PURE__ */ jsx(Spinner, { className: "size-5 text-foreground/70" })
12345
- }
12346
- ) : null,
12347
- reputation.phase === "disconnected" ? /* @__PURE__ */ jsx(
12348
- ReputationNotice,
12349
- {
12350
- title: "Not connected",
12351
- description: "Connect with Fluent ID to see your reputation."
12352
- }
12353
- ) : null,
12354
- reputation.phase === "signup" ? /* @__PURE__ */ jsx(
12355
- ReputationNotice,
12512
+ ] }),
12513
+ /* @__PURE__ */ jsx("span", { className: "absolute inset-0 animate-pulse rounded-md bg-foreground/10" })
12514
+ ]
12515
+ }
12516
+ ) : /* @__PURE__ */ jsxs(Fragment, { children: [
12517
+ /* @__PURE__ */ jsxs("span", { className: "inline-flex items-center gap-0.5", children: [
12518
+ "$ +0",
12519
+ FLUENT_DECIMAL_SEPARATOR,
12520
+ "00"
12521
+ ] }),
12522
+ /* @__PURE__ */ jsxs("span", { className: "text-green-400", children: [
12523
+ "+0",
12524
+ FLUENT_DECIMAL_SEPARATOR,
12525
+ "00%"
12526
+ ] })
12527
+ ] }) })
12528
+ ] }) }),
12529
+ /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-3 gap-2", children: [
12530
+ /* @__PURE__ */ jsx(
12531
+ Button,
12532
+ {
12533
+ variant: "secondary",
12534
+ className: "h-16 w-full",
12535
+ disabled: usdnrMinter ? mintUsdnrBusy : !actionAddress || !swapperReady,
12536
+ title: usdnrMinter || swapperReady ? void 0 : "Not configured for this app",
12537
+ onClick: usdnrMinter ? () => handleMintUsdnr(usdnrMinter) : handleSwapper,
12538
+ children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center gap-1", children: [
12539
+ /* @__PURE__ */ jsx(Icon, { name: "plus", className: "size-4" }),
12540
+ /* @__PURE__ */ jsx("span", { children: "Get USDnr" })
12541
+ ] })
12542
+ }
12543
+ ),
12544
+ /* @__PURE__ */ jsx(SwapperOnRampDialog, { config: swapperConfig, onClose: closeSwapper }),
12545
+ /* @__PURE__ */ jsx(
12546
+ Button,
12547
+ {
12548
+ variant: "secondary",
12549
+ className: "h-16 w-full",
12550
+ disabled: !accountAddress || !onSendToken,
12551
+ onClick: handleSend,
12552
+ children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center gap-1", children: [
12553
+ /* @__PURE__ */ jsx(Icon, { name: "arrow-right-up-line", className: "size-4" }),
12554
+ /* @__PURE__ */ jsx("span", { children: "Send" })
12555
+ ] })
12556
+ }
12557
+ ),
12558
+ /* @__PURE__ */ jsx(
12559
+ Button,
12560
+ {
12561
+ variant: "secondary",
12562
+ className: "h-16 w-full",
12563
+ onClick: () => onTabChange("bridge"),
12564
+ children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center gap-1", children: [
12565
+ /* @__PURE__ */ jsx(Icon, { name: "arrow-up-down-line", className: "size-4" }),
12566
+ /* @__PURE__ */ jsx("span", { children: "Swap" })
12567
+ ] })
12568
+ }
12569
+ )
12570
+ ] })
12571
+ ] }),
12572
+ /* @__PURE__ */ jsxs(Tabs, { value: homePanel, onValueChange: setHomePanel, className: "flex w-full flex-col", children: [
12573
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between", children: [
12574
+ /* @__PURE__ */ jsxs(TabsList, { variant: "line", children: [
12575
+ /* @__PURE__ */ jsx(TabsTrigger, { value: "tokens", children: "Tokens" }),
12576
+ /* @__PURE__ */ jsx(TabsTrigger, { value: "activity", children: "Activity" }),
12577
+ reputationEnabled ? /* @__PURE__ */ jsx(TabsTrigger, { value: "reputation", children: "Reputation" }) : null
12578
+ ] }),
12579
+ homePanel === "activity" ? /* @__PURE__ */ jsx(
12580
+ Button,
12581
+ {
12582
+ variant: "ghost",
12583
+ size: "icon-sm",
12584
+ "aria-label": "Refresh activity",
12585
+ className: "rounded-full",
12586
+ disabled: transactionsBusy || refreshingActivity,
12587
+ onClick: refreshActivity,
12588
+ children: /* @__PURE__ */ jsx(
12589
+ RefreshCw,
12356
12590
  {
12357
- title: "No reputation available",
12358
- description: "Connect your X account to access your reputation.",
12359
- action: {
12360
- label: "Connect with X",
12361
- icon: "x",
12362
- onClick: onConnectWithX
12363
- }
12591
+ className: cn("size-3.5", refreshingActivity && "animate-spin"),
12592
+ "aria-hidden": true
12364
12593
  }
12365
- ) : null,
12366
- reputation.phase === "error" ? /* @__PURE__ */ jsx(ReputationNotice, { title: "Could not load reputation", description: reputation.message }) : null
12367
- ] }) : null
12368
- ]
12369
- }
12370
- )
12371
- );
12594
+ )
12595
+ }
12596
+ ) : null
12597
+ ] }),
12598
+ /* @__PURE__ */ jsx(TabsContent, { value: "tokens", className: "pt-2", children: /* @__PURE__ */ jsx(
12599
+ WalletMenuTokenList,
12600
+ {
12601
+ accountAddress,
12602
+ balances,
12603
+ busy: balancesBusy,
12604
+ usdPrices: prices,
12605
+ tokens: displayTokens,
12606
+ selectedSymbol: gasPaymentToken,
12607
+ onRemoveUserToken: removeUserToken,
12608
+ actionsDisabled: settingsPending,
12609
+ error: tokenListError
12610
+ }
12611
+ ) }),
12612
+ /* @__PURE__ */ jsx(TabsContent, { value: "activity", className: "pt-2", children: /* @__PURE__ */ jsx(
12613
+ WalletMenuActivity,
12614
+ {
12615
+ network: resolvedConfig.network,
12616
+ fluent: {
12617
+ address: accountAddress,
12618
+ entries: transactions,
12619
+ pending: pendingTransfers,
12620
+ busy: transactionsBusy,
12621
+ loadingMore: transactionsLoadingMore,
12622
+ hasMore: hasMoreTransactions,
12623
+ loadMore: loadMoreTransactions,
12624
+ error: transactionsError
12625
+ },
12626
+ externalWalletAddress,
12627
+ usdPrices: prices,
12628
+ tokens: displayTokens,
12629
+ depositSwap: depositSwap?.state,
12630
+ sentDeposits,
12631
+ onOpenDepositSwap: () => onTabChange(DEPOSIT_SWAP_TAB),
12632
+ onOpenBridgeRow: (selection) => {
12633
+ setActivity({ kind: "bridge", selection });
12634
+ onTabChange("activity");
12635
+ },
12636
+ onOpenFluentEntry: (entry) => {
12637
+ if (!accountAddress) return;
12638
+ setActivity({ kind: "fluent", selection: { entry, account: accountAddress } });
12639
+ onTabChange("activity");
12640
+ }
12641
+ }
12642
+ ) }),
12643
+ reputationEnabled ? /* @__PURE__ */ jsxs(TabsContent, { value: "reputation", className: "flex flex-col gap-2 pt-2", children: [
12644
+ reputation.phase === "ready" ? /* @__PURE__ */ jsx("div", { className: "flex flex-col gap-2", children: orderedFamilyKeys(reputation.families.families).map((name) => /* @__PURE__ */ jsx(
12645
+ ReputationFamilyCard,
12646
+ {
12647
+ family: name,
12648
+ tier: reputation.families.families[name].tier
12649
+ },
12650
+ name
12651
+ )) }) : null,
12652
+ reputation.phase === "loading" ? /* @__PURE__ */ jsx(
12653
+ "div",
12654
+ {
12655
+ className: "flex items-center justify-center rounded-xl bg-foreground/5 px-4 py-8",
12656
+ "aria-busy": "true",
12657
+ "aria-label": "Loading reputation",
12658
+ children: /* @__PURE__ */ jsx(Spinner, { className: "size-5 text-foreground/70" })
12659
+ }
12660
+ ) : null,
12661
+ reputation.phase === "disconnected" ? /* @__PURE__ */ jsx(
12662
+ ReputationNotice,
12663
+ {
12664
+ title: "Not connected",
12665
+ description: "Connect with Fluent ID to see your reputation."
12666
+ }
12667
+ ) : null,
12668
+ reputation.phase === "signup" ? /* @__PURE__ */ jsx(
12669
+ ReputationNotice,
12670
+ {
12671
+ title: "No reputation available",
12672
+ description: "Connect your X account to access your reputation.",
12673
+ action: {
12674
+ label: "Connect with X",
12675
+ icon: "x",
12676
+ onClick: onConnectWithX
12677
+ }
12678
+ }
12679
+ ) : null,
12680
+ reputation.phase === "error" ? /* @__PURE__ */ jsx(ReputationNotice, { title: "Could not load reputation", description: reputation.message }) : null
12681
+ ] }) : null
12682
+ ] })
12683
+ ] });
12372
12684
  }
12373
12685
  var FLUENT_MAINNET_SWAP_CONTRACTS = {
12374
12686
  router: getAddress("0x23a82a0239F0b88De669Ac9c46222a9e62853701"),
@@ -13865,7 +14177,13 @@ function BridgeForm({
13865
14177
  const receiveToken = twoStep && swapTarget ? swapTarget : deliveredToken;
13866
14178
  const receiveAmount = twoStep ? quote?.amountOut : bridge.receiveAmount;
13867
14179
  const approximate = isSwap || twoStep ? "\u2248 " : "";
13868
- const receiveText = receiveAmount === void 0 || receiveAmount === 0n ? twoStep && swapQuote.loading ? "\u2026" : "0" : `${approximate}${formatAmount(receiveAmount, receiveToken.decimals)}`;
14180
+ const receiveText = receiveAmount === void 0 || receiveAmount === 0n ? twoStep && swapQuote.loading ? "\u2026" : "0" : `${approximate}${formatAmount(receiveAmount, receiveToken.decimals, receiveToken.symbol)}`;
14181
+ const receiveExact = receiveAmount === void 0 || receiveAmount === 0n ? void 0 : `${formatUnits(receiveAmount, receiveToken.decimals)} ${receiveToken.symbol}`;
14182
+ const receiveUsd = formatAmountUsd(
14183
+ receiveAmount === void 0 ? "0" : formatUnits(receiveAmount, receiveToken.decimals),
14184
+ priceOf(receiveToken.symbol)
14185
+ );
14186
+ const receiveUsdText = receiveUsd && receiveAmount !== void 0 && receiveAmount > 0n ? `${approximate}${receiveUsd}` : receiveUsd;
13869
14187
  const isFastPath = deliveredToken.route === "fast-path";
13870
14188
  const showApprovalSteps = bridge.connected && !bridge.wrongChain && isErc20 && !isSwap;
13871
14189
  const approvalStep = Number(form.amount) > 0 && !bridge.needsApproval && !bridge.approving ? 2 : 1;
@@ -13910,7 +14228,7 @@ function BridgeForm({
13910
14228
  "span",
13911
14229
  {
13912
14230
  title: bridge.sourceBalance !== void 0 ? formatUnits(bridge.sourceBalance, token.decimals) : void 0,
13913
- children: bridge.balanceLoading ? "Loading balance..." : `${formatAmount(bridge.sourceBalance, token.decimals)} ${token.symbol}`
14231
+ children: bridge.balanceLoading ? "Loading balance..." : `${formatAmount(bridge.sourceBalance, token.decimals, token.symbol)} ${token.symbol}`
13914
14232
  }
13915
14233
  ),
13916
14234
  /* @__PURE__ */ jsx(
@@ -13935,6 +14253,7 @@ function BridgeForm({
13935
14253
  {
13936
14254
  className: `block truncate font-medium leading-[1.2] ${receiveText === "0" ? "text-foreground/40" : "text-foreground"}`,
13937
14255
  style: getAmountFontStyle(receiveText),
14256
+ title: receiveExact,
13938
14257
  children: receiveText
13939
14258
  }
13940
14259
  ) }),
@@ -13948,6 +14267,7 @@ function BridgeForm({
13948
14267
  }
13949
14268
  ) : /* @__PURE__ */ jsx(TokenChip, { symbol: deliveredToken.symbol })
13950
14269
  ] }),
14270
+ receiveUsdText ? /* @__PURE__ */ jsx("span", { className: "min-w-0 truncate text-sm text-foreground/60", title: receiveUsdText, children: receiveUsdText }) : null,
13951
14271
  swapProblem ? /* @__PURE__ */ jsx("span", { className: "text-xs text-destructive", children: swapProblem }) : null
13952
14272
  ] })
13953
14273
  ] }),
@@ -14001,7 +14321,8 @@ function BridgeForm({
14001
14321
  SummaryRow,
14002
14322
  {
14003
14323
  label: "Minimum received",
14004
- value: minimumOut === void 0 ? swapQuote.loading ? "Pricing\u2026" : "\u2014" : `${formatAmount(minimumOut, swapTarget.decimals)} ${swapTarget.symbol}`,
14324
+ value: minimumOut === void 0 ? swapQuote.loading ? "Pricing\u2026" : "\u2014" : `${formatAmount(minimumOut, swapTarget.decimals, swapTarget.symbol)} ${swapTarget.symbol}`,
14325
+ valueTitle: minimumOut === void 0 ? void 0 : `${formatUnits(minimumOut, swapTarget.decimals)} ${swapTarget.symbol}`,
14005
14326
  tooltip: SLIPPAGE_TOOLTIP
14006
14327
  }
14007
14328
  ),
@@ -14983,6 +15304,7 @@ function encodeBatchCall(call) {
14983
15304
  };
14984
15305
  }
14985
15306
  var FLUENT_ZERODEV_ERC20_PAYMASTER_QUERY = "selfFunded=true";
15307
+ var FLUENT_ZERODEV_ERC20_MIN_POSTOP_GAS = 50000n;
14986
15308
  function getFluentZeroDevErc20PaymasterTokens(network = "testnet") {
14987
15309
  return Object.fromEntries(
14988
15310
  getFluentDefaultWidgetGasTokens(network).filter((token) => !isFluentNativeToken(token) && token.address).map((token) => [
@@ -15060,33 +15382,77 @@ function createFluentZeroDevErc20Paymaster(params) {
15060
15382
  getPaymasterData: (userOperation) => {
15061
15383
  const contextToken = getPaymasterContextToken(userOperation.context);
15062
15384
  return paymasterClient.sponsorUserOperation({
15063
- userOperation: withoutChainMetadata(userOperation),
15385
+ userOperation: withMinimumPostOpGas(withoutChainMetadata(userOperation)),
15064
15386
  gasToken: contextToken ?? gasToken.address
15065
15387
  });
15066
15388
  }
15067
15389
  };
15068
15390
  }
15069
- async function createFluentZeroDevErc20PaymasterApprovalCall(params) {
15391
+ var FluentGasPaymentError = class extends Error {
15392
+ constructor(code, message2, options) {
15393
+ super(message2, options);
15394
+ this.code = code;
15395
+ this.name = "FluentGasPaymentError";
15396
+ }
15397
+ code;
15398
+ };
15399
+ var erc20PaymasterAddresses = /* @__PURE__ */ new Map();
15400
+ async function readFluentZeroDevErc20PaymasterAddress(params = {}) {
15070
15401
  const chain = params.chain ?? fluentTestnet;
15071
- const gasToken = resolveFluentZeroDevErc20PaymasterToken(
15072
- params.gasToken,
15073
- params.network
15074
- );
15075
- const paymasterClient = params.paymasterClient ?? createFluentZeroDevErc20PaymasterClient({
15076
- chain,
15077
- paymasterRpcUrl: params.paymasterRpcUrl
15078
- });
15079
- return getERC20PaymasterApproveCall(paymasterClient, {
15080
- gasToken: gasToken.address,
15081
- approveAmount: params.approveAmount,
15082
- entryPoint: getEntryPoint("0.7")
15083
- });
15402
+ const paymasterRpcUrl = params.paymasterRpcUrl ?? createFluentZeroDevErc20PaymasterRpcUrl({ chainId: chain.id });
15403
+ const cacheKey = params.paymasterClient ? void 0 : paymasterRpcUrl;
15404
+ const known = cacheKey ? erc20PaymasterAddresses.get(cacheKey) : void 0;
15405
+ if (known) return known;
15406
+ const paymasterClient = params.paymasterClient ?? createFluentZeroDevErc20PaymasterClient({ chain, paymasterRpcUrl });
15407
+ const request = paymasterClient.request;
15408
+ let response;
15409
+ try {
15410
+ response = await request({
15411
+ method: "zd_pm_accounts",
15412
+ params: [{ chainId: chain.id, entryPointAddress: getEntryPoint("0.7").address }]
15413
+ });
15414
+ } catch (err) {
15415
+ throw new FluentGasPaymentError(
15416
+ "paymaster_unavailable",
15417
+ `ZeroDev could not name the ERC-20 paymaster for chain ${chain.id}`,
15418
+ { cause: err }
15419
+ );
15420
+ }
15421
+ const address = Array.isArray(response) ? response[0] : void 0;
15422
+ if (typeof address !== "string" || !isAddress(address)) {
15423
+ throw new FluentGasPaymentError(
15424
+ "paymaster_unavailable",
15425
+ `ZeroDev named no ERC-20 paymaster for chain ${chain.id}`
15426
+ );
15427
+ }
15428
+ const paymaster = getAddress(address);
15429
+ if (cacheKey) erc20PaymasterAddresses.set(cacheKey, paymaster);
15430
+ return paymaster;
15431
+ }
15432
+ function createFluentErc20ApproveCall(params) {
15433
+ return {
15434
+ to: params.gasToken,
15435
+ data: encodeFunctionData({
15436
+ abi: erc20Abi,
15437
+ functionName: "approve",
15438
+ args: [params.spender, params.amount]
15439
+ }),
15440
+ value: 0n
15441
+ };
15084
15442
  }
15085
15443
  function getPaymasterContextToken(context) {
15086
15444
  if (!context || typeof context !== "object") return void 0;
15087
15445
  const token = context.token;
15088
15446
  return typeof token === "string" && token.startsWith("0x") ? token : void 0;
15089
15447
  }
15448
+ function withMinimumPostOpGas(userOperation) {
15449
+ const limit = userOperation.paymasterPostOpGasLimit;
15450
+ if (limit !== void 0 && limit >= FLUENT_ZERODEV_ERC20_MIN_POSTOP_GAS) return userOperation;
15451
+ return {
15452
+ ...userOperation,
15453
+ paymasterPostOpGasLimit: FLUENT_ZERODEV_ERC20_MIN_POSTOP_GAS
15454
+ };
15455
+ }
15090
15456
  function withoutChainMetadata(userOperation) {
15091
15457
  const {
15092
15458
  chain: _chain,
@@ -16052,6 +16418,38 @@ function useFluentZeroDevAccount(hookOptions = {}) {
16052
16418
  refresh: () => initialize2({ throwOnError: true, signerMode: "prompt" })
16053
16419
  };
16054
16420
  }
16421
+ async function prepareFluentGasTokenApproval(params) {
16422
+ const { kernel, gasToken, network, gasPayment } = params;
16423
+ const paymaster = await readFluentZeroDevErc20PaymasterAddress({ chain: kernel.chain });
16424
+ if (gasPayment.includeApproval) {
16425
+ return createFluentErc20ApproveCall({
16426
+ gasToken,
16427
+ spender: paymaster,
16428
+ amount: gasPayment.approveAmount
16429
+ });
16430
+ }
16431
+ const automatic = getFluentGasTokenApproval(gasToken, network);
16432
+ if (!automatic) {
16433
+ debugWarn("[fluent zerodev] no automatic approval for this Gas token", { gasToken });
16434
+ return void 0;
16435
+ }
16436
+ let allowance = 0n;
16437
+ try {
16438
+ allowance = await kernel.publicClient.readContract({
16439
+ address: gasToken,
16440
+ abi: erc20Abi,
16441
+ functionName: "allowance",
16442
+ args: [kernel.smartAccountAddress, paymaster]
16443
+ });
16444
+ } catch (err) {
16445
+ debugWarn("[fluent zerodev] Gas token allowance unreadable, approving", {
16446
+ gasToken,
16447
+ error: err instanceof Error ? err.message : String(err)
16448
+ });
16449
+ }
16450
+ if (allowance >= automatic.refreshBelow) return void 0;
16451
+ return createFluentErc20ApproveCall({ gasToken, spender: paymaster, amount: automatic.amount });
16452
+ }
16055
16453
  async function sendCalls(context, calls, options, readyAccount) {
16056
16454
  const {
16057
16455
  kernels,
@@ -16078,21 +16476,20 @@ async function sendCalls(context, calls, options, readyAccount) {
16078
16476
  const executionKernel = knownKernel ?? await initialize2({ signerMode, throwOnError: true });
16079
16477
  if (!executionKernel) throw new Error(error?.message ?? "ZeroDev smart account is not ready");
16080
16478
  const gasToken = options?.gasPayment?.symbol ? getFluentGasTokenAddress(options.gasPayment.symbol, network) : void 0;
16081
- const preparedCalls = [...calls];
16082
- if (gasToken && options?.gasPayment?.includeApproval) {
16083
- preparedCalls.unshift(await createFluentZeroDevErc20PaymasterApprovalCall({
16084
- chain: executionKernel.chain,
16085
- gasToken,
16086
- approveAmount: options.gasPayment.approveAmount
16087
- }));
16088
- }
16479
+ const approval = gasToken && options?.gasPayment ? await prepareFluentGasTokenApproval({
16480
+ kernel: executionKernel,
16481
+ gasToken,
16482
+ network,
16483
+ gasPayment: options.gasPayment
16484
+ }) : void 0;
16485
+ const preparedCalls = approval ? [approval, ...calls] : [...calls];
16089
16486
  debugLog("[fluent zerodev] sendCalls", {
16090
16487
  signerMode,
16091
16488
  smartAccountAddress: executionKernel.smartAccountAddress,
16092
16489
  gasToken,
16093
16490
  gasTokenSymbol: options?.gasPayment?.symbol,
16094
16491
  sponsorship: options?.gasPayment?.sponsorship ?? "auto",
16095
- approvalIncluded: Boolean(gasToken && options?.gasPayment?.includeApproval),
16492
+ approvalIncluded: Boolean(approval),
16096
16493
  calls: preparedCalls.map((call) => ({
16097
16494
  to: call.to,
16098
16495
  hasData: Boolean(call.data && call.data !== "0x"),
@@ -20030,7 +20427,7 @@ function FluentWidgetContent({
20030
20427
  reviewOriginRef.current = null;
20031
20428
  const wasSend = batchReview?.id === FLUENT_SEND_TOKEN_OP_ID;
20032
20429
  if (outcome === "confirmed" && wasSend) {
20033
- setWalletMenuTab("home");
20430
+ setWalletMenuTab(SENT_TRANSFER_TAB);
20034
20431
  setAccountOpen(true);
20035
20432
  return;
20036
20433
  }
@@ -20073,10 +20470,12 @@ function FluentWidgetContent({
20073
20470
  });
20074
20471
  const [pendingTransfers, setPendingTransfers] = useState([]);
20075
20472
  const pendingTransferCount = useRef(0);
20473
+ const [sentTransfer, setSentTransfer] = useState(null);
20076
20474
  const beginTransfer = useCallback(
20077
20475
  (transfer) => {
20078
20476
  const id = `pending-${pendingTransferCount.current += 1}`;
20079
20477
  setPendingTransfers((list) => [...list, { ...transfer, id }]);
20478
+ setSentTransfer({ ...transfer, id });
20080
20479
  setWalletMenuPanel("activity");
20081
20480
  return id;
20082
20481
  },
@@ -20084,12 +20483,14 @@ function FluentWidgetContent({
20084
20483
  );
20085
20484
  const endTransfer = useCallback((id) => {
20086
20485
  setPendingTransfers((list) => list.filter((transfer) => transfer.id !== id));
20486
+ setSentTransfer((transfer) => transfer?.id === id && !transfer.hash ? null : transfer);
20087
20487
  }, []);
20088
20488
  const settleTransfer = useCallback(
20089
20489
  (id, hash) => {
20090
20490
  setPendingTransfers(
20091
20491
  (list) => list.map((transfer) => transfer.id === id ? { ...transfer, hash } : transfer)
20092
20492
  );
20493
+ setSentTransfer((transfer) => transfer?.id === id ? { ...transfer, hash } : transfer);
20093
20494
  setTimeout(() => {
20094
20495
  setPendingTransfers(
20095
20496
  (list) => list.map((transfer) => transfer.id === id ? { ...transfer, expired: true } : transfer)
@@ -20099,6 +20500,9 @@ function FluentWidgetContent({
20099
20500
  },
20100
20501
  [endTransfer]
20101
20502
  );
20503
+ useEffect(() => {
20504
+ if (walletMenuTab === SENT_TRANSFER_TAB && !sentTransfer) setWalletMenuTab("home");
20505
+ }, [walletMenuTab, sentTransfer, setWalletMenuTab]);
20102
20506
  const [sentDeposits, setSentDeposits] = useState([]);
20103
20507
  const addSentDeposit = useCallback((deposit) => {
20104
20508
  setSentDeposits((list) => [...list, deposit]);
@@ -20733,6 +21137,7 @@ function FluentWidgetContent({
20733
21137
  onPanelChange: setWalletMenuPanel,
20734
21138
  onSendToken: sendToken,
20735
21139
  pendingTransfers,
21140
+ sentTransfer: sentTransfer ?? void 0,
20736
21141
  sentDeposits,
20737
21142
  depositSwap,
20738
21143
  onMintUsdnr: mintUsdnr,
@@ -21316,6 +21721,6 @@ function useFluentIframeBridge(iframeRef, { allowedOrigin }) {
21316
21721
  }, [address]);
21317
21722
  }
21318
21723
 
21319
- export { AccountAvatar, FluentAuthError, FluentReviewRejectedError, FluentSponsorshipFallbackError, FluentUserOperationGasError, FluentWidget, FluentWidgetConfigError, fluentMainnet, fluentTestnet, getFluentChainByChainId, getFluentChainForNetwork, useFluentIframeBridge, useFluentWidget, useLinkX };
21724
+ export { AccountAvatar, FluentAuthError, FluentGasPaymentError, FluentReviewRejectedError, FluentSponsorshipFallbackError, FluentUserOperationGasError, FluentWidget, FluentWidgetConfigError, fluentMainnet, fluentTestnet, getFluentChainByChainId, getFluentChainForNetwork, useFluentIframeBridge, useFluentWidget, useLinkX };
21320
21725
  //# sourceMappingURL=index.js.map
21321
21726
  //# sourceMappingURL=index.js.map