@privy-io/react-auth 2.17.1 → 2.17.3

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 (39) hide show
  1. package/dist/cjs/abstract-smart-wallets.js +1 -1
  2. package/dist/cjs/index.js +1 -1
  3. package/dist/cjs/privy-provider-DJSBO1cS.js +28 -0
  4. package/dist/cjs/{smart-wallets-BYtNzX4E.js → smart-wallets-C5OETWB3.js} +1 -1
  5. package/dist/cjs/smart-wallets.js +1 -1
  6. package/dist/cjs/solana.js +1 -1
  7. package/dist/cjs/ui.js +1 -1
  8. package/dist/cjs/{useActiveWallet-nU87GByS.js → useActiveWallet-C_wN_Vtk.js} +1 -1
  9. package/dist/cjs/{useFundWallet-D34O27Xy.js → useFundWallet-D7jsZQgJ.js} +1 -1
  10. package/dist/dts/extended-chains.d.mts +1 -1
  11. package/dist/dts/extended-chains.d.ts +1 -1
  12. package/dist/dts/farcaster.d.mts +1 -1
  13. package/dist/dts/farcaster.d.ts +1 -1
  14. package/dist/dts/index.d.mts +13 -5
  15. package/dist/dts/index.d.ts +13 -5
  16. package/dist/dts/smart-wallets.d.mts +1 -1
  17. package/dist/dts/smart-wallets.d.ts +1 -1
  18. package/dist/dts/solana.d.mts +4 -4
  19. package/dist/dts/solana.d.ts +4 -4
  20. package/dist/dts/{types-BKf1TjPF.d.mts → types-C750flIl.d.mts} +3 -3
  21. package/dist/dts/{types-BKf1TjPF.d.ts → types-C750flIl.d.ts} +3 -3
  22. package/dist/dts/ui.d.mts +1 -1
  23. package/dist/dts/ui.d.ts +1 -1
  24. package/dist/dts/{useSolanaWallets-BTDsdOi4.d.mts → useSolanaWallets-BMH597gE.d.mts} +2 -2
  25. package/dist/dts/{useSolanaWallets-BTDsdOi4.d.ts → useSolanaWallets-BMH597gE.d.ts} +2 -2
  26. package/dist/esm/abstract-smart-wallets.mjs +1 -1
  27. package/dist/esm/index.mjs +1 -1
  28. package/dist/esm/privy-provider-C8x4T-HJ.mjs +28 -0
  29. package/dist/esm/smart-wallets-DJW4A6lN.mjs +1 -0
  30. package/dist/esm/smart-wallets.mjs +1 -1
  31. package/dist/esm/solana.mjs +1 -1
  32. package/dist/esm/ui.mjs +2 -2
  33. package/dist/esm/{useActiveWallet-DcO7KzrL.mjs → useActiveWallet-DTVla7H-.mjs} +1 -1
  34. package/dist/esm/useFundWallet-Biyv49Yj.mjs +1 -0
  35. package/package.json +5 -4
  36. package/dist/cjs/privy-provider-BXJNeQGh.js +0 -28
  37. package/dist/esm/privy-provider-BQ1CWFyj.mjs +0 -28
  38. package/dist/esm/smart-wallets-C-j9Aznr.mjs +0 -1
  39. package/dist/esm/useFundWallet-bdje11A8.mjs +0 -1
@@ -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-BKf1TjPF.js';
4
- export { ax as Apple, aK as AppleOAuthWithMetadata, aS as ContractUIOptions, aB as CrossAppAccount, aN as CrossAppAccountWithMetadata, au as Discord, aF as DiscordOAuthWithMetadata, aP as Email, ap as EmailWithMetadata, aW as Farcaster, aL as FarcasterWithMetadata, av as Github, aG as GithubOAuthWithMetadata, as as Google, aD as GoogleOAuthWithMetadata, az as Line, aI as LineOAuthWithMetadata, aC as LinkedAccountType, b as LinkedAccountWithMetadata, aw as LinkedIn, aJ as LinkedInOAuthWithMetadata, aY as LoginMethodOrderOption, ag as MessageTypes, ai as MoonpayConfig, aj as MoonpayCurrencyCode, aU as MoonpayFundingConfig, ak as MoonpayPaymentMethod, aT as NativeFundingConfig, ao as NonEmptyArray, aX as Passkey, aO as PasskeyWithMetadata, aQ as Phone, aq as PhoneWithMetadata, aV as PriceDisplayOptions, P as PrivyErrorCode, al as Quantity, ah as SmartWallet, f as SolanaCluster, k as SolanaFundingConfig, S as SolanaTransactionReceipt, e as SupportedSolanaTransaction, aA as Telegram, aM as TelegramWithMetadata, ay as Tiktok, aH as TiktokOAuthWithMetadata, am as TransactionLog, an as TransactionReceipt, aR as TransactionUIOptions, at as Twitter, aE as TwitterOAuthWithMetadata, af as TypedMessage, ar as WalletWithMetadata } from './types-BKf1TjPF.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-C750flIl.js';
4
+ export { ax as Apple, aK as AppleOAuthWithMetadata, aS as ContractUIOptions, aB as CrossAppAccount, aN as CrossAppAccountWithMetadata, au as Discord, aF as DiscordOAuthWithMetadata, aP as Email, ap as EmailWithMetadata, aW as Farcaster, aL as FarcasterWithMetadata, av as Github, aG as GithubOAuthWithMetadata, as as Google, aD as GoogleOAuthWithMetadata, az as Line, aI as LineOAuthWithMetadata, aC as LinkedAccountType, b as LinkedAccountWithMetadata, aw as LinkedIn, aJ as LinkedInOAuthWithMetadata, aY as LoginMethodOrderOption, ag as MessageTypes, ai as MoonpayConfig, aj as MoonpayCurrencyCode, aU as MoonpayFundingConfig, ak as MoonpayPaymentMethod, aT as NativeFundingConfig, ao as NonEmptyArray, aX as Passkey, aO as PasskeyWithMetadata, aQ as Phone, aq as PhoneWithMetadata, aV as PriceDisplayOptions, P as PrivyErrorCode, al as Quantity, ah as SmartWallet, f as SolanaCluster, k as SolanaFundingConfig, S as SolanaTransactionReceipt, e as SupportedSolanaTransaction, aA as Telegram, aM as TelegramWithMetadata, ay as Tiktok, aH as TiktokOAuthWithMetadata, am as TransactionLog, an as TransactionReceipt, aR as TransactionUIOptions, at as Twitter, aE as TwitterOAuthWithMetadata, af as TypedMessage, ar as WalletWithMetadata } from './types-C750flIl.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-BTDsdOi4.js';
20
- export { C as CallbackError, U as UseSolanaWalletsInterface, u as useSolanaWallets } from './useSolanaWallets-BTDsdOi4.js';
19
+ import { P as PrivyEvents } from './useSolanaWallets-BMH597gE.js';
20
+ export { C as CallbackError, U as UseSolanaWalletsInterface, u as useSolanaWallets } from './useSolanaWallets-BMH597gE.js';
21
21
  import '@coinbase/wallet-sdk';
22
22
  import '@solana/wallet-adapter-base';
23
23
  import '@solana/wallet-standard-features';
@@ -3396,6 +3396,14 @@ interface UseConnectCoinbaseSmartWalletInterface {
3396
3396
  }
3397
3397
  declare const useConnectCoinbaseSmartWallet: () => UseConnectCoinbaseSmartWalletInterface;
3398
3398
 
3399
+ type UseAuthMfa = {
3400
+ verify: () => Promise<void>;
3401
+ };
3402
+ /**
3403
+ * @experimental
3404
+ */
3405
+ declare const useAuthMfa: () => UseAuthMfa;
3406
+
3399
3407
  interface UseImportWalletInterface {
3400
3408
  /**
3401
3409
  * Imports a private key to be used as an embedded wallet for the user
@@ -4142,4 +4150,4 @@ declare const LoginModal: ({ open }: {
4142
4150
  open: boolean;
4143
4151
  }) => react_jsx_runtime.JSX.Element;
4144
4152
 
4145
- 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 };
4153
+ 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, useAuthMfa, 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-BKf1TjPF.js';
7
+ import { h as SendTransactionModalUIOptions, i as SignMessageModalUIOptions } from './types-C750flIl.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-BKf1TjPF.js';
7
+ import { h as SendTransactionModalUIOptions, i as SignMessageModalUIOptions } from './types-C750flIl.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-BKf1TjPF.js';
2
- export { C as ConnectedSolanaWallet, l as SolanaAdapterConnector, t as toSolanaWalletConnectors } from './types-BKf1TjPF.js';
3
- import { P as PrivyEvents } from './useSolanaWallets-BTDsdOi4.js';
4
- export { U as UseSolanaWalletsInterface, u as useSolanaWallets } from './useSolanaWallets-BTDsdOi4.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-C750flIl.js';
2
+ export { C as ConnectedSolanaWallet, l as SolanaAdapterConnector, t as toSolanaWalletConnectors } from './types-C750flIl.js';
3
+ import { P as PrivyEvents } from './useSolanaWallets-BMH597gE.js';
4
+ export { U as UseSolanaWalletsInterface, u as useSolanaWallets } from './useSolanaWallets-BMH597gE.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-BKf1TjPF.js';
2
- export { C as ConnectedSolanaWallet, l as SolanaAdapterConnector, t as toSolanaWalletConnectors } from './types-BKf1TjPF.js';
3
- import { P as PrivyEvents } from './useSolanaWallets-BTDsdOi4.js';
4
- export { U as UseSolanaWalletsInterface, u as useSolanaWallets } from './useSolanaWallets-BTDsdOi4.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-C750flIl.js';
2
+ export { C as ConnectedSolanaWallet, l as SolanaAdapterConnector, t as toSolanaWalletConnectors } from './types-C750flIl.js';
3
+ import { P as PrivyEvents } from './useSolanaWallets-BMH597gE.js';
4
+ export { U as UseSolanaWalletsInterface, u as useSolanaWallets } from './useSolanaWallets-BMH597gE.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';
@@ -497,7 +497,7 @@ type AlchemyPaymasterContextClient = {
497
497
 
498
498
  /**
499
499
  * A transaction that can be sent to the Solana network. Legacy transactions or v0 transactions (versioned) are supported.
500
- * Refer to {@link https://solana-labs.github.io/solana-web3.js/classes/Transaction.html Transaction} and {@link https://solana-labs.github.io/solana-web3.js/classes/VersionedTransaction.html VersionedTransaction}
500
+ * Refer to {@link https://solana-foundation.github.io/solana-web3.js/classes/Transaction.html Transaction} and {@link https://solana-foundation.github.io/solana-web3.js/classes/VersionedTransaction.html VersionedTransaction}
501
501
  */
502
502
  type SupportedSolanaTransaction = Transaction | VersionedTransaction;
503
503
  /**
@@ -508,7 +508,7 @@ type SolanaTransactionReceipt = {
508
508
  signature: string;
509
509
  /** The signed transaction */
510
510
  signedTransaction: SupportedSolanaTransaction;
511
- /** The parsed transaction result. Refer to {@link https://solana-labs.github.io/solana-web3.js/types/ParsedTransactionWithMeta.html ParsedTransactionWithMeta}*/
511
+ /** The parsed transaction result. Refer to {@link https://solana-foundation.github.io/solana-web3.js/types/ParsedTransactionWithMeta.html ParsedTransactionWithMeta}*/
512
512
  parsedTransaction: ParsedTransactionWithMeta | null;
513
513
  /** The fees payed for the transaction in lamports */
514
514
  fees: bigint;
@@ -516,7 +516,7 @@ type SolanaTransactionReceipt = {
516
516
  type SolanaCluster = {
517
517
  /**
518
518
  * The network name
519
- * Refer to {@link https://solana-labs.github.io/solana-web3.js/types/Cluster.html Cluster} for more information
519
+ * Refer to {@link https://solana-foundation.github.io/solana-web3.js/types/Cluster.html Cluster} for more information
520
520
  * */
521
521
  name: Cluster;
522
522
  /** The RPC endpoint */
@@ -497,7 +497,7 @@ type AlchemyPaymasterContextClient = {
497
497
 
498
498
  /**
499
499
  * A transaction that can be sent to the Solana network. Legacy transactions or v0 transactions (versioned) are supported.
500
- * Refer to {@link https://solana-labs.github.io/solana-web3.js/classes/Transaction.html Transaction} and {@link https://solana-labs.github.io/solana-web3.js/classes/VersionedTransaction.html VersionedTransaction}
500
+ * Refer to {@link https://solana-foundation.github.io/solana-web3.js/classes/Transaction.html Transaction} and {@link https://solana-foundation.github.io/solana-web3.js/classes/VersionedTransaction.html VersionedTransaction}
501
501
  */
502
502
  type SupportedSolanaTransaction = Transaction | VersionedTransaction;
503
503
  /**
@@ -508,7 +508,7 @@ type SolanaTransactionReceipt = {
508
508
  signature: string;
509
509
  /** The signed transaction */
510
510
  signedTransaction: SupportedSolanaTransaction;
511
- /** The parsed transaction result. Refer to {@link https://solana-labs.github.io/solana-web3.js/types/ParsedTransactionWithMeta.html ParsedTransactionWithMeta}*/
511
+ /** The parsed transaction result. Refer to {@link https://solana-foundation.github.io/solana-web3.js/types/ParsedTransactionWithMeta.html ParsedTransactionWithMeta}*/
512
512
  parsedTransaction: ParsedTransactionWithMeta | null;
513
513
  /** The fees payed for the transaction in lamports */
514
514
  fees: bigint;
@@ -516,7 +516,7 @@ type SolanaTransactionReceipt = {
516
516
  type SolanaCluster = {
517
517
  /**
518
518
  * The network name
519
- * Refer to {@link https://solana-labs.github.io/solana-web3.js/types/Cluster.html Cluster} for more information
519
+ * Refer to {@link https://solana-foundation.github.io/solana-web3.js/types/Cluster.html Cluster} for more information
520
520
  * */
521
521
  name: Cluster;
522
522
  /** The RPC endpoint */
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-BKf1TjPF.js';
2
+ import { R as RuntimeLoginOverridableOptions } from './types-C750flIl.js';
3
3
  import { Hex } from 'viem';
4
4
  import { Chain, Cluster } from '@privy-io/js-sdk-core';
5
5
  import '@coinbase/wallet-sdk';
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-BKf1TjPF.js';
2
+ import { R as RuntimeLoginOverridableOptions } from './types-C750flIl.js';
3
3
  import { Hex } from 'viem';
4
4
  import { Chain, Cluster } from '@privy-io/js-sdk-core';
5
5
  import '@coinbase/wallet-sdk';
@@ -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-BKf1TjPF.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-C750flIl.js';
3
3
  import { MouseEvent } from 'react';
4
4
 
5
5
  /**
@@ -248,7 +248,7 @@ interface PrivyEvents {
248
248
  /**
249
249
  * Callback that will execute once a successful `sendSolanaTransaction` completes.
250
250
  * This will not run in the case of a wallet-based authentication or link flow.
251
- * @param params.response - the response {@link https://solana-labs.github.io/solana-web3.js/types/ParsedTransactionMeta.html SolanaTransactionReceipt} from the successful transaction
251
+ * @param params.response - the response {@link https://solana-foundation.github.io/solana-web3.js/types/ParsedTransactionMeta.html SolanaTransactionReceipt} from the successful transaction
252
252
  */
253
253
  onSuccess?: (params: {
254
254
  response: SolanaTransactionReceipt;
@@ -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-BKf1TjPF.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-C750flIl.js';
3
3
  import { MouseEvent } from 'react';
4
4
 
5
5
  /**
@@ -248,7 +248,7 @@ interface PrivyEvents {
248
248
  /**
249
249
  * Callback that will execute once a successful `sendSolanaTransaction` completes.
250
250
  * This will not run in the case of a wallet-based authentication or link flow.
251
- * @param params.response - the response {@link https://solana-labs.github.io/solana-web3.js/types/ParsedTransactionMeta.html SolanaTransactionReceipt} from the successful transaction
251
+ * @param params.response - the response {@link https://solana-foundation.github.io/solana-web3.js/types/ParsedTransactionMeta.html SolanaTransactionReceipt} from the successful transaction
252
252
  */
253
253
  onSuccess?: (params: {
254
254
  response: SolanaTransactionReceipt;
@@ -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 c}from"viem/chains";import{u as s,g as l,c as d}from"./use-sign-with-user-signer-C3vxQSbq.mjs";import{e as p,k as m,ay as u,a as h,aJ as I,aK as g,aL as y,l as f}from"./privy-provider-BQ1CWFyj.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-C-j9Aznr.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/CalendarIcon";import"@heroicons/react/24/outline/ExclamationTriangleIcon";import"@heroicons/react/24/outline/ChevronDownIcon";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:b,appId:A,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=b.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,A)),publicTransport:i(f(d,W,A)),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
+ 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-C3vxQSbq.mjs";import{k as p,p as m,e as u,a as h,aP as I,aQ as g,aR as y,q as f}from"./privy-provider-C8x4T-HJ.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-DJW4A6lN.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/CalendarIcon";import"@heroicons/react/24/outline/ExclamationTriangleIcon";import"@heroicons/react/24/outline/ChevronDownIcon";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"@tanstack/react-virtual";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:b,appId:A,rpcConfig:W,client:k}=v(),M=p(),{wallets:F}=m(),{setModalData:q}=u(),R=l(T),x=!!R&&d(R),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=b.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,A)),publicTransport:i(f(d,W,A)),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:R.recoveryMethod,connectingWalletAddress:R.address,isUnifiedWallet:x,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:R.recoveryMethod,connectingWalletAddress:R.address,isUnifiedWallet:x,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:R.recoveryMethod,connectingWalletAddress:R.address,isUnifiedWallet:x,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(!k)throw Error("Privy client not found");let t=n?o(r.account.address,e):e,i=await r.prepareAbstractTransactionRequest(t);return await k.scanTransaction({metadata:{domain:M.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:R.recoveryMethod,connectingWalletAddress:R.address,isUnifiedWallet:x,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(!k)throw Error("Privy client not found");let t=n?o(r.account.address,e):e,i=await r.prepareAbstractTransactionRequest(t);return await k.scanTransaction({metadata:{domain:M.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{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 k,G as f,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-BQ1CWFyj.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-BQ1CWFyj.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-C3vxQSbq.mjs";export{c as useActiveWallet,a as useConnectWallet,b as useFundWallet,u as useLogin}from"./useActiveWallet-DcO7KzrL.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 ke,updateWallet as fe,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/CalendarIcon";import"@heroicons/react/24/outline/ExclamationTriangleIcon";import"@heroicons/react/24/outline/ChevronDownIcon";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,linkLine:h,linkSpotify:w,linkInstagram:p,linkTelegram:g,linkFarcaster:m,linkPasskey:y}=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,linkLine:h,linkSpotify:w,linkInstagram:p,linkFarcaster:m,linkTelegram:g,linkPasskey:y}}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}=k();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 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 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 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 ke(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
+ import{g as e,a as t,u as r,b as o,c as i,C as s,d as n,s as l,U as d,e as h,V as w,f as p,h as m,t as y,i as f,j as k,k as C,l as v,m as W,G as U,W as _,n as x,o as z,p as V,q as j,r as q,v as G,w as $,x as ee,y as te,z as re}from"./privy-provider-C8x4T-HJ.mjs";export{B as Captcha,D as ConnectorManager,F as EthereumWalletConnector,Z as LoginModal,O as PrivyClient,P as PrivyProvider,N as VERSION,E as WalletConnector,L as errorIndicatesMaxMfaRetries,M as errorIndicatesMfaTimeout,K as errorIndicatesMfaVerificationFailed,A as getAccessToken,T as useCreateWallet,Q as useIdentityToken,Y as useImportWallet,R as useLogout,I as useMfa,J as useMfaEnrollment,H as usePrivy,S as useRegisterMfaListener,X as useSolanaWallets}from"./privy-provider-C8x4T-HJ.mjs";import{useCallback as oe,useMemo as ie,useEffect as ae,useContext as se,useState as ne,useRef as le}from"react";import{P as ce,a as ue}from"./paths-j39vuJt8.mjs";import{u as de,I as he}from"./internal-context-De1jxnac.mjs";import{u as we,P as pe,g as me,a as ge,b as ye,c as Ae}from"./use-sign-with-user-signer-C3vxQSbq.mjs";export{c as useActiveWallet,a as useConnectWallet,b as useFundWallet,u as useLogin}from"./useActiveWallet-DTVla7H-.mjs";import{F as fe}from"./frame-UsDF_L76.mjs";import{MfaAuthTotpVerify as ke,MfaAuthPasskeyInit as Ce,MfaAuthPasskeyVerify as Ee}from"@privy-io/public-api";import{jsx as ve}from"react/jsx-runtime";import{zeroAddress as Se,getAddress as Ie,createWalletClient as We,http as Ue,parseSignature as Te}from"viem";import{hashAuthorization as Re}from"viem/utils";import{getWallet as Pe,updateWallet as be,generateAuthorizationSignature as Ne}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"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/CalendarIcon";import"@heroicons/react/24/outline/ExclamationTriangleIcon";import"@heroicons/react/24/outline/ChevronDownIcon";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"@tanstack/react-virtual";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 Oe=()=>{let{user:r}=we(),{walletProxy:o}=de();return{recover:oe((async i=>{if(!o)throw Error("Wallet proxy is not ready");let a=await e();if(!r||!a)throw new ce("User must be logged in before attempting to modify the recovery method.");let{entropyId:s,entropyIdVerifier:n}=t(r);try{await o.recover({entropyId:s,entropyIdVerifier:n,accessToken:a,...i})}catch{throw new ce("Unable to recover wallets")}}),[o,r])}},Me=()=>{let{client:e,setAuthenticated:t,setUser:r}=de();return ie((()=>({init:async()=>{if(!e)throw new ce("Must initialize Privy client first.");let t=new fe;return e.startAuthFlow(t),await t.init()},login:async({fid:o,message:i,signature:a})=>{if(!e)throw new ce("Must initialize Privy client first.");if(!(e.authFlow instanceof fe))throw new ce("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 ce("Failed to login with Farcaster V2");return r(s),t(!0),{user:s}}})),[e,r,t])},_e=e=>{r("login",e);let t=o(),a=i(),{ready:c,user:u}=we(),{initLoginWithHeadlessOAuth:d,loginWithHeadlessOAuth:h,oAuthState:w,setOAuthState:p,isHeadlessOAuthLoading:m}=de(),g=oe((async e=>{try{if(t.enabled&&"success"!==t.status)throw new s(t.error,null,ue.CAPTCHA_FAILURE);return await d(e.provider,t.token,e.disableSignup)}catch(e){throw p({status:"error",error:e}),e}}),[d,t]),y=oe((async()=>{let e=n();try{if(u)return console.warn("Cannot login with OAuth when already logged in"),u;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{l()}}),[h]);return ae((()=>{let e=n();c&&a&&e.inProgress&&!e.withPrivyUi&&!e.popupFlow&&y().catch((()=>{}))}),[c,a]),{initOAuth:g,loading:m,state:w}},Fe=e=>{let t=o(),{emailOtpState:r,setEmailOtpState:i,initLoginWithEmail:a,loginWithCode:n}=de();return{sendCode:oe((async({email:r,disableSignup:o})=>{try{let e;if(!r)throw Error("Email required to send OTP code");if(t.enabled&&"error"===t.status)throw new s(t.error,null,ue.CAPTCHA_FAILURE);return t.enabled&&"success"!==t.status&&(t.execute(),e=await t.waitForResult()),await a({email:r,captchaToken:e,disableSignup:o,withPrivyUi:!1})}catch(r){throw i({status:"error",error:r}),e?.onError?.(r.privyErrorCode||ue.UNKNOWN_AUTH_ERROR),r}}),[a]),loginWithCode:oe((async({code:r})=>{try{if(t.enabled&&"error"===t.status)throw new s(t.error,null,ue.CAPTCHA_FAILURE);let{user:o,isNewUser:i,wasAlreadyAuthenticated:a,linkedAccount:l}=await n(r);e?.onComplete?.({user:o,isNewUser:i,wasAlreadyAuthenticated:a,loginMethod:"email",loginAccount:l})}catch(r){throw i({status:"error",error:r}),e?.onError?.(r.privyErrorCode||ue.UNKNOWN_AUTH_ERROR),r}}),[n,t.status]),state:r}},Le=e=>{let t=o(),{initSignupWithPasskey:r,signupWithPasskey:i,passkeyAuthState:a,setPasskeyAuthState:n}=de();return{signupWithPasskey:oe((async()=>{try{let o;if(t.enabled&&"error"===t.status)throw new s(t.error,null,ue.CAPTCHA_FAILURE);t.enabled&&"success"!==t.status&&(t.execute(),o=await t.waitForResult()),await r({captchaToken:o,withPrivyUi:!1});let{user:a,isNewUser:n,wasAlreadyAuthenticated:l,loginAccount:c}=await i();e?.onComplete?.({user:a,isNewUser:n,wasAlreadyAuthenticated:l,loginMethod:"passkey",loginAccount:c})}catch(t){throw n({status:"error",error:t}),e?.onError?.(t.privyErrorCode||ue.UNKNOWN_AUTH_ERROR),t}}),[i,t.status]),state:a}},He=e=>{let t=o(),{initLoginWithPasskey:r,loginWithPasskey:i,passkeyAuthState:a,setPasskeyAuthState:n}=de();return{loginWithPasskey:oe((async o=>{try{let a;if(t.enabled&&"error"===t.status)throw new s(t.error,null,ue.CAPTCHA_FAILURE);t.enabled&&"success"!==t.status&&(t.execute(),a=await t.waitForResult()),await r({captchaToken:a,withPrivyUi:!1});let{user:n,isNewUser:l,wasAlreadyAuthenticated:c,loginAccount:u}=await i(o);e?.onComplete?.({user:n,isNewUser:l,wasAlreadyAuthenticated:c,loginMethod:"passkey",loginAccount:u})}catch(o){throw n({status:"error",error:o}),e?.onError?.(o.privyErrorCode||ue.UNKNOWN_AUTH_ERROR),o}}),[i,t.status]),state:a}},De=e=>{let{initLinkWithPasskey:t,linkWithPasskey:r,passkeyAuthState:o,setPasskeyAuthState:i}=de();return{linkWithPasskey:oe((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||ue.UNKNOWN_AUTH_ERROR,{linkMethod:"passkey"}),t}}),[r]),state:o}},xe=e=>{let t=o(),{smsOtpState:r,setSmsOtpState:i,initLoginWithSms:a,loginWithCode:n}=de();return{sendCode:oe((async({phoneNumber:r,disableSignup:o})=>{try{let e;if(!r)throw Error("SMS required to send OTP code");if(t.enabled&&"error"===t.status)throw new s(t.error,null,ue.CAPTCHA_FAILURE);return t.enabled&&"success"!==t.status&&(t.execute(),e=await t.waitForResult()),await a({phoneNumber:r,captchaToken:e,disableSignup:o,withPrivyUi:!1})}catch(r){throw i({status:"error",error:r}),e?.onError?.(r.privyErrorCode||ue.UNKNOWN_AUTH_ERROR),r}}),[a]),loginWithCode:oe((async({code:r})=>{try{if(t.enabled&&"success"!==t.status)throw new s(t.error,null,ue.CAPTCHA_FAILURE);let{user:o,isNewUser:i,wasAlreadyAuthenticated:a,linkedAccount:l}=await n(r);e?.onComplete?.({user:o,isNewUser:i,wasAlreadyAuthenticated:a,loginMethod:"sms",loginAccount:l})}catch(r){throw i({status:"error",error:r}),e?.onError?.(r.privyErrorCode||ue.UNKNOWN_AUTH_ERROR),r}}),[n,t.status]),state:r}},Ke=e=>{let{connectOrCreateWallet:t}=we();return r("connectOrCreateWallet",e),{connectOrCreateWallet:t}},ze=e=>{let t=o(),{siweState:r,setSiweState:i,linkWithSiwe:a,generateSiweMessage:n}=de();return{generateSiweMessage:oe((async({address:t,chainId:r})=>{try{if(!t||!r)throw Error("wallet address and chainId required to generate nonce");return await n({address:t,chainId:r}).then((e=>e))}catch(t){throw i({status:"error",error:t}),e?.onError?.(t.privyErrorCode||ue.UNKNOWN_AUTH_ERROR,{linkMethod:"siwe"}),t}}),[n]),linkWithSiwe:oe((async({signature:r,message:o,chainId:n,walletClientType:l,connectorType:c})=>{try{if(t.enabled&&"success"!==t.status)throw new s(t.error,null,ue.CAPTCHA_FAILURE);let{user:i,linkedAccount:u}=await a({message:o,signature:r,chainId:n,walletClientType:l,connectorType:c});u&&e?.onSuccess?.({user:i,linkMethod:"siwe",linkedAccount:u})}catch(r){throw i({status:"error",error:r}),e?.onError?.(r.privyErrorCode||ue.UNKNOWN_AUTH_ERROR,{linkMethod:"siwe"}),r}}),[a,t.status]),state:r}},Ve=e=>{let t=o(),{siweState:r,setSiweState:i,client:a,generateSiweMessage:n,loginWithSiwe:l}=de();return{generateSiweNonce:oe((async r=>{try{let e;if(t.enabled&&"error"===t.status)throw new s(t.error,null,ue.CAPTCHA_FAILURE);t.enabled&&"success"!==t.status&&(t.execute(),e=await t.waitForResult()),i({status:"generating-message"});let o=await a.generateSiweNonce({address:r?.address,captchaToken:e});return i({status:"awaiting-signature"}),o}catch(r){throw i({status:"error",error:r}),e?.onError?.(r.privyErrorCode||ue.UNKNOWN_AUTH_ERROR),r}}),[a,t]),generateSiweMessage:oe((async({address:t,chainId:r})=>{try{return await n({address:t,chainId:r})}catch(t){throw i({status:"error",error:t}),e?.onError?.(t.privyErrorCode||ue.UNKNOWN_AUTH_ERROR),t}}),[n]),loginWithSiwe:oe((async({message:r,signature:o,disableSignup:a})=>{try{let i;if(t.enabled&&"error"===t.status)throw new s(t.error,null,ue.CAPTCHA_FAILURE);t.enabled&&"success"!==t.status&&(t.execute(),i=await t.waitForResult());let n=await l({message:r,signature:o,captchaToken:i,disableSignup:a});return e?.onComplete?.({user:n,isNewUser:!1,wasAlreadyAuthenticated:!1,loginMethod:"siwe",loginAccount:null}),n}catch(r){throw i({status:"error",error:r}),e?.onError?.(r.privyErrorCode||ue.UNKNOWN_AUTH_ERROR),r}}),[l,t.status]),state:r}};function je(){let{signTransaction:e}=se(pe);return{signTransaction:e}}function qe(e){let{linkEmail:t,linkPhone:o,linkWallet:i,linkGoogle:a,linkApple:s,linkTwitter:n,linkDiscord:l,linkGithub:c,linkLinkedIn:u,linkTiktok:d,linkLine:h,linkSpotify:w,linkInstagram:p,linkTelegram:m,linkFarcaster:g,linkPasskey:y}=se(pe);return r("linkAccount",e),{linkEmail:t,linkPhone:o,linkWallet:i,linkGoogle:a,linkApple:s,linkTwitter:n,linkDiscord:l,linkGithub:c,linkLinkedIn:u,linkTiktok:d,linkLine:h,linkSpotify:w,linkInstagram:p,linkFarcaster:g,linkTelegram:m,linkPasskey:y}}function Be(e){let{updateEmail:t,updatePhone:o}=se(pe);return r("update",e),{updateEmail:t,updatePhone:o}}const Ge=e=>{let{user:t}=we(),{loginWithCode:r,emailOtpState:o,setEmailOtpState:i,client:a,inProgressAuthFlowRef:s,inProgressLoginOrLinkMethodRef:n}=de();return{state:o,sendCode:oe((async({newEmailAddress:r})=>{try{if(!t?.email)throw Error("User is required to have an email address to update it.");let e=new d(t.email.address,r);a.startAuthFlow(e),await e.sendCodeEmail({withPrivyUi:!1})}catch(r){i({status:"error",error:r}),e?.onError?.(r.privyErrorCode||ue.UNKNOWN_AUTH_ERROR,{linkMethod:"email"})}}),[t?.email]),verifyCode:oe((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||ue.UNKNOWN_AUTH_ERROR,{linkMethod:"email"})}}),[t?.email])}},Qe=()=>{let{connectCoinbaseSmartWallet:e}=de();return{connectCoinbaseSmartWallet:e}},Xe={component:()=>{let{user:e}=we(),{data:t}=h(),[r,o]=ne(e?.mfaMethods[0]),[i,a]=ne(!1),[s,n]=ne(),[l,c]=ne();if(ae((()=>{o(e?.mfaMethods[0])}),[e?.mfaMethods]),!t?.mfaVerify)throw Error("Missing modal data for MFA verification screen.");let{onFailure:u,onSuccess:d,generateOptions:g,verifyTotpCode:A,verifyPasskey:f,verifySmsCode:k,sendSmsCode:C}=t.mfaVerify,E=async e=>{if("passkey"!==e)try{o(e),"sms"===e&&(o(e),await C()),"totp"===e&&o(e)}catch(e){console.error(e)}else try{o(e);let t=await g();if(!t)throw Error("something went wrong");n(t),await f(t),a(!0),c(void 0),d()}catch(e){c(y(e))}},v=async e=>{c(void 0);try{if(!e||!r)return;if("passkey"===r){if(!s)throw Error("Missing passkey challenge");await f(s)}else"sms"===r?await k(e):"totp"===r&&await A(e);c(void 0),a(!0),d()}catch(e){throw y(e).error}},S=()=>{l||!i?u(l?.error??Error("Canceled MFA verification.")):d()},I=le(!1);return ae((()=>{!I.current&&r&&(I.current=!0,E(r).finally((()=>{I.current=!1})))}),[open]),e?"passkey"===r?/*#__PURE__*/ve(w,{account:e.linkedAccounts.filter((e=>"passkey"===e.type&&e.enrolledInMfa)).sort(((e,t)=>t.firstVerifiedAt.valueOf()-e.firstVerifiedAt.valueOf()))[0],submitSuccess:i,hasBlockingError:l?.isBlocking??!1,error:l?.error,onClose:S,onBack:()=>{o(void 0),c(void 0)},handleSubmit:()=>v(s).catch(c)}):"sms"===r||"totp"===r?/*#__PURE__*/ve(p,{selectedMethod:r,submitSuccess:i,hasBlockingError:l?.isBlocking??!1,handleSubmitCode:v,onClose:S,onBack:e.mfaMethods.length>1?()=>o(void 0):void 0}):/*#__PURE__*/ve(m,{user:e,onSelect:E,handleClose:S}):null}},Je=()=>{let{setModalData:e}=h(),{openModal:t,privy:r,closePrivyModal:o}=de(),{user:i}=we();return ie((()=>({verify:async()=>new Promise(((a,s)=>i?0===i.mfaMethods.length?a():(e({mfaVerify:{onSuccess:async()=>{await o({shouldCallAuthOnSuccess:!1,isSuccess:!0}),a()},onFailure:async e=>{await o({shouldCallAuthOnSuccess:!1,isSuccess:!1}),s(e)},sendSmsCode:async()=>{throw Error("Not enabled")},verifySmsCode:async()=>{throw Error("Not enabled")},verifyTotpCode:async e=>{await r.fetchPrivyRoute(ke,{body:{code:e}})},generateOptions:async()=>f((await r.fetchPrivyRoute(Ce,{body:{}})).options),verifyPasskey:async e=>{let t=await import("@simplewebauthn/browser"),o=await t.startAuthentication(e);await r.fetchPrivyRoute(Ee,{body:{authenticator_response:k(o)}})}}}),void t(Xe)):s(Error("Must be logged in to verify MFA"))))})),[r,e,t,o])},Ye=()=>{let{startCrossAppAuthFlow:e,unlinkCrossAppAccount:t,signMessageWithCrossAppWallet:r,signTypedDataWithCrossAppWallet:o,sendTransactionWithCrossAppWallet:i}=we();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 Ze(e){let{sendTransaction:t}=se(pe);return r("sendTransaction",e),{sendTransaction:t}}function $e(e){let{setWalletPassword:t}=se(pe);return r("setWalletPassword",e),{setWalletPassword:t}}function et(){let e=C(),{getAccessToken:t}=we(),r=v(),{client:o,setUser:i,setAuthenticated:a,setIsNewUser:s,initializeWalletProxy:n}=de(),{create:l}=W();return{createGuestAccount:async()=>{if(!e.id||!o)throw Error("SDK not yet ready");o.startAuthFlow(new U(e.id));try{let c=await o.authenticate(),u=c.user,d=c.isNewUser??!1;if(!u)throw new ce("Unable to authenticate guest account");let h=await t(),w=await n(_);if(h&&w)try{let t=x(u,e.embeddedWallets.ethereum.createOnLogin),r=z(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||ue.UNKNOWN_AUTH_ERROR),e}}}}function tt(e){let{setWalletRecovery:t}=se(pe);return r("setWalletRecovery",e),{setWalletRecovery:t}}function rt(e){let{signMessage:t}=se(pe);return r("signMessage",e),{signMessage:t}}const ot=()=>{let{ready:e,wallets:t}=V(),{user:r}=we(),{rpcConfig:o,chains:i,appId:a}=de();return{signAuthorization:oe((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??me(r)?.address??Se,u=t.find((e=>Ie(e.address)===Ie(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=We({account:c,chain:e,transport:Ue(j(e,o,a))});l=await t.prepareAuthorization({...s})}let h=await u.getEthereumProvider(),w=await h.request({method:"secp256k1_sign",params:[Re(l)]});return{...l,...Te(w)}}),[e,t,r,i])}},it=ot;function at(e){let{signTypedData:t}=se(pe);return r("signTypedData",e),{signTypedData:t}}const st=()=>{let{isModalOpen:e}=se(pe);return{isOpen:e}};function nt(e){let{getAccessToken:t}=se(pe);return r("accessToken",e),{getAccessToken:t}}function lt(e){let{authenticated:t,user:o}=we(),{initLoginWithOAuth:i}=de(),a=v();return r("oAuthAuthorization",e),{reauthorize:e=>ct(t,o,i,a,e.provider)}}let ct=async(e,t,r,o,i)=>{if(!e)throw o("linkAccount","onError",ue.MUST_BE_AUTHENTICATED,{linkMethod:i}),new ce("User must be authenticated before linking an account.");if(!t?.linkedAccounts.some((e=>e.type.includes(i))))throw new ce(`OAuth account of type ${i} not linked to the account.`);await r(i)};function ut(e){let{client:t}=de(),[r,o]=ne({status:"initial"});return{linkWithCustomJwt:oe((async r=>{try{o({status:"initial"}),t.startAuthFlow(new q(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||ue.UNKNOWN_AUTH_ERROR,{linkMethod:"custom"}),r}}),[t.startAuthFlow,t.link]),state:r}}const dt=e=>{let t=G();return r("customAuth",e),{status:t}};function ht({isAuthenticated:e,isLoading:t,...r}){let o=le();ae((()=>{t||o.current?.()}),[e,t]);let i=oe((e=>(o.current=e,()=>{o.current=void 0})),[]);return $({...r,subscribe:i})}function wt(){let{getFarcasterSignerPublicKey:e,signFarcasterMessage:t,requestFarcasterSignerFromWarpcast:r}=we();return{getFarcasterSignerPublicKey:e,signFarcasterMessage:t,requestFarcasterSignerFromWarpcast:r}}const pt=()=>{let{revokeDelegatedWallets:e,delegateWallet:t}=de();return{delegateWallet:async({address:e,chainType:r})=>await t({address:e,chainType:r,showDelegationUIs:!0}),revokeWallets:async()=>await e({showDelegationUIs:!0})}},mt=()=>{let{addSessionSignersInternal:e,removeSessionSignersInternal:t}=(()=>{let{getAccessToken:e,user:t}=we(),r=de(),{signWithUserSigner:o}=ge(),i=async({wallet:i,additional_signers:a})=>{let s=await e();if(!t||!s)throw new ce("User must be authenticated and have an embedded wallet to delegate actions.");if(!i.id)throw new ce("Wallet to add signers to must have ID on server");if(!r.walletProxy)throw new ce("Wallet proxy not initialized.");await be(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 ce("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 ce("Wallet proxy not initialized.");let l=ye(t,o);if(!l)throw new ce("Address to add signers too is not associated with current user.");if(Ae(l)){if(0===a.length)throw new ce("Must specify at least one signer to add.");let e=[...(await Pe(r.privy,{wallet_id:l.id})).additional_signers,...ee(a)];await i({wallet:l,additional_signers:e})}else{if(l.delegated)return{user:t};if(a.length>0)throw new ce("Specifying signers in addSessionSigners is only supported for TEE execution and this app uses On-device execution. Pass an empty array for signers instead. Learn more https://docs.privy.io/recipes/tee-wallet-migration-guide");let e=te({address:o,user:t}),i=re({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 ce("User must be authenticated and have an embedded wallet to delegate actions.");if(!(r.walletProxy??await r.initializeWalletProxy(15e3)))throw new ce("Wallet proxy not initialized.");let s=ye(t,o);if(!s)throw new ce("Address to remove signers from is not associated with current user.");Ae(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})}},gt=()=>{let{signWithUserSigner:e}=ge();return ie((()=>({async generateAuthorizationSignature(t){let{signature:r}=await Ne(e,t);return{signature:r}}})),[e])},yt=()=>{let{setUser:e,client:t}=se(he),{user:r}=se(pe);return{user:r,refreshUser:oe((async()=>{let r=await(t?.updateUserAndIdToken());return e(r??null),r}),[t,e])}},At=e=>{let t=o(),{initLoginWithTelegram:r,loginWithTelegram:i,telegramAuthState:a,setTelegramAuthState:n}=de();return{login:oe((async o=>{try{if(t.enabled&&"success"!==t.status)throw new s(t.error,null,ue.CAPTCHA_FAILURE);await r(t.token,o?.disableSignup);let{user:a,isNewUser:n,loginAccount:l,wasAlreadyAuthenticated:c}=await i({intent:"login"});e?.onComplete?.({user:a,isNewUser:n,wasAlreadyAuthenticated:c,loginMethod:"telegram",loginAccount:l})}catch(o){throw n({status:"error",error:o}),e?.onError?.(o.privyErrorCode||ue.UNKNOWN_AUTH_ERROR),o}}),[r,i,t]),state:a}},ft=()=>{let{revokeDelegatedWallets:e,delegateWallet:t}=de();return{delegateWallet:async({address:e,chainType:r})=>await t({address:e,chainType:r,showDelegationUIs:!1}),revokeWallets:async()=>await e({showDelegationUIs:!1})}};export{Je as useAuthMfa,gt as useAuthorizationSignature,Qe as useConnectCoinbaseSmartWallet,Ke as useConnectOrCreateWallet,Ye as useCrossAppAccounts,dt as useCustomAuth,pt as useDelegatedActions,wt as useFarcasterSigner,et as useGuestAccounts,ft as useHeadlessDelegatedActions,qe as useLinkAccount,ut as useLinkJwtAccount,De as useLinkWithPasskey,ze as useLinkWithSiwe,Fe as useLoginWithEmail,Me as useLoginWithFarcasterV2,_e as useLoginWithOAuth,He as useLoginWithPasskey,Ve as useLoginWithSiwe,xe as useLoginWithSms,At as useLoginWithTelegram,st as useModalStatus,lt as useOAuthTokens,Oe as useRecoverEmbeddedWallet,Ze as useSendTransaction,mt as useSessionSigners,$e as useSetWalletPassword,tt as useSetWalletRecovery,ot as useSign7702Authorization,it as useSignAuthorization,rt as useSignMessage,je as useSignTransaction,at as useSignTypedData,Le as useSignupWithPasskey,ht as useSubscribeToJwtAuthWithFlag,$ as useSyncJwtBasedAuthState,nt as useToken,Be as useUpdateAccount,Ge as useUpdateEmail,yt as useUser,V as useWallets};