@scallop-io/sui-scallop-sdk 1.4.1 → 1.4.2-rc.1

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.
Files changed (80) hide show
  1. package/dist/constants/common.d.ts +1 -1
  2. package/dist/constants/poolAddress.d.ts +16 -4
  3. package/dist/constants/queryKeys.d.ts +2 -2
  4. package/dist/constants/tokenBucket.d.ts +2 -2
  5. package/dist/index.d.ts +1 -0
  6. package/dist/index.js +1270 -588
  7. package/dist/index.js.map +1 -1
  8. package/dist/index.mjs +1225 -544
  9. package/dist/index.mjs.map +1 -1
  10. package/dist/models/scallopBuilder.d.ts +2 -1
  11. package/dist/models/scallopCache.d.ts +2 -0
  12. package/dist/models/scallopQuery.d.ts +38 -20
  13. package/dist/models/scallopUtils.d.ts +4 -2
  14. package/dist/queries/borrowIncentiveQuery.d.ts +12 -0
  15. package/dist/queries/coreQuery.d.ts +18 -19
  16. package/dist/queries/index.d.ts +2 -0
  17. package/dist/queries/isolatedAssetQuery.d.ts +2 -2
  18. package/dist/queries/objectsQuery.d.ts +3 -0
  19. package/dist/queries/poolAddressesQuery.d.ts +18 -0
  20. package/dist/queries/spoolQuery.d.ts +6 -2
  21. package/dist/test.d.ts +1 -0
  22. package/dist/types/builder/borrowIncentive.d.ts +5 -5
  23. package/dist/types/builder/core.d.ts +20 -16
  24. package/dist/types/builder/loyaltyProgram.d.ts +1 -1
  25. package/dist/types/builder/referral.d.ts +4 -4
  26. package/dist/types/builder/sCoin.d.ts +2 -2
  27. package/dist/types/builder/spool.d.ts +4 -4
  28. package/dist/types/builder/vesca.d.ts +6 -6
  29. package/dist/types/query/core.d.ts +22 -5
  30. package/dist/types/query/spool.d.ts +20 -0
  31. package/dist/types/utils.d.ts +7 -2
  32. package/dist/utils/core.d.ts +2 -0
  33. package/dist/utils/index.d.ts +2 -0
  34. package/dist/utils/query.d.ts +1 -1
  35. package/dist/utils/util.d.ts +1 -0
  36. package/package.json +7 -7
  37. package/src/builders/borrowIncentiveBuilder.ts +28 -15
  38. package/src/builders/coreBuilder.ts +76 -49
  39. package/src/builders/loyaltyProgramBuilder.ts +4 -3
  40. package/src/builders/referralBuilder.ts +23 -10
  41. package/src/builders/sCoinBuilder.ts +8 -6
  42. package/src/builders/spoolBuilder.ts +21 -14
  43. package/src/builders/vescaBuilder.ts +23 -13
  44. package/src/constants/common.ts +1 -12
  45. package/src/constants/poolAddress.ts +336 -10
  46. package/src/constants/queryKeys.ts +9 -5
  47. package/src/constants/testAddress.ts +42 -0
  48. package/src/constants/tokenBucket.ts +2 -2
  49. package/src/index.ts +1 -0
  50. package/src/models/scallopBuilder.ts +59 -2
  51. package/src/models/scallopCache.ts +171 -19
  52. package/src/models/scallopClient.ts +16 -10
  53. package/src/models/scallopQuery.ts +36 -28
  54. package/src/models/scallopUtils.ts +11 -4
  55. package/src/queries/borrowIncentiveQuery.ts +6 -8
  56. package/src/queries/borrowLimitQuery.ts +1 -0
  57. package/src/queries/coreQuery.ts +408 -258
  58. package/src/queries/index.ts +2 -0
  59. package/src/queries/isolatedAssetQuery.ts +37 -31
  60. package/src/queries/objectsQuery.ts +20 -0
  61. package/src/queries/poolAddressesQuery.ts +146 -0
  62. package/src/queries/portfolioQuery.ts +31 -13
  63. package/src/queries/priceQuery.ts +3 -1
  64. package/src/queries/spoolQuery.ts +189 -122
  65. package/src/test.ts +17 -0
  66. package/src/types/builder/borrowIncentive.ts +8 -5
  67. package/src/types/builder/core.ts +23 -17
  68. package/src/types/builder/loyaltyProgram.ts +1 -1
  69. package/src/types/builder/referral.ts +6 -4
  70. package/src/types/builder/sCoin.ts +2 -2
  71. package/src/types/builder/spool.ts +4 -4
  72. package/src/types/builder/vesca.ts +9 -6
  73. package/src/types/query/core.ts +21 -5
  74. package/src/types/query/spool.ts +21 -0
  75. package/src/types/utils.ts +8 -3
  76. package/src/utils/core.ts +18 -0
  77. package/src/utils/index.ts +2 -0
  78. package/src/utils/query.ts +21 -5
  79. package/src/utils/tokenBucket.ts +9 -29
  80. package/src/utils/util.ts +8 -0
@@ -4,7 +4,7 @@ import { ScallopQuery } from './scallopQuery';
4
4
  import { ScallopUtils } from './scallopUtils';
5
5
  import type { SuiTransactionBlockResponse } from '@mysten/sui/client';
6
6
  import type { Transaction } from '@mysten/sui/transactions';
7
- import type { SuiTxBlock as SuiKitTxBlock } from '@scallop-io/sui-kit';
7
+ import type { SuiAmountsArg, SuiTxBlock as SuiKitTxBlock, SuiObjectArg, SuiTxArg, SuiVecTxArg } from '@scallop-io/sui-kit';
8
8
  import type { ScallopBuilderParams, ScallopTxBlock, SupportMarketCoins, SupportAssetCoins, SupportSCoin, ScallopBuilderInstanceParams, SelectCoinReturnType } from '../types';
9
9
  import { ScallopCache } from './scallopCache';
10
10
  /**
@@ -86,4 +86,5 @@ export declare class ScallopBuilder {
86
86
  * @param txBlock - Scallop txBlock, txBlock created by SuiKit, or original transaction block.
87
87
  */
88
88
  signAndSendTxBlock(txBlock: ScallopTxBlock | SuiKitTxBlock | Transaction): Promise<SuiTransactionBlockResponse>;
89
+ moveCall(txb: ScallopTxBlock | SuiKitTxBlock, target: string, args?: (SuiTxArg | SuiVecTxArg | SuiObjectArg | SuiAmountsArg)[], typeArgs?: string[]): import("@scallop-io/sui-kit").TransactionResult;
89
90
  }
@@ -38,6 +38,7 @@ export declare class ScallopCache {
38
38
  * - `none`: No queries will be refetched. Queries that match the refetch predicate will only be marked as invalid.
39
39
  */
40
40
  invalidateAllCache(): Promise<Promise<void>[]>;
41
+ private retryFn;
41
42
  /**
42
43
  * @description Provides cache for inspectTxn of the SuiKit.
43
44
  * @param QueryInspectTxnParams
@@ -45,6 +46,7 @@ export declare class ScallopCache {
45
46
  * @returns Promise<DevInspectResults>
46
47
  */
47
48
  queryInspectTxn({ queryTarget, args, typeArgs, }: QueryInspectTxnParams): Promise<DevInspectResults | null>;
49
+ queryGetNormalizedMoveFunction(target: string): Promise<import("@mysten/sui/client").SuiMoveNormalizedFunction | null>;
48
50
  /**
49
51
  * @description Provides cache for getObject of the SuiKit.
50
52
  * @param objectId
@@ -34,6 +34,7 @@ export declare class ScallopQuery {
34
34
  */
35
35
  init(force?: boolean, address?: ScallopAddress): Promise<void>;
36
36
  /**
37
+ * @deprecated use getMarketPools
37
38
  * Query market data.
38
39
  * @param indexer - Whether to use indexer.
39
40
  * @return Market data.
@@ -57,22 +58,8 @@ export declare class ScallopQuery {
57
58
  coinPrices?: CoinPrices;
58
59
  indexer?: boolean;
59
60
  }): Promise<{
60
- usdc?: MarketPool | undefined;
61
- sbeth?: MarketPool | undefined;
62
- weth?: MarketPool | undefined;
63
- wbtc?: MarketPool | undefined;
64
- wusdc?: MarketPool | undefined;
65
- wusdt?: MarketPool | undefined;
66
- sui?: MarketPool | undefined;
67
- wapt?: MarketPool | undefined;
68
- wsol?: MarketPool | undefined;
69
- cetus?: MarketPool | undefined;
70
- afsui?: MarketPool | undefined;
71
- hasui?: MarketPool | undefined;
72
- vsui?: MarketPool | undefined;
73
- sca?: MarketPool | undefined;
74
- fud?: MarketPool | undefined;
75
- deep?: MarketPool | undefined;
61
+ pools: MarketPools;
62
+ collaterals: import("../types").MarketCollaterals;
76
63
  }>;
77
64
  /**
78
65
  * Get market pool
@@ -82,7 +69,6 @@ export declare class ScallopQuery {
82
69
  * @return Market pool data.
83
70
  */
84
71
  getMarketPool(poolCoinName: SupportPoolCoins, args?: {
85
- marketObject?: SuiObjectData | null;
86
72
  coinPrice?: number;
87
73
  indexer?: boolean;
88
74
  }): Promise<MarketPool | undefined>;
@@ -306,20 +292,26 @@ export declare class ScallopQuery {
306
292
  * @return Borrow incentive pools data.
307
293
  */
308
294
  getBorrowIncentivePools(coinNames?: SupportBorrowIncentiveCoins[], args?: {
309
- coinPrices: CoinPrices;
295
+ coinPrices?: CoinPrices;
310
296
  indexer?: boolean;
311
297
  marketPools?: MarketPools;
312
298
  }): Promise<{
313
299
  usdc?: import("../types").BorrowIncentivePool | undefined;
314
300
  sbeth?: import("../types").BorrowIncentivePool | undefined;
315
301
  weth?: import("../types").BorrowIncentivePool | undefined;
302
+ wbtc?: import("../types").BorrowIncentivePool | undefined;
316
303
  wusdc?: import("../types").BorrowIncentivePool | undefined;
317
304
  wusdt?: import("../types").BorrowIncentivePool | undefined;
318
305
  sui?: import("../types").BorrowIncentivePool | undefined;
306
+ wapt?: import("../types").BorrowIncentivePool | undefined;
307
+ wsol?: import("../types").BorrowIncentivePool | undefined;
308
+ cetus?: import("../types").BorrowIncentivePool | undefined;
319
309
  afsui?: import("../types").BorrowIncentivePool | undefined;
320
310
  hasui?: import("../types").BorrowIncentivePool | undefined;
321
311
  vsui?: import("../types").BorrowIncentivePool | undefined;
322
312
  sca?: import("../types").BorrowIncentivePool | undefined;
313
+ fud?: import("../types").BorrowIncentivePool | undefined;
314
+ deep?: import("../types").BorrowIncentivePool | undefined;
323
315
  }>;
324
316
  /**
325
317
  * Get borrow incentive accounts data.
@@ -332,13 +324,19 @@ export declare class ScallopQuery {
332
324
  usdc?: import("../types").ParsedBorrowIncentiveAccountData | undefined;
333
325
  sbeth?: import("../types").ParsedBorrowIncentiveAccountData | undefined;
334
326
  weth?: import("../types").ParsedBorrowIncentiveAccountData | undefined;
327
+ wbtc?: import("../types").ParsedBorrowIncentiveAccountData | undefined;
335
328
  wusdc?: import("../types").ParsedBorrowIncentiveAccountData | undefined;
336
329
  wusdt?: import("../types").ParsedBorrowIncentiveAccountData | undefined;
337
330
  sui?: import("../types").ParsedBorrowIncentiveAccountData | undefined;
331
+ wapt?: import("../types").ParsedBorrowIncentiveAccountData | undefined;
332
+ wsol?: import("../types").ParsedBorrowIncentiveAccountData | undefined;
333
+ cetus?: import("../types").ParsedBorrowIncentiveAccountData | undefined;
338
334
  afsui?: import("../types").ParsedBorrowIncentiveAccountData | undefined;
339
335
  hasui?: import("../types").ParsedBorrowIncentiveAccountData | undefined;
340
336
  vsui?: import("../types").ParsedBorrowIncentiveAccountData | undefined;
341
337
  sca?: import("../types").ParsedBorrowIncentiveAccountData | undefined;
338
+ fud?: import("../types").ParsedBorrowIncentiveAccountData | undefined;
339
+ deep?: import("../types").ParsedBorrowIncentiveAccountData | undefined;
342
340
  }>;
343
341
  /**
344
342
  * Get user lending and spool infomation for specific pools.
@@ -390,7 +388,7 @@ export declare class ScallopQuery {
390
388
  * @return All obligation accounts information.
391
389
  */
392
390
  getObligationAccounts(ownerAddress?: string, args?: {
393
- indexer: boolean;
391
+ indexer?: boolean;
394
392
  }): Promise<{
395
393
  [x: string]: import("../types").ObligationAccount | undefined;
396
394
  }>;
@@ -407,7 +405,7 @@ export declare class ScallopQuery {
407
405
  */
408
406
  getObligationAccount(obligationId: string, ownerAddress?: string, args?: {
409
407
  indexer?: boolean;
410
- }): Promise<import("../types").ObligationAccount>;
408
+ }): Promise<import("../types").ObligationAccount | undefined>;
411
409
  /**
412
410
  * Get total value locked.
413
411
  *
@@ -556,4 +554,24 @@ export declare class ScallopQuery {
556
554
  deep?: number | undefined;
557
555
  swapt?: number | undefined;
558
556
  }>;
557
+ /**
558
+ * Query all address (lending pool, collateral pool, borrow dynamics, interest models) of all pool
559
+ * @returns
560
+ */
561
+ getPoolAddresses(): Promise<import("../types").OptionalKeys<Record<"usdc" | "sbeth" | "weth" | "wbtc" | "wusdc" | "wusdt" | "sui" | "wapt" | "wsol" | "cetus" | "afsui" | "hasui" | "vsui" | "sca" | "fud" | "deep", {
562
+ lendingPoolAddress?: string;
563
+ collateralPoolAddress?: string;
564
+ borrowDynamic?: string;
565
+ spoolReward?: string;
566
+ spool?: string;
567
+ sCoinTreasury?: string;
568
+ interestModel?: string;
569
+ riskModel?: string;
570
+ borrowFeeKey?: string;
571
+ supplyLimitKey?: string;
572
+ borrowLimitKey?: string;
573
+ isolatedAssetKey?: string;
574
+ coinDecimalId?: string;
575
+ borrowIncentivePoolId?: string;
576
+ }>>>;
559
577
  }
@@ -59,12 +59,13 @@ export declare class ScallopUtils {
59
59
  */
60
60
  parseSCoinName<T extends SupportSCoin>(coinName: SupportCoins | SupportMarketCoins): T | undefined;
61
61
  /**
62
- * Convert sCoin name to coin name.
62
+ * Convert sCoin name to market coin name.
63
63
  * This function will parse new sCoin name `scallop_...` to its old market coin name which is shorter
64
64
  * e.g: `scallop_sui -> ssui
65
+ * if no `scallop_...` is encountered, return coinName
65
66
  * @return sCoin name
66
67
  */
67
- parseCoinNameFromSCoinName(coinName: string): "susdc" | "ssbeth" | "sweth" | "swbtc" | "swusdc" | "swusdt" | "ssui" | "swsol" | "scetus" | "safsui" | "shasui" | "svsui" | "ssca" | "sfud" | "sdeep";
68
+ parseSCoinTypeNameToMarketCoinName(coinName: string): "susdc" | "ssbeth" | "sweth" | "swbtc" | "swusdc" | "swusdt" | "ssui" | "swsol" | "scetus" | "safsui" | "shasui" | "svsui" | "ssca" | "sfud" | "sdeep";
68
69
  /**
69
70
  * Convert sCoin name into sCoin type
70
71
  * @param sCoinName
@@ -110,6 +111,7 @@ export declare class ScallopUtils {
110
111
  parseCoinNameFromType<T extends SupportAssetCoins>(coinType: string): T extends SupportAssetCoins ? T : SupportAssetCoins;
111
112
  parseCoinNameFromType<T extends SupportMarketCoins>(coinType: string): T extends SupportMarketCoins ? T : SupportMarketCoins;
112
113
  parseCoinNameFromType<T extends SupportCoins>(coinType: string): T extends SupportCoins ? T : SupportCoins;
114
+ parseCoinNameFromType<T extends SupportSCoin>(coinType: string): T extends SupportSCoin ? T : SupportSCoin;
113
115
  /**
114
116
  * Convert market coin name to coin name.
115
117
  *
@@ -18,13 +18,19 @@ export declare const getBorrowIncentivePools: (query: ScallopQuery, borrowIncent
18
18
  usdc?: BorrowIncentivePool | undefined;
19
19
  sbeth?: BorrowIncentivePool | undefined;
20
20
  weth?: BorrowIncentivePool | undefined;
21
+ wbtc?: BorrowIncentivePool | undefined;
21
22
  wusdc?: BorrowIncentivePool | undefined;
22
23
  wusdt?: BorrowIncentivePool | undefined;
23
24
  sui?: BorrowIncentivePool | undefined;
25
+ wapt?: BorrowIncentivePool | undefined;
26
+ wsol?: BorrowIncentivePool | undefined;
27
+ cetus?: BorrowIncentivePool | undefined;
24
28
  afsui?: BorrowIncentivePool | undefined;
25
29
  hasui?: BorrowIncentivePool | undefined;
26
30
  vsui?: BorrowIncentivePool | undefined;
27
31
  sca?: BorrowIncentivePool | undefined;
32
+ fud?: BorrowIncentivePool | undefined;
33
+ deep?: BorrowIncentivePool | undefined;
28
34
  }>;
29
35
  /**
30
36
  * Query borrow incentive accounts data.
@@ -39,13 +45,19 @@ export declare const queryBorrowIncentiveAccounts: ({ utils, }: {
39
45
  usdc?: import("../types").ParsedBorrowIncentiveAccountData | undefined;
40
46
  sbeth?: import("../types").ParsedBorrowIncentiveAccountData | undefined;
41
47
  weth?: import("../types").ParsedBorrowIncentiveAccountData | undefined;
48
+ wbtc?: import("../types").ParsedBorrowIncentiveAccountData | undefined;
42
49
  wusdc?: import("../types").ParsedBorrowIncentiveAccountData | undefined;
43
50
  wusdt?: import("../types").ParsedBorrowIncentiveAccountData | undefined;
44
51
  sui?: import("../types").ParsedBorrowIncentiveAccountData | undefined;
52
+ wapt?: import("../types").ParsedBorrowIncentiveAccountData | undefined;
53
+ wsol?: import("../types").ParsedBorrowIncentiveAccountData | undefined;
54
+ cetus?: import("../types").ParsedBorrowIncentiveAccountData | undefined;
45
55
  afsui?: import("../types").ParsedBorrowIncentiveAccountData | undefined;
46
56
  hasui?: import("../types").ParsedBorrowIncentiveAccountData | undefined;
47
57
  vsui?: import("../types").ParsedBorrowIncentiveAccountData | undefined;
48
58
  sca?: import("../types").ParsedBorrowIncentiveAccountData | undefined;
59
+ fud?: import("../types").ParsedBorrowIncentiveAccountData | undefined;
60
+ deep?: import("../types").ParsedBorrowIncentiveAccountData | undefined;
49
61
  }>;
50
62
  /**
51
63
  * Check veSca bind status
@@ -1,10 +1,12 @@
1
1
  import type { SuiObjectData } from '@mysten/sui/client';
2
2
  import type { SuiObjectArg } from '@scallop-io/sui-kit';
3
3
  import type { ScallopAddress, ScallopCache, ScallopQuery } from '../models';
4
- import { Market, MarketPool, MarketCollateral, SupportAssetCoins, SupportPoolCoins, SupportCollateralCoins, ObligationQueryInterface, Obligation, SupportMarketCoins, OptionalKeys, CoinPrices } from '../types';
4
+ import { Market, MarketPools, MarketPool, MarketCollaterals, MarketCollateral, SupportAssetCoins, SupportPoolCoins, SupportCollateralCoins, ObligationQueryInterface, Obligation, SupportMarketCoins, OptionalKeys, CoinPrices } from '../types';
5
5
  /**
6
6
  * Query market data.
7
7
  *
8
+ * @deprecated Use query market pools
9
+ *
8
10
  * @description
9
11
  * Use inspectTxn call to obtain the data provided in the scallop contract query module.
10
12
  *
@@ -25,23 +27,9 @@ export declare const queryMarket: (query: ScallopQuery, indexer?: boolean, coinP
25
27
  * @param indexer - Whether to use indexer.
26
28
  * @return Market pools data.
27
29
  */
28
- export declare const getMarketPools: (query: ScallopQuery, poolCoinNames?: SupportPoolCoins[], indexer?: boolean, coinPrices?: CoinPrices) => Promise<{
29
- usdc?: MarketPool | undefined;
30
- sbeth?: MarketPool | undefined;
31
- weth?: MarketPool | undefined;
32
- wbtc?: MarketPool | undefined;
33
- wusdc?: MarketPool | undefined;
34
- wusdt?: MarketPool | undefined;
35
- sui?: MarketPool | undefined;
36
- wapt?: MarketPool | undefined;
37
- wsol?: MarketPool | undefined;
38
- cetus?: MarketPool | undefined;
39
- afsui?: MarketPool | undefined;
40
- hasui?: MarketPool | undefined;
41
- vsui?: MarketPool | undefined;
42
- sca?: MarketPool | undefined;
43
- fud?: MarketPool | undefined;
44
- deep?: MarketPool | undefined;
30
+ export declare const getMarketPools: (query: ScallopQuery, poolCoinNames: SupportPoolCoins[], indexer?: boolean, coinPrices?: CoinPrices) => Promise<{
31
+ pools: MarketPools;
32
+ collaterals: MarketCollaterals;
45
33
  }>;
46
34
  /**
47
35
  * Get market pool data.
@@ -53,7 +41,18 @@ export declare const getMarketPools: (query: ScallopQuery, poolCoinNames?: Suppo
53
41
  * @param coinPrice - The coin price.
54
42
  * @returns Market pool data.
55
43
  */
56
- export declare const getMarketPool: (query: ScallopQuery, poolCoinName: SupportPoolCoins, indexer?: boolean, marketObject?: SuiObjectData | null, coinPrice?: number) => Promise<MarketPool | undefined>;
44
+ export declare const getMarketPool: (query: ScallopQuery, poolCoinName: SupportPoolCoins, indexer: boolean | undefined, coinPrice: number, requiredObjects?: {
45
+ balanceSheet: SuiObjectData;
46
+ borrowDynamic: SuiObjectData;
47
+ interestModel: SuiObjectData;
48
+ borrowFeeKey: SuiObjectData;
49
+ supplyLimitKey: SuiObjectData;
50
+ borrowLimitKey: SuiObjectData;
51
+ isolatedAssetKey: SuiObjectData;
52
+ }) => Promise<{
53
+ marketPool: MarketPool;
54
+ collateral?: MarketCollateral;
55
+ } | undefined>;
57
56
  /**
58
57
  * Get coin market collaterals data.
59
58
  *
@@ -10,3 +10,5 @@ export * from './spoolQuery';
10
10
  export * from './supplyLimitQuery';
11
11
  export * from './vescaQuery';
12
12
  export * from './borrowLimitQuery';
13
+ export * from './poolAddressesQuery';
14
+ export * from './objectsQuery';
@@ -1,11 +1,11 @@
1
- import { ScallopAddress, ScallopUtils } from '../models';
1
+ import { ScallopQuery, ScallopUtils } from '../models';
2
2
  import { SupportPoolCoins } from '../types';
3
3
  /**
4
4
  * Return list of isolated assets coin types
5
5
  * @param utils ScallopUtils
6
6
  * @returns list of isolated assets coin types
7
7
  */
8
- export declare const getIsolatedAssets: (address: ScallopAddress) => Promise<string[]>;
8
+ export declare const getIsolatedAssets: (query: ScallopQuery) => Promise<string[]>;
9
9
  /**
10
10
  * Check if the coin type is an isolated asset
11
11
  * @param coinName coin name
@@ -0,0 +1,3 @@
1
+ import { SuiObjectDataOptions } from '@mysten/sui/dist/cjs/client';
2
+ import { ScallopCache } from 'src/models/scallopCache';
3
+ export declare const queryMultipleObjects: (cache: ScallopCache, objectIds: string[], options?: SuiObjectDataOptions, partitionSize?: number) => Promise<import("@mysten/sui/dist/cjs/client").SuiObjectData[]>;
@@ -0,0 +1,18 @@
1
+ import { ScallopQuery } from 'src/models';
2
+ import { OptionalKeys } from 'src/types';
3
+ export declare const getAllAddresses: (query: ScallopQuery) => Promise<OptionalKeys<Record<"usdc" | "sbeth" | "weth" | "wbtc" | "wusdc" | "wusdt" | "sui" | "wapt" | "wsol" | "cetus" | "afsui" | "hasui" | "vsui" | "sca" | "fud" | "deep", {
4
+ lendingPoolAddress?: string;
5
+ collateralPoolAddress?: string;
6
+ borrowDynamic?: string;
7
+ spoolReward?: string;
8
+ spool?: string;
9
+ sCoinTreasury?: string;
10
+ interestModel?: string;
11
+ riskModel?: string;
12
+ borrowFeeKey?: string;
13
+ supplyLimitKey?: string;
14
+ borrowLimitKey?: string;
15
+ isolatedAssetKey?: string;
16
+ coinDecimalId?: string;
17
+ borrowIncentivePoolId?: string;
18
+ }>>>;
@@ -1,5 +1,6 @@
1
+ import type { SuiObjectData } from '@mysten/sui/client';
1
2
  import type { ScallopQuery, ScallopUtils } from '../models';
2
- import type { MarketPool, Spool, StakePool, StakeRewardPool, StakeAccounts, SupportStakeMarketCoins, CoinPrices, MarketPools } from '../types';
3
+ import type { Spool, StakePool, StakeRewardPool, StakeAccounts, SupportStakeMarketCoins, CoinPrices, MarketPools } from '../types';
3
4
  /**
4
5
  * Get spools data.
5
6
  *
@@ -29,7 +30,10 @@ export declare const getSpools: (query: ScallopQuery, stakeMarketCoinNames?: Sup
29
30
  * @param coinPrices - The coin prices.
30
31
  * @return Spool data.
31
32
  */
32
- export declare const getSpool: (query: ScallopQuery, marketCoinName: SupportStakeMarketCoins, indexer?: boolean, marketPool?: MarketPool, coinPrices?: CoinPrices) => Promise<Spool | undefined>;
33
+ export declare const getSpool: (query: ScallopQuery, marketCoinName: SupportStakeMarketCoins, indexer?: boolean, coinPrices?: CoinPrices, requiredObjects?: {
34
+ spool: SuiObjectData;
35
+ spoolReward: SuiObjectData;
36
+ }) => Promise<Spool>;
33
37
  /**
34
38
  * Get all stake accounts of the owner.
35
39
  *
package/dist/test.d.ts ADDED
@@ -0,0 +1 @@
1
+ export {};
@@ -11,11 +11,11 @@ export type BorrowIncentiveIds = {
11
11
  obligationAccessStore: string;
12
12
  };
13
13
  export type BorrowIncentiveNormalMethods = {
14
- stakeObligation: (obligation: SuiObjectArg, obligationKey: SuiObjectArg) => void;
15
- stakeObligationWithVesca: (obligation: SuiObjectArg, obligationKey: SuiObjectArg, veScaKey: SuiObjectArg) => void;
16
- unstakeObligation: (obligation: SuiObjectArg, obligationKey: SuiObjectArg) => void;
17
- claimBorrowIncentive: (obligation: SuiObjectArg, obligationKey: SuiObjectArg, rewardType: SupportBorrowIncentiveRewardCoins) => TransactionResult;
18
- deactivateBoost: (obligation: SuiObjectArg, veScaKey: SuiObjectArg) => void;
14
+ stakeObligation: (obligation: SuiObjectArg, obligationKey: SuiObjectArg) => Promise<void>;
15
+ stakeObligationWithVesca: (obligation: SuiObjectArg, obligationKey: SuiObjectArg, veScaKey: SuiObjectArg) => Promise<void>;
16
+ unstakeObligation: (obligation: SuiObjectArg, obligationKey: SuiObjectArg) => Promise<void>;
17
+ claimBorrowIncentive: (obligation: SuiObjectArg, obligationKey: SuiObjectArg, rewardType: SupportBorrowIncentiveRewardCoins) => Promise<TransactionResult>;
18
+ deactivateBoost: (obligation: SuiObjectArg, veScaKey: SuiObjectArg) => Promise<void>;
19
19
  };
20
20
  export type BorrowIncentiveQuickMethods = {
21
21
  stakeObligationQuick(obligation?: string, obligationKey?: string): Promise<void>;
@@ -1,4 +1,4 @@
1
- import type { SuiTxBlock as SuiKitTxBlock, SuiObjectArg } from '@scallop-io/sui-kit';
1
+ import type { SuiTxBlock as SuiKitTxBlock, SuiObjectArg, SuiTxArg } from '@scallop-io/sui-kit';
2
2
  import type { Argument, TransactionResult } from '@mysten/sui/transactions';
3
3
  import type { ScallopBuilder } from '../../models';
4
4
  import type { SupportCollateralCoins, SupportPoolCoins, SupportAssetCoins } from '../constant';
@@ -17,21 +17,25 @@ type Obligation = NestedResult;
17
17
  type ObligationKey = NestedResult;
18
18
  type ObligationHotPotato = NestedResult;
19
19
  export type CoreNormalMethods = {
20
- openObligation: () => [Obligation, ObligationKey, ObligationHotPotato];
21
- returnObligation: (obligation: SuiObjectArg, obligationHotPotato: SuiObjectArg) => void;
22
- openObligationEntry: () => void;
23
- addCollateral: (obligation: SuiObjectArg, coin: SuiObjectArg, collateralCoinName: SupportCollateralCoins) => void;
24
- takeCollateral: (obligation: SuiObjectArg, obligationKey: SuiObjectArg, amount: number, collateralCoinName: SupportCollateralCoins) => TransactionResult;
25
- deposit: (coin: SuiObjectArg, poolCoinName: SupportPoolCoins) => TransactionResult;
26
- depositEntry: (coin: SuiObjectArg, poolCoinName: SupportPoolCoins) => void;
27
- withdraw: (marketCoin: SuiObjectArg, poolCoinName: SupportPoolCoins) => TransactionResult;
28
- withdrawEntry: (marketCoin: SuiObjectArg, poolCoinName: SupportPoolCoins) => void;
29
- borrow: (obligation: SuiObjectArg, obligationKey: SuiObjectArg, amount: number, poolCoinName: SupportPoolCoins) => TransactionResult;
30
- borrowWithReferral: (obligation: SuiObjectArg, obligationKey: SuiObjectArg, borrowReferral: SuiObjectArg, amount: number, poolCoinName: SupportPoolCoins) => TransactionResult;
31
- borrowEntry: (obligation: SuiObjectArg, obligationKey: SuiObjectArg, amount: number, poolCoinName: SupportPoolCoins) => void;
32
- repay: (obligation: SuiObjectArg, coin: SuiObjectArg, poolCoinName: SupportPoolCoins) => void;
33
- borrowFlashLoan: (amount: number, poolCoinName: SupportPoolCoins) => TransactionResult;
34
- repayFlashLoan: (coin: SuiObjectArg, loan: SuiObjectArg, poolCoinName: SupportPoolCoins) => void;
20
+ openObligation: () => Promise<[
21
+ Obligation,
22
+ ObligationKey,
23
+ ObligationHotPotato
24
+ ]>;
25
+ returnObligation: (obligation: SuiObjectArg, obligationHotPotato: SuiObjectArg) => Promise<void>;
26
+ openObligationEntry: () => Promise<void>;
27
+ addCollateral: (obligation: SuiObjectArg, coin: SuiObjectArg, collateralCoinName: SupportCollateralCoins) => Promise<void>;
28
+ takeCollateral: (obligation: SuiObjectArg, obligationKey: SuiObjectArg, amount: number, collateralCoinName: SupportCollateralCoins) => Promise<TransactionResult>;
29
+ deposit: (coin: SuiObjectArg, poolCoinName: SupportPoolCoins) => Promise<TransactionResult>;
30
+ depositEntry: (coin: SuiObjectArg, poolCoinName: SupportPoolCoins) => Promise<TransactionResult>;
31
+ withdraw: (marketCoin: SuiObjectArg, poolCoinName: SupportPoolCoins) => Promise<TransactionResult>;
32
+ withdrawEntry: (marketCoin: SuiObjectArg, poolCoinName: SupportPoolCoins) => Promise<TransactionResult>;
33
+ borrow: (obligation: SuiObjectArg, obligationKey: SuiObjectArg, amount: number, poolCoinName: SupportPoolCoins) => Promise<TransactionResult>;
34
+ borrowWithReferral: (obligation: SuiObjectArg, obligationKey: SuiObjectArg, borrowReferral: SuiObjectArg, amount: number | SuiTxArg, poolCoinName: SupportPoolCoins) => Promise<TransactionResult>;
35
+ borrowEntry: (obligation: SuiObjectArg, obligationKey: SuiObjectArg, amount: number, poolCoinName: SupportPoolCoins) => Promise<TransactionResult>;
36
+ repay: (obligation: SuiObjectArg, coin: SuiObjectArg, poolCoinName: SupportPoolCoins) => Promise<void>;
37
+ borrowFlashLoan: (amount: number | SuiTxArg, poolCoinName: SupportPoolCoins) => Promise<TransactionResult>;
38
+ repayFlashLoan: (coin: SuiObjectArg, loan: SuiObjectArg, poolCoinName: SupportPoolCoins) => Promise<void>;
35
39
  };
36
40
  export type CoreQuickMethods = {
37
41
  addCollateralQuick: (amount: number, collateralCoinName: SupportCollateralCoins, obligationId?: SuiObjectArg) => Promise<void>;
@@ -6,7 +6,7 @@ export type LoyaltyProgramIds = {
6
6
  userRewardTableId: string;
7
7
  };
8
8
  export type LoyaltyProgramNormalMethods = {
9
- claimLoyaltyRevenue: (veScaKey: SuiObjectArg) => TransactionResult;
9
+ claimLoyaltyRevenue: (veScaKey: SuiObjectArg) => Promise<TransactionResult>;
10
10
  };
11
11
  export type LoyaltyProgramQuickMethods = {
12
12
  claimLoyaltyRevenueQuick: (veScaKey?: SuiObjectArg) => Promise<void>;
@@ -10,10 +10,10 @@ export type ReferralIds = {
10
10
  version: string;
11
11
  };
12
12
  export type ReferralNormalMethods = {
13
- bindToReferral: (veScaKeyId: string) => void;
14
- claimReferralTicket: (poolCoinName: SupportPoolCoins) => TransactionResult;
15
- burnReferralTicket: (ticket: SuiObjectArg, poolCoinName: SupportPoolCoins) => void;
16
- claimReferralRevenue: (veScaKey: SuiObjectArg, poolCoinName: SupportPoolCoins) => TransactionResult;
13
+ bindToReferral: (veScaKeyId: string) => Promise<void>;
14
+ claimReferralTicket: (poolCoinName: SupportPoolCoins) => Promise<TransactionResult>;
15
+ burnReferralTicket: (ticket: SuiObjectArg, poolCoinName: SupportPoolCoins) => Promise<void>;
16
+ claimReferralRevenue: (veScaKey: SuiObjectArg, poolCoinName: SupportPoolCoins) => Promise<TransactionResult>;
17
17
  };
18
18
  export type ReferralQuickMethods = {
19
19
  claimReferralRevenueQuick: (veScaKey: SuiObjectArg, coinNames: SupportPoolCoins[]) => Promise<void>;
@@ -12,14 +12,14 @@ export type sCoinNormalMethods = {
12
12
  * @param marketCoin
13
13
  * @returns
14
14
  */
15
- mintSCoin: (marketCoinName: SupportSCoin, marketCoin: SuiObjectArg) => TransactionResult;
15
+ mintSCoin: (marketCoinName: SupportSCoin, marketCoin: SuiObjectArg) => Promise<TransactionResult>;
16
16
  /**
17
17
  * Burn sCoin and return marketCoin
18
18
  * @param sCoinName
19
19
  * @param sCoin
20
20
  * @returns
21
21
  */
22
- burnSCoin: (sCoinName: SupportSCoin, sCoin: SuiObjectArg) => TransactionResult;
22
+ burnSCoin: (sCoinName: SupportSCoin, sCoin: SuiObjectArg) => Promise<TransactionResult>;
23
23
  };
24
24
  export type sCoinQuickMethods = {
25
25
  mintSCoinQuick: (marketCoinName: SupportSCoin, amount: number) => Promise<TransactionResult>;
@@ -7,10 +7,10 @@ export type SpoolIds = {
7
7
  spoolPkg: string;
8
8
  };
9
9
  export type SpoolNormalMethods = {
10
- createStakeAccount: (stakeMarketCoinName: SupportStakeMarketCoins) => TransactionResult;
11
- stake: (stakeAccount: SuiAddressArg, coin: SuiObjectArg, stakeMarketCoinName: SupportStakeMarketCoins) => void;
12
- unstake: (stakeAccount: SuiAddressArg, amount: number, stakeMarketCoinName: SupportStakeMarketCoins) => TransactionResult;
13
- claim: (stakeAccount: SuiAddressArg, stakeMarketCoinName: SupportStakeMarketCoins) => TransactionResult;
10
+ createStakeAccount: (stakeMarketCoinName: SupportStakeMarketCoins) => Promise<TransactionResult>;
11
+ stake: (stakeAccount: SuiAddressArg, coin: SuiObjectArg, stakeMarketCoinName: SupportStakeMarketCoins) => Promise<void>;
12
+ unstake: (stakeAccount: SuiAddressArg, amount: number, stakeMarketCoinName: SupportStakeMarketCoins) => Promise<TransactionResult>;
13
+ claim: (stakeAccount: SuiAddressArg, stakeMarketCoinName: SupportStakeMarketCoins) => Promise<TransactionResult>;
14
14
  };
15
15
  export type SpoolQuickMethods = {
16
16
  stakeQuick(amountOrMarketCoin: SuiObjectArg | number, stakeMarketCoinName: SupportStakeMarketCoins, stakeAccountId?: SuiAddressArg): Promise<void>;
@@ -8,12 +8,12 @@ export type VescaIds = {
8
8
  config: string;
9
9
  };
10
10
  export type VeScaNormalMethods = {
11
- lockSca: (scaCoin: SuiObjectArg, unlockAtInSecondTimestamp: number) => TransactionResult;
12
- extendLockPeriod: (veScaKey: SuiObjectArg, newUnlockAtInSecondTimestamp: number) => void;
13
- extendLockAmount: (veScaKey: SuiObjectArg, scaCoin: SuiObjectArg) => void;
14
- renewExpiredVeSca: (veScaKey: SuiObjectArg, scaCoin: SuiObjectArg, newUnlockAtInSecondTimestamp: number) => void;
15
- redeemSca: (veScaKey: SuiObjectArg) => TransactionResult;
16
- mintEmptyVeSca: () => TransactionResult;
11
+ lockSca: (scaCoin: SuiObjectArg, unlockAtInSecondTimestamp: number) => Promise<TransactionResult>;
12
+ extendLockPeriod: (veScaKey: SuiObjectArg, newUnlockAtInSecondTimestamp: number) => Promise<void>;
13
+ extendLockAmount: (veScaKey: SuiObjectArg, scaCoin: SuiObjectArg) => Promise<void>;
14
+ renewExpiredVeSca: (veScaKey: SuiObjectArg, scaCoin: SuiObjectArg, newUnlockAtInSecondTimestamp: number) => Promise<void>;
15
+ redeemSca: (veScaKey: SuiObjectArg) => Promise<TransactionResult>;
16
+ mintEmptyVeSca: () => Promise<TransactionResult>;
17
17
  };
18
18
  export type RedeemScaQuickReturnType<T extends boolean> = T extends true ? void : TransactionResult | undefined;
19
19
  export type VeScaQuickMethods = {
@@ -13,7 +13,7 @@ export type BalanceSheet = {
13
13
  market_coin_supply: string;
14
14
  revenue: string;
15
15
  };
16
- export type BorrowIndex = {
16
+ export type BorrowDynamic = {
17
17
  borrow_index: string;
18
18
  interest_rate: {
19
19
  fields: {
@@ -23,6 +23,9 @@ export type BorrowIndex = {
23
23
  interest_rate_scale: string;
24
24
  last_updated: string;
25
25
  };
26
+ export type BorrowFee = {
27
+ value: string;
28
+ };
26
29
  export type InterestModel = {
27
30
  base_borrow_rate_per_sec: {
28
31
  fields: {
@@ -135,7 +138,7 @@ export type MarketCollateral = {
135
138
  coinDecimal: number;
136
139
  coinPrice: number;
137
140
  isIsolated: boolean;
138
- } & Required<Pick<ParsedMarketCollateralData, 'collateralFactor' | 'liquidationFactor' | 'liquidationDiscount' | 'liquidationPanelty' | 'liquidationReserveFactor'>> & CalculatedMarketCollateralData;
141
+ } & Required<Pick<ParsedMarketCollateralData, 'collateralFactor' | 'liquidationFactor' | 'liquidationDiscount' | 'liquidationPenalty' | 'liquidationReserveFactor'>> & CalculatedMarketCollateralData;
139
142
  export type OriginMarketPoolData = {
140
143
  type: {
141
144
  name: string;
@@ -178,6 +181,9 @@ export type OriginMarketPoolData = {
178
181
  value: string;
179
182
  };
180
183
  minBorrowAmount: string;
184
+ isIsolated: boolean;
185
+ supplyLimit: string;
186
+ borrowLimit: string;
181
187
  };
182
188
  export type ParsedMarketPoolData = {
183
189
  coinType: string;
@@ -199,6 +205,9 @@ export type ParsedMarketPoolData = {
199
205
  highKink: number;
200
206
  midKink: number;
201
207
  minBorrowAmount: number;
208
+ isIsolated: boolean;
209
+ supplyLimit: number;
210
+ borrowLimit: number;
202
211
  };
203
212
  export type CalculatedMarketPoolData = {
204
213
  baseBorrowApr: number;
@@ -207,6 +216,8 @@ export type CalculatedMarketPoolData = {
207
216
  borrowApyOnHighKink: number;
208
217
  borrowAprOnMidKink: number;
209
218
  borrowApyOnMidKink: number;
219
+ coinDecimal: number;
220
+ conversionRate: number;
210
221
  maxBorrowApr: number;
211
222
  maxBorrowApy: number;
212
223
  borrowApr: number;
@@ -222,12 +233,15 @@ export type CalculatedMarketPoolData = {
222
233
  utilizationRate: number;
223
234
  supplyApr: number;
224
235
  supplyApy: number;
225
- conversionRate: number;
236
+ isIsolated: boolean;
237
+ maxSupplyCoin: number;
238
+ maxBorrowCoin: number;
226
239
  };
227
240
  export type OriginMarketCollateralData = {
228
241
  type: {
229
242
  name: string;
230
243
  };
244
+ isIsolated: boolean;
231
245
  collateralFactor: {
232
246
  value: string;
233
247
  };
@@ -237,7 +251,7 @@ export type OriginMarketCollateralData = {
237
251
  liquidationDiscount: {
238
252
  value: string;
239
253
  };
240
- liquidationPanelty: {
254
+ liquidationPenalty: {
241
255
  value: string;
242
256
  };
243
257
  liquidationReserveFactor: {
@@ -251,12 +265,15 @@ export type ParsedMarketCollateralData = {
251
265
  collateralFactor: number;
252
266
  liquidationFactor: number;
253
267
  liquidationDiscount: number;
254
- liquidationPanelty: number;
268
+ liquidationPenalty: number;
255
269
  liquidationReserveFactor: number;
256
270
  maxCollateralAmount: number;
257
271
  totalCollateralAmount: number;
272
+ isIsolated: boolean;
258
273
  };
259
274
  export type CalculatedMarketCollateralData = {
275
+ coinDecimal: number;
276
+ isIsolated: boolean;
260
277
  maxDepositAmount: number;
261
278
  maxDepositCoin: number;
262
279
  depositAmount: number;
@@ -32,6 +32,26 @@ export type OriginSpoolData = {
32
32
  createdAt: string;
33
33
  lastUpdate: string;
34
34
  };
35
+ export type SpoolData = {
36
+ created_at: string;
37
+ distributed_point: string;
38
+ distributed_point_per_period: string;
39
+ id: {
40
+ id: string;
41
+ };
42
+ index: string;
43
+ last_update: string;
44
+ max_distributed_point: string;
45
+ max_stakes: string;
46
+ point_distribution_time: string;
47
+ stake_type: {
48
+ type: string;
49
+ fields: {
50
+ name: string;
51
+ };
52
+ };
53
+ stakes: string;
54
+ };
35
55
  export type ParsedSpoolData = {
36
56
  stakeType: string;
37
57
  maxPoint: number;