@privy-io/react-auth 2.18.2 → 2.19.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. package/dist/cjs/abstract-smart-wallets.js +1 -1
  2. package/dist/cjs/extended-chains.js +1 -1
  3. package/dist/cjs/farcaster.js +1 -1
  4. package/dist/cjs/{frame-B38H7ILa.js → frame-8JZCzmCf.js} +1 -1
  5. package/dist/cjs/index.js +1 -1
  6. package/dist/cjs/{internal-context-Uge-4WDr.js → internal-context-B_aIJuQh.js} +1 -1
  7. package/dist/cjs/{paths-CdRs2pll.js → paths-B00ZrFQm.js} +1 -1
  8. package/dist/cjs/privy-provider-w2CZwYgl.js +29 -0
  9. package/dist/cjs/smart-wallets-Dr1Osypf.js +1 -0
  10. package/dist/cjs/smart-wallets.js +1 -1
  11. package/dist/cjs/solana.js +1 -1
  12. package/dist/cjs/ui.js +1 -1
  13. package/dist/cjs/{use-sign-with-user-signer-BrJ6QN6E.js → use-sign-with-user-signer-BQ_24mRh.js} +1 -1
  14. package/dist/cjs/{useActiveWallet-Bid3gn-d.js → useActiveWallet-DtQAu2Xs.js} +1 -1
  15. package/dist/cjs/{useFundWallet-BSIeXhtj.js → useFundWallet-BwCeN7KG.js} +1 -1
  16. package/dist/dts/extended-chains.d.mts +2 -1
  17. package/dist/dts/extended-chains.d.ts +2 -1
  18. package/dist/dts/farcaster.d.mts +2 -1
  19. package/dist/dts/farcaster.d.ts +2 -1
  20. package/dist/dts/index.d.mts +106 -99
  21. package/dist/dts/index.d.ts +106 -99
  22. package/dist/dts/smart-wallets.d.mts +2 -1
  23. package/dist/dts/smart-wallets.d.ts +2 -1
  24. package/dist/dts/solana.d.mts +5 -4
  25. package/dist/dts/solana.d.ts +5 -4
  26. package/dist/dts/{types-cSndhqyV.d.mts → types-ZqHmGCwO.d.mts} +55 -6
  27. package/dist/dts/{types-cSndhqyV.d.ts → types-ZqHmGCwO.d.ts} +55 -6
  28. package/dist/dts/ui.d.mts +2 -1
  29. package/dist/dts/ui.d.ts +2 -1
  30. package/dist/dts/{useSolanaWallets-BGaZqngA.d.mts → useSolanaWallets-idhSZbQC.d.mts} +1 -1
  31. package/dist/dts/{useSolanaWallets-BGaZqngA.d.ts → useSolanaWallets-idhSZbQC.d.ts} +1 -1
  32. package/dist/esm/abstract-smart-wallets.mjs +1 -1
  33. package/dist/esm/extended-chains.mjs +1 -1
  34. package/dist/esm/farcaster.mjs +1 -1
  35. package/dist/esm/{frame-FpttHlk8.mjs → frame-DMd4vZ0H.mjs} +1 -1
  36. package/dist/esm/index.mjs +1 -1
  37. package/dist/esm/{internal-context-BzsB315R.mjs → internal-context-qdNgTV5f.mjs} +1 -1
  38. package/dist/esm/{paths-CYLUXo_U.mjs → paths-DCwuPDUk.mjs} +1 -1
  39. package/dist/esm/privy-provider-CCrdZtua.mjs +29 -0
  40. package/dist/esm/smart-wallets-hHAH4Mag.mjs +1 -0
  41. package/dist/esm/smart-wallets.mjs +1 -1
  42. package/dist/esm/solana.mjs +1 -1
  43. package/dist/esm/ui.mjs +1 -1
  44. package/dist/esm/{use-sign-with-user-signer-C21K9CRz.mjs → use-sign-with-user-signer-DnNPDfxp.mjs} +1 -1
  45. package/dist/esm/{useActiveWallet-DwAADhPG.mjs → useActiveWallet-DevxnhSd.mjs} +1 -1
  46. package/dist/esm/{useFundWallet-CHnKKMFA.mjs → useFundWallet-NTlLFshj.mjs} +1 -1
  47. package/package.json +5 -4
  48. package/dist/cjs/privy-provider-CUA5RhGV.js +0 -29
  49. package/dist/cjs/smart-wallets-Dh0jTSUz.js +0 -1
  50. package/dist/esm/privy-provider-CGNOFJ8i.mjs +0 -29
  51. package/dist/esm/smart-wallets-DWVzc4NE.mjs +0 -1
@@ -5,6 +5,7 @@ import { ReactElement, ReactNode } from 'react';
5
5
  import { Hex } from 'viem';
6
6
  import { Cluster as Cluster$1, ChainLikeWithId, CountryCode, Chain, RpcConfig } from '@privy-io/js-sdk-core';
7
7
  import { ChainType, SmartWalletType, CustomMetadataType, PrivyAppResponse, PasskeyAuthenticateInputType } from '@privy-io/public-api';
8
+ import { createBaseAccountSDK } from '@base-org/account';
8
9
  import { SolanaSignMessageFeature, SolanaSignTransactionFeature, SolanaSignAndSendTransactionFeature, SolanaSignInFeature } from '@solana/wallet-standard-features';
9
10
  import { WalletWithFeatures } from '@wallet-standard/base';
10
11
  import { StandardConnectFeature, StandardDisconnectFeature, StandardEventsFeature } from '@wallet-standard/features';
@@ -314,6 +315,35 @@ interface RequestArguments {
314
315
  readonly params?: readonly unknown[] | object | any;
315
316
  }
316
317
 
318
+ declare global {
319
+ interface Window {
320
+ ethereum?: any;
321
+ }
322
+ }
323
+ /**
324
+ * @hidden
325
+ *
326
+ * The PrivyProxyProvider adds a middleware layer on top of the underlying wallet provider.
327
+ * */
328
+ declare class PrivyProxyProvider implements EIP1193Provider {
329
+ rpcTimeoutDuration: number;
330
+ walletProvider?: EIP1193Provider;
331
+ private _subscriptions;
332
+ constructor(walletProvider?: EIP1193Provider, rpcTimeoutDuration?: number);
333
+ on(eventName: string, listener: (...args: any[]) => void): any;
334
+ request(request: {
335
+ method: string;
336
+ params?: any[] | undefined;
337
+ }): Promise<any>;
338
+ removeListener: (eventName: string | symbol, listener: (...args: any[]) => void) => any;
339
+ walletTimeout: (error?: WalletTimeoutError, timeoutMs?: number) => Promise<string[]>;
340
+ setWalletProvider: (provider: EIP1193Provider) => void;
341
+ }
342
+
343
+ type BaseAccountSdkCreateParams = Parameters<typeof createBaseAccountSDK>[0];
344
+ type BaseAccountSdkType = ReturnType<typeof createBaseAccountSDK>;
345
+ type SetBaseAccountSdkType = (sdk: BaseAccountSdkType | undefined) => void;
346
+
317
347
  /**
318
348
  * Helper type for defining a Standard Wallet with a union of Solana features.
319
349
  */
@@ -555,7 +585,7 @@ declare const EMBEDDED_WALLET_CLIENT_TYPES: readonly ["privy"];
555
585
  type EmbeddedWalletClientType = (typeof EMBEDDED_WALLET_CLIENT_TYPES)[number];
556
586
  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"];
557
587
  type InjectedWalletClientType = (typeof INJECTED_WALLET_CLIENT_TYPES)[number];
558
- declare const COINBASE_WALLET_CLIENT_TYPES: readonly ["coinbase_wallet", "coinbase_smart_wallet"];
588
+ declare const COINBASE_WALLET_CLIENT_TYPES: readonly ["coinbase_wallet", "coinbase_smart_wallet", "base_account"];
559
589
  type CoinbaseWalletClientType = (typeof COINBASE_WALLET_CLIENT_TYPES)[number];
560
590
  type WalletConnectWalletClientType = (typeof WALLET_CONNECT_WALLET_CLIENT_TYPES)[number];
561
591
  declare const UNKNOWN_WALLET_CLIENT_TYPES: readonly ["unknown"];
@@ -1232,7 +1262,7 @@ type PriceDisplayOptions = {
1232
1262
  primary: 'native-token';
1233
1263
  secondary: null;
1234
1264
  };
1235
- type WalletListEntry = 'metamask' | 'coinbase_wallet' | 'rainbow' | 'phantom' | 'zerion' | 'cryptocom' | 'uniswap' | 'okx_wallet' | 'universal_profile'
1265
+ type WalletListEntry = 'metamask' | 'coinbase_wallet' | 'base_account' | 'rainbow' | 'phantom' | 'zerion' | 'cryptocom' | 'uniswap' | 'okx_wallet' | 'universal_profile'
1236
1266
  /** @deprecated Use `detected_ethereum_wallets` or `detected_solana_wallets` instead */
1237
1267
  | 'detected_wallets' | 'detected_solana_wallets' | 'detected_ethereum_wallets' | 'wallet_connect' | 'rabby_wallet' | 'bybit_wallet' | 'ronin_wallet' | 'haha_wallet' | 'safe' | 'solflare' | 'backpack' | 'binance';
1238
1268
  type NonEmptyArray<T> = [T, ...T[]];
@@ -1264,6 +1294,17 @@ type ExternalWalletsConfig = {
1264
1294
  */
1265
1295
  config?: Parameters<typeof createCoinbaseWalletSDK>[0];
1266
1296
  };
1297
+ /**
1298
+ * Options to configure connections to the Base Account (passkey-based smart wallet).
1299
+ */
1300
+ baseAccount?: {
1301
+ /**
1302
+ * Allows you to override the default configuration options for initializing the Base Account
1303
+ * connector. This includes overriding the connection options (via config.preference.options)
1304
+ * or adding additional configuration (i.e. enabling subAccounts)
1305
+ */
1306
+ config?: BaseAccountSdkCreateParams;
1307
+ };
1267
1308
  /**
1268
1309
  * Mapping between `walletClientType`s to the length of time after which signature and RPC requests will timeout for that
1269
1310
  * `walletClientType`.
@@ -1709,7 +1750,7 @@ interface TelegramWebAppData {
1709
1750
  signature?: string;
1710
1751
  }
1711
1752
  /**
1712
- * Data received from an OAuth user endpoint
1753
+ * Data received from an OAuth user endpoint -- only used in account transfer flows
1713
1754
  */
1714
1755
  interface OAuthUserInfo {
1715
1756
  subject: string;
@@ -1718,13 +1759,18 @@ interface OAuthUserInfo {
1718
1759
  email?: string;
1719
1760
  profilePictureUrl?: string;
1720
1761
  vanityName?: string;
1762
+ meta?: {
1763
+ providerAppId?: string;
1764
+ };
1765
+ embeddedWalletAddresses?: string[];
1766
+ smartWalletAddresses?: string[];
1721
1767
  }
1722
1768
  /**
1723
1769
  * Object representation of metadata reported by a connected wallet during the SIWE flow
1724
1770
  */
1725
- interface SiweWalletMetadata {
1771
+ interface ExternalWalletMetadata {
1726
1772
  walletClientType: WalletClientType;
1727
- chainId: string;
1773
+ chainId?: string;
1728
1774
  connectorType: string;
1729
1775
  }
1730
1776
  /**
@@ -1825,6 +1871,9 @@ type AppConfig = {
1825
1871
  coinbaseWallet: {
1826
1872
  config: NonNullable<NonNullable<NonNullable<PrivyClientConfig['externalWallets']>['coinbaseWallet']>['config']>;
1827
1873
  };
1874
+ baseAccount: {
1875
+ config: NonNullable<NonNullable<NonNullable<PrivyClientConfig['externalWallets']>['baseAccount']>['config']>;
1876
+ };
1828
1877
  walletConnect: {
1829
1878
  enabled: boolean;
1830
1879
  appKit?: AppKit;
@@ -2247,4 +2296,4 @@ type SessionSignerInput = {
2247
2296
  policyIds?: string[];
2248
2297
  }[];
2249
2298
 
2250
- 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 AppConfig 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 Telegram as aA, type CrossAppAccount as aB, type LinkedAccountType as aC, type GoogleOAuthWithMetadata as aD, type TwitterOAuthWithMetadata as aE, type DiscordOAuthWithMetadata as aF, type GithubOAuthWithMetadata as aG, type TiktokOAuthWithMetadata as aH, type LineOAuthWithMetadata as aI, type LinkedInOAuthWithMetadata as aJ, type AppleOAuthWithMetadata as aK, type FarcasterWithMetadata as aL, type TelegramWithMetadata as aM, type CrossAppAccountWithMetadata as aN, type PasskeyWithMetadata as aO, type Email as aP, type Phone as aQ, type TransactionUIOptions as aR, type ContractUIOptions as aS, type NativeFundingConfig as aT, type MoonpayFundingConfig as aU, type PriceDisplayOptions as aV, type Farcaster as aW, type Passkey as aX, type LoginMethodOrderOption as aY, 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 Line 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 };
2299
+ export { type MoonpaySignRequest as $, type ConnectorType as A, type BaseConnectedEthereumWallet as B, type ConnectedSolanaWallet as C, type SetBaseAccountSdkType as D, type EthereumRpcRequestType as E, type FundingMethod as F, type WalletListEntry as G, type HDWalletWithMetadata as H, type AppConfig as I, type BaseConnectedWallet as J, type ConnectWalletModalOptions as K, type LoginToFrame as L, type MfaMethod as M, type LoginModalOptions as N, type OAuthTokens as O, PrivyErrorCode as P, type SetWalletRecoveryOptions as Q, type RuntimeLoginOverridableOptions as R, type SolanaTransactionReceipt as S, type SignTypedDataParams as T, type User as U, type UnsignedTransactionRequest as V, type Wallet as W, type FundWalletConfig as X, type ConnectedWallet as Y, type CrossAppProviderDetails as Z, type OAuthProviderType as _, type LoginMethod as a, type MoonpaySignResponse as a0, type SmartWalletConfig as a1, type ExternalWalletMetadata as a2, type TelegramAuthResult as a3, type TelegramWebAppData as a4, type OAuthUserInfo as a5, type SiwsMessageType as a6, type OAuthFlowState as a7, type LoginWithCode as a8, type OtpFlowState as a9, type Tiktok as aA, type Line as aB, type Telegram as aC, type CrossAppAccount as aD, type LinkedAccountType as aE, type GoogleOAuthWithMetadata as aF, type TwitterOAuthWithMetadata as aG, type DiscordOAuthWithMetadata as aH, type GithubOAuthWithMetadata as aI, type TiktokOAuthWithMetadata as aJ, type LineOAuthWithMetadata as aK, type LinkedInOAuthWithMetadata as aL, type AppleOAuthWithMetadata as aM, type FarcasterWithMetadata as aN, type TelegramWithMetadata as aO, type CrossAppAccountWithMetadata as aP, type PasskeyWithMetadata as aQ, type Email as aR, type Phone as aS, type TransactionUIOptions as aT, type ContractUIOptions as aU, type NativeFundingConfig as aV, type MoonpayFundingConfig as aW, type PriceDisplayOptions as aX, type Farcaster as aY, type Passkey as aZ, type LoginMethodOrderOption as a_, type PasskeyFlowState as aa, type SiweFlowState as ab, type BaseAccountSdkType as ac, type UnsignedTransactionRequestWithChainId as ad, type BaseConnectedWalletType as ae, type SessionSignerInput as af, type TelegramAuthFlowState as ag, type TypedMessage as ah, type MessageTypes as ai, type SmartWallet as aj, type MoonpayConfig as ak, type MoonpayCurrencyCode as al, type MoonpayPaymentMethod as am, type Quantity as an, type TransactionLog as ao, type TransactionReceipt as ap, type NonEmptyArray as aq, type EmailWithMetadata as ar, type PhoneWithMetadata as as, type WalletWithMetadata as at, type Google as au, type Twitter as av, type Discord as aw, type Github as ax, type LinkedIn as ay, type Apple 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 PrivyFarcasterSignerInitResponse as m, type MfaSubmitArgs as n, type SolanaRpcRequestType as o, type EthereumRpcResponseType as p, type SolanaRpcResponseType as q, type EIP1193Provider as r, type EntropyIdVerifier as s, toSolanaWalletConnectors as t, type RequestArguments as u, WalletConnector as v, PrivyProxyProvider as w, type WalletClientType as x, type ConnectedWalletMetadata as y, type PrivyClientConfig 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-cSndhqyV.js';
2
+ import { R as RuntimeLoginOverridableOptions } from './types-ZqHmGCwO.js';
3
3
  import { Hex } from 'viem';
4
4
  import { Chain, Cluster } from '@privy-io/js-sdk-core';
5
5
  import '@coinbase/wallet-sdk';
@@ -7,6 +7,7 @@ import '@reown/appkit';
7
7
  import '@solana/wallet-adapter-base';
8
8
  import 'react';
9
9
  import '@privy-io/public-api';
10
+ import '@base-org/account';
10
11
  import '@solana/wallet-standard-features';
11
12
  import '@wallet-standard/base';
12
13
  import '@wallet-standard/features';
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-cSndhqyV.js';
2
+ import { R as RuntimeLoginOverridableOptions } from './types-ZqHmGCwO.js';
3
3
  import { Hex } from 'viem';
4
4
  import { Chain, Cluster } from '@privy-io/js-sdk-core';
5
5
  import '@coinbase/wallet-sdk';
@@ -7,6 +7,7 @@ import '@reown/appkit';
7
7
  import '@solana/wallet-adapter-base';
8
8
  import 'react';
9
9
  import '@privy-io/public-api';
10
+ import '@base-org/account';
10
11
  import '@solana/wallet-standard-features';
11
12
  import '@wallet-standard/base';
12
13
  import '@wallet-standard/features';
@@ -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-cSndhqyV.js';
2
+ import { P as PrivyErrorCode, U as User, a as LoginMethod, b as LinkedAccountWithMetadata, B as BaseConnectedEthereumWallet, c as BaseConnectedSolanaWallet, W as Wallet, M as MfaMethod, d as UserRecoveryMethod, S as SolanaTransactionReceipt, e as SupportedSolanaTransaction, O as OAuthTokens, F as FundingMethod, f as SolanaCluster, C as ConnectedSolanaWallet, g as CreateWalletOptions } from './types-ZqHmGCwO.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-cSndhqyV.js';
2
+ import { P as PrivyErrorCode, U as User, a as LoginMethod, b as LinkedAccountWithMetadata, B as BaseConnectedEthereumWallet, c as BaseConnectedSolanaWallet, W as Wallet, M as MfaMethod, d as UserRecoveryMethod, S as SolanaTransactionReceipt, e as SupportedSolanaTransaction, O as OAuthTokens, F as FundingMethod, f as SolanaCluster, C as ConnectedSolanaWallet, g as CreateWalletOptions } from './types-ZqHmGCwO.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,g as l,c as d}from"./use-sign-with-user-signer-C21K9CRz.mjs";import{o as p,w as m,e as u,a as h,a$ as I,b0 as g,b1 as y,x as f}from"./privy-provider-CGNOFJ8i.mjs";import{u as v}from"./internal-context-BzsB315R.mjs";import{g as w}from"./getEmbeddedConnectedWallet-CSSBWE2p.mjs";import{c as C}from"./smart-wallets-DWVzc4NE.mjs";import"react";import"react/jsx-runtime";import"mipd";import"react-device-detect";import"viem/utils";import"@privy-io/js-sdk-core";import"./paths-CYLUXo_U.mjs";import"ofetch";import"uuid";import"jose";import"eventemitter3";import"@coinbase/wallet-sdk";import"@privy-io/ethereum";import"@marsidev/react-turnstile";import"styled-components";import"tinycolor2";import"@heroicons/react/24/outline/DevicePhoneMobileIcon";import"@heroicons/react/24/outline/FingerPrintIcon";import"@heroicons/react/24/outline/PhoneIcon";import"@heroicons/react/24/outline/ShieldCheckIcon";import"@heroicons/react/24/outline/ArrowLeftIcon";import"@heroicons/react/24/outline/ArrowRightIcon";import"@heroicons/react/24/outline/QuestionMarkCircleIcon";import"@heroicons/react/24/outline/XMarkIcon";import"@heroicons/react/24/outline/CalendarIcon";import"@heroicons/react/24/outline/ExclamationTriangleIcon";import"@heroicons/react/24/outline/ChevronDownIcon";import"zustand";import"@headlessui/react";import"@heroicons/react/24/outline/CheckIcon";import"@heroicons/react/24/outline/Square2StackIcon";import"@walletconnect/ethereum-provider";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/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"@heroicons/react/24/outline";import"@tanstack/react-virtual";import"qrcode";import"@heroicons/react/24/solid/ArrowsRightLeftIcon";import"@heroicons/react/24/outline/ChevronRightIcon";import"@heroicons/react/24/outline/LockClosedIcon";import"@heroicons/react/24/outline/PencilSquareIcon";import"@heroicons/react/24/outline/ArrowPathIcon";import"@heroicons/react/24/outline/EyeIcon";import"@heroicons/react/24/outline/EyeSlashIcon";import"@heroicons/react/24/outline/KeyIcon";import"@heroicons/react/24/outline/ArrowDownTrayIcon";import"@heroicons/react/24/outline/ClipboardDocumentCheckIcon";import"@heroicons/react/24/outline/DocumentDuplicateIcon";import"@heroicons/react/24/solid/LockClosedIcon";import"@heroicons/react/24/outline/CheckCircleIcon";import"@heroicons/react/24/outline/InformationCircleIcon";import"@heroicons/react/24/outline/CreditCardIcon";import"@heroicons/react/24/outline/QrCodeIcon";import"@heroicons/react/24/outline/GlobeAltIcon";import"@heroicons/react/24/outline/ClipboardDocumentIcon";import"@heroicons/react/24/outline/CloudArrowUpIcon";import"@heroicons/react/24/outline/NoSymbolIcon";import"@heroicons/react/24/outline/ClockIcon";import"@heroicons/react/24/outline/TrashIcon";import"@heroicons/react/24/solid/CheckBadgeIcon";import"@heroicons/react/24/solid/IdentificationIcon";import"@heroicons/react/24/outline/MinusCircleIcon";import"@heroicons/react/24/outline/ArrowRightEndOnRectangleIcon";import"@heroicons/react/24/solid/ShieldCheckIcon";import"js-cookie";import"permissionless";import"permissionless/accounts";import"permissionless/clients/pimlico";import"viem/account-abstraction";function T(){let{user:T}=s(),{hideWalletUIs:P,openPrivyModal:S,chains:b,appId:A,rpcConfig:W,client:M}=v(),k=p(),{wallets:F}=m(),{setModalData:x}=u(),q=l(T),R=!!q&&d(q),D=async(o=c.id)=>{let s=w(F);if(!s)throw Error("No connected wallet found");let l="string"==typeof o?r(o):o;if(![c.id,2741].includes(l))throw Error("Error, only Abstract chains are supported");let d=b.find((e=>e.id===l));if(!d)throw Error("Chain not configured");await s.switchChain(d.id);let p=await s.getEthereumProvider(),m=t({account:s.address,transport:n(p)}),u=a({address:s.address,signMessage:m.signMessage,signTransaction:m.signTransaction,signTypedData:m.signTypedData});return await e({chain:d,transport:i(f(d,W,A)),publicTransport:i(f(d,W,A)),signer:u})};return{signMessage:async({message:e},o)=>{let r=await D(o);return new Promise((async(o,t)=>{let{entropyId:n,entropyIdVerifier:i}=h(T);P.current=!0,x({connectWallet:{recoveryMethod:q.recoveryMethod,connectingWalletAddress:q.address,isUnifiedWallet:R,entropyId:n,entropyIdVerifier:i,onCompleteNavigateTo:I,onFailure:()=>{}},signMessage:{method:"personal_sign",data:e,confirmAndSign:()=>r.signMessage({message:e}),onSuccess:e=>o(e),onFailure:t,uiOptions:{isCancellable:!0}}}),S(g)})).finally((()=>{P.current=!1}))},signTypedData:async(e,o)=>{let r=await D(o);return new Promise((async(o,t)=>{P.current=!0;let{entropyId:n,entropyIdVerifier:i}=h(T);x({connectWallet:{recoveryMethod:q.recoveryMethod,connectingWalletAddress:q.address,isUnifiedWallet:R,entropyId:n,entropyIdVerifier:i,onCompleteNavigateTo:I,onFailure:()=>{}},signMessage:{method:"eth_signTypedData_v4",data:e,confirmAndSign:()=>r.signTypedData(e),onSuccess:e=>o(e),onFailure:t,uiOptions:{isCancellable:!0}}}),S(g)})).finally((()=>{P.current=!1}))},sendTransaction:async e=>{let r=await D(e.chainId),t=[],n="calls"in e&&void 0!==e.calls;return t=n?[...e.calls]:[e],new Promise((async(i,a)=>{P.current=!0;let{entropyId:c,entropyIdVerifier:s}=h(T);x({connectWallet:{recoveryMethod:q.recoveryMethod,connectingWalletAddress:q.address,isUnifiedWallet:R,entropyId:c,entropyIdVerifier:s,onCompleteNavigateTo:y,onFailure:()=>{}},sendTransaction:{transactionRequests:C({calls:t,chain:r.chain,maxPriorityFeePerGas:e.maxPriorityFeePerGas,maxFeePerGas:e.maxFeePerGas,nonce:e.nonce?BigInt(e.nonce):void 0}),entropyId:c,entropyIdVerifier:s,transactingWalletAddress:r.account.address,transactingWalletIndex:void 0,prepareTransactionRequest:async()=>{let t=n?o(r.account.address,e):e;return await r.prepareAbstractTransactionRequest(t)},scanTransaction:async()=>{if(!M)throw Error("Privy client not found");let t=n?o(r.account.address,e):e,i=await r.prepareAbstractTransactionRequest(t);return await M.scanTransaction({metadata:{domain:k.embeddedWallets.transactionScanning.domain},chain_id:e.chainId.toString(),request:{method:"eth_sendTransaction",params:[{from:i.from,to:i.to,value:i.value?.toString(),gas:i.gas?.toString(),gasPrice:i.gasPrice?.toString(),nonce:i.nonce?.toString(),data:i.data,eip_712_meta:{paymaster_params:{paymaster:i.paymaster,paymaster_input:i.paymasterInput}}}]}})},signOnly:!1,getIsSponsored:async()=>void 0!==e.paymaster&&void 0!==e.paymasterInput,onConfirm:()=>n?r.sendTransactionBatch(e):r.sendTransaction(e),onSuccess:e=>i(e.hash),onFailure:a,uiOptions:{isCancellable:!0}}}),S(g)})).finally((()=>{P.current=!1}))},signTransaction:async e=>{let r=await D(e.chainId),t=[],n="calls"in e&&void 0!==e.calls;return t=n?[...e.calls]:[e],new Promise((async(i,a)=>{P.current=!0;let{entropyId:c,entropyIdVerifier:s}=h(T);x({connectWallet:{recoveryMethod:q.recoveryMethod,connectingWalletAddress:q.address,isUnifiedWallet:R,entropyId:c,entropyIdVerifier:s,onCompleteNavigateTo:y,onFailure:()=>{}},sendTransaction:{transactionRequests:C({calls:t,chain:r.chain,maxPriorityFeePerGas:e.maxPriorityFeePerGas,maxFeePerGas:e.maxFeePerGas,nonce:e.nonce?BigInt(e.nonce):void 0}),entropyId:c,entropyIdVerifier:s,transactingWalletAddress:r.account.address,transactingWalletIndex:void 0,prepareTransactionRequest:async()=>{let t=n?o(r.account.address,e):e;return await r.prepareAbstractTransactionRequest(t)},scanTransaction:async()=>{if(!M)throw Error("Privy client not found");let t=n?o(r.account.address,e):e,i=await r.prepareAbstractTransactionRequest(t);return await M.scanTransaction({metadata:{domain:k.embeddedWallets.transactionScanning.domain},chain_id:e.chainId.toString(),request:{method:"eth_sendTransaction",params:[{from:i.from,to:i.to,value:i.value?.toString(),gas:i.gas?.toString(),gasPrice:i.gasPrice?.toString(),nonce:i.nonce?.toString(),data:i.data}]}})},signOnly:!0,getIsSponsored:async()=>void 0!==e.paymaster&&void 0!==e.paymasterInput,onConfirm:async()=>{let t=n?o(r.account.address,e):e,i=await r.prepareAbstractTransactionRequest(t);return r.signTransaction(i)},onSuccess:e=>i(e.hash),onFailure:a,uiOptions:{isCancellable:!0}}}),S(g)})).finally((()=>{P.current=!1}))}}}export{T as useAbstractSmartWallets};
1
+ import{createAbstractClient as e}from"@abstract-foundation/agw-client";import{getBatchTransactionObject as o}from"@abstract-foundation/agw-client/actions";import{hexToNumber as r,createWalletClient as t,custom as n,http as i}from"viem";import{toAccount as a}from"viem/accounts";import{abstractTestnet as c}from"viem/chains";import{u as s,g as l,c as d}from"./use-sign-with-user-signer-DnNPDfxp.mjs";import{o as p,w as m,e as u,a as h,a$ as I,b0 as g,b1 as y,x as f}from"./privy-provider-CCrdZtua.mjs";import{u as v}from"./internal-context-qdNgTV5f.mjs";import{g as w}from"./getEmbeddedConnectedWallet-CSSBWE2p.mjs";import{c as C}from"./smart-wallets-hHAH4Mag.mjs";import"react";import"react/jsx-runtime";import"mipd";import"react-device-detect";import"viem/utils";import"@privy-io/js-sdk-core";import"./paths-DCwuPDUk.mjs";import"ofetch";import"uuid";import"jose";import"eventemitter3";import"@coinbase/wallet-sdk";import"@privy-io/ethereum";import"@marsidev/react-turnstile";import"styled-components";import"tinycolor2";import"@heroicons/react/24/outline/DevicePhoneMobileIcon";import"@heroicons/react/24/outline/FingerPrintIcon";import"@heroicons/react/24/outline/PhoneIcon";import"@heroicons/react/24/outline/ShieldCheckIcon";import"@heroicons/react/24/outline/ArrowLeftIcon";import"@heroicons/react/24/outline/ArrowRightIcon";import"@heroicons/react/24/outline/QuestionMarkCircleIcon";import"@heroicons/react/24/outline/XMarkIcon";import"@heroicons/react/24/outline/CalendarIcon";import"@heroicons/react/24/outline/ExclamationTriangleIcon";import"@heroicons/react/24/outline/ChevronDownIcon";import"zustand";import"@headlessui/react";import"@heroicons/react/24/outline/CheckIcon";import"@heroicons/react/24/outline/Square2StackIcon";import"@walletconnect/ethereum-provider";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/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"@heroicons/react/24/outline";import"@tanstack/react-virtual";import"qrcode";import"@heroicons/react/24/solid/ArrowsRightLeftIcon";import"@heroicons/react/24/outline/ChevronRightIcon";import"@heroicons/react/24/outline/LockClosedIcon";import"@heroicons/react/24/outline/PencilSquareIcon";import"@heroicons/react/24/outline/ArrowPathIcon";import"@heroicons/react/24/outline/EyeIcon";import"@heroicons/react/24/outline/EyeSlashIcon";import"@heroicons/react/24/outline/KeyIcon";import"@heroicons/react/24/outline/ArrowDownTrayIcon";import"@heroicons/react/24/outline/ClipboardDocumentCheckIcon";import"@heroicons/react/24/outline/DocumentDuplicateIcon";import"@heroicons/react/24/solid/LockClosedIcon";import"@heroicons/react/24/outline/CheckCircleIcon";import"@heroicons/react/24/outline/InformationCircleIcon";import"@heroicons/react/24/outline/CreditCardIcon";import"@heroicons/react/24/outline/QrCodeIcon";import"@heroicons/react/24/outline/GlobeAltIcon";import"@heroicons/react/24/outline/ClipboardDocumentIcon";import"@heroicons/react/24/outline/CloudArrowUpIcon";import"@heroicons/react/24/outline/NoSymbolIcon";import"@heroicons/react/24/outline/ClockIcon";import"@heroicons/react/24/outline/TrashIcon";import"@heroicons/react/24/solid/CheckBadgeIcon";import"@heroicons/react/24/solid/IdentificationIcon";import"@heroicons/react/24/outline/MinusCircleIcon";import"@heroicons/react/24/outline/ArrowRightEndOnRectangleIcon";import"@heroicons/react/24/solid/ShieldCheckIcon";import"js-cookie";import"permissionless";import"permissionless/accounts";import"permissionless/clients/pimlico";import"viem/account-abstraction";function T(){let{user:T}=s(),{hideWalletUIs:P,openPrivyModal:S,chains:b,appId:A,rpcConfig:W,client:M}=v(),k=p(),{wallets:F}=m(),{setModalData:x}=u(),q=l(T),R=!!q&&d(q),D=async(o=c.id)=>{let s=w(F);if(!s)throw Error("No connected wallet found");let l="string"==typeof o?r(o):o;if(![c.id,2741].includes(l))throw Error("Error, only Abstract chains are supported");let d=b.find((e=>e.id===l));if(!d)throw Error("Chain not configured");await s.switchChain(d.id);let p=await s.getEthereumProvider(),m=t({account:s.address,transport:n(p)}),u=a({address:s.address,signMessage:m.signMessage,signTransaction:m.signTransaction,signTypedData:m.signTypedData});return await e({chain:d,transport:i(f(d,W,A)),publicTransport:i(f(d,W,A)),signer:u})};return{signMessage:async({message:e},o)=>{let r=await D(o);return new Promise((async(o,t)=>{let{entropyId:n,entropyIdVerifier:i}=h(T);P.current=!0,x({connectWallet:{recoveryMethod:q.recoveryMethod,connectingWalletAddress:q.address,isUnifiedWallet:R,entropyId:n,entropyIdVerifier:i,onCompleteNavigateTo:I,onFailure:()=>{}},signMessage:{method:"personal_sign",data:e,confirmAndSign:()=>r.signMessage({message:e}),onSuccess:e=>o(e),onFailure:t,uiOptions:{isCancellable:!0}}}),S(g)})).finally((()=>{P.current=!1}))},signTypedData:async(e,o)=>{let r=await D(o);return new Promise((async(o,t)=>{P.current=!0;let{entropyId:n,entropyIdVerifier:i}=h(T);x({connectWallet:{recoveryMethod:q.recoveryMethod,connectingWalletAddress:q.address,isUnifiedWallet:R,entropyId:n,entropyIdVerifier:i,onCompleteNavigateTo:I,onFailure:()=>{}},signMessage:{method:"eth_signTypedData_v4",data:e,confirmAndSign:()=>r.signTypedData(e),onSuccess:e=>o(e),onFailure:t,uiOptions:{isCancellable:!0}}}),S(g)})).finally((()=>{P.current=!1}))},sendTransaction:async e=>{let r=await D(e.chainId),t=[],n="calls"in e&&void 0!==e.calls;return t=n?[...e.calls]:[e],new Promise((async(i,a)=>{P.current=!0;let{entropyId:c,entropyIdVerifier:s}=h(T);x({connectWallet:{recoveryMethod:q.recoveryMethod,connectingWalletAddress:q.address,isUnifiedWallet:R,entropyId:c,entropyIdVerifier:s,onCompleteNavigateTo:y,onFailure:()=>{}},sendTransaction:{transactionRequests:C({calls:t,chain:r.chain,maxPriorityFeePerGas:e.maxPriorityFeePerGas,maxFeePerGas:e.maxFeePerGas,nonce:e.nonce?BigInt(e.nonce):void 0}),entropyId:c,entropyIdVerifier:s,transactingWalletAddress:r.account.address,transactingWalletIndex:void 0,prepareTransactionRequest:async()=>{let t=n?o(r.account.address,e):e;return await r.prepareAbstractTransactionRequest(t)},scanTransaction:async()=>{if(!M)throw Error("Privy client not found");let t=n?o(r.account.address,e):e,i=await r.prepareAbstractTransactionRequest(t);return await M.scanTransaction({metadata:{domain:k.embeddedWallets.transactionScanning.domain},chain_id:e.chainId.toString(),request:{method:"eth_sendTransaction",params:[{from:i.from,to:i.to,value:i.value?.toString(),gas:i.gas?.toString(),gasPrice:i.gasPrice?.toString(),nonce:i.nonce?.toString(),data:i.data,eip_712_meta:{paymaster_params:{paymaster:i.paymaster,paymaster_input:i.paymasterInput}}}]}})},signOnly:!1,getIsSponsored:async()=>void 0!==e.paymaster&&void 0!==e.paymasterInput,onConfirm:()=>n?r.sendTransactionBatch(e):r.sendTransaction(e),onSuccess:e=>i(e.hash),onFailure:a,uiOptions:{isCancellable:!0}}}),S(g)})).finally((()=>{P.current=!1}))},signTransaction:async e=>{let r=await D(e.chainId),t=[],n="calls"in e&&void 0!==e.calls;return t=n?[...e.calls]:[e],new Promise((async(i,a)=>{P.current=!0;let{entropyId:c,entropyIdVerifier:s}=h(T);x({connectWallet:{recoveryMethod:q.recoveryMethod,connectingWalletAddress:q.address,isUnifiedWallet:R,entropyId:c,entropyIdVerifier:s,onCompleteNavigateTo:y,onFailure:()=>{}},sendTransaction:{transactionRequests:C({calls:t,chain:r.chain,maxPriorityFeePerGas:e.maxPriorityFeePerGas,maxFeePerGas:e.maxFeePerGas,nonce:e.nonce?BigInt(e.nonce):void 0}),entropyId:c,entropyIdVerifier:s,transactingWalletAddress:r.account.address,transactingWalletIndex:void 0,prepareTransactionRequest:async()=>{let t=n?o(r.account.address,e):e;return await r.prepareAbstractTransactionRequest(t)},scanTransaction:async()=>{if(!M)throw Error("Privy client not found");let t=n?o(r.account.address,e):e,i=await r.prepareAbstractTransactionRequest(t);return await M.scanTransaction({metadata:{domain:k.embeddedWallets.transactionScanning.domain},chain_id:e.chainId.toString(),request:{method:"eth_sendTransaction",params:[{from:i.from,to:i.to,value:i.value?.toString(),gas:i.gas?.toString(),gasPrice:i.gasPrice?.toString(),nonce:i.nonce?.toString(),data:i.data}]}})},signOnly:!0,getIsSponsored:async()=>void 0!==e.paymaster&&void 0!==e.paymasterInput,onConfirm:async()=>{let t=n?o(r.account.address,e):e,i=await r.prepareAbstractTransactionRequest(t);return r.signTransaction(i)},onSuccess:e=>i(e.hash),onFailure:a,uiOptions:{isCancellable:!0}}}),S(g)})).finally((()=>{P.current=!1}))}}}export{T as useAbstractSmartWallets};
@@ -1 +1 @@
1
- import{useMemo as r}from"react";import{create as e,rawSign as t}from"@privy-io/js-sdk-core";import{u as a}from"./internal-context-BzsB315R.mjs";import{u as i,a as s,f as n,c as o}from"./use-sign-with-user-signer-C21K9CRz.mjs";import"viem";const u=()=>{let{refreshSessionAndUser:t,privy:i}=a();return r((()=>({async createWallet(r){let a=await e(i,{request:{chain_type:r.chainType}}),s=await t();if(!s)throw Error("User must be authenticated before creating a Privy wallet");return{user:s,wallet:a}}})),[t,i])},d=()=>{let{user:e}=i(),{privy:u}=a(),{signWithUserSigner:d}=s();return r((()=>({async signRawHash({address:r,chainType:a,hash:i}){if(!e)throw Error("User must be authenticated before signing");let s=n(e,a).filter((r=>o(r))).find((e=>e.address===r));if(!s)throw Error("Wallet not found");let h=await t(u,d,{wallet_id:s.id,params:{hash:i}});if(h.data&&"signature"in h.data&&"hex"===h.data.encoding)return{signature:h.data.signature};throw Error("Failed to sign")}})),[u])};export{u as useCreateWallet,d as useSignRawHash};
1
+ import{useMemo as r}from"react";import{create as e,rawSign as t}from"@privy-io/js-sdk-core";import{u as a}from"./internal-context-qdNgTV5f.mjs";import{u as i,a as s,f as n,c as o}from"./use-sign-with-user-signer-DnNPDfxp.mjs";import"viem";const u=()=>{let{refreshSessionAndUser:t,privy:i}=a();return r((()=>({async createWallet(r){let a=await e(i,{request:{chain_type:r.chainType}}),s=await t();if(!s)throw Error("User must be authenticated before creating a Privy wallet");return{user:s,wallet:a}}})),[t,i])},d=()=>{let{user:e}=i(),{privy:u}=a(),{signWithUserSigner:d}=s();return r((()=>({async signRawHash({address:r,chainType:a,hash:i}){if(!e)throw Error("User must be authenticated before signing");let s=n(e,a).filter((r=>o(r))).find((e=>e.address===r));if(!s)throw Error("Wallet not found");let h=await t(u,d,{wallet_id:s.id,params:{hash:i}});if(h.data&&"signature"in h.data&&"hex"===h.data.encoding)return{signature:h.data.signature};throw Error("Failed to sign")}})),[u])};export{u as useCreateWallet,d as useSignRawHash};
@@ -1 +1 @@
1
- import{useCallback as t}from"react";import{F as e}from"./frame-FpttHlk8.mjs";import{P as r}from"./paths-CYLUXo_U.mjs";import{u as i}from"./internal-context-BzsB315R.mjs";import"ofetch";const a=()=>{let{client:a,setAuthenticated:s,setUser:n}=i();return{initLoginToFrame:t((async()=>{let t=new e;if(!a)throw new r("Must initialize Privy client first.");return a.startAuthFlow(t),await t.init()}),[a]),loginToFrame:t((async({message:t,signature:i})=>{if(!a)throw new r("Must initialize Privy client first.");if(!(a.authFlow instanceof e))throw new r("Must initialize Farcaster frame flow first.");let o=(t=>{let e=t.match(/farcaster:\/\/fid\/(\d+)/);return e&&e[1]?parseInt(e[1],10):null})(t);if(!o)throw new r("Invalid message format; could not parse Farcaster ID.");a.authFlow.setAuthData({message:t,signature:i,fid:o});let{user:l}=await a.authenticate();return l&&(n(l),s(!0)),l}),[a,n,s])}};export{a as useLoginToFrame};
1
+ import{useCallback as t}from"react";import{F as e}from"./frame-DMd4vZ0H.mjs";import{P as r}from"./paths-DCwuPDUk.mjs";import{u as i}from"./internal-context-qdNgTV5f.mjs";import"ofetch";const a=()=>{let{client:a,setAuthenticated:s,setUser:n}=i();return{initLoginToFrame:t((async()=>{let t=new e;if(!a)throw new r("Must initialize Privy client first.");return a.startAuthFlow(t),await t.init()}),[a]),loginToFrame:t((async({message:t,signature:i})=>{if(!a)throw new r("Must initialize Privy client first.");if(!(a.authFlow instanceof e))throw new r("Must initialize Farcaster frame flow first.");let o=(t=>{let e=t.match(/farcaster:\/\/fid\/(\d+)/);return e&&e[1]?parseInt(e[1],10):null})(t);if(!o)throw new r("Invalid message format; could not parse Farcaster ID.");a.authFlow.setAuthData({message:t,signature:i,fid:o});let{user:l}=await a.authenticate();return l&&(n(l),s(!0)),l}),[a,n,s])}};export{a as useLoginToFrame};
@@ -1 +1 @@
1
- import{P as t,aj as s,ak as i,f as a}from"./paths-CYLUXo_U.mjs";class e{async init(){if(!this.api)throw new t("Auth flow has no API instance");let{nonce:i,expires_at:a}=await this.api.post(s,{});return{nonce:i,expiresAt:a}}async authenticate(){if(!this.message||!this.signature||!this.fid)throw new t("Auth flow has no message, signature, or fid");if(!this.api)throw new t("Auth flow has no API instance");try{let s=await this.api.post(i,{message:this.message,signature:this.signature,fid:this.fid});if(!s)throw new t("No response from authentication");return s}catch(t){throw a(t)}}async link(){throw Error("Not implemented")}setAuthData({message:t,signature:s,fid:i}){this.message=t,this.signature=s,this.fid=i}constructor(){this.meta={}}}export{e as F};
1
+ import{P as t,ak as s,al as i,f as a}from"./paths-DCwuPDUk.mjs";class e{async init(){if(!this.api)throw new t("Auth flow has no API instance");let{nonce:i,expires_at:a}=await this.api.post(s,{});return{nonce:i,expiresAt:a}}async authenticate(){if(!this.message||!this.signature||!this.fid)throw new t("Auth flow has no message, signature, or fid");if(!this.api)throw new t("Auth flow has no API instance");try{let s=await this.api.post(i,{message:this.message,signature:this.signature,fid:this.fid});if(!s)throw new t("No response from authentication");return s}catch(t){throw a(t)}}async link(){throw Error("Not implemented")}setAuthData({message:t,signature:s,fid:i}){this.message=t,this.signature=s,this.fid=i}constructor(){this.meta={}}}export{e as F};
@@ -1 +1 @@
1
- import{g as e,a as t,u as r,b as o,c as n,C as i,d as s,s as l,U as d,e as h,f as w,t as p,h as m,M as y,i as f,A,j as k,k as v,L as C,l as E,I as S,T,S as U,B as I,P as W,E as P,m as M,n as F,o as L,p as D,q as H,G as x,W as q,r as z,v as j,w as B,x as G,y as J,z as ee,D as te,F as re,H as ae,J as oe}from"./privy-provider-CGNOFJ8i.mjs";export{O as Captcha,Q as ConnectorManager,V as EthereumWalletConnector,a9 as LoginModal,a2 as PrivyClient,K as PrivyProvider,a1 as VERSION,R as WalletConnector,$ as errorIndicatesMaxMfaRetries,a0 as errorIndicatesMfaTimeout,_ as errorIndicatesMfaVerificationFailed,N as getAccessToken,a6 as useCreateWallet,a3 as useIdentityToken,a8 as useImportWallet,a4 as useLogout,Y as useMfa,Z as useMfaEnrollment,X as usePrivy,a5 as useRegisterMfaListener,a7 as useSolanaWallets}from"./privy-provider-CGNOFJ8i.mjs";import{useCallback as ne,useMemo as ie,useEffect as se,useContext as le,useState as ce,useRef as ue}from"react";import{P as de,a as he}from"./paths-CYLUXo_U.mjs";import{u as we,I as pe}from"./internal-context-BzsB315R.mjs";import{u as me,P as ye,g as ge,a as fe,b as Ae,c as ke}from"./use-sign-with-user-signer-C21K9CRz.mjs";export{c as useActiveWallet,a as useConnectWallet,b as useFundWallet,u as useLogin}from"./useActiveWallet-DwAADhPG.mjs";import{F as ve}from"./frame-FpttHlk8.mjs";import{MfaAuthTotpVerify as Ce,MfaAuthPasskeyInit as Ee,MfaAuthPasskeyVerify as Se,MfaAuthTotpInit as Te,MfaAuthTotpEnroll as Ue,MfaAuthTotpUnenroll as Ie,MfaAuthPasskeyEnrollment as We}from"@privy-io/public-api";import{jsxs as Re,Fragment as Pe,jsx as be}from"react/jsx-runtime";import Me from"@heroicons/react/24/outline/QuestionMarkCircleIcon";import Ne from"@heroicons/react/24/outline/ShieldCheckIcon";import{zeroAddress as Oe,getAddress as _e,createWalletClient as Fe,http as Le,parseSignature as De}from"viem";import{hashAuthorization as He}from"viem/utils";import{getWallet as xe,updateWallet as Ke,generateAuthorizationSignature as qe,PrivyClientError as ze}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{toAccount as je}from"viem/accounts";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/ArrowLeftIcon";import"@heroicons/react/24/outline/ArrowRightIcon";import"@heroicons/react/24/outline/XMarkIcon";import"@heroicons/react/24/outline/CalendarIcon";import"@heroicons/react/24/outline/ExclamationTriangleIcon";import"@heroicons/react/24/outline/ChevronDownIcon";import"zustand";import"@headlessui/react";import"@heroicons/react/24/outline/CheckIcon";import"@heroicons/react/24/outline/Square2StackIcon";import"@walletconnect/ethereum-provider";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/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"@heroicons/react/24/outline";import"@tanstack/react-virtual";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/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 Ve=()=>{let{user:r}=me(),{walletProxy:a}=we();return{recover:ne((async o=>{if(!a)throw Error("Wallet proxy is not ready");let n=await e();if(!r||!n)throw new de("User must be logged in before attempting to modify the recovery method.");let{entropyId:i,entropyIdVerifier:s}=t(r);try{await a.recover({entropyId:i,entropyIdVerifier:s,accessToken:n,...o})}catch{throw new de("Unable to recover wallets")}}),[a,r])}},Be=()=>{let{client:e,setAuthenticated:t,setUser:r}=we();return ie((()=>({init:async()=>{if(!e)throw new de("Must initialize Privy client first.");let t=new ve;return e.startAuthFlow(t),await t.init()},login:async({fid:a,message:o,signature:n})=>{if(!e)throw new de("Must initialize Privy client first.");if(!(e.authFlow instanceof ve))throw new de("Must initialize Farcaster frame flow first.");e.authFlow.setAuthData({message:o,signature:n,fid:a});let{user:i}=await e.authenticate();if(!i)throw new de("Failed to login with Farcaster V2");return r(i),t(!0),{user:i}}})),[e,r,t])},Ge=e=>{r("login",e);let t=o(),a=n(),{ready:c,user:u}=me(),{initLoginWithHeadlessOAuth:d,loginWithHeadlessOAuth:h,oAuthState:w,setOAuthState:p,isHeadlessOAuthLoading:m}=we(),y=ne((async e=>{try{if(t.enabled&&"success"!==t.status)throw new i(t.error,null,he.CAPTCHA_FAILURE);return await d(e.provider,t.token,e.disableSignup)}catch(e){throw p({status:"error",error:e}),e}}),[d,t]),g=ne((async()=>{let e=s();try{if(u)return console.warn("Cannot login with OAuth when already logged in"),u;if(!e.inProgress)throw Error("Cannot login with OAuth because no OAuth flow is in progress");if(e.popupFlow)return}catch(e){throw p({status:"error",error:e}),e}try{return await h(e)}catch(e){throw p({status:"error",error:e}),e}finally{l()}}),[h]);return se((()=>{let e=s();c&&a&&e.inProgress&&!e.withPrivyUi&&!e.popupFlow&&g().catch((()=>{}))}),[c,a]),{initOAuth:y,loading:m,state:w}},$e=e=>{let t=o(),{emailOtpState:r,setEmailOtpState:a,initLoginWithEmail:n,loginWithCode:s}=we();return{sendCode:ne((async({email:r,disableSignup:o})=>{try{let e;if(!r)throw Error("Email required to send OTP code");if(t.enabled&&"error"===t.status)throw new i(t.error,null,he.CAPTCHA_FAILURE);return t.enabled&&"success"!==t.status&&(t.execute(),e=await t.waitForResult()),await n({email:r,captchaToken:e,disableSignup:o,withPrivyUi:!1})}catch(r){throw a({status:"error",error:r}),e?.onError?.(r.privyErrorCode||he.UNKNOWN_AUTH_ERROR),r}}),[n]),loginWithCode:ne((async({code:r})=>{try{if(t.enabled&&"error"===t.status)throw new i(t.error,null,he.CAPTCHA_FAILURE);let{user:a,isNewUser:o,wasAlreadyAuthenticated:n,linkedAccount:l}=await s(r);e?.onComplete?.({user:a,isNewUser:o,wasAlreadyAuthenticated:n,loginMethod:"email",loginAccount:l})}catch(r){throw a({status:"error",error:r}),e?.onError?.(r.privyErrorCode||he.UNKNOWN_AUTH_ERROR),r}}),[s,t.status]),state:r}},Qe=e=>{let t=o(),{initSignupWithPasskey:r,signupWithPasskey:a,passkeyAuthState:n,setPasskeyAuthState:s}=we();return{signupWithPasskey:ne((async()=>{try{let o;if(t.enabled&&"error"===t.status)throw new i(t.error,null,he.CAPTCHA_FAILURE);t.enabled&&"success"!==t.status&&(t.execute(),o=await t.waitForResult()),await r({captchaToken:o,withPrivyUi:!1});let{user:n,isNewUser:s,wasAlreadyAuthenticated:l,loginAccount:c}=await a();e?.onComplete?.({user:n,isNewUser:s,wasAlreadyAuthenticated:l,loginMethod:"passkey",loginAccount:c})}catch(t){throw s({status:"error",error:t}),e?.onError?.(t.privyErrorCode||he.UNKNOWN_AUTH_ERROR),t}}),[a,t.status]),state:n}},Xe=e=>{let t=o(),{initLoginWithPasskey:r,loginWithPasskey:a,passkeyAuthState:n,setPasskeyAuthState:s}=we();return{loginWithPasskey:ne((async o=>{try{let n;if(t.enabled&&"error"===t.status)throw new i(t.error,null,he.CAPTCHA_FAILURE);t.enabled&&"success"!==t.status&&(t.execute(),n=await t.waitForResult()),await r({captchaToken:n,withPrivyUi:!1});let{user:s,isNewUser:l,wasAlreadyAuthenticated:c,loginAccount:u}=await a(o);e?.onComplete?.({user:s,isNewUser:l,wasAlreadyAuthenticated:c,loginMethod:"passkey",loginAccount:u})}catch(o){throw s({status:"error",error:o}),e?.onError?.(o.privyErrorCode||he.UNKNOWN_AUTH_ERROR),o}}),[a,t.status]),state:n}},Je=e=>{let{initLinkWithPasskey:t,linkWithPasskey:r,passkeyAuthState:a,setPasskeyAuthState:o}=we();return{linkWithPasskey:ne((async()=>{try{await t();let a=await r();if(!a)throw Error("Error, user not found");let o=a.linkedAccounts.filter((e=>"passkey"===e.type)).sort(((e,t)=>t.latestVerifiedAt.getTime()-e.latestVerifiedAt.getTime()))[0];e?.onSuccess?.({user:a,linkMethod:"passkey",linkedAccount:o})}catch(t){throw o({status:"error",error:t}),e?.onError?.(t.privyErrorCode||he.UNKNOWN_AUTH_ERROR,{linkMethod:"passkey"}),t}}),[r]),state:a}},Ye=e=>{let t=o(),{smsOtpState:r,setSmsOtpState:a,initLoginWithSms:n,loginWithCode:s}=we();return{sendCode:ne((async({phoneNumber:r,disableSignup:o})=>{try{let e;if(!r)throw Error("SMS required to send OTP code");if(t.enabled&&"error"===t.status)throw new i(t.error,null,he.CAPTCHA_FAILURE);return t.enabled&&"success"!==t.status&&(t.execute(),e=await t.waitForResult()),await n({phoneNumber:r,captchaToken:e,disableSignup:o,withPrivyUi:!1})}catch(r){throw a({status:"error",error:r}),e?.onError?.(r.privyErrorCode||he.UNKNOWN_AUTH_ERROR),r}}),[n]),loginWithCode:ne((async({code:r})=>{try{if(t.enabled&&"success"!==t.status)throw new i(t.error,null,he.CAPTCHA_FAILURE);let{user:a,isNewUser:o,wasAlreadyAuthenticated:n,linkedAccount:l}=await s(r);e?.onComplete?.({user:a,isNewUser:o,wasAlreadyAuthenticated:n,loginMethod:"sms",loginAccount:l})}catch(r){throw a({status:"error",error:r}),e?.onError?.(r.privyErrorCode||he.UNKNOWN_AUTH_ERROR),r}}),[s,t.status]),state:r}},Ze=e=>{let{connectOrCreateWallet:t}=me();return r("connectOrCreateWallet",e),{connectOrCreateWallet:t}},et=e=>{let t=o(),{siweState:r,setSiweState:a,linkWithSiwe:n,generateSiweMessage:s}=we();return{generateSiweMessage:ne((async({address:t,chainId:r})=>{try{if(!t||!r)throw Error("wallet address and chainId required to generate nonce");return await s({address:t,chainId:r}).then((e=>e))}catch(t){throw a({status:"error",error:t}),e?.onError?.(t.privyErrorCode||he.UNKNOWN_AUTH_ERROR,{linkMethod:"siwe"}),t}}),[s]),linkWithSiwe:ne((async({signature:r,message:o,chainId:s,walletClientType:l,connectorType:c})=>{try{if(t.enabled&&"success"!==t.status)throw new i(t.error,null,he.CAPTCHA_FAILURE);let{user:a,linkedAccount:u}=await n({message:o,signature:r,chainId:s,walletClientType:l,connectorType:c});u&&e?.onSuccess?.({user:a,linkMethod:"siwe",linkedAccount:u})}catch(r){throw a({status:"error",error:r}),e?.onError?.(r.privyErrorCode||he.UNKNOWN_AUTH_ERROR,{linkMethod:"siwe"}),r}}),[n,t.status]),state:r}},tt=e=>{let t=o(),{siweState:r,setSiweState:a,client:n,generateSiweMessage:s,loginWithSiwe:l}=we();return{generateSiweNonce:ne((async r=>{try{let e;if(t.enabled&&"error"===t.status)throw new i(t.error,null,he.CAPTCHA_FAILURE);t.enabled&&"success"!==t.status&&(t.execute(),e=await t.waitForResult()),a({status:"generating-message"});let o=await n.generateSiweNonce({address:r?.address,captchaToken:e});return a({status:"awaiting-signature"}),o}catch(r){throw a({status:"error",error:r}),e?.onError?.(r.privyErrorCode||he.UNKNOWN_AUTH_ERROR),r}}),[n,t]),generateSiweMessage:ne((async({address:t,chainId:r})=>{try{return await s({address:t,chainId:r})}catch(t){throw a({status:"error",error:t}),e?.onError?.(t.privyErrorCode||he.UNKNOWN_AUTH_ERROR),t}}),[s]),loginWithSiwe:ne((async({message:r,signature:o,disableSignup:n})=>{try{let a;if(t.enabled&&"error"===t.status)throw new i(t.error,null,he.CAPTCHA_FAILURE);t.enabled&&"success"!==t.status&&(t.execute(),a=await t.waitForResult());let s=await l({message:r,signature:o,captchaToken:a,disableSignup:n});return e?.onComplete?.({user:s,isNewUser:!1,wasAlreadyAuthenticated:!1,loginMethod:"siwe",loginAccount:null}),s}catch(r){throw a({status:"error",error:r}),e?.onError?.(r.privyErrorCode||he.UNKNOWN_AUTH_ERROR),r}}),[l,t.status]),state:r}};function rt(){let{signTransaction:e}=le(ye);return{signTransaction:e}}function at(e){let{linkEmail:t,linkPhone:a,linkWallet:o,linkGoogle:n,linkApple:i,linkTwitter:s,linkDiscord:l,linkGithub:c,linkLinkedIn:u,linkTiktok:d,linkLine:h,linkSpotify:w,linkInstagram:p,linkTelegram:m,linkFarcaster:y,linkPasskey:g}=le(ye);return r("linkAccount",e),{linkEmail:t,linkPhone:a,linkWallet:o,linkGoogle:n,linkApple:i,linkTwitter:s,linkDiscord:l,linkGithub:c,linkLinkedIn:u,linkTiktok:d,linkLine:h,linkSpotify:w,linkInstagram:p,linkFarcaster:y,linkTelegram:m,linkPasskey:g}}function ot(e){let{updateEmail:t,updatePhone:a}=le(ye);return r("update",e),{updateEmail:t,updatePhone:a}}const nt=e=>{let{user:t}=me(),{loginWithCode:r,emailOtpState:a,setEmailOtpState:o,client:n,inProgressAuthFlowRef:i,inProgressLoginOrLinkMethodRef:s}=we();return{state:a,sendCode:ne((async({newEmailAddress:r})=>{try{if(!t?.email)throw Error("User is required to have an email address to update it.");let e=new d(t.email.address,r);n.startAuthFlow(e),await e.sendCodeEmail({withPrivyUi:!1})}catch(r){o({status:"error",error:r}),e?.onError?.(r.privyErrorCode||he.UNKNOWN_AUTH_ERROR,{linkMethod:"email"})}}),[t?.email]),verifyCode:ne((async({code:a})=>{try{if(!t?.email)throw Error("User is required to have an email address to update it.");i.current="update",s.current="email";let{user:o,linkedAccount:n}=await r(a);return e?.onSuccess?.({user:o,updateMethod:"email",updatedAccount:n}),{user:o}}catch(a){o({status:"error",error:a}),e?.onError?.(a.privyErrorCode||he.UNKNOWN_AUTH_ERROR,{linkMethod:"email"})}}),[t?.email])}},it=()=>{let{connectCoinbaseSmartWallet:e}=we();return{connectCoinbaseSmartWallet:e}},st=()=>{let{setModalData:e}=h(),{openModal:t,privy:r,closePrivyModal:a}=we(),{user:o}=me();return ie((()=>({verify:async({standalone:n=!0}={standalone:!0})=>new Promise(((i,s)=>o?0===o.mfaMethods.length?i():(e((e=>({...e,mfaVerify:{onSuccess:async()=>{n?await a({shouldCallAuthOnSuccess:!1,isSuccess:!0}):w.setState({inProgressMfaFlow:void 0}),i()},onFailure:async e=>{n?await a({shouldCallAuthOnSuccess:!1,isSuccess:!1}):w.setState({inProgressMfaFlow:void 0}),s(e)},sendSmsCode:async()=>{throw Error("Not enabled")},verifySmsCode:async()=>{throw Error("Not enabled")},verifyTotpCode:async e=>{await r.fetchPrivyRoute(Ce,{body:{code:e}})},generateOptions:async()=>p((await r.fetchPrivyRoute(Ee,{body:{}})).options),verifyPasskey:async e=>{let t=await import("@simplewebauthn/browser"),a=await t.startAuthentication(e);await r.fetchPrivyRoute(Se,{body:{authenticator_response:m(a)}})}}}))),void(n?t(y):w.setState({inProgressMfaFlow:"auth"}))):s(Error("Must be logged in to verify MFA"))))})),[r,e,t,a])},lt={component:()=>{let{user:e,ready:t}=me(),{app:r,data:a,onUserCloseViaDialogOrKeybindRef:o}=h(),[n,i]=ce(null),[s,l]=ce(null),[c,u]=ce(null),[d,w]=ce(!1),[p,m]=ce(!1),[y,g]=ce(),R=async()=>{y?b(y):e?await N({user:e}):b(Error("Must be logged in to manage MFA")),setTimeout((()=>{i(null),l(null)}),500)};if(o.current=R,!a?.mfaEnroll)throw Error("Missing modal data for MFA enrollment screen.");let{onFailure:b,onSuccess:N,mfaMethods:O,verify:_,generateTotpSecret:L,enrollTotp:D,unenrollTotp:H,enrollPasskey:x}=a.mfaEnroll,K=e?.mfaMethods.includes("sms"),q=e?.mfaMethods.includes("totp"),z=e?.mfaMethods.includes("passkey"),j=!!e?.phone,V=e?.linkedAccounts.filter((e=>"passkey"===e.type)).map((e=>e.credentialId))??[];function B(){i(null),l(null),g(void 0)}async function G(e=V){try{g(void 0),m(!0);let t=await x(e);return await N({user:t})}catch(e){g(e)}finally{m(!1),w(!1)}}if(!t||!e||!r)/*#__PURE__*/return Re(Pe,{children:[/*#__PURE__*/be(f,{onClose:R},"header"),/*#__PURE__*/be(A,{children:/*#__PURE__*/be(k,{})}),/*#__PURE__*/be(v,{children:/*#__PURE__*/be(C,{})}),/*#__PURE__*/be(E,{})]});if("sms"===n)return null;if("totp"===n)/*#__PURE__*/return Re(Pe,{children:[/*#__PURE__*/be(f,{backFn:B,onClose:R},"header"),/*#__PURE__*/be(S,{style:{marginBottom:"1.5rem"},children:/*#__PURE__*/be(Me,{})}),/*#__PURE__*/be(T,{children:"Remove authenticator app verification?"}),/*#__PURE__*/Re(U,{children:["MFA adds an extra layer of security to your ",r?.name," account. Make sure you have other methods to secure your account."]}),/*#__PURE__*/be(I,{children:/*#__PURE__*/be(W,{$warn:!0,onClick:async function(){try{g(void 0),m(!0);let e=await H();return await N({user:e})}catch(e){g(e)}finally{m(!1),i(null)}},loading:p,children:"Remove"})}),/*#__PURE__*/be(E,{})]});if("passkey"===n){let e=a.mfaEnroll.shouldUnlinkOnUnenrollMfa??!0;/*#__PURE__*/return Re(Pe,{children:[/*#__PURE__*/be(f,{backFn:B,onClose:R},"header"),/*#__PURE__*/be(S,{style:{marginBottom:"1.5rem"},children:/*#__PURE__*/be(Me,{})}),/*#__PURE__*/be(T,{children:"Are you sure you want to remove this passkey?"}),/*#__PURE__*/be(U,{children:e?"Removing your passkey will remove as both a verification method and a login method.":"Removing your passkey will remove as a verification method."}),/*#__PURE__*/be(I,{children:/*#__PURE__*/be(W,{$warn:!0,onClick:async function(){try{g(void 0),m(!0);let e=await x([]);return await N({user:e})}catch(e){g(e)}finally{m(!1),i(null)}},loading:p,children:"Remove"})}),/*#__PURE__*/be(E,{})]})}return 0!==O.length||K||q||z?"sms"===s?null:"totp"===s&&c?/*#__PURE__*/be(P,{onClose:R,onReset:B,submitEnrollmentWithTotp:e=>async function(e){try{g(void 0),m(!0);let t=await D(e);return await N({user:t})}catch(e){g(e)}finally{m(!1),i(null)}}(e.mfaCode),error:y,totpInfo:{...c,appName:r?.name||"Privy"}}):"passkey"===s?/*#__PURE__*/be(M,{onReset:B,onClose:R,submitEnrollmentWithPasskey:G}):/*#__PURE__*/be(F,{showIntro:!1,userMfaMethods:e.mfaMethods,appMfaMethods:r.mfa.methods,userHasAuthSms:j,onBackToIntro:()=>{},handleSelectMethod:async function(e){g(void 0);try{await _()}catch(e){return void g(e)}return"totp"===e?(l(e),u(null),void L().then((({totpSecret:e,totpAuthUrl:t})=>{u({authUrl:t,secret:e})})).catch((()=>{u(null),B()}))):"passkey"===e&&1===V.length?await G():void l(e)},isTotpLoading:"totp"===s&&!c,isPasskeyLoading:d,error:y,onClose:R,setRemovingMfaMethod:async function(e){g(void 0);try{await _()}catch(e){return void g(e)}i(e)}}):/*#__PURE__*/Re(Pe,{children:[/*#__PURE__*/be(f,{onClose:R},"header"),/*#__PURE__*/be(S,{style:{marginBottom:"1.5rem"},children:/*#__PURE__*/be(Ne,{})}),/*#__PURE__*/be(T,{children:"Add more security"}),/*#__PURE__*/Re(U,{children:[r?.name," does not have any verification methods enabled."]}),/*#__PURE__*/be(I,{children:/*#__PURE__*/be(W,{onClick:R,children:"Close"})}),/*#__PURE__*/be(E,{})]})}},ct=()=>{let e=L(),{setModalData:t}=h(),{verify:r}=st(),{openModal:a,privy:o,closePrivyModal:n,refreshSessionAndUser:i,setUser:s}=we();return ie((()=>({enroll:async()=>new Promise(((l,c)=>{t({mfaEnroll:{onSuccess:async e=>{await n({shouldCallAuthOnSuccess:!1,isSuccess:!0}),l(e)},onFailure:async e=>{await n({shouldCallAuthOnSuccess:!1,isSuccess:!1}),c(e)},verify:()=>r({standalone:!1}),shouldUnlinkOnUnenrollMfa:!0,mfaMethods:e.mfa.methods,sendSmsCode:async()=>{throw Error("Not enabled")},enrollSms:async()=>{throw Error("Not enabled")},unenrollSms:async()=>{throw Error("Not enabled")},generateTotpSecret:async()=>await o.fetchPrivyRoute(Te,{body:{}}),enrollTotp:async e=>{await o.fetchPrivyRoute(Ue,{body:{code:e}});let t=await i();return s(t),t},unenrollTotp:async()=>{await o.fetchPrivyRoute(Ie,{body:{}});let e=await i();return s(e),e},enrollPasskey:async e=>{await o.fetchPrivyRoute(We,{body:{credential_ids:e,remove_for_login:!0}});let t=await i();return s(t),t}}}),a(lt)}))})),[o,t,a,n])},ut=()=>{let{startCrossAppAuthFlow:e,unlinkCrossAppAccount:t,signMessageWithCrossAppWallet:r,signTypedDataWithCrossAppWallet:a,sendTransactionWithCrossAppWallet:o}=me();return{loginWithCrossAppAccount:({appId:t})=>e({appId:t,action:"login"}),linkCrossAppAccount:({appId:t})=>e({appId:t,action:"link"}),unlinkCrossAppAccount:t,signMessage:r,signTypedData:a,sendTransaction:o}};function dt(e){let{sendTransaction:t}=le(ye);return r("sendTransaction",e),{sendTransaction:t}}function ht(e){let{setWalletPassword:t}=le(ye);return r("setWalletPassword",e),{setWalletPassword:t}}function wt(){let e=L(),{getAccessToken:t}=me(),r=D(),{client:a,setUser:o,setAuthenticated:n,setIsNewUser:i,initializeWalletProxy:s}=we(),{create:l}=H();return{createGuestAccount:async()=>{if(!e.id||!a)throw Error("SDK not yet ready");a.startAuthFlow(new x(e.id));try{let c=await a.authenticate(),u=c.user,d=c.isNewUser??!1;if(!u)throw new de("Unable to authenticate guest account");let h=await t(),w=await s(q);if(h&&w)try{let t=z(u,e.embeddedWallets.ethereum.createOnLogin),r=j(u,e.embeddedWallets.solana.createOnLogin);t&&r?(u=(await l({chainType:"ethereum",latestUser:u})).user,u=(await l({chainType:"solana",latestUser:u})).user):r?u=(await l({chainType:"solana",latestUser:u})).user:t?u=(await l({chainType:"ethereum",latestUser:u})).user:o(u)}catch(e){o(u),console.warn("Unable to create embedded wallet for guest account")}return i(d),n(!0),r("login","onComplete",{user:u,isNewUser:d,wasAlreadyAuthenticated:!1,loginMethod:"guest",loginAccount:null}),u}catch(e){throw r("login","onError",e.privyErrorCode||he.UNKNOWN_AUTH_ERROR),e}}}}function pt(e){let{setWalletRecovery:t}=le(ye);return r("setWalletRecovery",e),{setWalletRecovery:t}}function mt(e){let{signMessage:t}=le(ye);return r("signMessage",e),{signMessage:t}}const yt=()=>{let{ready:e,wallets:t}=B(),{user:r}=me(),{rpcConfig:a,chains:o,appId:n}=we();return{signAuthorization:ne((async(i,s)=>{let l;if(!r)throw Error("User must be authenticated before signing with a Privy wallet");if(!e)throw Error("Wallets are not ready");let c=s?.address??ge(r)?.address??Oe,u=t.find((e=>_e(e.address)===_e(c)));if(!u)throw Error("Signing wallet not found.");let d=i.chainId??Number(u.chainId.split(":")[1]);if(0===d)l={chainId:0,address:i.contractAddress,nonce:i.nonce??0};else{let e=o.find((e=>e.id===d));if(!e)throw Error("Error, chain not configured in PrivyProvider config");let t=Fe({account:c,chain:e,transport:Le(G(e,a,n))});l=await t.prepareAuthorization({...i})}let h=await u.getEthereumProvider(),w=await h.request({method:"secp256k1_sign",params:[He(l)]});return{...l,...De(w)}}),[e,t,r,o])}},gt=yt;function ft(e){let{signTypedData:t}=le(ye);return r("signTypedData",e),{signTypedData:t}}const At=()=>{let{isModalOpen:e}=le(ye);return{isOpen:e}};function kt(e){let{getAccessToken:t}=le(ye);return r("accessToken",e),{getAccessToken:t}}function vt(e){let{authenticated:t,user:a}=me(),{initLoginWithOAuth:o}=we(),n=D();return r("oAuthAuthorization",e),{reauthorize:e=>Ct(t,a,o,n,e.provider)}}let Ct=async(e,t,r,a,o)=>{if(!e)throw a("linkAccount","onError",he.MUST_BE_AUTHENTICATED,{linkMethod:o}),new de("User must be authenticated before linking an account.");if(!t?.linkedAccounts.some((e=>e.type.includes(o))))throw new de(`OAuth account of type ${o} not linked to the account.`);await r(o)};function Et(e){let{client:t}=we(),[r,a]=ce({status:"initial"});return{linkWithCustomJwt:ne((async r=>{try{a({status:"initial"}),t.startAuthFlow(new J(r)),a({status:"loading"});let{user:o}=await t.link();if(!o)throw Error("Error, user not found");let n=o.linkedAccounts.filter((e=>"custom_auth"===e.type)).sort(((e,t)=>t.latestVerifiedAt.getTime()-e.latestVerifiedAt.getTime())).at(0);return a({status:"done"}),e?.onSuccess?.({user:o,linkMethod:"custom",linkedAccount:n}),{user:o}}catch(r){throw a({status:"error",error:r}),e?.onError?.(r.privyErrorCode||he.UNKNOWN_AUTH_ERROR,{linkMethod:"custom"}),r}}),[t.startAuthFlow,t.link]),state:r}}const St=e=>{let t=ee();return r("customAuth",e),{status:t}};function Tt({isAuthenticated:e,isLoading:t,...r}){let a=ue();se((()=>{t||a.current?.()}),[e,t]);let o=ne((e=>(a.current=e,()=>{a.current=void 0})),[]);return te({...r,subscribe:o})}function Ut(){let{getFarcasterSignerPublicKey:e,signFarcasterMessage:t,requestFarcasterSignerFromWarpcast:r}=me();return{getFarcasterSignerPublicKey:e,signFarcasterMessage:t,requestFarcasterSignerFromWarpcast:r}}const It=()=>{let{revokeDelegatedWallets:e,delegateWallet:t}=we();return{delegateWallet:async({address:e,chainType:r})=>await t({address:e,chainType:r,showDelegationUIs:!0}),revokeWallets:async()=>await e({showDelegationUIs:!0})}},Wt=()=>{let{addSessionSignersInternal:e,removeSessionSignersInternal:t}=(()=>{let{getAccessToken:e,user:t}=me(),r=we(),{signWithUserSigner:a}=fe(),o=async({wallet:o,additional_signers:n})=>{let i=await e();if(!t||!i)throw new de("User must be authenticated and have an embedded wallet to delegate actions.");if(!o.id)throw new de("Wallet to add signers to must have ID on server");if(!r.walletProxy)throw new de("Wallet proxy not initialized.");await Ke(r.privy,{wallet_id:o.id},a,{additional_signers:n})};return{addSessionSignersInternal:async({address:a,signers:n})=>{let i=await e();if(!t||!i)throw new de("User must be authenticated and have an embedded wallet to add a session signer.");let s=r.walletProxy??await r.initializeWalletProxy(15e3);if(!s)throw new de("Wallet proxy not initialized.");let l=Ae(t,a);if(!l)throw new de("Address to add signers too is not associated with current user.");if(ke(l)){if(0===n.length)throw new de("Must specify at least one signer to add.");let e=[...(await xe(r.privy,{wallet_id:l.id})).additional_signers,...re(n)];await o({wallet:l,additional_signers:e})}else{if(l.delegated)return{user:t};if(n.length>0)throw new de("Specifying signers in addSessionSigners is only supported for TEE execution and this app uses On-device execution. Pass an empty array for signers instead. Learn more https://docs.privy.io/recipes/tee-wallet-migration-guide");let e=ae({address:a,user:t}),o=oe({address:a,user:t});await r.recoverEmbeddedWallet({address:a}),await s.createDelegatedAction({accessToken:i,rootWallet:o,delegatedWallets:[e]})}let c=await r.refreshSessionAndUser();if(!c)throw Error("Could not refresh user");return{user:c}},removeSessionSignersInternal:async({address:a})=>{let n=await e();if(!t||!n)throw new de("User must be authenticated and have an embedded wallet to delegate actions.");if(!(r.walletProxy??await r.initializeWalletProxy(15e3)))throw new de("Wallet proxy not initialized.");let i=Ae(t,a);if(!i)throw new de("Address to remove signers from is not associated with current user.");ke(i)?await o({wallet:i,additional_signers:[]}):await r.client.revokeDelegatedWallet();let s=await r.refreshSessionAndUser();if(!s)throw Error("Could not refresh user");return{user:s}}}})();return{addSessionSigners:async({address:t,signers:r})=>e({address:t,signers:r}),removeSessionSigners:async({address:e})=>t({address:e})}},Rt=()=>{let{signWithUserSigner:e}=fe();return ie((()=>({async generateAuthorizationSignature(t){let{signature:r}=await qe(e,t);return{signature:r}}})),[e])},Pt=()=>{let{setUser:e,client:t}=le(pe),{user:r}=le(ye);return{user:r,refreshUser:ne((async()=>{let r=await(t?.updateUserAndIdToken());return e(r??null),r}),[t,e])}},bt=e=>{let t=o(),{initLoginWithTelegram:r,loginWithTelegram:a,telegramAuthState:n,setTelegramAuthState:s}=we();return{login:ne((async o=>{try{if(t.enabled&&"success"!==t.status)throw new i(t.error,null,he.CAPTCHA_FAILURE);await r(t.token,o?.disableSignup);let{user:n,isNewUser:s,loginAccount:l,wasAlreadyAuthenticated:c}=await a({intent:"login"});e?.onComplete?.({user:n,isNewUser:s,wasAlreadyAuthenticated:c,loginMethod:"telegram",loginAccount:l})}catch(o){throw s({status:"error",error:o}),e?.onError?.(o.privyErrorCode||he.UNKNOWN_AUTH_ERROR),o}}),[r,a,t]),state:n}},Mt=()=>{let{revokeDelegatedWallets:e,delegateWallet:t}=we();return{delegateWallet:async({address:e,chainType:r})=>await t({address:e,chainType:r,showDelegationUIs:!1}),revokeWallets:async()=>await e({showDelegationUIs:!1})}},Nt=async({wallet:e})=>{let t=await e.getEthereumProvider();return je({address:e.address,sign:async({hash:r})=>{if("privy"!==e.walletClientType)throw new ze({error:"Unprefixed signing is not supported by external wallets.",code:"unsupported_wallet_type"});return await t.request({method:"secp256k1_sign",params:[r]})},signMessage:async({message:r})=>await t.request({method:"personal_sign",params:[r,e.address]}),signTypedData:async r=>await t.request({method:"eth_signTypedData_v4",params:[e.address,r]}),signTransaction:async e=>await t.request({method:"eth_signTransaction",params:[e]})})};export{Nt as toViemAccount,st as useAuthMfa,ct as useAuthMfaEnrollment,Rt as useAuthorizationSignature,it as useConnectCoinbaseSmartWallet,Ze as useConnectOrCreateWallet,ut as useCrossAppAccounts,St as useCustomAuth,It as useDelegatedActions,Ut as useFarcasterSigner,wt as useGuestAccounts,Mt as useHeadlessDelegatedActions,at as useLinkAccount,Et as useLinkJwtAccount,Je as useLinkWithPasskey,et as useLinkWithSiwe,$e as useLoginWithEmail,Be as useLoginWithFarcasterV2,Ge as useLoginWithOAuth,Xe as useLoginWithPasskey,tt as useLoginWithSiwe,Ye as useLoginWithSms,bt as useLoginWithTelegram,At as useModalStatus,vt as useOAuthTokens,Ve as useRecoverEmbeddedWallet,dt as useSendTransaction,Wt as useSessionSigners,ht as useSetWalletPassword,pt as useSetWalletRecovery,yt as useSign7702Authorization,gt as useSignAuthorization,mt as useSignMessage,rt as useSignTransaction,ft as useSignTypedData,Qe as useSignupWithPasskey,Tt as useSubscribeToJwtAuthWithFlag,te as useSyncJwtBasedAuthState,kt as useToken,ot as useUpdateAccount,nt as useUpdateEmail,Pt as useUser,B as useWallets};
1
+ import{g as e,a as t,u as r,b as o,c as n,C as i,d as s,s as l,U as d,e as h,f as w,t as p,h as m,M as y,i as f,A,j as k,k as v,L as C,l as E,I as S,T,S as U,B as I,P as W,E as P,m as M,n as F,o as L,p as D,q as H,G as x,W as q,r as z,v as j,w as B,x as G,y as J,z as ee,D as te,F as re,H as ae,J as oe}from"./privy-provider-CCrdZtua.mjs";export{O as Captcha,Q as ConnectorManager,V as EthereumWalletConnector,a9 as LoginModal,a2 as PrivyClient,K as PrivyProvider,a1 as VERSION,R as WalletConnector,$ as errorIndicatesMaxMfaRetries,a0 as errorIndicatesMfaTimeout,_ as errorIndicatesMfaVerificationFailed,N as getAccessToken,a6 as useCreateWallet,a3 as useIdentityToken,a8 as useImportWallet,a4 as useLogout,Y as useMfa,Z as useMfaEnrollment,X as usePrivy,a5 as useRegisterMfaListener,a7 as useSolanaWallets}from"./privy-provider-CCrdZtua.mjs";import{useCallback as ne,useMemo as ie,useEffect as se,useContext as le,useState as ce,useRef as ue}from"react";import{P as de,a as he}from"./paths-DCwuPDUk.mjs";import{u as we,I as pe}from"./internal-context-qdNgTV5f.mjs";import{u as me,P as ye,g as ge,a as fe,b as Ae,c as ke}from"./use-sign-with-user-signer-DnNPDfxp.mjs";export{c as useActiveWallet,a as useConnectWallet,b as useFundWallet,u as useLogin}from"./useActiveWallet-DevxnhSd.mjs";import{F as ve}from"./frame-DMd4vZ0H.mjs";import{MfaAuthTotpVerify as Ce,MfaAuthPasskeyInit as Ee,MfaAuthPasskeyVerify as Se,MfaAuthTotpInit as Te,MfaAuthTotpEnroll as Ue,MfaAuthTotpUnenroll as Ie,MfaAuthPasskeyEnrollment as We}from"@privy-io/public-api";import{jsxs as Re,Fragment as Pe,jsx as be}from"react/jsx-runtime";import Me from"@heroicons/react/24/outline/QuestionMarkCircleIcon";import Ne from"@heroicons/react/24/outline/ShieldCheckIcon";import{zeroAddress as Oe,getAddress as _e,createWalletClient as Fe,http as Le,parseSignature as De}from"viem";import{hashAuthorization as He}from"viem/utils";import{getWallet as xe,updateWallet as Ke,generateAuthorizationSignature as qe,PrivyClientError as ze}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{toAccount as je}from"viem/accounts";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/ArrowLeftIcon";import"@heroicons/react/24/outline/ArrowRightIcon";import"@heroicons/react/24/outline/XMarkIcon";import"@heroicons/react/24/outline/CalendarIcon";import"@heroicons/react/24/outline/ExclamationTriangleIcon";import"@heroicons/react/24/outline/ChevronDownIcon";import"zustand";import"@headlessui/react";import"@heroicons/react/24/outline/CheckIcon";import"@heroicons/react/24/outline/Square2StackIcon";import"@walletconnect/ethereum-provider";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/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"@heroicons/react/24/outline";import"@tanstack/react-virtual";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/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 Ve=()=>{let{user:r}=me(),{walletProxy:a}=we();return{recover:ne((async o=>{if(!a)throw Error("Wallet proxy is not ready");let n=await e();if(!r||!n)throw new de("User must be logged in before attempting to modify the recovery method.");let{entropyId:i,entropyIdVerifier:s}=t(r);try{await a.recover({entropyId:i,entropyIdVerifier:s,accessToken:n,...o})}catch{throw new de("Unable to recover wallets")}}),[a,r])}},Be=()=>{let{client:e,setAuthenticated:t,setUser:r}=we();return ie((()=>({init:async()=>{if(!e)throw new de("Must initialize Privy client first.");let t=new ve;return e.startAuthFlow(t),await t.init()},login:async({fid:a,message:o,signature:n})=>{if(!e)throw new de("Must initialize Privy client first.");if(!(e.authFlow instanceof ve))throw new de("Must initialize Farcaster frame flow first.");e.authFlow.setAuthData({message:o,signature:n,fid:a});let{user:i}=await e.authenticate();if(!i)throw new de("Failed to login with Farcaster V2");return r(i),t(!0),{user:i}}})),[e,r,t])},Ge=e=>{r("login",e);let t=o(),a=n(),{ready:c,user:u}=me(),{initLoginWithHeadlessOAuth:d,loginWithHeadlessOAuth:h,oAuthState:w,setOAuthState:p,isHeadlessOAuthLoading:m}=we(),y=ne((async e=>{try{if(t.enabled&&"success"!==t.status)throw new i(t.error,null,he.CAPTCHA_FAILURE);return await d(e.provider,t.token,e.disableSignup)}catch(e){throw p({status:"error",error:e}),e}}),[d,t]),g=ne((async()=>{let e=s();try{if(u)return console.warn("Cannot login with OAuth when already logged in"),u;if(!e.inProgress)throw Error("Cannot login with OAuth because no OAuth flow is in progress");if(e.popupFlow)return}catch(e){throw p({status:"error",error:e}),e}try{return await h(e)}catch(e){throw p({status:"error",error:e}),e}finally{l()}}),[h]);return se((()=>{let e=s();c&&a&&e.inProgress&&!e.withPrivyUi&&!e.popupFlow&&g().catch((()=>{}))}),[c,a]),{initOAuth:y,loading:m,state:w}},$e=e=>{let t=o(),{emailOtpState:r,setEmailOtpState:a,initLoginWithEmail:n,loginWithCode:s}=we();return{sendCode:ne((async({email:r,disableSignup:o})=>{try{let e;if(!r)throw Error("Email required to send OTP code");if(t.enabled&&"error"===t.status)throw new i(t.error,null,he.CAPTCHA_FAILURE);return t.enabled&&"success"!==t.status&&(t.execute(),e=await t.waitForResult()),await n({email:r,captchaToken:e,disableSignup:o,withPrivyUi:!1})}catch(r){throw a({status:"error",error:r}),e?.onError?.(r.privyErrorCode||he.UNKNOWN_AUTH_ERROR),r}}),[n]),loginWithCode:ne((async({code:r})=>{try{if(t.enabled&&"error"===t.status)throw new i(t.error,null,he.CAPTCHA_FAILURE);let{user:a,isNewUser:o,wasAlreadyAuthenticated:n,linkedAccount:l}=await s(r);e?.onComplete?.({user:a,isNewUser:o,wasAlreadyAuthenticated:n,loginMethod:"email",loginAccount:l})}catch(r){throw a({status:"error",error:r}),e?.onError?.(r.privyErrorCode||he.UNKNOWN_AUTH_ERROR),r}}),[s,t.status]),state:r}},Qe=e=>{let t=o(),{initSignupWithPasskey:r,signupWithPasskey:a,passkeyAuthState:n,setPasskeyAuthState:s}=we();return{signupWithPasskey:ne((async()=>{try{let o;if(t.enabled&&"error"===t.status)throw new i(t.error,null,he.CAPTCHA_FAILURE);t.enabled&&"success"!==t.status&&(t.execute(),o=await t.waitForResult()),await r({captchaToken:o,withPrivyUi:!1});let{user:n,isNewUser:s,wasAlreadyAuthenticated:l,loginAccount:c}=await a();e?.onComplete?.({user:n,isNewUser:s,wasAlreadyAuthenticated:l,loginMethod:"passkey",loginAccount:c})}catch(t){throw s({status:"error",error:t}),e?.onError?.(t.privyErrorCode||he.UNKNOWN_AUTH_ERROR),t}}),[a,t.status]),state:n}},Xe=e=>{let t=o(),{initLoginWithPasskey:r,loginWithPasskey:a,passkeyAuthState:n,setPasskeyAuthState:s}=we();return{loginWithPasskey:ne((async o=>{try{let n;if(t.enabled&&"error"===t.status)throw new i(t.error,null,he.CAPTCHA_FAILURE);t.enabled&&"success"!==t.status&&(t.execute(),n=await t.waitForResult()),await r({captchaToken:n,withPrivyUi:!1});let{user:s,isNewUser:l,wasAlreadyAuthenticated:c,loginAccount:u}=await a(o);e?.onComplete?.({user:s,isNewUser:l,wasAlreadyAuthenticated:c,loginMethod:"passkey",loginAccount:u})}catch(o){throw s({status:"error",error:o}),e?.onError?.(o.privyErrorCode||he.UNKNOWN_AUTH_ERROR),o}}),[a,t.status]),state:n}},Je=e=>{let{initLinkWithPasskey:t,linkWithPasskey:r,passkeyAuthState:a,setPasskeyAuthState:o}=we();return{linkWithPasskey:ne((async()=>{try{await t();let a=await r();if(!a)throw Error("Error, user not found");let o=a.linkedAccounts.filter((e=>"passkey"===e.type)).sort(((e,t)=>t.latestVerifiedAt.getTime()-e.latestVerifiedAt.getTime()))[0];e?.onSuccess?.({user:a,linkMethod:"passkey",linkedAccount:o})}catch(t){throw o({status:"error",error:t}),e?.onError?.(t.privyErrorCode||he.UNKNOWN_AUTH_ERROR,{linkMethod:"passkey"}),t}}),[r]),state:a}},Ye=e=>{let t=o(),{smsOtpState:r,setSmsOtpState:a,initLoginWithSms:n,loginWithCode:s}=we();return{sendCode:ne((async({phoneNumber:r,disableSignup:o})=>{try{let e;if(!r)throw Error("SMS required to send OTP code");if(t.enabled&&"error"===t.status)throw new i(t.error,null,he.CAPTCHA_FAILURE);return t.enabled&&"success"!==t.status&&(t.execute(),e=await t.waitForResult()),await n({phoneNumber:r,captchaToken:e,disableSignup:o,withPrivyUi:!1})}catch(r){throw a({status:"error",error:r}),e?.onError?.(r.privyErrorCode||he.UNKNOWN_AUTH_ERROR),r}}),[n]),loginWithCode:ne((async({code:r})=>{try{if(t.enabled&&"success"!==t.status)throw new i(t.error,null,he.CAPTCHA_FAILURE);let{user:a,isNewUser:o,wasAlreadyAuthenticated:n,linkedAccount:l}=await s(r);e?.onComplete?.({user:a,isNewUser:o,wasAlreadyAuthenticated:n,loginMethod:"sms",loginAccount:l})}catch(r){throw a({status:"error",error:r}),e?.onError?.(r.privyErrorCode||he.UNKNOWN_AUTH_ERROR),r}}),[s,t.status]),state:r}},Ze=e=>{let{connectOrCreateWallet:t}=me();return r("connectOrCreateWallet",e),{connectOrCreateWallet:t}},et=e=>{let t=o(),{siweState:r,setSiweState:a,linkWithSiwe:n,generateSiweMessage:s}=we();return{generateSiweMessage:ne((async({address:t,chainId:r})=>{try{if(!t||!r)throw Error("wallet address and chainId required to generate nonce");return await s({address:t,chainId:r}).then((e=>e))}catch(t){throw a({status:"error",error:t}),e?.onError?.(t.privyErrorCode||he.UNKNOWN_AUTH_ERROR,{linkMethod:"siwe"}),t}}),[s]),linkWithSiwe:ne((async({signature:r,message:o,chainId:s,walletClientType:l,connectorType:c})=>{try{if(t.enabled&&"success"!==t.status)throw new i(t.error,null,he.CAPTCHA_FAILURE);let{user:a,linkedAccount:u}=await n({message:o,signature:r,chainId:s,walletClientType:l,connectorType:c});u&&e?.onSuccess?.({user:a,linkMethod:"siwe",linkedAccount:u})}catch(r){throw a({status:"error",error:r}),e?.onError?.(r.privyErrorCode||he.UNKNOWN_AUTH_ERROR,{linkMethod:"siwe"}),r}}),[n,t.status]),state:r}},tt=e=>{let t=o(),{siweState:r,setSiweState:a,client:n,generateSiweMessage:s,loginWithSiwe:l}=we();return{generateSiweNonce:ne((async r=>{try{let e;if(t.enabled&&"error"===t.status)throw new i(t.error,null,he.CAPTCHA_FAILURE);t.enabled&&"success"!==t.status&&(t.execute(),e=await t.waitForResult()),a({status:"generating-message"});let o=await n.generateSiweNonce({address:r?.address,captchaToken:e});return a({status:"awaiting-signature"}),o}catch(r){throw a({status:"error",error:r}),e?.onError?.(r.privyErrorCode||he.UNKNOWN_AUTH_ERROR),r}}),[n,t]),generateSiweMessage:ne((async({address:t,chainId:r})=>{try{return await s({address:t,chainId:r})}catch(t){throw a({status:"error",error:t}),e?.onError?.(t.privyErrorCode||he.UNKNOWN_AUTH_ERROR),t}}),[s]),loginWithSiwe:ne((async({message:r,signature:o,disableSignup:n})=>{try{let a;if(t.enabled&&"error"===t.status)throw new i(t.error,null,he.CAPTCHA_FAILURE);t.enabled&&"success"!==t.status&&(t.execute(),a=await t.waitForResult());let s=await l({message:r,signature:o,captchaToken:a,disableSignup:n});return e?.onComplete?.({user:s,isNewUser:!1,wasAlreadyAuthenticated:!1,loginMethod:"siwe",loginAccount:null}),s}catch(r){throw a({status:"error",error:r}),e?.onError?.(r.privyErrorCode||he.UNKNOWN_AUTH_ERROR),r}}),[l,t.status]),state:r}};function rt(){let{signTransaction:e}=le(ye);return{signTransaction:e}}function at(e){let{linkEmail:t,linkPhone:a,linkWallet:o,linkGoogle:n,linkApple:i,linkTwitter:s,linkDiscord:l,linkGithub:c,linkLinkedIn:u,linkTiktok:d,linkLine:h,linkSpotify:w,linkInstagram:p,linkTelegram:m,linkFarcaster:y,linkPasskey:g}=le(ye);return r("linkAccount",e),{linkEmail:t,linkPhone:a,linkWallet:o,linkGoogle:n,linkApple:i,linkTwitter:s,linkDiscord:l,linkGithub:c,linkLinkedIn:u,linkTiktok:d,linkLine:h,linkSpotify:w,linkInstagram:p,linkFarcaster:y,linkTelegram:m,linkPasskey:g}}function ot(e){let{updateEmail:t,updatePhone:a}=le(ye);return r("update",e),{updateEmail:t,updatePhone:a}}const nt=e=>{let{user:t}=me(),{loginWithCode:r,emailOtpState:a,setEmailOtpState:o,client:n,inProgressAuthFlowRef:i,inProgressLoginOrLinkMethodRef:s}=we();return{state:a,sendCode:ne((async({newEmailAddress:r})=>{try{if(!t?.email)throw Error("User is required to have an email address to update it.");let e=new d(t.email.address,r);n.startAuthFlow(e),await e.sendCodeEmail({withPrivyUi:!1})}catch(r){o({status:"error",error:r}),e?.onError?.(r.privyErrorCode||he.UNKNOWN_AUTH_ERROR,{linkMethod:"email"})}}),[t?.email]),verifyCode:ne((async({code:a})=>{try{if(!t?.email)throw Error("User is required to have an email address to update it.");i.current="update",s.current="email";let{user:o,linkedAccount:n}=await r(a);return e?.onSuccess?.({user:o,updateMethod:"email",updatedAccount:n}),{user:o}}catch(a){o({status:"error",error:a}),e?.onError?.(a.privyErrorCode||he.UNKNOWN_AUTH_ERROR,{linkMethod:"email"})}}),[t?.email])}},it=()=>{let{connectCoinbaseSmartWallet:e}=we();return{connectCoinbaseSmartWallet:e}},st=()=>{let{connectBaseAccount:e}=we();return{connectBaseAccount:e}},lt=()=>{let{baseAccountSdk:e}=we();return{baseAccountSdk:e}},ct=()=>{let{setModalData:e}=h(),{openModal:t,privy:r,closePrivyModal:a}=we(),{user:o}=me();return ie((()=>({verify:async({standalone:n=!0}={standalone:!0})=>new Promise(((i,s)=>o?0===o.mfaMethods.length?i():(e((e=>({...e,mfaVerify:{onSuccess:async()=>{n?await a({shouldCallAuthOnSuccess:!1,isSuccess:!0}):w.setState({inProgressMfaFlow:void 0}),i()},onFailure:async e=>{n?await a({shouldCallAuthOnSuccess:!1,isSuccess:!1}):w.setState({inProgressMfaFlow:void 0}),s(e)},sendSmsCode:async()=>{throw Error("Not enabled")},verifySmsCode:async()=>{throw Error("Not enabled")},verifyTotpCode:async e=>{await r.fetchPrivyRoute(Ce,{body:{code:e}})},generateOptions:async()=>p((await r.fetchPrivyRoute(Ee,{body:{}})).options),verifyPasskey:async e=>{let t=await import("@simplewebauthn/browser"),a=await t.startAuthentication(e);await r.fetchPrivyRoute(Se,{body:{authenticator_response:m(a)}})}}}))),void(n?t(y):w.setState({inProgressMfaFlow:"auth"}))):s(Error("Must be logged in to verify MFA"))))})),[r,e,t,a])},ut={component:()=>{let{user:e,ready:t}=me(),{app:r,data:a,onUserCloseViaDialogOrKeybindRef:o}=h(),[n,i]=ce(null),[s,l]=ce(null),[c,u]=ce(null),[d,w]=ce(!1),[p,m]=ce(!1),[y,g]=ce(),R=async()=>{y?b(y):e?await N({user:e}):b(Error("Must be logged in to manage MFA")),setTimeout((()=>{i(null),l(null)}),500)};if(o.current=R,!a?.mfaEnroll)throw Error("Missing modal data for MFA enrollment screen.");let{onFailure:b,onSuccess:N,mfaMethods:O,verify:_,generateTotpSecret:L,enrollTotp:D,unenrollTotp:H,enrollPasskey:x}=a.mfaEnroll,K=e?.mfaMethods.includes("sms"),q=e?.mfaMethods.includes("totp"),z=e?.mfaMethods.includes("passkey"),j=!!e?.phone,V=e?.linkedAccounts.filter((e=>"passkey"===e.type)).map((e=>e.credentialId))??[];function B(){i(null),l(null),g(void 0)}async function G(e=V){try{g(void 0),m(!0);let t=await x(e);return await N({user:t})}catch(e){g(e)}finally{m(!1),w(!1)}}if(!t||!e||!r)/*#__PURE__*/return Re(Pe,{children:[/*#__PURE__*/be(f,{onClose:R},"header"),/*#__PURE__*/be(A,{children:/*#__PURE__*/be(k,{})}),/*#__PURE__*/be(v,{children:/*#__PURE__*/be(C,{})}),/*#__PURE__*/be(E,{})]});if("sms"===n)return null;if("totp"===n)/*#__PURE__*/return Re(Pe,{children:[/*#__PURE__*/be(f,{backFn:B,onClose:R},"header"),/*#__PURE__*/be(S,{style:{marginBottom:"1.5rem"},children:/*#__PURE__*/be(Me,{})}),/*#__PURE__*/be(T,{children:"Remove authenticator app verification?"}),/*#__PURE__*/Re(U,{children:["MFA adds an extra layer of security to your ",r?.name," account. Make sure you have other methods to secure your account."]}),/*#__PURE__*/be(I,{children:/*#__PURE__*/be(W,{$warn:!0,onClick:async function(){try{g(void 0),m(!0);let e=await H();return await N({user:e})}catch(e){g(e)}finally{m(!1),i(null)}},loading:p,children:"Remove"})}),/*#__PURE__*/be(E,{})]});if("passkey"===n){let e=a.mfaEnroll.shouldUnlinkOnUnenrollMfa??!0;/*#__PURE__*/return Re(Pe,{children:[/*#__PURE__*/be(f,{backFn:B,onClose:R},"header"),/*#__PURE__*/be(S,{style:{marginBottom:"1.5rem"},children:/*#__PURE__*/be(Me,{})}),/*#__PURE__*/be(T,{children:"Are you sure you want to remove this passkey?"}),/*#__PURE__*/be(U,{children:e?"Removing your passkey will remove as both a verification method and a login method.":"Removing your passkey will remove as a verification method."}),/*#__PURE__*/be(I,{children:/*#__PURE__*/be(W,{$warn:!0,onClick:async function(){try{g(void 0),m(!0);let e=await x([]);return await N({user:e})}catch(e){g(e)}finally{m(!1),i(null)}},loading:p,children:"Remove"})}),/*#__PURE__*/be(E,{})]})}return 0!==O.length||K||q||z?"sms"===s?null:"totp"===s&&c?/*#__PURE__*/be(P,{onClose:R,onReset:B,submitEnrollmentWithTotp:e=>async function(e){try{g(void 0),m(!0);let t=await D(e);return await N({user:t})}catch(e){g(e)}finally{m(!1),i(null)}}(e.mfaCode),error:y,totpInfo:{...c,appName:r?.name||"Privy"}}):"passkey"===s?/*#__PURE__*/be(M,{onReset:B,onClose:R,submitEnrollmentWithPasskey:G}):/*#__PURE__*/be(F,{showIntro:!1,userMfaMethods:e.mfaMethods,appMfaMethods:r.mfa.methods,userHasAuthSms:j,onBackToIntro:()=>{},handleSelectMethod:async function(e){g(void 0);try{await _()}catch(e){return void g(e)}return"totp"===e?(l(e),u(null),void L().then((({totpSecret:e,totpAuthUrl:t})=>{u({authUrl:t,secret:e})})).catch((()=>{u(null),B()}))):"passkey"===e&&1===V.length?await G():void l(e)},isTotpLoading:"totp"===s&&!c,isPasskeyLoading:d,error:y,onClose:R,setRemovingMfaMethod:async function(e){g(void 0);try{await _()}catch(e){return void g(e)}i(e)}}):/*#__PURE__*/Re(Pe,{children:[/*#__PURE__*/be(f,{onClose:R},"header"),/*#__PURE__*/be(S,{style:{marginBottom:"1.5rem"},children:/*#__PURE__*/be(Ne,{})}),/*#__PURE__*/be(T,{children:"Add more security"}),/*#__PURE__*/Re(U,{children:[r?.name," does not have any verification methods enabled."]}),/*#__PURE__*/be(I,{children:/*#__PURE__*/be(W,{onClick:R,children:"Close"})}),/*#__PURE__*/be(E,{})]})}},dt=()=>{let e=L(),{setModalData:t}=h(),{verify:r}=ct(),{openModal:a,privy:o,closePrivyModal:n,refreshSessionAndUser:i,setUser:s}=we();return ie((()=>({enroll:async()=>new Promise(((l,c)=>{t({mfaEnroll:{onSuccess:async e=>{await n({shouldCallAuthOnSuccess:!1,isSuccess:!0}),l(e)},onFailure:async e=>{await n({shouldCallAuthOnSuccess:!1,isSuccess:!1}),c(e)},verify:()=>r({standalone:!1}),shouldUnlinkOnUnenrollMfa:!0,mfaMethods:e.mfa.methods,sendSmsCode:async()=>{throw Error("Not enabled")},enrollSms:async()=>{throw Error("Not enabled")},unenrollSms:async()=>{throw Error("Not enabled")},generateTotpSecret:async()=>await o.fetchPrivyRoute(Te,{body:{}}),enrollTotp:async e=>{await o.fetchPrivyRoute(Ue,{body:{code:e}});let t=await i();return s(t),t},unenrollTotp:async()=>{await o.fetchPrivyRoute(Ie,{body:{}});let e=await i();return s(e),e},enrollPasskey:async e=>{await o.fetchPrivyRoute(We,{body:{credential_ids:e,remove_for_login:!0}});let t=await i();return s(t),t}}}),a(ut)}))})),[o,t,a,n])},ht=()=>{let{startCrossAppAuthFlow:e,unlinkCrossAppAccount:t,signMessageWithCrossAppWallet:r,signTypedDataWithCrossAppWallet:a,sendTransactionWithCrossAppWallet:o}=me();return{loginWithCrossAppAccount:({appId:t})=>e({appId:t,action:"login"}),linkCrossAppAccount:({appId:t})=>e({appId:t,action:"link"}),unlinkCrossAppAccount:t,signMessage:r,signTypedData:a,sendTransaction:o}};function wt(e){let{sendTransaction:t}=le(ye);return r("sendTransaction",e),{sendTransaction:t}}function pt(e){let{setWalletPassword:t}=le(ye);return r("setWalletPassword",e),{setWalletPassword:t}}function mt(){let e=L(),{getAccessToken:t}=me(),r=D(),{client:a,setUser:o,setAuthenticated:n,setIsNewUser:i,initializeWalletProxy:s}=we(),{create:l}=H();return{createGuestAccount:async()=>{if(!e.id||!a)throw Error("SDK not yet ready");a.startAuthFlow(new x(e.id));try{let c=await a.authenticate(),u=c.user,d=c.isNewUser??!1;if(!u)throw new de("Unable to authenticate guest account");let h=await t(),w=await s(q);if(h&&w)try{let t=z(u,e.embeddedWallets.ethereum.createOnLogin),r=j(u,e.embeddedWallets.solana.createOnLogin);t&&r?(u=(await l({chainType:"ethereum",latestUser:u})).user,u=(await l({chainType:"solana",latestUser:u})).user):r?u=(await l({chainType:"solana",latestUser:u})).user:t?u=(await l({chainType:"ethereum",latestUser:u})).user:o(u)}catch(e){o(u),console.warn("Unable to create embedded wallet for guest account")}return i(d),n(!0),r("login","onComplete",{user:u,isNewUser:d,wasAlreadyAuthenticated:!1,loginMethod:"guest",loginAccount:null}),u}catch(e){throw r("login","onError",e.privyErrorCode||he.UNKNOWN_AUTH_ERROR),e}}}}function yt(e){let{setWalletRecovery:t}=le(ye);return r("setWalletRecovery",e),{setWalletRecovery:t}}function gt(e){let{signMessage:t}=le(ye);return r("signMessage",e),{signMessage:t}}const ft=()=>{let{ready:e,wallets:t}=B(),{user:r}=me(),{rpcConfig:a,chains:o,appId:n}=we();return{signAuthorization:ne((async(i,s)=>{let l;if(!r)throw Error("User must be authenticated before signing with a Privy wallet");if(!e)throw Error("Wallets are not ready");let c=s?.address??ge(r)?.address??Oe,u=t.find((e=>_e(e.address)===_e(c)));if(!u)throw Error("Signing wallet not found.");let d=i.chainId??Number(u.chainId.split(":")[1]);if(0===d)l={chainId:0,address:i.contractAddress,nonce:i.nonce??0};else{let e=o.find((e=>e.id===d));if(!e)throw Error("Error, chain not configured in PrivyProvider config");let t=Fe({account:c,chain:e,transport:Le(G(e,a,n))});l=await t.prepareAuthorization({...i})}let h=await u.getEthereumProvider(),w=await h.request({method:"secp256k1_sign",params:[He(l)]});return{...l,...De(w)}}),[e,t,r,o])}},At=ft;function kt(e){let{signTypedData:t}=le(ye);return r("signTypedData",e),{signTypedData:t}}const vt=()=>{let{isModalOpen:e}=le(ye);return{isOpen:e}};function Ct(e){let{getAccessToken:t}=le(ye);return r("accessToken",e),{getAccessToken:t}}function Et(e){let{authenticated:t,user:a}=me(),{initLoginWithOAuth:o}=we(),n=D();return r("oAuthAuthorization",e),{reauthorize:e=>St(t,a,o,n,e.provider)}}let St=async(e,t,r,a,o)=>{if(!e)throw a("linkAccount","onError",he.MUST_BE_AUTHENTICATED,{linkMethod:o}),new de("User must be authenticated before linking an account.");if(!t?.linkedAccounts.some((e=>e.type.includes(o))))throw new de(`OAuth account of type ${o} not linked to the account.`);await r(o)};function Tt(e){let{client:t}=we(),[r,a]=ce({status:"initial"});return{linkWithCustomJwt:ne((async r=>{try{a({status:"initial"}),t.startAuthFlow(new J(r)),a({status:"loading"});let{user:o}=await t.link();if(!o)throw Error("Error, user not found");let n=o.linkedAccounts.filter((e=>"custom_auth"===e.type)).sort(((e,t)=>t.latestVerifiedAt.getTime()-e.latestVerifiedAt.getTime())).at(0);return a({status:"done"}),e?.onSuccess?.({user:o,linkMethod:"custom",linkedAccount:n}),{user:o}}catch(r){throw a({status:"error",error:r}),e?.onError?.(r.privyErrorCode||he.UNKNOWN_AUTH_ERROR,{linkMethod:"custom"}),r}}),[t.startAuthFlow,t.link]),state:r}}const Ut=e=>{let t=ee();return r("customAuth",e),{status:t}};function It({isAuthenticated:e,isLoading:t,...r}){let a=ue();se((()=>{t||a.current?.()}),[e,t]);let o=ne((e=>(a.current=e,()=>{a.current=void 0})),[]);return te({...r,subscribe:o})}function Wt(){let{getFarcasterSignerPublicKey:e,signFarcasterMessage:t,requestFarcasterSignerFromWarpcast:r}=me();return{getFarcasterSignerPublicKey:e,signFarcasterMessage:t,requestFarcasterSignerFromWarpcast:r}}const Rt=()=>{let{revokeDelegatedWallets:e,delegateWallet:t}=we();return{delegateWallet:async({address:e,chainType:r})=>await t({address:e,chainType:r,showDelegationUIs:!0}),revokeWallets:async()=>await e({showDelegationUIs:!0})}},Pt=()=>{let{addSessionSignersInternal:e,removeSessionSignersInternal:t}=(()=>{let{getAccessToken:e,user:t}=me(),r=we(),{signWithUserSigner:a}=fe(),o=async({wallet:o,additional_signers:n})=>{let i=await e();if(!t||!i)throw new de("User must be authenticated and have an embedded wallet to delegate actions.");if(!o.id)throw new de("Wallet to add signers to must have ID on server");if(!r.walletProxy)throw new de("Wallet proxy not initialized.");await Ke(r.privy,{wallet_id:o.id},a,{additional_signers:n})};return{addSessionSignersInternal:async({address:a,signers:n})=>{let i=await e();if(!t||!i)throw new de("User must be authenticated and have an embedded wallet to add a session signer.");let s=r.walletProxy??await r.initializeWalletProxy(15e3);if(!s)throw new de("Wallet proxy not initialized.");let l=Ae(t,a);if(!l)throw new de("Address to add signers too is not associated with current user.");if(ke(l)){if(0===n.length)throw new de("Must specify at least one signer to add.");let e=[...(await xe(r.privy,{wallet_id:l.id})).additional_signers,...re(n)];await o({wallet:l,additional_signers:e})}else{if(l.delegated)return{user:t};if(n.length>0)throw new de("Specifying signers in addSessionSigners is only supported for TEE execution and this app uses On-device execution. Pass an empty array for signers instead. Learn more https://docs.privy.io/recipes/tee-wallet-migration-guide");let e=ae({address:a,user:t}),o=oe({address:a,user:t});await r.recoverEmbeddedWallet({address:a}),await s.createDelegatedAction({accessToken:i,rootWallet:o,delegatedWallets:[e]})}let c=await r.refreshSessionAndUser();if(!c)throw Error("Could not refresh user");return{user:c}},removeSessionSignersInternal:async({address:a})=>{let n=await e();if(!t||!n)throw new de("User must be authenticated and have an embedded wallet to delegate actions.");if(!(r.walletProxy??await r.initializeWalletProxy(15e3)))throw new de("Wallet proxy not initialized.");let i=Ae(t,a);if(!i)throw new de("Address to remove signers from is not associated with current user.");ke(i)?await o({wallet:i,additional_signers:[]}):await r.client.revokeDelegatedWallet();let s=await r.refreshSessionAndUser();if(!s)throw Error("Could not refresh user");return{user:s}}}})();return{addSessionSigners:async({address:t,signers:r})=>e({address:t,signers:r}),removeSessionSigners:async({address:e})=>t({address:e})}},bt=()=>{let{signWithUserSigner:e}=fe();return ie((()=>({async generateAuthorizationSignature(t){let{signature:r}=await qe(e,t);return{signature:r}}})),[e])},Mt=()=>{let{setUser:e,client:t}=le(pe),{user:r}=le(ye);return{user:r,refreshUser:ne((async()=>{let r=await(t?.updateUserAndIdToken());return e(r??null),r}),[t,e])}},Nt=e=>{let t=o(),{initLoginWithTelegram:r,loginWithTelegram:a,telegramAuthState:n,setTelegramAuthState:s}=we();return{login:ne((async o=>{try{if(t.enabled&&"success"!==t.status)throw new i(t.error,null,he.CAPTCHA_FAILURE);await r(t.token,o?.disableSignup);let{user:n,isNewUser:s,loginAccount:l,wasAlreadyAuthenticated:c}=await a({intent:"login"});e?.onComplete?.({user:n,isNewUser:s,wasAlreadyAuthenticated:c,loginMethod:"telegram",loginAccount:l})}catch(o){throw s({status:"error",error:o}),e?.onError?.(o.privyErrorCode||he.UNKNOWN_AUTH_ERROR),o}}),[r,a,t]),state:n}},Ot=()=>{let{revokeDelegatedWallets:e,delegateWallet:t}=we();return{delegateWallet:async({address:e,chainType:r})=>await t({address:e,chainType:r,showDelegationUIs:!1}),revokeWallets:async()=>await e({showDelegationUIs:!1})}},_t=async({wallet:e})=>{let t=await e.getEthereumProvider();return je({address:e.address,sign:async({hash:r})=>{if("privy"!==e.walletClientType)throw new ze({error:"Unprefixed signing is not supported by external wallets.",code:"unsupported_wallet_type"});return await t.request({method:"secp256k1_sign",params:[r]})},signMessage:async({message:r})=>await t.request({method:"personal_sign",params:[r,e.address]}),signTypedData:async r=>await t.request({method:"eth_signTypedData_v4",params:[e.address,r]}),signTransaction:async e=>await t.request({method:"eth_signTransaction",params:[e]})})};export{_t as toViemAccount,ct as useAuthMfa,dt as useAuthMfaEnrollment,bt as useAuthorizationSignature,lt as useBaseAccountSdk,st as useConnectBaseAccount,it as useConnectCoinbaseSmartWallet,Ze as useConnectOrCreateWallet,ht as useCrossAppAccounts,Ut as useCustomAuth,Rt as useDelegatedActions,Wt as useFarcasterSigner,mt as useGuestAccounts,Ot as useHeadlessDelegatedActions,at as useLinkAccount,Tt as useLinkJwtAccount,Je as useLinkWithPasskey,et as useLinkWithSiwe,$e as useLoginWithEmail,Be as useLoginWithFarcasterV2,Ge as useLoginWithOAuth,Xe as useLoginWithPasskey,tt as useLoginWithSiwe,Ye as useLoginWithSms,Nt as useLoginWithTelegram,vt as useModalStatus,Et as useOAuthTokens,Ve as useRecoverEmbeddedWallet,wt as useSendTransaction,Pt as useSessionSigners,pt as useSetWalletPassword,yt as useSetWalletRecovery,ft as useSign7702Authorization,At as useSignAuthorization,gt as useSignMessage,rt as useSignTransaction,kt as useSignTypedData,Qe as useSignupWithPasskey,It as useSubscribeToJwtAuthWithFlag,te as useSyncJwtBasedAuthState,Ct as useToken,ot as useUpdateAccount,nt as useUpdateEmail,Mt as useUser,B as useWallets};
@@ -1 +1 @@
1
- import{createContext as t,useContext as e}from"react";const i=()=>{throw Error("You need to wrap your application with the <PrivyProvider> initialized with your app id.")},a=t=>()=>{throw Error(t.trim())},n=/*#__PURE__*/t({setAuthenticated:i,setUser:i,setIsNewUser:i,isNewUserThisSession:!1,walletConnectionStatus:null,setWalletConnectionStatus:i,connectors:[],solanaWallets:[],rpcConfig:{rpcUrls:{}},showFiatPrices:!0,chains:[],clientAnalyticsId:null,pendingTransaction:null,client:null,privy:null,appId:"notAdded",onCustomAuthAuthenticated:i,hideWalletUIs:{current:!1},nativeTokenSymbolForChainId:i,initializeWalletProxy:i,getAuthMeta:i,getAuthFlow:i,closePrivyModal:i,openPrivyModal:i,connectWallet:i,initLoginWithWallet:i,loginWithWallet:i,initLoginWithFarcaster:i,loginWithFarcaster:i,loginWithCode:i,initLoginWithEmail:i,initLoginWithSms:i,initUpdateEmail:i,initUpdatePhone:i,resendEmailCode:i,resendSmsCode:i,initLoginWithHeadlessOAuth:i,loginWithHeadlessOAuth:i,crossAppAuthFlow:i,initLoginWithOAuth:i,loginWithOAuth:i,passkeyAuthState:{status:"initial"},setPasskeyAuthState:i,initSignupWithPasskey:i,signupWithPasskey:i,initLoginWithPasskey:i,loginWithPasskey:i,initLinkWithPasskey:i,linkWithPasskey:i,refreshSessionAndUser:i,walletProxy:null,createAnalyticsEvent:i,acceptTerms:i,getUsdTokenPrice:i,getUsdPriceForSol:i,getSplTokenMetadata:i,recoverEmbeddedWallet:i,updateWallets:i,fundWallet:i,openModal:i,setReadyToTrue:i,requestFarcasterSignerStatus:i,initLoginWithTelegram:i,loginWithTelegram:i,generateSiweMessage:i,generateSiweMessageForSmartWallet:i,loginWithSiwe:i,linkWithSiwe:i,linkSmartWallet:i,delegateWallet:i,revokeDelegatedWallets:i,exportSolanaWallet:i,connectCoinbaseSmartWallet:i,initiateAccountTransfer:i,emailOtpState:{status:"initial"},setEmailOtpState:i,smsOtpState:{status:"initial"},setSmsOtpState:i,siweState:{status:"initial"},setSiweState:i,oAuthState:{status:"initial"},setOAuthState:i,telegramAuthState:{status:"initial"},setTelegramAuthState:i,isHeadlessOAuthLoading:!1,isHeadlessSigning:i,inProgressAuthFlowRef:{current:null},inProgressLoginOrLinkMethodRef:{current:null}}),s=()=>e(n);export{n as I,i as a,a as n,s as u};
1
+ import{createContext as t,useContext as e}from"react";const i=()=>{throw Error("You need to wrap your application with the <PrivyProvider> initialized with your app id.")},a=t=>()=>{throw Error(t.trim())},n=/*#__PURE__*/t({setAuthenticated:i,setUser:i,setIsNewUser:i,isNewUserThisSession:!1,walletConnectionStatus:null,setWalletConnectionStatus:i,connectors:[],solanaWallets:[],rpcConfig:{rpcUrls:{}},showFiatPrices:!0,chains:[],clientAnalyticsId:null,pendingTransaction:null,client:null,privy:null,appId:"notAdded",onCustomAuthAuthenticated:i,hideWalletUIs:{current:!1},nativeTokenSymbolForChainId:i,initializeWalletProxy:i,getAuthMeta:i,getAuthFlow:i,closePrivyModal:i,openPrivyModal:i,connectWallet:i,initLoginWithWallet:i,loginWithWallet:i,initLoginWithFarcaster:i,loginWithFarcaster:i,loginWithCode:i,initLoginWithEmail:i,initLoginWithSms:i,initUpdateEmail:i,initUpdatePhone:i,resendEmailCode:i,resendSmsCode:i,initLoginWithHeadlessOAuth:i,loginWithHeadlessOAuth:i,crossAppAuthFlow:i,initLoginWithOAuth:i,loginWithOAuth:i,passkeyAuthState:{status:"initial"},setPasskeyAuthState:i,initSignupWithPasskey:i,signupWithPasskey:i,initLoginWithPasskey:i,loginWithPasskey:i,initLinkWithPasskey:i,linkWithPasskey:i,refreshSessionAndUser:i,walletProxy:null,createAnalyticsEvent:i,acceptTerms:i,getUsdTokenPrice:i,getUsdPriceForSol:i,getSplTokenMetadata:i,recoverEmbeddedWallet:i,updateWallets:i,fundWallet:i,openModal:i,setReadyToTrue:i,requestFarcasterSignerStatus:i,initLoginWithTelegram:i,loginWithTelegram:i,generateSiweMessage:i,generateSiweMessageForSmartWallet:i,loginWithSiwe:i,linkWithSiwe:i,linkSmartWallet:i,delegateWallet:i,revokeDelegatedWallets:i,exportSolanaWallet:i,connectCoinbaseSmartWallet:i,connectBaseAccount:i,initiateAccountTransfer:i,emailOtpState:{status:"initial"},setEmailOtpState:i,smsOtpState:{status:"initial"},setSmsOtpState:i,siweState:{status:"initial"},setSiweState:i,oAuthState:{status:"initial"},setOAuthState:i,telegramAuthState:{status:"initial"},setTelegramAuthState:i,isHeadlessOAuthLoading:!1,isHeadlessSigning:i,inProgressAuthFlowRef:{current:null},inProgressLoginOrLinkMethodRef:{current:null},baseAccountSdk:void 0,setBaseAccountSdk:i}),s=()=>e(n);export{n as I,i as a,a as n,s as u};
@@ -1 +1 @@
1
- import{FetchError as a}from"ofetch";var s;class e extends Error{toString(){return`${this.type}${this.privyErrorCode?`-${this.privyErrorCode}`:""}: ${this.message}${this.cause?` [cause: ${this.cause}]`:""}`}constructor(a,s,e){super(a),s instanceof Error&&(this.cause=s),this.privyErrorCode=e}}class t extends e{constructor(a,s,e,t,_,i){super(e,t,_),this.type=a,this.status=s,this.data=i}}class _ extends e{constructor(a,s,e){super(a,s,e),this.type="client_error"}}class i extends _{constructor(){super("Request timed out",void 0,"client_request_timeout")}}class r extends e{constructor(a,s,e){super(a,s,e),this.type="connector_error"}}const n=s=>{if(s instanceof e)return s;if(!(s instanceof a))return o(s);if(!s.response)return new t("api_error",null,s.message,s);let{type:_,message:i,error:r,code:n}=s.data;return new t(_||"ApiError",s.response.status,i||r,s,n,s.data)},o=a=>a instanceof e?a:a instanceof Error?new _(a.message,a):new _(`Internal error: ${a}`);var p=((s={}).OAUTH_ACCOUNT_SUSPENDED="oauth_account_suspended",s.MISSING_OR_INVALID_PRIVY_APP_ID="missing_or_invalid_privy_app_id",s.MISSING_OR_INVALID_PRIVY_ACCOUNT_ID="missing_or_invalid_privy_account_id",s.MISSING_OR_INVALID_TOKEN="missing_or_invalid_token",s.INVALID_DATA="invalid_data",s.INVALID_CAPTCHA="invalid_captcha",s.LINKED_TO_ANOTHER_USER="linked_to_another_user",s.CANNOT_LINK_MORE_OF_TYPE="cannot_link_more_of_type",s.FAILED_TO_LINK_ACCOUNT="failed_to_link_account",s.FAILED_TO_UPDATE_ACCOUNT="failed_to_update_account",s.USER_EXITED_UPDATE_FLOW="exited_update_flow",s.ALLOWLIST_REJECTED="allowlist_rejected",s.OAUTH_USER_DENIED="oauth_user_denied",s.OAUTH_UNEXPECTED="oauth_unexpected",s.UNKNOWN_AUTH_ERROR="unknown_auth_error",s.USER_EXITED_AUTH_FLOW="exited_auth_flow",s.USER_EXITED_LINK_FLOW="exited_link_flow",s.USER_EXITED_SET_PASSWORD_FLOW="user_exited_set_password_flow",s.MUST_BE_AUTHENTICATED="must_be_authenticated",s.UNKNOWN_CONNECT_WALLET_ERROR="unknown_connect_wallet_error",s.GENERIC_CONNECT_WALLET_ERROR="generic_connect_wallet_error",s.CLIENT_REQUEST_TIMEOUT="client_request_timeout",s.INVALID_CREDENTIALS="invalid_credentials",s.MISSING_MFA_CREDENTIALS="missing_or_invalid_mfa",s.UNKNOWN_MFA_ERROR="unknown_mfa_error",s.EMBEDDED_WALLET_ALREADY_EXISTS="embedded_wallet_already_exists",s.EMBEDDED_WALLET_NOT_FOUND="embedded_wallet_not_found",s.EMBEDDED_WALLET_CREATE_ERROR="embedded_wallet_create_error",s.UNKNOWN_EMBEDDED_WALLET_ERROR="unknown_embedded_wallet_error",s.EMBEDDED_WALLET_PASSWORD_UNCONFIRMED="embedded_wallet_password_unconfirmed",s.EMBEDDED_WALLET_PASSWORD_ALREADY_EXISTS="embedded_wallet_password_already_exists",s.EMBEDDED_WALLET_RECOVERY_ALREADY_EXISTS="embedded_wallet_recovery_already_exists",s.TRANSACTION_FAILURE="transaction_failure",s.UNSUPPORTED_CHAIN_ID="unsupported_chain_id",s.NOT_SUPPORTED="not_supported",s.CAPTCHA_TIMEOUT="captcha_timeout",s.INVALID_MESSAGE="invalid_message",s.UNABLE_TO_SIGN="unable_to_sign",s.CAPTCHA_FAILURE="captcha_failure",s.CAPTCHA_DISABLED="captcha_disabled",s.SESSION_STORAGE_UNAVAILABLE="session_storage_unavailable",s.TOO_MANY_REQUESTS="too_many_requests",s.USER_LIMIT_REACHED="max_accounts_reached",s.DISALLOWED_LOGIN_METHOD="disallowed_login_method",s.DISALLOWED_PLUS_EMAIL="disallowed_plus_email",s.PASSKEY_NOT_ALLOWED="passkey_not_allowed",s.USER_DOES_NOT_EXIST="user_does_not_exist",s.INSUFFICIENT_BALANCE="insufficient_balance",s.ACCOUNT_TRANSFER_REQUIRED="account_transfer_required",s.BUFFER_NOT_DEFINED="buffer_not_defined",s.UNSUPPORTED_WALLET_TYPE="unsupported_wallet_type",s);class E extends _{constructor(){super("Method called before `ready`. Ensure you wait until `ready` is true before calling.")}}class u extends _{constructor(a="Embedded wallet error",s){super(a,s,"unknown_embedded_wallet_error")}}class l extends _{constructor(a="User must be authenticated"){super(a,void 0,"must_be_authenticated")}}class c extends _{constructor(a){super("This application is in development mode and must be upgraded to production to log in new users.",a,"max_accounts_reached")}}const d="/api/v1/sessions",v="/api/v1/sessions/logout",A="/api/v1/siwe/init",T="/api/v1/siwe/authenticate",D="/api/v1/siwe/link",N="/api/v1/siwe/link_smart_wallet",I="/api/v1/siwe/unlink",O="/api/v1/siwe/transfer",L="/api/v1/siws/init",R="/api/v1/siws/authenticate",m="/api/v1/siws/link",w="/api/v1/siws/unlink",S="/api/v1/farcaster/init",h="/api/v1/farcaster/authenticate",f="/api/v1/farcaster/link",U="/api/v1/farcaster/status",C="/api/v1/farcaster/unlink",k="/api/v1/farcaster/transfer",y="api/v2/farcaster/init",g="api/v2/farcaster/authenticate",P="/api/v1/passwordless/init",W="/api/v1/passwordless/authenticate",M="/api/v1/passwordless/link",b="/api/v1/passwordless/unlink",x="/api/v1/passwordless/update",F="/api/v1/passwordless/transfer",H="/api/v1/passwordless_sms/init",B="/api/v1/passwordless_sms/link",V="/api/v1/passwordless_sms/unlink",K="/api/v1/passwordless_sms/authenticate",Y="/api/v1/passwordless_sms/update",G="/api/v1/passwordless_sms/transfer",X="/api/v1/oauth/init",$="/api/v1/oauth/authenticate",q="/api/v1/oauth/link",j="/api/v1/oauth/unlink",Q="/api/v1/oauth/transfer",J="/api/v1/recovery/oauth/init",z="/api/v1/recovery/oauth/init_icloud",Z="/api/v1/recovery/oauth/authenticate",aa="/api/v1/passkeys/link/init",sa="/api/v1/passkeys/authenticate/init",ea="/api/v1/passkeys/register/init",ta="/api/v1/passkeys/link",_a="/api/v1/passkeys/authenticate",ia="/api/v1/passkeys/register",ra="/api/v1/telegram/authenticate",na="/api/v1/telegram/link",oa="/api/v1/telegram/unlink",pa="/api/v1/telegram/transfer",Ea="/api/v1/mfa/passwordless_sms/init",ua="/api/v1/mfa/passkeys/init",la="/api/v1/users/me/accept_terms",ca="/api/v1/analytics_events",da="/api/v1/custom_jwt_account/authenticate",va="/api/v1/custom_jwt_account/link",Aa="/api/v1/guest/authenticate",Ta="/api/v1/plugins/moonpay_on_ramp/sign",Da="/api/v1/funding/coinbase_on_ramp/init",Na="/api/v1/funding/coinbase_on_ramp/status",Ia="/api/v1/wallets/revoke",Oa="/api/v1/users/me",La="/api/v1/scan/transaction";export{D as $,na as A,i as B,d as C,v as D,ca as E,da as F,va as G,Aa as H,o as I,t as J,Ea as K,ua as L,la as M,b as N,V as O,_ as P,I as Q,w as R,j as S,C as T,oa as U,Ia as V,Ta as W,Da as X,Na as Y,A as Z,T as _,p as a,N as a0,L as a1,R as a2,Q as a3,pa as a4,k as a5,O as a6,G as a7,F as a8,m as a9,Oa as aa,La as ab,Z as ac,z as ad,J as ae,u as af,c as ag,l as ah,E as ai,y as aj,g as ak,M as b,P as c,h as d,f as e,n as f,S as g,U as h,q as i,X as j,ia as k,_a as l,ta as m,ea as n,$ as o,W as p,sa as q,aa as r,K as s,B as t,x as u,H as v,Y as w,r as x,e as y,ra as z};
1
+ import{FetchError as a}from"ofetch";var s;class e extends Error{toString(){return`${this.type}${this.privyErrorCode?`-${this.privyErrorCode}`:""}: ${this.message}${this.cause?` [cause: ${this.cause}]`:""}`}constructor(a,s,e){super(a),s instanceof Error&&(this.cause=s),this.privyErrorCode=e}}class t extends e{constructor(a,s,e,t,_,i){super(e,t,_),this.type=a,this.status=s,this.data=i}}class _ extends e{constructor(a,s,e){super(a,s,e),this.type="client_error"}}class i extends _{constructor(){super("Request timed out",void 0,"client_request_timeout")}}class r extends e{constructor(a,s,e){super(a,s,e),this.type="connector_error"}}const n=s=>{if(s instanceof e)return s;if(!(s instanceof a))return o(s);if(!s.response)return new t("api_error",null,s.message,s);let{type:_,message:i,error:r,code:n}=s.data;return new t(_||"ApiError",s.response.status,i||r,s,n,s.data)},o=a=>a instanceof e?a:a instanceof Error?new _(a.message,a):new _(`Internal error: ${a}`);var p=((s={}).OAUTH_ACCOUNT_SUSPENDED="oauth_account_suspended",s.MISSING_OR_INVALID_PRIVY_APP_ID="missing_or_invalid_privy_app_id",s.MISSING_OR_INVALID_PRIVY_ACCOUNT_ID="missing_or_invalid_privy_account_id",s.MISSING_OR_INVALID_TOKEN="missing_or_invalid_token",s.INVALID_DATA="invalid_data",s.INVALID_CAPTCHA="invalid_captcha",s.LINKED_TO_ANOTHER_USER="linked_to_another_user",s.CANNOT_LINK_MORE_OF_TYPE="cannot_link_more_of_type",s.FAILED_TO_LINK_ACCOUNT="failed_to_link_account",s.FAILED_TO_UPDATE_ACCOUNT="failed_to_update_account",s.USER_EXITED_UPDATE_FLOW="exited_update_flow",s.ALLOWLIST_REJECTED="allowlist_rejected",s.OAUTH_USER_DENIED="oauth_user_denied",s.OAUTH_UNEXPECTED="oauth_unexpected",s.UNKNOWN_AUTH_ERROR="unknown_auth_error",s.USER_EXITED_AUTH_FLOW="exited_auth_flow",s.USER_EXITED_LINK_FLOW="exited_link_flow",s.USER_EXITED_SET_PASSWORD_FLOW="user_exited_set_password_flow",s.MUST_BE_AUTHENTICATED="must_be_authenticated",s.UNKNOWN_CONNECT_WALLET_ERROR="unknown_connect_wallet_error",s.GENERIC_CONNECT_WALLET_ERROR="generic_connect_wallet_error",s.CLIENT_REQUEST_TIMEOUT="client_request_timeout",s.INVALID_CREDENTIALS="invalid_credentials",s.MISSING_MFA_CREDENTIALS="missing_or_invalid_mfa",s.UNKNOWN_MFA_ERROR="unknown_mfa_error",s.EMBEDDED_WALLET_ALREADY_EXISTS="embedded_wallet_already_exists",s.EMBEDDED_WALLET_NOT_FOUND="embedded_wallet_not_found",s.EMBEDDED_WALLET_CREATE_ERROR="embedded_wallet_create_error",s.UNKNOWN_EMBEDDED_WALLET_ERROR="unknown_embedded_wallet_error",s.EMBEDDED_WALLET_PASSWORD_UNCONFIRMED="embedded_wallet_password_unconfirmed",s.EMBEDDED_WALLET_PASSWORD_ALREADY_EXISTS="embedded_wallet_password_already_exists",s.EMBEDDED_WALLET_RECOVERY_ALREADY_EXISTS="embedded_wallet_recovery_already_exists",s.TRANSACTION_FAILURE="transaction_failure",s.UNSUPPORTED_CHAIN_ID="unsupported_chain_id",s.NOT_SUPPORTED="not_supported",s.CAPTCHA_TIMEOUT="captcha_timeout",s.INVALID_MESSAGE="invalid_message",s.UNABLE_TO_SIGN="unable_to_sign",s.CAPTCHA_FAILURE="captcha_failure",s.CAPTCHA_DISABLED="captcha_disabled",s.SESSION_STORAGE_UNAVAILABLE="session_storage_unavailable",s.TOO_MANY_REQUESTS="too_many_requests",s.USER_LIMIT_REACHED="max_accounts_reached",s.DISALLOWED_LOGIN_METHOD="disallowed_login_method",s.DISALLOWED_PLUS_EMAIL="disallowed_plus_email",s.PASSKEY_NOT_ALLOWED="passkey_not_allowed",s.USER_DOES_NOT_EXIST="user_does_not_exist",s.INSUFFICIENT_BALANCE="insufficient_balance",s.ACCOUNT_TRANSFER_REQUIRED="account_transfer_required",s.BUFFER_NOT_DEFINED="buffer_not_defined",s.UNSUPPORTED_WALLET_TYPE="unsupported_wallet_type",s);class E extends _{constructor(){super("Method called before `ready`. Ensure you wait until `ready` is true before calling.")}}class u extends _{constructor(a="Embedded wallet error",s){super(a,s,"unknown_embedded_wallet_error")}}class l extends _{constructor(a="User must be authenticated"){super(a,void 0,"must_be_authenticated")}}class c extends _{constructor(a){super("This application is in development mode and must be upgraded to production to log in new users.",a,"max_accounts_reached")}}const d="/api/v1/sessions",v="/api/v1/sessions/logout",A="/api/v1/siwe/init",T="/api/v1/siwe/authenticate",D="/api/v1/siwe/link",N="/api/v1/siwe/link_smart_wallet",I="/api/v1/siwe/unlink",O="/api/v1/siwe/transfer",L="/api/v1/siws/init",R="/api/v1/siws/authenticate",m="/api/v1/siws/link",w="/api/v1/siws/unlink",S="/api/v1/siws/transfer",h="/api/v1/farcaster/init",f="/api/v1/farcaster/authenticate",U="/api/v1/farcaster/link",C="/api/v1/farcaster/status",k="/api/v1/farcaster/unlink",y="/api/v1/farcaster/transfer",g="api/v2/farcaster/init",P="api/v2/farcaster/authenticate",W="/api/v1/passwordless/init",M="/api/v1/passwordless/authenticate",b="/api/v1/passwordless/link",x="/api/v1/passwordless/unlink",F="/api/v1/passwordless/update",H="/api/v1/passwordless/transfer",B="/api/v1/passwordless_sms/init",V="/api/v1/passwordless_sms/link",K="/api/v1/passwordless_sms/unlink",Y="/api/v1/passwordless_sms/authenticate",G="/api/v1/passwordless_sms/update",X="/api/v1/passwordless_sms/transfer",$="/api/v1/oauth/init",q="/api/v1/oauth/authenticate",j="/api/v1/oauth/link",Q="/api/v1/oauth/unlink",J="/api/v1/oauth/transfer",z="/api/v1/recovery/oauth/init",Z="/api/v1/recovery/oauth/init_icloud",aa="/api/v1/recovery/oauth/authenticate",sa="/api/v1/passkeys/link/init",ea="/api/v1/passkeys/authenticate/init",ta="/api/v1/passkeys/register/init",_a="/api/v1/passkeys/link",ia="/api/v1/passkeys/authenticate",ra="/api/v1/passkeys/register",na="/api/v1/telegram/authenticate",oa="/api/v1/telegram/link",pa="/api/v1/telegram/unlink",Ea="/api/v1/telegram/transfer",ua="/api/v1/mfa/passwordless_sms/init",la="/api/v1/mfa/passkeys/init",ca="/api/v1/users/me/accept_terms",da="/api/v1/analytics_events",va="/api/v1/custom_jwt_account/authenticate",Aa="/api/v1/custom_jwt_account/link",Ta="/api/v1/guest/authenticate",Da="/api/v1/plugins/moonpay_on_ramp/sign",Na="/api/v1/funding/coinbase_on_ramp/init",Ia="/api/v1/funding/coinbase_on_ramp/status",Oa="/api/v1/wallets/revoke",La="/api/v1/users/me",Ra="/api/v1/scan/transaction";export{D as $,oa as A,i as B,d as C,v as D,da as E,va as F,Aa as G,Ta as H,o as I,t as J,ua as K,la as L,ca as M,x as N,K as O,_ as P,I as Q,w as R,Q as S,k as T,pa as U,Oa as V,Da as W,Na as X,Ia as Y,A as Z,T as _,p as a,N as a0,L as a1,R as a2,J as a3,S as a4,Ea as a5,y as a6,O as a7,X as a8,H as a9,m as aa,La as ab,Ra as ac,aa as ad,Z as ae,z as af,u as ag,c as ah,l as ai,E as aj,g as ak,P as al,b,W as c,f as d,U as e,n as f,h as g,C as h,j as i,$ as j,ra as k,ia as l,_a as m,ta as n,q as o,M as p,ea as q,sa as r,Y as s,V as t,F as u,B as v,G as w,r as x,e as y,na as z};