@scallop-io/sui-scallop-sdk 1.4.22-alpha.1 → 1.4.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/constants/common.d.ts +6 -6
- package/dist/constants/enum.d.ts +2 -2
- package/dist/index.js +51 -30
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +51 -30
- package/dist/index.mjs.map +1 -1
- package/dist/models/scallopIndexer.d.ts +0 -1
- package/dist/models/scallopQuery.d.ts +12 -12
- package/dist/models/scallopUtils.d.ts +2 -2
- package/dist/queries/borrowIncentiveQuery.d.ts +2 -0
- package/dist/queries/coreQuery.d.ts +1 -0
- package/dist/queries/poolAddressesQuery.d.ts +1 -1
- package/dist/queries/portfolioQuery.d.ts +4 -3
- package/dist/queries/priceQuery.d.ts +3 -1
- package/dist/queries/sCoinQuery.d.ts +1 -1
- package/package.json +1 -1
- package/src/constants/coinGecko.ts +1 -0
- package/src/constants/common.ts +4 -1
- package/src/constants/enum.ts +9 -0
- package/src/constants/poolAddress.ts +37 -0
- package/src/constants/pyth.ts +1 -0
- package/src/constants/testAddress.ts +4 -0
- package/src/models/scallopIndexer.ts +0 -11
- package/src/models/scallopQuery.ts +1 -15
- package/src/models/scallopUtils.ts +2 -0
- package/src/queries/priceQuery.ts +3 -10
|
@@ -90,6 +90,7 @@ export declare class ScallopQuery {
|
|
|
90
90
|
usdc?: import("../types").MarketCollateral | undefined;
|
|
91
91
|
sbeth?: import("../types").MarketCollateral | undefined;
|
|
92
92
|
sbusdt?: import("../types").MarketCollateral | undefined;
|
|
93
|
+
sbwbtc?: import("../types").MarketCollateral | undefined;
|
|
93
94
|
weth?: import("../types").MarketCollateral | undefined;
|
|
94
95
|
wbtc?: import("../types").MarketCollateral | undefined;
|
|
95
96
|
wusdc?: import("../types").MarketCollateral | undefined;
|
|
@@ -302,6 +303,7 @@ export declare class ScallopQuery {
|
|
|
302
303
|
usdc?: import("../types").BorrowIncentivePool | undefined;
|
|
303
304
|
sbeth?: import("../types").BorrowIncentivePool | undefined;
|
|
304
305
|
sbusdt?: import("../types").BorrowIncentivePool | undefined;
|
|
306
|
+
sbwbtc?: import("../types").BorrowIncentivePool | undefined;
|
|
305
307
|
weth?: import("../types").BorrowIncentivePool | undefined;
|
|
306
308
|
wbtc?: import("../types").BorrowIncentivePool | undefined;
|
|
307
309
|
wusdc?: import("../types").BorrowIncentivePool | undefined;
|
|
@@ -330,6 +332,7 @@ export declare class ScallopQuery {
|
|
|
330
332
|
usdc?: import("../types").ParsedBorrowIncentiveAccountData | undefined;
|
|
331
333
|
sbeth?: import("../types").ParsedBorrowIncentiveAccountData | undefined;
|
|
332
334
|
sbusdt?: import("../types").ParsedBorrowIncentiveAccountData | undefined;
|
|
335
|
+
sbwbtc?: import("../types").ParsedBorrowIncentiveAccountData | undefined;
|
|
333
336
|
weth?: import("../types").ParsedBorrowIncentiveAccountData | undefined;
|
|
334
337
|
wbtc?: import("../types").ParsedBorrowIncentiveAccountData | undefined;
|
|
335
338
|
wusdc?: import("../types").ParsedBorrowIncentiveAccountData | undefined;
|
|
@@ -363,6 +366,7 @@ export declare class ScallopQuery {
|
|
|
363
366
|
usdc?: import("../types").Lending | undefined;
|
|
364
367
|
sbeth?: import("../types").Lending | undefined;
|
|
365
368
|
sbusdt?: import("../types").Lending | undefined;
|
|
369
|
+
sbwbtc?: import("../types").Lending | undefined;
|
|
366
370
|
weth?: import("../types").Lending | undefined;
|
|
367
371
|
wbtc?: import("../types").Lending | undefined;
|
|
368
372
|
wusdc?: import("../types").Lending | undefined;
|
|
@@ -494,7 +498,7 @@ export declare class ScallopQuery {
|
|
|
494
498
|
* @param ownerAddress - The owner address.
|
|
495
499
|
* @return All market sCoin amounts.
|
|
496
500
|
*/
|
|
497
|
-
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" | "sblub", number>>>;
|
|
501
|
+
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>>>;
|
|
498
502
|
/**
|
|
499
503
|
* Get sCoin amount.
|
|
500
504
|
*
|
|
@@ -509,7 +513,7 @@ export declare class ScallopQuery {
|
|
|
509
513
|
* @returns
|
|
510
514
|
*/
|
|
511
515
|
getSCoinSwapRate(fromSCoin: SupportSCoin, toSCoin: SupportSCoin): Promise<number>;
|
|
512
|
-
getFlashLoanFees(assetCoinNames?: SupportAssetCoins[]): Promise<Record<"usdc" | "sbeth" | "sbusdt" | "weth" | "wbtc" | "wusdc" | "wusdt" | "sui" | "wapt" | "wsol" | "cetus" | "afsui" | "hasui" | "vsui" | "sca" | "fud" | "deep" | "fdusd" | "blub", number>>;
|
|
516
|
+
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>>;
|
|
513
517
|
/**
|
|
514
518
|
* Get supply limit of lending pool
|
|
515
519
|
*/
|
|
@@ -532,11 +536,6 @@ export declare class ScallopQuery {
|
|
|
532
536
|
* @returns price data
|
|
533
537
|
*/
|
|
534
538
|
getCoinPriceByIndexer(poolName: SupportPoolCoins): Promise<number>;
|
|
535
|
-
/**
|
|
536
|
-
* Get all supported pool price from indexer
|
|
537
|
-
* @returns prices data
|
|
538
|
-
*/
|
|
539
|
-
getCoinPricesByIndexer(): Promise<Record<string, number>>;
|
|
540
539
|
/**
|
|
541
540
|
* Get all coin prices, including sCoin
|
|
542
541
|
* @returns prices data
|
|
@@ -544,11 +543,11 @@ export declare class ScallopQuery {
|
|
|
544
543
|
getAllCoinPrices(args?: {
|
|
545
544
|
marketPools?: MarketPools;
|
|
546
545
|
coinPrices?: CoinPrices;
|
|
547
|
-
indexer?: boolean;
|
|
548
546
|
}): Promise<{
|
|
549
547
|
susdc?: number | undefined;
|
|
550
548
|
ssbeth?: number | undefined;
|
|
551
549
|
ssbusdt?: number | undefined;
|
|
550
|
+
ssbwbtc?: number | undefined;
|
|
552
551
|
sweth?: number | undefined;
|
|
553
552
|
swbtc?: number | undefined;
|
|
554
553
|
swusdc?: number | undefined;
|
|
@@ -567,6 +566,7 @@ export declare class ScallopQuery {
|
|
|
567
566
|
usdc?: number | undefined;
|
|
568
567
|
sbeth?: number | undefined;
|
|
569
568
|
sbusdt?: number | undefined;
|
|
569
|
+
sbwbtc?: number | undefined;
|
|
570
570
|
weth?: number | undefined;
|
|
571
571
|
wbtc?: number | undefined;
|
|
572
572
|
wusdc?: number | undefined;
|
|
@@ -589,7 +589,7 @@ export declare class ScallopQuery {
|
|
|
589
589
|
* Query all address (lending pool, collateral pool, borrow dynamics, interest models, etc.) of all pool
|
|
590
590
|
* @returns
|
|
591
591
|
*/
|
|
592
|
-
getPoolAddresses(): Promise<import("../types").OptionalKeys<Record<"usdc" | "sbeth" | "sbusdt" | "weth" | "wbtc" | "wusdc" | "wusdt" | "sui" | "wapt" | "wsol" | "cetus" | "afsui" | "hasui" | "vsui" | "sca" | "fud" | "deep" | "fdusd" | "blub", {
|
|
592
|
+
getPoolAddresses(): 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", {
|
|
593
593
|
coinName: string;
|
|
594
594
|
symbol: string;
|
|
595
595
|
lendingPoolAddress?: string;
|
|
@@ -628,7 +628,7 @@ export declare class ScallopQuery {
|
|
|
628
628
|
suppliedCoin: number;
|
|
629
629
|
suppliedValue: number;
|
|
630
630
|
stakedCoin: number;
|
|
631
|
-
coinName: "usdc" | "sbeth" | "sbusdt" | "weth" | "wbtc" | "wusdc" | "wusdt" | "sui" | "wapt" | "wsol" | "cetus" | "afsui" | "hasui" | "vsui" | "sca" | "fud" | "deep" | "fdusd" | "blub";
|
|
631
|
+
coinName: "usdc" | "sbeth" | "sbusdt" | "sbwbtc" | "weth" | "wbtc" | "wusdc" | "wusdt" | "sui" | "wapt" | "wsol" | "cetus" | "afsui" | "hasui" | "vsui" | "sca" | "fud" | "deep" | "fdusd" | "blub";
|
|
632
632
|
symbol: string;
|
|
633
633
|
coinType: string;
|
|
634
634
|
coinPrice: number;
|
|
@@ -645,7 +645,7 @@ export declare class ScallopQuery {
|
|
|
645
645
|
availableCollateralInUsd: number;
|
|
646
646
|
totalUnhealthyCollateralInUsd: number;
|
|
647
647
|
borrowedPools: {
|
|
648
|
-
coinName: "usdc" | "sbeth" | "sbusdt" | "weth" | "wbtc" | "wusdc" | "wusdt" | "sui" | "wapt" | "wsol" | "cetus" | "afsui" | "hasui" | "vsui" | "sca" | "fud" | "deep" | "fdusd" | "blub";
|
|
648
|
+
coinName: "usdc" | "sbeth" | "sbusdt" | "sbwbtc" | "weth" | "wbtc" | "wusdc" | "wusdt" | "sui" | "wapt" | "wsol" | "cetus" | "afsui" | "hasui" | "vsui" | "sca" | "fud" | "deep" | "fdusd" | "blub";
|
|
649
649
|
symbol: string;
|
|
650
650
|
coinDecimals: number;
|
|
651
651
|
coinType: string;
|
|
@@ -655,7 +655,7 @@ export declare class ScallopQuery {
|
|
|
655
655
|
borrowApr: number | undefined;
|
|
656
656
|
borrowApy: number | undefined;
|
|
657
657
|
incentiveInfos: {
|
|
658
|
-
coinName: "usdc" | "sbeth" | "sbusdt" | "weth" | "wbtc" | "wusdc" | "wusdt" | "sui" | "wapt" | "wsol" | "cetus" | "afsui" | "hasui" | "vsui" | "sca" | "fud" | "deep" | "fdusd" | "blub" | "susdc" | "ssbeth" | "ssbusdt" | "sweth" | "swbtc" | "swusdc" | "swusdt" | "ssui" | "swsol" | "scetus" | "safsui" | "shasui" | "svsui" | "ssca" | "sfud" | "sdeep" | "sfdusd" | "sblub";
|
|
658
|
+
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";
|
|
659
659
|
symbol: string;
|
|
660
660
|
coinType: string;
|
|
661
661
|
incentiveApr: number;
|
|
@@ -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" | "sweth" | "swbtc" | "swusdc" | "swusdt" | "ssui" | "swsol" | "scetus" | "safsui" | "shasui" | "svsui" | "ssca" | "sfud" | "sdeep" | "sfdusd" | "sblub";
|
|
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" | "sweth" | "swbtc" | "swusdc" | "swusdt" | "ssui" | "swsol" | "scetus" | "safsui" | "shasui" | "svsui" | "ssca" | "sfud" | "sdeep" | "sfdusd" | "sblub";
|
|
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
|
|
@@ -19,6 +19,7 @@ export declare const getBorrowIncentivePools: (query: ScallopQuery, borrowIncent
|
|
|
19
19
|
usdc?: BorrowIncentivePool | undefined;
|
|
20
20
|
sbeth?: BorrowIncentivePool | undefined;
|
|
21
21
|
sbusdt?: BorrowIncentivePool | undefined;
|
|
22
|
+
sbwbtc?: BorrowIncentivePool | undefined;
|
|
22
23
|
weth?: BorrowIncentivePool | undefined;
|
|
23
24
|
wbtc?: BorrowIncentivePool | undefined;
|
|
24
25
|
wusdc?: BorrowIncentivePool | undefined;
|
|
@@ -49,6 +50,7 @@ export declare const queryBorrowIncentiveAccounts: ({ utils, }: {
|
|
|
49
50
|
usdc?: import("../types").ParsedBorrowIncentiveAccountData | undefined;
|
|
50
51
|
sbeth?: import("../types").ParsedBorrowIncentiveAccountData | undefined;
|
|
51
52
|
sbusdt?: import("../types").ParsedBorrowIncentiveAccountData | undefined;
|
|
53
|
+
sbwbtc?: import("../types").ParsedBorrowIncentiveAccountData | undefined;
|
|
52
54
|
weth?: import("../types").ParsedBorrowIncentiveAccountData | undefined;
|
|
53
55
|
wbtc?: import("../types").ParsedBorrowIncentiveAccountData | undefined;
|
|
54
56
|
wusdc?: import("../types").ParsedBorrowIncentiveAccountData | undefined;
|
|
@@ -69,6 +69,7 @@ export declare const getMarketCollaterals: (query: ScallopQuery, collateralCoinN
|
|
|
69
69
|
usdc?: MarketCollateral | undefined;
|
|
70
70
|
sbeth?: MarketCollateral | undefined;
|
|
71
71
|
sbusdt?: MarketCollateral | undefined;
|
|
72
|
+
sbwbtc?: MarketCollateral | undefined;
|
|
72
73
|
weth?: MarketCollateral | undefined;
|
|
73
74
|
wbtc?: MarketCollateral | undefined;
|
|
74
75
|
wusdc?: MarketCollateral | undefined;
|
|
@@ -1,6 +1,6 @@
|
|
|
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" | "sbusdt" | "weth" | "wbtc" | "wusdc" | "wusdt" | "sui" | "wapt" | "wsol" | "cetus" | "afsui" | "hasui" | "vsui" | "sca" | "fud" | "deep" | "fdusd" | "blub", {
|
|
3
|
+
export declare const getAllAddresses: (query: ScallopQuery) => 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;
|
|
@@ -14,6 +14,7 @@ export declare const getLendings: (query: ScallopQuery, poolCoinNames?: SupportP
|
|
|
14
14
|
usdc?: Lending | undefined;
|
|
15
15
|
sbeth?: Lending | undefined;
|
|
16
16
|
sbusdt?: Lending | undefined;
|
|
17
|
+
sbwbtc?: Lending | undefined;
|
|
17
18
|
weth?: Lending | undefined;
|
|
18
19
|
wbtc?: Lending | undefined;
|
|
19
20
|
wusdc?: Lending | undefined;
|
|
@@ -89,7 +90,7 @@ export declare const getUserPortfolio: (query: ScallopQuery, walletAddress: stri
|
|
|
89
90
|
suppliedCoin: number;
|
|
90
91
|
suppliedValue: number;
|
|
91
92
|
stakedCoin: number;
|
|
92
|
-
coinName: "usdc" | "sbeth" | "sbusdt" | "weth" | "wbtc" | "wusdc" | "wusdt" | "sui" | "wapt" | "wsol" | "cetus" | "afsui" | "hasui" | "vsui" | "sca" | "fud" | "deep" | "fdusd" | "blub";
|
|
93
|
+
coinName: "usdc" | "sbeth" | "sbusdt" | "sbwbtc" | "weth" | "wbtc" | "wusdc" | "wusdt" | "sui" | "wapt" | "wsol" | "cetus" | "afsui" | "hasui" | "vsui" | "sca" | "fud" | "deep" | "fdusd" | "blub";
|
|
93
94
|
symbol: string;
|
|
94
95
|
coinType: string;
|
|
95
96
|
coinPrice: number;
|
|
@@ -106,7 +107,7 @@ export declare const getUserPortfolio: (query: ScallopQuery, walletAddress: stri
|
|
|
106
107
|
availableCollateralInUsd: number;
|
|
107
108
|
totalUnhealthyCollateralInUsd: number;
|
|
108
109
|
borrowedPools: {
|
|
109
|
-
coinName: "usdc" | "sbeth" | "sbusdt" | "weth" | "wbtc" | "wusdc" | "wusdt" | "sui" | "wapt" | "wsol" | "cetus" | "afsui" | "hasui" | "vsui" | "sca" | "fud" | "deep" | "fdusd" | "blub";
|
|
110
|
+
coinName: "usdc" | "sbeth" | "sbusdt" | "sbwbtc" | "weth" | "wbtc" | "wusdc" | "wusdt" | "sui" | "wapt" | "wsol" | "cetus" | "afsui" | "hasui" | "vsui" | "sca" | "fud" | "deep" | "fdusd" | "blub";
|
|
110
111
|
symbol: string;
|
|
111
112
|
coinDecimals: number;
|
|
112
113
|
coinType: string;
|
|
@@ -116,7 +117,7 @@ export declare const getUserPortfolio: (query: ScallopQuery, walletAddress: stri
|
|
|
116
117
|
borrowApr: number | undefined;
|
|
117
118
|
borrowApy: number | undefined;
|
|
118
119
|
incentiveInfos: {
|
|
119
|
-
coinName: "usdc" | "sbeth" | "sbusdt" | "weth" | "wbtc" | "wusdc" | "wusdt" | "sui" | "wapt" | "wsol" | "cetus" | "afsui" | "hasui" | "vsui" | "sca" | "fud" | "deep" | "fdusd" | "blub" | "susdc" | "ssbeth" | "ssbusdt" | "sweth" | "swbtc" | "swusdc" | "swusdt" | "ssui" | "swsol" | "scetus" | "safsui" | "shasui" | "svsui" | "ssca" | "sfud" | "sdeep" | "sfdusd" | "sblub";
|
|
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";
|
|
120
121
|
symbol: string;
|
|
121
122
|
coinType: string;
|
|
122
123
|
incentiveApr: number;
|
|
@@ -14,10 +14,11 @@ 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
|
|
17
|
+
export declare const getAllCoinPrices: (query: ScallopQuery, marketPools?: MarketPools, coinPrices?: CoinPrices) => Promise<{
|
|
18
18
|
susdc?: number | undefined;
|
|
19
19
|
ssbeth?: number | undefined;
|
|
20
20
|
ssbusdt?: number | undefined;
|
|
21
|
+
ssbwbtc?: number | undefined;
|
|
21
22
|
sweth?: number | undefined;
|
|
22
23
|
swbtc?: number | undefined;
|
|
23
24
|
swusdc?: number | undefined;
|
|
@@ -36,6 +37,7 @@ export declare const getAllCoinPrices: (query: ScallopQuery, marketPools?: Marke
|
|
|
36
37
|
usdc?: number | undefined;
|
|
37
38
|
sbeth?: number | undefined;
|
|
38
39
|
sbusdt?: number | undefined;
|
|
40
|
+
sbwbtc?: number | undefined;
|
|
39
41
|
weth?: number | undefined;
|
|
40
42
|
wbtc?: number | undefined;
|
|
41
43
|
wusdc?: number | undefined;
|
|
@@ -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" | "sweth" | "swbtc" | "swusdc" | "swusdt" | "ssui" | "swsol" | "scetus" | "safsui" | "shasui" | "svsui" | "ssca" | "sfud" | "sdeep" | "sfdusd" | "sblub", 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
|
*
|
package/package.json
CHANGED
package/src/constants/common.ts
CHANGED
|
@@ -33,6 +33,7 @@ export const SUPPORT_POOLS = [
|
|
|
33
33
|
'usdc', // native USDC
|
|
34
34
|
'sbeth', // sui bridge ETH
|
|
35
35
|
'sbusdt', // sui bridge USDT
|
|
36
|
+
'sbwbtc', // sui bridge WBTC
|
|
36
37
|
'weth',
|
|
37
38
|
'wbtc',
|
|
38
39
|
'wusdc',
|
|
@@ -55,6 +56,7 @@ export const SUPPORT_COLLATERALS = [
|
|
|
55
56
|
'usdc', // native USDC
|
|
56
57
|
'sbeth', // sui bridge ETH
|
|
57
58
|
'sbusdt', // sui bridge USDT
|
|
59
|
+
'sbwbtc', // sui bridge WBTC
|
|
58
60
|
'weth',
|
|
59
61
|
'wbtc',
|
|
60
62
|
'wusdc',
|
|
@@ -86,6 +88,7 @@ export const SUPPORT_SCOIN = [
|
|
|
86
88
|
'susdc',
|
|
87
89
|
'ssbeth',
|
|
88
90
|
'ssbusdt',
|
|
91
|
+
'ssbwbtc',
|
|
89
92
|
'ssui',
|
|
90
93
|
'swusdc',
|
|
91
94
|
'swusdt',
|
|
@@ -103,7 +106,7 @@ export const SUPPORT_SCOIN = [
|
|
|
103
106
|
'sblub',
|
|
104
107
|
] as const;
|
|
105
108
|
|
|
106
|
-
export const SUPPORT_SUI_BRIDGE = ['sbeth', 'sbusdt'] as const;
|
|
109
|
+
export const SUPPORT_SUI_BRIDGE = ['sbeth', 'sbusdt', 'sbwbtc'] as const;
|
|
107
110
|
export const SUPPORT_WORMHOLE = [
|
|
108
111
|
'wusdc',
|
|
109
112
|
'wusdt',
|
package/src/constants/enum.ts
CHANGED
|
@@ -5,6 +5,7 @@ export const coinDecimals: types.SupportCoinDecimals = {
|
|
|
5
5
|
usdc: 6,
|
|
6
6
|
sbeth: 8,
|
|
7
7
|
sbusdt: 6,
|
|
8
|
+
sbwbtc: 8,
|
|
8
9
|
weth: 8,
|
|
9
10
|
wbtc: 8,
|
|
10
11
|
wusdc: 6,
|
|
@@ -25,6 +26,7 @@ export const coinDecimals: types.SupportCoinDecimals = {
|
|
|
25
26
|
sweth: 8,
|
|
26
27
|
ssbeth: 8,
|
|
27
28
|
ssbusdt: 6,
|
|
29
|
+
ssbwbtc: 8,
|
|
28
30
|
swbtc: 8,
|
|
29
31
|
swusdc: 6,
|
|
30
32
|
swusdt: 6,
|
|
@@ -46,6 +48,7 @@ export const assetCoins: types.AssetCoins = {
|
|
|
46
48
|
usdc: 'usdc',
|
|
47
49
|
sbeth: 'sbeth',
|
|
48
50
|
sbusdt: 'sbusdt',
|
|
51
|
+
sbwbtc: 'sbwbtc',
|
|
49
52
|
weth: 'weth',
|
|
50
53
|
wbtc: 'wbtc',
|
|
51
54
|
wusdc: 'wusdc',
|
|
@@ -68,6 +71,7 @@ export const marketCoins: types.MarketCoins = {
|
|
|
68
71
|
susdc: 'susdc',
|
|
69
72
|
ssbeth: 'ssbeth',
|
|
70
73
|
ssbusdt: 'ssbusdt',
|
|
74
|
+
ssbwbtc: 'ssbwbtc',
|
|
71
75
|
sweth: 'sweth',
|
|
72
76
|
swbtc: 'swbtc',
|
|
73
77
|
swusdc: 'swusdc',
|
|
@@ -93,6 +97,7 @@ export const sCoins: types.SCoins = {
|
|
|
93
97
|
sweth: 'sweth',
|
|
94
98
|
swusdc: 'swusdc',
|
|
95
99
|
swusdt: 'swusdt',
|
|
100
|
+
ssbwbtc: 'ssbwbtc',
|
|
96
101
|
ssui: 'ssui',
|
|
97
102
|
scetus: 'scetus',
|
|
98
103
|
safsui: 'safsui',
|
|
@@ -134,6 +139,7 @@ export const spoolRewardCoins: types.StakeRewardCoins = {
|
|
|
134
139
|
export const suiBridgeCoins: types.SuiBridgeCoins = {
|
|
135
140
|
sbeth: 'sbeth',
|
|
136
141
|
sbusdt: 'sbusdt',
|
|
142
|
+
sbwbtc: 'sbwbtc',
|
|
137
143
|
};
|
|
138
144
|
|
|
139
145
|
export const coinIds: types.AssetCoinIds = {
|
|
@@ -163,6 +169,7 @@ export const coinIds: types.AssetCoinIds = {
|
|
|
163
169
|
// Sui bridge assets
|
|
164
170
|
sbeth: '0xd0e89b2af5e4910726fbcd8b8dd37bb79b29e5f83f7491bca830e94f7f226d29',
|
|
165
171
|
sbusdt: '0x375f70cf2ae4c00bf37117d0c85a2c71545e6ee05c4a5c7d282cd66a4504b068',
|
|
172
|
+
sbwbtc: '0xaafb102dd0902f5055cadecd687fb5b71ca82ef0e0285d90afde828ec58ca96b',
|
|
166
173
|
};
|
|
167
174
|
|
|
168
175
|
export const wormholeCoinIds: types.WormholeCoinIds = {
|
|
@@ -218,6 +225,8 @@ export const sCoinIds: types.SCoinIds = {
|
|
|
218
225
|
'0xb14f82d8506d139eacef109688d1b71e7236bcce9b2c0ad526abcd6aa5be7de0::scallop_sb_eth::SCALLOP_SB_ETH',
|
|
219
226
|
ssbusdt:
|
|
220
227
|
'0xb1d7df34829d1513b73ba17cb7ad90c88d1e104bb65ab8f62f13e0cc103783d3::scallop_sb_usdt::SCALLOP_SB_USDT',
|
|
228
|
+
ssbwbtc:
|
|
229
|
+
'0x08c0fe357d3a138f4552bee393ce3a28a45bebcca43373d6a90bc44ab76f82e2::scallop_sb_wbtc::SCALLOP_SB_WBTC',
|
|
221
230
|
} as const;
|
|
222
231
|
|
|
223
232
|
export const sCoinTypeToName = Object.entries(sCoinIds).reduce(
|
|
@@ -106,6 +106,43 @@ export const POOL_ADDRESSES: OptionalKeys<
|
|
|
106
106
|
pythFeedObjectId:
|
|
107
107
|
'0x985e3db9f93f76ee8bace7c3dd5cc676a096accd5d9e09e9ae0fb6e492b14572',
|
|
108
108
|
},
|
|
109
|
+
sbwbtc: {
|
|
110
|
+
coinName: 'sbwbtc',
|
|
111
|
+
symbol: 'sbwBTC',
|
|
112
|
+
lendingPoolAddress:
|
|
113
|
+
'0x5c4fc366c39e0969ddb8912da221cbf298656466f3b58039ff82c5ce64071ad8',
|
|
114
|
+
collateralPoolAddress:
|
|
115
|
+
'0x85fb30d16d66f08e8bc8013665b786d5ca04652015c5ac7461cee51c54d7d507',
|
|
116
|
+
borrowDynamic:
|
|
117
|
+
'0x1e25ebd25b6e1d4c765ff3172472ae21903e7f237b3efe1f6f011c93fef9f634',
|
|
118
|
+
interestModel:
|
|
119
|
+
'0x5f7bff8aa04cc6790a88c51014d5b6feadf6441e4c40a496d67705c2856183b3',
|
|
120
|
+
riskModel:
|
|
121
|
+
'0xb62fb27d5f1305ed94092ff4fd7015a71420bd2b47542599d361a1e8b88c46ad',
|
|
122
|
+
borrowFeeKey:
|
|
123
|
+
'0x4ede8076a8d83315c49df8db9e6774d55ba149fcfb4a7a38845cd76c34f590d1',
|
|
124
|
+
supplyLimitKey:
|
|
125
|
+
'0x4f5dfd04f32cc7ba8fba665486838fd3a291324980460d31bf79918a6b68a112',
|
|
126
|
+
sCoinTreasury:
|
|
127
|
+
'0x21db1d3b310d32b5fb1383591103bfea57c6aed62ef6d3b6d469bab752b8681f',
|
|
128
|
+
borrowLimitKey:
|
|
129
|
+
'0xc32b0a82ae08248912c39da03c1b347bcfbc7b63da0385e24306c4b97777da56',
|
|
130
|
+
sCoinType:
|
|
131
|
+
'0x08c0fe357d3a138f4552bee393ce3a28a45bebcca43373d6a90bc44ab76f82e2::scallop_sb_wbtc::SCALLOP_SB_WBTC',
|
|
132
|
+
sCoinName: 'ssbwbtc',
|
|
133
|
+
sCoinSymbol: 'ssbwBTC',
|
|
134
|
+
coinMetadataId:
|
|
135
|
+
'0x53e1cae1ad70a778d0b450d36c7c2553314ca029919005aad26945d65a8fb784',
|
|
136
|
+
coinType:
|
|
137
|
+
'0xaafb102dd0902f5055cadecd687fb5b71ca82ef0e0285d90afde828ec58ca96b::btc::BTC',
|
|
138
|
+
sCoinMetadataId:
|
|
139
|
+
'0x83d3d44ca57f9b1657065865caa497188d6fc1429f0ca846a51a9058f066f591',
|
|
140
|
+
decimals: 8,
|
|
141
|
+
pythFeed:
|
|
142
|
+
'e62df6c8b4a85fe1a67db44dc12de5db330f7ac66b72dc658afedf0f4a415b43',
|
|
143
|
+
pythFeedObjectId:
|
|
144
|
+
'0x9a62b4863bdeaabdc9500fce769cf7e72d5585eeb28a6d26e4cafadc13f76ab2',
|
|
145
|
+
},
|
|
109
146
|
usdc: {
|
|
110
147
|
coinName: 'usdc',
|
|
111
148
|
symbol: 'USDC',
|
package/src/constants/pyth.ts
CHANGED
|
@@ -11,6 +11,7 @@ export const PYTH_FEED_IDS: Record<SupportPoolCoins, string> = {
|
|
|
11
11
|
usdc: 'eaa020c61cc479712813461ce153894a96a6c00b21ed0cfc2798d1f9a9e9c94a',
|
|
12
12
|
sbeth: 'ff61491a931112ddf1bd8147cd1b641375f79f5825126d665480874634fd0ace',
|
|
13
13
|
sbusdt: '2b89b9dc8fdf9f34709a5b106b472f0f39bb6ca9ce04b0fd7f2e971688e2e53b',
|
|
14
|
+
sbwbtc: 'e62df6c8b4a85fe1a67db44dc12de5db330f7ac66b72dc658afedf0f4a415b43',
|
|
14
15
|
weth: 'ff61491a931112ddf1bd8147cd1b641375f79f5825126d665480874634fd0ace',
|
|
15
16
|
wbtc: 'e62df6c8b4a85fe1a67db44dc12de5db330f7ac66b72dc658afedf0f4a415b43',
|
|
16
17
|
wusdc: 'eaa020c61cc479712813461ce153894a96a6c00b21ed0cfc2798d1f9a9e9c94a',
|
|
@@ -239,6 +239,10 @@ export const TEST_ADDRESSES: AddressesInterface = {
|
|
|
239
239
|
// @TODO: add test address
|
|
240
240
|
// @ts-ignore
|
|
241
241
|
sbusdt: {},
|
|
242
|
+
// @ts-ignore
|
|
243
|
+
sbwbtc: {},
|
|
244
|
+
// @ts-ignore
|
|
245
|
+
blub: {},
|
|
242
246
|
fdusd: {
|
|
243
247
|
id: '0xf16e6b723f242ec745dfd7634ad072c42d5c1d9ac9d62a39c381303eaa57693a',
|
|
244
248
|
metaData:
|
|
@@ -269,15 +269,4 @@ export class ScallopIndexer {
|
|
|
269
269
|
public async getCoinPrice(poolCoinName: SupportPoolCoins): Promise<number> {
|
|
270
270
|
return (await this.getMarketPool(poolCoinName))?.coinPrice ?? 0;
|
|
271
271
|
}
|
|
272
|
-
|
|
273
|
-
public async getCoinPrices(): Promise<Record<string, number>> {
|
|
274
|
-
const marketPools = await this.getMarketPools();
|
|
275
|
-
return Object.entries(marketPools).reduce(
|
|
276
|
-
(prev, [coinName, market]) => {
|
|
277
|
-
prev[coinName] = market.coinPrice;
|
|
278
|
-
return prev;
|
|
279
|
-
},
|
|
280
|
-
{} as Record<string, number>
|
|
281
|
-
);
|
|
282
|
-
}
|
|
283
272
|
}
|
|
@@ -851,14 +851,6 @@ export class ScallopQuery {
|
|
|
851
851
|
return this.indexer.getCoinPrice(poolName);
|
|
852
852
|
}
|
|
853
853
|
|
|
854
|
-
/**
|
|
855
|
-
* Get all supported pool price from indexer
|
|
856
|
-
* @returns prices data
|
|
857
|
-
*/
|
|
858
|
-
public async getCoinPricesByIndexer() {
|
|
859
|
-
return this.indexer.getCoinPrices();
|
|
860
|
-
}
|
|
861
|
-
|
|
862
854
|
/**
|
|
863
855
|
* Get all coin prices, including sCoin
|
|
864
856
|
* @returns prices data
|
|
@@ -866,14 +858,8 @@ export class ScallopQuery {
|
|
|
866
858
|
public async getAllCoinPrices(args?: {
|
|
867
859
|
marketPools?: MarketPools;
|
|
868
860
|
coinPrices?: CoinPrices;
|
|
869
|
-
indexer?: boolean;
|
|
870
861
|
}) {
|
|
871
|
-
return getAllCoinPrices(
|
|
872
|
-
this,
|
|
873
|
-
args?.marketPools,
|
|
874
|
-
args?.coinPrices,
|
|
875
|
-
args?.indexer
|
|
876
|
-
);
|
|
862
|
+
return getAllCoinPrices(this, args?.marketPools, args?.coinPrices);
|
|
877
863
|
}
|
|
878
864
|
|
|
879
865
|
/**
|
|
@@ -172,6 +172,8 @@ export class ScallopUtils {
|
|
|
172
172
|
return normalizeStructTag(`${coinPackageId}::sui::SUI`);
|
|
173
173
|
if (coinName === 'blub')
|
|
174
174
|
return normalizeStructTag(`${coinPackageId}::BLUB::BLUB`);
|
|
175
|
+
if (coinName === 'sbwbtc')
|
|
176
|
+
return normalizeStructTag(`${coinPackageId}::btc::BTC`);
|
|
175
177
|
|
|
176
178
|
const wormHolePackageIds = [
|
|
177
179
|
this.address.get('core.coins.wusdc.id') ?? wormholeCoinIds.wusdc,
|
|
@@ -133,23 +133,16 @@ export const getPythPrices = async (
|
|
|
133
133
|
export const getAllCoinPrices = async (
|
|
134
134
|
query: ScallopQuery,
|
|
135
135
|
marketPools?: MarketPools,
|
|
136
|
-
coinPrices?: CoinPrices
|
|
137
|
-
indexer: boolean = false
|
|
136
|
+
coinPrices?: CoinPrices
|
|
138
137
|
) => {
|
|
139
|
-
coinPrices =
|
|
140
|
-
coinPrices ??
|
|
141
|
-
(indexer
|
|
142
|
-
? await query.getCoinPricesByIndexer()
|
|
143
|
-
: await query.utils.getCoinPrices());
|
|
144
|
-
|
|
138
|
+
coinPrices = coinPrices ?? (await query.utils.getCoinPrices());
|
|
145
139
|
marketPools =
|
|
146
140
|
marketPools ??
|
|
147
|
-
(await query.getMarketPools(undefined, { coinPrices
|
|
141
|
+
(await query.getMarketPools(undefined, { coinPrices })).pools;
|
|
148
142
|
|
|
149
143
|
if (!marketPools) {
|
|
150
144
|
throw new Error(`Failed to fetch market pool for getAllCoinPrices`);
|
|
151
145
|
}
|
|
152
|
-
|
|
153
146
|
const sCoinPrices: OptionalKeys<Record<SupportSCoin, number>> = {};
|
|
154
147
|
SUPPORT_SCOIN.forEach((sCoinName) => {
|
|
155
148
|
const coinName = query.utils.parseCoinName(sCoinName);
|