@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
|
@@ -2,12 +2,12 @@ export declare const API_BASE_URL: "https://sui.apis.scallop.io";
|
|
|
2
2
|
export declare const SDK_API_BASE_URL: "https://sdk.api.scallop.io";
|
|
3
3
|
export declare const IS_VE_SCA_TEST: boolean;
|
|
4
4
|
export declare const USE_TEST_ADDRESS: boolean;
|
|
5
|
-
export declare const ADDRESSES_ID: "65fb07c39c845425d71d7b18" | "
|
|
5
|
+
export declare const ADDRESSES_ID: "65fb07c39c845425d71d7b18" | "675c65cd301dd817ea262e76";
|
|
6
6
|
export declare const PROTOCOL_OBJECT_ID: "0xc9f859f98ca352a11b97a038c4b4162bee437b8df8caa047990fe9cb03d4f778" | "0xefe8b36d5b2e43728cc323298626b83177803521d195cfb11e15b910e892fddf";
|
|
7
7
|
export declare const BORROW_FEE_PROTOCOL_ID: "0xc9f859f98ca352a11b97a038c4b4162bee437b8df8caa047990fe9cb03d4f778" | "0xc38f849e81cfe46d4e4320f508ea7dda42934a329d5a6571bb4c3cb6ea63f5da";
|
|
8
8
|
export declare const SCA_COIN_TYPE: "0x6cd813061a3adf3602b76545f076205f0c8e7ec1d3b1eab9a1da7992c18c0524::sca::SCA" | "0x7016aae72cfc67f2fadf55769c0a7dd54291a583b63051a5ed71081cce836ac6::sca::SCA";
|
|
9
9
|
export declare const OLD_BORROW_INCENTIVE_PROTOCOL_ID: "0xc63072e7f5f4983a2efaf5bdba1480d5e7d74d57948e1c7cc436f8e22cbeb410";
|
|
10
|
-
export declare const SUPPORT_POOLS: readonly ["usdc", "sbeth", "weth", "wbtc", "wusdc", "wusdt", "sui", "wapt", "wsol", "cetus", "afsui", "hasui", "vsui", "sca"
|
|
10
|
+
export declare const SUPPORT_POOLS: readonly ["usdc", "sbeth", "weth", "wbtc", "wusdc", "wusdt", "sui", "wapt", "wsol", "cetus", "afsui", "hasui", "vsui", "sca"];
|
|
11
11
|
export declare const SUPPORT_COLLATERALS: readonly ["usdc", "sbeth", "weth", "wbtc", "wusdc", "wusdt", "sui", "wapt", "wsol", "cetus", "afsui", "hasui", "vsui", "sca"];
|
|
12
12
|
export declare const SUPPORT_SPOOLS: readonly ["susdc", "sweth", "ssui", "swusdc", "swusdt", "scetus", "safsui", "shasui", "svsui"];
|
|
13
13
|
export declare const SUPPORT_SCOIN: readonly ["susdc", "ssbeth", "ssui", "swusdc", "swusdt", "safsui", "shasui", "svsui", "sweth", "ssca", "scetus", "swsol", "swbtc"];
|
|
@@ -15,6 +15,6 @@ export declare const SUPPORT_SUI_BRIDGE: readonly ["sbeth"];
|
|
|
15
15
|
export declare const SUPPORT_WORMHOLE: readonly ["wusdc", "wusdt", "weth", "wbtc", "wapt", "wsol"];
|
|
16
16
|
export declare const SUPPORT_SPOOLS_REWARDS: readonly ["sui"];
|
|
17
17
|
export declare const SUPPORT_BORROW_INCENTIVE_POOLS: readonly ["sui", "wusdc", "wusdt", "afsui", "hasui", "vsui", "weth", "sbeth", "sca", "usdc"];
|
|
18
|
-
export declare const SUPPORT_BORROW_INCENTIVE_REWARDS: readonly ["sui", "sca"];
|
|
18
|
+
export declare const SUPPORT_BORROW_INCENTIVE_REWARDS: readonly ["usdc", "sbeth", "weth", "wbtc", "wusdc", "wusdt", "sui", "wapt", "wsol", "cetus", "afsui", "hasui", "vsui", "sca", "susdc", "ssbeth", "ssui", "swusdc", "swusdt", "safsui", "shasui", "svsui", "sweth", "ssca", "scetus", "swsol", "swbtc"];
|
|
19
19
|
export declare const SUPPORT_ORACLES: readonly ["supra", "switchboard", "pyth"];
|
|
20
20
|
export declare const SUPPORT_PACKAGES: readonly ["coinDecimalsRegistry", "math", "whitelist", "x", "protocol", "protocolWhitelist", "query", "supra", "pyth", "switchboard", "xOracle", "testCoin"];
|
package/dist/constants/enum.d.ts
CHANGED
|
@@ -12,3 +12,4 @@ export declare const wormholeCoinIds: types.WormholeCoinIds;
|
|
|
12
12
|
export declare const voloCoinIds: types.VoloCoinIds;
|
|
13
13
|
export declare const sCoinIds: types.SCoinIds;
|
|
14
14
|
export declare const sCoinTypeToName: Record<string, "susdc" | "ssbeth" | "sweth" | "swbtc" | "swusdc" | "swusdt" | "ssui" | "swsol" | "scetus" | "safsui" | "shasui" | "svsui" | "ssca">;
|
|
15
|
+
export declare const sCoinRawNameToName: Record<string, "susdc" | "ssbeth" | "sweth" | "swbtc" | "swusdc" | "swusdt" | "ssui" | "swsol" | "scetus" | "safsui" | "shasui" | "svsui" | "ssca">;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const DEFAULT_TOKENS_PER_INTERVAL =
|
|
1
|
+
export declare const DEFAULT_TOKENS_PER_INTERVAL = 50;
|
|
2
2
|
export declare const DEFAULT_INTERVAL_IN_MS = 300;
|
package/dist/index.js
CHANGED
|
@@ -80,6 +80,7 @@ __export(src_exports, {
|
|
|
80
80
|
marketCoins: () => marketCoins,
|
|
81
81
|
queryKeys: () => queryKeys,
|
|
82
82
|
sCoinIds: () => sCoinIds,
|
|
83
|
+
sCoinRawNameToName: () => sCoinRawNameToName,
|
|
83
84
|
sCoinTypeToName: () => sCoinTypeToName,
|
|
84
85
|
sCoins: () => sCoins,
|
|
85
86
|
spoolRewardCoins: () => spoolRewardCoins,
|
|
@@ -115,9 +116,10 @@ var COIN_GECKGO_IDS = {
|
|
|
115
116
|
afsui: "sui",
|
|
116
117
|
hasui: "sui",
|
|
117
118
|
vsui: "sui",
|
|
118
|
-
sca: "scallop-2"
|
|
119
|
-
|
|
120
|
-
|
|
119
|
+
sca: "scallop-2"
|
|
120
|
+
// TODO: enable for production
|
|
121
|
+
// deep: 'deepbook',
|
|
122
|
+
// fud: 'fud-the-pug',
|
|
121
123
|
};
|
|
122
124
|
|
|
123
125
|
// src/constants/common.ts
|
|
@@ -125,7 +127,7 @@ var API_BASE_URL = "https://sui.apis.scallop.io";
|
|
|
125
127
|
var SDK_API_BASE_URL = "https://sdk.api.scallop.io";
|
|
126
128
|
var IS_VE_SCA_TEST = false;
|
|
127
129
|
var USE_TEST_ADDRESS = false;
|
|
128
|
-
var ADDRESSES_ID = IS_VE_SCA_TEST || USE_TEST_ADDRESS ? "65fb07c39c845425d71d7b18" : "
|
|
130
|
+
var ADDRESSES_ID = IS_VE_SCA_TEST || USE_TEST_ADDRESS ? "65fb07c39c845425d71d7b18" : "675c65cd301dd817ea262e76";
|
|
129
131
|
var PROTOCOL_OBJECT_ID = IS_VE_SCA_TEST ? "0xc9f859f98ca352a11b97a038c4b4162bee437b8df8caa047990fe9cb03d4f778" : "0xefe8b36d5b2e43728cc323298626b83177803521d195cfb11e15b910e892fddf";
|
|
130
132
|
var BORROW_FEE_PROTOCOL_ID = IS_VE_SCA_TEST ? "0xc9f859f98ca352a11b97a038c4b4162bee437b8df8caa047990fe9cb03d4f778" : "0xc38f849e81cfe46d4e4320f508ea7dda42934a329d5a6571bb4c3cb6ea63f5da";
|
|
131
133
|
var SCA_COIN_TYPE = IS_VE_SCA_TEST ? `0x6cd813061a3adf3602b76545f076205f0c8e7ec1d3b1eab9a1da7992c18c0524::sca::SCA` : "0x7016aae72cfc67f2fadf55769c0a7dd54291a583b63051a5ed71081cce836ac6::sca::SCA";
|
|
@@ -146,9 +148,10 @@ var SUPPORT_POOLS = [
|
|
|
146
148
|
"afsui",
|
|
147
149
|
"hasui",
|
|
148
150
|
"vsui",
|
|
149
|
-
"sca"
|
|
150
|
-
|
|
151
|
-
|
|
151
|
+
"sca"
|
|
152
|
+
// TODO: enable for production
|
|
153
|
+
// 'fud',
|
|
154
|
+
// 'deep',
|
|
152
155
|
];
|
|
153
156
|
var SUPPORT_COLLATERALS = [
|
|
154
157
|
"usdc",
|
|
@@ -193,6 +196,9 @@ var SUPPORT_SCOIN = [
|
|
|
193
196
|
"scetus",
|
|
194
197
|
"swsol",
|
|
195
198
|
"swbtc"
|
|
199
|
+
// TODO: enable for production
|
|
200
|
+
// 'sdeep',
|
|
201
|
+
// 'sfud',
|
|
196
202
|
];
|
|
197
203
|
var SUPPORT_SUI_BRIDGE = ["sbeth"];
|
|
198
204
|
var SUPPORT_WORMHOLE = [
|
|
@@ -216,7 +222,10 @@ var SUPPORT_BORROW_INCENTIVE_POOLS = [
|
|
|
216
222
|
"sca",
|
|
217
223
|
"usdc"
|
|
218
224
|
];
|
|
219
|
-
var SUPPORT_BORROW_INCENTIVE_REWARDS = [
|
|
225
|
+
var SUPPORT_BORROW_INCENTIVE_REWARDS = [
|
|
226
|
+
...SUPPORT_POOLS,
|
|
227
|
+
...SUPPORT_SCOIN
|
|
228
|
+
];
|
|
220
229
|
var SUPPORT_ORACLES = ["supra", "switchboard", "pyth"];
|
|
221
230
|
var SUPPORT_PACKAGES = [
|
|
222
231
|
"coinDecimalsRegistry",
|
|
@@ -249,8 +258,9 @@ var coinDecimals = {
|
|
|
249
258
|
hasui: 9,
|
|
250
259
|
vsui: 9,
|
|
251
260
|
sca: 9,
|
|
252
|
-
|
|
253
|
-
|
|
261
|
+
// TODO: enable for production
|
|
262
|
+
// deep: 6,
|
|
263
|
+
// fud: 5,
|
|
254
264
|
susdc: 6,
|
|
255
265
|
sweth: 8,
|
|
256
266
|
ssbeth: 8,
|
|
@@ -264,9 +274,10 @@ var coinDecimals = {
|
|
|
264
274
|
safsui: 9,
|
|
265
275
|
shasui: 9,
|
|
266
276
|
svsui: 9,
|
|
267
|
-
ssca: 9
|
|
268
|
-
|
|
269
|
-
|
|
277
|
+
ssca: 9
|
|
278
|
+
// TODO: enable for production
|
|
279
|
+
// sdeep: 6,
|
|
280
|
+
// sfud: 5,
|
|
270
281
|
};
|
|
271
282
|
var assetCoins = {
|
|
272
283
|
usdc: "usdc",
|
|
@@ -282,9 +293,10 @@ var assetCoins = {
|
|
|
282
293
|
afsui: "afsui",
|
|
283
294
|
hasui: "hasui",
|
|
284
295
|
vsui: "vsui",
|
|
285
|
-
sca: "sca"
|
|
286
|
-
|
|
287
|
-
|
|
296
|
+
sca: "sca"
|
|
297
|
+
// TODO: enable for production
|
|
298
|
+
// deep: 'deep',
|
|
299
|
+
// fud: 'fud',
|
|
288
300
|
};
|
|
289
301
|
var marketCoins = {
|
|
290
302
|
susdc: "susdc",
|
|
@@ -300,9 +312,10 @@ var marketCoins = {
|
|
|
300
312
|
safsui: "safsui",
|
|
301
313
|
shasui: "shasui",
|
|
302
314
|
svsui: "svsui",
|
|
303
|
-
ssca: "ssca"
|
|
304
|
-
|
|
305
|
-
|
|
315
|
+
ssca: "ssca"
|
|
316
|
+
// TODO: enable for production
|
|
317
|
+
// sdeep: 'sdeep',
|
|
318
|
+
// sfud: 'sfud',
|
|
306
319
|
};
|
|
307
320
|
var sCoins = {
|
|
308
321
|
susdc: "susdc",
|
|
@@ -318,6 +331,9 @@ var sCoins = {
|
|
|
318
331
|
ssca: "ssca",
|
|
319
332
|
swsol: "swsol",
|
|
320
333
|
swbtc: "swbtc"
|
|
334
|
+
// TODO: enable for production
|
|
335
|
+
// sfud: 'sfud',
|
|
336
|
+
// sdeep: 'sdeep',
|
|
321
337
|
};
|
|
322
338
|
var stakeMarketCoins = {
|
|
323
339
|
susdc: "susdc",
|
|
@@ -345,16 +361,16 @@ var suiBridgeCoins = {
|
|
|
345
361
|
sbeth: "sbeth"
|
|
346
362
|
};
|
|
347
363
|
var borrowIncentiveRewardCoins = {
|
|
348
|
-
usdc: ["
|
|
349
|
-
sui: ["
|
|
350
|
-
wusdc: ["
|
|
351
|
-
wusdt: ["
|
|
352
|
-
sca: ["
|
|
353
|
-
afsui: ["
|
|
354
|
-
hasui: ["
|
|
355
|
-
vsui: ["
|
|
356
|
-
weth: ["
|
|
357
|
-
sbeth: ["
|
|
364
|
+
usdc: ["ssui", "ssca"],
|
|
365
|
+
sui: ["ssui", "ssca"],
|
|
366
|
+
wusdc: ["ssui", "ssca"],
|
|
367
|
+
wusdt: ["ssui", "ssca"],
|
|
368
|
+
sca: ["ssui", "ssca"],
|
|
369
|
+
afsui: ["ssui"],
|
|
370
|
+
hasui: ["ssui"],
|
|
371
|
+
vsui: ["ssui"],
|
|
372
|
+
weth: ["ssui"],
|
|
373
|
+
sbeth: ["ssui"]
|
|
358
374
|
};
|
|
359
375
|
var coinIds = {
|
|
360
376
|
usdc: "0xdba34672e30cb065b1f93e3ab55318768fd6fef66c15942c9f7cb846e2f900e7",
|
|
@@ -370,10 +386,10 @@ var coinIds = {
|
|
|
370
386
|
afsui: "0xf325ce1300e8dac124071d3152c5c5ee6174914f8bc2161e88329cf579246efc",
|
|
371
387
|
hasui: "0xbde4ba4c2e274a60ce15c1cfff9e5c42e41654ac8b6d906a57efa4bd3c29f47d",
|
|
372
388
|
vsui: "0x549e8b69270defbfafd4f94e17ec44cdbdd99820b33bda2278dea3b9a32d3f55",
|
|
373
|
-
sca: IS_VE_SCA_TEST ? "0x6cd813061a3adf3602b76545f076205f0c8e7ec1d3b1eab9a1da7992c18c0524" : "0x7016aae72cfc67f2fadf55769c0a7dd54291a583b63051a5ed71081cce836ac6"
|
|
389
|
+
sca: IS_VE_SCA_TEST ? "0x6cd813061a3adf3602b76545f076205f0c8e7ec1d3b1eab9a1da7992c18c0524" : "0x7016aae72cfc67f2fadf55769c0a7dd54291a583b63051a5ed71081cce836ac6"
|
|
374
390
|
// isolated assets
|
|
375
|
-
deep:
|
|
376
|
-
fud:
|
|
391
|
+
// deep: '0xdeeb7a4662eec9f2f3def03fb937a663dddaa2e215b8078a284d026b7946c270',
|
|
392
|
+
// fud: '0x76cb819b01abed502bee8a702b4c2d547532c12f25001c9dea795a5e631c26f1',
|
|
377
393
|
};
|
|
378
394
|
var wormholeCoinIds = {
|
|
379
395
|
weth: "0xaf8cd5edc19c4512f4259f0bee101a40d41ebed738ade5874359610ef8eeced5",
|
|
@@ -389,33 +405,28 @@ var voloCoinIds = {
|
|
|
389
405
|
var sCoinIds = {
|
|
390
406
|
susdc: "0x854950aa624b1df59fe64e630b2ba7c550642e9342267a33061d59fb31582da5::scallop_usdc::SCALLOP_USDC",
|
|
391
407
|
ssbeth: "0xb14f82d8506d139eacef109688d1b71e7236bcce9b2c0ad526abcd6aa5be7de0::scallop_sb_eth::SCALLOP_SB_ETH",
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
408
|
+
// prod values
|
|
409
|
+
// ssui: '0xaafc4f740de0dd0dde642a31148fb94517087052f19afb0f7bed1dc41a50c77b::scallop_sui::SCALLOP_SUI',
|
|
410
|
+
// swusdc:
|
|
411
|
+
// '0xad4d71551d31092230db1fd482008ea42867dbf27b286e9c70a79d2a6191d58d::scallop_wormhole_usdc::SCALLOP_WORMHOLE_USDC',
|
|
412
|
+
// swusdt:
|
|
413
|
+
// '0xe6e5a012ec20a49a3d1d57bd2b67140b96cd4d3400b9d79e541f7bdbab661f95::scallop_wormhole_usdt::SCALLOP_WORMHOLE_USDT',
|
|
414
|
+
// ssca: '0x5ca17430c1d046fae9edeaa8fd76c7b4193a00d764a0ecfa9418d733ad27bc1e::scallop_sca::SCALLOP_SCA',
|
|
415
|
+
// test values
|
|
416
|
+
ssui: "0xf569919046f19a0c40b519ecfbb6ca0319698cd5908716c29b62ef56541f298b::scallop_sui::SCALLOP_SUI",
|
|
417
|
+
swusdt: "0xac781d9f73058ff5e69f9bf8dde32f2e8c71c66d7fe8497fc83b2d9182254b22::scallop_wormhole_usdt::SCALLOP_WORMHOLE_USDT",
|
|
418
|
+
swusdc: "0xf5447c4305a486d8c8557559887c2c39449ddb5e748f15d33946d02a1663c158::scallop_wormhole_usdc::SCALLOP_WORMHOLE_USDC",
|
|
419
|
+
ssca: "0x958428555e778e55918a59eb1c92c77f32b5c554fa3a5e56cd0815086b5072e7::scallop_sca::SCALLOP_SCA",
|
|
397
420
|
scetus: "0xea346ce428f91ab007210443efcea5f5cdbbb3aae7e9affc0ca93f9203c31f0c::scallop_cetus::SCALLOP_CETUS",
|
|
398
|
-
ssca: (
|
|
399
|
-
// TODO: use prod value
|
|
400
|
-
// '0x5ca17430c1d046fae9edeaa8fd76c7b4193a00d764a0ecfa9418d733ad27bc1e::scallop_sca::SCALLOP_SCA',
|
|
401
|
-
"0x958428555e778e55918a59eb1c92c77f32b5c554fa3a5e56cd0815086b5072e7::scallop_sca::SCALLOP_SCA"
|
|
402
|
-
),
|
|
403
|
-
swusdc: (
|
|
404
|
-
// TODO: use prod value
|
|
405
|
-
// '0xad4d71551d31092230db1fd482008ea42867dbf27b286e9c70a79d2a6191d58d::scallop_wormhole_usdc::SCALLOP_WORMHOLE_USDC',
|
|
406
|
-
"0xf5447c4305a486d8c8557559887c2c39449ddb5e748f15d33946d02a1663c158::scallop_wormhole_usdc::SCALLOP_WORMHOLE_USDC"
|
|
407
|
-
),
|
|
408
|
-
swusdt: (
|
|
409
|
-
// TODO: use prod value
|
|
410
|
-
// '0xe6e5a012ec20a49a3d1d57bd2b67140b96cd4d3400b9d79e541f7bdbab661f95::scallop_wormhole_usdt::SCALLOP_WORMHOLE_USDT',
|
|
411
|
-
"0xac781d9f73058ff5e69f9bf8dde32f2e8c71c66d7fe8497fc83b2d9182254b22::scallop_wormhole_usdt::SCALLOP_WORMHOLE_USDT"
|
|
412
|
-
),
|
|
413
421
|
sweth: "0x67540ceb850d418679e69f1fb6b2093d6df78a2a699ffc733f7646096d552e9b::scallop_wormhole_eth::SCALLOP_WORMHOLE_ETH",
|
|
414
422
|
safsui: "0x00671b1fa2a124f5be8bdae8b91ee711462c5d9e31bda232e70fd9607b523c88::scallop_af_sui::SCALLOP_AF_SUI",
|
|
415
423
|
shasui: "0x9a2376943f7d22f88087c259c5889925f332ca4347e669dc37d54c2bf651af3c::scallop_ha_sui::SCALLOP_HA_SUI",
|
|
416
424
|
svsui: "0xe1a1cc6bcf0001a015eab84bcc6713393ce20535f55b8b6f35c142e057a25fbe::scallop_v_sui::SCALLOP_V_SUI",
|
|
417
425
|
swsol: "0x1392650f2eca9e3f6ffae3ff89e42a3590d7102b80e2b430f674730bc30d3259::scallop_wormhole_sol::SCALLOP_WORMHOLE_SOL",
|
|
418
426
|
swbtc: "0x2cf76a9cf5d3337961d1154283234f94da2dcff18544dfe5cbdef65f319591b5::scallop_wormhole_btc::SCALLOP_WORMHOLE_BTC"
|
|
427
|
+
// sdeep:
|
|
428
|
+
// '0xeb7a05a3224837c5e5503575aed0be73c091d1ce5e43aa3c3e716e0ae614608f::scallop_deep::SCALLOP_DEEP',
|
|
429
|
+
// sfud: '0xe56d5167f427cbe597da9e8150ef5c337839aaf46891d62468dcf80bdd8e10d1::scallop_fud::SCALLOP_FUD',
|
|
419
430
|
};
|
|
420
431
|
var sCoinTypeToName = Object.entries(sCoinIds).reduce(
|
|
421
432
|
(acc, [coinName, coinType]) => {
|
|
@@ -424,6 +435,13 @@ var sCoinTypeToName = Object.entries(sCoinIds).reduce(
|
|
|
424
435
|
},
|
|
425
436
|
{}
|
|
426
437
|
);
|
|
438
|
+
var sCoinRawNameToName = Object.entries(sCoinIds).reduce(
|
|
439
|
+
(acc, [coinName, coinType]) => {
|
|
440
|
+
acc[coinType.split("::")[2].toLowerCase()] = coinName;
|
|
441
|
+
return acc;
|
|
442
|
+
},
|
|
443
|
+
{}
|
|
444
|
+
);
|
|
427
445
|
|
|
428
446
|
// src/constants/flashloan.ts
|
|
429
447
|
var FlashLoanFeeObjectMap = {
|
|
@@ -498,13 +516,16 @@ var POOL_ADDRESSES = {
|
|
|
498
516
|
sca: {
|
|
499
517
|
lendingPoolAddress: "0x6fc7d4211fc7018b6c75e7b908b88f2e0536443239804a3d32af547637bd28d7",
|
|
500
518
|
collateralPoolAddress: "0xff677a5d9e9dc8f08f0a8681ebfc7481d1c7d57bc441f2881974adcdd7b13c31"
|
|
501
|
-
},
|
|
502
|
-
fud: {
|
|
503
|
-
lendingPoolAddress: ""
|
|
504
|
-
},
|
|
505
|
-
deep: {
|
|
506
|
-
lendingPoolAddress: ""
|
|
507
519
|
}
|
|
520
|
+
// TODO: enable for production
|
|
521
|
+
// fud: {
|
|
522
|
+
// lendingPoolAddress:
|
|
523
|
+
// '0x14367ddca30e2860cb89ed4eaca20c7ece260c5d59dd9990d2c85a8321326acb',
|
|
524
|
+
// },
|
|
525
|
+
// deep: {
|
|
526
|
+
// lendingPoolAddress:
|
|
527
|
+
// '0xf4a67ffb43da1e1c61c049f188f19463ea8dbbf2d5ef4722d6df854ff1b1cc03',
|
|
528
|
+
// },
|
|
508
529
|
};
|
|
509
530
|
|
|
510
531
|
// src/constants/pyth.ts
|
|
@@ -526,9 +547,10 @@ var PYTH_FEED_IDS = {
|
|
|
526
547
|
afsui: "23d7315113f5b1d3ba7a83604c44b94d79f4fd69af77f804fc7f920a6dc65744",
|
|
527
548
|
hasui: "23d7315113f5b1d3ba7a83604c44b94d79f4fd69af77f804fc7f920a6dc65744",
|
|
528
549
|
vsui: "23d7315113f5b1d3ba7a83604c44b94d79f4fd69af77f804fc7f920a6dc65744",
|
|
529
|
-
sca: "7e17f0ac105abe9214deb9944c30264f5986bf292869c6bd8e8da3ccd92d79bc"
|
|
530
|
-
|
|
531
|
-
|
|
550
|
+
sca: "7e17f0ac105abe9214deb9944c30264f5986bf292869c6bd8e8da3ccd92d79bc"
|
|
551
|
+
// TODO: enable for production
|
|
552
|
+
// deep: '29bdd5248234e33bd93d3b81100b5fa32eaa5997843847e2c2cb16d7c6d9f7ff',
|
|
553
|
+
// fud: '6a4090703da959247727f2b490eb21aea95c8684ecfac675f432008830890c75',
|
|
532
554
|
};
|
|
533
555
|
|
|
534
556
|
// src/constants/queryKeys.ts
|
|
@@ -1053,7 +1075,7 @@ var TEST_ADDRESSES = {
|
|
|
1053
1075
|
};
|
|
1054
1076
|
|
|
1055
1077
|
// src/constants/tokenBucket.ts
|
|
1056
|
-
var DEFAULT_TOKENS_PER_INTERVAL =
|
|
1078
|
+
var DEFAULT_TOKENS_PER_INTERVAL = 50;
|
|
1057
1079
|
var DEFAULT_INTERVAL_IN_MS = 300;
|
|
1058
1080
|
|
|
1059
1081
|
// src/constants/vesca.ts
|
|
@@ -2565,15 +2587,22 @@ var queryBorrowIncentivePools = async (address) => {
|
|
|
2565
2587
|
};
|
|
2566
2588
|
var getBorrowIncentivePools = async (query, borrowIncentiveCoinNames = [
|
|
2567
2589
|
...SUPPORT_BORROW_INCENTIVE_POOLS
|
|
2568
|
-
], indexer = false, coinPrices) => {
|
|
2590
|
+
], indexer = false, marketPools, coinPrices) => {
|
|
2569
2591
|
const borrowIncentivePools = {};
|
|
2570
|
-
|
|
2592
|
+
marketPools = marketPools ?? await query.getMarketPools(void 0, false, { coinPrices });
|
|
2593
|
+
coinPrices = coinPrices ?? await query.getAllCoinPrices({ marketPools });
|
|
2594
|
+
console.log({ coinPrices });
|
|
2571
2595
|
if (indexer) {
|
|
2572
2596
|
const borrowIncentivePoolsIndexer = await query.indexer.getBorrowIncentivePools();
|
|
2573
2597
|
const updateBorrowIncentivePool = (pool) => {
|
|
2574
2598
|
if (!borrowIncentiveCoinNames.includes(pool.coinName))
|
|
2575
2599
|
return;
|
|
2576
|
-
pool.coinPrice = coinPrices[pool.coinName]
|
|
2600
|
+
pool.coinPrice = coinPrices[pool.coinName] || pool.coinPrice;
|
|
2601
|
+
for (const sCoinName of SUPPORT_BORROW_INCENTIVE_REWARDS) {
|
|
2602
|
+
if (pool.points[sCoinName]) {
|
|
2603
|
+
pool.points[sCoinName].coinPrice = coinPrices[sCoinName] ?? pool.points[sCoinName].coinPrice;
|
|
2604
|
+
}
|
|
2605
|
+
}
|
|
2577
2606
|
borrowIncentivePools[pool.coinName] = pool;
|
|
2578
2607
|
};
|
|
2579
2608
|
Object.values(borrowIncentivePoolsIndexer).forEach(
|
|
@@ -2599,12 +2628,15 @@ var getBorrowIncentivePools = async (query, borrowIncentiveCoinNames = [
|
|
|
2599
2628
|
for (const [coinName, poolPoint] of Object.entries(
|
|
2600
2629
|
parsedBorrowIncentivePoolData.poolPoints
|
|
2601
2630
|
)) {
|
|
2602
|
-
const rewardCoinType =
|
|
2603
|
-
|
|
2631
|
+
const rewardCoinType = poolPoint.pointType;
|
|
2632
|
+
let rewardCoinName = query.utils.parseCoinNameFromType(
|
|
2604
2633
|
rewardCoinType
|
|
2605
2634
|
);
|
|
2606
|
-
|
|
2635
|
+
if (sCoinRawNameToName[rewardCoinName]) {
|
|
2636
|
+
rewardCoinName = sCoinRawNameToName[rewardCoinName];
|
|
2637
|
+
}
|
|
2607
2638
|
const rewardCoinDecimal = query.utils.getCoinDecimal(rewardCoinName);
|
|
2639
|
+
const rewardCoinPrice = coinPrices?.[rewardCoinName] ?? 0;
|
|
2608
2640
|
const symbol = query.utils.parseSymbol(rewardCoinName);
|
|
2609
2641
|
const coinDecimal = query.utils.getCoinDecimal(rewardCoinName);
|
|
2610
2642
|
const calculatedPoolPoint = calculateBorrowIncentivePoolPointData(
|
|
@@ -3037,7 +3069,7 @@ var getMarketPools = async (query, poolCoinNames = [...SUPPORT_POOLS], indexer =
|
|
|
3037
3069
|
const marketObjectResponse = await query.cache.queryGetObject(marketId, {
|
|
3038
3070
|
showContent: true
|
|
3039
3071
|
});
|
|
3040
|
-
coinPrices = await query.utils.getCoinPrices(
|
|
3072
|
+
coinPrices = coinPrices ?? await query.utils.getCoinPrices();
|
|
3041
3073
|
const marketPools = {};
|
|
3042
3074
|
if (indexer) {
|
|
3043
3075
|
const marketPoolsIndexer = await query.indexer.getMarketPools();
|
|
@@ -3071,7 +3103,7 @@ var getMarketPools = async (query, poolCoinNames = [...SUPPORT_POOLS], indexer =
|
|
|
3071
3103
|
};
|
|
3072
3104
|
var getMarketPool = async (query, poolCoinName, indexer = false, marketObject, coinPrice) => {
|
|
3073
3105
|
try {
|
|
3074
|
-
coinPrice = coinPrice
|
|
3106
|
+
coinPrice = coinPrice ?? (await query.utils.getCoinPrices())?.[poolCoinName];
|
|
3075
3107
|
if (indexer) {
|
|
3076
3108
|
const marketPoolIndexer = await query.indexer.getMarketPool(poolCoinName);
|
|
3077
3109
|
if (!marketPoolIndexer) {
|
|
@@ -3217,7 +3249,7 @@ var getMarketPool = async (query, poolCoinName, indexer = false, marketObject, c
|
|
|
3217
3249
|
};
|
|
3218
3250
|
var getMarketCollaterals = async (query, collateralCoinNames = [...SUPPORT_COLLATERALS], indexer = false) => {
|
|
3219
3251
|
const marketId = query.address.get("core.market");
|
|
3220
|
-
const coinPrices = await query.utils.getCoinPrices(
|
|
3252
|
+
const coinPrices = await query.utils.getCoinPrices() ?? {};
|
|
3221
3253
|
const marketCollaterals = {};
|
|
3222
3254
|
if (indexer) {
|
|
3223
3255
|
const marketCollateralsIndexer = await query.indexer.getMarketCollaterals();
|
|
@@ -3253,7 +3285,7 @@ var getMarketCollaterals = async (query, collateralCoinNames = [...SUPPORT_COLLA
|
|
|
3253
3285
|
return marketCollaterals;
|
|
3254
3286
|
};
|
|
3255
3287
|
var getMarketCollateral = async (query, collateralCoinName, indexer = false, marketObject, coinPrice) => {
|
|
3256
|
-
coinPrice = coinPrice
|
|
3288
|
+
coinPrice = coinPrice ?? (await query.utils.getCoinPrices())?.[collateralCoinName];
|
|
3257
3289
|
if (indexer) {
|
|
3258
3290
|
const marketCollateralIndexer = await query.indexer.getMarketCollateral(collateralCoinName);
|
|
3259
3291
|
marketCollateralIndexer.coinPrice = coinPrice ?? marketCollateralIndexer.coinPrice;
|
|
@@ -3569,7 +3601,7 @@ var getLendings = async (query, poolCoinNames = [...SUPPORT_POOLS], ownerAddress
|
|
|
3569
3601
|
const stakeMarketCoinNames = marketCoinNames.filter(
|
|
3570
3602
|
(marketCoinName) => SUPPORT_SPOOLS.includes(marketCoinName)
|
|
3571
3603
|
);
|
|
3572
|
-
const coinPrices = await query.utils.getCoinPrices(
|
|
3604
|
+
const coinPrices = await query.utils.getCoinPrices();
|
|
3573
3605
|
const marketPools = await query.getMarketPools(poolCoinNames, indexer, {
|
|
3574
3606
|
coinPrices
|
|
3575
3607
|
});
|
|
@@ -3607,7 +3639,7 @@ var getLendings = async (query, poolCoinNames = [...SUPPORT_POOLS], ownerAddress
|
|
|
3607
3639
|
};
|
|
3608
3640
|
var getLending = async (query, poolCoinName, ownerAddress, indexer = false, marketPool, spool, stakeAccounts, coinAmount, marketCoinAmount, coinPrice, sCoinAmount) => {
|
|
3609
3641
|
const marketCoinName = query.utils.parseMarketCoinName(poolCoinName);
|
|
3610
|
-
coinPrice = coinPrice ?? (await query.utils.getCoinPrices(
|
|
3642
|
+
coinPrice = coinPrice ?? (await query.utils.getCoinPrices())?.[poolCoinName] ?? 0;
|
|
3611
3643
|
marketPool = marketPool ?? await query.getMarketPool(poolCoinName, indexer, {
|
|
3612
3644
|
coinPrice
|
|
3613
3645
|
});
|
|
@@ -3767,7 +3799,7 @@ var getObligationAccount = async (query, obligationId, ownerAddress, indexer = f
|
|
|
3767
3799
|
const collateralAssetCoinNames = [
|
|
3768
3800
|
...SUPPORT_COLLATERALS
|
|
3769
3801
|
];
|
|
3770
|
-
coinPrices = coinPrices ?? await query.utils.getCoinPrices(
|
|
3802
|
+
coinPrices = coinPrices ?? await query.utils.getCoinPrices();
|
|
3771
3803
|
market = market ?? await query.queryMarket(indexer, { coinPrices });
|
|
3772
3804
|
coinAmounts = coinAmounts || await query.getCoinAmounts(collateralAssetCoinNames, ownerAddress);
|
|
3773
3805
|
const [obligationQuery, borrowIncentivePools, borrowIncentiveAccounts] = await Promise.all([
|
|
@@ -4090,6 +4122,7 @@ var getTotalValueLocked = async (query, indexer = false) => {
|
|
|
4090
4122
|
};
|
|
4091
4123
|
|
|
4092
4124
|
// src/queries/priceQuery.ts
|
|
4125
|
+
var import_bignumber6 = __toESM(require("bignumber.js"));
|
|
4093
4126
|
var getPythPrice = async ({
|
|
4094
4127
|
address
|
|
4095
4128
|
}, assetCoinName, priceFeedObject) => {
|
|
@@ -4128,10 +4161,12 @@ var getPythPrices = async ({
|
|
|
4128
4161
|
const pythPriceFeed = address.get(
|
|
4129
4162
|
`core.coins.${assetCoinName}.oracle.pyth.feedObject`
|
|
4130
4163
|
);
|
|
4131
|
-
if (
|
|
4132
|
-
prev[pythPriceFeed]
|
|
4133
|
-
|
|
4134
|
-
|
|
4164
|
+
if (pythPriceFeed) {
|
|
4165
|
+
if (!prev[pythPriceFeed]) {
|
|
4166
|
+
prev[pythPriceFeed] = [assetCoinName];
|
|
4167
|
+
} else {
|
|
4168
|
+
prev[pythPriceFeed].push(assetCoinName);
|
|
4169
|
+
}
|
|
4135
4170
|
}
|
|
4136
4171
|
return prev;
|
|
4137
4172
|
},
|
|
@@ -4169,6 +4204,22 @@ var getPythPrices = async ({
|
|
|
4169
4204
|
{}
|
|
4170
4205
|
);
|
|
4171
4206
|
};
|
|
4207
|
+
var getAllCoinPrices = async (query, marketPools, coinPrices) => {
|
|
4208
|
+
coinPrices = coinPrices ?? await query.utils.getCoinPrices();
|
|
4209
|
+
marketPools = marketPools ?? await query.getMarketPools(void 0, void 0, { coinPrices });
|
|
4210
|
+
if (!marketPools) {
|
|
4211
|
+
throw new Error(`Failed to fetch market pool for getAllCoinPrices`);
|
|
4212
|
+
}
|
|
4213
|
+
const sCoinPrices = {};
|
|
4214
|
+
SUPPORT_SCOIN.forEach((sCoinName) => {
|
|
4215
|
+
const coinName = query.utils.parseCoinName(sCoinName);
|
|
4216
|
+
sCoinPrices[sCoinName] = (0, import_bignumber6.default)(coinPrices[coinName] ?? 0).multipliedBy(marketPools[coinName]?.conversionRate ?? 1).toNumber();
|
|
4217
|
+
});
|
|
4218
|
+
return {
|
|
4219
|
+
...coinPrices,
|
|
4220
|
+
...sCoinPrices
|
|
4221
|
+
};
|
|
4222
|
+
};
|
|
4172
4223
|
|
|
4173
4224
|
// src/queries/referralQuery.ts
|
|
4174
4225
|
var queryVeScaKeyIdFromReferralBindings = async (address, refereeAddress) => {
|
|
@@ -4189,7 +4240,7 @@ var queryVeScaKeyIdFromReferralBindings = async (address, refereeAddress) => {
|
|
|
4189
4240
|
// src/queries/sCoinQuery.ts
|
|
4190
4241
|
var import_bcs = require("@mysten/sui/bcs");
|
|
4191
4242
|
var import_assert = __toESM(require("assert"));
|
|
4192
|
-
var
|
|
4243
|
+
var import_bignumber7 = __toESM(require("bignumber.js"));
|
|
4193
4244
|
var getSCoinTotalSupply = async ({
|
|
4194
4245
|
utils
|
|
4195
4246
|
}, sCoinName) => {
|
|
@@ -4210,7 +4261,7 @@ var getSCoinTotalSupply = async ({
|
|
|
4210
4261
|
const value = Uint8Array.from(results[0].returnValues[0][0]);
|
|
4211
4262
|
const type = results[0].returnValues[0][1];
|
|
4212
4263
|
(0, import_assert.default)(type === "u64", "Result type is not u64");
|
|
4213
|
-
return (0,
|
|
4264
|
+
return (0, import_bignumber7.default)(import_bcs.bcs.u64().parse(value)).shiftedBy(utils.getCoinDecimal(utils.parseCoinName(sCoinName))).toNumber();
|
|
4214
4265
|
}
|
|
4215
4266
|
return 0;
|
|
4216
4267
|
};
|
|
@@ -4236,7 +4287,7 @@ var getSCoinAmount = async ({
|
|
|
4236
4287
|
owner,
|
|
4237
4288
|
coinType: sCoinType
|
|
4238
4289
|
});
|
|
4239
|
-
return (0,
|
|
4290
|
+
return (0, import_bignumber7.default)(amount).toNumber();
|
|
4240
4291
|
};
|
|
4241
4292
|
var isSupportStakeCoins = (value) => {
|
|
4242
4293
|
return SUPPORT_SCOIN.includes(value);
|
|
@@ -4266,7 +4317,7 @@ var getSCoinSwapRate = async (query, fromSCoin, toSCoin, underlyingCoinPrice) =>
|
|
|
4266
4317
|
const ScoinAToARate = marketPools[0].conversionRate;
|
|
4267
4318
|
const BtoSCoinBRate = 1 / marketPools[1].conversionRate;
|
|
4268
4319
|
const calcAtoBRate = async () => {
|
|
4269
|
-
const prices = await query.utils.getCoinPrices(
|
|
4320
|
+
const prices = await query.utils.getCoinPrices();
|
|
4270
4321
|
if (!prices[fromCoinName] || !prices[toCoinName]) {
|
|
4271
4322
|
throw new Error("Failed to fetch the coin prices");
|
|
4272
4323
|
}
|
|
@@ -4276,7 +4327,7 @@ var getSCoinSwapRate = async (query, fromSCoin, toSCoin, underlyingCoinPrice) =>
|
|
|
4276
4327
|
return prices[fromCoinName] / prices[toCoinName];
|
|
4277
4328
|
};
|
|
4278
4329
|
const AtoBRate = underlyingCoinPrice ?? await calcAtoBRate();
|
|
4279
|
-
return (0,
|
|
4330
|
+
return (0, import_bignumber7.default)(ScoinAToARate).multipliedBy(AtoBRate).multipliedBy(BtoSCoinBRate).toNumber();
|
|
4280
4331
|
};
|
|
4281
4332
|
|
|
4282
4333
|
// src/queries/spoolQuery.ts
|
|
@@ -4336,7 +4387,7 @@ var getSpool = async (query, marketCoinName, indexer = false, marketPool, coinPr
|
|
|
4336
4387
|
`spool.pools.${marketCoinName}.rewardPoolId`
|
|
4337
4388
|
);
|
|
4338
4389
|
let spool = void 0;
|
|
4339
|
-
coinPrices = coinPrices || await query.utils.getCoinPrices(
|
|
4390
|
+
coinPrices = coinPrices || await query.utils.getCoinPrices();
|
|
4340
4391
|
if (indexer) {
|
|
4341
4392
|
const spoolIndexer = await query.indexer.getSpool(marketCoinName);
|
|
4342
4393
|
const coinName2 = query.utils.parseCoinName(marketCoinName);
|
|
@@ -4356,7 +4407,7 @@ var getSpool = async (query, marketCoinName, indexer = false, marketPool, coinPr
|
|
|
4356
4407
|
throw new Error("Fail to fetch spoolObjectResponse!");
|
|
4357
4408
|
}
|
|
4358
4409
|
const rewardCoinName = query.utils.getSpoolRewardCoinName(marketCoinName);
|
|
4359
|
-
coinPrices = coinPrices || await query.utils.getCoinPrices(
|
|
4410
|
+
coinPrices = coinPrices || await query.utils.getCoinPrices();
|
|
4360
4411
|
const spoolObject = spoolObjectResponse[0];
|
|
4361
4412
|
const rewardPoolObject = spoolObjectResponse[1];
|
|
4362
4413
|
if (spoolObject.content && "fields" in spoolObject.content) {
|
|
@@ -4600,7 +4651,7 @@ var getStakeRewardPool = async ({
|
|
|
4600
4651
|
};
|
|
4601
4652
|
|
|
4602
4653
|
// src/queries/vescaQuery.ts
|
|
4603
|
-
var
|
|
4654
|
+
var import_bignumber8 = __toESM(require("bignumber.js"));
|
|
4604
4655
|
var import_sui_kit3 = require("@scallop-io/sui-kit");
|
|
4605
4656
|
var import_bcs2 = require("@mysten/sui/bcs");
|
|
4606
4657
|
var import_zod5 = require("zod");
|
|
@@ -4682,7 +4733,7 @@ var getVeSca = async (utils, veScaKey) => {
|
|
|
4682
4733
|
0
|
|
4683
4734
|
);
|
|
4684
4735
|
const lockedScaAmount = String(dynamicFields.locked_sca_amount);
|
|
4685
|
-
const lockedScaCoin = (0,
|
|
4736
|
+
const lockedScaCoin = (0, import_bignumber8.default)(dynamicFields.locked_sca_amount).shiftedBy(-9).toNumber();
|
|
4686
4737
|
const currentVeScaBalance = lockedScaCoin * (Math.floor(remainingLockPeriodInMilliseconds / 1e3) / MAX_LOCK_DURATION);
|
|
4687
4738
|
vesca = {
|
|
4688
4739
|
id: veScaDynamicFieldObject.objectId,
|
|
@@ -4692,7 +4743,7 @@ var getVeSca = async (utils, veScaKey) => {
|
|
|
4692
4743
|
lockedScaAmount,
|
|
4693
4744
|
lockedScaCoin,
|
|
4694
4745
|
currentVeScaBalance,
|
|
4695
|
-
unlockAt: (0,
|
|
4746
|
+
unlockAt: (0, import_bignumber8.default)(dynamicFields.unlock_at * 1e3).toNumber()
|
|
4696
4747
|
};
|
|
4697
4748
|
}
|
|
4698
4749
|
return vesca;
|
|
@@ -4754,10 +4805,10 @@ var getVeScaTreasuryInfo = async (utils) => {
|
|
|
4754
4805
|
if (!veScaTreasury || veScaTreasury.data?.content?.dataType !== "moveObject")
|
|
4755
4806
|
return null;
|
|
4756
4807
|
const treasuryFields = veScaTreasury.data.content.fields;
|
|
4757
|
-
const totalLockedSca = (0,
|
|
4808
|
+
const totalLockedSca = (0, import_bignumber8.default)(
|
|
4758
4809
|
treasuryFields.unlock_schedule.fields.locked_sca_amount
|
|
4759
4810
|
).shiftedBy(-9).toNumber();
|
|
4760
|
-
const totalVeSca = (0,
|
|
4811
|
+
const totalVeSca = (0, import_bignumber8.default)(
|
|
4761
4812
|
await getTotalVeScaTreasuryAmount(utils, veScaTreasury.data) ?? 0
|
|
4762
4813
|
).shiftedBy(-9).toNumber();
|
|
4763
4814
|
const averageLockingPeriod = totalLockedSca > 0 ? totalVeSca / totalLockedSca * 4 : 0;
|
|
@@ -4926,6 +4977,15 @@ var ScallopUtils = class {
|
|
|
4926
4977
|
return void 0;
|
|
4927
4978
|
}
|
|
4928
4979
|
}
|
|
4980
|
+
/**
|
|
4981
|
+
* Convert sCoin name to coin name.
|
|
4982
|
+
* This function will parse new sCoin name `scallop_...` to its old market coin name which is shorter
|
|
4983
|
+
* e.g: `scallop_sui -> ssui
|
|
4984
|
+
* @return sCoin name
|
|
4985
|
+
*/
|
|
4986
|
+
parseCoinNameFromSCoinName(coinName) {
|
|
4987
|
+
return sCoinRawNameToName[coinName];
|
|
4988
|
+
}
|
|
4929
4989
|
/**
|
|
4930
4990
|
* Convert sCoin name into sCoin type
|
|
4931
4991
|
* @param sCoinName
|
|
@@ -4977,7 +5037,7 @@ var ScallopUtils = class {
|
|
|
4977
5037
|
const coinTypeMatch = coinType.match(coinTypeRegex);
|
|
4978
5038
|
const isMarketCoinType = coinType.includes("reserve::MarketCoin");
|
|
4979
5039
|
coinType = coinTypeMatch?.[1] ?? coinType;
|
|
4980
|
-
const
|
|
5040
|
+
const wormholeCoinTypeMap = {
|
|
4981
5041
|
[`${this.address.get("core.coins.wusdc.id") ?? wormholeCoinIds.wusdc}::coin::COIN`]: "wusdc",
|
|
4982
5042
|
[`${this.address.get("core.coins.wusdt.id") ?? wormholeCoinIds.wusdt}::coin::COIN`]: "wusdt",
|
|
4983
5043
|
[`${this.address.get("core.coins.weth.id") ?? wormholeCoinIds.weth}::coin::COIN`]: "weth",
|
|
@@ -4997,7 +5057,7 @@ var ScallopUtils = class {
|
|
|
4997
5057
|
},
|
|
4998
5058
|
{}
|
|
4999
5059
|
);
|
|
5000
|
-
const assetCoinName =
|
|
5060
|
+
const assetCoinName = wormholeCoinTypeMap[coinType] || voloCoinTypeMap[coinType] || suiBridgeTypeMap[coinType] || coinType.split("::")[2].toLowerCase();
|
|
5001
5061
|
return isMarketCoinType ? this.parseMarketCoinName(assetCoinName) : assetCoinName;
|
|
5002
5062
|
}
|
|
5003
5063
|
/**
|
|
@@ -7380,6 +7440,7 @@ var ScallopQuery = class {
|
|
|
7380
7440
|
this,
|
|
7381
7441
|
coinNames,
|
|
7382
7442
|
indexer,
|
|
7443
|
+
args?.marketPools,
|
|
7383
7444
|
args?.coinPrices
|
|
7384
7445
|
);
|
|
7385
7446
|
}
|
|
@@ -7595,6 +7656,13 @@ var ScallopQuery = class {
|
|
|
7595
7656
|
async getCoinPriceByIndexer(poolName) {
|
|
7596
7657
|
return this.indexer.getCoinPrice(poolName);
|
|
7597
7658
|
}
|
|
7659
|
+
/**
|
|
7660
|
+
* Get all coin prices, including sCoin
|
|
7661
|
+
* @returns prices data
|
|
7662
|
+
*/
|
|
7663
|
+
async getAllCoinPrices(args) {
|
|
7664
|
+
return getAllCoinPrices(this, args?.marketPools, args?.coinPrices);
|
|
7665
|
+
}
|
|
7598
7666
|
};
|
|
7599
7667
|
|
|
7600
7668
|
// src/models/scallopBuilder.ts
|
|
@@ -8583,6 +8651,7 @@ var Scallop = class {
|
|
|
8583
8651
|
marketCoins,
|
|
8584
8652
|
queryKeys,
|
|
8585
8653
|
sCoinIds,
|
|
8654
|
+
sCoinRawNameToName,
|
|
8586
8655
|
sCoinTypeToName,
|
|
8587
8656
|
sCoins,
|
|
8588
8657
|
spoolRewardCoins,
|