@medialane/sdk 0.6.3 → 0.6.5
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 +51 -2
- package/dist/index.cjs +546 -22
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +610 -38
- package/dist/index.d.ts +610 -38
- package/dist/index.js +542 -24
- 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,28 @@ 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
|
+
|
|
452
|
+
### v0.6.1
|
|
453
|
+
- **Collection Drop** — new `DropService` (`client.services.drop`) with full on-chain drop management: `claim`, `adminMint`, `setClaimConditions`, `setAllowlistEnabled`, `addToAllowlist`, `batchAddToAllowlist`, `setPaused`, `withdrawPayments`, `createDrop`
|
|
454
|
+
- **`client.api.getDropCollections(opts?)`** — list all `COLLECTION_DROP` collections
|
|
455
|
+
- **`client.api.getDropMintStatus(collection, wallet)`** — returns `{ mintedByWallet, totalMinted }`
|
|
456
|
+
- **`DropMintStatus`**, **`ClaimConditions`**, **`CreateDropParams`** types exported
|
|
457
|
+
- **`DropCollectionABI`** and **`DropFactoryABI`** exported from `@medialane/sdk`
|
|
458
|
+
- **`DROP_FACTORY_CONTRACT_MAINNET`** and **`DROP_COLLECTION_CLASS_HASH_MAINNET`** constants exported
|
|
459
|
+
- **`CollectionSource`** union extended with `"COLLECTION_DROP"`
|
|
460
|
+
|
|
461
|
+
### v0.6.0
|
|
462
|
+
- **POP Protocol** — `PopService` (`client.services.pop`): `claim`, `adminMint`, `addToAllowlist`, `batchAddToAllowlist`, `removeFromAllowlist`, `setTokenUri`, `setPaused`, `createCollection`
|
|
463
|
+
- **`client.api.getPopCollections(opts?)`** and **`client.api.getPopEligibility(collection, wallet)`**
|
|
464
|
+
- **`POPCollectionABI`** and **`POPFactoryABI`** exported
|
|
465
|
+
- **`POP_FACTORY_CONTRACT_MAINNET`** and **`POP_COLLECTION_CLASS_HASH_MAINNET`** constants exported
|
|
466
|
+
|
|
418
467
|
### v0.5.7
|
|
419
468
|
- **`ApiCollectionProfile.hasGatedContent: boolean`** — whether the collection has token-gated content configured
|
|
420
469
|
- **`ApiCollectionProfile.gatedContentTitle: string | null`** — public title of gated content (shown to all users; URL is accessible to holders only via the backend gated-content endpoint)
|