@medialane/sdk 0.124.0 → 0.125.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.
@@ -12039,9 +12039,11 @@ async function failureOf(res, fallback) {
12039
12039
  async function executeSponsored(config, signer, calls) {
12040
12040
  const doFetch = config.fetchImpl ?? fetch;
12041
12041
  const base = config.proxyUrl.replace(/\/$/, "");
12042
+ const headers = { "Content-Type": "application/json" };
12043
+ if (config.identityToken) headers.Authorization = `Bearer ${config.identityToken}`;
12042
12044
  const buildRes = await doFetch(`${base}/build`, {
12043
12045
  method: "POST",
12044
- headers: { "Content-Type": "application/json" },
12046
+ headers,
12045
12047
  body: JSON.stringify({ userAddress: signer.address, calls })
12046
12048
  });
12047
12049
  if (!buildRes.ok) {
@@ -12053,7 +12055,7 @@ async function executeSponsored(config, signer, calls) {
12053
12055
  const signature = await signer.signTypedData(typedData);
12054
12056
  const executeRes = await doFetch(`${base}/execute`, {
12055
12057
  method: "POST",
12056
- headers: { "Content-Type": "application/json" },
12058
+ headers,
12057
12059
  body: JSON.stringify({ userAddress: signer.address, typedData, signature, calls })
12058
12060
  });
12059
12061
  if (!executeRes.ok) {
@@ -12636,7 +12638,11 @@ function sponsoredExecutor(deps) {
12636
12638
  async execute(input) {
12637
12639
  const { userAddress, privateKeyHex, calls } = input;
12638
12640
  const result = await executeSponsored(
12639
- { proxyUrl: deps.proxyUrl, fetchImpl: deps.fetchImpl },
12641
+ {
12642
+ proxyUrl: deps.proxyUrl,
12643
+ fetchImpl: deps.fetchImpl,
12644
+ identityToken: deps.identityToken?.() ?? void 0
12645
+ },
12640
12646
  {
12641
12647
  address: userAddress,
12642
12648
  signTypedData: async (data) => signWithPrivateKey(privateKeyHex, starknet.typedData.getMessageHash(data, userAddress))