@misofm/platform 0.27.0 → 0.28.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 (425) hide show
  1. package/README.md +309 -204
  2. package/dist/Miso.d.ts +403 -0
  3. package/dist/Miso.d.ts.map +1 -0
  4. package/dist/Miso.js +455 -0
  5. package/dist/Miso.js.map +1 -0
  6. package/dist/auth.d.ts +11 -1
  7. package/dist/auth.d.ts.map +1 -1
  8. package/dist/auth.js +16 -3
  9. package/dist/auth.js.map +1 -1
  10. package/dist/catalog.d.ts +8 -5
  11. package/dist/catalog.d.ts.map +1 -1
  12. package/dist/catalog.js +36 -19
  13. package/dist/catalog.js.map +1 -1
  14. package/dist/client.d.ts +52 -443
  15. package/dist/client.d.ts.map +1 -1
  16. package/dist/client.js +58 -775
  17. package/dist/client.js.map +1 -1
  18. package/dist/contracts/composition_credits/composition_credits.d.ts +38 -48
  19. package/dist/contracts/composition_credits/composition_credits.d.ts.map +1 -1
  20. package/dist/contracts/composition_credits/composition_credits.js +20 -4
  21. package/dist/contracts/composition_credits/composition_credits.js.map +1 -1
  22. package/dist/contracts/composition_routed_stake/composition_routed_stake.d.ts +64 -1
  23. package/dist/contracts/composition_routed_stake/composition_routed_stake.d.ts.map +1 -1
  24. package/dist/contracts/composition_routed_stake/composition_routed_stake.js +66 -1
  25. package/dist/contracts/composition_routed_stake/composition_routed_stake.js.map +1 -1
  26. package/dist/contracts/composition_royalty_pool/composition_royalty_pool.d.ts +52 -4
  27. package/dist/contracts/composition_royalty_pool/composition_royalty_pool.d.ts.map +1 -1
  28. package/dist/contracts/composition_royalty_pool/composition_royalty_pool.js +52 -4
  29. package/dist/contracts/composition_royalty_pool/composition_royalty_pool.js.map +1 -1
  30. package/dist/contracts/composition_royalty_pool_plugin/composition_royalty_pool_plugin.d.ts +63 -1
  31. package/dist/contracts/composition_royalty_pool_plugin/composition_royalty_pool_plugin.d.ts.map +1 -1
  32. package/dist/contracts/composition_royalty_pool_plugin/composition_royalty_pool_plugin.js +63 -1
  33. package/dist/contracts/composition_royalty_pool_plugin/composition_royalty_pool_plugin.js.map +1 -1
  34. package/dist/contracts/genre/genre.d.ts +10 -1
  35. package/dist/contracts/genre/genre.d.ts.map +1 -1
  36. package/dist/contracts/genre/genre.js +8 -1
  37. package/dist/contracts/genre/genre.js.map +1 -1
  38. package/dist/contracts/miso_pay/deps/std/type_name.d.ts.map +1 -0
  39. package/dist/contracts/miso_pay/deps/std/type_name.js.map +1 -0
  40. package/dist/contracts/miso_pay/pay.d.ts +209 -0
  41. package/dist/contracts/miso_pay/pay.d.ts.map +1 -0
  42. package/dist/contracts/miso_pay/pay.js +195 -0
  43. package/dist/contracts/miso_pay/pay.js.map +1 -0
  44. package/dist/contracts/party_cta/party_cta.d.ts +49 -3
  45. package/dist/contracts/party_cta/party_cta.d.ts.map +1 -1
  46. package/dist/contracts/party_cta/party_cta.js +27 -5
  47. package/dist/contracts/party_cta/party_cta.js.map +1 -1
  48. package/dist/contracts/party_genre/party_genre.d.ts +25 -0
  49. package/dist/contracts/party_genre/party_genre.d.ts.map +1 -1
  50. package/dist/contracts/party_genre/party_genre.js +14 -3
  51. package/dist/contracts/party_genre/party_genre.js.map +1 -1
  52. package/dist/contracts/party_media/party_media.d.ts +19 -3
  53. package/dist/contracts/party_media/party_media.d.ts.map +1 -1
  54. package/dist/contracts/party_media/party_media.js +20 -4
  55. package/dist/contracts/party_media/party_media.js.map +1 -1
  56. package/dist/contracts/party_platform_link/party_platform_link.d.ts +15 -7
  57. package/dist/contracts/party_platform_link/party_platform_link.d.ts.map +1 -1
  58. package/dist/contracts/party_platform_link/party_platform_link.js +15 -7
  59. package/dist/contracts/party_platform_link/party_platform_link.js.map +1 -1
  60. package/dist/contracts/party_profile/party_profile.d.ts +63 -8
  61. package/dist/contracts/party_profile/party_profile.d.ts.map +1 -1
  62. package/dist/contracts/party_profile/party_profile.js +33 -8
  63. package/dist/contracts/party_profile/party_profile.js.map +1 -1
  64. package/dist/contracts/party_roles/party_roles.d.ts +28 -3
  65. package/dist/contracts/party_roles/party_roles.d.ts.map +1 -1
  66. package/dist/contracts/party_roles/party_roles.js +19 -4
  67. package/dist/contracts/party_roles/party_roles.js.map +1 -1
  68. package/dist/contracts/party_tags/party_tags.d.ts +23 -3
  69. package/dist/contracts/party_tags/party_tags.d.ts.map +1 -1
  70. package/dist/contracts/party_tags/party_tags.js +16 -4
  71. package/dist/contracts/party_tags/party_tags.js.map +1 -1
  72. package/dist/contracts/party_wallet/party_wallet.d.ts +4 -1
  73. package/dist/contracts/party_wallet/party_wallet.d.ts.map +1 -1
  74. package/dist/contracts/party_wallet/party_wallet.js +2 -1
  75. package/dist/contracts/party_wallet/party_wallet.js.map +1 -1
  76. package/dist/contracts/platform_link/platform_link.d.ts +207 -0
  77. package/dist/contracts/platform_link/platform_link.d.ts.map +1 -0
  78. package/dist/contracts/platform_link/platform_link.js +209 -0
  79. package/dist/contracts/platform_link/platform_link.js.map +1 -0
  80. package/dist/contracts/record/pressing.d.ts +53 -7
  81. package/dist/contracts/record/pressing.d.ts.map +1 -1
  82. package/dist/contracts/record/pressing.js +50 -4
  83. package/dist/contracts/record/pressing.js.map +1 -1
  84. package/dist/contracts/record/record.d.ts +14 -0
  85. package/dist/contracts/record/record.d.ts.map +1 -1
  86. package/dist/contracts/record/record.js +15 -1
  87. package/dist/contracts/record/record.js.map +1 -1
  88. package/dist/contracts/record_shop/listing.d.ts +80 -35
  89. package/dist/contracts/record_shop/listing.d.ts.map +1 -1
  90. package/dist/contracts/record_shop/listing.js +76 -13
  91. package/dist/contracts/record_shop/listing.js.map +1 -1
  92. package/dist/contracts/recording_advisory/recording_advisory.d.ts +15 -15
  93. package/dist/contracts/recording_advisory/recording_advisory.d.ts.map +1 -1
  94. package/dist/contracts/recording_advisory/recording_advisory.js +15 -8
  95. package/dist/contracts/recording_advisory/recording_advisory.js.map +1 -1
  96. package/dist/contracts/recording_credits/recording_credits.d.ts +95 -1350
  97. package/dist/contracts/recording_credits/recording_credits.d.ts.map +1 -1
  98. package/dist/contracts/recording_credits/recording_credits.js +63 -12
  99. package/dist/contracts/recording_credits/recording_credits.js.map +1 -1
  100. package/dist/contracts/recording_engine_session/recording_engine_session.d.ts +30 -49
  101. package/dist/contracts/recording_engine_session/recording_engine_session.d.ts.map +1 -1
  102. package/dist/contracts/recording_engine_session/recording_engine_session.js +19 -4
  103. package/dist/contracts/recording_engine_session/recording_engine_session.js.map +1 -1
  104. package/dist/contracts/recording_genre/recording_genre.d.ts +67 -9
  105. package/dist/contracts/recording_genre/recording_genre.d.ts.map +1 -1
  106. package/dist/contracts/recording_genre/recording_genre.js +53 -9
  107. package/dist/contracts/recording_genre/recording_genre.js.map +1 -1
  108. package/dist/contracts/recording_language/recording_language.d.ts +29 -5
  109. package/dist/contracts/recording_language/recording_language.d.ts.map +1 -1
  110. package/dist/contracts/recording_language/recording_language.js +18 -5
  111. package/dist/contracts/recording_language/recording_language.js.map +1 -1
  112. package/dist/contracts/recording_master_reference/recording_master_reference.d.ts +25 -15
  113. package/dist/contracts/recording_master_reference/recording_master_reference.d.ts.map +1 -1
  114. package/dist/contracts/recording_master_reference/recording_master_reference.js +18 -5
  115. package/dist/contracts/recording_master_reference/recording_master_reference.js.map +1 -1
  116. package/dist/contracts/recording_royalty_pool/recording_royalty_pool.d.ts +55 -4
  117. package/dist/contracts/recording_royalty_pool/recording_royalty_pool.d.ts.map +1 -1
  118. package/dist/contracts/recording_royalty_pool/recording_royalty_pool.js +55 -4
  119. package/dist/contracts/recording_royalty_pool/recording_royalty_pool.js.map +1 -1
  120. package/dist/contracts/recording_royalty_pool_plugin/recording_royalty_pool_plugin.d.ts +66 -1
  121. package/dist/contracts/recording_royalty_pool_plugin/recording_royalty_pool_plugin.d.ts.map +1 -1
  122. package/dist/contracts/recording_royalty_pool_plugin/recording_royalty_pool_plugin.js +66 -1
  123. package/dist/contracts/recording_royalty_pool_plugin/recording_royalty_pool_plugin.js.map +1 -1
  124. package/dist/contracts/recording_streaming_transcode/recording_streaming_transcode.d.ts +12 -9
  125. package/dist/contracts/recording_streaming_transcode/recording_streaming_transcode.d.ts.map +1 -1
  126. package/dist/contracts/recording_streaming_transcode/recording_streaming_transcode.js +11 -4
  127. package/dist/contracts/recording_streaming_transcode/recording_streaming_transcode.js.map +1 -1
  128. package/dist/contracts/release_cover_art/release_cover_art.d.ts +168 -74
  129. package/dist/contracts/release_cover_art/release_cover_art.d.ts.map +1 -1
  130. package/dist/contracts/release_cover_art/release_cover_art.js +126 -10
  131. package/dist/contracts/release_cover_art/release_cover_art.js.map +1 -1
  132. package/dist/contracts/release_credits/release_credits.d.ts +24 -28
  133. package/dist/contracts/release_credits/release_credits.d.ts.map +1 -1
  134. package/dist/contracts/release_credits/release_credits.js +18 -4
  135. package/dist/contracts/release_credits/release_credits.js.map +1 -1
  136. package/dist/contracts/release_description/release_description.d.ts +16 -5
  137. package/dist/contracts/release_description/release_description.d.ts.map +1 -1
  138. package/dist/contracts/release_description/release_description.js +9 -4
  139. package/dist/contracts/release_description/release_description.js.map +1 -1
  140. package/dist/contracts/release_dsp_link/release_dsp_link.d.ts +130 -160
  141. package/dist/contracts/release_dsp_link/release_dsp_link.d.ts.map +1 -1
  142. package/dist/contracts/release_dsp_link/release_dsp_link.js +74 -19
  143. package/dist/contracts/release_dsp_link/release_dsp_link.js.map +1 -1
  144. package/dist/contracts/release_genre/release_genre.d.ts +66 -11
  145. package/dist/contracts/release_genre/release_genre.d.ts.map +1 -1
  146. package/dist/contracts/release_genre/release_genre.js +52 -11
  147. package/dist/contracts/release_genre/release_genre.js.map +1 -1
  148. package/dist/contracts/release_kind/release_kind.d.ts +28 -5
  149. package/dist/contracts/release_kind/release_kind.d.ts.map +1 -1
  150. package/dist/contracts/release_kind/release_kind.js +19 -4
  151. package/dist/contracts/release_kind/release_kind.js.map +1 -1
  152. package/dist/contracts/release_revenue_distributor/release_revenue_distributor.d.ts +17 -0
  153. package/dist/contracts/release_revenue_distributor/release_revenue_distributor.d.ts.map +1 -1
  154. package/dist/contracts/release_revenue_distributor/release_revenue_distributor.js +15 -0
  155. package/dist/contracts/release_revenue_distributor/release_revenue_distributor.js.map +1 -1
  156. package/dist/contracts/release_revenue_distributor_plugin/release_revenue_distributor_plugin.d.ts +37 -1
  157. package/dist/contracts/release_revenue_distributor_plugin/release_revenue_distributor_plugin.d.ts.map +1 -1
  158. package/dist/contracts/release_revenue_distributor_plugin/release_revenue_distributor_plugin.js +37 -1
  159. package/dist/contracts/release_revenue_distributor_plugin/release_revenue_distributor_plugin.js.map +1 -1
  160. package/dist/contracts/routed_stake/routed_stake.d.ts +78 -6
  161. package/dist/contracts/routed_stake/routed_stake.d.ts.map +1 -1
  162. package/dist/contracts/routed_stake/routed_stake.js +79 -7
  163. package/dist/contracts/routed_stake/routed_stake.js.map +1 -1
  164. package/dist/contracts/royalty_pool/pool.d.ts +117 -27
  165. package/dist/contracts/royalty_pool/pool.d.ts.map +1 -1
  166. package/dist/contracts/royalty_pool/pool.js +117 -28
  167. package/dist/contracts/royalty_pool/pool.js.map +1 -1
  168. package/dist/contracts/royalty_pool/stake.d.ts +3 -0
  169. package/dist/contracts/royalty_pool/stake.d.ts.map +1 -1
  170. package/dist/contracts/royalty_pool/stake.js +5 -2
  171. package/dist/contracts/royalty_pool/stake.js.map +1 -1
  172. package/dist/contracts/share/share.d.ts +80 -0
  173. package/dist/contracts/share/share.d.ts.map +1 -0
  174. package/dist/contracts/share/share.js +72 -0
  175. package/dist/contracts/share/share.js.map +1 -0
  176. package/dist/contracts/vault/vault.d.ts +51 -0
  177. package/dist/contracts/vault/vault.d.ts.map +1 -1
  178. package/dist/contracts/vault/vault.js +55 -4
  179. package/dist/contracts/vault/vault.js.map +1 -1
  180. package/dist/contracts.d.ts +60 -0
  181. package/dist/contracts.d.ts.map +1 -1
  182. package/dist/contracts.js +17 -0
  183. package/dist/contracts.js.map +1 -1
  184. package/dist/cover.d.ts +5 -6
  185. package/dist/cover.d.ts.map +1 -1
  186. package/dist/cover.js +10 -10
  187. package/dist/cover.js.map +1 -1
  188. package/dist/credits.d.ts +12 -13
  189. package/dist/credits.d.ts.map +1 -1
  190. package/dist/credits.js +16 -10
  191. package/dist/credits.js.map +1 -1
  192. package/dist/deployments.d.ts +3 -3
  193. package/dist/deployments.d.ts.map +1 -1
  194. package/dist/deployments.js +2 -3
  195. package/dist/deployments.js.map +1 -1
  196. package/dist/errors.d.ts +24 -9
  197. package/dist/errors.d.ts.map +1 -1
  198. package/dist/errors.js +43 -16
  199. package/dist/errors.js.map +1 -1
  200. package/dist/events.d.ts +1687 -835
  201. package/dist/events.d.ts.map +1 -1
  202. package/dist/events.js +258 -39
  203. package/dist/events.js.map +1 -1
  204. package/dist/genre.d.ts +11 -12
  205. package/dist/genre.d.ts.map +1 -1
  206. package/dist/genre.js +5 -3
  207. package/dist/genre.js.map +1 -1
  208. package/dist/index.d.ts +3 -3
  209. package/dist/index.d.ts.map +1 -1
  210. package/dist/index.js +7 -2
  211. package/dist/index.js.map +1 -1
  212. package/dist/packages.d.ts +1047 -1695
  213. package/dist/packages.d.ts.map +1 -1
  214. package/dist/party/client.d.ts +113 -296
  215. package/dist/party/client.d.ts.map +1 -1
  216. package/dist/party/client.js +93 -178
  217. package/dist/party/client.js.map +1 -1
  218. package/dist/party/extensions/ctas.d.ts +3 -3
  219. package/dist/party/extensions/ctas.d.ts.map +1 -1
  220. package/dist/party/extensions/genres.d.ts +4 -4
  221. package/dist/party/extensions/genres.d.ts.map +1 -1
  222. package/dist/party/extensions/links.d.ts +5 -5
  223. package/dist/party/extensions/links.d.ts.map +1 -1
  224. package/dist/party/extensions/links.js.map +1 -1
  225. package/dist/party/extensions/media.d.ts +3 -3
  226. package/dist/party/extensions/media.d.ts.map +1 -1
  227. package/dist/party/extensions/profile.d.ts +3 -3
  228. package/dist/party/extensions/profile.d.ts.map +1 -1
  229. package/dist/party/extensions/roles.d.ts +4 -4
  230. package/dist/party/extensions/roles.d.ts.map +1 -1
  231. package/dist/party/extensions/roles.js.map +1 -1
  232. package/dist/party/extensions/tags.d.ts +4 -4
  233. package/dist/party/extensions/tags.d.ts.map +1 -1
  234. package/dist/party/index.d.ts +1 -1
  235. package/dist/party/index.d.ts.map +1 -1
  236. package/dist/party/index.js.map +1 -1
  237. package/dist/party/queries.d.ts +8 -8
  238. package/dist/party/queries.d.ts.map +1 -1
  239. package/dist/party/queries.js +83 -56
  240. package/dist/party/queries.js.map +1 -1
  241. package/dist/pressing.d.ts +13 -15
  242. package/dist/pressing.d.ts.map +1 -1
  243. package/dist/pressing.js +99 -29
  244. package/dist/pressing.js.map +1 -1
  245. package/dist/publication.d.ts +13 -6
  246. package/dist/publication.d.ts.map +1 -1
  247. package/dist/publication.js +26 -21
  248. package/dist/publication.js.map +1 -1
  249. package/dist/queries.js +3 -3
  250. package/dist/queries.js.map +1 -1
  251. package/dist/read/artist.d.ts +4 -3
  252. package/dist/read/artist.d.ts.map +1 -1
  253. package/dist/read/artist.js +24 -8
  254. package/dist/read/artist.js.map +1 -1
  255. package/dist/read/catalog.d.ts +17 -16
  256. package/dist/read/catalog.d.ts.map +1 -1
  257. package/dist/read/catalog.js +25 -11
  258. package/dist/read/catalog.js.map +1 -1
  259. package/dist/read/client.d.ts +41 -20
  260. package/dist/read/client.d.ts.map +1 -1
  261. package/dist/read/client.js +20 -12
  262. package/dist/read/client.js.map +1 -1
  263. package/dist/read/config.d.ts +25 -3
  264. package/dist/read/config.d.ts.map +1 -1
  265. package/dist/read/config.js +42 -25
  266. package/dist/read/config.js.map +1 -1
  267. package/dist/read/genres.d.ts +8 -3
  268. package/dist/read/genres.d.ts.map +1 -1
  269. package/dist/read/genres.js +23 -17
  270. package/dist/read/genres.js.map +1 -1
  271. package/dist/read/index.d.ts +1 -1
  272. package/dist/read/index.d.ts.map +1 -1
  273. package/dist/read/index.js +8 -6
  274. package/dist/read/index.js.map +1 -1
  275. package/dist/read/receipts.d.ts +5 -4
  276. package/dist/read/receipts.d.ts.map +1 -1
  277. package/dist/read/receipts.js +94 -46
  278. package/dist/read/receipts.js.map +1 -1
  279. package/dist/read/royalties.d.ts +6 -5
  280. package/dist/read/royalties.d.ts.map +1 -1
  281. package/dist/read/royalties.js +16 -9
  282. package/dist/read/royalties.js.map +1 -1
  283. package/dist/read/wallet.d.ts +23 -12
  284. package/dist/read/wallet.d.ts.map +1 -1
  285. package/dist/read/wallet.js +158 -177
  286. package/dist/read/wallet.js.map +1 -1
  287. package/dist/read/works.d.ts +6 -6
  288. package/dist/read/works.d.ts.map +1 -1
  289. package/dist/read/works.js +40 -26
  290. package/dist/read/works.js.map +1 -1
  291. package/dist/recording-extensions.d.ts +15 -16
  292. package/dist/recording-extensions.d.ts.map +1 -1
  293. package/dist/recording-extensions.js +12 -8
  294. package/dist/recording-extensions.js.map +1 -1
  295. package/dist/release-extensions.d.ts +5 -6
  296. package/dist/release-extensions.d.ts.map +1 -1
  297. package/dist/release-extensions.js +3 -2
  298. package/dist/release-extensions.js.map +1 -1
  299. package/dist/release-graph.d.ts +2 -2
  300. package/dist/release-graph.d.ts.map +1 -1
  301. package/dist/release-graph.js.map +1 -1
  302. package/dist/royalty.d.ts +4 -4
  303. package/dist/royalty.d.ts.map +1 -1
  304. package/dist/royalty.js +16 -7
  305. package/dist/royalty.js.map +1 -1
  306. package/dist/share.d.ts +58 -24
  307. package/dist/share.d.ts.map +1 -1
  308. package/dist/share.js +167 -92
  309. package/dist/share.js.map +1 -1
  310. package/dist/transactions.d.ts +15 -6
  311. package/dist/transactions.d.ts.map +1 -1
  312. package/dist/transactions.js +1 -0
  313. package/dist/transactions.js.map +1 -1
  314. package/dist/vault.d.ts +13 -3
  315. package/dist/vault.d.ts.map +1 -1
  316. package/dist/vault.js +22 -16
  317. package/dist/vault.js.map +1 -1
  318. package/package.json +9 -8
  319. package/src/Miso.ts +951 -0
  320. package/src/auth.ts +16 -3
  321. package/src/catalog.ts +58 -25
  322. package/src/client.ts +98 -1359
  323. package/src/contracts/composition_credits/composition_credits.ts +20 -4
  324. package/src/contracts/composition_routed_stake/composition_routed_stake.ts +67 -1
  325. package/src/contracts/composition_royalty_pool/composition_royalty_pool.ts +53 -4
  326. package/src/contracts/composition_royalty_pool_plugin/composition_royalty_pool_plugin.ts +64 -1
  327. package/src/contracts/genre/genre.ts +8 -1
  328. package/src/contracts/miso_pay/pay.ts +356 -0
  329. package/src/contracts/party_cta/party_cta.ts +27 -5
  330. package/src/contracts/party_genre/party_genre.ts +14 -3
  331. package/src/contracts/party_media/party_media.ts +20 -4
  332. package/src/contracts/party_platform_link/party_platform_link.ts +15 -7
  333. package/src/contracts/party_profile/party_profile.ts +33 -8
  334. package/src/contracts/party_roles/party_roles.ts +19 -4
  335. package/src/contracts/party_tags/party_tags.ts +16 -4
  336. package/src/contracts/party_wallet/party_wallet.ts +2 -1
  337. package/src/contracts/platform_link/platform_link.ts +322 -0
  338. package/src/contracts/record/pressing.ts +50 -4
  339. package/src/contracts/record/record.ts +15 -1
  340. package/src/contracts/record_shop/listing.ts +76 -13
  341. package/src/contracts/recording_advisory/recording_advisory.ts +15 -8
  342. package/src/contracts/recording_credits/recording_credits.ts +63 -12
  343. package/src/contracts/recording_engine_session/recording_engine_session.ts +19 -4
  344. package/src/contracts/recording_genre/recording_genre.ts +53 -9
  345. package/src/contracts/recording_language/recording_language.ts +18 -5
  346. package/src/contracts/recording_master_reference/recording_master_reference.ts +18 -5
  347. package/src/contracts/recording_royalty_pool/recording_royalty_pool.ts +56 -4
  348. package/src/contracts/recording_royalty_pool_plugin/recording_royalty_pool_plugin.ts +67 -1
  349. package/src/contracts/recording_streaming_transcode/recording_streaming_transcode.ts +11 -4
  350. package/src/contracts/release_cover_art/release_cover_art.ts +126 -10
  351. package/src/contracts/release_credits/release_credits.ts +18 -4
  352. package/src/contracts/release_description/release_description.ts +9 -4
  353. package/src/contracts/release_dsp_link/release_dsp_link.ts +74 -19
  354. package/src/contracts/release_genre/release_genre.ts +52 -11
  355. package/src/contracts/release_kind/release_kind.ts +19 -4
  356. package/src/contracts/release_revenue_distributor/release_revenue_distributor.ts +15 -0
  357. package/src/contracts/release_revenue_distributor_plugin/release_revenue_distributor_plugin.ts +38 -1
  358. package/src/contracts/routed_stake/routed_stake.ts +79 -7
  359. package/src/contracts/royalty_pool/pool.ts +140 -38
  360. package/src/contracts/royalty_pool/stake.ts +5 -2
  361. package/src/contracts/share/share.ts +97 -0
  362. package/src/contracts/vault/vault.ts +55 -4
  363. package/src/contracts.ts +18 -0
  364. package/src/cover.ts +14 -15
  365. package/src/credits.ts +27 -22
  366. package/src/deployments.ts +3 -4
  367. package/src/errors.ts +64 -34
  368. package/src/events.ts +260 -39
  369. package/src/genre.ts +15 -14
  370. package/src/index.ts +19 -10
  371. package/src/party/client.ts +217 -208
  372. package/src/party/extensions/ctas.ts +3 -3
  373. package/src/party/extensions/genres.ts +4 -4
  374. package/src/party/extensions/links.ts +7 -7
  375. package/src/party/extensions/media.ts +3 -3
  376. package/src/party/extensions/profile.ts +3 -3
  377. package/src/party/extensions/roles.ts +5 -5
  378. package/src/party/extensions/tags.ts +4 -4
  379. package/src/party/index.ts +0 -1
  380. package/src/party/queries.ts +90 -87
  381. package/src/pressing.ts +132 -89
  382. package/src/publication.ts +33 -32
  383. package/src/queries.ts +3 -3
  384. package/src/read/artist.ts +36 -17
  385. package/src/read/catalog.ts +68 -36
  386. package/src/read/client.ts +55 -30
  387. package/src/read/config.ts +55 -30
  388. package/src/read/genres.ts +22 -18
  389. package/src/read/index.ts +8 -6
  390. package/src/read/receipts.ts +130 -67
  391. package/src/read/royalties.ts +22 -10
  392. package/src/read/wallet.ts +226 -216
  393. package/src/read/works.ts +51 -44
  394. package/src/recording-extensions.ts +27 -24
  395. package/src/release-extensions.ts +7 -7
  396. package/src/release-graph.ts +2 -1
  397. package/src/royalty.ts +19 -25
  398. package/src/share.ts +197 -128
  399. package/src/transactions.ts +15 -8
  400. package/src/vault.ts +24 -31
  401. package/dist/contracts/record_shop/deps/std/type_name.d.ts.map +0 -1
  402. package/dist/contracts/record_shop/deps/std/type_name.js.map +0 -1
  403. package/dist/contracts/recording_language/deps/language_code/language_code.d.ts +0 -6
  404. package/dist/contracts/recording_language/deps/language_code/language_code.d.ts.map +0 -1
  405. package/dist/contracts/recording_language/deps/language_code/language_code.js +0 -8
  406. package/dist/contracts/recording_language/deps/language_code/language_code.js.map +0 -1
  407. package/dist/contracts/recording_master_reference/deps/ori/confidentiality.d.ts +0 -24
  408. package/dist/contracts/recording_master_reference/deps/ori/confidentiality.d.ts.map +0 -1
  409. package/dist/contracts/recording_master_reference/deps/ori/confidentiality.js +0 -24
  410. package/dist/contracts/recording_master_reference/deps/ori/confidentiality.js.map +0 -1
  411. package/dist/contracts/recording_master_reference/deps/ori/data.d.ts +0 -16
  412. package/dist/contracts/recording_master_reference/deps/ori/data.d.ts.map +0 -1
  413. package/dist/contracts/recording_master_reference/deps/ori/data.js +0 -12
  414. package/dist/contracts/recording_master_reference/deps/ori/data.js.map +0 -1
  415. package/dist/execute.d.ts +0 -32
  416. package/dist/execute.d.ts.map +0 -1
  417. package/dist/execute.js +0 -36
  418. package/dist/execute.js.map +0 -1
  419. package/src/contracts/recording_language/deps/language_code/language_code.ts +0 -8
  420. package/src/contracts/recording_master_reference/deps/ori/confidentiality.ts +0 -24
  421. package/src/contracts/recording_master_reference/deps/ori/data.ts +0 -12
  422. package/src/execute.ts +0 -56
  423. /package/dist/contracts/{record_shop → miso_pay}/deps/std/type_name.d.ts +0 -0
  424. /package/dist/contracts/{record_shop → miso_pay}/deps/std/type_name.js +0 -0
  425. /package/src/contracts/{record_shop → miso_pay}/deps/std/type_name.ts +0 -0
package/dist/royalty.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { Transaction, type TransactionArgument, type TransactionObjectArgument } from "@mysten/sui/transactions";
2
2
  import { Effect, Schema } from "effect";
3
- import { type BcsDecodeError, type SuiClient, type SuiRpcError } from "@misofm/effect";
3
+ import { Sui, type DecodeError, type ObjectUnavailable, type TransportError } from "@unconfirmed/sui-effect";
4
4
  declare const RoyaltyStakeRegistration_base: Schema.Class<RoyaltyStakeRegistration, Schema.Struct<{
5
5
  readonly currencyType: Schema.String;
6
6
  readonly poolId: Schema.String;
@@ -44,11 +44,11 @@ declare const RoutedStake_base: Schema.Class<RoutedStake, Schema.Struct<{
44
44
  export declare class RoutedStake extends RoutedStake_base {
45
45
  }
46
46
  /** One royalty pool by object ID, or `null` when no such object exists. */
47
- export declare const getRoyaltyPoolById: (poolId: string) => Effect.Effect<RoyaltyPool | null, BcsDecodeError | SuiRpcError, SuiClient>;
47
+ export declare const getRoyaltyPoolById: (poolId: string) => Effect.Effect<RoyaltyPool | null, DecodeError | ObjectUnavailable | TransportError, Sui>;
48
48
  /** One owned `Stake<Share>` by object ID, or `null` when no such object exists. */
49
- export declare const getRoyaltyStakeById: (stakeId: string) => Effect.Effect<RoyaltyStake | null, BcsDecodeError | SuiRpcError, SuiClient>;
49
+ export declare const getRoyaltyStakeById: (stakeId: string) => Effect.Effect<RoyaltyStake | null, DecodeError | ObjectUnavailable | TransportError, Sui>;
50
50
  /** One shared routed stake by object ID, or `null` when no such object exists. */
51
- export declare const getRoutedStakeById: (routedStakeId: string) => Effect.Effect<RoutedStake | null, BcsDecodeError | SuiRpcError, SuiClient>;
51
+ export declare const getRoutedStakeById: (routedStakeId: string) => Effect.Effect<RoutedStake | null, DecodeError | ObjectUnavailable | TransportError, Sui>;
52
52
  /** Deterministically derive the royalty-pool ID for a parent and type pair. */
53
53
  export declare function deriveRoyaltyPoolId(parentId: string, shareType: string, currencyType: string, royaltyPoolPackageId: string): string;
54
54
  /** Deterministically derive the routed-stake ID for a parent and stake share. */
@@ -1 +1 @@
1
- {"version":3,"file":"royalty.d.ts","sourceRoot":"","sources":["../src/royalty.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,WAAW,EAAE,KAAK,mBAAmB,EAAE,KAAK,yBAAyB,EAAE,MAAM,0BAA0B,CAAC;AAEjH,OAAO,EAAE,MAAM,EAAE,MAA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SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;IACrB,oBAAoB,EAAE,MAAM,CAAC;CAC9B,GACA,IAAI,CAWN;AAED,oFAAoF;AACpF,wBAAgB,mBAAmB,CACjC,EAAE,EAAE,WAAW,EACf,MAAM,EAAE;IACN,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;IACrB,oBAAoB,EAAE,MAAM,CAAC;CAC9B,GACA,yBAAyB,CAQ3B"}
package/dist/royalty.js CHANGED
@@ -8,7 +8,7 @@
8
8
  import { Transaction } from "@mysten/sui/transactions";
9
9
  import { deriveObjectID, normalizeStructTag } from "@mysten/sui/utils";
10
10
  import { Effect, Schema } from "effect";
11
- import { decodeBcs, getOptionalObjectContent } from "@misofm/effect";
11
+ import { ObjectId, Sui, SuiSchema } from "@unconfirmed/sui-effect";
12
12
  import { RoyaltyPool as RoyaltyPoolBcs } from "./contracts/royalty_pool/pool.js";
13
13
  import { Stake as RoyaltyStakeBcs } from "./contracts/royalty_pool/stake.js";
14
14
  import { RoutedStake as RoutedStakeBcs } from "./contracts/routed_stake/routed_stake.js";
@@ -89,24 +89,33 @@ function mapRoutedStake(routedStakeId, parsed) {
89
89
  }
90
90
  /** One royalty pool by object ID, or `null` when no such object exists. */
91
91
  export const getRoyaltyPoolById = Effect.fn("getRoyaltyPoolById")(function* (poolId) {
92
- const found = yield* getOptionalObjectContent(poolId);
92
+ const sui = yield* Sui;
93
+ const id = ObjectId.make(poolId);
94
+ const found = yield* sui.getObjectOption(id);
93
95
  if (found._tag === "None")
94
96
  return null;
95
- return yield* decodeBcs({ parse: (bytes) => mapRoyaltyPool(poolId, RoyaltyPoolBcs.parse(bytes)) }, RoyaltyPool, found.value.content, { type: "RoyaltyPool", objectId: poolId });
97
+ const parsed = yield* SuiSchema.decode(SuiSchema.bcs(RoyaltyPoolBcs), found.value.content, { objectId: id, actualType: found.value.type });
98
+ return new RoyaltyPool(mapRoyaltyPool(poolId, parsed));
96
99
  });
97
100
  /** One owned `Stake<Share>` by object ID, or `null` when no such object exists. */
98
101
  export const getRoyaltyStakeById = Effect.fn("getRoyaltyStakeById")(function* (stakeId) {
99
- const found = yield* getOptionalObjectContent(stakeId);
102
+ const sui = yield* Sui;
103
+ const id = ObjectId.make(stakeId);
104
+ const found = yield* sui.getObjectOption(id);
100
105
  if (found._tag === "None")
101
106
  return null;
102
- return yield* decodeBcs({ parse: (bytes) => mapRoyaltyStake(stakeId, RoyaltyStakeBcs.parse(bytes)) }, RoyaltyStake, found.value.content, { type: "RoyaltyStake", objectId: stakeId });
107
+ const parsed = yield* SuiSchema.decode(SuiSchema.bcs(RoyaltyStakeBcs), found.value.content, { objectId: id, actualType: found.value.type });
108
+ return new RoyaltyStake(mapRoyaltyStake(stakeId, parsed));
103
109
  });
104
110
  /** One shared routed stake by object ID, or `null` when no such object exists. */
105
111
  export const getRoutedStakeById = Effect.fn("getRoutedStakeById")(function* (routedStakeId) {
106
- const found = yield* getOptionalObjectContent(routedStakeId);
112
+ const sui = yield* Sui;
113
+ const id = ObjectId.make(routedStakeId);
114
+ const found = yield* sui.getObjectOption(id);
107
115
  if (found._tag === "None")
108
116
  return null;
109
- return yield* decodeBcs({ parse: (bytes) => mapRoutedStake(routedStakeId, RoutedStakeBcs.parse(bytes)) }, RoutedStake, found.value.content, { type: "RoutedStake", objectId: routedStakeId });
117
+ const parsed = yield* SuiSchema.decode(SuiSchema.bcs(RoutedStakeBcs), found.value.content, { objectId: id, actualType: found.value.type });
118
+ return new RoutedStake(mapRoutedStake(routedStakeId, parsed));
110
119
  });
111
120
  /** Deterministically derive the royalty-pool ID for a parent and type pair. */
112
121
  export function deriveRoyaltyPoolId(parentId, shareType, currencyType, royaltyPoolPackageId) {
@@ -1 +1 @@
1
- {"version":3,"file":"royalty.js","sourceRoot":"","sources":["../src/royalty.ts"],"names":[],"mappings":"AAAA,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AAC,iDAAiD,CAAC,CAAC;IACrE,CAAC;IACD,EAAE,CAAC,GAAG,CACJ,WAAW,CAAC,aAAa,CAAC;QACxB,OAAO,EAAE,MAAM,CAAC,oBAAoB;QACpC,aAAa,EAAE,CAAC,MAAM,CAAC,SAAS,EAAE,MAAM,CAAC,YAAY,CAAC;QACtD,SAAS,EAAE,CAAC,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,KAAK,IAAI,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,OAAQ,CAAC,CAAC;KAClF,CAAC,CACH,CAAC;AACJ,CAAC;AAED,oFAAoF;AACpF,MAAM,UAAU,mBAAmB,CACjC,EAAe,EACf,MAMC;IAED,OAAO,EAAE,CAAC,GAAG,CACX,WAAW,CAAC,YAAY,CAAC;QACvB,OAAO,EAAE,MAAM,CAAC,oBAAoB;QACpC,aAAa,EAAE,CAAC,MAAM,CAAC,SAAS,EAAE,MAAM,CAAC,YAAY,CAAC;QACtD,SAAS,EAAE,CAAC,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;KACjE,CAAC,CACH,CAAC;AACJ,CAAC;AAED,8EAA8E;AAC9E,+EAA+E;AAC/E,gCAAgC"}
package/dist/share.d.ts CHANGED
@@ -1,7 +1,6 @@
1
- import type { ParallelTransactionExecutor } from "@mysten/sui/transactions";
2
- import type { Signer } from "@mysten/sui/cryptography";
3
1
  import { Effect } from "effect";
4
- import { SuiClient, SuiRpcError, type TransactionFailedError } from "@misofm/effect";
2
+ import { UnexpectedEffects, type Sui, type SuiAddress } from "@unconfirmed/sui-effect";
3
+ import { type RunError, type Signer } from "@unconfirmed/sui-effect/tx";
5
4
  import { type PackageBytecode } from "./transactions.ts";
6
5
  export interface ShareCurrency {
7
6
  /** The published share package id. */
@@ -12,14 +11,21 @@ export interface ShareCurrency {
12
11
  shareType: string;
13
12
  /** The `TreasuryCap<Share>` object id (held by the treasury-cap recipient). */
14
13
  treasuryCapId: string;
15
- /** Net gas (MIST) attributed to this currency, if tracked per-item (else 0). */
16
- gasUsed: number;
14
+ /** Net gas (MIST), summed over every `Tx.run` this currency's provisioning made. Can be negative. */
15
+ gasUsed: bigint;
17
16
  }
18
17
  export interface ShareCurrencyMeta {
19
18
  name: string;
20
19
  description: string;
21
20
  iconUrl?: string;
22
21
  }
22
+ /** A signer to run a submit-on-behalf member as, plus a sponsor when the gas owner differs. */
23
+ export interface RunOpts {
24
+ readonly signer: Signer;
25
+ readonly gasOwner?: SuiAddress;
26
+ /** The gas owner's signer. Required whenever `gasOwner` names an address that is not `signer`'s. */
27
+ readonly sponsor?: Signer;
28
+ }
23
29
  /**
24
30
  * Patches the `INITIALIZER` constant in the share module bytecode, replacing the
25
31
  * 32-byte zero-address placeholder with `initializerAddress`. The template is left
@@ -38,31 +44,59 @@ export interface CreateShareCurrencyParams {
38
44
  /** Recipient of the minted `TreasuryCap`. Defaults to the signer. */
39
45
  treasuryCapRecipient?: string;
40
46
  }
41
- /** Publishes an immutable package, then initializes a fresh share currency in a second tx. */
42
- export declare const createShareCurrency: (signer: Signer, params: CreateShareCurrencyParams) => Effect.Effect<ShareCurrency, SuiRpcError | TransactionFailedError, SuiClient>;
43
47
  /**
44
- * Publishes `count` fresh, permanently immutable share-currency packages, batched
45
- * at ≤5 publishes per PTB and run concurrently through the executor. Each publish
46
- * consumes its UpgradeCap in the same PTB. Returns the published package ids
47
- * (fungible — order is not meaningful; the caller assigns them to work slots).
48
+ * Publishes an immutable package, then initializes a fresh share currency in a
49
+ * second tx two `Tx.run`s, because a `moveCall` target needs the package's
50
+ * id and a package published in the same PTB has none until it executes.
51
+ *
52
+ * Fails with: everything `Tx.run` does (`RunError`: `BuildError`,
53
+ * `SimulationFailed`, `PolicyDenied`, `SigningError`, `ExecutionFailed`,
54
+ * `NotApplied`, `SubmissionUnknown`, `JournalError`, `TransportError`), and
55
+ * `UnexpectedEffects` when a run applied but did not create the object this
56
+ * step expected (a Move-side change already on chain — not a "retry" outcome).
48
57
  */
49
- export declare const publishShareCurrencies: (executor: ParallelTransactionExecutor, initializerAddress: string, count: number, template?: PackageBytecode | undefined) => Effect.Effect<{
58
+ export declare const createShareCurrency: (params: CreateShareCurrencyParams, opts: RunOpts) => Effect.Effect<ShareCurrency, UnexpectedEffects | RunError, Sui>;
59
+ /**
60
+ * Publishes `count` fresh, permanently immutable share-currency packages,
61
+ * batched at ≤5 publishes per `Tx.run`. Each publish consumes its UpgradeCap
62
+ * in the same PTB. Returns the published package ids (fungible — order is not
63
+ * meaningful; the caller assigns them to work slots).
64
+ *
65
+ * Batches run as concurrent `Effect`s, but `Tx.run` holds one sender lock per
66
+ * address, so they serialize at the submission boundary — the accepted
67
+ * `ParallelTransactionExecutor` behaviour change for 0.28 (`docs/extensions.md`
68
+ * §5; parallel submission needs distinct gas owners).
69
+ *
70
+ * Fails with: `RunError`.
71
+ */
72
+ export declare const publishShareCurrencies: (count: number, opts: RunOpts & {
73
+ readonly initializerAddress?: string;
74
+ readonly template?: PackageBytecode;
75
+ }) => Effect.Effect<{
50
76
  packageIds: string[];
51
- gasUsed: number;
52
- }, SuiRpcError, never>;
77
+ gasUsed: bigint;
78
+ }, UnexpectedEffects | RunError, Sui>;
53
79
  /**
54
80
  * Initializes each published package into a `Currency<Share>` + `TreasuryCap`,
55
- * batched and run concurrently. `metaOf` supplies each package's display metadata,
56
- * so a currency destined for a specific work is named for it.
81
+ * batched (≤10 per `Tx.run`). `metaOf` supplies each package's display
82
+ * metadata, so a currency destined for a specific work is named for it.
83
+ *
84
+ * `share::initialize` is NON-idempotent (`coin_registry` registers one
85
+ * `Currency` per type), so a batch must never be re-run. `onBatch` fires for
86
+ * each succeeded batch as it lands, letting the caller persist it
87
+ * immediately, before the whole call settles. If any batch fails, the ones
88
+ * that already succeeded have already been reported through `onBatch`; this
89
+ * then fails with that batch's own typed error (the first one encountered),
90
+ * so a resume re-initializes only the still-missing packages.
57
91
  *
58
- * `share::initialize` is NON-idempotent (`coin_registry` registers one `Currency`
59
- * per type), so a batch must never be re-run. Batches run under `Promise.allSettled`
60
- * and `onBatch` fires for each SUCCEEDED batch as it lands — letting the caller
61
- * persist that batch immediately. If any batch fails, the succeeded ones are already
62
- * reported and this throws, so a resume re-initializes only the still-missing packages.
92
+ * Fails with: `RunError`; `UnexpectedEffects` when a batch applied but a
93
+ * package's `Currency`/`TreasuryCap` is missing from its effects, or from a
94
+ * rejecting `onBatch` effect; or whatever `onBatch` itself declares (typed `E`).
63
95
  */
64
- export declare const initializeShareCurrencies: (executor: ParallelTransactionExecutor, signerAddress: string, packageIds: string[], metaOf: (packageId: string) => ShareCurrencyMeta, onBatch?: ((currencies: ShareCurrency[], gasUsed: number) => void | Promise<void>) | undefined) => Effect.Effect<{
96
+ export declare function initializeShareCurrencies<E = never>(packageIds: readonly string[], metaOf: (packageId: string) => ShareCurrencyMeta, opts: RunOpts & {
97
+ readonly onBatch?: (currencies: ShareCurrency[], gasUsed: bigint) => Effect.Effect<void, E>;
98
+ }): Effect.Effect<{
65
99
  currencies: ShareCurrency[];
66
- gasUsed: number;
67
- }, never, never>;
100
+ gasUsed: bigint;
101
+ }, RunError | UnexpectedEffects | E, Sui>;
68
102
  //# sourceMappingURL=share.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"share.d.ts","sourceRoot":"","sources":["../src/share.ts"],"names":[],"mappings":"AAsBA,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,0BAA0B,CAAC;AAC5E,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;AAGvD,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAShC,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,KAAK,sBAAsB,EAAE,MAAM,gBAAgB,CAAC;AAErF,OAAO,EAAiD,KAAK,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAexG,MAAM,W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O,MAAM,mBAAmB,uHAgD9B,CAAC;AAWH;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,sBAAsB;kCAEe,MAAM;wBAAsB,eAAe;;gBAC3D,MAAM,EAAE;aAAW,MAAM;qCA0CzD,CAAC;AAqBH;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,yBAAyB,CAAC,CAAC,GAAG,KAAK,EACjD,UAAU,EAAE,SAAS,MAAM,EAAE,EAC7B,MAAM,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,iBAAiB,EAChD,IAAI,EAAE,OAAO,GAAG;IACd,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC,UAAU,EAAE,aAAa,EAAE,EAAE,OAAO,EAAE,MAAM,KAAK,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;CAC7F,GACA,MAAM,CAAC,MAAM,CAAC;IAAE,UAAU,EAAE,aAAa,EAAE,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,EAAE,QAAQ,GAAG,iBAAiB,GAAG,CAAC,EAAE,GAAG,CAAC,CAwDxG"}
package/dist/share.js CHANGED
@@ -1,22 +1,48 @@
1
1
  // Copyright (c) Miso Labs, Inc.
2
2
  // SPDX-License-Identifier: Apache-2.0
3
+ // Share-currency provisioning.
4
+ //
5
+ // Every composition and every recording is backed by its own fixed-supply
6
+ // (10M @ 6dp) share currency — an independently published `share` package whose
7
+ // `INITIALIZER` constant is patched to an authorized address before publish.
8
+ // Creating one is two transactions that CANNOT share a PTB: a `moveCall` target
9
+ // must name a concrete package id, but a package published in the same PTB has no
10
+ // id until it executes, so `${pkg}::share::initialize` must run in a later tx.
11
+ //
12
+ // The bytecode is identical for every currency (only the baked-in INITIALIZER
13
+ // matters, and it is the same signer for all), so publishes are fungible: a whole
14
+ // batch can be published — up to 5 `tx.publish` per PTB (the protocol's
15
+ // `max_publish_or_upgrade_per_ptb` cap) — in one `Tx.run`. Every Publish result is
16
+ // consumed immediately by `package::make_immutable` in that same PTB, so no
17
+ // share-package UpgradeCap is ever left with the publisher. Initialization is
18
+ // likewise batched. The caller assigns packages to work slots and supplies
19
+ // per-package metadata, so each currency still gets a descriptive, work-specific
20
+ // name.
21
+ //
22
+ // Every write here goes through `Tx.run`: the three submit-on-behalf members
23
+ // (`createShareCurrency`, `publishShareCurrencies`, `initializeShareCurrencies`,
24
+ // misofm/sdks#35 WP4) take the signer as a parameter, plus an optional `gasOwner`
25
+ // and `sponsor` when the gas owner differs from the sender. `Tx.run` holds one
26
+ // sender lock per address, so what used to run concurrently through a
27
+ // `ParallelTransactionExecutor` now serializes per batch under that lock — an
28
+ // accepted behaviour change for 0.28 (parallel submission needs distinct gas
29
+ // owners, `docs/extensions.md` §5).
3
30
  import { fromBase64, fromHex, toBase64 } from "@mysten/sui/utils";
4
31
  import { update_constants } from "@mysten/move-bytecode-template";
5
32
  import { Effect } from "effect";
6
- import { execThunks, publishedPackageId, allPublishedPackageIds, createdByType, allCreatedByType, } from "@misofm/musicos";
7
- import { SuiClient, SuiRpcError } from "@misofm/effect";
33
+ import { ObjectId, UnexpectedEffects } from "@unconfirmed/sui-effect";
34
+ import { Tx } from "@unconfirmed/sui-effect/tx";
8
35
  import { publishShareCurrency, initializeShareCurrency } from "./transactions.js";
9
36
  import { SHARE_TEMPLATE } from "./share-template.js";
10
- import { executeViaExecutor } from "./execute.js";
11
37
  /** The protocol cap on Publish/Upgrade commands per programmable transaction. */
12
38
  const PUBLISHES_PER_PTB = 5;
13
39
  /** Initializes batched per PTB (each is one moveCall + transfer; all share the 0xc registry). */
14
40
  const INITS_PER_PTB = 10;
15
- // Address-free type markers: gRPC object types carry fully-normalized addresses
16
- // (e.g. 0x0000…0002::coin::TreasuryCap), so we match on module::type rather than a
17
- // short "0x2" prefix that would never match.
18
- const CURRENCY_TYPE = "::coin_registry::Currency<";
19
- const TREASURY_CAP_TYPE = "::coin::TreasuryCap<";
41
+ // A bare (no type-argument) expected tag: per sui-effect's generic-Move-type
42
+ // rule, this matches every instantiation (`Currency<pkg::share::Share>` for
43
+ // any `pkg`), comparing only `address::module::name`.
44
+ const CURRENCY_TYPE = "0x2::coin_registry::Currency";
45
+ const TREASURY_CAP_TYPE = "0x2::coin::TreasuryCap";
20
46
  // ── Bytecode patching ────────────────────────────────────────────────────────
21
47
  /**
22
48
  * Patches the `INITIALIZER` constant in the share module bytecode, replacing the
@@ -36,32 +62,56 @@ export function patchInitializer(template, initializerAddress) {
36
62
  const patched = update_constants(moduleBytes, newValue, oldValue, "Vector(U8)");
37
63
  return { ...template, modules: [toBase64(patched)] };
38
64
  }
39
- /** Publishes an immutable package, then initializes a fresh share currency in a second tx. */
40
- export const createShareCurrency = Effect.fn("createShareCurrency")(function* (signer, params) {
41
- const signerAddress = signer.toSuiAddress();
65
+ /**
66
+ * Publishes an immutable package, then initializes a fresh share currency in a
67
+ * second tx — two `Tx.run`s, because a `moveCall` target needs the package's
68
+ * id and a package published in the same PTB has none until it executes.
69
+ *
70
+ * Fails with: everything `Tx.run` does (`RunError`: `BuildError`,
71
+ * `SimulationFailed`, `PolicyDenied`, `SigningError`, `ExecutionFailed`,
72
+ * `NotApplied`, `SubmissionUnknown`, `JournalError`, `TransportError`), and
73
+ * `UnexpectedEffects` when a run applied but did not create the object this
74
+ * step expected (a Move-side change already on chain — not a "retry" outcome).
75
+ */
76
+ export const createShareCurrency = Effect.fn("createShareCurrency")(function* (params, opts) {
77
+ const signerAddress = opts.signer.address;
42
78
  const initializer = params.initializerAddress ?? signerAddress;
43
79
  const recipient = params.treasuryCapRecipient ?? signerAddress;
44
80
  // Tx 1: publish the share package with the initializer baked in.
45
81
  const patched = patchInitializer(params.template ?? SHARE_TEMPLATE, initializer);
46
- const publishRes = yield* execThunks(signer, publishShareCurrency(patched));
47
- const packageId = publishedPackageId(publishRes);
82
+ const published = yield* Tx.run(publishShareCurrency(patched), opts);
83
+ const packagesPublished = published.packagesPublished();
84
+ const packageId = String(packagesPublished[0]?.id ?? "");
85
+ if (packageId === "") {
86
+ // The publish `Tx.run` already applied (gas was charged) but the effects
87
+ // carried no published package — `UnexpectedEffects` (outcome "applied"),
88
+ // not a defect, per B9 (misofm/sdks#35 verification): a caller must be
89
+ // able to `catchTag` this the same way `expectCreated` lets it below.
90
+ return yield* Effect.fail(new UnexpectedEffects({
91
+ digest: published.digest,
92
+ expected: "a published share package",
93
+ found: packagesPublished.map((ref) => ref.id),
94
+ }));
95
+ }
48
96
  // Tx 2: initialize → creates the Currency object + transfers the TreasuryCap.
49
- const initRes = yield* execThunks(signer, initializeShareCurrency({
97
+ const initialized = yield* Tx.run(initializeShareCurrency({
50
98
  shareCurrencyPackageId: packageId,
51
99
  name: params.name,
52
100
  description: params.description,
53
101
  iconUrl: params.iconUrl ?? "",
54
102
  treasuryCapRecipient: recipient,
55
- }));
103
+ }), opts);
104
+ const currency = yield* initialized.expectCreated(CURRENCY_TYPE);
105
+ const treasuryCap = yield* initialized.expectCreated(TREASURY_CAP_TYPE);
56
106
  return {
57
107
  packageId,
58
- currencyId: createdByType(initRes, CURRENCY_TYPE),
108
+ currencyId: String(currency.id),
59
109
  shareType: `${packageId}::share::Share`,
60
- treasuryCapId: createdByType(initRes, TREASURY_CAP_TYPE),
61
- gasUsed: publishRes.gasUsed + initRes.gasUsed,
110
+ treasuryCapId: String(treasuryCap.id),
111
+ gasUsed: published.gasUsedTotal + initialized.gasUsedTotal,
62
112
  };
63
113
  });
64
- // ── Batched (parallel) ─────────────────────────────────────────────────────
114
+ // ── Batched ────────────────────────────────────────────────────────────────
65
115
  /** Splits an array into fixed-size chunks. */
66
116
  function chunk(items, size) {
67
117
  const out = [];
@@ -70,95 +120,120 @@ function chunk(items, size) {
70
120
  return out;
71
121
  }
72
122
  /**
73
- * Publishes `count` fresh, permanently immutable share-currency packages, batched
74
- * at ≤5 publishes per PTB and run concurrently through the executor. Each publish
75
- * consumes its UpgradeCap in the same PTB. Returns the published package ids
76
- * (fungible — order is not meaningful; the caller assigns them to work slots).
123
+ * Publishes `count` fresh, permanently immutable share-currency packages,
124
+ * batched at ≤5 publishes per `Tx.run`. Each publish consumes its UpgradeCap
125
+ * in the same PTB. Returns the published package ids (fungible — order is not
126
+ * meaningful; the caller assigns them to work slots).
127
+ *
128
+ * Batches run as concurrent `Effect`s, but `Tx.run` holds one sender lock per
129
+ * address, so they serialize at the submission boundary — the accepted
130
+ * `ParallelTransactionExecutor` behaviour change for 0.28 (`docs/extensions.md`
131
+ * §5; parallel submission needs distinct gas owners).
132
+ *
133
+ * Fails with: `RunError`.
77
134
  */
78
- export const publishShareCurrencies = Effect.fn("publishShareCurrencies")(function* (executor, initializerAddress, count, template = SHARE_TEMPLATE) {
135
+ export const publishShareCurrencies = Effect.fn("publishShareCurrencies")(function* (count, opts) {
79
136
  if (count <= 0)
80
- return { packageIds: [], gasUsed: 0 };
137
+ return { packageIds: [], gasUsed: 0n };
81
138
  // One patched template, reused for every publish (identical bytecode → distinct packages).
82
- const patched = patchInitializer(template, initializerAddress);
139
+ const initializer = opts.initializerAddress ?? opts.signer.address;
140
+ const patched = patchInitializer(opts.template ?? SHARE_TEMPLATE, initializer);
83
141
  const batchSizes = [];
84
142
  for (let remaining = count; remaining > 0; remaining -= PUBLISHES_PER_PTB) {
85
143
  batchSizes.push(Math.min(PUBLISHES_PER_PTB, remaining));
86
144
  }
87
- const results = yield* Effect.forEach(batchSizes, (n) => executeViaExecutor(executor, ...Array.from({ length: n }, () => publishShareCurrency(patched))), { concurrency: "unbounded" });
88
- const packageIds = results.flatMap(allPublishedPackageIds);
89
- const gasUsed = results.reduce((sum, r) => sum + r.gasUsed, 0);
145
+ const results = yield* Effect.forEach(batchSizes, (n) => Tx.run((tx) => {
146
+ for (let i = 0; i < n; i++)
147
+ publishShareCurrency(patched)(tx);
148
+ }, { signer: opts.signer, gasOwner: opts.gasOwner, sponsor: opts.sponsor }), { concurrency: "unbounded" });
149
+ const packageIds = results.flatMap((executed) => executed.packagesPublished().map((ref) => String(ref.id)));
150
+ const gasUsed = results.reduce((sum, r) => sum + r.gasUsedTotal, 0n);
90
151
  if (packageIds.length !== count) {
91
- throw new Error(`Expected ${count} published share packages, got ${packageIds.length}.`);
152
+ // Every batch here already applied (each is its own `Tx.run`, gas
153
+ // charged) but the total published count disagrees with what was asked
154
+ // for — `UnexpectedEffects` (outcome "applied"), not a defect, per B9
155
+ // (misofm/sdks#35 verification). The last batch's digest is the most
156
+ // recent applied transaction; `found` lists every package actually seen.
157
+ const lastResult = results[results.length - 1];
158
+ return yield* Effect.fail(new UnexpectedEffects({
159
+ digest: lastResult.digest,
160
+ expected: `${count} published share packages`,
161
+ found: packageIds.map((id) => ObjectId.make(id)),
162
+ }));
92
163
  }
93
164
  return { packageIds, gasUsed };
94
165
  });
95
- /** Re-associates one init PTB's created objects back to their packages by share type. */
96
- function currenciesFromResult(res, batchPkgs) {
97
- const currencies = allCreatedByType(res, CURRENCY_TYPE);
98
- const treasuries = allCreatedByType(res, TREASURY_CAP_TYPE);
99
- return batchPkgs.map((pkg) => {
166
+ /**
167
+ * Re-associates one init PTB's created objects back to their packages by
168
+ * share type. `expectCreated` (an already-applied `Executed`'s own typed
169
+ * accessor) is what turns "the initialize applied but this package's
170
+ * Currency/TreasuryCap is missing" into `UnexpectedEffects` (outcome
171
+ * `"applied"`) instead of a bare throw a caller could not `catchTag` (B9,
172
+ * misofm/sdks#35 verification).
173
+ */
174
+ function currenciesFromResult(executed, batchPkgs) {
175
+ return Effect.forEach(batchPkgs, (pkg) => Effect.gen(function* () {
100
176
  const shareType = `${pkg}::share::Share`;
101
- const currency = currencies.find((o) => o.objectType.includes(shareType));
102
- const treasury = treasuries.find((o) => o.objectType.includes(shareType));
103
- if (!currency)
104
- throw new Error(`No Currency<${shareType}> created during initialize.`);
105
- if (!treasury)
106
- throw new Error(`No TreasuryCap<${shareType}> created during initialize.`);
107
- return { packageId: pkg, currencyId: currency.objectId, shareType, treasuryCapId: treasury.objectId, gasUsed: 0 };
108
- });
177
+ const currency = yield* executed.expectCreated(`${CURRENCY_TYPE}<${shareType}>`);
178
+ const treasury = yield* executed.expectCreated(`${TREASURY_CAP_TYPE}<${shareType}>`);
179
+ return { packageId: pkg, currencyId: String(currency.id), shareType, treasuryCapId: String(treasury.id), gasUsed: 0n };
180
+ }));
109
181
  }
110
182
  /**
111
183
  * Initializes each published package into a `Currency<Share>` + `TreasuryCap`,
112
- * batched and run concurrently. `metaOf` supplies each package's display metadata,
113
- * so a currency destined for a specific work is named for it.
184
+ * batched (≤10 per `Tx.run`). `metaOf` supplies each package's display
185
+ * metadata, so a currency destined for a specific work is named for it.
186
+ *
187
+ * `share::initialize` is NON-idempotent (`coin_registry` registers one
188
+ * `Currency` per type), so a batch must never be re-run. `onBatch` fires for
189
+ * each succeeded batch as it lands, letting the caller persist it
190
+ * immediately, before the whole call settles. If any batch fails, the ones
191
+ * that already succeeded have already been reported through `onBatch`; this
192
+ * then fails with that batch's own typed error (the first one encountered),
193
+ * so a resume re-initializes only the still-missing packages.
114
194
  *
115
- * `share::initialize` is NON-idempotent (`coin_registry` registers one `Currency`
116
- * per type), so a batch must never be re-run. Batches run under `Promise.allSettled`
117
- * and `onBatch` fires for each SUCCEEDED batch as it lands — letting the caller
118
- * persist that batch immediately. If any batch fails, the succeeded ones are already
119
- * reported and this throws, so a resume re-initializes only the still-missing packages.
195
+ * Fails with: `RunError`; `UnexpectedEffects` when a batch applied but a
196
+ * package's `Currency`/`TreasuryCap` is missing from its effects, or from a
197
+ * rejecting `onBatch` effect; or whatever `onBatch` itself declares (typed `E`).
120
198
  */
121
- export const initializeShareCurrencies = Effect.fn("initializeShareCurrencies")(function* (executor, signerAddress, packageIds, metaOf, onBatch) {
122
- if (packageIds.length === 0)
123
- return { currencies: [], gasUsed: 0 };
124
- const batches = chunk(packageIds, INITS_PER_PTB);
125
- // `Effect.either` per batch preserves `Promise.allSettled`'s partial-failure
126
- // tolerance: one batch's `SuiRpcError` does not cancel the others in flight.
127
- const outcomes = yield* Effect.forEach(batches, (batchPkgs) => executeViaExecutor(executor, ...batchPkgs.map((pkg) => {
128
- const meta = metaOf(pkg);
129
- return initializeShareCurrency({
130
- shareCurrencyPackageId: pkg,
131
- name: meta.name,
132
- description: meta.description,
133
- iconUrl: meta.iconUrl ?? "",
134
- treasuryCapRecipient: signerAddress,
135
- });
136
- })).pipe(Effect.map((res) => ({ batchCurrencies: currenciesFromResult(res, batchPkgs), gasUsed: res.gasUsed })),
137
- // A rejecting callback is this batch's failure, not a defect: a defect
138
- // would fail the whole forEach and interrupt sibling batches whose
139
- // transactions are already submitted.
140
- Effect.tap(({ batchCurrencies, gasUsed }) => onBatch
141
- ? Effect.tryPromise({
142
- try: () => Promise.resolve(onBatch(batchCurrencies, gasUsed)),
143
- catch: (cause) => new SuiRpcError({ operation: "onBatch", cause }),
144
- })
145
- : Effect.void), Effect.result), { concurrency: "unbounded" });
146
- const currencies = [];
147
- const errors = [];
148
- let gasUsed = 0;
149
- for (const outcome of outcomes) {
150
- if (outcome._tag === "Success") {
151
- currencies.push(...outcome.success.batchCurrencies);
152
- gasUsed += outcome.success.gasUsed;
199
+ export function initializeShareCurrencies(packageIds, metaOf, opts) {
200
+ return Effect.gen(function* () {
201
+ if (packageIds.length === 0)
202
+ return { currencies: [], gasUsed: 0n };
203
+ const batches = chunk(packageIds, INITS_PER_PTB);
204
+ // `Effect.result` per batch preserves the predecessor's partial-failure
205
+ // tolerance: one batch's error does not cancel sibling batches already in
206
+ // flight.
207
+ const outcomes = yield* Effect.forEach(batches, (batchPkgs) => Tx.run((tx) => {
208
+ for (const pkg of batchPkgs) {
209
+ const meta = metaOf(pkg);
210
+ initializeShareCurrency({
211
+ shareCurrencyPackageId: pkg,
212
+ name: meta.name,
213
+ description: meta.description,
214
+ iconUrl: meta.iconUrl ?? "",
215
+ treasuryCapRecipient: opts.signer.address,
216
+ })(tx);
217
+ }
218
+ }, { signer: opts.signer, gasOwner: opts.gasOwner, sponsor: opts.sponsor }).pipe(Effect.flatMap((executed) => Effect.map(currenciesFromResult(executed, batchPkgs), (batchCurrencies) => ({
219
+ batchCurrencies,
220
+ gasUsed: executed.gasUsedTotal,
221
+ }))), Effect.flatMap(({ batchCurrencies, gasUsed }) => (opts.onBatch ? opts.onBatch(batchCurrencies, gasUsed) : Effect.void).pipe(Effect.as({ batchCurrencies, gasUsed }))), Effect.result), { concurrency: "unbounded" });
222
+ const currencies = [];
223
+ let gasUsed = 0n;
224
+ let firstFailure;
225
+ for (const outcome of outcomes) {
226
+ if (outcome._tag === "Success") {
227
+ currencies.push(...outcome.success.batchCurrencies);
228
+ gasUsed += outcome.success.gasUsed;
229
+ }
230
+ else if (firstFailure === undefined) {
231
+ firstFailure = outcome.failure;
232
+ }
153
233
  }
154
- else {
155
- errors.push(outcome.failure);
156
- }
157
- }
158
- if (errors.length > 0) {
159
- const msg = errors.map((e) => (e instanceof Error ? e.message : String(e))).join("; ");
160
- throw new Error(`${errors.length}/${batches.length} initialize batch(es) failed: ${msg}`);
161
- }
162
- return { currencies, gasUsed };
163
- });
234
+ if (firstFailure !== undefined)
235
+ return yield* Effect.fail(firstFailure);
236
+ return { currencies, gasUsed };
237
+ });
238
+ }
164
239
  //# sourceMappingURL=share.js.map