@scallop-io/sui-scallop-sdk 1.5.0-alpha.1 → 1.5.1
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.d.mts +3161 -0
- package/dist/index.d.ts +3161 -3
- package/dist/index.js +78 -9966
- package/dist/index.mjs +15 -9892
- package/package.json +5 -6
- package/src/builders/coreBuilder.ts +10 -14
- package/src/builders/oracle.ts +10 -2
- package/src/constants/coinGecko.ts +14 -4
- package/src/constants/common.ts +8 -1
- package/src/constants/enum.ts +28 -57
- package/src/constants/poolAddress.ts +294 -344
- package/src/constants/pyth.ts +4 -1
- package/src/constants/testAddress.ts +487 -61
- package/src/constants/xoracle.ts +18 -16
- package/src/models/scallopAddress.ts +54 -0
- package/src/models/scallopQuery.ts +8 -12
- package/src/queries/coreQuery.ts +4 -4
- package/src/queries/poolAddressesQuery.ts +2 -2
- package/src/queries/portfolioQuery.ts +7 -8
- package/src/queries/xOracleQuery.ts +15 -7
- package/src/types/address.ts +5 -0
- package/src/types/model.ts +1 -0
- package/src/utils/util.ts +8 -3
- 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/coinGecko.d.ts +0 -2
- package/dist/constants/common.d.ts +0 -20
- package/dist/constants/enum.d.ts +0 -14
- package/dist/constants/flashloan.d.ts +0 -2
- package/dist/constants/index.d.ts +0 -13
- package/dist/constants/poolAddress.d.ts +0 -27
- package/dist/constants/pyth.d.ts +0 -5
- package/dist/constants/queryKeys.d.ts +0 -54
- package/dist/constants/rpc.d.ts +0 -1
- package/dist/constants/testAddress.d.ts +0 -2
- package/dist/constants/vesca.d.ts +0 -5
- package/dist/constants/xoracle.d.ts +0 -2
- package/dist/index.js.map +0 -1
- package/dist/index.mjs.map +0 -1
- package/dist/models/index.d.ts +0 -8
- package/dist/models/scallop.d.ts +0 -73
- package/dist/models/scallopAddress.d.ts +0 -150
- package/dist/models/scallopBuilder.d.ts +0 -90
- package/dist/models/scallopCache.d.ts +0 -81
- package/dist/models/scallopClient.d.ts +0 -321
- package/dist/models/scallopIndexer.d.ts +0 -90
- package/dist/models/scallopPrice.d.ts +0 -0
- package/dist/models/scallopQuery.d.ts +0 -704
- package/dist/models/scallopUtils.d.ts +0 -229
- package/dist/models/suiKit.d.ts +0 -2
- package/dist/queries/borrowIncentiveQuery.d.ts +0 -82
- package/dist/queries/borrowLimitQuery.d.ts +0 -9
- package/dist/queries/coreQuery.d.ts +0 -171
- package/dist/queries/index.d.ts +0 -15
- package/dist/queries/isolatedAssetQuery.d.ts +0 -14
- package/dist/queries/loyaltyProgramQuery.d.ts +0 -10
- package/dist/queries/objectsQuery.d.ts +0 -2
- package/dist/queries/poolAddressesQuery.d.ts +0 -29
- package/dist/queries/portfolioQuery.d.ts +0 -143
- package/dist/queries/priceQuery.d.ts +0 -58
- package/dist/queries/referralQuery.d.ts +0 -7
- package/dist/queries/sCoinQuery.d.ts +0 -41
- package/dist/queries/spoolQuery.d.ts +0 -74
- package/dist/queries/supplyLimitQuery.d.ts +0 -9
- package/dist/queries/vescaQuery.d.ts +0 -36
- package/dist/queries/xOracleQuery.d.ts +0 -13
- package/dist/types/address.d.ts +0 -108
- 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 -3
- package/dist/types/constant/xOracle.d.ts +0 -9
- package/dist/types/index.d.ts +0 -6
- package/dist/types/model.d.ts +0 -60
- package/dist/types/query/borrowIncentive.d.ts +0 -124
- package/dist/types/query/core.d.ts +0 -380
- 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 -119
- package/dist/types/query/sCoin.d.ts +0 -1
- package/dist/types/query/spool.d.ts +0 -142
- package/dist/types/query/vesca.d.ts +0 -26
- package/dist/types/utils.d.ts +0 -22
- package/dist/utils/builder.d.ts +0 -15
- package/dist/utils/core.d.ts +0 -2
- 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/util.d.ts +0 -27
package/dist/utils/builder.d.ts
DELETED
|
@@ -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;
|
package/dist/utils/core.d.ts
DELETED
package/dist/utils/index.d.ts
DELETED
package/dist/utils/indexer.d.ts
DELETED
|
@@ -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>;
|
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: (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;
|
package/dist/utils/util.d.ts
DELETED
|
@@ -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[][];
|