@scallop-io/sui-scallop-sdk 0.44.7 → 0.44.9
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/README.md +8 -1
- package/dist/constants/common.d.ts +1 -0
- package/dist/index.js +405 -68
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +403 -68
- package/dist/index.mjs.map +1 -1
- package/dist/models/index.d.ts +1 -0
- package/dist/models/scallop.d.ts +9 -1
- package/dist/models/scallopAddress.d.ts +1 -1
- package/dist/models/scallopBuilder.d.ts +1 -1
- package/dist/models/scallopIndexer.d.ts +81 -0
- package/dist/models/scallopQuery.d.ts +29 -15
- package/dist/queries/borrowIncentiveQuery.d.ts +2 -1
- package/dist/queries/coreQuery.d.ts +10 -6
- package/dist/queries/portfolioQuery.d.ts +10 -5
- package/dist/queries/spoolQuery.d.ts +6 -3
- package/package.json +1 -1
- package/src/constants/common.ts +1 -0
- package/src/models/index.ts +1 -0
- package/src/models/scallop.ts +14 -1
- package/src/models/scallopAddress.ts +1 -1
- package/src/models/scallopBuilder.ts +1 -1
- package/src/models/scallopIndexer.ts +269 -0
- package/src/models/scallopQuery.ts +71 -28
- package/src/queries/borrowIncentiveQuery.ts +27 -6
- package/src/queries/coreQuery.ts +104 -18
- package/src/queries/portfolioQuery.ts +46 -13
- package/src/queries/spoolQuery.ts +67 -9
package/dist/models/index.d.ts
CHANGED
package/dist/models/scallop.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ import { ScallopBuilder } from './scallopBuilder';
|
|
|
5
5
|
import { ScallopQuery } from './scallopQuery';
|
|
6
6
|
import { ScallopUtils } from './scallopUtils';
|
|
7
7
|
import type { ScallopParams } from '../types/';
|
|
8
|
+
import { ScallopIndexer } from './scallopIndexer';
|
|
8
9
|
/**
|
|
9
10
|
* @description
|
|
10
11
|
* The main instance that controls interaction with the Scallop contract.
|
|
@@ -12,10 +13,11 @@ import type { ScallopParams } from '../types/';
|
|
|
12
13
|
* @example
|
|
13
14
|
* ```typescript
|
|
14
15
|
* const sdk = new Scallop(<parameters>);
|
|
15
|
-
* const scallopUtils= await sdk.getScallopUtils();
|
|
16
16
|
* const scallopAddress = await sdk.getScallopAddress();
|
|
17
17
|
* const scallopBuilder = await sdk.createScallopBuilder();
|
|
18
18
|
* const scallopClient = await sdk.createScallopClient();
|
|
19
|
+
* const scallopIndexer= await sdk.createScallopIndexer();
|
|
20
|
+
* const scallopUtils= await sdk.createScallopUtils();
|
|
19
21
|
* ```
|
|
20
22
|
*/
|
|
21
23
|
export declare class Scallop {
|
|
@@ -49,6 +51,12 @@ export declare class Scallop {
|
|
|
49
51
|
* @return Scallop Query.
|
|
50
52
|
*/
|
|
51
53
|
createScallopQuery(): Promise<ScallopQuery>;
|
|
54
|
+
/**
|
|
55
|
+
* Create a scallop indexer instance.
|
|
56
|
+
*
|
|
57
|
+
* @return Scallop Indexer.
|
|
58
|
+
*/
|
|
59
|
+
createScallopIndexer(): Promise<ScallopIndexer>;
|
|
52
60
|
/**
|
|
53
61
|
* Create a scallop utils instance.
|
|
54
62
|
*
|
|
@@ -2,7 +2,7 @@ import type { NetworkType } from '@scallop-io/sui-kit';
|
|
|
2
2
|
import type { ScallopAddressParams, AddressesInterface, AddressStringPath } from '../types';
|
|
3
3
|
/**
|
|
4
4
|
* @description
|
|
5
|
-
*
|
|
5
|
+
* It provides methods for managing addresses.
|
|
6
6
|
*
|
|
7
7
|
* @example
|
|
8
8
|
* ```typescript
|
|
@@ -8,7 +8,7 @@ import type { SuiTxBlock as SuiKitTxBlock } from '@scallop-io/sui-kit';
|
|
|
8
8
|
import type { ScallopInstanceParams, ScallopBuilderParams, ScallopTxBlock, SupportMarketCoins, SupportAssetCoins } from '../types';
|
|
9
9
|
/**
|
|
10
10
|
* @description
|
|
11
|
-
*
|
|
11
|
+
* It provides methods for operating the transaction block, making it more convenient to organize transaction combinations.
|
|
12
12
|
*
|
|
13
13
|
* @example
|
|
14
14
|
* ```typescript
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import type { Market, MarketPools, MarketPool, MarketCollaterals, MarketCollateral, Spools, Spool, BorrowIncentivePools, BorrowIncentivePool, SupportPoolCoins, SupportCollateralCoins, SupportStakeMarketCoins, SupportBorrowIncentiveCoins, TotalValueLocked } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* @description
|
|
4
|
+
* It provides methods to obtain sdk index data from mainnet.
|
|
5
|
+
*
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```typescript
|
|
9
|
+
* const scallopIndexer = new scallopIndexer(<parameters>);
|
|
10
|
+
* scallopIndexer.<indexer functions>();
|
|
11
|
+
* await scallopIndexer.<indexer async functions>();
|
|
12
|
+
* ```
|
|
13
|
+
*/
|
|
14
|
+
export declare class ScallopIndexer {
|
|
15
|
+
private _requestClient;
|
|
16
|
+
constructor();
|
|
17
|
+
/**
|
|
18
|
+
* Get market index data.
|
|
19
|
+
*
|
|
20
|
+
* @return Market data.
|
|
21
|
+
*/
|
|
22
|
+
getMarket(): Promise<Pick<Market, 'pools' | 'collaterals'>>;
|
|
23
|
+
/**
|
|
24
|
+
* Get market pools index data.
|
|
25
|
+
*
|
|
26
|
+
* @return Market pools data.
|
|
27
|
+
*/
|
|
28
|
+
getMarketPools(): Promise<Required<MarketPools>>;
|
|
29
|
+
/**
|
|
30
|
+
* Get market pool index data.
|
|
31
|
+
*
|
|
32
|
+
* @return Market pool data.
|
|
33
|
+
*/
|
|
34
|
+
getMarketPool(poolCoinName: SupportPoolCoins): Promise<MarketPool>;
|
|
35
|
+
/**
|
|
36
|
+
* Get market collaterals index data.
|
|
37
|
+
*
|
|
38
|
+
* @return Market collaterals data.
|
|
39
|
+
*/
|
|
40
|
+
getMarketCollaterals(): Promise<Required<MarketCollaterals>>;
|
|
41
|
+
/**
|
|
42
|
+
* Get market collateral index data.
|
|
43
|
+
*
|
|
44
|
+
* @return Market collateral data.
|
|
45
|
+
*/
|
|
46
|
+
getMarketCollateral(collateralCoinName: SupportCollateralCoins): Promise<MarketCollateral>;
|
|
47
|
+
/**
|
|
48
|
+
* Get spools index data.
|
|
49
|
+
*
|
|
50
|
+
* @return Spools data.
|
|
51
|
+
*/
|
|
52
|
+
getSpools(): Promise<Required<Spools>>;
|
|
53
|
+
/**
|
|
54
|
+
* Get spool index data.
|
|
55
|
+
*
|
|
56
|
+
* @return Spool data.
|
|
57
|
+
*/
|
|
58
|
+
getSpool(marketCoinName: SupportStakeMarketCoins): Promise<Spool>;
|
|
59
|
+
/**
|
|
60
|
+
* Get borrow incentive pools index data.
|
|
61
|
+
*
|
|
62
|
+
* @return Borrow incentive pools data.
|
|
63
|
+
*/
|
|
64
|
+
getBorrowIncentivePools(): Promise<Required<BorrowIncentivePools>>;
|
|
65
|
+
/**
|
|
66
|
+
* Get borrow incentive pool index data.
|
|
67
|
+
*
|
|
68
|
+
* @return Borrow incentive pool data.
|
|
69
|
+
*/
|
|
70
|
+
getBorrowIncentivePool(borrowIncentiveCoinName: SupportBorrowIncentiveCoins): Promise<BorrowIncentivePool>;
|
|
71
|
+
/**
|
|
72
|
+
* Get total value locked index data.
|
|
73
|
+
*
|
|
74
|
+
* @return Total value locked.
|
|
75
|
+
*/
|
|
76
|
+
getTotalValueLocked(): Promise<TotalValueLocked & {
|
|
77
|
+
totalValueChangeRatio: number;
|
|
78
|
+
borrowValueChangeRatio: number;
|
|
79
|
+
supplyValueChangeRatio: number;
|
|
80
|
+
}>;
|
|
81
|
+
}
|
|
@@ -2,9 +2,10 @@ import { SuiKit } from '@scallop-io/sui-kit';
|
|
|
2
2
|
import { ScallopQueryParams, ScallopInstanceParams, SupportStakeMarketCoins, SupportAssetCoins, SupportPoolCoins, SupportCollateralCoins, SupportMarketCoins, SupportBorrowIncentiveCoins } from '../types';
|
|
3
3
|
import { ScallopAddress } from './scallopAddress';
|
|
4
4
|
import { ScallopUtils } from './scallopUtils';
|
|
5
|
+
import { ScallopIndexer } from './scallopIndexer';
|
|
5
6
|
/**
|
|
6
7
|
* @description
|
|
7
|
-
*
|
|
8
|
+
* It provides methods for getting on-chain data from the Scallop contract.
|
|
8
9
|
*
|
|
9
10
|
* @example
|
|
10
11
|
* ```typescript
|
|
@@ -19,6 +20,7 @@ export declare class ScallopQuery {
|
|
|
19
20
|
suiKit: SuiKit;
|
|
20
21
|
address: ScallopAddress;
|
|
21
22
|
utils: ScallopUtils;
|
|
23
|
+
indexer: ScallopIndexer;
|
|
22
24
|
constructor(params: ScallopQueryParams, instance?: ScallopInstanceParams);
|
|
23
25
|
/**
|
|
24
26
|
* Request the scallop API to initialize data.
|
|
@@ -28,10 +30,10 @@ export declare class ScallopQuery {
|
|
|
28
30
|
init(forece?: boolean): Promise<void>;
|
|
29
31
|
/**
|
|
30
32
|
* Query market data.
|
|
31
|
-
*
|
|
33
|
+
* @param indexer - Whether to use indexer.
|
|
32
34
|
* @return Market data.
|
|
33
35
|
*/
|
|
34
|
-
queryMarket(): Promise<import("../types").Market>;
|
|
36
|
+
queryMarket(indexer?: boolean): Promise<import("../types").Market>;
|
|
35
37
|
/**
|
|
36
38
|
* Get market pools.
|
|
37
39
|
*
|
|
@@ -40,9 +42,10 @@ export declare class ScallopQuery {
|
|
|
40
42
|
* the `queryMarket` method to reduce time consumption.
|
|
41
43
|
*
|
|
42
44
|
* @param poolCoinNames - Specific an array of support pool coin name.
|
|
45
|
+
* @param indexer - Whether to use indexer.
|
|
43
46
|
* @return Market pools data.
|
|
44
47
|
*/
|
|
45
|
-
getMarketPools(poolCoinNames?: SupportPoolCoins[]): Promise<{
|
|
48
|
+
getMarketPools(poolCoinNames?: SupportPoolCoins[], indexer?: boolean): Promise<{
|
|
46
49
|
eth?: import("../types").MarketPool | undefined;
|
|
47
50
|
btc?: import("../types").MarketPool | undefined;
|
|
48
51
|
usdc?: import("../types").MarketPool | undefined;
|
|
@@ -59,9 +62,10 @@ export declare class ScallopQuery {
|
|
|
59
62
|
* Get market pool
|
|
60
63
|
*
|
|
61
64
|
* @param poolCoinName - Specific support pool coin name.
|
|
65
|
+
* @param indexer - Whether to use indexer.
|
|
62
66
|
* @return Market pool data.
|
|
63
67
|
*/
|
|
64
|
-
getMarketPool(poolCoinName: SupportPoolCoins): Promise<import("../types").MarketPool | undefined>;
|
|
68
|
+
getMarketPool(poolCoinName: SupportPoolCoins, indexer?: boolean): Promise<import("../types").MarketPool | undefined>;
|
|
65
69
|
/**
|
|
66
70
|
* Get market collaterals.
|
|
67
71
|
*
|
|
@@ -70,9 +74,10 @@ export declare class ScallopQuery {
|
|
|
70
74
|
* the `queryMarket` method to reduce time consumption.
|
|
71
75
|
*
|
|
72
76
|
* @param collateralCoinNames - Specific an array of support collateral coin name.
|
|
77
|
+
* @param indexer - Whether to use indexer.
|
|
73
78
|
* @return Market collaterals data.
|
|
74
79
|
*/
|
|
75
|
-
getMarketCollaterals(collateralCoinNames?: SupportCollateralCoins[]): Promise<{
|
|
80
|
+
getMarketCollaterals(collateralCoinNames?: SupportCollateralCoins[], indexer?: boolean): Promise<{
|
|
76
81
|
eth?: import("../types").MarketCollateral | undefined;
|
|
77
82
|
btc?: import("../types").MarketCollateral | undefined;
|
|
78
83
|
usdc?: import("../types").MarketCollateral | undefined;
|
|
@@ -89,9 +94,10 @@ export declare class ScallopQuery {
|
|
|
89
94
|
* Get market collateral
|
|
90
95
|
*
|
|
91
96
|
* @param collateralCoinName - Specific support collateral coin name.
|
|
97
|
+
* @param indexer - Whether to use indexer.
|
|
92
98
|
* @return Market collateral data.
|
|
93
99
|
*/
|
|
94
|
-
getMarketCollateral(collateralCoinName: SupportCollateralCoins): Promise<import("../types").MarketCollateral | undefined>;
|
|
100
|
+
getMarketCollateral(collateralCoinName: SupportCollateralCoins, indexer?: boolean): Promise<import("../types").MarketCollateral | undefined>;
|
|
95
101
|
/**
|
|
96
102
|
* Get obligations data.
|
|
97
103
|
*
|
|
@@ -173,9 +179,10 @@ export declare class ScallopQuery {
|
|
|
173
179
|
* Get spools data.
|
|
174
180
|
*
|
|
175
181
|
* @param stakeMarketCoinNames - Specific an array of support stake market coin name.
|
|
182
|
+
* @param indexer - Whether to use indexer.
|
|
176
183
|
* @return Spools data.
|
|
177
184
|
*/
|
|
178
|
-
getSpools(stakeMarketCoinNames?: SupportStakeMarketCoins[]): Promise<{
|
|
185
|
+
getSpools(stakeMarketCoinNames?: SupportStakeMarketCoins[], indexer?: boolean): Promise<{
|
|
179
186
|
ssui?: import("../types").Spool | undefined;
|
|
180
187
|
susdc?: import("../types").Spool | undefined;
|
|
181
188
|
susdt?: import("../types").Spool | undefined;
|
|
@@ -184,9 +191,10 @@ export declare class ScallopQuery {
|
|
|
184
191
|
* Get spool data.
|
|
185
192
|
*
|
|
186
193
|
* @param stakeMarketCoinName - Specific support stake market coin name.
|
|
194
|
+
* @param indexer - Whether to use indexer.
|
|
187
195
|
* @return Spool data.
|
|
188
196
|
*/
|
|
189
|
-
getSpool(stakeMarketCoinName: SupportStakeMarketCoins): Promise<import("../types").Spool | undefined>;
|
|
197
|
+
getSpool(stakeMarketCoinName: SupportStakeMarketCoins, indexer?: boolean): Promise<import("../types").Spool | undefined>;
|
|
190
198
|
/**
|
|
191
199
|
* Get stake accounts data for all stake pools (spools).
|
|
192
200
|
*
|
|
@@ -258,9 +266,10 @@ export declare class ScallopQuery {
|
|
|
258
266
|
* Get borrow incentive pools data.
|
|
259
267
|
*
|
|
260
268
|
* @param coinNames - Specific an array of support borrow incentive coin name.
|
|
269
|
+
* @param indexer - Whether to use indexer.
|
|
261
270
|
* @return Borrow incentive pools data.
|
|
262
271
|
*/
|
|
263
|
-
getBorrowIncentivePools(coinNames?: SupportBorrowIncentiveCoins[]): Promise<{
|
|
272
|
+
getBorrowIncentivePools(coinNames?: SupportBorrowIncentiveCoins[], indexer?: boolean): Promise<{
|
|
264
273
|
usdc?: import("../types").BorrowIncentivePool | undefined;
|
|
265
274
|
usdt?: import("../types").BorrowIncentivePool | undefined;
|
|
266
275
|
sui?: import("../types").BorrowIncentivePool | undefined;
|
|
@@ -282,9 +291,10 @@ export declare class ScallopQuery {
|
|
|
282
291
|
*
|
|
283
292
|
* @param poolCoinNames - Specific an array of support pool coin name.
|
|
284
293
|
* @param ownerAddress - The owner address.
|
|
294
|
+
* @param indexer - Whether to use indexer.
|
|
285
295
|
* @return All lending and spool infomation.
|
|
286
296
|
*/
|
|
287
|
-
getLendings(poolCoinNames?: SupportPoolCoins[], ownerAddress?: string): Promise<{
|
|
297
|
+
getLendings(poolCoinNames?: SupportPoolCoins[], ownerAddress?: string, indexer?: boolean): Promise<{
|
|
288
298
|
eth?: import("../types").Lending | undefined;
|
|
289
299
|
btc?: import("../types").Lending | undefined;
|
|
290
300
|
usdc?: import("../types").Lending | undefined;
|
|
@@ -302,9 +312,10 @@ export declare class ScallopQuery {
|
|
|
302
312
|
*
|
|
303
313
|
* @param poolCoinName - Specific support pool coin name.
|
|
304
314
|
* @param ownerAddress - The owner address.
|
|
315
|
+
* @param indexer - Whether to use indexer.
|
|
305
316
|
* @return Lending pool data.
|
|
306
317
|
*/
|
|
307
|
-
getLending(poolCoinName: SupportPoolCoins, ownerAddress?: string): Promise<import("../types").Lending>;
|
|
318
|
+
getLending(poolCoinName: SupportPoolCoins, ownerAddress?: string, indexer?: boolean): Promise<import("../types").Lending>;
|
|
308
319
|
/**
|
|
309
320
|
* Get user all obligation accounts information.
|
|
310
321
|
*
|
|
@@ -312,9 +323,10 @@ export declare class ScallopQuery {
|
|
|
312
323
|
* All collateral and borrowing information in all obligation accounts owned by the user.
|
|
313
324
|
*
|
|
314
325
|
* @param ownerAddress - The owner address.
|
|
326
|
+
* @param indexer - Whether to use indexer.
|
|
315
327
|
* @return All obligation accounts information.
|
|
316
328
|
*/
|
|
317
|
-
getObligationAccounts(ownerAddress?: string): Promise<{
|
|
329
|
+
getObligationAccounts(ownerAddress?: string, indexer?: boolean): Promise<{
|
|
318
330
|
[x: string]: import("../types").ObligationAccount | undefined;
|
|
319
331
|
}>;
|
|
320
332
|
/**
|
|
@@ -325,16 +337,18 @@ export declare class ScallopQuery {
|
|
|
325
337
|
*
|
|
326
338
|
* @param obligationId - The obligation id.
|
|
327
339
|
* @param ownerAddress - The owner address.
|
|
340
|
+
* @param indexer - Whether to use indexer.
|
|
328
341
|
* @return Borrowing and collateral information.
|
|
329
342
|
*/
|
|
330
|
-
getObligationAccount(obligationId: string, ownerAddress?: string): Promise<import("../types").ObligationAccount>;
|
|
343
|
+
getObligationAccount(obligationId: string, ownerAddress?: string, indexer?: boolean): Promise<import("../types").ObligationAccount>;
|
|
331
344
|
/**
|
|
332
345
|
* Get total value locked.
|
|
333
346
|
*
|
|
347
|
+
* @param indexer - Whether to use indexer.
|
|
334
348
|
* @description
|
|
335
349
|
* Include total supplied value and total borrowed value.
|
|
336
350
|
*
|
|
337
351
|
* @return Total value locked.
|
|
338
352
|
*/
|
|
339
|
-
getTvl(): Promise<import("../types").TotalValueLocked>;
|
|
353
|
+
getTvl(indexer?: boolean): Promise<import("../types").TotalValueLocked>;
|
|
340
354
|
}
|
|
@@ -5,9 +5,10 @@ import type { SupportBorrowIncentiveCoins } from '../types';
|
|
|
5
5
|
*
|
|
6
6
|
* @param query - The Scallop query instance.
|
|
7
7
|
* @param borrowIncentiveCoinNames - Specific an array of support borrow incentive coin name.
|
|
8
|
+
* @param indexer - Whether to use indexer.
|
|
8
9
|
* @return Borrow incentive pools data.
|
|
9
10
|
*/
|
|
10
|
-
export declare const queryBorrowIncentivePools: (query: ScallopQuery, borrowIncentiveCoinNames?: SupportBorrowIncentiveCoins[]) => Promise<{
|
|
11
|
+
export declare const queryBorrowIncentivePools: (query: ScallopQuery, borrowIncentiveCoinNames?: SupportBorrowIncentiveCoins[], indexer?: boolean) => Promise<{
|
|
11
12
|
usdc?: import("../types").BorrowIncentivePool | undefined;
|
|
12
13
|
usdt?: import("../types").BorrowIncentivePool | undefined;
|
|
13
14
|
sui?: import("../types").BorrowIncentivePool | undefined;
|
|
@@ -9,10 +9,10 @@ import { Market, MarketPool, MarketCollateral, SupportAssetCoins, SupportPoolCoi
|
|
|
9
9
|
* Use inspectTxn call to obtain the data provided in the scallop contract query module.
|
|
10
10
|
*
|
|
11
11
|
* @param query - The Scallop query instance.
|
|
12
|
-
* @param
|
|
12
|
+
* @param indexer - Whether to use indexer.
|
|
13
13
|
* @return Market data.
|
|
14
14
|
*/
|
|
15
|
-
export declare const queryMarket: (query: ScallopQuery) => Promise<Market>;
|
|
15
|
+
export declare const queryMarket: (query: ScallopQuery, indexer?: boolean) => Promise<Market>;
|
|
16
16
|
/**
|
|
17
17
|
* Get coin market pools data.
|
|
18
18
|
*
|
|
@@ -22,9 +22,10 @@ export declare const queryMarket: (query: ScallopQuery) => Promise<Market>;
|
|
|
22
22
|
*
|
|
23
23
|
* @param query - The Scallop query instance.
|
|
24
24
|
* @param coinNames - Specific an array of support pool coin name.
|
|
25
|
+
* @param indexer - Whether to use indexer.
|
|
25
26
|
* @return Market pools data.
|
|
26
27
|
*/
|
|
27
|
-
export declare const getMarketPools: (query: ScallopQuery, poolCoinNames?: SupportPoolCoins[]) => Promise<{
|
|
28
|
+
export declare const getMarketPools: (query: ScallopQuery, poolCoinNames?: SupportPoolCoins[], indexer?: boolean) => Promise<{
|
|
28
29
|
eth?: MarketPool | undefined;
|
|
29
30
|
btc?: MarketPool | undefined;
|
|
30
31
|
usdc?: MarketPool | undefined;
|
|
@@ -42,11 +43,12 @@ export declare const getMarketPools: (query: ScallopQuery, poolCoinNames?: Suppo
|
|
|
42
43
|
*
|
|
43
44
|
* @param query - The Scallop query instance.
|
|
44
45
|
* @param poolCoinName - Specific support pool coin name.
|
|
46
|
+
* @param indexer - Whether to use indexer.
|
|
45
47
|
* @param marketObject - The market object.
|
|
46
48
|
* @param coinPrice - The coin price.
|
|
47
49
|
* @returns Market pool data.
|
|
48
50
|
*/
|
|
49
|
-
export declare const getMarketPool: (query: ScallopQuery, poolCoinName: SupportPoolCoins, marketObject?: SuiObjectData | null, coinPrice?: number) => Promise<MarketPool | undefined>;
|
|
51
|
+
export declare const getMarketPool: (query: ScallopQuery, poolCoinName: SupportPoolCoins, indexer?: boolean, marketObject?: SuiObjectData | null, coinPrice?: number) => Promise<MarketPool | undefined>;
|
|
50
52
|
/**
|
|
51
53
|
* Get coin market collaterals data.
|
|
52
54
|
*
|
|
@@ -56,9 +58,10 @@ export declare const getMarketPool: (query: ScallopQuery, poolCoinName: SupportP
|
|
|
56
58
|
*
|
|
57
59
|
* @param query - The Scallop query instance.
|
|
58
60
|
* @param collateralCoinNames - Specific an array of support collateral coin name.
|
|
61
|
+
* @param indexer - Whether to use indexer.
|
|
59
62
|
* @return Market collaterals data.
|
|
60
63
|
*/
|
|
61
|
-
export declare const getMarketCollaterals: (query: ScallopQuery, collateralCoinNames?: SupportCollateralCoins[]) => Promise<{
|
|
64
|
+
export declare const getMarketCollaterals: (query: ScallopQuery, collateralCoinNames?: SupportCollateralCoins[], indexer?: boolean) => Promise<{
|
|
62
65
|
eth?: MarketCollateral | undefined;
|
|
63
66
|
btc?: MarketCollateral | undefined;
|
|
64
67
|
usdc?: MarketCollateral | undefined;
|
|
@@ -76,11 +79,12 @@ export declare const getMarketCollaterals: (query: ScallopQuery, collateralCoinN
|
|
|
76
79
|
*
|
|
77
80
|
* @param query - The Scallop query instance.
|
|
78
81
|
* @param collateralCoinName - Specific support collateral coin name.
|
|
82
|
+
* @param indexer - Whether to use indexer.
|
|
79
83
|
* @param marketObject - The market object.
|
|
80
84
|
* @param coinPrice - The coin price.
|
|
81
85
|
* @returns Market collateral data.
|
|
82
86
|
*/
|
|
83
|
-
export declare const getMarketCollateral: (query: ScallopQuery, collateralCoinName: SupportCollateralCoins, marketObject?: SuiObjectData | null, coinPrice?: number) => Promise<MarketCollateral | undefined>;
|
|
87
|
+
export declare const getMarketCollateral: (query: ScallopQuery, collateralCoinName: SupportCollateralCoins, indexer?: boolean, marketObject?: SuiObjectData | null, coinPrice?: number) => Promise<MarketCollateral | undefined>;
|
|
84
88
|
/**
|
|
85
89
|
* Query all owned obligations.
|
|
86
90
|
*
|
|
@@ -6,9 +6,10 @@ import type { Market, SupportPoolCoins, MarketPool, Spool, StakeAccount, Lending
|
|
|
6
6
|
* @param query - The ScallopQuery instance.
|
|
7
7
|
* @param poolCoinNames - Specific an array of support pool coin name.
|
|
8
8
|
* @param ownerAddress - The owner address.
|
|
9
|
+
* @param indexer - Whether to use indexer.
|
|
9
10
|
* @return User lending infomation for specific pools.
|
|
10
11
|
*/
|
|
11
|
-
export declare const getLendings: (query: ScallopQuery, poolCoinNames?: SupportPoolCoins[], ownerAddress?: string) => Promise<{
|
|
12
|
+
export declare const getLendings: (query: ScallopQuery, poolCoinNames?: SupportPoolCoins[], ownerAddress?: string, indexer?: boolean) => Promise<{
|
|
12
13
|
eth?: Lending | undefined;
|
|
13
14
|
btc?: Lending | undefined;
|
|
14
15
|
usdc?: Lending | undefined;
|
|
@@ -30,6 +31,7 @@ export declare const getLendings: (query: ScallopQuery, poolCoinNames?: SupportP
|
|
|
30
31
|
* @param query - The ScallopQuery instance.
|
|
31
32
|
* @param poolCoinName - Specific support coin name.
|
|
32
33
|
* @param ownerAddress - The owner address.
|
|
34
|
+
* @param indexer - Whether to use indexer.
|
|
33
35
|
* @param marketPool - The market pool data.
|
|
34
36
|
* @param spool - The spool data.
|
|
35
37
|
* @param stakeAccounts - The stake accounts data.
|
|
@@ -37,15 +39,16 @@ export declare const getLendings: (query: ScallopQuery, poolCoinNames?: SupportP
|
|
|
37
39
|
* @param marketCoinAmount - The market coin amount.
|
|
38
40
|
* @return User lending infomation for specific pool.
|
|
39
41
|
*/
|
|
40
|
-
export declare const getLending: (query: ScallopQuery, poolCoinName: SupportPoolCoins, ownerAddress?: string, marketPool?: MarketPool, spool?: Spool, stakeAccounts?: StakeAccount[], coinAmount?: number, marketCoinAmount?: number, coinPrice?: number) => Promise<Lending>;
|
|
42
|
+
export declare const getLending: (query: ScallopQuery, poolCoinName: SupportPoolCoins, ownerAddress?: string, indexer?: boolean, marketPool?: MarketPool, spool?: Spool, stakeAccounts?: StakeAccount[], coinAmount?: number, marketCoinAmount?: number, coinPrice?: number) => Promise<Lending>;
|
|
41
43
|
/**
|
|
42
44
|
* Get all obligation accounts data.
|
|
43
45
|
*
|
|
44
46
|
* @param query - The Scallop query instance.
|
|
45
47
|
* @param ownerAddress - The owner address.
|
|
48
|
+
* @param indexer - Whether to use indexer.
|
|
46
49
|
* @return All obligation accounts data.
|
|
47
50
|
*/
|
|
48
|
-
export declare const getObligationAccounts: (query: ScallopQuery, ownerAddress?: string) => Promise<{
|
|
51
|
+
export declare const getObligationAccounts: (query: ScallopQuery, ownerAddress?: string, indexer?: boolean) => Promise<{
|
|
49
52
|
[x: string]: ObligationAccount | undefined;
|
|
50
53
|
}>;
|
|
51
54
|
/**
|
|
@@ -53,13 +56,15 @@ export declare const getObligationAccounts: (query: ScallopQuery, ownerAddress?:
|
|
|
53
56
|
*
|
|
54
57
|
* @param query - The Scallop query instance.
|
|
55
58
|
* @param obligationId - The obligation id.
|
|
59
|
+
* @param indexer - Whether to use indexer.
|
|
56
60
|
* @return Obligation account data.
|
|
57
61
|
*/
|
|
58
|
-
export declare const getObligationAccount: (query: ScallopQuery, obligationId: string, ownerAddress?: string, market?: Market, coinPrices?: CoinPrices, coinAmounts?: CoinAmounts) => Promise<ObligationAccount>;
|
|
62
|
+
export declare const getObligationAccount: (query: ScallopQuery, obligationId: string, ownerAddress?: string, indexer?: boolean, market?: Market, coinPrices?: CoinPrices, coinAmounts?: CoinAmounts) => Promise<ObligationAccount>;
|
|
59
63
|
/**
|
|
60
64
|
* Get total value locked data.
|
|
61
65
|
*
|
|
62
66
|
* @param query - The Scallop query instance.
|
|
67
|
+
* @param indexer - Whether to use indexer.
|
|
63
68
|
* @return Total value locked data.
|
|
64
69
|
*/
|
|
65
|
-
export declare const getTotalValueLocked: (query: ScallopQuery) => Promise<TotalValueLocked>;
|
|
70
|
+
export declare const getTotalValueLocked: (query: ScallopQuery, indexer?: boolean) => Promise<TotalValueLocked>;
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import type { ScallopQuery } from '../models';
|
|
2
|
-
import type { MarketPool, Spool, StakePool, StakeRewardPool, StakeAccounts, SupportStakeMarketCoins } from '../types';
|
|
2
|
+
import type { MarketPool, Spool, StakePool, StakeRewardPool, StakeAccounts, SupportStakeMarketCoins, CoinPrices } from '../types';
|
|
3
3
|
/**
|
|
4
4
|
* Get spools data.
|
|
5
5
|
*
|
|
6
6
|
* @param query - The Scallop query instance.
|
|
7
7
|
* @param marketCoinNames - Specific an array of support stake market coin name.
|
|
8
|
+
* @param indexer - Whether to use indexer.
|
|
8
9
|
* @return Spools data.
|
|
9
10
|
*/
|
|
10
|
-
export declare const getSpools: (query: ScallopQuery, stakeMarketCoinNames?: SupportStakeMarketCoins[]) => Promise<{
|
|
11
|
+
export declare const getSpools: (query: ScallopQuery, stakeMarketCoinNames?: SupportStakeMarketCoins[], indexer?: boolean) => Promise<{
|
|
11
12
|
ssui?: Spool | undefined;
|
|
12
13
|
susdc?: Spool | undefined;
|
|
13
14
|
susdt?: Spool | undefined;
|
|
@@ -17,10 +18,12 @@ export declare const getSpools: (query: ScallopQuery, stakeMarketCoinNames?: Sup
|
|
|
17
18
|
*
|
|
18
19
|
* @param query - The Scallop query instance.
|
|
19
20
|
* @param marketCoinName - Specific support stake market coin name.
|
|
21
|
+
* @param indexer - Whether to use indexer.
|
|
20
22
|
* @param marketPool - The market pool data.
|
|
23
|
+
* @param coinPrices - The coin prices.
|
|
21
24
|
* @return Spool data.
|
|
22
25
|
*/
|
|
23
|
-
export declare const getSpool: (query: ScallopQuery, marketCoinName: SupportStakeMarketCoins, marketPool?: MarketPool) => Promise<Spool | undefined>;
|
|
26
|
+
export declare const getSpool: (query: ScallopQuery, marketCoinName: SupportStakeMarketCoins, indexer?: boolean, marketPool?: MarketPool, coinPrices?: CoinPrices) => Promise<Spool | undefined>;
|
|
24
27
|
/**
|
|
25
28
|
* Get all stake accounts of the owner.
|
|
26
29
|
*
|
package/package.json
CHANGED
package/src/constants/common.ts
CHANGED
package/src/models/index.ts
CHANGED
package/src/models/scallop.ts
CHANGED
|
@@ -6,6 +6,7 @@ import { ScallopQuery } from './scallopQuery';
|
|
|
6
6
|
import { ScallopUtils } from './scallopUtils';
|
|
7
7
|
import { ADDRESSES_ID } from '../constants';
|
|
8
8
|
import type { ScallopParams } from '../types/';
|
|
9
|
+
import { ScallopIndexer } from './scallopIndexer';
|
|
9
10
|
|
|
10
11
|
/**
|
|
11
12
|
* @description
|
|
@@ -14,10 +15,11 @@ import type { ScallopParams } from '../types/';
|
|
|
14
15
|
* @example
|
|
15
16
|
* ```typescript
|
|
16
17
|
* const sdk = new Scallop(<parameters>);
|
|
17
|
-
* const scallopUtils= await sdk.getScallopUtils();
|
|
18
18
|
* const scallopAddress = await sdk.getScallopAddress();
|
|
19
19
|
* const scallopBuilder = await sdk.createScallopBuilder();
|
|
20
20
|
* const scallopClient = await sdk.createScallopClient();
|
|
21
|
+
* const scallopIndexer= await sdk.createScallopIndexer();
|
|
22
|
+
* const scallopUtils= await sdk.createScallopUtils();
|
|
21
23
|
* ```
|
|
22
24
|
*/
|
|
23
25
|
export class Scallop {
|
|
@@ -93,6 +95,17 @@ export class Scallop {
|
|
|
93
95
|
return scallopQuery;
|
|
94
96
|
}
|
|
95
97
|
|
|
98
|
+
/**
|
|
99
|
+
* Create a scallop indexer instance.
|
|
100
|
+
*
|
|
101
|
+
* @return Scallop Indexer.
|
|
102
|
+
*/
|
|
103
|
+
public async createScallopIndexer() {
|
|
104
|
+
const scallopIndexer = new ScallopIndexer();
|
|
105
|
+
|
|
106
|
+
return scallopIndexer;
|
|
107
|
+
}
|
|
108
|
+
|
|
96
109
|
/**
|
|
97
110
|
* Create a scallop utils instance.
|
|
98
111
|
*
|
|
@@ -18,7 +18,7 @@ import type {
|
|
|
18
18
|
|
|
19
19
|
/**
|
|
20
20
|
* @description
|
|
21
|
-
*
|
|
21
|
+
* It provides methods for operating the transaction block, making it more convenient to organize transaction combinations.
|
|
22
22
|
*
|
|
23
23
|
* @example
|
|
24
24
|
* ```typescript
|