@misonetwork/sdk 0.7.0 → 0.8.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.
- package/README.md +181 -139
- package/dist/client.d.ts +1225 -8
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +43 -19
- package/dist/client.js.map +1 -1
- package/dist/contracts/composition_credits/composition_credits.d.ts +181 -0
- package/dist/contracts/composition_credits/composition_credits.d.ts.map +1 -0
- package/dist/contracts/composition_credits/composition_credits.js +109 -0
- package/dist/contracts/composition_credits/composition_credits.js.map +1 -0
- package/dist/contracts/composition_credits/composition_party_role.d.ts +119 -0
- package/dist/contracts/composition_credits/composition_party_role.d.ts.map +1 -0
- package/dist/contracts/composition_credits/composition_party_role.js +139 -0
- package/dist/contracts/composition_credits/composition_party_role.js.map +1 -0
- package/dist/contracts/composition_credits/deps/miso_credit/credit.d.ts +24 -0
- package/dist/contracts/composition_credits/deps/miso_credit/credit.d.ts.map +1 -0
- package/dist/contracts/composition_credits/deps/miso_credit/credit.js +23 -0
- package/dist/contracts/composition_credits/deps/miso_credit/credit.js.map +1 -0
- package/dist/contracts/composition_credits/deps/sui/vec_map.d.ts +37 -0
- package/dist/contracts/composition_credits/deps/sui/vec_map.d.ts.map +1 -0
- package/dist/contracts/composition_credits/deps/sui/vec_map.js +28 -0
- package/dist/contracts/composition_credits/deps/sui/vec_map.js.map +1 -0
- package/dist/contracts/miso/composition.d.ts +1 -1
- package/dist/contracts/miso/composition.js +2 -2
- package/dist/contracts/miso/deps/bps/bps.d.ts +1 -1
- package/dist/contracts/miso/deps/bps/bps.js +1 -1
- package/dist/contracts/miso/recording.d.ts +1 -1
- package/dist/contracts/miso/recording.js +1 -1
- package/dist/contracts/miso/release.d.ts +61 -37
- package/dist/contracts/miso/release.d.ts.map +1 -1
- package/dist/contracts/miso/release.js +65 -38
- package/dist/contracts/miso/release.js.map +1 -1
- package/dist/contracts/miso/track.d.ts +2 -2
- package/dist/contracts/miso/track.js +2 -2
- package/dist/contracts/recording_advisory/recording_advisory.d.ts +194 -0
- package/dist/contracts/recording_advisory/recording_advisory.d.ts.map +1 -0
- package/dist/contracts/recording_advisory/recording_advisory.js +204 -0
- package/dist/contracts/recording_advisory/recording_advisory.js.map +1 -0
- package/dist/contracts/recording_credits/deps/miso_credit/credit.d.ts +24 -0
- package/dist/contracts/recording_credits/deps/miso_credit/credit.d.ts.map +1 -0
- package/dist/contracts/recording_credits/deps/miso_credit/credit.js +23 -0
- package/dist/contracts/recording_credits/deps/miso_credit/credit.js.map +1 -0
- package/dist/contracts/recording_credits/deps/sui/vec_map.d.ts +37 -0
- package/dist/contracts/recording_credits/deps/sui/vec_map.d.ts.map +1 -0
- package/dist/contracts/recording_credits/deps/sui/vec_map.js +28 -0
- package/dist/contracts/recording_credits/deps/sui/vec_map.js.map +1 -0
- package/dist/contracts/recording_credits/deps/sui/vec_set.d.ts +21 -0
- package/dist/contracts/recording_credits/deps/sui/vec_set.d.ts.map +1 -0
- package/dist/contracts/recording_credits/deps/sui/vec_set.js +20 -0
- package/dist/contracts/recording_credits/deps/sui/vec_set.js.map +1 -0
- package/dist/contracts/recording_credits/recording_credits.d.ts +2313 -0
- package/dist/contracts/recording_credits/recording_credits.d.ts.map +1 -0
- package/dist/contracts/recording_credits/recording_credits.js +270 -0
- package/dist/contracts/recording_credits/recording_credits.js.map +1 -0
- package/dist/contracts/recording_credits/recording_party_role.d.ts +1174 -0
- package/dist/contracts/recording_credits/recording_party_role.d.ts.map +1 -0
- package/dist/contracts/recording_credits/recording_party_role.js +692 -0
- package/dist/contracts/recording_credits/recording_party_role.js.map +1 -0
- package/dist/contracts/recording_language/deps/language_code/language_code.d.ts +6 -0
- package/dist/contracts/recording_language/deps/language_code/language_code.d.ts.map +1 -0
- package/dist/contracts/recording_language/deps/language_code/language_code.js +8 -0
- package/dist/contracts/recording_language/deps/language_code/language_code.js.map +1 -0
- package/dist/contracts/recording_language/recording_language.d.ts +152 -0
- package/dist/contracts/recording_language/recording_language.d.ts.map +1 -0
- package/dist/contracts/recording_language/recording_language.js +149 -0
- package/dist/contracts/recording_language/recording_language.js.map +1 -0
- package/dist/contracts/recording_master_reference/deps/ori/walrus_data.d.ts +52 -0
- package/dist/contracts/recording_master_reference/deps/ori/walrus_data.d.ts.map +1 -0
- package/dist/contracts/recording_master_reference/deps/ori/walrus_data.js +37 -0
- package/dist/contracts/recording_master_reference/deps/ori/walrus_data.js.map +1 -0
- package/dist/contracts/recording_master_reference/recording_master_reference.d.ts +131 -0
- package/dist/contracts/recording_master_reference/recording_master_reference.d.ts.map +1 -0
- package/dist/contracts/recording_master_reference/recording_master_reference.js +121 -0
- package/dist/contracts/recording_master_reference/recording_master_reference.js.map +1 -0
- package/dist/contracts/recording_preview/deps/ori/walrus_data.d.ts +52 -0
- package/dist/contracts/recording_preview/deps/ori/walrus_data.d.ts.map +1 -0
- package/dist/contracts/recording_preview/deps/ori/walrus_data.js +37 -0
- package/dist/contracts/recording_preview/deps/ori/walrus_data.js.map +1 -0
- package/dist/contracts/recording_preview/recording_preview.d.ts +104 -0
- package/dist/contracts/recording_preview/recording_preview.d.ts.map +1 -0
- package/dist/contracts/recording_preview/recording_preview.js +94 -0
- package/dist/contracts/recording_preview/recording_preview.js.map +1 -0
- package/dist/contracts/release_cover_art/deps/0x340057f2174fb59e4626742dd2b46c662237837b6187450cb59e4976ce7eac78/walrus_data.d.ts +52 -0
- package/dist/contracts/release_cover_art/deps/0x340057f2174fb59e4626742dd2b46c662237837b6187450cb59e4976ce7eac78/walrus_data.d.ts.map +1 -0
- package/dist/contracts/release_cover_art/deps/0x340057f2174fb59e4626742dd2b46c662237837b6187450cb59e4976ce7eac78/walrus_data.js +37 -0
- package/dist/contracts/release_cover_art/deps/0x340057f2174fb59e4626742dd2b46c662237837b6187450cb59e4976ce7eac78/walrus_data.js.map +1 -0
- package/dist/contracts/release_cover_art/deps/cover_art/cover_art.d.ts +46 -0
- package/dist/contracts/release_cover_art/deps/cover_art/cover_art.d.ts.map +1 -0
- package/dist/contracts/release_cover_art/deps/cover_art/cover_art.js +21 -0
- package/dist/contracts/release_cover_art/deps/cover_art/cover_art.js.map +1 -0
- package/dist/contracts/release_cover_art/deps/per_track/per_track.d.ts +33 -0
- package/dist/contracts/release_cover_art/deps/per_track/per_track.d.ts.map +1 -0
- package/dist/contracts/release_cover_art/deps/per_track/per_track.js +32 -0
- package/dist/contracts/release_cover_art/deps/per_track/per_track.js.map +1 -0
- package/dist/contracts/release_cover_art/release_cover_art.d.ts +300 -0
- package/dist/contracts/release_cover_art/release_cover_art.d.ts.map +1 -0
- package/dist/contracts/release_cover_art/release_cover_art.js +168 -0
- package/dist/contracts/release_cover_art/release_cover_art.js.map +1 -0
- package/dist/contracts/release_credits/deps/miso_credit/credit.d.ts +24 -0
- package/dist/contracts/release_credits/deps/miso_credit/credit.d.ts.map +1 -0
- package/dist/contracts/release_credits/deps/miso_credit/credit.js +23 -0
- package/dist/contracts/release_credits/deps/miso_credit/credit.js.map +1 -0
- package/dist/contracts/release_credits/deps/sui/vec_map.d.ts +37 -0
- package/dist/contracts/release_credits/deps/sui/vec_map.d.ts.map +1 -0
- package/dist/contracts/release_credits/deps/sui/vec_map.js +28 -0
- package/dist/contracts/release_credits/deps/sui/vec_map.js.map +1 -0
- package/dist/contracts/release_credits/release_credits.d.ts +142 -0
- package/dist/contracts/release_credits/release_credits.d.ts.map +1 -0
- package/dist/contracts/release_credits/release_credits.js +108 -0
- package/dist/contracts/release_credits/release_credits.js.map +1 -0
- package/dist/contracts/release_credits/release_party_role.d.ts +58 -0
- package/dist/contracts/release_credits/release_party_role.d.ts.map +1 -0
- package/dist/contracts/release_credits/release_party_role.js +66 -0
- package/dist/contracts/release_credits/release_party_role.js.map +1 -0
- package/dist/contracts/release_description/release_description.d.ts +112 -0
- package/dist/contracts/release_description/release_description.d.ts.map +1 -0
- package/dist/contracts/release_description/release_description.js +123 -0
- package/dist/contracts/release_description/release_description.js.map +1 -0
- package/dist/contracts/release_dsp_link/release_dsp_link.d.ts +644 -0
- package/dist/contracts/release_dsp_link/release_dsp_link.d.ts.map +1 -0
- package/dist/contracts/release_dsp_link/release_dsp_link.js +556 -0
- package/dist/contracts/release_dsp_link/release_dsp_link.js.map +1 -0
- package/dist/contracts/release_genre/deps/per_track/per_track.d.ts +33 -0
- package/dist/contracts/release_genre/deps/per_track/per_track.d.ts.map +1 -0
- package/dist/contracts/release_genre/deps/per_track/per_track.js +32 -0
- package/dist/contracts/release_genre/deps/per_track/per_track.js.map +1 -0
- package/dist/contracts/release_genre/release_genre.d.ts +193 -0
- package/dist/contracts/release_genre/release_genre.d.ts.map +1 -0
- package/dist/contracts/release_genre/release_genre.js +207 -0
- package/dist/contracts/release_genre/release_genre.js.map +1 -0
- package/dist/contracts/release_kind/release_kind.d.ts +98 -0
- package/dist/contracts/release_kind/release_kind.d.ts.map +1 -0
- package/dist/contracts/release_kind/release_kind.js +109 -0
- package/dist/contracts/release_kind/release_kind.js.map +1 -0
- package/dist/contracts/release_snapshot_bundle/deps/ori/walrus_data.d.ts +52 -0
- package/dist/contracts/release_snapshot_bundle/deps/ori/walrus_data.d.ts.map +1 -0
- package/dist/contracts/release_snapshot_bundle/deps/ori/walrus_data.js +37 -0
- package/dist/contracts/release_snapshot_bundle/deps/ori/walrus_data.js.map +1 -0
- package/dist/contracts/release_snapshot_bundle/release_snapshot_bundle.d.ts +91 -0
- package/dist/contracts/release_snapshot_bundle/release_snapshot_bundle.d.ts.map +1 -0
- package/dist/contracts/release_snapshot_bundle/release_snapshot_bundle.js +91 -0
- package/dist/contracts/release_snapshot_bundle/release_snapshot_bundle.js.map +1 -0
- package/dist/contracts/routed_stake/deps/royalty_pool/stake.d.ts +54 -0
- package/dist/contracts/routed_stake/deps/royalty_pool/stake.d.ts.map +1 -0
- package/dist/contracts/routed_stake/deps/royalty_pool/stake.js +37 -0
- package/dist/contracts/routed_stake/deps/royalty_pool/stake.js.map +1 -0
- package/dist/contracts/routed_stake/deps/std/type_name.d.ts +18 -0
- package/dist/contracts/routed_stake/deps/std/type_name.d.ts.map +1 -0
- package/dist/contracts/routed_stake/deps/std/type_name.js +20 -0
- package/dist/contracts/routed_stake/deps/std/type_name.js.map +1 -0
- package/dist/contracts/routed_stake/deps/sui/balance.d.ts +13 -0
- package/dist/contracts/routed_stake/deps/sui/balance.d.ts.map +1 -0
- package/dist/contracts/routed_stake/deps/sui/balance.js +15 -0
- package/dist/contracts/routed_stake/deps/sui/balance.js.map +1 -0
- package/dist/contracts/routed_stake/deps/sui/vec_map.d.ts +37 -0
- package/dist/contracts/routed_stake/deps/sui/vec_map.d.ts.map +1 -0
- package/dist/contracts/routed_stake/deps/sui/vec_map.js +28 -0
- package/dist/contracts/routed_stake/deps/sui/vec_map.js.map +1 -0
- package/dist/contracts/routed_stake/routed_stake.d.ts +356 -0
- package/dist/contracts/routed_stake/routed_stake.d.ts.map +1 -0
- package/dist/contracts/routed_stake/routed_stake.js +311 -0
- package/dist/contracts/routed_stake/routed_stake.js.map +1 -0
- package/dist/contracts/royalty_pool/deps/std/type_name.d.ts +18 -0
- package/dist/contracts/royalty_pool/deps/std/type_name.d.ts.map +1 -0
- package/dist/contracts/royalty_pool/deps/std/type_name.js +20 -0
- package/dist/contracts/royalty_pool/deps/std/type_name.js.map +1 -0
- package/dist/contracts/royalty_pool/deps/sui/balance.d.ts +13 -0
- package/dist/contracts/royalty_pool/deps/sui/balance.d.ts.map +1 -0
- package/dist/contracts/royalty_pool/deps/sui/balance.js +15 -0
- package/dist/contracts/royalty_pool/deps/sui/balance.js.map +1 -0
- package/dist/contracts/royalty_pool/deps/sui/vec_map.d.ts +37 -0
- package/dist/contracts/royalty_pool/deps/sui/vec_map.d.ts.map +1 -0
- package/dist/contracts/royalty_pool/deps/sui/vec_map.js +28 -0
- package/dist/contracts/royalty_pool/deps/sui/vec_map.js.map +1 -0
- package/dist/contracts/royalty_pool/pool.d.ts +394 -0
- package/dist/contracts/royalty_pool/pool.d.ts.map +1 -0
- package/dist/contracts/royalty_pool/pool.js +387 -0
- package/dist/contracts/royalty_pool/pool.js.map +1 -0
- package/dist/contracts/royalty_pool/stake.d.ts +202 -0
- package/dist/contracts/royalty_pool/stake.d.ts.map +1 -0
- package/dist/contracts/royalty_pool/stake.js +197 -0
- package/dist/contracts/royalty_pool/stake.js.map +1 -0
- package/dist/contracts.d.ts +37 -3
- package/dist/contracts.d.ts.map +1 -1
- package/dist/contracts.js +42 -8
- package/dist/contracts.js.map +1 -1
- package/dist/deployments.d.ts +46 -12
- package/dist/deployments.d.ts.map +1 -1
- package/dist/deployments.js +119 -11
- package/dist/deployments.js.map +1 -1
- package/dist/events.d.ts +1081 -0
- package/dist/events.d.ts.map +1 -0
- package/dist/events.js +124 -0
- package/dist/events.js.map +1 -0
- package/dist/execute.d.ts.map +1 -1
- package/dist/execute.js +0 -4
- package/dist/execute.js.map +1 -1
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -3
- package/dist/index.js.map +1 -1
- package/dist/internal.d.ts.map +1 -1
- package/dist/internal.js.map +1 -1
- package/dist/numeric.d.ts +5 -0
- package/dist/numeric.d.ts.map +1 -0
- package/dist/numeric.js +21 -0
- package/dist/numeric.js.map +1 -0
- package/dist/packages.d.ts +159 -0
- package/dist/packages.d.ts.map +1 -0
- package/dist/packages.js +179 -0
- package/dist/packages.js.map +1 -0
- package/dist/parsers.d.ts +5 -1
- package/dist/parsers.d.ts.map +1 -1
- package/dist/parsers.js +18 -2
- package/dist/parsers.js.map +1 -1
- package/dist/queries.d.ts +92 -0
- package/dist/queries.d.ts.map +1 -1
- package/dist/queries.js +132 -23
- package/dist/queries.js.map +1 -1
- package/dist/transactions.d.ts +96 -3
- package/dist/transactions.d.ts.map +1 -1
- package/dist/transactions.js +123 -11
- package/dist/transactions.js.map +1 -1
- package/dist/types.d.ts +18 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/view.d.ts +6 -5
- package/dist/view.d.ts.map +1 -1
- package/dist/view.js +8 -2
- package/dist/view.js.map +1 -1
- package/package.json +14 -4
- package/src/client.ts +57 -23
- package/src/contracts/composition_credits/composition_credits.ts +169 -0
- package/src/contracts/composition_credits/composition_party_role.ts +189 -0
- package/src/contracts/composition_credits/deps/miso_credit/credit.ts +27 -0
- package/src/contracts/composition_credits/deps/sui/vec_map.ts +33 -0
- package/src/contracts/miso/composition.ts +8 -8
- package/src/contracts/miso/deps/bps/bps.ts +3 -3
- package/src/contracts/miso/recording.ts +10 -10
- package/src/contracts/miso/release.ts +103 -67
- package/src/contracts/miso/track.ts +5 -5
- package/src/contracts/recording_advisory/recording_advisory.ts +315 -0
- package/src/contracts/recording_credits/deps/miso_credit/credit.ts +27 -0
- package/src/contracts/recording_credits/deps/sui/vec_map.ts +33 -0
- package/src/contracts/recording_credits/deps/sui/vec_set.ts +21 -0
- package/src/contracts/recording_credits/recording_credits.ts +458 -0
- package/src/contracts/recording_credits/recording_party_role.ts +1041 -0
- package/src/contracts/recording_language/deps/language_code/language_code.ts +7 -0
- package/src/contracts/recording_language/recording_language.ts +237 -0
- package/src/contracts/recording_master_reference/deps/ori/walrus_data.ts +36 -0
- package/src/contracts/recording_master_reference/recording_master_reference.ts +181 -0
- package/src/contracts/recording_preview/deps/ori/walrus_data.ts +36 -0
- package/src/contracts/recording_preview/recording_preview.ts +154 -0
- package/src/contracts/release_cover_art/deps/0x340057f2174fb59e4626742dd2b46c662237837b6187450cb59e4976ce7eac78/walrus_data.ts +36 -0
- package/src/contracts/release_cover_art/deps/cover_art/cover_art.ts +23 -0
- package/src/contracts/release_cover_art/deps/per_track/per_track.ts +36 -0
- package/src/contracts/release_cover_art/release_cover_art.ts +251 -0
- package/src/contracts/release_credits/deps/miso_credit/credit.ts +27 -0
- package/src/contracts/release_credits/deps/sui/vec_map.ts +33 -0
- package/src/contracts/release_credits/release_credits.ts +156 -0
- package/src/contracts/release_credits/release_party_role.ts +87 -0
- package/src/contracts/release_description/release_description.ts +167 -0
- package/src/contracts/release_dsp_link/release_dsp_link.ts +813 -0
- package/src/contracts/release_genre/deps/per_track/per_track.ts +36 -0
- package/src/contracts/release_genre/release_genre.ts +314 -0
- package/src/contracts/release_kind/release_kind.ts +153 -0
- package/src/contracts/release_snapshot_bundle/deps/ori/walrus_data.ts +36 -0
- package/src/contracts/release_snapshot_bundle/release_snapshot_bundle.ts +124 -0
- package/src/contracts/routed_stake/deps/royalty_pool/stake.ts +39 -0
- package/src/contracts/routed_stake/deps/std/type_name.ts +22 -0
- package/src/contracts/routed_stake/deps/sui/balance.ts +17 -0
- package/src/contracts/routed_stake/deps/sui/vec_map.ts +33 -0
- package/src/contracts/routed_stake/routed_stake.ts +508 -0
- package/src/contracts/royalty_pool/deps/std/type_name.ts +22 -0
- package/src/contracts/royalty_pool/deps/sui/balance.ts +17 -0
- package/src/contracts/royalty_pool/deps/sui/vec_map.ts +33 -0
- package/src/contracts/royalty_pool/pool.ts +613 -0
- package/src/contracts/royalty_pool/stake.ts +317 -0
- package/src/contracts.ts +59 -6
- package/src/deployments.ts +160 -22
- package/src/events.ts +129 -0
- package/src/execute.ts +0 -4
- package/src/index.ts +6 -3
- package/src/internal.ts +0 -4
- package/src/numeric.ts +25 -0
- package/src/packages.ts +251 -0
- package/src/parsers.ts +32 -2
- package/src/queries.ts +227 -25
- package/src/transactions.ts +254 -12
- package/src/types.ts +20 -0
- package/src/view.ts +12 -6
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**************************************************************
|
|
2
|
+
* THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
|
|
3
|
+
**************************************************************/
|
|
4
|
+
import { type BcsType, bcs } from '@mysten/sui/bcs';
|
|
5
|
+
import { MoveStruct } from '../../../utils/index.ts';
|
|
6
|
+
const $moduleName = '0x2::vec_map';
|
|
7
|
+
/** An entry in the map */
|
|
8
|
+
export function Entry<K extends BcsType<any>, V extends BcsType<any>>(...typeParameters: [
|
|
9
|
+
K,
|
|
10
|
+
V
|
|
11
|
+
]) {
|
|
12
|
+
return new MoveStruct({ name: `${$moduleName}::Entry<${typeParameters[0].name as K['name']}, ${typeParameters[1].name as V['name']}>`, fields: {
|
|
13
|
+
key: typeParameters[0],
|
|
14
|
+
value: typeParameters[1]
|
|
15
|
+
} });
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* A map data structure backed by a vector. The map is guaranteed not to contain
|
|
19
|
+
* duplicate keys, but entries are _not_ sorted by key--entries are included in
|
|
20
|
+
* insertion order. All operations are O(N) in the size of the map--the intention
|
|
21
|
+
* of this data structure is only to provide the convenience of programming against
|
|
22
|
+
* a map API. Large maps should use handwritten parent/child relationships instead.
|
|
23
|
+
* Maps that need sorted iteration rather than insertion order iteration should
|
|
24
|
+
* also be handwritten.
|
|
25
|
+
*/
|
|
26
|
+
export function VecMap<K extends BcsType<any>, V extends BcsType<any>>(...typeParameters: [
|
|
27
|
+
K,
|
|
28
|
+
V
|
|
29
|
+
]) {
|
|
30
|
+
return new MoveStruct({ name: `${$moduleName}::VecMap<${typeParameters[0].name as K['name']}, ${typeParameters[1].name as V['name']}>`, fields: {
|
|
31
|
+
contents: bcs.vector(Entry(typeParameters[0], typeParameters[1]))
|
|
32
|
+
} });
|
|
33
|
+
}
|
|
@@ -0,0 +1,613 @@
|
|
|
1
|
+
/**************************************************************
|
|
2
|
+
* THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
|
|
3
|
+
**************************************************************/
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Accumulator-based royalty distribution pool for the protocol's share tokens.
|
|
8
|
+
*
|
|
9
|
+
* A `RoyaltyPool<Share, Currency>` is a derived object of any UID-bearing parent.
|
|
10
|
+
* Its address is deterministically derived from `(parent_id, Share, Currency)` —
|
|
11
|
+
* at most one pool per triple, and the pool at that address is necessarily typed
|
|
12
|
+
* `RoyaltyPool<Share, Currency>` (the same type parameters produce the address and
|
|
13
|
+
* the object) and necessarily shared (the pool is key-only; `share` is its only
|
|
14
|
+
* consumer). The `Share` phantom identifies which share-token type can stake
|
|
15
|
+
* against the pool.
|
|
16
|
+
*
|
|
17
|
+
* Holders create a `Stake<Share>` (see `royalty_pool::stake`) and register it.
|
|
18
|
+
* Callers fund the pool by handing it a `Balance<Currency>` via `deposit`; the
|
|
19
|
+
* accumulator advances and claims pay out the per-stake proportional share since
|
|
20
|
+
* each stake's last claim.
|
|
21
|
+
*
|
|
22
|
+
* The pool is funded two ways, both committing the funds to share holders:
|
|
23
|
+
*
|
|
24
|
+
* - `deposit(balance)` from any caller holding `&mut` on the pool — e.g.
|
|
25
|
+
* `routed_stake::sweep`, which deposits a wrapped stake's claimed rewards into
|
|
26
|
+
* its parent's pool.
|
|
27
|
+
* - Delivery to the pool's derived address — pending `Coin<Currency>` transfers or
|
|
28
|
+
* address-balance credits (e.g. `release_revenue_distributor` settles each
|
|
29
|
+
* track's split there). The address is a pure function of
|
|
30
|
+
* `(parent_id, Share, Currency)`, so senders need the pool neither shared nor
|
|
31
|
+
* even created yet; a later `new` claims exactly that ID — and can only be the
|
|
32
|
+
* correctly-typed, shared pool. `receive_and_deposit` and `redeem_and_deposit`
|
|
33
|
+
* fold such funds into the accumulator, permissionlessly: anyone can complete
|
|
34
|
+
* the delivery. Both run through `deposit`, which aborts while no shares are
|
|
35
|
+
* staked — and the pool has no other withdrawal path — so funds at the pool's
|
|
36
|
+
* address wait, locked, until the pool exists and a stake registers.
|
|
37
|
+
*
|
|
38
|
+
* ### No activation delay (deliberate)
|
|
39
|
+
*
|
|
40
|
+
* Registration earns from the next deposit onward; there is no bonding or
|
|
41
|
+
* unbonding period (contrast Sui native staking's next-epoch activation). With the
|
|
42
|
+
* protocol's fixed-supply share token this is safe: a stake's take of any deposit
|
|
43
|
+
* is `v · s / S` with `S` (total registered) bounded by the share supply, so a
|
|
44
|
+
* continuously registered stake is guaranteed at least its pro-rata share of total
|
|
45
|
+
* supply on every deposit. Short-lived or just-in-time registrations can only
|
|
46
|
+
* compete for the _unregistered_ supply's drift — the designed incentive for being
|
|
47
|
+
* registered — never below any registered stake's floor.
|
|
48
|
+
*
|
|
49
|
+
* ### Precision
|
|
50
|
+
*
|
|
51
|
+
* The share token's shape is fixed at issuance by the protocol — exactly 10¹³ base
|
|
52
|
+
* units, 6 decimals, supply made immutable via `miso_share::share::initialize`
|
|
53
|
+
* (`make_supply_fixed`) — so `staked_shares ≤ 10¹³` objectively. A deposit of
|
|
54
|
+
* `value ≥ 1` base units therefore advances the accumulator by
|
|
55
|
+
* `value · PRECISION / staked_shares ≥ 10¹⁸ / 10¹³ = 10⁵`: the truncation-to-zero
|
|
56
|
+
* case that would permanently lock a deposit in the pool balance is impossible by
|
|
57
|
+
* construction, not by convention. Sub-base-unit claim residue (the remaining
|
|
58
|
+
* source of locked dust) is documented on `unregister_stake`.
|
|
59
|
+
*/
|
|
60
|
+
|
|
61
|
+
import { MoveStruct, MoveTuple, normalizeMoveArguments, type RawTransactionArgument } from '../utils/index.ts';
|
|
62
|
+
import { bcs } from '@mysten/sui/bcs';
|
|
63
|
+
import { type Transaction, type TransactionArgument } from '@mysten/sui/transactions';
|
|
64
|
+
import * as balance_1 from './deps/sui/balance.ts';
|
|
65
|
+
const $moduleName = '@local-pkg/royalty_pool::pool';
|
|
66
|
+
export const RoyaltyPool = new MoveStruct({ name: `${$moduleName}::RoyaltyPool<phantom Share, phantom Currency>`, fields: {
|
|
67
|
+
id: bcs.Address,
|
|
68
|
+
balance: balance_1.Balance,
|
|
69
|
+
staked_shares: bcs.u64(),
|
|
70
|
+
cumulative_reward_per_share: bcs.u256(),
|
|
71
|
+
/**
|
|
72
|
+
* Lifetime sum of every deposited value, in currency base units. Read-only
|
|
73
|
+
* analytics — never decremented; not used by any on-chain logic.
|
|
74
|
+
*/
|
|
75
|
+
cumulative_deposits: bcs.u128()
|
|
76
|
+
} });
|
|
77
|
+
export const RoyaltyPoolKey = new MoveTuple({ name: `${$moduleName}::RoyaltyPoolKey<phantom Share, phantom Currency>`, fields: [bcs.bool()] });
|
|
78
|
+
export const RoyaltyPoolCreatedEvent = new MoveStruct({ name: `${$moduleName}::RoyaltyPoolCreatedEvent<phantom Share, phantom Currency>`, fields: {
|
|
79
|
+
pool_id: bcs.Address,
|
|
80
|
+
parent_id: bcs.Address
|
|
81
|
+
} });
|
|
82
|
+
export const RoyaltyDepositedEvent = new MoveStruct({ name: `${$moduleName}::RoyaltyDepositedEvent<phantom Share, phantom Currency>`, fields: {
|
|
83
|
+
pool_id: bcs.Address,
|
|
84
|
+
value: bcs.u64()
|
|
85
|
+
} });
|
|
86
|
+
export const StakeRegisteredEvent = new MoveStruct({ name: `${$moduleName}::StakeRegisteredEvent<phantom Share, phantom Currency>`, fields: {
|
|
87
|
+
pool_id: bcs.Address,
|
|
88
|
+
stake_id: bcs.Address,
|
|
89
|
+
staked_amount: bcs.u64()
|
|
90
|
+
} });
|
|
91
|
+
export const StakeUnregisteredEvent = new MoveStruct({ name: `${$moduleName}::StakeUnregisteredEvent<phantom Share, phantom Currency>`, fields: {
|
|
92
|
+
pool_id: bcs.Address,
|
|
93
|
+
stake_id: bcs.Address,
|
|
94
|
+
unstaked_amount: bcs.u64()
|
|
95
|
+
} });
|
|
96
|
+
export const RoyaltyClaimedEvent = new MoveStruct({ name: `${$moduleName}::RoyaltyClaimedEvent<phantom Share, phantom Currency>`, fields: {
|
|
97
|
+
pool_id: bcs.Address,
|
|
98
|
+
stake_id: bcs.Address,
|
|
99
|
+
reward_amount: bcs.u64()
|
|
100
|
+
} });
|
|
101
|
+
export interface NewArguments {
|
|
102
|
+
parent: RawTransactionArgument<string>;
|
|
103
|
+
}
|
|
104
|
+
export interface NewOptions {
|
|
105
|
+
package?: string;
|
|
106
|
+
arguments: NewArguments | [
|
|
107
|
+
parent: RawTransactionArgument<string>
|
|
108
|
+
];
|
|
109
|
+
typeArguments: [
|
|
110
|
+
string,
|
|
111
|
+
string
|
|
112
|
+
];
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Construct a pool as a derived object of `parent`. The derivation key encodes
|
|
116
|
+
* both type parameters, so the pool's address is determined entirely by
|
|
117
|
+
* `(parent_id, Share, Currency)` — and therefore always names a pool of exactly
|
|
118
|
+
* this type (see `RoyaltyPoolKey`).
|
|
119
|
+
*
|
|
120
|
+
* Cap-gating happens at the parent: callers must obtain `&mut UID` via whatever
|
|
121
|
+
* cap-gated accessor the parent exposes.
|
|
122
|
+
*/
|
|
123
|
+
export function _new(options: NewOptions) {
|
|
124
|
+
const packageAddress = options.package ?? '@local-pkg/royalty_pool';
|
|
125
|
+
const argumentsTypes = [
|
|
126
|
+
'0x2::object::ID'
|
|
127
|
+
] satisfies (string | null)[];
|
|
128
|
+
const parameterNames = ["parent"];
|
|
129
|
+
return (tx: Transaction) => tx.moveCall({
|
|
130
|
+
package: packageAddress,
|
|
131
|
+
module: 'pool',
|
|
132
|
+
function: 'new',
|
|
133
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
134
|
+
typeArguments: options.typeArguments
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
export interface ShareArguments {
|
|
138
|
+
self: RawTransactionArgument<string>;
|
|
139
|
+
}
|
|
140
|
+
export interface ShareOptions {
|
|
141
|
+
package?: string;
|
|
142
|
+
arguments: ShareArguments | [
|
|
143
|
+
self: RawTransactionArgument<string>
|
|
144
|
+
];
|
|
145
|
+
typeArguments: [
|
|
146
|
+
string,
|
|
147
|
+
string
|
|
148
|
+
];
|
|
149
|
+
}
|
|
150
|
+
/** Share the pool object so holders can register and claim against it. */
|
|
151
|
+
export function share(options: ShareOptions) {
|
|
152
|
+
const packageAddress = options.package ?? '@local-pkg/royalty_pool';
|
|
153
|
+
const argumentsTypes = [
|
|
154
|
+
null
|
|
155
|
+
] satisfies (string | null)[];
|
|
156
|
+
const parameterNames = ["self"];
|
|
157
|
+
return (tx: Transaction) => tx.moveCall({
|
|
158
|
+
package: packageAddress,
|
|
159
|
+
module: 'pool',
|
|
160
|
+
function: 'share',
|
|
161
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
162
|
+
typeArguments: options.typeArguments
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
export interface DepositArguments {
|
|
166
|
+
self: RawTransactionArgument<string>;
|
|
167
|
+
balance: TransactionArgument;
|
|
168
|
+
}
|
|
169
|
+
export interface DepositOptions {
|
|
170
|
+
package?: string;
|
|
171
|
+
arguments: DepositArguments | [
|
|
172
|
+
self: RawTransactionArgument<string>,
|
|
173
|
+
balance: TransactionArgument
|
|
174
|
+
];
|
|
175
|
+
typeArguments: [
|
|
176
|
+
string,
|
|
177
|
+
string
|
|
178
|
+
];
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* Fold a balance into the accumulator. Aborts on zero staked shares (the deposit
|
|
182
|
+
* would be unattributable) or zero value (no-op deposits are rejected to keep
|
|
183
|
+
* events meaningful).
|
|
184
|
+
*
|
|
185
|
+
* Callers obtain the `Balance<Currency>` however they like — typically by pulling
|
|
186
|
+
* from a parent's pending coins or funds accumulator (see e.g.
|
|
187
|
+
* `composition_royalty_distributor`).
|
|
188
|
+
*/
|
|
189
|
+
export function deposit(options: DepositOptions) {
|
|
190
|
+
const packageAddress = options.package ?? '@local-pkg/royalty_pool';
|
|
191
|
+
const argumentsTypes = [
|
|
192
|
+
null,
|
|
193
|
+
null
|
|
194
|
+
] satisfies (string | null)[];
|
|
195
|
+
const parameterNames = ["self", "balance"];
|
|
196
|
+
return (tx: Transaction) => tx.moveCall({
|
|
197
|
+
package: packageAddress,
|
|
198
|
+
module: 'pool',
|
|
199
|
+
function: 'deposit',
|
|
200
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
201
|
+
typeArguments: options.typeArguments
|
|
202
|
+
});
|
|
203
|
+
}
|
|
204
|
+
export interface ReceiveAndDepositArguments {
|
|
205
|
+
self: RawTransactionArgument<string>;
|
|
206
|
+
coins: TransactionArgument;
|
|
207
|
+
}
|
|
208
|
+
export interface ReceiveAndDepositOptions {
|
|
209
|
+
package?: string;
|
|
210
|
+
arguments: ReceiveAndDepositArguments | [
|
|
211
|
+
self: RawTransactionArgument<string>,
|
|
212
|
+
coins: TransactionArgument
|
|
213
|
+
];
|
|
214
|
+
typeArguments: [
|
|
215
|
+
string,
|
|
216
|
+
string
|
|
217
|
+
];
|
|
218
|
+
}
|
|
219
|
+
/**
|
|
220
|
+
* Receive `Coin<Currency>` objects sent directly to this pool's address and fold
|
|
221
|
+
* them into the accumulator. Recovery path for funds delivered to the pool's
|
|
222
|
+
* address rather than via the canonical extension path.
|
|
223
|
+
*/
|
|
224
|
+
export function receiveAndDeposit(options: ReceiveAndDepositOptions) {
|
|
225
|
+
const packageAddress = options.package ?? '@local-pkg/royalty_pool';
|
|
226
|
+
const argumentsTypes = [
|
|
227
|
+
null,
|
|
228
|
+
'vector<null>'
|
|
229
|
+
] satisfies (string | null)[];
|
|
230
|
+
const parameterNames = ["self", "coins"];
|
|
231
|
+
return (tx: Transaction) => tx.moveCall({
|
|
232
|
+
package: packageAddress,
|
|
233
|
+
module: 'pool',
|
|
234
|
+
function: 'receive_and_deposit',
|
|
235
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
236
|
+
typeArguments: options.typeArguments
|
|
237
|
+
});
|
|
238
|
+
}
|
|
239
|
+
export interface RedeemAndDepositArguments {
|
|
240
|
+
self: RawTransactionArgument<string>;
|
|
241
|
+
value: RawTransactionArgument<number | bigint>;
|
|
242
|
+
}
|
|
243
|
+
export interface RedeemAndDepositOptions {
|
|
244
|
+
package?: string;
|
|
245
|
+
arguments: RedeemAndDepositArguments | [
|
|
246
|
+
self: RawTransactionArgument<string>,
|
|
247
|
+
value: RawTransactionArgument<number | bigint>
|
|
248
|
+
];
|
|
249
|
+
typeArguments: [
|
|
250
|
+
string,
|
|
251
|
+
string
|
|
252
|
+
];
|
|
253
|
+
}
|
|
254
|
+
/**
|
|
255
|
+
* Redeem `value` base units from the pool's funds-accumulator and fold them into
|
|
256
|
+
* the accumulator. Recovery path for funds delivered via Sui's `send_funds`
|
|
257
|
+
* mechanism rather than via the canonical extension path.
|
|
258
|
+
*/
|
|
259
|
+
export function redeemAndDeposit(options: RedeemAndDepositOptions) {
|
|
260
|
+
const packageAddress = options.package ?? '@local-pkg/royalty_pool';
|
|
261
|
+
const argumentsTypes = [
|
|
262
|
+
null,
|
|
263
|
+
'u64'
|
|
264
|
+
] satisfies (string | null)[];
|
|
265
|
+
const parameterNames = ["self", "value"];
|
|
266
|
+
return (tx: Transaction) => tx.moveCall({
|
|
267
|
+
package: packageAddress,
|
|
268
|
+
module: 'pool',
|
|
269
|
+
function: 'redeem_and_deposit',
|
|
270
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
271
|
+
typeArguments: options.typeArguments
|
|
272
|
+
});
|
|
273
|
+
}
|
|
274
|
+
export interface RegisterStakeArguments {
|
|
275
|
+
self: RawTransactionArgument<string>;
|
|
276
|
+
stake: RawTransactionArgument<string>;
|
|
277
|
+
}
|
|
278
|
+
export interface RegisterStakeOptions {
|
|
279
|
+
package?: string;
|
|
280
|
+
arguments: RegisterStakeArguments | [
|
|
281
|
+
self: RawTransactionArgument<string>,
|
|
282
|
+
stake: RawTransactionArgument<string>
|
|
283
|
+
];
|
|
284
|
+
typeArguments: [
|
|
285
|
+
string,
|
|
286
|
+
string
|
|
287
|
+
];
|
|
288
|
+
}
|
|
289
|
+
/**
|
|
290
|
+
* Register a stake with the pool. Records the stake's entry index so future
|
|
291
|
+
* deposits accrue to it proportionally.
|
|
292
|
+
*
|
|
293
|
+
* Aborts if the stake is already registered with a pool of the same Currency.
|
|
294
|
+
*/
|
|
295
|
+
export function registerStake(options: RegisterStakeOptions) {
|
|
296
|
+
const packageAddress = options.package ?? '@local-pkg/royalty_pool';
|
|
297
|
+
const argumentsTypes = [
|
|
298
|
+
null,
|
|
299
|
+
null
|
|
300
|
+
] satisfies (string | null)[];
|
|
301
|
+
const parameterNames = ["self", "stake"];
|
|
302
|
+
return (tx: Transaction) => tx.moveCall({
|
|
303
|
+
package: packageAddress,
|
|
304
|
+
module: 'pool',
|
|
305
|
+
function: 'register_stake',
|
|
306
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
307
|
+
typeArguments: options.typeArguments
|
|
308
|
+
});
|
|
309
|
+
}
|
|
310
|
+
export interface UnregisterStakeArguments {
|
|
311
|
+
self: RawTransactionArgument<string>;
|
|
312
|
+
stake: RawTransactionArgument<string>;
|
|
313
|
+
}
|
|
314
|
+
export interface UnregisterStakeOptions {
|
|
315
|
+
package?: string;
|
|
316
|
+
arguments: UnregisterStakeArguments | [
|
|
317
|
+
self: RawTransactionArgument<string>,
|
|
318
|
+
stake: RawTransactionArgument<string>
|
|
319
|
+
];
|
|
320
|
+
typeArguments: [
|
|
321
|
+
string,
|
|
322
|
+
string
|
|
323
|
+
];
|
|
324
|
+
}
|
|
325
|
+
/**
|
|
326
|
+
* Unregister a stake from the pool. All claimable rewards must be drained first —
|
|
327
|
+
* i.e., a final `claim_rewards` call must yield 0. Sub-base-unit residue in
|
|
328
|
+
* `last_claim_index` (left by the consumed-index advance when a reward truncated
|
|
329
|
+
* to 0) does NOT block unregister, since that residue could never be claimed as a
|
|
330
|
+
* whole base unit anyway. Forfeiting it on exit is the deliberate semantics.
|
|
331
|
+
*/
|
|
332
|
+
export function unregisterStake(options: UnregisterStakeOptions) {
|
|
333
|
+
const packageAddress = options.package ?? '@local-pkg/royalty_pool';
|
|
334
|
+
const argumentsTypes = [
|
|
335
|
+
null,
|
|
336
|
+
null
|
|
337
|
+
] satisfies (string | null)[];
|
|
338
|
+
const parameterNames = ["self", "stake"];
|
|
339
|
+
return (tx: Transaction) => tx.moveCall({
|
|
340
|
+
package: packageAddress,
|
|
341
|
+
module: 'pool',
|
|
342
|
+
function: 'unregister_stake',
|
|
343
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
344
|
+
typeArguments: options.typeArguments
|
|
345
|
+
});
|
|
346
|
+
}
|
|
347
|
+
export interface ClaimRewardsArguments {
|
|
348
|
+
self: RawTransactionArgument<string>;
|
|
349
|
+
stake: RawTransactionArgument<string>;
|
|
350
|
+
}
|
|
351
|
+
export interface ClaimRewardsOptions {
|
|
352
|
+
package?: string;
|
|
353
|
+
arguments: ClaimRewardsArguments | [
|
|
354
|
+
self: RawTransactionArgument<string>,
|
|
355
|
+
stake: RawTransactionArgument<string>
|
|
356
|
+
];
|
|
357
|
+
typeArguments: [
|
|
358
|
+
string,
|
|
359
|
+
string
|
|
360
|
+
];
|
|
361
|
+
}
|
|
362
|
+
/**
|
|
363
|
+
* Claim accrued rewards for a registered stake. Advances the stake's
|
|
364
|
+
* `last_claim_index` to the pool's current accumulator.
|
|
365
|
+
*/
|
|
366
|
+
export function claimRewards(options: ClaimRewardsOptions) {
|
|
367
|
+
const packageAddress = options.package ?? '@local-pkg/royalty_pool';
|
|
368
|
+
const argumentsTypes = [
|
|
369
|
+
null,
|
|
370
|
+
null
|
|
371
|
+
] satisfies (string | null)[];
|
|
372
|
+
const parameterNames = ["self", "stake"];
|
|
373
|
+
return (tx: Transaction) => tx.moveCall({
|
|
374
|
+
package: packageAddress,
|
|
375
|
+
module: 'pool',
|
|
376
|
+
function: 'claim_rewards',
|
|
377
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
378
|
+
typeArguments: options.typeArguments
|
|
379
|
+
});
|
|
380
|
+
}
|
|
381
|
+
export interface PendingRewardsArguments {
|
|
382
|
+
self: RawTransactionArgument<string>;
|
|
383
|
+
stake: RawTransactionArgument<string>;
|
|
384
|
+
}
|
|
385
|
+
export interface PendingRewardsOptions {
|
|
386
|
+
package?: string;
|
|
387
|
+
arguments: PendingRewardsArguments | [
|
|
388
|
+
self: RawTransactionArgument<string>,
|
|
389
|
+
stake: RawTransactionArgument<string>
|
|
390
|
+
];
|
|
391
|
+
typeArguments: [
|
|
392
|
+
string,
|
|
393
|
+
string
|
|
394
|
+
];
|
|
395
|
+
}
|
|
396
|
+
/**
|
|
397
|
+
* Compute pending rewards for a stake without claiming. Returns 0 if the stake is
|
|
398
|
+
* not registered with this pool.
|
|
399
|
+
*/
|
|
400
|
+
export function pendingRewards(options: PendingRewardsOptions) {
|
|
401
|
+
const packageAddress = options.package ?? '@local-pkg/royalty_pool';
|
|
402
|
+
const argumentsTypes = [
|
|
403
|
+
null,
|
|
404
|
+
null
|
|
405
|
+
] satisfies (string | null)[];
|
|
406
|
+
const parameterNames = ["self", "stake"];
|
|
407
|
+
return (tx: Transaction) => tx.moveCall({
|
|
408
|
+
package: packageAddress,
|
|
409
|
+
module: 'pool',
|
|
410
|
+
function: 'pending_rewards',
|
|
411
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
412
|
+
typeArguments: options.typeArguments
|
|
413
|
+
});
|
|
414
|
+
}
|
|
415
|
+
export interface IdArguments {
|
|
416
|
+
self: RawTransactionArgument<string>;
|
|
417
|
+
}
|
|
418
|
+
export interface IdOptions {
|
|
419
|
+
package?: string;
|
|
420
|
+
arguments: IdArguments | [
|
|
421
|
+
self: RawTransactionArgument<string>
|
|
422
|
+
];
|
|
423
|
+
typeArguments: [
|
|
424
|
+
string,
|
|
425
|
+
string
|
|
426
|
+
];
|
|
427
|
+
}
|
|
428
|
+
export function id(options: IdOptions) {
|
|
429
|
+
const packageAddress = options.package ?? '@local-pkg/royalty_pool';
|
|
430
|
+
const argumentsTypes = [
|
|
431
|
+
null
|
|
432
|
+
] satisfies (string | null)[];
|
|
433
|
+
const parameterNames = ["self"];
|
|
434
|
+
return (tx: Transaction) => tx.moveCall({
|
|
435
|
+
package: packageAddress,
|
|
436
|
+
module: 'pool',
|
|
437
|
+
function: 'id',
|
|
438
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
439
|
+
typeArguments: options.typeArguments
|
|
440
|
+
});
|
|
441
|
+
}
|
|
442
|
+
export interface BalanceArguments {
|
|
443
|
+
self: RawTransactionArgument<string>;
|
|
444
|
+
}
|
|
445
|
+
export interface BalanceOptions {
|
|
446
|
+
package?: string;
|
|
447
|
+
arguments: BalanceArguments | [
|
|
448
|
+
self: RawTransactionArgument<string>
|
|
449
|
+
];
|
|
450
|
+
typeArguments: [
|
|
451
|
+
string,
|
|
452
|
+
string
|
|
453
|
+
];
|
|
454
|
+
}
|
|
455
|
+
export function balance(options: BalanceOptions) {
|
|
456
|
+
const packageAddress = options.package ?? '@local-pkg/royalty_pool';
|
|
457
|
+
const argumentsTypes = [
|
|
458
|
+
null
|
|
459
|
+
] satisfies (string | null)[];
|
|
460
|
+
const parameterNames = ["self"];
|
|
461
|
+
return (tx: Transaction) => tx.moveCall({
|
|
462
|
+
package: packageAddress,
|
|
463
|
+
module: 'pool',
|
|
464
|
+
function: 'balance',
|
|
465
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
466
|
+
typeArguments: options.typeArguments
|
|
467
|
+
});
|
|
468
|
+
}
|
|
469
|
+
export interface StakedSharesArguments {
|
|
470
|
+
self: RawTransactionArgument<string>;
|
|
471
|
+
}
|
|
472
|
+
export interface StakedSharesOptions {
|
|
473
|
+
package?: string;
|
|
474
|
+
arguments: StakedSharesArguments | [
|
|
475
|
+
self: RawTransactionArgument<string>
|
|
476
|
+
];
|
|
477
|
+
typeArguments: [
|
|
478
|
+
string,
|
|
479
|
+
string
|
|
480
|
+
];
|
|
481
|
+
}
|
|
482
|
+
export function stakedShares(options: StakedSharesOptions) {
|
|
483
|
+
const packageAddress = options.package ?? '@local-pkg/royalty_pool';
|
|
484
|
+
const argumentsTypes = [
|
|
485
|
+
null
|
|
486
|
+
] satisfies (string | null)[];
|
|
487
|
+
const parameterNames = ["self"];
|
|
488
|
+
return (tx: Transaction) => tx.moveCall({
|
|
489
|
+
package: packageAddress,
|
|
490
|
+
module: 'pool',
|
|
491
|
+
function: 'staked_shares',
|
|
492
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
493
|
+
typeArguments: options.typeArguments
|
|
494
|
+
});
|
|
495
|
+
}
|
|
496
|
+
export interface CumulativeRewardPerShareArguments {
|
|
497
|
+
self: RawTransactionArgument<string>;
|
|
498
|
+
}
|
|
499
|
+
export interface CumulativeRewardPerShareOptions {
|
|
500
|
+
package?: string;
|
|
501
|
+
arguments: CumulativeRewardPerShareArguments | [
|
|
502
|
+
self: RawTransactionArgument<string>
|
|
503
|
+
];
|
|
504
|
+
typeArguments: [
|
|
505
|
+
string,
|
|
506
|
+
string
|
|
507
|
+
];
|
|
508
|
+
}
|
|
509
|
+
export function cumulativeRewardPerShare(options: CumulativeRewardPerShareOptions) {
|
|
510
|
+
const packageAddress = options.package ?? '@local-pkg/royalty_pool';
|
|
511
|
+
const argumentsTypes = [
|
|
512
|
+
null
|
|
513
|
+
] satisfies (string | null)[];
|
|
514
|
+
const parameterNames = ["self"];
|
|
515
|
+
return (tx: Transaction) => tx.moveCall({
|
|
516
|
+
package: packageAddress,
|
|
517
|
+
module: 'pool',
|
|
518
|
+
function: 'cumulative_reward_per_share',
|
|
519
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
520
|
+
typeArguments: options.typeArguments
|
|
521
|
+
});
|
|
522
|
+
}
|
|
523
|
+
export interface CumulativeDepositsArguments {
|
|
524
|
+
self: RawTransactionArgument<string>;
|
|
525
|
+
}
|
|
526
|
+
export interface CumulativeDepositsOptions {
|
|
527
|
+
package?: string;
|
|
528
|
+
arguments: CumulativeDepositsArguments | [
|
|
529
|
+
self: RawTransactionArgument<string>
|
|
530
|
+
];
|
|
531
|
+
typeArguments: [
|
|
532
|
+
string,
|
|
533
|
+
string
|
|
534
|
+
];
|
|
535
|
+
}
|
|
536
|
+
/** Lifetime sum of all deposits, in currency base units. Strictly monotonic. */
|
|
537
|
+
export function cumulativeDeposits(options: CumulativeDepositsOptions) {
|
|
538
|
+
const packageAddress = options.package ?? '@local-pkg/royalty_pool';
|
|
539
|
+
const argumentsTypes = [
|
|
540
|
+
null
|
|
541
|
+
] satisfies (string | null)[];
|
|
542
|
+
const parameterNames = ["self"];
|
|
543
|
+
return (tx: Transaction) => tx.moveCall({
|
|
544
|
+
package: packageAddress,
|
|
545
|
+
module: 'pool',
|
|
546
|
+
function: 'cumulative_deposits',
|
|
547
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
548
|
+
typeArguments: options.typeArguments
|
|
549
|
+
});
|
|
550
|
+
}
|
|
551
|
+
export interface DerivedAddressArguments {
|
|
552
|
+
parentId: RawTransactionArgument<string>;
|
|
553
|
+
}
|
|
554
|
+
export interface DerivedAddressOptions {
|
|
555
|
+
package?: string;
|
|
556
|
+
arguments: DerivedAddressArguments | [
|
|
557
|
+
parentId: RawTransactionArgument<string>
|
|
558
|
+
];
|
|
559
|
+
typeArguments: [
|
|
560
|
+
string,
|
|
561
|
+
string
|
|
562
|
+
];
|
|
563
|
+
}
|
|
564
|
+
/**
|
|
565
|
+
* Compute the deterministic address of a pool given its parent ID and `Currency`
|
|
566
|
+
* type parameter. Useful for off-chain derivation and for cross-module checks that
|
|
567
|
+
* the pool was minted from the expected parent.
|
|
568
|
+
*/
|
|
569
|
+
export function derivedAddress(options: DerivedAddressOptions) {
|
|
570
|
+
const packageAddress = options.package ?? '@local-pkg/royalty_pool';
|
|
571
|
+
const argumentsTypes = [
|
|
572
|
+
'0x2::object::ID'
|
|
573
|
+
] satisfies (string | null)[];
|
|
574
|
+
const parameterNames = ["parentId"];
|
|
575
|
+
return (tx: Transaction) => tx.moveCall({
|
|
576
|
+
package: packageAddress,
|
|
577
|
+
module: 'pool',
|
|
578
|
+
function: 'derived_address',
|
|
579
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
580
|
+
typeArguments: options.typeArguments
|
|
581
|
+
});
|
|
582
|
+
}
|
|
583
|
+
export interface AssertDerivedFromArguments {
|
|
584
|
+
self: RawTransactionArgument<string>;
|
|
585
|
+
parentId: RawTransactionArgument<string>;
|
|
586
|
+
}
|
|
587
|
+
export interface AssertDerivedFromOptions {
|
|
588
|
+
package?: string;
|
|
589
|
+
arguments: AssertDerivedFromArguments | [
|
|
590
|
+
self: RawTransactionArgument<string>,
|
|
591
|
+
parentId: RawTransactionArgument<string>
|
|
592
|
+
];
|
|
593
|
+
typeArguments: [
|
|
594
|
+
string,
|
|
595
|
+
string
|
|
596
|
+
];
|
|
597
|
+
}
|
|
598
|
+
/** Read-only verification that the pool was derived from the given parent ID. */
|
|
599
|
+
export function assertDerivedFrom(options: AssertDerivedFromOptions) {
|
|
600
|
+
const packageAddress = options.package ?? '@local-pkg/royalty_pool';
|
|
601
|
+
const argumentsTypes = [
|
|
602
|
+
null,
|
|
603
|
+
'0x2::object::ID'
|
|
604
|
+
] satisfies (string | null)[];
|
|
605
|
+
const parameterNames = ["self", "parentId"];
|
|
606
|
+
return (tx: Transaction) => tx.moveCall({
|
|
607
|
+
package: packageAddress,
|
|
608
|
+
module: 'pool',
|
|
609
|
+
function: 'assert_derived_from',
|
|
610
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
611
|
+
typeArguments: options.typeArguments
|
|
612
|
+
});
|
|
613
|
+
}
|