@misofm/sdk 0.9.0 → 0.11.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 +121 -18
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +200 -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/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 +13 -2
- package/dist/contracts.d.ts.map +1 -1
- package/dist/contracts.js +15 -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 +30 -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 +84 -0
- package/dist/release-extensions.d.ts.map +1 -0
- package/dist/release-extensions.js +160 -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 +399 -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/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 +16 -9
- package/src/cover.ts +62 -37
- package/src/credits.ts +64 -51
- package/src/deployments.ts +35 -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 +261 -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
|
@@ -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
|
+
}
|
|
@@ -0,0 +1,454 @@
|
|
|
1
|
+
/**************************************************************
|
|
2
|
+
* THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
|
|
3
|
+
**************************************************************/
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Generic capability custody and plugin authorization.
|
|
8
|
+
*
|
|
9
|
+
* `Vault<Cap>` holds a capability in a Sui `Referent`. An authorized plugin
|
|
10
|
+
* receives the whole capability temporarily, paired with a hot-potato `Borrow`
|
|
11
|
+
* receipt that forces the same capability back into the same vault before the
|
|
12
|
+
* transaction can finish. Plugin authorization is represented by a typed dynamic
|
|
13
|
+
* field in the vault's `Bag`.
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
import { type BcsType, bcs } from '@mysten/sui/bcs';
|
|
17
|
+
import { MoveStruct, MoveTuple, normalizeMoveArguments, type RawTransactionArgument } from '../utils/index.js';
|
|
18
|
+
import { type Transaction, type TransactionArgument } from '@mysten/sui/transactions';
|
|
19
|
+
import * as borrow from './deps/sui/borrow.js';
|
|
20
|
+
import * as bag from './deps/sui/bag.js';
|
|
21
|
+
const $moduleName = '@local-pkg/vault::vault';
|
|
22
|
+
/**
|
|
23
|
+
* Custodies one capability and the typed authorization records for plugins.
|
|
24
|
+
*
|
|
25
|
+
* `Vault` intentionally lacks `store`: only this module can share or destroy it.
|
|
26
|
+
* The wrapped capability is never exposed except through a hot-potato borrow that
|
|
27
|
+
* requires its exact return.
|
|
28
|
+
*/
|
|
29
|
+
export function Vault<Cap extends BcsType<any>>(...typeParameters: [
|
|
30
|
+
Cap
|
|
31
|
+
]) {
|
|
32
|
+
return new MoveStruct({ name: `${$moduleName}::Vault<${typeParameters[0].name as Cap['name']}>`, fields: {
|
|
33
|
+
id: bcs.Address,
|
|
34
|
+
cap: borrow.Referent(typeParameters[0]),
|
|
35
|
+
authorized_plugins: bag.Bag
|
|
36
|
+
} });
|
|
37
|
+
}
|
|
38
|
+
export const VaultAdminCap = new MoveStruct({ name: `${$moduleName}::VaultAdminCap<phantom Cap>`, fields: {
|
|
39
|
+
id: bcs.Address,
|
|
40
|
+
vault_id: bcs.Address
|
|
41
|
+
} });
|
|
42
|
+
export const AuthorizedPluginKey = new MoveTuple({ name: `${$moduleName}::AuthorizedPluginKey<phantom Witness>`, fields: [bcs.bool()] });
|
|
43
|
+
export const VaultCreatedEvent = new MoveStruct({ name: `${$moduleName}::VaultCreatedEvent<phantom Cap>`, fields: {
|
|
44
|
+
vault_id: bcs.Address,
|
|
45
|
+
vault_admin_cap_id: bcs.Address,
|
|
46
|
+
wrapped_cap_id: bcs.Address,
|
|
47
|
+
authorized_plugins_id: bcs.Address
|
|
48
|
+
} });
|
|
49
|
+
export const PluginAuthorizedEvent = new MoveStruct({ name: `${$moduleName}::PluginAuthorizedEvent<phantom Cap, phantom Witness>`, fields: {
|
|
50
|
+
vault_id: bcs.Address
|
|
51
|
+
} });
|
|
52
|
+
export const PluginRevokedEvent = new MoveStruct({ name: `${$moduleName}::PluginRevokedEvent<phantom Cap, phantom Witness>`, fields: {
|
|
53
|
+
vault_id: bcs.Address
|
|
54
|
+
} });
|
|
55
|
+
export const VaultDestroyedEvent = new MoveStruct({ name: `${$moduleName}::VaultDestroyedEvent<phantom Cap>`, fields: {
|
|
56
|
+
vault_id: bcs.Address,
|
|
57
|
+
wrapped_cap_id: bcs.Address
|
|
58
|
+
} });
|
|
59
|
+
export interface NewArguments<Cap extends BcsType<any>> {
|
|
60
|
+
cap: RawTransactionArgument<Cap>;
|
|
61
|
+
}
|
|
62
|
+
export interface NewOptions<Cap extends BcsType<any>> {
|
|
63
|
+
package?: string;
|
|
64
|
+
arguments: NewArguments<Cap> | [
|
|
65
|
+
cap: RawTransactionArgument<Cap>
|
|
66
|
+
];
|
|
67
|
+
typeArguments: [
|
|
68
|
+
string
|
|
69
|
+
];
|
|
70
|
+
}
|
|
71
|
+
/** Custody `cap` and create its vault-specific administrator capability. */
|
|
72
|
+
export function _new<Cap extends BcsType<any>>(options: NewOptions<Cap>) {
|
|
73
|
+
const packageAddress = options.package ?? '@local-pkg/vault';
|
|
74
|
+
const argumentsTypes = [
|
|
75
|
+
`${options.typeArguments[0]}`
|
|
76
|
+
] satisfies (string | null)[];
|
|
77
|
+
const parameterNames = ["cap"];
|
|
78
|
+
return (tx: Transaction) => tx.moveCall({
|
|
79
|
+
package: packageAddress,
|
|
80
|
+
module: 'vault',
|
|
81
|
+
function: 'new',
|
|
82
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
83
|
+
typeArguments: options.typeArguments
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
export interface ShareArguments {
|
|
87
|
+
vault: RawTransactionArgument<string>;
|
|
88
|
+
}
|
|
89
|
+
export interface ShareOptions {
|
|
90
|
+
package?: string;
|
|
91
|
+
arguments: ShareArguments | [
|
|
92
|
+
vault: RawTransactionArgument<string>
|
|
93
|
+
];
|
|
94
|
+
typeArguments: [
|
|
95
|
+
string
|
|
96
|
+
];
|
|
97
|
+
}
|
|
98
|
+
/** Share a newly-created vault. */
|
|
99
|
+
export function share(options: ShareOptions) {
|
|
100
|
+
const packageAddress = options.package ?? '@local-pkg/vault';
|
|
101
|
+
const argumentsTypes = [
|
|
102
|
+
null
|
|
103
|
+
] satisfies (string | null)[];
|
|
104
|
+
const parameterNames = ["vault"];
|
|
105
|
+
return (tx: Transaction) => tx.moveCall({
|
|
106
|
+
package: packageAddress,
|
|
107
|
+
module: 'vault',
|
|
108
|
+
function: 'share',
|
|
109
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
110
|
+
typeArguments: options.typeArguments
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
export interface DestroyArguments {
|
|
114
|
+
self: RawTransactionArgument<string>;
|
|
115
|
+
adminCap: RawTransactionArgument<string>;
|
|
116
|
+
}
|
|
117
|
+
export interface DestroyOptions {
|
|
118
|
+
package?: string;
|
|
119
|
+
arguments: DestroyArguments | [
|
|
120
|
+
self: RawTransactionArgument<string>,
|
|
121
|
+
adminCap: RawTransactionArgument<string>
|
|
122
|
+
];
|
|
123
|
+
typeArguments: [
|
|
124
|
+
string
|
|
125
|
+
];
|
|
126
|
+
}
|
|
127
|
+
/** Destroy an empty vault and return the exact capability it custodied. */
|
|
128
|
+
export function destroy(options: DestroyOptions) {
|
|
129
|
+
const packageAddress = options.package ?? '@local-pkg/vault';
|
|
130
|
+
const argumentsTypes = [
|
|
131
|
+
null,
|
|
132
|
+
null
|
|
133
|
+
] satisfies (string | null)[];
|
|
134
|
+
const parameterNames = ["self", "adminCap"];
|
|
135
|
+
return (tx: Transaction) => tx.moveCall({
|
|
136
|
+
package: packageAddress,
|
|
137
|
+
module: 'vault',
|
|
138
|
+
function: 'destroy',
|
|
139
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
140
|
+
typeArguments: options.typeArguments
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
export interface AuthorizePluginArguments<Witness extends BcsType<any>> {
|
|
144
|
+
self: RawTransactionArgument<string>;
|
|
145
|
+
adminCap: RawTransactionArgument<string>;
|
|
146
|
+
_: RawTransactionArgument<Witness>;
|
|
147
|
+
}
|
|
148
|
+
export interface AuthorizePluginOptions<Witness extends BcsType<any>> {
|
|
149
|
+
package?: string;
|
|
150
|
+
arguments: AuthorizePluginArguments<Witness> | [
|
|
151
|
+
self: RawTransactionArgument<string>,
|
|
152
|
+
adminCap: RawTransactionArgument<string>,
|
|
153
|
+
_: RawTransactionArgument<Witness>
|
|
154
|
+
];
|
|
155
|
+
typeArguments: [
|
|
156
|
+
string,
|
|
157
|
+
string
|
|
158
|
+
];
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* Authorize the package identified by its canonical `witness::Witness` type.
|
|
162
|
+
*
|
|
163
|
+
* The witness is consumed here. A plugin should construct it with a package-only
|
|
164
|
+
* `witness::new()` function.
|
|
165
|
+
*/
|
|
166
|
+
export function authorizePlugin<Witness extends BcsType<any>>(options: AuthorizePluginOptions<Witness>) {
|
|
167
|
+
const packageAddress = options.package ?? '@local-pkg/vault';
|
|
168
|
+
const argumentsTypes = [
|
|
169
|
+
null,
|
|
170
|
+
null,
|
|
171
|
+
`${options.typeArguments[1]}`
|
|
172
|
+
] satisfies (string | null)[];
|
|
173
|
+
const parameterNames = ["self", "adminCap", "_"];
|
|
174
|
+
return (tx: Transaction) => tx.moveCall({
|
|
175
|
+
package: packageAddress,
|
|
176
|
+
module: 'vault',
|
|
177
|
+
function: 'authorize_plugin',
|
|
178
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
179
|
+
typeArguments: options.typeArguments
|
|
180
|
+
});
|
|
181
|
+
}
|
|
182
|
+
export interface RevokePluginArguments {
|
|
183
|
+
self: RawTransactionArgument<string>;
|
|
184
|
+
adminCap: RawTransactionArgument<string>;
|
|
185
|
+
}
|
|
186
|
+
export interface RevokePluginOptions {
|
|
187
|
+
package?: string;
|
|
188
|
+
arguments: RevokePluginArguments | [
|
|
189
|
+
self: RawTransactionArgument<string>,
|
|
190
|
+
adminCap: RawTransactionArgument<string>
|
|
191
|
+
];
|
|
192
|
+
typeArguments: [
|
|
193
|
+
string,
|
|
194
|
+
string
|
|
195
|
+
];
|
|
196
|
+
}
|
|
197
|
+
/** Revoke a plugin authorization without requiring cooperation from the plugin. */
|
|
198
|
+
export function revokePlugin(options: RevokePluginOptions) {
|
|
199
|
+
const packageAddress = options.package ?? '@local-pkg/vault';
|
|
200
|
+
const argumentsTypes = [
|
|
201
|
+
null,
|
|
202
|
+
null
|
|
203
|
+
] satisfies (string | null)[];
|
|
204
|
+
const parameterNames = ["self", "adminCap"];
|
|
205
|
+
return (tx: Transaction) => tx.moveCall({
|
|
206
|
+
package: packageAddress,
|
|
207
|
+
module: 'vault',
|
|
208
|
+
function: 'revoke_plugin',
|
|
209
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
210
|
+
typeArguments: options.typeArguments
|
|
211
|
+
});
|
|
212
|
+
}
|
|
213
|
+
export interface BorrowAsPluginArguments<Witness extends BcsType<any>> {
|
|
214
|
+
self: RawTransactionArgument<string>;
|
|
215
|
+
_: RawTransactionArgument<Witness>;
|
|
216
|
+
}
|
|
217
|
+
export interface BorrowAsPluginOptions<Witness extends BcsType<any>> {
|
|
218
|
+
package?: string;
|
|
219
|
+
arguments: BorrowAsPluginArguments<Witness> | [
|
|
220
|
+
self: RawTransactionArgument<string>,
|
|
221
|
+
_: RawTransactionArgument<Witness>
|
|
222
|
+
];
|
|
223
|
+
typeArguments: [
|
|
224
|
+
string,
|
|
225
|
+
string
|
|
226
|
+
];
|
|
227
|
+
}
|
|
228
|
+
/**
|
|
229
|
+
* Temporarily lend the full custodied capability to an authorized plugin.
|
|
230
|
+
*
|
|
231
|
+
* `Borrow` has no abilities, so the exact capability must be returned through
|
|
232
|
+
* `put_back` in this transaction.
|
|
233
|
+
*/
|
|
234
|
+
export function borrowAsPlugin<Witness extends BcsType<any>>(options: BorrowAsPluginOptions<Witness>) {
|
|
235
|
+
const packageAddress = options.package ?? '@local-pkg/vault';
|
|
236
|
+
const argumentsTypes = [
|
|
237
|
+
null,
|
|
238
|
+
`${options.typeArguments[1]}`
|
|
239
|
+
] satisfies (string | null)[];
|
|
240
|
+
const parameterNames = ["self", "_"];
|
|
241
|
+
return (tx: Transaction) => tx.moveCall({
|
|
242
|
+
package: packageAddress,
|
|
243
|
+
module: 'vault',
|
|
244
|
+
function: 'borrow_as_plugin',
|
|
245
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
246
|
+
typeArguments: options.typeArguments
|
|
247
|
+
});
|
|
248
|
+
}
|
|
249
|
+
export interface BorrowAsAdminArguments {
|
|
250
|
+
self: RawTransactionArgument<string>;
|
|
251
|
+
adminCap: RawTransactionArgument<string>;
|
|
252
|
+
}
|
|
253
|
+
export interface BorrowAsAdminOptions {
|
|
254
|
+
package?: string;
|
|
255
|
+
arguments: BorrowAsAdminArguments | [
|
|
256
|
+
self: RawTransactionArgument<string>,
|
|
257
|
+
adminCap: RawTransactionArgument<string>
|
|
258
|
+
];
|
|
259
|
+
typeArguments: [
|
|
260
|
+
string
|
|
261
|
+
];
|
|
262
|
+
}
|
|
263
|
+
/** Temporarily lend the full custodied capability to the vault administrator. */
|
|
264
|
+
export function borrowAsAdmin(options: BorrowAsAdminOptions) {
|
|
265
|
+
const packageAddress = options.package ?? '@local-pkg/vault';
|
|
266
|
+
const argumentsTypes = [
|
|
267
|
+
null,
|
|
268
|
+
null
|
|
269
|
+
] satisfies (string | null)[];
|
|
270
|
+
const parameterNames = ["self", "adminCap"];
|
|
271
|
+
return (tx: Transaction) => tx.moveCall({
|
|
272
|
+
package: packageAddress,
|
|
273
|
+
module: 'vault',
|
|
274
|
+
function: 'borrow_as_admin',
|
|
275
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
276
|
+
typeArguments: options.typeArguments
|
|
277
|
+
});
|
|
278
|
+
}
|
|
279
|
+
export interface PutBackArguments<Cap extends BcsType<any>> {
|
|
280
|
+
self: RawTransactionArgument<string>;
|
|
281
|
+
cap: RawTransactionArgument<Cap>;
|
|
282
|
+
receipt: TransactionArgument;
|
|
283
|
+
}
|
|
284
|
+
export interface PutBackOptions<Cap extends BcsType<any>> {
|
|
285
|
+
package?: string;
|
|
286
|
+
arguments: PutBackArguments<Cap> | [
|
|
287
|
+
self: RawTransactionArgument<string>,
|
|
288
|
+
cap: RawTransactionArgument<Cap>,
|
|
289
|
+
receipt: TransactionArgument
|
|
290
|
+
];
|
|
291
|
+
typeArguments: [
|
|
292
|
+
string
|
|
293
|
+
];
|
|
294
|
+
}
|
|
295
|
+
/**
|
|
296
|
+
* Return the exact capability borrowed from this vault.
|
|
297
|
+
*
|
|
298
|
+
* No additional authorization is required: `Borrow` proves the originating
|
|
299
|
+
* referent and capability object ID, and blocking return would harm liveness.
|
|
300
|
+
*/
|
|
301
|
+
export function putBack<Cap extends BcsType<any>>(options: PutBackOptions<Cap>) {
|
|
302
|
+
const packageAddress = options.package ?? '@local-pkg/vault';
|
|
303
|
+
const argumentsTypes = [
|
|
304
|
+
null,
|
|
305
|
+
`${options.typeArguments[0]}`,
|
|
306
|
+
null
|
|
307
|
+
] satisfies (string | null)[];
|
|
308
|
+
const parameterNames = ["self", "cap", "receipt"];
|
|
309
|
+
return (tx: Transaction) => tx.moveCall({
|
|
310
|
+
package: packageAddress,
|
|
311
|
+
module: 'vault',
|
|
312
|
+
function: 'put_back',
|
|
313
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
314
|
+
typeArguments: options.typeArguments
|
|
315
|
+
});
|
|
316
|
+
}
|
|
317
|
+
export interface IdArguments {
|
|
318
|
+
self: RawTransactionArgument<string>;
|
|
319
|
+
}
|
|
320
|
+
export interface IdOptions {
|
|
321
|
+
package?: string;
|
|
322
|
+
arguments: IdArguments | [
|
|
323
|
+
self: RawTransactionArgument<string>
|
|
324
|
+
];
|
|
325
|
+
typeArguments: [
|
|
326
|
+
string
|
|
327
|
+
];
|
|
328
|
+
}
|
|
329
|
+
export function id(options: IdOptions) {
|
|
330
|
+
const packageAddress = options.package ?? '@local-pkg/vault';
|
|
331
|
+
const argumentsTypes = [
|
|
332
|
+
null
|
|
333
|
+
] satisfies (string | null)[];
|
|
334
|
+
const parameterNames = ["self"];
|
|
335
|
+
return (tx: Transaction) => tx.moveCall({
|
|
336
|
+
package: packageAddress,
|
|
337
|
+
module: 'vault',
|
|
338
|
+
function: 'id',
|
|
339
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
340
|
+
typeArguments: options.typeArguments
|
|
341
|
+
});
|
|
342
|
+
}
|
|
343
|
+
export interface VaultIdArguments {
|
|
344
|
+
self: RawTransactionArgument<string>;
|
|
345
|
+
}
|
|
346
|
+
export interface VaultIdOptions {
|
|
347
|
+
package?: string;
|
|
348
|
+
arguments: VaultIdArguments | [
|
|
349
|
+
self: RawTransactionArgument<string>
|
|
350
|
+
];
|
|
351
|
+
typeArguments: [
|
|
352
|
+
string
|
|
353
|
+
];
|
|
354
|
+
}
|
|
355
|
+
export function vaultId(options: VaultIdOptions) {
|
|
356
|
+
const packageAddress = options.package ?? '@local-pkg/vault';
|
|
357
|
+
const argumentsTypes = [
|
|
358
|
+
null
|
|
359
|
+
] satisfies (string | null)[];
|
|
360
|
+
const parameterNames = ["self"];
|
|
361
|
+
return (tx: Transaction) => tx.moveCall({
|
|
362
|
+
package: packageAddress,
|
|
363
|
+
module: 'vault',
|
|
364
|
+
function: 'vault_id',
|
|
365
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
366
|
+
typeArguments: options.typeArguments
|
|
367
|
+
});
|
|
368
|
+
}
|
|
369
|
+
export interface AuthorizedPluginsIdArguments {
|
|
370
|
+
self: RawTransactionArgument<string>;
|
|
371
|
+
}
|
|
372
|
+
export interface AuthorizedPluginsIdOptions {
|
|
373
|
+
package?: string;
|
|
374
|
+
arguments: AuthorizedPluginsIdArguments | [
|
|
375
|
+
self: RawTransactionArgument<string>
|
|
376
|
+
];
|
|
377
|
+
typeArguments: [
|
|
378
|
+
string
|
|
379
|
+
];
|
|
380
|
+
}
|
|
381
|
+
/** The ID under which `AuthorizedPluginKey` records are dynamic fields. */
|
|
382
|
+
export function authorizedPluginsId(options: AuthorizedPluginsIdOptions) {
|
|
383
|
+
const packageAddress = options.package ?? '@local-pkg/vault';
|
|
384
|
+
const argumentsTypes = [
|
|
385
|
+
null
|
|
386
|
+
] satisfies (string | null)[];
|
|
387
|
+
const parameterNames = ["self"];
|
|
388
|
+
return (tx: Transaction) => tx.moveCall({
|
|
389
|
+
package: packageAddress,
|
|
390
|
+
module: 'vault',
|
|
391
|
+
function: 'authorized_plugins_id',
|
|
392
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
393
|
+
typeArguments: options.typeArguments
|
|
394
|
+
});
|
|
395
|
+
}
|
|
396
|
+
export interface AuthorizedPluginCountArguments {
|
|
397
|
+
self: RawTransactionArgument<string>;
|
|
398
|
+
}
|
|
399
|
+
export interface AuthorizedPluginCountOptions {
|
|
400
|
+
package?: string;
|
|
401
|
+
arguments: AuthorizedPluginCountArguments | [
|
|
402
|
+
self: RawTransactionArgument<string>
|
|
403
|
+
];
|
|
404
|
+
typeArguments: [
|
|
405
|
+
string
|
|
406
|
+
];
|
|
407
|
+
}
|
|
408
|
+
export function authorizedPluginCount(options: AuthorizedPluginCountOptions) {
|
|
409
|
+
const packageAddress = options.package ?? '@local-pkg/vault';
|
|
410
|
+
const argumentsTypes = [
|
|
411
|
+
null
|
|
412
|
+
] satisfies (string | null)[];
|
|
413
|
+
const parameterNames = ["self"];
|
|
414
|
+
return (tx: Transaction) => tx.moveCall({
|
|
415
|
+
package: packageAddress,
|
|
416
|
+
module: 'vault',
|
|
417
|
+
function: 'authorized_plugin_count',
|
|
418
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
419
|
+
typeArguments: options.typeArguments
|
|
420
|
+
});
|
|
421
|
+
}
|
|
422
|
+
export interface IsPluginAuthorizedArguments {
|
|
423
|
+
self: RawTransactionArgument<string>;
|
|
424
|
+
}
|
|
425
|
+
export interface IsPluginAuthorizedOptions {
|
|
426
|
+
package?: string;
|
|
427
|
+
arguments: IsPluginAuthorizedArguments | [
|
|
428
|
+
self: RawTransactionArgument<string>
|
|
429
|
+
];
|
|
430
|
+
typeArguments: [
|
|
431
|
+
string,
|
|
432
|
+
string
|
|
433
|
+
];
|
|
434
|
+
}
|
|
435
|
+
/**
|
|
436
|
+
* Returns whether this witness type has an authorization record.
|
|
437
|
+
*
|
|
438
|
+
* This deliberately does not validate the witness shape: arbitrary types simply
|
|
439
|
+
* report false, while `authorize_plugin` is the only way to add one.
|
|
440
|
+
*/
|
|
441
|
+
export function isPluginAuthorized(options: IsPluginAuthorizedOptions) {
|
|
442
|
+
const packageAddress = options.package ?? '@local-pkg/vault';
|
|
443
|
+
const argumentsTypes = [
|
|
444
|
+
null
|
|
445
|
+
] satisfies (string | null)[];
|
|
446
|
+
const parameterNames = ["self"];
|
|
447
|
+
return (tx: Transaction) => tx.moveCall({
|
|
448
|
+
package: packageAddress,
|
|
449
|
+
module: 'vault',
|
|
450
|
+
function: 'is_plugin_authorized',
|
|
451
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
452
|
+
typeArguments: options.typeArguments
|
|
453
|
+
});
|
|
454
|
+
}
|
package/src/contracts.ts
CHANGED
|
@@ -14,24 +14,31 @@ export * as pressing from "./contracts/miso_pressing/pressing.ts";
|
|
|
14
14
|
export * as listing from "./contracts/miso_pressing/listing.ts";
|
|
15
15
|
export * as certificate from "./contracts/miso_pressing/certificate.ts";
|
|
16
16
|
|
|
17
|
-
//
|
|
18
|
-
// minting a `Release` now that core's `release::new` takes `&mut UID`.
|
|
19
|
-
export * as releaseRegistry from "./contracts/release_registry/release_registry.ts";
|
|
20
|
-
|
|
21
|
-
// Existing launch drops remain readable and purchasable while releases move to
|
|
22
|
-
// the pressing/listing contracts.
|
|
23
|
-
export * as drop from "./contracts/miso_drop/drop.ts";
|
|
24
|
-
|
|
25
|
-
// Royalty-pool extension (base lib + per-work extensions).
|
|
17
|
+
// Generic royalty-pool primitive plus vault-custodied business-logic plugins.
|
|
26
18
|
export * as royaltyPool from "./contracts/royalty_pool/pool.ts";
|
|
27
19
|
export * as royaltyPoolStake from "./contracts/royalty_pool/stake.ts";
|
|
20
|
+
export * as vault from "./contracts/vault/vault.ts";
|
|
28
21
|
export * as compositionRoyaltyPool from "./contracts/composition_royalty_pool/composition_royalty_pool.ts";
|
|
29
22
|
export * as recordingRoyaltyPool from "./contracts/recording_royalty_pool/recording_royalty_pool.ts";
|
|
23
|
+
export * as routedStake from "./contracts/routed_stake/routed_stake.ts";
|
|
24
|
+
export * as compositionRoutedStake from "./contracts/composition_routed_stake/composition_routed_stake.ts";
|
|
30
25
|
|
|
31
26
|
// Cover art (the CoverArt value type + the release attachment extension).
|
|
32
27
|
export * as coverArt from "./contracts/cover_art/cover_art.ts";
|
|
33
28
|
export * as releaseCoverArt from "./contracts/release_cover_art/release_cover_art.ts";
|
|
34
29
|
|
|
30
|
+
// Release presentation, discovery, buyer-content, and runtime economics.
|
|
31
|
+
export * as genre from "./contracts/genre/genre.ts";
|
|
32
|
+
export * as releaseDescription from "./contracts/release_description/release_description.ts";
|
|
33
|
+
export * as releaseDspLink from "./contracts/release_dsp_link/release_dsp_link.ts";
|
|
34
|
+
export * as releaseGenre from "./contracts/release_genre/release_genre.ts";
|
|
35
|
+
export * as releaseKind from "./contracts/release_kind/release_kind.ts";
|
|
36
|
+
export * as releaseRevenueDistributor from "./contracts/release_revenue_distributor/release_revenue_distributor.ts";
|
|
37
|
+
export * as recordingAdvisory from "./contracts/recording_advisory/recording_advisory.ts";
|
|
38
|
+
export * as recordingLanguage from "./contracts/recording_language/recording_language.ts";
|
|
39
|
+
export * as recordingMasterReference from "./contracts/recording_master_reference/recording_master_reference.ts";
|
|
40
|
+
export * as recordingPreview from "./contracts/recording_preview/recording_preview.ts";
|
|
41
|
+
|
|
35
42
|
// Credits extensions (per-work credit stores + their role vocabularies).
|
|
36
43
|
export * as compositionCredits from "./contracts/composition_credits/composition_credits.ts";
|
|
37
44
|
export * as compositionPartyRole from "./contracts/composition_credits/composition_party_role.ts";
|