@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.cjs
CHANGED
|
@@ -135,7 +135,7 @@ async function signOperatorConsentFromTypedData(signerPrivateKey, typedData) {
|
|
|
135
135
|
var import_viem2 = require("viem");
|
|
136
136
|
|
|
137
137
|
// src/format.ts
|
|
138
|
-
var G_COMPACT_FROM =
|
|
138
|
+
var G_COMPACT_FROM = 1e3;
|
|
139
139
|
var USD_MIN_VISIBLE = 5e-3;
|
|
140
140
|
var gGrouped = new Intl.NumberFormat("en-US", {
|
|
141
141
|
minimumFractionDigits: 0,
|
|
@@ -143,7 +143,7 @@ var gGrouped = new Intl.NumberFormat("en-US", {
|
|
|
143
143
|
});
|
|
144
144
|
var gCompact = new Intl.NumberFormat("en-US", {
|
|
145
145
|
notation: "compact",
|
|
146
|
-
maximumFractionDigits:
|
|
146
|
+
maximumFractionDigits: 1
|
|
147
147
|
});
|
|
148
148
|
var usdGrouped = new Intl.NumberFormat("en-US", {
|
|
149
149
|
minimumFractionDigits: 2,
|
|
@@ -169,20 +169,21 @@ function formatGValue(amount) {
|
|
|
169
169
|
if (value < 0.01) return "<0.01";
|
|
170
170
|
return gGrouped.format(value);
|
|
171
171
|
}
|
|
172
|
-
function formatGAmount(amount) {
|
|
173
|
-
return `${formatGValue(amount)} G$`;
|
|
174
|
-
}
|
|
175
172
|
function isGValueCompacted(amount) {
|
|
176
173
|
const value = toNumber(amount);
|
|
177
174
|
return Number.isFinite(value) && value >= G_COMPACT_FROM;
|
|
178
175
|
}
|
|
179
|
-
function
|
|
176
|
+
function formatExactGValue(amount) {
|
|
180
177
|
const value = toNumber(amount);
|
|
181
|
-
if (!Number.isFinite(value) || value <= 0) return "0
|
|
182
|
-
|
|
178
|
+
if (!Number.isFinite(value) || value <= 0) return "0";
|
|
179
|
+
if (value < 0.01) return "<0.01";
|
|
180
|
+
return gGrouped.format(value);
|
|
181
|
+
}
|
|
182
|
+
function formatExactGAmount(amount) {
|
|
183
|
+
return `${formatExactGValue(amount)} G$`;
|
|
183
184
|
}
|
|
184
|
-
function
|
|
185
|
-
return
|
|
185
|
+
function formatExactGWeiAmount(amountWei) {
|
|
186
|
+
return formatExactGAmount(weiToNumber(amountWei));
|
|
186
187
|
}
|
|
187
188
|
function formatUsdValue(amount) {
|
|
188
189
|
const value = toNumber(amount);
|
|
@@ -1561,9 +1562,9 @@ var VAULT_MINIMUMS_ABI = (0, import_viem7.parseAbi)([
|
|
|
1561
1562
|
function formatMinGDisplay(amountWei) {
|
|
1562
1563
|
const raw = Number(amountWei) / 1e18;
|
|
1563
1564
|
if (!Number.isFinite(raw) || raw <= 0) return "0";
|
|
1564
|
-
if (raw >= 1e3) return
|
|
1565
|
-
if (raw >= 10) return
|
|
1566
|
-
return
|
|
1565
|
+
if (raw >= 1e3) return formatExactGValue(Math.ceil(raw));
|
|
1566
|
+
if (raw >= 10) return formatExactGValue(Math.ceil(raw * 10) / 10);
|
|
1567
|
+
return formatExactGValue(Math.ceil(raw * 100) / 100);
|
|
1567
1568
|
}
|
|
1568
1569
|
function formatMinUsdDisplay(usd) {
|
|
1569
1570
|
return formatUsdDisplay(usd);
|
|
@@ -4952,7 +4953,7 @@ function formatEntryGAmount(gdAmountWei) {
|
|
|
4952
4953
|
try {
|
|
4953
4954
|
const amountWei = BigInt(gdAmountWei || "0");
|
|
4954
4955
|
if (amountWei <= 0n) return null;
|
|
4955
|
-
return
|
|
4956
|
+
return formatExactGWeiAmount(amountWei);
|
|
4956
4957
|
} catch {
|
|
4957
4958
|
return null;
|
|
4958
4959
|
}
|
|
@@ -5051,7 +5052,7 @@ function sumFilteredGdWei(entries) {
|
|
|
5051
5052
|
}, 0n);
|
|
5052
5053
|
}
|
|
5053
5054
|
function formatAccumulatedG(amountWei) {
|
|
5054
|
-
return
|
|
5055
|
+
return formatExactGAmount(Number(amountWei) / 1e18);
|
|
5055
5056
|
}
|
|
5056
5057
|
function formatShortDate(dateValue) {
|
|
5057
5058
|
const date = /* @__PURE__ */ new Date(`${dateValue}T00:00:00.000Z`);
|