@privy-io/react-auth 1.80.0 → 1.81.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -1,498 +1,23 @@
1
1
  import * as react from 'react';
2
- import react__default, { ReactElement, MouseEvent } from 'react';
3
- import { ExternalProvider, StaticJsonRpcProvider, Web3Provider, TransactionResponse } from '@ethersproject/providers';
4
- import { CountryCode } from 'libphonenumber-js/min';
5
- import { AbstractProvider } from 'web3-core';
6
- import EventEmitter from 'eventemitter3';
7
- import { PasskeyAuthenticateInputType, PrivyCoinbaseOnRampInitInput, PrivyCoinbaseOnRampInitResponse, PrivyCoinbaseOnRampStatusResponse } from '@privy-io/public-api';
8
- import { TypedMessage as TypedMessage$1, MessageTypes as MessageTypes$1 } from '@metamask/eth-sig-util';
2
+ import react__default, { MouseEvent } from 'react';
3
+ import { C as Chain, B as BaseConnectedWallet, W as WalletClientType, R as RpcConfig, a as ConnectorType, P as PrivyProxyProvider, E as Embedded1193Provider, b as ConnectedWalletMetadata, c as WalletBranding, d as WalletListEntry, e as ExternalWalletsConfig, f as EIP1193Provider, U as User, O as OAuthTokens, g as OAuthProviderType, M as MoonpaySignRequest, h as MoonpaySignResponse, i as PrivyServerConfig, j as PrivyFarcasterSignerInitResponse, k as PrivyClientConfig, l as RuntimeLoginOverridableOptions, m as Wallet, S as SetWalletRecoveryOptions, n as SignMessageModalUIOptions, o as SignTypedDataParams, p as MfaMethod, q as UnsignedTransactionRequest, r as SendTransactionModalUIOptions, F as FundWalletConfig, T as TransactionReceipt, s as ConnectedWallet, t as PrivyIframeErrorTypesType, u as PrivyErrorCode, L as LoginMethod, v as LinkedAccountWithMetadata, w as UserRecoveryMethod, x as FundingMethod, y as LoginWithCode, z as OtpFlowState, A as ConnectedSolanaWallet, D as UnsignedTransactionRequestWithChainId } from './types-ed6781aa.js';
4
+ export { a4 as Apple, ae as AppleOAuthWithMetadata, G as AsExternalProvider, am as ContractUIOptions, a7 as CrossAppAccount, ah as CrossAppAccountWithMetadata, a1 as Discord, aa as DiscordOAuthWithMetadata, aj as Email, Y as EmailWithMetadata, aq as Farcaster, af as FarcasterWithMetadata, a2 as Github, ab as GithubOAuthWithMetadata, $ as Google, a8 as GoogleOAuthWithMetadata, a3 as LinkedIn, ad as LinkedInOAuthWithMetadata, as as LoginMethodOrderOption, I as MessageTypes, J as MoonpayConfig, K as MoonpayCurrencyCode, ao as MoonpayFundingConfig, N as MoonpayPaymentMethod, an as NativeFundingConfig, X as NonEmptyArray, ar as Passkey, ai as PasskeyWithMetadata, ak as Phone, Z as PhoneWithMetadata, ap as PriceDisplayOptions, Q as Quantity, a6 as Telegram, ag as TelegramWithMetadata, a5 as Tiktok, ac as TiktokOAuthWithMetadata, V as TransactionLog, al as TransactionUIOptions, a0 as Twitter, a9 as TwitterOAuthWithMetadata, H as TypedMessage, _ as WalletWithMetadata } from './types-ed6781aa.js';
9
5
  import * as react_jsx_runtime from 'react/jsx-runtime';
10
6
  import { TurnstileProps } from '@marsidev/react-turnstile';
7
+ import EventEmitter from 'eventemitter3';
11
8
  import { Store, EIP6963ProviderDetail } from 'mipd';
9
+ import { Web3Provider, TransactionResponse } from '@ethersproject/providers';
12
10
  import * as _simplewebauthn_types from '@simplewebauthn/types';
13
11
  import { PublicKeyCredentialRequestOptionsJSON } from '@simplewebauthn/types';
12
+ import { AbstractProvider } from 'web3-core';
13
+ import { PrivyCoinbaseOnRampInitInput, PrivyCoinbaseOnRampInitResponse, PrivyCoinbaseOnRampStatusResponse } from '@privy-io/public-api';
14
14
  import { FetchOptions } from 'ofetch';
15
-
16
- /**
17
- * These types are fully compatible with WAGMI chain types, in case
18
- * we need interop in the future.
19
- */
20
- type RpcUrls = {
21
- http: readonly string[];
22
- webSocket?: readonly string[];
23
- };
24
- type NativeCurrency = {
25
- name: string;
26
- /** 2-6 characters long */
27
- symbol: string;
28
- decimals: number;
29
- };
30
- type BlockExplorer = {
31
- name: string;
32
- url: string;
33
- };
34
- /** A subset of WAGMI's chain type
35
- * https://github.com/wagmi-dev/references/blob/6aea7ee9c65cfac24f33173ab3c98176b8366f05/packages/chains/src/types.ts#L8
36
- *
37
- * @example
38
- *
39
- * override the RPC URL for a chain
40
- *
41
- * ```ts
42
- * import { mainnet } from 'viem/chains';
43
- *
44
- * const mainnetOverride: Chain = {
45
- * ...mainnet,
46
- * rpcUrls: {
47
- * ...mainnet.rpcUrls,
48
- * privyWalletOverride: {
49
- * http: [INSERT_MAINNET_OVERRIDE_URL],
50
- * },
51
- * },
52
- * };
53
- *
54
- * ```
55
- * or
56
- * ```ts
57
- * import { mainnet } from 'viem/chains';
58
- * import { addRpcUrlOverrideToChain } from '@privy-io/react-auth';
59
- *
60
- * const mainnetOverride = addRpcUrlOverrideToChain(mainnet, INSERT_MAINNET_OVERRIDE_URL);
61
- * ```
62
- *
63
- */
64
- type Chain = {
65
- /** Id in number form */
66
- id: number;
67
- /** Human readable name */
68
- name: string;
69
- /** Internal network name */
70
- network?: string;
71
- /** Currency used by chain */
72
- nativeCurrency: NativeCurrency;
73
- /** Collection of block explorers */
74
- blockExplorers?: {
75
- [key: string]: BlockExplorer;
76
- default: BlockExplorer;
77
- };
78
- /** Collection of RPC endpoints */
79
- rpcUrls: {
80
- [key: string]: RpcUrls;
81
- default: RpcUrls;
82
- } | {
83
- [key: string]: RpcUrls;
84
- default: RpcUrls;
85
- /** @optional Allows you to override the RPC url for this chain */
86
- privyWalletOverride: RpcUrls;
87
- };
88
- /** Flag for test networks */
89
- testnet?: boolean;
90
- };
91
- /**
92
- * RPC configuration for wallets.
93
- */
94
- type RpcConfig = {
95
- /**
96
- * Mapping of chainId to RPC URL. Overrides Privy default RPC URLs that are shared across projects. Set your own RPC URLs
97
- * to avoid rate limits or other throughput bottlenecks.
98
- *
99
- * Do not provide an RPC URL that can serve multiple networks. You should only provide RPC URLs that are speciifc to the
100
- * chain ID you'd like to override.
101
- */
102
- rpcUrls?: {
103
- [key: number]: string;
104
- };
105
- /**
106
- * Mapping between `walletClientType`s to the length of time after which RPC requests will timeout for that
107
- * `walletClientType`.
108
- *
109
- * By default, all RPC requests through Privy will timeout after 2 mins (120000 ms). Use this object to
110
- * override the RPC timeout in ms for specific` walletClientType`s, e.g. 'safe', in order to extend or
111
- * shorten the timeout duration.
112
- */
113
- rpcTimeouts?: {
114
- [key in WalletClientType]?: number;
115
- };
116
- };
15
+ import '@metamask/eth-sig-util';
16
+ import 'libphonenumber-js/min';
17
+ import 'viem';
117
18
 
118
19
  declare const DEFAULT_SUPPORTED_CHAINS: readonly [Chain, Chain, Chain, Chain, Chain, Chain, Chain, Chain, Chain, Chain, Chain, Chain, Chain, Chain, Chain, Chain, Chain, Chain, Chain, Chain, Chain, Chain, Chain, Chain, Chain, Chain];
119
20
 
120
- type WalletCreateRequestDataType = {
121
- accessToken: string;
122
- recoveryPassword?: string;
123
- recoveryMethod?: UserRecoveryMethod;
124
- recoveryAccessToken?: string;
125
- /**
126
- * Will be deprecated in a future release, use `recoveryPassword` instead
127
- * @deprecated
128
- */
129
- recoveryPin?: string;
130
- };
131
- type SolanaWalletCreateRequestDataType = {
132
- accessToken: string;
133
- /**
134
- * If a user has an existing Ethereum embedded wallet when creating the Solana embedded wallet, that address
135
- * MUST be passed in this field. Our iframe will use this address to derive the Solana embedded wallet from the
136
- * same entropy as the Ethereum wallet.
137
- *
138
- * If no address is passed here, our iframe assumes that the user has no existing Ethereum wallet and will create
139
- * a new set of entropy for Solana.
140
- */
141
- ethereumAddress?: string;
142
- };
143
- type WalletImportRequestDataType = {
144
- accessToken: string;
145
- privateKey: string;
146
- };
147
- type WalletSetRecoveryRequestDataType = {
148
- accessToken: string;
149
- address: string;
150
- recoveryMethod: UserRecoveryMethod;
151
- recoveryPassword?: string;
152
- recoveryAccessToken?: string;
153
- };
154
- type WalletRecoverRequestDataType = {
155
- address: string;
156
- imported?: boolean;
157
- accessToken: string;
158
- mfaCode?: string | PasskeyAuthenticateInputType['authenticator_response'];
159
- mfaMethod?: MfaMethod;
160
- relyingParty?: string;
161
- recoveryPassword?: string;
162
- recoveryMethod?: UserRecoveryMethod | 'privy';
163
- recoveryAccessToken?: string;
164
- /**
165
- * Will be deprecated in a future release, use `recoveryPassword` instead
166
- * @deprecated
167
- */
168
- recoveryPin?: string;
169
- };
170
- type WalletConnectRequestDataType = {
171
- accessToken: string;
172
- address: string;
173
- };
174
- type WalletRpcRequestDataType = {
175
- accessToken: string;
176
- mfaCode?: string | PasskeyAuthenticateInputType['authenticator_response'];
177
- mfaMethod?: MfaMethod;
178
- relyingParty?: string;
179
- requesterAppId?: string;
180
- address: string;
181
- request: EthereumRpcRequestType;
182
- };
183
- type SolanaWalletConnectRequestDataType = {
184
- publicKey: string;
185
- accessToken: string;
186
- };
187
- type SolanaWalletRecoverRequestDataType = {
188
- publicKey: string;
189
- accessToken: string;
190
- };
191
- type SolanaWalletRpcRequestDataType = {
192
- accessToken: string;
193
- publicKey: string;
194
- request: SolanaRpcRequestType;
195
- };
196
- type MfaVerifyRequestDataType = {
197
- accessToken: string;
198
- };
199
- type MfaInitEnrollmentRequestDataType = {
200
- accessToken: string;
201
- method: 'sms';
202
- phoneNumber: string;
203
- } | {
204
- accessToken: string;
205
- method: 'totp';
206
- };
207
- type MfaSubmitEnrollmentRequestDataType = {
208
- accessToken: string;
209
- method: 'sms';
210
- code: string;
211
- phoneNumber: string;
212
- } | {
213
- accessToken: string;
214
- method: 'totp';
215
- code: string;
216
- } | {
217
- accessToken: string;
218
- method: 'passkey';
219
- credentialIds: string[];
220
- };
221
- type MfaUnenrollRequestDataType = {
222
- accessToken: string;
223
- method: 'sms' | 'totp';
224
- };
225
- type MfaClearRequestDataType = {
226
- userId: string;
227
- };
228
- type FarcasterSignerInitRequestDataType = {
229
- address: string;
230
- hdWalletIndex: number | null;
231
- accessToken: string;
232
- mfaCode: string | PasskeyAuthenticateInputType['authenticator_response'] | null;
233
- mfaMethod: string | null;
234
- relyingParty: string;
235
- };
236
- type FarcasterSignRequestDataType = {
237
- address: string;
238
- hdWalletIndex: number | null;
239
- accessToken: string;
240
- mfaCode: string | PasskeyAuthenticateInputType['authenticator_response'] | null;
241
- mfaMethod: string | null;
242
- relyingParty: string;
243
- payload: {
244
- hash: string;
245
- };
246
- fid: bigint;
247
- };
248
- type WalletCreateResponseDataType = {
249
- address: string;
250
- };
251
- type WalletImportResponseDataType = {
252
- address: string;
253
- };
254
- type WalletConnectResponseDataType = {
255
- address: string;
256
- };
257
- type WalletRecoverResponseDataType = {
258
- address: string;
259
- };
260
- type WalletSetRecoveryResponseDataType = {
261
- address: string;
262
- };
263
- type WalletRpcResponseDataType = {
264
- address: string;
265
- response: EthereumRpcResponseType;
266
- };
267
- type SolanaWalletCreateResponseDataType = {
268
- publicKey: string;
269
- };
270
- type SolanaWalletConnectResponseDataType = {
271
- publicKey: string;
272
- };
273
- type SolanaWalletRecoverResponseDataType = {
274
- publicKey: string;
275
- };
276
- type SolanaWalletRpcResponseDataType = {
277
- publicKey: string;
278
- response: SolanaRpcResponseType;
279
- };
280
- type MfaVerifyResponseDataType = Record<string, never>;
281
- type MfaInitEnrollmentResponseDataType = {
282
- method: string;
283
- secret?: string;
284
- authUrl?: string;
285
- };
286
- type MfaSubmitEnrollmentResponseDataType = Record<string, never>;
287
- type MfaUnenrollResponseDataType = Record<string, never>;
288
- type MfaClearResponseDataType = Record<string, never>;
289
- type FarcasterSignerInitResponseDataType = PrivyFarcasterSignerInitResponse;
290
- type FarcasterSignResponseDataType = {
291
- hash: string;
292
- signature: string;
293
- };
294
- 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"];
295
- type PrivyIframeErrorTypesType = (typeof PrivyIframeErrorTypes)[number];
296
- interface EmbeddedWalletProxy {
297
- create: (data: WalletCreateRequestDataType) => Promise<WalletCreateResponseDataType>;
298
- import: (data: WalletImportRequestDataType) => Promise<WalletImportResponseDataType>;
299
- connect: (data: WalletConnectRequestDataType) => Promise<WalletConnectResponseDataType>;
300
- recover: (data: WalletRecoverRequestDataType) => Promise<WalletRecoverResponseDataType>;
301
- setRecovery: (data: WalletSetRecoveryRequestDataType) => Promise<WalletSetRecoveryResponseDataType>;
302
- rpc: (data: WalletRpcRequestDataType) => Promise<WalletRpcResponseDataType>;
303
- createSolana: (data: SolanaWalletCreateRequestDataType) => Promise<SolanaWalletCreateResponseDataType>;
304
- connectSolana: (data: SolanaWalletConnectRequestDataType) => Promise<SolanaWalletConnectResponseDataType>;
305
- recoverSolana: (data: SolanaWalletRecoverRequestDataType) => Promise<SolanaWalletRecoverResponseDataType>;
306
- rpcSolana: (data: SolanaWalletRpcRequestDataType) => Promise<SolanaWalletRpcResponseDataType>;
307
- verifyMfa: (data: MfaVerifyRequestDataType) => Promise<MfaVerifyResponseDataType>;
308
- initEnrollMfa: (data: MfaInitEnrollmentRequestDataType) => Promise<MfaInitEnrollmentResponseDataType>;
309
- submitEnrollMfa: (data: MfaSubmitEnrollmentRequestDataType) => Promise<MfaSubmitEnrollmentResponseDataType>;
310
- unenrollMfa: (data: MfaUnenrollRequestDataType) => Promise<MfaUnenrollResponseDataType>;
311
- clearMfa: (data: MfaClearRequestDataType) => Promise<MfaClearResponseDataType>;
312
- initFarcasterSigner: (data: FarcasterSignerInitRequestDataType) => Promise<FarcasterSignerInitResponseDataType>;
313
- signFarcasterMessage: (data: FarcasterSignRequestDataType) => Promise<FarcasterSignResponseDataType>;
314
- }
315
-
316
- declare abstract class PrivyError extends Error {
317
- /**
318
- * Privy error type.
319
- */
320
- abstract type: string;
321
- /**
322
- * Original Error object, it the error originated client-side.
323
- */
324
- cause?: Error;
325
- /**
326
- * An optional error code, often included in Privy API responses.
327
- */
328
- privyErrorCode?: PrivyErrorCode;
329
- /**
330
- * @param type Privy error type.
331
- * @param message Human-readable message.
332
- * @param cause Source of this error.
333
- */
334
- protected constructor(message: string, cause?: unknown, privyErrorCode?: PrivyErrorCode);
335
- toString(): string;
336
- }
337
- /**
338
- * The PrivyConnector instance threw an exception.
339
- */
340
- declare class PrivyConnectorError extends PrivyError {
341
- type: string;
342
- constructor(message: string, cause?: unknown, privyErrorCode?: PrivyErrorCode);
343
- }
344
- declare enum PrivyErrorCode {
345
- OAUTH_ACCOUNT_SUSPENDED = "oauth_account_suspended",
346
- MISSING_OR_INVALID_PRIVY_APP_ID = "missing_or_invalid_privy_app_id",
347
- MISSING_OR_INVALID_PRIVY_ACCOUNT_ID = "missing_or_invalid_privy_account_id",
348
- MISSING_OR_INVALID_TOKEN = "missing_or_invalid_token",
349
- INVALID_DATA = "invalid_data",
350
- INVALID_CAPTCHA = "invalid_captcha",
351
- LINKED_TO_ANOTHER_USER = "linked_to_another_user",
352
- CANNOT_LINK_MORE_OF_TYPE = "cannot_link_more_of_type",
353
- FAILED_TO_LINK_ACCOUNT = "failed_to_link_account",
354
- ALLOWLIST_REJECTED = "allowlist_rejected",
355
- OAUTH_USER_DENIED = "oauth_user_denied",
356
- OAUTH_UNEXPECTED = "oauth_unexpected",
357
- UNKNOWN_AUTH_ERROR = "unknown_auth_error",
358
- USER_EXITED_AUTH_FLOW = "exited_auth_flow",
359
- USER_EXITED_LINK_FLOW = "exited_link_flow",
360
- USER_EXITED_SET_PASSWORD_FLOW = "user_exited_set_password_flow",
361
- MUST_BE_AUTHENTICATED = "must_be_authenticated",
362
- UNKNOWN_CONNECT_WALLET_ERROR = "unknown_connect_wallet_error",
363
- GENERIC_CONNECT_WALLET_ERROR = "generic_connect_wallet_error",
364
- CLIENT_REQUEST_TIMEOUT = "client_request_timeout",
365
- INVALID_CREDENTIALS = "invalid_credentials",
366
- MISSING_MFA_CREDENTIALS = "missing_or_invalid_mfa",
367
- UNKNOWN_MFA_ERROR = "unknown_mfa_error",
368
- EMBEDDED_WALLET_ALREADY_EXISTS = "embedded_wallet_already_exists",
369
- EMBEDDED_WALLET_NOT_FOUND = "embedded_wallet_not_found",
370
- UNKNOWN_EMBEDDED_WALLET_ERROR = "unknown_embedded_wallet_error",
371
- EMBEDDED_WALLET_PASSWORD_UNCONFIRMED = "embedded_wallet_password_unconfirmed",
372
- EMBEDDED_WALLET_PASSWORD_ALREADY_EXISTS = "embedded_wallet_password_already_exists",
373
- EMBEDDED_WALLET_RECOVERY_ALREADY_EXISTS = "embedded_wallet_recovery_already_exists",
374
- TRANSACTION_FAILURE = "transaction_failure",
375
- UNSUPPORTED_CHAIN_ID = "unsupported_chain_id",
376
- NOT_SUPPORTED = "not_supported",
377
- CAPTCHA_TIMEOUT = "captcha_timeout",
378
- INVALID_MESSAGE = "invalid_message",
379
- UNABLE_TO_SIGN = "unable_to_sign",
380
- CAPTCHA_FAILURE = "captcha_failure",
381
- CAPTCHA_DISABLED = "captcha_disabled",
382
- SESSION_STORAGE_UNAVAILABLE = "session_storage_unavailable",
383
- TOO_MANY_REQUESTS = "too_many_requests",
384
- USER_LIMIT_REACHED = "max_accounts_reached",
385
- DISALLOWED_LOGIN_METHOD = "disallowed_login_method",
386
- PASSKEY_NOT_ALLOWED = "passkey_not_allowed",
387
- USER_DOES_NOT_EXIST = "user_does_not_exist",
388
- INSUFFICIENT_BALANCE = "insufficient_balance"
389
- }
390
-
391
- declare class WalletTimeoutError extends PrivyConnectorError {
392
- type: string;
393
- constructor();
394
- }
395
- /**
396
- * A ProviderRpcError combines the necessary bits of the {PrivyError} with the
397
- * EIP-compliant ProviderRpcError. This is meant to be a type around errors raised
398
- * by the ethereum provider.
399
- */
400
- declare class ProviderRpcError extends PrivyError {
401
- type: string;
402
- readonly code: number;
403
- readonly data?: unknown;
404
- constructor(message: string, code: number, data?: unknown);
405
- }
406
-
407
- declare global {
408
- interface Window {
409
- ethereum?: any;
410
- }
411
- }
412
- type ProviderConnectInfo = {
413
- chainId: string;
414
- };
415
- type OnConnectEventHandler = (connectInfo: ProviderConnectInfo) => void;
416
- type OnDisconnectEventHandler = (error: ProviderRpcError) => void;
417
- type OnChainChangedEventHandler = (chainId: string | number) => void;
418
- type OnAccountsChangedEventHandler = (accounts: string[]) => void;
419
- type ProviderMessage = {
420
- type: string;
421
- data: unknown;
422
- };
423
- type OnMessageEventHandler = (message: ProviderMessage) => void;
424
- type EIP1193OnEventHandler = OnConnectEventHandler | OnDisconnectEventHandler | OnChainChangedEventHandler | OnAccountsChangedEventHandler | OnMessageEventHandler;
425
- interface EIP1193Provider {
426
- rpcTimeoutDuration?: number;
427
- request: (request: {
428
- method: string;
429
- params?: Array<any> | undefined;
430
- }) => Promise<any>;
431
- on: (eventName: string, listener: EIP1193OnEventHandler) => any;
432
- removeListener: (eventName: string | symbol, listener: (...args: any[]) => void) => any;
433
- }
434
- /**
435
- * @hidden
436
- *
437
- * The PrivyProxyProvider adds a middleware layer on top of the underlying wallet provider.
438
- * */
439
- declare class PrivyProxyProvider implements EIP1193Provider {
440
- rpcTimeoutDuration: number;
441
- walletProvider?: EIP1193Provider;
442
- private _subscriptions;
443
- constructor(walletProvider?: EIP1193Provider, rpcTimeoutDuration?: number);
444
- on(eventName: string, listener: (...args: any[]) => void): any;
445
- request(request: {
446
- method: string;
447
- params?: any[] | undefined;
448
- }): Promise<any>;
449
- removeListener: (eventName: string | symbol, listener: (...args: any[]) => void) => any;
450
- walletTimeout: (error?: WalletTimeoutError, timeoutMs?: number) => Promise<string[]>;
451
- setWalletProvider: (provider: EIP1193Provider) => void;
452
- }
453
- interface RequestArguments {
454
- readonly method: string;
455
- readonly params?: readonly unknown[] | object | any;
456
- }
457
- declare class Embedded1193Provider extends EventEmitter implements EIP1193Provider {
458
- walletProxy: EmbeddedWalletProxy;
459
- address: string;
460
- provider: StaticJsonRpcProvider;
461
- chainId: number;
462
- rpcConfig: RpcConfig;
463
- chains: Chain[];
464
- rpcTimeoutDuration: number;
465
- appId: string;
466
- constructor(walletProxy: EmbeddedWalletProxy, address: string, rpcConfig: RpcConfig, chains: Chain[], appId: string, chainId?: number);
467
- handleSendTransaction(args: RequestArguments): Promise<string>;
468
- private handleSwitchEthereumChain;
469
- private handlePersonalSign;
470
- private handleSignedTypedData;
471
- private handleEstimateGas;
472
- request(args: RequestArguments): Promise<unknown>;
473
- connect(): Promise<string | null>;
474
- }
475
- /**
476
- * @hidden
477
- *
478
- * Shim to convert to ethers-compatible ExternalProvider class.
479
- */
480
- declare class AsExternalProvider extends PrivyProxyProvider implements ExternalProvider {
481
- constructor(provider: EIP1193Provider);
482
- isMetaMask?: boolean;
483
- isStatus?: boolean;
484
- host?: string;
485
- path?: string;
486
- sendAsync?: (request: {
487
- method: string;
488
- params?: Array<any>;
489
- }, callback: (error: any, response: any) => void) => void;
490
- send?: (request: {
491
- method: string;
492
- params?: Array<any>;
493
- }, callback: (error: any, response: any) => void) => void;
494
- }
495
-
496
21
  interface ConnectorEvents {
497
22
  walletsUpdated(): void;
498
23
  initialized(): void;
@@ -577,13 +102,6 @@ declare abstract class WalletConnector extends EventEmitter<ConnectorEvents> {
577
102
  abstract promptConnection(walletClientType: WalletClientType): void;
578
103
  }
579
104
 
580
- interface SolanaProvider {
581
- request: (request: {
582
- method: string;
583
- params?: any;
584
- }) => Promise<any>;
585
- }
586
-
587
105
  interface ResponseEmailAccount {
588
106
  type: 'email';
589
107
  address: string;
@@ -1104,1399 +622,6 @@ declare class PrivyClient {
1104
622
  }): Promise<User>;
1105
623
  }
1106
624
 
1107
- /**
1108
- * Accepted payment methods for the MoonPay fiat on-ramp.
1109
- */
1110
- 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';
1111
- type MoonpayUiConfig = {
1112
- accentColor?: string;
1113
- theme?: 'light' | 'dark';
1114
- };
1115
- /**
1116
- * Cryptocurrency codes for the MoonPay fiat on-ramp. These codes
1117
- * follow the format {TOKEN_NAME}_{NETWORK_NAME}.
1118
- */
1119
- 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';
1120
- /**
1121
- * Configuration parameter for the MoonPay fiat on-ramp.
1122
- */
1123
- type MoonpayConfig = {
1124
- currencyCode?: MoonpayCurrencyCode;
1125
- quoteCurrencyAmount?: number;
1126
- paymentMethod?: MoonpayPaymentMethod;
1127
- uiConfig?: MoonpayUiConfig;
1128
- };
1129
- type MoonpaySignRequest = {
1130
- address: string;
1131
- config: MoonpayConfig;
1132
- useSandbox: boolean;
1133
- };
1134
- type MoonpaySignResponse = {
1135
- signedUrl: string;
1136
- externalTransactionId: string;
1137
- };
1138
-
1139
- declare const SUPPORTED_OAUTH_PROVIDERS: readonly ["google", "discord", "twitter", "github", "spotify", "instagram", "tiktok", "linkedin", "apple"];
1140
- declare const SUPPORTED_RECOVERY_PROVIDERS: readonly ["google-drive", "icloud"];
1141
- declare const SUPPORTED_MFA_METHODS: readonly ["sms", "totp", "passkey"];
1142
- type MfaMethod = (typeof SUPPORTED_MFA_METHODS)[number];
1143
- /**
1144
- * Supported OAuth providers. Can be `'google'`, `'discord'`, `'twitter'`, `'github'`, `'spotify'`,
1145
- * `'instagram'`, `'tiktok'`, `'linkedin'`, or `'apple'`
1146
- */
1147
- type OAuthProviderType = (typeof SUPPORTED_OAUTH_PROVIDERS)[number];
1148
- /**
1149
- * Supported OAuth providers for the recovery flow. Can be `'google-drive'`
1150
- */
1151
- type RecoveryProviderType = (typeof SUPPORTED_RECOVERY_PROVIDERS)[number];
1152
- type LoginMethod = 'email' | 'sms' | 'siwe' | 'farcaster' | OAuthProviderType | 'passkey' | 'telegram' | 'custom' | `privy:${string}` | 'guest';
1153
- type LoginWithCode = {
1154
- /**
1155
- * One-time password _([OTP](https://en.wikipedia.org/wiki/One-time_password))_ that was sent to user during first login step
1156
- */
1157
- code: string;
1158
- };
1159
- declare const EMBEDDED_WALLET_CLIENT_TYPES: readonly ["privy"];
1160
- type EmbeddedWalletClientType = (typeof EMBEDDED_WALLET_CLIENT_TYPES)[number];
1161
- declare const INJECTED_WALLET_CLIENT_TYPES: readonly ["metamask", "phantom", "brave_wallet", "rainbow", "uniswap_wallet_extension", "uniswap_extension", "rabby_wallet", "crypto.com_wallet_extension"];
1162
- type InjectedWalletClientType = (typeof INJECTED_WALLET_CLIENT_TYPES)[number];
1163
- declare const COINBASE_WALLET_CLIENT_TYPES: readonly ["coinbase_wallet", "coinbase_smart_wallet"];
1164
- type CoinbaseWalletClientType = (typeof COINBASE_WALLET_CLIENT_TYPES)[number];
1165
- type WalletConnectWalletClientType = (typeof WALLET_CONNECT_WALLET_CLIENT_TYPES)[number];
1166
- declare const UNKNOWN_WALLET_CLIENT_TYPES: readonly ["unknown"];
1167
- type UnknownWalletClientType = (typeof UNKNOWN_WALLET_CLIENT_TYPES)[number];
1168
- type WalletClientType = InjectedWalletClientType | CoinbaseWalletClientType | WalletConnectWalletClientType | EmbeddedWalletClientType | UnknownWalletClientType;
1169
- declare const SUPPORTED_CONNECTOR_TYPES: string[];
1170
- type ConnectorType = (typeof SUPPORTED_CONNECTOR_TYPES)[number];
1171
- /**
1172
- * Wallet metadata currently for internal use only
1173
- */
1174
- type WalletBranding = {
1175
- name: string;
1176
- id: string;
1177
- icon?: string | EmbeddedSVG;
1178
- };
1179
- type LinkedAccountType = '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';
1180
- /** @ignore */
1181
- interface LinkMetadata {
1182
- /** Account type, most commonly useful when filtering through linkedAccounts */
1183
- type: LinkedAccountType;
1184
- /**
1185
- * @deprecated use `firstVerifiedAt` instead.
1186
- * Datetime when this account was linked to the user or created. */
1187
- verifiedAt: Date;
1188
- /** Datetime when this account was linked to the user. */
1189
- firstVerifiedAt: Date | null;
1190
- /** Datetime when this account was most recently used as a login/link method by the user. */
1191
- latestVerifiedAt: Date | null;
1192
- }
1193
- /**
1194
- * Legacy configuration for the Moonpay funding selection.
1195
- *
1196
- * @deprecated
1197
- */
1198
- type MoonpayFundingConfig = {
1199
- config: MoonpayConfig;
1200
- provider?: 'moonpay';
1201
- };
1202
- /**
1203
- * Configuration for native funding amount.
1204
- */
1205
- type NativeFundingConfig = {
1206
- chain?: Chain;
1207
- amount?: string;
1208
- };
1209
- /**
1210
- * Optional configuration parameter for the fiat on-ramp.
1211
- */
1212
- type FundWalletConfig = MoonpayFundingConfig | NativeFundingConfig;
1213
- /**
1214
- * Possible methods of user-driven recovery.
1215
- * This is set, per app, on the server.
1216
- */
1217
- type UserRecoveryMethod = 'user-passcode' | RecoveryProviderType;
1218
- /**
1219
- * Object representation of a user's wallet.
1220
- */
1221
- interface Wallet {
1222
- /** The wallet address. */
1223
- address: string;
1224
- /**
1225
- * Chain type of the wallet address.
1226
- */
1227
- chainType: 'ethereum' | 'solana';
1228
- /**
1229
- * @deprecated Use `BaseConnectedWallet.chainId` instead.
1230
- *
1231
- * ```tsx
1232
- * const {wallets} = useWallets();
1233
- * // Replace wallets[0] with the wallet you'd like
1234
- * const chainId = wallets[0].chainId;
1235
- * console.log(chainId);
1236
- * // This will be the current chain ID of the wallet,
1237
- * // e.g. 'eip155:1' if the wallet is on mainnet
1238
- * ```
1239
- *
1240
- * Represents the CAIP-2 formatted chain ID of the wallet
1241
- * during the most recent verification during SIWE. May not
1242
- * be up to date with the current chain ID of the wallet.
1243
- *
1244
- * Embedded wallets do not complete SIWE since the user is
1245
- * already authenticated, and you should not use this field
1246
- * for the embedded wallet.
1247
- *
1248
- * e.g. eip155:1, eip155:5, eip155:137, etc.
1249
- */
1250
- chainId?: string;
1251
- /**
1252
- * @deprecated Use `walletClientType` instead.
1253
- */
1254
- walletClient: 'privy' | 'unknown';
1255
- /**
1256
- * The wallet client used for this wallet during the most recent verification.
1257
- *
1258
- * If the value is `privy`, then this is a privy embedded wallet.
1259
- *
1260
- * Other values include but are not limited to `metamask`, `rainbow`, `coinbase_wallet`, etc.
1261
- */
1262
- walletClientType?: string;
1263
- /**
1264
- * The connector type used for this wallet during the most recent verification.
1265
- *
1266
- * This includes but is not limited to `injected`, `wallet_connect`, `coinbase_wallet`, `embedded`.
1267
- */
1268
- connectorType?: string;
1269
- /**
1270
- * If this is a 'privy' embedded wallet, stores the recovery method:
1271
- *
1272
- * 1. 'privy': privy escrow of the recovery material
1273
- * 2. 'user-passcode': recovery protected by user-input passcode
1274
- */
1275
- recoveryMethod?: 'privy' | UserRecoveryMethod;
1276
- /** Whether the wallet is imported. */
1277
- imported: boolean;
1278
- }
1279
- /**
1280
- * Object representation of metadata reported by a connected wallet from a wallet connector
1281
- */
1282
- interface ConnectedWalletMetadata {
1283
- /** The wallet name (e.g. MetaMask). */
1284
- name: string;
1285
- /** The wallet RDNS, falls back to the wallet name if none is available. */
1286
- id: string;
1287
- /** The wallet logo */
1288
- icon?: string;
1289
- }
1290
- /**
1291
- * Object representation of a base connected wallet from a wallet connector.
1292
- */
1293
- interface BaseConnectedWallet {
1294
- /** The wallet address. */
1295
- address: string;
1296
- /** The current chain ID with CAIP-2 formatting. */
1297
- chainId: string;
1298
- /** The first time this wallet was connected without break. */
1299
- connectedAt: number;
1300
- /**
1301
- * The wallet client where this key-pair is stored.
1302
- * e.g. metamask, rainbow, coinbase_wallet, etc.
1303
- */
1304
- walletClientType: WalletClientType;
1305
- /**
1306
- * The connector used to initiate the connection with the wallet client.
1307
- * e.g. injected, wallet_connect, coinbase_wallet, etc.
1308
- */
1309
- connectorType: ConnectorType;
1310
- /** Whether the wallet is imported. */
1311
- imported: boolean;
1312
- /**
1313
- * Metadata for the wallet.
1314
- */
1315
- meta: ConnectedWalletMetadata;
1316
- /** Returns true if the wallet is connected, false otherwise */
1317
- isConnected: () => Promise<boolean>;
1318
- /**
1319
- * Switch the network chain to a specified ID.
1320
- * Note: The chainId must be a supported network: https://docs.privy.io/guide/frontend/embedded/networks
1321
- * Note: This will not update any existing provider instances, re-request `wallet.getEthersProvider` (e.g.)
1322
- * to get a provider with the updated chainId.
1323
- *
1324
- * @param targetChainId The specified chain ID to switch to, as a number or 0x prefixed string.
1325
- * @returns void
1326
- */
1327
- switchChain: (targetChainId: `0x${string}` | number) => Promise<void>;
1328
- /** Helper methods to build providers for interfacing with this wallet. */
1329
- getEthereumProvider: () => Promise<EIP1193Provider>;
1330
- getEthersProvider: () => Promise<Web3Provider>;
1331
- getWeb3jsProvider: () => Promise<AbstractProvider>;
1332
- /**
1333
- * Perform personal_sign with the user's wallet.
1334
- *
1335
- * @param {string} message The message to sign.
1336
- * @returns {string} The resulting signature.
1337
- */
1338
- sign: (message: string) => Promise<string>;
1339
- /**
1340
- * @experimental **Experimental**: This property is {@link https://docs.privy.io/guide/guides/experimental-features subject to change at any time}.
1341
- *
1342
- * Not all wallet clients support programmatic disconnects (e.g. MetaMask, Phantom).
1343
- * In kind, if the wallet's client does not support programmatic disconnects,
1344
- * this method will no-op.
1345
- */
1346
- disconnect: () => void;
1347
- }
1348
- /**
1349
- * Object representation of a connected wallet.
1350
- */
1351
- interface ConnectedWallet extends BaseConnectedWallet {
1352
- /** True if this wallet is linked to the authenticated user. False if it is not yet linked or
1353
- * the user has not yet authenticated. */
1354
- linked: boolean;
1355
- /** Login with this wallet or link this wallet to the authenticated user.
1356
- *
1357
- * Throws a PrivyClientError if the wallet is not connected.
1358
- */
1359
- loginOrLink: () => Promise<void>;
1360
- /**
1361
- * Prompt the user to go through the funding flow and for the connected wallet.
1362
- *
1363
- * This will open the modal with a prompt for the user to select a funding method (if multiple are enabled).
1364
- *
1365
- * Once the user continues to the funding flow, Privy will display the funding status screen, and wait
1366
- * for the transaction to complete.
1367
- *
1368
- * Note: Even after a successful funding, funds can take a few minutes to arrive in the user's wallet.
1369
- *
1370
- * Privy currently supports funding via external wallets and Moonpay.
1371
- *
1372
- * @param {FundWalletConfig} fundWalletConfig Funding configuration to specify chain and funding amount (if enabled)
1373
- * **/
1374
- fund: (fundWalletConfig?: FundWalletConfig) => Promise<void>;
1375
- /** Unlink this wallet to the authenticated user. Throws a PrivyClientError if the user is not
1376
- * authenticated. */
1377
- unlink: () => Promise<void>;
1378
- }
1379
- /**
1380
- * Object representation of a connected Solana wallet for the user.
1381
- */
1382
- interface ConnectedSolanaWallet {
1383
- /** The Solana wallet address (base58-encoded public key) */
1384
- address: string;
1385
- /** A method to create a SolanaProvider to make RPC requests, like 'signMessage' to the wallet. */
1386
- getProvider: () => Promise<SolanaProvider>;
1387
- /** The first time this wallet was connected. */
1388
- connectedAt: number;
1389
- /** The wallet client for the Solana wallet. Currently, only embedded wallets (`walletClientType`: 'privy') is supported. */
1390
- walletClientType: 'privy';
1391
- /** The connector type for the Solana wallet. Currently, only embedded wallets (`connectorType`: 'embedded') is supported. */
1392
- connectorType: 'embedded';
1393
- /** Branding metadata for the Solana wallet. */
1394
- meta: WalletBranding;
1395
- }
1396
- /** Object representation of a user's email. */
1397
- interface Email {
1398
- /** The email address. */
1399
- address: string;
1400
- }
1401
- /** Object representation of a user's phone number. */
1402
- interface Phone {
1403
- /** The phone number. */
1404
- number: string;
1405
- }
1406
- /** Object representation of a user's Google account. */
1407
- interface Google {
1408
- /** The `sub` claim from the Google-issued JWT for this account. */
1409
- subject: string;
1410
- /** The email associated with the Google account. */
1411
- email: string;
1412
- /** The name associated with the Google account. */
1413
- name: string | null;
1414
- }
1415
- /** Object representation of a user's Twitter account. */
1416
- interface Twitter {
1417
- /** The `sub` claim from the Twitter-issued JWT for this account. */
1418
- subject: string;
1419
- /** The username associated with the Twitter account. */
1420
- username: string | null;
1421
- /** The name associated with the Twitter account. */
1422
- name: string | null;
1423
- /** The profile picture URL associated with the Twitter account.
1424
- * Note that the Twitter image URL returned is appended with `_normal`
1425
- * to return a 48x48px image. In order to retrieve the original-sized image,
1426
- * remove the `_normal` from the URL as specified in the Twitter API docs:
1427
- * https://developer.twitter.com/en/docs/twitter-api/v1/accounts-and-users/user-profile-images-and-banners
1428
- */
1429
- profilePictureUrl: string | null;
1430
- }
1431
- /** Object representation of a user's Discord account. */
1432
- interface Discord {
1433
- /** The `sub` claim from the Discord-issued JWT for this account. */
1434
- subject: string;
1435
- /** The username associated with the Discord account. */
1436
- username: string | null;
1437
- /** The email associated with the Discord account. */
1438
- email: string | null;
1439
- }
1440
- /** Object representation of a user's Github account. */
1441
- interface Github {
1442
- /** The `sub` claim from the Github-issued JWT for this account. */
1443
- subject: string;
1444
- /** The username associated with the Github account. */
1445
- username: string | null;
1446
- /** The name associated with the Github account. */
1447
- name: string | null;
1448
- /** The email associated with the Github account. */
1449
- email: string | null;
1450
- }
1451
- /** Object representation of a user's Spotify account. */
1452
- interface Spotify {
1453
- /** The user id associated with the Spotify account. */
1454
- subject: string;
1455
- /** The email associated with the Spotify account. */
1456
- email: string | null;
1457
- /** The display name associated with the Spotify account. */
1458
- name: string | null;
1459
- }
1460
- /** Object representation of a user's Instagram account. */
1461
- interface Instagram {
1462
- /** The user id associated with the Instagram account. */
1463
- subject: string;
1464
- /** The username associated with the Instagram account. */
1465
- username: string | null;
1466
- }
1467
- /** Object representation of a user's Tiktok account. */
1468
- interface Tiktok {
1469
- /** The `sub` claim from the Tiktok-issued JWT for this account. */
1470
- subject: string;
1471
- /** The username associated with the Tiktok account. */
1472
- username: string | null;
1473
- /** The display name associated with the Tiktok account. */
1474
- name: string | null;
1475
- }
1476
- /** Object representation of a user's LinkedIn account. */
1477
- interface LinkedIn {
1478
- /** The `sub` claim from the LinkedIn-issued JWT for this account. */
1479
- subject: string;
1480
- /** The name associated with the LinkedIn account. */
1481
- name: string | null;
1482
- /** The email associated with the LinkedIn account. */
1483
- email: string | null;
1484
- /** The vanityName/profile URL associated with the LinkedIn account. */
1485
- vanityName: string | null;
1486
- }
1487
- /** Object representation of a user's Apple account. */
1488
- interface Apple {
1489
- /** The `sub` claim from the Apple-issued JWT for this account. */
1490
- subject: string;
1491
- /** The email associated with the Apple account. */
1492
- email: string;
1493
- }
1494
- interface CustomJwtAccount {
1495
- /** The user ID given by the custom auth provider */
1496
- customUserId: string;
1497
- }
1498
- interface Farcaster {
1499
- /** The Farcaster on-chain FID */
1500
- fid: number | null;
1501
- /** The Farcaster ethereum address that owns the FID */
1502
- ownerAddress: string;
1503
- /** The Farcaster protocol username */
1504
- username: string | null;
1505
- /** The Farcaster protocol display name */
1506
- displayName: string | null;
1507
- /** The Farcaster protocol bio */
1508
- bio: string | null;
1509
- /** The Farcaster protocol profile picture */
1510
- pfp: string | null;
1511
- /** The Farcaster protocol profile url */
1512
- url: string | null;
1513
- /** 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 */
1514
- signerPublicKey: string | null;
1515
- }
1516
- interface Telegram {
1517
- /** The user ID that owns this Telegram account. */
1518
- telegramUserId: string;
1519
- /** The first name of the user . */
1520
- firstName: string | null;
1521
- /** The last name of the user . */
1522
- lastName: string | null;
1523
- /** The username associated with the Telegram account. */
1524
- username: string | null;
1525
- /** The url of the user's profile picture. */
1526
- photoUrl: string | null;
1527
- }
1528
- interface Passkey {
1529
- /** The passkey credential ID */
1530
- credentialId: string;
1531
- /** Whether or not this passkey can be used for MFA */
1532
- enrolledInMfa: boolean;
1533
- /** The type of authenticator holding the passkey */
1534
- authenticatorName?: string;
1535
- /** Metadata about the device that registered the passkey */
1536
- createdWithDevice?: string;
1537
- /** Metadata about the OS that registered the passkey */
1538
- createdWithOs?: string;
1539
- /** Metadata about the browser that registered the passkey */
1540
- createdWithBrowser?: string;
1541
- }
1542
- /** Metadata about the provider app for a cross-app account */
1543
- interface ProviderAppMetadata {
1544
- /** Privy app ID for the provider app. */
1545
- id: string;
1546
- /** Name for the provider app. */
1547
- name?: string;
1548
- /** Logo URL for the provider app. */
1549
- logoUrl?: string;
1550
- }
1551
- interface CrossAppAccount {
1552
- /** The user's embedded wallet address(es) from the provider app */
1553
- embeddedWallets: {
1554
- address: string;
1555
- }[];
1556
- smartWallets: {
1557
- address: string;
1558
- }[];
1559
- providerApp: ProviderAppMetadata;
1560
- subject: string;
1561
- }
1562
- /** Object representation of a user's email, with additional metadata for advanced use cases. */
1563
- interface EmailWithMetadata extends LinkMetadata, Email {
1564
- /** Denotes that this is an email account. */
1565
- type: 'email';
1566
- }
1567
- /** Object representation of a user's phone number, with additional metadata for advanced use cases. */
1568
- interface PhoneWithMetadata extends LinkMetadata, Phone {
1569
- /** Denotes that this is a phone account. */
1570
- type: 'phone';
1571
- }
1572
- /** Object representation of a user's wallet, with additional metadata for advanced use cases. */
1573
- interface WalletWithMetadata extends LinkMetadata, Wallet {
1574
- /** Denotes that this is a wallet account. */
1575
- type: 'wallet';
1576
- }
1577
- /** Object representation of a user's Google Account, with additional metadata for advanced use cases. */
1578
- interface GoogleOAuthWithMetadata extends LinkMetadata, Google {
1579
- /** Denotes that this is a Google account. */
1580
- type: 'google_oauth';
1581
- }
1582
- /** Object representation of a user's Twitter Account, with additional metadata for advanced use cases. */
1583
- interface TwitterOAuthWithMetadata extends LinkMetadata, Twitter {
1584
- /** Denotes that this is a Twitter account. */
1585
- type: 'twitter_oauth';
1586
- }
1587
- /** Object representation of a user's Discord Account, with additional metadata for advanced use cases. */
1588
- interface DiscordOAuthWithMetadata extends LinkMetadata, Discord {
1589
- /** Denotes that this is a Discord account. */
1590
- type: 'discord_oauth';
1591
- }
1592
- /** Object representation of a user's Github Account, with additional metadata for advanced use cases. */
1593
- interface GithubOAuthWithMetadata extends LinkMetadata, Github {
1594
- /** Denotes that this is a Github account. */
1595
- type: 'github_oauth';
1596
- }
1597
- /** Object representation of a user's Tiktok Account, with additional metadata for advanced use cases. */
1598
- interface SpotifyOAuthWithMetadata extends LinkMetadata, Spotify {
1599
- /** Denotes that this is a Tiktok account. */
1600
- type: 'spotify_oauth';
1601
- }
1602
- /** Object representation of a user's Instagram Account, with additional metadata for advanced use cases. */
1603
- interface InstagramOAuthWithMetadata extends LinkMetadata, Instagram {
1604
- /** Denotes that this is a Instagram account. */
1605
- type: 'instagram_oauth';
1606
- }
1607
- /** Object representation of a user's Tiktok Account, with additional metadata for advanced use cases. */
1608
- interface TiktokOAuthWithMetadata extends LinkMetadata, Tiktok {
1609
- /** Denotes that this is a Tiktok account. */
1610
- type: 'tiktok_oauth';
1611
- }
1612
- /** Object representation of a user's LinkedIn Account, with additional metadata for advanced use cases. */
1613
- interface LinkedInOAuthWithMetadata extends LinkMetadata, LinkedIn {
1614
- /** Denotes that this is a LinkedIn account. */
1615
- type: 'linkedin_oauth';
1616
- }
1617
- /** Object representation of a user's Apple Account, with additional metadata for advanced use cases. */
1618
- interface AppleOAuthWithMetadata extends LinkMetadata, Apple {
1619
- /** Denotes that this is a Apple account. */
1620
- type: 'apple_oauth';
1621
- }
1622
- /** Object representation of a user's Custom JWT Account, with additional metadata for advanced use cases. */
1623
- interface CustomJwtAccountWithMetadata extends LinkMetadata, CustomJwtAccount {
1624
- /** Denotes that this is an custom account. */
1625
- type: 'custom_auth';
1626
- }
1627
- /** Object representation of a user's Farcaster Account, with additional metadata for advanced use cases. */
1628
- interface FarcasterWithMetadata extends LinkMetadata, Farcaster {
1629
- /** Denotes that this is a Farcaster account. */
1630
- type: 'farcaster';
1631
- }
1632
- /** Object representation of a user's Passkey Account, with additional metadata for advanced use cases. */
1633
- interface PasskeyWithMetadata extends LinkMetadata, Passkey {
1634
- /** Denotes that this is a Passkey account. */
1635
- type: 'passkey';
1636
- }
1637
- /** Object representation of a user's Telegram Account, with additional metadata for advanced use cases. */
1638
- interface TelegramWithMetadata extends LinkMetadata, Telegram {
1639
- /** Denotes that this is a Telegram account. */
1640
- type: 'telegram';
1641
- }
1642
- /** Object representation of a user's cross-app account, with additional metadata for advanced use cases. */
1643
- interface CrossAppAccountWithMetadata extends LinkMetadata, CrossAppAccount {
1644
- /** Denotes that this is a cross-app account */
1645
- type: 'cross_app';
1646
- }
1647
- /**
1648
- * Object representation of a user's linked accounts
1649
- */
1650
- type LinkedAccountWithMetadata = WalletWithMetadata | EmailWithMetadata | PhoneWithMetadata | GoogleOAuthWithMetadata | TwitterOAuthWithMetadata | DiscordOAuthWithMetadata | GithubOAuthWithMetadata | SpotifyOAuthWithMetadata | InstagramOAuthWithMetadata | TiktokOAuthWithMetadata | LinkedInOAuthWithMetadata | AppleOAuthWithMetadata | CustomJwtAccountWithMetadata | FarcasterWithMetadata | PasskeyWithMetadata | TelegramWithMetadata | CrossAppAccountWithMetadata;
1651
- interface User {
1652
- /** The Privy-issued DID for the user. If you need to store additional information
1653
- * about a user, you can use this DID to reference them. */
1654
- id: string;
1655
- /** The datetime of when the user was created. */
1656
- createdAt: Date;
1657
- /** The user's email address, if they have linked one. It cannot be linked to another user. */
1658
- email?: Email;
1659
- /** The user's phone number, if they have linked one. It cannot be linked to another user. */
1660
- phone?: Phone;
1661
- /** The user's most recently linked wallet, if they have linked at least one wallet.
1662
- * It cannot be linked to another user.
1663
- * This wallet is the wallet that will be used for transactions and signing if it is connected.
1664
- **/
1665
- wallet?: Wallet;
1666
- /** The user's Google account, if they have linked one. It cannot be linked to another user. */
1667
- google?: Google;
1668
- /** The user's Twitter account, if they have linked one. It cannot be linked to another user. */
1669
- twitter?: Twitter;
1670
- /** The user's Discord account, if they have linked one. It cannot be linked to another user. */
1671
- discord?: Discord;
1672
- /** The user's Github account, if they have linked one. It cannot be linked to another user. */
1673
- github?: Github;
1674
- /** The user's Spotify account, if they have linked one. It cannot be linked to another user. */
1675
- spotify?: Spotify;
1676
- /** The user's Instagram account, if they have linked one. It cannot be linked to another user. */
1677
- instagram?: Instagram;
1678
- /** The user's Tiktok account, if they have linked one. It cannot be linked to another user. */
1679
- tiktok?: Tiktok;
1680
- /** The user's LinkedIn account, if they have linked one. It cannot be linked to another user. */
1681
- linkedin?: LinkedIn;
1682
- /** The user's Apple account, if they have linked one. It cannot be linked to another user. */
1683
- apple?: Apple;
1684
- /** The user's Farcaster account, if they have linked one. It cannot be linked to another user. */
1685
- farcaster?: Farcaster;
1686
- /** The user's Telegram account, if they have linked one. It cannot be linked to another user. */
1687
- telegram?: Telegram;
1688
- /** The list of accounts associated with this user. Each account contains additional metadata
1689
- * that may be helpful for advanced use cases. */
1690
- linkedAccounts: Array<LinkedAccountWithMetadata>;
1691
- /** The list of MFA Methods associated with this user. */
1692
- mfaMethods: Array<MfaMethod>;
1693
- /**
1694
- * Whether or not the user has explicitly accepted the Terms and Conditions
1695
- * and/or Privacy Policy
1696
- */
1697
- hasAcceptedTerms: boolean;
1698
- /** Whether or not the user is a guest */
1699
- isGuest: boolean;
1700
- }
1701
- type OAuthTokens = {
1702
- /** The OAuth provider. */
1703
- provider: OAuthProviderType;
1704
- /** The OAuth access token. */
1705
- accessToken: string;
1706
- /** The number of seconds until the OAuth access token expires. */
1707
- accessTokenExpiresInSeconds?: number;
1708
- /** The OAuth refresh token. */
1709
- refreshToken?: string;
1710
- /** The number of seconds until the OAuth refresh token expires.
1711
- * if the refresh token is present and this field is undefined, it is assumed
1712
- * that the refresh token does not have an expiration date
1713
- */
1714
- refreshTokenExpiresInSeconds?: number;
1715
- /** The list of OAuth scopes the access token is approved for. */
1716
- scopes?: string[];
1717
- };
1718
- type TelegramAuthConfiguration = {
1719
- botId: string;
1720
- botName: string;
1721
- seamlessAuthEnabled: boolean;
1722
- };
1723
- type FundingMethod = 'moonpay' | 'coinbase-onramp' | 'external';
1724
- type FundingConfig = {
1725
- /** The recommended currency for the user to fund. Note: to begin with we default to the chain's native currency. */
1726
- defaultRecommendedCurrency: {
1727
- chain: string;
1728
- };
1729
- /** The recommended amount of the specified currency to fund, in human readable format (eg '0.1') */
1730
- defaultRecommendedAmount: string;
1731
- /** The list of funding methods enabled for the app */
1732
- methods: FundingMethod[];
1733
- /** Whether to prompt the user to fund upon embedded wallet creation */
1734
- promptFundingOnWalletCreation: boolean;
1735
- };
1736
- type PrivyServerConfig = {
1737
- id?: string;
1738
- name?: string;
1739
- verificationKey?: string;
1740
- showWalletLoginFirst?: boolean;
1741
- allowlistConfig: AllowlistConfig;
1742
- walletAuth?: boolean;
1743
- emailAuth?: boolean;
1744
- smsAuth?: boolean;
1745
- googleOAuth?: boolean;
1746
- twitterOAuth?: boolean;
1747
- discordOAuth?: boolean;
1748
- githubOAuth?: boolean;
1749
- spotifyOAuth?: boolean;
1750
- instagramOAuth?: boolean;
1751
- tiktokOAuth?: boolean;
1752
- linkedinOAuth?: boolean;
1753
- appleOAuth?: boolean;
1754
- farcasterAuth?: boolean;
1755
- passkeyAuth?: boolean;
1756
- telegramAuth?: boolean;
1757
- termsAndConditionsUrl: string | null;
1758
- privacyPolicyUrl: string | null;
1759
- requireUsersAcceptTerms?: boolean;
1760
- createdAt?: Date;
1761
- updatedAt?: Date;
1762
- customApiUrl?: string | null;
1763
- walletConnectCloudProjectId?: string | null;
1764
- embeddedWalletConfig: EmbeddedWalletsConfig;
1765
- fiatOnRampEnabled?: boolean;
1766
- captchaEnabled?: boolean;
1767
- captchaSiteKey: string;
1768
- twitterOAuthOnMobileEnabled?: boolean;
1769
- enforceWalletUis?: boolean;
1770
- legacyWalletUiConfig?: boolean;
1771
- /** May be deprecated from the server config in a future release */
1772
- logoUrl?: string;
1773
- /** May be deprecated from the server config in a future release */
1774
- accentColor?: string;
1775
- mfaMethods?: Array<MfaMethod>;
1776
- telegramAuthConfiguration?: TelegramAuthConfiguration;
1777
- fundingConfig?: FundingConfig;
1778
- };
1779
- type HexColor = `#${string}`;
1780
- /**
1781
- * Options to customize the display of transaction prices in the embedded wallet's transaction prompt.
1782
- */
1783
- type PriceDisplayOptions = {
1784
- primary: 'fiat-currency';
1785
- secondary: 'native-token';
1786
- } | {
1787
- primary: 'native-token';
1788
- secondary: null;
1789
- };
1790
- type WalletListEntry = 'metamask' | 'coinbase_wallet' | 'rainbow' | 'phantom' | 'zerion' | 'cryptocom' | 'uniswap' | 'okx_wallet' | 'detected_wallets' | 'wallet_connect' | 'rabby_wallet' | 'safe';
1791
- type NonEmptyArray<T> = [T, ...T[]];
1792
- type LoginMethodOrderOption = 'email' | 'sms' | WalletListEntry | OAuthProviderType | 'farcaster' | 'telegram';
1793
- type ExternalWalletsConfig = {
1794
- /**
1795
- * Options to configure connections to the Coinbase Wallet (browser extension wallet, mobile wallet, and
1796
- * passkey-based smart wallet).
1797
- *
1798
- * @experimental This is an experimental config designed to give Privy developers a way to test the Coinbase Smart Wallet
1799
- * ahead of its mainnet launch. The smart wallet currently only supports the Base Sepolia testnet. In kind, DO NOT use this
1800
- * configuration in production as it will prevent users from using the Coinbase Wallet on networks other than Base Sepolia.
1801
- */
1802
- coinbaseWallet?: {
1803
- /**
1804
- * Whether Coinbase wallet connections should prompt the smart wallet, the extension wallet, or intelligently decide between the two.
1805
- * - If 'eoaOnly', Coinbase wallet connections will only prompt the Coinbase wallet browser extension or mobile app (an externally-owned account)
1806
- * - If 'smartWalletOnly', Coinbase wallet connections will only prompt the Coinbase smart wallet and will not allow users to use the extension or mobile app.
1807
- * DO NOT use this setting in production.
1808
- * - 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.
1809
- */
1810
- connectionOptions: 'all' | 'eoaOnly' | 'smartWalletOnly';
1811
- };
1812
- /**
1813
- * Options to configure WalletConnect behavior.
1814
- *
1815
- * @experimental This may change in future releases
1816
- */
1817
- walletConnect?: {
1818
- /**
1819
- * If disabled, stops WalletConnect from being initialized by the Privy SDK.
1820
- *
1821
- * WARNING: If you allow WalletConnect or WalletConnect-powered wallets, this will cause issues.
1822
- *
1823
- * Note that even if disabled, WalletConnect code may still be loaded in the browser. Defaults to true.
1824
- *
1825
- * @experimental This feature is very experimental and may break your wallet connector experience if you use external wallets.
1826
- */
1827
- enabled: boolean;
1828
- };
1829
- };
1830
- interface PrivyClientConfig {
1831
- /** All UI and theme related configuration */
1832
- appearance?: {
1833
- /** Primary theme for the privy UI. This dictates the foreground and background colors within the UI.
1834
- *
1835
- * 'light' (default): The privy default light UI.
1836
- * 'dark': The privy default dark UI.
1837
- * custom hex code (i.e. '#13152F'): A custom background. This will generate the remainder of the foreground and
1838
- * background colors for the UI by modulating the luminance of the passed color. This value should be _either_ dark
1839
- * or light (<20% or >80% luminance), for accessibility. */
1840
- theme?: 'light' | 'dark' | HexColor;
1841
- /** Accent color for the privy UI.
1842
- * Used for buttons, active borders, etc. This will generate light and dark variants.
1843
- * This overrides the server setting `accent_color`. */
1844
- accentColor?: HexColor;
1845
- /** Logo for the main privy modal screen.
1846
- * This can be a string (url) or an img / svg react element.
1847
- * If passing an element, Privy will overwrite the `style` props, to ensure proper rendering.
1848
- * This overrides the server setting `logo_url` */
1849
- logo?: string | ReactElement;
1850
- /**
1851
- * Header text for the landing screen of the Privy login modal. We strongly recommend using a string
1852
- * of length 35 or less. Strings longer than the width of the login modal will be ellipsified.
1853
- *
1854
- * Defaults to 'Log in or sign up'.
1855
- */
1856
- landingHeader?: string;
1857
- /**
1858
- * Subtitle text for the landing screen of the Privy login modal.
1859
- *
1860
- * This text will renders below the logo and will be capped at 100 characters.
1861
- *
1862
- * Defaults to undefined.
1863
- */
1864
- loginMessage?: string;
1865
- /** Determines the order of the login options in the privy modal. If true, the wallet login will render above
1866
- * social and email / sms login options.
1867
- * This overrides the server setting `show_wallet_login_first` */
1868
- showWalletLoginFirst?: boolean;
1869
- /**
1870
- * An array of {@link WalletListEntry wallet names} to configure the wallet buttons shown within
1871
- * the `login`, `connectWallet`, and `linkWallet` modals. Privy will show buttons for each option
1872
- * present in the list, in the order in which they are configured.
1873
- *
1874
- * On 'detected_wallets':
1875
- * - This option serves as a fallback to include all wallets that detected by Privy, that might not be
1876
- * individually configured in the `walletList`. Browser extension wallets that are not explicitly configured
1877
- * in the `walletList` will fall into this category.
1878
- * - If Privy detects a wallet, _and_ that wallet is configured within the `walletList` (e.g. 'metamask'),
1879
- * the order of the wallet's explicit name (e.g. 'metamask') in the `walletList` will take priority
1880
- * over the order of 'detected_wallets'.
1881
- *
1882
- * Defaults to ['detected_wallets', 'metamask', 'coinbase', 'rainbow', 'wallet_connect']
1883
- *
1884
- * @default ['detected_wallets', 'metamask', 'coinbase', 'rainbow', 'wallet_connect']
1885
- */
1886
- walletList?: WalletListEntry[];
1887
- };
1888
- /**
1889
- * Login methods for the privy modal.
1890
- *
1891
- * 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.
1892
- *
1893
- * Note that any login method included in this parameter must also be enabled as a login method in the developer dashboard.
1894
- *
1895
- * If both `loginMethodsAndOrder` and `loginMethods` are defined, `loginMethodsAndOrder` will take precedence.
1896
- */
1897
- loginMethods?: Array<'wallet' | 'email' | 'sms' | 'google' | 'twitter' | 'discord' | 'github' | 'linkedin' | 'spotify' | 'instagram' | 'tiktok' | 'apple' | 'farcaster' | 'telegram'>;
1898
- /**
1899
- * Login methods for the Privy modal. _This will override carefully designed defaults and should be used with caution._
1900
- *
1901
- * 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.
1902
- *
1903
- * Note that any login method included in this parameter must also be enabled as a login method in the developer dashboard.
1904
- *
1905
- * If both `loginMethodsAndOrder` and `loginMethods` are defined, `loginMethodsAndOrder` will take precedence.
1906
- */
1907
- loginMethodsAndOrder?: {
1908
- primary: NonEmptyArray<LoginMethodOrderOption>;
1909
- overflow?: Array<LoginMethodOrderOption>;
1910
- };
1911
- /** Options for internationalization of the privy modal */
1912
- intl?: {
1913
- /**
1914
- * This property is used to configure formatting and validation for the phone number input
1915
- * used when `phone` is enabled as a login method. Must be a valid
1916
- * [two-leter ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) (e.g. 'US').
1917
- * Defaults to 'US'.
1918
- *
1919
- * @default 'US'
1920
- */
1921
- defaultCountry: CountryCode;
1922
- };
1923
- /**
1924
- * This property is only required for apps that use a third-party authentication provider.
1925
- */
1926
- customAuth?: {
1927
- /**
1928
- * If true, enable custom authentication integration.
1929
- * This enables a JWT from a custom auth provider to be used to authenticate Privy embedded wallets.
1930
- * Defaults to true.
1931
- *
1932
- * @default true
1933
- */
1934
- enabled?: boolean;
1935
- /**
1936
- * A callback that returns the user's custom auth provider's access token as a string.
1937
- * Can be left blank if using cookies to store and send access tokens
1938
- *
1939
- * @example
1940
- * const {getAccessTokenSilently} = useAuth();
1941
- *
1942
- * <PrivyProvider
1943
- * {...props}
1944
- * config={{
1945
- * customAuth: {
1946
- * getCustomAccessToken: getAccessTokenSilently
1947
- * },
1948
- * }}
1949
- * />
1950
- */
1951
- getCustomAccessToken: () => Promise<string | undefined>;
1952
- /**
1953
- * Custom auth providers loading state
1954
- *
1955
- * @example
1956
- * const {isLoading} = useAuth();
1957
- *
1958
- * <PrivyProvider
1959
- * {...props}
1960
- * config={{
1961
- * customAuth: {
1962
- * isLoading,
1963
- * },
1964
- * }}
1965
- * />
1966
- */
1967
- isLoading: boolean;
1968
- };
1969
- /** All legal configuration */
1970
- legal?: {
1971
- /** URL to the terms and conditions page for your application.
1972
- * Rendered as a link in the privy modal footer.
1973
- * This overrides the server setting `terms_and_conditions_url` */
1974
- termsAndConditionsUrl?: string | null;
1975
- /** URL to the privacy policy page for your application.
1976
- * Rendered as a link in the privy modal footer.
1977
- * This overrides the server setting `privacy_policy_url` */
1978
- privacyPolicyUrl?: string | null;
1979
- };
1980
- walletConnectCloudProjectId?: string;
1981
- /**
1982
- * @deprecated use `supportedChains[number].rpcUrls.privyWalletOverride` instead.
1983
- *
1984
- * RPC overrides to customize RPC URLs and timeout durations.
1985
- */
1986
- rpcConfig?: RpcConfig;
1987
- /**
1988
- * @deprecated use `supportedChains` instead.
1989
- *
1990
- */
1991
- additionalChains?: Chain[];
1992
- /**
1993
- * A list of supported chains, used to specify which chains should be used throughout the application.
1994
- *
1995
- * Calling `sendTransaction` or `switchChain` on an unsupported network will throw an error.
1996
- *
1997
- * For external wallets, if the wallet's current chain post-connection (during connect-only or siwe flows)
1998
- * 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
1999
- * switching process does not fully succeed, the user will **not** be blocked from the application (and the wallet's current `chainId` can always
2000
- * be observed and acted upon accordingly).
2001
- *
2002
- * For embedded wallets, the wallet will automatically default to the `defaultChain` (if set) or first supplied `supportedChain`.
2003
- */
2004
- supportedChains?: Chain[];
2005
- /**
2006
- * When supplied, the `defaultChain` will be the default chain used throughout the application.
2007
- *
2008
- * For external wallets, it will be used if the user's wallet it not within the `supportedChains` (or default chains) list.
2009
- *
2010
- * For embedded wallets, it will be used upon initialization, when the user hasn't switched to another supported chain.
2011
- */
2012
- defaultChain?: Chain;
2013
- captchaEnabled?: boolean;
2014
- /**
2015
- * Options for connecting to external wallets like Coinbase Wallet, MetaMask, etc.
2016
- *
2017
- * @experimental This is an experimental config that is subject to breaking changes without a major version bump of the SDK.
2018
- */
2019
- externalWallets?: ExternalWalletsConfig;
2020
- /** All embedded wallets configuration */
2021
- embeddedWallets?: {
2022
- /**
2023
- * Whether an embedded wallet should be created for the user on login. This overrides the
2024
- * deprecated `createPrivyWalletOnLogin`.
2025
- *
2026
- * For `all-users`, the user will be prompted to create a Privy wallet after successfully
2027
- * logging in. If they cancel or are visiting after this flag was put in place, they will be
2028
- * prompted to create a wallet on their next login.
2029
- *
2030
- * For `users-without-wallets`, the user will be prompted to create a Privy wallet after\
2031
- * successfully logging in, only if they do not currently have any wallet associated with their
2032
- * user object - for example if they have linked an external wallet.
2033
- *
2034
- * For `off`, an embedded wallet is not created during login. You can always prompt the user to
2035
- * create one manually with your app.
2036
- *
2037
- * Defaults to 'off'.
2038
- */
2039
- createOnLogin?: EmbeddedWalletCreateOnLoginConfig;
2040
- /**
2041
- * @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
2042
- * is currently honored, but will be fully removed in a future release.
2043
- *
2044
- * If true, Privy will prompt users to create a password for their Privy embedded wallet.
2045
- * If false, embedded wallets will be created without the need of password.
2046
- *
2047
- * Defaults to false.
2048
- */
2049
- requireUserPasswordOnCreate?: boolean;
2050
- /**
2051
- * @deprecated. Instead, use the server-driven configuration found in the Privy console: https://dashboard.privy.io/apps/YOUR_APP_ID/embedded.
2052
- * If true, Privy will not prompt or instantiate any UI for embedded wallet signatures and transactions.
2053
- * If false, embedded wallet actions will raise a modal and require user confirmation to proceed.
2054
- *
2055
- * Defaults to false.
2056
- */
2057
- noPromptOnSignature?: boolean;
2058
- /**
2059
- * @experimental
2060
- *
2061
- * **This setting is only honored when using the EIP-1193 Ethereum Provider to interface
2062
- * with the embedded wallet, i.e. using `getEthereumProvider` or `getEthersProvider`.
2063
- * This setting is only honored when used alongside `noPromptOnSignature: true`**
2064
- *
2065
- * If true, calls to `sendTransaction` will wait for the transaction to be confirmed before resolving.
2066
- * If false, calls to `sendTransaction` will resolve once the transaction has been submitted.
2067
- *
2068
- * Defaults to true.
2069
- *
2070
- * @example
2071
- * <PrivyProvider
2072
- * config={{
2073
- * embeddedWallets: {
2074
- * noPromptOnSignature: true,
2075
- * waitForTransactionConfirmation: false,
2076
- * },
2077
- * }}
2078
- * >
2079
- * {children}
2080
- * </PrivyProvider>
2081
- */
2082
- waitForTransactionConfirmation?: boolean;
2083
- /**
2084
- * Options to customize the display of transaction prices in the embedded wallet's transaction
2085
- * prompt. You may configure a primary currency to emphasize, and a secondary currency to show
2086
- * as subtext. Defaults to emphasizing the price in fiat currency, and showing the price in the native
2087
- * token as subtext.
2088
- *
2089
- * You may either set:
2090
- * - `{primary: 'fiat-currency', secondary: 'native-token'}` to emphasize fiat currency prices, showing native token
2091
- * prices as subtext. This is the default.
2092
- * - `{secondary: 'native-token', secondary: null}` to show native token prices only, with no subtext.
2093
- *
2094
- * Privy does not currently support:
2095
- * - emphasizing native token prices over fiat currency prices
2096
- * - showing prices only in fiat currency, without native token prices
2097
- *
2098
- */
2099
- priceDisplay?: PriceDisplayOptions;
2100
- };
2101
- /**
2102
- * All multi-factor authentication configuration
2103
- */
2104
- mfa?: {
2105
- /**
2106
- * If true, Privy will not prompt or instantiate any UI for MFA Verification. The developer
2107
- * must handle MFA verification themselves.
2108
- * If false, any action that requires MFA will raise a modal and require user to verify MFA
2109
- * before proceeding.
2110
- *
2111
- * Defaults to false.
2112
- */
2113
- noPromptOnMfaRequired?: boolean;
2114
- };
2115
- /**
2116
- * @deprecated. Use `fundingMethodConfigurations -> moonpay -> useSandbox` instead.
2117
- * Setting associated with fiat-on-ramp flows
2118
- */
2119
- fiatOnRamp?: {
2120
- /**
2121
- * Determines whether to use the sandbox flow.
2122
- *
2123
- * Defaults to false.
2124
- */
2125
- useSandbox?: boolean;
2126
- };
2127
- /**
2128
- * Settings associated with funding methods
2129
- */
2130
- fundingMethodConfig?: {
2131
- moonpay: {
2132
- /**
2133
- * Determines whether to use the Moonpay sandbox flow.
2134
- *
2135
- * Defaults to false.
2136
- */
2137
- useSandbox?: boolean;
2138
- /**
2139
- * Determines the payment method for each Moonpay transaction.
2140
- *
2141
- * Defaults to Moonpay's default.
2142
- */
2143
- paymentMethod?: MoonpayPaymentMethod;
2144
- /**
2145
- * Determines the UI settings for each Moonpay transaction.
2146
- *
2147
- * Defaults to Moonpay's default.
2148
- */
2149
- uiConfig?: MoonpayUiConfig;
2150
- };
2151
- };
2152
- }
2153
- interface AllowlistConfig {
2154
- errorTitle: string | null;
2155
- errorDetail: string | null;
2156
- errorCtaText: string | null;
2157
- errorCtaLink: string | null;
2158
- }
2159
- type EmbeddedWalletCreateOnLoginConfig = 'users-without-wallets' | 'all-users' | 'off';
2160
- interface EmbeddedWalletsConfig {
2161
- createOnLogin: EmbeddedWalletCreateOnLoginConfig;
2162
- requireUserOwnedRecoveryOnCreate: boolean;
2163
- userOwnedRecoveryOptions: UserRecoveryMethod[];
2164
- }
2165
- type OtpFlowState = {
2166
- status: 'initial';
2167
- } | {
2168
- status: 'error';
2169
- error: Error | null;
2170
- } | {
2171
- status: 'sending-code';
2172
- } | {
2173
- status: 'awaiting-code-input';
2174
- } | {
2175
- status: 'submitting-code';
2176
- } | {
2177
- status: 'done';
2178
- };
2179
- /**
2180
- * UI configuration object for the embedded wallet's Sign Message screen
2181
- */
2182
- type SignMessageModalUIOptions = {
2183
- /**
2184
- * Title for the Sign Message screen. Defaults to 'Sign'.
2185
- */
2186
- title?: string;
2187
- /**
2188
- * Description text for the Sign Message screen. Defaults to
2189
- * 'Sign to continue'.
2190
- */
2191
- description?: string;
2192
- /**
2193
- * Text for the CTA button on the Sign Message screen. Defaults to
2194
- * 'Sign and Continue'
2195
- */
2196
- buttonText?: string;
2197
- /**
2198
- * An icon to display on the Sign Message screen. Defaults to no icon.
2199
- */
2200
- iconUrl?: string;
2201
- };
2202
- type MessageTypeProperty = {
2203
- name: string;
2204
- type: string;
2205
- };
2206
- type MessageTypes = {
2207
- [additionalProperties: string]: MessageTypeProperty[];
2208
- };
2209
- /**
2210
- * 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)
2211
- *
2212
- */
2213
- type TypedMessage<T extends MessageTypes> = {
2214
- types: T;
2215
- primaryType: keyof T;
2216
- domain: {
2217
- name?: string;
2218
- version?: string;
2219
- chainId?: number;
2220
- verifyingContract?: string;
2221
- salt?: ArrayBuffer;
2222
- };
2223
- message: Record<string, unknown>;
2224
- };
2225
- /**
2226
- * 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)
2227
- * See [`TypedMessage`](TypedMessage) for specs on the specific params of typedData.
2228
- */
2229
- type SignTypedDataParams = TypedMessage<MessageTypes>;
2230
- /**
2231
- * UI customization object for additional transaction details. Will be shown
2232
- * in an expandable accordion in the Send Transaction screen.
2233
- */
2234
- type TransactionUIOptions = {
2235
- /**
2236
- * Title for the transaction details accordion within the
2237
- * Send Transaction screen. Defaults to 'Details'.
2238
- */
2239
- title?: string;
2240
- /**
2241
- * Action that the user is taking when sending this transaction. This
2242
- * should be short (<4 words, e.g. 'Buy NFT'). Will be shown inside
2243
- * the transaction details accordion in Send Transaction screen.
2244
- */
2245
- action?: string;
2246
- /**
2247
- * If the transaction to be sent is a call to a smart contract, you may
2248
- * use this object to fill in additional details about the contract being called.
2249
- */
2250
- contractInfo?: ContractUIOptions;
2251
- /**
2252
- * @deprecated Use `description` in `SendTransactionModalUIOptions` instead.
2253
- */
2254
- description?: string;
2255
- /**
2256
- * @deprecated Use `title` instead.
2257
- */
2258
- actionDescription?: string;
2259
- };
2260
- /**
2261
- * If the transaction to be sent is a call to a smart contract, you may use this
2262
- * object to fill in additional details about the contract being called.
2263
- */
2264
- type ContractUIOptions = {
2265
- /**
2266
- * URL with more information about the smart contract.
2267
- */
2268
- url?: string;
2269
- /**
2270
- * Name of smart contract being called.
2271
- */
2272
- name?: string;
2273
- /**
2274
- * URL for an image to show in the Send Transaction screen.
2275
- */
2276
- imgUrl?: string;
2277
- /**
2278
- * Alt text for the image in the Send Transaction screen, if a
2279
- * valid `imgUrl` is set.
2280
- */
2281
- imgAltText?: string;
2282
- /**
2283
- * Size for the image in the Send Transaction screen, if a valid
2284
- * `imgUrl` is set.
2285
- */
2286
- imgSize?: 'sm' | 'lg';
2287
- /**
2288
- * @deprecated Use `description` in `SendTransactionModalUIOptions` instead.
2289
- */
2290
- actionText?: string;
2291
- };
2292
- /**
2293
- * UI customization object for the embedded wallet's Send Transaction screen
2294
- */
2295
- type SendTransactionModalUIOptions = {
2296
- /**
2297
- * Text to display at top of Send Transaction screen. Defaults to
2298
- * 'Review transaction' or 'Send (insert token symbol)' if transaction
2299
- * is a simple token transfer.
2300
- */
2301
- header?: string;
2302
- /**
2303
- * Description of the transaction being sent.
2304
- */
2305
- description?: string;
2306
- /**
2307
- * Text to show on CTA button for Send Transaction screen. Defaults to
2308
- * 'Submit'.
2309
- */
2310
- buttonText?: string;
2311
- /**
2312
- * Details about the transaction that the user will send. Will be shown
2313
- * in an accordion in the Send Transaction screen.
2314
- */
2315
- transactionInfo?: TransactionUIOptions;
2316
- /**
2317
- * Text to display at top of Send Transaction Success screen. Defaults to
2318
- * 'Transaction complete!' if transaction is successful.
2319
- */
2320
- successHeader?: string;
2321
- /**
2322
- * Description of the transaction Success screen. Defaults to 'You're all set.'
2323
- */
2324
- successDescription?: string;
2325
- /**
2326
- * @deprecated Use `header` instead.
2327
- */
2328
- title?: string;
2329
- /**
2330
- * @deprecated Use `header` instead.
2331
- */
2332
- modalTitle?: string;
2333
- /**
2334
- * @deprecated Use `transactionInfo.contractInfo` instead.
2335
- */
2336
- senderInfo?: ContractUIOptions;
2337
- };
2338
- /**
2339
- * Our external-facing `UnsignedTransactionRequest` type makes the `chainId` field optional,
2340
- * matching ethers, wagmi, and a bunch of other libraries. However, our modal needs to be "aware"
2341
- * of the transaction's `chainId` to ensure it does price conversion, quote labeling, etc. importantly.
2342
- *
2343
- * Thus, in the modal, we enforce a stricter type `UnsignedTransactionRequestWithChainId` which wraps
2344
- * `UnsignedTransactionRequest` to make `chainId` required.
2345
- *
2346
- * If the developer does not set a `chainId` in their `UnsignedTransactionRequest`, we default to the embedded
2347
- * provider's current `chainId` in `privy-provider.tsx` > `sendTransaction`
2348
- */
2349
- type UnsignedTransactionRequestWithChainId = UnsignedTransactionRequest & {
2350
- chainId: number;
2351
- };
2352
- type PrivyFarcasterSignerInitResponse = {
2353
- public_key: string;
2354
- status: 'pending_approval';
2355
- signer_approval_url: string;
2356
- } | {
2357
- public_key: string;
2358
- status: 'approved';
2359
- fid: bigint;
2360
- } | {
2361
- public_key: string;
2362
- status: 'revoked';
2363
- };
2364
- type PrefillLoginOptions = {
2365
- type: 'email' | 'phone';
2366
- value: string;
2367
- };
2368
- type RuntimeLoginOverridableOptions = {
2369
- loginMethods?: PrivyClientConfig['loginMethods'];
2370
- prefill?: PrefillLoginOptions;
2371
- };
2372
- type SetWalletRecoveryOptions = {};
2373
-
2374
- /**
2375
- * We support a subset of the provider methods found here:
2376
- *
2377
- * https://ethereum.org/en/developers/docs/apis/json-rpc/#json-rpc-methods
2378
- *
2379
- * For now, we're focused on signing-related methods because the iframe (this code)
2380
- * is the only place that has access to the private key and thus is the only one
2381
- * who can create signatures. All other methods do not need the private key and
2382
- * can therefore be implemented by clients of the iframe.
2383
- */
2384
-
2385
- declare const SUPPORTED_ETHEREUM_RPC_METHODS: readonly ["eth_sign", "eth_populateTransactionRequest", "eth_signTransaction", "personal_sign", "eth_signTypedData_v4", "csw_signUserOperation"];
2386
- type EthereumRpcMethodType = (typeof SUPPORTED_ETHEREUM_RPC_METHODS)[number];
2387
- declare const SUPPORTED_SOLANA_RPC_METHODS: string[];
2388
- type SolanaRpcMethodType = (typeof SUPPORTED_SOLANA_RPC_METHODS)[number];
2389
- type Quantity = string | number | bigint;
2390
- type UnsignedTransactionRequest = {
2391
- from?: string;
2392
- to?: string;
2393
- nonce?: Quantity;
2394
- gasLimit?: Quantity;
2395
- gasPrice?: Quantity;
2396
- data?: ArrayLike<number> | string;
2397
- value?: Quantity;
2398
- chainId?: number;
2399
- type?: number;
2400
- accessList?: Array<{
2401
- address: string;
2402
- storageKeys: Array<string>;
2403
- }> | Array<[string, Array<string>]> | Record<string, Array<string>>;
2404
- maxPriorityFeePerGas?: Quantity;
2405
- maxFeePerGas?: Quantity;
2406
- };
2407
- type TransactionLog = {
2408
- blockNumber: number;
2409
- blockHash: string;
2410
- transactionIndex: number;
2411
- removed: boolean;
2412
- address: string;
2413
- data: string;
2414
- topics: Array<string>;
2415
- transactionHash: string;
2416
- logIndex: number;
2417
- };
2418
- type TransactionReceipt = {
2419
- to: string;
2420
- from: string;
2421
- contractAddress: string;
2422
- transactionIndex: number;
2423
- root?: string;
2424
- logs: Array<TransactionLog>;
2425
- logsBloom: string;
2426
- blockHash: string;
2427
- transactionHash: string;
2428
- blockNumber: number;
2429
- confirmations: number;
2430
- byzantium: boolean;
2431
- type: number;
2432
- status?: number;
2433
- gasUsed: string;
2434
- cumulativeGasUsed: string;
2435
- effectiveGasPrice?: string;
2436
- };
2437
- interface BaseEthereumRpcRequestType {
2438
- method: EthereumRpcMethodType;
2439
- }
2440
- interface BaseSolanaRpcRequestType {
2441
- method: SolanaRpcMethodType;
2442
- }
2443
- interface eth_populateTransactionRequest extends BaseEthereumRpcRequestType {
2444
- method: 'eth_populateTransactionRequest';
2445
- params: [UnsignedTransactionRequest];
2446
- }
2447
- interface eth_populateTransactionRequestResponse {
2448
- method: 'eth_populateTransactionRequest';
2449
- data: UnsignedTransactionRequest;
2450
- }
2451
- interface eth_signTransaction extends BaseEthereumRpcRequestType {
2452
- method: 'eth_signTransaction';
2453
- params: [UnsignedTransactionRequest];
2454
- }
2455
- interface eth_sign extends BaseEthereumRpcRequestType {
2456
- method: 'eth_sign';
2457
- params: [address: string, message: string];
2458
- }
2459
- interface eth_signResponse {
2460
- method: 'eth_sign';
2461
- data: string;
2462
- }
2463
- interface personal_sign extends BaseEthereumRpcRequestType {
2464
- method: 'personal_sign';
2465
- params: [string, string];
2466
- }
2467
- interface personal_signResponse {
2468
- method: 'personal_sign';
2469
- data: string;
2470
- }
2471
- interface eth_signTransactionResponse {
2472
- method: 'eth_signTransaction';
2473
- data: string;
2474
- }
2475
- interface eth_signTypedData_v4 extends BaseEthereumRpcRequestType {
2476
- method: 'eth_signTypedData_v4';
2477
- params: [string, TypedMessage$1<MessageTypes$1> | string];
2478
- }
2479
- interface eth_signTypedData_v4Response {
2480
- method: 'eth_signTypedData_v4';
2481
- data: string;
2482
- }
2483
- interface solana_signMessage extends BaseSolanaRpcRequestType {
2484
- method: 'signMessage';
2485
- params: {
2486
- message: string;
2487
- };
2488
- }
2489
- interface solana_signMessageResponse {
2490
- method: 'signMessage';
2491
- data: {
2492
- signature: string;
2493
- };
2494
- }
2495
- type EthereumRpcRequestType = eth_signTransaction | eth_populateTransactionRequest | eth_sign | personal_sign | eth_signTypedData_v4;
2496
- type EthereumRpcResponseType = eth_signTransactionResponse | eth_populateTransactionRequestResponse | eth_signResponse | personal_signResponse | eth_signTypedData_v4Response;
2497
- type SolanaRpcRequestType = solana_signMessage;
2498
- type SolanaRpcResponseType = solana_signMessageResponse;
2499
-
2500
625
  declare function getAccessToken(): Promise<string | null>;
2501
626
  /**
2502
627
  * Properties to initialize the {@link PrivyProvider}.
@@ -3554,7 +1679,7 @@ type UseLoginWithOAuth = {
3554
1679
  *
3555
1680
  * Use this hook to log the user in with an OAuth provider, without using any Privy UIs.
3556
1681
  */
3557
- declare function useLoginWithOAuth(): UseLoginWithOAuth;
1682
+ declare const useLoginWithOAuth: (callbacks?: PrivyEvents["login"]) => UseLoginWithOAuth;
3558
1683
 
3559
1684
  type SendCodeToEmail = {
3560
1685
  email: string;
@@ -4169,4 +2294,4 @@ declare const LoginModal: ({ open }: {
4169
2294
  open: boolean;
4170
2295
  }) => react_jsx_runtime.JSX.Element;
4171
2296
 
4172
- export { Apple, AppleOAuthWithMetadata, AsExternalProvider, CallbackError, Captcha, ConnectedSolanaWallet, ConnectedWallet, ConnectorManager, ContractUIOptions, CrossAppAccount, CrossAppAccountWithMetadata, Discord, DiscordOAuthWithMetadata, EIP1193Provider, Email, EmailWithMetadata, Farcaster, FarcasterWithMetadata, FundWalletConfig, Github, GithubOAuthWithMetadata, Google, GoogleOAuthWithMetadata, LinkedIn, LinkedInOAuthWithMetadata, LoginMethodOrderOption, LoginModal, LoginWithCode, MessageTypes, MfaMethod, MoonpayConfig, MoonpayCurrencyCode, MoonpayFundingConfig, MoonpayPaymentMethod, NativeFundingConfig, NonEmptyArray, OAuthProviderType, OAuthTokens, Passkey, PasskeyWithMetadata, Phone, PhoneWithMetadata, PriceDisplayOptions, PrivyClient, PrivyClientConfig, PrivyEvents, PrivyInterface, PrivyProvider, PrivyProviderProps, PrivyProxyProvider, Quantity, DEFAULT_SUPPORTED_CHAINS as SUPPORTED_CHAINS, SendCodeToEmail, SendCodeToSms, SendTransactionModalUIOptions, SignMessageModalUIOptions, SignTypedDataParams, Telegram, TelegramWithMetadata, Tiktok, TiktokOAuthWithMetadata, TransactionLog, TransactionReceipt, TransactionUIOptions, Twitter, TwitterOAuthWithMetadata, TypedMessage, UnsignedTransactionRequest, UseConnectCoinbaseSmartWalletInterface, UseFundWalletInterface, UseLoginWithEmail, UseLoginWithSms, UseOAuthTokens, UseSolanaWalletsInterface, UseWalletsInterface, User, VERSION, Wallet, WalletConnector, WalletListEntry, WalletWithMetadata, addRpcUrlOverrideToChain, errorIndicatesMaxMfaRetries, errorIndicatesMfaTimeout, errorIndicatesMfaVerificationFailed, getAccessToken, getEmbeddedConnectedWallet, useConnectCoinbaseSmartWallet, useConnectWallet, useCreateWallet, useCrossAppAccounts, useExperimentalFarcasterSigner, useFarcasterSigner, useFundWallet, useGuestAccounts, useLinkAccount, useLinkWithSiwe, useLogin, useLoginWithEmail, useLoginWithOAuth, useLoginWithSms, useLogout, useMfa, useMfaEnrollment, useModalStatus, useOAuthTokens, usePrivy, useRegisterMfaListener, useSendTransaction, useSetWalletPassword, useSetWalletRecovery, useSignMessage, useSignTypedData, useSolanaWallets, useToken, useWallets };
2297
+ export { CallbackError, Captcha, ConnectedSolanaWallet, ConnectedWallet, ConnectorManager, EIP1193Provider, FundWalletConfig, LoginModal, LoginWithCode, MfaMethod, OAuthProviderType, OAuthTokens, PrivyClient, PrivyClientConfig, PrivyEvents, PrivyInterface, PrivyProvider, PrivyProviderProps, PrivyProxyProvider, DEFAULT_SUPPORTED_CHAINS as SUPPORTED_CHAINS, SendCodeToEmail, SendCodeToSms, SendTransactionModalUIOptions, SignMessageModalUIOptions, SignTypedDataParams, TransactionReceipt, UnsignedTransactionRequest, UseConnectCoinbaseSmartWalletInterface, UseFundWalletInterface, UseLoginWithEmail, UseLoginWithSms, UseOAuthTokens, UseSolanaWalletsInterface, UseWalletsInterface, User, VERSION, Wallet, WalletConnector, WalletListEntry, addRpcUrlOverrideToChain, errorIndicatesMaxMfaRetries, errorIndicatesMfaTimeout, errorIndicatesMfaVerificationFailed, getAccessToken, getEmbeddedConnectedWallet, useConnectCoinbaseSmartWallet, useConnectWallet, useCreateWallet, useCrossAppAccounts, useExperimentalFarcasterSigner, useFarcasterSigner, useFundWallet, useGuestAccounts, useLinkAccount, useLinkWithSiwe, useLogin, useLoginWithEmail, useLoginWithOAuth, useLoginWithSms, useLogout, useMfa, useMfaEnrollment, useModalStatus, useOAuthTokens, usePrivy, useRegisterMfaListener, useSendTransaction, useSetWalletPassword, useSetWalletRecovery, useSignMessage, useSignTypedData, useSolanaWallets, useToken, useWallets };