@scallop-io/sui-scallop-sdk 0.46.65 → 0.46.67
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/common.d.ts +1 -0
- package/dist/index.js +19 -14
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +18 -14
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/builders/coreBuilder.ts +1 -1
- package/src/constants/common.ts +2 -0
- package/src/queries/borrowIncentiveQuery.ts +3 -4
- package/src/queries/coreQuery.ts +6 -2
- package/src/queries/spoolQuery.ts +4 -3
package/dist/index.mjs
CHANGED
|
@@ -8,6 +8,7 @@ var PROTOCOL_OBJECT_ID = IS_VE_SCA_TEST ? "0xc9f859f98ca352a11b97a038c4b4162bee4
|
|
|
8
8
|
var BORROW_FEE_PROTOCOL_ID = IS_VE_SCA_TEST ? "0xc9f859f98ca352a11b97a038c4b4162bee437b8df8caa047990fe9cb03d4f778" : "0xc38f849e81cfe46d4e4320f508ea7dda42934a329d5a6571bb4c3cb6ea63f5da";
|
|
9
9
|
var SCA_COIN_TYPE = IS_VE_SCA_TEST ? `0x6cd813061a3adf3602b76545f076205f0c8e7ec1d3b1eab9a1da7992c18c0524::sca::SCA` : "0x7016aae72cfc67f2fadf55769c0a7dd54291a583b63051a5ed71081cce836ac6::sca::SCA";
|
|
10
10
|
var OLD_BORROW_INCENTIVE_PROTOCOL_ID = "0xc63072e7f5f4983a2efaf5bdba1480d5e7d74d57948e1c7cc436f8e22cbeb410";
|
|
11
|
+
var NATIVE_USDC = "0xdba34672e30cb065b1f93e3ab55318768fd6fef66c15942c9f7cb846e2f900e7::usdc::USDC";
|
|
11
12
|
var SUPPORT_POOLS = [
|
|
12
13
|
"eth",
|
|
13
14
|
"btc",
|
|
@@ -2260,6 +2261,8 @@ var queryMarket = async (query, indexer = false) => {
|
|
|
2260
2261
|
const marketData = queryResult?.events[0].parsedJson;
|
|
2261
2262
|
for (const pool of marketData?.pools ?? []) {
|
|
2262
2263
|
const coinType = normalizeStructTag3(pool.type.name);
|
|
2264
|
+
if (coinType === NATIVE_USDC)
|
|
2265
|
+
continue;
|
|
2263
2266
|
const poolCoinName = query.utils.parseCoinNameFromType(coinType);
|
|
2264
2267
|
const coinPrice = coinPrices[poolCoinName] ?? 0;
|
|
2265
2268
|
if (!SUPPORT_POOLS.includes(poolCoinName)) {
|
|
@@ -2318,6 +2321,8 @@ var queryMarket = async (query, indexer = false) => {
|
|
|
2318
2321
|
}
|
|
2319
2322
|
for (const collateral of marketData?.collaterals ?? []) {
|
|
2320
2323
|
const coinType = normalizeStructTag3(collateral.type.name);
|
|
2324
|
+
if (coinType === NATIVE_USDC)
|
|
2325
|
+
continue;
|
|
2321
2326
|
const collateralCoinName = query.utils.parseCoinNameFromType(coinType);
|
|
2322
2327
|
const coinPrice = coinPrices[collateralCoinName] ?? 0;
|
|
2323
2328
|
if (!SUPPORT_COLLATERALS.includes(collateralCoinName)) {
|
|
@@ -2364,7 +2369,7 @@ var getMarketPools = async (query, poolCoinNames = [...SUPPORT_POOLS], indexer =
|
|
|
2364
2369
|
const marketObjectResponse = await query.cache.queryGetObject(marketId, {
|
|
2365
2370
|
showContent: true
|
|
2366
2371
|
});
|
|
2367
|
-
const coinPrices = await query.utils.getCoinPrices(poolCoinNames ??
|
|
2372
|
+
const coinPrices = await query.utils.getCoinPrices(poolCoinNames) ?? {};
|
|
2368
2373
|
const marketPools = {};
|
|
2369
2374
|
if (indexer) {
|
|
2370
2375
|
const marketPoolsIndexer = await query.indexer.getMarketPools();
|
|
@@ -2546,7 +2551,7 @@ var getMarketPool = async (query, poolCoinName, indexer = false, marketObject, c
|
|
|
2546
2551
|
};
|
|
2547
2552
|
var getMarketCollaterals = async (query, collateralCoinNames = [...SUPPORT_COLLATERALS], indexer = false) => {
|
|
2548
2553
|
const marketId = query.address.get("core.market");
|
|
2549
|
-
const coinPrices = await query.utils.getCoinPrices(collateralCoinNames ??
|
|
2554
|
+
const coinPrices = await query.utils.getCoinPrices(collateralCoinNames) ?? {};
|
|
2550
2555
|
const marketCollaterals = {};
|
|
2551
2556
|
if (indexer) {
|
|
2552
2557
|
const marketCollateralsIndexer = await query.indexer.getMarketCollaterals();
|
|
@@ -2855,9 +2860,9 @@ var getSpools = async (query, stakeMarketCoinNames = [...SUPPORT_SPOOLS], indexe
|
|
|
2855
2860
|
const rewardCoinName = query.utils.getSpoolRewardCoinName(stakeMarketCoinName);
|
|
2856
2861
|
return rewardCoinName;
|
|
2857
2862
|
});
|
|
2858
|
-
const coinPrices = await query.utils.getCoinPrices(
|
|
2859
|
-
|
|
2860
|
-
);
|
|
2863
|
+
const coinPrices = await query.utils.getCoinPrices([
|
|
2864
|
+
.../* @__PURE__ */ new Set([...stakeCoinNames, ...rewardCoinNames])
|
|
2865
|
+
]) ?? {};
|
|
2861
2866
|
const marketPools = await query.getMarketPools(stakeCoinNames, indexer);
|
|
2862
2867
|
const spools = {};
|
|
2863
2868
|
if (indexer) {
|
|
@@ -3236,14 +3241,12 @@ var queryBorrowIncentivePools = async (query, borrowIncentiveCoinNames = [
|
|
|
3236
3241
|
...SUPPORT_BORROW_INCENTIVE_POOLS
|
|
3237
3242
|
], indexer = false) => {
|
|
3238
3243
|
const borrowIncentivePools = {};
|
|
3239
|
-
const coinPrices = await query.utils.getCoinPrices(
|
|
3240
|
-
[
|
|
3241
|
-
|
|
3242
|
-
|
|
3243
|
-
|
|
3244
|
-
|
|
3245
|
-
]
|
|
3246
|
-
);
|
|
3244
|
+
const coinPrices = await query.utils.getCoinPrices([
|
|
3245
|
+
.../* @__PURE__ */ new Set([
|
|
3246
|
+
...borrowIncentiveCoinNames,
|
|
3247
|
+
...SUPPORT_BORROW_INCENTIVE_REWARDS
|
|
3248
|
+
])
|
|
3249
|
+
]) ?? {};
|
|
3247
3250
|
if (indexer) {
|
|
3248
3251
|
const borrowIncentivePoolsIndexer = await query.indexer.getBorrowIncentivePools();
|
|
3249
3252
|
const updateBorrowIncentivePool = (pool) => {
|
|
@@ -5137,7 +5140,7 @@ var generateCoreQuickMethod = ({
|
|
|
5137
5140
|
const obligationCoinNames = await builder.utils.getObligationCoinNames(
|
|
5138
5141
|
obligationInfo.obligationId
|
|
5139
5142
|
) ?? [];
|
|
5140
|
-
const updateCoinNames = [...obligationCoinNames
|
|
5143
|
+
const updateCoinNames = [...obligationCoinNames, poolCoinName];
|
|
5141
5144
|
await updateOracles(builder, txBlock, updateCoinNames);
|
|
5142
5145
|
return txBlock.borrow(
|
|
5143
5146
|
obligationInfo.obligationId,
|
|
@@ -7976,6 +7979,7 @@ export {
|
|
|
7976
7979
|
MAX_LOCK_ROUNDS,
|
|
7977
7980
|
MIN_INITIAL_LOCK_AMOUNT,
|
|
7978
7981
|
MIN_TOP_UP_AMOUNT,
|
|
7982
|
+
NATIVE_USDC,
|
|
7979
7983
|
OLD_BORROW_INCENTIVE_PROTOCOL_ID,
|
|
7980
7984
|
PROTOCOL_OBJECT_ID,
|
|
7981
7985
|
SCA_COIN_TYPE,
|