@zing-protocol/zing-sdk 0.0.3 → 0.0.5

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.
@@ -2,7 +2,7 @@ import { SessionKey } from "@mysten/seal";
2
2
  import { Transaction } from "@mysten/sui/transactions";
3
3
  import type { PurchaseStorageTierParams, SetMonthlySubscriptionFeeParams, SubscribeParams } from "./types.js";
4
4
  import type { CoinSymbol, PlatformType, WorkType } from "../config/index.js";
5
- import type { Config, WalrusSystemState } from "../config/types.js";
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
8
  import type { SuiGrpcClient } from "@mysten/sui/grpc";
@@ -119,7 +119,7 @@ export declare class ZingClient {
119
119
  nextCursor: string | undefined;
120
120
  hasNextPage: boolean;
121
121
  }>;
122
- getWork(walrusSystem: WalrusSystemState, workId: string, workType?: WorkType): Promise<{
122
+ getWork(workId: string, workType?: WorkType): Promise<{
123
123
  id: {
124
124
  id: string;
125
125
  };
@@ -157,7 +157,7 @@ export declare class ZingClient {
157
157
  }[];
158
158
  };
159
159
  } | null>;
160
- getWorks(walrusSystem: WalrusSystemState, owner: string, workType?: WorkType, cursor?: string, limit?: number): Promise<{
160
+ getWorks(owner: string, workType?: WorkType, cursor?: string, limit?: number): Promise<{
161
161
  data: {
162
162
  id: {
163
163
  id: string;
@@ -76,11 +76,11 @@ export class ZingClient {
76
76
  async getMembers(owner, cursor, limit = 20) {
77
77
  return getMembers(this.suiGrpcClient, this.getDerivedMembershipID(owner), cursor, limit);
78
78
  }
79
- async getWork(walrusSystem, workId, workType) {
80
- return getWork(this.suiGrpcClient, walrusSystem, workId, workType ? this.config.zing.ZING_WORKS_TYPE[workType] : undefined);
79
+ async getWork(workId, workType) {
80
+ return getWork(this.suiGrpcClient, workId, workType ? this.config.zing.ZING_WORKS_TYPE[workType] : undefined);
81
81
  }
82
- async getWorks(walrusSystem, owner, workType, cursor, limit = 20) {
83
- return getWorks(this.suiGrpcClient, walrusSystem, this.getDerivedWorksID(owner), workType ? this.config.zing.ZING_WORKS_TYPE[workType] : undefined, cursor, limit);
82
+ async getWorks(owner, workType, cursor, limit = 20) {
83
+ return getWorks(this.suiGrpcClient, this.getDerivedWorksID(owner), workType ? this.config.zing.ZING_WORKS_TYPE[workType] : undefined, cursor, limit);
84
84
  }
85
85
  async getBalance(owner, coinSymbol) {
86
86
  return this.suiGrpcClient.stateService
package/dist/getters.d.ts CHANGED
@@ -1,5 +1,4 @@
1
1
  import { QuiltPatchId } from "./bcs.js";
2
- import type { WalrusSystemState } from "./config/types.js";
3
2
  import type { SuiGrpcClient } from "@mysten/sui/grpc";
4
3
  import type { SuiJsonRpcClient } from "@mysten/sui/jsonRpc";
5
4
  import type { EncodingType, WalrusClient } from "@mysten/walrus";
@@ -109,7 +108,7 @@ export declare function getMembers(suiGrpcClient: SuiGrpcClient, membershipTable
109
108
  nextCursor: string | undefined;
110
109
  hasNextPage: boolean;
111
110
  }>;
112
- export declare function getWork(suiGrpcClient: SuiGrpcClient, walrusSystem: WalrusSystemState, workId: string, workType?: string): Promise<{
111
+ export declare function getWork(suiGrpcClient: SuiGrpcClient, workId: string, workType?: string): Promise<{
113
112
  id: {
114
113
  id: string;
115
114
  };
@@ -147,7 +146,7 @@ export declare function getWork(suiGrpcClient: SuiGrpcClient, walrusSystem: Walr
147
146
  }[];
148
147
  };
149
148
  } | null>;
150
- export declare function getWorks(suiGrpcClient: SuiGrpcClient, walrusSystem: WalrusSystemState, workTableId: string, workType?: string, cursor?: string, limit?: number): Promise<{
149
+ export declare function getWorks(suiGrpcClient: SuiGrpcClient, workTableId: string, workType?: string, cursor?: string, limit?: number): Promise<{
151
150
  data: {
152
151
  id: {
153
152
  id: string;
package/dist/getters.js CHANGED
@@ -171,7 +171,7 @@ export async function getMembers(suiGrpcClient, membershipTableId, cursor, limit
171
171
  hasNextPage: res.response.nextPageToken !== undefined,
172
172
  };
173
173
  }
174
- export async function getWork(suiGrpcClient, walrusSystem, workId, workType) {
174
+ export async function getWork(suiGrpcClient, workId, workType) {
175
175
  const res = await suiGrpcClient.ledgerService.getObject({
176
176
  objectId: workId,
177
177
  readMask: {
@@ -189,7 +189,7 @@ export async function getWork(suiGrpcClient, walrusSystem, workId, workType) {
189
189
  return null;
190
190
  return Article.parse(suiMoveObject.data.MoveObject.contents);
191
191
  }
192
- export async function getWorks(suiGrpcClient, walrusSystem, workTableId, workType, cursor, limit = 20) {
192
+ export async function getWorks(suiGrpcClient, workTableId, workType, cursor, limit = 20) {
193
193
  const res = await suiGrpcClient.stateService.listDynamicFields({
194
194
  parent: workTableId,
195
195
  pageToken: cursor ? fromBase64(cursor) : undefined,
@@ -208,14 +208,8 @@ export async function getWorks(suiGrpcClient, walrusSystem, workTableId, workTyp
208
208
  return Article.parse(df.childObject.contents.value);
209
209
  });
210
210
  const data = works
211
- .filter((d) => {
212
- if (!d || d.blobs.length === 0 || d.deleted)
213
- return false;
214
- const minEndEpoch = Math.min(...d.blobs.map((b) => b.storage.end_epoch));
215
- return minEndEpoch > walrusSystem.committee.epoch;
216
- })
211
+ .filter((d) => Boolean(d))
217
212
  .sort((a, b) => Number(b.created_at) - Number(a.created_at));
218
- console.log({ getWorksData: data });
219
213
  return {
220
214
  data,
221
215
  nextCursor: res.response.nextPageToken
@@ -11,7 +11,7 @@ declare const zingInfiniteQueryMethodMap: (zingClient: ZingClient) => {
11
11
  nextCursor: string | undefined;
12
12
  hasNextPage: boolean;
13
13
  }>;
14
- getWorks: (walrusSystem: import("../index.js").WalrusSystemState, owner: string, workType?: import("../index.js").WorkType, cursor?: string, limit?: number) => Promise<{
14
+ getWorks: (owner: string, workType?: import("../index.js").WorkType, cursor?: string, limit?: number) => Promise<{
15
15
  data: {
16
16
  id: {
17
17
  id: string;
@@ -88,7 +88,7 @@ declare const zingQueryMethodMap: (zingClient: ZingClient) => {
88
88
  expired_at: string;
89
89
  } | null>;
90
90
  getBalance: (owner: string, coinSymbol: import("../index.js").CoinSymbol) => Promise<import("node_modules/@mysten/sui/dist/esm/grpc/proto/sui/rpc/v2/state_service.js").GetBalanceResponse>;
91
- getWork: (walrusSystem: import("../index.js").WalrusSystemState, workId: string, workType?: import("../index.js").WorkType) => Promise<{
91
+ getWork: (workId: string, workType?: import("../index.js").WorkType) => Promise<{
92
92
  id: {
93
93
  id: string;
94
94
  };
package/dist/index.d.ts CHANGED
@@ -7,6 +7,7 @@ export * from "./hooks/index.js";
7
7
  export * from "./bcs.js";
8
8
  export * from "./_generated/index.js";
9
9
  export * from "./components/index.js";
10
+ export * from "./client/index.js";
10
11
  export type * from "./types.js";
11
12
  export type InfiniteQueryResult<TData> = {
12
13
  pages: TData[];
package/dist/index.js CHANGED
@@ -7,3 +7,4 @@ export * from "./hooks/index.js";
7
7
  export * from "./bcs.js";
8
8
  export * from "./_generated/index.js";
9
9
  export * from "./components/index.js";
10
+ export * from "./client/index.js";
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.3",
5
+ "version": "0.0.5",
6
6
  "main": "./dist/index.js",
7
7
  "types": "./dist/index.d.ts",
8
8
  "exports": {