@fluent.xyz/connect 0.1.4 → 0.2.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
@@ -1,6 +1,6 @@
1
- import { defineChain, http, createPublicClient, formatUnits, encodeFunctionData, parseUnits, numberToHex, fallback, isHex, stringToHex, bytesToHex } from 'viem';
1
+ import { toEventSelector, parseAbiItem, defineChain, http, createPublicClient, formatUnits, isAddress, getAddress, encodeFunctionData, parseUnits, zeroAddress, numberToHex, BaseError, HttpRequestError, fallback, isHex, stringToHex, bytesToHex } from 'viem';
2
2
  import * as React2 from 'react';
3
- import { createContext, forwardRef, useContext, useState, useRef, useMemo, useEffect, useCallback, useLayoutEffect } from 'react';
3
+ import { createContext, forwardRef, useContext, useMemo, useState, useCallback, useRef, useEffect, useLayoutEffect } from 'react';
4
4
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
5
5
  import { toCallPolicy, CallPolicyVersion, toTimestampPolicy, CallType, ParamCondition } from '@zerodev/permissions/policies';
6
6
  export { CallType, ParamCondition } from '@zerodev/permissions/policies';
@@ -11,22 +11,24 @@ import { toPermissionValidator, serializePermissionAccount, deserializePermissio
11
11
  import { toECDSASigner } from '@zerodev/permissions/signers';
12
12
  import { createZeroDevPaymasterClient, getERC20PaymasterApproveCall, createKernelAccountClient, createKernelAccount } from '@zerodev/sdk';
13
13
  import { getEntryPoint, KERNEL_V3_3 } from '@zerodev/sdk/constants';
14
+ import { Toast as Toast$1 } from '@base-ui/react/toast';
15
+ import { clsx } from 'clsx';
16
+ import { twMerge } from 'tailwind-merge';
17
+ import { Button as Button$1 } from '@base-ui/react/button';
18
+ import { cva } from 'class-variance-authority';
19
+ import { XIcon, Loader2, ChevronLeft, ExternalLink, Copy, Settings, LogOut, ChevronDownIcon, CheckIcon, AlertTriangle, Trash2, Plus, Loader2Icon, ChevronUpIcon, CircleCheckIcon, InfoIcon, TriangleAlertIcon, OctagonXIcon } from 'lucide-react';
14
20
  import { WagmiAdapter } from '@reown/appkit-adapter-wagmi';
15
21
  import { createAppKit, useAppKit } from '@reown/appkit/react';
16
22
  import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
17
23
  import { WagmiProvider, useAccount, useDisconnect, useWalletClient, useSwitchChain } from 'wagmi';
18
- import { Button as Button$1 } from '@base-ui/react/button';
19
- import { cva } from 'class-variance-authority';
20
- import { clsx } from 'clsx';
21
- import { twMerge } from 'tailwind-merge';
24
+ import { coinbaseWallet, baseAccount } from 'wagmi/connectors';
22
25
  import { Dialog as Dialog$1 } from '@base-ui/react/dialog';
23
- import { XIcon, Loader2, ExternalLink, Copy, LogOut, ChevronDownIcon, CheckIcon, ChevronUpIcon, CircleCheckIcon, InfoIcon, TriangleAlertIcon, OctagonXIcon, Loader2Icon } from 'lucide-react';
24
26
  import { openSwapperModal } from '@swapper-finance/deposit-sdk';
25
27
  import { Separator as Separator$1 } from '@base-ui/react/separator';
26
28
  import { Select as Select$1 } from '@base-ui/react/select';
27
29
  import { Switch as Switch$1 } from '@base-ui/react/switch';
28
30
  import { Tabs as Tabs$1 } from '@base-ui/react/tabs';
29
- import { Toast as Toast$1 } from '@base-ui/react/toast';
31
+ import { Tooltip as Tooltip$1 } from '@base-ui/react/tooltip';
30
32
  import { Drawer as Drawer$1 } from '@base-ui/react/drawer';
31
33
 
32
34
  var __defProp = Object.defineProperty;
@@ -46,33 +48,6 @@ var fluentBridgeAbi = [
46
48
  }
47
49
  ];
48
50
 
49
- // ../registry/data/chains/fluent-devnet.json
50
- var fluent_devnet_default = {
51
- id: "fluent-devnet",
52
- name: "Fluent Developer Preview",
53
- chainId: 20993,
54
- testnet: true,
55
- nativeCurrency: {
56
- name: "Ether",
57
- symbol: "ETH",
58
- decimals: 18
59
- },
60
- rpcUrls: {
61
- default: {
62
- http: ["https://rpc.devnet.fluent.xyz/"],
63
- webSocket: ["wss://rpc.dev.gblend.xyz/ws"]
64
- }
65
- },
66
- blockExplorers: {
67
- default: {
68
- name: "Fluentscan Devnet",
69
- url: "https://devnet.fluentscan.xyz"
70
- }
71
- },
72
- infoURL: "https://docs.fluent.xyz/",
73
- faucets: ["https://testnet.fluent.xyz/dev-portal"]
74
- };
75
-
76
51
  // ../registry/data/chains/fluent-mainnet.json
77
52
  var fluent_mainnet_default = {
78
53
  id: "fluent-mainnet",
@@ -4384,7 +4359,6 @@ function parse(schema, value) {
4384
4359
  return schema.parse(value);
4385
4360
  }
4386
4361
  var fluentChains = {
4387
- devnet: parse(fluentChainSchema, fluent_devnet_default),
4388
4362
  testnet: parse(fluentChainSchema, fluent_testnet_default),
4389
4363
  mainnet: parse(fluentChainSchema, fluent_mainnet_default)
4390
4364
  };
@@ -4499,12 +4473,10 @@ function l1DefinitionToViemChain(definition) {
4499
4473
  }
4500
4474
 
4501
4475
  // ../connect-sdk/src/chains.ts
4502
- var fluentDevnet = fluentDefinitionToViemChain(fluentChains.devnet);
4503
4476
  var fluentTestnet = fluentDefinitionToViemChain(fluentChains.testnet);
4504
4477
  var fluentMainnet = fluentDefinitionToViemChain(fluentChains.mainnet);
4505
4478
  l1DefinitionToViemChain(l1Chains.sepolia);
4506
4479
  var fluent = {
4507
- devnet: fluentDevnet,
4508
4480
  testnet: fluentTestnet,
4509
4481
  mainnet: fluentMainnet
4510
4482
  };
@@ -4634,102 +4606,98 @@ function createFluentPermissionClient(config) {
4634
4606
  }
4635
4607
  };
4636
4608
  }
4609
+ function isFluentNativeToken(token) {
4610
+ return token.native === true;
4611
+ }
4612
+ function fluentTokenIdentity(token) {
4613
+ const target = isFluentNativeToken(token) ? "native" : token.address?.toLowerCase() ?? "unknown";
4614
+ return `${token.chainId}:${target}`;
4615
+ }
4637
4616
  var fluentTestnetTokenDefaults = {
4638
4617
  ETH: {
4639
4618
  chainId: 20994,
4640
4619
  symbol: "ETH",
4641
4620
  name: "Ether",
4642
- decimals: 18
4621
+ decimals: 18,
4622
+ native: true,
4623
+ gasPriority: 3
4643
4624
  },
4644
4625
  USDnr: {
4645
4626
  chainId: 20994,
4646
4627
  symbol: "USDnr",
4647
4628
  name: "USDnr",
4648
4629
  decimals: 18,
4649
- address: "0x092AE7564C6611a114C20C6df766B5B35A52334A"
4630
+ address: "0x092AE7564C6611a114C20C6df766B5B35A52334A",
4631
+ gasPriority: 2
4650
4632
  },
4651
4633
  BLEND: {
4652
4634
  chainId: 20994,
4653
4635
  symbol: "BLEND",
4654
4636
  name: "Mock Blend",
4655
4637
  decimals: 18,
4656
- address: "0x83Fed707A8dDDC2535aE591CF19fB6C91D542D8E"
4657
- },
4658
- USDC: {
4659
- chainId: 20994,
4660
- symbol: "USDC",
4661
- name: "USD Coin",
4662
- decimals: 6,
4663
- address: "0xC8Ebbf08Cb2A87aB90cC8EeC34C721764b7755e9"
4664
- },
4665
- USDT: {
4666
- chainId: 20994,
4667
- symbol: "USDT",
4668
- name: "USDT",
4669
- decimals: 6,
4670
- address: "0xD80Ca465c268e76F0d897D44a35fC97Db75AB797"
4638
+ address: "0x83Fed707A8dDDC2535aE591CF19fB6C91D542D8E",
4639
+ gasPriority: 1
4671
4640
  }
4672
4641
  };
4673
- var fluentTestnetWidgetTokens = [
4674
- fluentTestnetTokenDefaults.ETH,
4675
- fluentTestnetTokenDefaults.USDnr,
4676
- fluentTestnetTokenDefaults.BLEND,
4677
- fluentTestnetTokenDefaults.USDC,
4678
- fluentTestnetTokenDefaults.USDT
4679
- ];
4680
4642
  var fluentMainnetTokenDefaults = {
4681
4643
  ETH: {
4682
4644
  chainId: 25363,
4683
4645
  symbol: "ETH",
4684
4646
  name: "Ether",
4685
- decimals: 18
4647
+ decimals: 18,
4648
+ native: true,
4649
+ gasPriority: 3
4686
4650
  },
4687
4651
  USDnr: {
4688
4652
  chainId: 25363,
4689
4653
  symbol: "USDnr",
4690
4654
  name: "USDnr",
4691
4655
  decimals: 18,
4692
- address: "0xD48e565561416dE59DA1050ED70b8d75e8eF28f9"
4656
+ address: "0xD48e565561416dE59DA1050ED70b8d75e8eF28f9",
4657
+ gasPriority: 2
4693
4658
  },
4694
4659
  BLEND: {
4695
4660
  chainId: 25363,
4696
4661
  symbol: "BLEND",
4697
4662
  name: "Fluent",
4698
4663
  decimals: 18,
4699
- address: "0x1385b8f55a84f2bda13eed4099d29eae03d553b2"
4664
+ address: "0x1385b8f55a84f2bda13eed4099d29eae03d553b2",
4665
+ gasPriority: 1
4700
4666
  }
4701
4667
  };
4702
- var fluentMainnetWidgetTokens = [
4703
- fluentMainnetTokenDefaults.ETH,
4704
- fluentMainnetTokenDefaults.USDnr,
4705
- fluentMainnetTokenDefaults.BLEND
4706
- ];
4707
- function withChainId(defaults, chainId) {
4708
- return Object.fromEntries(
4709
- Object.entries(defaults).map(([key, token]) => [key, { ...token, chainId }])
4710
- );
4711
- }
4712
- var fluentDevnetTokenDefaults = withChainId(fluentTestnetTokenDefaults, 20993);
4713
- var fluentDevnetWidgetTokens = [
4714
- fluentDevnetTokenDefaults.ETH,
4715
- fluentDevnetTokenDefaults.USDnr,
4716
- fluentDevnetTokenDefaults.BLEND,
4717
- fluentDevnetTokenDefaults.USDC,
4718
- fluentDevnetTokenDefaults.USDT
4719
- ];
4720
4668
  function getFluentTokenDefaultsForNetwork(network) {
4721
4669
  switch (network) {
4722
4670
  case "mainnet":
4723
4671
  return fluentMainnetTokenDefaults;
4724
- case "devnet":
4725
- return fluentDevnetTokenDefaults;
4726
4672
  default:
4727
4673
  return fluentTestnetTokenDefaults;
4728
4674
  }
4729
4675
  }
4676
+ var fluentDefaultTokenIdentities = new Set(
4677
+ [
4678
+ ...Object.values(fluentTestnetTokenDefaults),
4679
+ ...Object.values(fluentMainnetTokenDefaults)
4680
+ ].map(fluentTokenIdentity)
4681
+ );
4682
+ function isFluentDefaultToken(token) {
4683
+ return fluentDefaultTokenIdentities.has(fluentTokenIdentity(token));
4684
+ }
4685
+ function sortFluentGasTokens(tokens) {
4686
+ return tokens.filter((token) => token.gasPriority !== void 0).sort((left, right) => left.gasPriority - right.gasPriority);
4687
+ }
4688
+ var displayTokensByNetwork = {
4689
+ testnet: Object.freeze(Object.values(fluentTestnetTokenDefaults)),
4690
+ mainnet: Object.freeze(Object.values(fluentMainnetTokenDefaults))
4691
+ };
4692
+ var gasTokensByNetwork = {
4693
+ testnet: Object.freeze(sortFluentGasTokens(displayTokensByNetwork.testnet)),
4694
+ mainnet: Object.freeze(sortFluentGasTokens(displayTokensByNetwork.mainnet))
4695
+ };
4696
+ function getFluentDefaultWidgetDisplayTokens(network) {
4697
+ return displayTokensByNetwork[network];
4698
+ }
4730
4699
  function getFluentDefaultWidgetGasTokens(network) {
4731
- const defaults = getFluentTokenDefaultsForNetwork(network);
4732
- return [defaults.USDnr, defaults.BLEND, defaults.ETH];
4700
+ return gasTokensByNetwork[network];
4733
4701
  }
4734
4702
  var balanceOfAbi = [
4735
4703
  {
@@ -4743,7 +4711,8 @@ var balanceOfAbi = [
4743
4711
  async function readFluentTokenBalances(params) {
4744
4712
  return Promise.all(
4745
4713
  params.tokens.map(async (token) => {
4746
- if (token.symbol !== "ETH" && !token.address) {
4714
+ const native = isFluentNativeToken(token);
4715
+ if (!native && !token.address) {
4747
4716
  return {
4748
4717
  ...token,
4749
4718
  raw: null,
@@ -4752,7 +4721,7 @@ async function readFluentTokenBalances(params) {
4752
4721
  };
4753
4722
  }
4754
4723
  try {
4755
- const raw = token.symbol === "ETH" ? await params.client.getBalance({ address: params.account }) : await params.client.readContract({
4724
+ const raw = native ? await params.client.getBalance({ address: params.account }) : await params.client.readContract({
4756
4725
  address: token.address,
4757
4726
  abi: balanceOfAbi,
4758
4727
  functionName: "balanceOf",
@@ -4776,6 +4745,111 @@ async function readFluentTokenBalances(params) {
4776
4745
  })
4777
4746
  );
4778
4747
  }
4748
+ var erc20MetadataAbi = [
4749
+ {
4750
+ type: "function",
4751
+ name: "name",
4752
+ stateMutability: "view",
4753
+ inputs: [],
4754
+ outputs: [{ name: "", type: "string" }]
4755
+ },
4756
+ {
4757
+ type: "function",
4758
+ name: "symbol",
4759
+ stateMutability: "view",
4760
+ inputs: [],
4761
+ outputs: [{ name: "", type: "string" }]
4762
+ },
4763
+ {
4764
+ type: "function",
4765
+ name: "decimals",
4766
+ stateMutability: "view",
4767
+ inputs: [],
4768
+ outputs: [{ name: "", type: "uint8" }]
4769
+ }
4770
+ ];
4771
+ var FLUENT_MAX_TOKEN_SYMBOL_LENGTH = 16;
4772
+ var FLUENT_MAX_TOKEN_NAME_LENGTH = 64;
4773
+ var FLUENT_MAX_TOKEN_DECIMALS = 36;
4774
+ function isFluentTokenDecimals(value) {
4775
+ return typeof value === "number" && Number.isInteger(value) && value >= 0 && value <= FLUENT_MAX_TOKEN_DECIMALS;
4776
+ }
4777
+ async function readFluentTokenMetadata(params) {
4778
+ const trimmed = params.address.trim();
4779
+ if (!isAddress(trimmed)) return { status: "invalid-address" };
4780
+ const address = getAddress(trimmed);
4781
+ const read = (functionName) => params.client.readContract({
4782
+ address,
4783
+ abi: erc20MetadataAbi,
4784
+ functionName
4785
+ });
4786
+ let symbol;
4787
+ let decimals;
4788
+ let name;
4789
+ try {
4790
+ const [symbolResult, decimalsResult, nameResult] = await Promise.all([
4791
+ read("symbol"),
4792
+ read("decimals"),
4793
+ read("name").catch(() => void 0)
4794
+ ]);
4795
+ symbol = String(symbolResult).trim();
4796
+ decimals = Number(decimalsResult);
4797
+ name = nameResult === void 0 ? void 0 : String(nameResult).trim();
4798
+ } catch (error) {
4799
+ return {
4800
+ status: "unreadable",
4801
+ reason: error instanceof Error ? error.message : "Could not read the contract"
4802
+ };
4803
+ }
4804
+ if (!symbol) return { status: "unreadable", reason: "Contract reports no symbol" };
4805
+ if (!isFluentTokenDecimals(decimals)) {
4806
+ return { status: "unreadable", reason: "Contract reports invalid decimals" };
4807
+ }
4808
+ return {
4809
+ status: "ok",
4810
+ token: {
4811
+ chainId: params.chainId,
4812
+ address,
4813
+ symbol: symbol.slice(0, FLUENT_MAX_TOKEN_SYMBOL_LENGTH),
4814
+ name: (name || symbol).slice(0, FLUENT_MAX_TOKEN_NAME_LENGTH),
4815
+ decimals
4816
+ }
4817
+ };
4818
+ }
4819
+
4820
+ // ../connect-sdk/src/tokenSources.ts
4821
+ function withoutCapabilities(token) {
4822
+ const { gasPriority: _gasPriority, native: _native, ...rest } = token;
4823
+ return rest;
4824
+ }
4825
+ function mergeFluentDisplayTokens(params) {
4826
+ const merged = [];
4827
+ const seen = /* @__PURE__ */ new Set();
4828
+ const take = (tokens, source) => {
4829
+ const trusted = source === "default";
4830
+ for (const raw of tokens) {
4831
+ const token = trusted ? raw : withoutCapabilities(raw);
4832
+ const identity = fluentTokenIdentity(token);
4833
+ if (seen.has(identity)) continue;
4834
+ seen.add(identity);
4835
+ merged.push({ ...token, source, identity });
4836
+ }
4837
+ };
4838
+ take(params.defaults, "default");
4839
+ take(params.integrator ?? [], "integrator");
4840
+ take(params.user ?? [], "user");
4841
+ return merged;
4842
+ }
4843
+ function findFluentSymbolCollisions(tokens) {
4844
+ const countBySymbol = /* @__PURE__ */ new Map();
4845
+ for (const token of tokens) {
4846
+ const symbol = token.symbol.toLowerCase();
4847
+ countBySymbol.set(symbol, (countBySymbol.get(symbol) ?? 0) + 1);
4848
+ }
4849
+ return new Set(
4850
+ [...countBySymbol.entries()].filter(([, count]) => count > 1).map(([symbol]) => symbol)
4851
+ );
4852
+ }
4779
4853
 
4780
4854
  // ../connect-sdk/src/families.ts
4781
4855
  function withoutTrailingSlash2(value) {
@@ -4971,7 +5045,6 @@ var FLUENT_NETWORK_ENV_KEYS = [
4971
5045
  "FLUENT_NETWORK"
4972
5046
  ];
4973
5047
  var FLUENT_NETWORK_ALIASES = {
4974
- devnet: "devnet",
4975
5048
  testnet: "testnet",
4976
5049
  mainnet: "mainnet",
4977
5050
  development: "testnet",
@@ -5014,7 +5087,7 @@ var FLUENT_WIDGET_DEFAULT_SCOPES = [
5014
5087
  ];
5015
5088
  var FLUENT_WIDGET_MAINNET_SCOPES = ["openid", "profile", "wallet", "families:read"];
5016
5089
  function isFaucetNetwork(network) {
5017
- return network === "devnet" || network === "testnet";
5090
+ return network === "testnet";
5018
5091
  }
5019
5092
  function getFluentWidgetDefaultScopes(network) {
5020
5093
  return isFaucetNetwork(network) ? FLUENT_WIDGET_DEFAULT_SCOPES : FLUENT_WIDGET_MAINNET_SCOPES;
@@ -5023,8 +5096,6 @@ function getFluentChainForNetwork(network) {
5023
5096
  switch (network) {
5024
5097
  case "mainnet":
5025
5098
  return fluentMainnet;
5026
- case "devnet":
5027
- return fluentDevnet;
5028
5099
  default:
5029
5100
  return fluentTestnet;
5030
5101
  }
@@ -5032,22 +5103,13 @@ function getFluentChainForNetwork(network) {
5032
5103
  function getFluentTokenDefaults(network) {
5033
5104
  return getFluentTokenDefaultsForNetwork(network);
5034
5105
  }
5035
- function getFluentDefaultGasTokens(network) {
5036
- return getFluentDefaultWidgetGasTokens(network);
5037
- }
5038
- function getFluentErc20PaymasterTokenAddresses(network) {
5039
- const defaults = getFluentTokenDefaults(network);
5040
- return {
5041
- BLEND: defaults.BLEND.address,
5042
- USDnr: defaults.USDnr.address
5043
- };
5044
- }
5045
5106
  function getFluentExplorerBaseUrl(network) {
5046
5107
  return getFluentChainForNetwork(network).blockExplorers?.default.url;
5047
5108
  }
5048
5109
 
5049
5110
  // src/core/storageKeys.ts
5050
5111
  var FLUENT_WIDGET_SESSION_STORAGE_KEY = "fluent:widget:session:v1";
5112
+ var FLUENT_WIDGET_USER_TOKENS_STORAGE_KEY = "fluent:widget:tokens:v1";
5051
5113
 
5052
5114
  // src/core/config.ts
5053
5115
  var FLUENT_CONNECT_PRIVY_APP_ID = "cmi7li7v901yojv0dmtfuf0v4";
@@ -5058,11 +5120,14 @@ var FLUENT_CONNECT_TESTNET_PUBLIC_API_URL = "https://api.fluent-connect.dev.gble
5058
5120
  var FLUENT_CONNECT_MAINNET_PUBLIC_API_URL = "https://fluent-connect.api.fluent.xyz/api/v1";
5059
5121
  var FLUENT_CONNECT_TESTNET_ANALYTICS_HOST = "https://api.fluent-connect.dev.gblend.xyz/ingest";
5060
5122
  var FLUENT_CONNECT_MAINNET_ANALYTICS_HOST = "";
5123
+ var FLUENT_CONNECT_TESTNET_SPONSORSHIP_URL = "https://sponsorship.fluent-connect.dev.gblend.xyz";
5124
+ var FLUENT_CONNECT_MAINNET_SPONSORSHIP_URL = "";
5061
5125
  var FLUENT_CONNECT_TESTNET_REPUTATION_SIGNUP_URL = "https://connect-preview.vercel.app/signin";
5062
5126
  var FLUENT_CONNECT_MAINNET_REPUTATION_SIGNUP_URL = "https://connect.fluent.xyz/signin";
5063
5127
  var FLUENT_CONNECT_TESTNET_AUTHORIZE_URL = "https://connect-preview.vercel.app/authorize";
5064
5128
  var FLUENT_CONNECT_MAINNET_AUTHORIZE_URL = "https://connect.fluent.xyz/authorize";
5065
5129
  var FLUENT_CONNECT_TESTNET_FAUCET_ENDPOINT = "https://eco-faucet-api.fluent.xyz/fluent-connect/pre-fund";
5130
+ var FLUENT_CONNECT_DEFAULT_SILENT_SIGNING = true;
5066
5131
  var FLUENT_CONNECT_DEFAULT_PORTAL_BRIDGE_URL = "https://portal.fluent.xyz/user/bridge";
5067
5132
  var FLUENT_CONNECT_DEFAULT_SWAPPER_CONFIG = {
5068
5133
  enabled: true,
@@ -5077,16 +5142,8 @@ var FLUENT_CONNECT_NETWORK_ENDPOINTS = {
5077
5142
  reputationSignupUrl: FLUENT_CONNECT_TESTNET_REPUTATION_SIGNUP_URL,
5078
5143
  faucetEndpoint: FLUENT_CONNECT_TESTNET_FAUCET_ENDPOINT,
5079
5144
  bridgeUrl: FLUENT_CONNECT_DEFAULT_PORTAL_BRIDGE_URL,
5080
- analyticsHost: FLUENT_CONNECT_TESTNET_ANALYTICS_HOST
5081
- },
5082
- // devnet mirrors testnet infrastructure.
5083
- devnet: {
5084
- authorizeUrl: FLUENT_CONNECT_TESTNET_AUTHORIZE_URL,
5085
- publicApiUrl: FLUENT_CONNECT_TESTNET_PUBLIC_API_URL,
5086
- reputationSignupUrl: FLUENT_CONNECT_TESTNET_REPUTATION_SIGNUP_URL,
5087
- faucetEndpoint: FLUENT_CONNECT_TESTNET_FAUCET_ENDPOINT,
5088
- bridgeUrl: FLUENT_CONNECT_DEFAULT_PORTAL_BRIDGE_URL,
5089
- analyticsHost: FLUENT_CONNECT_TESTNET_ANALYTICS_HOST
5145
+ analyticsHost: FLUENT_CONNECT_TESTNET_ANALYTICS_HOST,
5146
+ sponsorshipUrl: FLUENT_CONNECT_TESTNET_SPONSORSHIP_URL
5090
5147
  },
5091
5148
  mainnet: {
5092
5149
  authorizeUrl: FLUENT_CONNECT_MAINNET_AUTHORIZE_URL,
@@ -5095,7 +5152,8 @@ var FLUENT_CONNECT_NETWORK_ENDPOINTS = {
5095
5152
  // Mainnet has no faucet.
5096
5153
  faucetEndpoint: "",
5097
5154
  bridgeUrl: FLUENT_CONNECT_DEFAULT_PORTAL_BRIDGE_URL,
5098
- analyticsHost: FLUENT_CONNECT_MAINNET_ANALYTICS_HOST
5155
+ analyticsHost: FLUENT_CONNECT_MAINNET_ANALYTICS_HOST,
5156
+ sponsorshipUrl: FLUENT_CONNECT_MAINNET_SPONSORSHIP_URL
5099
5157
  }
5100
5158
  };
5101
5159
  function getFluentWidgetNetworkEndpoints(network) {
@@ -5205,10 +5263,36 @@ var FLUENT_FAMILY_TIER_PROGRESS = {
5205
5263
  D: 0
5206
5264
  };
5207
5265
  function resolveFluentWidgetConfig(config) {
5208
- const clientId = config.clientId.trim();
5209
- if (!clientId) {
5266
+ if (config.clientId !== void 0) {
5267
+ throw new Error(
5268
+ "FluentWidgetConfig.clientId was replaced in the PartnerId cutover. Pass partnerId (the partner_<32 hex> id from the Fluent console) and the Privy app client as privyClientId \u2014 both are required."
5269
+ );
5270
+ }
5271
+ const partnerId = (config.partnerId ?? "").trim();
5272
+ if (!partnerId) {
5210
5273
  throw new Error(
5211
- "FluentWidgetConfig.clientId is required. Pass the Fluent Connect app clientId from the host application."
5274
+ "FluentWidgetConfig.partnerId is required. Pass the partner_<32 hex> id from the Fluent console."
5275
+ );
5276
+ }
5277
+ if (partnerId.startsWith("client-")) {
5278
+ throw new Error(
5279
+ `FluentWidgetConfig.partnerId "${partnerId}" is a Privy app client, not a partner id. Pass the partner_<32 hex> id as partnerId and the Privy client as privyClientId.`
5280
+ );
5281
+ }
5282
+ const privyClientId = (config.privyClientId ?? "").trim();
5283
+ if (!privyClientId) {
5284
+ throw new Error(
5285
+ "FluentWidgetConfig.privyClientId is required. Pass the Privy app client issued by Fluent for this partner."
5286
+ );
5287
+ }
5288
+ if (privyClientId.startsWith("partner_")) {
5289
+ throw new Error(
5290
+ `FluentWidgetConfig.privyClientId "${privyClientId}" is a partner id, not a Privy app client. Swap the two: partnerId takes the partner_<32 hex> id, privyClientId the client-\u2026 value.`
5291
+ );
5292
+ }
5293
+ if (!privyClientId.startsWith("client-")) {
5294
+ throw new Error(
5295
+ `FluentWidgetConfig.privyClientId "${privyClientId}" does not look like a Privy app client \u2014 expected the client-\u2026 value issued by Fluent.`
5212
5296
  );
5213
5297
  }
5214
5298
  const network = config.network ?? resolveFluentWidgetNetworkFromEnv() ?? "testnet";
@@ -5216,12 +5300,15 @@ function resolveFluentWidgetConfig(config) {
5216
5300
  return {
5217
5301
  network,
5218
5302
  appName: config.appName ?? "Fluent Connect Demo",
5219
- clientId,
5303
+ partnerId,
5304
+ privyClientId,
5220
5305
  authMode: config.authMode ?? "hosted",
5221
5306
  authorizeUrl: endpoints.authorizeUrl,
5222
5307
  faucetEndpoint: endpoints.faucetEndpoint,
5223
5308
  eventsEndpoint: "",
5224
5309
  analyticsHost: endpoints.analyticsHost,
5310
+ sponsorshipUrl: config.sponsorshipUrl ?? endpoints.sponsorshipUrl,
5311
+ authTokenRenewalOffsetSeconds: config.authTokenRenewalOffsetSeconds ?? 30,
5225
5312
  disableAnalytics: config.disableAnalytics ?? false,
5226
5313
  publicApiUrl: endpoints.publicApiUrl,
5227
5314
  reputationSignupUrl: endpoints.reputationSignupUrl,
@@ -5249,7 +5336,7 @@ function createFluentConnectForWidget(config) {
5249
5336
  return fluent2.initialize({
5250
5337
  network: resolved.network,
5251
5338
  appName: resolved.appName,
5252
- clientId: resolved.clientId,
5339
+ clientId: resolved.privyClientId,
5253
5340
  authorizeUrl: resolved.authorizeUrl,
5254
5341
  scopes: resolved.scopes,
5255
5342
  source: resolved.source,
@@ -5293,6 +5380,246 @@ function useFluentWidget() {
5293
5380
  function useWidget() {
5294
5381
  return useFluentWidget().widget;
5295
5382
  }
5383
+ var FLUENT_USER_TOKEN_LIMIT = 50;
5384
+ function parsePayload(raw) {
5385
+ if (!raw) return [];
5386
+ let parsed;
5387
+ try {
5388
+ parsed = JSON.parse(raw);
5389
+ } catch {
5390
+ return [];
5391
+ }
5392
+ if (typeof parsed !== "object" || parsed === null) return [];
5393
+ const tokens = parsed.tokens;
5394
+ if (!Array.isArray(tokens)) return [];
5395
+ const valid = [];
5396
+ const seen = /* @__PURE__ */ new Set();
5397
+ for (const entry of tokens) {
5398
+ const token = validateStoredToken(entry);
5399
+ if (!token) continue;
5400
+ const key = fluentTokenIdentity(token);
5401
+ if (seen.has(key)) continue;
5402
+ seen.add(key);
5403
+ valid.push(token);
5404
+ }
5405
+ return valid;
5406
+ }
5407
+ function validateStoredToken(entry) {
5408
+ if (typeof entry !== "object" || entry === null) return null;
5409
+ const candidate = entry;
5410
+ const { chainId, address, symbol, name, decimals } = candidate;
5411
+ if (typeof chainId !== "number" || !Number.isInteger(chainId)) return null;
5412
+ if (typeof address !== "string" || !isAddress(address)) return null;
5413
+ if (typeof symbol !== "string" || symbol.length === 0) return null;
5414
+ if (typeof name !== "string" || name.length === 0) return null;
5415
+ if (!isFluentTokenDecimals(decimals)) return null;
5416
+ return {
5417
+ chainId,
5418
+ address: getAddress(address),
5419
+ symbol,
5420
+ name,
5421
+ decimals
5422
+ };
5423
+ }
5424
+ function resolveStorage(storage) {
5425
+ if (storage) return storage;
5426
+ try {
5427
+ return globalThis.localStorage ?? null;
5428
+ } catch {
5429
+ return null;
5430
+ }
5431
+ }
5432
+ function createFluentUserTokenStore(options) {
5433
+ const key = options?.key ?? FLUENT_WIDGET_USER_TOKENS_STORAGE_KEY;
5434
+ const storage = resolveStorage(options?.storage);
5435
+ let memory = [];
5436
+ const readAll = () => {
5437
+ if (!storage) return memory;
5438
+ try {
5439
+ return parsePayload(storage.getItem(key));
5440
+ } catch {
5441
+ return memory;
5442
+ }
5443
+ };
5444
+ const writeAll = (tokens) => {
5445
+ memory = tokens;
5446
+ if (!storage) return;
5447
+ const payload = { version: 1, tokens };
5448
+ try {
5449
+ storage.setItem(key, JSON.stringify(payload));
5450
+ } catch {
5451
+ }
5452
+ };
5453
+ return {
5454
+ list(chainId) {
5455
+ return readAll().filter((token) => token.chainId === chainId);
5456
+ },
5457
+ add(token) {
5458
+ const all = readAll();
5459
+ const tokenKey = fluentTokenIdentity(token);
5460
+ if (all.some((existing) => fluentTokenIdentity(existing) === tokenKey)) {
5461
+ return { status: "already-present" };
5462
+ }
5463
+ const onChain = all.filter((existing) => existing.chainId === token.chainId);
5464
+ if (onChain.length >= FLUENT_USER_TOKEN_LIMIT) {
5465
+ return { status: "at-capacity", limit: FLUENT_USER_TOKEN_LIMIT };
5466
+ }
5467
+ const stored = validateStoredToken(token);
5468
+ if (!stored) return { status: "invalid" };
5469
+ writeAll([...all, stored]);
5470
+ return { status: "added" };
5471
+ },
5472
+ remove(token) {
5473
+ const tokenKey = fluentTokenIdentity(token);
5474
+ writeAll(readAll().filter((existing) => fluentTokenIdentity(existing) !== tokenKey));
5475
+ }
5476
+ };
5477
+ }
5478
+
5479
+ // src/hooks/useFluentUserTokens.ts
5480
+ function useFluentUserTokens(options) {
5481
+ const { chain } = useFluentWidgetNetwork();
5482
+ const injectedStore = options?.store;
5483
+ const store = useMemo(
5484
+ () => injectedStore ?? createFluentUserTokenStore(),
5485
+ [injectedStore]
5486
+ );
5487
+ const [revision, setRevision] = useState(0);
5488
+ const tokens = useMemo(
5489
+ // eslint-disable-next-line react-hooks/exhaustive-deps -- `revision` is the invalidation signal
5490
+ () => store.list(chain.id),
5491
+ [store, chain.id, revision]
5492
+ );
5493
+ const add = useCallback(
5494
+ (token) => {
5495
+ const result = store.add(token);
5496
+ if (result.status === "added") setRevision((value) => value + 1);
5497
+ return result;
5498
+ },
5499
+ [store]
5500
+ );
5501
+ const remove = useCallback(
5502
+ (token) => {
5503
+ store.remove(token);
5504
+ setRevision((value) => value + 1);
5505
+ },
5506
+ [store]
5507
+ );
5508
+ return { tokens, add, remove };
5509
+ }
5510
+
5511
+ // src/utils/postJson.ts
5512
+ var HttpError = class extends Error {
5513
+ constructor(status, body) {
5514
+ super(body?.message ?? body?.error ?? `Request failed with ${status}`);
5515
+ this.status = status;
5516
+ this.body = body;
5517
+ this.name = "HttpError";
5518
+ }
5519
+ status;
5520
+ body;
5521
+ };
5522
+ async function postJson(url, body, headers = {}) {
5523
+ const response = await fetch(url, {
5524
+ method: "POST",
5525
+ headers: {
5526
+ "Content-Type": "application/json",
5527
+ ...headers
5528
+ },
5529
+ body: JSON.stringify(body)
5530
+ });
5531
+ if (!response.ok) {
5532
+ let errorBody;
5533
+ try {
5534
+ errorBody = await response.json();
5535
+ } catch {
5536
+ errorBody = void 0;
5537
+ }
5538
+ throw new HttpError(response.status, errorBody);
5539
+ }
5540
+ return response.json();
5541
+ }
5542
+
5543
+ // src/core/authToken.ts
5544
+ var FluentAuthError = class extends Error {
5545
+ constructor(code, message, status) {
5546
+ super(message);
5547
+ this.code = code;
5548
+ this.status = status;
5549
+ this.name = "FluentAuthError";
5550
+ }
5551
+ code;
5552
+ status;
5553
+ };
5554
+ var RETRY_ONCE = /* @__PURE__ */ new Set([
5555
+ "signature_prefix_rejected",
5556
+ "nonce_expired",
5557
+ "nonce_used"
5558
+ ]);
5559
+ function toAuthError(err) {
5560
+ if (err instanceof FluentAuthError) return err;
5561
+ if (err instanceof HttpError) {
5562
+ const code = err.body?.code ?? "request_failed";
5563
+ return new FluentAuthError(code, err.message, err.status);
5564
+ }
5565
+ return new FluentAuthError("request_failed", err instanceof Error ? err.message : String(err));
5566
+ }
5567
+ async function exchangePrivyAuthToken(params) {
5568
+ try {
5569
+ const { token } = await postJson(`${params.publicApiUrl}/auth/exchange/privy`, {
5570
+ partnerId: params.partnerId,
5571
+ accessToken: params.accessToken,
5572
+ identityToken: params.identityToken
5573
+ });
5574
+ return token;
5575
+ } catch (err) {
5576
+ throw toAuthError(err);
5577
+ }
5578
+ }
5579
+ async function exchangeWalletAuthToken(params) {
5580
+ const attempt = async () => {
5581
+ const challenge = await postJson(`${params.publicApiUrl}/auth/challenge`, {
5582
+ partnerId: params.partnerId,
5583
+ address: params.address
5584
+ });
5585
+ if (challenge.typedData.message.origin !== params.origin) {
5586
+ throw new FluentAuthError(
5587
+ "origin_mismatch",
5588
+ `Challenge origin ${challenge.typedData.message.origin} does not match ${params.origin}`
5589
+ );
5590
+ }
5591
+ const signature = await params.walletClient.signTypedData({
5592
+ account: params.address,
5593
+ ...challenge.typedData
5594
+ });
5595
+ const { token } = await postJson(`${params.publicApiUrl}/auth/exchange/wallet`, {
5596
+ partnerId: params.partnerId,
5597
+ nonce: challenge.nonce,
5598
+ signature
5599
+ });
5600
+ return token;
5601
+ };
5602
+ try {
5603
+ return await attempt();
5604
+ } catch (first) {
5605
+ const err = toAuthError(first);
5606
+ if (!RETRY_ONCE.has(err.code)) throw err;
5607
+ try {
5608
+ return await attempt();
5609
+ } catch (second) {
5610
+ throw toAuthError(second);
5611
+ }
5612
+ }
5613
+ }
5614
+ function readAuthTokenExpiry(token) {
5615
+ try {
5616
+ const [, body = ""] = token.split(".");
5617
+ const payload = JSON.parse(atob(body.replace(/-/g, "+").replace(/_/g, "/")));
5618
+ return typeof payload.exp === "number" ? payload.exp * 1e3 : void 0;
5619
+ } catch {
5620
+ return void 0;
5621
+ }
5622
+ }
5296
5623
  function createFluentBatchOp(input, executor) {
5297
5624
  if (input.calls.length === 0) {
5298
5625
  throw new Error("A Fluent batch operation requires at least one call");
@@ -5367,11 +5694,13 @@ function encodeBatchCall(call) {
5367
5694
  })
5368
5695
  };
5369
5696
  }
5370
- var FLUENT_GAS_PAYMENT_PRIORITY = ["USDnr", "BLEND", "ETH"];
5371
5697
  function getFluentGasTokenAddress(symbol, network) {
5372
- if (symbol === "ETH") return void 0;
5373
- const addresses = getFluentErc20PaymasterTokenAddresses(network);
5374
- return symbol === "BLEND" ? addresses.BLEND : addresses.USDnr;
5698
+ const wanted = symbol.toUpperCase();
5699
+ const token = getFluentDefaultWidgetGasTokens(network).find(
5700
+ (candidate) => candidate.symbol.toUpperCase() === wanted
5701
+ );
5702
+ if (!token || isFluentNativeToken(token)) return void 0;
5703
+ return token.address;
5375
5704
  }
5376
5705
  var FLUENT_GAS_PAYMENT_DEFAULT_ETH_RATES = {
5377
5706
  ETH: "1"
@@ -5384,12 +5713,11 @@ function selectFluentGasPaymentToken(params) {
5384
5713
  balance: null
5385
5714
  };
5386
5715
  }
5387
- for (const symbol of FLUENT_GAS_PAYMENT_PRIORITY) {
5388
- const balance = params.balances.find((item) => item.symbol === symbol);
5389
- if (balance?.status === "ready" && balance.raw !== null && balance.raw > 0n) {
5716
+ for (const balance of getFluentGasPaymentTokens(params.balances)) {
5717
+ if (balance.status === "ready" && balance.raw !== null && balance.raw > 0n) {
5390
5718
  return {
5391
5719
  status: "ready",
5392
- symbol,
5720
+ symbol: balance.symbol,
5393
5721
  balance
5394
5722
  };
5395
5723
  }
@@ -5401,7 +5729,7 @@ function selectFluentGasPaymentToken(params) {
5401
5729
  };
5402
5730
  }
5403
5731
  function getFluentGasPaymentTokens(tokens) {
5404
- return FLUENT_GAS_PAYMENT_PRIORITY.map((symbol) => tokens.find((token) => token.symbol === symbol)).filter((token) => Boolean(token));
5732
+ return sortFluentGasTokens(tokens.filter(isFluentDefaultToken));
5405
5733
  }
5406
5734
  function getFluentGasPaymentEthValue(params) {
5407
5735
  const balance = params.balance;
@@ -5438,27 +5766,6 @@ function getFluentGasPaymentValueTier(ethValueWei) {
5438
5766
  if (ethValueWei > 0n) return "neutral";
5439
5767
  return "neutral";
5440
5768
  }
5441
- function formatFluentGasTokenBalance(balance, maximumFractionDigits = 1) {
5442
- if (balance.raw === null || balance.formatted === null) return null;
5443
- if (maximumFractionDigits < 0 || !Number.isInteger(maximumFractionDigits)) {
5444
- throw new Error("maximumFractionDigits must be a non-negative integer");
5445
- }
5446
- let plain = balance.formatted;
5447
- if (balance.decimals > maximumFractionDigits) {
5448
- const discardedScale = 10n ** BigInt(balance.decimals - maximumFractionDigits);
5449
- const rounded = (balance.raw + discardedScale / 2n) / discardedScale;
5450
- plain = formatUnits(rounded, maximumFractionDigits);
5451
- }
5452
- return formatFluentLocaleAmount(plain, maximumFractionDigits);
5453
- }
5454
- function formatFluentLocaleAmount(value, maximumFractionDigits = 2) {
5455
- const amount = typeof value === "number" ? value : Number(value);
5456
- if (!Number.isFinite(amount)) return typeof value === "string" ? value : String(value);
5457
- return amount.toLocaleString("de-DE", {
5458
- minimumFractionDigits: 0,
5459
- maximumFractionDigits
5460
- });
5461
- }
5462
5769
  function formatEthValue(ethValueWei) {
5463
5770
  if (ethValueWei === 0n) return "0 ETH";
5464
5771
  const formatted = formatUnits(ethValueWei, 18);
@@ -5606,22 +5913,26 @@ async function withTimeout(promise, timeoutMs, message) {
5606
5913
  if (timer) clearTimeout(timer);
5607
5914
  }
5608
5915
  }
5916
+ function getSponsorshipFailure(err) {
5917
+ const httpError = err instanceof BaseError ? err.walk((e) => e instanceof HttpRequestError) : null;
5918
+ if (!httpError) return { reason: "denied", disableSponsorship: false };
5919
+ if (httpError.status === 403) return { reason: "unauthorized", disableSponsorship: true };
5920
+ if (httpError.status === 401) return { reason: "unauthorized", disableSponsorship: false };
5921
+ return { reason: "unreachable", disableSponsorship: false };
5922
+ }
5609
5923
  var FLUENT_ZERODEV_ERC20_PAYMASTER_QUERY = "selfFunded=true";
5610
5924
  var FLUENT_ZERODEV_PAYMASTER_DEMO_RECIPIENT = "0x000000000000000000000000000000000000dEaD";
5611
5925
  function getFluentZeroDevErc20PaymasterTokens(network = "testnet") {
5612
- const addresses = getFluentErc20PaymasterTokenAddresses(network);
5613
- return {
5614
- BLEND: {
5615
- address: addresses.BLEND,
5616
- decimals: 18,
5617
- symbol: "BLEND"
5618
- },
5619
- USDNR: {
5620
- address: addresses.USDnr,
5621
- decimals: 18,
5622
- symbol: "USDnr"
5623
- }
5624
- };
5926
+ return Object.fromEntries(
5927
+ getFluentDefaultWidgetGasTokens(network).filter((token) => !isFluentNativeToken(token) && token.address).map((token) => [
5928
+ token.symbol.toUpperCase(),
5929
+ {
5930
+ address: token.address,
5931
+ decimals: token.decimals,
5932
+ symbol: token.symbol
5933
+ }
5934
+ ])
5935
+ );
5625
5936
  }
5626
5937
  function createFluentZeroDevRpcUrl(params = {}) {
5627
5938
  const chainId = params.chainId ?? fluentTestnet.id;
@@ -5632,10 +5943,34 @@ function createFluentZeroDevRpcUrl(params = {}) {
5632
5943
  function createFluentZeroDevErc20PaymasterRpcUrl(params = {}) {
5633
5944
  return createFluentZeroDevRpcUrl({ ...params, selfFunded: true });
5634
5945
  }
5946
+ function createFluentSponsorshipRpcUrl(params) {
5947
+ const base = params.sponsorshipUrl.replace(/\/+$/, "");
5948
+ return `${base}/paymaster/${encodeURIComponent(params.partnerId)}`;
5949
+ }
5950
+ function createFluentZeroDevSponsoredPaymaster(params) {
5951
+ const paymasterClient = createZeroDevPaymasterClient({
5952
+ chain: params.chain,
5953
+ transport: http(params.rpcUrl, {
5954
+ fetchOptions: { headers: { Authorization: `Bearer ${params.accessToken}` } }
5955
+ })
5956
+ });
5957
+ return {
5958
+ getPaymasterData: (userOperation) => paymasterClient.sponsorUserOperation({
5959
+ userOperation: withoutChainMetadata(userOperation)
5960
+ })
5961
+ };
5962
+ }
5635
5963
  function resolveFluentZeroDevErc20PaymasterToken(token = "BLEND", network = "testnet") {
5636
5964
  if (typeof token === "object") return token;
5637
5965
  if (token.startsWith("0x")) return { address: token };
5638
- return getFluentZeroDevErc20PaymasterTokens(network)[token];
5966
+ const tokens = getFluentZeroDevErc20PaymasterTokens(network);
5967
+ const resolved = tokens[token.toUpperCase()];
5968
+ if (!resolved) {
5969
+ throw new Error(
5970
+ `"${token}" cannot pay gas on ${network}. Paymaster tokens: ${Object.keys(tokens).join(", ") || "none"}`
5971
+ );
5972
+ }
5973
+ return resolved;
5639
5974
  }
5640
5975
  function createFluentZeroDevErc20PaymasterClient(params = {}) {
5641
5976
  const chain = params.chain ?? fluentTestnet;
@@ -5790,7 +6125,7 @@ function createFluentBundlerTransport(url) {
5790
6125
  // src/widget/zerodevSession.ts
5791
6126
  function useFluentZeroDevAccount(hookOptions = {}) {
5792
6127
  const { chain, network } = useFluentWidgetNetwork();
5793
- const { authenticated, login: privyLogin, ready } = usePrivy();
6128
+ const { authenticated, getAccessToken, login: privyLogin, ready } = usePrivy();
5794
6129
  const login = hookOptions.login ?? privyLogin;
5795
6130
  const { signMessage: promptSignMessage } = useSignMessage();
5796
6131
  const { signTypedData: promptSignTypedData } = useSignTypedData();
@@ -5799,6 +6134,7 @@ function useFluentZeroDevAccount(hookOptions = {}) {
5799
6134
  const [error, setError] = useState(null);
5800
6135
  const [smartAccountReady, setSmartAccountReady] = useState(false);
5801
6136
  const initPromise = useRef({});
6137
+ const sponsorshipUnavailable = useRef(false);
5802
6138
  const embeddedWallet = wallets.find((wallet) => wallet.walletClientType === "privy");
5803
6139
  const hostedSigner = useMemo(
5804
6140
  () => hookOptions.allowHostedSigner !== false && hookOptions.authorizeUrl && hookOptions.sessionSignerAddress ? createFluentHostedSigner({
@@ -5971,6 +6307,26 @@ function useFluentZeroDevAccount(hookOptions = {}) {
5971
6307
  },
5972
6308
  [authenticated, embeddedWallet, error, hostedSigner, initialize2, kernels.prompt, ready]
5973
6309
  );
6310
+ const createSponsoredClient = useCallback(async (kernel) => {
6311
+ if (!hookOptions.sponsorshipUrl || !hookOptions.partnerId) return null;
6312
+ if (sponsorshipUnavailable.current) return null;
6313
+ const accessToken = await getAccessToken();
6314
+ if (!accessToken) return null;
6315
+ return createKernelAccountClient({
6316
+ account: kernel.account,
6317
+ chain: kernel.chain,
6318
+ bundlerTransport: createFluentBundlerTransport(kernel.zeroDevRpcUrl),
6319
+ client: kernel.publicClient,
6320
+ paymaster: createFluentZeroDevSponsoredPaymaster({
6321
+ chain: kernel.chain,
6322
+ accessToken,
6323
+ rpcUrl: createFluentSponsorshipRpcUrl({
6324
+ sponsorshipUrl: hookOptions.sponsorshipUrl,
6325
+ partnerId: hookOptions.partnerId
6326
+ })
6327
+ })
6328
+ });
6329
+ }, [getAccessToken, hookOptions.partnerId, hookOptions.sponsorshipUrl]);
5974
6330
  const sendCalls = useCallback(
5975
6331
  async (calls, options) => {
5976
6332
  const signerMode = confirmationToSignerMode(options?.confirmation ?? "always");
@@ -5995,6 +6351,7 @@ function useFluentZeroDevAccount(hookOptions = {}) {
5995
6351
  smartAccountAddress: executionKernel.smartAccountAddress,
5996
6352
  gasToken,
5997
6353
  gasTokenSymbol: options?.gasPayment?.symbol,
6354
+ sponsorship: options?.gasPayment?.sponsorship ?? "auto",
5998
6355
  approvalIncluded: Boolean(gasToken && options?.gasPayment?.includeApproval),
5999
6356
  calls: preparedCalls.map((call) => ({
6000
6357
  to: call.to,
@@ -6006,29 +6363,63 @@ function useFluentZeroDevAccount(hookOptions = {}) {
6006
6363
  gasTokenSymbol: options?.gasPayment?.symbol
6007
6364
  });
6008
6365
  try {
6009
- const executionClient = gasToken ? createFluentZeroDevErc20ExecutionClient(executionKernel, gasToken) : executionKernel.client;
6010
- const userOpHash = await executionClient.sendUserOperation({
6366
+ const callArgs = {
6011
6367
  account: executionKernel.account,
6012
6368
  calls: preparedCalls.map((call) => ({
6013
6369
  to: call.to,
6014
6370
  data: call.data ?? "0x",
6015
6371
  value: call.value ?? 0n
6016
6372
  }))
6017
- });
6373
+ };
6374
+ const sponsorshipRefused = !gasToken && options?.gasPayment?.sponsorship === "never";
6375
+ const sponsoredClient = gasToken || sponsorshipRefused ? null : await createSponsoredClient(executionKernel);
6376
+ const executionClient = gasToken ? createFluentZeroDevErc20ExecutionClient(executionKernel, gasToken) : sponsoredClient ?? executionKernel.client;
6377
+ let sponsorshipReason;
6378
+ if (sponsorshipRefused) {
6379
+ sponsorshipReason = "not_requested";
6380
+ } else if (!gasToken && !sponsoredClient && hookOptions.sponsorshipUrl && hookOptions.partnerId) {
6381
+ sponsorshipReason = sponsorshipUnavailable.current ? "unauthorized" : "no_token";
6382
+ }
6383
+ let settlementClient = executionClient;
6384
+ let userOpHash;
6385
+ try {
6386
+ userOpHash = await executionClient.sendUserOperation(callArgs);
6387
+ } catch (err) {
6388
+ if (!sponsoredClient) throw err;
6389
+ const failure = getSponsorshipFailure(err);
6390
+ sponsorshipReason = failure.reason;
6391
+ if (failure.disableSponsorship) sponsorshipUnavailable.current = true;
6392
+ debugWarn("[fluent zerodev] sponsorship unavailable, paying own gas", {
6393
+ reason: sponsorshipReason
6394
+ });
6395
+ settlementClient = executionKernel.client;
6396
+ userOpHash = await executionKernel.client.sendUserOperation(callArgs);
6397
+ }
6018
6398
  debugLog("[fluent zerodev] sendCalls userOp submitted", { userOpHash });
6019
- const receipt = await executionClient.waitForUserOperationReceipt({
6399
+ const receipt = await settlementClient.waitForUserOperationReceipt({
6020
6400
  hash: userOpHash
6021
6401
  });
6402
+ const paymaster = readUserOperationPaymaster(receipt);
6403
+ const sponsored = gasToken ? false : paymaster ? paymaster !== zeroAddress : Boolean(sponsoredClient);
6404
+ if (!gasToken && sponsoredClient && !sponsored) sponsorshipReason ??= "denied";
6022
6405
  debugLog("[fluent zerodev] sendCalls receipt", {
6023
6406
  userOpHash,
6024
6407
  success: receipt.success,
6025
6408
  reason: receipt.reason,
6026
- transactionHash: receipt.receipt.transactionHash
6409
+ transactionHash: receipt.receipt.transactionHash,
6410
+ sponsored,
6411
+ paymaster,
6412
+ sponsorshipReason
6027
6413
  });
6028
6414
  if (!receipt.success) {
6029
6415
  throw new Error(receipt.reason ?? `UserOperation ${userOpHash} execution failed`);
6030
6416
  }
6031
- return receipt.receipt.transactionHash;
6417
+ return {
6418
+ hash: receipt.receipt.transactionHash,
6419
+ sponsored,
6420
+ sponsorshipReason,
6421
+ paymaster
6422
+ };
6032
6423
  } catch (err) {
6033
6424
  debugError("[fluent zerodev] sendCalls failed", err);
6034
6425
  throw err;
@@ -6038,10 +6429,13 @@ function useFluentZeroDevAccount(hookOptions = {}) {
6038
6429
  },
6039
6430
  [
6040
6431
  authenticated,
6432
+ createSponsoredClient,
6041
6433
  embeddedWallet,
6042
6434
  error,
6043
6435
  hostedSigner,
6044
6436
  hookOptions.authorizationSession,
6437
+ hookOptions.partnerId,
6438
+ hookOptions.sponsorshipUrl,
6045
6439
  initialize2,
6046
6440
  kernels,
6047
6441
  network,
@@ -6078,6 +6472,20 @@ function useFluentZeroDevAccount(hookOptions = {}) {
6078
6472
  refresh: () => initialize2({ throwOnError: true, signerMode: "prompt" })
6079
6473
  };
6080
6474
  }
6475
+ var USER_OPERATION_EVENT_TOPIC = toEventSelector(
6476
+ parseAbiItem(
6477
+ "event UserOperationEvent(bytes32 indexed userOpHash, address indexed sender, address indexed paymaster, uint256 nonce, bool success, uint256 actualGasCost, uint256 actualGasUsed)"
6478
+ )
6479
+ ).toLowerCase();
6480
+ function readUserOperationPaymaster(receipt) {
6481
+ if (receipt.paymaster) return getAddress(receipt.paymaster);
6482
+ const event = receipt.logs.find(
6483
+ (log) => log.topics[0]?.toLowerCase() === USER_OPERATION_EVENT_TOPIC && log.topics[1]?.toLowerCase() === receipt.userOpHash.toLowerCase()
6484
+ );
6485
+ const topic = event?.topics[3];
6486
+ if (!topic || topic.length !== 66) return void 0;
6487
+ return getAddress(`0x${topic.slice(26)}`);
6488
+ }
6081
6489
  function getZeroDevReadinessMessage(params) {
6082
6490
  if (!params.ready) return "Privy wallet context is still loading";
6083
6491
  if (params.hostedSignerAvailable) return "Fluent hosted signer is preparing";
@@ -6537,7 +6945,7 @@ function toUnixSeconds(value) {
6537
6945
  }
6538
6946
 
6539
6947
  // package.json
6540
- var version = "0.1.4";
6948
+ var version = "0.2.0";
6541
6949
 
6542
6950
  // src/core/analytics.ts
6543
6951
  var INSTANCE_NAME = "fluent";
@@ -6619,7 +7027,7 @@ function createTracker(config, getContext) {
6619
7027
  const enabled = analyticsEnabled(config);
6620
7028
  if (enabled) initFluentAnalytics(config);
6621
7029
  const base = {
6622
- client_id: config.clientId,
7030
+ partner_id: config.partnerId,
6623
7031
  network: config.network,
6624
7032
  auth_mode: config.authMode,
6625
7033
  source: config.source,
@@ -6640,8 +7048,498 @@ function trackWidgetLoadedOnce(track, properties) {
6640
7048
  if (track.live) widgetLoadedTracked = true;
6641
7049
  }
6642
7050
 
6643
- // src/utils/hasStoredWidgetSession.ts
6644
- function hasStoredWidgetSession(storage = globalThis.window?.localStorage) {
7051
+ // src/utils/buildFluentBridgeUrl.ts
7052
+ function buildFluentBridgeUrl(bridgeUrl, recipient) {
7053
+ if (!recipient) return bridgeUrl;
7054
+ try {
7055
+ const url = new URL(bridgeUrl);
7056
+ url.searchParams.set("recipient", recipient);
7057
+ return url.toString();
7058
+ } catch {
7059
+ const join = bridgeUrl.includes("?") ? "&" : "?";
7060
+ return `${bridgeUrl}${join}recipient=${encodeURIComponent(recipient)}`;
7061
+ }
7062
+ }
7063
+
7064
+ // src/utils/clearPrivyRecentLoginMethod.ts
7065
+ function clearPrivyRecentLoginMethod(appId) {
7066
+ if (typeof window === "undefined" || !appId) return;
7067
+ try {
7068
+ window.localStorage.removeItem(`privy:${appId}:recent-login-method`);
7069
+ window.localStorage.removeItem(`privy:${appId}:recent-login-wallet-client`);
7070
+ window.localStorage.removeItem(`privy:${appId}:recent-login-chain-type`);
7071
+ } catch {
7072
+ }
7073
+ }
7074
+ function cn(...inputs) {
7075
+ return twMerge(clsx(inputs));
7076
+ }
7077
+ var WIDGET_STYLE_SCOPE = "fluent-root dark contents text-foreground";
7078
+ var FluentPortalContainerContext = createContext(null);
7079
+ function FluentPortalContainerProvider({ children }) {
7080
+ const [container, setContainer] = useState(null);
7081
+ useLayoutEffect(() => {
7082
+ const element = document.createElement("div");
7083
+ element.setAttribute("data-fluent-portal-root", "");
7084
+ element.className = WIDGET_STYLE_SCOPE;
7085
+ document.body.appendChild(element);
7086
+ setContainer(element);
7087
+ return () => {
7088
+ element.remove();
7089
+ setContainer(null);
7090
+ };
7091
+ }, []);
7092
+ return /* @__PURE__ */ jsx(FluentPortalContainerContext.Provider, { value: container, children });
7093
+ }
7094
+ function useFluentPortalContainer(override) {
7095
+ const container = useContext(FluentPortalContainerContext);
7096
+ return override ?? container ?? void 0;
7097
+ }
7098
+ var buttonVariants = cva(
7099
+ "group/button inline-flex shrink-0 items-center justify-center rounded-xl border border-transparent bg-clip-padding font-medium whitespace-nowrap transition-all duration-75 outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 active:not-aria-[haspopup]:translate-y-px disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
7100
+ {
7101
+ variants: {
7102
+ variant: {
7103
+ default: "bg-primary text-primary-foreground hover:bg-primary/80",
7104
+ outline: "border-border bg-background hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50",
7105
+ secondary: "bg-button text-button-foreground hover:bg-button-hover aria-expanded:bg-button aria-expanded:text-button-foreground",
7106
+ ghost: "hover:bg-primary/10 hover:text-foreground dark:hover:bg-primary/10",
7107
+ destructive: "bg-destructive/10 text-destructive hover:bg-destructive/20 focus-visible:border-destructive/40 focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:hover:bg-destructive/30 dark:focus-visible:ring-destructive/40",
7108
+ link: "text-primary underline-offset-4 hover:underline"
7109
+ },
7110
+ size: {
7111
+ default: "h-10 gap-1.5 px-3.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2 text-sm",
7112
+ xs: "h-6 gap-1 rounded-[min(var(--radius-md),10px)] px-2 text-xs in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3",
7113
+ sm: "h-7 gap-1 rounded-[min(var(--radius-md),12px)] px-2.5 text-[0.8rem] in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3.5",
7114
+ lg: "h-9 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",
7115
+ icon: "size-8",
7116
+ "icon-xs": "size-6 rounded-[min(var(--radius-md),10px)] in-data-[slot=button-group]:rounded-lg [&_svg:not([class*='size-'])]:size-3",
7117
+ "icon-sm": "size-7 rounded-[min(var(--radius-md),12px)] in-data-[slot=button-group]:rounded-lg",
7118
+ "icon-lg": "size-9"
7119
+ }
7120
+ },
7121
+ defaultVariants: {
7122
+ variant: "default",
7123
+ size: "default"
7124
+ }
7125
+ }
7126
+ );
7127
+ var Button = forwardRef(function Button2({ className, variant = "default", size = "default", href, target, rel, render, ...props }, ref) {
7128
+ const isLink = href !== void 0;
7129
+ return /* @__PURE__ */ jsx(
7130
+ Button$1,
7131
+ {
7132
+ ref,
7133
+ "data-slot": "button",
7134
+ nativeButton: isLink ? false : void 0,
7135
+ className: cn(buttonVariants({ variant, size, className })),
7136
+ render: isLink ? /* @__PURE__ */ jsx("a", { href, target, rel }) : render,
7137
+ ...props
7138
+ }
7139
+ );
7140
+ });
7141
+ var toast = Toast$1.createToastManager();
7142
+ function ToastProvider({ ...props }) {
7143
+ return /* @__PURE__ */ jsx(Toast$1.Provider, { ...props });
7144
+ }
7145
+ function ToastPortal({ container, ...props }) {
7146
+ return /* @__PURE__ */ jsx(
7147
+ Toast$1.Portal,
7148
+ {
7149
+ "data-slot": "toast-portal",
7150
+ container: useFluentPortalContainer(container),
7151
+ ...props
7152
+ }
7153
+ );
7154
+ }
7155
+ function ToastViewport({ className, ...props }) {
7156
+ return /* @__PURE__ */ jsx(
7157
+ Toast$1.Viewport,
7158
+ {
7159
+ "data-slot": "toast-viewport",
7160
+ className: cn(
7161
+ "dark pointer-events-none fixed inset-x-4 bottom-4 z-[100] mx-auto w-[min(100%,368px)] max-w-[368px] text-foreground outline-none sm:right-4 sm:left-auto sm:mx-0",
7162
+ className
7163
+ ),
7164
+ ...props
7165
+ }
7166
+ );
7167
+ }
7168
+ function Toast({ className, style, ...props }) {
7169
+ return /* @__PURE__ */ jsx(
7170
+ Toast$1.Root,
7171
+ {
7172
+ "data-slot": "toast",
7173
+ style: { maxWidth: 368, ...style },
7174
+ className: cn(
7175
+ "group/toast pointer-events-auto absolute right-0 bottom-0 z-[calc(1000-var(--toast-index))] w-full max-w-[368px] origin-bottom rounded-2xl border border-white/20 bg-popover text-popover-foreground shadow-lg will-change-transform outline-none select-none focus-visible:border-border focus-visible:ring-[3px] focus-visible:ring-ring/50",
7176
+ "[--gap:0.75rem] [--height:var(--toast-frontmost-height,var(--toast-height))] [--offset-y:calc(var(--toast-offset-y)*-1+calc(var(--toast-index)*var(--gap)*-1)+var(--toast-swipe-movement-y))] [--peek:0.75rem] [--scale:calc(max(0,1-(var(--toast-index)*0.1)))] [--shrink:calc(1-var(--scale))]",
7177
+ "h-(--height) [transform:translateX(var(--toast-swipe-movement-x))_translateY(calc(var(--toast-swipe-movement-y)-(var(--toast-index)*var(--peek))-(var(--shrink)*var(--height))))_scale(var(--scale))] [transition:transform_500ms_cubic-bezier(0.22,1,0.36,1),opacity_500ms,height_150ms]",
7178
+ "after:absolute after:top-full after:left-0 after:h-[calc(var(--gap)+1px)] after:w-full after:content-['']",
7179
+ "data-expanded:h-(--toast-height) data-expanded:[transform:translateX(var(--toast-swipe-movement-x))_translateY(var(--offset-y))]",
7180
+ "data-limited:opacity-0 data-starting-style:[transform:translateY(150%)]",
7181
+ "[&[data-ending-style]:not([data-limited]):not([data-swipe-direction])]:[transform:translateY(150%)]",
7182
+ "data-ending-style:data-[swipe-direction=down]:[transform:translateY(calc(var(--toast-swipe-movement-y)+150%))]",
7183
+ "data-ending-style:data-[swipe-direction=left]:[transform:translateX(calc(var(--toast-swipe-movement-x)-150%))_translateY(var(--offset-y))]",
7184
+ "data-ending-style:data-[swipe-direction=right]:[transform:translateX(calc(var(--toast-swipe-movement-x)+150%))_translateY(var(--offset-y))]",
7185
+ "data-ending-style:data-[swipe-direction=up]:[transform:translateY(calc(var(--toast-swipe-movement-y)-150%))]",
7186
+ "data-expanded:data-ending-style:data-[swipe-direction=down]:[transform:translateY(calc(var(--toast-swipe-movement-y)+150%))]",
7187
+ "data-expanded:data-ending-style:data-[swipe-direction=left]:[transform:translateX(calc(var(--toast-swipe-movement-x)-150%))_translateY(var(--offset-y))]",
7188
+ "data-expanded:data-ending-style:data-[swipe-direction=right]:[transform:translateX(calc(var(--toast-swipe-movement-x)+150%))_translateY(var(--offset-y))]",
7189
+ "data-expanded:data-ending-style:data-[swipe-direction=up]:[transform:translateY(calc(var(--toast-swipe-movement-y)-150%))]",
7190
+ className
7191
+ ),
7192
+ ...props
7193
+ }
7194
+ );
7195
+ }
7196
+ function ToastContent({ className, ...props }) {
7197
+ return /* @__PURE__ */ jsx(
7198
+ Toast$1.Content,
7199
+ {
7200
+ "data-slot": "toast-content",
7201
+ className: cn(
7202
+ "flex h-full items-start gap-3 overflow-hidden p-4 transition-opacity duration-250 ease-[cubic-bezier(0.22,1,0.36,1)] data-behind:opacity-0 data-expanded:opacity-100",
7203
+ className
7204
+ ),
7205
+ ...props
7206
+ }
7207
+ );
7208
+ }
7209
+ function ToastTitle({ className, ...props }) {
7210
+ return /* @__PURE__ */ jsx(
7211
+ Toast$1.Title,
7212
+ {
7213
+ "data-slot": "toast-title",
7214
+ className: cn("text-sm font-medium", className),
7215
+ ...props
7216
+ }
7217
+ );
7218
+ }
7219
+ function ToastDescription({
7220
+ className,
7221
+ ...props
7222
+ }) {
7223
+ return /* @__PURE__ */ jsx(
7224
+ Toast$1.Description,
7225
+ {
7226
+ "data-slot": "toast-description",
7227
+ className: cn("text-sm text-muted-foreground", className),
7228
+ ...props
7229
+ }
7230
+ );
7231
+ }
7232
+ function ToastAction({
7233
+ className,
7234
+ render = /* @__PURE__ */ jsx(Button, { variant: "outline", size: "sm" }),
7235
+ ...props
7236
+ }) {
7237
+ return /* @__PURE__ */ jsx(
7238
+ Toast$1.Action,
7239
+ {
7240
+ "data-slot": "toast-action",
7241
+ render,
7242
+ className: cn("shrink-0", className),
7243
+ ...props
7244
+ }
7245
+ );
7246
+ }
7247
+ function ToastClose({
7248
+ className,
7249
+ children,
7250
+ render = /* @__PURE__ */ jsx(Button, { variant: "ghost", size: "icon-sm" }),
7251
+ ...props
7252
+ }) {
7253
+ return /* @__PURE__ */ jsx(
7254
+ Toast$1.Close,
7255
+ {
7256
+ "data-slot": "toast-close",
7257
+ "aria-label": "Close toast",
7258
+ render,
7259
+ className: cn(
7260
+ "relative shrink-0 text-muted-foreground after:absolute after:-inset-2 after:content-[''] hover:text-foreground",
7261
+ className
7262
+ ),
7263
+ ...props,
7264
+ children: children ?? /* @__PURE__ */ jsx(XIcon, { "aria-hidden": "true" })
7265
+ }
7266
+ );
7267
+ }
7268
+ function ToastIcon({ type }) {
7269
+ let icon = null;
7270
+ if (type === "success") {
7271
+ icon = /* @__PURE__ */ jsx(CircleCheckIcon, { "aria-hidden": "true" });
7272
+ }
7273
+ if (type === "info") {
7274
+ icon = /* @__PURE__ */ jsx(InfoIcon, { "aria-hidden": "true" });
7275
+ }
7276
+ if (type === "warning") {
7277
+ icon = /* @__PURE__ */ jsx(TriangleAlertIcon, { "aria-hidden": "true" });
7278
+ }
7279
+ if (type === "error") {
7280
+ icon = /* @__PURE__ */ jsx(OctagonXIcon, { className: "text-destructive", "aria-hidden": "true" });
7281
+ }
7282
+ if (type === "loading") {
7283
+ icon = /* @__PURE__ */ jsx(Loader2Icon, { className: "animate-spin", "aria-hidden": "true" });
7284
+ }
7285
+ if (!icon) {
7286
+ return null;
7287
+ }
7288
+ return /* @__PURE__ */ jsx(
7289
+ "span",
7290
+ {
7291
+ "data-slot": "toast-icon",
7292
+ className: "shrink-0 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4",
7293
+ children: icon
7294
+ }
7295
+ );
7296
+ }
7297
+ function ToastList() {
7298
+ const { toasts } = Toast$1.useToastManager();
7299
+ return toasts.map((toastItem) => /* @__PURE__ */ jsx(Toast, { toast: toastItem, children: /* @__PURE__ */ jsxs(ToastContent, { children: [
7300
+ /* @__PURE__ */ jsxs("div", { className: "flex min-w-0 flex-1 flex-col gap-1", children: [
7301
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1.5", children: [
7302
+ /* @__PURE__ */ jsx(ToastIcon, { type: toastItem.type }),
7303
+ /* @__PURE__ */ jsx(ToastTitle, {})
7304
+ ] }),
7305
+ /* @__PURE__ */ jsx(ToastDescription, {})
7306
+ ] }),
7307
+ /* @__PURE__ */ jsx(ToastAction, {}),
7308
+ /* @__PURE__ */ jsx(ToastClose, {})
7309
+ ] }) }, toastItem.id));
7310
+ }
7311
+ function Toaster({
7312
+ children,
7313
+ toastManager = toast,
7314
+ ...props
7315
+ }) {
7316
+ return /* @__PURE__ */ jsxs(ToastProvider, { toastManager, ...props, children: [
7317
+ children,
7318
+ /* @__PURE__ */ jsx(ToastPortal, { children: /* @__PURE__ */ jsx(ToastViewport, { children: /* @__PURE__ */ jsx(ToastList, {}) }) })
7319
+ ] });
7320
+ }
7321
+ Toast$1.createToastManager;
7322
+ Toast$1.useToastManager;
7323
+
7324
+ // src/utils/formatAddress.ts
7325
+ function formatAddress(address) {
7326
+ return `${address.slice(0, 6)}...${address.slice(-4)}`;
7327
+ }
7328
+
7329
+ // src/utils/copyAddress.ts
7330
+ async function copyAddressToClipboard(address) {
7331
+ try {
7332
+ await navigator.clipboard.writeText(address);
7333
+ toast.add({
7334
+ type: "success",
7335
+ title: "Address copied",
7336
+ description: formatAddress(address)
7337
+ });
7338
+ } catch (error) {
7339
+ debugWarn("[fluent connect] Failed to copy address", error);
7340
+ toast.add({
7341
+ type: "error",
7342
+ title: "Copy failed",
7343
+ description: "Could not copy address to clipboard."
7344
+ });
7345
+ }
7346
+ }
7347
+
7348
+ // src/utils/createLocalFluentSession.ts
7349
+ function createLocalFluentSession(params) {
7350
+ const issuedAt = Math.floor(Date.now() / 1e3);
7351
+ const payload = {
7352
+ iss: typeof location !== "undefined" ? location.origin : "fluent-local",
7353
+ aud: params.partnerId,
7354
+ sub: params.userId,
7355
+ app: params.app,
7356
+ scopes: params.scopes,
7357
+ iat: issuedAt
7358
+ };
7359
+ return {
7360
+ app: params.app,
7361
+ partnerId: params.partnerId,
7362
+ idToken: `mock.${btoa(JSON.stringify(payload))}.signature`,
7363
+ user: {
7364
+ id: params.userId,
7365
+ email: params.email
7366
+ },
7367
+ wallet: {
7368
+ signerAddress: params.signerAddress,
7369
+ smartAccountAddress: params.smartAccountAddress
7370
+ },
7371
+ scopes: params.scopes,
7372
+ issuedAt,
7373
+ metadata: {
7374
+ authMode: "direct",
7375
+ origin: params.app.origin
7376
+ }
7377
+ };
7378
+ }
7379
+
7380
+ // src/utils/explorerAddress.ts
7381
+ function explorerAddress(address, network) {
7382
+ const baseUrl = getFluentExplorerBaseUrl(network ?? "testnet");
7383
+ return `${baseUrl}/address/${address}`;
7384
+ }
7385
+
7386
+ // src/utils/faucetToast.ts
7387
+ function normalize(value) {
7388
+ return (value ?? "").trim().toLowerCase();
7389
+ }
7390
+ function isAlreadyClaimed(status, message) {
7391
+ const statusNorm = normalize(status);
7392
+ const messageNorm = normalize(message);
7393
+ return statusNorm.includes("already") || messageNorm.includes("already");
7394
+ }
7395
+ function toastFaucetSuccess(receipt) {
7396
+ if (isAlreadyClaimed(receipt.status, receipt.message)) {
7397
+ toast.add({
7398
+ type: "info",
7399
+ title: "Already claimed",
7400
+ description: receipt.message || "BLEND faucet was already claimed for this account."
7401
+ });
7402
+ return;
7403
+ }
7404
+ toast.add({
7405
+ type: "success",
7406
+ title: "Faucet claimed",
7407
+ description: receipt.message || (receipt.txHash ? `Transaction ${receipt.txHash}` : "BLEND was sent to your wallet.")
7408
+ });
7409
+ }
7410
+ function toastFaucetError(error) {
7411
+ if (error instanceof HttpError) {
7412
+ if (isAlreadyClaimed(error.body?.status, error.message) || error.status === 409) {
7413
+ toast.add({
7414
+ type: "info",
7415
+ title: "Already claimed",
7416
+ description: error.message || "BLEND faucet was already claimed for this account."
7417
+ });
7418
+ return;
7419
+ }
7420
+ if (error.status === 429) {
7421
+ toast.add({
7422
+ type: "warning",
7423
+ title: "Too many requests",
7424
+ description: error.message || "Please wait a moment and try again."
7425
+ });
7426
+ return;
7427
+ }
7428
+ toast.add({
7429
+ type: "error",
7430
+ title: "Faucet request failed",
7431
+ description: error.message || `Request failed with ${error.status}`
7432
+ });
7433
+ return;
7434
+ }
7435
+ toast.add({
7436
+ type: "error",
7437
+ title: "Faucet request failed",
7438
+ description: error instanceof Error ? error.message : "Something went wrong."
7439
+ });
7440
+ }
7441
+
7442
+ // src/utils/formatExternalWallet.ts
7443
+ function formatExternalWallet(wallet, status) {
7444
+ return JSON.stringify(
7445
+ {
7446
+ status: status ?? "Waiting for wallet connection",
7447
+ wallet: wallet ? {
7448
+ provider: "Reown AppKit",
7449
+ configured: wallet.configured,
7450
+ connected: wallet.connected,
7451
+ address: wallet.address,
7452
+ chainId: wallet.chainId
7453
+ } : null,
7454
+ walletConnectEnabled: Boolean(wallet?.configured)
7455
+ },
7456
+ null,
7457
+ 2
7458
+ );
7459
+ }
7460
+
7461
+ // src/utils/formatFluentLocaleAmount.ts
7462
+ var FLUENT_AMOUNT_LOCALE = "en-US";
7463
+ var FLUENT_DECIMAL_SEPARATOR = new Intl.NumberFormat(FLUENT_AMOUNT_LOCALE).formatToParts(1.1).find((part) => part.type === "decimal")?.value ?? ".";
7464
+ function formatFluentLocaleAmount(value, maximumFractionDigits = 2) {
7465
+ const amount = typeof value === "number" ? value : Number(value);
7466
+ if (!Number.isFinite(amount)) return typeof value === "string" ? value : String(value);
7467
+ return amount.toLocaleString(FLUENT_AMOUNT_LOCALE, {
7468
+ minimumFractionDigits: 0,
7469
+ maximumFractionDigits
7470
+ });
7471
+ }
7472
+
7473
+ // src/utils/formatFluentGasTokenBalance.ts
7474
+ var GAS_BALANCE_MAX_FRACTION_DIGITS = 6;
7475
+ function roundToFractionDigits(raw, decimals, digits) {
7476
+ const discardedScale = 10n ** BigInt(decimals - digits);
7477
+ return (raw + discardedScale / 2n) / discardedScale;
7478
+ }
7479
+ function formatFluentGasTokenBalance(balance, maximumFractionDigits = 1) {
7480
+ if (balance.raw === null || balance.formatted === null) return null;
7481
+ if (maximumFractionDigits < 0 || !Number.isInteger(maximumFractionDigits)) {
7482
+ throw new Error("maximumFractionDigits must be a non-negative integer");
7483
+ }
7484
+ if (balance.decimals <= maximumFractionDigits) {
7485
+ return formatFluentLocaleAmount(balance.formatted, maximumFractionDigits);
7486
+ }
7487
+ const maxDigits = Math.max(
7488
+ maximumFractionDigits,
7489
+ Math.min(balance.decimals, GAS_BALANCE_MAX_FRACTION_DIGITS)
7490
+ );
7491
+ for (let digits = maximumFractionDigits; digits <= maxDigits; digits += 1) {
7492
+ const rounded = roundToFractionDigits(balance.raw, balance.decimals, digits);
7493
+ if (rounded > 0n || balance.raw === 0n) {
7494
+ return formatFluentLocaleAmount(formatUnits(rounded, digits), digits);
7495
+ }
7496
+ }
7497
+ return formatFluentLocaleAmount(0, maximumFractionDigits);
7498
+ }
7499
+
7500
+ // src/utils/formatSession.ts
7501
+ function formatSession(session) {
7502
+ if (!session) return "Waiting for Fluent login";
7503
+ return JSON.stringify(
7504
+ {
7505
+ app: {
7506
+ mode: session.app.mode,
7507
+ origin: session.app.origin,
7508
+ installationId: session.app.installationId,
7509
+ clientId: session.app.clientId,
7510
+ appName: session.app.appName
7511
+ },
7512
+ user: session.user,
7513
+ wallet: {
7514
+ smartAccountAddress: session.wallet.smartAccountAddress
7515
+ },
7516
+ scopes: session.scopes,
7517
+ issuedAt: session.issuedAt,
7518
+ idToken: session.idToken
7519
+ },
7520
+ null,
7521
+ 2
7522
+ );
7523
+ }
7524
+
7525
+ // src/utils/getAnonymousId.ts
7526
+ function getAnonymousId() {
7527
+ const storageKey = "fluent_demo_visitor_id";
7528
+ const existing = localStorage.getItem(storageKey);
7529
+ if (existing) return existing;
7530
+ const next = crypto.randomUUID?.() ?? `visitor_${Date.now()}_${Math.random().toString(16).slice(2)}`;
7531
+ localStorage.setItem(storageKey, next);
7532
+ return next;
7533
+ }
7534
+
7535
+ // src/utils/getHighResTwitterAvatar.ts
7536
+ function getHighResTwitterAvatar(url) {
7537
+ if (!url) return "";
7538
+ return url.replace("_normal", "");
7539
+ }
7540
+
7541
+ // src/utils/hasStoredWidgetSession.ts
7542
+ function hasStoredWidgetSession(storage = globalThis.window?.localStorage) {
6645
7543
  if (!storage) return false;
6646
7544
  try {
6647
7545
  return Boolean(storage.getItem(FLUENT_WIDGET_SESSION_STORAGE_KEY));
@@ -6651,16 +7549,23 @@ function hasStoredWidgetSession(storage = globalThis.window?.localStorage) {
6651
7549
  }
6652
7550
  var REOWN_PROJECT_ID = FLUENT_CONNECT_REOWN_PROJECT_ID;
6653
7551
  var queryClient = new QueryClient();
6654
- var appKitByChainId = /* @__PURE__ */ new Map();
7552
+ var appKitByKey = /* @__PURE__ */ new Map();
6655
7553
  var reownConfigured = Boolean(REOWN_PROJECT_ID);
6656
- function getReownWagmiAdapter(chain) {
6657
- const existing = appKitByChainId.get(chain.id);
7554
+ function getReownWagmiAdapter(chain, disableAnalytics) {
7555
+ const key = `${chain.id}:${disableAnalytics ? "no-analytics" : "analytics"}`;
7556
+ const existing = appKitByKey.get(key);
6658
7557
  if (existing) return existing;
6659
7558
  const adapter = new WagmiAdapter({
6660
7559
  networks: [chain],
6661
- projectId: REOWN_PROJECT_ID
7560
+ projectId: REOWN_PROJECT_ID,
7561
+ ...disableAnalytics ? {
7562
+ connectors: [
7563
+ coinbaseWallet({ preference: { options: "all", telemetry: false } }),
7564
+ baseAccount({ preference: { telemetry: false } })
7565
+ ]
7566
+ } : {}
6662
7567
  });
6663
- appKitByChainId.set(chain.id, adapter);
7568
+ appKitByKey.set(key, adapter);
6664
7569
  if (typeof window !== "undefined") {
6665
7570
  createAppKit({
6666
7571
  adapters: [adapter],
@@ -6683,8 +7588,9 @@ function getReownWagmiAdapter(chain) {
6683
7588
  }
6684
7589
  ],
6685
7590
  enableEIP6963: true,
6686
- enableCoinbase: true,
7591
+ enableCoinbase: !disableAnalytics,
6687
7592
  enableWalletConnect: true,
7593
+ features: { analytics: !disableAnalytics },
6688
7594
  themeMode: "dark",
6689
7595
  themeVariables: {
6690
7596
  "--w3m-accent": "#49EDED",
@@ -6696,16 +7602,20 @@ function getReownWagmiAdapter(chain) {
6696
7602
  }
6697
7603
  function ReownProvider({
6698
7604
  children,
6699
- network = "testnet"
7605
+ network = "testnet",
7606
+ disableAnalytics = false
6700
7607
  }) {
6701
7608
  const chain = useMemo(() => getFluentChainForNetwork(network), [network]);
6702
- const wagmiAdapter = useMemo(() => getReownWagmiAdapter(chain), [chain]);
7609
+ const wagmiAdapter = useMemo(
7610
+ () => getReownWagmiAdapter(chain, disableAnalytics),
7611
+ [chain, disableAnalytics]
7612
+ );
6703
7613
  if (!wagmiAdapter) return /* @__PURE__ */ jsx(Fragment, { children });
6704
7614
  return /* @__PURE__ */ jsx(WagmiProvider, { config: wagmiAdapter.wagmiConfig, children: /* @__PURE__ */ jsx(QueryClientProvider, { client: queryClient, children }) });
6705
7615
  }
6706
7616
  function useReownWallet() {
6707
7617
  const { open } = useAppKit();
6708
- const { address, chainId, isConnected } = useAccount();
7618
+ const { address, chainId, isConnected, status } = useAccount();
6709
7619
  const { disconnect } = useDisconnect();
6710
7620
  const { data: walletClient } = useWalletClient();
6711
7621
  const { switchChainAsync } = useSwitchChain();
@@ -6723,67 +7633,29 @@ function useReownWallet() {
6723
7633
  address,
6724
7634
  chainId,
6725
7635
  walletClient,
7636
+ reconnecting: status === "reconnecting",
6726
7637
  open: openWallet,
6727
7638
  disconnect,
6728
7639
  switchChain
6729
7640
  }),
6730
- [isConnected, address, chainId, walletClient, openWallet, disconnect, switchChain]
7641
+ [isConnected, address, chainId, walletClient, status, openWallet, disconnect, switchChain]
6731
7642
  );
6732
7643
  }
6733
- function cn(...inputs) {
6734
- return twMerge(clsx(inputs));
6735
- }
6736
- var buttonVariants = cva(
6737
- "group/button inline-flex shrink-0 items-center justify-center rounded-xl border border-transparent bg-clip-padding font-medium whitespace-nowrap transition-all duration-75 outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 active:not-aria-[haspopup]:translate-y-px disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
6738
- {
6739
- variants: {
6740
- variant: {
6741
- default: "bg-primary text-primary-foreground hover:bg-primary/80",
6742
- outline: "border-border bg-background hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50",
6743
- secondary: "bg-primary/10 text-secondary-foreground hover:bg-primary/15 aria-expanded:bg-primary/10 aria-expanded:text-secondary-foreground",
6744
- ghost: "hover:bg-primary/10 hover:text-foreground dark:hover:bg-primary/10",
6745
- destructive: "bg-destructive/10 text-destructive hover:bg-destructive/20 focus-visible:border-destructive/40 focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:hover:bg-destructive/30 dark:focus-visible:ring-destructive/40",
6746
- link: "text-primary underline-offset-4 hover:underline"
6747
- },
6748
- size: {
6749
- default: "h-10 gap-1.5 px-3.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2 text-sm",
6750
- xs: "h-6 gap-1 rounded-[min(var(--radius-md),10px)] px-2 text-xs in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3",
6751
- sm: "h-7 gap-1 rounded-[min(var(--radius-md),12px)] px-2.5 text-[0.8rem] in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3.5",
6752
- lg: "h-9 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",
6753
- icon: "size-8",
6754
- "icon-xs": "size-6 rounded-[min(var(--radius-md),10px)] in-data-[slot=button-group]:rounded-lg [&_svg:not([class*='size-'])]:size-3",
6755
- "icon-sm": "size-7 rounded-[min(var(--radius-md),12px)] in-data-[slot=button-group]:rounded-lg",
6756
- "icon-lg": "size-9"
6757
- }
6758
- },
6759
- defaultVariants: {
6760
- variant: "default",
6761
- size: "default"
6762
- }
6763
- }
6764
- );
6765
- var Button = forwardRef(function Button2({ className, variant = "default", size = "default", href, target, rel, render, ...props }, ref) {
6766
- const isLink = href !== void 0;
6767
- return /* @__PURE__ */ jsx(
6768
- Button$1,
6769
- {
6770
- ref,
6771
- "data-slot": "button",
6772
- nativeButton: isLink ? false : void 0,
6773
- className: cn(buttonVariants({ variant, size, className })),
6774
- render: isLink ? /* @__PURE__ */ jsx("a", { href, target, rel }) : render,
6775
- ...props
6776
- }
6777
- );
6778
- });
6779
7644
  function Dialog({ ...props }) {
6780
7645
  return /* @__PURE__ */ jsx(Dialog$1.Root, { "data-slot": "dialog", ...props });
6781
7646
  }
6782
7647
  function DialogTrigger({ ...props }) {
6783
7648
  return /* @__PURE__ */ jsx(Dialog$1.Trigger, { "data-slot": "dialog-trigger", ...props });
6784
7649
  }
6785
- function DialogPortal({ ...props }) {
6786
- return /* @__PURE__ */ jsx(Dialog$1.Portal, { "data-slot": "dialog-portal", ...props });
7650
+ function DialogPortal({ container, ...props }) {
7651
+ return /* @__PURE__ */ jsx(
7652
+ Dialog$1.Portal,
7653
+ {
7654
+ "data-slot": "dialog-portal",
7655
+ container: useFluentPortalContainer(container),
7656
+ ...props
7657
+ }
7658
+ );
6787
7659
  }
6788
7660
  function DialogClose({ ...props }) {
6789
7661
  return /* @__PURE__ */ jsx(Dialog$1.Close, { "data-slot": "dialog-close", ...props });
@@ -6907,10 +7779,6 @@ function DialogDescription({
6907
7779
  }
6908
7780
  );
6909
7781
  }
6910
-
6911
- // src/assets/token-icon-urls.ts
6912
- var USDT_ICON_DATA_URL = "data:image/png;base64,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";
6913
- var USDC_ICON_DATA_URL = "data:image/png;base64,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";
6914
7782
  var icons = {
6915
7783
  x: (props) => /* @__PURE__ */ jsx("svg", { viewBox: "0 0 24 24", fill: "currentColor", xmlns: "http://www.w3.org/2000/svg", ...props, children: /* @__PURE__ */ jsx("path", { d: "M10.4883 14.651L15.25 21H22.25L14.3917 10.5223L20.9308 3H18.2808L13.1643 8.88578L8.75 3H1.75L9.26086 13.0145L2.31915 21H4.96917L10.4883 14.651ZM16.25 19L5.75 5H7.75L18.25 19H16.25Z" }) }),
6916
7784
  "arrow-right-s-line": (props) => /* @__PURE__ */ jsx("svg", { viewBox: "0 0 24 24", fill: "currentColor", xmlns: "http://www.w3.org/2000/svg", ...props, children: /* @__PURE__ */ jsx("path", { d: "M13.1717 12.0007L8.22192 7.05093L9.63614 5.63672L16.0001 12.0007L9.63614 18.3646L8.22192 16.9504L13.1717 12.0007Z" }) }),
@@ -6926,8 +7794,6 @@ var icons = {
6926
7794
  /* @__PURE__ */ jsx("path", { d: "m11.944 15.349 6.722-3.937-6.722-3.003v6.94z", opacity: "0.2" }),
6927
7795
  /* @__PURE__ */ jsx("path", { d: "m5.222 11.412 6.722 3.937v-6.94l-6.722 3.003z", opacity: "0.6" })
6928
7796
  ] }),
6929
- usdc: ({ className }) => /* @__PURE__ */ jsx("img", { src: USDC_ICON_DATA_URL, alt: "", "aria-hidden": "true", className: cn(className) }),
6930
- usdt: ({ className }) => /* @__PURE__ */ jsx("img", { src: USDT_ICON_DATA_URL, alt: "", "aria-hidden": "true", className: cn(className) }),
6931
7797
  usdnr: (props) => /* @__PURE__ */ jsxs("svg", { viewBox: "0 0 75 75", fill: "currentColor", xmlns: "http://www.w3.org/2000/svg", ...props, children: [
6932
7798
  /* @__PURE__ */ jsx("path", { d: "M36.8,58.23c-.18-.12-.36-.24-.53-.36l-.34-.24-1.38,17.22,.23,.03c.34,.04,.68,.08,1.02,.1l.25,.02,.89-16.69-.12-.08Zm2.73,1.55c-.14-.07-.29-.14-.43-.21l-.37-.19,.86,15.63,.25-.02c.31-.03,.62-.06,.93-.1l.23-.03-1.2-14.95-.13-.06-.14-.07Zm-5.17-3.37c-.16-.14-.32-.28-.48-.42l-.31-.28-3.94,17.99,.21,.07c.35,.12,.7,.23,1.05,.33l.25,.07,3.33-17.67-.11-.09Zm8.46,4.67c-.15-.05-.29-.09-.44-.14l-.39-.13,2.57,13.32,.25-.07c.27-.08,.54-.16,.81-.25l.21-.07-2.72-12.56-.14-.04-.15-.05Zm3.68,.85c-.15-.02-.29-.05-.44-.07l-.4-.07,3.56,10.49,.25-.13c.22-.12,.44-.24,.66-.36l.18-.1-3.52-9.71-.14-.02-.15-.02Zm-15.82-9.4c-.13-.16-.25-.33-.37-.5l-.23-.31-9,16.93,.14,.13c.31,.28,.63,.55,.95,.81l.23,.19,8.36-17.13-.09-.12Zm19.96,9.67c-.18,0-.68,0-.87,0h-.41s4.02,7.36,4.02,7.36l.22-.18c.17-.14,.34-.28,.5-.43l.14-.13-3.47-6.62h-.15Zm-21.28-11.59c-.11-.17-.21-.35-.31-.52l-.19-.32-11.05,15.3,.11,.14c.26,.34,.53,.68,.81,1.02l.21,.24,10.5-15.73-.08-.13Zm28.05,14.86l.11-.14-2.55-3.59-.15,.03c-.17,.03-.33,.06-.5,.09l-.37,.06,2.9,4.24,.2-.25c.12-.15,.24-.29,.35-.44Zm-29.11-16.75c-.09-.18-.18-.36-.27-.55l-.15-.32-12.54,13.16,.07,.15c.2,.4,.41,.8,.63,1.19l.17,.3,12.16-13.79-.07-.15Zm31.71,12.66l-.82-.89-.15,.06c-.14,.05-.28,.11-.42,.16l-.48,.19,1.23,1.63c.08-.14,.58-1.01,.65-1.15Zm-32.54-14.53c-.07-.19-.15-.37-.22-.56l-.12-.31-13.39,10.73,.04,.15c.12,.44,.26,.89,.41,1.32l.11,.34,13.23-11.51-.06-.16Zm-.64-1.8c-.06-.19-.11-.38-.17-.57l-.09-.3-13.61,8.15v.15c.06,.47,.11,.93,.18,1.39l.06,.37,13.68-9.02-.05-.17Zm-.46-1.72c-.04-.19-.09-.38-.13-.57l-.06-.29-13.22,5.63v.15c-.05,.47-.07,.93-.08,1.4v.39s13.53-6.51,13.53-6.51l-.04-.19Zm-.33-1.67c-.03-.2-.06-.39-.09-.59l-.04-.27-12.3,3.35-.03,.14c-.11,.45-.21,.91-.29,1.36l-.07,.4,12.86-4.17-.03-.2Zm-.21-1.65c-.02-.21-.04-.41-.05-.62l-.02-.26-10.98,1.43-.05,.13c-.17,.42-.34,.85-.49,1.28l-.14,.39,11.73-2.13-.02-.22Zm-.04-3.95l.02-.22-7.59-1.08-.09,.11c-.27,.34-.52,.68-.76,1.03l-.24,.34,8.62,.75v-.25c.02-.22,.03-.45,.05-.67Zm.18-1.68l.03-.21-5.79-1.65-.1,.1c-.29,.29-.57,.59-.84,.89l-.28,.31,6.87,1.53,.03-.27c.03-.24,.05-.47,.09-.71Zm.3-1.7l.04-.19-4.07-1.78-.11,.09c-.3,.24-.6,.5-.89,.75l-.3,.27,5.13,1.89,.05-.28c.04-.25,.09-.5,.15-.75Zm.44-1.73l.05-.18-2.49-1.53-.13,.08c-.31,.2-.61,.41-.91,.63l-.31,.23,3.5,1.86,.07-.3c.07-.27,.14-.53,.22-.79Zm.6-1.79l.06-.16-1.11-.91-.14,.07c-.31,.17-.62,.34-.93,.52l-.32,.19,2.03,1.46,.1-.31c.1-.29,.2-.57,.3-.86Zm.38-.95c.06-.14,.12-.29,.19-.43l.26-.58-.58,.26c-.15,.07-.29,.13-.44,.2l-.32,.15,.76,.71,.13-.32Zm-1.95,10.17c0-.22,0-.43,0-.65v-.24l-9.36-.06-.07,.12s-.01,.02-.02,.03c0,.01-.02,.03-.05,.09h0c-.2,.35-.39,.69-.57,1.04l-.19,.37,10.28-.48v-.24Zm6.16,15.65c.14,.16,.28,.31,.43,.47l.1,.1-5.89,17.81-.25-.13c-.35-.18-.69-.37-1.03-.57l-.17-.1,6.56-17.88,.27,.3Z" }),
6933
7799
  /* @__PURE__ */ jsx("path", { d: "M58.26,38.26c-.12,.18-.24,.36-.36,.53l-.24,.34,17.19,1.39,.03-.23c.04-.34,.08-.68,.1-1.02l.02-.25-16.67-.89-.08,.12Zm1.54-2.74c-.07,.14-.14,.29-.21,.43l-.19,.37,15.6-.86-.02-.25c-.03-.31-.06-.62-.1-.93l-.03-.23-14.92,1.2-.06,.13-.07,.14Zm-3.36,5.18c-.14,.16-.28,.32-.42,.49l-.28,.31,17.96,3.95,.07-.21c.12-.35,.23-.7,.33-1.06l.07-.25-17.64-3.33-.09,.11Zm4.66-8.48c-.05,.15-.09,.3-.14,.44l-.13,.39,13.3-2.57-.07-.25c-.08-.27-.16-.54-.25-.81l-.07-.21-12.54,2.72-.04,.14-.05,.15Zm.85-3.69c-.02,.15-.05,.29-.07,.44l-.07,.4,10.47-3.56-.13-.25c-.12-.22-.24-.44-.36-.66l-.1-.18-9.7,3.52-.02,.14-.02,.15Zm-9.39,15.85c-.16,.13-.33,.25-.5,.37l-.31,.23,16.91,9.01,.13-.14c.28-.31,.55-.63,.81-.95l.19-.24-17.1-8.37-.12,.09Zm9.65-19.99c0,.18,0,.68,0,.87v.41s7.35-4.03,7.35-4.03l-.18-.22c-.14-.17-.28-.34-.43-.5l-.12-.14-6.61,3.47v.15Zm-11.57,21.32c-.17,.11-.35,.21-.52,.31l-.32,.19,15.28,11.07,.14-.11c.34-.26,.68-.53,1.02-.82l.24-.21-15.7-10.52-.13,.08Zm14.83-28.1l-.14-.11-3.59,2.55,.03,.15c.03,.17,.06,.34,.09,.5l.06,.37,4.23-2.91-.25-.2c-.15-.12-.29-.24-.44-.35Zm-16.73,29.16c-.18,.09-.36,.18-.54,.27l-.32,.15,13.14,12.56,.15-.07c.4-.2,.8-.41,1.19-.63l.3-.17-13.77-12.18-.15,.07Zm12.64-31.76l-.88,.82,.06,.15c.05,.14,.11,.28,.16,.42l.19,.49,1.62-1.24c-.14-.08-1.01-.58-1.15-.65Zm-14.5,32.6c-.19,.07-.37,.15-.56,.22l-.31,.12,10.71,13.42,.15-.04c.44-.12,.88-.26,1.32-.41l.34-.12-11.49-13.25-.16,.06Zm-1.79,.64c-.19,.06-.38,.11-.57,.17l-.3,.09,8.13,13.63h.15c.46-.06,.93-.11,1.39-.18l.37-.06-9.01-13.7-.17,.05Zm-1.72,.47c-.19,.04-.38,.09-.57,.13l-.29,.06,5.62,13.24h.15c.47,.05,.93,.07,1.4,.08h.39s-6.5-13.55-6.5-13.55l-.19,.04Zm-1.67,.33c-.2,.03-.39,.06-.59,.09l-.27,.04,3.34,12.32,.14,.03c.45,.11,.9,.21,1.36,.29l.4,.07-4.17-12.88-.2,.03Zm-1.64,.21c-.21,.02-.41,.04-.61,.05l-.26,.02,1.43,10.99,.13,.05c.42,.17,.85,.34,1.28,.49l.39,.14-2.13-11.75-.22,.02Zm-3.95,.04l-.22-.02-1.08,7.6,.11,.09c.34,.27,.68,.52,1.03,.77l.34,.24,.75-8.63h-.25c-.22-.02-.45-.03-.67-.05Zm-1.68-.18l-.21-.03-1.64,5.8,.1,.1c.29,.29,.59,.57,.89,.85l.31,.28,1.53-6.88-.27-.03c-.24-.03-.47-.05-.71-.09Zm-1.69-.3l-.19-.04-1.78,4.08,.09,.11c.24,.3,.49,.6,.75,.89l.27,.3,1.89-5.14-.28-.05c-.25-.04-.5-.09-.74-.15Zm-1.73-.44l-.18-.05-1.53,2.49,.08,.13c.2,.31,.41,.61,.63,.91l.23,.31,1.86-3.51-.3-.07c-.27-.07-.53-.14-.79-.22Zm-1.79-.6l-.16-.06-.91,1.11,.07,.14c.17,.31,.34,.62,.52,.93l.19,.32,1.45-2.03-.31-.1c-.29-.1-.57-.2-.85-.31Zm-.95-.38c-.14-.06-.29-.12-.43-.19l-.58-.26,.26,.58c.07,.15,.13,.29,.2,.44l.15,.32,.71-.76-.32-.13Zm10.15,1.95c-.22,0-.43,0-.65,0h-.24l-.06,9.37,.12,.07s.02,.01,.03,.02c.01,0,.03,.02,.09,.05h0c.34,.2,.69,.39,1.04,.57l.37,.19-.48-10.29h-.23Zm15.63-6.17c.16-.14,.31-.28,.47-.43l.1-.1,17.78,5.9-.13,.25c-.18,.35-.37,.69-.57,1.04l-.1,.18-17.85-6.57,.3-.27Z" }),
@@ -7122,25 +7988,6 @@ function ConnectChoiceModal({
7122
7988
  }
7123
7989
  );
7124
7990
  }
7125
-
7126
- // src/utils/buildFluentBridgeUrl.ts
7127
- function buildFluentBridgeUrl(bridgeUrl, recipient) {
7128
- if (!recipient) return bridgeUrl;
7129
- try {
7130
- const url = new URL(bridgeUrl);
7131
- url.searchParams.set("recipient", recipient);
7132
- return url.toString();
7133
- } catch {
7134
- const join = bridgeUrl.includes("?") ? "&" : "?";
7135
- return `${bridgeUrl}${join}recipient=${encodeURIComponent(recipient)}`;
7136
- }
7137
- }
7138
-
7139
- // src/utils/explorerAddress.ts
7140
- function explorerAddress(address, network) {
7141
- const baseUrl = getFluentExplorerBaseUrl(network ?? "testnet");
7142
- return `${baseUrl}/address/${address}`;
7143
- }
7144
7991
  function Label({ className, ...props }) {
7145
7992
  return /* @__PURE__ */ jsx(
7146
7993
  "label",
@@ -7323,7 +8170,7 @@ function SelectContent({
7323
8170
  alignItemWithTrigger = true,
7324
8171
  ...props
7325
8172
  }) {
7326
- return /* @__PURE__ */ jsx(Select$1.Portal, { children: /* @__PURE__ */ jsx(
8173
+ return /* @__PURE__ */ jsx(Select$1.Portal, { container: useFluentPortalContainer(), children: /* @__PURE__ */ jsx(
7327
8174
  Select$1.Positioner,
7328
8175
  {
7329
8176
  side,
@@ -7337,7 +8184,7 @@ function SelectContent({
7337
8184
  {
7338
8185
  "data-slot": "select-content",
7339
8186
  "data-align-trigger": alignItemWithTrigger,
7340
- className: cn("dark relative isolate z-50 max-h-(--available-height) w-(--anchor-width) min-w-36 origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-xl bg-popover p-1 border border-white/15 text-popover-foreground shadow-xl duration-100 data-[align-trigger=true]:animate-none data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95", className),
8187
+ className: cn("dark relative isolate z-50 max-h-(--available-height) w-(--anchor-width) min-w-36 origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-xl bg-popover p-1 border border-foreground/15 text-popover-foreground shadow-xl duration-100 data-[align-trigger=true]:animate-none data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95", className),
7341
8188
  ...props,
7342
8189
  children: [
7343
8190
  /* @__PURE__ */ jsx(SelectScrollUpButton, {}),
@@ -7359,7 +8206,7 @@ function SelectItem({
7359
8206
  {
7360
8207
  "data-slot": "select-item",
7361
8208
  className: cn(
7362
- "relative flex w-full cursor-default items-center gap-2 rounded-lg py-2 pr-8 pl-2.5 text-sm outline-hidden select-none focus:bg-white/10 focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",
8209
+ "relative flex w-full cursor-default items-center gap-2 rounded-lg py-2 pr-8 pl-2.5 text-sm outline-hidden select-none focus:bg-foreground/10 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",
7363
8210
  className
7364
8211
  ),
7365
8212
  ...props,
@@ -7376,6 +8223,19 @@ function SelectItem({
7376
8223
  }
7377
8224
  );
7378
8225
  }
8226
+ function SelectSeparator({
8227
+ className,
8228
+ ...props
8229
+ }) {
8230
+ return /* @__PURE__ */ jsx(
8231
+ Select$1.Separator,
8232
+ {
8233
+ "data-slot": "select-separator",
8234
+ className: cn("pointer-events-none -mx-1 my-1 h-px bg-border", className),
8235
+ ...props
8236
+ }
8237
+ );
8238
+ }
7379
8239
  function SelectScrollUpButton({
7380
8240
  className,
7381
8241
  ...props
@@ -7416,6 +8276,18 @@ function SelectScrollDownButton({
7416
8276
  }
7417
8277
  );
7418
8278
  }
8279
+ function Spinner({ className, ...props }) {
8280
+ return /* @__PURE__ */ jsx(
8281
+ Loader2Icon,
8282
+ {
8283
+ "data-slot": "spinner",
8284
+ role: "status",
8285
+ "aria-label": "Loading",
8286
+ className: cn("size-4 animate-spin", className),
8287
+ ...props
8288
+ }
8289
+ );
8290
+ }
7419
8291
  function Switch({
7420
8292
  className,
7421
8293
  size = "default",
@@ -7435,7 +8307,7 @@ function Switch({
7435
8307
  Switch$1.Thumb,
7436
8308
  {
7437
8309
  "data-slot": "switch-thumb",
7438
- className: "pointer-events-none block rounded-full bg-background ring-0 transition-transform group-data-[size=default]/switch:size-4 group-data-[size=sm]/switch:size-3 group-data-[size=default]/switch:data-checked:translate-x-[calc(100%-2px)] group-data-[size=sm]/switch:data-checked:translate-x-[calc(100%-2px)] dark:data-checked:bg-primary-foreground group-data-[size=default]/switch:data-unchecked:translate-x-0 group-data-[size=sm]/switch:data-unchecked:translate-x-0 dark:data-unchecked:bg-foreground"
8310
+ className: "pointer-events-none block rounded-full bg-background ring-0 transition-transform group-data-[size=default]/switch:size-4 group-data-[size=sm]/switch:size-3 group-data-[size=default]/switch:data-checked:translate-x-[calc(100%-2px)] group-data-[size=sm]/switch:data-checked:translate-x-[calc(100%-2px)] dark:data-checked:bg-primary-foreground group-data-[size=default]/switch:data-unchecked:translate-x-0 group-data-[size=sm]/switch:data-unchecked:translate-x-0 dark:data-unchecked:bg-primary"
7439
8311
  }
7440
8312
  )
7441
8313
  }
@@ -7460,11 +8332,11 @@ function Tabs({
7460
8332
  );
7461
8333
  }
7462
8334
  var tabsListVariants = cva(
7463
- "group/tabs-list inline-flex w-fit items-center justify-center rounded-xl p-[3px] text-muted-foreground group-data-horizontal/tabs:h-8 group-data-vertical/tabs:h-fit group-data-vertical/tabs:flex-col data-[variant=line]:rounded-none",
8335
+ "group/tabs-list inline-flex w-fit items-center justify-center rounded-xl p-[3px] text-tabs-foreground group-data-horizontal/tabs:h-8 group-data-vertical/tabs:h-fit group-data-vertical/tabs:flex-col data-[variant=line]:rounded-none",
7464
8336
  {
7465
8337
  variants: {
7466
8338
  variant: {
7467
- default: "bg-white/10",
8339
+ default: "bg-tabs",
7468
8340
  line: "gap-1 bg-transparent"
7469
8341
  }
7470
8342
  },
@@ -7494,9 +8366,9 @@ function TabsTrigger({ className, ...props }) {
7494
8366
  {
7495
8367
  "data-slot": "tabs-trigger",
7496
8368
  className: cn(
7497
- "relative inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-lg border border-transparent px-1.5 py-1 text-sm font-medium whitespace-nowrap text-foreground/60 transition-all group-data-vertical/tabs:w-full group-data-vertical/tabs:justify-start hover:text-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1 focus-visible:outline-ring disabled:pointer-events-none disabled:opacity-50 has-data-[icon=inline-end]:pr-1 has-data-[icon=inline-start]:pl-1 aria-disabled:pointer-events-none aria-disabled:opacity-50 dark:text-muted-foreground dark:hover:text-foreground group-data-[variant=default]/tabs-list:data-active:shadow-sm group-data-[variant=line]/tabs-list:data-active:shadow-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
8369
+ "relative inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-lg border border-transparent px-1.5 py-1 text-sm font-medium whitespace-nowrap text-tabs-foreground transition-all group-data-vertical/tabs:w-full group-data-vertical/tabs:justify-start hover:text-tabs-active-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1 focus-visible:outline-ring disabled:pointer-events-none disabled:opacity-50 has-data-[icon=inline-end]:pr-1 has-data-[icon=inline-start]:pl-1 aria-disabled:pointer-events-none aria-disabled:opacity-50 group-data-[variant=default]/tabs-list:data-active:shadow-sm group-data-[variant=line]/tabs-list:data-active:shadow-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
7498
8370
  "group-data-[variant=line]/tabs-list:bg-transparent group-data-[variant=line]/tabs-list:data-active:bg-transparent dark:group-data-[variant=line]/tabs-list:data-active:border-transparent dark:group-data-[variant=line]/tabs-list:data-active:bg-transparent",
7499
- "data-active:bg-background data-active:text-foreground dark:data-active:bg-white/10 dark:data-active:text-foreground",
8371
+ "data-active:bg-tabs-active data-active:text-tabs-active-foreground",
7500
8372
  "after:absolute after:bg-foreground after:opacity-0 after:transition-opacity group-data-horizontal/tabs:after:inset-x-0 group-data-horizontal/tabs:after:bottom-[-5px] group-data-horizontal/tabs:after:h-0.5 group-data-vertical/tabs:after:inset-y-0 group-data-vertical/tabs:after:-right-1 group-data-vertical/tabs:after:w-0.5 group-data-[variant=line]/tabs-list:data-active:after:opacity-100",
7501
8373
  className
7502
8374
  ),
@@ -7517,10 +8389,22 @@ function TabsContent({ className, ...props }) {
7517
8389
  function useFluentTokenBalances(params) {
7518
8390
  const { network, chain } = useFluentWidgetNetwork();
7519
8391
  const defaultTokens = useMemo(
7520
- () => getFluentDefaultWidgetGasTokens(network),
8392
+ () => getFluentDefaultWidgetDisplayTokens(network),
7521
8393
  [network]
7522
8394
  );
7523
- const tokens = params.tokens ?? defaultTokens;
8395
+ const {
8396
+ tokens: userTokens,
8397
+ add: addUserToken,
8398
+ remove: removeUserToken
8399
+ } = useFluentUserTokens({ store: params.userTokenStore });
8400
+ const displayTokens = useMemo(
8401
+ () => mergeFluentDisplayTokens({
8402
+ defaults: defaultTokens,
8403
+ integrator: params.tokens,
8404
+ user: userTokens
8405
+ }),
8406
+ [defaultTokens, params.tokens, userTokens]
8407
+ );
7524
8408
  const publicClient = useMemo(
7525
8409
  () => createPublicClient({
7526
8410
  chain,
@@ -7528,7 +8412,7 @@ function useFluentTokenBalances(params) {
7528
8412
  }),
7529
8413
  [chain]
7530
8414
  );
7531
- const gasTokens = useMemo(() => getFluentGasPaymentTokens(tokens), [tokens]);
8415
+ const gasTokens = useMemo(() => getFluentGasPaymentTokens(displayTokens), [displayTokens]);
7532
8416
  const [balances, setBalances] = useState([]);
7533
8417
  const [busy, setBusy] = useState(false);
7534
8418
  const [status, setStatus] = useState("Connect a Fluent account");
@@ -7544,16 +8428,16 @@ function useFluentTokenBalances(params) {
7544
8428
  return;
7545
8429
  }
7546
8430
  setBusy(true);
7547
- setStatus("Checking gas token balances");
8431
+ setStatus("Checking token balances");
7548
8432
  try {
7549
8433
  const next = await readFluentTokenBalances({
7550
8434
  client: publicClient,
7551
8435
  account: params.accountAddress,
7552
- tokens: gasTokens
8436
+ tokens: displayTokens
7553
8437
  });
7554
8438
  if (signal.aborted) return;
7555
8439
  setBalances(next);
7556
- setStatus("Gas route updated");
8440
+ setStatus("Balances updated");
7557
8441
  } catch {
7558
8442
  if (signal.aborted) return;
7559
8443
  setBalances([]);
@@ -7561,11 +8445,11 @@ function useFluentTokenBalances(params) {
7561
8445
  } finally {
7562
8446
  if (!signal.aborted) setBusy(false);
7563
8447
  }
7564
- }, [gasTokens, params.accountAddress, publicClient]);
8448
+ }, [displayTokens, params.accountAddress, publicClient]);
7565
8449
  useEffect(() => {
7566
8450
  setBalances([]);
7567
8451
  setStatus(
7568
- params.accountAddress ? "Checking gas token balances" : "Connect a Fluent account"
8452
+ params.accountAddress ? "Checking token balances" : "Connect a Fluent account"
7569
8453
  );
7570
8454
  }, [params.accountAddress]);
7571
8455
  useEffect(() => {
@@ -7573,20 +8457,25 @@ function useFluentTokenBalances(params) {
7573
8457
  return () => inFlight.current?.abort();
7574
8458
  }, [refresh, params.revisionCounter]);
7575
8459
  return {
8460
+ /** Balances for every display token, in display order. */
7576
8461
  balances,
7577
8462
  busy,
8463
+ /** The resolved display-token list the balances correspond to. */
8464
+ displayTokens,
8465
+ /** The gas-capable subset, in paymaster priority order. */
7578
8466
  gasTokens,
7579
8467
  refresh,
7580
- status
8468
+ status,
8469
+ addUserToken,
8470
+ removeUserToken
7581
8471
  };
7582
8472
  }
7583
- var fluentDefaultGasTokens = getFluentDefaultWidgetGasTokens("testnet");
7584
8473
  function sumFluentTokenBalancesUsd(balances, usdPrices) {
7585
8474
  let sum = 0;
7586
8475
  let hasPriced = false;
7587
8476
  for (const balance of balances) {
7588
8477
  if (balance.status !== "ready" || balance.formatted === null) continue;
7589
- const price = usdPrices[balance.symbol];
8478
+ const price = usdPrices[fluentTokenIdentity(balance)];
7590
8479
  if (price === void 0) continue;
7591
8480
  const amount = Number(balance.formatted);
7592
8481
  if (!Number.isFinite(amount)) continue;
@@ -7598,7 +8487,7 @@ function sumFluentTokenBalancesUsd(balances, usdPrices) {
7598
8487
  function formatFluentPortfolioTotal(total) {
7599
8488
  const [wholeRaw, fraction = "00"] = total.toFixed(2).split(".");
7600
8489
  const whole = formatFluentLocaleAmount(Number(wholeRaw), 0);
7601
- return { whole, fraction };
8490
+ return { whole, fraction, separator: FLUENT_DECIMAL_SEPARATOR };
7602
8491
  }
7603
8492
  function getFluentPortfolioPnl(params) {
7604
8493
  const { currentTotal, previousTotal } = params;
@@ -7608,9 +8497,9 @@ function getFluentPortfolioPnl(params) {
7608
8497
  return { delta, percent };
7609
8498
  }
7610
8499
  function formatFluentPortfolioPnlAbsolute(delta) {
7611
- const { whole, fraction } = formatFluentPortfolioTotal(Math.abs(delta));
8500
+ const { whole, fraction, separator } = formatFluentPortfolioTotal(Math.abs(delta));
7612
8501
  const sign = delta >= 0 ? "+" : "\u2212";
7613
- return `$ ${sign}${whole},${fraction}`;
8502
+ return `$ ${sign}${whole}${separator}${fraction}`;
7614
8503
  }
7615
8504
  function formatFluentPortfolioPnlPercent(percent) {
7616
8505
  return `${formatFluentLocaleAmount(Math.abs(percent), 2)}%`;
@@ -7619,9 +8508,7 @@ function formatFluentPortfolioPnlPercent(percent) {
7619
8508
  // src/core/tokenPrices.ts
7620
8509
  var COINGECKO_API = "https://api.coingecko.com/api/v3";
7621
8510
  var FIXED_USD_PRICES = {
7622
- USDnr: 1,
7623
- USDC: 1,
7624
- USDT: 1
8511
+ USDnr: 1
7625
8512
  };
7626
8513
  var COINBASE_BASE_BY_SYMBOL = {
7627
8514
  ETH: "ETH",
@@ -7739,17 +8626,33 @@ function splitFluentTokenUsdPricePoints(points) {
7739
8626
  }
7740
8627
  return { prices, prices24hAgo };
7741
8628
  }
8629
+ function getFluentPriceableSymbols(tokens) {
8630
+ return tokens.filter(isFluentDefaultToken).map((token) => token.symbol);
8631
+ }
8632
+ function mapFluentPricesToTokenIdentities(tokens, pricesBySymbol) {
8633
+ const byIdentity = {};
8634
+ for (const token of tokens) {
8635
+ if (!isFluentDefaultToken(token)) continue;
8636
+ const price = pricesBySymbol[token.symbol];
8637
+ if (price === void 0) continue;
8638
+ byIdentity[fluentTokenIdentity(token)] = price;
8639
+ }
8640
+ return byIdentity;
8641
+ }
7742
8642
 
7743
8643
  // src/hooks/useFluentTokenUsdPrices.ts
7744
- function useFluentTokenUsdPrices(symbols) {
7745
- const symbolKey = useMemo(() => [...new Set(symbols)].sort().join(","), [symbols]);
7746
- const [prices, setPrices] = useState({});
7747
- const [pricesYesterday, setPricesYesterday] = useState({});
8644
+ function useFluentTokenUsdPrices(tokens) {
8645
+ const symbolKey = useMemo(
8646
+ () => getFluentPriceableSymbols(tokens).sort().join(","),
8647
+ [tokens]
8648
+ );
8649
+ const [pricesBySymbol, setPricesBySymbol] = useState({});
8650
+ const [pricesBySymbolYesterday, setPricesBySymbolYesterday] = useState({});
7748
8651
  const [busy, setBusy] = useState(() => Boolean(symbolKey));
7749
8652
  useEffect(() => {
7750
8653
  if (!symbolKey) {
7751
- setPrices({});
7752
- setPricesYesterday({});
8654
+ setPricesBySymbol({});
8655
+ setPricesBySymbolYesterday({});
7753
8656
  setBusy(false);
7754
8657
  return;
7755
8658
  }
@@ -7758,326 +8661,395 @@ function useFluentTokenUsdPrices(symbols) {
7758
8661
  fetchFluentTokenUsdPricePoints(symbolKey.split(",")).then((points) => {
7759
8662
  if (!active) return;
7760
8663
  const next = splitFluentTokenUsdPricePoints(points);
7761
- setPrices(next.prices);
7762
- setPricesYesterday(next.prices24hAgo);
8664
+ setPricesBySymbol(next.prices);
8665
+ setPricesBySymbolYesterday(next.prices24hAgo);
7763
8666
  setBusy(false);
7764
8667
  });
7765
8668
  return () => {
7766
8669
  active = false;
7767
8670
  };
7768
8671
  }, [symbolKey]);
7769
- return { prices, pricesYesterday, busy };
7770
- }
7771
- var toast = Toast$1.createToastManager();
7772
- function ToastProvider({ ...props }) {
7773
- return /* @__PURE__ */ jsx(Toast$1.Provider, { ...props });
7774
- }
7775
- function ToastPortal({ ...props }) {
7776
- return /* @__PURE__ */ jsx(Toast$1.Portal, { "data-slot": "toast-portal", ...props });
7777
- }
7778
- function ToastViewport({ className, ...props }) {
7779
- return /* @__PURE__ */ jsx(
7780
- Toast$1.Viewport,
7781
- {
7782
- "data-slot": "toast-viewport",
7783
- className: cn(
7784
- "dark pointer-events-none fixed inset-x-4 bottom-4 z-[100] mx-auto w-[min(100%,368px)] max-w-[368px] text-foreground outline-none sm:right-4 sm:left-auto sm:mx-0",
7785
- className
7786
- ),
7787
- ...props
7788
- }
8672
+ const prices = useMemo(
8673
+ () => mapFluentPricesToTokenIdentities(tokens, pricesBySymbol),
8674
+ [tokens, pricesBySymbol]
7789
8675
  );
7790
- }
7791
- function Toast({ className, style, ...props }) {
7792
- return /* @__PURE__ */ jsx(
7793
- Toast$1.Root,
7794
- {
7795
- "data-slot": "toast",
7796
- style: { maxWidth: 368, ...style },
7797
- className: cn(
7798
- "group/toast pointer-events-auto absolute right-0 bottom-0 z-[calc(1000-var(--toast-index))] w-full max-w-[368px] origin-bottom rounded-2xl border border-white/20 bg-popover text-popover-foreground shadow-lg will-change-transform outline-none select-none focus-visible:border-border focus-visible:ring-[3px] focus-visible:ring-ring/50",
7799
- "[--gap:0.75rem] [--height:var(--toast-frontmost-height,var(--toast-height))] [--offset-y:calc(var(--toast-offset-y)*-1+calc(var(--toast-index)*var(--gap)*-1)+var(--toast-swipe-movement-y))] [--peek:0.75rem] [--scale:calc(max(0,1-(var(--toast-index)*0.1)))] [--shrink:calc(1-var(--scale))]",
7800
- "h-(--height) [transform:translateX(var(--toast-swipe-movement-x))_translateY(calc(var(--toast-swipe-movement-y)-(var(--toast-index)*var(--peek))-(var(--shrink)*var(--height))))_scale(var(--scale))] [transition:transform_500ms_cubic-bezier(0.22,1,0.36,1),opacity_500ms,height_150ms]",
7801
- "after:absolute after:top-full after:left-0 after:h-[calc(var(--gap)+1px)] after:w-full after:content-['']",
7802
- "data-expanded:h-(--toast-height) data-expanded:[transform:translateX(var(--toast-swipe-movement-x))_translateY(var(--offset-y))]",
7803
- "data-limited:opacity-0 data-starting-style:[transform:translateY(150%)]",
7804
- "[&[data-ending-style]:not([data-limited]):not([data-swipe-direction])]:[transform:translateY(150%)]",
7805
- "data-ending-style:data-[swipe-direction=down]:[transform:translateY(calc(var(--toast-swipe-movement-y)+150%))]",
7806
- "data-ending-style:data-[swipe-direction=left]:[transform:translateX(calc(var(--toast-swipe-movement-x)-150%))_translateY(var(--offset-y))]",
7807
- "data-ending-style:data-[swipe-direction=right]:[transform:translateX(calc(var(--toast-swipe-movement-x)+150%))_translateY(var(--offset-y))]",
7808
- "data-ending-style:data-[swipe-direction=up]:[transform:translateY(calc(var(--toast-swipe-movement-y)-150%))]",
7809
- "data-expanded:data-ending-style:data-[swipe-direction=down]:[transform:translateY(calc(var(--toast-swipe-movement-y)+150%))]",
7810
- "data-expanded:data-ending-style:data-[swipe-direction=left]:[transform:translateX(calc(var(--toast-swipe-movement-x)-150%))_translateY(var(--offset-y))]",
7811
- "data-expanded:data-ending-style:data-[swipe-direction=right]:[transform:translateX(calc(var(--toast-swipe-movement-x)+150%))_translateY(var(--offset-y))]",
7812
- "data-expanded:data-ending-style:data-[swipe-direction=up]:[transform:translateY(calc(var(--toast-swipe-movement-y)-150%))]",
7813
- className
7814
- ),
7815
- ...props
7816
- }
8676
+ const pricesYesterday = useMemo(
8677
+ () => mapFluentPricesToTokenIdentities(tokens, pricesBySymbolYesterday),
8678
+ [tokens, pricesBySymbolYesterday]
7817
8679
  );
8680
+ return { prices, pricesYesterday, busy };
7818
8681
  }
7819
- function ToastContent({ className, ...props }) {
7820
- return /* @__PURE__ */ jsx(
7821
- Toast$1.Content,
7822
- {
7823
- "data-slot": "toast-content",
7824
- className: cn(
7825
- "flex h-full items-start gap-3 overflow-hidden p-4 transition-opacity duration-250 ease-[cubic-bezier(0.22,1,0.36,1)] data-behind:opacity-0 data-expanded:opacity-100",
7826
- className
7827
- ),
7828
- ...props
7829
- }
8682
+ function AddTokenForm({
8683
+ existingSymbols,
8684
+ listedIdentities,
8685
+ onAdd,
8686
+ onClose
8687
+ }) {
8688
+ const { chain } = useFluentWidgetNetwork();
8689
+ const [address, setAddress] = useState("");
8690
+ const [lookup, setLookup] = useState({ phase: "idle" });
8691
+ const [addError, setAddError] = useState(null);
8692
+ const publicClient = useMemo(
8693
+ () => createPublicClient({ chain, transport: createFluentRpcTransport(chain) }),
8694
+ [chain]
7830
8695
  );
7831
- }
7832
- function ToastTitle({ className, ...props }) {
7833
- return /* @__PURE__ */ jsx(
7834
- Toast$1.Title,
7835
- {
7836
- "data-slot": "toast-title",
7837
- className: cn("text-sm font-medium", className),
7838
- ...props
8696
+ useEffect(() => {
8697
+ const trimmed = address.trim();
8698
+ if (!trimmed) {
8699
+ setLookup({ phase: "idle" });
8700
+ return;
7839
8701
  }
7840
- );
7841
- }
7842
- function ToastDescription({
7843
- className,
7844
- ...props
7845
- }) {
7846
- return /* @__PURE__ */ jsx(
7847
- Toast$1.Description,
8702
+ if (!isAddress(trimmed)) {
8703
+ setLookup({ phase: "rejected", message: "That is not a contract address." });
8704
+ return;
8705
+ }
8706
+ let cancelled = false;
8707
+ setLookup({ phase: "loading" });
8708
+ void readFluentTokenMetadata({
8709
+ client: publicClient,
8710
+ address: trimmed,
8711
+ chainId: chain.id
8712
+ }).then((result) => {
8713
+ if (cancelled) return;
8714
+ if (result.status === "ok") {
8715
+ setLookup({ phase: "found", token: result.token });
8716
+ return;
8717
+ }
8718
+ setLookup({
8719
+ phase: "rejected",
8720
+ message: result.status === "invalid-address" ? "That is not a contract address." : `No token found at this address. ${result.reason}`
8721
+ });
8722
+ });
8723
+ return () => {
8724
+ cancelled = true;
8725
+ };
8726
+ }, [address, chain.id, publicClient]);
8727
+ const token = lookup.phase === "found" ? lookup.token : null;
8728
+ const collides = token ? existingSymbols.has(token.symbol.toLowerCase()) : false;
8729
+ const alreadyListed = token ? listedIdentities.has(fluentTokenIdentity(token)) : false;
8730
+ const handleAdd = () => {
8731
+ if (!token) return;
8732
+ const result = onAdd(token);
8733
+ switch (result.status) {
8734
+ case "added":
8735
+ onClose();
8736
+ return;
8737
+ case "already-present":
8738
+ setAddError("This token is already on your list.");
8739
+ return;
8740
+ case "at-capacity":
8741
+ setAddError(`You can add up to ${result.limit} tokens per network.`);
8742
+ return;
8743
+ default:
8744
+ setAddError("This token could not be added.");
8745
+ }
8746
+ };
8747
+ return /* @__PURE__ */ jsxs(
8748
+ "div",
7848
8749
  {
7849
- "data-slot": "toast-description",
7850
- className: cn("text-sm text-muted-foreground", className),
7851
- ...props
8750
+ className: "flex flex-col gap-3 rounded-xl bg-white/5 p-3",
8751
+ "aria-label": "Add a token",
8752
+ children: [
8753
+ /* @__PURE__ */ jsxs("span", { className: "text-xs text-muted-foreground", children: [
8754
+ "Paste the token's contract address on ",
8755
+ chain.name,
8756
+ ". Its name and decimals are read from the contract."
8757
+ ] }),
8758
+ /* @__PURE__ */ jsx(
8759
+ "input",
8760
+ {
8761
+ "aria-label": "Token contract address",
8762
+ className: "w-full rounded-lg bg-black/30 px-2.5 py-2 font-mono text-xs leading-5 ring-1 ring-foreground/10 outline-none placeholder:text-muted-foreground focus-visible:ring-2 focus-visible:ring-foreground/30",
8763
+ placeholder: "0x\u2026",
8764
+ spellCheck: false,
8765
+ autoComplete: "off",
8766
+ autoFocus: true,
8767
+ value: address,
8768
+ onChange: (event) => {
8769
+ setAddError(null);
8770
+ setAddress(event.target.value);
8771
+ }
8772
+ }
8773
+ ),
8774
+ lookup.phase === "loading" ? /* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground", children: "Reading the contract\u2026" }) : null,
8775
+ lookup.phase === "rejected" ? /* @__PURE__ */ jsx("p", { className: "text-xs text-destructive", children: lookup.message }) : null,
8776
+ token ? /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1.5 rounded-lg bg-black/30 p-2.5", children: [
8777
+ /* @__PURE__ */ jsxs("div", { className: "flex items-baseline justify-between gap-2", children: [
8778
+ /* @__PURE__ */ jsx("span", { className: "text-sm font-medium", children: token.symbol }),
8779
+ /* @__PURE__ */ jsxs("span", { className: "text-xs text-muted-foreground", children: [
8780
+ token.decimals,
8781
+ " decimals"
8782
+ ] })
8783
+ ] }),
8784
+ /* @__PURE__ */ jsx("span", { className: "text-xs text-muted-foreground", children: token.name }),
8785
+ /* @__PURE__ */ jsx("span", { className: "font-mono text-[11px] leading-4 break-all text-muted-foreground", children: token.address })
8786
+ ] }) : null,
8787
+ alreadyListed ? /* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground", children: "This token is already on your list." }) : null,
8788
+ collides && !alreadyListed ? /* @__PURE__ */ jsxs("div", { className: "flex gap-2 rounded-lg bg-destructive/10 p-2.5 text-xs text-destructive", children: [
8789
+ /* @__PURE__ */ jsx(AlertTriangle, { className: "mt-0.5 size-4 shrink-0" }),
8790
+ /* @__PURE__ */ jsxs("span", { children: [
8791
+ "A token called ",
8792
+ token?.symbol,
8793
+ " is already on your list. Check the address above matches the token you mean \u2014 anyone can deploy a token using someone else's symbol."
8794
+ ] })
8795
+ ] }) : null,
8796
+ addError ? /* @__PURE__ */ jsx("p", { className: "text-xs text-destructive", children: addError }) : null,
8797
+ /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
8798
+ /* @__PURE__ */ jsx(Button, { size: "sm", variant: "ghost", className: "rounded-full px-3", onClick: onClose, children: "Cancel" }),
8799
+ /* @__PURE__ */ jsx(
8800
+ Button,
8801
+ {
8802
+ size: "sm",
8803
+ className: "rounded-full px-3",
8804
+ disabled: !token || alreadyListed,
8805
+ onClick: handleAdd,
8806
+ children: collides && !alreadyListed ? "Add anyway" : "Add token"
8807
+ }
8808
+ )
8809
+ ] })
8810
+ ]
7852
8811
  }
7853
8812
  );
7854
8813
  }
7855
- function ToastAction({
7856
- className,
7857
- render = /* @__PURE__ */ jsx(Button, { variant: "outline", size: "sm" }),
7858
- ...props
7859
- }) {
8814
+ var TooltipProvider = Tooltip$1.Provider;
8815
+ var Tooltip = Tooltip$1.Root;
8816
+ function TooltipTrigger({ className, ...props }) {
7860
8817
  return /* @__PURE__ */ jsx(
7861
- Toast$1.Action,
8818
+ Tooltip$1.Trigger,
7862
8819
  {
7863
- "data-slot": "toast-action",
7864
- render,
7865
- className: cn("shrink-0", className),
8820
+ "data-slot": "tooltip-trigger",
8821
+ className: cn("outline-none focus-visible:ring-3 focus-visible:ring-ring/50", className),
7866
8822
  ...props
7867
8823
  }
7868
8824
  );
7869
8825
  }
7870
- function ToastClose({
8826
+ function TooltipContent({
7871
8827
  className,
7872
8828
  children,
7873
- render = /* @__PURE__ */ jsx(Button, { variant: "ghost", size: "icon-sm" }),
8829
+ side = "top",
8830
+ sideOffset = 6,
8831
+ align = "center",
8832
+ alignOffset = 0,
7874
8833
  ...props
7875
8834
  }) {
7876
- return /* @__PURE__ */ jsx(
7877
- Toast$1.Close,
7878
- {
7879
- "data-slot": "toast-close",
7880
- "aria-label": "Close toast",
7881
- render,
7882
- className: cn(
7883
- "relative shrink-0 text-muted-foreground after:absolute after:-inset-2 after:content-[''] hover:text-foreground",
7884
- className
7885
- ),
7886
- ...props,
7887
- children: children ?? /* @__PURE__ */ jsx(XIcon, { "aria-hidden": "true" })
7888
- }
7889
- );
7890
- }
7891
- function ToastIcon({ type }) {
7892
- let icon = null;
7893
- if (type === "success") {
7894
- icon = /* @__PURE__ */ jsx(CircleCheckIcon, { "aria-hidden": "true" });
7895
- }
7896
- if (type === "info") {
7897
- icon = /* @__PURE__ */ jsx(InfoIcon, { "aria-hidden": "true" });
7898
- }
7899
- if (type === "warning") {
7900
- icon = /* @__PURE__ */ jsx(TriangleAlertIcon, { "aria-hidden": "true" });
7901
- }
7902
- if (type === "error") {
7903
- icon = /* @__PURE__ */ jsx(OctagonXIcon, { className: "text-destructive", "aria-hidden": "true" });
7904
- }
7905
- if (type === "loading") {
7906
- icon = /* @__PURE__ */ jsx(Loader2Icon, { className: "animate-spin", "aria-hidden": "true" });
7907
- }
7908
- if (!icon) {
7909
- return null;
7910
- }
7911
- return /* @__PURE__ */ jsx(
7912
- "span",
8835
+ return /* @__PURE__ */ jsx(Tooltip$1.Portal, { children: /* @__PURE__ */ jsx(
8836
+ Tooltip$1.Positioner,
7913
8837
  {
7914
- "data-slot": "toast-icon",
7915
- className: "shrink-0 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4",
7916
- children: icon
8838
+ side,
8839
+ sideOffset,
8840
+ align,
8841
+ alignOffset,
8842
+ className: "isolate z-50",
8843
+ children: /* @__PURE__ */ jsx(
8844
+ Tooltip$1.Popup,
8845
+ {
8846
+ "data-slot": "tooltip-content",
8847
+ className: cn(
8848
+ "dark relative isolate z-50 max-w-64 origin-(--transform-origin) rounded-lg border border-white/15 bg-popover px-2 py-1 text-xs text-popover-foreground shadow-xl duration-100 data-[side=bottom]:slide-in-from-top-1 data-[side=left]:slide-in-from-right-1 data-[side=right]:slide-in-from-left-1 data-[side=top]:slide-in-from-bottom-1 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",
8849
+ className
8850
+ ),
8851
+ ...props,
8852
+ children
8853
+ }
8854
+ )
7917
8855
  }
7918
- );
7919
- }
7920
- function ToastList() {
7921
- const { toasts } = Toast$1.useToastManager();
7922
- return toasts.map((toastItem) => /* @__PURE__ */ jsx(Toast, { toast: toastItem, children: /* @__PURE__ */ jsxs(ToastContent, { children: [
7923
- /* @__PURE__ */ jsxs("div", { className: "flex min-w-0 flex-1 flex-col gap-1", children: [
7924
- /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1.5", children: [
7925
- /* @__PURE__ */ jsx(ToastIcon, { type: toastItem.type }),
7926
- /* @__PURE__ */ jsx(ToastTitle, {})
7927
- ] }),
7928
- /* @__PURE__ */ jsx(ToastDescription, {})
7929
- ] }),
7930
- /* @__PURE__ */ jsx(ToastAction, {}),
7931
- /* @__PURE__ */ jsx(ToastClose, {})
7932
- ] }) }, toastItem.id));
7933
- }
7934
- function Toaster({
7935
- children,
7936
- toastManager = toast,
7937
- ...props
7938
- }) {
7939
- return /* @__PURE__ */ jsxs(ToastProvider, { toastManager, ...props, children: [
7940
- children,
7941
- /* @__PURE__ */ jsx(ToastPortal, { children: /* @__PURE__ */ jsx(ToastViewport, { children: /* @__PURE__ */ jsx(ToastList, {}) }) })
7942
- ] });
7943
- }
7944
- Toast$1.createToastManager;
7945
- Toast$1.useToastManager;
7946
-
7947
- // src/utils/formatAddress.ts
7948
- function formatAddress(address) {
7949
- return `${address.slice(0, 6)}...${address.slice(-4)}`;
7950
- }
7951
-
7952
- // src/utils/copyAddress.ts
7953
- async function copyAddressToClipboard(address) {
7954
- try {
7955
- await navigator.clipboard.writeText(address);
7956
- toast.add({
7957
- type: "success",
7958
- title: "Address copied",
7959
- description: formatAddress(address)
7960
- });
7961
- } catch (error) {
7962
- debugWarn("[fluent connect] Failed to copy address", error);
7963
- toast.add({
7964
- type: "error",
7965
- title: "Copy failed",
7966
- description: "Could not copy address to clipboard."
7967
- });
7968
- }
8856
+ ) });
7969
8857
  }
7970
- var tokenIcons = {
7971
- ETH: "eth",
7972
- USDnr: "usdnr",
7973
- BLEND: "fluent"
8858
+ var VISUAL_BY_DEFAULT_SYMBOL = {
8859
+ // ETH/USDnr glyphs sit on fixed brand-colored tiles, so they stay white
8860
+ // regardless of the host's foreground override.
8861
+ ETH: { icon: "eth", iconClassName: "size-6 text-white", bgClassName: "bg-[#627EEA]" },
8862
+ USDnr: { icon: "usdnr", iconClassName: "size-6 text-white", bgClassName: "bg-[#7f52d0]" },
8863
+ BLEND: { icon: "fluent", iconClassName: "size-4", bgClassName: "bg-[#FFFFFF]/10" }
7974
8864
  };
7975
- var tokenIconClassName = {
7976
- ETH: "size-6 text-white",
7977
- USDnr: "size-6 text-white",
7978
- BLEND: "size-4"
7979
- };
7980
- var tokenBgClassName = {
7981
- ETH: "bg-[#627EEA]",
7982
- USDnr: "bg-[#7f52d0]",
7983
- BLEND: "bg-[#FFFFFF]/10"
7984
- };
7985
- function WalletMenuGasPayment({
8865
+ function WalletMenuTokenList({
7986
8866
  accountAddress,
7987
8867
  balances,
7988
8868
  busy,
7989
8869
  usdPrices = {},
7990
- bridgeUrl: _bridgeUrl,
7991
- ethValueByToken: _ethValueByToken,
7992
- tokens = fluentDefaultGasTokens,
7993
- selectedSymbol
8870
+ tokens,
8871
+ selectedSymbol,
8872
+ onAddUserToken,
8873
+ onRemoveUserToken
7994
8874
  }) {
7995
- const gasTokens = useMemo(() => getFluentGasPaymentTokens(tokens), [tokens]);
8875
+ const [addOpen, setAddOpen] = useState(false);
8876
+ const gasTokenIdentities = useMemo(
8877
+ () => new Set(getFluentGasPaymentTokens(tokens).map((token) => token.identity)),
8878
+ [tokens]
8879
+ );
8880
+ const collidingSymbols = useMemo(() => findFluentSymbolCollisions(tokens), [tokens]);
8881
+ const existingSymbols = useMemo(
8882
+ () => new Set(tokens.map((token) => token.symbol.toLowerCase())),
8883
+ [tokens]
8884
+ );
8885
+ const listedIdentities = useMemo(() => new Set(tokens.map((token) => token.identity)), [tokens]);
8886
+ const balanceByIdentity = useMemo(
8887
+ () => new Map(balances.map((balance) => [fluentTokenIdentity(balance), balance])),
8888
+ [balances]
8889
+ );
7996
8890
  const sortedRows = useMemo(
7997
- () => gasTokens.map((token, index) => ({
7998
- token,
7999
- balance: balances.find((item) => item.symbol === token.symbol),
8000
- index
8001
- })).sort((left, right) => {
8002
- const leftRaw = getComparableBalance(left.balance);
8003
- const rightRaw = getComparableBalance(right.balance);
8004
- if (leftRaw === rightRaw) return left.index - right.index;
8005
- return rightRaw > leftRaw ? 1 : -1;
8891
+ () => tokens.map((token, index) => {
8892
+ const balance = balanceByIdentity.get(token.identity);
8893
+ return { token, balance, index, comparable: getComparableBalance(balance) };
8894
+ }).sort((left, right) => {
8895
+ if (left.comparable === right.comparable) return left.index - right.index;
8896
+ return right.comparable > left.comparable ? 1 : -1;
8006
8897
  }),
8007
- [balances, gasTokens]
8898
+ [balanceByIdentity, tokens]
8008
8899
  );
8009
- return /* @__PURE__ */ jsx("div", { className: "flex flex-col gap-3", children: /* @__PURE__ */ jsx("div", { className: "flex flex-col gap-4", "aria-label": "Gas payment tokens", children: sortedRows.map(({ token, balance }) => {
8010
- const symbol = token.symbol;
8011
- const unavailable = balance?.status === "not-configured";
8012
- const failed = balance?.status === "error";
8013
- const iconName = tokenIcons[symbol];
8014
- const active = selectedSymbol === symbol;
8015
- const formatted = balance?.status === "ready" ? formatFluentGasTokenBalance(balance, 0) ?? (balance.formatted ? formatFluentLocaleAmount(balance.formatted, 0) : null) : null;
8016
- const usdValueLabel = formatTokenUsdValue(balance, usdPrices[symbol]);
8017
- return /* @__PURE__ */ jsxs(
8018
- "div",
8019
- {
8020
- className: "flex w-full items-center gap-3 rounded-xl",
8021
- children: [
8022
- /* @__PURE__ */ jsx(
8023
- "span",
8024
- {
8025
- className: `flex size-10 shrink-0 items-center justify-center rounded-lg ${tokenBgClassName[symbol] ?? "bg-white/10"}`,
8026
- children: iconName ? /* @__PURE__ */ jsx(
8027
- Icon,
8028
- {
8029
- name: iconName,
8030
- className: tokenIconClassName[symbol] ?? "size-6 text-foreground"
8031
- }
8032
- ) : /* @__PURE__ */ jsx("span", { className: "text-xs font-medium", children: symbol.slice(0, 1) })
8033
- }
8034
- ),
8035
- /* @__PURE__ */ jsxs("span", { className: "flex min-w-0 flex-1 flex-col items-start gap-0.5", children: [
8036
- /* @__PURE__ */ jsxs("span", { className: "flex items-center gap-1 text-sm font-medium leading-4", children: [
8037
- symbol,
8038
- active && /* @__PURE__ */ jsx("span", { className: "rounded-md bg-white/15 px-1.5 leading-[18px] text-[10px] font-normal text-muted-foreground -my-px", children: "Gas" })
8039
- ] }),
8040
- token.address ? /* @__PURE__ */ jsxs(
8041
- Select,
8900
+ return /* @__PURE__ */ jsx(TooltipProvider, { delay: 200, children: /* @__PURE__ */ jsx("div", { className: "flex flex-col gap-3", children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-4", "aria-label": "Token balances", children: [
8901
+ sortedRows.map(({ token, balance }) => {
8902
+ const identity = token.identity;
8903
+ const symbol = token.symbol;
8904
+ const unavailable = balance?.status === "not-configured";
8905
+ const failed = balance?.status === "error";
8906
+ const visual = isFluentDefaultToken(token) ? VISUAL_BY_DEFAULT_SYMBOL[token.symbol] : void 0;
8907
+ const active = selectedSymbol === symbol && gasTokenIdentities.has(identity);
8908
+ const formatted = balance?.status === "ready" ? formatFluentGasTokenBalance(balance, 0) ?? (balance.formatted ? formatFluentLocaleAmount(balance.formatted, 0) : null) : null;
8909
+ const usdValueLabel = formatTokenUsdValue(balance, usdPrices[identity]);
8910
+ const exactBalance = balance?.status === "ready" && balance.formatted?.includes(".") ? balance.formatted : null;
8911
+ return /* @__PURE__ */ jsxs(
8912
+ "div",
8913
+ {
8914
+ className: "flex w-full items-center gap-3 rounded-xl",
8915
+ children: [
8916
+ /* @__PURE__ */ jsx(
8917
+ "span",
8042
8918
  {
8043
- value: null,
8044
- onValueChange: (value) => {
8045
- if (value === "copy" && token.address) {
8046
- void copyAddressToClipboard(token.address);
8047
- }
8048
- },
8049
- children: [
8919
+ className: `flex size-10 shrink-0 items-center justify-center overflow-hidden rounded-lg ${visual?.bgClassName ?? "bg-foreground/10"}`,
8920
+ children: visual ? /* @__PURE__ */ jsx(Icon, { name: visual.icon, className: visual.iconClassName }) : token.logoURI ? (
8921
+ // Rendered as an <img>, never inlined: a logo URL is data from
8922
+ // an integrator or a stranger's contract, and inlining SVG
8923
+ // from either would execute their markup in the widget.
8050
8924
  /* @__PURE__ */ jsx(
8051
- SelectTrigger,
8925
+ "img",
8052
8926
  {
8053
- "aria-label": `Token address actions for ${symbol}`,
8054
- className: "!h-auto max-w-full gap-0.5 border-0 bg-transparent p-0 text-xs leading-4 opacity-100 shadow-none hover:opacity-80 dark:bg-transparent dark:hover:bg-transparent [&_svg]:size-3 [&_svg]:opacity-0 hover:[&_svg]:opacity-70 aria-expanded:opacity-80 aria-expanded:[&_svg]:opacity-70",
8055
- children: /* @__PURE__ */ jsx("span", { className: "truncate", children: formatAddress(token.address) })
8927
+ src: token.logoURI,
8928
+ alt: "",
8929
+ "aria-hidden": "true",
8930
+ loading: "lazy",
8931
+ decoding: "async",
8932
+ className: "size-10 object-contain"
8056
8933
  }
8057
- ),
8058
- /* @__PURE__ */ jsx(SelectContent, { align: "start", alignItemWithTrigger: false, children: /* @__PURE__ */ jsxs(SelectItem, { value: "copy", children: [
8059
- /* @__PURE__ */ jsx(Copy, { className: "size-4" }),
8060
- "Copy address"
8061
- ] }) })
8062
- ]
8934
+ )
8935
+ ) : /* @__PURE__ */ jsx("span", { className: "text-xs font-medium", children: symbol.slice(0, 1) })
8063
8936
  }
8064
- ) : /* @__PURE__ */ jsx("span", { className: "shrink-0 text-xs leading-4 text-muted-foreground", children: symbol === "ETH" ? "Native" : "No address" })
8065
- ] }),
8066
- /* @__PURE__ */ jsxs("span", { className: "flex flex-col items-end gap-0.5 tabular-nums", children: [
8067
- /* @__PURE__ */ jsx("span", { className: "text-sm font-medium leading-4", children: renderBalanceLabel({
8068
- formatted,
8069
- unavailable,
8070
- failed,
8071
- isLoading: busy,
8072
- hasAccount: Boolean(accountAddress)
8073
- }) }),
8074
- usdValueLabel ? /* @__PURE__ */ jsx("span", { className: "text-xs leading-4 opacity-50", children: usdValueLabel }) : null
8075
- ] })
8937
+ ),
8938
+ /* @__PURE__ */ jsxs("span", { className: "flex min-w-0 flex-1 flex-col items-start gap-0.5", children: [
8939
+ /* @__PURE__ */ jsxs("span", { className: "flex items-center gap-1 text-sm font-medium leading-4", children: [
8940
+ symbol,
8941
+ active && /* @__PURE__ */ jsx("span", { className: "rounded-md bg-foreground/15 px-1.5 leading-[18px] text-[10px] font-normal text-muted-foreground -my-px", children: "Gas" }),
8942
+ token.source === "user" && /* @__PURE__ */ jsx("span", { className: "rounded-md bg-foreground/15 px-1.5 leading-[18px] text-[10px] font-normal text-muted-foreground -my-px", children: "Added by you" }),
8943
+ collidingSymbols.has(symbol.toLowerCase()) && /* @__PURE__ */ jsxs(Tooltip, { children: [
8944
+ /* @__PURE__ */ jsx(
8945
+ TooltipTrigger,
8946
+ {
8947
+ tabIndex: 0,
8948
+ "aria-label": `More than one token on this list calls itself ${symbol}`,
8949
+ render: /* @__PURE__ */ jsx("span", { className: "cursor-default rounded-sm" }),
8950
+ children: /* @__PURE__ */ jsx(AlertTriangle, { className: "size-3.5 text-destructive" })
8951
+ }
8952
+ ),
8953
+ /* @__PURE__ */ jsxs(TooltipContent, { children: [
8954
+ "More than one token here calls itself ",
8955
+ symbol,
8956
+ ". Check the address."
8957
+ ] })
8958
+ ] })
8959
+ ] }),
8960
+ token.address ? /* @__PURE__ */ jsxs(
8961
+ Select,
8962
+ {
8963
+ value: null,
8964
+ onValueChange: (value) => {
8965
+ if (value === "copy" && token.address) {
8966
+ copyAddressToClipboard(token.address);
8967
+ }
8968
+ if (value === "remove" && token.address) {
8969
+ onRemoveUserToken?.({ chainId: token.chainId, address: token.address });
8970
+ }
8971
+ },
8972
+ children: [
8973
+ /* @__PURE__ */ jsx(
8974
+ SelectTrigger,
8975
+ {
8976
+ "aria-label": `Token address actions for ${symbol}`,
8977
+ className: "!h-auto max-w-full gap-0.5 border-0 bg-transparent p-0 text-xs leading-4 opacity-100 shadow-none hover:opacity-80 dark:bg-transparent dark:hover:bg-transparent [&_svg]:size-3 [&_svg]:opacity-0 hover:[&_svg]:opacity-70 aria-expanded:opacity-80 aria-expanded:[&_svg]:opacity-70",
8978
+ children: /* @__PURE__ */ jsx("span", { className: "truncate", children: formatAddress(token.address) })
8979
+ }
8980
+ ),
8981
+ /* @__PURE__ */ jsxs(SelectContent, { align: "start", alignItemWithTrigger: false, children: [
8982
+ /* @__PURE__ */ jsxs(SelectItem, { value: "copy", children: [
8983
+ /* @__PURE__ */ jsx(Copy, { className: "size-4" }),
8984
+ "Copy address"
8985
+ ] }),
8986
+ token.source === "user" && onRemoveUserToken ? /* @__PURE__ */ jsxs(SelectItem, { value: "remove", children: [
8987
+ /* @__PURE__ */ jsx(Trash2, { className: "size-4" }),
8988
+ "Remove token"
8989
+ ] }) : null
8990
+ ] })
8991
+ ]
8992
+ }
8993
+ ) : /* @__PURE__ */ jsx("span", { className: "shrink-0 text-xs leading-4 text-muted-foreground", children: isFluentNativeToken(token) ? "Native" : "No address" })
8994
+ ] }),
8995
+ /* @__PURE__ */ jsxs("span", { className: "flex flex-col items-end gap-0.5 tabular-nums", children: [
8996
+ /* @__PURE__ */ jsx("span", { className: "text-sm font-medium leading-4", children: exactBalance ? /* @__PURE__ */ jsxs(Tooltip, { children: [
8997
+ /* @__PURE__ */ jsx(
8998
+ TooltipTrigger,
8999
+ {
9000
+ tabIndex: 0,
9001
+ "aria-label": `${symbol} balance: ${exactBalance}`,
9002
+ render: /* @__PURE__ */ jsx("span", { className: "cursor-default rounded-sm" }),
9003
+ children: renderBalanceLabel({
9004
+ formatted,
9005
+ unavailable,
9006
+ failed,
9007
+ isLoading: busy,
9008
+ hasAccount: Boolean(accountAddress)
9009
+ })
9010
+ }
9011
+ ),
9012
+ /* @__PURE__ */ jsxs(TooltipContent, { className: "tabular-nums break-all", children: [
9013
+ exactBalance,
9014
+ " ",
9015
+ symbol
9016
+ ] })
9017
+ ] }) : renderBalanceLabel({
9018
+ formatted,
9019
+ unavailable,
9020
+ failed,
9021
+ isLoading: busy,
9022
+ hasAccount: Boolean(accountAddress)
9023
+ }) }),
9024
+ usdValueLabel ? /* @__PURE__ */ jsx("span", { className: "text-xs leading-4 opacity-50", children: usdValueLabel }) : null
9025
+ ] })
9026
+ ]
9027
+ },
9028
+ identity
9029
+ );
9030
+ }),
9031
+ onAddUserToken && !addOpen ? /* @__PURE__ */ jsxs(
9032
+ "button",
9033
+ {
9034
+ type: "button",
9035
+ onClick: () => setAddOpen(true),
9036
+ className: "flex w-full items-center gap-3 rounded-xl text-left hover:opacity-80",
9037
+ children: [
9038
+ /* @__PURE__ */ jsx("span", { className: "flex size-10 shrink-0 items-center justify-center rounded-lg bg-foreground/10", children: /* @__PURE__ */ jsx(Plus, { className: "size-4" }) }),
9039
+ /* @__PURE__ */ jsx("span", { className: "text-sm font-medium leading-4", children: "Add token" })
8076
9040
  ]
8077
- },
8078
- symbol
8079
- );
8080
- }) }) });
9041
+ }
9042
+ ) : null,
9043
+ onAddUserToken && addOpen ? /* @__PURE__ */ jsx(
9044
+ AddTokenForm,
9045
+ {
9046
+ existingSymbols,
9047
+ listedIdentities,
9048
+ onAdd: onAddUserToken,
9049
+ onClose: () => setAddOpen(false)
9050
+ }
9051
+ ) : null
9052
+ ] }) }) });
8081
9053
  }
8082
9054
  function formatTokenUsdValue(balance, usdPrice) {
8083
9055
  if (!balance || balance.status !== "ready" || balance.formatted === null) return null;
@@ -8100,7 +9072,7 @@ function renderBalanceLabel({
8100
9072
  return /* @__PURE__ */ jsx(
8101
9073
  "span",
8102
9074
  {
8103
- className: "inline-block h-4 w-16 animate-pulse rounded-md bg-white/10",
9075
+ className: "inline-block h-4 w-16 animate-pulse rounded-md bg-foreground/10",
8104
9076
  "aria-label": "Loading balance"
8105
9077
  }
8106
9078
  );
@@ -8160,22 +9132,22 @@ function ReputationFamilyCard({ family, tier }) {
8160
9132
  const accent = FLUENT_FAMILY_ACCENTS[family] ?? FLUENT_FAMILY_FALLBACK_ACCENT;
8161
9133
  const labels = FLUENT_FAMILY_LABELS[family];
8162
9134
  const progress = FLUENT_FAMILY_TIER_PROGRESS[tier] ?? 0;
8163
- return /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-2.5 rounded-xl border border-white/15 bg-black/40 p-3", children: [
8164
- /* @__PURE__ */ jsx("span", { className: "text-[10px] font-medium uppercase tracking-[0.06em] text-white/60", children: FLUENT_FAMILY_DISPLAY_NAMES[family] ?? family }),
9135
+ return /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-2.5 rounded-xl border border-foreground/15 bg-background/40 p-3", children: [
9136
+ /* @__PURE__ */ jsx("span", { className: "text-[10px] font-medium uppercase tracking-[0.06em] text-foreground/60", children: FLUENT_FAMILY_DISPLAY_NAMES[family] ?? family }),
8165
9137
  /* @__PURE__ */ jsx(
8166
9138
  "div",
8167
9139
  {
8168
- className: "flex w-fit max-w-full items-center rounded-full border-[0.5px] border-white/20 px-2.5 py-0.5",
9140
+ className: "flex w-fit max-w-full items-center rounded-full border-[0.5px] border-foreground/20 px-2.5 py-0.5",
8169
9141
  style: { backgroundImage: `linear-gradient(90deg, ${accent.from}28, ${accent.to}28)` },
8170
- children: /* @__PURE__ */ jsx("span", { className: "truncate text-[12px] font-medium uppercase leading-5 text-white/85", children: labels?.[tier] ?? "Reputation signal" })
9142
+ children: /* @__PURE__ */ jsx("span", { className: "truncate text-[12px] font-medium uppercase leading-5 text-foreground/85", children: labels?.[tier] ?? "Reputation signal" })
8171
9143
  }
8172
9144
  ),
8173
9145
  /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1.5", children: [
8174
9146
  labels ? /* @__PURE__ */ jsxs("div", { className: "flex items-baseline justify-between gap-3", children: [
8175
- /* @__PURE__ */ jsx("span", { className: "truncate text-[9px] font-medium uppercase tracking-[0.06em] text-white/40", children: labels.D }),
8176
- /* @__PURE__ */ jsx("span", { className: "truncate text-[9px] font-medium uppercase tracking-[0.06em] text-white/70", children: labels.A })
9147
+ /* @__PURE__ */ jsx("span", { className: "truncate text-[9px] font-medium uppercase tracking-[0.06em] text-foreground/40", children: labels.D }),
9148
+ /* @__PURE__ */ jsx("span", { className: "truncate text-[9px] font-medium uppercase tracking-[0.06em] text-foreground/70", children: labels.A })
8177
9149
  ] }) : null,
8178
- /* @__PURE__ */ jsx("div", { className: "h-1.5 w-full overflow-hidden rounded-full bg-white/15", children: /* @__PURE__ */ jsx(
9150
+ /* @__PURE__ */ jsx("div", { className: "h-1.5 w-full overflow-hidden rounded-full bg-foreground/15", children: /* @__PURE__ */ jsx(
8179
9151
  "div",
8180
9152
  {
8181
9153
  className: "h-full rounded-full",
@@ -8194,7 +9166,7 @@ function ReputationNotice({
8194
9166
  description,
8195
9167
  action
8196
9168
  }) {
8197
- return /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center gap-3 rounded-xl bg-white/5 px-4 py-8 text-center", children: [
9169
+ return /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center gap-3 rounded-xl bg-foreground/5 px-4 py-8 text-center", children: [
8198
9170
  /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1", children: [
8199
9171
  /* @__PURE__ */ jsx("span", { className: "text-sm font-medium", children: title }),
8200
9172
  /* @__PURE__ */ jsx("span", { className: "text-xs opacity-50", children: description })
@@ -8309,13 +9281,19 @@ function WalletMenuActionCard({
8309
9281
  openExternalUrl(explorerAddress(actionAddress, resolvedConfig.network), "explorer", track);
8310
9282
  };
8311
9283
  const accountAddress = connectedAddress ?? actionAddress;
8312
- const { balances, busy: balancesBusy, gasTokens } = useFluentTokenBalances({
9284
+ const {
9285
+ balances,
9286
+ busy: balancesBusy,
9287
+ displayTokens,
9288
+ gasTokens,
9289
+ addUserToken,
9290
+ removeUserToken
9291
+ } = useFluentTokenBalances({
8313
9292
  accountAddress,
8314
9293
  tokens,
8315
9294
  revisionCounter: balanceRevisionCounter
8316
9295
  });
8317
- const priceSymbols = useMemo(() => gasTokens.map((token) => token.symbol), [gasTokens]);
8318
- const { prices, pricesYesterday, busy: pricesBusy } = useFluentTokenUsdPrices(priceSymbols);
9296
+ const { prices, pricesYesterday, busy: pricesBusy } = useFluentTokenUsdPrices(displayTokens);
8319
9297
  const portfolioTotal = useMemo(
8320
9298
  () => sumFluentTokenBalancesUsd(balances, prices),
8321
9299
  [balances, prices]
@@ -8337,27 +9315,117 @@ function WalletMenuActionCard({
8337
9315
  (balance) => balance.status === "ready" && balance.raw !== null && balance.raw > 0n
8338
9316
  );
8339
9317
  const portfolioUnavailable = Boolean(accountAddress) && !portfolioLoading && hasReadyBalances && portfolioTotal === null;
9318
+ if (tab === "settings") {
9319
+ return /* @__PURE__ */ jsxs("div", { className: "flex w-full flex-col gap-6", children: [
9320
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-2", children: [
9321
+ /* @__PURE__ */ jsx("span", { className: "text-xs font-medium opacity-50 uppercase", children: "Preferences" }),
9322
+ /* @__PURE__ */ jsxs(FieldGroup, { className: "w-full gap-2", children: [
9323
+ /* @__PURE__ */ jsx(FieldLabel, { htmlFor: "silent-signing", children: /* @__PURE__ */ jsxs(Field, { orientation: "horizontal", children: [
9324
+ /* @__PURE__ */ jsxs(FieldContent, { children: [
9325
+ /* @__PURE__ */ jsx(FieldTitle, { children: "Quick sign" }),
9326
+ /* @__PURE__ */ jsx(FieldDescription, { children: "Sign transactions without a confirmation popup." })
9327
+ ] }),
9328
+ /* @__PURE__ */ jsx(
9329
+ Switch,
9330
+ {
9331
+ id: "silent-signing",
9332
+ checked: silentSigningEnabled,
9333
+ onCheckedChange: (enabled) => {
9334
+ track("wallet_silent_signing_toggled", { enabled });
9335
+ onSilentSigningChange(enabled);
9336
+ }
9337
+ }
9338
+ )
9339
+ ] }) }),
9340
+ /* @__PURE__ */ jsx(FieldLabel, { htmlFor: "gas-payment", children: /* @__PURE__ */ jsxs(Field, { orientation: "horizontal", children: [
9341
+ /* @__PURE__ */ jsxs(FieldContent, { children: [
9342
+ /* @__PURE__ */ jsx(FieldTitle, { children: "Gas payment" }),
9343
+ /* @__PURE__ */ jsx(FieldDescription, { children: "Token used to pay transaction fees." })
9344
+ ] }),
9345
+ /* @__PURE__ */ jsxs(
9346
+ Select,
9347
+ {
9348
+ value: gasPaymentToken,
9349
+ onValueChange: (value) => {
9350
+ if (value) {
9351
+ track("wallet_gas_token_selected", { symbol: value });
9352
+ onGasPaymentTokenChange(value);
9353
+ }
9354
+ },
9355
+ children: [
9356
+ /* @__PURE__ */ jsx(
9357
+ SelectTrigger,
9358
+ {
9359
+ id: "gas-payment",
9360
+ size: "sm",
9361
+ className: "shrink-0 border-0 bg-transparent p-0 !h-auto shadow-none dark:bg-transparent dark:hover:bg-transparent",
9362
+ children: /* @__PURE__ */ jsx(SelectValue, {})
9363
+ }
9364
+ ),
9365
+ /* @__PURE__ */ jsx(SelectContent, { align: "end", alignItemWithTrigger: false, children: gasTokens.map((token) => /* @__PURE__ */ jsx(SelectItem, { value: token.symbol, children: token.symbol }, token.symbol)) })
9366
+ ]
9367
+ }
9368
+ )
9369
+ ] }) })
9370
+ ] })
9371
+ ] }),
9372
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-2", children: [
9373
+ /* @__PURE__ */ jsx("span", { className: "text-xs font-medium opacity-50 uppercase", children: "Developer" }),
9374
+ /* @__PURE__ */ jsxs(FieldGroup, { className: "w-full gap-2", children: [
9375
+ faucetAvailable ? /* @__PURE__ */ jsx(
9376
+ SettingsActionField,
9377
+ {
9378
+ title: faucetBusy ? "Requesting faucet" : "Faucet",
9379
+ description: session ? "Claim testnet BLEND" : "Connect Fluent ID first",
9380
+ disabled: faucetBusy || !session,
9381
+ onClick: onFaucet
9382
+ }
9383
+ ) : null,
9384
+ /* @__PURE__ */ jsx(
9385
+ SettingsActionField,
9386
+ {
9387
+ title: "Explorer",
9388
+ description: "View Kernel smart wallet",
9389
+ disabled: !actionAddress,
9390
+ onClick: handleExplorer
9391
+ }
9392
+ )
9393
+ ] })
9394
+ ] })
9395
+ ] });
9396
+ }
8340
9397
  return /* @__PURE__ */ jsxs(Tabs, { value: tab, onValueChange: onTabChange, className: "w-full flex flex-col", children: [
8341
9398
  /* @__PURE__ */ jsxs(TabsList, { className: "w-full", children: [
8342
9399
  /* @__PURE__ */ jsx(TabsTrigger, { value: "home", children: "Home" }),
8343
- /* @__PURE__ */ jsx(TabsTrigger, { value: "reputation", children: "Reputation" }),
8344
- /* @__PURE__ */ jsx(TabsTrigger, { value: "settings", children: "Settings" })
9400
+ /* @__PURE__ */ jsx(TabsTrigger, { value: "reputation", children: "Reputation" })
8345
9401
  ] }),
8346
9402
  /* @__PURE__ */ jsxs(TabsContent, { value: "home", className: "flex flex-col gap-4 pt-2", children: [
8347
9403
  /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-2", children: [
8348
- /* @__PURE__ */ jsx("div", { className: "relative overflow-hidden rounded-xl px-4 py-8 bg-white/5", children: /* @__PURE__ */ jsxs("div", { className: "relative z-10 flex flex-col items-center gap-1", children: [
8349
- /* @__PURE__ */ jsx("div", { className: "tracking-[.05em]", children: portfolioDisplay ? /* @__PURE__ */ jsxs(Fragment, { children: [
9404
+ /* @__PURE__ */ jsx("div", { className: "relative overflow-hidden rounded-xl px-4 py-8 bg-foreground/5", children: /* @__PURE__ */ jsxs("div", { className: "relative z-10 flex flex-col items-center gap-1", children: [
9405
+ /* @__PURE__ */ jsx("div", { className: "tracking-[.05em] leading-none", children: portfolioDisplay ? /* @__PURE__ */ jsxs(Fragment, { children: [
8350
9406
  /* @__PURE__ */ jsx("span", { className: "mr-1 text-3xl font-semibold", children: "$" }),
8351
9407
  /* @__PURE__ */ jsx("span", { className: "text-3xl font-semibold", children: portfolioDisplay.whole }),
8352
9408
  /* @__PURE__ */ jsxs("span", { className: "text-lg font-semibold opacity-50", children: [
8353
- ",",
9409
+ portfolioDisplay.separator,
8354
9410
  portfolioDisplay.fraction
8355
9411
  ] })
8356
- ] }) : portfolioLoading ? /* @__PURE__ */ jsx(
9412
+ ] }) : portfolioLoading ? /* @__PURE__ */ jsxs(
8357
9413
  "span",
8358
9414
  {
8359
- className: "inline-block h-9 w-28 animate-pulse rounded-md bg-white/10",
8360
- "aria-label": "Loading portfolio total"
9415
+ className: "relative inline-flex items-baseline",
9416
+ "aria-busy": "true",
9417
+ "aria-label": "Loading portfolio total",
9418
+ children: [
9419
+ /* @__PURE__ */ jsxs("span", { className: "invisible", "aria-hidden": "true", children: [
9420
+ /* @__PURE__ */ jsx("span", { className: "mr-1 text-3xl font-semibold", children: "$" }),
9421
+ /* @__PURE__ */ jsx("span", { className: "text-3xl font-semibold", children: "0" }),
9422
+ /* @__PURE__ */ jsxs("span", { className: "text-lg font-semibold", children: [
9423
+ FLUENT_DECIMAL_SEPARATOR,
9424
+ "00"
9425
+ ] })
9426
+ ] }),
9427
+ /* @__PURE__ */ jsx("span", { className: "absolute inset-0 animate-pulse rounded-md bg-foreground/10" })
9428
+ ]
8361
9429
  }
8362
9430
  ) : portfolioUnavailable ? /* @__PURE__ */ jsxs(Fragment, { children: [
8363
9431
  /* @__PURE__ */ jsx("span", { className: "mr-1 text-3xl font-semibold", children: "$" }),
@@ -8365,9 +9433,12 @@ function WalletMenuActionCard({
8365
9433
  ] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
8366
9434
  /* @__PURE__ */ jsx("span", { className: "mr-1 text-3xl font-semibold", children: "$" }),
8367
9435
  /* @__PURE__ */ jsx("span", { className: "text-3xl font-semibold", children: "0" }),
8368
- /* @__PURE__ */ jsx("span", { className: "text-lg font-semibold opacity-50", children: ",00" })
9436
+ /* @__PURE__ */ jsxs("span", { className: "text-lg font-semibold opacity-50", children: [
9437
+ FLUENT_DECIMAL_SEPARATOR,
9438
+ "00"
9439
+ ] })
8369
9440
  ] }) }),
8370
- /* @__PURE__ */ jsx("div", { className: "flex items-center gap-1.5 text-xs font-medium", children: portfolioPnl ? /* @__PURE__ */ jsxs(Fragment, { children: [
9441
+ /* @__PURE__ */ jsx("div", { className: "flex min-h-4 items-center gap-1.5 text-xs font-medium leading-none", children: portfolioPnl ? /* @__PURE__ */ jsxs(Fragment, { children: [
8371
9442
  /* @__PURE__ */ jsx("span", { className: "inline-flex items-center gap-0.5", children: formatFluentPortfolioPnlAbsolute(portfolioPnl.delta) }),
8372
9443
  portfolioPnl.percent !== null ? /* @__PURE__ */ jsxs(
8373
9444
  "span",
@@ -8385,17 +9456,44 @@ function WalletMenuActionCard({
8385
9456
  ]
8386
9457
  }
8387
9458
  ) : null
8388
- ] }) : portfolioLoading ? /* @__PURE__ */ jsx(
9459
+ ] }) : portfolioLoading ? /* @__PURE__ */ jsxs(
8389
9460
  "span",
8390
9461
  {
8391
- className: "inline-block h-4 w-24 animate-pulse rounded-md bg-white/10",
8392
- "aria-label": "Loading portfolio pnl"
9462
+ className: "relative inline-flex items-center gap-1.5",
9463
+ "aria-busy": "true",
9464
+ "aria-label": "Loading portfolio pnl",
9465
+ children: [
9466
+ /* @__PURE__ */ jsxs("span", { className: "invisible inline-flex items-center gap-1.5", "aria-hidden": "true", children: [
9467
+ /* @__PURE__ */ jsxs("span", { className: "inline-flex items-center gap-0.5", children: [
9468
+ "$ +0",
9469
+ FLUENT_DECIMAL_SEPARATOR,
9470
+ "00"
9471
+ ] }),
9472
+ /* @__PURE__ */ jsxs("span", { className: "inline-flex items-center", children: [
9473
+ /* @__PURE__ */ jsx(Icon, { name: "arrow-up-s-fill", className: "size-3.5" }),
9474
+ /* @__PURE__ */ jsxs("span", { children: [
9475
+ "0",
9476
+ FLUENT_DECIMAL_SEPARATOR,
9477
+ "00%"
9478
+ ] })
9479
+ ] })
9480
+ ] }),
9481
+ /* @__PURE__ */ jsx("span", { className: "absolute inset-0 animate-pulse rounded-md bg-foreground/10" })
9482
+ ]
8393
9483
  }
8394
9484
  ) : /* @__PURE__ */ jsxs(Fragment, { children: [
8395
- /* @__PURE__ */ jsx("span", { className: "inline-flex items-center gap-0.5", children: "$ +0,00" }),
9485
+ /* @__PURE__ */ jsxs("span", { className: "inline-flex items-center gap-0.5", children: [
9486
+ "$ +0",
9487
+ FLUENT_DECIMAL_SEPARATOR,
9488
+ "00"
9489
+ ] }),
8396
9490
  /* @__PURE__ */ jsxs("span", { className: "inline-flex items-center text-green-400", children: [
8397
9491
  /* @__PURE__ */ jsx(Icon, { name: "arrow-up-s-fill", className: "size-3.5" }),
8398
- /* @__PURE__ */ jsx("span", { children: "0,00%" })
9492
+ /* @__PURE__ */ jsxs("span", { children: [
9493
+ "0",
9494
+ FLUENT_DECIMAL_SEPARATOR,
9495
+ "00%"
9496
+ ] })
8399
9497
  ] })
8400
9498
  ] }) })
8401
9499
  ] }) }),
@@ -8420,16 +9518,16 @@ function WalletMenuActionCard({
8420
9518
  ] })
8421
9519
  ] }),
8422
9520
  /* @__PURE__ */ jsx(
8423
- WalletMenuGasPayment,
9521
+ WalletMenuTokenList,
8424
9522
  {
8425
9523
  accountAddress,
8426
9524
  balances,
8427
9525
  busy: balancesBusy,
8428
9526
  usdPrices: prices,
8429
- bridgeUrl: resolvedConfig.bridgeUrl,
8430
- ethValueByToken: resolvedConfig.gasPayment.ethValueByToken,
8431
- tokens,
8432
- selectedSymbol: gasPaymentToken
9527
+ tokens: displayTokens,
9528
+ selectedSymbol: gasPaymentToken,
9529
+ onAddUserToken: addUserToken,
9530
+ onRemoveUserToken: removeUserToken
8433
9531
  }
8434
9532
  )
8435
9533
  ] }),
@@ -8442,7 +9540,15 @@ function WalletMenuActionCard({
8442
9540
  },
8443
9541
  name
8444
9542
  )) }) : null,
8445
- reputation.phase === "loading" ? /* @__PURE__ */ jsx(ReputationNotice, { title: "Loading reputation", description: "Fetching your Fluent families." }) : null,
9543
+ reputation.phase === "loading" ? /* @__PURE__ */ jsx(
9544
+ "div",
9545
+ {
9546
+ className: "flex items-center justify-center rounded-xl bg-foreground/5 px-4 py-8",
9547
+ "aria-busy": "true",
9548
+ "aria-label": "Loading reputation",
9549
+ children: /* @__PURE__ */ jsx(Spinner, { className: "size-5 text-foreground/70" })
9550
+ }
9551
+ ) : null,
8446
9552
  reputation.phase === "disconnected" ? /* @__PURE__ */ jsx(
8447
9553
  ReputationNotice,
8448
9554
  {
@@ -8463,87 +9569,6 @@ function WalletMenuActionCard({
8463
9569
  }
8464
9570
  ) : null,
8465
9571
  reputation.phase === "error" ? /* @__PURE__ */ jsx(ReputationNotice, { title: "Could not load reputation", description: reputation.message }) : null
8466
- ] }),
8467
- /* @__PURE__ */ jsxs(TabsContent, { value: "settings", className: "flex flex-col gap-6 pt-2", children: [
8468
- /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-2", children: [
8469
- /* @__PURE__ */ jsx("span", { className: "text-xs font-medium opacity-50 uppercase", children: "Preferences" }),
8470
- /* @__PURE__ */ jsxs(FieldGroup, { className: "w-full gap-2", children: [
8471
- /* @__PURE__ */ jsx(FieldLabel, { htmlFor: "silent-signing", children: /* @__PURE__ */ jsxs(Field, { orientation: "horizontal", children: [
8472
- /* @__PURE__ */ jsxs(FieldContent, { children: [
8473
- /* @__PURE__ */ jsx(FieldTitle, { children: "Quick sign" }),
8474
- /* @__PURE__ */ jsx(FieldDescription, { children: "Sign transactions without a confirmation popup." })
8475
- ] }),
8476
- /* @__PURE__ */ jsx(
8477
- Switch,
8478
- {
8479
- id: "silent-signing",
8480
- checked: silentSigningEnabled,
8481
- onCheckedChange: (enabled) => {
8482
- track("wallet_silent_signing_toggled", { enabled });
8483
- onSilentSigningChange(enabled);
8484
- }
8485
- }
8486
- )
8487
- ] }) }),
8488
- /* @__PURE__ */ jsx(FieldLabel, { htmlFor: "gas-payment", children: /* @__PURE__ */ jsxs(Field, { orientation: "horizontal", children: [
8489
- /* @__PURE__ */ jsxs(FieldContent, { children: [
8490
- /* @__PURE__ */ jsx(FieldTitle, { children: "Gas payment" }),
8491
- /* @__PURE__ */ jsx(FieldDescription, { children: "Token used to pay transaction fees." })
8492
- ] }),
8493
- /* @__PURE__ */ jsxs(
8494
- Select,
8495
- {
8496
- value: gasPaymentToken,
8497
- onValueChange: (value) => {
8498
- if (value) {
8499
- track("wallet_gas_token_selected", { symbol: value });
8500
- onGasPaymentTokenChange(value);
8501
- }
8502
- },
8503
- children: [
8504
- /* @__PURE__ */ jsx(
8505
- SelectTrigger,
8506
- {
8507
- id: "gas-payment",
8508
- size: "sm",
8509
- className: "shrink-0 border-0 bg-transparent p-0 !h-auto shadow-none dark:bg-transparent dark:hover:bg-transparent",
8510
- children: /* @__PURE__ */ jsx(SelectValue, {})
8511
- }
8512
- ),
8513
- /* @__PURE__ */ jsx(SelectContent, { align: "end", alignItemWithTrigger: false, children: FLUENT_GAS_PAYMENT_PRIORITY.map((symbol) => /* @__PURE__ */ jsx(SelectItem, { value: symbol, children: symbol }, symbol)) })
8514
- ]
8515
- }
8516
- )
8517
- ] }) })
8518
- ] })
8519
- ] }),
8520
- /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-2", children: [
8521
- /* @__PURE__ */ jsx("span", { className: "text-xs font-medium opacity-50 uppercase", children: "Developer" }),
8522
- /* @__PURE__ */ jsxs(FieldGroup, { className: "w-full gap-2", children: [
8523
- faucetAvailable ? /* @__PURE__ */ jsx(
8524
- SettingsActionField,
8525
- {
8526
- title: faucetBusy ? "Requesting faucet" : "Faucet",
8527
- description: session ? "Claim testnet BLEND" : "Connect Fluent ID first",
8528
- disabled: faucetBusy || !session,
8529
- onClick: onFaucet
8530
- }
8531
- ) : null,
8532
- /* @__PURE__ */ jsx(
8533
- SettingsActionField,
8534
- {
8535
- title: "Explorer",
8536
- description: "View Kernel smart wallet",
8537
- disabled: !actionAddress,
8538
- onClick: handleExplorer
8539
- }
8540
- )
8541
- ] })
8542
- ] }),
8543
- /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-2", children: [
8544
- /* @__PURE__ */ jsx("span", { className: "text-xs font-medium opacity-50 uppercase", children: "Account" }),
8545
- /* @__PURE__ */ jsx("div", { className: "flex flex-col gap-2", children: /* @__PURE__ */ jsx(Button, { variant: "secondary", className: "justify-between", onClick: onDisconnect, children: "Disconnect" }) })
8546
- ] })
8547
9572
  ] })
8548
9573
  ] });
8549
9574
  }
@@ -8561,49 +9586,6 @@ function useIsMobile() {
8561
9586
  }, []);
8562
9587
  return !!isMobile;
8563
9588
  }
8564
-
8565
- // src/utils/clearPrivyRecentLoginMethod.ts
8566
- function clearPrivyRecentLoginMethod(appId) {
8567
- if (typeof window === "undefined" || !appId) return;
8568
- try {
8569
- window.localStorage.removeItem(`privy:${appId}:recent-login-method`);
8570
- window.localStorage.removeItem(`privy:${appId}:recent-login-wallet-client`);
8571
- window.localStorage.removeItem(`privy:${appId}:recent-login-chain-type`);
8572
- } catch {
8573
- }
8574
- }
8575
-
8576
- // src/utils/createLocalFluentSession.ts
8577
- function createLocalFluentSession(params) {
8578
- const issuedAt = Math.floor(Date.now() / 1e3);
8579
- const payload = {
8580
- iss: typeof location !== "undefined" ? location.origin : "fluent-local",
8581
- aud: params.app.clientId ?? params.app.origin,
8582
- sub: params.userId,
8583
- app: params.app,
8584
- scopes: params.scopes,
8585
- iat: issuedAt
8586
- };
8587
- return {
8588
- app: params.app,
8589
- clientId: params.app.clientId,
8590
- idToken: `mock.${btoa(JSON.stringify(payload))}.signature`,
8591
- user: {
8592
- id: params.userId,
8593
- email: params.email
8594
- },
8595
- wallet: {
8596
- signerAddress: params.signerAddress,
8597
- smartAccountAddress: params.smartAccountAddress
8598
- },
8599
- scopes: params.scopes,
8600
- issuedAt,
8601
- metadata: {
8602
- authMode: "direct",
8603
- origin: params.app.origin
8604
- }
8605
- };
8606
- }
8607
9589
  function BatchOperationReviewModal({
8608
9590
  operation,
8609
9591
  onConfirm,
@@ -8693,6 +9675,10 @@ function deriveWidgetAccount(input) {
8693
9675
  const connecting = Boolean(
8694
9676
  !hasConnectedAccount && directAuth && smartAccount.privyAuthenticated && !smartAccount.error
8695
9677
  );
9678
+ const restoring = Boolean(
9679
+ !hasConnectedAccount && !connecting && !smartAccount.error && (directAuth && !smartAccount.privyReady || wallet?.reconnecting)
9680
+ );
9681
+ const status = hasConnectedAccount ? "connected" : connecting ? "connecting" : restoring ? "restoring" : "disconnected";
8696
9682
  const externalReady = Boolean(wallet?.connected && wallet.hasWalletClient);
8697
9683
  const type = fluentAccountReady ? "smart" : wallet?.connected ? "eoa" : void 0;
8698
9684
  const executionReady = fluentAccountReady || externalReady;
@@ -8717,7 +9703,8 @@ function deriveWidgetAccount(input) {
8717
9703
  accountMenuAddress,
8718
9704
  fluentAccountReady,
8719
9705
  hasConnectedAccount,
8720
- connecting
9706
+ connecting,
9707
+ status
8721
9708
  };
8722
9709
  }
8723
9710
  function useWidgetAccount(input) {
@@ -8741,6 +9728,7 @@ function useWidgetAccount(input) {
8741
9728
  wallet?.connected,
8742
9729
  wallet?.address,
8743
9730
  wallet?.hasWalletClient,
9731
+ wallet?.reconnecting,
8744
9732
  sessionUserId,
8745
9733
  sessionSmartAccountAddress,
8746
9734
  directAuth
@@ -8758,157 +9746,54 @@ function resolveGasPaymentSelection(params) {
8758
9746
  };
8759
9747
  }
8760
9748
  function useGasPaymentSelection(params) {
8761
- const { gasPaymentToken, tokens, network, silentSigningEnabled } = params;
8762
- const defaultGasTokens = useMemo(
8763
- () => getFluentDefaultGasTokens(network),
9749
+ const { gasPaymentToken, network, silentSigningEnabled } = params;
9750
+ const availableTokens = useMemo(
9751
+ () => getFluentDefaultWidgetGasTokens(network),
8764
9752
  [network]
8765
9753
  );
8766
9754
  const selectedGasPaymentToken = useMemo(
8767
- () => resolveGasPaymentSelection({
8768
- gasPaymentToken,
8769
- availableTokens: tokens ?? defaultGasTokens
8770
- }),
8771
- [gasPaymentToken, tokens, defaultGasTokens]
8772
- );
8773
- const defaultConfirmationMode = silentSigningEnabled ? "session" : "always";
8774
- return { selectedGasPaymentToken, defaultConfirmationMode };
8775
- }
8776
- function useBatchReview(options) {
8777
- const [batchReview, setBatchReview] = useState(null);
8778
- const resolution = useRef(null);
8779
- const onOpen = options?.onOpen;
8780
- const confirmBatchOperation = useCallback(
8781
- (operation) => {
8782
- onOpen?.();
8783
- resolution.current?.reject(
8784
- new Error("A newer Fluent transaction review replaced this request")
8785
- );
8786
- setBatchReview(operation);
8787
- return new Promise((resolve, reject) => {
8788
- resolution.current = { resolve, reject };
8789
- });
8790
- },
8791
- [onOpen]
8792
- );
8793
- const acceptBatchReview = useCallback(() => {
8794
- resolution.current?.resolve();
8795
- resolution.current = null;
8796
- setBatchReview(null);
8797
- }, []);
8798
- const rejectBatchReview = useCallback(() => {
8799
- resolution.current?.reject(new Error("User rejected Fluent transaction review"));
8800
- resolution.current = null;
8801
- setBatchReview(null);
8802
- }, []);
8803
- useEffect(
8804
- () => () => {
8805
- resolution.current?.reject(new Error("Fluent transaction review was closed"));
8806
- resolution.current = null;
8807
- },
8808
- []
8809
- );
8810
- return { batchReview, confirmBatchOperation, acceptBatchReview, rejectBatchReview };
8811
- }
8812
-
8813
- // src/utils/postJson.ts
8814
- var HttpError = class extends Error {
8815
- constructor(status, body) {
8816
- super(body?.message ?? body?.error ?? `Request failed with ${status}`);
8817
- this.status = status;
8818
- this.body = body;
8819
- this.name = "HttpError";
8820
- }
8821
- status;
8822
- body;
8823
- };
8824
- async function postJson(url, body, headers = {}) {
8825
- const response = await fetch(url, {
8826
- method: "POST",
8827
- headers: {
8828
- "Content-Type": "application/json",
8829
- ...headers
8830
- },
8831
- body: JSON.stringify(body)
8832
- });
8833
- if (!response.ok) {
8834
- let errorBody;
8835
- try {
8836
- errorBody = await response.json();
8837
- } catch {
8838
- errorBody = void 0;
8839
- }
8840
- throw new HttpError(response.status, errorBody);
8841
- }
8842
- return response.json();
8843
- }
8844
-
8845
- // src/utils/faucetToast.ts
8846
- function normalize(value) {
8847
- return (value ?? "").trim().toLowerCase();
8848
- }
8849
- function isAlreadyClaimed(status, message) {
8850
- const statusNorm = normalize(status);
8851
- const messageNorm = normalize(message);
8852
- return statusNorm.includes("already") || messageNorm.includes("already");
8853
- }
8854
- function toastFaucetSuccess(receipt) {
8855
- if (isAlreadyClaimed(receipt.status, receipt.message)) {
8856
- toast.add({
8857
- type: "info",
8858
- title: "Already claimed",
8859
- description: receipt.message || "BLEND faucet was already claimed for this account."
8860
- });
8861
- return;
8862
- }
8863
- toast.add({
8864
- type: "success",
8865
- title: "Faucet claimed",
8866
- description: receipt.message || (receipt.txHash ? `Transaction ${receipt.txHash}` : "BLEND was sent to your wallet.")
8867
- });
9755
+ () => resolveGasPaymentSelection({ gasPaymentToken, availableTokens }),
9756
+ [gasPaymentToken, availableTokens]
9757
+ );
9758
+ const defaultConfirmationMode = silentSigningEnabled ? "session" : "always";
9759
+ return { selectedGasPaymentToken, defaultConfirmationMode };
8868
9760
  }
8869
- function toastFaucetError(error) {
8870
- if (error instanceof HttpError) {
8871
- if (isAlreadyClaimed(error.body?.status, error.message) || error.status === 409) {
8872
- toast.add({
8873
- type: "info",
8874
- title: "Already claimed",
8875
- description: error.message || "BLEND faucet was already claimed for this account."
8876
- });
8877
- return;
8878
- }
8879
- if (error.status === 429) {
8880
- toast.add({
8881
- type: "warning",
8882
- title: "Too many requests",
8883
- description: error.message || "Please wait a moment and try again."
9761
+ function useBatchReview(options) {
9762
+ const [batchReview, setBatchReview] = useState(null);
9763
+ const resolution = useRef(null);
9764
+ const onOpen = options?.onOpen;
9765
+ const confirmBatchOperation = useCallback(
9766
+ (operation) => {
9767
+ onOpen?.();
9768
+ resolution.current?.reject(
9769
+ new Error("A newer Fluent transaction review replaced this request")
9770
+ );
9771
+ setBatchReview(operation);
9772
+ return new Promise((resolve, reject) => {
9773
+ resolution.current = { resolve, reject };
8884
9774
  });
8885
- return;
8886
- }
8887
- toast.add({
8888
- type: "error",
8889
- title: "Faucet request failed",
8890
- description: error.message || `Request failed with ${error.status}`
8891
- });
8892
- return;
8893
- }
8894
- toast.add({
8895
- type: "error",
8896
- title: "Faucet request failed",
8897
- description: error instanceof Error ? error.message : "Something went wrong."
8898
- });
8899
- }
8900
-
8901
- // src/utils/getAnonymousId.ts
8902
- function getAnonymousId() {
8903
- const storageKey = "fluent_demo_visitor_id";
8904
- const existing = localStorage.getItem(storageKey);
8905
- if (existing) return existing;
8906
- const next = crypto.randomUUID?.() ?? `visitor_${Date.now()}_${Math.random().toString(16).slice(2)}`;
8907
- localStorage.setItem(storageKey, next);
8908
- return next;
9775
+ },
9776
+ [onOpen]
9777
+ );
9778
+ const acceptBatchReview = useCallback(() => {
9779
+ resolution.current?.resolve();
9780
+ resolution.current = null;
9781
+ setBatchReview(null);
9782
+ }, []);
9783
+ const rejectBatchReview = useCallback(() => {
9784
+ resolution.current?.reject(new Error("User rejected Fluent transaction review"));
9785
+ resolution.current = null;
9786
+ setBatchReview(null);
9787
+ }, []);
9788
+ useEffect(
9789
+ () => () => {
9790
+ resolution.current?.reject(new Error("Fluent transaction review was closed"));
9791
+ resolution.current = null;
9792
+ },
9793
+ []
9794
+ );
9795
+ return { batchReview, confirmBatchOperation, acceptBatchReview, rejectBatchReview };
8909
9796
  }
8910
-
8911
- // src/widget/hooks/useFaucet.ts
8912
9797
  function useFaucet(params) {
8913
9798
  const {
8914
9799
  session,
@@ -9060,7 +9945,7 @@ async function sendCallsViaExternalWallet(calls, wallet, chain, publicClient) {
9060
9945
  }
9061
9946
  const hash = hashes[hashes.length - 1];
9062
9947
  if (!hash) throw new Error("A Fluent batch operation requires at least one call");
9063
- return { hash, hashes, atomic: false };
9948
+ return { hash, hashes, atomic: false, sponsored: false };
9064
9949
  }
9065
9950
 
9066
9951
  // src/widget/hooks/useWidgetExecution.ts
@@ -9074,7 +9959,8 @@ function useWidgetExecution(params) {
9074
9959
  defaultConfirmationMode,
9075
9960
  selectedGasPaymentToken,
9076
9961
  confirmBatchOperation,
9077
- refreshBalances
9962
+ refreshBalances,
9963
+ track
9078
9964
  } = params;
9079
9965
  const eoaPublicClient = useMemo(
9080
9966
  () => createPublicClient({ chain, transport: createFluentRpcTransport(chain) }),
@@ -9083,9 +9969,10 @@ function useWidgetExecution(params) {
9083
9969
  const sendCalls = useCallback(
9084
9970
  async (calls, options) => {
9085
9971
  if (fluentAccountReady) {
9086
- const hash = await smartAccount.sendCalls(calls, options);
9972
+ const { hash, sponsored, sponsorshipReason, paymaster } = await smartAccount.sendCalls(calls, options);
9973
+ track("wallet_gas_sponsored", { sponsored, reason: sponsorshipReason });
9087
9974
  refreshBalances();
9088
- return { hash, hashes: [hash], atomic: true };
9975
+ return { hash, hashes: [hash], atomic: true, sponsored, paymaster };
9089
9976
  }
9090
9977
  if (wallet?.connected && wallet.walletClient) {
9091
9978
  const result = await sendCallsViaExternalWallet(calls, wallet, chain, eoaPublicClient);
@@ -9094,7 +9981,15 @@ function useWidgetExecution(params) {
9094
9981
  }
9095
9982
  throw new Error("No Fluent account is available to execute this operation");
9096
9983
  },
9097
- [wallet, chain, eoaPublicClient, fluentAccountReady, refreshBalances, smartAccount.sendCalls]
9984
+ [
9985
+ wallet,
9986
+ chain,
9987
+ eoaPublicClient,
9988
+ fluentAccountReady,
9989
+ refreshBalances,
9990
+ smartAccount.sendCalls,
9991
+ track
9992
+ ]
9098
9993
  );
9099
9994
  const createBatchOp = useCallback(
9100
9995
  (input) => createFluentBatchOp(input, {
@@ -9226,7 +10121,7 @@ function useHostedConnect(params) {
9226
10121
  const {
9227
10122
  fluentConnect,
9228
10123
  authorizeUrl,
9229
- clientId,
10124
+ partnerId,
9230
10125
  appName,
9231
10126
  authMode,
9232
10127
  setSession,
@@ -9248,10 +10143,10 @@ function useHostedConnect(params) {
9248
10143
  } catch {
9249
10144
  }
9250
10145
  const url = fluentConnect.buildAuthorizeUrl(state).toString();
9251
- debugLog("[fluent widget] open connect", { state, authorizeUrl: url, clientId, appName, authMode });
10146
+ debugLog("[fluent widget] open connect", { state, authorizeUrl: url, partnerId, appName, authMode });
9252
10147
  setHostedAuthorizeUrl(url);
9253
10148
  setConnectOpen(true);
9254
- }, [appName, authMode, clientId, fluentConnect, setConnectOpen]);
10149
+ }, [appName, authMode, partnerId, fluentConnect, setConnectOpen]);
9255
10150
  const acceptHostedResult = useCallback(
9256
10151
  (data) => {
9257
10152
  if (!data || typeof data !== "object") return;
@@ -9355,7 +10250,15 @@ function useHostedConnect(params) {
9355
10250
  return { hostedAuthorizeUrl, beginHostedConnect };
9356
10251
  }
9357
10252
  function useAccountMenu(params) {
9358
- const { accountMenuAddress, network, hasConnectedAccount, setAccountOpen, requestDisconnect, track } = params;
10253
+ const {
10254
+ accountMenuAddress,
10255
+ network,
10256
+ hasConnectedAccount,
10257
+ setAccountOpen,
10258
+ requestDisconnect,
10259
+ onOpenSettings,
10260
+ track
10261
+ } = params;
9359
10262
  const openAccountMenu = useCallback(() => setAccountOpen(true), [setAccountOpen]);
9360
10263
  const handleAccountMenuAction = useCallback(
9361
10264
  (value) => {
@@ -9375,11 +10278,15 @@ function useAccountMenu(params) {
9375
10278
  copyAddressToClipboard(accountMenuAddress);
9376
10279
  return;
9377
10280
  }
10281
+ if (value === "settings") {
10282
+ onOpenSettings?.();
10283
+ return;
10284
+ }
9378
10285
  if (value === "disconnect") {
9379
10286
  requestDisconnect();
9380
10287
  }
9381
10288
  },
9382
- [accountMenuAddress, network, requestDisconnect, track]
10289
+ [accountMenuAddress, network, onOpenSettings, requestDisconnect, track]
9383
10290
  );
9384
10291
  const wasConnected = useRef(hasConnectedAccount);
9385
10292
  useEffect(() => {
@@ -9389,6 +10296,87 @@ function useAccountMenu(params) {
9389
10296
  }, [hasConnectedAccount, setAccountOpen]);
9390
10297
  return { openAccountMenu, handleAccountMenuAction };
9391
10298
  }
10299
+ function authTokenCacheKey(params) {
10300
+ return `${params.publicApiUrl}|${params.partnerId}|${params.subject}`;
10301
+ }
10302
+ function useAuthToken(params) {
10303
+ const {
10304
+ publicApiUrl,
10305
+ partnerId,
10306
+ authMode,
10307
+ renewalOffsetSeconds,
10308
+ accountType,
10309
+ privyUserId,
10310
+ getAccessToken,
10311
+ identityToken,
10312
+ walletAddress,
10313
+ walletClient
10314
+ } = params;
10315
+ const cache = useRef(null);
10316
+ const inFlight = useRef(null);
10317
+ return useCallback(async () => {
10318
+ if (authMode === "hosted") {
10319
+ throw new FluentAuthError(
10320
+ "hosted_not_supported",
10321
+ 'getAuthToken() needs authMode: "direct" \u2014 the hosted bridge does not hand over the Privy access token.'
10322
+ );
10323
+ }
10324
+ const subject = accountType === "smart" && privyUserId ? `privy:${privyUserId}` : accountType === "eoa" && walletAddress ? `wallet:${walletAddress.toLowerCase()}` : null;
10325
+ if (!subject) {
10326
+ throw new FluentAuthError("not_connected", "Connect a Fluent ID or an external wallet first.");
10327
+ }
10328
+ const key = authTokenCacheKey({ publicApiUrl, partnerId, subject });
10329
+ const cached = cache.current;
10330
+ if (cached?.key === key && cached.expiresAt - renewalOffsetSeconds * 1e3 > Date.now()) {
10331
+ return cached.token;
10332
+ }
10333
+ if (inFlight.current?.key === key) return inFlight.current.promise;
10334
+ const promise = (async () => {
10335
+ let token;
10336
+ if (subject.startsWith("privy:")) {
10337
+ const accessToken = await getAccessToken();
10338
+ if (!accessToken || !identityToken) {
10339
+ throw new FluentAuthError(
10340
+ "privy_token_missing",
10341
+ "Privy session is not ready; sign in again."
10342
+ );
10343
+ }
10344
+ token = await exchangePrivyAuthToken({ publicApiUrl, partnerId, accessToken, identityToken });
10345
+ } else {
10346
+ if (!walletClient) {
10347
+ throw new FluentAuthError("not_connected", "External wallet has no signer.");
10348
+ }
10349
+ token = await exchangeWalletAuthToken({
10350
+ publicApiUrl,
10351
+ partnerId,
10352
+ walletClient,
10353
+ address: walletAddress,
10354
+ origin: window.location.origin
10355
+ });
10356
+ }
10357
+ const expiresAt = readAuthTokenExpiry(token);
10358
+ if (expiresAt) cache.current = { key, token, expiresAt };
10359
+ return token;
10360
+ })();
10361
+ inFlight.current = { key, promise };
10362
+ try {
10363
+ return await promise;
10364
+ } finally {
10365
+ if (inFlight.current?.promise === promise) inFlight.current = null;
10366
+ }
10367
+ }, [
10368
+ accountType,
10369
+ authMode,
10370
+ renewalOffsetSeconds,
10371
+ partnerId,
10372
+ getAccessToken,
10373
+ identityToken,
10374
+ privyUserId,
10375
+ publicApiUrl,
10376
+ walletAddress,
10377
+ walletClient
10378
+ ]);
10379
+ }
9392
10380
  var DrawerContext = React2.createContext(null);
9393
10381
  function useDrawer() {
9394
10382
  const context = React2.useContext(DrawerContext);
@@ -9420,8 +10408,15 @@ function Drawer({
9420
10408
  }
9421
10409
  ) });
9422
10410
  }
9423
- function DrawerPortal({ ...props }) {
9424
- return /* @__PURE__ */ jsx(Drawer$1.Portal, { "data-slot": "drawer-portal", ...props });
10411
+ function DrawerPortal({ container, ...props }) {
10412
+ return /* @__PURE__ */ jsx(
10413
+ Drawer$1.Portal,
10414
+ {
10415
+ "data-slot": "drawer-portal",
10416
+ container: useFluentPortalContainer(container),
10417
+ ...props
10418
+ }
10419
+ );
9425
10420
  }
9426
10421
  function DrawerOverlay({
9427
10422
  className,
@@ -9479,7 +10474,7 @@ function DrawerContent({
9479
10474
  "data-snap-points": hasSnapPoints ? "" : void 0,
9480
10475
  className: cn(
9481
10476
  // Base.
9482
- "group/drawer-popup pointer-events-auto fixed z-50 m-(--drawer-inset,0px) flex h-(--drawer-content-height) max-h-(--drawer-content-max-height,none) min-h-0 w-(--drawer-content-width,auto) transform-[translate3d(var(--translate-x,0px),var(--translate-y,0px),0)_scale(var(--stack-scale))] flex-col rounded-[min(var(--radius-4xl),24px)] border border-white/10 bg-popover text-sm text-popover-foreground shadow-xl transition-[transform,height,opacity,filter] duration-450 ease-[cubic-bezier(0.22,1,0.36,1)] will-change-transform outline-none select-none [--drawer-bleed-background:transparent] [--drawer-inset:--spacing(2)] [--drawer-stacked-shadow:0_-20px_25px_-5px_rgb(0_0_0/0.1),0_-8px_10px_-6px_rgb(0_0_0/0.1)] [interpolate-size:allow-keywords] data-[swipe-direction=down]:data-nested-drawer-open:shadow-(--drawer-stacked-shadow)",
10477
+ "group/drawer-popup pointer-events-auto fixed z-50 m-(--drawer-inset,0px) flex h-(--drawer-content-height) max-h-(--drawer-content-max-height,none) min-h-0 w-(--drawer-content-width,auto) transform-[translate3d(var(--translate-x,0px),var(--translate-y,0px),0)_scale(var(--stack-scale))] flex-col rounded-[min(var(--radius-4xl),24px)] border border-foreground/10 bg-popover text-sm text-popover-foreground shadow-xl transition-[transform,height,opacity,filter] duration-450 ease-[cubic-bezier(0.22,1,0.36,1)] will-change-transform outline-none select-none [--drawer-bleed-background:transparent] [--drawer-inset:--spacing(2)] [--drawer-stacked-shadow:0_-20px_25px_-5px_rgb(0_0_0/0.1),0_-8px_10px_-6px_rgb(0_0_0/0.1)] [interpolate-size:allow-keywords] data-[swipe-direction=down]:data-nested-drawer-open:shadow-(--drawer-stacked-shadow)",
9483
10478
  // Nested.
9484
10479
  "data-nested-drawer-open:overflow-hidden data-nested-drawer-open:brightness-95",
9485
10480
  // Bleed.
@@ -9537,35 +10532,73 @@ function DrawerHeader({ className, ...props }) {
9537
10532
  }
9538
10533
  );
9539
10534
  }
9540
- function FluentAccountDrawer(props) {
9541
- const {
9542
- accountOpen,
9543
- setAccountOpen,
9544
- hasConnectedAccount,
9545
- isMobile,
9546
- connectButton,
9547
- accountMenuAddress,
9548
- onAccountMenuAction,
9549
- children
9550
- } = props;
10535
+ function DrawerTitle({ className, ...props }) {
10536
+ return /* @__PURE__ */ jsx(
10537
+ Drawer$1.Title,
10538
+ {
10539
+ "data-slot": "drawer-title",
10540
+ className: cn(
10541
+ "text-base font-medium text-foreground",
10542
+ className
10543
+ ),
10544
+ ...props
10545
+ }
10546
+ );
10547
+ }
10548
+ function FluentAccountDrawer({
10549
+ accountOpen,
10550
+ setAccountOpen,
10551
+ hasConnectedAccount,
10552
+ isMobile,
10553
+ connectButton,
10554
+ accountMenuAddress,
10555
+ onAccountMenuAction,
10556
+ settingsOpen,
10557
+ onCloseSettings,
10558
+ modal,
10559
+ disablePointerDismissal,
10560
+ children,
10561
+ userLogoUrl
10562
+ }) {
9551
10563
  return /* @__PURE__ */ jsxs(
9552
10564
  Drawer,
9553
10565
  {
9554
10566
  open: hasConnectedAccount && accountOpen,
9555
10567
  onOpenChange: setAccountOpen,
9556
10568
  swipeDirection: isMobile ? "down" : "right",
10569
+ modal,
10570
+ disablePointerDismissal,
9557
10571
  children: [
9558
10572
  connectButton,
9559
- hasConnectedAccount ? /* @__PURE__ */ jsxs(DrawerContent, { "aria-label": "Connected account", className: "dark text-white antialiased sm:w-96", children: [
9560
- /* @__PURE__ */ jsx(DrawerHeader, { className: "items-stretch p-4 pb-0", children: accountMenuAddress ? /* @__PURE__ */ jsxs(Select, { value: null, onValueChange: onAccountMenuAction, children: [
10573
+ hasConnectedAccount ? /* @__PURE__ */ jsxs(DrawerContent, { "aria-label": "Connected account", className: "dark text-foreground antialiased sm:w-96", children: [
10574
+ /* @__PURE__ */ jsx(DrawerHeader, { className: "items-stretch p-4 pb-0", children: settingsOpen ? /* @__PURE__ */ jsxs("div", { className: "relative flex h-11 items-center justify-center", children: [
10575
+ /* @__PURE__ */ jsx(
10576
+ "button",
10577
+ {
10578
+ type: "button",
10579
+ "aria-label": "Back",
10580
+ className: "absolute left-0 inline-flex size-8 items-center justify-center rounded-lg text-foreground/70 transition-colors hover:bg-foreground/5 hover:text-foreground",
10581
+ onClick: onCloseSettings,
10582
+ children: /* @__PURE__ */ jsx(ChevronLeft, { className: "size-5" })
10583
+ }
10584
+ ),
10585
+ /* @__PURE__ */ jsx(DrawerTitle, { className: "text-sm font-medium leading-none text-foreground", children: "Settings" })
10586
+ ] }) : accountMenuAddress ? /* @__PURE__ */ jsxs(Select, { value: null, onValueChange: onAccountMenuAction, children: [
9561
10587
  /* @__PURE__ */ jsxs(
9562
10588
  SelectTrigger,
9563
10589
  {
9564
10590
  "aria-label": "Account actions",
9565
- className: "!h-auto w-full gap-2 overflow-hidden rounded-xl border border-white/10 !bg-transparent p-1.5 pr-3 hover:border-white/20 hover:!bg-white/5 aria-expanded:border-white/20 aria-expanded:!bg-white/5",
10591
+ 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",
9566
10592
  children: [
9567
- /* @__PURE__ */ jsx("div", { className: "flex size-8 shrink-0 items-center justify-center rounded-md bg-white/10 text-white", children: /* @__PURE__ */ jsx(Icon, { name: "fluent", className: "size-3" }) }),
9568
- /* @__PURE__ */ jsx("span", { className: "min-w-0 flex-1 truncate text-left text-sm font-medium leading-none text-white", children: formatAddress(accountMenuAddress) })
10593
+ /* @__PURE__ */ jsx("div", { className: "flex size-8 shrink-0 items-center justify-center overflow-hidden rounded-md bg-foreground/10 text-foreground", children: userLogoUrl ? /* @__PURE__ */ jsx(
10594
+ "img",
10595
+ {
10596
+ src: userLogoUrl,
10597
+ alt: "User logo",
10598
+ className: "size-full rounded-md object-cover"
10599
+ }
10600
+ ) : /* @__PURE__ */ jsx(Icon, { name: "fluent", className: "size-3" }) }),
10601
+ /* @__PURE__ */ jsx("span", { className: "min-w-0 flex-1 truncate text-left text-sm font-medium leading-none text-foreground", children: formatAddress(accountMenuAddress) })
9569
10602
  ]
9570
10603
  }
9571
10604
  ),
@@ -9578,13 +10611,19 @@ function FluentAccountDrawer(props) {
9578
10611
  /* @__PURE__ */ jsx(Copy, { className: "size-4" }),
9579
10612
  "Copy address"
9580
10613
  ] }),
10614
+ /* @__PURE__ */ jsx(SelectSeparator, { className: "mx-2" }),
10615
+ /* @__PURE__ */ jsxs(SelectItem, { value: "settings", children: [
10616
+ /* @__PURE__ */ jsx(Settings, { className: "size-4" }),
10617
+ "Settings"
10618
+ ] }),
10619
+ /* @__PURE__ */ jsx(SelectSeparator, { className: "mx-2" }),
9581
10620
  /* @__PURE__ */ jsxs(SelectItem, { value: "disconnect", children: [
9582
10621
  /* @__PURE__ */ jsx(LogOut, { className: "size-4" }),
9583
10622
  "Disconnect"
9584
10623
  ] })
9585
10624
  ] })
9586
- ] }) : /* @__PURE__ */ jsxs("div", { className: "relative flex items-center gap-2 overflow-hidden rounded-xl border border-white/10 p-2 pr-3 shadow-2xl", children: [
9587
- /* @__PURE__ */ jsx("div", { className: "relative z-10 flex size-8 items-center justify-center rounded-md bg-white/10", children: /* @__PURE__ */ jsx(Icon, { name: "fluent", className: "size-3" }) }),
10625
+ ] }) : /* @__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: [
10626
+ /* @__PURE__ */ jsx("div", { className: "relative z-10 flex size-8 items-center justify-center rounded-md bg-foreground/10", children: /* @__PURE__ */ jsx(Icon, { name: "fluent", className: "size-3" }) }),
9588
10627
  /* @__PURE__ */ jsx("div", { className: "relative z-10 text-sm font-medium leading-none", children: "Connected" })
9589
10628
  ] }) }),
9590
10629
  /* @__PURE__ */ jsx("div", { className: "flex min-h-0 flex-1 flex-col gap-3 overflow-y-auto p-4", children })
@@ -9598,25 +10637,34 @@ function FluentWidgetConnectButton({
9598
10637
  pending: pending2 = false,
9599
10638
  addressLabel,
9600
10639
  onClick,
9601
- className
10640
+ className,
10641
+ userLogoUrl
9602
10642
  }) {
10643
+ const userLogo = userLogoUrl ? /* @__PURE__ */ jsx(
10644
+ "img",
10645
+ {
10646
+ src: userLogoUrl,
10647
+ alt: "User logo",
10648
+ className: "size-full rounded-md object-cover"
10649
+ }
10650
+ ) : /* @__PURE__ */ jsx(Icon, { name: "fluent", className: "size-3" });
9603
10651
  return /* @__PURE__ */ jsxs(
9604
10652
  "button",
9605
10653
  {
9606
10654
  type: "button",
9607
- className: className ?? "bg-black p-1.5 pr-3 rounded-xl flex items-center gap-2 text-white overflow-hidden relative group",
10655
+ className: className ?? "bg-background p-1.5 pr-3 rounded-xl flex items-center gap-2 text-foreground overflow-hidden relative group",
9608
10656
  "aria-expanded": connected || void 0,
9609
10657
  "aria-busy": pending2 || void 0,
9610
10658
  disabled: pending2,
9611
10659
  onClick,
9612
10660
  children: [
9613
- /* @__PURE__ */ jsx("div", { className: "size-8 bg-white/5 rounded-md flex items-center justify-center relative z-10 ", children: pending2 ? /* @__PURE__ */ jsx(Loader2, { className: "w-full animate-spin" }) : /* @__PURE__ */ jsx(Icon, { name: "fluent", className: "size-3" }) }),
10661
+ /* @__PURE__ */ jsx("div", { className: "size-8 bg-foreground/5 rounded-md flex items-center justify-center relative z-10 ", children: pending2 ? /* @__PURE__ */ jsx(Loader2, { className: "w-full animate-spin" }) : userLogo }),
9614
10662
  /* @__PURE__ */ jsx(
9615
10663
  "div",
9616
10664
  {
9617
10665
  className: "absolute z-[1] inset-0 h-[200%] opacity-25 group-hover:opacity-50 transition-all duration-250 ease-in-out -translate-y-0 group-hover:-translate-y-5 group-hover:h-[300%]",
9618
10666
  style: {
9619
- background: "radial-gradient(152.48% 152.48% at 50% 84.8%, #000 25.21%, #5011FF 53.1%)",
10667
+ background: "radial-gradient(152.48% 152.48% at 50% 84.8%, var(--background) 25.21%, var(--brand) 53.1%)",
9620
10668
  backgroundSize: "150% auto",
9621
10669
  backgroundPosition: "center center",
9622
10670
  backgroundRepeat: "no-repeat"
@@ -9628,19 +10676,19 @@ function FluentWidgetConnectButton({
9628
10676
  }
9629
10677
  );
9630
10678
  }
9631
- function FluentConnectButtonSlot(props) {
9632
- const {
9633
- hasConnectedAccount,
9634
- connecting,
9635
- externalWalletConnected,
9636
- connectedAddress,
9637
- fluentAccountAddress,
9638
- onTopConnectClick,
9639
- openConnect,
9640
- openAccount,
9641
- renderConnectButton,
9642
- connectButton
9643
- } = props;
10679
+ function FluentConnectButtonSlot({
10680
+ hasConnectedAccount,
10681
+ connecting,
10682
+ externalWalletConnected,
10683
+ connectedAddress,
10684
+ fluentAccountAddress,
10685
+ onTopConnectClick,
10686
+ openConnect,
10687
+ openAccount,
10688
+ renderConnectButton,
10689
+ connectButton,
10690
+ userLogoUrl
10691
+ }) {
9644
10692
  const connectAddressLabel = hasConnectedAccount ? externalWalletConnected ? connectedAddress ? formatAddress(connectedAddress) : "Connected" : fluentAccountAddress ? formatAddress(fluentAccountAddress) : "Connected" : void 0;
9645
10693
  const defaultConnectButton = /* @__PURE__ */ jsx(
9646
10694
  FluentWidgetConnectButton,
@@ -9648,7 +10696,8 @@ function FluentConnectButtonSlot(props) {
9648
10696
  connected: hasConnectedAccount,
9649
10697
  pending: connecting,
9650
10698
  addressLabel: connectAddressLabel,
9651
- onClick: onTopConnectClick
10699
+ onClick: onTopConnectClick,
10700
+ userLogoUrl
9652
10701
  }
9653
10702
  );
9654
10703
  const connectButtonContext = {
@@ -9662,50 +10711,6 @@ function FluentConnectButtonSlot(props) {
9662
10711
  };
9663
10712
  return renderConnectButton?.(connectButtonContext) ?? (connectButton === false ? null : connectButton === "inline" ? defaultConnectButton : /* @__PURE__ */ jsx("div", { className: "fixed top-5 right-5 z-50", children: defaultConnectButton }));
9664
10713
  }
9665
-
9666
- // src/utils/formatExternalWallet.ts
9667
- function formatExternalWallet(wallet, status) {
9668
- return JSON.stringify(
9669
- {
9670
- status: status ?? "Waiting for wallet connection",
9671
- wallet: wallet ? {
9672
- provider: "Reown AppKit",
9673
- configured: wallet.configured,
9674
- connected: wallet.connected,
9675
- address: wallet.address,
9676
- chainId: wallet.chainId
9677
- } : null,
9678
- walletConnectEnabled: Boolean(wallet?.configured)
9679
- },
9680
- null,
9681
- 2
9682
- );
9683
- }
9684
-
9685
- // src/utils/formatSession.ts
9686
- function formatSession(session) {
9687
- if (!session) return "Waiting for Fluent login";
9688
- return JSON.stringify(
9689
- {
9690
- app: {
9691
- mode: session.app.mode,
9692
- origin: session.app.origin,
9693
- installationId: session.app.installationId,
9694
- clientId: session.app.clientId,
9695
- appName: session.app.appName
9696
- },
9697
- user: session.user,
9698
- wallet: {
9699
- smartAccountAddress: session.wallet.smartAccountAddress
9700
- },
9701
- scopes: session.scopes,
9702
- issuedAt: session.issuedAt,
9703
- idToken: session.idToken
9704
- },
9705
- null,
9706
- 2
9707
- );
9708
- }
9709
10714
  function DebugPanel(props) {
9710
10715
  const { session, wallet, walletStatus, hostedError } = props;
9711
10716
  return /* @__PURE__ */ jsxs("section", { className: "overflow-hidden rounded-2xl border border-white/10 bg-black/70 text-white shadow-2xl backdrop-blur-md", children: [
@@ -9752,13 +10757,17 @@ function FluentWidgetContent({
9752
10757
  }) {
9753
10758
  const internalWallet = useReownWallet();
9754
10759
  const isMobile = useIsMobile();
9755
- const smartAccount = useFluentZeroDevAccount({ login: requestPrivyLogin });
9756
- const { authenticated, login, logout, ready: privyReady, user } = usePrivy();
10760
+ const resolvedConfig = useMemo(() => resolveFluentWidgetConfig(config), [config]);
10761
+ const smartAccount = useFluentZeroDevAccount({
10762
+ login: requestPrivyLogin,
10763
+ partnerId: resolvedConfig.partnerId,
10764
+ sponsorshipUrl: resolvedConfig.sponsorshipUrl
10765
+ });
10766
+ const { authenticated, getAccessToken, login, logout, ready: privyReady, user } = usePrivy();
9757
10767
  const { identityToken } = useIdentityToken();
9758
10768
  const { refreshUser } = useUser();
9759
10769
  const activeWallet = wallet ?? internalWallet;
9760
10770
  const { chain } = useFluentWidgetNetwork();
9761
- const resolvedConfig = useMemo(() => resolveFluentWidgetConfig(config), [config]);
9762
10771
  const fluentConnect = useMemo(() => createFluentConnectForWidget(config), [config]);
9763
10772
  const directAuth = resolvedConfig.authMode === "direct";
9764
10773
  const directAuthRequested = useRef(
@@ -9792,7 +10801,8 @@ function FluentWidgetContent({
9792
10801
  accountMenuAddress,
9793
10802
  fluentAccountReady,
9794
10803
  hasConnectedAccount,
9795
- connecting
10804
+ connecting,
10805
+ status
9796
10806
  } = useWidgetAccount({
9797
10807
  smartAccount: {
9798
10808
  smartAccountReady: smartAccount.smartAccountReady,
@@ -9806,7 +10816,8 @@ function FluentWidgetContent({
9806
10816
  wallet: activeWallet ? {
9807
10817
  connected: activeWallet.connected,
9808
10818
  address: activeWallet.address,
9809
- hasWalletClient: Boolean(activeWallet.walletClient)
10819
+ hasWalletClient: Boolean(activeWallet.walletClient),
10820
+ reconnecting: activeWallet.reconnecting
9810
10821
  } : null,
9811
10822
  sessionUserId: session?.user?.id,
9812
10823
  sessionSmartAccountAddress: session?.wallet?.smartAccountAddress,
@@ -9814,7 +10825,6 @@ function FluentWidgetContent({
9814
10825
  });
9815
10826
  const { selectedGasPaymentToken, defaultConfirmationMode } = useGasPaymentSelection({
9816
10827
  gasPaymentToken,
9817
- tokens,
9818
10828
  network: resolvedConfig.network,
9819
10829
  silentSigningEnabled
9820
10830
  });
@@ -9833,7 +10843,7 @@ function FluentWidgetContent({
9833
10843
  const { hostedAuthorizeUrl, beginHostedConnect } = useHostedConnect({
9834
10844
  fluentConnect,
9835
10845
  authorizeUrl: resolvedConfig.authorizeUrl,
9836
- clientId: resolvedConfig.clientId,
10846
+ partnerId: resolvedConfig.partnerId,
9837
10847
  appName: resolvedConfig.appName,
9838
10848
  authMode: resolvedConfig.authMode,
9839
10849
  setSession,
@@ -9877,7 +10887,7 @@ function FluentWidgetContent({
9877
10887
  disconnectingRef.current = true;
9878
10888
  try {
9879
10889
  setAccountOpen(false);
9880
- commitSilentSigningEnabled(false);
10890
+ commitSilentSigningEnabled(FLUENT_CONNECT_DEFAULT_SILENT_SIGNING);
9881
10891
  setSession(null);
9882
10892
  resetInitialization();
9883
10893
  setDirectAuthRequested(false);
@@ -9900,7 +10910,7 @@ function FluentWidgetContent({
9900
10910
  }, [activeWallet, authenticated, commitSilentSigningEnabled, directAuth, fluentConnect, logout, setDirectAuthRequested, setSession]);
9901
10911
  const requestDisconnect = useCallback(() => {
9902
10912
  track("wallet_disconnected");
9903
- handleDisconnect();
10913
+ return handleDisconnect();
9904
10914
  }, [handleDisconnect, track]);
9905
10915
  const { openAccountMenu, handleAccountMenuAction } = useAccountMenu({
9906
10916
  accountMenuAddress,
@@ -9908,8 +10918,21 @@ function FluentWidgetContent({
9908
10918
  hasConnectedAccount,
9909
10919
  setAccountOpen,
9910
10920
  requestDisconnect,
10921
+ onOpenSettings: () => setWalletMenuTab("settings"),
9911
10922
  track
9912
10923
  });
10924
+ const lastMenuTabRef = useRef(walletMenuTab === "settings" ? "home" : walletMenuTab);
10925
+ useEffect(() => {
10926
+ if (walletMenuTab !== "settings") lastMenuTabRef.current = walletMenuTab;
10927
+ }, [walletMenuTab]);
10928
+ useEffect(() => {
10929
+ if (!accountOpen && walletMenuTab === "settings") {
10930
+ setWalletMenuTab(lastMenuTabRef.current);
10931
+ }
10932
+ }, [accountOpen, setWalletMenuTab, walletMenuTab]);
10933
+ const closeSettings = useCallback(() => {
10934
+ setWalletMenuTab(lastMenuTabRef.current);
10935
+ }, [setWalletMenuTab]);
9913
10936
  const { faucetBusy, claimFaucet } = useFaucet({
9914
10937
  session,
9915
10938
  identityToken,
@@ -9940,6 +10963,7 @@ function FluentWidgetContent({
9940
10963
  const app = fluentConnect.status().app;
9941
10964
  const nextSession = createLocalFluentSession({
9942
10965
  app,
10966
+ partnerId: resolvedConfig.partnerId,
9943
10967
  scopes: resolvedConfig.scopes,
9944
10968
  userId: user.id,
9945
10969
  email: typeof user.email?.address === "string" ? user.email.address : void 0,
@@ -10035,7 +11059,20 @@ function FluentWidgetContent({
10035
11059
  defaultConfirmationMode,
10036
11060
  selectedGasPaymentToken,
10037
11061
  confirmBatchOperation,
10038
- refreshBalances
11062
+ refreshBalances,
11063
+ track
11064
+ });
11065
+ const getAuthToken = useAuthToken({
11066
+ publicApiUrl: resolvedConfig.publicApiUrl,
11067
+ partnerId: resolvedConfig.partnerId,
11068
+ authMode: resolvedConfig.authMode,
11069
+ renewalOffsetSeconds: resolvedConfig.authTokenRenewalOffsetSeconds,
11070
+ accountType: widgetAccount.type,
11071
+ privyUserId: user?.id,
11072
+ getAccessToken,
11073
+ identityToken,
11074
+ walletAddress: activeWallet?.address,
11075
+ walletClient: activeWallet?.walletClient
10039
11076
  });
10040
11077
  const context = useMemo(
10041
11078
  () => ({
@@ -10045,9 +11082,12 @@ function FluentWidgetContent({
10045
11082
  widget: widgetApi,
10046
11083
  openConnect,
10047
11084
  openAccount: openAccountMenu,
11085
+ disconnect: requestDisconnect,
10048
11086
  hasConnectedAccount,
11087
+ status,
10049
11088
  connecting,
10050
- refreshBalances
11089
+ refreshBalances,
11090
+ getAuthToken
10051
11091
  }),
10052
11092
  [
10053
11093
  session,
@@ -10056,13 +11096,16 @@ function FluentWidgetContent({
10056
11096
  widgetApi,
10057
11097
  openConnect,
10058
11098
  openAccountMenu,
11099
+ requestDisconnect,
10059
11100
  hasConnectedAccount,
11101
+ status,
10060
11102
  connecting,
10061
- refreshBalances
11103
+ refreshBalances,
11104
+ getAuthToken
10062
11105
  ]
10063
11106
  );
10064
- const widget = /* @__PURE__ */ jsx(Toaster, { children: /* @__PURE__ */ jsxs("div", { className: "dark contents text-white antialiased", children: [
10065
- /* @__PURE__ */ jsx(
11107
+ const widget = /* @__PURE__ */ jsx(FluentPortalContainerProvider, { children: /* @__PURE__ */ jsxs(Toaster, { children: [
11108
+ /* @__PURE__ */ jsx("div", { className: WIDGET_STYLE_SCOPE, children: /* @__PURE__ */ jsx(
10066
11109
  FluentAccountDrawer,
10067
11110
  {
10068
11111
  accountOpen,
@@ -10071,6 +11114,9 @@ function FluentWidgetContent({
10071
11114
  isMobile,
10072
11115
  accountMenuAddress,
10073
11116
  onAccountMenuAction: handleAccountMenuAction,
11117
+ settingsOpen: walletMenuTab === "settings",
11118
+ onCloseSettings: closeSettings,
11119
+ userLogoUrl: getHighResTwitterAvatar(user?.twitter?.profilePictureUrl),
10074
11120
  connectButton: /* @__PURE__ */ jsx(
10075
11121
  FluentConnectButtonSlot,
10076
11122
  {
@@ -10083,7 +11129,8 @@ function FluentWidgetContent({
10083
11129
  openConnect,
10084
11130
  openAccount: openAccountMenu,
10085
11131
  renderConnectButton,
10086
- connectButton
11132
+ connectButton,
11133
+ userLogoUrl: getHighResTwitterAvatar(user?.twitter?.profilePictureUrl)
10087
11134
  }
10088
11135
  ),
10089
11136
  children: /* @__PURE__ */ jsx(
@@ -10109,58 +11156,64 @@ function FluentWidgetContent({
10109
11156
  }
10110
11157
  )
10111
11158
  }
10112
- ),
11159
+ ) }),
10113
11160
  /* @__PURE__ */ jsx(FluentWidgetProvider, { value: context, children: mode === "page" ? renderPage?.(context) : renderHome?.(context) }),
10114
- showDebugPayload && mode === "home" ? /* @__PURE__ */ jsx(
10115
- DebugPanel,
10116
- {
10117
- session,
10118
- wallet: activeWallet,
10119
- walletStatus,
10120
- hostedError
10121
- }
10122
- ) : null,
10123
- /* @__PURE__ */ jsx(
10124
- ConnectChoiceModal,
10125
- {
10126
- open: connectOpen,
10127
- onClose: () => setConnectOpen(false),
10128
- wallet: activeWallet,
10129
- fluentReady: directAuth ? privyReady : true,
10130
- authMode: resolvedConfig.authMode,
10131
- config,
10132
- fluentAuthorizeUrl: directAuth ? void 0 : hostedAuthorizeUrl,
10133
- hostedError,
10134
- track,
10135
- onExternalWalletSelected: () => {
10136
- externalWalletAnalytics.current.intent = true;
10137
- },
10138
- onFluentLogin: () => {
10139
- track("connect_login_started");
10140
- if (directAuth) {
10141
- startDirectFluentLogin();
10142
- return;
11161
+ /* @__PURE__ */ jsxs("div", { className: WIDGET_STYLE_SCOPE, children: [
11162
+ showDebugPayload && mode === "home" ? /* @__PURE__ */ jsx(
11163
+ DebugPanel,
11164
+ {
11165
+ session,
11166
+ wallet: activeWallet,
11167
+ walletStatus,
11168
+ hostedError
11169
+ }
11170
+ ) : null,
11171
+ /* @__PURE__ */ jsx(
11172
+ ConnectChoiceModal,
11173
+ {
11174
+ open: connectOpen,
11175
+ onClose: () => setConnectOpen(false),
11176
+ wallet: activeWallet,
11177
+ fluentReady: directAuth ? privyReady : true,
11178
+ authMode: resolvedConfig.authMode,
11179
+ config,
11180
+ fluentAuthorizeUrl: directAuth ? void 0 : hostedAuthorizeUrl,
11181
+ hostedError,
11182
+ track,
11183
+ onExternalWalletSelected: () => {
11184
+ externalWalletAnalytics.current.intent = true;
11185
+ },
11186
+ onFluentLogin: () => {
11187
+ track("connect_login_started");
11188
+ if (directAuth) {
11189
+ startDirectFluentLogin();
11190
+ return;
11191
+ }
11192
+ setWalletStatus("Opening hosted Fluent Connect ID");
10143
11193
  }
10144
- setWalletStatus("Opening hosted Fluent Connect ID");
10145
11194
  }
10146
- }
10147
- ),
10148
- /* @__PURE__ */ jsx(
10149
- BatchOperationReviewModal,
10150
- {
10151
- operation: batchReview,
10152
- onConfirm: acceptBatchReview,
10153
- onCancel: rejectBatchReview
10154
- }
10155
- )
11195
+ ),
11196
+ /* @__PURE__ */ jsx(
11197
+ BatchOperationReviewModal,
11198
+ {
11199
+ operation: batchReview,
11200
+ onConfirm: acceptBatchReview,
11201
+ onCancel: rejectBatchReview
11202
+ }
11203
+ )
11204
+ ] })
10156
11205
  ] }) });
10157
11206
  return widget;
10158
11207
  }
10159
11208
  var SILENT_SIGNING_REMOUNT_MS = 220;
10160
11209
  function FluentWidget(props) {
10161
11210
  setDebugLogging(props.debugLogging ?? false);
10162
- const [silentSigningEnabled, setSilentSigningEnabled] = useState(false);
10163
- const [silentSigningChecked, setSilentSigningChecked] = useState(false);
11211
+ const [silentSigningEnabled, setSilentSigningEnabled] = useState(
11212
+ FLUENT_CONNECT_DEFAULT_SILENT_SIGNING
11213
+ );
11214
+ const [silentSigningChecked, setSilentSigningChecked] = useState(
11215
+ FLUENT_CONNECT_DEFAULT_SILENT_SIGNING
11216
+ );
10164
11217
  const silentSigningRemountTimer = useRef(null);
10165
11218
  const [privyEpoch, setPrivyEpoch] = useState(0);
10166
11219
  const pendingPrivyLoginRef = useRef(false);
@@ -10172,6 +11225,7 @@ function FluentWidget(props) {
10172
11225
  [props.config]
10173
11226
  );
10174
11227
  const resolvedNetwork = resolvedConfig.network;
11228
+ const privyClientId = resolvedConfig.privyClientId;
10175
11229
  const analyticsContext = useRef({});
10176
11230
  const externalWallet = useRef({ intent: false, connected: false });
10177
11231
  const track = useMemo(
@@ -10305,33 +11359,41 @@ function FluentWidget(props) {
10305
11359
  PrivyProvider,
10306
11360
  {
10307
11361
  appId: FLUENT_CONNECT_PRIVY_APP_ID,
11362
+ clientId: privyClientId,
10308
11363
  config: privyConfig,
10309
- children: /* @__PURE__ */ jsx(ReownProvider, { network: resolvedNetwork, children: /* @__PURE__ */ jsx(
10310
- FluentWidgetContent,
11364
+ children: /* @__PURE__ */ jsx(
11365
+ ReownProvider,
10311
11366
  {
10312
- ...props,
10313
- track,
10314
- reportAnalyticsSession,
10315
- externalWalletAnalytics: externalWallet,
10316
- accountOpen,
10317
- setAccountOpen,
10318
- walletMenuTab,
10319
- setWalletMenuTab: handleTabChange,
10320
- gasPaymentToken,
10321
- setGasPaymentToken,
10322
- silentSigningEnabled,
10323
- silentSigningChecked,
10324
- onSilentSigningChange: handleSilentSigningChange,
10325
- commitSilentSigningEnabled,
10326
- requestPrivyLogin,
10327
- pendingPrivyLoginRef
11367
+ network: resolvedNetwork,
11368
+ disableAnalytics: resolvedConfig.disableAnalytics,
11369
+ children: /* @__PURE__ */ jsx(
11370
+ FluentWidgetContent,
11371
+ {
11372
+ ...props,
11373
+ track,
11374
+ reportAnalyticsSession,
11375
+ externalWalletAnalytics: externalWallet,
11376
+ accountOpen,
11377
+ setAccountOpen,
11378
+ walletMenuTab,
11379
+ setWalletMenuTab: handleTabChange,
11380
+ gasPaymentToken,
11381
+ setGasPaymentToken,
11382
+ silentSigningEnabled,
11383
+ silentSigningChecked,
11384
+ onSilentSigningChange: handleSilentSigningChange,
11385
+ commitSilentSigningEnabled,
11386
+ requestPrivyLogin,
11387
+ pendingPrivyLoginRef
11388
+ }
11389
+ )
10328
11390
  }
10329
- ) })
11391
+ )
10330
11392
  },
10331
11393
  `${resolvedNetwork}:${silentSigningEnabled ? "silent-signing" : "prompt-signing"}-${privyEpoch}`
10332
11394
  ) });
10333
11395
  }
10334
11396
 
10335
- export { Button, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, FLUENT_CONNECT_DEFAULT_ASSETS, FLUENT_GAS_PAYMENT_DEFAULT_ETH_RATES, FLUENT_GAS_PAYMENT_PRIORITY, FLUENT_WIDGET_SESSION_STORAGE_KEY, FLUENT_ZERODEV_ERC20_PAYMASTER_QUERY, FLUENT_ZERODEV_PAYMASTER_DEMO_RECIPIENT, FluentWidget, FluentWidgetConnectButton, FluentWidgetNetworkProvider, Icon, Separator, buttonVariants, clearPrivyRecentLoginMethod, createFluentBatchOp, createFluentClient, createFluentFamiliesClient, createFluentPermissionApi, createFluentPermissionClient, createFluentPermissionPolicyBuilders, createFluentPermissionSession, createFluentZeroDevErc20Paymaster, createFluentZeroDevErc20PaymasterApprovalCall, createFluentZeroDevErc20PaymasterClient, createFluentZeroDevErc20PaymasterRpcUrl, createFluentZeroDevPermissionSession, createFluentZeroDevRpcUrl, fluent2 as fluent, apps as fluentApps, fluentBridgeAbi, fluent as fluentChain, fluentChains, fluentDefinitionToViemChain, fluentDevnet, fluentDevnetTokenDefaults, fluentDevnetWidgetTokens, integrations as fluentIntegrations, l1Chains as fluentL1Chains, fluentMainnet, fluentMainnetTokenDefaults, fluentMainnetWidgetTokens, fluentTestnet, fluentTestnetTokenDefaults, fluentTestnetWidgetTokens, fluentZeroDevChainIds, formatFluentGasTokenBalance, formatFluentLocaleAmount, getApp, getContractAddressFromChain, getFluentChain, getFluentChainByChainId, getFluentChainForNetwork, getFluentDefaultGasTokens, getFluentDefaultWidgetGasTokens, getFluentExplorerBaseUrl, getFluentGasPaymentEthValue, getFluentGasPaymentTokens, getFluentGasPaymentValueTier, getFluentGasTokenAddress, getFluentTokenDefaults, getFluentTokenDefaultsForNetwork, getFluentZeroDevErc20PaymasterTokens, getL1Chain, getL1ForFluentChain, getZeroDevRpcUrl, getZerodevIntegration, isFaucetNetwork, isFluentZeroDevChain, l1DefinitionToViemChain, normalizeFluentWidgetNetwork, readFluentTokenBalances, registryVersion, resolveBridgeAddresses, resolveFluentWidgetNetworkFromEnv, resolveFluentZeroDevErc20PaymasterToken, resolveL1Definition, selectFluentGasPaymentToken, sendFluentZeroDevErc20PaymasterDemo, useFluentWidget, useFluentWidgetNetwork, useFluentZeroDevAccount, useWidget };
11397
+ export { Button, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, FLUENT_CONNECT_DEFAULT_ASSETS, FLUENT_GAS_PAYMENT_DEFAULT_ETH_RATES, FLUENT_USER_TOKEN_LIMIT, FLUENT_WIDGET_SESSION_STORAGE_KEY, FLUENT_WIDGET_USER_TOKENS_STORAGE_KEY, FLUENT_ZERODEV_ERC20_PAYMASTER_QUERY, FLUENT_ZERODEV_PAYMASTER_DEMO_RECIPIENT, FluentAuthError, FluentWidget, FluentWidgetConnectButton, FluentWidgetNetworkProvider, Icon, Separator, buttonVariants, clearPrivyRecentLoginMethod, createFluentBatchOp, createFluentClient, createFluentFamiliesClient, createFluentPermissionApi, createFluentPermissionClient, createFluentPermissionPolicyBuilders, createFluentPermissionSession, createFluentSponsorshipRpcUrl, createFluentUserTokenStore, createFluentZeroDevErc20Paymaster, createFluentZeroDevErc20PaymasterApprovalCall, createFluentZeroDevErc20PaymasterClient, createFluentZeroDevErc20PaymasterRpcUrl, createFluentZeroDevPermissionSession, createFluentZeroDevRpcUrl, createFluentZeroDevSponsoredPaymaster, findFluentSymbolCollisions, fluent2 as fluent, apps as fluentApps, fluentBridgeAbi, fluent as fluentChain, fluentChains, fluentDefinitionToViemChain, integrations as fluentIntegrations, l1Chains as fluentL1Chains, fluentMainnet, fluentMainnetTokenDefaults, fluentTestnet, fluentTestnetTokenDefaults, fluentTokenIdentity, fluentZeroDevChainIds, getApp, getContractAddressFromChain, getFluentChain, getFluentChainByChainId, getFluentChainForNetwork, getFluentDefaultWidgetDisplayTokens, getFluentDefaultWidgetGasTokens, getFluentExplorerBaseUrl, getFluentGasPaymentEthValue, getFluentGasPaymentTokens, getFluentGasPaymentValueTier, getFluentGasTokenAddress, getFluentTokenDefaults, getFluentTokenDefaultsForNetwork, getFluentZeroDevErc20PaymasterTokens, getL1Chain, getL1ForFluentChain, getZeroDevRpcUrl, getZerodevIntegration, isFaucetNetwork, isFluentDefaultToken, isFluentNativeToken, isFluentZeroDevChain, l1DefinitionToViemChain, mergeFluentDisplayTokens, normalizeFluentWidgetNetwork, readFluentTokenBalances, readFluentTokenMetadata, registryVersion, resolveBridgeAddresses, resolveFluentWidgetNetworkFromEnv, resolveFluentZeroDevErc20PaymasterToken, resolveL1Definition, selectFluentGasPaymentToken, sendFluentZeroDevErc20PaymasterDemo, sortFluentGasTokens, useFluentUserTokens, useFluentWidget, useFluentWidgetNetwork, useFluentZeroDevAccount, useWidget };
10336
11398
  //# sourceMappingURL=index.js.map
10337
11399
  //# sourceMappingURL=index.js.map