@goodwidget/ai-credits-widget 0.1.11 → 0.1.13
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-5AGZTMIN.js} +30 -19
- package/dist/chunk-5AGZTMIN.js.map +1 -0
- package/dist/element.cjs +29 -18
- package/dist/element.cjs.map +1 -1
- package/dist/element.js +1 -1
- package/dist/index.cjs +29 -18
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +1 -1
- package/dist/mocked/index.cjs +29 -18
- package/dist/mocked/index.cjs.map +1 -1
- package/dist/mocked/index.js +1 -1
- package/dist/register.cjs +34 -19
- package/dist/register.cjs.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-3QY3YZDH.js.map +0 -1
|
@@ -115,7 +115,7 @@ function clearDeepLinkArtifacts() {
|
|
|
115
115
|
import { parseUnits } from "viem";
|
|
116
116
|
|
|
117
117
|
// src/format.ts
|
|
118
|
-
var G_COMPACT_FROM =
|
|
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:
|
|
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
|
|
156
|
+
function formatExactGValue(amount) {
|
|
160
157
|
const value = toNumber(amount);
|
|
161
|
-
if (!Number.isFinite(value) || value <= 0) return "0
|
|
162
|
-
|
|
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
|
|
165
|
-
return
|
|
165
|
+
function formatExactGWeiAmount(amountWei) {
|
|
166
|
+
return formatExactGAmount(weiToNumber(amountWei));
|
|
166
167
|
}
|
|
167
168
|
function formatUsdValue(amount) {
|
|
168
169
|
const value = toNumber(amount);
|
|
@@ -963,7 +964,10 @@ var ANTSEED_BUYER_OPERATOR_DOMAIN = {
|
|
|
963
964
|
};
|
|
964
965
|
var WITHDRAW_PRINCIPAL_TYPES = {
|
|
965
966
|
WithdrawPrincipal: [
|
|
966
|
-
|
|
967
|
+
// `buyer` is the contract's field name; the value is our signer address.
|
|
968
|
+
// EIP-712 hashes field names, so renaming this to `signer` changes the
|
|
969
|
+
// struct hash and the vault rejects the withdrawal with InvalidSignature().
|
|
970
|
+
{ name: "buyer", type: "address" },
|
|
967
971
|
{ name: "amount", type: "uint256" },
|
|
968
972
|
{ name: "recipient", type: "address" },
|
|
969
973
|
{ name: "nonce", type: "uint256" }
|
|
@@ -999,7 +1003,7 @@ async function signWithdrawPrincipal(params) {
|
|
|
999
1003
|
types: WITHDRAW_PRINCIPAL_TYPES,
|
|
1000
1004
|
primaryType: "WithdrawPrincipal",
|
|
1001
1005
|
message: {
|
|
1002
|
-
|
|
1006
|
+
buyer: params.signer,
|
|
1003
1007
|
amount: params.amountMicro,
|
|
1004
1008
|
recipient: params.recipient,
|
|
1005
1009
|
nonce: params.nonce
|
|
@@ -1537,9 +1541,9 @@ var VAULT_MINIMUMS_ABI = parseAbi3([
|
|
|
1537
1541
|
function formatMinGDisplay(amountWei) {
|
|
1538
1542
|
const raw = Number(amountWei) / 1e18;
|
|
1539
1543
|
if (!Number.isFinite(raw) || raw <= 0) return "0";
|
|
1540
|
-
if (raw >= 1e3) return
|
|
1541
|
-
if (raw >= 10) return
|
|
1542
|
-
return
|
|
1544
|
+
if (raw >= 1e3) return formatExactGValue(Math.ceil(raw));
|
|
1545
|
+
if (raw >= 10) return formatExactGValue(Math.ceil(raw * 10) / 10);
|
|
1546
|
+
return formatExactGValue(Math.ceil(raw * 100) / 100);
|
|
1543
1547
|
}
|
|
1544
1548
|
function formatMinUsdDisplay(usd) {
|
|
1545
1549
|
return formatUsdDisplay(usd);
|
|
@@ -3235,6 +3239,12 @@ import {
|
|
|
3235
3239
|
updateToast
|
|
3236
3240
|
} from "@goodwidget/ui";
|
|
3237
3241
|
|
|
3242
|
+
// package.json
|
|
3243
|
+
var version = "0.1.13";
|
|
3244
|
+
|
|
3245
|
+
// src/AiCreditsWidget.tsx
|
|
3246
|
+
import { WidgetVersion } from "@goodwidget/ui";
|
|
3247
|
+
|
|
3238
3248
|
// src/useAiCreditsHistory.ts
|
|
3239
3249
|
import { useCallback as useCallback2, useEffect as useEffect2, useMemo as useMemo2, useState as useState2 } from "react";
|
|
3240
3250
|
var HISTORY_PAGE_SIZE = 10;
|
|
@@ -5023,7 +5033,7 @@ function formatEntryGAmount(gdAmountWei) {
|
|
|
5023
5033
|
try {
|
|
5024
5034
|
const amountWei = BigInt(gdAmountWei || "0");
|
|
5025
5035
|
if (amountWei <= 0n) return null;
|
|
5026
|
-
return
|
|
5036
|
+
return formatExactGWeiAmount(amountWei);
|
|
5027
5037
|
} catch {
|
|
5028
5038
|
return null;
|
|
5029
5039
|
}
|
|
@@ -5122,7 +5132,7 @@ function sumFilteredGdWei(entries) {
|
|
|
5122
5132
|
}, 0n);
|
|
5123
5133
|
}
|
|
5124
5134
|
function formatAccumulatedG(amountWei) {
|
|
5125
|
-
return
|
|
5135
|
+
return formatExactGAmount(Number(amountWei) / 1e18);
|
|
5126
5136
|
}
|
|
5127
5137
|
function formatShortDate(dateValue) {
|
|
5128
5138
|
const date = /* @__PURE__ */ new Date(`${dateValue}T00:00:00.000Z`);
|
|
@@ -6874,7 +6884,8 @@ function AiCreditsWidget({
|
|
|
6874
6884
|
showWalletControls
|
|
6875
6885
|
}
|
|
6876
6886
|
),
|
|
6877
|
-
/* @__PURE__ */ jsx19(ToastContainer, {})
|
|
6887
|
+
/* @__PURE__ */ jsx19(ToastContainer, {}),
|
|
6888
|
+
/* @__PURE__ */ jsx19(WidgetVersion, { name: "AI Credits", version })
|
|
6878
6889
|
] })
|
|
6879
6890
|
}
|
|
6880
6891
|
);
|
|
@@ -6911,4 +6922,4 @@ export {
|
|
|
6911
6922
|
useAiCreditsAdapter,
|
|
6912
6923
|
AiCreditsWidget
|
|
6913
6924
|
};
|
|
6914
|
-
//# sourceMappingURL=chunk-
|
|
6925
|
+
//# sourceMappingURL=chunk-5AGZTMIN.js.map
|