@scallop-io/sui-scallop-sdk 1.4.15-rc.3 → 1.4.16

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 (69) hide show
  1. package/dist/constants/common.d.ts +6 -6
  2. package/dist/constants/enum.d.ts +2 -2
  3. package/dist/constants/index.d.ts +0 -1
  4. package/dist/constants/poolAddress.d.ts +2 -1
  5. package/dist/constants/queryKeys.d.ts +3 -4
  6. package/dist/index.d.ts +0 -1
  7. package/dist/index.js +2009 -1627
  8. package/dist/index.js.map +1 -1
  9. package/dist/index.mjs +2088 -1701
  10. package/dist/index.mjs.map +1 -1
  11. package/dist/models/scallop.d.ts +1 -2
  12. package/dist/models/scallopBuilder.d.ts +2 -1
  13. package/dist/models/scallopCache.d.ts +18 -12
  14. package/dist/models/scallopQuery.d.ts +95 -10
  15. package/dist/models/scallopUtils.d.ts +4 -4
  16. package/dist/queries/borrowIncentiveQuery.d.ts +6 -1
  17. package/dist/queries/coreQuery.d.ts +2 -0
  18. package/dist/queries/objectsQuery.d.ts +1 -2
  19. package/dist/queries/poolAddressesQuery.d.ts +4 -2
  20. package/dist/queries/portfolioQuery.d.ts +71 -5
  21. package/dist/queries/priceQuery.d.ts +4 -0
  22. package/dist/queries/sCoinQuery.d.ts +1 -1
  23. package/dist/types/builder/core.d.ts +3 -3
  24. package/dist/types/model.d.ts +8 -2
  25. package/dist/utils/index.d.ts +0 -2
  26. package/package.json +7 -7
  27. package/src/builders/borrowIncentiveBuilder.ts +11 -5
  28. package/src/builders/coreBuilder.ts +61 -32
  29. package/src/builders/loyaltyProgramBuilder.ts +3 -2
  30. package/src/builders/referralBuilder.ts +16 -6
  31. package/src/builders/sCoinBuilder.ts +6 -4
  32. package/src/builders/spoolBuilder.ts +14 -7
  33. package/src/builders/vescaBuilder.ts +13 -7
  34. package/src/constants/coinGecko.ts +2 -0
  35. package/src/constants/common.ts +7 -1
  36. package/src/constants/enum.ts +46 -20
  37. package/src/constants/index.ts +0 -1
  38. package/src/constants/poolAddress.ts +163 -41
  39. package/src/constants/pyth.ts +2 -0
  40. package/src/constants/queryKeys.ts +7 -9
  41. package/src/constants/testAddress.ts +24 -0
  42. package/src/index.ts +0 -1
  43. package/src/models/scallop.ts +9 -13
  44. package/src/models/scallopAddress.ts +2 -9
  45. package/src/models/scallopBuilder.ts +62 -8
  46. package/src/models/scallopCache.ts +220 -114
  47. package/src/models/scallopClient.ts +3 -6
  48. package/src/models/scallopIndexer.ts +1 -5
  49. package/src/models/scallopQuery.ts +53 -19
  50. package/src/models/scallopUtils.ts +9 -13
  51. package/src/queries/borrowIncentiveQuery.ts +6 -13
  52. package/src/queries/coreQuery.ts +62 -48
  53. package/src/queries/loyaltyProgramQuery.ts +1 -3
  54. package/src/queries/objectsQuery.ts +1 -3
  55. package/src/queries/poolAddressesQuery.ts +13 -10
  56. package/src/queries/portfolioQuery.ts +252 -20
  57. package/src/queries/priceQuery.ts +2 -7
  58. package/src/queries/sCoinQuery.ts +2 -2
  59. package/src/queries/spoolQuery.ts +21 -20
  60. package/src/queries/vescaQuery.ts +3 -7
  61. package/src/types/builder/core.ts +21 -3
  62. package/src/types/model.ts +13 -2
  63. package/src/utils/index.ts +0 -2
  64. package/src/utils/indexer.ts +3 -1
  65. package/src/utils/query.ts +2 -2
  66. package/dist/constants/tokenBucket.d.ts +0 -2
  67. package/dist/utils/tokenBucket.d.ts +0 -11
  68. package/src/constants/tokenBucket.ts +0 -2
  69. package/src/utils/tokenBucket.ts +0 -68
@@ -8,7 +8,6 @@ import type { ScallopBuilderParams, ScallopClientParams, ScallopParams, ScallopQ
8
8
  import { ScallopIndexer } from './scallopIndexer';
9
9
  import { ScallopCache } from './scallopCache';
10
10
  import { QueryClientConfig } from '@tanstack/query-core';
11
- import { TokenBucket } from 'src/utils';
12
11
  import type { QueryClient } from '@tanstack/query-core';
13
12
  /**
14
13
  * @argument params - The parameters for the Scallop instance.
@@ -32,7 +31,7 @@ export declare class Scallop {
32
31
  suiKit: SuiKit;
33
32
  cache: ScallopCache;
34
33
  private address;
35
- constructor(params: ScallopParams, cacheOptions?: QueryClientConfig, tokenBucket?: TokenBucket, queryClient?: QueryClient);
34
+ constructor(params: ScallopParams, cacheOptions?: QueryClientConfig, queryClient?: QueryClient);
36
35
  /**
37
36
  * Get a scallop address instance that already has read addresses.
38
37
  *
@@ -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
  }
@@ -1,8 +1,8 @@
1
- import { QueryClient, QueryClientConfig } from '@tanstack/query-core';
1
+ import { QueryClient } from '@tanstack/query-core';
2
2
  import { SuiObjectArg } from '@scallop-io/sui-kit';
3
3
  import { SuiKit } from '@scallop-io/sui-kit';
4
- import type { SuiObjectResponse, SuiObjectDataOptions, SuiObjectData, GetOwnedObjectsParams, DevInspectResults, GetDynamicFieldsParams, DynamicFieldPage, GetDynamicFieldObjectParams, GetBalanceParams } from '@mysten/sui/client';
5
- import { TokenBucket } from 'src/utils';
4
+ import type { SuiObjectResponse, SuiObjectDataOptions, SuiObjectData, GetOwnedObjectsParams, DevInspectResults, GetDynamicFieldsParams, DynamicFieldPage, GetDynamicFieldObjectParams, GetBalanceParams, CoinBalance } from '@mysten/sui/client';
5
+ import { ScallopCacheInstanceParams, ScallopCacheParams } from 'src/types';
6
6
  type QueryInspectTxnParams = {
7
7
  queryTarget: string;
8
8
  args: SuiObjectArg[];
@@ -21,13 +21,19 @@ type QueryInspectTxnParams = {
21
21
  * ```
22
22
  */
23
23
  export declare class ScallopCache {
24
- readonly queryClient: QueryClient;
25
- readonly _suiKit: SuiKit;
26
- private tokenBucket;
24
+ readonly params: ScallopCacheParams;
25
+ queryClient: QueryClient;
26
+ suiKit: SuiKit;
27
27
  walletAddress: string;
28
- constructor(suiKit: SuiKit, walletAddress?: string, cacheOptions?: QueryClientConfig, tokenBucket?: TokenBucket, queryClient?: QueryClient);
29
- private get suiKit();
28
+ private tokensPerInterval;
29
+ private interval;
30
+ private tokens;
31
+ private lastRefill;
32
+ constructor(params: ScallopCacheParams, instance?: ScallopCacheInstanceParams);
30
33
  private get client();
34
+ private refill;
35
+ private removeTokens;
36
+ private callWithRateLimit;
31
37
  /**
32
38
  * @description Invalidate cache based on the refetchType parameter
33
39
  * @param refetchType Determines the type of queries to be refetched. Defaults to `active`.
@@ -37,7 +43,6 @@ export declare class ScallopCache {
37
43
  * - `all`: All queries that match the refetch predicate will be refetched in the background.
38
44
  * - `none`: No queries will be refetched. Queries that match the refetch predicate will only be marked as invalid.
39
45
  */
40
- invalidateAllCache(): Promise<Promise<void>[]>;
41
46
  private retryFn;
42
47
  /**
43
48
  * @description Provides cache for inspectTxn of the SuiKit.
@@ -46,6 +51,7 @@ export declare class ScallopCache {
46
51
  * @returns Promise<DevInspectResults>
47
52
  */
48
53
  queryInspectTxn({ queryTarget, args, typeArgs, }: QueryInspectTxnParams): Promise<DevInspectResults | null>;
54
+ queryGetNormalizedMoveFunction(target: string): Promise<import("@mysten/sui/client").SuiMoveNormalizedFunction | null>;
49
55
  /**
50
56
  * @description Provides cache for getObject of the SuiKit.
51
57
  * @param objectId
@@ -58,7 +64,7 @@ export declare class ScallopCache {
58
64
  * @param objectIds
59
65
  * @returns Promise<SuiObjectData[]>
60
66
  */
61
- queryGetObjects(objectIds: string[], options?: SuiObjectDataOptions): Promise<SuiObjectData[]>;
67
+ queryGetObjects(objectIds: string[]): Promise<SuiObjectData[]>;
62
68
  /**
63
69
  * @description Provides cache for getOwnedObjects of the SuiKit.
64
70
  * @param input
@@ -68,8 +74,8 @@ export declare class ScallopCache {
68
74
  queryGetDynamicFields(input: GetDynamicFieldsParams): Promise<DynamicFieldPage | null>;
69
75
  queryGetDynamicFieldObject(input: GetDynamicFieldObjectParams): Promise<SuiObjectResponse | null>;
70
76
  queryGetAllCoinBalances(owner: string): Promise<{
71
- [k: string]: string;
77
+ [k: string]: CoinBalance;
72
78
  }>;
73
- queryGetCoinBalance(input: GetBalanceParams): Promise<string>;
79
+ queryGetCoinBalance(input: GetBalanceParams): Promise<CoinBalance | null>;
74
80
  }
75
81
  export {};
@@ -1,10 +1,11 @@
1
- import { SuiKit } from '@scallop-io/sui-kit';
2
- import { ScallopQueryParams, SupportStakeMarketCoins, SupportAssetCoins, SupportPoolCoins, SupportCollateralCoins, SupportMarketCoins, SupportBorrowIncentiveCoins, SupportSCoin, ScallopQueryInstanceParams, MarketPool, CoinPrices, MarketPools } from '../types';
1
+ import { SuiKit, SuiObjectArg } from '@scallop-io/sui-kit';
2
+ import { ScallopQueryParams, SupportStakeMarketCoins, SupportAssetCoins, SupportPoolCoins, SupportCollateralCoins, SupportMarketCoins, SupportBorrowIncentiveCoins, SupportSCoin, ScallopQueryInstanceParams, MarketPool, CoinPrices, MarketPools, MarketCollaterals } from '../types';
3
3
  import { ScallopAddress } from './scallopAddress';
4
4
  import { ScallopUtils } from './scallopUtils';
5
5
  import { ScallopIndexer } from './scallopIndexer';
6
6
  import { ScallopCache } from './scallopCache';
7
7
  import { SuiObjectData } from '@mysten/sui/client';
8
+ import { SuiObjectRef } from '@mysten/sui/client';
8
9
  /**
9
10
  * @description
10
11
  * It provides methods for getting on-chain data from the Scallop contract.
@@ -59,7 +60,7 @@ export declare class ScallopQuery {
59
60
  indexer?: boolean;
60
61
  }): Promise<{
61
62
  pools: MarketPools;
62
- collaterals: import("../types").MarketCollaterals;
63
+ collaterals: MarketCollaterals;
63
64
  }>;
64
65
  /**
65
66
  * Get market pool
@@ -88,6 +89,7 @@ export declare class ScallopQuery {
88
89
  }): Promise<{
89
90
  usdc?: import("../types").MarketCollateral | undefined;
90
91
  sbeth?: import("../types").MarketCollateral | undefined;
92
+ sbusdt?: import("../types").MarketCollateral | undefined;
91
93
  weth?: import("../types").MarketCollateral | undefined;
92
94
  wbtc?: import("../types").MarketCollateral | undefined;
93
95
  wusdc?: import("../types").MarketCollateral | undefined;
@@ -100,6 +102,7 @@ export declare class ScallopQuery {
100
102
  hasui?: import("../types").MarketCollateral | undefined;
101
103
  vsui?: import("../types").MarketCollateral | undefined;
102
104
  sca?: import("../types").MarketCollateral | undefined;
105
+ fdusd?: import("../types").MarketCollateral | undefined;
103
106
  }>;
104
107
  /**
105
108
  * Get market collateral
@@ -124,7 +127,7 @@ export declare class ScallopQuery {
124
127
  * @param obligationId - The obligation id.
125
128
  * @return Obligation data.
126
129
  */
127
- queryObligation(obligationId: string): Promise<import("../types").ObligationQueryInterface | undefined>;
130
+ queryObligation(obligationId: string | SuiObjectArg): Promise<import("../types").ObligationQueryInterface | undefined>;
128
131
  /**
129
132
  * Get all asset coin amounts.
130
133
  *
@@ -298,6 +301,7 @@ export declare class ScallopQuery {
298
301
  }): Promise<{
299
302
  usdc?: import("../types").BorrowIncentivePool | undefined;
300
303
  sbeth?: import("../types").BorrowIncentivePool | undefined;
304
+ sbusdt?: import("../types").BorrowIncentivePool | undefined;
301
305
  weth?: import("../types").BorrowIncentivePool | undefined;
302
306
  wbtc?: import("../types").BorrowIncentivePool | undefined;
303
307
  wusdc?: import("../types").BorrowIncentivePool | undefined;
@@ -312,6 +316,7 @@ export declare class ScallopQuery {
312
316
  sca?: import("../types").BorrowIncentivePool | undefined;
313
317
  fud?: import("../types").BorrowIncentivePool | undefined;
314
318
  deep?: import("../types").BorrowIncentivePool | undefined;
319
+ fdusd?: import("../types").BorrowIncentivePool | undefined;
315
320
  }>;
316
321
  /**
317
322
  * Get borrow incentive accounts data.
@@ -320,9 +325,10 @@ export declare class ScallopQuery {
320
325
  * @param ownerAddress - The owner address.
321
326
  * @return Borrow incentive accounts data.
322
327
  */
323
- getBorrowIncentiveAccounts(obligationId: string, coinNames?: SupportBorrowIncentiveCoins[]): Promise<{
328
+ getBorrowIncentiveAccounts(obligationId: string | SuiObjectRef, coinNames?: SupportBorrowIncentiveCoins[]): Promise<{
324
329
  usdc?: import("../types").ParsedBorrowIncentiveAccountData | undefined;
325
330
  sbeth?: import("../types").ParsedBorrowIncentiveAccountData | undefined;
331
+ sbusdt?: import("../types").ParsedBorrowIncentiveAccountData | undefined;
326
332
  weth?: import("../types").ParsedBorrowIncentiveAccountData | undefined;
327
333
  wbtc?: import("../types").ParsedBorrowIncentiveAccountData | undefined;
328
334
  wusdc?: import("../types").ParsedBorrowIncentiveAccountData | undefined;
@@ -337,6 +343,7 @@ export declare class ScallopQuery {
337
343
  sca?: import("../types").ParsedBorrowIncentiveAccountData | undefined;
338
344
  fud?: import("../types").ParsedBorrowIncentiveAccountData | undefined;
339
345
  deep?: import("../types").ParsedBorrowIncentiveAccountData | undefined;
346
+ fdusd?: import("../types").ParsedBorrowIncentiveAccountData | undefined;
340
347
  }>;
341
348
  /**
342
349
  * Get user lending and spool infomation for specific pools.
@@ -348,9 +355,12 @@ export declare class ScallopQuery {
348
355
  */
349
356
  getLendings(poolCoinNames?: SupportPoolCoins[], ownerAddress?: string, args?: {
350
357
  indexer?: boolean;
358
+ marketPools?: MarketPools;
359
+ coinPrices?: CoinPrices;
351
360
  }): Promise<{
352
361
  usdc?: import("../types").Lending | undefined;
353
362
  sbeth?: import("../types").Lending | undefined;
363
+ sbusdt?: import("../types").Lending | undefined;
354
364
  weth?: import("../types").Lending | undefined;
355
365
  wbtc?: import("../types").Lending | undefined;
356
366
  wusdc?: import("../types").Lending | undefined;
@@ -365,6 +375,7 @@ export declare class ScallopQuery {
365
375
  sca?: import("../types").Lending | undefined;
366
376
  fud?: import("../types").Lending | undefined;
367
377
  deep?: import("../types").Lending | undefined;
378
+ fdusd?: import("../types").Lending | undefined;
368
379
  }>;
369
380
  /**
370
381
  * Get user lending and spool information for specific pool.
@@ -389,6 +400,11 @@ export declare class ScallopQuery {
389
400
  */
390
401
  getObligationAccounts(ownerAddress?: string, args?: {
391
402
  indexer?: boolean;
403
+ market?: {
404
+ collaterals: MarketCollaterals;
405
+ pools: MarketPools;
406
+ };
407
+ coinPrices?: CoinPrices;
392
408
  }): Promise<{
393
409
  [x: string]: import("../types").ObligationAccount | undefined;
394
410
  }>;
@@ -475,7 +491,7 @@ export declare class ScallopQuery {
475
491
  * @param ownerAddress - The owner address.
476
492
  * @return All market sCoin amounts.
477
493
  */
478
- getSCoinAmounts(sCoinNames?: SupportSCoin[], ownerAddress?: string): Promise<import("../types").OptionalKeys<Record<"susdc" | "ssbeth" | "sweth" | "swbtc" | "swusdc" | "swusdt" | "ssui" | "swsol" | "scetus" | "safsui" | "shasui" | "svsui" | "ssca" | "sfud" | "sdeep", number>>>;
494
+ getSCoinAmounts(sCoinNames?: SupportSCoin[], ownerAddress?: string): Promise<import("../types").OptionalKeys<Record<"susdc" | "ssbeth" | "ssbusdt" | "sweth" | "swbtc" | "swusdc" | "swusdt" | "ssui" | "swsol" | "scetus" | "safsui" | "shasui" | "svsui" | "ssca" | "sfud" | "sdeep" | "sfdusd", number>>>;
479
495
  /**
480
496
  * Get sCoin amount.
481
497
  *
@@ -490,7 +506,7 @@ export declare class ScallopQuery {
490
506
  * @returns
491
507
  */
492
508
  getSCoinSwapRate(fromSCoin: SupportSCoin, toSCoin: SupportSCoin): Promise<number>;
493
- getFlashLoanFees(assetCoinNames?: SupportAssetCoins[]): Promise<Record<"usdc" | "sbeth" | "weth" | "wbtc" | "wusdc" | "wusdt" | "sui" | "wapt" | "wsol" | "cetus" | "afsui" | "hasui" | "vsui" | "sca" | "fud" | "deep", number>>;
509
+ getFlashLoanFees(assetCoinNames?: SupportAssetCoins[]): Promise<Record<"usdc" | "sbeth" | "sbusdt" | "weth" | "wbtc" | "wusdc" | "wusdt" | "sui" | "wapt" | "wsol" | "cetus" | "afsui" | "hasui" | "vsui" | "sca" | "fud" | "deep" | "fdusd", number>>;
494
510
  /**
495
511
  * Get supply limit of lending pool
496
512
  */
@@ -523,6 +539,7 @@ export declare class ScallopQuery {
523
539
  }): Promise<{
524
540
  susdc?: number | undefined;
525
541
  ssbeth?: number | undefined;
542
+ ssbusdt?: number | undefined;
526
543
  sweth?: number | undefined;
527
544
  swbtc?: number | undefined;
528
545
  swusdc?: number | undefined;
@@ -536,8 +553,10 @@ export declare class ScallopQuery {
536
553
  ssca?: number | undefined;
537
554
  sfud?: number | undefined;
538
555
  sdeep?: number | undefined;
556
+ sfdusd?: number | undefined;
539
557
  usdc?: number | undefined;
540
558
  sbeth?: number | undefined;
559
+ sbusdt?: number | undefined;
541
560
  weth?: number | undefined;
542
561
  wbtc?: number | undefined;
543
562
  wusdc?: number | undefined;
@@ -552,18 +571,20 @@ export declare class ScallopQuery {
552
571
  sca?: number | undefined;
553
572
  fud?: number | undefined;
554
573
  deep?: number | undefined;
574
+ fdusd?: number | undefined;
555
575
  swapt?: number | undefined;
556
576
  }>;
557
577
  /**
558
- * Query all address (lending pool, collateral pool, borrow dynamics, interest models) of all pool
578
+ * Query all address (lending pool, collateral pool, borrow dynamics, interest models, etc.) of all pool
559
579
  * @returns
560
580
  */
561
- getPoolAddresses(): Promise<import("../types").OptionalKeys<Record<"usdc" | "sbeth" | "weth" | "wbtc" | "wusdc" | "wusdt" | "sui" | "wapt" | "wsol" | "cetus" | "afsui" | "hasui" | "vsui" | "sca" | "fud" | "deep", {
581
+ getPoolAddresses(): Promise<import("../types").OptionalKeys<Record<"usdc" | "sbeth" | "sbusdt" | "weth" | "wbtc" | "wusdc" | "wusdt" | "sui" | "wapt" | "wsol" | "cetus" | "afsui" | "hasui" | "vsui" | "sca" | "fud" | "deep" | "fdusd", {
562
582
  lendingPoolAddress?: string;
563
583
  collateralPoolAddress?: string;
564
584
  borrowDynamic?: string;
565
585
  spoolReward?: string;
566
586
  spool?: string;
587
+ sCoinType?: string;
567
588
  sCoinTreasury?: string;
568
589
  interestModel?: string;
569
590
  riskModel?: string;
@@ -571,7 +592,71 @@ export declare class ScallopQuery {
571
592
  supplyLimitKey?: string;
572
593
  borrowLimitKey?: string;
573
594
  isolatedAssetKey?: string;
574
- coinDecimalId?: string;
595
+ coinMetadataId?: string;
575
596
  borrowIncentivePoolId?: string;
597
+ coinType?: string;
576
598
  }>>>;
599
+ /**
600
+ * Get user portfolio
601
+ */
602
+ getUserPortfolio(args?: {
603
+ walletAddress?: string;
604
+ indexer?: boolean;
605
+ }): Promise<{
606
+ totalLockedScaValue: number;
607
+ lendings: {
608
+ suppliedCoin: number;
609
+ suppliedValue: number;
610
+ stakedCoin: number;
611
+ coinName: "usdc" | "sbeth" | "sbusdt" | "weth" | "wbtc" | "wusdc" | "wusdt" | "sui" | "wapt" | "wsol" | "cetus" | "afsui" | "hasui" | "vsui" | "sca" | "fud" | "deep" | "fdusd";
612
+ symbol: string;
613
+ coinType: string;
614
+ coinPrice: number;
615
+ coinDecimals: number;
616
+ supplyApr: number;
617
+ supplyApy: number;
618
+ incentiveApr: number;
619
+ }[];
620
+ borrowings: {
621
+ obligationId: string;
622
+ totalDebtsInUsd: number;
623
+ totalCollateralInUsd: number;
624
+ riskLevel: number;
625
+ availableCollateralInUsd: number;
626
+ totalUnhealthyCollateralInUsd: number;
627
+ borrowedPools: {
628
+ coinName: "usdc" | "sbeth" | "sbusdt" | "weth" | "wbtc" | "wusdc" | "wusdt" | "sui" | "wapt" | "wsol" | "cetus" | "afsui" | "hasui" | "vsui" | "sca" | "fud" | "deep" | "fdusd";
629
+ symbol: string;
630
+ coinDecimals: number;
631
+ coinType: string;
632
+ coinPrice: number;
633
+ borrowedCoin: number;
634
+ borrowedValueInUsd: number;
635
+ borrowApr: number | undefined;
636
+ borrowApy: number | undefined;
637
+ incentiveInfos: {
638
+ coinName: "usdc" | "sbeth" | "sbusdt" | "weth" | "wbtc" | "wusdc" | "wusdt" | "sui" | "wapt" | "wsol" | "cetus" | "afsui" | "hasui" | "vsui" | "sca" | "fud" | "deep" | "fdusd" | "susdc" | "ssbeth" | "ssbusdt" | "sweth" | "swbtc" | "swusdc" | "swusdt" | "ssui" | "swsol" | "scetus" | "safsui" | "shasui" | "svsui" | "ssca" | "sfud" | "sdeep" | "sfdusd";
639
+ symbol: string;
640
+ coinType: string;
641
+ incentiveApr: number;
642
+ }[];
643
+ }[];
644
+ }[];
645
+ pendingRewards: {
646
+ lendings: any;
647
+ borrowIncentives: any;
648
+ };
649
+ veScas: {
650
+ veScaKey: string;
651
+ coinPrice: number;
652
+ lockedScaInCoin: number;
653
+ lockedScaInUsd: number;
654
+ currentVeScaBalance: number;
655
+ remainingLockPeriodInDays: number;
656
+ unlockAt: number;
657
+ }[];
658
+ totalDebtValue: number;
659
+ totalCollateralValue: number;
660
+ totalSupplyValue: number;
661
+ }>;
577
662
  }
@@ -2,7 +2,7 @@ import { SuiKit } from '@scallop-io/sui-kit';
2
2
  import { ScallopAddress } from './scallopAddress';
3
3
  import { ScallopCache } from './scallopCache';
4
4
  import type { ScallopUtilsParams, SupportCoins, SupportAssetCoins, SupportMarketCoins, SupportStakeMarketCoins, CoinWrappedType, SupportSCoin, ScallopUtilsInstanceParams, SupportSuiBridgeCoins, SupportWormholeCoins, PoolAddressInfo } from '../types';
5
- import type { SuiObjectArg, SuiTxArg, SuiTxBlock } from '@scallop-io/sui-kit';
5
+ import type { SuiObjectArg, SuiTxBlock } from '@scallop-io/sui-kit';
6
6
  /**
7
7
  * @description
8
8
  * Integrates some helper functions frequently used in interactions with the Scallop contract.
@@ -65,7 +65,7 @@ export declare class ScallopUtils {
65
65
  * if no `scallop_...` is encountered, return coinName
66
66
  * @return sCoin name
67
67
  */
68
- parseSCoinTypeNameToMarketCoinName(coinName: string): "susdc" | "ssbeth" | "sweth" | "swbtc" | "swusdc" | "swusdt" | "ssui" | "swsol" | "scetus" | "safsui" | "shasui" | "svsui" | "ssca" | "sfud" | "sdeep";
68
+ parseSCoinTypeNameToMarketCoinName(coinName: string): "susdc" | "ssbeth" | "ssbusdt" | "sweth" | "swbtc" | "swusdc" | "swusdt" | "ssui" | "swsol" | "scetus" | "safsui" | "shasui" | "svsui" | "ssca" | "sfud" | "sdeep" | "sfdusd";
69
69
  /**
70
70
  * Convert sCoin name into sCoin type
71
71
  * @param sCoinName
@@ -77,7 +77,7 @@ export declare class ScallopUtils {
77
77
  * @param sCoinType
78
78
  * @returns sCoin name
79
79
  */
80
- parseSCoinNameFromType(sCoinType: string): "susdc" | "ssbeth" | "sweth" | "swbtc" | "swusdc" | "swusdt" | "ssui" | "swsol" | "scetus" | "safsui" | "shasui" | "svsui" | "ssca" | "sfud" | "sdeep";
80
+ parseSCoinNameFromType(sCoinType: string): "susdc" | "ssbeth" | "ssbusdt" | "sweth" | "swbtc" | "swusdc" | "swusdt" | "ssui" | "swsol" | "scetus" | "safsui" | "shasui" | "svsui" | "ssca" | "sfud" | "sdeep" | "sfdusd";
81
81
  /**
82
82
  * Convert sCoin name into its underlying coin type
83
83
  * @param sCoinName
@@ -166,7 +166,7 @@ export declare class ScallopUtils {
166
166
  * @param coinType
167
167
  * @param sender
168
168
  */
169
- mergeSimilarCoins(txBlock: SuiTxBlock, dest: SuiTxArg, coinType: string, sender?: string): Promise<void>;
169
+ mergeSimilarCoins(txBlock: SuiTxBlock, dest: SuiObjectArg, coinType: string, sender?: string): Promise<void>;
170
170
  /**
171
171
  * Get all asset coin names in the obligation record by obligation id.
172
172
  *
@@ -1,5 +1,6 @@
1
1
  import type { ScallopAddress, ScallopQuery, ScallopUtils } from '../models';
2
2
  import type { BorrowIncentivePoolsQueryInterface, SupportBorrowIncentiveCoins, BorrowIncentivePool, CoinPrices, MarketPools } from '../types';
3
+ import { SuiObjectRef } from '@mysten/sui/client';
3
4
  /**
4
5
  * Query borrow incentive pools data using moveCall
5
6
  * @param address
@@ -17,6 +18,7 @@ export declare const queryBorrowIncentivePools: (address: ScallopAddress) => Pro
17
18
  export declare const getBorrowIncentivePools: (query: ScallopQuery, borrowIncentiveCoinNames?: SupportBorrowIncentiveCoins[], indexer?: boolean, marketPools?: MarketPools, coinPrices?: CoinPrices) => Promise<{
18
19
  usdc?: BorrowIncentivePool | undefined;
19
20
  sbeth?: BorrowIncentivePool | undefined;
21
+ sbusdt?: BorrowIncentivePool | undefined;
20
22
  weth?: BorrowIncentivePool | undefined;
21
23
  wbtc?: BorrowIncentivePool | undefined;
22
24
  wusdc?: BorrowIncentivePool | undefined;
@@ -31,6 +33,7 @@ export declare const getBorrowIncentivePools: (query: ScallopQuery, borrowIncent
31
33
  sca?: BorrowIncentivePool | undefined;
32
34
  fud?: BorrowIncentivePool | undefined;
33
35
  deep?: BorrowIncentivePool | undefined;
36
+ fdusd?: BorrowIncentivePool | undefined;
34
37
  }>;
35
38
  /**
36
39
  * Query borrow incentive accounts data.
@@ -41,9 +44,10 @@ export declare const getBorrowIncentivePools: (query: ScallopQuery, borrowIncent
41
44
  */
42
45
  export declare const queryBorrowIncentiveAccounts: ({ utils, }: {
43
46
  utils: ScallopUtils;
44
- }, obligationId: string, borrowIncentiveCoinNames?: SupportBorrowIncentiveCoins[]) => Promise<{
47
+ }, obligationId: string | SuiObjectRef, borrowIncentiveCoinNames?: SupportBorrowIncentiveCoins[]) => Promise<{
45
48
  usdc?: import("../types").ParsedBorrowIncentiveAccountData | undefined;
46
49
  sbeth?: import("../types").ParsedBorrowIncentiveAccountData | undefined;
50
+ sbusdt?: import("../types").ParsedBorrowIncentiveAccountData | undefined;
47
51
  weth?: import("../types").ParsedBorrowIncentiveAccountData | undefined;
48
52
  wbtc?: import("../types").ParsedBorrowIncentiveAccountData | undefined;
49
53
  wusdc?: import("../types").ParsedBorrowIncentiveAccountData | undefined;
@@ -58,6 +62,7 @@ export declare const queryBorrowIncentiveAccounts: ({ utils, }: {
58
62
  sca?: import("../types").ParsedBorrowIncentiveAccountData | undefined;
59
63
  fud?: import("../types").ParsedBorrowIncentiveAccountData | undefined;
60
64
  deep?: import("../types").ParsedBorrowIncentiveAccountData | undefined;
65
+ fdusd?: import("../types").ParsedBorrowIncentiveAccountData | undefined;
61
66
  }>;
62
67
  /**
63
68
  * Check veSca bind status
@@ -68,6 +68,7 @@ export declare const getMarketPool: (query: ScallopQuery, poolCoinName: SupportP
68
68
  export declare const getMarketCollaterals: (query: ScallopQuery, collateralCoinNames?: SupportCollateralCoins[], indexer?: boolean) => Promise<{
69
69
  usdc?: MarketCollateral | undefined;
70
70
  sbeth?: MarketCollateral | undefined;
71
+ sbusdt?: MarketCollateral | undefined;
71
72
  weth?: MarketCollateral | undefined;
72
73
  wbtc?: MarketCollateral | undefined;
73
74
  wusdc?: MarketCollateral | undefined;
@@ -80,6 +81,7 @@ export declare const getMarketCollaterals: (query: ScallopQuery, collateralCoinN
80
81
  hasui?: MarketCollateral | undefined;
81
82
  vsui?: MarketCollateral | undefined;
82
83
  sca?: MarketCollateral | undefined;
84
+ fdusd?: MarketCollateral | undefined;
83
85
  }>;
84
86
  /**
85
87
  * Get market collateral data.
@@ -1,3 +1,2 @@
1
- import { SuiObjectDataOptions } from '@mysten/sui/dist/cjs/client';
2
1
  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[]>;
2
+ export declare const queryMultipleObjects: (cache: ScallopCache, objectIds: string[], partitionSize?: number) => Promise<import("@mysten/sui/dist/cjs/client").SuiObjectData[]>;
@@ -1,11 +1,12 @@
1
1
  import { ScallopQuery } from 'src/models';
2
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", {
3
+ export declare const getAllAddresses: (query: ScallopQuery) => Promise<OptionalKeys<Record<"usdc" | "sbeth" | "sbusdt" | "weth" | "wbtc" | "wusdc" | "wusdt" | "sui" | "wapt" | "wsol" | "cetus" | "afsui" | "hasui" | "vsui" | "sca" | "fud" | "deep" | "fdusd", {
4
4
  lendingPoolAddress?: string;
5
5
  collateralPoolAddress?: string;
6
6
  borrowDynamic?: string;
7
7
  spoolReward?: string;
8
8
  spool?: string;
9
+ sCoinType?: string;
9
10
  sCoinTreasury?: string;
10
11
  interestModel?: string;
11
12
  riskModel?: string;
@@ -13,6 +14,7 @@ export declare const getAllAddresses: (query: ScallopQuery) => Promise<OptionalK
13
14
  supplyLimitKey?: string;
14
15
  borrowLimitKey?: string;
15
16
  isolatedAssetKey?: string;
16
- coinDecimalId?: string;
17
+ coinMetadataId?: string;
17
18
  borrowIncentivePoolId?: string;
19
+ coinType?: string;
18
20
  }>>>;
@@ -1,5 +1,6 @@
1
1
  import type { ScallopQuery } from '../models';
2
- import type { Market, SupportPoolCoins, MarketPool, Spool, StakeAccount, Lending, ObligationAccount, CoinAmounts, CoinPrices, TotalValueLocked } from '../types';
2
+ import type { Market, SupportPoolCoins, MarketPool, Spool, StakeAccount, Lending, ObligationAccount, CoinAmounts, CoinPrices, TotalValueLocked, MarketPools, MarketCollaterals } from '../types';
3
+ import { SuiObjectRef } from '@mysten/sui/client';
3
4
  /**
4
5
  * Get user lending infomation for specific pools.
5
6
  *
@@ -9,9 +10,10 @@ import type { Market, SupportPoolCoins, MarketPool, Spool, StakeAccount, Lending
9
10
  * @param indexer - Whether to use indexer.
10
11
  * @return User lending infomation for specific pools.
11
12
  */
12
- export declare const getLendings: (query: ScallopQuery, poolCoinNames?: SupportPoolCoins[], ownerAddress?: string, indexer?: boolean) => Promise<{
13
+ export declare const getLendings: (query: ScallopQuery, poolCoinNames?: SupportPoolCoins[], ownerAddress?: string, marketPools?: MarketPools, coinPrices?: CoinPrices, indexer?: boolean) => Promise<{
13
14
  usdc?: Lending | undefined;
14
15
  sbeth?: Lending | undefined;
16
+ sbusdt?: Lending | undefined;
15
17
  weth?: Lending | undefined;
16
18
  wbtc?: Lending | undefined;
17
19
  wusdc?: Lending | undefined;
@@ -26,6 +28,7 @@ export declare const getLendings: (query: ScallopQuery, poolCoinNames?: SupportP
26
28
  sca?: Lending | undefined;
27
29
  fud?: Lending | undefined;
28
30
  deep?: Lending | undefined;
31
+ fdusd?: Lending | undefined;
29
32
  }>;
30
33
  /**
31
34
  * Get user lending infomation for specific pool.
@@ -53,18 +56,21 @@ export declare const getLending: (query: ScallopQuery, poolCoinName: SupportPool
53
56
  * @param indexer - Whether to use indexer.
54
57
  * @return All obligation accounts data.
55
58
  */
56
- export declare const getObligationAccounts: (query: ScallopQuery, ownerAddress?: string, indexer?: boolean) => Promise<{
59
+ export declare const getObligationAccounts: (query: ScallopQuery, ownerAddress?: string, market?: {
60
+ pools: MarketPools;
61
+ collaterals: MarketCollaterals;
62
+ }, coinPrices?: CoinPrices, indexer?: boolean) => Promise<{
57
63
  [x: string]: ObligationAccount | undefined;
58
64
  }>;
59
65
  /**
60
66
  * Get obligation account data.
61
67
  *
62
68
  * @param query - The Scallop query instance.
63
- * @param obligationId - The obligation id.
69
+ * @param obligation - The obligation id.
64
70
  * @param indexer - Whether to use indexer.
65
71
  * @return Obligation account data.
66
72
  */
67
- export declare const getObligationAccount: (query: ScallopQuery, obligationId: string, ownerAddress?: string, indexer?: boolean, market?: Market, coinPrices?: CoinPrices, coinAmounts?: CoinAmounts) => Promise<ObligationAccount>;
73
+ export declare const getObligationAccount: (query: ScallopQuery, obligation: string | SuiObjectRef, ownerAddress?: string, indexer?: boolean, market?: Market, coinPrices?: CoinPrices, coinAmounts?: CoinAmounts) => Promise<ObligationAccount>;
68
74
  /**
69
75
  * Get total value locked data.
70
76
  *
@@ -73,3 +79,63 @@ export declare const getObligationAccount: (query: ScallopQuery, obligationId: s
73
79
  * @return Total value locked data.
74
80
  */
75
81
  export declare const getTotalValueLocked: (query: ScallopQuery, indexer?: boolean) => Promise<TotalValueLocked>;
82
+ /**
83
+ * Get user portfolio by wallet address
84
+ */
85
+ export declare const getUserPortfolio: (query: ScallopQuery, walletAddress: string, indexer?: boolean) => Promise<{
86
+ totalLockedScaValue: number;
87
+ lendings: {
88
+ suppliedCoin: number;
89
+ suppliedValue: number;
90
+ stakedCoin: number;
91
+ coinName: "usdc" | "sbeth" | "sbusdt" | "weth" | "wbtc" | "wusdc" | "wusdt" | "sui" | "wapt" | "wsol" | "cetus" | "afsui" | "hasui" | "vsui" | "sca" | "fud" | "deep" | "fdusd";
92
+ symbol: string;
93
+ coinType: string;
94
+ coinPrice: number;
95
+ coinDecimals: number;
96
+ supplyApr: number;
97
+ supplyApy: number;
98
+ incentiveApr: number;
99
+ }[];
100
+ borrowings: {
101
+ obligationId: string;
102
+ totalDebtsInUsd: number;
103
+ totalCollateralInUsd: number;
104
+ riskLevel: number;
105
+ availableCollateralInUsd: number;
106
+ totalUnhealthyCollateralInUsd: number;
107
+ borrowedPools: {
108
+ coinName: "usdc" | "sbeth" | "sbusdt" | "weth" | "wbtc" | "wusdc" | "wusdt" | "sui" | "wapt" | "wsol" | "cetus" | "afsui" | "hasui" | "vsui" | "sca" | "fud" | "deep" | "fdusd";
109
+ symbol: string;
110
+ coinDecimals: number;
111
+ coinType: string;
112
+ coinPrice: number;
113
+ borrowedCoin: number;
114
+ borrowedValueInUsd: number;
115
+ borrowApr: number | undefined;
116
+ borrowApy: number | undefined;
117
+ incentiveInfos: {
118
+ coinName: "usdc" | "sbeth" | "sbusdt" | "weth" | "wbtc" | "wusdc" | "wusdt" | "sui" | "wapt" | "wsol" | "cetus" | "afsui" | "hasui" | "vsui" | "sca" | "fud" | "deep" | "fdusd" | "susdc" | "ssbeth" | "ssbusdt" | "sweth" | "swbtc" | "swusdc" | "swusdt" | "ssui" | "swsol" | "scetus" | "safsui" | "shasui" | "svsui" | "ssca" | "sfud" | "sdeep" | "sfdusd";
119
+ symbol: string;
120
+ coinType: string;
121
+ incentiveApr: number;
122
+ }[];
123
+ }[];
124
+ }[];
125
+ pendingRewards: {
126
+ lendings: any;
127
+ borrowIncentives: any;
128
+ };
129
+ veScas: {
130
+ veScaKey: string;
131
+ coinPrice: number;
132
+ lockedScaInCoin: number;
133
+ lockedScaInUsd: number;
134
+ currentVeScaBalance: number;
135
+ remainingLockPeriodInDays: number;
136
+ unlockAt: number;
137
+ }[];
138
+ totalDebtValue: number;
139
+ totalCollateralValue: number;
140
+ totalSupplyValue: number;
141
+ }>;
@@ -17,6 +17,7 @@ export declare const getPythPrices: ({ address, }: {
17
17
  export declare const getAllCoinPrices: (query: ScallopQuery, marketPools?: MarketPools, coinPrices?: CoinPrices) => Promise<{
18
18
  susdc?: number | undefined;
19
19
  ssbeth?: number | undefined;
20
+ ssbusdt?: number | undefined;
20
21
  sweth?: number | undefined;
21
22
  swbtc?: number | undefined;
22
23
  swusdc?: number | undefined;
@@ -30,8 +31,10 @@ export declare const getAllCoinPrices: (query: ScallopQuery, marketPools?: Marke
30
31
  ssca?: number | undefined;
31
32
  sfud?: number | undefined;
32
33
  sdeep?: number | undefined;
34
+ sfdusd?: number | undefined;
33
35
  usdc?: number | undefined;
34
36
  sbeth?: number | undefined;
37
+ sbusdt?: number | undefined;
35
38
  weth?: number | undefined;
36
39
  wbtc?: number | undefined;
37
40
  wusdc?: number | undefined;
@@ -46,5 +49,6 @@ export declare const getAllCoinPrices: (query: ScallopQuery, marketPools?: Marke
46
49
  sca?: number | undefined;
47
50
  fud?: number | undefined;
48
51
  deep?: number | undefined;
52
+ fdusd?: number | undefined;
49
53
  swapt?: number | undefined;
50
54
  }>;
@@ -19,7 +19,7 @@ export declare const getSCoinTotalSupply: ({ utils, }: {
19
19
  */
20
20
  export declare const getSCoinAmounts: ({ utils, }: {
21
21
  utils: ScallopUtils;
22
- }, sCoinNames?: SupportSCoin[], ownerAddress?: string) => Promise<OptionalKeys<Record<"susdc" | "ssbeth" | "sweth" | "swbtc" | "swusdc" | "swusdt" | "ssui" | "swsol" | "scetus" | "safsui" | "shasui" | "svsui" | "ssca" | "sfud" | "sdeep", number>>>;
22
+ }, sCoinNames?: SupportSCoin[], ownerAddress?: string) => Promise<OptionalKeys<Record<"susdc" | "ssbeth" | "ssbusdt" | "sweth" | "swbtc" | "swusdc" | "swusdt" | "ssui" | "swsol" | "scetus" | "safsui" | "shasui" | "svsui" | "ssca" | "sfud" | "sdeep" | "sfdusd", number>>>;
23
23
  /**
24
24
  * Query owned sCoin amount.
25
25
  *
@@ -23,12 +23,12 @@ export type CoreNormalMethods = {
23
23
  addCollateral: (obligation: SuiObjectArg, coin: SuiObjectArg, collateralCoinName: SupportCollateralCoins) => void;
24
24
  takeCollateral: (obligation: SuiObjectArg, obligationKey: SuiObjectArg, amount: number, collateralCoinName: SupportCollateralCoins) => TransactionResult;
25
25
  deposit: (coin: SuiObjectArg, poolCoinName: SupportPoolCoins) => TransactionResult;
26
- depositEntry: (coin: SuiObjectArg, poolCoinName: SupportPoolCoins) => void;
26
+ depositEntry: (coin: SuiObjectArg, poolCoinName: SupportPoolCoins) => TransactionResult;
27
27
  withdraw: (marketCoin: SuiObjectArg, poolCoinName: SupportPoolCoins) => TransactionResult;
28
- withdrawEntry: (marketCoin: SuiObjectArg, poolCoinName: SupportPoolCoins) => void;
28
+ withdrawEntry: (marketCoin: SuiObjectArg, poolCoinName: SupportPoolCoins) => TransactionResult;
29
29
  borrow: (obligation: SuiObjectArg, obligationKey: SuiObjectArg, amount: number, poolCoinName: SupportPoolCoins) => TransactionResult;
30
30
  borrowWithReferral: (obligation: SuiObjectArg, obligationKey: SuiObjectArg, borrowReferral: SuiObjectArg, amount: number | SuiTxArg, poolCoinName: SupportPoolCoins) => TransactionResult;
31
- borrowEntry: (obligation: SuiObjectArg, obligationKey: SuiObjectArg, amount: number, poolCoinName: SupportPoolCoins) => void;
31
+ borrowEntry: (obligation: SuiObjectArg, obligationKey: SuiObjectArg, amount: number, poolCoinName: SupportPoolCoins) => TransactionResult;
32
32
  repay: (obligation: SuiObjectArg, coin: SuiObjectArg, poolCoinName: SupportPoolCoins) => void;
33
33
  borrowFlashLoan: (amount: number | SuiTxArg, poolCoinName: SupportPoolCoins) => TransactionResult;
34
34
  repayFlashLoan: (coin: SuiObjectArg, loan: SuiObjectArg, poolCoinName: SupportPoolCoins) => void;