@medialane/sdk 0.137.0 → 0.139.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-Ca-A70L7.d.cts → errors-CMjZp66y.d.cts} +17 -32
- package/dist/{errors-CC1H8Usc.d.ts → errors-CtXjdRsL.d.ts} +17 -32
- package/dist/index.cjs +25 -35
- 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 +25 -35
- package/dist/index.js.map +1 -1
- package/dist/starknet/index.cjs +25 -35
- 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 +25 -35
- 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-CMjZp66y.cjs';
|
|
2
|
+
export { b$ as CreatedOwner, c0 as OwnerSigner, by as PasskeyCancelledError, c1 as PasskeyConfig, bQ as UserFacingError, c2 as createPasskeyOwner } from '../errors-CMjZp66y.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-CtXjdRsL.js';
|
|
2
|
+
export { b$ as CreatedOwner, c0 as OwnerSigner, by as PasskeyCancelledError, c1 as PasskeyConfig, bQ as UserFacingError, c2 as createPasskeyOwner } from '../errors-CtXjdRsL.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
|
}
|
|
@@ -754,10 +743,8 @@ var ApiClient = class {
|
|
|
754
743
|
});
|
|
755
744
|
}
|
|
756
745
|
async checkEmail(email) {
|
|
757
|
-
const body = await this.get(
|
|
758
|
-
|
|
759
|
-
);
|
|
760
|
-
return { exists: body.exists, walletWaiting: body.walletWaiting === true };
|
|
746
|
+
const body = await this.get(`/v1/auth/email/exists?email=${encodeURIComponent(email)}`);
|
|
747
|
+
return { exists: body.exists };
|
|
761
748
|
}
|
|
762
749
|
async requestEmailCode(email) {
|
|
763
750
|
await this.post("/v1/auth/email/request-code", { email });
|
|
@@ -766,15 +753,19 @@ var ApiClient = class {
|
|
|
766
753
|
await this.post("/v1/auth/email/register-account", { email });
|
|
767
754
|
}
|
|
768
755
|
async verifyEmailCode(email, code) {
|
|
769
|
-
|
|
770
|
-
return { waitingWallets: body.waitingWallets ?? [] };
|
|
756
|
+
await this.post("/v1/auth/email/verify-code", { email, code });
|
|
771
757
|
}
|
|
772
|
-
|
|
773
|
-
|
|
758
|
+
/**
|
|
759
|
+
* Makes the passkey the only owner of the session account's wallet. `signature` is the passkey's owner-alive
|
|
760
|
+
* proof for the wallet. Answers 409 when the wallet is already set up.
|
|
761
|
+
*/
|
|
762
|
+
setupWalletKey(params) {
|
|
763
|
+
return this.post("/v1/users/me/wallet/key", params);
|
|
774
764
|
}
|
|
765
|
+
/** The session account's wallet, and whether its passkey still has to be set up (`setupWalletKey`). */
|
|
775
766
|
async getSessionWallet() {
|
|
776
767
|
const body = await this.post("/v1/users/me/wallet", {});
|
|
777
|
-
return body.walletAddress
|
|
768
|
+
return body.walletAddress ? { walletAddress: body.walletAddress, needsKeySetup: body.needsKeySetup === true } : null;
|
|
778
769
|
}
|
|
779
770
|
getMyWallet(siwsToken) {
|
|
780
771
|
return this.request(
|
|
@@ -857,9 +848,6 @@ var ApiClient = class {
|
|
|
857
848
|
headers: { "Authorization": `Bearer ${siwsToken}` }
|
|
858
849
|
});
|
|
859
850
|
}
|
|
860
|
-
getPopCollections(opts = {}) {
|
|
861
|
-
return this.getCollections(opts.page ?? 1, opts.limit ?? 20, void 0, opts.sort, "pop-protocol");
|
|
862
|
-
}
|
|
863
851
|
async getPopEligibility(collection, wallet) {
|
|
864
852
|
const res = await this.get(
|
|
865
853
|
`/v1/pop/eligibility/${this.addr(collection)}/${this.addr(wallet)}`
|
|
@@ -909,9 +897,6 @@ var ApiClient = class {
|
|
|
909
897
|
headers: this.bearer(siwsToken)
|
|
910
898
|
});
|
|
911
899
|
}
|
|
912
|
-
getDropCollections(opts = {}) {
|
|
913
|
-
return this.getCollections(opts.page ?? 1, opts.limit ?? 20, void 0, opts.sort, "drop-collection");
|
|
914
|
-
}
|
|
915
900
|
async getDropMintStatus(collection, wallet) {
|
|
916
901
|
const res = await this.get(
|
|
917
902
|
`/v1/drop/mint-status/${this.addr(collection)}/${this.addr(wallet)}`
|
|
@@ -938,6 +923,10 @@ var ApiClient = class {
|
|
|
938
923
|
const res = await this.get(`/v1/tickets/${this.addr(contract)}/count`);
|
|
939
924
|
return res.data.count;
|
|
940
925
|
}
|
|
926
|
+
async getClubMembershipCount(contract) {
|
|
927
|
+
const res = await this.get(`/v1/club/${this.addr(contract)}/count`);
|
|
928
|
+
return res.data.count;
|
|
929
|
+
}
|
|
941
930
|
async getClubMembership(contract, tokenId) {
|
|
942
931
|
const res = await this.get(`/v1/club/${this.addr(contract)}/${tokenId}`);
|
|
943
932
|
return res.data;
|
|
@@ -1021,6 +1010,7 @@ var ApiClient = class {
|
|
|
1021
1010
|
if (query.sort) params.set("sort", query.sort);
|
|
1022
1011
|
if (query.isFeatured !== void 0) params.set("isFeatured", String(query.isFeatured));
|
|
1023
1012
|
if (query.hideEmpty !== void 0) params.set("hideEmpty", String(query.hideEmpty));
|
|
1013
|
+
if (query.standard) params.set("standard", query.standard);
|
|
1024
1014
|
if (query.chain) params.set("chain", query.chain);
|
|
1025
1015
|
const qs = params.toString();
|
|
1026
1016
|
return this.get(`/v1/collections${qs ? `?${qs}` : ""}`);
|