@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/index.js
CHANGED
package/dist/mocked/index.cjs
CHANGED
|
@@ -156,7 +156,7 @@ function clearDeepLinkArtifacts() {
|
|
|
156
156
|
var import_viem = require("viem");
|
|
157
157
|
|
|
158
158
|
// src/format.ts
|
|
159
|
-
var G_COMPACT_FROM =
|
|
159
|
+
var G_COMPACT_FROM = 1e3;
|
|
160
160
|
var USD_MIN_VISIBLE = 5e-3;
|
|
161
161
|
var gGrouped = new Intl.NumberFormat("en-US", {
|
|
162
162
|
minimumFractionDigits: 0,
|
|
@@ -164,7 +164,7 @@ var gGrouped = new Intl.NumberFormat("en-US", {
|
|
|
164
164
|
});
|
|
165
165
|
var gCompact = new Intl.NumberFormat("en-US", {
|
|
166
166
|
notation: "compact",
|
|
167
|
-
maximumFractionDigits:
|
|
167
|
+
maximumFractionDigits: 1
|
|
168
168
|
});
|
|
169
169
|
var usdGrouped = new Intl.NumberFormat("en-US", {
|
|
170
170
|
minimumFractionDigits: 2,
|
|
@@ -190,20 +190,21 @@ function formatGValue(amount) {
|
|
|
190
190
|
if (value < 0.01) return "<0.01";
|
|
191
191
|
return gGrouped.format(value);
|
|
192
192
|
}
|
|
193
|
-
function formatGAmount(amount) {
|
|
194
|
-
return `${formatGValue(amount)} G$`;
|
|
195
|
-
}
|
|
196
193
|
function isGValueCompacted(amount) {
|
|
197
194
|
const value = toNumber(amount);
|
|
198
195
|
return Number.isFinite(value) && value >= G_COMPACT_FROM;
|
|
199
196
|
}
|
|
200
|
-
function
|
|
197
|
+
function formatExactGValue(amount) {
|
|
201
198
|
const value = toNumber(amount);
|
|
202
|
-
if (!Number.isFinite(value) || value <= 0) return "0
|
|
203
|
-
|
|
199
|
+
if (!Number.isFinite(value) || value <= 0) return "0";
|
|
200
|
+
if (value < 0.01) return "<0.01";
|
|
201
|
+
return gGrouped.format(value);
|
|
202
|
+
}
|
|
203
|
+
function formatExactGAmount(amount) {
|
|
204
|
+
return `${formatExactGValue(amount)} G$`;
|
|
204
205
|
}
|
|
205
|
-
function
|
|
206
|
-
return
|
|
206
|
+
function formatExactGWeiAmount(amountWei) {
|
|
207
|
+
return formatExactGAmount(weiToNumber(amountWei));
|
|
207
208
|
}
|
|
208
209
|
function formatUsdValue(amount) {
|
|
209
210
|
const value = toNumber(amount);
|
|
@@ -1558,9 +1559,9 @@ var VAULT_MINIMUMS_ABI = (0, import_viem7.parseAbi)([
|
|
|
1558
1559
|
function formatMinGDisplay(amountWei) {
|
|
1559
1560
|
const raw = Number(amountWei) / 1e18;
|
|
1560
1561
|
if (!Number.isFinite(raw) || raw <= 0) return "0";
|
|
1561
|
-
if (raw >= 1e3) return
|
|
1562
|
-
if (raw >= 10) return
|
|
1563
|
-
return
|
|
1562
|
+
if (raw >= 1e3) return formatExactGValue(Math.ceil(raw));
|
|
1563
|
+
if (raw >= 10) return formatExactGValue(Math.ceil(raw * 10) / 10);
|
|
1564
|
+
return formatExactGValue(Math.ceil(raw * 100) / 100);
|
|
1564
1565
|
}
|
|
1565
1566
|
function formatMinUsdDisplay(usd) {
|
|
1566
1567
|
return formatUsdDisplay(usd);
|
|
@@ -4954,7 +4955,7 @@ function formatEntryGAmount(gdAmountWei) {
|
|
|
4954
4955
|
try {
|
|
4955
4956
|
const amountWei = BigInt(gdAmountWei || "0");
|
|
4956
4957
|
if (amountWei <= 0n) return null;
|
|
4957
|
-
return
|
|
4958
|
+
return formatExactGWeiAmount(amountWei);
|
|
4958
4959
|
} catch {
|
|
4959
4960
|
return null;
|
|
4960
4961
|
}
|
|
@@ -5053,7 +5054,7 @@ function sumFilteredGdWei(entries) {
|
|
|
5053
5054
|
}, 0n);
|
|
5054
5055
|
}
|
|
5055
5056
|
function formatAccumulatedG(amountWei) {
|
|
5056
|
-
return
|
|
5057
|
+
return formatExactGAmount(Number(amountWei) / 1e18);
|
|
5057
5058
|
}
|
|
5058
5059
|
function formatShortDate(dateValue) {
|
|
5059
5060
|
const date = /* @__PURE__ */ new Date(`${dateValue}T00:00:00.000Z`);
|