@misonetwork/sdk 0.2.1 → 0.3.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 +44 -98
- package/dist/contracts.d.ts +0 -12
- package/dist/contracts.d.ts.map +1 -1
- package/dist/contracts.js +3 -16
- package/dist/contracts.js.map +1 -1
- package/dist/index.d.ts +0 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -3
- package/dist/index.js.map +1 -1
- package/dist/internal.d.ts +0 -3
- package/dist/internal.d.ts.map +1 -1
- package/dist/internal.js +0 -4
- package/dist/internal.js.map +1 -1
- package/dist/queries.d.ts.map +1 -1
- package/dist/queries.js.map +1 -1
- package/package.json +1 -13
- package/src/contracts.ts +3 -19
- package/src/index.ts +3 -3
- package/src/internal.ts +10 -15
- package/src/queries.ts +5 -4
- package/dist/contracts/composition_credits/composition_credits.d.ts +0 -181
- package/dist/contracts/composition_credits/composition_credits.d.ts.map +0 -1
- package/dist/contracts/composition_credits/composition_credits.js +0 -109
- package/dist/contracts/composition_credits/composition_credits.js.map +0 -1
- package/dist/contracts/composition_credits/composition_party_role.d.ts +0 -119
- package/dist/contracts/composition_credits/composition_party_role.d.ts.map +0 -1
- package/dist/contracts/composition_credits/composition_party_role.js +0 -139
- package/dist/contracts/composition_credits/composition_party_role.js.map +0 -1
- package/dist/contracts/composition_credits/deps/miso_credit/credit.d.ts +0 -24
- package/dist/contracts/composition_credits/deps/miso_credit/credit.d.ts.map +0 -1
- package/dist/contracts/composition_credits/deps/miso_credit/credit.js +0 -23
- package/dist/contracts/composition_credits/deps/miso_credit/credit.js.map +0 -1
- package/dist/contracts/composition_credits/deps/sui/vec_map.d.ts +0 -37
- package/dist/contracts/composition_credits/deps/sui/vec_map.d.ts.map +0 -1
- package/dist/contracts/composition_credits/deps/sui/vec_map.js +0 -28
- package/dist/contracts/composition_credits/deps/sui/vec_map.js.map +0 -1
- package/dist/contracts/composition_royalty_pool/composition_royalty_pool.d.ts +0 -87
- package/dist/contracts/composition_royalty_pool/composition_royalty_pool.d.ts.map +0 -1
- package/dist/contracts/composition_royalty_pool/composition_royalty_pool.js +0 -80
- package/dist/contracts/composition_royalty_pool/composition_royalty_pool.js.map +0 -1
- package/dist/contracts/cover_art/cover_art.d.ts +0 -85
- package/dist/contracts/cover_art/cover_art.d.ts.map +0 -1
- package/dist/contracts/cover_art/cover_art.js +0 -68
- package/dist/contracts/cover_art/cover_art.js.map +0 -1
- package/dist/contracts/cover_art/deps/ori/walrus_data.d.ts +0 -52
- package/dist/contracts/cover_art/deps/ori/walrus_data.d.ts.map +0 -1
- package/dist/contracts/cover_art/deps/ori/walrus_data.js +0 -37
- package/dist/contracts/cover_art/deps/ori/walrus_data.js.map +0 -1
- package/dist/contracts/recording_credits/deps/miso_credit/credit.d.ts +0 -24
- package/dist/contracts/recording_credits/deps/miso_credit/credit.d.ts.map +0 -1
- package/dist/contracts/recording_credits/deps/miso_credit/credit.js +0 -23
- package/dist/contracts/recording_credits/deps/miso_credit/credit.js.map +0 -1
- package/dist/contracts/recording_credits/deps/sui/vec_map.d.ts +0 -37
- package/dist/contracts/recording_credits/deps/sui/vec_map.d.ts.map +0 -1
- package/dist/contracts/recording_credits/deps/sui/vec_map.js +0 -28
- package/dist/contracts/recording_credits/deps/sui/vec_map.js.map +0 -1
- package/dist/contracts/recording_credits/deps/sui/vec_set.d.ts +0 -21
- package/dist/contracts/recording_credits/deps/sui/vec_set.d.ts.map +0 -1
- package/dist/contracts/recording_credits/deps/sui/vec_set.js +0 -20
- package/dist/contracts/recording_credits/deps/sui/vec_set.js.map +0 -1
- package/dist/contracts/recording_credits/recording_credits.d.ts +0 -2313
- package/dist/contracts/recording_credits/recording_credits.d.ts.map +0 -1
- package/dist/contracts/recording_credits/recording_credits.js +0 -270
- package/dist/contracts/recording_credits/recording_credits.js.map +0 -1
- package/dist/contracts/recording_credits/recording_party_role.d.ts +0 -1174
- package/dist/contracts/recording_credits/recording_party_role.d.ts.map +0 -1
- package/dist/contracts/recording_credits/recording_party_role.js +0 -692
- package/dist/contracts/recording_credits/recording_party_role.js.map +0 -1
- package/dist/contracts/recording_royalty_pool/recording_royalty_pool.d.ts +0 -90
- package/dist/contracts/recording_royalty_pool/recording_royalty_pool.d.ts.map +0 -1
- package/dist/contracts/recording_royalty_pool/recording_royalty_pool.js +0 -80
- package/dist/contracts/recording_royalty_pool/recording_royalty_pool.js.map +0 -1
- package/dist/contracts/release_cover_art/deps/0x340057f2174fb59e4626742dd2b46c662237837b6187450cb59e4976ce7eac78/walrus_data.d.ts +0 -52
- package/dist/contracts/release_cover_art/deps/0x340057f2174fb59e4626742dd2b46c662237837b6187450cb59e4976ce7eac78/walrus_data.d.ts.map +0 -1
- package/dist/contracts/release_cover_art/deps/0x340057f2174fb59e4626742dd2b46c662237837b6187450cb59e4976ce7eac78/walrus_data.js +0 -37
- package/dist/contracts/release_cover_art/deps/0x340057f2174fb59e4626742dd2b46c662237837b6187450cb59e4976ce7eac78/walrus_data.js.map +0 -1
- package/dist/contracts/release_cover_art/deps/cover_art/cover_art.d.ts +0 -46
- package/dist/contracts/release_cover_art/deps/cover_art/cover_art.d.ts.map +0 -1
- package/dist/contracts/release_cover_art/deps/cover_art/cover_art.js +0 -21
- package/dist/contracts/release_cover_art/deps/cover_art/cover_art.js.map +0 -1
- package/dist/contracts/release_cover_art/deps/per_track/per_track.d.ts +0 -33
- package/dist/contracts/release_cover_art/deps/per_track/per_track.d.ts.map +0 -1
- package/dist/contracts/release_cover_art/deps/per_track/per_track.js +0 -32
- package/dist/contracts/release_cover_art/deps/per_track/per_track.js.map +0 -1
- package/dist/contracts/release_cover_art/release_cover_art.d.ts +0 -300
- package/dist/contracts/release_cover_art/release_cover_art.d.ts.map +0 -1
- package/dist/contracts/release_cover_art/release_cover_art.js +0 -168
- package/dist/contracts/release_cover_art/release_cover_art.js.map +0 -1
- package/dist/contracts/release_credits/deps/miso_credit/credit.d.ts +0 -24
- package/dist/contracts/release_credits/deps/miso_credit/credit.d.ts.map +0 -1
- package/dist/contracts/release_credits/deps/miso_credit/credit.js +0 -23
- package/dist/contracts/release_credits/deps/miso_credit/credit.js.map +0 -1
- package/dist/contracts/release_credits/deps/sui/vec_map.d.ts +0 -37
- package/dist/contracts/release_credits/deps/sui/vec_map.d.ts.map +0 -1
- package/dist/contracts/release_credits/deps/sui/vec_map.js +0 -28
- package/dist/contracts/release_credits/deps/sui/vec_map.js.map +0 -1
- package/dist/contracts/release_credits/release_credits.d.ts +0 -142
- package/dist/contracts/release_credits/release_credits.d.ts.map +0 -1
- package/dist/contracts/release_credits/release_credits.js +0 -108
- package/dist/contracts/release_credits/release_credits.js.map +0 -1
- package/dist/contracts/release_credits/release_party_role.d.ts +0 -58
- package/dist/contracts/release_credits/release_party_role.d.ts.map +0 -1
- package/dist/contracts/release_credits/release_party_role.js +0 -66
- package/dist/contracts/release_credits/release_party_role.js.map +0 -1
- package/dist/contracts/royalty_pool/deps/std/type_name.d.ts +0 -18
- package/dist/contracts/royalty_pool/deps/std/type_name.d.ts.map +0 -1
- package/dist/contracts/royalty_pool/deps/std/type_name.js +0 -20
- package/dist/contracts/royalty_pool/deps/std/type_name.js.map +0 -1
- package/dist/contracts/royalty_pool/deps/sui/balance.d.ts +0 -13
- package/dist/contracts/royalty_pool/deps/sui/balance.d.ts.map +0 -1
- package/dist/contracts/royalty_pool/deps/sui/balance.js +0 -15
- package/dist/contracts/royalty_pool/deps/sui/balance.js.map +0 -1
- package/dist/contracts/royalty_pool/deps/sui/vec_map.d.ts +0 -37
- package/dist/contracts/royalty_pool/deps/sui/vec_map.d.ts.map +0 -1
- package/dist/contracts/royalty_pool/deps/sui/vec_map.js +0 -28
- package/dist/contracts/royalty_pool/deps/sui/vec_map.js.map +0 -1
- package/dist/contracts/royalty_pool/pool.d.ts +0 -358
- package/dist/contracts/royalty_pool/pool.d.ts.map +0 -1
- package/dist/contracts/royalty_pool/pool.js +0 -352
- package/dist/contracts/royalty_pool/pool.js.map +0 -1
- package/dist/contracts/royalty_pool/stake.d.ts +0 -202
- package/dist/contracts/royalty_pool/stake.d.ts.map +0 -1
- package/dist/contracts/royalty_pool/stake.js +0 -197
- package/dist/contracts/royalty_pool/stake.js.map +0 -1
- package/dist/cover.d.ts +0 -48
- package/dist/cover.d.ts.map +0 -1
- package/dist/cover.js +0 -68
- package/dist/cover.js.map +0 -1
- package/dist/credits.d.ts +0 -171
- package/dist/credits.d.ts.map +0 -1
- package/dist/credits.js +0 -360
- package/dist/credits.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/composition_credits/composition_credits.ts +0 -169
- package/src/contracts/composition_credits/composition_party_role.ts +0 -189
- package/src/contracts/composition_credits/deps/miso_credit/credit.ts +0 -27
- package/src/contracts/composition_credits/deps/sui/vec_map.ts +0 -33
- package/src/contracts/composition_royalty_pool/composition_royalty_pool.ts +0 -135
- package/src/contracts/cover_art/cover_art.ts +0 -99
- package/src/contracts/cover_art/deps/ori/walrus_data.ts +0 -36
- package/src/contracts/recording_credits/deps/miso_credit/credit.ts +0 -27
- package/src/contracts/recording_credits/deps/sui/vec_map.ts +0 -33
- package/src/contracts/recording_credits/deps/sui/vec_set.ts +0 -21
- package/src/contracts/recording_credits/recording_credits.ts +0 -458
- package/src/contracts/recording_credits/recording_party_role.ts +0 -1041
- package/src/contracts/recording_royalty_pool/recording_royalty_pool.ts +0 -138
- package/src/contracts/release_cover_art/deps/0x340057f2174fb59e4626742dd2b46c662237837b6187450cb59e4976ce7eac78/walrus_data.ts +0 -36
- package/src/contracts/release_cover_art/deps/cover_art/cover_art.ts +0 -23
- package/src/contracts/release_cover_art/deps/per_track/per_track.ts +0 -36
- package/src/contracts/release_cover_art/release_cover_art.ts +0 -251
- package/src/contracts/release_credits/deps/miso_credit/credit.ts +0 -27
- package/src/contracts/release_credits/deps/sui/vec_map.ts +0 -33
- package/src/contracts/release_credits/release_credits.ts +0 -156
- package/src/contracts/release_credits/release_party_role.ts +0 -87
- package/src/contracts/royalty_pool/deps/std/type_name.ts +0 -22
- package/src/contracts/royalty_pool/deps/sui/balance.ts +0 -17
- package/src/contracts/royalty_pool/deps/sui/vec_map.ts +0 -33
- package/src/contracts/royalty_pool/pool.ts +0 -577
- package/src/contracts/royalty_pool/stake.ts +0 -317
- package/src/cover.ts +0 -136
- package/src/credits.ts +0 -645
- package/src/extensions/royalty-pool.ts +0 -85
|
@@ -1,577 +0,0 @@
|
|
|
1
|
-
/**************************************************************
|
|
2
|
-
* THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
|
|
3
|
-
**************************************************************/
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Generic accumulator-based royalty distribution pool.
|
|
8
|
-
*
|
|
9
|
-
* A `RoyaltyPool<Share, Currency>` is a derived object of any UID-bearing parent.
|
|
10
|
-
* Its address is deterministically derived from `(parent_id, Currency)` — at most
|
|
11
|
-
* one pool per `(parent, Currency)` pair. The `Share` phantom identifies which
|
|
12
|
-
* share-token type can stake against the pool.
|
|
13
|
-
*
|
|
14
|
-
* Holders create a `Stake<Share>` (see `royalty_pool::stake`) and register it.
|
|
15
|
-
* Callers fund the pool by handing it a `Balance<Currency>` via `deposit`; the
|
|
16
|
-
* accumulator advances and claims pay out the per-stake proportional share since
|
|
17
|
-
* each stake's last claim.
|
|
18
|
-
*
|
|
19
|
-
* `receive_and_deposit` and `redeem_and_deposit` exist as recovery valves for
|
|
20
|
-
* funds that land directly at the pool's address — either pending `Coin<Currency>`
|
|
21
|
-
* transfers or balances credited to the pool's funds-accumulator. Both are
|
|
22
|
-
* permissionless: anyone who notices stuck funds can fold them in. The canonical
|
|
23
|
-
* funding path remains `deposit(balance)` from a higher-layer extension (e.g.
|
|
24
|
-
* `composition_royalty_distributor`) that pulls from the parent's address.
|
|
25
|
-
*/
|
|
26
|
-
|
|
27
|
-
import { MoveStruct, MoveTuple, normalizeMoveArguments, type RawTransactionArgument } from '../utils/index.js';
|
|
28
|
-
import { bcs } from '@mysten/sui/bcs';
|
|
29
|
-
import { type Transaction, type TransactionArgument } from '@mysten/sui/transactions';
|
|
30
|
-
import * as balance_1 from './deps/sui/balance.js';
|
|
31
|
-
const $moduleName = '@local-pkg/royalty_pool::pool';
|
|
32
|
-
export const RoyaltyPool = new MoveStruct({ name: `${$moduleName}::RoyaltyPool<phantom Share, phantom Currency>`, fields: {
|
|
33
|
-
id: bcs.Address,
|
|
34
|
-
balance: balance_1.Balance,
|
|
35
|
-
staked_shares: bcs.u64(),
|
|
36
|
-
cumulative_reward_per_share: bcs.u256(),
|
|
37
|
-
/**
|
|
38
|
-
* Lifetime sum of every deposited value, in currency base units. Read-only
|
|
39
|
-
* analytics — never decremented; not used by any on-chain logic.
|
|
40
|
-
*/
|
|
41
|
-
cumulative_deposits: bcs.u128()
|
|
42
|
-
} });
|
|
43
|
-
export const RoyaltyPoolKey = new MoveTuple({ name: `${$moduleName}::RoyaltyPoolKey<phantom Currency>`, fields: [bcs.bool()] });
|
|
44
|
-
export const RoyaltyPoolCreatedEvent = new MoveStruct({ name: `${$moduleName}::RoyaltyPoolCreatedEvent<phantom Share, phantom Currency>`, fields: {
|
|
45
|
-
pool_id: bcs.Address,
|
|
46
|
-
parent_id: bcs.Address
|
|
47
|
-
} });
|
|
48
|
-
export const RoyaltyDepositedEvent = new MoveStruct({ name: `${$moduleName}::RoyaltyDepositedEvent<phantom Share, phantom Currency>`, fields: {
|
|
49
|
-
pool_id: bcs.Address,
|
|
50
|
-
value: bcs.u64()
|
|
51
|
-
} });
|
|
52
|
-
export const StakeRegisteredEvent = new MoveStruct({ name: `${$moduleName}::StakeRegisteredEvent<phantom Share, phantom Currency>`, fields: {
|
|
53
|
-
pool_id: bcs.Address,
|
|
54
|
-
stake_id: bcs.Address,
|
|
55
|
-
staked_amount: bcs.u64()
|
|
56
|
-
} });
|
|
57
|
-
export const StakeUnregisteredEvent = new MoveStruct({ name: `${$moduleName}::StakeUnregisteredEvent<phantom Share, phantom Currency>`, fields: {
|
|
58
|
-
pool_id: bcs.Address,
|
|
59
|
-
stake_id: bcs.Address,
|
|
60
|
-
unstaked_amount: bcs.u64()
|
|
61
|
-
} });
|
|
62
|
-
export const RoyaltyClaimedEvent = new MoveStruct({ name: `${$moduleName}::RoyaltyClaimedEvent<phantom Share, phantom Currency>`, fields: {
|
|
63
|
-
pool_id: bcs.Address,
|
|
64
|
-
stake_id: bcs.Address,
|
|
65
|
-
reward_amount: bcs.u64()
|
|
66
|
-
} });
|
|
67
|
-
export interface NewArguments {
|
|
68
|
-
parent: RawTransactionArgument<string>;
|
|
69
|
-
}
|
|
70
|
-
export interface NewOptions {
|
|
71
|
-
package?: string;
|
|
72
|
-
arguments: NewArguments | [
|
|
73
|
-
parent: RawTransactionArgument<string>
|
|
74
|
-
];
|
|
75
|
-
typeArguments: [
|
|
76
|
-
string,
|
|
77
|
-
string
|
|
78
|
-
];
|
|
79
|
-
}
|
|
80
|
-
/**
|
|
81
|
-
* Construct a pool as a derived object of `parent`. The derivation key includes
|
|
82
|
-
* only the `Currency` `TypeName`, so the pool's address is determined entirely by
|
|
83
|
-
* `(parent_id, Currency)`.
|
|
84
|
-
*
|
|
85
|
-
* Cap-gating happens at the parent: callers must obtain `&mut UID` via whatever
|
|
86
|
-
* cap-gated accessor the parent exposes.
|
|
87
|
-
*/
|
|
88
|
-
export function _new(options: NewOptions) {
|
|
89
|
-
const packageAddress = options.package ?? '@local-pkg/royalty_pool';
|
|
90
|
-
const argumentsTypes = [
|
|
91
|
-
'0x2::object::ID'
|
|
92
|
-
] satisfies (string | null)[];
|
|
93
|
-
const parameterNames = ["parent"];
|
|
94
|
-
return (tx: Transaction) => tx.moveCall({
|
|
95
|
-
package: packageAddress,
|
|
96
|
-
module: 'pool',
|
|
97
|
-
function: 'new',
|
|
98
|
-
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
99
|
-
typeArguments: options.typeArguments
|
|
100
|
-
});
|
|
101
|
-
}
|
|
102
|
-
export interface ShareArguments {
|
|
103
|
-
self: RawTransactionArgument<string>;
|
|
104
|
-
}
|
|
105
|
-
export interface ShareOptions {
|
|
106
|
-
package?: string;
|
|
107
|
-
arguments: ShareArguments | [
|
|
108
|
-
self: RawTransactionArgument<string>
|
|
109
|
-
];
|
|
110
|
-
typeArguments: [
|
|
111
|
-
string,
|
|
112
|
-
string
|
|
113
|
-
];
|
|
114
|
-
}
|
|
115
|
-
/** Share the pool object so holders can register and claim against it. */
|
|
116
|
-
export function share(options: ShareOptions) {
|
|
117
|
-
const packageAddress = options.package ?? '@local-pkg/royalty_pool';
|
|
118
|
-
const argumentsTypes = [
|
|
119
|
-
null
|
|
120
|
-
] satisfies (string | null)[];
|
|
121
|
-
const parameterNames = ["self"];
|
|
122
|
-
return (tx: Transaction) => tx.moveCall({
|
|
123
|
-
package: packageAddress,
|
|
124
|
-
module: 'pool',
|
|
125
|
-
function: 'share',
|
|
126
|
-
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
127
|
-
typeArguments: options.typeArguments
|
|
128
|
-
});
|
|
129
|
-
}
|
|
130
|
-
export interface DepositArguments {
|
|
131
|
-
self: RawTransactionArgument<string>;
|
|
132
|
-
balance: TransactionArgument;
|
|
133
|
-
}
|
|
134
|
-
export interface DepositOptions {
|
|
135
|
-
package?: string;
|
|
136
|
-
arguments: DepositArguments | [
|
|
137
|
-
self: RawTransactionArgument<string>,
|
|
138
|
-
balance: TransactionArgument
|
|
139
|
-
];
|
|
140
|
-
typeArguments: [
|
|
141
|
-
string,
|
|
142
|
-
string
|
|
143
|
-
];
|
|
144
|
-
}
|
|
145
|
-
/**
|
|
146
|
-
* Fold a balance into the accumulator. Aborts on zero staked shares (the deposit
|
|
147
|
-
* would be unattributable) or zero value (no-op deposits are rejected to keep
|
|
148
|
-
* events meaningful).
|
|
149
|
-
*
|
|
150
|
-
* Callers obtain the `Balance<Currency>` however they like — typically by pulling
|
|
151
|
-
* from a parent's pending coins or funds accumulator (see e.g.
|
|
152
|
-
* `composition_royalty_distributor`).
|
|
153
|
-
*/
|
|
154
|
-
export function deposit(options: DepositOptions) {
|
|
155
|
-
const packageAddress = options.package ?? '@local-pkg/royalty_pool';
|
|
156
|
-
const argumentsTypes = [
|
|
157
|
-
null,
|
|
158
|
-
null
|
|
159
|
-
] satisfies (string | null)[];
|
|
160
|
-
const parameterNames = ["self", "balance"];
|
|
161
|
-
return (tx: Transaction) => tx.moveCall({
|
|
162
|
-
package: packageAddress,
|
|
163
|
-
module: 'pool',
|
|
164
|
-
function: 'deposit',
|
|
165
|
-
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
166
|
-
typeArguments: options.typeArguments
|
|
167
|
-
});
|
|
168
|
-
}
|
|
169
|
-
export interface ReceiveAndDepositArguments {
|
|
170
|
-
self: RawTransactionArgument<string>;
|
|
171
|
-
coins: TransactionArgument;
|
|
172
|
-
}
|
|
173
|
-
export interface ReceiveAndDepositOptions {
|
|
174
|
-
package?: string;
|
|
175
|
-
arguments: ReceiveAndDepositArguments | [
|
|
176
|
-
self: RawTransactionArgument<string>,
|
|
177
|
-
coins: TransactionArgument
|
|
178
|
-
];
|
|
179
|
-
typeArguments: [
|
|
180
|
-
string,
|
|
181
|
-
string
|
|
182
|
-
];
|
|
183
|
-
}
|
|
184
|
-
/**
|
|
185
|
-
* Receive `Coin<Currency>` objects sent directly to this pool's address and fold
|
|
186
|
-
* them into the accumulator. Recovery path for funds delivered to the pool's
|
|
187
|
-
* address rather than via the canonical extension path.
|
|
188
|
-
*/
|
|
189
|
-
export function receiveAndDeposit(options: ReceiveAndDepositOptions) {
|
|
190
|
-
const packageAddress = options.package ?? '@local-pkg/royalty_pool';
|
|
191
|
-
const argumentsTypes = [
|
|
192
|
-
null,
|
|
193
|
-
'vector<null>'
|
|
194
|
-
] satisfies (string | null)[];
|
|
195
|
-
const parameterNames = ["self", "coins"];
|
|
196
|
-
return (tx: Transaction) => tx.moveCall({
|
|
197
|
-
package: packageAddress,
|
|
198
|
-
module: 'pool',
|
|
199
|
-
function: 'receive_and_deposit',
|
|
200
|
-
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
201
|
-
typeArguments: options.typeArguments
|
|
202
|
-
});
|
|
203
|
-
}
|
|
204
|
-
export interface RedeemAndDepositArguments {
|
|
205
|
-
self: RawTransactionArgument<string>;
|
|
206
|
-
value: RawTransactionArgument<number | bigint>;
|
|
207
|
-
}
|
|
208
|
-
export interface RedeemAndDepositOptions {
|
|
209
|
-
package?: string;
|
|
210
|
-
arguments: RedeemAndDepositArguments | [
|
|
211
|
-
self: RawTransactionArgument<string>,
|
|
212
|
-
value: RawTransactionArgument<number | bigint>
|
|
213
|
-
];
|
|
214
|
-
typeArguments: [
|
|
215
|
-
string,
|
|
216
|
-
string
|
|
217
|
-
];
|
|
218
|
-
}
|
|
219
|
-
/**
|
|
220
|
-
* Redeem `value` base units from the pool's funds-accumulator and fold them into
|
|
221
|
-
* the accumulator. Recovery path for funds delivered via Sui's `send_funds`
|
|
222
|
-
* mechanism rather than via the canonical extension path.
|
|
223
|
-
*/
|
|
224
|
-
export function redeemAndDeposit(options: RedeemAndDepositOptions) {
|
|
225
|
-
const packageAddress = options.package ?? '@local-pkg/royalty_pool';
|
|
226
|
-
const argumentsTypes = [
|
|
227
|
-
null,
|
|
228
|
-
'u64'
|
|
229
|
-
] satisfies (string | null)[];
|
|
230
|
-
const parameterNames = ["self", "value"];
|
|
231
|
-
return (tx: Transaction) => tx.moveCall({
|
|
232
|
-
package: packageAddress,
|
|
233
|
-
module: 'pool',
|
|
234
|
-
function: 'redeem_and_deposit',
|
|
235
|
-
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
236
|
-
typeArguments: options.typeArguments
|
|
237
|
-
});
|
|
238
|
-
}
|
|
239
|
-
export interface RegisterStakeArguments {
|
|
240
|
-
self: RawTransactionArgument<string>;
|
|
241
|
-
stake: RawTransactionArgument<string>;
|
|
242
|
-
}
|
|
243
|
-
export interface RegisterStakeOptions {
|
|
244
|
-
package?: string;
|
|
245
|
-
arguments: RegisterStakeArguments | [
|
|
246
|
-
self: RawTransactionArgument<string>,
|
|
247
|
-
stake: RawTransactionArgument<string>
|
|
248
|
-
];
|
|
249
|
-
typeArguments: [
|
|
250
|
-
string,
|
|
251
|
-
string
|
|
252
|
-
];
|
|
253
|
-
}
|
|
254
|
-
/**
|
|
255
|
-
* Register a stake with the pool. Records the stake's entry index so future
|
|
256
|
-
* deposits accrue to it proportionally.
|
|
257
|
-
*
|
|
258
|
-
* Aborts if the stake is already registered with a pool of the same Currency.
|
|
259
|
-
*/
|
|
260
|
-
export function registerStake(options: RegisterStakeOptions) {
|
|
261
|
-
const packageAddress = options.package ?? '@local-pkg/royalty_pool';
|
|
262
|
-
const argumentsTypes = [
|
|
263
|
-
null,
|
|
264
|
-
null
|
|
265
|
-
] satisfies (string | null)[];
|
|
266
|
-
const parameterNames = ["self", "stake"];
|
|
267
|
-
return (tx: Transaction) => tx.moveCall({
|
|
268
|
-
package: packageAddress,
|
|
269
|
-
module: 'pool',
|
|
270
|
-
function: 'register_stake',
|
|
271
|
-
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
272
|
-
typeArguments: options.typeArguments
|
|
273
|
-
});
|
|
274
|
-
}
|
|
275
|
-
export interface UnregisterStakeArguments {
|
|
276
|
-
self: RawTransactionArgument<string>;
|
|
277
|
-
stake: RawTransactionArgument<string>;
|
|
278
|
-
}
|
|
279
|
-
export interface UnregisterStakeOptions {
|
|
280
|
-
package?: string;
|
|
281
|
-
arguments: UnregisterStakeArguments | [
|
|
282
|
-
self: RawTransactionArgument<string>,
|
|
283
|
-
stake: RawTransactionArgument<string>
|
|
284
|
-
];
|
|
285
|
-
typeArguments: [
|
|
286
|
-
string,
|
|
287
|
-
string
|
|
288
|
-
];
|
|
289
|
-
}
|
|
290
|
-
/**
|
|
291
|
-
* Unregister a stake from the pool. All claimable rewards must be drained first —
|
|
292
|
-
* i.e., a final `claim_rewards` call must yield 0. Sub-base-unit residue in
|
|
293
|
-
* `last_claim_index` (left by the consumed-index advance when a reward truncated
|
|
294
|
-
* to 0) does NOT block unregister, since that residue could never be claimed as a
|
|
295
|
-
* whole base unit anyway. Forfeiting it on exit is the deliberate semantics.
|
|
296
|
-
*/
|
|
297
|
-
export function unregisterStake(options: UnregisterStakeOptions) {
|
|
298
|
-
const packageAddress = options.package ?? '@local-pkg/royalty_pool';
|
|
299
|
-
const argumentsTypes = [
|
|
300
|
-
null,
|
|
301
|
-
null
|
|
302
|
-
] satisfies (string | null)[];
|
|
303
|
-
const parameterNames = ["self", "stake"];
|
|
304
|
-
return (tx: Transaction) => tx.moveCall({
|
|
305
|
-
package: packageAddress,
|
|
306
|
-
module: 'pool',
|
|
307
|
-
function: 'unregister_stake',
|
|
308
|
-
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
309
|
-
typeArguments: options.typeArguments
|
|
310
|
-
});
|
|
311
|
-
}
|
|
312
|
-
export interface ClaimRewardsArguments {
|
|
313
|
-
self: RawTransactionArgument<string>;
|
|
314
|
-
stake: RawTransactionArgument<string>;
|
|
315
|
-
}
|
|
316
|
-
export interface ClaimRewardsOptions {
|
|
317
|
-
package?: string;
|
|
318
|
-
arguments: ClaimRewardsArguments | [
|
|
319
|
-
self: RawTransactionArgument<string>,
|
|
320
|
-
stake: RawTransactionArgument<string>
|
|
321
|
-
];
|
|
322
|
-
typeArguments: [
|
|
323
|
-
string,
|
|
324
|
-
string
|
|
325
|
-
];
|
|
326
|
-
}
|
|
327
|
-
/**
|
|
328
|
-
* Claim accrued rewards for a registered stake. Advances the stake's
|
|
329
|
-
* `last_claim_index` to the pool's current accumulator.
|
|
330
|
-
*/
|
|
331
|
-
export function claimRewards(options: ClaimRewardsOptions) {
|
|
332
|
-
const packageAddress = options.package ?? '@local-pkg/royalty_pool';
|
|
333
|
-
const argumentsTypes = [
|
|
334
|
-
null,
|
|
335
|
-
null
|
|
336
|
-
] satisfies (string | null)[];
|
|
337
|
-
const parameterNames = ["self", "stake"];
|
|
338
|
-
return (tx: Transaction) => tx.moveCall({
|
|
339
|
-
package: packageAddress,
|
|
340
|
-
module: 'pool',
|
|
341
|
-
function: 'claim_rewards',
|
|
342
|
-
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
343
|
-
typeArguments: options.typeArguments
|
|
344
|
-
});
|
|
345
|
-
}
|
|
346
|
-
export interface PendingRewardsArguments {
|
|
347
|
-
self: RawTransactionArgument<string>;
|
|
348
|
-
stake: RawTransactionArgument<string>;
|
|
349
|
-
}
|
|
350
|
-
export interface PendingRewardsOptions {
|
|
351
|
-
package?: string;
|
|
352
|
-
arguments: PendingRewardsArguments | [
|
|
353
|
-
self: RawTransactionArgument<string>,
|
|
354
|
-
stake: RawTransactionArgument<string>
|
|
355
|
-
];
|
|
356
|
-
typeArguments: [
|
|
357
|
-
string,
|
|
358
|
-
string
|
|
359
|
-
];
|
|
360
|
-
}
|
|
361
|
-
/**
|
|
362
|
-
* Compute pending rewards for a stake without claiming. Returns 0 if the stake is
|
|
363
|
-
* not registered with this pool.
|
|
364
|
-
*/
|
|
365
|
-
export function pendingRewards(options: PendingRewardsOptions) {
|
|
366
|
-
const packageAddress = options.package ?? '@local-pkg/royalty_pool';
|
|
367
|
-
const argumentsTypes = [
|
|
368
|
-
null,
|
|
369
|
-
null
|
|
370
|
-
] satisfies (string | null)[];
|
|
371
|
-
const parameterNames = ["self", "stake"];
|
|
372
|
-
return (tx: Transaction) => tx.moveCall({
|
|
373
|
-
package: packageAddress,
|
|
374
|
-
module: 'pool',
|
|
375
|
-
function: 'pending_rewards',
|
|
376
|
-
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
377
|
-
typeArguments: options.typeArguments
|
|
378
|
-
});
|
|
379
|
-
}
|
|
380
|
-
export interface IdArguments {
|
|
381
|
-
self: RawTransactionArgument<string>;
|
|
382
|
-
}
|
|
383
|
-
export interface IdOptions {
|
|
384
|
-
package?: string;
|
|
385
|
-
arguments: IdArguments | [
|
|
386
|
-
self: RawTransactionArgument<string>
|
|
387
|
-
];
|
|
388
|
-
typeArguments: [
|
|
389
|
-
string,
|
|
390
|
-
string
|
|
391
|
-
];
|
|
392
|
-
}
|
|
393
|
-
export function id(options: IdOptions) {
|
|
394
|
-
const packageAddress = options.package ?? '@local-pkg/royalty_pool';
|
|
395
|
-
const argumentsTypes = [
|
|
396
|
-
null
|
|
397
|
-
] satisfies (string | null)[];
|
|
398
|
-
const parameterNames = ["self"];
|
|
399
|
-
return (tx: Transaction) => tx.moveCall({
|
|
400
|
-
package: packageAddress,
|
|
401
|
-
module: 'pool',
|
|
402
|
-
function: 'id',
|
|
403
|
-
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
404
|
-
typeArguments: options.typeArguments
|
|
405
|
-
});
|
|
406
|
-
}
|
|
407
|
-
export interface BalanceArguments {
|
|
408
|
-
self: RawTransactionArgument<string>;
|
|
409
|
-
}
|
|
410
|
-
export interface BalanceOptions {
|
|
411
|
-
package?: string;
|
|
412
|
-
arguments: BalanceArguments | [
|
|
413
|
-
self: RawTransactionArgument<string>
|
|
414
|
-
];
|
|
415
|
-
typeArguments: [
|
|
416
|
-
string,
|
|
417
|
-
string
|
|
418
|
-
];
|
|
419
|
-
}
|
|
420
|
-
export function balance(options: BalanceOptions) {
|
|
421
|
-
const packageAddress = options.package ?? '@local-pkg/royalty_pool';
|
|
422
|
-
const argumentsTypes = [
|
|
423
|
-
null
|
|
424
|
-
] satisfies (string | null)[];
|
|
425
|
-
const parameterNames = ["self"];
|
|
426
|
-
return (tx: Transaction) => tx.moveCall({
|
|
427
|
-
package: packageAddress,
|
|
428
|
-
module: 'pool',
|
|
429
|
-
function: 'balance',
|
|
430
|
-
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
431
|
-
typeArguments: options.typeArguments
|
|
432
|
-
});
|
|
433
|
-
}
|
|
434
|
-
export interface StakedSharesArguments {
|
|
435
|
-
self: RawTransactionArgument<string>;
|
|
436
|
-
}
|
|
437
|
-
export interface StakedSharesOptions {
|
|
438
|
-
package?: string;
|
|
439
|
-
arguments: StakedSharesArguments | [
|
|
440
|
-
self: RawTransactionArgument<string>
|
|
441
|
-
];
|
|
442
|
-
typeArguments: [
|
|
443
|
-
string,
|
|
444
|
-
string
|
|
445
|
-
];
|
|
446
|
-
}
|
|
447
|
-
export function stakedShares(options: StakedSharesOptions) {
|
|
448
|
-
const packageAddress = options.package ?? '@local-pkg/royalty_pool';
|
|
449
|
-
const argumentsTypes = [
|
|
450
|
-
null
|
|
451
|
-
] satisfies (string | null)[];
|
|
452
|
-
const parameterNames = ["self"];
|
|
453
|
-
return (tx: Transaction) => tx.moveCall({
|
|
454
|
-
package: packageAddress,
|
|
455
|
-
module: 'pool',
|
|
456
|
-
function: 'staked_shares',
|
|
457
|
-
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
458
|
-
typeArguments: options.typeArguments
|
|
459
|
-
});
|
|
460
|
-
}
|
|
461
|
-
export interface CumulativeRewardPerShareArguments {
|
|
462
|
-
self: RawTransactionArgument<string>;
|
|
463
|
-
}
|
|
464
|
-
export interface CumulativeRewardPerShareOptions {
|
|
465
|
-
package?: string;
|
|
466
|
-
arguments: CumulativeRewardPerShareArguments | [
|
|
467
|
-
self: RawTransactionArgument<string>
|
|
468
|
-
];
|
|
469
|
-
typeArguments: [
|
|
470
|
-
string,
|
|
471
|
-
string
|
|
472
|
-
];
|
|
473
|
-
}
|
|
474
|
-
export function cumulativeRewardPerShare(options: CumulativeRewardPerShareOptions) {
|
|
475
|
-
const packageAddress = options.package ?? '@local-pkg/royalty_pool';
|
|
476
|
-
const argumentsTypes = [
|
|
477
|
-
null
|
|
478
|
-
] satisfies (string | null)[];
|
|
479
|
-
const parameterNames = ["self"];
|
|
480
|
-
return (tx: Transaction) => tx.moveCall({
|
|
481
|
-
package: packageAddress,
|
|
482
|
-
module: 'pool',
|
|
483
|
-
function: 'cumulative_reward_per_share',
|
|
484
|
-
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
485
|
-
typeArguments: options.typeArguments
|
|
486
|
-
});
|
|
487
|
-
}
|
|
488
|
-
export interface CumulativeDepositsArguments {
|
|
489
|
-
self: RawTransactionArgument<string>;
|
|
490
|
-
}
|
|
491
|
-
export interface CumulativeDepositsOptions {
|
|
492
|
-
package?: string;
|
|
493
|
-
arguments: CumulativeDepositsArguments | [
|
|
494
|
-
self: RawTransactionArgument<string>
|
|
495
|
-
];
|
|
496
|
-
typeArguments: [
|
|
497
|
-
string,
|
|
498
|
-
string
|
|
499
|
-
];
|
|
500
|
-
}
|
|
501
|
-
/** Lifetime sum of all deposits, in currency base units. Strictly monotonic. */
|
|
502
|
-
export function cumulativeDeposits(options: CumulativeDepositsOptions) {
|
|
503
|
-
const packageAddress = options.package ?? '@local-pkg/royalty_pool';
|
|
504
|
-
const argumentsTypes = [
|
|
505
|
-
null
|
|
506
|
-
] satisfies (string | null)[];
|
|
507
|
-
const parameterNames = ["self"];
|
|
508
|
-
return (tx: Transaction) => tx.moveCall({
|
|
509
|
-
package: packageAddress,
|
|
510
|
-
module: 'pool',
|
|
511
|
-
function: 'cumulative_deposits',
|
|
512
|
-
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
513
|
-
typeArguments: options.typeArguments
|
|
514
|
-
});
|
|
515
|
-
}
|
|
516
|
-
export interface DerivedAddressArguments {
|
|
517
|
-
parentId: RawTransactionArgument<string>;
|
|
518
|
-
}
|
|
519
|
-
export interface DerivedAddressOptions {
|
|
520
|
-
package?: string;
|
|
521
|
-
arguments: DerivedAddressArguments | [
|
|
522
|
-
parentId: RawTransactionArgument<string>
|
|
523
|
-
];
|
|
524
|
-
typeArguments: [
|
|
525
|
-
string
|
|
526
|
-
];
|
|
527
|
-
}
|
|
528
|
-
/**
|
|
529
|
-
* Compute the deterministic address of a pool given its parent ID and `Currency`
|
|
530
|
-
* type parameter. Useful for off-chain derivation and for cross-module checks that
|
|
531
|
-
* the pool was minted from the expected parent.
|
|
532
|
-
*/
|
|
533
|
-
export function derivedAddress(options: DerivedAddressOptions) {
|
|
534
|
-
const packageAddress = options.package ?? '@local-pkg/royalty_pool';
|
|
535
|
-
const argumentsTypes = [
|
|
536
|
-
'0x2::object::ID'
|
|
537
|
-
] satisfies (string | null)[];
|
|
538
|
-
const parameterNames = ["parentId"];
|
|
539
|
-
return (tx: Transaction) => tx.moveCall({
|
|
540
|
-
package: packageAddress,
|
|
541
|
-
module: 'pool',
|
|
542
|
-
function: 'derived_address',
|
|
543
|
-
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
544
|
-
typeArguments: options.typeArguments
|
|
545
|
-
});
|
|
546
|
-
}
|
|
547
|
-
export interface AssertDerivedFromArguments {
|
|
548
|
-
self: RawTransactionArgument<string>;
|
|
549
|
-
parentId: RawTransactionArgument<string>;
|
|
550
|
-
}
|
|
551
|
-
export interface AssertDerivedFromOptions {
|
|
552
|
-
package?: string;
|
|
553
|
-
arguments: AssertDerivedFromArguments | [
|
|
554
|
-
self: RawTransactionArgument<string>,
|
|
555
|
-
parentId: RawTransactionArgument<string>
|
|
556
|
-
];
|
|
557
|
-
typeArguments: [
|
|
558
|
-
string,
|
|
559
|
-
string
|
|
560
|
-
];
|
|
561
|
-
}
|
|
562
|
-
/** Read-only verification that the pool was derived from the given parent ID. */
|
|
563
|
-
export function assertDerivedFrom(options: AssertDerivedFromOptions) {
|
|
564
|
-
const packageAddress = options.package ?? '@local-pkg/royalty_pool';
|
|
565
|
-
const argumentsTypes = [
|
|
566
|
-
null,
|
|
567
|
-
'0x2::object::ID'
|
|
568
|
-
] satisfies (string | null)[];
|
|
569
|
-
const parameterNames = ["self", "parentId"];
|
|
570
|
-
return (tx: Transaction) => tx.moveCall({
|
|
571
|
-
package: packageAddress,
|
|
572
|
-
module: 'pool',
|
|
573
|
-
function: 'assert_derived_from',
|
|
574
|
-
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
575
|
-
typeArguments: options.typeArguments
|
|
576
|
-
});
|
|
577
|
-
}
|