@zing-protocol/zing-sdk 0.0.6 → 0.0.9

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.
@@ -27,6 +27,12 @@ export declare const DeleteArticleEvent: MoveStruct<{
27
27
  current_epoch: import("@mysten/sui/bcs").BcsType<number, number, "u32">;
28
28
  timestamp_ms: import("@mysten/sui/bcs").BcsType<string, string | number | bigint, "u64">;
29
29
  }, "@local-pkg/zing_studio::app::DeleteArticleEvent">;
30
+ export declare const UpdateArticleSubscriptionLevelEvent: MoveStruct<{
31
+ article_id: import("@mysten/sui/bcs").BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
32
+ owner: import("@mysten/sui/bcs").BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
33
+ prev_level: import("@mysten/sui/bcs").BcsType<number | null, number | null | undefined, "Option<u8>">;
34
+ new_level: import("@mysten/sui/bcs").BcsType<number | null, number | null | undefined, "Option<u8>">;
35
+ }, "@local-pkg/zing_studio::app::UpdateArticleSubscriptionLevelEvent">;
30
36
  export declare const DonateEvent: MoveStruct<{
31
37
  recipient: import("@mysten/sui/bcs").BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
32
38
  value: import("@mysten/sui/bcs").BcsType<string, string | number | bigint, "u64">;
@@ -169,9 +175,9 @@ export interface StartPublishArticleArguments {
169
175
  storageTreasury: RawTransactionArgument<string>;
170
176
  storageSpace: RawTransactionArgument<string>;
171
177
  subscriptionLevel: RawTransactionArgument<number | null>;
172
- blobId: RawTransactionArgument<number | bigint>;
173
- rootHash: RawTransactionArgument<number | bigint>;
174
- unencodedBlobSize: RawTransactionArgument<number | bigint>;
178
+ blobIds: RawTransactionArgument<number | bigint[]>;
179
+ rootHashes: RawTransactionArgument<number | bigint[]>;
180
+ unencodedBlobSizes: RawTransactionArgument<number | bigint[]>;
175
181
  encodingType: RawTransactionArgument<number>;
176
182
  identifiers: RawTransactionArgument<string[]>;
177
183
  blobIndexes: RawTransactionArgument<number | bigint[]>;
@@ -187,9 +193,9 @@ export interface StartPublishArticleOptions {
187
193
  storageTreasury: RawTransactionArgument<string>,
188
194
  storageSpace: RawTransactionArgument<string>,
189
195
  subscriptionLevel: RawTransactionArgument<number | null>,
190
- blobId: RawTransactionArgument<number | bigint>,
191
- rootHash: RawTransactionArgument<number | bigint>,
192
- unencodedBlobSize: RawTransactionArgument<number | bigint>,
196
+ blobIds: RawTransactionArgument<number | bigint[]>,
197
+ rootHashes: RawTransactionArgument<number | bigint[]>,
198
+ unencodedBlobSizes: RawTransactionArgument<number | bigint[]>,
193
199
  encodingType: RawTransactionArgument<number>,
194
200
  identifiers: RawTransactionArgument<string[]>,
195
201
  blobIndexes: RawTransactionArgument<number | bigint[]>,
@@ -349,3 +355,12 @@ export interface DonateOptions {
349
355
  typeArguments: [string];
350
356
  }
351
357
  export declare function donate(options: DonateOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
358
+ export interface BurnOrKeepPositiveCoinArguments {
359
+ coin: RawTransactionArgument<string>;
360
+ }
361
+ export interface BurnOrKeepPositiveCoinOptions {
362
+ package?: string;
363
+ arguments: BurnOrKeepPositiveCoinArguments | [coin: RawTransactionArgument<string>];
364
+ typeArguments: [string];
365
+ }
366
+ export declare function burnOrKeepPositiveCoin(options: BurnOrKeepPositiveCoinOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
@@ -40,6 +40,15 @@ export const DeleteArticleEvent = new MoveStruct({
40
40
  timestamp_ms: bcs.u64(),
41
41
  },
42
42
  });
43
+ export const UpdateArticleSubscriptionLevelEvent = new MoveStruct({
44
+ name: `${$moduleName}::UpdateArticleSubscriptionLevelEvent`,
45
+ fields: {
46
+ article_id: bcs.Address,
47
+ owner: bcs.Address,
48
+ prev_level: bcs.option(bcs.u8()),
49
+ new_level: bcs.option(bcs.u8()),
50
+ },
51
+ });
43
52
  export const DonateEvent = new MoveStruct({
44
53
  name: `${$moduleName}::DonateEvent`,
45
54
  fields: {
@@ -224,9 +233,9 @@ export function startPublishArticle(options) {
224
233
  `${packageAddress}::storage::StorageTreasury`,
225
234
  `${packageAddress}::storage::StorageSpace`,
226
235
  "0x0000000000000000000000000000000000000000000000000000000000000001::option::Option<u8>",
227
- "u256",
228
- "u256",
229
- "u64",
236
+ "vector<u256>",
237
+ "vector<u256>",
238
+ "vector<u64>",
230
239
  "u8",
231
240
  "vector<0x0000000000000000000000000000000000000000000000000000000000000001::ascii::String>",
232
241
  "vector<u64>",
@@ -241,9 +250,9 @@ export function startPublishArticle(options) {
241
250
  "storageTreasury",
242
251
  "storageSpace",
243
252
  "subscriptionLevel",
244
- "blobId",
245
- "rootHash",
246
- "unencodedBlobSize",
253
+ "blobIds",
254
+ "rootHashes",
255
+ "unencodedBlobSizes",
247
256
  "encodingType",
248
257
  "identifiers",
249
258
  "blobIndexes",
@@ -449,3 +458,17 @@ export function donate(options) {
449
458
  typeArguments: options.typeArguments,
450
459
  });
451
460
  }
461
+ export function burnOrKeepPositiveCoin(options) {
462
+ const packageAddress = options.package ?? "@local-pkg/zing_studio";
463
+ const argumentsTypes = [
464
+ `0x0000000000000000000000000000000000000000000000000000000000000002::coin::Coin<${options.typeArguments[0]}>`,
465
+ ];
466
+ const parameterNames = ["coin"];
467
+ return (tx) => tx.moveCall({
468
+ package: packageAddress,
469
+ module: "app",
470
+ function: "burn_or_keep_positive_coin",
471
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
472
+ typeArguments: options.typeArguments,
473
+ });
474
+ }
@@ -8,15 +8,16 @@ export declare const ReferralCreatedEvent: MoveStruct<{
8
8
  referrer: import("@mysten/sui/bcs").BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
9
9
  referee: import("@mysten/sui/bcs").BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
10
10
  timestamp_ms: import("@mysten/sui/bcs").BcsType<string, string | number | bigint, "u64">;
11
+ expired_at: import("@mysten/sui/bcs").BcsType<string, string | number | bigint, "u64">;
11
12
  }, "@local-pkg/zing_studio::referral::ReferralCreatedEvent">;
12
13
  export declare const ReferralConfig: MoveStruct<{
14
+ /** 5% from total value (platform fee exclusvie) */
13
15
  share_percentage_bps: import("@mysten/sui/bcs").BcsType<string, string | number | bigint, "u64">;
14
16
  program_duration: import("@mysten/sui/bcs").BcsType<string, string | number | bigint, "u64">;
15
17
  max_cap: import("@mysten/sui/bcs").BcsType<string, string | number | bigint, "u64">;
16
18
  }, "@local-pkg/zing_studio::referral::ReferralConfig">;
17
19
  export declare const Referral: MoveStruct<{
18
- /** total earning count the value without deducted fee */
19
- total_earning: import("@mysten/sui/bcs").BcsType<string, string | number | bigint, "u64">;
20
+ referrer_earning: import("@mysten/sui/bcs").BcsType<string, string | number | bigint, "u64">;
20
21
  referrer: import("@mysten/sui/bcs").BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
21
22
  expired_at: import("@mysten/sui/bcs").BcsType<string, string | number | bigint, "u64">;
22
23
  }, "@local-pkg/zing_studio::referral::Referral">;
@@ -114,14 +115,6 @@ export interface IsReferralExistsOptions {
114
115
  arguments: IsReferralExistsArguments | [studio: RawTransactionArgument<string>];
115
116
  }
116
117
  export declare function isReferralExists(options: IsReferralExistsOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
117
- export interface TotalEarningArguments {
118
- self: RawTransactionArgument<string>;
119
- }
120
- export interface TotalEarningOptions {
121
- package?: string;
122
- arguments: TotalEarningArguments | [self: RawTransactionArgument<string>];
123
- }
124
- export declare function totalEarning(options: TotalEarningOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
125
118
  export interface ReferrerArguments {
126
119
  self: RawTransactionArgument<string>;
127
120
  }
@@ -138,18 +131,14 @@ export interface ExpiredAtOptions {
138
131
  arguments: ExpiredAtArguments | [self: RawTransactionArgument<string>];
139
132
  }
140
133
  export declare function expiredAt(options: ExpiredAtOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
141
- export interface AddTotalEarningArguments {
134
+ export interface ReferrerEarningArguments {
142
135
  self: RawTransactionArgument<string>;
143
- value: RawTransactionArgument<number | bigint>;
144
136
  }
145
- export interface AddTotalEarningOptions {
137
+ export interface ReferrerEarningOptions {
146
138
  package?: string;
147
- arguments: AddTotalEarningArguments | [
148
- self: RawTransactionArgument<string>,
149
- value: RawTransactionArgument<number | bigint>
150
- ];
139
+ arguments: ReferrerEarningArguments | [self: RawTransactionArgument<string>];
151
140
  }
152
- export declare function addTotalEarning(options: AddTotalEarningOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
141
+ export declare function referrerEarning(options: ReferrerEarningOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
153
142
  export interface AddReferralToStudioArguments {
154
143
  studio: RawTransactionArgument<string>;
155
144
  config: RawTransactionArgument<string>;
@@ -10,11 +10,13 @@ export const ReferralCreatedEvent = new MoveStruct({
10
10
  referrer: bcs.Address,
11
11
  referee: bcs.Address,
12
12
  timestamp_ms: bcs.u64(),
13
+ expired_at: bcs.u64(),
13
14
  },
14
15
  });
15
16
  export const ReferralConfig = new MoveStruct({
16
17
  name: `${$moduleName}::ReferralConfig`,
17
18
  fields: {
19
+ /** 5% from total value (platform fee exclusvie) */
18
20
  share_percentage_bps: bcs.u64(),
19
21
  program_duration: bcs.u64(),
20
22
  max_cap: bcs.u64(),
@@ -23,8 +25,7 @@ export const ReferralConfig = new MoveStruct({
23
25
  export const Referral = new MoveStruct({
24
26
  name: `${$moduleName}::Referral`,
25
27
  fields: {
26
- /** total earning count the value without deducted fee */
27
- total_earning: bcs.u64(),
28
+ referrer_earning: bcs.u64(),
28
29
  referrer: bcs.Address,
29
30
  expired_at: bcs.u64(),
30
31
  },
@@ -153,19 +154,6 @@ export function isReferralExists(options) {
153
154
  arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
154
155
  });
155
156
  }
156
- export function totalEarning(options) {
157
- const packageAddress = options.package ?? "@local-pkg/zing_studio";
158
- const argumentsTypes = [
159
- `${packageAddress}::referral::Referral`,
160
- ];
161
- const parameterNames = ["self"];
162
- return (tx) => tx.moveCall({
163
- package: packageAddress,
164
- module: "referral",
165
- function: "total_earning",
166
- arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
167
- });
168
- }
169
157
  export function referrer(options) {
170
158
  const packageAddress = options.package ?? "@local-pkg/zing_studio";
171
159
  const argumentsTypes = [
@@ -192,17 +180,16 @@ export function expiredAt(options) {
192
180
  arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
193
181
  });
194
182
  }
195
- export function addTotalEarning(options) {
183
+ export function referrerEarning(options) {
196
184
  const packageAddress = options.package ?? "@local-pkg/zing_studio";
197
185
  const argumentsTypes = [
198
186
  `${packageAddress}::referral::Referral`,
199
- "u64",
200
187
  ];
201
- const parameterNames = ["self", "value"];
188
+ const parameterNames = ["self"];
202
189
  return (tx) => tx.moveCall({
203
190
  package: packageAddress,
204
191
  module: "referral",
205
- function: "add_total_earning",
192
+ function: "referrer_earning",
206
193
  arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
207
194
  });
208
195
  }
@@ -31,6 +31,10 @@ export declare const StorageTier: MoveStruct<{
31
31
  duration_days: import("@mysten/sui/bcs").BcsType<number, number, "u16">;
32
32
  storage_limit: import("@mysten/sui/bcs").BcsType<string, string | number | bigint, "u64">;
33
33
  }, "@local-pkg/zing_studio::storage::StorageTier">;
34
+ export declare const TreasuryUsageBudget: MoveStruct<{
35
+ duration: import("@mysten/sui/bcs").BcsType<string, string | number | bigint, "u64">;
36
+ max_budget: import("@mysten/sui/bcs").BcsType<string, string | number | bigint, "u64">;
37
+ }, "@local-pkg/zing_studio::storage::TreasuryUsageBudget">;
34
38
  export declare const StorageTreasury: MoveStruct<{
35
39
  id: MoveStruct<{
36
40
  id: import("@mysten/sui/bcs").BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
@@ -83,6 +87,18 @@ export declare const StorageTreasury: MoveStruct<{
83
87
  length: number;
84
88
  }, string>;
85
89
  }, "0x2::vec_map::VecMap<u32, walrus::storage_resource::Storage>">;
90
+ /** allocated storage size is being used */
91
+ total_used_storage_size_by_epoch: MoveStruct<{
92
+ contents: import("@mysten/sui/bcs").BcsType<{
93
+ key: number;
94
+ value: string;
95
+ }[], Iterable<{
96
+ key: number;
97
+ value: string | number | bigint;
98
+ }> & {
99
+ length: number;
100
+ }, string>;
101
+ }, "0x2::vec_map::VecMap<u32, u64>">;
86
102
  wal_treasury: MoveStruct<{
87
103
  id: MoveStruct<{
88
104
  id: import("@mysten/sui/bcs").BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
@@ -91,7 +107,28 @@ export declare const StorageTreasury: MoveStruct<{
91
107
  value: import("@mysten/sui/bcs").BcsType<string, string | number | bigint, "u64">;
92
108
  }, "0x2::balance::Balance">;
93
109
  }, "0x2::coin::Coin">;
110
+ wal_treasury_usage_budget: MoveStruct<{
111
+ contents: import("@mysten/sui/bcs").BcsType<{
112
+ key: number;
113
+ value: {
114
+ duration: string;
115
+ max_budget: string;
116
+ };
117
+ }[], Iterable<{
118
+ key: number;
119
+ value: {
120
+ duration: string | number | bigint;
121
+ max_budget: string | number | bigint;
122
+ };
123
+ }> & {
124
+ length: number;
125
+ }, string>;
126
+ }, "0x2::vec_map::VecMap<u8, @local-pkg/zing_studio::storage::TreasuryUsageBudget>">;
94
127
  }, "@local-pkg/zing_studio::storage::StorageTreasury">;
128
+ export declare const TreasuryUsage: MoveStruct<{
129
+ accumlataed_budget: import("@mysten/sui/bcs").BcsType<string, string | number | bigint, "u64">;
130
+ start_at: import("@mysten/sui/bcs").BcsType<string, string | number | bigint, "u64">;
131
+ }, "@local-pkg/zing_studio::storage::TreasuryUsage">;
95
132
  export declare const StorageSpace: MoveStruct<{
96
133
  id: MoveStruct<{
97
134
  id: import("@mysten/sui/bcs").BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
@@ -112,7 +149,30 @@ export declare const StorageSpace: MoveStruct<{
112
149
  }, string>;
113
150
  }, "0x2::vec_map::VecMap<u32, u64>">;
114
151
  credits: import("@mysten/sui/bcs").BcsType<string, string | number | bigint, "u64">;
152
+ treasury_usage: MoveStruct<{
153
+ accumlataed_budget: import("@mysten/sui/bcs").BcsType<string, string | number | bigint, "u64">;
154
+ start_at: import("@mysten/sui/bcs").BcsType<string, string | number | bigint, "u64">;
155
+ }, "@local-pkg/zing_studio::storage::TreasuryUsage">;
115
156
  }, "@local-pkg/zing_studio::storage::StorageSpace">;
157
+ export declare const UsageReceipt: MoveStruct<{
158
+ start_budget: import("@mysten/sui/bcs").BcsType<string, string | number | bigint, "u64">;
159
+ }, "@local-pkg/zing_studio::storage::UsageReceipt">;
160
+ export interface TreasuryUsageDurationArguments {
161
+ treasuryUsageBudget: RawTransactionArgument<string>;
162
+ }
163
+ export interface TreasuryUsageDurationOptions {
164
+ package?: string;
165
+ arguments: TreasuryUsageDurationArguments | [treasuryUsageBudget: RawTransactionArgument<string>];
166
+ }
167
+ export declare function treasuryUsageDuration(options: TreasuryUsageDurationOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
168
+ export interface TreasuryUsageMaxBudgetArguments {
169
+ treasuryUsageBudget: RawTransactionArgument<string>;
170
+ }
171
+ export interface TreasuryUsageMaxBudgetOptions {
172
+ package?: string;
173
+ arguments: TreasuryUsageMaxBudgetArguments | [treasuryUsageBudget: RawTransactionArgument<string>];
174
+ }
175
+ export declare function treasuryUsageMaxBudget(options: TreasuryUsageMaxBudgetOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
116
176
  export interface TierPlanArguments {
117
177
  self: RawTransactionArgument<string>;
118
178
  }
@@ -121,6 +181,14 @@ export interface TierPlanOptions {
121
181
  arguments: TierPlanArguments | [self: RawTransactionArgument<string>];
122
182
  }
123
183
  export declare function tierPlan(options: TierPlanOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
184
+ export interface TotalUsedStorageSizeByEpochArguments {
185
+ self: RawTransactionArgument<string>;
186
+ }
187
+ export interface TotalUsedStorageSizeByEpochOptions {
188
+ package?: string;
189
+ arguments: TotalUsedStorageSizeByEpochArguments | [self: RawTransactionArgument<string>];
190
+ }
191
+ export declare function totalUsedStorageSizeByEpoch(options: TotalUsedStorageSizeByEpochOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
124
192
  export interface StoragesByEpochArguments {
125
193
  self: RawTransactionArgument<string>;
126
194
  }
@@ -137,6 +205,14 @@ export interface WalTreasuryOptions {
137
205
  arguments: WalTreasuryArguments | [self: RawTransactionArgument<string>];
138
206
  }
139
207
  export declare function walTreasury(options: WalTreasuryOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
208
+ export interface WalTreasuryUsageBudgetArguments {
209
+ self: RawTransactionArgument<string>;
210
+ }
211
+ export interface WalTreasuryUsageBudgetOptions {
212
+ package?: string;
213
+ arguments: WalTreasuryUsageBudgetArguments | [self: RawTransactionArgument<string>];
214
+ }
215
+ export declare function walTreasuryUsageBudget(options: WalTreasuryUsageBudgetOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
140
216
  export interface TierPriceArguments {
141
217
  tier: RawTransactionArgument<string>;
142
218
  }
@@ -169,6 +245,22 @@ export interface TierStorageLimitOptions {
169
245
  arguments: TierStorageLimitArguments | [tier: RawTransactionArgument<string>];
170
246
  }
171
247
  export declare function tierStorageLimit(options: TierStorageLimitOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
248
+ export interface TreasuryUsageAccumulatedBudgetArguments {
249
+ treasuryUsage: RawTransactionArgument<string>;
250
+ }
251
+ export interface TreasuryUsageAccumulatedBudgetOptions {
252
+ package?: string;
253
+ arguments: TreasuryUsageAccumulatedBudgetArguments | [treasuryUsage: RawTransactionArgument<string>];
254
+ }
255
+ export declare function treasuryUsageAccumulatedBudget(options: TreasuryUsageAccumulatedBudgetOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
256
+ export interface TreasuryUsageStartAtArguments {
257
+ treasuryUsage: RawTransactionArgument<string>;
258
+ }
259
+ export interface TreasuryUsageStartAtOptions {
260
+ package?: string;
261
+ arguments: TreasuryUsageStartAtArguments | [treasuryUsage: RawTransactionArgument<string>];
262
+ }
263
+ export declare function treasuryUsageStartAt(options: TreasuryUsageStartAtOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
172
264
  export interface StorageLimitArguments {
173
265
  self: RawTransactionArgument<string>;
174
266
  storageSpace: RawTransactionArgument<string>;
@@ -226,6 +318,14 @@ export interface CreditsOptions {
226
318
  arguments: CreditsArguments | [storageSpace: RawTransactionArgument<string>];
227
319
  }
228
320
  export declare function credits(options: CreditsOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
321
+ export interface StorageSpaceTreasuryUsageArguments {
322
+ storageSpace: RawTransactionArgument<string>;
323
+ }
324
+ export interface StorageSpaceTreasuryUsageOptions {
325
+ package?: string;
326
+ arguments: StorageSpaceTreasuryUsageArguments | [storageSpace: RawTransactionArgument<string>];
327
+ }
328
+ export declare function storageSpaceTreasuryUsage(options: StorageSpaceTreasuryUsageOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
229
329
  export interface RemainingStorageArguments {
230
330
  self: RawTransactionArgument<string>;
231
331
  storageSpace: RawTransactionArgument<string>;
@@ -264,6 +364,24 @@ export interface UpdateTierPlanOptions {
264
364
  ];
265
365
  }
266
366
  export declare function updateTierPlan(options: UpdateTierPlanOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
367
+ export interface UpdateWalTreasuryUsageBudgetArguments {
368
+ self: RawTransactionArgument<string>;
369
+ Cap: RawTransactionArgument<string>;
370
+ tierIndex: RawTransactionArgument<number>;
371
+ duration: RawTransactionArgument<number | bigint>;
372
+ maxBudget: RawTransactionArgument<number | bigint>;
373
+ }
374
+ export interface UpdateWalTreasuryUsageBudgetOptions {
375
+ package?: string;
376
+ arguments: UpdateWalTreasuryUsageBudgetArguments | [
377
+ self: RawTransactionArgument<string>,
378
+ Cap: RawTransactionArgument<string>,
379
+ tierIndex: RawTransactionArgument<number>,
380
+ duration: RawTransactionArgument<number | bigint>,
381
+ maxBudget: RawTransactionArgument<number | bigint>
382
+ ];
383
+ }
384
+ export declare function updateWalTreasuryUsageBudget(options: UpdateWalTreasuryUsageBudgetOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
267
385
  export interface RemoveStorageByAdminArguments {
268
386
  self: RawTransactionArgument<string>;
269
387
  walrusSystem: RawTransactionArgument<string>;
@@ -56,6 +56,13 @@ export const StorageTier = new MoveStruct({
56
56
  storage_limit: bcs.u64(),
57
57
  },
58
58
  });
59
+ export const TreasuryUsageBudget = new MoveStruct({
60
+ name: `${$moduleName}::TreasuryUsageBudget`,
61
+ fields: {
62
+ duration: bcs.u64(),
63
+ max_budget: bcs.u64(),
64
+ },
65
+ });
59
66
  export const StorageTreasury = new MoveStruct({
60
67
  name: `${$moduleName}::StorageTreasury`,
61
68
  fields: {
@@ -66,7 +73,17 @@ export const StorageTreasury = new MoveStruct({
66
73
  * have multiple storage resources that get fused together
67
74
  */
68
75
  storages_by_epoch: vec_map.VecMap(bcs.u32(), storage_resource.Storage),
76
+ /** allocated storage size is being used */
77
+ total_used_storage_size_by_epoch: vec_map.VecMap(bcs.u32(), bcs.u64()),
69
78
  wal_treasury: coin.Coin,
79
+ wal_treasury_usage_budget: vec_map.VecMap(bcs.u8(), TreasuryUsageBudget),
80
+ },
81
+ });
82
+ export const TreasuryUsage = new MoveStruct({
83
+ name: `${$moduleName}::TreasuryUsage`,
84
+ fields: {
85
+ accumlataed_budget: bcs.u64(),
86
+ start_at: bcs.u64(),
70
87
  },
71
88
  });
72
89
  export const StorageSpace = new MoveStruct({
@@ -79,8 +96,41 @@ export const StorageSpace = new MoveStruct({
79
96
  /** Maps epoch number to storage used in that epoch */
80
97
  storage_used: vec_map.VecMap(bcs.u32(), bcs.u64()),
81
98
  credits: bcs.u64(),
99
+ treasury_usage: TreasuryUsage,
82
100
  },
83
101
  });
102
+ export const UsageReceipt = new MoveStruct({
103
+ name: `${$moduleName}::UsageReceipt`,
104
+ fields: {
105
+ start_budget: bcs.u64(),
106
+ },
107
+ });
108
+ export function treasuryUsageDuration(options) {
109
+ const packageAddress = options.package ?? "@local-pkg/zing_studio";
110
+ const argumentsTypes = [
111
+ `${packageAddress}::storage::TreasuryUsageBudget`,
112
+ ];
113
+ const parameterNames = ["treasuryUsageBudget"];
114
+ return (tx) => tx.moveCall({
115
+ package: packageAddress,
116
+ module: "storage",
117
+ function: "treasury_usage_duration",
118
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
119
+ });
120
+ }
121
+ export function treasuryUsageMaxBudget(options) {
122
+ const packageAddress = options.package ?? "@local-pkg/zing_studio";
123
+ const argumentsTypes = [
124
+ `${packageAddress}::storage::TreasuryUsageBudget`,
125
+ ];
126
+ const parameterNames = ["treasuryUsageBudget"];
127
+ return (tx) => tx.moveCall({
128
+ package: packageAddress,
129
+ module: "storage",
130
+ function: "treasury_usage_max_budget",
131
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
132
+ });
133
+ }
84
134
  export function tierPlan(options) {
85
135
  const packageAddress = options.package ?? "@local-pkg/zing_studio";
86
136
  const argumentsTypes = [
@@ -94,6 +144,19 @@ export function tierPlan(options) {
94
144
  arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
95
145
  });
96
146
  }
147
+ export function totalUsedStorageSizeByEpoch(options) {
148
+ const packageAddress = options.package ?? "@local-pkg/zing_studio";
149
+ const argumentsTypes = [
150
+ `${packageAddress}::storage::StorageTreasury`,
151
+ ];
152
+ const parameterNames = ["self"];
153
+ return (tx) => tx.moveCall({
154
+ package: packageAddress,
155
+ module: "storage",
156
+ function: "total_used_storage_size_by_epoch",
157
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
158
+ });
159
+ }
97
160
  export function storagesByEpoch(options) {
98
161
  const packageAddress = options.package ?? "@local-pkg/zing_studio";
99
162
  const argumentsTypes = [
@@ -120,6 +183,19 @@ export function walTreasury(options) {
120
183
  arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
121
184
  });
122
185
  }
186
+ export function walTreasuryUsageBudget(options) {
187
+ const packageAddress = options.package ?? "@local-pkg/zing_studio";
188
+ const argumentsTypes = [
189
+ `${packageAddress}::storage::StorageTreasury`,
190
+ ];
191
+ const parameterNames = ["self"];
192
+ return (tx) => tx.moveCall({
193
+ package: packageAddress,
194
+ module: "storage",
195
+ function: "wal_treasury_usage_budget",
196
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
197
+ });
198
+ }
123
199
  export function tierPrice(options) {
124
200
  const packageAddress = options.package ?? "@local-pkg/zing_studio";
125
201
  const argumentsTypes = [
@@ -172,6 +248,32 @@ export function tierStorageLimit(options) {
172
248
  arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
173
249
  });
174
250
  }
251
+ export function treasuryUsageAccumulatedBudget(options) {
252
+ const packageAddress = options.package ?? "@local-pkg/zing_studio";
253
+ const argumentsTypes = [
254
+ `${packageAddress}::storage::TreasuryUsage`,
255
+ ];
256
+ const parameterNames = ["treasuryUsage"];
257
+ return (tx) => tx.moveCall({
258
+ package: packageAddress,
259
+ module: "storage",
260
+ function: "treasury_usage_accumulated_budget",
261
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
262
+ });
263
+ }
264
+ export function treasuryUsageStartAt(options) {
265
+ const packageAddress = options.package ?? "@local-pkg/zing_studio";
266
+ const argumentsTypes = [
267
+ `${packageAddress}::storage::TreasuryUsage`,
268
+ ];
269
+ const parameterNames = ["treasuryUsage"];
270
+ return (tx) => tx.moveCall({
271
+ package: packageAddress,
272
+ module: "storage",
273
+ function: "treasury_usage_start_at",
274
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
275
+ });
276
+ }
175
277
  export function storageLimit(options) {
176
278
  const packageAddress = options.package ?? "@local-pkg/zing_studio";
177
279
  const argumentsTypes = [
@@ -253,6 +355,19 @@ export function credits(options) {
253
355
  arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
254
356
  });
255
357
  }
358
+ export function storageSpaceTreasuryUsage(options) {
359
+ const packageAddress = options.package ?? "@local-pkg/zing_studio";
360
+ const argumentsTypes = [
361
+ `${packageAddress}::storage::StorageSpace`,
362
+ ];
363
+ const parameterNames = ["storageSpace"];
364
+ return (tx) => tx.moveCall({
365
+ package: packageAddress,
366
+ module: "storage",
367
+ function: "storage_space_treasury_usage",
368
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
369
+ });
370
+ }
256
371
  /**
257
372
  * Calculates the remaining available storage capacity Returns 0 if already over
258
373
  * limit (defensive programming)
@@ -297,6 +412,23 @@ export function updateTierPlan(options) {
297
412
  arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
298
413
  });
299
414
  }
415
+ export function updateWalTreasuryUsageBudget(options) {
416
+ const packageAddress = options.package ?? "@local-pkg/zing_studio";
417
+ const argumentsTypes = [
418
+ `${packageAddress}::storage::StorageTreasury`,
419
+ `${packageAddress}::admin::AdminCap`,
420
+ "u8",
421
+ "u64",
422
+ "u64",
423
+ ];
424
+ const parameterNames = ["self", "Cap", "tierIndex", "duration", "maxBudget"];
425
+ return (tx) => tx.moveCall({
426
+ package: packageAddress,
427
+ module: "storage",
428
+ function: "update_wal_treasury_usage_budget",
429
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
430
+ });
431
+ }
300
432
  /**
301
433
  * Admin function to remove storage from treasury for a specific epoch Requires
302
434
  * AdminCap to ensure only authorized users can call this Returns the requested
@@ -48,11 +48,32 @@ export declare const Studio: MoveStruct<{
48
48
  encrypted_file_key: import("@mysten/sui/bcs").BcsType<number[] | null, (Iterable<number> & {
49
49
  length: number;
50
50
  }) | null | undefined, "Option<vector<u8>>">;
51
+ earnings: MoveStruct<{
52
+ contents: import("@mysten/sui/bcs").BcsType<{
53
+ key: string;
54
+ value: string;
55
+ }[], Iterable<{
56
+ key: string;
57
+ value: string | number | bigint;
58
+ }> & {
59
+ length: number;
60
+ }, string>;
61
+ }, "0x2::vec_map::VecMap<string, u64>">;
51
62
  }, "@local-pkg/zing_studio::studio::Studio">;
52
63
  export declare const Member: MoveStruct<{
53
64
  level: import("@mysten/sui/bcs").BcsType<number, number, "u8">;
54
65
  expired_at: import("@mysten/sui/bcs").BcsType<string, string | number | bigint, "u64">;
55
66
  }, "@local-pkg/zing_studio::studio::Member">;
67
+ export interface DonationEarningKeyOptions {
68
+ package?: string;
69
+ arguments?: [];
70
+ }
71
+ export declare function donationEarningKey(options?: DonationEarningKeyOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
72
+ export interface MembershipSubscriptionEarningKeyOptions {
73
+ package?: string;
74
+ arguments?: [];
75
+ }
76
+ export declare function membershipSubscriptionEarningKey(options?: MembershipSubscriptionEarningKeyOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
56
77
  export interface OwnerArguments {
57
78
  self: RawTransactionArgument<string>;
58
79
  }
@@ -110,6 +131,14 @@ export interface MonthlySubscriptionFeeOptions {
110
131
  arguments: MonthlySubscriptionFeeArguments | [self: RawTransactionArgument<string>];
111
132
  }
112
133
  export declare function monthlySubscriptionFee(options: MonthlySubscriptionFeeOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
134
+ export interface EarningsArguments {
135
+ self: RawTransactionArgument<string>;
136
+ }
137
+ export interface EarningsOptions {
138
+ package?: string;
139
+ arguments: EarningsArguments | [self: RawTransactionArgument<string>];
140
+ }
141
+ export declare function earnings(options: EarningsOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
113
142
  export interface MembershipArguments {
114
143
  self: RawTransactionArgument<string>;
115
144
  }
@@ -280,3 +309,11 @@ export interface ShareStudioOptions {
280
309
  arguments: ShareStudioArguments | [self: RawTransactionArgument<string>];
281
310
  }
282
311
  export declare function shareStudio(options: ShareStudioOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
312
+ export interface TotalEarningArguments {
313
+ self: RawTransactionArgument<string>;
314
+ }
315
+ export interface TotalEarningOptions {
316
+ package?: string;
317
+ arguments: TotalEarningArguments | [self: RawTransactionArgument<string>];
318
+ }
319
+ export declare function totalEarning(options: TotalEarningOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
@@ -42,6 +42,7 @@ export const Studio = new MoveStruct({
42
42
  /** Bag containing the actual asset objects, indexed by their IDs */
43
43
  works: derived_object_bag.DerivedObjectBag,
44
44
  encrypted_file_key: bcs.option(bcs.vector(bcs.u8())),
45
+ earnings: vec_map.VecMap(bcs.string(), bcs.u64()),
45
46
  },
46
47
  });
47
48
  export const Member = new MoveStruct({
@@ -51,6 +52,22 @@ export const Member = new MoveStruct({
51
52
  expired_at: bcs.u64(),
52
53
  },
53
54
  });
55
+ export function donationEarningKey(options = {}) {
56
+ const packageAddress = options.package ?? "@local-pkg/zing_studio";
57
+ return (tx) => tx.moveCall({
58
+ package: packageAddress,
59
+ module: "studio",
60
+ function: "donation_earning_key",
61
+ });
62
+ }
63
+ export function membershipSubscriptionEarningKey(options = {}) {
64
+ const packageAddress = options.package ?? "@local-pkg/zing_studio";
65
+ return (tx) => tx.moveCall({
66
+ package: packageAddress,
67
+ module: "studio",
68
+ function: "membership_subscription_earning_key",
69
+ });
70
+ }
54
71
  /** Returns the owner address of this studio */
55
72
  export function owner(options) {
56
73
  const packageAddress = options.package ?? "@local-pkg/zing_studio";
@@ -143,6 +160,19 @@ export function monthlySubscriptionFee(options) {
143
160
  arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
144
161
  });
145
162
  }
163
+ export function earnings(options) {
164
+ const packageAddress = options.package ?? "@local-pkg/zing_studio";
165
+ const argumentsTypes = [
166
+ `${packageAddress}::studio::Studio`,
167
+ ];
168
+ const parameterNames = ["self"];
169
+ return (tx) => tx.moveCall({
170
+ package: packageAddress,
171
+ module: "studio",
172
+ function: "earnings",
173
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
174
+ });
175
+ }
146
176
  export function membership(options) {
147
177
  const packageAddress = options.package ?? "@local-pkg/zing_studio";
148
178
  const argumentsTypes = [
@@ -358,3 +388,16 @@ export function shareStudio(options) {
358
388
  arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
359
389
  });
360
390
  }
391
+ export function totalEarning(options) {
392
+ const packageAddress = options.package ?? "@local-pkg/zing_studio";
393
+ const argumentsTypes = [
394
+ `${packageAddress}::studio::Studio`,
395
+ ];
396
+ const parameterNames = ["self"];
397
+ return (tx) => tx.moveCall({
398
+ package: packageAddress,
399
+ module: "studio",
400
+ function: "total_earning",
401
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
402
+ });
403
+ }
@@ -53,6 +53,12 @@ export declare class ZingClient {
53
53
  size: string;
54
54
  };
55
55
  encrypted_file_key: number[] | null;
56
+ earnings: {
57
+ contents: {
58
+ key: string;
59
+ value: string;
60
+ }[];
61
+ };
56
62
  } | null>;
57
63
  getStorageSpace(owner: string): Promise<{
58
64
  id: {
@@ -67,6 +73,10 @@ export declare class ZingClient {
67
73
  }[];
68
74
  };
69
75
  credits: string;
76
+ treasury_usage: {
77
+ accumlataed_budget: string;
78
+ start_at: string;
79
+ };
70
80
  } | null>;
71
81
  getStorageTreasury(): Promise<{
72
82
  id: {
@@ -95,6 +105,12 @@ export declare class ZingClient {
95
105
  };
96
106
  }[];
97
107
  };
108
+ total_used_storage_size_by_epoch: {
109
+ contents: {
110
+ key: number;
111
+ value: string;
112
+ }[];
113
+ };
98
114
  wal_treasury: {
99
115
  id: {
100
116
  id: string;
@@ -103,6 +119,15 @@ export declare class ZingClient {
103
119
  value: string;
104
120
  };
105
121
  };
122
+ wal_treasury_usage_budget: {
123
+ contents: {
124
+ key: number;
125
+ value: {
126
+ duration: string;
127
+ max_budget: string;
128
+ };
129
+ }[];
130
+ };
106
131
  } | null>;
107
132
  getMember(owner: string, member: string): Promise<{
108
133
  level: number;
@@ -1,8 +1,8 @@
1
1
  export const testnetZingConfig = {
2
2
  ZING_FRAMEWORK_PACKAGE_ADDRESS: "0xd851eb5b907b60aa5fd958dd74044d809c49ee60001cad621726f03ea138f943",
3
3
  ZING_IDENTITY_PACKAGE_ADDRESS: "0xaaf27a90890ac1efface4fbb22597e95829cbe6cbb771df02f0d2cc93f067c70",
4
- ZING_STUDIO_PACKAGE_ADDRESS: "0x455bd1ba1afe47158c9155001f33b4069c9f008d091eef28f61c47c857bf60aa",
5
- ZING_STUDIO_V0_PACKAGE_ADDRESS: "0x455bd1ba1afe47158c9155001f33b4069c9f008d091eef28f61c47c857bf60aa",
4
+ ZING_STUDIO_PACKAGE_ADDRESS: "0x3502955f106ee334653443005b37ebc6d1ddf7b9c704d39090263ae136ba599d",
5
+ ZING_STUDIO_V0_PACKAGE_ADDRESS: "0x3502955f106ee334653443005b37ebc6d1ddf7b9c704d39090263ae136ba599d",
6
6
  ZING_TREASURY_SHARED_OBJECT_REF: {
7
7
  objectId: "0xca56bc3982525decbd4b025d3d4ae4de07259d6efc187577bfc3ab212e20574f",
8
8
  initialSharedVersion: 645292716,
@@ -33,8 +33,8 @@ export const testnetZingConfig = {
33
33
  },
34
34
  },
35
35
  ZING_STUDIO_CONFIG_SHARED_OBJECT_REF: {
36
- objectId: "0x4257dc4f3a3fe73e5f8d8c86c2233210876c35dc9b369f72d6aab0521733e57e",
37
- initialSharedVersion: 723767900,
36
+ objectId: "0x0fff74127495094c4f8b0736a0bf4a0c8612e0a8c37342495d8aa00073d25c1e",
37
+ initialSharedVersion: 745941918,
38
38
  mutable: false,
39
39
  },
40
40
  ZING_STORAGE_TREASURY_SHARED_OBJECT_REF: {
@@ -43,10 +43,10 @@ export const testnetZingConfig = {
43
43
  mutable: true,
44
44
  },
45
45
  ZING_WORKS_TYPE: {
46
- article: "0x455bd1ba1afe47158c9155001f33b4069c9f008d091eef28f61c47c857bf60aa::article::Article",
46
+ article: "0x3502955f106ee334653443005b37ebc6d1ddf7b9c704d39090263ae136ba599d::article::Article",
47
47
  },
48
48
  EVENT_TYPES: {
49
- publishArticleEvent: "0x455bd1ba1afe47158c9155001f33b4069c9f008d091eef28f61c47c857bf60aa::article::PublishArticleEvent",
49
+ publishArticleEvent: "0x3502955f106ee334653443005b37ebc6d1ddf7b9c704d39090263ae136ba599d::article::PublishArticleEvent",
50
50
  },
51
51
  };
52
52
  export const testnetWalrusConfig = {
package/dist/getters.d.ts CHANGED
@@ -44,6 +44,12 @@ export declare function getStudio(suiGrpcClient: SuiGrpcClient, studioId: string
44
44
  size: string;
45
45
  };
46
46
  encrypted_file_key: number[] | null;
47
+ earnings: {
48
+ contents: {
49
+ key: string;
50
+ value: string;
51
+ }[];
52
+ };
47
53
  } | null>;
48
54
  export declare function getStorageSpace(suiGrpcClient: SuiGrpcClient, storageSpaceId: string): Promise<{
49
55
  id: {
@@ -58,6 +64,10 @@ export declare function getStorageSpace(suiGrpcClient: SuiGrpcClient, storageSpa
58
64
  }[];
59
65
  };
60
66
  credits: string;
67
+ treasury_usage: {
68
+ accumlataed_budget: string;
69
+ start_at: string;
70
+ };
61
71
  } | null>;
62
72
  export declare function getStorageTreasury(suiGrpcClient: SuiGrpcClient, storageTreasuryId: string): Promise<{
63
73
  id: {
@@ -86,6 +96,12 @@ export declare function getStorageTreasury(suiGrpcClient: SuiGrpcClient, storage
86
96
  };
87
97
  }[];
88
98
  };
99
+ total_used_storage_size_by_epoch: {
100
+ contents: {
101
+ key: number;
102
+ value: string;
103
+ }[];
104
+ };
89
105
  wal_treasury: {
90
106
  id: {
91
107
  id: string;
@@ -94,6 +110,15 @@ export declare function getStorageTreasury(suiGrpcClient: SuiGrpcClient, storage
94
110
  value: string;
95
111
  };
96
112
  };
113
+ wal_treasury_usage_budget: {
114
+ contents: {
115
+ key: number;
116
+ value: {
117
+ duration: string;
118
+ max_budget: string;
119
+ };
120
+ }[];
121
+ };
97
122
  } | null>;
98
123
  export declare function getMember(suiGrpcClient: SuiGrpcClient, membershipTableId: string, member: string): Promise<{
99
124
  level: number;
@@ -23,4 +23,10 @@ export declare function useGetStudio(suiAddress?: string): import("@tanstack/rea
23
23
  size: string;
24
24
  };
25
25
  encrypted_file_key: number[] | null;
26
+ earnings: {
27
+ contents: {
28
+ key: string;
29
+ value: string;
30
+ }[];
31
+ };
26
32
  } | null, Error>;
@@ -31,6 +31,12 @@ declare const zingQueryMethodMap: (zingClient: ZingClient) => {
31
31
  size: string;
32
32
  };
33
33
  encrypted_file_key: number[] | null;
34
+ earnings: {
35
+ contents: {
36
+ key: string;
37
+ value: string;
38
+ }[];
39
+ };
34
40
  } | null>;
35
41
  getStorageSpace: (owner: string) => Promise<{
36
42
  id: {
@@ -45,6 +51,10 @@ declare const zingQueryMethodMap: (zingClient: ZingClient) => {
45
51
  }[];
46
52
  };
47
53
  credits: string;
54
+ treasury_usage: {
55
+ accumlataed_budget: string;
56
+ start_at: string;
57
+ };
48
58
  } | null>;
49
59
  getStorageTreasury: () => Promise<{
50
60
  id: {
@@ -73,6 +83,12 @@ declare const zingQueryMethodMap: (zingClient: ZingClient) => {
73
83
  };
74
84
  }[];
75
85
  };
86
+ total_used_storage_size_by_epoch: {
87
+ contents: {
88
+ key: number;
89
+ value: string;
90
+ }[];
91
+ };
76
92
  wal_treasury: {
77
93
  id: {
78
94
  id: string;
@@ -81,6 +97,15 @@ declare const zingQueryMethodMap: (zingClient: ZingClient) => {
81
97
  value: string;
82
98
  };
83
99
  };
100
+ wal_treasury_usage_budget: {
101
+ contents: {
102
+ key: number;
103
+ value: {
104
+ duration: string;
105
+ max_budget: string;
106
+ };
107
+ }[];
108
+ };
84
109
  } | null>;
85
110
  getMember: (owner: string, member: string) => Promise<{
86
111
  level: number;
@@ -32,6 +32,12 @@ declare const zingQueryMethodMap: (zingClient: ZingClient) => {
32
32
  size: string;
33
33
  };
34
34
  encrypted_file_key: number[] | null;
35
+ earnings: {
36
+ contents: {
37
+ key: string;
38
+ value: string;
39
+ }[];
40
+ };
35
41
  } | null>;
36
42
  getStorageSpace: (owner: string) => Promise<{
37
43
  id: {
@@ -46,6 +52,10 @@ declare const zingQueryMethodMap: (zingClient: ZingClient) => {
46
52
  }[];
47
53
  };
48
54
  credits: string;
55
+ treasury_usage: {
56
+ accumlataed_budget: string;
57
+ start_at: string;
58
+ };
49
59
  } | null>;
50
60
  getStorageTreasury: () => Promise<{
51
61
  id: {
@@ -74,6 +84,12 @@ declare const zingQueryMethodMap: (zingClient: ZingClient) => {
74
84
  };
75
85
  }[];
76
86
  };
87
+ total_used_storage_size_by_epoch: {
88
+ contents: {
89
+ key: number;
90
+ value: string;
91
+ }[];
92
+ };
77
93
  wal_treasury: {
78
94
  id: {
79
95
  id: string;
@@ -82,6 +98,15 @@ declare const zingQueryMethodMap: (zingClient: ZingClient) => {
82
98
  value: string;
83
99
  };
84
100
  };
101
+ wal_treasury_usage_budget: {
102
+ contents: {
103
+ key: number;
104
+ value: {
105
+ duration: string;
106
+ max_budget: string;
107
+ };
108
+ }[];
109
+ };
85
110
  } | null>;
86
111
  getMember: (owner: string, member: string) => Promise<{
87
112
  level: number;
@@ -2,9 +2,8 @@ import { zkloginStorage } from "../stores/zkloginStore.js";
2
2
  import { Ed25519Keypair } from "@mysten/sui/keypairs/ed25519";
3
3
  import { fromBase64 } from "@mysten/sui/utils";
4
4
  import { decodeJwt } from "@mysten/sui/zklogin";
5
- const SALT_SERVER_BASE_URL =
6
- // "https://salt-server-production.up.railway.app";
7
- "http://localhost:3001";
5
+ const SALT_SERVER_BASE_URL = "https://salt-server-production.up.railway.app";
6
+ // "http://localhost:3001";
8
7
  export async function getSigner(suiClient) {
9
8
  const zkLoginStorage = await zkloginStorage.getState();
10
9
  const { epoch: currentEpoch } = await suiClient.getLatestSuiSystemState();
@@ -42,9 +42,9 @@ export function buildPublishArticleTransaction(config, walrusSystem, walTreasury
42
42
  storageTreasury: tx.sharedObjectRef(zingStorageTreasurySharedObjectRef),
43
43
  storageSpace: tx.object(getDerivedStorageID(zingStudioConfigSharedObjectRef.objectId, owner)),
44
44
  subscriptionLevel: tx.pure.option("u8", subscriptionLevel),
45
- blobId: blobIdToInt(blobId),
46
- rootHash: BigInt(bcs.u256().parse(rootHash)),
47
- unencodedBlobSize: fileSize,
45
+ blobIds: [blobIdToInt(blobId)],
46
+ rootHashes: [BigInt(bcs.u256().parse(rootHash))],
47
+ unencodedBlobSizes: [BigInt(fileSize)],
48
48
  encodingType: REDSTUFF_CODING_TYPE,
49
49
  identifiers: tx.pure.vector("string", articleMetadata.map((m) => m.identifier)),
50
50
  blobIndexes: tx.pure.vector("u64", articleMetadata.map(() => 0)),
@@ -120,12 +120,12 @@ export function createWalletStore(config) {
120
120
  extendedEphemeralPublicKey,
121
121
  jwtRandomness: randomness,
122
122
  });
123
- if (!zkProofResponse?.result)
124
- throw new Error(`Failed to get zkProof: ${zkProofResponse.error}`);
125
- zkloginStorage
126
- .getState()
127
- .setZKProof(JSON.stringify(zkProofResponse.result.zkProof));
128
- const suiAddress = zkProofResponse.result.suiAddress;
123
+ if (!zkProofResponse || !zkProofResponse.zkProof) {
124
+ throw new Error("Invalid response from proof server: Missing zkProof");
125
+ }
126
+ // 2. Access keys directly from the response (no .result nesting)
127
+ const { zkProof, suiAddress } = zkProofResponse;
128
+ zkloginStorage.getState().setZKProof(JSON.stringify(zkProof));
129
129
  zkloginStorage.getState().setSuiAddress(suiAddress);
130
130
  const account = { jwt: decoded };
131
131
  set({
@@ -133,7 +133,7 @@ export function createWalletStore(config) {
133
133
  decodedJwt: decoded,
134
134
  ephemeralKeyPair,
135
135
  suiAddress,
136
- zkProof: zkProofResponse.result.zkProof,
136
+ zkProof,
137
137
  maxEpoch,
138
138
  account,
139
139
  isConnected: true,
@@ -204,8 +204,6 @@ export function createWalletStore(config) {
204
204
  const ephemeralKeyPair = Ed25519Keypair.fromSecretKey(fromBase64(stored.ephemeralSecretKey));
205
205
  const decoded = decodeJwt(stored.jwt);
206
206
  const zkProofParsed = JSON.parse(stored.zkProof);
207
- console.log({ decodeJwt: decoded });
208
- console.log({ zkProofParsed: zkProofParsed });
209
207
  set({
210
208
  jwtTokenString: stored.jwt,
211
209
  decodedJwt: decoded,
package/dist/types.d.ts CHANGED
@@ -81,15 +81,19 @@ export interface ZkLoginProofParams {
81
81
  jwtRandomness: string;
82
82
  }
83
83
  export interface ZkLoginProofResponse {
84
- id: number;
85
- result?: {
86
- zkProof: PartialZkLoginSignature;
87
- suiAddress: string;
88
- };
89
- error?: {
90
- code: number;
91
- message: string;
84
+ zkProof: {
85
+ proofPoints: {
86
+ a: string[];
87
+ b: string[][];
88
+ c: string[];
89
+ };
90
+ issBase64Details: {
91
+ value: string;
92
+ indexMod4: number;
93
+ };
94
+ headerBase64: string;
92
95
  };
96
+ suiAddress: string;
93
97
  }
94
98
  export interface TierPlan {
95
99
  name: string;
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@zing-protocol/zing-sdk",
3
3
  "sideEffects": false,
4
4
  "type": "module",
5
- "version": "0.0.6",
5
+ "version": "0.0.9",
6
6
  "main": "./dist/index.js",
7
7
  "types": "./dist/index.d.ts",
8
8
  "exports": {