@medialane/sdk 0.119.0 → 0.119.1

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.
@@ -12029,7 +12029,7 @@ function mintedTokenIdFromReceipt(receipt, contract) {
12029
12029
  // src/starknet/services/sponsoredExecutor.ts
12030
12030
  var SponsoredCallRejectedError = class extends Error {
12031
12031
  };
12032
- var PRE_BROADCAST_EXECUTE_STATUSES = /* @__PURE__ */ new Set([400, 429, 503]);
12032
+ var SPONSOR_UNAVAILABLE_STATUS = 503;
12033
12033
  async function errorReason(res, fallback) {
12034
12034
  const body = await res.json().catch(() => null);
12035
12035
  return body?.error || fallback;
@@ -12043,7 +12043,9 @@ async function executeSponsored(config, signer, calls) {
12043
12043
  body: JSON.stringify({ userAddress: signer.address, calls })
12044
12044
  });
12045
12045
  if (!buildRes.ok) {
12046
- return { status: "unavailable", reason: await errorReason(buildRes, "We couldn't prepare this transaction.") };
12046
+ const reason = await errorReason(buildRes, "We couldn't prepare this transaction.");
12047
+ if (buildRes.status >= 500) return { status: "unavailable", reason };
12048
+ throw new SponsoredCallRejectedError(reason);
12047
12049
  }
12048
12050
  const { typedData } = await buildRes.json();
12049
12051
  const signature = await signer.signTypedData(typedData);
@@ -12054,7 +12056,7 @@ async function executeSponsored(config, signer, calls) {
12054
12056
  });
12055
12057
  if (!executeRes.ok) {
12056
12058
  const reason = await errorReason(executeRes, "We couldn't submit this transaction.");
12057
- if (PRE_BROADCAST_EXECUTE_STATUSES.has(executeRes.status)) {
12059
+ if (executeRes.status === SPONSOR_UNAVAILABLE_STATUS) {
12058
12060
  return { status: "unavailable", reason };
12059
12061
  }
12060
12062
  throw new SponsoredCallRejectedError(reason);