@misonetwork/sdk 0.1.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/LICENSE +201 -0
- package/README.md +644 -0
- package/dist/client.d.ts +197 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +218 -0
- package/dist/client.js.map +1 -0
- package/dist/contracts/composition_credits/composition_credits.d.ts +181 -0
- package/dist/contracts/composition_credits/composition_credits.d.ts.map +1 -0
- package/dist/contracts/composition_credits/composition_credits.js +109 -0
- package/dist/contracts/composition_credits/composition_credits.js.map +1 -0
- package/dist/contracts/composition_credits/composition_party_role.d.ts +119 -0
- package/dist/contracts/composition_credits/composition_party_role.d.ts.map +1 -0
- package/dist/contracts/composition_credits/composition_party_role.js +139 -0
- package/dist/contracts/composition_credits/composition_party_role.js.map +1 -0
- package/dist/contracts/composition_credits/deps/miso_credit/credit.d.ts +24 -0
- package/dist/contracts/composition_credits/deps/miso_credit/credit.d.ts.map +1 -0
- package/dist/contracts/composition_credits/deps/miso_credit/credit.js +23 -0
- package/dist/contracts/composition_credits/deps/miso_credit/credit.js.map +1 -0
- package/dist/contracts/composition_credits/deps/sui/vec_map.d.ts +37 -0
- package/dist/contracts/composition_credits/deps/sui/vec_map.d.ts.map +1 -0
- package/dist/contracts/composition_credits/deps/sui/vec_map.js +28 -0
- package/dist/contracts/composition_credits/deps/sui/vec_map.js.map +1 -0
- package/dist/contracts/composition_royalty_pool/composition_royalty_pool.d.ts +87 -0
- package/dist/contracts/composition_royalty_pool/composition_royalty_pool.d.ts.map +1 -0
- package/dist/contracts/composition_royalty_pool/composition_royalty_pool.js +80 -0
- package/dist/contracts/composition_royalty_pool/composition_royalty_pool.js.map +1 -0
- package/dist/contracts/cover_art/cover_art.d.ts +85 -0
- package/dist/contracts/cover_art/cover_art.d.ts.map +1 -0
- package/dist/contracts/cover_art/cover_art.js +68 -0
- package/dist/contracts/cover_art/cover_art.js.map +1 -0
- package/dist/contracts/cover_art/deps/ori/walrus_data.d.ts +52 -0
- package/dist/contracts/cover_art/deps/ori/walrus_data.d.ts.map +1 -0
- package/dist/contracts/cover_art/deps/ori/walrus_data.js +37 -0
- package/dist/contracts/cover_art/deps/ori/walrus_data.js.map +1 -0
- package/dist/contracts/miso/composition.d.ts +231 -0
- package/dist/contracts/miso/composition.d.ts.map +1 -0
- package/dist/contracts/miso/composition.js +231 -0
- package/dist/contracts/miso/composition.js.map +1 -0
- package/dist/contracts/miso/deal.d.ts +184 -0
- package/dist/contracts/miso/deal.d.ts.map +1 -0
- package/dist/contracts/miso/deal.js +184 -0
- package/dist/contracts/miso/deal.js.map +1 -0
- package/dist/contracts/miso/deps/bps/bps.d.ts +19 -0
- package/dist/contracts/miso/deps/bps/bps.d.ts.map +1 -0
- package/dist/contracts/miso/deps/bps/bps.js +21 -0
- package/dist/contracts/miso/deps/bps/bps.js.map +1 -0
- package/dist/contracts/miso/recording.d.ts +228 -0
- package/dist/contracts/miso/recording.d.ts.map +1 -0
- package/dist/contracts/miso/recording.js +221 -0
- package/dist/contracts/miso/recording.js.map +1 -0
- package/dist/contracts/miso/release.d.ts +280 -0
- package/dist/contracts/miso/release.d.ts.map +1 -0
- package/dist/contracts/miso/release.js +282 -0
- package/dist/contracts/miso/release.js.map +1 -0
- package/dist/contracts/miso/track.d.ts +118 -0
- package/dist/contracts/miso/track.d.ts.map +1 -0
- package/dist/contracts/miso/track.js +118 -0
- package/dist/contracts/miso/track.js.map +1 -0
- package/dist/contracts/recording_credits/deps/miso_credit/credit.d.ts +24 -0
- package/dist/contracts/recording_credits/deps/miso_credit/credit.d.ts.map +1 -0
- package/dist/contracts/recording_credits/deps/miso_credit/credit.js +23 -0
- package/dist/contracts/recording_credits/deps/miso_credit/credit.js.map +1 -0
- package/dist/contracts/recording_credits/deps/sui/vec_map.d.ts +37 -0
- package/dist/contracts/recording_credits/deps/sui/vec_map.d.ts.map +1 -0
- package/dist/contracts/recording_credits/deps/sui/vec_map.js +28 -0
- package/dist/contracts/recording_credits/deps/sui/vec_map.js.map +1 -0
- package/dist/contracts/recording_credits/deps/sui/vec_set.d.ts +21 -0
- package/dist/contracts/recording_credits/deps/sui/vec_set.d.ts.map +1 -0
- package/dist/contracts/recording_credits/deps/sui/vec_set.js +20 -0
- package/dist/contracts/recording_credits/deps/sui/vec_set.js.map +1 -0
- package/dist/contracts/recording_credits/recording_credits.d.ts +2313 -0
- package/dist/contracts/recording_credits/recording_credits.d.ts.map +1 -0
- package/dist/contracts/recording_credits/recording_credits.js +270 -0
- package/dist/contracts/recording_credits/recording_credits.js.map +1 -0
- package/dist/contracts/recording_credits/recording_party_role.d.ts +1174 -0
- package/dist/contracts/recording_credits/recording_party_role.d.ts.map +1 -0
- package/dist/contracts/recording_credits/recording_party_role.js +692 -0
- package/dist/contracts/recording_credits/recording_party_role.js.map +1 -0
- package/dist/contracts/recording_royalty_pool/recording_royalty_pool.d.ts +90 -0
- package/dist/contracts/recording_royalty_pool/recording_royalty_pool.d.ts.map +1 -0
- package/dist/contracts/recording_royalty_pool/recording_royalty_pool.js +80 -0
- package/dist/contracts/recording_royalty_pool/recording_royalty_pool.js.map +1 -0
- package/dist/contracts/release_cover_art/deps/0x340057f2174fb59e4626742dd2b46c662237837b6187450cb59e4976ce7eac78/walrus_data.d.ts +52 -0
- package/dist/contracts/release_cover_art/deps/0x340057f2174fb59e4626742dd2b46c662237837b6187450cb59e4976ce7eac78/walrus_data.d.ts.map +1 -0
- package/dist/contracts/release_cover_art/deps/0x340057f2174fb59e4626742dd2b46c662237837b6187450cb59e4976ce7eac78/walrus_data.js +37 -0
- package/dist/contracts/release_cover_art/deps/0x340057f2174fb59e4626742dd2b46c662237837b6187450cb59e4976ce7eac78/walrus_data.js.map +1 -0
- package/dist/contracts/release_cover_art/deps/cover_art/cover_art.d.ts +46 -0
- package/dist/contracts/release_cover_art/deps/cover_art/cover_art.d.ts.map +1 -0
- package/dist/contracts/release_cover_art/deps/cover_art/cover_art.js +21 -0
- package/dist/contracts/release_cover_art/deps/cover_art/cover_art.js.map +1 -0
- package/dist/contracts/release_cover_art/deps/per_track/per_track.d.ts +33 -0
- package/dist/contracts/release_cover_art/deps/per_track/per_track.d.ts.map +1 -0
- package/dist/contracts/release_cover_art/deps/per_track/per_track.js +32 -0
- package/dist/contracts/release_cover_art/deps/per_track/per_track.js.map +1 -0
- package/dist/contracts/release_cover_art/release_cover_art.d.ts +300 -0
- package/dist/contracts/release_cover_art/release_cover_art.d.ts.map +1 -0
- package/dist/contracts/release_cover_art/release_cover_art.js +168 -0
- package/dist/contracts/release_cover_art/release_cover_art.js.map +1 -0
- package/dist/contracts/release_credits/deps/miso_credit/credit.d.ts +24 -0
- package/dist/contracts/release_credits/deps/miso_credit/credit.d.ts.map +1 -0
- package/dist/contracts/release_credits/deps/miso_credit/credit.js +23 -0
- package/dist/contracts/release_credits/deps/miso_credit/credit.js.map +1 -0
- package/dist/contracts/release_credits/deps/sui/vec_map.d.ts +37 -0
- package/dist/contracts/release_credits/deps/sui/vec_map.d.ts.map +1 -0
- package/dist/contracts/release_credits/deps/sui/vec_map.js +28 -0
- package/dist/contracts/release_credits/deps/sui/vec_map.js.map +1 -0
- package/dist/contracts/release_credits/release_credits.d.ts +142 -0
- package/dist/contracts/release_credits/release_credits.d.ts.map +1 -0
- package/dist/contracts/release_credits/release_credits.js +108 -0
- package/dist/contracts/release_credits/release_credits.js.map +1 -0
- package/dist/contracts/release_credits/release_party_role.d.ts +58 -0
- package/dist/contracts/release_credits/release_party_role.d.ts.map +1 -0
- package/dist/contracts/release_credits/release_party_role.js +66 -0
- package/dist/contracts/release_credits/release_party_role.js.map +1 -0
- package/dist/contracts/royalty_pool/deps/std/type_name.d.ts +18 -0
- package/dist/contracts/royalty_pool/deps/std/type_name.d.ts.map +1 -0
- package/dist/contracts/royalty_pool/deps/std/type_name.js +20 -0
- package/dist/contracts/royalty_pool/deps/std/type_name.js.map +1 -0
- package/dist/contracts/royalty_pool/deps/sui/balance.d.ts +13 -0
- package/dist/contracts/royalty_pool/deps/sui/balance.d.ts.map +1 -0
- package/dist/contracts/royalty_pool/deps/sui/balance.js +15 -0
- package/dist/contracts/royalty_pool/deps/sui/balance.js.map +1 -0
- package/dist/contracts/royalty_pool/deps/sui/vec_map.d.ts +37 -0
- package/dist/contracts/royalty_pool/deps/sui/vec_map.d.ts.map +1 -0
- package/dist/contracts/royalty_pool/deps/sui/vec_map.js +28 -0
- package/dist/contracts/royalty_pool/deps/sui/vec_map.js.map +1 -0
- package/dist/contracts/royalty_pool/pool.d.ts +358 -0
- package/dist/contracts/royalty_pool/pool.d.ts.map +1 -0
- package/dist/contracts/royalty_pool/pool.js +352 -0
- package/dist/contracts/royalty_pool/pool.js.map +1 -0
- package/dist/contracts/royalty_pool/stake.d.ts +202 -0
- package/dist/contracts/royalty_pool/stake.d.ts.map +1 -0
- package/dist/contracts/royalty_pool/stake.js +197 -0
- package/dist/contracts/royalty_pool/stake.js.map +1 -0
- package/dist/contracts/utils/index.d.ts +31 -0
- package/dist/contracts/utils/index.d.ts.map +1 -0
- package/dist/contracts/utils/index.js +162 -0
- package/dist/contracts/utils/index.js.map +1 -0
- package/dist/contracts.d.ts +18 -0
- package/dist/contracts.d.ts.map +1 -0
- package/dist/contracts.js +26 -0
- package/dist/contracts.js.map +1 -0
- package/dist/cover.d.ts +48 -0
- package/dist/cover.d.ts.map +1 -0
- package/dist/cover.js +68 -0
- package/dist/cover.js.map +1 -0
- package/dist/credits.d.ts +171 -0
- package/dist/credits.d.ts.map +1 -0
- package/dist/credits.js +360 -0
- package/dist/credits.js.map +1 -0
- package/dist/execute.d.ts +49 -0
- package/dist/execute.d.ts.map +1 -0
- package/dist/execute.js +114 -0
- package/dist/execute.js.map +1 -0
- package/dist/extensions/royalty-pool.d.ts +32 -0
- package/dist/extensions/royalty-pool.d.ts.map +1 -0
- package/dist/extensions/royalty-pool.js +33 -0
- package/dist/extensions/royalty-pool.js.map +1 -0
- package/dist/index.d.ts +13 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +16 -0
- package/dist/index.js.map +1 -0
- package/dist/internal.d.ts +20 -0
- package/dist/internal.d.ts.map +1 -0
- package/dist/internal.js +48 -0
- package/dist/internal.js.map +1 -0
- package/dist/parsers.d.ts +9 -0
- package/dist/parsers.d.ts.map +1 -0
- package/dist/parsers.js +52 -0
- package/dist/parsers.js.map +1 -0
- package/dist/queries.d.ts +105 -0
- package/dist/queries.d.ts.map +1 -0
- package/dist/queries.js +380 -0
- package/dist/queries.js.map +1 -0
- package/dist/schemas.d.ts +99 -0
- package/dist/schemas.d.ts.map +1 -0
- package/dist/schemas.js +76 -0
- package/dist/schemas.js.map +1 -0
- package/dist/transactions.d.ts +158 -0
- package/dist/transactions.d.ts.map +1 -0
- package/dist/transactions.js +154 -0
- package/dist/transactions.js.map +1 -0
- package/dist/types.d.ts +204 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +4 -0
- package/dist/types.js.map +1 -0
- package/dist/view.d.ts +21 -0
- package/dist/view.d.ts.map +1 -0
- package/dist/view.js +36 -0
- package/dist/view.js.map +1 -0
- package/package.json +111 -0
- package/src/client.ts +278 -0
- package/src/contracts/composition_credits/composition_credits.ts +169 -0
- package/src/contracts/composition_credits/composition_party_role.ts +189 -0
- package/src/contracts/composition_credits/deps/miso_credit/credit.ts +27 -0
- package/src/contracts/composition_credits/deps/sui/vec_map.ts +33 -0
- package/src/contracts/composition_royalty_pool/composition_royalty_pool.ts +135 -0
- package/src/contracts/cover_art/cover_art.ts +99 -0
- package/src/contracts/cover_art/deps/ori/walrus_data.ts +36 -0
- package/src/contracts/miso/composition.ts +343 -0
- package/src/contracts/miso/deal.ts +257 -0
- package/src/contracts/miso/deps/bps/bps.ts +23 -0
- package/src/contracts/miso/recording.ts +298 -0
- package/src/contracts/miso/release.ts +392 -0
- package/src/contracts/miso/track.ts +153 -0
- package/src/contracts/recording_credits/deps/miso_credit/credit.ts +27 -0
- package/src/contracts/recording_credits/deps/sui/vec_map.ts +33 -0
- package/src/contracts/recording_credits/deps/sui/vec_set.ts +21 -0
- package/src/contracts/recording_credits/recording_credits.ts +458 -0
- package/src/contracts/recording_credits/recording_party_role.ts +1041 -0
- package/src/contracts/recording_royalty_pool/recording_royalty_pool.ts +138 -0
- package/src/contracts/release_cover_art/deps/0x340057f2174fb59e4626742dd2b46c662237837b6187450cb59e4976ce7eac78/walrus_data.ts +36 -0
- package/src/contracts/release_cover_art/deps/cover_art/cover_art.ts +23 -0
- package/src/contracts/release_cover_art/deps/per_track/per_track.ts +36 -0
- package/src/contracts/release_cover_art/release_cover_art.ts +251 -0
- package/src/contracts/release_credits/deps/miso_credit/credit.ts +27 -0
- package/src/contracts/release_credits/deps/sui/vec_map.ts +33 -0
- package/src/contracts/release_credits/release_credits.ts +156 -0
- package/src/contracts/release_credits/release_party_role.ts +87 -0
- package/src/contracts/royalty_pool/deps/std/type_name.ts +22 -0
- package/src/contracts/royalty_pool/deps/sui/balance.ts +17 -0
- package/src/contracts/royalty_pool/deps/sui/vec_map.ts +33 -0
- package/src/contracts/royalty_pool/pool.ts +577 -0
- package/src/contracts/royalty_pool/stake.ts +317 -0
- package/src/contracts/utils/index.ts +229 -0
- package/src/contracts.ts +30 -0
- package/src/cover.ts +136 -0
- package/src/credits.ts +645 -0
- package/src/execute.ts +141 -0
- package/src/extensions/royalty-pool.ts +85 -0
- package/src/index.ts +17 -0
- package/src/internal.ts +85 -0
- package/src/parsers.ts +80 -0
- package/src/queries.ts +478 -0
- package/src/schemas.ts +96 -0
- package/src/transactions.ts +290 -0
- package/src/types.ts +244 -0
- package/src/view.ts +59 -0
package/README.md
ADDED
|
@@ -0,0 +1,644 @@
|
|
|
1
|
+
# @misonetwork/sdk
|
|
2
|
+
|
|
3
|
+
TypeScript SDK for the [Miso](https://github.com/misonetwork/miso-protocol) protocol on [Sui](https://sui.io).
|
|
4
|
+
|
|
5
|
+
This package mirrors the on-chain ABI of the [`misonetwork/miso-protocol`](https://github.com/misonetwork/miso-protocol) Move package (plus its first-party extensions), regenerated from the live Move source via `bun run codegen`.
|
|
6
|
+
|
|
7
|
+
Miso is a permissionless on-chain music protocol that models compositions, recordings, and releases — and their associated rights and royalties — as Sui objects. This SDK provides typed queries, composable transaction builders, BCS event parsers, Zod validation schemas, extension helpers (credits, cover art, royalty pools), and a client extension.
|
|
8
|
+
|
|
9
|
+
## Installation
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
bun add @misonetwork/sdk @mysten/sui
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Quick Start
|
|
16
|
+
|
|
17
|
+
```ts
|
|
18
|
+
import { SuiGrpcClient } from "@mysten/sui/grpc";
|
|
19
|
+
import { miso } from "@misonetwork/sdk";
|
|
20
|
+
|
|
21
|
+
const client = new SuiGrpcClient({ network: "testnet" })
|
|
22
|
+
.$extend(miso({ misoPackageId: "0x..." }));
|
|
23
|
+
|
|
24
|
+
// Fetch a recording
|
|
25
|
+
const recording = await client.miso.getRecordingById("0x...");
|
|
26
|
+
console.log(recording.state); // display title comes from the parent composition
|
|
27
|
+
|
|
28
|
+
// Derive an admin cap ID (pure, no network call)
|
|
29
|
+
const adminCapId = client.miso.deriveRecordingAdminCapId("0x...");
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## Client Extension
|
|
33
|
+
|
|
34
|
+
The SDK provides a `miso()` client extension that works with any Sui client implementing the Core API:
|
|
35
|
+
|
|
36
|
+
```ts
|
|
37
|
+
import { SuiGrpcClient } from "@mysten/sui/grpc";
|
|
38
|
+
import { SuiGraphQLClient } from "@mysten/sui/graphql";
|
|
39
|
+
import { miso } from "@misonetwork/sdk";
|
|
40
|
+
|
|
41
|
+
const graphqlClient = new SuiGraphQLClient({
|
|
42
|
+
url: "https://sui-testnet.mystenlabs.com/graphql",
|
|
43
|
+
network: "testnet",
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
const client = new SuiGrpcClient({ network: "testnet" })
|
|
47
|
+
.$extend(miso({
|
|
48
|
+
misoPackageId: "0x...",
|
|
49
|
+
graphqlClient, // Required for generic type-based queries (getByShareType, getOwnedCompositionAdminCaps, getOwnedRecordingAdminCaps, getReleaseRegistry, getAdministeredRecordings)
|
|
50
|
+
}));
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
### API Priority
|
|
54
|
+
|
|
55
|
+
Methods use the most efficient transport available:
|
|
56
|
+
|
|
57
|
+
| Transport | When Used | Examples |
|
|
58
|
+
|-----------|-----------|----------|
|
|
59
|
+
| **Core API** | Single-object fetch by ID, derivation | `getRecordingById`, `deriveCompositionAdminCapId` |
|
|
60
|
+
| **Core API** | Non-generic type queries | `getOwnedReleaseAdminCaps` |
|
|
61
|
+
| **GraphQL** | Generic type queries (partial type matching) | `getOwnedCompositionAdminCaps`, `getRecordingByShareType` |
|
|
62
|
+
|
|
63
|
+
## Data Model
|
|
64
|
+
|
|
65
|
+
Miso stores only protocol-verifiable state. Each entity follows a build-then-freeze
|
|
66
|
+
lifecycle (`Initialized → Published`) and is immutable once published.
|
|
67
|
+
|
|
68
|
+
- **Composition** — the underlying written work. Earns an immutable-floored `royaltyRate` from each recording. Backed by its own share currency.
|
|
69
|
+
- **Recording** — an audio performance of a composition. Backed by its own share currency. Carries no name of its own — its display title is its composition's title; richer naming lives in the metadata extension.
|
|
70
|
+
- **Release** — a flat, ordered tracklist of `Track`s (album, EP, or single), assembled from `Deal`s. Display grouping (discs/sides) lives in extensions.
|
|
71
|
+
- **Deal** — a recording admin's transferable authorization to include the recording on one exact release id.
|
|
72
|
+
|
|
73
|
+
Everything else — credits, cover art, royalty pools, masters, descriptive
|
|
74
|
+
metadata — attaches to the frozen core objects as dynamic fields through
|
|
75
|
+
extension packages (see [Extensions](#extensions)).
|
|
76
|
+
|
|
77
|
+
On publish, each entity emits a single lean pointer event carrying just its identity;
|
|
78
|
+
indexers subscribe to that pointer and fetch the immutable object by ID.
|
|
79
|
+
|
|
80
|
+
## Queries
|
|
81
|
+
|
|
82
|
+
All client methods are also available as standalone functions (taking the client
|
|
83
|
+
explicitly) from the package root.
|
|
84
|
+
|
|
85
|
+
### Compositions
|
|
86
|
+
|
|
87
|
+
```ts
|
|
88
|
+
// Core API (by ID)
|
|
89
|
+
const comp = await client.miso.getCompositionById("0x...");
|
|
90
|
+
const comps = await client.miso.getCompositionsByIds(["0x...", "0x..."]);
|
|
91
|
+
const capId = client.miso.deriveCompositionAdminCapId("0x...");
|
|
92
|
+
const cap = await client.miso.getCompositionAdminCapById(capId);
|
|
93
|
+
const shareType = await client.miso.getCompositionShareType("0x...");
|
|
94
|
+
|
|
95
|
+
// GraphQL (by type or owner)
|
|
96
|
+
const comp2 = await client.miso.getCompositionByShareType("0x...::share::Share");
|
|
97
|
+
const caps = await client.miso.getOwnedCompositionAdminCaps(ownerAddress);
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
### Recordings
|
|
101
|
+
|
|
102
|
+
```ts
|
|
103
|
+
// Core API (by ID)
|
|
104
|
+
const rec = await client.miso.getRecordingById("0x...");
|
|
105
|
+
const recs = await client.miso.getRecordingsByIds(["0x...", "0x..."]);
|
|
106
|
+
const recCapId = client.miso.deriveRecordingAdminCapId("0x...");
|
|
107
|
+
const recCap = await client.miso.getRecordingAdminCapById(recCapId);
|
|
108
|
+
|
|
109
|
+
// A Recording is generic over two phantoms — Recording<RecordingShare, CompositionShare>.
|
|
110
|
+
const recShareType = await client.miso.getRecordingShareType("0x..."); // the recording's OWN share type
|
|
111
|
+
const [recShare, compShare] = await getRecordingShareTypes(client, "0x..."); // both, in that order
|
|
112
|
+
|
|
113
|
+
// GraphQL (by type or owner)
|
|
114
|
+
const rec2 = await client.miso.getRecordingByShareType("0x...::share::Share");
|
|
115
|
+
const recCaps = await client.miso.getOwnedRecordingAdminCaps(ownerAddress);
|
|
116
|
+
const administered = await client.miso.getAdministeredRecordings(ownerAddress);
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
`getRecordingShareType` returns the recording's own share type
|
|
120
|
+
(`RecordingShare`) and is bound on the client. `getRecordingShareTypes` is the
|
|
121
|
+
standalone query that returns both as `[RecordingShare, CompositionShare]` —
|
|
122
|
+
reach for it when building anything generic over the pair, which is most of the
|
|
123
|
+
protocol: `deal::new`, `track::new`, `recording::publish`, and the recording
|
|
124
|
+
credit/royalty-pool extensions all take the two phantoms in exactly that order.
|
|
125
|
+
|
|
126
|
+
### Deals
|
|
127
|
+
|
|
128
|
+
```ts
|
|
129
|
+
// Share types are read from the object's `Deal<RecordingShare, CompositionShare>` type parameters.
|
|
130
|
+
const deal = await client.miso.getDealById("0x...");
|
|
131
|
+
// { id, releaseId, trackSplitBps, recordingShareType, compositionShareType }
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
### Releases
|
|
135
|
+
|
|
136
|
+
```ts
|
|
137
|
+
// Core API (by ID)
|
|
138
|
+
const release = await client.miso.getReleaseById("0x...");
|
|
139
|
+
const releases = await client.miso.getReleasesByIds(["0x...", "0x..."]);
|
|
140
|
+
const relCapId = client.miso.deriveReleaseAdminCapId("0x...");
|
|
141
|
+
const relCap = await client.miso.getReleaseAdminCapById(relCapId);
|
|
142
|
+
const relCaps = await client.miso.getOwnedReleaseAdminCaps(ownerAddress);
|
|
143
|
+
|
|
144
|
+
// GraphQL
|
|
145
|
+
const registryId = await client.miso.getReleaseRegistry();
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
### Share currencies
|
|
149
|
+
|
|
150
|
+
```ts
|
|
151
|
+
const shareType = await client.miso.getShareCurrencyType("0x..."); // Currency<T> object id → T
|
|
152
|
+
// Takes the share TYPE (which builders already thread around), not the Currency
|
|
153
|
+
// object id — so this is one call, not two.
|
|
154
|
+
const treasuryCapId = await client.miso.getShareCurrencyTreasuryCap(shareType, ownerAddress);
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
### Missing objects: null vs throw
|
|
158
|
+
|
|
159
|
+
Core-object getters (`getCompositionById`, `getDealById`, …) **throw** when the
|
|
160
|
+
object is missing — a miss means a broken reference. Extension readers
|
|
161
|
+
(`getCompositionCredits`, `getReleaseCover`, …) return **`null`** — extension
|
|
162
|
+
data is optional by design. The exported `isNotFound(e)` helper distinguishes
|
|
163
|
+
a missing-object error from a transport failure across all Sui client
|
|
164
|
+
transports:
|
|
165
|
+
|
|
166
|
+
```ts
|
|
167
|
+
import { isNotFound } from "@misonetwork/sdk";
|
|
168
|
+
|
|
169
|
+
try {
|
|
170
|
+
await client.miso.getReleaseById(id);
|
|
171
|
+
} catch (e) {
|
|
172
|
+
if (isNotFound(e)) { /* no such object */ } else throw e;
|
|
173
|
+
}
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
Also exported: `extractTypeParam("p::m::T<A>")` → `"A"` and
|
|
177
|
+
`extractTypeParams2("p::m::T<A, B>")` → `["A", "B"]` for reading share types
|
|
178
|
+
out of object type tags.
|
|
179
|
+
|
|
180
|
+
## Transaction Builders
|
|
181
|
+
|
|
182
|
+
This module exports five builders, in two shapes:
|
|
183
|
+
|
|
184
|
+
| Builder | Shape |
|
|
185
|
+
|---------|-------|
|
|
186
|
+
| `createComposition(tx, params)` | takes the `Transaction` first, returns `CompositionParts` |
|
|
187
|
+
| `createRecording(tx, params)` | takes the `Transaction` first, returns `RecordingParts` |
|
|
188
|
+
| `createDeal(tx, params)` | takes the `Transaction` first, returns a `TransactionObjectArgument` |
|
|
189
|
+
| `createRelease(tx, params, trackVec)` | takes the `Transaction` first, returns `ReleaseParts` |
|
|
190
|
+
| `rejectDeal(params)` | returns a `TxThunk` |
|
|
191
|
+
|
|
192
|
+
Only `rejectDeal` follows the thunk pattern — it returns a `TxThunk`
|
|
193
|
+
(`(tx: Transaction) => void | Promise<void>`) that appends commands to a
|
|
194
|
+
caller-owned `Transaction`. The four `create*` primitives take the
|
|
195
|
+
`Transaction` as their **first argument** and return their by-value results, so
|
|
196
|
+
those results can be threaded into later commands. Either way, everything
|
|
197
|
+
composes inside a single caller-owned PTB.
|
|
198
|
+
|
|
199
|
+
The client binds exactly one builder — `client.miso.tx.rejectDeal` — which
|
|
200
|
+
injects the client's `misoPackageId`. The `create*` primitives have no thunk to
|
|
201
|
+
bind, so they stay free functions: import them from the package root and pass
|
|
202
|
+
`misoPackageId` explicitly.
|
|
203
|
+
|
|
204
|
+
This SDK keeps the bare protocol primitives only. The four `create*` functions
|
|
205
|
+
each append a single `::new` and hand back its by-value results — never
|
|
206
|
+
dispersing a share supply, publishing (sharing) the object, or routing an admin
|
|
207
|
+
cap. The opinionated layers — the finish (disperse via minato, publish,
|
|
208
|
+
transfer), track assembly, cap disposition, and the share-currency lifecycle —
|
|
209
|
+
live in [`@misofm/sdk`](https://github.com/misofm/sdk) as **free functions that
|
|
210
|
+
take `misoPackageId` explicitly** (they are not bound onto any client's `tx`
|
|
211
|
+
namespace): `finalizeComposition`/`finalizeRecording`/`finalizeRelease`,
|
|
212
|
+
`publishComposition`/`publishRecording`/`publishCompositionAndRecording`,
|
|
213
|
+
`publishRelease`/`publishReleaseFromDeals`/`publishReleaseGraph`,
|
|
214
|
+
`disperseShares`, share-currency provisioning, and `executeViaExecutor`. Those
|
|
215
|
+
import the primitives from here and build on top.
|
|
216
|
+
|
|
217
|
+
Execute any thunk (from this SDK or composed with another) with `buildTx` +
|
|
218
|
+
`signAndExecute` — see [Execution](#execution-executets):
|
|
219
|
+
|
|
220
|
+
```ts
|
|
221
|
+
import { buildTx, signAndExecute } from "@misonetwork/sdk";
|
|
222
|
+
|
|
223
|
+
const tx = await buildTx(client.miso.tx.rejectDeal({ /* … */ }));
|
|
224
|
+
await signAndExecute(client, signer, tx);
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
### Deals
|
|
228
|
+
|
|
229
|
+
`createDeal` is a primitive: it appends `deal::new` and returns the `Deal` for
|
|
230
|
+
you to route. It is a free function (not on `client.tx`) because it takes the
|
|
231
|
+
`Transaction` directly, so pass `misoPackageId` explicitly.
|
|
232
|
+
|
|
233
|
+
The returned `Deal` MUST be consumed in the same transaction — it is
|
|
234
|
+
`key, store` with no `drop` — but it can go to either of two places, which is
|
|
235
|
+
why the SDK does not choose for you:
|
|
236
|
+
|
|
237
|
+
```ts
|
|
238
|
+
import { createDeal } from "@misonetwork/sdk";
|
|
239
|
+
|
|
240
|
+
const deal = createDeal(tx, {
|
|
241
|
+
recordingId: "0x...",
|
|
242
|
+
recordingAdminCapId: "0x...", // or `recordingAdminCap` as an in-PTB argument
|
|
243
|
+
recordingShareType: "0x...::share::Share",
|
|
244
|
+
compositionShareType: "0x...::share::Share",
|
|
245
|
+
releaseId: "0x...", // pre-derived to match release::new — see view.deriveReleaseId
|
|
246
|
+
trackSplitBps: 5000,
|
|
247
|
+
misoPackageId,
|
|
248
|
+
});
|
|
249
|
+
|
|
250
|
+
// (1) cross-party: send it to whoever assembles the release, to redeem later
|
|
251
|
+
tx.transferObjects([deal], releaseCreator);
|
|
252
|
+
|
|
253
|
+
// (2) same-party: spend it immediately as authorization for a track
|
|
254
|
+
// tx.add(contracts.track._new({ package: misoPackageId, typeArguments, arguments: [deal, recording] }));
|
|
255
|
+
```
|
|
256
|
+
|
|
257
|
+
`rejectDeal` is the one builder bound on the client. It destroys a deal without
|
|
258
|
+
including it in a release, and emits `DealRejectedEvent`:
|
|
259
|
+
|
|
260
|
+
```ts
|
|
261
|
+
client.miso.tx.rejectDeal({
|
|
262
|
+
dealId: "0x...",
|
|
263
|
+
recordingShareType: "0x...::share::Share",
|
|
264
|
+
compositionShareType: "0x...::share::Share",
|
|
265
|
+
});
|
|
266
|
+
```
|
|
267
|
+
|
|
268
|
+
### Releases
|
|
269
|
+
|
|
270
|
+
The end-to-end release publishers are **not** on `client.miso.tx` — they are free
|
|
271
|
+
functions in [`@misofm/sdk`](https://github.com/misofm/sdk) that take
|
|
272
|
+
`misoPackageId` explicitly:
|
|
273
|
+
|
|
274
|
+
```ts
|
|
275
|
+
import { publishRelease, publishReleaseFromDeals } from "@misofm/sdk";
|
|
276
|
+
|
|
277
|
+
// Sender holds every recording's admin cap (a deal is created inline per track).
|
|
278
|
+
await buildTx(publishRelease({ title, tracks, releaseRegistryId, releaseId, releaseNonce, adminAddress, misoPackageId }));
|
|
279
|
+
|
|
280
|
+
// Or assemble from pre-made Deals the sender already holds.
|
|
281
|
+
await buildTx(publishReleaseFromDeals({ title, deals, releaseRegistryId, releaseNonce, adminAddress, misoPackageId }));
|
|
282
|
+
```
|
|
283
|
+
|
|
284
|
+
`releaseId` is a field on `PublishReleaseParams` only — pre-derive it (see
|
|
285
|
+
[Deriving the release id](#deriving-the-release-id-view)) so the inline deals
|
|
286
|
+
pin the right release. `PublishReleaseFromDealsParams` has no `releaseId`: each
|
|
287
|
+
pre-made deal already embeds it, so the from-deals variant derives it from them.
|
|
288
|
+
|
|
289
|
+
This package supplies the primitive underneath both: `createRelease(tx, params,
|
|
290
|
+
trackVec)`, which appends `release::new` over a caller-built `vector<Track>` and
|
|
291
|
+
returns the release plus its admin cap.
|
|
292
|
+
|
|
293
|
+
### Deriving the release id (`view`)
|
|
294
|
+
|
|
295
|
+
Deals embed the exact release id, which the chain derives from the full
|
|
296
|
+
tracklist + nonce. Compute it up front via `simulateTransaction`:
|
|
297
|
+
|
|
298
|
+
```ts
|
|
299
|
+
const releaseId = await client.miso.view.deriveReleaseId({
|
|
300
|
+
sender: ownerAddress, // any address; not charged
|
|
301
|
+
recordingIds: ["0x...", "0x..."], // in track order
|
|
302
|
+
splitBps: [5000, 5000], // aligned to recordingIds
|
|
303
|
+
nonce: "42",
|
|
304
|
+
releaseRegistryId: "0x...",
|
|
305
|
+
});
|
|
306
|
+
```
|
|
307
|
+
|
|
308
|
+
### Creating works (`createComposition` / `createRecording` / `createRelease`)
|
|
309
|
+
|
|
310
|
+
Each `create*` appends a single `::new` and returns its by-value parts — the
|
|
311
|
+
object, its admin cap, and for a work its freshly-minted share `Balance`. The
|
|
312
|
+
caller decides what happens next.
|
|
313
|
+
|
|
314
|
+
The key move is **borrow-before-share**: `recording::new` takes the parent
|
|
315
|
+
composition by immutable reference, so you can pass a `createComposition(...)`
|
|
316
|
+
result straight into `createRecording`'s `composition` param while it is still an
|
|
317
|
+
unshared, transaction-local value. That is what lets a composition and its first
|
|
318
|
+
recording be minted in one PTB.
|
|
319
|
+
|
|
320
|
+
```ts
|
|
321
|
+
import { Transaction } from "@mysten/sui/transactions";
|
|
322
|
+
import { createComposition, createRecording } from "@misonetwork/sdk";
|
|
323
|
+
|
|
324
|
+
const tx = new Transaction();
|
|
325
|
+
|
|
326
|
+
// 1. Composition — returns { composition, adminCap, balance }.
|
|
327
|
+
const comp = createComposition(tx, {
|
|
328
|
+
title: "Song Title",
|
|
329
|
+
royaltyRateBps: 1000,
|
|
330
|
+
shareType: compositionShareType, // `${sharePkg}::share::Share`
|
|
331
|
+
shareCurrencyId: "0x...", // Currency<Share>
|
|
332
|
+
shareTreasuryCapId: "0x...", // TreasuryCap<Share>, consumed by `new`
|
|
333
|
+
misoPackageId,
|
|
334
|
+
});
|
|
335
|
+
|
|
336
|
+
// 2. Recording — borrow-before-share: hand the still-unshared composition
|
|
337
|
+
// straight in. No on-chain object id is needed for it.
|
|
338
|
+
const rec = createRecording(tx, {
|
|
339
|
+
composition: comp.composition, // or `tx.object(compositionId)` if already on chain
|
|
340
|
+
compositionShareType,
|
|
341
|
+
shareType: recordingShareType,
|
|
342
|
+
shareCurrencyId: "0x...",
|
|
343
|
+
shareTreasuryCapId: "0x...",
|
|
344
|
+
maxRoyaltyRateBps: 1000, // slippage guard — see below
|
|
345
|
+
misoPackageId,
|
|
346
|
+
});
|
|
347
|
+
|
|
348
|
+
// 3. Both objects MUST still be consumed by their `publish` in THIS transaction
|
|
349
|
+
// — e.g. `finalizeComposition(tx, { ...comp, ... })` / `finalizeRecording(tx,
|
|
350
|
+
// { ...rec, ... })` from `@misofm/sdk`, which disperse the balances, publish
|
|
351
|
+
// the works, and route the admin caps.
|
|
352
|
+
```
|
|
353
|
+
|
|
354
|
+
`createRelease` takes the `vector<Track>` as an argument, because track assembly
|
|
355
|
+
is the part that genuinely varies between flows — from recording admin caps,
|
|
356
|
+
from pre-made deals, or from a mix of fresh and existing recordings:
|
|
357
|
+
|
|
358
|
+
```ts
|
|
359
|
+
import { createRelease } from "@misonetwork/sdk";
|
|
360
|
+
|
|
361
|
+
const trackVec = tx.makeMoveVec({ type: `${misoPackageId}::track::Track`, elements: trackArgs });
|
|
362
|
+
const rel = createRelease(tx, { title: "Album Title", nonce: "42", releaseRegistryId, misoPackageId }, trackVec);
|
|
363
|
+
// rel.release must be consumed by `release::publish` in this same tx.
|
|
364
|
+
```
|
|
365
|
+
|
|
366
|
+
#### Royalty-rate slippage (`maxRoyaltyRateBps`)
|
|
367
|
+
|
|
368
|
+
A composition's royalty rate is floored but can be **raised** by its admin. If it
|
|
369
|
+
goes up between the moment you read it and the moment your transaction lands, a
|
|
370
|
+
recording you thought owed 10% could land owing more. `CreateRecordingParams.maxRoyaltyRateBps`
|
|
371
|
+
is the guard: it is the maximum composition royalty rate (in bps) the recorder is
|
|
372
|
+
willing to grant, and `recording::new` aborts with `ERoyaltyRateAboveMax` if the
|
|
373
|
+
composition's live rate exceeds it. Pass the rate you actually observed.
|
|
374
|
+
|
|
375
|
+
It is optional, and defaults to the exported `PROTOCOL_MAX_ROYALTY_RATE_BPS`
|
|
376
|
+
(`2000`, the protocol's `MAX_ROYALTY_RATE_BPS`) — which accepts any legal rate,
|
|
377
|
+
i.e. no slippage protection. Set it explicitly whenever you are recording someone
|
|
378
|
+
else's composition.
|
|
379
|
+
|
|
380
|
+
```ts
|
|
381
|
+
import { PROTOCOL_MAX_ROYALTY_RATE_BPS } from "@misonetwork/sdk";
|
|
382
|
+
|
|
383
|
+
const comp = await client.miso.getCompositionById(compositionId);
|
|
384
|
+
createRecording(tx, { /* … */ maxRoyaltyRateBps: comp.royaltyRate.value });
|
|
385
|
+
```
|
|
386
|
+
|
|
387
|
+
#### Result shapes
|
|
388
|
+
|
|
389
|
+
```ts
|
|
390
|
+
import type {
|
|
391
|
+
CompositionParts, RecordingParts, ReleaseParts, ShareCurrencyBinding,
|
|
392
|
+
} from "@misonetwork/sdk";
|
|
393
|
+
|
|
394
|
+
// CompositionParts { composition, adminCap, balance } — balance is the creator's
|
|
395
|
+
// freshly-minted share supply
|
|
396
|
+
// RecordingParts { recording, adminCap, balance } — balance is what remains
|
|
397
|
+
// after the composition's cut
|
|
398
|
+
// ReleaseParts { release, adminCap }
|
|
399
|
+
// All fields are `TransactionObjectArgument`s, for threading onward in the PTB.
|
|
400
|
+
```
|
|
401
|
+
|
|
402
|
+
`ShareCurrencyBinding` is the trio every work-creating builder needs, extended by
|
|
403
|
+
both `CreateCompositionParams` and `CreateRecordingParams`: `shareType` (the
|
|
404
|
+
`${packageId}::share::Share` type), `shareCurrencyId` (the `Currency<Share>`
|
|
405
|
+
object), and `shareTreasuryCapId` (the `TreasuryCap<Share>`, consumed by `new`).
|
|
406
|
+
All three are passed explicitly rather than read from chain, which keeps the
|
|
407
|
+
builders synchronous — no RPC inside the transaction build.
|
|
408
|
+
|
|
409
|
+
**Lifecycle requirement.** `Composition`, `Recording`, and `Release` are all
|
|
410
|
+
`key`-only with no `drop`, so each created object MUST be consumed by its
|
|
411
|
+
`publish` in the same transaction — none can be transferred, wrapped, shared, or
|
|
412
|
+
discarded, and none can outlive its creating PTB. That is a same-**transaction**
|
|
413
|
+
requirement, not a same-**function** one: pairing a `create*` here with a
|
|
414
|
+
`finalize*` from `@misofm/sdk` on the same `tx` satisfies it. Keeping them apart
|
|
415
|
+
is what makes the intermediate value useful at all — borrowing a still-unshared
|
|
416
|
+
composition into `recording::new`, attaching a royalty pool via `uid_mut`, or
|
|
417
|
+
routing an admin cap somewhere other than a plain address (every admin cap is
|
|
418
|
+
`key, store`, hence freely routable).
|
|
419
|
+
|
|
420
|
+
Whole-graph orchestration lives in `@misofm/sdk` too: `publishReleaseGraph`
|
|
421
|
+
mints every composition and recording, attaches optional royalty pools, builds
|
|
422
|
+
the deals/tracks, and publishes the release — with the release id derived
|
|
423
|
+
on-chain — all in one PTB, importing the primitives from here.
|
|
424
|
+
|
|
425
|
+
```ts
|
|
426
|
+
import { publishReleaseGraph } from "@misofm/sdk";
|
|
427
|
+
```
|
|
428
|
+
|
|
429
|
+
## Extensions
|
|
430
|
+
|
|
431
|
+
### Credits (`credits.ts`)
|
|
432
|
+
|
|
433
|
+
Contributor credits pair a party with a display name and one or more
|
|
434
|
+
domain-specific roles, attached to a work as a dynamic field and gated by the
|
|
435
|
+
work's admin cap. Three role vocabularies:
|
|
436
|
+
|
|
437
|
+
- **Composition** (writing, 1–5 roles, no level): `Adapter`, `Arranger`, `Composer`, `Lyricist`, `Songwriter`, `Translator`, or `{ type: "Custom", name }`.
|
|
438
|
+
- **Recording** (production/performance, 1–10 roles): 28 leveled roles (`Producer`, `Vocalist`, `Engineer`, …) each with an optional seniority `level` (`Lead`, `Featured`, `Executive`, …), plus `{ type: "Instrumentalist", instrument, level? }`, `{ type: "Custom", name, level? }`, and the unleveled `ArtistsAndRepertoire` / `Copyist`.
|
|
439
|
+
- **Release** (top-line billing, exactly one role): `"Primary"` or `"Featured"`.
|
|
440
|
+
|
|
441
|
+
Writers validate client-side, mirroring the Move aborts: display name
|
|
442
|
+
non-empty and ≤200 UTF-8 bytes; role counts within the caps above; no
|
|
443
|
+
duplicate roles.
|
|
444
|
+
|
|
445
|
+
```ts
|
|
446
|
+
import {
|
|
447
|
+
attachCompositionCredit, attachRecordingCredit, addReleaseCredit,
|
|
448
|
+
addRecordingPrimaryArtist, addRecordingFeaturedArtist,
|
|
449
|
+
getCompositionCredits, getRecordingCredits, getReleaseCredits,
|
|
450
|
+
} from "@misonetwork/sdk";
|
|
451
|
+
|
|
452
|
+
const thunk = attachRecordingCredit({
|
|
453
|
+
recordingId: "0x...",
|
|
454
|
+
recordingAdminCapId: "0x...",
|
|
455
|
+
partyId: "0x...",
|
|
456
|
+
displayName: "Jane Doe",
|
|
457
|
+
roles: [{ type: "Vocalist", level: "Lead" }, { type: "Instrumentalist", instrument: "Guitar" }],
|
|
458
|
+
recordingShareType: "0x...::share::Share",
|
|
459
|
+
compositionShareType: "0x...::share::Share",
|
|
460
|
+
recordingCreditsPackageId: "0x...",
|
|
461
|
+
misoCreditPackageId: "0x...",
|
|
462
|
+
});
|
|
463
|
+
|
|
464
|
+
// Designate an already-credited party (same params minus displayName/roles/misoCreditPackageId):
|
|
465
|
+
addRecordingPrimaryArtist({ recordingId, recordingAdminCapId, partyId, recordingShareType, compositionShareType, recordingCreditsPackageId });
|
|
466
|
+
|
|
467
|
+
// Reads return null when no credits field is attached.
|
|
468
|
+
const credits = await getCompositionCredits(client, compositionId, compositionCreditsPackageId);
|
|
469
|
+
// CreditView[]: { partyId, displayName, roles: string[] } — e.g. "Producer (Lead)", "Instrumentalist: Guitar"
|
|
470
|
+
const rc = await getRecordingCredits(client, recordingId, recordingCreditsPackageId);
|
|
471
|
+
// { credits: CreditView[], primaryArtistIds: string[], featuredArtistIds: string[] }
|
|
472
|
+
```
|
|
473
|
+
|
|
474
|
+
`attachCompositionCredit` takes `compositionId`/`compositionAdminCapId`/`compositionShareType`/`compositionCreditsPackageId`;
|
|
475
|
+
`addReleaseCredit` takes `releaseId`/`releaseAdminCapId` and a single `role`.
|
|
476
|
+
|
|
477
|
+
### Cover art (`cover.ts`)
|
|
478
|
+
|
|
479
|
+
A release's cover is a Walrus blob referenced on-chain via `ori::WalrusData`,
|
|
480
|
+
attached under the `release_cover_art` extension:
|
|
481
|
+
|
|
482
|
+
```ts
|
|
483
|
+
import { setReleaseCover, getReleaseCover } from "@misonetwork/sdk";
|
|
484
|
+
|
|
485
|
+
const thunk = setReleaseCover({
|
|
486
|
+
releaseId: "0x...",
|
|
487
|
+
releaseAdminCapId: "0x...",
|
|
488
|
+
stillBlobId: "987654321", // Walrus blob id as u256 (decimal string or bigint)
|
|
489
|
+
animatedBlobId: null, // optional animated cover
|
|
490
|
+
coverArtPackageId: "0x...",
|
|
491
|
+
releaseCoverArtPackageId: "0x...",
|
|
492
|
+
oriPackageId: "0x...",
|
|
493
|
+
});
|
|
494
|
+
|
|
495
|
+
const cover = await getReleaseCover(client, releaseId, releaseCoverArtPackageId);
|
|
496
|
+
// ReleaseCoverView | null: { still, animated } as normalized Walrus refs
|
|
497
|
+
// ({ kind: "blob", blobId } | { kind: "quiltPatch", quiltId, version, startIndex, endIndex })
|
|
498
|
+
```
|
|
499
|
+
|
|
500
|
+
### Royalty pools (`extensions/royalty-pool.ts`)
|
|
501
|
+
|
|
502
|
+
`attachCompositionRoyaltyPool(tx, params)` / `attachRecordingRoyaltyPool(tx, params)`
|
|
503
|
+
create and share a `RoyaltyPool<Share, Currency>` for a work inside its publish
|
|
504
|
+
PTB (after `createComposition`/`createRecording`, before the opinionated
|
|
505
|
+
finish). `@misofm/sdk`'s
|
|
506
|
+
`publishReleaseGraph` accepts them as `royaltyPool` nodes.
|
|
507
|
+
|
|
508
|
+
Share-currency provisioning (`createShareCurrency`, `publishShareCurrencies`,
|
|
509
|
+
`initializeShareCurrencies`) also moved to `@misofm/sdk` — every composition
|
|
510
|
+
and recording is backed by its own fixed-supply share currency, and
|
|
511
|
+
provisioning one is part of the opinionated publish flow, not a protocol
|
|
512
|
+
primitive.
|
|
513
|
+
|
|
514
|
+
## Execution (`execute.ts`)
|
|
515
|
+
|
|
516
|
+
Builders only append to a `Transaction`; this module submits:
|
|
517
|
+
|
|
518
|
+
```ts
|
|
519
|
+
import { buildTx, signAndExecute, execThunks, publishedPackageId, createdByType, balanceDelta } from "@misonetwork/sdk";
|
|
520
|
+
|
|
521
|
+
const result = await execThunks(client, signer, thunkA, thunkB); // build + sign + execute + wait
|
|
522
|
+
// ExecResult: { digest, changedObjects, objectTypes, balanceChanges, gasUsed }
|
|
523
|
+
|
|
524
|
+
// Object-change extractors:
|
|
525
|
+
const pkgId = publishedPackageId(result);
|
|
526
|
+
const currencyId = createdByType(result, "::coin_registry::Currency<");
|
|
527
|
+
const delta = balanceDelta(result, address, "0x2::sui::SUI");
|
|
528
|
+
```
|
|
529
|
+
|
|
530
|
+
`@misofm/sdk` builds `executeViaExecutor(executor, ...thunks)` on top of this
|
|
531
|
+
module's `buildTx`/`toExecResult` — it submits a non-idempotent PTB through a
|
|
532
|
+
`ParallelTransactionExecutor` exactly once (no auto-retry), for its batched
|
|
533
|
+
share-currency provisioning.
|
|
534
|
+
|
|
535
|
+
## Event Parsers
|
|
536
|
+
|
|
537
|
+
Miso uses a lean publish-only event model: published objects emit a single pointer event,
|
|
538
|
+
and indexers fetch the immutable object by ID. Parse the BCS-encoded events from transaction
|
|
539
|
+
results:
|
|
540
|
+
|
|
541
|
+
```ts
|
|
542
|
+
// Pointer events (carry only identities)
|
|
543
|
+
const comp = client.miso.parse.compositionPublishedEvent(bcsBytes); // { compositionId }
|
|
544
|
+
const rec = client.miso.parse.recordingPublishedEvent(bcsBytes); // { recordingId }
|
|
545
|
+
const rel = client.miso.parse.releasePublishedEvent(bcsBytes); // { releaseId }
|
|
546
|
+
|
|
547
|
+
// Non-pointer events
|
|
548
|
+
const royalty = client.miso.parse.compositionRoyaltySetEvent(bcsBytes); // { royaltyRateBps }
|
|
549
|
+
const created = client.miso.parse.dealCreatedEvent(bcsBytes); // { dealId, releaseId, trackSplitBps }
|
|
550
|
+
const accepted = client.miso.parse.dealAcceptedEvent(bcsBytes); // { dealId, releaseId }
|
|
551
|
+
const rejected = client.miso.parse.dealRejectedEvent(bcsBytes); // { dealId, releaseId }
|
|
552
|
+
```
|
|
553
|
+
|
|
554
|
+
The same functions are exported standalone as `parseCompositionPublishedEvent`, etc.
|
|
555
|
+
|
|
556
|
+
## Validation Schemas
|
|
557
|
+
|
|
558
|
+
Zod schemas for validating Miso domain types and parsed events:
|
|
559
|
+
|
|
560
|
+
```ts
|
|
561
|
+
import {
|
|
562
|
+
CompositionSchema, RecordingSchema, ReleaseSchema, TrackSchema,
|
|
563
|
+
CompositionStateSchema, RecordingStateSchema, ReleaseStateSchema,
|
|
564
|
+
CompositionPublishedEventSchema, CompositionRoyaltySetEventSchema,
|
|
565
|
+
RecordingPublishedEventSchema, ReleasePublishedEventSchema,
|
|
566
|
+
DealCreatedEventSchema, DealAcceptedEventSchema, DealRejectedEventSchema,
|
|
567
|
+
} from "@misonetwork/sdk/schemas";
|
|
568
|
+
|
|
569
|
+
const result = RecordingSchema.safeParse(data);
|
|
570
|
+
```
|
|
571
|
+
|
|
572
|
+
## Types
|
|
573
|
+
|
|
574
|
+
All Miso domain types are exported:
|
|
575
|
+
|
|
576
|
+
```ts
|
|
577
|
+
import type {
|
|
578
|
+
// Core entities
|
|
579
|
+
Composition, Recording, Release, Deal, Track, BPS,
|
|
580
|
+
// Admin caps
|
|
581
|
+
CompositionAdminCap, RecordingAdminCap, ReleaseAdminCap,
|
|
582
|
+
// State machines
|
|
583
|
+
CompositionState, RecordingState, ReleaseState, TrackState,
|
|
584
|
+
// Events
|
|
585
|
+
CompositionPublishedEvent, CompositionRoyaltySetEvent,
|
|
586
|
+
RecordingPublishedEvent, ReleasePublishedEvent,
|
|
587
|
+
DealCreatedEvent, DealAcceptedEvent, DealRejectedEvent,
|
|
588
|
+
// Credits & roles (from ./credits)
|
|
589
|
+
CreditView, RecordingCreditsView,
|
|
590
|
+
CompositionRole, RecordingRole, RecordingRoleLevel, ReleaseRole,
|
|
591
|
+
RecordingLeveledRoleType,
|
|
592
|
+
// Extension views
|
|
593
|
+
ReleaseCoverView, CoverImageRef,
|
|
594
|
+
// Transaction builder inputs & results (from ./transactions)
|
|
595
|
+
TxThunk, ShareCurrencyBinding,
|
|
596
|
+
CompositionParts, RecordingParts, ReleaseParts,
|
|
597
|
+
CreateCompositionParams, CreateRecordingParams, CreateDealParams,
|
|
598
|
+
CreateReleaseParams, RejectDealParams,
|
|
599
|
+
} from "@misonetwork/sdk";
|
|
600
|
+
```
|
|
601
|
+
|
|
602
|
+
`RecordingLeveledRoleType` is the union of the 28 recording role base names that
|
|
603
|
+
carry an optional `RecordingRoleLevel` (`Producer`, `Vocalist`, `Engineer`,
|
|
604
|
+
`Conductor`, …) — the leveled arm of `RecordingRole`. The other arms
|
|
605
|
+
(`Instrumentalist`, `Custom`, and the unleveled `ArtistsAndRepertoire` /
|
|
606
|
+
`Copyist`) are spelled out separately in `RecordingRole`.
|
|
607
|
+
|
|
608
|
+
The non-type value export `PROTOCOL_MAX_ROYALTY_RATE_BPS` (`2000`) is documented
|
|
609
|
+
under [royalty-rate slippage](#royalty-rate-slippage-maxroyaltyratebps).
|
|
610
|
+
|
|
611
|
+
## Generated Bindings (`contracts`)
|
|
612
|
+
|
|
613
|
+
The codegen-generated, ABI-bound bindings (BCS structs + type-safe Move calls)
|
|
614
|
+
are exported under the `contracts` namespace — core protocol modules
|
|
615
|
+
(`composition`, `recording`, `release`, `deal`, `track`) plus the extension
|
|
616
|
+
packages (`royaltyPool`, `royaltyPoolStake`, `compositionRoyaltyPool`,
|
|
617
|
+
`recordingRoyaltyPool`, `coverArt`, `releaseCoverArt`, `compositionCredits`,
|
|
618
|
+
`compositionPartyRole`, `recordingCredits`, `recordingPartyRole`,
|
|
619
|
+
`releaseCredits`, `releasePartyRole`):
|
|
620
|
+
|
|
621
|
+
```ts
|
|
622
|
+
import { contracts } from "@misonetwork/sdk";
|
|
623
|
+
|
|
624
|
+
const parsed = contracts.composition.Composition.parse(bcsBytes);
|
|
625
|
+
tx.add(contracts.deal.reject({ package: misoPackageId, typeArguments, arguments: [dealId] }));
|
|
626
|
+
```
|
|
627
|
+
|
|
628
|
+
On the client, `client.miso.call.*` exposes the core modules with the package
|
|
629
|
+
id pre-bound, and `client.miso.bcs.*` the core BCS structs.
|
|
630
|
+
|
|
631
|
+
## Derived Objects
|
|
632
|
+
|
|
633
|
+
Miso uses Sui's derived object pattern for admin caps. The SDK provides pure derivation
|
|
634
|
+
functions that compute object IDs without network calls:
|
|
635
|
+
|
|
636
|
+
| Function | Derivation Key | Parent Object |
|
|
637
|
+
|----------|---------------|---------------|
|
|
638
|
+
| `deriveCompositionAdminCapId` | `CompositionAdminCapKey()` | Composition |
|
|
639
|
+
| `deriveRecordingAdminCapId` | `RecordingAdminCapKey()` | Recording |
|
|
640
|
+
| `deriveReleaseAdminCapId` | `ReleaseAdminCapKey()` | Release |
|
|
641
|
+
|
|
642
|
+
## License
|
|
643
|
+
|
|
644
|
+
Apache-2.0
|