@scallop-io/sui-scallop-sdk 1.3.4-alpha.1 → 1.3.4-alpha.3

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 (103) 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/types/query/index.ts +4 -4
  31. package/src/utils/tokenBucket.ts +2 -1
  32. package/dist/builders/borrowIncentiveBuilder.d.ts +0 -12
  33. package/dist/builders/coreBuilder.d.ts +0 -12
  34. package/dist/builders/index.d.ts +0 -12
  35. package/dist/builders/loyaltyProgramBuilder.d.ts +0 -12
  36. package/dist/builders/oracle.d.ts +0 -14
  37. package/dist/builders/referralBuilder.d.ts +0 -12
  38. package/dist/builders/sCoinBuilder.d.ts +0 -4
  39. package/dist/builders/spoolBuilder.d.ts +0 -12
  40. package/dist/builders/vescaBuilder.d.ts +0 -25
  41. package/dist/constants/cache.d.ts +0 -14
  42. package/dist/constants/coinGecko.d.ts +0 -2
  43. package/dist/constants/common.d.ts +0 -20
  44. package/dist/constants/enum.d.ts +0 -13
  45. package/dist/constants/flashloan.d.ts +0 -2
  46. package/dist/constants/index.d.ts +0 -12
  47. package/dist/constants/poolAddress.d.ts +0 -5
  48. package/dist/constants/pyth.d.ts +0 -5
  49. package/dist/constants/queryKeys.d.ts +0 -59
  50. package/dist/constants/testAddress.d.ts +0 -2
  51. package/dist/constants/tokenBucket.d.ts +0 -2
  52. package/dist/constants/vesca.d.ts +0 -5
  53. package/dist/index.d.ts +0 -3
  54. package/dist/models/index.d.ts +0 -8
  55. package/dist/models/scallop.d.ts +0 -74
  56. package/dist/models/scallopAddress.d.ts +0 -150
  57. package/dist/models/scallopBuilder.d.ts +0 -89
  58. package/dist/models/scallopCache.d.ts +0 -74
  59. package/dist/models/scallopClient.d.ts +0 -321
  60. package/dist/models/scallopIndexer.d.ts +0 -89
  61. package/dist/models/scallopQuery.d.ts +0 -474
  62. package/dist/models/scallopUtils.d.ts +0 -222
  63. package/dist/queries/borrowIncentiveQuery.d.ts +0 -61
  64. package/dist/queries/coreQuery.d.ts +0 -167
  65. package/dist/queries/index.d.ts +0 -8
  66. package/dist/queries/isolatedAsset.d.ts +0 -14
  67. package/dist/queries/loyaltyProgramQuery.d.ts +0 -10
  68. package/dist/queries/portfolioQuery.d.ts +0 -73
  69. package/dist/queries/priceQuery.d.ts +0 -16
  70. package/dist/queries/referralQuery.d.ts +0 -7
  71. package/dist/queries/sCoinQuery.d.ts +0 -41
  72. package/dist/queries/spoolQuery.d.ts +0 -70
  73. package/dist/queries/supplyLimit.d.ts +0 -9
  74. package/dist/queries/vescaQuery.d.ts +0 -36
  75. package/dist/types/address.d.ts +0 -107
  76. package/dist/types/builder/borrowIncentive.d.ts +0 -35
  77. package/dist/types/builder/core.d.ts +0 -56
  78. package/dist/types/builder/index.d.ts +0 -24
  79. package/dist/types/builder/loyaltyProgram.d.ts +0 -23
  80. package/dist/types/builder/referral.d.ts +0 -30
  81. package/dist/types/builder/sCoin.d.ts +0 -37
  82. package/dist/types/builder/spool.d.ts +0 -29
  83. package/dist/types/builder/vesca.d.ts +0 -51
  84. package/dist/types/constant/common.d.ts +0 -24
  85. package/dist/types/constant/enum.d.ts +0 -48
  86. package/dist/types/constant/index.d.ts +0 -2
  87. package/dist/types/index.d.ts +0 -6
  88. package/dist/types/model.d.ts +0 -54
  89. package/dist/types/query/borrowIncentive.d.ts +0 -124
  90. package/dist/types/query/core.d.ts +0 -362
  91. package/dist/types/query/index.d.ts +0 -7
  92. package/dist/types/query/loyaltyProgram.d.ts +0 -5
  93. package/dist/types/query/portfolio.d.ts +0 -115
  94. package/dist/types/query/sCoin.d.ts +0 -1
  95. package/dist/types/query/spool.d.ts +0 -122
  96. package/dist/types/query/vesca.d.ts +0 -26
  97. package/dist/types/utils.d.ts +0 -21
  98. package/dist/utils/builder.d.ts +0 -15
  99. package/dist/utils/index.d.ts +0 -5
  100. package/dist/utils/indexer.d.ts +0 -17
  101. package/dist/utils/query.d.ts +0 -62
  102. package/dist/utils/tokenBucket.d.ts +0 -11
  103. 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