@privy-io/react-auth 3.4.1 → 3.5.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.
Files changed (75) hide show
  1. package/dist/cjs/EmbeddedWalletConnectingScreen-D_YsihzO.js +27 -0
  2. package/dist/cjs/SignRequestScreen-MGUrxay9.js +1 -0
  3. package/dist/cjs/abstract-smart-wallets.js +1 -1
  4. package/dist/cjs/events-context-Dn0fJZ2h.js +1 -0
  5. package/dist/cjs/extended-chains.js +1 -1
  6. package/dist/cjs/farcaster.js +1 -1
  7. package/dist/cjs/frame-B2orQ_lK.js +1 -0
  8. package/dist/cjs/index.js +7 -7
  9. package/dist/cjs/internal-context-CeWKmK5u.js +1 -0
  10. package/dist/cjs/internal.js +1 -0
  11. package/dist/cjs/smart-wallets-5q-XiLac.js +1 -0
  12. package/dist/cjs/smart-wallets.js +1 -1
  13. package/dist/cjs/solana.js +1 -1
  14. package/dist/cjs/ui.js +2 -2
  15. package/dist/cjs/use-export-wallet-C7R1A29C.js +2 -0
  16. package/dist/cjs/use-sign-with-user-signer-BtJVKMQr.js +1 -0
  17. package/dist/cjs/useActiveWallet-E94x91YD.js +1 -0
  18. package/dist/cjs/usePrivy-BEZb4Uky.js +1 -0
  19. package/dist/dts/events-context-DB3Pn5Hg.d.mts +328 -0
  20. package/dist/dts/events-context-DB3Pn5Hg.d.ts +328 -0
  21. package/dist/dts/extended-chains.d.mts +24 -2
  22. package/dist/dts/extended-chains.d.ts +24 -2
  23. package/dist/dts/farcaster.d.mts +1 -1
  24. package/dist/dts/farcaster.d.ts +1 -1
  25. package/dist/dts/index.d.mts +20 -332
  26. package/dist/dts/index.d.ts +20 -332
  27. package/dist/dts/internal.d.mts +44 -0
  28. package/dist/dts/internal.d.ts +44 -0
  29. package/dist/dts/smart-wallets.d.mts +1 -1
  30. package/dist/dts/smart-wallets.d.ts +1 -1
  31. package/dist/dts/solana.d.mts +31 -7
  32. package/dist/dts/solana.d.ts +31 -7
  33. package/dist/dts/{types-BF33BYgd.d.mts → types-C4KyGxEF.d.mts} +3 -3
  34. package/dist/dts/{types-BF33BYgd.d.ts → types-C4KyGxEF.d.ts} +3 -3
  35. package/dist/dts/ui.d.mts +1 -1
  36. package/dist/dts/ui.d.ts +1 -1
  37. package/dist/esm/EmbeddedWalletConnectingScreen-ilL_GaJO.mjs +25 -0
  38. package/dist/esm/SignRequestScreen-B3UhThlp.mjs +1 -0
  39. package/dist/esm/abstract-smart-wallets.mjs +1 -1
  40. package/dist/esm/events-context-CB7CF-OC.mjs +1 -0
  41. package/dist/esm/extended-chains.mjs +1 -1
  42. package/dist/esm/farcaster.mjs +1 -1
  43. package/dist/esm/frame-Dj70FEYB.mjs +1 -0
  44. package/dist/esm/index.mjs +6 -6
  45. package/dist/esm/internal-context-eGSwROSk.mjs +1 -0
  46. package/dist/esm/internal.mjs +1 -0
  47. package/dist/esm/smart-wallets-DINPJbZr.mjs +1 -0
  48. package/dist/esm/smart-wallets.mjs +1 -1
  49. package/dist/esm/solana.mjs +1 -1
  50. package/dist/esm/ui.mjs +2 -2
  51. package/dist/esm/use-export-wallet-CED1-6Km.mjs +1 -0
  52. package/dist/esm/use-sign-with-user-signer-DaTvrd5T.mjs +1 -0
  53. package/dist/esm/useActiveWallet-2NxrDpZU.mjs +1 -0
  54. package/dist/esm/usePrivy-DhsfOIjx.mjs +1 -0
  55. package/package.json +21 -7
  56. package/dist/cjs/SignRequestScreen-cAAtS6nl.js +0 -27
  57. package/dist/cjs/frame-8JZCzmCf.js +0 -1
  58. package/dist/cjs/internal-context-DNWjSiYq.js +0 -1
  59. package/dist/cjs/paths-B00ZrFQm.js +0 -1
  60. package/dist/cjs/privy-context-NMR-GjnL.js +0 -1
  61. package/dist/cjs/smart-wallets-65yy6DGK.js +0 -1
  62. package/dist/cjs/use-export-wallet-9ypqLaaB.js +0 -2
  63. package/dist/cjs/use-sign-with-user-signer-Q0_LRVtz.js +0 -1
  64. package/dist/cjs/useActiveWallet-CtNcsjJH.js +0 -1
  65. package/dist/cjs/usePrivy-dGz-b0SX.js +0 -1
  66. package/dist/esm/SignRequestScreen-cNZ56bAg.mjs +0 -25
  67. package/dist/esm/frame-Dh-xhHMG.mjs +0 -1
  68. package/dist/esm/internal-context-CfE_S5P-.mjs +0 -1
  69. package/dist/esm/paths-B891YjWw.mjs +0 -1
  70. package/dist/esm/privy-context-DDSW3jEM.mjs +0 -1
  71. package/dist/esm/smart-wallets-_lFo8N6W.mjs +0 -1
  72. package/dist/esm/use-export-wallet-E2KvvjYq.mjs +0 -1
  73. package/dist/esm/use-sign-with-user-signer-DVcbjNtZ.mjs +0 -1
  74. package/dist/esm/useActiveWallet-BLu2tB4S.mjs +0 -1
  75. package/dist/esm/usePrivy-DmWciddF.mjs +0 -1
@@ -1,5 +1,5 @@
1
1
  import { ExtendedChainType, WalletResponseType, CurveSigningChainType } from '@privy-io/public-api';
2
- import { U as User } from './types-BF33BYgd.js';
2
+ import { U as User } from './types-C4KyGxEF.js';
3
3
  import '@coinbase/wallet-sdk';
4
4
  import '@simplewebauthn/browser';
5
5
  import '@solana/kit';
@@ -28,6 +28,28 @@ interface UseCreateWalletInterface {
28
28
  }
29
29
  declare const useCreateWallet: () => UseCreateWalletInterface;
30
30
 
31
+ /**
32
+ * Hook to export extended chain wallets (e.g., spark wallets).
33
+ * These are wallets built on the unified stack.
34
+ */
35
+ interface UseExportWalletInterface {
36
+ /**
37
+ * Shows the user a Privy modal, from which they can copy their embedded wallet's private
38
+ * key for easy export to another wallet client. The private key is loaded
39
+ * on an iframe running on a separate domain from your app, meaning your app cannot access it.
40
+ *
41
+ * This method will error if the user is not authenticated or does not have an embedded wallet
42
+ * for the specified address.
43
+ *
44
+ * @param options {@link {address: string}} wallet address to export the private key for
45
+ * @returns Promise that resolves once the user exits the modal
46
+ */
47
+ exportWallet: (options: {
48
+ address: string;
49
+ }) => Promise<void>;
50
+ }
51
+ declare function useExportWallet(): UseExportWalletInterface;
52
+
31
53
  interface SignRawHashInput {
32
54
  /** The address of the wallet to sign the hash with. */
33
55
  address: string;
@@ -49,4 +71,4 @@ interface UseSignRawHashInterface {
49
71
  }
50
72
  declare const useSignRawHash: () => UseSignRawHashInterface;
51
73
 
52
- export { useCreateWallet, useSignRawHash };
74
+ export { useCreateWallet, useExportWallet, useSignRawHash };
@@ -1,5 +1,5 @@
1
1
  import { ExtendedChainType, WalletResponseType, CurveSigningChainType } from '@privy-io/public-api';
2
- import { U as User } from './types-BF33BYgd.js';
2
+ import { U as User } from './types-C4KyGxEF.js';
3
3
  import '@coinbase/wallet-sdk';
4
4
  import '@simplewebauthn/browser';
5
5
  import '@solana/kit';
@@ -28,6 +28,28 @@ interface UseCreateWalletInterface {
28
28
  }
29
29
  declare const useCreateWallet: () => UseCreateWalletInterface;
30
30
 
31
+ /**
32
+ * Hook to export extended chain wallets (e.g., spark wallets).
33
+ * These are wallets built on the unified stack.
34
+ */
35
+ interface UseExportWalletInterface {
36
+ /**
37
+ * Shows the user a Privy modal, from which they can copy their embedded wallet's private
38
+ * key for easy export to another wallet client. The private key is loaded
39
+ * on an iframe running on a separate domain from your app, meaning your app cannot access it.
40
+ *
41
+ * This method will error if the user is not authenticated or does not have an embedded wallet
42
+ * for the specified address.
43
+ *
44
+ * @param options {@link {address: string}} wallet address to export the private key for
45
+ * @returns Promise that resolves once the user exits the modal
46
+ */
47
+ exportWallet: (options: {
48
+ address: string;
49
+ }) => Promise<void>;
50
+ }
51
+ declare function useExportWallet(): UseExportWalletInterface;
52
+
31
53
  interface SignRawHashInput {
32
54
  /** The address of the wallet to sign the hash with. */
33
55
  address: string;
@@ -49,4 +71,4 @@ interface UseSignRawHashInterface {
49
71
  }
50
72
  declare const useSignRawHash: () => UseSignRawHashInterface;
51
73
 
52
- export { useCreateWallet, useSignRawHash };
74
+ export { useCreateWallet, useExportWallet, useSignRawHash };
@@ -1,4 +1,4 @@
1
- import { L as LoginToMiniApp, U as User } from './types-BF33BYgd.js';
1
+ import { d as LoginToMiniApp, U as User } from './types-C4KyGxEF.js';
2
2
  import '@coinbase/wallet-sdk';
3
3
  import '@simplewebauthn/browser';
4
4
  import '@solana/kit';
@@ -1,4 +1,4 @@
1
- import { L as LoginToMiniApp, U as User } from './types-BF33BYgd.js';
1
+ import { d as LoginToMiniApp, U as User } from './types-C4KyGxEF.js';
2
2
  import '@coinbase/wallet-sdk';
3
3
  import '@simplewebauthn/browser';
4
4
  import '@solana/kit';
@@ -1,20 +1,22 @@
1
1
  import * as react from 'react';
2
2
  import react__default, { MouseEvent } from 'react';
3
- import { M as MfaSubmitArgs, g as UserRecoveryMethod, c as SessionSignerInput, E as EthereumRpcRequestType, h as SolanaRpcRequestType, i as EthereumRpcResponseType, j as SolanaRpcResponseType, P as PrivyFarcasterSignerInitResponse, k as EIP1193Provider, l as EntropyIdVerifier$1, H as HDWalletWithMetadata, m as RequestArguments, n as WalletConnector, B as BaseConnectedEthereumWallet, o as PrivyProxyProvider, p as WalletClientType, q as ConnectedWalletMetadata, r as PrivyClientConfig, s as ConnectorType, u as SetBaseAccountSdkType, v as WalletListEntry, A as AppConfig, w as BaseConnectedWallet, f as SolanaWalletConnector, U as User, x as ConnectWalletModalOptions, y as LoginModalOptions, C as CreateWalletOptions, W as Wallet, z as SetWalletRecoveryOptions, b as SignMessageModalUIOptions, D as SignTypedDataParams, F as MfaMethod, G as UnsignedTransactionRequest, a as SendTransactionModalUIOptions, I as FundWalletConfig, J as ConnectedWallet, O as OAuthTokens, K as CrossAppProviderDetails, N as MoonpaySignRequest, Q as MoonpaySignResponse, T as SmartWalletConfig, V as SiwsMessageType, X as LoginMethod, Y as ExternalWalletMetadata, Z as TelegramAuthResult, _ as TelegramWebAppData, $ as OAuthUserInfo, a0 as LinkedAccountWithMetadata, a1 as PrivyErrorCode, a2 as BaseConnectedSolanaWallet, a3 as FundingMethod, S as SolanaChain, a4 as OAuthFlowState, a5 as LoginWithCode, a6 as OtpFlowState, a7 as PasskeyFlowState, a8 as SiweFlowState, a9 as BaseAccountSdkType, aa as UnsignedTransactionRequestWithChainId, ab as BaseConnectedWalletType, ac as TelegramAuthFlowState } from './types-BF33BYgd.js';
4
- export { au as Apple, aH as AppleOAuthWithMetadata, aP as ContractUIOptions, ay as CrossAppAccount, aK as CrossAppAccountWithMetadata, ar as Discord, aC as DiscordOAuthWithMetadata, aM as Email, am as EmailWithMetadata, aS as Farcaster, aI as FarcasterWithMetadata, as as Github, aD as GithubOAuthWithMetadata, ap as Google, aA as GoogleOAuthWithMetadata, aw as Line, aF as LineOAuthWithMetadata, az as LinkedAccountType, at as LinkedIn, aG as LinkedInOAuthWithMetadata, aU as LoginMethodOrderOption, ae as MessageTypes, ag as MoonpayCurrencyCode, ah as MoonpayPaymentMethod, aQ as NativeFundingConfig, al as NonEmptyArray, aT as Passkey, aL as PasskeyWithMetadata, aN as Phone, an as PhoneWithMetadata, aR as PriceDisplayOptions, ai as Quantity, aV as SiwsFlowState, af as SmartWallet, ax as Telegram, aJ as TelegramWithMetadata, av as Tiktok, aE as TiktokOAuthWithMetadata, aj as TransactionLog, ak as TransactionReceipt, aO as TransactionUIOptions, aq as Twitter, aB as TwitterOAuthWithMetadata, ad as TypedMessage, ao as WalletWithMetadata } from './types-BF33BYgd.js';
3
+ import { k as MfaSubmitArgs, c as UserRecoveryMethod, g as SessionSignerInput, E as EthereumRpcRequestType, l as SolanaRpcRequestType, m as EthereumRpcResponseType, n as SolanaRpcResponseType, o as PrivyFarcasterSignerInitResponse, p as EIP1193Provider, q as EntropyIdVerifier$1, H as HDWalletWithMetadata, r as RequestArguments, s as WalletConnector, B as BaseConnectedEthereumWallet, u as PrivyProxyProvider, v as WalletClientType, w as ConnectedWalletMetadata, x as PrivyClientConfig, y as ConnectorType, z as SetBaseAccountSdkType, A as WalletListEntry, D as AppConfig, G as BaseConnectedWallet, j as SolanaWalletConnector, U as User, I as ConnectWalletModalOptions, J as LoginModalOptions, C as CreateWalletOptions, W as Wallet, K as SetWalletRecoveryOptions, f as SignMessageModalUIOptions, N as SignTypedDataParams, M as MfaMethod, Q as UnsignedTransactionRequest, e as SendTransactionModalUIOptions, T as FundWalletConfig, V as ConnectedWallet, O as OAuthTokens, X as CrossAppProviderDetails, Y as MoonpaySignRequest, Z as MoonpaySignResponse, _ as SmartWalletConfig, $ as SiwsMessageType, L as LoginMethod, a0 as ExternalWalletMetadata, a1 as TelegramAuthResult, a2 as TelegramWebAppData, a3 as OAuthUserInfo, a4 as OAuthFlowState, a5 as LoginWithCode, a6 as OtpFlowState, a7 as PasskeyFlowState, a8 as SiweFlowState, a as LinkedAccountWithMetadata, a9 as BaseAccountSdkType, aa as UnsignedTransactionRequestWithChainId, ab as BaseConnectedWalletType, b as BaseConnectedSolanaWallet, ac as TelegramAuthFlowState } from './types-C4KyGxEF.js';
4
+ export { au as Apple, aH as AppleOAuthWithMetadata, aP as ContractUIOptions, ay as CrossAppAccount, aK as CrossAppAccountWithMetadata, ar as Discord, aC as DiscordOAuthWithMetadata, aM as Email, am as EmailWithMetadata, aS as Farcaster, aI as FarcasterWithMetadata, as as Github, aD as GithubOAuthWithMetadata, ap as Google, aA as GoogleOAuthWithMetadata, aw as Line, aF as LineOAuthWithMetadata, az as LinkedAccountType, at as LinkedIn, aG as LinkedInOAuthWithMetadata, aU as LoginMethodOrderOption, ae as MessageTypes, ag as MoonpayCurrencyCode, ah as MoonpayPaymentMethod, aQ as NativeFundingConfig, al as NonEmptyArray, aT as Passkey, aL as PasskeyWithMetadata, aN as Phone, an as PhoneWithMetadata, aR as PriceDisplayOptions, P as PrivyErrorCode, ai as Quantity, aV as SiwsFlowState, af as SmartWallet, ax as Telegram, aJ as TelegramWithMetadata, av as Tiktok, aE as TiktokOAuthWithMetadata, aj as TransactionLog, ak as TransactionReceipt, aO as TransactionUIOptions, aq as Twitter, aB as TwitterOAuthWithMetadata, ad as TypedMessage, ao as WalletWithMetadata } from './types-C4KyGxEF.js';
5
5
  import * as react_jsx_runtime from 'react/jsx-runtime';
6
6
  import { TurnstileProps } from '@marsidev/react-turnstile';
7
7
  import EventEmitter from 'eventemitter3';
8
8
  import { Store, EIP6963ProviderDetail } from 'mipd';
9
9
  import Privy, { Chain, RpcConfig, GenerateAuthorizationSignatureInput, GenerateAuthorizationSignatureOutput } from '@privy-io/js-sdk-core';
10
10
  export { DEFAULT_SUPPORTED_CHAINS as SUPPORTED_CHAINS, addPrivyRpcToChain, addRpcUrlOverrideToChain } from '@privy-io/js-sdk-core';
11
- import { PasskeyAuthenticateInputType, SmartWalletType, CustomOAuthProvider, CustomMetadataType, OAuthProviderType, PrivyCoinbaseOnRampInitInput, PrivyCoinbaseOnRampInitResponse, PrivyCoinbaseOnRampStatusResponse, PrivyTransactionScanningInputType, PrivyTransactionScanningResponseType } from '@privy-io/public-api';
11
+ import { FirstClassChainType, PasskeyAuthenticateInputType, SmartWalletType, CustomOAuthProvider, CustomMetadataType, OAuthProviderType, PrivyCoinbaseOnRampInitInput, PrivyCoinbaseOnRampInitResponse, PrivyCoinbaseOnRampStatusResponse, PrivyTransactionScanningInputType, PrivyTransactionScanningResponseType } from '@privy-io/public-api';
12
12
  export { OAuthProviderType } from '@privy-io/public-api';
13
13
  import * as viem from 'viem';
14
14
  import { Address, HttpTransport, Hex } from 'viem';
15
15
  import * as _simplewebauthn_browser from '@simplewebauthn/browser';
16
16
  import { PublicKeyCredentialRequestOptionsJSON } from '@simplewebauthn/browser';
17
17
  import { FetchOptions } from 'ofetch';
18
+ import { P as PrivyEvents } from './events-context-DB3Pn5Hg.js';
19
+ export { C as CallbackError } from './events-context-DB3Pn5Hg.js';
18
20
  import * as viem_accounts from 'viem/accounts';
19
21
  import '@coinbase/wallet-sdk';
20
22
  import '@solana/kit';
@@ -364,7 +366,7 @@ type RootWalletForDelegation = {
364
366
  /** Address of the root wallet for the entropy being delegated. */
365
367
  address: string;
366
368
  /** Chain type of the root wallet for the entropy being delegated. */
367
- chainType: 'ethereum' | 'solana';
369
+ chainType: FirstClassChainType;
368
370
  /** Whether or not the root wallet for the entropy being delegated is imported. */
369
371
  imported: boolean;
370
372
  };
@@ -372,7 +374,7 @@ type DelegatedWallet = {
372
374
  /** Address for a wallet to delegate. */
373
375
  address: string;
374
376
  /** Chain type for a wallet to delegate. */
375
- chainType: 'ethereum' | 'solana';
377
+ chainType: FirstClassChainType;
376
378
  /** HD index for the wallet to delegate. */
377
379
  walletIndex: number;
378
380
  };
@@ -2805,330 +2807,6 @@ declare class PrivyClient {
2805
2807
  scanTransaction(request: PrivyTransactionScanningInputType): Promise<PrivyTransactionScanningResponseType>;
2806
2808
  }
2807
2809
 
2808
- /**
2809
- * `CallbackError` optionally includes a second parameter with further error details.
2810
- */
2811
- type CallbackError<Details extends Record<string, any> | undefined = undefined> = Details extends Record<string, any> ? (error: PrivyErrorCode, details: Details) => void : (error: PrivyErrorCode) => void;
2812
- interface PrivyEvents {
2813
- login: {
2814
- /**
2815
- * Callback that will execute once a `login` flow successfully completes.
2816
- * - If `config.embeddedWallets.createOnLogin` is set to 'off' or a wallet creation flow is not applicable,
2817
- * this will run after the user successfully authenticates.
2818
- * - If `config.embeddedWallets.createOnLogin` is set to 'users-without-wallets' or 'all-users',
2819
- * this will run after the user successfully authenticates _and_ creates their wallet (if applicable).
2820
- * - If a user is already authenticated, this will run immediately and the `wasAlreadyAuthenticated` flag will be set to `true`.
2821
- *
2822
- * @param params.user {@link User} the `user` oject corresponding to the authenticated user
2823
- * @param params.isNewUser {boolean} boolean flag indicating if this is the user's first time logging in to your app
2824
- * @param params.wasAlreadyAuthenticated {boolean} - boolean flag indicating whether the user entered the application already authenticated
2825
- * @param params.loginMethod {string} - the method used by the user to login
2826
- * @param params.loginAccount - the account corresponding to the loginMethod used
2827
- */
2828
- onComplete?: (params: {
2829
- user: User;
2830
- isNewUser: boolean;
2831
- wasAlreadyAuthenticated: boolean;
2832
- loginMethod: LoginMethod | null;
2833
- loginAccount: LinkedAccountWithMetadata | null;
2834
- }) => void;
2835
- /**
2836
- * Callback that will execute in the case of a non-successful login.
2837
- *
2838
- * @param error {@link PrivyErrorCode} - the corresponding error code
2839
- */
2840
- onError?: CallbackError;
2841
- };
2842
- logout: {
2843
- /**
2844
- * Callback that will execute when a user successfully logs out.
2845
- */
2846
- onSuccess?: () => void;
2847
- };
2848
- connectWallet: {
2849
- /**
2850
- * Callback that will execute once a successful `connectWallet` completes.
2851
- * This will not run in the case of a wallet-based authentication or link flow.
2852
- *
2853
- * @param params.wallet {@link BaseConnectedEthereumWallet | BaseConnectedSolanaWallet} the `wallet` object correspending to the connection
2854
- */
2855
- onSuccess?: (params: {
2856
- wallet: BaseConnectedEthereumWallet | BaseConnectedSolanaWallet;
2857
- }) => void;
2858
- /**
2859
- * Callback that will execute in the case of a non-successful wallet connection.
2860
- *
2861
- * @param params.error {@link PrivyErrorCode} - the corresponding error code
2862
- */
2863
- onError?: CallbackError;
2864
- };
2865
- connectOrCreateWallet: {
2866
- /**
2867
- * Callback that will execute once a successful `connectWallet` completes.
2868
- * This will not run in the case of a wallet-based authentication or link flow.
2869
- *
2870
- * @param params.wallet {@link BaseConnectedEthereumWallet | BaseConnectedSolanaWallet} the `wallet` object correspending to the connection
2871
- */
2872
- onSuccess?: (params: {
2873
- wallet: BaseConnectedEthereumWallet | BaseConnectedSolanaWallet;
2874
- }) => void;
2875
- /**
2876
- * Callback that will execute in the case of a non-successful wallet connection.
2877
- *
2878
- * @param params.error {@link PrivyErrorCode} - the corresponding error code
2879
- */
2880
- onError?: CallbackError;
2881
- };
2882
- createWallet: {
2883
- /**
2884
- * Callback that will execute once on a successful embedded wallet creation.
2885
- * This will run when `createWallet` is called manually, or when `config.embeddedWallets.createOnLogin` triggers
2886
- * an automatic wallet creation.
2887
- *
2888
- * @param params.wallet {@link BaseConnectedWallet}- the created `wallet` object
2889
- */
2890
- onSuccess?: (params: {
2891
- wallet: Wallet;
2892
- }) => void;
2893
- /**
2894
- * Callback that will execute in the case of a non-successful wallet creation.
2895
- *
2896
- * @param params.error {@link PrivyErrorCode} - the corresponding error code
2897
- */
2898
- onError?: CallbackError;
2899
- };
2900
- linkAccount: {
2901
- /**
2902
- * Callback that will execute once on a successful linking of a new account/login method.
2903
- * This will run when any of the 'link' methods are called manually.
2904
- * @param params.user {@link User}- the user the account was linked to
2905
- * @param params.linkMethod {@link LoginMethod}- the type of linked account
2906
- * @param params.linkedAccount - the newly linked account
2907
- */
2908
- onSuccess?: (params: {
2909
- user: User;
2910
- linkMethod: LoginMethod;
2911
- linkedAccount: LinkedAccountWithMetadata;
2912
- }) => void;
2913
- /**
2914
- * Callback that will execute in the case of a non-successful account linking.
2915
- *
2916
- * @param error {PrivyErrorCode} - the corresponding error code
2917
- * @param details.linkMethod {LoginMethod} - the type of (attempted) linked account
2918
- */
2919
- onError?: CallbackError<{
2920
- linkMethod: LoginMethod;
2921
- }>;
2922
- };
2923
- update: {
2924
- /**
2925
- * Callback that will execute once on a successful updating of an account.
2926
- * This will run when any of the 'updateAccount' methods are called manually.
2927
- * @param params.user {@link User}- the user the account was linked to
2928
- * @param params.updateMethod {@link LoginMethod}- the type of updated account
2929
- * @param params.updatedAccount - the newly updated account
2930
- */
2931
- onSuccess?: (params: {
2932
- user: User;
2933
- updateMethod: LoginMethod;
2934
- updatedAccount: LinkedAccountWithMetadata;
2935
- }) => void;
2936
- /**
2937
- * Callback that will execute in the case of a non-successful account linking.
2938
- *
2939
- * @param error {PrivyErrorCode} - the corresponding error code
2940
- * @param details.linkMethod {LoginMethod} - the type of (attempted) linked account
2941
- */
2942
- onError?: CallbackError<{
2943
- linkMethod: LoginMethod;
2944
- }>;
2945
- };
2946
- configureMfa: {
2947
- /**
2948
- * Callback that will execute when MFA is required to complete a given action.
2949
- * @param params.mfaMethods {@link MfaMethod[]} - List of MFA methods that the user can choose from
2950
- */
2951
- onMfaRequired: (params: {
2952
- mfaMethods: MfaMethod[];
2953
- }) => void;
2954
- };
2955
- setWalletPassword: {
2956
- /**
2957
- * Callback that will execute once a successful `setWalletPassword` completes.
2958
- * @param params.wallet {@link Wallet}- the `wallet` object that the password was set for
2959
- */
2960
- onSuccess?: (params: {
2961
- wallet: Wallet;
2962
- }) => void;
2963
- /**
2964
- * Callback that will execute in the case of a non-successful setWalletPassword.
2965
- *
2966
- * @param params.error {PrivyErrorCode} - the corresponding error code
2967
- */
2968
- onError?: CallbackError;
2969
- };
2970
- setWalletRecovery: {
2971
- /**
2972
- * Callback that will execute once a successful `setWalletRecovery` completes.
2973
- * @param params.method {@link UserRecoveryMethod} - the recovery method that was set
2974
- * @param params.wallet {@link Wallet}- the wallet object that the recovery was set for
2975
- */
2976
- onSuccess?: (params: {
2977
- method: UserRecoveryMethod;
2978
- wallet: Wallet;
2979
- }) => void;
2980
- /**
2981
- * Callback that will execute in the case of a non-successful setWalletRecovery.
2982
- *
2983
- * @param params.error {PrivyErrorCode} - the corresponding error code
2984
- */
2985
- onError?: CallbackError;
2986
- };
2987
- signMessage: {
2988
- /**
2989
- * Callback that will execute once a successful `signMessage` completes.
2990
- * This will not run in the case of a wallet-based authentication or link flow.
2991
- * @param params.signature - the signature (type string) of the embedded wallet used to sign message
2992
- */
2993
- onSuccess?: (params: {
2994
- signature: string;
2995
- }) => void;
2996
- /**
2997
- * Callback that will execute in the case of a non-successful signMessage.
2998
- *
2999
- * @param params.error {@link PrivyErrorCode} - the corresponding error code
3000
- */
3001
- onError?: CallbackError;
3002
- };
3003
- signTypedData: {
3004
- /**
3005
- * Callback that will execute once a successful `signTypedData` completes.
3006
- * @param params.signature - the signature (type string) of the embedded wallet used to sign
3007
- */
3008
- onSuccess?: (params: {
3009
- signature: string;
3010
- }) => void;
3011
- /**
3012
- * Callback that will execute in the case of a non-successful signTypedData.
3013
- *
3014
- * @param params.error {@link PrivyErrorCode} - the corresponding error code
3015
- */
3016
- onError?: CallbackError;
3017
- };
3018
- sendTransaction: {
3019
- /**
3020
- * Callback that will execute once a successful `sendTransaction` completes.
3021
- * This will not run for transactions with external wallets.
3022
- * @param an object with the transaction hash
3023
- */
3024
- onSuccess?: (params: {
3025
- hash: `0x${string}`;
3026
- }) => void;
3027
- /**
3028
- * Callback that will execute in the case of a non-successful sendTransaction.
3029
- *
3030
- * @param params.error {@link PrivyErrorCode} - the corresponding error code
3031
- */
3032
- onError?: CallbackError;
3033
- };
3034
- signTransaction: {
3035
- /**
3036
- * Callback that will execute once a successful `signTransaction` completes.
3037
- * This will not run for transactions with external wallets.
3038
- * @param an object with the transaction signature
3039
- */
3040
- onSuccess?: (params: {
3041
- signature: `0x${string}`;
3042
- }) => void;
3043
- /**
3044
- * Callback that will execute in the case of a non-successful signTransaction.
3045
- *
3046
- * @param params.error {@link PrivyErrorCode} - the corresponding error code
3047
- */
3048
- onError?: CallbackError;
3049
- };
3050
- accessToken: {
3051
- /**
3052
- * Callback that will execute when a user's access token is granted.
3053
- * @param params.accessToken - The user's access token
3054
- */
3055
- onAccessTokenGranted: (params: {
3056
- accessToken: string;
3057
- }) => void;
3058
- /**
3059
- * Callback that will execute when a user's access token is removed.
3060
- */
3061
- onAccessTokenRemoved: () => void;
3062
- };
3063
- oAuthAuthorization: {
3064
- /**
3065
- * Callback that will execute when a user successfully authorizes an OAuth flow.
3066
- *
3067
- * @param params.oAuthTokens {@link OAuthTokens} - the OAuth tokens returned from the OAuth provider:
3068
- * @param params.oAuthTokens.provider - {string} The OAuth provider type.
3069
- * @param params.oAuthTokens.accessToken - {string} The OAuth access token.
3070
- * @param params.oAuthTokens.accessTokenExpiresInSeconds - {number} (optional) The number of seconds until the OAuth access token expires.
3071
- * @param params.oAuthTokens.refreshToken - {string} (optional) The OAuth refresh token.
3072
- * @param params.oAuthTokens.refreshTokenExpiresInSeconds - {number} (optional) The number of seconds until the OAuth refresh token expires.
3073
- * if the refresh token is present and this field is undefined, it is assumed
3074
- * that the refresh token does not have an expiration date.
3075
- * @param params.oAuthTokens.scopes - {string[]} (optional) The list of OAuth scopes the access token is approved for.
3076
- *
3077
- * @param params.user {@link User} The authenticated user
3078
- */
3079
- onOAuthTokenGrant: (params: {
3080
- oAuthTokens: OAuthTokens;
3081
- user: User;
3082
- }) => void;
3083
- };
3084
- fundWallet: {
3085
- /**
3086
- * Callback that will execute when a funding flow is exited. This fires when a user closes a funding flow modal, for any reason.
3087
- *
3088
- * @param params.address {string} The address of the wallet being funded
3089
- * @param params.chain {Chain} The chain of the wallet being funded
3090
- * @param params.fundingMethod {@link FundingMethod} The funding method associated with the flow at time of exit. If the user had not yet selected
3091
- * a recovery method, this will be null.
3092
- * @param params.balance {bigint} The value for the funded wallet at the point of user exit.
3093
- */
3094
- onUserExited?: (params: {
3095
- address: string;
3096
- chain: Chain;
3097
- fundingMethod: FundingMethod | 'manual' | null;
3098
- balance: bigint | undefined;
3099
- }) => void;
3100
- };
3101
- fundSolanaWallet: {
3102
- /**
3103
- * Callback that will execute when a funding flow is exited. This fires when a user closes a funding flow modal, for any reason.
3104
- *
3105
- * @param params.address {string} The address of the wallet being funded
3106
- * @param params.fundingMethod {@link FundingMethod} The funding method associated with the flow at time of exit. If the user had not yet selected
3107
- * a recovery method, this will be null.
3108
- * @param params.balance {bigint} The value for the funded wallet at the point of user exit.
3109
- */
3110
- onUserExited?: (params: {
3111
- address: string;
3112
- fundingMethod: FundingMethod | 'manual' | null;
3113
- chain: SolanaChain;
3114
- balance: bigint | undefined;
3115
- }) => void;
3116
- };
3117
- customAuth: {
3118
- /**
3119
- * Callback that will execute when Privy successfully exchanges a custom auth JWT for a Privy JWT
3120
- * @param params.user - The Privy user
3121
- */
3122
- onAuthenticated: (params: {
3123
- user: User;
3124
- }) => void;
3125
- /**
3126
- * Callback that will execute when Privy detects a user is logged out from the third-party auth system, and correspondingly logs the user out.
3127
- */
3128
- onUnauthenticated: () => void;
3129
- };
3130
- }
3131
-
3132
2810
  /**
3133
2811
  * Use this hook to log the user in, and to attach callbacks
3134
2812
  * for successful `login`s, already-`authenticated` users, and
@@ -3505,12 +3183,17 @@ type UseLoginWithSiwe = {
3505
3183
  * @param opts options for verifying a signature for a SIWE message
3506
3184
  * @param opts.signature {string} The EIP-191 signature corresponding to the message that the user had been given.
3507
3185
  * @param opts.message {string} EIP-4361 message for signing. Returned from the generateSiweMessage call
3186
+ * @param opts.disableSignup {boolean} (optional) whether to disable signup for the user
3187
+ * @param opts.walletClientType {string} (optional) the wallet client of the external wallet (ie. 'metamask', 'coinbase_wallet'). Defaults to null if not specified.
3188
+ * @param opts.connectorType {string} (optional) the method used to connect the wallet to the application (ie. 'injected', 'wallet_connect_v2'). Defaults to null if not specified.
3508
3189
  * @returns The user response object.
3509
3190
  */
3510
- loginWithSiwe: ({ signature, message, disableSignup, }: {
3191
+ loginWithSiwe: ({ signature, message, disableSignup, walletClientType, connectorType, }: {
3511
3192
  signature: string;
3512
3193
  message: string;
3513
3194
  disableSignup?: boolean;
3195
+ walletClientType?: string;
3196
+ connectorType?: string;
3514
3197
  }) => Promise<User>;
3515
3198
  /**
3516
3199
  * The current state of the SIWE link operation
@@ -3537,12 +3220,17 @@ type UseLoginWithSiws = {
3537
3220
  * @param opts options for verifying a signature for a SIWS message
3538
3221
  * @param opts.signature {string} The signature corresponding to the message that the user had been given.
3539
3222
  * @param opts.message {string} SIWS message for signing. Returned from the generateSiwsMessage call
3223
+ * @param opts.disableSignup {boolean} (optional) whether to disable signup for the user
3224
+ * @param opts.walletClientType {string} (optional) the wallet client of the external wallet (ie. 'phantom', 'solflare'). Defaults to null if not specified.
3225
+ * @param opts.connectorType {string} (optional) the method used to connect the wallet to the application (ie. 'injected', 'wallet_connect_v2'). Defaults to null if not specified.
3540
3226
  * @returns The user response object.
3541
3227
  */
3542
- loginWithSiws: ({ signature, message, disableSignup, }: {
3228
+ loginWithSiws: ({ signature, message, disableSignup, walletClientType, connectorType, }: {
3543
3229
  signature: string;
3544
3230
  message: string;
3545
3231
  disableSignup?: boolean;
3232
+ walletClientType?: string;
3233
+ connectorType?: string;
3546
3234
  }) => Promise<User>;
3547
3235
  };
3548
3236
  declare const useLoginWithSiws: () => UseLoginWithSiws;
@@ -4611,4 +4299,4 @@ declare const useMigrateWallets: () => {
4611
4299
  }>;
4612
4300
  };
4613
4301
 
4614
- export { BaseConnectedWalletType, type CallbackError, Captcha, ConnectWalletModalOptions, ConnectedWallet, ConnectorManager, type CustomAuthFlowState, EIP1193Provider, EthereumWalletConnector, FundWalletConfig, type JwtAuthFlowState, LinkedAccountWithMetadata, LoginModal, LoginModalOptions, LoginWithCode, MfaMethod, OAuthFlowState, OAuthTokens, OtpFlowState, PasskeyFlowState, PrivyClient, PrivyClientConfig, PrivyErrorCode, type PrivyEvents, type PrivyInterface, PrivyProvider, type PrivyProviderProps, type SendCodeToEmail, type SendCodeToSms, SendTransactionModalUIOptions, SignMessageModalUIOptions, SignTypedDataParams, SiweFlowState, TelegramAuthFlowState, UnsignedTransactionRequest, type UseAuthorizationSignatureInterface, type UseBaseAccountSdkInterface, type UseConnectBaseAccountInterface, type UseConnectCoinbaseSmartWalletInterface, type UseCustomAuth, type UseDelegatedActionsInterface, type UseFundWalletInterface, type UseGetAccessTokenForProvider, type UseImportWalletInterface, type UseLinkJwtAccount, type UseLinkWithPasskey, type UseLinkWithSiws, type UseLoginWithEmail, type UseLoginWithPasskey, type UseLoginWithSiws, type UseLoginWithSms, type UseLoginWithTelegram, type UseOAuthTokens, type UseRecoverEmbeddedWalletInterface, type UseSessionSignersInterface, type UseSignupWithPasskey, type UseSubscribeToJwtAuthWithFlagInput, type UseSyncJwtBasedAuthStateInput, type UseSyncJwtBasedAuthStateInterface, type UseWalletsInterface, User, VERSION, Wallet, WalletConnector, WalletListEntry, errorIndicatesMaxMfaRetries, errorIndicatesMfaTimeout, errorIndicatesMfaVerificationFailed, getCustomerAccessToken as getAccessToken, getEmbeddedConnectedWallet, toViemAccount, useActiveWallet, useAuthMfa, useAuthMfaEnrollment, useAuthorizationSignature, useBaseAccountSdk, useConnectBaseAccount, useConnectCoinbaseSmartWallet, useConnectOrCreateWallet, useConnectWallet, useCreateWallet, useCrossAppAccounts, useCustomAuth, useDelegatedActions, useFarcasterSigner, useFundWallet, useGetAccessTokenForProvider, useGuestAccounts, useHeadlessDelegatedActions, useIdentityToken, useImportWallet, useLinkAccount, useLinkJwtAccount, useLinkWithPasskey, useLinkWithSiwe, useLinkWithSiws, useLogin, useLoginWithEmail, useLoginWithFarcasterV2, useLoginWithOAuth, useLoginWithPasskey, useLoginWithSiwe, useLoginWithSiws, useLoginWithSms, useLoginWithTelegram, useLogout, useMfa, useMfaEnrollment, useMigrateWallets, useModalStatus, useOAuthTokens, usePrivy, useRecoverEmbeddedWallet, useRegisterMfaListener, useSendTransaction, useSessionSigners, useSetWalletRecovery, useSign7702Authorization, useSignMessage, useSignTransaction, useSignTypedData, useSignupWithPasskey, useSubscribeToJwtAuthWithFlag, useSyncJwtBasedAuthState, useToken, useUpdateAccount, useUpdateEmail, useUser, useWallets };
4302
+ export { BaseConnectedWalletType, Captcha, ConnectWalletModalOptions, ConnectedWallet, ConnectorManager, type CustomAuthFlowState, EIP1193Provider, EthereumWalletConnector, FundWalletConfig, type JwtAuthFlowState, LinkedAccountWithMetadata, LoginModal, LoginModalOptions, LoginWithCode, MfaMethod, OAuthFlowState, OAuthTokens, OtpFlowState, PasskeyFlowState, PrivyClient, PrivyClientConfig, PrivyEvents, type PrivyInterface, PrivyProvider, type PrivyProviderProps, type SendCodeToEmail, type SendCodeToSms, SendTransactionModalUIOptions, SignMessageModalUIOptions, SignTypedDataParams, SiweFlowState, TelegramAuthFlowState, UnsignedTransactionRequest, type UseAuthorizationSignatureInterface, type UseBaseAccountSdkInterface, type UseConnectBaseAccountInterface, type UseConnectCoinbaseSmartWalletInterface, type UseCustomAuth, type UseDelegatedActionsInterface, type UseFundWalletInterface, type UseGetAccessTokenForProvider, type UseImportWalletInterface, type UseLinkJwtAccount, type UseLinkWithPasskey, type UseLinkWithSiws, type UseLoginWithEmail, type UseLoginWithPasskey, type UseLoginWithSiws, type UseLoginWithSms, type UseLoginWithTelegram, type UseOAuthTokens, type UseRecoverEmbeddedWalletInterface, type UseSessionSignersInterface, type UseSignupWithPasskey, type UseSubscribeToJwtAuthWithFlagInput, type UseSyncJwtBasedAuthStateInput, type UseSyncJwtBasedAuthStateInterface, type UseWalletsInterface, User, VERSION, Wallet, WalletConnector, WalletListEntry, errorIndicatesMaxMfaRetries, errorIndicatesMfaTimeout, errorIndicatesMfaVerificationFailed, getCustomerAccessToken as getAccessToken, getEmbeddedConnectedWallet, toViemAccount, useActiveWallet, useAuthMfa, useAuthMfaEnrollment, useAuthorizationSignature, useBaseAccountSdk, useConnectBaseAccount, useConnectCoinbaseSmartWallet, useConnectOrCreateWallet, useConnectWallet, useCreateWallet, useCrossAppAccounts, useCustomAuth, useDelegatedActions, useFarcasterSigner, useFundWallet, useGetAccessTokenForProvider, useGuestAccounts, useHeadlessDelegatedActions, useIdentityToken, useImportWallet, useLinkAccount, useLinkJwtAccount, useLinkWithPasskey, useLinkWithSiwe, useLinkWithSiws, useLogin, useLoginWithEmail, useLoginWithFarcasterV2, useLoginWithOAuth, useLoginWithPasskey, useLoginWithSiwe, useLoginWithSiws, useLoginWithSms, useLoginWithTelegram, useLogout, useMfa, useMfaEnrollment, useMigrateWallets, useModalStatus, useOAuthTokens, usePrivy, useRecoverEmbeddedWallet, useRegisterMfaListener, useSendTransaction, useSessionSigners, useSetWalletRecovery, useSign7702Authorization, useSignMessage, useSignTransaction, useSignTypedData, useSignupWithPasskey, useSubscribeToJwtAuthWithFlag, useSyncJwtBasedAuthState, useToken, useUpdateAccount, useUpdateEmail, useUser, useWallets };