@scallop-io/sui-scallop-sdk 0.47.0-alpha.5 → 0.47.0

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.
@@ -12,7 +12,7 @@ export declare const SUPPORT_COLLATERALS: readonly ["usdc", "weth", "wbtc", "wus
12
12
  export declare const SUPPORT_SPOOLS: readonly ["susdc", "sweth", "ssui", "swusdc", "swusdt", "scetus", "safsui", "shasui", "svsui"];
13
13
  export declare const SUPPORT_SCOIN: readonly ["susdc", "ssui", "swusdc", "swusdt", "safsui", "shasui", "svsui", "sweth", "ssca", "scetus", "swsol", "swbtc"];
14
14
  export declare const SUPPORT_SPOOLS_REWARDS: readonly ["sui"];
15
- export declare const SUPPORT_BORROW_INCENTIVE_POOLS: readonly ["sui", "wusdc", "wusdt", "afsui", "hasui", "vsui", "weth", "sca"];
15
+ export declare const SUPPORT_BORROW_INCENTIVE_POOLS: readonly ["sui", "wusdc", "wusdt", "afsui", "hasui", "vsui", "weth", "sca", "usdc"];
16
16
  export declare const SUPPORT_BORROW_INCENTIVE_REWARDS: readonly ["sui", "sca"];
17
17
  export declare const SUPPORT_ORACLES: readonly ["supra", "switchboard", "pyth"];
18
18
  export declare const SUPPORT_PACKAGES: readonly ["coinDecimalsRegistry", "math", "whitelist", "x", "protocol", "protocolWhitelist", "query", "supra", "pyth", "switchboard", "xOracle", "testCoin"];
package/dist/index.js CHANGED
@@ -151,7 +151,8 @@ var SUPPORT_BORROW_INCENTIVE_POOLS = [
151
151
  "hasui",
152
152
  "vsui",
153
153
  "weth",
154
- "sca"
154
+ "sca",
155
+ "usdc"
155
156
  ];
156
157
  var SUPPORT_BORROW_INCENTIVE_REWARDS = ["sui", "sca"];
157
158
  var SUPPORT_ORACLES = ["supra", "switchboard", "pyth"];
@@ -266,6 +267,7 @@ var spoolRewardCoins = {
266
267
  susdc: "sui"
267
268
  };
268
269
  var borrowIncentiveRewardCoins = {
270
+ usdc: ["sui", "sca"],
269
271
  sui: ["sui", "sca"],
270
272
  wusdc: ["sui", "sca"],
271
273
  wusdt: ["sui", "sca"],
@@ -302,8 +304,7 @@ var voloCoinIds = {
302
304
  vsui: "0x549e8b69270defbfafd4f94e17ec44cdbdd99820b33bda2278dea3b9a32d3f55"
303
305
  };
304
306
  var sCoinIds = {
305
- susdc: "",
306
- // TODO: sCoin contract
307
+ susdc: "0x854950aa624b1df59fe64e630b2ba7c550642e9342267a33061d59fb31582da5::scallop_usdc::SCALLOP_USDC",
307
308
  ssui: "0xaafc4f740de0dd0dde642a31148fb94517087052f19afb0f7bed1dc41a50c77b::scallop_sui::SCALLOP_SUI",
308
309
  scetus: "0xea346ce428f91ab007210443efcea5f5cdbbb3aae7e9affc0ca93f9203c31f0c::scallop_cetus::SCALLOP_CETUS",
309
310
  ssca: "0x5ca17430c1d046fae9edeaa8fd76c7b4193a00d764a0ecfa9418d733ad27bc1e::scallop_sca::SCALLOP_SCA",
@@ -715,7 +716,8 @@ var parseOriginBorrowIncentivesPoolPointData = (originBorrowIncentivePoolPointDa
715
716
  index: Number(originBorrowIncentivePoolPointData.index),
716
717
  baseWeight: Number(originBorrowIncentivePoolPointData.base_weight),
717
718
  weightedAmount: Number(originBorrowIncentivePoolPointData.weighted_amount),
718
- lastUpdate: Number(originBorrowIncentivePoolPointData.last_update)
719
+ lastUpdate: Number(originBorrowIncentivePoolPointData.last_update),
720
+ createdAt: Number(originBorrowIncentivePoolPointData.created_at)
719
721
  };
720
722
  };
721
723
  var parseOriginBorrowIncentivePoolData = (originBorrowIncentivePoolData) => {
@@ -724,7 +726,6 @@ var parseOriginBorrowIncentivePoolData = (originBorrowIncentivePoolData) => {
724
726
  minStakes: Number(originBorrowIncentivePoolData.min_stakes),
725
727
  maxStakes: Number(originBorrowIncentivePoolData.max_stakes),
726
728
  staked: Number(originBorrowIncentivePoolData.stakes),
727
- createdAt: Number(originBorrowIncentivePoolData.created_at),
728
729
  poolPoints: originBorrowIncentivePoolData.points.reduce(
729
730
  (acc, point) => {
730
731
  const parsed = parseOriginBorrowIncentivesPoolPointData(point);
@@ -2448,8 +2449,8 @@ var queryMarket = async (query, indexer = false) => {
2448
2449
  }
2449
2450
  return {
2450
2451
  pools,
2451
- collaterals,
2452
- data: marketData
2452
+ collaterals
2453
+ // data: marketData,
2453
2454
  };
2454
2455
  };
2455
2456
  var getMarketPools = async (query, poolCoinNames = [...SUPPORT_POOLS], indexer = false) => {
@@ -2831,8 +2832,7 @@ var queryObligation = async ({
2831
2832
  );
2832
2833
  return queryResult?.events[0]?.parsedJson;
2833
2834
  };
2834
- var getCoinAmounts = async (query, assetCoinNames, ownerAddress) => {
2835
- assetCoinNames = assetCoinNames || [...SUPPORT_POOLS];
2835
+ var getCoinAmounts = async (query, assetCoinNames = [...SUPPORT_POOLS], ownerAddress) => {
2836
2836
  const owner = ownerAddress || query.suiKit.currentAddress();
2837
2837
  const assetCoins2 = {};
2838
2838
  await Promise.allSettled(
@@ -3326,7 +3326,19 @@ var getStakeRewardPool = async ({
3326
3326
  // src/queries/borrowIncentiveQuery.ts
3327
3327
  var import_utils7 = require("@mysten/sui.js/utils");
3328
3328
  var import_bignumber3 = __toESM(require("bignumber.js"));
3329
- var queryBorrowIncentivePools = async (query, borrowIncentiveCoinNames = [
3329
+ var queryBorrowIncentivePools = async (address) => {
3330
+ const queryPkgId = address.get("borrowIncentive.query");
3331
+ const incentivePoolsId = address.get("borrowIncentive.incentivePools");
3332
+ const queryTarget = `${queryPkgId}::incentive_pools_query::incentive_pools_data`;
3333
+ const args = [incentivePoolsId];
3334
+ const queryResult = await address.cache.queryInspectTxn({
3335
+ queryTarget,
3336
+ args
3337
+ });
3338
+ const borrowIncentivePoolsQueryData = queryResult?.events[0].parsedJson;
3339
+ return borrowIncentivePoolsQueryData;
3340
+ };
3341
+ var getBorrowIncentivePools = async (query, borrowIncentiveCoinNames = [
3330
3342
  ...SUPPORT_BORROW_INCENTIVE_POOLS
3331
3343
  ], indexer = false) => {
3332
3344
  const borrowIncentivePools = {};
@@ -3349,12 +3361,9 @@ var queryBorrowIncentivePools = async (query, borrowIncentiveCoinNames = [
3349
3361
  );
3350
3362
  return borrowIncentivePools;
3351
3363
  }
3352
- const queryPkgId = query.address.get("borrowIncentive.query");
3353
- const incentivePoolsId = query.address.get("borrowIncentive.incentivePools");
3354
- const queryTarget = `${queryPkgId}::incentive_pools_query::incentive_pools_data`;
3355
- const args = [incentivePoolsId];
3356
- const queryResult = await query.cache.queryInspectTxn({ queryTarget, args });
3357
- const borrowIncentivePoolsQueryData = queryResult?.events[0].parsedJson;
3364
+ const borrowIncentivePoolsQueryData = await queryBorrowIncentivePools(
3365
+ query.address
3366
+ );
3358
3367
  for (const pool of borrowIncentivePoolsQueryData?.incentive_pools ?? []) {
3359
3368
  const borrowIncentivePoolPoints = {};
3360
3369
  const parsedBorrowIncentivePoolData = parseOriginBorrowIncentivePoolData(pool);
@@ -3417,10 +3426,9 @@ var queryBorrowIncentivePools = async (query, borrowIncentiveCoinNames = [
3417
3426
  };
3418
3427
  var queryBorrowIncentiveAccounts = async ({
3419
3428
  utils
3420
- }, obligationId, borrowIncentiveCoinNames) => {
3421
- borrowIncentiveCoinNames = borrowIncentiveCoinNames || [
3422
- ...SUPPORT_BORROW_INCENTIVE_POOLS
3423
- ];
3429
+ }, obligationId, borrowIncentiveCoinNames = [
3430
+ ...SUPPORT_BORROW_INCENTIVE_POOLS
3431
+ ]) => {
3424
3432
  const queryPkgId = utils.address.get("borrowIncentive.query");
3425
3433
  const incentiveAccountsId = utils.address.get(
3426
3434
  "borrowIncentive.incentiveAccounts"
@@ -4642,10 +4650,9 @@ var ScallopUtils = class {
4642
4650
  * @param assetCoinNames - Specific an array of support asset coin name.
4643
4651
  * @return Asset coin price.
4644
4652
  */
4645
- async getCoinPrices(assetCoinNames) {
4646
- assetCoinNames = assetCoinNames || [
4647
- .../* @__PURE__ */ new Set([...SUPPORT_POOLS, ...SUPPORT_COLLATERALS])
4648
- ];
4653
+ async getCoinPrices(assetCoinNames = [
4654
+ .../* @__PURE__ */ new Set([...SUPPORT_POOLS, ...SUPPORT_COLLATERALS])
4655
+ ]) {
4649
4656
  const coinPrices = {};
4650
4657
  const existPricesCoinNames = [];
4651
4658
  const lackPricesCoinNames = [];
@@ -6581,8 +6588,7 @@ var getSCoinTotalSupply = async ({
6581
6588
  };
6582
6589
  var getSCoinAmounts = async ({
6583
6590
  utils
6584
- }, sCoinNames, ownerAddress) => {
6585
- sCoinNames = sCoinNames || [...SUPPORT_SCOIN];
6591
+ }, sCoinNames = [...SUPPORT_SCOIN], ownerAddress) => {
6586
6592
  const owner = ownerAddress || utils.suiKit.currentAddress();
6587
6593
  const sCoins2 = {};
6588
6594
  await Promise.allSettled(
@@ -6946,7 +6952,7 @@ var ScallopQuery = class {
6946
6952
  * @return Borrow incentive pools data.
6947
6953
  */
6948
6954
  async getBorrowIncentivePools(coinNames, indexer = false) {
6949
- return await queryBorrowIncentivePools(this, coinNames, indexer);
6955
+ return await getBorrowIncentivePools(this, coinNames, indexer);
6950
6956
  }
6951
6957
  /**
6952
6958
  * Get borrow incentive accounts data.