@agentis-hq/cli 0.4.1 → 0.4.2
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/index.js +10 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -463,6 +463,9 @@ async function solToUsd(sol) {
|
|
|
463
463
|
const res = await fetch(`https://api.jup.ag/price/v3?ids=${SOL_MINT}`);
|
|
464
464
|
const data = await res.json();
|
|
465
465
|
const price = data[SOL_MINT]?.usdPrice ?? 0;
|
|
466
|
+
if (!Number.isFinite(price) || price <= 0) {
|
|
467
|
+
throw new Error("Unable to determine SOL/USD price for policy enforcement");
|
|
468
|
+
}
|
|
466
469
|
cachedSolPrice = { usd: price, fetchedAt: now };
|
|
467
470
|
return sol * price;
|
|
468
471
|
}
|
|
@@ -538,7 +541,13 @@ async function sendLocalSol(nameOrId, to, amountSol, displayAmount) {
|
|
|
538
541
|
console.error(`Agent or local wallet not found: ${nameOrId}`);
|
|
539
542
|
process.exit(1);
|
|
540
543
|
}
|
|
541
|
-
|
|
544
|
+
let amountUsd;
|
|
545
|
+
try {
|
|
546
|
+
amountUsd = await solToUsd(amountSol);
|
|
547
|
+
} catch (err) {
|
|
548
|
+
console.error(err instanceof Error ? err.message : "Unable to determine SOL/USD price for policy enforcement");
|
|
549
|
+
process.exit(1);
|
|
550
|
+
}
|
|
542
551
|
try {
|
|
543
552
|
checkPolicy({ ...wallet.policy, allowedDomains: [] }, amountUsd, `solana:${to}`, wallet.spendHistory);
|
|
544
553
|
} catch (err) {
|