@scallop-io/sui-scallop-sdk 1.3.3 → 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.
- package/dist/index.js +1258 -1092
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1249 -1092
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
- package/src/builders/loyaltyProgramBuilder.ts +1 -1
- package/src/constants/coinGecko.ts +18 -0
- package/src/constants/common.ts +0 -1
- package/src/constants/enum.ts +8 -0
- package/src/constants/index.ts +6 -0
- package/src/constants/poolAddress.ts +94 -0
- package/src/constants/pyth.ts +19 -0
- package/src/constants/queryKeys.ts +1 -5
- package/src/constants/rpc.ts +16 -0
- package/src/constants/tokenBucket.ts +1 -1
- package/src/models/scallop.ts +3 -2
- package/src/models/scallopAddress.ts +2 -2
- package/src/models/scallopBuilder.ts +4 -3
- package/src/models/scallopCache.ts +1 -1
- package/src/models/scallopClient.ts +27 -26
- package/src/models/scallopQuery.ts +58 -15
- package/src/models/scallopUtils.ts +96 -96
- package/src/models/suiKit.ts +11 -0
- package/src/queries/borrowIncentiveQuery.ts +6 -13
- package/src/queries/coreQuery.ts +37 -22
- package/src/queries/loyaltyProgramQuery.ts +1 -1
- package/src/queries/portfolioQuery.ts +55 -34
- package/src/queries/spoolQuery.ts +17 -17
- package/src/types/utils.ts +13 -0
- package/src/utils/tokenBucket.ts +2 -1
- package/src/utils/util.ts +2 -1
- package/dist/builders/borrowIncentiveBuilder.d.ts +0 -12
- package/dist/builders/coreBuilder.d.ts +0 -12
- package/dist/builders/index.d.ts +0 -12
- package/dist/builders/loyaltyProgramBuilder.d.ts +0 -12
- package/dist/builders/oracle.d.ts +0 -14
- package/dist/builders/referralBuilder.d.ts +0 -12
- package/dist/builders/sCoinBuilder.d.ts +0 -4
- package/dist/builders/spoolBuilder.d.ts +0 -12
- package/dist/builders/vescaBuilder.d.ts +0 -25
- package/dist/constants/cache.d.ts +0 -14
- package/dist/constants/common.d.ts +0 -20
- package/dist/constants/enum.d.ts +0 -13
- package/dist/constants/flashloan.d.ts +0 -2
- package/dist/constants/index.d.ts +0 -5
- package/dist/constants/pyth.d.ts +0 -3
- package/dist/constants/queryKeys.d.ts +0 -58
- package/dist/constants/testAddress.d.ts +0 -2
- package/dist/constants/tokenBucket.d.ts +0 -2
- package/dist/constants/vesca.d.ts +0 -5
- package/dist/index.d.ts +0 -3
- package/dist/models/index.d.ts +0 -8
- package/dist/models/scallop.d.ts +0 -74
- package/dist/models/scallopAddress.d.ts +0 -150
- package/dist/models/scallopBuilder.d.ts +0 -89
- package/dist/models/scallopCache.d.ts +0 -74
- package/dist/models/scallopClient.d.ts +0 -321
- package/dist/models/scallopIndexer.d.ts +0 -89
- package/dist/models/scallopPrice.d.ts +0 -0
- package/dist/models/scallopQuery.d.ts +0 -474
- package/dist/models/scallopUtils.d.ts +0 -217
- package/dist/queries/borrowIncentiveQuery.d.ts +0 -61
- package/dist/queries/coreQuery.d.ts +0 -167
- package/dist/queries/index.d.ts +0 -8
- package/dist/queries/isolatedAsset.d.ts +0 -14
- package/dist/queries/loyaltyProgramQuery.d.ts +0 -10
- package/dist/queries/portfolioQuery.d.ts +0 -73
- package/dist/queries/priceQuery.d.ts +0 -16
- package/dist/queries/referralQuery.d.ts +0 -7
- package/dist/queries/sCoinQuery.d.ts +0 -41
- package/dist/queries/spoolQuery.d.ts +0 -70
- package/dist/queries/supplyLimit.d.ts +0 -9
- package/dist/queries/vescaQuery.d.ts +0 -36
- package/dist/types/address.d.ts +0 -107
- package/dist/types/builder/borrowIncentive.d.ts +0 -35
- package/dist/types/builder/core.d.ts +0 -56
- package/dist/types/builder/index.d.ts +0 -24
- package/dist/types/builder/loyaltyProgram.d.ts +0 -23
- package/dist/types/builder/referral.d.ts +0 -30
- package/dist/types/builder/sCoin.d.ts +0 -37
- package/dist/types/builder/spool.d.ts +0 -29
- package/dist/types/builder/vesca.d.ts +0 -51
- package/dist/types/constant/common.d.ts +0 -24
- package/dist/types/constant/enum.d.ts +0 -48
- package/dist/types/constant/index.d.ts +0 -2
- package/dist/types/index.d.ts +0 -6
- package/dist/types/model.d.ts +0 -54
- package/dist/types/query/borrowIncentive.d.ts +0 -124
- package/dist/types/query/core.d.ts +0 -361
- package/dist/types/query/index.d.ts +0 -7
- package/dist/types/query/loyaltyProgram.d.ts +0 -5
- package/dist/types/query/portfolio.d.ts +0 -115
- package/dist/types/query/sCoin.d.ts +0 -1
- package/dist/types/query/spool.d.ts +0 -122
- package/dist/types/query/vesca.d.ts +0 -26
- package/dist/types/utils.d.ts +0 -9
- package/dist/utils/builder.d.ts +0 -15
- package/dist/utils/index.d.ts +0 -5
- package/dist/utils/indexer.d.ts +0 -17
- package/dist/utils/query.d.ts +0 -62
- package/dist/utils/tokenBucket.d.ts +0 -11
- package/dist/utils/util.d.ts +0 -26
- package/src/models/scallopPrice.ts +0 -0
package/dist/utils/query.d.ts
DELETED
|
@@ -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: (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,11 +0,0 @@
|
|
|
1
|
-
declare class TokenBucket {
|
|
2
|
-
private tokensPerInterval;
|
|
3
|
-
private interval;
|
|
4
|
-
private tokens;
|
|
5
|
-
private lastRefill;
|
|
6
|
-
constructor(tokensPerInterval: number, intervalInMs: number);
|
|
7
|
-
refill(): void;
|
|
8
|
-
removeTokens(count: number): boolean;
|
|
9
|
-
}
|
|
10
|
-
declare const callWithRateLimit: <T>(tokenBucket: TokenBucket, fn: () => Promise<T>, retryDelayInMs?: number, maxRetries?: number, backoffFactor?: number) => Promise<T | null>;
|
|
11
|
-
export { TokenBucket, callWithRateLimit };
|
package/dist/utils/util.d.ts
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import type { PriceFeed } from '@pythnetwork/pyth-sui-js';
|
|
2
|
-
import type { ScallopAddress } from '../models';
|
|
3
|
-
import type { SupportAssetCoins, SupportCoins, SupportMarketCoins, SupportSuiBridgeCoins, SupportWormholeCoins } from '../types';
|
|
4
|
-
export declare const isMarketCoin: (coinName: SupportCoins) => coinName is SupportMarketCoins;
|
|
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;
|
|
File without changes
|