@scallop-io/sui-scallop-sdk 0.46.61 → 0.46.63

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.
@@ -191,7 +191,7 @@ export declare class ScallopUtils {
191
191
  */
192
192
  parseAprToApy(apr: number, compoundFrequency?: number): number;
193
193
  /**
194
- * Convert apr to apy.
194
+ * Convert apy to apr.
195
195
  *
196
196
  * @param apr The equivalent annual percentage yield (APY).
197
197
  * @param compoundFrequency How often interest is compounded per year. Default is daily (365 times a year).
@@ -122,7 +122,7 @@ export type MarketPool = {
122
122
  coinWrappedType: CoinWrappedType;
123
123
  coinDecimal: number;
124
124
  coinPrice: number;
125
- supplyLimit: string;
125
+ maxSupplyCoin: number;
126
126
  } & Required<Pick<ParsedMarketPoolData, 'highKink' | 'midKink' | 'reserveFactor' | 'borrowWeight' | 'borrowFee' | 'marketCoinSupplyAmount' | 'minBorrowAmount'>> & CalculatedMarketPoolData;
127
127
  export type MarketCollateral = {
128
128
  coinName: SupportCollateralCoins;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scallop-io/sui-scallop-sdk",
3
- "version": "0.46.61",
3
+ "version": "0.46.63",
4
4
  "description": "Typescript sdk for interacting with Scallop contract on SUI",
5
5
  "keywords": [
6
6
  "sui",
@@ -817,7 +817,7 @@ export class ScallopClient {
817
817
  await this.utils.mergeSimilarCoins(
818
818
  txBlock,
819
819
  coin,
820
- this.utils.parseCoinType(this.utils.parseCoinName(stakeCoinName)),
820
+ this.utils.parseCoinType(stakeCoinName),
821
821
  requireSender(txBlock)
822
822
  );
823
823
 
@@ -582,7 +582,7 @@ export class ScallopUtils {
582
582
  }
583
583
 
584
584
  /**
585
- * Convert apr to apy.
585
+ * Convert apy to apr.
586
586
  *
587
587
  * @param apr The equivalent annual percentage yield (APY).
588
588
  * @param compoundFrequency How often interest is compounded per year. Default is daily (365 times a year).
@@ -125,8 +125,13 @@ export const queryMarket = async (
125
125
  parsedMarketPoolData
126
126
  );
127
127
 
128
- const supplyLimit =
129
- (await getSupplyLimit(query.utils, poolCoinName)) ?? '0';
128
+ const coinDecimal = query.utils.getCoinDecimal(poolCoinName);
129
+ const maxSupplyCoin = BigNumber(
130
+ (await getSupplyLimit(query.utils, poolCoinName)) ?? '0'
131
+ )
132
+ .shiftedBy(-coinDecimal)
133
+ .toNumber();
134
+
130
135
  pools[poolCoinName] = {
131
136
  coinName: poolCoinName,
132
137
  symbol: query.utils.parseSymbol(poolCoinName),
@@ -136,7 +141,7 @@ export const queryMarket = async (
136
141
  query.utils.parseMarketCoinName(poolCoinName)
137
142
  ),
138
143
  coinWrappedType: query.utils.getCoinWrappedType(poolCoinName),
139
- coinDecimal: query.utils.getCoinDecimal(poolCoinName),
144
+ coinDecimal,
140
145
  coinPrice: coinPrice,
141
146
  highKink: parsedMarketPoolData.highKink,
142
147
  midKink: parsedMarketPoolData.midKink,
@@ -145,7 +150,7 @@ export const queryMarket = async (
145
150
  borrowFee: parsedMarketPoolData.borrowFee,
146
151
  marketCoinSupplyAmount: parsedMarketPoolData.marketCoinSupplyAmount,
147
152
  minBorrowAmount: parsedMarketPoolData.minBorrowAmount,
148
- supplyLimit,
153
+ maxSupplyCoin,
149
154
  ...calculatedMarketPoolData,
150
155
  };
151
156
  }
@@ -455,8 +460,12 @@ export const getMarketPool = async (
455
460
  parsedMarketPoolData
456
461
  );
457
462
 
458
- const supplyLimit =
459
- (await getSupplyLimit(query.utils, poolCoinName)) ?? '0';
463
+ const coinDecimal = query.utils.getCoinDecimal(poolCoinName);
464
+ const maxSupplyCoin = BigNumber(
465
+ (await getSupplyLimit(query.utils, poolCoinName)) ?? '0'
466
+ )
467
+ .shiftedBy(-coinDecimal)
468
+ .toNumber();
460
469
 
461
470
  marketPool = {
462
471
  coinName: poolCoinName,
@@ -467,7 +476,7 @@ export const getMarketPool = async (
467
476
  query.utils.parseMarketCoinName(poolCoinName)
468
477
  ),
469
478
  coinWrappedType: query.utils.getCoinWrappedType(poolCoinName),
470
- coinDecimal: query.utils.getCoinDecimal(poolCoinName),
479
+ coinDecimal,
471
480
  coinPrice: coinPrice ?? 0,
472
481
  highKink: parsedMarketPoolData.highKink,
473
482
  midKink: parsedMarketPoolData.midKink,
@@ -476,7 +485,7 @@ export const getMarketPool = async (
476
485
  borrowFee: parsedMarketPoolData.borrowFee,
477
486
  marketCoinSupplyAmount: parsedMarketPoolData.marketCoinSupplyAmount,
478
487
  minBorrowAmount: parsedMarketPoolData.minBorrowAmount,
479
- supplyLimit,
488
+ maxSupplyCoin,
480
489
  ...calculatedMarketPoolData,
481
490
  };
482
491
  }
@@ -129,7 +129,7 @@ export type MarketPool = {
129
129
  coinWrappedType: CoinWrappedType;
130
130
  coinDecimal: number;
131
131
  coinPrice: number;
132
- supplyLimit: string;
132
+ maxSupplyCoin: number;
133
133
  } & Required<
134
134
  Pick<
135
135
  ParsedMarketPoolData,