@getpara/core-sdk 2.0.0-alpha.59 → 2.0.0-alpha.60

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.
@@ -495,7 +495,12 @@ const _ParaCore = class _ParaCore {
495
495
  } else if (this.isExternalWalletWithVerification) {
496
496
  return "VERIFICATION";
497
497
  } else if (!!Object.keys(this.externalWallets).length) {
498
- return "CONNECTION_ONLY";
498
+ const hasEmbeddedWallets = Object.keys(this.wallets).some((id) => !this.wallets[id].isExternal);
499
+ if (hasEmbeddedWallets) {
500
+ return "NONE";
501
+ } else {
502
+ return "CONNECTION_ONLY";
503
+ }
499
504
  }
500
505
  return "NONE";
501
506
  }
@@ -1239,12 +1244,16 @@ Need help? Visit: https://docs.getpara.com or contact support
1239
1244
  }
1240
1245
  /**
1241
1246
  * Sets the external wallets associated with the `ParaCore` instance.
1242
- * @param externalWallets - External wallets to set.
1247
+ * @param externalWallets - External wallets to set, or a function that modifies the current wallets.
1243
1248
  */
1244
1249
  setExternalWallets(externalWallets) {
1245
1250
  return __async(this, null, function* () {
1246
- this.externalWallets = externalWallets;
1247
- yield this.localStorageSetItem(constants.LOCAL_STORAGE_EXTERNAL_WALLETS, JSON.stringify(externalWallets));
1251
+ if (typeof externalWallets === "function") {
1252
+ this.externalWallets = externalWallets(this.externalWallets);
1253
+ } else {
1254
+ this.externalWallets = externalWallets;
1255
+ }
1256
+ yield this.localStorageSetItem(constants.LOCAL_STORAGE_EXTERNAL_WALLETS, JSON.stringify(this.externalWallets));
1248
1257
  });
1249
1258
  }
1250
1259
  /**
@@ -3352,7 +3361,7 @@ Need help? Visit: https://docs.getpara.com or contact support
3352
3361
  }
3353
3362
  break;
3354
3363
  default:
3355
- throw new Error("Invalid parameters for linking account, must pass `auth` or `type` or `externalWallet");
3364
+ throw new Error("Invalid parameters for linking account, must pass `auth` or `type` or `externalWallet`");
3356
3365
  }
3357
3366
  if (!isPermitted) {
3358
3367
  throw new Error(`Account linking for type '${type}' is not supported by the current API key configuration`);
@@ -43,7 +43,7 @@ __export(constants_exports, {
43
43
  SHORT_POLLING_INTERVAL_MS: () => SHORT_POLLING_INTERVAL_MS
44
44
  });
45
45
  module.exports = __toCommonJS(constants_exports);
46
- const PARA_CORE_VERSION = "2.0.0-alpha.59";
46
+ const PARA_CORE_VERSION = "2.0.0-alpha.60";
47
47
  const PREFIX = "@CAPSULE/";
48
48
  const PARA_PREFIX = "@PARA/";
49
49
  const LOCAL_STORAGE_AUTH_INFO = `${PREFIX}authInfo`;
@@ -459,7 +459,12 @@ const _ParaCore = class _ParaCore {
459
459
  } else if (this.isExternalWalletWithVerification) {
460
460
  return "VERIFICATION";
461
461
  } else if (!!Object.keys(this.externalWallets).length) {
462
- return "CONNECTION_ONLY";
462
+ const hasEmbeddedWallets = Object.keys(this.wallets).some((id) => !this.wallets[id].isExternal);
463
+ if (hasEmbeddedWallets) {
464
+ return "NONE";
465
+ } else {
466
+ return "CONNECTION_ONLY";
467
+ }
463
468
  }
464
469
  return "NONE";
465
470
  }
@@ -1203,12 +1208,16 @@ Need help? Visit: https://docs.getpara.com or contact support
1203
1208
  }
1204
1209
  /**
1205
1210
  * Sets the external wallets associated with the `ParaCore` instance.
1206
- * @param externalWallets - External wallets to set.
1211
+ * @param externalWallets - External wallets to set, or a function that modifies the current wallets.
1207
1212
  */
1208
1213
  setExternalWallets(externalWallets) {
1209
1214
  return __async(this, null, function* () {
1210
- this.externalWallets = externalWallets;
1211
- yield this.localStorageSetItem(constants.LOCAL_STORAGE_EXTERNAL_WALLETS, JSON.stringify(externalWallets));
1215
+ if (typeof externalWallets === "function") {
1216
+ this.externalWallets = externalWallets(this.externalWallets);
1217
+ } else {
1218
+ this.externalWallets = externalWallets;
1219
+ }
1220
+ yield this.localStorageSetItem(constants.LOCAL_STORAGE_EXTERNAL_WALLETS, JSON.stringify(this.externalWallets));
1212
1221
  });
1213
1222
  }
1214
1223
  /**
@@ -3316,7 +3325,7 @@ Need help? Visit: https://docs.getpara.com or contact support
3316
3325
  }
3317
3326
  break;
3318
3327
  default:
3319
- throw new Error("Invalid parameters for linking account, must pass `auth` or `type` or `externalWallet");
3328
+ throw new Error("Invalid parameters for linking account, must pass `auth` or `type` or `externalWallet`");
3320
3329
  }
3321
3330
  if (!isPermitted) {
3322
3331
  throw new Error(`Account linking for type '${type}' is not supported by the current API key configuration`);
@@ -1,5 +1,5 @@
1
1
  import "./chunk-W5CT3TVS.js";
2
- const PARA_CORE_VERSION = "2.0.0-alpha.59";
2
+ const PARA_CORE_VERSION = "2.0.0-alpha.60";
3
3
  const PREFIX = "@CAPSULE/";
4
4
  const PARA_PREFIX = "@PARA/";
5
5
  const LOCAL_STORAGE_AUTH_INFO = `${PREFIX}authInfo`;
@@ -292,9 +292,9 @@ export declare abstract class ParaCore implements CoreInterface {
292
292
  setWallets(wallets: Record<string, Wallet>): Promise<void>;
293
293
  /**
294
294
  * Sets the external wallets associated with the `ParaCore` instance.
295
- * @param externalWallets - External wallets to set.
295
+ * @param externalWallets - External wallets to set, or a function that modifies the current wallets.
296
296
  */
297
- setExternalWallets(externalWallets: Record<string, Wallet>): Promise<void>;
297
+ setExternalWallets(externalWallets: Record<string, Wallet> | ((current: Record<string, Wallet>) => Record<string, Wallet>)): Promise<void>;
298
298
  /**
299
299
  * Sets the login encryption key pair associated with the `ParaCore` instance.
300
300
  * @param keyPair - Encryption key pair generated from loginEncryptionKey.
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@getpara/core-sdk",
3
- "version": "2.0.0-alpha.59",
3
+ "version": "2.0.0-alpha.60",
4
4
  "dependencies": {
5
5
  "@celo/utils": "^8.0.2",
6
6
  "@cosmjs/encoding": "^0.32.4",
7
7
  "@ethereumjs/util": "^9.1.0",
8
- "@getpara/user-management-client": "2.0.0-alpha.59",
8
+ "@getpara/user-management-client": "2.0.0-alpha.60",
9
9
  "@noble/hashes": "^1.5.0",
10
10
  "base64url": "^3.0.1",
11
11
  "libphonenumber-js": "^1.11.7",
@@ -27,7 +27,7 @@
27
27
  "dist",
28
28
  "package.json"
29
29
  ],
30
- "gitHead": "e15908ac8eafff6f3b264fffa43742870b14b275",
30
+ "gitHead": "b445d9dcf909a9bfa72d4f21b825fcf7c643be0c",
31
31
  "main": "dist/cjs/index.js",
32
32
  "module": "dist/esm/index.js",
33
33
  "scripts": {