Skip to content

Commit

Permalink
Merge pull request #775 from eco-stake/fix-network-name-log
Browse files Browse the repository at this point in the history
Fix network name logging
  • Loading branch information
tombeynon authored Apr 8, 2024
2 parents 9b85195 + e183dc3 commit 1e99030
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/autostake/index.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ export default function Autostake(mnemonic, opts) {
const health = new Health(data.healthCheck, { dryRun: opts.dryRun, networkName: data.name })
health.started('⚛')
const results = await runWithRetry(data, health)
const network = results[0]?.networkRunner?.network
const { success, skipped } = results[results.length - 1] || {}
if(!skipped && !failed){
health.log(`Autostake ${success ? 'completed' : 'failed'} after ${results.length} attempt(s)`)
Expand All @@ -49,9 +50,9 @@ export default function Autostake(mnemonic, opts) {
})
}
if (success || skipped) {
return health.success(`Autostake finished for ${data.prettyName}`)
return health.success(`Autostake finished for ${network?.prettyName || data.name}`)
} else {
return health.failed(`Autostake failed for ${data.prettyName}`)
return health.failed(`Autostake failed for ${network?.prettyName || data.name}`)
}
}
})
Expand Down

0 comments on commit 1e99030

Please sign in to comment.