@misofm/platform 0.27.0 → 0.28.1
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.
- package/README.md +309 -204
- package/dist/Miso.d.ts +403 -0
- package/dist/Miso.d.ts.map +1 -0
- package/dist/Miso.js +455 -0
- package/dist/Miso.js.map +1 -0
- package/dist/auth.d.ts +11 -1
- package/dist/auth.d.ts.map +1 -1
- package/dist/auth.js +16 -3
- package/dist/auth.js.map +1 -1
- package/dist/catalog.d.ts +8 -5
- package/dist/catalog.d.ts.map +1 -1
- package/dist/catalog.js +36 -19
- package/dist/catalog.js.map +1 -1
- package/dist/client.d.ts +52 -443
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +58 -775
- package/dist/client.js.map +1 -1
- package/dist/contracts/composition_credits/composition_credits.d.ts +38 -48
- package/dist/contracts/composition_credits/composition_credits.d.ts.map +1 -1
- package/dist/contracts/composition_credits/composition_credits.js +20 -4
- package/dist/contracts/composition_credits/composition_credits.js.map +1 -1
- package/dist/contracts/composition_routed_stake/composition_routed_stake.d.ts +64 -1
- package/dist/contracts/composition_routed_stake/composition_routed_stake.d.ts.map +1 -1
- package/dist/contracts/composition_routed_stake/composition_routed_stake.js +66 -1
- package/dist/contracts/composition_routed_stake/composition_routed_stake.js.map +1 -1
- package/dist/contracts/composition_royalty_pool/composition_royalty_pool.d.ts +52 -4
- package/dist/contracts/composition_royalty_pool/composition_royalty_pool.d.ts.map +1 -1
- package/dist/contracts/composition_royalty_pool/composition_royalty_pool.js +52 -4
- package/dist/contracts/composition_royalty_pool/composition_royalty_pool.js.map +1 -1
- package/dist/contracts/composition_royalty_pool_plugin/composition_royalty_pool_plugin.d.ts +63 -1
- package/dist/contracts/composition_royalty_pool_plugin/composition_royalty_pool_plugin.d.ts.map +1 -1
- package/dist/contracts/composition_royalty_pool_plugin/composition_royalty_pool_plugin.js +63 -1
- package/dist/contracts/composition_royalty_pool_plugin/composition_royalty_pool_plugin.js.map +1 -1
- package/dist/contracts/genre/genre.d.ts +10 -1
- package/dist/contracts/genre/genre.d.ts.map +1 -1
- package/dist/contracts/genre/genre.js +8 -1
- package/dist/contracts/genre/genre.js.map +1 -1
- package/dist/contracts/miso_pay/deps/std/type_name.d.ts.map +1 -0
- package/dist/contracts/miso_pay/deps/std/type_name.js.map +1 -0
- package/dist/contracts/miso_pay/pay.d.ts +209 -0
- package/dist/contracts/miso_pay/pay.d.ts.map +1 -0
- package/dist/contracts/miso_pay/pay.js +195 -0
- package/dist/contracts/miso_pay/pay.js.map +1 -0
- package/dist/contracts/party_cta/party_cta.d.ts +49 -3
- package/dist/contracts/party_cta/party_cta.d.ts.map +1 -1
- package/dist/contracts/party_cta/party_cta.js +27 -5
- package/dist/contracts/party_cta/party_cta.js.map +1 -1
- package/dist/contracts/party_genre/party_genre.d.ts +25 -0
- package/dist/contracts/party_genre/party_genre.d.ts.map +1 -1
- package/dist/contracts/party_genre/party_genre.js +14 -3
- package/dist/contracts/party_genre/party_genre.js.map +1 -1
- package/dist/contracts/party_media/party_media.d.ts +19 -3
- package/dist/contracts/party_media/party_media.d.ts.map +1 -1
- package/dist/contracts/party_media/party_media.js +20 -4
- package/dist/contracts/party_media/party_media.js.map +1 -1
- package/dist/contracts/party_platform_link/party_platform_link.d.ts +15 -7
- package/dist/contracts/party_platform_link/party_platform_link.d.ts.map +1 -1
- package/dist/contracts/party_platform_link/party_platform_link.js +15 -7
- package/dist/contracts/party_platform_link/party_platform_link.js.map +1 -1
- package/dist/contracts/party_profile/party_profile.d.ts +63 -8
- package/dist/contracts/party_profile/party_profile.d.ts.map +1 -1
- package/dist/contracts/party_profile/party_profile.js +33 -8
- package/dist/contracts/party_profile/party_profile.js.map +1 -1
- package/dist/contracts/party_roles/party_roles.d.ts +28 -3
- package/dist/contracts/party_roles/party_roles.d.ts.map +1 -1
- package/dist/contracts/party_roles/party_roles.js +19 -4
- package/dist/contracts/party_roles/party_roles.js.map +1 -1
- package/dist/contracts/party_tags/party_tags.d.ts +23 -3
- package/dist/contracts/party_tags/party_tags.d.ts.map +1 -1
- package/dist/contracts/party_tags/party_tags.js +16 -4
- package/dist/contracts/party_tags/party_tags.js.map +1 -1
- package/dist/contracts/party_wallet/party_wallet.d.ts +4 -1
- package/dist/contracts/party_wallet/party_wallet.d.ts.map +1 -1
- package/dist/contracts/party_wallet/party_wallet.js +2 -1
- package/dist/contracts/party_wallet/party_wallet.js.map +1 -1
- package/dist/contracts/platform_link/platform_link.d.ts +207 -0
- package/dist/contracts/platform_link/platform_link.d.ts.map +1 -0
- package/dist/contracts/platform_link/platform_link.js +209 -0
- package/dist/contracts/platform_link/platform_link.js.map +1 -0
- package/dist/contracts/record/pressing.d.ts +53 -7
- package/dist/contracts/record/pressing.d.ts.map +1 -1
- package/dist/contracts/record/pressing.js +50 -4
- package/dist/contracts/record/pressing.js.map +1 -1
- package/dist/contracts/record/record.d.ts +14 -0
- package/dist/contracts/record/record.d.ts.map +1 -1
- package/dist/contracts/record/record.js +15 -1
- package/dist/contracts/record/record.js.map +1 -1
- package/dist/contracts/record_shop/listing.d.ts +80 -35
- package/dist/contracts/record_shop/listing.d.ts.map +1 -1
- package/dist/contracts/record_shop/listing.js +76 -13
- package/dist/contracts/record_shop/listing.js.map +1 -1
- package/dist/contracts/recording_advisory/recording_advisory.d.ts +15 -15
- package/dist/contracts/recording_advisory/recording_advisory.d.ts.map +1 -1
- package/dist/contracts/recording_advisory/recording_advisory.js +15 -8
- package/dist/contracts/recording_advisory/recording_advisory.js.map +1 -1
- package/dist/contracts/recording_credits/recording_credits.d.ts +95 -1350
- package/dist/contracts/recording_credits/recording_credits.d.ts.map +1 -1
- package/dist/contracts/recording_credits/recording_credits.js +63 -12
- package/dist/contracts/recording_credits/recording_credits.js.map +1 -1
- package/dist/contracts/recording_engine_session/recording_engine_session.d.ts +30 -49
- package/dist/contracts/recording_engine_session/recording_engine_session.d.ts.map +1 -1
- package/dist/contracts/recording_engine_session/recording_engine_session.js +19 -4
- package/dist/contracts/recording_engine_session/recording_engine_session.js.map +1 -1
- package/dist/contracts/recording_genre/recording_genre.d.ts +67 -9
- package/dist/contracts/recording_genre/recording_genre.d.ts.map +1 -1
- package/dist/contracts/recording_genre/recording_genre.js +53 -9
- package/dist/contracts/recording_genre/recording_genre.js.map +1 -1
- package/dist/contracts/recording_language/recording_language.d.ts +29 -5
- package/dist/contracts/recording_language/recording_language.d.ts.map +1 -1
- package/dist/contracts/recording_language/recording_language.js +18 -5
- package/dist/contracts/recording_language/recording_language.js.map +1 -1
- package/dist/contracts/recording_master_reference/recording_master_reference.d.ts +25 -15
- package/dist/contracts/recording_master_reference/recording_master_reference.d.ts.map +1 -1
- package/dist/contracts/recording_master_reference/recording_master_reference.js +18 -5
- package/dist/contracts/recording_master_reference/recording_master_reference.js.map +1 -1
- package/dist/contracts/recording_royalty_pool/recording_royalty_pool.d.ts +55 -4
- package/dist/contracts/recording_royalty_pool/recording_royalty_pool.d.ts.map +1 -1
- package/dist/contracts/recording_royalty_pool/recording_royalty_pool.js +55 -4
- package/dist/contracts/recording_royalty_pool/recording_royalty_pool.js.map +1 -1
- package/dist/contracts/recording_royalty_pool_plugin/recording_royalty_pool_plugin.d.ts +66 -1
- package/dist/contracts/recording_royalty_pool_plugin/recording_royalty_pool_plugin.d.ts.map +1 -1
- package/dist/contracts/recording_royalty_pool_plugin/recording_royalty_pool_plugin.js +66 -1
- package/dist/contracts/recording_royalty_pool_plugin/recording_royalty_pool_plugin.js.map +1 -1
- package/dist/contracts/recording_streaming_transcode/recording_streaming_transcode.d.ts +12 -9
- package/dist/contracts/recording_streaming_transcode/recording_streaming_transcode.d.ts.map +1 -1
- package/dist/contracts/recording_streaming_transcode/recording_streaming_transcode.js +11 -4
- package/dist/contracts/recording_streaming_transcode/recording_streaming_transcode.js.map +1 -1
- package/dist/contracts/release_cover_art/release_cover_art.d.ts +168 -74
- package/dist/contracts/release_cover_art/release_cover_art.d.ts.map +1 -1
- package/dist/contracts/release_cover_art/release_cover_art.js +126 -10
- package/dist/contracts/release_cover_art/release_cover_art.js.map +1 -1
- package/dist/contracts/release_credits/release_credits.d.ts +24 -28
- package/dist/contracts/release_credits/release_credits.d.ts.map +1 -1
- package/dist/contracts/release_credits/release_credits.js +18 -4
- package/dist/contracts/release_credits/release_credits.js.map +1 -1
- package/dist/contracts/release_description/release_description.d.ts +16 -5
- package/dist/contracts/release_description/release_description.d.ts.map +1 -1
- package/dist/contracts/release_description/release_description.js +9 -4
- package/dist/contracts/release_description/release_description.js.map +1 -1
- package/dist/contracts/release_dsp_link/release_dsp_link.d.ts +130 -160
- package/dist/contracts/release_dsp_link/release_dsp_link.d.ts.map +1 -1
- package/dist/contracts/release_dsp_link/release_dsp_link.js +74 -19
- package/dist/contracts/release_dsp_link/release_dsp_link.js.map +1 -1
- package/dist/contracts/release_genre/release_genre.d.ts +66 -11
- package/dist/contracts/release_genre/release_genre.d.ts.map +1 -1
- package/dist/contracts/release_genre/release_genre.js +52 -11
- package/dist/contracts/release_genre/release_genre.js.map +1 -1
- package/dist/contracts/release_kind/release_kind.d.ts +28 -5
- package/dist/contracts/release_kind/release_kind.d.ts.map +1 -1
- package/dist/contracts/release_kind/release_kind.js +19 -4
- package/dist/contracts/release_kind/release_kind.js.map +1 -1
- package/dist/contracts/release_revenue_distributor/release_revenue_distributor.d.ts +17 -0
- package/dist/contracts/release_revenue_distributor/release_revenue_distributor.d.ts.map +1 -1
- package/dist/contracts/release_revenue_distributor/release_revenue_distributor.js +15 -0
- package/dist/contracts/release_revenue_distributor/release_revenue_distributor.js.map +1 -1
- package/dist/contracts/release_revenue_distributor_plugin/release_revenue_distributor_plugin.d.ts +37 -1
- package/dist/contracts/release_revenue_distributor_plugin/release_revenue_distributor_plugin.d.ts.map +1 -1
- package/dist/contracts/release_revenue_distributor_plugin/release_revenue_distributor_plugin.js +37 -1
- package/dist/contracts/release_revenue_distributor_plugin/release_revenue_distributor_plugin.js.map +1 -1
- package/dist/contracts/routed_stake/routed_stake.d.ts +78 -6
- package/dist/contracts/routed_stake/routed_stake.d.ts.map +1 -1
- package/dist/contracts/routed_stake/routed_stake.js +79 -7
- package/dist/contracts/routed_stake/routed_stake.js.map +1 -1
- package/dist/contracts/royalty_pool/pool.d.ts +117 -27
- package/dist/contracts/royalty_pool/pool.d.ts.map +1 -1
- package/dist/contracts/royalty_pool/pool.js +117 -28
- package/dist/contracts/royalty_pool/pool.js.map +1 -1
- package/dist/contracts/royalty_pool/stake.d.ts +3 -0
- package/dist/contracts/royalty_pool/stake.d.ts.map +1 -1
- package/dist/contracts/royalty_pool/stake.js +5 -2
- package/dist/contracts/royalty_pool/stake.js.map +1 -1
- package/dist/contracts/share/share.d.ts +80 -0
- package/dist/contracts/share/share.d.ts.map +1 -0
- package/dist/contracts/share/share.js +72 -0
- package/dist/contracts/share/share.js.map +1 -0
- package/dist/contracts/vault/vault.d.ts +51 -0
- package/dist/contracts/vault/vault.d.ts.map +1 -1
- package/dist/contracts/vault/vault.js +55 -4
- package/dist/contracts/vault/vault.js.map +1 -1
- package/dist/contracts.d.ts +60 -0
- package/dist/contracts.d.ts.map +1 -1
- package/dist/contracts.js +17 -0
- package/dist/contracts.js.map +1 -1
- package/dist/cover.d.ts +5 -6
- package/dist/cover.d.ts.map +1 -1
- package/dist/cover.js +10 -10
- package/dist/cover.js.map +1 -1
- package/dist/credits.d.ts +12 -13
- package/dist/credits.d.ts.map +1 -1
- package/dist/credits.js +16 -10
- package/dist/credits.js.map +1 -1
- package/dist/deployments.d.ts +3 -3
- package/dist/deployments.d.ts.map +1 -1
- package/dist/deployments.js +2 -3
- package/dist/deployments.js.map +1 -1
- package/dist/errors.d.ts +24 -9
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +43 -16
- package/dist/errors.js.map +1 -1
- package/dist/events.d.ts +1687 -835
- package/dist/events.d.ts.map +1 -1
- package/dist/events.js +258 -39
- package/dist/events.js.map +1 -1
- package/dist/genre.d.ts +11 -12
- package/dist/genre.d.ts.map +1 -1
- package/dist/genre.js +5 -3
- package/dist/genre.js.map +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -2
- package/dist/index.js.map +1 -1
- package/dist/packages.d.ts +1047 -1695
- package/dist/packages.d.ts.map +1 -1
- package/dist/party/client.d.ts +113 -296
- package/dist/party/client.d.ts.map +1 -1
- package/dist/party/client.js +93 -178
- package/dist/party/client.js.map +1 -1
- package/dist/party/extensions/ctas.d.ts +3 -3
- package/dist/party/extensions/ctas.d.ts.map +1 -1
- package/dist/party/extensions/genres.d.ts +4 -4
- package/dist/party/extensions/genres.d.ts.map +1 -1
- package/dist/party/extensions/links.d.ts +5 -5
- package/dist/party/extensions/links.d.ts.map +1 -1
- package/dist/party/extensions/links.js.map +1 -1
- package/dist/party/extensions/media.d.ts +3 -3
- package/dist/party/extensions/media.d.ts.map +1 -1
- package/dist/party/extensions/profile.d.ts +3 -3
- package/dist/party/extensions/profile.d.ts.map +1 -1
- package/dist/party/extensions/roles.d.ts +4 -4
- package/dist/party/extensions/roles.d.ts.map +1 -1
- package/dist/party/extensions/roles.js.map +1 -1
- package/dist/party/extensions/tags.d.ts +4 -4
- package/dist/party/extensions/tags.d.ts.map +1 -1
- package/dist/party/index.d.ts +1 -1
- package/dist/party/index.d.ts.map +1 -1
- package/dist/party/index.js.map +1 -1
- package/dist/party/queries.d.ts +8 -8
- package/dist/party/queries.d.ts.map +1 -1
- package/dist/party/queries.js +83 -56
- package/dist/party/queries.js.map +1 -1
- package/dist/pressing.d.ts +13 -15
- package/dist/pressing.d.ts.map +1 -1
- package/dist/pressing.js +99 -29
- package/dist/pressing.js.map +1 -1
- package/dist/publication.d.ts +13 -6
- package/dist/publication.d.ts.map +1 -1
- package/dist/publication.js +26 -21
- package/dist/publication.js.map +1 -1
- package/dist/queries.js +3 -3
- package/dist/queries.js.map +1 -1
- package/dist/read/artist.d.ts +4 -3
- package/dist/read/artist.d.ts.map +1 -1
- package/dist/read/artist.js +24 -8
- package/dist/read/artist.js.map +1 -1
- package/dist/read/catalog.d.ts +17 -16
- package/dist/read/catalog.d.ts.map +1 -1
- package/dist/read/catalog.js +25 -11
- package/dist/read/catalog.js.map +1 -1
- package/dist/read/client.d.ts +41 -20
- package/dist/read/client.d.ts.map +1 -1
- package/dist/read/client.js +20 -12
- package/dist/read/client.js.map +1 -1
- package/dist/read/config.d.ts +25 -3
- package/dist/read/config.d.ts.map +1 -1
- package/dist/read/config.js +42 -25
- package/dist/read/config.js.map +1 -1
- package/dist/read/genres.d.ts +8 -3
- package/dist/read/genres.d.ts.map +1 -1
- package/dist/read/genres.js +23 -17
- package/dist/read/genres.js.map +1 -1
- package/dist/read/index.d.ts +1 -1
- package/dist/read/index.d.ts.map +1 -1
- package/dist/read/index.js +8 -6
- package/dist/read/index.js.map +1 -1
- package/dist/read/receipts.d.ts +5 -4
- package/dist/read/receipts.d.ts.map +1 -1
- package/dist/read/receipts.js +94 -46
- package/dist/read/receipts.js.map +1 -1
- package/dist/read/royalties.d.ts +6 -5
- package/dist/read/royalties.d.ts.map +1 -1
- package/dist/read/royalties.js +16 -9
- package/dist/read/royalties.js.map +1 -1
- package/dist/read/wallet.d.ts +23 -12
- package/dist/read/wallet.d.ts.map +1 -1
- package/dist/read/wallet.js +158 -177
- package/dist/read/wallet.js.map +1 -1
- package/dist/read/works.d.ts +6 -6
- package/dist/read/works.d.ts.map +1 -1
- package/dist/read/works.js +40 -26
- package/dist/read/works.js.map +1 -1
- package/dist/recording-extensions.d.ts +15 -16
- package/dist/recording-extensions.d.ts.map +1 -1
- package/dist/recording-extensions.js +12 -8
- package/dist/recording-extensions.js.map +1 -1
- package/dist/release-extensions.d.ts +5 -6
- package/dist/release-extensions.d.ts.map +1 -1
- package/dist/release-extensions.js +3 -2
- package/dist/release-extensions.js.map +1 -1
- package/dist/release-graph.d.ts +2 -2
- package/dist/release-graph.d.ts.map +1 -1
- package/dist/release-graph.js.map +1 -1
- package/dist/royalty.d.ts +4 -4
- package/dist/royalty.d.ts.map +1 -1
- package/dist/royalty.js +16 -7
- package/dist/royalty.js.map +1 -1
- package/dist/share.d.ts +58 -24
- package/dist/share.d.ts.map +1 -1
- package/dist/share.js +167 -92
- package/dist/share.js.map +1 -1
- package/dist/transactions.d.ts +15 -6
- package/dist/transactions.d.ts.map +1 -1
- package/dist/transactions.js +1 -0
- package/dist/transactions.js.map +1 -1
- package/dist/vault.d.ts +13 -3
- package/dist/vault.d.ts.map +1 -1
- package/dist/vault.js +22 -16
- package/dist/vault.js.map +1 -1
- package/package.json +9 -8
- package/src/Miso.ts +951 -0
- package/src/auth.ts +16 -3
- package/src/catalog.ts +58 -25
- package/src/client.ts +98 -1359
- package/src/contracts/composition_credits/composition_credits.ts +20 -4
- package/src/contracts/composition_routed_stake/composition_routed_stake.ts +67 -1
- package/src/contracts/composition_royalty_pool/composition_royalty_pool.ts +53 -4
- package/src/contracts/composition_royalty_pool_plugin/composition_royalty_pool_plugin.ts +64 -1
- package/src/contracts/genre/genre.ts +8 -1
- package/src/contracts/miso_pay/pay.ts +356 -0
- package/src/contracts/party_cta/party_cta.ts +27 -5
- package/src/contracts/party_genre/party_genre.ts +14 -3
- package/src/contracts/party_media/party_media.ts +20 -4
- package/src/contracts/party_platform_link/party_platform_link.ts +15 -7
- package/src/contracts/party_profile/party_profile.ts +33 -8
- package/src/contracts/party_roles/party_roles.ts +19 -4
- package/src/contracts/party_tags/party_tags.ts +16 -4
- package/src/contracts/party_wallet/party_wallet.ts +2 -1
- package/src/contracts/platform_link/platform_link.ts +322 -0
- package/src/contracts/record/pressing.ts +50 -4
- package/src/contracts/record/record.ts +15 -1
- package/src/contracts/record_shop/listing.ts +76 -13
- package/src/contracts/recording_advisory/recording_advisory.ts +15 -8
- package/src/contracts/recording_credits/recording_credits.ts +63 -12
- package/src/contracts/recording_engine_session/recording_engine_session.ts +19 -4
- package/src/contracts/recording_genre/recording_genre.ts +53 -9
- package/src/contracts/recording_language/recording_language.ts +18 -5
- package/src/contracts/recording_master_reference/recording_master_reference.ts +18 -5
- package/src/contracts/recording_royalty_pool/recording_royalty_pool.ts +56 -4
- package/src/contracts/recording_royalty_pool_plugin/recording_royalty_pool_plugin.ts +67 -1
- package/src/contracts/recording_streaming_transcode/recording_streaming_transcode.ts +11 -4
- package/src/contracts/release_cover_art/release_cover_art.ts +126 -10
- package/src/contracts/release_credits/release_credits.ts +18 -4
- package/src/contracts/release_description/release_description.ts +9 -4
- package/src/contracts/release_dsp_link/release_dsp_link.ts +74 -19
- package/src/contracts/release_genre/release_genre.ts +52 -11
- package/src/contracts/release_kind/release_kind.ts +19 -4
- package/src/contracts/release_revenue_distributor/release_revenue_distributor.ts +15 -0
- package/src/contracts/release_revenue_distributor_plugin/release_revenue_distributor_plugin.ts +38 -1
- package/src/contracts/routed_stake/routed_stake.ts +79 -7
- package/src/contracts/royalty_pool/pool.ts +140 -38
- package/src/contracts/royalty_pool/stake.ts +5 -2
- package/src/contracts/share/share.ts +97 -0
- package/src/contracts/vault/vault.ts +55 -4
- package/src/contracts.ts +18 -0
- package/src/cover.ts +14 -15
- package/src/credits.ts +27 -22
- package/src/deployments.ts +3 -4
- package/src/errors.ts +64 -34
- package/src/events.ts +260 -39
- package/src/genre.ts +15 -14
- package/src/index.ts +19 -10
- package/src/party/client.ts +217 -208
- package/src/party/extensions/ctas.ts +3 -3
- package/src/party/extensions/genres.ts +4 -4
- package/src/party/extensions/links.ts +7 -7
- package/src/party/extensions/media.ts +3 -3
- package/src/party/extensions/profile.ts +3 -3
- package/src/party/extensions/roles.ts +5 -5
- package/src/party/extensions/tags.ts +4 -4
- package/src/party/index.ts +0 -1
- package/src/party/queries.ts +90 -87
- package/src/pressing.ts +132 -89
- package/src/publication.ts +33 -32
- package/src/queries.ts +3 -3
- package/src/read/artist.ts +36 -17
- package/src/read/catalog.ts +68 -36
- package/src/read/client.ts +55 -30
- package/src/read/config.ts +55 -30
- package/src/read/genres.ts +22 -18
- package/src/read/index.ts +8 -6
- package/src/read/receipts.ts +130 -67
- package/src/read/royalties.ts +22 -10
- package/src/read/wallet.ts +226 -216
- package/src/read/works.ts +51 -44
- package/src/recording-extensions.ts +27 -24
- package/src/release-extensions.ts +7 -7
- package/src/release-graph.ts +2 -1
- package/src/royalty.ts +19 -25
- package/src/share.ts +197 -128
- package/src/transactions.ts +15 -8
- package/src/vault.ts +24 -31
- package/dist/contracts/record_shop/deps/std/type_name.d.ts.map +0 -1
- package/dist/contracts/record_shop/deps/std/type_name.js.map +0 -1
- package/dist/contracts/recording_language/deps/language_code/language_code.d.ts +0 -6
- package/dist/contracts/recording_language/deps/language_code/language_code.d.ts.map +0 -1
- package/dist/contracts/recording_language/deps/language_code/language_code.js +0 -8
- package/dist/contracts/recording_language/deps/language_code/language_code.js.map +0 -1
- package/dist/contracts/recording_master_reference/deps/ori/confidentiality.d.ts +0 -24
- package/dist/contracts/recording_master_reference/deps/ori/confidentiality.d.ts.map +0 -1
- package/dist/contracts/recording_master_reference/deps/ori/confidentiality.js +0 -24
- package/dist/contracts/recording_master_reference/deps/ori/confidentiality.js.map +0 -1
- package/dist/contracts/recording_master_reference/deps/ori/data.d.ts +0 -16
- package/dist/contracts/recording_master_reference/deps/ori/data.d.ts.map +0 -1
- package/dist/contracts/recording_master_reference/deps/ori/data.js +0 -12
- package/dist/contracts/recording_master_reference/deps/ori/data.js.map +0 -1
- package/dist/execute.d.ts +0 -32
- package/dist/execute.d.ts.map +0 -1
- package/dist/execute.js +0 -36
- package/dist/execute.js.map +0 -1
- package/src/contracts/recording_language/deps/language_code/language_code.ts +0 -8
- package/src/contracts/recording_master_reference/deps/ori/confidentiality.ts +0 -24
- package/src/contracts/recording_master_reference/deps/ori/data.ts +0 -12
- package/src/execute.ts +0 -56
- /package/dist/contracts/{record_shop → miso_pay}/deps/std/type_name.d.ts +0 -0
- /package/dist/contracts/{record_shop → miso_pay}/deps/std/type_name.js +0 -0
- /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
|
|
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,
|
|
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,
|
|
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,
|
|
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. */
|
package/dist/royalty.d.ts.map
CHANGED
|
@@ -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,MAAM,EAAE,MAAM,QAAQ,CAAC;AACxC,OAAO,
|
|
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,MAAM,EAAE,MAAM,QAAQ,CAAC;AACxC,OAAO,EAAY,GAAG,EAAa,KAAK,WAAW,EAAE,KAAK,iBAAiB,EAAE,KAAK,cAAc,EAAE,MAAM,yBAAyB,CAAC;;;;IAsBhI,oEAAoE;;;AANtE,sFAAsF;AACtF,qBAAa,wBAAyB,SAAQ,6BAO5C;CAAG;;;IAKH,+DAA+D;;IAE/D,oEAAoE;;IAEpE,gEAAgE;;IAEhE,8EAA8E;;IAE9E,oFAAoF;;;AAXtF,kHAAkH;AAClH,qBAAa,WAAY,SAAQ,gBAY/B;CAAG;;;IAKH,0EAA0E;;;;AAH5E,yDAAyD;AACzD,qBAAa,YAAa,SAAQ,iBAKhC;CAAG;;;IAKH,oEAAoE;;;AAHtE,sFAAsF;AACtF,qBAAa,WAAY,SAAQ,gBAI/B;CAAG;AAyCL,2EAA2E;AAC3E,eAAO,MAAM,kBAAkB,8GAS7B,CAAC;AAEH,mFAAmF;AACnF,eAAO,MAAM,mBAAmB,gHAS9B,CAAC;AAEH,kFAAkF;AAClF,eAAO,MAAM,kBAAkB,qHAS7B,CAAC;AAEH,+EAA+E;AAC/E,wBAAgB,mBAAmB,CACjC,Q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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 {
|
|
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
|
|
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
|
-
|
|
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
|
|
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
|
-
|
|
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
|
|
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
|
-
|
|
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) {
|
package/dist/royalty.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"royalty.js","sourceRoot":"","sources":["../src/royalty.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,sCAAsC;AAEtC,gFAAgF;AAChF,uEAAuE;AACvE,gFAAgF;AAChF,+EAA+E;AAC/E,8DAA8D;AAE9D,OAAO,EAAE,WAAW,EAA4D,MAAM,0BAA0B,CAAC;AACjH,OAAO,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AACvE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AACxC,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"royalty.js","sourceRoot":"","sources":["../src/royalty.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,sCAAsC;AAEtC,gFAAgF;AAChF,uEAAuE;AACvE,gFAAgF;AAChF,+EAA+E;AAC/E,8DAA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or } from "@mysten/sui/transactions";
|
|
2
|
-
import type { Signer } from "@mysten/sui/cryptography";
|
|
3
1
|
import { Effect } from "effect";
|
|
4
|
-
import {
|
|
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)
|
|
16
|
-
gasUsed:
|
|
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
|
|
45
|
-
*
|
|
46
|
-
*
|
|
47
|
-
*
|
|
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
|
|
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:
|
|
52
|
-
},
|
|
77
|
+
gasUsed: bigint;
|
|
78
|
+
}, UnexpectedEffects | RunError, Sui>;
|
|
53
79
|
/**
|
|
54
80
|
* Initializes each published package into a `Currency<Share>` + `TreasuryCap`,
|
|
55
|
-
* batched
|
|
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
|
-
*
|
|
59
|
-
*
|
|
60
|
-
*
|
|
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
|
|
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:
|
|
67
|
-
},
|
|
100
|
+
gasUsed: bigint;
|
|
101
|
+
}, RunError | UnexpectedEffects | E, Sui>;
|
|
68
102
|
//# sourceMappingURL=share.d.ts.map
|
package/dist/share.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"share.d.ts","sourceRoot":"","sources":["../src/share.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"share.d.ts","sourceRoot":"","sources":["../src/share.ts"],"names":[],"mappings":"AAiCA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,EAAY,iBAAiB,EAAiB,KAAK,GAAG,EAAE,KAAK,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAChH,OAAO,EAAM,KAAK,QAAQ,EAAE,KAAK,MAAM,EAAE,MAAM,4BAA4B,CAAC;AAE5E,OAAO,EAAiD,KAAK,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAcxG,MAAM,WAAW,aAAa;IAC5B,sCAAsC;IACtC,SAAS,EAAE,MAAM,CAAC;IAClB,uCAAuC;IACvC,UAAU,EAAE,MAAM,CAAC;IACnB,oEAAoE;IACpE,SAAS,EAAE,MAAM,CAAC;IAClB,+EAA+E;IAC/E,aAAa,EAAE,MAAM,CAAC;IACtB,qGAAqG;IACrG,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,+FAA+F;AAC/F,MAAM,WAAW,OAAO;IACtB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,QAAQ,CAAC,EAAE,UAAU,CAAC;IAC/B,oGAAoG;IACpG,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;CAC3B;AAID;;;;;GAKG;AACH,wBAAgB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|
|
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 {
|
|
7
|
-
import {
|
|
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
|
-
//
|
|
16
|
-
//
|
|
17
|
-
//
|
|
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
|
-
/**
|
|
40
|
-
|
|
41
|
-
|
|
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
|
|
47
|
-
const
|
|
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
|
|
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:
|
|
108
|
+
currencyId: String(currency.id),
|
|
59
109
|
shareType: `${packageId}::share::Share`,
|
|
60
|
-
treasuryCapId:
|
|
61
|
-
gasUsed:
|
|
110
|
+
treasuryCapId: String(treasuryCap.id),
|
|
111
|
+
gasUsed: published.gasUsedTotal + initialized.gasUsedTotal,
|
|
62
112
|
};
|
|
63
113
|
});
|
|
64
|
-
// ── Batched
|
|
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,
|
|
74
|
-
* at ≤5 publishes per
|
|
75
|
-
*
|
|
76
|
-
*
|
|
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* (
|
|
135
|
+
export const publishShareCurrencies = Effect.fn("publishShareCurrencies")(function* (count, opts) {
|
|
79
136
|
if (count <= 0)
|
|
80
|
-
return { packageIds: [], gasUsed:
|
|
137
|
+
return { packageIds: [], gasUsed: 0n };
|
|
81
138
|
// One patched template, reused for every publish (identical bytecode → distinct packages).
|
|
82
|
-
const
|
|
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) =>
|
|
88
|
-
|
|
89
|
-
|
|
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
|
-
|
|
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
|
-
/**
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
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 =
|
|
102
|
-
const treasury =
|
|
103
|
-
|
|
104
|
-
|
|
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
|
|
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
|
-
*
|
|
116
|
-
*
|
|
117
|
-
*
|
|
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
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
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
|
-
|
|
155
|
-
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
|
|
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
|