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