@medialane/sdk 0.20.0 → 0.21.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
@@ -5347,11 +5347,21 @@ var Medialane1155Module = class {
5347
5347
  return build1155CancellationTypedData(params, chainId);
5348
5348
  }
5349
5349
  };
5350
-
5351
- // src/utils/address.ts
5352
5350
  function normalizeAddress(address) {
5353
- const hex = address.replace(/^0x/, "").toLowerCase();
5354
- return "0x" + hex.padStart(64, "0");
5351
+ try {
5352
+ const hex = starknet.num.toHex(BigInt(address));
5353
+ return "0x" + hex.slice(2).padStart(64, "0").toLowerCase();
5354
+ } catch {
5355
+ throw new Error(`Invalid Starknet address: "${address}"`);
5356
+ }
5357
+ }
5358
+ function normalizeHash(hash) {
5359
+ try {
5360
+ const hex = starknet.num.toHex(BigInt(hash));
5361
+ return "0x" + hex.slice(2).padStart(64, "0").toLowerCase();
5362
+ } catch {
5363
+ throw new Error(`Invalid Starknet hash: "${hash}"`);
5364
+ }
5355
5365
  }
5356
5366
  function shortenAddress(address, chars = 4) {
5357
5367
  const norm = normalizeAddress(address);
@@ -6231,8 +6241,17 @@ var MedialaneClient = class {
6231
6241
  erc1155Collection: new ERC1155CollectionService(this.config)
6232
6242
  };
6233
6243
  if (!this.config.backendUrl) {
6234
- this.api = new Proxy({}, {
6235
- get(_target, prop) {
6244
+ const sentinel = new ApiClient("https://medialane-sdk-no-backend.invalid", this.config.apiKey);
6245
+ const apiMethodNames = new Set(
6246
+ Object.getOwnPropertyNames(ApiClient.prototype).filter(
6247
+ (k) => k !== "constructor" && typeof sentinel[k] === "function"
6248
+ )
6249
+ );
6250
+ this.api = new Proxy(sentinel, {
6251
+ get(target, prop, receiver) {
6252
+ if (typeof prop === "symbol" || !apiMethodNames.has(prop)) {
6253
+ return Reflect.get(target, prop, receiver);
6254
+ }
6236
6255
  return () => {
6237
6256
  throw new Error(
6238
6257
  `backendUrl not configured. Pass backendUrl to MedialaneClient to use .api.${String(prop)}()`
@@ -6272,6 +6291,13 @@ var SERVICES = {
6272
6291
  },
6273
6292
  uiVariant: "standard",
6274
6293
  capabilities: ["list", "buy", "make_offer", "cancel", "transfer", "mint", "remix", "license"],
6294
+ events: [
6295
+ { name: "CollectionCreated", emittedBy: "factory" }
6296
+ // Per-instance ERC-721 Transfer emitted by each deployed collection; not
6297
+ // yet declared here because the indexer polls discovered instances on a
6298
+ // slow schedule. Plan 2026-05-24-data-driven-event-registry.md covers
6299
+ // the migration.
6300
+ ],
6275
6301
  metadataSchema: { licenseDefault: "CC BY-SA" }
6276
6302
  },
6277
6303
  "ip-erc721": {
@@ -6282,6 +6308,8 @@ var SERVICES = {
6282
6308
  provenance: "MEDIALANE",
6283
6309
  uiVariant: "standard",
6284
6310
  capabilities: ["list", "buy", "make_offer", "cancel", "transfer", "mint", "remix", "license"],
6311
+ // No factory — single shared contract. Events declared when the genesis
6312
+ // contract address is wired into onchain.factoryAddress here.
6285
6313
  metadataSchema: { licenseDefault: "CC BY-SA" }
6286
6314
  },
6287
6315
  "mip-erc1155": {
@@ -6297,6 +6325,9 @@ var SERVICES = {
6297
6325
  },
6298
6326
  uiVariant: "edition",
6299
6327
  capabilities: ["list", "buy", "make_offer", "cancel", "transfer", "mint", "remix", "license"],
6328
+ events: [
6329
+ { name: "CollectionDeployed", emittedBy: "factory" }
6330
+ ],
6300
6331
  metadataSchema: { licenseDefault: "CC BY-SA" }
6301
6332
  },
6302
6333
  "pop-protocol": {
@@ -6311,6 +6342,10 @@ var SERVICES = {
6311
6342
  },
6312
6343
  uiVariant: "pop",
6313
6344
  capabilities: ["claim", "transfer"],
6345
+ events: [
6346
+ { name: "CollectionCreated", emittedBy: "factory" },
6347
+ { name: "AllowlistUpdated", emittedBy: "instance", poll: "slow" }
6348
+ ],
6314
6349
  metadataSchema: { licenseDefault: "CC BY-SA" }
6315
6350
  },
6316
6351
  "drop-collection": {
@@ -6325,6 +6360,10 @@ var SERVICES = {
6325
6360
  },
6326
6361
  uiVariant: "drop",
6327
6362
  capabilities: ["claim", "list", "buy", "make_offer", "cancel", "transfer"],
6363
+ events: [
6364
+ { name: "DropCreated", emittedBy: "factory" },
6365
+ { name: "AllowlistUpdated", emittedBy: "instance", poll: "slow" }
6366
+ ],
6328
6367
  metadataSchema: { licenseDefault: "CC BY-SA" }
6329
6368
  },
6330
6369
  "medialane-marketplace-erc721": {
@@ -6339,7 +6378,12 @@ var SERVICES = {
6339
6378
  startBlock: MARKETPLACE_721_START_BLOCK_MAINNET
6340
6379
  },
6341
6380
  uiVariant: "standard",
6342
- capabilities: ["list", "buy", "make_offer", "cancel"]
6381
+ capabilities: ["list", "buy", "make_offer", "cancel"],
6382
+ events: [
6383
+ { name: "OrderCreated", emittedBy: "factory" },
6384
+ { name: "OrderFulfilled", emittedBy: "factory" },
6385
+ { name: "OrderCancelled", emittedBy: "factory" }
6386
+ ]
6343
6387
  },
6344
6388
  "medialane-marketplace-erc1155": {
6345
6389
  id: "medialane-marketplace-erc1155",
@@ -6353,7 +6397,12 @@ var SERVICES = {
6353
6397
  startBlock: MARKETPLACE_1155_START_BLOCK_MAINNET
6354
6398
  },
6355
6399
  uiVariant: "edition",
6356
- capabilities: ["list", "buy", "make_offer", "cancel"]
6400
+ capabilities: ["list", "buy", "make_offer", "cancel"],
6401
+ events: [
6402
+ { name: "OrderCreated", emittedBy: "factory" },
6403
+ { name: "OrderFulfilled", emittedBy: "factory" },
6404
+ { name: "OrderCancelled", emittedBy: "factory" }
6405
+ ]
6357
6406
  },
6358
6407
  "external-erc721": {
6359
6408
  id: "external-erc721",
@@ -6450,6 +6499,7 @@ exports.getTokenBySymbol = getTokenBySymbol;
6450
6499
  exports.isServiceId = isServiceId;
6451
6500
  exports.listServices = listServices;
6452
6501
  exports.normalizeAddress = normalizeAddress;
6502
+ exports.normalizeHash = normalizeHash;
6453
6503
  exports.parseAmount = parseAmount;
6454
6504
  exports.resolveConfig = resolveConfig;
6455
6505
  exports.resolveFeeConfig = resolveFeeConfig;