@goodwidget/ai-credits-widget 0.1.11 → 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 +3 -3
- package/dist/chunk-3QY3YZDH.js.map +0 -1
package/dist/mocked/index.js
CHANGED
package/dist/register.cjs
CHANGED
|
@@ -141,20 +141,21 @@ function formatGValue(amount) {
|
|
|
141
141
|
if (value < 0.01) return "<0.01";
|
|
142
142
|
return gGrouped.format(value);
|
|
143
143
|
}
|
|
144
|
-
function formatGAmount(amount) {
|
|
145
|
-
return `${formatGValue(amount)} G$`;
|
|
146
|
-
}
|
|
147
144
|
function isGValueCompacted(amount) {
|
|
148
145
|
const value = toNumber(amount);
|
|
149
146
|
return Number.isFinite(value) && value >= G_COMPACT_FROM;
|
|
150
147
|
}
|
|
151
|
-
function
|
|
148
|
+
function formatExactGValue(amount) {
|
|
152
149
|
const value = toNumber(amount);
|
|
153
|
-
if (!Number.isFinite(value) || value <= 0) return "0
|
|
154
|
-
|
|
150
|
+
if (!Number.isFinite(value) || value <= 0) return "0";
|
|
151
|
+
if (value < 0.01) return "<0.01";
|
|
152
|
+
return gGrouped.format(value);
|
|
153
|
+
}
|
|
154
|
+
function formatExactGAmount(amount) {
|
|
155
|
+
return `${formatExactGValue(amount)} G$`;
|
|
155
156
|
}
|
|
156
|
-
function
|
|
157
|
-
return
|
|
157
|
+
function formatExactGWeiAmount(amountWei) {
|
|
158
|
+
return formatExactGAmount(weiToNumber(amountWei));
|
|
158
159
|
}
|
|
159
160
|
function formatUsdValue(amount) {
|
|
160
161
|
const value = toNumber(amount);
|
|
@@ -182,7 +183,7 @@ var G_COMPACT_FROM, USD_MIN_VISIBLE, gGrouped, gCompact, usdGrouped;
|
|
|
182
183
|
var init_format = __esm({
|
|
183
184
|
"src/format.ts"() {
|
|
184
185
|
"use strict";
|
|
185
|
-
G_COMPACT_FROM =
|
|
186
|
+
G_COMPACT_FROM = 1e3;
|
|
186
187
|
USD_MIN_VISIBLE = 5e-3;
|
|
187
188
|
gGrouped = new Intl.NumberFormat("en-US", {
|
|
188
189
|
minimumFractionDigits: 0,
|
|
@@ -190,7 +191,7 @@ var init_format = __esm({
|
|
|
190
191
|
});
|
|
191
192
|
gCompact = new Intl.NumberFormat("en-US", {
|
|
192
193
|
notation: "compact",
|
|
193
|
-
maximumFractionDigits:
|
|
194
|
+
maximumFractionDigits: 1
|
|
194
195
|
});
|
|
195
196
|
usdGrouped = new Intl.NumberFormat("en-US", {
|
|
196
197
|
minimumFractionDigits: 2,
|
|
@@ -1609,9 +1610,9 @@ var init_paymentErrors = __esm({
|
|
|
1609
1610
|
function formatMinGDisplay(amountWei) {
|
|
1610
1611
|
const raw = Number(amountWei) / 1e18;
|
|
1611
1612
|
if (!Number.isFinite(raw) || raw <= 0) return "0";
|
|
1612
|
-
if (raw >= 1e3) return
|
|
1613
|
-
if (raw >= 10) return
|
|
1614
|
-
return
|
|
1613
|
+
if (raw >= 1e3) return formatExactGValue(Math.ceil(raw));
|
|
1614
|
+
if (raw >= 10) return formatExactGValue(Math.ceil(raw * 10) / 10);
|
|
1615
|
+
return formatExactGValue(Math.ceil(raw * 100) / 100);
|
|
1615
1616
|
}
|
|
1616
1617
|
function formatMinUsdDisplay(usd) {
|
|
1617
1618
|
return formatUsdDisplay(usd);
|
|
@@ -5137,7 +5138,7 @@ function formatEntryGAmount(gdAmountWei) {
|
|
|
5137
5138
|
try {
|
|
5138
5139
|
const amountWei = BigInt(gdAmountWei || "0");
|
|
5139
5140
|
if (amountWei <= 0n) return null;
|
|
5140
|
-
return
|
|
5141
|
+
return formatExactGWeiAmount(amountWei);
|
|
5141
5142
|
} catch {
|
|
5142
5143
|
return null;
|
|
5143
5144
|
}
|
|
@@ -5236,7 +5237,7 @@ function sumFilteredGdWei(entries) {
|
|
|
5236
5237
|
}, 0n);
|
|
5237
5238
|
}
|
|
5238
5239
|
function formatAccumulatedG(amountWei) {
|
|
5239
|
-
return
|
|
5240
|
+
return formatExactGAmount(Number(amountWei) / 1e18);
|
|
5240
5241
|
}
|
|
5241
5242
|
function formatShortDate(dateValue) {
|
|
5242
5243
|
const date = /* @__PURE__ */ new Date(`${dateValue}T00:00:00.000Z`);
|