@scallop-io/sui-scallop-sdk 0.47.3 → 0.47.4

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.
@@ -386,7 +386,10 @@ export declare class ScallopQuery {
386
386
  * @param walletAddress
387
387
  * @returns array of veSca
388
388
  */
389
- getVeScas(walletAddress?: string): Promise<import("../types").Vesca[]>;
389
+ getVeScas({ walletAddress, excludeEmpty, }?: {
390
+ walletAddress?: string;
391
+ excludeEmpty?: boolean;
392
+ }): Promise<import("../types").Vesca[]>;
390
393
  /**
391
394
  * Get total vesca treasury with movecall
392
395
  * @returns Promise<string | undefined>
@@ -18,7 +18,7 @@ export declare const getVescaKeys: (utils: ScallopUtils, ownerAddress?: string)
18
18
  */
19
19
  export declare const getVeScas: ({ utils, }: {
20
20
  utils: ScallopUtils;
21
- }, ownerAddress?: string) => Promise<Vesca[]>;
21
+ }, ownerAddress?: string, excludeEmpty?: boolean) => Promise<Vesca[]>;
22
22
  /**
23
23
  * Get veSca data.
24
24
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scallop-io/sui-scallop-sdk",
3
- "version": "0.47.3",
3
+ "version": "0.47.4",
4
4
  "description": "Typescript sdk for interacting with Scallop contract on SUI",
5
5
  "keywords": [
6
6
  "sui",
@@ -1095,7 +1095,9 @@ export class ScallopClient {
1095
1095
  ): Promise<ScallopClientVeScaReturnType<S>> {
1096
1096
  // get all veSca keys
1097
1097
  const veScaKeys = (
1098
- (await this.query.getVeScas(this.walletAddress)) ?? []
1098
+ (await this.query.getVeScas({
1099
+ walletAddress: this.walletAddress,
1100
+ })) ?? []
1099
1101
  ).map(({ keyObject }) => keyObject);
1100
1102
  if (veScaKeys.length === 0) {
1101
1103
  throw new Error('No veSCA found in the wallet');
@@ -579,8 +579,14 @@ export class ScallopQuery {
579
579
  * @param walletAddress
580
580
  * @returns array of veSca
581
581
  */
582
- public async getVeScas(walletAddress: string = this.walletAddress) {
583
- return await getVeScas(this, walletAddress);
582
+ public async getVeScas({
583
+ walletAddress = this.walletAddress,
584
+ excludeEmpty = false,
585
+ }: {
586
+ walletAddress?: string;
587
+ excludeEmpty?: boolean;
588
+ } = {}) {
589
+ return await getVeScas(this, walletAddress, excludeEmpty);
584
590
  }
585
591
 
586
592
  /**
@@ -70,7 +70,8 @@ export const getVeScas = async (
70
70
  }: {
71
71
  utils: ScallopUtils;
72
72
  },
73
- ownerAddress?: string
73
+ ownerAddress?: string,
74
+ excludeEmpty?: boolean
74
75
  ) => {
75
76
  const keyObjectDatas = await getVescaKeys(utils, ownerAddress);
76
77
 
@@ -83,9 +84,14 @@ export const getVeScas = async (
83
84
  });
84
85
  await Promise.allSettled(tasks);
85
86
 
86
- return veScas
87
+ const result = veScas
87
88
  .filter(Boolean)
88
89
  .sort((a, b) => b!.currentVeScaBalance - a!.currentVeScaBalance);
90
+
91
+ if (excludeEmpty) {
92
+ return result.filter((v) => v.lockedScaAmount !== '0');
93
+ }
94
+ return result;
89
95
  };
90
96
 
91
97
  const SuiObjectRefZod = zod.object({