@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 +14 -5
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +14 -5
- package/dist/index.mjs.map +1 -1
- package/dist/models/scallopQuery.d.ts +4 -1
- package/dist/queries/vescaQuery.d.ts +1 -1
- package/package.json +1 -1
- package/src/models/scallopClient.ts +3 -1
- package/src/models/scallopQuery.ts +8 -2
- package/src/queries/vescaQuery.ts +8 -2
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
|
-
|
|
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(
|
|
7049
|
-
|
|
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(
|
|
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
|
}
|