@scallop-io/sui-scallop-sdk 0.44.0 → 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
@@ -10,7 +10,10 @@ var SUPPORT_POOLS = [
10
10
  "sui",
11
11
  "apt",
12
12
  "sol",
13
- "cetus"
13
+ "cetus",
14
+ "afsui",
15
+ "hasui",
16
+ "vsui"
14
17
  ];
15
18
  var SUPPORT_COLLATERALS = [
16
19
  "eth",
@@ -20,7 +23,10 @@ var SUPPORT_COLLATERALS = [
20
23
  "sui",
21
24
  "apt",
22
25
  "sol",
23
- "cetus"
26
+ "cetus",
27
+ "afsui",
28
+ "hasui",
29
+ "vsui"
24
30
  ];
25
31
  var SUPPORT_SPOOLS = ["ssui", "susdc", "susdt"];
26
32
  var SUPPORT_REWARD_POOLS = ["sui"];
@@ -50,6 +56,9 @@ var coinDecimals = {
50
56
  apt: 8,
51
57
  sol: 8,
52
58
  cetus: 9,
59
+ afsui: 9,
60
+ hasui: 9,
61
+ vsui: 9,
53
62
  seth: 8,
54
63
  sbtc: 8,
55
64
  susdc: 6,
@@ -57,7 +66,10 @@ var coinDecimals = {
57
66
  ssui: 9,
58
67
  sapt: 8,
59
68
  ssol: 8,
60
- scetus: 9
69
+ scetus: 9,
70
+ safsui: 9,
71
+ shasui: 9,
72
+ svsui: 9
61
73
  };
62
74
  var assetCoins = {
63
75
  eth: "eth",
@@ -67,7 +79,10 @@ var assetCoins = {
67
79
  sui: "sui",
68
80
  apt: "apt",
69
81
  sol: "sol",
70
- cetus: "cetus"
82
+ cetus: "cetus",
83
+ afsui: "afsui",
84
+ hasui: "hasui",
85
+ vsui: "vsui"
71
86
  };
72
87
  var marketCoins = {
73
88
  seth: "seth",
@@ -77,7 +92,10 @@ var marketCoins = {
77
92
  ssui: "ssui",
78
93
  sapt: "sapt",
79
94
  ssol: "ssol",
80
- scetus: "scetus"
95
+ scetus: "scetus",
96
+ safsui: "safsui",
97
+ shasui: "shasui",
98
+ svsui: "svsui"
81
99
  };
82
100
  var stakeMarketCoins = {
83
101
  ssui: "ssui",
@@ -97,7 +115,10 @@ var coinIds = {
97
115
  usdt: "0xc060006111016b8a020ad5b33834984a437aaa7d3c74c18e09a95d48aceab08c",
98
116
  apt: "0x3a5143bb1196e3bcdfab6203d1683ae29edd26294fc8bfeafe4aaa9d2704df37",
99
117
  sol: "0xb7844e289a8410e50fb3ca48d69eb9cf29e27d223ef90353fe1bd8e27ff8f3f8",
100
- cetus: "0x06864a6f921804860930db6ddbe2e16acdf8504495ea7481637a1c8b9a8fe54b"
118
+ cetus: "0x06864a6f921804860930db6ddbe2e16acdf8504495ea7481637a1c8b9a8fe54b",
119
+ afsui: "0xf325ce1300e8dac124071d3152c5c5ee6174914f8bc2161e88329cf579246efc",
120
+ hasui: "0xbde4ba4c2e274a60ce15c1cfff9e5c42e41654ac8b6d906a57efa4bd3c29f47d",
121
+ vsui: "0x549e8b69270defbfafd4f94e17ec44cdbdd99820b33bda2278dea3b9a32d3f55"
101
122
  };
102
123
  var wormholeCoinIds = {
103
124
  eth: "0xaf8cd5edc19c4512f4259f0bee101a40d41ebed738ade5874359610ef8eeced5",
@@ -107,6 +128,9 @@ var wormholeCoinIds = {
107
128
  apt: "0x3a5143bb1196e3bcdfab6203d1683ae29edd26294fc8bfeafe4aaa9d2704df37",
108
129
  sol: "0xb7844e289a8410e50fb3ca48d69eb9cf29e27d223ef90353fe1bd8e27ff8f3f8"
109
130
  };
131
+ var voloCoinIds = {
132
+ vsui: "0x549e8b69270defbfafd4f94e17ec44cdbdd99820b33bda2278dea3b9a32d3f55"
133
+ };
110
134
 
111
135
  // src/models/scallop.ts
112
136
  import { SuiKit as SuiKit5 } from "@scallop-io/sui-kit";
@@ -185,6 +209,45 @@ var EMPTY_ADDRESSES = {
185
209
  feedObject: ""
186
210
  }
187
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
+ }
188
251
  }
189
252
  },
190
253
  oracles: {
@@ -841,8 +904,8 @@ var minBigNumber = (...args) => {
841
904
 
842
905
  // src/utils/util.ts
843
906
  var isMarketCoin = (coinName) => {
844
- const assetCoinName = coinName.slice(1);
845
- return [
907
+ const assetCoinName = coinName.slice(1).toLowerCase();
908
+ return coinName.charAt(0).toLowerCase() === "s" && [
846
909
  .../* @__PURE__ */ new Set([
847
910
  ...SUPPORT_POOLS,
848
911
  ...SUPPORT_COLLATERALS,
@@ -850,6 +913,18 @@ var isMarketCoin = (coinName) => {
850
913
  ])
851
914
  ].includes(assetCoinName);
852
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
+ };
853
928
 
854
929
  // src/queries/coreQuery.ts
855
930
  var queryMarket = async (query) => {
@@ -2423,9 +2498,10 @@ var ScallopUtils = class {
2423
2498
  */
2424
2499
  parseSymbol(coinName) {
2425
2500
  if (isMarketCoin(coinName)) {
2426
- 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);
2427
2503
  } else {
2428
- return coinName.toUpperCase();
2504
+ return parseAssetSymbol(coinName);
2429
2505
  }
2430
2506
  }
2431
2507
  /**
@@ -2441,13 +2517,13 @@ var ScallopUtils = class {
2441
2517
  */
2442
2518
  parseCoinType(coinName) {
2443
2519
  coinName = isMarketCoin(coinName) ? this.parseCoinName(coinName) : coinName;
2444
- 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;
2445
2521
  if (!coinPackageId) {
2446
2522
  throw Error(`Coin ${coinName} is not supported`);
2447
2523
  }
2448
2524
  if (coinName === "sui")
2449
2525
  return normalizeStructTag2(`${coinPackageId}::sui::SUI`);
2450
- const wormHoleCoinIds = [
2526
+ const wormHolePckageIds = [
2451
2527
  this._address.get("core.coins.usdc.id") ?? wormholeCoinIds.usdc,
2452
2528
  this._address.get("core.coins.usdt.id") ?? wormholeCoinIds.usdt,
2453
2529
  this._address.get("core.coins.eth.id") ?? wormholeCoinIds.eth,
@@ -2455,8 +2531,13 @@ var ScallopUtils = class {
2455
2531
  this._address.get("core.coins.sol.id") ?? wormholeCoinIds.sol,
2456
2532
  this._address.get("core.coins.apt.id") ?? wormholeCoinIds.apt
2457
2533
  ];
2458
- if (wormHoleCoinIds.includes(coinPackageId)) {
2534
+ const voloPckageIds = [
2535
+ this._address.get("core.coins.vsui.id") ?? voloCoinIds.vsui
2536
+ ];
2537
+ if (wormHolePckageIds.includes(coinPackageId)) {
2459
2538
  return `${coinPackageId}::coin::COIN`;
2539
+ } else if (voloPckageIds.includes(coinPackageId)) {
2540
+ return `${coinPackageId}::cert::CERT`;
2460
2541
  } else {
2461
2542
  return `${coinPackageId}::${coinName}::${coinName.toUpperCase()}`;
2462
2543
  }
@@ -2486,7 +2567,10 @@ var ScallopUtils = class {
2486
2567
  [`${this._address.get("core.coins.sol.id") ?? wormholeCoinIds.sol}::coin::COIN`]: "sol",
2487
2568
  [`${this._address.get("core.coins.apt.id") ?? wormholeCoinIds.apt}::coin::COIN`]: "apt"
2488
2569
  };
2489
- 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();
2490
2574
  return isMarketCoinType ? this.parseMarketCoinName(assetCoinName) : assetCoinName;
2491
2575
  }
2492
2576
  /**
@@ -2609,13 +2693,14 @@ var ScallopUtils = class {
2609
2693
  );
2610
2694
  try {
2611
2695
  const priceFeeds = await pythConnection.getLatestPriceFeeds(priceIds) || [];
2612
- for (const feed of priceFeeds) {
2696
+ for (const [index, feed] of priceFeeds.entries()) {
2613
2697
  const data = parseDataFromPythPriceFeed(feed, this._address);
2614
- this._priceMap.set(data.coinName, {
2698
+ const coinName = lackPricesCoinNames[index];
2699
+ this._priceMap.set(coinName, {
2615
2700
  price: data.price,
2616
2701
  publishTime: data.publishTime
2617
2702
  });
2618
- coinPrices[data.coinName] = data.price;
2703
+ coinPrices[coinName] = data.price;
2619
2704
  }
2620
2705
  } catch (_e) {
2621
2706
  for (const coinName of lackPricesCoinNames) {
@@ -3953,6 +4038,7 @@ export {
3953
4038
  marketCoins,
3954
4039
  rewardCoins,
3955
4040
  stakeMarketCoins,
4041
+ voloCoinIds,
3956
4042
  wormholeCoinIds
3957
4043
  };
3958
4044
  //# sourceMappingURL=index.mjs.map