@medialane/sdk 0.52.0 → 0.54.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 +13 -27
- package/dist/index.cjs +10721 -9656
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +9600 -32
- package/dist/index.d.ts +9600 -32
- package/dist/index.js +10710 -9627
- package/dist/index.js.map +1 -1
- package/package.json +4 -44
- package/dist/chains-DE8AJMIY.d.cts +0 -96
- package/dist/chains-DE8AJMIY.d.ts +0 -96
- package/dist/evm/index.cjs +0 -357
- package/dist/evm/index.cjs.map +0 -1
- package/dist/evm/index.d.cts +0 -614
- package/dist/evm/index.d.ts +0 -614
- package/dist/evm/index.js +0 -346
- package/dist/evm/index.js.map +0 -1
- package/dist/index-DkyG8aRV.d.cts +0 -8840
- package/dist/index-aEIEolh3.d.ts +0 -8840
- package/dist/solana/index.cjs +0 -253
- package/dist/solana/index.cjs.map +0 -1
- package/dist/solana/index.d.cts +0 -63
- package/dist/solana/index.d.ts +0 -63
- package/dist/solana/index.js +0 -241
- package/dist/solana/index.js.map +0 -1
- package/dist/starknet/index.cjs +0 -11203
- package/dist/starknet/index.cjs.map +0 -1
- package/dist/starknet/index.d.cts +0 -4
- package/dist/starknet/index.d.ts +0 -4
- package/dist/starknet/index.js +0 -11136
- package/dist/starknet/index.js.map +0 -1
- package/dist/stellar/index.cjs +0 -165
- package/dist/stellar/index.cjs.map +0 -1
- package/dist/stellar/index.d.cts +0 -50
- package/dist/stellar/index.d.ts +0 -50
- package/dist/stellar/index.js +0 -162
- package/dist/stellar/index.js.map +0 -1
- package/dist/types-CYu4fwq8.d.cts +0 -78
- package/dist/types-DdwylC5C.d.ts +0 -78
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.
|
|
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 (`
|
|
82
|
-
- `client.marketplace1155` — ERC-1155 marketplace (`
|
|
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:
|
|
91
|
+
tokenId: 42n,
|
|
92
92
|
currency: "USDC",
|
|
93
93
|
price: "1000000", // 1 USDC (6 decimals)
|
|
94
|
-
|
|
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:
|
|
104
|
+
tokenId: 42n,
|
|
105
105
|
currency: "USDC",
|
|
106
106
|
price: "500000", // 0.5 USDC
|
|
107
|
-
|
|
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
|
-
|
|
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...",
|
|
129
|
-
{ orderHash: "0x...",
|
|
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
|
|
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);
|