@scallop-io/sui-scallop-sdk 0.44.1 → 0.44.2

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/index.mjs CHANGED
@@ -12,7 +12,8 @@ var SUPPORT_POOLS = [
12
12
  "sol",
13
13
  "cetus",
14
14
  "afsui",
15
- "hasui"
15
+ "hasui",
16
+ "vsui"
16
17
  ];
17
18
  var SUPPORT_COLLATERALS = [
18
19
  "eth",
@@ -24,7 +25,8 @@ var SUPPORT_COLLATERALS = [
24
25
  "sol",
25
26
  "cetus",
26
27
  "afsui",
27
- "hasui"
28
+ "hasui",
29
+ "vsui"
28
30
  ];
29
31
  var SUPPORT_SPOOLS = ["ssui", "susdc", "susdt"];
30
32
  var SUPPORT_REWARD_POOLS = ["sui"];
@@ -56,6 +58,7 @@ var coinDecimals = {
56
58
  cetus: 9,
57
59
  afsui: 9,
58
60
  hasui: 9,
61
+ vsui: 9,
59
62
  seth: 8,
60
63
  sbtc: 8,
61
64
  susdc: 6,
@@ -65,7 +68,8 @@ var coinDecimals = {
65
68
  ssol: 8,
66
69
  scetus: 9,
67
70
  safsui: 9,
68
- shasui: 9
71
+ shasui: 9,
72
+ svsui: 9
69
73
  };
70
74
  var assetCoins = {
71
75
  eth: "eth",
@@ -77,7 +81,8 @@ var assetCoins = {
77
81
  sol: "sol",
78
82
  cetus: "cetus",
79
83
  afsui: "afsui",
80
- hasui: "hasui"
84
+ hasui: "hasui",
85
+ vsui: "vsui"
81
86
  };
82
87
  var marketCoins = {
83
88
  seth: "seth",
@@ -89,7 +94,8 @@ var marketCoins = {
89
94
  ssol: "ssol",
90
95
  scetus: "scetus",
91
96
  safsui: "safsui",
92
- shasui: "shasui"
97
+ shasui: "shasui",
98
+ svsui: "svsui"
93
99
  };
94
100
  var stakeMarketCoins = {
95
101
  ssui: "ssui",
@@ -111,7 +117,8 @@ var coinIds = {
111
117
  sol: "0xb7844e289a8410e50fb3ca48d69eb9cf29e27d223ef90353fe1bd8e27ff8f3f8",
112
118
  cetus: "0x06864a6f921804860930db6ddbe2e16acdf8504495ea7481637a1c8b9a8fe54b",
113
119
  afsui: "0xf325ce1300e8dac124071d3152c5c5ee6174914f8bc2161e88329cf579246efc",
114
- hasui: "0xbde4ba4c2e274a60ce15c1cfff9e5c42e41654ac8b6d906a57efa4bd3c29f47d"
120
+ hasui: "0xbde4ba4c2e274a60ce15c1cfff9e5c42e41654ac8b6d906a57efa4bd3c29f47d",
121
+ vsui: "0x549e8b69270defbfafd4f94e17ec44cdbdd99820b33bda2278dea3b9a32d3f55"
115
122
  };
116
123
  var wormholeCoinIds = {
117
124
  eth: "0xaf8cd5edc19c4512f4259f0bee101a40d41ebed738ade5874359610ef8eeced5",
@@ -121,6 +128,9 @@ var wormholeCoinIds = {
121
128
  apt: "0x3a5143bb1196e3bcdfab6203d1683ae29edd26294fc8bfeafe4aaa9d2704df37",
122
129
  sol: "0xb7844e289a8410e50fb3ca48d69eb9cf29e27d223ef90353fe1bd8e27ff8f3f8"
123
130
  };
131
+ var voloCoinIds = {
132
+ vsui: "0x549e8b69270defbfafd4f94e17ec44cdbdd99820b33bda2278dea3b9a32d3f55"
133
+ };
124
134
 
125
135
  // src/models/scallop.ts
126
136
  import { SuiKit as SuiKit5 } from "@scallop-io/sui-kit";
@@ -199,6 +209,45 @@ var EMPTY_ADDRESSES = {
199
209
  feedObject: ""
200
210
  }
201
211
  }
212
+ },
213
+ afsui: {
214
+ id: "",
215
+ metaData: "",
216
+ treasury: "",
217
+ oracle: {
218
+ supra: "",
219
+ switchboard: "",
220
+ pyth: {
221
+ feed: "",
222
+ feedObject: ""
223
+ }
224
+ }
225
+ },
226
+ hasui: {
227
+ id: "",
228
+ metaData: "",
229
+ treasury: "",
230
+ oracle: {
231
+ supra: "",
232
+ switchboard: "",
233
+ pyth: {
234
+ feed: "",
235
+ feedObject: ""
236
+ }
237
+ }
238
+ },
239
+ vsui: {
240
+ id: "",
241
+ metaData: "",
242
+ treasury: "",
243
+ oracle: {
244
+ supra: "",
245
+ switchboard: "",
246
+ pyth: {
247
+ feed: "",
248
+ feedObject: ""
249
+ }
250
+ }
202
251
  }
203
252
  },
204
253
  oracles: {
@@ -855,8 +904,8 @@ var minBigNumber = (...args) => {
855
904
 
856
905
  // src/utils/util.ts
857
906
  var isMarketCoin = (coinName) => {
858
- const assetCoinName = coinName.slice(1);
859
- return [
907
+ const assetCoinName = coinName.slice(1).toLowerCase();
908
+ return coinName.charAt(0).toLowerCase() === "s" && [
860
909
  .../* @__PURE__ */ new Set([
861
910
  ...SUPPORT_POOLS,
862
911
  ...SUPPORT_COLLATERALS,
@@ -864,6 +913,18 @@ var isMarketCoin = (coinName) => {
864
913
  ])
865
914
  ].includes(assetCoinName);
866
915
  };
916
+ var parseAssetSymbol = (coinName) => {
917
+ switch (coinName) {
918
+ case "afsui":
919
+ return "afSUI";
920
+ case "hasui":
921
+ return "haSUI";
922
+ case "vsui":
923
+ return "vSUI";
924
+ default:
925
+ return coinName.toUpperCase();
926
+ }
927
+ };
867
928
 
868
929
  // src/queries/coreQuery.ts
869
930
  var queryMarket = async (query) => {
@@ -2437,9 +2498,10 @@ var ScallopUtils = class {
2437
2498
  */
2438
2499
  parseSymbol(coinName) {
2439
2500
  if (isMarketCoin(coinName)) {
2440
- return coinName.slice(0, 1) + coinName.slice(1).toUpperCase();
2501
+ const assetCoinName = coinName.slice(1).toLowerCase();
2502
+ return coinName.slice(0, 1).toLowerCase() + parseAssetSymbol(assetCoinName);
2441
2503
  } else {
2442
- return coinName.toUpperCase();
2504
+ return parseAssetSymbol(coinName);
2443
2505
  }
2444
2506
  }
2445
2507
  /**
@@ -2455,13 +2517,13 @@ var ScallopUtils = class {
2455
2517
  */
2456
2518
  parseCoinType(coinName) {
2457
2519
  coinName = isMarketCoin(coinName) ? this.parseCoinName(coinName) : coinName;
2458
- const coinPackageId = this._address.get(`core.coins.${coinName}.id`) ?? coinIds[coinName] ?? void 0;
2520
+ const coinPackageId = this._address.get(`core.coins.${coinName}.id`) || coinIds[coinName] || void 0;
2459
2521
  if (!coinPackageId) {
2460
2522
  throw Error(`Coin ${coinName} is not supported`);
2461
2523
  }
2462
2524
  if (coinName === "sui")
2463
2525
  return normalizeStructTag2(`${coinPackageId}::sui::SUI`);
2464
- const wormHoleCoinIds = [
2526
+ const wormHolePckageIds = [
2465
2527
  this._address.get("core.coins.usdc.id") ?? wormholeCoinIds.usdc,
2466
2528
  this._address.get("core.coins.usdt.id") ?? wormholeCoinIds.usdt,
2467
2529
  this._address.get("core.coins.eth.id") ?? wormholeCoinIds.eth,
@@ -2469,8 +2531,13 @@ var ScallopUtils = class {
2469
2531
  this._address.get("core.coins.sol.id") ?? wormholeCoinIds.sol,
2470
2532
  this._address.get("core.coins.apt.id") ?? wormholeCoinIds.apt
2471
2533
  ];
2472
- if (wormHoleCoinIds.includes(coinPackageId)) {
2534
+ const voloPckageIds = [
2535
+ this._address.get("core.coins.vsui.id") ?? voloCoinIds.vsui
2536
+ ];
2537
+ if (wormHolePckageIds.includes(coinPackageId)) {
2473
2538
  return `${coinPackageId}::coin::COIN`;
2539
+ } else if (voloPckageIds.includes(coinPackageId)) {
2540
+ return `${coinPackageId}::cert::CERT`;
2474
2541
  } else {
2475
2542
  return `${coinPackageId}::${coinName}::${coinName.toUpperCase()}`;
2476
2543
  }
@@ -2500,7 +2567,10 @@ var ScallopUtils = class {
2500
2567
  [`${this._address.get("core.coins.sol.id") ?? wormholeCoinIds.sol}::coin::COIN`]: "sol",
2501
2568
  [`${this._address.get("core.coins.apt.id") ?? wormholeCoinIds.apt}::coin::COIN`]: "apt"
2502
2569
  };
2503
- const assetCoinName = wormHoleCoinTypeMap[coinType] || coinType.split("::")[2].toLowerCase();
2570
+ const voloCoinTypeMap = {
2571
+ [`${this._address.get("core.coins.vsui.id") ?? voloCoinIds.vsui}::cert::CERT`]: "vsui"
2572
+ };
2573
+ const assetCoinName = wormHoleCoinTypeMap[coinType] || voloCoinTypeMap[coinType] || coinType.split("::")[2].toLowerCase();
2504
2574
  return isMarketCoinType ? this.parseMarketCoinName(assetCoinName) : assetCoinName;
2505
2575
  }
2506
2576
  /**
@@ -2623,13 +2693,14 @@ var ScallopUtils = class {
2623
2693
  );
2624
2694
  try {
2625
2695
  const priceFeeds = await pythConnection.getLatestPriceFeeds(priceIds) || [];
2626
- for (const feed of priceFeeds) {
2696
+ for (const [index, feed] of priceFeeds.entries()) {
2627
2697
  const data = parseDataFromPythPriceFeed(feed, this._address);
2628
- this._priceMap.set(data.coinName, {
2698
+ const coinName = lackPricesCoinNames[index];
2699
+ this._priceMap.set(coinName, {
2629
2700
  price: data.price,
2630
2701
  publishTime: data.publishTime
2631
2702
  });
2632
- coinPrices[data.coinName] = data.price;
2703
+ coinPrices[coinName] = data.price;
2633
2704
  }
2634
2705
  } catch (_e) {
2635
2706
  for (const coinName of lackPricesCoinNames) {
@@ -3967,6 +4038,7 @@ export {
3967
4038
  marketCoins,
3968
4039
  rewardCoins,
3969
4040
  stakeMarketCoins,
4041
+ voloCoinIds,
3970
4042
  wormholeCoinIds
3971
4043
  };
3972
4044
  //# sourceMappingURL=index.mjs.map