@medialane/sdk 0.137.0 → 0.138.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 } from '../errors-Ca-A70L7.cjs';
2
- export { b$ as CreatedOwner, c0 as OwnerSigner, by as PasskeyCancelledError, c1 as PasskeyConfig, bQ as UserFacingError, c2 as createPasskeyOwner } from '../errors-Ca-A70L7.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 } from '../errors-iITqaALF.cjs';
2
+ export { b$ as CreatedOwner, c0 as OwnerSigner, by as PasskeyCancelledError, c1 as PasskeyConfig, bQ as UserFacingError, c2 as createPasskeyOwner } from '../errors-iITqaALF.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-CuSlc_YE.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 } from '../errors-CC1H8Usc.js';
2
- export { b$ as CreatedOwner, c0 as OwnerSigner, by as PasskeyCancelledError, c1 as PasskeyConfig, bQ as UserFacingError, c2 as createPasskeyOwner } from '../errors-CC1H8Usc.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 } from '../errors-ac8HvmsP.js';
2
+ export { b$ as CreatedOwner, c0 as OwnerSigner, by as PasskeyCancelledError, c1 as PasskeyConfig, bQ as UserFacingError, c2 as createPasskeyOwner } from '../errors-ac8HvmsP.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-CuSlc_YE.js';
5
5
  import 'zod';
@@ -210,7 +210,13 @@ var DEFAULT_MAX_DELAY_MS = 5e3;
210
210
  function sleep(ms) {
211
211
  return new Promise((resolve) => setTimeout(resolve, ms));
212
212
  }
213
- async function withRetry(fn, opts) {
213
+ function isRetryableFor(method, err) {
214
+ if (err instanceof MedialaneApiError && err.status === 429) return true;
215
+ const isRead = method === "GET" || method === "HEAD";
216
+ if (!isRead) return false;
217
+ return err instanceof MedialaneApiError && err.status >= 500 || err instanceof TypeError;
218
+ }
219
+ async function withRetry(fn, opts, method = "GET") {
214
220
  const maxAttempts = opts?.maxAttempts ?? DEFAULT_MAX_ATTEMPTS;
215
221
  const baseDelayMs = opts?.baseDelayMs ?? DEFAULT_BASE_DELAY_MS;
216
222
  const maxDelayMs = opts?.maxDelayMs ?? DEFAULT_MAX_DELAY_MS;
@@ -220,11 +226,7 @@ async function withRetry(fn, opts) {
220
226
  return await fn();
221
227
  } catch (err) {
222
228
  lastError = err;
223
- if (err instanceof MedialaneApiError && err.status < 500 && err.status !== 429) {
224
- throw err;
225
- }
226
- const isRetryable = err instanceof MedialaneApiError && (err.status >= 500 || err.status === 429) || err instanceof TypeError;
227
- if (!isRetryable || attempt === maxAttempts - 1) {
229
+ if (!isRetryableFor(method, err) || attempt === maxAttempts - 1) {
228
230
  throw err;
229
231
  }
230
232
  const retryAfterMs = err instanceof MedialaneApiError ? err.retryAfterMs : void 0;
@@ -305,7 +307,7 @@ var ApiClient = class {
305
307
  );
306
308
  }
307
309
  return response;
308
- }, this.retryOptions);
310
+ }, this.retryOptions, (init?.method ?? "GET").toUpperCase());
309
311
  if (allowed(res.status)) return null;
310
312
  return res.json();
311
313
  }
@@ -373,19 +375,6 @@ var ApiClient = class {
373
375
  `/v1/tokens/${contract}/${tokenId}/history?page=${page}&limit=${limit}`
374
376
  );
375
377
  }
376
- getCollections(page = 1, limit = 20, isKnown, sort, service, chain, standard) {
377
- const params = new URLSearchParams({ page: String(page), limit: String(limit) });
378
- if (isKnown !== void 0) params.set("isKnown", String(isKnown));
379
- if (sort) params.set("sort", sort);
380
- if (service) params.set("service", service);
381
- if (chain) params.set("chain", chain);
382
- if (standard) params.set("standard", standard);
383
- return this.get(`/v1/collections?${params}`);
384
- }
385
- getCollectionsByOwner(owner, page = 1, limit = 50) {
386
- const params = new URLSearchParams({ owner: this.addr(owner), page: String(page), limit: String(limit) });
387
- return this.get(`/v1/collections?${params}`);
388
- }
389
378
  getCollection(contract) {
390
379
  return this.get(`/v1/collections/${this.addr(contract)}`);
391
380
  }
@@ -857,9 +846,6 @@ var ApiClient = class {
857
846
  headers: { "Authorization": `Bearer ${siwsToken}` }
858
847
  });
859
848
  }
860
- getPopCollections(opts = {}) {
861
- return this.getCollections(opts.page ?? 1, opts.limit ?? 20, void 0, opts.sort, "pop-protocol");
862
- }
863
849
  async getPopEligibility(collection, wallet) {
864
850
  const res = await this.get(
865
851
  `/v1/pop/eligibility/${this.addr(collection)}/${this.addr(wallet)}`
@@ -909,9 +895,6 @@ var ApiClient = class {
909
895
  headers: this.bearer(siwsToken)
910
896
  });
911
897
  }
912
- getDropCollections(opts = {}) {
913
- return this.getCollections(opts.page ?? 1, opts.limit ?? 20, void 0, opts.sort, "drop-collection");
914
- }
915
898
  async getDropMintStatus(collection, wallet) {
916
899
  const res = await this.get(
917
900
  `/v1/drop/mint-status/${this.addr(collection)}/${this.addr(wallet)}`
@@ -938,6 +921,10 @@ var ApiClient = class {
938
921
  const res = await this.get(`/v1/tickets/${this.addr(contract)}/count`);
939
922
  return res.data.count;
940
923
  }
924
+ async getClubMembershipCount(contract) {
925
+ const res = await this.get(`/v1/club/${this.addr(contract)}/count`);
926
+ return res.data.count;
927
+ }
941
928
  async getClubMembership(contract, tokenId) {
942
929
  const res = await this.get(`/v1/club/${this.addr(contract)}/${tokenId}`);
943
930
  return res.data;
@@ -1021,6 +1008,7 @@ var ApiClient = class {
1021
1008
  if (query.sort) params.set("sort", query.sort);
1022
1009
  if (query.isFeatured !== void 0) params.set("isFeatured", String(query.isFeatured));
1023
1010
  if (query.hideEmpty !== void 0) params.set("hideEmpty", String(query.hideEmpty));
1011
+ if (query.standard) params.set("standard", query.standard);
1024
1012
  if (query.chain) params.set("chain", query.chain);
1025
1013
  const qs = params.toString();
1026
1014
  return this.get(`/v1/collections${qs ? `?${qs}` : ""}`);