@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
package/dist/element.js
CHANGED
package/dist/index.cjs
CHANGED
|
@@ -196,7 +196,7 @@ function clearDeepLinkArtifacts() {
|
|
|
196
196
|
var import_viem = require("viem");
|
|
197
197
|
|
|
198
198
|
// src/format.ts
|
|
199
|
-
var G_COMPACT_FROM =
|
|
199
|
+
var G_COMPACT_FROM = 1e3;
|
|
200
200
|
var USD_MIN_VISIBLE = 5e-3;
|
|
201
201
|
var gGrouped = new Intl.NumberFormat("en-US", {
|
|
202
202
|
minimumFractionDigits: 0,
|
|
@@ -204,7 +204,7 @@ var gGrouped = new Intl.NumberFormat("en-US", {
|
|
|
204
204
|
});
|
|
205
205
|
var gCompact = new Intl.NumberFormat("en-US", {
|
|
206
206
|
notation: "compact",
|
|
207
|
-
maximumFractionDigits:
|
|
207
|
+
maximumFractionDigits: 1
|
|
208
208
|
});
|
|
209
209
|
var usdGrouped = new Intl.NumberFormat("en-US", {
|
|
210
210
|
minimumFractionDigits: 2,
|
|
@@ -230,20 +230,21 @@ function formatGValue(amount) {
|
|
|
230
230
|
if (value < 0.01) return "<0.01";
|
|
231
231
|
return gGrouped.format(value);
|
|
232
232
|
}
|
|
233
|
-
function formatGAmount(amount) {
|
|
234
|
-
return `${formatGValue(amount)} G$`;
|
|
235
|
-
}
|
|
236
233
|
function isGValueCompacted(amount) {
|
|
237
234
|
const value = toNumber(amount);
|
|
238
235
|
return Number.isFinite(value) && value >= G_COMPACT_FROM;
|
|
239
236
|
}
|
|
240
|
-
function
|
|
237
|
+
function formatExactGValue(amount) {
|
|
241
238
|
const value = toNumber(amount);
|
|
242
|
-
if (!Number.isFinite(value) || value <= 0) return "0
|
|
243
|
-
|
|
239
|
+
if (!Number.isFinite(value) || value <= 0) return "0";
|
|
240
|
+
if (value < 0.01) return "<0.01";
|
|
241
|
+
return gGrouped.format(value);
|
|
242
|
+
}
|
|
243
|
+
function formatExactGAmount(amount) {
|
|
244
|
+
return `${formatExactGValue(amount)} G$`;
|
|
244
245
|
}
|
|
245
|
-
function
|
|
246
|
-
return
|
|
246
|
+
function formatExactGWeiAmount(amountWei) {
|
|
247
|
+
return formatExactGAmount(weiToNumber(amountWei));
|
|
247
248
|
}
|
|
248
249
|
function formatUsdValue(amount) {
|
|
249
250
|
const value = toNumber(amount);
|
|
@@ -1607,9 +1608,9 @@ var VAULT_MINIMUMS_ABI = (0, import_viem7.parseAbi)([
|
|
|
1607
1608
|
function formatMinGDisplay(amountWei) {
|
|
1608
1609
|
const raw = Number(amountWei) / 1e18;
|
|
1609
1610
|
if (!Number.isFinite(raw) || raw <= 0) return "0";
|
|
1610
|
-
if (raw >= 1e3) return
|
|
1611
|
-
if (raw >= 10) return
|
|
1612
|
-
return
|
|
1611
|
+
if (raw >= 1e3) return formatExactGValue(Math.ceil(raw));
|
|
1612
|
+
if (raw >= 10) return formatExactGValue(Math.ceil(raw * 10) / 10);
|
|
1613
|
+
return formatExactGValue(Math.ceil(raw * 100) / 100);
|
|
1613
1614
|
}
|
|
1614
1615
|
function formatMinUsdDisplay(usd) {
|
|
1615
1616
|
return formatUsdDisplay(usd);
|
|
@@ -5003,7 +5004,7 @@ function formatEntryGAmount(gdAmountWei) {
|
|
|
5003
5004
|
try {
|
|
5004
5005
|
const amountWei = BigInt(gdAmountWei || "0");
|
|
5005
5006
|
if (amountWei <= 0n) return null;
|
|
5006
|
-
return
|
|
5007
|
+
return formatExactGWeiAmount(amountWei);
|
|
5007
5008
|
} catch {
|
|
5008
5009
|
return null;
|
|
5009
5010
|
}
|
|
@@ -5102,7 +5103,7 @@ function sumFilteredGdWei(entries) {
|
|
|
5102
5103
|
}, 0n);
|
|
5103
5104
|
}
|
|
5104
5105
|
function formatAccumulatedG(amountWei) {
|
|
5105
|
-
return
|
|
5106
|
+
return formatExactGAmount(Number(amountWei) / 1e18);
|
|
5106
5107
|
}
|
|
5107
5108
|
function formatShortDate(dateValue) {
|
|
5108
5109
|
const date = /* @__PURE__ */ new Date(`${dateValue}T00:00:00.000Z`);
|