@medialane/sdk 0.52.0 → 0.53.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
@@ -75,11 +75,11 @@ const client = new MedialaneClient({
75
75
 
76
76
  ## Marketplace Operations (On-Chain)
77
77
 
78
- All methods require a `starknet.js` `AccountInterface`. SNIP-12 signing and `waitForTransaction` are handled automatically. Fulfilment is **unsigned** — the caller is the fulfiller, so there is no `fulfiller`/`offerer` field to pass; cancellation still signs, but without a nonce (a per-offerer `counter` replaces it, see `incrementCounter`).
78
+ All methods require a `starknet.js` `AccountInterface`. Nonce management, SNIP-12 signing, and `waitForTransaction` are handled automatically.
79
79
 
80
80
  Two marketplace modules are available:
81
- - `client.marketplace` — ERC-721 marketplace (`Medialane721`)
82
- - `client.marketplace1155` — ERC-1155 marketplace (`Medialane1155`)
81
+ - `client.marketplace` — ERC-721 marketplace (`Medialane` contract)
82
+ - `client.marketplace1155` — ERC-1155 marketplace (`Medialane1155V2` contract, deployed 2026-04-28)
83
83
 
84
84
  ### Create a Listing (ERC-721)
85
85
 
@@ -88,10 +88,10 @@ import { Account } from "starknet";
88
88
 
89
89
  const result = await client.marketplace.createListing(account, {
90
90
  nftContract: "0x05e73b7...",
91
- tokenId: "42",
91
+ tokenId: 42n,
92
92
  currency: "USDC",
93
93
  price: "1000000", // 1 USDC (6 decimals)
94
- durationSeconds: 86400 * 30, // 30 days
94
+ endTime: Math.floor(Date.now() / 1000) + 86400 * 30, // 30 days
95
95
  });
96
96
  console.log("Listed:", result.txHash);
97
97
  ```
@@ -101,23 +101,19 @@ console.log("Listed:", result.txHash);
101
101
  ```typescript
102
102
  const result = await client.marketplace.makeOffer(account, {
103
103
  nftContract: "0x05e73b7...",
104
- tokenId: "42",
104
+ tokenId: 42n,
105
105
  currency: "USDC",
106
106
  price: "500000", // 0.5 USDC
107
- durationSeconds: 86400 * 7,
107
+ endTime: Math.floor(Date.now() / 1000) + 86400 * 7,
108
108
  });
109
109
  ```
110
110
 
111
111
  ### Fulfill an Order
112
112
 
113
113
  ```typescript
114
- // Fetch order details first to get paymentToken and totalPrice
115
- const details = await client.api.getOrder(orderHash);
116
-
117
114
  const result = await client.marketplace.fulfillOrder(account, {
118
115
  orderHash: "0x...",
119
- paymentToken: "0x033068...", // from order details
120
- totalPrice: "1000000", // raw token units
116
+ fulfiller: account.address,
121
117
  });
122
118
  ```
123
119
 
@@ -125,8 +121,8 @@ const result = await client.marketplace.fulfillOrder(account, {
125
121
 
126
122
  ```typescript
127
123
  const result = await client.marketplace.checkoutCart(account, [
128
- { orderHash: "0x...", considerationToken: "0x033068...", considerationAmount: "1000000" },
129
- { orderHash: "0x...", considerationToken: "0x033068...", considerationAmount: "500000" },
124
+ { orderHash: "0x...", fulfiller: account.address },
125
+ { orderHash: "0x...", fulfiller: account.address },
130
126
  ]);
131
127
  ```
132
128
 
@@ -135,16 +131,10 @@ const result = await client.marketplace.checkoutCart(account, [
135
131
  ```typescript
136
132
  const result = await client.marketplace.cancelOrder(account, {
137
133
  orderHash: "0x...",
134
+ offerer: account.address,
138
135
  });
139
136
  ```
140
137
 
141
- ### Bulk-Cancel (Invalidate All Open Orders)
142
-
143
- ```typescript
144
- // Bumps the caller's counter — every previously-registered order becomes unfulfillable.
145
- await client.marketplace.incrementCounter(account);
146
- ```
147
-
148
138
  ### Mint an IP Asset
149
139
 
150
140
  ```typescript
@@ -152,7 +142,6 @@ const result = await client.marketplace.mint(account, {
152
142
  collectionId: "1", // collection ID on the registry
153
143
  recipient: account.address,
154
144
  tokenUri: "ipfs://...", // IPFS URI of the metadata JSON
155
- royaltyBps: 500, // EIP-2981 secondary-sale royalty, 0-10_000 (required since MIP v0.4.0)
156
145
  });
157
146
  ```
158
147
 
@@ -170,7 +159,7 @@ const result = await client.marketplace.createCollection(account, {
170
159
 
171
160
  ## ERC-1155 Marketplace (Medialane1155)
172
161
 
173
- For IP assets from ERC-1155 collections (e.g. IP-Programmable-ERC1155-Collections). Contract address: see `getCoordinates("STARKNET").marketplace1155` in `src/chains.ts` (the single source — do not hardcode it here, it changes on redeploy).
162
+ For IP assets from ERC-1155 collections (e.g. IP-Programmable-ERC1155-Collections). Contract: `0x02bfa521c25461a09d735889b469418608d7d92f8b26e3d37ef174a4c2e22f99`.
174
163
 
175
164
  ### Create an ERC-1155 Listing
176
165
 
@@ -212,11 +201,8 @@ const result = await client.marketplace1155.cancelOrder(account, {
212
201
 
213
202
  ### SNIP-12 Typed Data Builders (ChipiPay / custom flows)
214
203
 
215
- Listing/offer and cancellation are signed; fulfilment is an **unsigned** call (the buyer is
216
- the fulfiller, since v0.26.0) — there is no fulfillment typed-data builder.
217
-
218
204
  ```typescript
219
- import { build1155OrderTypedData, build1155CancellationTypedData } from "@medialane/sdk";
205
+ import { build1155OrderTypedData, build1155FulfillmentTypedData, build1155CancellationTypedData } from "@medialane/sdk";
220
206
  import { constants } from "starknet";
221
207
 
222
208
  const typedData = build1155OrderTypedData(orderParams, constants.StarknetChainId.SN_MAIN);