@fluent.xyz/connect 0.6.1 → 0.6.2

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
@@ -5612,7 +5612,7 @@ function createFluentConnectForWidget(config) {
5612
5612
  }
5613
5613
 
5614
5614
  // package.json
5615
- var version = "0.6.1";
5615
+ var version = "0.6.2";
5616
5616
 
5617
5617
  // src/core/analytics.ts
5618
5618
  var INSTANCE_NAME = "fluent";
@@ -6334,6 +6334,13 @@ function toastFaucetError(error) {
6334
6334
  });
6335
6335
  }
6336
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
+
6337
6344
  // src/utils/formatExternalWallet.ts
6338
6345
  function formatExternalWallet(wallet, status) {
6339
6346
  return JSON.stringify(
@@ -7046,6 +7053,7 @@ function InlineConnectModal(props) {
7046
7053
  onClose,
7047
7054
  onFluentLogin,
7048
7055
  onRetry,
7056
+ onSignerCreationError,
7049
7057
  loginError,
7050
7058
  wallet,
7051
7059
  track,
@@ -7086,7 +7094,16 @@ function InlineConnectModal(props) {
7086
7094
  const operation = React.useRef(null);
7087
7095
  const generation = React.useRef(0);
7088
7096
  const attemptedWallet = React.useRef(null);
7089
- const walletFailed = React.useRef(false);
7097
+ const [signerError, setSignerError] = React.useState(null);
7098
+ const signerUserId = authenticated && !walletUserPrivySession ? user?.id : void 0;
7099
+ if (attemptedWallet.current?.userId !== signerUserId) attemptedWallet.current = null;
7100
+ const mounted = React.useRef(false);
7101
+ React.useEffect(() => {
7102
+ mounted.current = true;
7103
+ return () => {
7104
+ mounted.current = false;
7105
+ };
7106
+ }, []);
7090
7107
  const fluentChosen = React.useRef(false);
7091
7108
  const fluentGate = React.useRef(void 0);
7092
7109
  const heading = React.useRef(null);
@@ -7094,9 +7111,9 @@ function InlineConnectModal(props) {
7094
7111
  const walletList = React.useRef(null);
7095
7112
  const active = React.useRef(open);
7096
7113
  active.current = open;
7097
- const connecting = step !== "choice" && authenticated;
7114
+ const connecting = authenticated && (step !== "choice" || !walletUserPrivySession);
7098
7115
  const screen = connecting ? "connecting" : step;
7099
- const shownError = error || captchaError || (connecting ? signInRefusal || loginError : "");
7116
+ const shownError = error || captchaError || (signerError?.attempt === attemptedWallet.current ? signerError?.message : "") || (connecting ? signInRefusal || loginError : "");
7100
7117
  React.useEffect(() => {
7101
7118
  if (!open || !shownError) return;
7102
7119
  const id = toast.add({ type: "error", title: shownError });
@@ -7155,31 +7172,34 @@ function InlineConnectModal(props) {
7155
7172
  return () => clearTimeout(timer);
7156
7173
  }, [open, connecting, step, walletAttempt]);
7157
7174
  React.useEffect(() => {
7158
- if (!open || !connecting || !walletsReady || !user?.id || walletUserPrivySession) return;
7175
+ if (!ready || !authenticated || !walletsReady || !user?.id || walletUserPrivySession) return;
7159
7176
  clearInlineOAuth();
7160
7177
  const embedded = (account) => account.walletClientType === "privy" && (!account.chainType || account.chainType === "ethereum");
7161
7178
  if (wallets.some(embedded) || user.linkedAccounts?.some(
7162
7179
  (account) => account.type === "wallet" && embedded(account)
7163
7180
  ))
7164
7181
  return;
7165
- if (attemptedWallet.current === user.id) return;
7166
- attemptedWallet.current = user.id;
7167
- walletFailed.current = false;
7168
- const current = generation.current;
7182
+ if (attemptedWallet.current?.userId === user.id) return;
7183
+ const attempt = { userId: user.id, failed: false };
7184
+ attemptedWallet.current = attempt;
7185
+ setSignerError(null);
7169
7186
  void createWallet().catch((failure) => {
7170
- if (attemptedWallet.current === user.id) walletFailed.current = true;
7171
- if (active.current && current === generation.current)
7172
- setError(message(failure));
7187
+ if (!mounted.current || attemptedWallet.current !== attempt) return;
7188
+ attempt.failed = true;
7189
+ const detail = message(failure);
7190
+ setSignerError({ attempt, message: detail });
7191
+ onSignerCreationError?.();
7173
7192
  });
7174
7193
  }, [
7175
- open,
7176
- connecting,
7194
+ ready,
7195
+ authenticated,
7177
7196
  walletsReady,
7178
7197
  wallets,
7179
7198
  user,
7180
7199
  createWallet,
7181
7200
  walletAttempt,
7182
- walletUserPrivySession
7201
+ walletUserPrivySession,
7202
+ onSignerCreationError
7183
7203
  ]);
7184
7204
  const run = async (action, needsPrivy = true) => {
7185
7205
  if (operation.current || needsPrivy && !ready) return;
@@ -7335,7 +7355,7 @@ function InlineConnectModal(props) {
7335
7355
  setStep("choice");
7336
7356
  return;
7337
7357
  }
7338
- if (walletFailed.current) attemptedWallet.current = null;
7358
+ if (attemptedWallet.current?.failed) attemptedWallet.current = null;
7339
7359
  setWalletAttempt((value) => value + 1);
7340
7360
  onRetry?.();
7341
7361
  };
@@ -7972,10 +7992,15 @@ var STATUS_LABELS = {
7972
7992
  var activityTimeFormat = new Intl.DateTimeFormat(void 0, { timeStyle: "short" });
7973
7993
  function formatRowAmount(row) {
7974
7994
  if (row.amount === void 0 || row.decimals === void 0 || !row.tokenSymbol) return void 0;
7995
+ const digits = Math.min(4, fluentAmountFractionDigits(row.tokenSymbol));
7975
7996
  const [whole = "0", fraction = ""] = formatUnits(row.amount, row.decimals).split(".");
7976
- const trimmed = fraction.slice(0, 4).replace(/0+$/, "");
7997
+ const trimmed = fraction.slice(0, digits).replace(/0+$/, "");
7977
7998
  return `${trimmed ? `${whole}.${trimmed}` : whole} ${row.tokenSymbol}`;
7978
7999
  }
8000
+ function formatRowExactAmount(row) {
8001
+ if (row.amount === void 0 || row.decimals === void 0 || !row.tokenSymbol) return void 0;
8002
+ return `${formatUnits(row.amount, row.decimals)} ${row.tokenSymbol}`;
8003
+ }
7979
8004
  function HistoryRow({
7980
8005
  row,
7981
8006
  usd,
@@ -8010,7 +8035,14 @@ function HistoryRow({
8010
8035
  ] })
8011
8036
  ] }),
8012
8037
  /* @__PURE__ */ jsxs("span", { className: "flex shrink-0 flex-col items-end gap-1", children: [
8013
- amount ? /* @__PURE__ */ jsx("span", { className: `text-sm font-medium leading-4 ${inFlight ? "opacity-70" : ""}`, children: amount }) : null,
8038
+ amount ? /* @__PURE__ */ jsx(
8039
+ "span",
8040
+ {
8041
+ className: `text-sm font-medium leading-4 ${inFlight ? "opacity-70" : ""}`,
8042
+ title: formatRowExactAmount(row),
8043
+ children: amount
8044
+ }
8045
+ ) : null,
8014
8046
  amount && usd ? /* @__PURE__ */ jsx(
8015
8047
  "span",
8016
8048
  {
@@ -8101,7 +8133,7 @@ function BridgeActivityDetail({
8101
8133
  /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center gap-3 py-3", children: [
8102
8134
  /* @__PURE__ */ jsx(ActivityTokenTile, { tokenSymbol: row.tokenSymbol, badge: row.direction }),
8103
8135
  /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center gap-0", children: [
8104
- /* @__PURE__ */ jsx("span", { className: "min-w-0 truncate text-2xl font-medium", children: amount ?? rowTitle(row) }),
8136
+ /* @__PURE__ */ jsx("span", { className: "min-w-0 truncate text-2xl font-medium", title: formatRowExactAmount(row), children: amount ?? rowTitle(row) }),
8105
8137
  amount && usd ? /* @__PURE__ */ jsx(
8106
8138
  "span",
8107
8139
  {
@@ -8190,10 +8222,14 @@ function TooltipContent({
8190
8222
  }
8191
8223
  ) });
8192
8224
  }
8193
- function formatAmount(value, decimals) {
8225
+ function formatAmount(value, decimals, symbol) {
8194
8226
  if (value === void 0) return "\u2014";
8227
+ const digits = symbol ? fluentAmountFractionDigits(symbol) : FLUENT_AMOUNT_FRACTION_DIGITS;
8195
8228
  const [whole = "0", fraction = ""] = formatUnits(value, decimals).split(".");
8196
- const trimmed = fraction.slice(0, 6).replace(/0+$/, "");
8229
+ const trimmed = fraction.slice(0, digits).replace(/0+$/, "");
8230
+ if (!trimmed && whole === "0" && value > 0n && digits < FLUENT_AMOUNT_FRACTION_DIGITS) {
8231
+ return `<0.${"1".padStart(digits, "0")}`;
8232
+ }
8197
8233
  return trimmed ? `${whole}.${trimmed}` : whole;
8198
8234
  }
8199
8235
  function formatUsd(usd) {
@@ -8227,7 +8263,8 @@ function SummaryRow({
8227
8263
  label,
8228
8264
  value,
8229
8265
  secondary,
8230
- tooltip
8266
+ tooltip,
8267
+ valueTitle
8231
8268
  }) {
8232
8269
  return /* @__PURE__ */ jsxs("div", { className: "flex items-start justify-between gap-5 text-sm", children: [
8233
8270
  /* @__PURE__ */ jsxs("span", { className: "inline-flex items-center gap-1 text-foreground/80", children: [
@@ -8246,7 +8283,7 @@ function SummaryRow({
8246
8283
  ] }) : null
8247
8284
  ] }),
8248
8285
  /* @__PURE__ */ jsxs("span", { className: "flex items-center gap-2 text-right", children: [
8249
- /* @__PURE__ */ jsx("span", { className: "text-foreground", children: value }),
8286
+ /* @__PURE__ */ jsx("span", { className: "text-foreground", title: valueTitle, children: value }),
8250
8287
  secondary ? /* @__PURE__ */ jsx("span", { className: "size-0.5 rounded-full bg-foreground/50" }) : null,
8251
8288
  secondary ? /* @__PURE__ */ jsx("span", { className: "text-foreground/60", children: secondary }) : null
8252
8289
  ] })
@@ -8543,18 +8580,17 @@ function sortFluentTransactionHistory(entries) {
8543
8580
  (left, right) => right.timestamp - left.timestamp || left.id.localeCompare(right.id)
8544
8581
  );
8545
8582
  }
8546
- var AMOUNT_FRACTION_DIGITS = 6;
8547
- var SMALLEST_SHOWN_AMOUNT = 10 ** -AMOUNT_FRACTION_DIGITS;
8548
- function isFluentDustAmount(amount) {
8583
+ function isFluentDustAmount(amount, fractionDigits = FLUENT_AMOUNT_FRACTION_DIGITS) {
8549
8584
  const numeric = Number(amount);
8550
- return Number.isFinite(numeric) && numeric > 0 && numeric < SMALLEST_SHOWN_AMOUNT;
8585
+ return Number.isFinite(numeric) && numeric > 0 && numeric < 10 ** -fractionDigits;
8551
8586
  }
8552
8587
  function formatFluentTransactionAmount(entry) {
8553
8588
  const sign = entry.direction === "sent" ? "\u2212" : "+";
8554
- if (isFluentDustAmount(entry.amount)) {
8555
- return `${sign}<0${FLUENT_DECIMAL_SEPARATOR}000001 ${entry.symbol}`;
8589
+ const digits = fluentAmountFractionDigits(entry.symbol);
8590
+ if (isFluentDustAmount(entry.amount, digits)) {
8591
+ return `${sign}<0${FLUENT_DECIMAL_SEPARATOR}${"1".padStart(digits, "0")} ${entry.symbol}`;
8556
8592
  }
8557
- return `${sign}${formatFluentLocaleAmount(entry.amount, AMOUNT_FRACTION_DIGITS)} ${entry.symbol}`;
8593
+ return `${sign}${formatFluentLocaleAmount(entry.amount, digits)} ${entry.symbol}`;
8558
8594
  }
8559
8595
  var HYPERLANE_GRAPHQL_ENDPOINT = "https://api.hyperlane.xyz/v1/graphql";
8560
8596
  var HYPERLANE_HISTORY_LIMIT = 25;
@@ -9026,12 +9062,14 @@ function PendingActivityRow({
9026
9062
  ] })
9027
9063
  ] }),
9028
9064
  /* @__PURE__ */ jsxs("span", { className: "flex shrink-0 flex-col items-end gap-1", children: [
9029
- /* @__PURE__ */ jsxs("span", { className: "text-sm font-medium leading-4 tabular-nums opacity-70", children: [
9030
- "\u2212",
9031
- formatFluentLocaleAmount(transfer.amount, 6),
9032
- " ",
9033
- transfer.symbol
9034
- ] }),
9065
+ /* @__PURE__ */ jsx(
9066
+ "span",
9067
+ {
9068
+ className: "text-sm font-medium leading-4 tabular-nums opacity-70",
9069
+ title: `${transfer.amount} ${transfer.symbol}`,
9070
+ children: formatFluentTransactionAmount({ ...transfer, direction: "sent" })
9071
+ }
9072
+ ),
9035
9073
  /* @__PURE__ */ jsx(ActivityUsd, { usd })
9036
9074
  ] })
9037
9075
  ] }) });
@@ -9121,6 +9159,7 @@ function ActivityAmount({
9121
9159
  return /* @__PURE__ */ jsx(
9122
9160
  "span",
9123
9161
  {
9162
+ title: `${movement.amount} ${movement.symbol}`,
9124
9163
  className: cn(
9125
9164
  "text-sm leading-4 tabular-nums",
9126
9165
  !secondary && "font-medium",
@@ -9370,7 +9409,7 @@ function FluentActivityDetail({
9370
9409
  const movements = entry.kind === "movement" ? [entry] : entry.movements;
9371
9410
  const swap = splitFluentSwap(movements);
9372
9411
  const headed = swap ? swap.received : movements;
9373
- const heading = headed.length > 0 ? headed.map(formatFluentTransactionAmount).join(", ") : FLUENT_TRANSACTION_OPERATION_LABEL;
9412
+ 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;
9374
9413
  const rate = swap?.received.length === 1 && swap.paid.length === 1 ? formatSwapRate(swap.paid[0], swap.received[0]) : void 0;
9375
9414
  const openExplorer = explorerOpener(track);
9376
9415
  const transactionHash = entry.kind === "operation" ? entry.transactionHash : entry.hash;
@@ -9526,7 +9565,7 @@ function SwapSideRow({
9526
9565
  approximate = false
9527
9566
  }) {
9528
9567
  const usd = formatActivityUsd(movement.amount, priceOf(movement));
9529
- return /* @__PURE__ */ jsx(DetailRow, { label, children: /* @__PURE__ */ jsxs("span", { className: "tabular-nums", children: [
9568
+ return /* @__PURE__ */ jsx(DetailRow, { label, children: /* @__PURE__ */ jsxs("span", { className: "tabular-nums", title: `${movement.amount} ${movement.symbol}`, children: [
9530
9569
  approximate ? "\u2248 " : null,
9531
9570
  formatFluentTransactionAmount(movement).slice(1),
9532
9571
  usd ? /* @__PURE__ */ jsxs("span", { className: "font-normal text-muted-foreground", children: [
@@ -9626,7 +9665,7 @@ function DepositSwapActivityDetail({
9626
9665
  ActivityDetailHeader,
9627
9666
  {
9628
9667
  symbol: to.symbol,
9629
- heading: received ? `\u2248 ${formatFluentTransactionAmount(received)}` : `${formatFluentTransactionAmount(paid).slice(1)} \u2192 ${to.symbol}`,
9668
+ heading: /* @__PURE__ */ jsx("span", { title: `${(received ?? paid).amount} ${(received ?? paid).symbol}`, children: received ? `\u2248 ${formatFluentTransactionAmount(received)}` : `${formatFluentTransactionAmount(paid).slice(1)} \u2192 ${to.symbol}` }),
9630
9669
  usd: usd ? `${received ? "\u2248 " : ""}${usd}` : void 0,
9631
9670
  subtitle: `Deposit ${from.symbol} \u2192 ${to.symbol}`,
9632
9671
  timestamp: startedAt ?? Date.now(),
@@ -9691,6 +9730,76 @@ function DepositSwapActivityDetail({
9691
9730
  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
9692
9731
  ] });
9693
9732
  }
9733
+ function SentTransferDetail({
9734
+ transfer,
9735
+ account,
9736
+ network,
9737
+ priceOf,
9738
+ track
9739
+ }) {
9740
+ const openExplorer = explorerOpener(track);
9741
+ const movement = { amount: transfer.amount, direction: "sent", symbol: transfer.symbol };
9742
+ return /* @__PURE__ */ jsxs("div", { className: "flex w-full flex-col gap-2.5", children: [
9743
+ /* @__PURE__ */ jsx(
9744
+ ActivityDetailHeader,
9745
+ {
9746
+ symbol: transfer.symbol,
9747
+ heading: /* @__PURE__ */ jsx("span", { title: `${transfer.amount} ${transfer.symbol}`, children: formatFluentTransactionAmount(movement) }),
9748
+ usd: formatActivityUsd(
9749
+ transfer.amount,
9750
+ priceOf({ identity: transfer.tokenIdentity, symbol: transfer.symbol })
9751
+ ),
9752
+ subtitle: "Sent",
9753
+ timestamp: transfer.startedAt,
9754
+ entrance: true
9755
+ }
9756
+ ),
9757
+ /* @__PURE__ */ jsxs(
9758
+ "dl",
9759
+ {
9760
+ className: cn("flex flex-col gap-5 text-sm bg-white/5 p-4 rounded-2xl", riseIn("delay-300")),
9761
+ children: [
9762
+ /* @__PURE__ */ jsx(DetailRow, { label: "Status", children: /* @__PURE__ */ jsx(
9763
+ "span",
9764
+ {
9765
+ className: "inline-flex items-center gap-1.5 animate-in fade-in-0 zoom-in-90 duration-300 ease-out motion-reduce:animate-none",
9766
+ children: transfer.hash ? /* @__PURE__ */ jsx("span", { className: "text-green-400", children: "Confirmed" }) : /* @__PURE__ */ jsxs(Fragment, { children: [
9767
+ /* @__PURE__ */ jsx(Spinner, { className: "size-3.5 text-muted-foreground" }),
9768
+ /* @__PURE__ */ jsx("span", { className: "text-foreground/70", children: "Pending" })
9769
+ ] })
9770
+ },
9771
+ transfer.hash ? "confirmed" : "pending"
9772
+ ) }),
9773
+ /* @__PURE__ */ jsx(DetailRow, { label: "From", children: /* @__PURE__ */ jsx("span", { title: account, children: formatAddress(account) }) }),
9774
+ /* @__PURE__ */ jsx(DetailRow, { label: "To", children: /* @__PURE__ */ jsx(
9775
+ HashMenu,
9776
+ {
9777
+ hash: transfer.to,
9778
+ url: explorerAddress(transfer.to, network),
9779
+ onOpen: (url) => openExplorer(url, "explorer"),
9780
+ label: "Address"
9781
+ }
9782
+ ) }),
9783
+ /* @__PURE__ */ jsx(FluentNetworkRow, { network })
9784
+ ]
9785
+ }
9786
+ ),
9787
+ transfer.hash ? /* @__PURE__ */ jsx(
9788
+ "dl",
9789
+ {
9790
+ className: cn("flex flex-col gap-5 text-sm bg-white/5 p-4 rounded-2xl", riseIn("delay-100")),
9791
+ children: /* @__PURE__ */ jsx(DetailRow, { label: "Transaction ID", children: /* @__PURE__ */ jsx(
9792
+ HashMenu,
9793
+ {
9794
+ hash: transfer.hash,
9795
+ url: explorerTransaction(transfer.hash, network),
9796
+ onOpen: (url) => openExplorer(url, "transaction")
9797
+ }
9798
+ ) })
9799
+ }
9800
+ ) : null
9801
+ ] });
9802
+ }
9694
9803
  var FLUENT_RPC_TIMEOUT_MS = 3e4;
9695
9804
  var FLUENT_RPC_RETRY_COUNT = 3;
9696
9805
  var FLUENT_RPC_RETRY_DELAY_MS = 300;
@@ -10027,8 +10136,9 @@ function formatEstimatedFee(params) {
10027
10136
  };
10028
10137
  }
10029
10138
  return {
10030
- value: `\u2248 ${formatAmount(inFeeToken, feeToken.decimals)} ${feeToken.symbol}`,
10031
- secondary: usdOf(inFeeToken, feeToken.decimals, usdPrices[feeToken.identity])
10139
+ value: `\u2248 ${formatAmount(inFeeToken, feeToken.decimals, feeToken.symbol)} ${feeToken.symbol}`,
10140
+ secondary: usdOf(inFeeToken, feeToken.decimals, usdPrices[feeToken.identity]),
10141
+ exact: `${formatUnits(inFeeToken, feeToken.decimals)} ${feeToken.symbol}`
10032
10142
  };
10033
10143
  }
10034
10144
  function SendTokenForm({
@@ -10081,7 +10191,7 @@ function SendTokenForm({
10081
10191
  decimals: token.decimals,
10082
10192
  balance: rawBalance
10083
10193
  }) : null;
10084
- const balanceNote = token && rawBalance !== null ? `${formatAmount(rawBalance, token.decimals)} ${token.symbol}` : balancesBusy ? "Loading balance..." : "Balance unavailable";
10194
+ const balanceNote = token && rawBalance !== null ? `${formatAmount(rawBalance, token.decimals, token.symbol)} ${token.symbol}` : balancesBusy ? "Loading balance..." : "Balance unavailable";
10085
10195
  const amountUsd = token ? formatAmountUsd(amount, usdPrices[token.identity]) : void 0;
10086
10196
  const fee = feeToken ? checkFluentTransferFee({
10087
10197
  feeToken,
@@ -10111,9 +10221,15 @@ function SendTokenForm({
10111
10221
  const feeSponsored = Boolean(feeToken && isFluentNativeToken(feeToken) && sponsorshipAvailable);
10112
10222
  const feeBalanceLabel = (candidate) => {
10113
10223
  const entry = balanceByIdentity.get(candidate.identity);
10114
- if (entry?.status === "ready" && entry.raw !== null) return formatAmount(entry.raw, candidate.decimals);
10224
+ if (entry?.status === "ready" && entry.raw !== null) {
10225
+ return formatAmount(entry.raw, candidate.decimals, candidate.symbol);
10226
+ }
10115
10227
  return balancesBusy ? "\u2026" : "\u2014";
10116
10228
  };
10229
+ const feeBalanceExact = (candidate) => {
10230
+ const entry = balanceByIdentity.get(candidate.identity);
10231
+ return entry?.status === "ready" && entry.raw !== null ? formatUnits(entry.raw, candidate.decimals) : void 0;
10232
+ };
10117
10233
  const ready = Boolean(token) && recipientCheck.status === "ok" && amountCheck?.status === "ok" && fee.status !== "blocked" && !sending;
10118
10234
  const handleSend = async () => {
10119
10235
  if (!token || !feeToken) return;
@@ -10282,7 +10398,14 @@ function SendTokenForm({
10282
10398
  /* @__PURE__ */ jsx(SelectContent, { align: "end", alignItemWithTrigger: false, className: "min-w-52", children: gasTokens.map((candidate) => /* @__PURE__ */ jsxs(SelectItem, { value: candidate.identity, children: [
10283
10399
  /* @__PURE__ */ jsx(TokenGlyph, { token: candidate, className: "size-5" }),
10284
10400
  /* @__PURE__ */ jsx("span", { children: candidate.symbol }),
10285
- /* @__PURE__ */ jsx("span", { className: "ml-auto pl-4 text-foreground/60", children: feeBalanceLabel(candidate) })
10401
+ /* @__PURE__ */ jsx(
10402
+ "span",
10403
+ {
10404
+ className: "ml-auto pl-4 text-foreground/60",
10405
+ title: feeBalanceExact(candidate),
10406
+ children: feeBalanceLabel(candidate)
10407
+ }
10408
+ )
10286
10409
  ] }, candidate.identity)) })
10287
10410
  ]
10288
10411
  }
@@ -10296,6 +10419,7 @@ function SendTokenForm({
10296
10419
  {
10297
10420
  label: "Est. network fee",
10298
10421
  value: estimatedFee.value,
10422
+ valueTitle: estimatedFee.exact,
10299
10423
  secondary: estimatedFee.secondary,
10300
10424
  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."
10301
10425
  }
@@ -10785,6 +10909,7 @@ function useFluentUserTokens(options) {
10785
10909
  }
10786
10910
 
10787
10911
  // src/hooks/useFluentTokenBalances.ts
10912
+ var FLUENT_BALANCE_POLL_INTERVAL_MS = 1e4;
10788
10913
  function useFluentTokenBalances(params) {
10789
10914
  const { network, chain } = useFluentWidgetNetwork();
10790
10915
  const defaultTokens = useMemo(
@@ -10816,35 +10941,43 @@ function useFluentTokenBalances(params) {
10816
10941
  const [busy, setBusy] = useState(false);
10817
10942
  const [status, setStatus] = useState("Connect a Fluent account");
10818
10943
  const inFlight = useRef(null);
10819
- const refresh = useCallback(async () => {
10820
- inFlight.current?.abort();
10821
- const controller = new AbortController();
10822
- inFlight.current = controller;
10823
- const { signal } = controller;
10824
- if (!params.accountAddress) {
10825
- setBalances([]);
10826
- setStatus("Connect a Fluent account");
10827
- return;
10828
- }
10829
- setBusy(true);
10830
- setStatus("Checking token balances");
10831
- try {
10832
- const next = await readFluentTokenBalances({
10833
- client: publicClient,
10834
- account: params.accountAddress,
10835
- tokens: displayTokens
10836
- });
10837
- if (signal.aborted) return;
10838
- setBalances(next);
10839
- setStatus("Balances updated");
10840
- } catch {
10841
- if (signal.aborted) return;
10842
- setBalances([]);
10843
- setStatus("Could not load balances");
10844
- } finally {
10845
- if (!signal.aborted) setBusy(false);
10846
- }
10847
- }, [displayTokens, params.accountAddress, publicClient]);
10944
+ const refresh = useCallback(
10945
+ async (options) => {
10946
+ if (options?.quiet && inFlight.current) return;
10947
+ inFlight.current?.abort();
10948
+ const controller = new AbortController();
10949
+ inFlight.current = controller;
10950
+ const { signal } = controller;
10951
+ if (!params.accountAddress) {
10952
+ setBalances([]);
10953
+ setStatus("Connect a Fluent account");
10954
+ return;
10955
+ }
10956
+ if (!options?.quiet) {
10957
+ setBusy(true);
10958
+ setStatus("Checking token balances");
10959
+ }
10960
+ try {
10961
+ const next = await readFluentTokenBalances({
10962
+ client: publicClient,
10963
+ account: params.accountAddress,
10964
+ tokens: displayTokens
10965
+ });
10966
+ if (signal.aborted) return;
10967
+ setBalances(next);
10968
+ setStatus("Balances updated");
10969
+ } catch {
10970
+ if (signal.aborted) return;
10971
+ if (options?.quiet) return;
10972
+ setBalances([]);
10973
+ setStatus("Could not load balances");
10974
+ } finally {
10975
+ if (inFlight.current === controller) inFlight.current = null;
10976
+ if (!signal.aborted && !options?.quiet) setBusy(false);
10977
+ }
10978
+ },
10979
+ [displayTokens, params.accountAddress, publicClient]
10980
+ );
10848
10981
  useEffect(() => {
10849
10982
  setBalances([]);
10850
10983
  setStatus(
@@ -10855,6 +10988,15 @@ function useFluentTokenBalances(params) {
10855
10988
  refresh();
10856
10989
  return () => inFlight.current?.abort();
10857
10990
  }, [refresh, params.revisionCounter]);
10991
+ const { pollIntervalMs } = params;
10992
+ useEffect(() => {
10993
+ if (!pollIntervalMs || !params.accountAddress) return;
10994
+ const timer = setInterval(() => {
10995
+ if (typeof document !== "undefined" && document.visibilityState === "hidden") return;
10996
+ void refresh({ quiet: true });
10997
+ }, pollIntervalMs);
10998
+ return () => clearInterval(timer);
10999
+ }, [pollIntervalMs, params.accountAddress, refresh]);
10858
11000
  return {
10859
11001
  /** Balances for every display token, in display order. */
10860
11002
  balances,
@@ -10907,6 +11049,9 @@ function formatFluentPortfolioPnlPercent(percent) {
10907
11049
 
10908
11050
  // src/core/tokenPrices.ts
10909
11051
  var COINGECKO_API = "https://api.coingecko.com/api/v3";
11052
+ var DEFILLAMA_COINS_API = "https://coins.llama.fi";
11053
+ var FLUENT_PRICE_REQUEST_TIMEOUT_MS = 5e3;
11054
+ var DEFILLAMA_FLUENT_MAINNET_CHAIN = "fluent";
10910
11055
  var FIXED_USD_PRICES = {
10911
11056
  USDnr: 1
10912
11057
  };
@@ -10928,21 +11073,44 @@ function getCoinGeckoMarketChartRangeUrl(coinId, fromUnixSeconds, toUnixSeconds)
10928
11073
  url.searchParams.set("to", String(toUnixSeconds));
10929
11074
  return url.toString();
10930
11075
  }
11076
+ function getDefiLlamaCurrentPricesUrl(coinKeys) {
11077
+ return `${DEFILLAMA_COINS_API}/prices/current/${coinKeys.join(",")}`;
11078
+ }
11079
+ function getDefiLlamaHistoricalPricesUrl(coinKeys, unixSeconds) {
11080
+ return `${DEFILLAMA_COINS_API}/prices/historical/${unixSeconds}/${coinKeys.join(",")}`;
11081
+ }
10931
11082
  function resolveCoinbaseBaseSymbol(symbol) {
10932
11083
  return COINBASE_BASE_BY_SYMBOL[symbol] ?? null;
10933
11084
  }
10934
11085
  function resolveCoinGeckoCoinId(symbol) {
10935
11086
  return COINGECKO_COIN_ID_BY_SYMBOL[symbol] ?? null;
10936
11087
  }
11088
+ function resolveDefiLlamaCoinKey(token) {
11089
+ if (!token.native && token.address && token.chainId === fluentMainnet.id) {
11090
+ return `${DEFILLAMA_FLUENT_MAINNET_CHAIN}:${token.address}`;
11091
+ }
11092
+ const coinId = resolveCoinGeckoCoinId(token.symbol);
11093
+ return coinId ? `coingecko:${coinId}` : null;
11094
+ }
10937
11095
  function getFixedUsdPrice(symbol) {
10938
11096
  return FIXED_USD_PRICES[symbol] ?? null;
10939
11097
  }
11098
+ async function fetchWithTimeout(url) {
11099
+ const controller = new AbortController();
11100
+ const timer = setTimeout(() => controller.abort(), FLUENT_PRICE_REQUEST_TIMEOUT_MS);
11101
+ try {
11102
+ return await fetch(url, {
11103
+ headers: {
11104
+ Accept: "application/json"
11105
+ },
11106
+ signal: controller.signal
11107
+ });
11108
+ } finally {
11109
+ clearTimeout(timer);
11110
+ }
11111
+ }
10940
11112
  async function fetchJson(url, provider) {
10941
- const response = await fetch(url, {
10942
- headers: {
10943
- Accept: "application/json"
10944
- }
10945
- });
11113
+ const response = await fetchWithTimeout(url);
10946
11114
  if (!response.ok) {
10947
11115
  const body = await response.text();
10948
11116
  throw new Error(`${provider} request failed: ${response.status} ${body}`);
@@ -10951,12 +11119,13 @@ async function fetchJson(url, provider) {
10951
11119
  }
10952
11120
  async function fetchCoinbaseSpotUsdPrice(coinbaseSymbol) {
10953
11121
  try {
10954
- const response = await fetch(getCoinbaseSpotPriceUrl(coinbaseSymbol));
11122
+ const response = await fetchWithTimeout(getCoinbaseSpotPriceUrl(coinbaseSymbol));
10955
11123
  if (!response.ok) return null;
10956
11124
  const payload = await response.json();
10957
11125
  const amount = Number(payload.data?.amount);
10958
11126
  return Number.isFinite(amount) ? amount : null;
10959
- } catch {
11127
+ } catch (error) {
11128
+ debugWarn("[fluent-connect] Coinbase spot price request failed", coinbaseSymbol, error);
10960
11129
  return null;
10961
11130
  }
10962
11131
  }
@@ -10985,97 +11154,222 @@ async function fetchCoinGeckoPrice24hAgo(coinId) {
10985
11154
  }
10986
11155
  return price24hAgo;
10987
11156
  }
10988
- async function fetchFluentTokenUsdPricePoints(symbols2) {
10989
- const unique = [...new Set(symbols2)];
10990
- const entries = await Promise.all(
10991
- unique.map(async (symbol) => {
10992
- const fixed = getFixedUsdPrice(symbol);
10993
- if (fixed !== null) {
10994
- return [symbol, { current: fixed, price24hAgo: fixed }];
10995
- }
10996
- const coinbaseSymbol = resolveCoinbaseBaseSymbol(symbol);
10997
- const coinGeckoCoinId = resolveCoinGeckoCoinId(symbol);
10998
- if (!coinbaseSymbol || !coinGeckoCoinId) return null;
10999
- try {
11000
- const current = await fetchCoinbaseSpotUsdPrice(coinbaseSymbol);
11001
- if (current === null) return null;
11002
- let price24hAgo = current;
11003
- try {
11004
- price24hAgo = await fetchCoinGeckoPrice24hAgo(coinGeckoCoinId);
11005
- } catch {
11006
- }
11007
- return [symbol, { current, price24hAgo }];
11008
- } catch {
11009
- return null;
11010
- }
11157
+ async function fetchDefiLlamaUsdPrices(url) {
11158
+ const prices = /* @__PURE__ */ new Map();
11159
+ try {
11160
+ const payload = await fetchJson(url, "DefiLlama");
11161
+ for (const [coinKey, coin] of Object.entries(payload.coins ?? {})) {
11162
+ const price = coin?.price;
11163
+ if (typeof price !== "number" || !Number.isFinite(price)) continue;
11164
+ prices.set(coinKey.toLowerCase(), price);
11165
+ }
11166
+ } catch (error) {
11167
+ debugWarn("[fluent-connect] DefiLlama price request failed", error);
11168
+ }
11169
+ return prices;
11170
+ }
11171
+ function getFluentPriceableTokens(tokens) {
11172
+ return tokens.filter((token) => isFluentDefaultToken(token));
11173
+ }
11174
+ async function fetchFluentTokenUsdPricePoints(tokens) {
11175
+ const subjects = /* @__PURE__ */ new Map();
11176
+ for (const token of getFluentPriceableTokens(tokens)) {
11177
+ subjects.set(fluentTokenIdentity(token), token);
11178
+ }
11179
+ const current = /* @__PURE__ */ new Map();
11180
+ const price24hAgo = /* @__PURE__ */ new Map();
11181
+ const fetched = [];
11182
+ for (const [identity, token] of subjects) {
11183
+ const fixed = getFixedUsdPrice(token.symbol);
11184
+ if (fixed !== null) {
11185
+ current.set(identity, fixed);
11186
+ price24hAgo.set(identity, fixed);
11187
+ } else {
11188
+ fetched.push([identity, token]);
11189
+ }
11190
+ }
11191
+ await Promise.all(
11192
+ fetched.map(async ([identity, token]) => {
11193
+ const coinbaseSymbol = resolveCoinbaseBaseSymbol(token.symbol);
11194
+ const coinGeckoCoinId = resolveCoinGeckoCoinId(token.symbol);
11195
+ const [spot, chart] = await Promise.all([
11196
+ coinbaseSymbol ? fetchCoinbaseSpotUsdPrice(coinbaseSymbol) : null,
11197
+ coinGeckoCoinId ? fetchCoinGeckoPrice24hAgo(coinGeckoCoinId).catch((error) => {
11198
+ debugWarn("[fluent-connect] CoinGecko chart request failed", coinGeckoCoinId, error);
11199
+ return null;
11200
+ }) : null
11201
+ ]);
11202
+ if (spot !== null) current.set(identity, spot);
11203
+ if (chart !== null) price24hAgo.set(identity, chart);
11011
11204
  })
11012
11205
  );
11206
+ const missingCurrent = coinKeysOf(fetched.filter(([identity]) => !current.has(identity)));
11207
+ const missing24hAgo = coinKeysOf(fetched.filter(([identity]) => !price24hAgo.has(identity)));
11208
+ const nowUnixSeconds = Math.floor(Date.now() / 1e3);
11209
+ const [llamaCurrent, llama24hAgo] = await Promise.all([
11210
+ missingCurrent.size > 0 ? fetchDefiLlamaUsdPrices(getDefiLlamaCurrentPricesUrl(uniqueCoinKeys(missingCurrent))) : /* @__PURE__ */ new Map(),
11211
+ missing24hAgo.size > 0 ? fetchDefiLlamaUsdPrices(
11212
+ getDefiLlamaHistoricalPricesUrl(
11213
+ uniqueCoinKeys(missing24hAgo),
11214
+ nowUnixSeconds - 24 * 60 * 60
11215
+ )
11216
+ ) : /* @__PURE__ */ new Map()
11217
+ ]);
11218
+ applyDefiLlamaPrices(missingCurrent, llamaCurrent, current);
11219
+ applyDefiLlamaPrices(missing24hAgo, llama24hAgo, price24hAgo);
11220
+ const points = {};
11221
+ for (const identity of subjects.keys()) {
11222
+ const currentPrice = current.get(identity);
11223
+ if (currentPrice === void 0) continue;
11224
+ points[identity] = {
11225
+ current: currentPrice,
11226
+ price24hAgo: price24hAgo.get(identity) ?? currentPrice
11227
+ };
11228
+ }
11229
+ return points;
11230
+ }
11231
+ function coinKeysOf(entries) {
11232
+ const keys = /* @__PURE__ */ new Map();
11233
+ for (const [identity, token] of entries) {
11234
+ const coinKey = resolveDefiLlamaCoinKey(token);
11235
+ if (coinKey) keys.set(identity, coinKey);
11236
+ }
11237
+ return keys;
11238
+ }
11239
+ function uniqueCoinKeys(keysByIdentity) {
11240
+ return [...new Set(keysByIdentity.values())];
11241
+ }
11242
+ function applyDefiLlamaPrices(keysByIdentity, pricesByCoinKey, target) {
11243
+ for (const [identity, coinKey] of keysByIdentity) {
11244
+ const price = pricesByCoinKey.get(coinKey.toLowerCase());
11245
+ if (price !== void 0) target.set(identity, price);
11246
+ }
11247
+ }
11248
+ var FLUENT_TOKEN_PRICE_TTL_MS = 5 * 6e4;
11249
+ var priceCache = /* @__PURE__ */ new Map();
11250
+ var priceInFlight = /* @__PURE__ */ new Map();
11251
+ function isFreshPriceEntry(entry, now) {
11252
+ return entry !== void 0 && now - entry.readAt < FLUENT_TOKEN_PRICE_TTL_MS;
11253
+ }
11254
+ function peekFluentTokenUsdPricePoints(tokens, now = Date.now()) {
11013
11255
  const prices = {};
11014
- for (const entry of entries) {
11015
- if (!entry) continue;
11016
- prices[entry[0]] = entry[1];
11256
+ for (const token of getFluentPriceableTokens(tokens)) {
11257
+ const identity = fluentTokenIdentity(token);
11258
+ const fixed = getFixedUsdPrice(token.symbol);
11259
+ if (fixed !== null) {
11260
+ prices[identity] = { current: fixed, price24hAgo: fixed };
11261
+ continue;
11262
+ }
11263
+ const entry = priceCache.get(identity);
11264
+ if (isFreshPriceEntry(entry, now) && entry?.point) prices[identity] = entry.point;
11017
11265
  }
11018
11266
  return prices;
11019
11267
  }
11268
+ function getFluentTokenUsdPriceExpiry(tokens) {
11269
+ let expiry = null;
11270
+ for (const token of getFluentPriceableTokens(tokens)) {
11271
+ const entry = priceCache.get(fluentTokenIdentity(token));
11272
+ if (!entry) continue;
11273
+ const at = entry.readAt + FLUENT_TOKEN_PRICE_TTL_MS;
11274
+ if (expiry === null || at < expiry) expiry = at;
11275
+ }
11276
+ return expiry;
11277
+ }
11278
+ async function readFluentTokenUsdPricePoints(tokens, now = Date.now()) {
11279
+ const points = {};
11280
+ const awaited = [];
11281
+ const toAsk = /* @__PURE__ */ new Map();
11282
+ for (const token of getFluentPriceableTokens(tokens)) {
11283
+ const identity = fluentTokenIdentity(token);
11284
+ const fixed = getFixedUsdPrice(token.symbol);
11285
+ if (fixed !== null) {
11286
+ points[identity] = { current: fixed, price24hAgo: fixed };
11287
+ continue;
11288
+ }
11289
+ const cached = priceCache.get(identity);
11290
+ if (isFreshPriceEntry(cached, now)) {
11291
+ if (cached?.point) points[identity] = cached.point;
11292
+ continue;
11293
+ }
11294
+ const inFlight = priceInFlight.get(identity);
11295
+ if (inFlight) {
11296
+ awaited.push([identity, inFlight]);
11297
+ continue;
11298
+ }
11299
+ toAsk.set(identity, token);
11300
+ }
11301
+ if (toAsk.size > 0) {
11302
+ const batch = fetchFluentTokenUsdPricePoints([...toAsk.values()]);
11303
+ for (const identity of toAsk.keys()) {
11304
+ const pending2 = batch.then((fetched) => {
11305
+ const point = fetched[identity] ?? null;
11306
+ priceCache.set(identity, { point, readAt: Date.now() });
11307
+ return point;
11308
+ });
11309
+ priceInFlight.set(identity, pending2);
11310
+ void pending2.finally(() => {
11311
+ if (priceInFlight.get(identity) === pending2) priceInFlight.delete(identity);
11312
+ });
11313
+ awaited.push([identity, pending2]);
11314
+ }
11315
+ }
11316
+ for (const [identity, pending2] of awaited) {
11317
+ const point = await pending2;
11318
+ if (point) points[identity] = point;
11319
+ }
11320
+ return points;
11321
+ }
11020
11322
  function splitFluentTokenUsdPricePoints(points) {
11021
11323
  const prices = {};
11022
11324
  const prices24hAgo = {};
11023
- for (const [symbol, point] of Object.entries(points)) {
11024
- prices[symbol] = point.current;
11025
- prices24hAgo[symbol] = point.price24hAgo;
11325
+ for (const [identity, point] of Object.entries(points)) {
11326
+ prices[identity] = point.current;
11327
+ prices24hAgo[identity] = point.price24hAgo;
11026
11328
  }
11027
11329
  return { prices, prices24hAgo };
11028
11330
  }
11029
- function getFluentPriceableSymbols(tokens) {
11030
- return tokens.filter(isFluentDefaultToken).map((token) => token.symbol);
11031
- }
11032
- function mapFluentPricesToTokenIdentities(tokens, pricesBySymbol) {
11033
- const byIdentity = {};
11034
- for (const token of tokens) {
11035
- if (!isFluentDefaultToken(token)) continue;
11036
- const price = pricesBySymbol[token.symbol];
11037
- if (price === void 0) continue;
11038
- byIdentity[fluentTokenIdentity(token)] = price;
11039
- }
11040
- return byIdentity;
11041
- }
11042
11331
 
11043
11332
  // src/hooks/useFluentTokenUsdPrices.ts
11044
11333
  function useFluentTokenUsdPrices(tokens) {
11045
- const symbolKey = useMemo(
11046
- () => getFluentPriceableSymbols(tokens).sort().join(","),
11334
+ const subjectKey = useMemo(
11335
+ () => getFluentPriceableTokens(tokens).map(fluentTokenIdentity).sort().join(","),
11047
11336
  [tokens]
11048
11337
  );
11049
- const [pricesBySymbol, setPricesBySymbol] = useState({});
11050
- const [pricesBySymbolYesterday, setPricesBySymbolYesterday] = useState({});
11051
- const [busy, setBusy] = useState(() => Boolean(symbolKey));
11338
+ const [points, setPoints] = useState({});
11339
+ const [busy, setBusy] = useState(() => Boolean(subjectKey));
11052
11340
  useEffect(() => {
11053
- if (!symbolKey) {
11054
- setPricesBySymbol({});
11055
- setPricesBySymbolYesterday({});
11341
+ if (!subjectKey) {
11342
+ setPoints({});
11056
11343
  setBusy(false);
11057
11344
  return;
11058
11345
  }
11346
+ const subjects = getFluentPriceableTokens(tokens);
11059
11347
  let active = true;
11060
- setBusy(true);
11061
- fetchFluentTokenUsdPricePoints(symbolKey.split(",")).then((points) => {
11062
- if (!active) return;
11063
- const next = splitFluentTokenUsdPricePoints(points);
11064
- setPricesBySymbol(next.prices);
11065
- setPricesBySymbolYesterday(next.prices24hAgo);
11348
+ let timer;
11349
+ const apply = (next) => {
11350
+ setPoints(next);
11066
11351
  setBusy(false);
11067
- });
11352
+ };
11353
+ const load = async () => {
11354
+ const next = await readFluentTokenUsdPricePoints(subjects);
11355
+ if (!active) return;
11356
+ apply(next);
11357
+ const expiry = getFluentTokenUsdPriceExpiry(subjects);
11358
+ if (expiry !== null) timer = setTimeout(load, Math.max(0, expiry - Date.now()));
11359
+ };
11360
+ const cached = peekFluentTokenUsdPricePoints(subjects);
11361
+ const everyCached = subjects.every((token) => fluentTokenIdentity(token) in cached);
11362
+ if (everyCached) apply(cached);
11363
+ else setBusy(true);
11364
+ void load();
11068
11365
  return () => {
11069
11366
  active = false;
11367
+ if (timer !== void 0) clearTimeout(timer);
11070
11368
  };
11071
- }, [symbolKey]);
11072
- const prices = useMemo(
11073
- () => mapFluentPricesToTokenIdentities(tokens, pricesBySymbol),
11074
- [tokens, pricesBySymbol]
11075
- );
11076
- const pricesYesterday = useMemo(
11077
- () => mapFluentPricesToTokenIdentities(tokens, pricesBySymbolYesterday),
11078
- [tokens, pricesBySymbolYesterday]
11369
+ }, [subjectKey]);
11370
+ const { prices, prices24hAgo: pricesYesterday } = useMemo(
11371
+ () => splitFluentTokenUsdPricePoints(points),
11372
+ [points]
11079
11373
  );
11080
11374
  return { prices, pricesYesterday, busy };
11081
11375
  }
@@ -11199,12 +11493,14 @@ function useFluentTransactionHistory(params) {
11199
11493
 
11200
11494
  // src/widget/walletMenuSubPages.ts
11201
11495
  var DEPOSIT_SWAP_TAB = "deposit-swap";
11496
+ var SENT_TRANSFER_TAB = "sent-transfer";
11202
11497
  var WALLET_MENU_SUB_PAGES = {
11203
11498
  settings: { title: "Settings" },
11204
11499
  send: { title: "Send" },
11205
11500
  bridge: { title: "Swap" },
11206
11501
  activity: { title: "Transfer" },
11207
11502
  [DEPOSIT_SWAP_TAB]: { title: "Transfer" },
11503
+ [SENT_TRANSFER_TAB]: { title: "Transfer" },
11208
11504
  // Closed with an X, not walked back from: leaving it is the rejection.
11209
11505
  review: { title: "Confirm transaction", dismiss: "close" }
11210
11506
  };
@@ -11745,6 +12041,7 @@ function WalletMenuActionCard({
11745
12041
  tokenListError = null,
11746
12042
  onSendToken,
11747
12043
  pendingTransfers,
12044
+ sentTransfer,
11748
12045
  sentDeposits,
11749
12046
  depositSwap,
11750
12047
  onMintUsdnr,
@@ -11917,7 +12214,12 @@ function WalletMenuActionCard({
11917
12214
  accountAddress,
11918
12215
  tokens,
11919
12216
  revisionCounter: balanceRevisionCounter,
11920
- userTokenStore
12217
+ userTokenStore,
12218
+ // The account drawer unmounts its content when it closes, so this card is
12219
+ // mounted exactly while the wallet menu is open: the mount reads once for
12220
+ // the opening, and the schedule catches transfers that arrive from outside
12221
+ // the widget while it stays open.
12222
+ pollIntervalMs: FLUENT_BALANCE_POLL_INTERVAL_MS
11921
12223
  });
11922
12224
  const { prices, pricesYesterday, busy: pricesBusy } = useFluentTokenUsdPrices(displayTokens);
11923
12225
  const activityPriceOf = useActivityPrices(prices, displayTokens);
@@ -12107,12 +12409,25 @@ function WalletMenuActionCard({
12107
12409
  onSend: onSendToken,
12108
12410
  onSent: () => {
12109
12411
  setHomePanel("activity");
12110
- onTabChange("home");
12412
+ onTabChange(SENT_TRANSFER_TAB);
12111
12413
  onRevealAccount?.();
12112
12414
  }
12113
12415
  }
12114
12416
  );
12115
12417
  }
12418
+ if (tab === SENT_TRANSFER_TAB) {
12419
+ if (!sentTransfer || !accountAddress) return null;
12420
+ return /* @__PURE__ */ jsx(
12421
+ SentTransferDetail,
12422
+ {
12423
+ transfer: sentTransfer,
12424
+ account: accountAddress,
12425
+ network: resolvedConfig.network,
12426
+ priceOf: activityPriceOf,
12427
+ track
12428
+ }
12429
+ );
12430
+ }
12116
12431
  if (tab === DEPOSIT_SWAP_TAB) {
12117
12432
  if (!depositSwap || !accountAddress) return null;
12118
12433
  return /* @__PURE__ */ jsx(
@@ -13875,7 +14190,13 @@ function BridgeForm({
13875
14190
  const receiveToken = twoStep && swapTarget ? swapTarget : deliveredToken;
13876
14191
  const receiveAmount = twoStep ? quote?.amountOut : bridge.receiveAmount;
13877
14192
  const approximate = isSwap || twoStep ? "\u2248 " : "";
13878
- const receiveText = receiveAmount === void 0 || receiveAmount === 0n ? twoStep && swapQuote.loading ? "\u2026" : "0" : `${approximate}${formatAmount(receiveAmount, receiveToken.decimals)}`;
14193
+ const receiveText = receiveAmount === void 0 || receiveAmount === 0n ? twoStep && swapQuote.loading ? "\u2026" : "0" : `${approximate}${formatAmount(receiveAmount, receiveToken.decimals, receiveToken.symbol)}`;
14194
+ const receiveExact = receiveAmount === void 0 || receiveAmount === 0n ? void 0 : `${formatUnits(receiveAmount, receiveToken.decimals)} ${receiveToken.symbol}`;
14195
+ const receiveUsd = formatAmountUsd(
14196
+ receiveAmount === void 0 ? "0" : formatUnits(receiveAmount, receiveToken.decimals),
14197
+ priceOf(receiveToken.symbol)
14198
+ );
14199
+ const receiveUsdText = receiveUsd && receiveAmount !== void 0 && receiveAmount > 0n ? `${approximate}${receiveUsd}` : receiveUsd;
13879
14200
  const isFastPath = deliveredToken.route === "fast-path";
13880
14201
  const showApprovalSteps = bridge.connected && !bridge.wrongChain && isErc20 && !isSwap;
13881
14202
  const approvalStep = Number(form.amount) > 0 && !bridge.needsApproval && !bridge.approving ? 2 : 1;
@@ -13920,7 +14241,7 @@ function BridgeForm({
13920
14241
  "span",
13921
14242
  {
13922
14243
  title: bridge.sourceBalance !== void 0 ? formatUnits(bridge.sourceBalance, token.decimals) : void 0,
13923
- children: bridge.balanceLoading ? "Loading balance..." : `${formatAmount(bridge.sourceBalance, token.decimals)} ${token.symbol}`
14244
+ children: bridge.balanceLoading ? "Loading balance..." : `${formatAmount(bridge.sourceBalance, token.decimals, token.symbol)} ${token.symbol}`
13924
14245
  }
13925
14246
  ),
13926
14247
  /* @__PURE__ */ jsx(
@@ -13945,6 +14266,7 @@ function BridgeForm({
13945
14266
  {
13946
14267
  className: `block truncate font-medium leading-[1.2] ${receiveText === "0" ? "text-foreground/40" : "text-foreground"}`,
13947
14268
  style: getAmountFontStyle(receiveText),
14269
+ title: receiveExact,
13948
14270
  children: receiveText
13949
14271
  }
13950
14272
  ) }),
@@ -13958,6 +14280,7 @@ function BridgeForm({
13958
14280
  }
13959
14281
  ) : /* @__PURE__ */ jsx(TokenChip, { symbol: deliveredToken.symbol })
13960
14282
  ] }),
14283
+ receiveUsdText ? /* @__PURE__ */ jsx("span", { className: "min-w-0 truncate text-sm text-foreground/60", title: receiveUsdText, children: receiveUsdText }) : null,
13961
14284
  swapProblem ? /* @__PURE__ */ jsx("span", { className: "text-xs text-destructive", children: swapProblem }) : null
13962
14285
  ] })
13963
14286
  ] }),
@@ -14011,7 +14334,8 @@ function BridgeForm({
14011
14334
  SummaryRow,
14012
14335
  {
14013
14336
  label: "Minimum received",
14014
- value: minimumOut === void 0 ? swapQuote.loading ? "Pricing\u2026" : "\u2014" : `${formatAmount(minimumOut, swapTarget.decimals)} ${swapTarget.symbol}`,
14337
+ value: minimumOut === void 0 ? swapQuote.loading ? "Pricing\u2026" : "\u2014" : `${formatAmount(minimumOut, swapTarget.decimals, swapTarget.symbol)} ${swapTarget.symbol}`,
14338
+ valueTitle: minimumOut === void 0 ? void 0 : `${formatUnits(minimumOut, swapTarget.decimals)} ${swapTarget.symbol}`,
14015
14339
  tooltip: SLIPPAGE_TOOLTIP
14016
14340
  }
14017
14341
  ),
@@ -14993,6 +15317,7 @@ function encodeBatchCall(call) {
14993
15317
  };
14994
15318
  }
14995
15319
  var FLUENT_ZERODEV_ERC20_PAYMASTER_QUERY = "selfFunded=true";
15320
+ var FLUENT_ZERODEV_ERC20_MIN_POSTOP_GAS = 50000n;
14996
15321
  function getFluentZeroDevErc20PaymasterTokens(network = "testnet") {
14997
15322
  return Object.fromEntries(
14998
15323
  getFluentDefaultWidgetGasTokens(network).filter((token) => !isFluentNativeToken(token) && token.address).map((token) => [
@@ -15070,7 +15395,7 @@ function createFluentZeroDevErc20Paymaster(params) {
15070
15395
  getPaymasterData: (userOperation) => {
15071
15396
  const contextToken = getPaymasterContextToken(userOperation.context);
15072
15397
  return paymasterClient.sponsorUserOperation({
15073
- userOperation: withoutChainMetadata(userOperation),
15398
+ userOperation: withMinimumPostOpGas(withoutChainMetadata(userOperation)),
15074
15399
  gasToken: contextToken ?? gasToken.address
15075
15400
  });
15076
15401
  }
@@ -15133,6 +15458,14 @@ function getPaymasterContextToken(context) {
15133
15458
  const token = context.token;
15134
15459
  return typeof token === "string" && token.startsWith("0x") ? token : void 0;
15135
15460
  }
15461
+ function withMinimumPostOpGas(userOperation) {
15462
+ const limit = userOperation.paymasterPostOpGasLimit;
15463
+ if (limit !== void 0 && limit >= FLUENT_ZERODEV_ERC20_MIN_POSTOP_GAS) return userOperation;
15464
+ return {
15465
+ ...userOperation,
15466
+ paymasterPostOpGasLimit: FLUENT_ZERODEV_ERC20_MIN_POSTOP_GAS
15467
+ };
15468
+ }
15136
15469
  function withoutChainMetadata(userOperation) {
15137
15470
  const {
15138
15471
  chain: _chain,
@@ -19973,6 +20306,7 @@ function FluentWidgetContent({
19973
20306
  if (!authenticated || !user?.id || directAuthInFlight.current) return;
19974
20307
  if (disconnectingRef.current) return;
19975
20308
  if (walletUserPrivySession) return;
20309
+ if (!privyReady || embeddedWalletCount === 0) return;
19976
20310
  if (session && !directAuthRequested.current && session.user?.id === user.id) return;
19977
20311
  if (!identityToken) {
19978
20312
  setWalletStatus("Waiting for Privy identity token");
@@ -20022,6 +20356,8 @@ function FluentWidgetContent({
20022
20356
  }
20023
20357
  }, [
20024
20358
  authenticated,
20359
+ privyReady,
20360
+ embeddedWalletCount,
20025
20361
  fluentConnect,
20026
20362
  identityToken,
20027
20363
  resolvedConfig.scopes,
@@ -20107,7 +20443,7 @@ function FluentWidgetContent({
20107
20443
  reviewOriginRef.current = null;
20108
20444
  const wasSend = batchReview?.id === FLUENT_SEND_TOKEN_OP_ID;
20109
20445
  if (outcome === "confirmed" && wasSend) {
20110
- setWalletMenuTab("home");
20446
+ setWalletMenuTab(SENT_TRANSFER_TAB);
20111
20447
  setAccountOpen(true);
20112
20448
  return;
20113
20449
  }
@@ -20150,10 +20486,12 @@ function FluentWidgetContent({
20150
20486
  });
20151
20487
  const [pendingTransfers, setPendingTransfers] = useState([]);
20152
20488
  const pendingTransferCount = useRef(0);
20489
+ const [sentTransfer, setSentTransfer] = useState(null);
20153
20490
  const beginTransfer = useCallback(
20154
20491
  (transfer) => {
20155
20492
  const id = `pending-${pendingTransferCount.current += 1}`;
20156
20493
  setPendingTransfers((list) => [...list, { ...transfer, id }]);
20494
+ setSentTransfer({ ...transfer, id });
20157
20495
  setWalletMenuPanel("activity");
20158
20496
  return id;
20159
20497
  },
@@ -20161,12 +20499,14 @@ function FluentWidgetContent({
20161
20499
  );
20162
20500
  const endTransfer = useCallback((id) => {
20163
20501
  setPendingTransfers((list) => list.filter((transfer) => transfer.id !== id));
20502
+ setSentTransfer((transfer) => transfer?.id === id && !transfer.hash ? null : transfer);
20164
20503
  }, []);
20165
20504
  const settleTransfer = useCallback(
20166
20505
  (id, hash) => {
20167
20506
  setPendingTransfers(
20168
20507
  (list) => list.map((transfer) => transfer.id === id ? { ...transfer, hash } : transfer)
20169
20508
  );
20509
+ setSentTransfer((transfer) => transfer?.id === id ? { ...transfer, hash } : transfer);
20170
20510
  setTimeout(() => {
20171
20511
  setPendingTransfers(
20172
20512
  (list) => list.map((transfer) => transfer.id === id ? { ...transfer, expired: true } : transfer)
@@ -20176,6 +20516,9 @@ function FluentWidgetContent({
20176
20516
  },
20177
20517
  [endTransfer]
20178
20518
  );
20519
+ useEffect(() => {
20520
+ if (walletMenuTab === SENT_TRANSFER_TAB && !sentTransfer) setWalletMenuTab("home");
20521
+ }, [walletMenuTab, sentTransfer, setWalletMenuTab]);
20179
20522
  const [sentDeposits, setSentDeposits] = useState([]);
20180
20523
  const addSentDeposit = useCallback((deposit) => {
20181
20524
  setSentDeposits((list) => [...list, deposit]);
@@ -20810,6 +21153,7 @@ function FluentWidgetContent({
20810
21153
  onPanelChange: setWalletMenuPanel,
20811
21154
  onSendToken: sendToken,
20812
21155
  pendingTransfers,
21156
+ sentTransfer: sentTransfer ?? void 0,
20813
21157
  sentDeposits,
20814
21158
  depositSwap,
20815
21159
  onMintUsdnr: mintUsdnr,
@@ -20849,6 +21193,7 @@ function FluentWidgetContent({
20849
21193
  InlineConnectModal,
20850
21194
  {
20851
21195
  open: connectOpen,
21196
+ onSignerCreationError: () => setConnectOpen(true),
20852
21197
  onClose: () => {
20853
21198
  setConnectOpen(false);
20854
21199
  setDirectAuthRequested(false);