@scallop-io/sui-scallop-sdk 1.5.0-alpha.1 → 1.5.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.
Files changed (99) hide show
  1. package/dist/index.d.mts +3159 -0
  2. package/dist/index.d.ts +3159 -3
  3. package/dist/index.js +78 -9966
  4. package/dist/index.mjs +15 -9892
  5. package/package.json +5 -6
  6. package/src/constants/coinGecko.ts +14 -4
  7. package/src/constants/common.ts +7 -0
  8. package/src/constants/enum.ts +23 -0
  9. package/src/constants/poolAddress.ts +112 -1
  10. package/src/constants/pyth.ts +4 -1
  11. package/src/constants/testAddress.ts +220 -49
  12. package/src/constants/xoracle.ts +3 -0
  13. package/src/models/scallopAddress.ts +9 -0
  14. package/src/models/scallopQuery.ts +4 -2
  15. package/src/queries/poolAddressesQuery.ts +2 -2
  16. package/src/queries/portfolioQuery.ts +7 -8
  17. package/src/types/address.ts +1 -0
  18. package/src/utils/util.ts +8 -3
  19. package/dist/builders/borrowIncentiveBuilder.d.ts +0 -12
  20. package/dist/builders/coreBuilder.d.ts +0 -12
  21. package/dist/builders/index.d.ts +0 -12
  22. package/dist/builders/loyaltyProgramBuilder.d.ts +0 -12
  23. package/dist/builders/oracle.d.ts +0 -14
  24. package/dist/builders/referralBuilder.d.ts +0 -12
  25. package/dist/builders/sCoinBuilder.d.ts +0 -4
  26. package/dist/builders/spoolBuilder.d.ts +0 -12
  27. package/dist/builders/vescaBuilder.d.ts +0 -25
  28. package/dist/constants/cache.d.ts +0 -14
  29. package/dist/constants/coinGecko.d.ts +0 -2
  30. package/dist/constants/common.d.ts +0 -20
  31. package/dist/constants/enum.d.ts +0 -14
  32. package/dist/constants/flashloan.d.ts +0 -2
  33. package/dist/constants/index.d.ts +0 -13
  34. package/dist/constants/poolAddress.d.ts +0 -27
  35. package/dist/constants/pyth.d.ts +0 -5
  36. package/dist/constants/queryKeys.d.ts +0 -54
  37. package/dist/constants/rpc.d.ts +0 -1
  38. package/dist/constants/testAddress.d.ts +0 -2
  39. package/dist/constants/vesca.d.ts +0 -5
  40. package/dist/constants/xoracle.d.ts +0 -2
  41. package/dist/index.js.map +0 -1
  42. package/dist/index.mjs.map +0 -1
  43. package/dist/models/index.d.ts +0 -8
  44. package/dist/models/scallop.d.ts +0 -73
  45. package/dist/models/scallopAddress.d.ts +0 -150
  46. package/dist/models/scallopBuilder.d.ts +0 -90
  47. package/dist/models/scallopCache.d.ts +0 -81
  48. package/dist/models/scallopClient.d.ts +0 -321
  49. package/dist/models/scallopIndexer.d.ts +0 -90
  50. package/dist/models/scallopPrice.d.ts +0 -0
  51. package/dist/models/scallopQuery.d.ts +0 -704
  52. package/dist/models/scallopUtils.d.ts +0 -229
  53. package/dist/models/suiKit.d.ts +0 -2
  54. package/dist/queries/borrowIncentiveQuery.d.ts +0 -82
  55. package/dist/queries/borrowLimitQuery.d.ts +0 -9
  56. package/dist/queries/coreQuery.d.ts +0 -171
  57. package/dist/queries/index.d.ts +0 -15
  58. package/dist/queries/isolatedAssetQuery.d.ts +0 -14
  59. package/dist/queries/loyaltyProgramQuery.d.ts +0 -10
  60. package/dist/queries/objectsQuery.d.ts +0 -2
  61. package/dist/queries/poolAddressesQuery.d.ts +0 -29
  62. package/dist/queries/portfolioQuery.d.ts +0 -143
  63. package/dist/queries/priceQuery.d.ts +0 -58
  64. package/dist/queries/referralQuery.d.ts +0 -7
  65. package/dist/queries/sCoinQuery.d.ts +0 -41
  66. package/dist/queries/spoolQuery.d.ts +0 -74
  67. package/dist/queries/supplyLimitQuery.d.ts +0 -9
  68. package/dist/queries/vescaQuery.d.ts +0 -36
  69. package/dist/queries/xOracleQuery.d.ts +0 -13
  70. package/dist/types/address.d.ts +0 -108
  71. package/dist/types/builder/borrowIncentive.d.ts +0 -35
  72. package/dist/types/builder/core.d.ts +0 -56
  73. package/dist/types/builder/index.d.ts +0 -24
  74. package/dist/types/builder/loyaltyProgram.d.ts +0 -23
  75. package/dist/types/builder/referral.d.ts +0 -30
  76. package/dist/types/builder/sCoin.d.ts +0 -37
  77. package/dist/types/builder/spool.d.ts +0 -29
  78. package/dist/types/builder/vesca.d.ts +0 -51
  79. package/dist/types/constant/common.d.ts +0 -24
  80. package/dist/types/constant/enum.d.ts +0 -48
  81. package/dist/types/constant/index.d.ts +0 -3
  82. package/dist/types/constant/xOracle.d.ts +0 -9
  83. package/dist/types/index.d.ts +0 -6
  84. package/dist/types/model.d.ts +0 -60
  85. package/dist/types/query/borrowIncentive.d.ts +0 -124
  86. package/dist/types/query/core.d.ts +0 -380
  87. package/dist/types/query/index.d.ts +0 -7
  88. package/dist/types/query/loyaltyProgram.d.ts +0 -5
  89. package/dist/types/query/portfolio.d.ts +0 -119
  90. package/dist/types/query/sCoin.d.ts +0 -1
  91. package/dist/types/query/spool.d.ts +0 -142
  92. package/dist/types/query/vesca.d.ts +0 -26
  93. package/dist/types/utils.d.ts +0 -22
  94. package/dist/utils/builder.d.ts +0 -15
  95. package/dist/utils/core.d.ts +0 -2
  96. package/dist/utils/index.d.ts +0 -5
  97. package/dist/utils/indexer.d.ts +0 -17
  98. package/dist/utils/query.d.ts +0 -62
  99. package/dist/utils/util.d.ts +0 -27
@@ -1,15 +0,0 @@
1
- import type { SuiTxBlock as SuiKitTxBlock } from '@scallop-io/sui-kit';
2
- import type { SuiObjectArg } from '@scallop-io/sui-kit';
3
- /**
4
- * Check and get the sender from the transaction block.
5
- *
6
- * @param txBlock - TxBlock created by SuiKit.
7
- * @return Sender of transaction.
8
- */
9
- export declare const requireSender: (txBlock: SuiKitTxBlock) => string;
10
- export declare const checkVesca: (prevUnlockAtInMillisTimestamp?: number) => void;
11
- export declare const checkVescaExpired: (prevUnlockAtInMillisTimestamp: number) => void;
12
- export declare const checkExtendLockPeriod: (lockPeriodInDays: number, newUnlockAtInSecondTimestamp: number, prevUnlockAtInMillisTimestamp?: number) => void;
13
- export declare const checkLockSca: (scaAmountOrCoin: number | SuiObjectArg | undefined, lockPeriodInDays?: number, newUnlockAtInSecondTimestamp?: number, prevUnlockAtInMillisTimestamp?: number) => void;
14
- export declare const checkExtendLockAmount: (scaAmount: number, prevUnlockAtInMillisTimestamp?: number) => void;
15
- export declare const checkRenewExpiredVeSca: (scaAmount: number, lockPeriodInDays: number, prevUnlockAtInMillisTimestamp?: number) => void;
@@ -1,2 +0,0 @@
1
- import { SuiObjectData } from '@mysten/sui/client';
2
- export declare const parseObjectAs: <T>(object: SuiObjectData) => T;
@@ -1,5 +0,0 @@
1
- export * from './builder';
2
- export * from './query';
3
- export * from './util';
4
- export * from './indexer';
5
- export * from './core';
@@ -1,17 +0,0 @@
1
- /**
2
- * Generic wrapper for methods with indexer fallback.
3
- *
4
- * @param method - The method to call with fallback behavior.
5
- * @param context - The context (`this`) of the class instance.
6
- * @param args - The arguments to pass to the method.
7
- * @returns The result of the method call.
8
- */
9
- export declare function callMethodWithIndexerFallback(method: Function, context: any, ...args: any[]): Promise<any>;
10
- /**
11
- * This function creates a wrapper for methods that have an indexer parameter.
12
- * It ensures fallback behavior if indexer fails.
13
- *
14
- * @param method - The method to wrap.
15
- * @returns A function that applies indexer fallback.
16
- */
17
- export declare function withIndexerFallback(method: Function): (...args: any[]) => Promise<any>;
@@ -1,62 +0,0 @@
1
- import BigNumber from 'bignumber.js';
2
- import type { ScallopUtils } from '../models';
3
- import type { OriginMarketPoolData, ParsedMarketPoolData, CalculatedMarketPoolData, OriginMarketCollateralData, ParsedMarketCollateralData, CalculatedMarketCollateralData, OriginSpoolData, ParsedSpoolData, CalculatedSpoolData, OriginSpoolRewardPoolData, ParsedSpoolRewardPoolData, CalculatedSpoolRewardPoolData, OriginBorrowIncentivePoolData, ParsedBorrowIncentivePoolData, OriginBorrowIncentiveAccountData, ParsedBorrowIncentiveAccountData, OriginBorrowIncentivePoolPointData, ParsedBorrowIncentivePoolPointData, CalculatedBorrowIncentivePoolPointData, OriginBorrowIncentiveAccountPoolData, ParsedBorrowIncentiveAccountPoolData } from '../types';
4
- /**
5
- * Parse origin market pool data to a more readable format.
6
- *
7
- * @param originMarketPoolData - Origin market pool data
8
- * @return Parsed market pool data
9
- */
10
- export declare const parseOriginMarketPoolData: (originMarketPoolData: OriginMarketPoolData) => ParsedMarketPoolData;
11
- export declare const calculateMarketPoolData: (utils: ScallopUtils, parsedMarketPoolData: ParsedMarketPoolData) => CalculatedMarketPoolData;
12
- /**
13
- * Parse origin market collateral data to a more readable format.
14
- *
15
- * @param originMarketCollateralData - Origin market collateral data
16
- * @return Parsed market collateral data
17
- */
18
- export declare const parseOriginMarketCollateralData: (originMarketCollateralData: OriginMarketCollateralData) => ParsedMarketCollateralData;
19
- export declare const calculateMarketCollateralData: (utils: ScallopUtils, parsedMarketCollateralData: ParsedMarketCollateralData) => CalculatedMarketCollateralData;
20
- /**
21
- * Parse origin spool data to a more readable format.
22
- *
23
- * @param originSpoolData - Origin spool data
24
- * @return Parsed spool data
25
- */
26
- export declare const parseOriginSpoolData: (originSpoolData: OriginSpoolData) => ParsedSpoolData;
27
- export declare const calculateSpoolData: (parsedSpoolData: ParsedSpoolData, stakeMarketCoinPrice: number, stakeMarketCoinDecimal: number) => CalculatedSpoolData;
28
- /**
29
- * Parse origin spool reward pool data to a more readable format.
30
- *
31
- * @param originRewardPoolData - Origin reward pool data
32
- * @return Parsed spool reward pool data
33
- */
34
- export declare const parseOriginSpoolRewardPoolData: (originSpoolRewardPoolData: OriginSpoolRewardPoolData) => ParsedSpoolRewardPoolData;
35
- export declare const calculateSpoolRewardPoolData: (parsedSpoolData: ParsedSpoolData, parsedSpoolRewardPoolData: ParsedSpoolRewardPoolData, calculatedSpoolData: CalculatedSpoolData, rewardCoinPrice: number, rewardCoinDecimal: number) => CalculatedSpoolRewardPoolData;
36
- export declare const parseOriginBorrowIncentivesPoolPointData: (originBorrowIncentivePoolPointData: OriginBorrowIncentivePoolPointData) => ParsedBorrowIncentivePoolPointData;
37
- /**
38
- * Parse origin borrow incentive pool data to a more readable format.
39
- *
40
- * @param originBorrowIncentivePoolData - Origin borrow incentive pool data
41
- * @return Parsed borrow incentive pool data
42
- */
43
- export declare const parseOriginBorrowIncentivePoolData: (utils: ScallopUtils, originBorrowIncentivePoolData: OriginBorrowIncentivePoolData) => ParsedBorrowIncentivePoolData;
44
- export declare const calculateBorrowIncentivePoolPointData: (parsedBorrowIncentivePoolPointData: ParsedBorrowIncentivePoolPointData, rewardCoinPrice: number, rewardCoinDecimal: number, poolCoinPrice: number, poolCoinDecimal: number) => CalculatedBorrowIncentivePoolPointData;
45
- export declare const parseOriginBorrowIncentiveAccountPoolPointData: (originBorrowIncentiveAccountPoolPointData: OriginBorrowIncentiveAccountPoolData) => ParsedBorrowIncentiveAccountPoolData;
46
- /**
47
- * Parse origin borrow incentive account data to a more readable format.
48
- *
49
- * @param originBorrowIncentiveAccountData - Origin borrow incentive account data
50
- * @return Parsed borrow incentive account data
51
- */
52
- export declare const parseOriginBorrowIncentiveAccountData: (originBorrowIncentiveAccountData: OriginBorrowIncentiveAccountData) => ParsedBorrowIncentiveAccountData;
53
- export declare const minBigNumber: (...args: BigNumber.Value[]) => BigNumber;
54
- export declare const maxBigNumber: (...args: BigNumber.Value[]) => BigNumber;
55
- /**
56
- * Dynamically adjust the decrease or increase ratio according to the amount
57
- * @param amount - The amount required to calculate factor.
58
- * @param scaleStep - The scale step required to determine the factor..
59
- * @param type - The type of the calculation.
60
- * @return The estimated factor
61
- * */
62
- export declare const estimatedFactor: (amount: number, scaleStep: number, type: "increase" | "decrease") => number;
@@ -1,27 +0,0 @@
1
- import type { PriceFeed } from '@pythnetwork/pyth-sui-js';
2
- import type { ScallopAddress } from '../models';
3
- import type { SupportAssetCoins, SupportCoins, SupportMarketCoins, SupportSCoin, SupportSuiBridgeCoins, SupportWormholeCoins } from '../types';
4
- export declare const isMarketCoin: (coinName: SupportCoins) => coinName is SupportMarketCoins | SupportSCoin;
5
- export declare const isSuiBridgeAsset: (coinName: any) => coinName is SupportSuiBridgeCoins;
6
- export declare const isWormholeAsset: (coinName: any) => coinName is SupportWormholeCoins;
7
- export declare const parseAssetSymbol: (coinName: SupportCoins) => string;
8
- /**
9
- * Parse price from pyth price feed.
10
- *
11
- * @param feed - Price feed object from pyth.
12
- * @param address - Scallop address instance.
13
- * @return Price Data inclue coin name, price, and publish time.
14
- */
15
- export declare const parseDataFromPythPriceFeed: (feed: PriceFeed, address: ScallopAddress) => {
16
- coinName: SupportAssetCoins;
17
- price: number;
18
- publishTime: number;
19
- };
20
- /**
21
- * Find the closest unlock round timestamp (12AM) to the given unlock at timestamp in seconds.
22
- *
23
- * @param unlockAtInSecondTimestamp - Unlock at in seconds timestamp to find the closest round.
24
- * @returns Closest round (12AM) in seconds timestamp.
25
- */
26
- export declare const findClosestUnlockRound: (unlockAtInSecondTimestamp: number) => number;
27
- export declare const partitionArray: <T>(array: T[], chunkSize: number) => T[][];