@medialane/sdk 0.136.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.
- package/README.md +5 -4
- package/dist/{errors-DlrNXuXZ.d.ts → errors-ac8HvmsP.d.ts} +4 -12
- package/dist/{errors-CadmV001.d.cts → errors-iITqaALF.d.cts} +4 -12
- package/dist/index.cjs +33 -28
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +33 -28
- package/dist/index.js.map +1 -1
- package/dist/starknet/index.cjs +33 -28
- package/dist/starknet/index.cjs.map +1 -1
- package/dist/starknet/index.d.cts +2 -2
- package/dist/starknet/index.d.ts +2 -2
- package/dist/starknet/index.js +33 -28
- package/dist/starknet/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -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-
|
|
2
|
-
export { b$ as CreatedOwner, c0 as OwnerSigner, by as PasskeyCancelledError, c1 as PasskeyConfig, bQ as UserFacingError, c2 as createPasskeyOwner } from '../errors-
|
|
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';
|
package/dist/starknet/index.d.ts
CHANGED
|
@@ -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-
|
|
2
|
-
export { b$ as CreatedOwner, c0 as OwnerSigner, by as PasskeyCancelledError, c1 as PasskeyConfig, bQ as UserFacingError, c2 as createPasskeyOwner } from '../errors-
|
|
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';
|
package/dist/starknet/index.js
CHANGED
|
@@ -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
|
-
|
|
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 (
|
|
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
|
}
|
|
@@ -729,12 +718,13 @@ var ApiClient = class {
|
|
|
729
718
|
headers: this.bearer(siwsToken)
|
|
730
719
|
});
|
|
731
720
|
}
|
|
732
|
-
getCollectionBySlug(slug) {
|
|
733
|
-
|
|
721
|
+
async getCollectionBySlug(slug) {
|
|
722
|
+
const res = await this.request(
|
|
734
723
|
`/v1/collections/by-slug/${encodeURIComponent(slug.toLowerCase().trim())}`,
|
|
735
724
|
{ method: "GET" },
|
|
736
725
|
{ allow404: true }
|
|
737
726
|
);
|
|
727
|
+
return res?.data ?? null;
|
|
738
728
|
}
|
|
739
729
|
async registerUser(params) {
|
|
740
730
|
return this.post("/v1/users/register", params);
|
|
@@ -856,9 +846,6 @@ var ApiClient = class {
|
|
|
856
846
|
headers: { "Authorization": `Bearer ${siwsToken}` }
|
|
857
847
|
});
|
|
858
848
|
}
|
|
859
|
-
getPopCollections(opts = {}) {
|
|
860
|
-
return this.getCollections(opts.page ?? 1, opts.limit ?? 20, void 0, opts.sort, "pop-protocol");
|
|
861
|
-
}
|
|
862
849
|
async getPopEligibility(collection, wallet) {
|
|
863
850
|
const res = await this.get(
|
|
864
851
|
`/v1/pop/eligibility/${this.addr(collection)}/${this.addr(wallet)}`
|
|
@@ -908,9 +895,6 @@ var ApiClient = class {
|
|
|
908
895
|
headers: this.bearer(siwsToken)
|
|
909
896
|
});
|
|
910
897
|
}
|
|
911
|
-
getDropCollections(opts = {}) {
|
|
912
|
-
return this.getCollections(opts.page ?? 1, opts.limit ?? 20, void 0, opts.sort, "drop-collection");
|
|
913
|
-
}
|
|
914
898
|
async getDropMintStatus(collection, wallet) {
|
|
915
899
|
const res = await this.get(
|
|
916
900
|
`/v1/drop/mint-status/${this.addr(collection)}/${this.addr(wallet)}`
|
|
@@ -937,6 +921,10 @@ var ApiClient = class {
|
|
|
937
921
|
const res = await this.get(`/v1/tickets/${this.addr(contract)}/count`);
|
|
938
922
|
return res.data.count;
|
|
939
923
|
}
|
|
924
|
+
async getClubMembershipCount(contract) {
|
|
925
|
+
const res = await this.get(`/v1/club/${this.addr(contract)}/count`);
|
|
926
|
+
return res.data.count;
|
|
927
|
+
}
|
|
940
928
|
async getClubMembership(contract, tokenId) {
|
|
941
929
|
const res = await this.get(`/v1/club/${this.addr(contract)}/${tokenId}`);
|
|
942
930
|
return res.data;
|
|
@@ -1020,6 +1008,7 @@ var ApiClient = class {
|
|
|
1020
1008
|
if (query.sort) params.set("sort", query.sort);
|
|
1021
1009
|
if (query.isFeatured !== void 0) params.set("isFeatured", String(query.isFeatured));
|
|
1022
1010
|
if (query.hideEmpty !== void 0) params.set("hideEmpty", String(query.hideEmpty));
|
|
1011
|
+
if (query.standard) params.set("standard", query.standard);
|
|
1023
1012
|
if (query.chain) params.set("chain", query.chain);
|
|
1024
1013
|
const qs = params.toString();
|
|
1025
1014
|
return this.get(`/v1/collections${qs ? `?${qs}` : ""}`);
|
|
@@ -1045,6 +1034,22 @@ var ApiClient = class {
|
|
|
1045
1034
|
if (query.open !== void 0) params.set("open", String(query.open));
|
|
1046
1035
|
return this.get(`/v1/sponsorship/offers?${params}`);
|
|
1047
1036
|
}
|
|
1037
|
+
async getSponsorshipOffer(offerId) {
|
|
1038
|
+
const res = await this.request(
|
|
1039
|
+
`/v1/sponsorship/offers/${encodeURIComponent(offerId)}`,
|
|
1040
|
+
{ method: "GET" },
|
|
1041
|
+
{ allow404: true }
|
|
1042
|
+
);
|
|
1043
|
+
return res?.data ?? null;
|
|
1044
|
+
}
|
|
1045
|
+
async getSponsorshipProposal(proposalId) {
|
|
1046
|
+
const res = await this.request(
|
|
1047
|
+
`/v1/sponsorship/proposals/${encodeURIComponent(proposalId)}`,
|
|
1048
|
+
{ method: "GET" },
|
|
1049
|
+
{ allow404: true }
|
|
1050
|
+
);
|
|
1051
|
+
return res?.data ?? null;
|
|
1052
|
+
}
|
|
1048
1053
|
async getSponsorshipBids(offerId) {
|
|
1049
1054
|
const res = await this.get(`/v1/sponsorship/offers/${encodeURIComponent(offerId)}/bids`);
|
|
1050
1055
|
return res.data;
|