@fluent.xyz/connect 0.8.1 → 0.8.3

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
@@ -5626,7 +5626,7 @@ function createFluentConnectForWidget(config) {
5626
5626
  }
5627
5627
 
5628
5628
  // package.json
5629
- var version = "0.8.1";
5629
+ var version = "0.8.3";
5630
5630
 
5631
5631
  // src/core/analytics.ts
5632
5632
  var INSTANCE_NAME = "fluent";
@@ -8566,16 +8566,27 @@ function SummaryRow({
8566
8566
  tooltip,
8567
8567
  valueTitle
8568
8568
  }) {
8569
+ const [tipOpen, setTipOpen] = useState(false);
8569
8570
  return /* @__PURE__ */ jsxs("div", { className: "flex items-start justify-between gap-5 text-sm", children: [
8570
8571
  /* @__PURE__ */ jsxs("span", { className: "inline-flex items-center gap-1 text-foreground/80", children: [
8571
8572
  label,
8572
- tooltip ? /* @__PURE__ */ jsxs(Tooltip, { children: [
8573
+ tooltip ? /* @__PURE__ */ jsxs(Tooltip, { open: tipOpen, onOpenChange: setTipOpen, children: [
8573
8574
  /* @__PURE__ */ jsx(
8574
8575
  TooltipTrigger,
8575
8576
  {
8576
- tabIndex: 0,
8577
8577
  "aria-label": `About the ${label.toLowerCase()}`,
8578
- render: /* @__PURE__ */ jsx("span", { className: "inline-flex cursor-default rounded-sm" }),
8578
+ render: (
8579
+ // `!` against an App's own `button` rule, as on `ConsentLink`. A press only
8580
+ // opens: hover has opened it already on a desktop, and a tap elsewhere closes it.
8581
+ /* @__PURE__ */ jsx(
8582
+ "button",
8583
+ {
8584
+ type: "button",
8585
+ className: "inline-flex cursor-help appearance-none rounded-sm border-0! bg-transparent! p-0! text-inherit!",
8586
+ onClick: () => setTipOpen(true)
8587
+ }
8588
+ )
8589
+ ),
8579
8590
  children: /* @__PURE__ */ jsx(Info, { className: "size-4 text-foreground/45" })
8580
8591
  }
8581
8592
  ),
@@ -9335,6 +9346,10 @@ var TOKENS_BY_NETWORK = {
9335
9346
  function getBridgeTokens(network) {
9336
9347
  return TOKENS_BY_NETWORK[network];
9337
9348
  }
9349
+ function getDefaultBridgeToken(network) {
9350
+ const usdc = getBridgeToken(network, "USDC");
9351
+ return isBridgeTokenAvailable(usdc) ? usdc : getBridgeToken(network, "ETH");
9352
+ }
9338
9353
  function getBridgeToken(network, symbol) {
9339
9354
  const token = TOKENS_BY_NETWORK[network].find((t) => t.symbol === symbol);
9340
9355
  if (!token) throw new Error(`Unknown bridge token ${symbol}`);
@@ -13922,6 +13937,119 @@ function useFluentSwapQuote({
13922
13937
  error: ready && query.error && !noRoute ? query.error.message : void 0
13923
13938
  };
13924
13939
  }
13940
+ var ORDER_DEPOSIT_MIN_TOKENS = "2";
13941
+ function getOrderDepositMinimum(decimals) {
13942
+ return parseUnits(ORDER_DEPOSIT_MIN_TOKENS, decimals);
13943
+ }
13944
+ function readOrderDepositApproval(payload) {
13945
+ try {
13946
+ const decoded = decodeFunctionData({ abi: erc20Abi, data: payload.data });
13947
+ if (decoded.functionName !== "approve") return void 0;
13948
+ const [spender, amount] = decoded.args;
13949
+ return { token: payload.to, spender, amount };
13950
+ } catch {
13951
+ return void 0;
13952
+ }
13953
+ }
13954
+ function hasAddressWord(data, address) {
13955
+ const wanted = padHex(address, { size: 32 }).slice(2).toLowerCase();
13956
+ const words = data.slice(10).toLowerCase();
13957
+ for (let offset = 0; offset + 64 <= words.length; offset += 64) {
13958
+ if (words.slice(offset, offset + 64) === wanted) return true;
13959
+ }
13960
+ return false;
13961
+ }
13962
+ function findOrderDepositQuoteFault({
13963
+ quote,
13964
+ sourceChainId,
13965
+ tokenIn,
13966
+ amountIn,
13967
+ recipient
13968
+ }) {
13969
+ if (quote.amountIn !== amountIn) return "it is for another amount";
13970
+ if (quote.amountOut <= 0n) return "it delivers nothing";
13971
+ if (quote.payloads.some((payload) => payload.chainId !== sourceChainId)) {
13972
+ return "it has a transaction on another chain";
13973
+ }
13974
+ if (quote.payloads.some((payload) => payload.value !== 0n)) return "it spends ETH";
13975
+ const order = quote.payloads[quote.payloads.length - 1];
13976
+ const approvals = quote.payloads.slice(0, -1);
13977
+ if (!order || approvals.length > 1) return "it is not an approval and an order";
13978
+ if (readOrderDepositApproval(order) || order.to.toLowerCase() === tokenIn.toLowerCase()) {
13979
+ return "its last transaction is not an order";
13980
+ }
13981
+ if (!hasAddressWord(order.data, recipient)) return "its order does not name the recipient";
13982
+ for (const payload of approvals) {
13983
+ const approval = readOrderDepositApproval(payload);
13984
+ if (!approval) return "its first transaction is not an approval";
13985
+ if (approval.token.toLowerCase() !== tokenIn.toLowerCase()) {
13986
+ return "it approves another token";
13987
+ }
13988
+ if (approval.amount > amountIn) return "it approves more than the amount sent";
13989
+ if (approval.spender.toLowerCase() !== order.to.toLowerCase()) {
13990
+ return "it approves a contract the order does not go to";
13991
+ }
13992
+ }
13993
+ return void 0;
13994
+ }
13995
+ async function sendOrderDeposit({
13996
+ quote,
13997
+ account,
13998
+ signer,
13999
+ onStep
14000
+ }) {
14001
+ const steps = [];
14002
+ for (const payload of quote.payloads) {
14003
+ const approval = readOrderDepositApproval(payload);
14004
+ if (approval) {
14005
+ const allowance = await signer.readAllowance(approval.token, account, approval.spender).catch(() => void 0);
14006
+ if (allowance !== void 0 && allowance >= approval.amount) continue;
14007
+ }
14008
+ steps.push({ payload, approval: Boolean(approval) });
14009
+ }
14010
+ let hash;
14011
+ for (const [index, step] of steps.entries()) {
14012
+ onStep?.(step.approval ? "approval" : "order");
14013
+ hash = await signer.sendTransaction(step.payload);
14014
+ if (index === steps.length - 1) break;
14015
+ if (await signer.waitForReceipt(hash) !== "success") {
14016
+ throw new Error("The approval transaction reverted");
14017
+ }
14018
+ }
14019
+ if (!hash) throw new Error("The quote has no transaction to sign");
14020
+ return hash;
14021
+ }
14022
+ var ORDER_DEPOSIT_ORDER_GAS = 250000n;
14023
+ async function estimateOrderDepositGas({
14024
+ quote,
14025
+ account,
14026
+ allowance,
14027
+ estimateGas
14028
+ }) {
14029
+ let total = 0n;
14030
+ for (const payload of quote.payloads) {
14031
+ const approval = readOrderDepositApproval(payload);
14032
+ if (approval) {
14033
+ if (allowance !== void 0 && allowance >= approval.amount) continue;
14034
+ total += await estimateGas({ ...payload, account });
14035
+ continue;
14036
+ }
14037
+ total += await estimateGas({ ...payload, account }).catch(() => ORDER_DEPOSIT_ORDER_GAS);
14038
+ }
14039
+ return total;
14040
+ }
14041
+ function getOrderDepositFeeShare(quote) {
14042
+ if (quote.amountIn <= 0n || quote.amountOut > quote.amountIn) return void 0;
14043
+ const bps = (quote.amountIn - quote.amountOut) * 10000n / quote.amountIn;
14044
+ return Number(bps) / 1e4;
14045
+ }
14046
+ var ORDER_DEPOSIT_FEE_SHARE_WARNING = 0.05;
14047
+ var ORDER_DEPOSIT_FEE_SHARE_HINT = 0.02;
14048
+ function getOrderDepositFeeNotice(share) {
14049
+ if (share > ORDER_DEPOSIT_FEE_SHARE_WARNING) return "warning";
14050
+ if (share > ORDER_DEPOSIT_FEE_SHARE_HINT) return "hint";
14051
+ return void 0;
14052
+ }
13925
14053
 
13926
14054
  // src/bridge/abi.ts
13927
14055
  var nativeGatewayAbi = [
@@ -14052,6 +14180,42 @@ var swapFacilityAbi = [
14052
14180
  ]
14053
14181
  }
14054
14182
  ];
14183
+ function describeDepositError({
14184
+ error,
14185
+ chainName,
14186
+ fallback: fallback2
14187
+ }) {
14188
+ if (isInsufficientFunds(error)) {
14189
+ return `Not enough ETH on ${chainName} to pay the network fee. Add ETH to your wallet, or let the wallet pay gas another way, and try again.`;
14190
+ }
14191
+ if (error instanceof BaseError) return error.shortMessage;
14192
+ if (error instanceof Error) return error.message;
14193
+ return fallback2;
14194
+ }
14195
+ var INSUFFICIENT_FUNDS_TEXTS = ["insufficient funds", "exceeds the balance of the account"];
14196
+ function isInsufficientFunds(error) {
14197
+ return errorTexts(error).some((text) => {
14198
+ const lowered = text.toLowerCase();
14199
+ return INSUFFICIENT_FUNDS_TEXTS.some((needle) => lowered.includes(needle));
14200
+ });
14201
+ }
14202
+ function errorTexts(error) {
14203
+ const texts = [];
14204
+ let current = error;
14205
+ for (let depth = 0; depth < 10 && current !== void 0 && current !== null; depth += 1) {
14206
+ if (current instanceof BaseError) {
14207
+ texts.push(current.shortMessage, current.details, ...current.metaMessages ?? []);
14208
+ }
14209
+ if (current instanceof Error) {
14210
+ texts.push(current.message);
14211
+ current = current.cause;
14212
+ continue;
14213
+ }
14214
+ if (typeof current === "string") texts.push(current);
14215
+ break;
14216
+ }
14217
+ return texts.filter((text) => typeof text === "string" && text.length > 0);
14218
+ }
14055
14219
 
14056
14220
  // src/bridge/fastPathFee.ts
14057
14221
  var TOKEN_PAYLOAD_TYPE = 0;
@@ -14090,88 +14254,6 @@ async function readFastPathFeeWei(client2, portal, destinationChainId) {
14090
14254
  throw error;
14091
14255
  }
14092
14256
  }
14093
- var ORDER_DEPOSIT_MIN_TOKENS = "2";
14094
- function getOrderDepositMinimum(decimals) {
14095
- return parseUnits(ORDER_DEPOSIT_MIN_TOKENS, decimals);
14096
- }
14097
- function readOrderDepositApproval(payload) {
14098
- try {
14099
- const decoded = decodeFunctionData({ abi: erc20Abi, data: payload.data });
14100
- if (decoded.functionName !== "approve") return void 0;
14101
- const [spender, amount] = decoded.args;
14102
- return { token: payload.to, spender, amount };
14103
- } catch {
14104
- return void 0;
14105
- }
14106
- }
14107
- function hasAddressWord(data, address) {
14108
- const wanted = padHex(address, { size: 32 }).slice(2).toLowerCase();
14109
- const words = data.slice(10).toLowerCase();
14110
- for (let offset = 0; offset + 64 <= words.length; offset += 64) {
14111
- if (words.slice(offset, offset + 64) === wanted) return true;
14112
- }
14113
- return false;
14114
- }
14115
- function findOrderDepositQuoteFault({
14116
- quote,
14117
- sourceChainId,
14118
- tokenIn,
14119
- amountIn,
14120
- recipient
14121
- }) {
14122
- if (quote.amountIn !== amountIn) return "it is for another amount";
14123
- if (quote.amountOut <= 0n) return "it delivers nothing";
14124
- if (quote.payloads.some((payload) => payload.chainId !== sourceChainId)) {
14125
- return "it has a transaction on another chain";
14126
- }
14127
- if (quote.payloads.some((payload) => payload.value !== 0n)) return "it spends ETH";
14128
- const order = quote.payloads[quote.payloads.length - 1];
14129
- const approvals = quote.payloads.slice(0, -1);
14130
- if (!order || approvals.length > 1) return "it is not an approval and an order";
14131
- if (readOrderDepositApproval(order) || order.to.toLowerCase() === tokenIn.toLowerCase()) {
14132
- return "its last transaction is not an order";
14133
- }
14134
- if (!hasAddressWord(order.data, recipient)) return "its order does not name the recipient";
14135
- for (const payload of approvals) {
14136
- const approval = readOrderDepositApproval(payload);
14137
- if (!approval) return "its first transaction is not an approval";
14138
- if (approval.token.toLowerCase() !== tokenIn.toLowerCase()) {
14139
- return "it approves another token";
14140
- }
14141
- if (approval.amount > amountIn) return "it approves more than the amount sent";
14142
- if (approval.spender.toLowerCase() !== order.to.toLowerCase()) {
14143
- return "it approves a contract the order does not go to";
14144
- }
14145
- }
14146
- return void 0;
14147
- }
14148
- async function sendOrderDeposit({
14149
- quote,
14150
- account,
14151
- signer,
14152
- onStep
14153
- }) {
14154
- const steps = [];
14155
- for (const payload of quote.payloads) {
14156
- const approval = readOrderDepositApproval(payload);
14157
- if (approval) {
14158
- const allowance = await signer.readAllowance(approval.token, account, approval.spender).catch(() => void 0);
14159
- if (allowance !== void 0 && allowance >= approval.amount) continue;
14160
- }
14161
- steps.push({ payload, approval: Boolean(approval) });
14162
- }
14163
- let hash;
14164
- for (const [index, step] of steps.entries()) {
14165
- onStep?.(step.approval ? "approval" : "order");
14166
- hash = await signer.sendTransaction(step.payload);
14167
- if (index === steps.length - 1) break;
14168
- if (await signer.waitForReceipt(hash) !== "success") {
14169
- throw new Error("The approval transaction reverted");
14170
- }
14171
- }
14172
- if (!hash) throw new Error("The quote has no transaction to sign");
14173
- return hash;
14174
- }
14175
14257
  var ORDER_DEPOSIT_PREVIEW_ACCOUNT = "0x000000000000000000000000000000000000dEaD";
14176
14258
  var ORDER_DEPOSIT_PROBE_TOKENS = "100";
14177
14259
  var ORDER_DEPOSIT_PROBE_STALE_MS = 5 * 6e4;
@@ -14547,7 +14629,10 @@ function useBridgeDeposit({
14547
14629
  address,
14548
14630
  recipient,
14549
14631
  amountWei?.toString(),
14550
- fee?.toString()
14632
+ fee?.toString(),
14633
+ isOrder,
14634
+ orderQuote.quote?.payloads.map((payload) => payload.data).join(),
14635
+ allowance?.toString()
14551
14636
  ],
14552
14637
  queryFn: async () => {
14553
14638
  const missing = (name) => {
@@ -14558,7 +14643,17 @@ function useBridgeDeposit({
14558
14643
  const to = recipient ?? missing("recipient");
14559
14644
  const amount2 = amountWei ?? missing("amountWei");
14560
14645
  const value = fee ?? missing("fee");
14561
- const gas = deliveredToken.route === "native" ? await client2.estimateContractGas({
14646
+ const gas = isOrder ? await estimateOrderDepositGas({
14647
+ quote: orderQuote.quote ?? missing("orderQuote"),
14648
+ account,
14649
+ allowance,
14650
+ estimateGas: (payload) => client2.estimateGas({
14651
+ account: payload.account,
14652
+ to: payload.to,
14653
+ data: payload.data,
14654
+ value: payload.value
14655
+ })
14656
+ }) : deliveredToken.route === "native" ? await client2.estimateContractGas({
14562
14657
  account,
14563
14658
  address: route.nativeGateway,
14564
14659
  abi: nativeGatewayAbi,
@@ -14591,11 +14686,12 @@ function useBridgeDeposit({
14591
14686
  return gas * await client2.getGasPrice();
14592
14687
  },
14593
14688
  enabled: Boolean(
14594
- publicClient && address && recipient && amountWei !== void 0 && fee !== void 0 && !isSwap && !needsApproval
14689
+ publicClient && address && recipient && amountWei !== void 0 && fee !== void 0 && (isOrder ? Boolean(orderQuote.quote) : !isSwap && !needsApproval)
14595
14690
  ),
14596
14691
  staleTime: 15e3,
14597
14692
  retry: false
14598
14693
  });
14694
+ const gasFeeShort = isConnected && !wrongChain && ethBalance !== void 0 && gasEstimate.data !== void 0 && ethBalance.value < gasEstimate.data;
14599
14695
  const setMax = useCallback(() => {
14600
14696
  if (spendable === void 0 || spendable === 0n) return;
14601
14697
  setAmount(formatUnits(spendable, token.decimals));
@@ -14614,23 +14710,26 @@ function useBridgeDeposit({
14614
14710
  setState({ phase: "idle", slow: false });
14615
14711
  setAmount("");
14616
14712
  }, []);
14617
- const fail = useCallback((error, fallback2) => {
14618
- if (isUserRejection(error)) {
14619
- setState({ phase: "idle", slow: false });
14620
- toast.add({
14621
- type: "info",
14622
- title: "Transaction cancelled",
14623
- description: "Nothing was sent from your wallet."
14713
+ const fail = useCallback(
14714
+ (error, fallback2) => {
14715
+ if (isUserRejection(error)) {
14716
+ setState({ phase: "idle", slow: false });
14717
+ toast.add({
14718
+ type: "info",
14719
+ title: "Transaction cancelled",
14720
+ description: "Nothing was sent from your wallet."
14721
+ });
14722
+ return;
14723
+ }
14724
+ debugError("[FluentBridge] deposit failed", error);
14725
+ setState({
14726
+ phase: "error",
14727
+ slow: false,
14728
+ message: describeDepositError({ error, chainName: route.source.name, fallback: fallback2 })
14624
14729
  });
14625
- return;
14626
- }
14627
- debugError("[FluentBridge] deposit failed", error);
14628
- setState({
14629
- phase: "error",
14630
- slow: false,
14631
- message: error instanceof Error ? error.message : fallback2
14632
- });
14633
- }, []);
14730
+ },
14731
+ [route.source.name]
14732
+ );
14634
14733
  const approve = useCallback(() => {
14635
14734
  if (!address || !publicClient || amountWei === void 0) return;
14636
14735
  if (isSwap || !isErc20 || !token.l1Address || !bridgeSpender) return;
@@ -15056,6 +15155,7 @@ function useBridgeDeposit({
15056
15155
  order: isOrder ? {
15057
15156
  quoteLoading: orderQuote.loading,
15058
15157
  solverFee: orderQuote.quote && token.decimals === deliveredToken.decimals && orderQuote.quote.amountIn >= orderQuote.quote.amountOut ? orderQuote.quote.amountIn - orderQuote.quote.amountOut : void 0,
15158
+ solverFeeShare: orderQuote.quote && token.decimals === deliveredToken.decimals ? getOrderDepositFeeShare(orderQuote.quote) : void 0,
15059
15159
  fillSeconds: orderQuote.quote?.fillSeconds
15060
15160
  } : void 0,
15061
15161
  wrongChain,
@@ -15078,6 +15178,8 @@ function useBridgeDeposit({
15078
15178
  fee,
15079
15179
  gasFee: gasEstimate.data,
15080
15180
  gasFeeLoading: gasEstimate.isLoading,
15181
+ gasFeeShort,
15182
+ ethBalance: ethBalance?.value,
15081
15183
  needsApproval,
15082
15184
  approve,
15083
15185
  approving,
@@ -15114,6 +15216,22 @@ function formatFeeUsd(wei, usdPrice) {
15114
15216
  }
15115
15217
  var SLIPPAGE_LABEL = `${Number(FLUENT_SWAP_SLIPPAGE_BPS) / 100}%`;
15116
15218
  var SLIPPAGE_TOOLTIP = `The swap may settle up to ${SLIPPAGE_LABEL} below its quote. Below that the pool rejects it, and nothing is swapped.`;
15219
+ function Notice2({
15220
+ tone = "warning",
15221
+ children
15222
+ }) {
15223
+ return /* @__PURE__ */ jsxs(
15224
+ "p",
15225
+ {
15226
+ className: `flex gap-2 rounded-xl p-3 text-xs ${tone === "warning" ? "bg-amber-400/10 text-amber-300" : "bg-foreground/[0.06] text-foreground/60"}`,
15227
+ role: "status",
15228
+ children: [
15229
+ tone === "warning" ? /* @__PURE__ */ jsx(AlertTriangle, { className: "mt-0.5 size-4 shrink-0" }) : null,
15230
+ /* @__PURE__ */ jsx("span", { children })
15231
+ ]
15232
+ }
15233
+ );
15234
+ }
15117
15235
  function TokenChip({ symbol }) {
15118
15236
  return /* @__PURE__ */ jsxs("span", { className: "flex h-11 shrink-0 items-center gap-2 rounded-full bg-foreground/[0.06] pl-2 pr-3.5 text-foreground", children: [
15119
15237
  /* @__PURE__ */ jsx(TokenChainIcon, { symbol, chain: "destination" }),
@@ -15167,6 +15285,7 @@ function StatusView({
15167
15285
  route,
15168
15286
  bridge,
15169
15287
  onOpenPortal,
15288
+ onGoHome,
15170
15289
  swap
15171
15290
  }) {
15172
15291
  const { state, token, deliveredToken } = bridge;
@@ -15202,7 +15321,17 @@ function StatusView({
15202
15321
  "\u2026"
15203
15322
  ] }) : null,
15204
15323
  /* @__PURE__ */ jsxs("div", { className: "flex w-full flex-col gap-2", children: [
15205
- settled ? /* @__PURE__ */ jsx(Button, { className: "w-full", onClick: bridge.reset, children: "Make another deposit" }) : null,
15324
+ settled && onGoHome ? /* @__PURE__ */ jsx(Button, { className: "w-full", onClick: onGoHome, children: "Back to wallet" }) : null,
15325
+ settled ? /* @__PURE__ */ jsx(
15326
+ Button,
15327
+ {
15328
+ variant: onGoHome ? "ghost" : "default",
15329
+ className: "w-full",
15330
+ onClick: bridge.reset,
15331
+ children: "Make another deposit"
15332
+ }
15333
+ ) : null,
15334
+ state.phase === "relaying" && onGoHome ? /* @__PURE__ */ jsx(Button, { variant: "ghost", className: "w-full", onClick: onGoHome, children: "Back to wallet" }) : null,
15206
15335
  state.phase === "relaying" && state.slow ? /* @__PURE__ */ jsx(Button, { variant: "ghost", className: "w-full", onClick: onOpenPortal, children: "Check status on Fluent Portal" }) : null,
15207
15336
  explorerLink ? /* @__PURE__ */ jsxs(
15208
15337
  Button,
@@ -15341,7 +15470,9 @@ function BridgeForm({
15341
15470
  onGoHome
15342
15471
  }) {
15343
15472
  const tokens = getBridgeTokens(network);
15344
- const [symbol, setSymbol] = useState("ETH");
15473
+ const [symbol, setSymbol] = useState(
15474
+ () => getDefaultBridgeToken(network).symbol
15475
+ );
15345
15476
  const token = getBridgeToken(network, symbol);
15346
15477
  const handOver = useRef(void 0);
15347
15478
  const bridge = useBridgeDeposit({
@@ -15431,6 +15562,7 @@ function BridgeForm({
15431
15562
  route,
15432
15563
  bridge,
15433
15564
  onOpenPortal,
15565
+ onGoHome,
15434
15566
  swap: twoStep && swapTarget ? { target: swapTarget.symbol } : void 0
15435
15567
  }
15436
15568
  );
@@ -15504,6 +15636,11 @@ function BridgeForm({
15504
15636
  const fillMinutes = Math.max(1, Math.round((bridge.order?.fillSeconds ?? 60) / 60));
15505
15637
  const fillTime = fillMinutes === 1 ? "about a minute" : `about ${fillMinutes} minutes`;
15506
15638
  const minimumOut = twoStep && quote ? applyFluentSwapSlippage(quote.amountOut, FLUENT_SWAP_SLIPPAGE_BPS) : void 0;
15639
+ const feeNoticeTone = bridge.order?.solverFeeShare !== void 0 ? getOrderDepositFeeNotice(bridge.order.solverFeeShare) : void 0;
15640
+ const feeNotice = feeNoticeTone && bridge.order?.solverFee !== void 0 ? {
15641
+ tone: feeNoticeTone,
15642
+ text: `Flat ${formatAmount(bridge.order.solverFee, token.decimals, token.symbol)} ${token.symbol} fee. Bridge more to pay a smaller share.`
15643
+ } : void 0;
15507
15644
  return /* @__PURE__ */ jsxs("div", { className: "flex w-full flex-col gap-4 flex-1", children: [
15508
15645
  /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-2", children: [
15509
15646
  /* @__PURE__ */ jsxs(AmountCard, { label: "Send", children: [
@@ -15591,7 +15728,8 @@ function BridgeForm({
15591
15728
  {
15592
15729
  label: "Network fee",
15593
15730
  value: formatFee(bridge.gasFee, ethSymbol, bridge.gasFeeLoading),
15594
- secondary: formatFeeUsd(bridge.gasFee, ethUsdPrice)
15731
+ secondary: formatFeeUsd(bridge.gasFee, ethUsdPrice),
15732
+ tooltip: bridge.order ? `What ${route.source.name} charges to sign the approval and the order at the current gas price, paid in ${ethSymbol}. A wallet that pays gas with a token adds its own charge on top.` : void 0
15595
15733
  }
15596
15734
  ),
15597
15735
  bridge.fee !== void 0 && bridge.fee > 0n ? /* @__PURE__ */ jsx(
@@ -15610,7 +15748,8 @@ function BridgeForm({
15610
15748
  {
15611
15749
  label: "Solver fee",
15612
15750
  value: `${formatAmount(bridge.order.solverFee, token.decimals, token.symbol)} ` + token.symbol,
15613
- tooltip: "The solver that fills the order keeps this out of the amount you send. What you receive is already net of it."
15751
+ secondary: "flat fee",
15752
+ tooltip: "The solver that fills the order keeps this out of the amount you send. What you receive is already net of it. The fee is flat, so a larger deposit pays the same."
15614
15753
  }
15615
15754
  ) : null
15616
15755
  ) : /* @__PURE__ */ jsx(
@@ -15654,6 +15793,8 @@ function BridgeForm({
15654
15793
  ] }) : null,
15655
15794
  bridge.order ? /* @__PURE__ */ jsx("span", { className: "text-xs text-foreground/60", children: `${token.symbol} is sent as a limit order on ${route.source.name}: a solver pays ${deliveredToken.symbol} to your Fluent account, usually in ${fillTime}. Gas is paid in ${ethSymbol}.` }) : isSwap && !bridge.routeLoading ? /* @__PURE__ */ jsx("span", { className: "text-xs text-foreground/60", children: `${token.symbol} is swapped 1:1 to ${deliveredToken.symbol} on ${route.source.name}, then bridged to Fluent. Fees are paid in ${ethSymbol}. Expect up to 4 confirmations.` }) : null
15656
15795
  ] }) }),
15796
+ feeNotice ? /* @__PURE__ */ jsx(Notice2, { tone: feeNotice.tone, children: feeNotice.text }) : null,
15797
+ bridge.gasFeeShort && bridge.ethBalance !== void 0 ? /* @__PURE__ */ jsx(Notice2, { children: `Your wallet holds ${formatAmount(bridge.ethBalance, 18)} ${ethSymbol} on ${route.source.name}, less than the network fee. Add ${ethSymbol}, or let your wallet pay gas with a token.` }) : null,
15657
15798
  state.phase === "error" ? /* @__PURE__ */ jsx("span", { className: "text-xs text-destructive", children: state.message }) : null,
15658
15799
  bridge.restoring ? /* @__PURE__ */ jsxs(Button, { className: "w-full", disabled: true, children: [
15659
15800
  /* @__PURE__ */ jsx(Spinner, { className: "size-4" }),
@@ -17039,13 +17180,13 @@ var FLUENT_FEE_REJECTION_MESSAGES = [
17039
17180
  ];
17040
17181
  function isFluentFeeRejection(err) {
17041
17182
  const needles = FLUENT_FEE_REJECTION_MESSAGES.map((message2) => message2.toLowerCase());
17042
- for (const text of errorTexts(err)) {
17183
+ for (const text of errorTexts2(err)) {
17043
17184
  const lowered = text.toLowerCase();
17044
17185
  if (needles.some((needle) => lowered.includes(needle))) return true;
17045
17186
  }
17046
17187
  return false;
17047
17188
  }
17048
- function errorTexts(err) {
17189
+ function errorTexts2(err) {
17049
17190
  const texts = [];
17050
17191
  let current = err;
17051
17192
  for (let depth = 0; depth < 10 && current !== void 0 && current !== null; depth += 1) {