@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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scallop-io/sui-scallop-sdk",
3
- "version": "0.46.65",
3
+ "version": "0.46.67",
4
4
  "description": "Typescript sdk for interacting with Scallop contract on SUI",
5
5
  "keywords": [
6
6
  "sui",
@@ -392,7 +392,7 @@ const generateCoreQuickMethod: GenerateCoreQuickMethod = ({
392
392
  (await builder.utils.getObligationCoinNames(
393
393
  obligationInfo.obligationId
394
394
  )) ?? [];
395
- const updateCoinNames = [...(obligationCoinNames ?? []), poolCoinName];
395
+ const updateCoinNames = [...obligationCoinNames, poolCoinName];
396
396
  await updateOracles(builder, txBlock, updateCoinNames);
397
397
  return txBlock.borrow(
398
398
  obligationInfo.obligationId,
@@ -32,6 +32,8 @@ export const SCA_COIN_TYPE = IS_VE_SCA_TEST
32
32
  export const OLD_BORROW_INCENTIVE_PROTOCOL_ID =
33
33
  '0xc63072e7f5f4983a2efaf5bdba1480d5e7d74d57948e1c7cc436f8e22cbeb410' as const;
34
34
 
35
+ export const NATIVE_USDC =
36
+ '0xdba34672e30cb065b1f93e3ab55318768fd6fef66c15942c9f7cb846e2f900e7::usdc::USDC' as const;
35
37
  export const SUPPORT_POOLS = [
36
38
  'eth',
37
39
  'btc',
@@ -39,14 +39,13 @@ export const queryBorrowIncentivePools = async (
39
39
  ) => {
40
40
  const borrowIncentivePools: BorrowIncentivePools = {};
41
41
 
42
- const coinPrices = await query.utils.getCoinPrices(
43
- [
42
+ const coinPrices =
43
+ (await query.utils.getCoinPrices([
44
44
  ...new Set([
45
45
  ...borrowIncentiveCoinNames,
46
46
  ...SUPPORT_BORROW_INCENTIVE_REWARDS,
47
47
  ]),
48
- ] ?? []
49
- );
48
+ ])) ?? {};
50
49
 
51
50
  if (indexer) {
52
51
  const borrowIncentivePoolsIndexer =
@@ -6,6 +6,7 @@ import {
6
6
  BORROW_FEE_PROTOCOL_ID,
7
7
  USE_TEST_ADDRESS,
8
8
  FlashLoanFeeObjectMap,
9
+ NATIVE_USDC,
9
10
  } from '../constants';
10
11
  import {
11
12
  parseOriginMarketPoolData,
@@ -94,6 +95,7 @@ export const queryMarket = async (
94
95
 
95
96
  for (const pool of marketData?.pools ?? []) {
96
97
  const coinType = normalizeStructTag(pool.type.name);
98
+ if (coinType === NATIVE_USDC) continue;
97
99
  const poolCoinName =
98
100
  query.utils.parseCoinNameFromType<SupportPoolCoins>(coinType);
99
101
  const coinPrice = coinPrices[poolCoinName] ?? 0;
@@ -162,6 +164,7 @@ export const queryMarket = async (
162
164
 
163
165
  for (const collateral of marketData?.collaterals ?? []) {
164
166
  const coinType = normalizeStructTag(collateral.type.name);
167
+ if (coinType === NATIVE_USDC) continue;
165
168
  const collateralCoinName =
166
169
  query.utils.parseCoinNameFromType<SupportCollateralCoins>(coinType);
167
170
  const coinPrice = coinPrices[collateralCoinName] ?? 0;
@@ -233,7 +236,7 @@ export const getMarketPools = async (
233
236
  const marketObjectResponse = await query.cache.queryGetObject(marketId, {
234
237
  showContent: true,
235
238
  });
236
- const coinPrices = await query.utils.getCoinPrices(poolCoinNames ?? []);
239
+ const coinPrices = (await query.utils.getCoinPrices(poolCoinNames)) ?? {};
237
240
 
238
241
  const marketPools: MarketPools = {};
239
242
 
@@ -518,7 +521,8 @@ export const getMarketCollaterals = async (
518
521
  indexer: boolean = false
519
522
  ) => {
520
523
  const marketId = query.address.get('core.market');
521
- const coinPrices = await query.utils.getCoinPrices(collateralCoinNames ?? []);
524
+ const coinPrices =
525
+ (await query.utils.getCoinPrices(collateralCoinNames)) ?? {};
522
526
  const marketCollaterals: MarketCollaterals = {};
523
527
 
524
528
  if (indexer) {
@@ -42,9 +42,10 @@ export const getSpools = async (
42
42
  query.utils.getSpoolRewardCoinName(stakeMarketCoinName);
43
43
  return rewardCoinName;
44
44
  });
45
- const coinPrices = await query.utils.getCoinPrices(
46
- [...new Set([...stakeCoinNames, ...rewardCoinNames])] ?? []
47
- );
45
+ const coinPrices =
46
+ (await query.utils.getCoinPrices([
47
+ ...new Set([...stakeCoinNames, ...rewardCoinNames]),
48
+ ])) ?? {};
48
49
 
49
50
  const marketPools = await query.getMarketPools(stakeCoinNames, indexer);
50
51
  const spools: Spools = {};