@privy-io/react-auth 2.13.0 → 2.13.1-beta-20250505220758
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-DSzUwlM3.js +28 -0
- package/dist/cjs/{smart-wallets-DPzFARjT.js → smart-wallets-DFeVmNnD.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-BvJfkxie.js → useActiveWallet-6JLn_JTh.js} +1 -1
- package/dist/cjs/{useFundWallet-CiLG5ep0.js → useFundWallet-gRX-s_TG.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 +13 -6
- package/dist/dts/index.d.ts +13 -6
- 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-DN2c5-kP.d.mts → types-BTWpRwB-.d.mts} +15 -3
- package/dist/dts/{types-DN2c5-kP.d.ts → types-BTWpRwB-.d.ts} +15 -3
- package/dist/dts/ui.d.mts +1 -1
- package/dist/dts/ui.d.ts +1 -1
- package/dist/dts/{useSolanaWallets-BVh3xyXO.d.mts → useSolanaWallets-CggcfPGw.d.mts} +1 -1
- package/dist/dts/{useSolanaWallets-BVh3xyXO.d.ts → useSolanaWallets-CggcfPGw.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-ThLhF7PL.mjs +28 -0
- package/dist/esm/{smart-wallets-C8gN_Nj7.mjs → smart-wallets-BC6lSMiZ.mjs} +1 -1
- package/dist/esm/smart-wallets.mjs +1 -1
- package/dist/esm/solana.mjs +1 -1
- package/dist/esm/ui.mjs +1 -1
- package/dist/esm/{useActiveWallet-BKPcHlfH.mjs → useActiveWallet-BUpm9YGF.mjs} +1 -1
- package/dist/esm/{useFundWallet-YOssGx_G.mjs → useFundWallet-M0Ia2OyM.mjs} +1 -1
- package/package.json +4 -3
- package/dist/cjs/privy-provider-BZ16j6Os.js +0 -28
- package/dist/esm/privy-provider-IxOtd5-t.mjs +0 -28
package/dist/dts/index.d.mts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
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, w as RequestArguments, x as WalletTimeoutError, y as WalletConnector, B as BaseConnectedEthereumWallet, z as ConnectedWalletMetadata, A as ConnectorType, D as WalletListEntry, G as ExternalWalletsConfig,
|
|
4
|
-
export {
|
|
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 ExternalWalletsConfig, 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-BTWpRwB-.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-BTWpRwB-.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';
|
|
8
8
|
import { Store, EIP6963ProviderDetail } from 'mipd';
|
|
9
|
-
import { Chain, RpcConfig } from '@privy-io/js-sdk-core';
|
|
9
|
+
import Privy, { Chain, RpcConfig } from '@privy-io/js-sdk-core';
|
|
10
10
|
export { DEFAULT_SUPPORTED_CHAINS as SUPPORTED_CHAINS, addPrivyRpcToChain, addRpcUrlOverrideToChain } from '@privy-io/js-sdk-core';
|
|
11
11
|
import { PasskeyAuthenticateInputType, CustomMetadataType, SmartWalletType, PrivyCoinbaseOnRampInitInput, PrivyCoinbaseOnRampInitResponse, PrivyCoinbaseOnRampStatusResponse, PrivyTransactionScanningInputType, PrivyTransactionScanningResponseType } from '@privy-io/public-api';
|
|
12
12
|
import * as viem__types_actions_siwe_verifySiweMessage from 'viem/_types/actions/siwe/verifySiweMessage';
|
|
@@ -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-CggcfPGw.js';
|
|
20
|
+
export { C as CallbackError, U as UseSolanaWalletsInterface, u as useSolanaWallets } from './useSolanaWallets-CggcfPGw.js';
|
|
21
21
|
import '@solana/wallet-adapter-base';
|
|
22
22
|
import '@solana/wallet-standard-features';
|
|
23
23
|
import '@wallet-standard/base';
|
|
@@ -1291,7 +1291,11 @@ declare class Embedded1193Provider extends EventEmitter implements EIP1193Provid
|
|
|
1291
1291
|
* requests to the iframe. If this is an imported wallet, the `walletIndex` is defined as 0 (and is handled as such by the iframe).
|
|
1292
1292
|
*/
|
|
1293
1293
|
walletIndex: number;
|
|
1294
|
-
|
|
1294
|
+
/** The wallet account object for the wallet that this provider corresponds to. */
|
|
1295
|
+
walletAccount?: HDWalletWithMetadata;
|
|
1296
|
+
/** The Privy client instance from the core library. */
|
|
1297
|
+
privyClient?: Privy;
|
|
1298
|
+
constructor({ walletProxy, address, entropyId, entropyIdVerifier, rpcConfig, chains, appId, chainId, walletIndex, privyClient, walletAccount, }: {
|
|
1295
1299
|
walletProxy: EmbeddedWalletProxy;
|
|
1296
1300
|
address: string;
|
|
1297
1301
|
entropyId: string;
|
|
@@ -1301,6 +1305,8 @@ declare class Embedded1193Provider extends EventEmitter implements EIP1193Provid
|
|
|
1301
1305
|
appId: string;
|
|
1302
1306
|
chainId: number;
|
|
1303
1307
|
walletIndex: number;
|
|
1308
|
+
privyClient?: Privy;
|
|
1309
|
+
walletAccount?: HDWalletWithMetadata;
|
|
1304
1310
|
});
|
|
1305
1311
|
handleSendTransaction(args: RequestArguments): Promise<string>;
|
|
1306
1312
|
private handleSignTransaction;
|
|
@@ -1309,6 +1315,7 @@ declare class Embedded1193Provider extends EventEmitter implements EIP1193Provid
|
|
|
1309
1315
|
private handleSignedTypedData;
|
|
1310
1316
|
private handleEstimateGas;
|
|
1311
1317
|
request(args: RequestArguments): Promise<unknown>;
|
|
1318
|
+
private handleWalletApiRequest;
|
|
1312
1319
|
}
|
|
1313
1320
|
|
|
1314
1321
|
declare global {
|
package/dist/dts/index.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
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, w as RequestArguments, x as WalletTimeoutError, y as WalletConnector, B as BaseConnectedEthereumWallet, z as ConnectedWalletMetadata, A as ConnectorType, D as WalletListEntry, G as ExternalWalletsConfig,
|
|
4
|
-
export {
|
|
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 ExternalWalletsConfig, 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-BTWpRwB-.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-BTWpRwB-.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';
|
|
8
8
|
import { Store, EIP6963ProviderDetail } from 'mipd';
|
|
9
|
-
import { Chain, RpcConfig } from '@privy-io/js-sdk-core';
|
|
9
|
+
import Privy, { Chain, RpcConfig } from '@privy-io/js-sdk-core';
|
|
10
10
|
export { DEFAULT_SUPPORTED_CHAINS as SUPPORTED_CHAINS, addPrivyRpcToChain, addRpcUrlOverrideToChain } from '@privy-io/js-sdk-core';
|
|
11
11
|
import { PasskeyAuthenticateInputType, CustomMetadataType, SmartWalletType, PrivyCoinbaseOnRampInitInput, PrivyCoinbaseOnRampInitResponse, PrivyCoinbaseOnRampStatusResponse, PrivyTransactionScanningInputType, PrivyTransactionScanningResponseType } from '@privy-io/public-api';
|
|
12
12
|
import * as viem__types_actions_siwe_verifySiweMessage from 'viem/_types/actions/siwe/verifySiweMessage';
|
|
@@ -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-CggcfPGw.js';
|
|
20
|
+
export { C as CallbackError, U as UseSolanaWalletsInterface, u as useSolanaWallets } from './useSolanaWallets-CggcfPGw.js';
|
|
21
21
|
import '@solana/wallet-adapter-base';
|
|
22
22
|
import '@solana/wallet-standard-features';
|
|
23
23
|
import '@wallet-standard/base';
|
|
@@ -1291,7 +1291,11 @@ declare class Embedded1193Provider extends EventEmitter implements EIP1193Provid
|
|
|
1291
1291
|
* requests to the iframe. If this is an imported wallet, the `walletIndex` is defined as 0 (and is handled as such by the iframe).
|
|
1292
1292
|
*/
|
|
1293
1293
|
walletIndex: number;
|
|
1294
|
-
|
|
1294
|
+
/** The wallet account object for the wallet that this provider corresponds to. */
|
|
1295
|
+
walletAccount?: HDWalletWithMetadata;
|
|
1296
|
+
/** The Privy client instance from the core library. */
|
|
1297
|
+
privyClient?: Privy;
|
|
1298
|
+
constructor({ walletProxy, address, entropyId, entropyIdVerifier, rpcConfig, chains, appId, chainId, walletIndex, privyClient, walletAccount, }: {
|
|
1295
1299
|
walletProxy: EmbeddedWalletProxy;
|
|
1296
1300
|
address: string;
|
|
1297
1301
|
entropyId: string;
|
|
@@ -1301,6 +1305,8 @@ declare class Embedded1193Provider extends EventEmitter implements EIP1193Provid
|
|
|
1301
1305
|
appId: string;
|
|
1302
1306
|
chainId: number;
|
|
1303
1307
|
walletIndex: number;
|
|
1308
|
+
privyClient?: Privy;
|
|
1309
|
+
walletAccount?: HDWalletWithMetadata;
|
|
1304
1310
|
});
|
|
1305
1311
|
handleSendTransaction(args: RequestArguments): Promise<string>;
|
|
1306
1312
|
private handleSignTransaction;
|
|
@@ -1309,6 +1315,7 @@ declare class Embedded1193Provider extends EventEmitter implements EIP1193Provid
|
|
|
1309
1315
|
private handleSignedTypedData;
|
|
1310
1316
|
private handleEstimateGas;
|
|
1311
1317
|
request(args: RequestArguments): Promise<unknown>;
|
|
1318
|
+
private handleWalletApiRequest;
|
|
1312
1319
|
}
|
|
1313
1320
|
|
|
1314
1321
|
declare global {
|
|
@@ -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-BTWpRwB-.js';
|
|
11
11
|
import '@solana/wallet-adapter-base';
|
|
12
12
|
import '@privy-io/public-api';
|
|
13
13
|
import '@solana/wallet-standard-features';
|
|
@@ -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-BTWpRwB-.js';
|
|
11
11
|
import '@solana/wallet-adapter-base';
|
|
12
12
|
import '@privy-io/public-api';
|
|
13
13
|
import '@solana/wallet-standard-features';
|
package/dist/dts/solana.d.mts
CHANGED
|
@@ -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-
|
|
2
|
-
export { C as ConnectedSolanaWallet, l 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 SolanaStandardWallet, k as SolanaFundingConfig, e as SupportedSolanaTransaction, h as SendTransactionModalUIOptions, S as SolanaTransactionReceipt, i as SignMessageModalUIOptions } from './types-BTWpRwB-.js';
|
|
2
|
+
export { C as ConnectedSolanaWallet, l as SolanaAdapterConnector, t as toSolanaWalletConnectors } from './types-BTWpRwB-.js';
|
|
3
|
+
import { P as PrivyEvents } from './useSolanaWallets-CggcfPGw.js';
|
|
4
|
+
export { U as UseSolanaWalletsInterface, u as useSolanaWallets } from './useSolanaWallets-CggcfPGw.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';
|
package/dist/dts/solana.d.ts
CHANGED
|
@@ -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-
|
|
2
|
-
export { C as ConnectedSolanaWallet, l 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 SolanaStandardWallet, k as SolanaFundingConfig, e as SupportedSolanaTransaction, h as SendTransactionModalUIOptions, S as SolanaTransactionReceipt, i as SignMessageModalUIOptions } from './types-BTWpRwB-.js';
|
|
2
|
+
export { C as ConnectedSolanaWallet, l as SolanaAdapterConnector, t as toSolanaWalletConnectors } from './types-BTWpRwB-.js';
|
|
3
|
+
import { P as PrivyEvents } from './useSolanaWallets-CggcfPGw.js';
|
|
4
|
+
export { U as UseSolanaWalletsInterface, u as useSolanaWallets } from './useSolanaWallets-CggcfPGw.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';
|
|
@@ -913,6 +913,10 @@ interface SmartWalletWithMetadata extends LinkMetadata, SmartWallet {
|
|
|
913
913
|
/** Denotes that this is a smart wallet account. */
|
|
914
914
|
type: 'smart_wallet';
|
|
915
915
|
}
|
|
916
|
+
/** Object representation of an HD embedded wallet with a defined `walletIndex` */
|
|
917
|
+
type HDWalletWithMetadata = WalletWithMetadata & {
|
|
918
|
+
walletIndex: number;
|
|
919
|
+
};
|
|
916
920
|
/** Object representation of a user's Google Account, with additional metadata for advanced use cases. */
|
|
917
921
|
interface GoogleOAuthWithMetadata extends LinkMetadata, Google {
|
|
918
922
|
/** Denotes that this is a Google account. */
|
|
@@ -1992,6 +1996,14 @@ interface eth_signTypedData_v4Response {
|
|
|
1992
1996
|
method: 'eth_signTypedData_v4';
|
|
1993
1997
|
data: string;
|
|
1994
1998
|
}
|
|
1999
|
+
interface secp256k1_sign extends BaseEthereumRpcRequestType {
|
|
2000
|
+
method: 'secp256k1_sign';
|
|
2001
|
+
params: [`0x${string}`];
|
|
2002
|
+
}
|
|
2003
|
+
interface secp256k1_signResponse {
|
|
2004
|
+
method: 'secp256k1_sign';
|
|
2005
|
+
data: `0x${string}`;
|
|
2006
|
+
}
|
|
1995
2007
|
interface solana_signMessage extends BaseSolanaRpcRequestType {
|
|
1996
2008
|
method: 'signMessage';
|
|
1997
2009
|
params: {
|
|
@@ -2004,9 +2016,9 @@ interface solana_signMessageResponse {
|
|
|
2004
2016
|
signature: string;
|
|
2005
2017
|
};
|
|
2006
2018
|
}
|
|
2007
|
-
type EthereumRpcRequestType = eth_signTransaction | eth_populateTransactionRequest | eth_sign | personal_sign | eth_signTypedData_v4;
|
|
2008
|
-
type EthereumRpcResponseType = eth_signTransactionResponse | eth_populateTransactionRequestResponse | eth_signResponse | personal_signResponse | eth_signTypedData_v4Response;
|
|
2019
|
+
type EthereumRpcRequestType = eth_signTransaction | eth_populateTransactionRequest | eth_sign | personal_sign | eth_signTypedData_v4 | secp256k1_sign;
|
|
2020
|
+
type EthereumRpcResponseType = eth_signTransactionResponse | eth_populateTransactionRequestResponse | eth_signResponse | personal_signResponse | eth_signTypedData_v4Response | secp256k1_signResponse;
|
|
2009
2021
|
type SolanaRpcRequestType = solana_signMessage;
|
|
2010
2022
|
type SolanaRpcResponseType = solana_signMessageResponse;
|
|
2011
2023
|
|
|
2012
|
-
export { type
|
|
2024
|
+
export { type MoonpaySignResponse as $, type ConnectorType as A, type BaseConnectedEthereumWallet as B, type ConnectedSolanaWallet as C, type WalletListEntry as D, type EthereumRpcRequestType as E, type FundingMethod as F, type ExternalWalletsConfig as G, type HDWalletWithMetadata as H, type BaseConnectedWallet as I, type ConnectWalletModalOptions as J, type LoginModalOptions as K, type LoginToFrame as L, type MfaMethod as M, type SetWalletRecoveryOptions as N, type OAuthTokens as O, PrivyErrorCode as P, type SignTypedDataParams as Q, type RuntimeLoginOverridableOptions as R, type SolanaTransactionReceipt as S, type UnsignedTransactionRequest as T, type User as U, type FundWalletConfig as V, type Wallet as W, type ConnectedWallet as X, type CrossAppProviderDetails as Y, type OAuthProviderType as Z, type MoonpaySignRequest as _, type LoginMethod as a, type SmartWalletConfig as a0, type SiweWalletMetadata as a1, type TelegramAuthResult as a2, type TelegramWebAppData as a3, type OAuthUserInfo as a4, type SiwsMessageType as a5, type OAuthFlowState as a6, type LoginWithCode as a7, type OtpFlowState as a8, type PasskeyFlowState as a9, type CrossAppAccount as aA, type LinkedAccountType as aB, type GoogleOAuthWithMetadata as aC, type TwitterOAuthWithMetadata as aD, type DiscordOAuthWithMetadata as aE, type GithubOAuthWithMetadata as aF, type TiktokOAuthWithMetadata as aG, type LinkedInOAuthWithMetadata as aH, type AppleOAuthWithMetadata as aI, type FarcasterWithMetadata as aJ, type TelegramWithMetadata as aK, type CrossAppAccountWithMetadata as aL, type PasskeyWithMetadata as aM, type Email as aN, type Phone as aO, type TransactionUIOptions as aP, type ContractUIOptions as aQ, type NativeFundingConfig as aR, type MoonpayFundingConfig as aS, type PriceDisplayOptions as aT, type Farcaster as aU, type Passkey as aV, type LoginMethodOrderOption as aW, type SiweFlowState as aa, type UnsignedTransactionRequestWithChainId as ab, type BaseConnectedWalletType as ac, type SessionSignerInput as ad, type TelegramAuthFlowState as ae, type TypedMessage as af, type MessageTypes as ag, type SmartWallet as ah, type MoonpayConfig as ai, type MoonpayCurrencyCode as aj, type MoonpayPaymentMethod as ak, type Quantity as al, type TransactionLog as am, type TransactionReceipt as an, type NonEmptyArray as ao, type EmailWithMetadata as ap, type PhoneWithMetadata as aq, type WalletWithMetadata as ar, type Google as as, type Twitter as at, type Discord as au, type Github as av, type LinkedIn as aw, type Apple as ax, type Tiktok as ay, type Telegram as az, type LinkedAccountWithMetadata as b, type BaseConnectedSolanaWallet as c, type UserRecoveryMethod as d, type SupportedSolanaTransaction as e, type SolanaCluster as f, type CreateWalletOptions as g, type SendTransactionModalUIOptions as h, type SignMessageModalUIOptions as i, type SolanaStandardWallet as j, type SolanaFundingConfig as k, SolanaWalletConnector as l, type WalletClientType as m, type PrivyFarcasterSignerInitResponse as n, type MfaSubmitArgs as o, type SolanaRpcRequestType as p, type EthereumRpcResponseType as q, type SolanaRpcResponseType as r, type PrivyClientConfig as s, toSolanaWalletConnectors as t, type EIP1193Provider as u, type EntropyIdVerifier as v, type RequestArguments as w, WalletTimeoutError as x, WalletConnector as y, type ConnectedWalletMetadata as z };
|
|
@@ -913,6 +913,10 @@ interface SmartWalletWithMetadata extends LinkMetadata, SmartWallet {
|
|
|
913
913
|
/** Denotes that this is a smart wallet account. */
|
|
914
914
|
type: 'smart_wallet';
|
|
915
915
|
}
|
|
916
|
+
/** Object representation of an HD embedded wallet with a defined `walletIndex` */
|
|
917
|
+
type HDWalletWithMetadata = WalletWithMetadata & {
|
|
918
|
+
walletIndex: number;
|
|
919
|
+
};
|
|
916
920
|
/** Object representation of a user's Google Account, with additional metadata for advanced use cases. */
|
|
917
921
|
interface GoogleOAuthWithMetadata extends LinkMetadata, Google {
|
|
918
922
|
/** Denotes that this is a Google account. */
|
|
@@ -1992,6 +1996,14 @@ interface eth_signTypedData_v4Response {
|
|
|
1992
1996
|
method: 'eth_signTypedData_v4';
|
|
1993
1997
|
data: string;
|
|
1994
1998
|
}
|
|
1999
|
+
interface secp256k1_sign extends BaseEthereumRpcRequestType {
|
|
2000
|
+
method: 'secp256k1_sign';
|
|
2001
|
+
params: [`0x${string}`];
|
|
2002
|
+
}
|
|
2003
|
+
interface secp256k1_signResponse {
|
|
2004
|
+
method: 'secp256k1_sign';
|
|
2005
|
+
data: `0x${string}`;
|
|
2006
|
+
}
|
|
1995
2007
|
interface solana_signMessage extends BaseSolanaRpcRequestType {
|
|
1996
2008
|
method: 'signMessage';
|
|
1997
2009
|
params: {
|
|
@@ -2004,9 +2016,9 @@ interface solana_signMessageResponse {
|
|
|
2004
2016
|
signature: string;
|
|
2005
2017
|
};
|
|
2006
2018
|
}
|
|
2007
|
-
type EthereumRpcRequestType = eth_signTransaction | eth_populateTransactionRequest | eth_sign | personal_sign | eth_signTypedData_v4;
|
|
2008
|
-
type EthereumRpcResponseType = eth_signTransactionResponse | eth_populateTransactionRequestResponse | eth_signResponse | personal_signResponse | eth_signTypedData_v4Response;
|
|
2019
|
+
type EthereumRpcRequestType = eth_signTransaction | eth_populateTransactionRequest | eth_sign | personal_sign | eth_signTypedData_v4 | secp256k1_sign;
|
|
2020
|
+
type EthereumRpcResponseType = eth_signTransactionResponse | eth_populateTransactionRequestResponse | eth_signResponse | personal_signResponse | eth_signTypedData_v4Response | secp256k1_signResponse;
|
|
2009
2021
|
type SolanaRpcRequestType = solana_signMessage;
|
|
2010
2022
|
type SolanaRpcResponseType = solana_signMessageResponse;
|
|
2011
2023
|
|
|
2012
|
-
export { type
|
|
2024
|
+
export { type MoonpaySignResponse as $, type ConnectorType as A, type BaseConnectedEthereumWallet as B, type ConnectedSolanaWallet as C, type WalletListEntry as D, type EthereumRpcRequestType as E, type FundingMethod as F, type ExternalWalletsConfig as G, type HDWalletWithMetadata as H, type BaseConnectedWallet as I, type ConnectWalletModalOptions as J, type LoginModalOptions as K, type LoginToFrame as L, type MfaMethod as M, type SetWalletRecoveryOptions as N, type OAuthTokens as O, PrivyErrorCode as P, type SignTypedDataParams as Q, type RuntimeLoginOverridableOptions as R, type SolanaTransactionReceipt as S, type UnsignedTransactionRequest as T, type User as U, type FundWalletConfig as V, type Wallet as W, type ConnectedWallet as X, type CrossAppProviderDetails as Y, type OAuthProviderType as Z, type MoonpaySignRequest as _, type LoginMethod as a, type SmartWalletConfig as a0, type SiweWalletMetadata as a1, type TelegramAuthResult as a2, type TelegramWebAppData as a3, type OAuthUserInfo as a4, type SiwsMessageType as a5, type OAuthFlowState as a6, type LoginWithCode as a7, type OtpFlowState as a8, type PasskeyFlowState as a9, type CrossAppAccount as aA, type LinkedAccountType as aB, type GoogleOAuthWithMetadata as aC, type TwitterOAuthWithMetadata as aD, type DiscordOAuthWithMetadata as aE, type GithubOAuthWithMetadata as aF, type TiktokOAuthWithMetadata as aG, type LinkedInOAuthWithMetadata as aH, type AppleOAuthWithMetadata as aI, type FarcasterWithMetadata as aJ, type TelegramWithMetadata as aK, type CrossAppAccountWithMetadata as aL, type PasskeyWithMetadata as aM, type Email as aN, type Phone as aO, type TransactionUIOptions as aP, type ContractUIOptions as aQ, type NativeFundingConfig as aR, type MoonpayFundingConfig as aS, type PriceDisplayOptions as aT, type Farcaster as aU, type Passkey as aV, type LoginMethodOrderOption as aW, type SiweFlowState as aa, type UnsignedTransactionRequestWithChainId as ab, type BaseConnectedWalletType as ac, type SessionSignerInput as ad, type TelegramAuthFlowState as ae, type TypedMessage as af, type MessageTypes as ag, type SmartWallet as ah, type MoonpayConfig as ai, type MoonpayCurrencyCode as aj, type MoonpayPaymentMethod as ak, type Quantity as al, type TransactionLog as am, type TransactionReceipt as an, type NonEmptyArray as ao, type EmailWithMetadata as ap, type PhoneWithMetadata as aq, type WalletWithMetadata as ar, type Google as as, type Twitter as at, type Discord as au, type Github as av, type LinkedIn as aw, type Apple as ax, type Tiktok as ay, type Telegram as az, type LinkedAccountWithMetadata as b, type BaseConnectedSolanaWallet as c, type UserRecoveryMethod as d, type SupportedSolanaTransaction as e, type SolanaCluster as f, type CreateWalletOptions as g, type SendTransactionModalUIOptions as h, type SignMessageModalUIOptions as i, type SolanaStandardWallet as j, type SolanaFundingConfig as k, SolanaWalletConnector as l, type WalletClientType as m, type PrivyFarcasterSignerInitResponse as n, type MfaSubmitArgs as o, type SolanaRpcRequestType as p, type EthereumRpcResponseType as q, type SolanaRpcResponseType as r, type PrivyClientConfig as s, toSolanaWalletConnectors as t, type EIP1193Provider as u, type EntropyIdVerifier as v, type RequestArguments as w, WalletTimeoutError as x, WalletConnector as y, type ConnectedWalletMetadata as z };
|
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-BTWpRwB-.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-BTWpRwB-.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-BTWpRwB-.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-BTWpRwB-.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,at as m,m as p,t as u,a as h,aG as I,aH as g,aI as y,n as f}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,at as m,m as p,t as u,a as h,aG as I,aH as g,aI as y,n as f}from"./privy-provider-ThLhF7PL.mjs";import{u as v}from"./internal-context-lAHxpYRu.mjs";import{g as w}from"./getEmbeddedConnectedWallet-CSSBWE2p.mjs";import{c as C}from"./smart-wallets-BC6lSMiZ.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}=s(),{hideWalletUIs:P,openPrivyModal:S,chains:W,appId:b,rpcConfig:A,client:M}=v(),k=l(),{wallets:F}=d(),{setModalData:x}=m(),E=p(T),D=!!E&&u(E),_=async(o=c.id)=>{let s=w(F);if(!s)throw Error("No connected wallet found");let l="string"==typeof o?r(o):o;if(![c.id,2741].includes(l))throw Error("Error, only Abstract chains are supported");let d=W.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(f(d,A,b)),publicTransport:i(f(d,A,b)),signer:u})};return{signMessage:async({message:e},o)=>{let r=await _(o);return new Promise((async(o,t)=>{let{entropyId:n,entropyIdVerifier:i}=h(T);P.current=!0,x({connectWallet:{recoveryMethod:E.recoveryMethod,connectingWalletAddress:E.address,isUnifiedWallet:D,entropyId:n,entropyIdVerifier:i,onCompleteNavigateTo:I,onFailure:()=>{}},signMessage:{method:"personal_sign",data:e,confirmAndSign:()=>r.signMessage({message:e}),onSuccess:e=>o(e),onFailure:t,uiOptions:{isCancellable:!0}}}),S(g)})).finally((()=>{P.current=!1}))},signTypedData:async(e,o)=>{let r=await _(o);return new Promise((async(o,t)=>{P.current=!0;let{entropyId:n,entropyIdVerifier:i}=h(T);x({connectWallet:{recoveryMethod:E.recoveryMethod,connectingWalletAddress:E.address,isUnifiedWallet:D,entropyId:n,entropyIdVerifier:i,onCompleteNavigateTo:I,onFailure:()=>{}},signMessage:{method:"eth_signTypedData_v4",data:e,confirmAndSign:()=>r.signTypedData(e),onSuccess:e=>o(e),onFailure:t,uiOptions:{isCancellable:!0}}}),S(g)})).finally((()=>{P.current=!1}))},sendTransaction:async e=>{let r=await _(e.chainId),t=[],n="calls"in e&&void 0!==e.calls;return t=n?[...e.calls]:[e],new Promise((async(i,a)=>{P.current=!0;let{entropyId:c,entropyIdVerifier:s}=h(T);x({connectWallet:{recoveryMethod:E.recoveryMethod,connectingWalletAddress:E.address,isUnifiedWallet:D,entropyId:c,entropyIdVerifier:s,onCompleteNavigateTo:y,onFailure:()=>{}},sendTransaction:{transactionRequests:C({calls:t,chain:r.chain,maxPriorityFeePerGas:e.maxPriorityFeePerGas,maxFeePerGas:e.maxFeePerGas,nonce:e.nonce?BigInt(e.nonce):void 0}),entropyId:c,entropyIdVerifier:s,transactingWalletAddress:r.account.address,transactingWalletIndex:void 0,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}}}),S(g)})).finally((()=>{P.current=!1}))},signTransaction:async e=>{let r=await _(e.chainId),t=[],n="calls"in e&&void 0!==e.calls;return t=n?[...e.calls]:[e],new Promise((async(i,a)=>{P.current=!0;let{entropyId:c,entropyIdVerifier:s}=h(T);x({connectWallet:{recoveryMethod:E.recoveryMethod,connectingWalletAddress:E.address,isUnifiedWallet:D,entropyId:c,entropyIdVerifier:s,onCompleteNavigateTo:y,onFailure:()=>{}},sendTransaction:{transactionRequests:C({calls:t,chain:r.chain,maxPriorityFeePerGas:e.maxPriorityFeePerGas,maxFeePerGas:e.maxFeePerGas,nonce:e.nonce?BigInt(e.nonce):void 0}),entropyId:c,entropyIdVerifier:s,transactingWalletAddress:r.account.address,transactingWalletIndex:void 0,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}}}),S(g)})).finally((()=>{P.current=!1}))}}}export{T as useAbstractSmartWallets};
|
package/dist/esm/index.mjs
CHANGED
|
@@ -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 f,W as k,j as C,k as W,l as v,m as P,n as _,o as x,p as j,q,r as G,t as X,v as $,w as Y,x as Z}from"./privy-provider-IxOtd5-t.mjs";export{A as Captcha,B as ConnectorManager,E as EthereumWalletConnector,U as LoginModal,M as PrivyClient,y as PrivyProvider,V as VERSION,D as WalletConnector,K as errorIndicatesMaxMfaRetries,L as errorIndicatesMfaTimeout,J as errorIndicatesMfaVerificationFailed,z as getAccessToken,R as useCreateWallet,N as useIdentityToken,T as useImportWallet,O as useLogout,H as useMfa,I as useMfaEnrollment,F as usePrivy,Q as useRegisterMfaListener,S as useSolanaWallets}from"./privy-provider-IxOtd5-t.mjs";import{useCallback as ee,useMemo as te,useEffect as re,useContext as oe,useRef as ie}from"react";import{u as ae,P as ne,a as se,I as le}from"./internal-context-lAHxpYRu.mjs";export{c as useActiveWallet,a as useConnectWallet,b as useFundWallet,u as useLogin}from"./useActiveWallet-BKPcHlfH.mjs";import{F as ce}from"./frame-B1kjU0LI.mjs";import{zeroAddress as ue,getAddress as de,createWalletClient as he,http as we,parseSignature as pe}from"viem";import{hashAuthorization as ge}from"viem/utils";import{getWallet as me,updateWallet as ye}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"@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 Ae=()=>{let{user:o}=e(),{walletProxy:i}=ae();return{recover:ee((async e=>{if(!i)throw Error("Wallet proxy is not ready");let a=await t();if(!o||!a)throw new ne("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 ne("Unable to recover wallets")}}),[i,o])}},fe=()=>{let{client:e,setAuthenticated:t,setUser:r}=ae();return te((()=>({init:async()=>{if(!e)throw new ne("Must initialize Privy client first.");let t=new ce;return e.startAuthFlow(t),await t.init()},login:async({fid:o,message:i,signature:a})=>{if(!e)throw new ne("Must initialize Privy client first.");if(!(e.authFlow instanceof ce))throw new ne("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 ne("Failed to login with Farcaster V2");return r(n),t(!0),{user:n}}})),[e,r,t])},ke=t=>{o("login",t);let r=i(),a=n(),{ready:c,user:u}=e(),{initLoginWithHeadlessOAuth:h,loginWithHeadlessOAuth:w,oAuthState:p,setOAuthState:g,isHeadlessOAuthLoading:m}=ae(),y=ee((async e=>{try{if(r.enabled&&"success"!==r.status)throw new s(r.error,null,se.CAPTCHA_FAILURE);return await h(e.provider,r.token,e.disableSignup)}catch(e){throw g({status:"error",error:e}),e}}),[h,r]),A=ee((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 re((()=>{let e=l();c&&a&&e.inProgress&&!e.withPrivyUi&&!e.popupFlow&&A().catch((()=>{}))}),[c,a]),{initOAuth:y,loading:m,state:p}},Ce=e=>{let t=i(),{emailOtpState:r,setEmailOtpState:o,initLoginWithEmail:a,loginWithCode:n}=ae();return{sendCode:ee((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,se.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||se.UNKNOWN_AUTH_ERROR),r}}),[a]),loginWithCode:ee((async({code:r})=>{try{if(t.enabled&&"error"===t.status)throw new s(t.error,null,se.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||se.UNKNOWN_AUTH_ERROR),r}}),[n,t.status]),state:r}},Ie=e=>{let t=i(),{initSignupWithPasskey:r,signupWithPasskey:o,passkeyAuthState:a,setPasskeyAuthState:n}=ae();return{signupWithPasskey:ee((async()=>{try{let i;if(t.enabled&&"error"===t.status)throw new s(t.error,null,se.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||se.UNKNOWN_AUTH_ERROR),t}}),[o,t.status]),state:a}},We=e=>{let t=i(),{initLoginWithPasskey:r,loginWithPasskey:o,passkeyAuthState:a,setPasskeyAuthState:n}=ae();return{loginWithPasskey:ee((async i=>{try{let a;if(t.enabled&&"error"===t.status)throw new s(t.error,null,se.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||se.UNKNOWN_AUTH_ERROR),i}}),[o,t.status]),state:a}},Ee=e=>{let{initLinkWithPasskey:t,linkWithPasskey:r,passkeyAuthState:o,setPasskeyAuthState:i}=ae();return{linkWithPasskey:ee((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||se.UNKNOWN_AUTH_ERROR,{linkMethod:"passkey"}),t}}),[r]),state:o}},Te=e=>{let t=i(),{smsOtpState:r,setSmsOtpState:o,initLoginWithSms:a,loginWithCode:n}=ae();return{sendCode:ee((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,se.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||se.UNKNOWN_AUTH_ERROR),r}}),[a]),loginWithCode:ee((async({code:r})=>{try{if(t.enabled&&"success"!==t.status)throw new s(t.error,null,se.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||se.UNKNOWN_AUTH_ERROR),r}}),[n,t.status]),state:r}},Ue=t=>{let{connectOrCreateWallet:r}=e();return o("connectOrCreateWallet",t),{connectOrCreateWallet:r}},Se=e=>{let t=i(),{siweState:r,setSiweState:o,linkWithSiwe:a,generateSiweMessage:n}=ae();return{generateSiweMessage:ee((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||se.UNKNOWN_AUTH_ERROR,{linkMethod:"siwe"}),t}}),[n]),linkWithSiwe:ee((async({signature:r,message:i,chainId:n,walletClientType:l,connectorType:c})=>{try{if(t.enabled&&"success"!==t.status)throw new s(t.error,null,se.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||se.UNKNOWN_AUTH_ERROR,{linkMethod:"siwe"}),r}}),[a,t.status]),state:r}},ve=e=>{let t=i(),{siweState:r,setSiweState:o,client:a,generateSiweMessage:n,loginWithSiwe:l}=ae();return{generateSiweNonce:ee((async({address:r})=>{try{let e;if(t.enabled&&"error"===t.status)throw new s(t.error,null,se.CAPTCHA_FAILURE);t.enabled&&"success"!==t.status&&(t.execute(),e=await t.waitForResult()),o({status:"generating-message"});let i=await a.generateSiweNonce({address:r,captchaToken:e});return o({status:"awaiting-signature"}),i}catch(r){throw o({status:"error",error:r}),e?.onError?.(r.privyErrorCode||se.UNKNOWN_AUTH_ERROR),r}}),[a,t]),generateSiweMessage:ee((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||se.UNKNOWN_AUTH_ERROR),t}}),[n]),loginWithSiwe:ee((async({message:r,signature:i,disableSignup:a})=>{try{let o;if(t.enabled&&"error"===t.status)throw new s(t.error,null,se.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||se.UNKNOWN_AUTH_ERROR),r}}),[l,t.status]),state:r}};function Re(){let{signTransaction:e}=oe(h);return{signTransaction:e}}function Pe(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}=oe(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}}function be(e){let{updateEmail:t,updatePhone:r}=oe(h);return o("update",e),{updateEmail:t,updatePhone:r}}const Ne=()=>{let{connectCoinbaseSmartWallet:e}=ae();return{connectCoinbaseSmartWallet:e}},Oe=()=>{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 _e(e){let{sendTransaction:t}=oe(h);return o("sendTransaction",e),{sendTransaction:t}}function Me(e){let{setWalletPassword:t}=oe(h);return o("setWalletPassword",e),{setWalletPassword:t}}function Fe(){let t=w(),{getAccessToken:r}=e(),o=p(),{client:i,setUser:a,setAuthenticated:n,setIsNewUser:s,initializeWalletProxy:l}=ae(),{create:c}=m();return{createGuestAccount:async()=>{if(!t.id||!i)throw Error("SDK not yet ready");i.startAuthFlow(new f(t.id));try{let e=await i.authenticate(),u=e.user,d=e.isNewUser??!1;if(!u)throw new ne("Unable to authenticate guest account");let h=await r(),w=await l(k);if(h&&w)try{let e=C(u,t.embeddedWallets.ethereum.createOnLogin),r=W(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||se.UNKNOWN_AUTH_ERROR),e}}}}function Le(e){let{setWalletRecovery:t}=oe(h);return o("setWalletRecovery",e),{setWalletRecovery:t}}function He(e){let{signMessage:t}=oe(h);return o("signMessage",e),{signMessage:t}}const De=()=>{let{ready:t,wallets:r}=v(),{user:o}=e(),{rpcConfig:i,chains:a,appId:n}=ae();return{signAuthorization:ee((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 l=s?.address??P(o)?.address??ue,c=r.find((e=>de(e.address)===de(l)));if(!c)throw Error("Signing wallet not found.");let u=e.chainId??Number(c.chainId.split(":")[1]),d=a.find((e=>e.id===u));if(!d)throw Error("Error, chain not configured in PrivyProvider config");let h=he({account:l,chain:d,transport:we(_(d,i,n))}),w=await h.prepareAuthorization({...e}),p=await c.getEthereumProvider(),g=await p.request({method:"secp256k1_sign",params:[ge(w)]});return{...w,...pe(g)}}),[t,r,o,a])}};function xe(e){let{signTypedData:t}=oe(h);return o("signTypedData",e),{signTypedData:t}}const Ke=()=>{let{isModalOpen:e}=oe(h);return{isOpen:e}};function ze(e){let{getAccessToken:t}=oe(h);return o("accessToken",e),{getAccessToken:t}}function je(t){let{authenticated:r,user:i}=e(),{initLoginWithOAuth:a}=ae(),n=p();return o("oAuthAuthorization",t),{reauthorize:e=>qe(r,i,a,n,e.provider)}}let qe=async(e,t,r,o,i)=>{if(!e)throw o("linkAccount","onError",se.MUST_BE_AUTHENTICATED,{linkMethod:i}),new ne("User must be authenticated before linking an account.");if(!t?.linkedAccounts.some((e=>e.type.includes(i))))throw new ne(`OAuth account of type ${i} not linked to the account.`);await r(i)};const Ve=e=>{let t=x();return o("customAuth",e),{status:t}};function Ge({isAuthenticated:e,isLoading:t,...r}){let o=ie();re((()=>{t||o.current?.()}),[e,t]);let i=ee((e=>(o.current=e,()=>{o.current=void 0})),[]);return j({...r,subscribe:i})}function Be(){let{getFarcasterSignerPublicKey:t,signFarcasterMessage:r,requestFarcasterSignerFromWarpcast:o}=e();return{getFarcasterSignerPublicKey:t,signFarcasterMessage:r,requestFarcasterSignerFromWarpcast:o}}const Qe=()=>{let{revokeDelegatedWallets:e,delegateWallet:t}=ae();return{delegateWallet:async({address:e,chainType:r})=>await t({address:e,chainType:r,showDelegationUIs:!0}),revokeWallets:async()=>await e({showDelegationUIs:!0})}},Xe=()=>{let{addSessionSignersInternal:t,removeSessionSignersInternal:r}=(()=>{let{getAccessToken:t,user:r}=e(),o=ae(),{signWithUserSigner:i}=q(),a=async({wallet:e,additional_signers:a})=>{let n=await t();if(!r||!n)throw new ne("User must be authenticated and have an embedded wallet to delegate actions.");if(!e.id)throw new ne("Wallet to add signers to must have ID on server");if(!o.walletProxy)throw new ne("Wallet proxy not initialized.");await ye(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 ne("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 ne("Wallet proxy not initialized.");let l=G(r,e);if(!l)throw new ne("Address to add signers too is not associated with current user.");if(X(l)){if(0===i.length)throw new ne("Must specify at least one signer to add.");let e=[...(await me(o.privy,{wallet_id:l.id})).additional_signers,...$(i)];await a({wallet:l,additional_signers:e})}else{if(l.delegated)return{user:r};if(i.length>0)throw new ne("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=Y({address:e,user:r}),a=Z({address:e,user:r});await o.recoverPrimaryWallet(),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 ne("User must be authenticated and have an embedded wallet to delegate actions.");if(!(o.walletProxy??await o.initializeWalletProxy(15e3)))throw new ne("Wallet proxy not initialized.");let n=G(r,e);if(!n)throw new ne("Address to remove signers from is not associated with current user.");X(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})}},Je=()=>{let{setUser:e,client:t}=oe(le),{user:r}=oe(h);return{user:r,refreshUser:ee((async()=>{let r=await(t?.updateUserAndIdToken());return e(r??null),r}),[t,e])}},$e=e=>{let t=i(),{initLoginWithTelegram:r,loginWithTelegram:o,telegramAuthState:a,setTelegramAuthState:n}=ae();return{login:ee((async i=>{try{if(t.enabled&&"success"!==t.status)throw new s(t.error,null,se.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||se.UNKNOWN_AUTH_ERROR),i}}),[r,o,t]),state:a}},Ye=()=>{let{revokeDelegatedWallets:e,delegateWallet:t}=ae();return{delegateWallet:async({address:e,chainType:r})=>await t({address:e,chainType:r,showDelegationUIs:!1}),revokeWallets:async()=>await e({showDelegationUIs:!1})}};export{Ne as useConnectCoinbaseSmartWallet,Ue as useConnectOrCreateWallet,Oe as useCrossAppAccounts,Ve as useCustomAuth,Qe as useDelegatedActions,Be as useFarcasterSigner,Fe as useGuestAccounts,Ye as useHeadlessDelegatedActions,Pe as useLinkAccount,Ee as useLinkWithPasskey,Se as useLinkWithSiwe,Ce as useLoginWithEmail,fe as useLoginWithFarcasterV2,ke as useLoginWithOAuth,We as useLoginWithPasskey,ve as useLoginWithSiwe,Te as useLoginWithSms,$e as useLoginWithTelegram,Ke as useModalStatus,je as useOAuthTokens,Ae as useRecoverEmbeddedWallet,_e as useSendTransaction,Xe as useSessionSigners,Me as useSetWalletPassword,Le as useSetWalletRecovery,De as useSignAuthorization,He as useSignMessage,Re as useSignTransaction,xe as useSignTypedData,Ie as useSignupWithPasskey,Ge as useSubscribeToJwtAuthWithFlag,j as useSyncJwtBasedAuthState,ze as useToken,be as useUpdateAccount,Je as useUser,v 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 f,W as k,j as C,k as W,l as v,m as P,n as _,o as x,p as j,q,r as G,t as X,v as $,w as Y,x as Z}from"./privy-provider-ThLhF7PL.mjs";export{A as Captcha,B as ConnectorManager,E as EthereumWalletConnector,U as LoginModal,M as PrivyClient,y as PrivyProvider,V as VERSION,D as WalletConnector,K as errorIndicatesMaxMfaRetries,L as errorIndicatesMfaTimeout,J as errorIndicatesMfaVerificationFailed,z as getAccessToken,R as useCreateWallet,N as useIdentityToken,T as useImportWallet,O as useLogout,H as useMfa,I as useMfaEnrollment,F as usePrivy,Q as useRegisterMfaListener,S as useSolanaWallets}from"./privy-provider-ThLhF7PL.mjs";import{useCallback as ee,useMemo as te,useEffect as re,useContext as oe,useRef as ie}from"react";import{u as ae,P as ne,a as se,I as le}from"./internal-context-lAHxpYRu.mjs";export{c as useActiveWallet,a as useConnectWallet,b as useFundWallet,u as useLogin}from"./useActiveWallet-BUpm9YGF.mjs";import{F as ce}from"./frame-B1kjU0LI.mjs";import{zeroAddress as ue,getAddress as de,createWalletClient as he,http as we,parseSignature as pe}from"viem";import{hashAuthorization as ge}from"viem/utils";import{getWallet as me,updateWallet as ye}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 Ae=()=>{let{user:o}=e(),{walletProxy:i}=ae();return{recover:ee((async e=>{if(!i)throw Error("Wallet proxy is not ready");let a=await t();if(!o||!a)throw new ne("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 ne("Unable to recover wallets")}}),[i,o])}},fe=()=>{let{client:e,setAuthenticated:t,setUser:r}=ae();return te((()=>({init:async()=>{if(!e)throw new ne("Must initialize Privy client first.");let t=new ce;return e.startAuthFlow(t),await t.init()},login:async({fid:o,message:i,signature:a})=>{if(!e)throw new ne("Must initialize Privy client first.");if(!(e.authFlow instanceof ce))throw new ne("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 ne("Failed to login with Farcaster V2");return r(n),t(!0),{user:n}}})),[e,r,t])},ke=t=>{o("login",t);let r=i(),a=n(),{ready:c,user:u}=e(),{initLoginWithHeadlessOAuth:h,loginWithHeadlessOAuth:w,oAuthState:p,setOAuthState:g,isHeadlessOAuthLoading:m}=ae(),y=ee((async e=>{try{if(r.enabled&&"success"!==r.status)throw new s(r.error,null,se.CAPTCHA_FAILURE);return await h(e.provider,r.token,e.disableSignup)}catch(e){throw g({status:"error",error:e}),e}}),[h,r]),A=ee((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 re((()=>{let e=l();c&&a&&e.inProgress&&!e.withPrivyUi&&!e.popupFlow&&A().catch((()=>{}))}),[c,a]),{initOAuth:y,loading:m,state:p}},Ce=e=>{let t=i(),{emailOtpState:r,setEmailOtpState:o,initLoginWithEmail:a,loginWithCode:n}=ae();return{sendCode:ee((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,se.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||se.UNKNOWN_AUTH_ERROR),r}}),[a]),loginWithCode:ee((async({code:r})=>{try{if(t.enabled&&"error"===t.status)throw new s(t.error,null,se.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||se.UNKNOWN_AUTH_ERROR),r}}),[n,t.status]),state:r}},Ie=e=>{let t=i(),{initSignupWithPasskey:r,signupWithPasskey:o,passkeyAuthState:a,setPasskeyAuthState:n}=ae();return{signupWithPasskey:ee((async()=>{try{let i;if(t.enabled&&"error"===t.status)throw new s(t.error,null,se.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||se.UNKNOWN_AUTH_ERROR),t}}),[o,t.status]),state:a}},We=e=>{let t=i(),{initLoginWithPasskey:r,loginWithPasskey:o,passkeyAuthState:a,setPasskeyAuthState:n}=ae();return{loginWithPasskey:ee((async i=>{try{let a;if(t.enabled&&"error"===t.status)throw new s(t.error,null,se.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||se.UNKNOWN_AUTH_ERROR),i}}),[o,t.status]),state:a}},Ee=e=>{let{initLinkWithPasskey:t,linkWithPasskey:r,passkeyAuthState:o,setPasskeyAuthState:i}=ae();return{linkWithPasskey:ee((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||se.UNKNOWN_AUTH_ERROR,{linkMethod:"passkey"}),t}}),[r]),state:o}},Te=e=>{let t=i(),{smsOtpState:r,setSmsOtpState:o,initLoginWithSms:a,loginWithCode:n}=ae();return{sendCode:ee((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,se.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||se.UNKNOWN_AUTH_ERROR),r}}),[a]),loginWithCode:ee((async({code:r})=>{try{if(t.enabled&&"success"!==t.status)throw new s(t.error,null,se.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||se.UNKNOWN_AUTH_ERROR),r}}),[n,t.status]),state:r}},Ue=t=>{let{connectOrCreateWallet:r}=e();return o("connectOrCreateWallet",t),{connectOrCreateWallet:r}},Se=e=>{let t=i(),{siweState:r,setSiweState:o,linkWithSiwe:a,generateSiweMessage:n}=ae();return{generateSiweMessage:ee((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||se.UNKNOWN_AUTH_ERROR,{linkMethod:"siwe"}),t}}),[n]),linkWithSiwe:ee((async({signature:r,message:i,chainId:n,walletClientType:l,connectorType:c})=>{try{if(t.enabled&&"success"!==t.status)throw new s(t.error,null,se.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||se.UNKNOWN_AUTH_ERROR,{linkMethod:"siwe"}),r}}),[a,t.status]),state:r}},ve=e=>{let t=i(),{siweState:r,setSiweState:o,client:a,generateSiweMessage:n,loginWithSiwe:l}=ae();return{generateSiweNonce:ee((async({address:r})=>{try{let e;if(t.enabled&&"error"===t.status)throw new s(t.error,null,se.CAPTCHA_FAILURE);t.enabled&&"success"!==t.status&&(t.execute(),e=await t.waitForResult()),o({status:"generating-message"});let i=await a.generateSiweNonce({address:r,captchaToken:e});return o({status:"awaiting-signature"}),i}catch(r){throw o({status:"error",error:r}),e?.onError?.(r.privyErrorCode||se.UNKNOWN_AUTH_ERROR),r}}),[a,t]),generateSiweMessage:ee((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||se.UNKNOWN_AUTH_ERROR),t}}),[n]),loginWithSiwe:ee((async({message:r,signature:i,disableSignup:a})=>{try{let o;if(t.enabled&&"error"===t.status)throw new s(t.error,null,se.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||se.UNKNOWN_AUTH_ERROR),r}}),[l,t.status]),state:r}};function Re(){let{signTransaction:e}=oe(h);return{signTransaction:e}}function Pe(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}=oe(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}}function be(e){let{updateEmail:t,updatePhone:r}=oe(h);return o("update",e),{updateEmail:t,updatePhone:r}}const Ne=()=>{let{connectCoinbaseSmartWallet:e}=ae();return{connectCoinbaseSmartWallet:e}},Oe=()=>{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 _e(e){let{sendTransaction:t}=oe(h);return o("sendTransaction",e),{sendTransaction:t}}function Me(e){let{setWalletPassword:t}=oe(h);return o("setWalletPassword",e),{setWalletPassword:t}}function Fe(){let t=w(),{getAccessToken:r}=e(),o=p(),{client:i,setUser:a,setAuthenticated:n,setIsNewUser:s,initializeWalletProxy:l}=ae(),{create:c}=m();return{createGuestAccount:async()=>{if(!t.id||!i)throw Error("SDK not yet ready");i.startAuthFlow(new f(t.id));try{let e=await i.authenticate(),u=e.user,d=e.isNewUser??!1;if(!u)throw new ne("Unable to authenticate guest account");let h=await r(),w=await l(k);if(h&&w)try{let e=C(u,t.embeddedWallets.ethereum.createOnLogin),r=W(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||se.UNKNOWN_AUTH_ERROR),e}}}}function Le(e){let{setWalletRecovery:t}=oe(h);return o("setWalletRecovery",e),{setWalletRecovery:t}}function He(e){let{signMessage:t}=oe(h);return o("signMessage",e),{signMessage:t}}const De=()=>{let{ready:t,wallets:r}=v(),{user:o}=e(),{rpcConfig:i,chains:a,appId:n}=ae();return{signAuthorization:ee((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 l=s?.address??P(o)?.address??ue,c=r.find((e=>de(e.address)===de(l)));if(!c)throw Error("Signing wallet not found.");let u=e.chainId??Number(c.chainId.split(":")[1]),d=a.find((e=>e.id===u));if(!d)throw Error("Error, chain not configured in PrivyProvider config");let h=he({account:l,chain:d,transport:we(_(d,i,n))}),w=await h.prepareAuthorization({...e}),p=await c.getEthereumProvider(),g=await p.request({method:"secp256k1_sign",params:[ge(w)]});return{...w,...pe(g)}}),[t,r,o,a])}};function xe(e){let{signTypedData:t}=oe(h);return o("signTypedData",e),{signTypedData:t}}const Ke=()=>{let{isModalOpen:e}=oe(h);return{isOpen:e}};function ze(e){let{getAccessToken:t}=oe(h);return o("accessToken",e),{getAccessToken:t}}function je(t){let{authenticated:r,user:i}=e(),{initLoginWithOAuth:a}=ae(),n=p();return o("oAuthAuthorization",t),{reauthorize:e=>qe(r,i,a,n,e.provider)}}let qe=async(e,t,r,o,i)=>{if(!e)throw o("linkAccount","onError",se.MUST_BE_AUTHENTICATED,{linkMethod:i}),new ne("User must be authenticated before linking an account.");if(!t?.linkedAccounts.some((e=>e.type.includes(i))))throw new ne(`OAuth account of type ${i} not linked to the account.`);await r(i)};const Ve=e=>{let t=x();return o("customAuth",e),{status:t}};function Ge({isAuthenticated:e,isLoading:t,...r}){let o=ie();re((()=>{t||o.current?.()}),[e,t]);let i=ee((e=>(o.current=e,()=>{o.current=void 0})),[]);return j({...r,subscribe:i})}function Be(){let{getFarcasterSignerPublicKey:t,signFarcasterMessage:r,requestFarcasterSignerFromWarpcast:o}=e();return{getFarcasterSignerPublicKey:t,signFarcasterMessage:r,requestFarcasterSignerFromWarpcast:o}}const Qe=()=>{let{revokeDelegatedWallets:e,delegateWallet:t}=ae();return{delegateWallet:async({address:e,chainType:r})=>await t({address:e,chainType:r,showDelegationUIs:!0}),revokeWallets:async()=>await e({showDelegationUIs:!0})}},Xe=()=>{let{addSessionSignersInternal:t,removeSessionSignersInternal:r}=(()=>{let{getAccessToken:t,user:r}=e(),o=ae(),{signWithUserSigner:i}=q(),a=async({wallet:e,additional_signers:a})=>{let n=await t();if(!r||!n)throw new ne("User must be authenticated and have an embedded wallet to delegate actions.");if(!e.id)throw new ne("Wallet to add signers to must have ID on server");if(!o.walletProxy)throw new ne("Wallet proxy not initialized.");await ye(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 ne("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 ne("Wallet proxy not initialized.");let l=G(r,e);if(!l)throw new ne("Address to add signers too is not associated with current user.");if(X(l)){if(0===i.length)throw new ne("Must specify at least one signer to add.");let e=[...(await me(o.privy,{wallet_id:l.id})).additional_signers,...$(i)];await a({wallet:l,additional_signers:e})}else{if(l.delegated)return{user:r};if(i.length>0)throw new ne("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=Y({address:e,user:r}),a=Z({address:e,user:r});await o.recoverPrimaryWallet(),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 ne("User must be authenticated and have an embedded wallet to delegate actions.");if(!(o.walletProxy??await o.initializeWalletProxy(15e3)))throw new ne("Wallet proxy not initialized.");let n=G(r,e);if(!n)throw new ne("Address to remove signers from is not associated with current user.");X(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})}},Je=()=>{let{setUser:e,client:t}=oe(le),{user:r}=oe(h);return{user:r,refreshUser:ee((async()=>{let r=await(t?.updateUserAndIdToken());return e(r??null),r}),[t,e])}},$e=e=>{let t=i(),{initLoginWithTelegram:r,loginWithTelegram:o,telegramAuthState:a,setTelegramAuthState:n}=ae();return{login:ee((async i=>{try{if(t.enabled&&"success"!==t.status)throw new s(t.error,null,se.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||se.UNKNOWN_AUTH_ERROR),i}}),[r,o,t]),state:a}},Ye=()=>{let{revokeDelegatedWallets:e,delegateWallet:t}=ae();return{delegateWallet:async({address:e,chainType:r})=>await t({address:e,chainType:r,showDelegationUIs:!1}),revokeWallets:async()=>await e({showDelegationUIs:!1})}};export{Ne as useConnectCoinbaseSmartWallet,Ue as useConnectOrCreateWallet,Oe as useCrossAppAccounts,Ve as useCustomAuth,Qe as useDelegatedActions,Be as useFarcasterSigner,Fe as useGuestAccounts,Ye as useHeadlessDelegatedActions,Pe as useLinkAccount,Ee as useLinkWithPasskey,Se as useLinkWithSiwe,Ce as useLoginWithEmail,fe as useLoginWithFarcasterV2,ke as useLoginWithOAuth,We as useLoginWithPasskey,ve as useLoginWithSiwe,Te as useLoginWithSms,$e as useLoginWithTelegram,Ke as useModalStatus,je as useOAuthTokens,Ae as useRecoverEmbeddedWallet,_e as useSendTransaction,Xe as useSessionSigners,Me as useSetWalletPassword,Le as useSetWalletRecovery,De as useSignAuthorization,He as useSignMessage,Re as useSignTransaction,xe as useSignTypedData,Ie as useSignupWithPasskey,Ge as useSubscribeToJwtAuthWithFlag,j as useSyncJwtBasedAuthState,ze as useToken,be as useUpdateAccount,Je as useUser,v as useWallets};
|