@scallop-io/sui-scallop-sdk 1.3.4-alpha.6 → 1.3.4-isolated-asset.2
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/builders/borrowIncentiveBuilder.d.ts +12 -0
- package/dist/builders/coreBuilder.d.ts +12 -0
- package/dist/builders/index.d.ts +12 -0
- package/dist/builders/loyaltyProgramBuilder.d.ts +12 -0
- package/dist/builders/oracle.d.ts +14 -0
- package/dist/builders/referralBuilder.d.ts +12 -0
- package/dist/builders/sCoinBuilder.d.ts +4 -0
- package/dist/builders/spoolBuilder.d.ts +12 -0
- package/dist/builders/vescaBuilder.d.ts +25 -0
- package/dist/constants/cache.d.ts +14 -0
- package/dist/constants/coinGecko.d.ts +2 -0
- package/dist/constants/common.d.ts +20 -0
- package/dist/constants/enum.d.ts +14 -0
- package/dist/constants/flashloan.d.ts +2 -0
- package/dist/constants/index.d.ts +13 -0
- package/dist/constants/poolAddress.d.ts +5 -0
- package/dist/constants/pyth.d.ts +5 -0
- package/dist/constants/queryKeys.d.ts +56 -0
- package/dist/constants/rpc.d.ts +1 -0
- package/dist/constants/testAddress.d.ts +2 -0
- package/dist/constants/tokenBucket.d.ts +2 -0
- package/dist/constants/vesca.d.ts +5 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +438 -331
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +438 -331
- package/dist/index.mjs.map +1 -1
- package/dist/models/index.d.ts +8 -0
- package/dist/models/scallop.d.ts +74 -0
- package/dist/models/scallopAddress.d.ts +150 -0
- package/dist/models/scallopBuilder.d.ts +89 -0
- package/dist/models/scallopCache.d.ts +74 -0
- package/dist/models/scallopClient.d.ts +321 -0
- package/dist/models/scallopIndexer.d.ts +89 -0
- package/dist/models/scallopQuery.d.ts +497 -0
- package/dist/models/scallopUtils.d.ts +227 -0
- package/dist/models/suiKit.d.ts +2 -0
- package/dist/queries/borrowIncentiveQuery.d.ts +61 -0
- package/dist/queries/borrowLimitQuery.d.ts +9 -0
- package/dist/queries/coreQuery.d.ts +169 -0
- package/dist/queries/index.d.ts +12 -0
- package/dist/queries/isolatedAssetQuery.d.ts +14 -0
- package/dist/queries/loyaltyProgramQuery.d.ts +10 -0
- package/dist/queries/portfolioQuery.d.ts +75 -0
- package/dist/queries/priceQuery.d.ts +16 -0
- package/dist/queries/referralQuery.d.ts +7 -0
- package/dist/queries/sCoinQuery.d.ts +41 -0
- package/dist/queries/spoolQuery.d.ts +70 -0
- package/dist/queries/supplyLimitQuery.d.ts +9 -0
- package/dist/queries/vescaQuery.d.ts +36 -0
- package/dist/types/address.d.ts +107 -0
- package/dist/types/builder/borrowIncentive.d.ts +35 -0
- package/dist/types/builder/core.d.ts +56 -0
- package/dist/types/builder/index.d.ts +24 -0
- package/dist/types/builder/loyaltyProgram.d.ts +23 -0
- package/dist/types/builder/referral.d.ts +30 -0
- package/dist/types/builder/sCoin.d.ts +37 -0
- package/dist/types/builder/spool.d.ts +29 -0
- package/dist/types/builder/vesca.d.ts +51 -0
- package/dist/types/constant/common.d.ts +24 -0
- package/dist/types/constant/enum.d.ts +48 -0
- package/dist/types/constant/index.d.ts +2 -0
- package/dist/types/index.d.ts +6 -0
- package/dist/types/model.d.ts +54 -0
- package/dist/types/query/borrowIncentive.d.ts +124 -0
- package/dist/types/query/core.d.ts +363 -0
- package/dist/types/query/index.d.ts +7 -0
- package/dist/types/query/loyaltyProgram.d.ts +5 -0
- package/dist/types/query/portfolio.d.ts +115 -0
- package/dist/types/query/sCoin.d.ts +1 -0
- package/dist/types/query/spool.d.ts +122 -0
- package/dist/types/query/vesca.d.ts +26 -0
- package/dist/types/utils.d.ts +21 -0
- package/dist/utils/builder.d.ts +15 -0
- package/dist/utils/index.d.ts +5 -0
- package/dist/utils/indexer.d.ts +17 -0
- package/dist/utils/query.d.ts +62 -0
- package/dist/utils/tokenBucket.d.ts +11 -0
- package/dist/utils/util.d.ts +26 -0
- package/package.json +2 -2
- package/src/constants/coinGecko.ts +4 -2
- package/src/constants/common.ts +2 -0
- package/src/constants/enum.ts +25 -4
- package/src/constants/index.ts +1 -0
- package/src/constants/poolAddress.ts +7 -1
- package/src/constants/pyth.ts +2 -0
- package/src/constants/testAddress.ts +76 -35
- package/src/models/scallopBuilder.ts +2 -3
- package/src/models/scallopQuery.ts +26 -18
- package/src/models/scallopUtils.ts +5 -6
- package/src/queries/borrowLimitQuery.ts +53 -0
- package/src/queries/coreQuery.ts +238 -229
- package/src/queries/index.ts +1 -0
- package/src/queries/isolatedAssetQuery.ts +5 -5
- package/src/queries/referralQuery.ts +0 -1
- package/src/queries/spoolQuery.ts +1 -1
- package/src/queries/supplyLimitQuery.ts +23 -18
- package/src/types/query/core.ts +2 -0
- package/src/types/utils.ts +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ScallopUtils } from '
|
|
2
|
-
import { SupportPoolCoins } from '
|
|
1
|
+
import { ScallopUtils } from 'src/models';
|
|
2
|
+
import { SupportPoolCoins } from 'src/types';
|
|
3
3
|
import { z as zod } from 'zod';
|
|
4
4
|
|
|
5
5
|
const supplyLimitZod = zod.object({
|
|
@@ -17,9 +17,9 @@ const supplyLimitZod = zod.object({
|
|
|
17
17
|
}),
|
|
18
18
|
});
|
|
19
19
|
|
|
20
|
-
const
|
|
21
|
-
|
|
22
|
-
|
|
20
|
+
// const supplyLimitKeyType = `0x6e641f0dca8aedab3101d047e96439178f16301bf0b57fe8745086ff1195eb3e::market_dynamic_keys::SupplyLimitKey`;
|
|
21
|
+
// TODO: use prod value
|
|
22
|
+
const supplyLimitKeyType = `0x6c23585e940a989588432509107e98bae06dbca4e333f26d0635d401b3c7c76d::market_dynamic_keys::SupplyLimitKey`;
|
|
23
23
|
/**
|
|
24
24
|
* Return supply limit of a pool (including the decimals)
|
|
25
25
|
* @param utils
|
|
@@ -30,19 +30,24 @@ export const getSupplyLimit = async (
|
|
|
30
30
|
utils: ScallopUtils,
|
|
31
31
|
poolName: SupportPoolCoins
|
|
32
32
|
) => {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
33
|
+
try {
|
|
34
|
+
const poolCoinType = utils.parseCoinType(poolName).slice(2);
|
|
35
|
+
const marketObject = utils.address.get('core.market');
|
|
36
|
+
if (!marketObject) return null;
|
|
36
37
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
38
|
+
const object = await utils.cache.queryGetDynamicFieldObject({
|
|
39
|
+
parentId: marketObject,
|
|
40
|
+
name: {
|
|
41
|
+
type: supplyLimitKeyType,
|
|
42
|
+
value: poolCoinType,
|
|
43
|
+
},
|
|
44
|
+
});
|
|
44
45
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
46
|
+
const parsedData = supplyLimitZod.safeParse(object?.data?.content);
|
|
47
|
+
if (!parsedData.success) return null;
|
|
48
|
+
return parsedData.data.fields.value;
|
|
49
|
+
} catch (e: any) {
|
|
50
|
+
console.error(`Error in getSupplyLimit for ${poolName}: ${e.message}`);
|
|
51
|
+
return '0';
|
|
52
|
+
}
|
|
48
53
|
};
|
package/src/types/query/core.ts
CHANGED
|
@@ -130,6 +130,7 @@ export type MarketPool = {
|
|
|
130
130
|
coinDecimal: number;
|
|
131
131
|
coinPrice: number;
|
|
132
132
|
maxSupplyCoin: number;
|
|
133
|
+
maxBorrowCoin: number;
|
|
133
134
|
isIsolated: boolean;
|
|
134
135
|
} & Required<
|
|
135
136
|
Pick<
|
|
@@ -153,6 +154,7 @@ export type MarketCollateral = {
|
|
|
153
154
|
coinWrappedType: CoinWrappedType;
|
|
154
155
|
coinDecimal: number;
|
|
155
156
|
coinPrice: number;
|
|
157
|
+
isIsolated: boolean;
|
|
156
158
|
} & Required<
|
|
157
159
|
Pick<
|
|
158
160
|
ParsedMarketCollateralData,
|
package/src/types/utils.ts
CHANGED
|
@@ -20,7 +20,7 @@ export type PoolAddressInfo = {
|
|
|
20
20
|
decimal: number;
|
|
21
21
|
pythFeedId: string;
|
|
22
22
|
lendingPoolAddress: string;
|
|
23
|
-
collateralPoolAddress
|
|
23
|
+
collateralPoolAddress?: string;
|
|
24
24
|
sCoinAddress: string | undefined;
|
|
25
25
|
marketCoinAddress: string;
|
|
26
26
|
coinAddress: string;
|