@misonetwork/sdk 0.2.2 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +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 +7 -3
- package/dist/internal.d.ts.map +1 -1
- package/dist/internal.js +22 -4
- package/dist/internal.js.map +1 -1
- package/dist/queries.d.ts +8 -0
- package/dist/queries.d.ts.map +1 -1
- package/dist/queries.js +30 -8
- 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 +34 -15
- package/src/queries.ts +40 -12
- 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,317 +0,0 @@
|
|
|
1
|
-
/**************************************************************
|
|
2
|
-
* THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
|
|
3
|
-
**************************************************************/
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* A position holding share tokens registered against a `RoyaltyPool`.
|
|
8
|
-
*
|
|
9
|
-
* Stakes are owned objects with an immutable balance — to increase a holder's
|
|
10
|
-
* total staked amount, mint additional Stake objects rather than modify an
|
|
11
|
-
* existing one. This mirrors Sui's native staking model.
|
|
12
|
-
*
|
|
13
|
-
* Each stake tracks the royalty pools it is currently registered with via an
|
|
14
|
-
* inline `VecMap<TypeName, Registration>`, keyed by the pool's `Currency`
|
|
15
|
-
* `TypeName`. The stake cannot be destroyed while any registrations remain. Pool
|
|
16
|
-
* registrations are mutated by `royalty_pool::pool` through the package-private
|
|
17
|
-
* accessors below.
|
|
18
|
-
*/
|
|
19
|
-
|
|
20
|
-
import { MoveStruct, normalizeMoveArguments, type RawTransactionArgument } from '../utils/index.js';
|
|
21
|
-
import { bcs } from '@mysten/sui/bcs';
|
|
22
|
-
import { type Transaction, type TransactionArgument } from '@mysten/sui/transactions';
|
|
23
|
-
import * as balance_1 from './deps/sui/balance.js';
|
|
24
|
-
import * as vec_map from './deps/sui/vec_map.js';
|
|
25
|
-
import * as type_name from './deps/std/type_name.js';
|
|
26
|
-
const $moduleName = '@local-pkg/royalty_pool::stake';
|
|
27
|
-
export const Registration = new MoveStruct({ name: `${$moduleName}::Registration`, fields: {
|
|
28
|
-
pool_id: bcs.Address,
|
|
29
|
-
last_claim_index: bcs.u256()
|
|
30
|
-
} });
|
|
31
|
-
export const Stake = new MoveStruct({ name: `${$moduleName}::Stake<phantom Share>`, fields: {
|
|
32
|
-
id: bcs.Address,
|
|
33
|
-
/** The staked balance. Immutable after creation. */
|
|
34
|
-
balance: balance_1.Balance,
|
|
35
|
-
/**
|
|
36
|
-
* Active royalty-pool registrations, keyed by `Currency` `TypeName`. Must be empty
|
|
37
|
-
* to destroy.
|
|
38
|
-
*/
|
|
39
|
-
registrations: vec_map.VecMap(type_name.TypeName, Registration)
|
|
40
|
-
} });
|
|
41
|
-
export const StakeCreatedEvent = new MoveStruct({ name: `${$moduleName}::StakeCreatedEvent<phantom Share>`, fields: {
|
|
42
|
-
stake_id: bcs.Address,
|
|
43
|
-
amount: bcs.u64()
|
|
44
|
-
} });
|
|
45
|
-
export const StakeDestroyedEvent = new MoveStruct({ name: `${$moduleName}::StakeDestroyedEvent<phantom Share>`, fields: {
|
|
46
|
-
stake_id: bcs.Address,
|
|
47
|
-
amount: bcs.u64()
|
|
48
|
-
} });
|
|
49
|
-
export interface NewArguments {
|
|
50
|
-
balance: TransactionArgument;
|
|
51
|
-
}
|
|
52
|
-
export interface NewOptions {
|
|
53
|
-
package?: string;
|
|
54
|
-
arguments: NewArguments | [
|
|
55
|
-
balance: TransactionArgument
|
|
56
|
-
];
|
|
57
|
-
typeArguments: [
|
|
58
|
-
string
|
|
59
|
-
];
|
|
60
|
-
}
|
|
61
|
-
/**
|
|
62
|
-
* Create a new stake with the given balance.
|
|
63
|
-
*
|
|
64
|
-
* Aborts if `balance` is zero.
|
|
65
|
-
*/
|
|
66
|
-
export function _new(options: NewOptions) {
|
|
67
|
-
const packageAddress = options.package ?? '@local-pkg/royalty_pool';
|
|
68
|
-
const argumentsTypes = [
|
|
69
|
-
null
|
|
70
|
-
] satisfies (string | null)[];
|
|
71
|
-
const parameterNames = ["balance"];
|
|
72
|
-
return (tx: Transaction) => tx.moveCall({
|
|
73
|
-
package: packageAddress,
|
|
74
|
-
module: 'stake',
|
|
75
|
-
function: 'new',
|
|
76
|
-
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
77
|
-
typeArguments: options.typeArguments
|
|
78
|
-
});
|
|
79
|
-
}
|
|
80
|
-
export interface DestroyArguments {
|
|
81
|
-
stake: RawTransactionArgument<string>;
|
|
82
|
-
}
|
|
83
|
-
export interface DestroyOptions {
|
|
84
|
-
package?: string;
|
|
85
|
-
arguments: DestroyArguments | [
|
|
86
|
-
stake: RawTransactionArgument<string>
|
|
87
|
-
];
|
|
88
|
-
typeArguments: [
|
|
89
|
-
string
|
|
90
|
-
];
|
|
91
|
-
}
|
|
92
|
-
/**
|
|
93
|
-
* Destroy a stake and reclaim its balance.
|
|
94
|
-
*
|
|
95
|
-
* Aborts if the stake is still registered with any royalty pools.
|
|
96
|
-
*/
|
|
97
|
-
export function destroy(options: DestroyOptions) {
|
|
98
|
-
const packageAddress = options.package ?? '@local-pkg/royalty_pool';
|
|
99
|
-
const argumentsTypes = [
|
|
100
|
-
null
|
|
101
|
-
] satisfies (string | null)[];
|
|
102
|
-
const parameterNames = ["stake"];
|
|
103
|
-
return (tx: Transaction) => tx.moveCall({
|
|
104
|
-
package: packageAddress,
|
|
105
|
-
module: 'stake',
|
|
106
|
-
function: 'destroy',
|
|
107
|
-
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
108
|
-
typeArguments: options.typeArguments
|
|
109
|
-
});
|
|
110
|
-
}
|
|
111
|
-
export interface IdArguments {
|
|
112
|
-
self: RawTransactionArgument<string>;
|
|
113
|
-
}
|
|
114
|
-
export interface IdOptions {
|
|
115
|
-
package?: string;
|
|
116
|
-
arguments: IdArguments | [
|
|
117
|
-
self: RawTransactionArgument<string>
|
|
118
|
-
];
|
|
119
|
-
typeArguments: [
|
|
120
|
-
string
|
|
121
|
-
];
|
|
122
|
-
}
|
|
123
|
-
export function id(options: IdOptions) {
|
|
124
|
-
const packageAddress = options.package ?? '@local-pkg/royalty_pool';
|
|
125
|
-
const argumentsTypes = [
|
|
126
|
-
null
|
|
127
|
-
] satisfies (string | null)[];
|
|
128
|
-
const parameterNames = ["self"];
|
|
129
|
-
return (tx: Transaction) => tx.moveCall({
|
|
130
|
-
package: packageAddress,
|
|
131
|
-
module: 'stake',
|
|
132
|
-
function: 'id',
|
|
133
|
-
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
134
|
-
typeArguments: options.typeArguments
|
|
135
|
-
});
|
|
136
|
-
}
|
|
137
|
-
export interface BalanceArguments {
|
|
138
|
-
self: RawTransactionArgument<string>;
|
|
139
|
-
}
|
|
140
|
-
export interface BalanceOptions {
|
|
141
|
-
package?: string;
|
|
142
|
-
arguments: BalanceArguments | [
|
|
143
|
-
self: RawTransactionArgument<string>
|
|
144
|
-
];
|
|
145
|
-
typeArguments: [
|
|
146
|
-
string
|
|
147
|
-
];
|
|
148
|
-
}
|
|
149
|
-
export function balance(options: BalanceOptions) {
|
|
150
|
-
const packageAddress = options.package ?? '@local-pkg/royalty_pool';
|
|
151
|
-
const argumentsTypes = [
|
|
152
|
-
null
|
|
153
|
-
] satisfies (string | null)[];
|
|
154
|
-
const parameterNames = ["self"];
|
|
155
|
-
return (tx: Transaction) => tx.moveCall({
|
|
156
|
-
package: packageAddress,
|
|
157
|
-
module: 'stake',
|
|
158
|
-
function: 'balance',
|
|
159
|
-
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
160
|
-
typeArguments: options.typeArguments
|
|
161
|
-
});
|
|
162
|
-
}
|
|
163
|
-
export interface ValueArguments {
|
|
164
|
-
self: RawTransactionArgument<string>;
|
|
165
|
-
}
|
|
166
|
-
export interface ValueOptions {
|
|
167
|
-
package?: string;
|
|
168
|
-
arguments: ValueArguments | [
|
|
169
|
-
self: RawTransactionArgument<string>
|
|
170
|
-
];
|
|
171
|
-
typeArguments: [
|
|
172
|
-
string
|
|
173
|
-
];
|
|
174
|
-
}
|
|
175
|
-
export function value(options: ValueOptions) {
|
|
176
|
-
const packageAddress = options.package ?? '@local-pkg/royalty_pool';
|
|
177
|
-
const argumentsTypes = [
|
|
178
|
-
null
|
|
179
|
-
] satisfies (string | null)[];
|
|
180
|
-
const parameterNames = ["self"];
|
|
181
|
-
return (tx: Transaction) => tx.moveCall({
|
|
182
|
-
package: packageAddress,
|
|
183
|
-
module: 'stake',
|
|
184
|
-
function: 'value',
|
|
185
|
-
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
186
|
-
typeArguments: options.typeArguments
|
|
187
|
-
});
|
|
188
|
-
}
|
|
189
|
-
export interface RegistrationCountArguments {
|
|
190
|
-
self: RawTransactionArgument<string>;
|
|
191
|
-
}
|
|
192
|
-
export interface RegistrationCountOptions {
|
|
193
|
-
package?: string;
|
|
194
|
-
arguments: RegistrationCountArguments | [
|
|
195
|
-
self: RawTransactionArgument<string>
|
|
196
|
-
];
|
|
197
|
-
typeArguments: [
|
|
198
|
-
string
|
|
199
|
-
];
|
|
200
|
-
}
|
|
201
|
-
/** Number of royalty pools this stake is currently registered with. */
|
|
202
|
-
export function registrationCount(options: RegistrationCountOptions) {
|
|
203
|
-
const packageAddress = options.package ?? '@local-pkg/royalty_pool';
|
|
204
|
-
const argumentsTypes = [
|
|
205
|
-
null
|
|
206
|
-
] satisfies (string | null)[];
|
|
207
|
-
const parameterNames = ["self"];
|
|
208
|
-
return (tx: Transaction) => tx.moveCall({
|
|
209
|
-
package: packageAddress,
|
|
210
|
-
module: 'stake',
|
|
211
|
-
function: 'registration_count',
|
|
212
|
-
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
213
|
-
typeArguments: options.typeArguments
|
|
214
|
-
});
|
|
215
|
-
}
|
|
216
|
-
export interface HasRegistrationArguments {
|
|
217
|
-
self: RawTransactionArgument<string>;
|
|
218
|
-
currency: TransactionArgument;
|
|
219
|
-
}
|
|
220
|
-
export interface HasRegistrationOptions {
|
|
221
|
-
package?: string;
|
|
222
|
-
arguments: HasRegistrationArguments | [
|
|
223
|
-
self: RawTransactionArgument<string>,
|
|
224
|
-
currency: TransactionArgument
|
|
225
|
-
];
|
|
226
|
-
typeArguments: [
|
|
227
|
-
string
|
|
228
|
-
];
|
|
229
|
-
}
|
|
230
|
-
export function hasRegistration(options: HasRegistrationOptions) {
|
|
231
|
-
const packageAddress = options.package ?? '@local-pkg/royalty_pool';
|
|
232
|
-
const argumentsTypes = [
|
|
233
|
-
null,
|
|
234
|
-
null
|
|
235
|
-
] satisfies (string | null)[];
|
|
236
|
-
const parameterNames = ["self", "currency"];
|
|
237
|
-
return (tx: Transaction) => tx.moveCall({
|
|
238
|
-
package: packageAddress,
|
|
239
|
-
module: 'stake',
|
|
240
|
-
function: 'has_registration',
|
|
241
|
-
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
242
|
-
typeArguments: options.typeArguments
|
|
243
|
-
});
|
|
244
|
-
}
|
|
245
|
-
export interface GetRegistrationArguments {
|
|
246
|
-
self: RawTransactionArgument<string>;
|
|
247
|
-
currency: TransactionArgument;
|
|
248
|
-
}
|
|
249
|
-
export interface GetRegistrationOptions {
|
|
250
|
-
package?: string;
|
|
251
|
-
arguments: GetRegistrationArguments | [
|
|
252
|
-
self: RawTransactionArgument<string>,
|
|
253
|
-
currency: TransactionArgument
|
|
254
|
-
];
|
|
255
|
-
typeArguments: [
|
|
256
|
-
string
|
|
257
|
-
];
|
|
258
|
-
}
|
|
259
|
-
export function getRegistration(options: GetRegistrationOptions) {
|
|
260
|
-
const packageAddress = options.package ?? '@local-pkg/royalty_pool';
|
|
261
|
-
const argumentsTypes = [
|
|
262
|
-
null,
|
|
263
|
-
null
|
|
264
|
-
] satisfies (string | null)[];
|
|
265
|
-
const parameterNames = ["self", "currency"];
|
|
266
|
-
return (tx: Transaction) => tx.moveCall({
|
|
267
|
-
package: packageAddress,
|
|
268
|
-
module: 'stake',
|
|
269
|
-
function: 'get_registration',
|
|
270
|
-
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
271
|
-
typeArguments: options.typeArguments
|
|
272
|
-
});
|
|
273
|
-
}
|
|
274
|
-
export interface RegistrationPoolIdArguments {
|
|
275
|
-
r: TransactionArgument;
|
|
276
|
-
}
|
|
277
|
-
export interface RegistrationPoolIdOptions {
|
|
278
|
-
package?: string;
|
|
279
|
-
arguments: RegistrationPoolIdArguments | [
|
|
280
|
-
r: TransactionArgument
|
|
281
|
-
];
|
|
282
|
-
}
|
|
283
|
-
export function registrationPoolId(options: RegistrationPoolIdOptions) {
|
|
284
|
-
const packageAddress = options.package ?? '@local-pkg/royalty_pool';
|
|
285
|
-
const argumentsTypes = [
|
|
286
|
-
null
|
|
287
|
-
] satisfies (string | null)[];
|
|
288
|
-
const parameterNames = ["r"];
|
|
289
|
-
return (tx: Transaction) => tx.moveCall({
|
|
290
|
-
package: packageAddress,
|
|
291
|
-
module: 'stake',
|
|
292
|
-
function: 'registration_pool_id',
|
|
293
|
-
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
294
|
-
});
|
|
295
|
-
}
|
|
296
|
-
export interface RegistrationLastClaimIndexArguments {
|
|
297
|
-
r: TransactionArgument;
|
|
298
|
-
}
|
|
299
|
-
export interface RegistrationLastClaimIndexOptions {
|
|
300
|
-
package?: string;
|
|
301
|
-
arguments: RegistrationLastClaimIndexArguments | [
|
|
302
|
-
r: TransactionArgument
|
|
303
|
-
];
|
|
304
|
-
}
|
|
305
|
-
export function registrationLastClaimIndex(options: RegistrationLastClaimIndexOptions) {
|
|
306
|
-
const packageAddress = options.package ?? '@local-pkg/royalty_pool';
|
|
307
|
-
const argumentsTypes = [
|
|
308
|
-
null
|
|
309
|
-
] satisfies (string | null)[];
|
|
310
|
-
const parameterNames = ["r"];
|
|
311
|
-
return (tx: Transaction) => tx.moveCall({
|
|
312
|
-
package: packageAddress,
|
|
313
|
-
module: 'stake',
|
|
314
|
-
function: 'registration_last_claim_index',
|
|
315
|
-
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
316
|
-
});
|
|
317
|
-
}
|
package/src/cover.ts
DELETED
|
@@ -1,136 +0,0 @@
|
|
|
1
|
-
// Copyright (c) Miso Labs, Inc.
|
|
2
|
-
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
-
|
|
4
|
-
// Release cover art. A cover is a still image (optionally an animation) stored as
|
|
5
|
-
// a Walrus blob and referenced on-chain via `ori::WalrusData`. We build the ref
|
|
6
|
-
// (`ori::walrus_data::new_blob`, a raw call — ori is an external dep), wrap it in a
|
|
7
|
-
// `cover_art::CoverArt`, and attach it to the Release with
|
|
8
|
-
// `release_cover_art::set_cover` (gated by the ReleaseAdminCap).
|
|
9
|
-
//
|
|
10
|
-
// Blob ids are passed as `u256` (decimal string or bigint) — the CLI converts the
|
|
11
|
-
// base64url Walrus blob id to u256 before calling.
|
|
12
|
-
|
|
13
|
-
import type { ClientWithCoreApi } from "@mysten/sui/client";
|
|
14
|
-
import { bcs } from "@mysten/sui/bcs";
|
|
15
|
-
import { deriveDynamicFieldID } from "@mysten/sui/utils";
|
|
16
|
-
import type { TxThunk } from "./transactions.ts";
|
|
17
|
-
import { OPTION_NONE, OPTION_SOME } from "./internal.ts";
|
|
18
|
-
import { isNotFound } from "./queries.ts";
|
|
19
|
-
import * as coverArt from "./contracts/cover_art/cover_art.ts";
|
|
20
|
-
import * as releaseCoverArt from "./contracts/release_cover_art/release_cover_art.ts";
|
|
21
|
-
|
|
22
|
-
export interface SetReleaseCoverParams {
|
|
23
|
-
/** The `Release` object to attach the cover to. */
|
|
24
|
-
releaseId: string;
|
|
25
|
-
/** The release's `ReleaseAdminCap`. */
|
|
26
|
-
releaseAdminCapId: string;
|
|
27
|
-
/** Walrus blob id of the still cover image, as `u256` (decimal string or bigint). */
|
|
28
|
-
stillBlobId: bigint | string;
|
|
29
|
-
/** Optional animated-cover Walrus blob id (`u256`); omit for a still-only cover. */
|
|
30
|
-
animatedBlobId?: bigint | string | null;
|
|
31
|
-
/** `cover_art` package — home of the `CoverArt` value type (`cover_art::new`). */
|
|
32
|
-
coverArtPackageId: string;
|
|
33
|
-
/** `release_cover_art` package — home of the `set_cover` extension entry point. */
|
|
34
|
-
releaseCoverArtPackageId: string;
|
|
35
|
-
/** `ori` package (home of `walrus_data::new_blob` / the `WalrusData` type). */
|
|
36
|
-
oriPackageId: string;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
/** Sets (or replaces) a release's album-level cover from Walrus blob ids. */
|
|
40
|
-
export function setReleaseCover(p: SetReleaseCoverParams): TxThunk {
|
|
41
|
-
return (tx) => {
|
|
42
|
-
const walrusType = `${p.oriPackageId}::walrus_data::WalrusData`;
|
|
43
|
-
const blob = (id: bigint | string) =>
|
|
44
|
-
tx.moveCall({ target: `${p.oriPackageId}::walrus_data::new_blob`, arguments: [tx.pure.u256(id)] });
|
|
45
|
-
|
|
46
|
-
const still = blob(p.stillBlobId);
|
|
47
|
-
const animated =
|
|
48
|
-
p.animatedBlobId == null
|
|
49
|
-
? tx.moveCall({ target: OPTION_NONE, typeArguments: [walrusType] })
|
|
50
|
-
: tx.moveCall({ target: OPTION_SOME, typeArguments: [walrusType], arguments: [blob(p.animatedBlobId)] });
|
|
51
|
-
|
|
52
|
-
const cover = tx.add(coverArt._new({ package: p.coverArtPackageId, arguments: [still, animated] }));
|
|
53
|
-
tx.add(
|
|
54
|
-
releaseCoverArt.setCover({
|
|
55
|
-
package: p.releaseCoverArtPackageId,
|
|
56
|
-
arguments: [p.releaseId, p.releaseAdminCapId, cover],
|
|
57
|
-
}),
|
|
58
|
-
);
|
|
59
|
-
};
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
// ── Reads ────────────────────────────────────────────────────────────────────
|
|
63
|
-
|
|
64
|
-
/**
|
|
65
|
-
* A normalized reference to a cover image's Walrus data. Blob ids are returned as
|
|
66
|
-
* `u256` decimal strings (the on-chain form); callers convert to a base64url
|
|
67
|
-
* aggregator URL with `@unconfirmed/ori` (`u256ToB64Url` / `walrusDataUrl`).
|
|
68
|
-
*/
|
|
69
|
-
export type CoverImageRef =
|
|
70
|
-
| { kind: "blob"; blobId: string }
|
|
71
|
-
| { kind: "quiltPatch"; quiltId: string; version: number; startIndex: number; endIndex: number };
|
|
72
|
-
|
|
73
|
-
/** A release's album-level cover: a still image and an optional animation. */
|
|
74
|
-
export interface ReleaseCoverView {
|
|
75
|
-
still: CoverImageRef;
|
|
76
|
-
animated: CoverImageRef | null;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
// The cover is a dynamic field on the release UID under an empty `ExtensionKey()`
|
|
80
|
-
// (Move's implicit `dummy_field: bool` → one `false` byte). The stored value is a
|
|
81
|
-
// `Field { id, name: ExtensionKey, value: ReleaseCoverArt }`.
|
|
82
|
-
const CoverArtField = bcs.struct("Field", {
|
|
83
|
-
id: bcs.Address,
|
|
84
|
-
name: releaseCoverArt.ExtensionKey,
|
|
85
|
-
value: releaseCoverArt.ReleaseCoverArt,
|
|
86
|
-
});
|
|
87
|
-
const COVER_ART_KEY_BYTES = releaseCoverArt.ExtensionKey.serialize([false]).toBytes();
|
|
88
|
-
|
|
89
|
-
/** A parsed `ori::WalrusData` value (a MoveEnum: `Blob` or `QuiltPatch`). */
|
|
90
|
-
type ParsedWalrusData =
|
|
91
|
-
| { $kind: "Blob"; Blob: [string | number | bigint, unknown] }
|
|
92
|
-
| { $kind: "QuiltPatch"; QuiltPatch: [string | number | bigint, number, number, number] };
|
|
93
|
-
|
|
94
|
-
function toCoverImageRef(wd: ParsedWalrusData): CoverImageRef {
|
|
95
|
-
if (wd.$kind === "Blob") return { kind: "blob", blobId: String(wd.Blob[0]) };
|
|
96
|
-
const [quiltId, version, startIndex, endIndex] = wd.QuiltPatch;
|
|
97
|
-
return { kind: "quiltPatch", quiltId: String(quiltId), version, startIndex, endIndex };
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
/**
|
|
101
|
-
* Reads a release's album-level cover (the `release_cover_art` extension), or
|
|
102
|
-
* `null` if no cover is attached. Derives the `ExtensionKey` dynamic field on the
|
|
103
|
-
* release, parses the `ReleaseCoverArt`, and returns the still (+ optional
|
|
104
|
-
* animation) as normalized Walrus refs for the app's featured-pressing card.
|
|
105
|
-
*/
|
|
106
|
-
export async function getReleaseCover(
|
|
107
|
-
client: ClientWithCoreApi,
|
|
108
|
-
releaseId: string,
|
|
109
|
-
releaseCoverArtPackageId: string,
|
|
110
|
-
): Promise<ReleaseCoverView | null> {
|
|
111
|
-
const fieldId = deriveDynamicFieldID(
|
|
112
|
-
releaseId,
|
|
113
|
-
`${releaseCoverArtPackageId}::release_cover_art::ExtensionKey`,
|
|
114
|
-
COVER_ART_KEY_BYTES,
|
|
115
|
-
);
|
|
116
|
-
|
|
117
|
-
let content: Uint8Array | null;
|
|
118
|
-
try {
|
|
119
|
-
const { object } = await client.core.getObject({ objectId: fieldId, include: { content: true } });
|
|
120
|
-
content = object?.content ?? null;
|
|
121
|
-
} catch (e) {
|
|
122
|
-
if (isNotFound(e)) return null;
|
|
123
|
-
throw e;
|
|
124
|
-
}
|
|
125
|
-
if (!content) return null;
|
|
126
|
-
|
|
127
|
-
const cover = CoverArtField.parse(content).value.cover as
|
|
128
|
-
| { still: ParsedWalrusData; animated: ParsedWalrusData | null }
|
|
129
|
-
| null;
|
|
130
|
-
if (!cover) return null;
|
|
131
|
-
|
|
132
|
-
return {
|
|
133
|
-
still: toCoverImageRef(cover.still),
|
|
134
|
-
animated: cover.animated ? toCoverImageRef(cover.animated) : null,
|
|
135
|
-
};
|
|
136
|
-
}
|