@zing-protocol/zing-sdk 0.0.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 +12 -0
- package/package.json +37 -0
- package/src/_generated/index.js +6 -0
- package/src/_generated/utils/index.ts +181 -0
- package/src/_generated/zing_framework/coin_utils.ts +41 -0
- package/src/_generated/zing_framework/deps/sui/object.ts +16 -0
- package/src/_generated/zing_framework/derived_object_bag.ts +400 -0
- package/src/_generated/zing_framework/derived_table.ts +366 -0
- package/src/_generated/zing_governance/admin.ts +47 -0
- package/src/_generated/zing_governance/deps/sui/object.ts +16 -0
- package/src/_generated/zing_governance/treasury.ts +134 -0
- package/src/_generated/zing_identity/config.ts +191 -0
- package/src/_generated/zing_identity/deps/std/type_name.ts +25 -0
- package/src/_generated/zing_identity/deps/sui/object.ts +16 -0
- package/src/_generated/zing_identity/deps/sui/object_table.ts +26 -0
- package/src/_generated/zing_identity/deps/sui/table.ts +38 -0
- package/src/_generated/zing_identity/deps/sui/vec_set.ts +28 -0
- package/src/_generated/zing_identity/ecdsa.ts +166 -0
- package/src/_generated/zing_identity/identity.ts +661 -0
- package/src/_generated/zing_identity/reclaim.ts +803 -0
- package/src/_generated/zing_studio/app.ts +855 -0
- package/src/_generated/zing_studio/article.ts +598 -0
- package/src/_generated/zing_studio/config.ts +475 -0
- package/src/_generated/zing_studio/deps/std/type_name.ts +25 -0
- package/src/_generated/zing_studio/deps/sui/bag.ts +43 -0
- package/src/_generated/zing_studio/deps/sui/balance.ts +20 -0
- package/src/_generated/zing_studio/deps/sui/coin.ts +21 -0
- package/src/_generated/zing_studio/deps/sui/dynamic_field.ts +272 -0
- package/src/_generated/zing_studio/deps/sui/object.ts +16 -0
- package/src/_generated/zing_studio/deps/sui/table.ts +38 -0
- package/src/_generated/zing_studio/deps/sui/vec_map.ts +39 -0
- package/src/_generated/zing_studio/deps/sui/vec_set.ts +28 -0
- package/src/_generated/zing_studio/deps/walrus/blob.ts +22 -0
- package/src/_generated/zing_studio/deps/walrus/events.ts +124 -0
- package/src/_generated/zing_studio/deps/walrus/metadata.ts +137 -0
- package/src/_generated/zing_studio/deps/walrus/storage_resource.ts +17 -0
- package/src/_generated/zing_studio/deps/zing_framework/derived_object_bag.ts +17 -0
- package/src/_generated/zing_studio/deps/zing_framework/derived_table.ts +17 -0
- package/src/_generated/zing_studio/donation.ts +18 -0
- package/src/_generated/zing_studio/enclave.ts +466 -0
- package/src/_generated/zing_studio/nitro_attestation.ts +308 -0
- package/src/_generated/zing_studio/referral.ts +447 -0
- package/src/_generated/zing_studio/storage.ts +664 -0
- package/src/_generated/zing_studio/studio.ts +682 -0
- package/src/bcs.ts +139 -0
- package/src/client/index.ts +557 -0
- package/src/client/types.ts +28 -0
- package/src/components/index.ts +3 -0
- package/src/components/wallet-provider.tsx +53 -0
- package/src/components/walrus-provider.tsx +212 -0
- package/src/components/zing-provider.tsx +54 -0
- package/src/config/common.ts +82 -0
- package/src/config/index.ts +45 -0
- package/src/config/mainnet.ts +109 -0
- package/src/config/testnet.ts +111 -0
- package/src/config/types.ts +69 -0
- package/src/const.ts +32 -0
- package/src/getters.ts +523 -0
- package/src/hooks/index.ts +14 -0
- package/src/hooks/useGetStudio.ts +22 -0
- package/src/hooks/useGetTierPlan.ts +115 -0
- package/src/hooks/useReclaim.ts +165 -0
- package/src/hooks/useSignAndExecuteTransaction.ts +57 -0
- package/src/hooks/useSignPersonalMessage.ts +28 -0
- package/src/hooks/useZingInfiniteQueries.ts +92 -0
- package/src/hooks/useZingMutation.ts +66 -0
- package/src/hooks/useZingQueries.ts +107 -0
- package/src/hooks/useZingQuery.ts +88 -0
- package/src/index.ts +15 -0
- package/src/lib/utils/colorful-logger.ts +27 -0
- package/src/lib/utils/const.ts +25 -0
- package/src/lib/utils/helpers.ts +78 -0
- package/src/lib/utils/index.ts +5 -0
- package/src/lib/utils/init-app-with-shadow.ts +42 -0
- package/src/lib/utils/quilt.ts +317 -0
- package/src/lib/utils/reclaim.ts +148 -0
- package/src/lib/utils/types.ts +14 -0
- package/src/mutations/index.ts +3 -0
- package/src/mutations/seal.ts +78 -0
- package/src/mutations/signer.ts +241 -0
- package/src/mutations/walrus.ts +862 -0
- package/src/stores/index.ts +3 -0
- package/src/stores/walletStore.ts +360 -0
- package/src/stores/walrusStore.ts +118 -0
- package/src/stores/zkloginStore.ts +53 -0
- package/src/types.ts +120 -0
- package/tsconfig.json +12 -0
|
@@ -0,0 +1,855 @@
|
|
|
1
|
+
/**************************************************************
|
|
2
|
+
* THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
|
|
3
|
+
**************************************************************/
|
|
4
|
+
import * as studio from "./studio.js";
|
|
5
|
+
import { MoveStruct, normalizeMoveArguments } from "../utils/index.js";
|
|
6
|
+
import { bcs } from "@mysten/sui/bcs";
|
|
7
|
+
import type { RawTransactionArgument } from "../utils/index.js";
|
|
8
|
+
import type { Transaction } from "@mysten/sui/transactions";
|
|
9
|
+
|
|
10
|
+
const $moduleName = "@local-pkg/zing_studio::app";
|
|
11
|
+
export const PurchaseStorageTierEvent = new MoveStruct({
|
|
12
|
+
name: `${$moduleName}::PurchaseStorageTierEvent`,
|
|
13
|
+
fields: {
|
|
14
|
+
owner: bcs.Address,
|
|
15
|
+
current_epoch: bcs.u32(),
|
|
16
|
+
timestamp_ms: bcs.u64(),
|
|
17
|
+
prev_period: studio.Period,
|
|
18
|
+
current_period: studio.Period,
|
|
19
|
+
prev_tier: bcs.option(bcs.u8()),
|
|
20
|
+
current_tier: bcs.u8(),
|
|
21
|
+
prev_storage_limit: bcs.u64(),
|
|
22
|
+
current_storage_limit: bcs.u64(),
|
|
23
|
+
payment: bcs.u64(),
|
|
24
|
+
},
|
|
25
|
+
});
|
|
26
|
+
export const MembershipSubscribeEvent = new MoveStruct({
|
|
27
|
+
name: `${$moduleName}::MembershipSubscribeEvent`,
|
|
28
|
+
fields: {
|
|
29
|
+
owner: bcs.Address,
|
|
30
|
+
member: bcs.Address,
|
|
31
|
+
level: bcs.u8(),
|
|
32
|
+
extended_time_ms: bcs.u64(),
|
|
33
|
+
expired_at: bcs.u64(),
|
|
34
|
+
monthly_subscription_fee: bcs.u64(),
|
|
35
|
+
},
|
|
36
|
+
});
|
|
37
|
+
export const DeleteArticleEvent = new MoveStruct({
|
|
38
|
+
name: `${$moduleName}::DeleteArticleEvent`,
|
|
39
|
+
fields: {
|
|
40
|
+
article_id: bcs.Address,
|
|
41
|
+
owner: bcs.Address,
|
|
42
|
+
current_epoch: bcs.u32(),
|
|
43
|
+
timestamp_ms: bcs.u64(),
|
|
44
|
+
},
|
|
45
|
+
});
|
|
46
|
+
export const DonateEvent = new MoveStruct({
|
|
47
|
+
name: `${$moduleName}::DonateEvent`,
|
|
48
|
+
fields: {
|
|
49
|
+
recipient: bcs.Address,
|
|
50
|
+
value: bcs.u64(),
|
|
51
|
+
message: bcs.string(),
|
|
52
|
+
},
|
|
53
|
+
});
|
|
54
|
+
export const ReferralEvent = new MoveStruct({
|
|
55
|
+
name: `${$moduleName}::ReferralEvent`,
|
|
56
|
+
fields: {
|
|
57
|
+
value: bcs.u64(),
|
|
58
|
+
referrer: bcs.Address,
|
|
59
|
+
},
|
|
60
|
+
});
|
|
61
|
+
export const ReferralEarningEvent = new MoveStruct({
|
|
62
|
+
name: `${$moduleName}::ReferralEarningEvent`,
|
|
63
|
+
fields: {
|
|
64
|
+
referrer: bcs.Address,
|
|
65
|
+
referee: bcs.Address,
|
|
66
|
+
value: bcs.u64(),
|
|
67
|
+
},
|
|
68
|
+
});
|
|
69
|
+
export const App = new MoveStruct({
|
|
70
|
+
name: `${$moduleName}::App`,
|
|
71
|
+
fields: {
|
|
72
|
+
dummy_field: bcs.bool(),
|
|
73
|
+
},
|
|
74
|
+
});
|
|
75
|
+
export const PublishReceipt = new MoveStruct({
|
|
76
|
+
name: `${$moduleName}::PublishReceipt`,
|
|
77
|
+
fields: {
|
|
78
|
+
studio_id: bcs.Address,
|
|
79
|
+
work_id: bcs.Address,
|
|
80
|
+
},
|
|
81
|
+
});
|
|
82
|
+
export interface SetupFileKeyArguments {
|
|
83
|
+
config: RawTransactionArgument<string>;
|
|
84
|
+
studio: RawTransactionArgument<string>;
|
|
85
|
+
encryptedFileKey: RawTransactionArgument<number[]>;
|
|
86
|
+
}
|
|
87
|
+
export interface SetupFileKeyOptions {
|
|
88
|
+
package?: string;
|
|
89
|
+
arguments:
|
|
90
|
+
| SetupFileKeyArguments
|
|
91
|
+
| [
|
|
92
|
+
config: RawTransactionArgument<string>,
|
|
93
|
+
studio: RawTransactionArgument<string>,
|
|
94
|
+
encryptedFileKey: RawTransactionArgument<number[]>,
|
|
95
|
+
];
|
|
96
|
+
}
|
|
97
|
+
export function setupFileKey(options: SetupFileKeyOptions) {
|
|
98
|
+
const packageAddress = options.package ?? "@local-pkg/zing_studio";
|
|
99
|
+
const argumentsTypes = [
|
|
100
|
+
`${packageAddress}::config::Config`,
|
|
101
|
+
`${packageAddress}::studio::Studio`,
|
|
102
|
+
"vector<u8>",
|
|
103
|
+
] satisfies string[];
|
|
104
|
+
const parameterNames = ["config", "studio", "encryptedFileKey"];
|
|
105
|
+
return (tx: Transaction) =>
|
|
106
|
+
tx.moveCall({
|
|
107
|
+
package: packageAddress,
|
|
108
|
+
module: "app",
|
|
109
|
+
function: "setup_file_key",
|
|
110
|
+
arguments: normalizeMoveArguments(
|
|
111
|
+
options.arguments,
|
|
112
|
+
argumentsTypes,
|
|
113
|
+
parameterNames,
|
|
114
|
+
),
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
export interface UpdateFileKeyArguments {
|
|
118
|
+
config: RawTransactionArgument<string>;
|
|
119
|
+
studio: RawTransactionArgument<string>;
|
|
120
|
+
encryptedFileKey: RawTransactionArgument<number[]>;
|
|
121
|
+
}
|
|
122
|
+
export interface UpdateFileKeyOptions {
|
|
123
|
+
package?: string;
|
|
124
|
+
arguments:
|
|
125
|
+
| UpdateFileKeyArguments
|
|
126
|
+
| [
|
|
127
|
+
config: RawTransactionArgument<string>,
|
|
128
|
+
studio: RawTransactionArgument<string>,
|
|
129
|
+
encryptedFileKey: RawTransactionArgument<number[]>,
|
|
130
|
+
];
|
|
131
|
+
}
|
|
132
|
+
export function updateFileKey(options: UpdateFileKeyOptions) {
|
|
133
|
+
const packageAddress = options.package ?? "@local-pkg/zing_studio";
|
|
134
|
+
const argumentsTypes = [
|
|
135
|
+
`${packageAddress}::config::Config`,
|
|
136
|
+
`${packageAddress}::studio::Studio`,
|
|
137
|
+
"vector<u8>",
|
|
138
|
+
] satisfies string[];
|
|
139
|
+
const parameterNames = ["config", "studio", "encryptedFileKey"];
|
|
140
|
+
return (tx: Transaction) =>
|
|
141
|
+
tx.moveCall({
|
|
142
|
+
package: packageAddress,
|
|
143
|
+
module: "app",
|
|
144
|
+
function: "update_file_key",
|
|
145
|
+
arguments: normalizeMoveArguments(
|
|
146
|
+
options.arguments,
|
|
147
|
+
argumentsTypes,
|
|
148
|
+
parameterNames,
|
|
149
|
+
),
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
export interface SetMonthlySubscriptionFeeArguments {
|
|
153
|
+
config: RawTransactionArgument<string>;
|
|
154
|
+
studio: RawTransactionArgument<string>;
|
|
155
|
+
level: RawTransactionArgument<number>;
|
|
156
|
+
monthlySubscriptionFee: RawTransactionArgument<number | bigint>;
|
|
157
|
+
}
|
|
158
|
+
export interface SetMonthlySubscriptionFeeOptions {
|
|
159
|
+
package?: string;
|
|
160
|
+
arguments:
|
|
161
|
+
| SetMonthlySubscriptionFeeArguments
|
|
162
|
+
| [
|
|
163
|
+
config: RawTransactionArgument<string>,
|
|
164
|
+
studio: RawTransactionArgument<string>,
|
|
165
|
+
level: RawTransactionArgument<number>,
|
|
166
|
+
monthlySubscriptionFee: RawTransactionArgument<number | bigint>,
|
|
167
|
+
];
|
|
168
|
+
}
|
|
169
|
+
export function setMonthlySubscriptionFee(
|
|
170
|
+
options: SetMonthlySubscriptionFeeOptions,
|
|
171
|
+
) {
|
|
172
|
+
const packageAddress = options.package ?? "@local-pkg/zing_studio";
|
|
173
|
+
const argumentsTypes = [
|
|
174
|
+
`${packageAddress}::config::Config`,
|
|
175
|
+
`${packageAddress}::studio::Studio`,
|
|
176
|
+
"u8",
|
|
177
|
+
"u64",
|
|
178
|
+
] satisfies string[];
|
|
179
|
+
const parameterNames = [
|
|
180
|
+
"config",
|
|
181
|
+
"studio",
|
|
182
|
+
"level",
|
|
183
|
+
"monthlySubscriptionFee",
|
|
184
|
+
];
|
|
185
|
+
return (tx: Transaction) =>
|
|
186
|
+
tx.moveCall({
|
|
187
|
+
package: packageAddress,
|
|
188
|
+
module: "app",
|
|
189
|
+
function: "set_monthly_subscription_fee",
|
|
190
|
+
arguments: normalizeMoveArguments(
|
|
191
|
+
options.arguments,
|
|
192
|
+
argumentsTypes,
|
|
193
|
+
parameterNames,
|
|
194
|
+
),
|
|
195
|
+
});
|
|
196
|
+
}
|
|
197
|
+
export interface SubscribeToStudioArguments {
|
|
198
|
+
studio: RawTransactionArgument<string>;
|
|
199
|
+
treasury: RawTransactionArgument<string>;
|
|
200
|
+
subscriptionLevel: RawTransactionArgument<number>;
|
|
201
|
+
payment: RawTransactionArgument<string>;
|
|
202
|
+
config: RawTransactionArgument<string>;
|
|
203
|
+
}
|
|
204
|
+
export interface SubscribeToStudioOptions {
|
|
205
|
+
package?: string;
|
|
206
|
+
arguments:
|
|
207
|
+
| SubscribeToStudioArguments
|
|
208
|
+
| [
|
|
209
|
+
studio: RawTransactionArgument<string>,
|
|
210
|
+
treasury: RawTransactionArgument<string>,
|
|
211
|
+
subscriptionLevel: RawTransactionArgument<number>,
|
|
212
|
+
payment: RawTransactionArgument<string>,
|
|
213
|
+
config: RawTransactionArgument<string>,
|
|
214
|
+
];
|
|
215
|
+
typeArguments: [string];
|
|
216
|
+
}
|
|
217
|
+
export function subscribeToStudio(options: SubscribeToStudioOptions) {
|
|
218
|
+
const packageAddress = options.package ?? "@local-pkg/zing_studio";
|
|
219
|
+
const argumentsTypes = [
|
|
220
|
+
`${packageAddress}::studio::Studio`,
|
|
221
|
+
`${packageAddress}::treasury::Treasury`,
|
|
222
|
+
"u8",
|
|
223
|
+
`0x0000000000000000000000000000000000000000000000000000000000000002::coin::Coin<${options.typeArguments[0]}>`,
|
|
224
|
+
`${packageAddress}::config::Config`,
|
|
225
|
+
"0x0000000000000000000000000000000000000000000000000000000000000002::clock::Clock",
|
|
226
|
+
] satisfies string[];
|
|
227
|
+
const parameterNames = [
|
|
228
|
+
"studio",
|
|
229
|
+
"treasury",
|
|
230
|
+
"subscriptionLevel",
|
|
231
|
+
"payment",
|
|
232
|
+
"config",
|
|
233
|
+
];
|
|
234
|
+
return (tx: Transaction) =>
|
|
235
|
+
tx.moveCall({
|
|
236
|
+
package: packageAddress,
|
|
237
|
+
module: "app",
|
|
238
|
+
function: "subscribe_to_studio",
|
|
239
|
+
arguments: normalizeMoveArguments(
|
|
240
|
+
options.arguments,
|
|
241
|
+
argumentsTypes,
|
|
242
|
+
parameterNames,
|
|
243
|
+
),
|
|
244
|
+
typeArguments: options.typeArguments,
|
|
245
|
+
});
|
|
246
|
+
}
|
|
247
|
+
export interface PurchaseStorageTierArguments {
|
|
248
|
+
config: RawTransactionArgument<string>;
|
|
249
|
+
studio: RawTransactionArgument<string>;
|
|
250
|
+
treasury: RawTransactionArgument<string>;
|
|
251
|
+
walrusSystem: RawTransactionArgument<string>;
|
|
252
|
+
storageTreasury: RawTransactionArgument<string>;
|
|
253
|
+
storageSpace: RawTransactionArgument<string>;
|
|
254
|
+
newTierIdx: RawTransactionArgument<number>;
|
|
255
|
+
payment: RawTransactionArgument<string>;
|
|
256
|
+
}
|
|
257
|
+
export interface PurchaseStorageTierOptions {
|
|
258
|
+
package?: string;
|
|
259
|
+
arguments:
|
|
260
|
+
| PurchaseStorageTierArguments
|
|
261
|
+
| [
|
|
262
|
+
config: RawTransactionArgument<string>,
|
|
263
|
+
studio: RawTransactionArgument<string>,
|
|
264
|
+
treasury: RawTransactionArgument<string>,
|
|
265
|
+
walrusSystem: RawTransactionArgument<string>,
|
|
266
|
+
storageTreasury: RawTransactionArgument<string>,
|
|
267
|
+
storageSpace: RawTransactionArgument<string>,
|
|
268
|
+
newTierIdx: RawTransactionArgument<number>,
|
|
269
|
+
payment: RawTransactionArgument<string>,
|
|
270
|
+
];
|
|
271
|
+
typeArguments: [string];
|
|
272
|
+
}
|
|
273
|
+
export function purchaseStorageTier(options: PurchaseStorageTierOptions) {
|
|
274
|
+
const packageAddress = options.package ?? "@local-pkg/zing_studio";
|
|
275
|
+
const argumentsTypes = [
|
|
276
|
+
`${packageAddress}::config::Config`,
|
|
277
|
+
`${packageAddress}::studio::Studio`,
|
|
278
|
+
`${packageAddress}::treasury::Treasury`,
|
|
279
|
+
`${packageAddress}::system::System`,
|
|
280
|
+
`${packageAddress}::storage::StorageTreasury`,
|
|
281
|
+
`${packageAddress}::storage::StorageSpace`,
|
|
282
|
+
"u8",
|
|
283
|
+
`0x0000000000000000000000000000000000000000000000000000000000000002::coin::Coin<${options.typeArguments[0]}>`,
|
|
284
|
+
"0x0000000000000000000000000000000000000000000000000000000000000002::clock::Clock",
|
|
285
|
+
] satisfies string[];
|
|
286
|
+
const parameterNames = [
|
|
287
|
+
"config",
|
|
288
|
+
"studio",
|
|
289
|
+
"treasury",
|
|
290
|
+
"walrusSystem",
|
|
291
|
+
"storageTreasury",
|
|
292
|
+
"storageSpace",
|
|
293
|
+
"newTierIdx",
|
|
294
|
+
"payment",
|
|
295
|
+
];
|
|
296
|
+
return (tx: Transaction) =>
|
|
297
|
+
tx.moveCall({
|
|
298
|
+
package: packageAddress,
|
|
299
|
+
module: "app",
|
|
300
|
+
function: "purchase_storage_tier",
|
|
301
|
+
arguments: normalizeMoveArguments(
|
|
302
|
+
options.arguments,
|
|
303
|
+
argumentsTypes,
|
|
304
|
+
parameterNames,
|
|
305
|
+
),
|
|
306
|
+
typeArguments: options.typeArguments,
|
|
307
|
+
});
|
|
308
|
+
}
|
|
309
|
+
export interface AllocateStorageAndRegisterBlobArguments {
|
|
310
|
+
config: RawTransactionArgument<string>;
|
|
311
|
+
studio: RawTransactionArgument<string>;
|
|
312
|
+
walrusSystem: RawTransactionArgument<string>;
|
|
313
|
+
storageTreasury: RawTransactionArgument<string>;
|
|
314
|
+
storageSpace: RawTransactionArgument<string>;
|
|
315
|
+
blobId: RawTransactionArgument<number | bigint>;
|
|
316
|
+
rootHash: RawTransactionArgument<number | bigint>;
|
|
317
|
+
unencodedBlobSize: RawTransactionArgument<number | bigint>;
|
|
318
|
+
encodingType: RawTransactionArgument<number>;
|
|
319
|
+
}
|
|
320
|
+
export interface AllocateStorageAndRegisterBlobOptions {
|
|
321
|
+
package?: string;
|
|
322
|
+
arguments:
|
|
323
|
+
| AllocateStorageAndRegisterBlobArguments
|
|
324
|
+
| [
|
|
325
|
+
config: RawTransactionArgument<string>,
|
|
326
|
+
studio: RawTransactionArgument<string>,
|
|
327
|
+
walrusSystem: RawTransactionArgument<string>,
|
|
328
|
+
storageTreasury: RawTransactionArgument<string>,
|
|
329
|
+
storageSpace: RawTransactionArgument<string>,
|
|
330
|
+
blobId: RawTransactionArgument<number | bigint>,
|
|
331
|
+
rootHash: RawTransactionArgument<number | bigint>,
|
|
332
|
+
unencodedBlobSize: RawTransactionArgument<number | bigint>,
|
|
333
|
+
encodingType: RawTransactionArgument<number>,
|
|
334
|
+
];
|
|
335
|
+
}
|
|
336
|
+
export function allocateStorageAndRegisterBlob(
|
|
337
|
+
options: AllocateStorageAndRegisterBlobOptions,
|
|
338
|
+
) {
|
|
339
|
+
const packageAddress = options.package ?? "@local-pkg/zing_studio";
|
|
340
|
+
const argumentsTypes = [
|
|
341
|
+
`${packageAddress}::config::Config`,
|
|
342
|
+
`${packageAddress}::studio::Studio`,
|
|
343
|
+
`${packageAddress}::system::System`,
|
|
344
|
+
`${packageAddress}::storage::StorageTreasury`,
|
|
345
|
+
`${packageAddress}::storage::StorageSpace`,
|
|
346
|
+
"u256",
|
|
347
|
+
"u256",
|
|
348
|
+
"u64",
|
|
349
|
+
"u8",
|
|
350
|
+
"0x0000000000000000000000000000000000000000000000000000000000000002::clock::Clock",
|
|
351
|
+
] satisfies string[];
|
|
352
|
+
const parameterNames = [
|
|
353
|
+
"config",
|
|
354
|
+
"studio",
|
|
355
|
+
"walrusSystem",
|
|
356
|
+
"storageTreasury",
|
|
357
|
+
"storageSpace",
|
|
358
|
+
"blobId",
|
|
359
|
+
"rootHash",
|
|
360
|
+
"unencodedBlobSize",
|
|
361
|
+
"encodingType",
|
|
362
|
+
];
|
|
363
|
+
return (tx: Transaction) =>
|
|
364
|
+
tx.moveCall({
|
|
365
|
+
package: packageAddress,
|
|
366
|
+
module: "app",
|
|
367
|
+
function: "allocate_storage_and_register_blob",
|
|
368
|
+
arguments: normalizeMoveArguments(
|
|
369
|
+
options.arguments,
|
|
370
|
+
argumentsTypes,
|
|
371
|
+
parameterNames,
|
|
372
|
+
),
|
|
373
|
+
});
|
|
374
|
+
}
|
|
375
|
+
export interface StartPublishArticleArguments {
|
|
376
|
+
config: RawTransactionArgument<string>;
|
|
377
|
+
studio: RawTransactionArgument<string>;
|
|
378
|
+
walrusSystem: RawTransactionArgument<string>;
|
|
379
|
+
storageTreasury: RawTransactionArgument<string>;
|
|
380
|
+
storageSpace: RawTransactionArgument<string>;
|
|
381
|
+
subscriptionLevel: RawTransactionArgument<number | null>;
|
|
382
|
+
blobId: RawTransactionArgument<number | bigint>;
|
|
383
|
+
rootHash: RawTransactionArgument<number | bigint>;
|
|
384
|
+
unencodedBlobSize: RawTransactionArgument<number | bigint>;
|
|
385
|
+
encodingType: RawTransactionArgument<number>;
|
|
386
|
+
identifiers: RawTransactionArgument<string[]>;
|
|
387
|
+
blobIndexes: RawTransactionArgument<number | bigint[]>;
|
|
388
|
+
mimeTypes: RawTransactionArgument<string[]>;
|
|
389
|
+
metadataSizes: RawTransactionArgument<number | bigint[]>;
|
|
390
|
+
}
|
|
391
|
+
export interface StartPublishArticleOptions {
|
|
392
|
+
package?: string;
|
|
393
|
+
arguments:
|
|
394
|
+
| StartPublishArticleArguments
|
|
395
|
+
| [
|
|
396
|
+
config: RawTransactionArgument<string>,
|
|
397
|
+
studio: RawTransactionArgument<string>,
|
|
398
|
+
walrusSystem: RawTransactionArgument<string>,
|
|
399
|
+
storageTreasury: RawTransactionArgument<string>,
|
|
400
|
+
storageSpace: RawTransactionArgument<string>,
|
|
401
|
+
subscriptionLevel: RawTransactionArgument<number | null>,
|
|
402
|
+
blobId: RawTransactionArgument<number | bigint>,
|
|
403
|
+
rootHash: RawTransactionArgument<number | bigint>,
|
|
404
|
+
unencodedBlobSize: RawTransactionArgument<number | bigint>,
|
|
405
|
+
encodingType: RawTransactionArgument<number>,
|
|
406
|
+
identifiers: RawTransactionArgument<string[]>,
|
|
407
|
+
blobIndexes: RawTransactionArgument<number | bigint[]>,
|
|
408
|
+
mimeTypes: RawTransactionArgument<string[]>,
|
|
409
|
+
metadataSizes: RawTransactionArgument<number | bigint[]>,
|
|
410
|
+
];
|
|
411
|
+
}
|
|
412
|
+
export function startPublishArticle(options: StartPublishArticleOptions) {
|
|
413
|
+
const packageAddress = options.package ?? "@local-pkg/zing_studio";
|
|
414
|
+
const argumentsTypes = [
|
|
415
|
+
`${packageAddress}::config::Config`,
|
|
416
|
+
`${packageAddress}::studio::Studio`,
|
|
417
|
+
`${packageAddress}::system::System`,
|
|
418
|
+
`${packageAddress}::storage::StorageTreasury`,
|
|
419
|
+
`${packageAddress}::storage::StorageSpace`,
|
|
420
|
+
"0x0000000000000000000000000000000000000000000000000000000000000001::option::Option<u8>",
|
|
421
|
+
"u256",
|
|
422
|
+
"u256",
|
|
423
|
+
"u64",
|
|
424
|
+
"u8",
|
|
425
|
+
"vector<0x0000000000000000000000000000000000000000000000000000000000000001::ascii::String>",
|
|
426
|
+
"vector<u64>",
|
|
427
|
+
"vector<0x0000000000000000000000000000000000000000000000000000000000000001::ascii::String>",
|
|
428
|
+
"vector<u64>",
|
|
429
|
+
"0x0000000000000000000000000000000000000000000000000000000000000002::clock::Clock",
|
|
430
|
+
] satisfies string[];
|
|
431
|
+
const parameterNames = [
|
|
432
|
+
"config",
|
|
433
|
+
"studio",
|
|
434
|
+
"walrusSystem",
|
|
435
|
+
"storageTreasury",
|
|
436
|
+
"storageSpace",
|
|
437
|
+
"subscriptionLevel",
|
|
438
|
+
"blobId",
|
|
439
|
+
"rootHash",
|
|
440
|
+
"unencodedBlobSize",
|
|
441
|
+
"encodingType",
|
|
442
|
+
"identifiers",
|
|
443
|
+
"blobIndexes",
|
|
444
|
+
"mimeTypes",
|
|
445
|
+
"metadataSizes",
|
|
446
|
+
];
|
|
447
|
+
return (tx: Transaction) =>
|
|
448
|
+
tx.moveCall({
|
|
449
|
+
package: packageAddress,
|
|
450
|
+
module: "app",
|
|
451
|
+
function: "start_publish_article",
|
|
452
|
+
arguments: normalizeMoveArguments(
|
|
453
|
+
options.arguments,
|
|
454
|
+
argumentsTypes,
|
|
455
|
+
parameterNames,
|
|
456
|
+
),
|
|
457
|
+
});
|
|
458
|
+
}
|
|
459
|
+
export interface FinalizePublishArticleArguments {
|
|
460
|
+
config: RawTransactionArgument<string>;
|
|
461
|
+
studio: RawTransactionArgument<string>;
|
|
462
|
+
receipt: RawTransactionArgument<string>;
|
|
463
|
+
article: RawTransactionArgument<string>;
|
|
464
|
+
}
|
|
465
|
+
export interface FinalizePublishArticleOptions {
|
|
466
|
+
package?: string;
|
|
467
|
+
arguments:
|
|
468
|
+
| FinalizePublishArticleArguments
|
|
469
|
+
| [
|
|
470
|
+
config: RawTransactionArgument<string>,
|
|
471
|
+
studio: RawTransactionArgument<string>,
|
|
472
|
+
receipt: RawTransactionArgument<string>,
|
|
473
|
+
article: RawTransactionArgument<string>,
|
|
474
|
+
];
|
|
475
|
+
}
|
|
476
|
+
export function finalizePublishArticle(options: FinalizePublishArticleOptions) {
|
|
477
|
+
const packageAddress = options.package ?? "@local-pkg/zing_studio";
|
|
478
|
+
const argumentsTypes = [
|
|
479
|
+
`${packageAddress}::config::Config`,
|
|
480
|
+
`${packageAddress}::studio::Studio`,
|
|
481
|
+
`${packageAddress}::app::PublishReceipt`,
|
|
482
|
+
`${packageAddress}::article::Article`,
|
|
483
|
+
] satisfies string[];
|
|
484
|
+
const parameterNames = ["config", "studio", "receipt", "article"];
|
|
485
|
+
return (tx: Transaction) =>
|
|
486
|
+
tx.moveCall({
|
|
487
|
+
package: packageAddress,
|
|
488
|
+
module: "app",
|
|
489
|
+
function: "finalize_publish_article",
|
|
490
|
+
arguments: normalizeMoveArguments(
|
|
491
|
+
options.arguments,
|
|
492
|
+
argumentsTypes,
|
|
493
|
+
parameterNames,
|
|
494
|
+
),
|
|
495
|
+
});
|
|
496
|
+
}
|
|
497
|
+
export interface CertifyArticleBlobArguments {
|
|
498
|
+
config: RawTransactionArgument<string>;
|
|
499
|
+
studio: RawTransactionArgument<string>;
|
|
500
|
+
walrusSystem: RawTransactionArgument<string>;
|
|
501
|
+
articleId: RawTransactionArgument<string>;
|
|
502
|
+
blobIndex: RawTransactionArgument<number | bigint>;
|
|
503
|
+
signature: RawTransactionArgument<number[]>;
|
|
504
|
+
signersBitmap: RawTransactionArgument<number[]>;
|
|
505
|
+
message: RawTransactionArgument<number[]>;
|
|
506
|
+
}
|
|
507
|
+
export interface CertifyArticleBlobOptions {
|
|
508
|
+
package?: string;
|
|
509
|
+
arguments:
|
|
510
|
+
| CertifyArticleBlobArguments
|
|
511
|
+
| [
|
|
512
|
+
config: RawTransactionArgument<string>,
|
|
513
|
+
studio: RawTransactionArgument<string>,
|
|
514
|
+
walrusSystem: RawTransactionArgument<string>,
|
|
515
|
+
articleId: RawTransactionArgument<string>,
|
|
516
|
+
blobIndex: RawTransactionArgument<number | bigint>,
|
|
517
|
+
signature: RawTransactionArgument<number[]>,
|
|
518
|
+
signersBitmap: RawTransactionArgument<number[]>,
|
|
519
|
+
message: RawTransactionArgument<number[]>,
|
|
520
|
+
];
|
|
521
|
+
}
|
|
522
|
+
export function certifyArticleBlob(options: CertifyArticleBlobOptions) {
|
|
523
|
+
const packageAddress = options.package ?? "@local-pkg/zing_studio";
|
|
524
|
+
const argumentsTypes = [
|
|
525
|
+
`${packageAddress}::config::Config`,
|
|
526
|
+
`${packageAddress}::studio::Studio`,
|
|
527
|
+
`${packageAddress}::system::System`,
|
|
528
|
+
"0x0000000000000000000000000000000000000000000000000000000000000002::object::ID",
|
|
529
|
+
"u64",
|
|
530
|
+
"vector<u8>",
|
|
531
|
+
"vector<u8>",
|
|
532
|
+
"vector<u8>",
|
|
533
|
+
] satisfies string[];
|
|
534
|
+
const parameterNames = [
|
|
535
|
+
"config",
|
|
536
|
+
"studio",
|
|
537
|
+
"walrusSystem",
|
|
538
|
+
"articleId",
|
|
539
|
+
"blobIndex",
|
|
540
|
+
"signature",
|
|
541
|
+
"signersBitmap",
|
|
542
|
+
"message",
|
|
543
|
+
];
|
|
544
|
+
return (tx: Transaction) =>
|
|
545
|
+
tx.moveCall({
|
|
546
|
+
package: packageAddress,
|
|
547
|
+
module: "app",
|
|
548
|
+
function: "certify_article_blob",
|
|
549
|
+
arguments: normalizeMoveArguments(
|
|
550
|
+
options.arguments,
|
|
551
|
+
argumentsTypes,
|
|
552
|
+
parameterNames,
|
|
553
|
+
),
|
|
554
|
+
});
|
|
555
|
+
}
|
|
556
|
+
export interface DeleteArticleArguments {
|
|
557
|
+
config: RawTransactionArgument<string>;
|
|
558
|
+
studio: RawTransactionArgument<string>;
|
|
559
|
+
storageSpace: RawTransactionArgument<string>;
|
|
560
|
+
walrusSystem: RawTransactionArgument<string>;
|
|
561
|
+
articleId: RawTransactionArgument<string>;
|
|
562
|
+
}
|
|
563
|
+
export interface DeleteArticleOptions {
|
|
564
|
+
package?: string;
|
|
565
|
+
arguments:
|
|
566
|
+
| DeleteArticleArguments
|
|
567
|
+
| [
|
|
568
|
+
config: RawTransactionArgument<string>,
|
|
569
|
+
studio: RawTransactionArgument<string>,
|
|
570
|
+
storageSpace: RawTransactionArgument<string>,
|
|
571
|
+
walrusSystem: RawTransactionArgument<string>,
|
|
572
|
+
articleId: RawTransactionArgument<string>,
|
|
573
|
+
];
|
|
574
|
+
}
|
|
575
|
+
export function deleteArticle(options: DeleteArticleOptions) {
|
|
576
|
+
const packageAddress = options.package ?? "@local-pkg/zing_studio";
|
|
577
|
+
const argumentsTypes = [
|
|
578
|
+
`${packageAddress}::config::Config`,
|
|
579
|
+
`${packageAddress}::studio::Studio`,
|
|
580
|
+
`${packageAddress}::storage::StorageSpace`,
|
|
581
|
+
`${packageAddress}::system::System`,
|
|
582
|
+
"0x0000000000000000000000000000000000000000000000000000000000000002::object::ID",
|
|
583
|
+
"0x0000000000000000000000000000000000000000000000000000000000000002::clock::Clock",
|
|
584
|
+
] satisfies string[];
|
|
585
|
+
const parameterNames = [
|
|
586
|
+
"config",
|
|
587
|
+
"studio",
|
|
588
|
+
"storageSpace",
|
|
589
|
+
"walrusSystem",
|
|
590
|
+
"articleId",
|
|
591
|
+
];
|
|
592
|
+
return (tx: Transaction) =>
|
|
593
|
+
tx.moveCall({
|
|
594
|
+
package: packageAddress,
|
|
595
|
+
module: "app",
|
|
596
|
+
function: "delete_article",
|
|
597
|
+
arguments: normalizeMoveArguments(
|
|
598
|
+
options.arguments,
|
|
599
|
+
argumentsTypes,
|
|
600
|
+
parameterNames,
|
|
601
|
+
),
|
|
602
|
+
});
|
|
603
|
+
}
|
|
604
|
+
export interface BurnArticleArguments {
|
|
605
|
+
config: RawTransactionArgument<string>;
|
|
606
|
+
studio: RawTransactionArgument<string>;
|
|
607
|
+
storageTreasury: RawTransactionArgument<string>;
|
|
608
|
+
walrusSystem: RawTransactionArgument<string>;
|
|
609
|
+
articleId: RawTransactionArgument<string>;
|
|
610
|
+
}
|
|
611
|
+
export interface BurnArticleOptions {
|
|
612
|
+
package?: string;
|
|
613
|
+
arguments:
|
|
614
|
+
| BurnArticleArguments
|
|
615
|
+
| [
|
|
616
|
+
config: RawTransactionArgument<string>,
|
|
617
|
+
studio: RawTransactionArgument<string>,
|
|
618
|
+
storageTreasury: RawTransactionArgument<string>,
|
|
619
|
+
walrusSystem: RawTransactionArgument<string>,
|
|
620
|
+
articleId: RawTransactionArgument<string>,
|
|
621
|
+
];
|
|
622
|
+
}
|
|
623
|
+
export function burnArticle(options: BurnArticleOptions) {
|
|
624
|
+
const packageAddress = options.package ?? "@local-pkg/zing_studio";
|
|
625
|
+
const argumentsTypes = [
|
|
626
|
+
`${packageAddress}::config::Config`,
|
|
627
|
+
`${packageAddress}::studio::Studio`,
|
|
628
|
+
`${packageAddress}::storage::StorageTreasury`,
|
|
629
|
+
`${packageAddress}::system::System`,
|
|
630
|
+
"0x0000000000000000000000000000000000000000000000000000000000000002::object::ID",
|
|
631
|
+
"0x0000000000000000000000000000000000000000000000000000000000000002::clock::Clock",
|
|
632
|
+
] satisfies string[];
|
|
633
|
+
const parameterNames = [
|
|
634
|
+
"config",
|
|
635
|
+
"studio",
|
|
636
|
+
"storageTreasury",
|
|
637
|
+
"walrusSystem",
|
|
638
|
+
"articleId",
|
|
639
|
+
];
|
|
640
|
+
return (tx: Transaction) =>
|
|
641
|
+
tx.moveCall({
|
|
642
|
+
package: packageAddress,
|
|
643
|
+
module: "app",
|
|
644
|
+
function: "burn_article",
|
|
645
|
+
arguments: normalizeMoveArguments(
|
|
646
|
+
options.arguments,
|
|
647
|
+
argumentsTypes,
|
|
648
|
+
parameterNames,
|
|
649
|
+
),
|
|
650
|
+
});
|
|
651
|
+
}
|
|
652
|
+
export interface RenewArticleWithStorageTreasuryArguments {
|
|
653
|
+
config: RawTransactionArgument<string>;
|
|
654
|
+
studio: RawTransactionArgument<string>;
|
|
655
|
+
walrusSystem: RawTransactionArgument<string>;
|
|
656
|
+
storageTreasury: RawTransactionArgument<string>;
|
|
657
|
+
storageSpace: RawTransactionArgument<string>;
|
|
658
|
+
articleId: RawTransactionArgument<string>;
|
|
659
|
+
}
|
|
660
|
+
export interface RenewArticleWithStorageTreasuryOptions {
|
|
661
|
+
package?: string;
|
|
662
|
+
arguments:
|
|
663
|
+
| RenewArticleWithStorageTreasuryArguments
|
|
664
|
+
| [
|
|
665
|
+
config: RawTransactionArgument<string>,
|
|
666
|
+
studio: RawTransactionArgument<string>,
|
|
667
|
+
walrusSystem: RawTransactionArgument<string>,
|
|
668
|
+
storageTreasury: RawTransactionArgument<string>,
|
|
669
|
+
storageSpace: RawTransactionArgument<string>,
|
|
670
|
+
articleId: RawTransactionArgument<string>,
|
|
671
|
+
];
|
|
672
|
+
}
|
|
673
|
+
export function renewArticleWithStorageTreasury(
|
|
674
|
+
options: RenewArticleWithStorageTreasuryOptions,
|
|
675
|
+
) {
|
|
676
|
+
const packageAddress = options.package ?? "@local-pkg/zing_studio";
|
|
677
|
+
const argumentsTypes = [
|
|
678
|
+
`${packageAddress}::config::Config`,
|
|
679
|
+
`${packageAddress}::studio::Studio`,
|
|
680
|
+
`${packageAddress}::system::System`,
|
|
681
|
+
`${packageAddress}::storage::StorageTreasury`,
|
|
682
|
+
`${packageAddress}::storage::StorageSpace`,
|
|
683
|
+
"0x0000000000000000000000000000000000000000000000000000000000000002::object::ID",
|
|
684
|
+
"0x0000000000000000000000000000000000000000000000000000000000000002::clock::Clock",
|
|
685
|
+
] satisfies string[];
|
|
686
|
+
const parameterNames = [
|
|
687
|
+
"config",
|
|
688
|
+
"studio",
|
|
689
|
+
"walrusSystem",
|
|
690
|
+
"storageTreasury",
|
|
691
|
+
"storageSpace",
|
|
692
|
+
"articleId",
|
|
693
|
+
];
|
|
694
|
+
return (tx: Transaction) =>
|
|
695
|
+
tx.moveCall({
|
|
696
|
+
package: packageAddress,
|
|
697
|
+
module: "app",
|
|
698
|
+
function: "renew_article_with_storage_treasury",
|
|
699
|
+
arguments: normalizeMoveArguments(
|
|
700
|
+
options.arguments,
|
|
701
|
+
argumentsTypes,
|
|
702
|
+
parameterNames,
|
|
703
|
+
),
|
|
704
|
+
});
|
|
705
|
+
}
|
|
706
|
+
export interface RenewArticleWithWalPaymentArguments {
|
|
707
|
+
config: RawTransactionArgument<string>;
|
|
708
|
+
studio: RawTransactionArgument<string>;
|
|
709
|
+
walrusSystem: RawTransactionArgument<string>;
|
|
710
|
+
articleId: RawTransactionArgument<string>;
|
|
711
|
+
payment: RawTransactionArgument<string>;
|
|
712
|
+
}
|
|
713
|
+
export interface RenewArticleWithWalPaymentOptions {
|
|
714
|
+
package?: string;
|
|
715
|
+
arguments:
|
|
716
|
+
| RenewArticleWithWalPaymentArguments
|
|
717
|
+
| [
|
|
718
|
+
config: RawTransactionArgument<string>,
|
|
719
|
+
studio: RawTransactionArgument<string>,
|
|
720
|
+
walrusSystem: RawTransactionArgument<string>,
|
|
721
|
+
articleId: RawTransactionArgument<string>,
|
|
722
|
+
payment: RawTransactionArgument<string>,
|
|
723
|
+
];
|
|
724
|
+
}
|
|
725
|
+
export function renewArticleWithWalPayment(
|
|
726
|
+
options: RenewArticleWithWalPaymentOptions,
|
|
727
|
+
) {
|
|
728
|
+
const packageAddress = options.package ?? "@local-pkg/zing_studio";
|
|
729
|
+
const argumentsTypes = [
|
|
730
|
+
`${packageAddress}::config::Config`,
|
|
731
|
+
`${packageAddress}::studio::Studio`,
|
|
732
|
+
`${packageAddress}::system::System`,
|
|
733
|
+
"0x0000000000000000000000000000000000000000000000000000000000000002::object::ID",
|
|
734
|
+
`0x0000000000000000000000000000000000000000000000000000000000000002::coin::Coin<${packageAddress}::wal::WAL>`,
|
|
735
|
+
"0x0000000000000000000000000000000000000000000000000000000000000002::clock::Clock",
|
|
736
|
+
] satisfies string[];
|
|
737
|
+
const parameterNames = [
|
|
738
|
+
"config",
|
|
739
|
+
"studio",
|
|
740
|
+
"walrusSystem",
|
|
741
|
+
"articleId",
|
|
742
|
+
"payment",
|
|
743
|
+
];
|
|
744
|
+
return (tx: Transaction) =>
|
|
745
|
+
tx.moveCall({
|
|
746
|
+
package: packageAddress,
|
|
747
|
+
module: "app",
|
|
748
|
+
function: "renew_article_with_wal_payment",
|
|
749
|
+
arguments: normalizeMoveArguments(
|
|
750
|
+
options.arguments,
|
|
751
|
+
argumentsTypes,
|
|
752
|
+
parameterNames,
|
|
753
|
+
),
|
|
754
|
+
});
|
|
755
|
+
}
|
|
756
|
+
export interface UpdateArticleSubscriptionLevelArguments {
|
|
757
|
+
config: RawTransactionArgument<string>;
|
|
758
|
+
studio: RawTransactionArgument<string>;
|
|
759
|
+
walrusSystem: RawTransactionArgument<string>;
|
|
760
|
+
articleId: RawTransactionArgument<string>;
|
|
761
|
+
subscriptionLevel: RawTransactionArgument<number | null>;
|
|
762
|
+
}
|
|
763
|
+
export interface UpdateArticleSubscriptionLevelOptions {
|
|
764
|
+
package?: string;
|
|
765
|
+
arguments:
|
|
766
|
+
| UpdateArticleSubscriptionLevelArguments
|
|
767
|
+
| [
|
|
768
|
+
config: RawTransactionArgument<string>,
|
|
769
|
+
studio: RawTransactionArgument<string>,
|
|
770
|
+
walrusSystem: RawTransactionArgument<string>,
|
|
771
|
+
articleId: RawTransactionArgument<string>,
|
|
772
|
+
subscriptionLevel: RawTransactionArgument<number | null>,
|
|
773
|
+
];
|
|
774
|
+
}
|
|
775
|
+
export function updateArticleSubscriptionLevel(
|
|
776
|
+
options: UpdateArticleSubscriptionLevelOptions,
|
|
777
|
+
) {
|
|
778
|
+
const packageAddress = options.package ?? "@local-pkg/zing_studio";
|
|
779
|
+
const argumentsTypes = [
|
|
780
|
+
`${packageAddress}::config::Config`,
|
|
781
|
+
`${packageAddress}::studio::Studio`,
|
|
782
|
+
`${packageAddress}::system::System`,
|
|
783
|
+
"0x0000000000000000000000000000000000000000000000000000000000000002::object::ID",
|
|
784
|
+
"0x0000000000000000000000000000000000000000000000000000000000000001::option::Option<u8>",
|
|
785
|
+
"0x0000000000000000000000000000000000000000000000000000000000000002::clock::Clock",
|
|
786
|
+
] satisfies string[];
|
|
787
|
+
const parameterNames = [
|
|
788
|
+
"config",
|
|
789
|
+
"studio",
|
|
790
|
+
"walrusSystem",
|
|
791
|
+
"articleId",
|
|
792
|
+
"subscriptionLevel",
|
|
793
|
+
];
|
|
794
|
+
return (tx: Transaction) =>
|
|
795
|
+
tx.moveCall({
|
|
796
|
+
package: packageAddress,
|
|
797
|
+
module: "app",
|
|
798
|
+
function: "update_article_subscription_level",
|
|
799
|
+
arguments: normalizeMoveArguments(
|
|
800
|
+
options.arguments,
|
|
801
|
+
argumentsTypes,
|
|
802
|
+
parameterNames,
|
|
803
|
+
),
|
|
804
|
+
});
|
|
805
|
+
}
|
|
806
|
+
export interface DonateArguments {
|
|
807
|
+
config: RawTransactionArgument<string>;
|
|
808
|
+
studio: RawTransactionArgument<string>;
|
|
809
|
+
treasury: RawTransactionArgument<string>;
|
|
810
|
+
message: RawTransactionArgument<string>;
|
|
811
|
+
donation: RawTransactionArgument<string>;
|
|
812
|
+
}
|
|
813
|
+
export interface DonateOptions {
|
|
814
|
+
package?: string;
|
|
815
|
+
arguments:
|
|
816
|
+
| DonateArguments
|
|
817
|
+
| [
|
|
818
|
+
config: RawTransactionArgument<string>,
|
|
819
|
+
studio: RawTransactionArgument<string>,
|
|
820
|
+
treasury: RawTransactionArgument<string>,
|
|
821
|
+
message: RawTransactionArgument<string>,
|
|
822
|
+
donation: RawTransactionArgument<string>,
|
|
823
|
+
];
|
|
824
|
+
typeArguments: [string];
|
|
825
|
+
}
|
|
826
|
+
export function donate(options: DonateOptions) {
|
|
827
|
+
const packageAddress = options.package ?? "@local-pkg/zing_studio";
|
|
828
|
+
const argumentsTypes = [
|
|
829
|
+
`${packageAddress}::config::Config`,
|
|
830
|
+
`${packageAddress}::studio::Studio`,
|
|
831
|
+
`${packageAddress}::treasury::Treasury`,
|
|
832
|
+
"0x0000000000000000000000000000000000000000000000000000000000000001::string::String",
|
|
833
|
+
`0x0000000000000000000000000000000000000000000000000000000000000002::coin::Coin<${options.typeArguments[0]}>`,
|
|
834
|
+
"0x0000000000000000000000000000000000000000000000000000000000000002::clock::Clock",
|
|
835
|
+
] satisfies string[];
|
|
836
|
+
const parameterNames = [
|
|
837
|
+
"config",
|
|
838
|
+
"studio",
|
|
839
|
+
"treasury",
|
|
840
|
+
"message",
|
|
841
|
+
"donation",
|
|
842
|
+
];
|
|
843
|
+
return (tx: Transaction) =>
|
|
844
|
+
tx.moveCall({
|
|
845
|
+
package: packageAddress,
|
|
846
|
+
module: "app",
|
|
847
|
+
function: "donate",
|
|
848
|
+
arguments: normalizeMoveArguments(
|
|
849
|
+
options.arguments,
|
|
850
|
+
argumentsTypes,
|
|
851
|
+
parameterNames,
|
|
852
|
+
),
|
|
853
|
+
typeArguments: options.typeArguments,
|
|
854
|
+
});
|
|
855
|
+
}
|