forked from aptos-labs/aptos-go-sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
util.go
34 lines (27 loc) · 961 Bytes
/
util.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
package aptos
import (
"github.com/aptos-labs/aptos-go-sdk/internal/util"
"math/big"
)
// -- Note these are copied from internal/util/util.go to prevent package loops, but still allow devs to use it
// ParseHex Convenience function to deal with 0x at the beginning of hex strings
func ParseHex(hexStr string) ([]byte, error) {
// This had to be redefined separately to get around a package loop
return util.ParseHex(hexStr)
}
// Sha3256Hash takes a hash of the given sets of bytes
func Sha3256Hash(bytes [][]byte) (output []byte) {
return util.Sha3256Hash(bytes)
}
// BytesToHex converts bytes to a 0x prefixed hex string
func BytesToHex(bytes []byte) string {
return util.BytesToHex(bytes)
}
// StrToUint64 converts a string to a uint64
func StrToUint64(s string) (uint64, error) {
return util.StrToUint64(s)
}
// StrToBigInt converts a string to a big.Int
func StrToBigInt(val string) (num *big.Int, err error) {
return util.StrToBigInt(val)
}