@privy-io/react-auth 2.13.6 → 2.13.8-beta-20250602230359

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 (33) 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-AVb3fF9t.js → privy-provider-DuTcPLua.js} +22 -22
  4. package/dist/cjs/{smart-wallets-CMucONWg.js → smart-wallets-DMr_IPrS.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-Bcd5TKhY.js → useActiveWallet-SYmYaBd7.js} +1 -1
  9. package/dist/cjs/{useFundWallet-DhWF1HLx.js → useFundWallet-B_-2jCU7.js} +1 -1
  10. package/dist/dts/farcaster.d.mts +2 -1
  11. package/dist/dts/farcaster.d.ts +2 -1
  12. package/dist/dts/index.d.mts +9 -6
  13. package/dist/dts/index.d.ts +9 -6
  14. package/dist/dts/smart-wallets.d.mts +2 -1
  15. package/dist/dts/smart-wallets.d.ts +2 -1
  16. package/dist/dts/solana.d.mts +5 -4
  17. package/dist/dts/solana.d.ts +5 -4
  18. package/dist/dts/{types-BWtvBcM8.d.mts → types-CCLHKw4p.d.mts} +6 -0
  19. package/dist/dts/{types-BWtvBcM8.d.ts → types-CCLHKw4p.d.ts} +6 -0
  20. package/dist/dts/ui.d.mts +2 -1
  21. package/dist/dts/ui.d.ts +2 -1
  22. package/dist/dts/{useSolanaWallets-mdkbgoJN.d.mts → useSolanaWallets-CbaQnTe_.d.mts} +1 -1
  23. package/dist/dts/{useSolanaWallets-mdkbgoJN.d.ts → useSolanaWallets-CbaQnTe_.d.ts} +1 -1
  24. package/dist/esm/abstract-smart-wallets.mjs +1 -1
  25. package/dist/esm/index.mjs +1 -1
  26. package/dist/esm/{privy-provider-DzVKnifk.mjs → privy-provider-D_ew0EI2.mjs} +5 -5
  27. package/dist/esm/{smart-wallets-VdR-GNdn.mjs → smart-wallets-B3J4MB2p.mjs} +1 -1
  28. package/dist/esm/smart-wallets.mjs +1 -1
  29. package/dist/esm/solana.mjs +1 -1
  30. package/dist/esm/ui.mjs +1 -1
  31. package/dist/esm/{useActiveWallet-DEjTs-_i.mjs → useActiveWallet-gkcyBb0i.mjs} +1 -1
  32. package/dist/esm/{useFundWallet-BPshvr7J.mjs → useFundWallet-8VfrwcYY.mjs} +1 -1
  33. package/package.json +4 -4
@@ -1,9 +1,10 @@
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-BWtvBcM8.js';
4
- export { ax as Apple, aI as AppleOAuthWithMetadata, aQ as ContractUIOptions, aA as CrossAppAccount, aL as CrossAppAccountWithMetadata, au as Discord, aE as DiscordOAuthWithMetadata, aN as Email, ap as EmailWithMetadata, aU as Farcaster, aJ as FarcasterWithMetadata, av as Github, aF as GithubOAuthWithMetadata, as as Google, aC as GoogleOAuthWithMetadata, aB as LinkedAccountType, b as LinkedAccountWithMetadata, aw as LinkedIn, aH as LinkedInOAuthWithMetadata, aW as LoginMethodOrderOption, ag as MessageTypes, ai as MoonpayConfig, aj as MoonpayCurrencyCode, aS as MoonpayFundingConfig, ak as MoonpayPaymentMethod, aR as NativeFundingConfig, ao as NonEmptyArray, aV as Passkey, aM as PasskeyWithMetadata, aO as Phone, aq as PhoneWithMetadata, aT as PriceDisplayOptions, P as PrivyErrorCode, al as Quantity, ah as SmartWallet, f as SolanaCluster, k as SolanaFundingConfig, S as SolanaTransactionReceipt, e as SupportedSolanaTransaction, az as Telegram, aK as TelegramWithMetadata, ay as Tiktok, aG as TiktokOAuthWithMetadata, am as TransactionLog, an as TransactionReceipt, aP as TransactionUIOptions, at as Twitter, aD as TwitterOAuthWithMetadata, af as TypedMessage, ar as WalletWithMetadata } from './types-BWtvBcM8.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-CCLHKw4p.js';
4
+ export { ax as Apple, aI as AppleOAuthWithMetadata, aQ as ContractUIOptions, aA as CrossAppAccount, aL as CrossAppAccountWithMetadata, au as Discord, aE as DiscordOAuthWithMetadata, aN as Email, ap as EmailWithMetadata, aU as Farcaster, aJ as FarcasterWithMetadata, av as Github, aF as GithubOAuthWithMetadata, as as Google, aC as GoogleOAuthWithMetadata, aB as LinkedAccountType, b as LinkedAccountWithMetadata, aw as LinkedIn, aH as LinkedInOAuthWithMetadata, aW as LoginMethodOrderOption, ag as MessageTypes, ai as MoonpayConfig, aj as MoonpayCurrencyCode, aS as MoonpayFundingConfig, ak as MoonpayPaymentMethod, aR as NativeFundingConfig, ao as NonEmptyArray, aV as Passkey, aM as PasskeyWithMetadata, aO as Phone, aq as PhoneWithMetadata, aT as PriceDisplayOptions, P as PrivyErrorCode, al as Quantity, ah as SmartWallet, f as SolanaCluster, k as SolanaFundingConfig, S as SolanaTransactionReceipt, e as SupportedSolanaTransaction, az as Telegram, aK as TelegramWithMetadata, ay as Tiktok, aG as TiktokOAuthWithMetadata, am as TransactionLog, an as TransactionReceipt, aP as TransactionUIOptions, at as Twitter, aD as TwitterOAuthWithMetadata, af as TypedMessage, ar as WalletWithMetadata } from './types-CCLHKw4p.js';
5
5
  import * as react_jsx_runtime from 'react/jsx-runtime';
6
6
  import { TurnstileProps } from '@marsidev/react-turnstile';
7
+ import { AppKit } from '@reown/appkit';
7
8
  import EventEmitter from 'eventemitter3';
8
9
  import { Store, EIP6963ProviderDetail } from 'mipd';
9
10
  import Privy, { Chain, RpcConfig } from '@privy-io/js-sdk-core';
@@ -16,8 +17,8 @@ import * as _simplewebauthn_types from '@simplewebauthn/types';
16
17
  import { PublicKeyCredentialRequestOptionsJSON } from '@simplewebauthn/types';
17
18
  import { Cluster } from '@solana/web3.js';
18
19
  import { FetchOptions } from 'ofetch';
19
- import { P as PrivyEvents } from './useSolanaWallets-mdkbgoJN.js';
20
- export { C as CallbackError, U as UseSolanaWalletsInterface, u as useSolanaWallets } from './useSolanaWallets-mdkbgoJN.js';
20
+ import { P as PrivyEvents } from './useSolanaWallets-CbaQnTe_.js';
21
+ export { C as CallbackError, U as UseSolanaWalletsInterface, u as useSolanaWallets } from './useSolanaWallets-CbaQnTe_.js';
21
22
  import '@coinbase/wallet-sdk';
22
23
  import '@solana/wallet-adapter-base';
23
24
  import '@solana/wallet-standard-features';
@@ -1440,7 +1441,8 @@ declare class ConnectorManager extends EventEmitter<ConnectorManagerEvents> {
1440
1441
  private privyAppName;
1441
1442
  private walletChainType;
1442
1443
  private externalWalletConfig;
1443
- constructor(privyAppId: string, walletConnectCloudProjectId: string, rpcConfig: RpcConfig, chains: Chain[], defaultChain: Chain, store: Store, walletList: WalletListEntry[], shouldEnforceDefaultChainOnConnect: boolean, externalWalletConfig: AppConfig['externalWallets'], privyAppName: string, walletChainType?: 'ethereum-and-solana' | 'ethereum-only' | 'solana-only');
1444
+ private appKit?;
1445
+ constructor(privyAppId: string, walletConnectCloudProjectId: string, rpcConfig: RpcConfig, chains: Chain[], defaultChain: Chain, store: Store, walletList: WalletListEntry[], shouldEnforceDefaultChainOnConnect: boolean, externalWalletConfig: AppConfig['externalWallets'], privyAppName: string, walletChainType?: 'ethereum-and-solana' | 'ethereum-only' | 'solana-only', appKit?: AppKit);
1444
1446
  /**
1445
1447
  * The core wallets array that is exposed to developers. It builds
1446
1448
  * the wallets away with the following logic:
@@ -2565,7 +2567,7 @@ declare class PrivyClient {
2565
2567
  * config. We can set this once and only once. If it is set twice, event listeners will be created
2566
2568
  * on the first ConnectorManager and are not re-created.
2567
2569
  */
2568
- initializeConnectorManager({ walletConnectCloudProjectId, rpcConfig, chains, defaultChain, store, walletList, shouldEnforceDefaultChainOnConnect, externalWalletConfig, appName, walletChainType, }: {
2570
+ initializeConnectorManager({ walletConnectCloudProjectId, rpcConfig, chains, defaultChain, store, walletList, shouldEnforceDefaultChainOnConnect, externalWalletConfig, appName, walletChainType, appKit, }: {
2569
2571
  walletConnectCloudProjectId: string;
2570
2572
  rpcConfig: RpcConfig;
2571
2573
  chains: Chain[];
@@ -2576,6 +2578,7 @@ declare class PrivyClient {
2576
2578
  externalWalletConfig: AppConfig['externalWallets'];
2577
2579
  appName: string;
2578
2580
  walletChainType: 'ethereum-and-solana' | 'ethereum-only' | 'solana-only';
2581
+ appKit?: AppKit;
2579
2582
  }): void;
2580
2583
  generateApi(): Http;
2581
2584
  /**
@@ -1,9 +1,10 @@
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-BWtvBcM8.js';
4
- export { ax as Apple, aI as AppleOAuthWithMetadata, aQ as ContractUIOptions, aA as CrossAppAccount, aL as CrossAppAccountWithMetadata, au as Discord, aE as DiscordOAuthWithMetadata, aN as Email, ap as EmailWithMetadata, aU as Farcaster, aJ as FarcasterWithMetadata, av as Github, aF as GithubOAuthWithMetadata, as as Google, aC as GoogleOAuthWithMetadata, aB as LinkedAccountType, b as LinkedAccountWithMetadata, aw as LinkedIn, aH as LinkedInOAuthWithMetadata, aW as LoginMethodOrderOption, ag as MessageTypes, ai as MoonpayConfig, aj as MoonpayCurrencyCode, aS as MoonpayFundingConfig, ak as MoonpayPaymentMethod, aR as NativeFundingConfig, ao as NonEmptyArray, aV as Passkey, aM as PasskeyWithMetadata, aO as Phone, aq as PhoneWithMetadata, aT as PriceDisplayOptions, P as PrivyErrorCode, al as Quantity, ah as SmartWallet, f as SolanaCluster, k as SolanaFundingConfig, S as SolanaTransactionReceipt, e as SupportedSolanaTransaction, az as Telegram, aK as TelegramWithMetadata, ay as Tiktok, aG as TiktokOAuthWithMetadata, am as TransactionLog, an as TransactionReceipt, aP as TransactionUIOptions, at as Twitter, aD as TwitterOAuthWithMetadata, af as TypedMessage, ar as WalletWithMetadata } from './types-BWtvBcM8.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-CCLHKw4p.js';
4
+ export { ax as Apple, aI as AppleOAuthWithMetadata, aQ as ContractUIOptions, aA as CrossAppAccount, aL as CrossAppAccountWithMetadata, au as Discord, aE as DiscordOAuthWithMetadata, aN as Email, ap as EmailWithMetadata, aU as Farcaster, aJ as FarcasterWithMetadata, av as Github, aF as GithubOAuthWithMetadata, as as Google, aC as GoogleOAuthWithMetadata, aB as LinkedAccountType, b as LinkedAccountWithMetadata, aw as LinkedIn, aH as LinkedInOAuthWithMetadata, aW as LoginMethodOrderOption, ag as MessageTypes, ai as MoonpayConfig, aj as MoonpayCurrencyCode, aS as MoonpayFundingConfig, ak as MoonpayPaymentMethod, aR as NativeFundingConfig, ao as NonEmptyArray, aV as Passkey, aM as PasskeyWithMetadata, aO as Phone, aq as PhoneWithMetadata, aT as PriceDisplayOptions, P as PrivyErrorCode, al as Quantity, ah as SmartWallet, f as SolanaCluster, k as SolanaFundingConfig, S as SolanaTransactionReceipt, e as SupportedSolanaTransaction, az as Telegram, aK as TelegramWithMetadata, ay as Tiktok, aG as TiktokOAuthWithMetadata, am as TransactionLog, an as TransactionReceipt, aP as TransactionUIOptions, at as Twitter, aD as TwitterOAuthWithMetadata, af as TypedMessage, ar as WalletWithMetadata } from './types-CCLHKw4p.js';
5
5
  import * as react_jsx_runtime from 'react/jsx-runtime';
6
6
  import { TurnstileProps } from '@marsidev/react-turnstile';
7
+ import { AppKit } from '@reown/appkit';
7
8
  import EventEmitter from 'eventemitter3';
8
9
  import { Store, EIP6963ProviderDetail } from 'mipd';
9
10
  import Privy, { Chain, RpcConfig } from '@privy-io/js-sdk-core';
@@ -16,8 +17,8 @@ import * as _simplewebauthn_types from '@simplewebauthn/types';
16
17
  import { PublicKeyCredentialRequestOptionsJSON } from '@simplewebauthn/types';
17
18
  import { Cluster } from '@solana/web3.js';
18
19
  import { FetchOptions } from 'ofetch';
19
- import { P as PrivyEvents } from './useSolanaWallets-mdkbgoJN.js';
20
- export { C as CallbackError, U as UseSolanaWalletsInterface, u as useSolanaWallets } from './useSolanaWallets-mdkbgoJN.js';
20
+ import { P as PrivyEvents } from './useSolanaWallets-CbaQnTe_.js';
21
+ export { C as CallbackError, U as UseSolanaWalletsInterface, u as useSolanaWallets } from './useSolanaWallets-CbaQnTe_.js';
21
22
  import '@coinbase/wallet-sdk';
22
23
  import '@solana/wallet-adapter-base';
23
24
  import '@solana/wallet-standard-features';
@@ -1440,7 +1441,8 @@ declare class ConnectorManager extends EventEmitter<ConnectorManagerEvents> {
1440
1441
  private privyAppName;
1441
1442
  private walletChainType;
1442
1443
  private externalWalletConfig;
1443
- constructor(privyAppId: string, walletConnectCloudProjectId: string, rpcConfig: RpcConfig, chains: Chain[], defaultChain: Chain, store: Store, walletList: WalletListEntry[], shouldEnforceDefaultChainOnConnect: boolean, externalWalletConfig: AppConfig['externalWallets'], privyAppName: string, walletChainType?: 'ethereum-and-solana' | 'ethereum-only' | 'solana-only');
1444
+ private appKit?;
1445
+ constructor(privyAppId: string, walletConnectCloudProjectId: string, rpcConfig: RpcConfig, chains: Chain[], defaultChain: Chain, store: Store, walletList: WalletListEntry[], shouldEnforceDefaultChainOnConnect: boolean, externalWalletConfig: AppConfig['externalWallets'], privyAppName: string, walletChainType?: 'ethereum-and-solana' | 'ethereum-only' | 'solana-only', appKit?: AppKit);
1444
1446
  /**
1445
1447
  * The core wallets array that is exposed to developers. It builds
1446
1448
  * the wallets away with the following logic:
@@ -2565,7 +2567,7 @@ declare class PrivyClient {
2565
2567
  * config. We can set this once and only once. If it is set twice, event listeners will be created
2566
2568
  * on the first ConnectorManager and are not re-created.
2567
2569
  */
2568
- initializeConnectorManager({ walletConnectCloudProjectId, rpcConfig, chains, defaultChain, store, walletList, shouldEnforceDefaultChainOnConnect, externalWalletConfig, appName, walletChainType, }: {
2570
+ initializeConnectorManager({ walletConnectCloudProjectId, rpcConfig, chains, defaultChain, store, walletList, shouldEnforceDefaultChainOnConnect, externalWalletConfig, appName, walletChainType, appKit, }: {
2569
2571
  walletConnectCloudProjectId: string;
2570
2572
  rpcConfig: RpcConfig;
2571
2573
  chains: Chain[];
@@ -2576,6 +2578,7 @@ declare class PrivyClient {
2576
2578
  externalWalletConfig: AppConfig['externalWallets'];
2577
2579
  appName: string;
2578
2580
  walletChainType: 'ethereum-and-solana' | 'ethereum-only' | 'solana-only';
2581
+ appKit?: AppKit;
2579
2582
  }): void;
2580
2583
  generateApi(): Http;
2581
2584
  /**
@@ -7,8 +7,9 @@ import { SmartAccount, SendUserOperationParameters } from 'viem/account-abstract
7
7
  import * as viem from 'viem';
8
8
  import { SendTransactionParameters, Chain, Hash, SignableMessage, Hex, TypedData, SignTypedDataParameters, EIP1193Provider, PublicClient, Client } from 'viem';
9
9
  import { SmartWalletType } from '@privy-io/js-sdk-core';
10
- import { h as SendTransactionModalUIOptions, i as SignMessageModalUIOptions } from './types-BWtvBcM8.js';
10
+ import { h as SendTransactionModalUIOptions, i as SignMessageModalUIOptions } from './types-CCLHKw4p.js';
11
11
  import '@coinbase/wallet-sdk';
12
+ import '@reown/appkit';
12
13
  import '@solana/wallet-adapter-base';
13
14
  import '@privy-io/public-api';
14
15
  import '@solana/wallet-standard-features';
@@ -7,8 +7,9 @@ import { SmartAccount, SendUserOperationParameters } from 'viem/account-abstract
7
7
  import * as viem from 'viem';
8
8
  import { SendTransactionParameters, Chain, Hash, SignableMessage, Hex, TypedData, SignTypedDataParameters, EIP1193Provider, PublicClient, Client } from 'viem';
9
9
  import { SmartWalletType } from '@privy-io/js-sdk-core';
10
- import { h as SendTransactionModalUIOptions, i as SignMessageModalUIOptions } from './types-BWtvBcM8.js';
10
+ import { h as SendTransactionModalUIOptions, i as SignMessageModalUIOptions } from './types-CCLHKw4p.js';
11
11
  import '@coinbase/wallet-sdk';
12
+ import '@reown/appkit';
12
13
  import '@solana/wallet-adapter-base';
13
14
  import '@privy-io/public-api';
14
15
  import '@solana/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-BWtvBcM8.js';
2
- export { C as ConnectedSolanaWallet, l as SolanaAdapterConnector, t as toSolanaWalletConnectors } from './types-BWtvBcM8.js';
3
- import { P as PrivyEvents } from './useSolanaWallets-mdkbgoJN.js';
4
- export { U as UseSolanaWalletsInterface, u as useSolanaWallets } from './useSolanaWallets-mdkbgoJN.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-CCLHKw4p.js';
2
+ export { C as ConnectedSolanaWallet, l as SolanaAdapterConnector, t as toSolanaWalletConnectors } from './types-CCLHKw4p.js';
3
+ import { P as PrivyEvents } from './useSolanaWallets-CbaQnTe_.js';
4
+ export { U as UseSolanaWalletsInterface, u as useSolanaWallets } from './useSolanaWallets-CbaQnTe_.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';
@@ -9,6 +9,7 @@ import { Transaction, VersionedTransaction, Cluster, SendOptions, TransactionSig
9
9
  import EventEmitter from 'eventemitter3';
10
10
  import { SendTransactionOptions } from '@solana/wallet-adapter-base';
11
11
  import '@coinbase/wallet-sdk';
12
+ import '@reown/appkit';
12
13
  import 'react';
13
14
  import 'viem';
14
15
  import '@privy-io/js-sdk-core';
@@ -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-BWtvBcM8.js';
2
- export { C as ConnectedSolanaWallet, l as SolanaAdapterConnector, t as toSolanaWalletConnectors } from './types-BWtvBcM8.js';
3
- import { P as PrivyEvents } from './useSolanaWallets-mdkbgoJN.js';
4
- export { U as UseSolanaWalletsInterface, u as useSolanaWallets } from './useSolanaWallets-mdkbgoJN.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-CCLHKw4p.js';
2
+ export { C as ConnectedSolanaWallet, l as SolanaAdapterConnector, t as toSolanaWalletConnectors } from './types-CCLHKw4p.js';
3
+ import { P as PrivyEvents } from './useSolanaWallets-CbaQnTe_.js';
4
+ export { U as UseSolanaWalletsInterface, u as useSolanaWallets } from './useSolanaWallets-CbaQnTe_.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';
@@ -9,6 +9,7 @@ import { Transaction, VersionedTransaction, Cluster, SendOptions, TransactionSig
9
9
  import EventEmitter from 'eventemitter3';
10
10
  import { SendTransactionOptions } from '@solana/wallet-adapter-base';
11
11
  import '@coinbase/wallet-sdk';
12
+ import '@reown/appkit';
12
13
  import 'react';
13
14
  import 'viem';
14
15
  import '@privy-io/js-sdk-core';
@@ -1,4 +1,5 @@
1
1
  import { createCoinbaseWalletSDK } from '@coinbase/wallet-sdk';
2
+ import { AppKit } from '@reown/appkit';
2
3
  import { StandardWalletAdapter, Adapter, WalletError, MessageSignerWalletAdapterProps, WalletAdapterProps, SignerWalletAdapterProps } from '@solana/wallet-adapter-base';
3
4
  import { ReactElement } from 'react';
4
5
  import { Hex } from 'viem';
@@ -1272,6 +1273,10 @@ type ExternalWalletsConfig = {
1272
1273
  * @experimental This feature is very experimental and may break your wallet connector experience if you use external wallets.
1273
1274
  */
1274
1275
  enabled: boolean;
1276
+ /**
1277
+ * @experimental This feature is very experimental and may break your wallet connector experience if you use external wallets.
1278
+ */
1279
+ appKit?: AppKit;
1275
1280
  };
1276
1281
  solana?: {
1277
1282
  connectors?: SolanaWalletConnectorsConfig;
@@ -1803,6 +1808,7 @@ type AppConfig = {
1803
1808
  };
1804
1809
  walletConnect: {
1805
1810
  enabled: boolean;
1811
+ appKit?: AppKit;
1806
1812
  };
1807
1813
  solana: {
1808
1814
  connectors: NonNullable<NonNullable<PrivyClientConfig['externalWallets']>['solana']>['connectors'];
@@ -1,4 +1,5 @@
1
1
  import { createCoinbaseWalletSDK } from '@coinbase/wallet-sdk';
2
+ import { AppKit } from '@reown/appkit';
2
3
  import { StandardWalletAdapter, Adapter, WalletError, MessageSignerWalletAdapterProps, WalletAdapterProps, SignerWalletAdapterProps } from '@solana/wallet-adapter-base';
3
4
  import { ReactElement } from 'react';
4
5
  import { Hex } from 'viem';
@@ -1272,6 +1273,10 @@ type ExternalWalletsConfig = {
1272
1273
  * @experimental This feature is very experimental and may break your wallet connector experience if you use external wallets.
1273
1274
  */
1274
1275
  enabled: boolean;
1276
+ /**
1277
+ * @experimental This feature is very experimental and may break your wallet connector experience if you use external wallets.
1278
+ */
1279
+ appKit?: AppKit;
1275
1280
  };
1276
1281
  solana?: {
1277
1282
  connectors?: SolanaWalletConnectorsConfig;
@@ -1803,6 +1808,7 @@ type AppConfig = {
1803
1808
  };
1804
1809
  walletConnect: {
1805
1810
  enabled: boolean;
1811
+ appKit?: AppKit;
1806
1812
  };
1807
1813
  solana: {
1808
1814
  connectors: NonNullable<NonNullable<PrivyClientConfig['externalWallets']>['solana']>['connectors'];
package/dist/dts/ui.d.mts CHANGED
@@ -1,8 +1,9 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import { R as RuntimeLoginOverridableOptions } from './types-BWtvBcM8.js';
2
+ import { R as RuntimeLoginOverridableOptions } from './types-CCLHKw4p.js';
3
3
  import { Hex } from 'viem';
4
4
  import { Chain, Cluster } from '@privy-io/js-sdk-core';
5
5
  import '@coinbase/wallet-sdk';
6
+ import '@reown/appkit';
6
7
  import '@solana/wallet-adapter-base';
7
8
  import 'react';
8
9
  import '@privy-io/public-api';
package/dist/dts/ui.d.ts CHANGED
@@ -1,8 +1,9 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import { R as RuntimeLoginOverridableOptions } from './types-BWtvBcM8.js';
2
+ import { R as RuntimeLoginOverridableOptions } from './types-CCLHKw4p.js';
3
3
  import { Hex } from 'viem';
4
4
  import { Chain, Cluster } from '@privy-io/js-sdk-core';
5
5
  import '@coinbase/wallet-sdk';
6
+ import '@reown/appkit';
6
7
  import '@solana/wallet-adapter-base';
7
8
  import 'react';
8
9
  import '@privy-io/public-api';
@@ -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-BWtvBcM8.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-CCLHKw4p.js';
3
3
  import { MouseEvent } from 'react';
4
4
 
5
5
  /**
@@ -1,5 +1,5 @@
1
1
  import { Chain } from '@privy-io/js-sdk-core';
2
- import { P as PrivyErrorCode, U as User, a as LoginMethod, b as LinkedAccountWithMetadata, B as BaseConnectedEthereumWallet, c as BaseConnectedSolanaWallet, W as Wallet, M as MfaMethod, d as UserRecoveryMethod, S as SolanaTransactionReceipt, e as SupportedSolanaTransaction, O as OAuthTokens, F as FundingMethod, f as SolanaCluster, C as ConnectedSolanaWallet, g as CreateWalletOptions } from './types-BWtvBcM8.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-CCLHKw4p.js';
3
3
  import { MouseEvent } from 'react';
4
4
 
5
5
  /**
@@ -1 +1 @@
1
- import{createAbstractClient as e}from"@abstract-foundation/agw-client";import{getBatchTransactionObject as o}from"@abstract-foundation/agw-client/actions";import{hexToNumber as r,createWalletClient as t,custom as n,http as i}from"viem";import{toAccount as a}from"viem/accounts";import{abstractTestnet as s}from"viem/chains";import{u as c,f as l,l as d,au as p,m,v as u,a as h,aH as y,aI as I,aJ as g,n as v}from"./privy-provider-DzVKnifk.mjs";import{u as f}from"./internal-context-pX7RZwl3.mjs";import{g as w}from"./getEmbeddedConnectedWallet-CSSBWE2p.mjs";import{c as C}from"./smart-wallets-VdR-GNdn.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"@privy-io/ethereum";import"@marsidev/react-turnstile";import"styled-components";import"tinycolor2";import"@heroicons/react/24/outline/DevicePhoneMobileIcon";import"@heroicons/react/24/outline/FingerPrintIcon";import"@heroicons/react/24/outline/PhoneIcon";import"@heroicons/react/24/outline/ShieldCheckIcon";import"@heroicons/react/24/outline/ArrowLeftIcon";import"@heroicons/react/24/outline/ArrowRightIcon";import"@heroicons/react/24/outline/QuestionMarkCircleIcon";import"@heroicons/react/24/outline/XMarkIcon";import"@heroicons/react/24/outline/ChevronDownIcon";import"@heroicons/react/24/outline/CalendarIcon";import"@heroicons/react/24/outline/ExclamationTriangleIcon";import"@headlessui/react";import"@walletconnect/ethereum-provider";import"zustand";import"fast-password-entropy";import"secure-password-utilities";import"secure-password-utilities/wordlists";import"@heroicons/react/24/outline/UserCircleIcon";import"@heroicons/react/24/outline/EnvelopeIcon";import"@heroicons/react/20/solid/CheckIcon";import"@heroicons/react/24/outline/WalletIcon";import"@heroicons/react/24/outline/CheckIcon";import"@heroicons/react/24/outline/Square2StackIcon";import"@heroicons/react/24/outline/ExclamationCircleIcon";import"@heroicons/react/24/outline/ArrowTopRightOnSquareIcon";import"@heroicons/react/24/solid/DocumentCheckIcon";import"@heroicons/react/24/solid/XCircleIcon";import"@heroicons/react/24/solid/CheckCircleIcon";import"qrcode";import"@heroicons/react/24/solid/ArrowsRightLeftIcon";import"@heroicons/react/24/outline/ChevronRightIcon";import"@heroicons/react/24/outline/LockClosedIcon";import"@heroicons/react/24/outline/PencilSquareIcon";import"@heroicons/react/24/outline/ArrowPathIcon";import"@heroicons/react/24/outline/EyeIcon";import"@heroicons/react/24/outline/EyeSlashIcon";import"@heroicons/react/24/outline/KeyIcon";import"@heroicons/react/24/outline/ArrowDownTrayIcon";import"@heroicons/react/24/outline/ClipboardDocumentCheckIcon";import"@heroicons/react/24/outline/DocumentDuplicateIcon";import"@heroicons/react/24/solid/LockClosedIcon";import"@heroicons/react/24/outline/CheckCircleIcon";import"@heroicons/react/24/outline/InformationCircleIcon";import"@heroicons/react/24/outline/CreditCardIcon";import"@heroicons/react/24/outline/QrCodeIcon";import"@heroicons/react/24/outline/GlobeAltIcon";import"ofetch";import"@heroicons/react/24/outline";import"@heroicons/react/24/outline/ClipboardDocumentIcon";import"@heroicons/react/24/outline/CloudArrowUpIcon";import"@heroicons/react/24/outline/NoSymbolIcon";import"@heroicons/react/24/outline/ClockIcon";import"@heroicons/react/24/outline/TrashIcon";import"@heroicons/react/24/solid/CheckBadgeIcon";import"@heroicons/react/24/solid/IdentificationIcon";import"@heroicons/react/24/outline/MinusCircleIcon";import"@heroicons/react/24/outline/ArrowRightEndOnRectangleIcon";import"@heroicons/react/24/solid/ShieldCheckIcon";import"js-cookie";import"permissionless";import"permissionless/accounts";import"permissionless/clients/pimlico";import"viem/account-abstraction";function T(){let{user:T}=c(),{hideWalletUIs:S,openPrivyModal:P,chains:b,appId:A,rpcConfig:W,client:M}=f(),k=l(),{wallets:F}=d(),{setModalData:q}=p(),x=m(T),R=!!x&&u(x),D=async(o=s.id)=>{let c=w(F);if(!c)throw Error("No connected wallet found");let l="string"==typeof o?r(o):o;if(![s.id,2741].includes(l))throw Error("Error, only Abstract chains are supported");let d=b.find((e=>e.id===l));if(!d)throw Error("Chain not configured");await c.switchChain(d.id);let p=await c.getEthereumProvider(),m=t({account:c.address,transport:n(p)}),u=a({address:c.address,signMessage:m.signMessage,signTransaction:m.signTransaction,signTypedData:m.signTypedData});return await e({chain:d,transport:i(v(d,W,A)),publicTransport:i(v(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);S.current=!0,q({connectWallet:{recoveryMethod:x.recoveryMethod,connectingWalletAddress:x.address,isUnifiedWallet:R,entropyId:n,entropyIdVerifier:i,onCompleteNavigateTo:y,onFailure:()=>{}},signMessage:{method:"personal_sign",data:e,confirmAndSign:()=>r.signMessage({message:e}),onSuccess:e=>o(e),onFailure:t,uiOptions:{isCancellable:!0}}}),P(I)})).finally((()=>{S.current=!1}))},signTypedData:async(e,o)=>{let r=await D(o);return new Promise((async(o,t)=>{S.current=!0;let{entropyId:n,entropyIdVerifier:i}=h(T);q({connectWallet:{recoveryMethod:x.recoveryMethod,connectingWalletAddress:x.address,isUnifiedWallet:R,entropyId:n,entropyIdVerifier:i,onCompleteNavigateTo:y,onFailure:()=>{}},signMessage:{method:"eth_signTypedData_v4",data:e,confirmAndSign:()=>r.signTypedData(e),onSuccess:e=>o(e),onFailure:t,uiOptions:{isCancellable:!0}}}),P(I)})).finally((()=>{S.current=!1}))},sendTransaction:async e=>{let r=await D(e.chainId),t=[],n="calls"in e&&void 0!==e.calls;return t=n?[...e.calls]:[e],new Promise((async(i,a)=>{S.current=!0;let{entropyId:s,entropyIdVerifier:c}=h(T);q({connectWallet:{recoveryMethod:x.recoveryMethod,connectingWalletAddress:x.address,isUnifiedWallet:R,entropyId:s,entropyIdVerifier:c,onCompleteNavigateTo:g,onFailure:()=>{}},sendTransaction:{transactionRequests:C({calls:t,chain:r.chain,maxPriorityFeePerGas:e.maxPriorityFeePerGas,maxFeePerGas:e.maxFeePerGas,nonce:e.nonce?BigInt(e.nonce):void 0}),entropyId:s,entropyIdVerifier:c,transactingWalletAddress:r.account.address,transactingWalletIndex:void 0,prepareTransactionRequest:async()=>{let t=n?o(r.account.address,e):e;return await r.prepareAbstractTransactionRequest({...t,isSponsored:void 0!==t.paymaster&&void 0!==t.paymasterInput})},scanTransaction:async()=>{if(!M)throw Error("Privy client not found");let t=n?o(r.account.address,e):e,i=await r.prepareAbstractTransactionRequest({...t,isSponsored:void 0!==t.paymaster&&void 0!==t.paymasterInput});return await M.scanTransaction({metadata:{domain:k.embeddedWallets.transactionScanning.domain},chain_id:e.chainId.toString(),request:{method:"eth_sendTransaction",params:[{from:i.from,to:i.to,value:i.value?.toString(),gas:i.gas?.toString(),gasPrice:i.gasPrice?.toString(),nonce:i.nonce?.toString(),data:i.data,eip_712_meta:{paymaster_params:{paymaster:i.paymaster,paymaster_input:i.paymasterInput}}}]}})},signOnly:!1,getIsSponsored:async()=>void 0!==e.paymaster&&void 0!==e.paymasterInput,onConfirm:()=>n?r.sendTransactionBatch(e):r.sendTransaction(e),onSuccess:e=>i(e.hash),onFailure:a,uiOptions:{isCancellable:!0}}}),P(I)})).finally((()=>{S.current=!1}))},signTransaction:async e=>{let r=await D(e.chainId),t=[],n="calls"in e&&void 0!==e.calls;return t=n?[...e.calls]:[e],new Promise((async(i,a)=>{S.current=!0;let{entropyId:s,entropyIdVerifier:c}=h(T);q({connectWallet:{recoveryMethod:x.recoveryMethod,connectingWalletAddress:x.address,isUnifiedWallet:R,entropyId:s,entropyIdVerifier:c,onCompleteNavigateTo:g,onFailure:()=>{}},sendTransaction:{transactionRequests:C({calls:t,chain:r.chain,maxPriorityFeePerGas:e.maxPriorityFeePerGas,maxFeePerGas:e.maxFeePerGas,nonce:e.nonce?BigInt(e.nonce):void 0}),entropyId:s,entropyIdVerifier:c,transactingWalletAddress:r.account.address,transactingWalletIndex:void 0,prepareTransactionRequest:async()=>{let t=n?o(r.account.address,e):e;return await r.prepareAbstractTransactionRequest({...t,isSponsored:void 0!==t.paymaster&&void 0!==t.paymasterInput})},scanTransaction:async()=>{if(!M)throw Error("Privy client not found");let t=n?o(r.account.address,e):e,i=await r.prepareAbstractTransactionRequest({...t,isSponsored:void 0!==t.paymaster&&void 0!==t.paymasterInput});return await M.scanTransaction({metadata:{domain:k.embeddedWallets.transactionScanning.domain},chain_id:e.chainId.toString(),request:{method:"eth_sendTransaction",params:[{from:i.from,to:i.to,value:i.value?.toString(),gas:i.gas?.toString(),gasPrice:i.gasPrice?.toString(),nonce:i.nonce?.toString(),data:i.data}]}})},signOnly:!0,getIsSponsored:async()=>void 0!==e.paymaster&&void 0!==e.paymasterInput,onConfirm:async()=>{let t=n?o(r.account.address,e):e,i=await r.prepareAbstractTransactionRequest({...t,isSponsored:void 0!==t.paymaster&&void 0!==t.paymasterInput});return r.signTransaction(i)},onSuccess:e=>i(e.hash),onFailure:a,uiOptions:{isCancellable:!0}}}),P(I)})).finally((()=>{S.current=!1}))}}}export{T as useAbstractSmartWallets};
1
+ import{createAbstractClient as e}from"@abstract-foundation/agw-client";import{getBatchTransactionObject as o}from"@abstract-foundation/agw-client/actions";import{hexToNumber as r,createWalletClient as t,custom as n,http as i}from"viem";import{toAccount as a}from"viem/accounts";import{abstractTestnet as s}from"viem/chains";import{u as c,f as l,l as d,au as p,m,v as u,a as h,aH as y,aI as I,aJ as g,n as v}from"./privy-provider-D_ew0EI2.mjs";import{u as f}from"./internal-context-pX7RZwl3.mjs";import{g as w}from"./getEmbeddedConnectedWallet-CSSBWE2p.mjs";import{c as C}from"./smart-wallets-B3J4MB2p.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"@privy-io/ethereum";import"@marsidev/react-turnstile";import"styled-components";import"tinycolor2";import"@heroicons/react/24/outline/DevicePhoneMobileIcon";import"@heroicons/react/24/outline/FingerPrintIcon";import"@heroicons/react/24/outline/PhoneIcon";import"@heroicons/react/24/outline/ShieldCheckIcon";import"@heroicons/react/24/outline/ArrowLeftIcon";import"@heroicons/react/24/outline/ArrowRightIcon";import"@heroicons/react/24/outline/QuestionMarkCircleIcon";import"@heroicons/react/24/outline/XMarkIcon";import"@heroicons/react/24/outline/ChevronDownIcon";import"@heroicons/react/24/outline/CalendarIcon";import"@heroicons/react/24/outline/ExclamationTriangleIcon";import"@headlessui/react";import"@walletconnect/ethereum-provider";import"zustand";import"fast-password-entropy";import"secure-password-utilities";import"secure-password-utilities/wordlists";import"@heroicons/react/24/outline/UserCircleIcon";import"@heroicons/react/24/outline/EnvelopeIcon";import"@heroicons/react/20/solid/CheckIcon";import"@heroicons/react/24/outline/WalletIcon";import"@heroicons/react/24/outline/CheckIcon";import"@heroicons/react/24/outline/Square2StackIcon";import"@heroicons/react/24/outline/ExclamationCircleIcon";import"@heroicons/react/24/outline/ArrowTopRightOnSquareIcon";import"@heroicons/react/24/solid/DocumentCheckIcon";import"@heroicons/react/24/solid/XCircleIcon";import"@heroicons/react/24/solid/CheckCircleIcon";import"qrcode";import"@heroicons/react/24/solid/ArrowsRightLeftIcon";import"@heroicons/react/24/outline/ChevronRightIcon";import"@heroicons/react/24/outline/LockClosedIcon";import"@heroicons/react/24/outline/PencilSquareIcon";import"@heroicons/react/24/outline/ArrowPathIcon";import"@heroicons/react/24/outline/EyeIcon";import"@heroicons/react/24/outline/EyeSlashIcon";import"@heroicons/react/24/outline/KeyIcon";import"@heroicons/react/24/outline/ArrowDownTrayIcon";import"@heroicons/react/24/outline/ClipboardDocumentCheckIcon";import"@heroicons/react/24/outline/DocumentDuplicateIcon";import"@heroicons/react/24/solid/LockClosedIcon";import"@heroicons/react/24/outline/CheckCircleIcon";import"@heroicons/react/24/outline/InformationCircleIcon";import"@heroicons/react/24/outline/CreditCardIcon";import"@heroicons/react/24/outline/QrCodeIcon";import"@heroicons/react/24/outline/GlobeAltIcon";import"ofetch";import"@heroicons/react/24/outline";import"@heroicons/react/24/outline/ClipboardDocumentIcon";import"@heroicons/react/24/outline/CloudArrowUpIcon";import"@heroicons/react/24/outline/NoSymbolIcon";import"@heroicons/react/24/outline/ClockIcon";import"@heroicons/react/24/outline/TrashIcon";import"@heroicons/react/24/solid/CheckBadgeIcon";import"@heroicons/react/24/solid/IdentificationIcon";import"@heroicons/react/24/outline/MinusCircleIcon";import"@heroicons/react/24/outline/ArrowRightEndOnRectangleIcon";import"@heroicons/react/24/solid/ShieldCheckIcon";import"js-cookie";import"permissionless";import"permissionless/accounts";import"permissionless/clients/pimlico";import"viem/account-abstraction";function T(){let{user:T}=c(),{hideWalletUIs:S,openPrivyModal:P,chains:b,appId:A,rpcConfig:W,client:M}=f(),k=l(),{wallets:F}=d(),{setModalData:q}=p(),x=m(T),R=!!x&&u(x),D=async(o=s.id)=>{let c=w(F);if(!c)throw Error("No connected wallet found");let l="string"==typeof o?r(o):o;if(![s.id,2741].includes(l))throw Error("Error, only Abstract chains are supported");let d=b.find((e=>e.id===l));if(!d)throw Error("Chain not configured");await c.switchChain(d.id);let p=await c.getEthereumProvider(),m=t({account:c.address,transport:n(p)}),u=a({address:c.address,signMessage:m.signMessage,signTransaction:m.signTransaction,signTypedData:m.signTypedData});return await e({chain:d,transport:i(v(d,W,A)),publicTransport:i(v(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);S.current=!0,q({connectWallet:{recoveryMethod:x.recoveryMethod,connectingWalletAddress:x.address,isUnifiedWallet:R,entropyId:n,entropyIdVerifier:i,onCompleteNavigateTo:y,onFailure:()=>{}},signMessage:{method:"personal_sign",data:e,confirmAndSign:()=>r.signMessage({message:e}),onSuccess:e=>o(e),onFailure:t,uiOptions:{isCancellable:!0}}}),P(I)})).finally((()=>{S.current=!1}))},signTypedData:async(e,o)=>{let r=await D(o);return new Promise((async(o,t)=>{S.current=!0;let{entropyId:n,entropyIdVerifier:i}=h(T);q({connectWallet:{recoveryMethod:x.recoveryMethod,connectingWalletAddress:x.address,isUnifiedWallet:R,entropyId:n,entropyIdVerifier:i,onCompleteNavigateTo:y,onFailure:()=>{}},signMessage:{method:"eth_signTypedData_v4",data:e,confirmAndSign:()=>r.signTypedData(e),onSuccess:e=>o(e),onFailure:t,uiOptions:{isCancellable:!0}}}),P(I)})).finally((()=>{S.current=!1}))},sendTransaction:async e=>{let r=await D(e.chainId),t=[],n="calls"in e&&void 0!==e.calls;return t=n?[...e.calls]:[e],new Promise((async(i,a)=>{S.current=!0;let{entropyId:s,entropyIdVerifier:c}=h(T);q({connectWallet:{recoveryMethod:x.recoveryMethod,connectingWalletAddress:x.address,isUnifiedWallet:R,entropyId:s,entropyIdVerifier:c,onCompleteNavigateTo:g,onFailure:()=>{}},sendTransaction:{transactionRequests:C({calls:t,chain:r.chain,maxPriorityFeePerGas:e.maxPriorityFeePerGas,maxFeePerGas:e.maxFeePerGas,nonce:e.nonce?BigInt(e.nonce):void 0}),entropyId:s,entropyIdVerifier:c,transactingWalletAddress:r.account.address,transactingWalletIndex:void 0,prepareTransactionRequest:async()=>{let t=n?o(r.account.address,e):e;return await r.prepareAbstractTransactionRequest({...t,isSponsored:void 0!==t.paymaster&&void 0!==t.paymasterInput})},scanTransaction:async()=>{if(!M)throw Error("Privy client not found");let t=n?o(r.account.address,e):e,i=await r.prepareAbstractTransactionRequest({...t,isSponsored:void 0!==t.paymaster&&void 0!==t.paymasterInput});return await M.scanTransaction({metadata:{domain:k.embeddedWallets.transactionScanning.domain},chain_id:e.chainId.toString(),request:{method:"eth_sendTransaction",params:[{from:i.from,to:i.to,value:i.value?.toString(),gas:i.gas?.toString(),gasPrice:i.gasPrice?.toString(),nonce:i.nonce?.toString(),data:i.data,eip_712_meta:{paymaster_params:{paymaster:i.paymaster,paymaster_input:i.paymasterInput}}}]}})},signOnly:!1,getIsSponsored:async()=>void 0!==e.paymaster&&void 0!==e.paymasterInput,onConfirm:()=>n?r.sendTransactionBatch(e):r.sendTransaction(e),onSuccess:e=>i(e.hash),onFailure:a,uiOptions:{isCancellable:!0}}}),P(I)})).finally((()=>{S.current=!1}))},signTransaction:async e=>{let r=await D(e.chainId),t=[],n="calls"in e&&void 0!==e.calls;return t=n?[...e.calls]:[e],new Promise((async(i,a)=>{S.current=!0;let{entropyId:s,entropyIdVerifier:c}=h(T);q({connectWallet:{recoveryMethod:x.recoveryMethod,connectingWalletAddress:x.address,isUnifiedWallet:R,entropyId:s,entropyIdVerifier:c,onCompleteNavigateTo:g,onFailure:()=>{}},sendTransaction:{transactionRequests:C({calls:t,chain:r.chain,maxPriorityFeePerGas:e.maxPriorityFeePerGas,maxFeePerGas:e.maxFeePerGas,nonce:e.nonce?BigInt(e.nonce):void 0}),entropyId:s,entropyIdVerifier:c,transactingWalletAddress:r.account.address,transactingWalletIndex:void 0,prepareTransactionRequest:async()=>{let t=n?o(r.account.address,e):e;return await r.prepareAbstractTransactionRequest({...t,isSponsored:void 0!==t.paymaster&&void 0!==t.paymasterInput})},scanTransaction:async()=>{if(!M)throw Error("Privy client not found");let t=n?o(r.account.address,e):e,i=await r.prepareAbstractTransactionRequest({...t,isSponsored:void 0!==t.paymaster&&void 0!==t.paymasterInput});return await M.scanTransaction({metadata:{domain:k.embeddedWallets.transactionScanning.domain},chain_id:e.chainId.toString(),request:{method:"eth_sendTransaction",params:[{from:i.from,to:i.to,value:i.value?.toString(),gas:i.gas?.toString(),gasPrice:i.gasPrice?.toString(),nonce:i.nonce?.toString(),data:i.data}]}})},signOnly:!0,getIsSponsored:async()=>void 0!==e.paymaster&&void 0!==e.paymasterInput,onConfirm:async()=>{let t=n?o(r.account.address,e):e,i=await r.prepareAbstractTransactionRequest({...t,isSponsored:void 0!==t.paymaster&&void 0!==t.paymasterInput});return r.signTransaction(i)},onSuccess:e=>i(e.hash),onFailure:a,uiOptions:{isCancellable:!0}}}),P(I)})).finally((()=>{S.current=!1}))}}}export{T as useAbstractSmartWallets};
@@ -1 +1 @@
1
- import{u as e,g as t,a as r,b as o,c as i,d as n,C as s,e as l,s as d,P as h,f as w,h as p,i as m,G as y,W as k,j as f,k as C,l as W,m as v,n as P,o as _,p as x,q as j,r as q,t as G,v as $,w as Y,x as Z,y as ee}from"./privy-provider-DzVKnifk.mjs";export{B as Captcha,D as ConnectorManager,F as EthereumWalletConnector,X as LoginModal,N as PrivyClient,z as PrivyProvider,V as VERSION,E as WalletConnector,L as errorIndicatesMaxMfaRetries,M as errorIndicatesMfaTimeout,K as errorIndicatesMfaVerificationFailed,A as getAccessToken,S as useCreateWallet,O as useIdentityToken,U as useImportWallet,Q as useLogout,I as useMfa,J as useMfaEnrollment,H as usePrivy,R as useRegisterMfaListener,T as useSolanaWallets}from"./privy-provider-DzVKnifk.mjs";import{useCallback as te,useMemo as re,useEffect as oe,useContext as ie,useState as ae,useRef as ne}from"react";import{u as se,P as le,a as ce,I as ue}from"./internal-context-pX7RZwl3.mjs";export{c as useActiveWallet,a as useConnectWallet,b as useFundWallet,u as useLogin}from"./useActiveWallet-DEjTs-_i.mjs";import{F as de}from"./frame-S_4wR3Zf.mjs";import{zeroAddress as he,getAddress as we,createWalletClient as pe,http as ge,parseSignature as me}from"viem";import{hashAuthorization as ye}from"viem/utils";import{getWallet as Ae,updateWallet as ke}from"@privy-io/js-sdk-core";export{DEFAULT_SUPPORTED_CHAINS as SUPPORTED_CHAINS,addPrivyRpcToChain,addRpcUrlOverrideToChain}from"@privy-io/js-sdk-core";export{g as getEmbeddedConnectedWallet}from"./getEmbeddedConnectedWallet-CSSBWE2p.mjs";import"react/jsx-runtime";import"mipd";import"react-device-detect";import"uuid";import"jose";import"eventemitter3";import"@coinbase/wallet-sdk";import"@privy-io/ethereum";import"@marsidev/react-turnstile";import"styled-components";import"tinycolor2";import"@heroicons/react/24/outline/DevicePhoneMobileIcon";import"@heroicons/react/24/outline/FingerPrintIcon";import"@heroicons/react/24/outline/PhoneIcon";import"@heroicons/react/24/outline/ShieldCheckIcon";import"@heroicons/react/24/outline/ArrowLeftIcon";import"@heroicons/react/24/outline/ArrowRightIcon";import"@heroicons/react/24/outline/QuestionMarkCircleIcon";import"@heroicons/react/24/outline/XMarkIcon";import"@heroicons/react/24/outline/ChevronDownIcon";import"@heroicons/react/24/outline/CalendarIcon";import"@heroicons/react/24/outline/ExclamationTriangleIcon";import"@headlessui/react";import"@walletconnect/ethereum-provider";import"zustand";import"fast-password-entropy";import"secure-password-utilities";import"secure-password-utilities/wordlists";import"@heroicons/react/24/outline/UserCircleIcon";import"@heroicons/react/24/outline/EnvelopeIcon";import"@heroicons/react/20/solid/CheckIcon";import"@heroicons/react/24/outline/WalletIcon";import"@heroicons/react/24/outline/CheckIcon";import"@heroicons/react/24/outline/Square2StackIcon";import"@heroicons/react/24/outline/ExclamationCircleIcon";import"@heroicons/react/24/outline/ArrowTopRightOnSquareIcon";import"@heroicons/react/24/solid/DocumentCheckIcon";import"@heroicons/react/24/solid/XCircleIcon";import"@heroicons/react/24/solid/CheckCircleIcon";import"qrcode";import"@heroicons/react/24/solid/ArrowsRightLeftIcon";import"@heroicons/react/24/outline/ChevronRightIcon";import"@heroicons/react/24/outline/LockClosedIcon";import"@heroicons/react/24/outline/PencilSquareIcon";import"@heroicons/react/24/outline/ArrowPathIcon";import"@heroicons/react/24/outline/EyeIcon";import"@heroicons/react/24/outline/EyeSlashIcon";import"@heroicons/react/24/outline/KeyIcon";import"@heroicons/react/24/outline/ArrowDownTrayIcon";import"@heroicons/react/24/outline/ClipboardDocumentCheckIcon";import"@heroicons/react/24/outline/DocumentDuplicateIcon";import"@heroicons/react/24/solid/LockClosedIcon";import"@heroicons/react/24/outline/CheckCircleIcon";import"@heroicons/react/24/outline/InformationCircleIcon";import"@heroicons/react/24/outline/CreditCardIcon";import"@heroicons/react/24/outline/QrCodeIcon";import"@heroicons/react/24/outline/GlobeAltIcon";import"ofetch";import"@heroicons/react/24/outline";import"@heroicons/react/24/outline/ClipboardDocumentIcon";import"@heroicons/react/24/outline/CloudArrowUpIcon";import"@heroicons/react/24/outline/NoSymbolIcon";import"@heroicons/react/24/outline/ClockIcon";import"@heroicons/react/24/outline/TrashIcon";import"@heroicons/react/24/solid/CheckBadgeIcon";import"@heroicons/react/24/solid/IdentificationIcon";import"@heroicons/react/24/outline/MinusCircleIcon";import"@heroicons/react/24/outline/ArrowRightEndOnRectangleIcon";import"@heroicons/react/24/solid/ShieldCheckIcon";import"js-cookie";const fe=()=>{let{user:o}=e(),{walletProxy:i}=se();return{recover:te((async e=>{if(!i)throw Error("Wallet proxy is not ready");let a=await t();if(!o||!a)throw new le("User must be logged in before attempting to modify the recovery method.");let{entropyId:n,entropyIdVerifier:s}=r(o);try{await i.recover({entropyId:n,entropyIdVerifier:s,accessToken:a,...e})}catch{throw new le("Unable to recover wallets")}}),[i,o])}},Ce=()=>{let{client:e,setAuthenticated:t,setUser:r}=se();return re((()=>({init:async()=>{if(!e)throw new le("Must initialize Privy client first.");let t=new de;return e.startAuthFlow(t),await t.init()},login:async({fid:o,message:i,signature:a})=>{if(!e)throw new le("Must initialize Privy client first.");if(!(e.authFlow instanceof de))throw new le("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 le("Failed to login with Farcaster V2");return r(n),t(!0),{user:n}}})),[e,r,t])},Ie=t=>{o("login",t);let r=i(),a=n(),{ready:c,user:u}=e(),{initLoginWithHeadlessOAuth:h,loginWithHeadlessOAuth:w,oAuthState:p,setOAuthState:g,isHeadlessOAuthLoading:m}=se(),y=te((async e=>{try{if(r.enabled&&"success"!==r.status)throw new s(r.error,null,ce.CAPTCHA_FAILURE);return await h(e.provider,r.token,e.disableSignup)}catch(e){throw g({status:"error",error:e}),e}}),[h,r]),A=te((async()=>{let e=l();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 g({status:"error",error:e}),e}try{return await w(e)}catch(e){throw g({status:"error",error:e}),e}finally{d()}}),[w]);return oe((()=>{let e=l();c&&a&&e.inProgress&&!e.withPrivyUi&&!e.popupFlow&&A().catch((()=>{}))}),[c,a]),{initOAuth:y,loading:m,state:p}},Ee=e=>{let t=i(),{emailOtpState:r,setEmailOtpState:o,initLoginWithEmail:a,loginWithCode:n}=se();return{sendCode:te((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 s(t.error,null,ce.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||ce.UNKNOWN_AUTH_ERROR),r}}),[a]),loginWithCode:te((async({code:r})=>{try{if(t.enabled&&"error"===t.status)throw new s(t.error,null,ce.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 o({status:"error",error:r}),e?.onError?.(r.privyErrorCode||ce.UNKNOWN_AUTH_ERROR),r}}),[n,t.status]),state:r}},We=e=>{let t=i(),{initSignupWithPasskey:r,signupWithPasskey:o,passkeyAuthState:a,setPasskeyAuthState:n}=se();return{signupWithPasskey:te((async()=>{try{let i;if(t.enabled&&"error"===t.status)throw new s(t.error,null,ce.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:l,loginAccount:c}=await o();e?.onComplete?.({user:a,isNewUser:n,wasAlreadyAuthenticated:l,loginMethod:"passkey",loginAccount:c})}catch(t){throw n({status:"error",error:t}),e?.onError?.(t.privyErrorCode||ce.UNKNOWN_AUTH_ERROR),t}}),[o,t.status]),state:a}},Te=e=>{let t=i(),{initLoginWithPasskey:r,loginWithPasskey:o,passkeyAuthState:a,setPasskeyAuthState:n}=se();return{loginWithPasskey:te((async i=>{try{let a;if(t.enabled&&"error"===t.status)throw new s(t.error,null,ce.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 o(i);e?.onComplete?.({user:n,isNewUser:l,wasAlreadyAuthenticated:c,loginMethod:"passkey",loginAccount:u})}catch(i){throw n({status:"error",error:i}),e?.onError?.(i.privyErrorCode||ce.UNKNOWN_AUTH_ERROR),i}}),[o,t.status]),state:a}},Ue=e=>{let{initLinkWithPasskey:t,linkWithPasskey:r,passkeyAuthState:o,setPasskeyAuthState:i}=se();return{linkWithPasskey:te((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||ce.UNKNOWN_AUTH_ERROR,{linkMethod:"passkey"}),t}}),[r]),state:o}},Se=e=>{let t=i(),{smsOtpState:r,setSmsOtpState:o,initLoginWithSms:a,loginWithCode:n}=se();return{sendCode:te((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 s(t.error,null,ce.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||ce.UNKNOWN_AUTH_ERROR),r}}),[a]),loginWithCode:te((async({code:r})=>{try{if(t.enabled&&"success"!==t.status)throw new s(t.error,null,ce.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 o({status:"error",error:r}),e?.onError?.(r.privyErrorCode||ce.UNKNOWN_AUTH_ERROR),r}}),[n,t.status]),state:r}},ve=t=>{let{connectOrCreateWallet:r}=e();return o("connectOrCreateWallet",t),{connectOrCreateWallet:r}},Re=e=>{let t=i(),{siweState:r,setSiweState:o,linkWithSiwe:a,generateSiweMessage:n}=se();return{generateSiweMessage:te((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||ce.UNKNOWN_AUTH_ERROR,{linkMethod:"siwe"}),t}}),[n]),linkWithSiwe:te((async({signature:r,message:i,chainId:n,walletClientType:l,connectorType:c})=>{try{if(t.enabled&&"success"!==t.status)throw new s(t.error,null,ce.CAPTCHA_FAILURE);let{user:o,linkedAccount:u}=await a({message:i,signature:r,chainId:n,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||ce.UNKNOWN_AUTH_ERROR,{linkMethod:"siwe"}),r}}),[a,t.status]),state:r}},Pe=e=>{let t=i(),{siweState:r,setSiweState:o,client:a,generateSiweMessage:n,loginWithSiwe:l}=se();return{generateSiweNonce:te((async r=>{try{let e;if(t.enabled&&"error"===t.status)throw new s(t.error,null,ce.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||ce.UNKNOWN_AUTH_ERROR),r}}),[a,t]),generateSiweMessage:te((async({address:t,chainId:r})=>{try{return await n({address:t,chainId:r})}catch(t){throw o({status:"error",error:t}),e?.onError?.(t.privyErrorCode||ce.UNKNOWN_AUTH_ERROR),t}}),[n]),loginWithSiwe:te((async({message:r,signature:i,disableSignup:a})=>{try{let o;if(t.enabled&&"error"===t.status)throw new s(t.error,null,ce.CAPTCHA_FAILURE);t.enabled&&"success"!==t.status&&(t.execute(),o=await t.waitForResult());let n=await l({message:r,signature:i,captchaToken:o,disableSignup:a});return e?.onComplete?.({user:n,isNewUser:!1,wasAlreadyAuthenticated:!1,loginMethod:"siwe",loginAccount:null}),n}catch(r){throw o({status:"error",error:r}),e?.onError?.(r.privyErrorCode||ce.UNKNOWN_AUTH_ERROR),r}}),[l,t.status]),state:r}};function be(){let{signTransaction:e}=ie(h);return{signTransaction:e}}function Ne(e){let{linkEmail:t,linkPhone:r,linkWallet:i,linkGoogle:a,linkApple:n,linkTwitter:s,linkDiscord:l,linkGithub:c,linkLinkedIn:u,linkTiktok:d,linkSpotify:w,linkInstagram:p,linkTelegram:g,linkFarcaster:m,linkPasskey:y}=ie(h);return o("linkAccount",e),{linkEmail:t,linkPhone:r,linkWallet:i,linkGoogle:a,linkApple:n,linkTwitter:s,linkDiscord:l,linkGithub:c,linkLinkedIn:u,linkTiktok:d,linkSpotify:w,linkInstagram:p,linkFarcaster:m,linkTelegram:g,linkPasskey:y}}function Oe(e){let{updateEmail:t,updatePhone:r}=ie(h);return o("update",e),{updateEmail:t,updatePhone:r}}const _e=()=>{let{connectCoinbaseSmartWallet:e}=se();return{connectCoinbaseSmartWallet:e}},Me=()=>{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 Fe(e){let{sendTransaction:t}=ie(h);return o("sendTransaction",e),{sendTransaction:t}}function Le(e){let{setWalletPassword:t}=ie(h);return o("setWalletPassword",e),{setWalletPassword:t}}function He(){let t=w(),{getAccessToken:r}=e(),o=p(),{client:i,setUser:a,setAuthenticated:n,setIsNewUser:s,initializeWalletProxy:l}=se(),{create:c}=m();return{createGuestAccount:async()=>{if(!t.id||!i)throw Error("SDK not yet ready");i.startAuthFlow(new y(t.id));try{let e=await i.authenticate(),u=e.user,d=e.isNewUser??!1;if(!u)throw new le("Unable to authenticate guest account");let h=await r(),w=await l(k);if(h&&w)try{let e=f(u,t.embeddedWallets.ethereum.createOnLogin),r=C(u,t.embeddedWallets.solana.createOnLogin);e&&r?(u=(await c({chainType:"ethereum",latestUser:u})).user,u=(await c({chainType:"solana",latestUser:u})).user):r?u=(await c({chainType:"solana",latestUser:u})).user:e?u=(await c({chainType:"ethereum",latestUser:u})).user:a(u)}catch(e){a(u),console.warn("Unable to create embedded wallet for guest account")}return s(d),n(!0),o("login","onComplete",{user:u,isNewUser:d,wasAlreadyAuthenticated:!1,loginMethod:"guest",loginAccount:null}),u}catch(e){throw o("login","onError",e.privyErrorCode||ce.UNKNOWN_AUTH_ERROR),e}}}}function De(e){let{setWalletRecovery:t}=ie(h);return o("setWalletRecovery",e),{setWalletRecovery:t}}function xe(e){let{signMessage:t}=ie(h);return o("signMessage",e),{signMessage:t}}const Ke=()=>{let{ready:t,wallets:r}=W(),{user:o}=e(),{rpcConfig:i,chains:a,appId:n}=se();return{signAuthorization:te((async(e,s)=>{let l;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??v(o)?.address??he,u=r.find((e=>we(e.address)===we(c)));if(!u)throw Error("Signing wallet not found.");let d=e.chainId??Number(u.chainId.split(":")[1]);if(0===d)l={chainId:0,address:e.contractAddress,nonce:e.nonce??0};else{let t=a.find((e=>e.id===d));if(!t)throw Error("Error, chain not configured in PrivyProvider config");let r=pe({account:c,chain:t,transport:ge(P(t,i,n))});l=await r.prepareAuthorization({...e})}let h=await u.getEthereumProvider(),w=await h.request({method:"secp256k1_sign",params:[ye(l)]});return{...l,...me(w)}}),[t,r,o,a])}};function ze(e){let{signTypedData:t}=ie(h);return o("signTypedData",e),{signTypedData:t}}const je=()=>{let{isModalOpen:e}=ie(h);return{isOpen:e}};function qe(e){let{getAccessToken:t}=ie(h);return o("accessToken",e),{getAccessToken:t}}function Ve(t){let{authenticated:r,user:i}=e(),{initLoginWithOAuth:a}=se(),n=p();return o("oAuthAuthorization",t),{reauthorize:e=>Ge(r,i,a,n,e.provider)}}let Ge=async(e,t,r,o,i)=>{if(!e)throw o("linkAccount","onError",ce.MUST_BE_AUTHENTICATED,{linkMethod:i}),new le("User must be authenticated before linking an account.");if(!t?.linkedAccounts.some((e=>e.type.includes(i))))throw new le(`OAuth account of type ${i} not linked to the account.`);await r(i)};function Be(e){let{client:t}=se(),[r,o]=ae({status:"initial"});return{linkWithCustomJwt:te((async r=>{try{o({status:"initial"}),t.startAuthFlow(new _(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||ce.UNKNOWN_AUTH_ERROR,{linkMethod:"custom"}),r}}),[t.startAuthFlow,t.link]),state:r}}const Qe=e=>{let t=x();return o("customAuth",e),{status:t}};function Xe({isAuthenticated:e,isLoading:t,...r}){let o=ne();oe((()=>{t||o.current?.()}),[e,t]);let i=te((e=>(o.current=e,()=>{o.current=void 0})),[]);return j({...r,subscribe:i})}function Je(){let{getFarcasterSignerPublicKey:t,signFarcasterMessage:r,requestFarcasterSignerFromWarpcast:o}=e();return{getFarcasterSignerPublicKey:t,signFarcasterMessage:r,requestFarcasterSignerFromWarpcast:o}}const $e=()=>{let{revokeDelegatedWallets:e,delegateWallet:t}=se();return{delegateWallet:async({address:e,chainType:r})=>await t({address:e,chainType:r,showDelegationUIs:!0}),revokeWallets:async()=>await e({showDelegationUIs:!0})}},Ye=()=>{let{addSessionSignersInternal:t,removeSessionSignersInternal:r}=(()=>{let{getAccessToken:t,user:r}=e(),o=se(),{signWithUserSigner:i}=q(),a=async({wallet:e,additional_signers:a})=>{let n=await t();if(!r||!n)throw new le("User must be authenticated and have an embedded wallet to delegate actions.");if(!e.id)throw new le("Wallet to add signers to must have ID on server");if(!o.walletProxy)throw new le("Wallet proxy not initialized.");await ke(o.privy,{wallet_id:e.id},i,{additional_signers:a})};return{addSessionSignersInternal:async({address:e,signers:i})=>{let n=await t();if(!r||!n)throw new le("User must be authenticated and have an embedded wallet to add a session signer.");let s=o.walletProxy??await o.initializeWalletProxy(15e3);if(!s)throw new le("Wallet proxy not initialized.");let l=G(r,e);if(!l)throw new le("Address to add signers too is not associated with current user.");if($(l)){if(0===i.length)throw new le("Must specify at least one signer to add.");let e=[...(await Ae(o.privy,{wallet_id:l.id})).additional_signers,...Y(i)];await a({wallet:l,additional_signers:e})}else{if(l.delegated)return{user:r};if(i.length>0)throw new le("This embedded wallet does not support specifying signers. If signing is enabled in the dashboard, signer will default to that key. Otherwise, no signatures will be required for the wallet.");let t=Z({address:e,user:r}),a=ee({address:e,user:r});await o.recoverEmbeddedWallet({address:e}),await s.createDelegatedAction({accessToken:n,rootWallet:a,delegatedWallets:[t]})}let c=await o.refreshSessionAndUser();if(!c)throw Error("Could not refresh user");return{user:c}},removeSessionSignersInternal:async({address:e})=>{let i=await t();if(!r||!i)throw new le("User must be authenticated and have an embedded wallet to delegate actions.");if(!(o.walletProxy??await o.initializeWalletProxy(15e3)))throw new le("Wallet proxy not initialized.");let n=G(r,e);if(!n)throw new le("Address to remove signers from is not associated with current user.");$(n)?await a({wallet:n,additional_signers:[]}):await o.client.revokeDelegatedWallet();let s=await o.refreshSessionAndUser();if(!s)throw Error("Could not refresh user");return{user:s}}}})();return{addSessionSigners:async({address:e,signers:r})=>t({address:e,signers:r}),removeSessionSigners:async({address:e})=>r({address:e})}},Ze=()=>{let{setUser:e,client:t}=ie(ue),{user:r}=ie(h);return{user:r,refreshUser:te((async()=>{let r=await(t?.updateUserAndIdToken());return e(r??null),r}),[t,e])}},et=e=>{let t=i(),{initLoginWithTelegram:r,loginWithTelegram:o,telegramAuthState:a,setTelegramAuthState:n}=se();return{login:te((async i=>{try{if(t.enabled&&"success"!==t.status)throw new s(t.error,null,ce.CAPTCHA_FAILURE);await r(t.token,i?.disableSignup);let{user:a,isNewUser:n,loginAccount:l,wasAlreadyAuthenticated:c}=await o({intent:"login"});e?.onComplete?.({user:a,isNewUser:n,wasAlreadyAuthenticated:c,loginMethod:"telegram",loginAccount:l})}catch(i){throw n({status:"error",error:i}),e?.onError?.(i.privyErrorCode||ce.UNKNOWN_AUTH_ERROR),i}}),[r,o,t]),state:a}},tt=()=>{let{revokeDelegatedWallets:e,delegateWallet:t}=se();return{delegateWallet:async({address:e,chainType:r})=>await t({address:e,chainType:r,showDelegationUIs:!1}),revokeWallets:async()=>await e({showDelegationUIs:!1})}};export{_e as useConnectCoinbaseSmartWallet,ve as useConnectOrCreateWallet,Me as useCrossAppAccounts,Qe as useCustomAuth,$e as useDelegatedActions,Je as useFarcasterSigner,He as useGuestAccounts,tt as useHeadlessDelegatedActions,Ne as useLinkAccount,Be as useLinkJwtAccount,Ue as useLinkWithPasskey,Re as useLinkWithSiwe,Ee as useLoginWithEmail,Ce as useLoginWithFarcasterV2,Ie as useLoginWithOAuth,Te as useLoginWithPasskey,Pe as useLoginWithSiwe,Se as useLoginWithSms,et as useLoginWithTelegram,je as useModalStatus,Ve as useOAuthTokens,fe as useRecoverEmbeddedWallet,Fe as useSendTransaction,Ye as useSessionSigners,Le as useSetWalletPassword,De as useSetWalletRecovery,Ke as useSignAuthorization,xe as useSignMessage,be as useSignTransaction,ze as useSignTypedData,We as useSignupWithPasskey,Xe as useSubscribeToJwtAuthWithFlag,j as useSyncJwtBasedAuthState,qe as useToken,Oe as useUpdateAccount,Ze as useUser,W as useWallets};
1
+ import{u as e,g as t,a as r,b as o,c as i,d as n,C as s,e as l,s as d,P as h,f as w,h as p,i as m,G as y,W as k,j as f,k as C,l as W,m as v,n as P,o as _,p as x,q as j,r as q,t as G,v as $,w as Y,x as Z,y as ee}from"./privy-provider-D_ew0EI2.mjs";export{B as Captcha,D as ConnectorManager,F as EthereumWalletConnector,X as LoginModal,N as PrivyClient,z as PrivyProvider,V as VERSION,E as WalletConnector,L as errorIndicatesMaxMfaRetries,M as errorIndicatesMfaTimeout,K as errorIndicatesMfaVerificationFailed,A as getAccessToken,S as useCreateWallet,O as useIdentityToken,U as useImportWallet,Q as useLogout,I as useMfa,J as useMfaEnrollment,H as usePrivy,R as useRegisterMfaListener,T as useSolanaWallets}from"./privy-provider-D_ew0EI2.mjs";import{useCallback as te,useMemo as re,useEffect as oe,useContext as ie,useState as ae,useRef as ne}from"react";import{u as se,P as le,a as ce,I as ue}from"./internal-context-pX7RZwl3.mjs";export{c as useActiveWallet,a as useConnectWallet,b as useFundWallet,u as useLogin}from"./useActiveWallet-gkcyBb0i.mjs";import{F as de}from"./frame-S_4wR3Zf.mjs";import{zeroAddress as he,getAddress as we,createWalletClient as pe,http as ge,parseSignature as me}from"viem";import{hashAuthorization as ye}from"viem/utils";import{getWallet as Ae,updateWallet as ke}from"@privy-io/js-sdk-core";export{DEFAULT_SUPPORTED_CHAINS as SUPPORTED_CHAINS,addPrivyRpcToChain,addRpcUrlOverrideToChain}from"@privy-io/js-sdk-core";export{g as getEmbeddedConnectedWallet}from"./getEmbeddedConnectedWallet-CSSBWE2p.mjs";import"react/jsx-runtime";import"mipd";import"react-device-detect";import"uuid";import"jose";import"eventemitter3";import"@coinbase/wallet-sdk";import"@privy-io/ethereum";import"@marsidev/react-turnstile";import"styled-components";import"tinycolor2";import"@heroicons/react/24/outline/DevicePhoneMobileIcon";import"@heroicons/react/24/outline/FingerPrintIcon";import"@heroicons/react/24/outline/PhoneIcon";import"@heroicons/react/24/outline/ShieldCheckIcon";import"@heroicons/react/24/outline/ArrowLeftIcon";import"@heroicons/react/24/outline/ArrowRightIcon";import"@heroicons/react/24/outline/QuestionMarkCircleIcon";import"@heroicons/react/24/outline/XMarkIcon";import"@heroicons/react/24/outline/ChevronDownIcon";import"@heroicons/react/24/outline/CalendarIcon";import"@heroicons/react/24/outline/ExclamationTriangleIcon";import"@headlessui/react";import"@walletconnect/ethereum-provider";import"zustand";import"fast-password-entropy";import"secure-password-utilities";import"secure-password-utilities/wordlists";import"@heroicons/react/24/outline/UserCircleIcon";import"@heroicons/react/24/outline/EnvelopeIcon";import"@heroicons/react/20/solid/CheckIcon";import"@heroicons/react/24/outline/WalletIcon";import"@heroicons/react/24/outline/CheckIcon";import"@heroicons/react/24/outline/Square2StackIcon";import"@heroicons/react/24/outline/ExclamationCircleIcon";import"@heroicons/react/24/outline/ArrowTopRightOnSquareIcon";import"@heroicons/react/24/solid/DocumentCheckIcon";import"@heroicons/react/24/solid/XCircleIcon";import"@heroicons/react/24/solid/CheckCircleIcon";import"qrcode";import"@heroicons/react/24/solid/ArrowsRightLeftIcon";import"@heroicons/react/24/outline/ChevronRightIcon";import"@heroicons/react/24/outline/LockClosedIcon";import"@heroicons/react/24/outline/PencilSquareIcon";import"@heroicons/react/24/outline/ArrowPathIcon";import"@heroicons/react/24/outline/EyeIcon";import"@heroicons/react/24/outline/EyeSlashIcon";import"@heroicons/react/24/outline/KeyIcon";import"@heroicons/react/24/outline/ArrowDownTrayIcon";import"@heroicons/react/24/outline/ClipboardDocumentCheckIcon";import"@heroicons/react/24/outline/DocumentDuplicateIcon";import"@heroicons/react/24/solid/LockClosedIcon";import"@heroicons/react/24/outline/CheckCircleIcon";import"@heroicons/react/24/outline/InformationCircleIcon";import"@heroicons/react/24/outline/CreditCardIcon";import"@heroicons/react/24/outline/QrCodeIcon";import"@heroicons/react/24/outline/GlobeAltIcon";import"ofetch";import"@heroicons/react/24/outline";import"@heroicons/react/24/outline/ClipboardDocumentIcon";import"@heroicons/react/24/outline/CloudArrowUpIcon";import"@heroicons/react/24/outline/NoSymbolIcon";import"@heroicons/react/24/outline/ClockIcon";import"@heroicons/react/24/outline/TrashIcon";import"@heroicons/react/24/solid/CheckBadgeIcon";import"@heroicons/react/24/solid/IdentificationIcon";import"@heroicons/react/24/outline/MinusCircleIcon";import"@heroicons/react/24/outline/ArrowRightEndOnRectangleIcon";import"@heroicons/react/24/solid/ShieldCheckIcon";import"js-cookie";const fe=()=>{let{user:o}=e(),{walletProxy:i}=se();return{recover:te((async e=>{if(!i)throw Error("Wallet proxy is not ready");let a=await t();if(!o||!a)throw new le("User must be logged in before attempting to modify the recovery method.");let{entropyId:n,entropyIdVerifier:s}=r(o);try{await i.recover({entropyId:n,entropyIdVerifier:s,accessToken:a,...e})}catch{throw new le("Unable to recover wallets")}}),[i,o])}},Ce=()=>{let{client:e,setAuthenticated:t,setUser:r}=se();return re((()=>({init:async()=>{if(!e)throw new le("Must initialize Privy client first.");let t=new de;return e.startAuthFlow(t),await t.init()},login:async({fid:o,message:i,signature:a})=>{if(!e)throw new le("Must initialize Privy client first.");if(!(e.authFlow instanceof de))throw new le("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 le("Failed to login with Farcaster V2");return r(n),t(!0),{user:n}}})),[e,r,t])},Ie=t=>{o("login",t);let r=i(),a=n(),{ready:c,user:u}=e(),{initLoginWithHeadlessOAuth:h,loginWithHeadlessOAuth:w,oAuthState:p,setOAuthState:g,isHeadlessOAuthLoading:m}=se(),y=te((async e=>{try{if(r.enabled&&"success"!==r.status)throw new s(r.error,null,ce.CAPTCHA_FAILURE);return await h(e.provider,r.token,e.disableSignup)}catch(e){throw g({status:"error",error:e}),e}}),[h,r]),A=te((async()=>{let e=l();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 g({status:"error",error:e}),e}try{return await w(e)}catch(e){throw g({status:"error",error:e}),e}finally{d()}}),[w]);return oe((()=>{let e=l();c&&a&&e.inProgress&&!e.withPrivyUi&&!e.popupFlow&&A().catch((()=>{}))}),[c,a]),{initOAuth:y,loading:m,state:p}},Ee=e=>{let t=i(),{emailOtpState:r,setEmailOtpState:o,initLoginWithEmail:a,loginWithCode:n}=se();return{sendCode:te((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 s(t.error,null,ce.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||ce.UNKNOWN_AUTH_ERROR),r}}),[a]),loginWithCode:te((async({code:r})=>{try{if(t.enabled&&"error"===t.status)throw new s(t.error,null,ce.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 o({status:"error",error:r}),e?.onError?.(r.privyErrorCode||ce.UNKNOWN_AUTH_ERROR),r}}),[n,t.status]),state:r}},We=e=>{let t=i(),{initSignupWithPasskey:r,signupWithPasskey:o,passkeyAuthState:a,setPasskeyAuthState:n}=se();return{signupWithPasskey:te((async()=>{try{let i;if(t.enabled&&"error"===t.status)throw new s(t.error,null,ce.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:l,loginAccount:c}=await o();e?.onComplete?.({user:a,isNewUser:n,wasAlreadyAuthenticated:l,loginMethod:"passkey",loginAccount:c})}catch(t){throw n({status:"error",error:t}),e?.onError?.(t.privyErrorCode||ce.UNKNOWN_AUTH_ERROR),t}}),[o,t.status]),state:a}},Te=e=>{let t=i(),{initLoginWithPasskey:r,loginWithPasskey:o,passkeyAuthState:a,setPasskeyAuthState:n}=se();return{loginWithPasskey:te((async i=>{try{let a;if(t.enabled&&"error"===t.status)throw new s(t.error,null,ce.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 o(i);e?.onComplete?.({user:n,isNewUser:l,wasAlreadyAuthenticated:c,loginMethod:"passkey",loginAccount:u})}catch(i){throw n({status:"error",error:i}),e?.onError?.(i.privyErrorCode||ce.UNKNOWN_AUTH_ERROR),i}}),[o,t.status]),state:a}},Ue=e=>{let{initLinkWithPasskey:t,linkWithPasskey:r,passkeyAuthState:o,setPasskeyAuthState:i}=se();return{linkWithPasskey:te((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||ce.UNKNOWN_AUTH_ERROR,{linkMethod:"passkey"}),t}}),[r]),state:o}},Se=e=>{let t=i(),{smsOtpState:r,setSmsOtpState:o,initLoginWithSms:a,loginWithCode:n}=se();return{sendCode:te((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 s(t.error,null,ce.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||ce.UNKNOWN_AUTH_ERROR),r}}),[a]),loginWithCode:te((async({code:r})=>{try{if(t.enabled&&"success"!==t.status)throw new s(t.error,null,ce.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 o({status:"error",error:r}),e?.onError?.(r.privyErrorCode||ce.UNKNOWN_AUTH_ERROR),r}}),[n,t.status]),state:r}},ve=t=>{let{connectOrCreateWallet:r}=e();return o("connectOrCreateWallet",t),{connectOrCreateWallet:r}},Re=e=>{let t=i(),{siweState:r,setSiweState:o,linkWithSiwe:a,generateSiweMessage:n}=se();return{generateSiweMessage:te((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||ce.UNKNOWN_AUTH_ERROR,{linkMethod:"siwe"}),t}}),[n]),linkWithSiwe:te((async({signature:r,message:i,chainId:n,walletClientType:l,connectorType:c})=>{try{if(t.enabled&&"success"!==t.status)throw new s(t.error,null,ce.CAPTCHA_FAILURE);let{user:o,linkedAccount:u}=await a({message:i,signature:r,chainId:n,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||ce.UNKNOWN_AUTH_ERROR,{linkMethod:"siwe"}),r}}),[a,t.status]),state:r}},Pe=e=>{let t=i(),{siweState:r,setSiweState:o,client:a,generateSiweMessage:n,loginWithSiwe:l}=se();return{generateSiweNonce:te((async r=>{try{let e;if(t.enabled&&"error"===t.status)throw new s(t.error,null,ce.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||ce.UNKNOWN_AUTH_ERROR),r}}),[a,t]),generateSiweMessage:te((async({address:t,chainId:r})=>{try{return await n({address:t,chainId:r})}catch(t){throw o({status:"error",error:t}),e?.onError?.(t.privyErrorCode||ce.UNKNOWN_AUTH_ERROR),t}}),[n]),loginWithSiwe:te((async({message:r,signature:i,disableSignup:a})=>{try{let o;if(t.enabled&&"error"===t.status)throw new s(t.error,null,ce.CAPTCHA_FAILURE);t.enabled&&"success"!==t.status&&(t.execute(),o=await t.waitForResult());let n=await l({message:r,signature:i,captchaToken:o,disableSignup:a});return e?.onComplete?.({user:n,isNewUser:!1,wasAlreadyAuthenticated:!1,loginMethod:"siwe",loginAccount:null}),n}catch(r){throw o({status:"error",error:r}),e?.onError?.(r.privyErrorCode||ce.UNKNOWN_AUTH_ERROR),r}}),[l,t.status]),state:r}};function be(){let{signTransaction:e}=ie(h);return{signTransaction:e}}function Ne(e){let{linkEmail:t,linkPhone:r,linkWallet:i,linkGoogle:a,linkApple:n,linkTwitter:s,linkDiscord:l,linkGithub:c,linkLinkedIn:u,linkTiktok:d,linkSpotify:w,linkInstagram:p,linkTelegram:g,linkFarcaster:m,linkPasskey:y}=ie(h);return o("linkAccount",e),{linkEmail:t,linkPhone:r,linkWallet:i,linkGoogle:a,linkApple:n,linkTwitter:s,linkDiscord:l,linkGithub:c,linkLinkedIn:u,linkTiktok:d,linkSpotify:w,linkInstagram:p,linkFarcaster:m,linkTelegram:g,linkPasskey:y}}function Oe(e){let{updateEmail:t,updatePhone:r}=ie(h);return o("update",e),{updateEmail:t,updatePhone:r}}const _e=()=>{let{connectCoinbaseSmartWallet:e}=se();return{connectCoinbaseSmartWallet:e}},Me=()=>{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 Fe(e){let{sendTransaction:t}=ie(h);return o("sendTransaction",e),{sendTransaction:t}}function Le(e){let{setWalletPassword:t}=ie(h);return o("setWalletPassword",e),{setWalletPassword:t}}function He(){let t=w(),{getAccessToken:r}=e(),o=p(),{client:i,setUser:a,setAuthenticated:n,setIsNewUser:s,initializeWalletProxy:l}=se(),{create:c}=m();return{createGuestAccount:async()=>{if(!t.id||!i)throw Error("SDK not yet ready");i.startAuthFlow(new y(t.id));try{let e=await i.authenticate(),u=e.user,d=e.isNewUser??!1;if(!u)throw new le("Unable to authenticate guest account");let h=await r(),w=await l(k);if(h&&w)try{let e=f(u,t.embeddedWallets.ethereum.createOnLogin),r=C(u,t.embeddedWallets.solana.createOnLogin);e&&r?(u=(await c({chainType:"ethereum",latestUser:u})).user,u=(await c({chainType:"solana",latestUser:u})).user):r?u=(await c({chainType:"solana",latestUser:u})).user:e?u=(await c({chainType:"ethereum",latestUser:u})).user:a(u)}catch(e){a(u),console.warn("Unable to create embedded wallet for guest account")}return s(d),n(!0),o("login","onComplete",{user:u,isNewUser:d,wasAlreadyAuthenticated:!1,loginMethod:"guest",loginAccount:null}),u}catch(e){throw o("login","onError",e.privyErrorCode||ce.UNKNOWN_AUTH_ERROR),e}}}}function De(e){let{setWalletRecovery:t}=ie(h);return o("setWalletRecovery",e),{setWalletRecovery:t}}function xe(e){let{signMessage:t}=ie(h);return o("signMessage",e),{signMessage:t}}const Ke=()=>{let{ready:t,wallets:r}=W(),{user:o}=e(),{rpcConfig:i,chains:a,appId:n}=se();return{signAuthorization:te((async(e,s)=>{let l;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??v(o)?.address??he,u=r.find((e=>we(e.address)===we(c)));if(!u)throw Error("Signing wallet not found.");let d=e.chainId??Number(u.chainId.split(":")[1]);if(0===d)l={chainId:0,address:e.contractAddress,nonce:e.nonce??0};else{let t=a.find((e=>e.id===d));if(!t)throw Error("Error, chain not configured in PrivyProvider config");let r=pe({account:c,chain:t,transport:ge(P(t,i,n))});l=await r.prepareAuthorization({...e})}let h=await u.getEthereumProvider(),w=await h.request({method:"secp256k1_sign",params:[ye(l)]});return{...l,...me(w)}}),[t,r,o,a])}};function ze(e){let{signTypedData:t}=ie(h);return o("signTypedData",e),{signTypedData:t}}const je=()=>{let{isModalOpen:e}=ie(h);return{isOpen:e}};function qe(e){let{getAccessToken:t}=ie(h);return o("accessToken",e),{getAccessToken:t}}function Ve(t){let{authenticated:r,user:i}=e(),{initLoginWithOAuth:a}=se(),n=p();return o("oAuthAuthorization",t),{reauthorize:e=>Ge(r,i,a,n,e.provider)}}let Ge=async(e,t,r,o,i)=>{if(!e)throw o("linkAccount","onError",ce.MUST_BE_AUTHENTICATED,{linkMethod:i}),new le("User must be authenticated before linking an account.");if(!t?.linkedAccounts.some((e=>e.type.includes(i))))throw new le(`OAuth account of type ${i} not linked to the account.`);await r(i)};function Be(e){let{client:t}=se(),[r,o]=ae({status:"initial"});return{linkWithCustomJwt:te((async r=>{try{o({status:"initial"}),t.startAuthFlow(new _(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||ce.UNKNOWN_AUTH_ERROR,{linkMethod:"custom"}),r}}),[t.startAuthFlow,t.link]),state:r}}const Qe=e=>{let t=x();return o("customAuth",e),{status:t}};function Xe({isAuthenticated:e,isLoading:t,...r}){let o=ne();oe((()=>{t||o.current?.()}),[e,t]);let i=te((e=>(o.current=e,()=>{o.current=void 0})),[]);return j({...r,subscribe:i})}function Je(){let{getFarcasterSignerPublicKey:t,signFarcasterMessage:r,requestFarcasterSignerFromWarpcast:o}=e();return{getFarcasterSignerPublicKey:t,signFarcasterMessage:r,requestFarcasterSignerFromWarpcast:o}}const $e=()=>{let{revokeDelegatedWallets:e,delegateWallet:t}=se();return{delegateWallet:async({address:e,chainType:r})=>await t({address:e,chainType:r,showDelegationUIs:!0}),revokeWallets:async()=>await e({showDelegationUIs:!0})}},Ye=()=>{let{addSessionSignersInternal:t,removeSessionSignersInternal:r}=(()=>{let{getAccessToken:t,user:r}=e(),o=se(),{signWithUserSigner:i}=q(),a=async({wallet:e,additional_signers:a})=>{let n=await t();if(!r||!n)throw new le("User must be authenticated and have an embedded wallet to delegate actions.");if(!e.id)throw new le("Wallet to add signers to must have ID on server");if(!o.walletProxy)throw new le("Wallet proxy not initialized.");await ke(o.privy,{wallet_id:e.id},i,{additional_signers:a})};return{addSessionSignersInternal:async({address:e,signers:i})=>{let n=await t();if(!r||!n)throw new le("User must be authenticated and have an embedded wallet to add a session signer.");let s=o.walletProxy??await o.initializeWalletProxy(15e3);if(!s)throw new le("Wallet proxy not initialized.");let l=G(r,e);if(!l)throw new le("Address to add signers too is not associated with current user.");if($(l)){if(0===i.length)throw new le("Must specify at least one signer to add.");let e=[...(await Ae(o.privy,{wallet_id:l.id})).additional_signers,...Y(i)];await a({wallet:l,additional_signers:e})}else{if(l.delegated)return{user:r};if(i.length>0)throw new le("This embedded wallet does not support specifying signers. If signing is enabled in the dashboard, signer will default to that key. Otherwise, no signatures will be required for the wallet.");let t=Z({address:e,user:r}),a=ee({address:e,user:r});await o.recoverEmbeddedWallet({address:e}),await s.createDelegatedAction({accessToken:n,rootWallet:a,delegatedWallets:[t]})}let c=await o.refreshSessionAndUser();if(!c)throw Error("Could not refresh user");return{user:c}},removeSessionSignersInternal:async({address:e})=>{let i=await t();if(!r||!i)throw new le("User must be authenticated and have an embedded wallet to delegate actions.");if(!(o.walletProxy??await o.initializeWalletProxy(15e3)))throw new le("Wallet proxy not initialized.");let n=G(r,e);if(!n)throw new le("Address to remove signers from is not associated with current user.");$(n)?await a({wallet:n,additional_signers:[]}):await o.client.revokeDelegatedWallet();let s=await o.refreshSessionAndUser();if(!s)throw Error("Could not refresh user");return{user:s}}}})();return{addSessionSigners:async({address:e,signers:r})=>t({address:e,signers:r}),removeSessionSigners:async({address:e})=>r({address:e})}},Ze=()=>{let{setUser:e,client:t}=ie(ue),{user:r}=ie(h);return{user:r,refreshUser:te((async()=>{let r=await(t?.updateUserAndIdToken());return e(r??null),r}),[t,e])}},et=e=>{let t=i(),{initLoginWithTelegram:r,loginWithTelegram:o,telegramAuthState:a,setTelegramAuthState:n}=se();return{login:te((async i=>{try{if(t.enabled&&"success"!==t.status)throw new s(t.error,null,ce.CAPTCHA_FAILURE);await r(t.token,i?.disableSignup);let{user:a,isNewUser:n,loginAccount:l,wasAlreadyAuthenticated:c}=await o({intent:"login"});e?.onComplete?.({user:a,isNewUser:n,wasAlreadyAuthenticated:c,loginMethod:"telegram",loginAccount:l})}catch(i){throw n({status:"error",error:i}),e?.onError?.(i.privyErrorCode||ce.UNKNOWN_AUTH_ERROR),i}}),[r,o,t]),state:a}},tt=()=>{let{revokeDelegatedWallets:e,delegateWallet:t}=se();return{delegateWallet:async({address:e,chainType:r})=>await t({address:e,chainType:r,showDelegationUIs:!1}),revokeWallets:async()=>await e({showDelegationUIs:!1})}};export{_e as useConnectCoinbaseSmartWallet,ve as useConnectOrCreateWallet,Me as useCrossAppAccounts,Qe as useCustomAuth,$e as useDelegatedActions,Je as useFarcasterSigner,He as useGuestAccounts,tt as useHeadlessDelegatedActions,Ne as useLinkAccount,Be as useLinkJwtAccount,Ue as useLinkWithPasskey,Re as useLinkWithSiwe,Ee as useLoginWithEmail,Ce as useLoginWithFarcasterV2,Ie as useLoginWithOAuth,Te as useLoginWithPasskey,Pe as useLoginWithSiwe,Se as useLoginWithSms,et as useLoginWithTelegram,je as useModalStatus,Ve as useOAuthTokens,fe as useRecoverEmbeddedWallet,Fe as useSendTransaction,Ye as useSessionSigners,Le as useSetWalletPassword,De as useSetWalletRecovery,Ke as useSignAuthorization,xe as useSignMessage,be as useSignTransaction,ze as useSignTypedData,We as useSignupWithPasskey,Xe as useSubscribeToJwtAuthWithFlag,j as useSyncJwtBasedAuthState,qe as useToken,Oe as useUpdateAccount,Ze as useUser,W as useWallets};