@fluent.xyz/connect 0.5.0 → 0.5.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -21,9 +21,9 @@ import { twMerge } from 'tailwind-merge';
21
21
  import { Button as Button$1 } from '@base-ui/react/button';
22
22
  import { cva } from 'class-variance-authority';
23
23
  import { XIcon, Trash2, RefreshCw, X, ChevronLeft, ExternalLink, Copy, Settings, LogOut, Loader2, ChevronDownIcon, CheckIcon, AlertTriangle, Layers, Plus, Loader2Icon, ChevronUpIcon, CircleHelp, LogIn, Send, RotateCw, KeyRound, Mail, Wallet, Check, CircleCheckIcon, InfoIcon, TriangleAlertIcon, OctagonXIcon } from 'lucide-react';
24
+ import { QueryClient, QueryClientContext, QueryClientProvider, useInfiniteQuery, useQuery } from '@tanstack/react-query';
24
25
  import { WagmiAdapter } from '@reown/appkit-adapter-wagmi';
25
26
  import { createAppKit, useAppKit } from '@reown/appkit/react';
26
- import { QueryClient, QueryClientContext, QueryClientProvider, useInfiniteQuery, useQuery } from '@tanstack/react-query';
27
27
  import { WagmiContext, WagmiProvider, useAccount, useDisconnect, useWalletClient, useSwitchChain, useConnect, usePublicClient, useBalance, useReadContract, useWriteContract, useWaitForTransactionReceipt } from 'wagmi';
28
28
  import { hydrate } from '@wagmi/core';
29
29
  import { reconnect } from 'wagmi/actions';
@@ -5278,6 +5278,9 @@ function getFluentChainForNetwork(network) {
5278
5278
  return fluentTestnet;
5279
5279
  }
5280
5280
  }
5281
+ function getFluentWidgetNetworkForChainId(chainId) {
5282
+ return chainId === fluentMainnet.id ? "mainnet" : "testnet";
5283
+ }
5281
5284
  function getFluentTokenDefaults(network) {
5282
5285
  return getFluentTokenDefaultsForNetwork(network);
5283
5286
  }
@@ -5292,16 +5295,18 @@ var FLUENT_WIDGET_USER_TOKENS_IMPORT_MARKER_KEY = "fluent:widget:tokens-import:v
5292
5295
  var FLUENT_WIDGET_REFRESH_CREDENTIAL_STORAGE_PREFIX = "fluent:widget:refresh:v1";
5293
5296
 
5294
5297
  // src/core/config.ts
5295
- var FLUENT_CONNECT_PRIVY_APP_ID = "cmi7li7v901yojv0dmtfuf0v4";
5298
+ var FLUENT_CONNECT_TESTNET_PRIVY_APP_ID = "cmi7li7v901yojv0dmtfuf0v4";
5299
+ var FLUENT_CONNECT_MAINNET_PRIVY_APP_ID = "cmig3bvhd005hkz0c2q8vdg3s";
5296
5300
  var FLUENT_CONNECT_REOWN_PROJECT_ID = "fbf7578f67b4a34e5101051131829ac0";
5297
- var FLUENT_CONNECT_ZERODEV_PROJECT_ID = "893acc63-da39-4b57-8789-5784ed7f1969";
5301
+ var FLUENT_CONNECT_TESTNET_ZERODEV_PROJECT_ID = "893acc63-da39-4b57-8789-5784ed7f1969";
5302
+ var FLUENT_CONNECT_MAINNET_ZERODEV_PROJECT_ID = "216ca7d9-2b97-4894-ac23-7aa6a287dd97";
5298
5303
  var FLUENT_CONNECT_POSTHOG_TOKEN = "phc_xr3QqFLEnKbDvmD5qsKvXuyaAdSkSKvcFGUH5VeDTLGD";
5299
5304
  var FLUENT_CONNECT_TESTNET_PUBLIC_API_URL = "https://api.fluent-connect.dev.gblend.xyz/api/v1";
5300
- var FLUENT_CONNECT_MAINNET_PUBLIC_API_URL = "https://fluent-connect.api.fluent.xyz/api/v1";
5305
+ var FLUENT_CONNECT_MAINNET_PUBLIC_API_URL = "https://api.fluent.xyz/connect/v1";
5301
5306
  var FLUENT_CONNECT_TESTNET_ANALYTICS_HOST = "https://api.fluent-connect.dev.gblend.xyz/ingest";
5302
- var FLUENT_CONNECT_MAINNET_ANALYTICS_HOST = "";
5307
+ var FLUENT_CONNECT_MAINNET_ANALYTICS_HOST = "https://api.fluent.xyz/connect/v1/ingest";
5303
5308
  var FLUENT_CONNECT_TESTNET_SPONSORSHIP_URL = "https://sponsorship.fluent-connect.dev.gblend.xyz";
5304
- var FLUENT_CONNECT_MAINNET_SPONSORSHIP_URL = "";
5309
+ var FLUENT_CONNECT_MAINNET_SPONSORSHIP_URL = "https://api.fluent.xyz/connect/v1";
5305
5310
  var FLUENT_CONNECT_TESTNET_REPUTATION_SIGNUP_URL = "https://connect-preview.vercel.app/signin";
5306
5311
  var FLUENT_CONNECT_MAINNET_REPUTATION_SIGNUP_URL = "https://connect.fluent.xyz/signin";
5307
5312
  var FLUENT_CONNECT_TESTNET_FAUCET_ENDPOINT = "https://eco-faucet-api.fluent.xyz/fluent-connect/pre-fund";
@@ -5340,6 +5345,20 @@ var FLUENT_CONNECT_NETWORK_ENDPOINTS = {
5340
5345
  function getFluentWidgetNetworkEndpoints(network) {
5341
5346
  return FLUENT_CONNECT_NETWORK_ENDPOINTS[network];
5342
5347
  }
5348
+ var FLUENT_CONNECT_ZERODEV_PROJECT_IDS = {
5349
+ testnet: FLUENT_CONNECT_TESTNET_ZERODEV_PROJECT_ID,
5350
+ mainnet: FLUENT_CONNECT_MAINNET_ZERODEV_PROJECT_ID
5351
+ };
5352
+ function getFluentZeroDevProjectId(network) {
5353
+ return FLUENT_CONNECT_ZERODEV_PROJECT_IDS[network];
5354
+ }
5355
+ var FLUENT_CONNECT_PRIVY_APP_IDS = {
5356
+ testnet: FLUENT_CONNECT_TESTNET_PRIVY_APP_ID,
5357
+ mainnet: FLUENT_CONNECT_MAINNET_PRIVY_APP_ID
5358
+ };
5359
+ function getFluentPrivyAppId(network) {
5360
+ return FLUENT_CONNECT_PRIVY_APP_IDS[network];
5361
+ }
5343
5362
  var FLUENT_CONNECT_DEFAULT_ASSETS = {
5344
5363
  fluentLogo: FLUENT_CONNECT_BUNDLED_ASSETS.fluentLogo,
5345
5364
  walletConnectIcon: FLUENT_CONNECT_BUNDLED_ASSETS.walletConnectIcon,
@@ -5378,10 +5397,10 @@ var FLUENT_CONNECT_PRIVY_CONFIG = {
5378
5397
  *
5379
5398
  * Privy resolves this once when `PrivyProvider` mounts and does not pick up a
5380
5399
  * later change to the `config` prop — which is why Quick sign used to key that
5381
- * provider and rebuild everything below it. A signer that wants Privy's
5382
- * confirmation screen asks for it per call instead (`uiOptions.showWalletUIs`,
5383
- * which wins over this), so the provider never has to be rebuilt to change
5384
- * its mind.
5400
+ * provider and rebuild everything below it. Neither signer mode shows Privy's
5401
+ * confirmation screen: Prompt mode is confirmed in the widget's own review,
5402
+ * and its signer still names `uiOptions.showWalletUIs: false` per call, which
5403
+ * wins over this.
5385
5404
  */
5386
5405
  embeddedWallets: {
5387
5406
  createOnLogin: "users-without-wallets",
@@ -6801,17 +6820,19 @@ function validateFixedLimit(field, value, maximum = maxCallGasLimit, minimum = 1
6801
6820
  }
6802
6821
  function withoutGasEstimation(client2, args, gas) {
6803
6822
  const paymaster = args.paymaster ?? client2.paymaster;
6804
- if (paymaster && (gas.paymasterVerificationGasLimit === void 0 || gas.paymasterPostOpGasLimit === void 0)) {
6823
+ const fixedPaymasterGas = gas.paymasterVerificationGasLimit !== void 0;
6824
+ if (paymaster && fixedPaymasterGas !== (gas.paymasterPostOpGasLimit !== void 0)) {
6805
6825
  throw new FluentUserOperationGasError(
6806
6826
  "invalid_policy",
6807
- "skipEstimation requires paymasterVerificationGasLimit and paymasterPostOpGasLimit when a paymaster is used"
6827
+ "skipEstimation requires both paymasterVerificationGasLimit and paymasterPostOpGasLimit or neither when a paymaster is used"
6808
6828
  );
6809
6829
  }
6810
- const limits = {
6830
+ const providerGas = Boolean(paymaster && !fixedPaymasterGas);
6831
+ let limits = {
6811
6832
  callGasLimit: gas.callGasLimit,
6812
6833
  verificationGasLimit: gas.verificationGasLimit,
6813
6834
  preVerificationGas: gas.preVerificationGas,
6814
- ...paymaster ? {
6835
+ ...paymaster && fixedPaymasterGas ? {
6815
6836
  paymasterVerificationGasLimit: gas.paymasterVerificationGasLimit,
6816
6837
  paymasterPostOpGasLimit: gas.paymasterPostOpGasLimit
6817
6838
  } : {}
@@ -6820,6 +6841,21 @@ function withoutGasEstimation(client2, args, gas) {
6820
6841
  getPaymasterStubData: (operation) => getPaymasterStubData(client2, operation),
6821
6842
  getPaymasterData: (operation) => getPaymasterData(client2, operation)
6822
6843
  } : typeof paymaster === "object" ? paymaster : void 0;
6844
+ if (providerGas && !adapter) {
6845
+ throw new FluentUserOperationGasError(
6846
+ "invalid_policy",
6847
+ "skipEstimation needs a paymaster adapter to obtain provider gas limits"
6848
+ );
6849
+ }
6850
+ const acceptGas = (data, isFinal) => {
6851
+ if (providerGas) {
6852
+ if (isFinal) assertAuthorizedGas(data, {
6853
+ callGasLimit: gas.callGasLimit,
6854
+ verificationGasLimit: gas.verificationGasLimit
6855
+ });
6856
+ limits = readProviderGas(data, limits, gas.preVerificationGas);
6857
+ } else if (isFinal) assertAuthorizedGas(data, limits);
6858
+ };
6823
6859
  return {
6824
6860
  ...args,
6825
6861
  ...limits,
@@ -6830,14 +6866,14 @@ function withoutGasEstimation(client2, args, gas) {
6830
6866
  const fixedOperation = { ...operation, ...limits };
6831
6867
  const data = await getStub.call(adapter, fixedOperation);
6832
6868
  const isFinal = !adapter.getPaymasterStubData || "isFinal" in data && data.isFinal === true;
6833
- if (isFinal) assertAuthorizedGas(data, limits);
6869
+ acceptGas(data, isFinal);
6834
6870
  return { ...data, ...limits, isFinal };
6835
6871
  },
6836
6872
  async getPaymasterData(operation) {
6837
6873
  const fixedOperation = { ...operation, ...limits };
6838
6874
  const data = await adapter.getPaymasterData(fixedOperation);
6839
- assertAuthorizedGas(data, limits);
6840
- return data;
6875
+ acceptGas(data, true);
6876
+ return { ...data, ...limits };
6841
6877
  }
6842
6878
  }
6843
6879
  } : {},
@@ -6852,6 +6888,30 @@ function withoutGasEstimation(client2, args, gas) {
6852
6888
  }
6853
6889
  };
6854
6890
  }
6891
+ function readProviderGas(data, current, preVerificationGasCeiling) {
6892
+ if (!data || typeof data !== "object") {
6893
+ throw new FluentUserOperationGasError(
6894
+ "paymaster_gas_mismatch",
6895
+ "skipEstimation requires a paymaster authorization object"
6896
+ );
6897
+ }
6898
+ const next = { ...current };
6899
+ for (const [field, minimum, maximum] of [
6900
+ ["preVerificationGas", 1n, preVerificationGasCeiling],
6901
+ ["paymasterVerificationGasLimit", 1n, maxCallGasLimit],
6902
+ ["paymasterPostOpGasLimit", 0n, maxCallGasLimit]
6903
+ ]) {
6904
+ const value = Object.hasOwn(data, field) ? Reflect.get(data, field) : current[field];
6905
+ if (typeof value !== "bigint" || value < minimum || value > maximum) {
6906
+ throw new FluentUserOperationGasError(
6907
+ "paymaster_gas_mismatch",
6908
+ `Paymaster ${field} must be a bigint between ${minimum} and ${maximum}`
6909
+ );
6910
+ }
6911
+ next[field] = value;
6912
+ }
6913
+ return next;
6914
+ }
6855
6915
  function assertAuthorizedGas(data, limits) {
6856
6916
  if (!data || typeof data !== "object") {
6857
6917
  throw new FluentUserOperationGasError(
@@ -7187,7 +7247,9 @@ function getFluentZeroDevErc20PaymasterTokens(network = "testnet") {
7187
7247
  }
7188
7248
  function createFluentZeroDevRpcUrl(params = {}) {
7189
7249
  const chainId = params.chainId ?? fluentTestnet.id;
7190
- const projectId = params.projectId ?? FLUENT_CONNECT_ZERODEV_PROJECT_ID;
7250
+ const projectId = params.projectId ?? getFluentZeroDevProjectId(
7251
+ getFluentWidgetNetworkForChainId(chainId)
7252
+ );
7191
7253
  const baseUrl = `https://rpc.zerodev.app/api/v3/${projectId}/chain/${chainId}`;
7192
7254
  return params.selfFunded ? `${baseUrl}?${FLUENT_ZERODEV_ERC20_PAYMASTER_QUERY}` : baseUrl;
7193
7255
  }
@@ -8495,6 +8557,7 @@ function toFluentSigningAccount(params) {
8495
8557
  }
8496
8558
  function useFluentZeroDevAccount(hookOptions = {}) {
8497
8559
  const { chain, network } = useFluentWidgetNetwork();
8560
+ const zeroDevProjectId = getFluentZeroDevProjectId(network);
8498
8561
  const { authenticated, login: privyLogin, ready } = usePrivy2();
8499
8562
  const login = hookOptions.login ?? privyLogin;
8500
8563
  const { signMessage: promptSignMessage } = useSignMessage2();
@@ -8533,7 +8596,7 @@ function useFluentZeroDevAccount(hookOptions = {}) {
8533
8596
  cachedSignerModes: Object.keys(kernels),
8534
8597
  initInFlight: Boolean(initPromise.current[signerMode]),
8535
8598
  throwOnError: Boolean(options.throwOnError),
8536
- hasProjectId: Boolean(FLUENT_CONNECT_ZERODEV_PROJECT_ID)
8599
+ hasProjectId: Boolean(zeroDevProjectId)
8537
8600
  });
8538
8601
  if (cachedKernel) {
8539
8602
  debugLog("[fluent zerodev] using cached kernel", {
@@ -8566,6 +8629,13 @@ function useFluentZeroDevAccount(hookOptions = {}) {
8566
8629
  debugLog("[fluent zerodev] joining in-flight initialization");
8567
8630
  return initPromise.current[signerMode];
8568
8631
  }
8632
+ if (!zeroDevProjectId) {
8633
+ setKernels({});
8634
+ setSmartAccountReady(false);
8635
+ setError(null);
8636
+ debugWarn("[fluent zerodev] initialize blocked: project id missing");
8637
+ return null;
8638
+ }
8569
8639
  setSmartAccountReady(Boolean(activeKernel));
8570
8640
  setError(null);
8571
8641
  initPromise.current[signerMode] = (async () => {
@@ -8626,7 +8696,8 @@ function useFluentZeroDevAccount(hookOptions = {}) {
8626
8696
  promptSignMessage,
8627
8697
  promptSignTypedData,
8628
8698
  readExecution,
8629
- ready
8699
+ ready,
8700
+ zeroDevProjectId
8630
8701
  ]);
8631
8702
  useEffect(() => {
8632
8703
  if (!ready) return;
@@ -8717,10 +8788,6 @@ function useFluentZeroDevAccount(hookOptions = {}) {
8717
8788
  value: (call.value ?? 0n).toString()
8718
8789
  }))
8719
8790
  });
8720
- setPromptSigningContext({
8721
- intent: "transaction",
8722
- gasTokenSymbol: options?.gasPayment?.symbol
8723
- });
8724
8791
  const signerChainCheck = execution.chainCheckBeforeSign ? readFluentSignerChainCheck(executionKernel.account) : void 0;
8725
8792
  const signingAccount = signerChainCheck ? withFluentSignerChainCheck(
8726
8793
  executionKernel.account,
@@ -8891,8 +8958,6 @@ function useFluentZeroDevAccount(hookOptions = {}) {
8891
8958
  } catch (err) {
8892
8959
  debugError("[fluent zerodev] sendCalls failed", err);
8893
8960
  throw err;
8894
- } finally {
8895
- clearPromptSigningContext();
8896
8961
  }
8897
8962
  },
8898
8963
  [
@@ -8924,7 +8989,7 @@ function useFluentZeroDevAccount(hookOptions = {}) {
8924
8989
  return executionKernel;
8925
8990
  }, [authenticated, error, initialize2, kernels, login, ready]);
8926
8991
  return {
8927
- smartAccountEnabled: Boolean(FLUENT_CONNECT_ZERODEV_PROJECT_ID),
8992
+ smartAccountEnabled: Boolean(zeroDevProjectId),
8928
8993
  smartAccountReady,
8929
8994
  smartAccountAddress: activeKernel?.smartAccountAddress,
8930
8995
  signerAddress: embeddedWallet?.address ?? hookOptions.sessionSignerAddress,
@@ -9035,7 +9100,11 @@ function createFluentZeroDevKernelClient(params) {
9035
9100
  });
9036
9101
  }
9037
9102
  async function createFluentZeroDevAuthorizedSessionKernel(authorizationSession, chain, readExecution) {
9038
- const zeroDevRpcUrl = `https://rpc.zerodev.app/api/v3/${FLUENT_CONNECT_ZERODEV_PROJECT_ID}/chain/${chain.id}`;
9103
+ const projectId = getFluentZeroDevProjectId(getFluentWidgetNetworkForChainId(chain.id));
9104
+ if (!projectId) {
9105
+ throw new Error("Fluent ZeroDev project is not configured");
9106
+ }
9107
+ const zeroDevRpcUrl = `https://rpc.zerodev.app/api/v3/${projectId}/chain/${chain.id}`;
9039
9108
  const publicClient = createPublicClient({
9040
9109
  chain,
9041
9110
  transport: createFluentRpcTransport(chain)
@@ -9067,11 +9136,13 @@ async function createFluentZeroDevAuthorizedSessionKernel(authorizationSession,
9067
9136
  };
9068
9137
  }
9069
9138
  async function createFluentZeroDevKernel(params) {
9139
+ const projectId = getFluentZeroDevProjectId(getFluentWidgetNetworkForChainId(params.chain.id));
9140
+ if (!projectId) throw new Error("Fluent ZeroDev project is not configured");
9070
9141
  if (!params.wallet) throw new Error("Fluent signer is unavailable");
9071
9142
  debugLog("[fluent zerodev] ensuring Fluent chain", params.chain.id);
9072
9143
  await ensureWalletOnFluentChain(params.wallet, params.chain);
9073
9144
  debugLog("[fluent zerodev] Fluent chain ready", params.chain.id);
9074
- const zeroDevRpcUrl = `https://rpc.zerodev.app/api/v3/${FLUENT_CONNECT_ZERODEV_PROJECT_ID}/chain/${params.chain.id}`;
9145
+ const zeroDevRpcUrl = `https://rpc.zerodev.app/api/v3/${projectId}/chain/${params.chain.id}`;
9075
9146
  const publicClient = createPublicClient({
9076
9147
  chain: params.chain,
9077
9148
  transport: createFluentRpcTransport(params.chain)
@@ -9119,38 +9190,7 @@ function createFluentZeroDevErc20ExecutionClient(kernel, gasToken, readExecution
9119
9190
  })
9120
9191
  });
9121
9192
  }
9122
- var promptSigningContext = {};
9123
- function setPromptSigningContext(context) {
9124
- promptSigningContext = context;
9125
- }
9126
- function clearPromptSigningContext() {
9127
- promptSigningContext = {};
9128
- }
9129
- async function withFluentSignaturePrompt(sign) {
9130
- setPromptSigningContext({ intent: "signature" });
9131
- try {
9132
- return await sign();
9133
- } finally {
9134
- clearPromptSigningContext();
9135
- }
9136
- }
9137
- function buildPromptSigningUiOptions() {
9138
- if (promptSigningContext.intent === "signature") {
9139
- return {
9140
- showWalletUIs: true,
9141
- title: "Sign with Fluent",
9142
- description: "Sign this request with your Fluent account. Nothing is sent on chain.",
9143
- buttonText: "Sign"
9144
- };
9145
- }
9146
- const gasTokenSymbol = promptSigningContext.gasTokenSymbol;
9147
- return {
9148
- showWalletUIs: true,
9149
- title: "Confirm Fluent transaction",
9150
- description: gasTokenSymbol ? `Gas will be paid in ${gasTokenSymbol}. Confirm this Fluent transaction.` : "Confirm this Fluent transaction.",
9151
- buttonText: "Sign"
9152
- };
9153
- }
9193
+ var PROMPT_MODE_PRIVY_UI_OPTIONS = { showWalletUIs: false };
9154
9194
  function toPromptedPrivyLocalAccount(wallet, promptedSigners) {
9155
9195
  const source = {
9156
9196
  address: wallet.address,
@@ -9159,7 +9199,7 @@ function toPromptedPrivyLocalAccount(wallet, promptedSigners) {
9159
9199
  { message: formatSignableMessageForPrivy(message2) },
9160
9200
  {
9161
9201
  address: wallet.address,
9162
- uiOptions: buildPromptSigningUiOptions()
9202
+ uiOptions: PROMPT_MODE_PRIVY_UI_OPTIONS
9163
9203
  }
9164
9204
  );
9165
9205
  return signature;
@@ -9177,7 +9217,7 @@ function toPromptedPrivyLocalAccount(wallet, promptedSigners) {
9177
9217
  },
9178
9218
  {
9179
9219
  address: wallet.address,
9180
- uiOptions: buildPromptSigningUiOptions()
9220
+ uiOptions: PROMPT_MODE_PRIVY_UI_OPTIONS
9181
9221
  }
9182
9222
  );
9183
9223
  return signature;
@@ -9646,7 +9686,7 @@ function useFluentIframeBridge(iframeRef, { allowedOrigin }) {
9646
9686
  }
9647
9687
 
9648
9688
  // package.json
9649
- var version = "0.5.0";
9689
+ var version = "0.5.2";
9650
9690
 
9651
9691
  // src/core/analytics.ts
9652
9692
  var INSTANCE_NAME = "fluent";
@@ -16786,8 +16826,8 @@ function useWidgetExecution(params) {
16786
16826
  return {
16787
16827
  signerSource: kernel.signerSource,
16788
16828
  account: {
16789
- signMessage: (params2) => withFluentSignaturePrompt(() => kernel.account.signMessage(params2)),
16790
- signTypedData: (typedData) => withFluentSignaturePrompt(() => kernel.account.signTypedData(typedData))
16829
+ signMessage: (params2) => kernel.account.signMessage(params2),
16830
+ signTypedData: (typedData) => kernel.account.signTypedData(typedData)
16791
16831
  }
16792
16832
  };
16793
16833
  },
@@ -18283,7 +18323,8 @@ function FluentWidgetContent({
18283
18323
  handledInlineLoginRequest,
18284
18324
  authTokenState,
18285
18325
  userSettingsRef,
18286
- connectedPresentation
18326
+ connectedPresentation,
18327
+ appQueryClient
18287
18328
  }) {
18288
18329
  const internalWallet = useReownWallet();
18289
18330
  const isMobile = useIsMobile();
@@ -18476,13 +18517,23 @@ function FluentWidgetContent({
18476
18517
  commitSilentSigningEnabled(FLUENT_CONNECT_DEFAULT_SILENT_SIGNING);
18477
18518
  connectedPresentation.current.connected = null;
18478
18519
  connectedPresentation.current.rebuilding = null;
18479
- clearPrivyRecentLoginMethod(FLUENT_CONNECT_PRIVY_APP_ID);
18520
+ clearPrivyRecentLoginMethod(getFluentPrivyAppId(resolvedConfig.network));
18480
18521
  if (activeWallet?.connected) activeWallet.disconnect();
18481
18522
  } finally {
18482
18523
  disconnectingRef.current = false;
18483
18524
  }
18484
18525
  if (awaitAuthSession) await authSessionEnded;
18485
- }, [activeWallet, authenticated, commitSilentSigningEnabled, connectedPresentation, fluentConnect, logout, setDirectAuthRequested, setSession]);
18526
+ }, [
18527
+ activeWallet,
18528
+ authenticated,
18529
+ commitSilentSigningEnabled,
18530
+ connectedPresentation,
18531
+ fluentConnect,
18532
+ logout,
18533
+ resolvedConfig.network,
18534
+ setDirectAuthRequested,
18535
+ setSession
18536
+ ]);
18486
18537
  const requestDisconnect = useCallback(() => {
18487
18538
  track("wallet_disconnected");
18488
18539
  return handleDisconnect({ awaitAuthSession: true });
@@ -19249,6 +19300,11 @@ function FluentWidgetContent({
19249
19300
  linkX
19250
19301
  ]
19251
19302
  );
19303
+ const appPage = (() => {
19304
+ const page = mode === "page" ? renderPage?.(context) : renderHome?.(context);
19305
+ if (!appQueryClient) return page;
19306
+ return /* @__PURE__ */ jsx(QueryClientProvider, { client: appQueryClient, children: page });
19307
+ })();
19252
19308
  const widget = /* @__PURE__ */ jsxs(FluentPortalContainerProvider, { children: [
19253
19309
  /* @__PURE__ */ jsx(FluentTopLayerBridge, {}),
19254
19310
  !session && connectedWalletAddress !== void 0 ? /* @__PURE__ */ jsx(LinkXSiweSource, { source: linkXSiwe }) : null,
@@ -19343,7 +19399,7 @@ function FluentWidgetContent({
19343
19399
  )
19344
19400
  }
19345
19401
  ) }),
19346
- /* @__PURE__ */ jsx(FluentWidgetProvider, { value: context, children: mode === "page" ? renderPage?.(context) : renderHome?.(context) }),
19402
+ /* @__PURE__ */ jsx(FluentWidgetProvider, { value: context, children: appPage }),
19347
19403
  /* @__PURE__ */ jsxs("div", { className: WIDGET_STYLE_SCOPE, children: [
19348
19404
  showDebugPayload && mode === "home" ? /* @__PURE__ */ jsx(
19349
19405
  DebugPanel,
@@ -19410,6 +19466,7 @@ function LinkXSiweSource({
19410
19466
  var SILENT_SIGNING_REMOUNT_MS = 220;
19411
19467
  function FluentWidget(props) {
19412
19468
  setDebugLogging(props.debugLogging ?? false);
19469
+ const appQueryClient = useContext(QueryClientContext);
19413
19470
  const resolvedConfig = useMemo(
19414
19471
  () => resolveFluentWidgetConfig(props.config),
19415
19472
  [props.config]
@@ -19435,6 +19492,7 @@ function FluentWidget(props) {
19435
19492
  );
19436
19493
  const resolvedNetwork = resolvedConfig.network;
19437
19494
  const privyClientId = resolvedConfig.privyClientId;
19495
+ const privyAppId = getFluentPrivyAppId(resolvedNetwork);
19438
19496
  const analyticsContext = useRef({});
19439
19497
  const externalWallet = useRef({ intent: false, connected: false });
19440
19498
  const track = useMemo(
@@ -19541,8 +19599,8 @@ function FluentWidget(props) {
19541
19599
  ]
19542
19600
  );
19543
19601
  useLayoutEffect(() => {
19544
- clearPrivyRecentLoginMethod(FLUENT_CONNECT_PRIVY_APP_ID);
19545
- }, []);
19602
+ clearPrivyRecentLoginMethod(privyAppId);
19603
+ }, [privyAppId]);
19546
19604
  const applySilentSigningEnabled = useCallback((enabled) => {
19547
19605
  setSilentSigningEnabled(enabled);
19548
19606
  }, []);
@@ -19571,9 +19629,9 @@ function FluentWidget(props) {
19571
19629
  [applySilentSigningEnabled]
19572
19630
  );
19573
19631
  const requestPrivyLogin = useCallback(() => {
19574
- clearPrivyRecentLoginMethod(FLUENT_CONNECT_PRIVY_APP_ID);
19632
+ clearPrivyRecentLoginMethod(privyAppId);
19575
19633
  setInlineLoginRequest((value) => value + 1);
19576
- }, []);
19634
+ }, [privyAppId]);
19577
19635
  useEffect(() => {
19578
19636
  return () => {
19579
19637
  if (silentSigningRemountTimer.current) {
@@ -19592,7 +19650,7 @@ function FluentWidget(props) {
19592
19650
  FluentPrivyProvider,
19593
19651
  {
19594
19652
  adapter: props.privyAdapter,
19595
- appId: FLUENT_CONNECT_PRIVY_APP_ID,
19653
+ appId: privyAppId,
19596
19654
  clientId: privyClientId,
19597
19655
  config: privyConfig,
19598
19656
  children: /* @__PURE__ */ jsx(
@@ -19617,7 +19675,8 @@ function FluentWidget(props) {
19617
19675
  handledInlineLoginRequest,
19618
19676
  authTokenState,
19619
19677
  userSettingsRef: userSettings,
19620
- connectedPresentation
19678
+ connectedPresentation,
19679
+ appQueryClient
19621
19680
  }
19622
19681
  )
19623
19682
  },
@@ -19627,6 +19686,6 @@ function FluentWidget(props) {
19627
19686
  ) });
19628
19687
  }
19629
19688
 
19630
- export { AccountAvatar, 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_DEFAULT_GAS_TOKEN, FLUENT_WIDGET_SESSION_STORAGE_KEY, FLUENT_WIDGET_USER_TOKENS_IMPORT_MARKER_KEY, FLUENT_WIDGET_USER_TOKENS_STORAGE_KEY, FLUENT_ZERODEV_ERC20_PAYMASTER_QUERY, FLUENT_ZERODEV_PAYMASTER_DEMO_RECIPIENT, FluentAccountDrawer, FluentAuthError, FluentIframeRpcError, FluentPortalContainerProvider, FluentReviewRejectedError, FluentSettingsError, FluentSponsorshipFallbackError, FluentUserOperationGasError, FluentWidget, FluentWidgetConfigError, FluentWidgetConnectButton, FluentWidgetNetworkProvider, Icon, Label, Separator, Switch, WIDGET_STYLE_SCOPE, WalletMenuActionCard, buildFluentTransferCall, buttonVariants, checkFluentTransferFee, clearPrivyRecentLoginMethod, createFluentBackendUserTokenStore, createFluentBatchOp, createFluentClient, createFluentFamiliesClient, createFluentIframeBridge, createFluentIframeRpcHandler, createFluentPermissionApi, createFluentPermissionClient, createFluentPermissionPolicyBuilders, createFluentPermissionSession, createFluentSettingsClient, createFluentSponsorshipRpcUrl, createFluentUserTokenStore, createFluentZeroDevErc20Paymaster, createFluentZeroDevErc20PaymasterApprovalCall, createFluentZeroDevErc20PaymasterClient, createFluentZeroDevErc20PaymasterRpcUrl, createFluentZeroDevPermissionSession, createFluentZeroDevRpcUrl, createFluentZeroDevSponsoredPaymaster, deriveFluentGasEthRates, findFluentSymbolCollisions, fluent2 as fluent, apps as fluentApps, fluentBridgeAbi, fluent as fluentChain, fluentChains, fluentDefinitionToViemChain, integrations as fluentIntegrations, l1Chains as fluentL1Chains, fluentMainnet, fluentMainnetTokenDefaults, fluentTestnet, fluentTestnetTokenDefaults, fluentTokenIdentity, fluentTransferAbi, 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, parseFluentTransferAmount, parseFluentTransferRecipient, readFluentTokenBalances, readFluentTokenMetadata, registryVersion, resolveBridgeAddresses, resolveDefaultGasToken, resolveFluentWidgetNetworkFromEnv, resolveFluentZeroDevErc20PaymasterToken, resolveL1Definition, selectFluentGasPaymentToken, sendFluentZeroDevErc20PaymasterDemo, sortFluentGasTokens, useFluentIframeBridge, useFluentUserTokens, useFluentWidget, useFluentWidgetNetwork, useFluentZeroDevAccount, useLinkX, useWidget, withFluentSignaturePrompt };
19689
+ export { AccountAvatar, 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_DEFAULT_GAS_TOKEN, FLUENT_WIDGET_SESSION_STORAGE_KEY, FLUENT_WIDGET_USER_TOKENS_IMPORT_MARKER_KEY, FLUENT_WIDGET_USER_TOKENS_STORAGE_KEY, FLUENT_ZERODEV_ERC20_PAYMASTER_QUERY, FLUENT_ZERODEV_PAYMASTER_DEMO_RECIPIENT, FluentAccountDrawer, FluentAuthError, FluentIframeRpcError, FluentPortalContainerProvider, FluentReviewRejectedError, FluentSettingsError, FluentSponsorshipFallbackError, FluentUserOperationGasError, FluentWidget, FluentWidgetConfigError, FluentWidgetConnectButton, FluentWidgetNetworkProvider, Icon, Label, Separator, Switch, WIDGET_STYLE_SCOPE, WalletMenuActionCard, buildFluentTransferCall, buttonVariants, checkFluentTransferFee, clearPrivyRecentLoginMethod, createFluentBackendUserTokenStore, createFluentBatchOp, createFluentClient, createFluentFamiliesClient, createFluentIframeBridge, createFluentIframeRpcHandler, createFluentPermissionApi, createFluentPermissionClient, createFluentPermissionPolicyBuilders, createFluentPermissionSession, createFluentSettingsClient, createFluentSponsorshipRpcUrl, createFluentUserTokenStore, createFluentZeroDevErc20Paymaster, createFluentZeroDevErc20PaymasterApprovalCall, createFluentZeroDevErc20PaymasterClient, createFluentZeroDevErc20PaymasterRpcUrl, createFluentZeroDevPermissionSession, createFluentZeroDevRpcUrl, createFluentZeroDevSponsoredPaymaster, deriveFluentGasEthRates, findFluentSymbolCollisions, fluent2 as fluent, apps as fluentApps, fluentBridgeAbi, fluent as fluentChain, fluentChains, fluentDefinitionToViemChain, integrations as fluentIntegrations, l1Chains as fluentL1Chains, fluentMainnet, fluentMainnetTokenDefaults, fluentTestnet, fluentTestnetTokenDefaults, fluentTokenIdentity, fluentTransferAbi, 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, parseFluentTransferAmount, parseFluentTransferRecipient, readFluentTokenBalances, readFluentTokenMetadata, registryVersion, resolveBridgeAddresses, resolveDefaultGasToken, resolveFluentWidgetNetworkFromEnv, resolveFluentZeroDevErc20PaymasterToken, resolveL1Definition, selectFluentGasPaymentToken, sendFluentZeroDevErc20PaymasterDemo, sortFluentGasTokens, useFluentIframeBridge, useFluentUserTokens, useFluentWidget, useFluentWidgetNetwork, useFluentZeroDevAccount, useLinkX, useWidget };
19631
19690
  //# sourceMappingURL=index.js.map
19632
19691
  //# sourceMappingURL=index.js.map