@medialane/sdk 0.152.0 → 0.153.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.
@@ -1,5 +1,5 @@
1
- import { bG as ResolvedConfig, bO as TxResult, a$ as CreatePopCollectionParams, aM as ClaimConditions, aX as CreateDropParams, b4 as CreateTicketParams, bq as MintTicketsParams, aZ as CreateMembershipParams, bp as MintMembershipsParams, b2 as CreateSponsorshipOfferParams, bD as ProposeSponsorshipParams, k as ApiClient, bn as MedialaneConfig, bo as MedialaneErrorCode, bv as OrderDetails, R as ResolvedFeeConfig, I as ApiFundingIntent, H as ApiFundingInstructions, L as ApiFundingSubmit, N as ApiIntentCreated, bW as SealedOwner, bX as ReceiptProviderLike, bY as WalletExecutor, bZ as ExecutedTransaction, b_ as PasskeyOwner, b$ as CreatedOwner } from '../errors-BiylBrXD.cjs';
2
- export { c0 as InvalidRecoveryKeyError, c1 as OwnerSigner, by as PasskeyCancelledError, c2 as PasskeyConfig, c3 as RecoveryKey, bQ as UserFacingError, c4 as createPasskeyOwner, c5 as encodeRecoveryKey, c6 as parseRecoveryKey } from '../errors-BiylBrXD.cjs';
1
+ import { bG as ResolvedConfig, bO as TxResult, a$ as CreatePopCollectionParams, aM as ClaimConditions, aX as CreateDropParams, b4 as CreateTicketParams, bq as MintTicketsParams, aZ as CreateMembershipParams, bp as MintMembershipsParams, b2 as CreateSponsorshipOfferParams, bD as ProposeSponsorshipParams, k as ApiClient, bn as MedialaneConfig, bo as MedialaneErrorCode, bv as OrderDetails, R as ResolvedFeeConfig, I as ApiFundingIntent, H as ApiFundingInstructions, L as ApiFundingSubmit, N as ApiIntentCreated, bW as SealedOwner, bX as ReceiptProviderLike, bY as WalletExecutor, bZ as ExecutedTransaction, b_ as PasskeyOwner, b$ as CreatedOwner } from '../errors-DQRDzDiT.cjs';
2
+ export { c0 as InvalidRecoveryKeyError, c1 as OwnerSigner, by as PasskeyCancelledError, c2 as PasskeyConfig, c3 as RecoveryKey, bQ as UserFacingError, c4 as createPasskeyOwner, c5 as encodeRecoveryKey, c6 as parseRecoveryKey } from '../errors-DQRDzDiT.cjs';
3
3
  import { AccountInterface, Call, ProviderInterface, TypedData, constants, BigNumberish, DeployAccountContractPayload, Account } from 'starknet';
4
4
  import { V as VenueAdapter, O as OrderRef, A as AdapterTxResult, R as RegisterOrderParams, j as VenueSigner } from '../types-CO6YYHVA.cjs';
5
5
  import 'zod';
@@ -1,5 +1,5 @@
1
- import { bG as ResolvedConfig, bO as TxResult, a$ as CreatePopCollectionParams, aM as ClaimConditions, aX as CreateDropParams, b4 as CreateTicketParams, bq as MintTicketsParams, aZ as CreateMembershipParams, bp as MintMembershipsParams, b2 as CreateSponsorshipOfferParams, bD as ProposeSponsorshipParams, k as ApiClient, bn as MedialaneConfig, bo as MedialaneErrorCode, bv as OrderDetails, R as ResolvedFeeConfig, I as ApiFundingIntent, H as ApiFundingInstructions, L as ApiFundingSubmit, N as ApiIntentCreated, bW as SealedOwner, bX as ReceiptProviderLike, bY as WalletExecutor, bZ as ExecutedTransaction, b_ as PasskeyOwner, b$ as CreatedOwner } from '../errors-CjBITkRd.js';
2
- export { c0 as InvalidRecoveryKeyError, c1 as OwnerSigner, by as PasskeyCancelledError, c2 as PasskeyConfig, c3 as RecoveryKey, bQ as UserFacingError, c4 as createPasskeyOwner, c5 as encodeRecoveryKey, c6 as parseRecoveryKey } from '../errors-CjBITkRd.js';
1
+ import { bG as ResolvedConfig, bO as TxResult, a$ as CreatePopCollectionParams, aM as ClaimConditions, aX as CreateDropParams, b4 as CreateTicketParams, bq as MintTicketsParams, aZ as CreateMembershipParams, bp as MintMembershipsParams, b2 as CreateSponsorshipOfferParams, bD as ProposeSponsorshipParams, k as ApiClient, bn as MedialaneConfig, bo as MedialaneErrorCode, bv as OrderDetails, R as ResolvedFeeConfig, I as ApiFundingIntent, H as ApiFundingInstructions, L as ApiFundingSubmit, N as ApiIntentCreated, bW as SealedOwner, bX as ReceiptProviderLike, bY as WalletExecutor, bZ as ExecutedTransaction, b_ as PasskeyOwner, b$ as CreatedOwner } from '../errors-dgfLd7nS.js';
2
+ export { c0 as InvalidRecoveryKeyError, c1 as OwnerSigner, by as PasskeyCancelledError, c2 as PasskeyConfig, c3 as RecoveryKey, bQ as UserFacingError, c4 as createPasskeyOwner, c5 as encodeRecoveryKey, c6 as parseRecoveryKey } from '../errors-dgfLd7nS.js';
3
3
  import { AccountInterface, Call, ProviderInterface, TypedData, constants, BigNumberish, DeployAccountContractPayload, Account } from 'starknet';
4
4
  import { V as VenueAdapter, O as OrderRef, A as AdapterTxResult, R as RegisterOrderParams, j as VenueSigner } from '../types-CO6YYHVA.js';
5
5
  import 'zod';
@@ -90,6 +90,7 @@ var MedialaneConfigSchema = z.object({
90
90
  rpcUrl: z.string().url().optional(),
91
91
  backendUrl: z.string().url().optional(),
92
92
  apiKey: z.string().optional(),
93
+ appSource: z.string().regex(/^[A-Z][A-Z0-9_]*$/).optional(),
93
94
  marketplace721Contract: z.string().optional(),
94
95
  marketplaceContract: z.string().optional(),
95
96
  marketplace1155Contract: z.string().optional(),
@@ -114,6 +115,7 @@ function resolveConfig(raw) {
114
115
  rpcUrl: parsed.rpcUrl ?? coords.rpcUrl,
115
116
  backendUrl: parsed.backendUrl,
116
117
  apiKey: parsed.apiKey,
118
+ appSource: parsed.appSource,
117
119
  marketplace721Contract,
118
120
  marketplaceContract: marketplace721Contract,
119
121
  marketplace1155Contract: parsed.marketplace1155Contract ?? sn.marketplace1155,
@@ -264,10 +266,13 @@ function parseRetryAfter(value) {
264
266
  return void 0;
265
267
  }
266
268
  var ApiClient = class {
267
- constructor(baseUrl, apiKey, retryOptions, chain = "STARKNET") {
269
+ constructor(baseUrl, apiKey, retryOptions, chain = "STARKNET", appSource) {
268
270
  this.baseUrl = baseUrl;
269
271
  this.chain = chain;
270
- this.baseHeaders = apiKey ? { "x-api-key": apiKey } : {};
272
+ this.baseHeaders = {
273
+ ...apiKey ? { "x-api-key": apiKey } : {},
274
+ ...appSource ? { "x-app-source": appSource } : {}
275
+ };
271
276
  this.retryOptions = retryOptions;
272
277
  }
273
278
  addr(a) {
@@ -11109,7 +11114,7 @@ var MedialaneClient = class {
11109
11114
  }
11110
11115
  });
11111
11116
  } else {
11112
- this.api = new ApiClient(this.config.backendUrl, this.config.apiKey, this.config.retryOptions, this.config.chain);
11117
+ this.api = new ApiClient(this.config.backendUrl, this.config.apiKey, this.config.retryOptions, this.config.chain, this.config.appSource);
11113
11118
  }
11114
11119
  }
11115
11120
  get chain() {
@@ -11801,9 +11806,13 @@ async function requestSiwsToken({
11801
11806
  appSource
11802
11807
  }) {
11803
11808
  const base = backendUrl.replace(/\/$/, "");
11809
+ const headers = {
11810
+ "Content-Type": "application/json",
11811
+ ...appSource ? { "x-app-source": appSource } : {}
11812
+ };
11804
11813
  const nonceRes = await fetch(`${base}/v1/auth/siws/nonce`, {
11805
11814
  method: "POST",
11806
- headers: { "Content-Type": "application/json" },
11815
+ headers,
11807
11816
  body: JSON.stringify({ walletAddress })
11808
11817
  });
11809
11818
  if (!nonceRes.ok) {
@@ -11813,7 +11822,7 @@ async function requestSiwsToken({
11813
11822
  const signature = normalizeSiwsSignature(await signer.signMessage(typedData));
11814
11823
  const verifyRes = await fetch(`${base}/v1/auth/siws/verify`, {
11815
11824
  method: "POST",
11816
- headers: { "Content-Type": "application/json" },
11825
+ headers,
11817
11826
  body: JSON.stringify({ walletAddress, nonce, signature, ...appSource ? { appSource } : {} })
11818
11827
  });
11819
11828
  if (!verifyRes.ok) {