Skip to content

Commit 3c08d5d

Browse files
committed
format fixes for gasLine and price, cleanup
1 parent d60b79f commit 3c08d5d

File tree

3 files changed

+21
-13
lines changed

3 files changed

+21
-13
lines changed

cmd/common.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -454,10 +454,11 @@ func formatEvent(g *gocui.Gui, event *collections.Event, nodes *node.Nodes, wall
454454
eventWithStyle.EtherscanURL = etherscanURL
455455

456456
// price
457+
price, _ := priceEther.Float64()
457458
if event.EventType == collections.Listing {
458-
out.WriteString(" " + priceStyle.Render(style.TerminalLink(openseaURL, fmt.Sprintf("%6.3f", priceEther))))
459+
out.WriteString(" " + priceStyle.Render(style.TerminalLink(openseaURL, fmt.Sprintf("%6.3f", price))))
459460
} else {
460-
out.WriteString(" " + priceStyle.Render(fmt.Sprintf("%6.3f", priceEther)))
461+
out.WriteString(" " + priceStyle.Render(fmt.Sprintf("%6.3f", price)))
461462
}
462463

463464
out.WriteString(formattedCurrencySymbol)

cmd/live.go

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -166,9 +166,7 @@ func live(_ *cobra.Command, _ []string) {
166166
// create a new chainserver instance
167167
cWatcher = server.New()
168168
// subscribe to the chain logs/events and start the workers
169-
cWatcher.Subscribe(&queueEvents)
170-
// old type (while migrating to new snode.Node type (will be renamed from snode to node after))
171-
// nodes := cWatcher.GetNodesAsGBNodeCollection()
169+
go cWatcher.Subscribe(&queueEvents)
172170

173171
// websockets server
174172
if viper.GetBool("server.websockets.enabled") {
@@ -315,7 +313,7 @@ func live(_ *cobra.Command, _ []string) {
315313
}()
316314
}
317315

318-
QueueStatsLive(&queueEvents, queueLogs, queueListings, &queueOutput, &queueOutWS)
316+
go QueueStatsLive(&queueEvents, queueLogs, queueListings, &queueOutput, &queueOutWS)
319317

320318
select {}
321319
}

internal/ticker/gas.go

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -42,18 +42,27 @@ func GasTicker(gasTicker *time.Ticker, nodes *node.Nodes, queueOutput *chan stri
4242

4343
oldGasPrice = gasPrice
4444

45+
// // tip / priority fee
46+
// var gasTip int
47+
// if gasInfo.GasTipWei.Cmp(big.NewInt(0)) > 0 {
48+
// gasTipGwei, _ := node.WeiToGwei(gasInfo.GasTipWei).Float64()
49+
// gasTip = int(math.Round(gasTipGwei))
50+
// fmt.Printf("gasInfo.GasTipWei: %+v | gasTipGwei: %+v | gasTip: %+v\n", gasInfo.GasTipWei, gasTipGwei, gasTip)
51+
// }
52+
4553
intro := style.DarkerGrayStyle.Render("~ ") + style.DarkGrayStyle.Render("gas") + style.DarkerGrayStyle.Render(" ~ ")
4654
outro := style.DarkerGrayStyle.Render(" ~ ~")
47-
formattedGas := style.LightGrayStyle.Render(fmt.Sprintf("%d", gasPrice)) + style.DarkGrayStyle.Render("gw")
4855
divider := style.DarkerGrayStyle.Render(" ~ ~ ~ ~ ~ ~ ")
4956

50-
gasLine.WriteString(intro + formattedGas + divider + formattedGas + divider + formattedGas + outro)
57+
formattedGas := style.GrayStyle.Render(fmt.Sprintf("%d", gasPrice)) + style.DarkGrayStyle.Render("gw")
58+
formattedGasAndTip := formattedGas
59+
60+
// if gasTip > 0 {
61+
// formattedGasAndTip = formattedGas + "|" + style.GrayStyle.Render(fmt.Sprintf("%d", gasTip)) + style.DarkGrayStyle.Render("gw")
62+
// }
63+
64+
gasLine.WriteString(intro + formattedGas + divider + formattedGasAndTip + divider + formattedGas + outro)
5165
}
52-
// // tip / priority fee
53-
// if gasInfo.GasTipWei.Cmp(big.NewInt(0)) > 0 {
54-
// gasTipGwei, _ := weiToGwei(gasInfo.GasTipWei).Float64()
55-
// gasLine.WriteString(style.GrayStyle.Render(fmt.Sprintf(" | tip: %d", int(math.Ceil(gasTipGwei)))))
56-
// }
5766
}
5867

5968
*queueOutput <- gasLine.String()

0 commit comments

Comments
 (0)