@scallop-io/sui-scallop-sdk 1.3.4-alpha.5 → 1.3.4-alpha.6
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 +96 -96
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +96 -96
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
- package/src/builders/borrowIncentiveBuilder.ts +8 -8
- package/src/builders/coreBuilder.ts +5 -5
- package/src/builders/index.ts +2 -2
- package/src/builders/oracle.ts +4 -4
- package/src/builders/referralBuilder.ts +1 -1
- package/src/builders/spoolBuilder.ts +6 -6
- package/src/builders/vescaBuilder.ts +4 -4
- package/src/constants/coinGecko.ts +1 -1
- package/src/constants/enum.ts +1 -1
- package/src/constants/index.ts +1 -1
- package/src/models/scallop.ts +5 -5
- package/src/models/scallopAddress.ts +6 -9
- package/src/models/scallopBuilder.ts +5 -4
- package/src/models/scallopCache.ts +4 -4
- package/src/models/scallopClient.ts +4 -4
- package/src/models/scallopIndexer.ts +4 -3
- package/src/models/scallopQuery.ts +4 -8
- package/src/models/scallopUtils.ts +8 -11
- package/src/models/suiKit.ts +1 -1
- package/src/queries/borrowIncentiveQuery.ts +5 -5
- package/src/queries/coreQuery.ts +4 -4
- package/src/queries/isolatedAssetQuery.ts +2 -2
- package/src/queries/portfolioQuery.ts +4 -4
- package/src/queries/priceQuery.ts +2 -2
- package/src/queries/spoolQuery.ts +5 -5
- package/src/queries/supplyLimitQuery.ts +2 -2
- package/src/queries/vescaQuery.ts +2 -2
- package/src/types/address.ts +1 -1
- package/src/types/builder/borrowIncentive.ts +3 -3
- package/src/types/builder/core.ts +3 -3
- package/src/types/builder/index.ts +4 -5
- package/src/types/builder/referral.ts +1 -1
- package/src/types/builder/sCoin.ts +1 -1
- package/src/types/builder/spool.ts +2 -2
- package/src/types/constant/common.ts +1 -1
- package/src/types/model.ts +2 -2
- package/src/types/query/borrowIncentive.ts +2 -2
- package/src/types/query/core.ts +1 -1
- package/src/types/query/portfolio.ts +2 -2
- package/src/types/query/spool.ts +1 -1
- package/src/utils/builder.ts +1 -1
- package/src/utils/index.ts +2 -2
- package/src/utils/query.ts +3 -3
- package/src/utils/tokenBucket.ts +1 -1
- package/src/utils/util.ts +4 -4
- 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 -12
- package/dist/constants/poolAddress.d.ts +0 -5
- package/dist/constants/pyth.d.ts +0 -5
- package/dist/constants/queryKeys.d.ts +0 -56
- package/dist/constants/rpc.d.ts +0 -1
- 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/scallopQuery.d.ts +0 -489
- package/dist/models/scallopUtils.d.ts +0 -227
- package/dist/models/suiKit.d.ts +0 -2
- package/dist/queries/borrowIncentiveQuery.d.ts +0 -61
- package/dist/queries/coreQuery.d.ts +0 -167
- package/dist/queries/index.d.ts +0 -11
- package/dist/queries/isolatedAssetQuery.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/supplyLimitQuery.d.ts +0 -9
- package/dist/queries/vescaQuery.d.ts +0 -36
- package/dist/test.d.ts +0 -0
- 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 -25
- 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 -21
- 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/test.ts +0 -30
|
@@ -1,227 +0,0 @@
|
|
|
1
|
-
import { SuiKit } from '@scallop-io/sui-kit';
|
|
2
|
-
import { ScallopAddress } from './scallopAddress';
|
|
3
|
-
import { ScallopCache } from './scallopCache';
|
|
4
|
-
import { ScallopUtilsParams, SupportCoins, SupportAssetCoins, SupportMarketCoins, SupportStakeMarketCoins, SupportBorrowIncentiveCoins, CoinWrappedType, SupportSCoin, ScallopUtilsInstanceParams, SupportSuiBridgeCoins, SupportWormholeCoins, PoolAddressInfo } from 'src/types';
|
|
5
|
-
import type { SuiObjectArg, SuiTxArg, SuiTxBlock } from '@scallop-io/sui-kit';
|
|
6
|
-
/**
|
|
7
|
-
* @description
|
|
8
|
-
* Integrates some helper functions frequently used in interactions with the Scallop contract.
|
|
9
|
-
*
|
|
10
|
-
* @example
|
|
11
|
-
* ```typescript
|
|
12
|
-
* const scallopUtils = new ScallopUtils(<parameters>);
|
|
13
|
-
* await scallopUtils.init();
|
|
14
|
-
* scallopUtils.<utils functions>();
|
|
15
|
-
* await scallopUtils.<utils functions>();
|
|
16
|
-
* ```
|
|
17
|
-
*/
|
|
18
|
-
export declare class ScallopUtils {
|
|
19
|
-
readonly params: ScallopUtilsParams;
|
|
20
|
-
readonly isTestnet: boolean;
|
|
21
|
-
suiKit: SuiKit;
|
|
22
|
-
address: ScallopAddress;
|
|
23
|
-
cache: ScallopCache;
|
|
24
|
-
walletAddress: string;
|
|
25
|
-
constructor(params: ScallopUtilsParams, instance?: ScallopUtilsInstanceParams);
|
|
26
|
-
isSuiBridgeAsset(coinName: any): coinName is SupportSuiBridgeCoins;
|
|
27
|
-
isWormholeAsset(coinName: any): coinName is SupportWormholeCoins;
|
|
28
|
-
/**
|
|
29
|
-
* Request the scallop API to initialize data.
|
|
30
|
-
*
|
|
31
|
-
* @param force - Whether to force initialization.
|
|
32
|
-
* @param address - ScallopAddress instance.
|
|
33
|
-
*/
|
|
34
|
-
init(force?: boolean, address?: ScallopAddress): Promise<void>;
|
|
35
|
-
/**
|
|
36
|
-
* Convert coin name to symbol.
|
|
37
|
-
*
|
|
38
|
-
* @param coinName - Specific support coin name.
|
|
39
|
-
* @return Symbol string.
|
|
40
|
-
*/
|
|
41
|
-
parseSymbol(coinName: SupportCoins): string;
|
|
42
|
-
/**
|
|
43
|
-
* Convert coin name to coin type.
|
|
44
|
-
*
|
|
45
|
-
* @description
|
|
46
|
-
* The Coin type of wormhole is fixed `coin:Coin`. Here using package id
|
|
47
|
-
* to determine and return the type.
|
|
48
|
-
*
|
|
49
|
-
* @param coinPackageId - Package id of coin.
|
|
50
|
-
* @param coinName - Specific support coin name.
|
|
51
|
-
* @return Coin type.
|
|
52
|
-
*/
|
|
53
|
-
parseCoinType(coinName: SupportCoins): string;
|
|
54
|
-
/**
|
|
55
|
-
* Convert coin name to sCoin name.
|
|
56
|
-
*
|
|
57
|
-
* @param coinName - Specific support coin name.
|
|
58
|
-
* @return sCoin name.
|
|
59
|
-
*/
|
|
60
|
-
parseSCoinName<T extends SupportSCoin>(coinName: SupportCoins | SupportMarketCoins): T | undefined;
|
|
61
|
-
/**
|
|
62
|
-
* Convert sCoin name into sCoin type
|
|
63
|
-
* @param sCoinName
|
|
64
|
-
* @returns sCoin type
|
|
65
|
-
*/
|
|
66
|
-
parseSCoinType(sCoinName: SupportSCoin): string;
|
|
67
|
-
/**
|
|
68
|
-
* Convert sCoinType into sCoin name
|
|
69
|
-
* @param sCoinType
|
|
70
|
-
* @returns sCoin name
|
|
71
|
-
*/
|
|
72
|
-
parseSCoinNameFromType(sCoinType: string): "susdc" | "ssbeth" | "sweth" | "swbtc" | "swusdc" | "swusdt" | "ssui" | "swsol" | "scetus" | "safsui" | "shasui" | "svsui" | "ssca";
|
|
73
|
-
/**
|
|
74
|
-
* Convert sCoin name into its underlying coin type
|
|
75
|
-
* @param sCoinName
|
|
76
|
-
* @returns coin type
|
|
77
|
-
*/
|
|
78
|
-
parseUnderlyingSCoinType(sCoinName: SupportSCoin): string;
|
|
79
|
-
/**
|
|
80
|
-
* Get sCoin treasury id from sCoin name
|
|
81
|
-
* @param sCoinName
|
|
82
|
-
* @returns sCoin treasury id
|
|
83
|
-
*/
|
|
84
|
-
getSCoinTreasury(sCoinName: SupportSCoin): any;
|
|
85
|
-
/**
|
|
86
|
-
* Convert coin name to market coin type.
|
|
87
|
-
*
|
|
88
|
-
* @param coinPackageId - Package id of coin.
|
|
89
|
-
* @param coinName - Specific support coin name.
|
|
90
|
-
* @return Market coin type.
|
|
91
|
-
*/
|
|
92
|
-
parseMarketCoinType(coinName: SupportCoins): string;
|
|
93
|
-
/**
|
|
94
|
-
* Convert coin type to coin name.
|
|
95
|
-
*
|
|
96
|
-
* @description
|
|
97
|
-
* The coin name cannot be obtained directly from the wormhole type. Here
|
|
98
|
-
* the package id is used to determine and return a specific name.
|
|
99
|
-
*
|
|
100
|
-
* @param coinType - Specific support coin type.
|
|
101
|
-
* @return Coin Name.
|
|
102
|
-
*/
|
|
103
|
-
parseCoinNameFromType<T extends SupportAssetCoins>(coinType: string): T extends SupportAssetCoins ? T : SupportAssetCoins;
|
|
104
|
-
parseCoinNameFromType<T extends SupportMarketCoins>(coinType: string): T extends SupportMarketCoins ? T : SupportMarketCoins;
|
|
105
|
-
parseCoinNameFromType<T extends SupportCoins>(coinType: string): T extends SupportCoins ? T : SupportCoins;
|
|
106
|
-
/**
|
|
107
|
-
* Convert market coin name to coin name.
|
|
108
|
-
*
|
|
109
|
-
* @param marketCoinName - Specific support market coin name.
|
|
110
|
-
* @return Coin Name.
|
|
111
|
-
*/
|
|
112
|
-
parseCoinName<T extends SupportAssetCoins>(marketCoinName: string): T;
|
|
113
|
-
/**
|
|
114
|
-
* Convert coin name to market coin name.
|
|
115
|
-
*
|
|
116
|
-
* @param coinName - Specific support coin name.
|
|
117
|
-
* @return Market coin name.
|
|
118
|
-
*/
|
|
119
|
-
parseMarketCoinName<T extends SupportMarketCoins>(coinName: SupportCoins): T;
|
|
120
|
-
/**
|
|
121
|
-
* Get reward type of spool.
|
|
122
|
-
*
|
|
123
|
-
* @param stakeMarketCoinName - Support stake market coin.
|
|
124
|
-
* @return Spool reward coin name.
|
|
125
|
-
*/
|
|
126
|
-
getSpoolRewardCoinName: (stakeMarketCoinName: SupportStakeMarketCoins) => "sui";
|
|
127
|
-
/**
|
|
128
|
-
* Get reward type of borrow incentive pool.
|
|
129
|
-
*
|
|
130
|
-
* @param borrowIncentiveCoinName - Support borrow incentive coin.
|
|
131
|
-
* @return Borrow incentive reward coin name.
|
|
132
|
-
*/
|
|
133
|
-
getBorrowIncentiveRewardCoinName: (borrowIncentiveCoinName: SupportBorrowIncentiveCoins) => ("sui" | "sca")[];
|
|
134
|
-
/**
|
|
135
|
-
* Get coin decimal.
|
|
136
|
-
*
|
|
137
|
-
* return Coin decimal.
|
|
138
|
-
*/
|
|
139
|
-
getCoinDecimal(coinName: SupportCoins): number;
|
|
140
|
-
/**
|
|
141
|
-
* Get coin wrapped type.
|
|
142
|
-
*
|
|
143
|
-
* return Coin wrapped type.
|
|
144
|
-
*/
|
|
145
|
-
getCoinWrappedType(assetCoinName: SupportAssetCoins): CoinWrappedType;
|
|
146
|
-
/**
|
|
147
|
-
* Select coin id that add up to the given amount as transaction arguments.
|
|
148
|
-
*
|
|
149
|
-
* @param ownerAddress - The address of the owner.
|
|
150
|
-
* @param amount - The amount that including coin decimals.
|
|
151
|
-
* @param coinType - The coin type, default is 0x2::SUI::SUI.
|
|
152
|
-
* @return The selected transaction coin arguments.
|
|
153
|
-
*/
|
|
154
|
-
selectCoins(amount: number, coinType?: string, ownerAddress?: string): Promise<{
|
|
155
|
-
objectId: string;
|
|
156
|
-
digest: string;
|
|
157
|
-
version: string;
|
|
158
|
-
balance: string;
|
|
159
|
-
}[]>;
|
|
160
|
-
/**
|
|
161
|
-
* Merge coins with type `coinType` to dest
|
|
162
|
-
* @param txBlock
|
|
163
|
-
* @param dest
|
|
164
|
-
* @param coinType
|
|
165
|
-
* @param sender
|
|
166
|
-
*/
|
|
167
|
-
mergeSimilarCoins(txBlock: SuiTxBlock, dest: SuiTxArg, coinType: string, sender?: string): Promise<void>;
|
|
168
|
-
/**
|
|
169
|
-
* Get all asset coin names in the obligation record by obligation id.
|
|
170
|
-
*
|
|
171
|
-
* @description
|
|
172
|
-
* This can often be used to determine which assets in an obligation require
|
|
173
|
-
* price updates before interacting with specific instructions of the Scallop contract.
|
|
174
|
-
*
|
|
175
|
-
* @param obligationId - The obligation id.
|
|
176
|
-
* @return Asset coin Names.
|
|
177
|
-
*/
|
|
178
|
-
getObligationCoinNames(obligationId: SuiObjectArg): Promise<SupportAssetCoins[] | undefined>;
|
|
179
|
-
/**
|
|
180
|
-
* Get asset coin price.
|
|
181
|
-
*
|
|
182
|
-
* @description
|
|
183
|
-
* The strategy for obtaining the price is to get it through API first,
|
|
184
|
-
* and then on-chain data if API cannot be retrieved.
|
|
185
|
-
* Currently, we only support obtaining from pyth protocol, other
|
|
186
|
-
* oracles will be supported in the future.
|
|
187
|
-
*
|
|
188
|
-
* @param assetCoinNames - Specific an array of support asset coin name.
|
|
189
|
-
* @return Asset coin price.
|
|
190
|
-
*/
|
|
191
|
-
getCoinPrices(_?: SupportAssetCoins[]): Promise<import("src/types").OptionalKeys<Record<SupportAssetCoins, number>>>;
|
|
192
|
-
/**
|
|
193
|
-
* Convert apr to apy.
|
|
194
|
-
*
|
|
195
|
-
* @param apr The annual percentage rate (APR).
|
|
196
|
-
* @param compoundFrequency How often interest is compounded per year. Default is daily (365 times a year).
|
|
197
|
-
* @return The equivalent annual percentage yield (APY) for the given APR and compounding frequency.
|
|
198
|
-
*/
|
|
199
|
-
parseAprToApy(apr: number, compoundFrequency?: number): number;
|
|
200
|
-
/**
|
|
201
|
-
* Convert apy to apr.
|
|
202
|
-
*
|
|
203
|
-
* @param apr The equivalent annual percentage yield (APY).
|
|
204
|
-
* @param compoundFrequency How often interest is compounded per year. Default is daily (365 times a year).
|
|
205
|
-
* @return The equivalent annual percentage rate (APR) for the given APY and compounding frequency.
|
|
206
|
-
*/
|
|
207
|
-
parseApyToApr(apy: number, compoundFrequency?: number): number;
|
|
208
|
-
/**
|
|
209
|
-
* Give extend lock period to get unlock at in seconds timestamp.
|
|
210
|
-
*
|
|
211
|
-
* @description
|
|
212
|
-
* - When the user without remaining unlock period, If the extended unlock day is not specified,
|
|
213
|
-
* the unlock period will be increased by one day by default.
|
|
214
|
-
* - When the given extended day plus the user's remaining unlock period exceeds the maximum
|
|
215
|
-
* unlock period, the maximum unlock period is used as unlock period.
|
|
216
|
-
*
|
|
217
|
-
* @param extendLockPeriodInDay The extend lock period in day.
|
|
218
|
-
* @param unlockAtInSecondTimestamp The unlock timestamp from veSca object.
|
|
219
|
-
* @return New unlock at in seconds timestamp.
|
|
220
|
-
*/
|
|
221
|
-
getUnlockAt(extendLockPeriodInDay?: number, unlockAtInMillisTimestamp?: number): number;
|
|
222
|
-
/**
|
|
223
|
-
* Get detailed contract address and price id information for supported pool in Scallop
|
|
224
|
-
* @returns Supported pool informations
|
|
225
|
-
*/
|
|
226
|
-
getSupportedPoolAddresses(): PoolAddressInfo[];
|
|
227
|
-
}
|
package/dist/models/suiKit.d.ts
DELETED
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import type { ScallopAddress, ScallopQuery, ScallopUtils } from 'src/models';
|
|
2
|
-
import { BorrowIncentivePoolsQueryInterface, SupportBorrowIncentiveCoins, BorrowIncentivePool, CoinPrices } from 'src/types';
|
|
3
|
-
/**
|
|
4
|
-
* Query borrow incentive pools data using moveCall
|
|
5
|
-
* @param address
|
|
6
|
-
* @returns
|
|
7
|
-
*/
|
|
8
|
-
export declare const queryBorrowIncentivePools: (address: ScallopAddress) => Promise<BorrowIncentivePoolsQueryInterface | undefined>;
|
|
9
|
-
/**
|
|
10
|
-
* Get borrow incentive pools data.
|
|
11
|
-
*
|
|
12
|
-
* @param query - The Scallop query instance.
|
|
13
|
-
* @param borrowIncentiveCoinNames - Specific an array of support borrow incentive coin name.
|
|
14
|
-
* @param indexer - Whether to use indexer.
|
|
15
|
-
* @return Borrow incentive pools data.
|
|
16
|
-
*/
|
|
17
|
-
export declare const getBorrowIncentivePools: (query: ScallopQuery, borrowIncentiveCoinNames?: SupportBorrowIncentiveCoins[], indexer?: boolean, coinPrices?: CoinPrices) => Promise<{
|
|
18
|
-
usdc?: BorrowIncentivePool | undefined;
|
|
19
|
-
sbeth?: BorrowIncentivePool | undefined;
|
|
20
|
-
weth?: BorrowIncentivePool | undefined;
|
|
21
|
-
wusdc?: BorrowIncentivePool | undefined;
|
|
22
|
-
wusdt?: BorrowIncentivePool | undefined;
|
|
23
|
-
sui?: BorrowIncentivePool | undefined;
|
|
24
|
-
afsui?: BorrowIncentivePool | undefined;
|
|
25
|
-
hasui?: BorrowIncentivePool | undefined;
|
|
26
|
-
vsui?: BorrowIncentivePool | undefined;
|
|
27
|
-
sca?: BorrowIncentivePool | undefined;
|
|
28
|
-
}>;
|
|
29
|
-
/**
|
|
30
|
-
* Query borrow incentive accounts data.
|
|
31
|
-
*
|
|
32
|
-
* @param query - The Scallop query instance.
|
|
33
|
-
* @param borrowIncentiveCoinNames - Specific an array of support borrow incentive coin name.
|
|
34
|
-
* @return Borrow incentive accounts data.
|
|
35
|
-
*/
|
|
36
|
-
export declare const queryBorrowIncentiveAccounts: ({ utils, }: {
|
|
37
|
-
utils: ScallopUtils;
|
|
38
|
-
}, obligationId: string, borrowIncentiveCoinNames?: SupportBorrowIncentiveCoins[]) => Promise<{
|
|
39
|
-
usdc?: import("src/types").ParsedBorrowIncentiveAccountData | undefined;
|
|
40
|
-
sbeth?: import("src/types").ParsedBorrowIncentiveAccountData | undefined;
|
|
41
|
-
weth?: import("src/types").ParsedBorrowIncentiveAccountData | undefined;
|
|
42
|
-
wusdc?: import("src/types").ParsedBorrowIncentiveAccountData | undefined;
|
|
43
|
-
wusdt?: import("src/types").ParsedBorrowIncentiveAccountData | undefined;
|
|
44
|
-
sui?: import("src/types").ParsedBorrowIncentiveAccountData | undefined;
|
|
45
|
-
afsui?: import("src/types").ParsedBorrowIncentiveAccountData | undefined;
|
|
46
|
-
hasui?: import("src/types").ParsedBorrowIncentiveAccountData | undefined;
|
|
47
|
-
vsui?: import("src/types").ParsedBorrowIncentiveAccountData | undefined;
|
|
48
|
-
sca?: import("src/types").ParsedBorrowIncentiveAccountData | undefined;
|
|
49
|
-
}>;
|
|
50
|
-
/**
|
|
51
|
-
* Check veSca bind status
|
|
52
|
-
* @param query
|
|
53
|
-
* @param veScaKey
|
|
54
|
-
* @returns
|
|
55
|
-
*/
|
|
56
|
-
export declare const getBindedObligationId: ({ address, }: {
|
|
57
|
-
address: ScallopAddress;
|
|
58
|
-
}, veScaKeyId: string) => Promise<string | null>;
|
|
59
|
-
export declare const getBindedVeScaKey: ({ address, }: {
|
|
60
|
-
address: ScallopAddress;
|
|
61
|
-
}, obligationId: string) => Promise<string | null>;
|
|
@@ -1,167 +0,0 @@
|
|
|
1
|
-
import type { SuiObjectData } from '@mysten/sui/client';
|
|
2
|
-
import type { SuiObjectArg } from '@scallop-io/sui-kit';
|
|
3
|
-
import type { ScallopAddress, ScallopCache, ScallopQuery } from 'src/models';
|
|
4
|
-
import { Market, MarketPool, MarketCollateral, SupportAssetCoins, SupportPoolCoins, SupportCollateralCoins, ObligationQueryInterface, Obligation, SupportMarketCoins, OptionalKeys, CoinPrices } from 'src/types';
|
|
5
|
-
/**
|
|
6
|
-
* Query market data.
|
|
7
|
-
*
|
|
8
|
-
* @description
|
|
9
|
-
* Use inspectTxn call to obtain the data provided in the scallop contract query module.
|
|
10
|
-
*
|
|
11
|
-
* @param query - The Scallop query instance.
|
|
12
|
-
* @param indexer - Whether to use indexer.
|
|
13
|
-
* @return Market data.
|
|
14
|
-
*/
|
|
15
|
-
export declare const queryMarket: (query: ScallopQuery, indexer?: boolean, coinPrices?: CoinPrices) => Promise<Market>;
|
|
16
|
-
/**
|
|
17
|
-
* Get coin market pools data.
|
|
18
|
-
*
|
|
19
|
-
* @description
|
|
20
|
-
* To obtain all market pools information at once, it is recommended to use
|
|
21
|
-
* the `queryMarket` method to reduce time consumption.
|
|
22
|
-
*
|
|
23
|
-
* @param query - The Scallop query instance.
|
|
24
|
-
* @param coinNames - Specific an array of support pool coin name.
|
|
25
|
-
* @param indexer - Whether to use indexer.
|
|
26
|
-
* @return Market pools data.
|
|
27
|
-
*/
|
|
28
|
-
export declare const getMarketPools: (query: ScallopQuery, poolCoinNames?: SupportPoolCoins[], indexer?: boolean, coinPrices?: CoinPrices) => Promise<{
|
|
29
|
-
usdc?: MarketPool | undefined;
|
|
30
|
-
sbeth?: MarketPool | undefined;
|
|
31
|
-
weth?: MarketPool | undefined;
|
|
32
|
-
wbtc?: MarketPool | undefined;
|
|
33
|
-
wusdc?: MarketPool | undefined;
|
|
34
|
-
wusdt?: MarketPool | undefined;
|
|
35
|
-
sui?: MarketPool | undefined;
|
|
36
|
-
wapt?: MarketPool | undefined;
|
|
37
|
-
wsol?: MarketPool | undefined;
|
|
38
|
-
cetus?: MarketPool | undefined;
|
|
39
|
-
afsui?: MarketPool | undefined;
|
|
40
|
-
hasui?: MarketPool | undefined;
|
|
41
|
-
vsui?: MarketPool | undefined;
|
|
42
|
-
sca?: MarketPool | undefined;
|
|
43
|
-
}>;
|
|
44
|
-
/**
|
|
45
|
-
* Get market pool data.
|
|
46
|
-
*
|
|
47
|
-
* @param query - The Scallop query instance.
|
|
48
|
-
* @param poolCoinName - Specific support pool coin name.
|
|
49
|
-
* @param indexer - Whether to use indexer.
|
|
50
|
-
* @param marketObject - The market object.
|
|
51
|
-
* @param coinPrice - The coin price.
|
|
52
|
-
* @returns Market pool data.
|
|
53
|
-
*/
|
|
54
|
-
export declare const getMarketPool: (query: ScallopQuery, poolCoinName: SupportPoolCoins, indexer?: boolean, marketObject?: SuiObjectData | null, coinPrice?: number) => Promise<MarketPool | undefined>;
|
|
55
|
-
/**
|
|
56
|
-
* Get coin market collaterals data.
|
|
57
|
-
*
|
|
58
|
-
* @description
|
|
59
|
-
* To obtain all market collaterals information at once, it is recommended to use
|
|
60
|
-
* the `queryMarket` method to reduce time consumption.
|
|
61
|
-
*
|
|
62
|
-
* @param query - The Scallop query instance.
|
|
63
|
-
* @param collateralCoinNames - Specific an array of support collateral coin name.
|
|
64
|
-
* @param indexer - Whether to use indexer.
|
|
65
|
-
* @return Market collaterals data.
|
|
66
|
-
*/
|
|
67
|
-
export declare const getMarketCollaterals: (query: ScallopQuery, collateralCoinNames?: SupportCollateralCoins[], indexer?: boolean) => Promise<{
|
|
68
|
-
usdc?: MarketCollateral | undefined;
|
|
69
|
-
sbeth?: MarketCollateral | undefined;
|
|
70
|
-
weth?: MarketCollateral | undefined;
|
|
71
|
-
wbtc?: MarketCollateral | undefined;
|
|
72
|
-
wusdc?: MarketCollateral | undefined;
|
|
73
|
-
wusdt?: MarketCollateral | undefined;
|
|
74
|
-
sui?: MarketCollateral | undefined;
|
|
75
|
-
wapt?: MarketCollateral | undefined;
|
|
76
|
-
wsol?: MarketCollateral | undefined;
|
|
77
|
-
cetus?: MarketCollateral | undefined;
|
|
78
|
-
afsui?: MarketCollateral | undefined;
|
|
79
|
-
hasui?: MarketCollateral | undefined;
|
|
80
|
-
vsui?: MarketCollateral | undefined;
|
|
81
|
-
sca?: MarketCollateral | undefined;
|
|
82
|
-
}>;
|
|
83
|
-
/**
|
|
84
|
-
* Get market collateral data.
|
|
85
|
-
*
|
|
86
|
-
* @param query - The Scallop query instance.
|
|
87
|
-
* @param collateralCoinName - Specific support collateral coin name.
|
|
88
|
-
* @param indexer - Whether to use indexer.
|
|
89
|
-
* @param marketObject - The market object.
|
|
90
|
-
* @param coinPrice - The coin price.
|
|
91
|
-
* @returns Market collateral data.
|
|
92
|
-
*/
|
|
93
|
-
export declare const getMarketCollateral: (query: ScallopQuery, collateralCoinName: SupportCollateralCoins, indexer?: boolean, marketObject?: SuiObjectData | null, coinPrice?: number) => Promise<MarketCollateral | undefined>;
|
|
94
|
-
/**
|
|
95
|
-
* Query all owned obligations.
|
|
96
|
-
*
|
|
97
|
-
* @param query - The Scallop query instance.
|
|
98
|
-
* @param ownerAddress - The owner address.
|
|
99
|
-
* @return Owned obligations.
|
|
100
|
-
*/
|
|
101
|
-
export declare const getObligations: ({ address, }: {
|
|
102
|
-
address: ScallopAddress;
|
|
103
|
-
}, ownerAddress: string) => Promise<Obligation[]>;
|
|
104
|
-
/**
|
|
105
|
-
* Query obligation locked status.
|
|
106
|
-
*
|
|
107
|
-
* @param query - The Scallop query instance.
|
|
108
|
-
* @param obligation - The obligation id or the obligation object.
|
|
109
|
-
* @return Obligation locked status.
|
|
110
|
-
*/
|
|
111
|
-
export declare const getObligationLocked: (cache: ScallopCache, obligation: string | SuiObjectData) => Promise<boolean>;
|
|
112
|
-
/**
|
|
113
|
-
* Query obligation data.
|
|
114
|
-
*
|
|
115
|
-
* @description
|
|
116
|
-
* Use inspectTxn call to obtain the data provided in the scallop contract query module.
|
|
117
|
-
*
|
|
118
|
-
* @param query - The Scallop query instance.
|
|
119
|
-
* @param obligationId - The obligation id.
|
|
120
|
-
* @return Obligation data.
|
|
121
|
-
*/
|
|
122
|
-
export declare const queryObligation: ({ address, }: {
|
|
123
|
-
address: ScallopAddress;
|
|
124
|
-
}, obligationId: SuiObjectArg) => Promise<ObligationQueryInterface | undefined>;
|
|
125
|
-
/**
|
|
126
|
-
* Query all owned coin amount.
|
|
127
|
-
*
|
|
128
|
-
* @param query - The Scallop query instance.
|
|
129
|
-
* @param assetCoinNames - Specific an array of support asset coin name.
|
|
130
|
-
* @param ownerAddress - The owner address.
|
|
131
|
-
* @return All owned coin amounts.
|
|
132
|
-
*/
|
|
133
|
-
export declare const getCoinAmounts: (query: ScallopQuery, assetCoinNames?: SupportAssetCoins[], ownerAddress?: string) => Promise<OptionalKeys<Record<SupportAssetCoins, number>>>;
|
|
134
|
-
/**
|
|
135
|
-
* Query owned coin amount.
|
|
136
|
-
*
|
|
137
|
-
* @param query - The Scallop query instance.
|
|
138
|
-
* @param assetCoinName - Specific support asset coin name.
|
|
139
|
-
* @param ownerAddress - The owner address.
|
|
140
|
-
* @return Owned coin amount.
|
|
141
|
-
*/
|
|
142
|
-
export declare const getCoinAmount: (query: ScallopQuery, assetCoinName: SupportAssetCoins, ownerAddress?: string) => Promise<number>;
|
|
143
|
-
/**
|
|
144
|
-
* Query all owned market coins (sCoin) amount.
|
|
145
|
-
*
|
|
146
|
-
* @param query - The Scallop query instance.
|
|
147
|
-
* @param marketCoinNames - Specific an array of support market coin name.
|
|
148
|
-
* @param ownerAddress - The owner address.
|
|
149
|
-
* @return All owned market coins amount.
|
|
150
|
-
*/
|
|
151
|
-
export declare const getMarketCoinAmounts: (query: ScallopQuery, marketCoinNames?: SupportMarketCoins[], ownerAddress?: string) => Promise<OptionalKeys<Record<SupportMarketCoins, number>>>;
|
|
152
|
-
/**
|
|
153
|
-
* Query owned market coin (sCoin) amount.
|
|
154
|
-
*
|
|
155
|
-
* @param query - The Scallop query instance.
|
|
156
|
-
* @param marketCoinNames - Specific support market coin name.
|
|
157
|
-
* @param ownerAddress - The owner address.
|
|
158
|
-
* @return Owned market coin amount.
|
|
159
|
-
*/
|
|
160
|
-
export declare const getMarketCoinAmount: (query: ScallopQuery, marketCoinName: SupportMarketCoins, ownerAddress?: string) => Promise<number>;
|
|
161
|
-
/**
|
|
162
|
-
* Get flashloan fee for specific asset
|
|
163
|
-
* @param query - The Scallop query instance.
|
|
164
|
-
* @param assetNames - Specific an array of support pool coin name.
|
|
165
|
-
* @returns Record of asset name to flashloan fee in decimal
|
|
166
|
-
*/
|
|
167
|
-
export declare const getFlashLoanFees: (query: ScallopQuery, assetNames: SupportPoolCoins[]) => Promise<Record<SupportPoolCoins, number>>;
|
package/dist/queries/index.d.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
export * from './borrowIncentiveQuery';
|
|
2
|
-
export * from './coreQuery';
|
|
3
|
-
export * from './isolatedAssetQuery';
|
|
4
|
-
export * from './loyaltyProgramQuery';
|
|
5
|
-
export * from './portfolioQuery';
|
|
6
|
-
export * from './priceQuery';
|
|
7
|
-
export * from './referralQuery';
|
|
8
|
-
export * from './sCoinQuery';
|
|
9
|
-
export * from './spoolQuery';
|
|
10
|
-
export * from './supplyLimitQuery';
|
|
11
|
-
export * from './vescaQuery';
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { ScallopAddress, ScallopUtils } from 'src/models';
|
|
2
|
-
import { SupportPoolCoins } from 'src/types';
|
|
3
|
-
/**
|
|
4
|
-
* Return list of isolated assets coin types
|
|
5
|
-
* @param utils ScallopUtils
|
|
6
|
-
* @returns list of isolated assets coin types
|
|
7
|
-
*/
|
|
8
|
-
export declare const getIsolatedAssets: (address: ScallopAddress) => Promise<string[]>;
|
|
9
|
-
/**
|
|
10
|
-
* Check if the coin type is an isolated asset
|
|
11
|
-
* @param coinName coin name
|
|
12
|
-
* @returns true if the coin type is an isolated asset
|
|
13
|
-
*/
|
|
14
|
-
export declare const isIsolatedAsset: (utils: ScallopUtils, coinName: SupportPoolCoins) => Promise<boolean>;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { SuiObjectData } from '@mysten/sui/client';
|
|
2
|
-
import { ScallopQuery } from 'src/models';
|
|
3
|
-
import { LoyaltyProgramInfo } from 'src/types';
|
|
4
|
-
/**
|
|
5
|
-
* Get user's loyalty program information and pending rewards if exists
|
|
6
|
-
* @param query
|
|
7
|
-
* @param veScaKey
|
|
8
|
-
* @returns
|
|
9
|
-
*/
|
|
10
|
-
export declare const getLoyaltyProgramInformations: (query: ScallopQuery, veScaKey?: string | SuiObjectData) => Promise<LoyaltyProgramInfo | null>;
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
import type { ScallopQuery } from 'src/models';
|
|
2
|
-
import { Market, SupportPoolCoins, MarketPool, Spool, StakeAccount, Lending, ObligationAccount, CoinAmounts, CoinPrices, TotalValueLocked } from 'src/types';
|
|
3
|
-
/**
|
|
4
|
-
* Get user lending infomation for specific pools.
|
|
5
|
-
*
|
|
6
|
-
* @param query - The ScallopQuery instance.
|
|
7
|
-
* @param poolCoinNames - Specific an array of support pool coin name.
|
|
8
|
-
* @param ownerAddress - The owner address.
|
|
9
|
-
* @param indexer - Whether to use indexer.
|
|
10
|
-
* @return User lending infomation for specific pools.
|
|
11
|
-
*/
|
|
12
|
-
export declare const getLendings: (query: ScallopQuery, poolCoinNames?: SupportPoolCoins[], ownerAddress?: string, indexer?: boolean) => Promise<{
|
|
13
|
-
usdc?: Lending | undefined;
|
|
14
|
-
sbeth?: Lending | undefined;
|
|
15
|
-
weth?: Lending | undefined;
|
|
16
|
-
wbtc?: Lending | undefined;
|
|
17
|
-
wusdc?: Lending | undefined;
|
|
18
|
-
wusdt?: Lending | undefined;
|
|
19
|
-
sui?: Lending | undefined;
|
|
20
|
-
wapt?: Lending | undefined;
|
|
21
|
-
wsol?: Lending | undefined;
|
|
22
|
-
cetus?: Lending | undefined;
|
|
23
|
-
afsui?: Lending | undefined;
|
|
24
|
-
hasui?: Lending | undefined;
|
|
25
|
-
vsui?: Lending | undefined;
|
|
26
|
-
sca?: Lending | undefined;
|
|
27
|
-
}>;
|
|
28
|
-
/**
|
|
29
|
-
* Get user lending infomation for specific pool.
|
|
30
|
-
*
|
|
31
|
-
* @description
|
|
32
|
-
* The lending information includes the spool information extended by it.
|
|
33
|
-
*
|
|
34
|
-
* @param query - The ScallopQuery instance.
|
|
35
|
-
* @param poolCoinName - Specific support coin name.
|
|
36
|
-
* @param ownerAddress - The owner address.
|
|
37
|
-
* @param indexer - Whether to use indexer.
|
|
38
|
-
* @param marketPool - The market pool data.
|
|
39
|
-
* @param spool - The spool data.
|
|
40
|
-
* @param stakeAccounts - The stake accounts data.
|
|
41
|
-
* @param coinAmount - The coin amount.
|
|
42
|
-
* @param marketCoinAmount - The market coin amount.
|
|
43
|
-
* @return User lending infomation for specific pool.
|
|
44
|
-
*/
|
|
45
|
-
export declare const getLending: (query: ScallopQuery, poolCoinName: SupportPoolCoins, ownerAddress?: string, indexer?: boolean, marketPool?: MarketPool, spool?: Spool, stakeAccounts?: StakeAccount[], coinAmount?: number, marketCoinAmount?: number, coinPrice?: number, sCoinAmount?: number) => Promise<Lending>;
|
|
46
|
-
/**
|
|
47
|
-
* Get all obligation accounts data.
|
|
48
|
-
*
|
|
49
|
-
* @param query - The Scallop query instance.
|
|
50
|
-
* @param ownerAddress - The owner address.
|
|
51
|
-
* @param indexer - Whether to use indexer.
|
|
52
|
-
* @return All obligation accounts data.
|
|
53
|
-
*/
|
|
54
|
-
export declare const getObligationAccounts: (query: ScallopQuery, ownerAddress?: string, indexer?: boolean) => Promise<{
|
|
55
|
-
[x: string]: ObligationAccount | undefined;
|
|
56
|
-
}>;
|
|
57
|
-
/**
|
|
58
|
-
* Get obligation account data.
|
|
59
|
-
*
|
|
60
|
-
* @param query - The Scallop query instance.
|
|
61
|
-
* @param obligationId - The obligation id.
|
|
62
|
-
* @param indexer - Whether to use indexer.
|
|
63
|
-
* @return Obligation account data.
|
|
64
|
-
*/
|
|
65
|
-
export declare const getObligationAccount: (query: ScallopQuery, obligationId: string, ownerAddress?: string, indexer?: boolean, market?: Market, coinPrices?: CoinPrices, coinAmounts?: CoinAmounts) => Promise<ObligationAccount>;
|
|
66
|
-
/**
|
|
67
|
-
* Get total value locked data.
|
|
68
|
-
*
|
|
69
|
-
* @param query - The Scallop query instance.
|
|
70
|
-
* @param indexer - Whether to use indexer.
|
|
71
|
-
* @return Total value locked data.
|
|
72
|
-
*/
|
|
73
|
-
export declare const getTotalValueLocked: (query: ScallopQuery, indexer?: boolean) => Promise<TotalValueLocked>;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { SuiObjectData } from '@mysten/sui/client';
|
|
2
|
-
import type { ScallopAddress } from 'src/models';
|
|
3
|
-
import { SupportAssetCoins } from 'src/types';
|
|
4
|
-
/**
|
|
5
|
-
* Get price from pyth fee object.
|
|
6
|
-
*
|
|
7
|
-
* @param query - The Scallop query instance.
|
|
8
|
-
* @param assetCoinName - Specific support asset coin name.
|
|
9
|
-
* @return Asset coin price.
|
|
10
|
-
*/
|
|
11
|
-
export declare const getPythPrice: ({ address, }: {
|
|
12
|
-
address: ScallopAddress;
|
|
13
|
-
}, assetCoinName: SupportAssetCoins, priceFeedObject?: SuiObjectData | null) => Promise<number>;
|
|
14
|
-
export declare const getPythPrices: ({ address, }: {
|
|
15
|
-
address: ScallopAddress;
|
|
16
|
-
}, assetCoinNames: SupportAssetCoins[]) => Promise<Record<SupportAssetCoins, number>>;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { ScallopAddress } from 'src/models';
|
|
2
|
-
/**
|
|
3
|
-
* Query the veScaKeyId from the referral bindings table using the borrower address
|
|
4
|
-
* @param query
|
|
5
|
-
* @returns
|
|
6
|
-
*/
|
|
7
|
-
export declare const queryVeScaKeyIdFromReferralBindings: (address: ScallopAddress, refereeAddress: string) => Promise<string | null>;
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { ScallopQuery, ScallopUtils } from 'src/models';
|
|
2
|
-
import { OptionalKeys, SupportSCoin, sCoinBalance } from 'src/types';
|
|
3
|
-
/**
|
|
4
|
-
* Get total supply of sCoin
|
|
5
|
-
* @param query
|
|
6
|
-
* @param sCoinName
|
|
7
|
-
* @returns `number`
|
|
8
|
-
*/
|
|
9
|
-
export declare const getSCoinTotalSupply: ({ utils, }: {
|
|
10
|
-
utils: ScallopUtils;
|
|
11
|
-
}, sCoinName: SupportSCoin) => Promise<sCoinBalance>;
|
|
12
|
-
/**
|
|
13
|
-
* Query all owned sCoin amount.
|
|
14
|
-
*
|
|
15
|
-
* @param query - The Scallop query instance.
|
|
16
|
-
* @param sCoinNames - Specific an array of support sCoin name.
|
|
17
|
-
* @param ownerAddress - The owner address.
|
|
18
|
-
* @return All owned sCoins amount.
|
|
19
|
-
*/
|
|
20
|
-
export declare const getSCoinAmounts: ({ utils, }: {
|
|
21
|
-
utils: ScallopUtils;
|
|
22
|
-
}, sCoinNames?: SupportSCoin[], ownerAddress?: string) => Promise<OptionalKeys<Record<"susdc" | "ssbeth" | "sweth" | "swbtc" | "swusdc" | "swusdt" | "ssui" | "swsol" | "scetus" | "safsui" | "shasui" | "svsui" | "ssca", number>>>;
|
|
23
|
-
/**
|
|
24
|
-
* Query owned sCoin amount.
|
|
25
|
-
*
|
|
26
|
-
* @param query - The Scallop query instance.
|
|
27
|
-
* @param sCoinNames - Specific support sCoin name.
|
|
28
|
-
* @param ownerAddress - The owner address.
|
|
29
|
-
* @return Owned sCoin amount.
|
|
30
|
-
*/
|
|
31
|
-
export declare const getSCoinAmount: ({ utils, }: {
|
|
32
|
-
utils: ScallopUtils;
|
|
33
|
-
}, sCoinName: SupportSCoin, ownerAddress?: string) => Promise<number>;
|
|
34
|
-
/**
|
|
35
|
-
* Get swap rate from sCoin A to sCoin B.
|
|
36
|
-
* @param fromSCoin
|
|
37
|
-
* @param toSCoin
|
|
38
|
-
* @param underlyingCoinPrice - The price of the underlying coin. For example, if fromSCoin is sSUI and toSCoin is sUSDC, then underlyingCoinPrice represents the price of 1 SUI in USDC.
|
|
39
|
-
* @returns number
|
|
40
|
-
*/
|
|
41
|
-
export declare const getSCoinSwapRate: (query: ScallopQuery, fromSCoin: SupportSCoin, toSCoin: SupportSCoin, underlyingCoinPrice?: number) => Promise<number>;
|