@getpara/core-sdk 2.0.0-alpha.33 → 2.0.0-alpha.35

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.
@@ -129,6 +129,7 @@ const _ParaCore = class _ParaCore {
129
129
  this.isAwaitingLogin = false;
130
130
  this.isAwaitingFarcaster = false;
131
131
  this.isAwaitingOAuth = false;
132
+ this.isWorkerInitialized = false;
132
133
  /**
133
134
  * 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.
134
135
  */
@@ -137,6 +138,7 @@ const _ParaCore = class _ParaCore {
137
138
  * Wallets associated with the `ParaCore` instance.
138
139
  */
139
140
  this.externalWallets = {};
141
+ this.onRampPopup = void 0;
140
142
  this.localStorageGetItem = (key) => {
141
143
  return this.platformUtils.localStorage.get(key);
142
144
  };
@@ -288,6 +290,16 @@ const _ParaCore = class _ParaCore {
288
290
  const _externalWallets = JSON.parse(stringExternalWallets || "{}");
289
291
  this.setExternalWallets(_externalWallets);
290
292
  };
293
+ this.initializeWorker = () => __async(this, null, function* () {
294
+ if (!this.isWorkerInitialized && !this.ctx.disableWebSockets && !this.ctx.disableWorkers) {
295
+ try {
296
+ this.isWorkerInitialized = true;
297
+ yield this.platformUtils.initializeWorker(this.ctx);
298
+ } catch (e) {
299
+ this.devLog("error initializing worker:", e);
300
+ }
301
+ }
302
+ });
291
303
  /**
292
304
  * Creates several new wallets with the desired types. If no types are provided, this method
293
305
  * will create one for each of the non-optional types specified in the instance's `supportedWalletTypes`
@@ -710,7 +722,7 @@ const _ParaCore = class _ParaCore {
710
722
  break;
711
723
  }
712
724
  case "onRamp": {
713
- path = `/web/users/${this.userId}/on-ramp-transaction/${opts.pathId}`;
725
+ path = `/web/users/${this.userId}/on-ramp-transaction/v2/${opts.pathId}`;
714
726
  break;
715
727
  }
716
728
  case "telegramLogin": {
@@ -753,7 +765,7 @@ const _ParaCore = class _ParaCore {
753
765
  }, (0, import_user_management_client.isPhone)(this.authInfo.auth) ? (0, import_utils2.splitPhoneNumber)(this.authInfo.auth.phone) : this.authInfo.auth), {
754
766
  pfpUrl: this.authInfo.pfpUrl,
755
767
  displayName: this.authInfo.displayName
756
- }) : {}), isOnRamp ? { sessionId } : {}), isLogin ? __spreadProps(__spreadValues({
768
+ }) : {}), isOnRamp ? { origin: typeof window !== "undefined" ? window.location.origin : void 0, email: this.email } : {}), isLogin ? __spreadProps(__spreadValues({
757
769
  sessionId: thisDevice.sessionId,
758
770
  encryptionKey: thisDevice.encryptionKey
759
771
  }, opts.newDevice ? {
@@ -772,6 +784,9 @@ const _ParaCore = class _ParaCore {
772
784
  touchSession(regenerate = false) {
773
785
  return __async(this, null, function* () {
774
786
  var _a, _b, _c;
787
+ if (!this.isWorkerInitialized) {
788
+ this.initializeWorker();
789
+ }
775
790
  if (!this.isReady) {
776
791
  yield this.ready();
777
792
  }
@@ -1770,9 +1785,6 @@ const _ParaCore = class _ParaCore {
1770
1785
  return __privateMethod(this, _ParaCore_instances, getOAuthUrl_fn).call(this, __spreadProps(__spreadValues({}, opts), { sessionLookupId }));
1771
1786
  });
1772
1787
  }
1773
- getOAuthUrlSync(opts) {
1774
- return __privateMethod(this, _ParaCore_instances, getOAuthUrl_fn).call(this, opts);
1775
- }
1776
1788
  /**
1777
1789
  * Awaits the response from a user's attempt to log in with OAuth.
1778
1790
  * If successful, this returns the user's email address and indicates whether the user already exists.
@@ -1790,6 +1802,7 @@ const _ParaCore = class _ParaCore {
1790
1802
  onCancel,
1791
1803
  onPoll,
1792
1804
  onOAuthUrl,
1805
+ onOAuthPopup,
1793
1806
  isLinkAccount
1794
1807
  } = _j, urlOptions = __objRest(_j, [
1795
1808
  "method",
@@ -1798,10 +1811,19 @@ const _ParaCore = class _ParaCore {
1798
1811
  "onCancel",
1799
1812
  "onPoll",
1800
1813
  "onOAuthUrl",
1814
+ "onOAuthPopup",
1801
1815
  "isLinkAccount"
1802
1816
  ]);
1817
+ let popupWindow;
1818
+ if (onOAuthPopup) {
1819
+ try {
1820
+ popupWindow = yield this.platformUtils.openPopup("about:blank", { type: import_types.PopupType.OAUTH });
1821
+ } catch (error) {
1822
+ throw new Error(`Failed to open OAuth popup: ${error}`);
1823
+ }
1824
+ }
1803
1825
  let sessionLookupId, accountLinkInProgress;
1804
- if (onOAuthUrl) {
1826
+ if (onOAuthUrl || onOAuthPopup) {
1805
1827
  if (isLinkAccount) {
1806
1828
  accountLinkInProgress = yield __privateMethod(this, _ParaCore_instances, assertIsLinkingAccountOrStart_fn).call(this, method);
1807
1829
  sessionLookupId = (yield this.touchSession()).sessionLookupId;
@@ -1809,7 +1831,17 @@ const _ParaCore = class _ParaCore {
1809
1831
  sessionLookupId = yield this.prepareLogin();
1810
1832
  }
1811
1833
  const oAuthUrl = yield __privateMethod(this, _ParaCore_instances, getOAuthUrl_fn).call(this, { method, appScheme, sessionLookupId, accountLinkInProgress });
1812
- onOAuthUrl(oAuthUrl);
1834
+ switch (true) {
1835
+ case !!onOAuthUrl: {
1836
+ onOAuthUrl(oAuthUrl);
1837
+ break;
1838
+ }
1839
+ case (!!onOAuthPopup && !!popupWindow): {
1840
+ popupWindow.location.href = oAuthUrl;
1841
+ onOAuthPopup(popupWindow);
1842
+ break;
1843
+ }
1844
+ }
1813
1845
  } else {
1814
1846
  ({ sessionLookupId } = yield this.touchSession());
1815
1847
  }
@@ -1945,7 +1977,7 @@ const _ParaCore = class _ParaCore {
1945
1977
  sessionId
1946
1978
  });
1947
1979
  if (shouldOpenPopup) {
1948
- this.platformUtils.openPopup(link);
1980
+ yield this.platformUtils.openPopup(link);
1949
1981
  }
1950
1982
  return link;
1951
1983
  });
@@ -2489,25 +2521,12 @@ const _ParaCore = class _ParaCore {
2489
2521
  });
2490
2522
  });
2491
2523
  }
2492
- getOnRampTransactionUrl(_k) {
2493
- return __async(this, null, function* () {
2494
- var _l = _k, {
2495
- purchaseId,
2496
- providerKey
2497
- } = _l, walletParams = __objRest(_l, [
2498
- "purchaseId",
2499
- "providerKey"
2500
- ]);
2501
- const { sessionId } = yield this.touchSession();
2502
- const [key, identifier] = (0, import_user_management_client.extractWalletRef)(walletParams);
2524
+ getOnRampTransactionUrl(_0) {
2525
+ return __async(this, arguments, function* ({
2526
+ purchaseId
2527
+ }) {
2503
2528
  return this.constructPortalUrl("onRamp", {
2504
- pathId: purchaseId,
2505
- sessionId,
2506
- params: {
2507
- [key]: identifier,
2508
- providerKey,
2509
- currentWalletIds: JSON.stringify(this.currentWalletIds)
2510
- }
2529
+ pathId: purchaseId
2511
2530
  });
2512
2531
  });
2513
2532
  }
@@ -2541,7 +2560,7 @@ const _ParaCore = class _ParaCore {
2541
2560
  let signRes = yield this.signMessageInner({ wallet, signerId, messageBase64, cosmosSignDocBase64 });
2542
2561
  let timeStart = Date.now();
2543
2562
  if (signRes.pendingTransactionId) {
2544
- this.platformUtils.openPopup(
2563
+ yield this.platformUtils.openPopup(
2545
2564
  yield this.getTransactionReviewUrl(signRes.pendingTransactionId, timeoutMs),
2546
2565
  { type: cosmosSignDocBase64 ? import_types.PopupType.SIGN_TRANSACTION_REVIEW : import_types.PopupType.SIGN_MESSAGE_REVIEW }
2547
2566
  );
@@ -2653,7 +2672,7 @@ const _ParaCore = class _ParaCore {
2653
2672
  );
2654
2673
  let timeStart = Date.now();
2655
2674
  if (signRes.pendingTransactionId) {
2656
- this.platformUtils.openPopup(
2675
+ yield this.platformUtils.openPopup(
2657
2676
  yield this.getTransactionReviewUrl(signRes.pendingTransactionId, timeoutMs),
2658
2677
  { type: import_types.PopupType.SIGN_TRANSACTION_REVIEW }
2659
2678
  );
@@ -2729,7 +2748,8 @@ const _ParaCore = class _ParaCore {
2729
2748
  providerKey: onRampPurchase.providerKey
2730
2749
  }, walletParams));
2731
2750
  if (shouldOpenPopup) {
2732
- this.platformUtils.openPopup(portalUrl, { type: import_types.PopupType.ON_RAMP_TRANSACTION });
2751
+ const onRampWindow = yield this.platformUtils.openPopup(portalUrl, { type: import_types.PopupType.ON_RAMP_TRANSACTION });
2752
+ this.onRampPopup = { window: onRampWindow, onRampPurchase };
2733
2753
  }
2734
2754
  return { onRampPurchase, portalUrl };
2735
2755
  });
@@ -2990,9 +3010,9 @@ const _ParaCore = class _ParaCore {
2990
3010
  return sessionLookupId;
2991
3011
  });
2992
3012
  }
2993
- signUpOrLogIn(_m) {
3013
+ signUpOrLogIn(_k) {
2994
3014
  return __async(this, null, function* () {
2995
- var _n = _m, { auth } = _n, urlOptions = __objRest(_n, ["auth"]);
3015
+ var _l = _k, { auth } = _l, urlOptions = __objRest(_l, ["auth"]);
2996
3016
  const serverAuthState = yield this.ctx.client.signUpOrLogIn(__spreadValues(__spreadValues({}, auth), this.getVerificationEmailProps()));
2997
3017
  const authInfo = serverAuthState.auth;
2998
3018
  if (this.fetchPregenWalletsOverride && (0, import_user_management_client.isPregenAuth)(authInfo)) {
@@ -3004,11 +3024,11 @@ const _ParaCore = class _ParaCore {
3004
3024
  return __privateMethod(this, _ParaCore_instances, prepareAuthState_fn).call(this, serverAuthState, urlOptions);
3005
3025
  });
3006
3026
  }
3007
- verifyNewAccount(_o) {
3027
+ verifyNewAccount(_m) {
3008
3028
  return __async(this, null, function* () {
3009
- var _p = _o, {
3029
+ var _n = _m, {
3010
3030
  verificationCode
3011
- } = _p, urlOptions = __objRest(_p, [
3031
+ } = _n, urlOptions = __objRest(_n, [
3012
3032
  "verificationCode"
3013
3033
  ]);
3014
3034
  this.assertIsAuthSet(["email", "phone"]);
@@ -3102,10 +3122,10 @@ const _ParaCore = class _ParaCore {
3102
3122
  });
3103
3123
  }
3104
3124
  verifyLink() {
3105
- return __async(this, arguments, function* (_q = {}) {
3106
- var _r = _q, {
3125
+ return __async(this, arguments, function* (_o = {}) {
3126
+ var _p = _o, {
3107
3127
  accountLinkInProgress = __privateMethod(this, _ParaCore_instances, assertIsLinkingAccount_fn).call(this)
3108
- } = _r, opts = __objRest(_r, [
3128
+ } = _p, opts = __objRest(_p, [
3109
3129
  "accountLinkInProgress"
3110
3130
  ]);
3111
3131
  try {
@@ -40,7 +40,7 @@ __export(constants_exports, {
40
40
  SHORT_POLLING_INTERVAL_MS: () => SHORT_POLLING_INTERVAL_MS
41
41
  });
42
42
  module.exports = __toCommonJS(constants_exports);
43
- const PARA_CORE_VERSION = "2.0.0-alpha.33";
43
+ const PARA_CORE_VERSION = "2.0.0-alpha.35";
44
44
  const PREFIX = "@CAPSULE/";
45
45
  const LOCAL_STORAGE_AUTH_INFO = `${PREFIX}authInfo`;
46
46
  const LOCAL_STORAGE_EMAIL = `${PREFIX}e-mail`;
@@ -23,7 +23,6 @@ import {
23
23
  AuthMethod,
24
24
  PublicKeyStatus,
25
25
  PublicKeyType,
26
- extractWalletRef,
27
26
  PasswordStatus,
28
27
  extractAuthInfo,
29
28
  isEmail,
@@ -95,6 +94,7 @@ const _ParaCore = class _ParaCore {
95
94
  this.isAwaitingLogin = false;
96
95
  this.isAwaitingFarcaster = false;
97
96
  this.isAwaitingOAuth = false;
97
+ this.isWorkerInitialized = false;
98
98
  /**
99
99
  * 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.
100
100
  */
@@ -103,6 +103,7 @@ const _ParaCore = class _ParaCore {
103
103
  * Wallets associated with the `ParaCore` instance.
104
104
  */
105
105
  this.externalWallets = {};
106
+ this.onRampPopup = void 0;
106
107
  this.localStorageGetItem = (key) => {
107
108
  return this.platformUtils.localStorage.get(key);
108
109
  };
@@ -254,6 +255,16 @@ const _ParaCore = class _ParaCore {
254
255
  const _externalWallets = JSON.parse(stringExternalWallets || "{}");
255
256
  this.setExternalWallets(_externalWallets);
256
257
  };
258
+ this.initializeWorker = () => __async(this, null, function* () {
259
+ if (!this.isWorkerInitialized && !this.ctx.disableWebSockets && !this.ctx.disableWorkers) {
260
+ try {
261
+ this.isWorkerInitialized = true;
262
+ yield this.platformUtils.initializeWorker(this.ctx);
263
+ } catch (e) {
264
+ this.devLog("error initializing worker:", e);
265
+ }
266
+ }
267
+ });
257
268
  /**
258
269
  * Creates several new wallets with the desired types. If no types are provided, this method
259
270
  * will create one for each of the non-optional types specified in the instance's `supportedWalletTypes`
@@ -676,7 +687,7 @@ const _ParaCore = class _ParaCore {
676
687
  break;
677
688
  }
678
689
  case "onRamp": {
679
- path = `/web/users/${this.userId}/on-ramp-transaction/${opts.pathId}`;
690
+ path = `/web/users/${this.userId}/on-ramp-transaction/v2/${opts.pathId}`;
680
691
  break;
681
692
  }
682
693
  case "telegramLogin": {
@@ -719,7 +730,7 @@ const _ParaCore = class _ParaCore {
719
730
  }, isPhone(this.authInfo.auth) ? splitPhoneNumber(this.authInfo.auth.phone) : this.authInfo.auth), {
720
731
  pfpUrl: this.authInfo.pfpUrl,
721
732
  displayName: this.authInfo.displayName
722
- }) : {}), isOnRamp ? { sessionId } : {}), isLogin ? __spreadProps(__spreadValues({
733
+ }) : {}), isOnRamp ? { origin: typeof window !== "undefined" ? window.location.origin : void 0, email: this.email } : {}), isLogin ? __spreadProps(__spreadValues({
723
734
  sessionId: thisDevice.sessionId,
724
735
  encryptionKey: thisDevice.encryptionKey
725
736
  }, opts.newDevice ? {
@@ -738,6 +749,9 @@ const _ParaCore = class _ParaCore {
738
749
  touchSession(regenerate = false) {
739
750
  return __async(this, null, function* () {
740
751
  var _a, _b, _c;
752
+ if (!this.isWorkerInitialized) {
753
+ this.initializeWorker();
754
+ }
741
755
  if (!this.isReady) {
742
756
  yield this.ready();
743
757
  }
@@ -1736,9 +1750,6 @@ const _ParaCore = class _ParaCore {
1736
1750
  return __privateMethod(this, _ParaCore_instances, getOAuthUrl_fn).call(this, __spreadProps(__spreadValues({}, opts), { sessionLookupId }));
1737
1751
  });
1738
1752
  }
1739
- getOAuthUrlSync(opts) {
1740
- return __privateMethod(this, _ParaCore_instances, getOAuthUrl_fn).call(this, opts);
1741
- }
1742
1753
  /**
1743
1754
  * Awaits the response from a user's attempt to log in with OAuth.
1744
1755
  * If successful, this returns the user's email address and indicates whether the user already exists.
@@ -1756,6 +1767,7 @@ const _ParaCore = class _ParaCore {
1756
1767
  onCancel,
1757
1768
  onPoll,
1758
1769
  onOAuthUrl,
1770
+ onOAuthPopup,
1759
1771
  isLinkAccount
1760
1772
  } = _j, urlOptions = __objRest(_j, [
1761
1773
  "method",
@@ -1764,10 +1776,19 @@ const _ParaCore = class _ParaCore {
1764
1776
  "onCancel",
1765
1777
  "onPoll",
1766
1778
  "onOAuthUrl",
1779
+ "onOAuthPopup",
1767
1780
  "isLinkAccount"
1768
1781
  ]);
1782
+ let popupWindow;
1783
+ if (onOAuthPopup) {
1784
+ try {
1785
+ popupWindow = yield this.platformUtils.openPopup("about:blank", { type: PopupType.OAUTH });
1786
+ } catch (error) {
1787
+ throw new Error(`Failed to open OAuth popup: ${error}`);
1788
+ }
1789
+ }
1769
1790
  let sessionLookupId, accountLinkInProgress;
1770
- if (onOAuthUrl) {
1791
+ if (onOAuthUrl || onOAuthPopup) {
1771
1792
  if (isLinkAccount) {
1772
1793
  accountLinkInProgress = yield __privateMethod(this, _ParaCore_instances, assertIsLinkingAccountOrStart_fn).call(this, method);
1773
1794
  sessionLookupId = (yield this.touchSession()).sessionLookupId;
@@ -1775,7 +1796,17 @@ const _ParaCore = class _ParaCore {
1775
1796
  sessionLookupId = yield this.prepareLogin();
1776
1797
  }
1777
1798
  const oAuthUrl = yield __privateMethod(this, _ParaCore_instances, getOAuthUrl_fn).call(this, { method, appScheme, sessionLookupId, accountLinkInProgress });
1778
- onOAuthUrl(oAuthUrl);
1799
+ switch (true) {
1800
+ case !!onOAuthUrl: {
1801
+ onOAuthUrl(oAuthUrl);
1802
+ break;
1803
+ }
1804
+ case (!!onOAuthPopup && !!popupWindow): {
1805
+ popupWindow.location.href = oAuthUrl;
1806
+ onOAuthPopup(popupWindow);
1807
+ break;
1808
+ }
1809
+ }
1779
1810
  } else {
1780
1811
  ({ sessionLookupId } = yield this.touchSession());
1781
1812
  }
@@ -1911,7 +1942,7 @@ const _ParaCore = class _ParaCore {
1911
1942
  sessionId
1912
1943
  });
1913
1944
  if (shouldOpenPopup) {
1914
- this.platformUtils.openPopup(link);
1945
+ yield this.platformUtils.openPopup(link);
1915
1946
  }
1916
1947
  return link;
1917
1948
  });
@@ -2455,25 +2486,12 @@ const _ParaCore = class _ParaCore {
2455
2486
  });
2456
2487
  });
2457
2488
  }
2458
- getOnRampTransactionUrl(_k) {
2459
- return __async(this, null, function* () {
2460
- var _l = _k, {
2461
- purchaseId,
2462
- providerKey
2463
- } = _l, walletParams = __objRest(_l, [
2464
- "purchaseId",
2465
- "providerKey"
2466
- ]);
2467
- const { sessionId } = yield this.touchSession();
2468
- const [key, identifier] = extractWalletRef(walletParams);
2489
+ getOnRampTransactionUrl(_0) {
2490
+ return __async(this, arguments, function* ({
2491
+ purchaseId
2492
+ }) {
2469
2493
  return this.constructPortalUrl("onRamp", {
2470
- pathId: purchaseId,
2471
- sessionId,
2472
- params: {
2473
- [key]: identifier,
2474
- providerKey,
2475
- currentWalletIds: JSON.stringify(this.currentWalletIds)
2476
- }
2494
+ pathId: purchaseId
2477
2495
  });
2478
2496
  });
2479
2497
  }
@@ -2507,7 +2525,7 @@ const _ParaCore = class _ParaCore {
2507
2525
  let signRes = yield this.signMessageInner({ wallet, signerId, messageBase64, cosmosSignDocBase64 });
2508
2526
  let timeStart = Date.now();
2509
2527
  if (signRes.pendingTransactionId) {
2510
- this.platformUtils.openPopup(
2528
+ yield this.platformUtils.openPopup(
2511
2529
  yield this.getTransactionReviewUrl(signRes.pendingTransactionId, timeoutMs),
2512
2530
  { type: cosmosSignDocBase64 ? PopupType.SIGN_TRANSACTION_REVIEW : PopupType.SIGN_MESSAGE_REVIEW }
2513
2531
  );
@@ -2619,7 +2637,7 @@ const _ParaCore = class _ParaCore {
2619
2637
  );
2620
2638
  let timeStart = Date.now();
2621
2639
  if (signRes.pendingTransactionId) {
2622
- this.platformUtils.openPopup(
2640
+ yield this.platformUtils.openPopup(
2623
2641
  yield this.getTransactionReviewUrl(signRes.pendingTransactionId, timeoutMs),
2624
2642
  { type: PopupType.SIGN_TRANSACTION_REVIEW }
2625
2643
  );
@@ -2695,7 +2713,8 @@ const _ParaCore = class _ParaCore {
2695
2713
  providerKey: onRampPurchase.providerKey
2696
2714
  }, walletParams));
2697
2715
  if (shouldOpenPopup) {
2698
- this.platformUtils.openPopup(portalUrl, { type: PopupType.ON_RAMP_TRANSACTION });
2716
+ const onRampWindow = yield this.platformUtils.openPopup(portalUrl, { type: PopupType.ON_RAMP_TRANSACTION });
2717
+ this.onRampPopup = { window: onRampWindow, onRampPurchase };
2699
2718
  }
2700
2719
  return { onRampPurchase, portalUrl };
2701
2720
  });
@@ -2956,9 +2975,9 @@ const _ParaCore = class _ParaCore {
2956
2975
  return sessionLookupId;
2957
2976
  });
2958
2977
  }
2959
- signUpOrLogIn(_m) {
2978
+ signUpOrLogIn(_k) {
2960
2979
  return __async(this, null, function* () {
2961
- var _n = _m, { auth } = _n, urlOptions = __objRest(_n, ["auth"]);
2980
+ var _l = _k, { auth } = _l, urlOptions = __objRest(_l, ["auth"]);
2962
2981
  const serverAuthState = yield this.ctx.client.signUpOrLogIn(__spreadValues(__spreadValues({}, auth), this.getVerificationEmailProps()));
2963
2982
  const authInfo = serverAuthState.auth;
2964
2983
  if (this.fetchPregenWalletsOverride && isPregenAuth(authInfo)) {
@@ -2970,11 +2989,11 @@ const _ParaCore = class _ParaCore {
2970
2989
  return __privateMethod(this, _ParaCore_instances, prepareAuthState_fn).call(this, serverAuthState, urlOptions);
2971
2990
  });
2972
2991
  }
2973
- verifyNewAccount(_o) {
2992
+ verifyNewAccount(_m) {
2974
2993
  return __async(this, null, function* () {
2975
- var _p = _o, {
2994
+ var _n = _m, {
2976
2995
  verificationCode
2977
- } = _p, urlOptions = __objRest(_p, [
2996
+ } = _n, urlOptions = __objRest(_n, [
2978
2997
  "verificationCode"
2979
2998
  ]);
2980
2999
  this.assertIsAuthSet(["email", "phone"]);
@@ -3068,10 +3087,10 @@ const _ParaCore = class _ParaCore {
3068
3087
  });
3069
3088
  }
3070
3089
  verifyLink() {
3071
- return __async(this, arguments, function* (_q = {}) {
3072
- var _r = _q, {
3090
+ return __async(this, arguments, function* (_o = {}) {
3091
+ var _p = _o, {
3073
3092
  accountLinkInProgress = __privateMethod(this, _ParaCore_instances, assertIsLinkingAccount_fn).call(this)
3074
- } = _r, opts = __objRest(_r, [
3093
+ } = _p, opts = __objRest(_p, [
3075
3094
  "accountLinkInProgress"
3076
3095
  ]);
3077
3096
  try {
@@ -1,5 +1,5 @@
1
1
  import "./chunk-7B52C2XE.js";
2
- const PARA_CORE_VERSION = "2.0.0-alpha.33";
2
+ const PARA_CORE_VERSION = "2.0.0-alpha.35";
3
3
  const PREFIX = "@CAPSULE/";
4
4
  const LOCAL_STORAGE_AUTH_INFO = `${PREFIX}authInfo`;
5
5
  const LOCAL_STORAGE_EMAIL = `${PREFIX}e-mail`;
@@ -1,4 +1,4 @@
1
- import { AuthMethod, AuthExtras, CurrentWalletIds, EmailTheme, TWalletType, PregenIds, BiometricLocationHint, Auth, SupportedWalletTypes, AuthIdentifier, AuthType, ExternalWalletInfo, PrimaryAuthInfo, SessionInfo, PrimaryAuth, PrimaryAuthType, AccountMetadata, LinkedAccounts, VerifyLinkParams, VerifyExternalWalletParams, SupportedAccountLinks } from '@getpara/user-management-client';
1
+ import { AuthMethod, AuthExtras, CurrentWalletIds, EmailTheme, TWalletType, PregenIds, BiometricLocationHint, Auth, SupportedWalletTypes, AuthIdentifier, AuthType, ExternalWalletInfo, PrimaryAuthInfo, SessionInfo, PrimaryAuth, PrimaryAuthType, AccountMetadata, LinkedAccounts, VerifyLinkParams, VerifyExternalWalletParams, SupportedAccountLinks, OnRampPurchase } from '@getpara/user-management-client';
2
2
  import type { pki as pkiType } from 'node-forge';
3
3
  import { Ctx, Environment, Theme, WalletFilters, Wallet, PortalUrlOptions, ConstructorOpts, CoreAuthInfo, PortalUrlType, CoreMethodParams, CoreMethodResponse, NewCredentialUrlParams, LoginUrlParams, CoreInterface, ExternalWalletConnectionType, AccountLinkInProgress, InternalMethodParams, InternalMethodResponse } from './types/index.js';
4
4
  import { PlatformUtils } from './PlatformUtils.js';
@@ -23,6 +23,7 @@ export declare abstract class ParaCore implements CoreInterface {
23
23
  private isAwaitingLogin;
24
24
  private isAwaitingFarcaster;
25
25
  private isAwaitingOAuth;
26
+ private isWorkerInitialized;
26
27
  get isEmail(): boolean;
27
28
  get isPhone(): boolean;
28
29
  get isFarcaster(): boolean;
@@ -129,7 +130,11 @@ export declare abstract class ParaCore implements CoreInterface {
129
130
  get cosmosPrefix(): string | undefined;
130
131
  get supportedAccountLinks(): SupportedAccountLinks;
131
132
  get isWalletTypeEnabled(): Partial<Record<TWalletType, boolean>>;
132
- private platformUtils;
133
+ protected onRampPopup: {
134
+ window: Window;
135
+ onRampPurchase: OnRampPurchase;
136
+ } | undefined;
137
+ protected platformUtils: PlatformUtils;
133
138
  private localStorageGetItem;
134
139
  private localStorageSetItem;
135
140
  private localStorageRemoveItem;
@@ -145,7 +150,7 @@ export declare abstract class ParaCore implements CoreInterface {
145
150
  clearStorage: (type?: CoreMethodParams<"clearStorage">) => CoreMethodResponse<"clearStorage">;
146
151
  private convertBigInt;
147
152
  private convertEncryptionKeyPair;
148
- private isPortal;
153
+ protected isPortal(envOverride?: Environment): boolean;
149
154
  private isParaConnect;
150
155
  private requireApiKey;
151
156
  private isWalletSupported;
@@ -197,6 +202,7 @@ export declare abstract class ParaCore implements CoreInterface {
197
202
  private updateSessionCookieFromStorage;
198
203
  private updateLoginEncryptionKeyPairFromStorage;
199
204
  private updateExternalWalletsFromStorage;
205
+ protected initializeWorker: () => Promise<void>;
200
206
  touchSession(regenerate?: boolean): Promise<SessionInfo>;
201
207
  private getVerificationEmailProps;
202
208
  private getBackupKitEmailProps;
@@ -429,9 +435,6 @@ export declare abstract class ParaCore implements CoreInterface {
429
435
  verifyFarcaster(opts: CoreMethodParams<'verifyFarcaster'>): CoreMethodResponse<'verifyFarcaster'>;
430
436
  protected verifyFarcasterLink(opts: InternalMethodParams<'verifyFarcasterLink'>): InternalMethodResponse<'verifyFarcasterLink'>;
431
437
  getOAuthUrl(opts: CoreMethodParams<'getOAuthUrl'>): CoreMethodResponse<'getOAuthUrl'>;
432
- getOAuthUrlSync(opts: Omit<CoreMethodParams<'getOAuthUrl'>, 'sessionLookupId'> & {
433
- sessionLookupId: string;
434
- }): Awaited<CoreMethodResponse<'getOAuthUrl'>>;
435
438
  protected verifyOAuthProcess(_: InternalMethodParams<'verifyOAuthLink'> & {
436
439
  isLinkAccount: true;
437
440
  }): InternalMethodResponse<'verifyOAuthLink'>;
@@ -42,5 +42,6 @@ export interface PlatformUtils {
42
42
  disableProviderModal?: boolean;
43
43
  openPopup(popupUrl: string, opts?: {
44
44
  type: PopupType;
45
- }): Window;
45
+ }): Promise<Window>;
46
+ initializeWorker(ctx: Ctx): Promise<void>;
46
47
  }
@@ -110,8 +110,17 @@ export type OAuthParams = OAuthUrlParams & PollParams & {
110
110
  /**
111
111
  * A callback function that will be invoked with the OAuth URL when it is available.
112
112
  * For example, you can use this to open the URL in a new window or tab.
113
+ *
114
+ * You should pass one of `onOAuthUrl` or `onOAuthPopup`, not both.
113
115
  */
114
116
  onOAuthUrl?: (url: string) => void;
117
+ /**
118
+ * A callback function that will be invoked with the OAuth popup window when it is available.
119
+ * If supplied, a window will automatically be opened for you if running on an applicable platform.
120
+ *
121
+ * You should pass one of `onOAuthUrl` or `onOAuthPopup`, not both.
122
+ */
123
+ onOAuthPopup?: (popup: Window) => void;
115
124
  };
116
125
  export type AuthStateBaseParams = WithCustomTheme & WithUseShortUrls;
117
126
  export type AuthStateVerify = ServerAuthStateVerify;
@@ -1,4 +1,4 @@
1
- import { EmbeddedWalletType, ExternalWalletType, PartnerEntity, TExternalWallet, TPregenIdentifierType, TWalletScheme } from '@getpara/user-management-client';
1
+ import { EmbeddedWalletType, ExternalWalletType, PartnerEntity, TPregenIdentifierType, TWalletScheme } from '@getpara/user-management-client';
2
2
  export interface Wallet {
3
3
  createdAt?: string;
4
4
  id: string;
@@ -20,7 +20,7 @@ export interface Wallet {
20
20
  lastUsedPartnerId?: string;
21
21
  isExternal?: boolean;
22
22
  isExternalWithParaAuth?: boolean;
23
- externalProviderId?: TExternalWallet;
23
+ externalProviderId?: string;
24
24
  isExternalWithVerification?: boolean;
25
25
  isExternalConnectionOnly?: boolean;
26
26
  ensName?: string | null;
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@getpara/core-sdk",
3
- "version": "2.0.0-alpha.33",
3
+ "version": "2.0.0-alpha.35",
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.33",
8
+ "@getpara/user-management-client": "2.0.0-alpha.35",
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": "f338306fa30497d2190f8da2ff72ddd8d9d9032f",
30
+ "gitHead": "abfec8cf9931f7a8469b09b67b5d48eee6f4cfd5",
31
31
  "main": "dist/cjs/index.js",
32
32
  "module": "dist/esm/index.js",
33
33
  "scripts": {