Update code to use new v2 API
This commit is contained in:
parent
616593ce4d
commit
252edaf84b
@ -19,27 +19,24 @@ type MempoolInfo struct {
|
||||
}
|
||||
|
||||
type Block struct {
|
||||
Hash string `json:"hash"`
|
||||
Height int `json:"height"`
|
||||
NTx int `json:"nTx"`
|
||||
Size int `json:"size"`
|
||||
Time int `json:"time"`
|
||||
Weight int `json:"weight"`
|
||||
Fees float64 `json:"fees"`
|
||||
MinFee float64 `json:"minFee"`
|
||||
MaxFee float64 `json:"maxFee"`
|
||||
MedianFee float64 `json:"medianFee"`
|
||||
ID string `json:"id"`
|
||||
Height int `json:"height"`
|
||||
TxCount int `json:"tx_count"`
|
||||
Size int `json:"size"`
|
||||
Time int `json:"timestamp"`
|
||||
Weight int `json:"weight"`
|
||||
FeeRange []float64 `json:"fee_range"`
|
||||
MedianFee float64 `json:"medianFee"`
|
||||
}
|
||||
|
||||
type MempoolBlock struct {
|
||||
BlockSize int `json:"blockSize"`
|
||||
BlockWeight int `json:"blockWeight"`
|
||||
BlockWeight float64 `json:"blockVSize"`
|
||||
NTx int `json:"nTx"`
|
||||
FeeRange []float64 `json:"feeRange"`
|
||||
MinWeigthFee float64 `json:"minWeigthFee"`
|
||||
MaxWeigthFee float64 `json:"maxWeigthFee"`
|
||||
MedianFee float64 `json:"medianFee"`
|
||||
Fees float64 `json:"fees"`
|
||||
FeeRange []float64 `json:"feeRange"`
|
||||
HasMyTx bool `json:"hasMytx"`
|
||||
}
|
||||
|
||||
|
||||
15
ui/blocks.go
15
ui/blocks.go
@ -60,7 +60,10 @@ func (b MempoolBlock) Print(n int, x, _y int) []byte {
|
||||
footer = fmt.Sprintf("+%d blocks", n)
|
||||
}
|
||||
|
||||
min, max := b.FeeRange[0], b.FeeRange[len(b.FeeRange)-1]
|
||||
var min, max float64
|
||||
if len(b.FeeRange) > 2 {
|
||||
min, max = b.FeeRange[0], b.FeeRange[len(b.FeeRange)-1]
|
||||
}
|
||||
box := &Box{x: x}
|
||||
box.Printf(color.FgWhite, "~%d sat/vB", ceil(b.MedianFee)).
|
||||
Printf(color.FgYellow, "%d-%d sat/vB", ceil(min), ceil(max)).
|
||||
@ -76,7 +79,7 @@ func (b MempoolBlock) Print(n int, x, _y int) []byte {
|
||||
var full int
|
||||
if n < 3 {
|
||||
full = int(
|
||||
float64(b.BlockWeight) / 4_000_000 * 10,
|
||||
float64(b.BlockWeight) / 1_000_000 * 10,
|
||||
)
|
||||
}
|
||||
|
||||
@ -89,11 +92,15 @@ func (b Block) Print(n int, x, _y int) []byte {
|
||||
ago := time.Now().Unix() - int64(b.Time)
|
||||
box := &Box{x: x}
|
||||
|
||||
var min, max float64
|
||||
if len(b.FeeRange) > 2 {
|
||||
min, max = b.FeeRange[0], b.FeeRange[len(b.FeeRange)-1]
|
||||
}
|
||||
box.Printf(color.FgWhite, "~%d sat/Vb", ceil(b.MedianFee)).
|
||||
Printf(color.FgYellow, "%d-%d sat/vB", ceil(b.MinFee), ceil(b.MaxFee)).
|
||||
Printf(color.FgYellow, "%d-%d sat/vB", ceil(min), ceil(max)).
|
||||
Append("").
|
||||
Printf(color.FgWhite, "%.2f MB", float64(b.Size)/(1000*1000)).
|
||||
Printf(color.FgWhite, " %4d transactions", b.NTx).
|
||||
Printf(color.FgWhite, " %4d transactions", b.TxCount).
|
||||
Append("").
|
||||
Append("").
|
||||
Append("").
|
||||
|
||||
Loading…
Reference in New Issue
Block a user