@medialane/sdk 0.6.4 → 0.6.6
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 +36 -2
- package/dist/index.cjs +3 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +16 -5
- package/dist/index.d.ts +16 -5
- package/dist/index.js +3 -3
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -11,7 +11,7 @@ The Medialane SDK provides a unified interface for interacting with the Medialan
|
|
|
11
11
|
## Features
|
|
12
12
|
|
|
13
13
|
**On-Chain Operations**
|
|
14
|
-
- Create listings (ERC-721 for sale)
|
|
14
|
+
- Create listings (ERC-721 / ERC-1155 for sale)
|
|
15
15
|
- Make offers (bid with ERC-20)
|
|
16
16
|
- Fulfill orders (purchase NFTs)
|
|
17
17
|
- Cancel active orders
|
|
@@ -19,7 +19,7 @@ The Medialane SDK provides a unified interface for interacting with the Medialan
|
|
|
19
19
|
- Built-in approval checking
|
|
20
20
|
- SNIP-12 typed data signing
|
|
21
21
|
- Mint IP NFTs into any collection
|
|
22
|
-
- Deploy new ERC-721 collections
|
|
22
|
+
- Deploy new ERC-721 or ERC-1155 collections
|
|
23
23
|
|
|
24
24
|
**REST API Client**
|
|
25
25
|
- Query orders, tokens, collections, and activities
|
|
@@ -27,6 +27,7 @@ The Medialane SDK provides a unified interface for interacting with the Medialan
|
|
|
27
27
|
- Intent-based transaction orchestration
|
|
28
28
|
- Upload metadata and files to IPFS (Pinata)
|
|
29
29
|
- Tenant portal: API keys, webhooks, usage
|
|
30
|
+
- ERC-1155 multi-holder ownership via `token.balances`
|
|
30
31
|
|
|
31
32
|
**IP Metadata Types**
|
|
32
33
|
- `IpAttribute` — typed OpenSea ERC-721 attribute
|
|
@@ -178,6 +179,32 @@ const tokens = await client.api.getTokensByOwner(address);
|
|
|
178
179
|
const history = await client.api.getTokenHistory(contract, tokenId);
|
|
179
180
|
```
|
|
180
181
|
|
|
182
|
+
### ERC-1155 Ownership
|
|
183
|
+
|
|
184
|
+
For ERC-1155 tokens, a single token ID can be held by many wallets simultaneously. Use `token.balances` instead of `token.owner`:
|
|
185
|
+
|
|
186
|
+
```typescript
|
|
187
|
+
import type { ApiTokenBalance } from "@medialane/sdk";
|
|
188
|
+
|
|
189
|
+
const { data: token } = await client.api.getToken(contract, tokenId);
|
|
190
|
+
|
|
191
|
+
// Check if a wallet owns any quantity of this token
|
|
192
|
+
const isOwner = token.balances?.some(
|
|
193
|
+
(b: ApiTokenBalance) => b.owner.toLowerCase() === wallet.toLowerCase() && BigInt(b.amount) > 0n
|
|
194
|
+
) ?? (token.owner?.toLowerCase() === wallet.toLowerCase());
|
|
195
|
+
|
|
196
|
+
// How many copies does a wallet hold?
|
|
197
|
+
const balance = token.balances?.find((b) => b.owner.toLowerCase() === wallet.toLowerCase());
|
|
198
|
+
console.log(`${wallet} holds ${balance?.amount ?? "0"} copies`);
|
|
199
|
+
|
|
200
|
+
// All current holders
|
|
201
|
+
token.balances?.forEach((b: ApiTokenBalance) => {
|
|
202
|
+
console.log(`${b.owner}: ${b.amount}`);
|
|
203
|
+
});
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
`token.owner` is deprecated and always `null` post-migration. `token.balances` is only populated on single-token fetches (`getToken`) — it is `null` on list responses.
|
|
207
|
+
|
|
181
208
|
### Query Collections
|
|
182
209
|
|
|
183
210
|
```typescript
|
|
@@ -415,6 +442,13 @@ Built with:
|
|
|
415
442
|
|
|
416
443
|
## Changelog
|
|
417
444
|
|
|
445
|
+
### v0.6.5
|
|
446
|
+
- **ERC-1155 support** — `ApiToken.balances: ApiTokenBalance[] | null` replaces the single `owner` field for ownership checks
|
|
447
|
+
- **`ApiTokenBalance`** type — `{ owner: string; amount: string }` — each entry represents one holder and their quantity
|
|
448
|
+
- **`ApiToken.owner`** deprecated — always `null` after the ERC-1155 migration; use `balances` instead
|
|
449
|
+
- **`ApiCollection.standard`** — `"ERC721" | "ERC1155" | "UNKNOWN"` detected via ERC-165 `supportsInterface`
|
|
450
|
+
- **`totalSupply` fix** — ERC-1155 collections now report `SUM(holder amounts)` instead of distinct token ID count
|
|
451
|
+
|
|
418
452
|
### v0.6.1
|
|
419
453
|
- **Collection Drop** — new `DropService` (`client.services.drop`) with full on-chain drop management: `claim`, `adminMint`, `setClaimConditions`, `setAllowlistEnabled`, `addToAllowlist`, `batchAddToAllowlist`, `setPaused`, `withdrawPayments`, `createDrop`
|
|
420
454
|
- **`client.api.getDropCollections(opts?)`** — list all `COLLECTION_DROP` collections
|
package/dist/index.cjs
CHANGED
|
@@ -7,7 +7,9 @@ var starknet = require('starknet');
|
|
|
7
7
|
|
|
8
8
|
// src/constants.ts
|
|
9
9
|
var MARKETPLACE_CONTRACT_MAINNET = "0x0234f4e8838801ebf01d7f4166d42aed9a55bc67c1301162decf9e2040e05f16";
|
|
10
|
-
var COLLECTION_CONTRACT_MAINNET = "
|
|
10
|
+
var COLLECTION_CONTRACT_MAINNET = "0x05c49ee5d3208a2c2e150fdd0c247d1195ed9ab54fa2d5dea7a633f39e4b205b";
|
|
11
|
+
var DROP_FACTORY_CONTRACT_MAINNET = "0x03587f42e29daee1b193f6cf83bf8627908ed6632d0d83fcb26225c50547d800";
|
|
12
|
+
var POP_FACTORY_CONTRACT_MAINNET = "0x00b32c34b427d8f346b5843ada6a37bd3368d879fc752cd52b68a87287f60111";
|
|
11
13
|
var MARKETPLACE_CONTRACT_SEPOLIA = "";
|
|
12
14
|
var COLLECTION_CONTRACT_SEPOLIA = "";
|
|
13
15
|
var SUPPORTED_TOKENS = [
|
|
@@ -49,9 +51,7 @@ var DEFAULT_RPC_URLS = {
|
|
|
49
51
|
mainnet: "https://rpc.starknet.lava.build",
|
|
50
52
|
sepolia: "https://rpc.starknet-sepolia.lava.build"
|
|
51
53
|
};
|
|
52
|
-
var POP_FACTORY_CONTRACT_MAINNET = "0x00b32c34b427d8f346b5843ada6a37bd3368d879fc752cd52b68a87287f60111";
|
|
53
54
|
var POP_COLLECTION_CLASS_HASH_MAINNET = "0x077c421686f10851872561953ea16898d933364b7f8937a5d7e2b1ba0a36263f";
|
|
54
|
-
var DROP_FACTORY_CONTRACT_MAINNET = "0x03587f42e29daee1b193f6cf83bf8627908ed6632d0d83fcb26225c50547d800";
|
|
55
55
|
var DROP_COLLECTION_CLASS_HASH_MAINNET = "0x00092e72cdb63067521e803aaf7d4101c3e3ce026ae6bc045ec4228027e58282";
|
|
56
56
|
|
|
57
57
|
// src/abis.ts
|