@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.
package/dist/index.mjs CHANGED
@@ -4081,7 +4081,7 @@ var getVescaKeys = async (utils, ownerAddress) => {
4081
4081
  };
4082
4082
  var getVeScas = async ({
4083
4083
  utils
4084
- }, ownerAddress) => {
4084
+ }, ownerAddress, excludeEmpty) => {
4085
4085
  const keyObjectDatas = await getVescaKeys(utils, ownerAddress);
4086
4086
  const veScas = Array(keyObjectDatas.length).fill(null);
4087
4087
  const tasks = keyObjectDatas.map(async (veScaKey, idx) => {
@@ -4091,7 +4091,11 @@ var getVeScas = async ({
4091
4091
  }
4092
4092
  });
4093
4093
  await Promise.allSettled(tasks);
4094
- return veScas.filter(Boolean).sort((a, b) => b.currentVeScaBalance - a.currentVeScaBalance);
4094
+ const result = veScas.filter(Boolean).sort((a, b) => b.currentVeScaBalance - a.currentVeScaBalance);
4095
+ if (excludeEmpty) {
4096
+ return result.filter((v) => v.lockedScaAmount !== "0");
4097
+ }
4098
+ return result;
4095
4099
  };
4096
4100
  var SuiObjectRefZod = zod2.object({
4097
4101
  objectId: zod2.string(),
@@ -6985,8 +6989,11 @@ var ScallopQuery = class {
6985
6989
  * @param walletAddress
6986
6990
  * @returns array of veSca
6987
6991
  */
6988
- async getVeScas(walletAddress = this.walletAddress) {
6989
- return await getVeScas(this, walletAddress);
6992
+ async getVeScas({
6993
+ walletAddress = this.walletAddress,
6994
+ excludeEmpty = false
6995
+ } = {}) {
6996
+ return await getVeScas(this, walletAddress, excludeEmpty);
6990
6997
  }
6991
6998
  /**
6992
6999
  * Get total vesca treasury with movecall
@@ -7834,7 +7841,9 @@ var ScallopClient = class {
7834
7841
  }
7835
7842
  }
7836
7843
  async claimAllUnlockedSca(sign = true) {
7837
- const veScaKeys = (await this.query.getVeScas(this.walletAddress) ?? []).map(({ keyObject }) => keyObject);
7844
+ const veScaKeys = (await this.query.getVeScas({
7845
+ walletAddress: this.walletAddress
7846
+ }) ?? []).map(({ keyObject }) => keyObject);
7838
7847
  if (veScaKeys.length === 0) {
7839
7848
  throw new Error("No veSCA found in the wallet");
7840
7849
  }