status-go/abi-spec/utils.go

23 lines
350 B
Go
Raw Normal View History

2022-08-24 12:42:41 +00:00
package abispec
import (
"fmt"
"math/big"
)
func HexToNumber(hex string) string {
num, success := big.NewInt(0).SetString(hex, 16)
if success {
return num.String()
}
return ""
}
func NumberToHex(numString string) string {
num, success := big.NewInt(0).SetString(numString, 0)
if success {
return fmt.Sprintf("%x", num)
}
return ""
}