@getpara/core-sdk 3.5.1 → 3.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.
Files changed (69) hide show
  1. package/dist/cjs/ParaCore.js +11 -4
  2. package/dist/cjs/constants.js +1 -1
  3. package/dist/cjs/cryptography/utils.js +2 -2
  4. package/dist/cjs/external/localDevUrlOverrides.js +50 -0
  5. package/dist/cjs/external/userManagementClient.js +11 -21
  6. package/dist/cjs/index.js +15 -15
  7. package/dist/cjs/services/PortalUrlService.js +1 -1
  8. package/dist/cjs/state/actors/authenticateWithEmailOrPhone.js +1 -1
  9. package/dist/cjs/state/actors/authenticateWithExternalWallet.js +1 -1
  10. package/dist/cjs/state/actors/authenticateWithFarcaster.js +1 -1
  11. package/dist/cjs/state/actors/authenticateWithFarcasterLegacy.js +1 -1
  12. package/dist/cjs/state/actors/authenticateWithTelegram.js +1 -1
  13. package/dist/cjs/state/actors/authenticateWithTelegramLegacy.js +1 -1
  14. package/dist/cjs/state/actors/checkUserState.js +1 -1
  15. package/dist/cjs/state/actors/claimWallets.js +1 -1
  16. package/dist/cjs/state/actors/connectExternalConnectors.js +1 -1
  17. package/dist/cjs/state/actors/connectExternalWallet.js +1 -1
  18. package/dist/cjs/state/actors/createGuestWallets.js +1 -1
  19. package/dist/cjs/state/actors/createWallets.js +1 -1
  20. package/dist/cjs/state/actors/processAuthentication.js +1 -1
  21. package/dist/cjs/state/actors/setupAfterLogin.js +1 -1
  22. package/dist/cjs/state/actors/setupPara.js +1 -1
  23. package/dist/cjs/state/actors/signExternalWalletVerification.js +1 -1
  24. package/dist/cjs/state/actors/switchExternalWallet.js +1 -1
  25. package/dist/cjs/state/actors/verifyExternalWallet.js +1 -1
  26. package/dist/cjs/state/actors/verifyNewAccount.js +1 -1
  27. package/dist/cjs/state/actors/waitForExternalWalletProviders.js +1 -1
  28. package/dist/cjs/state/machines/authStateMachine.js +7 -7
  29. package/dist/cjs/state/machines/coreStateMachine.js +1 -1
  30. package/dist/cjs/state/machines/walletStateMachine.js +1 -1
  31. package/dist/cjs/telemetry/tracer.js +1 -1
  32. package/dist/cjs/utils/url.js +5 -2
  33. package/dist/esm/ParaCore.js +11 -4
  34. package/dist/esm/constants.js +1 -1
  35. package/dist/esm/cryptography/utils.js +2 -2
  36. package/dist/esm/external/localDevUrlOverrides.js +27 -0
  37. package/dist/esm/external/userManagementClient.js +11 -21
  38. package/dist/esm/index.js +2 -2
  39. package/dist/esm/services/PortalUrlService.js +1 -1
  40. package/dist/esm/state/actors/authenticateWithEmailOrPhone.js +1 -1
  41. package/dist/esm/state/actors/authenticateWithExternalWallet.js +1 -1
  42. package/dist/esm/state/actors/authenticateWithFarcaster.js +1 -1
  43. package/dist/esm/state/actors/authenticateWithFarcasterLegacy.js +1 -1
  44. package/dist/esm/state/actors/authenticateWithTelegram.js +1 -1
  45. package/dist/esm/state/actors/authenticateWithTelegramLegacy.js +1 -1
  46. package/dist/esm/state/actors/checkUserState.js +1 -1
  47. package/dist/esm/state/actors/claimWallets.js +1 -1
  48. package/dist/esm/state/actors/connectExternalConnectors.js +1 -1
  49. package/dist/esm/state/actors/connectExternalWallet.js +1 -1
  50. package/dist/esm/state/actors/createGuestWallets.js +1 -1
  51. package/dist/esm/state/actors/createWallets.js +1 -1
  52. package/dist/esm/state/actors/processAuthentication.js +1 -1
  53. package/dist/esm/state/actors/setupAfterLogin.js +1 -1
  54. package/dist/esm/state/actors/setupPara.js +1 -1
  55. package/dist/esm/state/actors/signExternalWalletVerification.js +1 -1
  56. package/dist/esm/state/actors/switchExternalWallet.js +1 -1
  57. package/dist/esm/state/actors/verifyExternalWallet.js +1 -1
  58. package/dist/esm/state/actors/verifyNewAccount.js +1 -1
  59. package/dist/esm/state/actors/waitForExternalWalletProviders.js +1 -1
  60. package/dist/esm/state/machines/authStateMachine.js +7 -7
  61. package/dist/esm/state/machines/coreStateMachine.js +1 -1
  62. package/dist/esm/state/machines/walletStateMachine.js +1 -1
  63. package/dist/esm/telemetry/tracer.js +1 -1
  64. package/dist/esm/utils/url.js +4 -2
  65. package/dist/types/external/localDevUrlOverrides.d.ts +4 -0
  66. package/dist/types/external/userManagementClient.d.ts +5 -4
  67. package/dist/types/types/config.d.ts +2 -0
  68. package/dist/types/utils/url.d.ts +1 -0
  69. package/package.json +4 -4
@@ -30,7 +30,9 @@ import forge from "node-forge";
30
30
  const { pki, jsbn } = forge;
31
31
  import { decryptWithPrivateKey, getAsymmetricKeyPair } from "./cryptography/utils.js";
32
32
  import { getBaseUrl, initClient, normalizePlatform } from "./external/userManagementClient.js";
33
+ import { getDevApiBaseUrlOverride, getDevMPCNetworkUrlOverride } from "./external/localDevUrlOverrides.js";
33
34
  import * as mpcComputationClient from "./external/mpcComputationClient.js";
35
+ import { getGlobalPortalUrlOverride } from "./utils/url.js";
34
36
  import {
35
37
  Environment,
36
38
  PopupType,
@@ -226,7 +228,7 @@ const _ParaCore = class _ParaCore {
226
228
  const uxTargetId = typeof entry === "string" ? void 0 : entry.uxTargetId;
227
229
  const original = this[methodName];
228
230
  if (typeof original === "function") {
229
- this[methodName] = (...args) => {
231
+ this[methodName] = ((...args) => {
230
232
  var _a;
231
233
  const attrs = __spreadValues(__spreadProps(__spreadValues({
232
234
  "para.platform": this.platformUtils.sdkType
@@ -249,7 +251,7 @@ const _ParaCore = class _ParaCore {
249
251
  }),
250
252
  attrs
251
253
  ).catch((err) => this.trackError(methodName, err));
252
- };
254
+ });
253
255
  }
254
256
  }
255
257
  };
@@ -482,6 +484,7 @@ const _ParaCore = class _ParaCore {
482
484
  const rawPlatform = (_a = opts.hostPlatform) != null ? _a : this.platformUtils.sdkType;
483
485
  this.clientType = normalizePlatform(rawPlatform);
484
486
  const requestAgents = (_c = (_b = this.platformUtils).getRequestAgents) == null ? void 0 : _c.call(_b);
487
+ const apiBaseUrlOverride = getDevApiBaseUrlOverride();
485
488
  const client = initClient({
486
489
  env,
487
490
  version: _ParaCore.version,
@@ -494,7 +497,8 @@ const _ParaCore = class _ParaCore {
494
497
  retrieveSessionCookie: this.retrieveSessionCookie,
495
498
  persistSessionCookie: this.persistSessionCookie,
496
499
  httpAgent: requestAgents == null ? void 0 : requestAgents.httpAgent,
497
- httpsAgent: requestAgents == null ? void 0 : requestAgents.httpsAgent
500
+ httpsAgent: requestAgents == null ? void 0 : requestAgents.httpsAgent,
501
+ apiBaseUrlOverride
498
502
  });
499
503
  const enclaveClient = new EnclaveClient({
500
504
  userManagementClient: client,
@@ -508,6 +512,9 @@ const _ParaCore = class _ParaCore {
508
512
  apiKey,
509
513
  client,
510
514
  enclaveClient,
515
+ apiBaseUrlOverride,
516
+ portalUrlOverride: getGlobalPortalUrlOverride(),
517
+ mpcNetworkUrlOverride: getDevMPCNetworkUrlOverride(),
511
518
  disableWorkers: opts.disableWorkers,
512
519
  offloadMPCComputationURL: opts.offloadMPCComputationURL,
513
520
  useLocalFiles: opts.useLocalFiles,
@@ -1540,7 +1547,7 @@ const _ParaCore = class _ParaCore {
1540
1547
  const telemetry = res.data.partner.telemetry;
1541
1548
  if ((telemetry == null ? void 0 : telemetry.enabled) && this.ctx.env) {
1542
1549
  void initTelemetry({
1543
- tunnelUrl: `${getBaseUrl(this.ctx.env)}telemetry`,
1550
+ tunnelUrl: `${getBaseUrl(this.ctx.env, "http", this.ctx.apiBaseUrlOverride)}telemetry`,
1544
1551
  sampleRate: telemetry.sample_rate,
1545
1552
  sdkType: this.platformUtils.sdkType,
1546
1553
  clientType: this.clientType,
@@ -1,5 +1,5 @@
1
1
  import "./chunk-7B52C2XE.js";
2
- const PARA_CORE_VERSION = "3.5.1";
2
+ const PARA_CORE_VERSION = "3.6.0";
3
3
  const PREFIX = "@CAPSULE/";
4
4
  const PARA_PREFIX = "@PARA/";
5
5
  const LOCAL_STORAGE_AUTH_INFO = `${PREFIX}authInfo`;
@@ -94,7 +94,7 @@ function getAsymmetricKeyPair(ctx, seedValue) {
94
94
  if (!ctx.disableWorkers) {
95
95
  options.workLoad = 100;
96
96
  options.workers = seedValue ? 1 : -1;
97
- const workerBlob = yield wrapWithSpan("worker.load_prime", () => __async(this, null, function* () {
97
+ const workerBlob = yield wrapWithSpan("worker.load_prime", () => __async(null, null, function* () {
98
98
  const workerRes = yield fetch(`${getPortalBaseURL(ctx)}/static/js/prime.worker.min.js`);
99
99
  return new Blob([yield workerRes.text()], { type: "application/javascript" });
100
100
  }));
@@ -156,7 +156,7 @@ function decryptWithDerivedPrivateKey(_0, _1) {
156
156
  function getDerivedPrivateKeyAndDecrypt(ctx, seedValue, encryptedShares) {
157
157
  return __async(this, null, function* () {
158
158
  return Promise.all(
159
- encryptedShares.map((share) => __async(this, null, function* () {
159
+ encryptedShares.map((share) => __async(null, null, function* () {
160
160
  return {
161
161
  walletId: share.walletId,
162
162
  walletScheme: share.walletScheme,
@@ -0,0 +1,27 @@
1
+ import "../chunk-7B52C2XE.js";
2
+ function getLocalDevUrlOverride(explicitOverride, globalKey, envKey) {
3
+ var _a;
4
+ const override = (_a = explicitOverride != null ? explicitOverride : typeof globalThis !== "undefined" ? globalThis[globalKey] : void 0) != null ? _a : typeof process !== "undefined" ? process.env[envKey] : void 0;
5
+ return typeof override === "string" && override ? override : void 0;
6
+ }
7
+ function normalizeDevUrlOverride(override, scheme) {
8
+ const url = new URL(override);
9
+ url.protocol = `${scheme}${url.protocol.endsWith("s:") ? "s" : ""}:`;
10
+ return url.href;
11
+ }
12
+ function getDevApiBaseUrlOverride(apiBaseUrlOverride, scheme = "http") {
13
+ const override = getLocalDevUrlOverride(apiBaseUrlOverride, "__PARA_API_BASE_URL_OVERRIDE__", "PARA_API_BASE_URL");
14
+ return override ? normalizeDevUrlOverride(override, scheme) : void 0;
15
+ }
16
+ function getDevMPCNetworkUrlOverride(mpcNetworkUrlOverride, useWebsocket) {
17
+ const override = getLocalDevUrlOverride(
18
+ mpcNetworkUrlOverride,
19
+ "__PARA_MPC_NETWORK_URL_OVERRIDE__",
20
+ "PARA_MPC_NETWORK_URL"
21
+ );
22
+ return override ? normalizeDevUrlOverride(override, useWebsocket ? "ws" : "http").replace(/\/+$/, "") : void 0;
23
+ }
24
+ export {
25
+ getDevApiBaseUrlOverride,
26
+ getDevMPCNetworkUrlOverride
27
+ };
@@ -1,24 +1,12 @@
1
1
  import "../chunk-7B52C2XE.js";
2
2
  import Client from "@getpara/user-management-client";
3
3
  import { Environment } from "../types/index.js";
4
- function getDevApiBaseUrlOverride(scheme = "http") {
5
- const override = typeof globalThis !== "undefined" ? globalThis.__PARA_API_BASE_URL_OVERRIDE__ : void 0;
6
- if (!override || typeof override !== "string") {
7
- return void 0;
8
- }
9
- const url = new URL(override);
10
- if (scheme === "ws") {
11
- url.protocol = url.protocol === "https:" || url.protocol === "wss:" ? "wss:" : "ws:";
12
- } else {
13
- url.protocol = url.protocol === "wss:" || url.protocol === "https:" ? "https:" : "http:";
14
- }
15
- return url.toString();
16
- }
17
- function getBaseOAuthUrl(env) {
4
+ import { getDevApiBaseUrlOverride, getDevMPCNetworkUrlOverride } from "./localDevUrlOverrides.js";
5
+ function getBaseOAuthUrl(env, apiBaseUrlOverride) {
18
6
  var _a;
19
7
  switch (env) {
20
8
  case Environment.DEV:
21
- return (_a = getDevApiBaseUrlOverride()) != null ? _a : "http://localhost:8080/";
9
+ return (_a = getDevApiBaseUrlOverride(apiBaseUrlOverride)) != null ? _a : "http://localhost:8080/";
22
10
  case Environment.SANDBOX:
23
11
  return "https://api.sandbox.usecapsule.com/";
24
12
  case Environment.BETA:
@@ -29,11 +17,11 @@ function getBaseOAuthUrl(env) {
29
17
  throw new Error(`unsupported env: ${env}`);
30
18
  }
31
19
  }
32
- function getBaseUrl(env, scheme = "http") {
20
+ function getBaseUrl(env, scheme = "http", apiBaseUrlOverride) {
33
21
  var _a;
34
22
  switch (env) {
35
23
  case Environment.DEV:
36
- return (_a = getDevApiBaseUrlOverride(scheme)) != null ? _a : `${scheme}://localhost:8080/`;
24
+ return (_a = getDevApiBaseUrlOverride(apiBaseUrlOverride, scheme)) != null ? _a : `${scheme}://localhost:8080/`;
37
25
  case Environment.SANDBOX:
38
26
  return `${scheme}s://api.sandbox.getpara.com/`;
39
27
  case Environment.BETA:
@@ -44,11 +32,12 @@ function getBaseUrl(env, scheme = "http") {
44
32
  throw new Error(`unsupported env: ${env}`);
45
33
  }
46
34
  }
47
- function getBaseMPCNetworkUrl(env, useWebsocket) {
35
+ function getBaseMPCNetworkUrl(env, useWebsocket, mpcNetworkUrlOverride) {
36
+ var _a;
48
37
  const prefix = useWebsocket ? "ws" : "http";
49
38
  switch (env) {
50
39
  case Environment.DEV:
51
- return `${prefix}://localhost:3000`;
40
+ return (_a = getDevMPCNetworkUrlOverride(mpcNetworkUrlOverride, useWebsocket)) != null ? _a : `${prefix}://localhost:3000`;
52
41
  case Environment.SANDBOX:
53
42
  return `${prefix}s://mpc-network.sandbox.getpara.com`;
54
43
  case Environment.BETA:
@@ -91,10 +80,11 @@ function initClient({
91
80
  persistSessionCookie,
92
81
  staticTraceContext,
93
82
  httpAgent,
94
- httpsAgent
83
+ httpsAgent,
84
+ apiBaseUrlOverride
95
85
  }) {
96
86
  return new Client({
97
- userManagementHost: getBaseUrl(env),
87
+ userManagementHost: getBaseUrl(env, "http", apiBaseUrlOverride),
98
88
  version: [Environment.DEV, Environment.SANDBOX].includes(env) ? "dev" : version,
99
89
  apiKey,
100
90
  partnerId,
package/dist/esm/index.js CHANGED
@@ -111,7 +111,7 @@ import { setCurrentUserId } from "./telemetry/uxStateSpanProcessor.js";
111
111
  import { recordActionOnSpan } from "./telemetry/uxAction.js";
112
112
  import { startModalSession, endModalSession, getModalSessionContext } from "./telemetry/modalSession.js";
113
113
  const paraVersion = ParaCore.version;
114
- var src_default = ParaCore;
114
+ var index_default = ParaCore;
115
115
  export {
116
116
  AccountLinkError,
117
117
  AuthLayout,
@@ -155,7 +155,7 @@ export {
155
155
  decryptPrivateKeyWithPassword,
156
156
  decryptWithKeyPair,
157
157
  decryptWithPrivateKey,
158
- src_default as default,
158
+ index_default as default,
159
159
  dispatchEvent,
160
160
  distributeNewShare,
161
161
  encodeConfigParams,
@@ -396,7 +396,7 @@ class PortalUrlService {
396
396
  })).then((r) => r.url) : Promise.resolve(false)
397
397
  ]);
398
398
  return constructUrl({
399
- base: getBaseOAuthUrl(__privateGet(this, _paraCoreInterface).ctx.env),
399
+ base: getBaseOAuthUrl(__privateGet(this, _paraCoreInterface).ctx.env, __privateGet(this, _paraCoreInterface).ctx.apiBaseUrlOverride),
400
400
  path: `/auth/${method.toLowerCase()}`,
401
401
  params: __spreadValues(__spreadValues({
402
402
  apiKey: __privateGet(this, _paraCoreInterface).ctx.apiKey,
@@ -2,7 +2,7 @@ import {
2
2
  __async
3
3
  } from "../../chunk-7B52C2XE.js";
4
4
  import { fromPromise } from "xstate";
5
- const createAuthenticateWithEmailOrPhoneActor = (authService) => fromPromise((params) => __async(void 0, null, function* () {
5
+ const createAuthenticateWithEmailOrPhoneActor = (authService) => fromPromise((params) => __async(null, null, function* () {
6
6
  return yield authService.performSignUpOrLogIn(params.input);
7
7
  }));
8
8
  export {
@@ -2,7 +2,7 @@ import {
2
2
  __async
3
3
  } from "../../chunk-7B52C2XE.js";
4
4
  import { fromPromise } from "xstate";
5
- const createAuthenticateWithExternalWalletActor = (authService) => fromPromise((params) => __async(void 0, null, function* () {
5
+ const createAuthenticateWithExternalWalletActor = (authService) => fromPromise((params) => __async(null, null, function* () {
6
6
  return yield authService.performLoginExternalWallet(params.input);
7
7
  }));
8
8
  export {
@@ -2,7 +2,7 @@ import {
2
2
  __async
3
3
  } from "../../chunk-7B52C2XE.js";
4
4
  import { fromPromise } from "xstate";
5
- const createAuthenticateWithFarcasterActor = (pollingService) => fromPromise((params) => __async(void 0, null, function* () {
5
+ const createAuthenticateWithFarcasterActor = (pollingService) => fromPromise((params) => __async(null, null, function* () {
6
6
  return yield pollingService.waitForFarcasterEvent(params.input);
7
7
  }));
8
8
  export {
@@ -2,7 +2,7 @@ import {
2
2
  __async
3
3
  } from "../../chunk-7B52C2XE.js";
4
4
  import { fromPromise } from "xstate";
5
- const createAuthenticateWithFarcasterLegacyActor = (authService) => fromPromise((params) => __async(void 0, null, function* () {
5
+ const createAuthenticateWithFarcasterLegacyActor = (authService) => fromPromise((params) => __async(null, null, function* () {
6
6
  return yield authService.performVerifyFarcaster(params.input);
7
7
  }));
8
8
  export {
@@ -2,7 +2,7 @@ import {
2
2
  __async
3
3
  } from "../../chunk-7B52C2XE.js";
4
4
  import { fromPromise } from "xstate";
5
- const createAuthenticateWithTelegramActor = (pollingService) => fromPromise((params) => __async(void 0, null, function* () {
5
+ const createAuthenticateWithTelegramActor = (pollingService) => fromPromise((params) => __async(null, null, function* () {
6
6
  return yield pollingService.waitForTelegramEvent(params.input);
7
7
  }));
8
8
  export {
@@ -2,7 +2,7 @@ import {
2
2
  __async
3
3
  } from "../../chunk-7B52C2XE.js";
4
4
  import { fromPromise } from "xstate";
5
- const createAuthenticateWithTelegramLegacyActor = (authService) => fromPromise((params) => __async(void 0, null, function* () {
5
+ const createAuthenticateWithTelegramLegacyActor = (authService) => fromPromise((params) => __async(null, null, function* () {
6
6
  return yield authService.performVerifyTelegram(params.input);
7
7
  }));
8
8
  export {
@@ -2,7 +2,7 @@ import {
2
2
  __async
3
3
  } from "../../chunk-7B52C2XE.js";
4
4
  import { fromPromise } from "xstate";
5
- const createCheckUserStateActor = (paraCoreInterface) => fromPromise(() => __async(void 0, null, function* () {
5
+ const createCheckUserStateActor = (paraCoreInterface) => fromPromise(() => __async(null, null, function* () {
6
6
  const isAuthenticated = yield paraCoreInterface.sessionManagementService.isSessionActive();
7
7
  const isFullyLoggedIn = yield paraCoreInterface.sessionManagementService.isFullyLoggedIn();
8
8
  const isGuestMode = paraCoreInterface.pregenWalletService.isGuestMode;
@@ -4,7 +4,7 @@ import {
4
4
  import { fromPromise } from "xstate";
5
5
  import { retryDelay, sleep } from "../../utils/retryBackoff.js";
6
6
  const createClaimWalletsActor = (pregenWalletService) => fromPromise(
7
- (_0) => __async(void 0, [_0], function* ({ input }) {
7
+ (_0) => __async(null, [_0], function* ({ input }) {
8
8
  var _a;
9
9
  const retryCount = (_a = input == null ? void 0 : input.retryCount) != null ? _a : 0;
10
10
  if (retryCount > 0) yield sleep(retryDelay(retryCount));
@@ -3,7 +3,7 @@ import {
3
3
  } from "../../chunk-7B52C2XE.js";
4
4
  import { fromPromise } from "xstate";
5
5
  import { retryDelay, sleep } from "../../utils/retryBackoff.js";
6
- const createConnectParaConnectorsActor = (externalWalletService) => fromPromise((_0) => __async(void 0, [_0], function* ({ input }) {
6
+ const createConnectParaConnectorsActor = (externalWalletService) => fromPromise((_0) => __async(null, [_0], function* ({ input }) {
7
7
  var _a;
8
8
  const retryCount = (_a = input == null ? void 0 : input.retryCount) != null ? _a : 0;
9
9
  if (retryCount > 0) yield sleep(retryDelay(retryCount));
@@ -2,7 +2,7 @@ import {
2
2
  __async
3
3
  } from "../../chunk-7B52C2XE.js";
4
4
  import { fromPromise } from "xstate";
5
- const createConnectExternalWalletActor = (externalWalletService) => fromPromise((params) => __async(void 0, null, function* () {
5
+ const createConnectExternalWalletActor = (externalWalletService) => fromPromise((params) => __async(null, null, function* () {
6
6
  return yield externalWalletService.performConnectExternalWallet(params.input);
7
7
  }));
8
8
  export {
@@ -2,7 +2,7 @@ import {
2
2
  __async
3
3
  } from "../../chunk-7B52C2XE.js";
4
4
  import { fromPromise } from "xstate";
5
- const createCreateGuestWalletsActor = (pregenWalletService) => fromPromise(() => __async(void 0, null, function* () {
5
+ const createCreateGuestWalletsActor = (pregenWalletService) => fromPromise(() => __async(null, null, function* () {
6
6
  return yield pregenWalletService.performCreateGuestWallets();
7
7
  }));
8
8
  export {
@@ -4,7 +4,7 @@ import {
4
4
  } from "../../chunk-7B52C2XE.js";
5
5
  import { fromPromise } from "xstate";
6
6
  import { retryDelay, sleep } from "../../utils/retryBackoff.js";
7
- const createCreateWalletsActor = (walletService) => fromPromise((_0) => __async(void 0, [_0], function* ({ input }) {
7
+ const createCreateWalletsActor = (walletService) => fromPromise((_0) => __async(null, [_0], function* ({ input }) {
8
8
  var _a;
9
9
  const retryCount = (_a = input == null ? void 0 : input.retryCount) != null ? _a : 0;
10
10
  if (retryCount > 0) yield sleep(retryDelay(retryCount));
@@ -2,7 +2,7 @@ import {
2
2
  __async
3
3
  } from "../../chunk-7B52C2XE.js";
4
4
  import { fromPromise } from "xstate";
5
- const createProcessAuthenticationActor = (authService) => fromPromise((params) => __async(void 0, null, function* () {
5
+ const createProcessAuthenticationActor = (authService) => fromPromise((params) => __async(null, null, function* () {
6
6
  return yield authService.prepareAuthState(params.input.authState, params.input.opts);
7
7
  }));
8
8
  export {
@@ -3,7 +3,7 @@ import {
3
3
  } from "../../chunk-7B52C2XE.js";
4
4
  import { fromPromise } from "xstate";
5
5
  const createSetupAfterLoginActor = (paraCoreInterface) => fromPromise(
6
- (_0) => __async(void 0, [_0], function* ({ input: { temporaryShares, skipSessionRefresh } }) {
6
+ (_0) => __async(null, [_0], function* ({ input: { temporaryShares, skipSessionRefresh } }) {
7
7
  yield paraCoreInterface.setupAfterLogin({ temporaryShares, skipSessionRefresh });
8
8
  })
9
9
  );
@@ -2,7 +2,7 @@ import {
2
2
  __async
3
3
  } from "../../chunk-7B52C2XE.js";
4
4
  import { fromPromise } from "xstate";
5
- const createSetupParaActor = (paraCoreInterface) => fromPromise(() => __async(void 0, null, function* () {
5
+ const createSetupParaActor = (paraCoreInterface) => fromPromise(() => __async(null, null, function* () {
6
6
  const eagerPartnerLoad = paraCoreInterface.isPortal() ? Promise.resolve() : paraCoreInterface.sessionManagementService.touchSession().catch((e) => {
7
7
  paraCoreInterface.devLog("setupPara: eager partner load via touchSession failed; will retry lazily", e);
8
8
  });
@@ -5,7 +5,7 @@ import {
5
5
  } from "../../chunk-7B52C2XE.js";
6
6
  import { fromPromise } from "xstate";
7
7
  const createSignExternalWalletVerificationActor = (externalWalletService) => fromPromise(
8
- (params) => __async(void 0, null, function* () {
8
+ (params) => __async(null, null, function* () {
9
9
  const _a = yield externalWalletService.signMessage(params.input), { signature } = _a, rest = __objRest(_a, ["signature"]);
10
10
  return __spreadValues({ externalWallet: params.input.externalWallet, signedMessage: signature }, rest);
11
11
  })
@@ -2,7 +2,7 @@ import {
2
2
  __async
3
3
  } from "../../chunk-7B52C2XE.js";
4
4
  import { fromPromise } from "xstate";
5
- const createSwitchExternalWalletActor = (externalWalletService) => fromPromise((params) => __async(void 0, null, function* () {
5
+ const createSwitchExternalWalletActor = (externalWalletService) => fromPromise((params) => __async(null, null, function* () {
6
6
  return yield externalWalletService.performSwitchExternalWallet(params.input);
7
7
  }));
8
8
  export {
@@ -2,7 +2,7 @@ import {
2
2
  __async
3
3
  } from "../../chunk-7B52C2XE.js";
4
4
  import { fromPromise } from "xstate";
5
- const createVerifyExternalWalletActor = (authService) => fromPromise((params) => __async(void 0, null, function* () {
5
+ const createVerifyExternalWalletActor = (authService) => fromPromise((params) => __async(null, null, function* () {
6
6
  return yield authService.performVerifyExternalWallet(params.input);
7
7
  }));
8
8
  export {
@@ -2,7 +2,7 @@ import {
2
2
  __async
3
3
  } from "../../chunk-7B52C2XE.js";
4
4
  import { fromPromise } from "xstate";
5
- const createVerifyNewAccountActor = (authService) => fromPromise((params) => __async(void 0, null, function* () {
5
+ const createVerifyNewAccountActor = (authService) => fromPromise((params) => __async(null, null, function* () {
6
6
  return yield authService.performVerifyNewAccount(params.input);
7
7
  }));
8
8
  export {
@@ -2,7 +2,7 @@ import {
2
2
  __async
3
3
  } from "../../chunk-7B52C2XE.js";
4
4
  import { fromPromise } from "xstate";
5
- const createWaitForExternalWalletProvidersActor = (stateMachineInterface) => fromPromise(() => __async(void 0, null, function* () {
5
+ const createWaitForExternalWalletProvidersActor = (stateMachineInterface) => fromPromise(() => __async(null, null, function* () {
6
6
  return yield stateMachineInterface.externalWalletService.waitForProvidersLoading();
7
7
  }));
8
8
  export {
@@ -54,7 +54,7 @@ function createAuthStateMachine(paraCoreInterface) {
54
54
  connectExternalWallet: createConnectExternalWalletActor(paraCoreInterface.externalWalletService),
55
55
  signExternalWalletVerification: createSignExternalWalletVerificationActor(paraCoreInterface.externalWalletService),
56
56
  switchExternalWallet: createSwitchExternalWalletActor(paraCoreInterface.externalWalletService),
57
- logoutActor: fromPromise(() => __async(this, null, function* () {
57
+ logoutActor: fromPromise(() => __async(null, null, function* () {
58
58
  yield paraCoreInterface.logout({ skipStateReset: true });
59
59
  }))
60
60
  },
@@ -277,7 +277,7 @@ function createAuthStateMachine(paraCoreInterface) {
277
277
  let oauthSessionLookupId;
278
278
  let oauthAuthState = null;
279
279
  return {
280
- init: () => __async(this, null, function* () {
280
+ init: () => __async(null, null, function* () {
281
281
  try {
282
282
  const { sessionLookupId } = yield paraCoreInterface.pollingService.initOAuthPolling({
283
283
  onOAuthPopup,
@@ -292,7 +292,7 @@ function createAuthStateMachine(paraCoreInterface) {
292
292
  throw new Error(`OAuth initialization failed: ${extractErrorMessage(error, "Unknown error")}`);
293
293
  }
294
294
  }),
295
- checkCondition: () => __async(this, null, function* () {
295
+ checkCondition: () => __async(null, null, function* () {
296
296
  try {
297
297
  const result = yield paraCoreInterface.pollingService.waitForOAuth({
298
298
  onSuccess: (serverAuthState) => {
@@ -605,7 +605,7 @@ function createAuthStateMachine(paraCoreInterface) {
605
605
  var _a;
606
606
  let farcasterAuthState = null;
607
607
  return {
608
- checkCondition: () => __async(this, null, function* () {
608
+ checkCondition: () => __async(null, null, function* () {
609
609
  try {
610
610
  const result = yield paraCoreInterface.pollingService.waitForFarcasterAuth({
611
611
  onSuccess: (serverAuthState) => {
@@ -877,7 +877,7 @@ function createAuthStateMachine(paraCoreInterface) {
877
877
  var _a;
878
878
  let resolvedAuthState = null;
879
879
  return {
880
- checkCondition: () => __async(this, null, function* () {
880
+ checkCondition: () => __async(null, null, function* () {
881
881
  try {
882
882
  const result = yield paraCoreInterface.pollingService.waitForOAuth({
883
883
  onSuccess: (serverAuthState) => {
@@ -1069,7 +1069,7 @@ function createAuthStateMachine(paraCoreInterface) {
1069
1069
  input: ({ context }) => {
1070
1070
  var _a;
1071
1071
  return {
1072
- init: () => __async(this, null, function* () {
1072
+ init: () => __async(null, null, function* () {
1073
1073
  try {
1074
1074
  yield paraCoreInterface.sessionManagementService.touchSession();
1075
1075
  if (!paraCoreInterface.authService.isExternalWalletAuth) {
@@ -1080,7 +1080,7 @@ function createAuthStateMachine(paraCoreInterface) {
1080
1080
  throw new Error(`Session touch failed: ${extractErrorMessage(error, "Unknown error")}`);
1081
1081
  }
1082
1082
  }),
1083
- checkCondition: () => __async(this, null, function* () {
1083
+ checkCondition: () => __async(null, null, function* () {
1084
1084
  try {
1085
1085
  return yield paraCoreInterface.pollingService.waitForSession();
1086
1086
  } catch (error) {
@@ -18,7 +18,7 @@ function createCoreStateMachine(paraCoreInterface) {
18
18
  waitForExternalWalletProviders: createWaitForExternalWalletProvidersActor(paraCoreInterface),
19
19
  authMachine: createAuthStateMachine(paraCoreInterface),
20
20
  walletMachine: createWalletStateMachine(paraCoreInterface),
21
- logoutPara: fromPromise(() => __async(this, null, function* () {
21
+ logoutPara: fromPromise(() => __async(null, null, function* () {
22
22
  yield paraCoreInterface.logout();
23
23
  }))
24
24
  },
@@ -283,7 +283,7 @@ function createWalletStateMachine(paraCoreInterface) {
283
283
  input: ({ context, self }) => {
284
284
  var _a;
285
285
  return {
286
- checkCondition: () => __async(this, null, function* () {
286
+ checkCondition: () => __async(null, null, function* () {
287
287
  try {
288
288
  return yield paraCoreInterface.pollingService.waitForWallets({ parent: self })();
289
289
  } catch (error) {
@@ -27,7 +27,7 @@ function wrapWithSpan(name, fn, attributes) {
27
27
  const parentCtx = activeSpan ? active : (_b = (_a = getModalSessionContext()) != null ? _a : defaultParentContext) != null ? _b : active;
28
28
  return otelContext.with(
29
29
  parentCtx,
30
- () => getTracer().startActiveSpan(name, { attributes }, (span) => __async(this, null, function* () {
30
+ () => getTracer().startActiveSpan(name, { attributes }, (span) => __async(null, null, function* () {
31
31
  try {
32
32
  const result = yield fn(span);
33
33
  return result;
@@ -4,7 +4,8 @@ import {
4
4
  import { upload } from "../transmission/transmissionUtils.js";
5
5
  import { Environment } from "../types/index.js";
6
6
  function getGlobalPortalUrlOverride() {
7
- const override = typeof globalThis !== "undefined" ? globalThis.__PARA_PORTAL_URL_OVERRIDE__ : void 0;
7
+ var _a;
8
+ const override = (_a = typeof globalThis !== "undefined" ? globalThis.__PARA_PORTAL_URL_OVERRIDE__ : void 0) != null ? _a : typeof process !== "undefined" ? process.env.PARA_PORTAL_URL : void 0;
8
9
  return typeof override === "string" && override ? override : void 0;
9
10
  }
10
11
  function getPortalDomain(env, isE2E, isLegacy) {
@@ -27,7 +28,7 @@ function getPortalDomain(env, isE2E, isLegacy) {
27
28
  }
28
29
  function getPortalBaseURL({ env, isE2E, portalUrlOverride }, useLocalIp, isForWasm, isLegacy) {
29
30
  const resolvedPortalUrlOverride = portalUrlOverride != null ? portalUrlOverride : getGlobalPortalUrlOverride();
30
- if (resolvedPortalUrlOverride && !isForWasm) {
31
+ if (resolvedPortalUrlOverride) {
31
32
  return new URL(resolvedPortalUrlOverride).origin;
32
33
  }
33
34
  if (isE2E) {
@@ -91,6 +92,7 @@ function shortenUrl(ctx, url, isLegacy) {
91
92
  }
92
93
  export {
93
94
  constructUrl,
95
+ getGlobalPortalUrlOverride,
94
96
  getParaConnectBaseUrl,
95
97
  getParaConnectDomain,
96
98
  getPortalBaseURL,
@@ -0,0 +1,4 @@
1
+ type DevUrlScheme = 'http' | 'ws';
2
+ export declare function getDevApiBaseUrlOverride(apiBaseUrlOverride?: string, scheme?: DevUrlScheme): string | undefined;
3
+ export declare function getDevMPCNetworkUrlOverride(mpcNetworkUrlOverride?: string, useWebsocket?: boolean): string | undefined;
4
+ export {};
@@ -1,8 +1,8 @@
1
1
  import Client from '@getpara/user-management-client';
2
2
  import { Environment } from '../types/index.js';
3
- export declare function getBaseOAuthUrl(env: Environment): string;
4
- export declare function getBaseUrl(env: Environment, scheme?: 'http' | 'ws'): string;
5
- export declare function getBaseMPCNetworkUrl(env: Environment, useWebsocket?: boolean): string;
3
+ export declare function getBaseOAuthUrl(env: Environment, apiBaseUrlOverride?: string): string;
4
+ export declare function getBaseUrl(env: Environment, scheme?: 'http' | 'ws', apiBaseUrlOverride?: string): string;
5
+ export declare function getBaseMPCNetworkUrl(env: Environment, useWebsocket?: boolean, mpcNetworkUrlOverride?: string): string;
6
6
  /**
7
7
  * Maps a raw host-platform / sdkType value onto the normalized `client_type`
8
8
  * dimension used by backend analytics + Sentry. Unknown values (e.g. BRIDGE
@@ -11,7 +11,7 @@ export declare function getBaseMPCNetworkUrl(env: Environment, useWebsocket?: bo
11
11
  * outside this core SDK path.
12
12
  */
13
13
  export declare function normalizePlatform(platform?: string): string | undefined;
14
- export declare function initClient({ env, version, apiKey, partnerId, platform, useFetchAdapter, retrieveSessionCookie, persistSessionCookie, staticTraceContext, httpAgent, httpsAgent, }: {
14
+ export declare function initClient({ env, version, apiKey, partnerId, platform, useFetchAdapter, retrieveSessionCookie, persistSessionCookie, staticTraceContext, httpAgent, httpsAgent, apiBaseUrlOverride, }: {
15
15
  env: Environment;
16
16
  version?: string;
17
17
  apiKey: string;
@@ -24,4 +24,5 @@ export declare function initClient({ env, version, apiKey, partnerId, platform,
24
24
  staticTraceContext?: Record<string, string>;
25
25
  httpAgent?: unknown;
26
26
  httpsAgent?: unknown;
27
+ apiBaseUrlOverride?: string;
27
28
  }): Client;
@@ -17,6 +17,8 @@ export interface Ctx {
17
17
  disableWorkers?: boolean;
18
18
  offloadMPCComputationURL?: string;
19
19
  mpcComputationClient?: AxiosInstance;
20
+ apiBaseUrlOverride?: string;
21
+ mpcNetworkUrlOverride?: string;
20
22
  useLocalFiles?: boolean;
21
23
  useDKLS?: boolean;
22
24
  disableWebSockets: boolean;
@@ -1,4 +1,5 @@
1
1
  import { Ctx, Environment } from '../types/index.js';
2
+ export declare function getGlobalPortalUrlOverride(): string | undefined;
2
3
  export declare function getPortalDomain(env: Environment, isE2E?: boolean, isLegacy?: boolean): string;
3
4
  export declare function getPortalBaseURL({ env, isE2E, portalUrlOverride }: {
4
5
  env: Environment;
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@getpara/core-sdk",
3
- "version": "3.5.1",
3
+ "version": "3.6.0",
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": "3.5.1",
8
+ "@getpara/user-management-client": "3.6.0",
9
9
  "@noble/hashes": "^1.5.0",
10
10
  "@opentelemetry/api": "^1.9.1",
11
11
  "@opentelemetry/context-zone": "^2.7.1",
@@ -23,7 +23,7 @@
23
23
  "elliptic": "^6.6.1",
24
24
  "libphonenumber-js": "^1.11.7",
25
25
  "node-forge": "^1.3.1",
26
- "uuid": "^11.1.0",
26
+ "uuid": "^11.1.1",
27
27
  "xstate": "^5.24.0"
28
28
  },
29
29
  "devDependencies": {
@@ -41,7 +41,7 @@
41
41
  "dist",
42
42
  "package.json"
43
43
  ],
44
- "gitHead": "362fc377edf3cca5f743679498ff4908921c8468",
44
+ "gitHead": "565535ab0cf38d65f6996fc9f1ede52d133ddac0",
45
45
  "main": "dist/cjs/index.js",
46
46
  "module": "dist/esm/index.js",
47
47
  "scripts": {