@getpara/core-sdk 1.12.0 → 1.13.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.
@@ -1584,16 +1584,10 @@ const _ParaCore = class _ParaCore {
1584
1584
  if (this.isUsingExternalWallet()) {
1585
1585
  return true;
1586
1586
  }
1587
- if (this.isGuestMode) {
1588
- return true;
1589
- }
1590
1587
  const isSessionActive = yield this.isSessionActive();
1591
1588
  return isSessionActive && (this.isNoWalletConfig || this.currentWalletIdsArray.length > 0 && this.currentWalletIdsArray.reduce((acc, [id]) => acc && !!this.wallets[id], true));
1592
1589
  });
1593
1590
  }
1594
- get isGuestMode() {
1595
- return !this.userId && this.currentWalletIdsArray.length > 0 && this.currentWalletIdsArray.every(([id]) => !!this.wallets[id] && this.wallets[id].pregenIdentifierType === "GUEST_ID");
1596
- }
1597
1591
  supportedAuthMethods(auth) {
1598
1592
  return __async(this, null, function* () {
1599
1593
  const { supportedAuthMethods } = yield this.ctx.client.getSupportedAuthMethods(auth);
@@ -2468,24 +2462,6 @@ const _ParaCore = class _ParaCore {
2468
2462
  return res.wallets.filter((w) => this.isWalletSupported((0, import_utils2.entityToWallet)(w)));
2469
2463
  });
2470
2464
  }
2471
- createGuestWallets() {
2472
- return __async(this, arguments, function* ({ types } = {}) {
2473
- const wallets = [];
2474
- const currentWalletIds = {};
2475
- const guestId = (0, import_utils2.newUuid)();
2476
- for (const type of yield this.getTypesToCreate(
2477
- types != null ? types : this.supportedWalletTypes.filter(({ optional }) => !optional).map(({ type: type2 }) => type2)
2478
- )) {
2479
- const wallet = yield __privateMethod(this, _ParaCore_instances, createPregenWallet_fn).call(this, { type, pregenIdentifier: guestId, pregenIdentifierType: "GUEST_ID" });
2480
- wallets.push(wallet);
2481
- (0, import_utils2.getEquivalentTypes)(type).filter((t) => __privateGet(this, _supportedWalletTypes).some(({ type: type2, optional }) => t === type2 && !optional)).forEach((eqType) => {
2482
- currentWalletIds[eqType] = [wallet.id];
2483
- });
2484
- }
2485
- yield this.setCurrentWalletIds(currentWalletIds);
2486
- return wallets;
2487
- });
2488
- }
2489
2465
  encodeWalletBase64(wallet) {
2490
2466
  const walletJson = JSON.stringify(wallet);
2491
2467
  const base64Wallet = Buffer.from(walletJson).toString("base64");
@@ -37,7 +37,7 @@ __export(constants_exports, {
37
37
  SHORT_POLLING_INTERVAL_MS: () => SHORT_POLLING_INTERVAL_MS
38
38
  });
39
39
  module.exports = __toCommonJS(constants_exports);
40
- const PARA_CORE_VERSION = "1.12.0";
40
+ const PARA_CORE_VERSION = "1.13.0";
41
41
  const PREFIX = "@CAPSULE/";
42
42
  const LOCAL_STORAGE_EMAIL = `${PREFIX}e-mail`;
43
43
  const LOCAL_STORAGE_PHONE = `${PREFIX}phone`;
@@ -1,11 +1,9 @@
1
- var __create = Object.create;
2
1
  var __defProp = Object.defineProperty;
3
2
  var __defProps = Object.defineProperties;
4
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
4
  var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
6
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
7
6
  var __getOwnPropSymbols = Object.getOwnPropertySymbols;
8
- var __getProtoOf = Object.getPrototypeOf;
9
7
  var __hasOwnProp = Object.prototype.hasOwnProperty;
10
8
  var __propIsEnum = Object.prototype.propertyIsEnumerable;
11
9
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
@@ -33,14 +31,6 @@ var __copyProps = (to, from, except, desc) => {
33
31
  }
34
32
  return to;
35
33
  };
36
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
37
- // If the importer is in node compatibility mode or this is not an ESM
38
- // file that has been converted to a CommonJS file using a Babel-
39
- // compatible transform (i.e. "__esModule" has not been set), then set
40
- // "default" to the CommonJS "module.exports" for node compatibility.
41
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
42
- mod
43
- ));
44
34
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
45
35
  var wallet_exports = {};
46
36
  __export(wallet_exports, {
@@ -51,11 +41,9 @@ __export(wallet_exports, {
51
41
  getWalletTypes: () => getWalletTypes,
52
42
  isPregenIdentifierMatch: () => isPregenIdentifierMatch,
53
43
  isWalletSupported: () => isWalletSupported,
54
- migrateWallet: () => migrateWallet,
55
- newUuid: () => newUuid
44
+ migrateWallet: () => migrateWallet
56
45
  });
57
46
  module.exports = __toCommonJS(wallet_exports);
58
- var uuid = __toESM(require("uuid"));
59
47
  var import_user_management_client = require("@getpara/user-management-client");
60
48
  var import_formatting = require("./formatting.js");
61
49
  const WalletSchemeTypeMap = {
@@ -129,9 +117,6 @@ function migrateWallet(obj) {
129
117
  }
130
118
  return obj;
131
119
  }
132
- function newUuid() {
133
- return uuid.v4();
134
- }
135
120
  // Annotate the CommonJS export names for ESM import in node:
136
121
  0 && (module.exports = {
137
122
  WalletSchemeTypeMap,
@@ -141,6 +126,5 @@ function newUuid() {
141
126
  getWalletTypes,
142
127
  isPregenIdentifierMatch,
143
128
  isWalletSupported,
144
- migrateWallet,
145
- newUuid
129
+ migrateWallet
146
130
  });
@@ -55,7 +55,6 @@ import {
55
55
  isPregenIdentifierMatch,
56
56
  isWalletSupported,
57
57
  migrateWallet,
58
- newUuid,
59
58
  normalizePhoneNumber,
60
59
  truncateAddress,
61
60
  WalletSchemeTypeMap
@@ -1535,16 +1534,10 @@ const _ParaCore = class _ParaCore {
1535
1534
  if (this.isUsingExternalWallet()) {
1536
1535
  return true;
1537
1536
  }
1538
- if (this.isGuestMode) {
1539
- return true;
1540
- }
1541
1537
  const isSessionActive = yield this.isSessionActive();
1542
1538
  return isSessionActive && (this.isNoWalletConfig || this.currentWalletIdsArray.length > 0 && this.currentWalletIdsArray.reduce((acc, [id]) => acc && !!this.wallets[id], true));
1543
1539
  });
1544
1540
  }
1545
- get isGuestMode() {
1546
- return !this.userId && this.currentWalletIdsArray.length > 0 && this.currentWalletIdsArray.every(([id]) => !!this.wallets[id] && this.wallets[id].pregenIdentifierType === "GUEST_ID");
1547
- }
1548
1541
  supportedAuthMethods(auth) {
1549
1542
  return __async(this, null, function* () {
1550
1543
  const { supportedAuthMethods } = yield this.ctx.client.getSupportedAuthMethods(auth);
@@ -2419,24 +2412,6 @@ const _ParaCore = class _ParaCore {
2419
2412
  return res.wallets.filter((w) => this.isWalletSupported(entityToWallet(w)));
2420
2413
  });
2421
2414
  }
2422
- createGuestWallets() {
2423
- return __async(this, arguments, function* ({ types } = {}) {
2424
- const wallets = [];
2425
- const currentWalletIds = {};
2426
- const guestId = newUuid();
2427
- for (const type of yield this.getTypesToCreate(
2428
- types != null ? types : this.supportedWalletTypes.filter(({ optional }) => !optional).map(({ type: type2 }) => type2)
2429
- )) {
2430
- const wallet = yield __privateMethod(this, _ParaCore_instances, createPregenWallet_fn).call(this, { type, pregenIdentifier: guestId, pregenIdentifierType: "GUEST_ID" });
2431
- wallets.push(wallet);
2432
- getEquivalentTypes(type).filter((t) => __privateGet(this, _supportedWalletTypes).some(({ type: type2, optional }) => t === type2 && !optional)).forEach((eqType) => {
2433
- currentWalletIds[eqType] = [wallet.id];
2434
- });
2435
- }
2436
- yield this.setCurrentWalletIds(currentWalletIds);
2437
- return wallets;
2438
- });
2439
- }
2440
2415
  encodeWalletBase64(wallet) {
2441
2416
  const walletJson = JSON.stringify(wallet);
2442
2417
  const base64Wallet = Buffer.from(walletJson).toString("base64");
@@ -1,5 +1,5 @@
1
1
  import "./chunk-7B52C2XE.js";
2
- const PARA_CORE_VERSION = "1.12.0";
2
+ const PARA_CORE_VERSION = "1.13.0";
3
3
  const PREFIX = "@CAPSULE/";
4
4
  const LOCAL_STORAGE_EMAIL = `${PREFIX}e-mail`;
5
5
  const LOCAL_STORAGE_PHONE = `${PREFIX}phone`;
@@ -2,7 +2,6 @@ import {
2
2
  __spreadProps,
3
3
  __spreadValues
4
4
  } from "../chunk-7B52C2XE.js";
5
- import * as uuid from "uuid";
6
5
  import { WalletScheme, WalletType } from "@getpara/user-management-client";
7
6
  import { stringToPhoneNumber } from "./formatting.js";
8
7
  const WalletSchemeTypeMap = {
@@ -76,9 +75,6 @@ function migrateWallet(obj) {
76
75
  }
77
76
  return obj;
78
77
  }
79
- function newUuid() {
80
- return uuid.v4();
81
- }
82
78
  export {
83
79
  WalletSchemeTypeMap,
84
80
  entityToWallet,
@@ -87,6 +83,5 @@ export {
87
83
  getWalletTypes,
88
84
  isPregenIdentifierMatch,
89
85
  isWalletSupported,
90
- migrateWallet,
91
- newUuid
86
+ migrateWallet
92
87
  };
@@ -1,6 +1,6 @@
1
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
- import { Ctx, Environment, Theme, FullSignatureRes, ExternalWalletInfo, GetWebAuthUrlForLoginParams, AccountSetupResponse, LoginResponse, WalletFilters, WalletTypeProp, Wallet, SupportedWalletTypes, PortalUrlOptions, ConstructorOpts, RecoveryStatus, GetWalletBalanceParams, CreateGuestWalletsParams } from './types/index.js';
3
+ import { Ctx, Environment, Theme, FullSignatureRes, ExternalWalletInfo, GetWebAuthUrlForLoginParams, AccountSetupResponse, LoginResponse, WalletFilters, WalletTypeProp, Wallet, SupportedWalletTypes, PortalUrlOptions, ConstructorOpts, RecoveryStatus, GetWalletBalanceParams } from './types/index.js';
4
4
  import { PlatformUtils } from './PlatformUtils.js';
5
5
  import { CountryCallingCode } from 'libphonenumber-js';
6
6
  export declare abstract class ParaCore {
@@ -534,7 +534,6 @@ export declare abstract class ParaCore {
534
534
  * @returns `true` if active, `false` otherwise
535
535
  **/
536
536
  isFullyLoggedIn(): Promise<boolean>;
537
- get isGuestMode(): boolean;
538
537
  protected supportedAuthMethods(auth: Auth): Promise<Set<AuthMethod>>;
539
538
  /**
540
539
  * Get hints associated with the users stored biometrics.
@@ -782,7 +781,7 @@ export declare abstract class ParaCore {
782
781
  createPregenWallet(opts: {
783
782
  type: WalletType;
784
783
  pregenIdentifier: string;
785
- pregenIdentifierType: Exclude<TPregenIdentifierType, 'GUEST_ID'>;
784
+ pregenIdentifierType: TPregenIdentifierType;
786
785
  }): Promise<Wallet>;
787
786
  /**
788
787
  * Creates new pregenerated wallets for each desired type.
@@ -796,7 +795,7 @@ export declare abstract class ParaCore {
796
795
  **/
797
796
  createPregenWalletPerType({ types, pregenIdentifier, pregenIdentifierType, }: {
798
797
  pregenIdentifier: string;
799
- pregenIdentifierType: Exclude<TPregenIdentifierType, 'GUEST_ID'>;
798
+ pregenIdentifierType: TPregenIdentifierType;
800
799
  types?: WalletType[];
801
800
  }): Promise<Wallet[]>;
802
801
  /**
@@ -845,7 +844,6 @@ export declare abstract class ParaCore {
845
844
  pregenIdentifier?: string;
846
845
  pregenIdentifierType?: TPregenIdentifierType;
847
846
  }): Promise<WalletEntity[]>;
848
- createGuestWallets({ types }?: CreateGuestWalletsParams): Promise<Wallet[]>;
849
847
  private encodeWalletBase64;
850
848
  /**
851
849
  * Encodes the current wallets encoded in Base 64.
@@ -1,6 +1,6 @@
1
1
  import { ParaCore } from './ParaCore.js';
2
2
  export { AuthMethod, type CurrentWalletIds, EmailTheme, type PartnerEntity, type WalletEntity, Network, WalletType, WalletScheme, OnRampAsset, OnRampPurchaseType, OnRampProvider, OnRampPurchaseStatus, type OnRampConfig, type OnRampAllowedAssets, type OnRampPurchase, OAuthMethod, type TPregenIdentifierType, type PregenIds, NON_ED25519, PREGEN_IDENTIFIER_TYPES, } from '@getpara/user-management-client';
3
- export { OnRampMethod, PopupType, PregenIdentifierType, RecoveryStatus, type ProviderAssetInfo, type SignatureRes, type FullSignatureRes, type SuccessfulSignatureRes, type DeniedSignatureRes, type DeniedSignatureResWithUrl, type OnRampAssetInfo, type Theme, type Wallet, type GetWalletBalanceParams, type CreateGuestWalletsParams, } from './types/index.js';
3
+ export { OnRampMethod, PopupType, PregenIdentifierType, RecoveryStatus, 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/events.js';
5
5
  export * from './types/config.js';
6
6
  export { getPortalDomain, stringToPhoneNumber, entityToWallet } from './utils/index.js';
@@ -68,6 +68,3 @@ export type GetWalletBalanceParams = {
68
68
  walletId: string;
69
69
  rpcUrl?: string;
70
70
  };
71
- export type CreateGuestWalletsParams = {
72
- types?: WalletType[];
73
- };
@@ -8,4 +8,3 @@ export declare function getWalletTypes(schemes: WalletScheme[]): WalletType[];
8
8
  export declare function getEquivalentTypes(types: WalletTypeProp[] | WalletTypeProp): WalletType[];
9
9
  export declare function entityToWallet(w: WalletEntity): Omit<Wallet, 'signer'>;
10
10
  export declare function migrateWallet(obj: Record<string, unknown>): Wallet;
11
- export declare function newUuid(): string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@getpara/core-sdk",
3
- "version": "1.12.0",
3
+ "version": "1.13.0",
4
4
  "main": "dist/cjs/index.js",
5
5
  "module": "dist/esm/index.js",
6
6
  "types": "dist/types/index.d.ts",
@@ -10,7 +10,7 @@
10
10
  "@celo/utils": "^8.0.2",
11
11
  "@cosmjs/encoding": "^0.32.4",
12
12
  "@ethereumjs/util": "^9.1.0",
13
- "@getpara/user-management-client": "1.12.0",
13
+ "@getpara/user-management-client": "1.13.0",
14
14
  "@noble/hashes": "^1.5.0",
15
15
  "base64url": "^3.0.1",
16
16
  "libphonenumber-js": "1.11.2",
@@ -40,5 +40,5 @@
40
40
  "require": "./dist/cjs/index.js"
41
41
  }
42
42
  },
43
- "gitHead": "748afcf08c9d307a2d3eaf0716f73132f3eb8529"
43
+ "gitHead": "cfc12a88a622907b3fbde326c891060fa53a2d32"
44
44
  }