@scallop-io/sui-scallop-sdk 1.3.4 → 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.
Files changed (37) hide show
  1. package/dist/constants/common.d.ts +3 -3
  2. package/dist/constants/enum.d.ts +2 -1
  3. package/dist/constants/tokenBucket.d.ts +1 -1
  4. package/dist/index.js +161 -84
  5. package/dist/index.js.map +1 -1
  6. package/dist/index.mjs +160 -84
  7. package/dist/index.mjs.map +1 -1
  8. package/dist/models/scallopQuery.d.ts +41 -7
  9. package/dist/models/scallopUtils.d.ts +10 -3
  10. package/dist/queries/borrowIncentiveQuery.d.ts +2 -2
  11. package/dist/queries/coreQuery.d.ts +0 -2
  12. package/dist/queries/portfolioQuery.d.ts +0 -2
  13. package/dist/queries/priceQuery.d.ts +32 -2
  14. package/dist/queries/sCoinQuery.d.ts +1 -1
  15. package/dist/types/constant/common.d.ts +1 -1
  16. package/dist/types/utils.d.ts +2 -6
  17. package/package.json +1 -1
  18. package/src/constants/coinGecko.ts +3 -2
  19. package/src/constants/common.ts +10 -5
  20. package/src/constants/enum.ts +54 -31
  21. package/src/constants/poolAddress.ts +10 -7
  22. package/src/constants/pyth.ts +3 -2
  23. package/src/constants/tokenBucket.ts +1 -1
  24. package/src/models/scallopQuery.ts +14 -1
  25. package/src/models/scallopUtils.ts +14 -2
  26. package/src/queries/borrowIncentiveQuery.ts +30 -12
  27. package/src/queries/borrowLimitQuery.ts +3 -2
  28. package/src/queries/coreQuery.ts +4 -9
  29. package/src/queries/isolatedAssetQuery.ts +3 -2
  30. package/src/queries/portfolioQuery.ts +3 -6
  31. package/src/queries/priceQuery.ts +36 -2
  32. package/src/queries/sCoinQuery.ts +1 -1
  33. package/src/queries/spoolQuery.ts +2 -4
  34. package/src/queries/supplyLimitQuery.ts +3 -2
  35. package/src/types/constant/common.ts +1 -2
  36. package/src/types/utils.ts +2 -10
  37. package/src/utils/query.ts +0 -87
@@ -7,14 +7,14 @@ export declare const PROTOCOL_OBJECT_ID: "0xc9f859f98ca352a11b97a038c4b4162bee43
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", "fud", "deep"];
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
- export declare const SUPPORT_SCOIN: readonly ["susdc", "ssbeth", "ssui", "swusdc", "swusdt", "safsui", "shasui", "svsui", "sweth", "ssca", "scetus", "swsol", "swbtc", "sdeep", "sfud"];
13
+ export declare const SUPPORT_SCOIN: readonly ["susdc", "ssbeth", "ssui", "swusdc", "swusdt", "safsui", "shasui", "svsui", "sweth", "ssca", "scetus", "swsol", "swbtc"];
14
14
  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"];
@@ -11,4 +11,5 @@ export declare const coinIds: types.AssetCoinIds;
11
11
  export declare const wormholeCoinIds: types.WormholeCoinIds;
12
12
  export declare const voloCoinIds: types.VoloCoinIds;
13
13
  export declare const sCoinIds: types.SCoinIds;
14
- export declare const sCoinTypeToName: Record<string, "susdc" | "ssbeth" | "sweth" | "swbtc" | "swusdc" | "swusdt" | "ssui" | "swsol" | "scetus" | "safsui" | "shasui" | "svsui" | "ssca" | "sfud" | "sdeep">;
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 = 10;
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
- deep: "deepbook",
120
- fud: "fud-the-pug"
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
@@ -146,9 +148,10 @@ var SUPPORT_POOLS = [
146
148
  "afsui",
147
149
  "hasui",
148
150
  "vsui",
149
- "sca",
150
- "fud",
151
- "deep"
151
+ "sca"
152
+ // TODO: enable for production
153
+ // 'fud',
154
+ // 'deep',
152
155
  ];
153
156
  var SUPPORT_COLLATERALS = [
154
157
  "usdc",
@@ -192,9 +195,10 @@ var SUPPORT_SCOIN = [
192
195
  "ssca",
193
196
  "scetus",
194
197
  "swsol",
195
- "swbtc",
196
- "sdeep",
197
- "sfud"
198
+ "swbtc"
199
+ // TODO: enable for production
200
+ // 'sdeep',
201
+ // 'sfud',
198
202
  ];
199
203
  var SUPPORT_SUI_BRIDGE = ["sbeth"];
200
204
  var SUPPORT_WORMHOLE = [
@@ -218,7 +222,10 @@ var SUPPORT_BORROW_INCENTIVE_POOLS = [
218
222
  "sca",
219
223
  "usdc"
220
224
  ];
221
- var SUPPORT_BORROW_INCENTIVE_REWARDS = ["sui", "sca"];
225
+ var SUPPORT_BORROW_INCENTIVE_REWARDS = [
226
+ ...SUPPORT_POOLS,
227
+ ...SUPPORT_SCOIN
228
+ ];
222
229
  var SUPPORT_ORACLES = ["supra", "switchboard", "pyth"];
223
230
  var SUPPORT_PACKAGES = [
224
231
  "coinDecimalsRegistry",
@@ -251,8 +258,9 @@ var coinDecimals = {
251
258
  hasui: 9,
252
259
  vsui: 9,
253
260
  sca: 9,
254
- deep: 6,
255
- fud: 5,
261
+ // TODO: enable for production
262
+ // deep: 6,
263
+ // fud: 5,
256
264
  susdc: 6,
257
265
  sweth: 8,
258
266
  ssbeth: 8,
@@ -266,9 +274,10 @@ var coinDecimals = {
266
274
  safsui: 9,
267
275
  shasui: 9,
268
276
  svsui: 9,
269
- ssca: 9,
270
- sdeep: 6,
271
- sfud: 5
277
+ ssca: 9
278
+ // TODO: enable for production
279
+ // sdeep: 6,
280
+ // sfud: 5,
272
281
  };
273
282
  var assetCoins = {
274
283
  usdc: "usdc",
@@ -284,9 +293,10 @@ var assetCoins = {
284
293
  afsui: "afsui",
285
294
  hasui: "hasui",
286
295
  vsui: "vsui",
287
- sca: "sca",
288
- deep: "deep",
289
- fud: "fud"
296
+ sca: "sca"
297
+ // TODO: enable for production
298
+ // deep: 'deep',
299
+ // fud: 'fud',
290
300
  };
291
301
  var marketCoins = {
292
302
  susdc: "susdc",
@@ -302,9 +312,10 @@ var marketCoins = {
302
312
  safsui: "safsui",
303
313
  shasui: "shasui",
304
314
  svsui: "svsui",
305
- ssca: "ssca",
306
- sdeep: "sdeep",
307
- sfud: "sfud"
315
+ ssca: "ssca"
316
+ // TODO: enable for production
317
+ // sdeep: 'sdeep',
318
+ // sfud: 'sfud',
308
319
  };
309
320
  var sCoins = {
310
321
  susdc: "susdc",
@@ -319,9 +330,10 @@ var sCoins = {
319
330
  svsui: "svsui",
320
331
  ssca: "ssca",
321
332
  swsol: "swsol",
322
- swbtc: "swbtc",
323
- sfud: "sfud",
324
- sdeep: "sdeep"
333
+ swbtc: "swbtc"
334
+ // TODO: enable for production
335
+ // sfud: 'sfud',
336
+ // sdeep: 'sdeep',
325
337
  };
326
338
  var stakeMarketCoins = {
327
339
  susdc: "susdc",
@@ -349,16 +361,16 @@ var suiBridgeCoins = {
349
361
  sbeth: "sbeth"
350
362
  };
351
363
  var borrowIncentiveRewardCoins = {
352
- usdc: ["sui", "sca"],
353
- sui: ["sui", "sca"],
354
- wusdc: ["sui", "sca"],
355
- wusdt: ["sui", "sca"],
356
- sca: ["sui", "sca"],
357
- afsui: ["sui"],
358
- hasui: ["sui"],
359
- vsui: ["sui"],
360
- weth: ["sui"],
361
- sbeth: ["sui"]
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"]
362
374
  };
363
375
  var coinIds = {
364
376
  usdc: "0xdba34672e30cb065b1f93e3ab55318768fd6fef66c15942c9f7cb846e2f900e7",
@@ -374,10 +386,10 @@ var coinIds = {
374
386
  afsui: "0xf325ce1300e8dac124071d3152c5c5ee6174914f8bc2161e88329cf579246efc",
375
387
  hasui: "0xbde4ba4c2e274a60ce15c1cfff9e5c42e41654ac8b6d906a57efa4bd3c29f47d",
376
388
  vsui: "0x549e8b69270defbfafd4f94e17ec44cdbdd99820b33bda2278dea3b9a32d3f55",
377
- sca: IS_VE_SCA_TEST ? "0x6cd813061a3adf3602b76545f076205f0c8e7ec1d3b1eab9a1da7992c18c0524" : "0x7016aae72cfc67f2fadf55769c0a7dd54291a583b63051a5ed71081cce836ac6",
389
+ sca: IS_VE_SCA_TEST ? "0x6cd813061a3adf3602b76545f076205f0c8e7ec1d3b1eab9a1da7992c18c0524" : "0x7016aae72cfc67f2fadf55769c0a7dd54291a583b63051a5ed71081cce836ac6"
378
390
  // isolated assets
379
- deep: "0xdeeb7a4662eec9f2f3def03fb937a663dddaa2e215b8078a284d026b7946c270",
380
- fud: "0x76cb819b01abed502bee8a702b4c2d547532c12f25001c9dea795a5e631c26f1"
391
+ // deep: '0xdeeb7a4662eec9f2f3def03fb937a663dddaa2e215b8078a284d026b7946c270',
392
+ // fud: '0x76cb819b01abed502bee8a702b4c2d547532c12f25001c9dea795a5e631c26f1',
381
393
  };
382
394
  var wormholeCoinIds = {
383
395
  weth: "0xaf8cd5edc19c4512f4259f0bee101a40d41ebed738ade5874359610ef8eeced5",
@@ -393,19 +405,28 @@ var voloCoinIds = {
393
405
  var sCoinIds = {
394
406
  susdc: "0x854950aa624b1df59fe64e630b2ba7c550642e9342267a33061d59fb31582da5::scallop_usdc::SCALLOP_USDC",
395
407
  ssbeth: "0xb14f82d8506d139eacef109688d1b71e7236bcce9b2c0ad526abcd6aa5be7de0::scallop_sb_eth::SCALLOP_SB_ETH",
396
- ssui: "0xaafc4f740de0dd0dde642a31148fb94517087052f19afb0f7bed1dc41a50c77b::scallop_sui::SCALLOP_SUI",
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: "0x5ca17430c1d046fae9edeaa8fd76c7b4193a00d764a0ecfa9418d733ad27bc1e::scallop_sca::SCALLOP_SCA",
399
- swusdc: "0xad4d71551d31092230db1fd482008ea42867dbf27b286e9c70a79d2a6191d58d::scallop_wormhole_usdc::SCALLOP_WORMHOLE_USDC",
400
- swusdt: "0xe6e5a012ec20a49a3d1d57bd2b67140b96cd4d3400b9d79e541f7bdbab661f95::scallop_wormhole_usdt::SCALLOP_WORMHOLE_USDT",
401
421
  sweth: "0x67540ceb850d418679e69f1fb6b2093d6df78a2a699ffc733f7646096d552e9b::scallop_wormhole_eth::SCALLOP_WORMHOLE_ETH",
402
422
  safsui: "0x00671b1fa2a124f5be8bdae8b91ee711462c5d9e31bda232e70fd9607b523c88::scallop_af_sui::SCALLOP_AF_SUI",
403
423
  shasui: "0x9a2376943f7d22f88087c259c5889925f332ca4347e669dc37d54c2bf651af3c::scallop_ha_sui::SCALLOP_HA_SUI",
404
424
  svsui: "0xe1a1cc6bcf0001a015eab84bcc6713393ce20535f55b8b6f35c142e057a25fbe::scallop_v_sui::SCALLOP_V_SUI",
405
425
  swsol: "0x1392650f2eca9e3f6ffae3ff89e42a3590d7102b80e2b430f674730bc30d3259::scallop_wormhole_sol::SCALLOP_WORMHOLE_SOL",
406
- swbtc: "0x2cf76a9cf5d3337961d1154283234f94da2dcff18544dfe5cbdef65f319591b5::scallop_wormhole_btc::SCALLOP_WORMHOLE_BTC",
407
- sdeep: "0xeb7a05a3224837c5e5503575aed0be73c091d1ce5e43aa3c3e716e0ae614608f::scallop_deep::SCALLOP_DEEP",
408
- sfud: "0xe56d5167f427cbe597da9e8150ef5c337839aaf46891d62468dcf80bdd8e10d1::scallop_fud::SCALLOP_FUD"
426
+ swbtc: "0x2cf76a9cf5d3337961d1154283234f94da2dcff18544dfe5cbdef65f319591b5::scallop_wormhole_btc::SCALLOP_WORMHOLE_BTC"
427
+ // sdeep:
428
+ // '0xeb7a05a3224837c5e5503575aed0be73c091d1ce5e43aa3c3e716e0ae614608f::scallop_deep::SCALLOP_DEEP',
429
+ // sfud: '0xe56d5167f427cbe597da9e8150ef5c337839aaf46891d62468dcf80bdd8e10d1::scallop_fud::SCALLOP_FUD',
409
430
  };
410
431
  var sCoinTypeToName = Object.entries(sCoinIds).reduce(
411
432
  (acc, [coinName, coinType]) => {
@@ -414,6 +435,13 @@ var sCoinTypeToName = Object.entries(sCoinIds).reduce(
414
435
  },
415
436
  {}
416
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
+ );
417
445
 
418
446
  // src/constants/flashloan.ts
419
447
  var FlashLoanFeeObjectMap = {
@@ -488,13 +516,16 @@ var POOL_ADDRESSES = {
488
516
  sca: {
489
517
  lendingPoolAddress: "0x6fc7d4211fc7018b6c75e7b908b88f2e0536443239804a3d32af547637bd28d7",
490
518
  collateralPoolAddress: "0xff677a5d9e9dc8f08f0a8681ebfc7481d1c7d57bc441f2881974adcdd7b13c31"
491
- },
492
- fud: {
493
- lendingPoolAddress: ""
494
- },
495
- deep: {
496
- lendingPoolAddress: ""
497
519
  }
520
+ // TODO: enable for production
521
+ // fud: {
522
+ // lendingPoolAddress:
523
+ // '0x14367ddca30e2860cb89ed4eaca20c7ece260c5d59dd9990d2c85a8321326acb',
524
+ // },
525
+ // deep: {
526
+ // lendingPoolAddress:
527
+ // '0xf4a67ffb43da1e1c61c049f188f19463ea8dbbf2d5ef4722d6df854ff1b1cc03',
528
+ // },
498
529
  };
499
530
 
500
531
  // src/constants/pyth.ts
@@ -516,9 +547,10 @@ var PYTH_FEED_IDS = {
516
547
  afsui: "23d7315113f5b1d3ba7a83604c44b94d79f4fd69af77f804fc7f920a6dc65744",
517
548
  hasui: "23d7315113f5b1d3ba7a83604c44b94d79f4fd69af77f804fc7f920a6dc65744",
518
549
  vsui: "23d7315113f5b1d3ba7a83604c44b94d79f4fd69af77f804fc7f920a6dc65744",
519
- sca: "7e17f0ac105abe9214deb9944c30264f5986bf292869c6bd8e8da3ccd92d79bc",
520
- deep: "29bdd5248234e33bd93d3b81100b5fa32eaa5997843847e2c2cb16d7c6d9f7ff",
521
- fud: "6a4090703da959247727f2b490eb21aea95c8684ecfac675f432008830890c75"
550
+ sca: "7e17f0ac105abe9214deb9944c30264f5986bf292869c6bd8e8da3ccd92d79bc"
551
+ // TODO: enable for production
552
+ // deep: '29bdd5248234e33bd93d3b81100b5fa32eaa5997843847e2c2cb16d7c6d9f7ff',
553
+ // fud: '6a4090703da959247727f2b490eb21aea95c8684ecfac675f432008830890c75',
522
554
  };
523
555
 
524
556
  // src/constants/queryKeys.ts
@@ -1043,7 +1075,7 @@ var TEST_ADDRESSES = {
1043
1075
  };
1044
1076
 
1045
1077
  // src/constants/tokenBucket.ts
1046
- var DEFAULT_TOKENS_PER_INTERVAL = 10;
1078
+ var DEFAULT_TOKENS_PER_INTERVAL = 50;
1047
1079
  var DEFAULT_INTERVAL_IN_MS = 300;
1048
1080
 
1049
1081
  // src/constants/vesca.ts
@@ -2555,15 +2587,22 @@ var queryBorrowIncentivePools = async (address) => {
2555
2587
  };
2556
2588
  var getBorrowIncentivePools = async (query, borrowIncentiveCoinNames = [
2557
2589
  ...SUPPORT_BORROW_INCENTIVE_POOLS
2558
- ], indexer = false, coinPrices) => {
2590
+ ], indexer = false, marketPools, coinPrices) => {
2559
2591
  const borrowIncentivePools = {};
2560
- coinPrices = coinPrices ?? await query.utils.getCoinPrices() ?? {};
2592
+ marketPools = marketPools ?? await query.getMarketPools(void 0, false, { coinPrices });
2593
+ coinPrices = coinPrices ?? await query.getAllCoinPrices({ marketPools });
2594
+ console.log({ coinPrices });
2561
2595
  if (indexer) {
2562
2596
  const borrowIncentivePoolsIndexer = await query.indexer.getBorrowIncentivePools();
2563
2597
  const updateBorrowIncentivePool = (pool) => {
2564
2598
  if (!borrowIncentiveCoinNames.includes(pool.coinName))
2565
2599
  return;
2566
- pool.coinPrice = coinPrices[pool.coinName] ?? pool.coinPrice;
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
+ }
2567
2606
  borrowIncentivePools[pool.coinName] = pool;
2568
2607
  };
2569
2608
  Object.values(borrowIncentivePoolsIndexer).forEach(
@@ -2589,12 +2628,15 @@ var getBorrowIncentivePools = async (query, borrowIncentiveCoinNames = [
2589
2628
  for (const [coinName, poolPoint] of Object.entries(
2590
2629
  parsedBorrowIncentivePoolData.poolPoints
2591
2630
  )) {
2592
- const rewardCoinType = (0, import_utils3.normalizeStructTag)(poolPoint.pointType);
2593
- const rewardCoinName = query.utils.parseCoinNameFromType(
2631
+ const rewardCoinType = poolPoint.pointType;
2632
+ let rewardCoinName = query.utils.parseCoinNameFromType(
2594
2633
  rewardCoinType
2595
2634
  );
2596
- const rewardCoinPrice = coinPrices?.[rewardCoinName] ?? 0;
2635
+ if (sCoinRawNameToName[rewardCoinName]) {
2636
+ rewardCoinName = sCoinRawNameToName[rewardCoinName];
2637
+ }
2597
2638
  const rewardCoinDecimal = query.utils.getCoinDecimal(rewardCoinName);
2639
+ const rewardCoinPrice = coinPrices?.[rewardCoinName] ?? 0;
2598
2640
  const symbol = query.utils.parseSymbol(rewardCoinName);
2599
2641
  const coinDecimal = query.utils.getCoinDecimal(rewardCoinName);
2600
2642
  const calculatedPoolPoint = calculateBorrowIncentivePoolPointData(
@@ -2740,7 +2782,7 @@ var supplyLimitZod = import_zod.z.object({
2740
2782
  value: import_zod.z.string()
2741
2783
  })
2742
2784
  });
2743
- var supplyLimitKeyType = `0x6e641f0dca8aedab3101d047e96439178f16301bf0b57fe8745086ff1195eb3e::market_dynamic_keys::SupplyLimitKey`;
2785
+ var supplyLimitKeyType = `0x6c23585e940a989588432509107e98bae06dbca4e333f26d0635d401b3c7c76d::market_dynamic_keys::SupplyLimitKey`;
2744
2786
  var getSupplyLimit = async (utils, poolName) => {
2745
2787
  try {
2746
2788
  const poolCoinType = utils.parseCoinType(poolName).slice(2);
@@ -2780,7 +2822,7 @@ var isolatedAssetZod = import_zod2.z.object({
2780
2822
  value: import_zod2.z.boolean()
2781
2823
  })
2782
2824
  });
2783
- var isolatedAssetKeyType = `0xe7dbb371a9595631f7964b7ece42255ad0e738cc85fe6da26c7221b220f01af6::market_dynamic_keys::IsolatedAssetKey`;
2825
+ var isolatedAssetKeyType = `0x6c23585e940a989588432509107e98bae06dbca4e333f26d0635d401b3c7c76d::market_dynamic_keys::IsolatedAssetKey`;
2784
2826
  var getIsolatedAssets = async (address) => {
2785
2827
  try {
2786
2828
  const marketObject = address.get("core.market");
@@ -2860,7 +2902,7 @@ var borrowLimitZod = import_zod3.z.object({
2860
2902
  value: import_zod3.z.string()
2861
2903
  })
2862
2904
  });
2863
- var borrowLimitKeyType = `0xe7dbb371a9595631f7964b7ece42255ad0e738cc85fe6da26c7221b220f01af6::market_dynamic_keys::BorrowLimitKey`;
2905
+ var borrowLimitKeyType = `0xb784ea287d944e478a3ceaa071f8885072cce6b7224cf245914dc2f9963f460e::market_dynamic_keys::BorrowLimitKey`;
2864
2906
  var getBorrowLimit = async (utils, poolName) => {
2865
2907
  try {
2866
2908
  const poolCoinType = utils.parseCoinType(poolName).slice(2);
@@ -3027,7 +3069,7 @@ var getMarketPools = async (query, poolCoinNames = [...SUPPORT_POOLS], indexer =
3027
3069
  const marketObjectResponse = await query.cache.queryGetObject(marketId, {
3028
3070
  showContent: true
3029
3071
  });
3030
- coinPrices = await query.utils.getCoinPrices(poolCoinNames) ?? {};
3072
+ coinPrices = coinPrices ?? await query.utils.getCoinPrices();
3031
3073
  const marketPools = {};
3032
3074
  if (indexer) {
3033
3075
  const marketPoolsIndexer = await query.indexer.getMarketPools();
@@ -3061,7 +3103,7 @@ var getMarketPools = async (query, poolCoinNames = [...SUPPORT_POOLS], indexer =
3061
3103
  };
3062
3104
  var getMarketPool = async (query, poolCoinName, indexer = false, marketObject, coinPrice) => {
3063
3105
  try {
3064
- coinPrice = coinPrice || (await query.utils.getCoinPrices([poolCoinName]))?.[poolCoinName];
3106
+ coinPrice = coinPrice ?? (await query.utils.getCoinPrices())?.[poolCoinName];
3065
3107
  if (indexer) {
3066
3108
  const marketPoolIndexer = await query.indexer.getMarketPool(poolCoinName);
3067
3109
  if (!marketPoolIndexer) {
@@ -3207,7 +3249,7 @@ var getMarketPool = async (query, poolCoinName, indexer = false, marketObject, c
3207
3249
  };
3208
3250
  var getMarketCollaterals = async (query, collateralCoinNames = [...SUPPORT_COLLATERALS], indexer = false) => {
3209
3251
  const marketId = query.address.get("core.market");
3210
- const coinPrices = await query.utils.getCoinPrices(collateralCoinNames) ?? {};
3252
+ const coinPrices = await query.utils.getCoinPrices() ?? {};
3211
3253
  const marketCollaterals = {};
3212
3254
  if (indexer) {
3213
3255
  const marketCollateralsIndexer = await query.indexer.getMarketCollaterals();
@@ -3243,7 +3285,7 @@ var getMarketCollaterals = async (query, collateralCoinNames = [...SUPPORT_COLLA
3243
3285
  return marketCollaterals;
3244
3286
  };
3245
3287
  var getMarketCollateral = async (query, collateralCoinName, indexer = false, marketObject, coinPrice) => {
3246
- coinPrice = coinPrice || (await query.utils.getCoinPrices([collateralCoinName]))?.[collateralCoinName];
3288
+ coinPrice = coinPrice ?? (await query.utils.getCoinPrices())?.[collateralCoinName];
3247
3289
  if (indexer) {
3248
3290
  const marketCollateralIndexer = await query.indexer.getMarketCollateral(collateralCoinName);
3249
3291
  marketCollateralIndexer.coinPrice = coinPrice ?? marketCollateralIndexer.coinPrice;
@@ -3559,7 +3601,7 @@ var getLendings = async (query, poolCoinNames = [...SUPPORT_POOLS], ownerAddress
3559
3601
  const stakeMarketCoinNames = marketCoinNames.filter(
3560
3602
  (marketCoinName) => SUPPORT_SPOOLS.includes(marketCoinName)
3561
3603
  );
3562
- const coinPrices = await query.utils.getCoinPrices(poolCoinNames);
3604
+ const coinPrices = await query.utils.getCoinPrices();
3563
3605
  const marketPools = await query.getMarketPools(poolCoinNames, indexer, {
3564
3606
  coinPrices
3565
3607
  });
@@ -3597,7 +3639,7 @@ var getLendings = async (query, poolCoinNames = [...SUPPORT_POOLS], ownerAddress
3597
3639
  };
3598
3640
  var getLending = async (query, poolCoinName, ownerAddress, indexer = false, marketPool, spool, stakeAccounts, coinAmount, marketCoinAmount, coinPrice, sCoinAmount) => {
3599
3641
  const marketCoinName = query.utils.parseMarketCoinName(poolCoinName);
3600
- coinPrice = coinPrice ?? (await query.utils.getCoinPrices([poolCoinName]))?.[poolCoinName] ?? 0;
3642
+ coinPrice = coinPrice ?? (await query.utils.getCoinPrices())?.[poolCoinName] ?? 0;
3601
3643
  marketPool = marketPool ?? await query.getMarketPool(poolCoinName, indexer, {
3602
3644
  coinPrice
3603
3645
  });
@@ -3757,7 +3799,7 @@ var getObligationAccount = async (query, obligationId, ownerAddress, indexer = f
3757
3799
  const collateralAssetCoinNames = [
3758
3800
  ...SUPPORT_COLLATERALS
3759
3801
  ];
3760
- coinPrices = coinPrices ?? await query.utils.getCoinPrices(collateralAssetCoinNames);
3802
+ coinPrices = coinPrices ?? await query.utils.getCoinPrices();
3761
3803
  market = market ?? await query.queryMarket(indexer, { coinPrices });
3762
3804
  coinAmounts = coinAmounts || await query.getCoinAmounts(collateralAssetCoinNames, ownerAddress);
3763
3805
  const [obligationQuery, borrowIncentivePools, borrowIncentiveAccounts] = await Promise.all([
@@ -4080,6 +4122,7 @@ var getTotalValueLocked = async (query, indexer = false) => {
4080
4122
  };
4081
4123
 
4082
4124
  // src/queries/priceQuery.ts
4125
+ var import_bignumber6 = __toESM(require("bignumber.js"));
4083
4126
  var getPythPrice = async ({
4084
4127
  address
4085
4128
  }, assetCoinName, priceFeedObject) => {
@@ -4161,6 +4204,22 @@ var getPythPrices = async ({
4161
4204
  {}
4162
4205
  );
4163
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
+ };
4164
4223
 
4165
4224
  // src/queries/referralQuery.ts
4166
4225
  var queryVeScaKeyIdFromReferralBindings = async (address, refereeAddress) => {
@@ -4181,7 +4240,7 @@ var queryVeScaKeyIdFromReferralBindings = async (address, refereeAddress) => {
4181
4240
  // src/queries/sCoinQuery.ts
4182
4241
  var import_bcs = require("@mysten/sui/bcs");
4183
4242
  var import_assert = __toESM(require("assert"));
4184
- var import_bignumber6 = __toESM(require("bignumber.js"));
4243
+ var import_bignumber7 = __toESM(require("bignumber.js"));
4185
4244
  var getSCoinTotalSupply = async ({
4186
4245
  utils
4187
4246
  }, sCoinName) => {
@@ -4202,7 +4261,7 @@ var getSCoinTotalSupply = async ({
4202
4261
  const value = Uint8Array.from(results[0].returnValues[0][0]);
4203
4262
  const type = results[0].returnValues[0][1];
4204
4263
  (0, import_assert.default)(type === "u64", "Result type is not u64");
4205
- return (0, import_bignumber6.default)(import_bcs.bcs.u64().parse(value)).shiftedBy(utils.getCoinDecimal(utils.parseCoinName(sCoinName))).toNumber();
4264
+ return (0, import_bignumber7.default)(import_bcs.bcs.u64().parse(value)).shiftedBy(utils.getCoinDecimal(utils.parseCoinName(sCoinName))).toNumber();
4206
4265
  }
4207
4266
  return 0;
4208
4267
  };
@@ -4228,7 +4287,7 @@ var getSCoinAmount = async ({
4228
4287
  owner,
4229
4288
  coinType: sCoinType
4230
4289
  });
4231
- return (0, import_bignumber6.default)(amount).toNumber();
4290
+ return (0, import_bignumber7.default)(amount).toNumber();
4232
4291
  };
4233
4292
  var isSupportStakeCoins = (value) => {
4234
4293
  return SUPPORT_SCOIN.includes(value);
@@ -4258,7 +4317,7 @@ var getSCoinSwapRate = async (query, fromSCoin, toSCoin, underlyingCoinPrice) =>
4258
4317
  const ScoinAToARate = marketPools[0].conversionRate;
4259
4318
  const BtoSCoinBRate = 1 / marketPools[1].conversionRate;
4260
4319
  const calcAtoBRate = async () => {
4261
- const prices = await query.utils.getCoinPrices([fromCoinName, toCoinName]);
4320
+ const prices = await query.utils.getCoinPrices();
4262
4321
  if (!prices[fromCoinName] || !prices[toCoinName]) {
4263
4322
  throw new Error("Failed to fetch the coin prices");
4264
4323
  }
@@ -4268,7 +4327,7 @@ var getSCoinSwapRate = async (query, fromSCoin, toSCoin, underlyingCoinPrice) =>
4268
4327
  return prices[fromCoinName] / prices[toCoinName];
4269
4328
  };
4270
4329
  const AtoBRate = underlyingCoinPrice ?? await calcAtoBRate();
4271
- return (0, import_bignumber6.default)(ScoinAToARate).multipliedBy(AtoBRate).multipliedBy(BtoSCoinBRate).toNumber();
4330
+ return (0, import_bignumber7.default)(ScoinAToARate).multipliedBy(AtoBRate).multipliedBy(BtoSCoinBRate).toNumber();
4272
4331
  };
4273
4332
 
4274
4333
  // src/queries/spoolQuery.ts
@@ -4328,7 +4387,7 @@ var getSpool = async (query, marketCoinName, indexer = false, marketPool, coinPr
4328
4387
  `spool.pools.${marketCoinName}.rewardPoolId`
4329
4388
  );
4330
4389
  let spool = void 0;
4331
- coinPrices = coinPrices || await query.utils.getCoinPrices([coinName]);
4390
+ coinPrices = coinPrices || await query.utils.getCoinPrices();
4332
4391
  if (indexer) {
4333
4392
  const spoolIndexer = await query.indexer.getSpool(marketCoinName);
4334
4393
  const coinName2 = query.utils.parseCoinName(marketCoinName);
@@ -4348,7 +4407,7 @@ var getSpool = async (query, marketCoinName, indexer = false, marketPool, coinPr
4348
4407
  throw new Error("Fail to fetch spoolObjectResponse!");
4349
4408
  }
4350
4409
  const rewardCoinName = query.utils.getSpoolRewardCoinName(marketCoinName);
4351
- coinPrices = coinPrices || await query.utils.getCoinPrices([coinName, rewardCoinName]);
4410
+ coinPrices = coinPrices || await query.utils.getCoinPrices();
4352
4411
  const spoolObject = spoolObjectResponse[0];
4353
4412
  const rewardPoolObject = spoolObjectResponse[1];
4354
4413
  if (spoolObject.content && "fields" in spoolObject.content) {
@@ -4592,7 +4651,7 @@ var getStakeRewardPool = async ({
4592
4651
  };
4593
4652
 
4594
4653
  // src/queries/vescaQuery.ts
4595
- var import_bignumber7 = __toESM(require("bignumber.js"));
4654
+ var import_bignumber8 = __toESM(require("bignumber.js"));
4596
4655
  var import_sui_kit3 = require("@scallop-io/sui-kit");
4597
4656
  var import_bcs2 = require("@mysten/sui/bcs");
4598
4657
  var import_zod5 = require("zod");
@@ -4674,7 +4733,7 @@ var getVeSca = async (utils, veScaKey) => {
4674
4733
  0
4675
4734
  );
4676
4735
  const lockedScaAmount = String(dynamicFields.locked_sca_amount);
4677
- const lockedScaCoin = (0, import_bignumber7.default)(dynamicFields.locked_sca_amount).shiftedBy(-9).toNumber();
4736
+ const lockedScaCoin = (0, import_bignumber8.default)(dynamicFields.locked_sca_amount).shiftedBy(-9).toNumber();
4678
4737
  const currentVeScaBalance = lockedScaCoin * (Math.floor(remainingLockPeriodInMilliseconds / 1e3) / MAX_LOCK_DURATION);
4679
4738
  vesca = {
4680
4739
  id: veScaDynamicFieldObject.objectId,
@@ -4684,7 +4743,7 @@ var getVeSca = async (utils, veScaKey) => {
4684
4743
  lockedScaAmount,
4685
4744
  lockedScaCoin,
4686
4745
  currentVeScaBalance,
4687
- unlockAt: (0, import_bignumber7.default)(dynamicFields.unlock_at * 1e3).toNumber()
4746
+ unlockAt: (0, import_bignumber8.default)(dynamicFields.unlock_at * 1e3).toNumber()
4688
4747
  };
4689
4748
  }
4690
4749
  return vesca;
@@ -4746,10 +4805,10 @@ var getVeScaTreasuryInfo = async (utils) => {
4746
4805
  if (!veScaTreasury || veScaTreasury.data?.content?.dataType !== "moveObject")
4747
4806
  return null;
4748
4807
  const treasuryFields = veScaTreasury.data.content.fields;
4749
- const totalLockedSca = (0, import_bignumber7.default)(
4808
+ const totalLockedSca = (0, import_bignumber8.default)(
4750
4809
  treasuryFields.unlock_schedule.fields.locked_sca_amount
4751
4810
  ).shiftedBy(-9).toNumber();
4752
- const totalVeSca = (0, import_bignumber7.default)(
4811
+ const totalVeSca = (0, import_bignumber8.default)(
4753
4812
  await getTotalVeScaTreasuryAmount(utils, veScaTreasury.data) ?? 0
4754
4813
  ).shiftedBy(-9).toNumber();
4755
4814
  const averageLockingPeriod = totalLockedSca > 0 ? totalVeSca / totalLockedSca * 4 : 0;
@@ -4918,6 +4977,15 @@ var ScallopUtils = class {
4918
4977
  return void 0;
4919
4978
  }
4920
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
+ }
4921
4989
  /**
4922
4990
  * Convert sCoin name into sCoin type
4923
4991
  * @param sCoinName
@@ -4969,7 +5037,7 @@ var ScallopUtils = class {
4969
5037
  const coinTypeMatch = coinType.match(coinTypeRegex);
4970
5038
  const isMarketCoinType = coinType.includes("reserve::MarketCoin");
4971
5039
  coinType = coinTypeMatch?.[1] ?? coinType;
4972
- const wormHoleCoinTypeMap = {
5040
+ const wormholeCoinTypeMap = {
4973
5041
  [`${this.address.get("core.coins.wusdc.id") ?? wormholeCoinIds.wusdc}::coin::COIN`]: "wusdc",
4974
5042
  [`${this.address.get("core.coins.wusdt.id") ?? wormholeCoinIds.wusdt}::coin::COIN`]: "wusdt",
4975
5043
  [`${this.address.get("core.coins.weth.id") ?? wormholeCoinIds.weth}::coin::COIN`]: "weth",
@@ -4989,7 +5057,7 @@ var ScallopUtils = class {
4989
5057
  },
4990
5058
  {}
4991
5059
  );
4992
- const assetCoinName = wormHoleCoinTypeMap[coinType] || voloCoinTypeMap[coinType] || suiBridgeTypeMap[coinType] || coinType.split("::")[2].toLowerCase();
5060
+ const assetCoinName = wormholeCoinTypeMap[coinType] || voloCoinTypeMap[coinType] || suiBridgeTypeMap[coinType] || coinType.split("::")[2].toLowerCase();
4993
5061
  return isMarketCoinType ? this.parseMarketCoinName(assetCoinName) : assetCoinName;
4994
5062
  }
4995
5063
  /**
@@ -7372,6 +7440,7 @@ var ScallopQuery = class {
7372
7440
  this,
7373
7441
  coinNames,
7374
7442
  indexer,
7443
+ args?.marketPools,
7375
7444
  args?.coinPrices
7376
7445
  );
7377
7446
  }
@@ -7587,6 +7656,13 @@ var ScallopQuery = class {
7587
7656
  async getCoinPriceByIndexer(poolName) {
7588
7657
  return this.indexer.getCoinPrice(poolName);
7589
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
+ }
7590
7666
  };
7591
7667
 
7592
7668
  // src/models/scallopBuilder.ts
@@ -8575,6 +8651,7 @@ var Scallop = class {
8575
8651
  marketCoins,
8576
8652
  queryKeys,
8577
8653
  sCoinIds,
8654
+ sCoinRawNameToName,
8578
8655
  sCoinTypeToName,
8579
8656
  sCoins,
8580
8657
  spoolRewardCoins,