@medialane/sdk 0.77.0 → 0.79.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 CHANGED
@@ -576,10 +576,10 @@ var ApiClient = class {
576
576
  { method: "PATCH", body: JSON.stringify(data), headers: this.bearer(clerkToken) }
577
577
  );
578
578
  }
579
- getWalletActivity(address, siwsToken, chain = "STARKNET") {
580
- return this.request(
581
- `/v1/wallet-activity?address=${this.addr(address)}&chain=${chain}`,
582
- { method: "GET", headers: this.bearer(siwsToken) }
579
+ /** No signature required — wallet activity is public on-chain data, read like any other /v1 GET. */
580
+ getWalletActivity(address, chain = "STARKNET") {
581
+ return this.get(
582
+ `/v1/wallet-activity?address=${this.addr(address)}&chain=${chain}`
583
583
  );
584
584
  }
585
585
  getGatedContent(contractAddress, clerkToken) {
@@ -1305,6 +1305,12 @@ function stringifyBigInts(obj) {
1305
1305
  function u256ToBigInt(low, high) {
1306
1306
  return BigInt(low) + (BigInt(high) << 128n);
1307
1307
  }
1308
+ function encodeU256(n) {
1309
+ return [
1310
+ (n & 0xffffffffffffffffffffffffffffffffn).toString(),
1311
+ (n >> 128n).toString()
1312
+ ];
1313
+ }
1308
1314
 
1309
1315
  // src/utils/rpc.ts
1310
1316
  var PUBLIC_RPC_FALLBACKS = [
@@ -1359,6 +1365,60 @@ function createFailoverFetch(urls, options = {}) {
1359
1365
  return failover;
1360
1366
  }
1361
1367
 
1368
+ // src/metadata.ts
1369
+ var RESERVED_TRAITS = /* @__PURE__ */ new Set([
1370
+ "Creator",
1371
+ "IP Type",
1372
+ "License",
1373
+ "Commercial Use",
1374
+ "Derivatives",
1375
+ "Attribution",
1376
+ "Territory",
1377
+ "AI Policy",
1378
+ "Royalty",
1379
+ "Edition",
1380
+ "Standard",
1381
+ "Registration"
1382
+ ]);
1383
+ var RESERVED_TRAITS_NORMALIZED = new Set([...RESERVED_TRAITS].map((t) => t.toLowerCase()));
1384
+ function buildAssetMetadata(input) {
1385
+ const attributes = [];
1386
+ if (input.creator) attributes.push({ trait_type: "Creator", value: input.creator });
1387
+ if (input.ipType) attributes.push({ trait_type: "IP Type", value: input.ipType });
1388
+ if (input.licenseType) attributes.push({ trait_type: "License", value: input.licenseType });
1389
+ if (input.commercialUse) attributes.push({ trait_type: "Commercial Use", value: input.commercialUse });
1390
+ if (input.derivatives) attributes.push({ trait_type: "Derivatives", value: input.derivatives });
1391
+ if (input.attribution) attributes.push({ trait_type: "Attribution", value: input.attribution });
1392
+ if (input.geographicScope) attributes.push({ trait_type: "Territory", value: input.geographicScope });
1393
+ if (input.aiPolicy) attributes.push({ trait_type: "AI Policy", value: input.aiPolicy });
1394
+ if (input.royalty) {
1395
+ const num = parseFloat(String(input.royalty).replace("%", ""));
1396
+ if (!isNaN(num) && num > 0) attributes.push({ trait_type: "Royalty", value: `${num}%` });
1397
+ }
1398
+ if (input.edition) attributes.push({ trait_type: "Edition", value: input.edition });
1399
+ for (const t of input.templateTraits ?? []) {
1400
+ const traitType = t.traitType?.trim() ?? "";
1401
+ const traitValue = String(t.value ?? "").trim();
1402
+ if (!traitType || !traitValue || RESERVED_TRAITS_NORMALIZED.has(traitType.toLowerCase())) continue;
1403
+ if (traitType.length > 64 || traitValue.length > 512) continue;
1404
+ attributes.push({ trait_type: traitType, value: traitValue });
1405
+ }
1406
+ if (input.licenseType) {
1407
+ attributes.push({ trait_type: "Standard", value: "Berne Convention" });
1408
+ attributes.push({
1409
+ trait_type: "Registration",
1410
+ value: input.registrationDate ?? (/* @__PURE__ */ new Date()).toISOString().split("T")[0]
1411
+ });
1412
+ }
1413
+ return {
1414
+ name: input.name,
1415
+ description: input.description ?? "",
1416
+ image: input.imageUri ?? null,
1417
+ external_url: input.externalUrl || "https://medialane.io",
1418
+ attributes
1419
+ };
1420
+ }
1421
+
1362
1422
  exports.ApiClient = ApiClient;
1363
1423
  exports.CHAINS = CHAINS;
1364
1424
  exports.DEFAULT_CHAIN = DEFAULT_CHAIN;
@@ -1367,6 +1427,7 @@ exports.FeeConfigSchema = FeeConfigSchema;
1367
1427
  exports.MedialaneApiError = MedialaneApiError;
1368
1428
  exports.OPEN_LICENSES = OPEN_LICENSES;
1369
1429
  exports.PUBLIC_RPC_FALLBACKS = PUBLIC_RPC_FALLBACKS;
1430
+ exports.RESERVED_TRAITS = RESERVED_TRAITS;
1370
1431
  exports.STARKNET_COLLECTION_1155_CLASS_HASH = STARKNET_COLLECTION_1155_CLASS_HASH;
1371
1432
  exports.STARKNET_COLLECTION_1155_CONTRACT = STARKNET_COLLECTION_1155_CONTRACT;
1372
1433
  exports.STARKNET_COLLECTION_1155_FACTORY_CLASS_HASH = STARKNET_COLLECTION_1155_FACTORY_CLASS_HASH;
@@ -1401,11 +1462,13 @@ exports.STARKNET_POP_FACTORY_CONTRACT = STARKNET_POP_FACTORY_CONTRACT;
1401
1462
  exports.SUPPORTED_TOKENS = SUPPORTED_TOKENS;
1402
1463
  exports.SUPPORTED_URL_CHAINS = SUPPORTED_URL_CHAINS;
1403
1464
  exports.assetHref = assetHref;
1465
+ exports.buildAssetMetadata = buildAssetMetadata;
1404
1466
  exports.chainFromSlug = chainFromSlug;
1405
1467
  exports.chainSlug = chainSlug;
1406
1468
  exports.coinHref = coinHref;
1407
1469
  exports.collectionHref = collectionHref;
1408
1470
  exports.createFailoverFetch = createFailoverFetch;
1471
+ exports.encodeU256 = encodeU256;
1409
1472
  exports.formatAmount = formatAmount;
1410
1473
  exports.getCoordinates = getCoordinates;
1411
1474
  exports.getListableTokens = getListableTokens;