@medialane/sdk 0.4.8 → 0.5.1
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/dist/index.cjs +117 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +154 -3
- package/dist/index.d.ts +154 -3
- package/dist/index.js +117 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1147,6 +1147,31 @@ var ApiClient = class {
|
|
|
1147
1147
|
createCollectionIntent(params) {
|
|
1148
1148
|
return this.post("/v1/intents/create-collection", params);
|
|
1149
1149
|
}
|
|
1150
|
+
/**
|
|
1151
|
+
* Create a counter-offer intent. The seller proposes a new price in response
|
|
1152
|
+
* to a buyer's active bid. clerkToken is optional — the endpoint authenticates
|
|
1153
|
+
* via the tenant API key; pass a Clerk JWT only if your backend requires it.
|
|
1154
|
+
*/
|
|
1155
|
+
createCounterOfferIntent(params, clerkToken) {
|
|
1156
|
+
const extraHeaders = clerkToken ? { "Authorization": `Bearer ${clerkToken}` } : {};
|
|
1157
|
+
return this.request("/v1/intents/counter-offer", {
|
|
1158
|
+
method: "POST",
|
|
1159
|
+
body: JSON.stringify(params),
|
|
1160
|
+
headers: extraHeaders
|
|
1161
|
+
});
|
|
1162
|
+
}
|
|
1163
|
+
/**
|
|
1164
|
+
* Fetch counter-offers. Pass `originalOrderHash` (buyer view) or
|
|
1165
|
+
* `sellerAddress` (seller view) — at least one is required.
|
|
1166
|
+
*/
|
|
1167
|
+
getCounterOffers(query) {
|
|
1168
|
+
const params = new URLSearchParams();
|
|
1169
|
+
if (query.originalOrderHash) params.set("originalOrderHash", query.originalOrderHash);
|
|
1170
|
+
if (query.sellerAddress) params.set("sellerAddress", query.sellerAddress);
|
|
1171
|
+
if (query.page !== void 0) params.set("page", String(query.page));
|
|
1172
|
+
if (query.limit !== void 0) params.set("limit", String(query.limit));
|
|
1173
|
+
return this.get(`/v1/orders/counter-offers?${params}`);
|
|
1174
|
+
}
|
|
1150
1175
|
// ─── Metadata ──────────────────────────────────────────────────────────────
|
|
1151
1176
|
getMetadataSignedUrl() {
|
|
1152
1177
|
return this.get("/v1/metadata/signed-url");
|
|
@@ -1313,6 +1338,94 @@ var ApiClient = class {
|
|
|
1313
1338
|
if (res.status === 404) return null;
|
|
1314
1339
|
return res.json();
|
|
1315
1340
|
}
|
|
1341
|
+
// ─── Remix Licensing ─────────────────────────────────────────────────────────
|
|
1342
|
+
/**
|
|
1343
|
+
* Get public remixes of a token (open to everyone).
|
|
1344
|
+
*/
|
|
1345
|
+
getTokenRemixes(contract, tokenId, opts = {}) {
|
|
1346
|
+
const params = new URLSearchParams();
|
|
1347
|
+
if (opts.page !== void 0) params.set("page", String(opts.page));
|
|
1348
|
+
if (opts.limit !== void 0) params.set("limit", String(opts.limit));
|
|
1349
|
+
const qs = params.toString();
|
|
1350
|
+
return this.get(
|
|
1351
|
+
`/v1/tokens/${normalizeAddress(contract)}/${tokenId}/remixes${qs ? `?${qs}` : ""}`
|
|
1352
|
+
);
|
|
1353
|
+
}
|
|
1354
|
+
/**
|
|
1355
|
+
* Submit a custom remix offer for a token. Requires Clerk JWT.
|
|
1356
|
+
*/
|
|
1357
|
+
submitRemixOffer(params, clerkToken) {
|
|
1358
|
+
return this.request("/v1/remix-offers", {
|
|
1359
|
+
method: "POST",
|
|
1360
|
+
body: JSON.stringify(params),
|
|
1361
|
+
headers: { "Authorization": `Bearer ${clerkToken}` }
|
|
1362
|
+
});
|
|
1363
|
+
}
|
|
1364
|
+
/**
|
|
1365
|
+
* Submit an auto remix offer for a token with an open license. Requires Clerk JWT.
|
|
1366
|
+
*/
|
|
1367
|
+
submitAutoRemixOffer(params, clerkToken) {
|
|
1368
|
+
return this.request("/v1/remix-offers/auto", {
|
|
1369
|
+
method: "POST",
|
|
1370
|
+
body: JSON.stringify(params),
|
|
1371
|
+
headers: { "Authorization": `Bearer ${clerkToken}` }
|
|
1372
|
+
});
|
|
1373
|
+
}
|
|
1374
|
+
/**
|
|
1375
|
+
* Record a self-remix (owner remixing their own token). Requires Clerk JWT.
|
|
1376
|
+
*/
|
|
1377
|
+
confirmSelfRemix(params, clerkToken) {
|
|
1378
|
+
return this.request("/v1/remix-offers/self/confirm", {
|
|
1379
|
+
method: "POST",
|
|
1380
|
+
body: JSON.stringify(params),
|
|
1381
|
+
headers: { "Authorization": `Bearer ${clerkToken}` }
|
|
1382
|
+
});
|
|
1383
|
+
}
|
|
1384
|
+
/**
|
|
1385
|
+
* List remix offers by role. Requires Clerk JWT.
|
|
1386
|
+
* role="creator" — offers where you are the original creator.
|
|
1387
|
+
* role="requester" — offers you made.
|
|
1388
|
+
*/
|
|
1389
|
+
async getRemixOffers(query, clerkToken) {
|
|
1390
|
+
const params = new URLSearchParams({ role: query.role });
|
|
1391
|
+
if (query.page !== void 0) params.set("page", String(query.page));
|
|
1392
|
+
if (query.limit !== void 0) params.set("limit", String(query.limit));
|
|
1393
|
+
const url = `${this.baseUrl.replace(/\/$/, "")}/v1/remix-offers?${params}`;
|
|
1394
|
+
const res = await fetch(url, {
|
|
1395
|
+
headers: { ...this.baseHeaders, "Authorization": `Bearer ${clerkToken}` }
|
|
1396
|
+
});
|
|
1397
|
+
return res.json();
|
|
1398
|
+
}
|
|
1399
|
+
/**
|
|
1400
|
+
* Get a single remix offer. Clerk JWT optional (price/currency hidden for non-participants).
|
|
1401
|
+
*/
|
|
1402
|
+
async getRemixOffer(id, clerkToken) {
|
|
1403
|
+
const url = `${this.baseUrl.replace(/\/$/, "")}/v1/remix-offers/${id}`;
|
|
1404
|
+
const headers = { ...this.baseHeaders };
|
|
1405
|
+
if (clerkToken) headers["Authorization"] = `Bearer ${clerkToken}`;
|
|
1406
|
+
const res = await fetch(url, { headers });
|
|
1407
|
+
return res.json();
|
|
1408
|
+
}
|
|
1409
|
+
/**
|
|
1410
|
+
* Creator approves a remix offer (authorises the requester to mint). Requires Clerk JWT.
|
|
1411
|
+
*/
|
|
1412
|
+
confirmRemixOffer(id, params, clerkToken) {
|
|
1413
|
+
return this.request(`/v1/remix-offers/${id}/confirm`, {
|
|
1414
|
+
method: "POST",
|
|
1415
|
+
body: JSON.stringify(params),
|
|
1416
|
+
headers: { "Authorization": `Bearer ${clerkToken}` }
|
|
1417
|
+
});
|
|
1418
|
+
}
|
|
1419
|
+
/**
|
|
1420
|
+
* Creator rejects a remix offer. Requires Clerk JWT.
|
|
1421
|
+
*/
|
|
1422
|
+
rejectRemixOffer(id, clerkToken) {
|
|
1423
|
+
return this.request(`/v1/remix-offers/${id}/reject`, {
|
|
1424
|
+
method: "POST",
|
|
1425
|
+
body: JSON.stringify({}),
|
|
1426
|
+
headers: { "Authorization": `Bearer ${clerkToken}` }
|
|
1427
|
+
});
|
|
1428
|
+
}
|
|
1316
1429
|
};
|
|
1317
1430
|
|
|
1318
1431
|
// src/client.ts
|
|
@@ -1345,6 +1458,9 @@ var MedialaneClient = class {
|
|
|
1345
1458
|
}
|
|
1346
1459
|
};
|
|
1347
1460
|
|
|
1461
|
+
// src/types/api.ts
|
|
1462
|
+
var OPEN_LICENSES = ["CC0", "CC BY", "CC BY-SA", "CC BY-NC"];
|
|
1463
|
+
|
|
1348
1464
|
exports.ApiClient = ApiClient;
|
|
1349
1465
|
exports.COLLECTION_CONTRACT_MAINNET = COLLECTION_CONTRACT_MAINNET;
|
|
1350
1466
|
exports.DEFAULT_RPC_URLS = DEFAULT_RPC_URLS;
|
|
@@ -1354,6 +1470,7 @@ exports.MarketplaceModule = MarketplaceModule;
|
|
|
1354
1470
|
exports.MedialaneApiError = MedialaneApiError;
|
|
1355
1471
|
exports.MedialaneClient = MedialaneClient;
|
|
1356
1472
|
exports.MedialaneError = MedialaneError;
|
|
1473
|
+
exports.OPEN_LICENSES = OPEN_LICENSES;
|
|
1357
1474
|
exports.SUPPORTED_NETWORKS = SUPPORTED_NETWORKS;
|
|
1358
1475
|
exports.SUPPORTED_TOKENS = SUPPORTED_TOKENS;
|
|
1359
1476
|
exports.buildCancellationTypedData = buildCancellationTypedData;
|