@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.js CHANGED
@@ -4155,7 +4155,7 @@ var getVescaKeys = async (utils, ownerAddress) => {
4155
4155
  };
4156
4156
  var getVeScas = async ({
4157
4157
  utils
4158
- }, ownerAddress) => {
4158
+ }, ownerAddress, excludeEmpty) => {
4159
4159
  const keyObjectDatas = await getVescaKeys(utils, ownerAddress);
4160
4160
  const veScas = Array(keyObjectDatas.length).fill(null);
4161
4161
  const tasks = keyObjectDatas.map(async (veScaKey, idx) => {
@@ -4165,7 +4165,11 @@ var getVeScas = async ({
4165
4165
  }
4166
4166
  });
4167
4167
  await Promise.allSettled(tasks);
4168
- return veScas.filter(Boolean).sort((a, b) => b.currentVeScaBalance - a.currentVeScaBalance);
4168
+ const result = veScas.filter(Boolean).sort((a, b) => b.currentVeScaBalance - a.currentVeScaBalance);
4169
+ if (excludeEmpty) {
4170
+ return result.filter((v) => v.lockedScaAmount !== "0");
4171
+ }
4172
+ return result;
4169
4173
  };
4170
4174
  var SuiObjectRefZod = import_zod2.z.object({
4171
4175
  objectId: import_zod2.z.string(),
@@ -7045,8 +7049,11 @@ var ScallopQuery = class {
7045
7049
  * @param walletAddress
7046
7050
  * @returns array of veSca
7047
7051
  */
7048
- async getVeScas(walletAddress = this.walletAddress) {
7049
- return await getVeScas(this, walletAddress);
7052
+ async getVeScas({
7053
+ walletAddress = this.walletAddress,
7054
+ excludeEmpty = false
7055
+ } = {}) {
7056
+ return await getVeScas(this, walletAddress, excludeEmpty);
7050
7057
  }
7051
7058
  /**
7052
7059
  * Get total vesca treasury with movecall
@@ -7894,7 +7901,9 @@ var ScallopClient = class {
7894
7901
  }
7895
7902
  }
7896
7903
  async claimAllUnlockedSca(sign = true) {
7897
- const veScaKeys = (await this.query.getVeScas(this.walletAddress) ?? []).map(({ keyObject }) => keyObject);
7904
+ const veScaKeys = (await this.query.getVeScas({
7905
+ walletAddress: this.walletAddress
7906
+ }) ?? []).map(({ keyObject }) => keyObject);
7898
7907
  if (veScaKeys.length === 0) {
7899
7908
  throw new Error("No veSCA found in the wallet");
7900
7909
  }