@1delta/margin-fetcher 5.0.51 → 5.0.52
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 +16 -2
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -56478,10 +56478,24 @@ var ASSET_TOKENS = /* @__PURE__ */ new Set([
|
|
|
56478
56478
|
"plume",
|
|
56479
56479
|
"s"
|
|
56480
56480
|
]);
|
|
56481
|
+
var isAssetToken = (tl, asset) => {
|
|
56482
|
+
if (asset && tl === asset || ASSET_TOKENS.has(tl) || tl.includes("usd")) {
|
|
56483
|
+
return true;
|
|
56484
|
+
}
|
|
56485
|
+
const unwrapped = tl.replace(/^(cb|wst|ws|w|st)/, "");
|
|
56486
|
+
return unwrapped !== tl && ASSET_TOKENS.has(unwrapped);
|
|
56487
|
+
};
|
|
56481
56488
|
function curatorNameFromVaultName(name, assetSymbol) {
|
|
56482
56489
|
if (!name) return void 0;
|
|
56483
56490
|
if (/\b(test|testing|fake)\b/i.test(name)) return void 0;
|
|
56484
|
-
const
|
|
56491
|
+
const by = /\bby\s+(.{2,})$/i.exec(name);
|
|
56492
|
+
if (by) {
|
|
56493
|
+
const suffix = by[1].trim().split(/\s+/).slice(0, 3).join(" ");
|
|
56494
|
+
if (suffix.length >= 2 && !isAssetToken(suffix.toLowerCase(), (assetSymbol ?? "").toLowerCase())) {
|
|
56495
|
+
return suffix;
|
|
56496
|
+
}
|
|
56497
|
+
}
|
|
56498
|
+
const cleaned = name.replace(/\([^)]*\)\s*$/, "").split(":")[0].trim();
|
|
56485
56499
|
if (!cleaned) return void 0;
|
|
56486
56500
|
const tokens = cleaned.split(/[\s/]+/).flatMap((t) => t.split("-")).filter(Boolean);
|
|
56487
56501
|
const asset = (assetSymbol ?? "").toLowerCase();
|
|
@@ -56489,7 +56503,7 @@ function curatorNameFromVaultName(name, assetSymbol) {
|
|
|
56489
56503
|
let terminated = false;
|
|
56490
56504
|
for (const tok of tokens) {
|
|
56491
56505
|
const tl = tok.toLowerCase();
|
|
56492
|
-
if (STOP_WORDS.has(tl) ||
|
|
56506
|
+
if (STOP_WORDS.has(tl) || isAssetToken(tl, asset)) {
|
|
56493
56507
|
terminated = true;
|
|
56494
56508
|
break;
|
|
56495
56509
|
}
|