@fileverse-dev/formulajs 4.4.15 → 4.4.17
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/lib/browser/formula.js +55 -36
- package/lib/browser/formula.min.js +2 -2
- package/lib/browser/formula.min.js.map +1 -1
- package/lib/cjs/index.cjs +22 -11
- package/lib/esm/index.mjs +22 -11
- package/package.json +1 -1
package/lib/cjs/index.cjs
CHANGED
|
@@ -17870,7 +17870,7 @@ async function COINGECKO() {
|
|
|
17870
17870
|
const out = {};
|
|
17871
17871
|
for (const [token, prices] of Object.entries(json))
|
|
17872
17872
|
for (const [cur, val] of Object.entries(prices))
|
|
17873
|
-
out[`${token.
|
|
17873
|
+
out[`${token.toUpperCase()}_${cur.toUpperCase()}`] = val;
|
|
17874
17874
|
return [out]
|
|
17875
17875
|
}
|
|
17876
17876
|
|
|
@@ -18586,17 +18586,22 @@ const SUPPORTED_TOKEN_NAMES = {
|
|
|
18586
18586
|
|
|
18587
18587
|
|
|
18588
18588
|
function formatNumber(raw, decimals) {
|
|
18589
|
-
|
|
18589
|
+
try {
|
|
18590
|
+
if(!decimals){
|
|
18591
|
+
return raw
|
|
18592
|
+
}
|
|
18593
|
+
const quorum = BigInt(raw);
|
|
18594
|
+
const divisor = 10 ** decimals;
|
|
18595
|
+
const normalized = Number(quorum) / divisor;
|
|
18596
|
+
|
|
18597
|
+
return new Intl.NumberFormat("en-US", {
|
|
18598
|
+
notation: "compact",
|
|
18599
|
+
maximumFractionDigits: 2,
|
|
18600
|
+
}).format(normalized);
|
|
18601
|
+
} catch (error) {
|
|
18602
|
+
console.log({error});
|
|
18590
18603
|
return raw
|
|
18591
18604
|
}
|
|
18592
|
-
const quorum = BigInt(raw);
|
|
18593
|
-
const divisor = 10 ** decimals;
|
|
18594
|
-
const normalized = Number(quorum) / divisor;
|
|
18595
|
-
|
|
18596
|
-
return new Intl.NumberFormat("en-US", {
|
|
18597
|
-
notation: "compact",
|
|
18598
|
-
maximumFractionDigits: 2,
|
|
18599
|
-
}).format(normalized);
|
|
18600
18605
|
}
|
|
18601
18606
|
|
|
18602
18607
|
let cachedChains = null;
|
|
@@ -18667,7 +18672,13 @@ async function DUNE() {
|
|
|
18667
18672
|
});
|
|
18668
18673
|
|
|
18669
18674
|
const res = await fetch(finalUrl, { method: "GET", headers: HEADERS });
|
|
18670
|
-
if (!res.ok)
|
|
18675
|
+
if (!res.ok) {
|
|
18676
|
+
if(res.status === 400){
|
|
18677
|
+
const data = await res.json();
|
|
18678
|
+
throw new ValidationError(data.message)
|
|
18679
|
+
}
|
|
18680
|
+
throw new NetworkError(SERVICES_API_KEY.DuneSim, res.status);
|
|
18681
|
+
}
|
|
18671
18682
|
|
|
18672
18683
|
const json = await res.json();
|
|
18673
18684
|
const data =
|
package/lib/esm/index.mjs
CHANGED
|
@@ -17868,7 +17868,7 @@ async function COINGECKO() {
|
|
|
17868
17868
|
const out = {};
|
|
17869
17869
|
for (const [token, prices] of Object.entries(json))
|
|
17870
17870
|
for (const [cur, val] of Object.entries(prices))
|
|
17871
|
-
out[`${token.
|
|
17871
|
+
out[`${token.toUpperCase()}_${cur.toUpperCase()}`] = val;
|
|
17872
17872
|
return [out]
|
|
17873
17873
|
}
|
|
17874
17874
|
|
|
@@ -18584,17 +18584,22 @@ const SUPPORTED_TOKEN_NAMES = {
|
|
|
18584
18584
|
|
|
18585
18585
|
|
|
18586
18586
|
function formatNumber(raw, decimals) {
|
|
18587
|
-
|
|
18587
|
+
try {
|
|
18588
|
+
if(!decimals){
|
|
18589
|
+
return raw
|
|
18590
|
+
}
|
|
18591
|
+
const quorum = BigInt(raw);
|
|
18592
|
+
const divisor = 10 ** decimals;
|
|
18593
|
+
const normalized = Number(quorum) / divisor;
|
|
18594
|
+
|
|
18595
|
+
return new Intl.NumberFormat("en-US", {
|
|
18596
|
+
notation: "compact",
|
|
18597
|
+
maximumFractionDigits: 2,
|
|
18598
|
+
}).format(normalized);
|
|
18599
|
+
} catch (error) {
|
|
18600
|
+
console.log({error});
|
|
18588
18601
|
return raw
|
|
18589
18602
|
}
|
|
18590
|
-
const quorum = BigInt(raw);
|
|
18591
|
-
const divisor = 10 ** decimals;
|
|
18592
|
-
const normalized = Number(quorum) / divisor;
|
|
18593
|
-
|
|
18594
|
-
return new Intl.NumberFormat("en-US", {
|
|
18595
|
-
notation: "compact",
|
|
18596
|
-
maximumFractionDigits: 2,
|
|
18597
|
-
}).format(normalized);
|
|
18598
18603
|
}
|
|
18599
18604
|
|
|
18600
18605
|
let cachedChains = null;
|
|
@@ -18665,7 +18670,13 @@ async function DUNE() {
|
|
|
18665
18670
|
});
|
|
18666
18671
|
|
|
18667
18672
|
const res = await fetch(finalUrl, { method: "GET", headers: HEADERS });
|
|
18668
|
-
if (!res.ok)
|
|
18673
|
+
if (!res.ok) {
|
|
18674
|
+
if(res.status === 400){
|
|
18675
|
+
const data = await res.json();
|
|
18676
|
+
throw new ValidationError(data.message)
|
|
18677
|
+
}
|
|
18678
|
+
throw new NetworkError(SERVICES_API_KEY.DuneSim, res.status);
|
|
18679
|
+
}
|
|
18669
18680
|
|
|
18670
18681
|
const json = await res.json();
|
|
18671
18682
|
const data =
|