@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,598 @@
|
|
|
1
|
+
/**************************************************************
|
|
2
|
+
* THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
|
|
3
|
+
**************************************************************/
|
|
4
|
+
import * as object from "./deps/sui/object.js";
|
|
5
|
+
import * as vec_map from "./deps/sui/vec_map.js";
|
|
6
|
+
import * as blob from "./deps/walrus/blob.js";
|
|
7
|
+
import { MoveStruct, normalizeMoveArguments } from "../utils/index.js";
|
|
8
|
+
import { bcs } from "@mysten/sui/bcs";
|
|
9
|
+
import type { RawTransactionArgument } from "../utils/index.js";
|
|
10
|
+
import type { Transaction } from "@mysten/sui/transactions";
|
|
11
|
+
|
|
12
|
+
const $moduleName = "@local-pkg/zing_studio::article";
|
|
13
|
+
export const File = new MoveStruct({
|
|
14
|
+
name: `${$moduleName}::File`,
|
|
15
|
+
fields: {
|
|
16
|
+
/**
|
|
17
|
+
* Whether the file is publicly accessible Index of the blob containing this file's
|
|
18
|
+
* data
|
|
19
|
+
*/
|
|
20
|
+
blob_index: bcs.u64(),
|
|
21
|
+
/** MIME type of the file */
|
|
22
|
+
mime_type: bcs.string(),
|
|
23
|
+
/** Size of the file in bytes */
|
|
24
|
+
size: bcs.u64(),
|
|
25
|
+
},
|
|
26
|
+
});
|
|
27
|
+
export const PublishArticleEvent = new MoveStruct({
|
|
28
|
+
name: `${$moduleName}::PublishArticleEvent`,
|
|
29
|
+
fields: {
|
|
30
|
+
article_id: bcs.Address,
|
|
31
|
+
owner: bcs.Address,
|
|
32
|
+
blob_ids: bcs.vector(bcs.u256()),
|
|
33
|
+
blob_sizes: bcs.vector(bcs.u64()),
|
|
34
|
+
blob_storage_sizes: bcs.vector(bcs.u64()),
|
|
35
|
+
blob_end_epochs: bcs.vector(bcs.u32()),
|
|
36
|
+
files: vec_map.VecMap(bcs.string(), File),
|
|
37
|
+
timestamp_ms: bcs.u64(),
|
|
38
|
+
},
|
|
39
|
+
});
|
|
40
|
+
export const BurnArticleEvent = new MoveStruct({
|
|
41
|
+
name: `${$moduleName}::BurnArticleEvent`,
|
|
42
|
+
fields: {
|
|
43
|
+
article_id: bcs.Address,
|
|
44
|
+
owner: bcs.Address,
|
|
45
|
+
current_epoch: bcs.u32(),
|
|
46
|
+
blob_end_epochs: bcs.vector(bcs.u32()),
|
|
47
|
+
timestamp_ms: bcs.u64(),
|
|
48
|
+
},
|
|
49
|
+
});
|
|
50
|
+
export const RenewArticleEvent = new MoveStruct({
|
|
51
|
+
name: `${$moduleName}::RenewArticleEvent`,
|
|
52
|
+
fields: {
|
|
53
|
+
article_id: bcs.Address,
|
|
54
|
+
owner: bcs.Address,
|
|
55
|
+
current_epoch: bcs.u32(),
|
|
56
|
+
prev_blob_end_epochs: bcs.vector(bcs.u32()),
|
|
57
|
+
new_blob_end_epochs: bcs.vector(bcs.u32()),
|
|
58
|
+
},
|
|
59
|
+
});
|
|
60
|
+
export const ARTICLE = new MoveStruct({
|
|
61
|
+
name: `${$moduleName}::ARTICLE`,
|
|
62
|
+
fields: {
|
|
63
|
+
dummy_field: bcs.bool(),
|
|
64
|
+
},
|
|
65
|
+
});
|
|
66
|
+
export const Article = new MoveStruct({
|
|
67
|
+
name: `${$moduleName}::Article`,
|
|
68
|
+
fields: {
|
|
69
|
+
id: object.UID,
|
|
70
|
+
owner: bcs.Address,
|
|
71
|
+
deleted: bcs.bool(),
|
|
72
|
+
created_at: bcs.u64(),
|
|
73
|
+
subscription_level: bcs.option(bcs.u8()),
|
|
74
|
+
/**
|
|
75
|
+
* Storage blobs containing the article content (all blobs must have compatible
|
|
76
|
+
* properties)
|
|
77
|
+
*/
|
|
78
|
+
blobs: bcs.vector(blob.Blob),
|
|
79
|
+
/** Maps file identifiers to their corresponding metadata */
|
|
80
|
+
files: vec_map.VecMap(bcs.string(), File),
|
|
81
|
+
},
|
|
82
|
+
});
|
|
83
|
+
export interface OwnerArguments {
|
|
84
|
+
self: RawTransactionArgument<string>;
|
|
85
|
+
}
|
|
86
|
+
export interface OwnerOptions {
|
|
87
|
+
package?: string;
|
|
88
|
+
arguments: OwnerArguments | [self: RawTransactionArgument<string>];
|
|
89
|
+
}
|
|
90
|
+
export function owner(options: OwnerOptions) {
|
|
91
|
+
const packageAddress = options.package ?? "@local-pkg/zing_studio";
|
|
92
|
+
const argumentsTypes = [
|
|
93
|
+
`${packageAddress}::article::Article`,
|
|
94
|
+
] satisfies string[];
|
|
95
|
+
const parameterNames = ["self"];
|
|
96
|
+
return (tx: Transaction) =>
|
|
97
|
+
tx.moveCall({
|
|
98
|
+
package: packageAddress,
|
|
99
|
+
module: "article",
|
|
100
|
+
function: "owner",
|
|
101
|
+
arguments: normalizeMoveArguments(
|
|
102
|
+
options.arguments,
|
|
103
|
+
argumentsTypes,
|
|
104
|
+
parameterNames,
|
|
105
|
+
),
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
export interface DeletedArguments {
|
|
109
|
+
self: RawTransactionArgument<string>;
|
|
110
|
+
}
|
|
111
|
+
export interface DeletedOptions {
|
|
112
|
+
package?: string;
|
|
113
|
+
arguments: DeletedArguments | [self: RawTransactionArgument<string>];
|
|
114
|
+
}
|
|
115
|
+
export function deleted(options: DeletedOptions) {
|
|
116
|
+
const packageAddress = options.package ?? "@local-pkg/zing_studio";
|
|
117
|
+
const argumentsTypes = [
|
|
118
|
+
`${packageAddress}::article::Article`,
|
|
119
|
+
] satisfies string[];
|
|
120
|
+
const parameterNames = ["self"];
|
|
121
|
+
return (tx: Transaction) =>
|
|
122
|
+
tx.moveCall({
|
|
123
|
+
package: packageAddress,
|
|
124
|
+
module: "article",
|
|
125
|
+
function: "deleted",
|
|
126
|
+
arguments: normalizeMoveArguments(
|
|
127
|
+
options.arguments,
|
|
128
|
+
argumentsTypes,
|
|
129
|
+
parameterNames,
|
|
130
|
+
),
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
export interface CreatedAtArguments {
|
|
134
|
+
self: RawTransactionArgument<string>;
|
|
135
|
+
}
|
|
136
|
+
export interface CreatedAtOptions {
|
|
137
|
+
package?: string;
|
|
138
|
+
arguments: CreatedAtArguments | [self: RawTransactionArgument<string>];
|
|
139
|
+
}
|
|
140
|
+
export function createdAt(options: CreatedAtOptions) {
|
|
141
|
+
const packageAddress = options.package ?? "@local-pkg/zing_studio";
|
|
142
|
+
const argumentsTypes = [
|
|
143
|
+
`${packageAddress}::article::Article`,
|
|
144
|
+
] satisfies string[];
|
|
145
|
+
const parameterNames = ["self"];
|
|
146
|
+
return (tx: Transaction) =>
|
|
147
|
+
tx.moveCall({
|
|
148
|
+
package: packageAddress,
|
|
149
|
+
module: "article",
|
|
150
|
+
function: "created_at",
|
|
151
|
+
arguments: normalizeMoveArguments(
|
|
152
|
+
options.arguments,
|
|
153
|
+
argumentsTypes,
|
|
154
|
+
parameterNames,
|
|
155
|
+
),
|
|
156
|
+
});
|
|
157
|
+
}
|
|
158
|
+
export interface SubscriptionLevelArguments {
|
|
159
|
+
self: RawTransactionArgument<string>;
|
|
160
|
+
}
|
|
161
|
+
export interface SubscriptionLevelOptions {
|
|
162
|
+
package?: string;
|
|
163
|
+
arguments:
|
|
164
|
+
| SubscriptionLevelArguments
|
|
165
|
+
| [self: RawTransactionArgument<string>];
|
|
166
|
+
}
|
|
167
|
+
export function subscriptionLevel(options: SubscriptionLevelOptions) {
|
|
168
|
+
const packageAddress = options.package ?? "@local-pkg/zing_studio";
|
|
169
|
+
const argumentsTypes = [
|
|
170
|
+
`${packageAddress}::article::Article`,
|
|
171
|
+
] satisfies string[];
|
|
172
|
+
const parameterNames = ["self"];
|
|
173
|
+
return (tx: Transaction) =>
|
|
174
|
+
tx.moveCall({
|
|
175
|
+
package: packageAddress,
|
|
176
|
+
module: "article",
|
|
177
|
+
function: "subscription_level",
|
|
178
|
+
arguments: normalizeMoveArguments(
|
|
179
|
+
options.arguments,
|
|
180
|
+
argumentsTypes,
|
|
181
|
+
parameterNames,
|
|
182
|
+
),
|
|
183
|
+
});
|
|
184
|
+
}
|
|
185
|
+
export interface BlobsArguments {
|
|
186
|
+
self: RawTransactionArgument<string>;
|
|
187
|
+
}
|
|
188
|
+
export interface BlobsOptions {
|
|
189
|
+
package?: string;
|
|
190
|
+
arguments: BlobsArguments | [self: RawTransactionArgument<string>];
|
|
191
|
+
}
|
|
192
|
+
export function blobs(options: BlobsOptions) {
|
|
193
|
+
const packageAddress = options.package ?? "@local-pkg/zing_studio";
|
|
194
|
+
const argumentsTypes = [
|
|
195
|
+
`${packageAddress}::article::Article`,
|
|
196
|
+
] satisfies string[];
|
|
197
|
+
const parameterNames = ["self"];
|
|
198
|
+
return (tx: Transaction) =>
|
|
199
|
+
tx.moveCall({
|
|
200
|
+
package: packageAddress,
|
|
201
|
+
module: "article",
|
|
202
|
+
function: "blobs",
|
|
203
|
+
arguments: normalizeMoveArguments(
|
|
204
|
+
options.arguments,
|
|
205
|
+
argumentsTypes,
|
|
206
|
+
parameterNames,
|
|
207
|
+
),
|
|
208
|
+
});
|
|
209
|
+
}
|
|
210
|
+
export interface FilesArguments {
|
|
211
|
+
self: RawTransactionArgument<string>;
|
|
212
|
+
}
|
|
213
|
+
export interface FilesOptions {
|
|
214
|
+
package?: string;
|
|
215
|
+
arguments: FilesArguments | [self: RawTransactionArgument<string>];
|
|
216
|
+
}
|
|
217
|
+
export function files(options: FilesOptions) {
|
|
218
|
+
const packageAddress = options.package ?? "@local-pkg/zing_studio";
|
|
219
|
+
const argumentsTypes = [
|
|
220
|
+
`${packageAddress}::article::Article`,
|
|
221
|
+
] satisfies string[];
|
|
222
|
+
const parameterNames = ["self"];
|
|
223
|
+
return (tx: Transaction) =>
|
|
224
|
+
tx.moveCall({
|
|
225
|
+
package: packageAddress,
|
|
226
|
+
module: "article",
|
|
227
|
+
function: "files",
|
|
228
|
+
arguments: normalizeMoveArguments(
|
|
229
|
+
options.arguments,
|
|
230
|
+
argumentsTypes,
|
|
231
|
+
parameterNames,
|
|
232
|
+
),
|
|
233
|
+
});
|
|
234
|
+
}
|
|
235
|
+
export interface EndEpochArguments {
|
|
236
|
+
self: RawTransactionArgument<string>;
|
|
237
|
+
}
|
|
238
|
+
export interface EndEpochOptions {
|
|
239
|
+
package?: string;
|
|
240
|
+
arguments: EndEpochArguments | [self: RawTransactionArgument<string>];
|
|
241
|
+
}
|
|
242
|
+
/**
|
|
243
|
+
* Returns the end epoch of the article (assumes all blobs have the same end epoch)
|
|
244
|
+
* SECURITY NOTE: This function assumes blobs[0] exists and all blobs have the same
|
|
245
|
+
* end epoch
|
|
246
|
+
*/
|
|
247
|
+
export function endEpoch(options: EndEpochOptions) {
|
|
248
|
+
const packageAddress = options.package ?? "@local-pkg/zing_studio";
|
|
249
|
+
const argumentsTypes = [
|
|
250
|
+
`${packageAddress}::article::Article`,
|
|
251
|
+
] satisfies string[];
|
|
252
|
+
const parameterNames = ["self"];
|
|
253
|
+
return (tx: Transaction) =>
|
|
254
|
+
tx.moveCall({
|
|
255
|
+
package: packageAddress,
|
|
256
|
+
module: "article",
|
|
257
|
+
function: "end_epoch",
|
|
258
|
+
arguments: normalizeMoveArguments(
|
|
259
|
+
options.arguments,
|
|
260
|
+
argumentsTypes,
|
|
261
|
+
parameterNames,
|
|
262
|
+
),
|
|
263
|
+
});
|
|
264
|
+
}
|
|
265
|
+
export interface TotalBlobSizeArguments {
|
|
266
|
+
self: RawTransactionArgument<string>;
|
|
267
|
+
}
|
|
268
|
+
export interface TotalBlobSizeOptions {
|
|
269
|
+
package?: string;
|
|
270
|
+
arguments: TotalBlobSizeArguments | [self: RawTransactionArgument<string>];
|
|
271
|
+
}
|
|
272
|
+
/** Calculates the total size of all blobs in the article */
|
|
273
|
+
export function totalBlobSize(options: TotalBlobSizeOptions) {
|
|
274
|
+
const packageAddress = options.package ?? "@local-pkg/zing_studio";
|
|
275
|
+
const argumentsTypes = [
|
|
276
|
+
`${packageAddress}::article::Article`,
|
|
277
|
+
] satisfies string[];
|
|
278
|
+
const parameterNames = ["self"];
|
|
279
|
+
return (tx: Transaction) =>
|
|
280
|
+
tx.moveCall({
|
|
281
|
+
package: packageAddress,
|
|
282
|
+
module: "article",
|
|
283
|
+
function: "total_blob_size",
|
|
284
|
+
arguments: normalizeMoveArguments(
|
|
285
|
+
options.arguments,
|
|
286
|
+
argumentsTypes,
|
|
287
|
+
parameterNames,
|
|
288
|
+
),
|
|
289
|
+
});
|
|
290
|
+
}
|
|
291
|
+
export interface IsExpiredArguments {
|
|
292
|
+
self: RawTransactionArgument<string>;
|
|
293
|
+
walrusSystem: RawTransactionArgument<string>;
|
|
294
|
+
}
|
|
295
|
+
export interface IsExpiredOptions {
|
|
296
|
+
package?: string;
|
|
297
|
+
arguments:
|
|
298
|
+
| IsExpiredArguments
|
|
299
|
+
| [
|
|
300
|
+
self: RawTransactionArgument<string>,
|
|
301
|
+
walrusSystem: RawTransactionArgument<string>,
|
|
302
|
+
];
|
|
303
|
+
}
|
|
304
|
+
export function isExpired(options: IsExpiredOptions) {
|
|
305
|
+
const packageAddress = options.package ?? "@local-pkg/zing_studio";
|
|
306
|
+
const argumentsTypes = [
|
|
307
|
+
`${packageAddress}::article::Article`,
|
|
308
|
+
`${packageAddress}::system::System`,
|
|
309
|
+
] satisfies string[];
|
|
310
|
+
const parameterNames = ["self", "walrusSystem"];
|
|
311
|
+
return (tx: Transaction) =>
|
|
312
|
+
tx.moveCall({
|
|
313
|
+
package: packageAddress,
|
|
314
|
+
module: "article",
|
|
315
|
+
function: "is_expired",
|
|
316
|
+
arguments: normalizeMoveArguments(
|
|
317
|
+
options.arguments,
|
|
318
|
+
argumentsTypes,
|
|
319
|
+
parameterNames,
|
|
320
|
+
),
|
|
321
|
+
});
|
|
322
|
+
}
|
|
323
|
+
export interface IsPublicArguments {
|
|
324
|
+
self: RawTransactionArgument<string>;
|
|
325
|
+
}
|
|
326
|
+
export interface IsPublicOptions {
|
|
327
|
+
package?: string;
|
|
328
|
+
arguments: IsPublicArguments | [self: RawTransactionArgument<string>];
|
|
329
|
+
}
|
|
330
|
+
export function isPublic(options: IsPublicOptions) {
|
|
331
|
+
const packageAddress = options.package ?? "@local-pkg/zing_studio";
|
|
332
|
+
const argumentsTypes = [
|
|
333
|
+
`${packageAddress}::article::Article`,
|
|
334
|
+
] satisfies string[];
|
|
335
|
+
const parameterNames = ["self"];
|
|
336
|
+
return (tx: Transaction) =>
|
|
337
|
+
tx.moveCall({
|
|
338
|
+
package: packageAddress,
|
|
339
|
+
module: "article",
|
|
340
|
+
function: "is_public",
|
|
341
|
+
arguments: normalizeMoveArguments(
|
|
342
|
+
options.arguments,
|
|
343
|
+
argumentsTypes,
|
|
344
|
+
parameterNames,
|
|
345
|
+
),
|
|
346
|
+
});
|
|
347
|
+
}
|
|
348
|
+
export interface BlobIndexArguments {
|
|
349
|
+
file: RawTransactionArgument<string>;
|
|
350
|
+
}
|
|
351
|
+
export interface BlobIndexOptions {
|
|
352
|
+
package?: string;
|
|
353
|
+
arguments: BlobIndexArguments | [file: RawTransactionArgument<string>];
|
|
354
|
+
}
|
|
355
|
+
export function blobIndex(options: BlobIndexOptions) {
|
|
356
|
+
const packageAddress = options.package ?? "@local-pkg/zing_studio";
|
|
357
|
+
const argumentsTypes = [
|
|
358
|
+
`${packageAddress}::article::File`,
|
|
359
|
+
] satisfies string[];
|
|
360
|
+
const parameterNames = ["file"];
|
|
361
|
+
return (tx: Transaction) =>
|
|
362
|
+
tx.moveCall({
|
|
363
|
+
package: packageAddress,
|
|
364
|
+
module: "article",
|
|
365
|
+
function: "blob_index",
|
|
366
|
+
arguments: normalizeMoveArguments(
|
|
367
|
+
options.arguments,
|
|
368
|
+
argumentsTypes,
|
|
369
|
+
parameterNames,
|
|
370
|
+
),
|
|
371
|
+
});
|
|
372
|
+
}
|
|
373
|
+
export interface MimeTypeArguments {
|
|
374
|
+
file: RawTransactionArgument<string>;
|
|
375
|
+
}
|
|
376
|
+
export interface MimeTypeOptions {
|
|
377
|
+
package?: string;
|
|
378
|
+
arguments: MimeTypeArguments | [file: RawTransactionArgument<string>];
|
|
379
|
+
}
|
|
380
|
+
export function mimeType(options: MimeTypeOptions) {
|
|
381
|
+
const packageAddress = options.package ?? "@local-pkg/zing_studio";
|
|
382
|
+
const argumentsTypes = [
|
|
383
|
+
`${packageAddress}::article::File`,
|
|
384
|
+
] satisfies string[];
|
|
385
|
+
const parameterNames = ["file"];
|
|
386
|
+
return (tx: Transaction) =>
|
|
387
|
+
tx.moveCall({
|
|
388
|
+
package: packageAddress,
|
|
389
|
+
module: "article",
|
|
390
|
+
function: "mime_type",
|
|
391
|
+
arguments: normalizeMoveArguments(
|
|
392
|
+
options.arguments,
|
|
393
|
+
argumentsTypes,
|
|
394
|
+
parameterNames,
|
|
395
|
+
),
|
|
396
|
+
});
|
|
397
|
+
}
|
|
398
|
+
export interface FileSizeArguments {
|
|
399
|
+
file: RawTransactionArgument<string>;
|
|
400
|
+
}
|
|
401
|
+
export interface FileSizeOptions {
|
|
402
|
+
package?: string;
|
|
403
|
+
arguments: FileSizeArguments | [file: RawTransactionArgument<string>];
|
|
404
|
+
}
|
|
405
|
+
export function fileSize(options: FileSizeOptions) {
|
|
406
|
+
const packageAddress = options.package ?? "@local-pkg/zing_studio";
|
|
407
|
+
const argumentsTypes = [
|
|
408
|
+
`${packageAddress}::article::File`,
|
|
409
|
+
] satisfies string[];
|
|
410
|
+
const parameterNames = ["file"];
|
|
411
|
+
return (tx: Transaction) =>
|
|
412
|
+
tx.moveCall({
|
|
413
|
+
package: packageAddress,
|
|
414
|
+
module: "article",
|
|
415
|
+
function: "file_size",
|
|
416
|
+
arguments: normalizeMoveArguments(
|
|
417
|
+
options.arguments,
|
|
418
|
+
argumentsTypes,
|
|
419
|
+
parameterNames,
|
|
420
|
+
),
|
|
421
|
+
});
|
|
422
|
+
}
|
|
423
|
+
export interface ArticleBlobAddMetadataArguments {
|
|
424
|
+
config: RawTransactionArgument<string>;
|
|
425
|
+
self: RawTransactionArgument<string>;
|
|
426
|
+
blobIndex: RawTransactionArgument<number | bigint>;
|
|
427
|
+
metadata: RawTransactionArgument<string>;
|
|
428
|
+
}
|
|
429
|
+
export interface ArticleBlobAddMetadataOptions {
|
|
430
|
+
package?: string;
|
|
431
|
+
arguments:
|
|
432
|
+
| ArticleBlobAddMetadataArguments
|
|
433
|
+
| [
|
|
434
|
+
config: RawTransactionArgument<string>,
|
|
435
|
+
self: RawTransactionArgument<string>,
|
|
436
|
+
blobIndex: RawTransactionArgument<number | bigint>,
|
|
437
|
+
metadata: RawTransactionArgument<string>,
|
|
438
|
+
];
|
|
439
|
+
}
|
|
440
|
+
export function articleBlobAddMetadata(options: ArticleBlobAddMetadataOptions) {
|
|
441
|
+
const packageAddress = options.package ?? "@local-pkg/zing_studio";
|
|
442
|
+
const argumentsTypes = [
|
|
443
|
+
`${packageAddress}::config::Config`,
|
|
444
|
+
`${packageAddress}::article::Article`,
|
|
445
|
+
"u64",
|
|
446
|
+
`${packageAddress}::metadata::Metadata`,
|
|
447
|
+
] satisfies string[];
|
|
448
|
+
const parameterNames = ["config", "self", "blobIndex", "metadata"];
|
|
449
|
+
return (tx: Transaction) =>
|
|
450
|
+
tx.moveCall({
|
|
451
|
+
package: packageAddress,
|
|
452
|
+
module: "article",
|
|
453
|
+
function: "article_blob_add_metadata",
|
|
454
|
+
arguments: normalizeMoveArguments(
|
|
455
|
+
options.arguments,
|
|
456
|
+
argumentsTypes,
|
|
457
|
+
parameterNames,
|
|
458
|
+
),
|
|
459
|
+
});
|
|
460
|
+
}
|
|
461
|
+
export interface ArticleBlobRemoveMetadataArguments {
|
|
462
|
+
config: RawTransactionArgument<string>;
|
|
463
|
+
self: RawTransactionArgument<string>;
|
|
464
|
+
blobIndex: RawTransactionArgument<number | bigint>;
|
|
465
|
+
key: RawTransactionArgument<string>;
|
|
466
|
+
}
|
|
467
|
+
export interface ArticleBlobRemoveMetadataOptions {
|
|
468
|
+
package?: string;
|
|
469
|
+
arguments:
|
|
470
|
+
| ArticleBlobRemoveMetadataArguments
|
|
471
|
+
| [
|
|
472
|
+
config: RawTransactionArgument<string>,
|
|
473
|
+
self: RawTransactionArgument<string>,
|
|
474
|
+
blobIndex: RawTransactionArgument<number | bigint>,
|
|
475
|
+
key: RawTransactionArgument<string>,
|
|
476
|
+
];
|
|
477
|
+
}
|
|
478
|
+
export function articleBlobRemoveMetadata(
|
|
479
|
+
options: ArticleBlobRemoveMetadataOptions,
|
|
480
|
+
) {
|
|
481
|
+
const packageAddress = options.package ?? "@local-pkg/zing_studio";
|
|
482
|
+
const argumentsTypes = [
|
|
483
|
+
`${packageAddress}::config::Config`,
|
|
484
|
+
`${packageAddress}::article::Article`,
|
|
485
|
+
"u64",
|
|
486
|
+
"0x0000000000000000000000000000000000000000000000000000000000000001::string::String",
|
|
487
|
+
] satisfies string[];
|
|
488
|
+
const parameterNames = ["config", "self", "blobIndex", "key"];
|
|
489
|
+
return (tx: Transaction) =>
|
|
490
|
+
tx.moveCall({
|
|
491
|
+
package: packageAddress,
|
|
492
|
+
module: "article",
|
|
493
|
+
function: "article_blob_remove_metadata",
|
|
494
|
+
arguments: normalizeMoveArguments(
|
|
495
|
+
options.arguments,
|
|
496
|
+
argumentsTypes,
|
|
497
|
+
parameterNames,
|
|
498
|
+
),
|
|
499
|
+
});
|
|
500
|
+
}
|
|
501
|
+
export interface ArticleBlobInsertOrUpdateMetadataPairArguments {
|
|
502
|
+
config: RawTransactionArgument<string>;
|
|
503
|
+
self: RawTransactionArgument<string>;
|
|
504
|
+
blobIndex: RawTransactionArgument<number | bigint>;
|
|
505
|
+
key: RawTransactionArgument<string>;
|
|
506
|
+
value: RawTransactionArgument<string>;
|
|
507
|
+
}
|
|
508
|
+
export interface ArticleBlobInsertOrUpdateMetadataPairOptions {
|
|
509
|
+
package?: string;
|
|
510
|
+
arguments:
|
|
511
|
+
| ArticleBlobInsertOrUpdateMetadataPairArguments
|
|
512
|
+
| [
|
|
513
|
+
config: RawTransactionArgument<string>,
|
|
514
|
+
self: RawTransactionArgument<string>,
|
|
515
|
+
blobIndex: RawTransactionArgument<number | bigint>,
|
|
516
|
+
key: RawTransactionArgument<string>,
|
|
517
|
+
value: RawTransactionArgument<string>,
|
|
518
|
+
];
|
|
519
|
+
}
|
|
520
|
+
export function articleBlobInsertOrUpdateMetadataPair(
|
|
521
|
+
options: ArticleBlobInsertOrUpdateMetadataPairOptions,
|
|
522
|
+
) {
|
|
523
|
+
const packageAddress = options.package ?? "@local-pkg/zing_studio";
|
|
524
|
+
const argumentsTypes = [
|
|
525
|
+
`${packageAddress}::config::Config`,
|
|
526
|
+
`${packageAddress}::article::Article`,
|
|
527
|
+
"u64",
|
|
528
|
+
"0x0000000000000000000000000000000000000000000000000000000000000001::string::String",
|
|
529
|
+
"0x0000000000000000000000000000000000000000000000000000000000000001::string::String",
|
|
530
|
+
] satisfies string[];
|
|
531
|
+
const parameterNames = ["config", "self", "blobIndex", "key", "value"];
|
|
532
|
+
return (tx: Transaction) =>
|
|
533
|
+
tx.moveCall({
|
|
534
|
+
package: packageAddress,
|
|
535
|
+
module: "article",
|
|
536
|
+
function: "article_blob_insert_or_update_metadata_pair",
|
|
537
|
+
arguments: normalizeMoveArguments(
|
|
538
|
+
options.arguments,
|
|
539
|
+
argumentsTypes,
|
|
540
|
+
parameterNames,
|
|
541
|
+
),
|
|
542
|
+
});
|
|
543
|
+
}
|
|
544
|
+
export interface CertifyArticleBlobArguments {
|
|
545
|
+
config: RawTransactionArgument<string>;
|
|
546
|
+
self: RawTransactionArgument<string>;
|
|
547
|
+
walrusSystem: RawTransactionArgument<string>;
|
|
548
|
+
blobIndex: RawTransactionArgument<number | bigint>;
|
|
549
|
+
signature: RawTransactionArgument<number[]>;
|
|
550
|
+
signersBitmap: RawTransactionArgument<number[]>;
|
|
551
|
+
message: RawTransactionArgument<number[]>;
|
|
552
|
+
}
|
|
553
|
+
export interface CertifyArticleBlobOptions {
|
|
554
|
+
package?: string;
|
|
555
|
+
arguments:
|
|
556
|
+
| CertifyArticleBlobArguments
|
|
557
|
+
| [
|
|
558
|
+
config: RawTransactionArgument<string>,
|
|
559
|
+
self: RawTransactionArgument<string>,
|
|
560
|
+
walrusSystem: RawTransactionArgument<string>,
|
|
561
|
+
blobIndex: RawTransactionArgument<number | bigint>,
|
|
562
|
+
signature: RawTransactionArgument<number[]>,
|
|
563
|
+
signersBitmap: RawTransactionArgument<number[]>,
|
|
564
|
+
message: RawTransactionArgument<number[]>,
|
|
565
|
+
];
|
|
566
|
+
}
|
|
567
|
+
export function certifyArticleBlob(options: CertifyArticleBlobOptions) {
|
|
568
|
+
const packageAddress = options.package ?? "@local-pkg/zing_studio";
|
|
569
|
+
const argumentsTypes = [
|
|
570
|
+
`${packageAddress}::config::Config`,
|
|
571
|
+
`${packageAddress}::article::Article`,
|
|
572
|
+
`${packageAddress}::system::System`,
|
|
573
|
+
"u64",
|
|
574
|
+
"vector<u8>",
|
|
575
|
+
"vector<u8>",
|
|
576
|
+
"vector<u8>",
|
|
577
|
+
] satisfies string[];
|
|
578
|
+
const parameterNames = [
|
|
579
|
+
"config",
|
|
580
|
+
"self",
|
|
581
|
+
"walrusSystem",
|
|
582
|
+
"blobIndex",
|
|
583
|
+
"signature",
|
|
584
|
+
"signersBitmap",
|
|
585
|
+
"message",
|
|
586
|
+
];
|
|
587
|
+
return (tx: Transaction) =>
|
|
588
|
+
tx.moveCall({
|
|
589
|
+
package: packageAddress,
|
|
590
|
+
module: "article",
|
|
591
|
+
function: "certify_article_blob",
|
|
592
|
+
arguments: normalizeMoveArguments(
|
|
593
|
+
options.arguments,
|
|
594
|
+
argumentsTypes,
|
|
595
|
+
parameterNames,
|
|
596
|
+
),
|
|
597
|
+
});
|
|
598
|
+
}
|