@privy-io/react-auth 2.15.1 → 2.16.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 (43) hide show
  1. package/dist/cjs/abstract-smart-wallets.js +1 -1
  2. package/dist/cjs/extended-chains.js +1 -1
  3. package/dist/cjs/farcaster.js +1 -1
  4. package/dist/cjs/index.js +1 -1
  5. package/dist/cjs/{internal-context-CrTqNb_c.js → internal-context-vhWXhsPy.js} +1 -1
  6. package/dist/cjs/{privy-provider-UmRLOMDd.js → privy-provider-BwT4_Q1p.js} +5 -5
  7. package/dist/cjs/{smart-wallets-BViP2cFO.js → smart-wallets-BBYteGIQ.js} +1 -1
  8. package/dist/cjs/smart-wallets.js +1 -1
  9. package/dist/cjs/solana.js +1 -1
  10. package/dist/cjs/ui.js +1 -1
  11. package/dist/cjs/{use-sign-with-user-signer-h5JGn1CY.js → use-sign-with-user-signer-Btd3Mi-j.js} +1 -1
  12. package/dist/cjs/{useActiveWallet-BmJnPTkG.js → useActiveWallet-geVurizV.js} +1 -1
  13. package/dist/cjs/{useFundWallet-BSFsqoD8.js → useFundWallet-Do4NJHE-.js} +1 -1
  14. package/dist/dts/extended-chains.d.mts +1 -1
  15. package/dist/dts/extended-chains.d.ts +1 -1
  16. package/dist/dts/farcaster.d.mts +1 -1
  17. package/dist/dts/farcaster.d.ts +1 -1
  18. package/dist/dts/index.d.mts +35 -5
  19. package/dist/dts/index.d.ts +35 -5
  20. package/dist/dts/smart-wallets.d.mts +1 -1
  21. package/dist/dts/smart-wallets.d.ts +1 -1
  22. package/dist/dts/solana.d.mts +4 -4
  23. package/dist/dts/solana.d.ts +4 -4
  24. package/dist/dts/{types-BVjRQyBr.d.mts → types-CH4HSSkH.d.mts} +7 -0
  25. package/dist/dts/{types-BVjRQyBr.d.ts → types-CH4HSSkH.d.ts} +7 -0
  26. package/dist/dts/ui.d.mts +2 -1
  27. package/dist/dts/ui.d.ts +2 -1
  28. package/dist/dts/{useSolanaWallets-B9ju3nTn.d.mts → useSolanaWallets-NCQrusNU.d.mts} +1 -1
  29. package/dist/dts/{useSolanaWallets-B9ju3nTn.d.ts → useSolanaWallets-NCQrusNU.d.ts} +1 -1
  30. package/dist/esm/abstract-smart-wallets.mjs +1 -1
  31. package/dist/esm/extended-chains.mjs +1 -1
  32. package/dist/esm/farcaster.mjs +1 -1
  33. package/dist/esm/index.mjs +1 -1
  34. package/dist/esm/{internal-context-Bxhby7Hv.mjs → internal-context-De1jxnac.mjs} +1 -1
  35. package/dist/esm/{privy-provider-B2wDQG1e.mjs → privy-provider-9dA1clzB.mjs} +5 -5
  36. package/dist/esm/{smart-wallets-DWn4sZHM.mjs → smart-wallets-BODPu_tJ.mjs} +1 -1
  37. package/dist/esm/smart-wallets.mjs +1 -1
  38. package/dist/esm/solana.mjs +1 -1
  39. package/dist/esm/ui.mjs +2 -2
  40. package/dist/esm/{use-sign-with-user-signer-CEyk1z8w.mjs → use-sign-with-user-signer-Yg0Gn-gB.mjs} +1 -1
  41. package/dist/esm/{useActiveWallet-D4n8kXvn.mjs → useActiveWallet-jVmO0lCL.mjs} +1 -1
  42. package/dist/esm/{useFundWallet-qZe9uPbe.mjs → useFundWallet-CZq0dDAM.mjs} +1 -1
  43. package/package.json +4 -4
@@ -1,5 +1,5 @@
1
1
  import { CurveSigningChainType, WalletResponseType } from '@privy-io/public-api';
2
- import { U as User } from './types-BVjRQyBr.js';
2
+ import { U as User } from './types-CH4HSSkH.js';
3
3
  import '@coinbase/wallet-sdk';
4
4
  import '@reown/appkit';
5
5
  import '@solana/wallet-adapter-base';
@@ -1,5 +1,5 @@
1
1
  import { CurveSigningChainType, WalletResponseType } from '@privy-io/public-api';
2
- import { U as User } from './types-BVjRQyBr.js';
2
+ import { U as User } from './types-CH4HSSkH.js';
3
3
  import '@coinbase/wallet-sdk';
4
4
  import '@reown/appkit';
5
5
  import '@solana/wallet-adapter-base';
@@ -1,4 +1,4 @@
1
- import { L as LoginToFrame, U as User } from './types-BVjRQyBr.js';
1
+ import { L as LoginToFrame, U as User } from './types-CH4HSSkH.js';
2
2
  import '@coinbase/wallet-sdk';
3
3
  import '@reown/appkit';
4
4
  import '@solana/wallet-adapter-base';
@@ -1,4 +1,4 @@
1
- import { L as LoginToFrame, U as User } from './types-BVjRQyBr.js';
1
+ import { L as LoginToFrame, U as User } from './types-CH4HSSkH.js';
2
2
  import '@coinbase/wallet-sdk';
3
3
  import '@reown/appkit';
4
4
  import '@solana/wallet-adapter-base';
@@ -1,7 +1,7 @@
1
1
  import * as react from 'react';
2
2
  import react__default, { MouseEvent } from 'react';
3
- import { m as WalletClientType, d as UserRecoveryMethod, n as PrivyFarcasterSignerInitResponse, o as MfaSubmitArgs, E as EthereumRpcRequestType, p as SolanaRpcRequestType, q as EthereumRpcResponseType, r as SolanaRpcResponseType, s as PrivyClientConfig, u as EIP1193Provider, v as EntropyIdVerifier$1, H as HDWalletWithMetadata, w as RequestArguments, x as WalletTimeoutError, y as WalletConnector, B as BaseConnectedEthereumWallet, z as ConnectedWalletMetadata, A as ConnectorType, D as WalletListEntry, G as AppConfig, I as BaseConnectedWallet, l as SolanaWalletConnector, U as User, J as ConnectWalletModalOptions, K as LoginModalOptions, g as CreateWalletOptions, W as Wallet, N as SetWalletRecoveryOptions, i as SignMessageModalUIOptions, Q as SignTypedDataParams, M as MfaMethod, T as UnsignedTransactionRequest, h as SendTransactionModalUIOptions, V as FundWalletConfig, X as ConnectedWallet, O as OAuthTokens, Y as CrossAppProviderDetails, Z as OAuthProviderType, _ as MoonpaySignRequest, $ as MoonpaySignResponse, a0 as SmartWalletConfig, a as LoginMethod, a1 as SiweWalletMetadata, a2 as TelegramAuthResult, a3 as TelegramWebAppData, a4 as OAuthUserInfo, a5 as SiwsMessageType, a6 as OAuthFlowState, a7 as LoginWithCode, a8 as OtpFlowState, a9 as PasskeyFlowState, aa as SiweFlowState, ab as UnsignedTransactionRequestWithChainId, ac as BaseConnectedWalletType, C as ConnectedSolanaWallet, ad as SessionSignerInput, ae as TelegramAuthFlowState } from './types-BVjRQyBr.js';
4
- export { ax as Apple, aI as AppleOAuthWithMetadata, aQ as ContractUIOptions, aA as CrossAppAccount, aL as CrossAppAccountWithMetadata, au as Discord, aE as DiscordOAuthWithMetadata, aN as Email, ap as EmailWithMetadata, aU as Farcaster, aJ as FarcasterWithMetadata, av as Github, aF as GithubOAuthWithMetadata, as as Google, aC as GoogleOAuthWithMetadata, aB as LinkedAccountType, b as LinkedAccountWithMetadata, aw as LinkedIn, aH as LinkedInOAuthWithMetadata, aW as LoginMethodOrderOption, ag as MessageTypes, ai as MoonpayConfig, aj as MoonpayCurrencyCode, aS as MoonpayFundingConfig, ak as MoonpayPaymentMethod, aR as NativeFundingConfig, ao as NonEmptyArray, aV as Passkey, aM as PasskeyWithMetadata, aO as Phone, aq as PhoneWithMetadata, aT as PriceDisplayOptions, P as PrivyErrorCode, al as Quantity, ah as SmartWallet, f as SolanaCluster, k as SolanaFundingConfig, S as SolanaTransactionReceipt, e as SupportedSolanaTransaction, az as Telegram, aK as TelegramWithMetadata, ay as Tiktok, aG as TiktokOAuthWithMetadata, am as TransactionLog, an as TransactionReceipt, aP as TransactionUIOptions, at as Twitter, aD as TwitterOAuthWithMetadata, af as TypedMessage, ar as WalletWithMetadata } from './types-BVjRQyBr.js';
3
+ import { m as WalletClientType, d as UserRecoveryMethod, n as PrivyFarcasterSignerInitResponse, o as MfaSubmitArgs, E as EthereumRpcRequestType, p as SolanaRpcRequestType, q as EthereumRpcResponseType, r as SolanaRpcResponseType, s as PrivyClientConfig, u as EIP1193Provider, v as EntropyIdVerifier$1, H as HDWalletWithMetadata, w as RequestArguments, x as WalletTimeoutError, y as WalletConnector, B as BaseConnectedEthereumWallet, z as ConnectedWalletMetadata, A as ConnectorType, D as WalletListEntry, G as AppConfig, I as BaseConnectedWallet, l as SolanaWalletConnector, U as User, J as ConnectWalletModalOptions, K as LoginModalOptions, g as CreateWalletOptions, W as Wallet, N as SetWalletRecoveryOptions, i as SignMessageModalUIOptions, Q as SignTypedDataParams, M as MfaMethod, T as UnsignedTransactionRequest, h as SendTransactionModalUIOptions, V as FundWalletConfig, X as ConnectedWallet, O as OAuthTokens, Y as CrossAppProviderDetails, Z as OAuthProviderType, _ as MoonpaySignRequest, $ as MoonpaySignResponse, a0 as SmartWalletConfig, a as LoginMethod, a1 as SiweWalletMetadata, a2 as TelegramAuthResult, a3 as TelegramWebAppData, a4 as OAuthUserInfo, a5 as SiwsMessageType, a6 as OAuthFlowState, a7 as LoginWithCode, a8 as OtpFlowState, a9 as PasskeyFlowState, aa as SiweFlowState, ab as UnsignedTransactionRequestWithChainId, ac as BaseConnectedWalletType, C as ConnectedSolanaWallet, ad as SessionSignerInput, ae as TelegramAuthFlowState } from './types-CH4HSSkH.js';
4
+ export { ax as Apple, aI as AppleOAuthWithMetadata, aQ as ContractUIOptions, aA as CrossAppAccount, aL as CrossAppAccountWithMetadata, au as Discord, aE as DiscordOAuthWithMetadata, aN as Email, ap as EmailWithMetadata, aU as Farcaster, aJ as FarcasterWithMetadata, av as Github, aF as GithubOAuthWithMetadata, as as Google, aC as GoogleOAuthWithMetadata, aB as LinkedAccountType, b as LinkedAccountWithMetadata, aw as LinkedIn, aH as LinkedInOAuthWithMetadata, aW as LoginMethodOrderOption, ag as MessageTypes, ai as MoonpayConfig, aj as MoonpayCurrencyCode, aS as MoonpayFundingConfig, ak as MoonpayPaymentMethod, aR as NativeFundingConfig, ao as NonEmptyArray, aV as Passkey, aM as PasskeyWithMetadata, aO as Phone, aq as PhoneWithMetadata, aT as PriceDisplayOptions, P as PrivyErrorCode, al as Quantity, ah as SmartWallet, f as SolanaCluster, k as SolanaFundingConfig, S as SolanaTransactionReceipt, e as SupportedSolanaTransaction, az as Telegram, aK as TelegramWithMetadata, ay as Tiktok, aG as TiktokOAuthWithMetadata, am as TransactionLog, an as TransactionReceipt, aP as TransactionUIOptions, at as Twitter, aD as TwitterOAuthWithMetadata, af as TypedMessage, ar as WalletWithMetadata } from './types-CH4HSSkH.js';
5
5
  import * as react_jsx_runtime from 'react/jsx-runtime';
6
6
  import { TurnstileProps } from '@marsidev/react-turnstile';
7
7
  import { AppKit } from '@reown/appkit';
@@ -16,8 +16,8 @@ import * as _simplewebauthn_types from '@simplewebauthn/types';
16
16
  import { PublicKeyCredentialRequestOptionsJSON } from '@simplewebauthn/types';
17
17
  import { Cluster } from '@solana/web3.js';
18
18
  import { FetchOptions } from 'ofetch';
19
- import { P as PrivyEvents } from './useSolanaWallets-B9ju3nTn.js';
20
- export { C as CallbackError, U as UseSolanaWalletsInterface, u as useSolanaWallets } from './useSolanaWallets-B9ju3nTn.js';
19
+ import { P as PrivyEvents } from './useSolanaWallets-NCQrusNU.js';
20
+ export { C as CallbackError, U as UseSolanaWalletsInterface, u as useSolanaWallets } from './useSolanaWallets-NCQrusNU.js';
21
21
  import '@coinbase/wallet-sdk';
22
22
  import '@solana/wallet-adapter-base';
23
23
  import '@solana/wallet-standard-features';
@@ -3259,6 +3259,36 @@ declare function useUpdateAccount(callbacks?: PrivyEvents['update']): {
3259
3259
  updatePhone: () => void;
3260
3260
  };
3261
3261
 
3262
+ /**
3263
+ * The interface for the `useUpdateEmail` hook.
3264
+ *
3265
+ * @param state - The current state of the email OTP process.
3266
+ * @param sendCode - Send a code to the new email address.
3267
+ * @param verifyCode - Verify the code and update the email address.
3268
+ */
3269
+ interface UseUpdateEmailInterface {
3270
+ state: OtpFlowState;
3271
+ sendCode: (input: {
3272
+ newEmailAddress: string;
3273
+ }) => Promise<void>;
3274
+ verifyCode: (input: {
3275
+ code: string;
3276
+ }) => Promise<{
3277
+ user: User;
3278
+ } | undefined>;
3279
+ }
3280
+ /**
3281
+ * Use this hook to headlessly update a user's email address and to attach callbacks
3282
+ * for successful `updateEmail`, and`updateEmail` errors.
3283
+ *
3284
+ * @param callbacks.onSuccess - Callback to execute after successful email update.
3285
+ * @param callbacks.onError - Callback to execute if there is an error during email update.
3286
+ * @returns state - The current state of the email OTP process.
3287
+ * @returns sendCode - Send a code to the new email address.
3288
+ * @returns verifyCode - Verify the code and update the email address.
3289
+ */
3290
+ declare const useUpdateEmail: (callbacks?: PrivyEvents["update"]) => UseUpdateEmailInterface;
3291
+
3262
3292
  /**
3263
3293
  * Use this hook to connect the user's external wallet, and to attach
3264
3294
  * callbacks after a user successfully connects their wallet, or if there
@@ -4088,4 +4118,4 @@ declare const LoginModal: ({ open }: {
4088
4118
  open: boolean;
4089
4119
  }) => react_jsx_runtime.JSX.Element;
4090
4120
 
4091
- export { BaseConnectedWalletType, Captcha, ConnectWalletModalOptions, ConnectedSolanaWallet, ConnectedWallet, ConnectorManager, type CustomAuthFlowState, EIP1193Provider, EthereumWalletConnector, FundWalletConfig, type JwtAuthFlowState, LoginModal, LoginModalOptions, LoginWithCode, MfaMethod, OAuthFlowState, OAuthProviderType, OAuthTokens, OtpFlowState, PasskeyFlowState, PrivyClient, PrivyClientConfig, PrivyEvents, type PrivyInterface, PrivyProvider, type PrivyProviderProps, type SendCodeToEmail, type SendCodeToSms, SendTransactionModalUIOptions, SignMessageModalUIOptions, SignTypedDataParams, SiweFlowState, TelegramAuthFlowState, UnsignedTransactionRequest, type UseAuthorizationSignatureInterface, type UseConnectCoinbaseSmartWalletInterface, type UseCustomAuth, type UseDelegatedActionsInterface, type UseFundWalletInterface, type UseImportWalletInterface, type UseLinkJwtAccount, type UseLinkWithPasskey, type UseLoginWithEmail, type UseLoginWithPasskey, 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, useActiveWallet, useAuthorizationSignature, useConnectCoinbaseSmartWallet, useConnectOrCreateWallet, useConnectWallet, useCreateWallet, useCrossAppAccounts, useCustomAuth, useDelegatedActions, useFarcasterSigner, useFundWallet, useGuestAccounts, useHeadlessDelegatedActions, useIdentityToken, useImportWallet, useLinkAccount, useLinkJwtAccount, useLinkWithPasskey, useLinkWithSiwe, useLogin, useLoginWithEmail, useLoginWithFarcasterV2, useLoginWithOAuth, useLoginWithPasskey, useLoginWithSiwe, useLoginWithSms, useLoginWithTelegram, useLogout, useMfa, useMfaEnrollment, useModalStatus, useOAuthTokens, usePrivy, useRecoverEmbeddedWallet, useRegisterMfaListener, useSendTransaction, useSessionSigners, useSetWalletPassword, useSetWalletRecovery, useSign7702Authorization, useSignAuthorization, useSignMessage, useSignTransaction, useSignTypedData, useSignupWithPasskey, useSubscribeToJwtAuthWithFlag, useSyncJwtBasedAuthState, useToken, useUpdateAccount, useUser, useWallets };
4121
+ export { BaseConnectedWalletType, Captcha, ConnectWalletModalOptions, ConnectedSolanaWallet, ConnectedWallet, ConnectorManager, type CustomAuthFlowState, EIP1193Provider, EthereumWalletConnector, FundWalletConfig, type JwtAuthFlowState, LoginModal, LoginModalOptions, LoginWithCode, MfaMethod, OAuthFlowState, OAuthProviderType, OAuthTokens, OtpFlowState, PasskeyFlowState, PrivyClient, PrivyClientConfig, PrivyEvents, type PrivyInterface, PrivyProvider, type PrivyProviderProps, type SendCodeToEmail, type SendCodeToSms, SendTransactionModalUIOptions, SignMessageModalUIOptions, SignTypedDataParams, SiweFlowState, TelegramAuthFlowState, UnsignedTransactionRequest, type UseAuthorizationSignatureInterface, type UseConnectCoinbaseSmartWalletInterface, type UseCustomAuth, type UseDelegatedActionsInterface, type UseFundWalletInterface, type UseImportWalletInterface, type UseLinkJwtAccount, type UseLinkWithPasskey, type UseLoginWithEmail, type UseLoginWithPasskey, 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, useActiveWallet, useAuthorizationSignature, useConnectCoinbaseSmartWallet, useConnectOrCreateWallet, useConnectWallet, useCreateWallet, useCrossAppAccounts, useCustomAuth, useDelegatedActions, useFarcasterSigner, useFundWallet, useGuestAccounts, useHeadlessDelegatedActions, useIdentityToken, useImportWallet, useLinkAccount, useLinkJwtAccount, useLinkWithPasskey, useLinkWithSiwe, useLogin, useLoginWithEmail, useLoginWithFarcasterV2, useLoginWithOAuth, useLoginWithPasskey, useLoginWithSiwe, useLoginWithSms, useLoginWithTelegram, useLogout, useMfa, useMfaEnrollment, useModalStatus, useOAuthTokens, usePrivy, useRecoverEmbeddedWallet, useRegisterMfaListener, useSendTransaction, useSessionSigners, useSetWalletPassword, useSetWalletRecovery, useSign7702Authorization, useSignAuthorization, useSignMessage, useSignTransaction, useSignTypedData, useSignupWithPasskey, useSubscribeToJwtAuthWithFlag, useSyncJwtBasedAuthState, useToken, useUpdateAccount, useUpdateEmail, useUser, useWallets };
@@ -1,7 +1,7 @@
1
1
  import * as react from 'react';
2
2
  import react__default, { MouseEvent } from 'react';
3
- import { m as WalletClientType, d as UserRecoveryMethod, n as PrivyFarcasterSignerInitResponse, o as MfaSubmitArgs, E as EthereumRpcRequestType, p as SolanaRpcRequestType, q as EthereumRpcResponseType, r as SolanaRpcResponseType, s as PrivyClientConfig, u as EIP1193Provider, v as EntropyIdVerifier$1, H as HDWalletWithMetadata, w as RequestArguments, x as WalletTimeoutError, y as WalletConnector, B as BaseConnectedEthereumWallet, z as ConnectedWalletMetadata, A as ConnectorType, D as WalletListEntry, G as AppConfig, I as BaseConnectedWallet, l as SolanaWalletConnector, U as User, J as ConnectWalletModalOptions, K as LoginModalOptions, g as CreateWalletOptions, W as Wallet, N as SetWalletRecoveryOptions, i as SignMessageModalUIOptions, Q as SignTypedDataParams, M as MfaMethod, T as UnsignedTransactionRequest, h as SendTransactionModalUIOptions, V as FundWalletConfig, X as ConnectedWallet, O as OAuthTokens, Y as CrossAppProviderDetails, Z as OAuthProviderType, _ as MoonpaySignRequest, $ as MoonpaySignResponse, a0 as SmartWalletConfig, a as LoginMethod, a1 as SiweWalletMetadata, a2 as TelegramAuthResult, a3 as TelegramWebAppData, a4 as OAuthUserInfo, a5 as SiwsMessageType, a6 as OAuthFlowState, a7 as LoginWithCode, a8 as OtpFlowState, a9 as PasskeyFlowState, aa as SiweFlowState, ab as UnsignedTransactionRequestWithChainId, ac as BaseConnectedWalletType, C as ConnectedSolanaWallet, ad as SessionSignerInput, ae as TelegramAuthFlowState } from './types-BVjRQyBr.js';
4
- export { ax as Apple, aI as AppleOAuthWithMetadata, aQ as ContractUIOptions, aA as CrossAppAccount, aL as CrossAppAccountWithMetadata, au as Discord, aE as DiscordOAuthWithMetadata, aN as Email, ap as EmailWithMetadata, aU as Farcaster, aJ as FarcasterWithMetadata, av as Github, aF as GithubOAuthWithMetadata, as as Google, aC as GoogleOAuthWithMetadata, aB as LinkedAccountType, b as LinkedAccountWithMetadata, aw as LinkedIn, aH as LinkedInOAuthWithMetadata, aW as LoginMethodOrderOption, ag as MessageTypes, ai as MoonpayConfig, aj as MoonpayCurrencyCode, aS as MoonpayFundingConfig, ak as MoonpayPaymentMethod, aR as NativeFundingConfig, ao as NonEmptyArray, aV as Passkey, aM as PasskeyWithMetadata, aO as Phone, aq as PhoneWithMetadata, aT as PriceDisplayOptions, P as PrivyErrorCode, al as Quantity, ah as SmartWallet, f as SolanaCluster, k as SolanaFundingConfig, S as SolanaTransactionReceipt, e as SupportedSolanaTransaction, az as Telegram, aK as TelegramWithMetadata, ay as Tiktok, aG as TiktokOAuthWithMetadata, am as TransactionLog, an as TransactionReceipt, aP as TransactionUIOptions, at as Twitter, aD as TwitterOAuthWithMetadata, af as TypedMessage, ar as WalletWithMetadata } from './types-BVjRQyBr.js';
3
+ import { m as WalletClientType, d as UserRecoveryMethod, n as PrivyFarcasterSignerInitResponse, o as MfaSubmitArgs, E as EthereumRpcRequestType, p as SolanaRpcRequestType, q as EthereumRpcResponseType, r as SolanaRpcResponseType, s as PrivyClientConfig, u as EIP1193Provider, v as EntropyIdVerifier$1, H as HDWalletWithMetadata, w as RequestArguments, x as WalletTimeoutError, y as WalletConnector, B as BaseConnectedEthereumWallet, z as ConnectedWalletMetadata, A as ConnectorType, D as WalletListEntry, G as AppConfig, I as BaseConnectedWallet, l as SolanaWalletConnector, U as User, J as ConnectWalletModalOptions, K as LoginModalOptions, g as CreateWalletOptions, W as Wallet, N as SetWalletRecoveryOptions, i as SignMessageModalUIOptions, Q as SignTypedDataParams, M as MfaMethod, T as UnsignedTransactionRequest, h as SendTransactionModalUIOptions, V as FundWalletConfig, X as ConnectedWallet, O as OAuthTokens, Y as CrossAppProviderDetails, Z as OAuthProviderType, _ as MoonpaySignRequest, $ as MoonpaySignResponse, a0 as SmartWalletConfig, a as LoginMethod, a1 as SiweWalletMetadata, a2 as TelegramAuthResult, a3 as TelegramWebAppData, a4 as OAuthUserInfo, a5 as SiwsMessageType, a6 as OAuthFlowState, a7 as LoginWithCode, a8 as OtpFlowState, a9 as PasskeyFlowState, aa as SiweFlowState, ab as UnsignedTransactionRequestWithChainId, ac as BaseConnectedWalletType, C as ConnectedSolanaWallet, ad as SessionSignerInput, ae as TelegramAuthFlowState } from './types-CH4HSSkH.js';
4
+ export { ax as Apple, aI as AppleOAuthWithMetadata, aQ as ContractUIOptions, aA as CrossAppAccount, aL as CrossAppAccountWithMetadata, au as Discord, aE as DiscordOAuthWithMetadata, aN as Email, ap as EmailWithMetadata, aU as Farcaster, aJ as FarcasterWithMetadata, av as Github, aF as GithubOAuthWithMetadata, as as Google, aC as GoogleOAuthWithMetadata, aB as LinkedAccountType, b as LinkedAccountWithMetadata, aw as LinkedIn, aH as LinkedInOAuthWithMetadata, aW as LoginMethodOrderOption, ag as MessageTypes, ai as MoonpayConfig, aj as MoonpayCurrencyCode, aS as MoonpayFundingConfig, ak as MoonpayPaymentMethod, aR as NativeFundingConfig, ao as NonEmptyArray, aV as Passkey, aM as PasskeyWithMetadata, aO as Phone, aq as PhoneWithMetadata, aT as PriceDisplayOptions, P as PrivyErrorCode, al as Quantity, ah as SmartWallet, f as SolanaCluster, k as SolanaFundingConfig, S as SolanaTransactionReceipt, e as SupportedSolanaTransaction, az as Telegram, aK as TelegramWithMetadata, ay as Tiktok, aG as TiktokOAuthWithMetadata, am as TransactionLog, an as TransactionReceipt, aP as TransactionUIOptions, at as Twitter, aD as TwitterOAuthWithMetadata, af as TypedMessage, ar as WalletWithMetadata } from './types-CH4HSSkH.js';
5
5
  import * as react_jsx_runtime from 'react/jsx-runtime';
6
6
  import { TurnstileProps } from '@marsidev/react-turnstile';
7
7
  import { AppKit } from '@reown/appkit';
@@ -16,8 +16,8 @@ import * as _simplewebauthn_types from '@simplewebauthn/types';
16
16
  import { PublicKeyCredentialRequestOptionsJSON } from '@simplewebauthn/types';
17
17
  import { Cluster } from '@solana/web3.js';
18
18
  import { FetchOptions } from 'ofetch';
19
- import { P as PrivyEvents } from './useSolanaWallets-B9ju3nTn.js';
20
- export { C as CallbackError, U as UseSolanaWalletsInterface, u as useSolanaWallets } from './useSolanaWallets-B9ju3nTn.js';
19
+ import { P as PrivyEvents } from './useSolanaWallets-NCQrusNU.js';
20
+ export { C as CallbackError, U as UseSolanaWalletsInterface, u as useSolanaWallets } from './useSolanaWallets-NCQrusNU.js';
21
21
  import '@coinbase/wallet-sdk';
22
22
  import '@solana/wallet-adapter-base';
23
23
  import '@solana/wallet-standard-features';
@@ -3259,6 +3259,36 @@ declare function useUpdateAccount(callbacks?: PrivyEvents['update']): {
3259
3259
  updatePhone: () => void;
3260
3260
  };
3261
3261
 
3262
+ /**
3263
+ * The interface for the `useUpdateEmail` hook.
3264
+ *
3265
+ * @param state - The current state of the email OTP process.
3266
+ * @param sendCode - Send a code to the new email address.
3267
+ * @param verifyCode - Verify the code and update the email address.
3268
+ */
3269
+ interface UseUpdateEmailInterface {
3270
+ state: OtpFlowState;
3271
+ sendCode: (input: {
3272
+ newEmailAddress: string;
3273
+ }) => Promise<void>;
3274
+ verifyCode: (input: {
3275
+ code: string;
3276
+ }) => Promise<{
3277
+ user: User;
3278
+ } | undefined>;
3279
+ }
3280
+ /**
3281
+ * Use this hook to headlessly update a user's email address and to attach callbacks
3282
+ * for successful `updateEmail`, and`updateEmail` errors.
3283
+ *
3284
+ * @param callbacks.onSuccess - Callback to execute after successful email update.
3285
+ * @param callbacks.onError - Callback to execute if there is an error during email update.
3286
+ * @returns state - The current state of the email OTP process.
3287
+ * @returns sendCode - Send a code to the new email address.
3288
+ * @returns verifyCode - Verify the code and update the email address.
3289
+ */
3290
+ declare const useUpdateEmail: (callbacks?: PrivyEvents["update"]) => UseUpdateEmailInterface;
3291
+
3262
3292
  /**
3263
3293
  * Use this hook to connect the user's external wallet, and to attach
3264
3294
  * callbacks after a user successfully connects their wallet, or if there
@@ -4088,4 +4118,4 @@ declare const LoginModal: ({ open }: {
4088
4118
  open: boolean;
4089
4119
  }) => react_jsx_runtime.JSX.Element;
4090
4120
 
4091
- export { BaseConnectedWalletType, Captcha, ConnectWalletModalOptions, ConnectedSolanaWallet, ConnectedWallet, ConnectorManager, type CustomAuthFlowState, EIP1193Provider, EthereumWalletConnector, FundWalletConfig, type JwtAuthFlowState, LoginModal, LoginModalOptions, LoginWithCode, MfaMethod, OAuthFlowState, OAuthProviderType, OAuthTokens, OtpFlowState, PasskeyFlowState, PrivyClient, PrivyClientConfig, PrivyEvents, type PrivyInterface, PrivyProvider, type PrivyProviderProps, type SendCodeToEmail, type SendCodeToSms, SendTransactionModalUIOptions, SignMessageModalUIOptions, SignTypedDataParams, SiweFlowState, TelegramAuthFlowState, UnsignedTransactionRequest, type UseAuthorizationSignatureInterface, type UseConnectCoinbaseSmartWalletInterface, type UseCustomAuth, type UseDelegatedActionsInterface, type UseFundWalletInterface, type UseImportWalletInterface, type UseLinkJwtAccount, type UseLinkWithPasskey, type UseLoginWithEmail, type UseLoginWithPasskey, 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, useActiveWallet, useAuthorizationSignature, useConnectCoinbaseSmartWallet, useConnectOrCreateWallet, useConnectWallet, useCreateWallet, useCrossAppAccounts, useCustomAuth, useDelegatedActions, useFarcasterSigner, useFundWallet, useGuestAccounts, useHeadlessDelegatedActions, useIdentityToken, useImportWallet, useLinkAccount, useLinkJwtAccount, useLinkWithPasskey, useLinkWithSiwe, useLogin, useLoginWithEmail, useLoginWithFarcasterV2, useLoginWithOAuth, useLoginWithPasskey, useLoginWithSiwe, useLoginWithSms, useLoginWithTelegram, useLogout, useMfa, useMfaEnrollment, useModalStatus, useOAuthTokens, usePrivy, useRecoverEmbeddedWallet, useRegisterMfaListener, useSendTransaction, useSessionSigners, useSetWalletPassword, useSetWalletRecovery, useSign7702Authorization, useSignAuthorization, useSignMessage, useSignTransaction, useSignTypedData, useSignupWithPasskey, useSubscribeToJwtAuthWithFlag, useSyncJwtBasedAuthState, useToken, useUpdateAccount, useUser, useWallets };
4121
+ export { BaseConnectedWalletType, Captcha, ConnectWalletModalOptions, ConnectedSolanaWallet, ConnectedWallet, ConnectorManager, type CustomAuthFlowState, EIP1193Provider, EthereumWalletConnector, FundWalletConfig, type JwtAuthFlowState, LoginModal, LoginModalOptions, LoginWithCode, MfaMethod, OAuthFlowState, OAuthProviderType, OAuthTokens, OtpFlowState, PasskeyFlowState, PrivyClient, PrivyClientConfig, PrivyEvents, type PrivyInterface, PrivyProvider, type PrivyProviderProps, type SendCodeToEmail, type SendCodeToSms, SendTransactionModalUIOptions, SignMessageModalUIOptions, SignTypedDataParams, SiweFlowState, TelegramAuthFlowState, UnsignedTransactionRequest, type UseAuthorizationSignatureInterface, type UseConnectCoinbaseSmartWalletInterface, type UseCustomAuth, type UseDelegatedActionsInterface, type UseFundWalletInterface, type UseImportWalletInterface, type UseLinkJwtAccount, type UseLinkWithPasskey, type UseLoginWithEmail, type UseLoginWithPasskey, 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, useActiveWallet, useAuthorizationSignature, useConnectCoinbaseSmartWallet, useConnectOrCreateWallet, useConnectWallet, useCreateWallet, useCrossAppAccounts, useCustomAuth, useDelegatedActions, useFarcasterSigner, useFundWallet, useGuestAccounts, useHeadlessDelegatedActions, useIdentityToken, useImportWallet, useLinkAccount, useLinkJwtAccount, useLinkWithPasskey, useLinkWithSiwe, useLogin, useLoginWithEmail, useLoginWithFarcasterV2, useLoginWithOAuth, useLoginWithPasskey, useLoginWithSiwe, useLoginWithSms, useLoginWithTelegram, useLogout, useMfa, useMfaEnrollment, useModalStatus, useOAuthTokens, usePrivy, useRecoverEmbeddedWallet, useRegisterMfaListener, useSendTransaction, useSessionSigners, useSetWalletPassword, useSetWalletRecovery, useSign7702Authorization, useSignAuthorization, useSignMessage, useSignTransaction, useSignTypedData, useSignupWithPasskey, useSubscribeToJwtAuthWithFlag, useSyncJwtBasedAuthState, useToken, useUpdateAccount, useUpdateEmail, useUser, useWallets };
@@ -4,7 +4,7 @@ import { SmartAccountClient } from 'permissionless';
4
4
  import { SendTransactionParameters, Chain, Hash, SignableMessage, Hex, TypedData, SignTypedDataParameters, EIP1193Provider, PublicClient, HttpTransport, WalletClient, PaymasterRpcSchema } from 'viem';
5
5
  import { SmartAccount, SendUserOperationParameters } from 'viem/account-abstraction';
6
6
  import { SmartWalletType } from '@privy-io/js-sdk-core';
7
- import { h as SendTransactionModalUIOptions, i as SignMessageModalUIOptions } from './types-BVjRQyBr.js';
7
+ import { h as SendTransactionModalUIOptions, i as SignMessageModalUIOptions } from './types-CH4HSSkH.js';
8
8
  import '@coinbase/wallet-sdk';
9
9
  import '@reown/appkit';
10
10
  import '@solana/wallet-adapter-base';
@@ -4,7 +4,7 @@ import { SmartAccountClient } from 'permissionless';
4
4
  import { SendTransactionParameters, Chain, Hash, SignableMessage, Hex, TypedData, SignTypedDataParameters, EIP1193Provider, PublicClient, HttpTransport, WalletClient, PaymasterRpcSchema } from 'viem';
5
5
  import { SmartAccount, SendUserOperationParameters } from 'viem/account-abstraction';
6
6
  import { SmartWalletType } from '@privy-io/js-sdk-core';
7
- import { h as SendTransactionModalUIOptions, i as SignMessageModalUIOptions } from './types-BVjRQyBr.js';
7
+ import { h as SendTransactionModalUIOptions, i as SignMessageModalUIOptions } from './types-CH4HSSkH.js';
8
8
  import '@coinbase/wallet-sdk';
9
9
  import '@reown/appkit';
10
10
  import '@solana/wallet-adapter-base';
@@ -1,7 +1,7 @@
1
- import { W as Wallet, j as SolanaStandardWallet, k as SolanaFundingConfig, e as SupportedSolanaTransaction, h as SendTransactionModalUIOptions, S as SolanaTransactionReceipt, i as SignMessageModalUIOptions } from './types-BVjRQyBr.js';
2
- export { C as ConnectedSolanaWallet, l as SolanaAdapterConnector, t as toSolanaWalletConnectors } from './types-BVjRQyBr.js';
3
- import { P as PrivyEvents } from './useSolanaWallets-B9ju3nTn.js';
4
- export { U as UseSolanaWalletsInterface, u as useSolanaWallets } from './useSolanaWallets-B9ju3nTn.js';
1
+ import { W as Wallet, j as SolanaStandardWallet, k as SolanaFundingConfig, e as SupportedSolanaTransaction, h as SendTransactionModalUIOptions, S as SolanaTransactionReceipt, i as SignMessageModalUIOptions } from './types-CH4HSSkH.js';
2
+ export { C as ConnectedSolanaWallet, l as SolanaAdapterConnector, t as toSolanaWalletConnectors } from './types-CH4HSSkH.js';
3
+ import { P as PrivyEvents } from './useSolanaWallets-NCQrusNU.js';
4
+ export { U as UseSolanaWalletsInterface, u as useSolanaWallets } from './useSolanaWallets-NCQrusNU.js';
5
5
  import { SolanaSignAndSendTransactionFeature, SolanaSignTransactionFeature, SolanaSignMessageFeature } from '@solana/wallet-standard-features';
6
6
  import { WalletAccount, WalletIcon, WalletVersion } from '@wallet-standard/base';
7
7
  import { StandardConnectFeature, StandardDisconnectFeature, StandardEventsFeature } from '@wallet-standard/features';
@@ -1,7 +1,7 @@
1
- import { W as Wallet, j as SolanaStandardWallet, k as SolanaFundingConfig, e as SupportedSolanaTransaction, h as SendTransactionModalUIOptions, S as SolanaTransactionReceipt, i as SignMessageModalUIOptions } from './types-BVjRQyBr.js';
2
- export { C as ConnectedSolanaWallet, l as SolanaAdapterConnector, t as toSolanaWalletConnectors } from './types-BVjRQyBr.js';
3
- import { P as PrivyEvents } from './useSolanaWallets-B9ju3nTn.js';
4
- export { U as UseSolanaWalletsInterface, u as useSolanaWallets } from './useSolanaWallets-B9ju3nTn.js';
1
+ import { W as Wallet, j as SolanaStandardWallet, k as SolanaFundingConfig, e as SupportedSolanaTransaction, h as SendTransactionModalUIOptions, S as SolanaTransactionReceipt, i as SignMessageModalUIOptions } from './types-CH4HSSkH.js';
2
+ export { C as ConnectedSolanaWallet, l as SolanaAdapterConnector, t as toSolanaWalletConnectors } from './types-CH4HSSkH.js';
3
+ import { P as PrivyEvents } from './useSolanaWallets-NCQrusNU.js';
4
+ export { U as UseSolanaWalletsInterface, u as useSolanaWallets } from './useSolanaWallets-NCQrusNU.js';
5
5
  import { SolanaSignAndSendTransactionFeature, SolanaSignTransactionFeature, SolanaSignMessageFeature } from '@solana/wallet-standard-features';
6
6
  import { WalletAccount, WalletIcon, WalletVersion } from '@wallet-standard/base';
7
7
  import { StandardConnectFeature, StandardDisconnectFeature, StandardEventsFeature } from '@wallet-standard/features';
@@ -2159,6 +2159,7 @@ type RuntimeLoginOverridableOptions = {
2159
2159
  /** Options for Privy's `connectWallet` method */
2160
2160
  type ExternalConnectWalletModalOptions = {
2161
2161
  /**
2162
+ * @deprecated Use `description` instead to provide custom text for the connect wallet modal.
2162
2163
  * An address to suggest the user to connect in Privy's UIs. This is only a suggestion for the
2163
2164
  * user and the method will not error if they connect a different address.
2164
2165
  */
@@ -2171,6 +2172,12 @@ type ExternalConnectWalletModalOptions = {
2171
2172
  * Filter the login wallet options to only show wallets that support the specified chain type.
2172
2173
  */
2173
2174
  walletChainType?: NonNullable<PrivyClientConfig['appearance']>['walletChainType'];
2175
+ /**
2176
+ * Custom description text to display in the connect wallet modal. If not provided,
2177
+ * a default description will be shown based on the context (e.g., "Connect a wallet to your [app] account").
2178
+ * To hide completely, set to an empty string.
2179
+ */
2180
+ description?: string;
2174
2181
  };
2175
2182
  /** Options for Privy's `createWallet` method */
2176
2183
  type CreateWalletOptions = {
@@ -2159,6 +2159,7 @@ type RuntimeLoginOverridableOptions = {
2159
2159
  /** Options for Privy's `connectWallet` method */
2160
2160
  type ExternalConnectWalletModalOptions = {
2161
2161
  /**
2162
+ * @deprecated Use `description` instead to provide custom text for the connect wallet modal.
2162
2163
  * An address to suggest the user to connect in Privy's UIs. This is only a suggestion for the
2163
2164
  * user and the method will not error if they connect a different address.
2164
2165
  */
@@ -2171,6 +2172,12 @@ type ExternalConnectWalletModalOptions = {
2171
2172
  * Filter the login wallet options to only show wallets that support the specified chain type.
2172
2173
  */
2173
2174
  walletChainType?: NonNullable<PrivyClientConfig['appearance']>['walletChainType'];
2175
+ /**
2176
+ * Custom description text to display in the connect wallet modal. If not provided,
2177
+ * a default description will be shown based on the context (e.g., "Connect a wallet to your [app] account").
2178
+ * To hide completely, set to an empty string.
2179
+ */
2180
+ description?: string;
2174
2181
  };
2175
2182
  /** Options for Privy's `createWallet` method */
2176
2183
  type CreateWalletOptions = {
package/dist/dts/ui.d.mts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import { R as RuntimeLoginOverridableOptions } from './types-BVjRQyBr.js';
2
+ import { R as RuntimeLoginOverridableOptions } from './types-CH4HSSkH.js';
3
3
  import { Hex } from 'viem';
4
4
  import { Chain, Cluster } from '@privy-io/js-sdk-core';
5
5
  import '@coinbase/wallet-sdk';
@@ -22,6 +22,7 @@ type UserPillProps = {
22
22
  type: 'connectWallet';
23
23
  options?: {
24
24
  suggestedAddress?: string;
25
+ description?: string;
25
26
  };
26
27
  };
27
28
  expanded?: boolean;
package/dist/dts/ui.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import { R as RuntimeLoginOverridableOptions } from './types-BVjRQyBr.js';
2
+ import { R as RuntimeLoginOverridableOptions } from './types-CH4HSSkH.js';
3
3
  import { Hex } from 'viem';
4
4
  import { Chain, Cluster } from '@privy-io/js-sdk-core';
5
5
  import '@coinbase/wallet-sdk';
@@ -22,6 +22,7 @@ type UserPillProps = {
22
22
  type: 'connectWallet';
23
23
  options?: {
24
24
  suggestedAddress?: string;
25
+ description?: string;
25
26
  };
26
27
  };
27
28
  expanded?: boolean;
@@ -1,5 +1,5 @@
1
1
  import { Chain } from '@privy-io/js-sdk-core';
2
- import { P as PrivyErrorCode, U as User, a as LoginMethod, b as LinkedAccountWithMetadata, B as BaseConnectedEthereumWallet, c as BaseConnectedSolanaWallet, W as Wallet, M as MfaMethod, d as UserRecoveryMethod, S as SolanaTransactionReceipt, e as SupportedSolanaTransaction, O as OAuthTokens, F as FundingMethod, f as SolanaCluster, C as ConnectedSolanaWallet, g as CreateWalletOptions } from './types-BVjRQyBr.js';
2
+ import { P as PrivyErrorCode, U as User, a as LoginMethod, b as LinkedAccountWithMetadata, B as BaseConnectedEthereumWallet, c as BaseConnectedSolanaWallet, W as Wallet, M as MfaMethod, d as UserRecoveryMethod, S as SolanaTransactionReceipt, e as SupportedSolanaTransaction, O as OAuthTokens, F as FundingMethod, f as SolanaCluster, C as ConnectedSolanaWallet, g as CreateWalletOptions } from './types-CH4HSSkH.js';
3
3
  import { MouseEvent } from 'react';
4
4
 
5
5
  /**
@@ -1,5 +1,5 @@
1
1
  import { Chain } from '@privy-io/js-sdk-core';
2
- import { P as PrivyErrorCode, U as User, a as LoginMethod, b as LinkedAccountWithMetadata, B as BaseConnectedEthereumWallet, c as BaseConnectedSolanaWallet, W as Wallet, M as MfaMethod, d as UserRecoveryMethod, S as SolanaTransactionReceipt, e as SupportedSolanaTransaction, O as OAuthTokens, F as FundingMethod, f as SolanaCluster, C as ConnectedSolanaWallet, g as CreateWalletOptions } from './types-BVjRQyBr.js';
2
+ import { P as PrivyErrorCode, U as User, a as LoginMethod, b as LinkedAccountWithMetadata, B as BaseConnectedEthereumWallet, c as BaseConnectedSolanaWallet, W as Wallet, M as MfaMethod, d as UserRecoveryMethod, S as SolanaTransactionReceipt, e as SupportedSolanaTransaction, O as OAuthTokens, F as FundingMethod, f as SolanaCluster, C as ConnectedSolanaWallet, g as CreateWalletOptions } from './types-CH4HSSkH.js';
3
3
  import { MouseEvent } from 'react';
4
4
 
5
5
  /**
@@ -1 +1 @@
1
- import{createAbstractClient as e}from"@abstract-foundation/agw-client";import{getBatchTransactionObject as o}from"@abstract-foundation/agw-client/actions";import{hexToNumber as r,createWalletClient as t,custom as n,http as i}from"viem";import{toAccount as a}from"viem/accounts";import{abstractTestnet as s}from"viem/chains";import{u as c,g as l,c as p}from"./use-sign-with-user-signer-CEyk1z8w.mjs";import{e as d,k as m,ao as u,a as h,az as y,aA as I,aB as g,l as v}from"./privy-provider-B2wDQG1e.mjs";import{u as f}from"./internal-context-Bxhby7Hv.mjs";import{g as w}from"./getEmbeddedConnectedWallet-CSSBWE2p.mjs";import{c as C}from"./smart-wallets-DWn4sZHM.mjs";import"react";import"react/jsx-runtime";import"mipd";import"react-device-detect";import"viem/utils";import"@privy-io/js-sdk-core";import"./paths-j39vuJt8.mjs";import"ofetch";import"uuid";import"jose";import"eventemitter3";import"@coinbase/wallet-sdk";import"@privy-io/ethereum";import"@marsidev/react-turnstile";import"styled-components";import"tinycolor2";import"@heroicons/react/24/outline/DevicePhoneMobileIcon";import"@heroicons/react/24/outline/FingerPrintIcon";import"@heroicons/react/24/outline/PhoneIcon";import"@heroicons/react/24/outline/ShieldCheckIcon";import"@heroicons/react/24/outline/ArrowLeftIcon";import"@heroicons/react/24/outline/ArrowRightIcon";import"@heroicons/react/24/outline/QuestionMarkCircleIcon";import"@heroicons/react/24/outline/XMarkIcon";import"@heroicons/react/24/outline/ChevronDownIcon";import"@heroicons/react/24/outline/CalendarIcon";import"@heroicons/react/24/outline/ExclamationTriangleIcon";import"@headlessui/react";import"@walletconnect/ethereum-provider";import"zustand";import"fast-password-entropy";import"secure-password-utilities";import"secure-password-utilities/wordlists";import"@heroicons/react/24/outline/UserCircleIcon";import"@heroicons/react/24/outline/EnvelopeIcon";import"@heroicons/react/20/solid/CheckIcon";import"@heroicons/react/24/outline/WalletIcon";import"@heroicons/react/24/outline/CheckIcon";import"@heroicons/react/24/outline/Square2StackIcon";import"@heroicons/react/24/outline/ExclamationCircleIcon";import"@heroicons/react/24/outline/ArrowTopRightOnSquareIcon";import"@heroicons/react/24/solid/DocumentCheckIcon";import"@heroicons/react/24/solid/XCircleIcon";import"@heroicons/react/24/solid/CheckCircleIcon";import"qrcode";import"@heroicons/react/24/solid/ArrowsRightLeftIcon";import"@heroicons/react/24/outline/ChevronRightIcon";import"@heroicons/react/24/outline/LockClosedIcon";import"@heroicons/react/24/outline/PencilSquareIcon";import"@heroicons/react/24/outline/ArrowPathIcon";import"@heroicons/react/24/outline/EyeIcon";import"@heroicons/react/24/outline/EyeSlashIcon";import"@heroicons/react/24/outline/KeyIcon";import"@heroicons/react/24/outline/ArrowDownTrayIcon";import"@heroicons/react/24/outline/ClipboardDocumentCheckIcon";import"@heroicons/react/24/outline/DocumentDuplicateIcon";import"@heroicons/react/24/solid/LockClosedIcon";import"@heroicons/react/24/outline/CheckCircleIcon";import"@heroicons/react/24/outline/InformationCircleIcon";import"@heroicons/react/24/outline/CreditCardIcon";import"@heroicons/react/24/outline/QrCodeIcon";import"@heroicons/react/24/outline/GlobeAltIcon";import"@heroicons/react/24/outline";import"@heroicons/react/24/outline/ClipboardDocumentIcon";import"@heroicons/react/24/outline/CloudArrowUpIcon";import"@heroicons/react/24/outline/NoSymbolIcon";import"@heroicons/react/24/outline/ClockIcon";import"@heroicons/react/24/outline/TrashIcon";import"@heroicons/react/24/solid/CheckBadgeIcon";import"@heroicons/react/24/solid/IdentificationIcon";import"@heroicons/react/24/outline/MinusCircleIcon";import"@heroicons/react/24/outline/ArrowRightEndOnRectangleIcon";import"@heroicons/react/24/solid/ShieldCheckIcon";import"js-cookie";import"permissionless";import"permissionless/accounts";import"permissionless/clients/pimlico";import"viem/account-abstraction";function T(){let{user:T}=c(),{hideWalletUIs:S,openPrivyModal:P,chains:A,appId:b,rpcConfig:W,client:M}=f(),k=d(),{wallets:F}=m(),{setModalData:q}=u(),x=l(T),R=!!x&&p(x),D=async(o=s.id)=>{let c=w(F);if(!c)throw Error("No connected wallet found");let l="string"==typeof o?r(o):o;if(![s.id,2741].includes(l))throw Error("Error, only Abstract chains are supported");let p=A.find((e=>e.id===l));if(!p)throw Error("Chain not configured");await c.switchChain(p.id);let d=await c.getEthereumProvider(),m=t({account:c.address,transport:n(d)}),u=a({address:c.address,signMessage:m.signMessage,signTransaction:m.signTransaction,signTypedData:m.signTypedData});return await e({chain:p,transport:i(v(p,W,b)),publicTransport:i(v(p,W,b)),signer:u})};return{signMessage:async({message:e},o)=>{let r=await D(o);return new Promise((async(o,t)=>{let{entropyId:n,entropyIdVerifier:i}=h(T);S.current=!0,q({connectWallet:{recoveryMethod:x.recoveryMethod,connectingWalletAddress:x.address,isUnifiedWallet:R,entropyId:n,entropyIdVerifier:i,onCompleteNavigateTo:y,onFailure:()=>{}},signMessage:{method:"personal_sign",data:e,confirmAndSign:()=>r.signMessage({message:e}),onSuccess:e=>o(e),onFailure:t,uiOptions:{isCancellable:!0}}}),P(I)})).finally((()=>{S.current=!1}))},signTypedData:async(e,o)=>{let r=await D(o);return new Promise((async(o,t)=>{S.current=!0;let{entropyId:n,entropyIdVerifier:i}=h(T);q({connectWallet:{recoveryMethod:x.recoveryMethod,connectingWalletAddress:x.address,isUnifiedWallet:R,entropyId:n,entropyIdVerifier:i,onCompleteNavigateTo:y,onFailure:()=>{}},signMessage:{method:"eth_signTypedData_v4",data:e,confirmAndSign:()=>r.signTypedData(e),onSuccess:e=>o(e),onFailure:t,uiOptions:{isCancellable:!0}}}),P(I)})).finally((()=>{S.current=!1}))},sendTransaction:async e=>{let r=await D(e.chainId),t=[],n="calls"in e&&void 0!==e.calls;return t=n?[...e.calls]:[e],new Promise((async(i,a)=>{S.current=!0;let{entropyId:s,entropyIdVerifier:c}=h(T);q({connectWallet:{recoveryMethod:x.recoveryMethod,connectingWalletAddress:x.address,isUnifiedWallet:R,entropyId:s,entropyIdVerifier:c,onCompleteNavigateTo:g,onFailure:()=>{}},sendTransaction:{transactionRequests:C({calls:t,chain:r.chain,maxPriorityFeePerGas:e.maxPriorityFeePerGas,maxFeePerGas:e.maxFeePerGas,nonce:e.nonce?BigInt(e.nonce):void 0}),entropyId:s,entropyIdVerifier:c,transactingWalletAddress:r.account.address,transactingWalletIndex:void 0,prepareTransactionRequest:async()=>{let t=n?o(r.account.address,e):e;return await r.prepareAbstractTransactionRequest({...t,isSponsored:void 0!==t.paymaster&&void 0!==t.paymasterInput})},scanTransaction:async()=>{if(!M)throw Error("Privy client not found");let t=n?o(r.account.address,e):e,i=await r.prepareAbstractTransactionRequest({...t,isSponsored:void 0!==t.paymaster&&void 0!==t.paymasterInput});return await M.scanTransaction({metadata:{domain:k.embeddedWallets.transactionScanning.domain},chain_id:e.chainId.toString(),request:{method:"eth_sendTransaction",params:[{from:i.from,to:i.to,value:i.value?.toString(),gas:i.gas?.toString(),gasPrice:i.gasPrice?.toString(),nonce:i.nonce?.toString(),data:i.data,eip_712_meta:{paymaster_params:{paymaster:i.paymaster,paymaster_input:i.paymasterInput}}}]}})},signOnly:!1,getIsSponsored:async()=>void 0!==e.paymaster&&void 0!==e.paymasterInput,onConfirm:()=>n?r.sendTransactionBatch(e):r.sendTransaction(e),onSuccess:e=>i(e.hash),onFailure:a,uiOptions:{isCancellable:!0}}}),P(I)})).finally((()=>{S.current=!1}))},signTransaction:async e=>{let r=await D(e.chainId),t=[],n="calls"in e&&void 0!==e.calls;return t=n?[...e.calls]:[e],new Promise((async(i,a)=>{S.current=!0;let{entropyId:s,entropyIdVerifier:c}=h(T);q({connectWallet:{recoveryMethod:x.recoveryMethod,connectingWalletAddress:x.address,isUnifiedWallet:R,entropyId:s,entropyIdVerifier:c,onCompleteNavigateTo:g,onFailure:()=>{}},sendTransaction:{transactionRequests:C({calls:t,chain:r.chain,maxPriorityFeePerGas:e.maxPriorityFeePerGas,maxFeePerGas:e.maxFeePerGas,nonce:e.nonce?BigInt(e.nonce):void 0}),entropyId:s,entropyIdVerifier:c,transactingWalletAddress:r.account.address,transactingWalletIndex:void 0,prepareTransactionRequest:async()=>{let t=n?o(r.account.address,e):e;return await r.prepareAbstractTransactionRequest({...t,isSponsored:void 0!==t.paymaster&&void 0!==t.paymasterInput})},scanTransaction:async()=>{if(!M)throw Error("Privy client not found");let t=n?o(r.account.address,e):e,i=await r.prepareAbstractTransactionRequest({...t,isSponsored:void 0!==t.paymaster&&void 0!==t.paymasterInput});return await M.scanTransaction({metadata:{domain:k.embeddedWallets.transactionScanning.domain},chain_id:e.chainId.toString(),request:{method:"eth_sendTransaction",params:[{from:i.from,to:i.to,value:i.value?.toString(),gas:i.gas?.toString(),gasPrice:i.gasPrice?.toString(),nonce:i.nonce?.toString(),data:i.data}]}})},signOnly:!0,getIsSponsored:async()=>void 0!==e.paymaster&&void 0!==e.paymasterInput,onConfirm:async()=>{let t=n?o(r.account.address,e):e,i=await r.prepareAbstractTransactionRequest({...t,isSponsored:void 0!==t.paymaster&&void 0!==t.paymasterInput});return r.signTransaction(i)},onSuccess:e=>i(e.hash),onFailure:a,uiOptions:{isCancellable:!0}}}),P(I)})).finally((()=>{S.current=!1}))}}}export{T as useAbstractSmartWallets};
1
+ import{createAbstractClient as e}from"@abstract-foundation/agw-client";import{getBatchTransactionObject as o}from"@abstract-foundation/agw-client/actions";import{hexToNumber as r,createWalletClient as t,custom as n,http as i}from"viem";import{toAccount as a}from"viem/accounts";import{abstractTestnet as c}from"viem/chains";import{u as s,g as l,c as d}from"./use-sign-with-user-signer-Yg0Gn-gB.mjs";import{e as p,k as m,ap as u,a as h,aA as I,aB as g,aC as y,l as f}from"./privy-provider-9dA1clzB.mjs";import{u as v}from"./internal-context-De1jxnac.mjs";import{g as w}from"./getEmbeddedConnectedWallet-CSSBWE2p.mjs";import{c as C}from"./smart-wallets-BODPu_tJ.mjs";import"react";import"react/jsx-runtime";import"mipd";import"react-device-detect";import"viem/utils";import"@privy-io/js-sdk-core";import"./paths-j39vuJt8.mjs";import"ofetch";import"uuid";import"jose";import"eventemitter3";import"@coinbase/wallet-sdk";import"@privy-io/ethereum";import"@marsidev/react-turnstile";import"styled-components";import"tinycolor2";import"@heroicons/react/24/outline/DevicePhoneMobileIcon";import"@heroicons/react/24/outline/FingerPrintIcon";import"@heroicons/react/24/outline/PhoneIcon";import"@heroicons/react/24/outline/ShieldCheckIcon";import"@heroicons/react/24/outline/ArrowLeftIcon";import"@heroicons/react/24/outline/ArrowRightIcon";import"@heroicons/react/24/outline/QuestionMarkCircleIcon";import"@heroicons/react/24/outline/XMarkIcon";import"@heroicons/react/24/outline/ChevronDownIcon";import"@heroicons/react/24/outline/CalendarIcon";import"@heroicons/react/24/outline/ExclamationTriangleIcon";import"@headlessui/react";import"@walletconnect/ethereum-provider";import"zustand";import"fast-password-entropy";import"secure-password-utilities";import"secure-password-utilities/wordlists";import"@heroicons/react/24/outline/UserCircleIcon";import"@heroicons/react/24/outline/EnvelopeIcon";import"@heroicons/react/20/solid/CheckIcon";import"@heroicons/react/24/outline/WalletIcon";import"@heroicons/react/24/outline/CheckIcon";import"@heroicons/react/24/outline/Square2StackIcon";import"@heroicons/react/24/outline/ExclamationCircleIcon";import"@heroicons/react/24/outline/ArrowTopRightOnSquareIcon";import"@heroicons/react/24/solid/DocumentCheckIcon";import"@heroicons/react/24/solid/XCircleIcon";import"@heroicons/react/24/solid/CheckCircleIcon";import"qrcode";import"@heroicons/react/24/solid/ArrowsRightLeftIcon";import"@heroicons/react/24/outline/ChevronRightIcon";import"@heroicons/react/24/outline/LockClosedIcon";import"@heroicons/react/24/outline/PencilSquareIcon";import"@heroicons/react/24/outline/ArrowPathIcon";import"@heroicons/react/24/outline/EyeIcon";import"@heroicons/react/24/outline/EyeSlashIcon";import"@heroicons/react/24/outline/KeyIcon";import"@heroicons/react/24/outline/ArrowDownTrayIcon";import"@heroicons/react/24/outline/ClipboardDocumentCheckIcon";import"@heroicons/react/24/outline/DocumentDuplicateIcon";import"@heroicons/react/24/solid/LockClosedIcon";import"@heroicons/react/24/outline/CheckCircleIcon";import"@heroicons/react/24/outline/InformationCircleIcon";import"@heroicons/react/24/outline/CreditCardIcon";import"@heroicons/react/24/outline/QrCodeIcon";import"@heroicons/react/24/outline/GlobeAltIcon";import"@heroicons/react/24/outline";import"@heroicons/react/24/outline/ClipboardDocumentIcon";import"@heroicons/react/24/outline/CloudArrowUpIcon";import"@heroicons/react/24/outline/NoSymbolIcon";import"@heroicons/react/24/outline/ClockIcon";import"@heroicons/react/24/outline/TrashIcon";import"@heroicons/react/24/solid/CheckBadgeIcon";import"@heroicons/react/24/solid/IdentificationIcon";import"@heroicons/react/24/outline/MinusCircleIcon";import"@heroicons/react/24/outline/ArrowRightEndOnRectangleIcon";import"@heroicons/react/24/solid/ShieldCheckIcon";import"js-cookie";import"permissionless";import"permissionless/accounts";import"permissionless/clients/pimlico";import"viem/account-abstraction";function T(){let{user:T}=s(),{hideWalletUIs:P,openPrivyModal:S,chains:A,appId:b,rpcConfig:W,client:M}=v(),k=p(),{wallets:F}=m(),{setModalData:q}=u(),x=l(T),R=!!x&&d(x),D=async(o=c.id)=>{let s=w(F);if(!s)throw Error("No connected wallet found");let l="string"==typeof o?r(o):o;if(![c.id,2741].includes(l))throw Error("Error, only Abstract chains are supported");let d=A.find((e=>e.id===l));if(!d)throw Error("Chain not configured");await s.switchChain(d.id);let p=await s.getEthereumProvider(),m=t({account:s.address,transport:n(p)}),u=a({address:s.address,signMessage:m.signMessage,signTransaction:m.signTransaction,signTypedData:m.signTypedData});return await e({chain:d,transport:i(f(d,W,b)),publicTransport:i(f(d,W,b)),signer:u})};return{signMessage:async({message:e},o)=>{let r=await D(o);return new Promise((async(o,t)=>{let{entropyId:n,entropyIdVerifier:i}=h(T);P.current=!0,q({connectWallet:{recoveryMethod:x.recoveryMethod,connectingWalletAddress:x.address,isUnifiedWallet:R,entropyId:n,entropyIdVerifier:i,onCompleteNavigateTo:I,onFailure:()=>{}},signMessage:{method:"personal_sign",data:e,confirmAndSign:()=>r.signMessage({message:e}),onSuccess:e=>o(e),onFailure:t,uiOptions:{isCancellable:!0}}}),S(g)})).finally((()=>{P.current=!1}))},signTypedData:async(e,o)=>{let r=await D(o);return new Promise((async(o,t)=>{P.current=!0;let{entropyId:n,entropyIdVerifier:i}=h(T);q({connectWallet:{recoveryMethod:x.recoveryMethod,connectingWalletAddress:x.address,isUnifiedWallet:R,entropyId:n,entropyIdVerifier:i,onCompleteNavigateTo:I,onFailure:()=>{}},signMessage:{method:"eth_signTypedData_v4",data:e,confirmAndSign:()=>r.signTypedData(e),onSuccess:e=>o(e),onFailure:t,uiOptions:{isCancellable:!0}}}),S(g)})).finally((()=>{P.current=!1}))},sendTransaction:async e=>{let r=await D(e.chainId),t=[],n="calls"in e&&void 0!==e.calls;return t=n?[...e.calls]:[e],new Promise((async(i,a)=>{P.current=!0;let{entropyId:c,entropyIdVerifier:s}=h(T);q({connectWallet:{recoveryMethod:x.recoveryMethod,connectingWalletAddress:x.address,isUnifiedWallet:R,entropyId:c,entropyIdVerifier:s,onCompleteNavigateTo:y,onFailure:()=>{}},sendTransaction:{transactionRequests:C({calls:t,chain:r.chain,maxPriorityFeePerGas:e.maxPriorityFeePerGas,maxFeePerGas:e.maxFeePerGas,nonce:e.nonce?BigInt(e.nonce):void 0}),entropyId:c,entropyIdVerifier:s,transactingWalletAddress:r.account.address,transactingWalletIndex:void 0,prepareTransactionRequest:async()=>{let t=n?o(r.account.address,e):e;return await r.prepareAbstractTransactionRequest(t)},scanTransaction:async()=>{if(!M)throw Error("Privy client not found");let t=n?o(r.account.address,e):e,i=await r.prepareAbstractTransactionRequest(t);return await M.scanTransaction({metadata:{domain:k.embeddedWallets.transactionScanning.domain},chain_id:e.chainId.toString(),request:{method:"eth_sendTransaction",params:[{from:i.from,to:i.to,value:i.value?.toString(),gas:i.gas?.toString(),gasPrice:i.gasPrice?.toString(),nonce:i.nonce?.toString(),data:i.data,eip_712_meta:{paymaster_params:{paymaster:i.paymaster,paymaster_input:i.paymasterInput}}}]}})},signOnly:!1,getIsSponsored:async()=>void 0!==e.paymaster&&void 0!==e.paymasterInput,onConfirm:()=>n?r.sendTransactionBatch(e):r.sendTransaction(e),onSuccess:e=>i(e.hash),onFailure:a,uiOptions:{isCancellable:!0}}}),S(g)})).finally((()=>{P.current=!1}))},signTransaction:async e=>{let r=await D(e.chainId),t=[],n="calls"in e&&void 0!==e.calls;return t=n?[...e.calls]:[e],new Promise((async(i,a)=>{P.current=!0;let{entropyId:c,entropyIdVerifier:s}=h(T);q({connectWallet:{recoveryMethod:x.recoveryMethod,connectingWalletAddress:x.address,isUnifiedWallet:R,entropyId:c,entropyIdVerifier:s,onCompleteNavigateTo:y,onFailure:()=>{}},sendTransaction:{transactionRequests:C({calls:t,chain:r.chain,maxPriorityFeePerGas:e.maxPriorityFeePerGas,maxFeePerGas:e.maxFeePerGas,nonce:e.nonce?BigInt(e.nonce):void 0}),entropyId:c,entropyIdVerifier:s,transactingWalletAddress:r.account.address,transactingWalletIndex:void 0,prepareTransactionRequest:async()=>{let t=n?o(r.account.address,e):e;return await r.prepareAbstractTransactionRequest(t)},scanTransaction:async()=>{if(!M)throw Error("Privy client not found");let t=n?o(r.account.address,e):e,i=await r.prepareAbstractTransactionRequest(t);return await M.scanTransaction({metadata:{domain:k.embeddedWallets.transactionScanning.domain},chain_id:e.chainId.toString(),request:{method:"eth_sendTransaction",params:[{from:i.from,to:i.to,value:i.value?.toString(),gas:i.gas?.toString(),gasPrice:i.gasPrice?.toString(),nonce:i.nonce?.toString(),data:i.data}]}})},signOnly:!0,getIsSponsored:async()=>void 0!==e.paymaster&&void 0!==e.paymasterInput,onConfirm:async()=>{let t=n?o(r.account.address,e):e,i=await r.prepareAbstractTransactionRequest(t);return r.signTransaction(i)},onSuccess:e=>i(e.hash),onFailure:a,uiOptions:{isCancellable:!0}}}),S(g)})).finally((()=>{P.current=!1}))}}}export{T as useAbstractSmartWallets};
@@ -1 +1 @@
1
- import{useMemo as r}from"react";import{create as e,rawSign as t}from"@privy-io/js-sdk-core";import{u as a}from"./internal-context-Bxhby7Hv.mjs";import{u as i,a as s,f as n,c as o}from"./use-sign-with-user-signer-CEyk1z8w.mjs";import"viem";const u=()=>{let{refreshSessionAndUser:t,privy:i}=a();return r((()=>({async createWallet(r){let a=await e(i,{request:{chain_type:r.chainType}}),s=await t();if(!s)throw Error("User must be authenticated before creating a Privy wallet");return{user:s,wallet:a}}})),[t,i])},d=()=>{let{user:e}=i(),{privy:u}=a(),{signWithUserSigner:d}=s();return r((()=>({async signRawHash({address:r,chainType:a,hash:i}){if(!e)throw Error("User must be authenticated before signing");let s=n(e,a).filter((r=>o(r))).find((e=>e.address===r));if(!s)throw Error("Wallet not found");let h=await t(u,d,{wallet_id:s.id,params:{hash:i}});if(h.data&&"signature"in h.data&&"hex"===h.data.encoding)return{signature:h.data.signature};throw Error("Failed to sign")}})),[u])};export{u as useCreateWallet,d as useSignRawHash};
1
+ import{useMemo as r}from"react";import{create as e,rawSign as t}from"@privy-io/js-sdk-core";import{u as a}from"./internal-context-De1jxnac.mjs";import{u as i,a as s,f as n,c as o}from"./use-sign-with-user-signer-Yg0Gn-gB.mjs";import"viem";const u=()=>{let{refreshSessionAndUser:t,privy:i}=a();return r((()=>({async createWallet(r){let a=await e(i,{request:{chain_type:r.chainType}}),s=await t();if(!s)throw Error("User must be authenticated before creating a Privy wallet");return{user:s,wallet:a}}})),[t,i])},d=()=>{let{user:e}=i(),{privy:u}=a(),{signWithUserSigner:d}=s();return r((()=>({async signRawHash({address:r,chainType:a,hash:i}){if(!e)throw Error("User must be authenticated before signing");let s=n(e,a).filter((r=>o(r))).find((e=>e.address===r));if(!s)throw Error("Wallet not found");let h=await t(u,d,{wallet_id:s.id,params:{hash:i}});if(h.data&&"signature"in h.data&&"hex"===h.data.encoding)return{signature:h.data.signature};throw Error("Failed to sign")}})),[u])};export{u as useCreateWallet,d as useSignRawHash};
@@ -1 +1 @@
1
- import{useCallback as t}from"react";import{F as e}from"./frame-UsDF_L76.mjs";import{P as r}from"./paths-j39vuJt8.mjs";import{u as i}from"./internal-context-Bxhby7Hv.mjs";import"ofetch";const a=()=>{let{client:a,setAuthenticated:s,setUser:n}=i();return{initLoginToFrame:t((async()=>{let t=new e;if(!a)throw new r("Must initialize Privy client first.");return a.startAuthFlow(t),await t.init()}),[a]),loginToFrame:t((async({message:t,signature:i})=>{if(!a)throw new r("Must initialize Privy client first.");if(!(a.authFlow instanceof e))throw new r("Must initialize Farcaster frame flow first.");let o=(t=>{let e=t.match(/farcaster:\/\/fid\/(\d+)/);return e&&e[1]?parseInt(e[1],10):null})(t);if(!o)throw new r("Invalid message format; could not parse Farcaster ID.");a.authFlow.setAuthData({message:t,signature:i,fid:o});let{user:l}=await a.authenticate();return l&&(n(l),s(!0)),l}),[a,n,s])}};export{a as useLoginToFrame};
1
+ import{useCallback as t}from"react";import{F as e}from"./frame-UsDF_L76.mjs";import{P as r}from"./paths-j39vuJt8.mjs";import{u as i}from"./internal-context-De1jxnac.mjs";import"ofetch";const a=()=>{let{client:a,setAuthenticated:s,setUser:n}=i();return{initLoginToFrame:t((async()=>{let t=new e;if(!a)throw new r("Must initialize Privy client first.");return a.startAuthFlow(t),await t.init()}),[a]),loginToFrame:t((async({message:t,signature:i})=>{if(!a)throw new r("Must initialize Privy client first.");if(!(a.authFlow instanceof e))throw new r("Must initialize Farcaster frame flow first.");let o=(t=>{let e=t.match(/farcaster:\/\/fid\/(\d+)/);return e&&e[1]?parseInt(e[1],10):null})(t);if(!o)throw new r("Invalid message format; could not parse Farcaster ID.");a.authFlow.setAuthData({message:t,signature:i,fid:o});let{user:l}=await a.authenticate();return l&&(n(l),s(!0)),l}),[a,n,s])}};export{a as useLoginToFrame};
@@ -1 +1 @@
1
- import{g as e,a as r,u as o,b as i,c as s,C as n,d as l,s as d,e as h,f as p,h as m,G as f,W as k,i as C,j as W,k as T,l as U,m as S,n as R,o as _,p as j,q,r as G}from"./privy-provider-B2wDQG1e.mjs";export{v as Captcha,w as ConnectorManager,E as EthereumWalletConnector,O as LoginModal,H as PrivyClient,P as PrivyProvider,V as VERSION,x as WalletConnector,D as errorIndicatesMaxMfaRetries,F as errorIndicatesMfaTimeout,B as errorIndicatesMfaVerificationFailed,t as getAccessToken,L as useCreateWallet,I as useIdentityToken,N as useImportWallet,J as useLogout,z as useMfa,A as useMfaEnrollment,y as usePrivy,K as useRegisterMfaListener,M as useSolanaWallets}from"./privy-provider-B2wDQG1e.mjs";import{useCallback as Q,useMemo as X,useEffect as $,useContext as Y,useState as Z,useRef as ee}from"react";import{P as te,a as re}from"./paths-j39vuJt8.mjs";import{u as oe,I as ie}from"./internal-context-Bxhby7Hv.mjs";import{u as ae,P as se,g as ne,a as le,b as ce,c as ue}from"./use-sign-with-user-signer-CEyk1z8w.mjs";export{c as useActiveWallet,a as useConnectWallet,b as useFundWallet,u as useLogin}from"./useActiveWallet-D4n8kXvn.mjs";import{F as de}from"./frame-UsDF_L76.mjs";import{zeroAddress as he,getAddress as we,createWalletClient as pe,http as ge,parseSignature as me}from"viem";import{hashAuthorization as ye}from"viem/utils";import{getWallet as Ae,updateWallet as fe,generateAuthorizationSignature as ke}from"@privy-io/js-sdk-core";export{DEFAULT_SUPPORTED_CHAINS as SUPPORTED_CHAINS,addPrivyRpcToChain,addRpcUrlOverrideToChain}from"@privy-io/js-sdk-core";export{g as getEmbeddedConnectedWallet}from"./getEmbeddedConnectedWallet-CSSBWE2p.mjs";import"react/jsx-runtime";import"mipd";import"react-device-detect";import"uuid";import"jose";import"eventemitter3";import"@coinbase/wallet-sdk";import"@privy-io/ethereum";import"@marsidev/react-turnstile";import"styled-components";import"tinycolor2";import"@heroicons/react/24/outline/DevicePhoneMobileIcon";import"@heroicons/react/24/outline/FingerPrintIcon";import"@heroicons/react/24/outline/PhoneIcon";import"@heroicons/react/24/outline/ShieldCheckIcon";import"@heroicons/react/24/outline/ArrowLeftIcon";import"@heroicons/react/24/outline/ArrowRightIcon";import"@heroicons/react/24/outline/QuestionMarkCircleIcon";import"@heroicons/react/24/outline/XMarkIcon";import"@heroicons/react/24/outline/ChevronDownIcon";import"@heroicons/react/24/outline/CalendarIcon";import"@heroicons/react/24/outline/ExclamationTriangleIcon";import"@headlessui/react";import"@walletconnect/ethereum-provider";import"zustand";import"fast-password-entropy";import"secure-password-utilities";import"secure-password-utilities/wordlists";import"@heroicons/react/24/outline/UserCircleIcon";import"@heroicons/react/24/outline/EnvelopeIcon";import"@heroicons/react/20/solid/CheckIcon";import"@heroicons/react/24/outline/WalletIcon";import"@heroicons/react/24/outline/CheckIcon";import"@heroicons/react/24/outline/Square2StackIcon";import"@heroicons/react/24/outline/ExclamationCircleIcon";import"@heroicons/react/24/outline/ArrowTopRightOnSquareIcon";import"@heroicons/react/24/solid/DocumentCheckIcon";import"@heroicons/react/24/solid/XCircleIcon";import"@heroicons/react/24/solid/CheckCircleIcon";import"qrcode";import"@heroicons/react/24/solid/ArrowsRightLeftIcon";import"@heroicons/react/24/outline/ChevronRightIcon";import"@heroicons/react/24/outline/LockClosedIcon";import"@heroicons/react/24/outline/PencilSquareIcon";import"@heroicons/react/24/outline/ArrowPathIcon";import"@heroicons/react/24/outline/EyeIcon";import"@heroicons/react/24/outline/EyeSlashIcon";import"@heroicons/react/24/outline/KeyIcon";import"@heroicons/react/24/outline/ArrowDownTrayIcon";import"@heroicons/react/24/outline/ClipboardDocumentCheckIcon";import"@heroicons/react/24/outline/DocumentDuplicateIcon";import"@heroicons/react/24/solid/LockClosedIcon";import"@heroicons/react/24/outline/CheckCircleIcon";import"@heroicons/react/24/outline/InformationCircleIcon";import"@heroicons/react/24/outline/CreditCardIcon";import"@heroicons/react/24/outline/QrCodeIcon";import"@heroicons/react/24/outline/GlobeAltIcon";import"ofetch";import"@heroicons/react/24/outline";import"@heroicons/react/24/outline/ClipboardDocumentIcon";import"@heroicons/react/24/outline/CloudArrowUpIcon";import"@heroicons/react/24/outline/NoSymbolIcon";import"@heroicons/react/24/outline/ClockIcon";import"@heroicons/react/24/outline/TrashIcon";import"@heroicons/react/24/solid/CheckBadgeIcon";import"@heroicons/react/24/solid/IdentificationIcon";import"@heroicons/react/24/outline/MinusCircleIcon";import"@heroicons/react/24/outline/ArrowRightEndOnRectangleIcon";import"@heroicons/react/24/solid/ShieldCheckIcon";import"js-cookie";const Ce=()=>{let{user:t}=ae(),{walletProxy:o}=oe();return{recover:Q((async i=>{if(!o)throw Error("Wallet proxy is not ready");let a=await e();if(!t||!a)throw new te("User must be logged in before attempting to modify the recovery method.");let{entropyId:s,entropyIdVerifier:n}=r(t);try{await o.recover({entropyId:s,entropyIdVerifier:n,accessToken:a,...i})}catch{throw new te("Unable to recover wallets")}}),[o,t])}},Ie=()=>{let{client:e,setAuthenticated:t,setUser:r}=oe();return X((()=>({init:async()=>{if(!e)throw new te("Must initialize Privy client first.");let t=new de;return e.startAuthFlow(t),await t.init()},login:async({fid:o,message:i,signature:a})=>{if(!e)throw new te("Must initialize Privy client first.");if(!(e.authFlow instanceof de))throw new te("Must initialize Farcaster frame flow first.");e.authFlow.setAuthData({message:i,signature:a,fid:o});let{user:s}=await e.authenticate();if(!s)throw new te("Failed to login with Farcaster V2");return r(s),t(!0),{user:s}}})),[e,r,t])},Ee=e=>{o("login",e);let t=i(),r=s(),{ready:a,user:c}=ae(),{initLoginWithHeadlessOAuth:u,loginWithHeadlessOAuth:h,oAuthState:w,setOAuthState:p,isHeadlessOAuthLoading:g}=oe(),m=Q((async e=>{try{if(t.enabled&&"success"!==t.status)throw new n(t.error,null,re.CAPTCHA_FAILURE);return await u(e.provider,t.token,e.disableSignup)}catch(e){throw p({status:"error",error:e}),e}}),[u,t]),y=Q((async()=>{let e=l();try{if(c)return console.warn("Cannot login with OAuth when already logged in"),c;if(!e.inProgress)throw Error("Cannot login with OAuth because no OAuth flow is in progress");if(e.popupFlow)return}catch(e){throw p({status:"error",error:e}),e}try{return await h(e)}catch(e){throw p({status:"error",error:e}),e}finally{d()}}),[h]);return $((()=>{let e=l();a&&r&&e.inProgress&&!e.withPrivyUi&&!e.popupFlow&&y().catch((()=>{}))}),[a,r]),{initOAuth:m,loading:g,state:w}},We=e=>{let t=i(),{emailOtpState:r,setEmailOtpState:o,initLoginWithEmail:a,loginWithCode:s}=oe();return{sendCode:Q((async({email:r,disableSignup:i})=>{try{let e;if(!r)throw Error("Email required to send OTP code");if(t.enabled&&"error"===t.status)throw new n(t.error,null,re.CAPTCHA_FAILURE);return t.enabled&&"success"!==t.status&&(t.execute(),e=await t.waitForResult()),await a({email:r,captchaToken:e,disableSignup:i,withPrivyUi:!1})}catch(r){throw o({status:"error",error:r}),e?.onError?.(r.privyErrorCode||re.UNKNOWN_AUTH_ERROR),r}}),[a]),loginWithCode:Q((async({code:r})=>{try{if(t.enabled&&"error"===t.status)throw new n(t.error,null,re.CAPTCHA_FAILURE);let{user:o,isNewUser:i,wasAlreadyAuthenticated:a,linkedAccount:l}=await s(r);e?.onComplete?.({user:o,isNewUser:i,wasAlreadyAuthenticated:a,loginMethod:"email",loginAccount:l})}catch(r){throw o({status:"error",error:r}),e?.onError?.(r.privyErrorCode||re.UNKNOWN_AUTH_ERROR),r}}),[s,t.status]),state:r}},Te=e=>{let t=i(),{initSignupWithPasskey:r,signupWithPasskey:o,passkeyAuthState:a,setPasskeyAuthState:s}=oe();return{signupWithPasskey:Q((async()=>{try{let i;if(t.enabled&&"error"===t.status)throw new n(t.error,null,re.CAPTCHA_FAILURE);t.enabled&&"success"!==t.status&&(t.execute(),i=await t.waitForResult()),await r({captchaToken:i,withPrivyUi:!1});let{user:a,isNewUser:s,wasAlreadyAuthenticated:l,loginAccount:c}=await o();e?.onComplete?.({user:a,isNewUser:s,wasAlreadyAuthenticated:l,loginMethod:"passkey",loginAccount:c})}catch(t){throw s({status:"error",error:t}),e?.onError?.(t.privyErrorCode||re.UNKNOWN_AUTH_ERROR),t}}),[o,t.status]),state:a}},Ue=e=>{let t=i(),{initLoginWithPasskey:r,loginWithPasskey:o,passkeyAuthState:a,setPasskeyAuthState:s}=oe();return{loginWithPasskey:Q((async i=>{try{let a;if(t.enabled&&"error"===t.status)throw new n(t.error,null,re.CAPTCHA_FAILURE);t.enabled&&"success"!==t.status&&(t.execute(),a=await t.waitForResult()),await r({captchaToken:a,withPrivyUi:!1});let{user:s,isNewUser:l,wasAlreadyAuthenticated:c,loginAccount:u}=await o(i);e?.onComplete?.({user:s,isNewUser:l,wasAlreadyAuthenticated:c,loginMethod:"passkey",loginAccount:u})}catch(i){throw s({status:"error",error:i}),e?.onError?.(i.privyErrorCode||re.UNKNOWN_AUTH_ERROR),i}}),[o,t.status]),state:a}},Se=e=>{let{initLinkWithPasskey:t,linkWithPasskey:r,passkeyAuthState:o,setPasskeyAuthState:i}=oe();return{linkWithPasskey:Q((async()=>{try{await t();let o=await r();if(!o)throw Error("Error, user not found");let i=o.linkedAccounts.filter((e=>"passkey"===e.type)).sort(((e,t)=>t.latestVerifiedAt.getTime()-e.latestVerifiedAt.getTime()))[0];e?.onSuccess?.({user:o,linkMethod:"passkey",linkedAccount:i})}catch(t){throw i({status:"error",error:t}),e?.onError?.(t.privyErrorCode||re.UNKNOWN_AUTH_ERROR,{linkMethod:"passkey"}),t}}),[r]),state:o}},ve=e=>{let t=i(),{smsOtpState:r,setSmsOtpState:o,initLoginWithSms:a,loginWithCode:s}=oe();return{sendCode:Q((async({phoneNumber:r,disableSignup:i})=>{try{let e;if(!r)throw Error("SMS required to send OTP code");if(t.enabled&&"error"===t.status)throw new n(t.error,null,re.CAPTCHA_FAILURE);return t.enabled&&"success"!==t.status&&(t.execute(),e=await t.waitForResult()),await a({phoneNumber:r,captchaToken:e,disableSignup:i,withPrivyUi:!1})}catch(r){throw o({status:"error",error:r}),e?.onError?.(r.privyErrorCode||re.UNKNOWN_AUTH_ERROR),r}}),[a]),loginWithCode:Q((async({code:r})=>{try{if(t.enabled&&"success"!==t.status)throw new n(t.error,null,re.CAPTCHA_FAILURE);let{user:o,isNewUser:i,wasAlreadyAuthenticated:a,linkedAccount:l}=await s(r);e?.onComplete?.({user:o,isNewUser:i,wasAlreadyAuthenticated:a,loginMethod:"sms",loginAccount:l})}catch(r){throw o({status:"error",error:r}),e?.onError?.(r.privyErrorCode||re.UNKNOWN_AUTH_ERROR),r}}),[s,t.status]),state:r}},Re=e=>{let{connectOrCreateWallet:t}=ae();return o("connectOrCreateWallet",e),{connectOrCreateWallet:t}},Pe=e=>{let t=i(),{siweState:r,setSiweState:o,linkWithSiwe:a,generateSiweMessage:s}=oe();return{generateSiweMessage:Q((async({address:t,chainId:r})=>{try{if(!t||!r)throw Error("wallet address and chainId required to generate nonce");return await s({address:t,chainId:r}).then((e=>e))}catch(t){throw o({status:"error",error:t}),e?.onError?.(t.privyErrorCode||re.UNKNOWN_AUTH_ERROR,{linkMethod:"siwe"}),t}}),[s]),linkWithSiwe:Q((async({signature:r,message:i,chainId:s,walletClientType:l,connectorType:c})=>{try{if(t.enabled&&"success"!==t.status)throw new n(t.error,null,re.CAPTCHA_FAILURE);let{user:o,linkedAccount:u}=await a({message:i,signature:r,chainId:s,walletClientType:l,connectorType:c});u&&e?.onSuccess?.({user:o,linkMethod:"siwe",linkedAccount:u})}catch(r){throw o({status:"error",error:r}),e?.onError?.(r.privyErrorCode||re.UNKNOWN_AUTH_ERROR,{linkMethod:"siwe"}),r}}),[a,t.status]),state:r}},Ne=e=>{let t=i(),{siweState:r,setSiweState:o,client:a,generateSiweMessage:s,loginWithSiwe:l}=oe();return{generateSiweNonce:Q((async r=>{try{let e;if(t.enabled&&"error"===t.status)throw new n(t.error,null,re.CAPTCHA_FAILURE);t.enabled&&"success"!==t.status&&(t.execute(),e=await t.waitForResult()),o({status:"generating-message"});let i=await a.generateSiweNonce({address:r?.address,captchaToken:e});return o({status:"awaiting-signature"}),i}catch(r){throw o({status:"error",error:r}),e?.onError?.(r.privyErrorCode||re.UNKNOWN_AUTH_ERROR),r}}),[a,t]),generateSiweMessage:Q((async({address:t,chainId:r})=>{try{return await s({address:t,chainId:r})}catch(t){throw o({status:"error",error:t}),e?.onError?.(t.privyErrorCode||re.UNKNOWN_AUTH_ERROR),t}}),[s]),loginWithSiwe:Q((async({message:r,signature:i,disableSignup:a})=>{try{let o;if(t.enabled&&"error"===t.status)throw new n(t.error,null,re.CAPTCHA_FAILURE);t.enabled&&"success"!==t.status&&(t.execute(),o=await t.waitForResult());let s=await l({message:r,signature:i,captchaToken:o,disableSignup:a});return e?.onComplete?.({user:s,isNewUser:!1,wasAlreadyAuthenticated:!1,loginMethod:"siwe",loginAccount:null}),s}catch(r){throw o({status:"error",error:r}),e?.onError?.(r.privyErrorCode||re.UNKNOWN_AUTH_ERROR),r}}),[l,t.status]),state:r}};function be(){let{signTransaction:e}=Y(se);return{signTransaction:e}}function Oe(e){let{linkEmail:t,linkPhone:r,linkWallet:i,linkGoogle:a,linkApple:s,linkTwitter:n,linkDiscord:l,linkGithub:c,linkLinkedIn:u,linkTiktok:d,linkSpotify:h,linkInstagram:w,linkTelegram:p,linkFarcaster:g,linkPasskey:m}=Y(se);return o("linkAccount",e),{linkEmail:t,linkPhone:r,linkWallet:i,linkGoogle:a,linkApple:s,linkTwitter:n,linkDiscord:l,linkGithub:c,linkLinkedIn:u,linkTiktok:d,linkSpotify:h,linkInstagram:w,linkFarcaster:g,linkTelegram:p,linkPasskey:m}}function _e(e){let{updateEmail:t,updatePhone:r}=Y(se);return o("update",e),{updateEmail:t,updatePhone:r}}const Me=()=>{let{connectCoinbaseSmartWallet:e}=oe();return{connectCoinbaseSmartWallet:e}},Fe=()=>{let{startCrossAppAuthFlow:e,unlinkCrossAppAccount:t,signMessageWithCrossAppWallet:r,signTypedDataWithCrossAppWallet:o,sendTransactionWithCrossAppWallet:i}=ae();return{loginWithCrossAppAccount:({appId:t})=>e({appId:t,action:"login"}),linkCrossAppAccount:({appId:t})=>e({appId:t,action:"link"}),unlinkCrossAppAccount:t,signMessage:r,signTypedData:o,sendTransaction:i}};function Le(e){let{sendTransaction:t}=Y(se);return o("sendTransaction",e),{sendTransaction:t}}function He(e){let{setWalletPassword:t}=Y(se);return o("setWalletPassword",e),{setWalletPassword:t}}function De(){let e=h(),{getAccessToken:t}=ae(),r=p(),{client:o,setUser:i,setAuthenticated:a,setIsNewUser:s,initializeWalletProxy:n}=oe(),{create:l}=m();return{createGuestAccount:async()=>{if(!e.id||!o)throw Error("SDK not yet ready");o.startAuthFlow(new f(e.id));try{let c=await o.authenticate(),u=c.user,d=c.isNewUser??!1;if(!u)throw new te("Unable to authenticate guest account");let h=await t(),w=await n(k);if(h&&w)try{let t=C(u,e.embeddedWallets.ethereum.createOnLogin),r=W(u,e.embeddedWallets.solana.createOnLogin);t&&r?(u=(await l({chainType:"ethereum",latestUser:u})).user,u=(await l({chainType:"solana",latestUser:u})).user):r?u=(await l({chainType:"solana",latestUser:u})).user:t?u=(await l({chainType:"ethereum",latestUser:u})).user:i(u)}catch(e){i(u),console.warn("Unable to create embedded wallet for guest account")}return s(d),a(!0),r("login","onComplete",{user:u,isNewUser:d,wasAlreadyAuthenticated:!1,loginMethod:"guest",loginAccount:null}),u}catch(e){throw r("login","onError",e.privyErrorCode||re.UNKNOWN_AUTH_ERROR),e}}}}function xe(e){let{setWalletRecovery:t}=Y(se);return o("setWalletRecovery",e),{setWalletRecovery:t}}function Ke(e){let{signMessage:t}=Y(se);return o("signMessage",e),{signMessage:t}}const ze=()=>{let{ready:e,wallets:t}=T(),{user:r}=ae(),{rpcConfig:o,chains:i,appId:a}=oe();return{signAuthorization:Q((async(s,n)=>{let l;if(!r)throw Error("User must be authenticated before signing with a Privy wallet");if(!e)throw Error("Wallets are not ready");let c=n?.address??ne(r)?.address??he,u=t.find((e=>we(e.address)===we(c)));if(!u)throw Error("Signing wallet not found.");let d=s.chainId??Number(u.chainId.split(":")[1]);if(0===d)l={chainId:0,address:s.contractAddress,nonce:s.nonce??0};else{let e=i.find((e=>e.id===d));if(!e)throw Error("Error, chain not configured in PrivyProvider config");let t=pe({account:c,chain:e,transport:ge(U(e,o,a))});l=await t.prepareAuthorization({...s})}let h=await u.getEthereumProvider(),w=await h.request({method:"secp256k1_sign",params:[ye(l)]});return{...l,...me(w)}}),[e,t,r,i])}},je=ze;function qe(e){let{signTypedData:t}=Y(se);return o("signTypedData",e),{signTypedData:t}}const Ve=()=>{let{isModalOpen:e}=Y(se);return{isOpen:e}};function Ge(e){let{getAccessToken:t}=Y(se);return o("accessToken",e),{getAccessToken:t}}function Be(e){let{authenticated:t,user:r}=ae(),{initLoginWithOAuth:i}=oe(),a=p();return o("oAuthAuthorization",e),{reauthorize:e=>Je(t,r,i,a,e.provider)}}let Je=async(e,t,r,o,i)=>{if(!e)throw o("linkAccount","onError",re.MUST_BE_AUTHENTICATED,{linkMethod:i}),new te("User must be authenticated before linking an account.");if(!t?.linkedAccounts.some((e=>e.type.includes(i))))throw new te(`OAuth account of type ${i} not linked to the account.`);await r(i)};function Qe(e){let{client:t}=oe(),[r,o]=Z({status:"initial"});return{linkWithCustomJwt:Q((async r=>{try{o({status:"initial"}),t.startAuthFlow(new S(r)),o({status:"loading"});let{user:i}=await t.link();if(!i)throw Error("Error, user not found");let a=i.linkedAccounts.filter((e=>"custom_auth"===e.type)).sort(((e,t)=>t.latestVerifiedAt.getTime()-e.latestVerifiedAt.getTime())).at(0);return o({status:"done"}),e?.onSuccess?.({user:i,linkMethod:"custom",linkedAccount:a}),{user:i}}catch(r){throw o({status:"error",error:r}),e?.onError?.(r.privyErrorCode||re.UNKNOWN_AUTH_ERROR,{linkMethod:"custom"}),r}}),[t.startAuthFlow,t.link]),state:r}}const Xe=e=>{let t=R();return o("customAuth",e),{status:t}};function $e({isAuthenticated:e,isLoading:t,...r}){let o=ee();$((()=>{t||o.current?.()}),[e,t]);let i=Q((e=>(o.current=e,()=>{o.current=void 0})),[]);return _({...r,subscribe:i})}function Ye(){let{getFarcasterSignerPublicKey:e,signFarcasterMessage:t,requestFarcasterSignerFromWarpcast:r}=ae();return{getFarcasterSignerPublicKey:e,signFarcasterMessage:t,requestFarcasterSignerFromWarpcast:r}}const Ze=()=>{let{revokeDelegatedWallets:e,delegateWallet:t}=oe();return{delegateWallet:async({address:e,chainType:r})=>await t({address:e,chainType:r,showDelegationUIs:!0}),revokeWallets:async()=>await e({showDelegationUIs:!0})}},et=()=>{let{addSessionSignersInternal:e,removeSessionSignersInternal:t}=(()=>{let{getAccessToken:e,user:t}=ae(),r=oe(),{signWithUserSigner:o}=le(),i=async({wallet:i,additional_signers:a})=>{let s=await e();if(!t||!s)throw new te("User must be authenticated and have an embedded wallet to delegate actions.");if(!i.id)throw new te("Wallet to add signers to must have ID on server");if(!r.walletProxy)throw new te("Wallet proxy not initialized.");await fe(r.privy,{wallet_id:i.id},o,{additional_signers:a})};return{addSessionSignersInternal:async({address:o,signers:a})=>{let s=await e();if(!t||!s)throw new te("User must be authenticated and have an embedded wallet to add a session signer.");let n=r.walletProxy??await r.initializeWalletProxy(15e3);if(!n)throw new te("Wallet proxy not initialized.");let l=ce(t,o);if(!l)throw new te("Address to add signers too is not associated with current user.");if(ue(l)){if(0===a.length)throw new te("Must specify at least one signer to add.");let e=[...(await Ae(r.privy,{wallet_id:l.id})).additional_signers,...j(a)];await i({wallet:l,additional_signers:e})}else{if(l.delegated)return{user:t};if(a.length>0)throw new te("addSessionSigners is only supported for TEE execution and this app uses On-device execution. Use the useHeadlessDelegatedActions hook to manage server side access on behalf of your users. Learn more https://docs.privy.io/recipes/tee-wallet-migration-guide");let e=q({address:o,user:t}),i=G({address:o,user:t});await r.recoverEmbeddedWallet({address:o}),await n.createDelegatedAction({accessToken:s,rootWallet:i,delegatedWallets:[e]})}let c=await r.refreshSessionAndUser();if(!c)throw Error("Could not refresh user");return{user:c}},removeSessionSignersInternal:async({address:o})=>{let a=await e();if(!t||!a)throw new te("User must be authenticated and have an embedded wallet to delegate actions.");if(!(r.walletProxy??await r.initializeWalletProxy(15e3)))throw new te("Wallet proxy not initialized.");let s=ce(t,o);if(!s)throw new te("Address to remove signers from is not associated with current user.");ue(s)?await i({wallet:s,additional_signers:[]}):await r.client.revokeDelegatedWallet();let n=await r.refreshSessionAndUser();if(!n)throw Error("Could not refresh user");return{user:n}}}})();return{addSessionSigners:async({address:t,signers:r})=>e({address:t,signers:r}),removeSessionSigners:async({address:e})=>t({address:e})}},tt=()=>{let{signWithUserSigner:e}=le();return X((()=>({async generateAuthorizationSignature(t){let{signature:r}=await ke(e,t);return{signature:r}}})),[e])},rt=()=>{let{setUser:e,client:t}=Y(ie),{user:r}=Y(se);return{user:r,refreshUser:Q((async()=>{let r=await(t?.updateUserAndIdToken());return e(r??null),r}),[t,e])}},ot=e=>{let t=i(),{initLoginWithTelegram:r,loginWithTelegram:o,telegramAuthState:a,setTelegramAuthState:s}=oe();return{login:Q((async i=>{try{if(t.enabled&&"success"!==t.status)throw new n(t.error,null,re.CAPTCHA_FAILURE);await r(t.token,i?.disableSignup);let{user:a,isNewUser:s,loginAccount:l,wasAlreadyAuthenticated:c}=await o({intent:"login"});e?.onComplete?.({user:a,isNewUser:s,wasAlreadyAuthenticated:c,loginMethod:"telegram",loginAccount:l})}catch(i){throw s({status:"error",error:i}),e?.onError?.(i.privyErrorCode||re.UNKNOWN_AUTH_ERROR),i}}),[r,o,t]),state:a}},it=()=>{let{revokeDelegatedWallets:e,delegateWallet:t}=oe();return{delegateWallet:async({address:e,chainType:r})=>await t({address:e,chainType:r,showDelegationUIs:!1}),revokeWallets:async()=>await e({showDelegationUIs:!1})}};export{tt as useAuthorizationSignature,Me as useConnectCoinbaseSmartWallet,Re as useConnectOrCreateWallet,Fe as useCrossAppAccounts,Xe as useCustomAuth,Ze as useDelegatedActions,Ye as useFarcasterSigner,De as useGuestAccounts,it as useHeadlessDelegatedActions,Oe as useLinkAccount,Qe as useLinkJwtAccount,Se as useLinkWithPasskey,Pe as useLinkWithSiwe,We as useLoginWithEmail,Ie as useLoginWithFarcasterV2,Ee as useLoginWithOAuth,Ue as useLoginWithPasskey,Ne as useLoginWithSiwe,ve as useLoginWithSms,ot as useLoginWithTelegram,Ve as useModalStatus,Be as useOAuthTokens,Ce as useRecoverEmbeddedWallet,Le as useSendTransaction,et as useSessionSigners,He as useSetWalletPassword,xe as useSetWalletRecovery,ze as useSign7702Authorization,je as useSignAuthorization,Ke as useSignMessage,be as useSignTransaction,qe as useSignTypedData,Te as useSignupWithPasskey,$e as useSubscribeToJwtAuthWithFlag,_ as useSyncJwtBasedAuthState,Ge as useToken,_e as useUpdateAccount,rt as useUser,T as useWallets};
1
+ import{g as e,a as r,u as o,b as i,c as s,C as n,d as l,s as d,U as h,e as p,f as m,h as f,G as k,W as C,i as U,j as W,k as T,l as S,m as R,n as _,o as j,p as q,q as G,r as Q}from"./privy-provider-9dA1clzB.mjs";export{v as Captcha,w as ConnectorManager,E as EthereumWalletConnector,O as LoginModal,H as PrivyClient,P as PrivyProvider,V as VERSION,x as WalletConnector,D as errorIndicatesMaxMfaRetries,F as errorIndicatesMfaTimeout,B as errorIndicatesMfaVerificationFailed,t as getAccessToken,L as useCreateWallet,I as useIdentityToken,N as useImportWallet,J as useLogout,z as useMfa,A as useMfaEnrollment,y as usePrivy,K as useRegisterMfaListener,M as useSolanaWallets}from"./privy-provider-9dA1clzB.mjs";import{useCallback as X,useMemo as $,useEffect as Y,useContext as Z,useState as ee,useRef as te}from"react";import{P as re,a as oe}from"./paths-j39vuJt8.mjs";import{u as ie,I as ae}from"./internal-context-De1jxnac.mjs";import{u as se,P as ne,g as le,a as ce,b as ue,c as de}from"./use-sign-with-user-signer-Yg0Gn-gB.mjs";export{c as useActiveWallet,a as useConnectWallet,b as useFundWallet,u as useLogin}from"./useActiveWallet-jVmO0lCL.mjs";import{F as he}from"./frame-UsDF_L76.mjs";import{zeroAddress as we,getAddress as pe,createWalletClient as ge,http as me,parseSignature as ye}from"viem";import{hashAuthorization as Ae}from"viem/utils";import{getWallet as fe,updateWallet as ke,generateAuthorizationSignature as Ce}from"@privy-io/js-sdk-core";export{DEFAULT_SUPPORTED_CHAINS as SUPPORTED_CHAINS,addPrivyRpcToChain,addRpcUrlOverrideToChain}from"@privy-io/js-sdk-core";export{g as getEmbeddedConnectedWallet}from"./getEmbeddedConnectedWallet-CSSBWE2p.mjs";import"react/jsx-runtime";import"mipd";import"react-device-detect";import"uuid";import"jose";import"eventemitter3";import"@coinbase/wallet-sdk";import"@privy-io/ethereum";import"@marsidev/react-turnstile";import"styled-components";import"tinycolor2";import"@heroicons/react/24/outline/DevicePhoneMobileIcon";import"@heroicons/react/24/outline/FingerPrintIcon";import"@heroicons/react/24/outline/PhoneIcon";import"@heroicons/react/24/outline/ShieldCheckIcon";import"@heroicons/react/24/outline/ArrowLeftIcon";import"@heroicons/react/24/outline/ArrowRightIcon";import"@heroicons/react/24/outline/QuestionMarkCircleIcon";import"@heroicons/react/24/outline/XMarkIcon";import"@heroicons/react/24/outline/ChevronDownIcon";import"@heroicons/react/24/outline/CalendarIcon";import"@heroicons/react/24/outline/ExclamationTriangleIcon";import"@headlessui/react";import"@walletconnect/ethereum-provider";import"zustand";import"fast-password-entropy";import"secure-password-utilities";import"secure-password-utilities/wordlists";import"@heroicons/react/24/outline/UserCircleIcon";import"@heroicons/react/24/outline/EnvelopeIcon";import"@heroicons/react/20/solid/CheckIcon";import"@heroicons/react/24/outline/WalletIcon";import"@heroicons/react/24/outline/CheckIcon";import"@heroicons/react/24/outline/Square2StackIcon";import"@heroicons/react/24/outline/ExclamationCircleIcon";import"@heroicons/react/24/outline/ArrowTopRightOnSquareIcon";import"@heroicons/react/24/solid/DocumentCheckIcon";import"@heroicons/react/24/solid/XCircleIcon";import"@heroicons/react/24/solid/CheckCircleIcon";import"qrcode";import"@heroicons/react/24/solid/ArrowsRightLeftIcon";import"@heroicons/react/24/outline/ChevronRightIcon";import"@heroicons/react/24/outline/LockClosedIcon";import"@heroicons/react/24/outline/PencilSquareIcon";import"@heroicons/react/24/outline/ArrowPathIcon";import"@heroicons/react/24/outline/EyeIcon";import"@heroicons/react/24/outline/EyeSlashIcon";import"@heroicons/react/24/outline/KeyIcon";import"@heroicons/react/24/outline/ArrowDownTrayIcon";import"@heroicons/react/24/outline/ClipboardDocumentCheckIcon";import"@heroicons/react/24/outline/DocumentDuplicateIcon";import"@heroicons/react/24/solid/LockClosedIcon";import"@heroicons/react/24/outline/CheckCircleIcon";import"@heroicons/react/24/outline/InformationCircleIcon";import"@heroicons/react/24/outline/CreditCardIcon";import"@heroicons/react/24/outline/QrCodeIcon";import"@heroicons/react/24/outline/GlobeAltIcon";import"ofetch";import"@heroicons/react/24/outline";import"@heroicons/react/24/outline/ClipboardDocumentIcon";import"@heroicons/react/24/outline/CloudArrowUpIcon";import"@heroicons/react/24/outline/NoSymbolIcon";import"@heroicons/react/24/outline/ClockIcon";import"@heroicons/react/24/outline/TrashIcon";import"@heroicons/react/24/solid/CheckBadgeIcon";import"@heroicons/react/24/solid/IdentificationIcon";import"@heroicons/react/24/outline/MinusCircleIcon";import"@heroicons/react/24/outline/ArrowRightEndOnRectangleIcon";import"@heroicons/react/24/solid/ShieldCheckIcon";import"js-cookie";const Ee=()=>{let{user:t}=se(),{walletProxy:o}=ie();return{recover:X((async i=>{if(!o)throw Error("Wallet proxy is not ready");let a=await e();if(!t||!a)throw new re("User must be logged in before attempting to modify the recovery method.");let{entropyId:s,entropyIdVerifier:n}=r(t);try{await o.recover({entropyId:s,entropyIdVerifier:n,accessToken:a,...i})}catch{throw new re("Unable to recover wallets")}}),[o,t])}},Ie=()=>{let{client:e,setAuthenticated:t,setUser:r}=ie();return $((()=>({init:async()=>{if(!e)throw new re("Must initialize Privy client first.");let t=new he;return e.startAuthFlow(t),await t.init()},login:async({fid:o,message:i,signature:a})=>{if(!e)throw new re("Must initialize Privy client first.");if(!(e.authFlow instanceof he))throw new re("Must initialize Farcaster frame flow first.");e.authFlow.setAuthData({message:i,signature:a,fid:o});let{user:s}=await e.authenticate();if(!s)throw new re("Failed to login with Farcaster V2");return r(s),t(!0),{user:s}}})),[e,r,t])},Ue=e=>{o("login",e);let t=i(),r=s(),{ready:a,user:c}=se(),{initLoginWithHeadlessOAuth:u,loginWithHeadlessOAuth:h,oAuthState:w,setOAuthState:p,isHeadlessOAuthLoading:g}=ie(),m=X((async e=>{try{if(t.enabled&&"success"!==t.status)throw new n(t.error,null,oe.CAPTCHA_FAILURE);return await u(e.provider,t.token,e.disableSignup)}catch(e){throw p({status:"error",error:e}),e}}),[u,t]),y=X((async()=>{let e=l();try{if(c)return console.warn("Cannot login with OAuth when already logged in"),c;if(!e.inProgress)throw Error("Cannot login with OAuth because no OAuth flow is in progress");if(e.popupFlow)return}catch(e){throw p({status:"error",error:e}),e}try{return await h(e)}catch(e){throw p({status:"error",error:e}),e}finally{d()}}),[h]);return Y((()=>{let e=l();a&&r&&e.inProgress&&!e.withPrivyUi&&!e.popupFlow&&y().catch((()=>{}))}),[a,r]),{initOAuth:m,loading:g,state:w}},We=e=>{let t=i(),{emailOtpState:r,setEmailOtpState:o,initLoginWithEmail:a,loginWithCode:s}=ie();return{sendCode:X((async({email:r,disableSignup:i})=>{try{let e;if(!r)throw Error("Email required to send OTP code");if(t.enabled&&"error"===t.status)throw new n(t.error,null,oe.CAPTCHA_FAILURE);return t.enabled&&"success"!==t.status&&(t.execute(),e=await t.waitForResult()),await a({email:r,captchaToken:e,disableSignup:i,withPrivyUi:!1})}catch(r){throw o({status:"error",error:r}),e?.onError?.(r.privyErrorCode||oe.UNKNOWN_AUTH_ERROR),r}}),[a]),loginWithCode:X((async({code:r})=>{try{if(t.enabled&&"error"===t.status)throw new n(t.error,null,oe.CAPTCHA_FAILURE);let{user:o,isNewUser:i,wasAlreadyAuthenticated:a,linkedAccount:l}=await s(r);e?.onComplete?.({user:o,isNewUser:i,wasAlreadyAuthenticated:a,loginMethod:"email",loginAccount:l})}catch(r){throw o({status:"error",error:r}),e?.onError?.(r.privyErrorCode||oe.UNKNOWN_AUTH_ERROR),r}}),[s,t.status]),state:r}},Te=e=>{let t=i(),{initSignupWithPasskey:r,signupWithPasskey:o,passkeyAuthState:a,setPasskeyAuthState:s}=ie();return{signupWithPasskey:X((async()=>{try{let i;if(t.enabled&&"error"===t.status)throw new n(t.error,null,oe.CAPTCHA_FAILURE);t.enabled&&"success"!==t.status&&(t.execute(),i=await t.waitForResult()),await r({captchaToken:i,withPrivyUi:!1});let{user:a,isNewUser:s,wasAlreadyAuthenticated:l,loginAccount:c}=await o();e?.onComplete?.({user:a,isNewUser:s,wasAlreadyAuthenticated:l,loginMethod:"passkey",loginAccount:c})}catch(t){throw s({status:"error",error:t}),e?.onError?.(t.privyErrorCode||oe.UNKNOWN_AUTH_ERROR),t}}),[o,t.status]),state:a}},Se=e=>{let t=i(),{initLoginWithPasskey:r,loginWithPasskey:o,passkeyAuthState:a,setPasskeyAuthState:s}=ie();return{loginWithPasskey:X((async i=>{try{let a;if(t.enabled&&"error"===t.status)throw new n(t.error,null,oe.CAPTCHA_FAILURE);t.enabled&&"success"!==t.status&&(t.execute(),a=await t.waitForResult()),await r({captchaToken:a,withPrivyUi:!1});let{user:s,isNewUser:l,wasAlreadyAuthenticated:c,loginAccount:u}=await o(i);e?.onComplete?.({user:s,isNewUser:l,wasAlreadyAuthenticated:c,loginMethod:"passkey",loginAccount:u})}catch(i){throw s({status:"error",error:i}),e?.onError?.(i.privyErrorCode||oe.UNKNOWN_AUTH_ERROR),i}}),[o,t.status]),state:a}},ve=e=>{let{initLinkWithPasskey:t,linkWithPasskey:r,passkeyAuthState:o,setPasskeyAuthState:i}=ie();return{linkWithPasskey:X((async()=>{try{await t();let o=await r();if(!o)throw Error("Error, user not found");let i=o.linkedAccounts.filter((e=>"passkey"===e.type)).sort(((e,t)=>t.latestVerifiedAt.getTime()-e.latestVerifiedAt.getTime()))[0];e?.onSuccess?.({user:o,linkMethod:"passkey",linkedAccount:i})}catch(t){throw i({status:"error",error:t}),e?.onError?.(t.privyErrorCode||oe.UNKNOWN_AUTH_ERROR,{linkMethod:"passkey"}),t}}),[r]),state:o}},Re=e=>{let t=i(),{smsOtpState:r,setSmsOtpState:o,initLoginWithSms:a,loginWithCode:s}=ie();return{sendCode:X((async({phoneNumber:r,disableSignup:i})=>{try{let e;if(!r)throw Error("SMS required to send OTP code");if(t.enabled&&"error"===t.status)throw new n(t.error,null,oe.CAPTCHA_FAILURE);return t.enabled&&"success"!==t.status&&(t.execute(),e=await t.waitForResult()),await a({phoneNumber:r,captchaToken:e,disableSignup:i,withPrivyUi:!1})}catch(r){throw o({status:"error",error:r}),e?.onError?.(r.privyErrorCode||oe.UNKNOWN_AUTH_ERROR),r}}),[a]),loginWithCode:X((async({code:r})=>{try{if(t.enabled&&"success"!==t.status)throw new n(t.error,null,oe.CAPTCHA_FAILURE);let{user:o,isNewUser:i,wasAlreadyAuthenticated:a,linkedAccount:l}=await s(r);e?.onComplete?.({user:o,isNewUser:i,wasAlreadyAuthenticated:a,loginMethod:"sms",loginAccount:l})}catch(r){throw o({status:"error",error:r}),e?.onError?.(r.privyErrorCode||oe.UNKNOWN_AUTH_ERROR),r}}),[s,t.status]),state:r}},Ne=e=>{let{connectOrCreateWallet:t}=se();return o("connectOrCreateWallet",e),{connectOrCreateWallet:t}},Pe=e=>{let t=i(),{siweState:r,setSiweState:o,linkWithSiwe:a,generateSiweMessage:s}=ie();return{generateSiweMessage:X((async({address:t,chainId:r})=>{try{if(!t||!r)throw Error("wallet address and chainId required to generate nonce");return await s({address:t,chainId:r}).then((e=>e))}catch(t){throw o({status:"error",error:t}),e?.onError?.(t.privyErrorCode||oe.UNKNOWN_AUTH_ERROR,{linkMethod:"siwe"}),t}}),[s]),linkWithSiwe:X((async({signature:r,message:i,chainId:s,walletClientType:l,connectorType:c})=>{try{if(t.enabled&&"success"!==t.status)throw new n(t.error,null,oe.CAPTCHA_FAILURE);let{user:o,linkedAccount:u}=await a({message:i,signature:r,chainId:s,walletClientType:l,connectorType:c});u&&e?.onSuccess?.({user:o,linkMethod:"siwe",linkedAccount:u})}catch(r){throw o({status:"error",error:r}),e?.onError?.(r.privyErrorCode||oe.UNKNOWN_AUTH_ERROR,{linkMethod:"siwe"}),r}}),[a,t.status]),state:r}},be=e=>{let t=i(),{siweState:r,setSiweState:o,client:a,generateSiweMessage:s,loginWithSiwe:l}=ie();return{generateSiweNonce:X((async r=>{try{let e;if(t.enabled&&"error"===t.status)throw new n(t.error,null,oe.CAPTCHA_FAILURE);t.enabled&&"success"!==t.status&&(t.execute(),e=await t.waitForResult()),o({status:"generating-message"});let i=await a.generateSiweNonce({address:r?.address,captchaToken:e});return o({status:"awaiting-signature"}),i}catch(r){throw o({status:"error",error:r}),e?.onError?.(r.privyErrorCode||oe.UNKNOWN_AUTH_ERROR),r}}),[a,t]),generateSiweMessage:X((async({address:t,chainId:r})=>{try{return await s({address:t,chainId:r})}catch(t){throw o({status:"error",error:t}),e?.onError?.(t.privyErrorCode||oe.UNKNOWN_AUTH_ERROR),t}}),[s]),loginWithSiwe:X((async({message:r,signature:i,disableSignup:a})=>{try{let o;if(t.enabled&&"error"===t.status)throw new n(t.error,null,oe.CAPTCHA_FAILURE);t.enabled&&"success"!==t.status&&(t.execute(),o=await t.waitForResult());let s=await l({message:r,signature:i,captchaToken:o,disableSignup:a});return e?.onComplete?.({user:s,isNewUser:!1,wasAlreadyAuthenticated:!1,loginMethod:"siwe",loginAccount:null}),s}catch(r){throw o({status:"error",error:r}),e?.onError?.(r.privyErrorCode||oe.UNKNOWN_AUTH_ERROR),r}}),[l,t.status]),state:r}};function Oe(){let{signTransaction:e}=Z(ne);return{signTransaction:e}}function _e(e){let{linkEmail:t,linkPhone:r,linkWallet:i,linkGoogle:a,linkApple:s,linkTwitter:n,linkDiscord:l,linkGithub:c,linkLinkedIn:u,linkTiktok:d,linkSpotify:h,linkInstagram:w,linkTelegram:p,linkFarcaster:g,linkPasskey:m}=Z(ne);return o("linkAccount",e),{linkEmail:t,linkPhone:r,linkWallet:i,linkGoogle:a,linkApple:s,linkTwitter:n,linkDiscord:l,linkGithub:c,linkLinkedIn:u,linkTiktok:d,linkSpotify:h,linkInstagram:w,linkFarcaster:g,linkTelegram:p,linkPasskey:m}}function Me(e){let{updateEmail:t,updatePhone:r}=Z(ne);return o("update",e),{updateEmail:t,updatePhone:r}}const Fe=e=>{let{user:t}=se(),{loginWithCode:r,emailOtpState:o,setEmailOtpState:i,client:a,inProgressAuthFlowRef:s,inProgressLoginOrLinkMethodRef:n}=ie();return{state:o,sendCode:X((async({newEmailAddress:r})=>{try{if(!t?.email)throw Error("User is required to have an email address to update it.");let e=new h(t.email.address,r);a.startAuthFlow(e),await e.sendCodeEmail({withPrivyUi:!1})}catch(r){i({status:"error",error:r}),e?.onError?.(r.privyErrorCode||oe.UNKNOWN_AUTH_ERROR,{linkMethod:"email"})}}),[t?.email]),verifyCode:X((async({code:o})=>{try{if(!t?.email)throw Error("User is required to have an email address to update it.");s.current="update",n.current="email";let{user:i,linkedAccount:a}=await r(o);return e?.onSuccess?.({user:i,updateMethod:"email",updatedAccount:a}),{user:i}}catch(o){i({status:"error",error:o}),e?.onError?.(o.privyErrorCode||oe.UNKNOWN_AUTH_ERROR,{linkMethod:"email"})}}),[t?.email])}},Le=()=>{let{connectCoinbaseSmartWallet:e}=ie();return{connectCoinbaseSmartWallet:e}},He=()=>{let{startCrossAppAuthFlow:e,unlinkCrossAppAccount:t,signMessageWithCrossAppWallet:r,signTypedDataWithCrossAppWallet:o,sendTransactionWithCrossAppWallet:i}=se();return{loginWithCrossAppAccount:({appId:t})=>e({appId:t,action:"login"}),linkCrossAppAccount:({appId:t})=>e({appId:t,action:"link"}),unlinkCrossAppAccount:t,signMessage:r,signTypedData:o,sendTransaction:i}};function De(e){let{sendTransaction:t}=Z(ne);return o("sendTransaction",e),{sendTransaction:t}}function xe(e){let{setWalletPassword:t}=Z(ne);return o("setWalletPassword",e),{setWalletPassword:t}}function Ke(){let e=p(),{getAccessToken:t}=se(),r=m(),{client:o,setUser:i,setAuthenticated:a,setIsNewUser:s,initializeWalletProxy:n}=ie(),{create:l}=f();return{createGuestAccount:async()=>{if(!e.id||!o)throw Error("SDK not yet ready");o.startAuthFlow(new k(e.id));try{let c=await o.authenticate(),u=c.user,d=c.isNewUser??!1;if(!u)throw new re("Unable to authenticate guest account");let h=await t(),w=await n(C);if(h&&w)try{let t=U(u,e.embeddedWallets.ethereum.createOnLogin),r=W(u,e.embeddedWallets.solana.createOnLogin);t&&r?(u=(await l({chainType:"ethereum",latestUser:u})).user,u=(await l({chainType:"solana",latestUser:u})).user):r?u=(await l({chainType:"solana",latestUser:u})).user:t?u=(await l({chainType:"ethereum",latestUser:u})).user:i(u)}catch(e){i(u),console.warn("Unable to create embedded wallet for guest account")}return s(d),a(!0),r("login","onComplete",{user:u,isNewUser:d,wasAlreadyAuthenticated:!1,loginMethod:"guest",loginAccount:null}),u}catch(e){throw r("login","onError",e.privyErrorCode||oe.UNKNOWN_AUTH_ERROR),e}}}}function ze(e){let{setWalletRecovery:t}=Z(ne);return o("setWalletRecovery",e),{setWalletRecovery:t}}function je(e){let{signMessage:t}=Z(ne);return o("signMessage",e),{signMessage:t}}const qe=()=>{let{ready:e,wallets:t}=T(),{user:r}=se(),{rpcConfig:o,chains:i,appId:a}=ie();return{signAuthorization:X((async(s,n)=>{let l;if(!r)throw Error("User must be authenticated before signing with a Privy wallet");if(!e)throw Error("Wallets are not ready");let c=n?.address??le(r)?.address??we,u=t.find((e=>pe(e.address)===pe(c)));if(!u)throw Error("Signing wallet not found.");let d=s.chainId??Number(u.chainId.split(":")[1]);if(0===d)l={chainId:0,address:s.contractAddress,nonce:s.nonce??0};else{let e=i.find((e=>e.id===d));if(!e)throw Error("Error, chain not configured in PrivyProvider config");let t=ge({account:c,chain:e,transport:me(S(e,o,a))});l=await t.prepareAuthorization({...s})}let h=await u.getEthereumProvider(),w=await h.request({method:"secp256k1_sign",params:[Ae(l)]});return{...l,...ye(w)}}),[e,t,r,i])}},Ve=qe;function Ge(e){let{signTypedData:t}=Z(ne);return o("signTypedData",e),{signTypedData:t}}const Be=()=>{let{isModalOpen:e}=Z(ne);return{isOpen:e}};function Je(e){let{getAccessToken:t}=Z(ne);return o("accessToken",e),{getAccessToken:t}}function Qe(e){let{authenticated:t,user:r}=se(),{initLoginWithOAuth:i}=ie(),a=m();return o("oAuthAuthorization",e),{reauthorize:e=>Xe(t,r,i,a,e.provider)}}let Xe=async(e,t,r,o,i)=>{if(!e)throw o("linkAccount","onError",oe.MUST_BE_AUTHENTICATED,{linkMethod:i}),new re("User must be authenticated before linking an account.");if(!t?.linkedAccounts.some((e=>e.type.includes(i))))throw new re(`OAuth account of type ${i} not linked to the account.`);await r(i)};function $e(e){let{client:t}=ie(),[r,o]=ee({status:"initial"});return{linkWithCustomJwt:X((async r=>{try{o({status:"initial"}),t.startAuthFlow(new R(r)),o({status:"loading"});let{user:i}=await t.link();if(!i)throw Error("Error, user not found");let a=i.linkedAccounts.filter((e=>"custom_auth"===e.type)).sort(((e,t)=>t.latestVerifiedAt.getTime()-e.latestVerifiedAt.getTime())).at(0);return o({status:"done"}),e?.onSuccess?.({user:i,linkMethod:"custom",linkedAccount:a}),{user:i}}catch(r){throw o({status:"error",error:r}),e?.onError?.(r.privyErrorCode||oe.UNKNOWN_AUTH_ERROR,{linkMethod:"custom"}),r}}),[t.startAuthFlow,t.link]),state:r}}const Ye=e=>{let t=_();return o("customAuth",e),{status:t}};function Ze({isAuthenticated:e,isLoading:t,...r}){let o=te();Y((()=>{t||o.current?.()}),[e,t]);let i=X((e=>(o.current=e,()=>{o.current=void 0})),[]);return j({...r,subscribe:i})}function et(){let{getFarcasterSignerPublicKey:e,signFarcasterMessage:t,requestFarcasterSignerFromWarpcast:r}=se();return{getFarcasterSignerPublicKey:e,signFarcasterMessage:t,requestFarcasterSignerFromWarpcast:r}}const tt=()=>{let{revokeDelegatedWallets:e,delegateWallet:t}=ie();return{delegateWallet:async({address:e,chainType:r})=>await t({address:e,chainType:r,showDelegationUIs:!0}),revokeWallets:async()=>await e({showDelegationUIs:!0})}},rt=()=>{let{addSessionSignersInternal:e,removeSessionSignersInternal:t}=(()=>{let{getAccessToken:e,user:t}=se(),r=ie(),{signWithUserSigner:o}=ce(),i=async({wallet:i,additional_signers:a})=>{let s=await e();if(!t||!s)throw new re("User must be authenticated and have an embedded wallet to delegate actions.");if(!i.id)throw new re("Wallet to add signers to must have ID on server");if(!r.walletProxy)throw new re("Wallet proxy not initialized.");await ke(r.privy,{wallet_id:i.id},o,{additional_signers:a})};return{addSessionSignersInternal:async({address:o,signers:a})=>{let s=await e();if(!t||!s)throw new re("User must be authenticated and have an embedded wallet to add a session signer.");let n=r.walletProxy??await r.initializeWalletProxy(15e3);if(!n)throw new re("Wallet proxy not initialized.");let l=ue(t,o);if(!l)throw new re("Address to add signers too is not associated with current user.");if(de(l)){if(0===a.length)throw new re("Must specify at least one signer to add.");let e=[...(await fe(r.privy,{wallet_id:l.id})).additional_signers,...q(a)];await i({wallet:l,additional_signers:e})}else{if(l.delegated)return{user:t};if(a.length>0)throw new re("addSessionSigners is only supported for TEE execution and this app uses On-device execution. Use the useHeadlessDelegatedActions hook to manage server side access on behalf of your users. Learn more https://docs.privy.io/recipes/tee-wallet-migration-guide");let e=G({address:o,user:t}),i=Q({address:o,user:t});await r.recoverEmbeddedWallet({address:o}),await n.createDelegatedAction({accessToken:s,rootWallet:i,delegatedWallets:[e]})}let c=await r.refreshSessionAndUser();if(!c)throw Error("Could not refresh user");return{user:c}},removeSessionSignersInternal:async({address:o})=>{let a=await e();if(!t||!a)throw new re("User must be authenticated and have an embedded wallet to delegate actions.");if(!(r.walletProxy??await r.initializeWalletProxy(15e3)))throw new re("Wallet proxy not initialized.");let s=ue(t,o);if(!s)throw new re("Address to remove signers from is not associated with current user.");de(s)?await i({wallet:s,additional_signers:[]}):await r.client.revokeDelegatedWallet();let n=await r.refreshSessionAndUser();if(!n)throw Error("Could not refresh user");return{user:n}}}})();return{addSessionSigners:async({address:t,signers:r})=>e({address:t,signers:r}),removeSessionSigners:async({address:e})=>t({address:e})}},ot=()=>{let{signWithUserSigner:e}=ce();return $((()=>({async generateAuthorizationSignature(t){let{signature:r}=await Ce(e,t);return{signature:r}}})),[e])},it=()=>{let{setUser:e,client:t}=Z(ae),{user:r}=Z(ne);return{user:r,refreshUser:X((async()=>{let r=await(t?.updateUserAndIdToken());return e(r??null),r}),[t,e])}},at=e=>{let t=i(),{initLoginWithTelegram:r,loginWithTelegram:o,telegramAuthState:a,setTelegramAuthState:s}=ie();return{login:X((async i=>{try{if(t.enabled&&"success"!==t.status)throw new n(t.error,null,oe.CAPTCHA_FAILURE);await r(t.token,i?.disableSignup);let{user:a,isNewUser:s,loginAccount:l,wasAlreadyAuthenticated:c}=await o({intent:"login"});e?.onComplete?.({user:a,isNewUser:s,wasAlreadyAuthenticated:c,loginMethod:"telegram",loginAccount:l})}catch(i){throw s({status:"error",error:i}),e?.onError?.(i.privyErrorCode||oe.UNKNOWN_AUTH_ERROR),i}}),[r,o,t]),state:a}},st=()=>{let{revokeDelegatedWallets:e,delegateWallet:t}=ie();return{delegateWallet:async({address:e,chainType:r})=>await t({address:e,chainType:r,showDelegationUIs:!1}),revokeWallets:async()=>await e({showDelegationUIs:!1})}};export{ot as useAuthorizationSignature,Le as useConnectCoinbaseSmartWallet,Ne as useConnectOrCreateWallet,He as useCrossAppAccounts,Ye as useCustomAuth,tt as useDelegatedActions,et as useFarcasterSigner,Ke as useGuestAccounts,st as useHeadlessDelegatedActions,_e as useLinkAccount,$e as useLinkJwtAccount,ve as useLinkWithPasskey,Pe as useLinkWithSiwe,We as useLoginWithEmail,Ie as useLoginWithFarcasterV2,Ue as useLoginWithOAuth,Se as useLoginWithPasskey,be as useLoginWithSiwe,Re as useLoginWithSms,at as useLoginWithTelegram,Be as useModalStatus,Qe as useOAuthTokens,Ee as useRecoverEmbeddedWallet,De as useSendTransaction,rt as useSessionSigners,xe as useSetWalletPassword,ze as useSetWalletRecovery,qe as useSign7702Authorization,Ve as useSignAuthorization,je as useSignMessage,Oe as useSignTransaction,Ge as useSignTypedData,Te as useSignupWithPasskey,Ze as useSubscribeToJwtAuthWithFlag,j as useSyncJwtBasedAuthState,Je as useToken,Me as useUpdateAccount,Fe as useUpdateEmail,it as useUser,T as useWallets};
@@ -1 +1 @@
1
- import{createContext as t,useContext as e}from"react";const i=()=>{throw Error("You need to wrap your application with the <PrivyProvider> initialized with your app id.")},a=t=>()=>{throw Error(t.trim())},s=/*#__PURE__*/t({setAuthenticated:i,setUser:i,setIsNewUser:i,isNewUserThisSession:!1,walletConnectionStatus:null,connectors:[],solanaWallets:[],rpcConfig:{rpcUrls:{}},showFiatPrices:!0,chains:[],clientAnalyticsId:null,pendingTransaction:null,client:null,privy:null,appId:"notAdded",onCustomAuthAuthenticated:i,hideWalletUIs:{current:!1},nativeTokenSymbolForChainId:i,initializeWalletProxy:i,getAuthMeta:i,getAuthFlow:i,closePrivyModal:i,openPrivyModal:i,connectWallet:i,initLoginWithWallet:i,loginWithWallet:i,initLoginWithFarcaster:i,loginWithFarcaster:i,loginWithCode:i,initLoginWithEmail:i,initLoginWithSms:i,initUpdateEmail:i,initUpdatePhone:i,resendEmailCode:i,resendSmsCode:i,initLoginWithHeadlessOAuth:i,loginWithHeadlessOAuth:i,crossAppAuthFlow:i,initLoginWithOAuth:i,loginWithOAuth:i,passkeyAuthState:{status:"initial"},setPasskeyAuthState:i,initSignupWithPasskey:i,signupWithPasskey:i,initLoginWithPasskey:i,loginWithPasskey:i,initLinkWithPasskey:i,linkWithPasskey:i,refreshSessionAndUser:i,walletProxy:null,createAnalyticsEvent:i,acceptTerms:i,getUsdTokenPrice:i,getUsdPriceForSol:i,getSplTokenMetadata:i,recoverEmbeddedWallet:i,updateWallets:i,fundWallet:i,openModal:i,setReadyToTrue:i,requestFarcasterSignerStatus:i,initLoginWithTelegram:i,loginWithTelegram:i,generateSiweMessage:i,generateSiweMessageForSmartWallet:i,loginWithSiwe:i,linkWithSiwe:i,linkSmartWallet:i,delegateWallet:i,revokeDelegatedWallets:i,exportSolanaWallet:i,connectCoinbaseSmartWallet:i,initiateAccountTransfer:i,emailOtpState:{status:"initial"},setEmailOtpState:i,smsOtpState:{status:"initial"},setSmsOtpState:i,siweState:{status:"initial"},setSiweState:i,oAuthState:{status:"initial"},setOAuthState:i,telegramAuthState:{status:"initial"},setTelegramAuthState:i,isHeadlessOAuthLoading:!1,isHeadlessSigning:i}),n=()=>e(s);export{s as I,i as a,a as n,n as u};
1
+ import{createContext as t,useContext as e}from"react";const i=()=>{throw Error("You need to wrap your application with the <PrivyProvider> initialized with your app id.")},a=t=>()=>{throw Error(t.trim())},n=/*#__PURE__*/t({setAuthenticated:i,setUser:i,setIsNewUser:i,isNewUserThisSession:!1,walletConnectionStatus:null,connectors:[],solanaWallets:[],rpcConfig:{rpcUrls:{}},showFiatPrices:!0,chains:[],clientAnalyticsId:null,pendingTransaction:null,client:null,privy:null,appId:"notAdded",onCustomAuthAuthenticated:i,hideWalletUIs:{current:!1},nativeTokenSymbolForChainId:i,initializeWalletProxy:i,getAuthMeta:i,getAuthFlow:i,closePrivyModal:i,openPrivyModal:i,connectWallet:i,initLoginWithWallet:i,loginWithWallet:i,initLoginWithFarcaster:i,loginWithFarcaster:i,loginWithCode:i,initLoginWithEmail:i,initLoginWithSms:i,initUpdateEmail:i,initUpdatePhone:i,resendEmailCode:i,resendSmsCode:i,initLoginWithHeadlessOAuth:i,loginWithHeadlessOAuth:i,crossAppAuthFlow:i,initLoginWithOAuth:i,loginWithOAuth:i,passkeyAuthState:{status:"initial"},setPasskeyAuthState:i,initSignupWithPasskey:i,signupWithPasskey:i,initLoginWithPasskey:i,loginWithPasskey:i,initLinkWithPasskey:i,linkWithPasskey:i,refreshSessionAndUser:i,walletProxy:null,createAnalyticsEvent:i,acceptTerms:i,getUsdTokenPrice:i,getUsdPriceForSol:i,getSplTokenMetadata:i,recoverEmbeddedWallet:i,updateWallets:i,fundWallet:i,openModal:i,setReadyToTrue:i,requestFarcasterSignerStatus:i,initLoginWithTelegram:i,loginWithTelegram:i,generateSiweMessage:i,generateSiweMessageForSmartWallet:i,loginWithSiwe:i,linkWithSiwe:i,linkSmartWallet:i,delegateWallet:i,revokeDelegatedWallets:i,exportSolanaWallet:i,connectCoinbaseSmartWallet:i,initiateAccountTransfer:i,emailOtpState:{status:"initial"},setEmailOtpState:i,smsOtpState:{status:"initial"},setSmsOtpState:i,siweState:{status:"initial"},setSiweState:i,oAuthState:{status:"initial"},setOAuthState:i,telegramAuthState:{status:"initial"},setTelegramAuthState:i,isHeadlessOAuthLoading:!1,isHeadlessSigning:i,inProgressAuthFlowRef:{current:null},inProgressLoginOrLinkMethodRef:{current:null}}),s=()=>e(n);export{n as I,i as a,a as n,s as u};