@fluent.xyz/connect 0.1.4 → 0.1.5

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.d.ts CHANGED
@@ -495,53 +495,6 @@ declare const zerodevIntegrationSchema: z.ZodObject<{
495
495
  type ZerodevIntegration = z.infer<typeof zerodevIntegrationSchema>;
496
496
 
497
497
  declare const fluentChains: {
498
- readonly devnet: {
499
- id: string;
500
- name: string;
501
- chainId: number;
502
- testnet: boolean;
503
- nativeCurrency: {
504
- symbol: string;
505
- name: string;
506
- decimals: number;
507
- };
508
- rpcUrls: {
509
- default: {
510
- http: string[];
511
- webSocket?: string[] | undefined;
512
- };
513
- };
514
- blockExplorers: {
515
- default: {
516
- name: string;
517
- url: string;
518
- };
519
- };
520
- infoURL: string;
521
- faucets?: string[] | undefined;
522
- parent?: {
523
- type: "L2";
524
- chainId: number;
525
- bridgeUrl: string;
526
- } | undefined;
527
- contracts?: {
528
- fluentBridge?: {
529
- address: string;
530
- implementation?: string | undefined;
531
- } | undefined;
532
- universalTokenFactory?: {
533
- address: string;
534
- implementation?: string | undefined;
535
- } | undefined;
536
- paymentGateway?: {
537
- address: string;
538
- implementation?: string | undefined;
539
- } | undefined;
540
- peggedTokenPrecompile?: {
541
- address: string;
542
- } | undefined;
543
- } | undefined;
544
- };
545
498
  readonly testnet: {
546
499
  id: string;
547
500
  name: string;
@@ -728,7 +681,7 @@ declare function resolveL1Definition(definition: FluentChainDefinition): L1Chain
728
681
 
729
682
  type FluentClientConfig = {
730
683
  /** Fluent network to target. Defaults to `"testnet"`. */
731
- network?: "devnet" | "testnet" | "mainnet";
684
+ network?: "testnet" | "mainnet";
732
685
  /** Custom RPC URL. Defaults to the selected chain's built-in RPC. */
733
686
  rpcUrl?: string;
734
687
  /** Advanced override: pass a viem chain directly (takes precedence over `network`). */
@@ -810,7 +763,7 @@ type FluentPermissionClient = {
810
763
  };
811
764
  declare function createFluentPermissionClient(config: FluentPermissionClientConfig): FluentPermissionClient;
812
765
 
813
- type FluentNetworkName = "devnet" | "testnet" | "mainnet";
766
+ type FluentNetworkName = "testnet" | "mainnet";
814
767
  type FluentTokenDefinition = {
815
768
  chainId: number;
816
769
  symbol: "ETH" | "USDnr" | "BLEND" | "USDC" | "USDT" | string;
@@ -885,43 +838,6 @@ declare const fluentMainnetTokenDefaults: {
885
838
  };
886
839
  };
887
840
  declare const fluentMainnetWidgetTokens: readonly FluentTokenDefinition[];
888
- declare const fluentDevnetTokenDefaults: {
889
- readonly ETH: {
890
- readonly chainId: 20994;
891
- readonly symbol: "ETH";
892
- readonly name: "Ether";
893
- readonly decimals: 18;
894
- };
895
- readonly USDnr: {
896
- readonly chainId: 20994;
897
- readonly symbol: "USDnr";
898
- readonly name: "USDnr";
899
- readonly decimals: 18;
900
- readonly address: "0x092AE7564C6611a114C20C6df766B5B35A52334A";
901
- };
902
- readonly BLEND: {
903
- readonly chainId: 20994;
904
- readonly symbol: "BLEND";
905
- readonly name: "Mock Blend";
906
- readonly decimals: 18;
907
- readonly address: "0x83Fed707A8dDDC2535aE591CF19fB6C91D542D8E";
908
- };
909
- readonly USDC: {
910
- readonly chainId: 20994;
911
- readonly symbol: "USDC";
912
- readonly name: "USD Coin";
913
- readonly decimals: 6;
914
- readonly address: "0xC8Ebbf08Cb2A87aB90cC8EeC34C721764b7755e9";
915
- };
916
- readonly USDT: {
917
- readonly chainId: 20994;
918
- readonly symbol: "USDT";
919
- readonly name: "USDT";
920
- readonly decimals: 6;
921
- readonly address: "0xD80Ca465c268e76F0d897D44a35fC97Db75AB797";
922
- };
923
- };
924
- declare const fluentDevnetWidgetTokens: readonly FluentTokenDefinition[];
925
841
  declare function getFluentTokenDefaultsForNetwork(network: FluentNetworkName): {
926
842
  readonly ETH: {
927
843
  readonly chainId: 20994;
@@ -1009,19 +925,16 @@ declare function createFluentFamiliesClient(config: FluentFamiliesClientConfig):
1009
925
  declare function fluentDefinitionToViemChain(definition: FluentChainDefinition): Chain;
1010
926
  declare function l1DefinitionToViemChain(definition: L1ChainDefinition): Chain;
1011
927
 
1012
- /** Fluent Developer Preview (chain id 20993) */
1013
- declare const fluentDevnet: viem.Chain;
1014
928
  /** Fluent public testnet (chain id 20994) */
1015
929
  declare const fluentTestnet: viem.Chain;
1016
930
  /** Fluent mainnet (chain id 25363) */
1017
931
  declare const fluentMainnet: viem.Chain;
1018
932
  declare const fluent$1: {
1019
- readonly devnet: viem.Chain;
1020
933
  readonly testnet: viem.Chain;
1021
934
  readonly mainnet: viem.Chain;
1022
935
  };
1023
936
 
1024
- type FluentNetwork = "devnet" | "testnet" | "mainnet";
937
+ type FluentNetwork = "testnet" | "mainnet";
1025
938
  type FluentInitializeConfig = {
1026
939
  network: FluentNetwork;
1027
940
  /**
@@ -1093,8 +1006,8 @@ declare const fluent: {
1093
1006
  initialize: typeof initialize;
1094
1007
  };
1095
1008
 
1096
- type FluentWidgetNetwork = "devnet" | "testnet" | "mainnet";
1097
- declare function isFaucetNetwork(network: FluentWidgetNetwork): network is "testnet" | "devnet";
1009
+ type FluentWidgetNetwork = "testnet" | "mainnet";
1010
+ declare function isFaucetNetwork(network: FluentWidgetNetwork): network is "testnet";
1098
1011
  declare function getFluentChainForNetwork(network: FluentWidgetNetwork): Chain;
1099
1012
  declare function getFluentTokenDefaults(network: FluentWidgetNetwork): {
1100
1013
  readonly ETH: {
@@ -1560,10 +1473,32 @@ type FluentExternalWalletState = {
1560
1473
  address?: string;
1561
1474
  chainId?: number;
1562
1475
  walletClient?: WalletClient;
1476
+ /**
1477
+ * True while the wallet is being restored from a previous visit and neither
1478
+ * `connected` nor "no wallet" is known yet. Optional so hosts supplying their
1479
+ * own wallet state keep working; omitting it just means the widget reports
1480
+ * `"disconnected"` slightly earlier during a reload.
1481
+ */
1482
+ reconnecting?: boolean;
1563
1483
  open: () => void;
1564
1484
  disconnect: () => void;
1565
1485
  switchChain: (chainId: number) => Promise<void>;
1566
1486
  };
1487
+ /**
1488
+ * Top-level connection state of the widget, safe to read on any render.
1489
+ *
1490
+ * The distinction that matters is `"restoring"` vs `"disconnected"`: a session
1491
+ * restored from a previous visit is not known synchronously, so a host that
1492
+ * treats "not connected yet" as "no account" will render a Connect button at
1493
+ * users who do have a live session. Wait out `"restoring"` instead.
1494
+ *
1495
+ * - `"restoring"` — a previous session may exist; nothing is decided yet.
1496
+ * - `"connecting"` — a sign-in the user started is in flight.
1497
+ * - `"connected"` — an account is available. Whether it can send transactions
1498
+ * *right now* is a separate question — see `widget.account.executionStatus`.
1499
+ * - `"disconnected"` — no account, and none is being restored or negotiated.
1500
+ */
1501
+ type FluentWidgetStatus = "restoring" | "connecting" | "connected" | "disconnected";
1567
1502
 
1568
1503
  type FluentWidgetRenderContext = {
1569
1504
  session: FluentWidgetSession | null;
@@ -1572,8 +1507,28 @@ type FluentWidgetRenderContext = {
1572
1507
  widget: FluentBatchApi;
1573
1508
  openConnect: () => void;
1574
1509
  openAccount: () => void;
1510
+ /**
1511
+ * Tear down the current session without going through the widget's account
1512
+ * menu — the same teardown that menu's "Disconnect" runs, for both hosted and
1513
+ * direct auth. Resolves once the session, the stored identity token and any
1514
+ * external wallet connection are cleared, so a host can await it before
1515
+ * resetting its own state.
1516
+ */
1517
+ disconnect: () => Promise<void>;
1575
1518
  hasConnectedAccount: boolean;
1576
- /** True while a direct-auth smart account is being prepared after sign-in. */
1519
+ /**
1520
+ * Connection state as a single value that is meaningful on every render —
1521
+ * including the first, before a stored session has been reconciled. Branch on
1522
+ * this rather than on `hasConnectedAccount` alone: `"restoring"` and
1523
+ * `"disconnected"` both have `hasConnectedAccount === false`, and treating
1524
+ * them alike shows a Connect button to users who are already signed in.
1525
+ */
1526
+ status: FluentWidgetStatus;
1527
+ /**
1528
+ * True while a direct-auth smart account is being prepared after sign-in.
1529
+ * Equivalent to `status === "connecting"`; prefer `status`, which also covers
1530
+ * the restore-in-progress case this flag cannot express.
1531
+ */
1577
1532
  connecting: boolean;
1578
1533
  /**
1579
1534
  * Refetch the widget's on-chain balances. Transactions run through
@@ -1792,14 +1747,14 @@ declare function clearPrivyRecentLoginMethod(appId: string): void;
1792
1747
 
1793
1748
  declare const buttonVariants: (props?: ({
1794
1749
  variant?: "default" | "link" | "outline" | "secondary" | "ghost" | "destructive" | null | undefined;
1795
- size?: "default" | "xs" | "sm" | "lg" | "icon" | "icon-xs" | "icon-sm" | "icon-lg" | null | undefined;
1750
+ size?: "default" | "icon" | "xs" | "sm" | "lg" | "icon-xs" | "icon-sm" | "icon-lg" | null | undefined;
1796
1751
  } & class_variance_authority_types.ClassProp) | undefined) => string;
1797
1752
  type ButtonProps = Button$1.Props & VariantProps<typeof buttonVariants> & Pick<AnchorHTMLAttributes<HTMLAnchorElement>, "href" | "target" | "rel">;
1798
1753
  declare const Button: React.ForwardRefExoticComponent<Omit<ButtonProps, "ref"> & React.RefAttributes<HTMLButtonElement>>;
1799
1754
 
1800
1755
  declare function Dialog({ ...props }: Dialog$1.Root.Props): React.JSX.Element;
1801
1756
  declare function DialogTrigger({ ...props }: Dialog$1.Trigger.Props): React.JSX.Element;
1802
- declare function DialogPortal({ ...props }: Dialog$1.Portal.Props): React.JSX.Element;
1757
+ declare function DialogPortal({ container, ...props }: Dialog$1.Portal.Props): React.JSX.Element;
1803
1758
  declare function DialogClose({ ...props }: Dialog$1.Close.Props): React.JSX.Element;
1804
1759
  declare function DialogOverlay({ className, ...props }: Dialog$1.Backdrop.Props): React.JSX.Element;
1805
1760
  declare function DialogContent({ className, children, showCloseButton, ...props }: Dialog$1.Popup.Props & {
@@ -1819,4 +1774,4 @@ declare function Icon({ name, className, ...props }: {
1819
1774
  name: IconName;
1820
1775
  } & SVGProps<SVGSVGElement>): React.JSX.Element;
1821
1776
 
1822
- export { type AppDefinition, type BridgeAddresses, 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, type FluentAccountCapabilities, type FluentAccountType, type FluentBatchApi, type FluentBatchCallInput, type FluentBatchConfirmationMode, type FluentBatchOperation, type FluentBatchOperationExecuteOptions, type FluentBatchOperationExecutor, type FluentBatchOperationInput, type FluentBatchOperationReview, type FluentCallPermission, type FluentChainDefinition, type FluentClient, type FluentClientConfig, type FluentEncodedBatchCall, type FluentExecuteResult, type FluentExternalWalletState, type FluentFamilies, type FluentFamiliesClient, type FluentFamiliesClientConfig, type FluentFamily, type FluentFamilyTier, type FluentFamilyType, type FluentGasPayment, type FluentGasPaymentEthRates, type FluentGasPaymentSelection, type FluentGasPaymentSymbol, type FluentGasPaymentValueTier, type FluentPermissionApi, type FluentPermissionArgConstraint, type FluentPermissionArgs, type FluentPermissionBatchPolicy, type FluentPermissionBatchPolicyInput, type FluentPermissionCallInput, type FluentPermissionCallPolicy, type FluentPermissionClient, type FluentPermissionClientConfig, type FluentPermissionGrant, type FluentPermissionGrantRequest, type FluentPermissionPolicy, type FluentPermissionPolicyBuilders, type FluentPermissionPreview, type FluentPermissionSession, type FluentPermissionSessionExecutor, type FluentPermissionSessionInput, type FluentPermissionStatus, type FluentSession, type FluentSpendPeriod, type FluentSpendPermission, type FluentTokenBalance, type FluentTokenDefinition, FluentWidget, type FluentWidgetAccount, type FluentWidgetAuthMode, type FluentWidgetConfig, FluentWidgetConnectButton, type FluentWidgetConnectButtonProps, type FluentWidgetConnectButtonRenderContext, type FluentWidgetExecutionStatus, type FluentWidgetGasPayment, type FluentWidgetNetwork, FluentWidgetNetworkProvider, type FluentWidgetProps, type FluentWidgetRenderContext, type FluentWidgetSession, type FluentZeroDevErc20PaymasterToken, type FluentZeroDevErc20PaymasterTokenKey, type FluentZeroDevKernel, type FluentZeroDevPaymasterDemoResult, type FluentZeroDevPaymasterKernel, type FluentZeroDevPermissionCall, type FluentZeroDevPermissionSession, type FluentZeroDevSignerMode, Icon, type IconName, type L1ChainDefinition, type ResolvedFluentWidgetConfig, Separator, type ZerodevIntegration, buttonVariants, clearPrivyRecentLoginMethod, createFluentBatchOp, createFluentClient, createFluentFamiliesClient, createFluentPermissionApi, createFluentPermissionClient, createFluentPermissionPolicyBuilders, createFluentPermissionSession, createFluentZeroDevErc20Paymaster, createFluentZeroDevErc20PaymasterApprovalCall, createFluentZeroDevErc20PaymasterClient, createFluentZeroDevErc20PaymasterRpcUrl, createFluentZeroDevPermissionSession, createFluentZeroDevRpcUrl, fluent, apps as fluentApps, fluentBridgeAbi, fluent$1 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 };
1777
+ export { type AppDefinition, type BridgeAddresses, 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, type FluentAccountCapabilities, type FluentAccountType, type FluentBatchApi, type FluentBatchCallInput, type FluentBatchConfirmationMode, type FluentBatchOperation, type FluentBatchOperationExecuteOptions, type FluentBatchOperationExecutor, type FluentBatchOperationInput, type FluentBatchOperationReview, type FluentCallPermission, type FluentChainDefinition, type FluentClient, type FluentClientConfig, type FluentEncodedBatchCall, type FluentExecuteResult, type FluentExternalWalletState, type FluentFamilies, type FluentFamiliesClient, type FluentFamiliesClientConfig, type FluentFamily, type FluentFamilyTier, type FluentFamilyType, type FluentGasPayment, type FluentGasPaymentEthRates, type FluentGasPaymentSelection, type FluentGasPaymentSymbol, type FluentGasPaymentValueTier, type FluentPermissionApi, type FluentPermissionArgConstraint, type FluentPermissionArgs, type FluentPermissionBatchPolicy, type FluentPermissionBatchPolicyInput, type FluentPermissionCallInput, type FluentPermissionCallPolicy, type FluentPermissionClient, type FluentPermissionClientConfig, type FluentPermissionGrant, type FluentPermissionGrantRequest, type FluentPermissionPolicy, type FluentPermissionPolicyBuilders, type FluentPermissionPreview, type FluentPermissionSession, type FluentPermissionSessionExecutor, type FluentPermissionSessionInput, type FluentPermissionStatus, type FluentSession, type FluentSpendPeriod, type FluentSpendPermission, type FluentTokenBalance, type FluentTokenDefinition, FluentWidget, type FluentWidgetAccount, type FluentWidgetAuthMode, type FluentWidgetConfig, FluentWidgetConnectButton, type FluentWidgetConnectButtonProps, type FluentWidgetConnectButtonRenderContext, type FluentWidgetExecutionStatus, type FluentWidgetGasPayment, type FluentWidgetNetwork, FluentWidgetNetworkProvider, type FluentWidgetProps, type FluentWidgetRenderContext, type FluentWidgetSession, type FluentWidgetStatus, type FluentZeroDevErc20PaymasterToken, type FluentZeroDevErc20PaymasterTokenKey, type FluentZeroDevKernel, type FluentZeroDevPaymasterDemoResult, type FluentZeroDevPaymasterKernel, type FluentZeroDevPermissionCall, type FluentZeroDevPermissionSession, type FluentZeroDevSignerMode, Icon, type IconName, type L1ChainDefinition, type ResolvedFluentWidgetConfig, Separator, type ZerodevIntegration, buttonVariants, clearPrivyRecentLoginMethod, createFluentBatchOp, createFluentClient, createFluentFamiliesClient, createFluentPermissionApi, createFluentPermissionClient, createFluentPermissionPolicyBuilders, createFluentPermissionSession, createFluentZeroDevErc20Paymaster, createFluentZeroDevErc20PaymasterApprovalCall, createFluentZeroDevErc20PaymasterClient, createFluentZeroDevErc20PaymasterRpcUrl, createFluentZeroDevPermissionSession, createFluentZeroDevRpcUrl, fluent, apps as fluentApps, fluentBridgeAbi, fluent$1 as fluentChain, fluentChains, fluentDefinitionToViemChain, 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 };