@privy-io/react-auth 2.10.0 → 2.11.0-beta-20250424021159
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/abstract-smart-wallets.js +1 -1
- package/dist/cjs/farcaster.js +1 -1
- package/dist/cjs/{frame-BE5iw8D5.js → frame-Cjm2A_Kg.js} +1 -1
- package/dist/cjs/index.js +1 -1
- package/dist/cjs/internal-context-MaZRiWRJ.js +1 -0
- package/dist/cjs/privy-provider-CKXpJjKU.js +28 -0
- package/dist/cjs/{smart-wallets-qD-P9gIh.js → smart-wallets-BDFeGI4n.js} +1 -1
- package/dist/cjs/smart-wallets.js +1 -1
- package/dist/cjs/solana.js +1 -1
- package/dist/cjs/ui.js +1 -1
- package/dist/cjs/{useActiveWallet-D-7Wli-E.js → useActiveWallet-DYXyIUwl.js} +1 -1
- package/dist/cjs/{useFundWallet-lvAux3ho.js → useFundWallet-BSTSLS88.js} +1 -1
- package/dist/dts/index.d.mts +50 -1
- package/dist/dts/index.d.ts +50 -1
- package/dist/esm/abstract-smart-wallets.mjs +1 -1
- package/dist/esm/farcaster.mjs +1 -1
- package/dist/esm/{frame-DTkUHpPA.mjs → frame-BeG8p5X6.mjs} +1 -1
- package/dist/esm/index.mjs +1 -1
- package/dist/esm/{internal-context-D5bEplez.mjs → internal-context-eu0bC04Q.mjs} +1 -1
- package/dist/esm/privy-provider-Db2seOwT.mjs +28 -0
- package/dist/esm/{smart-wallets-CB0UaeGE.mjs → smart-wallets-1_hEGsxD.mjs} +1 -1
- package/dist/esm/smart-wallets.mjs +1 -1
- package/dist/esm/solana.mjs +1 -1
- package/dist/esm/ui.mjs +1 -1
- package/dist/esm/{useActiveWallet-CGwRepnm.mjs → useActiveWallet-ChXrfJFe.mjs} +1 -1
- package/dist/esm/{useFundWallet-WrqNttW5.mjs → useFundWallet-ByYy4oa1.mjs} +1 -1
- package/package.json +3 -3
- package/dist/cjs/internal-context-GxD_jR-e.js +0 -1
- package/dist/cjs/privy-provider-BivyFPW2.js +0 -28
- package/dist/esm/privy-provider-L7_Cz9Ka.mjs +0 -28
package/dist/dts/index.d.mts
CHANGED
|
@@ -3084,6 +3084,55 @@ type UseLinkWithSiwe = {
|
|
|
3084
3084
|
*/
|
|
3085
3085
|
declare const useLinkWithSiwe: (callbacks?: PrivyEvents["linkAccount"]) => UseLinkWithSiwe;
|
|
3086
3086
|
|
|
3087
|
+
type UseLoginWithSiwe = {
|
|
3088
|
+
/**
|
|
3089
|
+
* Given an external wallet address and chain ID, creates a EIP-4361 message for signing.
|
|
3090
|
+
* To be used for a SIWE implementation without Privy UIs
|
|
3091
|
+
*
|
|
3092
|
+
* @param opts options for generating a SIWE message for
|
|
3093
|
+
* @param opts.address {string} EIP-55 mixed-case checksum-encoded address performing the signing.
|
|
3094
|
+
* @param opts.chainId {string} EIP-155 Chain ID to which the session is bound
|
|
3095
|
+
* @returns {string} EIP-4361 message for signing.
|
|
3096
|
+
*/
|
|
3097
|
+
generateSiweMessage: ({ address, chainId, disableSignup, }: {
|
|
3098
|
+
address: string;
|
|
3099
|
+
chainId: `eip155:${number}`;
|
|
3100
|
+
disableSignup?: boolean;
|
|
3101
|
+
}) => Promise<string>;
|
|
3102
|
+
/**
|
|
3103
|
+
* Given an external wallet address, generates a nonce for signing.
|
|
3104
|
+
* This method is for lower level SIWE implementations - you must format
|
|
3105
|
+
* the nonce into an EIP-4361 compatible message for signing.
|
|
3106
|
+
*
|
|
3107
|
+
* @param opts options for generating a SIWE nonce
|
|
3108
|
+
* @param opts.address {string} EIP-55 mixed-case checksum-encoded address performing the signing.
|
|
3109
|
+
* @param opts.disableSignup {boolean} whether to disable signup for the user
|
|
3110
|
+
* @returns {string} nonce for signing.
|
|
3111
|
+
*/
|
|
3112
|
+
generateSiweNonce: ({ address, disableSignup, }: {
|
|
3113
|
+
address: string;
|
|
3114
|
+
disableSignup?: boolean;
|
|
3115
|
+
}) => Promise<string>;
|
|
3116
|
+
/**
|
|
3117
|
+
* Log a user in with a SIWE message and signature.
|
|
3118
|
+
*
|
|
3119
|
+
* @param opts options for verifying a signature for a SIWE message
|
|
3120
|
+
* @param opts.signature {string} The EIP-191 signature corresponding to the message that the user had been given.
|
|
3121
|
+
* @param opts.message {string} EIP-4361 message for signing. Returned from the generateSiweMessage call
|
|
3122
|
+
* @returns The user response object.
|
|
3123
|
+
*/
|
|
3124
|
+
loginWithSiwe: ({ signature, message, disableSignup, }: {
|
|
3125
|
+
signature: string;
|
|
3126
|
+
message: string;
|
|
3127
|
+
disableSignup?: boolean;
|
|
3128
|
+
}) => Promise<User>;
|
|
3129
|
+
/**
|
|
3130
|
+
* The current state of the SIWE link operation
|
|
3131
|
+
*/
|
|
3132
|
+
state: SiweFlowState;
|
|
3133
|
+
};
|
|
3134
|
+
declare const useLoginWithSiwe: (callbacks?: PrivyEvents["login"]) => UseLoginWithSiwe;
|
|
3135
|
+
|
|
3087
3136
|
/**
|
|
3088
3137
|
* Use this hook to sign a transaction using the embedded wallet.
|
|
3089
3138
|
*
|
|
@@ -3889,4 +3938,4 @@ declare const LoginModal: ({ open }: {
|
|
|
3889
3938
|
open: boolean;
|
|
3890
3939
|
}) => react_jsx_runtime.JSX.Element;
|
|
3891
3940
|
|
|
3892
|
-
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 UseConnectCoinbaseSmartWalletInterface, type UseCustomAuth, type UseDelegatedActionsInterface, type UseFundWalletInterface, type UseImportWalletInterface, type UseLinkWithPasskey, type UseLoginWithEmail, type UseLoginWithPasskey, type UseLoginWithSms, type UseLoginWithTelegram, type UseOAuthTokens, type UseRecoverEmbeddedWalletInterface, type UseSignupWithPasskey, type UseSubscribeToJwtAuthWithFlagInput, type UseSyncJwtBasedAuthStateInput, type UseSyncJwtBasedAuthStateInterface, type UseWalletsInterface, User, VERSION, Wallet, WalletConnector, WalletListEntry, errorIndicatesMaxMfaRetries, errorIndicatesMfaTimeout, errorIndicatesMfaVerificationFailed, getCustomerAccessToken as getAccessToken, getEmbeddedConnectedWallet, useActiveWallet, useConnectCoinbaseSmartWallet, useConnectOrCreateWallet, useConnectWallet, useCreateWallet, useCrossAppAccounts, useCustomAuth, useDelegatedActions, useFarcasterSigner, useFundWallet, useGuestAccounts, useHeadlessDelegatedActions, useIdentityToken, useImportWallet, useLinkAccount, useLinkWithPasskey, useLinkWithSiwe, useLogin, useLoginWithEmail, useLoginWithFarcasterV2, useLoginWithOAuth, useLoginWithPasskey, useLoginWithSms, useLoginWithTelegram, useLogout, useMfa, useMfaEnrollment, useModalStatus, useOAuthTokens, usePrivy, useRecoverEmbeddedWallet, useRegisterMfaListener, useSendTransaction, useSetWalletPassword, useSetWalletRecovery, useSignAuthorization, useSignMessage, useSignTransaction, useSignTypedData, useSignupWithPasskey, useSubscribeToJwtAuthWithFlag, useSyncJwtBasedAuthState, useToken, useUpdateAccount, useUser, useWallets };
|
|
3941
|
+
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 UseConnectCoinbaseSmartWalletInterface, type UseCustomAuth, type UseDelegatedActionsInterface, type UseFundWalletInterface, type UseImportWalletInterface, type UseLinkWithPasskey, type UseLoginWithEmail, type UseLoginWithPasskey, type UseLoginWithSms, type UseLoginWithTelegram, type UseOAuthTokens, type UseRecoverEmbeddedWalletInterface, type UseSignupWithPasskey, type UseSubscribeToJwtAuthWithFlagInput, type UseSyncJwtBasedAuthStateInput, type UseSyncJwtBasedAuthStateInterface, type UseWalletsInterface, User, VERSION, Wallet, WalletConnector, WalletListEntry, errorIndicatesMaxMfaRetries, errorIndicatesMfaTimeout, errorIndicatesMfaVerificationFailed, getCustomerAccessToken as getAccessToken, getEmbeddedConnectedWallet, useActiveWallet, useConnectCoinbaseSmartWallet, useConnectOrCreateWallet, useConnectWallet, useCreateWallet, useCrossAppAccounts, useCustomAuth, useDelegatedActions, useFarcasterSigner, useFundWallet, useGuestAccounts, useHeadlessDelegatedActions, useIdentityToken, useImportWallet, useLinkAccount, useLinkWithPasskey, useLinkWithSiwe, useLogin, useLoginWithEmail, useLoginWithFarcasterV2, useLoginWithOAuth, useLoginWithPasskey, useLoginWithSiwe, useLoginWithSms, useLoginWithTelegram, useLogout, useMfa, useMfaEnrollment, useModalStatus, useOAuthTokens, usePrivy, useRecoverEmbeddedWallet, useRegisterMfaListener, useSendTransaction, useSetWalletPassword, useSetWalletRecovery, useSignAuthorization, useSignMessage, useSignTransaction, useSignTypedData, useSignupWithPasskey, useSubscribeToJwtAuthWithFlag, useSyncJwtBasedAuthState, useToken, useUpdateAccount, useUser, useWallets };
|
package/dist/dts/index.d.ts
CHANGED
|
@@ -3084,6 +3084,55 @@ type UseLinkWithSiwe = {
|
|
|
3084
3084
|
*/
|
|
3085
3085
|
declare const useLinkWithSiwe: (callbacks?: PrivyEvents["linkAccount"]) => UseLinkWithSiwe;
|
|
3086
3086
|
|
|
3087
|
+
type UseLoginWithSiwe = {
|
|
3088
|
+
/**
|
|
3089
|
+
* Given an external wallet address and chain ID, creates a EIP-4361 message for signing.
|
|
3090
|
+
* To be used for a SIWE implementation without Privy UIs
|
|
3091
|
+
*
|
|
3092
|
+
* @param opts options for generating a SIWE message for
|
|
3093
|
+
* @param opts.address {string} EIP-55 mixed-case checksum-encoded address performing the signing.
|
|
3094
|
+
* @param opts.chainId {string} EIP-155 Chain ID to which the session is bound
|
|
3095
|
+
* @returns {string} EIP-4361 message for signing.
|
|
3096
|
+
*/
|
|
3097
|
+
generateSiweMessage: ({ address, chainId, disableSignup, }: {
|
|
3098
|
+
address: string;
|
|
3099
|
+
chainId: `eip155:${number}`;
|
|
3100
|
+
disableSignup?: boolean;
|
|
3101
|
+
}) => Promise<string>;
|
|
3102
|
+
/**
|
|
3103
|
+
* Given an external wallet address, generates a nonce for signing.
|
|
3104
|
+
* This method is for lower level SIWE implementations - you must format
|
|
3105
|
+
* the nonce into an EIP-4361 compatible message for signing.
|
|
3106
|
+
*
|
|
3107
|
+
* @param opts options for generating a SIWE nonce
|
|
3108
|
+
* @param opts.address {string} EIP-55 mixed-case checksum-encoded address performing the signing.
|
|
3109
|
+
* @param opts.disableSignup {boolean} whether to disable signup for the user
|
|
3110
|
+
* @returns {string} nonce for signing.
|
|
3111
|
+
*/
|
|
3112
|
+
generateSiweNonce: ({ address, disableSignup, }: {
|
|
3113
|
+
address: string;
|
|
3114
|
+
disableSignup?: boolean;
|
|
3115
|
+
}) => Promise<string>;
|
|
3116
|
+
/**
|
|
3117
|
+
* Log a user in with a SIWE message and signature.
|
|
3118
|
+
*
|
|
3119
|
+
* @param opts options for verifying a signature for a SIWE message
|
|
3120
|
+
* @param opts.signature {string} The EIP-191 signature corresponding to the message that the user had been given.
|
|
3121
|
+
* @param opts.message {string} EIP-4361 message for signing. Returned from the generateSiweMessage call
|
|
3122
|
+
* @returns The user response object.
|
|
3123
|
+
*/
|
|
3124
|
+
loginWithSiwe: ({ signature, message, disableSignup, }: {
|
|
3125
|
+
signature: string;
|
|
3126
|
+
message: string;
|
|
3127
|
+
disableSignup?: boolean;
|
|
3128
|
+
}) => Promise<User>;
|
|
3129
|
+
/**
|
|
3130
|
+
* The current state of the SIWE link operation
|
|
3131
|
+
*/
|
|
3132
|
+
state: SiweFlowState;
|
|
3133
|
+
};
|
|
3134
|
+
declare const useLoginWithSiwe: (callbacks?: PrivyEvents["login"]) => UseLoginWithSiwe;
|
|
3135
|
+
|
|
3087
3136
|
/**
|
|
3088
3137
|
* Use this hook to sign a transaction using the embedded wallet.
|
|
3089
3138
|
*
|
|
@@ -3889,4 +3938,4 @@ declare const LoginModal: ({ open }: {
|
|
|
3889
3938
|
open: boolean;
|
|
3890
3939
|
}) => react_jsx_runtime.JSX.Element;
|
|
3891
3940
|
|
|
3892
|
-
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 UseConnectCoinbaseSmartWalletInterface, type UseCustomAuth, type UseDelegatedActionsInterface, type UseFundWalletInterface, type UseImportWalletInterface, type UseLinkWithPasskey, type UseLoginWithEmail, type UseLoginWithPasskey, type UseLoginWithSms, type UseLoginWithTelegram, type UseOAuthTokens, type UseRecoverEmbeddedWalletInterface, type UseSignupWithPasskey, type UseSubscribeToJwtAuthWithFlagInput, type UseSyncJwtBasedAuthStateInput, type UseSyncJwtBasedAuthStateInterface, type UseWalletsInterface, User, VERSION, Wallet, WalletConnector, WalletListEntry, errorIndicatesMaxMfaRetries, errorIndicatesMfaTimeout, errorIndicatesMfaVerificationFailed, getCustomerAccessToken as getAccessToken, getEmbeddedConnectedWallet, useActiveWallet, useConnectCoinbaseSmartWallet, useConnectOrCreateWallet, useConnectWallet, useCreateWallet, useCrossAppAccounts, useCustomAuth, useDelegatedActions, useFarcasterSigner, useFundWallet, useGuestAccounts, useHeadlessDelegatedActions, useIdentityToken, useImportWallet, useLinkAccount, useLinkWithPasskey, useLinkWithSiwe, useLogin, useLoginWithEmail, useLoginWithFarcasterV2, useLoginWithOAuth, useLoginWithPasskey, useLoginWithSms, useLoginWithTelegram, useLogout, useMfa, useMfaEnrollment, useModalStatus, useOAuthTokens, usePrivy, useRecoverEmbeddedWallet, useRegisterMfaListener, useSendTransaction, useSetWalletPassword, useSetWalletRecovery, useSignAuthorization, useSignMessage, useSignTransaction, useSignTypedData, useSignupWithPasskey, useSubscribeToJwtAuthWithFlag, useSyncJwtBasedAuthState, useToken, useUpdateAccount, useUser, useWallets };
|
|
3941
|
+
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 UseConnectCoinbaseSmartWalletInterface, type UseCustomAuth, type UseDelegatedActionsInterface, type UseFundWalletInterface, type UseImportWalletInterface, type UseLinkWithPasskey, type UseLoginWithEmail, type UseLoginWithPasskey, type UseLoginWithSms, type UseLoginWithTelegram, type UseOAuthTokens, type UseRecoverEmbeddedWalletInterface, type UseSignupWithPasskey, type UseSubscribeToJwtAuthWithFlagInput, type UseSyncJwtBasedAuthStateInput, type UseSyncJwtBasedAuthStateInterface, type UseWalletsInterface, User, VERSION, Wallet, WalletConnector, WalletListEntry, errorIndicatesMaxMfaRetries, errorIndicatesMfaTimeout, errorIndicatesMfaVerificationFailed, getCustomerAccessToken as getAccessToken, getEmbeddedConnectedWallet, useActiveWallet, useConnectCoinbaseSmartWallet, useConnectOrCreateWallet, useConnectWallet, useCreateWallet, useCrossAppAccounts, useCustomAuth, useDelegatedActions, useFarcasterSigner, useFundWallet, useGuestAccounts, useHeadlessDelegatedActions, useIdentityToken, useImportWallet, useLinkAccount, useLinkWithPasskey, useLinkWithSiwe, useLogin, useLoginWithEmail, useLoginWithFarcasterV2, useLoginWithOAuth, useLoginWithPasskey, useLoginWithSiwe, useLoginWithSms, useLoginWithTelegram, useLogout, useMfa, useMfaEnrollment, useModalStatus, useOAuthTokens, usePrivy, useRecoverEmbeddedWallet, useRegisterMfaListener, useSendTransaction, useSetWalletPassword, useSetWalletRecovery, useSignAuthorization, useSignMessage, useSignTransaction, useSignTypedData, useSignupWithPasskey, useSubscribeToJwtAuthWithFlag, useSyncJwtBasedAuthState, useToken, useUpdateAccount, useUser, useWallets };
|
|
@@ -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,f as l,l as d,an as m,m as p,a as u,av as h,aw as I,ax as g,n as y}from"./privy-provider-
|
|
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,f as l,l as d,an as m,m as p,a as u,av as h,aw as I,ax as g,n as y}from"./privy-provider-Db2seOwT.mjs";import{u as f}from"./internal-context-eu0bC04Q.mjs";import{g as v}from"./getEmbeddedConnectedWallet-CSSBWE2p.mjs";import{c as w}from"./smart-wallets-1_hEGsxD.mjs";import"react/jsx-runtime";import"mipd";import"react";import"react-device-detect";import"viem/utils";import"@privy-io/js-sdk-core";import"uuid";import"jose";import"eventemitter3";import"@coinbase/wallet-sdk";import"@marsidev/react-turnstile";import"styled-components";import"tinycolor2";import"@heroicons/react/24/outline/DevicePhoneMobileIcon";import"@heroicons/react/24/outline/FingerPrintIcon";import"@heroicons/react/24/outline/PhoneIcon";import"@heroicons/react/24/outline/ShieldCheckIcon";import"@heroicons/react/24/outline/ArrowLeftIcon";import"@heroicons/react/24/outline/ArrowRightIcon";import"@heroicons/react/24/outline/QuestionMarkCircleIcon";import"@heroicons/react/24/outline/XMarkIcon";import"@heroicons/react/24/outline/ChevronDownIcon";import"@heroicons/react/24/outline/CalendarIcon";import"@heroicons/react/24/outline/ExclamationTriangleIcon";import"@headlessui/react";import"@walletconnect/ethereum-provider";import"zustand";import"fast-password-entropy";import"secure-password-utilities";import"secure-password-utilities/wordlists";import"@heroicons/react/24/outline/UserCircleIcon";import"@heroicons/react/24/outline/EnvelopeIcon";import"@heroicons/react/20/solid/CheckIcon";import"@heroicons/react/24/outline/WalletIcon";import"@heroicons/react/24/outline/CheckIcon";import"@heroicons/react/24/outline/Square2StackIcon";import"@heroicons/react/24/outline/ExclamationCircleIcon";import"@heroicons/react/24/outline/ArrowTopRightOnSquareIcon";import"@heroicons/react/24/solid/DocumentCheckIcon";import"@heroicons/react/24/solid/XCircleIcon";import"@heroicons/react/24/solid/CheckCircleIcon";import"qrcode";import"@heroicons/react/24/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/solid/ArrowsRightLeftIcon";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";import"permissionless";import"permissionless/accounts";import"permissionless/clients/pimlico";import"viem/account-abstraction";function C(){let{user:C}=s(),{hideWalletUIs:T,openPrivyModal:P,chains:S,appId:b,rpcConfig:A,client:M}=f(),k=l(),{wallets:F}=d(),{setModalData:W}=m(),x=p(C),E=async(o=c.id)=>{let s=v(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=S.find((e=>e.id===l));if(!d)throw Error("Chain not configured");await s.switchChain(d.id);let m=await s.getEthereumProvider(),p=t({account:s.address,transport:n(m)}),u=a({address:s.address,signMessage:p.signMessage,signTransaction:p.signTransaction,signTypedData:p.signTypedData});return await e({chain:d,transport:i(y(d,A,b)),publicTransport:i(y(d,A,b)),signer:u})};return{signMessage:async({message:e},o)=>{let r=await E(o);return new Promise((async(o,t)=>{let{entropyId:n,entropyIdVerifier:i}=u(C);T.current=!0,W({connectWallet:{recoveryMethod:x.recoveryMethod,connectingWalletAddress:x.address,entropyId:n,entropyIdVerifier:i,onCompleteNavigateTo:h,onFailure:()=>{}},signMessage:{method:"personal_sign",data:e,confirmAndSign:()=>r.signMessage({message:e}),onSuccess:e=>o(e),onFailure:t,uiOptions:{isCancellable:!0}}}),P(I)})).finally((()=>{T.current=!1}))},signTypedData:async(e,o)=>{let r=await E(o);return new Promise((async(o,t)=>{T.current=!0;let{entropyId:n,entropyIdVerifier:i}=u(C);W({connectWallet:{recoveryMethod:x.recoveryMethod,connectingWalletAddress:x.address,entropyId:n,entropyIdVerifier:i,onCompleteNavigateTo:h,onFailure:()=>{}},signMessage:{method:"eth_signTypedData_v4",data:e,confirmAndSign:()=>r.signTypedData(e),onSuccess:e=>o(e),onFailure:t,uiOptions:{isCancellable:!0}}}),P(I)})).finally((()=>{T.current=!1}))},sendTransaction:async e=>{let r=await E(e.chainId),t=[],n="calls"in e&&void 0!==e.calls;return t=n?[...e.calls]:[e],new Promise((async(i,a)=>{T.current=!0;let{entropyId:c,entropyIdVerifier:s}=u(C);W({connectWallet:{recoveryMethod:x.recoveryMethod,connectingWalletAddress:x.address,entropyId:c,entropyIdVerifier:s,onCompleteNavigateTo:g,onFailure:()=>{}},sendTransaction:{transactionRequests:w({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,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:i.chainId.toString(),request:{method:"eth_sendTransaction",params:[{from:i.from,to:i.to,value:i.value?.toString(),gas:i.gas?.toString(),gasPrice:i.gasPrice?.toString(),nonce:i.nonce?.toString(),data:i.data,eip_712_meta:{paymaster_params:{paymaster:i.paymaster,paymaster_input:i.paymasterInput}}}]}})},signOnly:!1,getIsSponsored:async()=>void 0!==e.paymaster&&void 0!==e.paymasterInput,onConfirm:()=>n?r.sendTransactionBatch(e):r.sendTransaction(e),onSuccess:e=>i(e.hash),onFailure:a,uiOptions:{isCancellable:!0}}}),P(I)})).finally((()=>{T.current=!1}))},signTransaction:async e=>{let r=await E(e.chainId),t=[],n="calls"in e&&void 0!==e.calls;return t=n?[...e.calls]:[e],new Promise((async(i,a)=>{T.current=!0;let{entropyId:c,entropyIdVerifier:s}=u(C);W({connectWallet:{recoveryMethod:x.recoveryMethod,connectingWalletAddress:x.address,entropyId:c,entropyIdVerifier:s,onCompleteNavigateTo:g,onFailure:()=>{}},sendTransaction:{transactionRequests:w({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,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:i.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:()=>{if(!n)return r.signTransaction(e);throw Error("Batch transactions not supported for signing")},onSuccess:e=>i(e.hash),onFailure:a,uiOptions:{isCancellable:!0}}}),P(I)})).finally((()=>{T.current=!1}))}}}export{C as useAbstractSmartWallets};
|
package/dist/esm/farcaster.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{useCallback as t}from"react";import{F as e}from"./frame-
|
|
1
|
+
import{useCallback as t}from"react";import{F as e}from"./frame-BeG8p5X6.mjs";import{u as i,P as r}from"./internal-context-eu0bC04Q.mjs";import"ofetch";const a=()=>{let{client:a,setAuthenticated:n,setUser:s}=i();return{initLoginToFrame:t((async()=>{let t=new e;if(!a)throw new r("Must initialize Privy client first.");return a.startAuthFlow(t),await t.init()}),[a]),loginToFrame:t((async({message:t,signature:i})=>{if(!a)throw new r("Must initialize Privy client first.");if(!(a.authFlow instanceof e))throw new r("Must initialize Farcaster frame flow first.");let o=(t=>{let e=t.match(/farcaster:\/\/fid\/(\d+)/);return e&&e[1]?parseInt(e[1],10):null})(t);if(!o)throw new r("Invalid message format; could not parse Farcaster ID.");a.authFlow.setAuthData({message:t,signature:i,fid:o});let{user:l}=await a.authenticate();return l&&(s(l),n(!0)),l}),[a,s,n])}};export{a as useLoginToFrame};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{P as t,am as s,an as i,f as e}from"./internal-context-
|
|
1
|
+
import{P as t,am as s,an as i,f as e}from"./internal-context-eu0bC04Q.mjs";class a{async init(){if(!this.api)throw new t("Auth flow has no API instance");let{nonce:i,expires_at:e}=await this.api.post(s,{});return{nonce:i,expiresAt:e}}async authenticate(){if(!this.message||!this.signature||!this.fid)throw new t("Auth flow has no message, signature, or fid");if(!this.api)throw new t("Auth flow has no API instance");try{let s=await this.api.post(i,{message:this.message,signature:this.signature,fid:this.fid});if(!s)throw new t("No response from authentication");return s}catch(t){throw e(t)}}async link(){throw Error("Not implemented")}setAuthData({message:t,signature:s,fid:i}){this.message=t,this.signature=s,this.fid=i}constructor(){this.meta={}}}export{a as F};
|
package/dist/esm/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{u as e,g as o,a as i,b as n,c as s,d as l,C as h,e as d,s as p,P as m,f as k,h as C,i as f,G as T,W,j as U,k as P,l as R,m as S,n as O,o as _,p as j}from"./privy-provider-L7_Cz9Ka.mjs";export{t as Captcha,v as ConnectorManager,E as EthereumWalletConnector,N as LoginModal,F as PrivyClient,q as PrivyProvider,V as VERSION,w as WalletConnector,B as errorIndicatesMaxMfaRetries,D as errorIndicatesMfaTimeout,A as errorIndicatesMfaVerificationFailed,r as getAccessToken,K as useCreateWallet,H as useIdentityToken,M as useImportWallet,I as useLogout,y as useMfa,z as useMfaEnrollment,x as usePrivy,J as useRegisterMfaListener,L as useSolanaWallets}from"./privy-provider-L7_Cz9Ka.mjs";import{useCallback as G,useMemo as Q,useEffect as X,useContext as $,useRef as Y}from"react";import{u as Z,P as ee,a as te,I as re}from"./internal-context-D5bEplez.mjs";export{c as useActiveWallet,a as useConnectWallet,b as useFundWallet,u as useLogin}from"./useActiveWallet-CGwRepnm.mjs";import{F as oe}from"./frame-DTkUHpPA.mjs";import{zeroAddress as ie,getAddress as ne,createWalletClient as ae,http as se,parseSignature as ce}from"viem";import{hashAuthorization as le}from"viem/utils";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"@marsidev/react-turnstile";import"styled-components";import"tinycolor2";import"@heroicons/react/24/outline/DevicePhoneMobileIcon";import"@heroicons/react/24/outline/FingerPrintIcon";import"@heroicons/react/24/outline/PhoneIcon";import"@heroicons/react/24/outline/ShieldCheckIcon";import"@heroicons/react/24/outline/ArrowLeftIcon";import"@heroicons/react/24/outline/ArrowRightIcon";import"@heroicons/react/24/outline/QuestionMarkCircleIcon";import"@heroicons/react/24/outline/XMarkIcon";import"@heroicons/react/24/outline/ChevronDownIcon";import"@heroicons/react/24/outline/CalendarIcon";import"@heroicons/react/24/outline/ExclamationTriangleIcon";import"@headlessui/react";import"@walletconnect/ethereum-provider";import"zustand";import"fast-password-entropy";import"secure-password-utilities";import"secure-password-utilities/wordlists";import"@heroicons/react/24/outline/UserCircleIcon";import"@heroicons/react/24/outline/EnvelopeIcon";import"@heroicons/react/20/solid/CheckIcon";import"@heroicons/react/24/outline/WalletIcon";import"@heroicons/react/24/outline/CheckIcon";import"@heroicons/react/24/outline/Square2StackIcon";import"@heroicons/react/24/outline/ExclamationCircleIcon";import"@heroicons/react/24/outline/ArrowTopRightOnSquareIcon";import"@heroicons/react/24/solid/DocumentCheckIcon";import"@heroicons/react/24/solid/XCircleIcon";import"@heroicons/react/24/solid/CheckCircleIcon";import"qrcode";import"@heroicons/react/24/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/solid/ArrowsRightLeftIcon";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 ue=()=>{let{user:t}=e(),{walletProxy:r}=Z();return{recover:G((async e=>{if(!r)throw Error("Wallet proxy is not ready");let n=await o();if(!t||!n)throw new ee("User must be logged in before attempting to modify the recovery method.");let{entropyId:a,entropyIdVerifier:s}=i(t);try{await r.recover({entropyId:a,entropyIdVerifier:s,accessToken:n,...e})}catch{throw new ee("Unable to recover wallets")}}),[r,t])}},he=()=>{let{client:e,setAuthenticated:t,setUser:r}=Z();return Q((()=>({init:async()=>{if(!e)throw new ee("Must initialize Privy client first.");let t=new oe;return e.startAuthFlow(t),await t.init()},login:async({fid:o,message:i,signature:n})=>{if(!e)throw new ee("Must initialize Privy client first.");if(!(e.authFlow instanceof oe))throw new ee("Must initialize Farcaster frame flow first.");e.authFlow.setAuthData({message:i,signature:n,fid:o});let{user:a}=await e.authenticate();if(!a)throw new ee("Failed to login with Farcaster V2");return r(a),t(!0),{user:a}}})),[e,r,t])},de=t=>{n("login",t);let r=s(),o=l(),{ready:i,user:a}=e(),{initLoginWithHeadlessOAuth:c,loginWithHeadlessOAuth:u,oAuthState:w,setOAuthState:m,isHeadlessOAuthLoading:g}=Z(),y=G((async e=>{try{if(r.enabled&&"success"!==r.status)throw new h(r.error,null,te.CAPTCHA_FAILURE);return await c(e.provider,r.token,e.disableSignup)}catch(e){throw m({status:"error",error:e}),e}}),[c,r]),A=G((async()=>{let e=d();try{if(a)return console.warn("Cannot login with OAuth when already logged in"),a;if(!e.inProgress)throw Error("Cannot login with OAuth because no OAuth flow is in progress");if(e.popupFlow)return}catch(e){throw m({status:"error",error:e}),e}try{return await u(e)}catch(e){throw m({status:"error",error:e}),e}finally{p()}}),[u]);return X((()=>{let e=d();i&&o&&e.inProgress&&!e.withPrivyUi&&!e.popupFlow&&A().catch((()=>{}))}),[i,o]),{initOAuth:y,loading:g,state:w}},pe=e=>{let t=s(),{emailOtpState:r,setEmailOtpState:o,initLoginWithEmail:i,loginWithCode:n}=Z();return{sendCode:G((async({email:r,disableSignup:n})=>{try{let e;if(!r)throw Error("Email required to send OTP code");if(t.enabled&&"error"===t.status)throw new h(t.error,null,te.CAPTCHA_FAILURE);return t.enabled&&"success"!==t.status&&(t.execute(),e=await t.waitForResult()),await i({email:r,captchaToken:e,disableSignup:n,withPrivyUi:!1})}catch(r){throw o({status:"error",error:r}),e?.onError?.(r.privyErrorCode||te.UNKNOWN_AUTH_ERROR),r}}),[i]),loginWithCode:G((async({code:r})=>{try{if(t.enabled&&"error"===t.status)throw new h(t.error,null,te.CAPTCHA_FAILURE);let{user:o,isNewUser:i,wasAlreadyAuthenticated:a,linkedAccount:s}=await n(r);e?.onComplete?.({user:o,isNewUser:i,wasAlreadyAuthenticated:a,loginMethod:"email",loginAccount:s})}catch(r){throw o({status:"error",error:r}),e?.onError?.(r.privyErrorCode||te.UNKNOWN_AUTH_ERROR),r}}),[n,t.status]),state:r}},we=e=>{let t=s(),{initSignupWithPasskey:r,signupWithPasskey:o,passkeyAuthState:i,setPasskeyAuthState:n}=Z();return{signupWithPasskey:G((async()=>{try{let i;if(t.enabled&&"error"===t.status)throw new h(t.error,null,te.CAPTCHA_FAILURE);t.enabled&&"success"!==t.status&&(t.execute(),i=await t.waitForResult()),await r({captchaToken:i,withPrivyUi:!1});let{user:n,isNewUser:a,wasAlreadyAuthenticated:s,loginAccount:c}=await o();e?.onComplete?.({user:n,isNewUser:a,wasAlreadyAuthenticated:s,loginMethod:"passkey",loginAccount:c})}catch(t){throw n({status:"error",error:t}),e?.onError?.(t.privyErrorCode||te.UNKNOWN_AUTH_ERROR),t}}),[o,t.status]),state:i}},me=e=>{let t=s(),{initLoginWithPasskey:r,loginWithPasskey:o,passkeyAuthState:i,setPasskeyAuthState:n}=Z();return{loginWithPasskey:G((async i=>{try{let n;if(t.enabled&&"error"===t.status)throw new h(t.error,null,te.CAPTCHA_FAILURE);t.enabled&&"success"!==t.status&&(t.execute(),n=await t.waitForResult()),await r({captchaToken:n,withPrivyUi:!1});let{user:a,isNewUser:s,wasAlreadyAuthenticated:c,loginAccount:l}=await o(i);e?.onComplete?.({user:a,isNewUser:s,wasAlreadyAuthenticated:c,loginMethod:"passkey",loginAccount:l})}catch(i){throw n({status:"error",error:i}),e?.onError?.(i.privyErrorCode||te.UNKNOWN_AUTH_ERROR),i}}),[o,t.status]),state:i}},ge=e=>{let{initLinkWithPasskey:t,linkWithPasskey:r,passkeyAuthState:o,setPasskeyAuthState:i}=Z();return{linkWithPasskey:G((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||te.UNKNOWN_AUTH_ERROR,{linkMethod:"passkey"}),t}}),[r]),state:o}},ye=e=>{let t=s(),{smsOtpState:r,setSmsOtpState:o,initLoginWithSms:i,loginWithCode:n}=Z();return{sendCode:G((async({phoneNumber:r,disableSignup:n})=>{try{let e;if(!r)throw Error("SMS required to send OTP code");if(t.enabled&&"error"===t.status)throw new h(t.error,null,te.CAPTCHA_FAILURE);return t.enabled&&"success"!==t.status&&(t.execute(),e=await t.waitForResult()),await i({phoneNumber:r,captchaToken:e,disableSignup:n,withPrivyUi:!1})}catch(r){throw o({status:"error",error:r}),e?.onError?.(r.privyErrorCode||te.UNKNOWN_AUTH_ERROR),r}}),[i]),loginWithCode:G((async({code:r})=>{try{if(t.enabled&&"success"!==t.status)throw new h(t.error,null,te.CAPTCHA_FAILURE);let{user:o,isNewUser:i,wasAlreadyAuthenticated:a,linkedAccount:s}=await n(r);e?.onComplete?.({user:o,isNewUser:i,wasAlreadyAuthenticated:a,loginMethod:"sms",loginAccount:s})}catch(r){throw o({status:"error",error:r}),e?.onError?.(r.privyErrorCode||te.UNKNOWN_AUTH_ERROR),r}}),[n,t.status]),state:r}},Ae=t=>{let{connectOrCreateWallet:r}=e();return n("connectOrCreateWallet",t),{connectOrCreateWallet:r}},ke=e=>{let t=s(),{siweState:r,setSiweState:o,linkWithSiwe:i,generateSiweMessage:n}=Z();return{generateSiweMessage:G((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 o({status:"error",error:t}),e?.onError?.(t.privyErrorCode||te.UNKNOWN_AUTH_ERROR,{linkMethod:"siwe"}),t}}),[n]),linkWithSiwe:G((async({signature:r,message:n,chainId:a,walletClientType:s,connectorType:c})=>{try{if(t.enabled&&"success"!==t.status)throw new h(t.error,null,te.CAPTCHA_FAILURE);let{user:o,linkedAccount:l}=await i({message:n,signature:r,chainId:a,walletClientType:s,connectorType:c});l&&e?.onSuccess?.({user:o,linkMethod:"siwe",linkedAccount:l})}catch(r){throw o({status:"error",error:r}),e?.onError?.(r.privyErrorCode||te.UNKNOWN_AUTH_ERROR,{linkMethod:"siwe"}),r}}),[i,t.status]),state:r}};function Ce(){let{signTransaction:e}=$(m);return{signTransaction:e}}function fe(e){let{linkEmail:t,linkPhone:r,linkWallet:o,linkGoogle:i,linkApple:a,linkTwitter:s,linkDiscord:c,linkGithub:l,linkLinkedIn:u,linkTiktok:h,linkSpotify:d,linkInstagram:p,linkTelegram:w,linkFarcaster:g}=$(m);return n("linkAccount",e),{linkEmail:t,linkPhone:r,linkWallet:o,linkGoogle:i,linkApple:a,linkTwitter:s,linkDiscord:c,linkGithub:l,linkLinkedIn:u,linkTiktok:h,linkSpotify:d,linkInstagram:p,linkFarcaster:g,linkTelegram:w}}function Ie(e){let{updateEmail:t,updatePhone:r}=$(m);return n("update",e),{updateEmail:t,updatePhone:r}}const Te=()=>{let{connectCoinbaseSmartWallet:e}=Z();return{connectCoinbaseSmartWallet:e}},Ee=()=>{let{startCrossAppAuthFlow:t,unlinkCrossAppAccount:r,signMessageWithCrossAppWallet:o,signTypedDataWithCrossAppWallet:i,sendTransactionWithCrossAppWallet:n}=e();return{loginWithCrossAppAccount:({appId:e})=>t({appId:e,action:"login"}),linkCrossAppAccount:({appId:e})=>t({appId:e,action:"link"}),unlinkCrossAppAccount:r,signMessage:o,signTypedData:i,sendTransaction:n}};function We(e){let{sendTransaction:t}=$(m);return n("sendTransaction",e),{sendTransaction:t}}function Ue(e){let{setWalletPassword:t}=$(m);return n("setWalletPassword",e),{setWalletPassword:t}}function Pe(){let t=k(),{getAccessToken:r}=e(),o=C(),{client:i,setUser:n,setAuthenticated:a,setIsNewUser:s,initializeWalletProxy:c}=Z(),{create:l}=f();return{createGuestAccount:async()=>{if(!t.id||!i)throw Error("SDK not yet ready");i.startAuthFlow(new T(t.id));try{let e=await i.authenticate(),u=e.user,h=e.isNewUser??!1;if(!u)throw new ee("Unable to authenticate guest account");let d=await r(),p=await c(W);if(d&&p)try{let e=U(u,t.embeddedWallets.ethereum.createOnLogin),r=P(u,t.embeddedWallets.solana.createOnLogin);e&&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:e?u=(await l({chainType:"ethereum",latestUser:u})).user:n(u)}catch(e){n(u),console.warn("Unable to create embedded wallet for guest account")}return s(h),a(!0),o("login","onComplete",{user:u,isNewUser:h,wasAlreadyAuthenticated:!1,loginMethod:"guest",loginAccount:null}),u}catch(e){throw o("login","onError",e.privyErrorCode||te.UNKNOWN_AUTH_ERROR),e}}}}function Re(e){let{setWalletRecovery:t}=$(m);return n("setWalletRecovery",e),{setWalletRecovery:t}}function ve(e){let{signMessage:t}=$(m);return n("signMessage",e),{signMessage:t}}const Se=()=>{let{ready:t,wallets:r}=R(),{user:o}=e(),{rpcConfig:i,chains:n,appId:a}=Z();return{signAuthorization:G((async(e,s)=>{if(!o)throw Error("User must be authenticated before signing with a Privy wallet");if(!t)throw Error("Wallets are not ready");let c=s?.address??S(o)?.address??ie,l=r.find((e=>ne(e.address)===ne(c)));if(!l)throw Error("Signing wallet not found.");let u=e.chainId??Number(l.chainId.split(":")[1]),h=n.find((e=>e.id===u));if(!h)throw Error("Error, chain not configured in PrivyProvider config");let d=ae({account:c,chain:h,transport:se(O(h,i,a))}),p=await d.prepareAuthorization({...e}),w=await l.getEthereumProvider(),m=await w.request({method:"secp256k1_sign",params:[le(p)]});return{...p,...ce(m)}}),[t,r,o,n])}};function Ne(e){let{signTypedData:t}=$(m);return n("signTypedData",e),{signTypedData:t}}const be=()=>{let{isModalOpen:e}=$(m);return{isOpen:e}};function Oe(e){let{getAccessToken:t}=$(m);return n("accessToken",e),{getAccessToken:t}}function Me(t){let{authenticated:r,user:o}=e(),{initLoginWithOAuth:i}=Z(),a=C();return n("oAuthAuthorization",t),{reauthorize:e=>Fe(r,o,i,a,e.provider)}}let Fe=async(e,t,r,o,i)=>{if(!e)throw o("linkAccount","onError",te.MUST_BE_AUTHENTICATED,{linkMethod:i}),new ee("User must be authenticated before linking an account.");if(!t?.linkedAccounts.some((e=>e.type.includes(i))))throw new ee(`OAuth account of type ${i} not linked to the account.`);await r(i)};const _e=e=>{let t=_();return n("customAuth",e),{status:t}};function Le({isAuthenticated:e,isLoading:t,...r}){let o=Y();X((()=>{t||o.current?.()}),[e,t]);let i=G((e=>(o.current=e,()=>{o.current=void 0})),[]);return j({...r,subscribe:i})}function De(){let{getFarcasterSignerPublicKey:t,signFarcasterMessage:r,requestFarcasterSignerFromWarpcast:o}=e();return{getFarcasterSignerPublicKey:t,signFarcasterMessage:r,requestFarcasterSignerFromWarpcast:o}}const He=()=>{let{revokeDelegatedWallets:e,delegateWallet:t}=Z();return{delegateWallet:async({address:e,chainType:r})=>await t({address:e,chainType:r,showDelegationUIs:!0}),revokeWallets:async()=>await e({showDelegationUIs:!0})}},xe=()=>{let{setUser:e,client:t}=$(re),{user:r}=$(m);return{user:r,refreshUser:G((async()=>{let r=await(t?.updateUserAndIdToken());return e(r??null),r}),[t,e])}},Ke=e=>{let t=s(),{initLoginWithTelegram:r,loginWithTelegram:o,telegramAuthState:i,setTelegramAuthState:n}=Z();return{login:G((async i=>{try{if(t.enabled&&"success"!==t.status)throw new h(t.error,null,te.CAPTCHA_FAILURE);await r(t.token,i?.disableSignup);let{user:n,isNewUser:a,loginAccount:s,wasAlreadyAuthenticated:c}=await o({intent:"login"});e?.onComplete?.({user:n,isNewUser:a,wasAlreadyAuthenticated:c,loginMethod:"telegram",loginAccount:s})}catch(i){throw n({status:"error",error:i}),e?.onError?.(i.privyErrorCode||te.UNKNOWN_AUTH_ERROR),i}}),[r,o,t]),state:i}},je=()=>{let{revokeDelegatedWallets:e,delegateWallet:t}=Z();return{delegateWallet:async({address:e,chainType:r})=>await t({address:e,chainType:r,showDelegationUIs:!1}),revokeWallets:async()=>await e({showDelegationUIs:!1})}};export{Te as useConnectCoinbaseSmartWallet,Ae as useConnectOrCreateWallet,Ee as useCrossAppAccounts,_e as useCustomAuth,He as useDelegatedActions,De as useFarcasterSigner,Pe as useGuestAccounts,je as useHeadlessDelegatedActions,fe as useLinkAccount,ge as useLinkWithPasskey,ke as useLinkWithSiwe,pe as useLoginWithEmail,he as useLoginWithFarcasterV2,de as useLoginWithOAuth,me as useLoginWithPasskey,ye as useLoginWithSms,Ke as useLoginWithTelegram,be as useModalStatus,Me as useOAuthTokens,ue as useRecoverEmbeddedWallet,We as useSendTransaction,Ue as useSetWalletPassword,Re as useSetWalletRecovery,Se as useSignAuthorization,ve as useSignMessage,Ce as useSignTransaction,Ne as useSignTypedData,we as useSignupWithPasskey,Le as useSubscribeToJwtAuthWithFlag,j as useSyncJwtBasedAuthState,Oe as useToken,Ie as useUpdateAccount,xe as useUser,R as useWallets};
|
|
1
|
+
import{u as e,g as o,a as i,b as n,c as s,d as l,C as h,e as d,s as p,P as m,f as k,h as C,i as f,G as T,W,j as U,k as R,l as S,m as P,n as O,o as _,p as j}from"./privy-provider-Db2seOwT.mjs";export{t as Captcha,v as ConnectorManager,E as EthereumWalletConnector,N as LoginModal,F as PrivyClient,q as PrivyProvider,V as VERSION,w as WalletConnector,B as errorIndicatesMaxMfaRetries,D as errorIndicatesMfaTimeout,A as errorIndicatesMfaVerificationFailed,r as getAccessToken,K as useCreateWallet,H as useIdentityToken,M as useImportWallet,I as useLogout,y as useMfa,z as useMfaEnrollment,x as usePrivy,J as useRegisterMfaListener,L as useSolanaWallets}from"./privy-provider-Db2seOwT.mjs";import{useCallback as G,useMemo as Q,useEffect as X,useContext as $,useRef as Y}from"react";import{u as Z,P as ee,a as te,I as re}from"./internal-context-eu0bC04Q.mjs";export{c as useActiveWallet,a as useConnectWallet,b as useFundWallet,u as useLogin}from"./useActiveWallet-ChXrfJFe.mjs";import{F as oe}from"./frame-BeG8p5X6.mjs";import{zeroAddress as ie,getAddress as ae,createWalletClient as ne,http as se,parseSignature as ce}from"viem";import{hashAuthorization as le}from"viem/utils";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"@marsidev/react-turnstile";import"styled-components";import"tinycolor2";import"@heroicons/react/24/outline/DevicePhoneMobileIcon";import"@heroicons/react/24/outline/FingerPrintIcon";import"@heroicons/react/24/outline/PhoneIcon";import"@heroicons/react/24/outline/ShieldCheckIcon";import"@heroicons/react/24/outline/ArrowLeftIcon";import"@heroicons/react/24/outline/ArrowRightIcon";import"@heroicons/react/24/outline/QuestionMarkCircleIcon";import"@heroicons/react/24/outline/XMarkIcon";import"@heroicons/react/24/outline/ChevronDownIcon";import"@heroicons/react/24/outline/CalendarIcon";import"@heroicons/react/24/outline/ExclamationTriangleIcon";import"@headlessui/react";import"@walletconnect/ethereum-provider";import"zustand";import"fast-password-entropy";import"secure-password-utilities";import"secure-password-utilities/wordlists";import"@heroicons/react/24/outline/UserCircleIcon";import"@heroicons/react/24/outline/EnvelopeIcon";import"@heroicons/react/20/solid/CheckIcon";import"@heroicons/react/24/outline/WalletIcon";import"@heroicons/react/24/outline/CheckIcon";import"@heroicons/react/24/outline/Square2StackIcon";import"@heroicons/react/24/outline/ExclamationCircleIcon";import"@heroicons/react/24/outline/ArrowTopRightOnSquareIcon";import"@heroicons/react/24/solid/DocumentCheckIcon";import"@heroicons/react/24/solid/XCircleIcon";import"@heroicons/react/24/solid/CheckCircleIcon";import"qrcode";import"@heroicons/react/24/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/solid/ArrowsRightLeftIcon";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 ue=()=>{let{user:t}=e(),{walletProxy:r}=Z();return{recover:G((async e=>{if(!r)throw Error("Wallet proxy is not ready");let a=await o();if(!t||!a)throw new ee("User must be logged in before attempting to modify the recovery method.");let{entropyId:n,entropyIdVerifier:s}=i(t);try{await r.recover({entropyId:n,entropyIdVerifier:s,accessToken:a,...e})}catch{throw new ee("Unable to recover wallets")}}),[r,t])}},he=()=>{let{client:e,setAuthenticated:t,setUser:r}=Z();return Q((()=>({init:async()=>{if(!e)throw new ee("Must initialize Privy client first.");let t=new oe;return e.startAuthFlow(t),await t.init()},login:async({fid:o,message:i,signature:a})=>{if(!e)throw new ee("Must initialize Privy client first.");if(!(e.authFlow instanceof oe))throw new ee("Must initialize Farcaster frame flow first.");e.authFlow.setAuthData({message:i,signature:a,fid:o});let{user:n}=await e.authenticate();if(!n)throw new ee("Failed to login with Farcaster V2");return r(n),t(!0),{user:n}}})),[e,r,t])},de=t=>{n("login",t);let r=s(),o=l(),{ready:i,user:a}=e(),{initLoginWithHeadlessOAuth:c,loginWithHeadlessOAuth:u,oAuthState:w,setOAuthState:g,isHeadlessOAuthLoading:m}=Z(),y=G((async e=>{try{if(r.enabled&&"success"!==r.status)throw new h(r.error,null,te.CAPTCHA_FAILURE);return await c(e.provider,r.token,e.disableSignup)}catch(e){throw g({status:"error",error:e}),e}}),[c,r]),A=G((async()=>{let e=d();try{if(a)return console.warn("Cannot login with OAuth when already logged in"),a;if(!e.inProgress)throw Error("Cannot login with OAuth because no OAuth flow is in progress");if(e.popupFlow)return}catch(e){throw g({status:"error",error:e}),e}try{return await u(e)}catch(e){throw g({status:"error",error:e}),e}finally{p()}}),[u]);return X((()=>{let e=d();i&&o&&e.inProgress&&!e.withPrivyUi&&!e.popupFlow&&A().catch((()=>{}))}),[i,o]),{initOAuth:y,loading:m,state:w}},pe=e=>{let t=s(),{emailOtpState:r,setEmailOtpState:o,initLoginWithEmail:i,loginWithCode:a}=Z();return{sendCode:G((async({email:r,disableSignup:a})=>{try{let e;if(!r)throw Error("Email required to send OTP code");if(t.enabled&&"error"===t.status)throw new h(t.error,null,te.CAPTCHA_FAILURE);return t.enabled&&"success"!==t.status&&(t.execute(),e=await t.waitForResult()),await i({email:r,captchaToken:e,disableSignup:a,withPrivyUi:!1})}catch(r){throw o({status:"error",error:r}),e?.onError?.(r.privyErrorCode||te.UNKNOWN_AUTH_ERROR),r}}),[i]),loginWithCode:G((async({code:r})=>{try{if(t.enabled&&"error"===t.status)throw new h(t.error,null,te.CAPTCHA_FAILURE);let{user:o,isNewUser:i,wasAlreadyAuthenticated:n,linkedAccount:s}=await a(r);e?.onComplete?.({user:o,isNewUser:i,wasAlreadyAuthenticated:n,loginMethod:"email",loginAccount:s})}catch(r){throw o({status:"error",error:r}),e?.onError?.(r.privyErrorCode||te.UNKNOWN_AUTH_ERROR),r}}),[a,t.status]),state:r}},we=e=>{let t=s(),{initSignupWithPasskey:r,signupWithPasskey:o,passkeyAuthState:i,setPasskeyAuthState:a}=Z();return{signupWithPasskey:G((async()=>{try{let i;if(t.enabled&&"error"===t.status)throw new h(t.error,null,te.CAPTCHA_FAILURE);t.enabled&&"success"!==t.status&&(t.execute(),i=await t.waitForResult()),await r({captchaToken:i,withPrivyUi:!1});let{user:a,isNewUser:n,wasAlreadyAuthenticated:s,loginAccount:c}=await o();e?.onComplete?.({user:a,isNewUser:n,wasAlreadyAuthenticated:s,loginMethod:"passkey",loginAccount:c})}catch(t){throw a({status:"error",error:t}),e?.onError?.(t.privyErrorCode||te.UNKNOWN_AUTH_ERROR),t}}),[o,t.status]),state:i}},ge=e=>{let t=s(),{initLoginWithPasskey:r,loginWithPasskey:o,passkeyAuthState:i,setPasskeyAuthState:a}=Z();return{loginWithPasskey:G((async i=>{try{let a;if(t.enabled&&"error"===t.status)throw new h(t.error,null,te.CAPTCHA_FAILURE);t.enabled&&"success"!==t.status&&(t.execute(),a=await t.waitForResult()),await r({captchaToken:a,withPrivyUi:!1});let{user:n,isNewUser:s,wasAlreadyAuthenticated:c,loginAccount:l}=await o(i);e?.onComplete?.({user:n,isNewUser:s,wasAlreadyAuthenticated:c,loginMethod:"passkey",loginAccount:l})}catch(i){throw a({status:"error",error:i}),e?.onError?.(i.privyErrorCode||te.UNKNOWN_AUTH_ERROR),i}}),[o,t.status]),state:i}},me=e=>{let{initLinkWithPasskey:t,linkWithPasskey:r,passkeyAuthState:o,setPasskeyAuthState:i}=Z();return{linkWithPasskey:G((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||te.UNKNOWN_AUTH_ERROR,{linkMethod:"passkey"}),t}}),[r]),state:o}},ye=e=>{let t=s(),{smsOtpState:r,setSmsOtpState:o,initLoginWithSms:i,loginWithCode:a}=Z();return{sendCode:G((async({phoneNumber:r,disableSignup:a})=>{try{let e;if(!r)throw Error("SMS required to send OTP code");if(t.enabled&&"error"===t.status)throw new h(t.error,null,te.CAPTCHA_FAILURE);return t.enabled&&"success"!==t.status&&(t.execute(),e=await t.waitForResult()),await i({phoneNumber:r,captchaToken:e,disableSignup:a,withPrivyUi:!1})}catch(r){throw o({status:"error",error:r}),e?.onError?.(r.privyErrorCode||te.UNKNOWN_AUTH_ERROR),r}}),[i]),loginWithCode:G((async({code:r})=>{try{if(t.enabled&&"success"!==t.status)throw new h(t.error,null,te.CAPTCHA_FAILURE);let{user:o,isNewUser:i,wasAlreadyAuthenticated:n,linkedAccount:s}=await a(r);e?.onComplete?.({user:o,isNewUser:i,wasAlreadyAuthenticated:n,loginMethod:"sms",loginAccount:s})}catch(r){throw o({status:"error",error:r}),e?.onError?.(r.privyErrorCode||te.UNKNOWN_AUTH_ERROR),r}}),[a,t.status]),state:r}},Ae=t=>{let{connectOrCreateWallet:r}=e();return n("connectOrCreateWallet",t),{connectOrCreateWallet:r}},ke=e=>{let t=s(),{siweState:r,setSiweState:o,linkWithSiwe:i,generateSiweMessage:a}=Z();return{generateSiweMessage:G((async({address:t,chainId:r})=>{try{if(!t||!r)throw Error("wallet address and chainId required to generate nonce");return await a({address:t,chainId:r}).then((e=>e))}catch(t){throw o({status:"error",error:t}),e?.onError?.(t.privyErrorCode||te.UNKNOWN_AUTH_ERROR,{linkMethod:"siwe"}),t}}),[a]),linkWithSiwe:G((async({signature:r,message:a,chainId:n,walletClientType:s,connectorType:c})=>{try{if(t.enabled&&"success"!==t.status)throw new h(t.error,null,te.CAPTCHA_FAILURE);let{user:o,linkedAccount:l}=await i({message:a,signature:r,chainId:n,walletClientType:s,connectorType:c});l&&e?.onSuccess?.({user:o,linkMethod:"siwe",linkedAccount:l})}catch(r){throw o({status:"error",error:r}),e?.onError?.(r.privyErrorCode||te.UNKNOWN_AUTH_ERROR,{linkMethod:"siwe"}),r}}),[i,t.status]),state:r}},Ce=e=>{let t=s(),{siweState:r,setSiweState:o,client:i,generateSiweMessage:a,loginWithSiwe:n}=Z();return{generateSiweNonce:G((async({address:r})=>{try{let e;if(t.enabled&&"error"===t.status)throw new h(t.error,null,te.CAPTCHA_FAILURE);t.enabled&&"success"!==t.status&&(t.execute(),e=await t.waitForResult()),o({status:"generating-message"});let a=await i.generateSiweNonce({address:r,captchaToken:e});return o({status:"awaiting-signature"}),a}catch(r){throw o({status:"error",error:r}),e?.onError?.(r.privyErrorCode||te.UNKNOWN_AUTH_ERROR),r}}),[i,t]),generateSiweMessage:G((async({address:t,chainId:r})=>{try{return await a({address:t,chainId:r})}catch(t){throw o({status:"error",error:t}),e?.onError?.(t.privyErrorCode||te.UNKNOWN_AUTH_ERROR),t}}),[a]),loginWithSiwe:G((async({message:r,signature:i,disableSignup:a})=>{try{let o;if(t.enabled&&"error"===t.status)throw new h(t.error,null,te.CAPTCHA_FAILURE);t.enabled&&"success"!==t.status&&(t.execute(),o=await t.waitForResult());let s=await n({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||te.UNKNOWN_AUTH_ERROR),r}}),[n,t.status]),state:r}};function fe(){let{signTransaction:e}=$(m);return{signTransaction:e}}function Ie(e){let{linkEmail:t,linkPhone:r,linkWallet:o,linkGoogle:i,linkApple:a,linkTwitter:s,linkDiscord:c,linkGithub:l,linkLinkedIn:u,linkTiktok:h,linkSpotify:d,linkInstagram:p,linkTelegram:w,linkFarcaster:g}=$(m);return n("linkAccount",e),{linkEmail:t,linkPhone:r,linkWallet:o,linkGoogle:i,linkApple:a,linkTwitter:s,linkDiscord:c,linkGithub:l,linkLinkedIn:u,linkTiktok:h,linkSpotify:d,linkInstagram:p,linkFarcaster:g,linkTelegram:w}}function Ee(e){let{updateEmail:t,updatePhone:r}=$(m);return n("update",e),{updateEmail:t,updatePhone:r}}const Te=()=>{let{connectCoinbaseSmartWallet:e}=Z();return{connectCoinbaseSmartWallet:e}},We=()=>{let{startCrossAppAuthFlow:t,unlinkCrossAppAccount:r,signMessageWithCrossAppWallet:o,signTypedDataWithCrossAppWallet:i,sendTransactionWithCrossAppWallet:a}=e();return{loginWithCrossAppAccount:({appId:e})=>t({appId:e,action:"login"}),linkCrossAppAccount:({appId:e})=>t({appId:e,action:"link"}),unlinkCrossAppAccount:r,signMessage:o,signTypedData:i,sendTransaction:a}};function Ue(e){let{sendTransaction:t}=$(m);return n("sendTransaction",e),{sendTransaction:t}}function Re(e){let{setWalletPassword:t}=$(m);return n("setWalletPassword",e),{setWalletPassword:t}}function Se(){let t=k(),{getAccessToken:r}=e(),o=C(),{client:i,setUser:a,setAuthenticated:n,setIsNewUser:s,initializeWalletProxy:c}=Z(),{create:l}=f();return{createGuestAccount:async()=>{if(!t.id||!i)throw Error("SDK not yet ready");i.startAuthFlow(new T(t.id));try{let e=await i.authenticate(),u=e.user,h=e.isNewUser??!1;if(!u)throw new ee("Unable to authenticate guest account");let d=await r(),p=await c(W);if(d&&p)try{let e=U(u,t.embeddedWallets.ethereum.createOnLogin),r=R(u,t.embeddedWallets.solana.createOnLogin);e&&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:e?u=(await l({chainType:"ethereum",latestUser:u})).user:a(u)}catch(e){a(u),console.warn("Unable to create embedded wallet for guest account")}return s(h),n(!0),o("login","onComplete",{user:u,isNewUser:h,wasAlreadyAuthenticated:!1,loginMethod:"guest",loginAccount:null}),u}catch(e){throw o("login","onError",e.privyErrorCode||te.UNKNOWN_AUTH_ERROR),e}}}}function Ne(e){let{setWalletRecovery:t}=$(m);return n("setWalletRecovery",e),{setWalletRecovery:t}}function Pe(e){let{signMessage:t}=$(m);return n("signMessage",e),{signMessage:t}}const ve=()=>{let{ready:t,wallets:r}=S(),{user:o}=e(),{rpcConfig:i,chains:a,appId:n}=Z();return{signAuthorization:G((async(e,s)=>{if(!o)throw Error("User must be authenticated before signing with a Privy wallet");if(!t)throw Error("Wallets are not ready");let c=s?.address??P(o)?.address??ie,l=r.find((e=>ae(e.address)===ae(c)));if(!l)throw Error("Signing wallet not found.");let u=e.chainId??Number(l.chainId.split(":")[1]),h=a.find((e=>e.id===u));if(!h)throw Error("Error, chain not configured in PrivyProvider config");let d=ne({account:c,chain:h,transport:se(O(h,i,n))}),p=await d.prepareAuthorization({...e}),w=await l.getEthereumProvider(),g=await w.request({method:"secp256k1_sign",params:[le(p)]});return{...p,...ce(g)}}),[t,r,o,a])}};function be(e){let{signTypedData:t}=$(m);return n("signTypedData",e),{signTypedData:t}}const Oe=()=>{let{isModalOpen:e}=$(m);return{isOpen:e}};function _e(e){let{getAccessToken:t}=$(m);return n("accessToken",e),{getAccessToken:t}}function Me(t){let{authenticated:r,user:o}=e(),{initLoginWithOAuth:i}=Z(),a=C();return n("oAuthAuthorization",t),{reauthorize:e=>Fe(r,o,i,a,e.provider)}}let Fe=async(e,t,r,o,i)=>{if(!e)throw o("linkAccount","onError",te.MUST_BE_AUTHENTICATED,{linkMethod:i}),new ee("User must be authenticated before linking an account.");if(!t?.linkedAccounts.some((e=>e.type.includes(i))))throw new ee(`OAuth account of type ${i} not linked to the account.`);await r(i)};const Le=e=>{let t=_();return n("customAuth",e),{status:t}};function He({isAuthenticated:e,isLoading:t,...r}){let o=Y();X((()=>{t||o.current?.()}),[e,t]);let i=G((e=>(o.current=e,()=>{o.current=void 0})),[]);return j({...r,subscribe:i})}function De(){let{getFarcasterSignerPublicKey:t,signFarcasterMessage:r,requestFarcasterSignerFromWarpcast:o}=e();return{getFarcasterSignerPublicKey:t,signFarcasterMessage:r,requestFarcasterSignerFromWarpcast:o}}const xe=()=>{let{revokeDelegatedWallets:e,delegateWallet:t}=Z();return{delegateWallet:async({address:e,chainType:r})=>await t({address:e,chainType:r,showDelegationUIs:!0}),revokeWallets:async()=>await e({showDelegationUIs:!0})}},Ke=()=>{let{setUser:e,client:t}=$(re),{user:r}=$(m);return{user:r,refreshUser:G((async()=>{let r=await(t?.updateUserAndIdToken());return e(r??null),r}),[t,e])}},je=e=>{let t=s(),{initLoginWithTelegram:r,loginWithTelegram:o,telegramAuthState:i,setTelegramAuthState:a}=Z();return{login:G((async i=>{try{if(t.enabled&&"success"!==t.status)throw new h(t.error,null,te.CAPTCHA_FAILURE);await r(t.token,i?.disableSignup);let{user:a,isNewUser:n,loginAccount:s,wasAlreadyAuthenticated:c}=await o({intent:"login"});e?.onComplete?.({user:a,isNewUser:n,wasAlreadyAuthenticated:c,loginMethod:"telegram",loginAccount:s})}catch(i){throw a({status:"error",error:i}),e?.onError?.(i.privyErrorCode||te.UNKNOWN_AUTH_ERROR),i}}),[r,o,t]),state:i}},qe=()=>{let{revokeDelegatedWallets:e,delegateWallet:t}=Z();return{delegateWallet:async({address:e,chainType:r})=>await t({address:e,chainType:r,showDelegationUIs:!1}),revokeWallets:async()=>await e({showDelegationUIs:!1})}};export{Te as useConnectCoinbaseSmartWallet,Ae as useConnectOrCreateWallet,We as useCrossAppAccounts,Le as useCustomAuth,xe as useDelegatedActions,De as useFarcasterSigner,Se as useGuestAccounts,qe as useHeadlessDelegatedActions,Ie as useLinkAccount,me as useLinkWithPasskey,ke as useLinkWithSiwe,pe as useLoginWithEmail,he as useLoginWithFarcasterV2,de as useLoginWithOAuth,ge as useLoginWithPasskey,Ce as useLoginWithSiwe,ye as useLoginWithSms,je as useLoginWithTelegram,Oe as useModalStatus,Me as useOAuthTokens,ue as useRecoverEmbeddedWallet,Ue as useSendTransaction,Re as useSetWalletPassword,Ne as useSetWalletRecovery,ve as useSignAuthorization,Pe as useSignMessage,fe as useSignTransaction,be as useSignTypedData,we as useSignupWithPasskey,He as useSubscribeToJwtAuthWithFlag,j as useSyncJwtBasedAuthState,_e as useToken,Ee as useUpdateAccount,Ke as useUser,S as useWallets};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{FetchError as a}from"ofetch";import{createContext as e,useContext as s}from"react";var t;class i extends Error{toString(){return`${this.type}${this.privyErrorCode?`-${this.privyErrorCode}`:""}: ${this.message}${this.cause?` [cause: ${this.cause}]`:""}`}constructor(a,e,s){super(a),e instanceof Error&&(this.cause=e),this.privyErrorCode=s}}class n extends i{constructor(a,e,s,t,i,n){super(s,t,i),this.type=a,this.status=e,this.data=n}}class r extends i{constructor(a,e,s){super(a,e,s),this.type="client_error"}}class _ extends r{constructor(){super("Request timed out",void 0,"client_request_timeout")}}class o extends i{constructor(a,e,s){super(a,e,s),this.type="connector_error"}}const l=e=>{if(e instanceof i)return e;if(!(e instanceof a))return u(e);if(!e.response)return new n("api_error",null,e.message,e);let{type:s,message:t,error:r,code:_}=e.data;return new n(s||"ApiError",e.response.status,t||r,e,_,e.data)},u=a=>a instanceof i?a:a instanceof Error?new r(a.message,a):new r(`Internal error: ${a}`);var p=((t={}).OAUTH_ACCOUNT_SUSPENDED="oauth_account_suspended",t.MISSING_OR_INVALID_PRIVY_APP_ID="missing_or_invalid_privy_app_id",t.MISSING_OR_INVALID_PRIVY_ACCOUNT_ID="missing_or_invalid_privy_account_id",t.MISSING_OR_INVALID_TOKEN="missing_or_invalid_token",t.INVALID_DATA="invalid_data",t.INVALID_CAPTCHA="invalid_captcha",t.LINKED_TO_ANOTHER_USER="linked_to_another_user",t.CANNOT_LINK_MORE_OF_TYPE="cannot_link_more_of_type",t.FAILED_TO_LINK_ACCOUNT="failed_to_link_account",t.FAILED_TO_UPDATE_ACCOUNT="failed_to_update_account",t.USER_EXITED_UPDATE_FLOW="exited_update_flow",t.ALLOWLIST_REJECTED="allowlist_rejected",t.OAUTH_USER_DENIED="oauth_user_denied",t.OAUTH_UNEXPECTED="oauth_unexpected",t.UNKNOWN_AUTH_ERROR="unknown_auth_error",t.USER_EXITED_AUTH_FLOW="exited_auth_flow",t.USER_EXITED_LINK_FLOW="exited_link_flow",t.USER_EXITED_SET_PASSWORD_FLOW="user_exited_set_password_flow",t.MUST_BE_AUTHENTICATED="must_be_authenticated",t.UNKNOWN_CONNECT_WALLET_ERROR="unknown_connect_wallet_error",t.GENERIC_CONNECT_WALLET_ERROR="generic_connect_wallet_error",t.CLIENT_REQUEST_TIMEOUT="client_request_timeout",t.INVALID_CREDENTIALS="invalid_credentials",t.MISSING_MFA_CREDENTIALS="missing_or_invalid_mfa",t.UNKNOWN_MFA_ERROR="unknown_mfa_error",t.EMBEDDED_WALLET_ALREADY_EXISTS="embedded_wallet_already_exists",t.EMBEDDED_WALLET_NOT_FOUND="embedded_wallet_not_found",t.EMBEDDED_WALLET_CREATE_ERROR="embedded_wallet_create_error",t.UNKNOWN_EMBEDDED_WALLET_ERROR="unknown_embedded_wallet_error",t.EMBEDDED_WALLET_PASSWORD_UNCONFIRMED="embedded_wallet_password_unconfirmed",t.EMBEDDED_WALLET_PASSWORD_ALREADY_EXISTS="embedded_wallet_password_already_exists",t.EMBEDDED_WALLET_RECOVERY_ALREADY_EXISTS="embedded_wallet_recovery_already_exists",t.TRANSACTION_FAILURE="transaction_failure",t.UNSUPPORTED_CHAIN_ID="unsupported_chain_id",t.NOT_SUPPORTED="not_supported",t.CAPTCHA_TIMEOUT="captcha_timeout",t.INVALID_MESSAGE="invalid_message",t.UNABLE_TO_SIGN="unable_to_sign",t.CAPTCHA_FAILURE="captcha_failure",t.CAPTCHA_DISABLED="captcha_disabled",t.SESSION_STORAGE_UNAVAILABLE="session_storage_unavailable",t.TOO_MANY_REQUESTS="too_many_requests",t.USER_LIMIT_REACHED="max_accounts_reached",t.DISALLOWED_LOGIN_METHOD="disallowed_login_method",t.DISALLOWED_PLUS_EMAIL="disallowed_plus_email",t.PASSKEY_NOT_ALLOWED="passkey_not_allowed",t.USER_DOES_NOT_EXIST="user_does_not_exist",t.INSUFFICIENT_BALANCE="insufficient_balance",t.ACCOUNT_TRANSFER_REQUIRED="account_transfer_required",t.BUFFER_NOT_DEFINED="buffer_not_defined",t);class d extends r{constructor(){super("Method called before `ready`. Ensure you wait until `ready` is true before calling.")}}class c extends r{constructor(a="Embedded wallet error",e){super(a,e,"unknown_embedded_wallet_error")}}class E extends r{constructor(a="User must be authenticated"){super(a,void 0,"must_be_authenticated")}}class A extends r{constructor(a){super("This application is in development mode and must be upgraded to production to log in new users.",a,"max_accounts_reached")}}const h="/api/v1/sessions",v="/api/v1/sessions/logout",S="/api/v1/siwe/init",T="/api/v1/siwe/authenticate",m="/api/v1/siwe/link",w="/api/v1/siwe/link_smart_wallet",I="/api/v1/siwe/unlink",D="/api/v1/siwe/transfer",N="/api/v1/siws/init",O="/api/v1/siws/authenticate",L="/api/v1/siws/link",g="/api/v1/siws/unlink",R="/api/v1/farcaster/init",W="/api/v1/farcaster/authenticate",U="/api/v1/farcaster/link",f="/api/v1/farcaster/status",k="/api/v1/farcaster/unlink",y="/api/v1/farcaster/transfer",C="api/v2/farcaster/init",P="api/v2/farcaster/authenticate",M="/api/v1/passwordless/init",F="/api/v1/passwordless/authenticate",b="/api/v1/passwordless/link",x="/api/v1/passwordless/unlink",H="/api/v1/passwordless/update",B="/api/v1/passwordless/transfer",V="/api/v1/passwordless_sms/init",K="/api/v1/passwordless_sms/link",Y="/api/v1/passwordless_sms/unlink",G="/api/v1/passwordless_sms/authenticate",X="/api/v1/passwordless_sms/update",$="/api/v1/passwordless_sms/transfer",q="/api/v1/oauth/init",j="/api/v1/oauth/authenticate",Q="/api/v1/oauth/link",z="/api/v1/oauth/unlink",J="/api/v1/oauth/transfer",Z="/api/v1/recovery/oauth/init",aa="/api/v1/recovery/oauth/init_icloud",ea="/api/v1/recovery/oauth/authenticate",sa="/api/v1/passkeys/link/init",ta="/api/v1/passkeys/authenticate/init",ia="/api/v1/passkeys/register/init",na="/api/v1/passkeys/link",ra="/api/v1/passkeys/authenticate",_a="/api/v1/passkeys/register",oa="/api/v1/telegram/authenticate",la="/api/v1/telegram/link",ua="/api/v1/telegram/unlink",pa="/api/v1/telegram/transfer",da="/api/v1/mfa/passwordless_sms/init",ca="/api/v1/mfa/passkeys/init",Ea="/api/v1/users/me/accept_terms",Aa="/api/v1/analytics_events",ha="/api/v1/custom_jwt_account/authenticate",va="/api/v1/guest/authenticate",Sa="/api/v1/plugins/moonpay_on_ramp/sign",Ta="/api/v1/funding/coinbase_on_ramp/init",ma="/api/v1/funding/coinbase_on_ramp/status",wa="/api/v1/wallets/revoke",Ia="/api/v1/users/me",Da="/api/v1/scan/transaction",Na=()=>{throw Error("You need to wrap your application with the <PrivyProvider> initialized with your app id.")},Oa=a=>()=>{throw Error(a.trim())},La=/*#__PURE__*/e({setAuthenticated:Na,setUser:Na,setIsNewUser:Na,isNewUserThisSession:!1,walletConnectionStatus:null,connectors:[],solanaWallets:[],rpcConfig:{rpcUrls:{}},showFiatPrices:!0,chains:[],clientAnalyticsId:null,pendingTransaction:null,client:null,privy:null,appId:"notAdded",onCustomAuthAuthenticated:Na,hideWalletUIs:{current:!1},nativeTokenSymbolForChainId:Na,initializeWalletProxy:Na,getAuthMeta:Na,getAuthFlow:Na,closePrivyModal:Na,openPrivyModal:Na,connectWallet:Na,initLoginWithWallet:Na,loginWithWallet:Na,initLoginWithFarcaster:Na,loginWithFarcaster:Na,loginWithCode:Na,initLoginWithEmail:Na,initLoginWithSms:Na,initUpdateEmail:Na,initUpdatePhone:Na,resendEmailCode:Na,resendSmsCode:Na,initLoginWithHeadlessOAuth:Na,loginWithHeadlessOAuth:Na,crossAppAuthFlow:Na,initLoginWithOAuth:Na,loginWithOAuth:Na,passkeyAuthState:{status:"initial"},setPasskeyAuthState:Na,initSignupWithPasskey:Na,signupWithPasskey:Na,initLoginWithPasskey:Na,loginWithPasskey:Na,initLinkWithPasskey:Na,linkWithPasskey:Na,refreshSessionAndUser:Na,walletProxy:null,createAnalyticsEvent:Na,acceptTerms:Na,getUsdTokenPrice:Na,getUsdPriceForSol:Na,getSplTokenMetadata:Na,recoverPrimaryWallet:Na,updateWallets:Na,fundWallet:Na,openModal:Na,setReadyToTrue:Na,requestFarcasterSignerStatus:Na,initLoginWithTelegram:Na,loginWithTelegram:Na,generateSiweMessage:Na,generateSiweMessageForSmartWallet:Na,linkWithSiwe:Na,linkSmartWallet:Na,delegateWallet:Na,revokeDelegatedWallets:Na,exportSolanaWallet:Na,connectCoinbaseSmartWallet:Na,initiateAccountTransfer:Na,emailOtpState:{status:"initial"},setEmailOtpState:Na,smsOtpState:{status:"initial"},setSmsOtpState:Na,siweState:{status:"initial"},setSiweState:Na,oAuthState:{status:"initial"},setOAuthState:Na,telegramAuthState:{status:"initial"},setTelegramAuthState:Na,isHeadlessOAuthLoading:!1,isHeadlessSigning:Na}),ga=()=>s(La);export{ma as $,i as A,oa as B,la as C,Oa as D,_ as E,h as F,v as G,Aa as H,La as I,ha as J,va as K,u as L,n as M,da as N,ca as O,r as P,Ea as Q,x as R,Y as S,I as T,g as U,z as V,k as W,ua as X,wa as Y,Sa as Z,Ta as _,p as a,S as a0,T as a1,m as a2,w as a3,N as a4,O as a5,J as a6,pa as a7,y as a8,D as a9,$ as aa,B as ab,L as ac,Ia as ad,Da as ae,ea as af,aa as ag,Z as ah,c as ai,A as aj,E as ak,d as al,C as am,P as an,b,M as c,H as d,o as e,l as f,W as g,U as h,R as i,f as j,Q as k,q as l,_a as m,Na as n,j as o,F as p,ra as q,na as r,ia as s,ta as t,ga as u,sa as v,G as w,K as x,V as y,X as z};
|
|
1
|
+
import{FetchError as a}from"ofetch";import{createContext as e,useContext as s}from"react";var t;class i extends Error{toString(){return`${this.type}${this.privyErrorCode?`-${this.privyErrorCode}`:""}: ${this.message}${this.cause?` [cause: ${this.cause}]`:""}`}constructor(a,e,s){super(a),e instanceof Error&&(this.cause=e),this.privyErrorCode=s}}class n extends i{constructor(a,e,s,t,i,n){super(s,t,i),this.type=a,this.status=e,this.data=n}}class r extends i{constructor(a,e,s){super(a,e,s),this.type="client_error"}}class _ extends r{constructor(){super("Request timed out",void 0,"client_request_timeout")}}class o extends i{constructor(a,e,s){super(a,e,s),this.type="connector_error"}}const l=e=>{if(e instanceof i)return e;if(!(e instanceof a))return u(e);if(!e.response)return new n("api_error",null,e.message,e);let{type:s,message:t,error:r,code:_}=e.data;return new n(s||"ApiError",e.response.status,t||r,e,_,e.data)},u=a=>a instanceof i?a:a instanceof Error?new r(a.message,a):new r(`Internal error: ${a}`);var p=((t={}).OAUTH_ACCOUNT_SUSPENDED="oauth_account_suspended",t.MISSING_OR_INVALID_PRIVY_APP_ID="missing_or_invalid_privy_app_id",t.MISSING_OR_INVALID_PRIVY_ACCOUNT_ID="missing_or_invalid_privy_account_id",t.MISSING_OR_INVALID_TOKEN="missing_or_invalid_token",t.INVALID_DATA="invalid_data",t.INVALID_CAPTCHA="invalid_captcha",t.LINKED_TO_ANOTHER_USER="linked_to_another_user",t.CANNOT_LINK_MORE_OF_TYPE="cannot_link_more_of_type",t.FAILED_TO_LINK_ACCOUNT="failed_to_link_account",t.FAILED_TO_UPDATE_ACCOUNT="failed_to_update_account",t.USER_EXITED_UPDATE_FLOW="exited_update_flow",t.ALLOWLIST_REJECTED="allowlist_rejected",t.OAUTH_USER_DENIED="oauth_user_denied",t.OAUTH_UNEXPECTED="oauth_unexpected",t.UNKNOWN_AUTH_ERROR="unknown_auth_error",t.USER_EXITED_AUTH_FLOW="exited_auth_flow",t.USER_EXITED_LINK_FLOW="exited_link_flow",t.USER_EXITED_SET_PASSWORD_FLOW="user_exited_set_password_flow",t.MUST_BE_AUTHENTICATED="must_be_authenticated",t.UNKNOWN_CONNECT_WALLET_ERROR="unknown_connect_wallet_error",t.GENERIC_CONNECT_WALLET_ERROR="generic_connect_wallet_error",t.CLIENT_REQUEST_TIMEOUT="client_request_timeout",t.INVALID_CREDENTIALS="invalid_credentials",t.MISSING_MFA_CREDENTIALS="missing_or_invalid_mfa",t.UNKNOWN_MFA_ERROR="unknown_mfa_error",t.EMBEDDED_WALLET_ALREADY_EXISTS="embedded_wallet_already_exists",t.EMBEDDED_WALLET_NOT_FOUND="embedded_wallet_not_found",t.EMBEDDED_WALLET_CREATE_ERROR="embedded_wallet_create_error",t.UNKNOWN_EMBEDDED_WALLET_ERROR="unknown_embedded_wallet_error",t.EMBEDDED_WALLET_PASSWORD_UNCONFIRMED="embedded_wallet_password_unconfirmed",t.EMBEDDED_WALLET_PASSWORD_ALREADY_EXISTS="embedded_wallet_password_already_exists",t.EMBEDDED_WALLET_RECOVERY_ALREADY_EXISTS="embedded_wallet_recovery_already_exists",t.TRANSACTION_FAILURE="transaction_failure",t.UNSUPPORTED_CHAIN_ID="unsupported_chain_id",t.NOT_SUPPORTED="not_supported",t.CAPTCHA_TIMEOUT="captcha_timeout",t.INVALID_MESSAGE="invalid_message",t.UNABLE_TO_SIGN="unable_to_sign",t.CAPTCHA_FAILURE="captcha_failure",t.CAPTCHA_DISABLED="captcha_disabled",t.SESSION_STORAGE_UNAVAILABLE="session_storage_unavailable",t.TOO_MANY_REQUESTS="too_many_requests",t.USER_LIMIT_REACHED="max_accounts_reached",t.DISALLOWED_LOGIN_METHOD="disallowed_login_method",t.DISALLOWED_PLUS_EMAIL="disallowed_plus_email",t.PASSKEY_NOT_ALLOWED="passkey_not_allowed",t.USER_DOES_NOT_EXIST="user_does_not_exist",t.INSUFFICIENT_BALANCE="insufficient_balance",t.ACCOUNT_TRANSFER_REQUIRED="account_transfer_required",t.BUFFER_NOT_DEFINED="buffer_not_defined",t);class d extends r{constructor(){super("Method called before `ready`. Ensure you wait until `ready` is true before calling.")}}class c extends r{constructor(a="Embedded wallet error",e){super(a,e,"unknown_embedded_wallet_error")}}class E extends r{constructor(a="User must be authenticated"){super(a,void 0,"must_be_authenticated")}}class A extends r{constructor(a){super("This application is in development mode and must be upgraded to production to log in new users.",a,"max_accounts_reached")}}const h="/api/v1/sessions",v="/api/v1/sessions/logout",S="/api/v1/siwe/init",T="/api/v1/siwe/authenticate",m="/api/v1/siwe/link",w="/api/v1/siwe/link_smart_wallet",I="/api/v1/siwe/unlink",D="/api/v1/siwe/transfer",N="/api/v1/siws/init",O="/api/v1/siws/authenticate",L="/api/v1/siws/link",g="/api/v1/siws/unlink",R="/api/v1/farcaster/init",W="/api/v1/farcaster/authenticate",U="/api/v1/farcaster/link",f="/api/v1/farcaster/status",k="/api/v1/farcaster/unlink",y="/api/v1/farcaster/transfer",C="api/v2/farcaster/init",P="api/v2/farcaster/authenticate",M="/api/v1/passwordless/init",F="/api/v1/passwordless/authenticate",b="/api/v1/passwordless/link",x="/api/v1/passwordless/unlink",H="/api/v1/passwordless/update",B="/api/v1/passwordless/transfer",V="/api/v1/passwordless_sms/init",K="/api/v1/passwordless_sms/link",Y="/api/v1/passwordless_sms/unlink",G="/api/v1/passwordless_sms/authenticate",X="/api/v1/passwordless_sms/update",$="/api/v1/passwordless_sms/transfer",q="/api/v1/oauth/init",j="/api/v1/oauth/authenticate",Q="/api/v1/oauth/link",z="/api/v1/oauth/unlink",J="/api/v1/oauth/transfer",Z="/api/v1/recovery/oauth/init",aa="/api/v1/recovery/oauth/init_icloud",ea="/api/v1/recovery/oauth/authenticate",sa="/api/v1/passkeys/link/init",ta="/api/v1/passkeys/authenticate/init",ia="/api/v1/passkeys/register/init",na="/api/v1/passkeys/link",ra="/api/v1/passkeys/authenticate",_a="/api/v1/passkeys/register",oa="/api/v1/telegram/authenticate",la="/api/v1/telegram/link",ua="/api/v1/telegram/unlink",pa="/api/v1/telegram/transfer",da="/api/v1/mfa/passwordless_sms/init",ca="/api/v1/mfa/passkeys/init",Ea="/api/v1/users/me/accept_terms",Aa="/api/v1/analytics_events",ha="/api/v1/custom_jwt_account/authenticate",va="/api/v1/guest/authenticate",Sa="/api/v1/plugins/moonpay_on_ramp/sign",Ta="/api/v1/funding/coinbase_on_ramp/init",ma="/api/v1/funding/coinbase_on_ramp/status",wa="/api/v1/wallets/revoke",Ia="/api/v1/users/me",Da="/api/v1/scan/transaction",Na=()=>{throw Error("You need to wrap your application with the <PrivyProvider> initialized with your app id.")},Oa=a=>()=>{throw Error(a.trim())},La=/*#__PURE__*/e({setAuthenticated:Na,setUser:Na,setIsNewUser:Na,isNewUserThisSession:!1,walletConnectionStatus:null,connectors:[],solanaWallets:[],rpcConfig:{rpcUrls:{}},showFiatPrices:!0,chains:[],clientAnalyticsId:null,pendingTransaction:null,client:null,privy:null,appId:"notAdded",onCustomAuthAuthenticated:Na,hideWalletUIs:{current:!1},nativeTokenSymbolForChainId:Na,initializeWalletProxy:Na,getAuthMeta:Na,getAuthFlow:Na,closePrivyModal:Na,openPrivyModal:Na,connectWallet:Na,initLoginWithWallet:Na,loginWithWallet:Na,initLoginWithFarcaster:Na,loginWithFarcaster:Na,loginWithCode:Na,initLoginWithEmail:Na,initLoginWithSms:Na,initUpdateEmail:Na,initUpdatePhone:Na,resendEmailCode:Na,resendSmsCode:Na,initLoginWithHeadlessOAuth:Na,loginWithHeadlessOAuth:Na,crossAppAuthFlow:Na,initLoginWithOAuth:Na,loginWithOAuth:Na,passkeyAuthState:{status:"initial"},setPasskeyAuthState:Na,initSignupWithPasskey:Na,signupWithPasskey:Na,initLoginWithPasskey:Na,loginWithPasskey:Na,initLinkWithPasskey:Na,linkWithPasskey:Na,refreshSessionAndUser:Na,walletProxy:null,createAnalyticsEvent:Na,acceptTerms:Na,getUsdTokenPrice:Na,getUsdPriceForSol:Na,getSplTokenMetadata:Na,recoverPrimaryWallet:Na,updateWallets:Na,fundWallet:Na,openModal:Na,setReadyToTrue:Na,requestFarcasterSignerStatus:Na,initLoginWithTelegram:Na,loginWithTelegram:Na,generateSiweMessage:Na,generateSiweMessageForSmartWallet:Na,loginWithSiwe:Na,linkWithSiwe:Na,linkSmartWallet:Na,delegateWallet:Na,revokeDelegatedWallets:Na,exportSolanaWallet:Na,connectCoinbaseSmartWallet:Na,initiateAccountTransfer:Na,emailOtpState:{status:"initial"},setEmailOtpState:Na,smsOtpState:{status:"initial"},setSmsOtpState:Na,siweState:{status:"initial"},setSiweState:Na,oAuthState:{status:"initial"},setOAuthState:Na,telegramAuthState:{status:"initial"},setTelegramAuthState:Na,isHeadlessOAuthLoading:!1,isHeadlessSigning:Na}),ga=()=>s(La);export{ma as $,i as A,oa as B,la as C,Oa as D,_ as E,h as F,v as G,Aa as H,La as I,ha as J,va as K,u as L,n as M,da as N,ca as O,r as P,Ea as Q,x as R,Y as S,I as T,g as U,z as V,k as W,ua as X,wa as Y,Sa as Z,Ta as _,p as a,S as a0,T as a1,m as a2,w as a3,N as a4,O as a5,J as a6,pa as a7,y as a8,D as a9,$ as aa,B as ab,L as ac,Ia as ad,Da as ae,ea as af,aa as ag,Z as ah,c as ai,A as aj,E as ak,d as al,C as am,P as an,b,M as c,H as d,o as e,l as f,W as g,U as h,R as i,f as j,Q as k,q as l,_a as m,Na as n,j as o,F as p,ra as q,na as r,ia as s,ta as t,ga as u,sa as v,G as w,K as x,V as y,X as z};
|