@fluent.xyz/connect 0.6.3 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -13,7 +13,7 @@ import { cva } from 'class-variance-authority';
13
13
  import { X, ChevronLeft, ExternalLink, Copy, Settings, LogOut, Layers, Trash2, RefreshCw, ChevronDownIcon, CheckIcon, AlertTriangle, Plus, Loader2Icon, Loader2, LogIn, Send, RotateCw, KeyRound, Mail, Wallet, XIcon, Check, ChevronUpIcon, Search, ChevronDown, Info, CircleCheckIcon, InfoIcon, TriangleAlertIcon, OctagonXIcon } from 'lucide-react';
14
14
  import { WagmiAdapter } from '@reown/appkit-adapter-wagmi';
15
15
  import { createAppKit, useAppKit } from '@reown/appkit/react';
16
- import { WagmiContext, WagmiProvider, useAccount, useDisconnect, useWalletClient, useSwitchChain, useConnect, usePublicClient, useBalance, useReadContract, useWriteContract, useWaitForTransactionReceipt } from 'wagmi';
16
+ import { WagmiContext, WagmiProvider, useAccount, useDisconnect, useWalletClient, useSwitchChain, useConnect, useConfig, usePublicClient, useBalance, useReadContract, useWriteContract, useWaitForTransactionReceipt } from 'wagmi';
17
17
  import { hydrate } from '@wagmi/core';
18
18
  import { reconnect } from 'wagmi/actions';
19
19
  import { coinbaseWallet, baseAccount } from 'wagmi/connectors';
@@ -24,7 +24,8 @@ import { createKernelAccount, createKernelAccountClient, createZeroDevPaymasterC
24
24
  import { getEntryPoint, KERNEL_V3_3 } from '@zerodev/sdk/constants';
25
25
  import { Switch as Switch$1 } from '@base-ui/react/switch';
26
26
  import { Tabs as Tabs$1 } from '@base-ui/react/tabs';
27
- import { RainbowKitProvider, darkTheme, useConnectModal } from '@rainbow-me/rainbowkit';
27
+ import { RainbowKitProvider, darkTheme, useConnectModal, connectorsForWallets, getWalletConnectConnector } from '@rainbow-me/rainbowkit';
28
+ import { metaMaskWallet, trustWallet, rainbowWallet } from '@rainbow-me/rainbowkit/wallets';
28
29
  import { signerToEcdsaValidator } from '@zerodev/ecdsa-validator';
29
30
  import { deserializePermissionAccount } from '@zerodev/permissions';
30
31
  import '@zerodev/permissions/policies';
@@ -5612,7 +5613,7 @@ function createFluentConnectForWidget(config) {
5612
5613
  }
5613
5614
 
5614
5615
  // package.json
5615
- var version = "0.6.3";
5616
+ var version = "0.7.0";
5616
5617
 
5617
5618
  // src/core/analytics.ts
5618
5619
  var INSTANCE_NAME = "fluent";
@@ -6600,12 +6601,7 @@ function getReownWagmiAdapter(chain, disableAnalytics, reconnectOnMount) {
6600
6601
  networks,
6601
6602
  defaultNetwork: chain,
6602
6603
  projectId: REOWN_PROJECT_ID,
6603
- metadata: {
6604
- name: "Fluent Connect Demo",
6605
- description: "Connect a wallet or continue with Fluent Connect ID.",
6606
- url: window.location.origin,
6607
- icons: [`${window.location.origin}/favicon.ico`]
6608
- },
6604
+ metadata: getReownMetadata(),
6609
6605
  customWallets: [
6610
6606
  {
6611
6607
  id: "fluent-connect-id",
@@ -6628,6 +6624,14 @@ function getReownWagmiAdapter(chain, disableAnalytics, reconnectOnMount) {
6628
6624
  }
6629
6625
  return adapter;
6630
6626
  }
6627
+ function getReownMetadata() {
6628
+ return {
6629
+ name: "Fluent Connect Demo",
6630
+ description: "Connect a wallet or continue with Fluent Connect ID.",
6631
+ url: window.location.origin,
6632
+ icons: [`${window.location.origin}/favicon.ico`]
6633
+ };
6634
+ }
6631
6635
  function ReownProvider({
6632
6636
  children,
6633
6637
  network = "testnet",
@@ -6665,9 +6669,16 @@ function useReownWallet() {
6665
6669
  const { chain } = useFluentWidgetNetwork();
6666
6670
  const choices = useMemo(
6667
6671
  () => connectors.filter(
6668
- (connector) => connector.id !== "AUTH" && (connector.id !== "injected" || typeof window !== "undefined" && "ethereum" in window && !connectors.some(
6669
- (other) => other.type === "injected" && other.id !== "injected"
6670
- ))
6672
+ (connector) => (
6673
+ // The bridge page's picker registers wallets of its own into this
6674
+ // config; they share AppKit's `walletConnect` id and belong there.
6675
+ // RainbowKit's mark is read here rather than through
6676
+ // `isBridgeWalletConnector`: `reownAppKit.test.mjs` runs this
6677
+ // hook's source on its own, with no import in reach.
6678
+ !connector.rkDetails?.isRainbowKitConnector && connector.id !== "AUTH" && (connector.id !== "injected" || typeof window !== "undefined" && "ethereum" in window && !connectors.some(
6679
+ (other) => other.type === "injected" && other.id !== "injected"
6680
+ ))
6681
+ )
6671
6682
  ).map((connector) => ({
6672
6683
  id: connector.uid,
6673
6684
  name: connector.id === "injected" ? "Browser wallet" : connector.name,
@@ -9423,7 +9434,9 @@ function FluentActivityDetail({
9423
9434
  const summary = describeFluentTransaction(entry);
9424
9435
  const movements = entry.kind === "movement" ? [entry] : entry.movements;
9425
9436
  const swap = splitFluentSwap(movements);
9426
- const headed = swap ? swap.received : movements;
9437
+ const headline = swap ? void 0 : pickFluentHeadlineMovement(movements, priceOf);
9438
+ const headed = swap ? swap.received : headline ? [headline] : [];
9439
+ const alsoMoved = headline ? movements.filter((movement) => movement !== headline) : [];
9427
9440
  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;
9428
9441
  const rate = swap?.received.length === 1 && swap.paid.length === 1 ? formatSwapRate(swap.paid[0], swap.received[0]) : void 0;
9429
9442
  const openExplorer = explorerOpener(track);
@@ -9452,9 +9465,18 @@ function FluentActivityDetail({
9452
9465
  ),
9453
9466
  /* @__PURE__ */ jsxs("dl", { className: "flex flex-col gap-5 text-sm bg-white/5 p-4 rounded-2xl", children: [
9454
9467
  /* @__PURE__ */ jsx(DetailRow, { label: "Status", children: /* @__PURE__ */ jsx("span", { className: status.className, children: status.label }) }),
9468
+ alsoMoved.map((item) => /* @__PURE__ */ jsx(
9469
+ MovementRow,
9470
+ {
9471
+ label: item.direction === "sent" ? "Fee" : "Also received",
9472
+ movement: item,
9473
+ priceOf
9474
+ },
9475
+ item.id
9476
+ )),
9455
9477
  swap ? /* @__PURE__ */ jsxs(Fragment, { children: [
9456
- swap.paid.map((item) => /* @__PURE__ */ jsx(SwapSideRow, { label: "Paid", movement: item, priceOf }, item.id)),
9457
- swap.received.map((item) => /* @__PURE__ */ jsx(SwapSideRow, { label: "Received", movement: item, priceOf }, item.id)),
9478
+ swap.paid.map((item) => /* @__PURE__ */ jsx(MovementRow, { label: "Paid", movement: item, priceOf }, item.id)),
9479
+ swap.received.map((item) => /* @__PURE__ */ jsx(MovementRow, { label: "Received", movement: item, priceOf }, item.id)),
9458
9480
  rate ? /* @__PURE__ */ jsx(DetailRow, { label: "Rate", children: rate }) : null
9459
9481
  ] }) : null,
9460
9482
  counterpartyCell ? /* @__PURE__ */ jsxs(Fragment, { children: [
@@ -9573,7 +9595,7 @@ function FluentNetworkRow({ network }) {
9573
9595
  chainName
9574
9596
  ] });
9575
9597
  }
9576
- function SwapSideRow({
9598
+ function MovementRow({
9577
9599
  label,
9578
9600
  movement,
9579
9601
  priceOf,
@@ -9694,8 +9716,8 @@ function DepositSwapActivityDetail({
9694
9716
  children: [
9695
9717
  /* @__PURE__ */ jsx(DetailRow, { label: "Deposit", children: /* @__PURE__ */ jsx(StepStatusCell, { status: depositStatus(state) }) }),
9696
9718
  /* @__PURE__ */ jsx(DetailRow, { label: "Swap", children: /* @__PURE__ */ jsx(StepStatusCell, { status: swapStatus(state) }) }),
9697
- /* @__PURE__ */ jsx(SwapSideRow, { label: "Paid", movement: paid, priceOf }),
9698
- received ? /* @__PURE__ */ jsx(SwapSideRow, { label: "Received", movement: received, priceOf, approximate: true }) : null,
9719
+ /* @__PURE__ */ jsx(MovementRow, { label: "Paid", movement: paid, priceOf }),
9720
+ received ? /* @__PURE__ */ jsx(MovementRow, { label: "Received", movement: received, priceOf, approximate: true }) : null,
9699
9721
  rate ? /* @__PURE__ */ jsxs(DetailRow, { label: "Rate", children: [
9700
9722
  "\u2248 ",
9701
9723
  rate
@@ -9984,22 +10006,6 @@ function createFluentZeroDevErc20Paymaster(params) {
9984
10006
  const token = contextToken && contextToken.toLowerCase() !== gasToken.address.toLowerCase() ? { address: contextToken } : gasToken;
9985
10007
  const prepared = withMinimumPostOpGas(withoutChainMetadata(userOperation));
9986
10008
  const label = token.symbol ?? token.address;
9987
- if (params.publicClient) {
9988
- const shortfall = await readFluentGasTokenShortfall({
9989
- chain,
9990
- paymasterClient,
9991
- publicClient: params.publicClient,
9992
- gasToken: token.address,
9993
- userOperation: prepared,
9994
- entryPointAddress: userOperation.entryPointAddress
9995
- });
9996
- if (shortfall) {
9997
- throw new FluentGasPaymentError(
9998
- "insufficient_gas_token",
9999
- `The ${label} balance (${shortfall.balance}) is below the fee the paymaster quotes for this operation (${shortfall.fee}), in ${label}'s smallest unit`
10000
- );
10001
- }
10002
- }
10003
10009
  try {
10004
10010
  return await paymasterClient.sponsorUserOperation({
10005
10011
  userOperation: prepared,
@@ -10011,70 +10017,6 @@ function createFluentZeroDevErc20Paymaster(params) {
10011
10017
  }
10012
10018
  };
10013
10019
  }
10014
- async function readFluentGasTokenShortfall(params) {
10015
- const { chain, paymasterClient, publicClient, gasToken, userOperation } = params;
10016
- const sender = userOperation.sender;
10017
- if (!sender) return void 0;
10018
- const request = paymasterClient.request;
10019
- const [quote, balance] = await Promise.allSettled([
10020
- request({
10021
- method: "stackup_getERC20TokenQuotes",
10022
- params: [{
10023
- chainId: chain.id,
10024
- userOp: { initCode: "0x", ...deepHexlify(quotedFields(userOperation)) },
10025
- tokenAddress: gasToken,
10026
- entryPointAddress: params.entryPointAddress ?? getEntryPoint("0.7").address
10027
- }]
10028
- }),
10029
- publicClient.readContract({
10030
- address: gasToken,
10031
- abi: erc20Abi,
10032
- functionName: "balanceOf",
10033
- args: [sender]
10034
- })
10035
- ]);
10036
- const fee = quote.status === "fulfilled" ? readQuantity(quote.value, "maxGasCostToken") : void 0;
10037
- if (fee === void 0 || balance.status !== "fulfilled") {
10038
- try {
10039
- debugWarn("[fluent zerodev] Gas token fee check skipped", {
10040
- gasToken,
10041
- quote: quote.status === "rejected" ? errorText(quote.reason) : fee?.toString() ?? "unusable",
10042
- balance: balance.status === "rejected" ? errorText(balance.reason) : "read"
10043
- });
10044
- } catch {
10045
- }
10046
- return void 0;
10047
- }
10048
- return balance.value < fee ? { balance: balance.value, fee } : void 0;
10049
- }
10050
- function quotedFields(userOperation) {
10051
- const {
10052
- chainId: _chainId,
10053
- entryPointAddress: _entryPointAddress,
10054
- ...fields
10055
- } = userOperation;
10056
- return fields;
10057
- }
10058
- function readQuantity(answer, key) {
10059
- if (!answer || typeof answer !== "object") return void 0;
10060
- const value = answer[key];
10061
- if (typeof value === "number" && Number.isSafeInteger(value) && value >= 0) return BigInt(value);
10062
- if (typeof value !== "string" || !/^(0x[\da-f]+|\d+)$/i.test(value)) return void 0;
10063
- return BigInt(value);
10064
- }
10065
- function deepHexlify(value) {
10066
- if (typeof value === "bigint") return `0x${value.toString(16)}`;
10067
- if (Array.isArray(value)) return value.map(deepHexlify);
10068
- if (value && typeof value === "object") {
10069
- return Object.fromEntries(
10070
- Object.entries(value).map(([key, entry]) => [key, deepHexlify(entry)])
10071
- );
10072
- }
10073
- return value;
10074
- }
10075
- function errorText(err) {
10076
- return err instanceof Error ? err.message : String(err);
10077
- }
10078
10020
  function toFluentGasPaymentRefusal(err, label) {
10079
10021
  const answered = err instanceof BaseError && err.walk(
10080
10022
  (inner) => inner instanceof HttpRequestError && inner.status !== void 0 || typeof inner.code === "number"
@@ -10539,7 +10481,8 @@ function SendTokenForm({
10539
10481
  decimals: token.decimals,
10540
10482
  balance: rawBalance
10541
10483
  }) : null;
10542
- const balanceNote = token && rawBalance !== null ? `${formatUnits(rawBalance, token.decimals)} ${token.symbol}` : balancesBusy ? "Loading balance..." : "Balance unavailable";
10484
+ const balanceNote = token && rawBalance !== null ? `${formatAmount(rawBalance, token.decimals, token.symbol)} ${token.symbol}` : balancesBusy ? "Loading balance..." : "Balance unavailable";
10485
+ const balanceExact = token && rawBalance !== null ? formatUnits(rawBalance, token.decimals) : void 0;
10543
10486
  const amountUsd = token ? formatAmountUsd(amount, usdPrices[token.identity]) : void 0;
10544
10487
  const fee = feeToken ? checkFluentTransferFee({
10545
10488
  feeToken,
@@ -10667,7 +10610,7 @@ function SendTokenForm({
10667
10610
  /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between gap-1 text-sm text-foreground/60", children: [
10668
10611
  /* @__PURE__ */ jsx("span", { className: "min-w-0 truncate", title: amountUsd, children: amountUsd }),
10669
10612
  /* @__PURE__ */ jsxs("div", { className: "flex shrink-0 items-center gap-1 whitespace-nowrap", children: [
10670
- /* @__PURE__ */ jsx("span", { className: "tabular-nums", children: balanceNote }),
10613
+ /* @__PURE__ */ jsx("span", { className: "tabular-nums", title: balanceExact, children: balanceNote }),
10671
10614
  /* @__PURE__ */ jsx(
10672
10615
  "button",
10673
10616
  {
@@ -14703,7 +14646,7 @@ function BridgeForm({
14703
14646
  ),
14704
14647
  /* @__PURE__ */ jsx(SummaryRow, { label: "Slippage", value: SLIPPAGE_LABEL })
14705
14648
  ] }) : null,
14706
- isSwap ? /* @__PURE__ */ jsx("span", { className: "text-xs text-foreground/60", children: `Fluent settles in ${deliveredToken.symbol}, so ${token.symbol} is first swapped to ${deliveredToken.symbol} on ${route.source.name} at 1:1, then bridged. Fee and gas are paid in ${ethSymbol}; expect up to four signatures \u2014 two approvals, the swap, the deposit.` }) : null
14649
+ isSwap ? /* @__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
14707
14650
  ] }) }),
14708
14651
  state.phase === "error" ? /* @__PURE__ */ jsx("span", { className: "text-xs text-destructive", children: state.message }) : null,
14709
14652
  bridge.restoring ? /* @__PURE__ */ jsxs(Button, { className: "w-full", disabled: true, children: [
@@ -14770,6 +14713,72 @@ function BridgeForm({
14770
14713
  ] })
14771
14714
  ] });
14772
14715
  }
14716
+ var WALLETS = [
14717
+ [metaMaskWallet, (uri) => `https://metamask.app.link/wc?uri=${encodeURIComponent(uri)}`],
14718
+ [trustWallet, (uri) => `https://link.trustwallet.com/wc?uri=${encodeURIComponent(uri)}`],
14719
+ [
14720
+ rainbowWallet,
14721
+ (uri) => `https://rnbwapp.com/wc?uri=${encodeURIComponent(uri)}&connector=rainbowkit`
14722
+ ]
14723
+ ];
14724
+ function isPhone() {
14725
+ return typeof navigator !== "undefined" && /android|iphone|ipad|ipod/i.test(navigator.userAgent);
14726
+ }
14727
+ function walletConnectOnly(createWallet, link) {
14728
+ return (params) => {
14729
+ const wallet = createWallet(params);
14730
+ return {
14731
+ ...wallet,
14732
+ installed: void 0,
14733
+ hidden: () => !isPhone(),
14734
+ mobile: { getUri: link },
14735
+ createConnector: getWalletConnectConnector({
14736
+ projectId: params.projectId,
14737
+ walletConnectParameters: params.walletConnectParameters
14738
+ })
14739
+ };
14740
+ };
14741
+ }
14742
+ function getBridgeWalletConnectors({
14743
+ projectId,
14744
+ metadata
14745
+ }) {
14746
+ return connectorsForWallets(
14747
+ [
14748
+ {
14749
+ groupName: "Popular",
14750
+ wallets: WALLETS.map(([createWallet, link]) => walletConnectOnly(createWallet, link))
14751
+ }
14752
+ ],
14753
+ {
14754
+ projectId,
14755
+ appName: metadata.name,
14756
+ appDescription: metadata.description,
14757
+ appUrl: metadata.url,
14758
+ appIcon: metadata.icons[0],
14759
+ walletConnectParameters: { metadata }
14760
+ }
14761
+ );
14762
+ }
14763
+ var registered = /* @__PURE__ */ new WeakSet();
14764
+ function registerBridgeWalletConnectors(config, params) {
14765
+ if (registered.has(config)) return;
14766
+ registered.add(config);
14767
+ const connectors = getBridgeWalletConnectors(params).map(
14768
+ (createConnector) => config._internal.connectors.setup(createConnector)
14769
+ );
14770
+ config._internal.connectors.setState((current) => [...current, ...connectors]);
14771
+ }
14772
+ function BridgeWalletConnectors() {
14773
+ const config = useConfig();
14774
+ useEffect(() => {
14775
+ registerBridgeWalletConnectors(config, {
14776
+ projectId: REOWN_PROJECT_ID,
14777
+ metadata: getReownMetadata()
14778
+ });
14779
+ }, [config]);
14780
+ return null;
14781
+ }
14773
14782
  function EscapeGuard() {
14774
14783
  const { connectModalOpen } = useConnectModal();
14775
14784
  useEffect(() => {
@@ -14793,6 +14802,7 @@ function BridgeWalletPicker({
14793
14802
  theme: darkTheme({ accentColor: "#49EDED", accentColorForeground: "#05131f" }),
14794
14803
  modalSize: "compact",
14795
14804
  children: [
14805
+ /* @__PURE__ */ jsx(BridgeWalletConnectors, {}),
14796
14806
  /* @__PURE__ */ jsx(EscapeGuard, {}),
14797
14807
  children
14798
14808
  ]
@@ -17043,8 +17053,7 @@ function createFluentZeroDevErc20ExecutionClient(kernel, gasToken, readExecution
17043
17053
  readExecution,
17044
17054
  paymaster: createFluentZeroDevErc20Paymaster({
17045
17055
  chain: kernel.chain,
17046
- gasToken: { address: gasToken, symbol: gasTokenSymbol },
17047
- publicClient: kernel.publicClient
17056
+ gasToken: { address: gasToken, symbol: gasTokenSymbol }
17048
17057
  })
17049
17058
  });
17050
17059
  }
@@ -20033,61 +20042,95 @@ function FluentAccountDrawer({
20033
20042
  onOpenChange: setAccountOpen,
20034
20043
  actionsRef: drawerActions,
20035
20044
  swipeDirection: isMobile ? "down" : "right",
20045
+ showSwipeHandle: isMobile,
20036
20046
  modal,
20037
20047
  disablePointerDismissal,
20038
20048
  children: [
20039
20049
  connectButton,
20040
- hasConnectedAccount ? /* @__PURE__ */ jsxs(DrawerContent, { "aria-label": "Connected account", className: "dark text-foreground antialiased sm:w-96", children: [
20041
- /* @__PURE__ */ jsx(DrawerHeader, { className: "items-stretch p-4 pb-0", children: subPage ? /* @__PURE__ */ jsxs("div", { className: "relative flex h-11 items-center justify-center", children: [
20042
- /* @__PURE__ */ jsx(
20043
- "button",
20044
- {
20045
- type: "button",
20046
- "aria-label": subPageDismiss === "close" ? "Close" : "Back",
20047
- className: `absolute inline-flex size-8 items-center justify-center rounded-lg text-foreground/70 transition-colors hover:bg-foreground/5 hover:text-foreground ${subPageDismiss === "close" ? "right-0" : "left-0"}`,
20048
- onClick: closeSubPage,
20049
- children: subPageDismiss === "close" ? /* @__PURE__ */ jsx(X, { className: "size-5" }) : /* @__PURE__ */ jsx(ChevronLeft, { className: "size-5" })
20050
- }
20051
- ),
20052
- /* @__PURE__ */ jsx(DrawerTitle, { className: "text-sm font-medium leading-none text-foreground", children: subPage })
20053
- ] }) : accountMenuAddress ? /* @__PURE__ */ jsxs(Select, { value: null, onValueChange: onAccountMenuAction, children: [
20054
- /* @__PURE__ */ jsxs(
20055
- SelectTrigger,
20056
- {
20057
- "aria-label": "Account actions",
20058
- className: "!h-auto w-full gap-2 overflow-hidden rounded-xl border border-foreground/10 !bg-transparent p-1.5 pr-3 hover:border-foreground/20 hover:!bg-foreground/5 aria-expanded:border-foreground/20 aria-expanded:!bg-foreground/5",
20059
- children: [
20060
- /* @__PURE__ */ jsx("div", { className: "flex size-8 shrink-0 items-center justify-center overflow-hidden rounded-md bg-foreground/10 text-foreground", children: /* @__PURE__ */ jsx(AccountAvatar, { userAvatarUrl, defaultLogoUrl }) }),
20061
- /* @__PURE__ */ jsx("span", { className: "min-w-0 flex-1 truncate text-left text-sm font-medium leading-none text-foreground", children: formatAddress(accountMenuAddress) })
20062
- ]
20063
- }
20064
- ),
20065
- /* @__PURE__ */ jsxs(SelectContent, { align: "end", alignItemWithTrigger: false, className: "min-w-(--anchor-width)", children: [
20066
- /* @__PURE__ */ jsxs(SelectItem, { value: "explorer", children: [
20067
- /* @__PURE__ */ jsx(ExternalLink, { className: "size-4" }),
20068
- "Open on FluentScan"
20069
- ] }),
20070
- /* @__PURE__ */ jsxs(SelectItem, { value: "copy", children: [
20071
- /* @__PURE__ */ jsx(Copy, { className: "size-4" }),
20072
- "Copy address"
20073
- ] }),
20074
- /* @__PURE__ */ jsx(SelectSeparator, { className: "mx-2" }),
20075
- /* @__PURE__ */ jsxs(SelectItem, { value: "settings", children: [
20076
- /* @__PURE__ */ jsx(Settings, { className: "size-4" }),
20077
- "Settings"
20078
- ] }),
20079
- /* @__PURE__ */ jsx(SelectSeparator, { className: "mx-2" }),
20080
- /* @__PURE__ */ jsxs(SelectItem, { value: "disconnect", children: [
20081
- /* @__PURE__ */ jsx(LogOut, { className: "size-4" }),
20082
- "Disconnect"
20083
- ] })
20084
- ] })
20085
- ] }) : /* @__PURE__ */ jsxs("div", { className: "relative flex items-center gap-2 overflow-hidden rounded-xl border border-foreground/10 p-2 pr-3 shadow-2xl", children: [
20086
- /* @__PURE__ */ jsx("div", { className: "relative z-10 flex size-8 items-center justify-center overflow-hidden rounded-md bg-foreground/10", children: /* @__PURE__ */ jsx(AccountAvatar, { userAvatarUrl, defaultLogoUrl }) }),
20087
- /* @__PURE__ */ jsx("div", { className: "relative z-10 text-sm font-medium leading-none", children: "Connected" })
20088
- ] }) }),
20089
- /* @__PURE__ */ jsx("div", { className: "flex min-h-0 flex-1 flex-col gap-3 overflow-y-auto p-4", children })
20090
- ] }) : null
20050
+ hasConnectedAccount ? /* @__PURE__ */ jsxs(
20051
+ DrawerContent,
20052
+ {
20053
+ "aria-label": "Connected account",
20054
+ className: "dark text-foreground antialiased data-[swipe-axis=y]:[--drawer-content-height:calc(100dvh-2*var(--drawer-inset))] data-[swipe-axis=y]:[--drawer-content-max-height:none]",
20055
+ children: [
20056
+ /* @__PURE__ */ jsx(DrawerHeader, { className: "items-stretch p-4 pb-0", children: subPage ? /* @__PURE__ */ jsxs("div", { className: "relative flex h-11 items-center justify-center", children: [
20057
+ /* @__PURE__ */ jsx(
20058
+ "button",
20059
+ {
20060
+ type: "button",
20061
+ "aria-label": subPageDismiss === "close" ? "Close" : "Back",
20062
+ className: `absolute inline-flex size-8 items-center justify-center rounded-lg text-foreground/70 transition-colors hover:bg-foreground/5 hover:text-foreground ${subPageDismiss === "close" ? "right-0" : "left-0"}`,
20063
+ onClick: closeSubPage,
20064
+ children: subPageDismiss === "close" ? /* @__PURE__ */ jsx(X, { className: "size-5" }) : /* @__PURE__ */ jsx(ChevronLeft, { className: "size-5" })
20065
+ }
20066
+ ),
20067
+ /* @__PURE__ */ jsx(DrawerTitle, { className: "text-sm font-medium leading-none text-foreground", children: subPage })
20068
+ ] }) : accountMenuAddress ? /* @__PURE__ */ jsxs("div", { className: "relative flex items-center gap-2", children: [
20069
+ /* @__PURE__ */ jsxs(Select, { value: null, onValueChange: onAccountMenuAction, children: [
20070
+ /* @__PURE__ */ jsxs(
20071
+ SelectTrigger,
20072
+ {
20073
+ "aria-label": "Account actions",
20074
+ className: `!h-auto min-w-0 ${isMobile ? "w-fit" : "w-full"} gap-2 overflow-hidden rounded-xl border-0 !bg-transparent p-1.5 pr-3 hover:!bg-foreground/5 aria-expanded:!bg-foreground/5`,
20075
+ children: [
20076
+ /* @__PURE__ */ jsx("div", { className: "flex size-8 shrink-0 items-center justify-center overflow-hidden rounded-md bg-foreground/10 text-foreground", children: /* @__PURE__ */ jsx(
20077
+ AccountAvatar,
20078
+ {
20079
+ userAvatarUrl,
20080
+ defaultLogoUrl
20081
+ }
20082
+ ) }),
20083
+ /* @__PURE__ */ jsx("span", { className: "min-w-0 flex-1 truncate text-left text-sm font-medium leading-none text-foreground", children: formatAddress(accountMenuAddress) })
20084
+ ]
20085
+ }
20086
+ ),
20087
+ /* @__PURE__ */ jsxs(
20088
+ SelectContent,
20089
+ {
20090
+ align: isMobile ? "start" : "end",
20091
+ alignItemWithTrigger: false,
20092
+ className: "w-56 min-w-(--anchor-width)",
20093
+ children: [
20094
+ /* @__PURE__ */ jsxs(SelectItem, { value: "explorer", children: [
20095
+ /* @__PURE__ */ jsx(ExternalLink, { className: "size-4" }),
20096
+ "Open on FluentScan"
20097
+ ] }),
20098
+ /* @__PURE__ */ jsxs(SelectItem, { value: "copy", children: [
20099
+ /* @__PURE__ */ jsx(Copy, { className: "size-4" }),
20100
+ "Copy address"
20101
+ ] }),
20102
+ /* @__PURE__ */ jsx(SelectSeparator, { className: "mx-2" }),
20103
+ /* @__PURE__ */ jsxs(SelectItem, { value: "settings", children: [
20104
+ /* @__PURE__ */ jsx(Settings, { className: "size-4" }),
20105
+ "Settings"
20106
+ ] }),
20107
+ /* @__PURE__ */ jsx(SelectSeparator, { className: "mx-2" }),
20108
+ /* @__PURE__ */ jsxs(SelectItem, { value: "disconnect", children: [
20109
+ /* @__PURE__ */ jsx(LogOut, { className: "size-4" }),
20110
+ "Disconnect"
20111
+ ] })
20112
+ ]
20113
+ }
20114
+ )
20115
+ ] }),
20116
+ isMobile ? /* @__PURE__ */ jsx(
20117
+ "button",
20118
+ {
20119
+ type: "button",
20120
+ "aria-label": "Close",
20121
+ className: "absolute -right-1 -top-4 inline-flex size-8 items-center justify-center rounded-full bg-white/10 text-foreground/70 transition-colors hover:bg-white/15 hover:text-foreground",
20122
+ onClick: () => setAccountOpen(false),
20123
+ children: /* @__PURE__ */ jsx(X, { className: "size-5" })
20124
+ }
20125
+ ) : null
20126
+ ] }) : /* @__PURE__ */ jsxs("div", { className: "relative flex items-center gap-2 overflow-hidden rounded-xl border border-foreground/10 p-2 pr-3 shadow-2xl", children: [
20127
+ /* @__PURE__ */ jsx("div", { className: "relative z-10 flex size-8 items-center justify-center overflow-hidden rounded-md bg-foreground/10", children: /* @__PURE__ */ jsx(AccountAvatar, { userAvatarUrl, defaultLogoUrl }) }),
20128
+ /* @__PURE__ */ jsx("div", { className: "relative z-10 text-sm font-medium leading-none", children: "Connected" })
20129
+ ] }) }),
20130
+ /* @__PURE__ */ jsx("div", { className: "flex min-h-0 flex-1 flex-col gap-3 overflow-y-auto p-4", children })
20131
+ ]
20132
+ }
20133
+ ) : null
20091
20134
  ]
20092
20135
  }
20093
20136
  );