Skip to content

Commit

Permalink
Adds second table ordered by ejection txn
Browse files Browse the repository at this point in the history
  • Loading branch information
pschork committed Oct 17, 2024
1 parent 0d599f0 commit fe8f7e7
Showing 1 changed file with 26 additions and 2 deletions.
28 changes: 26 additions & 2 deletions tools/ejections/cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,10 @@ func RunScan(ctx *cli.Context) error {

t := table.NewWriter()
t.AppendHeader(table.Row{"OperatorID", "Quorum", "Timestamp", "Txn"}, rowConfigAutoMerge)

sort.Slice(ejections, func(i, j int) bool {
return ejections[i].OperatorId < ejections[j].OperatorId
})
for _, ejection := range ejections {
logger.Debug("ejection", "ts", ejection.BlockTimestamp, "txn", ejection.TransactionHash, "quorum", ejection.Quorum, "operatorId", ejection.OperatorId)
var link_prefix string
if strings.Contains(config.SubgraphEndpoint, "holesky") {
link_prefix = "https://holesky.etherscan.io/tx/"
Expand All @@ -84,5 +82,31 @@ func RunScan(ctx *cli.Context) error {
t.SetStyle(table.StyleLight)
t.Style().Options.SeparateRows = true
fmt.Println(t.Render())

t = table.NewWriter()
t.AppendHeader(table.Row{"Txn", "Timestamp", "OperatorId", "Quorum"}, rowConfigAutoMerge)
sort.Slice(ejections, func(i, j int) bool {
return ejections[i].TransactionHash < ejections[j].TransactionHash
})

for _, ejection := range ejections {
var link_prefix string
if strings.Contains(config.SubgraphEndpoint, "holesky") {
link_prefix = "https://holesky.etherscan.io/tx/"
} else {
link_prefix = "https://etherscan.io/tx/"
}
t.AppendRow(table.Row{link_prefix + ejection.TransactionHash, ejection.BlockTimestamp, ejection.OperatorId, ejection.Quorum}, rowConfigAutoMerge)
}
t.SetAutoIndex(true)
t.SetColumnConfigs([]table.ColumnConfig{
{Number: 1, AutoMerge: true},
{Number: 2, AutoMerge: true},
{Number: 3, AutoMerge: true},
{Number: 4, Align: text.AlignCenter},
})
t.SetStyle(table.StyleLight)
t.Style().Options.SeparateRows = true
fmt.Println(t.Render())
return nil
}

0 comments on commit fe8f7e7

Please sign in to comment.