@medialane/sdk 0.6.8 → 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 +62 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
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",
|
|
68
|
-
rpcUrl: "https://rpc.starknet.lava.build",
|
|
69
|
-
backendUrl: "https://medialane-backend-production.up.railway.app",
|
|
70
|
-
apiKey: "ml_live_...",
|
|
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
|
-
|
|
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
|