mirror of
https://github.com/status-im/status-go.git
synced 2025-01-27 23:18:40 +00:00
23 lines
350 B
Go
23 lines
350 B
Go
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 ""
|
|
}
|