@medialane/sdk 0.19.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.js CHANGED
@@ -5345,11 +5345,21 @@ var Medialane1155Module = class {
5345
5345
  return build1155CancellationTypedData(params, chainId);
5346
5346
  }
5347
5347
  };
5348
-
5349
- // src/utils/address.ts
5350
5348
  function normalizeAddress(address) {
5351
- const hex = address.replace(/^0x/, "").toLowerCase();
5352
- return "0x" + hex.padStart(64, "0");
5349
+ try {
5350
+ const hex = num.toHex(BigInt(address));
5351
+ return "0x" + hex.slice(2).padStart(64, "0").toLowerCase();
5352
+ } catch {
5353
+ throw new Error(`Invalid Starknet address: "${address}"`);
5354
+ }
5355
+ }
5356
+ function normalizeHash(hash) {
5357
+ try {
5358
+ const hex = num.toHex(BigInt(hash));
5359
+ return "0x" + hex.slice(2).padStart(64, "0").toLowerCase();
5360
+ } catch {
5361
+ throw new Error(`Invalid Starknet hash: "${hash}"`);
5362
+ }
5353
5363
  }
5354
5364
  function shortenAddress(address, chars = 4) {
5355
5365
  const norm = normalizeAddress(address);
@@ -6229,8 +6239,17 @@ var MedialaneClient = class {
6229
6239
  erc1155Collection: new ERC1155CollectionService(this.config)
6230
6240
  };
6231
6241
  if (!this.config.backendUrl) {
6232
- this.api = new Proxy({}, {
6233
- get(_target, prop) {
6242
+ const sentinel = new ApiClient("https://medialane-sdk-no-backend.invalid", this.config.apiKey);
6243
+ const apiMethodNames = new Set(
6244
+ Object.getOwnPropertyNames(ApiClient.prototype).filter(
6245
+ (k) => k !== "constructor" && typeof sentinel[k] === "function"
6246
+ )
6247
+ );
6248
+ this.api = new Proxy(sentinel, {
6249
+ get(target, prop, receiver) {
6250
+ if (typeof prop === "symbol" || !apiMethodNames.has(prop)) {
6251
+ return Reflect.get(target, prop, receiver);
6252
+ }
6234
6253
  return () => {
6235
6254
  throw new Error(
6236
6255
  `backendUrl not configured. Pass backendUrl to MedialaneClient to use .api.${String(prop)}()`
@@ -6270,6 +6289,13 @@ var SERVICES = {
6270
6289
  },
6271
6290
  uiVariant: "standard",
6272
6291
  capabilities: ["list", "buy", "make_offer", "cancel", "transfer", "mint", "remix", "license"],
6292
+ events: [
6293
+ { name: "CollectionCreated", emittedBy: "factory" }
6294
+ // Per-instance ERC-721 Transfer emitted by each deployed collection; not
6295
+ // yet declared here because the indexer polls discovered instances on a
6296
+ // slow schedule. Plan 2026-05-24-data-driven-event-registry.md covers
6297
+ // the migration.
6298
+ ],
6273
6299
  metadataSchema: { licenseDefault: "CC BY-SA" }
6274
6300
  },
6275
6301
  "ip-erc721": {
@@ -6280,6 +6306,8 @@ var SERVICES = {
6280
6306
  provenance: "MEDIALANE",
6281
6307
  uiVariant: "standard",
6282
6308
  capabilities: ["list", "buy", "make_offer", "cancel", "transfer", "mint", "remix", "license"],
6309
+ // No factory — single shared contract. Events declared when the genesis
6310
+ // contract address is wired into onchain.factoryAddress here.
6283
6311
  metadataSchema: { licenseDefault: "CC BY-SA" }
6284
6312
  },
6285
6313
  "mip-erc1155": {
@@ -6295,6 +6323,9 @@ var SERVICES = {
6295
6323
  },
6296
6324
  uiVariant: "edition",
6297
6325
  capabilities: ["list", "buy", "make_offer", "cancel", "transfer", "mint", "remix", "license"],
6326
+ events: [
6327
+ { name: "CollectionDeployed", emittedBy: "factory" }
6328
+ ],
6298
6329
  metadataSchema: { licenseDefault: "CC BY-SA" }
6299
6330
  },
6300
6331
  "pop-protocol": {
@@ -6309,6 +6340,10 @@ var SERVICES = {
6309
6340
  },
6310
6341
  uiVariant: "pop",
6311
6342
  capabilities: ["claim", "transfer"],
6343
+ events: [
6344
+ { name: "CollectionCreated", emittedBy: "factory" },
6345
+ { name: "AllowlistUpdated", emittedBy: "instance", poll: "slow" }
6346
+ ],
6312
6347
  metadataSchema: { licenseDefault: "CC BY-SA" }
6313
6348
  },
6314
6349
  "drop-collection": {
@@ -6323,6 +6358,10 @@ var SERVICES = {
6323
6358
  },
6324
6359
  uiVariant: "drop",
6325
6360
  capabilities: ["claim", "list", "buy", "make_offer", "cancel", "transfer"],
6361
+ events: [
6362
+ { name: "DropCreated", emittedBy: "factory" },
6363
+ { name: "AllowlistUpdated", emittedBy: "instance", poll: "slow" }
6364
+ ],
6326
6365
  metadataSchema: { licenseDefault: "CC BY-SA" }
6327
6366
  },
6328
6367
  "medialane-marketplace-erc721": {
@@ -6337,7 +6376,12 @@ var SERVICES = {
6337
6376
  startBlock: MARKETPLACE_721_START_BLOCK_MAINNET
6338
6377
  },
6339
6378
  uiVariant: "standard",
6340
- capabilities: ["list", "buy", "make_offer", "cancel"]
6379
+ capabilities: ["list", "buy", "make_offer", "cancel"],
6380
+ events: [
6381
+ { name: "OrderCreated", emittedBy: "factory" },
6382
+ { name: "OrderFulfilled", emittedBy: "factory" },
6383
+ { name: "OrderCancelled", emittedBy: "factory" }
6384
+ ]
6341
6385
  },
6342
6386
  "medialane-marketplace-erc1155": {
6343
6387
  id: "medialane-marketplace-erc1155",
@@ -6351,7 +6395,12 @@ var SERVICES = {
6351
6395
  startBlock: MARKETPLACE_1155_START_BLOCK_MAINNET
6352
6396
  },
6353
6397
  uiVariant: "edition",
6354
- capabilities: ["list", "buy", "make_offer", "cancel"]
6398
+ capabilities: ["list", "buy", "make_offer", "cancel"],
6399
+ events: [
6400
+ { name: "OrderCreated", emittedBy: "factory" },
6401
+ { name: "OrderFulfilled", emittedBy: "factory" },
6402
+ { name: "OrderCancelled", emittedBy: "factory" }
6403
+ ]
6355
6404
  },
6356
6405
  "external-erc721": {
6357
6406
  id: "external-erc721",
@@ -6372,16 +6421,21 @@ var SERVICES = {
6372
6421
  capabilities: ["list", "buy", "make_offer", "cancel", "transfer"]
6373
6422
  }
6374
6423
  };
6424
+ function isServiceId(id) {
6425
+ return typeof id === "string" && id in SERVICES;
6426
+ }
6375
6427
  function getService(id) {
6376
- return id ? SERVICES[id] : void 0;
6428
+ return id && id in SERVICES ? SERVICES[id] : void 0;
6377
6429
  }
6378
6430
  function listServices() {
6379
6431
  return Object.values(SERVICES);
6380
6432
  }
6381
6433
  function getServicesByCapability(cap) {
6382
- return Object.values(SERVICES).filter((s) => s.capabilities.includes(cap));
6434
+ return Object.values(SERVICES).filter(
6435
+ (s) => s.capabilities.includes(cap)
6436
+ );
6383
6437
  }
6384
6438
 
6385
- export { ApiClient, COLLECTION_1155_CLASS_HASH_MAINNET, COLLECTION_1155_CONTRACT_MAINNET, COLLECTION_1155_FACTORY_CLASS_HASH_MAINNET, COLLECTION_1155_START_BLOCK_MAINNET, COLLECTION_721_CONTRACT_MAINNET, COLLECTION_721_START_BLOCK_MAINNET, CollectionRegistryABI, DEFAULT_RPC_URL, DROP_COLLECTION_CLASS_HASH_MAINNET, DROP_FACTORY_CONTRACT_MAINNET, DropCollectionABI, DropFactoryABI, DropService, ERC1155CollectionService, FeeConfigSchema, IPCOLLECTION_CLASS_HASH_MAINNET, IPCollection1155ABI, IPCollection1155FactoryABI, IPCollectionABI, IPMarketplaceABI, IPNFT_CLASS_HASH_MAINNET, IPNftABI, MARKETPLACE_1155_CLASS_HASH_MAINNET, MARKETPLACE_1155_CONTRACT_MAINNET, MARKETPLACE_1155_START_BLOCK_MAINNET, MARKETPLACE_721_CLASS_HASH_MAINNET, MARKETPLACE_721_CONTRACT_MAINNET, MARKETPLACE_721_START_BLOCK_MAINNET, MarketplaceModule, Medialane1155ABI, Medialane1155Module, MedialaneApiError, MedialaneClient, MedialaneError, NFTCOMMENTS_CONTRACT_MAINNET, OPEN_LICENSES, POPCollectionABI, POPFactoryABI, POP_COLLECTION_CLASS_HASH_MAINNET, POP_FACTORY_CONTRACT_MAINNET, PopService, SUPPORTED_NETWORKS, SUPPORTED_TOKENS, build1155CancellationTypedData, build1155FulfillmentTypedData, build1155OrderTypedData, buildCancellationTypedData, buildFeeCall, buildFulfillmentTypedData, buildOrderTypedData, encodeByteArray, formatAmount, getListableTokens, getService, getServicesByCapability, getTokenByAddress, getTokenBySymbol, listServices, normalizeAddress, parseAmount, resolveConfig, resolveFeeConfig, shortenAddress, stringifyBigInts, u256ToBigInt };
6439
+ export { ApiClient, COLLECTION_1155_CLASS_HASH_MAINNET, COLLECTION_1155_CONTRACT_MAINNET, COLLECTION_1155_FACTORY_CLASS_HASH_MAINNET, COLLECTION_1155_START_BLOCK_MAINNET, COLLECTION_721_CONTRACT_MAINNET, COLLECTION_721_START_BLOCK_MAINNET, CollectionRegistryABI, DEFAULT_RPC_URL, DROP_COLLECTION_CLASS_HASH_MAINNET, DROP_FACTORY_CONTRACT_MAINNET, DropCollectionABI, DropFactoryABI, DropService, ERC1155CollectionService, FeeConfigSchema, IPCOLLECTION_CLASS_HASH_MAINNET, IPCollection1155ABI, IPCollection1155FactoryABI, IPCollectionABI, IPMarketplaceABI, IPNFT_CLASS_HASH_MAINNET, IPNftABI, MARKETPLACE_1155_CLASS_HASH_MAINNET, MARKETPLACE_1155_CONTRACT_MAINNET, MARKETPLACE_1155_START_BLOCK_MAINNET, MARKETPLACE_721_CLASS_HASH_MAINNET, MARKETPLACE_721_CONTRACT_MAINNET, MARKETPLACE_721_START_BLOCK_MAINNET, MarketplaceModule, Medialane1155ABI, Medialane1155Module, MedialaneApiError, MedialaneClient, MedialaneError, NFTCOMMENTS_CONTRACT_MAINNET, OPEN_LICENSES, POPCollectionABI, POPFactoryABI, POP_COLLECTION_CLASS_HASH_MAINNET, POP_FACTORY_CONTRACT_MAINNET, PopService, SUPPORTED_NETWORKS, SUPPORTED_TOKENS, build1155CancellationTypedData, build1155FulfillmentTypedData, build1155OrderTypedData, buildCancellationTypedData, buildFeeCall, buildFulfillmentTypedData, buildOrderTypedData, encodeByteArray, formatAmount, getListableTokens, getService, getServicesByCapability, getTokenByAddress, getTokenBySymbol, isServiceId, listServices, normalizeAddress, normalizeHash, parseAmount, resolveConfig, resolveFeeConfig, shortenAddress, stringifyBigInts, u256ToBigInt };
6386
6440
  //# sourceMappingURL=index.js.map
6387
6441
  //# sourceMappingURL=index.js.map