@zing-protocol/zing-sdk 0.0.16 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_generated/index.d.ts +0 -2
- package/dist/_generated/index.js +0 -2
- package/dist/_generated/utils/index.d.ts +21 -2
- package/dist/_generated/utils/index.js +35 -11
- package/dist/_generated/zing_framework/coin_utils.js +1 -4
- package/dist/_generated/zing_framework/derived_object_bag.d.ts +4 -3
- package/dist/_generated/zing_framework/derived_object_bag.js +12 -37
- package/dist/_generated/zing_framework/derived_table.d.ts +5 -4
- package/dist/_generated/zing_framework/derived_table.js +12 -33
- package/dist/_generated/zing_governance/admin.d.ts +4 -17
- package/dist/_generated/zing_governance/admin.js +3 -17
- package/dist/_generated/zing_governance/treasury.d.ts +5 -4
- package/dist/_generated/zing_governance/treasury.js +5 -15
- package/dist/_generated/zing_studio/app.d.ts +70 -2
- package/dist/_generated/zing_studio/app.js +154 -100
- package/dist/_generated/zing_studio/article.d.ts +6 -52
- package/dist/_generated/zing_studio/article.js +23 -74
- package/dist/_generated/zing_studio/config.d.ts +34 -3
- package/dist/_generated/zing_studio/config.js +47 -50
- package/dist/_generated/zing_studio/deps/sui/bag.d.ts +25 -3
- package/dist/_generated/zing_studio/deps/sui/bag.js +1 -2
- package/dist/_generated/zing_studio/deps/sui/balance.d.ts +1 -1
- package/dist/_generated/zing_studio/deps/sui/balance.js +1 -1
- package/dist/_generated/zing_studio/deps/sui/coin.d.ts +3 -5
- package/dist/_generated/zing_studio/deps/sui/coin.js +3 -3
- package/dist/_generated/zing_studio/deps/sui/table.d.ts +21 -4
- package/dist/_generated/zing_studio/deps/sui/table.js +2 -3
- package/dist/_generated/zing_studio/deps/walrus/blob.d.ts +2 -6
- package/dist/_generated/zing_studio/deps/walrus/blob.js +1 -2
- package/dist/_generated/zing_studio/deps/walrus/storage_resource.d.ts +1 -3
- package/dist/_generated/zing_studio/deps/walrus/storage_resource.js +1 -2
- package/dist/_generated/zing_studio/deps/zing_framework/derived_object_bag.d.ts +1 -3
- package/dist/_generated/zing_studio/deps/zing_framework/derived_object_bag.js +1 -2
- package/dist/_generated/zing_studio/deps/zing_framework/derived_table.d.ts +2 -4
- package/dist/_generated/zing_studio/deps/zing_framework/derived_table.js +2 -3
- package/dist/_generated/zing_studio/donation.d.ts +6 -14
- package/dist/_generated/zing_studio/donation.js +2 -2
- package/dist/_generated/zing_studio/enclave.d.ts +17 -10
- package/dist/_generated/zing_studio/enclave.js +16 -41
- package/dist/_generated/zing_studio/referral.js +15 -46
- package/dist/_generated/zing_studio/storage.d.ts +13 -17
- package/dist/_generated/zing_studio/storage.js +46 -100
- package/dist/_generated/zing_studio/studio.d.ts +6 -28
- package/dist/_generated/zing_studio/studio.js +23 -96
- package/dist/client/index.d.ts +22 -56
- package/dist/client/index.js +4 -30
- package/dist/components/zing-provider.d.ts +2 -0
- package/dist/components/zing-provider.js +3 -2
- package/dist/getters.d.ts +17 -62
- package/dist/getters.js +62 -56
- package/dist/hooks/index.d.ts +0 -1
- package/dist/hooks/index.js +1 -1
- package/dist/hooks/useGetStudio.d.ts +4 -10
- package/dist/hooks/useReclaim.d.ts +0 -10
- package/dist/hooks/useReclaim.js +169 -92
- package/dist/hooks/useSignAndExecuteTransaction.js +4 -1
- package/dist/hooks/useZingInfiniteQueries.d.ts +3 -9
- package/dist/hooks/useZingInfiniteQueries.js +1 -0
- package/dist/hooks/useZingQueries.d.ts +8 -27
- package/dist/hooks/useZingQueries.js +1 -2
- package/dist/hooks/useZingQuery.d.ts +11 -36
- package/dist/hooks/useZingQuery.js +1 -2
- package/dist/lib/utils/index.d.ts +0 -1
- package/dist/lib/utils/index.js +0 -1
- package/dist/lib/utils/reclaim.d.ts +1 -29
- package/dist/lib/utils/reclaim.js +148 -87
- package/dist/mutations/signer.js +1 -1
- package/dist/mutations/walrus.js +1 -1
- package/package.json +1 -1
- package/dist/_generated/zing_framework/deps/sui/object.d.ts +0 -8
- package/dist/_generated/zing_framework/deps/sui/object.js +0 -13
- package/dist/_generated/zing_governance/deps/sui/object.d.ts +0 -8
- package/dist/_generated/zing_governance/deps/sui/object.js +0 -13
- package/dist/_generated/zing_identity/config.d.ts +0 -87
- package/dist/_generated/zing_identity/config.js +0 -98
- package/dist/_generated/zing_identity/deps/std/type_name.d.ts +0 -17
- package/dist/_generated/zing_identity/deps/std/type_name.js +0 -22
- package/dist/_generated/zing_identity/deps/sui/object.d.ts +0 -8
- package/dist/_generated/zing_identity/deps/sui/object.js +0 -13
- package/dist/_generated/zing_identity/deps/sui/object_table.d.ts +0 -12
- package/dist/_generated/zing_identity/deps/sui/object_table.js +0 -23
- package/dist/_generated/zing_identity/deps/sui/table.d.ts +0 -12
- package/dist/_generated/zing_identity/deps/sui/table.js +0 -35
- package/dist/_generated/zing_identity/deps/sui/vec_set.d.ts +0 -17
- package/dist/_generated/zing_identity/deps/sui/vec_set.js +0 -22
- package/dist/_generated/zing_identity/ecdsa.d.ts +0 -81
- package/dist/_generated/zing_identity/ecdsa.js +0 -87
- package/dist/_generated/zing_identity/identity.d.ts +0 -262
- package/dist/_generated/zing_identity/identity.js +0 -294
- package/dist/_generated/zing_identity/reclaim.d.ts +0 -356
- package/dist/_generated/zing_identity/reclaim.js +0 -414
- package/dist/_generated/zing_studio/nitro_attestation.d.ts +0 -148
- package/dist/_generated/zing_studio/nitro_attestation.js +0 -183
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
/**************************************************************
|
|
2
2
|
* THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
|
|
3
3
|
**************************************************************/
|
|
4
|
-
import * as object from "./deps/sui/object.js";
|
|
5
4
|
import * as vec_map from "./deps/sui/vec_map.js";
|
|
6
5
|
import * as derived_object_bag from "./deps/zing_framework/derived_object_bag.js";
|
|
7
6
|
import * as derived_table from "./deps/zing_framework/derived_table.js";
|
|
@@ -28,7 +27,7 @@ export const STUDIO = new MoveStruct({
|
|
|
28
27
|
export const Studio = new MoveStruct({
|
|
29
28
|
name: `${$moduleName}::Studio`,
|
|
30
29
|
fields: {
|
|
31
|
-
id:
|
|
30
|
+
id: bcs.Address,
|
|
32
31
|
/** The owner of this studio - only they can add/remove works */
|
|
33
32
|
owner: bcs.Address,
|
|
34
33
|
period: Period,
|
|
@@ -71,9 +70,7 @@ export function membershipSubscriptionEarningKey(options = {}) {
|
|
|
71
70
|
/** Returns the owner address of this studio */
|
|
72
71
|
export function owner(options) {
|
|
73
72
|
const packageAddress = options.package ?? "@local-pkg/zing_studio";
|
|
74
|
-
const argumentsTypes = [
|
|
75
|
-
`${packageAddress}::studio::Studio`,
|
|
76
|
-
];
|
|
73
|
+
const argumentsTypes = [null];
|
|
77
74
|
const parameterNames = ["self"];
|
|
78
75
|
return (tx) => tx.moveCall({
|
|
79
76
|
package: packageAddress,
|
|
@@ -84,9 +81,7 @@ export function owner(options) {
|
|
|
84
81
|
}
|
|
85
82
|
export function period(options) {
|
|
86
83
|
const packageAddress = options.package ?? "@local-pkg/zing_studio";
|
|
87
|
-
const argumentsTypes = [
|
|
88
|
-
`${packageAddress}::studio::Studio`,
|
|
89
|
-
];
|
|
84
|
+
const argumentsTypes = [null];
|
|
90
85
|
const parameterNames = ["self"];
|
|
91
86
|
return (tx) => tx.moveCall({
|
|
92
87
|
package: packageAddress,
|
|
@@ -97,9 +92,7 @@ export function period(options) {
|
|
|
97
92
|
}
|
|
98
93
|
export function startAt(options) {
|
|
99
94
|
const packageAddress = options.package ?? "@local-pkg/zing_studio";
|
|
100
|
-
const argumentsTypes = [
|
|
101
|
-
`${packageAddress}::studio::Studio`,
|
|
102
|
-
];
|
|
95
|
+
const argumentsTypes = [null];
|
|
103
96
|
const parameterNames = ["self"];
|
|
104
97
|
return (tx) => tx.moveCall({
|
|
105
98
|
package: packageAddress,
|
|
@@ -110,9 +103,7 @@ export function startAt(options) {
|
|
|
110
103
|
}
|
|
111
104
|
export function endAt(options) {
|
|
112
105
|
const packageAddress = options.package ?? "@local-pkg/zing_studio";
|
|
113
|
-
const argumentsTypes = [
|
|
114
|
-
`${packageAddress}::studio::Studio`,
|
|
115
|
-
];
|
|
106
|
+
const argumentsTypes = [null];
|
|
116
107
|
const parameterNames = ["self"];
|
|
117
108
|
return (tx) => tx.moveCall({
|
|
118
109
|
package: packageAddress,
|
|
@@ -123,9 +114,7 @@ export function endAt(options) {
|
|
|
123
114
|
}
|
|
124
115
|
export function memberLevel(options) {
|
|
125
116
|
const packageAddress = options.package ?? "@local-pkg/zing_studio";
|
|
126
|
-
const argumentsTypes = [
|
|
127
|
-
`${packageAddress}::studio::Member`,
|
|
128
|
-
];
|
|
117
|
+
const argumentsTypes = [null];
|
|
129
118
|
const parameterNames = ["member"];
|
|
130
119
|
return (tx) => tx.moveCall({
|
|
131
120
|
package: packageAddress,
|
|
@@ -136,9 +125,7 @@ export function memberLevel(options) {
|
|
|
136
125
|
}
|
|
137
126
|
export function memberExpiredAt(options) {
|
|
138
127
|
const packageAddress = options.package ?? "@local-pkg/zing_studio";
|
|
139
|
-
const argumentsTypes = [
|
|
140
|
-
`${packageAddress}::studio::Member`,
|
|
141
|
-
];
|
|
128
|
+
const argumentsTypes = [null];
|
|
142
129
|
const parameterNames = ["member"];
|
|
143
130
|
return (tx) => tx.moveCall({
|
|
144
131
|
package: packageAddress,
|
|
@@ -149,9 +136,7 @@ export function memberExpiredAt(options) {
|
|
|
149
136
|
}
|
|
150
137
|
export function monthlySubscriptionFee(options) {
|
|
151
138
|
const packageAddress = options.package ?? "@local-pkg/zing_studio";
|
|
152
|
-
const argumentsTypes = [
|
|
153
|
-
`${packageAddress}::studio::Studio`,
|
|
154
|
-
];
|
|
139
|
+
const argumentsTypes = [null];
|
|
155
140
|
const parameterNames = ["self"];
|
|
156
141
|
return (tx) => tx.moveCall({
|
|
157
142
|
package: packageAddress,
|
|
@@ -162,9 +147,7 @@ export function monthlySubscriptionFee(options) {
|
|
|
162
147
|
}
|
|
163
148
|
export function earnings(options) {
|
|
164
149
|
const packageAddress = options.package ?? "@local-pkg/zing_studio";
|
|
165
|
-
const argumentsTypes = [
|
|
166
|
-
`${packageAddress}::studio::Studio`,
|
|
167
|
-
];
|
|
150
|
+
const argumentsTypes = [null];
|
|
168
151
|
const parameterNames = ["self"];
|
|
169
152
|
return (tx) => tx.moveCall({
|
|
170
153
|
package: packageAddress,
|
|
@@ -175,9 +158,7 @@ export function earnings(options) {
|
|
|
175
158
|
}
|
|
176
159
|
export function membership(options) {
|
|
177
160
|
const packageAddress = options.package ?? "@local-pkg/zing_studio";
|
|
178
|
-
const argumentsTypes = [
|
|
179
|
-
`${packageAddress}::studio::Studio`,
|
|
180
|
-
];
|
|
161
|
+
const argumentsTypes = [null];
|
|
181
162
|
const parameterNames = ["self"];
|
|
182
163
|
return (tx) => tx.moveCall({
|
|
183
164
|
package: packageAddress,
|
|
@@ -192,10 +173,7 @@ export function membership(options) {
|
|
|
192
173
|
*/
|
|
193
174
|
export function assetOf(options) {
|
|
194
175
|
const packageAddress = options.package ?? "@local-pkg/zing_studio";
|
|
195
|
-
const argumentsTypes = [
|
|
196
|
-
`${packageAddress}::studio::Studio`,
|
|
197
|
-
"0x0000000000000000000000000000000000000000000000000000000000000002::object::ID",
|
|
198
|
-
];
|
|
176
|
+
const argumentsTypes = [null, "0x2::object::ID"];
|
|
199
177
|
const parameterNames = ["self", "assetId"];
|
|
200
178
|
return (tx) => tx.moveCall({
|
|
201
179
|
package: packageAddress,
|
|
@@ -207,9 +185,7 @@ export function assetOf(options) {
|
|
|
207
185
|
}
|
|
208
186
|
export function works(options) {
|
|
209
187
|
const packageAddress = options.package ?? "@local-pkg/zing_studio";
|
|
210
|
-
const argumentsTypes = [
|
|
211
|
-
`${packageAddress}::studio::Studio`,
|
|
212
|
-
];
|
|
188
|
+
const argumentsTypes = [null];
|
|
213
189
|
const parameterNames = ["self"];
|
|
214
190
|
return (tx) => tx.moveCall({
|
|
215
191
|
package: packageAddress,
|
|
@@ -220,9 +196,7 @@ export function works(options) {
|
|
|
220
196
|
}
|
|
221
197
|
export function encryptedFileKey(options) {
|
|
222
198
|
const packageAddress = options.package ?? "@local-pkg/zing_studio";
|
|
223
|
-
const argumentsTypes = [
|
|
224
|
-
`${packageAddress}::studio::Studio`,
|
|
225
|
-
];
|
|
199
|
+
const argumentsTypes = [null];
|
|
226
200
|
const parameterNames = ["self"];
|
|
227
201
|
return (tx) => tx.moveCall({
|
|
228
202
|
package: packageAddress,
|
|
@@ -233,11 +207,7 @@ export function encryptedFileKey(options) {
|
|
|
233
207
|
}
|
|
234
208
|
export function sealApproveStudioOwner(options) {
|
|
235
209
|
const packageAddress = options.package ?? "@local-pkg/zing_studio";
|
|
236
|
-
const argumentsTypes = [
|
|
237
|
-
"vector<u8>",
|
|
238
|
-
`${packageAddress}::config::Config`,
|
|
239
|
-
`${packageAddress}::studio::Studio`,
|
|
240
|
-
];
|
|
210
|
+
const argumentsTypes = ["vector<u8>", null, null];
|
|
241
211
|
const parameterNames = ["id", "config", "self"];
|
|
242
212
|
return (tx) => tx.moveCall({
|
|
243
213
|
package: packageAddress,
|
|
@@ -246,29 +216,9 @@ export function sealApproveStudioOwner(options) {
|
|
|
246
216
|
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
247
217
|
});
|
|
248
218
|
}
|
|
249
|
-
export function sealApproveRegisteredEnclave(options) {
|
|
250
|
-
const packageAddress = options.package ?? "@local-pkg/zing_studio";
|
|
251
|
-
const argumentsTypes = [
|
|
252
|
-
"vector<u8>",
|
|
253
|
-
`${packageAddress}::config::Config`,
|
|
254
|
-
`${packageAddress}::studio::Studio`,
|
|
255
|
-
`${packageAddress}::enclave::Enclave`,
|
|
256
|
-
];
|
|
257
|
-
const parameterNames = ["id", "config", "self", "enclave"];
|
|
258
|
-
return (tx) => tx.moveCall({
|
|
259
|
-
package: packageAddress,
|
|
260
|
-
module: "studio",
|
|
261
|
-
function: "seal_approve_registered_enclave",
|
|
262
|
-
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
263
|
-
});
|
|
264
|
-
}
|
|
265
219
|
export function sealApproveManager(options) {
|
|
266
220
|
const packageAddress = options.package ?? "@local-pkg/zing_studio";
|
|
267
|
-
const argumentsTypes = [
|
|
268
|
-
"vector<u8>",
|
|
269
|
-
`${packageAddress}::config::Config`,
|
|
270
|
-
`${packageAddress}::studio::Studio`,
|
|
271
|
-
];
|
|
221
|
+
const argumentsTypes = ["vector<u8>", null, null];
|
|
272
222
|
const parameterNames = ["id", "config", "self"];
|
|
273
223
|
return (tx) => tx.moveCall({
|
|
274
224
|
package: packageAddress,
|
|
@@ -283,10 +233,7 @@ export function sealApproveManager(options) {
|
|
|
283
233
|
*/
|
|
284
234
|
export function studioOf(options) {
|
|
285
235
|
const packageAddress = options.package ?? "@local-pkg/zing_studio";
|
|
286
|
-
const argumentsTypes = [
|
|
287
|
-
`${packageAddress}::config::Config`,
|
|
288
|
-
"address",
|
|
289
|
-
];
|
|
236
|
+
const argumentsTypes = [null, "address"];
|
|
290
237
|
const parameterNames = ["config", "owner"];
|
|
291
238
|
return (tx) => tx.moveCall({
|
|
292
239
|
package: packageAddress,
|
|
@@ -301,10 +248,7 @@ export function studioOf(options) {
|
|
|
301
248
|
*/
|
|
302
249
|
export function studioExists(options) {
|
|
303
250
|
const packageAddress = options.package ?? "@local-pkg/zing_studio";
|
|
304
|
-
const argumentsTypes = [
|
|
305
|
-
`${packageAddress}::config::Config`,
|
|
306
|
-
"address",
|
|
307
|
-
];
|
|
251
|
+
const argumentsTypes = [null, "address"];
|
|
308
252
|
const parameterNames = ["config", "owner"];
|
|
309
253
|
return (tx) => tx.moveCall({
|
|
310
254
|
package: packageAddress,
|
|
@@ -315,10 +259,7 @@ export function studioExists(options) {
|
|
|
315
259
|
}
|
|
316
260
|
export function isInValidPeriod(options) {
|
|
317
261
|
const packageAddress = options.package ?? "@local-pkg/zing_studio";
|
|
318
|
-
const argumentsTypes = [
|
|
319
|
-
`${packageAddress}::studio::Studio`,
|
|
320
|
-
"0x0000000000000000000000000000000000000000000000000000000000000002::clock::Clock",
|
|
321
|
-
];
|
|
262
|
+
const argumentsTypes = [null, "0x2::clock::Clock"];
|
|
322
263
|
const parameterNames = ["self"];
|
|
323
264
|
return (tx) => tx.moveCall({
|
|
324
265
|
package: packageAddress,
|
|
@@ -329,11 +270,7 @@ export function isInValidPeriod(options) {
|
|
|
329
270
|
}
|
|
330
271
|
export function membershipLevel(options) {
|
|
331
272
|
const packageAddress = options.package ?? "@local-pkg/zing_studio";
|
|
332
|
-
const argumentsTypes = [
|
|
333
|
-
`${packageAddress}::studio::Studio`,
|
|
334
|
-
"address",
|
|
335
|
-
"0x0000000000000000000000000000000000000000000000000000000000000002::clock::Clock",
|
|
336
|
-
];
|
|
273
|
+
const argumentsTypes = [null, "address", "0x2::clock::Clock"];
|
|
337
274
|
const parameterNames = ["self", "member"];
|
|
338
275
|
return (tx) => tx.moveCall({
|
|
339
276
|
package: packageAddress,
|
|
@@ -344,11 +281,7 @@ export function membershipLevel(options) {
|
|
|
344
281
|
}
|
|
345
282
|
export function isMembership(options) {
|
|
346
283
|
const packageAddress = options.package ?? "@local-pkg/zing_studio";
|
|
347
|
-
const argumentsTypes = [
|
|
348
|
-
`${packageAddress}::studio::Studio`,
|
|
349
|
-
"address",
|
|
350
|
-
"0x0000000000000000000000000000000000000000000000000000000000000002::clock::Clock",
|
|
351
|
-
];
|
|
284
|
+
const argumentsTypes = [null, "address", "0x2::clock::Clock"];
|
|
352
285
|
const parameterNames = ["self", "member"];
|
|
353
286
|
return (tx) => tx.moveCall({
|
|
354
287
|
package: packageAddress,
|
|
@@ -364,9 +297,7 @@ export function isMembership(options) {
|
|
|
364
297
|
*/
|
|
365
298
|
export function _new(options) {
|
|
366
299
|
const packageAddress = options.package ?? "@local-pkg/zing_studio";
|
|
367
|
-
const argumentsTypes = [
|
|
368
|
-
`${packageAddress}::config::Config`,
|
|
369
|
-
];
|
|
300
|
+
const argumentsTypes = [null];
|
|
370
301
|
const parameterNames = ["config"];
|
|
371
302
|
return (tx) => tx.moveCall({
|
|
372
303
|
package: packageAddress,
|
|
@@ -377,9 +308,7 @@ export function _new(options) {
|
|
|
377
308
|
}
|
|
378
309
|
export function shareStudio(options) {
|
|
379
310
|
const packageAddress = options.package ?? "@local-pkg/zing_studio";
|
|
380
|
-
const argumentsTypes = [
|
|
381
|
-
`${packageAddress}::studio::Studio`,
|
|
382
|
-
];
|
|
311
|
+
const argumentsTypes = [null];
|
|
383
312
|
const parameterNames = ["self"];
|
|
384
313
|
return (tx) => tx.moveCall({
|
|
385
314
|
package: packageAddress,
|
|
@@ -390,9 +319,7 @@ export function shareStudio(options) {
|
|
|
390
319
|
}
|
|
391
320
|
export function totalEarning(options) {
|
|
392
321
|
const packageAddress = options.package ?? "@local-pkg/zing_studio";
|
|
393
|
-
const argumentsTypes = [
|
|
394
|
-
`${packageAddress}::studio::Studio`,
|
|
395
|
-
];
|
|
322
|
+
const argumentsTypes = [null];
|
|
396
323
|
const parameterNames = ["self"];
|
|
397
324
|
return (tx) => tx.moveCall({
|
|
398
325
|
package: packageAddress,
|
package/dist/client/index.d.ts
CHANGED
|
@@ -1,37 +1,33 @@
|
|
|
1
1
|
import { SessionKey } from "@mysten/seal";
|
|
2
2
|
import { Transaction } from "@mysten/sui/transactions";
|
|
3
3
|
import type { PurchaseStorageTierParams, SetMonthlySubscriptionFeeParams, SubscribeParams } from "./types.js";
|
|
4
|
-
import type { CoinSymbol,
|
|
4
|
+
import type { CoinSymbol, WorkType } from "../config/index.js";
|
|
5
5
|
import type { Config } from "../config/types.js";
|
|
6
6
|
import type { SuiNetwork, ZKLoginSignerState } from "../types.js";
|
|
7
7
|
import type { SealClient } from "@mysten/seal";
|
|
8
|
+
import type { SuiGraphQLClient } from "@mysten/sui/graphql";
|
|
8
9
|
import type { SuiGrpcClient } from "@mysten/sui/grpc";
|
|
9
10
|
interface Params {
|
|
10
11
|
network: SuiNetwork;
|
|
11
12
|
suiGrpcClient: SuiGrpcClient;
|
|
13
|
+
suiGraphQLClient: SuiGraphQLClient;
|
|
12
14
|
}
|
|
13
15
|
export declare class ZingClient {
|
|
14
16
|
suiGrpcClient: SuiGrpcClient;
|
|
17
|
+
suiGraphQLClient: SuiGraphQLClient;
|
|
15
18
|
network: SuiNetwork;
|
|
16
19
|
config: Config;
|
|
17
|
-
constructor({ network, suiGrpcClient }: Params);
|
|
20
|
+
constructor({ network, suiGraphQLClient, suiGrpcClient }: Params);
|
|
18
21
|
getConfig(): Config;
|
|
19
22
|
getDerivedStudioID(address: string): string;
|
|
20
23
|
getDerivedStorageID(address: string): string;
|
|
21
24
|
getDerivedWorksID(address: string): string;
|
|
22
25
|
getDerivedMembershipID(address: string): string;
|
|
23
26
|
getReferralID(address: string): string;
|
|
24
|
-
getIdentifierByAddress(platform: PlatformType, address: string): Promise<string | null>;
|
|
25
|
-
getIdentifierInfoByIdentifier(platform: PlatformType, identifier: string): Promise<{
|
|
26
|
-
owner: string;
|
|
27
|
-
updated_at: string;
|
|
28
|
-
} | null>;
|
|
29
27
|
getStudio(owner: string): Promise<{
|
|
30
|
-
id:
|
|
31
|
-
id: string;
|
|
32
|
-
};
|
|
28
|
+
id: string;
|
|
33
29
|
owner: string;
|
|
34
|
-
period: string
|
|
30
|
+
period: [string, string];
|
|
35
31
|
monthly_subscription_fee: {
|
|
36
32
|
contents: {
|
|
37
33
|
key: number;
|
|
@@ -39,15 +35,11 @@ export declare class ZingClient {
|
|
|
39
35
|
}[];
|
|
40
36
|
};
|
|
41
37
|
membership: {
|
|
42
|
-
id:
|
|
43
|
-
id: string;
|
|
44
|
-
};
|
|
38
|
+
id: string;
|
|
45
39
|
size: string;
|
|
46
40
|
};
|
|
47
41
|
works: {
|
|
48
|
-
id:
|
|
49
|
-
id: string;
|
|
50
|
-
};
|
|
42
|
+
id: string;
|
|
51
43
|
size: string;
|
|
52
44
|
};
|
|
53
45
|
encrypted_file_key: number[] | null;
|
|
@@ -59,9 +51,7 @@ export declare class ZingClient {
|
|
|
59
51
|
};
|
|
60
52
|
} | null>;
|
|
61
53
|
getStorageSpace(owner: string): Promise<{
|
|
62
|
-
id:
|
|
63
|
-
id: string;
|
|
64
|
-
};
|
|
54
|
+
id: string;
|
|
65
55
|
owner: string;
|
|
66
56
|
tier: number | null;
|
|
67
57
|
storage_used: {
|
|
@@ -77,9 +67,7 @@ export declare class ZingClient {
|
|
|
77
67
|
};
|
|
78
68
|
} | null>;
|
|
79
69
|
getStorageTreasury(): Promise<{
|
|
80
|
-
id:
|
|
81
|
-
id: string;
|
|
82
|
-
};
|
|
70
|
+
id: string;
|
|
83
71
|
tier_plan: {
|
|
84
72
|
contents: {
|
|
85
73
|
key: number;
|
|
@@ -94,9 +82,7 @@ export declare class ZingClient {
|
|
|
94
82
|
contents: {
|
|
95
83
|
key: number;
|
|
96
84
|
value: {
|
|
97
|
-
id:
|
|
98
|
-
id: string;
|
|
99
|
-
};
|
|
85
|
+
id: string;
|
|
100
86
|
start_epoch: number;
|
|
101
87
|
end_epoch: number;
|
|
102
88
|
storage_size: string;
|
|
@@ -110,9 +96,7 @@ export declare class ZingClient {
|
|
|
110
96
|
}[];
|
|
111
97
|
};
|
|
112
98
|
wal_treasury: {
|
|
113
|
-
id:
|
|
114
|
-
id: string;
|
|
115
|
-
};
|
|
99
|
+
id: string;
|
|
116
100
|
balance: {
|
|
117
101
|
value: string;
|
|
118
102
|
};
|
|
@@ -146,26 +130,20 @@ export declare class ZingClient {
|
|
|
146
130
|
expired_at: string;
|
|
147
131
|
} | null>;
|
|
148
132
|
getWork(workId: string, workType?: WorkType): Promise<{
|
|
149
|
-
id:
|
|
150
|
-
id: string;
|
|
151
|
-
};
|
|
133
|
+
id: string;
|
|
152
134
|
owner: string;
|
|
153
135
|
deleted: boolean;
|
|
154
136
|
created_at: string;
|
|
155
137
|
subscription_level: number | null;
|
|
156
138
|
blobs: {
|
|
157
|
-
id:
|
|
158
|
-
id: string;
|
|
159
|
-
};
|
|
139
|
+
id: string;
|
|
160
140
|
registered_epoch: number;
|
|
161
141
|
blob_id: string;
|
|
162
142
|
size: string;
|
|
163
143
|
encoding_type: number;
|
|
164
144
|
certified_epoch: number | null;
|
|
165
145
|
storage: {
|
|
166
|
-
id:
|
|
167
|
-
id: string;
|
|
168
|
-
};
|
|
146
|
+
id: string;
|
|
169
147
|
start_epoch: number;
|
|
170
148
|
end_epoch: number;
|
|
171
149
|
storage_size: string;
|
|
@@ -185,26 +163,20 @@ export declare class ZingClient {
|
|
|
185
163
|
} | null>;
|
|
186
164
|
getWorks(owner: string, workType?: WorkType, cursor?: string, limit?: number): Promise<{
|
|
187
165
|
data: {
|
|
188
|
-
id:
|
|
189
|
-
id: string;
|
|
190
|
-
};
|
|
166
|
+
id: string;
|
|
191
167
|
owner: string;
|
|
192
168
|
deleted: boolean;
|
|
193
169
|
created_at: string;
|
|
194
170
|
subscription_level: number | null;
|
|
195
171
|
blobs: {
|
|
196
|
-
id:
|
|
197
|
-
id: string;
|
|
198
|
-
};
|
|
172
|
+
id: string;
|
|
199
173
|
registered_epoch: number;
|
|
200
174
|
blob_id: string;
|
|
201
175
|
size: string;
|
|
202
176
|
encoding_type: number;
|
|
203
177
|
certified_epoch: number | null;
|
|
204
178
|
storage: {
|
|
205
|
-
id:
|
|
206
|
-
id: string;
|
|
207
|
-
};
|
|
179
|
+
id: string;
|
|
208
180
|
start_epoch: number;
|
|
209
181
|
end_epoch: number;
|
|
210
182
|
storage_size: string;
|
|
@@ -226,26 +198,20 @@ export declare class ZingClient {
|
|
|
226
198
|
hasNextPage: boolean;
|
|
227
199
|
}>;
|
|
228
200
|
getWorksByObjectIds(owner: string, workObjectIds: string[], workType?: WorkType): Promise<{
|
|
229
|
-
id:
|
|
230
|
-
id: string;
|
|
231
|
-
};
|
|
201
|
+
id: string;
|
|
232
202
|
owner: string;
|
|
233
203
|
deleted: boolean;
|
|
234
204
|
created_at: string;
|
|
235
205
|
subscription_level: number | null;
|
|
236
206
|
blobs: {
|
|
237
|
-
id:
|
|
238
|
-
id: string;
|
|
239
|
-
};
|
|
207
|
+
id: string;
|
|
240
208
|
registered_epoch: number;
|
|
241
209
|
blob_id: string;
|
|
242
210
|
size: string;
|
|
243
211
|
encoding_type: number;
|
|
244
212
|
certified_epoch: number | null;
|
|
245
213
|
storage: {
|
|
246
|
-
id:
|
|
247
|
-
id: string;
|
|
248
|
-
};
|
|
214
|
+
id: string;
|
|
249
215
|
start_epoch: number;
|
|
250
216
|
end_epoch: number;
|
|
251
217
|
storage_size: string;
|
package/dist/client/index.js
CHANGED
|
@@ -4,15 +4,16 @@ import { addReferralToStudio } from "../_generated/zing_studio/referral.js";
|
|
|
4
4
|
import { shareStorageSpace } from "../_generated/zing_studio/storage.js";
|
|
5
5
|
import { _new as newStudio, sealApproveStudioOwner, shareStudio, } from "../_generated/zing_studio/studio.js";
|
|
6
6
|
import { getConfig } from "../config/index.js";
|
|
7
|
-
import { getDerivedMembershipID, getDerivedStorageID, getDerivedStudioID, getDerivedWorksID,
|
|
7
|
+
import { getDerivedMembershipID, getDerivedStorageID, getDerivedStudioID, getDerivedWorksID, getMember, getMembers, getReferral, getReferralID, getStorageSpace, getStorageTreasury, getStudio, getWork, getWorks, getWorksByObjectIds, } from "../getters.js";
|
|
8
8
|
import { importFileKey } from "../mutations/seal.js";
|
|
9
9
|
import { signPersonalMessage } from "../mutations/signer.js";
|
|
10
10
|
import { SessionKey } from "@mysten/seal";
|
|
11
11
|
import { Transaction, coinWithBalance } from "@mysten/sui/transactions";
|
|
12
12
|
import { fromHex } from "@mysten/sui/utils";
|
|
13
13
|
export class ZingClient {
|
|
14
|
-
constructor({ network, suiGrpcClient }) {
|
|
14
|
+
constructor({ network, suiGraphQLClient, suiGrpcClient }) {
|
|
15
15
|
this.suiGrpcClient = suiGrpcClient;
|
|
16
|
+
this.suiGraphQLClient = suiGraphQLClient;
|
|
16
17
|
this.network = network || "testnet";
|
|
17
18
|
this.config = getConfig(network);
|
|
18
19
|
}
|
|
@@ -35,33 +36,6 @@ export class ZingClient {
|
|
|
35
36
|
getReferralID(address) {
|
|
36
37
|
return getReferralID(this.config.zing.ZING_STUDIO_CONFIG_SHARED_OBJECT_REF.objectId, address);
|
|
37
38
|
}
|
|
38
|
-
async getIdentifierByAddress(platform, address) {
|
|
39
|
-
return getIdentifierByAddress(this.suiGrpcClient, this.config.zing.IDENTITY_PLATFORMS[platform]
|
|
40
|
-
.IDENTITY_MANAGER_ADDRESS_TO_IDENTIFIER_DF_ID, address);
|
|
41
|
-
}
|
|
42
|
-
async getIdentifierInfoByIdentifier(platform, identifier) {
|
|
43
|
-
return getIdentifierInfoByIdentifier(this.suiGrpcClient, this.config.zing.IDENTITY_PLATFORMS[platform]
|
|
44
|
-
.IDENTITY_MANAGER_IDENTIFIER_INFO_DF_ID, identifier);
|
|
45
|
-
}
|
|
46
|
-
// async getDonationByIdentifier(identifier: string) {
|
|
47
|
-
// const donations = await getDonationByIdentifier(
|
|
48
|
-
// this.suiGrpcClient,
|
|
49
|
-
// this.config.zing.DONATIONS_TABLE_DF_ID,
|
|
50
|
-
// identifier,
|
|
51
|
-
// );
|
|
52
|
-
//
|
|
53
|
-
// return Object.keys(this.config.coins).reduce(
|
|
54
|
-
// (acc, coinSymbol) => {
|
|
55
|
-
// const symbol = coinSymbol as CoinSymbol;
|
|
56
|
-
// const donation = donations?.contents.find(
|
|
57
|
-
// (c) => c.key.name === this.config.coins[symbol],
|
|
58
|
-
// );
|
|
59
|
-
// if (donation) acc[symbol] = donation.value;
|
|
60
|
-
// return acc;
|
|
61
|
-
// },
|
|
62
|
-
// {} as Record<CoinSymbol, string>,
|
|
63
|
-
// );
|
|
64
|
-
// }
|
|
65
39
|
async getStudio(owner) {
|
|
66
40
|
return getStudio(this.suiGrpcClient, this.getDerivedStudioID(owner));
|
|
67
41
|
}
|
|
@@ -111,7 +85,7 @@ export class ZingClient {
|
|
|
111
85
|
address: owner,
|
|
112
86
|
packageId: this.config.zing.ZING_STUDIO_V0_PACKAGE_ADDRESS,
|
|
113
87
|
ttlMin: 10,
|
|
114
|
-
suiClient: this.
|
|
88
|
+
suiClient: this.suiGraphQLClient,
|
|
115
89
|
});
|
|
116
90
|
const message = sessionKey.getPersonalMessage();
|
|
117
91
|
const { zkLoginSignature } = await signPersonalMessage(saltServerUrl, signer, message);
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { ZingClient } from "../client/index.js";
|
|
2
2
|
import type { SuiNetwork } from "../types.js";
|
|
3
|
+
import type { SuiGraphQLClient } from "@mysten/sui/graphql";
|
|
3
4
|
import type { SuiGrpcClient } from "@mysten/sui/grpc";
|
|
4
5
|
import type { ReactNode } from "react";
|
|
5
6
|
interface ZingClientProviderProps {
|
|
6
7
|
network: SuiNetwork;
|
|
7
8
|
suiGrpcClient: SuiGrpcClient;
|
|
9
|
+
suiGraphQLClient: SuiGraphQLClient;
|
|
8
10
|
children: ReactNode;
|
|
9
11
|
}
|
|
10
12
|
export declare const ZingClientProvider: React.FC<ZingClientProviderProps>;
|
|
@@ -4,11 +4,12 @@ import { createContext, useContext, useMemo } from "react";
|
|
|
4
4
|
const ZingClientContext = createContext({
|
|
5
5
|
client: null,
|
|
6
6
|
});
|
|
7
|
-
export const ZingClientProvider = ({ network, suiGrpcClient, children, }) => {
|
|
7
|
+
export const ZingClientProvider = ({ network, suiGrpcClient, suiGraphQLClient, children, }) => {
|
|
8
8
|
const client = useMemo(() => new ZingClient({
|
|
9
9
|
network,
|
|
10
10
|
suiGrpcClient,
|
|
11
|
-
|
|
11
|
+
suiGraphQLClient,
|
|
12
|
+
}), [network, suiGrpcClient, suiGraphQLClient]);
|
|
12
13
|
return (_jsx(ZingClientContext.Provider, { value: { client }, children: children }));
|
|
13
14
|
};
|
|
14
15
|
export const useZingClient = () => {
|