@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
|
@@ -7,6 +7,7 @@ export declare const PROTOCOL_OBJECT_ID: "0xc9f859f98ca352a11b97a038c4b4162bee43
|
|
|
7
7
|
export declare const BORROW_FEE_PROTOCOL_ID: "0xc9f859f98ca352a11b97a038c4b4162bee437b8df8caa047990fe9cb03d4f778" | "0xc38f849e81cfe46d4e4320f508ea7dda42934a329d5a6571bb4c3cb6ea63f5da";
|
|
8
8
|
export declare const SCA_COIN_TYPE: "0x6cd813061a3adf3602b76545f076205f0c8e7ec1d3b1eab9a1da7992c18c0524::sca::SCA" | "0x7016aae72cfc67f2fadf55769c0a7dd54291a583b63051a5ed71081cce836ac6::sca::SCA";
|
|
9
9
|
export declare const OLD_BORROW_INCENTIVE_PROTOCOL_ID: "0xc63072e7f5f4983a2efaf5bdba1480d5e7d74d57948e1c7cc436f8e22cbeb410";
|
|
10
|
+
export declare const NATIVE_USDC: "0xdba34672e30cb065b1f93e3ab55318768fd6fef66c15942c9f7cb846e2f900e7::usdc::USDC";
|
|
10
11
|
export declare const SUPPORT_POOLS: readonly ["eth", "btc", "usdc", "usdt", "sui", "apt", "sol", "cetus", "afsui", "hasui", "vsui", "sca"];
|
|
11
12
|
export declare const SUPPORT_COLLATERALS: readonly ["eth", "btc", "usdc", "usdt", "sui", "apt", "sol", "cetus", "afsui", "hasui", "vsui", "sca"];
|
|
12
13
|
export declare const SUPPORT_SPOOLS: readonly ["seth", "ssui", "susdc", "susdt", "scetus", "safsui", "shasui", "svsui"];
|
package/dist/index.js
CHANGED
|
@@ -39,6 +39,7 @@ __export(src_exports, {
|
|
|
39
39
|
MAX_LOCK_ROUNDS: () => MAX_LOCK_ROUNDS,
|
|
40
40
|
MIN_INITIAL_LOCK_AMOUNT: () => MIN_INITIAL_LOCK_AMOUNT,
|
|
41
41
|
MIN_TOP_UP_AMOUNT: () => MIN_TOP_UP_AMOUNT,
|
|
42
|
+
NATIVE_USDC: () => NATIVE_USDC,
|
|
42
43
|
OLD_BORROW_INCENTIVE_PROTOCOL_ID: () => OLD_BORROW_INCENTIVE_PROTOCOL_ID,
|
|
43
44
|
PROTOCOL_OBJECT_ID: () => PROTOCOL_OBJECT_ID,
|
|
44
45
|
SCA_COIN_TYPE: () => SCA_COIN_TYPE,
|
|
@@ -86,6 +87,7 @@ var PROTOCOL_OBJECT_ID = IS_VE_SCA_TEST ? "0xc9f859f98ca352a11b97a038c4b4162bee4
|
|
|
86
87
|
var BORROW_FEE_PROTOCOL_ID = IS_VE_SCA_TEST ? "0xc9f859f98ca352a11b97a038c4b4162bee437b8df8caa047990fe9cb03d4f778" : "0xc38f849e81cfe46d4e4320f508ea7dda42934a329d5a6571bb4c3cb6ea63f5da";
|
|
87
88
|
var SCA_COIN_TYPE = IS_VE_SCA_TEST ? `0x6cd813061a3adf3602b76545f076205f0c8e7ec1d3b1eab9a1da7992c18c0524::sca::SCA` : "0x7016aae72cfc67f2fadf55769c0a7dd54291a583b63051a5ed71081cce836ac6::sca::SCA";
|
|
88
89
|
var OLD_BORROW_INCENTIVE_PROTOCOL_ID = "0xc63072e7f5f4983a2efaf5bdba1480d5e7d74d57948e1c7cc436f8e22cbeb410";
|
|
90
|
+
var NATIVE_USDC = "0xdba34672e30cb065b1f93e3ab55318768fd6fef66c15942c9f7cb846e2f900e7::usdc::USDC";
|
|
89
91
|
var SUPPORT_POOLS = [
|
|
90
92
|
"eth",
|
|
91
93
|
"btc",
|
|
@@ -2334,6 +2336,8 @@ var queryMarket = async (query, indexer = false) => {
|
|
|
2334
2336
|
const marketData = queryResult?.events[0].parsedJson;
|
|
2335
2337
|
for (const pool of marketData?.pools ?? []) {
|
|
2336
2338
|
const coinType = (0, import_utils3.normalizeStructTag)(pool.type.name);
|
|
2339
|
+
if (coinType === NATIVE_USDC)
|
|
2340
|
+
continue;
|
|
2337
2341
|
const poolCoinName = query.utils.parseCoinNameFromType(coinType);
|
|
2338
2342
|
const coinPrice = coinPrices[poolCoinName] ?? 0;
|
|
2339
2343
|
if (!SUPPORT_POOLS.includes(poolCoinName)) {
|
|
@@ -2392,6 +2396,8 @@ var queryMarket = async (query, indexer = false) => {
|
|
|
2392
2396
|
}
|
|
2393
2397
|
for (const collateral of marketData?.collaterals ?? []) {
|
|
2394
2398
|
const coinType = (0, import_utils3.normalizeStructTag)(collateral.type.name);
|
|
2399
|
+
if (coinType === NATIVE_USDC)
|
|
2400
|
+
continue;
|
|
2395
2401
|
const collateralCoinName = query.utils.parseCoinNameFromType(coinType);
|
|
2396
2402
|
const coinPrice = coinPrices[collateralCoinName] ?? 0;
|
|
2397
2403
|
if (!SUPPORT_COLLATERALS.includes(collateralCoinName)) {
|
|
@@ -2438,7 +2444,7 @@ var getMarketPools = async (query, poolCoinNames = [...SUPPORT_POOLS], indexer =
|
|
|
2438
2444
|
const marketObjectResponse = await query.cache.queryGetObject(marketId, {
|
|
2439
2445
|
showContent: true
|
|
2440
2446
|
});
|
|
2441
|
-
const coinPrices = await query.utils.getCoinPrices(poolCoinNames ??
|
|
2447
|
+
const coinPrices = await query.utils.getCoinPrices(poolCoinNames) ?? {};
|
|
2442
2448
|
const marketPools = {};
|
|
2443
2449
|
if (indexer) {
|
|
2444
2450
|
const marketPoolsIndexer = await query.indexer.getMarketPools();
|
|
@@ -2620,7 +2626,7 @@ var getMarketPool = async (query, poolCoinName, indexer = false, marketObject, c
|
|
|
2620
2626
|
};
|
|
2621
2627
|
var getMarketCollaterals = async (query, collateralCoinNames = [...SUPPORT_COLLATERALS], indexer = false) => {
|
|
2622
2628
|
const marketId = query.address.get("core.market");
|
|
2623
|
-
const coinPrices = await query.utils.getCoinPrices(collateralCoinNames ??
|
|
2629
|
+
const coinPrices = await query.utils.getCoinPrices(collateralCoinNames) ?? {};
|
|
2624
2630
|
const marketCollaterals = {};
|
|
2625
2631
|
if (indexer) {
|
|
2626
2632
|
const marketCollateralsIndexer = await query.indexer.getMarketCollaterals();
|
|
@@ -2929,9 +2935,9 @@ var getSpools = async (query, stakeMarketCoinNames = [...SUPPORT_SPOOLS], indexe
|
|
|
2929
2935
|
const rewardCoinName = query.utils.getSpoolRewardCoinName(stakeMarketCoinName);
|
|
2930
2936
|
return rewardCoinName;
|
|
2931
2937
|
});
|
|
2932
|
-
const coinPrices = await query.utils.getCoinPrices(
|
|
2933
|
-
|
|
2934
|
-
);
|
|
2938
|
+
const coinPrices = await query.utils.getCoinPrices([
|
|
2939
|
+
.../* @__PURE__ */ new Set([...stakeCoinNames, ...rewardCoinNames])
|
|
2940
|
+
]) ?? {};
|
|
2935
2941
|
const marketPools = await query.getMarketPools(stakeCoinNames, indexer);
|
|
2936
2942
|
const spools = {};
|
|
2937
2943
|
if (indexer) {
|
|
@@ -3310,14 +3316,12 @@ var queryBorrowIncentivePools = async (query, borrowIncentiveCoinNames = [
|
|
|
3310
3316
|
...SUPPORT_BORROW_INCENTIVE_POOLS
|
|
3311
3317
|
], indexer = false) => {
|
|
3312
3318
|
const borrowIncentivePools = {};
|
|
3313
|
-
const coinPrices = await query.utils.getCoinPrices(
|
|
3314
|
-
[
|
|
3315
|
-
|
|
3316
|
-
|
|
3317
|
-
|
|
3318
|
-
|
|
3319
|
-
]
|
|
3320
|
-
);
|
|
3319
|
+
const coinPrices = await query.utils.getCoinPrices([
|
|
3320
|
+
.../* @__PURE__ */ new Set([
|
|
3321
|
+
...borrowIncentiveCoinNames,
|
|
3322
|
+
...SUPPORT_BORROW_INCENTIVE_REWARDS
|
|
3323
|
+
])
|
|
3324
|
+
]) ?? {};
|
|
3321
3325
|
if (indexer) {
|
|
3322
3326
|
const borrowIncentivePoolsIndexer = await query.indexer.getBorrowIncentivePools();
|
|
3323
3327
|
const updateBorrowIncentivePool = (pool) => {
|
|
@@ -5208,7 +5212,7 @@ var generateCoreQuickMethod = ({
|
|
|
5208
5212
|
const obligationCoinNames = await builder.utils.getObligationCoinNames(
|
|
5209
5213
|
obligationInfo.obligationId
|
|
5210
5214
|
) ?? [];
|
|
5211
|
-
const updateCoinNames = [...obligationCoinNames
|
|
5215
|
+
const updateCoinNames = [...obligationCoinNames, poolCoinName];
|
|
5212
5216
|
await updateOracles(builder, txBlock, updateCoinNames);
|
|
5213
5217
|
return txBlock.borrow(
|
|
5214
5218
|
obligationInfo.obligationId,
|
|
@@ -8037,6 +8041,7 @@ var Scallop = class {
|
|
|
8037
8041
|
MAX_LOCK_ROUNDS,
|
|
8038
8042
|
MIN_INITIAL_LOCK_AMOUNT,
|
|
8039
8043
|
MIN_TOP_UP_AMOUNT,
|
|
8044
|
+
NATIVE_USDC,
|
|
8040
8045
|
OLD_BORROW_INCENTIVE_PROTOCOL_ID,
|
|
8041
8046
|
PROTOCOL_OBJECT_ID,
|
|
8042
8047
|
SCA_COIN_TYPE,
|