@privy-io/js-sdk-core 0.30.0 → 0.30.2

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.
@@ -125,6 +125,11 @@ interface eth_signTypedData_v4Response {
125
125
  }
126
126
  export type RpcRequestType = eth_sendTransaction | eth_signTransaction | eth_populateTransactionRequest | eth_sign | personal_sign | eth_signTypedData_v4;
127
127
  export type RpcResponseType = eth_signTransactionResponse | eth_populateTransactionRequestResponse | eth_signResponse | personal_signResponse | eth_signTypedData_v4Response;
128
+ export interface SolanaRpcResponseType {
129
+ data: {
130
+ signature: string;
131
+ };
132
+ }
128
133
  declare const SUPPORTED_SOLANA_RPC_METHODS: readonly ["signMessage"];
129
134
  type SolanaRpcMethodType = (typeof SUPPORTED_SOLANA_RPC_METHODS)[number];
130
135
  export declare const isSupportedSolanaRpcMethod: (method: any) => method is SolanaRpcMethodType;
@@ -138,15 +143,11 @@ export interface SolanaRpcRequestType extends BaseSolanaRpcRequestType {
138
143
  message: string;
139
144
  };
140
145
  }
141
- export interface SolanaRpcResponseType {
142
- data: {
143
- signature: string;
144
- };
145
- }
146
- export type PrivyEventType = 'privy:iframe:ready' | 'privy:wallet:create' | 'privy:wallet:connect' | 'privy:wallet:recover' | 'privy:wallet:rpc' | 'privy:wallet:set-recovery' | 'privy:solana-wallet:create' | 'privy:solana-wallet:create-additional' | 'privy:solana-wallet:connect' | 'privy:solana-wallet:recover' | 'privy:solana-wallet:rpc' | 'privy:mfa:verify' | 'privy:mfa:init-enrollment' | 'privy:mfa:submit-enrollment' | 'privy:mfa:unenroll' | 'privy:mfa:clear';
146
+ export type PrivyEventType = 'privy:iframe:ready' | 'privy:wallets:create' | 'privy:wallets:add' | 'privy:wallets:set-recovery' | 'privy:wallets:connect' | 'privy:wallets:recover' | 'privy:wallets:rpc' | 'privy:wallet:create' | 'privy:wallet:connect' | 'privy:wallet:recover' | 'privy:wallet:rpc' | 'privy:wallet:set-recovery' | 'privy:solana-wallet:create' | 'privy:solana-wallet:create-additional' | 'privy:solana-wallet:connect' | 'privy:solana-wallet:recover' | 'privy:solana-wallet:rpc' | 'privy:mfa:verify' | 'privy:mfa:init-enrollment' | 'privy:mfa:submit-enrollment' | 'privy:mfa:unenroll' | 'privy:mfa:clear';
147
147
  export type IEmbeddedWalletRecoveryOptions = 'privy' | 'user-passcode' | 'google-drive' | 'icloud' | 'icloud-native';
148
148
  export type IUserRecoveryMethod = 'user-passcode' | 'google-drive' | 'icloud' | 'icloud-native';
149
149
  export type EmbeddedWalletRecoveryOptions = 'privy' | 'user-passcode' | 'google-drive' | 'icloud';
150
+ export type EntropyIdType = 'ethereum' | 'solana';
150
151
  export type PasswordRecoveryInput = {
151
152
  recoveryMethod: 'user-passcode';
152
153
  password: string;
@@ -163,7 +164,171 @@ export type ICloudNativeRecoveryInput = {
163
164
  export type SetRecoveryInput = {
164
165
  wallet: PrivyEthereumEmbeddedWalletAccount;
165
166
  } & (PasswordRecoveryInput | CloudRecoveryInput | ICloudNativeRecoveryInput | PrivyRecoveryInput);
167
+ type BaseProxyRequest = {
168
+ accessToken: string;
169
+ } & Partial<MfaSubmitArgs>;
170
+ type PrivyResponseBaseEventType<E extends PrivyEventType, D extends PrivyResponseDataType> = {
171
+ id: string;
172
+ event: E;
173
+ data: D;
174
+ };
175
+ type PrivyEventResponseCallbacksType<R extends PrivyResponseDataType> = {
176
+ reject: (error: Error) => void;
177
+ resolve: (res: R) => void;
178
+ };
179
+ type BaseWalletsRequestData = BaseProxyRequest & {
180
+ chainType: 'ethereum' | 'solana' | 'bitcoin-taproot' | 'bitcoin-segwit';
181
+ };
166
182
  export type IframeReadyRequestDataType = Record<string, never>;
183
+ export type IframeReadyResponseDataType = Record<string, never>;
184
+ export type IframeReadyResponseCallbacksType = PrivyEventResponseCallbacksType<IframeReadyResponseDataType>;
185
+ type IframeReadyResponseEventType = PrivyResponseBaseEventType<'privy:iframe:ready', IframeReadyResponseDataType>;
186
+ export type WalletsCreateRequestDataType = BaseWalletsRequestData & {
187
+ /** Optional: the user-specified recovery password, replaces recoveryPin */
188
+ recoveryPassword?: string;
189
+ /** Optional: the recovery method to be used for the created wallet */
190
+ recoveryMethod?: EmbeddedWalletRecoveryOptions;
191
+ /** Optional: in the case of cloud recovery, the access token to be used to communicated with the cloud provider (eg Google) */
192
+ recoveryAccessToken?: string;
193
+ /** Optional: override the recoverySecret, only for use when we need to store recovery secrets in cloud storage outside of the iframe (eg native) */
194
+ recoverySecretOverride?: string;
195
+ /** Optional: override the iCloudRecordName, only for use when we need to store recovery secrets in cloud storage outside of the iframe (eg native) */
196
+ iCloudRecordNameOverride?: string;
197
+ };
198
+ export type WalletsCreateResponseDataType = {
199
+ address: string;
200
+ };
201
+ export type WalletsCreateResponseCallbacksType = PrivyEventResponseCallbacksType<WalletsCreateResponseDataType>;
202
+ type WalletsCreateResponseEventType = PrivyResponseBaseEventType<'privy:wallets:create', WalletsCreateResponseDataType>;
203
+ export type WalletsAddRequestDataType = BaseWalletsRequestData & {
204
+ /**
205
+ * Key with which to look up the existing entropy
206
+ */
207
+ entropyId: string;
208
+ /**
209
+ * Source of the key with which to look up the existing entropy
210
+ */
211
+ entropyIdType: EntropyIdType;
212
+ /**
213
+ * The HD node index at which to create a wallet. Must be >= 1 AND equal to the next
214
+ * index in the sequence, since the primary wallet is created at index 0.
215
+ */
216
+ hdWalletIndex: number;
217
+ };
218
+ export type WalletsAddResponseDataType = {
219
+ address: string;
220
+ };
221
+ export type WalletsAddResponseCallbacksType = PrivyEventResponseCallbacksType<WalletsAddResponseDataType>;
222
+ type WalletsAddResponseEventType = PrivyResponseBaseEventType<'privy:wallets:add', WalletsAddResponseDataType>;
223
+ type WalletsSetRecoveryBaseRequestDataType = BaseWalletsRequestData & {
224
+ /**
225
+ * Key with which to look up the existing entropy
226
+ */
227
+ entropyId: string;
228
+ /**
229
+ * Source of the key with which to look up the existing entropy
230
+ */
231
+ entropyIdType: EntropyIdType;
232
+ existingRecoveryMethod?: EmbeddedWalletRecoveryOptions;
233
+ };
234
+ type WalletsSetRecoveryPasswordDataType = WalletsSetRecoveryBaseRequestDataType & {
235
+ recoveryMethod: 'user-passcode';
236
+ recoveryPassword: string;
237
+ };
238
+ type WalletsSetRecoveryGoogleDriveDataType = WalletsSetRecoveryBaseRequestDataType & {
239
+ recoveryMethod: 'google-drive';
240
+ recoveryAccessToken: string;
241
+ };
242
+ type WalletsSetRecoveryICloudDataType = WalletsSetRecoveryBaseRequestDataType & {
243
+ recoveryMethod: 'icloud';
244
+ recoveryAccessToken: string;
245
+ };
246
+ type WalletsSetRecoveryICloudNativeDataType = WalletsSetRecoveryBaseRequestDataType & {
247
+ recoveryMethod: 'icloud-native';
248
+ recoverySecretOverride: string;
249
+ iCloudRecordNameOverride: string;
250
+ };
251
+ export type WalletsSetRecoveryRequestDataType = WalletsSetRecoveryPasswordDataType | WalletsSetRecoveryGoogleDriveDataType | WalletsSetRecoveryICloudDataType | WalletsSetRecoveryICloudNativeDataType;
252
+ export type WalletsSetRecoveryResponseDataType = {
253
+ address: string;
254
+ };
255
+ export type WalletsSetRecoveryResponseCallbacksType = PrivyEventResponseCallbacksType<WalletsSetRecoveryResponseDataType>;
256
+ type WalletsSetRecoveryResponseEventType = PrivyResponseBaseEventType<'privy:wallets:set-recovery', WalletsSetRecoveryResponseDataType>;
257
+ export type WalletsConnectRequestDataType = BaseWalletsRequestData & {
258
+ /**
259
+ * Key with which to look up the existing entropy
260
+ */
261
+ entropyId: string;
262
+ /**
263
+ * Source of the key with which to look up the existing entropy
264
+ */
265
+ entropyIdType: EntropyIdType;
266
+ };
267
+ export type WalletsConnectResponseDataType = {
268
+ address: string;
269
+ };
270
+ export type WalletsConnectResponseCallbacksType = PrivyEventResponseCallbacksType<WalletsConnectResponseDataType>;
271
+ type WalletsConnectResponseEventType = PrivyResponseBaseEventType<'privy:wallets:connect', WalletsConnectResponseDataType>;
272
+ export type WalletsRecoverRequestDataType = BaseWalletsRequestData & {
273
+ /**
274
+ * Key with which to look up the existing entropy
275
+ */
276
+ entropyId: string;
277
+ /**
278
+ * Source of the key with which to look up the existing entropy
279
+ */
280
+ entropyIdType: EntropyIdType;
281
+ /** Optional: the user-specified recovery password, replaces recoveryPin */
282
+ recoveryPassword?: string;
283
+ /** Optional: in the case of cloud recovery, the access token to be used to communicated with the cloud provider (eg Google) */
284
+ recoveryAccessToken?: string;
285
+ /** Optional: override the recoverySecret, only for use when we need to retrieve recovery secrets in cloud storage outside of the iframe (eg native) */
286
+ recoverySecretOverride?: string;
287
+ };
288
+ export type WalletsRecoverResponseDataType = {
289
+ address: string;
290
+ };
291
+ export type WalletsRecoverResponseCallbacksType = PrivyEventResponseCallbacksType<WalletsRecoverResponseDataType>;
292
+ type WalletsRecoverResponseEventType = PrivyResponseBaseEventType<'privy:wallets:recover', WalletsRecoverResponseDataType>;
293
+ type WalletsRpcEthereumRequestDataType = {
294
+ chainType: 'ethereum';
295
+ request: RpcRequestType;
296
+ };
297
+ type WalletsRpcSolanaRequestDataType = {
298
+ chainType: 'solana';
299
+ request: SolanaRpcRequestType;
300
+ };
301
+ type WalletsRpcBitcoinRequestDataType = {
302
+ chainType: 'bitcoin-taproot' | 'bitcoin-segwit';
303
+ request: unknown;
304
+ };
305
+ export type WalletsRpcRequestDataType = BaseWalletsRequestData & {
306
+ /**
307
+ * Key with which to look up the existing entropy
308
+ */
309
+ entropyId: string;
310
+ /**
311
+ * Source of the key with which to look up the existing entropy
312
+ */
313
+ entropyIdType: EntropyIdType;
314
+ } & (WalletsRpcEthereumRequestDataType | WalletsRpcSolanaRequestDataType | WalletsRpcBitcoinRequestDataType);
315
+ type WalletsRpcEthereumResponseDataType = {
316
+ chainType: 'ethereum';
317
+ response: RpcResponseType;
318
+ };
319
+ type WalletsRpcSolanaResponseDataType = {
320
+ chainType: 'solana';
321
+ response: SolanaRpcResponseType;
322
+ };
323
+ type WalletsRpcBitcoinResponseDataType = {
324
+ chainType: 'bitcoin-taproot' | 'bitcoin-segwit';
325
+ response: unknown;
326
+ };
327
+ export type WalletsRpcResponseDataType = {
328
+ address: string;
329
+ } & (WalletsRpcEthereumResponseDataType | WalletsRpcSolanaResponseDataType | WalletsRpcBitcoinResponseDataType);
330
+ export type WalletsRpcResponseCallbacksType = PrivyEventResponseCallbacksType<WalletsRpcResponseDataType>;
331
+ type WalletsRpcResponseEventType = PrivyResponseBaseEventType<'privy:wallets:rpc', WalletsRpcResponseDataType>;
167
332
  export type EthereumWalletCreateRequestDataType = BaseProxyRequest & {
168
333
  accessToken: string;
169
334
  recoveryPassword?: string;
@@ -177,24 +342,43 @@ export type EthereumWalletCreateRequestDataType = BaseProxyRequest & {
177
342
  */
178
343
  solanaAddress?: string;
179
344
  };
180
- type BaseProxyRequest = {
181
- accessToken: string;
182
- } & Partial<MfaSubmitArgs>;
183
345
  export type WalletCreateRequestDataType = EthereumWalletCreateRequestDataType;
346
+ export type WalletCreateResponseDataType = {
347
+ address: string;
348
+ };
349
+ export type WalletCreateResponseCallbacksType = PrivyEventResponseCallbacksType<WalletCreateResponseDataType>;
350
+ type WalletCreateResponseEventType = PrivyResponseBaseEventType<'privy:wallet:create', WalletCreateResponseDataType>;
184
351
  export type WalletConnectRequestDataType = BaseProxyRequest & {
185
- accessToken: string;
186
352
  address: string;
187
353
  };
354
+ export type WalletConnectResponseDataType = {
355
+ address: string;
356
+ };
357
+ export type WalletConnectResponseCallbacksType = PrivyEventResponseCallbacksType<WalletConnectResponseDataType>;
358
+ type WalletConnectResponseEventType = PrivyResponseBaseEventType<'privy:wallet:connect', WalletConnectResponseDataType>;
188
359
  export type WalletRecoverRequestDataType = BaseProxyRequest & {
189
- accessToken: string;
190
360
  address: string;
191
361
  recoveryPassword?: string;
192
362
  recoveryMethod?: string;
193
363
  recoveryAccessToken?: string;
194
364
  recoverySecretOverride?: string;
195
365
  };
366
+ export type WalletRecoverResponseDataType = {
367
+ address: string;
368
+ };
369
+ export type WalletRecoverResponseCallbacksType = PrivyEventResponseCallbacksType<WalletRecoverResponseDataType>;
370
+ type WalletRecoverResponseEventType = PrivyResponseBaseEventType<'privy:wallet:recover', WalletRecoverResponseDataType>;
371
+ export type WalletRpcRequestDataType = BaseProxyRequest & {
372
+ address: string;
373
+ request: RpcRequestType;
374
+ };
375
+ export type WalletRpcResponseDataType = {
376
+ address: string;
377
+ response: RpcResponseType;
378
+ };
379
+ export type WalletRpcResponseCallbacksType = PrivyEventResponseCallbacksType<WalletRpcResponseDataType>;
380
+ type WalletRpcResponseEventType = PrivyResponseBaseEventType<'privy:wallet:rpc', WalletRpcResponseDataType>;
196
381
  export type WalletSetRecoveryRequestDataType = BaseProxyRequest & {
197
- accessToken: string;
198
382
  address: string;
199
383
  recoveryMethod: IUserRecoveryMethod;
200
384
  recoveryPassword?: string;
@@ -202,21 +386,24 @@ export type WalletSetRecoveryRequestDataType = BaseProxyRequest & {
202
386
  recoverySecretOverride?: string;
203
387
  iCloudRecordNameOverride?: string;
204
388
  };
205
- export type WalletRpcRequestDataType = BaseProxyRequest & {
206
- accessToken: string;
389
+ export type WalletSetRecoveryResponseDataType = {
207
390
  address: string;
208
- request: RpcRequestType;
209
391
  };
392
+ export type WalletSetRecoveryResponseCallbacksType = PrivyEventResponseCallbacksType<WalletSetRecoveryResponseDataType>;
393
+ type WalletSetRecoveryResponseEventType = PrivyResponseBaseEventType<'privy:wallet:set-recovery', WalletSetRecoveryResponseDataType>;
210
394
  export type SolanaWalletCreateRequestDataType = BaseProxyRequest & {
211
- accessToken: string;
212
395
  /**
213
396
  * The user's existing Ethereum embedded wallet address if they have one. This parameter must be passed
214
397
  * if the user has an Ethereum embedded wallet, otherwise Solana wallet creation will fail.
215
398
  */
216
399
  ethereumAddress?: string;
217
400
  };
401
+ export type SolanaWalletCreateResponseDataType = {
402
+ publicKey: string;
403
+ };
404
+ export type SolanaWalletCreateResponseCallbacksType = PrivyEventResponseCallbacksType<SolanaWalletCreateResponseDataType>;
405
+ type SolanaWalletCreateResponseEventType = PrivyResponseBaseEventType<'privy:solana-wallet:create', SolanaWalletCreateResponseDataType>;
218
406
  export type SolanaWalletCreateAdditionalRequestDataType = BaseProxyRequest & {
219
- accessToken: string;
220
407
  /**
221
408
  * The address/public key of the solana HD wallet at index 0
222
409
  */
@@ -228,16 +415,28 @@ export type SolanaWalletCreateAdditionalRequestDataType = BaseProxyRequest & {
228
415
  */
229
416
  hdWalletIndex: number;
230
417
  };
418
+ export type SolanaWalletCreateAdditionalResponseDataType = {
419
+ publicKey: string;
420
+ };
421
+ export type SolanaWalletCreateAdditionalResponseCallbacksType = PrivyEventResponseCallbacksType<SolanaWalletCreateAdditionalResponseDataType>;
422
+ type SolanaWalletCreateAdditionalResponseEventType = PrivyResponseBaseEventType<'privy:solana-wallet:create-additional', SolanaWalletCreateAdditionalResponseDataType>;
231
423
  export type SolanaWalletConnectRequestDataType = BaseProxyRequest & {
232
- accessToken: string;
233
424
  publicKey: string;
234
425
  };
426
+ export type SolanaWalletConnectResponseDataType = {
427
+ publicKey: string;
428
+ };
429
+ export type SolanaWalletConnectResponseCallbacksType = PrivyEventResponseCallbacksType<SolanaWalletConnectResponseDataType>;
430
+ type SolanaWalletConnectResponseEventType = PrivyResponseBaseEventType<'privy:solana-wallet:connect', SolanaWalletConnectResponseDataType>;
235
431
  export type SolanaWalletRecoverRequestDataType = BaseProxyRequest & {
236
- accessToken: string;
237
432
  publicKey: string;
238
433
  };
434
+ export type SolanaWalletRecoverResponseDataType = {
435
+ publicKey: string;
436
+ };
437
+ export type SolanaWalletRecoverResponseCallbacksType = PrivyEventResponseCallbacksType<SolanaWalletRecoverResponseDataType>;
438
+ type SolanaWalletRecoverResponseEventType = PrivyResponseBaseEventType<'privy:solana-wallet:recover', SolanaWalletRecoverResponseDataType>;
239
439
  export type SolanaWalletRpcRequestDataType = BaseProxyRequest & {
240
- accessToken: string;
241
440
  /**
242
441
  * The primary public key of the embedded wallet at HD index 0.
243
442
  */
@@ -261,169 +460,70 @@ export type SolanaWalletRpcRequestDataType = BaseProxyRequest & {
261
460
  hdWalletIndex?: number;
262
461
  request: SolanaRpcRequestType;
263
462
  };
264
- export type PrivyRequestDataType = IframeReadyRequestDataType | EthereumWalletCreateRequestDataType | WalletConnectRequestDataType | WalletRecoverRequestDataType | WalletRpcRequestDataType | WalletSetRecoveryRequestDataType | SolanaWalletCreateRequestDataType | SolanaWalletCreateAdditionalRequestDataType | SolanaWalletRecoverRequestDataType | SolanaWalletConnectRequestDataType | SolanaWalletRpcRequestDataType | MfaVerifyRequestDataType | MfaInitEnrollmentRequestDataType | MfaSubmitEnrollmentRequestDataType | MfaUnenrollRequestDataType | MfaClearRequestDataType;
265
- export type PrivyErrorResponseDataType = {
266
- error: Error;
267
- };
268
- export type IframeReadyResponseDataType = Record<string, never>;
269
- export type WalletCreateResponseDataType = {
270
- address: string;
271
- };
272
- export type WalletConnectResponseDataType = {
273
- address: string;
274
- };
275
- export type WalletRecoverResponseDataType = {
276
- address: string;
277
- };
278
- export type WalletSetRecoveryResponseDataType = {
279
- address: string;
280
- };
281
- export type WalletRpcResponseDataType = {
282
- address: string;
283
- response: RpcResponseType;
284
- };
285
- export type SolanaWalletCreateResponseDataType = {
286
- publicKey: string;
287
- };
288
- export type SolanaWalletCreateAdditionalResponseDataType = {
463
+ export type SolanaWalletRpcResponseDataType = {
289
464
  publicKey: string;
465
+ response: SolanaRpcResponseType;
290
466
  };
291
- export type SolanaWalletConnectResponseDataType = {
292
- publicKey: string;
467
+ export type SolanaWalletRpcResponseCallbacksType = PrivyEventResponseCallbacksType<SolanaWalletRpcResponseDataType>;
468
+ type SolanaWalletRpcResponseEventType = PrivyResponseBaseEventType<'privy:solana-wallet:rpc', SolanaWalletRpcResponseDataType>;
469
+ export type MfaVerifyRequestDataType = BaseProxyRequest;
470
+ export type MfaVerifyResponseDataType = Record<string, never>;
471
+ export type MfaVerifyResponseCallbacksType = PrivyEventResponseCallbacksType<MfaVerifyResponseDataType>;
472
+ type MfaVerifyResponseEventType = PrivyResponseBaseEventType<'privy:mfa:verify', MfaVerifyResponseDataType>;
473
+ export type MfaInitEnrollmentRequestDataType = BaseProxyRequest & ({
474
+ method: 'sms';
475
+ phoneNumber: string;
476
+ } | {
477
+ method: 'totp';
478
+ });
479
+ export type MfaInitEnrollmentResponseDataType = {
480
+ method: string;
481
+ secret?: string;
482
+ authUrl?: string;
293
483
  };
294
- export type SolanaWalletRecoverResponseDataType = {
295
- publicKey: string;
484
+ export type MfaInitEnrollmentResponseCallbacksType = PrivyEventResponseCallbacksType<MfaInitEnrollmentResponseDataType>;
485
+ type MfaInitEnrollmentResponseEventType = PrivyResponseBaseEventType<'privy:mfa:init-enrollment', MfaInitEnrollmentResponseDataType>;
486
+ export type MfaSubmitEnrollmentRequestDataType = BaseProxyRequest & ({
487
+ method: 'sms';
488
+ code: string;
489
+ phoneNumber: string;
490
+ } | {
491
+ method: 'totp';
492
+ code: string;
493
+ } | {
494
+ method: 'passkey';
495
+ credentialIds: string[];
496
+ });
497
+ export type MfaSubmitEnrollmentResponseDataType = Record<string, never>;
498
+ export type MfaSubmitEnrollmentResponseCallbacksType = PrivyEventResponseCallbacksType<MfaSubmitEnrollmentResponseDataType>;
499
+ type MfaSubmitEnrollmentResponseEventType = PrivyResponseBaseEventType<'privy:mfa:submit-enrollment', MfaSubmitEnrollmentResponseDataType>;
500
+ export type MfaUnenrollRequestDataType = BaseProxyRequest & {
501
+ method: 'sms' | 'totp';
296
502
  };
297
- export type SolanaWalletSetRecoveryPasswordResponseDataType = {
298
- publicKey: string;
503
+ export type MfaUnenrollResponseDataType = Record<string, never>;
504
+ export type MfaUnenrollResponseCallbacksType = PrivyEventResponseCallbacksType<MfaUnenrollResponseDataType>;
505
+ type MfaUnenrollResponseEventType = PrivyResponseBaseEventType<'privy:mfa:unenroll', MfaUnenrollResponseDataType>;
506
+ export type MfaClearRequestDataType = {
507
+ userId: string;
299
508
  };
300
- export type SolanaWalletRpcResponseDataType = {
301
- publicKey: string;
302
- response: SolanaRpcResponseType;
509
+ export type MfaClearResponseDataType = Record<string, never>;
510
+ export type MfaClearResponseCallbacksType = PrivyEventResponseCallbacksType<MfaClearResponseDataType>;
511
+ type MfaClearResponseEventType = PrivyResponseBaseEventType<'privy:mfa:clear', MfaClearResponseDataType>;
512
+ export type PrivyRequestDataType = IframeReadyRequestDataType | WalletsCreateRequestDataType | WalletsAddRequestDataType | WalletsSetRecoveryRequestDataType | WalletsConnectRequestDataType | WalletsRecoverRequestDataType | WalletsRpcRequestDataType | EthereumWalletCreateRequestDataType | WalletConnectRequestDataType | WalletRecoverRequestDataType | WalletRpcRequestDataType | WalletSetRecoveryRequestDataType | SolanaWalletCreateRequestDataType | SolanaWalletCreateAdditionalRequestDataType | SolanaWalletRecoverRequestDataType | SolanaWalletConnectRequestDataType | SolanaWalletRpcRequestDataType | MfaVerifyRequestDataType | MfaInitEnrollmentRequestDataType | MfaSubmitEnrollmentRequestDataType | MfaUnenrollRequestDataType | MfaClearRequestDataType;
513
+ export type PrivyErrorResponseDataType = {
514
+ error: Error;
303
515
  };
304
- export type PrivyResponseDataType = IframeReadyResponseDataType | WalletCreateResponseDataType | WalletConnectResponseDataType | WalletRecoverResponseDataType | WalletSetRecoveryResponseDataType | WalletRpcResponseDataType | SolanaWalletCreateResponseDataType | SolanaWalletConnectResponseDataType | SolanaWalletRecoverResponseDataType | SolanaWalletRpcResponseDataType | MfaVerifyResponseDataType | MfaInitEnrollmentResponseDataType | MfaSubmitEnrollmentResponseDataType | MfaUnenrollResponseDataType | MfaClearResponseDataType;
516
+ export type PrivyResponseDataType = IframeReadyResponseDataType | WalletsCreateResponseDataType | WalletsAddResponseDataType | WalletsSetRecoveryResponseDataType | WalletsConnectResponseDataType | WalletsRecoverResponseDataType | WalletsRpcResponseDataType | WalletCreateResponseDataType | WalletConnectResponseDataType | WalletRecoverResponseDataType | WalletSetRecoveryResponseDataType | WalletRpcResponseDataType | SolanaWalletCreateResponseDataType | SolanaWalletConnectResponseDataType | SolanaWalletRecoverResponseDataType | SolanaWalletRpcResponseDataType | MfaVerifyResponseDataType | MfaInitEnrollmentResponseDataType | MfaSubmitEnrollmentResponseDataType | MfaUnenrollResponseDataType | MfaClearResponseDataType;
305
517
  export declare const PrivyIframeErrorTypes: readonly ["error", "invalid_request_arguments", "wallet_not_on_device", "invalid_recovery_pin", "insufficient_funds", "mfa_timeout", "missing_or_invalid_mfa", "mfa_verification_max_attempts_reached"];
306
518
  export type PrivyIframeErrorTypesType = (typeof PrivyIframeErrorTypes)[number];
307
- interface PrivyResponseBaseEventType {
308
- id: string;
309
- event: PrivyEventType;
310
- }
311
- export interface PrivyErrorResponseEventType extends PrivyResponseBaseEventType {
519
+ export type PrivyErrorResponseEventType = PrivyResponseBaseEventType<PrivyEventType, PrivyResponseDataType> & {
312
520
  error: {
313
521
  type: PrivyIframeErrorTypesType;
314
522
  message: string;
315
523
  };
316
- }
317
- interface IframeReadyResponseEventType extends PrivyResponseBaseEventType {
318
- event: 'privy:iframe:ready';
319
- data: IframeReadyResponseDataType;
320
- }
321
- interface WalletCreateResponseEventType extends PrivyResponseBaseEventType {
322
- event: 'privy:wallet:create';
323
- data: WalletCreateResponseDataType;
324
- }
325
- interface WalletConnectResponseEventType extends PrivyResponseBaseEventType {
326
- event: 'privy:wallet:connect';
327
- data: WalletConnectResponseDataType;
328
- }
329
- interface WalletRecoverResponseEventType extends PrivyResponseBaseEventType {
330
- event: 'privy:wallet:recover';
331
- data: WalletRecoverResponseDataType;
332
- }
333
- interface WalletSetRecoveryResponseEventType extends PrivyResponseBaseEventType {
334
- event: 'privy:wallet:set-recovery';
335
- data: WalletSetRecoveryResponseDataType;
336
- }
337
- interface WalletRpcResponseEventType extends PrivyResponseBaseEventType {
338
- event: 'privy:wallet:rpc';
339
- data: WalletRpcResponseDataType;
340
- }
341
- interface SolanaWalletCreateResponseEventType extends PrivyResponseBaseEventType {
342
- event: 'privy:solana-wallet:create';
343
- data: SolanaWalletCreateResponseDataType;
344
- }
345
- interface SolanaWalletCreateAdditionalResponseEventType extends PrivyResponseBaseEventType {
346
- event: 'privy:solana-wallet:create-additional';
347
- data: SolanaWalletCreateAdditionalResponseDataType;
348
- }
349
- interface SolanaWalletConnectResponseEventType extends PrivyResponseBaseEventType {
350
- event: 'privy:solana-wallet:connect';
351
- data: SolanaWalletConnectResponseDataType;
352
- }
353
- interface SolanaWalletRecoverResponseEventType extends PrivyResponseBaseEventType {
354
- event: 'privy:solana-wallet:recover';
355
- data: SolanaWalletRecoverResponseDataType;
356
- }
357
- interface SolanaWalletRpcResponseEventType extends PrivyResponseBaseEventType {
358
- event: 'privy:solana-wallet:rpc';
359
- data: SolanaWalletRpcResponseDataType;
360
- }
361
- export type PrivyResponseEvent = IframeReadyResponseEventType | PrivyErrorResponseEventType | WalletCreateResponseEventType | WalletConnectResponseEventType | WalletRecoverResponseEventType | WalletSetRecoveryResponseEventType | WalletRpcResponseEventType | SolanaWalletCreateResponseEventType | SolanaWalletCreateAdditionalResponseEventType | SolanaWalletConnectResponseEventType | SolanaWalletRecoverResponseEventType | SolanaWalletRpcResponseEventType;
362
- export type IframeReadyResponseCallbacksType = {
363
- reject: (error: Error) => void;
364
- resolve: (res: IframeReadyResponseDataType) => void;
365
524
  };
366
- export type WalletCreateResponseCallbacksType = {
367
- reject: (error: Error) => void;
368
- resolve: (res: WalletCreateResponseDataType) => void;
369
- };
370
- export type WalletConnectResponseCallbacksType = {
371
- reject: (error: Error) => void;
372
- resolve: (res: WalletConnectResponseDataType) => void;
373
- };
374
- export type WalletRecoverResponseCallbacksType = {
375
- reject: (error: Error) => void;
376
- resolve: (res: WalletRecoverResponseDataType) => void;
377
- };
378
- export type WalletSetRecoveryResponseCallbacksType = {
379
- reject: (error: Error) => void;
380
- resolve: (res: WalletSetRecoveryResponseDataType) => void;
381
- };
382
- export type WalletRpcResponseCallbacksType = {
383
- reject: (error: Error) => void;
384
- resolve: (res: WalletRpcResponseDataType) => void;
385
- };
386
- export type SolanaWalletCreateResponseCallbacksType = {
387
- reject: (error: Error) => void;
388
- resolve: (res: SolanaWalletCreateResponseDataType) => void;
389
- };
390
- export type SolanaWalletCreateAdditionalResponseCallbacksType = {
391
- reject: (error: Error) => void;
392
- resolve: (res: SolanaWalletCreateAdditionalResponseDataType) => void;
393
- };
394
- export type SolanaWalletConnectResponseCallbacksType = {
395
- reject: (error: Error) => void;
396
- resolve: (res: SolanaWalletConnectResponseDataType) => void;
397
- };
398
- export type SolanaWalletRecoverResponseCallbacksType = {
399
- reject: (error: Error) => void;
400
- resolve: (res: SolanaWalletRecoverResponseDataType) => void;
401
- };
402
- export type SolanaWalletRpcResponseCallbacksType = {
403
- reject: (error: Error) => void;
404
- resolve: (res: SolanaWalletRpcResponseDataType) => void;
405
- };
406
- export type MfaVerifyResponseCallbacksType = {
407
- reject: (error: Error) => void;
408
- resolve: (res: MfaVerifyResponseDataType) => void;
409
- };
410
- export type MfaInitEnrollmentResponseCallbacksType = {
411
- reject: (error: Error) => void;
412
- resolve: (res: MfaInitEnrollmentResponseDataType) => void;
413
- };
414
- export type MfaSubmitEnrollmentResponseCallbacksType = {
415
- reject: (error: Error) => void;
416
- resolve: (res: MfaSubmitEnrollmentResponseDataType) => void;
417
- };
418
- export type MfaUnenrollResponseCallbacksType = {
419
- reject: (error: Error) => void;
420
- resolve: (res: MfaUnenrollResponseDataType) => void;
421
- };
422
- export type MfaClearResponseCallbacksType = {
423
- reject: (error: Error) => void;
424
- resolve: (res: MfaClearResponseDataType) => void;
425
- };
426
- export type PrivyResponseCallbacksType = IframeReadyResponseCallbacksType | WalletCreateResponseCallbacksType | WalletConnectResponseCallbacksType | WalletRecoverResponseCallbacksType | WalletSetRecoveryResponseCallbacksType | WalletRpcResponseCallbacksType | SolanaWalletCreateResponseCallbacksType | SolanaWalletCreateAdditionalResponseCallbacksType | SolanaWalletConnectResponseCallbacksType | SolanaWalletRecoverResponseCallbacksType | SolanaWalletRpcResponseCallbacksType | MfaVerifyResponseCallbacksType | MfaInitEnrollmentResponseCallbacksType | MfaSubmitEnrollmentResponseCallbacksType | MfaUnenrollResponseCallbacksType | MfaClearResponseCallbacksType;
525
+ export type PrivyResponseEvent = IframeReadyResponseEventType | PrivyErrorResponseEventType | WalletsCreateResponseEventType | WalletsAddResponseEventType | WalletsSetRecoveryResponseEventType | WalletsConnectResponseEventType | WalletsRecoverResponseEventType | WalletsRpcResponseEventType | WalletCreateResponseEventType | WalletConnectResponseEventType | WalletRecoverResponseEventType | WalletSetRecoveryResponseEventType | WalletRpcResponseEventType | SolanaWalletCreateResponseEventType | SolanaWalletCreateAdditionalResponseEventType | SolanaWalletConnectResponseEventType | SolanaWalletRecoverResponseEventType | SolanaWalletRpcResponseEventType | MfaVerifyResponseEventType | MfaInitEnrollmentResponseEventType | MfaSubmitEnrollmentResponseEventType | MfaUnenrollResponseEventType | MfaClearResponseEventType;
526
+ export type PrivyResponseCallbacksType = IframeReadyResponseCallbacksType | WalletsCreateResponseCallbacksType | WalletsAddResponseCallbacksType | WalletsSetRecoveryResponseCallbacksType | WalletsConnectResponseCallbacksType | WalletsRecoverResponseCallbacksType | WalletsRpcResponseCallbacksType | WalletCreateResponseCallbacksType | WalletConnectResponseCallbacksType | WalletRecoverResponseCallbacksType | WalletSetRecoveryResponseCallbacksType | WalletRpcResponseCallbacksType | SolanaWalletCreateResponseCallbacksType | SolanaWalletCreateAdditionalResponseCallbacksType | SolanaWalletConnectResponseCallbacksType | SolanaWalletRecoverResponseCallbacksType | SolanaWalletRpcResponseCallbacksType | MfaVerifyResponseCallbacksType | MfaInitEnrollmentResponseCallbacksType | MfaSubmitEnrollmentResponseCallbacksType | MfaUnenrollResponseCallbacksType | MfaClearResponseCallbacksType;
427
527
  export type EmbeddedWalletMessagePoster = {
428
528
  postMessage: (message: any, targetOrigin: string, transfer?: Transferable) => void;
429
529
  };
@@ -446,45 +546,4 @@ export type PreparedTransactionRequestLegacy = UnsignedTransactionRequest & {
446
546
  gasPrice: Quantity;
447
547
  };
448
548
  export type PreparedTransactionRequest = PreparedTransactionRequestEIP1559 | PreparedTransactionRequestLegacy;
449
- export type MfaVerifyRequestDataType = {
450
- accessToken: string;
451
- };
452
- export type MfaInitEnrollmentRequestDataType = {
453
- accessToken: string;
454
- method: 'sms';
455
- phoneNumber: string;
456
- } | {
457
- accessToken: string;
458
- method: 'totp';
459
- };
460
- export type MfaSubmitEnrollmentRequestDataType = {
461
- accessToken: string;
462
- method: 'sms';
463
- code: string;
464
- phoneNumber: string;
465
- } | {
466
- accessToken: string;
467
- method: 'totp';
468
- code: string;
469
- } | {
470
- accessToken: string;
471
- method: 'passkey';
472
- credentialIds: string[];
473
- };
474
- export type MfaUnenrollRequestDataType = {
475
- accessToken: string;
476
- method: 'sms' | 'totp';
477
- };
478
- export type MfaClearRequestDataType = {
479
- userId: string;
480
- };
481
- export type MfaVerifyResponseDataType = Record<string, never>;
482
- export type MfaInitEnrollmentResponseDataType = {
483
- method: string;
484
- secret?: string;
485
- authUrl?: string;
486
- };
487
- export type MfaSubmitEnrollmentResponseDataType = Record<string, never>;
488
- export type MfaUnenrollResponseDataType = Record<string, never>;
489
- export type MfaClearResponseDataType = Record<string, never>;
490
549
  export {};
@@ -6,7 +6,8 @@ export { InMemoryCache } from './storage/InMemoryStorage';
6
6
  export type { ErrorMessageMap } from './Error';
7
7
  export { PrivyApiError, PrivyClientError, createErrorFormatter, errorIndicatesMfaCanceled, } from './Error';
8
8
  export { PrivyEmbeddedWalletErrorCode, errorIndicatesRecoveryIsNeeded, ProviderErrors, PrivyProviderRpcError, PrivyConnectorError, EmbeddedProviderError, errorIndicatesMaxMfaRetries, errorIndicatesMfaRateLimit, errorIndicatesMfaTimeout, errorIndicatesMfaVerificationFailed, } from './embedded/errors';
9
- export { getUserEmbeddedWallet } from './utils/getUserEmbeddedWallet';
9
+ export { getUserEmbeddedWallet, getUserEmbeddedEthereumWallet, } from './utils/getUserEmbeddedEthereumWallet';
10
+ export { getAllUserEmbeddedEthereumWallets } from './utils/getAllUserEmbeddedEthereumWallets';
10
11
  export { getAllUserEmbeddedSolanaWallets } from './utils/getAllUserEmbeddedSolanaWallets';
11
12
  export { type CountryCode, countryCodesAndNumbers, formatPhoneNumber, getCountryCallingCode, getPhoneCountryCodeAndNumber, getPlaceholderPhoneNumber, lastFourDigits, phoneNumberTypingFormatter, validatePhoneNumber, } from './utils/phoneNumberUtils';
12
13
  export { getUserEmbeddedSolanaWallet } from './utils/getUserEmbeddedSolanaWallet';
@@ -6,7 +6,8 @@ export { InMemoryCache } from './storage/InMemoryStorage';
6
6
  export type { ErrorMessageMap } from './Error';
7
7
  export { PrivyApiError, PrivyClientError, createErrorFormatter, errorIndicatesMfaCanceled, } from './Error';
8
8
  export { PrivyEmbeddedWalletErrorCode, errorIndicatesRecoveryIsNeeded, ProviderErrors, PrivyProviderRpcError, PrivyConnectorError, EmbeddedProviderError, errorIndicatesMaxMfaRetries, errorIndicatesMfaRateLimit, errorIndicatesMfaTimeout, errorIndicatesMfaVerificationFailed, } from './embedded/errors';
9
- export { getUserEmbeddedWallet } from './utils/getUserEmbeddedWallet';
9
+ export { getUserEmbeddedWallet, getUserEmbeddedEthereumWallet, } from './utils/getUserEmbeddedEthereumWallet';
10
+ export { getAllUserEmbeddedEthereumWallets } from './utils/getAllUserEmbeddedEthereumWallets';
10
11
  export { getAllUserEmbeddedSolanaWallets } from './utils/getAllUserEmbeddedSolanaWallets';
11
12
  export { type CountryCode, countryCodesAndNumbers, formatPhoneNumber, getCountryCallingCode, getPhoneCountryCodeAndNumber, getPlaceholderPhoneNumber, lastFourDigits, phoneNumberTypingFormatter, validatePhoneNumber, } from './utils/phoneNumberUtils';
12
13
  export { getUserEmbeddedSolanaWallet } from './utils/getUserEmbeddedSolanaWallet';
@@ -0,0 +1,12 @@
1
+ import type { PrivyUser, PrivyEthereumEmbeddedWalletAccount } from '@privy-io/public-api';
2
+ /**
3
+ * @description Finds all of the embedded ethereum wallet accounts for a user.
4
+ *
5
+ * @param user A privy user object
6
+ *
7
+ * @returns The user's embedded ethereum wallet accounts, sorted by wallet_index.
8
+ *
9
+ * @example
10
+ * const accounts = getAllUserEmbeddedEthereumWallet(user)
11
+ */
12
+ export declare const getAllUserEmbeddedEthereumWallets: (user: PrivyUser | null) => PrivyEthereumEmbeddedWalletAccount[];
@@ -0,0 +1,12 @@
1
+ import type { PrivyUser, PrivyEthereumEmbeddedWalletAccount } from '@privy-io/public-api';
2
+ /**
3
+ * @description Finds all of the embedded ethereum wallet accounts for a user.
4
+ *
5
+ * @param user A privy user object
6
+ *
7
+ * @returns The user's embedded ethereum wallet accounts, sorted by wallet_index.
8
+ *
9
+ * @example
10
+ * const accounts = getAllUserEmbeddedEthereumWallet(user)
11
+ */
12
+ export declare const getAllUserEmbeddedEthereumWallets: (user: PrivyUser | null) => PrivyEthereumEmbeddedWalletAccount[];
@@ -10,4 +10,8 @@ import type { PrivyUser, PrivyEthereumEmbeddedWalletAccount } from '@privy-io/pu
10
10
  * const account = getUserEmbeddedWallet(user)
11
11
  * console.log(account.address)
12
12
  */
13
+ export declare const getUserEmbeddedEthereumWallet: (user: PrivyUser | null) => PrivyEthereumEmbeddedWalletAccount | null;
14
+ /**
15
+ * @deprecated use `getUserEmbeddedEthereumWallet` instead
16
+ */
13
17
  export declare const getUserEmbeddedWallet: (user: PrivyUser | null) => PrivyEthereumEmbeddedWalletAccount | null;
@@ -10,4 +10,8 @@ import type { PrivyUser, PrivyEthereumEmbeddedWalletAccount } from '@privy-io/pu
10
10
  * const account = getUserEmbeddedWallet(user)
11
11
  * console.log(account.address)
12
12
  */
13
+ export declare const getUserEmbeddedEthereumWallet: (user: PrivyUser | null) => PrivyEthereumEmbeddedWalletAccount | null;
14
+ /**
15
+ * @deprecated use `getUserEmbeddedEthereumWallet` instead
16
+ */
13
17
  export declare const getUserEmbeddedWallet: (user: PrivyUser | null) => PrivyEthereumEmbeddedWalletAccount | null;