@medialane/sdk 0.6.7 → 0.6.9

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,10 +64,10 @@ yarn add @medialane/sdk starknet
64
64
  import { MedialaneClient } from "@medialane/sdk";
65
65
 
66
66
  const client = new MedialaneClient({
67
- network: "mainnet", // "mainnet" | "sepolia"
68
- rpcUrl: "https://rpc.starknet.lava.build", // optional; defaults to Lava
69
- backendUrl: "https://medialane-backend-production.up.railway.app", // required for .api methods
70
- apiKey: "ml_live_...", // from Medialane Portal
67
+ network: "mainnet", // mainnet only
68
+ rpcUrl: "https://rpc.starknet.lava.build", // optional; defaults to Lava
69
+ backendUrl: "https://medialane-backend-production.up.railway.app", // required for .api methods
70
+ apiKey: "ml_live_...", // from Medialane Portal
71
71
  });
72
72
  ```
73
73
 
@@ -77,7 +77,11 @@ const client = new MedialaneClient({
77
77
 
78
78
  All methods require a `starknet.js` `AccountInterface`. Nonce management, SNIP-12 signing, and `waitForTransaction` are handled automatically.
79
79
 
80
- ### Create a Listing
80
+ Two marketplace modules are available:
81
+ - `client.marketplace` — ERC-721 marketplace (`Medialane` contract)
82
+ - `client.marketplace1155` — ERC-1155 marketplace (`Medialane1155` contract, deployed 2026-04-15)
83
+
84
+ ### Create a Listing (ERC-721)
81
85
 
82
86
  ```typescript
83
87
  import { Account } from "starknet";
@@ -153,6 +157,59 @@ const result = await client.marketplace.createCollection(account, {
153
157
 
154
158
  ---
155
159
 
160
+ ## ERC-1155 Marketplace (Medialane1155)
161
+
162
+ For IP assets from ERC-1155 collections (e.g. IP-Programmable-ERC1155-Collections). Contract: `0x042005e9b85536072bfa260b95aa6aaef07f48e622031657384d2375195d7123`.
163
+
164
+ ### Create an ERC-1155 Listing
165
+
166
+ ```typescript
167
+ const result = await client.marketplace1155.createListing(account, {
168
+ nftContract: "0x...", // ERC-1155 collection address
169
+ tokenId: "1",
170
+ amount: "10", // number of tokens to sell
171
+ pricePerUnit: "1", // human-readable price per token (e.g. "1" USDC)
172
+ currency: "USDC",
173
+ durationSeconds: 86400 * 30,
174
+ });
175
+ ```
176
+
177
+ `set_approval_for_all` is granted automatically if not already in place.
178
+
179
+ ### Fulfill an ERC-1155 Order
180
+
181
+ ```typescript
182
+ // Fetch order details first to get paymentToken and totalPrice
183
+ const details = await client.api.getOrder(orderHash);
184
+
185
+ const result = await client.marketplace1155.fulfillOrder(account, {
186
+ orderHash: "0x...",
187
+ paymentToken: "0x033068...", // from order details
188
+ totalPrice: "10000000", // pricePerUnit × amount in raw token units
189
+ });
190
+ ```
191
+
192
+ ERC-2981 royalties are automatically deducted by the contract at fulfillment.
193
+
194
+ ### Cancel an ERC-1155 Order
195
+
196
+ ```typescript
197
+ const result = await client.marketplace1155.cancelOrder(account, {
198
+ orderHash: "0x...",
199
+ });
200
+ ```
201
+
202
+ ### SNIP-12 Typed Data Builders (ChipiPay / custom flows)
203
+
204
+ ```typescript
205
+ import { build1155OrderTypedData, build1155FulfillmentTypedData, build1155CancellationTypedData } from "@medialane/sdk";
206
+ import { constants } from "starknet";
207
+
208
+ const typedData = build1155OrderTypedData(orderParams, constants.StarknetChainId.SN_MAIN);
209
+ ```
210
+
211
+ ---
212
+
156
213
  ## REST API
157
214
 
158
215
  ### Query Orders
@@ -442,6 +499,12 @@ Built with:
442
499
 
443
500
  ## Changelog
444
501
 
502
+ ### v0.6.7
503
+ - **`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.
504
+
505
+ ### v0.6.6
506
+ - **`COLLECTION_CONTRACT_MAINNET`** updated to audited v2 contract address `0x05c49ee5d3208a2c2e150fdd0c247d1195ed9ab54fa2d5dea7a633f39e4b205b`
507
+
445
508
  ### v0.6.5
446
509
  - **ERC-1155 support** — `ApiToken.balances: ApiTokenBalance[] | null` replaces the single `owner` field for ownership checks
447
510
  - **`ApiTokenBalance`** type — `{ owner: string; amount: string }` — each entry represents one holder and their quantity