@medialane/sdk 0.123.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.
@@ -11580,7 +11580,8 @@ function normalizeSiwsSignature(signature) {
11580
11580
  async function requestSiwsToken({
11581
11581
  backendUrl,
11582
11582
  walletAddress,
11583
- signer
11583
+ signer,
11584
+ appSource
11584
11585
  }) {
11585
11586
  const base = backendUrl.replace(/\/$/, "");
11586
11587
  const nonceRes = await fetch(`${base}/v1/auth/siws/nonce`, {
@@ -11596,7 +11597,7 @@ async function requestSiwsToken({
11596
11597
  const verifyRes = await fetch(`${base}/v1/auth/siws/verify`, {
11597
11598
  method: "POST",
11598
11599
  headers: { "Content-Type": "application/json" },
11599
- body: JSON.stringify({ walletAddress, nonce, signature })
11600
+ body: JSON.stringify({ walletAddress, nonce, signature, ...appSource ? { appSource } : {} })
11600
11601
  });
11601
11602
  if (!verifyRes.ok) {
11602
11603
  let backendMessage;
@@ -12038,9 +12039,11 @@ async function failureOf(res, fallback) {
12038
12039
  async function executeSponsored(config, signer, calls) {
12039
12040
  const doFetch = config.fetchImpl ?? fetch;
12040
12041
  const base = config.proxyUrl.replace(/\/$/, "");
12042
+ const headers = { "Content-Type": "application/json" };
12043
+ if (config.identityToken) headers.Authorization = `Bearer ${config.identityToken}`;
12041
12044
  const buildRes = await doFetch(`${base}/build`, {
12042
12045
  method: "POST",
12043
- headers: { "Content-Type": "application/json" },
12046
+ headers,
12044
12047
  body: JSON.stringify({ userAddress: signer.address, calls })
12045
12048
  });
12046
12049
  if (!buildRes.ok) {
@@ -12052,7 +12055,7 @@ async function executeSponsored(config, signer, calls) {
12052
12055
  const signature = await signer.signTypedData(typedData);
12053
12056
  const executeRes = await doFetch(`${base}/execute`, {
12054
12057
  method: "POST",
12055
- headers: { "Content-Type": "application/json" },
12058
+ headers,
12056
12059
  body: JSON.stringify({ userAddress: signer.address, typedData, signature, calls })
12057
12060
  });
12058
12061
  if (!executeRes.ok) {
@@ -12635,7 +12638,11 @@ function sponsoredExecutor(deps) {
12635
12638
  async execute(input) {
12636
12639
  const { userAddress, privateKeyHex, calls } = input;
12637
12640
  const result = await executeSponsored(
12638
- { proxyUrl: deps.proxyUrl, fetchImpl: deps.fetchImpl },
12641
+ {
12642
+ proxyUrl: deps.proxyUrl,
12643
+ fetchImpl: deps.fetchImpl,
12644
+ identityToken: deps.identityToken?.() ?? void 0
12645
+ },
12639
12646
  {
12640
12647
  address: userAddress,
12641
12648
  signTypedData: async (data) => signWithPrivateKey(privateKeyHex, starknet.typedData.getMessageHash(data, userAddress))