@@ -24,6 +24,12 @@ const PRIVATE_KEYS = fs.readFileSync(keysFile, "utf-8")
2424 . map ( line => line . trim ( ) )
2525 . filter ( line => line . length > 0 ) ;
2626
27+ // Pre-calculate all wallet addresses to easily check if all are inactive
28+ const ALL_WALLETS = PRIVATE_KEYS . map ( key => {
29+ const wallet = new ethers . Wallet ( key ) ;
30+ return wallet . address ;
31+ } ) ;
32+
2733// --- Wallet Persona Management ---
2834const personaFile = "personas.json" ;
2935let walletProfiles = { } ;
@@ -71,7 +77,7 @@ function ensurePersona(wallet) {
7177 // NEW TRAITS
7278 activeHours : [ 6 + Math . floor ( Math . random ( ) * 6 ) , 22 ] , // e.g. 06:00-22:00 UTC
7379 cooldownAfterFail : 60 + Math . floor ( Math . random ( ) * 180 ) , // 1-4 min
74- avgWait : 60 + Math . floor ( Math . random ( ) * 120 ) , // base wait time 1-3 min
80+ avgWait : 60 + Math . floor ( Math . random ( ) * 41 ) , // base wait time 1-1.6 min
7581 retryBias : Math . random ( ) * 0.5 , // 0-50% chance to retry
7682 // dynamic per-wallet nonce retirement
7783 maxNonce : 520 + Math . floor ( Math . random ( ) * 100 ) ,
@@ -367,6 +373,12 @@ async function loop() {
367373 loadPersonas ( ) ;
368374 loadInactive ( ) ;
369375 while ( true ) {
376+ // === NEW LOGIC: Check if all wallets are inactive and sleep if so ===
377+ if ( inactiveWallets . size >= ALL_WALLETS . length ) {
378+ console . log ( chalk . yellow ( "😴 All wallets are currently inactive. Sleeping for 5 minutes..." ) ) ;
379+ await randomDelay ( 300 , 300 ) ; // 5 minutes
380+ }
381+
370382 // === NEW LOGIC: Retry loop for RPC connection ===
371383 let provider = null ;
372384 let url = null ;
0 commit comments