@getpara/core-sdk 1.5.1 → 1.6.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/cjs/index.js CHANGED
@@ -1104,7 +1104,7 @@ var TransactionReviewTimeout = class extends Error {
1104
1104
  };
1105
1105
 
1106
1106
  // src/constants.ts
1107
- var PARA_CORE_VERSION = '1.5.1';
1107
+ var PARA_CORE_VERSION = '1.6.0';
1108
1108
  var PREFIX = "@CAPSULE/";
1109
1109
  var LOCAL_STORAGE_EMAIL = `${PREFIX}e-mail`;
1110
1110
  var LOCAL_STORAGE_PHONE = `${PREFIX}phone`;
@@ -1943,6 +1943,23 @@ var _ParaCore = class _ParaCore {
1943
1943
  dispatchEvent(ParaEvent.WALLETS_CHANGE_EVENT, null);
1944
1944
  });
1945
1945
  }
1946
+ /**
1947
+ * Fetches the most recent OAuth account metadata for the signed-in user.
1948
+ * 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.
1949
+ * @returns {Promise<AccountMetadata>} the user's account metadata.
1950
+ */
1951
+ getAccountMetadata() {
1952
+ return __async(this, null, function* () {
1953
+ if (!(yield this.isSessionActive()) || !this.userId) {
1954
+ throw new Error("no signed-in user");
1955
+ }
1956
+ const {
1957
+ data: { partnerId }
1958
+ } = yield this.touchSession();
1959
+ const { accountMetadata } = yield this.ctx.client.getAccountMetadata(this.userId, partnerId);
1960
+ return accountMetadata;
1961
+ });
1962
+ }
1946
1963
  /**
1947
1964
  * Validates that a wallet ID is present on the instance, usable, and matches the desired filters.
1948
1965
  * If no ID is passed, this will instead return the first valid, usable wallet ID that matches the filters.
@@ -3332,6 +3349,12 @@ var _ParaCore = class _ParaCore {
3332
3349
  if (pregenWallets.length === 0) {
3333
3350
  return void 0;
3334
3351
  }
3352
+ const missingWallets = pregenWallets.filter((wallet) => !this.wallets[wallet.id]);
3353
+ if (missingWallets.length > 0) {
3354
+ throw new Error(
3355
+ `Cannot claim pregen wallets because wallet data is missing. Please call setUserShare first to load the wallet data for the following wallet IDs: ${missingWallets.map((w) => w.id).join(", ")}`
3356
+ );
3357
+ }
3335
3358
  let newRecoverySecret;
3336
3359
  const { walletIds } = yield this.ctx.client.claimPregenWallets({
3337
3360
  userId: this.userId,
Binary file
Binary file
@@ -0,0 +1,3 @@
1
+ {
2
+ "type": "commonjs"
3
+ }
package/dist/esm/index.js CHANGED
@@ -1021,7 +1021,7 @@ var TransactionReviewTimeout = class extends Error {
1021
1021
  };
1022
1022
 
1023
1023
  // src/constants.ts
1024
- var PARA_CORE_VERSION = '1.5.1';
1024
+ var PARA_CORE_VERSION = '1.6.0';
1025
1025
  var PREFIX = "@CAPSULE/";
1026
1026
  var LOCAL_STORAGE_EMAIL = `${PREFIX}e-mail`;
1027
1027
  var LOCAL_STORAGE_PHONE = `${PREFIX}phone`;
@@ -1860,6 +1860,23 @@ var _ParaCore = class _ParaCore {
1860
1860
  dispatchEvent(ParaEvent.WALLETS_CHANGE_EVENT, null);
1861
1861
  });
1862
1862
  }
1863
+ /**
1864
+ * Fetches the most recent OAuth account metadata for the signed-in user.
1865
+ * 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.
1866
+ * @returns {Promise<AccountMetadata>} the user's account metadata.
1867
+ */
1868
+ getAccountMetadata() {
1869
+ return __async(this, null, function* () {
1870
+ if (!(yield this.isSessionActive()) || !this.userId) {
1871
+ throw new Error("no signed-in user");
1872
+ }
1873
+ const {
1874
+ data: { partnerId }
1875
+ } = yield this.touchSession();
1876
+ const { accountMetadata } = yield this.ctx.client.getAccountMetadata(this.userId, partnerId);
1877
+ return accountMetadata;
1878
+ });
1879
+ }
1863
1880
  /**
1864
1881
  * Validates that a wallet ID is present on the instance, usable, and matches the desired filters.
1865
1882
  * If no ID is passed, this will instead return the first valid, usable wallet ID that matches the filters.
@@ -3249,6 +3266,12 @@ var _ParaCore = class _ParaCore {
3249
3266
  if (pregenWallets.length === 0) {
3250
3267
  return void 0;
3251
3268
  }
3269
+ const missingWallets = pregenWallets.filter((wallet) => !this.wallets[wallet.id]);
3270
+ if (missingWallets.length > 0) {
3271
+ throw new Error(
3272
+ `Cannot claim pregen wallets because wallet data is missing. Please call setUserShare first to load the wallet data for the following wallet IDs: ${missingWallets.map((w) => w.id).join(", ")}`
3273
+ );
3274
+ }
3252
3275
  let newRecoverySecret;
3253
3276
  const { walletIds } = yield this.ctx.client.claimPregenWallets({
3254
3277
  userId: this.userId,
Binary file
Binary file
@@ -0,0 +1,4 @@
1
+ {
2
+ "type": "module",
3
+ "sideEffects": false
4
+ }
@@ -1,4 +1,4 @@
1
- import Client, { AuthMethod, BackupKitEmailProps, CurrentWalletIds, EmailTheme, WalletEntity, WalletType, WalletParams, OAuthMethod, OnRampPurchaseCreateParams, OnRampPurchase, TPregenIdentifierType, PregenIds, BiometricLocationHint, TelegramAuthResponse, VerifyTelegramRes, Auth, ExternalWalletLoginRes } from '@getpara/user-management-client';
1
+ import Client, { AuthMethod, BackupKitEmailProps, CurrentWalletIds, EmailTheme, WalletEntity, WalletType, WalletParams, OAuthMethod, OnRampPurchaseCreateParams, OnRampPurchase, TPregenIdentifierType, PregenIds, BiometricLocationHint, TelegramAuthResponse, VerifyTelegramRes, Auth, ExternalWalletLoginRes, AccountMetadata } from '@getpara/user-management-client';
2
2
  import type { pki as pkiType } from 'node-forge';
3
3
  import { Ctx, Environment, Theme, FullSignatureRes, ExternalWalletInfo, GetWebAuthUrlForLoginParams, AccountSetupResponse, LoginResponse, WalletFilters, WalletTypeProp, Wallet, SupportedWalletTypes, PortalUrlOptions, ConstructorOpts, RecoveryStatus } from './types/index.js';
4
4
  import { PlatformUtils } from './PlatformUtils.js';
@@ -269,6 +269,12 @@ export declare abstract class ParaCore {
269
269
  sessionLookupId?: string;
270
270
  newDeviceSessionLookupId?: string;
271
271
  }): Promise<void>;
272
+ /**
273
+ * Fetches the most recent OAuth account metadata for the signed-in user.
274
+ * 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.
275
+ * @returns {Promise<AccountMetadata>} the user's account metadata.
276
+ */
277
+ getAccountMetadata(): Promise<AccountMetadata>;
272
278
  /**
273
279
  * The prefix for the instance's managed Cosmos wallets. Defaults to `'cosmos'`.
274
280
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@getpara/core-sdk",
3
- "version": "1.5.1",
3
+ "version": "1.6.0",
4
4
  "main": "dist/cjs/index.js",
5
5
  "module": "dist/esm/index.js",
6
6
  "types": "dist/types/index.d.ts",
@@ -9,7 +9,7 @@
9
9
  "dependencies": {
10
10
  "@celo/utils": "^8.0.0",
11
11
  "@cosmjs/encoding": "^0.32.4",
12
- "@getpara/user-management-client": "1.5.1",
12
+ "@getpara/user-management-client": "1.6.0",
13
13
  "@noble/hashes": "^1.5.0",
14
14
  "base64url": "^3.0.1",
15
15
  "ethereumjs-util": "7.1.5",
@@ -40,5 +40,5 @@
40
40
  "require": "./dist/cjs/index.js"
41
41
  }
42
42
  },
43
- "gitHead": "f77e0f5e162a1672219b01dbf7c06a3baadd2f35"
43
+ "gitHead": "2dd6c8ea893d72d693804e5c5b0856d2ea6c3a7a"
44
44
  }