@scallop-io/sui-scallop-sdk 2.2.3-pyth-sponsored-transaction-alpha.1 → 2.3.0-lst-x-oracle-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/address-CW2IpaLn.d.ts +165 -0
- package/dist/chunk-E3URAUAC.js +25 -0
- package/dist/chunk-YA77R5GT.mjs +5 -0
- package/dist/constants/index.d.mts +262 -0
- package/dist/constants/index.d.ts +262 -0
- package/dist/constants/index.js +86 -0
- package/dist/constants/index.mjs +5 -0
- package/dist/index.d.mts +11 -3242
- package/dist/index.d.ts +11 -3242
- package/dist/index.js +0 -47
- package/dist/index.mjs +0 -14
- package/dist/models/index.d.mts +393 -0
- package/dist/models/index.d.ts +393 -0
- package/dist/models/index.js +34 -0
- package/dist/models/index.mjs +16 -0
- package/dist/queryKeys-AaZqDYle.d.ts +43 -0
- package/dist/scallopUtils-BZLZd2z8.d.ts +2404 -0
- package/dist/types/index.d.mts +9 -0
- package/dist/types/index.d.ts +9 -0
- package/dist/types/index.js +2 -0
- package/dist/types/index.mjs +1 -0
- package/package.json +31 -4
- package/src/builders/borrowIncentiveBuilder.ts +2 -2
- package/src/builders/coreBuilder.ts +5 -14
- package/src/builders/index.ts +2 -2
- package/src/builders/oracles/error.ts +29 -0
- package/src/builders/oracles/index.ts +114 -365
- package/src/builders/oracles/oraclePackageRegistry.ts +323 -0
- package/src/builders/oracles/priceFeedUpdater.ts +112 -0
- package/src/builders/oracles/priceUpdateRequester.ts +50 -0
- package/src/builders/oracles/xOracleUpdateStrategy.ts +178 -0
- package/src/builders/oracles/xOracleUpdater.ts +160 -0
- package/src/builders/vescaBuilder.ts +2 -2
- package/src/constants/api.ts +2 -0
- package/src/constants/common.ts +0 -3
- package/src/constants/index.ts +2 -1
- package/src/constants/package.ts +14 -0
- package/src/constants/testAddress.ts +190 -105
- package/src/constants/xoracle.ts +8 -2
- package/src/index.ts +2 -12
- package/src/models/index.ts +2 -1
- package/src/models/interface.ts +6 -6
- package/src/models/scallopAddress.ts +24 -4
- package/src/models/scallopBuilder.ts +4 -4
- package/src/models/scallopClient.ts +1 -1
- package/src/models/scallopConstants.ts +2 -2
- package/src/models/scallopIndexer.ts +3 -2
- package/src/models/scallopQuery.ts +52 -36
- package/src/models/scallopQueryClient.ts +1 -1
- package/src/models/scallopSuiKit.ts +1 -1
- package/src/models/scallopUtils.ts +5 -8
- package/src/queries/borrowIncentiveQuery.ts +2 -3
- package/src/queries/coreQuery.ts +2 -3
- package/src/queries/index.ts +4 -3
- package/src/queries/loyaltyProgramQuery.ts +1 -1
- package/src/queries/portfolioQuery.ts +13 -13
- package/src/queries/sCoinQuery.ts +2 -2
- package/src/queries/spoolQuery.ts +8 -8
- package/src/queries/vescaQuery.ts +2 -2
- package/src/queries/xOracleQuery.ts +20 -3
- package/src/types/address.ts +85 -47
- package/src/types/builder/core.ts +2 -4
- package/src/types/constant/index.ts +2 -1
- package/src/types/constant/package.ts +3 -0
- package/src/types/constant/xOracle.ts +10 -7
- package/src/types/query/index.ts +0 -1
- package/src/utils/builder.ts +1 -1
- package/src/utils/index.ts +2 -2
- package/src/utils/query.ts +6 -6
- package/src/utils/util.ts +1 -1
- package/src/builders/oracles/pyth.ts +0 -52
- package/src/queries/ownerQuery.ts +0 -32
- package/src/types/constant/enum.ts +0 -64
- package/src/types/query/sCoin.ts +0 -1
|
@@ -0,0 +1,2404 @@
|
|
|
1
|
+
import * as _tanstack_query_core from '@tanstack/query-core';
|
|
2
|
+
import { QueryClient, QueryClientConfig, QueryKey } from '@tanstack/query-core';
|
|
3
|
+
import * as _scallop_io_sui_kit from '@scallop-io/sui-kit';
|
|
4
|
+
import { NetworkType, SuiKit, Transaction, SuiTxBlock, DerivePathParams, SuiObjectArg, SuiKitParams, SuiTxArg, SuiAddressArg, TransactionResult as TransactionResult$1, SuiVecTxArg, SuiAmountsArg } from '@scallop-io/sui-kit';
|
|
5
|
+
import { A as AddressesInterface, l as AddressStringPath, e as xOracleRules } from './address-CW2IpaLn.js';
|
|
6
|
+
import { AxiosInstance, AxiosResponse, AxiosRequestConfig } from 'axios';
|
|
7
|
+
import * as _mysten_sui_dist_cjs_client from '@mysten/sui/dist/cjs/client';
|
|
8
|
+
import { SuiObjectRef as SuiObjectRef$1, SuiObjectData as SuiObjectData$1 } from '@mysten/sui/dist/cjs/client';
|
|
9
|
+
import { SuiObjectRef, SuiObjectDataOptions, SuiObjectResponse, SuiObjectData, GetOwnedObjectsParams, GetDynamicFieldsParams, DynamicFieldPage, GetDynamicFieldObjectParams, CoinBalance, GetBalanceParams, DevInspectResults, SuiTransactionBlockResponse } from '@mysten/sui/client';
|
|
10
|
+
import { Argument, TransactionResult, Transaction as Transaction$1, TransactionObjectArgument } from '@mysten/sui/transactions';
|
|
11
|
+
|
|
12
|
+
type PoolAddress = {
|
|
13
|
+
coinName: string;
|
|
14
|
+
symbol: string;
|
|
15
|
+
coinType: string;
|
|
16
|
+
coinMetadataId: string;
|
|
17
|
+
decimals: number;
|
|
18
|
+
isIsolated: boolean;
|
|
19
|
+
pythFeed?: string;
|
|
20
|
+
pythFeedObjectId?: string;
|
|
21
|
+
lendingPoolAddress?: string;
|
|
22
|
+
borrowDynamic?: string;
|
|
23
|
+
interestModel?: string;
|
|
24
|
+
borrowFeeKey?: string;
|
|
25
|
+
flashloanFeeObject?: string;
|
|
26
|
+
coinGeckoId?: string;
|
|
27
|
+
collateralPoolAddress?: string;
|
|
28
|
+
riskModel?: string;
|
|
29
|
+
supplyLimitKey?: string;
|
|
30
|
+
borrowLimitKey?: string;
|
|
31
|
+
sCoinType?: string;
|
|
32
|
+
sCoinName?: string;
|
|
33
|
+
sCoinSymbol?: string;
|
|
34
|
+
sCoinMetadataId?: string;
|
|
35
|
+
sCoinTreasury?: string;
|
|
36
|
+
isolatedAssetKey: string;
|
|
37
|
+
spool?: string;
|
|
38
|
+
spoolReward?: string;
|
|
39
|
+
spoolName?: string;
|
|
40
|
+
};
|
|
41
|
+
type Whitelist = {
|
|
42
|
+
lending: Set<string>;
|
|
43
|
+
borrowing: Set<string>;
|
|
44
|
+
collateral: Set<string>;
|
|
45
|
+
packages: Set<string>;
|
|
46
|
+
spool: Set<string>;
|
|
47
|
+
scoin: Set<string>;
|
|
48
|
+
suiBridge: Set<string>;
|
|
49
|
+
wormhole: Set<string>;
|
|
50
|
+
oracles: Set<string>;
|
|
51
|
+
borrowIncentiveRewards: Set<string>;
|
|
52
|
+
rewardsAsPoint: Set<string>;
|
|
53
|
+
pythEndpoints: Set<string>;
|
|
54
|
+
deprecated: Set<string>;
|
|
55
|
+
emerging: Set<string>;
|
|
56
|
+
};
|
|
57
|
+
type CoinWrappedType = {
|
|
58
|
+
from: string;
|
|
59
|
+
type: string;
|
|
60
|
+
} | undefined;
|
|
61
|
+
|
|
62
|
+
type ScallopQueryClientParams = {
|
|
63
|
+
queryClient?: QueryClient;
|
|
64
|
+
queryClientConfig?: QueryClientConfig;
|
|
65
|
+
};
|
|
66
|
+
declare class ScallopQueryClient {
|
|
67
|
+
private _queryClient;
|
|
68
|
+
constructor(params?: ScallopQueryClientParams);
|
|
69
|
+
get queryClient(): QueryClient;
|
|
70
|
+
set queryClient(queryClient: QueryClient);
|
|
71
|
+
get defaultQueryClientConfig(): {
|
|
72
|
+
defaultOptions: {
|
|
73
|
+
queries: {
|
|
74
|
+
staleTime: number;
|
|
75
|
+
gcTime: number;
|
|
76
|
+
};
|
|
77
|
+
};
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
type ScallopAxiosParams = {
|
|
82
|
+
baseUrl?: string;
|
|
83
|
+
axiosInstance?: AxiosInstance;
|
|
84
|
+
axiosTimeout?: number;
|
|
85
|
+
} & ScallopQueryClientParams;
|
|
86
|
+
declare class ScallopAxios extends ScallopQueryClient {
|
|
87
|
+
readonly axiosInstance: AxiosInstance;
|
|
88
|
+
constructor(params?: ScallopAxiosParams);
|
|
89
|
+
post<T = any, R = AxiosResponse<T>, D = any>(url: string, data?: D, config?: AxiosRequestConfig<D>): Promise<R>;
|
|
90
|
+
post<T = any, R = AxiosResponse<T>, D = any>(url: string, queryKey: QueryKey, data?: D, config?: AxiosRequestConfig<D>): Promise<R>;
|
|
91
|
+
get<T = any, R = AxiosResponse<T>, D = any>(url: string, config?: AxiosRequestConfig<D>): Promise<R>;
|
|
92
|
+
get<T = any, R = AxiosResponse<T>, D = any>(url: string, queryKey: QueryKey, config?: AxiosRequestConfig<D>): Promise<R>;
|
|
93
|
+
put<T = any, R = AxiosResponse<T>, D = any>(url: string, data?: D, config?: AxiosRequestConfig<D>): Promise<R>;
|
|
94
|
+
put<T = any, R = AxiosResponse<T>, D = any>(url: string, queryKey: QueryKey, data?: D, config?: AxiosRequestConfig<D>): Promise<R>;
|
|
95
|
+
delete<T = any, R = AxiosResponse<T>, D = any>(url: string, config?: AxiosRequestConfig<D>): Promise<R>;
|
|
96
|
+
delete<T = any, R = AxiosResponse<T>, D = any>(url: string, queryKey: QueryKey, config?: AxiosRequestConfig<D>): Promise<R>;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
type ScallopAddressParams = {
|
|
100
|
+
addressId?: string;
|
|
101
|
+
urls?: {
|
|
102
|
+
addresses?: string[];
|
|
103
|
+
};
|
|
104
|
+
auth?: string;
|
|
105
|
+
network?: NetworkType;
|
|
106
|
+
forceAddressesInterface?: Partial<Record<NetworkType, AddressesInterface>>;
|
|
107
|
+
defaultValues?: {
|
|
108
|
+
addresses?: Partial<Record<NetworkType, AddressesInterface>>;
|
|
109
|
+
};
|
|
110
|
+
} & ScallopAxiosParams;
|
|
111
|
+
declare class ScallopAddress {
|
|
112
|
+
readonly params: ScallopAddressParams;
|
|
113
|
+
private currentAddresses?;
|
|
114
|
+
private addressId?;
|
|
115
|
+
private network;
|
|
116
|
+
private auth;
|
|
117
|
+
readonly scallopAxios: ScallopAxios;
|
|
118
|
+
private readonly addressMap;
|
|
119
|
+
private readonly defaultParamValues;
|
|
120
|
+
constructor(params?: ScallopAddressParams);
|
|
121
|
+
private initializeForcedAddresses;
|
|
122
|
+
get axiosClient(): ScallopAxios;
|
|
123
|
+
get queryClient(): _tanstack_query_core.QueryClient;
|
|
124
|
+
get defaultValues(): {
|
|
125
|
+
addresses?: Partial<Record<NetworkType, AddressesInterface>>;
|
|
126
|
+
} | undefined;
|
|
127
|
+
getId(): string | undefined;
|
|
128
|
+
/**
|
|
129
|
+
* Get the address at the provided path.
|
|
130
|
+
*
|
|
131
|
+
* @param path - The path of the address to get.
|
|
132
|
+
* @return The address at the provided path.
|
|
133
|
+
*/
|
|
134
|
+
get(path: AddressStringPath): any;
|
|
135
|
+
/**
|
|
136
|
+
* Sets the address for the specified path, it does not interact with the API.
|
|
137
|
+
*
|
|
138
|
+
* @param path - The path of the address to set.
|
|
139
|
+
* @param address - The address be setted to the tartget path.
|
|
140
|
+
* @return The addresses.
|
|
141
|
+
*/
|
|
142
|
+
set(path: AddressStringPath, address: string): AddressesInterface | undefined;
|
|
143
|
+
/**
|
|
144
|
+
* Synchronize the specified network addresses from the addresses map to the
|
|
145
|
+
* current addresses and change the default network to specified network.
|
|
146
|
+
*
|
|
147
|
+
* @param network - Specifies which network's addresses you want to get.
|
|
148
|
+
* @return Current addresses.
|
|
149
|
+
*/
|
|
150
|
+
switchCurrentAddresses(network: NetworkType): AddressesInterface | undefined;
|
|
151
|
+
/**
|
|
152
|
+
* Get the addresses, If `network` is not provided, returns the current
|
|
153
|
+
* addresses or the default network addresses in the addresses map.
|
|
154
|
+
*
|
|
155
|
+
* @param network - Specifies which network's addresses you want to get.
|
|
156
|
+
*/
|
|
157
|
+
getAddresses(network?: NetworkType): AddressesInterface | undefined;
|
|
158
|
+
/**
|
|
159
|
+
* Set the addresses into addresses map. If the specified network is the same
|
|
160
|
+
* as the current network, the current addresses will be updated at the same time.
|
|
161
|
+
*
|
|
162
|
+
* @param addresses - The addresses be setted to the tartget network.
|
|
163
|
+
* @param network - Specifies which network's addresses you want to set.
|
|
164
|
+
* @return The addresses.
|
|
165
|
+
*/
|
|
166
|
+
setAddresses(addresses: AddressesInterface, network?: NetworkType): void;
|
|
167
|
+
/**
|
|
168
|
+
* Get all addresses.
|
|
169
|
+
*
|
|
170
|
+
* @return All addresses.
|
|
171
|
+
*/
|
|
172
|
+
getAllAddresses(): {
|
|
173
|
+
[k: string]: AddressesInterface;
|
|
174
|
+
};
|
|
175
|
+
/**
|
|
176
|
+
* Create a new addresses through the API and synchronize it back to the
|
|
177
|
+
* instance.
|
|
178
|
+
*
|
|
179
|
+
* @description
|
|
180
|
+
* If the `network` is not specified, the mainnet is used by default.
|
|
181
|
+
* If no `addresses` from instance or parameter is provided, an addresses with
|
|
182
|
+
* all empty strings is created by default.
|
|
183
|
+
*
|
|
184
|
+
* This function only allows for one addresses to be input into a specific network
|
|
185
|
+
* at a time, and does not provide an addresses map for setting addresses
|
|
186
|
+
* across all networks at once.
|
|
187
|
+
*
|
|
188
|
+
* @param params.addresses - The addresses be setted to the tartget network.
|
|
189
|
+
* @param params.network - Specifies which network's addresses you want to set.
|
|
190
|
+
* @param params.auth - The authentication API key.
|
|
191
|
+
* @param params.memo - Add memo to the addresses created in the API.
|
|
192
|
+
* @return All addresses.
|
|
193
|
+
*/
|
|
194
|
+
create(params?: {
|
|
195
|
+
addresses?: AddressesInterface | undefined;
|
|
196
|
+
network?: NetworkType | undefined;
|
|
197
|
+
auth?: string | undefined;
|
|
198
|
+
memo?: string | undefined;
|
|
199
|
+
}): Promise<{
|
|
200
|
+
[k: string]: AddressesInterface;
|
|
201
|
+
}>;
|
|
202
|
+
protected readApi<T>({ url, queryKey, config, }: {
|
|
203
|
+
url: string;
|
|
204
|
+
queryKey: QueryKey;
|
|
205
|
+
config?: AxiosRequestConfig;
|
|
206
|
+
}): Promise<T>;
|
|
207
|
+
/**
|
|
208
|
+
* Read and synchronizes all addresses from the API into instance.
|
|
209
|
+
*
|
|
210
|
+
* @param id - The id of the addresses to get.
|
|
211
|
+
* @return All addresses.
|
|
212
|
+
*/
|
|
213
|
+
read(id?: string): Promise<{
|
|
214
|
+
[k: string]: AddressesInterface;
|
|
215
|
+
}>;
|
|
216
|
+
/**
|
|
217
|
+
* Update the addresses through the API and synchronize it back to the
|
|
218
|
+
* instance.
|
|
219
|
+
*
|
|
220
|
+
* @description
|
|
221
|
+
* If the `network` is not specified, the mainnet is used by default.
|
|
222
|
+
* If no `addresses` from instance or parameter is provided, an addresses with
|
|
223
|
+
* all empty strings is created by default.
|
|
224
|
+
*
|
|
225
|
+
* This function only allows for one addresses to be input into a specific network
|
|
226
|
+
* at a time, and does not provide an addresses map for setting addresses
|
|
227
|
+
* across all networks at once.
|
|
228
|
+
*
|
|
229
|
+
* @param params.id - The id of the addresses to update.
|
|
230
|
+
* @param params.addresses - The addresses be setted to the tartget network.
|
|
231
|
+
* @param params.network - Specifies which network's addresses you want to set.
|
|
232
|
+
* @param params.auth - The authentication api key.
|
|
233
|
+
* @param params.memo - Add memo to the addresses created in the API.
|
|
234
|
+
* @return All addresses.
|
|
235
|
+
*/
|
|
236
|
+
update(params?: {
|
|
237
|
+
id?: string;
|
|
238
|
+
addresses?: AddressesInterface | undefined;
|
|
239
|
+
network?: NetworkType | undefined;
|
|
240
|
+
auth?: string | undefined;
|
|
241
|
+
memo?: string | undefined;
|
|
242
|
+
}): Promise<{
|
|
243
|
+
[k: string]: AddressesInterface;
|
|
244
|
+
}>;
|
|
245
|
+
/**
|
|
246
|
+
* Deletes all addresses of a specified id through the API and clear all
|
|
247
|
+
* addresses in the instance.
|
|
248
|
+
*
|
|
249
|
+
* @param id - The id of the addresses to delete.
|
|
250
|
+
* @param auth - The authentication API key.
|
|
251
|
+
*/
|
|
252
|
+
delete(id?: string, auth?: string): Promise<void>;
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
type CoinName = string;
|
|
256
|
+
type CoinType = string;
|
|
257
|
+
type SCoinType = string;
|
|
258
|
+
type OldMarketCoinType = string;
|
|
259
|
+
/**
|
|
260
|
+
* @description `scallop_sui`, `scallop_usdt`, etc (parsed directly from coin type, ex: `0x...::scallop_sui::SCALLOP_SUI`)
|
|
261
|
+
*/
|
|
262
|
+
type SCoinRawName = string;
|
|
263
|
+
/**
|
|
264
|
+
* @description `ssui`, `susdc`, etc..
|
|
265
|
+
*/
|
|
266
|
+
type SCoinName = string;
|
|
267
|
+
type ScallopConstantsParams = {
|
|
268
|
+
urls?: {
|
|
269
|
+
poolAddresses?: string[];
|
|
270
|
+
whitelist?: string[];
|
|
271
|
+
};
|
|
272
|
+
forcePoolAddressInterface?: Record<string, PoolAddress>;
|
|
273
|
+
forceWhitelistInterface?: Whitelist | Record<string, any>;
|
|
274
|
+
defaultValues?: {
|
|
275
|
+
poolAddresses?: Record<string, PoolAddress>;
|
|
276
|
+
whitelist?: Whitelist | Record<string, any>;
|
|
277
|
+
};
|
|
278
|
+
} & ScallopAddressParams;
|
|
279
|
+
declare class ScallopConstants extends ScallopAddress {
|
|
280
|
+
readonly params: ScallopConstantsParams;
|
|
281
|
+
private _poolAddresses;
|
|
282
|
+
private _whitelist;
|
|
283
|
+
/**
|
|
284
|
+
* @description coin names to coin decimal map
|
|
285
|
+
*/
|
|
286
|
+
coinDecimals: Record<CoinName, number | undefined>;
|
|
287
|
+
coinNameToOldMarketCoinTypeMap: Record<CoinName, OldMarketCoinType | undefined>;
|
|
288
|
+
scoinRawNameToSCoinNameMap: Record<SCoinRawName, SCoinName | undefined>;
|
|
289
|
+
scoinTypeToSCoinNameMap: Record<SCoinType, SCoinName | undefined>;
|
|
290
|
+
wormholeCoinTypeToCoinNameMap: Record<CoinType, CoinName | undefined>;
|
|
291
|
+
voloCoinTypeToCoinNameMap: Record<CoinType, CoinName | undefined>;
|
|
292
|
+
suiBridgeCoinTypeToCoinNameMap: Record<CoinType, CoinName | undefined>;
|
|
293
|
+
/**
|
|
294
|
+
* @description coin names to coin types map
|
|
295
|
+
*/
|
|
296
|
+
coinTypes: Record<CoinName, CoinType | undefined>;
|
|
297
|
+
/**
|
|
298
|
+
* @description scoin names to scoin types map
|
|
299
|
+
*/
|
|
300
|
+
sCoinTypes: Record<SCoinName, SCoinType | undefined>;
|
|
301
|
+
coinTypeToCoinNameMap: Record<CoinType, CoinName | undefined>;
|
|
302
|
+
/**
|
|
303
|
+
* @description Supported borrow incentive reward coin names
|
|
304
|
+
*/
|
|
305
|
+
supportedBorrowIncentiveRewards: Set<CoinName>;
|
|
306
|
+
constructor(params?: ScallopConstantsParams);
|
|
307
|
+
get protocolObjectId(): string;
|
|
308
|
+
get isInitialized(): boolean;
|
|
309
|
+
get whitelist(): Whitelist;
|
|
310
|
+
get poolAddresses(): Record<string, PoolAddress | undefined>;
|
|
311
|
+
get defaultValues(): ({
|
|
312
|
+
poolAddresses?: Record<string, PoolAddress>;
|
|
313
|
+
whitelist?: Whitelist | Record<string, any>;
|
|
314
|
+
} & {
|
|
315
|
+
addresses?: Partial<Record<NetworkType, AddressesInterface>>;
|
|
316
|
+
}) | undefined;
|
|
317
|
+
private isAddressInitialized;
|
|
318
|
+
parseToOldMarketCoin(coinType: string): string;
|
|
319
|
+
init({ networkType, force, addressId, constantsParams, }?: {
|
|
320
|
+
networkType?: NetworkType;
|
|
321
|
+
force?: boolean;
|
|
322
|
+
addressId?: string;
|
|
323
|
+
constantsParams?: Partial<ScallopConstantsParams>;
|
|
324
|
+
}): Promise<void>;
|
|
325
|
+
private initConstants;
|
|
326
|
+
readWhiteList(): Promise<Whitelist>;
|
|
327
|
+
readPoolAddresses(): Promise<Record<string, PoolAddress>>;
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
interface BorrowIncentiveAccountKey {
|
|
331
|
+
id: string;
|
|
332
|
+
onwerId: string;
|
|
333
|
+
}
|
|
334
|
+
type OptionalKeys$4<T> = {
|
|
335
|
+
[K in keyof T]?: T[K];
|
|
336
|
+
};
|
|
337
|
+
type BorrowIncentivePools = OptionalKeys$4<Record<string, BorrowIncentivePool>>;
|
|
338
|
+
type BorrowIncentivePoolPoints = {
|
|
339
|
+
symbol: string;
|
|
340
|
+
coinName: string;
|
|
341
|
+
coinType: string;
|
|
342
|
+
coinDecimal: number;
|
|
343
|
+
coinPrice: number;
|
|
344
|
+
} & Required<Pick<ParsedBorrowIncentivePoolPointData, 'points' | 'distributedPoint' | 'weightedAmount'>> & CalculatedBorrowIncentivePoolPointData;
|
|
345
|
+
type BorrowIncentivePool = {
|
|
346
|
+
coinName: string;
|
|
347
|
+
symbol: string;
|
|
348
|
+
coinType: string;
|
|
349
|
+
coinDecimal: number;
|
|
350
|
+
coinPrice: number;
|
|
351
|
+
stakedAmount: number;
|
|
352
|
+
stakedCoin: number;
|
|
353
|
+
stakedValue: number;
|
|
354
|
+
points: OptionalKeys$4<Record<string, BorrowIncentivePoolPoints>>;
|
|
355
|
+
};
|
|
356
|
+
type OriginBorrowIncentivePoolPointData = {
|
|
357
|
+
point_type: {
|
|
358
|
+
name: string;
|
|
359
|
+
};
|
|
360
|
+
distributed_point_per_period: string;
|
|
361
|
+
point_distribution_time: string;
|
|
362
|
+
distributed_point: string;
|
|
363
|
+
points: string;
|
|
364
|
+
index: string;
|
|
365
|
+
base_weight: string;
|
|
366
|
+
weighted_amount: string;
|
|
367
|
+
last_update: string;
|
|
368
|
+
created_at: string;
|
|
369
|
+
};
|
|
370
|
+
type OriginBorrowIncentivePoolData = {
|
|
371
|
+
pool_type: {
|
|
372
|
+
name: string;
|
|
373
|
+
};
|
|
374
|
+
points: OriginBorrowIncentivePoolPointData[];
|
|
375
|
+
min_stakes: string;
|
|
376
|
+
max_stakes: string;
|
|
377
|
+
stakes: string;
|
|
378
|
+
created_at: string;
|
|
379
|
+
};
|
|
380
|
+
type ParsedBorrowIncentivePoolPointData = {
|
|
381
|
+
pointType: string;
|
|
382
|
+
distributedPointPerPeriod: number;
|
|
383
|
+
period: number;
|
|
384
|
+
distributedPoint: number;
|
|
385
|
+
points: number;
|
|
386
|
+
index: number;
|
|
387
|
+
baseWeight: number;
|
|
388
|
+
weightedAmount: number;
|
|
389
|
+
lastUpdate: number;
|
|
390
|
+
createdAt: number;
|
|
391
|
+
};
|
|
392
|
+
type ParsedBorrowIncentivePoolData = {
|
|
393
|
+
poolType: string;
|
|
394
|
+
poolPoints: OptionalKeys$4<Record<string, ParsedBorrowIncentivePoolPointData>>;
|
|
395
|
+
minStakes: number;
|
|
396
|
+
maxStakes: number;
|
|
397
|
+
staked: number;
|
|
398
|
+
};
|
|
399
|
+
type CalculatedBorrowIncentivePoolPointData = {
|
|
400
|
+
baseWeight: number;
|
|
401
|
+
weightedStakedAmount: number;
|
|
402
|
+
weightedStakedCoin: number;
|
|
403
|
+
weightedStakedValue: number;
|
|
404
|
+
distributedPointPerSec: number;
|
|
405
|
+
accumulatedPoints: number;
|
|
406
|
+
currentPointIndex: number;
|
|
407
|
+
currentTotalDistributedPoint: number;
|
|
408
|
+
rewardApr: number;
|
|
409
|
+
rewardPerSec: number;
|
|
410
|
+
};
|
|
411
|
+
type BorrowIncentiveAccounts = OptionalKeys$4<Record<string, ParsedBorrowIncentiveAccountData>>;
|
|
412
|
+
type OriginBorrowIncentiveAccountPoolData = {
|
|
413
|
+
point_type: {
|
|
414
|
+
name: string;
|
|
415
|
+
};
|
|
416
|
+
weighted_amount: string;
|
|
417
|
+
points: string;
|
|
418
|
+
total_points: string;
|
|
419
|
+
index: string;
|
|
420
|
+
};
|
|
421
|
+
type OriginBorrowIncentiveAccountData = {
|
|
422
|
+
points_list: OriginBorrowIncentiveAccountPoolData[];
|
|
423
|
+
pool_type: {
|
|
424
|
+
name: string;
|
|
425
|
+
};
|
|
426
|
+
debt_amount: string;
|
|
427
|
+
};
|
|
428
|
+
type ParsedBorrowIncentiveAccountPoolData = {
|
|
429
|
+
pointType: string;
|
|
430
|
+
weightedAmount: number;
|
|
431
|
+
points: number;
|
|
432
|
+
totalPoints: number;
|
|
433
|
+
index: number;
|
|
434
|
+
};
|
|
435
|
+
type ParsedBorrowIncentiveAccountData = {
|
|
436
|
+
pointList: OptionalKeys$4<Record<string, ParsedBorrowIncentiveAccountPoolData>>;
|
|
437
|
+
poolType: string;
|
|
438
|
+
debtAmount: number;
|
|
439
|
+
};
|
|
440
|
+
/**
|
|
441
|
+
* The query interface for `incentive_pools_query::incentive_pools_data` inspectTxn.
|
|
442
|
+
*/
|
|
443
|
+
interface BorrowIncentivePoolsQueryInterface {
|
|
444
|
+
incentive_pools: OriginBorrowIncentivePoolData[];
|
|
445
|
+
}
|
|
446
|
+
/**
|
|
447
|
+
* The query interface for `incentive_account_query::incentive_account_data` inspectTxn.
|
|
448
|
+
*/
|
|
449
|
+
interface BorrowIncentiveAccountsQueryInterface {
|
|
450
|
+
pool_records: OriginBorrowIncentiveAccountData[];
|
|
451
|
+
}
|
|
452
|
+
|
|
453
|
+
type OptionalKeys$3<T> = {
|
|
454
|
+
[K in keyof T]?: T[K];
|
|
455
|
+
};
|
|
456
|
+
type MarketPools = OptionalKeys$3<Record<string, MarketPool>>;
|
|
457
|
+
type MarketCollaterals = OptionalKeys$3<Record<string, MarketCollateral>>;
|
|
458
|
+
type CoinAmounts = OptionalKeys$3<Record<string, number>>;
|
|
459
|
+
type MarketCoinAmounts = OptionalKeys$3<Record<string, number>>;
|
|
460
|
+
type SCoinAmounts = OptionalKeys$3<Record<string, number>>;
|
|
461
|
+
type BalanceSheet = {
|
|
462
|
+
cash: string;
|
|
463
|
+
debt: string;
|
|
464
|
+
market_coin_supply: string;
|
|
465
|
+
revenue: string;
|
|
466
|
+
};
|
|
467
|
+
type BorrowDynamic = {
|
|
468
|
+
borrow_index: string;
|
|
469
|
+
interest_rate: {
|
|
470
|
+
fields: {
|
|
471
|
+
value: string;
|
|
472
|
+
};
|
|
473
|
+
};
|
|
474
|
+
interest_rate_scale: string;
|
|
475
|
+
last_updated: string;
|
|
476
|
+
};
|
|
477
|
+
type BorrowFee = {
|
|
478
|
+
value: string;
|
|
479
|
+
};
|
|
480
|
+
type InterestModel = {
|
|
481
|
+
base_borrow_rate_per_sec: {
|
|
482
|
+
fields: {
|
|
483
|
+
value: string;
|
|
484
|
+
};
|
|
485
|
+
};
|
|
486
|
+
borrow_rate_on_high_kink: {
|
|
487
|
+
fields: {
|
|
488
|
+
value: string;
|
|
489
|
+
};
|
|
490
|
+
};
|
|
491
|
+
borrow_rate_on_mid_kink: {
|
|
492
|
+
fields: {
|
|
493
|
+
value: string;
|
|
494
|
+
};
|
|
495
|
+
};
|
|
496
|
+
borrow_weight: {
|
|
497
|
+
fields: {
|
|
498
|
+
value: string;
|
|
499
|
+
};
|
|
500
|
+
};
|
|
501
|
+
borrow_fee_rate: {
|
|
502
|
+
fields: {
|
|
503
|
+
value: string;
|
|
504
|
+
};
|
|
505
|
+
};
|
|
506
|
+
high_kink: {
|
|
507
|
+
fields: {
|
|
508
|
+
value: string;
|
|
509
|
+
};
|
|
510
|
+
};
|
|
511
|
+
interest_rate_scale: string;
|
|
512
|
+
max_borrow_rate: {
|
|
513
|
+
fields: {
|
|
514
|
+
value: string;
|
|
515
|
+
};
|
|
516
|
+
};
|
|
517
|
+
mid_kink: {
|
|
518
|
+
fields: {
|
|
519
|
+
value: string;
|
|
520
|
+
};
|
|
521
|
+
};
|
|
522
|
+
min_borrow_amount: string;
|
|
523
|
+
revenue_factor: {
|
|
524
|
+
fields: {
|
|
525
|
+
value: string;
|
|
526
|
+
};
|
|
527
|
+
};
|
|
528
|
+
type: {
|
|
529
|
+
fields: {
|
|
530
|
+
name: string;
|
|
531
|
+
};
|
|
532
|
+
};
|
|
533
|
+
};
|
|
534
|
+
type RiskModel = {
|
|
535
|
+
collateral_factor: {
|
|
536
|
+
fields: {
|
|
537
|
+
value: string;
|
|
538
|
+
};
|
|
539
|
+
};
|
|
540
|
+
liquidation_discount: {
|
|
541
|
+
fields: {
|
|
542
|
+
value: string;
|
|
543
|
+
};
|
|
544
|
+
};
|
|
545
|
+
liquidation_factor: {
|
|
546
|
+
fields: {
|
|
547
|
+
value: string;
|
|
548
|
+
};
|
|
549
|
+
};
|
|
550
|
+
liquidation_penalty: {
|
|
551
|
+
fields: {
|
|
552
|
+
value: string;
|
|
553
|
+
};
|
|
554
|
+
};
|
|
555
|
+
liquidation_revenue_factor: {
|
|
556
|
+
fields: {
|
|
557
|
+
value: string;
|
|
558
|
+
};
|
|
559
|
+
};
|
|
560
|
+
max_collateral_amount: string;
|
|
561
|
+
type: {
|
|
562
|
+
fields: {
|
|
563
|
+
name: string;
|
|
564
|
+
};
|
|
565
|
+
};
|
|
566
|
+
};
|
|
567
|
+
type CollateralStat = {
|
|
568
|
+
amount: string;
|
|
569
|
+
};
|
|
570
|
+
type MarketPool = {
|
|
571
|
+
coinName: string;
|
|
572
|
+
symbol: string;
|
|
573
|
+
coinType: string;
|
|
574
|
+
marketCoinType: string;
|
|
575
|
+
sCoinType: string;
|
|
576
|
+
coinWrappedType: CoinWrappedType;
|
|
577
|
+
coinDecimal: number;
|
|
578
|
+
coinPrice: number;
|
|
579
|
+
maxSupplyCoin: number;
|
|
580
|
+
maxBorrowCoin: number;
|
|
581
|
+
isIsolated: boolean;
|
|
582
|
+
} & Required<Pick<ParsedMarketPoolData, 'highKink' | 'midKink' | 'reserveFactor' | 'borrowWeight' | 'borrowFee' | 'marketCoinSupplyAmount' | 'minBorrowAmount'>> & CalculatedMarketPoolData;
|
|
583
|
+
type MarketCollateral = {
|
|
584
|
+
coinName: string;
|
|
585
|
+
symbol: string;
|
|
586
|
+
coinType: string;
|
|
587
|
+
marketCoinType: string;
|
|
588
|
+
coinWrappedType: CoinWrappedType;
|
|
589
|
+
coinDecimal: number;
|
|
590
|
+
coinPrice: number;
|
|
591
|
+
isIsolated: boolean;
|
|
592
|
+
} & Required<Pick<ParsedMarketCollateralData, 'collateralFactor' | 'liquidationFactor' | 'liquidationDiscount' | 'liquidationPenalty' | 'liquidationReserveFactor'>> & CalculatedMarketCollateralData;
|
|
593
|
+
type OriginMarketPoolData = {
|
|
594
|
+
type: {
|
|
595
|
+
name: string;
|
|
596
|
+
};
|
|
597
|
+
maxBorrowRate: {
|
|
598
|
+
value: string;
|
|
599
|
+
};
|
|
600
|
+
interestRate: {
|
|
601
|
+
value: string;
|
|
602
|
+
};
|
|
603
|
+
interestRateScale: string;
|
|
604
|
+
borrowIndex: string;
|
|
605
|
+
lastUpdated: string;
|
|
606
|
+
cash: string;
|
|
607
|
+
debt: string;
|
|
608
|
+
marketCoinSupply: string;
|
|
609
|
+
reserve: string;
|
|
610
|
+
reserveFactor: {
|
|
611
|
+
value: string;
|
|
612
|
+
};
|
|
613
|
+
borrowWeight: {
|
|
614
|
+
value: string;
|
|
615
|
+
};
|
|
616
|
+
borrowFeeRate: {
|
|
617
|
+
value: string;
|
|
618
|
+
};
|
|
619
|
+
baseBorrowRatePerSec: {
|
|
620
|
+
value: string;
|
|
621
|
+
};
|
|
622
|
+
borrowRateOnHighKink: {
|
|
623
|
+
value: string;
|
|
624
|
+
};
|
|
625
|
+
borrowRateOnMidKink: {
|
|
626
|
+
value: string;
|
|
627
|
+
};
|
|
628
|
+
highKink: {
|
|
629
|
+
value: string;
|
|
630
|
+
};
|
|
631
|
+
midKink: {
|
|
632
|
+
value: string;
|
|
633
|
+
};
|
|
634
|
+
minBorrowAmount: string;
|
|
635
|
+
isIsolated: boolean;
|
|
636
|
+
supplyLimit: string;
|
|
637
|
+
borrowLimit: string;
|
|
638
|
+
};
|
|
639
|
+
type ParsedMarketPoolData = {
|
|
640
|
+
coinType: string;
|
|
641
|
+
maxBorrowRate: number;
|
|
642
|
+
borrowRate: number;
|
|
643
|
+
borrowRateScale: number;
|
|
644
|
+
borrowIndex: number;
|
|
645
|
+
lastUpdated: number;
|
|
646
|
+
cashAmount: number;
|
|
647
|
+
debtAmount: number;
|
|
648
|
+
marketCoinSupplyAmount: number;
|
|
649
|
+
reserveAmount: number;
|
|
650
|
+
reserveFactor: number;
|
|
651
|
+
borrowWeight: number;
|
|
652
|
+
borrowFee: number;
|
|
653
|
+
baseBorrowRate: number;
|
|
654
|
+
borrowRateOnHighKink: number;
|
|
655
|
+
borrowRateOnMidKink: number;
|
|
656
|
+
highKink: number;
|
|
657
|
+
midKink: number;
|
|
658
|
+
minBorrowAmount: number;
|
|
659
|
+
isIsolated: boolean;
|
|
660
|
+
supplyLimit: number;
|
|
661
|
+
borrowLimit: number;
|
|
662
|
+
};
|
|
663
|
+
type CalculatedMarketPoolData = {
|
|
664
|
+
baseBorrowApr: number;
|
|
665
|
+
baseBorrowApy: number;
|
|
666
|
+
borrowAprOnHighKink: number;
|
|
667
|
+
borrowApyOnHighKink: number;
|
|
668
|
+
borrowAprOnMidKink: number;
|
|
669
|
+
borrowApyOnMidKink: number;
|
|
670
|
+
coinDecimal: number;
|
|
671
|
+
conversionRate: number;
|
|
672
|
+
maxBorrowApr: number;
|
|
673
|
+
maxBorrowApy: number;
|
|
674
|
+
borrowApr: number;
|
|
675
|
+
borrowApy: number;
|
|
676
|
+
borrowIndex: number;
|
|
677
|
+
growthInterest: number;
|
|
678
|
+
supplyAmount: number;
|
|
679
|
+
supplyCoin: number;
|
|
680
|
+
borrowAmount: number;
|
|
681
|
+
borrowCoin: number;
|
|
682
|
+
reserveAmount: number;
|
|
683
|
+
reserveCoin: number;
|
|
684
|
+
utilizationRate: number;
|
|
685
|
+
supplyApr: number;
|
|
686
|
+
supplyApy: number;
|
|
687
|
+
isIsolated: boolean;
|
|
688
|
+
maxSupplyCoin: number;
|
|
689
|
+
maxBorrowCoin: number;
|
|
690
|
+
};
|
|
691
|
+
type OriginMarketCollateralData = {
|
|
692
|
+
type: {
|
|
693
|
+
name: string;
|
|
694
|
+
};
|
|
695
|
+
isIsolated: boolean;
|
|
696
|
+
collateralFactor: {
|
|
697
|
+
value: string;
|
|
698
|
+
};
|
|
699
|
+
liquidationFactor: {
|
|
700
|
+
value: string;
|
|
701
|
+
};
|
|
702
|
+
liquidationDiscount: {
|
|
703
|
+
value: string;
|
|
704
|
+
};
|
|
705
|
+
liquidationPenalty: {
|
|
706
|
+
value: string;
|
|
707
|
+
};
|
|
708
|
+
liquidationReserveFactor: {
|
|
709
|
+
value: string;
|
|
710
|
+
};
|
|
711
|
+
maxCollateralAmount: string;
|
|
712
|
+
totalCollateralAmount: string;
|
|
713
|
+
};
|
|
714
|
+
type ParsedMarketCollateralData = {
|
|
715
|
+
coinType: string;
|
|
716
|
+
collateralFactor: number;
|
|
717
|
+
liquidationFactor: number;
|
|
718
|
+
liquidationDiscount: number;
|
|
719
|
+
liquidationPenalty: number;
|
|
720
|
+
liquidationReserveFactor: number;
|
|
721
|
+
maxCollateralAmount: number;
|
|
722
|
+
totalCollateralAmount: number;
|
|
723
|
+
isIsolated: boolean;
|
|
724
|
+
};
|
|
725
|
+
type CalculatedMarketCollateralData = {
|
|
726
|
+
coinDecimal: number;
|
|
727
|
+
isIsolated: boolean;
|
|
728
|
+
maxDepositAmount: number;
|
|
729
|
+
maxDepositCoin: number;
|
|
730
|
+
depositAmount: number;
|
|
731
|
+
depositCoin: number;
|
|
732
|
+
};
|
|
733
|
+
type Market = {
|
|
734
|
+
pools: MarketPools;
|
|
735
|
+
collaterals: MarketCollaterals;
|
|
736
|
+
data?: MarketQueryInterface;
|
|
737
|
+
};
|
|
738
|
+
type Obligation$1 = {
|
|
739
|
+
id: string;
|
|
740
|
+
keyId: string;
|
|
741
|
+
locked: boolean;
|
|
742
|
+
};
|
|
743
|
+
/**
|
|
744
|
+
* The query interface for `market_query::market_data` inspectTxn.
|
|
745
|
+
*/
|
|
746
|
+
interface MarketQueryInterface {
|
|
747
|
+
collaterals: {
|
|
748
|
+
collateralFactor: {
|
|
749
|
+
value: string;
|
|
750
|
+
};
|
|
751
|
+
liquidationDiscount: {
|
|
752
|
+
value: string;
|
|
753
|
+
};
|
|
754
|
+
liquidationFactor: {
|
|
755
|
+
value: string;
|
|
756
|
+
};
|
|
757
|
+
liquidationPanelty: {
|
|
758
|
+
value: string;
|
|
759
|
+
};
|
|
760
|
+
liquidationReserveFactor: {
|
|
761
|
+
value: string;
|
|
762
|
+
};
|
|
763
|
+
maxCollateralAmount: string;
|
|
764
|
+
totalCollateralAmount: string;
|
|
765
|
+
type: {
|
|
766
|
+
name: string;
|
|
767
|
+
};
|
|
768
|
+
}[];
|
|
769
|
+
pools: {
|
|
770
|
+
baseBorrowRatePerSec: {
|
|
771
|
+
value: string;
|
|
772
|
+
};
|
|
773
|
+
borrowRateOnHighKink: {
|
|
774
|
+
value: string;
|
|
775
|
+
};
|
|
776
|
+
borrowRateOnMidKink: {
|
|
777
|
+
value: string;
|
|
778
|
+
};
|
|
779
|
+
maxBorrowRate: {
|
|
780
|
+
value: string;
|
|
781
|
+
};
|
|
782
|
+
highKink: {
|
|
783
|
+
value: string;
|
|
784
|
+
};
|
|
785
|
+
midKink: {
|
|
786
|
+
value: string;
|
|
787
|
+
};
|
|
788
|
+
interestRate: {
|
|
789
|
+
value: string;
|
|
790
|
+
};
|
|
791
|
+
interestRateScale: string;
|
|
792
|
+
borrowIndex: string;
|
|
793
|
+
lastUpdated: string;
|
|
794
|
+
cash: string;
|
|
795
|
+
debt: string;
|
|
796
|
+
marketCoinSupply: string;
|
|
797
|
+
minBorrowAmount: string;
|
|
798
|
+
reserve: string;
|
|
799
|
+
reserveFactor: {
|
|
800
|
+
value: string;
|
|
801
|
+
};
|
|
802
|
+
borrowWeight: {
|
|
803
|
+
value: string;
|
|
804
|
+
};
|
|
805
|
+
borrowFeeRate: {
|
|
806
|
+
value: string;
|
|
807
|
+
};
|
|
808
|
+
type: {
|
|
809
|
+
name: string;
|
|
810
|
+
};
|
|
811
|
+
}[];
|
|
812
|
+
}
|
|
813
|
+
/**
|
|
814
|
+
* The query interface for `obligation_query::obligation_data` inspectTxn.
|
|
815
|
+
*/
|
|
816
|
+
interface ObligationQueryInterface {
|
|
817
|
+
collaterals: {
|
|
818
|
+
type: {
|
|
819
|
+
name: string;
|
|
820
|
+
};
|
|
821
|
+
amount: string;
|
|
822
|
+
}[];
|
|
823
|
+
debts: {
|
|
824
|
+
type: {
|
|
825
|
+
name: string;
|
|
826
|
+
};
|
|
827
|
+
amount: string;
|
|
828
|
+
borrowIndex: string;
|
|
829
|
+
}[];
|
|
830
|
+
}
|
|
831
|
+
|
|
832
|
+
type LoyaltyProgramInfo = {
|
|
833
|
+
pendingReward: number;
|
|
834
|
+
totalPoolReward: number;
|
|
835
|
+
isClaimEnabled: boolean;
|
|
836
|
+
};
|
|
837
|
+
type VeScaLoyaltyProgramInfo = {
|
|
838
|
+
pendingVeScaReward: number;
|
|
839
|
+
pendingScaReward: number;
|
|
840
|
+
totalPoolReward: number;
|
|
841
|
+
isClaimEnabled: boolean;
|
|
842
|
+
};
|
|
843
|
+
|
|
844
|
+
type OptionalKeys$2<T> = {
|
|
845
|
+
[K in keyof T]?: T[K];
|
|
846
|
+
};
|
|
847
|
+
type Spools = OptionalKeys$2<Record<string, Spool>>;
|
|
848
|
+
type Spool = {
|
|
849
|
+
marketCoinName: string;
|
|
850
|
+
symbol: string;
|
|
851
|
+
coinType: string;
|
|
852
|
+
marketCoinType: string;
|
|
853
|
+
rewardCoinType: string;
|
|
854
|
+
sCoinType: string;
|
|
855
|
+
coinDecimal: number;
|
|
856
|
+
rewardCoinDecimal: number;
|
|
857
|
+
coinPrice: number;
|
|
858
|
+
marketCoinPrice: number;
|
|
859
|
+
rewardCoinPrice: number;
|
|
860
|
+
} & Required<Pick<ParsedSpoolData, 'maxPoint' | 'distributedPoint' | 'maxStake'>> & CalculatedSpoolData & SpoolRewardPool;
|
|
861
|
+
type OriginSpoolData = {
|
|
862
|
+
stakeType: {
|
|
863
|
+
fields: {
|
|
864
|
+
name: string;
|
|
865
|
+
};
|
|
866
|
+
};
|
|
867
|
+
maxDistributedPoint: string;
|
|
868
|
+
distributedPoint: string;
|
|
869
|
+
distributedPointPerPeriod: string;
|
|
870
|
+
pointDistributionTime: string;
|
|
871
|
+
maxStake: string;
|
|
872
|
+
stakes: string;
|
|
873
|
+
index: string;
|
|
874
|
+
createdAt: string;
|
|
875
|
+
lastUpdate: string;
|
|
876
|
+
};
|
|
877
|
+
type SpoolData = {
|
|
878
|
+
created_at: string;
|
|
879
|
+
distributed_point: string;
|
|
880
|
+
distributed_point_per_period: string;
|
|
881
|
+
id: {
|
|
882
|
+
id: string;
|
|
883
|
+
};
|
|
884
|
+
index: string;
|
|
885
|
+
last_update: string;
|
|
886
|
+
max_distributed_point: string;
|
|
887
|
+
max_stakes: string;
|
|
888
|
+
point_distribution_time: string;
|
|
889
|
+
stake_type: {
|
|
890
|
+
type: string;
|
|
891
|
+
fields: {
|
|
892
|
+
name: string;
|
|
893
|
+
};
|
|
894
|
+
};
|
|
895
|
+
stakes: string;
|
|
896
|
+
};
|
|
897
|
+
type ParsedSpoolData = {
|
|
898
|
+
stakeType: string;
|
|
899
|
+
maxPoint: number;
|
|
900
|
+
distributedPoint: number;
|
|
901
|
+
pointPerPeriod: number;
|
|
902
|
+
period: number;
|
|
903
|
+
maxStake: number;
|
|
904
|
+
staked: number;
|
|
905
|
+
index: number;
|
|
906
|
+
createdAt: number;
|
|
907
|
+
lastUpdate: number;
|
|
908
|
+
};
|
|
909
|
+
type CalculatedSpoolData = {
|
|
910
|
+
stakedAmount: number;
|
|
911
|
+
stakedCoin: number;
|
|
912
|
+
stakedValue: number;
|
|
913
|
+
distributedPointPerSec: number;
|
|
914
|
+
accumulatedPoints: number;
|
|
915
|
+
currentPointIndex: number;
|
|
916
|
+
currentTotalDistributedPoint: number;
|
|
917
|
+
startDate: Date;
|
|
918
|
+
endDate: Date;
|
|
919
|
+
};
|
|
920
|
+
type SpoolRewardPool = Required<Pick<ParsedSpoolRewardPoolData, 'exchangeRateNumerator' | 'exchangeRateDenominator'>> & CalculatedSpoolRewardPoolData;
|
|
921
|
+
type OriginSpoolRewardPoolData = {
|
|
922
|
+
claimed_rewards: string;
|
|
923
|
+
exchange_rate_denominator: string;
|
|
924
|
+
exchange_rate_numerator: string;
|
|
925
|
+
rewards: string;
|
|
926
|
+
spool_id: string;
|
|
927
|
+
};
|
|
928
|
+
type ParsedSpoolRewardPoolData = {
|
|
929
|
+
claimedRewards: number;
|
|
930
|
+
exchangeRateDenominator: number;
|
|
931
|
+
exchangeRateNumerator: number;
|
|
932
|
+
rewards: number;
|
|
933
|
+
spoolId: string;
|
|
934
|
+
};
|
|
935
|
+
type CalculatedSpoolRewardPoolData = {
|
|
936
|
+
rewardApr: number;
|
|
937
|
+
totalRewardAmount: number;
|
|
938
|
+
totalRewardCoin: number;
|
|
939
|
+
totalRewardValue: number;
|
|
940
|
+
remaindRewardAmount: number;
|
|
941
|
+
remaindRewardCoin: number;
|
|
942
|
+
remaindRewardValue: number;
|
|
943
|
+
claimedRewardAmount: number;
|
|
944
|
+
claimedRewardCoin: number;
|
|
945
|
+
claimedRewardValue: number;
|
|
946
|
+
rewardPerSec: number;
|
|
947
|
+
};
|
|
948
|
+
type StakePools = OptionalKeys$2<Record<string, StakePool>>;
|
|
949
|
+
type StakeRewardPools = OptionalKeys$2<Record<string, StakeRewardPool>>;
|
|
950
|
+
type StakeAccounts = Record<string, StakeAccount[]>;
|
|
951
|
+
interface StakeAccount {
|
|
952
|
+
id: string;
|
|
953
|
+
type: string;
|
|
954
|
+
stakePoolId: string;
|
|
955
|
+
stakeType: string;
|
|
956
|
+
staked: number;
|
|
957
|
+
index: number;
|
|
958
|
+
points: number;
|
|
959
|
+
totalPoints: number;
|
|
960
|
+
}
|
|
961
|
+
interface StakePool {
|
|
962
|
+
id: string;
|
|
963
|
+
type: string;
|
|
964
|
+
maxPoint: number;
|
|
965
|
+
distributedPoint: number;
|
|
966
|
+
pointPerPeriod: number;
|
|
967
|
+
period: number;
|
|
968
|
+
maxStake: number;
|
|
969
|
+
stakeType: string;
|
|
970
|
+
totalStaked: number;
|
|
971
|
+
index: number;
|
|
972
|
+
createdAt: number;
|
|
973
|
+
lastUpdate: number;
|
|
974
|
+
}
|
|
975
|
+
interface StakeRewardPool {
|
|
976
|
+
id: string;
|
|
977
|
+
type: string;
|
|
978
|
+
stakePoolId: string;
|
|
979
|
+
ratioDenominator: number;
|
|
980
|
+
ratioNumerator: number;
|
|
981
|
+
rewards: number;
|
|
982
|
+
claimedRewards: number;
|
|
983
|
+
}
|
|
984
|
+
|
|
985
|
+
type OptionalKeys$1<T> = {
|
|
986
|
+
[K in keyof T]?: T[K];
|
|
987
|
+
};
|
|
988
|
+
type Lendings = OptionalKeys$1<Record<string, Lending>>;
|
|
989
|
+
type ObligationAccounts = OptionalKeys$1<Record<string, ObligationAccount>>;
|
|
990
|
+
type Lending = Required<Pick<MarketPool, 'coinName' | 'symbol' | 'coinType' | 'marketCoinType' | 'sCoinType' | 'coinDecimal' | 'coinPrice' | 'conversionRate' | 'isIsolated'> & Pick<Spool, 'marketCoinPrice'>> & {
|
|
991
|
+
supplyApr: number;
|
|
992
|
+
supplyApy: number;
|
|
993
|
+
rewardApr: number;
|
|
994
|
+
suppliedAmount: number;
|
|
995
|
+
suppliedCoin: number;
|
|
996
|
+
suppliedValue: number;
|
|
997
|
+
stakedMarketAmount: number;
|
|
998
|
+
stakedMarketCoin: number;
|
|
999
|
+
stakedAmount: number;
|
|
1000
|
+
stakedCoin: number;
|
|
1001
|
+
stakedValue: number;
|
|
1002
|
+
unstakedMarketAmount: number;
|
|
1003
|
+
unstakedMarketCoin: number;
|
|
1004
|
+
unstakedAmount: number;
|
|
1005
|
+
unstakedCoin: number;
|
|
1006
|
+
unstakedValue: number;
|
|
1007
|
+
availableSupplyAmount: number;
|
|
1008
|
+
availableSupplyCoin: number;
|
|
1009
|
+
availableWithdrawAmount: number;
|
|
1010
|
+
availableWithdrawCoin: number;
|
|
1011
|
+
availableStakeAmount: number;
|
|
1012
|
+
availableStakeCoin: number;
|
|
1013
|
+
availableUnstakeAmount: number;
|
|
1014
|
+
availableUnstakeCoin: number;
|
|
1015
|
+
availableClaimAmount: number;
|
|
1016
|
+
availableClaimCoin: number;
|
|
1017
|
+
};
|
|
1018
|
+
type ObligationAccount = {
|
|
1019
|
+
obligationId: string;
|
|
1020
|
+
totalDepositedValue: number;
|
|
1021
|
+
totalBorrowedValue: number;
|
|
1022
|
+
totalBalanceValue: number;
|
|
1023
|
+
totalBorrowCapacityValue: number;
|
|
1024
|
+
totalAvailableCollateralValue: number;
|
|
1025
|
+
totalBorrowedValueWithWeight: number;
|
|
1026
|
+
totalRequiredCollateralValue: number;
|
|
1027
|
+
totalUnhealthyCollateralValue: number;
|
|
1028
|
+
totalRiskLevel: number;
|
|
1029
|
+
totalDepositedPools: number;
|
|
1030
|
+
totalBorrowedPools: number;
|
|
1031
|
+
totalRewardedPools: number;
|
|
1032
|
+
collaterals: OptionalKeys$1<Record<string, ObligationCollateral>>;
|
|
1033
|
+
debts: OptionalKeys$1<Record<string, ObligationDebt>>;
|
|
1034
|
+
borrowIncentives: OptionalKeys$1<Record<string, ObligationBorrowIncentive>>;
|
|
1035
|
+
};
|
|
1036
|
+
type ObligationCollateral = {
|
|
1037
|
+
coinName: string;
|
|
1038
|
+
coinType: string;
|
|
1039
|
+
symbol: string;
|
|
1040
|
+
coinDecimal: number;
|
|
1041
|
+
coinPrice: number;
|
|
1042
|
+
depositedAmount: number;
|
|
1043
|
+
depositedCoin: number;
|
|
1044
|
+
depositedValue: number;
|
|
1045
|
+
borrowCapacityValue: number;
|
|
1046
|
+
requiredCollateralValue: number;
|
|
1047
|
+
availableDepositAmount: number;
|
|
1048
|
+
availableDepositCoin: number;
|
|
1049
|
+
availableWithdrawAmount: number;
|
|
1050
|
+
availableWithdrawCoin: number;
|
|
1051
|
+
};
|
|
1052
|
+
type ObligationDebt = {
|
|
1053
|
+
coinName: string;
|
|
1054
|
+
coinType: string;
|
|
1055
|
+
symbol: string;
|
|
1056
|
+
coinDecimal: number;
|
|
1057
|
+
coinPrice: number;
|
|
1058
|
+
borrowedAmount: number;
|
|
1059
|
+
borrowedCoin: number;
|
|
1060
|
+
borrowedValue: number;
|
|
1061
|
+
borrowedValueWithWeight: number;
|
|
1062
|
+
borrowIndex: number;
|
|
1063
|
+
requiredRepayAmount: number;
|
|
1064
|
+
requiredRepayCoin: number;
|
|
1065
|
+
availableBorrowAmount: number;
|
|
1066
|
+
availableBorrowCoin: number;
|
|
1067
|
+
availableRepayAmount: number;
|
|
1068
|
+
availableRepayCoin: number;
|
|
1069
|
+
};
|
|
1070
|
+
type ObligationBorrowIncentiveReward = {
|
|
1071
|
+
coinName: string;
|
|
1072
|
+
coinType: string;
|
|
1073
|
+
symbol: string;
|
|
1074
|
+
coinDecimal: number;
|
|
1075
|
+
coinPrice: number;
|
|
1076
|
+
weightedBorrowAmount: number;
|
|
1077
|
+
availableClaimCoin: number;
|
|
1078
|
+
availableClaimAmount: number;
|
|
1079
|
+
boostValue: number;
|
|
1080
|
+
};
|
|
1081
|
+
type ObligationBorrowIncentive = {
|
|
1082
|
+
coinName: string;
|
|
1083
|
+
coinType: string;
|
|
1084
|
+
symbol: string;
|
|
1085
|
+
coinDecimal: number;
|
|
1086
|
+
coinPrice: number;
|
|
1087
|
+
rewards: ObligationBorrowIncentiveReward[];
|
|
1088
|
+
};
|
|
1089
|
+
type TotalValueLocked = {
|
|
1090
|
+
supplyLendingValue: number;
|
|
1091
|
+
supplyCollateralValue: number;
|
|
1092
|
+
supplyValue: number;
|
|
1093
|
+
borrowValue: number;
|
|
1094
|
+
totalValue: number;
|
|
1095
|
+
supplyValueChangeRatio?: number;
|
|
1096
|
+
supplyLendingValueChangeRatio?: number;
|
|
1097
|
+
supplyCollateralValueChangeRatio?: number;
|
|
1098
|
+
borrowValueChangeRatio?: number;
|
|
1099
|
+
totalValueChangeRatio?: number;
|
|
1100
|
+
};
|
|
1101
|
+
|
|
1102
|
+
type Vesca = {
|
|
1103
|
+
id: string;
|
|
1104
|
+
keyId: string;
|
|
1105
|
+
keyObject?: SuiObjectRef;
|
|
1106
|
+
object: SuiObjectRef;
|
|
1107
|
+
lockedScaAmount: string;
|
|
1108
|
+
lockedScaCoin: number;
|
|
1109
|
+
currentVeScaBalance: number;
|
|
1110
|
+
unlockAt: number;
|
|
1111
|
+
};
|
|
1112
|
+
type VeScaTreasuryFields = {
|
|
1113
|
+
total_ve_sca_amount: string;
|
|
1114
|
+
sca_balance: string;
|
|
1115
|
+
unlock_schedule: {
|
|
1116
|
+
fields: {
|
|
1117
|
+
locked_sca_amount: string;
|
|
1118
|
+
};
|
|
1119
|
+
};
|
|
1120
|
+
};
|
|
1121
|
+
type VeScaTreasuryInfo = {
|
|
1122
|
+
totalLockedSca: number;
|
|
1123
|
+
totalVeSca: number;
|
|
1124
|
+
averageLockingPeriod: number;
|
|
1125
|
+
averageLockingPeriodUnit: string;
|
|
1126
|
+
};
|
|
1127
|
+
|
|
1128
|
+
type ScallopIndexerParams = {
|
|
1129
|
+
indexerApiUrl?: string;
|
|
1130
|
+
} & ScallopAxiosParams;
|
|
1131
|
+
declare class ScallopIndexer extends ScallopAxios {
|
|
1132
|
+
constructor(params?: ScallopIndexerParams);
|
|
1133
|
+
/**
|
|
1134
|
+
* Get market index data.
|
|
1135
|
+
*
|
|
1136
|
+
* @return Market data.
|
|
1137
|
+
*/
|
|
1138
|
+
getMarket(): Promise<Pick<Market, 'pools' | 'collaterals'>>;
|
|
1139
|
+
/**
|
|
1140
|
+
* Get market pools index data.
|
|
1141
|
+
*
|
|
1142
|
+
* @return Market pools data.
|
|
1143
|
+
*/
|
|
1144
|
+
getMarketPools(): Promise<Required<MarketPools>>;
|
|
1145
|
+
/**
|
|
1146
|
+
* Get market pool index data.
|
|
1147
|
+
*
|
|
1148
|
+
* @return Market pool data.
|
|
1149
|
+
*/
|
|
1150
|
+
getMarketPool(poolCoinName: string): Promise<MarketPool>;
|
|
1151
|
+
/**
|
|
1152
|
+
* Get market collaterals index data.
|
|
1153
|
+
*
|
|
1154
|
+
* @return Market collaterals data.
|
|
1155
|
+
*/
|
|
1156
|
+
getMarketCollaterals(): Promise<Required<MarketCollaterals>>;
|
|
1157
|
+
/**
|
|
1158
|
+
* Get market collateral index data.
|
|
1159
|
+
*
|
|
1160
|
+
* @return Market collateral data.
|
|
1161
|
+
*/
|
|
1162
|
+
getMarketCollateral(collateralCoinName: string): Promise<MarketCollateral>;
|
|
1163
|
+
/**
|
|
1164
|
+
* Get spools index data.
|
|
1165
|
+
*
|
|
1166
|
+
* @return Spools data.
|
|
1167
|
+
*/
|
|
1168
|
+
getSpools(): Promise<Required<Spools>>;
|
|
1169
|
+
/**
|
|
1170
|
+
* Get spool index data.
|
|
1171
|
+
*
|
|
1172
|
+
* @return Spool data.
|
|
1173
|
+
*/
|
|
1174
|
+
getSpool(marketCoinName: string): Promise<Spool>;
|
|
1175
|
+
/**
|
|
1176
|
+
* Get borrow incentive pools index data.
|
|
1177
|
+
*
|
|
1178
|
+
* @return Borrow incentive pools data.
|
|
1179
|
+
*/
|
|
1180
|
+
getBorrowIncentivePools(): Promise<Required<BorrowIncentivePools>>;
|
|
1181
|
+
/**
|
|
1182
|
+
* Get borrow incentive pool index data.
|
|
1183
|
+
*
|
|
1184
|
+
* @return Borrow incentive pool data.
|
|
1185
|
+
*/
|
|
1186
|
+
getBorrowIncentivePool(borrowIncentiveCoinName: string): Promise<BorrowIncentivePool>;
|
|
1187
|
+
/**
|
|
1188
|
+
* Get total value locked index data.
|
|
1189
|
+
*
|
|
1190
|
+
* @return Total value locked.
|
|
1191
|
+
*/
|
|
1192
|
+
getTotalValueLocked(): Promise<TotalValueLocked & {
|
|
1193
|
+
totalValueChangeRatio: number;
|
|
1194
|
+
borrowValueChangeRatio: number;
|
|
1195
|
+
supplyValueChangeRatio: number;
|
|
1196
|
+
}>;
|
|
1197
|
+
/**
|
|
1198
|
+
* Get coin price index data.
|
|
1199
|
+
*
|
|
1200
|
+
* @return price data.
|
|
1201
|
+
*/
|
|
1202
|
+
getCoinPrice(poolCoinName: string): Promise<number>;
|
|
1203
|
+
getCoinPrices(): Promise<Record<string, number>>;
|
|
1204
|
+
}
|
|
1205
|
+
|
|
1206
|
+
type OptionalKeys<T> = {
|
|
1207
|
+
[K in keyof T]?: T[K];
|
|
1208
|
+
};
|
|
1209
|
+
type CoinPrices = OptionalKeys<Record<string, number>>;
|
|
1210
|
+
|
|
1211
|
+
type QueryInspectTxnParams = {
|
|
1212
|
+
queryTarget: string;
|
|
1213
|
+
args: SuiObjectArg[];
|
|
1214
|
+
typeArgs?: any[];
|
|
1215
|
+
};
|
|
1216
|
+
type ScallopSuiKitParams = {
|
|
1217
|
+
suiKit?: SuiKit;
|
|
1218
|
+
tokensPerSecond?: number;
|
|
1219
|
+
walletAddress?: string;
|
|
1220
|
+
} & SuiKitParams & ScallopQueryClientParams;
|
|
1221
|
+
declare class ScallopSuiKit extends ScallopQueryClient {
|
|
1222
|
+
readonly suiKit: SuiKit;
|
|
1223
|
+
private _walletAddress;
|
|
1224
|
+
private _tokensPerSecond;
|
|
1225
|
+
private rateLimiter;
|
|
1226
|
+
constructor(params?: ScallopSuiKitParams);
|
|
1227
|
+
switchFullNodes(fullNodes: string[]): void;
|
|
1228
|
+
get client(): _mysten_sui_dist_cjs_client.SuiClient;
|
|
1229
|
+
get walletAddress(): string;
|
|
1230
|
+
set walletAddress(value: string);
|
|
1231
|
+
get tokensPerSecond(): number;
|
|
1232
|
+
set tokensPerSecond(value: number);
|
|
1233
|
+
get currentFullNode(): string;
|
|
1234
|
+
signAndSendTxn(tx: Uint8Array | Transaction | SuiTxBlock, derivePathParams?: DerivePathParams): Promise<_mysten_sui_dist_cjs_client.SuiTransactionBlockResponse>;
|
|
1235
|
+
private callWithRateLimiter;
|
|
1236
|
+
private queryGetNormalizedMoveFunction;
|
|
1237
|
+
/**
|
|
1238
|
+
* @description Provides cache for getObject of the SuiKit.
|
|
1239
|
+
* @param objectId
|
|
1240
|
+
* @param QueryObjectParams
|
|
1241
|
+
* @returns Promise<SuiObjectResponse>
|
|
1242
|
+
*/
|
|
1243
|
+
queryGetObject(objectId: string, options?: SuiObjectDataOptions): Promise<SuiObjectResponse>;
|
|
1244
|
+
/**
|
|
1245
|
+
* @description Provides cache for getObjects of the SuiKit.
|
|
1246
|
+
* @param objectIds
|
|
1247
|
+
* @returns Promise<SuiObjectData[]>
|
|
1248
|
+
*/
|
|
1249
|
+
queryGetObjects(objectIds: string[], options?: SuiObjectDataOptions): Promise<SuiObjectData[]>;
|
|
1250
|
+
/**
|
|
1251
|
+
* @description Provides cache for getOwnedObjects of the SuiKit.
|
|
1252
|
+
* @param input
|
|
1253
|
+
* @returns Promise<PaginatedObjectsResponse>
|
|
1254
|
+
*/
|
|
1255
|
+
queryGetOwnedObjects(input: GetOwnedObjectsParams): Promise<_mysten_sui_dist_cjs_client.PaginatedObjectsResponse>;
|
|
1256
|
+
queryGetDynamicFields(input: GetDynamicFieldsParams): Promise<DynamicFieldPage | null>;
|
|
1257
|
+
queryGetDynamicFieldObject(input: GetDynamicFieldObjectParams): Promise<SuiObjectResponse | null>;
|
|
1258
|
+
queryGetAllCoinBalances(owner: string): Promise<{
|
|
1259
|
+
[k: string]: CoinBalance;
|
|
1260
|
+
}>;
|
|
1261
|
+
queryGetCoinBalance(input: GetBalanceParams): Promise<CoinBalance | null>;
|
|
1262
|
+
/**
|
|
1263
|
+
* @description Provides cache for inspectTxn of the SuiKit.
|
|
1264
|
+
* @param QueryInspectTxnParams
|
|
1265
|
+
* @param txBlock
|
|
1266
|
+
* @returns Promise<DevInspectResults>
|
|
1267
|
+
*/
|
|
1268
|
+
queryInspectTxn({ queryTarget, args, typeArgs, }: QueryInspectTxnParams): Promise<DevInspectResults | null>;
|
|
1269
|
+
}
|
|
1270
|
+
|
|
1271
|
+
type ScallopQueryParams = {
|
|
1272
|
+
indexer?: ScallopIndexer;
|
|
1273
|
+
utils?: ScallopUtils;
|
|
1274
|
+
} & ScallopUtilsParams & ScallopIndexerParams;
|
|
1275
|
+
declare class ScallopQuery implements ScallopQueryInterface {
|
|
1276
|
+
readonly indexer: ScallopIndexer;
|
|
1277
|
+
readonly utils: ScallopUtils;
|
|
1278
|
+
constructor(params: ScallopQueryParams);
|
|
1279
|
+
initIndexerFallback(): void;
|
|
1280
|
+
/**
|
|
1281
|
+
* Request the scallop API to initialize data.
|
|
1282
|
+
*
|
|
1283
|
+
* @param force - Whether to force initialization.
|
|
1284
|
+
*/
|
|
1285
|
+
init(force?: boolean): Promise<void>;
|
|
1286
|
+
get constants(): ScallopConstants;
|
|
1287
|
+
get walletAddress(): string;
|
|
1288
|
+
get scallopSuiKit(): ScallopSuiKit;
|
|
1289
|
+
get address(): ScallopConstants;
|
|
1290
|
+
/**
|
|
1291
|
+
* @deprecated use getMarketPools
|
|
1292
|
+
* Query market data.
|
|
1293
|
+
* @param indexer - Whether to use indexer.
|
|
1294
|
+
* @return Market data.
|
|
1295
|
+
*/
|
|
1296
|
+
queryMarket(args?: {
|
|
1297
|
+
coinPrices?: CoinPrices;
|
|
1298
|
+
indexer?: boolean;
|
|
1299
|
+
}): Promise<Market>;
|
|
1300
|
+
/**
|
|
1301
|
+
* Get market pools.
|
|
1302
|
+
*
|
|
1303
|
+
* @description
|
|
1304
|
+
* To obtain all market pools at once, it is recommended to use
|
|
1305
|
+
* the `queryMarket` method to reduce time consumption.
|
|
1306
|
+
*
|
|
1307
|
+
* @param poolCoinNames - Specific an array of support pool coin name.
|
|
1308
|
+
* @param indexer - Whether to use indexer.
|
|
1309
|
+
* @return Market pools data.
|
|
1310
|
+
*/
|
|
1311
|
+
getMarketPools(poolCoinNames?: string[], args?: {
|
|
1312
|
+
coinPrices?: CoinPrices;
|
|
1313
|
+
indexer?: boolean;
|
|
1314
|
+
}): Promise<{
|
|
1315
|
+
pools: MarketPools;
|
|
1316
|
+
collaterals: MarketCollaterals;
|
|
1317
|
+
}>;
|
|
1318
|
+
/**
|
|
1319
|
+
* Get market pool
|
|
1320
|
+
*
|
|
1321
|
+
* @param poolCoinName - Specific support pool coin name.
|
|
1322
|
+
* @param indexer - Whether to use indexer.
|
|
1323
|
+
* @return Market pool data.
|
|
1324
|
+
*/
|
|
1325
|
+
getMarketPool(poolCoinName: string, args?: {
|
|
1326
|
+
coinPrice?: number;
|
|
1327
|
+
indexer?: boolean;
|
|
1328
|
+
}): Promise<MarketPool | undefined>;
|
|
1329
|
+
/**
|
|
1330
|
+
* Get market collaterals.
|
|
1331
|
+
*
|
|
1332
|
+
* @description
|
|
1333
|
+
* To obtain all market collaterals at once, it is recommended to use
|
|
1334
|
+
* the `queryMarket` method to reduce time consumption.
|
|
1335
|
+
*
|
|
1336
|
+
* @param collateralCoinNames - Specific an array of support collateral coin name.
|
|
1337
|
+
* @param indexer - Whether to use indexer.
|
|
1338
|
+
* @return Market collaterals data.
|
|
1339
|
+
*/
|
|
1340
|
+
getMarketCollaterals(collateralCoinNames?: string[], args?: {
|
|
1341
|
+
indexer?: boolean;
|
|
1342
|
+
}): Promise<{
|
|
1343
|
+
[x: string]: MarketCollateral | undefined;
|
|
1344
|
+
}>;
|
|
1345
|
+
/**
|
|
1346
|
+
* Get market collateral
|
|
1347
|
+
*
|
|
1348
|
+
* @param collateralCoinName - Specific support collateral coin name.
|
|
1349
|
+
* @param indexer - Whether to use indexer.
|
|
1350
|
+
* @return Market collateral data.
|
|
1351
|
+
*/
|
|
1352
|
+
getMarketCollateral(collateralCoinName: string, args?: {
|
|
1353
|
+
indexer?: boolean;
|
|
1354
|
+
}): Promise<MarketCollateral | undefined>;
|
|
1355
|
+
/**
|
|
1356
|
+
* Get obligations data.
|
|
1357
|
+
*
|
|
1358
|
+
* @param ownerAddress - The owner address.
|
|
1359
|
+
* @return Obligations data.
|
|
1360
|
+
*/
|
|
1361
|
+
getObligations(ownerAddress?: string): Promise<Obligation$1[]>;
|
|
1362
|
+
/**
|
|
1363
|
+
* Query obligation data.
|
|
1364
|
+
*
|
|
1365
|
+
* @param obligationId - The obligation id.
|
|
1366
|
+
* @return Obligation data.
|
|
1367
|
+
*/
|
|
1368
|
+
queryObligation(obligationId: SuiObjectArg): Promise<ObligationQueryInterface | undefined>;
|
|
1369
|
+
/**
|
|
1370
|
+
* Get all asset coin amounts.
|
|
1371
|
+
*
|
|
1372
|
+
* @param assetCoinNames - Specific an array of support asset coin name.
|
|
1373
|
+
* @param ownerAddress - The owner address.
|
|
1374
|
+
* @return All coin amounts.
|
|
1375
|
+
*/
|
|
1376
|
+
getCoinAmounts(assetCoinNames?: string[], ownerAddress?: string): Promise<OptionalKeys<Record<string, number>>>;
|
|
1377
|
+
/**
|
|
1378
|
+
* Get asset coin amount.
|
|
1379
|
+
*
|
|
1380
|
+
* @param assetCoinName - Specific support asset coin name.
|
|
1381
|
+
* @param ownerAddress - The owner address.
|
|
1382
|
+
* @return Coin amount.
|
|
1383
|
+
*/
|
|
1384
|
+
getCoinAmount(assetCoinName: string, ownerAddress?: string): Promise<number>;
|
|
1385
|
+
/**
|
|
1386
|
+
* Get all market coin amounts.
|
|
1387
|
+
*
|
|
1388
|
+
* @param coinNames - Specific an array of support market coin name.
|
|
1389
|
+
* @param ownerAddress - The owner address.
|
|
1390
|
+
* @return All market market coin amounts.
|
|
1391
|
+
*/
|
|
1392
|
+
getMarketCoinAmounts(marketCoinNames?: string[], ownerAddress?: string): Promise<OptionalKeys<Record<string, number>>>;
|
|
1393
|
+
/**
|
|
1394
|
+
* Get market coin amount.
|
|
1395
|
+
*
|
|
1396
|
+
* @param coinNames - Specific support market coin name.
|
|
1397
|
+
* @param ownerAddress - The owner address.
|
|
1398
|
+
* @return Market market coin amount.
|
|
1399
|
+
*/
|
|
1400
|
+
getMarketCoinAmount(marketCoinName: string, ownerAddress?: string): Promise<number>;
|
|
1401
|
+
/**
|
|
1402
|
+
* Get price from pyth fee object.
|
|
1403
|
+
*
|
|
1404
|
+
* @param assetCoinName - Specific support asset coin name.
|
|
1405
|
+
* @return Asset coin price.
|
|
1406
|
+
*/
|
|
1407
|
+
getPriceFromPyth(assetCoinName: string): Promise<number>;
|
|
1408
|
+
/**
|
|
1409
|
+
* Get prices from pyth fee object.
|
|
1410
|
+
*
|
|
1411
|
+
* @param assetCoinNames - Array of supported asset coin names.
|
|
1412
|
+
* @return Array of asset coin prices.
|
|
1413
|
+
*/
|
|
1414
|
+
getPricesFromPyth(assetCoinNames: string[]): Promise<Record<string, number>>;
|
|
1415
|
+
/**
|
|
1416
|
+
* Get spools data.
|
|
1417
|
+
*
|
|
1418
|
+
* @param stakeMarketCoinNames - Specific an array of support stake market coin name.
|
|
1419
|
+
* @param indexer - Whether to use indexer.
|
|
1420
|
+
* @return Spools data.
|
|
1421
|
+
*/
|
|
1422
|
+
getSpools(stakeMarketCoinNames?: string[], args?: {
|
|
1423
|
+
marketPools?: MarketPools;
|
|
1424
|
+
coinPrices?: CoinPrices;
|
|
1425
|
+
indexer?: boolean;
|
|
1426
|
+
}): Promise<{
|
|
1427
|
+
[x: string]: Spool | undefined;
|
|
1428
|
+
}>;
|
|
1429
|
+
/**
|
|
1430
|
+
* Get spool data.
|
|
1431
|
+
*
|
|
1432
|
+
* @param stakeMarketCoinName - Specific support stake market coin name.
|
|
1433
|
+
* @param indexer - Whether to use indexer.
|
|
1434
|
+
* @return Spool data.
|
|
1435
|
+
*/
|
|
1436
|
+
getSpool(stakeMarketCoinName: string, args?: {
|
|
1437
|
+
marketPool?: MarketPool;
|
|
1438
|
+
coinPrices?: CoinPrices;
|
|
1439
|
+
indexer?: boolean;
|
|
1440
|
+
}): Promise<Spool | undefined>;
|
|
1441
|
+
/**
|
|
1442
|
+
* Get stake accounts data for all stake pools (spools).
|
|
1443
|
+
*
|
|
1444
|
+
* @param ownerAddress - The owner address.
|
|
1445
|
+
* @return All Stake accounts data.
|
|
1446
|
+
*/
|
|
1447
|
+
getAllStakeAccounts(ownerAddress?: string): Promise<StakeAccounts>;
|
|
1448
|
+
/**
|
|
1449
|
+
* Get stake accounts data for specific stake pool (spool).
|
|
1450
|
+
*
|
|
1451
|
+
* @param stakeMarketCoinName - Specific support stake market coin name.
|
|
1452
|
+
* @param ownerAddress - The owner address.
|
|
1453
|
+
* @return Stake accounts data.
|
|
1454
|
+
*/
|
|
1455
|
+
getStakeAccounts(stakeMarketCoinName: string, ownerAddress?: string): Promise<StakeAccount[]>;
|
|
1456
|
+
/**
|
|
1457
|
+
* Get stake pools (spools) data.
|
|
1458
|
+
*
|
|
1459
|
+
* @description
|
|
1460
|
+
* For backward compatible, it is recommended to use `getSpools` method
|
|
1461
|
+
* to get all spools data.
|
|
1462
|
+
*
|
|
1463
|
+
* @param stakeMarketCoinNames - Specific an array of support stake market coin name.
|
|
1464
|
+
* @return Stake pools data.
|
|
1465
|
+
*/
|
|
1466
|
+
getStakePools(stakeMarketCoinNames?: string[]): Promise<{
|
|
1467
|
+
[x: string]: StakePool | undefined;
|
|
1468
|
+
}>;
|
|
1469
|
+
/**
|
|
1470
|
+
* Get stake pool (spool) data.
|
|
1471
|
+
*
|
|
1472
|
+
* @description
|
|
1473
|
+
* For backward compatible, it is recommended to use `getSpool` method
|
|
1474
|
+
* to get all spool data.
|
|
1475
|
+
*
|
|
1476
|
+
* @param stakeMarketCoinName - Specific support stake market coin name.
|
|
1477
|
+
* @return Stake pool data.
|
|
1478
|
+
*/
|
|
1479
|
+
getStakePool(stakeMarketCoinName: string): Promise<StakePool | undefined>;
|
|
1480
|
+
/**
|
|
1481
|
+
* Get stake reward pools data.
|
|
1482
|
+
*
|
|
1483
|
+
* @description
|
|
1484
|
+
* For backward compatible, it is recommended to use `getSpools` method
|
|
1485
|
+
* to get all spools data.
|
|
1486
|
+
*
|
|
1487
|
+
* @param stakeMarketCoinNames - Specific an array of stake market coin name.
|
|
1488
|
+
* @return Stake reward pools data.
|
|
1489
|
+
*/
|
|
1490
|
+
getStakeRewardPools(stakeMarketCoinNames?: string[]): Promise<{
|
|
1491
|
+
[x: string]: StakeRewardPool | undefined;
|
|
1492
|
+
}>;
|
|
1493
|
+
/**
|
|
1494
|
+
* Get stake reward pool data.
|
|
1495
|
+
*
|
|
1496
|
+
* @description
|
|
1497
|
+
* For backward compatible, it is recommended to use `getSpool` method
|
|
1498
|
+
* to get spool data.
|
|
1499
|
+
*
|
|
1500
|
+
* @param marketCoinName - Specific support stake market coin name.
|
|
1501
|
+
* @return Stake reward pool data.
|
|
1502
|
+
*/
|
|
1503
|
+
getStakeRewardPool(stakeMarketCoinName: string): Promise<StakeRewardPool | undefined>;
|
|
1504
|
+
/**
|
|
1505
|
+
* Get borrow incentive pools data.
|
|
1506
|
+
*
|
|
1507
|
+
* @param coinNames - Specific an array of support borrow incentive coin name.
|
|
1508
|
+
* @param indexer - Whether to use indexer.
|
|
1509
|
+
* @return Borrow incentive pools data.
|
|
1510
|
+
*/
|
|
1511
|
+
getBorrowIncentivePools(coinNames?: string[], args?: {
|
|
1512
|
+
coinPrices?: CoinPrices;
|
|
1513
|
+
indexer?: boolean;
|
|
1514
|
+
marketPools?: MarketPools;
|
|
1515
|
+
}): Promise<{
|
|
1516
|
+
[x: string]: BorrowIncentivePool | undefined;
|
|
1517
|
+
}>;
|
|
1518
|
+
/**
|
|
1519
|
+
* Get borrow incentive accounts data.
|
|
1520
|
+
*
|
|
1521
|
+
* @param coinNames - Specific support borrow incentive coin name.
|
|
1522
|
+
* @param ownerAddress - The owner address.
|
|
1523
|
+
* @return Borrow incentive accounts data.
|
|
1524
|
+
*/
|
|
1525
|
+
getBorrowIncentiveAccounts(obligationId: string | SuiObjectRef$1, coinNames?: string[]): Promise<{
|
|
1526
|
+
[x: string]: ParsedBorrowIncentiveAccountData | undefined;
|
|
1527
|
+
}>;
|
|
1528
|
+
/**
|
|
1529
|
+
* Get user lending and spool infomation for specific pools.
|
|
1530
|
+
*
|
|
1531
|
+
* @param poolCoinNames - Specific an array of support pool coin name.
|
|
1532
|
+
* @param ownerAddress - The owner address.
|
|
1533
|
+
* @param indexer - Whether to use indexer.
|
|
1534
|
+
* @return All lending and spool infomation.
|
|
1535
|
+
*/
|
|
1536
|
+
getLendings(poolCoinNames?: string[], ownerAddress?: string, args?: {
|
|
1537
|
+
indexer?: boolean;
|
|
1538
|
+
marketPools?: MarketPools;
|
|
1539
|
+
coinPrices?: CoinPrices;
|
|
1540
|
+
}): Promise<{
|
|
1541
|
+
[x: string]: Lending | undefined;
|
|
1542
|
+
}>;
|
|
1543
|
+
/**
|
|
1544
|
+
* Get user lending and spool information for specific pool.
|
|
1545
|
+
*
|
|
1546
|
+
* @param poolCoinName - Specific support pool coin name.
|
|
1547
|
+
* @param ownerAddress - The owner address.
|
|
1548
|
+
* @param indexer - Whether to use indexer.
|
|
1549
|
+
* @return Lending pool data.
|
|
1550
|
+
*/
|
|
1551
|
+
getLending(poolCoinName: string, ownerAddress?: string, args?: {
|
|
1552
|
+
indexer?: boolean;
|
|
1553
|
+
}): Promise<Lending>;
|
|
1554
|
+
/**
|
|
1555
|
+
* Get user all obligation accounts information.
|
|
1556
|
+
*
|
|
1557
|
+
* @description
|
|
1558
|
+
* All collateral and borrowing information in all obligation accounts owned by the user.
|
|
1559
|
+
*
|
|
1560
|
+
* @param ownerAddress - The owner address.
|
|
1561
|
+
* @param indexer - Whether to use indexer.
|
|
1562
|
+
* @return All obligation accounts information.
|
|
1563
|
+
*/
|
|
1564
|
+
getObligationAccounts(ownerAddress?: string, args?: {
|
|
1565
|
+
indexer?: boolean;
|
|
1566
|
+
market?: {
|
|
1567
|
+
collaterals: MarketCollaterals;
|
|
1568
|
+
pools: MarketPools;
|
|
1569
|
+
};
|
|
1570
|
+
coinPrices?: CoinPrices;
|
|
1571
|
+
}): Promise<{
|
|
1572
|
+
[x: string]: ObligationAccount | undefined;
|
|
1573
|
+
}>;
|
|
1574
|
+
/**
|
|
1575
|
+
* Get obligation account information for specific id.
|
|
1576
|
+
*
|
|
1577
|
+
* @description
|
|
1578
|
+
* borrowing and obligation information for specific pool.
|
|
1579
|
+
*
|
|
1580
|
+
* @param obligationId - The obligation id.
|
|
1581
|
+
* @param ownerAddress - The owner address.
|
|
1582
|
+
* @param indexer - Whether to use indexer.
|
|
1583
|
+
* @return Borrowing and collateral information.
|
|
1584
|
+
*/
|
|
1585
|
+
getObligationAccount(obligationId: string, ownerAddress?: string, args?: {
|
|
1586
|
+
indexer?: boolean;
|
|
1587
|
+
}): Promise<ObligationAccount | undefined>;
|
|
1588
|
+
/**
|
|
1589
|
+
* Get total value locked.
|
|
1590
|
+
*
|
|
1591
|
+
* @param indexer - Whether to use indexer.
|
|
1592
|
+
* @description
|
|
1593
|
+
* Include total supplied value and total borrowed value.
|
|
1594
|
+
*
|
|
1595
|
+
* @return Total value locked.
|
|
1596
|
+
*/
|
|
1597
|
+
getTvl(args?: {
|
|
1598
|
+
indexer?: boolean;
|
|
1599
|
+
}): Promise<TotalValueLocked>;
|
|
1600
|
+
/**
|
|
1601
|
+
* Get veSca data.
|
|
1602
|
+
* @param veScaKey
|
|
1603
|
+
* @returns veSca
|
|
1604
|
+
*/
|
|
1605
|
+
getVeSca(veScaKey: string | SuiObjectData$1): Promise<Vesca | undefined>;
|
|
1606
|
+
/**
|
|
1607
|
+
* Get all veSca from walletAdddress
|
|
1608
|
+
* @param walletAddress
|
|
1609
|
+
* @returns array of veSca
|
|
1610
|
+
*/
|
|
1611
|
+
getVeScas({ walletAddress, excludeEmpty, }?: {
|
|
1612
|
+
walletAddress?: string;
|
|
1613
|
+
excludeEmpty?: boolean;
|
|
1614
|
+
}): Promise<Vesca[]>;
|
|
1615
|
+
/**
|
|
1616
|
+
* Get total vesca treasury with movecall
|
|
1617
|
+
* @returns Promise<string | undefined>
|
|
1618
|
+
*/
|
|
1619
|
+
getVeScaTreasuryInfo(): Promise<VeScaTreasuryInfo | null>;
|
|
1620
|
+
/**
|
|
1621
|
+
* Return binded referrer veScaKeyId of referee walletAddress if exist
|
|
1622
|
+
* @param walletAddress
|
|
1623
|
+
* @returns veScaKeyId
|
|
1624
|
+
*/
|
|
1625
|
+
getVeScaKeyIdFromReferralBindings(walletAddress?: string): Promise<string | null>;
|
|
1626
|
+
/**
|
|
1627
|
+
* Get binded obligationId from a veScaKey if it exists.
|
|
1628
|
+
* @param veScaKey
|
|
1629
|
+
* @returns obligationId
|
|
1630
|
+
*/
|
|
1631
|
+
getBindedObligationId(veScaKey: string): Promise<string | null>;
|
|
1632
|
+
/**
|
|
1633
|
+
* Get binded veSCA key from a obligationId if it exists.
|
|
1634
|
+
* @param obligationId
|
|
1635
|
+
* @returns veScaKey
|
|
1636
|
+
*/
|
|
1637
|
+
getBindedVeScaKey(obligationId: string): Promise<string | null>;
|
|
1638
|
+
/**
|
|
1639
|
+
* Get user's veSCA loyalty program informations
|
|
1640
|
+
* @param veScaKey
|
|
1641
|
+
* @returns Loyalty program information
|
|
1642
|
+
*/
|
|
1643
|
+
getLoyaltyProgramInfos(veScaKey?: string | SuiObjectData$1): Promise<LoyaltyProgramInfo | null>;
|
|
1644
|
+
/**
|
|
1645
|
+
* Get user's veSCA rewards informations from loyalty program
|
|
1646
|
+
* @param veScaKey
|
|
1647
|
+
* @returns Loyalty program information
|
|
1648
|
+
*/
|
|
1649
|
+
getVeScaLoyaltyProgramInfos(veScaKey?: string | SuiObjectData$1): Promise<VeScaLoyaltyProgramInfo | null>;
|
|
1650
|
+
/**
|
|
1651
|
+
* Get total supply of sCoin
|
|
1652
|
+
* @param sCoinName - Supported sCoin name
|
|
1653
|
+
* @returns Total Supply
|
|
1654
|
+
*/
|
|
1655
|
+
getSCoinTotalSupply(sCoinName: string): Promise<number>;
|
|
1656
|
+
/**
|
|
1657
|
+
* Get all sCoin amounts.
|
|
1658
|
+
*
|
|
1659
|
+
* @param sCoinNames - Specific an array of support sCoin name.
|
|
1660
|
+
* @param ownerAddress - The owner address.
|
|
1661
|
+
* @return All market sCoin amounts.
|
|
1662
|
+
*/
|
|
1663
|
+
getSCoinAmounts(sCoinNames?: string[], ownerAddress?: string): Promise<OptionalKeys<Record<string, number>>>;
|
|
1664
|
+
/**
|
|
1665
|
+
* Get sCoin amount.
|
|
1666
|
+
*
|
|
1667
|
+
* @param coinNames - Specific support sCoin name.
|
|
1668
|
+
* @param ownerAddress - The owner address.
|
|
1669
|
+
* @return sCoin amount.
|
|
1670
|
+
*/
|
|
1671
|
+
getSCoinAmount(sCoinName: string | string, ownerAddress?: string): Promise<number>;
|
|
1672
|
+
/**
|
|
1673
|
+
* Get swap rate from sCoin A to sCoin B
|
|
1674
|
+
* @param assetCoinNames
|
|
1675
|
+
* @returns
|
|
1676
|
+
*/
|
|
1677
|
+
getSCoinSwapRate(fromSCoin: string, toSCoin: string): Promise<number>;
|
|
1678
|
+
getFlashLoanFees(assetCoinNames?: string[]): Promise<Record<string, number>>;
|
|
1679
|
+
/**
|
|
1680
|
+
* Get supply limit of lending pool
|
|
1681
|
+
*/
|
|
1682
|
+
getPoolSupplyLimit(poolName: string): Promise<string | null>;
|
|
1683
|
+
/**
|
|
1684
|
+
* Get borrow limit of borrow pool
|
|
1685
|
+
*/
|
|
1686
|
+
getPoolBorrowLimit(poolName: string): Promise<string | null>;
|
|
1687
|
+
/**
|
|
1688
|
+
* Get list of isolated assets
|
|
1689
|
+
*/
|
|
1690
|
+
getIsolatedAssets(useOnChainQuery?: boolean): Promise<string[]>;
|
|
1691
|
+
/**
|
|
1692
|
+
* Check if asset is an isolated asset
|
|
1693
|
+
*/
|
|
1694
|
+
isIsolatedAsset(assetCoinName: string): Promise<boolean>;
|
|
1695
|
+
/**
|
|
1696
|
+
* Get pool coin price from indexer
|
|
1697
|
+
* @param coinName
|
|
1698
|
+
* @returns price data
|
|
1699
|
+
*/
|
|
1700
|
+
getCoinPriceByIndexer(poolName: string): Promise<number>;
|
|
1701
|
+
/**
|
|
1702
|
+
* Get all supported pool price from indexer
|
|
1703
|
+
* @returns prices data
|
|
1704
|
+
*/
|
|
1705
|
+
getCoinPricesByIndexer(): Promise<Record<string, number>>;
|
|
1706
|
+
/**
|
|
1707
|
+
* Get all coin prices, including sCoin
|
|
1708
|
+
* @returns prices data
|
|
1709
|
+
*/
|
|
1710
|
+
getAllCoinPrices(args?: {
|
|
1711
|
+
marketPools?: MarketPools;
|
|
1712
|
+
coinPrices?: CoinPrices;
|
|
1713
|
+
indexer?: boolean;
|
|
1714
|
+
}): Promise<{
|
|
1715
|
+
[x: string]: number | undefined;
|
|
1716
|
+
}>;
|
|
1717
|
+
/**
|
|
1718
|
+
* Query all address (lending pool, collateral pool, borrow dynamics, interest models, etc.) of all pool
|
|
1719
|
+
* @returns
|
|
1720
|
+
*/
|
|
1721
|
+
getPoolAddresses(apiAddressId?: string | undefined): Promise<OptionalKeys<Record<string, PoolAddress>>>;
|
|
1722
|
+
/**
|
|
1723
|
+
* Get user portfolio
|
|
1724
|
+
*/
|
|
1725
|
+
getUserPortfolio(args?: {
|
|
1726
|
+
walletAddress?: string;
|
|
1727
|
+
indexer?: boolean;
|
|
1728
|
+
}): Promise<{
|
|
1729
|
+
totalLockedScaValue: number;
|
|
1730
|
+
lendings: {
|
|
1731
|
+
suppliedCoin: number;
|
|
1732
|
+
suppliedValue: number;
|
|
1733
|
+
stakedCoin: number;
|
|
1734
|
+
coinName: string;
|
|
1735
|
+
symbol: string;
|
|
1736
|
+
coinType: string;
|
|
1737
|
+
coinPrice: number;
|
|
1738
|
+
coinDecimals: number;
|
|
1739
|
+
supplyApr: number;
|
|
1740
|
+
supplyApy: number;
|
|
1741
|
+
incentiveApr: number;
|
|
1742
|
+
}[];
|
|
1743
|
+
borrowings: {
|
|
1744
|
+
obligationId: string;
|
|
1745
|
+
totalDebtsInUsd: number;
|
|
1746
|
+
totalCollateralInUsd: number;
|
|
1747
|
+
riskLevel: number;
|
|
1748
|
+
availableCollateralInUsd: number;
|
|
1749
|
+
totalUnhealthyCollateralInUsd: number;
|
|
1750
|
+
collaterals: {
|
|
1751
|
+
coinName: string;
|
|
1752
|
+
symbol: string;
|
|
1753
|
+
coinDecimals: number;
|
|
1754
|
+
coinType: string;
|
|
1755
|
+
coinPrice: number;
|
|
1756
|
+
depositedCoin: number;
|
|
1757
|
+
depositedValueInUsd: number;
|
|
1758
|
+
}[];
|
|
1759
|
+
borrowedPools: {
|
|
1760
|
+
coinName: string;
|
|
1761
|
+
symbol: string;
|
|
1762
|
+
coinDecimals: number;
|
|
1763
|
+
coinType: string;
|
|
1764
|
+
coinPrice: number;
|
|
1765
|
+
borrowedCoin: number;
|
|
1766
|
+
borrowedValueInUsd: number;
|
|
1767
|
+
borrowApr: number | undefined;
|
|
1768
|
+
borrowApy: number | undefined;
|
|
1769
|
+
incentiveInfos: {
|
|
1770
|
+
coinName: string;
|
|
1771
|
+
symbol: string;
|
|
1772
|
+
coinType: string;
|
|
1773
|
+
incentiveApr: number;
|
|
1774
|
+
}[];
|
|
1775
|
+
}[];
|
|
1776
|
+
}[];
|
|
1777
|
+
pendingRewards: {
|
|
1778
|
+
lendings: any;
|
|
1779
|
+
borrowIncentives: any;
|
|
1780
|
+
};
|
|
1781
|
+
veScas: {
|
|
1782
|
+
veScaKey: string;
|
|
1783
|
+
coinPrice: number;
|
|
1784
|
+
lockedScaInCoin: number;
|
|
1785
|
+
lockedScaInUsd: number;
|
|
1786
|
+
currentVeScaBalance: number;
|
|
1787
|
+
remainingLockPeriodInDays: number;
|
|
1788
|
+
unlockAt: number;
|
|
1789
|
+
}[];
|
|
1790
|
+
totalDebtValue: number;
|
|
1791
|
+
totalCollateralValue: number;
|
|
1792
|
+
totalSupplyValue: number;
|
|
1793
|
+
}>;
|
|
1794
|
+
/**
|
|
1795
|
+
* Get both primary and secondary price update policy objects
|
|
1796
|
+
* @returns price update policies
|
|
1797
|
+
*/
|
|
1798
|
+
getPriceUpdatePolicies(): Promise<{
|
|
1799
|
+
primary: _mysten_sui_dist_cjs_client.SuiObjectResponse | null;
|
|
1800
|
+
secondary: _mysten_sui_dist_cjs_client.SuiObjectResponse | null;
|
|
1801
|
+
}>;
|
|
1802
|
+
/**
|
|
1803
|
+
* Return the supported primary and secondary oracles for all supported pool assets
|
|
1804
|
+
*/
|
|
1805
|
+
getAssetOracles(): Promise<Record<string, xOracleRules>>;
|
|
1806
|
+
/**
|
|
1807
|
+
* Get switchboard on-demand aggregator object id based on coinType
|
|
1808
|
+
* @param coinType
|
|
1809
|
+
* @returns
|
|
1810
|
+
*/
|
|
1811
|
+
getSwitchboardOnDemandAggregatorObjectIds(coinName: string[]): Promise<string[]>;
|
|
1812
|
+
}
|
|
1813
|
+
|
|
1814
|
+
type CoreIds = {
|
|
1815
|
+
protocolPkg: string;
|
|
1816
|
+
market: string;
|
|
1817
|
+
version: string;
|
|
1818
|
+
coinDecimalsRegistry: string;
|
|
1819
|
+
xOracle: string;
|
|
1820
|
+
};
|
|
1821
|
+
type NestedResult = Extract<Argument, {
|
|
1822
|
+
$kind: 'NestedResult';
|
|
1823
|
+
}>;
|
|
1824
|
+
type Obligation = NestedResult;
|
|
1825
|
+
type ObligationKey = NestedResult;
|
|
1826
|
+
type ObligationHotPotato = NestedResult;
|
|
1827
|
+
type CoreNormalMethods = {
|
|
1828
|
+
openObligation: () => [Obligation, ObligationKey, ObligationHotPotato];
|
|
1829
|
+
returnObligation: (obligation: SuiObjectArg, obligationHotPotato: SuiObjectArg) => void;
|
|
1830
|
+
openObligationEntry: () => void;
|
|
1831
|
+
addCollateral: (obligation: SuiObjectArg, coin: SuiObjectArg, collateralCoinName: string) => void;
|
|
1832
|
+
takeCollateral: (obligation: SuiObjectArg, obligationKey: SuiObjectArg, amount: number, collateralCoinName: string) => TransactionResult;
|
|
1833
|
+
deposit: (coin: SuiObjectArg, poolCoinName: string) => TransactionResult;
|
|
1834
|
+
depositEntry: (coin: SuiObjectArg, poolCoinName: string) => TransactionResult;
|
|
1835
|
+
withdraw: (marketCoin: SuiObjectArg, poolCoinName: string) => TransactionResult;
|
|
1836
|
+
withdrawEntry: (marketCoin: SuiObjectArg, poolCoinName: string) => TransactionResult;
|
|
1837
|
+
borrow: (obligation: SuiObjectArg, obligationKey: SuiObjectArg, amount: number, poolCoinName: string) => TransactionResult;
|
|
1838
|
+
borrowWithReferral: (obligation: SuiObjectArg, obligationKey: SuiObjectArg, borrowReferral: SuiObjectArg, amount: number | SuiTxArg, poolCoinName: string) => TransactionResult;
|
|
1839
|
+
borrowEntry: (obligation: SuiObjectArg, obligationKey: SuiObjectArg, amount: number, poolCoinName: string) => TransactionResult;
|
|
1840
|
+
repay: (obligation: SuiObjectArg, coin: SuiObjectArg, poolCoinName: string) => void;
|
|
1841
|
+
borrowFlashLoan: (amount: number | SuiTxArg, poolCoinName: string) => TransactionResult;
|
|
1842
|
+
repayFlashLoan: (coin: SuiObjectArg, loan: SuiObjectArg, poolCoinName: string) => void;
|
|
1843
|
+
};
|
|
1844
|
+
type CoreQuickMethods = {
|
|
1845
|
+
addCollateralQuick: (amount: number, collateralCoinName: string, obligationId?: SuiObjectArg) => Promise<void>;
|
|
1846
|
+
takeCollateralQuick: (amount: number, collateralCoinName: string, obligationId?: SuiObjectArg, obligationKey?: SuiObjectArg) => Promise<TransactionResult>;
|
|
1847
|
+
borrowQuick: (amount: number, poolCoinName: string, obligationId?: SuiObjectArg, obligationKey?: SuiObjectArg) => Promise<TransactionResult>;
|
|
1848
|
+
borrowWithReferralQuick: (amount: number, poolCoinName: string, borrowReferral: SuiObjectArg, obligationId?: SuiObjectArg, obligationKey?: SuiObjectArg) => Promise<TransactionResult>;
|
|
1849
|
+
depositQuick: (amount: number, poolCoinName: string, returnSCoin?: boolean) => Promise<TransactionResult>;
|
|
1850
|
+
withdrawQuick: (amount: number, poolCoinName: string) => Promise<TransactionResult>;
|
|
1851
|
+
repayQuick: (amount: number, poolCoinName: string, obligationId?: SuiObjectArg) => Promise<void>;
|
|
1852
|
+
updateAssetPricesQuick: (assetCoinNames?: string[]) => Promise<void>;
|
|
1853
|
+
};
|
|
1854
|
+
type SuiTxBlockWithCoreNormalMethods = SuiTxBlock & SuiTxBlockWithSpool & CoreNormalMethods;
|
|
1855
|
+
type CoreTxBlock = SuiTxBlockWithCoreNormalMethods & CoreQuickMethods;
|
|
1856
|
+
type GenerateCoreNormalMethod = (params: {
|
|
1857
|
+
builder: ScallopBuilder;
|
|
1858
|
+
txBlock: SuiTxBlock;
|
|
1859
|
+
}) => CoreNormalMethods;
|
|
1860
|
+
type GenerateCoreQuickMethod = (params: {
|
|
1861
|
+
builder: ScallopBuilder;
|
|
1862
|
+
txBlock: SuiTxBlockWithCoreNormalMethods;
|
|
1863
|
+
}) => CoreQuickMethods;
|
|
1864
|
+
|
|
1865
|
+
type SpoolIds = {
|
|
1866
|
+
spoolPkg: string;
|
|
1867
|
+
};
|
|
1868
|
+
type SpoolNormalMethods = {
|
|
1869
|
+
createStakeAccount: (stakeMarketCoinName: string) => TransactionResult;
|
|
1870
|
+
stake: (stakeAccount: SuiAddressArg, coin: SuiObjectArg, stakeMarketCoinName: string) => void;
|
|
1871
|
+
unstake: (stakeAccount: SuiAddressArg, amount: number, stakeMarketCoinName: string) => TransactionResult;
|
|
1872
|
+
claim: (stakeAccount: SuiAddressArg, stakeMarketCoinName: string) => TransactionResult;
|
|
1873
|
+
};
|
|
1874
|
+
type SpoolQuickMethods = {
|
|
1875
|
+
stakeQuick(amountOrMarketCoin: SuiObjectArg | number, stakeMarketCoinName: string, stakeAccountId?: SuiAddressArg): Promise<void>;
|
|
1876
|
+
unstakeQuick(amount: number, stakeMarketCoinName: string, stakeAccountId?: SuiAddressArg, returnSCoin?: boolean): Promise<TransactionResult | undefined>;
|
|
1877
|
+
claimQuick(stakeMarketCoinName: string, stakeAccountId?: SuiAddressArg): Promise<TransactionResult[]>;
|
|
1878
|
+
};
|
|
1879
|
+
type SuiTxBlockWithSpoolNormalMethods = SuiTxBlock & SuiTxBlockWithSCoin & SpoolNormalMethods;
|
|
1880
|
+
type SpoolTxBlock = SuiTxBlockWithSpoolNormalMethods & SpoolQuickMethods;
|
|
1881
|
+
type GenerateSpoolNormalMethod = (params: {
|
|
1882
|
+
builder: ScallopBuilder;
|
|
1883
|
+
txBlock: SuiTxBlock;
|
|
1884
|
+
}) => SpoolNormalMethods;
|
|
1885
|
+
type GenerateSpoolQuickMethod = (params: {
|
|
1886
|
+
builder: ScallopBuilder;
|
|
1887
|
+
txBlock: SuiTxBlockWithSpoolNormalMethods;
|
|
1888
|
+
}) => SpoolQuickMethods;
|
|
1889
|
+
|
|
1890
|
+
type BorrowIncentiveIds = {
|
|
1891
|
+
borrowIncentivePkg: string;
|
|
1892
|
+
query: string;
|
|
1893
|
+
config: string;
|
|
1894
|
+
incentivePools: string;
|
|
1895
|
+
incentiveAccounts: string;
|
|
1896
|
+
obligationAccessStore: string;
|
|
1897
|
+
};
|
|
1898
|
+
type BorrowIncentiveNormalMethods = {
|
|
1899
|
+
stakeObligation: (obligation: SuiObjectArg, obligationKey: SuiObjectArg) => void;
|
|
1900
|
+
stakeObligationWithVesca: (obligation: SuiObjectArg, obligationKey: SuiObjectArg, veScaKey: SuiObjectArg) => void;
|
|
1901
|
+
unstakeObligation: (obligation: SuiObjectArg, obligationKey: SuiObjectArg) => void;
|
|
1902
|
+
claimBorrowIncentive: (obligation: SuiObjectArg, obligationKey: SuiObjectArg, rewardType: string) => TransactionResult;
|
|
1903
|
+
deactivateBoost: (obligation: SuiObjectArg, veScaKey: SuiObjectArg) => void;
|
|
1904
|
+
};
|
|
1905
|
+
type BorrowIncentiveQuickMethods = {
|
|
1906
|
+
stakeObligationQuick(obligation?: string, obligationKey?: string): Promise<void>;
|
|
1907
|
+
stakeObligationWithVeScaQuick(obligation?: string, obligationKey?: string, veScaKey?: string): Promise<void>;
|
|
1908
|
+
unstakeObligationQuick(obligation?: string, obligationKey?: string): Promise<void>;
|
|
1909
|
+
claimBorrowIncentiveQuick(rewardType: string, obligation?: string, obligationKey?: string): Promise<TransactionResult>;
|
|
1910
|
+
};
|
|
1911
|
+
type SuiTxBlockWithBorrowIncentiveNormalMethods = SuiTxBlock & BorrowIncentiveNormalMethods;
|
|
1912
|
+
type BorrowIncentiveTxBlock = SuiTxBlockWithBorrowIncentiveNormalMethods & BorrowIncentiveQuickMethods;
|
|
1913
|
+
type GenerateBorrowIncentiveNormalMethod = (params: {
|
|
1914
|
+
builder: ScallopBuilder;
|
|
1915
|
+
txBlock: SuiTxBlock;
|
|
1916
|
+
}) => BorrowIncentiveNormalMethods;
|
|
1917
|
+
type GenerateBorrowIncentiveQuickMethod = (params: {
|
|
1918
|
+
builder: ScallopBuilder;
|
|
1919
|
+
txBlock: SuiTxBlockWithBorrowIncentiveNormalMethods;
|
|
1920
|
+
}) => BorrowIncentiveQuickMethods;
|
|
1921
|
+
|
|
1922
|
+
type VeScaNormalMethods = {
|
|
1923
|
+
lockSca: (scaCoin: SuiObjectArg, unlockAtInSecondTimestamp: number) => TransactionResult;
|
|
1924
|
+
extendLockPeriod: (veScaKey: SuiObjectArg, newUnlockAtInSecondTimestamp: number) => void;
|
|
1925
|
+
extendLockAmount: (veScaKey: SuiObjectArg, scaCoin: SuiObjectArg) => void;
|
|
1926
|
+
renewExpiredVeSca: (veScaKey: SuiObjectArg, scaCoin: SuiObjectArg, newUnlockAtInSecondTimestamp: number) => void;
|
|
1927
|
+
redeemSca: (veScaKey: SuiObjectArg) => TransactionResult;
|
|
1928
|
+
mintEmptyVeSca: () => TransactionResult;
|
|
1929
|
+
splitVeSca: (veScaKey: SuiObjectArg, splitAmount: string) => TransactionResult;
|
|
1930
|
+
mergeVeSca: (targetVeScaKey: SuiObjectArg, sourceVeScaKey: SuiObjectArg) => void;
|
|
1931
|
+
};
|
|
1932
|
+
type QuickMethodReturnType<T extends boolean> = T extends true ? void : TransactionResult;
|
|
1933
|
+
type VeScaQuickMethods = {
|
|
1934
|
+
/**
|
|
1935
|
+
* Quick methods to automate
|
|
1936
|
+
* lock initial SCA, extend lock period, lock more SCA, renew expired VeSCA, and redeem SCA
|
|
1937
|
+
*
|
|
1938
|
+
* **Flow:**
|
|
1939
|
+
* - If only `amountOrCoin` is provided, it will lock the amount of existing not expired veSCA
|
|
1940
|
+
* - If only `lockPeriodInDays` is provided, it will extend the lock period of existing not expired veSCA
|
|
1941
|
+
*
|
|
1942
|
+
* **Note:**
|
|
1943
|
+
* - If one or both flow above is used on a expired veSCA, it will claim the unlocked SCA
|
|
1944
|
+
* and renew the veSCA first, and then flow continues
|
|
1945
|
+
* - If users has no veSCA yet, they need to provide both `amountOrCoin` and `lockPeriodInDays` for initial lock
|
|
1946
|
+
* @param amountOrCoin
|
|
1947
|
+
* @param lockPeriodInDays
|
|
1948
|
+
* @param autoCheck
|
|
1949
|
+
*/
|
|
1950
|
+
lockScaQuick(params: {
|
|
1951
|
+
amountOrCoin?: SuiObjectArg | number;
|
|
1952
|
+
lockPeriodInDays?: number;
|
|
1953
|
+
autoCheck?: boolean;
|
|
1954
|
+
veScaKey?: SuiObjectData | string;
|
|
1955
|
+
}): Promise<void>;
|
|
1956
|
+
extendLockPeriodQuick: (params: {
|
|
1957
|
+
lockPeriodInDays: number;
|
|
1958
|
+
autoCheck?: boolean;
|
|
1959
|
+
veScaKey?: SuiObjectData | string;
|
|
1960
|
+
}) => Promise<void>;
|
|
1961
|
+
extendLockAmountQuick: (params: {
|
|
1962
|
+
scaAmount: number;
|
|
1963
|
+
autoCheck?: boolean;
|
|
1964
|
+
veScaKey?: SuiObjectData | string;
|
|
1965
|
+
}) => Promise<void>;
|
|
1966
|
+
renewExpiredVeScaQuick: (params: {
|
|
1967
|
+
scaAmount: number;
|
|
1968
|
+
lockPeriodInDays: number;
|
|
1969
|
+
autoCheck?: boolean;
|
|
1970
|
+
veScaKey?: SuiObjectData | string;
|
|
1971
|
+
}) => Promise<void>;
|
|
1972
|
+
redeemScaQuick: <T extends boolean>(params: {
|
|
1973
|
+
veScaKey?: SuiObjectData | string;
|
|
1974
|
+
transferSca?: T;
|
|
1975
|
+
}) => Promise<QuickMethodReturnType<T> | undefined>;
|
|
1976
|
+
splitVeScaQuick: <T extends boolean>(params: {
|
|
1977
|
+
splitAmount: string;
|
|
1978
|
+
veScaKey: string;
|
|
1979
|
+
transferVeScaKey?: T;
|
|
1980
|
+
}) => Promise<QuickMethodReturnType<T> | undefined>;
|
|
1981
|
+
mergeVeScaQuick: (params: {
|
|
1982
|
+
targetVeScaKey: string;
|
|
1983
|
+
sourceVeScaKey: string;
|
|
1984
|
+
}) => Promise<void>;
|
|
1985
|
+
};
|
|
1986
|
+
type SuiTxBlockWithVeScaNormalMethods = SuiTxBlock & VeScaNormalMethods;
|
|
1987
|
+
type VeScaTxBlock = SuiTxBlockWithVeScaNormalMethods & VeScaQuickMethods;
|
|
1988
|
+
type GenerateVeScaNormalMethod = (params: {
|
|
1989
|
+
builder: ScallopBuilder;
|
|
1990
|
+
txBlock: SuiTxBlock;
|
|
1991
|
+
}) => VeScaNormalMethods;
|
|
1992
|
+
type GenerateVeScaQuickMethod = (params: {
|
|
1993
|
+
builder: ScallopBuilder;
|
|
1994
|
+
txBlock: SuiTxBlockWithVeScaNormalMethods;
|
|
1995
|
+
}) => VeScaQuickMethods;
|
|
1996
|
+
|
|
1997
|
+
type ReferralNormalMethods = {
|
|
1998
|
+
bindToReferral: (veScaKeyId: string) => void;
|
|
1999
|
+
claimReferralTicket: (poolCoinName: string) => TransactionResult$1;
|
|
2000
|
+
burnReferralTicket: (ticket: SuiObjectArg, poolCoinName: string) => void;
|
|
2001
|
+
claimReferralRevenue: (veScaKey: SuiObjectArg, poolCoinName: string) => TransactionResult$1;
|
|
2002
|
+
};
|
|
2003
|
+
type ReferralQuickMethods = {
|
|
2004
|
+
claimReferralRevenueQuick: (veScaKey: SuiObjectArg, coinNames: string[]) => Promise<void>;
|
|
2005
|
+
};
|
|
2006
|
+
type SuiTxBlockWithReferralNormalMethods = SuiTxBlock & ReferralNormalMethods;
|
|
2007
|
+
type ReferralTxBlock = SuiTxBlockWithReferralNormalMethods & ReferralQuickMethods;
|
|
2008
|
+
|
|
2009
|
+
type LoyaltyProgramNormalMethods = {
|
|
2010
|
+
claimLoyaltyRevenue: (veScaKey: SuiObjectArg) => TransactionResult$1;
|
|
2011
|
+
claimVeScaLoyaltyReward: (veScaKey: SuiObjectArg) => TransactionResult$1;
|
|
2012
|
+
};
|
|
2013
|
+
type LoyaltyProgramQuickMethods = {
|
|
2014
|
+
claimLoyaltyRevenueQuick: (veScaKey?: SuiObjectArg) => Promise<void>;
|
|
2015
|
+
claimVeScaLoyaltyRewardQuick: (veScaKey?: SuiObjectArg) => Promise<void>;
|
|
2016
|
+
};
|
|
2017
|
+
type SuiTxBlockWithLoyaltyProgramNormalMethods = SuiTxBlock & LoyaltyProgramNormalMethods;
|
|
2018
|
+
type LoyaltyProgramTxBlock = SuiTxBlockWithLoyaltyProgramNormalMethods & LoyaltyProgramQuickMethods;
|
|
2019
|
+
type GenerateLoyaltyProgramNormalMethod = (params: {
|
|
2020
|
+
builder: ScallopBuilder;
|
|
2021
|
+
txBlock: SuiTxBlock;
|
|
2022
|
+
}) => LoyaltyProgramNormalMethods;
|
|
2023
|
+
type GenerateLoyaltyProgramQuickMethod = (params: {
|
|
2024
|
+
builder: ScallopBuilder;
|
|
2025
|
+
txBlock: SuiTxBlockWithLoyaltyProgramNormalMethods;
|
|
2026
|
+
}) => LoyaltyProgramQuickMethods;
|
|
2027
|
+
|
|
2028
|
+
type sCoinPkgIds = {
|
|
2029
|
+
pkgId: string;
|
|
2030
|
+
};
|
|
2031
|
+
type sCoinNormalMethods = {
|
|
2032
|
+
/**
|
|
2033
|
+
* Lock marketCoin and return sCoin
|
|
2034
|
+
* @param marketCoinName
|
|
2035
|
+
* @param marketCoin
|
|
2036
|
+
* @returns
|
|
2037
|
+
*/
|
|
2038
|
+
mintSCoin: (marketCoinName: string, marketCoin: SuiObjectArg) => TransactionResult$1;
|
|
2039
|
+
/**
|
|
2040
|
+
* Burn sCoin and return marketCoin
|
|
2041
|
+
* @param sCoinName
|
|
2042
|
+
* @param sCoin
|
|
2043
|
+
* @returns
|
|
2044
|
+
*/
|
|
2045
|
+
burnSCoin: (sCoinName: string, sCoin: SuiObjectArg) => TransactionResult$1;
|
|
2046
|
+
};
|
|
2047
|
+
type sCoinQuickMethods = {
|
|
2048
|
+
mintSCoinQuick: (marketCoinName: string, amount: number) => Promise<TransactionResult$1>;
|
|
2049
|
+
burnSCoinQuick: (sCoinName: string, amount: number) => Promise<TransactionResult$1>;
|
|
2050
|
+
};
|
|
2051
|
+
type SuiTxBlockWithSCoinNormalMethods = SuiTxBlock & BaseScallopTxBlock & sCoinNormalMethods;
|
|
2052
|
+
type SCoinTxBlock = SuiTxBlockWithSCoinNormalMethods & sCoinQuickMethods;
|
|
2053
|
+
type GenerateSCoinNormalMethod = (params: {
|
|
2054
|
+
builder: ScallopBuilder;
|
|
2055
|
+
txBlock: SuiTxBlock;
|
|
2056
|
+
}) => sCoinNormalMethods;
|
|
2057
|
+
type GenerateSCoinQuickMethod = (params: {
|
|
2058
|
+
builder: ScallopBuilder;
|
|
2059
|
+
txBlock: SuiTxBlockWithSCoinNormalMethods;
|
|
2060
|
+
}) => sCoinQuickMethods;
|
|
2061
|
+
|
|
2062
|
+
type BaseScallopTxBlock = ReferralTxBlock & LoyaltyProgramTxBlock & BorrowIncentiveTxBlock & VeScaTxBlock;
|
|
2063
|
+
type SuiTxBlockWithSCoin = BaseScallopTxBlock & SCoinTxBlock;
|
|
2064
|
+
type SuiTxBlockWithSpool = SuiTxBlockWithSCoin & SpoolTxBlock;
|
|
2065
|
+
type ScallopTxBlock = SuiTxBlockWithSpool & CoreTxBlock;
|
|
2066
|
+
type SelectCoinReturnType<T extends string> = T extends 'sui' ? {
|
|
2067
|
+
takeCoin: NestedResult;
|
|
2068
|
+
} : {
|
|
2069
|
+
takeCoin: NestedResult;
|
|
2070
|
+
leftCoin: NestedResult;
|
|
2071
|
+
};
|
|
2072
|
+
|
|
2073
|
+
type ScallopBuilderParams = {
|
|
2074
|
+
query?: ScallopQuery;
|
|
2075
|
+
usePythPullModel?: boolean;
|
|
2076
|
+
pythSponsoredFeeds?: string[];
|
|
2077
|
+
useOnChainXOracleList?: boolean;
|
|
2078
|
+
} & ScallopQueryParams;
|
|
2079
|
+
/**
|
|
2080
|
+
* @description
|
|
2081
|
+
* It provides methods for operating the transaction block, making it more convenient to organize transaction combinations.
|
|
2082
|
+
*
|
|
2083
|
+
* @example
|
|
2084
|
+
* ```typescript
|
|
2085
|
+
* const scallopBuilder = new ScallopBuilder(<parameters>);
|
|
2086
|
+
* await scallopBuilder.init();
|
|
2087
|
+
* const txBlock = scallopBuilder.<builder functions>();
|
|
2088
|
+
* ```
|
|
2089
|
+
*/
|
|
2090
|
+
declare class ScallopBuilder implements ScallopBuilderInterface {
|
|
2091
|
+
readonly query: ScallopQuery;
|
|
2092
|
+
readonly usePythPullModel: boolean;
|
|
2093
|
+
readonly useOnChainXOracleList: boolean;
|
|
2094
|
+
readonly pythSponsoredFeeds: string[];
|
|
2095
|
+
constructor(params: ScallopBuilderParams);
|
|
2096
|
+
get utils(): ScallopUtils;
|
|
2097
|
+
get constants(): ScallopConstants;
|
|
2098
|
+
get walletAddress(): string;
|
|
2099
|
+
get scallopSuiKit(): ScallopSuiKit;
|
|
2100
|
+
get suiKit(): _scallop_io_sui_kit.SuiKit;
|
|
2101
|
+
get address(): ScallopConstants;
|
|
2102
|
+
/**
|
|
2103
|
+
* Request the scallop API to initialize data.
|
|
2104
|
+
*
|
|
2105
|
+
* @param force - Whether to force initialization.
|
|
2106
|
+
*/
|
|
2107
|
+
init(force?: boolean): Promise<void>;
|
|
2108
|
+
/**
|
|
2109
|
+
* Create a scallop txBlock instance that enhances transaction block.
|
|
2110
|
+
*
|
|
2111
|
+
* @param txBlock - Scallop txBlock, txBlock created by SuiKit, or original transaction block.
|
|
2112
|
+
* @return Scallop txBlock.
|
|
2113
|
+
*/
|
|
2114
|
+
createTxBlock(txBlock?: ScallopTxBlock | SuiTxBlock | Transaction$1): ScallopTxBlock;
|
|
2115
|
+
/**
|
|
2116
|
+
* Specifying the sender's amount of coins to get coins args from transaction result.
|
|
2117
|
+
*
|
|
2118
|
+
* @param txBlock - Scallop txBlock or txBlock created by SuiKit .
|
|
2119
|
+
* @param assetCoinName - Specific support asset coin name.
|
|
2120
|
+
* @param amount - Amount of coins to be selected.
|
|
2121
|
+
* @param sender - Sender address.
|
|
2122
|
+
* @return Take coin and left coin.
|
|
2123
|
+
*/
|
|
2124
|
+
selectCoin<T extends string>(txBlock: ScallopTxBlock | SuiTxBlock, assetCoinName: T, amount: number, sender?: string): Promise<SelectCoinReturnType<T>>;
|
|
2125
|
+
/**
|
|
2126
|
+
* Specifying the sender's amount of market coins to get coins args from transaction result.
|
|
2127
|
+
*
|
|
2128
|
+
* @param txBlock - Scallop txBlock or txBlock created by SuiKit .
|
|
2129
|
+
* @param marketCoinName - Specific support market coin name.
|
|
2130
|
+
* @param amount - Amount of coins to be selected.
|
|
2131
|
+
* @param sender - Sender address.
|
|
2132
|
+
* @return Take coin and left coin.
|
|
2133
|
+
*/
|
|
2134
|
+
selectMarketCoin(txBlock: ScallopTxBlock | SuiTxBlock, marketCoinName: string, amount: number, sender?: string): Promise<{
|
|
2135
|
+
takeCoin: TransactionObjectArgument;
|
|
2136
|
+
leftCoin: TransactionObjectArgument;
|
|
2137
|
+
totalAmount: number;
|
|
2138
|
+
}>;
|
|
2139
|
+
/**
|
|
2140
|
+
* Specifying the sender's amount of sCoins to get coins args from transaction result.
|
|
2141
|
+
*
|
|
2142
|
+
* @param txBlock - Scallop txBlock or txBlock created by SuiKit .
|
|
2143
|
+
* @param marketCoinName - Specific support sCoin name.
|
|
2144
|
+
* @param amount - Amount of coins to be selected.
|
|
2145
|
+
* @param sender - Sender address.
|
|
2146
|
+
* @return Take coin and left coin.
|
|
2147
|
+
*/
|
|
2148
|
+
selectSCoin(txBlock: ScallopTxBlock | SuiTxBlock, sCoinName: string, amount: number, sender?: string): Promise<{
|
|
2149
|
+
takeCoin: TransactionObjectArgument;
|
|
2150
|
+
leftCoin: TransactionObjectArgument;
|
|
2151
|
+
totalAmount: number;
|
|
2152
|
+
}>;
|
|
2153
|
+
/**
|
|
2154
|
+
* Select sCoin or market coin automatically. Prioritize sCoin first
|
|
2155
|
+
*/
|
|
2156
|
+
selectSCoinOrMarketCoin(txBlock: ScallopTxBlock | SuiTxBlock, sCoinName: string, amount: number, sender?: string): Promise<{
|
|
2157
|
+
sCoin: TransactionObjectArgument | undefined;
|
|
2158
|
+
marketCoin: TransactionObjectArgument | undefined;
|
|
2159
|
+
}>;
|
|
2160
|
+
/**
|
|
2161
|
+
* Execute Scallop txBlock using the `signAndSendTxn` methods in suikit.
|
|
2162
|
+
*
|
|
2163
|
+
* @param txBlock - Scallop txBlock, txBlock created by SuiKit, or original transaction block.
|
|
2164
|
+
*/
|
|
2165
|
+
signAndSendTxBlock(txBlock: ScallopTxBlock | SuiTxBlock | Transaction$1): Promise<SuiTransactionBlockResponse>;
|
|
2166
|
+
moveCall(txb: ScallopTxBlock | SuiTxBlock, target: string, args?: (SuiTxArg | SuiVecTxArg | SuiObjectArg | SuiAmountsArg)[], typeArgs?: string[]): _scallop_io_sui_kit.TransactionResult;
|
|
2167
|
+
}
|
|
2168
|
+
|
|
2169
|
+
interface ScallopBaseInterface {
|
|
2170
|
+
scallopSuiKit: ScallopSuiKit;
|
|
2171
|
+
constants: ScallopConstants;
|
|
2172
|
+
walletAddress: string;
|
|
2173
|
+
init: () => Promise<void>;
|
|
2174
|
+
}
|
|
2175
|
+
interface ScallopUtilsInterface extends ScallopBaseInterface {
|
|
2176
|
+
address: ScallopAddress;
|
|
2177
|
+
}
|
|
2178
|
+
interface ScallopQueryInterface extends ScallopUtilsInterface {
|
|
2179
|
+
utils: ScallopUtils;
|
|
2180
|
+
}
|
|
2181
|
+
interface ScallopBuilderInterface extends ScallopQueryInterface {
|
|
2182
|
+
query: ScallopQuery;
|
|
2183
|
+
}
|
|
2184
|
+
interface ScallopClientInterface extends ScallopBaseInterface {
|
|
2185
|
+
builder: ScallopBuilder;
|
|
2186
|
+
}
|
|
2187
|
+
|
|
2188
|
+
type ScallopUtilsParams = {
|
|
2189
|
+
pythEndpoints?: string[];
|
|
2190
|
+
scallopSuiKit?: ScallopSuiKit;
|
|
2191
|
+
scallopConstants?: ScallopConstants;
|
|
2192
|
+
} & ScallopSuiKitParams & ScallopConstantsParams;
|
|
2193
|
+
declare class ScallopUtils implements ScallopUtilsInterface {
|
|
2194
|
+
pythEndpoints: string[];
|
|
2195
|
+
readonly scallopSuiKit: ScallopSuiKit;
|
|
2196
|
+
readonly constants: ScallopConstants;
|
|
2197
|
+
constructor(params?: ScallopUtilsParams);
|
|
2198
|
+
get walletAddress(): string;
|
|
2199
|
+
get suiKit(): _scallop_io_sui_kit.SuiKit;
|
|
2200
|
+
get queryClient(): _tanstack_query_core.QueryClient;
|
|
2201
|
+
get address(): ScallopConstants;
|
|
2202
|
+
isSuiBridgeAsset(coinName: any): boolean;
|
|
2203
|
+
isWormholeAsset(coinName: any): boolean;
|
|
2204
|
+
isMarketCoin(coinName: string): boolean;
|
|
2205
|
+
init({ force }?: {
|
|
2206
|
+
force?: boolean;
|
|
2207
|
+
}): Promise<void>;
|
|
2208
|
+
/**
|
|
2209
|
+
* Convert market coin name to coin name.
|
|
2210
|
+
*
|
|
2211
|
+
* @param marketCoinName - Specific support market coin name.
|
|
2212
|
+
* @return Coin Name.
|
|
2213
|
+
*/
|
|
2214
|
+
parseCoinName<T extends string>(marketCoinName: string): T;
|
|
2215
|
+
/**
|
|
2216
|
+
* Convert coin name to symbol.
|
|
2217
|
+
*
|
|
2218
|
+
* @param coinName - Specific support coin name.
|
|
2219
|
+
* @return Symbol string.
|
|
2220
|
+
*/
|
|
2221
|
+
parseSymbol(coinName: string): string;
|
|
2222
|
+
/**
|
|
2223
|
+
* Convert coin name to coin type.
|
|
2224
|
+
*
|
|
2225
|
+
* @description
|
|
2226
|
+
* The Coin type of wormhole is fixed `coin:Coin`. Here using package id
|
|
2227
|
+
* to determine and return the type.
|
|
2228
|
+
*
|
|
2229
|
+
* @param coinPackageId - Package id of coin.
|
|
2230
|
+
* @param coinName - Specific support coin name.
|
|
2231
|
+
* @return Coin type.
|
|
2232
|
+
*/
|
|
2233
|
+
parseCoinType(coinName: string, useOldMarketCoin?: boolean): string;
|
|
2234
|
+
/**
|
|
2235
|
+
* Convert coin name to sCoin name.
|
|
2236
|
+
*
|
|
2237
|
+
* @param coinName - Specific support coin name.
|
|
2238
|
+
* @return sCoin name.
|
|
2239
|
+
*/
|
|
2240
|
+
parseSCoinName<T extends string>(coinName: string): T | undefined;
|
|
2241
|
+
/**
|
|
2242
|
+
* Convert sCoin name to market coin name.
|
|
2243
|
+
* This function will parse new sCoin name `scallop_...` to its old market coin name which is shorter
|
|
2244
|
+
* e.g: `scallop_sui -> ssui
|
|
2245
|
+
* if no `scallop_...` is encountered, return coinName
|
|
2246
|
+
* @return sCoin name
|
|
2247
|
+
*/
|
|
2248
|
+
parseSCoinTypeNameToMarketCoinName(coinName: string): string;
|
|
2249
|
+
/**
|
|
2250
|
+
* Convert sCoin name into sCoin type
|
|
2251
|
+
* @param sCoinName
|
|
2252
|
+
* @returns sCoin type
|
|
2253
|
+
*/
|
|
2254
|
+
parseSCoinType(sCoinName: string): string;
|
|
2255
|
+
/**
|
|
2256
|
+
* Convert sCoinType into sCoin name
|
|
2257
|
+
* @param sCoinType
|
|
2258
|
+
* @returns sCoin name
|
|
2259
|
+
*/
|
|
2260
|
+
parseSCoinNameFromType(sCoinType: string): string | undefined;
|
|
2261
|
+
/**
|
|
2262
|
+
* Convert sCoin name into its underlying coin type
|
|
2263
|
+
* @param sCoinName
|
|
2264
|
+
* @returns coin type
|
|
2265
|
+
*/
|
|
2266
|
+
parseUnderlyingSCoinType(sCoinName: string): string;
|
|
2267
|
+
/**
|
|
2268
|
+
* Get sCoin treasury id from sCoin name
|
|
2269
|
+
* @param sCoinName
|
|
2270
|
+
* @returns sCoin treasury id
|
|
2271
|
+
*/
|
|
2272
|
+
getSCoinTreasury(sCoinName: string): any;
|
|
2273
|
+
/**
|
|
2274
|
+
* Convert coin name to market coin type.
|
|
2275
|
+
*
|
|
2276
|
+
* @param coinPackageId - Package id of coin.
|
|
2277
|
+
* @param coinName - Specific support coin name.
|
|
2278
|
+
* @return Market coin type.
|
|
2279
|
+
*/
|
|
2280
|
+
parseMarketCoinType(coinName: string): string;
|
|
2281
|
+
/**
|
|
2282
|
+
* Convert coin name to market coin name.
|
|
2283
|
+
*
|
|
2284
|
+
* @param coinName - Specific support coin name.
|
|
2285
|
+
* @return Market coin name.
|
|
2286
|
+
*/
|
|
2287
|
+
parseMarketCoinName<T extends string>(coinName: string): T;
|
|
2288
|
+
/**
|
|
2289
|
+
* Get reward type of spool.
|
|
2290
|
+
*
|
|
2291
|
+
* @param stakeMarketCoinName - Support stake market coin.
|
|
2292
|
+
* @return Spool reward coin name.
|
|
2293
|
+
*/
|
|
2294
|
+
getSpoolRewardCoinName: () => string;
|
|
2295
|
+
/**
|
|
2296
|
+
* Get coin decimal.
|
|
2297
|
+
*
|
|
2298
|
+
* return Coin decimal.
|
|
2299
|
+
*/
|
|
2300
|
+
getCoinDecimal(coinName: string): number;
|
|
2301
|
+
/**
|
|
2302
|
+
* Get coin wrapped type.
|
|
2303
|
+
*
|
|
2304
|
+
* return Coin wrapped type.
|
|
2305
|
+
*/
|
|
2306
|
+
getCoinWrappedType(assetCoinName: string): CoinWrappedType;
|
|
2307
|
+
/**
|
|
2308
|
+
* Convert coin type to coin name.
|
|
2309
|
+
*
|
|
2310
|
+
* @description
|
|
2311
|
+
* The coin name cannot be obtained directly from the wormhole type. Here
|
|
2312
|
+
* the package id is used to determine and return a specific name.
|
|
2313
|
+
*
|
|
2314
|
+
* @param coinType - Specific support coin type.
|
|
2315
|
+
* @return Coin Name.
|
|
2316
|
+
*/
|
|
2317
|
+
parseCoinNameFromType(coinType: string): string;
|
|
2318
|
+
/**
|
|
2319
|
+
* Select coin id that add up to the given amount as transaction arguments.
|
|
2320
|
+
*
|
|
2321
|
+
* @param ownerAddress - The address of the owner.
|
|
2322
|
+
* @param amount - The amount that including coin decimals.
|
|
2323
|
+
* @param coinType - The coin type, default is 0x2::SUI::SUI.
|
|
2324
|
+
* @return The selected transaction coin arguments.
|
|
2325
|
+
*/
|
|
2326
|
+
selectCoins(amount: number, coinType?: string, ownerAddress?: string): Promise<{
|
|
2327
|
+
objectId: string;
|
|
2328
|
+
digest: string;
|
|
2329
|
+
version: string;
|
|
2330
|
+
balance: string;
|
|
2331
|
+
}[]>;
|
|
2332
|
+
/**
|
|
2333
|
+
* Merge coins with type `coinType` to dest
|
|
2334
|
+
* @param txBlock
|
|
2335
|
+
* @param dest
|
|
2336
|
+
* @param coinType
|
|
2337
|
+
* @param sender
|
|
2338
|
+
*/
|
|
2339
|
+
mergeSimilarCoins(txBlock: SuiTxBlock | Transaction, dest: SuiObjectArg, coinType: string, sender?: string): Promise<void>;
|
|
2340
|
+
/**
|
|
2341
|
+
* Get all asset coin names in the obligation record by obligation id.
|
|
2342
|
+
*
|
|
2343
|
+
* @description
|
|
2344
|
+
* This can often be used to determine which assets in an obligation require
|
|
2345
|
+
* price updates before interacting with specific instructions of the Scallop contract.
|
|
2346
|
+
*
|
|
2347
|
+
* @param obligationId - The obligation id.
|
|
2348
|
+
* @return Asset coin Names.
|
|
2349
|
+
*/
|
|
2350
|
+
getObligationCoinNames(obligationId: SuiObjectArg): Promise<string[] | undefined>;
|
|
2351
|
+
private parseDataFromPythPriceFeed;
|
|
2352
|
+
getPythPrice(assetCoinName: string, priceFeedObject?: SuiObjectData$1 | null): Promise<number>;
|
|
2353
|
+
getPythPrices(assetCoinNames: string[]): Promise<Record<string, number>>;
|
|
2354
|
+
/**
|
|
2355
|
+
* Get asset coin price.
|
|
2356
|
+
*
|
|
2357
|
+
* @description
|
|
2358
|
+
* The strategy for obtaining the price is to get it through API first,
|
|
2359
|
+
* and then on-chain data if API cannot be retrieved.
|
|
2360
|
+
* Currently, we only support obtaining from pyth protocol, other
|
|
2361
|
+
* oracles will be supported in the future.
|
|
2362
|
+
*
|
|
2363
|
+
* @param assetCoinNames - Specific an array of support asset coin name.
|
|
2364
|
+
* @return Asset coin price.
|
|
2365
|
+
*/
|
|
2366
|
+
getCoinPrices(coinNames?: string[]): Promise<OptionalKeys<Record<string, number>>>;
|
|
2367
|
+
/**
|
|
2368
|
+
* Convert apr to apy.
|
|
2369
|
+
*
|
|
2370
|
+
* @param apr The annual percentage rate (APR).
|
|
2371
|
+
* @param compoundFrequency How often interest is compounded per year. Default is daily (365 times a year).
|
|
2372
|
+
* @return The equivalent annual percentage yield (APY) for the given APR and compounding frequency.
|
|
2373
|
+
*/
|
|
2374
|
+
parseAprToApy(apr: number, compoundFrequency?: number): number;
|
|
2375
|
+
/**
|
|
2376
|
+
* Convert apy to apr.
|
|
2377
|
+
*
|
|
2378
|
+
* @param apr The equivalent annual percentage yield (APY).
|
|
2379
|
+
* @param compoundFrequency How often interest is compounded per year. Default is daily (365 times a year).
|
|
2380
|
+
* @return The equivalent annual percentage rate (APR) for the given APY and compounding frequency.
|
|
2381
|
+
*/
|
|
2382
|
+
parseApyToApr(apy: number, compoundFrequency?: number): number;
|
|
2383
|
+
/**
|
|
2384
|
+
* Give extend lock period to get unlock at in seconds timestamp.
|
|
2385
|
+
*
|
|
2386
|
+
* @description
|
|
2387
|
+
* - When the user without remaining unlock period, If the extended unlock day is not specified,
|
|
2388
|
+
* the unlock period will be increased by one day by default.
|
|
2389
|
+
* - When the given extended day plus the user's remaining unlock period exceeds the maximum
|
|
2390
|
+
* unlock period, the maximum unlock period is used as unlock period.
|
|
2391
|
+
*
|
|
2392
|
+
* @param extendLockPeriodInDay The extend lock period in day.
|
|
2393
|
+
* @param unlockAtInSecondTimestamp The unlock timestamp from veSca object.
|
|
2394
|
+
* @return New unlock at in seconds timestamp.
|
|
2395
|
+
*/
|
|
2396
|
+
getUnlockAt(extendLockPeriodInDay?: number, unlockAtInMillisTimestamp?: number): number;
|
|
2397
|
+
/**
|
|
2398
|
+
* Get detailed contract address and price id information for supported pool in Scallop
|
|
2399
|
+
* @returns Supported pool informations
|
|
2400
|
+
*/
|
|
2401
|
+
getSupportedPoolAddresses(): PoolAddress[];
|
|
2402
|
+
}
|
|
2403
|
+
|
|
2404
|
+
export { type SCoinTxBlock as $, type BorrowIncentiveQuickMethods as A, type BaseScallopTxBlock as B, type CoreIds as C, type SuiTxBlockWithBorrowIncentiveNormalMethods as D, type BorrowIncentiveTxBlock as E, type GenerateBorrowIncentiveNormalMethod as F, type GenerateCoreNormalMethod as G, type GenerateBorrowIncentiveQuickMethod as H, type VeScaQuickMethods as I, type SuiTxBlockWithVeScaNormalMethods as J, type VeScaTxBlock as K, type GenerateVeScaNormalMethod as L, type GenerateVeScaQuickMethod as M, type NestedResult as N, type LoyaltyProgramNormalMethods as O, type LoyaltyProgramQuickMethods as P, type QuickMethodReturnType as Q, type SuiTxBlockWithLoyaltyProgramNormalMethods as R, ScallopBuilder as S, type LoyaltyProgramTxBlock as T, type GenerateLoyaltyProgramNormalMethod as U, type VeScaNormalMethods as V, type GenerateLoyaltyProgramQuickMethod as W, type sCoinPkgIds as X, type sCoinNormalMethods as Y, type sCoinQuickMethods as Z, type SuiTxBlockWithSCoinNormalMethods as _, ScallopAddress as a, type ParsedSpoolRewardPoolData as a$, type GenerateSCoinNormalMethod as a0, type GenerateSCoinQuickMethod as a1, type PoolAddress as a2, type Whitelist as a3, type CoinWrappedType as a4, type BorrowIncentiveAccountKey as a5, type BorrowIncentivePools as a6, type BorrowIncentivePoolPoints as a7, type BorrowIncentivePool as a8, type OriginBorrowIncentivePoolPointData as a9, type CalculatedMarketPoolData as aA, type OriginMarketCollateralData as aB, type ParsedMarketCollateralData as aC, type CalculatedMarketCollateralData as aD, type Market as aE, type Obligation$1 as aF, type MarketQueryInterface as aG, type ObligationQueryInterface as aH, type LoyaltyProgramInfo as aI, type VeScaLoyaltyProgramInfo as aJ, type Lendings as aK, type ObligationAccounts as aL, type Lending as aM, type ObligationAccount as aN, type ObligationCollateral as aO, type ObligationDebt as aP, type ObligationBorrowIncentiveReward as aQ, type ObligationBorrowIncentive as aR, type TotalValueLocked as aS, type Spools as aT, type Spool as aU, type OriginSpoolData as aV, type SpoolData as aW, type ParsedSpoolData as aX, type CalculatedSpoolData as aY, type SpoolRewardPool as aZ, type OriginSpoolRewardPoolData as a_, type OriginBorrowIncentivePoolData as aa, type ParsedBorrowIncentivePoolPointData as ab, type ParsedBorrowIncentivePoolData as ac, type CalculatedBorrowIncentivePoolPointData as ad, type BorrowIncentiveAccounts as ae, type OriginBorrowIncentiveAccountPoolData as af, type OriginBorrowIncentiveAccountData as ag, type ParsedBorrowIncentiveAccountPoolData as ah, type ParsedBorrowIncentiveAccountData as ai, type BorrowIncentivePoolsQueryInterface as aj, type BorrowIncentiveAccountsQueryInterface as ak, type MarketPools as al, type MarketCollaterals as am, type CoinAmounts as an, type MarketCoinAmounts as ao, type SCoinAmounts as ap, type BalanceSheet as aq, type BorrowDynamic as ar, type BorrowFee as as, type InterestModel as at, type RiskModel as au, type CollateralStat as av, type MarketPool as aw, type MarketCollateral as ax, type OriginMarketPoolData as ay, type ParsedMarketPoolData as az, ScallopAxios as b, type CalculatedSpoolRewardPoolData as b0, type StakePools as b1, type StakeRewardPools as b2, type StakeAccounts as b3, type StakeAccount as b4, type StakePool as b5, type StakeRewardPool as b6, type Vesca as b7, type VeScaTreasuryFields as b8, type VeScaTreasuryInfo as b9, type OptionalKeys as ba, type CoinPrices as bb, type ScallopClientInterface as bc, type ScallopBuilderParams as bd, ScallopConstants as c, ScallopIndexer as d, ScallopQuery as e, ScallopQueryClient as f, ScallopUtils as g, ScallopSuiKit as h, type SuiTxBlockWithSCoin as i, type SuiTxBlockWithSpool as j, type ScallopTxBlock as k, type SelectCoinReturnType as l, type CoreNormalMethods as m, type CoreQuickMethods as n, type SuiTxBlockWithCoreNormalMethods as o, type CoreTxBlock as p, type GenerateCoreQuickMethod as q, type SpoolIds as r, type SpoolNormalMethods as s, type SpoolQuickMethods as t, type SuiTxBlockWithSpoolNormalMethods as u, type SpoolTxBlock as v, type GenerateSpoolNormalMethod as w, type GenerateSpoolQuickMethod as x, type BorrowIncentiveIds as y, type BorrowIncentiveNormalMethods as z };
|