@medialane/sdk 0.138.0 → 0.140.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.
@@ -745,10 +745,8 @@ var ApiClient = class {
745
745
  });
746
746
  }
747
747
  async checkEmail(email) {
748
- const body = await this.get(
749
- `/v1/auth/email/exists?email=${encodeURIComponent(email)}`
750
- );
751
- return { exists: body.exists, walletWaiting: body.walletWaiting === true };
748
+ const body = await this.get(`/v1/auth/email/exists?email=${encodeURIComponent(email)}`);
749
+ return { exists: body.exists };
752
750
  }
753
751
  async requestEmailCode(email) {
754
752
  await this.post("/v1/auth/email/request-code", { email });
@@ -757,15 +755,19 @@ var ApiClient = class {
757
755
  await this.post("/v1/auth/email/register-account", { email });
758
756
  }
759
757
  async verifyEmailCode(email, code) {
760
- const body = await this.post("/v1/auth/email/verify-code", { email, code });
761
- return { waitingWallets: body.waitingWallets ?? [] };
758
+ await this.post("/v1/auth/email/verify-code", { email, code });
762
759
  }
763
- claimWallet(params) {
764
- return this.post("/v1/users/me/claim-wallet", params);
760
+ /**
761
+ * Makes the passkey the only owner of the session account's wallet. `signature` is the passkey's owner-alive
762
+ * proof for the wallet. Answers 409 when the wallet is already set up.
763
+ */
764
+ setupWalletKey(params) {
765
+ return this.post("/v1/users/me/wallet/key", params);
765
766
  }
767
+ /** The session account's wallet, and whether its passkey still has to be set up (`setupWalletKey`). */
766
768
  async getSessionWallet() {
767
769
  const body = await this.post("/v1/users/me/wallet", {});
768
- return body.walletAddress ?? null;
770
+ return body.walletAddress ? { walletAddress: body.walletAddress, needsKeySetup: body.needsKeySetup === true } : null;
769
771
  }
770
772
  getMyWallet(siwsToken) {
771
773
  return this.request(
@@ -12323,9 +12325,9 @@ function mintedTokenIdFromReceipt(receipt, contract) {
12323
12325
  // src/starknet/services/sponsoredExecutor.ts
12324
12326
  var SponsoredCallRejectedError = class extends Error {
12325
12327
  };
12326
- var USER_MAY_PAY = /* @__PURE__ */ new Set(["sponsor_unavailable", "credits_exhausted"]);
12327
- function userMayPayInstead(code, status, stage) {
12328
- if (code) return USER_MAY_PAY.has(code);
12328
+ var FALLBACK_FUNDING_FAILURES = /* @__PURE__ */ new Set(["sponsor_unavailable", "credits_exhausted"]);
12329
+ function allowsFallbackFunding(code, status, stage) {
12330
+ if (code) return FALLBACK_FUNDING_FAILURES.has(code);
12329
12331
  return stage === "build" ? status >= 500 : status === 503;
12330
12332
  }
12331
12333
  async function failureOf(res, fallback) {
@@ -12343,7 +12345,7 @@ async function executeSponsored(config, signer, calls) {
12343
12345
  });
12344
12346
  if (!buildRes.ok) {
12345
12347
  const { reason, code } = await failureOf(buildRes, "We couldn't prepare this transaction.");
12346
- if (userMayPayInstead(code, buildRes.status, "build")) return { status: "unavailable", reason };
12348
+ if (allowsFallbackFunding(code, buildRes.status, "build")) return { status: "unavailable", reason };
12347
12349
  throw new SponsoredCallRejectedError(reason);
12348
12350
  }
12349
12351
  const { typedData } = await buildRes.json();
@@ -12355,7 +12357,7 @@ async function executeSponsored(config, signer, calls) {
12355
12357
  });
12356
12358
  if (!executeRes.ok) {
12357
12359
  const { reason, code } = await failureOf(executeRes, "We couldn't submit this transaction.");
12358
- if (userMayPayInstead(code, executeRes.status, "execute")) {
12360
+ if (allowsFallbackFunding(code, executeRes.status, "execute")) {
12359
12361
  return { status: "unavailable", reason };
12360
12362
  }
12361
12363
  throw new SponsoredCallRejectedError(reason);
@@ -13224,6 +13226,7 @@ exports.UserFacingError = UserFacingError;
13224
13226
  exports.VALIDATED_EKUBO_PARAMS = VALIDATED_EKUBO_PARAMS;
13225
13227
  exports.accountFor = accountFor;
13226
13228
  exports.adminRequestDigest = adminRequestDigest;
13229
+ exports.allowsFallbackFunding = allowsFallbackFunding;
13227
13230
  exports.assertTransactionSucceeded = assertTransactionSucceeded;
13228
13231
  exports.build1155CancellationTypedData = build1155CancellationTypedData;
13229
13232
  exports.build1155OrderTypedData = build1155OrderTypedData;
@@ -13315,7 +13318,6 @@ exports.syncTransactionBestEffort = syncTransactionBestEffort;
13315
13318
  exports.teamCoinsRaw = teamCoinsRaw;
13316
13319
  exports.toDropContractConditions = toContractConditions;
13317
13320
  exports.unsealPrivateKey = unsealPrivateKey;
13318
- exports.userMayPayInstead = userMayPayInstead;
13319
13321
  exports.validateCoinName = validateName;
13320
13322
  exports.validateCoinSupply = validateSupply;
13321
13323
  exports.validateCoinSymbol = validateSymbol;