@scallop-io/sui-scallop-sdk 1.3.4-alpha.1 → 1.3.4-alpha.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.
Files changed (102) hide show
  1. package/dist/index.js +550 -544
  2. package/dist/index.js.map +1 -1
  3. package/dist/index.mjs +549 -544
  4. package/dist/index.mjs.map +1 -1
  5. package/package.json +2 -2
  6. package/src/builders/loyaltyProgramBuilder.ts +1 -1
  7. package/src/constants/common.ts +0 -1
  8. package/src/constants/enum.ts +12 -11
  9. package/src/constants/index.ts +0 -1
  10. package/src/constants/queryKeys.ts +1 -5
  11. package/src/constants/rpc.ts +16 -0
  12. package/src/constants/testAddress.ts +35 -76
  13. package/src/constants/tokenBucket.ts +1 -1
  14. package/src/models/scallop.ts +3 -2
  15. package/src/models/scallopAddress.ts +2 -2
  16. package/src/models/scallopBuilder.ts +7 -5
  17. package/src/models/scallopCache.ts +1 -1
  18. package/src/models/scallopClient.ts +27 -26
  19. package/src/models/scallopQuery.ts +61 -19
  20. package/src/models/scallopUtils.ts +74 -109
  21. package/src/models/suiKit.ts +11 -0
  22. package/src/queries/borrowIncentiveQuery.ts +6 -13
  23. package/src/queries/coreQuery.ts +245 -236
  24. package/src/queries/isolatedAsset.ts +4 -4
  25. package/src/queries/loyaltyProgramQuery.ts +1 -1
  26. package/src/queries/portfolioQuery.ts +58 -34
  27. package/src/queries/referralQuery.ts +1 -0
  28. package/src/queries/spoolQuery.ts +17 -17
  29. package/src/types/query/core.ts +0 -1
  30. package/src/utils/tokenBucket.ts +2 -1
  31. package/dist/builders/borrowIncentiveBuilder.d.ts +0 -12
  32. package/dist/builders/coreBuilder.d.ts +0 -12
  33. package/dist/builders/index.d.ts +0 -12
  34. package/dist/builders/loyaltyProgramBuilder.d.ts +0 -12
  35. package/dist/builders/oracle.d.ts +0 -14
  36. package/dist/builders/referralBuilder.d.ts +0 -12
  37. package/dist/builders/sCoinBuilder.d.ts +0 -4
  38. package/dist/builders/spoolBuilder.d.ts +0 -12
  39. package/dist/builders/vescaBuilder.d.ts +0 -25
  40. package/dist/constants/cache.d.ts +0 -14
  41. package/dist/constants/coinGecko.d.ts +0 -2
  42. package/dist/constants/common.d.ts +0 -20
  43. package/dist/constants/enum.d.ts +0 -13
  44. package/dist/constants/flashloan.d.ts +0 -2
  45. package/dist/constants/index.d.ts +0 -12
  46. package/dist/constants/poolAddress.d.ts +0 -5
  47. package/dist/constants/pyth.d.ts +0 -5
  48. package/dist/constants/queryKeys.d.ts +0 -59
  49. package/dist/constants/testAddress.d.ts +0 -2
  50. package/dist/constants/tokenBucket.d.ts +0 -2
  51. package/dist/constants/vesca.d.ts +0 -5
  52. package/dist/index.d.ts +0 -3
  53. package/dist/models/index.d.ts +0 -8
  54. package/dist/models/scallop.d.ts +0 -74
  55. package/dist/models/scallopAddress.d.ts +0 -150
  56. package/dist/models/scallopBuilder.d.ts +0 -89
  57. package/dist/models/scallopCache.d.ts +0 -74
  58. package/dist/models/scallopClient.d.ts +0 -321
  59. package/dist/models/scallopIndexer.d.ts +0 -89
  60. package/dist/models/scallopQuery.d.ts +0 -474
  61. package/dist/models/scallopUtils.d.ts +0 -222
  62. package/dist/queries/borrowIncentiveQuery.d.ts +0 -61
  63. package/dist/queries/coreQuery.d.ts +0 -167
  64. package/dist/queries/index.d.ts +0 -8
  65. package/dist/queries/isolatedAsset.d.ts +0 -14
  66. package/dist/queries/loyaltyProgramQuery.d.ts +0 -10
  67. package/dist/queries/portfolioQuery.d.ts +0 -73
  68. package/dist/queries/priceQuery.d.ts +0 -16
  69. package/dist/queries/referralQuery.d.ts +0 -7
  70. package/dist/queries/sCoinQuery.d.ts +0 -41
  71. package/dist/queries/spoolQuery.d.ts +0 -70
  72. package/dist/queries/supplyLimit.d.ts +0 -9
  73. package/dist/queries/vescaQuery.d.ts +0 -36
  74. package/dist/types/address.d.ts +0 -107
  75. package/dist/types/builder/borrowIncentive.d.ts +0 -35
  76. package/dist/types/builder/core.d.ts +0 -56
  77. package/dist/types/builder/index.d.ts +0 -24
  78. package/dist/types/builder/loyaltyProgram.d.ts +0 -23
  79. package/dist/types/builder/referral.d.ts +0 -30
  80. package/dist/types/builder/sCoin.d.ts +0 -37
  81. package/dist/types/builder/spool.d.ts +0 -29
  82. package/dist/types/builder/vesca.d.ts +0 -51
  83. package/dist/types/constant/common.d.ts +0 -24
  84. package/dist/types/constant/enum.d.ts +0 -48
  85. package/dist/types/constant/index.d.ts +0 -2
  86. package/dist/types/index.d.ts +0 -6
  87. package/dist/types/model.d.ts +0 -54
  88. package/dist/types/query/borrowIncentive.d.ts +0 -124
  89. package/dist/types/query/core.d.ts +0 -362
  90. package/dist/types/query/index.d.ts +0 -7
  91. package/dist/types/query/loyaltyProgram.d.ts +0 -5
  92. package/dist/types/query/portfolio.d.ts +0 -115
  93. package/dist/types/query/sCoin.d.ts +0 -1
  94. package/dist/types/query/spool.d.ts +0 -122
  95. package/dist/types/query/vesca.d.ts +0 -26
  96. package/dist/types/utils.d.ts +0 -21
  97. package/dist/utils/builder.d.ts +0 -15
  98. package/dist/utils/index.d.ts +0 -5
  99. package/dist/utils/indexer.d.ts +0 -17
  100. package/dist/utils/query.d.ts +0 -62
  101. package/dist/utils/tokenBucket.d.ts +0 -11
  102. package/dist/utils/util.d.ts +0 -26
@@ -1,8 +1,5 @@
1
1
  import { normalizeStructTag } from '@mysten/sui/utils';
2
- import {
3
- SUPPORT_BORROW_INCENTIVE_POOLS,
4
- SUPPORT_BORROW_INCENTIVE_REWARDS,
5
- } from '../constants';
2
+ import { SUPPORT_BORROW_INCENTIVE_POOLS } from '../constants';
6
3
  import {
7
4
  parseOriginBorrowIncentivePoolData,
8
5
  parseOriginBorrowIncentiveAccountData,
@@ -19,6 +16,7 @@ import type {
19
16
  BorrowIncentivePoolPoints,
20
17
  OptionalKeys,
21
18
  BorrowIncentivePool,
19
+ CoinPrices,
22
20
  } from '../types';
23
21
  import BigNumber from 'bignumber.js';
24
22
 
@@ -56,17 +54,12 @@ export const getBorrowIncentivePools = async (
56
54
  borrowIncentiveCoinNames: SupportBorrowIncentiveCoins[] = [
57
55
  ...SUPPORT_BORROW_INCENTIVE_POOLS,
58
56
  ],
59
- indexer: boolean = false
57
+ indexer: boolean = false,
58
+ coinPrices?: CoinPrices
60
59
  ) => {
61
60
  const borrowIncentivePools: BorrowIncentivePools = {};
62
61
 
63
- const coinPrices =
64
- (await query.utils.getCoinPrices([
65
- ...new Set([
66
- ...borrowIncentiveCoinNames,
67
- ...SUPPORT_BORROW_INCENTIVE_REWARDS,
68
- ]),
69
- ])) ?? {};
62
+ coinPrices = coinPrices ?? (await query.utils.getCoinPrices()) ?? {};
70
63
 
71
64
  if (indexer) {
72
65
  const borrowIncentivePoolsIndexer =
@@ -74,7 +67,7 @@ export const getBorrowIncentivePools = async (
74
67
 
75
68
  const updateBorrowIncentivePool = (pool: BorrowIncentivePool) => {
76
69
  if (!borrowIncentiveCoinNames.includes(pool.coinName)) return;
77
- pool.coinPrice = coinPrices[pool.coinName] || pool.coinPrice;
70
+ pool.coinPrice = coinPrices[pool.coinName] ?? pool.coinPrice;
78
71
  borrowIncentivePools[pool.coinName] = pool;
79
72
  };
80
73