@scallop-io/sui-scallop-sdk 1.3.3-alpha.2 → 1.3.3
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/constants/index.d.ts +0 -1
- package/dist/constants/queryKeys.d.ts +1 -2
- package/dist/index.js +1011 -1022
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1011 -1021
- package/dist/index.mjs.map +1 -1
- package/dist/models/scallopIndexer.d.ts +6 -0
- package/dist/models/scallopPrice.d.ts +0 -0
- package/dist/models/scallopQuery.d.ts +6 -0
- package/dist/queries/vescaQuery.d.ts +2 -2
- package/dist/types/query/core.d.ts +0 -1
- package/dist/types/query/portfolio.d.ts +1 -1
- package/dist/types/query/spool.d.ts +1 -0
- package/dist/types/query/vesca.d.ts +1 -1
- package/package.json +1 -1
- package/src/builders/borrowIncentiveBuilder.ts +3 -2
- package/src/constants/enum.ts +4 -11
- package/src/constants/index.ts +0 -1
- package/src/constants/queryKeys.ts +2 -2
- package/src/constants/testAddress.ts +35 -76
- package/src/models/scallopBuilder.ts +3 -2
- package/src/models/scallopClient.ts +3 -3
- package/src/models/scallopIndexer.ts +9 -0
- package/src/models/scallopPrice.ts +0 -0
- package/src/models/scallopQuery.ts +12 -4
- package/src/models/scallopUtils.ts +28 -39
- package/src/queries/coreQuery.ts +225 -230
- package/src/queries/isolatedAsset.ts +4 -4
- package/src/queries/portfolioQuery.ts +10 -6
- package/src/queries/referralQuery.ts +1 -0
- package/src/queries/spoolQuery.ts +2 -1
- package/src/queries/vescaQuery.ts +4 -6
- package/src/types/query/core.ts +0 -1
- package/src/types/query/portfolio.ts +1 -0
- package/src/types/query/spool.ts +1 -0
- package/src/types/query/vesca.ts +1 -1
|
@@ -114,7 +114,7 @@ export const getSpool = async (
|
|
|
114
114
|
const coinName = query.utils.parseCoinName<SupportStakeCoins>(marketCoinName);
|
|
115
115
|
marketPool = marketPool || (await query.getMarketPool(coinName, indexer));
|
|
116
116
|
if (!marketPool) {
|
|
117
|
-
throw new Error(
|
|
117
|
+
throw new Error('Fail to fetch marketPool');
|
|
118
118
|
}
|
|
119
119
|
|
|
120
120
|
const poolId = query.address.get(`spool.pools.${marketCoinName}.id`);
|
|
@@ -210,6 +210,7 @@ export const getSpool = async (
|
|
|
210
210
|
rewardCoinType: isMarketCoin(rewardCoinName)
|
|
211
211
|
? query.utils.parseMarketCoinType(rewardCoinName)
|
|
212
212
|
: query.utils.parseCoinType(rewardCoinName),
|
|
213
|
+
sCoinType: marketPool.sCoinType,
|
|
213
214
|
coinDecimal: query.utils.getCoinDecimal(coinName),
|
|
214
215
|
rewardCoinDecimal: query.utils.getCoinDecimal(rewardCoinName),
|
|
215
216
|
coinPrice: coinPrices?.[coinName] ?? 0,
|
|
@@ -72,7 +72,7 @@ export const getVeScas = async (
|
|
|
72
72
|
}: {
|
|
73
73
|
utils: ScallopUtils;
|
|
74
74
|
},
|
|
75
|
-
ownerAddress
|
|
75
|
+
ownerAddress: string,
|
|
76
76
|
excludeEmpty?: boolean
|
|
77
77
|
) => {
|
|
78
78
|
const keyObjectDatas = await getVescaKeys(utils, ownerAddress);
|
|
@@ -88,7 +88,7 @@ export const getVeScas = async (
|
|
|
88
88
|
|
|
89
89
|
const result = veScas
|
|
90
90
|
.filter(Boolean)
|
|
91
|
-
.sort((a, b) => b
|
|
91
|
+
.sort((a, b) => b.currentVeScaBalance - a.currentVeScaBalance);
|
|
92
92
|
|
|
93
93
|
if (excludeEmpty) {
|
|
94
94
|
return result.filter((v) => v.lockedScaAmount !== '0');
|
|
@@ -113,11 +113,9 @@ type SuiObjectRefType = zod.infer<typeof SuiObjectRefZod>;
|
|
|
113
113
|
*/
|
|
114
114
|
export const getVeSca = async (
|
|
115
115
|
utils: ScallopUtils,
|
|
116
|
-
veScaKey
|
|
117
|
-
ownerAddress?: string
|
|
116
|
+
veScaKey: string | SuiObjectData
|
|
118
117
|
) => {
|
|
119
118
|
const tableId = utils.address.get(`vesca.tableId`);
|
|
120
|
-
veScaKey = veScaKey || (await getVescaKeys(utils, ownerAddress))[0];
|
|
121
119
|
|
|
122
120
|
if (!veScaKey) return undefined;
|
|
123
121
|
if (typeof veScaKey === 'object') {
|
|
@@ -168,7 +166,7 @@ export const getVeSca = async (
|
|
|
168
166
|
lockedScaCoin,
|
|
169
167
|
currentVeScaBalance,
|
|
170
168
|
unlockAt: BigNumber(dynamicFields.unlock_at * 1000).toNumber(),
|
|
171
|
-
}
|
|
169
|
+
};
|
|
172
170
|
}
|
|
173
171
|
|
|
174
172
|
return vesca;
|
package/src/types/query/core.ts
CHANGED
package/src/types/query/spool.ts
CHANGED