@medialane/sdk 0.4.7 → 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/README.md CHANGED
@@ -199,6 +199,7 @@ const tokens = await client.api.getCollectionTokens(contract);
199
199
  const results = await client.api.search("landscape painting", 10);
200
200
  // results.data.tokens — matching tokens
201
201
  // results.data.collections — matching collections
202
+ // results.data.creators — matching creator profiles (v0.4.5)
202
203
  ```
203
204
 
204
205
  ### Activities
@@ -281,7 +282,7 @@ const metadata: IpNftMetadata = {
281
282
  image: "ipfs://...",
282
283
  external_url: "https://medialane.io",
283
284
  attributes: [
284
- { trait_type: "IP Type", value: "Music" },
285
+ { trait_type: "IP Type", value: "Audio" },
285
286
  { trait_type: "License", value: "CC BY-NC-SA" },
286
287
  { trait_type: "Commercial Use", value: "No" },
287
288
  { trait_type: "Derivatives", value: "Share-Alike" },
@@ -414,6 +415,21 @@ Built with:
414
415
 
415
416
  ## Changelog
416
417
 
418
+ ### v0.4.7
419
+ - **`IPType`** union type exported — `"Audio" | "Art" | "Documents" | "NFT" | "Video" | "Photography" | "Patents" | "Posts" | "Publications" | "RWA" | "Software" | "Custom"`
420
+
421
+ ### v0.4.6
422
+ - **`ApiUserWallet`** type + `upsertMyWallet(clerkToken)` / `getMyWallet(clerkToken)` for ChipiPay wallet registration fallback (`POST/GET /v1/users/me`)
423
+
424
+ ### v0.4.5
425
+ - **`ApiSearchCreatorResult`** type + `ApiSearchResult.creators` — creator profiles now included in search results
426
+
427
+ ### v0.4.4
428
+ - **`ApiCreatorListResult`** + `getCreators(opts?)` — list creators with search/pagination via `GET /v1/creators`
429
+
430
+ ### v0.4.3
431
+ - **`ApiCreatorProfile.username`** field + `getCreatorByUsername(username)` — resolve username slug to creator profile
432
+
417
433
  ### v0.4.2
418
434
  - **WBTC** added to `SUPPORTED_TOKENS` (`0x03fe2b97c1fd336e750087d68b9b867997fd64a2661ff3ca5a7c771641e8e7ac`, 8 decimals)
419
435
  - **`listable` field** on every `SUPPORTED_TOKENS` entry — controls whether a token appears in listing/offer dialogs vs filter-only
package/dist/index.cjs CHANGED
@@ -1105,6 +1105,16 @@ var ApiClient = class {
1105
1105
  `/v1/activities/${normalizeAddress(address)}?page=${page}&limit=${limit}`
1106
1106
  );
1107
1107
  }
1108
+ // ─── Comments ──────────────────────────────────────────────────────────────
1109
+ getTokenComments(contract, tokenId, opts = {}) {
1110
+ const params = new URLSearchParams();
1111
+ if (opts.page !== void 0) params.set("page", String(opts.page));
1112
+ if (opts.limit !== void 0) params.set("limit", String(opts.limit));
1113
+ const qs = params.toString();
1114
+ return this.get(
1115
+ `/v1/tokens/${normalizeAddress(contract)}/${tokenId}/comments${qs ? `?${qs}` : ""}`
1116
+ );
1117
+ }
1108
1118
  // ─── Search ────────────────────────────────────────────────────────────────
1109
1119
  search(q, limit = 10) {
1110
1120
  const params = new URLSearchParams({ q, limit: String(limit) });
@@ -1137,6 +1147,29 @@ var ApiClient = class {
1137
1147
  createCollectionIntent(params) {
1138
1148
  return this.post("/v1/intents/create-collection", params);
1139
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
+ }
1140
1173
  // ─── Metadata ──────────────────────────────────────────────────────────────
1141
1174
  getMetadataSignedUrl() {
1142
1175
  return this.get("/v1/metadata/signed-url");
@@ -1303,6 +1336,94 @@ var ApiClient = class {
1303
1336
  if (res.status === 404) return null;
1304
1337
  return res.json();
1305
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
+ }
1306
1427
  };
1307
1428
 
1308
1429
  // src/client.ts
@@ -1335,6 +1456,9 @@ var MedialaneClient = class {
1335
1456
  }
1336
1457
  };
1337
1458
 
1459
+ // src/types/api.ts
1460
+ var OPEN_LICENSES = ["CC0", "CC BY", "CC BY-SA", "CC BY-NC"];
1461
+
1338
1462
  exports.ApiClient = ApiClient;
1339
1463
  exports.COLLECTION_CONTRACT_MAINNET = COLLECTION_CONTRACT_MAINNET;
1340
1464
  exports.DEFAULT_RPC_URLS = DEFAULT_RPC_URLS;
@@ -1344,6 +1468,7 @@ exports.MarketplaceModule = MarketplaceModule;
1344
1468
  exports.MedialaneApiError = MedialaneApiError;
1345
1469
  exports.MedialaneClient = MedialaneClient;
1346
1470
  exports.MedialaneError = MedialaneError;
1471
+ exports.OPEN_LICENSES = OPEN_LICENSES;
1347
1472
  exports.SUPPORTED_NETWORKS = SUPPORTED_NETWORKS;
1348
1473
  exports.SUPPORTED_TOKENS = SUPPORTED_TOKENS;
1349
1474
  exports.buildCancellationTypedData = buildCancellationTypedData;