@misofm/sdk 0.1.1 → 0.2.1

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.
Files changed (171) hide show
  1. package/README.md +138 -10
  2. package/dist/catalog.d.ts +30 -0
  3. package/dist/catalog.d.ts.map +1 -1
  4. package/dist/catalog.js +60 -1
  5. package/dist/catalog.js.map +1 -1
  6. package/dist/contracts/composition_credits/composition_credits.d.ts +181 -0
  7. package/dist/contracts/composition_credits/composition_credits.d.ts.map +1 -0
  8. package/dist/contracts/composition_credits/composition_credits.js +109 -0
  9. package/dist/contracts/composition_credits/composition_credits.js.map +1 -0
  10. package/dist/contracts/composition_credits/composition_party_role.d.ts +119 -0
  11. package/dist/contracts/composition_credits/composition_party_role.d.ts.map +1 -0
  12. package/dist/contracts/composition_credits/composition_party_role.js +139 -0
  13. package/dist/contracts/composition_credits/composition_party_role.js.map +1 -0
  14. package/dist/contracts/composition_credits/deps/miso_credit/credit.d.ts +24 -0
  15. package/dist/contracts/composition_credits/deps/miso_credit/credit.d.ts.map +1 -0
  16. package/dist/contracts/composition_credits/deps/miso_credit/credit.js +23 -0
  17. package/dist/contracts/composition_credits/deps/miso_credit/credit.js.map +1 -0
  18. package/dist/contracts/composition_credits/deps/sui/vec_map.d.ts +37 -0
  19. package/dist/contracts/composition_credits/deps/sui/vec_map.d.ts.map +1 -0
  20. package/dist/contracts/composition_credits/deps/sui/vec_map.js +28 -0
  21. package/dist/contracts/composition_credits/deps/sui/vec_map.js.map +1 -0
  22. package/dist/contracts/composition_royalty_pool/composition_royalty_pool.d.ts +87 -0
  23. package/dist/contracts/composition_royalty_pool/composition_royalty_pool.d.ts.map +1 -0
  24. package/dist/contracts/composition_royalty_pool/composition_royalty_pool.js +80 -0
  25. package/dist/contracts/composition_royalty_pool/composition_royalty_pool.js.map +1 -0
  26. package/dist/contracts/cover_art/cover_art.d.ts +85 -0
  27. package/dist/contracts/cover_art/cover_art.d.ts.map +1 -0
  28. package/dist/contracts/cover_art/cover_art.js +68 -0
  29. package/dist/contracts/cover_art/cover_art.js.map +1 -0
  30. package/dist/contracts/cover_art/deps/ori/walrus_data.d.ts +52 -0
  31. package/dist/contracts/cover_art/deps/ori/walrus_data.d.ts.map +1 -0
  32. package/dist/contracts/cover_art/deps/ori/walrus_data.js +37 -0
  33. package/dist/contracts/cover_art/deps/ori/walrus_data.js.map +1 -0
  34. package/dist/contracts/recording_credits/deps/miso_credit/credit.d.ts +24 -0
  35. package/dist/contracts/recording_credits/deps/miso_credit/credit.d.ts.map +1 -0
  36. package/dist/contracts/recording_credits/deps/miso_credit/credit.js +23 -0
  37. package/dist/contracts/recording_credits/deps/miso_credit/credit.js.map +1 -0
  38. package/dist/contracts/recording_credits/deps/sui/vec_map.d.ts +37 -0
  39. package/dist/contracts/recording_credits/deps/sui/vec_map.d.ts.map +1 -0
  40. package/dist/contracts/recording_credits/deps/sui/vec_map.js +28 -0
  41. package/dist/contracts/recording_credits/deps/sui/vec_map.js.map +1 -0
  42. package/dist/contracts/recording_credits/deps/sui/vec_set.d.ts +21 -0
  43. package/dist/contracts/recording_credits/deps/sui/vec_set.d.ts.map +1 -0
  44. package/dist/contracts/recording_credits/deps/sui/vec_set.js +20 -0
  45. package/dist/contracts/recording_credits/deps/sui/vec_set.js.map +1 -0
  46. package/dist/contracts/recording_credits/recording_credits.d.ts +2313 -0
  47. package/dist/contracts/recording_credits/recording_credits.d.ts.map +1 -0
  48. package/dist/contracts/recording_credits/recording_credits.js +270 -0
  49. package/dist/contracts/recording_credits/recording_credits.js.map +1 -0
  50. package/dist/contracts/recording_credits/recording_party_role.d.ts +1174 -0
  51. package/dist/contracts/recording_credits/recording_party_role.d.ts.map +1 -0
  52. package/dist/contracts/recording_credits/recording_party_role.js +692 -0
  53. package/dist/contracts/recording_credits/recording_party_role.js.map +1 -0
  54. package/dist/contracts/recording_royalty_pool/recording_royalty_pool.d.ts +90 -0
  55. package/dist/contracts/recording_royalty_pool/recording_royalty_pool.d.ts.map +1 -0
  56. package/dist/contracts/recording_royalty_pool/recording_royalty_pool.js +80 -0
  57. package/dist/contracts/recording_royalty_pool/recording_royalty_pool.js.map +1 -0
  58. package/dist/contracts/release_cover_art/deps/0x340057f2174fb59e4626742dd2b46c662237837b6187450cb59e4976ce7eac78/walrus_data.d.ts +52 -0
  59. package/dist/contracts/release_cover_art/deps/0x340057f2174fb59e4626742dd2b46c662237837b6187450cb59e4976ce7eac78/walrus_data.d.ts.map +1 -0
  60. package/dist/contracts/release_cover_art/deps/0x340057f2174fb59e4626742dd2b46c662237837b6187450cb59e4976ce7eac78/walrus_data.js +37 -0
  61. package/dist/contracts/release_cover_art/deps/0x340057f2174fb59e4626742dd2b46c662237837b6187450cb59e4976ce7eac78/walrus_data.js.map +1 -0
  62. package/dist/contracts/release_cover_art/deps/cover_art/cover_art.d.ts +46 -0
  63. package/dist/contracts/release_cover_art/deps/cover_art/cover_art.d.ts.map +1 -0
  64. package/dist/contracts/release_cover_art/deps/cover_art/cover_art.js +21 -0
  65. package/dist/contracts/release_cover_art/deps/cover_art/cover_art.js.map +1 -0
  66. package/dist/contracts/release_cover_art/deps/per_track/per_track.d.ts +33 -0
  67. package/dist/contracts/release_cover_art/deps/per_track/per_track.d.ts.map +1 -0
  68. package/dist/contracts/release_cover_art/deps/per_track/per_track.js +32 -0
  69. package/dist/contracts/release_cover_art/deps/per_track/per_track.js.map +1 -0
  70. package/dist/contracts/release_cover_art/release_cover_art.d.ts +300 -0
  71. package/dist/contracts/release_cover_art/release_cover_art.d.ts.map +1 -0
  72. package/dist/contracts/release_cover_art/release_cover_art.js +168 -0
  73. package/dist/contracts/release_cover_art/release_cover_art.js.map +1 -0
  74. package/dist/contracts/release_credits/deps/miso_credit/credit.d.ts +24 -0
  75. package/dist/contracts/release_credits/deps/miso_credit/credit.d.ts.map +1 -0
  76. package/dist/contracts/release_credits/deps/miso_credit/credit.js +23 -0
  77. package/dist/contracts/release_credits/deps/miso_credit/credit.js.map +1 -0
  78. package/dist/contracts/release_credits/deps/sui/vec_map.d.ts +37 -0
  79. package/dist/contracts/release_credits/deps/sui/vec_map.d.ts.map +1 -0
  80. package/dist/contracts/release_credits/deps/sui/vec_map.js +28 -0
  81. package/dist/contracts/release_credits/deps/sui/vec_map.js.map +1 -0
  82. package/dist/contracts/release_credits/release_credits.d.ts +142 -0
  83. package/dist/contracts/release_credits/release_credits.d.ts.map +1 -0
  84. package/dist/contracts/release_credits/release_credits.js +108 -0
  85. package/dist/contracts/release_credits/release_credits.js.map +1 -0
  86. package/dist/contracts/release_credits/release_party_role.d.ts +58 -0
  87. package/dist/contracts/release_credits/release_party_role.d.ts.map +1 -0
  88. package/dist/contracts/release_credits/release_party_role.js +66 -0
  89. package/dist/contracts/release_credits/release_party_role.js.map +1 -0
  90. package/dist/contracts/royalty_pool/deps/std/type_name.d.ts +18 -0
  91. package/dist/contracts/royalty_pool/deps/std/type_name.d.ts.map +1 -0
  92. package/dist/contracts/royalty_pool/deps/std/type_name.js +20 -0
  93. package/dist/contracts/royalty_pool/deps/std/type_name.js.map +1 -0
  94. package/dist/contracts/royalty_pool/deps/sui/balance.d.ts +13 -0
  95. package/dist/contracts/royalty_pool/deps/sui/balance.d.ts.map +1 -0
  96. package/dist/contracts/royalty_pool/deps/sui/balance.js +15 -0
  97. package/dist/contracts/royalty_pool/deps/sui/balance.js.map +1 -0
  98. package/dist/contracts/royalty_pool/deps/sui/vec_map.d.ts +37 -0
  99. package/dist/contracts/royalty_pool/deps/sui/vec_map.d.ts.map +1 -0
  100. package/dist/contracts/royalty_pool/deps/sui/vec_map.js +28 -0
  101. package/dist/contracts/royalty_pool/deps/sui/vec_map.js.map +1 -0
  102. package/dist/contracts/royalty_pool/pool.d.ts +358 -0
  103. package/dist/contracts/royalty_pool/pool.d.ts.map +1 -0
  104. package/dist/contracts/royalty_pool/pool.js +352 -0
  105. package/dist/contracts/royalty_pool/pool.js.map +1 -0
  106. package/dist/contracts/royalty_pool/stake.d.ts +202 -0
  107. package/dist/contracts/royalty_pool/stake.d.ts.map +1 -0
  108. package/dist/contracts/royalty_pool/stake.js +197 -0
  109. package/dist/contracts/royalty_pool/stake.js.map +1 -0
  110. package/dist/contracts.d.ts +16 -0
  111. package/dist/contracts.d.ts.map +1 -0
  112. package/dist/contracts.js +29 -0
  113. package/dist/contracts.js.map +1 -0
  114. package/dist/cover.d.ts +48 -0
  115. package/dist/cover.d.ts.map +1 -0
  116. package/dist/cover.js +68 -0
  117. package/dist/cover.js.map +1 -0
  118. package/dist/credits.d.ts +171 -0
  119. package/dist/credits.d.ts.map +1 -0
  120. package/dist/credits.js +362 -0
  121. package/dist/credits.js.map +1 -0
  122. package/dist/extensions/royalty-pool.d.ts +32 -0
  123. package/dist/extensions/royalty-pool.d.ts.map +1 -0
  124. package/dist/extensions/royalty-pool.js +33 -0
  125. package/dist/extensions/royalty-pool.js.map +1 -0
  126. package/dist/index.d.ts +4 -0
  127. package/dist/index.d.ts.map +1 -1
  128. package/dist/index.js +17 -3
  129. package/dist/index.js.map +1 -1
  130. package/dist/internal.d.ts +4 -0
  131. package/dist/internal.d.ts.map +1 -0
  132. package/dist/internal.js +18 -0
  133. package/dist/internal.js.map +1 -0
  134. package/dist/release-graph.d.ts.map +1 -1
  135. package/dist/release-graph.js +5 -4
  136. package/dist/release-graph.js.map +1 -1
  137. package/package.json +14 -2
  138. package/src/catalog.ts +118 -0
  139. package/src/contracts/composition_credits/composition_credits.ts +169 -0
  140. package/src/contracts/composition_credits/composition_party_role.ts +189 -0
  141. package/src/contracts/composition_credits/deps/miso_credit/credit.ts +27 -0
  142. package/src/contracts/composition_credits/deps/sui/vec_map.ts +33 -0
  143. package/src/contracts/composition_royalty_pool/composition_royalty_pool.ts +135 -0
  144. package/src/contracts/cover_art/cover_art.ts +99 -0
  145. package/src/contracts/cover_art/deps/ori/walrus_data.ts +36 -0
  146. package/src/contracts/recording_credits/deps/miso_credit/credit.ts +27 -0
  147. package/src/contracts/recording_credits/deps/sui/vec_map.ts +33 -0
  148. package/src/contracts/recording_credits/deps/sui/vec_set.ts +21 -0
  149. package/src/contracts/recording_credits/recording_credits.ts +458 -0
  150. package/src/contracts/recording_credits/recording_party_role.ts +1041 -0
  151. package/src/contracts/recording_royalty_pool/recording_royalty_pool.ts +138 -0
  152. package/src/contracts/release_cover_art/deps/0x340057f2174fb59e4626742dd2b46c662237837b6187450cb59e4976ce7eac78/walrus_data.ts +36 -0
  153. package/src/contracts/release_cover_art/deps/cover_art/cover_art.ts +23 -0
  154. package/src/contracts/release_cover_art/deps/per_track/per_track.ts +36 -0
  155. package/src/contracts/release_cover_art/release_cover_art.ts +251 -0
  156. package/src/contracts/release_credits/deps/miso_credit/credit.ts +27 -0
  157. package/src/contracts/release_credits/deps/sui/vec_map.ts +33 -0
  158. package/src/contracts/release_credits/release_credits.ts +156 -0
  159. package/src/contracts/release_credits/release_party_role.ts +87 -0
  160. package/src/contracts/royalty_pool/deps/std/type_name.ts +22 -0
  161. package/src/contracts/royalty_pool/deps/sui/balance.ts +17 -0
  162. package/src/contracts/royalty_pool/deps/sui/vec_map.ts +33 -0
  163. package/src/contracts/royalty_pool/pool.ts +577 -0
  164. package/src/contracts/royalty_pool/stake.ts +317 -0
  165. package/src/contracts.ts +33 -0
  166. package/src/cover.ts +140 -0
  167. package/src/credits.ts +665 -0
  168. package/src/extensions/royalty-pool.ts +90 -0
  169. package/src/index.ts +19 -3
  170. package/src/internal.ts +19 -0
  171. package/src/release-graph.ts +5 -10
package/README.md CHANGED
@@ -1,9 +1,10 @@
1
1
  # @misofm/sdk
2
2
 
3
3
  Typed reads and transaction builders for the **Miso platform layer** on Sui: the
4
- record production line and the sale of copies off it, plus the opinionated
5
- publish flow (share economics, minato dispersal, whole-graph orchestration)
6
- built on top of `@misonetwork/sdk`'s bare protocol primitives.
4
+ record production line and the sale of copies off it, the first-party protocol
5
+ extensions (credits, cover art, royalty pools), and the opinionated publish flow
6
+ (share economics, minato dispersal, whole-graph orchestration) built on top of
7
+ `@misonetwork/sdk`'s bare protocol primitives.
7
8
 
8
9
  ## The split
9
10
 
@@ -13,7 +14,7 @@ holding:
13
14
  | Scope | Layer | Owns |
14
15
  | --- | --- | --- |
15
16
  | `@misonetwork/*` | **Protocol** | Composition, Recording, Release as bare primitives — mint a work, don't disperse/publish/transfer it. The permissionless layer anyone can build on |
16
- | `@misofm/*` | **Platform** | Pressing, Listing, Record (how Miso sells copies of a release) — plus the opinionated finish for publishing works: disperse share supply via minato, publish (share), transfer the admin cap, provision share currencies, and orchestrate a whole release graph in one PTB |
17
+ | `@misofm/*` | **Platform** | Pressing, Listing, Record (how Miso sells copies of a release) — the first-party extensions (credits, cover art, royalty pools) — plus the opinionated finish for publishing works: disperse share supply via minato, publish (share), transfer the admin cap, provision share currencies, and orchestrate a whole release graph in one PTB |
17
18
 
18
19
  A release is protocol. Pressing a record off that release and selling it is
19
20
  platform. So is deciding *what to do* with a freshly-minted work's share
@@ -21,6 +22,15 @@ supply — the protocol only knows how to mint one. Keeping the boundary at the
21
22
  package line is what stops the open protocol from quietly growing a
22
23
  storefront (or an opinion about tokenomics).
23
24
 
25
+ **Extensions are platform too.** An extension is not part of what a Composition
26
+ or Recording *is* — it is a choice about how to describe one: which credit roles
27
+ exist and what they are called, what counts as a cover, whether royalties
28
+ accumulate in a pool. The protocol offers a cap-gated `&mut UID` hook and takes
29
+ no position on what hangs off it; every module that *does* take a position is
30
+ business logic, and ships from here. (They lived in `@misonetwork/sdk` through
31
+ its 0.2.x line; `@misonetwork/sdk` 0.3.0 dropped them and `@misofm/sdk` 0.2.0
32
+ picked them up, with signatures unchanged — only the import specifier moves.)
33
+
24
34
  This package depends on `@misonetwork/sdk` and imports its bare
25
35
  `createComposition`/`createRecording` primitives, composing them with its own
26
36
  minato-dispersal and share-currency logic in the same PTB — the
@@ -192,18 +202,130 @@ non-idempotent PTB through a `ParallelTransactionExecutor` exactly once (no
192
202
  auto-retry) — it's what the batched provisioning above builds on, layered over
193
203
  `@misonetwork/sdk`'s transport-agnostic `buildTx`/`toExecResult`.
194
204
 
205
+ ## Extensions
206
+
207
+ An extension attaches data to a protocol work through that work's cap-gated
208
+ `uid_mut` hook. The work stays a protocol object; the opinion hanging off it is
209
+ ours.
210
+
211
+ ### Credits (`credits.ts`)
212
+
213
+ Contributor credits pair a party with a display name and one or more
214
+ domain-specific roles, attached to a work as a dynamic field and gated by the
215
+ work's admin cap. Three role vocabularies:
216
+
217
+ - **Composition** (writing, 1–5 roles, no level): `Adapter`, `Arranger`, `Composer`, `Lyricist`, `Songwriter`, `Translator`, or `{ type: "Custom", name }`.
218
+ - **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`.
219
+ - **Release** (top-line billing, exactly one role): `"Primary"` or `"Featured"`.
220
+
221
+ Writers validate client-side, mirroring the Move aborts: display name
222
+ non-empty and ≤200 UTF-8 bytes; role counts within the caps above; no
223
+ duplicate roles.
224
+
225
+ ```ts
226
+ import {
227
+ attachCompositionCredit, attachRecordingCredit, addReleaseCredit,
228
+ addRecordingPrimaryArtist, addRecordingFeaturedArtist,
229
+ getCompositionCredits, getRecordingCredits, getReleaseCredits,
230
+ } from "@misofm/sdk";
231
+
232
+ const thunk = attachRecordingCredit({
233
+ recordingId: "0x...",
234
+ recordingAdminCapId: "0x...",
235
+ partyId: "0x...",
236
+ displayName: "Jane Doe",
237
+ roles: [{ type: "Vocalist", level: "Lead" }, { type: "Instrumentalist", instrument: "Guitar" }],
238
+ recordingShareType: "0x...::share::Share",
239
+ compositionShareType: "0x...::share::Share",
240
+ recordingCreditsPackageId: "0x...",
241
+ misoCreditPackageId: "0x...",
242
+ });
243
+
244
+ // Designate an already-credited party (same params minus displayName/roles/misoCreditPackageId):
245
+ addRecordingPrimaryArtist({ recordingId, recordingAdminCapId, partyId, recordingShareType, compositionShareType, recordingCreditsPackageId });
246
+
247
+ // Reads return null when no credits field is attached.
248
+ const credits = await getCompositionCredits(client, compositionId, compositionCreditsPackageId);
249
+ // CreditView[]: { partyId, displayName, roles: string[] } — e.g. "Producer (Lead)", "Instrumentalist: Guitar"
250
+ const rc = await getRecordingCredits(client, recordingId, recordingCreditsPackageId);
251
+ // { credits: CreditView[], primaryArtistIds: string[], featuredArtistIds: string[] }
252
+ ```
253
+
254
+ `attachCompositionCredit` takes `compositionId`/`compositionAdminCapId`/`compositionShareType`/`compositionCreditsPackageId`;
255
+ `addReleaseCredit` takes `releaseId`/`releaseAdminCapId` and a single `role`.
256
+
257
+ A recording is `Recording<RecordingShare, CompositionShare>` — the recording's
258
+ OWN share type comes first, its parent composition's second. The recording
259
+ writers take both as separate named params for that reason; passing them in the
260
+ wrong order still typechecks (both are `string`) and resolves to the wrong
261
+ on-chain type.
262
+
263
+ ### Cover art (`cover.ts`)
264
+
265
+ A release's cover is a Walrus blob referenced on-chain via `ori::WalrusData`,
266
+ attached under the `release_cover_art` extension:
267
+
268
+ ```ts
269
+ import { setReleaseCover, getReleaseCover } from "@misofm/sdk";
270
+
271
+ const thunk = setReleaseCover({
272
+ releaseId: "0x...",
273
+ releaseAdminCapId: "0x...",
274
+ stillBlobId: "987654321", // Walrus blob id as u256 (decimal string or bigint)
275
+ animatedBlobId: null, // optional animated cover
276
+ coverArtPackageId: "0x...",
277
+ releaseCoverArtPackageId: "0x...",
278
+ oriPackageId: "0x...",
279
+ });
280
+
281
+ const cover = await getReleaseCover(client, releaseId, releaseCoverArtPackageId);
282
+ // ReleaseCoverView | null: { still, animated } as normalized Walrus refs
283
+ // ({ kind: "blob", blobId } | { kind: "quiltPatch", quiltId, version, startIndex, endIndex })
284
+ ```
285
+
286
+ ### Royalty pools (`extensions/royalty-pool.ts`)
287
+
288
+ `attachCompositionRoyaltyPool(tx, params)` / `attachRecordingRoyaltyPool(tx, params)`
289
+ create and share a `RoyaltyPool<Share, Currency>` for a work inside its publish
290
+ PTB — after `@misonetwork/sdk`'s `createComposition`/`createRecording`, before
291
+ this package's opinionated finish. `publishReleaseGraph` accepts them as
292
+ `royaltyPool` nodes and does the sequencing for you.
293
+
294
+ ### Extension types
295
+
296
+ ```ts
297
+ import type {
298
+ CreditView, RecordingCreditsView,
299
+ CompositionRole, RecordingRole, RecordingRoleLevel, RecordingLeveledRoleType,
300
+ ReleaseRole,
301
+ ReleaseCoverView, CoverImageRef,
302
+ } from "@misofm/sdk";
303
+ ```
304
+
305
+ `RecordingLeveledRoleType` is the union of the 28 recording role base names that
306
+ carry an optional `RecordingRoleLevel` (`Producer`, `Vocalist`, `Engineer`,
307
+ `Conductor`, …) — the leveled arm of `RecordingRole`. The other arms
308
+ (`Instrumentalist`, `Custom`, and the unleveled `ArtistsAndRepertoire` /
309
+ `Copyist`) are spelled out separately in `RecordingRole`.
310
+
195
311
  ## Layout
196
312
 
197
313
  ```
198
314
  src/
199
315
  client.ts the client extension — misoPlatform({ packageId, settingsId, misoPackageId?, minatoPackageId? })
200
316
  pressing.ts facade: builders, readers, and the id derivations
201
- queries.ts shared read plumbing (isNotFound)
317
+ queries.ts shared read plumbing (isNotFound, re-exported from @misonetwork/sdk)
202
318
  transactions.ts the TxThunk contract + the opinionated publish flow (disperse/finalize/publish*)
203
319
  release-graph.ts whole release graph in one PTB (publishReleaseGraph)
204
320
  share.ts share-currency provisioning (createShareCurrency, batched variants)
205
321
  share-template.ts embedded `share` package bytecode
322
+ credits.ts EXTENSION: contributor credits + the three role vocabularies
323
+ cover.ts EXTENSION: release cover art (Walrus blob via ori)
324
+ extensions/
325
+ royalty-pool.ts EXTENSION: create + share a RoyaltyPool<Share, Currency>
206
326
  execute.ts executeViaExecutor, layered on @misonetwork/sdk's buildTx/toExecResult
327
+ internal.ts private helpers (the 0x1::option moveCall targets) — NOT exported
328
+ contracts.ts barrel re-exporting the generated bindings as `contracts`
207
329
  contracts/ GENERATED — do not edit by hand
208
330
  ```
209
331
 
@@ -216,11 +338,17 @@ the on-chain ABI:
216
338
  bun run codegen # reads sui-codegen.config.ts → src/contracts/
217
339
  ```
218
340
 
219
- `sui-codegen.config.ts` lists **platform packages only** (currently just
220
- `miso_pressing`). Protocol packages (`miso`/composition/recording/release and
221
- its extensions) generate into `@misonetwork/sdk` instead, which this package
222
- depends on for their typed bindings — adding a protocol package here to save
223
- an import is how the split this package exists to enforce gets undone.
341
+ `sui-codegen.config.ts` lists the **platform** package (`miso_pressing`) and the
342
+ first-party **extension** packages (`royalty_pool`, `composition_royalty_pool`,
343
+ `recording_royalty_pool`, `cover_art`, `release_cover_art`,
344
+ `composition_credits`, `recording_credits`, `release_credits`). The protocol
345
+ CORE (`miso` composition/recording/release/deal/track) generates into
346
+ `@misonetwork/sdk` instead, which this package depends on for those bindings —
347
+ adding the core here to save an import is how the split this package exists to
348
+ enforce gets undone.
349
+
350
+ Paths resolve against sibling checkouts, so regenerating requires
351
+ `~/Documents/GitHub/misofm/{sdk, pressing, protocol-extensions}`.
224
352
 
225
353
  ## Dependency on `@misonetwork/sdk`
226
354
 
package/dist/catalog.d.ts CHANGED
@@ -1,6 +1,36 @@
1
1
  import type { ClientWithCoreApi } from "@mysten/sui/client";
2
2
  import type { SuiGraphQLClient } from "@mysten/sui/graphql";
3
3
  import { type Recording } from "@misonetwork/sdk";
4
+ import { type CreditView, type RecordingCreditsView } from "./credits.ts";
5
+ export interface GetReleaseTrackCreditsOptions {
6
+ /** Core Miso package that defines Composition and Recording. */
7
+ misoPackageId: string;
8
+ /** Package that defines the composition_credits extension key. */
9
+ compositionCreditsPackageId: string;
10
+ /** Package that defines the recording_credits extension key. */
11
+ recordingCreditsPackageId: string;
12
+ }
13
+ export interface ReleaseTrackCredits {
14
+ compositionCredits: CreditView[];
15
+ recordingCredits: RecordingCreditsView;
16
+ }
17
+ /**
18
+ * Composition and recording credits for every track on a release, keyed by
19
+ * recording id.
20
+ *
21
+ * The read follows the chain's actual object graph instead of release credits:
22
+ * Release -> Recording -> Composition. Recording credit fields and recording
23
+ * type parameters are fetched together for every track. Composition addresses
24
+ * are then resolved concurrently, deduplicated, and all composition credit
25
+ * fields are fetched concurrently as well.
26
+ */
27
+ export declare function getReleaseTrackCredits(client: ClientWithCoreApi, graphqlClient: SuiGraphQLClient, releaseId: string, options: GetReleaseTrackCreditsOptions): Promise<Record<string, ReleaseTrackCredits>>;
28
+ /**
29
+ * Composition and recording credits for the supplied recordings, keyed by
30
+ * recording id. This form is intended for consumers that already loaded a
31
+ * release and do not need to fetch it again.
32
+ */
33
+ export declare function getTrackCreditsByRecordingIds(client: ClientWithCoreApi, graphqlClient: SuiGraphQLClient, recordingIdsInput: readonly string[], options: GetReleaseTrackCreditsOptions): Promise<Record<string, ReleaseTrackCredits>>;
4
34
  export interface GetAdministeredRecordingsOptions {
5
35
  /**
6
36
  * Maximum lookups in flight at once. The traversal is one lookup per admin
@@ -1 +1 @@
1
- {"version":3,"file":"catalog.d.ts","sourceRoot":"","sources":["../src/catalog.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAC5D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAC5D,OAAO,EAGL,KAAK,SAAS,EACf,MAAM,kBAAkB,CAAC;AAE1B,MAAM,WAAW,gCAAgC;IAC/C;;;;OAIG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAsB,yBAAyB,CAC7C,MAAM,EAAE,iBAAiB,EACzB,aAAa,EAAE,gBAAgB,EAC/B,KAAK,EAAE,MAAM,EACb,aAAa,EAAE,MAAM,EACrB,OAAO,GAAE,gCAAqC,GAC7C,OAAO,CAAC,SAAS,EAAE,CAAC,CAsBtB"}
1
+ {"version":3,"file":"catalog.d.ts","sourceRoot":"","sources":["../src/catalog.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,iBAAiB,EAAE,M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AC,CAsBtB"}
package/dist/catalog.js CHANGED
@@ -1,6 +1,65 @@
1
1
  // Copyright (c) Miso Labs, Inc.
2
2
  // SPDX-License-Identifier: Apache-2.0
3
- import { getOwnedRecordingAdminCaps, getRecordingByShareType, } from "@misonetwork/sdk";
3
+ import { getCompositionAddressByShareType, getOwnedRecordingAdminCaps, getRecordingByShareType, getRecordingShareTypes, getReleaseById, } from "@misonetwork/sdk";
4
+ import { getCompositionCredits, getRecordingCredits, } from "./credits.js";
5
+ const EMPTY_RECORDING_CREDITS = {
6
+ credits: [],
7
+ primaryArtistIds: [],
8
+ featuredArtistIds: [],
9
+ };
10
+ /**
11
+ * Composition and recording credits for every track on a release, keyed by
12
+ * recording id.
13
+ *
14
+ * The read follows the chain's actual object graph instead of release credits:
15
+ * Release -> Recording -> Composition. Recording credit fields and recording
16
+ * type parameters are fetched together for every track. Composition addresses
17
+ * are then resolved concurrently, deduplicated, and all composition credit
18
+ * fields are fetched concurrently as well.
19
+ */
20
+ export async function getReleaseTrackCredits(client, graphqlClient, releaseId, options) {
21
+ const release = await getReleaseById(client, releaseId);
22
+ return getTrackCreditsByRecordingIds(client, graphqlClient, release.tracks.map((track) => track.recordingId), options);
23
+ }
24
+ /**
25
+ * Composition and recording credits for the supplied recordings, keyed by
26
+ * recording id. This form is intended for consumers that already loaded a
27
+ * release and do not need to fetch it again.
28
+ */
29
+ export async function getTrackCreditsByRecordingIds(client, graphqlClient, recordingIdsInput, options) {
30
+ const recordingIds = [...new Set(recordingIdsInput)];
31
+ const recordingReads = await Promise.all(recordingIds.map(async (recordingId) => {
32
+ const [recordingCredits, [, compositionShareType]] = await Promise.all([
33
+ getRecordingCredits(client, recordingId, options.recordingCreditsPackageId),
34
+ getRecordingShareTypes(client, recordingId),
35
+ ]);
36
+ return { recordingId, recordingCredits, compositionShareType };
37
+ }));
38
+ const compositionShareTypes = [...new Set(recordingReads.map((read) => read.compositionShareType))];
39
+ const compositionAddressEntries = await Promise.all(compositionShareTypes.map(async (shareType) => {
40
+ const compositionId = await getCompositionAddressByShareType(graphqlClient, shareType, options.misoPackageId);
41
+ if (!compositionId)
42
+ throw new Error(`Composition not found for share type: ${shareType}`);
43
+ return [shareType, compositionId];
44
+ }));
45
+ const compositionAddressByShareType = new Map(compositionAddressEntries);
46
+ const compositionIds = [...new Set(compositionAddressEntries.map(([, compositionId]) => compositionId))];
47
+ const compositionCreditEntries = await Promise.all(compositionIds.map(async (compositionId) => {
48
+ const credits = await getCompositionCredits(client, compositionId, options.compositionCreditsPackageId);
49
+ return [compositionId, credits ?? []];
50
+ }));
51
+ const compositionCreditsById = new Map(compositionCreditEntries);
52
+ return Object.fromEntries(recordingReads.map((read) => {
53
+ const compositionId = compositionAddressByShareType.get(read.compositionShareType);
54
+ return [
55
+ read.recordingId,
56
+ {
57
+ compositionCredits: compositionCreditsById.get(compositionId) ?? [],
58
+ recordingCredits: read.recordingCredits ?? EMPTY_RECORDING_CREDITS,
59
+ },
60
+ ];
61
+ }));
62
+ }
4
63
  /**
5
64
  * Every `Recording` administered by `owner`.
6
65
  *
@@ -1 +1 @@
1
- {"version":3,"file":"catalog.js","sourceRoot":"","sources":["../src/catalog.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,sCAAsC;AActC,OAAO,EACL,0BAA0B,EAC1B,uBAAuB,GAExB,MAAM,kBAAkB,CAAC;AAW1B;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,CAAC,KAAK,UAAU,yBAAyB,CAC7C,MAAyB,EACzB,aAA+B,EAC/B,KAAa,EACb,aAAqB,EACrB,UAA4C,EAAE;IAE9C,MAAM,WAAW,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,OAAO,CAAC,WAAW,IAAI,EAAE,CAAC,CAAC;IAC3D,MAAM,IAAI,GAAG,MAAM,0BAA0B,CAAC,MAAM,EAAE,KAAK,EAAE,aAAa,CAAC,CAAC;IAE5E,MAAM,UAAU,GAAgB,EAAE,CAAC;IACnC,KAAK,IAAI,CAAC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b,aAAqB,EACrB,UAA4C,EAAE;IAE9C,MAAM,WAAW,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,OAAO,CAAC,WAAW,IAAI,EAAE,CAAC,CAAC;IAC3D,MAAM,IAAI,GAAG,MAAM,0BAA0B,CAAC,MAAM,EAAE,KAAK,EAAE,aAAa,CAAC,CAAC;IAE5E,MAAM,UAAU,GAAgB,EAAE,CAAC;IACnC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,IAAI,WAAW,EAAE,CAAC;QAClD,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,GAAG,WAAW,CAAC,CAAC;QAC7C,MAAM,OAAO,GAAG,MAAM,OAAO,CAAC,GAAG,CAC/B,KAAK,CAAC,GAAG,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE;YACtB,IAAI,CAAC;gBACH,OAAO,MAAM,uBAAuB,CAAC,MAAM,EAAE,aAAa,EAAE,GAAG,CAAC,SAAS,EAAE,aAAa,CAAC,CAAC;YAC5F,CAAC;YAAC,MAAM,CAAC;gBACP,kEAAkE;gBAClE,sEAAsE;gBACtE,4CAA4C;gBAC5C,OAAO,IAAI,CAAC;YACd,CAAC;QACH,CAAC,CAAC,CACH,CAAC;QACF,KAAK,MAAM,GAAG,IAAI,OAAO;YAAE,IAAI,GAAG;gBAAE,UAAU,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAC3D,CAAC;IACD,OAAO,UAAU,CAAC;AACpB,CAAC"}
@@ -0,0 +1,181 @@
1
+ /**************************************************************
2
+ * THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
3
+ **************************************************************/
4
+ /**
5
+ * First-party credits extension for compositions.
6
+ *
7
+ * Attribution (writing credits) is display-oriented and varies across platforms,
8
+ * so it lives here as a dynamic field on the composition rather than in immutable
9
+ * core. The data is attached under `ExtensionKey()` via the composition's
10
+ * cap-gated `uid_mut`, so every mutation is authorized by the composition's admin
11
+ * and credits survive into any lifecycle state (they may be attached before or
12
+ * after the composition is published).
13
+ *
14
+ * This is Miso's canonical credits standard; because it is an extension, other
15
+ * parties may publish their own composition-credits standard against the same
16
+ * `Composition`. Credits are NOT read by the economics — they are attribution.
17
+ */
18
+ import { MoveTuple, MoveStruct, type RawTransactionArgument } from '../utils/index.js';
19
+ import { type Transaction, type TransactionArgument } from '@mysten/sui/transactions';
20
+ export declare const ExtensionKey: MoveTuple<readonly [import("@mysten/sui/bcs").BcsType<boolean, boolean, "bool">], "@local-pkg/composition_credits::composition_credits::ExtensionKey">;
21
+ export declare const CompositionCredits: MoveStruct<{
22
+ /** Map of party IDs to their credit (display name + roles). */
23
+ credits: MoveStruct<{
24
+ contents: import("@mysten/sui/bcs").BcsType<{
25
+ key: string;
26
+ value: {
27
+ display_name: string;
28
+ roles: import("@mysten/bcs").EnumOutputShapeWithKeys<{
29
+ Adapter: true;
30
+ Arranger: true;
31
+ Composer: true;
32
+ Lyricist: true;
33
+ Songwriter: true;
34
+ Translator: true;
35
+ Custom: string;
36
+ }, "Adapter" | "Arranger" | "Composer" | "Lyricist" | "Songwriter" | "Translator" | "Custom">[];
37
+ };
38
+ }[], Iterable<{
39
+ key: string | Uint8Array<ArrayBufferLike>;
40
+ value: {
41
+ display_name: string;
42
+ roles: Iterable<import("@mysten/bcs").EnumInputShape<{
43
+ Adapter: boolean | object | null;
44
+ Arranger: boolean | object | null;
45
+ Composer: boolean | object | null;
46
+ Lyricist: boolean | object | null;
47
+ Songwriter: boolean | object | null;
48
+ Translator: boolean | object | null;
49
+ Custom: string;
50
+ }>> & {
51
+ length: number;
52
+ };
53
+ };
54
+ }> & {
55
+ length: number;
56
+ }, string>;
57
+ }, "0x2::vec_map::VecMap<bytes[32], miso_credit::credit::Credit<@local-pkg/composition_credits::composition_party_role::CompositionPartyRole>>">;
58
+ }, "@local-pkg/composition_credits::composition_credits::CompositionCredits">;
59
+ export declare const CreditAddedEvent: MoveStruct<{
60
+ composition_id: import("@mysten/sui/bcs").BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
61
+ party_id: import("@mysten/sui/bcs").BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
62
+ credit: MoveStruct<{
63
+ display_name: import("@mysten/sui/bcs").BcsType<string, string, "string">;
64
+ roles: import("@mysten/sui/bcs").BcsType<import("@mysten/bcs").EnumOutputShapeWithKeys<{
65
+ Adapter: true;
66
+ Arranger: true;
67
+ Composer: true;
68
+ Lyricist: true;
69
+ Songwriter: true;
70
+ Translator: true;
71
+ Custom: string;
72
+ }, "Adapter" | "Arranger" | "Composer" | "Lyricist" | "Songwriter" | "Translator" | "Custom">[], Iterable<import("@mysten/bcs").EnumInputShape<{
73
+ Adapter: boolean | object | null;
74
+ Arranger: boolean | object | null;
75
+ Composer: boolean | object | null;
76
+ Lyricist: boolean | object | null;
77
+ Songwriter: boolean | object | null;
78
+ Translator: boolean | object | null;
79
+ Custom: string;
80
+ }>> & {
81
+ length: number;
82
+ }, string>;
83
+ }, "miso_credit::credit::Credit<@local-pkg/composition_credits::composition_party_role::CompositionPartyRole>">;
84
+ }, "@local-pkg/composition_credits::composition_credits::CreditAddedEvent">;
85
+ export declare const CreditRemovedEvent: MoveStruct<{
86
+ composition_id: import("@mysten/sui/bcs").BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
87
+ party_id: import("@mysten/sui/bcs").BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
88
+ credit: MoveStruct<{
89
+ display_name: import("@mysten/sui/bcs").BcsType<string, string, "string">;
90
+ roles: import("@mysten/sui/bcs").BcsType<import("@mysten/bcs").EnumOutputShapeWithKeys<{
91
+ Adapter: true;
92
+ Arranger: true;
93
+ Composer: true;
94
+ Lyricist: true;
95
+ Songwriter: true;
96
+ Translator: true;
97
+ Custom: string;
98
+ }, "Adapter" | "Arranger" | "Composer" | "Lyricist" | "Songwriter" | "Translator" | "Custom">[], Iterable<import("@mysten/bcs").EnumInputShape<{
99
+ Adapter: boolean | object | null;
100
+ Arranger: boolean | object | null;
101
+ Composer: boolean | object | null;
102
+ Lyricist: boolean | object | null;
103
+ Songwriter: boolean | object | null;
104
+ Translator: boolean | object | null;
105
+ Custom: string;
106
+ }>> & {
107
+ length: number;
108
+ }, string>;
109
+ }, "miso_credit::credit::Credit<@local-pkg/composition_credits::composition_party_role::CompositionPartyRole>">;
110
+ }, "@local-pkg/composition_credits::composition_credits::CreditRemovedEvent">;
111
+ export interface AddCreditArguments {
112
+ self: RawTransactionArgument<string>;
113
+ cap: RawTransactionArgument<string>;
114
+ party: RawTransactionArgument<string>;
115
+ credit: TransactionArgument;
116
+ }
117
+ export interface AddCreditOptions {
118
+ package?: string;
119
+ arguments: AddCreditArguments | [
120
+ self: RawTransactionArgument<string>,
121
+ cap: RawTransactionArgument<string>,
122
+ party: RawTransactionArgument<string>,
123
+ credit: TransactionArgument
124
+ ];
125
+ typeArguments: [
126
+ string
127
+ ];
128
+ }
129
+ /**
130
+ * Adds a credit for a party on the composition, lazily creating the credits record
131
+ * on first use. Each credit must have 1-5 roles, and a party may hold at most one
132
+ * credit. Requires the composition's admin capability.
133
+ */
134
+ export declare function addCredit(options: AddCreditOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
135
+ export interface RemoveCreditArguments {
136
+ self: RawTransactionArgument<string>;
137
+ cap: RawTransactionArgument<string>;
138
+ partyId: RawTransactionArgument<string>;
139
+ }
140
+ export interface RemoveCreditOptions {
141
+ package?: string;
142
+ arguments: RemoveCreditArguments | [
143
+ self: RawTransactionArgument<string>,
144
+ cap: RawTransactionArgument<string>,
145
+ partyId: RawTransactionArgument<string>
146
+ ];
147
+ typeArguments: [
148
+ string
149
+ ];
150
+ }
151
+ /** Removes a party's credit. Requires the composition's admin capability. */
152
+ export declare function removeCredit(options: RemoveCreditOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
153
+ export interface HasCreditsArguments {
154
+ self: RawTransactionArgument<string>;
155
+ }
156
+ export interface HasCreditsOptions {
157
+ package?: string;
158
+ arguments: HasCreditsArguments | [
159
+ self: RawTransactionArgument<string>
160
+ ];
161
+ typeArguments: [
162
+ string
163
+ ];
164
+ }
165
+ /** Returns whether a credits record has been attached to this composition yet. */
166
+ export declare function hasCredits(options: HasCreditsOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
167
+ export interface CreditsArguments {
168
+ self: RawTransactionArgument<string>;
169
+ }
170
+ export interface CreditsOptions {
171
+ package?: string;
172
+ arguments: CreditsArguments | [
173
+ self: RawTransactionArgument<string>
174
+ ];
175
+ typeArguments: [
176
+ string
177
+ ];
178
+ }
179
+ /** Returns the party-to-credit map. Aborts if no credits are attached. */
180
+ export declare function credits(options: CreditsOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
181
+ //# sourceMappingURL=composition_credits.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"composition_credits.d.ts","sourceRoot":"","sources":["../../../src/contracts/composition_credits/composition_credits.ts"],"names":[],"mappings":"AAAA;;gEAEgE;AAGhE;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,SAAS,EAAE,UAAU,EAA0B,KAAK,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;AAE/G,OAAO,EAAE,KAAK,WAAW,EAAE,KAAK,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAKtF,eAAO,MAAM,YAAY,wJAAgF,CAAC;AAC1G,eAAO,MAAM,kBAAkB;IACvB,+DAA+D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;6EAE/D,CAAC;AACT,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;2EAIrB,CAAC;AACT,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;6EAIvB,CAAC;AACT,MAAM,WAAW,kBAAkB;IAC/B,IAAI,EAAE,sBAAsB,CAAC,MAAM,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CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,mBAAmB,GAAG;QAC7B,IAAI,EAAE,sBAAsB,CAAC,MAAM,CAAC;KACvC,CAAC;IACF,aAAa,EAAE;QACX,MAAM;KACT,CAAC;CACL;AACD,kFAAkF;AAClF,wBAAgB,UAAU,CAAC,OAAO,EAAE,iBAAiB,IAMzC,IAAI,WAAW,0DAO1B;AACD,MAAM,WAAW,gBAAgB;IAC7B,IAAI,EAAE,sBAAsB,CAAC,MAAM,CAAC,CAAC;CACxC;AACD,MAAM,WAAW,cAAc;IAC3B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,gBAAgB,GAAG;QAC1B,IAAI,EAAE,sBAAsB,CAAC,MAAM,CAAC;KACvC,CAAC;IACF,aAAa,EAAE;QACX,MAAM;KACT,CAAC;CACL;AACD,0EAA0E;AAC1E,wBAAgB,OAAO,CAAC,OAAO,EAAE,cAAc,IAMnC,IAAI,WAAW,0DAO1B"}
@@ -0,0 +1,109 @@
1
+ /**************************************************************
2
+ * THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
3
+ **************************************************************/
4
+ /**
5
+ * First-party credits extension for compositions.
6
+ *
7
+ * Attribution (writing credits) is display-oriented and varies across platforms,
8
+ * so it lives here as a dynamic field on the composition rather than in immutable
9
+ * core. The data is attached under `ExtensionKey()` via the composition's
10
+ * cap-gated `uid_mut`, so every mutation is authorized by the composition's admin
11
+ * and credits survive into any lifecycle state (they may be attached before or
12
+ * after the composition is published).
13
+ *
14
+ * This is Miso's canonical credits standard; because it is an extension, other
15
+ * parties may publish their own composition-credits standard against the same
16
+ * `Composition`. Credits are NOT read by the economics — they are attribution.
17
+ */
18
+ import { MoveTuple, MoveStruct, normalizeMoveArguments } from '../utils/index.js';
19
+ import { bcs } from '@mysten/sui/bcs';
20
+ import {} from '@mysten/sui/transactions';
21
+ import * as vec_map from './deps/sui/vec_map.js';
22
+ import * as credit from './deps/miso_credit/credit.js';
23
+ import * as composition_party_role from './composition_party_role.js';
24
+ const $moduleName = '@local-pkg/composition_credits::composition_credits';
25
+ export const ExtensionKey = new MoveTuple({ name: `${$moduleName}::ExtensionKey`, fields: [bcs.bool()] });
26
+ export const CompositionCredits = new MoveStruct({ name: `${$moduleName}::CompositionCredits`, fields: {
27
+ /** Map of party IDs to their credit (display name + roles). */
28
+ credits: vec_map.VecMap(bcs.Address, credit.Credit(composition_party_role.CompositionPartyRole))
29
+ } });
30
+ export const CreditAddedEvent = new MoveStruct({ name: `${$moduleName}::CreditAddedEvent`, fields: {
31
+ composition_id: bcs.Address,
32
+ party_id: bcs.Address,
33
+ credit: credit.Credit(composition_party_role.CompositionPartyRole)
34
+ } });
35
+ export const CreditRemovedEvent = new MoveStruct({ name: `${$moduleName}::CreditRemovedEvent`, fields: {
36
+ composition_id: bcs.Address,
37
+ party_id: bcs.Address,
38
+ credit: credit.Credit(composition_party_role.CompositionPartyRole)
39
+ } });
40
+ /**
41
+ * Adds a credit for a party on the composition, lazily creating the credits record
42
+ * on first use. Each credit must have 1-5 roles, and a party may hold at most one
43
+ * credit. Requires the composition's admin capability.
44
+ */
45
+ export function addCredit(options) {
46
+ const packageAddress = options.package ?? '@local-pkg/composition_credits';
47
+ const argumentsTypes = [
48
+ null,
49
+ null,
50
+ null,
51
+ null
52
+ ];
53
+ const parameterNames = ["self", "cap", "party", "credit"];
54
+ return (tx) => tx.moveCall({
55
+ package: packageAddress,
56
+ module: 'composition_credits',
57
+ function: 'add_credit',
58
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
59
+ typeArguments: options.typeArguments
60
+ });
61
+ }
62
+ /** Removes a party's credit. Requires the composition's admin capability. */
63
+ export function removeCredit(options) {
64
+ const packageAddress = options.package ?? '@local-pkg/composition_credits';
65
+ const argumentsTypes = [
66
+ null,
67
+ null,
68
+ '0x2::object::ID'
69
+ ];
70
+ const parameterNames = ["self", "cap", "partyId"];
71
+ return (tx) => tx.moveCall({
72
+ package: packageAddress,
73
+ module: 'composition_credits',
74
+ function: 'remove_credit',
75
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
76
+ typeArguments: options.typeArguments
77
+ });
78
+ }
79
+ /** Returns whether a credits record has been attached to this composition yet. */
80
+ export function hasCredits(options) {
81
+ const packageAddress = options.package ?? '@local-pkg/composition_credits';
82
+ const argumentsTypes = [
83
+ null
84
+ ];
85
+ const parameterNames = ["self"];
86
+ return (tx) => tx.moveCall({
87
+ package: packageAddress,
88
+ module: 'composition_credits',
89
+ function: 'has_credits',
90
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
91
+ typeArguments: options.typeArguments
92
+ });
93
+ }
94
+ /** Returns the party-to-credit map. Aborts if no credits are attached. */
95
+ export function credits(options) {
96
+ const packageAddress = options.package ?? '@local-pkg/composition_credits';
97
+ const argumentsTypes = [
98
+ null
99
+ ];
100
+ const parameterNames = ["self"];
101
+ return (tx) => tx.moveCall({
102
+ package: packageAddress,
103
+ module: 'composition_credits',
104
+ function: 'credits',
105
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
106
+ typeArguments: options.typeArguments
107
+ });
108
+ }
109
+ //# sourceMappingURL=composition_credits.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"composition_credits.js","sourceRoot":"","sources":["../../../src/contracts/composition_credits/composition_credits.ts"],"names":[],"mappings":"AAAA;;gEAEgE;AAGhE;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,sBAAsB,EAA+B,MAAM,mBAAmB,CAAC;AAC/G,OAAO,EAAE,GAAG,EAAE,MAAM,iBAAiB,CAAC;AACtC,OAAO,EAA8C,MAAM,0BAA0B,CAAC;AACtF,OAAO,KAAK,OAAO,MAAM,uBAAuB,CAAC;AACjD,OAAO,KAAK,MAAM,MAAM,8BAA8B,CAAC;AACvD,OAAO,KAAK,sBAAsB,MAAM,6BAA6B,CAAC;AACtE,MAAM,WAAW,G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