@privy-io/react-auth 2.8.3 → 2.9.1-beta-20250412182455
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/abstract-smart-wallets.js +1 -1
- package/dist/cjs/index.js +1 -1
- package/dist/cjs/{privy-provider-FtDgdqaz.js → privy-provider-DOLT-3NP.js} +9 -8
- package/dist/cjs/{smart-wallets-DpZ1VbmP.js → smart-wallets-BZt-a5JY.js} +1 -1
- package/dist/cjs/smart-wallets.js +1 -1
- package/dist/cjs/solana.js +1 -1
- package/dist/cjs/ui.js +1 -1
- package/dist/cjs/{useActiveWallet-b98a2Pfo.js → useActiveWallet-Q7fvkdWQ.js} +1 -1
- package/dist/cjs/{useFundWallet-CK866vxp.js → useFundWallet-CckNUqVa.js} +1 -1
- package/dist/dts/farcaster.d.mts +1 -1
- package/dist/dts/farcaster.d.ts +1 -1
- package/dist/dts/index.d.mts +4 -4
- package/dist/dts/index.d.ts +4 -4
- package/dist/dts/smart-wallets.d.mts +1 -1
- package/dist/dts/smart-wallets.d.ts +1 -1
- package/dist/dts/solana.d.mts +4 -4
- package/dist/dts/solana.d.ts +4 -4
- package/dist/dts/{types-B92M8x5e.d.mts → types-CYonPN7t.d.mts} +10 -2
- package/dist/dts/{types-B92M8x5e.d.ts → types-CYonPN7t.d.ts} +10 -2
- package/dist/dts/ui.d.mts +1 -1
- package/dist/dts/ui.d.ts +1 -1
- package/dist/dts/{useSolanaWallets-BSNPWBSM.d.mts → useSolanaWallets-C1tLgq7o.d.mts} +1 -1
- package/dist/dts/{useSolanaWallets-BSNPWBSM.d.ts → useSolanaWallets-C1tLgq7o.d.ts} +1 -1
- package/dist/esm/abstract-smart-wallets.mjs +1 -1
- package/dist/esm/index.mjs +1 -1
- package/dist/esm/{privy-provider-8kKbowq5.mjs → privy-provider-k2j2FRnN.mjs} +9 -8
- package/dist/esm/{smart-wallets-Cb3AejtF.mjs → smart-wallets-CboVBPDT.mjs} +1 -1
- package/dist/esm/smart-wallets.mjs +1 -1
- package/dist/esm/solana.mjs +1 -1
- package/dist/esm/ui.mjs +2 -2
- package/dist/esm/{useActiveWallet-Cpqv9qnc.mjs → useActiveWallet-BxyfU0Yc.mjs} +1 -1
- package/dist/esm/{useFundWallet-Lp53P4p6.mjs → useFundWallet-DjREE839.mjs} +1 -1
- package/package.json +5 -5
package/dist/dts/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
2
|
import react__default, { MouseEvent } from 'react';
|
|
3
|
-
import { l as WalletClientType, d as UserRecoveryMethod, m as PrivyFarcasterSignerInitResponse, n as MfaSubmitArgs, E as EthereumRpcRequestType, o as SolanaRpcRequestType, p as EthereumRpcResponseType, q as SolanaRpcResponseType, r as PrivyClientConfig, s as EIP1193Provider, u as EntropyIdVerifier$1, v as RequestArguments, w as WalletTimeoutError, x as WalletConnector, B as BaseConnectedEthereumWallet, y as ConnectedWalletMetadata, z as ConnectorType, A as WalletListEntry, D as ExternalWalletsConfig, G as BaseConnectedWallet, k as SolanaWalletConnector, U as User, H as ConnectWalletModalOptions, I as LoginModalOptions, g as CreateWalletOptions, W as Wallet, J as SetWalletRecoveryOptions, i as SignMessageModalUIOptions, K as SignTypedDataParams, M as MfaMethod, N as UnsignedTransactionRequest, h as SendTransactionModalUIOptions, Q as FundWalletConfig, T as ConnectedWallet, O as OAuthTokens, V as CrossAppProviderDetails, X as OAuthProviderType, Y as MoonpaySignRequest, Z as MoonpaySignResponse, _ as SmartWalletConfig, a as LoginMethod, $ as SiweWalletMetadata, a0 as TelegramAuthResult, a1 as TelegramWebAppData, a2 as OAuthUserInfo, a3 as OAuthFlowState, a4 as LoginWithCode, a5 as OtpFlowState, a6 as PasskeyFlowState, a7 as SiweFlowState, a8 as UnsignedTransactionRequestWithChainId, a9 as BaseConnectedWalletType, C as ConnectedSolanaWallet, aa as TelegramAuthFlowState } from './types-
|
|
4
|
-
export { at as Apple, aE as AppleOAuthWithMetadata, aM as ContractUIOptions, aw as CrossAppAccount, aH as CrossAppAccountWithMetadata, aq as Discord, aA as DiscordOAuthWithMetadata, aJ as Email, al as EmailWithMetadata, aQ as Farcaster, aF as FarcasterWithMetadata, ar as Github, aB as GithubOAuthWithMetadata, ao as Google, ay as GoogleOAuthWithMetadata, ax as LinkedAccountType, b as LinkedAccountWithMetadata, as as LinkedIn, aD as LinkedInOAuthWithMetadata, aS as LoginMethodOrderOption, ac as MessageTypes, ae as MoonpayConfig, af as MoonpayCurrencyCode, aO as MoonpayFundingConfig, ag as MoonpayPaymentMethod, aN as NativeFundingConfig, ak as NonEmptyArray, aR as Passkey, aI as PasskeyWithMetadata, aK as Phone, am as PhoneWithMetadata, aP as PriceDisplayOptions, P as PrivyErrorCode, ah as Quantity, ad as SmartWallet, f as SolanaCluster, j as SolanaFundingConfig, S as SolanaTransactionReceipt, e as SupportedSolanaTransaction, av as Telegram, aG as TelegramWithMetadata, au as Tiktok, aC as TiktokOAuthWithMetadata, ai as TransactionLog, aj as TransactionReceipt, aL as TransactionUIOptions, ap as Twitter, az as TwitterOAuthWithMetadata, ab as TypedMessage, an as WalletWithMetadata } from './types-
|
|
3
|
+
import { l as WalletClientType, d as UserRecoveryMethod, m as PrivyFarcasterSignerInitResponse, n as MfaSubmitArgs, E as EthereumRpcRequestType, o as SolanaRpcRequestType, p as EthereumRpcResponseType, q as SolanaRpcResponseType, r as PrivyClientConfig, s as EIP1193Provider, u as EntropyIdVerifier$1, v as RequestArguments, w as WalletTimeoutError, x as WalletConnector, B as BaseConnectedEthereumWallet, y as ConnectedWalletMetadata, z as ConnectorType, A as WalletListEntry, D as ExternalWalletsConfig, G as BaseConnectedWallet, k as SolanaWalletConnector, U as User, H as ConnectWalletModalOptions, I as LoginModalOptions, g as CreateWalletOptions, W as Wallet, J as SetWalletRecoveryOptions, i as SignMessageModalUIOptions, K as SignTypedDataParams, M as MfaMethod, N as UnsignedTransactionRequest, h as SendTransactionModalUIOptions, Q as FundWalletConfig, T as ConnectedWallet, O as OAuthTokens, V as CrossAppProviderDetails, X as OAuthProviderType, Y as MoonpaySignRequest, Z as MoonpaySignResponse, _ as SmartWalletConfig, a as LoginMethod, $ as SiweWalletMetadata, a0 as TelegramAuthResult, a1 as TelegramWebAppData, a2 as OAuthUserInfo, a3 as OAuthFlowState, a4 as LoginWithCode, a5 as OtpFlowState, a6 as PasskeyFlowState, a7 as SiweFlowState, a8 as UnsignedTransactionRequestWithChainId, a9 as BaseConnectedWalletType, C as ConnectedSolanaWallet, aa as TelegramAuthFlowState } from './types-CYonPN7t.js';
|
|
4
|
+
export { at as Apple, aE as AppleOAuthWithMetadata, aM as ContractUIOptions, aw as CrossAppAccount, aH as CrossAppAccountWithMetadata, aq as Discord, aA as DiscordOAuthWithMetadata, aJ as Email, al as EmailWithMetadata, aQ as Farcaster, aF as FarcasterWithMetadata, ar as Github, aB as GithubOAuthWithMetadata, ao as Google, ay as GoogleOAuthWithMetadata, ax as LinkedAccountType, b as LinkedAccountWithMetadata, as as LinkedIn, aD as LinkedInOAuthWithMetadata, aS as LoginMethodOrderOption, ac as MessageTypes, ae as MoonpayConfig, af as MoonpayCurrencyCode, aO as MoonpayFundingConfig, ag as MoonpayPaymentMethod, aN as NativeFundingConfig, ak as NonEmptyArray, aR as Passkey, aI as PasskeyWithMetadata, aK as Phone, am as PhoneWithMetadata, aP as PriceDisplayOptions, P as PrivyErrorCode, ah as Quantity, ad as SmartWallet, f as SolanaCluster, j as SolanaFundingConfig, S as SolanaTransactionReceipt, e as SupportedSolanaTransaction, av as Telegram, aG as TelegramWithMetadata, au as Tiktok, aC as TiktokOAuthWithMetadata, ai as TransactionLog, aj as TransactionReceipt, aL as TransactionUIOptions, ap as Twitter, az as TwitterOAuthWithMetadata, ab as TypedMessage, an as WalletWithMetadata } from './types-CYonPN7t.js';
|
|
5
5
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
6
6
|
import { TurnstileProps } from '@marsidev/react-turnstile';
|
|
7
7
|
import EventEmitter from 'eventemitter3';
|
|
@@ -16,8 +16,8 @@ import * as _simplewebauthn_types from '@simplewebauthn/types';
|
|
|
16
16
|
import { PublicKeyCredentialRequestOptionsJSON } from '@simplewebauthn/types';
|
|
17
17
|
import { Cluster } from '@solana/web3.js';
|
|
18
18
|
import { FetchOptions } from 'ofetch';
|
|
19
|
-
import { P as PrivyEvents } from './useSolanaWallets-
|
|
20
|
-
export { C as CallbackError, U as UseSolanaWalletsInterface, u as useSolanaWallets } from './useSolanaWallets-
|
|
19
|
+
import { P as PrivyEvents } from './useSolanaWallets-C1tLgq7o.js';
|
|
20
|
+
export { C as CallbackError, U as UseSolanaWalletsInterface, u as useSolanaWallets } from './useSolanaWallets-C1tLgq7o.js';
|
|
21
21
|
import '@solana/wallet-adapter-base';
|
|
22
22
|
import '@metamask/eth-sig-util';
|
|
23
23
|
|
|
@@ -7,7 +7,7 @@ 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-
|
|
10
|
+
import { h as SendTransactionModalUIOptions, i as SignMessageModalUIOptions } from './types-CYonPN7t.js';
|
|
11
11
|
import '@solana/wallet-adapter-base';
|
|
12
12
|
import '@privy-io/public-api';
|
|
13
13
|
import '@metamask/eth-sig-util';
|
|
@@ -7,7 +7,7 @@ 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-
|
|
10
|
+
import { h as SendTransactionModalUIOptions, i as SignMessageModalUIOptions } from './types-CYonPN7t.js';
|
|
11
11
|
import '@solana/wallet-adapter-base';
|
|
12
12
|
import '@privy-io/public-api';
|
|
13
13
|
import '@metamask/eth-sig-util';
|
package/dist/dts/solana.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { W as Wallet, j as SolanaFundingConfig, e as SupportedSolanaTransaction, h as SendTransactionModalUIOptions, S as SolanaTransactionReceipt, i as SignMessageModalUIOptions } from './types-
|
|
2
|
-
export { C as ConnectedSolanaWallet, k as SolanaAdapterConnector, t as toSolanaWalletConnectors } from './types-
|
|
3
|
-
import { P as PrivyEvents } from './useSolanaWallets-
|
|
4
|
-
export { U as UseSolanaWalletsInterface, u as useSolanaWallets } from './useSolanaWallets-
|
|
1
|
+
import { W as Wallet, j as SolanaFundingConfig, e as SupportedSolanaTransaction, h as SendTransactionModalUIOptions, S as SolanaTransactionReceipt, i as SignMessageModalUIOptions } from './types-CYonPN7t.js';
|
|
2
|
+
export { C as ConnectedSolanaWallet, k as SolanaAdapterConnector, t as toSolanaWalletConnectors } from './types-CYonPN7t.js';
|
|
3
|
+
import { P as PrivyEvents } from './useSolanaWallets-C1tLgq7o.js';
|
|
4
|
+
export { U as UseSolanaWalletsInterface, u as useSolanaWallets } from './useSolanaWallets-C1tLgq7o.js';
|
|
5
5
|
import { SendTransactionOptions } from '@solana/wallet-adapter-base';
|
|
6
6
|
import { Connection } from '@solana/web3.js';
|
|
7
7
|
import 'react';
|
package/dist/dts/solana.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { W as Wallet, j as SolanaFundingConfig, e as SupportedSolanaTransaction, h as SendTransactionModalUIOptions, S as SolanaTransactionReceipt, i as SignMessageModalUIOptions } from './types-
|
|
2
|
-
export { C as ConnectedSolanaWallet, k as SolanaAdapterConnector, t as toSolanaWalletConnectors } from './types-
|
|
3
|
-
import { P as PrivyEvents } from './useSolanaWallets-
|
|
4
|
-
export { U as UseSolanaWalletsInterface, u as useSolanaWallets } from './useSolanaWallets-
|
|
1
|
+
import { W as Wallet, j as SolanaFundingConfig, e as SupportedSolanaTransaction, h as SendTransactionModalUIOptions, S as SolanaTransactionReceipt, i as SignMessageModalUIOptions } from './types-CYonPN7t.js';
|
|
2
|
+
export { C as ConnectedSolanaWallet, k as SolanaAdapterConnector, t as toSolanaWalletConnectors } from './types-CYonPN7t.js';
|
|
3
|
+
import { P as PrivyEvents } from './useSolanaWallets-C1tLgq7o.js';
|
|
4
|
+
export { U as UseSolanaWalletsInterface, u as useSolanaWallets } from './useSolanaWallets-C1tLgq7o.js';
|
|
5
5
|
import { SendTransactionOptions } from '@solana/wallet-adapter-base';
|
|
6
6
|
import { Connection } from '@solana/web3.js';
|
|
7
7
|
import 'react';
|
|
@@ -367,6 +367,8 @@ type SolanaCluster = {
|
|
|
367
367
|
name: Cluster;
|
|
368
368
|
/** The RPC endpoint */
|
|
369
369
|
rpcUrl?: string;
|
|
370
|
+
/** Block explorer URL */
|
|
371
|
+
blockExplorerUrl?: string;
|
|
370
372
|
};
|
|
371
373
|
|
|
372
374
|
declare const SUPPORTED_OAUTH_PROVIDERS: readonly ["google", "discord", "twitter", "github", "spotify", "instagram", "tiktok", "linkedin", "apple"];
|
|
@@ -397,7 +399,7 @@ type LoginWithCode = {
|
|
|
397
399
|
};
|
|
398
400
|
declare const EMBEDDED_WALLET_CLIENT_TYPES: readonly ["privy"];
|
|
399
401
|
type EmbeddedWalletClientType = (typeof EMBEDDED_WALLET_CLIENT_TYPES)[number];
|
|
400
|
-
declare const INJECTED_WALLET_CLIENT_TYPES: readonly ["metamask", "phantom", "brave_wallet", "rainbow", "uniswap_wallet_extension", "uniswap_extension", "rabby_wallet", "bybit_wallet", "ronin_wallet", "haha_wallet", "crypto.com_wallet_extension", "crypto.com_onchain"];
|
|
402
|
+
declare const INJECTED_WALLET_CLIENT_TYPES: readonly ["metamask", "phantom", "brave_wallet", "rainbow", "uniswap_wallet_extension", "uniswap_extension", "rabby_wallet", "bybit_wallet", "ronin_wallet", "haha_wallet", "crypto.com_wallet_extension", "crypto.com_onchain", "binance"];
|
|
401
403
|
type InjectedWalletClientType = (typeof INJECTED_WALLET_CLIENT_TYPES)[number];
|
|
402
404
|
declare const COINBASE_WALLET_CLIENT_TYPES: readonly ["coinbase_wallet", "coinbase_smart_wallet"];
|
|
403
405
|
type CoinbaseWalletClientType = (typeof COINBASE_WALLET_CLIENT_TYPES)[number];
|
|
@@ -1048,7 +1050,7 @@ type PriceDisplayOptions = {
|
|
|
1048
1050
|
};
|
|
1049
1051
|
type WalletListEntry = 'metamask' | 'coinbase_wallet' | 'rainbow' | 'phantom' | 'zerion' | 'cryptocom' | 'uniswap' | 'okx_wallet' | 'universal_profile'
|
|
1050
1052
|
/** @deprecated Use `detected_ethereum_wallets` or `detected_solana_wallets` instead */
|
|
1051
|
-
| 'detected_wallets' | 'detected_solana_wallets' | 'detected_ethereum_wallets' | 'wallet_connect' | 'rabby_wallet' | 'bybit_wallet' | 'ronin_wallet' | 'haha_wallet' | 'safe' | 'solflare' | 'backpack';
|
|
1053
|
+
| 'detected_wallets' | 'detected_solana_wallets' | 'detected_ethereum_wallets' | 'wallet_connect' | 'rabby_wallet' | 'bybit_wallet' | 'ronin_wallet' | 'haha_wallet' | 'safe' | 'solflare' | 'backpack' | 'binance';
|
|
1052
1054
|
type NonEmptyArray<T> = [T, ...T[]];
|
|
1053
1055
|
type LoginMethodOrderOption = 'email' | 'sms' | WalletListEntry | OAuthProviderType | `privy:${string}` | 'farcaster' | 'telegram';
|
|
1054
1056
|
type ExternalWalletsConfig = {
|
|
@@ -1090,6 +1092,12 @@ type ExternalWalletsConfig = {
|
|
|
1090
1092
|
solana?: {
|
|
1091
1093
|
connectors?: SolanaWalletConnectorsConfig;
|
|
1092
1094
|
};
|
|
1095
|
+
/**
|
|
1096
|
+
* If true, disables all connections to external wallets.
|
|
1097
|
+
*
|
|
1098
|
+
* @experimental This feature is experimental
|
|
1099
|
+
*/
|
|
1100
|
+
disableAllExternalWallets?: boolean;
|
|
1093
1101
|
};
|
|
1094
1102
|
interface PrivyClientConfig {
|
|
1095
1103
|
/** All UI and theme related configuration */
|
|
@@ -367,6 +367,8 @@ type SolanaCluster = {
|
|
|
367
367
|
name: Cluster;
|
|
368
368
|
/** The RPC endpoint */
|
|
369
369
|
rpcUrl?: string;
|
|
370
|
+
/** Block explorer URL */
|
|
371
|
+
blockExplorerUrl?: string;
|
|
370
372
|
};
|
|
371
373
|
|
|
372
374
|
declare const SUPPORTED_OAUTH_PROVIDERS: readonly ["google", "discord", "twitter", "github", "spotify", "instagram", "tiktok", "linkedin", "apple"];
|
|
@@ -397,7 +399,7 @@ type LoginWithCode = {
|
|
|
397
399
|
};
|
|
398
400
|
declare const EMBEDDED_WALLET_CLIENT_TYPES: readonly ["privy"];
|
|
399
401
|
type EmbeddedWalletClientType = (typeof EMBEDDED_WALLET_CLIENT_TYPES)[number];
|
|
400
|
-
declare const INJECTED_WALLET_CLIENT_TYPES: readonly ["metamask", "phantom", "brave_wallet", "rainbow", "uniswap_wallet_extension", "uniswap_extension", "rabby_wallet", "bybit_wallet", "ronin_wallet", "haha_wallet", "crypto.com_wallet_extension", "crypto.com_onchain"];
|
|
402
|
+
declare const INJECTED_WALLET_CLIENT_TYPES: readonly ["metamask", "phantom", "brave_wallet", "rainbow", "uniswap_wallet_extension", "uniswap_extension", "rabby_wallet", "bybit_wallet", "ronin_wallet", "haha_wallet", "crypto.com_wallet_extension", "crypto.com_onchain", "binance"];
|
|
401
403
|
type InjectedWalletClientType = (typeof INJECTED_WALLET_CLIENT_TYPES)[number];
|
|
402
404
|
declare const COINBASE_WALLET_CLIENT_TYPES: readonly ["coinbase_wallet", "coinbase_smart_wallet"];
|
|
403
405
|
type CoinbaseWalletClientType = (typeof COINBASE_WALLET_CLIENT_TYPES)[number];
|
|
@@ -1048,7 +1050,7 @@ type PriceDisplayOptions = {
|
|
|
1048
1050
|
};
|
|
1049
1051
|
type WalletListEntry = 'metamask' | 'coinbase_wallet' | 'rainbow' | 'phantom' | 'zerion' | 'cryptocom' | 'uniswap' | 'okx_wallet' | 'universal_profile'
|
|
1050
1052
|
/** @deprecated Use `detected_ethereum_wallets` or `detected_solana_wallets` instead */
|
|
1051
|
-
| 'detected_wallets' | 'detected_solana_wallets' | 'detected_ethereum_wallets' | 'wallet_connect' | 'rabby_wallet' | 'bybit_wallet' | 'ronin_wallet' | 'haha_wallet' | 'safe' | 'solflare' | 'backpack';
|
|
1053
|
+
| 'detected_wallets' | 'detected_solana_wallets' | 'detected_ethereum_wallets' | 'wallet_connect' | 'rabby_wallet' | 'bybit_wallet' | 'ronin_wallet' | 'haha_wallet' | 'safe' | 'solflare' | 'backpack' | 'binance';
|
|
1052
1054
|
type NonEmptyArray<T> = [T, ...T[]];
|
|
1053
1055
|
type LoginMethodOrderOption = 'email' | 'sms' | WalletListEntry | OAuthProviderType | `privy:${string}` | 'farcaster' | 'telegram';
|
|
1054
1056
|
type ExternalWalletsConfig = {
|
|
@@ -1090,6 +1092,12 @@ type ExternalWalletsConfig = {
|
|
|
1090
1092
|
solana?: {
|
|
1091
1093
|
connectors?: SolanaWalletConnectorsConfig;
|
|
1092
1094
|
};
|
|
1095
|
+
/**
|
|
1096
|
+
* If true, disables all connections to external wallets.
|
|
1097
|
+
*
|
|
1098
|
+
* @experimental This feature is experimental
|
|
1099
|
+
*/
|
|
1100
|
+
disableAllExternalWallets?: boolean;
|
|
1093
1101
|
};
|
|
1094
1102
|
interface PrivyClientConfig {
|
|
1095
1103
|
/** All UI and theme related configuration */
|
package/dist/dts/ui.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import { R as RuntimeLoginOverridableOptions } from './types-
|
|
2
|
+
import { R as RuntimeLoginOverridableOptions } from './types-CYonPN7t.js';
|
|
3
3
|
import { Hex } from 'viem';
|
|
4
4
|
import { Chain, Cluster } from '@privy-io/js-sdk-core';
|
|
5
5
|
import '@solana/wallet-adapter-base';
|
package/dist/dts/ui.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import { R as RuntimeLoginOverridableOptions } from './types-
|
|
2
|
+
import { R as RuntimeLoginOverridableOptions } from './types-CYonPN7t.js';
|
|
3
3
|
import { Hex } from 'viem';
|
|
4
4
|
import { Chain, Cluster } from '@privy-io/js-sdk-core';
|
|
5
5
|
import '@solana/wallet-adapter-base';
|
|
@@ -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-
|
|
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-CYonPN7t.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-
|
|
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-CYonPN7t.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 c}from"viem/chains";import{u as s,f as l,l as d,an as m,m as p,a as u,av as h,aw as I,ax as g,n as y}from"./privy-provider-
|
|
1
|
+
import{createAbstractClient as e}from"@abstract-foundation/agw-client";import{getBatchTransactionObject as o}from"@abstract-foundation/agw-client/actions";import{hexToNumber as r,createWalletClient as t,custom as n,http as i}from"viem";import{toAccount as a}from"viem/accounts";import{abstractTestnet as c}from"viem/chains";import{u as s,f as l,l as d,an as m,m as p,a as u,av as h,aw as I,ax as g,n as y}from"./privy-provider-k2j2FRnN.mjs";import{u as f}from"./internal-context-D5bEplez.mjs";import{g as v}from"./getEmbeddedConnectedWallet-CSSBWE2p.mjs";import{c as w}from"./smart-wallets-CboVBPDT.mjs";import"react/jsx-runtime";import"mipd";import"react";import"react-device-detect";import"viem/utils";import"@privy-io/js-sdk-core";import"uuid";import"jose";import"eventemitter3";import"@coinbase/wallet-sdk";import"@marsidev/react-turnstile";import"styled-components";import"tinycolor2";import"@heroicons/react/24/outline/DevicePhoneMobileIcon";import"@heroicons/react/24/outline/FingerPrintIcon";import"@heroicons/react/24/outline/PhoneIcon";import"@heroicons/react/24/outline/ShieldCheckIcon";import"@heroicons/react/24/outline/ArrowLeftIcon";import"@heroicons/react/24/outline/ArrowRightIcon";import"@heroicons/react/24/outline/QuestionMarkCircleIcon";import"@heroicons/react/24/outline/XMarkIcon";import"@heroicons/react/24/outline/ChevronDownIcon";import"@heroicons/react/24/outline/CalendarIcon";import"@heroicons/react/24/outline/ExclamationTriangleIcon";import"@headlessui/react";import"@walletconnect/ethereum-provider";import"zustand";import"fast-password-entropy";import"secure-password-utilities";import"secure-password-utilities/wordlists";import"@heroicons/react/24/outline/UserCircleIcon";import"@heroicons/react/24/outline/EnvelopeIcon";import"@heroicons/react/20/solid/CheckIcon";import"@heroicons/react/24/outline/WalletIcon";import"@heroicons/react/24/outline/CheckIcon";import"@heroicons/react/24/outline/Square2StackIcon";import"@heroicons/react/24/outline/ExclamationCircleIcon";import"@heroicons/react/24/outline/ArrowTopRightOnSquareIcon";import"@heroicons/react/24/solid/DocumentCheckIcon";import"@heroicons/react/24/solid/XCircleIcon";import"@heroicons/react/24/solid/CheckCircleIcon";import"qrcode";import"@heroicons/react/24/outline/ChevronRightIcon";import"@heroicons/react/24/outline/LockClosedIcon";import"@heroicons/react/24/outline/PencilSquareIcon";import"@heroicons/react/24/outline/ArrowPathIcon";import"@heroicons/react/24/outline/EyeIcon";import"@heroicons/react/24/outline/EyeSlashIcon";import"@heroicons/react/24/outline/KeyIcon";import"@heroicons/react/24/outline/ArrowDownTrayIcon";import"@heroicons/react/24/outline/ClipboardDocumentCheckIcon";import"@heroicons/react/24/outline/DocumentDuplicateIcon";import"@heroicons/react/24/solid/LockClosedIcon";import"@heroicons/react/24/outline/CheckCircleIcon";import"@heroicons/react/24/outline/InformationCircleIcon";import"@heroicons/react/24/outline/CreditCardIcon";import"@heroicons/react/24/outline/QrCodeIcon";import"@heroicons/react/24/solid/ArrowsRightLeftIcon";import"@heroicons/react/24/outline/GlobeAltIcon";import"ofetch";import"@heroicons/react/24/outline";import"@heroicons/react/24/outline/ClipboardDocumentIcon";import"@heroicons/react/24/outline/CloudArrowUpIcon";import"@heroicons/react/24/outline/NoSymbolIcon";import"@heroicons/react/24/outline/ClockIcon";import"@heroicons/react/24/outline/TrashIcon";import"@heroicons/react/24/solid/CheckBadgeIcon";import"@heroicons/react/24/solid/IdentificationIcon";import"@heroicons/react/24/outline/MinusCircleIcon";import"@heroicons/react/24/outline/ArrowRightEndOnRectangleIcon";import"@heroicons/react/24/solid/ShieldCheckIcon";import"js-cookie";import"permissionless";import"permissionless/accounts";import"permissionless/clients/pimlico";import"viem/account-abstraction";function C(){let{user:C}=s(),{hideWalletUIs:T,openPrivyModal:P,chains:S,appId:b,rpcConfig:A,client:M}=f(),k=l(),{wallets:F}=d(),{setModalData:W}=m(),x=p(C),E=async(o=c.id)=>{let s=v(F);if(!s)throw Error("No connected wallet found");let l="string"==typeof o?r(o):o;if(![c.id,2741].includes(l))throw Error("Error, only Abstract chains are supported");let d=S.find((e=>e.id===l));if(!d)throw Error("Chain not configured");await s.switchChain(d.id);let m=await s.getEthereumProvider(),p=t({account:s.address,transport:n(m)}),u=a({address:s.address,signMessage:p.signMessage,signTransaction:p.signTransaction,signTypedData:p.signTypedData});return await e({chain:d,transport:i(y(d,A,b)),publicTransport:i(y(d,A,b)),signer:u})};return{signMessage:async({message:e},o)=>{let r=await E(o);return new Promise((async(o,t)=>{let{entropyId:n,entropyIdVerifier:i}=u(C);T.current=!0,W({connectWallet:{recoveryMethod:x.recoveryMethod,connectingWalletAddress:x.address,entropyId:n,entropyIdVerifier:i,onCompleteNavigateTo:h,onFailure:()=>{}},signMessage:{method:"personal_sign",data:e,confirmAndSign:()=>r.signMessage({message:e}),onSuccess:e=>o(e),onFailure:t,uiOptions:{isCancellable:!0}}}),P(I)})).finally((()=>{T.current=!1}))},signTypedData:async(e,o)=>{let r=await E(o);return new Promise((async(o,t)=>{T.current=!0;let{entropyId:n,entropyIdVerifier:i}=u(C);W({connectWallet:{recoveryMethod:x.recoveryMethod,connectingWalletAddress:x.address,entropyId:n,entropyIdVerifier:i,onCompleteNavigateTo:h,onFailure:()=>{}},signMessage:{method:"eth_signTypedData_v4",data:e,confirmAndSign:()=>r.signTypedData(e),onSuccess:e=>o(e),onFailure:t,uiOptions:{isCancellable:!0}}}),P(I)})).finally((()=>{T.current=!1}))},sendTransaction:async e=>{let r=await E(e.chainId),t=[],n="calls"in e&&void 0!==e.calls;return t=n?[...e.calls]:[e],new Promise((async(i,a)=>{T.current=!0;let{entropyId:c,entropyIdVerifier:s}=u(C);W({connectWallet:{recoveryMethod:x.recoveryMethod,connectingWalletAddress:x.address,entropyId:c,entropyIdVerifier:s,onCompleteNavigateTo:g,onFailure:()=>{}},sendTransaction:{transactionRequests:w({calls:t,chain:r.chain,maxPriorityFeePerGas:e.maxPriorityFeePerGas,maxFeePerGas:e.maxFeePerGas,nonce:e.nonce?BigInt(e.nonce):void 0}),entropyId:c,entropyIdVerifier:s,transactingWalletAddress:r.account.address,transactingWalletIndex:void 0,scanTransaction:async()=>{if(!M)throw Error("Privy client not found");let t=n?o(r.account.address,e):e,i=await r.prepareAbstractTransactionRequest(t);return await M.scanTransaction({metadata:{domain:k.embeddedWallets.transactionScanning.domain},chain_id:i.chainId.toString(),request:{method:"eth_sendTransaction",params:[{from:i.from,to:i.to,value:i.value?.toString(),gas:i.gas?.toString(),gasPrice:i.gasPrice?.toString(),nonce:i.nonce?.toString(),data:i.data,eip_712_meta:{paymaster_params:{paymaster:i.paymaster,paymaster_input:i.paymasterInput}}}]}})},signOnly:!1,getIsSponsored:async()=>void 0!==e.paymaster&&void 0!==e.paymasterInput,onConfirm:()=>n?r.sendTransactionBatch(e):r.sendTransaction(e),onSuccess:e=>i(e.hash),onFailure:a,uiOptions:{isCancellable:!0}}}),P(I)})).finally((()=>{T.current=!1}))},signTransaction:async e=>{let r=await E(e.chainId),t=[],n="calls"in e&&void 0!==e.calls;return t=n?[...e.calls]:[e],new Promise((async(i,a)=>{T.current=!0;let{entropyId:c,entropyIdVerifier:s}=u(C);W({connectWallet:{recoveryMethod:x.recoveryMethod,connectingWalletAddress:x.address,entropyId:c,entropyIdVerifier:s,onCompleteNavigateTo:g,onFailure:()=>{}},sendTransaction:{transactionRequests:w({calls:t,chain:r.chain,maxPriorityFeePerGas:e.maxPriorityFeePerGas,maxFeePerGas:e.maxFeePerGas,nonce:e.nonce?BigInt(e.nonce):void 0}),entropyId:c,entropyIdVerifier:s,transactingWalletAddress:r.account.address,transactingWalletIndex:void 0,scanTransaction:async()=>{if(!M)throw Error("Privy client not found");let t=n?o(r.account.address,e):e,i=await r.prepareAbstractTransactionRequest(t);return await M.scanTransaction({metadata:{domain:k.embeddedWallets.transactionScanning.domain},chain_id:i.chainId.toString(),request:{method:"eth_sendTransaction",params:[{from:i.from,to:i.to,value:i.value?.toString(),gas:i.gas?.toString(),gasPrice:i.gasPrice?.toString(),nonce:i.nonce?.toString(),data:i.data}]}})},signOnly:!0,getIsSponsored:async()=>void 0!==e.paymaster&&void 0!==e.paymasterInput,onConfirm:()=>{if(!n)return r.signTransaction(e);throw Error("Batch transactions not supported for signing")},onSuccess:e=>i(e.hash),onFailure:a,uiOptions:{isCancellable:!0}}}),P(I)})).finally((()=>{T.current=!1}))}}}export{C as useAbstractSmartWallets};
|
package/dist/esm/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{u as e,g as o,a as i,b as n,c as s,d as l,C as h,e as d,s as p,P as m,f as k,h as C,i as f,G as T,W,j as U,k as P,l as R,m as S,n as O,o as _,p as j}from"./privy-provider-8kKbowq5.mjs";export{t as Captcha,v as ConnectorManager,E as EthereumWalletConnector,N as LoginModal,F as PrivyClient,q as PrivyProvider,V as VERSION,w as WalletConnector,B as errorIndicatesMaxMfaRetries,D as errorIndicatesMfaTimeout,A as errorIndicatesMfaVerificationFailed,r as getAccessToken,K as useCreateWallet,H as useIdentityToken,M as useImportWallet,I as useLogout,y as useMfa,z as useMfaEnrollment,x as usePrivy,J as useRegisterMfaListener,L as useSolanaWallets}from"./privy-provider-8kKbowq5.mjs";import{useCallback as G,useMemo as Q,useEffect as X,useContext as $,useRef as Y}from"react";import{u as Z,P as ee,a as te,I as re}from"./internal-context-D5bEplez.mjs";export{c as useActiveWallet,a as useConnectWallet,b as useFundWallet,u as useLogin}from"./useActiveWallet-Cpqv9qnc.mjs";import{F as oe}from"./frame-DTkUHpPA.mjs";import{zeroAddress as ie,getAddress as ne,createWalletClient as ae,http as se,parseSignature as ce}from"viem";import{hashAuthorization as le}from"viem/utils";export{DEFAULT_SUPPORTED_CHAINS as SUPPORTED_CHAINS,addPrivyRpcToChain,addRpcUrlOverrideToChain}from"@privy-io/js-sdk-core";export{g as getEmbeddedConnectedWallet}from"./getEmbeddedConnectedWallet-CSSBWE2p.mjs";import"react/jsx-runtime";import"mipd";import"react-device-detect";import"uuid";import"jose";import"eventemitter3";import"@coinbase/wallet-sdk";import"@marsidev/react-turnstile";import"styled-components";import"tinycolor2";import"@heroicons/react/24/outline/DevicePhoneMobileIcon";import"@heroicons/react/24/outline/FingerPrintIcon";import"@heroicons/react/24/outline/PhoneIcon";import"@heroicons/react/24/outline/ShieldCheckIcon";import"@heroicons/react/24/outline/ArrowLeftIcon";import"@heroicons/react/24/outline/ArrowRightIcon";import"@heroicons/react/24/outline/QuestionMarkCircleIcon";import"@heroicons/react/24/outline/XMarkIcon";import"@heroicons/react/24/outline/ChevronDownIcon";import"@heroicons/react/24/outline/CalendarIcon";import"@heroicons/react/24/outline/ExclamationTriangleIcon";import"@headlessui/react";import"@walletconnect/ethereum-provider";import"zustand";import"fast-password-entropy";import"secure-password-utilities";import"secure-password-utilities/wordlists";import"@heroicons/react/24/outline/UserCircleIcon";import"@heroicons/react/24/outline/EnvelopeIcon";import"@heroicons/react/20/solid/CheckIcon";import"@heroicons/react/24/outline/WalletIcon";import"@heroicons/react/24/outline/CheckIcon";import"@heroicons/react/24/outline/Square2StackIcon";import"@heroicons/react/24/outline/ExclamationCircleIcon";import"@heroicons/react/24/outline/ArrowTopRightOnSquareIcon";import"@heroicons/react/24/solid/DocumentCheckIcon";import"@heroicons/react/24/solid/XCircleIcon";import"@heroicons/react/24/solid/CheckCircleIcon";import"qrcode";import"@heroicons/react/24/outline/ChevronRightIcon";import"@heroicons/react/24/outline/LockClosedIcon";import"@heroicons/react/24/outline/PencilSquareIcon";import"@heroicons/react/24/outline/ArrowPathIcon";import"@heroicons/react/24/outline/EyeIcon";import"@heroicons/react/24/outline/EyeSlashIcon";import"@heroicons/react/24/outline/KeyIcon";import"@heroicons/react/24/outline/ArrowDownTrayIcon";import"@heroicons/react/24/outline/ClipboardDocumentCheckIcon";import"@heroicons/react/24/outline/DocumentDuplicateIcon";import"@heroicons/react/24/solid/LockClosedIcon";import"@heroicons/react/24/outline/CheckCircleIcon";import"@heroicons/react/24/outline/InformationCircleIcon";import"@heroicons/react/24/outline/CreditCardIcon";import"@heroicons/react/24/outline/QrCodeIcon";import"@heroicons/react/24/solid/ArrowsRightLeftIcon";import"@heroicons/react/24/outline/GlobeAltIcon";import"ofetch";import"@heroicons/react/24/outline";import"@heroicons/react/24/outline/ClipboardDocumentIcon";import"@heroicons/react/24/outline/CloudArrowUpIcon";import"@heroicons/react/24/outline/NoSymbolIcon";import"@heroicons/react/24/outline/ClockIcon";import"@heroicons/react/24/outline/TrashIcon";import"@heroicons/react/24/solid/CheckBadgeIcon";import"@heroicons/react/24/solid/IdentificationIcon";import"@heroicons/react/24/outline/MinusCircleIcon";import"@heroicons/react/24/outline/ArrowRightEndOnRectangleIcon";import"@heroicons/react/24/solid/ShieldCheckIcon";import"js-cookie";const ue=()=>{let{user:t}=e(),{walletProxy:r}=Z();return{recover:G((async e=>{if(!r)throw Error("Wallet proxy is not ready");let n=await o();if(!t||!n)throw new ee("User must be logged in before attempting to modify the recovery method.");let{entropyId:a,entropyIdVerifier:s}=i(t);try{await r.recover({entropyId:a,entropyIdVerifier:s,accessToken:n,...e})}catch{throw new ee("Unable to recover wallets")}}),[r,t])}},he=()=>{let{client:e,setAuthenticated:t,setUser:r}=Z();return Q((()=>({init:async()=>{if(!e)throw new ee("Must initialize Privy client first.");let t=new oe;return e.startAuthFlow(t),await t.init()},login:async({fid:o,message:i,signature:n})=>{if(!e)throw new ee("Must initialize Privy client first.");if(!(e.authFlow instanceof oe))throw new ee("Must initialize Farcaster frame flow first.");e.authFlow.setAuthData({message:i,signature:n,fid:o});let{user:a}=await e.authenticate();if(!a)throw new ee("Failed to login with Farcaster V2");return r(a),t(!0),{user:a}}})),[e,r,t])},de=t=>{n("login",t);let r=s(),o=l(),{ready:i,user:a}=e(),{initLoginWithHeadlessOAuth:c,loginWithHeadlessOAuth:u,oAuthState:w,setOAuthState:m,isHeadlessOAuthLoading:g}=Z(),y=G((async e=>{try{if(r.enabled&&"success"!==r.status)throw new h(r.error,null,te.CAPTCHA_FAILURE);return await c(e.provider,r.token,e.disableSignup)}catch(e){throw m({status:"error",error:e}),e}}),[c,r]),A=G((async()=>{let e=d();try{if(a)return console.warn("Cannot login with OAuth when already logged in"),a;if(!e.inProgress)throw Error("Cannot login with OAuth because no OAuth flow is in progress");if(e.popupFlow)return}catch(e){throw m({status:"error",error:e}),e}try{return await u(e)}catch(e){throw m({status:"error",error:e}),e}finally{p()}}),[u]);return X((()=>{let e=d();i&&o&&e.inProgress&&!e.withPrivyUi&&!e.popupFlow&&A().catch((()=>{}))}),[i,o]),{initOAuth:y,loading:g,state:w}},pe=e=>{let t=s(),{emailOtpState:r,setEmailOtpState:o,initLoginWithEmail:i,loginWithCode:n}=Z();return{sendCode:G((async({email:r,disableSignup:n})=>{try{let e;if(!r)throw Error("Email required to send OTP code");if(t.enabled&&"error"===t.status)throw new h(t.error,null,te.CAPTCHA_FAILURE);return t.enabled&&"success"!==t.status&&(t.execute(),e=await t.waitForResult()),await i({email:r,captchaToken:e,disableSignup:n,withPrivyUi:!1})}catch(r){throw o({status:"error",error:r}),e?.onError?.(r.privyErrorCode||te.UNKNOWN_AUTH_ERROR),r}}),[i]),loginWithCode:G((async({code:r})=>{try{if(t.enabled&&"error"===t.status)throw new h(t.error,null,te.CAPTCHA_FAILURE);let{user:o,isNewUser:i,wasAlreadyAuthenticated:a,linkedAccount:s}=await n(r);e?.onComplete?.({user:o,isNewUser:i,wasAlreadyAuthenticated:a,loginMethod:"email",loginAccount:s})}catch(r){throw o({status:"error",error:r}),e?.onError?.(r.privyErrorCode||te.UNKNOWN_AUTH_ERROR),r}}),[n,t.status]),state:r}},we=e=>{let t=s(),{initSignupWithPasskey:r,signupWithPasskey:o,passkeyAuthState:i,setPasskeyAuthState:n}=Z();return{signupWithPasskey:G((async()=>{try{let i;if(t.enabled&&"error"===t.status)throw new h(t.error,null,te.CAPTCHA_FAILURE);t.enabled&&"success"!==t.status&&(t.execute(),i=await t.waitForResult()),await r({captchaToken:i,withPrivyUi:!1});let{user:n,isNewUser:a,wasAlreadyAuthenticated:s,loginAccount:c}=await o();e?.onComplete?.({user:n,isNewUser:a,wasAlreadyAuthenticated:s,loginMethod:"passkey",loginAccount:c})}catch(t){throw n({status:"error",error:t}),e?.onError?.(t.privyErrorCode||te.UNKNOWN_AUTH_ERROR),t}}),[o,t.status]),state:i}},me=e=>{let t=s(),{initLoginWithPasskey:r,loginWithPasskey:o,passkeyAuthState:i,setPasskeyAuthState:n}=Z();return{loginWithPasskey:G((async i=>{try{let n;if(t.enabled&&"error"===t.status)throw new h(t.error,null,te.CAPTCHA_FAILURE);t.enabled&&"success"!==t.status&&(t.execute(),n=await t.waitForResult()),await r({captchaToken:n,withPrivyUi:!1});let{user:a,isNewUser:s,wasAlreadyAuthenticated:c,loginAccount:l}=await o(i);e?.onComplete?.({user:a,isNewUser:s,wasAlreadyAuthenticated:c,loginMethod:"passkey",loginAccount:l})}catch(i){throw n({status:"error",error:i}),e?.onError?.(i.privyErrorCode||te.UNKNOWN_AUTH_ERROR),i}}),[o,t.status]),state:i}},ge=e=>{let{initLinkWithPasskey:t,linkWithPasskey:r,passkeyAuthState:o,setPasskeyAuthState:i}=Z();return{linkWithPasskey:G((async()=>{try{await t();let o=await r();if(!o)throw Error("Error, user not found");let i=o.linkedAccounts.filter((e=>"passkey"===e.type)).sort(((e,t)=>t.latestVerifiedAt.getTime()-e.latestVerifiedAt.getTime()))[0];e?.onSuccess?.({user:o,linkMethod:"passkey",linkedAccount:i})}catch(t){throw i({status:"error",error:t}),e?.onError?.(t.privyErrorCode||te.UNKNOWN_AUTH_ERROR,{linkMethod:"passkey"}),t}}),[r]),state:o}},ye=e=>{let t=s(),{smsOtpState:r,setSmsOtpState:o,initLoginWithSms:i,loginWithCode:n}=Z();return{sendCode:G((async({phoneNumber:r,disableSignup:n})=>{try{let e;if(!r)throw Error("SMS required to send OTP code");if(t.enabled&&"error"===t.status)throw new h(t.error,null,te.CAPTCHA_FAILURE);return t.enabled&&"success"!==t.status&&(t.execute(),e=await t.waitForResult()),await i({phoneNumber:r,captchaToken:e,disableSignup:n,withPrivyUi:!1})}catch(r){throw o({status:"error",error:r}),e?.onError?.(r.privyErrorCode||te.UNKNOWN_AUTH_ERROR),r}}),[i]),loginWithCode:G((async({code:r})=>{try{if(t.enabled&&"success"!==t.status)throw new h(t.error,null,te.CAPTCHA_FAILURE);let{user:o,isNewUser:i,wasAlreadyAuthenticated:a,linkedAccount:s}=await n(r);e?.onComplete?.({user:o,isNewUser:i,wasAlreadyAuthenticated:a,loginMethod:"sms",loginAccount:s})}catch(r){throw o({status:"error",error:r}),e?.onError?.(r.privyErrorCode||te.UNKNOWN_AUTH_ERROR),r}}),[n,t.status]),state:r}},Ae=t=>{let{connectOrCreateWallet:r}=e();return n("connectOrCreateWallet",t),{connectOrCreateWallet:r}},ke=e=>{let t=s(),{siweState:r,setSiweState:o,linkWithSiwe:i,generateSiweMessage:n}=Z();return{generateSiweMessage:G((async({address:t,chainId:r})=>{try{if(!t||!r)throw Error("wallet address and chainId required to generate nonce");return await n({address:t,chainId:r}).then((e=>e))}catch(t){throw o({status:"error",error:t}),e?.onError?.(t.privyErrorCode||te.UNKNOWN_AUTH_ERROR,{linkMethod:"siwe"}),t}}),[n]),linkWithSiwe:G((async({signature:r,message:n,chainId:a,walletClientType:s,connectorType:c})=>{try{if(t.enabled&&"success"!==t.status)throw new h(t.error,null,te.CAPTCHA_FAILURE);let{user:o,linkedAccount:l}=await i({message:n,signature:r,chainId:a,walletClientType:s,connectorType:c});l&&e?.onSuccess?.({user:o,linkMethod:"siwe",linkedAccount:l})}catch(r){throw o({status:"error",error:r}),e?.onError?.(r.privyErrorCode||te.UNKNOWN_AUTH_ERROR,{linkMethod:"siwe"}),r}}),[i,t.status]),state:r}};function Ce(){let{signTransaction:e}=$(m);return{signTransaction:e}}function fe(e){let{linkEmail:t,linkPhone:r,linkWallet:o,linkGoogle:i,linkApple:a,linkTwitter:s,linkDiscord:c,linkGithub:l,linkLinkedIn:u,linkTiktok:h,linkSpotify:d,linkInstagram:p,linkTelegram:w,linkFarcaster:g}=$(m);return n("linkAccount",e),{linkEmail:t,linkPhone:r,linkWallet:o,linkGoogle:i,linkApple:a,linkTwitter:s,linkDiscord:c,linkGithub:l,linkLinkedIn:u,linkTiktok:h,linkSpotify:d,linkInstagram:p,linkFarcaster:g,linkTelegram:w}}function Ie(e){let{updateEmail:t,updatePhone:r}=$(m);return n("update",e),{updateEmail:t,updatePhone:r}}const Te=()=>{let{connectCoinbaseSmartWallet:e}=Z();return{connectCoinbaseSmartWallet:e}},Ee=()=>{let{startCrossAppAuthFlow:t,unlinkCrossAppAccount:r,signMessageWithCrossAppWallet:o,signTypedDataWithCrossAppWallet:i,sendTransactionWithCrossAppWallet:n}=e();return{loginWithCrossAppAccount:({appId:e})=>t({appId:e,action:"login"}),linkCrossAppAccount:({appId:e})=>t({appId:e,action:"link"}),unlinkCrossAppAccount:r,signMessage:o,signTypedData:i,sendTransaction:n}};function We(e){let{sendTransaction:t}=$(m);return n("sendTransaction",e),{sendTransaction:t}}function Ue(e){let{setWalletPassword:t}=$(m);return n("setWalletPassword",e),{setWalletPassword:t}}function Pe(){let t=k(),{getAccessToken:r}=e(),o=C(),{client:i,setUser:n,setAuthenticated:a,setIsNewUser:s,initializeWalletProxy:c}=Z(),{create:l}=f();return{createGuestAccount:async()=>{if(!t.id||!i)throw Error("SDK not yet ready");i.startAuthFlow(new T(t.id));try{let e=await i.authenticate(),u=e.user,h=e.isNewUser??!1;if(!u)throw new ee("Unable to authenticate guest account");let d=await r(),p=await c(W);if(d&&p)try{let e=U(u,t.embeddedWallets.ethereum.createOnLogin),r=P(u,t.embeddedWallets.solana.createOnLogin);e&&r?(u=(await l({chainType:"ethereum",latestUser:u})).user,u=(await l({chainType:"solana",latestUser:u})).user):r?u=(await l({chainType:"solana",latestUser:u})).user:e?u=(await l({chainType:"ethereum",latestUser:u})).user:n(u)}catch(e){n(u),console.warn("Unable to create embedded wallet for guest account")}return s(h),a(!0),o("login","onComplete",{user:u,isNewUser:h,wasAlreadyAuthenticated:!1,loginMethod:"guest",loginAccount:null}),u}catch(e){throw o("login","onError",e.privyErrorCode||te.UNKNOWN_AUTH_ERROR),e}}}}function Re(e){let{setWalletRecovery:t}=$(m);return n("setWalletRecovery",e),{setWalletRecovery:t}}function ve(e){let{signMessage:t}=$(m);return n("signMessage",e),{signMessage:t}}const Se=()=>{let{ready:t,wallets:r}=R(),{user:o}=e(),{rpcConfig:i,chains:n,appId:a}=Z();return{signAuthorization:G((async(e,s)=>{if(!o)throw Error("User must be authenticated before signing with a Privy wallet");if(!t)throw Error("Wallets are not ready");let c=s?.address??S(o)?.address??ie,l=r.find((e=>ne(e.address)===ne(c)));if(!l)throw Error("Signing wallet not found.");let u=e.chainId??Number(l.chainId.split(":")[1]),h=n.find((e=>e.id===u));if(!h)throw Error("Error, chain not configured in PrivyProvider config");let d=ae({account:c,chain:h,transport:se(O(h,i,a))}),p=await d.prepareAuthorization({...e}),w=await l.getEthereumProvider(),m=await w.request({method:"secp256k1_sign",params:[le(p)]});return{...p,...ce(m)}}),[t,r,o,n])}};function Ne(e){let{signTypedData:t}=$(m);return n("signTypedData",e),{signTypedData:t}}const be=()=>{let{isModalOpen:e}=$(m);return{isOpen:e}};function Oe(e){let{getAccessToken:t}=$(m);return n("accessToken",e),{getAccessToken:t}}function Me(t){let{authenticated:r,user:o}=e(),{initLoginWithOAuth:i}=Z(),a=C();return n("oAuthAuthorization",t),{reauthorize:e=>Fe(r,o,i,a,e.provider)}}let Fe=async(e,t,r,o,i)=>{if(!e)throw o("linkAccount","onError",te.MUST_BE_AUTHENTICATED,{linkMethod:i}),new ee("User must be authenticated before linking an account.");if(!t?.linkedAccounts.some((e=>e.type.includes(i))))throw new ee(`OAuth account of type ${i} not linked to the account.`);await r(i)};const _e=e=>{let t=_();return n("customAuth",e),{status:t}};function Le({isAuthenticated:e,isLoading:t,...r}){let o=Y();X((()=>{t||o.current?.()}),[e,t]);let i=G((e=>(o.current=e,()=>{o.current=void 0})),[]);return j({...r,subscribe:i})}function De(){let{getFarcasterSignerPublicKey:t,signFarcasterMessage:r,requestFarcasterSignerFromWarpcast:o}=e();return{getFarcasterSignerPublicKey:t,signFarcasterMessage:r,requestFarcasterSignerFromWarpcast:o}}const He=()=>{let{revokeDelegatedWallets:e,delegateWallet:t}=Z();return{delegateWallet:async({address:e,chainType:r})=>await t({address:e,chainType:r,showDelegationUIs:!0}),revokeWallets:async()=>await e({showDelegationUIs:!0})}},xe=()=>{let{setUser:e,client:t}=$(re),{user:r}=$(m);return{user:r,refreshUser:G((async()=>{let r=await(t?.updateUserAndIdToken());return e(r??null),r}),[t,e])}},Ke=e=>{let t=s(),{initLoginWithTelegram:r,loginWithTelegram:o,telegramAuthState:i,setTelegramAuthState:n}=Z();return{login:G((async i=>{try{if(t.enabled&&"success"!==t.status)throw new h(t.error,null,te.CAPTCHA_FAILURE);await r(t.token,i?.disableSignup);let{user:n,isNewUser:a,loginAccount:s,wasAlreadyAuthenticated:c}=await o({intent:"login"});e?.onComplete?.({user:n,isNewUser:a,wasAlreadyAuthenticated:c,loginMethod:"telegram",loginAccount:s})}catch(i){throw n({status:"error",error:i}),e?.onError?.(i.privyErrorCode||te.UNKNOWN_AUTH_ERROR),i}}),[r,o,t]),state:i}},je=()=>{let{revokeDelegatedWallets:e,delegateWallet:t}=Z();return{delegateWallet:async({address:e,chainType:r})=>await t({address:e,chainType:r,showDelegationUIs:!1}),revokeWallets:async()=>await e({showDelegationUIs:!1})}};export{Te as useConnectCoinbaseSmartWallet,Ae as useConnectOrCreateWallet,Ee as useCrossAppAccounts,_e as useCustomAuth,He as useDelegatedActions,De as useFarcasterSigner,Pe as useGuestAccounts,je as useHeadlessDelegatedActions,fe as useLinkAccount,ge as useLinkWithPasskey,ke as useLinkWithSiwe,pe as useLoginWithEmail,he as useLoginWithFarcasterV2,de as useLoginWithOAuth,me as useLoginWithPasskey,ye as useLoginWithSms,Ke as useLoginWithTelegram,be as useModalStatus,Me as useOAuthTokens,ue as useRecoverEmbeddedWallet,We as useSendTransaction,Ue as useSetWalletPassword,Re as useSetWalletRecovery,Se as useSignAuthorization,ve as useSignMessage,Ce as useSignTransaction,Ne as useSignTypedData,we as useSignupWithPasskey,Le as useSubscribeToJwtAuthWithFlag,j as useSyncJwtBasedAuthState,Oe as useToken,Ie as useUpdateAccount,xe as useUser,R as useWallets};
|
|
1
|
+
import{u as e,g as o,a as i,b as n,c as s,d as l,C as h,e as d,s as p,P as m,f as k,h as C,i as f,G as T,W,j as U,k as P,l as R,m as S,n as O,o as _,p as j}from"./privy-provider-k2j2FRnN.mjs";export{t as Captcha,v as ConnectorManager,E as EthereumWalletConnector,N as LoginModal,F as PrivyClient,q as PrivyProvider,V as VERSION,w as WalletConnector,B as errorIndicatesMaxMfaRetries,D as errorIndicatesMfaTimeout,A as errorIndicatesMfaVerificationFailed,r as getAccessToken,K as useCreateWallet,H as useIdentityToken,M as useImportWallet,I as useLogout,y as useMfa,z as useMfaEnrollment,x as usePrivy,J as useRegisterMfaListener,L as useSolanaWallets}from"./privy-provider-k2j2FRnN.mjs";import{useCallback as G,useMemo as Q,useEffect as X,useContext as $,useRef as Y}from"react";import{u as Z,P as ee,a as te,I as re}from"./internal-context-D5bEplez.mjs";export{c as useActiveWallet,a as useConnectWallet,b as useFundWallet,u as useLogin}from"./useActiveWallet-BxyfU0Yc.mjs";import{F as oe}from"./frame-DTkUHpPA.mjs";import{zeroAddress as ie,getAddress as ne,createWalletClient as ae,http as se,parseSignature as ce}from"viem";import{hashAuthorization as le}from"viem/utils";export{DEFAULT_SUPPORTED_CHAINS as SUPPORTED_CHAINS,addPrivyRpcToChain,addRpcUrlOverrideToChain}from"@privy-io/js-sdk-core";export{g as getEmbeddedConnectedWallet}from"./getEmbeddedConnectedWallet-CSSBWE2p.mjs";import"react/jsx-runtime";import"mipd";import"react-device-detect";import"uuid";import"jose";import"eventemitter3";import"@coinbase/wallet-sdk";import"@marsidev/react-turnstile";import"styled-components";import"tinycolor2";import"@heroicons/react/24/outline/DevicePhoneMobileIcon";import"@heroicons/react/24/outline/FingerPrintIcon";import"@heroicons/react/24/outline/PhoneIcon";import"@heroicons/react/24/outline/ShieldCheckIcon";import"@heroicons/react/24/outline/ArrowLeftIcon";import"@heroicons/react/24/outline/ArrowRightIcon";import"@heroicons/react/24/outline/QuestionMarkCircleIcon";import"@heroicons/react/24/outline/XMarkIcon";import"@heroicons/react/24/outline/ChevronDownIcon";import"@heroicons/react/24/outline/CalendarIcon";import"@heroicons/react/24/outline/ExclamationTriangleIcon";import"@headlessui/react";import"@walletconnect/ethereum-provider";import"zustand";import"fast-password-entropy";import"secure-password-utilities";import"secure-password-utilities/wordlists";import"@heroicons/react/24/outline/UserCircleIcon";import"@heroicons/react/24/outline/EnvelopeIcon";import"@heroicons/react/20/solid/CheckIcon";import"@heroicons/react/24/outline/WalletIcon";import"@heroicons/react/24/outline/CheckIcon";import"@heroicons/react/24/outline/Square2StackIcon";import"@heroicons/react/24/outline/ExclamationCircleIcon";import"@heroicons/react/24/outline/ArrowTopRightOnSquareIcon";import"@heroicons/react/24/solid/DocumentCheckIcon";import"@heroicons/react/24/solid/XCircleIcon";import"@heroicons/react/24/solid/CheckCircleIcon";import"qrcode";import"@heroicons/react/24/outline/ChevronRightIcon";import"@heroicons/react/24/outline/LockClosedIcon";import"@heroicons/react/24/outline/PencilSquareIcon";import"@heroicons/react/24/outline/ArrowPathIcon";import"@heroicons/react/24/outline/EyeIcon";import"@heroicons/react/24/outline/EyeSlashIcon";import"@heroicons/react/24/outline/KeyIcon";import"@heroicons/react/24/outline/ArrowDownTrayIcon";import"@heroicons/react/24/outline/ClipboardDocumentCheckIcon";import"@heroicons/react/24/outline/DocumentDuplicateIcon";import"@heroicons/react/24/solid/LockClosedIcon";import"@heroicons/react/24/outline/CheckCircleIcon";import"@heroicons/react/24/outline/InformationCircleIcon";import"@heroicons/react/24/outline/CreditCardIcon";import"@heroicons/react/24/outline/QrCodeIcon";import"@heroicons/react/24/solid/ArrowsRightLeftIcon";import"@heroicons/react/24/outline/GlobeAltIcon";import"ofetch";import"@heroicons/react/24/outline";import"@heroicons/react/24/outline/ClipboardDocumentIcon";import"@heroicons/react/24/outline/CloudArrowUpIcon";import"@heroicons/react/24/outline/NoSymbolIcon";import"@heroicons/react/24/outline/ClockIcon";import"@heroicons/react/24/outline/TrashIcon";import"@heroicons/react/24/solid/CheckBadgeIcon";import"@heroicons/react/24/solid/IdentificationIcon";import"@heroicons/react/24/outline/MinusCircleIcon";import"@heroicons/react/24/outline/ArrowRightEndOnRectangleIcon";import"@heroicons/react/24/solid/ShieldCheckIcon";import"js-cookie";const ue=()=>{let{user:t}=e(),{walletProxy:r}=Z();return{recover:G((async e=>{if(!r)throw Error("Wallet proxy is not ready");let n=await o();if(!t||!n)throw new ee("User must be logged in before attempting to modify the recovery method.");let{entropyId:a,entropyIdVerifier:s}=i(t);try{await r.recover({entropyId:a,entropyIdVerifier:s,accessToken:n,...e})}catch{throw new ee("Unable to recover wallets")}}),[r,t])}},he=()=>{let{client:e,setAuthenticated:t,setUser:r}=Z();return Q((()=>({init:async()=>{if(!e)throw new ee("Must initialize Privy client first.");let t=new oe;return e.startAuthFlow(t),await t.init()},login:async({fid:o,message:i,signature:n})=>{if(!e)throw new ee("Must initialize Privy client first.");if(!(e.authFlow instanceof oe))throw new ee("Must initialize Farcaster frame flow first.");e.authFlow.setAuthData({message:i,signature:n,fid:o});let{user:a}=await e.authenticate();if(!a)throw new ee("Failed to login with Farcaster V2");return r(a),t(!0),{user:a}}})),[e,r,t])},de=t=>{n("login",t);let r=s(),o=l(),{ready:i,user:a}=e(),{initLoginWithHeadlessOAuth:c,loginWithHeadlessOAuth:u,oAuthState:w,setOAuthState:m,isHeadlessOAuthLoading:g}=Z(),y=G((async e=>{try{if(r.enabled&&"success"!==r.status)throw new h(r.error,null,te.CAPTCHA_FAILURE);return await c(e.provider,r.token,e.disableSignup)}catch(e){throw m({status:"error",error:e}),e}}),[c,r]),A=G((async()=>{let e=d();try{if(a)return console.warn("Cannot login with OAuth when already logged in"),a;if(!e.inProgress)throw Error("Cannot login with OAuth because no OAuth flow is in progress");if(e.popupFlow)return}catch(e){throw m({status:"error",error:e}),e}try{return await u(e)}catch(e){throw m({status:"error",error:e}),e}finally{p()}}),[u]);return X((()=>{let e=d();i&&o&&e.inProgress&&!e.withPrivyUi&&!e.popupFlow&&A().catch((()=>{}))}),[i,o]),{initOAuth:y,loading:g,state:w}},pe=e=>{let t=s(),{emailOtpState:r,setEmailOtpState:o,initLoginWithEmail:i,loginWithCode:n}=Z();return{sendCode:G((async({email:r,disableSignup:n})=>{try{let e;if(!r)throw Error("Email required to send OTP code");if(t.enabled&&"error"===t.status)throw new h(t.error,null,te.CAPTCHA_FAILURE);return t.enabled&&"success"!==t.status&&(t.execute(),e=await t.waitForResult()),await i({email:r,captchaToken:e,disableSignup:n,withPrivyUi:!1})}catch(r){throw o({status:"error",error:r}),e?.onError?.(r.privyErrorCode||te.UNKNOWN_AUTH_ERROR),r}}),[i]),loginWithCode:G((async({code:r})=>{try{if(t.enabled&&"error"===t.status)throw new h(t.error,null,te.CAPTCHA_FAILURE);let{user:o,isNewUser:i,wasAlreadyAuthenticated:a,linkedAccount:s}=await n(r);e?.onComplete?.({user:o,isNewUser:i,wasAlreadyAuthenticated:a,loginMethod:"email",loginAccount:s})}catch(r){throw o({status:"error",error:r}),e?.onError?.(r.privyErrorCode||te.UNKNOWN_AUTH_ERROR),r}}),[n,t.status]),state:r}},we=e=>{let t=s(),{initSignupWithPasskey:r,signupWithPasskey:o,passkeyAuthState:i,setPasskeyAuthState:n}=Z();return{signupWithPasskey:G((async()=>{try{let i;if(t.enabled&&"error"===t.status)throw new h(t.error,null,te.CAPTCHA_FAILURE);t.enabled&&"success"!==t.status&&(t.execute(),i=await t.waitForResult()),await r({captchaToken:i,withPrivyUi:!1});let{user:n,isNewUser:a,wasAlreadyAuthenticated:s,loginAccount:c}=await o();e?.onComplete?.({user:n,isNewUser:a,wasAlreadyAuthenticated:s,loginMethod:"passkey",loginAccount:c})}catch(t){throw n({status:"error",error:t}),e?.onError?.(t.privyErrorCode||te.UNKNOWN_AUTH_ERROR),t}}),[o,t.status]),state:i}},me=e=>{let t=s(),{initLoginWithPasskey:r,loginWithPasskey:o,passkeyAuthState:i,setPasskeyAuthState:n}=Z();return{loginWithPasskey:G((async i=>{try{let n;if(t.enabled&&"error"===t.status)throw new h(t.error,null,te.CAPTCHA_FAILURE);t.enabled&&"success"!==t.status&&(t.execute(),n=await t.waitForResult()),await r({captchaToken:n,withPrivyUi:!1});let{user:a,isNewUser:s,wasAlreadyAuthenticated:c,loginAccount:l}=await o(i);e?.onComplete?.({user:a,isNewUser:s,wasAlreadyAuthenticated:c,loginMethod:"passkey",loginAccount:l})}catch(i){throw n({status:"error",error:i}),e?.onError?.(i.privyErrorCode||te.UNKNOWN_AUTH_ERROR),i}}),[o,t.status]),state:i}},ge=e=>{let{initLinkWithPasskey:t,linkWithPasskey:r,passkeyAuthState:o,setPasskeyAuthState:i}=Z();return{linkWithPasskey:G((async()=>{try{await t();let o=await r();if(!o)throw Error("Error, user not found");let i=o.linkedAccounts.filter((e=>"passkey"===e.type)).sort(((e,t)=>t.latestVerifiedAt.getTime()-e.latestVerifiedAt.getTime()))[0];e?.onSuccess?.({user:o,linkMethod:"passkey",linkedAccount:i})}catch(t){throw i({status:"error",error:t}),e?.onError?.(t.privyErrorCode||te.UNKNOWN_AUTH_ERROR,{linkMethod:"passkey"}),t}}),[r]),state:o}},ye=e=>{let t=s(),{smsOtpState:r,setSmsOtpState:o,initLoginWithSms:i,loginWithCode:n}=Z();return{sendCode:G((async({phoneNumber:r,disableSignup:n})=>{try{let e;if(!r)throw Error("SMS required to send OTP code");if(t.enabled&&"error"===t.status)throw new h(t.error,null,te.CAPTCHA_FAILURE);return t.enabled&&"success"!==t.status&&(t.execute(),e=await t.waitForResult()),await i({phoneNumber:r,captchaToken:e,disableSignup:n,withPrivyUi:!1})}catch(r){throw o({status:"error",error:r}),e?.onError?.(r.privyErrorCode||te.UNKNOWN_AUTH_ERROR),r}}),[i]),loginWithCode:G((async({code:r})=>{try{if(t.enabled&&"success"!==t.status)throw new h(t.error,null,te.CAPTCHA_FAILURE);let{user:o,isNewUser:i,wasAlreadyAuthenticated:a,linkedAccount:s}=await n(r);e?.onComplete?.({user:o,isNewUser:i,wasAlreadyAuthenticated:a,loginMethod:"sms",loginAccount:s})}catch(r){throw o({status:"error",error:r}),e?.onError?.(r.privyErrorCode||te.UNKNOWN_AUTH_ERROR),r}}),[n,t.status]),state:r}},Ae=t=>{let{connectOrCreateWallet:r}=e();return n("connectOrCreateWallet",t),{connectOrCreateWallet:r}},ke=e=>{let t=s(),{siweState:r,setSiweState:o,linkWithSiwe:i,generateSiweMessage:n}=Z();return{generateSiweMessage:G((async({address:t,chainId:r})=>{try{if(!t||!r)throw Error("wallet address and chainId required to generate nonce");return await n({address:t,chainId:r}).then((e=>e))}catch(t){throw o({status:"error",error:t}),e?.onError?.(t.privyErrorCode||te.UNKNOWN_AUTH_ERROR,{linkMethod:"siwe"}),t}}),[n]),linkWithSiwe:G((async({signature:r,message:n,chainId:a,walletClientType:s,connectorType:c})=>{try{if(t.enabled&&"success"!==t.status)throw new h(t.error,null,te.CAPTCHA_FAILURE);let{user:o,linkedAccount:l}=await i({message:n,signature:r,chainId:a,walletClientType:s,connectorType:c});l&&e?.onSuccess?.({user:o,linkMethod:"siwe",linkedAccount:l})}catch(r){throw o({status:"error",error:r}),e?.onError?.(r.privyErrorCode||te.UNKNOWN_AUTH_ERROR,{linkMethod:"siwe"}),r}}),[i,t.status]),state:r}};function Ce(){let{signTransaction:e}=$(m);return{signTransaction:e}}function fe(e){let{linkEmail:t,linkPhone:r,linkWallet:o,linkGoogle:i,linkApple:a,linkTwitter:s,linkDiscord:c,linkGithub:l,linkLinkedIn:u,linkTiktok:h,linkSpotify:d,linkInstagram:p,linkTelegram:w,linkFarcaster:g}=$(m);return n("linkAccount",e),{linkEmail:t,linkPhone:r,linkWallet:o,linkGoogle:i,linkApple:a,linkTwitter:s,linkDiscord:c,linkGithub:l,linkLinkedIn:u,linkTiktok:h,linkSpotify:d,linkInstagram:p,linkFarcaster:g,linkTelegram:w}}function Ie(e){let{updateEmail:t,updatePhone:r}=$(m);return n("update",e),{updateEmail:t,updatePhone:r}}const Te=()=>{let{connectCoinbaseSmartWallet:e}=Z();return{connectCoinbaseSmartWallet:e}},Ee=()=>{let{startCrossAppAuthFlow:t,unlinkCrossAppAccount:r,signMessageWithCrossAppWallet:o,signTypedDataWithCrossAppWallet:i,sendTransactionWithCrossAppWallet:n}=e();return{loginWithCrossAppAccount:({appId:e})=>t({appId:e,action:"login"}),linkCrossAppAccount:({appId:e})=>t({appId:e,action:"link"}),unlinkCrossAppAccount:r,signMessage:o,signTypedData:i,sendTransaction:n}};function We(e){let{sendTransaction:t}=$(m);return n("sendTransaction",e),{sendTransaction:t}}function Ue(e){let{setWalletPassword:t}=$(m);return n("setWalletPassword",e),{setWalletPassword:t}}function Pe(){let t=k(),{getAccessToken:r}=e(),o=C(),{client:i,setUser:n,setAuthenticated:a,setIsNewUser:s,initializeWalletProxy:c}=Z(),{create:l}=f();return{createGuestAccount:async()=>{if(!t.id||!i)throw Error("SDK not yet ready");i.startAuthFlow(new T(t.id));try{let e=await i.authenticate(),u=e.user,h=e.isNewUser??!1;if(!u)throw new ee("Unable to authenticate guest account");let d=await r(),p=await c(W);if(d&&p)try{let e=U(u,t.embeddedWallets.ethereum.createOnLogin),r=P(u,t.embeddedWallets.solana.createOnLogin);e&&r?(u=(await l({chainType:"ethereum",latestUser:u})).user,u=(await l({chainType:"solana",latestUser:u})).user):r?u=(await l({chainType:"solana",latestUser:u})).user:e?u=(await l({chainType:"ethereum",latestUser:u})).user:n(u)}catch(e){n(u),console.warn("Unable to create embedded wallet for guest account")}return s(h),a(!0),o("login","onComplete",{user:u,isNewUser:h,wasAlreadyAuthenticated:!1,loginMethod:"guest",loginAccount:null}),u}catch(e){throw o("login","onError",e.privyErrorCode||te.UNKNOWN_AUTH_ERROR),e}}}}function Re(e){let{setWalletRecovery:t}=$(m);return n("setWalletRecovery",e),{setWalletRecovery:t}}function ve(e){let{signMessage:t}=$(m);return n("signMessage",e),{signMessage:t}}const Se=()=>{let{ready:t,wallets:r}=R(),{user:o}=e(),{rpcConfig:i,chains:n,appId:a}=Z();return{signAuthorization:G((async(e,s)=>{if(!o)throw Error("User must be authenticated before signing with a Privy wallet");if(!t)throw Error("Wallets are not ready");let c=s?.address??S(o)?.address??ie,l=r.find((e=>ne(e.address)===ne(c)));if(!l)throw Error("Signing wallet not found.");let u=e.chainId??Number(l.chainId.split(":")[1]),h=n.find((e=>e.id===u));if(!h)throw Error("Error, chain not configured in PrivyProvider config");let d=ae({account:c,chain:h,transport:se(O(h,i,a))}),p=await d.prepareAuthorization({...e}),w=await l.getEthereumProvider(),m=await w.request({method:"secp256k1_sign",params:[le(p)]});return{...p,...ce(m)}}),[t,r,o,n])}};function Ne(e){let{signTypedData:t}=$(m);return n("signTypedData",e),{signTypedData:t}}const be=()=>{let{isModalOpen:e}=$(m);return{isOpen:e}};function Oe(e){let{getAccessToken:t}=$(m);return n("accessToken",e),{getAccessToken:t}}function Me(t){let{authenticated:r,user:o}=e(),{initLoginWithOAuth:i}=Z(),a=C();return n("oAuthAuthorization",t),{reauthorize:e=>Fe(r,o,i,a,e.provider)}}let Fe=async(e,t,r,o,i)=>{if(!e)throw o("linkAccount","onError",te.MUST_BE_AUTHENTICATED,{linkMethod:i}),new ee("User must be authenticated before linking an account.");if(!t?.linkedAccounts.some((e=>e.type.includes(i))))throw new ee(`OAuth account of type ${i} not linked to the account.`);await r(i)};const _e=e=>{let t=_();return n("customAuth",e),{status:t}};function Le({isAuthenticated:e,isLoading:t,...r}){let o=Y();X((()=>{t||o.current?.()}),[e,t]);let i=G((e=>(o.current=e,()=>{o.current=void 0})),[]);return j({...r,subscribe:i})}function De(){let{getFarcasterSignerPublicKey:t,signFarcasterMessage:r,requestFarcasterSignerFromWarpcast:o}=e();return{getFarcasterSignerPublicKey:t,signFarcasterMessage:r,requestFarcasterSignerFromWarpcast:o}}const He=()=>{let{revokeDelegatedWallets:e,delegateWallet:t}=Z();return{delegateWallet:async({address:e,chainType:r})=>await t({address:e,chainType:r,showDelegationUIs:!0}),revokeWallets:async()=>await e({showDelegationUIs:!0})}},xe=()=>{let{setUser:e,client:t}=$(re),{user:r}=$(m);return{user:r,refreshUser:G((async()=>{let r=await(t?.updateUserAndIdToken());return e(r??null),r}),[t,e])}},Ke=e=>{let t=s(),{initLoginWithTelegram:r,loginWithTelegram:o,telegramAuthState:i,setTelegramAuthState:n}=Z();return{login:G((async i=>{try{if(t.enabled&&"success"!==t.status)throw new h(t.error,null,te.CAPTCHA_FAILURE);await r(t.token,i?.disableSignup);let{user:n,isNewUser:a,loginAccount:s,wasAlreadyAuthenticated:c}=await o({intent:"login"});e?.onComplete?.({user:n,isNewUser:a,wasAlreadyAuthenticated:c,loginMethod:"telegram",loginAccount:s})}catch(i){throw n({status:"error",error:i}),e?.onError?.(i.privyErrorCode||te.UNKNOWN_AUTH_ERROR),i}}),[r,o,t]),state:i}},je=()=>{let{revokeDelegatedWallets:e,delegateWallet:t}=Z();return{delegateWallet:async({address:e,chainType:r})=>await t({address:e,chainType:r,showDelegationUIs:!1}),revokeWallets:async()=>await e({showDelegationUIs:!1})}};export{Te as useConnectCoinbaseSmartWallet,Ae as useConnectOrCreateWallet,Ee as useCrossAppAccounts,_e as useCustomAuth,He as useDelegatedActions,De as useFarcasterSigner,Pe as useGuestAccounts,je as useHeadlessDelegatedActions,fe as useLinkAccount,ge as useLinkWithPasskey,ke as useLinkWithSiwe,pe as useLoginWithEmail,he as useLoginWithFarcasterV2,de as useLoginWithOAuth,me as useLoginWithPasskey,ye as useLoginWithSms,Ke as useLoginWithTelegram,be as useModalStatus,Me as useOAuthTokens,ue as useRecoverEmbeddedWallet,We as useSendTransaction,Ue as useSetWalletPassword,Re as useSetWalletRecovery,Se as useSignAuthorization,ve as useSignMessage,Ce as useSignTransaction,Ne as useSignTypedData,we as useSignupWithPasskey,Le as useSubscribeToJwtAuthWithFlag,j as useSyncJwtBasedAuthState,Oe as useToken,Ie as useUpdateAccount,xe as useUser,R as useWallets};
|