fix: proxy uses undici ProxyAgent for fetch, schedule moved to .env, verbose redeem logging
- Fix proxy: native fetch needs undici ProxyAgent with dispatcher option (https-proxy-agent only works with axios, not Node's built-in fetch) - Move schedule from hardcoded to .env: SNIPER_SCHEDULE_BTC=19:40-22:40,03:40-06:10 - Add verbose logging to redeemSniperPositions for debugging - Config dynamically reads all SNIPER_SCHEDULE_* env vars
This commit is contained in:
+9
-3
@@ -560,13 +560,19 @@ export async function redeemSniperPositions() {
|
||||
let dataPositions = [];
|
||||
try {
|
||||
const resp = await proxyFetch(`${config.dataHost}/positions?user=${config.proxyWallet}`);
|
||||
if (resp.ok) dataPositions = await resp.json();
|
||||
if (!resp.ok) {
|
||||
logger.warn(`SNIPER redeemer: Data API returned ${resp.status} — will retry`);
|
||||
return;
|
||||
}
|
||||
dataPositions = await resp.json();
|
||||
if (!Array.isArray(dataPositions)) dataPositions = [];
|
||||
} catch {
|
||||
return; // silent — will retry next interval
|
||||
} catch (err) {
|
||||
logger.warn(`SNIPER redeemer: Data API fetch failed — ${err.message}`);
|
||||
return;
|
||||
}
|
||||
|
||||
if (dataPositions.length === 0) return;
|
||||
logger.info(`SNIPER redeemer: checking ${dataPositions.length} position(s)...`);
|
||||
|
||||
const provider = await getPolygonProvider();
|
||||
const ctf = new ethers.Contract(CTF_ADDRESS, CTF_ABI, provider);
|
||||
|
||||
Reference in New Issue
Block a user