@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.
Files changed (238) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +644 -0
  3. package/dist/client.d.ts +197 -0
  4. package/dist/client.d.ts.map +1 -0
  5. package/dist/client.js +218 -0
  6. package/dist/client.js.map +1 -0
  7. package/dist/contracts/composition_credits/composition_credits.d.ts +181 -0
  8. package/dist/contracts/composition_credits/composition_credits.d.ts.map +1 -0
  9. package/dist/contracts/composition_credits/composition_credits.js +109 -0
  10. package/dist/contracts/composition_credits/composition_credits.js.map +1 -0
  11. package/dist/contracts/composition_credits/composition_party_role.d.ts +119 -0
  12. package/dist/contracts/composition_credits/composition_party_role.d.ts.map +1 -0
  13. package/dist/contracts/composition_credits/composition_party_role.js +139 -0
  14. package/dist/contracts/composition_credits/composition_party_role.js.map +1 -0
  15. package/dist/contracts/composition_credits/deps/miso_credit/credit.d.ts +24 -0
  16. package/dist/contracts/composition_credits/deps/miso_credit/credit.d.ts.map +1 -0
  17. package/dist/contracts/composition_credits/deps/miso_credit/credit.js +23 -0
  18. package/dist/contracts/composition_credits/deps/miso_credit/credit.js.map +1 -0
  19. package/dist/contracts/composition_credits/deps/sui/vec_map.d.ts +37 -0
  20. package/dist/contracts/composition_credits/deps/sui/vec_map.d.ts.map +1 -0
  21. package/dist/contracts/composition_credits/deps/sui/vec_map.js +28 -0
  22. package/dist/contracts/composition_credits/deps/sui/vec_map.js.map +1 -0
  23. package/dist/contracts/composition_royalty_pool/composition_royalty_pool.d.ts +87 -0
  24. package/dist/contracts/composition_royalty_pool/composition_royalty_pool.d.ts.map +1 -0
  25. package/dist/contracts/composition_royalty_pool/composition_royalty_pool.js +80 -0
  26. package/dist/contracts/composition_royalty_pool/composition_royalty_pool.js.map +1 -0
  27. package/dist/contracts/cover_art/cover_art.d.ts +85 -0
  28. package/dist/contracts/cover_art/cover_art.d.ts.map +1 -0
  29. package/dist/contracts/cover_art/cover_art.js +68 -0
  30. package/dist/contracts/cover_art/cover_art.js.map +1 -0
  31. package/dist/contracts/cover_art/deps/ori/walrus_data.d.ts +52 -0
  32. package/dist/contracts/cover_art/deps/ori/walrus_data.d.ts.map +1 -0
  33. package/dist/contracts/cover_art/deps/ori/walrus_data.js +37 -0
  34. package/dist/contracts/cover_art/deps/ori/walrus_data.js.map +1 -0
  35. package/dist/contracts/miso/composition.d.ts +231 -0
  36. package/dist/contracts/miso/composition.d.ts.map +1 -0
  37. package/dist/contracts/miso/composition.js +231 -0
  38. package/dist/contracts/miso/composition.js.map +1 -0
  39. package/dist/contracts/miso/deal.d.ts +184 -0
  40. package/dist/contracts/miso/deal.d.ts.map +1 -0
  41. package/dist/contracts/miso/deal.js +184 -0
  42. package/dist/contracts/miso/deal.js.map +1 -0
  43. package/dist/contracts/miso/deps/bps/bps.d.ts +19 -0
  44. package/dist/contracts/miso/deps/bps/bps.d.ts.map +1 -0
  45. package/dist/contracts/miso/deps/bps/bps.js +21 -0
  46. package/dist/contracts/miso/deps/bps/bps.js.map +1 -0
  47. package/dist/contracts/miso/recording.d.ts +228 -0
  48. package/dist/contracts/miso/recording.d.ts.map +1 -0
  49. package/dist/contracts/miso/recording.js +221 -0
  50. package/dist/contracts/miso/recording.js.map +1 -0
  51. package/dist/contracts/miso/release.d.ts +280 -0
  52. package/dist/contracts/miso/release.d.ts.map +1 -0
  53. package/dist/contracts/miso/release.js +282 -0
  54. package/dist/contracts/miso/release.js.map +1 -0
  55. package/dist/contracts/miso/track.d.ts +118 -0
  56. package/dist/contracts/miso/track.d.ts.map +1 -0
  57. package/dist/contracts/miso/track.js +118 -0
  58. package/dist/contracts/miso/track.js.map +1 -0
  59. package/dist/contracts/recording_credits/deps/miso_credit/credit.d.ts +24 -0
  60. package/dist/contracts/recording_credits/deps/miso_credit/credit.d.ts.map +1 -0
  61. package/dist/contracts/recording_credits/deps/miso_credit/credit.js +23 -0
  62. package/dist/contracts/recording_credits/deps/miso_credit/credit.js.map +1 -0
  63. package/dist/contracts/recording_credits/deps/sui/vec_map.d.ts +37 -0
  64. package/dist/contracts/recording_credits/deps/sui/vec_map.d.ts.map +1 -0
  65. package/dist/contracts/recording_credits/deps/sui/vec_map.js +28 -0
  66. package/dist/contracts/recording_credits/deps/sui/vec_map.js.map +1 -0
  67. package/dist/contracts/recording_credits/deps/sui/vec_set.d.ts +21 -0
  68. package/dist/contracts/recording_credits/deps/sui/vec_set.d.ts.map +1 -0
  69. package/dist/contracts/recording_credits/deps/sui/vec_set.js +20 -0
  70. package/dist/contracts/recording_credits/deps/sui/vec_set.js.map +1 -0
  71. package/dist/contracts/recording_credits/recording_credits.d.ts +2313 -0
  72. package/dist/contracts/recording_credits/recording_credits.d.ts.map +1 -0
  73. package/dist/contracts/recording_credits/recording_credits.js +270 -0
  74. package/dist/contracts/recording_credits/recording_credits.js.map +1 -0
  75. package/dist/contracts/recording_credits/recording_party_role.d.ts +1174 -0
  76. package/dist/contracts/recording_credits/recording_party_role.d.ts.map +1 -0
  77. package/dist/contracts/recording_credits/recording_party_role.js +692 -0
  78. package/dist/contracts/recording_credits/recording_party_role.js.map +1 -0
  79. package/dist/contracts/recording_royalty_pool/recording_royalty_pool.d.ts +90 -0
  80. package/dist/contracts/recording_royalty_pool/recording_royalty_pool.d.ts.map +1 -0
  81. package/dist/contracts/recording_royalty_pool/recording_royalty_pool.js +80 -0
  82. package/dist/contracts/recording_royalty_pool/recording_royalty_pool.js.map +1 -0
  83. package/dist/contracts/release_cover_art/deps/0x340057f2174fb59e4626742dd2b46c662237837b6187450cb59e4976ce7eac78/walrus_data.d.ts +52 -0
  84. package/dist/contracts/release_cover_art/deps/0x340057f2174fb59e4626742dd2b46c662237837b6187450cb59e4976ce7eac78/walrus_data.d.ts.map +1 -0
  85. package/dist/contracts/release_cover_art/deps/0x340057f2174fb59e4626742dd2b46c662237837b6187450cb59e4976ce7eac78/walrus_data.js +37 -0
  86. package/dist/contracts/release_cover_art/deps/0x340057f2174fb59e4626742dd2b46c662237837b6187450cb59e4976ce7eac78/walrus_data.js.map +1 -0
  87. package/dist/contracts/release_cover_art/deps/cover_art/cover_art.d.ts +46 -0
  88. package/dist/contracts/release_cover_art/deps/cover_art/cover_art.d.ts.map +1 -0
  89. package/dist/contracts/release_cover_art/deps/cover_art/cover_art.js +21 -0
  90. package/dist/contracts/release_cover_art/deps/cover_art/cover_art.js.map +1 -0
  91. package/dist/contracts/release_cover_art/deps/per_track/per_track.d.ts +33 -0
  92. package/dist/contracts/release_cover_art/deps/per_track/per_track.d.ts.map +1 -0
  93. package/dist/contracts/release_cover_art/deps/per_track/per_track.js +32 -0
  94. package/dist/contracts/release_cover_art/deps/per_track/per_track.js.map +1 -0
  95. package/dist/contracts/release_cover_art/release_cover_art.d.ts +300 -0
  96. package/dist/contracts/release_cover_art/release_cover_art.d.ts.map +1 -0
  97. package/dist/contracts/release_cover_art/release_cover_art.js +168 -0
  98. package/dist/contracts/release_cover_art/release_cover_art.js.map +1 -0
  99. package/dist/contracts/release_credits/deps/miso_credit/credit.d.ts +24 -0
  100. package/dist/contracts/release_credits/deps/miso_credit/credit.d.ts.map +1 -0
  101. package/dist/contracts/release_credits/deps/miso_credit/credit.js +23 -0
  102. package/dist/contracts/release_credits/deps/miso_credit/credit.js.map +1 -0
  103. package/dist/contracts/release_credits/deps/sui/vec_map.d.ts +37 -0
  104. package/dist/contracts/release_credits/deps/sui/vec_map.d.ts.map +1 -0
  105. package/dist/contracts/release_credits/deps/sui/vec_map.js +28 -0
  106. package/dist/contracts/release_credits/deps/sui/vec_map.js.map +1 -0
  107. package/dist/contracts/release_credits/release_credits.d.ts +142 -0
  108. package/dist/contracts/release_credits/release_credits.d.ts.map +1 -0
  109. package/dist/contracts/release_credits/release_credits.js +108 -0
  110. package/dist/contracts/release_credits/release_credits.js.map +1 -0
  111. package/dist/contracts/release_credits/release_party_role.d.ts +58 -0
  112. package/dist/contracts/release_credits/release_party_role.d.ts.map +1 -0
  113. package/dist/contracts/release_credits/release_party_role.js +66 -0
  114. package/dist/contracts/release_credits/release_party_role.js.map +1 -0
  115. package/dist/contracts/royalty_pool/deps/std/type_name.d.ts +18 -0
  116. package/dist/contracts/royalty_pool/deps/std/type_name.d.ts.map +1 -0
  117. package/dist/contracts/royalty_pool/deps/std/type_name.js +20 -0
  118. package/dist/contracts/royalty_pool/deps/std/type_name.js.map +1 -0
  119. package/dist/contracts/royalty_pool/deps/sui/balance.d.ts +13 -0
  120. package/dist/contracts/royalty_pool/deps/sui/balance.d.ts.map +1 -0
  121. package/dist/contracts/royalty_pool/deps/sui/balance.js +15 -0
  122. package/dist/contracts/royalty_pool/deps/sui/balance.js.map +1 -0
  123. package/dist/contracts/royalty_pool/deps/sui/vec_map.d.ts +37 -0
  124. package/dist/contracts/royalty_pool/deps/sui/vec_map.d.ts.map +1 -0
  125. package/dist/contracts/royalty_pool/deps/sui/vec_map.js +28 -0
  126. package/dist/contracts/royalty_pool/deps/sui/vec_map.js.map +1 -0
  127. package/dist/contracts/royalty_pool/pool.d.ts +358 -0
  128. package/dist/contracts/royalty_pool/pool.d.ts.map +1 -0
  129. package/dist/contracts/royalty_pool/pool.js +352 -0
  130. package/dist/contracts/royalty_pool/pool.js.map +1 -0
  131. package/dist/contracts/royalty_pool/stake.d.ts +202 -0
  132. package/dist/contracts/royalty_pool/stake.d.ts.map +1 -0
  133. package/dist/contracts/royalty_pool/stake.js +197 -0
  134. package/dist/contracts/royalty_pool/stake.js.map +1 -0
  135. package/dist/contracts/utils/index.d.ts +31 -0
  136. package/dist/contracts/utils/index.d.ts.map +1 -0
  137. package/dist/contracts/utils/index.js +162 -0
  138. package/dist/contracts/utils/index.js.map +1 -0
  139. package/dist/contracts.d.ts +18 -0
  140. package/dist/contracts.d.ts.map +1 -0
  141. package/dist/contracts.js +26 -0
  142. package/dist/contracts.js.map +1 -0
  143. package/dist/cover.d.ts +48 -0
  144. package/dist/cover.d.ts.map +1 -0
  145. package/dist/cover.js +68 -0
  146. package/dist/cover.js.map +1 -0
  147. package/dist/credits.d.ts +171 -0
  148. package/dist/credits.d.ts.map +1 -0
  149. package/dist/credits.js +360 -0
  150. package/dist/credits.js.map +1 -0
  151. package/dist/execute.d.ts +49 -0
  152. package/dist/execute.d.ts.map +1 -0
  153. package/dist/execute.js +114 -0
  154. package/dist/execute.js.map +1 -0
  155. package/dist/extensions/royalty-pool.d.ts +32 -0
  156. package/dist/extensions/royalty-pool.d.ts.map +1 -0
  157. package/dist/extensions/royalty-pool.js +33 -0
  158. package/dist/extensions/royalty-pool.js.map +1 -0
  159. package/dist/index.d.ts +13 -0
  160. package/dist/index.d.ts.map +1 -0
  161. package/dist/index.js +16 -0
  162. package/dist/index.js.map +1 -0
  163. package/dist/internal.d.ts +20 -0
  164. package/dist/internal.d.ts.map +1 -0
  165. package/dist/internal.js +48 -0
  166. package/dist/internal.js.map +1 -0
  167. package/dist/parsers.d.ts +9 -0
  168. package/dist/parsers.d.ts.map +1 -0
  169. package/dist/parsers.js +52 -0
  170. package/dist/parsers.js.map +1 -0
  171. package/dist/queries.d.ts +105 -0
  172. package/dist/queries.d.ts.map +1 -0
  173. package/dist/queries.js +380 -0
  174. package/dist/queries.js.map +1 -0
  175. package/dist/schemas.d.ts +99 -0
  176. package/dist/schemas.d.ts.map +1 -0
  177. package/dist/schemas.js +76 -0
  178. package/dist/schemas.js.map +1 -0
  179. package/dist/transactions.d.ts +158 -0
  180. package/dist/transactions.d.ts.map +1 -0
  181. package/dist/transactions.js +154 -0
  182. package/dist/transactions.js.map +1 -0
  183. package/dist/types.d.ts +204 -0
  184. package/dist/types.d.ts.map +1 -0
  185. package/dist/types.js +4 -0
  186. package/dist/types.js.map +1 -0
  187. package/dist/view.d.ts +21 -0
  188. package/dist/view.d.ts.map +1 -0
  189. package/dist/view.js +36 -0
  190. package/dist/view.js.map +1 -0
  191. package/package.json +111 -0
  192. package/src/client.ts +278 -0
  193. package/src/contracts/composition_credits/composition_credits.ts +169 -0
  194. package/src/contracts/composition_credits/composition_party_role.ts +189 -0
  195. package/src/contracts/composition_credits/deps/miso_credit/credit.ts +27 -0
  196. package/src/contracts/composition_credits/deps/sui/vec_map.ts +33 -0
  197. package/src/contracts/composition_royalty_pool/composition_royalty_pool.ts +135 -0
  198. package/src/contracts/cover_art/cover_art.ts +99 -0
  199. package/src/contracts/cover_art/deps/ori/walrus_data.ts +36 -0
  200. package/src/contracts/miso/composition.ts +343 -0
  201. package/src/contracts/miso/deal.ts +257 -0
  202. package/src/contracts/miso/deps/bps/bps.ts +23 -0
  203. package/src/contracts/miso/recording.ts +298 -0
  204. package/src/contracts/miso/release.ts +392 -0
  205. package/src/contracts/miso/track.ts +153 -0
  206. package/src/contracts/recording_credits/deps/miso_credit/credit.ts +27 -0
  207. package/src/contracts/recording_credits/deps/sui/vec_map.ts +33 -0
  208. package/src/contracts/recording_credits/deps/sui/vec_set.ts +21 -0
  209. package/src/contracts/recording_credits/recording_credits.ts +458 -0
  210. package/src/contracts/recording_credits/recording_party_role.ts +1041 -0
  211. package/src/contracts/recording_royalty_pool/recording_royalty_pool.ts +138 -0
  212. package/src/contracts/release_cover_art/deps/0x340057f2174fb59e4626742dd2b46c662237837b6187450cb59e4976ce7eac78/walrus_data.ts +36 -0
  213. package/src/contracts/release_cover_art/deps/cover_art/cover_art.ts +23 -0
  214. package/src/contracts/release_cover_art/deps/per_track/per_track.ts +36 -0
  215. package/src/contracts/release_cover_art/release_cover_art.ts +251 -0
  216. package/src/contracts/release_credits/deps/miso_credit/credit.ts +27 -0
  217. package/src/contracts/release_credits/deps/sui/vec_map.ts +33 -0
  218. package/src/contracts/release_credits/release_credits.ts +156 -0
  219. package/src/contracts/release_credits/release_party_role.ts +87 -0
  220. package/src/contracts/royalty_pool/deps/std/type_name.ts +22 -0
  221. package/src/contracts/royalty_pool/deps/sui/balance.ts +17 -0
  222. package/src/contracts/royalty_pool/deps/sui/vec_map.ts +33 -0
  223. package/src/contracts/royalty_pool/pool.ts +577 -0
  224. package/src/contracts/royalty_pool/stake.ts +317 -0
  225. package/src/contracts/utils/index.ts +229 -0
  226. package/src/contracts.ts +30 -0
  227. package/src/cover.ts +136 -0
  228. package/src/credits.ts +645 -0
  229. package/src/execute.ts +141 -0
  230. package/src/extensions/royalty-pool.ts +85 -0
  231. package/src/index.ts +17 -0
  232. package/src/internal.ts +85 -0
  233. package/src/parsers.ts +80 -0
  234. package/src/queries.ts +478 -0
  235. package/src/schemas.ts +96 -0
  236. package/src/transactions.ts +290 -0
  237. package/src/types.ts +244 -0
  238. package/src/view.ts +59 -0
@@ -0,0 +1,158 @@
1
+ import { Transaction, type TransactionObjectArgument } from "@mysten/sui/transactions";
2
+ /** A thunk that adds commands to a transaction. May be async (resolves at build time). */
3
+ export type TxThunk = (tx: Transaction) => void | Promise<void>;
4
+ /**
5
+ * Share-currency binding for a work: the fully-qualified `share::Share` type, the
6
+ * `Currency<Share>` object, and the `TreasuryCap<Share>`. All three are known once
7
+ * the currency has been published + initialized, so builders take them explicitly
8
+ * rather than reading them from chain — keeping the thunks synchronous and
9
+ * composable (no RPC inside the transaction build).
10
+ */
11
+ export interface ShareCurrencyBinding {
12
+ /** The `${packageId}::share::Share` type. */
13
+ shareType: string;
14
+ /** The `Currency<Share>` object id. */
15
+ shareCurrencyId: string;
16
+ /** The `TreasuryCap<Share>` object id (held by the caller, consumed by `new`). */
17
+ shareTreasuryCapId: string;
18
+ }
19
+ /** The three by-value results of `composition::new`, for threading onward in a PTB. */
20
+ export interface CompositionParts {
21
+ composition: TransactionObjectArgument;
22
+ adminCap: TransactionObjectArgument;
23
+ /** The creator's freshly-minted share supply (a `Balance<Share>`). */
24
+ balance: TransactionObjectArgument;
25
+ }
26
+ export interface CreateCompositionParams extends ShareCurrencyBinding {
27
+ title: string;
28
+ royaltyRateBps: number;
29
+ misoPackageId: string;
30
+ }
31
+ /**
32
+ * PRIMITIVE. Appends `composition::new` and returns its by-value results without
33
+ * dispersing, sharing, or transferring anything — the caller decides what happens
34
+ * next (share it, keep it unshared to bundle with a recording, attach a dynamic
35
+ * field via `uid_mut`, …). Composes with anything in the same PTB.
36
+ */
37
+ export declare function createComposition(tx: Transaction, params: CreateCompositionParams): CompositionParts;
38
+ /** The three by-value results of `recording::new`, for threading onward in a PTB. */
39
+ export interface RecordingParts {
40
+ recording: TransactionObjectArgument;
41
+ adminCap: TransactionObjectArgument;
42
+ /** The creator's remaining share supply after the composition's cut is split off. */
43
+ balance: TransactionObjectArgument;
44
+ }
45
+ /** The protocol's maximum composition royalty rate (`MAX_ROYALTY_RATE_BPS`). */
46
+ export declare const PROTOCOL_MAX_ROYALTY_RATE_BPS = 2000;
47
+ export interface CreateRecordingParams extends ShareCurrencyBinding {
48
+ /** Share type of the parent composition (the recording's `CompositionShare` phantom). */
49
+ compositionShareType: string;
50
+ /**
51
+ * Parent `Composition`, passed by immutable reference (`recording::new` reads only
52
+ * its id + royalty rate). May be an on-chain object (`tx.object(id)`) or a still-
53
+ * unshared, transaction-local `createComposition(...).composition` result.
54
+ */
55
+ composition: TransactionObjectArgument;
56
+ /**
57
+ * Slippage guard: the maximum composition royalty rate (bps) the recorder will
58
+ * grant — `recording::new` aborts if the composition's live rate exceeds it.
59
+ * Pass the rate you observed. Defaults to the protocol maximum (2000), which
60
+ * accepts any legal rate.
61
+ */
62
+ maxRoyaltyRateBps?: number;
63
+ misoPackageId: string;
64
+ }
65
+ /**
66
+ * PRIMITIVE. Appends `recording::new` and returns its by-value results without
67
+ * publishing/dispersing/transferring. Because it borrows the composition by
68
+ * reference, it can run against a composition that is still an unshared PTB-local
69
+ * value — the borrow-before-share pattern that lets a composition + recording share
70
+ * one PTB.
71
+ */
72
+ export declare function createRecording(tx: Transaction, params: CreateRecordingParams): RecordingParts;
73
+ export interface CreateDealParams {
74
+ recordingId: string;
75
+ recordingAdminCapId?: string;
76
+ recordingAdminCap?: TransactionObjectArgument;
77
+ /** Share type of the recording (the deal's `RecordingShare` phantom). */
78
+ recordingShareType: string;
79
+ /** Share type of the parent composition (the deal's `CompositionShare` phantom). */
80
+ compositionShareType: string;
81
+ releaseId: string;
82
+ trackSplitBps: number;
83
+ misoPackageId: string;
84
+ }
85
+ /**
86
+ * PRIMITIVE. Appends `deal::new` and returns the `Deal` by value without routing
87
+ * it anywhere — the caller decides what happens next.
88
+ *
89
+ * LIFECYCLE NOTE — the returned `Deal` MUST be consumed in this same
90
+ * transaction. It is `key, store` with no `drop`, so it cannot be discarded, but
91
+ * it CAN go to either of two places, which is exactly why this does not choose:
92
+ *
93
+ * 1. `tx.transferObjects([deal], recipient)` — send it to whoever is
94
+ * assembling the release, for them to redeem later. This is the
95
+ * cross-party flow: a recording owner signs a deal for someone else's
96
+ * release.
97
+ * 2. straight into `track::new(deal, &recording)` in this same PTB — the
98
+ * same-party flow, where the deal is a transient authorization rather than
99
+ * something anyone holds. `@misofm/sdk`'s `publishReleaseGraph` does this.
100
+ *
101
+ * Both are legitimate, and picking one for the caller would make the other
102
+ * awkward, so the disposition stays with the caller. `@misofm/sdk` layers the
103
+ * opinionated flows on top.
104
+ *
105
+ * The `recordingAdminCap` may be passed as an on-chain object id
106
+ * (`recordingAdminCapId`) or as a PTB-local argument (`recordingAdminCap`) —
107
+ * the latter lets a deal be signed against a recording created earlier in the
108
+ * same transaction, before its cap has been transferred anywhere.
109
+ */
110
+ export declare function createDeal(tx: Transaction, params: CreateDealParams): TransactionObjectArgument;
111
+ export interface RejectDealParams {
112
+ dealId: string;
113
+ /** Share type of the recording (the deal's `RecordingShare` phantom). */
114
+ recordingShareType: string;
115
+ /** Share type of the parent composition (the deal's `CompositionShare` phantom). */
116
+ compositionShareType: string;
117
+ misoPackageId: string;
118
+ }
119
+ /** Rejects (destroys) a deal without including it in a release. Emits `DealRejectedEvent`. */
120
+ export declare function rejectDeal(params: RejectDealParams): TxThunk;
121
+ /** The two by-value results of `release::new`, for threading onward in a PTB. */
122
+ export interface ReleaseParts {
123
+ release: TransactionObjectArgument;
124
+ adminCap: TransactionObjectArgument;
125
+ }
126
+ export interface CreateReleaseParams {
127
+ title: string;
128
+ /** u256 nonce as a decimal string (deterministic release id). */
129
+ nonce: string;
130
+ releaseRegistryId: string;
131
+ misoPackageId: string;
132
+ }
133
+ /**
134
+ * PRIMITIVE. Appends `release::new` over a caller-built `vector<Track>` and
135
+ * returns its by-value results without publishing (sharing) the release or
136
+ * routing the admin cap — the caller decides what happens next. Mirrors
137
+ * {@link createComposition}/{@link createRecording}.
138
+ *
139
+ * `trackVec` is supplied by the caller because track assembly is the part that
140
+ * genuinely varies between release flows: from recording admin caps, from
141
+ * pre-made deals, or from a mix of fresh and existing recordings (see
142
+ * `@misofm/sdk`'s `publishRelease`/`publishReleaseFromDeals`/
143
+ * `publishReleaseGraph`).
144
+ *
145
+ * LIFECYCLE NOTE — the returned `Release` MUST be consumed by
146
+ * `release::publish` in this same transaction. `Release` is `key`-only with no
147
+ * `drop`, and `publish` is its only by-value consumer, so an `Initialized`
148
+ * release cannot be transferred, wrapped, shared, or discarded, and cannot
149
+ * outlive its creating transaction; the protocol deliberately provides no keep
150
+ * function. That is a same-PTB requirement, NOT a same-function one — pairing
151
+ * this with a later `finalizeRelease` command in the same `tx` satisfies it.
152
+ * (`Composition` and `Recording` carry the identical requirement, which is why
153
+ * all three primitives have the same shape.) The admin cap has no such
154
+ * constraint: `ReleaseAdminCap` is `key, store` and `publish` only borrows it,
155
+ * so it is an ordinary transferable value the caller routes as it sees fit.
156
+ */
157
+ export declare function createRelease(tx: Transaction, params: CreateReleaseParams, trackVec: TransactionObjectArgument): ReleaseParts;
158
+ //# sourceMappingURL=transactions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transactions.d.ts","sourceRoot":"","sources":["../src/transactions.ts"],"names":[],"mappings":"AAqCA,OAAO,EAAE,WAAW,EAAE,KAAK,yBAAyB,EAAE,MAAM,0BAA0B,CAAC;AAOvF,0FAA0F;AAC1F,MAAM,MAAM,OAAO,GAAG,CAAC,EAAE,EAAE,WAAW,KAAK,IAAI,GAAG,OAAO,CA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,CAAC,EAAE,MAAM,CAAC;IAC7B,iBAAiB,CAAC,EAAE,yBAAyB,CAAC;IAC9C,yEAAyE;IACzE,kBAAkB,EAAE,MAAM,CAAC;IAC3B,oFAAoF;IACpF,oBAAoB,EAAE,MAAM,CAAC;IAC7B,SAAS,EAAE,MAAM,CAAC;IAClB,aAAa,EAAE,MAAM,CAAC;IACtB,aAAa,EAAE,MAAM,CAAC;CACvB;AAED;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAgB,UAAU,CAAC,EAAE,EAAE,WAAW,EAAE,MAAM,EAAE,gBAAgB,GAAG,yBAAyB,CAiB/F;AAED,MAAM,WAAW,gBAAgB;IAC/B,MAAM,EAAE,MAAM,CAAC;IACf,yEAAyE;IACzE,kBAAkB,EAAE,MAAM,CAAC;IAC3B,oFAAoF;IACpF,oBAAoB,EAAE,MAAM,CAAC;IAC7B,aAAa,EAAE,MAAM,CAAC;CACvB;AAED,8FAA8F;AAC9F,wBAAgB,UAAU,CAAC,MAAM,EAAE,gBAAgB,GAAG,OAAO,CAQ5D;AAMD,iFAAiF;AACjF,MAAM,WAAW,YAAY;IAC3B,OAAO,EAAE,yBAAyB,CAAC;IACnC,QAAQ,EAAE,yBAAyB,CAAC;CACrC;AAED,MAAM,WAAW,mBAAmB;IAClC,KAAK,EAAE,MAAM,CAAC;IACd,iEAAiE;IACjE,KAAK,EAAE,MAAM,CAAC;IACd,iBAAiB,EAAE,MAAM,CAAC;IAC1B,aAAa,EAAE,MAAM,CAAC;CACvB;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,aAAa,CAC3B,EAAE,EAAE,WAAW,EACf,MAAM,EAAE,mBAAmB,EAC3B,QAAQ,EAAE,yBAAyB,GAClC,YAAY,CAQd"}
@@ -0,0 +1,154 @@
1
+ // Copyright (c) Miso Labs, Inc.
2
+ // SPDX-License-Identifier: Apache-2.0
3
+ // Transaction builders. Every builder adds commands to a caller-owned
4
+ // `Transaction`, so flows compose in a single PTB, but they come in two shapes.
5
+ // The `create*` primitives take the `Transaction` as their FIRST argument and
6
+ // return their by-value results, so those results can be threaded into later
7
+ // commands. `rejectDeal` has nothing to hand back, so it keeps the Sui SDK
8
+ // thunk shape: `(params) => (tx: Transaction) => …`. Miso calls go through the
9
+ // codegen-generated, type-safe call functions.
10
+ //
11
+ // This module keeps the bare protocol PRIMITIVES only. The rule is: do the
12
+ // minimum the Move semantics FORCE, and return anything the caller could
13
+ // legitimately route elsewhere.
14
+ //
15
+ // `createComposition`, `createRecording`, and `createRelease` each append a
16
+ // single `::new` and hand back its by-value results — never dispersing a share
17
+ // supply, publishing (sharing) the object, or routing an admin cap.
18
+ //
19
+ // Each created object MUST still be consumed by its `publish` in the same PTB
20
+ // (`Composition`, `Recording`, and `Release` are all `key`-only with no `drop`),
21
+ // but that is a same-TRANSACTION requirement, not a same-FUNCTION one: a later
22
+ // `finalize*` command on the same `tx` satisfies it. Keeping them apart is what
23
+ // lets the intermediate value be used at all — borrowing a still-unshared
24
+ // composition into `recording::new`, attaching a royalty pool via `uid_mut`, or
25
+ // sending an admin cap somewhere other than a plain address (every admin cap is
26
+ // `key, store`, so it is freely routable).
27
+ //
28
+ // The opinionated layers — track assembly, cap disposition, minato dispersal,
29
+ // the share-currency lifecycle — live in `@misofm/sdk`
30
+ // (`publishRelease`/`publishReleaseFromDeals`/`publishReleaseGraph`,
31
+ // `finalizeComposition`/`finalizeRecording`/`finalizeRelease`,
32
+ // `publishComposition`/`publishRecording`/`publishCompositionAndRecording`,
33
+ // `share.ts`) as free functions taking `misoPackageId` explicitly. Those import
34
+ // the primitives from here and build on top, same PTB composition pattern, just
35
+ // crossing a package boundary.
36
+ import { Transaction } from "@mysten/sui/transactions";
37
+ import * as composition from "./contracts/miso/composition.js";
38
+ import * as recording from "./contracts/miso/recording.js";
39
+ import * as deal from "./contracts/miso/deal.js";
40
+ import * as release from "./contracts/miso/release.js";
41
+ /**
42
+ * PRIMITIVE. Appends `composition::new` and returns its by-value results without
43
+ * dispersing, sharing, or transferring anything — the caller decides what happens
44
+ * next (share it, keep it unshared to bundle with a recording, attach a dynamic
45
+ * field via `uid_mut`, …). Composes with anything in the same PTB.
46
+ */
47
+ export function createComposition(tx, params) {
48
+ const result = tx.add(composition._new({
49
+ package: params.misoPackageId,
50
+ typeArguments: [params.shareType],
51
+ arguments: [tx.pure.string(params.title), tx.pure.u16(params.royaltyRateBps), tx.object(params.shareCurrencyId), tx.object(params.shareTreasuryCapId)],
52
+ }));
53
+ return { composition: result[0], adminCap: result[1], balance: result[2] };
54
+ }
55
+ /** The protocol's maximum composition royalty rate (`MAX_ROYALTY_RATE_BPS`). */
56
+ export const PROTOCOL_MAX_ROYALTY_RATE_BPS = 2000;
57
+ /**
58
+ * PRIMITIVE. Appends `recording::new` and returns its by-value results without
59
+ * publishing/dispersing/transferring. Because it borrows the composition by
60
+ * reference, it can run against a composition that is still an unshared PTB-local
61
+ * value — the borrow-before-share pattern that lets a composition + recording share
62
+ * one PTB.
63
+ */
64
+ export function createRecording(tx, params) {
65
+ const result = tx.add(recording._new({
66
+ package: params.misoPackageId,
67
+ typeArguments: [params.shareType, params.compositionShareType],
68
+ arguments: [params.composition, tx.object(params.shareCurrencyId), tx.object(params.shareTreasuryCapId), tx.pure.u16(params.maxRoyaltyRateBps ?? PROTOCOL_MAX_ROYALTY_RATE_BPS)],
69
+ }));
70
+ return { recording: result[0], adminCap: result[1], balance: result[2] };
71
+ }
72
+ /**
73
+ * PRIMITIVE. Appends `deal::new` and returns the `Deal` by value without routing
74
+ * it anywhere — the caller decides what happens next.
75
+ *
76
+ * LIFECYCLE NOTE — the returned `Deal` MUST be consumed in this same
77
+ * transaction. It is `key, store` with no `drop`, so it cannot be discarded, but
78
+ * it CAN go to either of two places, which is exactly why this does not choose:
79
+ *
80
+ * 1. `tx.transferObjects([deal], recipient)` — send it to whoever is
81
+ * assembling the release, for them to redeem later. This is the
82
+ * cross-party flow: a recording owner signs a deal for someone else's
83
+ * release.
84
+ * 2. straight into `track::new(deal, &recording)` in this same PTB — the
85
+ * same-party flow, where the deal is a transient authorization rather than
86
+ * something anyone holds. `@misofm/sdk`'s `publishReleaseGraph` does this.
87
+ *
88
+ * Both are legitimate, and picking one for the caller would make the other
89
+ * awkward, so the disposition stays with the caller. `@misofm/sdk` layers the
90
+ * opinionated flows on top.
91
+ *
92
+ * The `recordingAdminCap` may be passed as an on-chain object id
93
+ * (`recordingAdminCapId`) or as a PTB-local argument (`recordingAdminCap`) —
94
+ * the latter lets a deal be signed against a recording created earlier in the
95
+ * same transaction, before its cap has been transferred anywhere.
96
+ */
97
+ export function createDeal(tx, params) {
98
+ if (!params.recordingAdminCap && !params.recordingAdminCapId) {
99
+ throw new Error("createDeal: recordingAdminCapId or recordingAdminCap required");
100
+ }
101
+ const adminCapArg = params.recordingAdminCap ?? tx.object(params.recordingAdminCapId);
102
+ return tx.add(deal._new({
103
+ package: params.misoPackageId,
104
+ typeArguments: [params.recordingShareType, params.compositionShareType],
105
+ arguments: [
106
+ adminCapArg,
107
+ tx.object(params.recordingId),
108
+ tx.pure.id(params.releaseId),
109
+ tx.pure.u16(params.trackSplitBps),
110
+ ],
111
+ }));
112
+ }
113
+ /** Rejects (destroys) a deal without including it in a release. Emits `DealRejectedEvent`. */
114
+ export function rejectDeal(params) {
115
+ return (tx) => {
116
+ tx.add(deal.reject({
117
+ package: params.misoPackageId,
118
+ typeArguments: [params.recordingShareType, params.compositionShareType],
119
+ arguments: [tx.object(params.dealId)],
120
+ }));
121
+ };
122
+ }
123
+ /**
124
+ * PRIMITIVE. Appends `release::new` over a caller-built `vector<Track>` and
125
+ * returns its by-value results without publishing (sharing) the release or
126
+ * routing the admin cap — the caller decides what happens next. Mirrors
127
+ * {@link createComposition}/{@link createRecording}.
128
+ *
129
+ * `trackVec` is supplied by the caller because track assembly is the part that
130
+ * genuinely varies between release flows: from recording admin caps, from
131
+ * pre-made deals, or from a mix of fresh and existing recordings (see
132
+ * `@misofm/sdk`'s `publishRelease`/`publishReleaseFromDeals`/
133
+ * `publishReleaseGraph`).
134
+ *
135
+ * LIFECYCLE NOTE — the returned `Release` MUST be consumed by
136
+ * `release::publish` in this same transaction. `Release` is `key`-only with no
137
+ * `drop`, and `publish` is its only by-value consumer, so an `Initialized`
138
+ * release cannot be transferred, wrapped, shared, or discarded, and cannot
139
+ * outlive its creating transaction; the protocol deliberately provides no keep
140
+ * function. That is a same-PTB requirement, NOT a same-function one — pairing
141
+ * this with a later `finalizeRelease` command in the same `tx` satisfies it.
142
+ * (`Composition` and `Recording` carry the identical requirement, which is why
143
+ * all three primitives have the same shape.) The admin cap has no such
144
+ * constraint: `ReleaseAdminCap` is `key, store` and `publish` only borrows it,
145
+ * so it is an ordinary transferable value the caller routes as it sees fit.
146
+ */
147
+ export function createRelease(tx, params, trackVec) {
148
+ const result = tx.add(release._new({
149
+ package: params.misoPackageId,
150
+ arguments: [tx.pure.string(params.title), trackVec, tx.pure.u256(BigInt(params.nonce)), tx.object(params.releaseRegistryId)],
151
+ }));
152
+ return { release: result[0], adminCap: result[1] };
153
+ }
154
+ //# sourceMappingURL=transactions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transactions.js","sourceRoot":"","sources":["../src/transactions.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,sCAAsC;AAEtC,sEAAsE;AACtE,gFAAgF;AAChF,8EAA8E;AAC9E,6EAA6E;AAC7E,2EAA2E;AAC3E,+EAA+E;AAC/E,+CAA+C;AAC/C,EAAE;AACF,2EAA2E;AAC3E,yEAAyE;AACzE,gCAAgC;AAChC,EAAE;AACF,4EAA4E;AAC5E,+EAA+E;AAC/E,oEAAoE;AACpE,EAAE;AACF,8EAA8E;AAC9E,iFAAiF;AACjF,+EAA+E;AAC/E,gFAAgF;AAChF,0EAA0E;AAC1E,gFAAgF;AAChF,gFAAgF;AAChF,2CAA2C;AAC3C,EAAE;AACF,8EAA8E;AAC9E,uDAAuD;AACvD,qEAAqE;AACrE,+DAA+D;AAC/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,CACH,CAAC;AACJ,CAAC;AAWD,8FAA8F;AAC9F,MAAM,UAAU,UAAU,CAAC,MAAwB;IACjD,OAAO,CAAC,EAAE,EAAE,EAAE;QACZ,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC;YACjB,OAAO,EAAE,MAAM,CAAC,aAAa;YAC7B,aAAa,EAAE,CAAC,MAAM,CAAC,kBAAkB,EAAE,MAAM,CAAC,oBAAoB,CAAC;YACvE,SAAS,EAAE,CAAC,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;SACtC,CAAC,CAAC,CAAC;IACN,CAAC,CAAC;AACJ,CAAC;AAoBD;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAM,UAAU,aAAa,CAC3B,EAAe,EACf,MAA2B,EAC3B,QAAmC;IAEnC,MAAM,MAAM,GAAG,EAAE,CAAC,GAAG,CACnB,OAAO,CAAC,IAAI,CAAC;QACX,OAAO,EAAE,MAAM,CAAC,aAAa;QAC7B,SAAS,EAAE,CAAC,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,QAAQ,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,iBAAiB,CAAC,CAAC;KAC7H,CAAC,CACH,CAAC;IACF,OAAO,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC,CAAE,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAC,CAAE,EAAE,CAAC;AACvD,CAAC"}
@@ -0,0 +1,204 @@
1
+ /** Basis points value (0-10000, where 10000 = 100%). */
2
+ export interface BPS {
3
+ value: number;
4
+ }
5
+ /** Lifecycle state of a composition. */
6
+ export type CompositionState = {
7
+ type: "Initialized";
8
+ } | {
9
+ type: "Published";
10
+ timestampMs: number;
11
+ };
12
+ /**
13
+ * A musical composition representing the underlying written work.
14
+ *
15
+ * Compositions are the written musical works (songs, instrumentals) that
16
+ * recordings are based on. Each composition has its own share token for
17
+ * ownership distribution.
18
+ *
19
+ * State machine: Initialized -> Published (immutable after publish)
20
+ */
21
+ export interface Composition {
22
+ /** Unique identifier for this composition. */
23
+ id: string;
24
+ /** Current lifecycle state. */
25
+ state: CompositionState;
26
+ /** Primary title of the composition. */
27
+ title: string;
28
+ /** Royalty rate this composition earns from each recording's revenue (basis points, 0-2000). */
29
+ royaltyRate: BPS;
30
+ }
31
+ /**
32
+ * Emitted once when a composition is published. A pure pointer carrying only the
33
+ * composition's identity — an indexer fetches the full immutable object by
34
+ * `compositionId`.
35
+ */
36
+ export interface CompositionPublishedEvent {
37
+ compositionId: string;
38
+ }
39
+ /**
40
+ * Emitted when a composition's royalty rate is set or changed. The composition
41
+ * is identified by the event's `CompositionShare` phantom type, not a field.
42
+ */
43
+ export interface CompositionRoyaltySetEvent {
44
+ royaltyRateBps: number;
45
+ }
46
+ /**
47
+ * Admin cap for a Composition, derived deterministically from the Composition object ID.
48
+ *
49
+ * The share type parameter T is extracted from the on-chain type
50
+ * `CompositionAdminCap<T>` where T is the composition's share token type.
51
+ */
52
+ export interface CompositionAdminCap {
53
+ /** The object ID of the admin cap. */
54
+ id: string;
55
+ /** The share type parameter T from CompositionAdminCap<T>. */
56
+ shareType: string;
57
+ }
58
+ /** Lifecycle state of a recording. */
59
+ export type RecordingState = {
60
+ type: "Initialized";
61
+ } | {
62
+ type: "Published";
63
+ timestampMs: number;
64
+ };
65
+ /**
66
+ * An audio recording of a composition.
67
+ *
68
+ * Recordings are the audio performances that are distributed and played.
69
+ * Each recording has its own share token for ownership distribution.
70
+ *
71
+ * A recording carries no name of its own: its display title is its
72
+ * composition's title, resolved through the recording's `CompositionShare`
73
+ * type parameter. Richer naming ("(Live)", localized titles) lives in the
74
+ * metadata extension.
75
+ *
76
+ * State machine: Initialized -> Published (immutable after publish)
77
+ */
78
+ export interface Recording {
79
+ /** Unique identifier for this recording. */
80
+ id: string;
81
+ /** Current lifecycle state. */
82
+ state: RecordingState;
83
+ }
84
+ /**
85
+ * Emitted once when a recording is published. A pure pointer carrying only the
86
+ * recording's identity — an indexer fetches the full immutable object by
87
+ * `recordingId`.
88
+ */
89
+ export interface RecordingPublishedEvent {
90
+ recordingId: string;
91
+ }
92
+ /**
93
+ * Admin cap for a Recording, derived deterministically from the Recording object ID.
94
+ *
95
+ * The share type parameter T is extracted from the on-chain type
96
+ * `RecordingAdminCap<T>` where T is the recording's share token type.
97
+ */
98
+ export interface RecordingAdminCap {
99
+ /** The object ID of the admin cap. */
100
+ id: string;
101
+ /** The share type parameter T from RecordingAdminCap<T>. */
102
+ shareType: string;
103
+ }
104
+ /**
105
+ * A deal authorizing a recording's inclusion in a specific release. Created by
106
+ * the recording's admin, held (transferably) by whoever assembles the release,
107
+ * and consumed by `track::new`. The recording/composition identities ride on
108
+ * the object's type parameters; the recording's object id is NOT stored.
109
+ */
110
+ export interface Deal {
111
+ /** The object ID of the deal. */
112
+ id: string;
113
+ /** The exact release id this deal authorizes (a digest of the full tracklist + nonce). */
114
+ releaseId: string;
115
+ /** The agreed track split for this recording within the release. */
116
+ trackSplitBps: BPS;
117
+ /** The recording's share type (first type parameter of `Deal<R, C>`). */
118
+ recordingShareType: string;
119
+ /** The parent composition's share type (second type parameter of `Deal<R, C>`). */
120
+ compositionShareType: string;
121
+ }
122
+ /** Lifecycle state of a track on a release. */
123
+ export type TrackState = "Unassigned" | "Assigned";
124
+ /**
125
+ * A track on a release, linking a recording to its position in the tracklist.
126
+ * The recording is the handle through which all other metadata (share types,
127
+ * composition lineage, and — via the composition — the display title) is
128
+ * reached.
129
+ */
130
+ export interface Track {
131
+ /** Current state of the track (Unassigned until the release claims it, then Assigned). */
132
+ state: TrackState;
133
+ /** ID of the recording on this track. */
134
+ recordingId: string;
135
+ /** Revenue split for this track within the release (in basis points). */
136
+ splitBps: BPS;
137
+ }
138
+ /** Lifecycle state of a release. */
139
+ export type ReleaseState = {
140
+ type: "Initialized";
141
+ } | {
142
+ type: "Published";
143
+ timestampMs: number;
144
+ };
145
+ /**
146
+ * A music release (album, EP, or single).
147
+ *
148
+ * A release is a flat, ordered tracklist with per-track revenue distribution
149
+ * configuration. Display grouping (discs, vinyl sides), cover art, and edition
150
+ * naming live in extensions — the stored tracklist has the same shape as the
151
+ * digest pre-image every deal consented to.
152
+ *
153
+ * State machine: Initialized -> Published (immutable after publish)
154
+ */
155
+ export interface Release {
156
+ /** Unique identifier for this release. */
157
+ id: string;
158
+ /** Current lifecycle state. */
159
+ state: ReleaseState;
160
+ /** Title of the release. */
161
+ title: string;
162
+ /** The ordered tracklist. */
163
+ tracks: Track[];
164
+ }
165
+ /**
166
+ * Emitted once when a release is published. A pure pointer carrying only the
167
+ * release's identity — an indexer fetches the full immutable object (discs,
168
+ * tracks) by `releaseId`.
169
+ */
170
+ export interface ReleasePublishedEvent {
171
+ releaseId: string;
172
+ }
173
+ /**
174
+ * Admin cap for a Release, derived deterministically from the Release object ID.
175
+ *
176
+ * Unlike Composition and Recording admin caps, ReleaseAdminCap is not generic
177
+ * (Release has no share type parameter) and stores a reference to its Release.
178
+ */
179
+ export interface ReleaseAdminCap {
180
+ /** The object ID of the admin cap. */
181
+ id: string;
182
+ /** The object ID of the Release this cap administers. */
183
+ releaseId: string;
184
+ }
185
+ export interface DealCreatedEvent {
186
+ dealId: string;
187
+ releaseId: string;
188
+ trackSplitBps: BPS;
189
+ }
190
+ /**
191
+ * Emitted when a deal is accepted: consumed by `track::new` into a track for
192
+ * its target release. Treat as provisional until the release publishes (in the
193
+ * honest path both land in the same transaction).
194
+ */
195
+ export interface DealAcceptedEvent {
196
+ dealId: string;
197
+ releaseId: string;
198
+ }
199
+ /** Emitted when a deal is rejected: destroyed without inclusion in a release. Terminal. */
200
+ export interface DealRejectedEvent {
201
+ dealId: string;
202
+ releaseId: string;
203
+ }
204
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3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AM,WAAW,gBAAgB;IAC/B,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,aAAa,EAAE,GAAG,CAAC;CACpB;AAED;;;;GAIG;AACH,MAAM,WAAW,iBAAiB;IAChC,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,2FAA2F;AAC3F,MAAM,WAAW,iBAAiB;IAChC,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;CACnB"}
package/dist/types.js ADDED
@@ -0,0 +1,4 @@
1
+ // Copyright (c) Miso Labs, Inc.
2
+ // SPDX-License-Identifier: Apache-2.0
3
+ export {};
4
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,sCAAsC"}
package/dist/view.d.ts ADDED
@@ -0,0 +1,21 @@
1
+ import type { ClientWithCoreApi } from "@mysten/sui/client";
2
+ export interface DeriveReleaseIdParams {
3
+ /** Sender for the simulation (any address; not charged). */
4
+ sender: string;
5
+ /** Recording object ids, in track order. */
6
+ recordingIds: string[];
7
+ /** Per-track split basis points, aligned to `recordingIds`. */
8
+ splitBps: number[];
9
+ /** The release nonce (u256 as a decimal string). */
10
+ nonce: string;
11
+ /** The shared ReleaseRegistry object id. */
12
+ releaseRegistryId: string;
13
+ }
14
+ /**
15
+ * Derives the release id the on-chain `release::new` will produce for these
16
+ * inputs, via a `simulateTransaction` call to `release::derive_release_id`. The
17
+ * deals embedded in a release must reference this exact id, so it is computed up
18
+ * front and threaded into the release publish builder.
19
+ */
20
+ export declare function deriveReleaseId(client: ClientWithCoreApi, misoPackageId: string, params: DeriveReleaseIdParams): Promise<string>;
21
+ //# sourceMappingURL=view.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"view.d.ts","sourceRoot":"","sources":["../src/view.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAG5D,MAAM,WAAW,qBAAqB;IACpC,4DAA4D;IAC5D,MAAM,EAAE,MAAM,CAAC;IACf,4CAA4C;IAC5C,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,+DAA+D;IAC/D,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,oDAAoD;IACpD,KAAK,EAAE,MAAM,CAAC;IACd,4CAA4C;IAC5C,iBAAiB,EAAE,MAAM,CAAC;CAC3B;AAED;;;;;GAKG;AACH,wBAAsB,eAAe,CACnC,MAAM,EAAE,iBAAiB,EACzB,aAAa,EAAE,MAAM,EACrB,MAAM,EAAE,qBAAqB,GAC5B,OAAO,CAAC,MAAM,CAAC,CAsBjB"}
package/dist/view.js ADDED
@@ -0,0 +1,36 @@
1
+ // Copyright (c) Miso Labs, Inc.
2
+ // SPDX-License-Identifier: Apache-2.0
3
+ // Simulate-based reads (the `view` surface). These build a transaction and run it
4
+ // through the Core `simulateTransaction` API to read a computed value without
5
+ // changing state — used where the value is a pure function of inputs the chain
6
+ // derives (e.g. the deterministic release id).
7
+ import { Transaction } from "@mysten/sui/transactions";
8
+ import { bcs } from "@mysten/sui/bcs";
9
+ import * as release from "./contracts/miso/release.js";
10
+ /**
11
+ * Derives the release id the on-chain `release::new` will produce for these
12
+ * inputs, via a `simulateTransaction` call to `release::derive_release_id`. The
13
+ * deals embedded in a release must reference this exact id, so it is computed up
14
+ * front and threaded into the release publish builder.
15
+ */
16
+ export async function deriveReleaseId(client, misoPackageId, params) {
17
+ if (params.recordingIds.length !== params.splitBps.length) {
18
+ throw new Error(`deriveReleaseId: recordingIds (${params.recordingIds.length}) and splitBps (${params.splitBps.length}) length mismatch.`);
19
+ }
20
+ const tx = new Transaction();
21
+ tx.setSender(params.sender);
22
+ tx.add(release.deriveReleaseId({
23
+ package: misoPackageId,
24
+ arguments: [params.recordingIds, params.splitBps.map((v) => BigInt(v)), BigInt(params.nonce), params.releaseRegistryId],
25
+ }));
26
+ // gRPC/Core equivalent of devInspect: simulate with per-command return values.
27
+ const res = await client.core.simulateTransaction({ transaction: tx, include: { commandResults: true } });
28
+ if (res.$kind !== "Transaction") {
29
+ throw new Error(`derive_release_id simulation failed: ${JSON.stringify(res.FailedTransaction.status)}`);
30
+ }
31
+ const returned = res.commandResults?.[0]?.returnValues?.[0]?.bcs;
32
+ if (!returned)
33
+ throw new Error("derive_release_id returned no value.");
34
+ return bcs.Address.parse(returned);
35
+ }
36
+ //# sourceMappingURL=view.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"view.js","sourceRoot":"","sources":["../src/view.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,sCAAsC;AAEtC,kFAAkF;AAClF,8EAA8E;AAC9E,+EAA+E;AAC/E,+CAA+C;AAE/C,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,EAAE,GAAG,EAAE,MAAM,iBAAiB,CAAC;AAEtC,OAAO,KAAK,OAAO,MAAM,6BAA6B,CAAC;AAevD;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,eAAe,CACnC,MAAyB,EACzB,aAAqB,EACrB,MAA6B;IAE7B,IAAI,MAAM,CAAC,YAAY,CAAC,MAAM,KAAK,MAAM,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC;QAC1D,MAAM,IAAI,KAAK,CAAC,kCAAkC,MAAM,CAAC,YAAY,CAAC,MAAM,mBAAmB,MAAM,CAAC,QAAQ,CAAC,MAAM,oBAAoB,CAAC,CAAC;IAC7I,CAAC;IAED,MAAM,EAAE,GAAG,IAAI,WAAW,EAAE,CAAC;IAC7B,EAAE,CAAC,SAAS,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IAC5B,EAAE,CAAC,GAAG,CACJ,OAAO,CAAC,eAAe,CAAC;QACtB,OAAO,EAAE,aAAa;QACtB,SAAS,EAAE,CAAC,MAAM,CAAC,YAAY,EAAE,MAAM,CAAC,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