@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,153 @@
1
+ /**************************************************************
2
+ * THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
3
+ **************************************************************/
4
+
5
+
6
+ /**
7
+ * Represents a track on a release, linking a recording to its position in the
8
+ * tracklist.
9
+ *
10
+ * A `Track` is the minimal positioned (recording, revenue-share) pair:
11
+ *
12
+ * - `recording_id` — the routing target for the track's revenue, and the handle
13
+ * through which all other metadata (title, cover art, and the
14
+ * recording/composition share-type identities) is reached.
15
+ * - `split_bps` — this track's share of the release's revenue; genuinely
16
+ * release-specific and not derivable from the recording.
17
+ * - `state` — the assign-once lifecycle that carries (then sheds) each deal's
18
+ * target release commitment; see `TrackState`.
19
+ *
20
+ * `Track` is intentionally monomorphic: a `Release` holds a `vector<Track>` of
21
+ * tracks from many different recordings/compositions, so it cannot be generic over
22
+ * their share types. It stores no title, cover art, or share-type — all derived
23
+ * from the recording via `recording_id`.
24
+ */
25
+
26
+ import { MoveEnum, MoveStruct, normalizeMoveArguments, type RawTransactionArgument } from '../utils/index.js';
27
+ import { bcs } from '@mysten/sui/bcs';
28
+ import { type Transaction, type TransactionArgument } from '@mysten/sui/transactions';
29
+ import * as bps from './deps/bps/bps.js';
30
+ const $moduleName = '@local-pkg/miso::track';
31
+ /**
32
+ * Lifecycle state of a track within a release. A track is born `Unassigned`,
33
+ * carrying the target `release_id` its originating `Deal` committed to (the
34
+ * release id is a digest of the whole tracklist, so this is the recording owner's
35
+ * consent to the exact release configuration). At publish the release verifies the
36
+ * match and transitions the track to `Assigned`, which carries no id — shedding
37
+ * the 32-byte commitment once it has served its purpose.
38
+ */
39
+ export const TrackState = new MoveEnum({ name: `${$moduleName}::TrackState`, fields: {
40
+ /**
41
+ * Track has been created but not yet assigned to a release. Carries the target
42
+ * release id the originating deal committed to.
43
+ */
44
+ Unassigned: bcs.Address,
45
+ /** Track has been assigned to its target release. */
46
+ Assigned: null
47
+ } });
48
+ export const Track = new MoveStruct({ name: `${$moduleName}::Track`, fields: {
49
+ /** Current state of the track. */
50
+ state: TrackState,
51
+ /**
52
+ * ID of the recording on this track. The routing target for the track's revenue;
53
+ * also the handle a consumer uses to fetch the recording (whose type carries the
54
+ * recording and composition share-type identities).
55
+ */
56
+ recording_id: bcs.Address,
57
+ /**
58
+ * This track's share of the release's revenue, in basis points. All tracks in a
59
+ * release sum to 100%. The composition's cut is settled as recording-share
60
+ * ownership at recording creation, so it is not split out here — a track routes
61
+ * its full share to the recording.
62
+ */
63
+ split_bps: bps.BPS
64
+ } });
65
+ export interface NewArguments {
66
+ deal: RawTransactionArgument<string>;
67
+ recording: RawTransactionArgument<string>;
68
+ }
69
+ export interface NewOptions {
70
+ package?: string;
71
+ arguments: NewArguments | [
72
+ deal: RawTransactionArgument<string>,
73
+ recording: RawTransactionArgument<string>
74
+ ];
75
+ typeArguments: [
76
+ string,
77
+ string
78
+ ];
79
+ }
80
+ /**
81
+ * Creates a new track by accepting a deal. The deal is the authorization — created
82
+ * by the recording's admin, carrying the target release and the agreed split.
83
+ * Emits a `DealAcceptedEvent`.
84
+ *
85
+ * The deal's `RecordingShare`/`CompositionShare` phantoms are erased here: a
86
+ * `Track` is monomorphic so it can live in a release's heterogeneous
87
+ * `vector<Track>`. Identity rides on those phantoms up to this point, but the
88
+ * monomorphic `Track` must store the recording's _address_ for revenue routing —
89
+ * and an address can't come from a phantom. So the matching `Recording` is passed
90
+ * in (the deal's phantoms force it to be the right one) purely to read its id; the
91
+ * deal no longer stores it.
92
+ */
93
+ export function _new(options: NewOptions) {
94
+ const packageAddress = options.package ?? '@local-pkg/miso';
95
+ const argumentsTypes = [
96
+ null,
97
+ null
98
+ ] satisfies (string | null)[];
99
+ const parameterNames = ["deal", "recording"];
100
+ return (tx: Transaction) => tx.moveCall({
101
+ package: packageAddress,
102
+ module: 'track',
103
+ function: 'new',
104
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
105
+ typeArguments: options.typeArguments
106
+ });
107
+ }
108
+ export interface RecordingIdArguments {
109
+ self: TransactionArgument;
110
+ }
111
+ export interface RecordingIdOptions {
112
+ package?: string;
113
+ arguments: RecordingIdArguments | [
114
+ self: TransactionArgument
115
+ ];
116
+ }
117
+ /** Returns the ID of the recording. */
118
+ export function recordingId(options: RecordingIdOptions) {
119
+ const packageAddress = options.package ?? '@local-pkg/miso';
120
+ const argumentsTypes = [
121
+ null
122
+ ] satisfies (string | null)[];
123
+ const parameterNames = ["self"];
124
+ return (tx: Transaction) => tx.moveCall({
125
+ package: packageAddress,
126
+ module: 'track',
127
+ function: 'recording_id',
128
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
129
+ });
130
+ }
131
+ export interface SplitBpsArguments {
132
+ self: TransactionArgument;
133
+ }
134
+ export interface SplitBpsOptions {
135
+ package?: string;
136
+ arguments: SplitBpsArguments | [
137
+ self: TransactionArgument
138
+ ];
139
+ }
140
+ /** Returns this track's share of the release's revenue (in basis points). */
141
+ export function splitBps(options: SplitBpsOptions) {
142
+ const packageAddress = options.package ?? '@local-pkg/miso';
143
+ const argumentsTypes = [
144
+ null
145
+ ] satisfies (string | null)[];
146
+ const parameterNames = ["self"];
147
+ return (tx: Transaction) => tx.moveCall({
148
+ package: packageAddress,
149
+ module: 'track',
150
+ function: 'split_bps',
151
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
152
+ });
153
+ }
@@ -0,0 +1,27 @@
1
+ /**************************************************************
2
+ * THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
3
+ **************************************************************/
4
+
5
+
6
+ /**
7
+ * Represents a party's credit on a work or activity. A credit pairs a display name
8
+ * with one or more roles, identifying how a party contributed to the work.
9
+ */
10
+
11
+ import { type BcsType, bcs } from '@mysten/sui/bcs';
12
+ import { MoveStruct } from '../../../utils/index.js';
13
+ const $moduleName = 'miso_credit::credit';
14
+ /**
15
+ * A credit attributing roles to a party on a work. Generic over the role type to
16
+ * support domain-specific roles.
17
+ */
18
+ export function Credit<Role extends BcsType<any>>(...typeParameters: [
19
+ Role
20
+ ]) {
21
+ return new MoveStruct({ name: `${$moduleName}::Credit<${typeParameters[0].name as Role['name']}>`, fields: {
22
+ /** Human-readable name to display for this credit. */
23
+ display_name: bcs.string(),
24
+ /** Roles assigned to the credited party. */
25
+ roles: bcs.vector(typeParameters[0])
26
+ } });
27
+ }
@@ -0,0 +1,33 @@
1
+ /**************************************************************
2
+ * THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
3
+ **************************************************************/
4
+ import { type BcsType, bcs } from '@mysten/sui/bcs';
5
+ import { MoveStruct } from '../../../utils/index.js';
6
+ const $moduleName = '0x2::vec_map';
7
+ /** An entry in the map */
8
+ export function Entry<K extends BcsType<any>, V extends BcsType<any>>(...typeParameters: [
9
+ K,
10
+ V
11
+ ]) {
12
+ return new MoveStruct({ name: `${$moduleName}::Entry<${typeParameters[0].name as K['name']}, ${typeParameters[1].name as V['name']}>`, fields: {
13
+ key: typeParameters[0],
14
+ value: typeParameters[1]
15
+ } });
16
+ }
17
+ /**
18
+ * A map data structure backed by a vector. The map is guaranteed not to contain
19
+ * duplicate keys, but entries are _not_ sorted by key--entries are included in
20
+ * insertion order. All operations are O(N) in the size of the map--the intention
21
+ * of this data structure is only to provide the convenience of programming against
22
+ * a map API. Large maps should use handwritten parent/child relationships instead.
23
+ * Maps that need sorted iteration rather than insertion order iteration should
24
+ * also be handwritten.
25
+ */
26
+ export function VecMap<K extends BcsType<any>, V extends BcsType<any>>(...typeParameters: [
27
+ K,
28
+ V
29
+ ]) {
30
+ return new MoveStruct({ name: `${$moduleName}::VecMap<${typeParameters[0].name as K['name']}, ${typeParameters[1].name as V['name']}>`, fields: {
31
+ contents: bcs.vector(Entry(typeParameters[0], typeParameters[1]))
32
+ } });
33
+ }
@@ -0,0 +1,21 @@
1
+ /**************************************************************
2
+ * THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
3
+ **************************************************************/
4
+ import { type BcsType, bcs } from '@mysten/sui/bcs';
5
+ import { MoveStruct } from '../../../utils/index.js';
6
+ const $moduleName = '0x2::vec_set';
7
+ /**
8
+ * A set data structure backed by a vector. The set is guaranteed not to contain
9
+ * duplicate keys. All operations are O(N) in the size of the set
10
+ *
11
+ * - the intention of this data structure is only to provide the convenience of
12
+ * programming against a set API. Sets that need sorted iteration rather than
13
+ * insertion order iteration should be handwritten.
14
+ */
15
+ export function VecSet<K extends BcsType<any>>(...typeParameters: [
16
+ K
17
+ ]) {
18
+ return new MoveStruct({ name: `${$moduleName}::VecSet<${typeParameters[0].name as K['name']}>`, fields: {
19
+ contents: bcs.vector(typeParameters[0])
20
+ } });
21
+ }
@@ -0,0 +1,458 @@
1
+ /**************************************************************
2
+ * THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
3
+ **************************************************************/
4
+
5
+
6
+ /**
7
+ * First-party credits extension for recordings.
8
+ *
9
+ * Attribution (credits + primary/featured artists) is display-oriented and varies
10
+ * across platforms, so it lives here as a dynamic field on the recording rather
11
+ * than in immutable core. The data is attached under `ExtensionKey()` via the
12
+ * recording's cap-gated `uid_mut`, so every mutation is authorized by the
13
+ * recording's admin and credits survive into any lifecycle state (they may be
14
+ * attached before or after the recording is published).
15
+ *
16
+ * This is Miso's canonical credits standard; because it is an extension, other
17
+ * parties may publish their own recording-credits standard against the same
18
+ * `Recording`. Credits are NOT read by the economics — they are attribution.
19
+ */
20
+
21
+ import { MoveTuple, MoveStruct, normalizeMoveArguments, type RawTransactionArgument } from '../utils/index.js';
22
+ import { bcs } from '@mysten/sui/bcs';
23
+ import { type Transaction, type TransactionArgument } from '@mysten/sui/transactions';
24
+ import * as vec_map from './deps/sui/vec_map.js';
25
+ import * as credit from './deps/miso_credit/credit.js';
26
+ import * as recording_party_role from './recording_party_role.js';
27
+ import * as vec_set from './deps/sui/vec_set.js';
28
+ const $moduleName = '@local-pkg/recording_credits::recording_credits';
29
+ export const ExtensionKey = new MoveTuple({ name: `${$moduleName}::ExtensionKey`, fields: [bcs.bool()] });
30
+ export const RecordingCredits = new MoveStruct({ name: `${$moduleName}::RecordingCredits`, fields: {
31
+ /** Map of party IDs to their credit (display name + roles). */
32
+ credits: vec_map.VecMap(bcs.Address, credit.Credit(recording_party_role.RecordingPartyRole)),
33
+ /** IDs of the primary artists. Always a subset of `credits`. */
34
+ primary_artist_ids: vec_set.VecSet(bcs.Address),
35
+ /** IDs of the featured artists. Always a subset of `credits`. */
36
+ featured_artist_ids: vec_set.VecSet(bcs.Address)
37
+ } });
38
+ export const CreditAddedEvent = new MoveStruct({ name: `${$moduleName}::CreditAddedEvent`, fields: {
39
+ recording_id: bcs.Address,
40
+ party_id: bcs.Address,
41
+ credit: credit.Credit(recording_party_role.RecordingPartyRole)
42
+ } });
43
+ export const CreditRemovedEvent = new MoveStruct({ name: `${$moduleName}::CreditRemovedEvent`, fields: {
44
+ recording_id: bcs.Address,
45
+ party_id: bcs.Address,
46
+ credit: credit.Credit(recording_party_role.RecordingPartyRole)
47
+ } });
48
+ export const PrimaryArtistAddedEvent = new MoveStruct({ name: `${$moduleName}::PrimaryArtistAddedEvent`, fields: {
49
+ recording_id: bcs.Address,
50
+ party_id: bcs.Address
51
+ } });
52
+ export const PrimaryArtistRemovedEvent = new MoveStruct({ name: `${$moduleName}::PrimaryArtistRemovedEvent`, fields: {
53
+ recording_id: bcs.Address,
54
+ party_id: bcs.Address
55
+ } });
56
+ export const FeaturedArtistAddedEvent = new MoveStruct({ name: `${$moduleName}::FeaturedArtistAddedEvent`, fields: {
57
+ recording_id: bcs.Address,
58
+ party_id: bcs.Address
59
+ } });
60
+ export const FeaturedArtistRemovedEvent = new MoveStruct({ name: `${$moduleName}::FeaturedArtistRemovedEvent`, fields: {
61
+ recording_id: bcs.Address,
62
+ party_id: bcs.Address
63
+ } });
64
+ export interface AddCreditArguments {
65
+ self: RawTransactionArgument<string>;
66
+ cap: RawTransactionArgument<string>;
67
+ party: RawTransactionArgument<string>;
68
+ credit: TransactionArgument;
69
+ }
70
+ export interface AddCreditOptions {
71
+ package?: string;
72
+ arguments: AddCreditArguments | [
73
+ self: RawTransactionArgument<string>,
74
+ cap: RawTransactionArgument<string>,
75
+ party: RawTransactionArgument<string>,
76
+ credit: TransactionArgument
77
+ ];
78
+ typeArguments: [
79
+ string,
80
+ string
81
+ ];
82
+ }
83
+ /**
84
+ * Adds a credit for a party on the recording, lazily creating the credits record
85
+ * on first use. Each credit must have 1-10 roles, and a party may hold at most one
86
+ * credit. Requires the recording's admin capability.
87
+ */
88
+ export function addCredit(options: AddCreditOptions) {
89
+ const packageAddress = options.package ?? '@local-pkg/recording_credits';
90
+ const argumentsTypes = [
91
+ null,
92
+ null,
93
+ null,
94
+ null
95
+ ] satisfies (string | null)[];
96
+ const parameterNames = ["self", "cap", "party", "credit"];
97
+ return (tx: Transaction) => tx.moveCall({
98
+ package: packageAddress,
99
+ module: 'recording_credits',
100
+ function: 'add_credit',
101
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
102
+ typeArguments: options.typeArguments
103
+ });
104
+ }
105
+ export interface RemoveCreditArguments {
106
+ self: RawTransactionArgument<string>;
107
+ cap: RawTransactionArgument<string>;
108
+ partyId: RawTransactionArgument<string>;
109
+ }
110
+ export interface RemoveCreditOptions {
111
+ package?: string;
112
+ arguments: RemoveCreditArguments | [
113
+ self: RawTransactionArgument<string>,
114
+ cap: RawTransactionArgument<string>,
115
+ partyId: RawTransactionArgument<string>
116
+ ];
117
+ typeArguments: [
118
+ string,
119
+ string
120
+ ];
121
+ }
122
+ /**
123
+ * Removes a party's credit. Also drops them from the primary/featured sets,
124
+ * preserving the invariant that those are subsets of the credited parties.
125
+ * Requires the recording's admin capability.
126
+ */
127
+ export function removeCredit(options: RemoveCreditOptions) {
128
+ const packageAddress = options.package ?? '@local-pkg/recording_credits';
129
+ const argumentsTypes = [
130
+ null,
131
+ null,
132
+ '0x2::object::ID'
133
+ ] satisfies (string | null)[];
134
+ const parameterNames = ["self", "cap", "partyId"];
135
+ return (tx: Transaction) => tx.moveCall({
136
+ package: packageAddress,
137
+ module: 'recording_credits',
138
+ function: 'remove_credit',
139
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
140
+ typeArguments: options.typeArguments
141
+ });
142
+ }
143
+ export interface AddPrimaryArtistArguments {
144
+ self: RawTransactionArgument<string>;
145
+ cap: RawTransactionArgument<string>;
146
+ party: RawTransactionArgument<string>;
147
+ }
148
+ export interface AddPrimaryArtistOptions {
149
+ package?: string;
150
+ arguments: AddPrimaryArtistArguments | [
151
+ self: RawTransactionArgument<string>,
152
+ cap: RawTransactionArgument<string>,
153
+ party: RawTransactionArgument<string>
154
+ ];
155
+ typeArguments: [
156
+ string,
157
+ string
158
+ ];
159
+ }
160
+ /**
161
+ * Designates an already-credited party as a primary artist. The party must be
162
+ * credited and not already a primary or featured artist.
163
+ */
164
+ export function addPrimaryArtist(options: AddPrimaryArtistOptions) {
165
+ const packageAddress = options.package ?? '@local-pkg/recording_credits';
166
+ const argumentsTypes = [
167
+ null,
168
+ null,
169
+ null
170
+ ] satisfies (string | null)[];
171
+ const parameterNames = ["self", "cap", "party"];
172
+ return (tx: Transaction) => tx.moveCall({
173
+ package: packageAddress,
174
+ module: 'recording_credits',
175
+ function: 'add_primary_artist',
176
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
177
+ typeArguments: options.typeArguments
178
+ });
179
+ }
180
+ export interface RemovePrimaryArtistArguments {
181
+ self: RawTransactionArgument<string>;
182
+ cap: RawTransactionArgument<string>;
183
+ partyId: RawTransactionArgument<string>;
184
+ }
185
+ export interface RemovePrimaryArtistOptions {
186
+ package?: string;
187
+ arguments: RemovePrimaryArtistArguments | [
188
+ self: RawTransactionArgument<string>,
189
+ cap: RawTransactionArgument<string>,
190
+ partyId: RawTransactionArgument<string>
191
+ ];
192
+ typeArguments: [
193
+ string,
194
+ string
195
+ ];
196
+ }
197
+ /** Removes a party from the primary-artist set (leaves the credit intact). */
198
+ export function removePrimaryArtist(options: RemovePrimaryArtistOptions) {
199
+ const packageAddress = options.package ?? '@local-pkg/recording_credits';
200
+ const argumentsTypes = [
201
+ null,
202
+ null,
203
+ '0x2::object::ID'
204
+ ] satisfies (string | null)[];
205
+ const parameterNames = ["self", "cap", "partyId"];
206
+ return (tx: Transaction) => tx.moveCall({
207
+ package: packageAddress,
208
+ module: 'recording_credits',
209
+ function: 'remove_primary_artist',
210
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
211
+ typeArguments: options.typeArguments
212
+ });
213
+ }
214
+ export interface AddFeaturedArtistArguments {
215
+ self: RawTransactionArgument<string>;
216
+ cap: RawTransactionArgument<string>;
217
+ party: RawTransactionArgument<string>;
218
+ }
219
+ export interface AddFeaturedArtistOptions {
220
+ package?: string;
221
+ arguments: AddFeaturedArtistArguments | [
222
+ self: RawTransactionArgument<string>,
223
+ cap: RawTransactionArgument<string>,
224
+ party: RawTransactionArgument<string>
225
+ ];
226
+ typeArguments: [
227
+ string,
228
+ string
229
+ ];
230
+ }
231
+ /**
232
+ * Designates an already-credited party as a featured artist. The party must be
233
+ * credited and not already a primary or featured artist.
234
+ */
235
+ export function addFeaturedArtist(options: AddFeaturedArtistOptions) {
236
+ const packageAddress = options.package ?? '@local-pkg/recording_credits';
237
+ const argumentsTypes = [
238
+ null,
239
+ null,
240
+ null
241
+ ] satisfies (string | null)[];
242
+ const parameterNames = ["self", "cap", "party"];
243
+ return (tx: Transaction) => tx.moveCall({
244
+ package: packageAddress,
245
+ module: 'recording_credits',
246
+ function: 'add_featured_artist',
247
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
248
+ typeArguments: options.typeArguments
249
+ });
250
+ }
251
+ export interface RemoveFeaturedArtistArguments {
252
+ self: RawTransactionArgument<string>;
253
+ cap: RawTransactionArgument<string>;
254
+ partyId: RawTransactionArgument<string>;
255
+ }
256
+ export interface RemoveFeaturedArtistOptions {
257
+ package?: string;
258
+ arguments: RemoveFeaturedArtistArguments | [
259
+ self: RawTransactionArgument<string>,
260
+ cap: RawTransactionArgument<string>,
261
+ partyId: RawTransactionArgument<string>
262
+ ];
263
+ typeArguments: [
264
+ string,
265
+ string
266
+ ];
267
+ }
268
+ /** Removes a party from the featured-artist set (leaves the credit intact). */
269
+ export function removeFeaturedArtist(options: RemoveFeaturedArtistOptions) {
270
+ const packageAddress = options.package ?? '@local-pkg/recording_credits';
271
+ const argumentsTypes = [
272
+ null,
273
+ null,
274
+ '0x2::object::ID'
275
+ ] satisfies (string | null)[];
276
+ const parameterNames = ["self", "cap", "partyId"];
277
+ return (tx: Transaction) => tx.moveCall({
278
+ package: packageAddress,
279
+ module: 'recording_credits',
280
+ function: 'remove_featured_artist',
281
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
282
+ typeArguments: options.typeArguments
283
+ });
284
+ }
285
+ export interface HasCreditsArguments {
286
+ self: RawTransactionArgument<string>;
287
+ }
288
+ export interface HasCreditsOptions {
289
+ package?: string;
290
+ arguments: HasCreditsArguments | [
291
+ self: RawTransactionArgument<string>
292
+ ];
293
+ typeArguments: [
294
+ string,
295
+ string
296
+ ];
297
+ }
298
+ /** Returns whether a credits record has been attached to this recording yet. */
299
+ export function hasCredits(options: HasCreditsOptions) {
300
+ const packageAddress = options.package ?? '@local-pkg/recording_credits';
301
+ const argumentsTypes = [
302
+ null
303
+ ] satisfies (string | null)[];
304
+ const parameterNames = ["self"];
305
+ return (tx: Transaction) => tx.moveCall({
306
+ package: packageAddress,
307
+ module: 'recording_credits',
308
+ function: 'has_credits',
309
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
310
+ typeArguments: options.typeArguments
311
+ });
312
+ }
313
+ export interface CreditsArguments {
314
+ self: RawTransactionArgument<string>;
315
+ }
316
+ export interface CreditsOptions {
317
+ package?: string;
318
+ arguments: CreditsArguments | [
319
+ self: RawTransactionArgument<string>
320
+ ];
321
+ typeArguments: [
322
+ string,
323
+ string
324
+ ];
325
+ }
326
+ /** Returns the party-to-credit map. Aborts if no credits are attached. */
327
+ export function credits(options: CreditsOptions) {
328
+ const packageAddress = options.package ?? '@local-pkg/recording_credits';
329
+ const argumentsTypes = [
330
+ null
331
+ ] satisfies (string | null)[];
332
+ const parameterNames = ["self"];
333
+ return (tx: Transaction) => tx.moveCall({
334
+ package: packageAddress,
335
+ module: 'recording_credits',
336
+ function: 'credits',
337
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
338
+ typeArguments: options.typeArguments
339
+ });
340
+ }
341
+ export interface PrimaryArtistIdsArguments {
342
+ self: RawTransactionArgument<string>;
343
+ }
344
+ export interface PrimaryArtistIdsOptions {
345
+ package?: string;
346
+ arguments: PrimaryArtistIdsArguments | [
347
+ self: RawTransactionArgument<string>
348
+ ];
349
+ typeArguments: [
350
+ string,
351
+ string
352
+ ];
353
+ }
354
+ /** Returns the primary-artist IDs. Aborts if no credits are attached. */
355
+ export function primaryArtistIds(options: PrimaryArtistIdsOptions) {
356
+ const packageAddress = options.package ?? '@local-pkg/recording_credits';
357
+ const argumentsTypes = [
358
+ null
359
+ ] satisfies (string | null)[];
360
+ const parameterNames = ["self"];
361
+ return (tx: Transaction) => tx.moveCall({
362
+ package: packageAddress,
363
+ module: 'recording_credits',
364
+ function: 'primary_artist_ids',
365
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
366
+ typeArguments: options.typeArguments
367
+ });
368
+ }
369
+ export interface FeaturedArtistIdsArguments {
370
+ self: RawTransactionArgument<string>;
371
+ }
372
+ export interface FeaturedArtistIdsOptions {
373
+ package?: string;
374
+ arguments: FeaturedArtistIdsArguments | [
375
+ self: RawTransactionArgument<string>
376
+ ];
377
+ typeArguments: [
378
+ string,
379
+ string
380
+ ];
381
+ }
382
+ /** Returns the featured-artist IDs. Aborts if no credits are attached. */
383
+ export function featuredArtistIds(options: FeaturedArtistIdsOptions) {
384
+ const packageAddress = options.package ?? '@local-pkg/recording_credits';
385
+ const argumentsTypes = [
386
+ null
387
+ ] satisfies (string | null)[];
388
+ const parameterNames = ["self"];
389
+ return (tx: Transaction) => tx.moveCall({
390
+ package: packageAddress,
391
+ module: 'recording_credits',
392
+ function: 'featured_artist_ids',
393
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
394
+ typeArguments: options.typeArguments
395
+ });
396
+ }
397
+ export interface IsPrimaryArtistArguments {
398
+ self: RawTransactionArgument<string>;
399
+ partyId: RawTransactionArgument<string>;
400
+ }
401
+ export interface IsPrimaryArtistOptions {
402
+ package?: string;
403
+ arguments: IsPrimaryArtistArguments | [
404
+ self: RawTransactionArgument<string>,
405
+ partyId: RawTransactionArgument<string>
406
+ ];
407
+ typeArguments: [
408
+ string,
409
+ string
410
+ ];
411
+ }
412
+ /** Returns whether the party is a primary artist (false if no credits attached). */
413
+ export function isPrimaryArtist(options: IsPrimaryArtistOptions) {
414
+ const packageAddress = options.package ?? '@local-pkg/recording_credits';
415
+ const argumentsTypes = [
416
+ null,
417
+ '0x2::object::ID'
418
+ ] satisfies (string | null)[];
419
+ const parameterNames = ["self", "partyId"];
420
+ return (tx: Transaction) => tx.moveCall({
421
+ package: packageAddress,
422
+ module: 'recording_credits',
423
+ function: 'is_primary_artist',
424
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
425
+ typeArguments: options.typeArguments
426
+ });
427
+ }
428
+ export interface IsFeaturedArtistArguments {
429
+ self: RawTransactionArgument<string>;
430
+ partyId: RawTransactionArgument<string>;
431
+ }
432
+ export interface IsFeaturedArtistOptions {
433
+ package?: string;
434
+ arguments: IsFeaturedArtistArguments | [
435
+ self: RawTransactionArgument<string>,
436
+ partyId: RawTransactionArgument<string>
437
+ ];
438
+ typeArguments: [
439
+ string,
440
+ string
441
+ ];
442
+ }
443
+ /** Returns whether the party is a featured artist (false if no credits attached). */
444
+ export function isFeaturedArtist(options: IsFeaturedArtistOptions) {
445
+ const packageAddress = options.package ?? '@local-pkg/recording_credits';
446
+ const argumentsTypes = [
447
+ null,
448
+ '0x2::object::ID'
449
+ ] satisfies (string | null)[];
450
+ const parameterNames = ["self", "partyId"];
451
+ return (tx: Transaction) => tx.moveCall({
452
+ package: packageAddress,
453
+ module: 'recording_credits',
454
+ function: 'is_featured_artist',
455
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
456
+ typeArguments: options.typeArguments
457
+ });
458
+ }