@getpara/core-sdk 2.27.0 → 2.28.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.
@@ -1406,6 +1406,15 @@ const _ParaCore = class _ParaCore {
1406
1406
  if (!wallet) {
1407
1407
  throw new Error("wallet not found");
1408
1408
  }
1409
+ if (wallet.scheme === "ED25519") {
1410
+ return yield this.platformUtils.getED25519PrivateKey(
1411
+ this.ctx,
1412
+ this.userId,
1413
+ wallet.id,
1414
+ wallet.signer,
1415
+ this.retrieveSessionCookie()
1416
+ );
1417
+ }
1409
1418
  if (wallet.scheme !== "DKLS") {
1410
1419
  throw new Error("invalid wallet scheme");
1411
1420
  }
@@ -1580,8 +1589,8 @@ const _ParaCore = class _ParaCore {
1580
1589
  * Resend a verification email for the current user.
1581
1590
  */
1582
1591
  resendVerificationCode(_0) {
1583
- return __async(this, arguments, function* ({ type: reason = "SIGNUP" }) {
1584
- return yield __privateGet(this, _authService).resendVerificationCode({ type: reason });
1592
+ return __async(this, arguments, function* ({ type: reason = "SIGNUP", deliveryChannel }) {
1593
+ return yield __privateGet(this, _authService).resendVerificationCode({ type: reason, deliveryChannel });
1585
1594
  });
1586
1595
  }
1587
1596
  /**
@@ -2817,15 +2826,16 @@ const _ParaCore = class _ParaCore {
2817
2826
  }
2818
2827
  sendLoginCode() {
2819
2828
  return __async(this, null, function* () {
2820
- const { userId } = yield this.ctx.client.sendLoginVerificationCode(this.authInfo);
2829
+ const { userId, deliveryChannel, fallbackUsed, fallbackChannel, isSmsAllowed } = yield this.ctx.client.sendLoginVerificationCode(this.authInfo);
2821
2830
  this.setUserId(userId);
2831
+ return { deliveryChannel, fallbackUsed, fallbackChannel, isSmsAllowed };
2822
2832
  });
2823
2833
  }
2824
2834
  exportPrivateKey() {
2825
2835
  return __async(this, arguments, function* (args = {}) {
2826
2836
  let walletId = args == null ? void 0 : args.walletId;
2827
2837
  if (!(args == null ? void 0 : args.walletId)) {
2828
- walletId = this.findWalletId(void 0, { forbidPregen: true, scheme: ["DKLS"] });
2838
+ walletId = this.findWalletId(void 0, { forbidPregen: true, scheme: ["DKLS", "ED25519"] });
2829
2839
  }
2830
2840
  const wallet = this.wallets[walletId];
2831
2841
  if (this.externalWallets[walletId]) {
@@ -2834,9 +2844,6 @@ const _ParaCore = class _ParaCore {
2834
2844
  if (!wallet || !wallet.signer) {
2835
2845
  throw new Error("Wallet not found with id: " + walletId);
2836
2846
  }
2837
- if (wallet.scheme !== "DKLS") {
2838
- throw new Error("Cannot export private key for a Solana wallet");
2839
- }
2840
2847
  if (wallet.isPregen && !!wallet.pregenIdentifier && wallet.pregenIdentifierType !== "GUEST_ID") {
2841
2848
  throw new Error("Cannot export private key for a pregenerated wallet");
2842
2849
  }
@@ -46,7 +46,7 @@ __export(constants_exports, {
46
46
  TRANSACTION_REVIEW_TIMEOUT_MS: () => TRANSACTION_REVIEW_TIMEOUT_MS
47
47
  });
48
48
  module.exports = __toCommonJS(constants_exports);
49
- const PARA_CORE_VERSION = "2.27.0";
49
+ const PARA_CORE_VERSION = "2.28.0";
50
50
  const PREFIX = "@CAPSULE/";
51
51
  const PARA_PREFIX = "@PARA/";
52
52
  const LOCAL_STORAGE_AUTH_INFO = `${PREFIX}authInfo`;
package/dist/cjs/index.js CHANGED
@@ -82,6 +82,7 @@ __export(src_exports, {
82
82
  getNetworkPrefix: () => import_onRamps.getNetworkPrefix,
83
83
  getOnRampAssets: () => import_onRamps.getOnRampAssets,
84
84
  getOnRampNetworks: () => import_onRamps.getOnRampNetworks,
85
+ getParaConnectBaseUrl: () => import_url.getParaConnectBaseUrl,
85
86
  getPortalBaseURL: () => import_url.getPortalBaseURL,
86
87
  getPortalDomain: () => import_utils.getPortalDomain,
87
88
  getPublicKeyFromSignature: () => import_utils2.getPublicKeyFromSignature,
@@ -182,6 +183,7 @@ var src_default = import_ParaCore.ParaCore;
182
183
  getNetworkPrefix,
183
184
  getOnRampAssets,
184
185
  getOnRampNetworks,
186
+ getParaConnectBaseUrl,
185
187
  getPortalBaseURL,
186
188
  getPortalDomain,
187
189
  getPublicKeyFromSignature,
@@ -687,7 +687,7 @@ class AuthService {
687
687
  const { url } = yield this.getNewCredentialAndUrl({ isForNewDevice: true, authMethod });
688
688
  return url;
689
689
  });
690
- this.resendVerificationCode = (_0) => __async(this, [_0], function* ({ type: reason = "SIGNUP" }) {
690
+ this.resendVerificationCode = (_0) => __async(this, [_0], function* ({ type: reason = "SIGNUP", deliveryChannel }) {
691
691
  let type, linkedAccountId;
692
692
  switch (reason) {
693
693
  case "SIGNUP":
@@ -709,10 +709,11 @@ class AuthService {
709
709
  if (type !== "EMAIL" && type !== "PHONE") {
710
710
  throw new Error("invalid auth type for verification code");
711
711
  }
712
- yield __privateGet(this, _paraCoreInterface).ctx.client.resendVerificationCode(__spreadValues({
712
+ return yield __privateGet(this, _paraCoreInterface).ctx.client.resendVerificationCode(__spreadValues({
713
713
  userId,
714
714
  type,
715
- linkedAccountId
715
+ linkedAccountId,
716
+ deliveryChannel
716
717
  }, __privateGet(this, _paraCoreInterface).getVerificationEmailProps()));
717
718
  });
718
719
  __privateSet(this, _paraCoreInterface, paraCore.getAuthServiceInterface());
@@ -115,7 +115,7 @@ const _CoreStateManager = class _CoreStateManager {
115
115
  * Extracts all data needed by UI consumers from authStateResult.
116
116
  */
117
117
  computeAuthStateInfo(authContext, walletContext) {
118
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B;
118
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B, _C, _D, _E;
119
119
  const defaultAuthStateInfo = {
120
120
  userId: null,
121
121
  isPasskeySupported: false,
@@ -129,6 +129,9 @@ const _CoreStateManager = class _CoreStateManager {
129
129
  pinUrl: null,
130
130
  passkeyId: null,
131
131
  verificationUrl: null,
132
+ deliveryChannel: null,
133
+ fallbackUsed: false,
134
+ fallbackChannel: null,
132
135
  externalWalletVerification: null,
133
136
  recoverySecret: null,
134
137
  isNewUser: false
@@ -164,6 +167,9 @@ const _CoreStateManager = class _CoreStateManager {
164
167
  let verificationUrl = null;
165
168
  let passkeyHints = null;
166
169
  let passkeyId = null;
170
+ let deliveryChannel = null;
171
+ let fallbackUsed = false;
172
+ let fallbackChannel = null;
167
173
  if (stage === "login") {
168
174
  const loginState = authStateResult;
169
175
  const authMethods = (_j = loginState.loginAuthMethods) != null ? _j : [];
@@ -190,6 +196,9 @@ const _CoreStateManager = class _CoreStateManager {
190
196
  } else if (stage === "verify") {
191
197
  const verifyState = authStateResult;
192
198
  verificationUrl = (_w = verifyState.loginUrl) != null ? _w : null;
199
+ deliveryChannel = (_x = verifyState.deliveryChannel) != null ? _x : null;
200
+ fallbackUsed = (_y = verifyState.fallbackUsed) != null ? _y : false;
201
+ fallbackChannel = (_z = verifyState.fallbackChannel) != null ? _z : null;
193
202
  }
194
203
  return {
195
204
  userId,
@@ -204,10 +213,13 @@ const _CoreStateManager = class _CoreStateManager {
204
213
  pinUrl,
205
214
  passkeyId,
206
215
  verificationUrl,
216
+ deliveryChannel,
217
+ fallbackUsed,
218
+ fallbackChannel,
207
219
  externalWalletVerification: externalWalletVerification ? {
208
- signatureVerificationMessage: (_x = externalWalletVerification.signatureVerificationMessage) != null ? _x : "",
209
- walletAddress: (_z = (_y = externalWalletVerification.externalWallet) == null ? void 0 : _y.address) != null ? _z : "",
210
- walletType: (_B = (_A = externalWalletVerification.externalWallet) == null ? void 0 : _A.type) != null ? _B : ""
220
+ signatureVerificationMessage: (_A = externalWalletVerification.signatureVerificationMessage) != null ? _A : "",
221
+ walletAddress: (_C = (_B = externalWalletVerification.externalWallet) == null ? void 0 : _B.address) != null ? _C : "",
222
+ walletType: (_E = (_D = externalWalletVerification.externalWallet) == null ? void 0 : _D.type) != null ? _E : ""
211
223
  } : null,
212
224
  recoverySecret,
213
225
  isNewUser
@@ -268,7 +280,7 @@ const _CoreStateManager = class _CoreStateManager {
268
280
  }
269
281
  authStateInfoEqual(a, b) {
270
282
  var _a, _b, _c, _d, _e, _f, _g, _h, _i;
271
- return a.userId === b.userId && a.isPasskeySupported === b.isPasskeySupported && a.hasPasskey === b.hasPasskey && a.hasPassword === b.hasPassword && a.hasPin === b.hasPin && a.passkeyUrl === b.passkeyUrl && a.passkeyKnownDeviceUrl === b.passkeyKnownDeviceUrl && a.passwordUrl === b.passwordUrl && a.pinUrl === b.pinUrl && a.passkeyId === b.passkeyId && a.verificationUrl === b.verificationUrl && a.recoverySecret === b.recoverySecret && a.isNewUser === b.isNewUser && ((_a = a.externalWalletVerification) == null ? void 0 : _a.signatureVerificationMessage) === ((_b = b.externalWalletVerification) == null ? void 0 : _b.signatureVerificationMessage) && ((_c = a.externalWalletVerification) == null ? void 0 : _c.walletAddress) === ((_d = b.externalWalletVerification) == null ? void 0 : _d.walletAddress) && ((_e = a.externalWalletVerification) == null ? void 0 : _e.walletType) === ((_f = b.externalWalletVerification) == null ? void 0 : _f.walletType) && ((_g = a.passkeyHints) == null ? void 0 : _g.length) === ((_h = b.passkeyHints) == null ? void 0 : _h.length) && ((_i = a.passkeyHints) != null ? _i : []).every(
283
+ return a.userId === b.userId && a.isPasskeySupported === b.isPasskeySupported && a.hasPasskey === b.hasPasskey && a.hasPassword === b.hasPassword && a.hasPin === b.hasPin && a.passkeyUrl === b.passkeyUrl && a.passkeyKnownDeviceUrl === b.passkeyKnownDeviceUrl && a.passwordUrl === b.passwordUrl && a.pinUrl === b.pinUrl && a.passkeyId === b.passkeyId && a.verificationUrl === b.verificationUrl && a.deliveryChannel === b.deliveryChannel && a.fallbackUsed === b.fallbackUsed && a.fallbackChannel === b.fallbackChannel && a.recoverySecret === b.recoverySecret && a.isNewUser === b.isNewUser && ((_a = a.externalWalletVerification) == null ? void 0 : _a.signatureVerificationMessage) === ((_b = b.externalWalletVerification) == null ? void 0 : _b.signatureVerificationMessage) && ((_c = a.externalWalletVerification) == null ? void 0 : _c.walletAddress) === ((_d = b.externalWalletVerification) == null ? void 0 : _d.walletAddress) && ((_e = a.externalWalletVerification) == null ? void 0 : _e.walletType) === ((_f = b.externalWalletVerification) == null ? void 0 : _f.walletType) && ((_g = a.passkeyHints) == null ? void 0 : _g.length) === ((_h = b.passkeyHints) == null ? void 0 : _h.length) && ((_i = a.passkeyHints) != null ? _i : []).every(
272
284
  (hint, i) => hint.useragent === b.passkeyHints[i].useragent && hint.aaguid === b.passkeyHints[i].aaguid
273
285
  );
274
286
  }
@@ -215,6 +215,28 @@ function createWalletStateMachine(paraCoreInterface) {
215
215
  ]
216
216
  },
217
217
  needs_wallets: {
218
+ // `needs_wallets` is otherwise a passive state that waits for the consumer
219
+ // to dispatch `WAIT_FOR_WALLET_CREATION`. That contract is fine for
220
+ // `isNewUser` reaching this state without auto-create (`checking_wallet_state`
221
+ // guard at line ~127), but it traps existing users who landed here via
222
+ // `waiting_for_wallets` COMPLETE with `needsWallet=true` — i.e., an
223
+ // authenticated user whose wallets don't satisfy the partner's
224
+ // `supportedWalletTypes` (e.g. EVM-only user logging into a Solana-only
225
+ // partner). Their auth flow set `shouldAutoCreateWallets: true` via
226
+ // `authenticateWithOAuth` / `authenticateWithEmailOrPhone`, but the
227
+ // existing `claiming_wallets` guard requires `isNewUser ||
228
+ // shouldClaimGuestWallets`, neither of which is true for them, so
229
+ // auto-create silently never happens.
230
+ //
231
+ // When `shouldAutoCreate` is true, route directly to `creating_wallets`.
232
+ // `createWalletPerType` is partner-aware via `#getMissingTypes`, so it
233
+ // provisions exactly the missing required types (no duplicates).
234
+ always: [
235
+ {
236
+ target: "creating_wallets",
237
+ guard: "shouldAutoCreate"
238
+ }
239
+ ],
218
240
  on: {
219
241
  WAIT_FOR_WALLET_CREATION: {
220
242
  target: "claiming_wallets",
@@ -45,7 +45,12 @@ function formatStateError(error, defaultMessage) {
45
45
  return new Error(error);
46
46
  }
47
47
  if (error && typeof error === "object" && "message" in error) {
48
- return new Error(String(error.message));
48
+ const src = error;
49
+ const normalized = Object.assign(new Error(String(src.message)), {});
50
+ if ("code" in src) normalized.code = src.code;
51
+ if ("status" in src) normalized.status = src.status;
52
+ if ("data" in src) normalized.data = src.data;
53
+ return normalized;
49
54
  }
50
55
  if (error && typeof error === "object" && "error" in error) {
51
56
  return formatStateError(error.error, defaultMessage);
@@ -1348,6 +1348,15 @@ const _ParaCore = class _ParaCore {
1348
1348
  if (!wallet) {
1349
1349
  throw new Error("wallet not found");
1350
1350
  }
1351
+ if (wallet.scheme === "ED25519") {
1352
+ return yield this.platformUtils.getED25519PrivateKey(
1353
+ this.ctx,
1354
+ this.userId,
1355
+ wallet.id,
1356
+ wallet.signer,
1357
+ this.retrieveSessionCookie()
1358
+ );
1359
+ }
1351
1360
  if (wallet.scheme !== "DKLS") {
1352
1361
  throw new Error("invalid wallet scheme");
1353
1362
  }
@@ -1522,8 +1531,8 @@ const _ParaCore = class _ParaCore {
1522
1531
  * Resend a verification email for the current user.
1523
1532
  */
1524
1533
  resendVerificationCode(_0) {
1525
- return __async(this, arguments, function* ({ type: reason = "SIGNUP" }) {
1526
- return yield __privateGet(this, _authService).resendVerificationCode({ type: reason });
1534
+ return __async(this, arguments, function* ({ type: reason = "SIGNUP", deliveryChannel }) {
1535
+ return yield __privateGet(this, _authService).resendVerificationCode({ type: reason, deliveryChannel });
1527
1536
  });
1528
1537
  }
1529
1538
  /**
@@ -2759,15 +2768,16 @@ const _ParaCore = class _ParaCore {
2759
2768
  }
2760
2769
  sendLoginCode() {
2761
2770
  return __async(this, null, function* () {
2762
- const { userId } = yield this.ctx.client.sendLoginVerificationCode(this.authInfo);
2771
+ const { userId, deliveryChannel, fallbackUsed, fallbackChannel, isSmsAllowed } = yield this.ctx.client.sendLoginVerificationCode(this.authInfo);
2763
2772
  this.setUserId(userId);
2773
+ return { deliveryChannel, fallbackUsed, fallbackChannel, isSmsAllowed };
2764
2774
  });
2765
2775
  }
2766
2776
  exportPrivateKey() {
2767
2777
  return __async(this, arguments, function* (args = {}) {
2768
2778
  let walletId = args == null ? void 0 : args.walletId;
2769
2779
  if (!(args == null ? void 0 : args.walletId)) {
2770
- walletId = this.findWalletId(void 0, { forbidPregen: true, scheme: ["DKLS"] });
2780
+ walletId = this.findWalletId(void 0, { forbidPregen: true, scheme: ["DKLS", "ED25519"] });
2771
2781
  }
2772
2782
  const wallet = this.wallets[walletId];
2773
2783
  if (this.externalWallets[walletId]) {
@@ -2776,9 +2786,6 @@ const _ParaCore = class _ParaCore {
2776
2786
  if (!wallet || !wallet.signer) {
2777
2787
  throw new Error("Wallet not found with id: " + walletId);
2778
2788
  }
2779
- if (wallet.scheme !== "DKLS") {
2780
- throw new Error("Cannot export private key for a Solana wallet");
2781
- }
2782
2789
  if (wallet.isPregen && !!wallet.pregenIdentifier && wallet.pregenIdentifierType !== "GUEST_ID") {
2783
2790
  throw new Error("Cannot export private key for a pregenerated wallet");
2784
2791
  }
@@ -1,5 +1,5 @@
1
1
  import "./chunk-7B52C2XE.js";
2
- const PARA_CORE_VERSION = "2.27.0";
2
+ const PARA_CORE_VERSION = "2.28.0";
3
3
  const PREFIX = "@CAPSULE/";
4
4
  const PARA_PREFIX = "@PARA/";
5
5
  const LOCAL_STORAGE_AUTH_INFO = `${PREFIX}authInfo`;
package/dist/esm/index.js CHANGED
@@ -83,7 +83,7 @@ export * from "./utils/phone.js";
83
83
  export * from "./utils/config.js";
84
84
  import { isWalletSupported } from "./utils/wallet.js";
85
85
  import { getNetworkPrefix, getOnRampAssets, getOnRampNetworks, toAssetInfoArray } from "./utils/onRamps.js";
86
- import { getPortalBaseURL } from "./utils/url.js";
86
+ import { getPortalBaseURL, getParaConnectBaseUrl } from "./utils/url.js";
87
87
  import { retrieve } from "./transmission/transmissionUtils.js";
88
88
  const paraVersion = ParaCore.version;
89
89
  var src_default = ParaCore;
@@ -142,6 +142,7 @@ export {
142
142
  getNetworkPrefix,
143
143
  getOnRampAssets,
144
144
  getOnRampNetworks,
145
+ getParaConnectBaseUrl,
145
146
  getPortalBaseURL,
146
147
  getPortalDomain,
147
148
  getPublicKeyFromSignature,
@@ -618,7 +618,7 @@ class AuthService {
618
618
  const { url } = yield this.getNewCredentialAndUrl({ isForNewDevice: true, authMethod });
619
619
  return url;
620
620
  });
621
- this.resendVerificationCode = (_0) => __async(this, [_0], function* ({ type: reason = "SIGNUP" }) {
621
+ this.resendVerificationCode = (_0) => __async(this, [_0], function* ({ type: reason = "SIGNUP", deliveryChannel }) {
622
622
  let type, linkedAccountId;
623
623
  switch (reason) {
624
624
  case "SIGNUP":
@@ -640,10 +640,11 @@ class AuthService {
640
640
  if (type !== "EMAIL" && type !== "PHONE") {
641
641
  throw new Error("invalid auth type for verification code");
642
642
  }
643
- yield __privateGet(this, _paraCoreInterface).ctx.client.resendVerificationCode(__spreadValues({
643
+ return yield __privateGet(this, _paraCoreInterface).ctx.client.resendVerificationCode(__spreadValues({
644
644
  userId,
645
645
  type,
646
- linkedAccountId
646
+ linkedAccountId,
647
+ deliveryChannel
647
648
  }, __privateGet(this, _paraCoreInterface).getVerificationEmailProps()));
648
649
  });
649
650
  __privateSet(this, _paraCoreInterface, paraCore.getAuthServiceInterface());
@@ -80,7 +80,7 @@ const _CoreStateManager = class _CoreStateManager {
80
80
  * Extracts all data needed by UI consumers from authStateResult.
81
81
  */
82
82
  computeAuthStateInfo(authContext, walletContext) {
83
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B;
83
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B, _C, _D, _E;
84
84
  const defaultAuthStateInfo = {
85
85
  userId: null,
86
86
  isPasskeySupported: false,
@@ -94,6 +94,9 @@ const _CoreStateManager = class _CoreStateManager {
94
94
  pinUrl: null,
95
95
  passkeyId: null,
96
96
  verificationUrl: null,
97
+ deliveryChannel: null,
98
+ fallbackUsed: false,
99
+ fallbackChannel: null,
97
100
  externalWalletVerification: null,
98
101
  recoverySecret: null,
99
102
  isNewUser: false
@@ -129,6 +132,9 @@ const _CoreStateManager = class _CoreStateManager {
129
132
  let verificationUrl = null;
130
133
  let passkeyHints = null;
131
134
  let passkeyId = null;
135
+ let deliveryChannel = null;
136
+ let fallbackUsed = false;
137
+ let fallbackChannel = null;
132
138
  if (stage === "login") {
133
139
  const loginState = authStateResult;
134
140
  const authMethods = (_j = loginState.loginAuthMethods) != null ? _j : [];
@@ -155,6 +161,9 @@ const _CoreStateManager = class _CoreStateManager {
155
161
  } else if (stage === "verify") {
156
162
  const verifyState = authStateResult;
157
163
  verificationUrl = (_w = verifyState.loginUrl) != null ? _w : null;
164
+ deliveryChannel = (_x = verifyState.deliveryChannel) != null ? _x : null;
165
+ fallbackUsed = (_y = verifyState.fallbackUsed) != null ? _y : false;
166
+ fallbackChannel = (_z = verifyState.fallbackChannel) != null ? _z : null;
158
167
  }
159
168
  return {
160
169
  userId,
@@ -169,10 +178,13 @@ const _CoreStateManager = class _CoreStateManager {
169
178
  pinUrl,
170
179
  passkeyId,
171
180
  verificationUrl,
181
+ deliveryChannel,
182
+ fallbackUsed,
183
+ fallbackChannel,
172
184
  externalWalletVerification: externalWalletVerification ? {
173
- signatureVerificationMessage: (_x = externalWalletVerification.signatureVerificationMessage) != null ? _x : "",
174
- walletAddress: (_z = (_y = externalWalletVerification.externalWallet) == null ? void 0 : _y.address) != null ? _z : "",
175
- walletType: (_B = (_A = externalWalletVerification.externalWallet) == null ? void 0 : _A.type) != null ? _B : ""
185
+ signatureVerificationMessage: (_A = externalWalletVerification.signatureVerificationMessage) != null ? _A : "",
186
+ walletAddress: (_C = (_B = externalWalletVerification.externalWallet) == null ? void 0 : _B.address) != null ? _C : "",
187
+ walletType: (_E = (_D = externalWalletVerification.externalWallet) == null ? void 0 : _D.type) != null ? _E : ""
176
188
  } : null,
177
189
  recoverySecret,
178
190
  isNewUser
@@ -233,7 +245,7 @@ const _CoreStateManager = class _CoreStateManager {
233
245
  }
234
246
  authStateInfoEqual(a, b) {
235
247
  var _a, _b, _c, _d, _e, _f, _g, _h, _i;
236
- return a.userId === b.userId && a.isPasskeySupported === b.isPasskeySupported && a.hasPasskey === b.hasPasskey && a.hasPassword === b.hasPassword && a.hasPin === b.hasPin && a.passkeyUrl === b.passkeyUrl && a.passkeyKnownDeviceUrl === b.passkeyKnownDeviceUrl && a.passwordUrl === b.passwordUrl && a.pinUrl === b.pinUrl && a.passkeyId === b.passkeyId && a.verificationUrl === b.verificationUrl && a.recoverySecret === b.recoverySecret && a.isNewUser === b.isNewUser && ((_a = a.externalWalletVerification) == null ? void 0 : _a.signatureVerificationMessage) === ((_b = b.externalWalletVerification) == null ? void 0 : _b.signatureVerificationMessage) && ((_c = a.externalWalletVerification) == null ? void 0 : _c.walletAddress) === ((_d = b.externalWalletVerification) == null ? void 0 : _d.walletAddress) && ((_e = a.externalWalletVerification) == null ? void 0 : _e.walletType) === ((_f = b.externalWalletVerification) == null ? void 0 : _f.walletType) && ((_g = a.passkeyHints) == null ? void 0 : _g.length) === ((_h = b.passkeyHints) == null ? void 0 : _h.length) && ((_i = a.passkeyHints) != null ? _i : []).every(
248
+ return a.userId === b.userId && a.isPasskeySupported === b.isPasskeySupported && a.hasPasskey === b.hasPasskey && a.hasPassword === b.hasPassword && a.hasPin === b.hasPin && a.passkeyUrl === b.passkeyUrl && a.passkeyKnownDeviceUrl === b.passkeyKnownDeviceUrl && a.passwordUrl === b.passwordUrl && a.pinUrl === b.pinUrl && a.passkeyId === b.passkeyId && a.verificationUrl === b.verificationUrl && a.deliveryChannel === b.deliveryChannel && a.fallbackUsed === b.fallbackUsed && a.fallbackChannel === b.fallbackChannel && a.recoverySecret === b.recoverySecret && a.isNewUser === b.isNewUser && ((_a = a.externalWalletVerification) == null ? void 0 : _a.signatureVerificationMessage) === ((_b = b.externalWalletVerification) == null ? void 0 : _b.signatureVerificationMessage) && ((_c = a.externalWalletVerification) == null ? void 0 : _c.walletAddress) === ((_d = b.externalWalletVerification) == null ? void 0 : _d.walletAddress) && ((_e = a.externalWalletVerification) == null ? void 0 : _e.walletType) === ((_f = b.externalWalletVerification) == null ? void 0 : _f.walletType) && ((_g = a.passkeyHints) == null ? void 0 : _g.length) === ((_h = b.passkeyHints) == null ? void 0 : _h.length) && ((_i = a.passkeyHints) != null ? _i : []).every(
237
249
  (hint, i) => hint.useragent === b.passkeyHints[i].useragent && hint.aaguid === b.passkeyHints[i].aaguid
238
250
  );
239
251
  }
@@ -161,6 +161,28 @@ function createWalletStateMachine(paraCoreInterface) {
161
161
  ]
162
162
  },
163
163
  needs_wallets: {
164
+ // `needs_wallets` is otherwise a passive state that waits for the consumer
165
+ // to dispatch `WAIT_FOR_WALLET_CREATION`. That contract is fine for
166
+ // `isNewUser` reaching this state without auto-create (`checking_wallet_state`
167
+ // guard at line ~127), but it traps existing users who landed here via
168
+ // `waiting_for_wallets` COMPLETE with `needsWallet=true` — i.e., an
169
+ // authenticated user whose wallets don't satisfy the partner's
170
+ // `supportedWalletTypes` (e.g. EVM-only user logging into a Solana-only
171
+ // partner). Their auth flow set `shouldAutoCreateWallets: true` via
172
+ // `authenticateWithOAuth` / `authenticateWithEmailOrPhone`, but the
173
+ // existing `claiming_wallets` guard requires `isNewUser ||
174
+ // shouldClaimGuestWallets`, neither of which is true for them, so
175
+ // auto-create silently never happens.
176
+ //
177
+ // When `shouldAutoCreate` is true, route directly to `creating_wallets`.
178
+ // `createWalletPerType` is partner-aware via `#getMissingTypes`, so it
179
+ // provisions exactly the missing required types (no duplicates).
180
+ always: [
181
+ {
182
+ target: "creating_wallets",
183
+ guard: "shouldAutoCreate"
184
+ }
185
+ ],
164
186
  on: {
165
187
  WAIT_FOR_WALLET_CREATION: {
166
188
  target: "claiming_wallets",
@@ -23,7 +23,12 @@ function formatStateError(error, defaultMessage) {
23
23
  return new Error(error);
24
24
  }
25
25
  if (error && typeof error === "object" && "message" in error) {
26
- return new Error(String(error.message));
26
+ const src = error;
27
+ const normalized = Object.assign(new Error(String(src.message)), {});
28
+ if ("code" in src) normalized.code = src.code;
29
+ if ("status" in src) normalized.status = src.status;
30
+ if ("data" in src) normalized.data = src.data;
31
+ return normalized;
27
32
  }
28
33
  if (error && typeof error === "object" && "error" in error) {
29
34
  return formatStateError(error.error, defaultMessage);
@@ -489,7 +489,7 @@ export declare abstract class ParaCore implements CoreInterface {
489
489
  /**
490
490
  * Resend a verification email for the current user.
491
491
  */
492
- resendVerificationCode({ type: reason }: ResendVerificationCodeParams): Promise<void>;
492
+ resendVerificationCode({ type: reason, deliveryChannel }: ResendVerificationCodeParams): Promise<import("./services/types").ResendVerificationCodeResponse>;
493
493
  /**
494
494
  * Checks if the current session is active.
495
495
  * @returns `true` if active, `false` otherwise
@@ -866,6 +866,11 @@ export declare abstract class ParaCore implements CoreInterface {
866
866
  config?: BalancesConfig;
867
867
  refetch?: boolean;
868
868
  }): Promise<import("@getpara/user-management-client").ProfileBalance>;
869
- protected sendLoginCode(): Promise<void>;
869
+ protected sendLoginCode(): Promise<{
870
+ deliveryChannel: import("@getpara/user-management-client").DeliveryChannel;
871
+ fallbackUsed: boolean;
872
+ fallbackChannel: import("@getpara/user-management-client").DeliveryChannel;
873
+ isSmsAllowed: boolean;
874
+ }>;
870
875
  exportPrivateKey(args?: CoreMethodParams<'exportPrivateKey'>): CoreMethodResponse<'exportPrivateKey'>;
871
876
  }
@@ -10,6 +10,7 @@ export type EventHandler<T = any> = (data: T) => void;
10
10
  export interface PlatformUtils {
11
11
  sdkType: SDKType;
12
12
  getPrivateKey(ctx: Ctx, userId: string, walletId: string, share: string, sessionCookie: string): Promise<string>;
13
+ getED25519PrivateKey(ctx: Ctx, userId: string, walletId: string, share: string, sessionCookie: string): Promise<string>;
13
14
  keygen(ctx: Ctx, userId: string, type: Exclude<TWalletType, 'SOLANA'>, secretKey: string | null, // should be acceptable as null in RN as we don't pre-gen them
14
15
  sessionCookie: string, emailProps?: BackupKitEmailProps): Promise<{
15
16
  signer: string;
@@ -22,7 +22,7 @@ export * from './utils/phone.js';
22
22
  export * from './utils/config.js';
23
23
  export { isWalletSupported } from './utils/wallet.js';
24
24
  export { getNetworkPrefix, getOnRampAssets, getOnRampNetworks, toAssetInfoArray } from './utils/onRamps.js';
25
- export { getPortalBaseURL } from './utils/url.js';
25
+ export { getPortalBaseURL, getParaConnectBaseUrl } from './utils/url.js';
26
26
  export { retrieve as transmissionUtilsRetrieve } from './transmission/transmissionUtils.js';
27
27
  export type { ShareData } from './shares/enclave.js';
28
28
  export type { StateSnapshot, AuthStateInfo } from './state/types/core';
@@ -1,4 +1,4 @@
1
- import type { Auth, AuthExtras, AuthMethod, AuthType, ExternalWalletInfo, PrimaryAuth, PrimaryAuthInfo, ServerAuthState, ServerAuthStateLogin, TAuthMethod, Theme, TOAuthMethod } from '@getpara/user-management-client';
1
+ import type { Auth, AuthExtras, AuthMethod, AuthType, DeliveryChannel, ExternalWalletInfo, PrimaryAuth, PrimaryAuthInfo, ServerAuthState, ServerAuthStateLogin, TAuthMethod, Theme, TOAuthMethod } from '@getpara/user-management-client';
2
2
  import type { AuthState, AuthStateDone, AuthStateLogin, AuthStateSignup, AuthStateVerify, CoreAuthInfo, WithCustomTheme, WithSessionLookupId, WithShorten, WithUseShortUrls } from '../../types/index.js';
3
3
  import type { InitOAuthPollingParams, PollingCallbacks } from './PollingServiceTypes.js';
4
4
  import { PerformConnectExternalWalletResponse, ExternalSignMessageParams } from './ExternalWalletServiceTypes.js';
@@ -142,6 +142,13 @@ export type AddCredentialMethod = (_: AddCredentialParams) => Promise<string | u
142
142
  export type SupportedUserAuthMethodsMethod = () => Promise<Set<AuthMethod>>;
143
143
  export interface ResendVerificationCodeParams {
144
144
  type?: 'SIGNUP' | 'LINK_ACCOUNT' | 'LOGIN';
145
+ deliveryChannel?: DeliveryChannel;
145
146
  }
146
- export type ResendVerificationCodeMethod = (_: ResendVerificationCodeParams) => Promise<void>;
147
+ export interface ResendVerificationCodeResponse {
148
+ deliveryChannel?: DeliveryChannel;
149
+ fallbackUsed?: boolean;
150
+ fallbackChannel?: DeliveryChannel;
151
+ isSmsAllowed?: boolean;
152
+ }
153
+ export type ResendVerificationCodeMethod = (_: ResendVerificationCodeParams) => Promise<ResendVerificationCodeResponse>;
147
154
  export {};
@@ -2784,6 +2784,10 @@ export declare function createCoreStateMachine(paraCoreInterface: StateMachineIn
2784
2784
  }];
2785
2785
  };
2786
2786
  readonly needs_wallets: {
2787
+ readonly always: readonly [{
2788
+ readonly target: "creating_wallets";
2789
+ readonly guard: "shouldAutoCreate";
2790
+ }];
2787
2791
  readonly on: {
2788
2792
  readonly WAIT_FOR_WALLET_CREATION: {
2789
2793
  readonly target: "claiming_wallets";
@@ -6426,6 +6430,10 @@ export declare function createCoreStateMachine(paraCoreInterface: StateMachineIn
6426
6430
  }];
6427
6431
  };
6428
6432
  readonly needs_wallets: {
6433
+ readonly always: readonly [{
6434
+ readonly target: "creating_wallets";
6435
+ readonly guard: "shouldAutoCreate";
6436
+ }];
6429
6437
  readonly on: {
6430
6438
  readonly WAIT_FOR_WALLET_CREATION: {
6431
6439
  readonly target: "claiming_wallets";
@@ -10141,6 +10149,10 @@ export declare function createCoreStateMachine(paraCoreInterface: StateMachineIn
10141
10149
  }];
10142
10150
  };
10143
10151
  readonly needs_wallets: {
10152
+ readonly always: readonly [{
10153
+ readonly target: "creating_wallets";
10154
+ readonly guard: "shouldAutoCreate";
10155
+ }];
10144
10156
  readonly on: {
10145
10157
  readonly WAIT_FOR_WALLET_CREATION: {
10146
10158
  readonly target: "claiming_wallets";
@@ -13794,6 +13806,10 @@ export declare function createCoreStateMachine(paraCoreInterface: StateMachineIn
13794
13806
  }];
13795
13807
  };
13796
13808
  readonly needs_wallets: {
13809
+ readonly always: readonly [{
13810
+ readonly target: "creating_wallets";
13811
+ readonly guard: "shouldAutoCreate";
13812
+ }];
13797
13813
  readonly on: {
13798
13814
  readonly WAIT_FOR_WALLET_CREATION: {
13799
13815
  readonly target: "claiming_wallets";
@@ -17541,6 +17557,10 @@ export declare function createCoreStateMachine(paraCoreInterface: StateMachineIn
17541
17557
  }];
17542
17558
  };
17543
17559
  readonly needs_wallets: {
17560
+ readonly always: readonly [{
17561
+ readonly target: "creating_wallets";
17562
+ readonly guard: "shouldAutoCreate";
17563
+ }];
17544
17564
  readonly on: {
17545
17565
  readonly WAIT_FOR_WALLET_CREATION: {
17546
17566
  readonly target: "claiming_wallets";
@@ -21195,6 +21215,10 @@ export declare function createCoreStateMachine(paraCoreInterface: StateMachineIn
21195
21215
  }];
21196
21216
  };
21197
21217
  readonly needs_wallets: {
21218
+ readonly always: readonly [{
21219
+ readonly target: "creating_wallets";
21220
+ readonly guard: "shouldAutoCreate";
21221
+ }];
21198
21222
  readonly on: {
21199
21223
  readonly WAIT_FOR_WALLET_CREATION: {
21200
21224
  readonly target: "claiming_wallets";
@@ -211,6 +211,10 @@ export declare function createWalletStateMachine(paraCoreInterface: StateMachine
211
211
  }];
212
212
  };
213
213
  readonly needs_wallets: {
214
+ readonly always: readonly [{
215
+ readonly target: "creating_wallets";
216
+ readonly guard: "shouldAutoCreate";
217
+ }];
214
218
  readonly on: {
215
219
  readonly WAIT_FOR_WALLET_CREATION: {
216
220
  readonly target: "claiming_wallets";
@@ -1,4 +1,4 @@
1
- import type { BiometricLocationHint, CurrentWalletIds, ServerAuthState } from '@getpara/user-management-client';
1
+ import type { BiometricLocationHint, CurrentWalletIds, DeliveryChannel, ServerAuthState } from '@getpara/user-management-client';
2
2
  import type { AuthState, Wallet, WithCustomTheme, WithUseShortUrls } from '../../types/index.js';
3
3
  import { AuthMachine, AuthPhase } from './auth.js';
4
4
  import { WalletMachine, WalletPhase } from './wallet.js';
@@ -87,6 +87,12 @@ export type AuthStateInfo = {
87
87
  passkeyId: string | null;
88
88
  /** Verification URL for email/phone verification in SLO */
89
89
  verificationUrl: string | null;
90
+ /** Channel the OTP was sent over — set on phone verifications so the UI can render channel-specific copy */
91
+ deliveryChannel: DeliveryChannel | null;
92
+ /** True when the server had to fall back from the primary channel (WhatsApp → SMS typically) */
93
+ fallbackUsed: boolean;
94
+ /** The channel actually used when fallbackUsed is true */
95
+ fallbackChannel: DeliveryChannel | null;
90
96
  /** External wallet verification data when signature is needed */
91
97
  externalWalletVerification: {
92
98
  signatureVerificationMessage: string;
@@ -1,9 +1,9 @@
1
- import { ExternalWalletInfo, OnRampPurchase, OnRampPurchaseCreateParams, Setup2faResponse, VerifiedAuth, WalletEntity, WalletParams, TWalletType, IssueJwtParams, IssueJwtResponse, TLinkedAccountType, LinkedAccounts, AuthMethod } from '@getpara/user-management-client';
1
+ import { ExternalWalletInfo, OnRampPurchase, OnRampPurchaseCreateParams, Setup2faResponse, VerifiedAuth, WalletEntity, WalletParams, TWalletType, IssueJwtParams, IssueJwtResponse, TLinkedAccountType, LinkedAccounts, AuthMethod, DeliveryChannel } from '@getpara/user-management-client';
2
2
  import type { OAuthResponse, WithCustomTheme, WithUseShortUrls, Verify2faParams, Verify2faResponse, AuthStateSignup, StorageType, CoreAuthInfo, TelegramParams } from './';
3
3
  import { ParaCore } from '../ParaCore.js';
4
4
  import { FullSignatureRes, Wallet } from './wallet.js';
5
5
  import { AccountLinkInProgress } from './accountLinking.js';
6
- import type { WaitForLoginParams, WaitForLoginResponse, WaitForSignupParams, WaitForWalletCreationParams, WaitForWalletCreationResponse, GetOAuthUrlParams, AddCredentialParams, LoginExternalWalletParams, LoginExternalWalletResponse, ResendVerificationCodeParams, SignUpOrLogInParams, SignUpOrLogInResponse, VerifyOAuthProcessParams, VerifyExternalWalletParams, VerifyExternalWalletResponse, VerifyFarcasterParams, VerifyTelegramParams, ClaimPregenWalletsParams, ClaimPregenWalletsResponse, CreateGuestWalletsResponse, CreatePregenWalletParams, CreatePregenWalletPerTypeParams, CreatePregenWalletPerTypeResponse, CreatePregenWalletResponse, CreateWalletParams, CreateWalletPerTypeParams, CreateWalletPerTypeResponse, CreateWalletResponse, DistributeNewWalletShareParams, GetPregenWalletsParams, GetPregenWalletsResponse, GetWalletBalanceParams, HasPregenWalletParams, PollingCallbacks, RefreshShareParams, RefreshShareResponse, RequestFaucetParams, RequestFaucetResponse, UpdatePregenWalletIdentifierParams, BaseVerifyExternalWalletParams, AuthenticateWithEmailOrPhoneParams, AuthenticateWithEmailOrPhoneResponse, AuthenticateWithOAuthParams, AuthenticateWithOAuthResponse } from '../services/types';
6
+ import type { WaitForLoginParams, WaitForLoginResponse, WaitForSignupParams, WaitForWalletCreationParams, WaitForWalletCreationResponse, GetOAuthUrlParams, AddCredentialParams, LoginExternalWalletParams, LoginExternalWalletResponse, ResendVerificationCodeParams, ResendVerificationCodeResponse, SignUpOrLogInParams, SignUpOrLogInResponse, VerifyOAuthProcessParams, VerifyExternalWalletParams, VerifyExternalWalletResponse, VerifyFarcasterParams, VerifyTelegramParams, ClaimPregenWalletsParams, ClaimPregenWalletsResponse, CreateGuestWalletsResponse, CreatePregenWalletParams, CreatePregenWalletPerTypeParams, CreatePregenWalletPerTypeResponse, CreatePregenWalletResponse, CreateWalletParams, CreateWalletPerTypeParams, CreateWalletPerTypeResponse, CreateWalletResponse, DistributeNewWalletShareParams, GetPregenWalletsParams, GetPregenWalletsResponse, GetWalletBalanceParams, HasPregenWalletParams, PollingCallbacks, RefreshShareParams, RefreshShareResponse, RequestFaucetParams, RequestFaucetResponse, UpdatePregenWalletIdentifierParams, BaseVerifyExternalWalletParams, AuthenticateWithEmailOrPhoneParams, AuthenticateWithEmailOrPhoneResponse, AuthenticateWithOAuthParams, AuthenticateWithOAuthResponse } from '../services/types';
7
7
  export declare const PARA_CORE_METHODS: readonly ["getAuthInfo", "signUpOrLogIn", "verifyNewAccount", "waitForLogin", "waitForSignup", "waitForWalletCreation", "getOAuthUrl", "verifyOAuth", "getFarcasterConnectUri", "verifyFarcaster", "verifyTelegram", "resendVerificationCode", "loginExternalWallet", "verifyExternalWallet", "setup2fa", "enable2fa", "verify2fa", "logout", "clearStorage", "isSessionActive", "isFullyLoggedIn", "refreshSession", "keepSessionAlive", "exportSession", "waitAndExportSession", "importSession", "getVerificationToken", "getWallets", "getWalletsByType", "fetchWallets", "createWallet", "createWalletPerType", "getPregenWallets", "hasPregenWallet", "updatePregenWalletIdentifier", "createPregenWallet", "createPregenWalletPerType", "claimPregenWallets", "createGuestWallets", "distributeNewWalletShare", "getUserShare", "setUserShare", "refreshShare", "signMessage", "signTransaction", "initiateOnRampTransaction", "getWalletBalance", "requestFaucet", "issueJwt", "getLinkedAccounts", "accountLinkInProgress", "addCredential", "exportPrivateKey", "authenticateWithEmailOrPhone", "authenticateWithOAuth"];
8
8
  export declare const PARA_INTERNAL_METHODS: readonly ["linkAccount", "unlinkAccount", "verifyEmailOrPhoneLink", "verifyOAuthLink", "verifyFarcasterLink", "verifyTelegramLink", "verifyExternalWalletLink", "accountLinkInProgress", "prepareLogin", "sendLoginCode", "supportedUserAuthMethods"];
9
9
  export type CoreMethodName = (typeof PARA_CORE_METHODS)[number];
@@ -189,7 +189,7 @@ export type CoreMethods = Record<CoreMethodName, {
189
189
  };
190
190
  resendVerificationCode: {
191
191
  params: ResendVerificationCodeParams;
192
- response: void;
192
+ response: ResendVerificationCodeResponse;
193
193
  };
194
194
  logout: {
195
195
  params: LogoutParams;
@@ -427,7 +427,12 @@ export type InternalMethods = {
427
427
  };
428
428
  sendLoginCode: {
429
429
  params: void;
430
- response: void;
430
+ response: {
431
+ deliveryChannel?: DeliveryChannel;
432
+ fallbackUsed?: boolean;
433
+ fallbackChannel?: DeliveryChannel;
434
+ isSmsAllowed?: boolean;
435
+ };
431
436
  };
432
437
  supportedUserAuthMethods: {
433
438
  params: void;
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@getpara/core-sdk",
3
- "version": "2.27.0",
3
+ "version": "2.28.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": "2.27.0",
8
+ "@getpara/user-management-client": "2.28.0",
9
9
  "@noble/hashes": "^1.5.0",
10
10
  "axios": "^1.8.4",
11
11
  "base64url": "^3.0.1",
@@ -30,7 +30,7 @@
30
30
  "dist",
31
31
  "package.json"
32
32
  ],
33
- "gitHead": "9f3045c8e2b0b372c792a7a35a997d5955f910b1",
33
+ "gitHead": "cb74d2b02aed6a8a5373249418b315d686b83b66",
34
34
  "main": "dist/cjs/index.js",
35
35
  "module": "dist/esm/index.js",
36
36
  "scripts": {