add leading zeros to display correct balance

This commit is contained in:
Iuri Matias 2020-07-14 16:52:31 -04:00
parent 7d7bac5fb6
commit c3e632253a

View File

@ -107,7 +107,9 @@ proc hex2Eth*(input: string): string =
var one_eth = fromHex(Stuint[256], "DE0B6B3A7640000")
var (eth, remainder) = divmod(value, one_eth)
fmt"{eth}.{remainder}"
let leading_zeros = "0".repeat(($one_eth).len - ($remainder).len - 1)
fmt"{eth}.{leading_zeros}{remainder}"
proc validateMnemonic*(mnemonic: string): string =
result = $libstatus.validateMnemonic(mnemonic)