@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.
@@ -115,7 +115,7 @@ function clearDeepLinkArtifacts() {
115
115
  import { parseUnits } from "viem";
116
116
 
117
117
  // src/format.ts
118
- var G_COMPACT_FROM = 1e6;
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: 2
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 formatExactGAmount(amount) {
156
+ function formatExactGValue(amount) {
160
157
  const value = toNumber(amount);
161
- if (!Number.isFinite(value) || value <= 0) return "0 G$";
162
- return `${gGrouped.format(value)} G$`;
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 formatGWeiAmount(amountWei) {
165
- return formatGAmount(weiToNumber(amountWei));
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 formatGValue(Math.ceil(raw));
1541
- if (raw >= 10) return formatGValue(Math.ceil(raw * 10) / 10);
1542
- return formatGValue(Math.ceil(raw * 100) / 100);
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 formatGWeiAmount(amountWei);
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 formatGAmount(Number(amountWei) / 1e18);
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-3QY3YZDH.js.map
6915
+ //# sourceMappingURL=chunk-HFKD7MN7.js.map