@scallop-io/sui-scallop-sdk 0.44.6 → 0.44.8

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.
@@ -4,3 +4,4 @@ export * from './scallopClient';
4
4
  export * from './scallopBuilder';
5
5
  export * from './scallopQuery';
6
6
  export * from './scallopUtils';
7
+ export * from './scallopIndexer';
@@ -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
- * it provides methods for managing addresses.
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
- * it provides methods for operating the transaction block, making it more convenient to organize transaction combinations.
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
@@ -192,7 +192,7 @@ export declare class ScallopClient {
192
192
  * @param walletAddress - The wallet address of the owner.
193
193
  * @return Transaction block response or transaction block.
194
194
  */
195
- repay<S extends boolean>(poolCoinName: SupportPoolCoins, amount: number, sign: S | undefined, obligationId: string, walletAddress?: string): Promise<ScallopClientFnReturnType<S>>;
195
+ repay<S extends boolean>(poolCoinName: SupportPoolCoins, amount: number, sign: S | undefined, obligationId: string, obligationKey: string, walletAddress?: string): Promise<ScallopClientFnReturnType<S>>;
196
196
  /**
197
197
  * FlashLoan asset from the specific pool.
198
198
  *
@@ -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
- * it provides methods for getting on-chain data from the Scallop contract.
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,10 +266,12 @@ 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;
274
+ usdt?: import("../types").BorrowIncentivePool | undefined;
265
275
  sui?: import("../types").BorrowIncentivePool | undefined;
266
276
  }>;
267
277
  /**
@@ -273,6 +283,7 @@ export declare class ScallopQuery {
273
283
  */
274
284
  getBorrowIncentiveAccounts(obligationId: string, coinNames?: SupportBorrowIncentiveCoins[]): Promise<{
275
285
  usdc?: import("../types").ParsedBorrowIncentiveAccountData | undefined;
286
+ usdt?: import("../types").ParsedBorrowIncentiveAccountData | undefined;
276
287
  sui?: import("../types").ParsedBorrowIncentiveAccountData | undefined;
277
288
  }>;
278
289
  /**
@@ -280,9 +291,10 @@ export declare class ScallopQuery {
280
291
  *
281
292
  * @param poolCoinNames - Specific an array of support pool coin name.
282
293
  * @param ownerAddress - The owner address.
294
+ * @param indexer - Whether to use indexer.
283
295
  * @return All lending and spool infomation.
284
296
  */
285
- getLendings(poolCoinNames?: SupportPoolCoins[], ownerAddress?: string): Promise<{
297
+ getLendings(poolCoinNames?: SupportPoolCoins[], ownerAddress?: string, indexer?: boolean): Promise<{
286
298
  eth?: import("../types").Lending | undefined;
287
299
  btc?: import("../types").Lending | undefined;
288
300
  usdc?: import("../types").Lending | undefined;
@@ -300,9 +312,10 @@ export declare class ScallopQuery {
300
312
  *
301
313
  * @param poolCoinName - Specific support pool coin name.
302
314
  * @param ownerAddress - The owner address.
315
+ * @param indexer - Whether to use indexer.
303
316
  * @return Lending pool data.
304
317
  */
305
- getLending(poolCoinName: SupportPoolCoins, ownerAddress?: string): Promise<import("../types").Lending>;
318
+ getLending(poolCoinName: SupportPoolCoins, ownerAddress?: string, indexer?: boolean): Promise<import("../types").Lending>;
306
319
  /**
307
320
  * Get user all obligation accounts information.
308
321
  *
@@ -310,9 +323,10 @@ export declare class ScallopQuery {
310
323
  * All collateral and borrowing information in all obligation accounts owned by the user.
311
324
  *
312
325
  * @param ownerAddress - The owner address.
326
+ * @param indexer - Whether to use indexer.
313
327
  * @return All obligation accounts information.
314
328
  */
315
- getObligationAccounts(ownerAddress?: string): Promise<{
329
+ getObligationAccounts(ownerAddress?: string, indexer?: boolean): Promise<{
316
330
  [x: string]: import("../types").ObligationAccount | undefined;
317
331
  }>;
318
332
  /**
@@ -323,16 +337,18 @@ export declare class ScallopQuery {
323
337
  *
324
338
  * @param obligationId - The obligation id.
325
339
  * @param ownerAddress - The owner address.
340
+ * @param indexer - Whether to use indexer.
326
341
  * @return Borrowing and collateral information.
327
342
  */
328
- getObligationAccount(obligationId: string, ownerAddress?: string): Promise<import("../types").ObligationAccount>;
343
+ getObligationAccount(obligationId: string, ownerAddress?: string, indexer?: boolean): Promise<import("../types").ObligationAccount>;
329
344
  /**
330
345
  * Get total value locked.
331
346
  *
347
+ * @param indexer - Whether to use indexer.
332
348
  * @description
333
349
  * Include total supplied value and total borrowed value.
334
350
  *
335
351
  * @return Total value locked.
336
352
  */
337
- getTvl(): Promise<import("../types").TotalValueLocked>;
353
+ getTvl(indexer?: boolean): Promise<import("../types").TotalValueLocked>;
338
354
  }
@@ -5,10 +5,12 @@ 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;
13
+ usdt?: import("../types").BorrowIncentivePool | undefined;
12
14
  sui?: import("../types").BorrowIncentivePool | undefined;
13
15
  }>;
14
16
  /**
@@ -20,5 +22,6 @@ export declare const queryBorrowIncentivePools: (query: ScallopQuery, borrowInce
20
22
  */
21
23
  export declare const queryBorrowIncentiveAccounts: (query: ScallopQuery, obligationId: string, borrowIncentiveCoinNames?: SupportBorrowIncentiveCoins[]) => Promise<{
22
24
  usdc?: import("../types").ParsedBorrowIncentiveAccountData | undefined;
25
+ usdt?: import("../types").ParsedBorrowIncentiveAccountData | undefined;
23
26
  sui?: import("../types").ParsedBorrowIncentiveAccountData | undefined;
24
27
  }>;
@@ -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 rateType - How interest rates are calculated.
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
  *
@@ -77,6 +77,8 @@ export type ObligationDebt = {
77
77
  borrowedValue: number;
78
78
  borrowedValueWithWeight: number;
79
79
  borrowIndex: number;
80
+ requiredRepayAmount: number;
81
+ requiredRepayCoin: number;
80
82
  availableBorrowAmount: number;
81
83
  availableBorrowCoin: number;
82
84
  availableRepayAmount: number;
@@ -58,3 +58,11 @@ export declare const calculateBorrowIncentiveRewardPoolData: (parsedBorrowIncent
58
58
  export declare const parseOriginBorrowIncentiveAccountData: (originBorrowIncentiveAccountData: OriginBorrowIncentiveAccountData) => ParsedBorrowIncentiveAccountData;
59
59
  export declare const minBigNumber: (...args: BigNumber.Value[]) => BigNumber;
60
60
  export declare const maxBigNumber: (...args: BigNumber.Value[]) => BigNumber;
61
+ /**
62
+ * Dynamically adjust the decrease or increase ratio according to the amout
63
+ * @param amount - The amount required to calculate factor.
64
+ * @param scaleStep - The scale step required to determine the factor..
65
+ * @param type - The type of the calculation.
66
+ * @return The estimated factor
67
+ * */
68
+ export declare const estimatedFactor: (amount: number, scaleStep: number, type: 'increase' | 'decrease') => number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scallop-io/sui-scallop-sdk",
3
- "version": "0.44.6",
3
+ "version": "0.44.8",
4
4
  "description": "Typescript sdk for interacting with Scallop contract on SUI",
5
5
  "keywords": [
6
6
  "sui",
@@ -1,4 +1,5 @@
1
1
  export const API_BASE_URL = 'https://sui.api.scallop.io';
2
+ export const SDK_API_BASE_URL = 'https://sui-scallop-sdk-api.vercel.app';
2
3
 
3
4
  export const ADDRESSES_ID = '6462a088a7ace142bb6d7e9b';
4
5
 
@@ -40,7 +41,7 @@ export const SUPPORT_SPOOLS = ['ssui', 'susdc', 'susdt'] as const;
40
41
 
41
42
  export const SUPPORT_SPOOLS_REWARDS = ['sui'] as const;
42
43
 
43
- export const SUPPORT_BORROW_INCENTIVE_POOLS = ['sui', 'usdc'] as const;
44
+ export const SUPPORT_BORROW_INCENTIVE_POOLS = ['sui', 'usdc', 'usdt'] as const;
44
45
 
45
46
  export const SUPPORT_BORROW_INCENTIVE_REWARDS = ['sui'] as const;
46
47
  export const SUPPORT_ORACLES = ['supra', 'switchboard', 'pyth'] as const;
@@ -78,6 +78,7 @@ export const spoolRewardCoins: StakeRewardCoins = {
78
78
  export const borrowIncentiveRewardCoins: BorrowIncentiveRewardCoins = {
79
79
  sui: 'sui',
80
80
  usdc: 'sui',
81
+ usdt: 'sui',
81
82
  };
82
83
 
83
84
  export const coinIds: AssetCoinIds = {
@@ -4,3 +4,4 @@ export * from './scallopClient';
4
4
  export * from './scallopBuilder';
5
5
  export * from './scallopQuery';
6
6
  export * from './scallopUtils';
7
+ export * from './scallopIndexer';
@@ -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
  *
@@ -213,7 +213,7 @@ const EMPTY_ADDRESSES: AddressesInterface = {
213
213
 
214
214
  /**
215
215
  * @description
216
- * it provides methods for managing addresses.
216
+ * It provides methods for managing addresses.
217
217
  *
218
218
  * @example
219
219
  * ```typescript
@@ -18,7 +18,7 @@ import type {
18
18
 
19
19
  /**
20
20
  * @description
21
- * it provides methods for operating the transaction block, making it more convenient to organize transaction combinations.
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