@scallop-io/sui-scallop-sdk 0.44.28 → 0.45.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/cache.d.ts +8 -0
- package/dist/index.js +448 -231
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +432 -216
- package/dist/index.mjs.map +1 -1
- package/dist/models/index.d.ts +1 -0
- package/dist/models/scallop.d.ts +7 -1
- package/dist/models/scallopAddress.d.ts +4 -2
- package/dist/models/scallopBuilder.d.ts +2 -0
- package/dist/models/scallopCache.d.ts +71 -0
- package/dist/models/scallopClient.d.ts +2 -0
- package/dist/models/scallopIndexer.d.ts +5 -3
- package/dist/models/scallopQuery.d.ts +2 -0
- package/dist/models/scallopUtils.d.ts +1 -0
- package/dist/types/model.d.ts +2 -0
- package/package.json +2 -1
- package/src/builders/borrowIncentiveBuilder.ts +2 -2
- package/src/constants/cache.ts +15 -0
- package/src/models/index.ts +1 -0
- package/src/models/scallop.ts +26 -7
- package/src/models/scallopAddress.ts +24 -19
- package/src/models/scallopBuilder.ts +14 -4
- package/src/models/scallopCache.ts +245 -0
- package/src/models/scallopClient.ts +15 -4
- package/src/models/scallopIndexer.ts +58 -84
- package/src/models/scallopQuery.ts +14 -5
- package/src/models/scallopUtils.ts +53 -24
- package/src/queries/borrowIncentiveQuery.ts +4 -7
- package/src/queries/coreQuery.ts +62 -75
- package/src/queries/priceQuery.ts +4 -6
- package/src/queries/spoolQuery.ts +12 -15
- package/src/queries/vescaQuery.ts +2 -3
- package/src/types/model.ts +2 -0
- package/src/types/query/borrowIncentive.ts +0 -107
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { normalizeStructTag } from '@mysten/sui.js/utils';
|
|
2
|
-
import { SuiTxBlock as SuiKitTxBlock } from '@scallop-io/sui-kit';
|
|
3
2
|
import {
|
|
4
3
|
IS_VE_SCA_TEST,
|
|
5
4
|
SUPPORT_BORROW_INCENTIVE_POOLS,
|
|
@@ -41,10 +40,9 @@ export const queryBorrowIncentivePools = async (
|
|
|
41
40
|
const queryPkgId = query.address.get('borrowIncentive.query');
|
|
42
41
|
const incentivePoolsId = query.address.get('borrowIncentive.incentivePools');
|
|
43
42
|
|
|
44
|
-
const txBlock = new SuiKitTxBlock();
|
|
45
43
|
const queryTarget = `${queryPkgId}::incentive_pools_query::incentive_pools_data`;
|
|
46
|
-
|
|
47
|
-
const queryResult = await query.
|
|
44
|
+
const args = [incentivePoolsId];
|
|
45
|
+
const queryResult = await query.cache.queryInspectTxn({ queryTarget, args });
|
|
48
46
|
const borrowIncentivePoolsQueryData = queryResult.events[0]
|
|
49
47
|
.parsedJson as BorrowIncentivePoolsQueryInterface;
|
|
50
48
|
|
|
@@ -170,10 +168,9 @@ export const queryBorrowIncentiveAccounts = async (
|
|
|
170
168
|
'borrowIncentive.incentiveAccounts'
|
|
171
169
|
);
|
|
172
170
|
const queryTarget = `${queryPkgId}::incentive_account_query::incentive_account_data`;
|
|
171
|
+
const args = [incentiveAccountsId, obligationId];
|
|
173
172
|
|
|
174
|
-
const
|
|
175
|
-
txBlock.moveCall(queryTarget, [incentiveAccountsId, obligationId]);
|
|
176
|
-
const queryResult = await query.suiKit.inspectTxn(txBlock);
|
|
173
|
+
const queryResult = await query.cache.queryInspectTxn({ queryTarget, args });
|
|
177
174
|
const borrowIncentiveAccountsQueryData = queryResult.events[0]
|
|
178
175
|
.parsedJson as BorrowIncentiveAccountsQueryInterface;
|
|
179
176
|
|
package/src/queries/coreQuery.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { normalizeStructTag } from '@mysten/sui.js/utils';
|
|
2
|
-
import { SuiTxBlock as SuiKitTxBlock } from '@scallop-io/sui-kit';
|
|
3
2
|
import BigNumber from 'bignumber.js';
|
|
4
3
|
import {
|
|
5
4
|
SUPPORT_POOLS,
|
|
@@ -54,10 +53,15 @@ export const queryMarket = async (
|
|
|
54
53
|
) => {
|
|
55
54
|
const packageId = query.address.get('core.packages.query.id');
|
|
56
55
|
const marketId = query.address.get('core.market');
|
|
57
|
-
const txBlock = new SuiKitTxBlock();
|
|
58
56
|
const queryTarget = `${packageId}::market_query::market_data`;
|
|
59
|
-
|
|
60
|
-
|
|
57
|
+
const args = [marketId];
|
|
58
|
+
|
|
59
|
+
// const txBlock = new SuiKitTxBlock();
|
|
60
|
+
// txBlock.moveCall(queryTarget, args);
|
|
61
|
+
const queryResult = await query.cache.queryInspectTxn(
|
|
62
|
+
{ queryTarget, args }
|
|
63
|
+
// txBlock
|
|
64
|
+
);
|
|
61
65
|
const marketData = queryResult.events[0].parsedJson as MarketQueryInterface;
|
|
62
66
|
const coinPrices = await query.utils.getCoinPrices();
|
|
63
67
|
|
|
@@ -211,11 +215,8 @@ export const getMarketPools = async (
|
|
|
211
215
|
) => {
|
|
212
216
|
poolCoinNames = poolCoinNames || [...SUPPORT_POOLS];
|
|
213
217
|
const marketId = query.address.get('core.market');
|
|
214
|
-
const marketObjectResponse = await query.
|
|
215
|
-
|
|
216
|
-
options: {
|
|
217
|
-
showContent: true,
|
|
218
|
-
},
|
|
218
|
+
const marketObjectResponse = await query.cache.queryGetObject(marketId, {
|
|
219
|
+
showContent: true,
|
|
219
220
|
});
|
|
220
221
|
const coinPrices = await query.utils.getCoinPrices(poolCoinNames ?? []);
|
|
221
222
|
|
|
@@ -274,11 +275,8 @@ export const getMarketPool = async (
|
|
|
274
275
|
marketObject =
|
|
275
276
|
marketObject ||
|
|
276
277
|
(
|
|
277
|
-
await query.
|
|
278
|
-
|
|
279
|
-
options: {
|
|
280
|
-
showContent: true,
|
|
281
|
-
},
|
|
278
|
+
await query.cache.queryGetObject(marketId, {
|
|
279
|
+
showContent: true,
|
|
282
280
|
})
|
|
283
281
|
).data;
|
|
284
282
|
|
|
@@ -310,9 +308,8 @@ export const getMarketPool = async (
|
|
|
310
308
|
// Get balance sheet.
|
|
311
309
|
const balanceSheetParentId =
|
|
312
310
|
fields.vault.fields.balance_sheets.fields.table.fields.id.id;
|
|
313
|
-
const balanceSheetDynamicFieldObjectResponse =
|
|
314
|
-
.
|
|
315
|
-
.getDynamicFieldObject({
|
|
311
|
+
const balanceSheetDynamicFieldObjectResponse =
|
|
312
|
+
await query.cache.queryGetDynamicFieldObject({
|
|
316
313
|
parentId: balanceSheetParentId,
|
|
317
314
|
name: {
|
|
318
315
|
type: '0x1::type_name::TypeName',
|
|
@@ -336,9 +333,8 @@ export const getMarketPool = async (
|
|
|
336
333
|
// Get borrow index.
|
|
337
334
|
const borrowIndexParentId =
|
|
338
335
|
fields.borrow_dynamics.fields.table.fields.id.id;
|
|
339
|
-
const borrowIndexDynamicFieldObjectResponse =
|
|
340
|
-
.
|
|
341
|
-
.getDynamicFieldObject({
|
|
336
|
+
const borrowIndexDynamicFieldObjectResponse =
|
|
337
|
+
await query.cache.queryGetDynamicFieldObject({
|
|
342
338
|
parentId: borrowIndexParentId,
|
|
343
339
|
name: {
|
|
344
340
|
type: '0x1::type_name::TypeName',
|
|
@@ -362,9 +358,8 @@ export const getMarketPool = async (
|
|
|
362
358
|
// Get interest models.
|
|
363
359
|
const interestModelParentId =
|
|
364
360
|
fields.interest_models.fields.table.fields.id.id;
|
|
365
|
-
const interestModelDynamicFieldObjectResponse =
|
|
366
|
-
.
|
|
367
|
-
.getDynamicFieldObject({
|
|
361
|
+
const interestModelDynamicFieldObjectResponse =
|
|
362
|
+
await query.cache.queryGetDynamicFieldObject({
|
|
368
363
|
parentId: interestModelParentId,
|
|
369
364
|
name: {
|
|
370
365
|
type: '0x1::type_name::TypeName',
|
|
@@ -386,9 +381,8 @@ export const getMarketPool = async (
|
|
|
386
381
|
}
|
|
387
382
|
|
|
388
383
|
// Get borrow fee.
|
|
389
|
-
const borrowFeeDynamicFieldObjectResponse =
|
|
390
|
-
.
|
|
391
|
-
.getDynamicFieldObject({
|
|
384
|
+
const borrowFeeDynamicFieldObjectResponse =
|
|
385
|
+
await query.cache.queryGetDynamicFieldObject({
|
|
392
386
|
parentId: marketId,
|
|
393
387
|
name: {
|
|
394
388
|
type: `${BORROW_FEE_PROTOCOL_ID}::market_dynamic_keys::BorrowFeeKey`,
|
|
@@ -482,11 +476,8 @@ export const getMarketCollaterals = async (
|
|
|
482
476
|
) => {
|
|
483
477
|
collateralCoinNames = collateralCoinNames || [...SUPPORT_COLLATERALS];
|
|
484
478
|
const marketId = query.address.get('core.market');
|
|
485
|
-
const marketObjectResponse = await query.
|
|
486
|
-
|
|
487
|
-
options: {
|
|
488
|
-
showContent: true,
|
|
489
|
-
},
|
|
479
|
+
const marketObjectResponse = await query.cache.queryGetObject(marketId, {
|
|
480
|
+
showContent: true,
|
|
490
481
|
});
|
|
491
482
|
const coinPrices = await query.utils.getCoinPrices(collateralCoinNames ?? []);
|
|
492
483
|
|
|
@@ -544,11 +535,8 @@ export const getMarketCollateral = async (
|
|
|
544
535
|
marketObject =
|
|
545
536
|
marketObject ||
|
|
546
537
|
(
|
|
547
|
-
await query.
|
|
548
|
-
|
|
549
|
-
options: {
|
|
550
|
-
showContent: true,
|
|
551
|
-
},
|
|
538
|
+
await query.cache.queryGetObject(marketId, {
|
|
539
|
+
showContent: true,
|
|
552
540
|
})
|
|
553
541
|
).data;
|
|
554
542
|
|
|
@@ -581,9 +569,8 @@ export const getMarketCollateral = async (
|
|
|
581
569
|
|
|
582
570
|
// Get risk model.
|
|
583
571
|
const riskModelParentId = fields.risk_models.fields.table.fields.id.id;
|
|
584
|
-
const riskModelDynamicFieldObjectResponse =
|
|
585
|
-
.
|
|
586
|
-
.getDynamicFieldObject({
|
|
572
|
+
const riskModelDynamicFieldObjectResponse =
|
|
573
|
+
await query.cache.queryGetDynamicFieldObject({
|
|
587
574
|
parentId: riskModelParentId,
|
|
588
575
|
name: {
|
|
589
576
|
type: '0x1::type_name::TypeName',
|
|
@@ -606,9 +593,8 @@ export const getMarketCollateral = async (
|
|
|
606
593
|
// Get collateral stat.
|
|
607
594
|
const collateralStatParentId =
|
|
608
595
|
fields.collateral_stats.fields.table.fields.id.id;
|
|
609
|
-
const collateralStatDynamicFieldObjectResponse =
|
|
610
|
-
.
|
|
611
|
-
.getDynamicFieldObject({
|
|
596
|
+
const collateralStatDynamicFieldObjectResponse =
|
|
597
|
+
await query.cache.queryGetDynamicFieldObject({
|
|
612
598
|
parentId: collateralStatParentId,
|
|
613
599
|
name: {
|
|
614
600
|
type: '0x1::type_name::TypeName',
|
|
@@ -687,15 +673,14 @@ export const getObligations = async (
|
|
|
687
673
|
let hasNextPage = false;
|
|
688
674
|
let nextCursor: string | null | undefined = null;
|
|
689
675
|
do {
|
|
690
|
-
const paginatedKeyObjectsResponse = await query.
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
});
|
|
676
|
+
const paginatedKeyObjectsResponse = await query.cache.queryGetOwnedObjects({
|
|
677
|
+
owner,
|
|
678
|
+
filter: {
|
|
679
|
+
StructType: `${protocolObjectId}::obligation::ObligationKey`,
|
|
680
|
+
},
|
|
681
|
+
cursor: nextCursor,
|
|
682
|
+
});
|
|
683
|
+
|
|
699
684
|
keyObjectsResponse.push(...paginatedKeyObjectsResponse.data);
|
|
700
685
|
if (
|
|
701
686
|
paginatedKeyObjectsResponse.hasNextPage &&
|
|
@@ -711,7 +696,8 @@ export const getObligations = async (
|
|
|
711
696
|
const keyObjectIds: string[] = keyObjectsResponse
|
|
712
697
|
.map((ref: any) => ref?.data?.objectId)
|
|
713
698
|
.filter((id: any) => id !== undefined);
|
|
714
|
-
const keyObjects = await query.
|
|
699
|
+
const keyObjects = await query.cache.queryGetObjects(keyObjectIds);
|
|
700
|
+
|
|
715
701
|
const obligations: Obligation[] = [];
|
|
716
702
|
for (const keyObject of keyObjects) {
|
|
717
703
|
const keyId = keyObject.objectId;
|
|
@@ -736,12 +722,10 @@ export const getObligationLocked = async (
|
|
|
736
722
|
query: ScallopQuery,
|
|
737
723
|
obligationId: string
|
|
738
724
|
) => {
|
|
739
|
-
const obligationObjectResponse = await query.
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
},
|
|
744
|
-
});
|
|
725
|
+
const obligationObjectResponse = await query.cache.queryGetObject(
|
|
726
|
+
obligationId,
|
|
727
|
+
{ showContent: true }
|
|
728
|
+
);
|
|
745
729
|
let obligationLocked = false;
|
|
746
730
|
if (
|
|
747
731
|
obligationObjectResponse.data &&
|
|
@@ -772,9 +756,14 @@ export const queryObligation = async (
|
|
|
772
756
|
) => {
|
|
773
757
|
const packageId = query.address.get('core.packages.query.id');
|
|
774
758
|
const queryTarget = `${packageId}::obligation_query::obligation_data`;
|
|
775
|
-
const
|
|
776
|
-
|
|
777
|
-
const
|
|
759
|
+
const args = [obligationId];
|
|
760
|
+
|
|
761
|
+
// const txBlock = new SuiKitTxBlock();
|
|
762
|
+
// txBlock.moveCall(queryTarget, args);
|
|
763
|
+
const queryResult = await query.cache.queryInspectTxn(
|
|
764
|
+
{ queryTarget, args }
|
|
765
|
+
// txBlock
|
|
766
|
+
);
|
|
778
767
|
return queryResult.events[0].parsedJson as ObligationQueryInterface;
|
|
779
768
|
};
|
|
780
769
|
|
|
@@ -797,9 +786,8 @@ export const getCoinAmounts = async (
|
|
|
797
786
|
let hasNextPage = false;
|
|
798
787
|
let nextCursor: string | null | undefined = null;
|
|
799
788
|
do {
|
|
800
|
-
const paginatedCoinObjectsResponse = await query.
|
|
801
|
-
|
|
802
|
-
.getOwnedObjects({
|
|
789
|
+
const paginatedCoinObjectsResponse = await query.cache.queryGetOwnedObjects(
|
|
790
|
+
{
|
|
803
791
|
owner,
|
|
804
792
|
filter: {
|
|
805
793
|
MatchAny: assetCoinNames.map((assetCoinName) => {
|
|
@@ -812,7 +800,8 @@ export const getCoinAmounts = async (
|
|
|
812
800
|
showContent: true,
|
|
813
801
|
},
|
|
814
802
|
cursor: nextCursor,
|
|
815
|
-
}
|
|
803
|
+
}
|
|
804
|
+
);
|
|
816
805
|
|
|
817
806
|
coinObjectsResponse.push(...paginatedCoinObjectsResponse.data);
|
|
818
807
|
if (
|
|
@@ -869,16 +858,16 @@ export const getCoinAmount = async (
|
|
|
869
858
|
let hasNextPage = false;
|
|
870
859
|
let nextCursor: string | null | undefined = null;
|
|
871
860
|
do {
|
|
872
|
-
const paginatedCoinObjectsResponse = await query.
|
|
873
|
-
|
|
874
|
-
.getOwnedObjects({
|
|
861
|
+
const paginatedCoinObjectsResponse = await query.cache.queryGetOwnedObjects(
|
|
862
|
+
{
|
|
875
863
|
owner,
|
|
876
864
|
filter: { StructType: `0x2::coin::Coin<${coinType}>` },
|
|
877
865
|
options: {
|
|
878
866
|
showContent: true,
|
|
879
867
|
},
|
|
880
868
|
cursor: nextCursor,
|
|
881
|
-
}
|
|
869
|
+
}
|
|
870
|
+
);
|
|
882
871
|
|
|
883
872
|
coinObjectsResponse.push(...paginatedCoinObjectsResponse.data);
|
|
884
873
|
if (
|
|
@@ -932,9 +921,8 @@ export const getMarketCoinAmounts = async (
|
|
|
932
921
|
let hasNextPage = false;
|
|
933
922
|
let nextCursor: string | null | undefined = null;
|
|
934
923
|
do {
|
|
935
|
-
const paginatedMarketCoinObjectsResponse =
|
|
936
|
-
.
|
|
937
|
-
.getOwnedObjects({
|
|
924
|
+
const paginatedMarketCoinObjectsResponse =
|
|
925
|
+
await query.cache.queryGetOwnedObjects({
|
|
938
926
|
owner,
|
|
939
927
|
filter: {
|
|
940
928
|
MatchAny: marketCoinNames.map((marketCoinName) => {
|
|
@@ -1007,9 +995,8 @@ export const getMarketCoinAmount = async (
|
|
|
1007
995
|
let hasNextPage = false;
|
|
1008
996
|
let nextCursor: string | null | undefined = null;
|
|
1009
997
|
do {
|
|
1010
|
-
const paginatedMarketCoinObjectsResponse =
|
|
1011
|
-
.
|
|
1012
|
-
.getOwnedObjects({
|
|
998
|
+
const paginatedMarketCoinObjectsResponse =
|
|
999
|
+
await query.cache.queryGetOwnedObjects({
|
|
1013
1000
|
owner,
|
|
1014
1001
|
filter: { StructType: `0x2::coin::Coin<${marketCoinType}>` },
|
|
1015
1002
|
options: {
|
|
@@ -15,12 +15,10 @@ export const getPythPrice = async (
|
|
|
15
15
|
const pythFeedObjectId = query.address.get(
|
|
16
16
|
`core.coins.${assetCoinName}.oracle.pyth.feedObject`
|
|
17
17
|
);
|
|
18
|
-
const priceFeedObjectResponse = await query.
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
},
|
|
23
|
-
});
|
|
18
|
+
const priceFeedObjectResponse = await query.cache.queryGetObject(
|
|
19
|
+
pythFeedObjectId,
|
|
20
|
+
{ showContent: true }
|
|
21
|
+
);
|
|
24
22
|
|
|
25
23
|
if (priceFeedObjectResponse.data) {
|
|
26
24
|
const priceFeedPoolObject = priceFeedObjectResponse.data;
|
|
@@ -245,9 +245,8 @@ export const getStakeAccounts = async (
|
|
|
245
245
|
let hasNextPage = false;
|
|
246
246
|
let nextCursor: string | null | undefined = null;
|
|
247
247
|
do {
|
|
248
|
-
const paginatedStakeObjectsResponse =
|
|
249
|
-
.
|
|
250
|
-
.getOwnedObjects({
|
|
248
|
+
const paginatedStakeObjectsResponse =
|
|
249
|
+
await query.cache.queryGetOwnedObjects({
|
|
251
250
|
owner,
|
|
252
251
|
filter: { StructType: stakeAccountType },
|
|
253
252
|
options: {
|
|
@@ -298,7 +297,7 @@ export const getStakeAccounts = async (
|
|
|
298
297
|
const stakeObjectIds: string[] = stakeObjectsResponse
|
|
299
298
|
.map((ref: any) => ref?.data?.objectId)
|
|
300
299
|
.filter((id: any) => id !== undefined);
|
|
301
|
-
const stakeObjects = await query.
|
|
300
|
+
const stakeObjects = await query.cache.queryGetObjects(stakeObjectIds);
|
|
302
301
|
for (const stakeObject of stakeObjects) {
|
|
303
302
|
const id = stakeObject.objectId;
|
|
304
303
|
const type = stakeObject.type!;
|
|
@@ -421,12 +420,9 @@ export const getStakePool = async (
|
|
|
421
420
|
) => {
|
|
422
421
|
const poolId = query.address.get(`spool.pools.${marketCoinName}.id`);
|
|
423
422
|
let stakePool: StakePool | undefined = undefined;
|
|
424
|
-
const stakePoolObjectResponse = await query.
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
showContent: true,
|
|
428
|
-
showType: true,
|
|
429
|
-
},
|
|
423
|
+
const stakePoolObjectResponse = await query.cache.queryGetObject(poolId, {
|
|
424
|
+
showContent: true,
|
|
425
|
+
showType: true,
|
|
430
426
|
});
|
|
431
427
|
if (stakePoolObjectResponse.data) {
|
|
432
428
|
const stakePoolObject = stakePoolObjectResponse.data;
|
|
@@ -482,13 +478,14 @@ export const getStakeRewardPool = async (
|
|
|
482
478
|
`spool.pools.${marketCoinName}.rewardPoolId`
|
|
483
479
|
);
|
|
484
480
|
let stakeRewardPool: StakeRewardPool | undefined = undefined;
|
|
485
|
-
const stakeRewardPoolObjectResponse = await query.
|
|
486
|
-
|
|
487
|
-
|
|
481
|
+
const stakeRewardPoolObjectResponse = await query.cache.queryGetObject(
|
|
482
|
+
poolId,
|
|
483
|
+
{
|
|
488
484
|
showContent: true,
|
|
489
485
|
showType: true,
|
|
490
|
-
}
|
|
491
|
-
|
|
486
|
+
}
|
|
487
|
+
);
|
|
488
|
+
|
|
492
489
|
if (stakeRewardPoolObjectResponse.data) {
|
|
493
490
|
const stakeRewardPoolObject = stakeRewardPoolObjectResponse.data;
|
|
494
491
|
const id = stakeRewardPoolObject.objectId;
|
|
@@ -91,9 +91,8 @@ export const getVeSca = async (
|
|
|
91
91
|
|
|
92
92
|
let vesca: Vesca | undefined = undefined;
|
|
93
93
|
|
|
94
|
-
const veScaDynamicFieldObjectResponse =
|
|
95
|
-
.
|
|
96
|
-
.getDynamicFieldObject({
|
|
94
|
+
const veScaDynamicFieldObjectResponse =
|
|
95
|
+
await query.cache.queryGetDynamicFieldObject({
|
|
97
96
|
parentId: tableId,
|
|
98
97
|
name: {
|
|
99
98
|
type: '0x2::object::ID',
|
package/src/types/model.ts
CHANGED
|
@@ -7,6 +7,7 @@ import type {
|
|
|
7
7
|
ScallopUtils,
|
|
8
8
|
ScallopBuilder,
|
|
9
9
|
} from '../models';
|
|
10
|
+
import { ScallopCache } from 'src/models/scallopCache';
|
|
10
11
|
|
|
11
12
|
export type ScallopClientFnReturnType<T extends boolean> = T extends true
|
|
12
13
|
? SuiTransactionBlockResponse
|
|
@@ -18,6 +19,7 @@ export type ScallopInstanceParams = {
|
|
|
18
19
|
query?: ScallopQuery;
|
|
19
20
|
utils?: ScallopUtils;
|
|
20
21
|
builder?: ScallopBuilder;
|
|
22
|
+
cache: ScallopCache;
|
|
21
23
|
};
|
|
22
24
|
|
|
23
25
|
export type ScallopAddressParams = {
|
|
@@ -16,24 +16,6 @@ export type BorrowIncentivePools = OptionalKeys<
|
|
|
16
16
|
Record<SupportBorrowIncentiveCoins, BorrowIncentivePool>
|
|
17
17
|
>;
|
|
18
18
|
|
|
19
|
-
// export type BorrowIncentivePool = {
|
|
20
|
-
// coinName: SupportBorrowIncentiveCoins;
|
|
21
|
-
// symbol: string;
|
|
22
|
-
// coinType: string;
|
|
23
|
-
// rewardCoinType: string;
|
|
24
|
-
// coinDecimal: number;
|
|
25
|
-
// rewardCoinDecimal: number;
|
|
26
|
-
// coinPrice: number;
|
|
27
|
-
// rewardCoinPrice: number;
|
|
28
|
-
// } & Required<
|
|
29
|
-
// Pick<
|
|
30
|
-
// ParsedBorrowIncentivePoolData,
|
|
31
|
-
// 'maxPoints' | 'distributedPoint' | 'maxStake'
|
|
32
|
-
// >
|
|
33
|
-
// > &
|
|
34
|
-
// CalculatedBorrowIncentivePoolData &
|
|
35
|
-
// BorrowIncentiveRewardPool;
|
|
36
|
-
|
|
37
19
|
export type BorrowIncentivePoolPoints = {
|
|
38
20
|
symbol: string;
|
|
39
21
|
coinName: SupportBorrowIncentiveRewardCoins;
|
|
@@ -60,21 +42,6 @@ export type BorrowIncentivePool = {
|
|
|
60
42
|
>;
|
|
61
43
|
};
|
|
62
44
|
|
|
63
|
-
// export type OriginBorrowIncentivePoolData = {
|
|
64
|
-
// created_at: string;
|
|
65
|
-
// distributed_point: string;
|
|
66
|
-
// distributed_point_per_period: string;
|
|
67
|
-
// index: string;
|
|
68
|
-
// last_update: string;
|
|
69
|
-
// max_distributed_point: string;
|
|
70
|
-
// max_stakes: string;
|
|
71
|
-
// point_distribution_time: string;
|
|
72
|
-
// pool_type: {
|
|
73
|
-
// name: string;
|
|
74
|
-
// };
|
|
75
|
-
// stakes: string;
|
|
76
|
-
// };
|
|
77
|
-
|
|
78
45
|
export type OriginBorrowIncentivePoolPointData = {
|
|
79
46
|
point_type: {
|
|
80
47
|
name: string;
|
|
@@ -112,18 +79,6 @@ export type ParsedBorrowIncentivePoolPointData = {
|
|
|
112
79
|
lastUpdate: number;
|
|
113
80
|
};
|
|
114
81
|
|
|
115
|
-
// export type ParsedBorrowIncentivePoolData = {
|
|
116
|
-
// poolType: string;
|
|
117
|
-
// maxPoint: number;
|
|
118
|
-
// distributedPoint: number;
|
|
119
|
-
// pointPerPeriod: number;
|
|
120
|
-
// period: number;
|
|
121
|
-
// maxStake: number;
|
|
122
|
-
// staked: number;
|
|
123
|
-
// index: number;
|
|
124
|
-
// createdAt: number;
|
|
125
|
-
// lastUpdate: number;
|
|
126
|
-
// };
|
|
127
82
|
export type ParsedBorrowIncentivePoolData = {
|
|
128
83
|
poolType: string;
|
|
129
84
|
poolPoints: OptionalKeys<
|
|
@@ -154,54 +109,10 @@ export type CalculatedBorrowIncentivePoolPointData = {
|
|
|
154
109
|
rewardPerSec: number;
|
|
155
110
|
};
|
|
156
111
|
|
|
157
|
-
// export type BorrowIncentiveRewardPool = CalculatedBorrowIncentiveRewardPoolData;
|
|
158
|
-
|
|
159
|
-
// export type OriginBorrowIncentiveRewardPoolData = {
|
|
160
|
-
// claimed_rewards: string;
|
|
161
|
-
// exchange_rate_denominator: string;
|
|
162
|
-
// exchange_rate_numerator: string;
|
|
163
|
-
// remaining_reward: string;
|
|
164
|
-
// reward_type: {
|
|
165
|
-
// name: string;
|
|
166
|
-
// };
|
|
167
|
-
// };
|
|
168
|
-
|
|
169
|
-
// export type ParsedBorrowIncentiveRewardPoolData = {
|
|
170
|
-
// rewardType: string;
|
|
171
|
-
// claimedRewards: number;
|
|
172
|
-
// exchangeRateDenominator: number;
|
|
173
|
-
// exchangeRateNumerator: number;
|
|
174
|
-
// remainingRewards: number;
|
|
175
|
-
// };
|
|
176
|
-
|
|
177
|
-
// export type CalculatedBorrowIncentiveRewardPoolData = {
|
|
178
|
-
// rewardApr: number;
|
|
179
|
-
// totalRewardAmount: number;
|
|
180
|
-
// totalRewardCoin: number;
|
|
181
|
-
// totalRewardValue: number;
|
|
182
|
-
// // remaindRewardAmount: number;
|
|
183
|
-
// // remaindRewardCoin: number;
|
|
184
|
-
// // remaindRewardValue: number;
|
|
185
|
-
// // claimedRewardAmount: number;
|
|
186
|
-
// // claimedRewardCoin: number;
|
|
187
|
-
// // claimedRewardValue: number;
|
|
188
|
-
// rewardPerSec: number;
|
|
189
|
-
// };
|
|
190
|
-
|
|
191
112
|
export type BorrowIncentiveAccounts = OptionalKeys<
|
|
192
113
|
Record<SupportBorrowIncentiveCoins, ParsedBorrowIncentiveAccountData>
|
|
193
114
|
>;
|
|
194
115
|
|
|
195
|
-
// export type OriginBorrowIncentiveAccountData = {
|
|
196
|
-
// amount: string;
|
|
197
|
-
// index: string;
|
|
198
|
-
// points: string;
|
|
199
|
-
// pool_type: {
|
|
200
|
-
// name: string;
|
|
201
|
-
// };
|
|
202
|
-
// total_points: string;
|
|
203
|
-
// };
|
|
204
|
-
|
|
205
116
|
export type OriginBorrowIncentiveAccountPoolData = {
|
|
206
117
|
point_type: {
|
|
207
118
|
name: string;
|
|
@@ -220,14 +131,6 @@ export type OriginBorrowIncentiveAccountData = {
|
|
|
220
131
|
debt_amount: string;
|
|
221
132
|
};
|
|
222
133
|
|
|
223
|
-
// export type ParsedBorrowIncentiveAccountData = {
|
|
224
|
-
// poolType: string;
|
|
225
|
-
// amount: number;
|
|
226
|
-
// index: number;
|
|
227
|
-
// points: number;
|
|
228
|
-
// totalPoints: number;
|
|
229
|
-
// };
|
|
230
|
-
|
|
231
134
|
export type ParsedBorrowIncentiveAccountPoolData = {
|
|
232
135
|
pointType: string;
|
|
233
136
|
weightedAmount: number;
|
|
@@ -250,11 +153,6 @@ export type ParsedBorrowIncentiveAccountData = {
|
|
|
250
153
|
/**
|
|
251
154
|
* The query interface for `incentive_pools_query::incentive_pools_data` inspectTxn.
|
|
252
155
|
*/
|
|
253
|
-
// export interface BorrowIncentivePoolsQueryInterface {
|
|
254
|
-
// incentive_pools: OriginBorrowIncentivePoolData[];
|
|
255
|
-
// reward_pool: OriginBorrowIncentiveRewardPoolData;
|
|
256
|
-
// }
|
|
257
|
-
|
|
258
156
|
export interface BorrowIncentivePoolsQueryInterface {
|
|
259
157
|
incentive_pools: OriginBorrowIncentivePoolData[];
|
|
260
158
|
}
|
|
@@ -262,11 +160,6 @@ export interface BorrowIncentivePoolsQueryInterface {
|
|
|
262
160
|
/**
|
|
263
161
|
* The query interface for `incentive_account_query::incentive_account_data` inspectTxn.
|
|
264
162
|
*/
|
|
265
|
-
// export interface BorrowIncentiveAccountsQueryInterface {
|
|
266
|
-
// incentive_states: OriginBorrowIncentiveAccountData[];
|
|
267
|
-
// total_points: string;
|
|
268
|
-
// }
|
|
269
|
-
|
|
270
163
|
export interface BorrowIncentiveAccountsQueryInterface {
|
|
271
164
|
pool_records: OriginBorrowIncentiveAccountData[];
|
|
272
165
|
}
|