@scallop-io/sui-scallop-sdk 1.4.24-alpha.1 → 1.5.0-alpha.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 (52) hide show
  1. package/dist/constants/common.d.ts +4 -4
  2. package/dist/constants/enum.d.ts +2 -2
  3. package/dist/constants/index.d.ts +1 -0
  4. package/dist/constants/xoracle.d.ts +2 -0
  5. package/dist/index.js +580 -685
  6. package/dist/index.js.map +1 -1
  7. package/dist/index.mjs +590 -696
  8. package/dist/index.mjs.map +1 -1
  9. package/dist/models/scallopIndexer.d.ts +1 -0
  10. package/dist/models/scallopPrice.d.ts +0 -0
  11. package/dist/models/scallopQuery.d.ts +30 -13
  12. package/dist/models/scallopUtils.d.ts +2 -2
  13. package/dist/queries/borrowIncentiveQuery.d.ts +0 -2
  14. package/dist/queries/coreQuery.d.ts +1 -1
  15. package/dist/queries/index.d.ts +1 -0
  16. package/dist/queries/poolAddressesQuery.d.ts +1 -1
  17. package/dist/queries/portfolioQuery.d.ts +3 -4
  18. package/dist/queries/priceQuery.d.ts +1 -3
  19. package/dist/queries/sCoinQuery.d.ts +1 -1
  20. package/dist/queries/xOracleQuery.d.ts +13 -0
  21. package/dist/types/address.d.ts +1 -0
  22. package/dist/types/constant/index.d.ts +1 -0
  23. package/dist/types/constant/xOracle.d.ts +9 -0
  24. package/package.json +1 -1
  25. package/src/builders/borrowIncentiveBuilder.ts +11 -25
  26. package/src/builders/coreBuilder.ts +15 -72
  27. package/src/builders/oracle.ts +73 -46
  28. package/src/builders/referralBuilder.ts +9 -20
  29. package/src/builders/spoolBuilder.ts +10 -38
  30. package/src/builders/vescaBuilder.ts +11 -26
  31. package/src/constants/coinGecko.ts +4 -12
  32. package/src/constants/common.ts +0 -2
  33. package/src/constants/enum.ts +10 -13
  34. package/src/constants/index.ts +1 -0
  35. package/src/constants/poolAddress.ts +343 -218
  36. package/src/constants/pyth.ts +0 -1
  37. package/src/constants/testAddress.ts +35 -254
  38. package/src/constants/xoracle.ts +25 -0
  39. package/src/models/scallopIndexer.ts +11 -0
  40. package/src/models/scallopPrice.ts +0 -0
  41. package/src/models/scallopQuery.ts +58 -13
  42. package/src/models/scallopUtils.ts +1 -1
  43. package/src/queries/coreQuery.ts +16 -6
  44. package/src/queries/index.ts +1 -0
  45. package/src/queries/poolAddressesQuery.ts +2 -2
  46. package/src/queries/priceQuery.ts +10 -3
  47. package/src/queries/vescaQuery.ts +8 -17
  48. package/src/queries/xOracleQuery.ts +124 -0
  49. package/src/types/address.ts +1 -0
  50. package/src/types/constant/index.ts +1 -0
  51. package/src/types/constant/xOracle.ts +11 -0
  52. package/src/utils/util.ts +4 -9
@@ -86,4 +86,5 @@ export declare class ScallopIndexer {
86
86
  * @return price data.
87
87
  */
88
88
  getCoinPrice(poolCoinName: SupportPoolCoins): Promise<number>;
89
+ getCoinPrices(): Promise<Record<string, number>>;
89
90
  }
File without changes
@@ -1,5 +1,5 @@
1
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';
2
+ import { ScallopQueryParams, SupportStakeMarketCoins, SupportAssetCoins, SupportPoolCoins, SupportCollateralCoins, SupportMarketCoins, SupportBorrowIncentiveCoins, SupportSCoin, ScallopQueryInstanceParams, MarketPool, CoinPrices, MarketPools, MarketCollaterals, xOracleRules } from '../types';
3
3
  import { ScallopAddress } from './scallopAddress';
4
4
  import { ScallopUtils } from './scallopUtils';
5
5
  import { ScallopIndexer } from './scallopIndexer';
@@ -128,7 +128,10 @@ export declare class ScallopQuery {
128
128
  * @param obligationId - The obligation id.
129
129
  * @return Obligation data.
130
130
  */
131
- queryObligation(obligationId: string | SuiObjectArg): Promise<import("../types").ObligationQueryInterface | undefined>;
131
+ queryObligation(obligationId: SuiObjectArg, args?: {
132
+ version: SuiObjectArg;
133
+ market: SuiObjectArg;
134
+ }): Promise<import("../types").ObligationQueryInterface | undefined>;
132
135
  /**
133
136
  * Get all asset coin amounts.
134
137
  *
@@ -320,7 +323,6 @@ export declare class ScallopQuery {
320
323
  deep?: import("../types").BorrowIncentivePool | undefined;
321
324
  fdusd?: import("../types").BorrowIncentivePool | undefined;
322
325
  blub?: import("../types").BorrowIncentivePool | undefined;
323
- musd?: import("../types").BorrowIncentivePool | undefined;
324
326
  }>;
325
327
  /**
326
328
  * Get borrow incentive accounts data.
@@ -350,7 +352,6 @@ export declare class ScallopQuery {
350
352
  deep?: import("../types").ParsedBorrowIncentiveAccountData | undefined;
351
353
  fdusd?: import("../types").ParsedBorrowIncentiveAccountData | undefined;
352
354
  blub?: import("../types").ParsedBorrowIncentiveAccountData | undefined;
353
- musd?: import("../types").ParsedBorrowIncentiveAccountData | undefined;
354
355
  }>;
355
356
  /**
356
357
  * Get user lending and spool infomation for specific pools.
@@ -385,7 +386,6 @@ export declare class ScallopQuery {
385
386
  deep?: import("../types").Lending | undefined;
386
387
  fdusd?: import("../types").Lending | undefined;
387
388
  blub?: import("../types").Lending | undefined;
388
- musd?: import("../types").Lending | undefined;
389
389
  }>;
390
390
  /**
391
391
  * Get user lending and spool information for specific pool.
@@ -501,7 +501,7 @@ export declare class ScallopQuery {
501
501
  * @param ownerAddress - The owner address.
502
502
  * @return All market sCoin amounts.
503
503
  */
504
- getSCoinAmounts(sCoinNames?: SupportSCoin[], ownerAddress?: string): Promise<import("../types").OptionalKeys<Record<"susdc" | "ssbeth" | "ssbusdt" | "ssbwbtc" | "sweth" | "swbtc" | "swusdc" | "swusdt" | "ssui" | "swsol" | "scetus" | "safsui" | "shasui" | "svsui" | "ssca" | "sfud" | "sdeep" | "sfdusd" | "sblub" | "smusd", number>>>;
504
+ getSCoinAmounts(sCoinNames?: SupportSCoin[], ownerAddress?: string): Promise<import("../types").OptionalKeys<Record<"susdc" | "ssbeth" | "ssbusdt" | "ssbwbtc" | "sweth" | "swbtc" | "swusdc" | "swusdt" | "ssui" | "swsol" | "scetus" | "safsui" | "shasui" | "svsui" | "ssca" | "sfud" | "sdeep" | "sfdusd" | "sblub", number>>>;
505
505
  /**
506
506
  * Get sCoin amount.
507
507
  *
@@ -516,7 +516,7 @@ export declare class ScallopQuery {
516
516
  * @returns
517
517
  */
518
518
  getSCoinSwapRate(fromSCoin: SupportSCoin, toSCoin: SupportSCoin): Promise<number>;
519
- getFlashLoanFees(assetCoinNames?: SupportAssetCoins[]): Promise<Record<"usdc" | "sbeth" | "sbusdt" | "sbwbtc" | "weth" | "wbtc" | "wusdc" | "wusdt" | "sui" | "wapt" | "wsol" | "cetus" | "afsui" | "hasui" | "vsui" | "sca" | "fud" | "deep" | "fdusd" | "blub" | "musd", number>>;
519
+ getFlashLoanFees(assetCoinNames?: SupportAssetCoins[]): Promise<Record<"usdc" | "sbeth" | "sbusdt" | "sbwbtc" | "weth" | "wbtc" | "wusdc" | "wusdt" | "sui" | "wapt" | "wsol" | "cetus" | "afsui" | "hasui" | "vsui" | "sca" | "fud" | "deep" | "fdusd" | "blub", number>>;
520
520
  /**
521
521
  * Get supply limit of lending pool
522
522
  */
@@ -539,6 +539,11 @@ export declare class ScallopQuery {
539
539
  * @returns price data
540
540
  */
541
541
  getCoinPriceByIndexer(poolName: SupportPoolCoins): Promise<number>;
542
+ /**
543
+ * Get all supported pool price from indexer
544
+ * @returns prices data
545
+ */
546
+ getCoinPricesByIndexer(): Promise<Record<string, number>>;
542
547
  /**
543
548
  * Get all coin prices, including sCoin
544
549
  * @returns prices data
@@ -546,6 +551,7 @@ export declare class ScallopQuery {
546
551
  getAllCoinPrices(args?: {
547
552
  marketPools?: MarketPools;
548
553
  coinPrices?: CoinPrices;
554
+ indexer?: boolean;
549
555
  }): Promise<{
550
556
  susdc?: number | undefined;
551
557
  ssbeth?: number | undefined;
@@ -566,7 +572,6 @@ export declare class ScallopQuery {
566
572
  sdeep?: number | undefined;
567
573
  sfdusd?: number | undefined;
568
574
  sblub?: number | undefined;
569
- smusd?: number | undefined;
570
575
  usdc?: number | undefined;
571
576
  sbeth?: number | undefined;
572
577
  sbusdt?: number | undefined;
@@ -587,14 +592,13 @@ export declare class ScallopQuery {
587
592
  deep?: number | undefined;
588
593
  fdusd?: number | undefined;
589
594
  blub?: number | undefined;
590
- musd?: number | undefined;
591
595
  swapt?: number | undefined;
592
596
  }>;
593
597
  /**
594
598
  * Query all address (lending pool, collateral pool, borrow dynamics, interest models, etc.) of all pool
595
599
  * @returns
596
600
  */
597
- getPoolAddresses(pools?: SupportPoolCoins[]): Promise<import("../types").OptionalKeys<Record<"usdc" | "sbeth" | "sbusdt" | "sbwbtc" | "weth" | "wbtc" | "wusdc" | "wusdt" | "sui" | "wapt" | "wsol" | "cetus" | "afsui" | "hasui" | "vsui" | "sca" | "fud" | "deep" | "fdusd" | "blub" | "musd", {
601
+ getPoolAddresses(poolNames?: SupportPoolCoins[]): Promise<import("../types").OptionalKeys<Record<"usdc" | "sbeth" | "sbusdt" | "sbwbtc" | "weth" | "wbtc" | "wusdc" | "wusdt" | "sui" | "wapt" | "wsol" | "cetus" | "afsui" | "hasui" | "vsui" | "sca" | "fud" | "deep" | "fdusd" | "blub", {
598
602
  coinName: string;
599
603
  symbol: string;
600
604
  lendingPoolAddress?: string;
@@ -633,7 +637,7 @@ export declare class ScallopQuery {
633
637
  suppliedCoin: number;
634
638
  suppliedValue: number;
635
639
  stakedCoin: number;
636
- coinName: "usdc" | "sbeth" | "sbusdt" | "sbwbtc" | "weth" | "wbtc" | "wusdc" | "wusdt" | "sui" | "wapt" | "wsol" | "cetus" | "afsui" | "hasui" | "vsui" | "sca" | "fud" | "deep" | "fdusd" | "blub" | "musd";
640
+ coinName: "usdc" | "sbeth" | "sbusdt" | "sbwbtc" | "weth" | "wbtc" | "wusdc" | "wusdt" | "sui" | "wapt" | "wsol" | "cetus" | "afsui" | "hasui" | "vsui" | "sca" | "fud" | "deep" | "fdusd" | "blub";
637
641
  symbol: string;
638
642
  coinType: string;
639
643
  coinPrice: number;
@@ -650,7 +654,7 @@ export declare class ScallopQuery {
650
654
  availableCollateralInUsd: number;
651
655
  totalUnhealthyCollateralInUsd: number;
652
656
  borrowedPools: {
653
- coinName: "usdc" | "sbeth" | "sbusdt" | "sbwbtc" | "weth" | "wbtc" | "wusdc" | "wusdt" | "sui" | "wapt" | "wsol" | "cetus" | "afsui" | "hasui" | "vsui" | "sca" | "fud" | "deep" | "fdusd" | "blub" | "musd";
657
+ coinName: "usdc" | "sbeth" | "sbusdt" | "sbwbtc" | "weth" | "wbtc" | "wusdc" | "wusdt" | "sui" | "wapt" | "wsol" | "cetus" | "afsui" | "hasui" | "vsui" | "sca" | "fud" | "deep" | "fdusd" | "blub";
654
658
  symbol: string;
655
659
  coinDecimals: number;
656
660
  coinType: string;
@@ -660,7 +664,7 @@ export declare class ScallopQuery {
660
664
  borrowApr: number | undefined;
661
665
  borrowApy: number | undefined;
662
666
  incentiveInfos: {
663
- coinName: "usdc" | "sbeth" | "sbusdt" | "sbwbtc" | "weth" | "wbtc" | "wusdc" | "wusdt" | "sui" | "wapt" | "wsol" | "cetus" | "afsui" | "hasui" | "vsui" | "sca" | "fud" | "deep" | "fdusd" | "blub" | "musd" | "susdc" | "ssbeth" | "ssbusdt" | "ssbwbtc" | "sweth" | "swbtc" | "swusdc" | "swusdt" | "ssui" | "swsol" | "scetus" | "safsui" | "shasui" | "svsui" | "ssca" | "sfud" | "sdeep" | "sfdusd" | "sblub" | "smusd";
667
+ coinName: "usdc" | "sbeth" | "sbusdt" | "sbwbtc" | "weth" | "wbtc" | "wusdc" | "wusdt" | "sui" | "wapt" | "wsol" | "cetus" | "afsui" | "hasui" | "vsui" | "sca" | "fud" | "deep" | "fdusd" | "blub" | "susdc" | "ssbeth" | "ssbusdt" | "ssbwbtc" | "sweth" | "swbtc" | "swusdc" | "swusdt" | "ssui" | "swsol" | "scetus" | "safsui" | "shasui" | "svsui" | "ssca" | "sfud" | "sdeep" | "sfdusd" | "sblub";
664
668
  symbol: string;
665
669
  coinType: string;
666
670
  incentiveApr: number;
@@ -684,4 +688,17 @@ export declare class ScallopQuery {
684
688
  totalCollateralValue: number;
685
689
  totalSupplyValue: number;
686
690
  }>;
691
+ /**
692
+ * Get both primary and secondary price update policy objects
693
+ * @returns price update policies
694
+ */
695
+ getPriceUpdatePolicies(): Promise<{
696
+ primary: import("@mysten/sui/client").SuiObjectResponse | null;
697
+ secondary: import("@mysten/sui/client").SuiObjectResponse | null;
698
+ }>;
699
+ /**
700
+ * Return the supported primary and secondary oracles for all supported pool assets
701
+ * @returns
702
+ */
703
+ getAssetOracles(): Promise<Record<SupportAssetCoins, xOracleRules>>;
687
704
  }
@@ -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" | "ssbusdt" | "ssbwbtc" | "sweth" | "swbtc" | "swusdc" | "swusdt" | "ssui" | "swsol" | "scetus" | "safsui" | "shasui" | "svsui" | "ssca" | "sfud" | "sdeep" | "sfdusd" | "sblub" | "smusd";
68
+ parseSCoinTypeNameToMarketCoinName(coinName: string): "susdc" | "ssbeth" | "ssbusdt" | "ssbwbtc" | "sweth" | "swbtc" | "swusdc" | "swusdt" | "ssui" | "swsol" | "scetus" | "safsui" | "shasui" | "svsui" | "ssca" | "sfud" | "sdeep" | "sfdusd" | "sblub";
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" | "ssbusdt" | "ssbwbtc" | "sweth" | "swbtc" | "swusdc" | "swusdt" | "ssui" | "swsol" | "scetus" | "safsui" | "shasui" | "svsui" | "ssca" | "sfud" | "sdeep" | "sfdusd" | "sblub" | "smusd";
80
+ parseSCoinNameFromType(sCoinType: string): "susdc" | "ssbeth" | "ssbusdt" | "ssbwbtc" | "sweth" | "swbtc" | "swusdc" | "swusdt" | "ssui" | "swsol" | "scetus" | "safsui" | "shasui" | "svsui" | "ssca" | "sfud" | "sdeep" | "sfdusd" | "sblub";
81
81
  /**
82
82
  * Convert sCoin name into its underlying coin type
83
83
  * @param sCoinName
@@ -36,7 +36,6 @@ export declare const getBorrowIncentivePools: (query: ScallopQuery, borrowIncent
36
36
  deep?: BorrowIncentivePool | undefined;
37
37
  fdusd?: BorrowIncentivePool | undefined;
38
38
  blub?: BorrowIncentivePool | undefined;
39
- musd?: BorrowIncentivePool | undefined;
40
39
  }>;
41
40
  /**
42
41
  * Query borrow incentive accounts data.
@@ -68,7 +67,6 @@ export declare const queryBorrowIncentiveAccounts: ({ utils, }: {
68
67
  deep?: import("../types").ParsedBorrowIncentiveAccountData | undefined;
69
68
  fdusd?: import("../types").ParsedBorrowIncentiveAccountData | undefined;
70
69
  blub?: import("../types").ParsedBorrowIncentiveAccountData | undefined;
71
- musd?: import("../types").ParsedBorrowIncentiveAccountData | undefined;
72
70
  }>;
73
71
  /**
74
72
  * Check veSca bind status
@@ -125,7 +125,7 @@ export declare const getObligationLocked: (cache: ScallopCache, obligation: stri
125
125
  */
126
126
  export declare const queryObligation: ({ address, }: {
127
127
  address: ScallopAddress;
128
- }, obligationId: SuiObjectArg) => Promise<ObligationQueryInterface | undefined>;
128
+ }, obligationId: SuiObjectArg, version?: SuiObjectArg, market?: SuiObjectArg) => Promise<ObligationQueryInterface | undefined>;
129
129
  /**
130
130
  * Query all owned coin amount.
131
131
  *
@@ -12,3 +12,4 @@ export * from './vescaQuery';
12
12
  export * from './borrowLimitQuery';
13
13
  export * from './poolAddressesQuery';
14
14
  export * from './objectsQuery';
15
+ export * from './xOracleQuery';
@@ -1,6 +1,6 @@
1
1
  import { ScallopQuery } from 'src/models';
2
2
  import { OptionalKeys, SupportPoolCoins } from 'src/types';
3
- export declare const getAllAddresses: (query: ScallopQuery, pools: SupportPoolCoins[]) => Promise<OptionalKeys<Record<"usdc" | "sbeth" | "sbusdt" | "sbwbtc" | "weth" | "wbtc" | "wusdc" | "wusdt" | "sui" | "wapt" | "wsol" | "cetus" | "afsui" | "hasui" | "vsui" | "sca" | "fud" | "deep" | "fdusd" | "blub" | "musd", {
3
+ export declare const getAllAddresses: (query: ScallopQuery, pools?: SupportPoolCoins[]) => Promise<OptionalKeys<Record<"usdc" | "sbeth" | "sbusdt" | "sbwbtc" | "weth" | "wbtc" | "wusdc" | "wusdt" | "sui" | "wapt" | "wsol" | "cetus" | "afsui" | "hasui" | "vsui" | "sca" | "fud" | "deep" | "fdusd" | "blub", {
4
4
  coinName: string;
5
5
  symbol: string;
6
6
  lendingPoolAddress?: string;
@@ -31,7 +31,6 @@ export declare const getLendings: (query: ScallopQuery, poolCoinNames?: SupportP
31
31
  deep?: Lending | undefined;
32
32
  fdusd?: Lending | undefined;
33
33
  blub?: Lending | undefined;
34
- musd?: Lending | undefined;
35
34
  }>;
36
35
  /**
37
36
  * Get user lending infomation for specific pool.
@@ -91,7 +90,7 @@ export declare const getUserPortfolio: (query: ScallopQuery, walletAddress: stri
91
90
  suppliedCoin: number;
92
91
  suppliedValue: number;
93
92
  stakedCoin: number;
94
- coinName: "usdc" | "sbeth" | "sbusdt" | "sbwbtc" | "weth" | "wbtc" | "wusdc" | "wusdt" | "sui" | "wapt" | "wsol" | "cetus" | "afsui" | "hasui" | "vsui" | "sca" | "fud" | "deep" | "fdusd" | "blub" | "musd";
93
+ coinName: "usdc" | "sbeth" | "sbusdt" | "sbwbtc" | "weth" | "wbtc" | "wusdc" | "wusdt" | "sui" | "wapt" | "wsol" | "cetus" | "afsui" | "hasui" | "vsui" | "sca" | "fud" | "deep" | "fdusd" | "blub";
95
94
  symbol: string;
96
95
  coinType: string;
97
96
  coinPrice: number;
@@ -108,7 +107,7 @@ export declare const getUserPortfolio: (query: ScallopQuery, walletAddress: stri
108
107
  availableCollateralInUsd: number;
109
108
  totalUnhealthyCollateralInUsd: number;
110
109
  borrowedPools: {
111
- coinName: "usdc" | "sbeth" | "sbusdt" | "sbwbtc" | "weth" | "wbtc" | "wusdc" | "wusdt" | "sui" | "wapt" | "wsol" | "cetus" | "afsui" | "hasui" | "vsui" | "sca" | "fud" | "deep" | "fdusd" | "blub" | "musd";
110
+ coinName: "usdc" | "sbeth" | "sbusdt" | "sbwbtc" | "weth" | "wbtc" | "wusdc" | "wusdt" | "sui" | "wapt" | "wsol" | "cetus" | "afsui" | "hasui" | "vsui" | "sca" | "fud" | "deep" | "fdusd" | "blub";
112
111
  symbol: string;
113
112
  coinDecimals: number;
114
113
  coinType: string;
@@ -118,7 +117,7 @@ export declare const getUserPortfolio: (query: ScallopQuery, walletAddress: stri
118
117
  borrowApr: number | undefined;
119
118
  borrowApy: number | undefined;
120
119
  incentiveInfos: {
121
- coinName: "usdc" | "sbeth" | "sbusdt" | "sbwbtc" | "weth" | "wbtc" | "wusdc" | "wusdt" | "sui" | "wapt" | "wsol" | "cetus" | "afsui" | "hasui" | "vsui" | "sca" | "fud" | "deep" | "fdusd" | "blub" | "musd" | "susdc" | "ssbeth" | "ssbusdt" | "ssbwbtc" | "sweth" | "swbtc" | "swusdc" | "swusdt" | "ssui" | "swsol" | "scetus" | "safsui" | "shasui" | "svsui" | "ssca" | "sfud" | "sdeep" | "sfdusd" | "sblub" | "smusd";
120
+ coinName: "usdc" | "sbeth" | "sbusdt" | "sbwbtc" | "weth" | "wbtc" | "wusdc" | "wusdt" | "sui" | "wapt" | "wsol" | "cetus" | "afsui" | "hasui" | "vsui" | "sca" | "fud" | "deep" | "fdusd" | "blub" | "susdc" | "ssbeth" | "ssbusdt" | "ssbwbtc" | "sweth" | "swbtc" | "swusdc" | "swusdt" | "ssui" | "swsol" | "scetus" | "safsui" | "shasui" | "svsui" | "ssca" | "sfud" | "sdeep" | "sfdusd" | "sblub";
122
121
  symbol: string;
123
122
  coinType: string;
124
123
  incentiveApr: number;
@@ -14,7 +14,7 @@ export declare const getPythPrice: ({ address, }: {
14
14
  export declare const getPythPrices: ({ address, }: {
15
15
  address: ScallopAddress;
16
16
  }, assetCoinNames: SupportAssetCoins[]) => Promise<Record<SupportAssetCoins, number>>;
17
- export declare const getAllCoinPrices: (query: ScallopQuery, marketPools?: MarketPools, coinPrices?: CoinPrices) => Promise<{
17
+ export declare const getAllCoinPrices: (query: ScallopQuery, marketPools?: MarketPools, coinPrices?: CoinPrices, indexer?: boolean) => Promise<{
18
18
  susdc?: number | undefined;
19
19
  ssbeth?: number | undefined;
20
20
  ssbusdt?: number | undefined;
@@ -34,7 +34,6 @@ export declare const getAllCoinPrices: (query: ScallopQuery, marketPools?: Marke
34
34
  sdeep?: number | undefined;
35
35
  sfdusd?: number | undefined;
36
36
  sblub?: number | undefined;
37
- smusd?: number | undefined;
38
37
  usdc?: number | undefined;
39
38
  sbeth?: number | undefined;
40
39
  sbusdt?: number | undefined;
@@ -55,6 +54,5 @@ export declare const getAllCoinPrices: (query: ScallopQuery, marketPools?: Marke
55
54
  deep?: number | undefined;
56
55
  fdusd?: number | undefined;
57
56
  blub?: number | undefined;
58
- musd?: number | undefined;
59
57
  swapt?: number | undefined;
60
58
  }>;
@@ -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" | "ssbusdt" | "ssbwbtc" | "sweth" | "swbtc" | "swusdc" | "swusdt" | "ssui" | "swsol" | "scetus" | "safsui" | "shasui" | "svsui" | "ssca" | "sfud" | "sdeep" | "sfdusd" | "sblub" | "smusd", number>>>;
22
+ }, sCoinNames?: SupportSCoin[], ownerAddress?: string) => Promise<OptionalKeys<Record<"susdc" | "ssbeth" | "ssbusdt" | "ssbwbtc" | "sweth" | "swbtc" | "swusdc" | "swusdt" | "ssui" | "swsol" | "scetus" | "safsui" | "shasui" | "svsui" | "ssca" | "sfud" | "sdeep" | "sfdusd" | "sblub", number>>>;
23
23
  /**
24
24
  * Query owned sCoin amount.
25
25
  *
@@ -0,0 +1,13 @@
1
+ import { SuiObjectResponse } from '@mysten/sui/client';
2
+ import { ScallopAddress, ScallopUtils } from 'src/models';
3
+ import { SupportAssetCoins, SupportOracleType, xOracleRuleType } from 'src/types';
4
+ /**
5
+ * Query the price update policy table ids. Usually the value for these table will be constant.
6
+ * @param query
7
+ * @returns
8
+ */
9
+ export declare const getPriceUpdatePolicies: (address: ScallopAddress) => Promise<{
10
+ primary: SuiObjectResponse | null;
11
+ secondary: SuiObjectResponse | null;
12
+ }>;
13
+ export declare const getAssetOracles: (utils: ScallopUtils, ruleType: xOracleRuleType) => Promise<Record<SupportAssetCoins, SupportOracleType[]>>;
@@ -41,6 +41,7 @@ export interface AddressesInterface {
41
41
  };
42
42
  packages: Partial<Record<SupportPackageType, {
43
43
  id: string;
44
+ object?: string;
44
45
  upgradeCap: string;
45
46
  }>>;
46
47
  };
@@ -1,2 +1,3 @@
1
1
  export type * from './common';
2
2
  export type * from './enum';
3
+ export type * from './xOracle';
@@ -0,0 +1,9 @@
1
+ import { SupportAssetCoins, SupportOracleType } from './common';
2
+ export type xOracleRules = {
3
+ primary: SupportOracleType[];
4
+ secondary: SupportOracleType[];
5
+ };
6
+ export type xOracleRuleType = keyof xOracleRules;
7
+ export type xOracleListType = {
8
+ [key in SupportAssetCoins]: xOracleRules;
9
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scallop-io/sui-scallop-sdk",
3
- "version": "1.4.24-alpha.1",
3
+ "version": "1.5.0-alpha.1",
4
4
  "description": "Typescript sdk for interacting with Scallop contract on SUI",
5
5
  "keywords": [
6
6
  "sui",
@@ -98,6 +98,12 @@ const generateBorrowIncentiveNormalMethod: GenerateBorrowIncentiveNormalMethod =
98
98
  config: builder.address.get('vesca.config'),
99
99
  };
100
100
 
101
+ const clockObjectRef = txBlock.sharedObjectRef({
102
+ objectId: SUI_CLOCK_OBJECT_ID,
103
+ mutable: false,
104
+ initialSharedVersion: '1',
105
+ });
106
+
101
107
  return {
102
108
  stakeObligation: (obligationId, obligationKey) => {
103
109
  builder.moveCall(
@@ -110,11 +116,7 @@ const generateBorrowIncentiveNormalMethod: GenerateBorrowIncentiveNormalMethod =
110
116
  obligationKey,
111
117
  obligationId,
112
118
  borrowIncentiveIds.obligationAccessStore,
113
- txBlock.sharedObjectRef({
114
- objectId: SUI_CLOCK_OBJECT_ID,
115
- mutable: false,
116
- initialSharedVersion: '1',
117
- }),
119
+ clockObjectRef,
118
120
  ]
119
121
  );
120
122
  },
@@ -133,11 +135,7 @@ const generateBorrowIncentiveNormalMethod: GenerateBorrowIncentiveNormalMethod =
133
135
  veScaIds.treasury,
134
136
  veScaIds.table,
135
137
  veScaKey,
136
- txBlock.sharedObjectRef({
137
- objectId: SUI_CLOCK_OBJECT_ID,
138
- mutable: false,
139
- initialSharedVersion: '1',
140
- }),
138
+ clockObjectRef,
141
139
  ],
142
140
  []
143
141
  );
@@ -152,11 +150,7 @@ const generateBorrowIncentiveNormalMethod: GenerateBorrowIncentiveNormalMethod =
152
150
  borrowIncentiveIds.incentiveAccounts,
153
151
  obligationKey,
154
152
  obligationId,
155
- txBlock.sharedObjectRef({
156
- objectId: SUI_CLOCK_OBJECT_ID,
157
- mutable: false,
158
- initialSharedVersion: '1',
159
- }),
153
+ clockObjectRef,
160
154
  ]
161
155
  );
162
156
  },
@@ -171,11 +165,7 @@ const generateBorrowIncentiveNormalMethod: GenerateBorrowIncentiveNormalMethod =
171
165
  borrowIncentiveIds.incentiveAccounts,
172
166
  obligationKey,
173
167
  obligationId,
174
- txBlock.sharedObjectRef({
175
- objectId: SUI_CLOCK_OBJECT_ID,
176
- mutable: false,
177
- initialSharedVersion: '1',
178
- }),
168
+ clockObjectRef,
179
169
  ],
180
170
  [rewardType]
181
171
  );
@@ -190,11 +180,7 @@ const generateBorrowIncentiveNormalMethod: GenerateBorrowIncentiveNormalMethod =
190
180
  borrowIncentiveIds.incentiveAccounts,
191
181
  obligation,
192
182
  veScaKey,
193
- txBlock.sharedObjectRef({
194
- objectId: SUI_CLOCK_OBJECT_ID,
195
- mutable: false,
196
- initialSharedVersion: '1',
197
- }),
183
+ clockObjectRef,
198
184
  ]
199
185
  );
200
186
  },
@@ -75,6 +75,11 @@ const generateCoreNormalMethod: GenerateCoreNormalMethod = ({
75
75
 
76
76
  const referralPkgId = builder.address.get('referral.id');
77
77
  const referralWitnessType = `${referralPkgId}::scallop_referral_program::REFERRAL_WITNESS`;
78
+ const clockObjectRef = txBlock.sharedObjectRef({
79
+ objectId: SUI_CLOCK_OBJECT_ID,
80
+ mutable: false,
81
+ initialSharedVersion: '1',
82
+ });
78
83
 
79
84
  return {
80
85
  openObligation: () => {
@@ -126,11 +131,7 @@ const generateCoreNormalMethod: GenerateCoreNormalMethod = ({
126
131
  coreIds.coinDecimalsRegistry,
127
132
  txBlock.pure.u64(amount),
128
133
  coreIds.xOracle,
129
- txBlock.sharedObjectRef({
130
- objectId: SUI_CLOCK_OBJECT_ID,
131
- mutable: false,
132
- initialSharedVersion: '1',
133
- }),
134
+ clockObjectRef,
134
135
  ],
135
136
  [coinType]
136
137
  );
@@ -141,16 +142,7 @@ const generateCoreNormalMethod: GenerateCoreNormalMethod = ({
141
142
  return builder.moveCall(
142
143
  txBlock,
143
144
  `${coreIds.protocolPkg}::mint::mint`,
144
- [
145
- coreIds.version,
146
- coreIds.market,
147
- coin,
148
- txBlock.sharedObjectRef({
149
- objectId: SUI_CLOCK_OBJECT_ID,
150
- mutable: false,
151
- initialSharedVersion: '1',
152
- }),
153
- ],
145
+ [coreIds.version, coreIds.market, coin, clockObjectRef],
154
146
  [coinType]
155
147
  );
156
148
  },
@@ -160,16 +152,7 @@ const generateCoreNormalMethod: GenerateCoreNormalMethod = ({
160
152
  return builder.moveCall(
161
153
  txBlock,
162
154
  `${coreIds.protocolPkg}::mint::mint_entry`,
163
- [
164
- coreIds.version,
165
- coreIds.market,
166
- coin,
167
- txBlock.sharedObjectRef({
168
- objectId: SUI_CLOCK_OBJECT_ID,
169
- mutable: false,
170
- initialSharedVersion: '1',
171
- }),
172
- ],
155
+ [coreIds.version, coreIds.market, coin, clockObjectRef],
173
156
  [coinType]
174
157
  );
175
158
  },
@@ -179,16 +162,7 @@ const generateCoreNormalMethod: GenerateCoreNormalMethod = ({
179
162
  return builder.moveCall(
180
163
  txBlock,
181
164
  `${coreIds.protocolPkg}::redeem::redeem`,
182
- [
183
- coreIds.version,
184
- coreIds.market,
185
- marketCoin,
186
- txBlock.sharedObjectRef({
187
- objectId: SUI_CLOCK_OBJECT_ID,
188
- mutable: false,
189
- initialSharedVersion: '1',
190
- }),
191
- ],
165
+ [coreIds.version, coreIds.market, marketCoin, clockObjectRef],
192
166
  [coinType]
193
167
  );
194
168
  },
@@ -198,16 +172,7 @@ const generateCoreNormalMethod: GenerateCoreNormalMethod = ({
198
172
  return builder.moveCall(
199
173
  txBlock,
200
174
  `${coreIds.protocolPkg}::redeem::redeem_entry`,
201
- [
202
- coreIds.version,
203
- coreIds.market,
204
- marketCoin,
205
- txBlock.sharedObjectRef({
206
- objectId: SUI_CLOCK_OBJECT_ID,
207
- mutable: false,
208
- initialSharedVersion: '1',
209
- }),
210
- ],
175
+ [coreIds.version, coreIds.market, marketCoin, clockObjectRef],
211
176
  [coinType]
212
177
  );
213
178
  },
@@ -225,11 +190,7 @@ const generateCoreNormalMethod: GenerateCoreNormalMethod = ({
225
190
  coreIds.coinDecimalsRegistry,
226
191
  amount,
227
192
  coreIds.xOracle,
228
- txBlock.sharedObjectRef({
229
- objectId: SUI_CLOCK_OBJECT_ID,
230
- mutable: false,
231
- initialSharedVersion: '1',
232
- }),
193
+ clockObjectRef,
233
194
  ],
234
195
  [coinType]
235
196
  );
@@ -255,11 +216,7 @@ const generateCoreNormalMethod: GenerateCoreNormalMethod = ({
255
216
  borrowReferral,
256
217
  typeof amount === 'number' ? txBlock.pure.u64(amount) : amount,
257
218
  coreIds.xOracle,
258
- txBlock.sharedObjectRef({
259
- objectId: SUI_CLOCK_OBJECT_ID,
260
- mutable: false,
261
- initialSharedVersion: '1',
262
- }),
219
+ clockObjectRef,
263
220
  ],
264
221
  [coinType, referralWitnessType]
265
222
  );
@@ -278,11 +235,7 @@ const generateCoreNormalMethod: GenerateCoreNormalMethod = ({
278
235
  coreIds.coinDecimalsRegistry,
279
236
  txBlock.pure.u64(amount),
280
237
  coreIds.xOracle,
281
- txBlock.sharedObjectRef({
282
- objectId: SUI_CLOCK_OBJECT_ID,
283
- mutable: false,
284
- initialSharedVersion: '1',
285
- }),
238
+ clockObjectRef,
286
239
  ],
287
240
  [coinType]
288
241
  );
@@ -292,17 +245,7 @@ const generateCoreNormalMethod: GenerateCoreNormalMethod = ({
292
245
  builder.moveCall(
293
246
  txBlock,
294
247
  `${coreIds.protocolPkg}::repay::repay`,
295
- [
296
- coreIds.version,
297
- obligation,
298
- coreIds.market,
299
- coin,
300
- txBlock.sharedObjectRef({
301
- objectId: SUI_CLOCK_OBJECT_ID,
302
- mutable: false,
303
- initialSharedVersion: '1',
304
- }),
305
- ],
248
+ [coreIds.version, obligation, coreIds.market, coin, clockObjectRef],
306
249
  [coinType]
307
250
  );
308
251
  },
@@ -479,7 +422,7 @@ const generateCoreQuickMethod: GenerateCoreQuickMethod = ({
479
422
  )) ?? [];
480
423
  const updateCoinNames = [...obligationCoinNames, poolCoinName];
481
424
  await updateOracles(builder, txBlock, updateCoinNames);
482
- return await txBlock.borrow(
425
+ return txBlock.borrow(
483
426
  obligationInfo.obligationId,
484
427
  obligationInfo.obligationKey as SuiObjectArg,
485
428
  amount,