@getpara/core-sdk 2.0.0-alpha.3 → 2.0.0-alpha.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (92) hide show
  1. package/dist/cjs/ParaCore.js +3028 -0
  2. package/dist/cjs/PlatformUtils.js +15 -0
  3. package/dist/cjs/StorageUtils.js +15 -0
  4. package/dist/cjs/constants.js +84 -0
  5. package/dist/cjs/cryptography/utils.js +350 -0
  6. package/dist/cjs/errors.js +51 -0
  7. package/dist/cjs/external/mpcComputationClient.js +62 -0
  8. package/dist/cjs/external/userManagementClient.js +106 -0
  9. package/dist/cjs/index.js +85 -4001
  10. package/dist/cjs/package.json +3 -0
  11. package/dist/cjs/shares/KeyContainer.js +89 -0
  12. package/dist/cjs/shares/recovery.js +127 -0
  13. package/dist/cjs/shares/shareDistribution.js +104 -0
  14. package/dist/cjs/transmission/transmissionUtils.js +93 -0
  15. package/dist/cjs/types/config.js +43 -0
  16. package/dist/cjs/types/coreApi.js +74 -0
  17. package/dist/cjs/types/events.js +41 -0
  18. package/dist/cjs/types/index.js +52 -0
  19. package/dist/cjs/types/methods.js +15 -0
  20. package/dist/cjs/types/onRamps.js +33 -0
  21. package/dist/cjs/types/popup.js +35 -0
  22. package/dist/cjs/types/recovery.js +34 -0
  23. package/dist/cjs/types/theme.js +15 -0
  24. package/dist/cjs/types/wallet.js +31 -0
  25. package/dist/cjs/utils/autobind.js +41 -0
  26. package/dist/cjs/utils/events.js +45 -0
  27. package/dist/cjs/utils/formatting.js +112 -0
  28. package/dist/cjs/utils/index.js +41 -0
  29. package/dist/cjs/utils/json.js +37 -0
  30. package/dist/cjs/utils/listeners.js +71 -0
  31. package/dist/cjs/utils/onRamps.js +92 -0
  32. package/dist/cjs/utils/phone.js +73 -0
  33. package/dist/cjs/utils/polling.js +58 -0
  34. package/dist/cjs/utils/types.js +29 -0
  35. package/dist/cjs/utils/url.js +135 -0
  36. package/dist/cjs/utils/wallet.js +159 -0
  37. package/dist/esm/ParaCore.js +2990 -0
  38. package/dist/esm/PlatformUtils.js +0 -0
  39. package/dist/esm/StorageUtils.js +0 -0
  40. package/dist/esm/chunk-7B52C2XE.js +70 -0
  41. package/dist/esm/constants.js +43 -0
  42. package/dist/esm/cryptography/utils.js +282 -0
  43. package/dist/esm/errors.js +27 -0
  44. package/dist/esm/external/mpcComputationClient.js +30 -0
  45. package/dist/esm/external/userManagementClient.js +71 -0
  46. package/dist/esm/index.js +58 -3965
  47. package/dist/esm/package.json +4 -0
  48. package/dist/esm/shares/KeyContainer.js +57 -0
  49. package/dist/esm/shares/recovery.js +74 -0
  50. package/dist/esm/shares/shareDistribution.js +64 -0
  51. package/dist/esm/transmission/transmissionUtils.js +42 -0
  52. package/dist/esm/types/config.js +20 -0
  53. package/dist/esm/types/coreApi.js +52 -0
  54. package/dist/esm/types/events.js +19 -0
  55. package/dist/esm/types/index.js +22 -0
  56. package/dist/esm/types/methods.js +0 -0
  57. package/dist/esm/types/onRamps.js +11 -0
  58. package/dist/esm/types/popup.js +13 -0
  59. package/dist/esm/types/recovery.js +12 -0
  60. package/dist/esm/types/theme.js +0 -0
  61. package/dist/esm/types/wallet.js +9 -0
  62. package/dist/esm/utils/autobind.js +19 -0
  63. package/dist/esm/utils/events.js +11 -0
  64. package/dist/esm/utils/formatting.js +74 -0
  65. package/dist/esm/utils/index.js +11 -0
  66. package/dist/esm/utils/json.js +15 -0
  67. package/dist/esm/utils/listeners.js +38 -0
  68. package/dist/esm/utils/onRamps.js +66 -0
  69. package/dist/esm/utils/phone.js +39 -0
  70. package/dist/esm/utils/polling.js +18 -0
  71. package/dist/esm/utils/types.js +7 -0
  72. package/dist/esm/utils/url.js +90 -0
  73. package/dist/esm/utils/wallet.js +103 -0
  74. package/dist/types/ParaCore.d.ts +157 -126
  75. package/dist/types/PlatformUtils.d.ts +4 -3
  76. package/dist/types/constants.d.ts +2 -0
  77. package/dist/types/index.d.ts +3 -3
  78. package/dist/types/types/config.d.ts +4 -5
  79. package/dist/types/types/coreApi.d.ts +47 -9
  80. package/dist/types/types/events.d.ts +4 -1
  81. package/dist/types/types/methods.d.ts +9 -4
  82. package/dist/types/types/onRamps.d.ts +3 -3
  83. package/dist/types/types/wallet.d.ts +4 -2
  84. package/dist/types/utils/formatting.d.ts +3 -2
  85. package/dist/types/utils/onRamps.d.ts +12 -5
  86. package/dist/types/utils/phone.d.ts +4 -0
  87. package/dist/types/utils/wallet.d.ts +8 -7
  88. package/package.json +7 -7
  89. package/dist/cjs/index.js.br +0 -0
  90. package/dist/cjs/index.js.gz +0 -0
  91. package/dist/esm/index.js.br +0 -0
  92. package/dist/esm/index.js.gz +0 -0
@@ -1,6 +1,6 @@
1
- import { AuthMethod, AuthExtras, CurrentWalletIds, EmailTheme, WalletType, PregenIds, BiometricLocationHint, Auth, SupportedWalletTypes, AuthIdentifier, AuthType, ExternalWalletInfo, PrimaryAuthInfo, SessionInfo, PrimaryAuth, PrimaryAuthType } from '@getpara/user-management-client';
1
+ import { AuthMethod, AuthExtras, CurrentWalletIds, EmailTheme, TWalletType, PregenIds, BiometricLocationHint, Auth, SupportedWalletTypes, AuthIdentifier, AuthType, ExternalWalletInfo, PrimaryAuthInfo, SessionInfo, PrimaryAuth, PrimaryAuthType, AccountMetadata } from '@getpara/user-management-client';
2
2
  import type { pki as pkiType } from 'node-forge';
3
- import { Ctx, Environment, Theme, WalletFilters, WalletTypeProp, Wallet, PortalUrlOptions, ConstructorOpts, CoreAuthInfo, PortalUrlType, CoreMethodParams, CoreMethodResponse, OAuthUrlParams, NewCredentialUrlParams, LoginUrlParams, CoreInterface, ExternalWalletConnectionType } from './types/index.js';
3
+ import { Ctx, Environment, Theme, WalletFilters, Wallet, PortalUrlOptions, ConstructorOpts, CoreAuthInfo, PortalUrlType, CoreMethodParams, CoreMethodResponse, NewCredentialUrlParams, LoginUrlParams, CoreInterface, ExternalWalletConnectionType } from './types/index.js';
4
4
  import { PlatformUtils } from './PlatformUtils.js';
5
5
  export declare abstract class ParaCore implements CoreInterface {
6
6
  #private;
@@ -30,7 +30,7 @@ export declare abstract class ParaCore implements CoreInterface {
30
30
  * The IDs of the currently active wallets, for each supported wallet type. Any signer integrations will default to the first viable wallet ID in this dictionary.
31
31
  */
32
32
  currentWalletIds: CurrentWalletIds;
33
- get currentWalletIdsArray(): [string, WalletType][];
33
+ get currentWalletIdsArray(): [string, TWalletType][];
34
34
  get currentWalletIdsUnique(): string[];
35
35
  /**
36
36
  * Wallets associated with the `ParaCore` instance. Retrieve a particular wallet using `para.wallets[walletId]`.
@@ -114,10 +114,15 @@ export declare abstract class ParaCore implements CoreInterface {
114
114
  * @deprecated configure theming through the developer portal
115
115
  */
116
116
  portalTheme?: Theme;
117
+ /**
118
+ * Whether or not to treat external wallets as connections only, skipping all Para functionality.
119
+ */
120
+ externalWalletConnectionOnly?: boolean;
117
121
  private disableProviderModal?;
122
+ get isNoWalletConfig(): boolean;
118
123
  get supportedWalletTypes(): SupportedWalletTypes;
119
124
  get cosmosPrefix(): string | undefined;
120
- get isWalletTypeEnabled(): Partial<Record<WalletType, boolean>>;
125
+ get isWalletTypeEnabled(): Partial<Record<TWalletType, boolean>>;
121
126
  private platformUtils;
122
127
  private localStorageGetItem;
123
128
  private localStorageSetItem;
@@ -147,12 +152,14 @@ export declare abstract class ParaCore implements CoreInterface {
147
152
  * @param {string} walletId the ID of the wallet address to display.
148
153
  * @param {object} options additional options for formatting the address.
149
154
  * @param {boolean} options.truncate whether to truncate the address.
150
- * @param {WalletType} options.addressType the type of address to display.
155
+ * @param {TWalletType} options.addressType the type of address to display.
151
156
  * @returns the formatted address
152
157
  */
153
158
  getDisplayAddress(walletId: string, options?: {
154
159
  truncate?: boolean;
155
- addressType?: WalletTypeProp | undefined;
160
+ addressType?: TWalletType | undefined;
161
+ cosmosPrefix?: string;
162
+ targetLength?: number;
156
163
  } | undefined): string;
157
164
  /**
158
165
  * Returns a unique hash for a wallet suitable for use as an identicon seed.
@@ -160,7 +167,7 @@ export declare abstract class ParaCore implements CoreInterface {
160
167
  * @param {boolean} options.addressType used to format the hash for another wallet type.
161
168
  * @returns the identicon hash string
162
169
  */
163
- getIdenticonHash(walletId: string, overrideType?: WalletType): string | undefined;
170
+ getIdenticonHash(walletId: string, overrideType?: TWalletType): string | undefined;
164
171
  getWallets(): Record<string, Wallet>;
165
172
  getAddress(walletId?: string): string | undefined;
166
173
  protected abstract getPlatformUtils(): PlatformUtils;
@@ -173,6 +180,8 @@ export declare abstract class ParaCore implements CoreInterface {
173
180
  * @returns - A new ParaCore instance.
174
181
  */
175
182
  constructor(env: Environment, apiKey: string, opts?: ConstructorOpts);
183
+ private trackError;
184
+ private wrapMethodsWithErrorTracking;
176
185
  private initializeFromStorage;
177
186
  private updateAuthInfoFromStorage;
178
187
  private updateUserIdFromStorage;
@@ -196,7 +205,6 @@ export declare abstract class ParaCore implements CoreInterface {
196
205
  }): Promise<typeof this.authInfo>;
197
206
  protected assertUserId(): string;
198
207
  protected assertIsAuthSet(allowed?: AuthType[]): PrimaryAuthInfo;
199
- assertIsUser: any;
200
208
  /**
201
209
  * Sets the email associated with the `ParaCore` instance.
202
210
  * @param email - Email to set.
@@ -212,7 +220,7 @@ export declare abstract class ParaCore implements CoreInterface {
212
220
  * @param phone - Phone number to set.
213
221
  * @param countryCode - Country Code to set.
214
222
  */
215
- setPhone(phone: `+${number}` | string, countryCode?: string): Promise<void>;
223
+ setPhoneNumber(phone: `+${number}` | string, countryCode?: string): Promise<void>;
216
224
  /**
217
225
  * Sets the farcaster username associated with the `ParaCore` instance.
218
226
  * @param farcasterUsername - Farcaster Username to set.
@@ -250,6 +258,7 @@ export declare abstract class ParaCore implements CoreInterface {
250
258
  * @returns - userId associated with the `ParaCore` instance.
251
259
  */
252
260
  getUserId(): string | undefined;
261
+ getAuthInfo(): CoreAuthInfo | undefined;
253
262
  /**
254
263
  * Gets the email associated with the `ParaCore` instance.
255
264
  * @returns - email associated with the `ParaCore` instance.
@@ -270,6 +279,12 @@ export declare abstract class ParaCore implements CoreInterface {
270
279
  sessionLookupId?: string;
271
280
  newDeviceSessionLookupId?: string;
272
281
  }): Promise<void>;
282
+ /**
283
+ * Fetches the most recent OAuth account metadata for the signed-in user.
284
+ * If applicable, this will include the user's most recent metadata from their Google, Apple, Facebook, X, Discord, Farcaster, or Telegram account, the last time they signed in to your app.
285
+ * @returns {Promise<AccountMetadata>} the user's account metadata.
286
+ */
287
+ getAccountMetadata(): Promise<AccountMetadata>;
273
288
  /**
274
289
  * Validates that a wallet ID is present on the instance, usable, and matches the desired filters.
275
290
  * If no ID is passed, this will instead return the first valid, usable wallet ID that matches the filters.
@@ -286,14 +301,14 @@ export declare abstract class ParaCore implements CoreInterface {
286
301
  * @returns {string} the wallet ID originally passed, or the one found.
287
302
  */
288
303
  findWalletByAddress(address: string, filter?: WalletFilters | undefined): any;
289
- findWallet(idOrAddress?: string, overrideType?: WalletTypeProp, filter?: WalletFilters): Omit<Wallet, 'signer'> | undefined;
304
+ findWallet(idOrAddress?: string, overrideType?: TWalletType, filter?: WalletFilters): Omit<Wallet, 'signer'> | undefined;
290
305
  get availableWallets(): Pick<Wallet, 'id' | 'type' | 'name' | 'address' | 'isExternal'>[];
291
306
  /**
292
307
  * Retrieves all usable wallets with the provided type (`'EVM' | 'COSMOS' | 'SOLANA'`)
293
308
  * @param {string} type the wallet type to filter by.
294
309
  * @returns {Wallet[]} an array of matching wallets.
295
310
  */
296
- getWalletsByType(type: WalletTypeProp): Wallet[];
311
+ getWalletsByType(type: CoreMethodParams<'getWalletsByType'>): CoreMethodResponse<'getWalletsByType'>;
297
312
  private assertIsValidWalletId;
298
313
  private assertIsValidWalletType;
299
314
  private getMissingTypes;
@@ -318,6 +333,41 @@ export declare abstract class ParaCore implements CoreInterface {
318
333
  fetchWallets(): CoreMethodResponse<'fetchWallets'>;
319
334
  private populateWalletAddresses;
320
335
  private populatePregenWalletAddresses;
336
+ /**
337
+ * Logs in or creates a new user using an external wallet address.
338
+ * @param {Object} opts the options object
339
+ * @param {string} opts.address the external wallet address to use for identification.
340
+ * @param {TWalletType} opts.type type of external wallet to use for identification.
341
+ * @param {string} opts.provider the name of the provider for the external wallet.
342
+ */
343
+ loginExternalWallet({ externalWallet, ...urlOptions }: CoreMethodParams<'loginExternalWallet'>): CoreMethodResponse<'loginExternalWallet'>;
344
+ verifyExternalWallet({ externalWallet, signedMessage, cosmosPublicKeyHex, cosmosSigner, ...urlOptions }: CoreMethodParams<'verifyExternalWallet'>): CoreMethodResponse<'verifyExternalWallet'>;
345
+ /**
346
+ * Validates the response received from an attempted Telegram login for authenticity, then
347
+ * creates or retrieves the corresponding Para user and prepares the Para instance to sign in with that user.
348
+ * @param authResponse - the response JSON object received from the Telegram widget.
349
+ * @returns `{ isValid: boolean; telegramUserId?: string; userId?: string; isNewUser?: boolean; supportedAuthMethods?: AuthMethod[]; biometricHints?: BiometricLocationHint[] }`
350
+ */
351
+ verifyTelegram({ telegramAuthResponse, ...urlOptions }: CoreMethodParams<'verifyTelegram'>): CoreMethodResponse<'verifyTelegram'>;
352
+ /**
353
+ * Performs 2FA verification.
354
+ * @param {Object} opts the options object
355
+ * @param {string} opts.email the email to use for performing a 2FA verification.
356
+ * @param {string} opts.verificationCode the verification code to received via 2FA.
357
+ * @returns {Object} `{ address, initiatedAt, status, userId, walletId }`
358
+ */
359
+ verify2fa({ auth, verificationCode }: CoreMethodParams<'verify2fa'>): CoreMethodResponse<'verify2fa'>;
360
+ /**
361
+ * Sets up two-factor authentication for the current user.
362
+ * @returns {string} uri - uri to use for setting up 2FA
363
+ * */
364
+ setup2fa(): CoreMethodResponse<'setup2fa'>;
365
+ /**
366
+ * Enables 2FA.
367
+ * @param {Object} opts the options object
368
+ * @param {string} opts.verificationCode - the verification code received via 2FA.
369
+ */
370
+ enable2fa({ verificationCode }: CoreMethodParams<'enable2fa'>): CoreMethodResponse<'enable2fa'>;
321
371
  /**
322
372
  * Resend a verification email for the current user.
323
373
  */
@@ -332,6 +382,7 @@ export declare abstract class ParaCore implements CoreInterface {
332
382
  * @returns `true` if active, `false` otherwise
333
383
  **/
334
384
  isFullyLoggedIn(): CoreMethodResponse<'isFullyLoggedIn'>;
385
+ get isGuestMode(): boolean;
335
386
  protected supportedAuthMethods(auth: Auth<PrimaryAuthType | 'userId'>): Promise<Set<AuthMethod>>;
336
387
  /**
337
388
  * Get hints associated with the users stored biometrics.
@@ -339,6 +390,50 @@ export declare abstract class ParaCore implements CoreInterface {
339
390
  * @returns Array containing useragents and AAGuids for stored biometrics
340
391
  */
341
392
  protected getUserBiometricLocationHints(): Promise<BiometricLocationHint[]>;
393
+ /**
394
+ * Waits for the session to be active.
395
+ **/
396
+ waitForSignup({ isCanceled, onCancel, onPoll, }: CoreMethodParams<'waitForSignup'>): CoreMethodResponse<'waitForSignup'>;
397
+ waitForWalletCreation({ isCanceled, onCancel, }?: CoreMethodParams<'waitForWalletCreation'>): CoreMethodResponse<'waitForWalletCreation'>;
398
+ /**
399
+ * Initiates a Farcaster login attempt and return the URI for the user to connect.
400
+ * You can create a QR code with this URI that works with Farcaster's mobile app.
401
+ * @return {string} the Farcaster connect URI
402
+ */
403
+ getFarcasterConnectUri(): CoreMethodResponse<'getFarcasterConnectUri'>;
404
+ /**
405
+ * Awaits the response from a user's attempt to log in with Farcaster.
406
+ * If successful, this returns the user's Farcaster username and profile picture and indicates whether the user already exists.
407
+ * @return {Object} `{userExists: boolean; username: string; pfpUrl?: string | null }` - the user's information and whether the user already exists.
408
+ */
409
+ verifyFarcaster({ isCanceled, onConnectUri, onCancel, onPoll, ...urlOptions }: CoreMethodParams<'verifyFarcaster'>): CoreMethodResponse<'verifyFarcaster'>;
410
+ /**
411
+ * Generates a URL for the user to log in with OAuth using a desire method.
412
+ *
413
+ * @param {Object} opts the options object
414
+ * @param {TOAuthMethod} opts.method the third-party service to use for OAuth.
415
+ * @param {string} [opts.deeplinkUrl] the deeplink to redirect to after the OAuth flow. This is for mobile only.
416
+ * @returns {string} the URL for the user to log in with OAuth.
417
+ */
418
+ getOAuthUrl({ method, deeplinkUrl, ...params }: CoreMethodParams<'getOAuthUrl'>): CoreMethodResponse<'getOAuthUrl'>;
419
+ /**
420
+ * Awaits the response from a user's attempt to log in with OAuth.
421
+ * If successful, this returns the user's email address and indicates whether the user already exists.
422
+ *
423
+ * @param {Object} opts the options object.
424
+ * @param {Window} [opts.popupWindow] the popup window being used for login.
425
+ * @return {Object} `{ email?: string; isError?: boolean; userExists: boolean; }` the result data
426
+ */
427
+ verifyOAuth({ method, deeplinkUrl, isCanceled, onCancel, onPoll, onOAuthUrl, ...urlOptions }: CoreMethodParams<'verifyOAuth'>): CoreMethodResponse<'verifyOAuth'>;
428
+ /**
429
+ * Waits for the session to be active and sets up the user.
430
+ *
431
+ * @param {Object} opts the options object
432
+ * @param {Window} [opts.popupWindow] the popup window being used for login.
433
+ * @param {boolean} [opts.skipSessionRefresh] whether to skip refreshing the session.
434
+ * @returns {Object} `{ isComplete: boolean; isError: boolean; needsWallet: boolean; partnerId: string; }` the result data
435
+ **/
436
+ waitForLogin({ isCanceled, onCancel, onPoll, skipSessionRefresh, }?: CoreMethodParams<'waitForLogin'>): CoreMethodResponse<'waitForLogin'>;
342
437
  /**
343
438
  * Updates the session with the user management server, possibly
344
439
  * opening a popup to refresh the session.
@@ -409,7 +504,7 @@ export declare abstract class ParaCore implements CoreInterface {
409
504
  *
410
505
  * @param {Object} [opts] the options object.
411
506
  * @param {boolean} [opts.skipDistribute] if `true`, the wallets' recovery share will not be distributed.
412
- * @param {WalletType[]} [opts.types] the types of wallets to create.
507
+ * @param {TWalletType[]} [opts.types] the types of wallets to create.
413
508
  * @returns {Object} the wallets created, their ids, and the recovery secret.
414
509
  **/
415
510
  createWalletPerType({ skipDistribute, types, }?: CoreMethodParams<'createWalletPerType'>): CoreMethodResponse<'createWalletPerType'>;
@@ -429,11 +524,56 @@ export declare abstract class ParaCore implements CoreInterface {
429
524
  /**
430
525
  * Creates a new wallet.
431
526
  * @param {Object} opts the options object.
432
- * @param {WalletType} opts.type the type of wallet to create.
527
+ * @param {TWalletType} opts.type the type of wallet to create.
433
528
  * @param {boolean} opts.skipDistribute - if true, recovery share will not be distributed.
434
529
  * @returns {[Wallet, string | null]} `[wallet, recoveryShare]` - the wallet object and the new recovery share.
435
530
  **/
436
531
  createWallet({ type: _type, skipDistribute, }?: CoreMethodParams<'createWallet'>): CoreMethodResponse<'createWallet'>;
532
+ createPregenWallet(opts: CoreMethodParams<'createPregenWallet'>): CoreMethodResponse<'createPregenWallet'>;
533
+ /**
534
+ * Creates new pregenerated wallets for each desired type.
535
+ * If no types are provided, this method will create one for each of the non-optional types
536
+ * specified in the instance's `supportedWalletTypes` array that are not already present.
537
+ * @param {Object} opts the options object.
538
+ * @param {string} opts.pregenIdentifier the identifier to associate each wallet with.
539
+ * @param {TPregenIdentifierType} opts.pregenIdentifierType - either `'EMAIL'` or `'PHONE'`.
540
+ * @param {TWalletType[]} [opts.types] the wallet types to create. Defaults to any types the instance supports that are not already present.
541
+ * @returns {Wallet[]} an array containing the created wallets.
542
+ **/
543
+ createPregenWalletPerType({ types, pregenId, }: CoreMethodParams<'createPregenWalletPerType'>): CoreMethodResponse<'createPregenWalletPerType'>;
544
+ /**
545
+ * Claims a pregenerated wallet.
546
+ * @param {Object} opts the options object.
547
+ * @param {string} opts.pregenIdentifier string the identifier of the user claiming the wallet
548
+ * @param {TPregenIdentifierType} opts.pregenIdentifierType type of the identifier of the user claiming the wallet
549
+ * @returns {[Wallet, string | null]} `[wallet, recoveryShare]` - the wallet object and the new recovery share.
550
+ **/
551
+ claimPregenWallets({ pregenId, }?: CoreMethodParams<'claimPregenWallets'>): CoreMethodResponse<'claimPregenWallets'>;
552
+ /**
553
+ * Updates the identifier for a pregen wallet.
554
+ * @param {Object} opts the options object.
555
+ * @param {string} opts.walletId the pregen wallet ID
556
+ * @param {string} opts.newPregenIdentifier the new identtifier
557
+ * @param {TPregenIdentifierType} opts.newPregenIdentifierType: the new identifier type
558
+ **/
559
+ updatePregenWalletIdentifier({ walletId, newPregenId, }: CoreMethodParams<'updatePregenWalletIdentifier'>): CoreMethodResponse<'updatePregenWalletIdentifier'>;
560
+ /**
561
+ * Checks if a pregen Wallet exists for the given identifier with the current partner.
562
+ * @param {Object} opts the options object.
563
+ * @param {string} opts.pregenIdentifier string the identifier of the user claiming the wallet
564
+ * @param {TPregenIdentifierType} opts.pregenIdentifierType type of the string of the identifier of the user claiming the wallet
565
+ * @returns {boolean} whether the pregen wallet exists
566
+ **/
567
+ hasPregenWallet({ pregenId }: CoreMethodParams<'hasPregenWallet'>): CoreMethodResponse<'hasPregenWallet'>;
568
+ /**
569
+ * Get pregen wallets for the given identifier.
570
+ * @param {Object} opts the options object.
571
+ * @param {string} opts.pregenIdentifier - the identifier of the user claiming the wallet
572
+ * @param {TPregenIdentifierType} opts.pregenIdentifierType - type of the identifier of the user claiming the wallet
573
+ * @returns {Promise<WalletEntity[]>} the array of found wallets
574
+ **/
575
+ getPregenWallets({ pregenId }?: CoreMethodParams<'getPregenWallets'>): CoreMethodResponse<'getPregenWallets'>;
576
+ createGuestWallets(): CoreMethodResponse<'createGuestWallets'>;
437
577
  private encodeWalletBase64;
438
578
  /**
439
579
  * Encodes the current wallets encoded in Base 64.
@@ -447,6 +587,7 @@ export declare abstract class ParaCore implements CoreInterface {
447
587
  setUserShare(base64Wallets: CoreMethodParams<'setUserShare'>): CoreMethodResponse<'setUserShare'>;
448
588
  private getTransactionReviewUrl;
449
589
  private getOnRampTransactionUrl;
590
+ getWalletBalance: ({ walletId, rpcUrl, }: CoreMethodParams<'getWalletBalance'>) => CoreMethodResponse<'getWalletBalance'>;
450
591
  /**
451
592
  * Signs a message using one of the current wallets.
452
593
  *
@@ -485,29 +626,15 @@ export declare abstract class ParaCore implements CoreInterface {
485
626
  keepSessionAlive(): Promise<boolean>;
486
627
  /**
487
628
  * Serialize the current session for import by another Para instance.
629
+ * @param {boolean} excludeSigners - whether or not to exclude the signer from the exported wallets.
488
630
  * @returns {string} the serialized session
489
631
  */
490
- exportSession(): CoreMethodResponse<'exportSession'>;
632
+ exportSession({ excludeSigners }?: CoreMethodParams<'exportSession'>): CoreMethodResponse<'exportSession'>;
491
633
  /**
492
634
  * Imports a session serialized by another Para instance.
493
635
  * @param {string} serializedInstanceBase64 the serialized session
494
636
  */
495
637
  importSession(serializedInstanceBase64: CoreMethodParams<'importSession'>): CoreMethodResponse<'importSession'>;
496
- /**
497
- * @deprecated
498
- */
499
- /**
500
- * @deprecated
501
- */
502
- /**
503
- * @deprecated
504
- */
505
- /**
506
- * @deprecated
507
- */
508
- /**
509
- * @deprecated
510
- */
511
638
  /**
512
639
  * Retrieves a token to verify the current session.
513
640
  * @returns {Promise<string>} the ID
@@ -529,10 +656,9 @@ export declare abstract class ParaCore implements CoreInterface {
529
656
  * Doesn't work for all types of logging.
530
657
  **/
531
658
  toString(): string;
532
- /** NEW METHODS */
533
659
  protected getNewCredentialAndUrl({ authMethod, isForNewDevice, portalTheme, shorten, }?: NewCredentialUrlParams): Promise<{
534
660
  credentialId: string;
535
- url: string;
661
+ url?: string;
536
662
  }>;
537
663
  /**
538
664
  * Returns a Para Portal URL for logging in with a WebAuth passkey or a password.
@@ -543,101 +669,6 @@ export declare abstract class ParaCore implements CoreInterface {
543
669
  * @returns {SignUpOrLogInResponse} an object in the form of either: `{ stage: 'verify' }` or `{ stage: 'login'; passkeyUrl?: string; passwordUrl?: string; biometricHints?: BiometricLocationHint[] }`
544
670
  */
545
671
  protected getLoginUrl({ authMethod, shorten, portalTheme, sessionId, }: LoginUrlParams): Promise<string>;
546
- protected getOAuthUrl({ method, deeplinkUrl }: OAuthUrlParams): Promise<string>;
547
672
  signUpOrLogIn({ auth, ...urlOptions }: CoreMethodParams<'signUpOrLogIn'>): CoreMethodResponse<'signUpOrLogIn'>;
548
673
  verifyNewAccount({ verificationCode, ...urlOptions }: CoreMethodParams<'verifyNewAccount'>): CoreMethodResponse<'verifyNewAccount'>;
549
- verifyOAuth({ method, deeplinkUrl, isCanceled, onCancel, onPoll, onOAuthUrl, ...urlOptions }: CoreMethodParams<'verifyOAuth'>): CoreMethodResponse<'verifyOAuth'>;
550
- verifyFarcaster({ isCanceled, onConnectUri, onCancel, onPoll, ...urlOptions }: CoreMethodParams<'verifyFarcaster'>): CoreMethodResponse<'verifyFarcaster'>;
551
- /**
552
- * Validates the response received from an attempted Telegram login for authenticity, then
553
- * creates or retrieves the corresponding Para user and prepares the Para instance to sign in with that user.
554
- * @param authResponse - the response JSON object received from the Telegram widget.
555
- * @returns `{ isValid: boolean; telegramUserId?: string; userId?: string; isNewUser?: boolean; supportedAuthMethods?: AuthMethod[]; biometricHints?: BiometricLocationHint[] }`
556
- */
557
- verifyTelegram({ telegramAuthResponse, ...urlOptions }: CoreMethodParams<'verifyTelegram'>): CoreMethodResponse<'verifyTelegram'>;
558
- /**
559
- * Waits for the session to be active and sets up the user.
560
- *
561
- * @param {Object} opts the options object
562
- * @param {Window} [opts.popupWindow] the popup window being used for login.
563
- * @param {boolean} [opts.skipSessionRefresh] whether to skip refreshing the session.
564
- * @returns {Object} `{ isComplete: boolean; isError: boolean; needsWallet: boolean; partnerId: string; }` the result data
565
- **/
566
- waitForLogin({ isCanceled, onCancel, onPoll, skipSessionRefresh, }?: CoreMethodParams<'waitForLogin'>): CoreMethodResponse<'waitForLogin'>;
567
- waitForSignup({ isCanceled, onCancel, onPoll, }: CoreMethodParams<'waitForSignup'>): CoreMethodResponse<'waitForSignup'>;
568
- waitForWalletCreation({ isCanceled, onCancel, }?: CoreMethodParams<'waitForWalletCreation'>): CoreMethodResponse<'waitForWalletCreation'>;
569
- loginExternalWallet({ externalWallet, ...urlOptions }: CoreMethodParams<'loginExternalWallet'>): CoreMethodResponse<'loginExternalWallet'>;
570
- verifyExternalWallet({ externalWallet, signedMessage, cosmosPublicKeyHex, cosmosSigner, ...urlOptions }: CoreMethodParams<'verifyExternalWallet'>): CoreMethodResponse<'verifyExternalWallet'>;
571
- /**
572
- * Performs 2FA verification.
573
- * @param {Object} opts the options object
574
- * @param {string} opts.email the email to use for performing a 2FA verification.
575
- * @param {string} opts.verificationCode the verification code to received via 2FA.
576
- * @returns {Object} `{ address, initiatedAt, status, userId, walletId }`
577
- */
578
- verify2fa({ auth, verificationCode }: CoreMethodParams<'verify2fa'>): CoreMethodResponse<'verify2fa'>;
579
- /**
580
- * Sets up two-factor authentication for the current user.
581
- * @returns {string} uri - uri to use for setting up 2FA
582
- * */
583
- setup2fa(): CoreMethodResponse<'setup2fa'>;
584
- /**
585
- * Enables 2FA.
586
- * @param {Object} opts the options object
587
- * @param {string} opts.verificationCode - the verification code received via 2FA.
588
- */
589
- enable2fa({ verificationCode }: CoreMethodParams<'enable2fa'>): CoreMethodResponse<'enable2fa'>;
590
- /**
591
- * Creates a new pregenerated wallet.
592
- *
593
- * @param {Object} opts the options object.
594
- * @param {string} opts.pregenIdentifier the identifier associated with the new wallet.
595
- * @param {TPregenIdentifierType} [opts.pregenIdentifierType] the identifier type. Defaults to `EMAIL`.
596
- * @param {WalletType} [opts.type] the type of wallet to create. Defaults to the first non-optional type in the instance's `supportedWalletTypes` array.
597
- * @returns {Wallet} the created wallet.
598
- **/
599
- createPregenWallet(opts: CoreMethodParams<'createPregenWallet'>): CoreMethodResponse<'createPregenWallet'>;
600
- /**
601
- * Creates new pregenerated wallets for each desired type.
602
- * If no types are provided, this method will create one for each of the non-optional types
603
- * specified in the instance's `supportedWalletTypes` array that are not already present.
604
- * @param {Object} opts the options object.
605
- * @param {string} opts.pregenIdentifier the identifier to associate each wallet with.
606
- * @param {TPregenIdentifierType} opts.pregenIdentifierType - either `'EMAIL'` or `'PHONE'`.
607
- * @param {WalletType[]} [opts.types] the wallet types to create. Defaults to any types the instance supports that are not already present.
608
- * @returns {Wallet[]} an array containing the created wallets.
609
- **/
610
- createPregenWalletPerType({ types, pregenId, }: CoreMethodParams<'createPregenWalletPerType'>): CoreMethodResponse<'createPregenWalletPerType'>;
611
- /**
612
- * Claims a pregenerated wallet.
613
- * @param {Object} opts the options object.
614
- * @param {string} opts.pregenIdentifier string the identifier of the user claiming the wallet
615
- * @param {TPregenIdentifierType} opts.pregenIdentifierType type of the identifier of the user claiming the wallet
616
- * @returns {[Wallet, string | null]} `[wallet, recoveryShare]` - the wallet object and the new recovery share.
617
- **/
618
- claimPregenWallets({ pregenId, }?: CoreMethodParams<'claimPregenWallets'>): CoreMethodResponse<'claimPregenWallets'>;
619
- /**
620
- * Updates the identifier for a pregen wallet.
621
- * @param {Object} opts the options object.
622
- * @param {string} opts.walletId the pregen wallet ID
623
- * @param {string} opts.newPregenIdentifier the new identtifier
624
- * @param {TPregenIdentifierType} opts.newPregenIdentifierType: the new identifier type
625
- **/
626
- updatePregenWalletIdentifier({ walletId, newPregenId, }: CoreMethodParams<'updatePregenWalletIdentifier'>): CoreMethodResponse<'updatePregenWalletIdentifier'>;
627
- /**
628
- * Checks if a pregen Wallet exists for the given identifier with the current partner.
629
- * @param {Object} opts the options object.
630
- * @param {string} opts.pregenIdentifier string the identifier of the user claiming the wallet
631
- * @param {TPregenIdentifierType} opts.pregenIdentifierType type of the string of the identifier of the user claiming the wallet
632
- * @returns {boolean} whether the pregen wallet exists
633
- **/
634
- hasPregenWallet({ pregenId }: CoreMethodParams<'hasPregenWallet'>): CoreMethodResponse<'hasPregenWallet'>;
635
- /**
636
- * Get pregen wallets for the given identifier.
637
- * @param {Object} opts the options object.
638
- * @param {string} opts.pregenIdentifier - the identifier of the user claiming the wallet
639
- * @param {TPregenIdentifierType} opts.pregenIdentifierType - type of the identifier of the user claiming the wallet
640
- * @returns {Promise<WalletEntity[]>} the array of found wallets
641
- **/
642
- getPregenWallets({ pregenId }?: CoreMethodParams<'getPregenWallets'>): CoreMethodResponse<'getPregenWallets'>;
643
674
  }
@@ -1,11 +1,12 @@
1
1
  /// <reference types="node" />
2
2
  /// <reference types="node" />
3
- import { BackupKitEmailProps, TPregenIdentifierType, WalletType } from '@getpara/user-management-client';
3
+ import { BackupKitEmailProps, TPregenIdentifierType, TWalletType, SDKType } from '@getpara/user-management-client';
4
4
  import { Ctx, PopupType, SignatureRes } from './types/index.js';
5
5
  import { StorageUtils } from './StorageUtils.js';
6
6
  export interface PlatformUtils {
7
+ sdkType: SDKType;
7
8
  getPrivateKey(ctx: Ctx, userId: string, walletId: string, share: string, sessionCookie: string): Promise<string>;
8
- keygen(ctx: Ctx, userId: string, type: Exclude<WalletType, WalletType.SOLANA>, secretKey: string | null, // should be acceptable as null in RN as we don't pre-gen them
9
+ keygen(ctx: Ctx, userId: string, type: Exclude<TWalletType, 'SOLANA'>, secretKey: string | null, // should be acceptable as null in RN as we don't pre-gen them
9
10
  sessionCookie: string, emailProps?: BackupKitEmailProps): Promise<{
10
11
  signer: string;
11
12
  walletId: string;
@@ -14,7 +15,7 @@ export interface PlatformUtils {
14
15
  signer: string;
15
16
  protocolId?: string;
16
17
  }>;
17
- preKeygen(ctx: Ctx, partnerId: string, pregenIdentifier: string, pregenIdentifierType: TPregenIdentifierType, type: Exclude<WalletType, WalletType.SOLANA>, secretKey: string | null, // should be acceptable as null in RN as we don't pre-gen them
18
+ preKeygen(ctx: Ctx, partnerId: string, pregenIdentifier: string, pregenIdentifierType: TPregenIdentifierType, type: Exclude<TWalletType, 'SOLANA'>, secretKey: string | null, // should be acceptable as null in RN as we don't pre-gen them
18
19
  sessionCookie: string): Promise<{
19
20
  signer: string;
20
21
  walletId: string;
@@ -6,6 +6,7 @@ export declare const LOCAL_STORAGE_PHONE: string;
6
6
  export declare const LOCAL_STORAGE_COUNTRY_CODE: string;
7
7
  export declare const LOCAL_STORAGE_FARCASTER_USERNAME: string;
8
8
  export declare const LOCAL_STORAGE_TELEGRAM_USER_ID: string;
9
+ export declare const LOCAL_STORAGE_EXTERNAL_WALLET_USER_ID: string;
9
10
  export declare const LOCAL_STORAGE_USER_ID: string;
10
11
  export declare const LOCAL_STORAGE_ED25519_WALLETS: string;
11
12
  export declare const LOCAL_STORAGE_WALLETS: string;
@@ -16,3 +17,4 @@ export declare const SESSION_STORAGE_LOGIN_ENCRYPTION_KEY_PAIR: string;
16
17
  export declare const POLLING_INTERVAL_MS = 2000;
17
18
  export declare const SHORT_POLLING_INTERVAL_MS = 1000;
18
19
  export declare const POLLING_TIMEOUT_MS = 300000;
20
+ export declare const EXTERNAL_WALLET_CONNECTION_ONLY_USER_ID = "EXTERNAL_WALLET_CONNECTION_ONLY";
@@ -1,6 +1,6 @@
1
1
  import { ParaCore } from './ParaCore.js';
2
- export { type AuthInfo, type PrimaryAuthInfo, type VerifiedAuthInfo, AuthMethod, type AuthExtras, type CurrentWalletIds, EmailTheme, type PartnerEntity, type WalletEntity, Network, WalletType, WalletScheme, OnRampAsset, OnRampPurchaseType, OnRampProvider, OnRampPurchaseStatus, type OnRampConfig, type OnRampAllowedAssets, type OnRampPurchase, OAuthMethod, type SupportedWalletTypes, type TPregenIdentifierType, type PregenIds, NON_ED25519, PREGEN_IDENTIFIER_TYPES, } from '@getpara/user-management-client';
3
- export { OnRampMethod, PopupType, PregenIdentifierType, RecoveryStatus, type AuthStateSignup, type AuthStateVerify, type AuthStateLogin, type AuthState, type OAuthResponse, type CoreAuthInfo, type ProviderAssetInfo, type SignatureRes, type FullSignatureRes, type SuccessfulSignatureRes, type DeniedSignatureRes, type DeniedSignatureResWithUrl, type OnRampAssetInfo, type Theme, type Wallet, } from './types/index.js';
2
+ export { type AuthInfo, type PrimaryAuthInfo, type VerifiedAuthInfo, AuthMethod, type AuthExtras, type CurrentWalletIds, EmailTheme, type PartnerEntity, type WalletEntity, Network, type TWalletType, type TWalletScheme, OnRampAsset, OnRampPurchaseType, OnRampProvider, OnRampPurchaseStatus, type OnRampConfig, type OnRampAllowedAssets, type OnRampPurchase, type TOAuthMethod, type SupportedWalletTypes, type TPregenIdentifierType, type PregenIds, NON_ED25519, PREGEN_IDENTIFIER_TYPES, WALLET_TYPES, WALLET_SCHEMES, OAUTH_METHODS, } from '@getpara/user-management-client';
3
+ export { OnRampMethod, PopupType, PregenIdentifierType, RecoveryStatus, type AuthStateSignup, type AuthStateVerify, type AuthStateLogin, type AuthState, type OAuthResponse, type CoreAuthInfo, type ProviderAssetInfo, type SignatureRes, type FullSignatureRes, type SuccessfulSignatureRes, type DeniedSignatureRes, type DeniedSignatureResWithUrl, type OnRampAssetInfo, type Theme, type Wallet, type GetWalletBalanceParams, } from './types/index.js';
4
4
  export * from './types/coreApi.js';
5
5
  export * from './types/events.js';
6
6
  export * from './types/config.js';
@@ -19,7 +19,7 @@ export * from './utils/formatting.js';
19
19
  export * from './utils/polling.js';
20
20
  export * from './utils/phone.js';
21
21
  export { isWalletSupported } from './utils/wallet.js';
22
- export { getOnRampAssets, getOnRampNetworks, toAssetInfoArray } from './utils/onRamps.js';
22
+ export { getNetworkPrefix, getOnRampAssets, getOnRampNetworks, toAssetInfoArray } from './utils/onRamps.js';
23
23
  export { getPortalBaseURL } from './utils/url.js';
24
24
  export { retrieve as transmissionUtilsRetrieve } from './transmission/transmissionUtils.js';
25
25
  export declare const paraVersion: string;
@@ -1,5 +1,5 @@
1
1
  import { AxiosInstance } from 'axios';
2
- import Client, { EmailTheme, Network, OnRampAsset, OnRampProvider, WalletScheme, WalletType } from '@getpara/user-management-client';
2
+ import Client, { EmailTheme, Network, OnRampAsset, OnRampProvider, TWalletScheme, TWalletType } from '@getpara/user-management-client';
3
3
  import { Theme } from './theme.js';
4
4
  export declare enum Environment {
5
5
  DEV = "DEV",
@@ -25,11 +25,9 @@ export interface Ctx {
25
25
  }
26
26
  export type deprecated__NetworkProp = keyof typeof Network | Network;
27
27
  export type deprecated__OnRampProviderProp = keyof typeof OnRampProvider | OnRampProvider;
28
- export type WalletTypeProp = keyof typeof WalletType | WalletType;
29
- export type WalletSchemeProp = keyof typeof WalletScheme | WalletScheme;
30
28
  export type WalletFilters = {
31
- type?: WalletTypeProp[];
32
- scheme?: WalletSchemeProp[];
29
+ type?: TWalletType[];
30
+ scheme?: TWalletScheme[];
33
31
  forbidPregen?: boolean;
34
32
  };
35
33
  export type deprecated__RampConfig = {
@@ -58,6 +56,7 @@ export type SupportedWalletTypeConfig = {
58
56
  optional?: boolean;
59
57
  };
60
58
  export interface ConstructorOpts {
59
+ externalWalletConnectionOnly?: boolean;
61
60
  useStorageOverrides?: boolean;
62
61
  disableWorkers?: boolean;
63
62
  offloadMPCComputationURL?: string;