@medialane/sdk 0.153.0 → 0.155.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 +1 -2
- package/dist/{errors-dgfLd7nS.d.ts → errors-BKaHnCOI.d.ts} +2 -35
- package/dist/{errors-DQRDzDiT.d.cts → errors-CAKnNI3N.d.cts} +2 -35
- package/dist/index.cjs +2 -21
- 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 +2 -21
- package/dist/index.js.map +1 -1
- package/dist/starknet/index.cjs +5 -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 +5 -28
- package/dist/starknet/index.js.map +1 -1
- package/package.json +1 -1
package/dist/starknet/index.cjs
CHANGED
|
@@ -92,7 +92,6 @@ var MedialaneConfigSchema = zod.z.object({
|
|
|
92
92
|
rpcUrl: zod.z.string().url().optional(),
|
|
93
93
|
backendUrl: zod.z.string().url().optional(),
|
|
94
94
|
apiKey: zod.z.string().optional(),
|
|
95
|
-
appSource: zod.z.string().regex(/^[A-Z][A-Z0-9_]*$/).optional(),
|
|
96
95
|
marketplace721Contract: zod.z.string().optional(),
|
|
97
96
|
marketplaceContract: zod.z.string().optional(),
|
|
98
97
|
marketplace1155Contract: zod.z.string().optional(),
|
|
@@ -117,7 +116,6 @@ function resolveConfig(raw) {
|
|
|
117
116
|
rpcUrl: parsed.rpcUrl ?? coords.rpcUrl,
|
|
118
117
|
backendUrl: parsed.backendUrl,
|
|
119
118
|
apiKey: parsed.apiKey,
|
|
120
|
-
appSource: parsed.appSource,
|
|
121
119
|
marketplace721Contract,
|
|
122
120
|
marketplaceContract: marketplace721Contract,
|
|
123
121
|
marketplace1155Contract: parsed.marketplace1155Contract ?? sn.marketplace1155,
|
|
@@ -268,13 +266,10 @@ function parseRetryAfter(value) {
|
|
|
268
266
|
return void 0;
|
|
269
267
|
}
|
|
270
268
|
var ApiClient = class {
|
|
271
|
-
constructor(baseUrl, apiKey, retryOptions, chain = "STARKNET"
|
|
269
|
+
constructor(baseUrl, apiKey, retryOptions, chain = "STARKNET") {
|
|
272
270
|
this.baseUrl = baseUrl;
|
|
273
271
|
this.chain = chain;
|
|
274
|
-
this.baseHeaders = {
|
|
275
|
-
...apiKey ? { "x-api-key": apiKey } : {},
|
|
276
|
-
...appSource ? { "x-app-source": appSource } : {}
|
|
277
|
-
};
|
|
272
|
+
this.baseHeaders = apiKey ? { "x-api-key": apiKey } : {};
|
|
278
273
|
this.retryOptions = retryOptions;
|
|
279
274
|
}
|
|
280
275
|
addr(a) {
|
|
@@ -325,9 +320,6 @@ var ApiClient = class {
|
|
|
325
320
|
patch(path, body) {
|
|
326
321
|
return this.request(path, { method: "PATCH", body: JSON.stringify(body) });
|
|
327
322
|
}
|
|
328
|
-
del(path) {
|
|
329
|
-
return this.request(path, { method: "DELETE" });
|
|
330
|
-
}
|
|
331
323
|
bearer(siwsToken) {
|
|
332
324
|
return { Authorization: `Bearer ${siwsToken}` };
|
|
333
325
|
}
|
|
@@ -619,17 +611,6 @@ var ApiClient = class {
|
|
|
619
611
|
headers: this.asSubject(siwsToken)
|
|
620
612
|
});
|
|
621
613
|
}
|
|
622
|
-
getWebhooks() {
|
|
623
|
-
return this.get("/v1/portal/webhooks");
|
|
624
|
-
}
|
|
625
|
-
createWebhook(params) {
|
|
626
|
-
return this.post("/v1/portal/webhooks", params);
|
|
627
|
-
}
|
|
628
|
-
deleteWebhook(id) {
|
|
629
|
-
return this.del(
|
|
630
|
-
`/v1/portal/webhooks/${id}`
|
|
631
|
-
);
|
|
632
|
-
}
|
|
633
614
|
async claimCollection(contractAddress, walletAddress, siwsToken) {
|
|
634
615
|
return this.request("/v1/collections/claim", {
|
|
635
616
|
method: "POST",
|
|
@@ -11116,7 +11097,7 @@ var MedialaneClient = class {
|
|
|
11116
11097
|
}
|
|
11117
11098
|
});
|
|
11118
11099
|
} else {
|
|
11119
|
-
this.api = new ApiClient(this.config.backendUrl, this.config.apiKey, this.config.retryOptions, this.config.chain
|
|
11100
|
+
this.api = new ApiClient(this.config.backendUrl, this.config.apiKey, this.config.retryOptions, this.config.chain);
|
|
11120
11101
|
}
|
|
11121
11102
|
}
|
|
11122
11103
|
get chain() {
|
|
@@ -11808,13 +11789,9 @@ async function requestSiwsToken({
|
|
|
11808
11789
|
appSource
|
|
11809
11790
|
}) {
|
|
11810
11791
|
const base = backendUrl.replace(/\/$/, "");
|
|
11811
|
-
const headers = {
|
|
11812
|
-
"Content-Type": "application/json",
|
|
11813
|
-
...appSource ? { "x-app-source": appSource } : {}
|
|
11814
|
-
};
|
|
11815
11792
|
const nonceRes = await fetch(`${base}/v1/auth/siws/nonce`, {
|
|
11816
11793
|
method: "POST",
|
|
11817
|
-
headers,
|
|
11794
|
+
headers: { "Content-Type": "application/json" },
|
|
11818
11795
|
body: JSON.stringify({ walletAddress })
|
|
11819
11796
|
});
|
|
11820
11797
|
if (!nonceRes.ok) {
|
|
@@ -11824,7 +11801,7 @@ async function requestSiwsToken({
|
|
|
11824
11801
|
const signature = normalizeSiwsSignature(await signer.signMessage(typedData));
|
|
11825
11802
|
const verifyRes = await fetch(`${base}/v1/auth/siws/verify`, {
|
|
11826
11803
|
method: "POST",
|
|
11827
|
-
headers,
|
|
11804
|
+
headers: { "Content-Type": "application/json" },
|
|
11828
11805
|
body: JSON.stringify({ walletAddress, nonce, signature, ...appSource ? { appSource } : {} })
|
|
11829
11806
|
});
|
|
11830
11807
|
if (!verifyRes.ok) {
|