@privy-io/react-auth 1.87.0-beta-20240920184838 → 1.87.0-beta-20240923210930

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 (45) hide show
  1. package/dist/cjs/getEmbeddedConnectedWallet.js +1 -0
  2. package/dist/cjs/index.js +3113 -0
  3. package/dist/cjs/internal-context.js +1 -0
  4. package/dist/cjs/smart-wallets.js +1 -0
  5. package/dist/cjs/solana.js +1 -0
  6. package/dist/cjs/ui.js +132 -0
  7. package/dist/cjs/useFundWallet.js +118 -0
  8. package/dist/cjs/useSolanaWallets.js +1 -0
  9. package/dist/cjs/useWallets.js +1 -0
  10. package/dist/dts/index.d.mts +2448 -0
  11. package/dist/{index.d.ts → dts/index.d.ts} +21 -8
  12. package/dist/dts/smart-wallets.d.mts +728 -0
  13. package/dist/{smart-wallets.d.ts → dts/smart-wallets.d.ts} +1 -1
  14. package/dist/dts/solana.d.mts +65 -0
  15. package/dist/{solana.d.ts → dts/solana.d.ts} +3 -3
  16. package/dist/{types-eaea6708.d.ts → dts/types.d.mts} +44 -1
  17. package/dist/dts/types.d.ts +2251 -0
  18. package/dist/dts/ui.d.mts +29 -0
  19. package/dist/{ui.d.ts → dts/ui.d.ts} +1 -1
  20. package/dist/esm/getEmbeddedConnectedWallet.mjs +1 -0
  21. package/dist/esm/index.mjs +3113 -0
  22. package/dist/esm/internal-context.mjs +1 -0
  23. package/dist/esm/smart-wallets.mjs +1 -0
  24. package/dist/esm/solana.mjs +1 -0
  25. package/dist/esm/ui.mjs +132 -0
  26. package/dist/esm/useFundWallet.mjs +118 -0
  27. package/dist/esm/useSolanaWallets.mjs +1 -0
  28. package/dist/esm/useWallets.mjs +1 -0
  29. package/package.json +58 -29
  30. package/dist/chunk-4ODVFLKF.js +0 -1
  31. package/dist/chunk-4RGQ4R3M.js +0 -118
  32. package/dist/chunk-E7B7OFUX.js +0 -3376
  33. package/dist/chunk-VGM5FGSZ.js +0 -1
  34. package/dist/esm/chunk-4ODVFLKF.js +0 -1
  35. package/dist/esm/chunk-4RGQ4R3M.js +0 -118
  36. package/dist/esm/chunk-E7B7OFUX.js +0 -3376
  37. package/dist/esm/chunk-VGM5FGSZ.js +0 -1
  38. package/dist/esm/index.js +0 -1
  39. package/dist/esm/smart-wallets.js +0 -1
  40. package/dist/esm/solana.js +0 -1
  41. package/dist/esm/ui.js +0 -142
  42. package/dist/index.js +0 -1
  43. package/dist/smart-wallets.js +0 -1
  44. package/dist/solana.js +0 -1
  45. package/dist/ui.js +0 -142
@@ -0,0 +1,2251 @@
1
+ import { TypedMessage as TypedMessage$1, MessageTypes as MessageTypes$1 } from '@metamask/eth-sig-util';
2
+ import { ExternalProvider, StaticJsonRpcProvider, Web3Provider } from '@ethersproject/providers';
3
+ import EventEmitter from 'eventemitter3';
4
+ import { PasskeyAuthenticateInputType, SmartWalletType } from '@privy-io/public-api';
5
+ import { Adapter, WalletError, MessageSignerWalletAdapterProps, WalletAdapterProps, SignerWalletAdapterProps } from '@solana/wallet-adapter-base';
6
+ import { CountryCode } from 'libphonenumber-js/min';
7
+ import { ReactElement } from 'react';
8
+ import { Hex } from 'viem';
9
+ import { AbstractProvider } from 'web3-core';
10
+
11
+ interface ConnectorEvents {
12
+ walletsUpdated(): void;
13
+ initialized(): void;
14
+ }
15
+ /**
16
+ * @hidden
17
+ *
18
+ * A WalletConnector is identified by a connectorType and walletClientType. A
19
+ * connectorType includes injected, wallet_connect, etc. A walletClientType
20
+ * includes metamask, trustwallet, etc.
21
+ *
22
+ * Each WalletConnector manages a list of wallets, identified by an address
23
+ * and chainId. Each wallet has a connected property indicating its current
24
+ * connection status, which is determined based on events emitted by the
25
+ * underlying provider.
26
+ *
27
+ * The WalletConnector also emits two events: walletsUpdated and initialized.
28
+ * The walletsUpdated event is triggered when the list of wallets changes,
29
+ * while the initialized event is triggered when the WalletConnector is
30
+ * ready and has successfully executed the syncAccounts() function for
31
+ * the first time.
32
+ */
33
+ declare abstract class WalletConnector extends EventEmitter<ConnectorEvents> {
34
+ connected: boolean;
35
+ initialized: boolean;
36
+ walletClientType: WalletClientType;
37
+ abstract wallets: (BaseConnectedEthereumWallet | BaseConnectedSolanaWallet)[];
38
+ abstract chainType: 'ethereum' | 'solana';
39
+ abstract connectorType: ConnectorType;
40
+ constructor(walletClientType: WalletClientType);
41
+ abstract isConnected(): Promise<boolean>;
42
+ abstract subscribeListeners(): void;
43
+ abstract unsubscribeListeners(): void;
44
+ abstract get walletBranding(): WalletBranding;
45
+ abstract initialize(): Promise<void>;
46
+ abstract connect(options: {
47
+ showPrompt?: boolean;
48
+ chainId?: number;
49
+ }): Promise<BaseConnectedWallet | null>;
50
+ abstract disconnect(): void;
51
+ abstract promptConnection(walletClientType: WalletClientType): void;
52
+ }
53
+
54
+ /**
55
+ * These types are fully compatible with WAGMI chain types, in case
56
+ * we need interop in the future.
57
+ */
58
+ type RpcUrls = {
59
+ http: readonly string[];
60
+ webSocket?: readonly string[];
61
+ };
62
+ type NativeCurrency = {
63
+ name: string;
64
+ /** 2-6 characters long */
65
+ symbol: string;
66
+ decimals: number;
67
+ };
68
+ type BlockExplorer = {
69
+ name: string;
70
+ url: string;
71
+ };
72
+ /** A subset of WAGMI's chain type
73
+ * https://github.com/wagmi-dev/references/blob/6aea7ee9c65cfac24f33173ab3c98176b8366f05/packages/chains/src/types.ts#L8
74
+ *
75
+ * @example
76
+ *
77
+ * override the RPC URL for a chain
78
+ *
79
+ * ```ts
80
+ * import { mainnet } from 'viem/chains';
81
+ *
82
+ * const mainnetOverride: Chain = {
83
+ * ...mainnet,
84
+ * rpcUrls: {
85
+ * ...mainnet.rpcUrls,
86
+ * privyWalletOverride: {
87
+ * http: [INSERT_MAINNET_OVERRIDE_URL],
88
+ * },
89
+ * },
90
+ * };
91
+ *
92
+ * ```
93
+ * or
94
+ * ```ts
95
+ * import { mainnet } from 'viem/chains';
96
+ * import { addRpcUrlOverrideToChain } from '@privy-io/react-auth';
97
+ *
98
+ * const mainnetOverride = addRpcUrlOverrideToChain(mainnet, INSERT_MAINNET_OVERRIDE_URL);
99
+ * ```
100
+ *
101
+ */
102
+ type Chain = {
103
+ /** Id in number form */
104
+ id: number;
105
+ /** Human readable name */
106
+ name: string;
107
+ /** Internal network name */
108
+ network?: string;
109
+ /** Currency used by chain */
110
+ nativeCurrency: NativeCurrency;
111
+ /** Collection of block explorers */
112
+ blockExplorers?: {
113
+ [key: string]: BlockExplorer;
114
+ default: BlockExplorer;
115
+ };
116
+ /** Collection of RPC endpoints */
117
+ rpcUrls: {
118
+ [key: string]: RpcUrls;
119
+ default: RpcUrls;
120
+ } | {
121
+ [key: string]: RpcUrls;
122
+ default: RpcUrls;
123
+ /** @optional Allows you to override the RPC url for this chain */
124
+ privyWalletOverride: RpcUrls;
125
+ };
126
+ /** Flag for test networks */
127
+ testnet?: boolean;
128
+ };
129
+ /**
130
+ * RPC configuration for wallets.
131
+ */
132
+ type RpcConfig = {
133
+ /**
134
+ * Mapping of chainId to RPC URL. Overrides Privy default RPC URLs that are shared across projects. Set your own RPC URLs
135
+ * to avoid rate limits or other throughput bottlenecks.
136
+ *
137
+ * Do not provide an RPC URL that can serve multiple networks. You should only provide RPC URLs that are speciifc to the
138
+ * chain ID you'd like to override.
139
+ */
140
+ rpcUrls?: {
141
+ [key: number]: string;
142
+ };
143
+ /**
144
+ * Mapping between `walletClientType`s to the length of time after which RPC requests will timeout for that
145
+ * `walletClientType`.
146
+ *
147
+ * By default, all RPC requests through Privy will timeout after 2 mins (120000 ms). Use this object to
148
+ * override the RPC timeout in ms for specific` walletClientType`s, e.g. 'safe', in order to extend or
149
+ * shorten the timeout duration.
150
+ */
151
+ rpcTimeouts?: {
152
+ [key in WalletClientType]?: number;
153
+ };
154
+ };
155
+
156
+ declare abstract class PrivyError extends Error {
157
+ /**
158
+ * Privy error type.
159
+ */
160
+ abstract type: string;
161
+ /**
162
+ * Original Error object, it the error originated client-side.
163
+ */
164
+ cause?: Error;
165
+ /**
166
+ * An optional error code, often included in Privy API responses.
167
+ */
168
+ privyErrorCode?: PrivyErrorCode;
169
+ /**
170
+ * @param type Privy error type.
171
+ * @param message Human-readable message.
172
+ * @param cause Source of this error.
173
+ */
174
+ protected constructor(message: string, cause?: unknown, privyErrorCode?: PrivyErrorCode);
175
+ toString(): string;
176
+ }
177
+ /**
178
+ * The PrivyConnector instance threw an exception.
179
+ */
180
+ declare class PrivyConnectorError extends PrivyError {
181
+ type: string;
182
+ constructor(message: string, cause?: unknown, privyErrorCode?: PrivyErrorCode);
183
+ }
184
+ declare enum PrivyErrorCode {
185
+ OAUTH_ACCOUNT_SUSPENDED = "oauth_account_suspended",
186
+ MISSING_OR_INVALID_PRIVY_APP_ID = "missing_or_invalid_privy_app_id",
187
+ MISSING_OR_INVALID_PRIVY_ACCOUNT_ID = "missing_or_invalid_privy_account_id",
188
+ MISSING_OR_INVALID_TOKEN = "missing_or_invalid_token",
189
+ INVALID_DATA = "invalid_data",
190
+ INVALID_CAPTCHA = "invalid_captcha",
191
+ LINKED_TO_ANOTHER_USER = "linked_to_another_user",
192
+ CANNOT_LINK_MORE_OF_TYPE = "cannot_link_more_of_type",
193
+ FAILED_TO_LINK_ACCOUNT = "failed_to_link_account",
194
+ ALLOWLIST_REJECTED = "allowlist_rejected",
195
+ OAUTH_USER_DENIED = "oauth_user_denied",
196
+ OAUTH_UNEXPECTED = "oauth_unexpected",
197
+ UNKNOWN_AUTH_ERROR = "unknown_auth_error",
198
+ USER_EXITED_AUTH_FLOW = "exited_auth_flow",
199
+ USER_EXITED_LINK_FLOW = "exited_link_flow",
200
+ USER_EXITED_SET_PASSWORD_FLOW = "user_exited_set_password_flow",
201
+ MUST_BE_AUTHENTICATED = "must_be_authenticated",
202
+ UNKNOWN_CONNECT_WALLET_ERROR = "unknown_connect_wallet_error",
203
+ GENERIC_CONNECT_WALLET_ERROR = "generic_connect_wallet_error",
204
+ CLIENT_REQUEST_TIMEOUT = "client_request_timeout",
205
+ INVALID_CREDENTIALS = "invalid_credentials",
206
+ MISSING_MFA_CREDENTIALS = "missing_or_invalid_mfa",
207
+ UNKNOWN_MFA_ERROR = "unknown_mfa_error",
208
+ EMBEDDED_WALLET_ALREADY_EXISTS = "embedded_wallet_already_exists",
209
+ EMBEDDED_WALLET_NOT_FOUND = "embedded_wallet_not_found",
210
+ UNKNOWN_EMBEDDED_WALLET_ERROR = "unknown_embedded_wallet_error",
211
+ EMBEDDED_WALLET_PASSWORD_UNCONFIRMED = "embedded_wallet_password_unconfirmed",
212
+ EMBEDDED_WALLET_PASSWORD_ALREADY_EXISTS = "embedded_wallet_password_already_exists",
213
+ EMBEDDED_WALLET_RECOVERY_ALREADY_EXISTS = "embedded_wallet_recovery_already_exists",
214
+ TRANSACTION_FAILURE = "transaction_failure",
215
+ UNSUPPORTED_CHAIN_ID = "unsupported_chain_id",
216
+ NOT_SUPPORTED = "not_supported",
217
+ CAPTCHA_TIMEOUT = "captcha_timeout",
218
+ INVALID_MESSAGE = "invalid_message",
219
+ UNABLE_TO_SIGN = "unable_to_sign",
220
+ CAPTCHA_FAILURE = "captcha_failure",
221
+ CAPTCHA_DISABLED = "captcha_disabled",
222
+ SESSION_STORAGE_UNAVAILABLE = "session_storage_unavailable",
223
+ TOO_MANY_REQUESTS = "too_many_requests",
224
+ USER_LIMIT_REACHED = "max_accounts_reached",
225
+ DISALLOWED_LOGIN_METHOD = "disallowed_login_method",
226
+ PASSKEY_NOT_ALLOWED = "passkey_not_allowed",
227
+ USER_DOES_NOT_EXIST = "user_does_not_exist",
228
+ INSUFFICIENT_BALANCE = "insufficient_balance",
229
+ ACCOUNT_TRANSFER_REQUIRED = "account_transfer_required"
230
+ }
231
+
232
+ declare class WalletTimeoutError extends PrivyConnectorError {
233
+ type: string;
234
+ constructor();
235
+ }
236
+ /**
237
+ * A ProviderRpcError combines the necessary bits of the {PrivyError} with the
238
+ * EIP-compliant ProviderRpcError. This is meant to be a type around errors raised
239
+ * by the ethereum provider.
240
+ */
241
+ declare class ProviderRpcError extends PrivyError {
242
+ type: string;
243
+ readonly code: number;
244
+ readonly data?: unknown;
245
+ constructor(message: string, code: number, data?: unknown);
246
+ }
247
+
248
+ type WalletCreateRequestDataType = {
249
+ accessToken: string;
250
+ recoveryPassword?: string;
251
+ recoveryMethod?: UserRecoveryMethod;
252
+ recoveryAccessToken?: string;
253
+ /**
254
+ * Will be deprecated in a future release, use `recoveryPassword` instead
255
+ * @deprecated
256
+ */
257
+ recoveryPin?: string;
258
+ };
259
+ type WalletCreateAdditionalRequestDataType = {
260
+ accessToken: string;
261
+ primaryWalletAddress: string;
262
+ hdWalletIndex: number;
263
+ };
264
+ type SolanaWalletCreateRequestDataType = {
265
+ accessToken: string;
266
+ /**
267
+ * If a user has an existing Ethereum embedded wallet when creating the Solana embedded wallet, that address
268
+ * MUST be passed in this field. Our iframe will use this address to derive the Solana embedded wallet from the
269
+ * same entropy as the Ethereum wallet.
270
+ *
271
+ * If no address is passed here, our iframe assumes that the user has no existing Ethereum wallet and will create
272
+ * a new set of entropy for Solana.
273
+ */
274
+ ethereumAddress?: string;
275
+ };
276
+ type WalletImportRequestDataType = {
277
+ accessToken: string;
278
+ privateKey: string;
279
+ };
280
+ type WalletSetRecoveryRequestDataType = {
281
+ accessToken: string;
282
+ address: string;
283
+ recoveryMethod: UserRecoveryMethod;
284
+ recoveryPassword?: string;
285
+ recoveryAccessToken?: string;
286
+ };
287
+ type WalletRecoverRequestDataType = {
288
+ address: string;
289
+ imported?: boolean;
290
+ accessToken: string;
291
+ mfaCode?: string | PasskeyAuthenticateInputType['authenticator_response'];
292
+ mfaMethod?: MfaMethod;
293
+ relyingParty?: string;
294
+ recoveryPassword?: string;
295
+ recoveryMethod?: UserRecoveryMethod | 'privy';
296
+ recoveryAccessToken?: string;
297
+ /**
298
+ * Will be deprecated in a future release, use `recoveryPassword` instead
299
+ * @deprecated
300
+ */
301
+ recoveryPin?: string;
302
+ };
303
+ type WalletConnectRequestDataType = {
304
+ accessToken: string;
305
+ address: string;
306
+ };
307
+ type WalletRpcRequestDataType = {
308
+ accessToken: string;
309
+ hdWalletIndex?: number;
310
+ mfaCode?: string | PasskeyAuthenticateInputType['authenticator_response'];
311
+ mfaMethod?: MfaMethod;
312
+ relyingParty?: string;
313
+ requesterAppId?: string;
314
+ address: string;
315
+ request: EthereumRpcRequestType;
316
+ };
317
+ type SolanaWalletConnectRequestDataType = {
318
+ publicKey: string;
319
+ accessToken: string;
320
+ };
321
+ type SolanaWalletRecoverRequestDataType = {
322
+ publicKey: string;
323
+ accessToken: string;
324
+ };
325
+ type SolanaWalletRpcRequestDataType = {
326
+ accessToken: string;
327
+ publicKey: string;
328
+ request: SolanaRpcRequestType;
329
+ };
330
+ type MfaVerifyRequestDataType = {
331
+ accessToken: string;
332
+ };
333
+ type MfaInitEnrollmentRequestDataType = {
334
+ accessToken: string;
335
+ method: 'sms';
336
+ phoneNumber: string;
337
+ } | {
338
+ accessToken: string;
339
+ method: 'totp';
340
+ };
341
+ type MfaSubmitEnrollmentRequestDataType = {
342
+ accessToken: string;
343
+ method: 'sms';
344
+ code: string;
345
+ phoneNumber: string;
346
+ } | {
347
+ accessToken: string;
348
+ method: 'totp';
349
+ code: string;
350
+ } | {
351
+ accessToken: string;
352
+ method: 'passkey';
353
+ credentialIds: string[];
354
+ };
355
+ type MfaUnenrollRequestDataType = {
356
+ accessToken: string;
357
+ method: 'sms' | 'totp';
358
+ };
359
+ type MfaClearRequestDataType = {
360
+ userId: string;
361
+ };
362
+ type FarcasterSignerInitRequestDataType = {
363
+ address: string;
364
+ hdWalletIndex: number | null;
365
+ accessToken: string;
366
+ mfaCode: string | PasskeyAuthenticateInputType['authenticator_response'] | null;
367
+ mfaMethod: string | null;
368
+ relyingParty: string;
369
+ };
370
+ type FarcasterSignRequestDataType = {
371
+ address: string;
372
+ hdWalletIndex: number | null;
373
+ accessToken: string;
374
+ mfaCode: string | PasskeyAuthenticateInputType['authenticator_response'] | null;
375
+ mfaMethod: string | null;
376
+ relyingParty: string;
377
+ payload: {
378
+ hash: string;
379
+ };
380
+ fid: bigint;
381
+ };
382
+ type WalletCreateResponseDataType = {
383
+ address: string;
384
+ };
385
+ type WalletCreateAdditionalResponseDataType = {
386
+ address: string;
387
+ };
388
+ type WalletImportResponseDataType = {
389
+ address: string;
390
+ };
391
+ type WalletConnectResponseDataType = {
392
+ address: string;
393
+ };
394
+ type WalletRecoverResponseDataType = {
395
+ address: string;
396
+ };
397
+ type WalletSetRecoveryResponseDataType = {
398
+ address: string;
399
+ };
400
+ type WalletRpcResponseDataType = {
401
+ address: string;
402
+ response: EthereumRpcResponseType;
403
+ };
404
+ type SolanaWalletCreateResponseDataType = {
405
+ publicKey: string;
406
+ };
407
+ type SolanaWalletConnectResponseDataType = {
408
+ publicKey: string;
409
+ };
410
+ type SolanaWalletRecoverResponseDataType = {
411
+ publicKey: string;
412
+ };
413
+ type SolanaWalletRpcResponseDataType = {
414
+ publicKey: string;
415
+ response: SolanaRpcResponseType;
416
+ };
417
+ type MfaVerifyResponseDataType = Record<string, never>;
418
+ type MfaInitEnrollmentResponseDataType = {
419
+ method: string;
420
+ secret?: string;
421
+ authUrl?: string;
422
+ };
423
+ type MfaSubmitEnrollmentResponseDataType = Record<string, never>;
424
+ type MfaUnenrollResponseDataType = Record<string, never>;
425
+ type MfaClearResponseDataType = Record<string, never>;
426
+ type FarcasterSignerInitResponseDataType = PrivyFarcasterSignerInitResponse;
427
+ type FarcasterSignResponseDataType = {
428
+ hash: string;
429
+ signature: string;
430
+ };
431
+ declare const PrivyIframeErrorTypes: readonly ["error", "invalid_request_arguments", "wallet_not_on_device", "invalid_recovery_pin", "insufficient_funds", "missing_or_invalid_mfa", "mfa_verification_max_attempts_reached", "mfa_timeout", "twilio_verification_failed"];
432
+ type PrivyIframeErrorTypesType = (typeof PrivyIframeErrorTypes)[number];
433
+ interface EmbeddedWalletProxy {
434
+ create: (data: WalletCreateRequestDataType) => Promise<WalletCreateResponseDataType>;
435
+ createAdditional: (data: WalletCreateAdditionalRequestDataType) => Promise<WalletCreateAdditionalResponseDataType>;
436
+ import: (data: WalletImportRequestDataType) => Promise<WalletImportResponseDataType>;
437
+ connect: (data: WalletConnectRequestDataType) => Promise<WalletConnectResponseDataType>;
438
+ recover: (data: WalletRecoverRequestDataType) => Promise<WalletRecoverResponseDataType>;
439
+ setRecovery: (data: WalletSetRecoveryRequestDataType) => Promise<WalletSetRecoveryResponseDataType>;
440
+ rpc: (data: WalletRpcRequestDataType) => Promise<WalletRpcResponseDataType>;
441
+ createSolana: (data: SolanaWalletCreateRequestDataType) => Promise<SolanaWalletCreateResponseDataType>;
442
+ connectSolana: (data: SolanaWalletConnectRequestDataType) => Promise<SolanaWalletConnectResponseDataType>;
443
+ recoverSolana: (data: SolanaWalletRecoverRequestDataType) => Promise<SolanaWalletRecoverResponseDataType>;
444
+ rpcSolana: (data: SolanaWalletRpcRequestDataType) => Promise<SolanaWalletRpcResponseDataType>;
445
+ verifyMfa: (data: MfaVerifyRequestDataType) => Promise<MfaVerifyResponseDataType>;
446
+ initEnrollMfa: (data: MfaInitEnrollmentRequestDataType) => Promise<MfaInitEnrollmentResponseDataType>;
447
+ submitEnrollMfa: (data: MfaSubmitEnrollmentRequestDataType) => Promise<MfaSubmitEnrollmentResponseDataType>;
448
+ unenrollMfa: (data: MfaUnenrollRequestDataType) => Promise<MfaUnenrollResponseDataType>;
449
+ clearMfa: (data: MfaClearRequestDataType) => Promise<MfaClearResponseDataType>;
450
+ initFarcasterSigner: (data: FarcasterSignerInitRequestDataType) => Promise<FarcasterSignerInitResponseDataType>;
451
+ signFarcasterMessage: (data: FarcasterSignRequestDataType) => Promise<FarcasterSignResponseDataType>;
452
+ }
453
+
454
+ declare global {
455
+ interface Window {
456
+ ethereum?: any;
457
+ }
458
+ }
459
+ type ProviderConnectInfo = {
460
+ chainId: string;
461
+ };
462
+ type OnConnectEventHandler = (connectInfo: ProviderConnectInfo) => void;
463
+ type OnDisconnectEventHandler = (error: ProviderRpcError) => void;
464
+ type OnChainChangedEventHandler = (chainId: string | number) => void;
465
+ type OnAccountsChangedEventHandler = (accounts: string[]) => void;
466
+ type ProviderMessage = {
467
+ type: string;
468
+ data: unknown;
469
+ };
470
+ type OnMessageEventHandler = (message: ProviderMessage) => void;
471
+ type EIP1193OnEventHandler = OnConnectEventHandler | OnDisconnectEventHandler | OnChainChangedEventHandler | OnAccountsChangedEventHandler | OnMessageEventHandler;
472
+ interface EIP1193Provider {
473
+ rpcTimeoutDuration?: number;
474
+ request: (request: {
475
+ method: string;
476
+ params?: Array<any> | undefined;
477
+ }) => Promise<any>;
478
+ on: (eventName: string, listener: EIP1193OnEventHandler) => any;
479
+ removeListener: (eventName: string | symbol, listener: (...args: any[]) => void) => any;
480
+ }
481
+ /**
482
+ * @hidden
483
+ *
484
+ * The PrivyProxyProvider adds a middleware layer on top of the underlying wallet provider.
485
+ * */
486
+ declare class PrivyProxyProvider implements EIP1193Provider {
487
+ rpcTimeoutDuration: number;
488
+ walletProvider?: EIP1193Provider;
489
+ private _subscriptions;
490
+ constructor(walletProvider?: EIP1193Provider, rpcTimeoutDuration?: number);
491
+ on(eventName: string, listener: (...args: any[]) => void): any;
492
+ request(request: {
493
+ method: string;
494
+ params?: any[] | undefined;
495
+ }): Promise<any>;
496
+ removeListener: (eventName: string | symbol, listener: (...args: any[]) => void) => any;
497
+ walletTimeout: (error?: WalletTimeoutError, timeoutMs?: number) => Promise<string[]>;
498
+ setWalletProvider: (provider: EIP1193Provider) => void;
499
+ }
500
+ interface RequestArguments {
501
+ readonly method: string;
502
+ readonly params?: readonly unknown[] | object | any;
503
+ }
504
+ declare class Embedded1193Provider extends EventEmitter implements EIP1193Provider {
505
+ walletProxy: EmbeddedWalletProxy;
506
+ /** Address of the embedded wallet that this provider corresponds to. */
507
+ address: string;
508
+ provider: StaticJsonRpcProvider;
509
+ chainId: number;
510
+ rpcConfig: RpcConfig;
511
+ chains: Chain[];
512
+ rpcTimeoutDuration: number;
513
+ appId: string;
514
+ /** Address of the user's embedded wallet at HD index 0. This is required to make RPC requests to the iframe. */
515
+ rootAddress: string;
516
+ /**
517
+ * HD index of the embedded wallet that this provider corresponds to, if this is an HD wallet. This is required to make RPC
518
+ * requests to the iframe. If this is an imported wallet, the `walletIndex` is defined as 0 (and is handled as such by the iframe).
519
+ */
520
+ walletIndex: number;
521
+ constructor({ walletProxy, address, rootAddress, rpcConfig, chains, appId, chainId, walletIndex, }: {
522
+ walletProxy: EmbeddedWalletProxy;
523
+ address: string;
524
+ rootAddress: string;
525
+ rpcConfig: RpcConfig;
526
+ chains: Chain[];
527
+ appId: string;
528
+ chainId: number;
529
+ walletIndex: number;
530
+ });
531
+ handleSendTransaction(args: RequestArguments): Promise<string>;
532
+ private handleSwitchEthereumChain;
533
+ private handlePersonalSign;
534
+ private handleSignedTypedData;
535
+ private handleEstimateGas;
536
+ request(args: RequestArguments): Promise<unknown>;
537
+ connect(): Promise<string | null>;
538
+ }
539
+ /**
540
+ * @hidden
541
+ *
542
+ * Shim to convert to ethers-compatible ExternalProvider class.
543
+ */
544
+ declare class AsExternalProvider extends PrivyProxyProvider implements ExternalProvider {
545
+ constructor(provider: EIP1193Provider);
546
+ isMetaMask?: boolean;
547
+ isStatus?: boolean;
548
+ host?: string;
549
+ path?: string;
550
+ sendAsync?: (request: {
551
+ method: string;
552
+ params?: Array<any>;
553
+ }, callback: (error: any, response: any) => void) => void;
554
+ send?: (request: {
555
+ method: string;
556
+ params?: Array<any>;
557
+ }, callback: (error: any, response: any) => void) => void;
558
+ }
559
+
560
+ /**
561
+ * Represents a connection with a single Solana wallet provider. Manages wallet state
562
+ * including ongoing connection status, and exposes methods for connecting and disconnecting.
563
+ */
564
+ declare class SolanaWalletConnector extends WalletConnector {
565
+ chainType: "solana";
566
+ connectorType: "solana_adapter";
567
+ wallets: BaseConnectedSolanaWallet[];
568
+ private adapter;
569
+ private shouldAutoConnect;
570
+ constructor(adapter: Adapter, shouldAutoConnect: boolean);
571
+ get isInstalled(): boolean;
572
+ /**
573
+ * Builds a connected wallet object to be exposed to the developer. This object
574
+ * contains the address and a few helper methods.
575
+ *
576
+ * Provider methods share the PrivyProxyProvider instance. This means that multiple
577
+ * wallets may share the same provider if one wallet was disconnected and another
578
+ * wallet was connected.
579
+ *
580
+ * A wallet is considered connected if it is present in the wallets array and is
581
+ * in a connected state.
582
+ *
583
+ * @hidden
584
+ */
585
+ buildConnectedWallet(wallet: Adapter, meta: ConnectedWalletMetadata): BaseConnectedSolanaWallet;
586
+ /**
587
+ * @hidden
588
+ */
589
+ syncAccounts(): Promise<void>;
590
+ /**
591
+ * @hidden
592
+ */
593
+ get walletBranding(): WalletBranding;
594
+ /**
595
+ * @hidden
596
+ */
597
+ initialize(): Promise<void>;
598
+ /**
599
+ * @hidden
600
+ */
601
+ connect(options: {
602
+ showPrompt: boolean;
603
+ }): Promise<BaseConnectedSolanaWallet | null>;
604
+ /**
605
+ * @hidden
606
+ */
607
+ disconnect: () => void;
608
+ /**
609
+ * @hidden
610
+ */
611
+ promptConnection: () => Promise<void>;
612
+ protected onDisconnect: () => void;
613
+ protected onConnect: (_: any) => void;
614
+ protected onError: (_: WalletError) => void;
615
+ protected onReadyStateChange: (readyState: string) => void;
616
+ /**
617
+ * Get the most recently connected wallet.
618
+ *
619
+ * @hidden
620
+ */
621
+ getConnectedWallet(): Promise<BaseConnectedSolanaWallet | null>;
622
+ /**
623
+ * We depend on the adapter to manage the connection state. We consider a wallet
624
+ * connected if the adapter is connected and its readyState is 'Installed'.
625
+ *
626
+ * @hidden
627
+ */
628
+ isConnected(): Promise<boolean>;
629
+ /**
630
+ * @hidden
631
+ */
632
+ subscribeListeners(): void;
633
+ /**
634
+ * @hidden
635
+ */
636
+ unsubscribeListeners(): void;
637
+ }
638
+
639
+ interface SolanaWalletConnectorsOptions {
640
+ shouldAutoConnect?: boolean;
641
+ }
642
+ /**
643
+ * Plugin object to add solana support to the Privy SDK
644
+ */
645
+ type SolanaWalletConnectorsConfig = {
646
+ /**
647
+ * Creates listeners for when solana wallets are registered or unregistered
648
+ */
649
+ onMount: () => void;
650
+ /**
651
+ * Remove listener registered by `onMount`
652
+ */
653
+ onUnmount: () => void;
654
+ /**
655
+ * Get all Wallets that have been registered, converted to `SolanaWalletConnectors`.
656
+ */
657
+ get: () => SolanaWalletConnector[];
658
+ };
659
+ /**
660
+ * Wraps the wallet detection logic found in `@solana/wallet-standard-wallet-adapter-base`
661
+ * and `@wallet-standard-app`. Returns a `SolanaWalletConnectors` object to be used with the `PrivyProvider`.
662
+ *
663
+ * @param {SolanaWalletConnectorsOptions} args Configuration object
664
+ * @param {boolean} args.shouldAutoConnect Whether to automatically connect to the wallet.
665
+ * Defaults to `true` and should not prompt the user loudly for connection. However, some legacy
666
+ * adapters may still auto-connect loudly, so this flag can be used to disable that behavior.
667
+ */
668
+ declare const toSolanaWalletConnectors: (args?: SolanaWalletConnectorsOptions) => SolanaWalletConnectorsConfig;
669
+
670
+ interface SolanaProvider {
671
+ request: (request: {
672
+ method: string;
673
+ params?: any;
674
+ }) => Promise<any>;
675
+ }
676
+
677
+ /**
678
+ * Accepted payment methods for the MoonPay fiat on-ramp.
679
+ */
680
+ type MoonpayPaymentMethod = 'ach_bank_transfer' | 'credit_debit_card' | 'gbp_bank_transfer' | 'gbp_open_banking_payment' | 'mobile_wallet' | 'sepa_bank_transfer' | 'sepa_open_banking_payment' | 'pix_instant_payment' | 'yellow_card_bank_transfer';
681
+ type MoonpayUiConfig = {
682
+ accentColor?: string;
683
+ theme?: 'light' | 'dark';
684
+ };
685
+ /**
686
+ * Cryptocurrency codes for the MoonPay fiat on-ramp. These codes
687
+ * follow the format {TOKEN_NAME}_{NETWORK_NAME}.
688
+ */
689
+ type MoonpayCurrencyCode = 'AVAX_CCHAIN' | 'CELO_CELO' | 'CUSD_CELO' | 'DAI_ETHEREUM' | 'ETH_ETHEREUM' | 'ETH_ARBITRUM' | 'ETH_POLYGON' | 'ETH_BASE' | 'FIL_FVM' | 'MATIC_ETHEREUM' | 'MATIC_POLYGON' | 'USDC_ETHEREUM' | 'USDC_ARBITRUM' | 'USDC_OPTIMISM' | 'USDC_POLYGON' | 'USDC_BASE' | 'USDT_ETHEREUM' | 'USDT_POLYGON' | 'WETH_POLYGON' | 'WBTC_ETHEREUM' | 'BNB_BNB' | 'BNB_BSC';
690
+ /**
691
+ * Configuration parameter for the MoonPay fiat on-ramp.
692
+ */
693
+ type MoonpayConfig = {
694
+ currencyCode?: MoonpayCurrencyCode;
695
+ quoteCurrencyAmount?: number;
696
+ paymentMethod?: MoonpayPaymentMethod;
697
+ uiConfig?: MoonpayUiConfig;
698
+ };
699
+ type MoonpaySignRequest = {
700
+ address: string;
701
+ config: MoonpayConfig;
702
+ useSandbox: boolean;
703
+ };
704
+ type MoonpaySignResponse = {
705
+ signedUrl: string;
706
+ externalTransactionId: string;
707
+ };
708
+
709
+ declare const SUPPORTED_OAUTH_PROVIDERS: readonly ["google", "discord", "twitter", "github", "spotify", "instagram", "tiktok", "linkedin", "apple"];
710
+ declare const SUPPORTED_RECOVERY_PROVIDERS: readonly ["google-drive", "icloud"];
711
+ declare const SUPPORTED_MFA_METHODS: readonly ["sms", "totp", "passkey"];
712
+ type MfaMethod = (typeof SUPPORTED_MFA_METHODS)[number];
713
+ /**
714
+ * Supported OAuth providers. Can be `'google'`, `'discord'`, `'twitter'`, `'github'`, `'spotify'`,
715
+ * `'instagram'`, `'tiktok'`, `'linkedin'`, or `'apple'`
716
+ */
717
+ type OAuthProviderType = (typeof SUPPORTED_OAUTH_PROVIDERS)[number];
718
+ /**
719
+ * Supported OAuth providers for the recovery flow. Can be `'google-drive'`
720
+ */
721
+ type RecoveryProviderType = (typeof SUPPORTED_RECOVERY_PROVIDERS)[number];
722
+ type LoginMethod = 'email' | 'sms' | 'siwe' | 'siws' | 'farcaster' | OAuthProviderType | 'passkey' | 'telegram' | 'custom' | `privy:${string}` | 'guest';
723
+ type LoginWithCode = {
724
+ /**
725
+ * One-time password _([OTP](https://en.wikipedia.org/wiki/One-time_password))_ that was sent to user during first login step
726
+ */
727
+ code: string;
728
+ };
729
+ declare const EMBEDDED_WALLET_CLIENT_TYPES: readonly ["privy"];
730
+ type EmbeddedWalletClientType = (typeof EMBEDDED_WALLET_CLIENT_TYPES)[number];
731
+ declare const INJECTED_WALLET_CLIENT_TYPES: readonly ["metamask", "phantom", "brave_wallet", "rainbow", "uniswap_wallet_extension", "uniswap_extension", "rabby_wallet", "crypto.com_wallet_extension"];
732
+ type InjectedWalletClientType = (typeof INJECTED_WALLET_CLIENT_TYPES)[number];
733
+ declare const COINBASE_WALLET_CLIENT_TYPES: readonly ["coinbase_wallet", "coinbase_smart_wallet"];
734
+ type CoinbaseWalletClientType = (typeof COINBASE_WALLET_CLIENT_TYPES)[number];
735
+ type WalletConnectWalletClientType = (typeof WALLET_CONNECT_WALLET_CLIENT_TYPES)[number];
736
+ declare const UNKNOWN_WALLET_CLIENT_TYPES: readonly ["unknown"];
737
+ type UnknownWalletClientType = (typeof UNKNOWN_WALLET_CLIENT_TYPES)[number];
738
+ declare const SOLANA_WALLET_CLIENT_TYPES: readonly ["phantom", "solflare", "glow"];
739
+ type SolanaWalletClientType = (typeof SOLANA_WALLET_CLIENT_TYPES)[number];
740
+ type WalletClientType = InjectedWalletClientType | CoinbaseWalletClientType | WalletConnectWalletClientType | EmbeddedWalletClientType | UnknownWalletClientType | SolanaWalletClientType;
741
+ declare const SUPPORTED_CONNECTOR_TYPES: string[];
742
+ type ConnectorType = (typeof SUPPORTED_CONNECTOR_TYPES)[number];
743
+ /**
744
+ * Wallet metadata currently for internal use only
745
+ */
746
+ type WalletBranding = {
747
+ name: string;
748
+ id: string;
749
+ icon?: string | EmbeddedSVG;
750
+ };
751
+ type LinkedAccountType = 'wallet' | 'smart_wallet' | 'email' | 'phone' | 'google_oauth' | 'twitter_oauth' | 'discord_oauth' | 'github_oauth' | 'spotify_oauth' | 'instagram_oauth' | 'tiktok_oauth' | 'linkedin_oauth' | 'apple_oauth' | 'custom_auth' | 'farcaster' | 'passkey' | 'telegram' | 'cross_app' | 'guest';
752
+ /** @ignore */
753
+ interface LinkMetadata {
754
+ /** Account type, most commonly useful when filtering through linkedAccounts */
755
+ type: LinkedAccountType;
756
+ /**
757
+ * @deprecated use `firstVerifiedAt` instead.
758
+ * Datetime when this account was linked to the user or created. */
759
+ verifiedAt: Date;
760
+ /** Datetime when this account was linked to the user. */
761
+ firstVerifiedAt: Date | null;
762
+ /** Datetime when this account was most recently used as a login/link method by the user. */
763
+ latestVerifiedAt: Date | null;
764
+ }
765
+ /**
766
+ * Legacy configuration for the Moonpay funding selection.
767
+ *
768
+ * @deprecated
769
+ */
770
+ type MoonpayFundingConfig = {
771
+ config: MoonpayConfig;
772
+ provider?: 'moonpay';
773
+ };
774
+ /**
775
+ * Configuration for native funding amount.
776
+ */
777
+ type NativeFundingConfig = {
778
+ chain?: Chain;
779
+ amount?: string;
780
+ } | {
781
+ chain?: Chain;
782
+ amount: string;
783
+ asset: {
784
+ erc20: Hex;
785
+ } | 'USDC' | 'native-currency';
786
+ };
787
+ /**
788
+ * Optional configuration parameter for the fiat on-ramp.
789
+ */
790
+ type FundWalletConfig = MoonpayFundingConfig | NativeFundingConfig;
791
+ /**
792
+ * Possible methods of user-driven recovery.
793
+ * This is set, per app, on the server.
794
+ */
795
+ type UserRecoveryMethod = 'user-passcode' | RecoveryProviderType;
796
+ /**
797
+ * Object representation of a user's wallet.
798
+ */
799
+ interface Wallet {
800
+ /** The wallet address. */
801
+ address: string;
802
+ /**
803
+ * Chain type of the wallet address.
804
+ */
805
+ chainType: 'ethereum' | 'solana';
806
+ /**
807
+ * @deprecated Use `BaseConnectedWallet.chainId` instead.
808
+ *
809
+ * ```tsx
810
+ * const {wallets} = useWallets();
811
+ * // Replace wallets[0] with the wallet you'd like
812
+ * const chainId = wallets[0].chainId;
813
+ * console.log(chainId);
814
+ * // This will be the current chain ID of the wallet,
815
+ * // e.g. 'eip155:1' if the wallet is on mainnet
816
+ * ```
817
+ *
818
+ * Represents the CAIP-2 formatted chain ID of the wallet
819
+ * during the most recent verification during SIWE. May not
820
+ * be up to date with the current chain ID of the wallet.
821
+ *
822
+ * Embedded wallets do not complete SIWE since the user is
823
+ * already authenticated, and you should not use this field
824
+ * for the embedded wallet.
825
+ *
826
+ * e.g. eip155:1, eip155:5, eip155:137, etc.
827
+ */
828
+ chainId?: string;
829
+ /**
830
+ * @deprecated Use `walletClientType` instead.
831
+ */
832
+ walletClient: 'privy' | 'unknown';
833
+ /**
834
+ * The wallet client used for this wallet during the most recent verification.
835
+ *
836
+ * If the value is `privy`, then this is a privy embedded wallet.
837
+ *
838
+ * Other values include but are not limited to `metamask`, `rainbow`, `coinbase_wallet`, etc.
839
+ */
840
+ walletClientType?: string;
841
+ /**
842
+ * The connector type used for this wallet during the most recent verification.
843
+ *
844
+ * This includes but is not limited to `injected`, `wallet_connect`, `coinbase_wallet`, `embedded`.
845
+ */
846
+ connectorType?: string;
847
+ /**
848
+ * If this is a 'privy' embedded wallet, stores the recovery method:
849
+ *
850
+ * 1. 'privy': privy escrow of the recovery material
851
+ * 2. 'user-passcode': recovery protected by user-input passcode
852
+ */
853
+ recoveryMethod?: 'privy' | UserRecoveryMethod;
854
+ /** Whether the wallet is imported. */
855
+ imported: boolean;
856
+ /** HD index for the wallet if embedded. */
857
+ walletIndex: number | null;
858
+ }
859
+ /**
860
+ * Object representation of metadata reported by a connected wallet from a wallet connector
861
+ */
862
+ interface ConnectedWalletMetadata {
863
+ /** The wallet name (e.g. MetaMask). */
864
+ name: string;
865
+ /** The wallet RDNS, falls back to the wallet name if none is available. */
866
+ id: string;
867
+ /** The wallet logo */
868
+ icon?: string;
869
+ }
870
+ /**
871
+ * Object representation of a base connected wallet from a wallet connector.
872
+ */
873
+ interface BaseConnectedWallet {
874
+ /** The wallet address. */
875
+ address: string;
876
+ /** The first time this wallet was connected without break. */
877
+ connectedAt: number;
878
+ /**
879
+ * The wallet client where this key-pair is stored.
880
+ * e.g. metamask, rainbow, coinbase_wallet, etc.
881
+ */
882
+ walletClientType: WalletClientType;
883
+ /**
884
+ * The connector used to initiate the connection with the wallet client.
885
+ * e.g. injected, wallet_connect, coinbase_wallet, etc.
886
+ */
887
+ connectorType: ConnectorType;
888
+ /** Whether the wallet is imported. */
889
+ imported: boolean;
890
+ /**
891
+ * Metadata for the wallet.
892
+ */
893
+ meta: ConnectedWalletMetadata;
894
+ /** Returns true if the wallet is connected, false otherwise */
895
+ isConnected: () => Promise<boolean>;
896
+ /**
897
+ * @experimental **Experimental**: This property is {@link https://docs.privy.io/guide/guides/experimental-features subject to change at any time}.
898
+ *
899
+ * Not all wallet clients support programmatic disconnects (e.g. MetaMask, Phantom).
900
+ * In kind, if the wallet's client does not support programmatic disconnects,
901
+ * this method will no-op.
902
+ */
903
+ disconnect: () => void;
904
+ }
905
+ /**
906
+ * Object representation of a base connected Solana wallet from a wallet connector.
907
+ */
908
+ interface BaseConnectedSolanaWallet extends BaseConnectedWallet {
909
+ /**
910
+ * Returns a light provider for interfacing with this wallet. Support message signing
911
+ * on embedded and external wallets using an internal interface.
912
+ */
913
+ getProvider: () => Promise<SolanaProvider>;
914
+ signMessage: MessageSignerWalletAdapterProps['signMessage'] | undefined;
915
+ sendTransaction: WalletAdapterProps['sendTransaction'] | undefined;
916
+ signTransaction: SignerWalletAdapterProps['signTransaction'] | undefined;
917
+ }
918
+ /**
919
+ * Object representation of a base connected Ethereum wallet from a wallet connector.
920
+ */
921
+ interface BaseConnectedEthereumWallet extends BaseConnectedWallet {
922
+ /** The current chain ID with CAIP-2 formatting. */
923
+ chainId: string;
924
+ /**
925
+ * Switch the network chain to a specified ID.
926
+ * Note: The chainId must be a supported network: https://docs.privy.io/guide/frontend/embedded/networks
927
+ * Note: This will not update any existing provider instances, re-request `wallet.getEthersProvider` (e.g.)
928
+ * to get a provider with the updated chainId.
929
+ *
930
+ * @param targetChainId The specified chain ID to switch to, as a number or 0x prefixed string.
931
+ * @returns void
932
+ */
933
+ switchChain: (targetChainId: `0x${string}` | number) => Promise<void>;
934
+ /** Helper methods to build providers for interfacing with this wallet. */
935
+ getEthereumProvider: () => Promise<EIP1193Provider>;
936
+ getEthersProvider: () => Promise<Web3Provider>;
937
+ getWeb3jsProvider: () => Promise<AbstractProvider>;
938
+ /**
939
+ * Perform personal_sign with the user's wallet.
940
+ *
941
+ * @param {string} message The message to sign.
942
+ * @returns {string} The resulting signature.
943
+ */
944
+ sign: (message: string) => Promise<string>;
945
+ }
946
+ interface PrivyConnectedWallet {
947
+ /** True if this wallet is linked to the authenticated user. False if it is not yet linked or
948
+ * the user has not yet authenticated. */
949
+ linked: boolean;
950
+ /** Login with this wallet or link this wallet to the authenticated user.
951
+ *
952
+ * Throws a PrivyClientError if the wallet is not connected.
953
+ */
954
+ loginOrLink: () => Promise<void>;
955
+ /**
956
+ * Prompt the user to go through the funding flow and for the connected wallet.
957
+ *
958
+ * This will open the modal with a prompt for the user to select a funding method (if multiple are enabled).
959
+ *
960
+ * Once the user continues to the funding flow, Privy will display the funding status screen, and wait
961
+ * for the transaction to complete.
962
+ *
963
+ * Note: Even after a successful funding, funds can take a few minutes to arrive in the user's wallet.
964
+ *
965
+ * Privy currently supports funding via external wallets and Moonpay.
966
+ *
967
+ * @param {FundWalletConfig} fundWalletConfig Funding configuration to specify chain and funding amount (if enabled)
968
+ * **/
969
+ fund: (fundWalletConfig?: FundWalletConfig) => Promise<void>;
970
+ /** Unlink this wallet to the authenticated user. Throws a PrivyClientError if the user is not
971
+ * authenticated. */
972
+ unlink: () => Promise<void>;
973
+ }
974
+ /**
975
+ * Object representation of a connected wallet.
976
+ */
977
+ interface ConnectedWallet extends BaseConnectedEthereumWallet, PrivyConnectedWallet {
978
+ }
979
+ /**
980
+ * Object representation of a connected Solana wallet for the user.
981
+ */
982
+ interface ConnectedSolanaWallet extends BaseConnectedSolanaWallet, PrivyConnectedWallet {
983
+ }
984
+ /**
985
+ * Object representation of a smart wallet.
986
+ */
987
+ interface SmartWallet {
988
+ /** The wallet address. */
989
+ address: string;
990
+ /** The provider of the smart wallet. */
991
+ smartWalletType: SmartWalletType;
992
+ }
993
+ /** Object representation of a user's email. */
994
+ interface Email {
995
+ /** The email address. */
996
+ address: string;
997
+ }
998
+ /** Object representation of a user's phone number. */
999
+ interface Phone {
1000
+ /** The phone number. */
1001
+ number: string;
1002
+ }
1003
+ /** Object representation of a user's Google account. */
1004
+ interface Google {
1005
+ /** The `sub` claim from the Google-issued JWT for this account. */
1006
+ subject: string;
1007
+ /** The email associated with the Google account. */
1008
+ email: string;
1009
+ /** The name associated with the Google account. */
1010
+ name: string | null;
1011
+ }
1012
+ /** Object representation of a user's Twitter account. */
1013
+ interface Twitter {
1014
+ /** The `sub` claim from the Twitter-issued JWT for this account. */
1015
+ subject: string;
1016
+ /** The username associated with the Twitter account. */
1017
+ username: string | null;
1018
+ /** The name associated with the Twitter account. */
1019
+ name: string | null;
1020
+ /** The profile picture URL associated with the Twitter account.
1021
+ * Note that the Twitter image URL returned is appended with `_normal`
1022
+ * to return a 48x48px image. In order to retrieve the original-sized image,
1023
+ * remove the `_normal` from the URL as specified in the Twitter API docs:
1024
+ * https://developer.twitter.com/en/docs/twitter-api/v1/accounts-and-users/user-profile-images-and-banners
1025
+ */
1026
+ profilePictureUrl: string | null;
1027
+ }
1028
+ /** Object representation of a user's Discord account. */
1029
+ interface Discord {
1030
+ /** The `sub` claim from the Discord-issued JWT for this account. */
1031
+ subject: string;
1032
+ /** The username associated with the Discord account. */
1033
+ username: string | null;
1034
+ /** The email associated with the Discord account. */
1035
+ email: string | null;
1036
+ }
1037
+ /** Object representation of a user's Github account. */
1038
+ interface Github {
1039
+ /** The `sub` claim from the Github-issued JWT for this account. */
1040
+ subject: string;
1041
+ /** The username associated with the Github account. */
1042
+ username: string | null;
1043
+ /** The name associated with the Github account. */
1044
+ name: string | null;
1045
+ /** The email associated with the Github account. */
1046
+ email: string | null;
1047
+ }
1048
+ /** Object representation of a user's Spotify account. */
1049
+ interface Spotify {
1050
+ /** The user id associated with the Spotify account. */
1051
+ subject: string;
1052
+ /** The email associated with the Spotify account. */
1053
+ email: string | null;
1054
+ /** The display name associated with the Spotify account. */
1055
+ name: string | null;
1056
+ }
1057
+ /** Object representation of a user's Instagram account. */
1058
+ interface Instagram {
1059
+ /** The user id associated with the Instagram account. */
1060
+ subject: string;
1061
+ /** The username associated with the Instagram account. */
1062
+ username: string | null;
1063
+ }
1064
+ /** Object representation of a user's Tiktok account. */
1065
+ interface Tiktok {
1066
+ /** The `sub` claim from the Tiktok-issued JWT for this account. */
1067
+ subject: string;
1068
+ /** The username associated with the Tiktok account. */
1069
+ username: string | null;
1070
+ /** The display name associated with the Tiktok account. */
1071
+ name: string | null;
1072
+ }
1073
+ /** Object representation of a user's LinkedIn account. */
1074
+ interface LinkedIn {
1075
+ /** The `sub` claim from the LinkedIn-issued JWT for this account. */
1076
+ subject: string;
1077
+ /** The name associated with the LinkedIn account. */
1078
+ name: string | null;
1079
+ /** The email associated with the LinkedIn account. */
1080
+ email: string | null;
1081
+ /** The vanityName/profile URL associated with the LinkedIn account. */
1082
+ vanityName: string | null;
1083
+ }
1084
+ /** Object representation of a user's Apple account. */
1085
+ interface Apple {
1086
+ /** The `sub` claim from the Apple-issued JWT for this account. */
1087
+ subject: string;
1088
+ /** The email associated with the Apple account. */
1089
+ email: string;
1090
+ }
1091
+ interface CustomJwtAccount {
1092
+ /** The user ID given by the custom auth provider */
1093
+ customUserId: string;
1094
+ }
1095
+ interface Farcaster {
1096
+ /** The Farcaster on-chain FID */
1097
+ fid: number | null;
1098
+ /** The Farcaster ethereum address that owns the FID */
1099
+ ownerAddress: string;
1100
+ /** The Farcaster protocol username */
1101
+ username: string | null;
1102
+ /** The Farcaster protocol display name */
1103
+ displayName: string | null;
1104
+ /** The Farcaster protocol bio */
1105
+ bio: string | null;
1106
+ /** The Farcaster protocol profile picture */
1107
+ pfp: string | null;
1108
+ /** The Farcaster protocol profile url */
1109
+ url: string | null;
1110
+ /** The public key of the signer, if set. This is not guaranteed to be valid, as the user can revoke the key at any time */
1111
+ signerPublicKey: string | null;
1112
+ }
1113
+ interface Telegram {
1114
+ /** The user ID that owns this Telegram account. */
1115
+ telegramUserId: string;
1116
+ /** The first name of the user . */
1117
+ firstName: string | null;
1118
+ /** The last name of the user . */
1119
+ lastName: string | null;
1120
+ /** The username associated with the Telegram account. */
1121
+ username: string | null;
1122
+ /** The url of the user's profile picture. */
1123
+ photoUrl: string | null;
1124
+ }
1125
+ interface Passkey {
1126
+ /** The passkey credential ID */
1127
+ credentialId: string;
1128
+ /** Whether or not this passkey can be used for MFA */
1129
+ enrolledInMfa: boolean;
1130
+ /** The type of authenticator holding the passkey */
1131
+ authenticatorName?: string;
1132
+ /** Metadata about the device that registered the passkey */
1133
+ createdWithDevice?: string;
1134
+ /** Metadata about the OS that registered the passkey */
1135
+ createdWithOs?: string;
1136
+ /** Metadata about the browser that registered the passkey */
1137
+ createdWithBrowser?: string;
1138
+ }
1139
+ /** Metadata about the provider app for a cross-app account */
1140
+ interface ProviderAppMetadata {
1141
+ /** Privy app ID for the provider app. */
1142
+ id: string;
1143
+ /** Name for the provider app. */
1144
+ name?: string;
1145
+ /** Logo URL for the provider app. */
1146
+ logoUrl?: string;
1147
+ }
1148
+ interface CrossAppAccount {
1149
+ /** The user's embedded wallet address(es) from the provider app */
1150
+ embeddedWallets: {
1151
+ address: string;
1152
+ }[];
1153
+ smartWallets: {
1154
+ address: string;
1155
+ }[];
1156
+ providerApp: ProviderAppMetadata;
1157
+ subject: string;
1158
+ }
1159
+ /** Object representation of a user's email, with additional metadata for advanced use cases. */
1160
+ interface EmailWithMetadata extends LinkMetadata, Email {
1161
+ /** Denotes that this is an email account. */
1162
+ type: 'email';
1163
+ }
1164
+ /** Object representation of a user's phone number, with additional metadata for advanced use cases. */
1165
+ interface PhoneWithMetadata extends LinkMetadata, Phone {
1166
+ /** Denotes that this is a phone account. */
1167
+ type: 'phone';
1168
+ }
1169
+ /** Object representation of a user's wallet, with additional metadata for advanced use cases. */
1170
+ interface WalletWithMetadata extends LinkMetadata, Wallet {
1171
+ /** Denotes that this is a wallet account. */
1172
+ type: 'wallet';
1173
+ }
1174
+ interface SmartWalletWithMetadata extends LinkMetadata, SmartWallet {
1175
+ /** Denotes that this is a smart wallet account. */
1176
+ type: 'smart_wallet';
1177
+ }
1178
+ /** Object representation of a user's Google Account, with additional metadata for advanced use cases. */
1179
+ interface GoogleOAuthWithMetadata extends LinkMetadata, Google {
1180
+ /** Denotes that this is a Google account. */
1181
+ type: 'google_oauth';
1182
+ }
1183
+ /** Object representation of a user's Twitter Account, with additional metadata for advanced use cases. */
1184
+ interface TwitterOAuthWithMetadata extends LinkMetadata, Twitter {
1185
+ /** Denotes that this is a Twitter account. */
1186
+ type: 'twitter_oauth';
1187
+ }
1188
+ /** Object representation of a user's Discord Account, with additional metadata for advanced use cases. */
1189
+ interface DiscordOAuthWithMetadata extends LinkMetadata, Discord {
1190
+ /** Denotes that this is a Discord account. */
1191
+ type: 'discord_oauth';
1192
+ }
1193
+ /** Object representation of a user's Github Account, with additional metadata for advanced use cases. */
1194
+ interface GithubOAuthWithMetadata extends LinkMetadata, Github {
1195
+ /** Denotes that this is a Github account. */
1196
+ type: 'github_oauth';
1197
+ }
1198
+ /** Object representation of a user's Tiktok Account, with additional metadata for advanced use cases. */
1199
+ interface SpotifyOAuthWithMetadata extends LinkMetadata, Spotify {
1200
+ /** Denotes that this is a Tiktok account. */
1201
+ type: 'spotify_oauth';
1202
+ }
1203
+ /** Object representation of a user's Instagram Account, with additional metadata for advanced use cases. */
1204
+ interface InstagramOAuthWithMetadata extends LinkMetadata, Instagram {
1205
+ /** Denotes that this is a Instagram account. */
1206
+ type: 'instagram_oauth';
1207
+ }
1208
+ /** Object representation of a user's Tiktok Account, with additional metadata for advanced use cases. */
1209
+ interface TiktokOAuthWithMetadata extends LinkMetadata, Tiktok {
1210
+ /** Denotes that this is a Tiktok account. */
1211
+ type: 'tiktok_oauth';
1212
+ }
1213
+ /** Object representation of a user's LinkedIn Account, with additional metadata for advanced use cases. */
1214
+ interface LinkedInOAuthWithMetadata extends LinkMetadata, LinkedIn {
1215
+ /** Denotes that this is a LinkedIn account. */
1216
+ type: 'linkedin_oauth';
1217
+ }
1218
+ /** Object representation of a user's Apple Account, with additional metadata for advanced use cases. */
1219
+ interface AppleOAuthWithMetadata extends LinkMetadata, Apple {
1220
+ /** Denotes that this is a Apple account. */
1221
+ type: 'apple_oauth';
1222
+ }
1223
+ /** Object representation of a user's Custom JWT Account, with additional metadata for advanced use cases. */
1224
+ interface CustomJwtAccountWithMetadata extends LinkMetadata, CustomJwtAccount {
1225
+ /** Denotes that this is an custom account. */
1226
+ type: 'custom_auth';
1227
+ }
1228
+ /** Object representation of a user's Farcaster Account, with additional metadata for advanced use cases. */
1229
+ interface FarcasterWithMetadata extends LinkMetadata, Farcaster {
1230
+ /** Denotes that this is a Farcaster account. */
1231
+ type: 'farcaster';
1232
+ }
1233
+ /** Object representation of a user's Passkey Account, with additional metadata for advanced use cases. */
1234
+ interface PasskeyWithMetadata extends LinkMetadata, Passkey {
1235
+ /** Denotes that this is a Passkey account. */
1236
+ type: 'passkey';
1237
+ }
1238
+ /** Object representation of a user's Telegram Account, with additional metadata for advanced use cases. */
1239
+ interface TelegramWithMetadata extends LinkMetadata, Telegram {
1240
+ /** Denotes that this is a Telegram account. */
1241
+ type: 'telegram';
1242
+ }
1243
+ /** Object representation of a user's cross-app account, with additional metadata for advanced use cases. */
1244
+ interface CrossAppAccountWithMetadata extends LinkMetadata, CrossAppAccount {
1245
+ /** Denotes that this is a cross-app account */
1246
+ type: 'cross_app';
1247
+ }
1248
+ /**
1249
+ * Object representation of a user's linked accounts
1250
+ */
1251
+ type LinkedAccountWithMetadata = WalletWithMetadata | SmartWalletWithMetadata | EmailWithMetadata | PhoneWithMetadata | GoogleOAuthWithMetadata | TwitterOAuthWithMetadata | DiscordOAuthWithMetadata | GithubOAuthWithMetadata | SpotifyOAuthWithMetadata | InstagramOAuthWithMetadata | TiktokOAuthWithMetadata | LinkedInOAuthWithMetadata | AppleOAuthWithMetadata | CustomJwtAccountWithMetadata | FarcasterWithMetadata | PasskeyWithMetadata | TelegramWithMetadata | CrossAppAccountWithMetadata;
1252
+ interface User {
1253
+ /** The Privy-issued DID for the user. If you need to store additional information
1254
+ * about a user, you can use this DID to reference them. */
1255
+ id: string;
1256
+ /** The datetime of when the user was created. */
1257
+ createdAt: Date;
1258
+ /** The user's email address, if they have linked one. It cannot be linked to another user. */
1259
+ email?: Email;
1260
+ /** The user's phone number, if they have linked one. It cannot be linked to another user. */
1261
+ phone?: Phone;
1262
+ /** The user's most recently linked wallet, if they have linked at least one wallet.
1263
+ * It cannot be linked to another user.
1264
+ * This wallet is the wallet that will be used for transactions and signing if it is connected.
1265
+ **/
1266
+ wallet?: Wallet;
1267
+ /**
1268
+ * The user's smart wallet, if they have set up through the Privy Smart Wallet SDK.
1269
+ */
1270
+ smartWallet?: SmartWallet;
1271
+ /** The user's Google account, if they have linked one. It cannot be linked to another user. */
1272
+ google?: Google;
1273
+ /** The user's Twitter account, if they have linked one. It cannot be linked to another user. */
1274
+ twitter?: Twitter;
1275
+ /** The user's Discord account, if they have linked one. It cannot be linked to another user. */
1276
+ discord?: Discord;
1277
+ /** The user's Github account, if they have linked one. It cannot be linked to another user. */
1278
+ github?: Github;
1279
+ /** The user's Spotify account, if they have linked one. It cannot be linked to another user. */
1280
+ spotify?: Spotify;
1281
+ /** The user's Instagram account, if they have linked one. It cannot be linked to another user. */
1282
+ instagram?: Instagram;
1283
+ /** The user's Tiktok account, if they have linked one. It cannot be linked to another user. */
1284
+ tiktok?: Tiktok;
1285
+ /** The user's LinkedIn account, if they have linked one. It cannot be linked to another user. */
1286
+ linkedin?: LinkedIn;
1287
+ /** The user's Apple account, if they have linked one. It cannot be linked to another user. */
1288
+ apple?: Apple;
1289
+ /** The user's Farcaster account, if they have linked one. It cannot be linked to another user. */
1290
+ farcaster?: Farcaster;
1291
+ /** The user's Telegram account, if they have linked one. It cannot be linked to another user. */
1292
+ telegram?: Telegram;
1293
+ /** The list of accounts associated with this user. Each account contains additional metadata
1294
+ * that may be helpful for advanced use cases. */
1295
+ linkedAccounts: Array<LinkedAccountWithMetadata>;
1296
+ /** The list of MFA Methods associated with this user. */
1297
+ mfaMethods: Array<MfaMethod>;
1298
+ /**
1299
+ * Whether or not the user has explicitly accepted the Terms and Conditions
1300
+ * and/or Privacy Policy
1301
+ */
1302
+ hasAcceptedTerms: boolean;
1303
+ /** Whether or not the user is a guest */
1304
+ isGuest: boolean;
1305
+ /** Custom metadata field for a given user account */
1306
+ customMetadata?: Record<string, string>;
1307
+ }
1308
+ type OAuthTokens = {
1309
+ /** The OAuth provider. */
1310
+ provider: OAuthProviderType;
1311
+ /** The OAuth access token. */
1312
+ accessToken: string;
1313
+ /** The number of seconds until the OAuth access token expires. */
1314
+ accessTokenExpiresInSeconds?: number;
1315
+ /** The OAuth refresh token. */
1316
+ refreshToken?: string;
1317
+ /** The number of seconds until the OAuth refresh token expires.
1318
+ * if the refresh token is present and this field is undefined, it is assumed
1319
+ * that the refresh token does not have an expiration date
1320
+ */
1321
+ refreshTokenExpiresInSeconds?: number;
1322
+ /** The list of OAuth scopes the access token is approved for. */
1323
+ scopes?: string[];
1324
+ };
1325
+ type TelegramAuthConfiguration = {
1326
+ botId: string;
1327
+ botName: string;
1328
+ seamlessAuthEnabled: boolean;
1329
+ };
1330
+ type FundingMethod = 'moonpay' | 'coinbase-onramp' | 'external';
1331
+ type FundingConfig = {
1332
+ /** The recommended currency for the user to fund. Note: to begin with we default to the chain's native currency. */
1333
+ defaultRecommendedCurrency: {
1334
+ chain: string;
1335
+ asset?: 'native-currency' | 'USDC';
1336
+ };
1337
+ /** The recommended amount of the specified currency to fund, in human readable format (eg '0.1') */
1338
+ defaultRecommendedAmount: string;
1339
+ /** The list of funding methods enabled for the app */
1340
+ methods: FundingMethod[];
1341
+ /** Whether to prompt the user to fund upon embedded wallet creation */
1342
+ promptFundingOnWalletCreation: boolean;
1343
+ };
1344
+ type PrivyServerConfig = {
1345
+ id?: string;
1346
+ name?: string;
1347
+ verificationKey?: string;
1348
+ showWalletLoginFirst?: boolean;
1349
+ allowlistConfig: AllowlistConfig;
1350
+ walletAuth?: boolean;
1351
+ emailAuth?: boolean;
1352
+ smsAuth?: boolean;
1353
+ googleOAuth?: boolean;
1354
+ twitterOAuth?: boolean;
1355
+ discordOAuth?: boolean;
1356
+ githubOAuth?: boolean;
1357
+ spotifyOAuth?: boolean;
1358
+ instagramOAuth?: boolean;
1359
+ tiktokOAuth?: boolean;
1360
+ linkedinOAuth?: boolean;
1361
+ appleOAuth?: boolean;
1362
+ farcasterAuth?: boolean;
1363
+ passkeyAuth?: boolean;
1364
+ telegramAuth?: boolean;
1365
+ termsAndConditionsUrl: string | null;
1366
+ privacyPolicyUrl: string | null;
1367
+ requireUsersAcceptTerms?: boolean;
1368
+ createdAt?: Date;
1369
+ updatedAt?: Date;
1370
+ customApiUrl?: string | null;
1371
+ walletConnectCloudProjectId?: string | null;
1372
+ embeddedWalletConfig: EmbeddedWalletsConfig;
1373
+ fiatOnRampEnabled?: boolean;
1374
+ captchaEnabled?: boolean;
1375
+ captchaSiteKey: string;
1376
+ enforceWalletUis?: boolean;
1377
+ legacyWalletUiConfig?: boolean;
1378
+ /** May be deprecated from the server config in a future release */
1379
+ logoUrl?: string;
1380
+ /** May be deprecated from the server config in a future release */
1381
+ accentColor?: string;
1382
+ mfaMethods?: Array<MfaMethod>;
1383
+ telegramAuthConfiguration?: TelegramAuthConfiguration;
1384
+ fundingConfig?: FundingConfig;
1385
+ };
1386
+ type HexColor = `#${string}`;
1387
+ /**
1388
+ * Options to customize the display of transaction prices in the embedded wallet's transaction prompt.
1389
+ */
1390
+ type PriceDisplayOptions = {
1391
+ primary: 'fiat-currency';
1392
+ secondary: 'native-token';
1393
+ } | {
1394
+ primary: 'native-token';
1395
+ secondary: null;
1396
+ };
1397
+ type WalletListEntry = 'metamask' | 'coinbase_wallet' | 'rainbow' | 'phantom' | 'zerion' | 'cryptocom' | 'uniswap' | 'okx_wallet' | 'detected_wallets' | 'wallet_connect' | 'rabby_wallet' | 'safe';
1398
+ type NonEmptyArray<T> = [T, ...T[]];
1399
+ type LoginMethodOrderOption = 'email' | 'sms' | WalletListEntry | OAuthProviderType | 'farcaster' | 'telegram';
1400
+ type ExternalWalletsConfig = {
1401
+ /**
1402
+ * Options to configure connections to the Coinbase Wallet (browser extension wallet, mobile wallet, and
1403
+ * passkey-based smart wallet).
1404
+ *
1405
+ * @experimental This is an experimental config designed to give Privy developers a way to test the Coinbase Smart Wallet
1406
+ * ahead of its mainnet launch. The smart wallet currently only supports the Base Sepolia testnet. In kind, DO NOT use this
1407
+ * configuration in production as it will prevent users from using the Coinbase Wallet on networks other than Base Sepolia.
1408
+ */
1409
+ coinbaseWallet?: {
1410
+ /**
1411
+ * Whether Coinbase wallet connections should prompt the smart wallet, the extension wallet, or intelligently decide between the two.
1412
+ * - If 'eoaOnly', Coinbase wallet connections will only prompt the Coinbase wallet browser extension or mobile app (an externally-owned account)
1413
+ * - If 'smartWalletOnly', Coinbase wallet connections will only prompt the Coinbase smart wallet and will not allow users to use the extension or mobile app.
1414
+ * DO NOT use this setting in production.
1415
+ * - If 'all', Coinbase wallet connections will prompt the Coinbase wallet browser extension if it is detected as installed, and will otherwise prompt the smart wallet.
1416
+ */
1417
+ connectionOptions: 'all' | 'eoaOnly' | 'smartWalletOnly';
1418
+ };
1419
+ /**
1420
+ * Options to configure WalletConnect behavior.
1421
+ *
1422
+ * @experimental This may change in future releases
1423
+ */
1424
+ walletConnect?: {
1425
+ /**
1426
+ * If disabled, stops WalletConnect from being initialized by the Privy SDK.
1427
+ *
1428
+ * WARNING: If you allow WalletConnect or WalletConnect-powered wallets, this will cause issues.
1429
+ *
1430
+ * Note that even if disabled, WalletConnect code may still be loaded in the browser. Defaults to true.
1431
+ *
1432
+ * @experimental This feature is very experimental and may break your wallet connector experience if you use external wallets.
1433
+ */
1434
+ enabled: boolean;
1435
+ };
1436
+ solana?: {
1437
+ connectors?: SolanaWalletConnectorsConfig;
1438
+ };
1439
+ };
1440
+ interface PrivyClientConfig {
1441
+ /** All UI and theme related configuration */
1442
+ appearance?: {
1443
+ /** Primary theme for the privy UI. This dictates the foreground and background colors within the UI.
1444
+ *
1445
+ * 'light' (default): The privy default light UI.
1446
+ * 'dark': The privy default dark UI.
1447
+ * custom hex code (i.e. '#13152F'): A custom background. This will generate the remainder of the foreground and
1448
+ * background colors for the UI by modulating the luminance of the passed color. This value should be _either_ dark
1449
+ * or light (<20% or >80% luminance), for accessibility. */
1450
+ theme?: 'light' | 'dark' | HexColor;
1451
+ /** Accent color for the privy UI.
1452
+ * Used for buttons, active borders, etc. This will generate light and dark variants.
1453
+ * This overrides the server setting `accent_color`. */
1454
+ accentColor?: HexColor;
1455
+ /** Logo for the main privy modal screen.
1456
+ * This can be a string (url) or an img / svg react element.
1457
+ * If passing an element, Privy will overwrite the `style` props, to ensure proper rendering.
1458
+ * This overrides the server setting `logo_url` */
1459
+ logo?: string | ReactElement;
1460
+ /**
1461
+ * Header text for the landing screen of the Privy login modal. We strongly recommend using a string
1462
+ * of length 35 or less. Strings longer than the width of the login modal will be ellipsified.
1463
+ *
1464
+ * Defaults to 'Log in or sign up'.
1465
+ */
1466
+ landingHeader?: string;
1467
+ /**
1468
+ * Subtitle text for the landing screen of the Privy login modal.
1469
+ *
1470
+ * This text will renders below the logo and will be capped at 100 characters.
1471
+ *
1472
+ * Defaults to undefined.
1473
+ */
1474
+ loginMessage?: string;
1475
+ /** Determines the order of the login options in the privy modal. If true, the wallet login will render above
1476
+ * social and email / sms login options.
1477
+ * This overrides the server setting `show_wallet_login_first` */
1478
+ showWalletLoginFirst?: boolean;
1479
+ /**
1480
+ * An array of {@link WalletListEntry wallet names} to configure the wallet buttons shown within
1481
+ * the `login`, `connectWallet`, and `linkWallet` modals. Privy will show buttons for each option
1482
+ * present in the list, in the order in which they are configured.
1483
+ *
1484
+ * On 'detected_wallets':
1485
+ * - This option serves as a fallback to include all wallets that detected by Privy, that might not be
1486
+ * individually configured in the `walletList`. Browser extension wallets that are not explicitly configured
1487
+ * in the `walletList` will fall into this category.
1488
+ * - If Privy detects a wallet, _and_ that wallet is configured within the `walletList` (e.g. 'metamask'),
1489
+ * the order of the wallet's explicit name (e.g. 'metamask') in the `walletList` will take priority
1490
+ * over the order of 'detected_wallets'.
1491
+ *
1492
+ * Defaults to ['detected_wallets', 'metamask', 'coinbase', 'rainbow', 'wallet_connect']
1493
+ *
1494
+ * @default ['detected_wallets', 'metamask', 'coinbase', 'rainbow', 'wallet_connect']
1495
+ */
1496
+ walletList?: WalletListEntry[];
1497
+ /**
1498
+ * Determines which external wallet types to show in the modal. By default, only Ethereum external wallets
1499
+ * are shown. If you want to show Solana wallets, set this to 'solana-only' or 'ethereum-and-solana'.
1500
+ *
1501
+ * When 'ethereum-and-solana' is set, Solana wallets will have a badge indicating that they are Solana wallets.
1502
+ *
1503
+ * @defaults 'ethereum-only'
1504
+ */
1505
+ walletChainType?: 'ethereum-only' | 'solana-only' | 'ethereum-and-solana';
1506
+ };
1507
+ /**
1508
+ * Login methods for the privy modal.
1509
+ *
1510
+ * This parameter enables you to display a subset of the login methods specified in the developer dashboard. `loginMethods` cannot be an empty array if specified. The order of this array does not dictate order of the login methods in the UI.
1511
+ *
1512
+ * Note that any login method included in this parameter must also be enabled as a login method in the developer dashboard.
1513
+ *
1514
+ * If both `loginMethodsAndOrder` and `loginMethods` are defined, `loginMethodsAndOrder` will take precedence.
1515
+ */
1516
+ loginMethods?: Array<'wallet' | 'email' | 'sms' | 'google' | 'twitter' | 'discord' | 'github' | 'linkedin' | 'spotify' | 'instagram' | 'tiktok' | 'apple' | 'farcaster' | 'telegram'>;
1517
+ /**
1518
+ * Login methods for the Privy modal. _This will override carefully designed defaults and should be used with caution._
1519
+ *
1520
+ * This parameter enables you to display a subset of the login methods specified in the developer dashboard. Login methods will be rendered in the order they appear in the array. The first 4 options specified in the `primary` list will render on the default screen of the login experience. Options in the `overflow` list will appear on the following screen.
1521
+ *
1522
+ * Note that any login method included in this parameter must also be enabled as a login method in the developer dashboard.
1523
+ *
1524
+ * If both `loginMethodsAndOrder` and `loginMethods` are defined, `loginMethodsAndOrder` will take precedence.
1525
+ */
1526
+ loginMethodsAndOrder?: {
1527
+ primary: NonEmptyArray<LoginMethodOrderOption>;
1528
+ overflow?: Array<LoginMethodOrderOption>;
1529
+ };
1530
+ /** Options for internationalization of the privy modal */
1531
+ intl?: {
1532
+ /**
1533
+ * This property is used to configure formatting and validation for the phone number input
1534
+ * used when `phone` is enabled as a login method. Must be a valid
1535
+ * [two-leter ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) (e.g. 'US').
1536
+ * Defaults to 'US'.
1537
+ *
1538
+ * @default 'US'
1539
+ */
1540
+ defaultCountry: CountryCode;
1541
+ };
1542
+ /**
1543
+ * This property is only required for apps that use a third-party authentication provider.
1544
+ */
1545
+ customAuth?: {
1546
+ /**
1547
+ * If true, enable custom authentication integration.
1548
+ * This enables a JWT from a custom auth provider to be used to authenticate Privy embedded wallets.
1549
+ * Defaults to true.
1550
+ *
1551
+ * @default true
1552
+ */
1553
+ enabled?: boolean;
1554
+ /**
1555
+ * A callback that returns the user's custom auth provider's access token as a string.
1556
+ * Can be left blank if using cookies to store and send access tokens
1557
+ *
1558
+ * @example
1559
+ * const {getAccessTokenSilently} = useAuth();
1560
+ *
1561
+ * <PrivyProvider
1562
+ * {...props}
1563
+ * config={{
1564
+ * customAuth: {
1565
+ * getCustomAccessToken: getAccessTokenSilently
1566
+ * },
1567
+ * }}
1568
+ * />
1569
+ */
1570
+ getCustomAccessToken: () => Promise<string | undefined>;
1571
+ /**
1572
+ * Custom auth providers loading state
1573
+ *
1574
+ * @example
1575
+ * const {isLoading} = useAuth();
1576
+ *
1577
+ * <PrivyProvider
1578
+ * {...props}
1579
+ * config={{
1580
+ * customAuth: {
1581
+ * isLoading,
1582
+ * },
1583
+ * }}
1584
+ * />
1585
+ */
1586
+ isLoading: boolean;
1587
+ };
1588
+ /** All legal configuration */
1589
+ legal?: {
1590
+ /** URL to the terms and conditions page for your application.
1591
+ * Rendered as a link in the privy modal footer.
1592
+ * This overrides the server setting `terms_and_conditions_url` */
1593
+ termsAndConditionsUrl?: string | null;
1594
+ /** URL to the privacy policy page for your application.
1595
+ * Rendered as a link in the privy modal footer.
1596
+ * This overrides the server setting `privacy_policy_url` */
1597
+ privacyPolicyUrl?: string | null;
1598
+ };
1599
+ walletConnectCloudProjectId?: string;
1600
+ /**
1601
+ * @deprecated use `supportedChains[number].rpcUrls.privyWalletOverride` instead.
1602
+ *
1603
+ * RPC overrides to customize RPC URLs and timeout durations.
1604
+ */
1605
+ rpcConfig?: RpcConfig;
1606
+ /**
1607
+ * @deprecated use `supportedChains` instead.
1608
+ *
1609
+ */
1610
+ additionalChains?: Chain[];
1611
+ /**
1612
+ * A list of supported chains, used to specify which chains should be used throughout the application.
1613
+ *
1614
+ * Calling `sendTransaction` or `switchChain` on an unsupported network will throw an error.
1615
+ *
1616
+ * For external wallets, if the wallet's current chain post-connection (during connect-only or siwe flows)
1617
+ * is not within the supported chains list, the user will be prompted to switch to the `defaultChain` (if set) or first supplied. If the chain
1618
+ * switching process does not fully succeed, the user will **not** be blocked from the application (and the wallet's current `chainId` can always
1619
+ * be observed and acted upon accordingly).
1620
+ *
1621
+ * For embedded wallets, the wallet will automatically default to the `defaultChain` (if set) or first supplied `supportedChain`.
1622
+ */
1623
+ supportedChains?: Chain[];
1624
+ /**
1625
+ * When supplied, the `defaultChain` will be the default chain used throughout the application.
1626
+ *
1627
+ * For external wallets, it will be used if the user's wallet it not within the `supportedChains` (or default chains) list.
1628
+ *
1629
+ * For embedded wallets, it will be used upon initialization, when the user hasn't switched to another supported chain.
1630
+ */
1631
+ defaultChain?: Chain;
1632
+ captchaEnabled?: boolean;
1633
+ /**
1634
+ * Options for connecting to external wallets like Coinbase Wallet, MetaMask, etc.
1635
+ *
1636
+ * @experimental This is an experimental config that is subject to breaking changes without a major version bump of the SDK.
1637
+ */
1638
+ externalWallets?: ExternalWalletsConfig;
1639
+ /** All embedded wallets configuration */
1640
+ embeddedWallets?: {
1641
+ /**
1642
+ * Whether an embedded wallet should be created for the user on login. This overrides the
1643
+ * deprecated `createPrivyWalletOnLogin`.
1644
+ *
1645
+ * For `all-users`, the user will be prompted to create a Privy wallet after successfully
1646
+ * logging in. If they cancel or are visiting after this flag was put in place, they will be
1647
+ * prompted to create a wallet on their next login.
1648
+ *
1649
+ * For `users-without-wallets`, the user will be prompted to create a Privy wallet after\
1650
+ * successfully logging in, only if they do not currently have any wallet associated with their
1651
+ * user object - for example if they have linked an external wallet.
1652
+ *
1653
+ * For `off`, an embedded wallet is not created during login. You can always prompt the user to
1654
+ * create one manually with your app.
1655
+ *
1656
+ * Defaults to 'off'.
1657
+ */
1658
+ createOnLogin?: EmbeddedWalletCreateOnLoginConfig;
1659
+ /**
1660
+ * @deprecated. Instead, use the server-driven configuration found in the Privy console: https://dashboard.privy.io/apps/YOUR_APP_ID/embedded. This client-side setting
1661
+ * is currently honored, but will be fully removed in a future release.
1662
+ *
1663
+ * If true, Privy will prompt users to create a password for their Privy embedded wallet.
1664
+ * If false, embedded wallets will be created without the need of password.
1665
+ *
1666
+ * Defaults to false.
1667
+ */
1668
+ requireUserPasswordOnCreate?: boolean;
1669
+ /**
1670
+ * @deprecated. Instead, use the server-driven configuration found in the Privy console: https://dashboard.privy.io/apps/YOUR_APP_ID/embedded.
1671
+ * If true, Privy will not prompt or instantiate any UI for embedded wallet signatures and transactions.
1672
+ * If false, embedded wallet actions will raise a modal and require user confirmation to proceed.
1673
+ *
1674
+ * Defaults to false.
1675
+ */
1676
+ noPromptOnSignature?: boolean;
1677
+ /**
1678
+ * @experimental
1679
+ *
1680
+ * **This setting is only honored when using the EIP-1193 Ethereum Provider to interface
1681
+ * with the embedded wallet, i.e. using `getEthereumProvider` or `getEthersProvider`.
1682
+ * This setting is only honored when used alongside `noPromptOnSignature: true`**
1683
+ *
1684
+ * If true, calls to `sendTransaction` will wait for the transaction to be confirmed before resolving.
1685
+ * If false, calls to `sendTransaction` will resolve once the transaction has been submitted.
1686
+ *
1687
+ * Defaults to true.
1688
+ *
1689
+ * @example
1690
+ * <PrivyProvider
1691
+ * config={{
1692
+ * embeddedWallets: {
1693
+ * noPromptOnSignature: true,
1694
+ * waitForTransactionConfirmation: false,
1695
+ * },
1696
+ * }}
1697
+ * >
1698
+ * {children}
1699
+ * </PrivyProvider>
1700
+ */
1701
+ waitForTransactionConfirmation?: boolean;
1702
+ /**
1703
+ * Options to customize the display of transaction prices in the embedded wallet's transaction
1704
+ * prompt. You may configure a primary currency to emphasize, and a secondary currency to show
1705
+ * as subtext. Defaults to emphasizing the price in fiat currency, and showing the price in the native
1706
+ * token as subtext.
1707
+ *
1708
+ * You may either set:
1709
+ * - `{primary: 'fiat-currency', secondary: 'native-token'}` to emphasize fiat currency prices, showing native token
1710
+ * prices as subtext. This is the default.
1711
+ * - `{secondary: 'native-token', secondary: null}` to show native token prices only, with no subtext.
1712
+ *
1713
+ * Privy does not currently support:
1714
+ * - emphasizing native token prices over fiat currency prices
1715
+ * - showing prices only in fiat currency, without native token prices
1716
+ *
1717
+ */
1718
+ priceDisplay?: PriceDisplayOptions;
1719
+ };
1720
+ /**
1721
+ * All multi-factor authentication configuration
1722
+ */
1723
+ mfa?: {
1724
+ /**
1725
+ * If true, Privy will not prompt or instantiate any UI for MFA Verification. The developer
1726
+ * must handle MFA verification themselves.
1727
+ * If false, any action that requires MFA will raise a modal and require user to verify MFA
1728
+ * before proceeding.
1729
+ *
1730
+ * Defaults to false.
1731
+ */
1732
+ noPromptOnMfaRequired?: boolean;
1733
+ };
1734
+ /**
1735
+ * @deprecated. Use `fundingMethodConfigurations -> moonpay -> useSandbox` instead.
1736
+ * Setting associated with fiat-on-ramp flows
1737
+ */
1738
+ fiatOnRamp?: {
1739
+ /**
1740
+ * Determines whether to use the sandbox flow.
1741
+ *
1742
+ * Defaults to false.
1743
+ */
1744
+ useSandbox?: boolean;
1745
+ };
1746
+ /**
1747
+ * Settings associated with funding methods
1748
+ */
1749
+ fundingMethodConfig?: {
1750
+ moonpay: {
1751
+ /**
1752
+ * Determines whether to use the Moonpay sandbox flow.
1753
+ *
1754
+ * Defaults to false.
1755
+ */
1756
+ useSandbox?: boolean;
1757
+ /**
1758
+ * Determines the payment method for each Moonpay transaction.
1759
+ *
1760
+ * Defaults to Moonpay's default.
1761
+ */
1762
+ paymentMethod?: MoonpayPaymentMethod;
1763
+ /**
1764
+ * Determines the UI settings for each Moonpay transaction.
1765
+ *
1766
+ * Defaults to Moonpay's default.
1767
+ */
1768
+ uiConfig?: MoonpayUiConfig;
1769
+ };
1770
+ };
1771
+ }
1772
+ /**
1773
+ * The data received from Telegram when the user is authenticated.
1774
+ *
1775
+ * @see https://core.telegram.org/widgets/login#receiving-authorization-data
1776
+ */
1777
+ interface TelegramAuthResult {
1778
+ id: number;
1779
+ first_name: string;
1780
+ auth_date: number;
1781
+ hash: string;
1782
+ last_name?: string;
1783
+ photo_url?: string;
1784
+ username?: string;
1785
+ }
1786
+ /**
1787
+ * Data received from an OAuth user endpoint
1788
+ */
1789
+ interface OAuthUserInfo {
1790
+ subject: string;
1791
+ username?: string;
1792
+ name?: string;
1793
+ email?: string;
1794
+ profilePictureUrl?: string;
1795
+ vanityName?: string;
1796
+ }
1797
+ /**
1798
+ * Object representation of metadata reported by a connected wallet during the SIWE flow
1799
+ */
1800
+ interface SiweWalletMetadata {
1801
+ walletClientType: WalletClientType;
1802
+ chainId: string;
1803
+ connectorType: string;
1804
+ }
1805
+ /**
1806
+ * Configuration for the Privy Smart Wallet SDK.
1807
+ * This configuration is used to enable the Smart Wallet SDK and configure the networks that the Smart Wallet will be used on.
1808
+ * This is internal so changes to this do not count as breaking API changes.
1809
+ */
1810
+ type SmartWalletConfig = {
1811
+ enabled: false;
1812
+ } | {
1813
+ enabled: true;
1814
+ smartWalletType: SmartWalletType;
1815
+ configuredNetworks: SmartWalletNetworkConfig[];
1816
+ };
1817
+ type SmartWalletNetworkConfig = {
1818
+ chainId: string;
1819
+ bundlerUrl: string;
1820
+ paymasterUrl?: string;
1821
+ };
1822
+ interface AllowlistConfig {
1823
+ errorTitle: string | null;
1824
+ errorDetail: string | null;
1825
+ errorCtaText: string | null;
1826
+ errorCtaLink: string | null;
1827
+ }
1828
+ type EmbeddedWalletCreateOnLoginConfig = 'users-without-wallets' | 'all-users' | 'off';
1829
+ interface EmbeddedWalletsConfig {
1830
+ createOnLogin: EmbeddedWalletCreateOnLoginConfig;
1831
+ requireUserOwnedRecoveryOnCreate: boolean;
1832
+ userOwnedRecoveryOptions: UserRecoveryMethod[];
1833
+ }
1834
+ type OtpFlowState = {
1835
+ status: 'initial';
1836
+ } | {
1837
+ status: 'error';
1838
+ error: Error | null;
1839
+ } | {
1840
+ status: 'sending-code';
1841
+ } | {
1842
+ status: 'awaiting-code-input';
1843
+ } | {
1844
+ status: 'submitting-code';
1845
+ } | {
1846
+ status: 'done';
1847
+ };
1848
+ type PasskeyFlowState = {
1849
+ status: 'initial';
1850
+ } | {
1851
+ status: 'error';
1852
+ error: Error | null;
1853
+ } | {
1854
+ status: 'generating-challenge';
1855
+ } | {
1856
+ status: 'awaiting-passkey';
1857
+ } | {
1858
+ status: 'submitting-response';
1859
+ } | {
1860
+ status: 'done';
1861
+ };
1862
+ type SiweFlowState = {
1863
+ status: 'initial';
1864
+ } | {
1865
+ status: 'error';
1866
+ error: Error | null;
1867
+ } | {
1868
+ status: 'generating-message';
1869
+ } | {
1870
+ status: 'awaiting-signature';
1871
+ } | {
1872
+ status: 'submitting-signature';
1873
+ } | {
1874
+ status: 'done';
1875
+ };
1876
+ type OAuthFlowState = {
1877
+ status: 'initial';
1878
+ } | {
1879
+ status: 'loading';
1880
+ } | {
1881
+ status: 'done';
1882
+ } | {
1883
+ status: 'error';
1884
+ error: Error | null;
1885
+ };
1886
+ /**
1887
+ * UI configuration object for the embedded wallet's Sign Message screen
1888
+ */
1889
+ type SignMessageModalUIOptions = {
1890
+ /**
1891
+ * Title for the Sign Message screen. Defaults to 'Sign'.
1892
+ */
1893
+ title?: string;
1894
+ /**
1895
+ * Description text for the Sign Message screen. Defaults to
1896
+ * 'Sign to continue'.
1897
+ */
1898
+ description?: string;
1899
+ /**
1900
+ * Text for the CTA button on the Sign Message screen. Defaults to
1901
+ * 'Sign and Continue'
1902
+ */
1903
+ buttonText?: string;
1904
+ /**
1905
+ * An icon to display on the Sign Message screen. Defaults to no icon.
1906
+ */
1907
+ iconUrl?: string;
1908
+ };
1909
+ type MessageTypeProperty = {
1910
+ name: string;
1911
+ type: string;
1912
+ };
1913
+ type MessageTypes = {
1914
+ [additionalProperties: string]: MessageTypeProperty[];
1915
+ };
1916
+ /**
1917
+ * JSON Object that conforms to the EIP-712 [`TypedData JSON schema.`](https://eips.ethereum.org/EIPS/eip-712#specification-of-the-eth_signtypeddata-json-rpc)
1918
+ *
1919
+ */
1920
+ type TypedMessage<T extends MessageTypes> = {
1921
+ types: T;
1922
+ primaryType: keyof T;
1923
+ domain: {
1924
+ name?: string;
1925
+ version?: string;
1926
+ chainId?: number;
1927
+ verifyingContract?: string;
1928
+ salt?: ArrayBuffer;
1929
+ };
1930
+ message: Record<string, unknown>;
1931
+ };
1932
+ /**
1933
+ * JSON Object that conforms to the EIP-712 [`TypedData JSON schema.`](https://eips.ethereum.org/EIPS/eip-712#specification-of-the-eth_signtypeddata-json-rpc)
1934
+ * See [`TypedMessage`](TypedMessage) for specs on the specific params of typedData.
1935
+ */
1936
+ type SignTypedDataParams = TypedMessage<MessageTypes>;
1937
+ /**
1938
+ * UI customization object for additional transaction details. Will be shown
1939
+ * in an expandable accordion in the Send Transaction screen.
1940
+ */
1941
+ type TransactionUIOptions = {
1942
+ /**
1943
+ * Title for the transaction details accordion within the
1944
+ * Send Transaction screen. Defaults to 'Details'.
1945
+ */
1946
+ title?: string;
1947
+ /**
1948
+ * Action that the user is taking when sending this transaction. This
1949
+ * should be short (<4 words, e.g. 'Buy NFT'). Will be shown inside
1950
+ * the transaction details accordion in Send Transaction screen.
1951
+ */
1952
+ action?: string;
1953
+ /**
1954
+ * If the transaction to be sent is a call to a smart contract, you may
1955
+ * use this object to fill in additional details about the contract being called.
1956
+ */
1957
+ contractInfo?: ContractUIOptions;
1958
+ /**
1959
+ * @deprecated Use `description` in `SendTransactionModalUIOptions` instead.
1960
+ */
1961
+ description?: string;
1962
+ /**
1963
+ * @deprecated Use `title` instead.
1964
+ */
1965
+ actionDescription?: string;
1966
+ };
1967
+ /**
1968
+ * If the transaction to be sent is a call to a smart contract, you may use this
1969
+ * object to fill in additional details about the contract being called.
1970
+ */
1971
+ type ContractUIOptions = {
1972
+ /**
1973
+ * URL with more information about the smart contract.
1974
+ */
1975
+ url?: string;
1976
+ /**
1977
+ * Name of smart contract being called.
1978
+ */
1979
+ name?: string;
1980
+ /**
1981
+ * URL for an image to show in the Send Transaction screen.
1982
+ */
1983
+ imgUrl?: string;
1984
+ /**
1985
+ * Alt text for the image in the Send Transaction screen, if a
1986
+ * valid `imgUrl` is set.
1987
+ */
1988
+ imgAltText?: string;
1989
+ /**
1990
+ * Size for the image in the Send Transaction screen, if a valid
1991
+ * `imgUrl` is set.
1992
+ */
1993
+ imgSize?: 'sm' | 'lg';
1994
+ /**
1995
+ * @deprecated Use `description` in `SendTransactionModalUIOptions` instead.
1996
+ */
1997
+ actionText?: string;
1998
+ };
1999
+ /**
2000
+ * UI customization object for the embedded wallet's Send Transaction screen
2001
+ */
2002
+ type SendTransactionModalUIOptions = {
2003
+ /**
2004
+ * Text to display at top of Send Transaction screen. Defaults to
2005
+ * 'Review transaction' or 'Send (insert token symbol)' if transaction
2006
+ * is a simple token transfer.
2007
+ */
2008
+ header?: string;
2009
+ /**
2010
+ * Description of the transaction being sent.
2011
+ */
2012
+ description?: string;
2013
+ /**
2014
+ * Text to show on CTA button for Send Transaction screen. Defaults to
2015
+ * 'Submit'.
2016
+ */
2017
+ buttonText?: string;
2018
+ /**
2019
+ * Details about the transaction that the user will send. Will be shown
2020
+ * in an accordion in the Send Transaction screen.
2021
+ */
2022
+ transactionInfo?: TransactionUIOptions;
2023
+ /**
2024
+ * Text to display at top of Send Transaction Success screen. Defaults to
2025
+ * 'Transaction complete!' if transaction is successful.
2026
+ */
2027
+ successHeader?: string;
2028
+ /**
2029
+ * Description of the transaction Success screen. Defaults to 'You're all set.'
2030
+ */
2031
+ successDescription?: string;
2032
+ /**
2033
+ * @deprecated Use `header` instead.
2034
+ */
2035
+ title?: string;
2036
+ /**
2037
+ * @deprecated Use `header` instead.
2038
+ */
2039
+ modalTitle?: string;
2040
+ /**
2041
+ * @deprecated Use `transactionInfo.contractInfo` instead.
2042
+ */
2043
+ senderInfo?: ContractUIOptions;
2044
+ };
2045
+ /**
2046
+ * Our external-facing `UnsignedTransactionRequest` type makes the `chainId` field optional,
2047
+ * matching ethers, wagmi, and a bunch of other libraries. However, our modal needs to be "aware"
2048
+ * of the transaction's `chainId` to ensure it does price conversion, quote labeling, etc. importantly.
2049
+ *
2050
+ * Thus, in the modal, we enforce a stricter type `UnsignedTransactionRequestWithChainId` which wraps
2051
+ * `UnsignedTransactionRequest` to make `chainId` required.
2052
+ *
2053
+ * If the developer does not set a `chainId` in their `UnsignedTransactionRequest`, we default to the embedded
2054
+ * provider's current `chainId` in `privy-provider.tsx` > `sendTransaction`
2055
+ */
2056
+ type UnsignedTransactionRequestWithChainId = UnsignedTransactionRequest & {
2057
+ chainId: number;
2058
+ };
2059
+ type LoginModalOptions = RuntimeLoginOverridableOptions;
2060
+ type ConnectWalletModalOptions = ExternalConnectWalletModalOptions;
2061
+ type PrivyFarcasterSignerInitResponse = {
2062
+ public_key: string;
2063
+ status: 'pending_approval';
2064
+ signer_approval_url: string;
2065
+ } | {
2066
+ public_key: string;
2067
+ status: 'approved';
2068
+ fid: bigint;
2069
+ } | {
2070
+ public_key: string;
2071
+ status: 'revoked';
2072
+ };
2073
+ type PrefillLoginOptions = {
2074
+ type: 'email' | 'phone';
2075
+ value: string;
2076
+ };
2077
+ /** Options for Privy's `login` method. */
2078
+ type RuntimeLoginOverridableOptions = {
2079
+ /** An array of login methods to display in the login modal. */
2080
+ loginMethods?: PrivyClientConfig['loginMethods'];
2081
+ /** Details to prefill a user's email or phone number for email or SMS login. */
2082
+ prefill?: PrefillLoginOptions;
2083
+ /**
2084
+ * Whether or not to block sign ups (only allow existing users to log in).
2085
+ */
2086
+ disableSignup?: boolean;
2087
+ };
2088
+ /** Options for Privy's `connectWallet` method */
2089
+ type ExternalConnectWalletModalOptions = {
2090
+ /**
2091
+ * An address to suggest the user to connect in Privy's UIs. This is only a suggestion for the
2092
+ * user and the method will not error if they connect a different address.
2093
+ */
2094
+ suggestedAddress?: string;
2095
+ /**
2096
+ * An array of wallet options to present the user in the connect wallet modal.
2097
+ */
2098
+ walletList?: WalletListEntry[];
2099
+ };
2100
+ /** Options for Privy's `createWallet` method */
2101
+ type CreateWalletOptions = {
2102
+ /**
2103
+ * Whether or not to create an additional Ethereum embedded wallet for a user that already has
2104
+ * an Ethereum embedded wallet. If this is set to `true` and the user does not already have an Ethereum
2105
+ * embedded wallet, `createWallet` will throw an error.
2106
+ *
2107
+ * Defaults to `false`.
2108
+ */
2109
+ createAdditional?: boolean;
2110
+ };
2111
+ type SetWalletRecoveryOptions = {};
2112
+ type CustomAuthFlowState = {
2113
+ status: 'initial';
2114
+ } | {
2115
+ status: 'loading';
2116
+ } | {
2117
+ status: 'not-enabled';
2118
+ } | {
2119
+ status: 'done';
2120
+ } | {
2121
+ status: 'error';
2122
+ error: Error | null;
2123
+ };
2124
+
2125
+ /**
2126
+ * We support a subset of the provider methods found here:
2127
+ *
2128
+ * https://ethereum.org/en/developers/docs/apis/json-rpc/#json-rpc-methods
2129
+ *
2130
+ * For now, we're focused on signing-related methods because the iframe (this code)
2131
+ * is the only place that has access to the private key and thus is the only one
2132
+ * who can create signatures. All other methods do not need the private key and
2133
+ * can therefore be implemented by clients of the iframe.
2134
+ */
2135
+
2136
+ declare const SUPPORTED_ETHEREUM_RPC_METHODS: readonly ["eth_sign", "eth_populateTransactionRequest", "eth_signTransaction", "personal_sign", "eth_signTypedData_v4", "csw_signUserOperation"];
2137
+ type EthereumRpcMethodType = (typeof SUPPORTED_ETHEREUM_RPC_METHODS)[number];
2138
+ declare const SUPPORTED_SOLANA_RPC_METHODS: string[];
2139
+ type SolanaRpcMethodType = (typeof SUPPORTED_SOLANA_RPC_METHODS)[number];
2140
+ type Quantity = string | number | bigint;
2141
+ type UnsignedTransactionRequest = {
2142
+ from?: string;
2143
+ to?: string;
2144
+ nonce?: Quantity;
2145
+ gasLimit?: Quantity;
2146
+ gasPrice?: Quantity;
2147
+ data?: ArrayLike<number> | string;
2148
+ value?: Quantity;
2149
+ chainId?: number;
2150
+ type?: number;
2151
+ accessList?: Array<{
2152
+ address: string;
2153
+ storageKeys: Array<string>;
2154
+ }> | Array<[string, Array<string>]> | Record<string, Array<string>>;
2155
+ maxPriorityFeePerGas?: Quantity;
2156
+ maxFeePerGas?: Quantity;
2157
+ };
2158
+ type TransactionLog = {
2159
+ blockNumber: number;
2160
+ blockHash: string;
2161
+ transactionIndex: number;
2162
+ removed: boolean;
2163
+ address: string;
2164
+ data: string;
2165
+ topics: Array<string>;
2166
+ transactionHash: string;
2167
+ logIndex: number;
2168
+ };
2169
+ type TransactionReceipt = {
2170
+ to: string;
2171
+ from: string;
2172
+ contractAddress: string;
2173
+ transactionIndex: number;
2174
+ root?: string;
2175
+ logs: Array<TransactionLog>;
2176
+ logsBloom: string;
2177
+ blockHash: string;
2178
+ transactionHash: string;
2179
+ blockNumber: number;
2180
+ confirmations: number;
2181
+ byzantium: boolean;
2182
+ type: number;
2183
+ status?: number;
2184
+ gasUsed: string;
2185
+ cumulativeGasUsed: string;
2186
+ effectiveGasPrice?: string;
2187
+ };
2188
+ interface BaseEthereumRpcRequestType {
2189
+ method: EthereumRpcMethodType;
2190
+ }
2191
+ interface BaseSolanaRpcRequestType {
2192
+ method: SolanaRpcMethodType;
2193
+ }
2194
+ interface eth_populateTransactionRequest extends BaseEthereumRpcRequestType {
2195
+ method: 'eth_populateTransactionRequest';
2196
+ params: [UnsignedTransactionRequest];
2197
+ }
2198
+ interface eth_populateTransactionRequestResponse {
2199
+ method: 'eth_populateTransactionRequest';
2200
+ data: UnsignedTransactionRequest;
2201
+ }
2202
+ interface eth_signTransaction extends BaseEthereumRpcRequestType {
2203
+ method: 'eth_signTransaction';
2204
+ params: [UnsignedTransactionRequest];
2205
+ }
2206
+ interface eth_sign extends BaseEthereumRpcRequestType {
2207
+ method: 'eth_sign';
2208
+ params: [address: string, message: string];
2209
+ }
2210
+ interface eth_signResponse {
2211
+ method: 'eth_sign';
2212
+ data: string;
2213
+ }
2214
+ interface personal_sign extends BaseEthereumRpcRequestType {
2215
+ method: 'personal_sign';
2216
+ params: [string, string];
2217
+ }
2218
+ interface personal_signResponse {
2219
+ method: 'personal_sign';
2220
+ data: string;
2221
+ }
2222
+ interface eth_signTransactionResponse {
2223
+ method: 'eth_signTransaction';
2224
+ data: string;
2225
+ }
2226
+ interface eth_signTypedData_v4 extends BaseEthereumRpcRequestType {
2227
+ method: 'eth_signTypedData_v4';
2228
+ params: [string, TypedMessage$1<MessageTypes$1> | string];
2229
+ }
2230
+ interface eth_signTypedData_v4Response {
2231
+ method: 'eth_signTypedData_v4';
2232
+ data: string;
2233
+ }
2234
+ interface solana_signMessage extends BaseSolanaRpcRequestType {
2235
+ method: 'signMessage';
2236
+ params: {
2237
+ message: string;
2238
+ };
2239
+ }
2240
+ interface solana_signMessageResponse {
2241
+ method: 'signMessage';
2242
+ data: {
2243
+ signature: string;
2244
+ };
2245
+ }
2246
+ type EthereumRpcRequestType = eth_signTransaction | eth_populateTransactionRequest | eth_sign | personal_sign | eth_signTypedData_v4;
2247
+ type EthereumRpcResponseType = eth_signTransactionResponse | eth_populateTransactionRequestResponse | eth_signResponse | personal_signResponse | eth_signTypedData_v4Response;
2248
+ type SolanaRpcRequestType = solana_signMessage;
2249
+ type SolanaRpcResponseType = solana_signMessageResponse;
2250
+
2251
+ export { AsExternalProvider as $, type TransactionReceipt as A, type BaseConnectedEthereumWallet as B, type Chain as C, type ConnectedWallet as D, Embedded1193Provider as E, type FundWalletConfig as F, type PrivyIframeErrorTypesType as G, PrivyErrorCode as H, type LinkedAccountWithMetadata as I, type UserRecoveryMethod as J, type FundingMethod as K, type LoginMethod as L, type MoonpaySignRequest as M, type OAuthFlowState as N, type OAuthTokens as O, PrivyProxyProvider as P, type LoginWithCode as Q, type RuntimeLoginOverridableOptions as R, SolanaWalletConnector as S, type TelegramAuthResult as T, type User as U, type OtpFlowState as V, WalletConnector as W, type PasskeyFlowState as X, type SiweFlowState as Y, type UnsignedTransactionRequestWithChainId as Z, type CustomAuthFlowState as _, type RpcConfig as a, type TypedMessage as a0, type MessageTypes as a1, type MoonpayConfig as a2, type MoonpayCurrencyCode as a3, type MoonpayPaymentMethod as a4, type Quantity as a5, type TransactionLog as a6, type NonEmptyArray as a7, type EmailWithMetadata as a8, type PhoneWithMetadata as a9, type MoonpayFundingConfig as aA, type PriceDisplayOptions as aB, type Farcaster as aC, type Passkey as aD, type LoginMethodOrderOption as aE, type ConnectedSolanaWallet as aF, toSolanaWalletConnectors as aG, type WalletWithMetadata as aa, type Google as ab, type Twitter as ac, type Discord as ad, type Github as ae, type LinkedIn as af, type Apple as ag, type Tiktok as ah, type Telegram as ai, type CrossAppAccount as aj, type GoogleOAuthWithMetadata as ak, type TwitterOAuthWithMetadata as al, type DiscordOAuthWithMetadata as am, type GithubOAuthWithMetadata as an, type TiktokOAuthWithMetadata as ao, type LinkedInOAuthWithMetadata as ap, type AppleOAuthWithMetadata as aq, type FarcasterWithMetadata as ar, type TelegramWithMetadata as as, type CrossAppAccountWithMetadata as at, type PasskeyWithMetadata as au, type Email as av, type Phone as aw, type TransactionUIOptions as ax, type ContractUIOptions as ay, type NativeFundingConfig as az, type WalletClientType as b, type ConnectedWalletMetadata as c, type ConnectorType as d, type WalletListEntry as e, type ExternalWalletsConfig as f, type BaseConnectedWallet as g, type EIP1193Provider as h, type OAuthProviderType as i, type MoonpaySignResponse as j, type SmartWalletConfig as k, type PrivyServerConfig as l, type PrivyFarcasterSignerInitResponse as m, type SiweWalletMetadata as n, type OAuthUserInfo as o, type PrivyClientConfig as p, type ConnectWalletModalOptions as q, type LoginModalOptions as r, type CreateWalletOptions as s, type Wallet as t, type SetWalletRecoveryOptions as u, type SignMessageModalUIOptions as v, type SignTypedDataParams as w, type MfaMethod as x, type UnsignedTransactionRequest as y, type SendTransactionModalUIOptions as z };