@misofm/sdk 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (166) hide show
  1. package/README.md +138 -10
  2. package/dist/contracts/composition_credits/composition_credits.d.ts +181 -0
  3. package/dist/contracts/composition_credits/composition_credits.d.ts.map +1 -0
  4. package/dist/contracts/composition_credits/composition_credits.js +109 -0
  5. package/dist/contracts/composition_credits/composition_credits.js.map +1 -0
  6. package/dist/contracts/composition_credits/composition_party_role.d.ts +119 -0
  7. package/dist/contracts/composition_credits/composition_party_role.d.ts.map +1 -0
  8. package/dist/contracts/composition_credits/composition_party_role.js +139 -0
  9. package/dist/contracts/composition_credits/composition_party_role.js.map +1 -0
  10. package/dist/contracts/composition_credits/deps/miso_credit/credit.d.ts +24 -0
  11. package/dist/contracts/composition_credits/deps/miso_credit/credit.d.ts.map +1 -0
  12. package/dist/contracts/composition_credits/deps/miso_credit/credit.js +23 -0
  13. package/dist/contracts/composition_credits/deps/miso_credit/credit.js.map +1 -0
  14. package/dist/contracts/composition_credits/deps/sui/vec_map.d.ts +37 -0
  15. package/dist/contracts/composition_credits/deps/sui/vec_map.d.ts.map +1 -0
  16. package/dist/contracts/composition_credits/deps/sui/vec_map.js +28 -0
  17. package/dist/contracts/composition_credits/deps/sui/vec_map.js.map +1 -0
  18. package/dist/contracts/composition_royalty_pool/composition_royalty_pool.d.ts +87 -0
  19. package/dist/contracts/composition_royalty_pool/composition_royalty_pool.d.ts.map +1 -0
  20. package/dist/contracts/composition_royalty_pool/composition_royalty_pool.js +80 -0
  21. package/dist/contracts/composition_royalty_pool/composition_royalty_pool.js.map +1 -0
  22. package/dist/contracts/cover_art/cover_art.d.ts +85 -0
  23. package/dist/contracts/cover_art/cover_art.d.ts.map +1 -0
  24. package/dist/contracts/cover_art/cover_art.js +68 -0
  25. package/dist/contracts/cover_art/cover_art.js.map +1 -0
  26. package/dist/contracts/cover_art/deps/ori/walrus_data.d.ts +52 -0
  27. package/dist/contracts/cover_art/deps/ori/walrus_data.d.ts.map +1 -0
  28. package/dist/contracts/cover_art/deps/ori/walrus_data.js +37 -0
  29. package/dist/contracts/cover_art/deps/ori/walrus_data.js.map +1 -0
  30. package/dist/contracts/recording_credits/deps/miso_credit/credit.d.ts +24 -0
  31. package/dist/contracts/recording_credits/deps/miso_credit/credit.d.ts.map +1 -0
  32. package/dist/contracts/recording_credits/deps/miso_credit/credit.js +23 -0
  33. package/dist/contracts/recording_credits/deps/miso_credit/credit.js.map +1 -0
  34. package/dist/contracts/recording_credits/deps/sui/vec_map.d.ts +37 -0
  35. package/dist/contracts/recording_credits/deps/sui/vec_map.d.ts.map +1 -0
  36. package/dist/contracts/recording_credits/deps/sui/vec_map.js +28 -0
  37. package/dist/contracts/recording_credits/deps/sui/vec_map.js.map +1 -0
  38. package/dist/contracts/recording_credits/deps/sui/vec_set.d.ts +21 -0
  39. package/dist/contracts/recording_credits/deps/sui/vec_set.d.ts.map +1 -0
  40. package/dist/contracts/recording_credits/deps/sui/vec_set.js +20 -0
  41. package/dist/contracts/recording_credits/deps/sui/vec_set.js.map +1 -0
  42. package/dist/contracts/recording_credits/recording_credits.d.ts +2313 -0
  43. package/dist/contracts/recording_credits/recording_credits.d.ts.map +1 -0
  44. package/dist/contracts/recording_credits/recording_credits.js +270 -0
  45. package/dist/contracts/recording_credits/recording_credits.js.map +1 -0
  46. package/dist/contracts/recording_credits/recording_party_role.d.ts +1174 -0
  47. package/dist/contracts/recording_credits/recording_party_role.d.ts.map +1 -0
  48. package/dist/contracts/recording_credits/recording_party_role.js +692 -0
  49. package/dist/contracts/recording_credits/recording_party_role.js.map +1 -0
  50. package/dist/contracts/recording_royalty_pool/recording_royalty_pool.d.ts +90 -0
  51. package/dist/contracts/recording_royalty_pool/recording_royalty_pool.d.ts.map +1 -0
  52. package/dist/contracts/recording_royalty_pool/recording_royalty_pool.js +80 -0
  53. package/dist/contracts/recording_royalty_pool/recording_royalty_pool.js.map +1 -0
  54. package/dist/contracts/release_cover_art/deps/0x340057f2174fb59e4626742dd2b46c662237837b6187450cb59e4976ce7eac78/walrus_data.d.ts +52 -0
  55. package/dist/contracts/release_cover_art/deps/0x340057f2174fb59e4626742dd2b46c662237837b6187450cb59e4976ce7eac78/walrus_data.d.ts.map +1 -0
  56. package/dist/contracts/release_cover_art/deps/0x340057f2174fb59e4626742dd2b46c662237837b6187450cb59e4976ce7eac78/walrus_data.js +37 -0
  57. package/dist/contracts/release_cover_art/deps/0x340057f2174fb59e4626742dd2b46c662237837b6187450cb59e4976ce7eac78/walrus_data.js.map +1 -0
  58. package/dist/contracts/release_cover_art/deps/cover_art/cover_art.d.ts +46 -0
  59. package/dist/contracts/release_cover_art/deps/cover_art/cover_art.d.ts.map +1 -0
  60. package/dist/contracts/release_cover_art/deps/cover_art/cover_art.js +21 -0
  61. package/dist/contracts/release_cover_art/deps/cover_art/cover_art.js.map +1 -0
  62. package/dist/contracts/release_cover_art/deps/per_track/per_track.d.ts +33 -0
  63. package/dist/contracts/release_cover_art/deps/per_track/per_track.d.ts.map +1 -0
  64. package/dist/contracts/release_cover_art/deps/per_track/per_track.js +32 -0
  65. package/dist/contracts/release_cover_art/deps/per_track/per_track.js.map +1 -0
  66. package/dist/contracts/release_cover_art/release_cover_art.d.ts +300 -0
  67. package/dist/contracts/release_cover_art/release_cover_art.d.ts.map +1 -0
  68. package/dist/contracts/release_cover_art/release_cover_art.js +168 -0
  69. package/dist/contracts/release_cover_art/release_cover_art.js.map +1 -0
  70. package/dist/contracts/release_credits/deps/miso_credit/credit.d.ts +24 -0
  71. package/dist/contracts/release_credits/deps/miso_credit/credit.d.ts.map +1 -0
  72. package/dist/contracts/release_credits/deps/miso_credit/credit.js +23 -0
  73. package/dist/contracts/release_credits/deps/miso_credit/credit.js.map +1 -0
  74. package/dist/contracts/release_credits/deps/sui/vec_map.d.ts +37 -0
  75. package/dist/contracts/release_credits/deps/sui/vec_map.d.ts.map +1 -0
  76. package/dist/contracts/release_credits/deps/sui/vec_map.js +28 -0
  77. package/dist/contracts/release_credits/deps/sui/vec_map.js.map +1 -0
  78. package/dist/contracts/release_credits/release_credits.d.ts +142 -0
  79. package/dist/contracts/release_credits/release_credits.d.ts.map +1 -0
  80. package/dist/contracts/release_credits/release_credits.js +108 -0
  81. package/dist/contracts/release_credits/release_credits.js.map +1 -0
  82. package/dist/contracts/release_credits/release_party_role.d.ts +58 -0
  83. package/dist/contracts/release_credits/release_party_role.d.ts.map +1 -0
  84. package/dist/contracts/release_credits/release_party_role.js +66 -0
  85. package/dist/contracts/release_credits/release_party_role.js.map +1 -0
  86. package/dist/contracts/royalty_pool/deps/std/type_name.d.ts +18 -0
  87. package/dist/contracts/royalty_pool/deps/std/type_name.d.ts.map +1 -0
  88. package/dist/contracts/royalty_pool/deps/std/type_name.js +20 -0
  89. package/dist/contracts/royalty_pool/deps/std/type_name.js.map +1 -0
  90. package/dist/contracts/royalty_pool/deps/sui/balance.d.ts +13 -0
  91. package/dist/contracts/royalty_pool/deps/sui/balance.d.ts.map +1 -0
  92. package/dist/contracts/royalty_pool/deps/sui/balance.js +15 -0
  93. package/dist/contracts/royalty_pool/deps/sui/balance.js.map +1 -0
  94. package/dist/contracts/royalty_pool/deps/sui/vec_map.d.ts +37 -0
  95. package/dist/contracts/royalty_pool/deps/sui/vec_map.d.ts.map +1 -0
  96. package/dist/contracts/royalty_pool/deps/sui/vec_map.js +28 -0
  97. package/dist/contracts/royalty_pool/deps/sui/vec_map.js.map +1 -0
  98. package/dist/contracts/royalty_pool/pool.d.ts +358 -0
  99. package/dist/contracts/royalty_pool/pool.d.ts.map +1 -0
  100. package/dist/contracts/royalty_pool/pool.js +352 -0
  101. package/dist/contracts/royalty_pool/pool.js.map +1 -0
  102. package/dist/contracts/royalty_pool/stake.d.ts +202 -0
  103. package/dist/contracts/royalty_pool/stake.d.ts.map +1 -0
  104. package/dist/contracts/royalty_pool/stake.js +197 -0
  105. package/dist/contracts/royalty_pool/stake.js.map +1 -0
  106. package/dist/contracts.d.ts +16 -0
  107. package/dist/contracts.d.ts.map +1 -0
  108. package/dist/contracts.js +29 -0
  109. package/dist/contracts.js.map +1 -0
  110. package/dist/cover.d.ts +48 -0
  111. package/dist/cover.d.ts.map +1 -0
  112. package/dist/cover.js +68 -0
  113. package/dist/cover.js.map +1 -0
  114. package/dist/credits.d.ts +171 -0
  115. package/dist/credits.d.ts.map +1 -0
  116. package/dist/credits.js +360 -0
  117. package/dist/credits.js.map +1 -0
  118. package/dist/extensions/royalty-pool.d.ts +32 -0
  119. package/dist/extensions/royalty-pool.d.ts.map +1 -0
  120. package/dist/extensions/royalty-pool.js +33 -0
  121. package/dist/extensions/royalty-pool.js.map +1 -0
  122. package/dist/index.d.ts +4 -0
  123. package/dist/index.d.ts.map +1 -1
  124. package/dist/index.js +17 -3
  125. package/dist/index.js.map +1 -1
  126. package/dist/internal.d.ts +4 -0
  127. package/dist/internal.d.ts.map +1 -0
  128. package/dist/internal.js +18 -0
  129. package/dist/internal.js.map +1 -0
  130. package/dist/release-graph.d.ts.map +1 -1
  131. package/dist/release-graph.js +5 -4
  132. package/dist/release-graph.js.map +1 -1
  133. package/package.json +14 -2
  134. package/src/contracts/composition_credits/composition_credits.ts +169 -0
  135. package/src/contracts/composition_credits/composition_party_role.ts +189 -0
  136. package/src/contracts/composition_credits/deps/miso_credit/credit.ts +27 -0
  137. package/src/contracts/composition_credits/deps/sui/vec_map.ts +33 -0
  138. package/src/contracts/composition_royalty_pool/composition_royalty_pool.ts +135 -0
  139. package/src/contracts/cover_art/cover_art.ts +99 -0
  140. package/src/contracts/cover_art/deps/ori/walrus_data.ts +36 -0
  141. package/src/contracts/recording_credits/deps/miso_credit/credit.ts +27 -0
  142. package/src/contracts/recording_credits/deps/sui/vec_map.ts +33 -0
  143. package/src/contracts/recording_credits/deps/sui/vec_set.ts +21 -0
  144. package/src/contracts/recording_credits/recording_credits.ts +458 -0
  145. package/src/contracts/recording_credits/recording_party_role.ts +1041 -0
  146. package/src/contracts/recording_royalty_pool/recording_royalty_pool.ts +138 -0
  147. package/src/contracts/release_cover_art/deps/0x340057f2174fb59e4626742dd2b46c662237837b6187450cb59e4976ce7eac78/walrus_data.ts +36 -0
  148. package/src/contracts/release_cover_art/deps/cover_art/cover_art.ts +23 -0
  149. package/src/contracts/release_cover_art/deps/per_track/per_track.ts +36 -0
  150. package/src/contracts/release_cover_art/release_cover_art.ts +251 -0
  151. package/src/contracts/release_credits/deps/miso_credit/credit.ts +27 -0
  152. package/src/contracts/release_credits/deps/sui/vec_map.ts +33 -0
  153. package/src/contracts/release_credits/release_credits.ts +156 -0
  154. package/src/contracts/release_credits/release_party_role.ts +87 -0
  155. package/src/contracts/royalty_pool/deps/std/type_name.ts +22 -0
  156. package/src/contracts/royalty_pool/deps/sui/balance.ts +17 -0
  157. package/src/contracts/royalty_pool/deps/sui/vec_map.ts +33 -0
  158. package/src/contracts/royalty_pool/pool.ts +577 -0
  159. package/src/contracts/royalty_pool/stake.ts +317 -0
  160. package/src/contracts.ts +33 -0
  161. package/src/cover.ts +140 -0
  162. package/src/credits.ts +651 -0
  163. package/src/extensions/royalty-pool.ts +90 -0
  164. package/src/index.ts +19 -3
  165. package/src/internal.ts +19 -0
  166. package/src/release-graph.ts +5 -10
@@ -0,0 +1,317 @@
1
+ /**************************************************************
2
+ * THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
3
+ **************************************************************/
4
+
5
+
6
+ /**
7
+ * A position holding share tokens registered against a `RoyaltyPool`.
8
+ *
9
+ * Stakes are owned objects with an immutable balance — to increase a holder's
10
+ * total staked amount, mint additional Stake objects rather than modify an
11
+ * existing one. This mirrors Sui's native staking model.
12
+ *
13
+ * Each stake tracks the royalty pools it is currently registered with via an
14
+ * inline `VecMap<TypeName, Registration>`, keyed by the pool's `Currency`
15
+ * `TypeName`. The stake cannot be destroyed while any registrations remain. Pool
16
+ * registrations are mutated by `royalty_pool::pool` through the package-private
17
+ * accessors below.
18
+ */
19
+
20
+ import { MoveStruct, normalizeMoveArguments, type RawTransactionArgument } from '../utils/index.js';
21
+ import { bcs } from '@mysten/sui/bcs';
22
+ import { type Transaction, type TransactionArgument } from '@mysten/sui/transactions';
23
+ import * as balance_1 from './deps/sui/balance.js';
24
+ import * as vec_map from './deps/sui/vec_map.js';
25
+ import * as type_name from './deps/std/type_name.js';
26
+ const $moduleName = '@local-pkg/royalty_pool::stake';
27
+ export const Registration = new MoveStruct({ name: `${$moduleName}::Registration`, fields: {
28
+ pool_id: bcs.Address,
29
+ last_claim_index: bcs.u256()
30
+ } });
31
+ export const Stake = new MoveStruct({ name: `${$moduleName}::Stake<phantom Share>`, fields: {
32
+ id: bcs.Address,
33
+ /** The staked balance. Immutable after creation. */
34
+ balance: balance_1.Balance,
35
+ /**
36
+ * Active royalty-pool registrations, keyed by `Currency` `TypeName`. Must be empty
37
+ * to destroy.
38
+ */
39
+ registrations: vec_map.VecMap(type_name.TypeName, Registration)
40
+ } });
41
+ export const StakeCreatedEvent = new MoveStruct({ name: `${$moduleName}::StakeCreatedEvent<phantom Share>`, fields: {
42
+ stake_id: bcs.Address,
43
+ amount: bcs.u64()
44
+ } });
45
+ export const StakeDestroyedEvent = new MoveStruct({ name: `${$moduleName}::StakeDestroyedEvent<phantom Share>`, fields: {
46
+ stake_id: bcs.Address,
47
+ amount: bcs.u64()
48
+ } });
49
+ export interface NewArguments {
50
+ balance: TransactionArgument;
51
+ }
52
+ export interface NewOptions {
53
+ package?: string;
54
+ arguments: NewArguments | [
55
+ balance: TransactionArgument
56
+ ];
57
+ typeArguments: [
58
+ string
59
+ ];
60
+ }
61
+ /**
62
+ * Create a new stake with the given balance.
63
+ *
64
+ * Aborts if `balance` is zero.
65
+ */
66
+ export function _new(options: NewOptions) {
67
+ const packageAddress = options.package ?? '@local-pkg/royalty_pool';
68
+ const argumentsTypes = [
69
+ null
70
+ ] satisfies (string | null)[];
71
+ const parameterNames = ["balance"];
72
+ return (tx: Transaction) => tx.moveCall({
73
+ package: packageAddress,
74
+ module: 'stake',
75
+ function: 'new',
76
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
77
+ typeArguments: options.typeArguments
78
+ });
79
+ }
80
+ export interface DestroyArguments {
81
+ stake: RawTransactionArgument<string>;
82
+ }
83
+ export interface DestroyOptions {
84
+ package?: string;
85
+ arguments: DestroyArguments | [
86
+ stake: RawTransactionArgument<string>
87
+ ];
88
+ typeArguments: [
89
+ string
90
+ ];
91
+ }
92
+ /**
93
+ * Destroy a stake and reclaim its balance.
94
+ *
95
+ * Aborts if the stake is still registered with any royalty pools.
96
+ */
97
+ export function destroy(options: DestroyOptions) {
98
+ const packageAddress = options.package ?? '@local-pkg/royalty_pool';
99
+ const argumentsTypes = [
100
+ null
101
+ ] satisfies (string | null)[];
102
+ const parameterNames = ["stake"];
103
+ return (tx: Transaction) => tx.moveCall({
104
+ package: packageAddress,
105
+ module: 'stake',
106
+ function: 'destroy',
107
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
108
+ typeArguments: options.typeArguments
109
+ });
110
+ }
111
+ export interface IdArguments {
112
+ self: RawTransactionArgument<string>;
113
+ }
114
+ export interface IdOptions {
115
+ package?: string;
116
+ arguments: IdArguments | [
117
+ self: RawTransactionArgument<string>
118
+ ];
119
+ typeArguments: [
120
+ string
121
+ ];
122
+ }
123
+ export function id(options: IdOptions) {
124
+ const packageAddress = options.package ?? '@local-pkg/royalty_pool';
125
+ const argumentsTypes = [
126
+ null
127
+ ] satisfies (string | null)[];
128
+ const parameterNames = ["self"];
129
+ return (tx: Transaction) => tx.moveCall({
130
+ package: packageAddress,
131
+ module: 'stake',
132
+ function: 'id',
133
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
134
+ typeArguments: options.typeArguments
135
+ });
136
+ }
137
+ export interface BalanceArguments {
138
+ self: RawTransactionArgument<string>;
139
+ }
140
+ export interface BalanceOptions {
141
+ package?: string;
142
+ arguments: BalanceArguments | [
143
+ self: RawTransactionArgument<string>
144
+ ];
145
+ typeArguments: [
146
+ string
147
+ ];
148
+ }
149
+ export function balance(options: BalanceOptions) {
150
+ const packageAddress = options.package ?? '@local-pkg/royalty_pool';
151
+ const argumentsTypes = [
152
+ null
153
+ ] satisfies (string | null)[];
154
+ const parameterNames = ["self"];
155
+ return (tx: Transaction) => tx.moveCall({
156
+ package: packageAddress,
157
+ module: 'stake',
158
+ function: 'balance',
159
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
160
+ typeArguments: options.typeArguments
161
+ });
162
+ }
163
+ export interface ValueArguments {
164
+ self: RawTransactionArgument<string>;
165
+ }
166
+ export interface ValueOptions {
167
+ package?: string;
168
+ arguments: ValueArguments | [
169
+ self: RawTransactionArgument<string>
170
+ ];
171
+ typeArguments: [
172
+ string
173
+ ];
174
+ }
175
+ export function value(options: ValueOptions) {
176
+ const packageAddress = options.package ?? '@local-pkg/royalty_pool';
177
+ const argumentsTypes = [
178
+ null
179
+ ] satisfies (string | null)[];
180
+ const parameterNames = ["self"];
181
+ return (tx: Transaction) => tx.moveCall({
182
+ package: packageAddress,
183
+ module: 'stake',
184
+ function: 'value',
185
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
186
+ typeArguments: options.typeArguments
187
+ });
188
+ }
189
+ export interface RegistrationCountArguments {
190
+ self: RawTransactionArgument<string>;
191
+ }
192
+ export interface RegistrationCountOptions {
193
+ package?: string;
194
+ arguments: RegistrationCountArguments | [
195
+ self: RawTransactionArgument<string>
196
+ ];
197
+ typeArguments: [
198
+ string
199
+ ];
200
+ }
201
+ /** Number of royalty pools this stake is currently registered with. */
202
+ export function registrationCount(options: RegistrationCountOptions) {
203
+ const packageAddress = options.package ?? '@local-pkg/royalty_pool';
204
+ const argumentsTypes = [
205
+ null
206
+ ] satisfies (string | null)[];
207
+ const parameterNames = ["self"];
208
+ return (tx: Transaction) => tx.moveCall({
209
+ package: packageAddress,
210
+ module: 'stake',
211
+ function: 'registration_count',
212
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
213
+ typeArguments: options.typeArguments
214
+ });
215
+ }
216
+ export interface HasRegistrationArguments {
217
+ self: RawTransactionArgument<string>;
218
+ currency: TransactionArgument;
219
+ }
220
+ export interface HasRegistrationOptions {
221
+ package?: string;
222
+ arguments: HasRegistrationArguments | [
223
+ self: RawTransactionArgument<string>,
224
+ currency: TransactionArgument
225
+ ];
226
+ typeArguments: [
227
+ string
228
+ ];
229
+ }
230
+ export function hasRegistration(options: HasRegistrationOptions) {
231
+ const packageAddress = options.package ?? '@local-pkg/royalty_pool';
232
+ const argumentsTypes = [
233
+ null,
234
+ null
235
+ ] satisfies (string | null)[];
236
+ const parameterNames = ["self", "currency"];
237
+ return (tx: Transaction) => tx.moveCall({
238
+ package: packageAddress,
239
+ module: 'stake',
240
+ function: 'has_registration',
241
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
242
+ typeArguments: options.typeArguments
243
+ });
244
+ }
245
+ export interface GetRegistrationArguments {
246
+ self: RawTransactionArgument<string>;
247
+ currency: TransactionArgument;
248
+ }
249
+ export interface GetRegistrationOptions {
250
+ package?: string;
251
+ arguments: GetRegistrationArguments | [
252
+ self: RawTransactionArgument<string>,
253
+ currency: TransactionArgument
254
+ ];
255
+ typeArguments: [
256
+ string
257
+ ];
258
+ }
259
+ export function getRegistration(options: GetRegistrationOptions) {
260
+ const packageAddress = options.package ?? '@local-pkg/royalty_pool';
261
+ const argumentsTypes = [
262
+ null,
263
+ null
264
+ ] satisfies (string | null)[];
265
+ const parameterNames = ["self", "currency"];
266
+ return (tx: Transaction) => tx.moveCall({
267
+ package: packageAddress,
268
+ module: 'stake',
269
+ function: 'get_registration',
270
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
271
+ typeArguments: options.typeArguments
272
+ });
273
+ }
274
+ export interface RegistrationPoolIdArguments {
275
+ r: TransactionArgument;
276
+ }
277
+ export interface RegistrationPoolIdOptions {
278
+ package?: string;
279
+ arguments: RegistrationPoolIdArguments | [
280
+ r: TransactionArgument
281
+ ];
282
+ }
283
+ export function registrationPoolId(options: RegistrationPoolIdOptions) {
284
+ const packageAddress = options.package ?? '@local-pkg/royalty_pool';
285
+ const argumentsTypes = [
286
+ null
287
+ ] satisfies (string | null)[];
288
+ const parameterNames = ["r"];
289
+ return (tx: Transaction) => tx.moveCall({
290
+ package: packageAddress,
291
+ module: 'stake',
292
+ function: 'registration_pool_id',
293
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
294
+ });
295
+ }
296
+ export interface RegistrationLastClaimIndexArguments {
297
+ r: TransactionArgument;
298
+ }
299
+ export interface RegistrationLastClaimIndexOptions {
300
+ package?: string;
301
+ arguments: RegistrationLastClaimIndexArguments | [
302
+ r: TransactionArgument
303
+ ];
304
+ }
305
+ export function registrationLastClaimIndex(options: RegistrationLastClaimIndexOptions) {
306
+ const packageAddress = options.package ?? '@local-pkg/royalty_pool';
307
+ const argumentsTypes = [
308
+ null
309
+ ] satisfies (string | null)[];
310
+ const parameterNames = ["r"];
311
+ return (tx: Transaction) => tx.moveCall({
312
+ package: packageAddress,
313
+ module: 'stake',
314
+ function: 'registration_last_claim_index',
315
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
316
+ });
317
+ }
@@ -0,0 +1,33 @@
1
+ // Copyright (c) Miso Labs, Inc.
2
+ // SPDX-License-Identifier: Apache-2.0
3
+
4
+ // Barrel for the codegen-generated, ABI-bound bindings (BCS structs + type-safe
5
+ // Move calls). Re-exported from the package root as the `contracts` namespace.
6
+ //
7
+ // PLATFORM + EXTENSION packages. The protocol core (`miso`: Composition,
8
+ // Recording, Release, Deal, Track) generates into `@misonetwork/sdk` and is
9
+ // re-exported from ITS `contracts` namespace — import it from there rather than
10
+ // mirroring it here.
11
+
12
+ // The record production line (pressing runs + their per-currency listings).
13
+ export * as pressing from "./contracts/miso_pressing/pressing.ts";
14
+ export * as listing from "./contracts/miso_pressing/listing.ts";
15
+ export * as certificate from "./contracts/miso_pressing/certificate.ts";
16
+
17
+ // Royalty-pool extension (base lib + per-work extensions).
18
+ export * as royaltyPool from "./contracts/royalty_pool/pool.ts";
19
+ export * as royaltyPoolStake from "./contracts/royalty_pool/stake.ts";
20
+ export * as compositionRoyaltyPool from "./contracts/composition_royalty_pool/composition_royalty_pool.ts";
21
+ export * as recordingRoyaltyPool from "./contracts/recording_royalty_pool/recording_royalty_pool.ts";
22
+
23
+ // Cover art (the CoverArt value type + the release attachment extension).
24
+ export * as coverArt from "./contracts/cover_art/cover_art.ts";
25
+ export * as releaseCoverArt from "./contracts/release_cover_art/release_cover_art.ts";
26
+
27
+ // Credits extensions (per-work credit stores + their role vocabularies).
28
+ export * as compositionCredits from "./contracts/composition_credits/composition_credits.ts";
29
+ export * as compositionPartyRole from "./contracts/composition_credits/composition_party_role.ts";
30
+ export * as recordingCredits from "./contracts/recording_credits/recording_credits.ts";
31
+ export * as recordingPartyRole from "./contracts/recording_credits/recording_party_role.ts";
32
+ export * as releaseCredits from "./contracts/release_credits/release_credits.ts";
33
+ export * as releasePartyRole from "./contracts/release_credits/release_party_role.ts";
package/src/cover.ts ADDED
@@ -0,0 +1,140 @@
1
+ // Copyright (c) Miso Labs, Inc.
2
+ // SPDX-License-Identifier: Apache-2.0
3
+
4
+ // Release cover art. A cover is a still image (optionally an animation) stored as
5
+ // a Walrus blob and referenced on-chain via `ori::WalrusData`. We build the ref
6
+ // (`ori::walrus_data::new_blob`, a raw call — ori is an external dep), wrap it in a
7
+ // `cover_art::CoverArt`, and attach it to the Release with
8
+ // `release_cover_art::set_cover` (gated by the ReleaseAdminCap).
9
+ //
10
+ // Blob ids are passed as `u256` (decimal string or bigint) — the CLI converts the
11
+ // base64url Walrus blob id to u256 before calling.
12
+ //
13
+ // The `Release` being covered is a protocol object; the cover is a platform
14
+ // opinion attached to it through the release's cap-gated `uid_mut` hook, which is
15
+ // why this module ships from `@misofm/sdk` rather than the protocol SDK.
16
+
17
+ import type { ClientWithCoreApi } from "@mysten/sui/client";
18
+ import { bcs } from "@mysten/sui/bcs";
19
+ import { deriveDynamicFieldID } from "@mysten/sui/utils";
20
+ import type { TxThunk } from "./transactions.ts";
21
+ import { OPTION_NONE, OPTION_SOME } from "./internal.ts";
22
+ import { isNotFound } from "./queries.ts";
23
+ import * as coverArt from "./contracts/cover_art/cover_art.ts";
24
+ import * as releaseCoverArt from "./contracts/release_cover_art/release_cover_art.ts";
25
+
26
+ export interface SetReleaseCoverParams {
27
+ /** The `Release` object to attach the cover to. */
28
+ releaseId: string;
29
+ /** The release's `ReleaseAdminCap`. */
30
+ releaseAdminCapId: string;
31
+ /** Walrus blob id of the still cover image, as `u256` (decimal string or bigint). */
32
+ stillBlobId: bigint | string;
33
+ /** Optional animated-cover Walrus blob id (`u256`); omit for a still-only cover. */
34
+ animatedBlobId?: bigint | string | null;
35
+ /** `cover_art` package — home of the `CoverArt` value type (`cover_art::new`). */
36
+ coverArtPackageId: string;
37
+ /** `release_cover_art` package — home of the `set_cover` extension entry point. */
38
+ releaseCoverArtPackageId: string;
39
+ /** `ori` package (home of `walrus_data::new_blob` / the `WalrusData` type). */
40
+ oriPackageId: string;
41
+ }
42
+
43
+ /** Sets (or replaces) a release's album-level cover from Walrus blob ids. */
44
+ export function setReleaseCover(p: SetReleaseCoverParams): TxThunk {
45
+ return (tx) => {
46
+ const walrusType = `${p.oriPackageId}::walrus_data::WalrusData`;
47
+ const blob = (id: bigint | string) =>
48
+ tx.moveCall({ target: `${p.oriPackageId}::walrus_data::new_blob`, arguments: [tx.pure.u256(id)] });
49
+
50
+ const still = blob(p.stillBlobId);
51
+ const animated =
52
+ p.animatedBlobId == null
53
+ ? tx.moveCall({ target: OPTION_NONE, typeArguments: [walrusType] })
54
+ : tx.moveCall({ target: OPTION_SOME, typeArguments: [walrusType], arguments: [blob(p.animatedBlobId)] });
55
+
56
+ const cover = tx.add(coverArt._new({ package: p.coverArtPackageId, arguments: [still, animated] }));
57
+ tx.add(
58
+ releaseCoverArt.setCover({
59
+ package: p.releaseCoverArtPackageId,
60
+ arguments: [p.releaseId, p.releaseAdminCapId, cover],
61
+ }),
62
+ );
63
+ };
64
+ }
65
+
66
+ // ── Reads ────────────────────────────────────────────────────────────────────
67
+
68
+ /**
69
+ * A normalized reference to a cover image's Walrus data. Blob ids are returned as
70
+ * `u256` decimal strings (the on-chain form); callers convert to a base64url
71
+ * aggregator URL with `@unconfirmed/ori` (`u256ToB64Url` / `walrusDataUrl`).
72
+ */
73
+ export type CoverImageRef =
74
+ | { kind: "blob"; blobId: string }
75
+ | { kind: "quiltPatch"; quiltId: string; version: number; startIndex: number; endIndex: number };
76
+
77
+ /** A release's album-level cover: a still image and an optional animation. */
78
+ export interface ReleaseCoverView {
79
+ still: CoverImageRef;
80
+ animated: CoverImageRef | null;
81
+ }
82
+
83
+ // The cover is a dynamic field on the release UID under an empty `ExtensionKey()`
84
+ // (Move's implicit `dummy_field: bool` → one `false` byte). The stored value is a
85
+ // `Field { id, name: ExtensionKey, value: ReleaseCoverArt }`.
86
+ const CoverArtField = bcs.struct("Field", {
87
+ id: bcs.Address,
88
+ name: releaseCoverArt.ExtensionKey,
89
+ value: releaseCoverArt.ReleaseCoverArt,
90
+ });
91
+ const COVER_ART_KEY_BYTES = releaseCoverArt.ExtensionKey.serialize([false]).toBytes();
92
+
93
+ /** A parsed `ori::WalrusData` value (a MoveEnum: `Blob` or `QuiltPatch`). */
94
+ type ParsedWalrusData =
95
+ | { $kind: "Blob"; Blob: [string | number | bigint, unknown] }
96
+ | { $kind: "QuiltPatch"; QuiltPatch: [string | number | bigint, number, number, number] };
97
+
98
+ function toCoverImageRef(wd: ParsedWalrusData): CoverImageRef {
99
+ if (wd.$kind === "Blob") return { kind: "blob", blobId: String(wd.Blob[0]) };
100
+ const [quiltId, version, startIndex, endIndex] = wd.QuiltPatch;
101
+ return { kind: "quiltPatch", quiltId: String(quiltId), version, startIndex, endIndex };
102
+ }
103
+
104
+ /**
105
+ * Reads a release's album-level cover (the `release_cover_art` extension), or
106
+ * `null` if no cover is attached. Derives the `ExtensionKey` dynamic field on the
107
+ * release, parses the `ReleaseCoverArt`, and returns the still (+ optional
108
+ * animation) as normalized Walrus refs for the app's featured-pressing card.
109
+ */
110
+ export async function getReleaseCover(
111
+ client: ClientWithCoreApi,
112
+ releaseId: string,
113
+ releaseCoverArtPackageId: string,
114
+ ): Promise<ReleaseCoverView | null> {
115
+ const fieldId = deriveDynamicFieldID(
116
+ releaseId,
117
+ `${releaseCoverArtPackageId}::release_cover_art::ExtensionKey`,
118
+ COVER_ART_KEY_BYTES,
119
+ );
120
+
121
+ let content: Uint8Array | null;
122
+ try {
123
+ const { object } = await client.core.getObject({ objectId: fieldId, include: { content: true } });
124
+ content = object?.content ?? null;
125
+ } catch (e) {
126
+ if (isNotFound(e)) return null;
127
+ throw e;
128
+ }
129
+ if (!content) return null;
130
+
131
+ const cover = CoverArtField.parse(content).value.cover as
132
+ | { still: ParsedWalrusData; animated: ParsedWalrusData | null }
133
+ | null;
134
+ if (!cover) return null;
135
+
136
+ return {
137
+ still: toCoverImageRef(cover.still),
138
+ animated: cover.animated ? toCoverImageRef(cover.animated) : null,
139
+ };
140
+ }