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