@scallop-io/sui-scallop-sdk 1.4.1-alpha.1 → 1.4.11
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 +2 -2
- package/dist/constants/tokenBucket.d.ts +2 -2
- package/dist/index.js +114 -97
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +114 -97
- package/dist/index.mjs.map +1 -1
- package/dist/models/scallopQuery.d.ts +11 -3
- package/dist/models/scallopUtils.d.ts +2 -2
- package/dist/queries/coreQuery.d.ts +2 -0
- package/dist/queries/portfolioQuery.d.ts +2 -0
- package/dist/queries/priceQuery.d.ts +4 -0
- package/dist/queries/sCoinQuery.d.ts +1 -1
- package/package.json +1 -1
- package/src/constants/coinGecko.ts +2 -3
- package/src/constants/common.ts +4 -7
- package/src/constants/enum.ts +20 -35
- package/src/constants/poolAddress.ts +8 -9
- package/src/constants/pyth.ts +2 -3
- package/src/constants/testAddress.ts +42 -0
- package/src/constants/tokenBucket.ts +2 -2
- package/src/models/scallopCache.ts +36 -15
- package/src/models/scallopQuery.ts +1 -1
- package/src/models/scallopUtils.ts +1 -1
- package/src/queries/borrowIncentiveQuery.ts +1 -1
- package/src/queries/borrowLimitQuery.ts +3 -3
- package/src/queries/isolatedAssetQuery.ts +2 -3
- package/src/queries/portfolioQuery.ts +1 -0
- package/src/queries/supplyLimitQuery.ts +2 -3
- package/src/utils/query.ts +5 -1
- package/src/utils/tokenBucket.ts +8 -28
- package/dist/test.d.ts +0 -0
- package/src/test.ts +0 -20
|
@@ -71,6 +71,8 @@ export declare class ScallopQuery {
|
|
|
71
71
|
hasui?: MarketPool | undefined;
|
|
72
72
|
vsui?: MarketPool | undefined;
|
|
73
73
|
sca?: MarketPool | undefined;
|
|
74
|
+
fud?: MarketPool | undefined;
|
|
75
|
+
deep?: MarketPool | undefined;
|
|
74
76
|
}>;
|
|
75
77
|
/**
|
|
76
78
|
* Get market pool
|
|
@@ -304,7 +306,7 @@ export declare class ScallopQuery {
|
|
|
304
306
|
* @return Borrow incentive pools data.
|
|
305
307
|
*/
|
|
306
308
|
getBorrowIncentivePools(coinNames?: SupportBorrowIncentiveCoins[], args?: {
|
|
307
|
-
coinPrices
|
|
309
|
+
coinPrices?: CoinPrices;
|
|
308
310
|
indexer?: boolean;
|
|
309
311
|
marketPools?: MarketPools;
|
|
310
312
|
}): Promise<{
|
|
@@ -363,6 +365,8 @@ export declare class ScallopQuery {
|
|
|
363
365
|
hasui?: import("../types").Lending | undefined;
|
|
364
366
|
vsui?: import("../types").Lending | undefined;
|
|
365
367
|
sca?: import("../types").Lending | undefined;
|
|
368
|
+
fud?: import("../types").Lending | undefined;
|
|
369
|
+
deep?: import("../types").Lending | undefined;
|
|
366
370
|
}>;
|
|
367
371
|
/**
|
|
368
372
|
* Get user lending and spool information for specific pool.
|
|
@@ -473,7 +477,7 @@ export declare class ScallopQuery {
|
|
|
473
477
|
* @param ownerAddress - The owner address.
|
|
474
478
|
* @return All market sCoin amounts.
|
|
475
479
|
*/
|
|
476
|
-
getSCoinAmounts(sCoinNames?: SupportSCoin[], ownerAddress?: string): Promise<import("../types").OptionalKeys<Record<"susdc" | "ssbeth" | "sweth" | "swbtc" | "swusdc" | "swusdt" | "ssui" | "swsol" | "scetus" | "safsui" | "shasui" | "svsui" | "ssca", number>>>;
|
|
480
|
+
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>>>;
|
|
477
481
|
/**
|
|
478
482
|
* Get sCoin amount.
|
|
479
483
|
*
|
|
@@ -488,7 +492,7 @@ export declare class ScallopQuery {
|
|
|
488
492
|
* @returns
|
|
489
493
|
*/
|
|
490
494
|
getSCoinSwapRate(fromSCoin: SupportSCoin, toSCoin: SupportSCoin): Promise<number>;
|
|
491
|
-
getFlashLoanFees(assetCoinNames?: SupportAssetCoins[]): Promise<Record<"usdc" | "sbeth" | "weth" | "wbtc" | "wusdc" | "wusdt" | "sui" | "wapt" | "wsol" | "cetus" | "afsui" | "hasui" | "vsui" | "sca", number>>;
|
|
495
|
+
getFlashLoanFees(assetCoinNames?: SupportAssetCoins[]): Promise<Record<"usdc" | "sbeth" | "weth" | "wbtc" | "wusdc" | "wusdt" | "sui" | "wapt" | "wsol" | "cetus" | "afsui" | "hasui" | "vsui" | "sca" | "fud" | "deep", number>>;
|
|
492
496
|
/**
|
|
493
497
|
* Get supply limit of lending pool
|
|
494
498
|
*/
|
|
@@ -532,6 +536,8 @@ export declare class ScallopQuery {
|
|
|
532
536
|
shasui?: number | undefined;
|
|
533
537
|
svsui?: number | undefined;
|
|
534
538
|
ssca?: number | undefined;
|
|
539
|
+
sfud?: number | undefined;
|
|
540
|
+
sdeep?: number | undefined;
|
|
535
541
|
usdc?: number | undefined;
|
|
536
542
|
sbeth?: number | undefined;
|
|
537
543
|
weth?: number | undefined;
|
|
@@ -546,6 +552,8 @@ export declare class ScallopQuery {
|
|
|
546
552
|
hasui?: number | undefined;
|
|
547
553
|
vsui?: number | undefined;
|
|
548
554
|
sca?: number | undefined;
|
|
555
|
+
fud?: number | undefined;
|
|
556
|
+
deep?: number | undefined;
|
|
549
557
|
swapt?: number | undefined;
|
|
550
558
|
}>;
|
|
551
559
|
}
|
|
@@ -64,7 +64,7 @@ export declare class ScallopUtils {
|
|
|
64
64
|
* e.g: `scallop_sui -> ssui
|
|
65
65
|
* @return sCoin name
|
|
66
66
|
*/
|
|
67
|
-
parseCoinNameFromSCoinName(coinName: string): "susdc" | "ssbeth" | "sweth" | "swbtc" | "swusdc" | "swusdt" | "ssui" | "swsol" | "scetus" | "safsui" | "shasui" | "svsui" | "ssca";
|
|
67
|
+
parseCoinNameFromSCoinName(coinName: string): "susdc" | "ssbeth" | "sweth" | "swbtc" | "swusdc" | "swusdt" | "ssui" | "swsol" | "scetus" | "safsui" | "shasui" | "svsui" | "ssca" | "sfud" | "sdeep";
|
|
68
68
|
/**
|
|
69
69
|
* Convert sCoin name into sCoin type
|
|
70
70
|
* @param sCoinName
|
|
@@ -76,7 +76,7 @@ export declare class ScallopUtils {
|
|
|
76
76
|
* @param sCoinType
|
|
77
77
|
* @returns sCoin name
|
|
78
78
|
*/
|
|
79
|
-
parseSCoinNameFromType(sCoinType: string): "susdc" | "ssbeth" | "sweth" | "swbtc" | "swusdc" | "swusdt" | "ssui" | "swsol" | "scetus" | "safsui" | "shasui" | "svsui" | "ssca";
|
|
79
|
+
parseSCoinNameFromType(sCoinType: string): "susdc" | "ssbeth" | "sweth" | "swbtc" | "swusdc" | "swusdt" | "ssui" | "swsol" | "scetus" | "safsui" | "shasui" | "svsui" | "ssca" | "sfud" | "sdeep";
|
|
80
80
|
/**
|
|
81
81
|
* Convert sCoin name into its underlying coin type
|
|
82
82
|
* @param sCoinName
|
|
@@ -40,6 +40,8 @@ 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;
|
|
43
45
|
}>;
|
|
44
46
|
/**
|
|
45
47
|
* Get market pool data.
|
|
@@ -24,6 +24,8 @@ 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;
|
|
27
29
|
}>;
|
|
28
30
|
/**
|
|
29
31
|
* Get user lending infomation for specific pool.
|
|
@@ -28,6 +28,8 @@ export declare const getAllCoinPrices: (query: ScallopQuery, marketPools?: Marke
|
|
|
28
28
|
shasui?: number | undefined;
|
|
29
29
|
svsui?: number | undefined;
|
|
30
30
|
ssca?: number | undefined;
|
|
31
|
+
sfud?: number | undefined;
|
|
32
|
+
sdeep?: number | undefined;
|
|
31
33
|
usdc?: number | undefined;
|
|
32
34
|
sbeth?: number | undefined;
|
|
33
35
|
weth?: number | undefined;
|
|
@@ -42,5 +44,7 @@ export declare const getAllCoinPrices: (query: ScallopQuery, marketPools?: Marke
|
|
|
42
44
|
hasui?: number | undefined;
|
|
43
45
|
vsui?: number | undefined;
|
|
44
46
|
sca?: number | undefined;
|
|
47
|
+
fud?: number | undefined;
|
|
48
|
+
deep?: number | undefined;
|
|
45
49
|
swapt?: number | undefined;
|
|
46
50
|
}>;
|
|
@@ -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", number>>>;
|
|
22
|
+
}, sCoinNames?: SupportSCoin[], ownerAddress?: string) => Promise<OptionalKeys<Record<"susdc" | "ssbeth" | "sweth" | "swbtc" | "swusdc" | "swusdt" | "ssui" | "swsol" | "scetus" | "safsui" | "shasui" | "svsui" | "ssca" | "sfud" | "sdeep", number>>>;
|
|
23
23
|
/**
|
|
24
24
|
* Query owned sCoin amount.
|
|
25
25
|
*
|
package/package.json
CHANGED
package/src/constants/common.ts
CHANGED
|
@@ -9,7 +9,6 @@ export const ADDRESSES_ID =
|
|
|
9
9
|
? ('65fb07c39c845425d71d7b18' as const)
|
|
10
10
|
: ('675c65cd301dd817ea262e76' as const);
|
|
11
11
|
// : ('66f8e7ed9bb9e07fdfb86bbb' as const);
|
|
12
|
-
// : ('664dfe22898c36c159e28bc8' as const);
|
|
13
12
|
|
|
14
13
|
export const PROTOCOL_OBJECT_ID = IS_VE_SCA_TEST
|
|
15
14
|
? ('0xc9f859f98ca352a11b97a038c4b4162bee437b8df8caa047990fe9cb03d4f778' as const)
|
|
@@ -45,9 +44,8 @@ export const SUPPORT_POOLS = [
|
|
|
45
44
|
'hasui',
|
|
46
45
|
'vsui',
|
|
47
46
|
'sca',
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
// 'deep',
|
|
47
|
+
'fud',
|
|
48
|
+
'deep',
|
|
51
49
|
] as const;
|
|
52
50
|
|
|
53
51
|
export const SUPPORT_COLLATERALS = [
|
|
@@ -93,9 +91,8 @@ export const SUPPORT_SCOIN = [
|
|
|
93
91
|
'scetus',
|
|
94
92
|
'swsol',
|
|
95
93
|
'swbtc',
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
// 'sfud',
|
|
94
|
+
'sdeep',
|
|
95
|
+
'sfud',
|
|
99
96
|
] as const;
|
|
100
97
|
|
|
101
98
|
export const SUPPORT_SUI_BRIDGE = ['sbeth'] as const;
|
package/src/constants/enum.ts
CHANGED
|
@@ -16,9 +16,8 @@ export const coinDecimals: types.SupportCoinDecimals = {
|
|
|
16
16
|
hasui: 9,
|
|
17
17
|
vsui: 9,
|
|
18
18
|
sca: 9,
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
// fud: 5,
|
|
19
|
+
deep: 6,
|
|
20
|
+
fud: 5,
|
|
22
21
|
susdc: 6,
|
|
23
22
|
sweth: 8,
|
|
24
23
|
ssbeth: 8,
|
|
@@ -33,9 +32,8 @@ export const coinDecimals: types.SupportCoinDecimals = {
|
|
|
33
32
|
shasui: 9,
|
|
34
33
|
svsui: 9,
|
|
35
34
|
ssca: 9,
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
// sfud: 5,
|
|
35
|
+
sdeep: 6,
|
|
36
|
+
sfud: 5,
|
|
39
37
|
};
|
|
40
38
|
|
|
41
39
|
export const assetCoins: types.AssetCoins = {
|
|
@@ -53,9 +51,8 @@ export const assetCoins: types.AssetCoins = {
|
|
|
53
51
|
hasui: 'hasui',
|
|
54
52
|
vsui: 'vsui',
|
|
55
53
|
sca: 'sca',
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
// fud: 'fud',
|
|
54
|
+
deep: 'deep',
|
|
55
|
+
fud: 'fud',
|
|
59
56
|
};
|
|
60
57
|
|
|
61
58
|
export const marketCoins: types.MarketCoins = {
|
|
@@ -73,9 +70,8 @@ export const marketCoins: types.MarketCoins = {
|
|
|
73
70
|
shasui: 'shasui',
|
|
74
71
|
svsui: 'svsui',
|
|
75
72
|
ssca: 'ssca',
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
// sfud: 'sfud',
|
|
73
|
+
sdeep: 'sdeep',
|
|
74
|
+
sfud: 'sfud',
|
|
79
75
|
};
|
|
80
76
|
|
|
81
77
|
export const sCoins: types.SCoins = {
|
|
@@ -92,9 +88,8 @@ export const sCoins: types.SCoins = {
|
|
|
92
88
|
ssca: 'ssca',
|
|
93
89
|
swsol: 'swsol',
|
|
94
90
|
swbtc: 'swbtc',
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
// sdeep: 'sdeep',
|
|
91
|
+
sfud: 'sfud',
|
|
92
|
+
sdeep: 'sdeep',
|
|
98
93
|
};
|
|
99
94
|
|
|
100
95
|
export const stakeMarketCoins: types.StakeMarketCoins = {
|
|
@@ -143,8 +138,8 @@ export const coinIds: types.AssetCoinIds = {
|
|
|
143
138
|
? '0x6cd813061a3adf3602b76545f076205f0c8e7ec1d3b1eab9a1da7992c18c0524'
|
|
144
139
|
: '0x7016aae72cfc67f2fadf55769c0a7dd54291a583b63051a5ed71081cce836ac6',
|
|
145
140
|
// isolated assets
|
|
146
|
-
|
|
147
|
-
|
|
141
|
+
deep: '0xdeeb7a4662eec9f2f3def03fb937a663dddaa2e215b8078a284d026b7946c270',
|
|
142
|
+
fud: '0x76cb819b01abed502bee8a702b4c2d547532c12f25001c9dea795a5e631c26f1',
|
|
148
143
|
};
|
|
149
144
|
|
|
150
145
|
export const wormholeCoinIds: types.WormholeCoinIds = {
|
|
@@ -166,22 +161,12 @@ export const sCoinIds: types.SCoinIds = {
|
|
|
166
161
|
'0x854950aa624b1df59fe64e630b2ba7c550642e9342267a33061d59fb31582da5::scallop_usdc::SCALLOP_USDC',
|
|
167
162
|
ssbeth:
|
|
168
163
|
'0xb14f82d8506d139eacef109688d1b71e7236bcce9b2c0ad526abcd6aa5be7de0::scallop_sb_eth::SCALLOP_SB_ETH',
|
|
169
|
-
|
|
170
|
-
// ssui: '0xaafc4f740de0dd0dde642a31148fb94517087052f19afb0f7bed1dc41a50c77b::scallop_sui::SCALLOP_SUI',
|
|
171
|
-
// swusdc:
|
|
172
|
-
// '0xad4d71551d31092230db1fd482008ea42867dbf27b286e9c70a79d2a6191d58d::scallop_wormhole_usdc::SCALLOP_WORMHOLE_USDC',
|
|
173
|
-
// swusdt:
|
|
174
|
-
// '0xe6e5a012ec20a49a3d1d57bd2b67140b96cd4d3400b9d79e541f7bdbab661f95::scallop_wormhole_usdt::SCALLOP_WORMHOLE_USDT',
|
|
175
|
-
// ssca: '0x5ca17430c1d046fae9edeaa8fd76c7b4193a00d764a0ecfa9418d733ad27bc1e::scallop_sca::SCALLOP_SCA',
|
|
176
|
-
|
|
177
|
-
// test values
|
|
178
|
-
ssui: '0xf569919046f19a0c40b519ecfbb6ca0319698cd5908716c29b62ef56541f298b::scallop_sui::SCALLOP_SUI',
|
|
179
|
-
swusdt:
|
|
180
|
-
'0xac781d9f73058ff5e69f9bf8dde32f2e8c71c66d7fe8497fc83b2d9182254b22::scallop_wormhole_usdt::SCALLOP_WORMHOLE_USDT',
|
|
164
|
+
ssui: '0xaafc4f740de0dd0dde642a31148fb94517087052f19afb0f7bed1dc41a50c77b::scallop_sui::SCALLOP_SUI',
|
|
181
165
|
swusdc:
|
|
182
|
-
'
|
|
183
|
-
|
|
184
|
-
|
|
166
|
+
'0xad4d71551d31092230db1fd482008ea42867dbf27b286e9c70a79d2a6191d58d::scallop_wormhole_usdc::SCALLOP_WORMHOLE_USDC',
|
|
167
|
+
swusdt:
|
|
168
|
+
'0xe6e5a012ec20a49a3d1d57bd2b67140b96cd4d3400b9d79e541f7bdbab661f95::scallop_wormhole_usdt::SCALLOP_WORMHOLE_USDT',
|
|
169
|
+
ssca: '0x5ca17430c1d046fae9edeaa8fd76c7b4193a00d764a0ecfa9418d733ad27bc1e::scallop_sca::SCALLOP_SCA',
|
|
185
170
|
scetus:
|
|
186
171
|
'0xea346ce428f91ab007210443efcea5f5cdbbb3aae7e9affc0ca93f9203c31f0c::scallop_cetus::SCALLOP_CETUS',
|
|
187
172
|
sweth:
|
|
@@ -196,9 +181,9 @@ export const sCoinIds: types.SCoinIds = {
|
|
|
196
181
|
'0x1392650f2eca9e3f6ffae3ff89e42a3590d7102b80e2b430f674730bc30d3259::scallop_wormhole_sol::SCALLOP_WORMHOLE_SOL',
|
|
197
182
|
swbtc:
|
|
198
183
|
'0x2cf76a9cf5d3337961d1154283234f94da2dcff18544dfe5cbdef65f319591b5::scallop_wormhole_btc::SCALLOP_WORMHOLE_BTC',
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
184
|
+
sdeep:
|
|
185
|
+
'0xeb7a05a3224837c5e5503575aed0be73c091d1ce5e43aa3c3e716e0ae614608f::scallop_deep::SCALLOP_DEEP',
|
|
186
|
+
sfud: '0xe56d5167f427cbe597da9e8150ef5c337839aaf46891d62468dcf80bdd8e10d1::scallop_fud::SCALLOP_FUD',
|
|
202
187
|
} as const;
|
|
203
188
|
|
|
204
189
|
export const sCoinTypeToName = Object.entries(sCoinIds).reduce(
|
|
@@ -91,13 +91,12 @@ export const POOL_ADDRESSES: Record<
|
|
|
91
91
|
collateralPoolAddress:
|
|
92
92
|
'0xff677a5d9e9dc8f08f0a8681ebfc7481d1c7d57bc441f2881974adcdd7b13c31',
|
|
93
93
|
},
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
// },
|
|
94
|
+
fud: {
|
|
95
|
+
lendingPoolAddress:
|
|
96
|
+
'0x14367ddca30e2860cb89ed4eaca20c7ece260c5d59dd9990d2c85a8321326acb',
|
|
97
|
+
},
|
|
98
|
+
deep: {
|
|
99
|
+
lendingPoolAddress:
|
|
100
|
+
'0xf4a67ffb43da1e1c61c049f188f19463ea8dbbf2d5ef4722d6df854ff1b1cc03',
|
|
101
|
+
},
|
|
103
102
|
};
|
package/src/constants/pyth.ts
CHANGED
|
@@ -22,7 +22,6 @@ export const PYTH_FEED_IDS: Record<SupportPoolCoins, string> = {
|
|
|
22
22
|
hasui: '23d7315113f5b1d3ba7a83604c44b94d79f4fd69af77f804fc7f920a6dc65744',
|
|
23
23
|
vsui: '23d7315113f5b1d3ba7a83604c44b94d79f4fd69af77f804fc7f920a6dc65744',
|
|
24
24
|
sca: '7e17f0ac105abe9214deb9944c30264f5986bf292869c6bd8e8da3ccd92d79bc',
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
// fud: '6a4090703da959247727f2b490eb21aea95c8684ecfac675f432008830890c75',
|
|
25
|
+
deep: '29bdd5248234e33bd93d3b81100b5fa32eaa5997843847e2c2cb16d7c6d9f7ff',
|
|
26
|
+
fud: '6a4090703da959247727f2b490eb21aea95c8684ecfac675f432008830890c75',
|
|
28
27
|
};
|
|
@@ -236,6 +236,36 @@ export const TEST_ADDRESSES: AddressesInterface = {
|
|
|
236
236
|
},
|
|
237
237
|
},
|
|
238
238
|
},
|
|
239
|
+
deep: {
|
|
240
|
+
id: '0xdeeb7a4662eec9f2f3def03fb937a663dddaa2e215b8078a284d026b7946c270',
|
|
241
|
+
metaData:
|
|
242
|
+
'0x6e60b051a08fa836f5a7acd7c464c8d9825bc29c44657fe170fe9b8e1e4770c0',
|
|
243
|
+
treasury: '',
|
|
244
|
+
oracle: {
|
|
245
|
+
supra: '',
|
|
246
|
+
switchboard: '',
|
|
247
|
+
pyth: {
|
|
248
|
+
feed: '29bdd5248234e33bd93d3b81100b5fa32eaa5997843847e2c2cb16d7c6d9f7ff',
|
|
249
|
+
feedObject:
|
|
250
|
+
'0x8c7f3a322b94cc69db2a2ac575cbd94bf5766113324c3a3eceac91e3e88a51ed',
|
|
251
|
+
},
|
|
252
|
+
},
|
|
253
|
+
},
|
|
254
|
+
fud: {
|
|
255
|
+
id: '0x76cb819b01abed502bee8a702b4c2d547532c12f25001c9dea795a5e631c26f1',
|
|
256
|
+
metaData:
|
|
257
|
+
'0x01087411ef48aaac1eb6e24803213e3a60a03b147dac930e5e341f17a85e524e',
|
|
258
|
+
treasury: '',
|
|
259
|
+
oracle: {
|
|
260
|
+
supra: '',
|
|
261
|
+
switchboard: '',
|
|
262
|
+
pyth: {
|
|
263
|
+
feed: '6a4090703da959247727f2b490eb21aea95c8684ecfac675f432008830890c75',
|
|
264
|
+
feedObject:
|
|
265
|
+
'0x4531c3ed0d22f21f5fce882905372006c9aafa30f01db03b789e95a6c50de7b2',
|
|
266
|
+
},
|
|
267
|
+
},
|
|
268
|
+
},
|
|
239
269
|
},
|
|
240
270
|
oracles: {
|
|
241
271
|
xOracle:
|
|
@@ -513,6 +543,18 @@ export const TEST_ADDRESSES: AddressesInterface = {
|
|
|
513
543
|
treasury:
|
|
514
544
|
'0xfd0f02def6358a1f266acfa1493d4707ee8387460d434fb667d63d755ff907ed',
|
|
515
545
|
},
|
|
546
|
+
sdeep: {
|
|
547
|
+
coinType:
|
|
548
|
+
'0xeb7a05a3224837c5e5503575aed0be73c091d1ce5e43aa3c3e716e0ae614608f::scallop_deep::SCALLOP_DEEP',
|
|
549
|
+
treasury:
|
|
550
|
+
'0xc63838fabe37b25ad897392d89876d920f5e0c6a406bf3abcb84753d2829bc88',
|
|
551
|
+
},
|
|
552
|
+
sfud: {
|
|
553
|
+
coinType:
|
|
554
|
+
'0xe56d5167f427cbe597da9e8150ef5c337839aaf46891d62468dcf80bdd8e10d1::scallop_fud::SCALLOP_FUD',
|
|
555
|
+
treasury:
|
|
556
|
+
'0xf25212f11d182decff7a86165699a73e3d5787aced203ca539f43cfbc10db867',
|
|
557
|
+
},
|
|
516
558
|
},
|
|
517
559
|
},
|
|
518
560
|
};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export const DEFAULT_TOKENS_PER_INTERVAL =
|
|
2
|
-
export const DEFAULT_INTERVAL_IN_MS =
|
|
1
|
+
export const DEFAULT_TOKENS_PER_INTERVAL = 10;
|
|
2
|
+
export const DEFAULT_INTERVAL_IN_MS = 50;
|
|
@@ -122,10 +122,13 @@ export class ScallopCache {
|
|
|
122
122
|
txBlock.moveCall(queryTarget, args, typeArgs);
|
|
123
123
|
|
|
124
124
|
const query = await this.queryClient.fetchQuery({
|
|
125
|
+
retry: 5,
|
|
126
|
+
retryDelay: 1000,
|
|
125
127
|
queryKey: queryKeys.rpc.getInspectTxn(queryTarget, args, typeArgs),
|
|
126
128
|
queryFn: async () => {
|
|
127
|
-
return await callWithRateLimit(
|
|
128
|
-
this.
|
|
129
|
+
return await callWithRateLimit(
|
|
130
|
+
this.tokenBucket,
|
|
131
|
+
async () => await this.suiKit.inspectTxn(txBlock)
|
|
129
132
|
);
|
|
130
133
|
},
|
|
131
134
|
});
|
|
@@ -143,13 +146,17 @@ export class ScallopCache {
|
|
|
143
146
|
options?: SuiObjectDataOptions
|
|
144
147
|
): Promise<SuiObjectResponse | null> {
|
|
145
148
|
return this.queryClient.fetchQuery({
|
|
149
|
+
retry: 5,
|
|
150
|
+
retryDelay: 1000,
|
|
146
151
|
queryKey: queryKeys.rpc.getObject(objectId, this.walletAddress, options),
|
|
147
152
|
queryFn: async () => {
|
|
148
|
-
return await callWithRateLimit(
|
|
149
|
-
this.
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
+
return await callWithRateLimit(
|
|
154
|
+
this.tokenBucket,
|
|
155
|
+
async () =>
|
|
156
|
+
await this.client.getObject({
|
|
157
|
+
id: objectId,
|
|
158
|
+
options,
|
|
159
|
+
})
|
|
153
160
|
);
|
|
154
161
|
},
|
|
155
162
|
});
|
|
@@ -170,14 +177,17 @@ export class ScallopCache {
|
|
|
170
177
|
// objectIds.sort();
|
|
171
178
|
|
|
172
179
|
return this.queryClient.fetchQuery({
|
|
180
|
+
retry: 5,
|
|
181
|
+
retryDelay: 1000,
|
|
173
182
|
queryKey: queryKeys.rpc.getObjects(
|
|
174
183
|
objectIds,
|
|
175
184
|
this.walletAddress,
|
|
176
185
|
options
|
|
177
186
|
),
|
|
178
187
|
queryFn: async () => {
|
|
179
|
-
return await callWithRateLimit(
|
|
180
|
-
this.
|
|
188
|
+
return await callWithRateLimit(
|
|
189
|
+
this.tokenBucket,
|
|
190
|
+
async () => await this.suiKit.getObjects(objectIds, options)
|
|
181
191
|
);
|
|
182
192
|
},
|
|
183
193
|
});
|
|
@@ -190,10 +200,13 @@ export class ScallopCache {
|
|
|
190
200
|
*/
|
|
191
201
|
public async queryGetOwnedObjects(input: GetOwnedObjectsParams) {
|
|
192
202
|
return this.queryClient.fetchQuery({
|
|
203
|
+
retry: 5,
|
|
204
|
+
retryDelay: 1000,
|
|
193
205
|
queryKey: queryKeys.rpc.getOwnedObjects(input),
|
|
194
206
|
queryFn: async () => {
|
|
195
|
-
return await callWithRateLimit(
|
|
196
|
-
this.
|
|
207
|
+
return await callWithRateLimit(
|
|
208
|
+
this.tokenBucket,
|
|
209
|
+
async () => await this.client.getOwnedObjects(input)
|
|
197
210
|
);
|
|
198
211
|
},
|
|
199
212
|
});
|
|
@@ -203,10 +216,13 @@ export class ScallopCache {
|
|
|
203
216
|
input: GetDynamicFieldsParams
|
|
204
217
|
): Promise<DynamicFieldPage | null> {
|
|
205
218
|
return this.queryClient.fetchQuery({
|
|
219
|
+
retry: 5,
|
|
220
|
+
retryDelay: 1000,
|
|
206
221
|
queryKey: queryKeys.rpc.getDynamicFields(input),
|
|
207
222
|
queryFn: async () => {
|
|
208
|
-
return await callWithRateLimit(
|
|
209
|
-
this.
|
|
223
|
+
return await callWithRateLimit(
|
|
224
|
+
this.tokenBucket,
|
|
225
|
+
async () => await this.client.getDynamicFields(input)
|
|
210
226
|
);
|
|
211
227
|
},
|
|
212
228
|
});
|
|
@@ -216,6 +232,8 @@ export class ScallopCache {
|
|
|
216
232
|
input: GetDynamicFieldObjectParams
|
|
217
233
|
): Promise<SuiObjectResponse | null> {
|
|
218
234
|
return this.queryClient.fetchQuery({
|
|
235
|
+
retry: 5,
|
|
236
|
+
retryDelay: (attemptIndex) => Math.min(1000 * attemptIndex, 8000),
|
|
219
237
|
queryKey: queryKeys.rpc.getDynamicFieldObject(input),
|
|
220
238
|
queryFn: async () => {
|
|
221
239
|
return await callWithRateLimit(this.tokenBucket, () =>
|
|
@@ -229,10 +247,13 @@ export class ScallopCache {
|
|
|
229
247
|
owner: string
|
|
230
248
|
): Promise<{ [k: string]: string }> {
|
|
231
249
|
return this.queryClient.fetchQuery({
|
|
250
|
+
retry: 5,
|
|
251
|
+
retryDelay: 1000,
|
|
232
252
|
queryKey: queryKeys.rpc.getAllCoinBalances(owner),
|
|
233
253
|
queryFn: async () => {
|
|
234
|
-
const allBalances = await callWithRateLimit(
|
|
235
|
-
this.
|
|
254
|
+
const allBalances = await callWithRateLimit(
|
|
255
|
+
this.tokenBucket,
|
|
256
|
+
async () => await this.client.getAllBalances({ owner })
|
|
236
257
|
);
|
|
237
258
|
if (!allBalances) return {};
|
|
238
259
|
const balances = allBalances.reduce(
|
|
@@ -66,7 +66,7 @@ export const getBorrowIncentivePools = async (
|
|
|
66
66
|
const borrowIncentivePools: BorrowIncentivePools = {};
|
|
67
67
|
marketPools =
|
|
68
68
|
marketPools ??
|
|
69
|
-
(await query.getMarketPools(undefined, {
|
|
69
|
+
(await query.getMarketPools(undefined, { coinPrices, indexer }));
|
|
70
70
|
coinPrices = coinPrices ?? (await query.getAllCoinPrices({ marketPools }));
|
|
71
71
|
|
|
72
72
|
if (indexer) {
|
|
@@ -17,9 +17,9 @@ const borrowLimitZod = zod.object({
|
|
|
17
17
|
}),
|
|
18
18
|
});
|
|
19
19
|
|
|
20
|
-
|
|
21
|
-
// const borrowLimitKeyType = `
|
|
22
|
-
|
|
20
|
+
const borrowLimitKeyType = `0xe7dbb371a9595631f7964b7ece42255ad0e738cc85fe6da26c7221b220f01af6::market_dynamic_keys::BorrowLimitKey`; // prod
|
|
21
|
+
// const borrowLimitKeyType = `0xb784ea287d944e478a3ceaa071f8885072cce6b7224cf245914dc2f9963f460e::market_dynamic_keys::BorrowLimitKey`;
|
|
22
|
+
|
|
23
23
|
/**
|
|
24
24
|
* Return supply limit of a pool (including the decimals)
|
|
25
25
|
* @param utils
|
|
@@ -18,9 +18,8 @@ const isolatedAssetZod = zod.object({
|
|
|
18
18
|
}),
|
|
19
19
|
});
|
|
20
20
|
|
|
21
|
-
|
|
22
|
-
// const isolatedAssetKeyType = `
|
|
23
|
-
const isolatedAssetKeyType = `0x6c23585e940a989588432509107e98bae06dbca4e333f26d0635d401b3c7c76d::market_dynamic_keys::IsolatedAssetKey`;
|
|
21
|
+
const isolatedAssetKeyType = `0xe7dbb371a9595631f7964b7ece42255ad0e738cc85fe6da26c7221b220f01af6::market_dynamic_keys::IsolatedAssetKey`; // prod
|
|
22
|
+
// const isolatedAssetKeyType = `0x6c23585e940a989588432509107e98bae06dbca4e333f26d0635d401b3c7c76d::market_dynamic_keys::IsolatedAssetKey`;
|
|
24
23
|
|
|
25
24
|
/**
|
|
26
25
|
* Return list of isolated assets coin types
|
|
@@ -17,9 +17,8 @@ const supplyLimitZod = zod.object({
|
|
|
17
17
|
}),
|
|
18
18
|
});
|
|
19
19
|
|
|
20
|
-
|
|
21
|
-
// const supplyLimitKeyType = `
|
|
22
|
-
const supplyLimitKeyType = `0x6c23585e940a989588432509107e98bae06dbca4e333f26d0635d401b3c7c76d::market_dynamic_keys::SupplyLimitKey`;
|
|
20
|
+
const supplyLimitKeyType = `0x6e641f0dca8aedab3101d047e96439178f16301bf0b57fe8745086ff1195eb3e::market_dynamic_keys::SupplyLimitKey`; // prod
|
|
21
|
+
// const supplyLimitKeyType = `0x6c23585e940a989588432509107e98bae06dbca4e333f26d0635d401b3c7c76d::market_dynamic_keys::SupplyLimitKey`;
|
|
23
22
|
/**
|
|
24
23
|
* Return supply limit of a pool (including the decimals)
|
|
25
24
|
* @param utils
|
package/src/utils/query.ts
CHANGED
|
@@ -27,6 +27,7 @@ import type {
|
|
|
27
27
|
ParsedBorrowIncentiveAccountPoolData,
|
|
28
28
|
SupportBorrowIncentiveRewardCoins,
|
|
29
29
|
} from '../types';
|
|
30
|
+
import { sCoinRawNameToName } from 'src/constants';
|
|
30
31
|
|
|
31
32
|
/**
|
|
32
33
|
* Parse origin market pool data to a more readable format.
|
|
@@ -433,9 +434,12 @@ export const parseOriginBorrowIncentivePoolData = (
|
|
|
433
434
|
poolPoints: originBorrowIncentivePoolData.points.reduce(
|
|
434
435
|
(acc, point) => {
|
|
435
436
|
const parsed = parseOriginBorrowIncentivesPoolPointData(point);
|
|
436
|
-
|
|
437
|
+
let name = parseStructTag(
|
|
437
438
|
parsed.pointType
|
|
438
439
|
).name.toLowerCase() as SupportBorrowIncentiveRewardCoins;
|
|
440
|
+
if (sCoinRawNameToName[name]) {
|
|
441
|
+
name = sCoinRawNameToName[name];
|
|
442
|
+
}
|
|
439
443
|
acc[name] = parsed;
|
|
440
444
|
return acc;
|
|
441
445
|
},
|