@misofm/sdk 0.1.1 → 0.2.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.
Files changed (166) hide show
  1. package/README.md +138 -10
  2. package/dist/contracts/composition_credits/composition_credits.d.ts +181 -0
  3. package/dist/contracts/composition_credits/composition_credits.d.ts.map +1 -0
  4. package/dist/contracts/composition_credits/composition_credits.js +109 -0
  5. package/dist/contracts/composition_credits/composition_credits.js.map +1 -0
  6. package/dist/contracts/composition_credits/composition_party_role.d.ts +119 -0
  7. package/dist/contracts/composition_credits/composition_party_role.d.ts.map +1 -0
  8. package/dist/contracts/composition_credits/composition_party_role.js +139 -0
  9. package/dist/contracts/composition_credits/composition_party_role.js.map +1 -0
  10. package/dist/contracts/composition_credits/deps/miso_credit/credit.d.ts +24 -0
  11. package/dist/contracts/composition_credits/deps/miso_credit/credit.d.ts.map +1 -0
  12. package/dist/contracts/composition_credits/deps/miso_credit/credit.js +23 -0
  13. package/dist/contracts/composition_credits/deps/miso_credit/credit.js.map +1 -0
  14. package/dist/contracts/composition_credits/deps/sui/vec_map.d.ts +37 -0
  15. package/dist/contracts/composition_credits/deps/sui/vec_map.d.ts.map +1 -0
  16. package/dist/contracts/composition_credits/deps/sui/vec_map.js +28 -0
  17. package/dist/contracts/composition_credits/deps/sui/vec_map.js.map +1 -0
  18. package/dist/contracts/composition_royalty_pool/composition_royalty_pool.d.ts +87 -0
  19. package/dist/contracts/composition_royalty_pool/composition_royalty_pool.d.ts.map +1 -0
  20. package/dist/contracts/composition_royalty_pool/composition_royalty_pool.js +80 -0
  21. package/dist/contracts/composition_royalty_pool/composition_royalty_pool.js.map +1 -0
  22. package/dist/contracts/cover_art/cover_art.d.ts +85 -0
  23. package/dist/contracts/cover_art/cover_art.d.ts.map +1 -0
  24. package/dist/contracts/cover_art/cover_art.js +68 -0
  25. package/dist/contracts/cover_art/cover_art.js.map +1 -0
  26. package/dist/contracts/cover_art/deps/ori/walrus_data.d.ts +52 -0
  27. package/dist/contracts/cover_art/deps/ori/walrus_data.d.ts.map +1 -0
  28. package/dist/contracts/cover_art/deps/ori/walrus_data.js +37 -0
  29. package/dist/contracts/cover_art/deps/ori/walrus_data.js.map +1 -0
  30. package/dist/contracts/recording_credits/deps/miso_credit/credit.d.ts +24 -0
  31. package/dist/contracts/recording_credits/deps/miso_credit/credit.d.ts.map +1 -0
  32. package/dist/contracts/recording_credits/deps/miso_credit/credit.js +23 -0
  33. package/dist/contracts/recording_credits/deps/miso_credit/credit.js.map +1 -0
  34. package/dist/contracts/recording_credits/deps/sui/vec_map.d.ts +37 -0
  35. package/dist/contracts/recording_credits/deps/sui/vec_map.d.ts.map +1 -0
  36. package/dist/contracts/recording_credits/deps/sui/vec_map.js +28 -0
  37. package/dist/contracts/recording_credits/deps/sui/vec_map.js.map +1 -0
  38. package/dist/contracts/recording_credits/deps/sui/vec_set.d.ts +21 -0
  39. package/dist/contracts/recording_credits/deps/sui/vec_set.d.ts.map +1 -0
  40. package/dist/contracts/recording_credits/deps/sui/vec_set.js +20 -0
  41. package/dist/contracts/recording_credits/deps/sui/vec_set.js.map +1 -0
  42. package/dist/contracts/recording_credits/recording_credits.d.ts +2313 -0
  43. package/dist/contracts/recording_credits/recording_credits.d.ts.map +1 -0
  44. package/dist/contracts/recording_credits/recording_credits.js +270 -0
  45. package/dist/contracts/recording_credits/recording_credits.js.map +1 -0
  46. package/dist/contracts/recording_credits/recording_party_role.d.ts +1174 -0
  47. package/dist/contracts/recording_credits/recording_party_role.d.ts.map +1 -0
  48. package/dist/contracts/recording_credits/recording_party_role.js +692 -0
  49. package/dist/contracts/recording_credits/recording_party_role.js.map +1 -0
  50. package/dist/contracts/recording_royalty_pool/recording_royalty_pool.d.ts +90 -0
  51. package/dist/contracts/recording_royalty_pool/recording_royalty_pool.d.ts.map +1 -0
  52. package/dist/contracts/recording_royalty_pool/recording_royalty_pool.js +80 -0
  53. package/dist/contracts/recording_royalty_pool/recording_royalty_pool.js.map +1 -0
  54. package/dist/contracts/release_cover_art/deps/0x340057f2174fb59e4626742dd2b46c662237837b6187450cb59e4976ce7eac78/walrus_data.d.ts +52 -0
  55. package/dist/contracts/release_cover_art/deps/0x340057f2174fb59e4626742dd2b46c662237837b6187450cb59e4976ce7eac78/walrus_data.d.ts.map +1 -0
  56. package/dist/contracts/release_cover_art/deps/0x340057f2174fb59e4626742dd2b46c662237837b6187450cb59e4976ce7eac78/walrus_data.js +37 -0
  57. package/dist/contracts/release_cover_art/deps/0x340057f2174fb59e4626742dd2b46c662237837b6187450cb59e4976ce7eac78/walrus_data.js.map +1 -0
  58. package/dist/contracts/release_cover_art/deps/cover_art/cover_art.d.ts +46 -0
  59. package/dist/contracts/release_cover_art/deps/cover_art/cover_art.d.ts.map +1 -0
  60. package/dist/contracts/release_cover_art/deps/cover_art/cover_art.js +21 -0
  61. package/dist/contracts/release_cover_art/deps/cover_art/cover_art.js.map +1 -0
  62. package/dist/contracts/release_cover_art/deps/per_track/per_track.d.ts +33 -0
  63. package/dist/contracts/release_cover_art/deps/per_track/per_track.d.ts.map +1 -0
  64. package/dist/contracts/release_cover_art/deps/per_track/per_track.js +32 -0
  65. package/dist/contracts/release_cover_art/deps/per_track/per_track.js.map +1 -0
  66. package/dist/contracts/release_cover_art/release_cover_art.d.ts +300 -0
  67. package/dist/contracts/release_cover_art/release_cover_art.d.ts.map +1 -0
  68. package/dist/contracts/release_cover_art/release_cover_art.js +168 -0
  69. package/dist/contracts/release_cover_art/release_cover_art.js.map +1 -0
  70. package/dist/contracts/release_credits/deps/miso_credit/credit.d.ts +24 -0
  71. package/dist/contracts/release_credits/deps/miso_credit/credit.d.ts.map +1 -0
  72. package/dist/contracts/release_credits/deps/miso_credit/credit.js +23 -0
  73. package/dist/contracts/release_credits/deps/miso_credit/credit.js.map +1 -0
  74. package/dist/contracts/release_credits/deps/sui/vec_map.d.ts +37 -0
  75. package/dist/contracts/release_credits/deps/sui/vec_map.d.ts.map +1 -0
  76. package/dist/contracts/release_credits/deps/sui/vec_map.js +28 -0
  77. package/dist/contracts/release_credits/deps/sui/vec_map.js.map +1 -0
  78. package/dist/contracts/release_credits/release_credits.d.ts +142 -0
  79. package/dist/contracts/release_credits/release_credits.d.ts.map +1 -0
  80. package/dist/contracts/release_credits/release_credits.js +108 -0
  81. package/dist/contracts/release_credits/release_credits.js.map +1 -0
  82. package/dist/contracts/release_credits/release_party_role.d.ts +58 -0
  83. package/dist/contracts/release_credits/release_party_role.d.ts.map +1 -0
  84. package/dist/contracts/release_credits/release_party_role.js +66 -0
  85. package/dist/contracts/release_credits/release_party_role.js.map +1 -0
  86. package/dist/contracts/royalty_pool/deps/std/type_name.d.ts +18 -0
  87. package/dist/contracts/royalty_pool/deps/std/type_name.d.ts.map +1 -0
  88. package/dist/contracts/royalty_pool/deps/std/type_name.js +20 -0
  89. package/dist/contracts/royalty_pool/deps/std/type_name.js.map +1 -0
  90. package/dist/contracts/royalty_pool/deps/sui/balance.d.ts +13 -0
  91. package/dist/contracts/royalty_pool/deps/sui/balance.d.ts.map +1 -0
  92. package/dist/contracts/royalty_pool/deps/sui/balance.js +15 -0
  93. package/dist/contracts/royalty_pool/deps/sui/balance.js.map +1 -0
  94. package/dist/contracts/royalty_pool/deps/sui/vec_map.d.ts +37 -0
  95. package/dist/contracts/royalty_pool/deps/sui/vec_map.d.ts.map +1 -0
  96. package/dist/contracts/royalty_pool/deps/sui/vec_map.js +28 -0
  97. package/dist/contracts/royalty_pool/deps/sui/vec_map.js.map +1 -0
  98. package/dist/contracts/royalty_pool/pool.d.ts +358 -0
  99. package/dist/contracts/royalty_pool/pool.d.ts.map +1 -0
  100. package/dist/contracts/royalty_pool/pool.js +352 -0
  101. package/dist/contracts/royalty_pool/pool.js.map +1 -0
  102. package/dist/contracts/royalty_pool/stake.d.ts +202 -0
  103. package/dist/contracts/royalty_pool/stake.d.ts.map +1 -0
  104. package/dist/contracts/royalty_pool/stake.js +197 -0
  105. package/dist/contracts/royalty_pool/stake.js.map +1 -0
  106. package/dist/contracts.d.ts +16 -0
  107. package/dist/contracts.d.ts.map +1 -0
  108. package/dist/contracts.js +29 -0
  109. package/dist/contracts.js.map +1 -0
  110. package/dist/cover.d.ts +48 -0
  111. package/dist/cover.d.ts.map +1 -0
  112. package/dist/cover.js +68 -0
  113. package/dist/cover.js.map +1 -0
  114. package/dist/credits.d.ts +171 -0
  115. package/dist/credits.d.ts.map +1 -0
  116. package/dist/credits.js +360 -0
  117. package/dist/credits.js.map +1 -0
  118. package/dist/extensions/royalty-pool.d.ts +32 -0
  119. package/dist/extensions/royalty-pool.d.ts.map +1 -0
  120. package/dist/extensions/royalty-pool.js +33 -0
  121. package/dist/extensions/royalty-pool.js.map +1 -0
  122. package/dist/index.d.ts +4 -0
  123. package/dist/index.d.ts.map +1 -1
  124. package/dist/index.js +17 -3
  125. package/dist/index.js.map +1 -1
  126. package/dist/internal.d.ts +4 -0
  127. package/dist/internal.d.ts.map +1 -0
  128. package/dist/internal.js +18 -0
  129. package/dist/internal.js.map +1 -0
  130. package/dist/release-graph.d.ts.map +1 -1
  131. package/dist/release-graph.js +5 -4
  132. package/dist/release-graph.js.map +1 -1
  133. package/package.json +14 -2
  134. package/src/contracts/composition_credits/composition_credits.ts +169 -0
  135. package/src/contracts/composition_credits/composition_party_role.ts +189 -0
  136. package/src/contracts/composition_credits/deps/miso_credit/credit.ts +27 -0
  137. package/src/contracts/composition_credits/deps/sui/vec_map.ts +33 -0
  138. package/src/contracts/composition_royalty_pool/composition_royalty_pool.ts +135 -0
  139. package/src/contracts/cover_art/cover_art.ts +99 -0
  140. package/src/contracts/cover_art/deps/ori/walrus_data.ts +36 -0
  141. package/src/contracts/recording_credits/deps/miso_credit/credit.ts +27 -0
  142. package/src/contracts/recording_credits/deps/sui/vec_map.ts +33 -0
  143. package/src/contracts/recording_credits/deps/sui/vec_set.ts +21 -0
  144. package/src/contracts/recording_credits/recording_credits.ts +458 -0
  145. package/src/contracts/recording_credits/recording_party_role.ts +1041 -0
  146. package/src/contracts/recording_royalty_pool/recording_royalty_pool.ts +138 -0
  147. package/src/contracts/release_cover_art/deps/0x340057f2174fb59e4626742dd2b46c662237837b6187450cb59e4976ce7eac78/walrus_data.ts +36 -0
  148. package/src/contracts/release_cover_art/deps/cover_art/cover_art.ts +23 -0
  149. package/src/contracts/release_cover_art/deps/per_track/per_track.ts +36 -0
  150. package/src/contracts/release_cover_art/release_cover_art.ts +251 -0
  151. package/src/contracts/release_credits/deps/miso_credit/credit.ts +27 -0
  152. package/src/contracts/release_credits/deps/sui/vec_map.ts +33 -0
  153. package/src/contracts/release_credits/release_credits.ts +156 -0
  154. package/src/contracts/release_credits/release_party_role.ts +87 -0
  155. package/src/contracts/royalty_pool/deps/std/type_name.ts +22 -0
  156. package/src/contracts/royalty_pool/deps/sui/balance.ts +17 -0
  157. package/src/contracts/royalty_pool/deps/sui/vec_map.ts +33 -0
  158. package/src/contracts/royalty_pool/pool.ts +577 -0
  159. package/src/contracts/royalty_pool/stake.ts +317 -0
  160. package/src/contracts.ts +33 -0
  161. package/src/cover.ts +140 -0
  162. package/src/credits.ts +651 -0
  163. package/src/extensions/royalty-pool.ts +90 -0
  164. package/src/index.ts +19 -3
  165. package/src/internal.ts +19 -0
  166. package/src/release-graph.ts +5 -10
@@ -0,0 +1,90 @@
1
+ // Copyright (c) Miso Labs, Inc.
2
+ // SPDX-License-Identifier: Apache-2.0
3
+
4
+ // First-party royalty-pool extension.
5
+ //
6
+ // A RoyaltyPool<Share, Currency> is an accumulator-based royalty-distribution pool
7
+ // bound to a composition or recording. It is created via the work's admin-gated
8
+ // `uid_mut(&AdminCap)` derived-object hook (`initialize_pool`), then shared
9
+ // (`pool::share`). Because `initialize_pool` borrows the work `&mut` (and the cap
10
+ // `&`) — not a shared on-chain input — it composes INSIDE the work's publish PTB:
11
+ // run it after `createComposition`/`createRecording` and before `finalize*` (which
12
+ // consumes the work into `share_object` and transfers the cap to the owner).
13
+ //
14
+ // Scope here is create + share only. Stake registration, funding (receive/redeem/
15
+ // deposit), and claiming are later owner/holder actions, not part of publishing.
16
+ //
17
+ // The work being extended (`composition`/`recording`) is a protocol object built
18
+ // by `@misonetwork/sdk`'s `createComposition`/`createRecording`; only the pool
19
+ // hung off it is ours. That is the whole reason this module lives on the platform
20
+ // side of the split — the protocol defines the `uid_mut` hook, not what to attach.
21
+
22
+ import type { Transaction, TransactionObjectArgument } from "@mysten/sui/transactions";
23
+ import * as compositionRoyaltyPool from "../contracts/composition_royalty_pool/composition_royalty_pool.ts";
24
+ import * as recordingRoyaltyPool from "../contracts/recording_royalty_pool/recording_royalty_pool.ts";
25
+ import * as pool from "../contracts/royalty_pool/pool.ts";
26
+
27
+ export interface AttachCompositionRoyaltyPoolParams {
28
+ /** The Composition — an in-PTB `createComposition` result, borrowed `&mut`. */
29
+ composition: TransactionObjectArgument;
30
+ /** The CompositionAdminCap, borrowed `&`. */
31
+ adminCap: TransactionObjectArgument;
32
+ /** The composition's share type (the pool's `Share` phantom = CompositionShare). */
33
+ compositionShareType: string;
34
+ /** Fully-qualified coin type the pool accumulates (the `Currency` phantom). */
35
+ currency: string;
36
+ compositionRoyaltyPoolPackageId: string;
37
+ royaltyPoolPackageId: string;
38
+ }
39
+
40
+ /** Creates a royalty pool for a composition and shares it, appending to `tx`. */
41
+ export function attachCompositionRoyaltyPool(tx: Transaction, params: AttachCompositionRoyaltyPoolParams): void {
42
+ const created = tx.add(
43
+ compositionRoyaltyPool.initializePool({
44
+ package: params.compositionRoyaltyPoolPackageId,
45
+ typeArguments: [params.compositionShareType, params.currency],
46
+ arguments: [params.composition, params.adminCap],
47
+ }),
48
+ );
49
+ tx.add(
50
+ pool.share({
51
+ package: params.royaltyPoolPackageId,
52
+ typeArguments: [params.compositionShareType, params.currency],
53
+ arguments: [created],
54
+ }),
55
+ );
56
+ }
57
+
58
+ export interface AttachRecordingRoyaltyPoolParams {
59
+ /** The Recording — an in-PTB `createRecording` result, borrowed `&mut`. */
60
+ recording: TransactionObjectArgument;
61
+ /** The RecordingAdminCap, borrowed `&`. */
62
+ adminCap: TransactionObjectArgument;
63
+ /** The recording's own share type (the pool's `Share` phantom = RecordingShare). */
64
+ recordingShareType: string;
65
+ /** The parent composition's share type (the recording's `CompositionShare` phantom). */
66
+ compositionShareType: string;
67
+ /** Fully-qualified coin type the pool accumulates (the `Currency` phantom). */
68
+ currency: string;
69
+ recordingRoyaltyPoolPackageId: string;
70
+ royaltyPoolPackageId: string;
71
+ }
72
+
73
+ /** Creates a royalty pool for a recording and shares it, appending to `tx`. */
74
+ export function attachRecordingRoyaltyPool(tx: Transaction, params: AttachRecordingRoyaltyPoolParams): void {
75
+ const created = tx.add(
76
+ recordingRoyaltyPool.initializePool({
77
+ package: params.recordingRoyaltyPoolPackageId,
78
+ typeArguments: [params.recordingShareType, params.compositionShareType, params.currency],
79
+ arguments: [params.recording, params.adminCap],
80
+ }),
81
+ );
82
+ // The pool is RoyaltyPool<RecordingShare, Currency> — Share is the recording's own share type.
83
+ tx.add(
84
+ pool.share({
85
+ package: params.royaltyPoolPackageId,
86
+ typeArguments: [params.recordingShareType, params.currency],
87
+ arguments: [created],
88
+ }),
89
+ );
90
+ }
package/src/index.ts CHANGED
@@ -8,13 +8,20 @@
8
8
  //
9
9
  // @misonetwork/* PROTOCOL — Composition, Recording, Release. The open layer
10
10
  // anyone can build on, and nobody needs Miso's permission to use.
11
- // @misofm/* PLATFORM — Pressing, Listing, Record. How MISO sells copies of
12
- // a release: the production line, its currencies, and the record
13
- // a buyer walks away with.
11
+ // @misofm/* PLATFORM — Pressing, Listing, Record, and the first-party
12
+ // EXTENSIONS. How MISO sells copies of a release, and the
13
+ // opinions it attaches to a work along the way.
14
14
  //
15
15
  // A release is protocol. Pressing a record off it and selling that record is
16
16
  // platform. Keeping the split at the package boundary is what stops the protocol
17
17
  // from quietly growing a storefront.
18
+ //
19
+ // Extensions live on this side of the line for the same reason. An extension is
20
+ // not part of what a Composition or Recording IS — it is a choice Miso makes
21
+ // about how to describe one (who gets credited and in what vocabulary, what the
22
+ // cover looks like, whether royalties accumulate in a pool). The protocol gives
23
+ // extensions a `&mut UID` hook and stops there; every opinion about what to hang
24
+ // off it is business logic, and business logic ships from the platform package.
18
25
 
19
26
  // The recommended entry point is the client extension (see ./client.ts); the bare
20
27
  // builders and readers stay exported for callers that hold ids themselves.
@@ -27,3 +34,12 @@ export * from "./share.ts";
27
34
  export * from "./share-template.ts";
28
35
  export * from "./release-graph.ts";
29
36
  export * from "./catalog.ts";
37
+
38
+ // First-party extensions — attached to a protocol work via its cap-gated
39
+ // `uid_mut` hook.
40
+ export * from "./credits.ts";
41
+ export * from "./cover.ts";
42
+ export * from "./extensions/royalty-pool.ts";
43
+
44
+ // Generated, ABI-bound bindings (BCS structs + type-safe Move calls).
45
+ export * as contracts from "./contracts.ts";
@@ -0,0 +1,19 @@
1
+ // Copyright (c) Miso Labs, Inc.
2
+ // SPDX-License-Identifier: Apache-2.0
3
+
4
+ // Internal shared helpers (deliberately NOT exported from the package root).
5
+ //
6
+ // PTB building blocks — the `0x1::option` move-call targets used when a generated
7
+ // call needs an `Option` argument built inline. Consumed by `./cover` and
8
+ // `./credits`.
9
+ //
10
+ // These came over from `@misonetwork/sdk`'s own private `internal.ts` when the
11
+ // extension surface moved here. They were NOT promoted to that package's public
12
+ // API to make them reachable: they are two literal Move function targets from the
13
+ // standard library, so re-deriving them costs nothing, whereas exporting them
14
+ // would widen the protocol SDK's public surface — and therefore its compatibility
15
+ // promise — for no benefit.
16
+
17
+ /** `0x1::option::none` / `0x1::option::some` moveCall targets. */
18
+ export const OPTION_NONE = "0x1::option::none";
19
+ export const OPTION_SOME = "0x1::option::some";
@@ -22,18 +22,13 @@
22
22
  //
23
23
  // This is the whole-graph orchestration half of the opinionated publish flow —
24
24
  // it composes `@misonetwork/sdk`'s bare `composition`/`recording`/`deal`/`track`/
25
- // `release` call bindings, its `createRelease` primitive and
26
- // `attachCompositionRoyaltyPool`/`attachRecordingRoyaltyPool`, plus this
27
- // package's own `disperseShares`/`finalizeRelease`, into one PTB.
25
+ // `release` call bindings and its `createRelease` primitive with this package's
26
+ // own `disperseShares`/`finalizeRelease` and royalty-pool extension helpers, into
27
+ // one PTB.
28
28
 
29
29
  import { Transaction, type TransactionObjectArgument } from "@mysten/sui/transactions";
30
- import {
31
- contracts,
32
- attachCompositionRoyaltyPool,
33
- attachRecordingRoyaltyPool,
34
- createRelease,
35
- PROTOCOL_MAX_ROYALTY_RATE_BPS,
36
- } from "@misonetwork/sdk";
30
+ import { contracts, createRelease, PROTOCOL_MAX_ROYALTY_RATE_BPS } from "@misonetwork/sdk";
31
+ import { attachCompositionRoyaltyPool, attachRecordingRoyaltyPool } from "./extensions/royalty-pool.ts";
37
32
  import { disperseShares, finalizeRelease, type ShareRecipient } from "./transactions.ts";
38
33
 
39
34
  const { composition, recording, deal, track, release } = contracts;