@medialane/sdk 0.37.0 → 0.38.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
@@ -64,8 +64,8 @@ yarn add @medialane/sdk starknet
64
64
  import { MedialaneClient } from "@medialane/sdk";
65
65
 
66
66
  const client = new MedialaneClient({
67
- network: "mainnet", // mainnet only
68
- rpcUrl: "https://rpc.starknet.lava.build", // optional; defaults to Lava
67
+ chain: "STARKNET", // chain-scoped (default "STARKNET"); replaces `network` (v0.37.0)
68
+ rpcUrl: "https://rpc.starknet.lava.build", // optional; defaults to the chain's registry rpcUrl
69
69
  backendUrl: "https://medialane-backend-production.up.railway.app", // required for .api methods
70
70
  apiKey: "ml_live_...", // from Medialane Portal
71
71
  });
@@ -412,8 +412,11 @@ const token = getTokenByAddress("0x033068...");
412
412
 
413
413
  ```typescript
414
414
  import {
415
- normalizeAddress, // Pad to 64-char 0x-prefixed lowercase hex
416
- shortenAddress, // → "0x1234...5678"
415
+ normalizeAddress, // (chain, address) canonical form per chain (Starknet pad / EVM EIP-55 / Solana base58)
416
+ shortenAddress, // (chain, address) → "0x1234...5678"
417
+ getCoordinates, // (chain) → that chain's service coordinates from the registry
418
+ CHAINS, // readonly ["STARKNET","ETHEREUM","SOLANA","BASE","BITCOIN"]
419
+ type Chain,
417
420
  parseAmount, // Human-readable → smallest unit BigInt ("1.5", 6) → 1500000n
418
421
  formatAmount, // Smallest unit → human-readable ("1500000", 6) → "1.5"
419
422
  stringifyBigInts, // Recursively convert BigInt → string (for JSON)
@@ -454,8 +457,8 @@ try {
454
457
 
455
458
  | Option | Type | Default | Description |
456
459
  |---|---|---|---|
457
- | `network` | `"mainnet" \| "sepolia"` | `"mainnet"` | Starknet network |
458
- | `rpcUrl` | `string` | Lava public endpoint | JSON-RPC URL |
460
+ | `chain` | `Chain` (`"STARKNET" \| "ETHEREUM" \| "SOLANA" \| "BASE" \| "BITCOIN"`) | `"STARKNET"` | The chain this client is scoped to. Coordinates resolve from the `coordinates[chain]` registry (`chains.ts`). Replaces `network` (v0.37.0). |
461
+ | `rpcUrl` | `string` | the chain's registry `rpcUrl` | JSON-RPC URL override |
459
462
  | `backendUrl` | `string` | — | Medialane API base URL (required for `.api.*`) |
460
463
  | `apiKey` | `string` | — | API key from [Medialane Portal](https://medialane.xyz) |
461
464
  | `marketplace721Contract` | `string` | Mainnet default | ERC-721 marketplace protocol override |
@@ -503,6 +506,15 @@ Built with:
503
506
 
504
507
  ## Changelog
505
508
 
509
+ > Full history in [CHANGELOG.md](./CHANGELOG.md). Highlights below.
510
+
511
+ ### v0.37.0 — multichain readiness (BREAKING)
512
+ - **Chain is a first-class axis.** New `chains.ts` `coordinates[chain]` registry is the single source of per-chain service coordinates (`CHAINS`, `getCoordinates`, `DEFAULT_CHAIN`, `Chain`, `ChainCoordinates`); the flat `*_MAINNET` constants derive from it.
513
+ - **`MedialaneConfig.chain` replaces `network`** — the client is chain-scoped; `client.network` getter → `client.chain`.
514
+ - **`ServiceDefinition.onchain` is per-chain** — `Partial<Record<Chain, …>>`; read `service.onchain?.STARKNET?.factoryAddress`.
515
+ - **`normalizeAddress(chain, address)`** — per-chain codec (Starknet pad / EVM EIP-55 / Solana base58; Bitcoin not yet implemented).
516
+ - **Removed** `SUPPORTED_NETWORKS`, `DEFAULT_RPC_URL`, `Network` (mainnet-only — coordinates key by chain alone). `getChainId(config)` throws for non-Starknet.
517
+
506
518
  ### v0.6.7
507
519
  - **`CollectionRegistryABI`** exported from `@medialane/sdk` — minimal ABI covering `list_user_collections` and `get_collection` on the collection registry contract. Eliminates duplicated inline ABI definitions in consuming apps.
508
520
 
package/dist/index.cjs CHANGED
@@ -6083,6 +6083,20 @@ var ApiClient = class {
6083
6083
  );
6084
6084
  return res.data;
6085
6085
  }
6086
+ // ─── Coins (fungible — ERC-20 etc.) ───────────────────────────────────────────
6087
+ // Coins are a separate model from Collections (spec 2026-06-14). Price/liquidity
6088
+ // is read live from Ekubo (CreatorCoinService.getPrice), never from these.
6089
+ getCoins(opts = {}) {
6090
+ const params = new URLSearchParams();
6091
+ if (opts.page) params.set("page", String(opts.page));
6092
+ if (opts.limit) params.set("limit", String(opts.limit));
6093
+ if (opts.service) params.set("service", opts.service);
6094
+ const qs = params.toString();
6095
+ return this.get(`/v1/coins${qs ? `?${qs}` : ""}`);
6096
+ }
6097
+ getCoin(contract) {
6098
+ return this.get(`/v1/coins/${this.addr(contract)}`);
6099
+ }
6086
6100
  // ─── Collection Drop ────────────────────────────────────────────────────────
6087
6101
  getDropCollections(opts = {}) {
6088
6102
  return this.getCollections(opts.page ?? 1, opts.limit ?? 20, void 0, opts.sort, "COLLECTION_DROP");