kaspad/cmd/kaspawallet/utils/format_kas.go
D-Stacks 57c6118be8
Adds a "sweep" command to kaspawallet (#2018)
* Add "sweep" command to kaspawallet

* minor linting & layout improvements.

* contain code in "sweep"

* update to sweep.go

* formatting and bugs

* clean up renaming of ExtractTransaction functions

* Nicer formating of display

* address reveiw.

* one more sweeped -> swept

* missed one reveiw comment. (extra mass).

* remove redundant code from split function.

Co-authored-by: Ori Newman <orinewman1@gmail.com>
2022-04-14 02:16:16 +03:00

17 lines
372 B
Go

package utils
import (
"fmt"
"github.com/kaspanet/kaspad/domain/consensus/utils/constants"
)
// FormatKas takes the amount of sompis as uint64, and returns amount of KAS with 8 decimal places
func FormatKas(amount uint64) string {
res := " "
if amount > 0 {
res = fmt.Sprintf("%19.8f", float64(amount)/constants.SompiPerKaspa)
}
return res
}