@medialane/sdk 0.4.1 → 0.4.2

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
@@ -306,16 +306,16 @@ token.data.metadata.attributes; // IpAttribute[] | null
306
306
 
307
307
  ## Supported Tokens
308
308
 
309
- | Symbol | Type | Address | Decimals |
310
- |---|---|---|---|
311
- | USDC | Circle-native (canonical) | `0x033068f6539f8e6e6b131e6b2b814e6c34a5224bc66947c47dab9dfee93b35fb` | 6 |
312
- | USDC.e | Bridged (Starkgate) | `0x053c91253bc9682c04929ca02ed00b3e423f6710d2ee7e0d5ebb06f3ecf368a8` | 6 |
313
- | USDT | Tether | `0x068f5c6a61780768455de69077e07e89787839bf8166decfbf92b645209c0fb8` | 6 |
314
- | ETH | Ether | `0x049d36570d4e46f48e99674bd3fcc84644ddd6b96f7c741b1562b82f9e004dc7` | 18 |
315
- | STRK | Starknet native | `0x04718f5a0fc34cc1af16a1cdee98ffb20c31f5cd61d6ab07201858f4287c938d` | 18 |
309
+ | Symbol | Address | Decimals | Listable |
310
+ |--------|---------|----------|----------|
311
+ | USDC | `0x033068f6539f8e6e6b131e6b2b814e6c34a5224bc66947c47dab9dfee93b35fb` | 6 | ✓ |
312
+ | USDT | `0x068f5c6a61780768455de69077e07e89787839bf8166decfbf92b645209c0fb8` | 6 | ✓ |
313
+ | ETH | `0x049d36570d4e46f48e99674bd3fcc84644ddd6b96f7c741b1562b82f9e004dc7` | 18 | |
314
+ | STRK | `0x04718f5a0fc34cc1af16a1cdee98ffb20c31f5cd61d6ab07201858f4287c938d` | 18 | ✓ |
315
+ | WBTC | `0x03fe2b97c1fd336e750087d68b9b867997fd64a2661ff3ca5a7c771641e8e7ac` | 8 | |
316
316
 
317
317
  ```typescript
318
- import { getTokenBySymbol, getTokenByAddress, SUPPORTED_TOKENS } from "@medialane/sdk";
318
+ import { getTokenBySymbol, getTokenByAddress, getListableTokens, SUPPORTED_TOKENS } from "@medialane/sdk";
319
319
 
320
320
  const usdc = getTokenBySymbol("USDC");
321
321
  const token = getTokenByAddress("0x033068...");
@@ -327,12 +327,13 @@ const token = getTokenByAddress("0x033068...");
327
327
 
328
328
  ```typescript
329
329
  import {
330
- normalizeAddress, // Pad to 64-char 0x-prefixed lowercase hex
331
- shortenAddress, // → "0x1234...5678"
332
- parseAmount, // Human-readable → smallest unit BigInt ("1.5", 6) → 1500000n
333
- formatAmount, // Smallest unit → human-readable ("1500000", 6) → "1.5"
334
- stringifyBigInts, // Recursively convert BigInt → string (for JSON)
335
- u256ToBigInt, // u256 { low, high } → BigInt
330
+ normalizeAddress, // Pad to 64-char 0x-prefixed lowercase hex
331
+ shortenAddress, // → "0x1234...5678"
332
+ parseAmount, // Human-readable → smallest unit BigInt ("1.5", 6) → 1500000n
333
+ formatAmount, // Smallest unit → human-readable ("1500000", 6) → "1.5"
334
+ stringifyBigInts, // Recursively convert BigInt → string (for JSON)
335
+ u256ToBigInt, // u256 { low, high } → BigInt
336
+ getListableTokens, // ReadonlyArray<SupportedToken> filtered to listable: true (for dialogs)
336
337
  } from "@medialane/sdk";
337
338
  ```
338
339
 
@@ -413,6 +414,28 @@ Built with:
413
414
 
414
415
  ## Changelog
415
416
 
417
+ ### v0.4.2
418
+ - **WBTC** added to `SUPPORTED_TOKENS` (`0x03fe2b97c1fd336e750087d68b9b867997fd64a2661ff3ca5a7c771641e8e7ac`, 8 decimals)
419
+ - **`listable` field** on every `SUPPORTED_TOKENS` entry — controls whether a token appears in listing/offer dialogs vs filter-only
420
+ - **`getListableTokens()`** — returns tokens filtered to `listable: true`; exported from package root
421
+ - **ETH** promoted to `listable: true` — now available in listing and offer dialogs
422
+ - **USDC.e removed** — bridged USDC (`0x053c91...`) removed entirely; only Circle-native USDC remains, to avoid user confusion
423
+
424
+ ### v0.4.1
425
+ - **Collection claims** — `claimCollection(contractAddress, walletAddress, clerkToken)` for on-chain ownership verification; `requestCollectionClaim({ contractAddress, walletAddress?, email, notes? })` for manual review
426
+ - **Collection profiles** — `getCollectionProfile(contractAddress)` and `updateCollectionProfile(contractAddress, data, clerkToken)` for enriched display metadata (displayName, description, image, bannerImage, social links)
427
+ - **Creator profiles** — `getCreatorProfile(walletAddress)` and `updateCreatorProfile(walletAddress, data, clerkToken)` for creator display metadata
428
+ - **New types** — `ApiCollectionClaim`, `ApiAdminCollectionClaim`, `ApiCollectionProfile`, `ApiCreatorProfile`
429
+ - **`ApiCollection`** extended with `source` (`"MEDIALANE_REGISTRY" | "EXTERNAL" | "PARTNERSHIP" | "IP_TICKET" | "IP_CLUB" | "GAME"`) and `claimedBy: string | null`
430
+ - `profile?: ApiCollectionProfile | null` optionally embedded on `ApiCollection` when `?include=profile`
431
+
432
+ ### v0.4.0
433
+ - **Typed error codes** — `MedialaneError` and `MedialaneApiError` now expose a `.code: MedialaneErrorCode` property (`"TOKEN_NOT_FOUND"` | `"RATE_LIMITED"` | `"INTENT_EXPIRED"` | `"UNAUTHORIZED"` | `"INVALID_PARAMS"` | `"NETWORK_NOT_SUPPORTED"` | `"UNKNOWN"`)
434
+ - **Automatic retry** — all API requests retry up to 3 times with exponential backoff (300ms base, 5s cap); 4xx errors are not retried. Configure via `retryOptions` in `MedialaneConfig`
435
+ - **`RetryOptions`** type exported from index
436
+ - **`CollectionSort`** named union type exported (`"recent" | "supply" | "floor" | "volume" | "name"`)
437
+ - **Sepolia guard** — constructing a client with `network: "sepolia"` and no explicit contract addresses now throws `NETWORK_NOT_SUPPORTED` immediately
438
+
416
439
  ### v0.3.3
417
440
  - `getCollections(page?, limit?, isKnown?, sort?)` — added `sort` parameter: `"recent"` (default) | `"supply"` | `"floor"` | `"volume"` | `"name"`
418
441
  - Default sort changed from `totalSupply DESC` to `createdAt DESC` (newest first) — matches backend default
@@ -421,15 +444,12 @@ Built with:
421
444
  - `ApiCollection.collectionId: string | null` — on-chain registry numeric ID (decimal string). Required for `createMintIntent`. Populated for collections indexed after 2026-03-09.
422
445
 
423
446
  ### v0.3.0
424
- - `normalizeAddress()` now applied internally before all API calls — callers no longer need to normalize Starknet addresses before passing them to SDK methods
425
- - `getCollectionsByOwner(owner)` — fetch collections by wallet address via API
426
-
427
- ### v0.2.8
428
- - `ApiCollection.owner: string | null`
429
- - `ApiClient.getCollectionsByOwner(owner)`
447
+ - `normalizeAddress()` applied internally before all API calls — callers no longer need to normalize Starknet addresses
448
+ - `ApiCollection.owner: string | null` — populated from intent typedData or on-chain `owner()` call
449
+ - `getCollectionsByOwner(owner)` — fetch collections by wallet address via `GET /v1/collections?owner=`
430
450
 
431
451
  ### v0.2.6
432
- - `ApiOrder.token: ApiOrderTokenMeta | null` — token name/image/description on orders (batchTokenMeta)
452
+ - `ApiOrder.token: ApiOrderTokenMeta | null` — token name/image/description embedded on orders (batchTokenMeta); no per-row `getToken` calls needed
433
453
 
434
454
  ### v0.2.0
435
455
  - `IpAttribute` and `IpNftMetadata` interfaces for IP metadata
package/dist/index.cjs CHANGED
@@ -12,31 +12,35 @@ var MARKETPLACE_CONTRACT_SEPOLIA = "";
12
12
  var COLLECTION_CONTRACT_SEPOLIA = "";
13
13
  var SUPPORTED_TOKENS = [
14
14
  {
15
- // Circle-native USDC on Starknet (canonical — preferred)
15
+ // Circle-native USDC on Starknet (canonical)
16
16
  symbol: "USDC",
17
17
  address: "0x033068f6539f8e6e6b131e6b2b814e6c34a5224bc66947c47dab9dfee93b35fb",
18
- decimals: 6
19
- },
20
- {
21
- // Bridged USDC.e (Ethereum USDC bridged via Starkgate)
22
- symbol: "USDC.e",
23
- address: "0x053c91253bc9682c04929ca02ed00b3e423f6710d2ee7e0d5ebb06f3ecf368a8",
24
- decimals: 6
18
+ decimals: 6,
19
+ listable: true
25
20
  },
26
21
  {
27
22
  symbol: "USDT",
28
23
  address: "0x068f5c6a61780768455de69077e07e89787839bf8166decfbf92b645209c0fb8",
29
- decimals: 6
24
+ decimals: 6,
25
+ listable: true
30
26
  },
31
27
  {
32
28
  symbol: "ETH",
33
29
  address: "0x049d36570d4e46f48e99674bd3fcc84644ddd6b96f7c741b1562b82f9e004dc7",
34
- decimals: 18
30
+ decimals: 18,
31
+ listable: true
35
32
  },
36
33
  {
37
34
  symbol: "STRK",
38
35
  address: "0x04718f5a0fc34cc1af16a1cdee98ffb20c31f5cd61d6ab07201858f4287c938d",
39
- decimals: 18
36
+ decimals: 18,
37
+ listable: true
38
+ },
39
+ {
40
+ symbol: "WBTC",
41
+ address: "0x03fe2b97c1fd336e750087d68b9b867997fd64a2661ff3ca5a7c771641e8e7ac",
42
+ decimals: 8,
43
+ listable: true
40
44
  }
41
45
  ];
42
46
  var DEFAULT_CURRENCY = "USDC";
@@ -398,6 +402,9 @@ function getTokenBySymbol(symbol) {
398
402
  const upper = symbol.toUpperCase();
399
403
  return SUPPORTED_TOKENS.find((t) => t.symbol === upper);
400
404
  }
405
+ function getListableTokens() {
406
+ return SUPPORTED_TOKENS.filter((t) => t.listable);
407
+ }
401
408
  function buildOrderTypedData(message, chainId) {
402
409
  return {
403
410
  domain: {
@@ -1296,6 +1303,7 @@ exports.buildCancellationTypedData = buildCancellationTypedData;
1296
1303
  exports.buildFulfillmentTypedData = buildFulfillmentTypedData;
1297
1304
  exports.buildOrderTypedData = buildOrderTypedData;
1298
1305
  exports.formatAmount = formatAmount;
1306
+ exports.getListableTokens = getListableTokens;
1299
1307
  exports.getTokenByAddress = getTokenByAddress;
1300
1308
  exports.getTokenBySymbol = getTokenBySymbol;
1301
1309
  exports.normalizeAddress = normalizeAddress;