decharge-scout 4.0.4 → 4.0.6
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/.env.example +5 -0
- package/index.js +14 -3
- package/package.json +1 -1
package/.env.example
CHANGED
|
@@ -27,3 +27,8 @@ STAKE_AMOUNT=0.01
|
|
|
27
27
|
|
|
28
28
|
# Premium Feature Price (in SOL)
|
|
29
29
|
PREMIUM_PRICE=0.001
|
|
30
|
+
|
|
31
|
+
# Query Cycle Interval (in minutes)
|
|
32
|
+
# How often to fetch weather & submit data (default: 15)
|
|
33
|
+
# For testing, you can set to 2 minutes: CYCLE_INTERVAL_MINUTES=2
|
|
34
|
+
CYCLE_INTERVAL_MINUTES=15
|
package/index.js
CHANGED
|
@@ -47,7 +47,8 @@ const __dirname = dirname(__filename);
|
|
|
47
47
|
|
|
48
48
|
// Configuration
|
|
49
49
|
const STAKE_AMOUNT = parseFloat(process.env.STAKE_AMOUNT || '0.01');
|
|
50
|
-
const
|
|
50
|
+
const CYCLE_INTERVAL_MINUTES = parseInt(process.env.CYCLE_INTERVAL_MINUTES || '15'); // Default: 15 minutes
|
|
51
|
+
const CYCLE_INTERVAL_MS = CYCLE_INTERVAL_MINUTES * 60 * 1000;
|
|
51
52
|
|
|
52
53
|
// Global state
|
|
53
54
|
let isRunning = true;
|
|
@@ -463,9 +464,19 @@ async function runQueryCycle(wallet, agentName, location, options) {
|
|
|
463
464
|
console.log(chalk.gray(' • "7-9PM peak in Lagos" (evening peak)'));
|
|
464
465
|
console.log(chalk.gray(' • "1-5AM cheap in Berlin" (off-peak)'));
|
|
465
466
|
console.log(chalk.gray(' • "5-8PM peak in Mumbai" (dinner time surge)'));
|
|
466
|
-
console.log(chalk.gray(' • "2-6AM cheap in Texas" (wind energy overnight)
|
|
467
|
+
console.log(chalk.gray(' • "2-6AM cheap in Texas" (wind energy overnight)'));
|
|
468
|
+
console.log(chalk.gray(' (Will auto-skip in 15 seconds if no input)\n'));
|
|
467
469
|
|
|
468
|
-
|
|
470
|
+
// Add timeout to prevent hanging
|
|
471
|
+
const alphaInput = await Promise.race([
|
|
472
|
+
question(chalk.blue('Share local peak times (or press Enter to skip): ')),
|
|
473
|
+
new Promise((resolve) => {
|
|
474
|
+
setTimeout(() => {
|
|
475
|
+
console.log(chalk.yellow('\n⏱️ Timeout - skipping alpha contribution'));
|
|
476
|
+
resolve('');
|
|
477
|
+
}, 15000); // 15 second timeout
|
|
478
|
+
})
|
|
479
|
+
]);
|
|
469
480
|
|
|
470
481
|
if (alphaInput.trim()) {
|
|
471
482
|
const parsed = parseAlphaContribution(alphaInput, location);
|