@scallop-io/sui-scallop-sdk 1.3.41 → 1.4.0
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/constants/tokenBucket.d.ts +1 -1
- package/dist/index.js +194 -186
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +194 -186
- package/dist/index.mjs.map +1 -1
- package/dist/models/scallopQuery.d.ts +34 -14
- package/package.json +1 -1
- package/src/constants/tokenBucket.ts +1 -1
- package/src/models/scallopQuery.ts +38 -31
- package/src/queries/coreQuery.ts +184 -189
- package/src/queries/portfolioQuery.ts +17 -16
- package/src/queries/sCoinQuery.ts +2 -2
- package/src/queries/spoolQuery.ts +2 -2
- package/src/utils/indexer.ts +9 -3
- package/src/utils/tokenBucket.ts +2 -2
|
@@ -38,8 +38,9 @@ export declare class ScallopQuery {
|
|
|
38
38
|
* @param indexer - Whether to use indexer.
|
|
39
39
|
* @return Market data.
|
|
40
40
|
*/
|
|
41
|
-
queryMarket(
|
|
42
|
-
coinPrices
|
|
41
|
+
queryMarket(args?: {
|
|
42
|
+
coinPrices?: CoinPrices;
|
|
43
|
+
indexer?: boolean;
|
|
43
44
|
}): Promise<import("../types").Market>;
|
|
44
45
|
/**
|
|
45
46
|
* Get market pools.
|
|
@@ -52,8 +53,9 @@ export declare class ScallopQuery {
|
|
|
52
53
|
* @param indexer - Whether to use indexer.
|
|
53
54
|
* @return Market pools data.
|
|
54
55
|
*/
|
|
55
|
-
getMarketPools(poolCoinNames?: SupportPoolCoins[],
|
|
56
|
+
getMarketPools(poolCoinNames?: SupportPoolCoins[], args?: {
|
|
56
57
|
coinPrices?: CoinPrices;
|
|
58
|
+
indexer?: boolean;
|
|
57
59
|
}): Promise<{
|
|
58
60
|
usdc?: MarketPool | undefined;
|
|
59
61
|
sbeth?: MarketPool | undefined;
|
|
@@ -79,9 +81,10 @@ export declare class ScallopQuery {
|
|
|
79
81
|
* @param indexer - Whether to use indexer.
|
|
80
82
|
* @return Market pool data.
|
|
81
83
|
*/
|
|
82
|
-
getMarketPool(poolCoinName: SupportPoolCoins,
|
|
84
|
+
getMarketPool(poolCoinName: SupportPoolCoins, args?: {
|
|
83
85
|
marketObject?: SuiObjectData | null;
|
|
84
86
|
coinPrice?: number;
|
|
87
|
+
indexer?: boolean;
|
|
85
88
|
}): Promise<MarketPool | undefined>;
|
|
86
89
|
/**
|
|
87
90
|
* Get market collaterals.
|
|
@@ -94,7 +97,9 @@ export declare class ScallopQuery {
|
|
|
94
97
|
* @param indexer - Whether to use indexer.
|
|
95
98
|
* @return Market collaterals data.
|
|
96
99
|
*/
|
|
97
|
-
getMarketCollaterals(collateralCoinNames?: SupportCollateralCoins[],
|
|
100
|
+
getMarketCollaterals(collateralCoinNames?: SupportCollateralCoins[], args?: {
|
|
101
|
+
indexer?: boolean;
|
|
102
|
+
}): Promise<{
|
|
98
103
|
usdc?: import("../types").MarketCollateral | undefined;
|
|
99
104
|
sbeth?: import("../types").MarketCollateral | undefined;
|
|
100
105
|
weth?: import("../types").MarketCollateral | undefined;
|
|
@@ -117,7 +122,9 @@ export declare class ScallopQuery {
|
|
|
117
122
|
* @param indexer - Whether to use indexer.
|
|
118
123
|
* @return Market collateral data.
|
|
119
124
|
*/
|
|
120
|
-
getMarketCollateral(collateralCoinName: SupportCollateralCoins,
|
|
125
|
+
getMarketCollateral(collateralCoinName: SupportCollateralCoins, args?: {
|
|
126
|
+
indexer?: boolean;
|
|
127
|
+
}): Promise<import("../types").MarketCollateral | undefined>;
|
|
121
128
|
/**
|
|
122
129
|
* Get obligations data.
|
|
123
130
|
*
|
|
@@ -185,9 +192,10 @@ export declare class ScallopQuery {
|
|
|
185
192
|
* @param indexer - Whether to use indexer.
|
|
186
193
|
* @return Spools data.
|
|
187
194
|
*/
|
|
188
|
-
getSpools(stakeMarketCoinNames?: SupportStakeMarketCoins[],
|
|
195
|
+
getSpools(stakeMarketCoinNames?: SupportStakeMarketCoins[], args?: {
|
|
189
196
|
marketPools?: MarketPools;
|
|
190
197
|
coinPrices?: CoinPrices;
|
|
198
|
+
indexer?: boolean;
|
|
191
199
|
}): Promise<{
|
|
192
200
|
susdc?: import("../types").Spool | undefined;
|
|
193
201
|
sweth?: import("../types").Spool | undefined;
|
|
@@ -206,9 +214,10 @@ export declare class ScallopQuery {
|
|
|
206
214
|
* @param indexer - Whether to use indexer.
|
|
207
215
|
* @return Spool data.
|
|
208
216
|
*/
|
|
209
|
-
getSpool(stakeMarketCoinName: SupportStakeMarketCoins,
|
|
217
|
+
getSpool(stakeMarketCoinName: SupportStakeMarketCoins, args?: {
|
|
210
218
|
marketPool?: MarketPool;
|
|
211
219
|
coinPrices?: CoinPrices;
|
|
220
|
+
indexer?: boolean;
|
|
212
221
|
}): Promise<import("../types").Spool | undefined>;
|
|
213
222
|
/**
|
|
214
223
|
* Get stake accounts data for all stake pools (spools).
|
|
@@ -296,8 +305,9 @@ export declare class ScallopQuery {
|
|
|
296
305
|
* @param indexer - Whether to use indexer.
|
|
297
306
|
* @return Borrow incentive pools data.
|
|
298
307
|
*/
|
|
299
|
-
getBorrowIncentivePools(coinNames?: SupportBorrowIncentiveCoins[],
|
|
308
|
+
getBorrowIncentivePools(coinNames?: SupportBorrowIncentiveCoins[], args?: {
|
|
300
309
|
coinPrices: CoinPrices;
|
|
310
|
+
indexer?: boolean;
|
|
301
311
|
}): Promise<{
|
|
302
312
|
usdc?: import("../types").BorrowIncentivePool | undefined;
|
|
303
313
|
sbeth?: import("../types").BorrowIncentivePool | undefined;
|
|
@@ -337,7 +347,9 @@ export declare class ScallopQuery {
|
|
|
337
347
|
* @param indexer - Whether to use indexer.
|
|
338
348
|
* @return All lending and spool infomation.
|
|
339
349
|
*/
|
|
340
|
-
getLendings(poolCoinNames?: SupportPoolCoins[], ownerAddress?: string,
|
|
350
|
+
getLendings(poolCoinNames?: SupportPoolCoins[], ownerAddress?: string, args?: {
|
|
351
|
+
indexer?: boolean;
|
|
352
|
+
}): Promise<{
|
|
341
353
|
usdc?: import("../types").Lending | undefined;
|
|
342
354
|
sbeth?: import("../types").Lending | undefined;
|
|
343
355
|
weth?: import("../types").Lending | undefined;
|
|
@@ -363,7 +375,9 @@ export declare class ScallopQuery {
|
|
|
363
375
|
* @param indexer - Whether to use indexer.
|
|
364
376
|
* @return Lending pool data.
|
|
365
377
|
*/
|
|
366
|
-
getLending(poolCoinName: SupportPoolCoins, ownerAddress?: string,
|
|
378
|
+
getLending(poolCoinName: SupportPoolCoins, ownerAddress?: string, args?: {
|
|
379
|
+
indexer?: boolean;
|
|
380
|
+
}): Promise<import("../types").Lending>;
|
|
367
381
|
/**
|
|
368
382
|
* Get user all obligation accounts information.
|
|
369
383
|
*
|
|
@@ -374,7 +388,9 @@ export declare class ScallopQuery {
|
|
|
374
388
|
* @param indexer - Whether to use indexer.
|
|
375
389
|
* @return All obligation accounts information.
|
|
376
390
|
*/
|
|
377
|
-
getObligationAccounts(ownerAddress?: string,
|
|
391
|
+
getObligationAccounts(ownerAddress?: string, args?: {
|
|
392
|
+
indexer: boolean;
|
|
393
|
+
}): Promise<{
|
|
378
394
|
[x: string]: import("../types").ObligationAccount | undefined;
|
|
379
395
|
}>;
|
|
380
396
|
/**
|
|
@@ -388,7 +404,9 @@ export declare class ScallopQuery {
|
|
|
388
404
|
* @param indexer - Whether to use indexer.
|
|
389
405
|
* @return Borrowing and collateral information.
|
|
390
406
|
*/
|
|
391
|
-
getObligationAccount(obligationId: string, ownerAddress?: string,
|
|
407
|
+
getObligationAccount(obligationId: string, ownerAddress?: string, args?: {
|
|
408
|
+
indexer?: boolean;
|
|
409
|
+
}): Promise<import("../types").ObligationAccount>;
|
|
392
410
|
/**
|
|
393
411
|
* Get total value locked.
|
|
394
412
|
*
|
|
@@ -398,7 +416,9 @@ export declare class ScallopQuery {
|
|
|
398
416
|
*
|
|
399
417
|
* @return Total value locked.
|
|
400
418
|
*/
|
|
401
|
-
getTvl(
|
|
419
|
+
getTvl(args?: {
|
|
420
|
+
indexer?: boolean;
|
|
421
|
+
}): Promise<import("../types").TotalValueLocked>;
|
|
402
422
|
/**
|
|
403
423
|
* Get veSca data.
|
|
404
424
|
* @param veScaKey
|
package/package.json
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export const DEFAULT_TOKENS_PER_INTERVAL = 50;
|
|
2
|
-
export const DEFAULT_INTERVAL_IN_MS =
|
|
2
|
+
export const DEFAULT_INTERVAL_IN_MS = 100;
|
|
@@ -191,11 +191,11 @@ export class ScallopQuery {
|
|
|
191
191
|
* @param indexer - Whether to use indexer.
|
|
192
192
|
* @return Market data.
|
|
193
193
|
*/
|
|
194
|
-
public async queryMarket(
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
) {
|
|
198
|
-
return await queryMarket(this, indexer, args?.coinPrices);
|
|
194
|
+
public async queryMarket(args?: {
|
|
195
|
+
coinPrices?: CoinPrices;
|
|
196
|
+
indexer?: boolean;
|
|
197
|
+
}) {
|
|
198
|
+
return await queryMarket(this, args?.indexer, args?.coinPrices);
|
|
199
199
|
}
|
|
200
200
|
|
|
201
201
|
/**
|
|
@@ -211,12 +211,17 @@ export class ScallopQuery {
|
|
|
211
211
|
*/
|
|
212
212
|
public async getMarketPools(
|
|
213
213
|
poolCoinNames?: SupportPoolCoins[],
|
|
214
|
-
indexer: boolean = false,
|
|
215
214
|
args?: {
|
|
216
215
|
coinPrices?: CoinPrices;
|
|
216
|
+
indexer?: boolean;
|
|
217
217
|
}
|
|
218
218
|
) {
|
|
219
|
-
return await getMarketPools(
|
|
219
|
+
return await getMarketPools(
|
|
220
|
+
this,
|
|
221
|
+
poolCoinNames,
|
|
222
|
+
args?.indexer,
|
|
223
|
+
args?.coinPrices
|
|
224
|
+
);
|
|
220
225
|
}
|
|
221
226
|
|
|
222
227
|
/**
|
|
@@ -228,16 +233,16 @@ export class ScallopQuery {
|
|
|
228
233
|
*/
|
|
229
234
|
public async getMarketPool(
|
|
230
235
|
poolCoinName: SupportPoolCoins,
|
|
231
|
-
indexer: boolean = false,
|
|
232
236
|
args?: {
|
|
233
237
|
marketObject?: SuiObjectData | null;
|
|
234
238
|
coinPrice?: number;
|
|
239
|
+
indexer?: boolean;
|
|
235
240
|
}
|
|
236
241
|
) {
|
|
237
242
|
return await getMarketPool(
|
|
238
243
|
this,
|
|
239
244
|
poolCoinName,
|
|
240
|
-
indexer,
|
|
245
|
+
args?.indexer,
|
|
241
246
|
args?.marketObject,
|
|
242
247
|
args?.coinPrice
|
|
243
248
|
);
|
|
@@ -256,9 +261,9 @@ export class ScallopQuery {
|
|
|
256
261
|
*/
|
|
257
262
|
public async getMarketCollaterals(
|
|
258
263
|
collateralCoinNames?: SupportCollateralCoins[],
|
|
259
|
-
indexer
|
|
264
|
+
args?: { indexer?: boolean }
|
|
260
265
|
) {
|
|
261
|
-
return await getMarketCollaterals(this, collateralCoinNames, indexer);
|
|
266
|
+
return await getMarketCollaterals(this, collateralCoinNames, args?.indexer);
|
|
262
267
|
}
|
|
263
268
|
|
|
264
269
|
/**
|
|
@@ -270,9 +275,9 @@ export class ScallopQuery {
|
|
|
270
275
|
*/
|
|
271
276
|
public async getMarketCollateral(
|
|
272
277
|
collateralCoinName: SupportCollateralCoins,
|
|
273
|
-
indexer
|
|
278
|
+
args?: { indexer?: boolean }
|
|
274
279
|
) {
|
|
275
|
-
return await getMarketCollateral(this, collateralCoinName, indexer);
|
|
280
|
+
return await getMarketCollateral(this, collateralCoinName, args?.indexer);
|
|
276
281
|
}
|
|
277
282
|
|
|
278
283
|
/**
|
|
@@ -382,16 +387,16 @@ export class ScallopQuery {
|
|
|
382
387
|
*/
|
|
383
388
|
public async getSpools(
|
|
384
389
|
stakeMarketCoinNames?: SupportStakeMarketCoins[],
|
|
385
|
-
indexer: boolean = false,
|
|
386
390
|
args?: {
|
|
387
391
|
marketPools?: MarketPools;
|
|
388
392
|
coinPrices?: CoinPrices;
|
|
393
|
+
indexer?: boolean;
|
|
389
394
|
}
|
|
390
395
|
) {
|
|
391
396
|
return await getSpools(
|
|
392
397
|
this,
|
|
393
398
|
stakeMarketCoinNames,
|
|
394
|
-
indexer,
|
|
399
|
+
args?.indexer,
|
|
395
400
|
args?.marketPools,
|
|
396
401
|
args?.coinPrices
|
|
397
402
|
);
|
|
@@ -406,13 +411,16 @@ export class ScallopQuery {
|
|
|
406
411
|
*/
|
|
407
412
|
public async getSpool(
|
|
408
413
|
stakeMarketCoinName: SupportStakeMarketCoins,
|
|
409
|
-
|
|
410
|
-
|
|
414
|
+
args?: {
|
|
415
|
+
marketPool?: MarketPool;
|
|
416
|
+
coinPrices?: CoinPrices;
|
|
417
|
+
indexer?: boolean;
|
|
418
|
+
}
|
|
411
419
|
) {
|
|
412
420
|
return await getSpool(
|
|
413
421
|
this,
|
|
414
422
|
stakeMarketCoinName,
|
|
415
|
-
indexer,
|
|
423
|
+
args?.indexer,
|
|
416
424
|
args?.marketPool,
|
|
417
425
|
args?.coinPrices
|
|
418
426
|
);
|
|
@@ -536,13 +544,12 @@ export class ScallopQuery {
|
|
|
536
544
|
*/
|
|
537
545
|
public async getBorrowIncentivePools(
|
|
538
546
|
coinNames?: SupportBorrowIncentiveCoins[],
|
|
539
|
-
|
|
540
|
-
args?: { coinPrices: CoinPrices }
|
|
547
|
+
args?: { coinPrices: CoinPrices; indexer?: boolean }
|
|
541
548
|
) {
|
|
542
549
|
return await getBorrowIncentivePools(
|
|
543
550
|
this,
|
|
544
551
|
coinNames,
|
|
545
|
-
indexer,
|
|
552
|
+
args?.indexer,
|
|
546
553
|
args?.coinPrices
|
|
547
554
|
);
|
|
548
555
|
}
|
|
@@ -572,9 +579,9 @@ export class ScallopQuery {
|
|
|
572
579
|
public async getLendings(
|
|
573
580
|
poolCoinNames?: SupportPoolCoins[],
|
|
574
581
|
ownerAddress: string = this.walletAddress,
|
|
575
|
-
indexer
|
|
582
|
+
args?: { indexer?: boolean }
|
|
576
583
|
) {
|
|
577
|
-
return await getLendings(this, poolCoinNames, ownerAddress, indexer);
|
|
584
|
+
return await getLendings(this, poolCoinNames, ownerAddress, args?.indexer);
|
|
578
585
|
}
|
|
579
586
|
|
|
580
587
|
/**
|
|
@@ -588,9 +595,9 @@ export class ScallopQuery {
|
|
|
588
595
|
public async getLending(
|
|
589
596
|
poolCoinName: SupportPoolCoins,
|
|
590
597
|
ownerAddress: string = this.walletAddress,
|
|
591
|
-
indexer
|
|
598
|
+
args?: { indexer?: boolean }
|
|
592
599
|
) {
|
|
593
|
-
return await getLending(this, poolCoinName, ownerAddress, indexer);
|
|
600
|
+
return await getLending(this, poolCoinName, ownerAddress, args?.indexer);
|
|
594
601
|
}
|
|
595
602
|
|
|
596
603
|
/**
|
|
@@ -605,9 +612,9 @@ export class ScallopQuery {
|
|
|
605
612
|
*/
|
|
606
613
|
public async getObligationAccounts(
|
|
607
614
|
ownerAddress: string = this.walletAddress,
|
|
608
|
-
indexer: boolean
|
|
615
|
+
args?: { indexer: boolean }
|
|
609
616
|
) {
|
|
610
|
-
return await getObligationAccounts(this, ownerAddress, indexer);
|
|
617
|
+
return await getObligationAccounts(this, ownerAddress, args?.indexer);
|
|
611
618
|
}
|
|
612
619
|
|
|
613
620
|
/**
|
|
@@ -624,13 +631,13 @@ export class ScallopQuery {
|
|
|
624
631
|
public async getObligationAccount(
|
|
625
632
|
obligationId: string,
|
|
626
633
|
ownerAddress: string = this.walletAddress,
|
|
627
|
-
indexer
|
|
634
|
+
args?: { indexer?: boolean }
|
|
628
635
|
) {
|
|
629
636
|
return await getObligationAccount(
|
|
630
637
|
this,
|
|
631
638
|
obligationId,
|
|
632
639
|
ownerAddress,
|
|
633
|
-
indexer
|
|
640
|
+
args?.indexer
|
|
634
641
|
);
|
|
635
642
|
}
|
|
636
643
|
|
|
@@ -643,8 +650,8 @@ export class ScallopQuery {
|
|
|
643
650
|
*
|
|
644
651
|
* @return Total value locked.
|
|
645
652
|
*/
|
|
646
|
-
public async getTvl(indexer
|
|
647
|
-
return await getTotalValueLocked(this, indexer);
|
|
653
|
+
public async getTvl(args?: { indexer?: boolean }) {
|
|
654
|
+
return await getTotalValueLocked(this, args?.indexer);
|
|
648
655
|
}
|
|
649
656
|
|
|
650
657
|
/**
|