dont print fil suffix in lotus shed audit balances
This commit is contained in:
parent
7c7e0d73d5
commit
8f4911ac0d
@ -12,11 +12,15 @@ import (
|
|||||||
type FIL BigInt
|
type FIL BigInt
|
||||||
|
|
||||||
func (f FIL) String() string {
|
func (f FIL) String() string {
|
||||||
|
return f.Unitless() + " FIL"
|
||||||
|
}
|
||||||
|
|
||||||
|
func (f FIL) Unitless() string {
|
||||||
r := new(big.Rat).SetFrac(f.Int, big.NewInt(int64(build.FilecoinPrecision)))
|
r := new(big.Rat).SetFrac(f.Int, big.NewInt(int64(build.FilecoinPrecision)))
|
||||||
if r.Sign() == 0 {
|
if r.Sign() == 0 {
|
||||||
return "0 FIL"
|
return "0 FIL"
|
||||||
}
|
}
|
||||||
return strings.TrimRight(strings.TrimRight(r.FloatString(18), "0"), ".") + " FIL"
|
return strings.TrimRight(strings.TrimRight(r.FloatString(18), "0"), ".")
|
||||||
}
|
}
|
||||||
|
|
||||||
func (f FIL) Format(s fmt.State, ch rune) {
|
func (f FIL) Format(s fmt.State, ch rune) {
|
||||||
|
@ -117,7 +117,7 @@ var chainBalanceCmd = &cli.Command{
|
|||||||
|
|
||||||
fmt.Printf("Address,Balance,Type,Power,Worker,Owner\n")
|
fmt.Printf("Address,Balance,Type,Power,Worker,Owner\n")
|
||||||
for _, acc := range infos {
|
for _, acc := range infos {
|
||||||
fmt.Printf("%s,%s,%s,%s,%s,%s\n", acc.Address, acc.Balance, acc.Type, acc.Power, acc.Worker, acc.Owner)
|
fmt.Printf("%s,%s,%s,%s,%s,%s\n", acc.Address, acc.Balance.Unitless(), acc.Type, acc.Power, acc.Worker, acc.Owner)
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
},
|
},
|
||||||
@ -244,12 +244,12 @@ var chainBalanceStateCmd = &cli.Command{
|
|||||||
if minerInfo {
|
if minerInfo {
|
||||||
fmt.Printf("Address,Balance,Type,Sectors,Worker,Owner,InitialPledge,Locked,PreCommits\n")
|
fmt.Printf("Address,Balance,Type,Sectors,Worker,Owner,InitialPledge,Locked,PreCommits\n")
|
||||||
for _, acc := range infos {
|
for _, acc := range infos {
|
||||||
fmt.Printf("%s,%s,%s,%d,%s,%s,%s,%s,%s\n", acc.Address, acc.Balance, acc.Type, acc.Sectors, acc.Worker, acc.Owner, acc.InitialPledge, acc.LockedFunds, acc.PreCommits)
|
fmt.Printf("%s,%s,%s,%d,%s,%s,%s,%s,%s\n", acc.Address, acc.Balance.Unitless(), acc.Type, acc.Sectors, acc.Worker, acc.Owner, acc.InitialPledge, acc.LockedFunds, acc.PreCommits)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
fmt.Printf("Address,Balance,Type\n")
|
fmt.Printf("Address,Balance,Type\n")
|
||||||
for _, acc := range infos {
|
for _, acc := range infos {
|
||||||
fmt.Printf("%s,%s,%s\n", acc.Address, acc.Balance, acc.Type)
|
fmt.Printf("%s,%s,%s\n", acc.Address, acc.Balance.Unitless(), acc.Type)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user