@goodwidget/ai-credits-widget 0.1.10 → 0.1.12
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/{chunk-3QY3YZDH.js → chunk-HFKD7MN7.js} +17 -16
- package/dist/chunk-HFKD7MN7.js.map +1 -0
- package/dist/element.cjs +16 -15
- package/dist/element.cjs.map +1 -1
- package/dist/element.js +1 -1
- package/dist/index.cjs +16 -15
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +1 -1
- package/dist/mocked/index.cjs +16 -15
- package/dist/mocked/index.cjs.map +1 -1
- package/dist/mocked/index.js +1 -1
- package/dist/register.cjs +16 -15
- package/dist/register.cjs.map +1 -1
- package/package.json +2 -2
- package/dist/chunk-3QY3YZDH.js.map +0 -1
|
@@ -115,7 +115,7 @@ function clearDeepLinkArtifacts() {
|
|
|
115
115
|
import { parseUnits } from "viem";
|
|
116
116
|
|
|
117
117
|
// src/format.ts
|
|
118
|
-
var G_COMPACT_FROM =
|
|
118
|
+
var G_COMPACT_FROM = 1e3;
|
|
119
119
|
var USD_MIN_VISIBLE = 5e-3;
|
|
120
120
|
var gGrouped = new Intl.NumberFormat("en-US", {
|
|
121
121
|
minimumFractionDigits: 0,
|
|
@@ -123,7 +123,7 @@ var gGrouped = new Intl.NumberFormat("en-US", {
|
|
|
123
123
|
});
|
|
124
124
|
var gCompact = new Intl.NumberFormat("en-US", {
|
|
125
125
|
notation: "compact",
|
|
126
|
-
maximumFractionDigits:
|
|
126
|
+
maximumFractionDigits: 1
|
|
127
127
|
});
|
|
128
128
|
var usdGrouped = new Intl.NumberFormat("en-US", {
|
|
129
129
|
minimumFractionDigits: 2,
|
|
@@ -149,20 +149,21 @@ function formatGValue(amount) {
|
|
|
149
149
|
if (value < 0.01) return "<0.01";
|
|
150
150
|
return gGrouped.format(value);
|
|
151
151
|
}
|
|
152
|
-
function formatGAmount(amount) {
|
|
153
|
-
return `${formatGValue(amount)} G$`;
|
|
154
|
-
}
|
|
155
152
|
function isGValueCompacted(amount) {
|
|
156
153
|
const value = toNumber(amount);
|
|
157
154
|
return Number.isFinite(value) && value >= G_COMPACT_FROM;
|
|
158
155
|
}
|
|
159
|
-
function
|
|
156
|
+
function formatExactGValue(amount) {
|
|
160
157
|
const value = toNumber(amount);
|
|
161
|
-
if (!Number.isFinite(value) || value <= 0) return "0
|
|
162
|
-
|
|
158
|
+
if (!Number.isFinite(value) || value <= 0) return "0";
|
|
159
|
+
if (value < 0.01) return "<0.01";
|
|
160
|
+
return gGrouped.format(value);
|
|
161
|
+
}
|
|
162
|
+
function formatExactGAmount(amount) {
|
|
163
|
+
return `${formatExactGValue(amount)} G$`;
|
|
163
164
|
}
|
|
164
|
-
function
|
|
165
|
-
return
|
|
165
|
+
function formatExactGWeiAmount(amountWei) {
|
|
166
|
+
return formatExactGAmount(weiToNumber(amountWei));
|
|
166
167
|
}
|
|
167
168
|
function formatUsdValue(amount) {
|
|
168
169
|
const value = toNumber(amount);
|
|
@@ -1537,9 +1538,9 @@ var VAULT_MINIMUMS_ABI = parseAbi3([
|
|
|
1537
1538
|
function formatMinGDisplay(amountWei) {
|
|
1538
1539
|
const raw = Number(amountWei) / 1e18;
|
|
1539
1540
|
if (!Number.isFinite(raw) || raw <= 0) return "0";
|
|
1540
|
-
if (raw >= 1e3) return
|
|
1541
|
-
if (raw >= 10) return
|
|
1542
|
-
return
|
|
1541
|
+
if (raw >= 1e3) return formatExactGValue(Math.ceil(raw));
|
|
1542
|
+
if (raw >= 10) return formatExactGValue(Math.ceil(raw * 10) / 10);
|
|
1543
|
+
return formatExactGValue(Math.ceil(raw * 100) / 100);
|
|
1543
1544
|
}
|
|
1544
1545
|
function formatMinUsdDisplay(usd) {
|
|
1545
1546
|
return formatUsdDisplay(usd);
|
|
@@ -5023,7 +5024,7 @@ function formatEntryGAmount(gdAmountWei) {
|
|
|
5023
5024
|
try {
|
|
5024
5025
|
const amountWei = BigInt(gdAmountWei || "0");
|
|
5025
5026
|
if (amountWei <= 0n) return null;
|
|
5026
|
-
return
|
|
5027
|
+
return formatExactGWeiAmount(amountWei);
|
|
5027
5028
|
} catch {
|
|
5028
5029
|
return null;
|
|
5029
5030
|
}
|
|
@@ -5122,7 +5123,7 @@ function sumFilteredGdWei(entries) {
|
|
|
5122
5123
|
}, 0n);
|
|
5123
5124
|
}
|
|
5124
5125
|
function formatAccumulatedG(amountWei) {
|
|
5125
|
-
return
|
|
5126
|
+
return formatExactGAmount(Number(amountWei) / 1e18);
|
|
5126
5127
|
}
|
|
5127
5128
|
function formatShortDate(dateValue) {
|
|
5128
5129
|
const date = /* @__PURE__ */ new Date(`${dateValue}T00:00:00.000Z`);
|
|
@@ -6911,4 +6912,4 @@ export {
|
|
|
6911
6912
|
useAiCreditsAdapter,
|
|
6912
6913
|
AiCreditsWidget
|
|
6913
6914
|
};
|
|
6914
|
-
//# sourceMappingURL=chunk-
|
|
6915
|
+
//# sourceMappingURL=chunk-HFKD7MN7.js.map
|