@scallop-io/sui-scallop-sdk 1.3.4-alpha.1 → 1.3.4-alpha.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/index.js +550 -544
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +549 -544
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
- package/src/builders/loyaltyProgramBuilder.ts +1 -1
- package/src/constants/common.ts +0 -1
- package/src/constants/enum.ts +12 -11
- package/src/constants/index.ts +0 -1
- package/src/constants/queryKeys.ts +1 -5
- package/src/constants/rpc.ts +16 -0
- package/src/constants/testAddress.ts +35 -76
- package/src/constants/tokenBucket.ts +1 -1
- package/src/models/scallop.ts +3 -2
- package/src/models/scallopAddress.ts +2 -2
- package/src/models/scallopBuilder.ts +7 -5
- package/src/models/scallopCache.ts +1 -1
- package/src/models/scallopClient.ts +27 -26
- package/src/models/scallopQuery.ts +61 -19
- package/src/models/scallopUtils.ts +74 -109
- package/src/models/suiKit.ts +11 -0
- package/src/queries/borrowIncentiveQuery.ts +6 -13
- package/src/queries/coreQuery.ts +245 -236
- package/src/queries/isolatedAsset.ts +4 -4
- package/src/queries/loyaltyProgramQuery.ts +1 -1
- package/src/queries/portfolioQuery.ts +58 -34
- package/src/queries/referralQuery.ts +1 -0
- package/src/queries/spoolQuery.ts +17 -17
- package/src/types/query/core.ts +0 -1
- package/src/types/query/index.ts +4 -4
- package/src/utils/tokenBucket.ts +2 -1
- package/dist/builders/borrowIncentiveBuilder.d.ts +0 -12
- package/dist/builders/coreBuilder.d.ts +0 -12
- package/dist/builders/index.d.ts +0 -12
- package/dist/builders/loyaltyProgramBuilder.d.ts +0 -12
- package/dist/builders/oracle.d.ts +0 -14
- package/dist/builders/referralBuilder.d.ts +0 -12
- package/dist/builders/sCoinBuilder.d.ts +0 -4
- package/dist/builders/spoolBuilder.d.ts +0 -12
- package/dist/builders/vescaBuilder.d.ts +0 -25
- package/dist/constants/cache.d.ts +0 -14
- package/dist/constants/coinGecko.d.ts +0 -2
- package/dist/constants/common.d.ts +0 -20
- package/dist/constants/enum.d.ts +0 -13
- package/dist/constants/flashloan.d.ts +0 -2
- package/dist/constants/index.d.ts +0 -12
- package/dist/constants/poolAddress.d.ts +0 -5
- package/dist/constants/pyth.d.ts +0 -5
- package/dist/constants/queryKeys.d.ts +0 -59
- package/dist/constants/testAddress.d.ts +0 -2
- package/dist/constants/tokenBucket.d.ts +0 -2
- package/dist/constants/vesca.d.ts +0 -5
- package/dist/index.d.ts +0 -3
- package/dist/models/index.d.ts +0 -8
- package/dist/models/scallop.d.ts +0 -74
- package/dist/models/scallopAddress.d.ts +0 -150
- package/dist/models/scallopBuilder.d.ts +0 -89
- package/dist/models/scallopCache.d.ts +0 -74
- package/dist/models/scallopClient.d.ts +0 -321
- package/dist/models/scallopIndexer.d.ts +0 -89
- package/dist/models/scallopQuery.d.ts +0 -474
- package/dist/models/scallopUtils.d.ts +0 -222
- package/dist/queries/borrowIncentiveQuery.d.ts +0 -61
- package/dist/queries/coreQuery.d.ts +0 -167
- package/dist/queries/index.d.ts +0 -8
- package/dist/queries/isolatedAsset.d.ts +0 -14
- package/dist/queries/loyaltyProgramQuery.d.ts +0 -10
- package/dist/queries/portfolioQuery.d.ts +0 -73
- package/dist/queries/priceQuery.d.ts +0 -16
- package/dist/queries/referralQuery.d.ts +0 -7
- package/dist/queries/sCoinQuery.d.ts +0 -41
- package/dist/queries/spoolQuery.d.ts +0 -70
- package/dist/queries/supplyLimit.d.ts +0 -9
- package/dist/queries/vescaQuery.d.ts +0 -36
- package/dist/types/address.d.ts +0 -107
- package/dist/types/builder/borrowIncentive.d.ts +0 -35
- package/dist/types/builder/core.d.ts +0 -56
- package/dist/types/builder/index.d.ts +0 -24
- package/dist/types/builder/loyaltyProgram.d.ts +0 -23
- package/dist/types/builder/referral.d.ts +0 -30
- package/dist/types/builder/sCoin.d.ts +0 -37
- package/dist/types/builder/spool.d.ts +0 -29
- package/dist/types/builder/vesca.d.ts +0 -51
- package/dist/types/constant/common.d.ts +0 -24
- package/dist/types/constant/enum.d.ts +0 -48
- package/dist/types/constant/index.d.ts +0 -2
- package/dist/types/index.d.ts +0 -6
- package/dist/types/model.d.ts +0 -54
- package/dist/types/query/borrowIncentive.d.ts +0 -124
- package/dist/types/query/core.d.ts +0 -362
- package/dist/types/query/index.d.ts +0 -7
- package/dist/types/query/loyaltyProgram.d.ts +0 -5
- package/dist/types/query/portfolio.d.ts +0 -115
- package/dist/types/query/sCoin.d.ts +0 -1
- package/dist/types/query/spool.d.ts +0 -122
- package/dist/types/query/vesca.d.ts +0 -26
- package/dist/types/utils.d.ts +0 -21
- package/dist/utils/builder.d.ts +0 -15
- package/dist/utils/index.d.ts +0 -5
- package/dist/utils/indexer.d.ts +0 -17
- package/dist/utils/query.d.ts +0 -62
- package/dist/utils/tokenBucket.d.ts +0 -11
- package/dist/utils/util.d.ts +0 -26
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
import { normalizeStructTag } from '@mysten/sui/utils';
|
|
2
|
-
import {
|
|
3
|
-
SUPPORT_BORROW_INCENTIVE_POOLS,
|
|
4
|
-
SUPPORT_BORROW_INCENTIVE_REWARDS,
|
|
5
|
-
} from '../constants';
|
|
2
|
+
import { SUPPORT_BORROW_INCENTIVE_POOLS } from '../constants';
|
|
6
3
|
import {
|
|
7
4
|
parseOriginBorrowIncentivePoolData,
|
|
8
5
|
parseOriginBorrowIncentiveAccountData,
|
|
@@ -19,6 +16,7 @@ import type {
|
|
|
19
16
|
BorrowIncentivePoolPoints,
|
|
20
17
|
OptionalKeys,
|
|
21
18
|
BorrowIncentivePool,
|
|
19
|
+
CoinPrices,
|
|
22
20
|
} from '../types';
|
|
23
21
|
import BigNumber from 'bignumber.js';
|
|
24
22
|
|
|
@@ -56,17 +54,12 @@ export const getBorrowIncentivePools = async (
|
|
|
56
54
|
borrowIncentiveCoinNames: SupportBorrowIncentiveCoins[] = [
|
|
57
55
|
...SUPPORT_BORROW_INCENTIVE_POOLS,
|
|
58
56
|
],
|
|
59
|
-
indexer: boolean = false
|
|
57
|
+
indexer: boolean = false,
|
|
58
|
+
coinPrices?: CoinPrices
|
|
60
59
|
) => {
|
|
61
60
|
const borrowIncentivePools: BorrowIncentivePools = {};
|
|
62
61
|
|
|
63
|
-
|
|
64
|
-
(await query.utils.getCoinPrices([
|
|
65
|
-
...new Set([
|
|
66
|
-
...borrowIncentiveCoinNames,
|
|
67
|
-
...SUPPORT_BORROW_INCENTIVE_REWARDS,
|
|
68
|
-
]),
|
|
69
|
-
])) ?? {};
|
|
62
|
+
coinPrices = coinPrices ?? (await query.utils.getCoinPrices()) ?? {};
|
|
70
63
|
|
|
71
64
|
if (indexer) {
|
|
72
65
|
const borrowIncentivePoolsIndexer =
|
|
@@ -74,7 +67,7 @@ export const getBorrowIncentivePools = async (
|
|
|
74
67
|
|
|
75
68
|
const updateBorrowIncentivePool = (pool: BorrowIncentivePool) => {
|
|
76
69
|
if (!borrowIncentiveCoinNames.includes(pool.coinName)) return;
|
|
77
|
-
pool.coinPrice = coinPrices[pool.coinName]
|
|
70
|
+
pool.coinPrice = coinPrices[pool.coinName] ?? pool.coinPrice;
|
|
78
71
|
borrowIncentivePools[pool.coinName] = pool;
|
|
79
72
|
};
|
|
80
73
|
|