@misofm/sdk 0.9.0 → 0.10.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 +88 -56
- package/dist/client.d.ts +126 -18
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +210 -44
- package/dist/client.js.map +1 -1
- package/dist/contracts/composition_routed_stake/composition_routed_stake.d.ts +205 -0
- package/dist/contracts/composition_routed_stake/composition_routed_stake.d.ts.map +1 -0
- package/dist/contracts/composition_routed_stake/composition_routed_stake.js +184 -0
- package/dist/contracts/composition_routed_stake/composition_routed_stake.js.map +1 -0
- package/dist/contracts/composition_routed_stake/witness.d.ts +7 -0
- package/dist/contracts/composition_routed_stake/witness.d.ts.map +1 -0
- package/dist/contracts/composition_routed_stake/witness.js +9 -0
- package/dist/contracts/composition_routed_stake/witness.js.map +1 -0
- package/dist/contracts/composition_royalty_pool/composition_royalty_pool.d.ts +89 -28
- package/dist/contracts/composition_royalty_pool/composition_royalty_pool.d.ts.map +1 -1
- package/dist/contracts/composition_royalty_pool/composition_royalty_pool.js +84 -23
- package/dist/contracts/composition_royalty_pool/composition_royalty_pool.js.map +1 -1
- package/dist/contracts/composition_royalty_pool/witness.d.ts +6 -0
- package/dist/contracts/composition_royalty_pool/witness.d.ts.map +1 -0
- package/dist/contracts/composition_royalty_pool/witness.js +8 -0
- package/dist/contracts/composition_royalty_pool/witness.js.map +1 -0
- package/dist/contracts/genre/genre.d.ts +96 -0
- package/dist/contracts/genre/genre.d.ts.map +1 -0
- package/dist/contracts/genre/genre.js +107 -0
- package/dist/contracts/genre/genre.js.map +1 -0
- 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_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/recording_royalty_pool/recording_royalty_pool.d.ts +90 -28
- package/dist/contracts/recording_royalty_pool/recording_royalty_pool.d.ts.map +1 -1
- package/dist/contracts/recording_royalty_pool/recording_royalty_pool.js +84 -23
- package/dist/contracts/recording_royalty_pool/recording_royalty_pool.js.map +1 -1
- package/dist/contracts/recording_royalty_pool/witness.d.ts +6 -0
- package/dist/contracts/recording_royalty_pool/witness.d.ts.map +1 -0
- package/dist/contracts/recording_royalty_pool/witness.js +8 -0
- package/dist/contracts/recording_royalty_pool/witness.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_revenue_distributor/release_revenue_distributor.d.ts +106 -0
- package/dist/contracts/release_revenue_distributor/release_revenue_distributor.d.ts.map +1 -0
- package/dist/contracts/release_revenue_distributor/release_revenue_distributor.js +113 -0
- package/dist/contracts/release_revenue_distributor/release_revenue_distributor.js.map +1 -0
- package/dist/contracts/release_revenue_distributor/witness.d.ts +7 -0
- package/dist/contracts/release_revenue_distributor/witness.d.ts.map +1 -0
- package/dist/contracts/release_revenue_distributor/witness.js +9 -0
- package/dist/contracts/release_revenue_distributor/witness.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/pool.d.ts +27 -17
- package/dist/contracts/royalty_pool/pool.d.ts.map +1 -1
- package/dist/contracts/royalty_pool/pool.js +26 -17
- package/dist/contracts/royalty_pool/pool.js.map +1 -1
- package/dist/contracts/vault/deps/sui/bag.d.ts +35 -0
- package/dist/contracts/vault/deps/sui/bag.d.ts.map +1 -0
- package/dist/contracts/vault/deps/sui/bag.js +37 -0
- package/dist/contracts/vault/deps/sui/bag.js.map +1 -0
- package/dist/contracts/vault/deps/sui/borrow.d.ts +20 -0
- package/dist/contracts/vault/deps/sui/borrow.d.ts.map +1 -0
- package/dist/contracts/vault/deps/sui/borrow.js +21 -0
- package/dist/contracts/vault/deps/sui/borrow.js.map +1 -0
- package/dist/contracts/vault/vault.d.ts +276 -0
- package/dist/contracts/vault/vault.d.ts.map +1 -0
- package/dist/contracts/vault/vault.js +274 -0
- package/dist/contracts/vault/vault.js.map +1 -0
- package/dist/contracts.d.ts +14 -2
- package/dist/contracts.d.ts.map +1 -1
- package/dist/contracts.js +16 -7
- package/dist/contracts.js.map +1 -1
- package/dist/cover.d.ts +17 -3
- package/dist/cover.d.ts.map +1 -1
- package/dist/cover.js +43 -20
- package/dist/cover.js.map +1 -1
- package/dist/credits.d.ts +31 -12
- package/dist/credits.d.ts.map +1 -1
- package/dist/credits.js +41 -25
- package/dist/credits.js.map +1 -1
- package/dist/deployments.d.ts +31 -57
- package/dist/deployments.d.ts.map +1 -1
- package/dist/deployments.js +5 -53
- package/dist/deployments.js.map +1 -1
- package/dist/index.d.ts +4 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -5
- package/dist/index.js.map +1 -1
- package/dist/pressing.d.ts +8 -7
- package/dist/pressing.d.ts.map +1 -1
- package/dist/pressing.js +91 -32
- package/dist/pressing.js.map +1 -1
- package/dist/read/artist.js +3 -3
- package/dist/read/artist.js.map +1 -1
- package/dist/read/catalog.d.ts +14 -9
- package/dist/read/catalog.d.ts.map +1 -1
- package/dist/read/catalog.js +71 -37
- package/dist/read/catalog.js.map +1 -1
- package/dist/read/client.d.ts +4 -2
- package/dist/read/client.d.ts.map +1 -1
- package/dist/read/client.js +15 -4
- package/dist/read/client.js.map +1 -1
- package/dist/read/config.d.ts +14 -11
- package/dist/read/config.d.ts.map +1 -1
- package/dist/read/config.js +10 -37
- package/dist/read/config.js.map +1 -1
- package/dist/read/index.d.ts +2 -2
- package/dist/read/index.d.ts.map +1 -1
- package/dist/read/index.js +1 -1
- package/dist/read/index.js.map +1 -1
- package/dist/read/receipts.d.ts +24 -7
- package/dist/read/receipts.d.ts.map +1 -1
- package/dist/read/receipts.js +78 -25
- package/dist/read/receipts.js.map +1 -1
- package/dist/read/types.d.ts +43 -25
- package/dist/read/types.d.ts.map +1 -1
- package/dist/read/types.js +2 -2
- package/dist/read/types.js.map +1 -1
- package/dist/recording-extensions.d.ts +37 -0
- package/dist/recording-extensions.d.ts.map +1 -0
- package/dist/recording-extensions.js +61 -0
- package/dist/recording-extensions.js.map +1 -0
- package/dist/release-extensions.d.ts +92 -0
- package/dist/release-extensions.d.ts.map +1 -0
- package/dist/release-extensions.js +175 -0
- package/dist/release-extensions.js.map +1 -0
- package/dist/release-graph.d.ts +17 -26
- package/dist/release-graph.d.ts.map +1 -1
- package/dist/release-graph.js +55 -49
- package/dist/release-graph.js.map +1 -1
- package/dist/transactions.d.ts +43 -24
- package/dist/transactions.d.ts.map +1 -1
- package/dist/transactions.js +48 -27
- package/dist/transactions.js.map +1 -1
- package/dist/vault.d.ts +268 -0
- package/dist/vault.d.ts.map +1 -0
- package/dist/vault.js +389 -0
- package/dist/vault.js.map +1 -0
- package/package.json +17 -11
- package/src/client.ts +428 -61
- package/src/contracts/composition_routed_stake/composition_routed_stake.ts +346 -0
- package/src/contracts/composition_routed_stake/witness.ts +11 -0
- package/src/contracts/composition_royalty_pool/composition_royalty_pool.ts +151 -35
- package/src/contracts/composition_royalty_pool/witness.ts +7 -0
- package/src/contracts/genre/genre.ts +151 -0
- package/src/contracts/recording_advisory/recording_advisory.ts +315 -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/recording_royalty_pool/recording_royalty_pool.ts +152 -35
- package/src/contracts/recording_royalty_pool/witness.ts +7 -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_revenue_distributor/release_revenue_distributor.ts +178 -0
- package/src/contracts/release_revenue_distributor/witness.ts +11 -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/pool.ts +34 -24
- package/src/contracts/vault/deps/sui/bag.ts +39 -0
- package/src/contracts/vault/deps/sui/borrow.ts +25 -0
- package/src/contracts/vault/vault.ts +454 -0
- package/src/contracts.ts +17 -9
- package/src/cover.ts +62 -37
- package/src/credits.ts +64 -51
- package/src/deployments.ts +36 -97
- package/src/index.ts +11 -5
- package/src/pressing.ts +135 -39
- package/src/read/artist.ts +3 -3
- package/src/read/catalog.ts +99 -44
- package/src/read/client.ts +20 -4
- package/src/read/config.ts +23 -49
- package/src/read/index.ts +3 -1
- package/src/read/receipts.ts +103 -26
- package/src/read/types.ts +44 -27
- package/src/recording-extensions.ts +102 -0
- package/src/release-extensions.ts +286 -0
- package/src/release-graph.ts +68 -81
- package/src/transactions.ts +79 -53
- package/src/vault.ts +777 -0
- package/dist/contracts/miso_drop/drop.d.ts +0 -550
- package/dist/contracts/miso_drop/drop.d.ts.map +0 -1
- package/dist/contracts/miso_drop/drop.js +0 -523
- package/dist/contracts/miso_drop/drop.js.map +0 -1
- package/dist/contracts/release_registry/release_registry.d.ts +0 -114
- package/dist/contracts/release_registry/release_registry.d.ts.map +0 -1
- package/dist/contracts/release_registry/release_registry.js +0 -119
- package/dist/contracts/release_registry/release_registry.js.map +0 -1
- package/dist/drop.d.ts +0 -127
- package/dist/drop.d.ts.map +0 -1
- package/dist/drop.js +0 -202
- package/dist/drop.js.map +0 -1
- package/dist/extensions/royalty-pool.d.ts +0 -32
- package/dist/extensions/royalty-pool.d.ts.map +0 -1
- package/dist/extensions/royalty-pool.js +0 -33
- package/dist/extensions/royalty-pool.js.map +0 -1
- package/src/contracts/miso_drop/drop.ts +0 -798
- package/src/contracts/release_registry/release_registry.ts +0 -160
- package/src/drop.ts +0 -376
- package/src/extensions/royalty-pool.ts +0 -90
|
@@ -0,0 +1,508 @@
|
|
|
1
|
+
/**************************************************************
|
|
2
|
+
* THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
|
|
3
|
+
**************************************************************/
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* A stake whose rewards are irrevocably routed to its parent's royalty pool.
|
|
8
|
+
*
|
|
9
|
+
* A `RoutedStake<StakeShare, PoolShare>` is a derived object of any UID-bearing
|
|
10
|
+
* parent (same pattern as `RoyaltyPool`). It wraps a `Stake<StakeShare>` — shares
|
|
11
|
+
* of some other asset that the parent owns — and commits the rewards that stake
|
|
12
|
+
* earns to the parent's own `RoyaltyPool<PoolShare, Currency>`: `sweep` is the
|
|
13
|
+
* only reachable claim path, and it deposits straight into the pool derived from
|
|
14
|
+
* the same parent. The wrapper exists precisely so the raw `Stake` is never
|
|
15
|
+
* exposed — a bare shared `Stake` would let any caller claim its rewards and keep
|
|
16
|
+
* them.
|
|
17
|
+
*
|
|
18
|
+
* Because the route is fixed, the wrapper is safe to share: `sweep` is
|
|
19
|
+
* permissionless, and it does not matter who calls it, since the money can only go
|
|
20
|
+
* one place. Lifecycle operations (`register`, `unregister`, `unstake`, `restake`)
|
|
21
|
+
* instead require the parent's `&mut UID` as the credential — cap-gating happens
|
|
22
|
+
* at the parent, exactly as with `RoyaltyPool` creation. `register`/`unregister`
|
|
23
|
+
* are gated because a stake registers at most once per `Currency`: a
|
|
24
|
+
* permissionless register could grief by binding the stake to a garbage same-typed
|
|
25
|
+
* pool, permanently blocking the real one for that currency.
|
|
26
|
+
*
|
|
27
|
+
* The derivation key encodes only `StakeShare` — at most one routed stake per
|
|
28
|
+
* `(parent, StakeShare)` pair, whatever `PoolShare` it used (the same
|
|
29
|
+
* burned-by-first-claim consequence as `RoyaltyPoolKey`; the parent's cap-gated
|
|
30
|
+
* extension is expected to pin `PoolShare` to the parent's own share type). For
|
|
31
|
+
* the same reason the wrapper is never deleted: `unstake` empties it and `restake`
|
|
32
|
+
* refills it, so the one derived address per pair stays usable forever.
|
|
33
|
+
*/
|
|
34
|
+
|
|
35
|
+
import { MoveStruct, MoveTuple, normalizeMoveArguments, type RawTransactionArgument } from '../utils/index.js';
|
|
36
|
+
import { bcs } from '@mysten/sui/bcs';
|
|
37
|
+
import { type Transaction, type TransactionArgument } from '@mysten/sui/transactions';
|
|
38
|
+
import * as stake_1 from './deps/royalty_pool/stake.js';
|
|
39
|
+
const $moduleName = '@local-pkg/routed_stake::routed_stake';
|
|
40
|
+
export const RoutedStake = new MoveStruct({ name: `${$moduleName}::RoutedStake<phantom StakeShare, phantom PoolShare>`, fields: {
|
|
41
|
+
id: bcs.Address,
|
|
42
|
+
/**
|
|
43
|
+
* The wrapped position. `None` between `unstake` and `restake`; the wrapper itself
|
|
44
|
+
* persists because its derived address can never be re-claimed.
|
|
45
|
+
*/
|
|
46
|
+
stake: bcs.option(stake_1.Stake)
|
|
47
|
+
} });
|
|
48
|
+
export const RoutedStakeKey = new MoveTuple({ name: `${$moduleName}::RoutedStakeKey<phantom StakeShare>`, fields: [bcs.bool()] });
|
|
49
|
+
export const RoutedStakeCreatedEvent = new MoveStruct({ name: `${$moduleName}::RoutedStakeCreatedEvent<phantom StakeShare, phantom PoolShare>`, fields: {
|
|
50
|
+
routed_stake_id: bcs.Address,
|
|
51
|
+
parent_id: bcs.Address,
|
|
52
|
+
staked_value: bcs.u64()
|
|
53
|
+
} });
|
|
54
|
+
export const RoutedStakeSweptEvent = new MoveStruct({ name: `${$moduleName}::RoutedStakeSweptEvent<phantom StakeShare, phantom PoolShare, phantom Currency>`, fields: {
|
|
55
|
+
routed_stake_id: bcs.Address,
|
|
56
|
+
parent_id: bcs.Address,
|
|
57
|
+
value: bcs.u64()
|
|
58
|
+
} });
|
|
59
|
+
export const RoutedStakeUnstakedEvent = new MoveStruct({ name: `${$moduleName}::RoutedStakeUnstakedEvent<phantom StakeShare, phantom PoolShare>`, fields: {
|
|
60
|
+
routed_stake_id: bcs.Address,
|
|
61
|
+
parent_id: bcs.Address,
|
|
62
|
+
unstaked_value: bcs.u64()
|
|
63
|
+
} });
|
|
64
|
+
export const RoutedStakeRestakedEvent = new MoveStruct({ name: `${$moduleName}::RoutedStakeRestakedEvent<phantom StakeShare, phantom PoolShare>`, fields: {
|
|
65
|
+
routed_stake_id: bcs.Address,
|
|
66
|
+
parent_id: bcs.Address,
|
|
67
|
+
staked_value: bcs.u64()
|
|
68
|
+
} });
|
|
69
|
+
export interface NewArguments {
|
|
70
|
+
parent: RawTransactionArgument<string>;
|
|
71
|
+
balance: TransactionArgument;
|
|
72
|
+
}
|
|
73
|
+
export interface NewOptions {
|
|
74
|
+
package?: string;
|
|
75
|
+
arguments: NewArguments | [
|
|
76
|
+
parent: RawTransactionArgument<string>,
|
|
77
|
+
balance: TransactionArgument
|
|
78
|
+
];
|
|
79
|
+
typeArguments: [
|
|
80
|
+
string,
|
|
81
|
+
string
|
|
82
|
+
];
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Construct a routed stake as a derived object of `parent`, wrapping `balance` as
|
|
86
|
+
* its staked position. Aborts (in `stake::new`) on a zero balance, and (in
|
|
87
|
+
* `derived_object::claim`) if the `(parent, StakeShare)` address was already
|
|
88
|
+
* claimed.
|
|
89
|
+
*
|
|
90
|
+
* Cap-gating happens at the parent: callers must obtain `&mut UID` via whatever
|
|
91
|
+
* cap-gated accessor the parent exposes.
|
|
92
|
+
*/
|
|
93
|
+
export function _new(options: NewOptions) {
|
|
94
|
+
const packageAddress = options.package ?? '@local-pkg/routed_stake';
|
|
95
|
+
const argumentsTypes = [
|
|
96
|
+
'0x2::object::ID',
|
|
97
|
+
null
|
|
98
|
+
] satisfies (string | null)[];
|
|
99
|
+
const parameterNames = ["parent", "balance"];
|
|
100
|
+
return (tx: Transaction) => tx.moveCall({
|
|
101
|
+
package: packageAddress,
|
|
102
|
+
module: 'routed_stake',
|
|
103
|
+
function: 'new',
|
|
104
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
105
|
+
typeArguments: options.typeArguments
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
export interface ShareArguments {
|
|
109
|
+
self: RawTransactionArgument<string>;
|
|
110
|
+
}
|
|
111
|
+
export interface ShareOptions {
|
|
112
|
+
package?: string;
|
|
113
|
+
arguments: ShareArguments | [
|
|
114
|
+
self: RawTransactionArgument<string>
|
|
115
|
+
];
|
|
116
|
+
typeArguments: [
|
|
117
|
+
string,
|
|
118
|
+
string
|
|
119
|
+
];
|
|
120
|
+
}
|
|
121
|
+
/** Share the routed stake so anyone can `sweep` it. */
|
|
122
|
+
export function share(options: ShareOptions) {
|
|
123
|
+
const packageAddress = options.package ?? '@local-pkg/routed_stake';
|
|
124
|
+
const argumentsTypes = [
|
|
125
|
+
null
|
|
126
|
+
] satisfies (string | null)[];
|
|
127
|
+
const parameterNames = ["self"];
|
|
128
|
+
return (tx: Transaction) => tx.moveCall({
|
|
129
|
+
package: packageAddress,
|
|
130
|
+
module: 'routed_stake',
|
|
131
|
+
function: 'share',
|
|
132
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
133
|
+
typeArguments: options.typeArguments
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
export interface RegisterArguments {
|
|
137
|
+
self: RawTransactionArgument<string>;
|
|
138
|
+
parent: RawTransactionArgument<string>;
|
|
139
|
+
stakePool: RawTransactionArgument<string>;
|
|
140
|
+
}
|
|
141
|
+
export interface RegisterOptions {
|
|
142
|
+
package?: string;
|
|
143
|
+
arguments: RegisterArguments | [
|
|
144
|
+
self: RawTransactionArgument<string>,
|
|
145
|
+
parent: RawTransactionArgument<string>,
|
|
146
|
+
stakePool: RawTransactionArgument<string>
|
|
147
|
+
];
|
|
148
|
+
typeArguments: [
|
|
149
|
+
string,
|
|
150
|
+
string,
|
|
151
|
+
string
|
|
152
|
+
];
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* Register the wrapped stake with the pool it earns from, so future deposits
|
|
156
|
+
* accrue to it. Which same-typed pool is the _correct_ one is the caller's concern
|
|
157
|
+
* — the parent's extension is expected to pin it (e.g. by derivation from the
|
|
158
|
+
* asset object) before delegating here.
|
|
159
|
+
*/
|
|
160
|
+
export function register(options: RegisterOptions) {
|
|
161
|
+
const packageAddress = options.package ?? '@local-pkg/routed_stake';
|
|
162
|
+
const argumentsTypes = [
|
|
163
|
+
null,
|
|
164
|
+
'0x2::object::ID',
|
|
165
|
+
null
|
|
166
|
+
] satisfies (string | null)[];
|
|
167
|
+
const parameterNames = ["self", "parent", "stakePool"];
|
|
168
|
+
return (tx: Transaction) => tx.moveCall({
|
|
169
|
+
package: packageAddress,
|
|
170
|
+
module: 'routed_stake',
|
|
171
|
+
function: 'register',
|
|
172
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
173
|
+
typeArguments: options.typeArguments
|
|
174
|
+
});
|
|
175
|
+
}
|
|
176
|
+
export interface UnregisterArguments {
|
|
177
|
+
self: RawTransactionArgument<string>;
|
|
178
|
+
parent: RawTransactionArgument<string>;
|
|
179
|
+
stakePool: RawTransactionArgument<string>;
|
|
180
|
+
}
|
|
181
|
+
export interface UnregisterOptions {
|
|
182
|
+
package?: string;
|
|
183
|
+
arguments: UnregisterArguments | [
|
|
184
|
+
self: RawTransactionArgument<string>,
|
|
185
|
+
parent: RawTransactionArgument<string>,
|
|
186
|
+
stakePool: RawTransactionArgument<string>
|
|
187
|
+
];
|
|
188
|
+
typeArguments: [
|
|
189
|
+
string,
|
|
190
|
+
string,
|
|
191
|
+
string
|
|
192
|
+
];
|
|
193
|
+
}
|
|
194
|
+
/**
|
|
195
|
+
* Unregister the wrapped stake from a pool it earns from. The pool requires
|
|
196
|
+
* claimable rewards to be drained to zero first — i.e. a final `sweep` — so
|
|
197
|
+
* accrued rewards provably reach the parent's pool before the position can move.
|
|
198
|
+
*/
|
|
199
|
+
export function unregister(options: UnregisterOptions) {
|
|
200
|
+
const packageAddress = options.package ?? '@local-pkg/routed_stake';
|
|
201
|
+
const argumentsTypes = [
|
|
202
|
+
null,
|
|
203
|
+
'0x2::object::ID',
|
|
204
|
+
null
|
|
205
|
+
] satisfies (string | null)[];
|
|
206
|
+
const parameterNames = ["self", "parent", "stakePool"];
|
|
207
|
+
return (tx: Transaction) => tx.moveCall({
|
|
208
|
+
package: packageAddress,
|
|
209
|
+
module: 'routed_stake',
|
|
210
|
+
function: 'unregister',
|
|
211
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
212
|
+
typeArguments: options.typeArguments
|
|
213
|
+
});
|
|
214
|
+
}
|
|
215
|
+
export interface UnstakeArguments {
|
|
216
|
+
self: RawTransactionArgument<string>;
|
|
217
|
+
parent: RawTransactionArgument<string>;
|
|
218
|
+
}
|
|
219
|
+
export interface UnstakeOptions {
|
|
220
|
+
package?: string;
|
|
221
|
+
arguments: UnstakeArguments | [
|
|
222
|
+
self: RawTransactionArgument<string>,
|
|
223
|
+
parent: RawTransactionArgument<string>
|
|
224
|
+
];
|
|
225
|
+
typeArguments: [
|
|
226
|
+
string,
|
|
227
|
+
string
|
|
228
|
+
];
|
|
229
|
+
}
|
|
230
|
+
/**
|
|
231
|
+
* Remove the staked position and return its principal. Aborts (in
|
|
232
|
+
* `stake::destroy`) while any pool registrations remain. The emptied wrapper
|
|
233
|
+
* persists — its derived address is burned forever, so deleting it would
|
|
234
|
+
* permanently destroy the parent's ability to route-stake this share type;
|
|
235
|
+
* `restake` refills it instead.
|
|
236
|
+
*/
|
|
237
|
+
export function unstake(options: UnstakeOptions) {
|
|
238
|
+
const packageAddress = options.package ?? '@local-pkg/routed_stake';
|
|
239
|
+
const argumentsTypes = [
|
|
240
|
+
null,
|
|
241
|
+
'0x2::object::ID'
|
|
242
|
+
] satisfies (string | null)[];
|
|
243
|
+
const parameterNames = ["self", "parent"];
|
|
244
|
+
return (tx: Transaction) => tx.moveCall({
|
|
245
|
+
package: packageAddress,
|
|
246
|
+
module: 'routed_stake',
|
|
247
|
+
function: 'unstake',
|
|
248
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
249
|
+
typeArguments: options.typeArguments
|
|
250
|
+
});
|
|
251
|
+
}
|
|
252
|
+
export interface RestakeArguments {
|
|
253
|
+
self: RawTransactionArgument<string>;
|
|
254
|
+
parent: RawTransactionArgument<string>;
|
|
255
|
+
balance: TransactionArgument;
|
|
256
|
+
}
|
|
257
|
+
export interface RestakeOptions {
|
|
258
|
+
package?: string;
|
|
259
|
+
arguments: RestakeArguments | [
|
|
260
|
+
self: RawTransactionArgument<string>,
|
|
261
|
+
parent: RawTransactionArgument<string>,
|
|
262
|
+
balance: TransactionArgument
|
|
263
|
+
];
|
|
264
|
+
typeArguments: [
|
|
265
|
+
string,
|
|
266
|
+
string
|
|
267
|
+
];
|
|
268
|
+
}
|
|
269
|
+
/**
|
|
270
|
+
* Refill an emptied wrapper with a new staked position. Aborts if a position is
|
|
271
|
+
* already present.
|
|
272
|
+
*/
|
|
273
|
+
export function restake(options: RestakeOptions) {
|
|
274
|
+
const packageAddress = options.package ?? '@local-pkg/routed_stake';
|
|
275
|
+
const argumentsTypes = [
|
|
276
|
+
null,
|
|
277
|
+
'0x2::object::ID',
|
|
278
|
+
null
|
|
279
|
+
] satisfies (string | null)[];
|
|
280
|
+
const parameterNames = ["self", "parent", "balance"];
|
|
281
|
+
return (tx: Transaction) => tx.moveCall({
|
|
282
|
+
package: packageAddress,
|
|
283
|
+
module: 'routed_stake',
|
|
284
|
+
function: 'restake',
|
|
285
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
286
|
+
typeArguments: options.typeArguments
|
|
287
|
+
});
|
|
288
|
+
}
|
|
289
|
+
export interface SweepArguments {
|
|
290
|
+
self: RawTransactionArgument<string>;
|
|
291
|
+
stakePool: RawTransactionArgument<string>;
|
|
292
|
+
routedPool: RawTransactionArgument<string>;
|
|
293
|
+
parentId: RawTransactionArgument<string>;
|
|
294
|
+
}
|
|
295
|
+
export interface SweepOptions {
|
|
296
|
+
package?: string;
|
|
297
|
+
arguments: SweepArguments | [
|
|
298
|
+
self: RawTransactionArgument<string>,
|
|
299
|
+
stakePool: RawTransactionArgument<string>,
|
|
300
|
+
routedPool: RawTransactionArgument<string>,
|
|
301
|
+
parentId: RawTransactionArgument<string>
|
|
302
|
+
];
|
|
303
|
+
typeArguments: [
|
|
304
|
+
string,
|
|
305
|
+
string,
|
|
306
|
+
string
|
|
307
|
+
];
|
|
308
|
+
}
|
|
309
|
+
/**
|
|
310
|
+
* Claim the wrapped stake's accrued rewards from `stake_pool` and deposit them
|
|
311
|
+
* into `routed_pool` — the parent's own pool. Permissionless: the caller supplies
|
|
312
|
+
* `parent_id`, but cannot lie, because both the wrapper's own address and
|
|
313
|
+
* `routed_pool`'s address must derive from it. A zero reward is a no-op (no
|
|
314
|
+
* event), so the call composes safely into batch PTBs; a positive reward aborts
|
|
315
|
+
* (in `royalty_pool::pool`) if `routed_pool` has no registered stakes — the reward
|
|
316
|
+
* stays claimable here until it does.
|
|
317
|
+
*/
|
|
318
|
+
export function sweep(options: SweepOptions) {
|
|
319
|
+
const packageAddress = options.package ?? '@local-pkg/routed_stake';
|
|
320
|
+
const argumentsTypes = [
|
|
321
|
+
null,
|
|
322
|
+
null,
|
|
323
|
+
null,
|
|
324
|
+
'0x2::object::ID'
|
|
325
|
+
] satisfies (string | null)[];
|
|
326
|
+
const parameterNames = ["self", "stakePool", "routedPool", "parentId"];
|
|
327
|
+
return (tx: Transaction) => tx.moveCall({
|
|
328
|
+
package: packageAddress,
|
|
329
|
+
module: 'routed_stake',
|
|
330
|
+
function: 'sweep',
|
|
331
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
332
|
+
typeArguments: options.typeArguments
|
|
333
|
+
});
|
|
334
|
+
}
|
|
335
|
+
export interface IdArguments {
|
|
336
|
+
self: RawTransactionArgument<string>;
|
|
337
|
+
}
|
|
338
|
+
export interface IdOptions {
|
|
339
|
+
package?: string;
|
|
340
|
+
arguments: IdArguments | [
|
|
341
|
+
self: RawTransactionArgument<string>
|
|
342
|
+
];
|
|
343
|
+
typeArguments: [
|
|
344
|
+
string,
|
|
345
|
+
string
|
|
346
|
+
];
|
|
347
|
+
}
|
|
348
|
+
export function id(options: IdOptions) {
|
|
349
|
+
const packageAddress = options.package ?? '@local-pkg/routed_stake';
|
|
350
|
+
const argumentsTypes = [
|
|
351
|
+
null
|
|
352
|
+
] satisfies (string | null)[];
|
|
353
|
+
const parameterNames = ["self"];
|
|
354
|
+
return (tx: Transaction) => tx.moveCall({
|
|
355
|
+
package: packageAddress,
|
|
356
|
+
module: 'routed_stake',
|
|
357
|
+
function: 'id',
|
|
358
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
359
|
+
typeArguments: options.typeArguments
|
|
360
|
+
});
|
|
361
|
+
}
|
|
362
|
+
export interface HasStakeArguments {
|
|
363
|
+
self: RawTransactionArgument<string>;
|
|
364
|
+
}
|
|
365
|
+
export interface HasStakeOptions {
|
|
366
|
+
package?: string;
|
|
367
|
+
arguments: HasStakeArguments | [
|
|
368
|
+
self: RawTransactionArgument<string>
|
|
369
|
+
];
|
|
370
|
+
typeArguments: [
|
|
371
|
+
string,
|
|
372
|
+
string
|
|
373
|
+
];
|
|
374
|
+
}
|
|
375
|
+
export function hasStake(options: HasStakeOptions) {
|
|
376
|
+
const packageAddress = options.package ?? '@local-pkg/routed_stake';
|
|
377
|
+
const argumentsTypes = [
|
|
378
|
+
null
|
|
379
|
+
] satisfies (string | null)[];
|
|
380
|
+
const parameterNames = ["self"];
|
|
381
|
+
return (tx: Transaction) => tx.moveCall({
|
|
382
|
+
package: packageAddress,
|
|
383
|
+
module: 'routed_stake',
|
|
384
|
+
function: 'has_stake',
|
|
385
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
386
|
+
typeArguments: options.typeArguments
|
|
387
|
+
});
|
|
388
|
+
}
|
|
389
|
+
export interface ValueArguments {
|
|
390
|
+
self: RawTransactionArgument<string>;
|
|
391
|
+
}
|
|
392
|
+
export interface ValueOptions {
|
|
393
|
+
package?: string;
|
|
394
|
+
arguments: ValueArguments | [
|
|
395
|
+
self: RawTransactionArgument<string>
|
|
396
|
+
];
|
|
397
|
+
typeArguments: [
|
|
398
|
+
string,
|
|
399
|
+
string
|
|
400
|
+
];
|
|
401
|
+
}
|
|
402
|
+
/** Staked principal, or 0 while the wrapper is empty. */
|
|
403
|
+
export function value(options: ValueOptions) {
|
|
404
|
+
const packageAddress = options.package ?? '@local-pkg/routed_stake';
|
|
405
|
+
const argumentsTypes = [
|
|
406
|
+
null
|
|
407
|
+
] satisfies (string | null)[];
|
|
408
|
+
const parameterNames = ["self"];
|
|
409
|
+
return (tx: Transaction) => tx.moveCall({
|
|
410
|
+
package: packageAddress,
|
|
411
|
+
module: 'routed_stake',
|
|
412
|
+
function: 'value',
|
|
413
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
414
|
+
typeArguments: options.typeArguments
|
|
415
|
+
});
|
|
416
|
+
}
|
|
417
|
+
export interface StakeArguments {
|
|
418
|
+
self: RawTransactionArgument<string>;
|
|
419
|
+
}
|
|
420
|
+
export interface StakeOptions {
|
|
421
|
+
package?: string;
|
|
422
|
+
arguments: StakeArguments | [
|
|
423
|
+
self: RawTransactionArgument<string>
|
|
424
|
+
];
|
|
425
|
+
typeArguments: [
|
|
426
|
+
string,
|
|
427
|
+
string
|
|
428
|
+
];
|
|
429
|
+
}
|
|
430
|
+
/**
|
|
431
|
+
* Read-only access to the wrapped stake, e.g. for `pool::pending_rewards`. Aborts
|
|
432
|
+
* while the wrapper is empty (`has_stake` to guard).
|
|
433
|
+
*/
|
|
434
|
+
export function stake(options: StakeOptions) {
|
|
435
|
+
const packageAddress = options.package ?? '@local-pkg/routed_stake';
|
|
436
|
+
const argumentsTypes = [
|
|
437
|
+
null
|
|
438
|
+
] satisfies (string | null)[];
|
|
439
|
+
const parameterNames = ["self"];
|
|
440
|
+
return (tx: Transaction) => tx.moveCall({
|
|
441
|
+
package: packageAddress,
|
|
442
|
+
module: 'routed_stake',
|
|
443
|
+
function: 'stake',
|
|
444
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
445
|
+
typeArguments: options.typeArguments
|
|
446
|
+
});
|
|
447
|
+
}
|
|
448
|
+
export interface DerivedAddressArguments {
|
|
449
|
+
parentId: RawTransactionArgument<string>;
|
|
450
|
+
}
|
|
451
|
+
export interface DerivedAddressOptions {
|
|
452
|
+
package?: string;
|
|
453
|
+
arguments: DerivedAddressArguments | [
|
|
454
|
+
parentId: RawTransactionArgument<string>
|
|
455
|
+
];
|
|
456
|
+
typeArguments: [
|
|
457
|
+
string
|
|
458
|
+
];
|
|
459
|
+
}
|
|
460
|
+
/**
|
|
461
|
+
* Compute the deterministic address of a routed stake given its parent ID and
|
|
462
|
+
* `StakeShare` type parameter.
|
|
463
|
+
*/
|
|
464
|
+
export function derivedAddress(options: DerivedAddressOptions) {
|
|
465
|
+
const packageAddress = options.package ?? '@local-pkg/routed_stake';
|
|
466
|
+
const argumentsTypes = [
|
|
467
|
+
'0x2::object::ID'
|
|
468
|
+
] satisfies (string | null)[];
|
|
469
|
+
const parameterNames = ["parentId"];
|
|
470
|
+
return (tx: Transaction) => tx.moveCall({
|
|
471
|
+
package: packageAddress,
|
|
472
|
+
module: 'routed_stake',
|
|
473
|
+
function: 'derived_address',
|
|
474
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
475
|
+
typeArguments: options.typeArguments
|
|
476
|
+
});
|
|
477
|
+
}
|
|
478
|
+
export interface AssertDerivedFromArguments {
|
|
479
|
+
self: RawTransactionArgument<string>;
|
|
480
|
+
parentId: RawTransactionArgument<string>;
|
|
481
|
+
}
|
|
482
|
+
export interface AssertDerivedFromOptions {
|
|
483
|
+
package?: string;
|
|
484
|
+
arguments: AssertDerivedFromArguments | [
|
|
485
|
+
self: RawTransactionArgument<string>,
|
|
486
|
+
parentId: RawTransactionArgument<string>
|
|
487
|
+
];
|
|
488
|
+
typeArguments: [
|
|
489
|
+
string,
|
|
490
|
+
string
|
|
491
|
+
];
|
|
492
|
+
}
|
|
493
|
+
/** Verify the routed stake was derived from the given parent ID. */
|
|
494
|
+
export function assertDerivedFrom(options: AssertDerivedFromOptions) {
|
|
495
|
+
const packageAddress = options.package ?? '@local-pkg/routed_stake';
|
|
496
|
+
const argumentsTypes = [
|
|
497
|
+
null,
|
|
498
|
+
'0x2::object::ID'
|
|
499
|
+
] satisfies (string | null)[];
|
|
500
|
+
const parameterNames = ["self", "parentId"];
|
|
501
|
+
return (tx: Transaction) => tx.moveCall({
|
|
502
|
+
package: packageAddress,
|
|
503
|
+
module: 'routed_stake',
|
|
504
|
+
function: 'assert_derived_from',
|
|
505
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
506
|
+
typeArguments: options.typeArguments
|
|
507
|
+
});
|
|
508
|
+
}
|
|
@@ -5,30 +5,38 @@
|
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Accumulator-based royalty distribution pool for the protocol's share tokens.
|
|
8
|
-
*
|
|
8
|
+
*
|
|
9
9
|
* A `RoyaltyPool<Share, Currency>` is a derived object of any UID-bearing parent.
|
|
10
|
-
* Its address is deterministically derived from `(parent_id, Currency)` —
|
|
11
|
-
* one pool per
|
|
12
|
-
*
|
|
13
|
-
*
|
|
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
|
+
*
|
|
14
17
|
* Holders create a `Stake<Share>` (see `royalty_pool::stake`) and register it.
|
|
15
18
|
* Callers fund the pool by handing it a `Balance<Currency>` via `deposit`; the
|
|
16
19
|
* accumulator advances and claims pay out the per-stake proportional share since
|
|
17
20
|
* each stake's last claim.
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
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
|
+
*
|
|
30
38
|
* ### No activation delay (deliberate)
|
|
31
|
-
*
|
|
39
|
+
*
|
|
32
40
|
* Registration earns from the next deposit onward; there is no bonding or
|
|
33
41
|
* unbonding period (contrast Sui native staking's next-epoch activation). With the
|
|
34
42
|
* protocol's fixed-supply share token this is safe: a stake's take of any deposit
|
|
@@ -37,9 +45,9 @@
|
|
|
37
45
|
* supply on every deposit. Short-lived or just-in-time registrations can only
|
|
38
46
|
* compete for the _unregistered_ supply's drift — the designed incentive for being
|
|
39
47
|
* registered — never below any registered stake's floor.
|
|
40
|
-
*
|
|
48
|
+
*
|
|
41
49
|
* ### Precision
|
|
42
|
-
*
|
|
50
|
+
*
|
|
43
51
|
* The share token's shape is fixed at issuance by the protocol — exactly 10¹³ base
|
|
44
52
|
* units, 6 decimals, supply made immutable via `miso_share::share::initialize`
|
|
45
53
|
* (`make_supply_fixed`) — so `staked_shares ≤ 10¹³` objectively. A deposit of
|
|
@@ -66,7 +74,7 @@ export const RoyaltyPool = new MoveStruct({ name: `${$moduleName}::RoyaltyPool<p
|
|
|
66
74
|
*/
|
|
67
75
|
cumulative_deposits: bcs.u128()
|
|
68
76
|
} });
|
|
69
|
-
export const RoyaltyPoolKey = new MoveTuple({ name: `${$moduleName}::RoyaltyPoolKey<phantom Currency>`, fields: [bcs.bool()] });
|
|
77
|
+
export const RoyaltyPoolKey = new MoveTuple({ name: `${$moduleName}::RoyaltyPoolKey<phantom Share, phantom Currency>`, fields: [bcs.bool()] });
|
|
70
78
|
export const RoyaltyPoolCreatedEvent = new MoveStruct({ name: `${$moduleName}::RoyaltyPoolCreatedEvent<phantom Share, phantom Currency>`, fields: {
|
|
71
79
|
pool_id: bcs.Address,
|
|
72
80
|
parent_id: bcs.Address
|
|
@@ -104,9 +112,10 @@ export interface NewOptions {
|
|
|
104
112
|
];
|
|
105
113
|
}
|
|
106
114
|
/**
|
|
107
|
-
* Construct a pool as a derived object of `parent`. The derivation key
|
|
108
|
-
*
|
|
109
|
-
* `(parent_id, Currency)
|
|
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`).
|
|
110
119
|
*
|
|
111
120
|
* Cap-gating happens at the parent: callers must obtain `&mut UID` via whatever
|
|
112
121
|
* cap-gated accessor the parent exposes.
|
|
@@ -548,6 +557,7 @@ export interface DerivedAddressOptions {
|
|
|
548
557
|
parentId: RawTransactionArgument<string>
|
|
549
558
|
];
|
|
550
559
|
typeArguments: [
|
|
560
|
+
string,
|
|
551
561
|
string
|
|
552
562
|
];
|
|
553
563
|
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**************************************************************
|
|
2
|
+
* THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
|
|
3
|
+
**************************************************************/
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* A bag is a heterogeneous map-like collection. The collection is similar to
|
|
8
|
+
* `sui::table` in that its keys and values are not stored within the `Bag` value,
|
|
9
|
+
* but instead are stored using Sui's object system. The `Bag` struct acts only as
|
|
10
|
+
* a handle into the object system to retrieve those keys and values. Note that
|
|
11
|
+
* this means that `Bag` values with exactly the same key-value mapping will not be
|
|
12
|
+
* equal, with `==`, at runtime. For example
|
|
13
|
+
*
|
|
14
|
+
* ```
|
|
15
|
+
* let bag1 = bag::new();
|
|
16
|
+
* let bag2 = bag::new();
|
|
17
|
+
* bag::add(&mut bag1, 0, false);
|
|
18
|
+
* bag::add(&mut bag1, 1, true);
|
|
19
|
+
* bag::add(&mut bag2, 0, false);
|
|
20
|
+
* bag::add(&mut bag2, 1, true);
|
|
21
|
+
* // bag1 does not equal bag2, despite having the same entries
|
|
22
|
+
* assert!(&bag1 != &bag2);
|
|
23
|
+
* ```
|
|
24
|
+
*
|
|
25
|
+
* At it's core, `sui::bag` is a wrapper around `UID` that allows for access to
|
|
26
|
+
* `sui::dynamic_field` while preventing accidentally stranding field values. A
|
|
27
|
+
* `UID` can be deleted, even if it has dynamic fields associated with it, but a
|
|
28
|
+
* bag, on the other hand, must be empty to be destroyed.
|
|
29
|
+
*/
|
|
30
|
+
|
|
31
|
+
import { MoveStruct } from '../../../utils/index.js';
|
|
32
|
+
import { bcs } from '@mysten/sui/bcs';
|
|
33
|
+
const $moduleName = '0x2::bag';
|
|
34
|
+
export const Bag = new MoveStruct({ name: `${$moduleName}::Bag`, fields: {
|
|
35
|
+
/** the ID of this bag */
|
|
36
|
+
id: bcs.Address,
|
|
37
|
+
/** the number of key-value pairs in the bag */
|
|
38
|
+
size: bcs.u64()
|
|
39
|
+
} });
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**************************************************************
|
|
2
|
+
* THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
|
|
3
|
+
**************************************************************/
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* A simple library that enables hot-potato-locked borrow mechanics.
|
|
8
|
+
*
|
|
9
|
+
* With Programmable transactions, it is possible to borrow a value within a
|
|
10
|
+
* transaction, use it and put back in the end. Hot-potato `Borrow` makes sure the
|
|
11
|
+
* object is returned and was not swapped for another one.
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
import { type BcsType, bcs } from '@mysten/sui/bcs';
|
|
15
|
+
import { MoveStruct } from '../../../utils/index.js';
|
|
16
|
+
const $moduleName = '0x2::borrow';
|
|
17
|
+
/** An object wrapping a `T` and providing the borrow API. */
|
|
18
|
+
export function Referent<T extends BcsType<any>>(...typeParameters: [
|
|
19
|
+
T
|
|
20
|
+
]) {
|
|
21
|
+
return new MoveStruct({ name: `${$moduleName}::Referent<${typeParameters[0].name as T['name']}>`, fields: {
|
|
22
|
+
id: bcs.Address,
|
|
23
|
+
value: bcs.option(typeParameters[0])
|
|
24
|
+
} });
|
|
25
|
+
}
|