@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,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,229 @@
1
+
2
+ import {
3
+ bcs,
4
+ type BcsType,
5
+ type TypeTag,
6
+ TypeTagSerializer,
7
+ BcsStruct,
8
+ BcsEnum,
9
+ BcsTuple,
10
+ } from '@mysten/sui/bcs';
11
+ import { normalizeSuiAddress } from '@mysten/sui/utils';
12
+ import { type TransactionArgument, isArgument } from '@mysten/sui/transactions';
13
+ import { type ClientWithCoreApi, type SuiClientTypes } from '@mysten/sui/client';
14
+
15
+ const MOVE_STDLIB_ADDRESS = normalizeSuiAddress('0x1');
16
+ const SUI_FRAMEWORK_ADDRESS = normalizeSuiAddress('0x2');
17
+
18
+ export type RawTransactionArgument<T> = T | TransactionArgument;
19
+
20
+ export type GetOptions<Include extends Omit<SuiClientTypes.ObjectInclude, 'content'> = {}> =
21
+ SuiClientTypes.GetObjectOptions<Include> & { client: ClientWithCoreApi };
22
+
23
+ export type GetManyOptions<Include extends Omit<SuiClientTypes.ObjectInclude, 'content'> = {}> =
24
+ SuiClientTypes.GetObjectsOptions<Include> & { client: ClientWithCoreApi };
25
+
26
+ export function getPureBcsSchema(typeTag: string | TypeTag): BcsType<any> | null {
27
+ const parsedTag = typeof typeTag === 'string' ? TypeTagSerializer.parseFromStr(typeTag) : typeTag;
28
+
29
+ if ('u8' in parsedTag) {
30
+ return bcs.U8;
31
+ } else if ('u16' in parsedTag) {
32
+ return bcs.U16;
33
+ } else if ('u32' in parsedTag) {
34
+ return bcs.U32;
35
+ } else if ('u64' in parsedTag) {
36
+ return bcs.U64;
37
+ } else if ('u128' in parsedTag) {
38
+ return bcs.U128;
39
+ } else if ('u256' in parsedTag) {
40
+ return bcs.U256;
41
+ } else if ('address' in parsedTag) {
42
+ return bcs.Address;
43
+ } else if ('bool' in parsedTag) {
44
+ return bcs.Bool;
45
+ } else if ('vector' in parsedTag) {
46
+ const type = getPureBcsSchema(parsedTag.vector);
47
+ return type ? bcs.vector(type) : null;
48
+ } else if ('struct' in parsedTag) {
49
+ const structTag = parsedTag.struct;
50
+ const pkg = normalizeSuiAddress(structTag.address);
51
+
52
+ if (pkg === MOVE_STDLIB_ADDRESS) {
53
+ if (
54
+ (structTag.module === 'ascii' || structTag.module === 'string') &&
55
+ structTag.name === 'String'
56
+ ) {
57
+ return bcs.String;
58
+ }
59
+
60
+ if (structTag.module === 'option' && structTag.name === 'Option') {
61
+ const inner = structTag.typeParams[0];
62
+ const type = inner ? getPureBcsSchema(inner) : null;
63
+ return type ? bcs.option(type) : null;
64
+ }
65
+ }
66
+
67
+ if (
68
+ pkg === SUI_FRAMEWORK_ADDRESS &&
69
+ structTag.module === 'object' &&
70
+ (structTag.name === 'ID' || structTag.name === 'UID')
71
+ ) {
72
+ return bcs.Address;
73
+ }
74
+ }
75
+
76
+ return null;
77
+ }
78
+
79
+ export function normalizeMoveArguments(
80
+ args: unknown[] | object,
81
+ argTypes: readonly (string | null)[],
82
+ parameterNames?: string[],
83
+ ) {
84
+ const argLen = Array.isArray(args) ? args.length : Object.keys(args).length;
85
+ if (parameterNames && argLen !== parameterNames.length) {
86
+ throw new Error(
87
+ `Invalid number of arguments, expected ${parameterNames.length}, got ${argLen}`,
88
+ );
89
+ }
90
+
91
+ const normalizedArgs: TransactionArgument[] = [];
92
+
93
+ let index = 0;
94
+ for (const argType of argTypes) {
95
+ if (argType === '0x2::clock::Clock') {
96
+ normalizedArgs.push((tx) => tx.object.clock());
97
+ continue;
98
+ }
99
+
100
+ if (argType === '0x2::random::Random') {
101
+ normalizedArgs.push((tx) => tx.object.random());
102
+ continue;
103
+ }
104
+
105
+ if (argType === '0x2::deny_list::DenyList') {
106
+ normalizedArgs.push((tx) => tx.object.denyList());
107
+ continue;
108
+ }
109
+
110
+ if (argType === '0x3::sui_system::SuiSystemState') {
111
+ normalizedArgs.push((tx) => tx.object.system());
112
+ continue;
113
+ }
114
+
115
+ let arg;
116
+ if (Array.isArray(args)) {
117
+ if (index >= args.length) {
118
+ throw new Error(
119
+ `Invalid number of arguments, expected at least ${index + 1}, got ${args.length}`,
120
+ );
121
+ }
122
+ arg = args[index];
123
+ } else {
124
+ if (!parameterNames) {
125
+ throw new Error(`Expected arguments to be passed as an array`);
126
+ }
127
+ const name = parameterNames[index];
128
+ arg = args[name as keyof typeof args];
129
+
130
+ if (arg === undefined) {
131
+ throw new Error(`Parameter ${name} is required`);
132
+ }
133
+ }
134
+
135
+ index += 1;
136
+
137
+ if (typeof arg === 'function' || isArgument(arg)) {
138
+ normalizedArgs.push(arg as TransactionArgument);
139
+ continue;
140
+ }
141
+
142
+ const bcsType = argType === null ? null : getPureBcsSchema(argType);
143
+
144
+ if (bcsType) {
145
+ const bytes = bcsType.serialize(arg as never);
146
+ normalizedArgs.push((tx) => tx.pure(bytes));
147
+ continue;
148
+ }
149
+
150
+ if (typeof arg === 'string') {
151
+ normalizedArgs.push((tx) => tx.object(arg));
152
+ continue;
153
+ }
154
+
155
+ throw new Error(`Invalid argument ${stringify(arg)} for type ${argType}`);
156
+ }
157
+
158
+ return normalizedArgs;
159
+ }
160
+
161
+ export class MoveStruct<
162
+ T extends Record<string, BcsType<any>>,
163
+ const Name extends string = string,
164
+ > extends BcsStruct<T, Name> {
165
+ async get<Include extends Omit<SuiClientTypes.ObjectInclude, 'content' | 'json'> = {}>({
166
+ objectId,
167
+ ...options
168
+ }: GetOptions<Include>): Promise<
169
+ SuiClientTypes.Object<Include & { content: true, json: true }> & { json: BcsStruct<T>['$inferType'] }
170
+ > {
171
+ const [res] = await this.getMany<Include>({
172
+ ...options,
173
+ objectIds: [objectId],
174
+ });
175
+
176
+ if (!res) {
177
+ throw new Error(`No object found for id ${objectId}`);
178
+ }
179
+
180
+ return res;
181
+ }
182
+
183
+ async getMany<Include extends Omit<SuiClientTypes.ObjectInclude, 'content' | 'json'> = {}>({
184
+ client,
185
+ ...options
186
+ }: GetManyOptions<Include>): Promise<
187
+ Array<SuiClientTypes.Object<Include & { content: true, json: true }> & { json: BcsStruct<T>['$inferType'] }>
188
+ > {
189
+ const response = (await client.core.getObjects({
190
+ ...options,
191
+ include: {
192
+ ...options.include,
193
+ content: true,
194
+ },
195
+ })) as SuiClientTypes.GetObjectsResponse<Include & { content: true }>;
196
+
197
+ return response.objects.map((obj) => {
198
+ if (obj instanceof Error) {
199
+ throw obj;
200
+ }
201
+
202
+ return {
203
+ ...obj,
204
+ json: this.parse(obj.content),
205
+ };
206
+ });
207
+ }
208
+ }
209
+
210
+ export class MoveEnum<
211
+ T extends Record<string, BcsType<any> | null>,
212
+ const Name extends string,
213
+ > extends BcsEnum<T, Name> {}
214
+
215
+ export class MoveTuple<
216
+ const T extends readonly BcsType<any>[],
217
+ const Name extends string,
218
+ > extends BcsTuple<T, Name> {}
219
+
220
+ function stringify(val: unknown) {
221
+ if (typeof val === 'object') {
222
+ return JSON.stringify(val, (val: unknown) => val);
223
+ }
224
+ if (typeof val === 'bigint') {
225
+ return val.toString();
226
+ }
227
+
228
+ return val;
229
+ }
@@ -0,0 +1,30 @@
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
+ // Core miso protocol.
8
+ export * as composition from "./contracts/miso/composition.ts";
9
+ export * as recording from "./contracts/miso/recording.ts";
10
+ export * as release from "./contracts/miso/release.ts";
11
+ export * as deal from "./contracts/miso/deal.ts";
12
+ export * as track from "./contracts/miso/track.ts";
13
+
14
+ // Royalty-pool extension (base lib + per-work extensions).
15
+ export * as royaltyPool from "./contracts/royalty_pool/pool.ts";
16
+ export * as royaltyPoolStake from "./contracts/royalty_pool/stake.ts";
17
+ export * as compositionRoyaltyPool from "./contracts/composition_royalty_pool/composition_royalty_pool.ts";
18
+ export * as recordingRoyaltyPool from "./contracts/recording_royalty_pool/recording_royalty_pool.ts";
19
+
20
+ // Cover art (the CoverArt value type + the release attachment extension).
21
+ export * as coverArt from "./contracts/cover_art/cover_art.ts";
22
+ export * as releaseCoverArt from "./contracts/release_cover_art/release_cover_art.ts";
23
+
24
+ // Credits extensions (per-work credit stores + their role vocabularies).
25
+ export * as compositionCredits from "./contracts/composition_credits/composition_credits.ts";
26
+ export * as compositionPartyRole from "./contracts/composition_credits/composition_party_role.ts";
27
+ export * as recordingCredits from "./contracts/recording_credits/recording_credits.ts";
28
+ export * as recordingPartyRole from "./contracts/recording_credits/recording_party_role.ts";
29
+ export * as releaseCredits from "./contracts/release_credits/release_credits.ts";
30
+ export * as releasePartyRole from "./contracts/release_credits/release_party_role.ts";