@scallop-io/sui-scallop-sdk 1.3.4-isolated-asset.2 → 1.3.5-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.
- package/dist/constants/common.d.ts +3 -3
- package/dist/constants/enum.d.ts +1 -0
- package/dist/constants/tokenBucket.d.ts +1 -1
- package/dist/index.js +162 -93
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +161 -93
- package/dist/index.mjs.map +1 -1
- package/dist/models/scallopQuery.d.ts +40 -6
- package/dist/models/scallopUtils.d.ts +9 -2
- package/dist/queries/borrowIncentiveQuery.d.ts +2 -2
- package/dist/queries/coreQuery.d.ts +0 -2
- package/dist/queries/portfolioQuery.d.ts +0 -2
- package/dist/queries/priceQuery.d.ts +32 -2
- package/dist/types/constant/common.d.ts +1 -1
- package/dist/types/utils.d.ts +2 -6
- package/package.json +1 -1
- package/src/constants/coinGecko.ts +3 -2
- package/src/constants/common.ts +12 -4
- package/src/constants/enum.ts +58 -51
- package/src/constants/poolAddress.ts +10 -7
- package/src/constants/pyth.ts +3 -2
- package/src/constants/tokenBucket.ts +1 -1
- package/src/models/scallopQuery.ts +14 -1
- package/src/models/scallopUtils.ts +14 -2
- package/src/queries/borrowIncentiveQuery.ts +30 -12
- package/src/queries/borrowLimitQuery.ts +2 -2
- package/src/queries/coreQuery.ts +4 -9
- package/src/queries/isolatedAssetQuery.ts +2 -2
- package/src/queries/portfolioQuery.ts +3 -6
- package/src/queries/priceQuery.ts +42 -6
- package/src/queries/sCoinQuery.ts +1 -1
- package/src/queries/spoolQuery.ts +2 -4
- package/src/queries/supplyLimitQuery.ts +2 -2
- package/src/types/constant/common.ts +1 -2
- package/src/types/utils.ts +2 -10
- package/src/utils/query.ts +0 -87
|
@@ -69,8 +69,6 @@ export declare class ScallopQuery {
|
|
|
69
69
|
hasui?: MarketPool | undefined;
|
|
70
70
|
vsui?: MarketPool | undefined;
|
|
71
71
|
sca?: MarketPool | undefined;
|
|
72
|
-
fud?: MarketPool | undefined;
|
|
73
|
-
deep?: MarketPool | undefined;
|
|
74
72
|
}>;
|
|
75
73
|
/**
|
|
76
74
|
* Get market pool
|
|
@@ -297,7 +295,8 @@ export declare class ScallopQuery {
|
|
|
297
295
|
* @return Borrow incentive pools data.
|
|
298
296
|
*/
|
|
299
297
|
getBorrowIncentivePools(coinNames?: SupportBorrowIncentiveCoins[], indexer?: boolean, args?: {
|
|
300
|
-
|
|
298
|
+
marketPools?: MarketPools;
|
|
299
|
+
coinPrices?: CoinPrices;
|
|
301
300
|
}): Promise<{
|
|
302
301
|
usdc?: import("../types").BorrowIncentivePool | undefined;
|
|
303
302
|
sbeth?: import("../types").BorrowIncentivePool | undefined;
|
|
@@ -352,8 +351,6 @@ export declare class ScallopQuery {
|
|
|
352
351
|
hasui?: import("../types").Lending | undefined;
|
|
353
352
|
vsui?: import("../types").Lending | undefined;
|
|
354
353
|
sca?: import("../types").Lending | undefined;
|
|
355
|
-
fud?: import("../types").Lending | undefined;
|
|
356
|
-
deep?: import("../types").Lending | undefined;
|
|
357
354
|
}>;
|
|
358
355
|
/**
|
|
359
356
|
* Get user lending and spool information for specific pool.
|
|
@@ -471,7 +468,7 @@ export declare class ScallopQuery {
|
|
|
471
468
|
* @returns
|
|
472
469
|
*/
|
|
473
470
|
getSCoinSwapRate(fromSCoin: SupportSCoin, toSCoin: SupportSCoin): Promise<number>;
|
|
474
|
-
getFlashLoanFees(assetCoinNames?: SupportAssetCoins[]): Promise<Record<"usdc" | "sbeth" | "weth" | "wbtc" | "wusdc" | "wusdt" | "sui" | "wapt" | "wsol" | "cetus" | "afsui" | "hasui" | "vsui" | "sca"
|
|
471
|
+
getFlashLoanFees(assetCoinNames?: SupportAssetCoins[]): Promise<Record<"usdc" | "sbeth" | "weth" | "wbtc" | "wusdc" | "wusdt" | "sui" | "wapt" | "wsol" | "cetus" | "afsui" | "hasui" | "vsui" | "sca", number>>;
|
|
475
472
|
/**
|
|
476
473
|
* Get supply limit of lending pool
|
|
477
474
|
*/
|
|
@@ -494,4 +491,41 @@ export declare class ScallopQuery {
|
|
|
494
491
|
* @returns price data
|
|
495
492
|
*/
|
|
496
493
|
getCoinPriceByIndexer(poolName: SupportPoolCoins): Promise<number>;
|
|
494
|
+
/**
|
|
495
|
+
* Get all coin prices, including sCoin
|
|
496
|
+
* @returns prices data
|
|
497
|
+
*/
|
|
498
|
+
getAllCoinPrices(args?: {
|
|
499
|
+
marketPools?: MarketPools;
|
|
500
|
+
coinPrices?: CoinPrices;
|
|
501
|
+
}): Promise<{
|
|
502
|
+
susdc?: number | undefined;
|
|
503
|
+
ssbeth?: number | undefined;
|
|
504
|
+
sweth?: number | undefined;
|
|
505
|
+
swbtc?: number | undefined;
|
|
506
|
+
swusdc?: number | undefined;
|
|
507
|
+
swusdt?: number | undefined;
|
|
508
|
+
ssui?: number | undefined;
|
|
509
|
+
swsol?: number | undefined;
|
|
510
|
+
scetus?: number | undefined;
|
|
511
|
+
safsui?: number | undefined;
|
|
512
|
+
shasui?: number | undefined;
|
|
513
|
+
svsui?: number | undefined;
|
|
514
|
+
ssca?: number | undefined;
|
|
515
|
+
usdc?: number | undefined;
|
|
516
|
+
sbeth?: number | undefined;
|
|
517
|
+
weth?: number | undefined;
|
|
518
|
+
wbtc?: number | undefined;
|
|
519
|
+
wusdc?: number | undefined;
|
|
520
|
+
wusdt?: number | undefined;
|
|
521
|
+
sui?: number | undefined;
|
|
522
|
+
wapt?: number | undefined;
|
|
523
|
+
wsol?: number | undefined;
|
|
524
|
+
cetus?: number | undefined;
|
|
525
|
+
afsui?: number | undefined;
|
|
526
|
+
hasui?: number | undefined;
|
|
527
|
+
vsui?: number | undefined;
|
|
528
|
+
sca?: number | undefined;
|
|
529
|
+
swapt?: number | undefined;
|
|
530
|
+
}>;
|
|
497
531
|
}
|
|
@@ -58,6 +58,13 @@ export declare class ScallopUtils {
|
|
|
58
58
|
* @return sCoin name.
|
|
59
59
|
*/
|
|
60
60
|
parseSCoinName<T extends SupportSCoin>(coinName: SupportCoins | SupportMarketCoins): T | undefined;
|
|
61
|
+
/**
|
|
62
|
+
* Convert sCoin name to coin name.
|
|
63
|
+
* This function will parse new sCoin name `scallop_...` to its old market coin name which is shorter
|
|
64
|
+
* e.g: `scallop_sui -> ssui
|
|
65
|
+
* @return sCoin name
|
|
66
|
+
*/
|
|
67
|
+
parseCoinNameFromSCoinName(coinName: string): "susdc" | "ssbeth" | "sweth" | "swbtc" | "swusdc" | "swusdt" | "ssui" | "swsol" | "scetus" | "safsui" | "shasui" | "svsui" | "ssca";
|
|
61
68
|
/**
|
|
62
69
|
* Convert sCoin name into sCoin type
|
|
63
70
|
* @param sCoinName
|
|
@@ -130,7 +137,7 @@ export declare class ScallopUtils {
|
|
|
130
137
|
* @param borrowIncentiveCoinName - Support borrow incentive coin.
|
|
131
138
|
* @return Borrow incentive reward coin name.
|
|
132
139
|
*/
|
|
133
|
-
getBorrowIncentiveRewardCoinName: (borrowIncentiveCoinName: SupportBorrowIncentiveCoins) => ("sui" | "sca")[];
|
|
140
|
+
getBorrowIncentiveRewardCoinName: (borrowIncentiveCoinName: SupportBorrowIncentiveCoins) => ("usdc" | "sbeth" | "weth" | "wbtc" | "wusdc" | "wusdt" | "sui" | "wapt" | "wsol" | "cetus" | "afsui" | "hasui" | "vsui" | "sca" | "susdc" | "ssbeth" | "sweth" | "swbtc" | "swusdc" | "swusdt" | "ssui" | "swsol" | "scetus" | "safsui" | "shasui" | "svsui" | "ssca")[];
|
|
134
141
|
/**
|
|
135
142
|
* Get coin decimal.
|
|
136
143
|
*
|
|
@@ -188,7 +195,7 @@ export declare class ScallopUtils {
|
|
|
188
195
|
* @param assetCoinNames - Specific an array of support asset coin name.
|
|
189
196
|
* @return Asset coin price.
|
|
190
197
|
*/
|
|
191
|
-
getCoinPrices(_?: SupportAssetCoins[]): Promise<import("../types").OptionalKeys<Record<
|
|
198
|
+
getCoinPrices(_?: SupportAssetCoins[]): Promise<import("../types").OptionalKeys<Record<SupportCoins, number>>>;
|
|
192
199
|
/**
|
|
193
200
|
* Convert apr to apy.
|
|
194
201
|
*
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ScallopAddress, ScallopQuery, ScallopUtils } from '../models';
|
|
2
|
-
import type { BorrowIncentivePoolsQueryInterface, SupportBorrowIncentiveCoins, BorrowIncentivePool, CoinPrices } from '../types';
|
|
2
|
+
import type { BorrowIncentivePoolsQueryInterface, SupportBorrowIncentiveCoins, BorrowIncentivePool, CoinPrices, MarketPools } from '../types';
|
|
3
3
|
/**
|
|
4
4
|
* Query borrow incentive pools data using moveCall
|
|
5
5
|
* @param address
|
|
@@ -14,7 +14,7 @@ export declare const queryBorrowIncentivePools: (address: ScallopAddress) => Pro
|
|
|
14
14
|
* @param indexer - Whether to use indexer.
|
|
15
15
|
* @return Borrow incentive pools data.
|
|
16
16
|
*/
|
|
17
|
-
export declare const getBorrowIncentivePools: (query: ScallopQuery, borrowIncentiveCoinNames?: SupportBorrowIncentiveCoins[], indexer?: boolean, coinPrices?: CoinPrices) => Promise<{
|
|
17
|
+
export declare const getBorrowIncentivePools: (query: ScallopQuery, borrowIncentiveCoinNames?: SupportBorrowIncentiveCoins[], indexer?: boolean, marketPools?: MarketPools, coinPrices?: CoinPrices) => Promise<{
|
|
18
18
|
usdc?: BorrowIncentivePool | undefined;
|
|
19
19
|
sbeth?: BorrowIncentivePool | undefined;
|
|
20
20
|
weth?: BorrowIncentivePool | undefined;
|
|
@@ -40,8 +40,6 @@ export declare const getMarketPools: (query: ScallopQuery, poolCoinNames?: Suppo
|
|
|
40
40
|
hasui?: MarketPool | undefined;
|
|
41
41
|
vsui?: MarketPool | undefined;
|
|
42
42
|
sca?: MarketPool | undefined;
|
|
43
|
-
fud?: MarketPool | undefined;
|
|
44
|
-
deep?: MarketPool | undefined;
|
|
45
43
|
}>;
|
|
46
44
|
/**
|
|
47
45
|
* Get market pool data.
|
|
@@ -24,8 +24,6 @@ export declare const getLendings: (query: ScallopQuery, poolCoinNames?: SupportP
|
|
|
24
24
|
hasui?: Lending | undefined;
|
|
25
25
|
vsui?: Lending | undefined;
|
|
26
26
|
sca?: Lending | undefined;
|
|
27
|
-
fud?: Lending | undefined;
|
|
28
|
-
deep?: Lending | undefined;
|
|
29
27
|
}>;
|
|
30
28
|
/**
|
|
31
29
|
* Get user lending infomation for specific pool.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { SuiObjectData } from '@mysten/sui/client';
|
|
2
|
-
import type { ScallopAddress } from '../models';
|
|
3
|
-
import type { SupportAssetCoins } from '../types';
|
|
2
|
+
import type { ScallopAddress, ScallopQuery } from '../models';
|
|
3
|
+
import type { CoinPrices, MarketPools, SupportAssetCoins } from '../types';
|
|
4
4
|
/**
|
|
5
5
|
* Get price from pyth fee object.
|
|
6
6
|
*
|
|
@@ -14,3 +14,33 @@ 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<{
|
|
18
|
+
susdc?: number | undefined;
|
|
19
|
+
ssbeth?: number | undefined;
|
|
20
|
+
sweth?: number | undefined;
|
|
21
|
+
swbtc?: number | undefined;
|
|
22
|
+
swusdc?: number | undefined;
|
|
23
|
+
swusdt?: number | undefined;
|
|
24
|
+
ssui?: number | undefined;
|
|
25
|
+
swsol?: number | undefined;
|
|
26
|
+
scetus?: number | undefined;
|
|
27
|
+
safsui?: number | undefined;
|
|
28
|
+
shasui?: number | undefined;
|
|
29
|
+
svsui?: number | undefined;
|
|
30
|
+
ssca?: number | undefined;
|
|
31
|
+
usdc?: number | undefined;
|
|
32
|
+
sbeth?: number | undefined;
|
|
33
|
+
weth?: number | undefined;
|
|
34
|
+
wbtc?: number | undefined;
|
|
35
|
+
wusdc?: number | undefined;
|
|
36
|
+
wusdt?: number | undefined;
|
|
37
|
+
sui?: number | undefined;
|
|
38
|
+
wapt?: number | undefined;
|
|
39
|
+
wsol?: number | undefined;
|
|
40
|
+
cetus?: number | undefined;
|
|
41
|
+
afsui?: number | undefined;
|
|
42
|
+
hasui?: number | undefined;
|
|
43
|
+
vsui?: number | undefined;
|
|
44
|
+
sca?: number | undefined;
|
|
45
|
+
swapt?: number | undefined;
|
|
46
|
+
}>;
|
|
@@ -2,7 +2,7 @@ import { SUPPORT_POOLS, SUPPORT_COLLATERALS, SUPPORT_ORACLES, SUPPORT_PACKAGES,
|
|
|
2
2
|
type ParseMarketCoins<T extends string> = `s${T}`;
|
|
3
3
|
type ParseCoins<T extends string> = T extends `s${infer R}` ? R : never;
|
|
4
4
|
export type SupportCoins = SupportAssetCoins | SupportMarketCoins | SupportStakeMarketCoins | SupportSCoin;
|
|
5
|
-
export type SupportAssetCoins = SupportPoolCoins | SupportCollateralCoins | SupportStakeRewardCoins
|
|
5
|
+
export type SupportAssetCoins = SupportPoolCoins | SupportCollateralCoins | SupportStakeRewardCoins;
|
|
6
6
|
export type SupportPoolCoins = (typeof SUPPORT_POOLS)[number];
|
|
7
7
|
export type SupportCollateralCoins = (typeof SUPPORT_COLLATERALS)[number];
|
|
8
8
|
export type SupportMarketCoins = ParseMarketCoins<SupportPoolCoins> | SupportStakeMarketCoins;
|
package/dist/types/utils.d.ts
CHANGED
|
@@ -1,12 +1,8 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { SupportCoins } from './constant';
|
|
2
2
|
export type OptionalKeys<T> = {
|
|
3
3
|
[K in keyof T]?: T[K];
|
|
4
4
|
};
|
|
5
|
-
export type CoinPrices = OptionalKeys<Record<
|
|
6
|
-
export type PriceMap = Map<SupportAssetCoins, {
|
|
7
|
-
price: number;
|
|
8
|
-
publishTime: number;
|
|
9
|
-
}>;
|
|
5
|
+
export type CoinPrices = OptionalKeys<Record<SupportCoins, number>>;
|
|
10
6
|
export type PoolAddressInfo = {
|
|
11
7
|
name: string;
|
|
12
8
|
coingeckoId: string;
|
package/package.json
CHANGED
package/src/constants/common.ts
CHANGED
|
@@ -7,7 +7,8 @@ export const USE_TEST_ADDRESS: boolean = false;
|
|
|
7
7
|
export const ADDRESSES_ID =
|
|
8
8
|
IS_VE_SCA_TEST || USE_TEST_ADDRESS
|
|
9
9
|
? ('65fb07c39c845425d71d7b18' as const)
|
|
10
|
-
: ('
|
|
10
|
+
: ('675c65cd301dd817ea262e76' as const);
|
|
11
|
+
// : ('66f8e7ed9bb9e07fdfb86bbb' as const);
|
|
11
12
|
// : ('664dfe22898c36c159e28bc8' as const);
|
|
12
13
|
|
|
13
14
|
export const PROTOCOL_OBJECT_ID = IS_VE_SCA_TEST
|
|
@@ -44,8 +45,9 @@ export const SUPPORT_POOLS = [
|
|
|
44
45
|
'hasui',
|
|
45
46
|
'vsui',
|
|
46
47
|
'sca',
|
|
47
|
-
|
|
48
|
-
'
|
|
48
|
+
// TODO: enable for production
|
|
49
|
+
// 'fud',
|
|
50
|
+
// 'deep',
|
|
49
51
|
] as const;
|
|
50
52
|
|
|
51
53
|
export const SUPPORT_COLLATERALS = [
|
|
@@ -91,6 +93,9 @@ export const SUPPORT_SCOIN = [
|
|
|
91
93
|
'scetus',
|
|
92
94
|
'swsol',
|
|
93
95
|
'swbtc',
|
|
96
|
+
// TODO: enable for production
|
|
97
|
+
// 'sdeep',
|
|
98
|
+
// 'sfud',
|
|
94
99
|
] as const;
|
|
95
100
|
|
|
96
101
|
export const SUPPORT_SUI_BRIDGE = ['sbeth'] as const;
|
|
@@ -118,7 +123,10 @@ export const SUPPORT_BORROW_INCENTIVE_POOLS = [
|
|
|
118
123
|
'usdc',
|
|
119
124
|
] as const;
|
|
120
125
|
|
|
121
|
-
export const SUPPORT_BORROW_INCENTIVE_REWARDS = [
|
|
126
|
+
export const SUPPORT_BORROW_INCENTIVE_REWARDS = [
|
|
127
|
+
...SUPPORT_POOLS,
|
|
128
|
+
...SUPPORT_SCOIN,
|
|
129
|
+
] as const;
|
|
122
130
|
export const SUPPORT_ORACLES = ['supra', 'switchboard', 'pyth'] as const;
|
|
123
131
|
|
|
124
132
|
export const SUPPORT_PACKAGES = [
|
package/src/constants/enum.ts
CHANGED
|
@@ -16,8 +16,9 @@ export const coinDecimals: types.SupportCoinDecimals = {
|
|
|
16
16
|
hasui: 9,
|
|
17
17
|
vsui: 9,
|
|
18
18
|
sca: 9,
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
// TODO: enable for production
|
|
20
|
+
// deep: 6,
|
|
21
|
+
// fud: 5,
|
|
21
22
|
susdc: 6,
|
|
22
23
|
sweth: 8,
|
|
23
24
|
ssbeth: 8,
|
|
@@ -32,8 +33,9 @@ export const coinDecimals: types.SupportCoinDecimals = {
|
|
|
32
33
|
shasui: 9,
|
|
33
34
|
svsui: 9,
|
|
34
35
|
ssca: 9,
|
|
35
|
-
|
|
36
|
-
|
|
36
|
+
// TODO: enable for production
|
|
37
|
+
// sdeep: 6,
|
|
38
|
+
// sfud: 5,
|
|
37
39
|
};
|
|
38
40
|
|
|
39
41
|
export const assetCoins: types.AssetCoins = {
|
|
@@ -51,8 +53,9 @@ export const assetCoins: types.AssetCoins = {
|
|
|
51
53
|
hasui: 'hasui',
|
|
52
54
|
vsui: 'vsui',
|
|
53
55
|
sca: 'sca',
|
|
54
|
-
|
|
55
|
-
|
|
56
|
+
// TODO: enable for production
|
|
57
|
+
// deep: 'deep',
|
|
58
|
+
// fud: 'fud',
|
|
56
59
|
};
|
|
57
60
|
|
|
58
61
|
export const marketCoins: types.MarketCoins = {
|
|
@@ -70,8 +73,9 @@ export const marketCoins: types.MarketCoins = {
|
|
|
70
73
|
shasui: 'shasui',
|
|
71
74
|
svsui: 'svsui',
|
|
72
75
|
ssca: 'ssca',
|
|
73
|
-
|
|
74
|
-
|
|
76
|
+
// TODO: enable for production
|
|
77
|
+
// sdeep: 'sdeep',
|
|
78
|
+
// sfud: 'sfud',
|
|
75
79
|
};
|
|
76
80
|
|
|
77
81
|
export const sCoins: types.SCoins = {
|
|
@@ -88,6 +92,9 @@ export const sCoins: types.SCoins = {
|
|
|
88
92
|
ssca: 'ssca',
|
|
89
93
|
swsol: 'swsol',
|
|
90
94
|
swbtc: 'swbtc',
|
|
95
|
+
// TODO: enable for production
|
|
96
|
+
// sfud: 'sfud',
|
|
97
|
+
// sdeep: 'sdeep',
|
|
91
98
|
};
|
|
92
99
|
|
|
93
100
|
export const stakeMarketCoins: types.StakeMarketCoins = {
|
|
@@ -119,16 +126,16 @@ export const suiBridgeCoins: types.SuiBridgeCoins = {
|
|
|
119
126
|
};
|
|
120
127
|
|
|
121
128
|
export const borrowIncentiveRewardCoins: types.BorrowIncentiveRewardCoins = {
|
|
122
|
-
usdc: ['
|
|
123
|
-
sui: ['
|
|
124
|
-
wusdc: ['
|
|
125
|
-
wusdt: ['
|
|
126
|
-
sca: ['
|
|
127
|
-
afsui: ['
|
|
128
|
-
hasui: ['
|
|
129
|
-
vsui: ['
|
|
130
|
-
weth: ['
|
|
131
|
-
sbeth: ['
|
|
129
|
+
usdc: ['ssui', 'ssca'],
|
|
130
|
+
sui: ['ssui', 'ssca'],
|
|
131
|
+
wusdc: ['ssui', 'ssca'],
|
|
132
|
+
wusdt: ['ssui', 'ssca'],
|
|
133
|
+
sca: ['ssui', 'ssca'],
|
|
134
|
+
afsui: ['ssui'],
|
|
135
|
+
hasui: ['ssui'],
|
|
136
|
+
vsui: ['ssui'],
|
|
137
|
+
weth: ['ssui'],
|
|
138
|
+
sbeth: ['ssui'],
|
|
132
139
|
};
|
|
133
140
|
|
|
134
141
|
export const coinIds: types.AssetCoinIds = {
|
|
@@ -149,8 +156,8 @@ export const coinIds: types.AssetCoinIds = {
|
|
|
149
156
|
? '0x6cd813061a3adf3602b76545f076205f0c8e7ec1d3b1eab9a1da7992c18c0524'
|
|
150
157
|
: '0x7016aae72cfc67f2fadf55769c0a7dd54291a583b63051a5ed71081cce836ac6',
|
|
151
158
|
// isolated assets
|
|
152
|
-
deep: '0xdeeb7a4662eec9f2f3def03fb937a663dddaa2e215b8078a284d026b7946c270
|
|
153
|
-
fud: '0x76cb819b01abed502bee8a702b4c2d547532c12f25001c9dea795a5e631c26f1
|
|
159
|
+
// deep: '0xdeeb7a4662eec9f2f3def03fb937a663dddaa2e215b8078a284d026b7946c270',
|
|
160
|
+
// fud: '0x76cb819b01abed502bee8a702b4c2d547532c12f25001c9dea795a5e631c26f1',
|
|
154
161
|
};
|
|
155
162
|
|
|
156
163
|
export const wormholeCoinIds: types.WormholeCoinIds = {
|
|
@@ -172,24 +179,24 @@ export const sCoinIds: types.SCoinIds = {
|
|
|
172
179
|
'0x854950aa624b1df59fe64e630b2ba7c550642e9342267a33061d59fb31582da5::scallop_usdc::SCALLOP_USDC',
|
|
173
180
|
ssbeth:
|
|
174
181
|
'0xb14f82d8506d139eacef109688d1b71e7236bcce9b2c0ad526abcd6aa5be7de0::scallop_sb_eth::SCALLOP_SB_ETH',
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
ssca:
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
swusdc:
|
|
186
|
-
// TODO: use prod value
|
|
187
|
-
// '0xad4d71551d31092230db1fd482008ea42867dbf27b286e9c70a79d2a6191d58d::scallop_wormhole_usdc::SCALLOP_WORMHOLE_USDC',
|
|
188
|
-
'0xf5447c4305a486d8c8557559887c2c39449ddb5e748f15d33946d02a1663c158::scallop_wormhole_usdc::SCALLOP_WORMHOLE_USDC',
|
|
182
|
+
// prod values
|
|
183
|
+
// ssui: '0xaafc4f740de0dd0dde642a31148fb94517087052f19afb0f7bed1dc41a50c77b::scallop_sui::SCALLOP_SUI',
|
|
184
|
+
// swusdc:
|
|
185
|
+
// '0xad4d71551d31092230db1fd482008ea42867dbf27b286e9c70a79d2a6191d58d::scallop_wormhole_usdc::SCALLOP_WORMHOLE_USDC',
|
|
186
|
+
// swusdt:
|
|
187
|
+
// '0xe6e5a012ec20a49a3d1d57bd2b67140b96cd4d3400b9d79e541f7bdbab661f95::scallop_wormhole_usdt::SCALLOP_WORMHOLE_USDT',
|
|
188
|
+
// ssca: '0x5ca17430c1d046fae9edeaa8fd76c7b4193a00d764a0ecfa9418d733ad27bc1e::scallop_sca::SCALLOP_SCA',
|
|
189
|
+
|
|
190
|
+
// test values
|
|
191
|
+
ssui: '0xf569919046f19a0c40b519ecfbb6ca0319698cd5908716c29b62ef56541f298b::scallop_sui::SCALLOP_SUI',
|
|
189
192
|
swusdt:
|
|
190
|
-
// TODO: use prod value
|
|
191
|
-
// '0xe6e5a012ec20a49a3d1d57bd2b67140b96cd4d3400b9d79e541f7bdbab661f95::scallop_wormhole_usdt::SCALLOP_WORMHOLE_USDT',
|
|
192
193
|
'0xac781d9f73058ff5e69f9bf8dde32f2e8c71c66d7fe8497fc83b2d9182254b22::scallop_wormhole_usdt::SCALLOP_WORMHOLE_USDT',
|
|
194
|
+
swusdc:
|
|
195
|
+
'0xf5447c4305a486d8c8557559887c2c39449ddb5e748f15d33946d02a1663c158::scallop_wormhole_usdc::SCALLOP_WORMHOLE_USDC',
|
|
196
|
+
ssca: '0x958428555e778e55918a59eb1c92c77f32b5c554fa3a5e56cd0815086b5072e7::scallop_sca::SCALLOP_SCA',
|
|
197
|
+
|
|
198
|
+
scetus:
|
|
199
|
+
'0xea346ce428f91ab007210443efcea5f5cdbbb3aae7e9affc0ca93f9203c31f0c::scallop_cetus::SCALLOP_CETUS',
|
|
193
200
|
sweth:
|
|
194
201
|
'0x67540ceb850d418679e69f1fb6b2093d6df78a2a699ffc733f7646096d552e9b::scallop_wormhole_eth::SCALLOP_WORMHOLE_ETH',
|
|
195
202
|
safsui:
|
|
@@ -202,6 +209,9 @@ export const sCoinIds: types.SCoinIds = {
|
|
|
202
209
|
'0x1392650f2eca9e3f6ffae3ff89e42a3590d7102b80e2b430f674730bc30d3259::scallop_wormhole_sol::SCALLOP_WORMHOLE_SOL',
|
|
203
210
|
swbtc:
|
|
204
211
|
'0x2cf76a9cf5d3337961d1154283234f94da2dcff18544dfe5cbdef65f319591b5::scallop_wormhole_btc::SCALLOP_WORMHOLE_BTC',
|
|
212
|
+
// sdeep:
|
|
213
|
+
// '0xeb7a05a3224837c5e5503575aed0be73c091d1ce5e43aa3c3e716e0ae614608f::scallop_deep::SCALLOP_DEEP',
|
|
214
|
+
// sfud: '0xe56d5167f427cbe597da9e8150ef5c337839aaf46891d62468dcf80bdd8e10d1::scallop_fud::SCALLOP_FUD',
|
|
205
215
|
} as const;
|
|
206
216
|
|
|
207
217
|
export const sCoinTypeToName = Object.entries(sCoinIds).reduce(
|
|
@@ -212,23 +222,20 @@ export const sCoinTypeToName = Object.entries(sCoinIds).reduce(
|
|
|
212
222
|
{} as Record<string, types.SupportSCoin>
|
|
213
223
|
);
|
|
214
224
|
|
|
225
|
+
export const sCoinRawNameToName = Object.entries(sCoinIds).reduce(
|
|
226
|
+
(acc, [coinName, coinType]) => {
|
|
227
|
+
acc[coinType.split('::')[2].toLowerCase()] = coinName as types.SupportSCoin;
|
|
228
|
+
return acc;
|
|
229
|
+
},
|
|
230
|
+
{} as Record<string, types.SupportSCoin>
|
|
231
|
+
);
|
|
232
|
+
|
|
215
233
|
// TEST VERSION
|
|
216
234
|
// export const sCoinIds: types.SCoinIds = {
|
|
217
|
-
//
|
|
218
|
-
//
|
|
219
|
-
//
|
|
220
|
-
//
|
|
221
|
-
// swusdc:
|
|
222
|
-
// '0xaedc3ab75db8680b81a755015fa90124d217be93457b893c05bac033817defaf::scallop_wormhole_usdc::SCALLOP_WORMHOLE_USDC',
|
|
223
|
-
// swusdt:
|
|
224
|
-
// '0xbf02fc87ddc104b342ad8414c85ceadf5b0c823c055a06fb0ed776272c01a52a::scallop_wormhole_usdt::SCALLOP_WORMHOLE_USDT',
|
|
225
|
-
// sweth: '0x27d54f43e3eda701be56b82e5756e41c84467cd202f5cf713d5f9e45a9f1b6bc::scallop_wormhole_eth::SCALLOP_WORMHOLE_ETH',
|
|
226
|
-
// safsui:
|
|
227
|
-
// '0xb75b46d975d8d80670b53a6bee90baaa8ce2e0b7d397f079447d641eef6b44ad::scallop_af_sui::SCALLOP_AF_SUI',
|
|
228
|
-
// shasui:
|
|
229
|
-
// '0xd973a723874e2c7cde196602a79155a1343a933f8cf87d9b1bb7408bc1acbc58::scallop_ha_sui::SCALLOP_HA_SUI',
|
|
230
|
-
// svsui:
|
|
231
|
-
// '0x97023a317320c4498cc4cd239dd02fd30c28246e5e8f81325d63f2bd8d70f6b3::scallop_v_sui::SCALLOP_V_SUI',
|
|
235
|
+
// ssui: '0xf569919046f19a0c40b519ecfbb6ca0319698cd5908716c29b62ef56541f298b::scallop_sui::SCALLOP_SUI',
|
|
236
|
+
// swusdt: '0xac781d9f73058ff5e69f9bf8dde32f2e8c71c66d7fe8497fc83b2d9182254b22::scallop_wormhole_usdt::SCALLOP_WORMHOLE_USDT',
|
|
237
|
+
// swusdc: '0xf5447c4305a486d8c8557559887c2c39449ddb5e748f15d33946d02a1663c158::scallop_wormhole_usdc::SCALLOP_WORMHOLE_USDC',
|
|
238
|
+
// ssca: '0x958428555e778e55918a59eb1c92c77f32b5c554fa3a5e56cd0815086b5072e7::scallop_sca::SCALLOP_SCA',
|
|
232
239
|
// } as const;
|
|
233
240
|
|
|
234
241
|
// export const sCoinTreasuryCaps: types.SCoinTreasuryCaps = {
|
|
@@ -4,7 +4,7 @@ export const POOL_ADDRESSES: Record<
|
|
|
4
4
|
SupportPoolCoins,
|
|
5
5
|
{
|
|
6
6
|
lendingPoolAddress: string;
|
|
7
|
-
collateralPoolAddress?: string;
|
|
7
|
+
collateralPoolAddress?: string; // not all pool has collateral
|
|
8
8
|
}
|
|
9
9
|
> = {
|
|
10
10
|
usdc: {
|
|
@@ -91,10 +91,13 @@ export const POOL_ADDRESSES: Record<
|
|
|
91
91
|
collateralPoolAddress:
|
|
92
92
|
'0xff677a5d9e9dc8f08f0a8681ebfc7481d1c7d57bc441f2881974adcdd7b13c31',
|
|
93
93
|
},
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
94
|
+
// TODO: enable for production
|
|
95
|
+
// fud: {
|
|
96
|
+
// lendingPoolAddress:
|
|
97
|
+
// '0x14367ddca30e2860cb89ed4eaca20c7ece260c5d59dd9990d2c85a8321326acb',
|
|
98
|
+
// },
|
|
99
|
+
// deep: {
|
|
100
|
+
// lendingPoolAddress:
|
|
101
|
+
// '0xf4a67ffb43da1e1c61c049f188f19463ea8dbbf2d5ef4722d6df854ff1b1cc03',
|
|
102
|
+
// },
|
|
100
103
|
};
|
package/src/constants/pyth.ts
CHANGED
|
@@ -22,6 +22,7 @@ export const PYTH_FEED_IDS: Record<SupportPoolCoins, string> = {
|
|
|
22
22
|
hasui: '23d7315113f5b1d3ba7a83604c44b94d79f4fd69af77f804fc7f920a6dc65744',
|
|
23
23
|
vsui: '23d7315113f5b1d3ba7a83604c44b94d79f4fd69af77f804fc7f920a6dc65744',
|
|
24
24
|
sca: '7e17f0ac105abe9214deb9944c30264f5986bf292869c6bd8e8da3ccd92d79bc',
|
|
25
|
-
|
|
26
|
-
|
|
25
|
+
// TODO: enable for production
|
|
26
|
+
// deep: '29bdd5248234e33bd93d3b81100b5fa32eaa5997843847e2c2cb16d7c6d9f7ff',
|
|
27
|
+
// fud: '6a4090703da959247727f2b490eb21aea95c8684ecfac675f432008830890c75',
|
|
27
28
|
};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export const DEFAULT_TOKENS_PER_INTERVAL =
|
|
1
|
+
export const DEFAULT_TOKENS_PER_INTERVAL = 50;
|
|
2
2
|
export const DEFAULT_INTERVAL_IN_MS = 300;
|
|
@@ -47,6 +47,7 @@ import {
|
|
|
47
47
|
getSCoinAmounts,
|
|
48
48
|
getSCoinSwapRate,
|
|
49
49
|
getSCoinTotalSupply,
|
|
50
|
+
getAllCoinPrices,
|
|
50
51
|
} from '../queries';
|
|
51
52
|
import {
|
|
52
53
|
ScallopQueryParams,
|
|
@@ -537,12 +538,13 @@ export class ScallopQuery {
|
|
|
537
538
|
public async getBorrowIncentivePools(
|
|
538
539
|
coinNames?: SupportBorrowIncentiveCoins[],
|
|
539
540
|
indexer: boolean = false,
|
|
540
|
-
args?: { coinPrices
|
|
541
|
+
args?: { marketPools?: MarketPools; coinPrices?: CoinPrices }
|
|
541
542
|
) {
|
|
542
543
|
return await getBorrowIncentivePools(
|
|
543
544
|
this,
|
|
544
545
|
coinNames,
|
|
545
546
|
indexer,
|
|
547
|
+
args?.marketPools,
|
|
546
548
|
args?.coinPrices
|
|
547
549
|
);
|
|
548
550
|
}
|
|
@@ -817,4 +819,15 @@ export class ScallopQuery {
|
|
|
817
819
|
public async getCoinPriceByIndexer(poolName: SupportPoolCoins) {
|
|
818
820
|
return this.indexer.getCoinPrice(poolName);
|
|
819
821
|
}
|
|
822
|
+
|
|
823
|
+
/**
|
|
824
|
+
* Get all coin prices, including sCoin
|
|
825
|
+
* @returns prices data
|
|
826
|
+
*/
|
|
827
|
+
public async getAllCoinPrices(args?: {
|
|
828
|
+
marketPools?: MarketPools;
|
|
829
|
+
coinPrices?: CoinPrices;
|
|
830
|
+
}) {
|
|
831
|
+
return getAllCoinPrices(this, args?.marketPools, args?.coinPrices);
|
|
832
|
+
}
|
|
820
833
|
}
|
|
@@ -21,6 +21,7 @@ import {
|
|
|
21
21
|
COIN_GECKGO_IDS,
|
|
22
22
|
POOL_ADDRESSES,
|
|
23
23
|
sCoinTypeToName,
|
|
24
|
+
sCoinRawNameToName,
|
|
24
25
|
} from '../constants';
|
|
25
26
|
import { getPythPrices, queryObligation } from '../queries';
|
|
26
27
|
import {
|
|
@@ -225,6 +226,16 @@ export class ScallopUtils {
|
|
|
225
226
|
}
|
|
226
227
|
}
|
|
227
228
|
|
|
229
|
+
/**
|
|
230
|
+
* Convert sCoin name to coin name.
|
|
231
|
+
* This function will parse new sCoin name `scallop_...` to its old market coin name which is shorter
|
|
232
|
+
* e.g: `scallop_sui -> ssui
|
|
233
|
+
* @return sCoin name
|
|
234
|
+
*/
|
|
235
|
+
public parseCoinNameFromSCoinName(coinName: string) {
|
|
236
|
+
return sCoinRawNameToName[coinName];
|
|
237
|
+
}
|
|
238
|
+
|
|
228
239
|
/**
|
|
229
240
|
* Convert sCoin name into sCoin type
|
|
230
241
|
* @param sCoinName
|
|
@@ -297,12 +308,13 @@ export class ScallopUtils {
|
|
|
297
308
|
): T extends SupportCoins ? T : SupportCoins;
|
|
298
309
|
public parseCoinNameFromType(coinType: string) {
|
|
299
310
|
coinType = normalizeStructTag(coinType);
|
|
311
|
+
|
|
300
312
|
const coinTypeRegex = new RegExp(`((0x[^:]+::[^:]+::[^<>]+))(?![^<>]*<)`);
|
|
301
313
|
const coinTypeMatch = coinType.match(coinTypeRegex);
|
|
302
314
|
const isMarketCoinType = coinType.includes('reserve::MarketCoin');
|
|
303
315
|
coinType = coinTypeMatch?.[1] ?? coinType;
|
|
304
316
|
|
|
305
|
-
const
|
|
317
|
+
const wormholeCoinTypeMap: Record<string, SupportAssetCoins> = {
|
|
306
318
|
[`${
|
|
307
319
|
this.address.get('core.coins.wusdc.id') ?? wormholeCoinIds.wusdc
|
|
308
320
|
}::coin::COIN`]: 'wusdc',
|
|
@@ -339,7 +351,7 @@ export class ScallopUtils {
|
|
|
339
351
|
);
|
|
340
352
|
|
|
341
353
|
const assetCoinName =
|
|
342
|
-
|
|
354
|
+
wormholeCoinTypeMap[coinType] ||
|
|
343
355
|
voloCoinTypeMap[coinType] ||
|
|
344
356
|
suiBridgeTypeMap[coinType] ||
|
|
345
357
|
(coinType.split('::')[2].toLowerCase() as SupportAssetCoins);
|