@fluent.xyz/connect 0.2.3 → 0.3.1

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
@@ -1,5 +1,5 @@
1
1
  import * as viem from 'viem';
2
- import { Chain, PublicClient, Transport, Address, createPublicClient, Hex, Abi, Hash, WalletClient } from 'viem';
2
+ import { Chain, PublicClient, Transport, Address, createPublicClient, Hex, Abi, Hash, SignableMessage, TypedData, TypedDataDefinition, WalletClient } from 'viem';
3
3
  import * as React from 'react';
4
4
  import { ReactNode, AnchorHTMLAttributes, SVGProps } from 'react';
5
5
  import * as _privy_io_react_auth from '@privy-io/react-auth';
@@ -1198,7 +1198,7 @@ declare const FLUENT_CONNECT_DEFAULT_ASSETS: {
1198
1198
  };
1199
1199
 
1200
1200
  type FluentWidgetSession = FluentSession & {
1201
- partnerId?: string;
1201
+ appId?: string;
1202
1202
  idToken: string;
1203
1203
  wallet: Omit<FluentSession["wallet"], "smartAccountAddress"> & {
1204
1204
  smartAccountAddress: `0x${string}`;
@@ -1215,16 +1215,18 @@ type FluentWidgetSession = FluentSession & {
1215
1215
  };
1216
1216
  type FluentWidgetAuthMode = "hosted" | "direct";
1217
1217
  type FluentWidgetConfig = {
1218
- /** The partner's id (`partner_<32 hex>`) — the same string the console shows and the token's `aud` carries. */
1219
- partnerId: string;
1218
+ /** The App's id (`app_<32 hex>`) — the same string the Fluent Dashboard shows and the token's `aud` carries. */
1219
+ appId: string;
1220
1220
  /**
1221
- * The Privy app client issued by Fluent for this partner. Login configuration, not
1222
- * identity: it carries the allowed origins for Privy login, while `partnerId` is what
1221
+ * The Privy app client issued by Fluent for this App. Login configuration, not
1222
+ * identity: it carries the allowed origins for Privy login, while `appId` is what
1223
1223
  * sponsorship, auth and analytics speak.
1224
1224
  */
1225
1225
  privyClientId: string;
1226
- /** Removed in the PartnerId cutover — the type exists only so the error names the fix. */
1226
+ /** Removed in 0.2.0 — the type exists only so the error names the fix. */
1227
1227
  clientId?: never;
1228
+ /** Renamed to `appId` in 0.3.0 — the type exists only so the error names the fix. */
1229
+ partnerId?: never;
1228
1230
  network?: FluentWidgetNetwork;
1229
1231
  appName?: string;
1230
1232
  /**
@@ -1281,7 +1283,7 @@ type FluentWidgetConfig = {
1281
1283
  };
1282
1284
  };
1283
1285
  type ResolvedFluentWidgetConfig = {
1284
- partnerId: string;
1286
+ appId: string;
1285
1287
  privyClientId: string;
1286
1288
  network: FluentWidgetNetwork;
1287
1289
  appName: string;
@@ -1372,8 +1374,8 @@ type FluentZeroDevPermissionCall = {
1372
1374
  declare function useFluentZeroDevAccount(hookOptions?: {
1373
1375
  authorizeUrl?: string;
1374
1376
  allowHostedSigner?: boolean;
1375
- /** Partner id in the sponsorship path. Sponsorship is off unless both this and the URL are set. */
1376
- partnerId?: string;
1377
+ /** App id in the sponsorship path. Sponsorship is off unless both this and the URL are set. */
1378
+ appId?: string;
1377
1379
  sponsorshipUrl?: string;
1378
1380
  authorizationSession?: {
1379
1381
  expiresAt: number;
@@ -1418,6 +1420,12 @@ declare function createFluentZeroDevPermissionSession(params: {
1418
1420
  calls: readonly FluentZeroDevPermissionCall[];
1419
1421
  expiresAt?: number;
1420
1422
  }): Promise<FluentZeroDevPermissionSession>;
1423
+ /**
1424
+ * Runs `sign` with the Privy prompt worded for a plain signature rather than a
1425
+ * UserOperation. The prompt kernel's signer reads a module-level context because
1426
+ * Privy's `uiOptions` are fixed when the signer is built, not per call.
1427
+ */
1428
+ declare function withFluentSignaturePrompt<T>(sign: () => Promise<T>): Promise<T>;
1421
1429
 
1422
1430
  type FluentPermissionArgConstraint = {
1423
1431
  equals: unknown;
@@ -1480,6 +1488,37 @@ declare function createFluentPermissionApi(executor?: FluentPermissionSessionExe
1480
1488
  declare function createFluentPermissionPolicyBuilders(): FluentPermissionPolicyBuilders;
1481
1489
  declare function createFluentPermissionSession(input: FluentPermissionSessionInput, executor?: FluentPermissionSessionExecutor | null): Promise<FluentPermissionSession>;
1482
1490
 
1491
+ /**
1492
+ * A typed-data request with its generics erased: what the review shows and what the
1493
+ * signer receives. `signTypedData` on the public API keeps viem's generic signature so
1494
+ * hosts get their `types` checked; the erasure happens once, at the API boundary.
1495
+ */
1496
+ type FluentTypedDataRequest = TypedDataDefinition<TypedData | Record<string, unknown>, string>;
1497
+ /**
1498
+ * What the user reviews before a signature is produced. `origin` is the page asking,
1499
+ * which is the one fact a signature request cannot be trusted to state about itself;
1500
+ * `address` is the account the signature will be for.
1501
+ */
1502
+ type FluentSignatureReview = {
1503
+ origin: string;
1504
+ account: FluentWidgetAccount;
1505
+ address: Address;
1506
+ } & ({
1507
+ kind: "message";
1508
+ message: SignableMessage;
1509
+ } | {
1510
+ kind: "typedData";
1511
+ typedData: FluentTypedDataRequest;
1512
+ });
1513
+ type FluentSignApi = {
1514
+ /** EIP-191 signature. ERC-1271 (ERC-6492 before deployment) for a smart account, ECDSA for an External wallet. */
1515
+ signMessage: (params: {
1516
+ message: SignableMessage;
1517
+ }) => Promise<Hex>;
1518
+ /** EIP-712 signature. ERC-1271 (ERC-6492 before deployment) for a smart account, ECDSA for an External wallet. */
1519
+ signTypedData: <const typedData extends TypedData | Record<string, unknown>, primaryType extends keyof typedData | "EIP712Domain" = keyof typedData>(typedData: TypedDataDefinition<typedData, primaryType>) => Promise<Hex>;
1520
+ };
1521
+
1483
1522
  type FluentBatchCallInput = {
1484
1523
  id?: string;
1485
1524
  label?: string;
@@ -1533,7 +1572,7 @@ type FluentExecuteResult = {
1533
1572
  /** True when all calls landed atomically (smart account), false for sequential EOA txs. */
1534
1573
  atomic: boolean;
1535
1574
  /**
1536
- * True when a partner's sponsorship paid the gas for this operation. Read back off the
1575
+ * True when an App's sponsorship paid the gas for this operation. Read back off the
1537
1576
  * settled UserOperation (which contract the EntryPoint charged), not from which client
1538
1577
  * we chose to send with: a refusal in the sponsorship proxy is a flat 403 and the
1539
1578
  * account silently pays its own gas, so an optimistic flag would report the failure
@@ -1582,7 +1621,7 @@ type FluentGasPayment = {
1582
1621
  */
1583
1622
  symbol: FluentGasTokenSymbol;
1584
1623
  /**
1585
- * Whether to ask the partner's sponsorship paymaster to pay for this operation.
1624
+ * Whether to ask the App's sponsorship paymaster to pay for this operation.
1586
1625
  *
1587
1626
  * Defaults to `"auto"`, which is what every caller got before this option existed: try
1588
1627
  * sponsorship, and if the paymaster refuses, resend with the account paying its own gas.
@@ -1591,7 +1630,7 @@ type FluentGasPayment = {
1591
1630
  *
1592
1631
  * The distinction is not cosmetic: under `"auto"` the two outcomes are indistinguishable
1593
1632
  * before the send and only the settled receipt separates them, so a caller that wants to
1594
- * *demonstrate* unsponsored execution — or to keep a partner's budget untouched — has no
1633
+ * *demonstrate* unsponsored execution — or to keep an App's budget untouched — has no
1595
1634
  * way to say so. Ignored when `symbol` names an ERC-20: that token's own paymaster pays,
1596
1635
  * and sponsorship is not in the picture.
1597
1636
  */
@@ -1622,7 +1661,7 @@ type FluentBatchOperation = {
1622
1661
  canExecute: boolean;
1623
1662
  execute: (optionsOrExecutor?: FluentBatchOperationExecuteOptions | FluentBatchOperationExecutor, executor?: FluentBatchOperationExecutor) => Promise<FluentExecuteResult>;
1624
1663
  };
1625
- type FluentBatchApi = FluentPermissionApi & {
1664
+ type FluentBatchApi = FluentPermissionApi & FluentSignApi & {
1626
1665
  account: FluentWidgetAccount;
1627
1666
  confirmationMode: FluentBatchConfirmationMode;
1628
1667
  gasPayment: FluentWidgetGasPayment;
@@ -1701,7 +1740,7 @@ type FluentWidgetRenderContext = {
1701
1740
  refreshBalances: () => void;
1702
1741
  /**
1703
1742
  * A short-lived (5 min) Fluent-signed JWT for the connected user. Verify it on your backend
1704
- * against `<iss>/.well-known/jwks.json` (ES256), checking `iss`, `aud` (= your partnerId) and
1743
+ * against `<iss>/.well-known/jwks.json` (ES256), checking `iss`, `aud` (= your appId) and
1705
1744
  * `exp`; `sub` is stable per user per app. Reused until `authTokenRenewalOffsetSeconds`
1706
1745
  * before `exp`. Direct auth only; throws `FluentAuthError`
1707
1746
  * (`code: "hosted_not_supported"`) in hosted mode. External wallets: EOAs and deployed
@@ -1794,7 +1833,7 @@ declare function useFluentUserTokens(options?: {
1794
1833
  remove: (token: Pick<FluentTokenDefinition, "chainId" | "address">) => void;
1795
1834
  };
1796
1835
 
1797
- type FluentAuthErrorCode = "unknown_partner" | "partner_not_auth_enabled" | "origin_not_allowed" | "origin_missing" | "bad_request" | "nonce_unknown" | "nonce_used" | "nonce_expired" | "partner_mismatch" | "invalid_signature" | "signature_prefix_rejected" | "address_already_linked" | "invalid_privy_token" | "no_embedded_wallet" | "rate_limited" | "internal" | "hosted_not_supported" | "not_connected" | "privy_token_missing" | "origin_mismatch" | "request_failed";
1836
+ type FluentAuthErrorCode = "unknown_app" | "app_not_auth_enabled" | "origin_not_allowed" | "origin_missing" | "bad_request" | "nonce_unknown" | "nonce_used" | "nonce_expired" | "app_mismatch" | "invalid_signature" | "signature_prefix_rejected" | "address_already_linked" | "invalid_privy_token" | "no_embedded_wallet" | "rate_limited" | "internal" | "hosted_not_supported" | "not_connected" | "root_signer_required" | "privy_token_missing" | "origin_mismatch" | "request_failed";
1798
1837
  declare class FluentAuthError extends Error {
1799
1838
  readonly code: FluentAuthErrorCode;
1800
1839
  readonly status?: number | undefined;
@@ -1855,10 +1894,10 @@ declare function createFluentZeroDevErc20PaymasterRpcUrl(params?: {
1855
1894
  chainId?: number;
1856
1895
  projectId?: string;
1857
1896
  }): string;
1858
- /** The partner travels in the path, the user in the `Authorization` header. */
1897
+ /** The App travels in the path, the user in the `Authorization` header. */
1859
1898
  declare function createFluentSponsorshipRpcUrl(params: {
1860
1899
  sponsorshipUrl: string;
1861
- partnerId: string;
1900
+ appId: string;
1862
1901
  }): string;
1863
1902
  declare function createFluentZeroDevSponsoredPaymaster(params: {
1864
1903
  chain: Chain;
@@ -2090,4 +2129,4 @@ type AccountAvatarProps = {
2090
2129
  */
2091
2130
  declare function AccountAvatar({ userLogoUrl, defaultLogoUrl, className }: AccountAvatarProps): React.JSX.Element;
2092
2131
 
2093
- export { AccountAvatar, type AccountAvatarProps, 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_USER_TOKEN_LIMIT, FLUENT_WIDGET_SESSION_STORAGE_KEY, FLUENT_WIDGET_USER_TOKENS_STORAGE_KEY, FLUENT_ZERODEV_ERC20_PAYMASTER_QUERY, FLUENT_ZERODEV_PAYMASTER_DEMO_RECIPIENT, type FluentAccountCapabilities, FluentAccountDrawer, type FluentAccountType, FluentAuthError, type FluentAuthErrorCode, 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 FluentGasPaymentValueTier, type FluentGasTokenSymbol, 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, FluentPortalContainerProvider, type FluentSession, type FluentSpendPeriod, type FluentSpendPermission, type FluentSponsorshipReason, type FluentTokenBalance, type FluentTokenDefinition, type FluentUserTokenAddResult, 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 FluentZeroDevErc20PaymasterTokenInfo, type FluentZeroDevKernel, type FluentZeroDevPaymasterDemoResult, type FluentZeroDevPaymasterKernel, type FluentZeroDevPermissionCall, type FluentZeroDevPermissionSession, type FluentZeroDevSignerMode, Icon, type IconName, type L1ChainDefinition, Label, type ResolvedFluentWidgetConfig, Separator, Switch, type UserTokenStore, WIDGET_STYLE_SCOPE, WalletMenuActionCard, type ZerodevIntegration, buttonVariants, clearPrivyRecentLoginMethod, createFluentBatchOp, createFluentClient, createFluentFamiliesClient, createFluentPermissionApi, createFluentPermissionClient, createFluentPermissionPolicyBuilders, createFluentPermissionSession, createFluentSponsorshipRpcUrl, createFluentUserTokenStore, createFluentZeroDevErc20Paymaster, createFluentZeroDevErc20PaymasterApprovalCall, createFluentZeroDevErc20PaymasterClient, createFluentZeroDevErc20PaymasterRpcUrl, createFluentZeroDevPermissionSession, createFluentZeroDevRpcUrl, createFluentZeroDevSponsoredPaymaster, findFluentSymbolCollisions, fluent, apps as fluentApps, fluentBridgeAbi, fluent$1 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 };
2132
+ export { AccountAvatar, type AccountAvatarProps, 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_USER_TOKEN_LIMIT, FLUENT_WIDGET_SESSION_STORAGE_KEY, FLUENT_WIDGET_USER_TOKENS_STORAGE_KEY, FLUENT_ZERODEV_ERC20_PAYMASTER_QUERY, FLUENT_ZERODEV_PAYMASTER_DEMO_RECIPIENT, type FluentAccountCapabilities, FluentAccountDrawer, type FluentAccountType, FluentAuthError, type FluentAuthErrorCode, 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 FluentGasPaymentValueTier, type FluentGasTokenSymbol, 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, FluentPortalContainerProvider, type FluentSession, type FluentSignApi, type FluentSignatureReview, type FluentSpendPeriod, type FluentSpendPermission, type FluentSponsorshipReason, type FluentTokenBalance, type FluentTokenDefinition, type FluentTypedDataRequest, type FluentUserTokenAddResult, 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 FluentZeroDevErc20PaymasterTokenInfo, type FluentZeroDevKernel, type FluentZeroDevPaymasterDemoResult, type FluentZeroDevPaymasterKernel, type FluentZeroDevPermissionCall, type FluentZeroDevPermissionSession, type FluentZeroDevSignerMode, Icon, type IconName, type L1ChainDefinition, Label, type ResolvedFluentWidgetConfig, Separator, Switch, type UserTokenStore, WIDGET_STYLE_SCOPE, WalletMenuActionCard, type ZerodevIntegration, buttonVariants, clearPrivyRecentLoginMethod, createFluentBatchOp, createFluentClient, createFluentFamiliesClient, createFluentPermissionApi, createFluentPermissionClient, createFluentPermissionPolicyBuilders, createFluentPermissionSession, createFluentSponsorshipRpcUrl, createFluentUserTokenStore, createFluentZeroDevErc20Paymaster, createFluentZeroDevErc20PaymasterApprovalCall, createFluentZeroDevErc20PaymasterClient, createFluentZeroDevErc20PaymasterRpcUrl, createFluentZeroDevPermissionSession, createFluentZeroDevRpcUrl, createFluentZeroDevSponsoredPaymaster, findFluentSymbolCollisions, fluent, apps as fluentApps, fluentBridgeAbi, fluent$1 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, withFluentSignaturePrompt };