@provex/react 1.6.2 → 1.7.0-rc.20260522201545.020a3eb
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/LICENSE +21 -0
- package/README.md +1 -1
- package/dist/{ProvexProvider-BQ5vZkHO.d.cts → ProvexProvider-eG_i0Yz3.d.cts} +13 -4
- package/dist/{ProvexProvider-BQ5vZkHO.d.ts → ProvexProvider-eG_i0Yz3.d.ts} +13 -4
- package/dist/{chunk-VWWANYB2.js → chunk-NAGOACEK.js} +22 -11
- package/dist/chunk-NAGOACEK.js.map +1 -0
- package/dist/index.cjs +19 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -2
- package/dist/wagmi.cjs +19 -8
- package/dist/wagmi.cjs.map +1 -1
- package/dist/wagmi.d.cts +1 -1
- package/dist/wagmi.d.ts +1 -1
- package/dist/wagmi.js +1 -1
- package/package.json +7 -5
- package/skills/react-integration/SKILL.md +246 -0
- package/dist/chunk-VWWANYB2.js.map +0 -1
package/dist/index.cjs
CHANGED
|
@@ -921,7 +921,9 @@ var ProveXClient = class {
|
|
|
921
921
|
let errorMessage = `Attestation error: ${res.status}`;
|
|
922
922
|
try {
|
|
923
923
|
const errorJson = await res.json();
|
|
924
|
-
if (errorJson.message) errorMessage = errorJson.message;
|
|
924
|
+
if (errorJson.details?.message) errorMessage = errorJson.details.message;
|
|
925
|
+
else if (errorJson.message) errorMessage = errorJson.message;
|
|
926
|
+
else if (errorJson.error) errorMessage = errorJson.error;
|
|
925
927
|
} catch {
|
|
926
928
|
}
|
|
927
929
|
return {
|
|
@@ -1215,6 +1217,7 @@ function useReputationLimits({
|
|
|
1215
1217
|
chainId,
|
|
1216
1218
|
selectedPaymentMethod,
|
|
1217
1219
|
tier,
|
|
1220
|
+
decimals,
|
|
1218
1221
|
amountInInt,
|
|
1219
1222
|
cooldownEndsAt
|
|
1220
1223
|
}) {
|
|
@@ -1247,19 +1250,20 @@ function useReputationLimits({
|
|
|
1247
1250
|
return reputation.getCooldownHours({ tier, providerKey: selectedPaymentMethod });
|
|
1248
1251
|
}, [hasLimits, tier, selectedPaymentMethod]);
|
|
1249
1252
|
const effectiveCap = react.useMemo(() => {
|
|
1250
|
-
return reputation.getEffectiveCap({ tier, providerKey: selectedPaymentMethod });
|
|
1251
|
-
}, [hasLimits, tier, selectedPaymentMethod]);
|
|
1253
|
+
return reputation.getEffectiveCap({ tier, providerKey: selectedPaymentMethod, decimals });
|
|
1254
|
+
}, [hasLimits, tier, selectedPaymentMethod, decimals]);
|
|
1252
1255
|
const amountExceedsCap = react.useMemo(() => {
|
|
1253
1256
|
if (effectiveCap === null) return false;
|
|
1254
1257
|
if (!amountInInt) return false;
|
|
1255
|
-
|
|
1256
|
-
return amountUsd > effectiveCap;
|
|
1258
|
+
return amountInInt > effectiveCap;
|
|
1257
1259
|
}, [effectiveCap, amountInInt]);
|
|
1258
1260
|
const capExceededMessage = react.useMemo(() => {
|
|
1259
1261
|
if (!amountExceedsCap || effectiveCap === null) return null;
|
|
1262
|
+
if (effectiveCap === reputation.UNLIMITED_CAP_BASE_UNITS) return null;
|
|
1263
|
+
const capUsd = reputation.getEffectiveCapDisplayUsd(effectiveCap, decimals) ?? 0;
|
|
1260
1264
|
const providerName = payment.providerConfigs(chainId)[selectedPaymentMethod]?.name ?? selectedPaymentMethod;
|
|
1261
|
-
return `Amount exceeds your $${
|
|
1262
|
-
}, [amountExceedsCap, effectiveCap, chainId, selectedPaymentMethod]);
|
|
1265
|
+
return `Amount exceeds your $${capUsd.toLocaleString()} limit for ${providerName}`;
|
|
1266
|
+
}, [amountExceedsCap, effectiveCap, chainId, selectedPaymentMethod, decimals]);
|
|
1263
1267
|
return {
|
|
1264
1268
|
hasLimits,
|
|
1265
1269
|
noCooldownProviders,
|
|
@@ -1611,11 +1615,18 @@ function useProvexBuy({
|
|
|
1611
1615
|
() => parseAmountSafe(amount, currency.decimals),
|
|
1612
1616
|
[amount, currency.decimals]
|
|
1613
1617
|
);
|
|
1618
|
+
const tokenDecimals = token?.decimals ?? 6;
|
|
1619
|
+
const amountInTokenUnits = react.useMemo(() => {
|
|
1620
|
+
if (amountBigInt === null) return null;
|
|
1621
|
+
const decimalShift = BigInt(tokenDecimals - currency.decimals);
|
|
1622
|
+
return decimalShift >= 0n ? amountBigInt * 10n ** decimalShift : amountBigInt / 10n ** -decimalShift;
|
|
1623
|
+
}, [amountBigInt, tokenDecimals, currency.decimals]);
|
|
1614
1624
|
const limits = useReputationLimits({
|
|
1615
1625
|
chainId,
|
|
1616
1626
|
selectedPaymentMethod: activePaymentMethod,
|
|
1617
1627
|
tier: reputation$1.tier,
|
|
1618
|
-
|
|
1628
|
+
decimals: tokenDecimals,
|
|
1629
|
+
amountInInt: amountInTokenUnits,
|
|
1619
1630
|
cooldownEndsAt: reputation$1.cooldownEndsAt
|
|
1620
1631
|
});
|
|
1621
1632
|
const signalIntent = useSignalIntent({
|