@getpara/core-sdk 3.0.0-alpha.1 → 3.0.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 (103) hide show
  1. package/dist/cjs/ParaCore.js +436 -86
  2. package/dist/cjs/constants.js +1 -1
  3. package/dist/cjs/cryptography/utils.js +5 -2
  4. package/dist/cjs/errors.js +10 -0
  5. package/dist/cjs/external/userManagementClient.js +21 -4
  6. package/dist/cjs/index.js +67 -1
  7. package/dist/cjs/services/AuthService.js +66 -47
  8. package/dist/cjs/services/LoginFlowService.js +30 -27
  9. package/dist/cjs/services/PollingService.js +100 -75
  10. package/dist/cjs/services/PortalUrlService.js +112 -19
  11. package/dist/cjs/services/PregenWalletService.js +125 -76
  12. package/dist/cjs/services/SessionManagementService.js +15 -8
  13. package/dist/cjs/services/SignupFlowService.js +52 -47
  14. package/dist/cjs/services/VerificationFlowService.js +13 -10
  15. package/dist/cjs/services/WalletService.js +51 -36
  16. package/dist/cjs/shares/enclave.js +44 -24
  17. package/dist/cjs/state/CoreStateManager.js +17 -5
  18. package/dist/cjs/state/actors/setupPara.js +4 -1
  19. package/dist/cjs/state/machines/walletStateMachine.js +22 -0
  20. package/dist/cjs/telemetry/config.js +15 -0
  21. package/dist/cjs/telemetry/init.js +185 -0
  22. package/dist/cjs/telemetry/modalSession.js +54 -0
  23. package/dist/cjs/telemetry/session.js +39 -0
  24. package/dist/cjs/telemetry/tracer.js +126 -0
  25. package/dist/cjs/telemetry/uxAction.js +30 -0
  26. package/dist/cjs/telemetry/uxBaggagePropagator.js +58 -0
  27. package/dist/cjs/telemetry/uxState.js +46 -0
  28. package/dist/cjs/telemetry/uxStateSpanProcessor.js +51 -0
  29. package/dist/cjs/utils/configEncoding.js +98 -0
  30. package/dist/cjs/utils/deprecation.js +13 -13
  31. package/dist/cjs/utils/index.js +11 -0
  32. package/dist/cjs/utils/partnerConfig.js +103 -0
  33. package/dist/cjs/utils/partnerConfigGating.js +83 -0
  34. package/dist/cjs/utils/stateErrorHelpers.js +6 -1
  35. package/dist/cjs/utils/url.js +10 -2
  36. package/dist/esm/ParaCore.js +441 -88
  37. package/dist/esm/constants.js +1 -1
  38. package/dist/esm/cryptography/utils.js +5 -2
  39. package/dist/esm/errors.js +9 -0
  40. package/dist/esm/external/userManagementClient.js +21 -4
  41. package/dist/esm/index.js +58 -4
  42. package/dist/esm/services/AuthService.js +66 -47
  43. package/dist/esm/services/LoginFlowService.js +30 -27
  44. package/dist/esm/services/PollingService.js +100 -75
  45. package/dist/esm/services/PortalUrlService.js +112 -19
  46. package/dist/esm/services/PregenWalletService.js +125 -76
  47. package/dist/esm/services/SessionManagementService.js +15 -8
  48. package/dist/esm/services/SignupFlowService.js +52 -47
  49. package/dist/esm/services/VerificationFlowService.js +13 -10
  50. package/dist/esm/services/WalletService.js +51 -36
  51. package/dist/esm/shares/enclave.js +44 -24
  52. package/dist/esm/state/CoreStateManager.js +17 -5
  53. package/dist/esm/state/actors/setupPara.js +4 -1
  54. package/dist/esm/state/machines/walletStateMachine.js +22 -0
  55. package/dist/esm/telemetry/config.js +0 -0
  56. package/dist/esm/telemetry/init.js +118 -0
  57. package/dist/esm/telemetry/modalSession.js +29 -0
  58. package/dist/esm/telemetry/session.js +16 -0
  59. package/dist/esm/telemetry/tracer.js +84 -0
  60. package/dist/esm/telemetry/uxAction.js +8 -0
  61. package/dist/esm/telemetry/uxBaggagePropagator.js +35 -0
  62. package/dist/esm/telemetry/uxState.js +21 -0
  63. package/dist/esm/telemetry/uxStateSpanProcessor.js +28 -0
  64. package/dist/esm/utils/configEncoding.js +45 -0
  65. package/dist/esm/utils/deprecation.js +11 -12
  66. package/dist/esm/utils/index.js +6 -0
  67. package/dist/esm/utils/partnerConfig.js +67 -0
  68. package/dist/esm/utils/partnerConfigGating.js +61 -0
  69. package/dist/esm/utils/stateErrorHelpers.js +6 -1
  70. package/dist/esm/utils/url.js +10 -2
  71. package/dist/types/ParaCore.d.ts +101 -19
  72. package/dist/types/PlatformUtils.d.ts +1 -0
  73. package/dist/types/errors.d.ts +26 -0
  74. package/dist/types/external/userManagementClient.d.ts +2 -1
  75. package/dist/types/index.d.ts +15 -3
  76. package/dist/types/services/types/AuthServiceTypes.d.ts +10 -3
  77. package/dist/types/services/types/PortalUrlServiceTypes.d.ts +3 -3
  78. package/dist/types/services/types/WalletServiceTypes.d.ts +4 -0
  79. package/dist/types/state/actors/setupPara.d.ts +18 -0
  80. package/dist/types/state/machines/authStateMachine.d.ts +1 -1
  81. package/dist/types/state/machines/coreStateMachine.d.ts +30 -6
  82. package/dist/types/state/machines/walletStateMachine.d.ts +4 -0
  83. package/dist/types/state/types/core.d.ts +7 -1
  84. package/dist/types/telemetry/config.d.ts +4 -0
  85. package/dist/types/telemetry/init.d.ts +17 -0
  86. package/dist/types/telemetry/modalSession.d.ts +5 -0
  87. package/dist/types/telemetry/session.d.ts +2 -0
  88. package/dist/types/telemetry/tracer.d.ts +10 -0
  89. package/dist/types/telemetry/uxAction.d.ts +3 -0
  90. package/dist/types/telemetry/uxBaggagePropagator.d.ts +7 -0
  91. package/dist/types/telemetry/uxState.d.ts +8 -0
  92. package/dist/types/telemetry/uxStateSpanProcessor.d.ts +9 -0
  93. package/dist/types/types/config.d.ts +15 -3
  94. package/dist/types/types/coreApi.d.ts +7 -9
  95. package/dist/types/types/serviceInterfaces.d.ts +5 -3
  96. package/dist/types/types/util.d.ts +2 -15
  97. package/dist/types/utils/configEncoding.d.ts +51 -0
  98. package/dist/types/utils/deprecation.d.ts +3 -1
  99. package/dist/types/utils/index.d.ts +2 -0
  100. package/dist/types/utils/partnerConfig.d.ts +28 -0
  101. package/dist/types/utils/partnerConfigGating.d.ts +48 -0
  102. package/dist/types/utils/url.d.ts +3 -2
  103. package/package.json +14 -4
@@ -1,5 +1,5 @@
1
1
  import "./chunk-7B52C2XE.js";
2
- const PARA_CORE_VERSION = "3.0.0-alpha.1";
2
+ const PARA_CORE_VERSION = "3.0.0";
3
3
  const PREFIX = "@CAPSULE/";
4
4
  const PARA_PREFIX = "@PARA/";
5
5
  const LOCAL_STORAGE_AUTH_INFO = `${PREFIX}authInfo`;
@@ -4,6 +4,7 @@ import {
4
4
  import base64url from "base64url";
5
5
  import forge from "node-forge";
6
6
  import { getPortalBaseURL } from "../utils/index.js";
7
+ import { wrapWithSpan } from "../telemetry/tracer.js";
7
8
  const rsa = forge.pki.rsa;
8
9
  const RSA_ENCRYPTION_SCHEME = "RSA-OAEP";
9
10
  const CONSTANT_IV = "794241bc819a125a7b78ea313decc0bc";
@@ -93,8 +94,10 @@ function getAsymmetricKeyPair(ctx, seedValue) {
93
94
  if (!ctx.disableWorkers) {
94
95
  options.workLoad = 100;
95
96
  options.workers = seedValue ? 1 : -1;
96
- const workerRes = yield fetch(`${getPortalBaseURL(ctx)}/static/js/prime.worker.min.js`);
97
- const workerBlob = new Blob([yield workerRes.text()], { type: "application/javascript" });
97
+ const workerBlob = yield wrapWithSpan("worker.load_prime", () => __async(this, null, function* () {
98
+ const workerRes = yield fetch(`${getPortalBaseURL(ctx)}/static/js/prime.worker.min.js`);
99
+ return new Blob([yield workerRes.text()], { type: "application/javascript" });
100
+ }));
98
101
  options.workerScript = URL.createObjectURL(workerBlob);
99
102
  }
100
103
  return new Promise(
@@ -20,7 +20,16 @@ class TransactionReviewTimeout extends Error {
20
20
  this.pendingTransactionId = pendingTransactionId;
21
21
  }
22
22
  }
23
+ class PartnerConfigError extends Error {
24
+ constructor(code, message, detail) {
25
+ super(message);
26
+ this.name = "PartnerConfigError";
27
+ this.code = code;
28
+ this.detail = detail;
29
+ }
30
+ }
23
31
  export {
32
+ PartnerConfigError,
24
33
  TransactionReviewDenied,
25
34
  TransactionReviewError,
26
35
  TransactionReviewTimeout
@@ -1,10 +1,24 @@
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
+ }
4
17
  function getBaseOAuthUrl(env) {
18
+ var _a;
5
19
  switch (env) {
6
20
  case Environment.DEV:
7
- return "http://localhost:8080/";
21
+ return (_a = getDevApiBaseUrlOverride()) != null ? _a : "http://localhost:8080/";
8
22
  case Environment.SANDBOX:
9
23
  return "https://api.sandbox.usecapsule.com/";
10
24
  case Environment.BETA:
@@ -16,9 +30,10 @@ function getBaseOAuthUrl(env) {
16
30
  }
17
31
  }
18
32
  function getBaseUrl(env, scheme = "http") {
33
+ var _a;
19
34
  switch (env) {
20
35
  case Environment.DEV:
21
- return `${scheme}://localhost:8080/`;
36
+ return (_a = getDevApiBaseUrlOverride(scheme)) != null ? _a : `${scheme}://localhost:8080/`;
22
37
  case Environment.SANDBOX:
23
38
  return `${scheme}s://api.sandbox.getpara.com/`;
24
39
  case Environment.BETA:
@@ -51,7 +66,8 @@ function initClient({
51
66
  partnerId,
52
67
  useFetchAdapter = false,
53
68
  retrieveSessionCookie,
54
- persistSessionCookie
69
+ persistSessionCookie,
70
+ staticTraceContext
55
71
  }) {
56
72
  return new Client({
57
73
  userManagementHost: getBaseUrl(env),
@@ -60,7 +76,8 @@ function initClient({
60
76
  partnerId,
61
77
  opts: { useFetchAdapter },
62
78
  retrieveSessionCookie,
63
- persistSessionCookie
79
+ persistSessionCookie,
80
+ staticTraceContext
64
81
  });
65
82
  }
66
83
  export {
package/dist/esm/index.js CHANGED
@@ -3,6 +3,7 @@ import { ParaCore } from "./ParaCore.js";
3
3
  import {
4
4
  AuthMethod,
5
5
  AuthMethodStatus,
6
+ AuthLayout,
6
7
  EmailTheme,
7
8
  Network,
8
9
  WalletType,
@@ -26,7 +27,8 @@ import {
26
27
  SOLANA_WALLETS,
27
28
  COSMOS_WALLETS,
28
29
  formatAssetQuantity,
29
- formatCurrency
30
+ formatCurrency,
31
+ DeliveryChannel
30
32
  } from "@getpara/user-management-client";
31
33
  import {
32
34
  PopupType,
@@ -45,7 +47,8 @@ import {
45
47
  entityToWallet,
46
48
  constructUrl,
47
49
  shortenUrl,
48
- isPortal
50
+ isPortal,
51
+ warnOnce
49
52
  } from "./utils/index.js";
50
53
  import {
51
54
  PREFIX,
@@ -83,15 +86,40 @@ export * from "./utils/phone.js";
83
86
  export * from "./utils/config.js";
84
87
  import { isWalletSupported } from "./utils/wallet.js";
85
88
  import { getNetworkPrefix, getOnRampAssets, getOnRampNetworks, toAssetInfoArray } from "./utils/onRamps.js";
86
- import { getPortalBaseURL } from "./utils/url.js";
89
+ import { getPortalBaseURL, getParaConnectBaseUrl } from "./utils/url.js";
90
+ import {
91
+ encodeConfigParams,
92
+ tryDecodeConfig,
93
+ isCompressionStreamSupported,
94
+ ENCODED_CONFIG_VERSION
95
+ } from "./utils/configEncoding.js";
87
96
  import { retrieve } from "./transmission/transmissionUtils.js";
97
+ import {
98
+ getTracer,
99
+ wrapWithSpan,
100
+ wrapWithSpanInContext,
101
+ extractTraceContextFromUrl,
102
+ getUrlTraceCarrier,
103
+ setDefaultParentContext,
104
+ getDefaultParentContext,
105
+ SpanStatusCode
106
+ } from "./telemetry/tracer.js";
107
+ import { getOrCreateSessionId } from "./telemetry/session.js";
108
+ import { initTelemetry, isTelemetryInitialized, onTelemetryReady, flushTelemetry } from "./telemetry/init.js";
109
+ import { getUxState, setCurrentView, setLastInteraction } from "./telemetry/uxState.js";
110
+ import { setCurrentUserId } from "./telemetry/uxStateSpanProcessor.js";
111
+ import { recordActionOnSpan } from "./telemetry/uxAction.js";
112
+ import { startModalSession, endModalSession, getModalSessionContext } from "./telemetry/modalSession.js";
88
113
  const paraVersion = ParaCore.version;
89
114
  var src_default = ParaCore;
90
115
  export {
91
116
  AccountLinkError,
117
+ AuthLayout,
92
118
  AuthMethod,
93
119
  AuthMethodStatus,
94
120
  COSMOS_WALLETS,
121
+ DeliveryChannel,
122
+ ENCODED_CONFIG_VERSION,
95
123
  EVM_WALLETS,
96
124
  EXTERNAL_WALLET_TYPES,
97
125
  EmailTheme,
@@ -115,6 +143,7 @@ export {
115
143
  RecoveryStatus,
116
144
  SOLANA_WALLETS,
117
145
  PREFIX as STORAGE_PREFIX,
146
+ SpanStatusCode,
118
147
  ThemeMode,
119
148
  WALLET_SCHEMES,
120
149
  WALLET_TYPES,
@@ -129,34 +158,59 @@ export {
129
158
  src_default as default,
130
159
  dispatchEvent,
131
160
  distributeNewShare,
161
+ encodeConfigParams,
132
162
  encodePrivateKeyToPemHex,
133
163
  encryptPrivateKey,
134
164
  encryptPrivateKeyWithPassword,
135
165
  encryptWithDerivedPublicKey,
166
+ endModalSession,
136
167
  entityToWallet,
168
+ extractTraceContextFromUrl,
169
+ flushTelemetry,
137
170
  formatAssetQuantity,
138
171
  formatCurrency,
139
172
  getAsymmetricKeyPair,
140
173
  getBaseUrl,
174
+ getDefaultParentContext,
141
175
  getDerivedPrivateKeyAndDecrypt,
176
+ getModalSessionContext,
142
177
  getNetworkPrefix,
143
178
  getOnRampAssets,
144
179
  getOnRampNetworks,
180
+ getOrCreateSessionId,
181
+ getParaConnectBaseUrl,
145
182
  getPortalBaseURL,
146
183
  getPortalDomain,
147
184
  getPublicKeyFromSignature,
148
185
  getPublicKeyHex,
149
186
  getSHA256HashHex,
187
+ getTracer,
188
+ getUrlTraceCarrier,
189
+ getUxState,
150
190
  hashPasswordWithSalt,
151
191
  initClient,
192
+ initTelemetry,
193
+ isCompressionStreamSupported,
152
194
  isPortal,
195
+ isTelemetryInitialized,
153
196
  isWalletSupported,
154
197
  mpcComputationClient,
155
198
  offParaEvent,
156
199
  onParaEvent,
200
+ onTelemetryReady,
157
201
  paraVersion,
158
202
  publicKeyFromHex,
203
+ recordActionOnSpan,
204
+ setCurrentUserId,
205
+ setCurrentView,
206
+ setDefaultParentContext,
207
+ setLastInteraction,
159
208
  shortenUrl,
209
+ startModalSession,
160
210
  toAssetInfoArray,
161
- retrieve as transmissionUtilsRetrieve
211
+ retrieve as transmissionUtilsRetrieve,
212
+ tryDecodeConfig,
213
+ warnOnce,
214
+ wrapWithSpan,
215
+ wrapWithSpanInContext
162
216
  };
@@ -23,6 +23,8 @@ import * as constants from "../constants.js";
23
23
  import { LoginFlowService } from "./LoginFlowService.js";
24
24
  import { VerificationFlowService } from "./VerificationFlowService.js";
25
25
  import { SignupFlowService } from "./SignupFlowService.js";
26
+ import { wrapWithSpan } from "../telemetry/tracer.js";
27
+ import { setCurrentUserId } from "../telemetry/uxStateSpanProcessor.js";
26
28
  import { waitForAuthStateChange } from "../utils/stateListener.js";
27
29
  class AuthService {
28
30
  constructor(paraCore) {
@@ -73,12 +75,14 @@ class AuthService {
73
75
  }));
74
76
  };
75
77
  this.prepareLogin = () => __async(this, null, function* () {
76
- yield __privateGet(this, _paraCoreInterface).logout({ skipStateReset: true });
77
- const { sessionLookupId } = yield __privateGet(this, _sessionManagementService).touchSession(true);
78
- if (!__privateGet(this, _paraCoreInterface).loginEncryptionKeyPair) {
79
- yield __privateGet(this, _paraCoreInterface).setLoginEncryptionKeyPair();
80
- }
81
- return sessionLookupId;
78
+ return wrapWithSpan("auth.prepare_login", () => __async(this, null, function* () {
79
+ yield __privateGet(this, _paraCoreInterface).logout({ skipStateReset: true });
80
+ const { sessionLookupId } = yield __privateGet(this, _sessionManagementService).touchSession(true);
81
+ if (!__privateGet(this, _paraCoreInterface).loginEncryptionKeyPair) {
82
+ yield __privateGet(this, _paraCoreInterface).setLoginEncryptionKeyPair();
83
+ }
84
+ return sessionLookupId;
85
+ }));
82
86
  });
83
87
  this.setAuth = (_0, ..._1) => __async(this, [_0, ..._1], function* (auth, { extras = {}, userId } = {}) {
84
88
  const authInfo = __spreadValues(__spreadValues({}, extractAuthInfo(auth, { isRequired: true })), extras || {});
@@ -99,6 +103,7 @@ class AuthService {
99
103
  });
100
104
  this.setUserId = (userId) => __async(this, null, function* () {
101
105
  this.userId = userId;
106
+ setCurrentUserId(userId);
102
107
  yield __privateGet(this, _paraCoreInterface).localStorageSetItem(constants.LOCAL_STORAGE_USER_ID, userId);
103
108
  });
104
109
  this.assertIsAuthSet = (allowed) => {
@@ -174,9 +179,14 @@ class AuthService {
174
179
  });
175
180
  });
176
181
  this.performSignUpOrLogIn = (params) => __async(this, null, function* () {
182
+ var _b;
177
183
  const _a = params, { auth } = _a, urlOptions = __objRest(_a, ["auth"]);
178
184
  try {
179
- const serverAuthState = yield __privateGet(this, _paraCoreInterface).ctx.client.signUpOrLogIn(__spreadValues(__spreadValues({}, auth), __privateGet(this, _paraCoreInterface).getVerificationEmailProps()));
185
+ const serverAuthState = yield wrapWithSpan(
186
+ "auth.send_otp",
187
+ () => __privateGet(this, _paraCoreInterface).ctx.client.signUpOrLogIn(__spreadValues(__spreadValues({}, auth), __privateGet(this, _paraCoreInterface).getVerificationEmailProps())),
188
+ { "auth.method": (_b = auth.authType) != null ? _b : "unknown" }
189
+ );
180
190
  return { authState: serverAuthState, opts: urlOptions };
181
191
  } catch (error) {
182
192
  if (error.message.includes("max beta users reached")) {
@@ -457,51 +467,59 @@ class AuthService {
457
467
  break;
458
468
  }
459
469
  }
460
- yield waitForAuthStateChange({
461
- stateManager: __privateGet(this, _stateManager),
462
- resolvePhases: [
463
- // awaiting_session_start will be hit for non-SLO logins & all SLO logins/sign ups
464
- { phase: "awaiting_session_start", onPhase: () => void 0 }
465
- ],
466
- rejectPhases: [
467
- {
468
- phase: "unauthenticated",
469
- onPhase: () => new Error("OAuth canceled")
470
- }
471
- ]
472
- });
470
+ yield wrapWithSpan(
471
+ "oauth.redirect_wait",
472
+ () => waitForAuthStateChange({
473
+ stateManager: __privateGet(this, _stateManager),
474
+ resolvePhases: [
475
+ // awaiting_session_start will be hit for non-SLO logins & all SLO logins/sign ups
476
+ { phase: "awaiting_session_start", onPhase: () => void 0 }
477
+ ],
478
+ rejectPhases: [
479
+ {
480
+ phase: "unauthenticated",
481
+ onPhase: () => new Error("OAuth canceled")
482
+ }
483
+ ]
484
+ }),
485
+ { "auth.method": params.method }
486
+ );
473
487
  __privateGet(this, _stateManager).send({
474
488
  type: "WAIT_FOR_SESSION",
475
489
  data: __spreadProps(__spreadValues({}, params.sessionPollingCallbacks), { autoCreateWallets: true })
476
490
  });
477
- const resp = yield waitForAuthStateChange({
478
- stateManager: __privateGet(this, _stateManager),
479
- resolvePhases: [
480
- {
481
- phase: "authenticated",
482
- onPhase: (state) => {
483
- const createdWallets = state.newWalletsResult;
484
- if (createdWallets) {
491
+ const resp = yield wrapWithSpan(
492
+ "oauth.session_wait",
493
+ () => waitForAuthStateChange({
494
+ stateManager: __privateGet(this, _stateManager),
495
+ resolvePhases: [
496
+ {
497
+ phase: "authenticated",
498
+ onPhase: (state) => {
499
+ const createdWallets = state.newWalletsResult;
500
+ if (createdWallets) {
501
+ return {
502
+ hasCreatedWallets: true,
503
+ recoverySecret: state.newWalletsResult.recoverySecret
504
+ };
505
+ }
485
506
  return {
486
- hasCreatedWallets: true,
487
- recoverySecret: state.newWalletsResult.recoverySecret
507
+ hasCreatedWallets: false,
508
+ recoverySecret: void 0
488
509
  };
489
510
  }
490
- return {
491
- hasCreatedWallets: false,
492
- recoverySecret: void 0
493
- };
494
511
  }
495
- }
496
- ],
497
- rejectPhases: [
498
- {
499
- phase: "unauthenticated",
500
- onPhase: () => new Error("Session waiting canceled")
501
- }
502
- ],
503
- waitForCoreAuthenticated: true
504
- });
512
+ ],
513
+ rejectPhases: [
514
+ {
515
+ phase: "unauthenticated",
516
+ onPhase: () => new Error("Session waiting canceled")
517
+ }
518
+ ],
519
+ waitForCoreAuthenticated: true
520
+ }),
521
+ { "auth.method": params.method }
522
+ );
505
523
  return __spreadValues({ authInfo: this.authInfo }, resp);
506
524
  });
507
525
  this.performVerifyTelegram = (params) => __async(this, null, function* () {
@@ -618,7 +636,7 @@ class AuthService {
618
636
  const { url } = yield this.getNewCredentialAndUrl({ isForNewDevice: true, authMethod });
619
637
  return url;
620
638
  });
621
- this.resendVerificationCode = (_0) => __async(this, [_0], function* ({ type: reason = "SIGNUP" }) {
639
+ this.resendVerificationCode = (_0) => __async(this, [_0], function* ({ type: reason = "SIGNUP", deliveryChannel }) {
622
640
  let type, linkedAccountId;
623
641
  switch (reason) {
624
642
  case "SIGNUP":
@@ -640,10 +658,11 @@ class AuthService {
640
658
  if (type !== "EMAIL" && type !== "PHONE") {
641
659
  throw new Error("invalid auth type for verification code");
642
660
  }
643
- yield __privateGet(this, _paraCoreInterface).ctx.client.resendVerificationCode(__spreadValues({
661
+ return yield __privateGet(this, _paraCoreInterface).ctx.client.resendVerificationCode(__spreadValues({
644
662
  userId,
645
663
  type,
646
- linkedAccountId
664
+ linkedAccountId,
665
+ deliveryChannel
647
666
  }, __privateGet(this, _paraCoreInterface).getVerificationEmailProps()));
648
667
  });
649
668
  __privateSet(this, _paraCoreInterface, paraCore.getAuthServiceInterface());
@@ -10,6 +10,7 @@ import { getPublicKeyHex } from "../cryptography/utils.js";
10
10
  import { ParaEvent } from "../types/events.js";
11
11
  import { dispatchEvent } from "../utils/index.js";
12
12
  import { waitForAuthStateChange } from "../utils/stateListener.js";
13
+ import { wrapWithSpan } from "../telemetry/tracer.js";
13
14
  class LoginFlowService extends BaseAuthFlowService {
14
15
  constructor() {
15
16
  super(...arguments);
@@ -71,35 +72,37 @@ class LoginFlowService extends BaseAuthFlowService {
71
72
  return result;
72
73
  });
73
74
  this.waitForLogin = (params) => __async(this, null, function* () {
74
- this.stateManager.send({
75
- type: "WAIT_FOR_SESSION",
76
- data: __spreadValues({}, params)
77
- });
78
- return yield waitForAuthStateChange({
79
- stateManager: this.stateManager,
80
- resolvePhases: [
81
- {
82
- phase: "authenticated",
83
- onPhase: () => {
84
- const needsWallet = this.stateManager.getSnapshot().needsWallet;
85
- dispatchEvent(ParaEvent.LOGIN_EVENT, true);
86
- return {
87
- partnerId: this.paraCoreInterface.partnerId,
88
- needsWallet: needsWallet || Object.values(this.services.walletService.wallets).length === 0
89
- };
75
+ return wrapWithSpan("auth.login_wait", () => __async(this, null, function* () {
76
+ this.stateManager.send({
77
+ type: "WAIT_FOR_SESSION",
78
+ data: __spreadValues({}, params)
79
+ });
80
+ return yield waitForAuthStateChange({
81
+ stateManager: this.stateManager,
82
+ resolvePhases: [
83
+ {
84
+ phase: "authenticated",
85
+ onPhase: () => {
86
+ const needsWallet = this.stateManager.getSnapshot().needsWallet;
87
+ dispatchEvent(ParaEvent.LOGIN_EVENT, true);
88
+ return {
89
+ partnerId: this.paraCoreInterface.partnerId,
90
+ needsWallet: needsWallet || Object.values(this.services.walletService.wallets).length === 0
91
+ };
92
+ }
90
93
  }
94
+ ],
95
+ rejectPhases: [
96
+ {
97
+ phase: "unauthenticated",
98
+ onPhase: () => new Error("canceled")
99
+ }
100
+ ],
101
+ onReject: () => {
102
+ dispatchEvent(ParaEvent.LOGIN_EVENT, { isComplete: false }, "failed to setup user");
91
103
  }
92
- ],
93
- rejectPhases: [
94
- {
95
- phase: "unauthenticated",
96
- onPhase: () => new Error("canceled")
97
- }
98
- ],
99
- onReject: () => {
100
- dispatchEvent(ParaEvent.LOGIN_EVENT, { isComplete: false }, "failed to setup user");
101
- }
102
- });
104
+ });
105
+ }));
103
106
  });
104
107
  }
105
108
  }