@t2000/engine 0.6.6 → 0.6.8
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.js +27 -9
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -160,6 +160,8 @@ var KNOWN_COINS = {
|
|
|
160
160
|
"0xdba34672e30cb065b1f93e3ab55318768fd6fef66c15942c9f7cb846e2f900e7::usdc::USDC": { symbol: "USDC", decimals: 6 },
|
|
161
161
|
"0xc060006111016b8a020ad5b33834984a437aaa7d3c74c18e09a95d48aceab08c::coin::COIN": { symbol: "USDT", decimals: 6 },
|
|
162
162
|
"0x375f70cf2ae4c00bf37117d0c85a2c71545e6ee05c4a5c7d282cd66a4504b068::usdt::USDT": { symbol: "USDT", decimals: 6 },
|
|
163
|
+
"0x44f838219cf67b058f3b37907b655f226153c18e33dfcd0da559a844fea9b1c1::usdsui::USDSUI": { symbol: "USDsui", decimals: 6 },
|
|
164
|
+
"0x41d587e5336f1c86cad50d38a7136db99333bb9bda91cea4ba69115defeb1402::sui_usde::SUI_USDE": { symbol: "USDe", decimals: 6 },
|
|
163
165
|
"0xd0e89b2af5e4910726fbcd8b8dd37bb79b29e5f83f7491bca830e94f7f226d29::eth::ETH": { symbol: "ETH", decimals: 8 },
|
|
164
166
|
"0x0041f9f9344cac094454cd574e333c4fdb132d7bcc9379bcd4aab485b2a63942::wbtc::WBTC": { symbol: "BTC", decimals: 8 },
|
|
165
167
|
"0x356a26eb9e012a68958082340d4c4116e7f55615cf27affcff209cf0ae544f59::wal::WAL": { symbol: "WAL", decimals: 9 },
|
|
@@ -293,18 +295,34 @@ function transformRates(raw) {
|
|
|
293
295
|
}
|
|
294
296
|
return result;
|
|
295
297
|
}
|
|
298
|
+
var NAVI_NEWER_POOL_SYMBOLS = /* @__PURE__ */ new Set([
|
|
299
|
+
"USDSUI",
|
|
300
|
+
"USDsui",
|
|
301
|
+
"SUI_USDE",
|
|
302
|
+
"suiUSDe",
|
|
303
|
+
"USDe",
|
|
304
|
+
"suiUSDT"
|
|
305
|
+
]);
|
|
306
|
+
var NEWER_POOL_FACTOR = 1e3;
|
|
307
|
+
function naviDecimalFactor(symbol) {
|
|
308
|
+
return NAVI_NEWER_POOL_SYMBOLS.has(symbol) ? NEWER_POOL_FACTOR : 1;
|
|
309
|
+
}
|
|
296
310
|
function transformPositions(raw) {
|
|
297
311
|
const data = raw;
|
|
298
312
|
const positions = data?.positions ?? (Array.isArray(raw) ? raw : []);
|
|
299
|
-
return positions.map((p) =>
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
313
|
+
return positions.map((p) => {
|
|
314
|
+
const symbol = p.tokenASymbol ?? "UNKNOWN";
|
|
315
|
+
const factor = naviDecimalFactor(symbol);
|
|
316
|
+
return {
|
|
317
|
+
protocol: p.protocol ?? "navi",
|
|
318
|
+
type: p.type?.includes("borrow") ? "borrow" : "supply",
|
|
319
|
+
symbol,
|
|
320
|
+
amount: toNum(p.amountA) * factor,
|
|
321
|
+
valueUsd: toNum(p.valueUSD) * factor,
|
|
322
|
+
apy: toNum(p.apr) / 100,
|
|
323
|
+
liquidationThreshold: toNum(p.liquidationThreshold)
|
|
324
|
+
};
|
|
325
|
+
});
|
|
308
326
|
}
|
|
309
327
|
function transformHealthFactor(rawHf, rawPositions) {
|
|
310
328
|
const hf = rawHf;
|