github.com/quantosnetwork/Quantos@v0.0.0-20220306172517-e20b28c5a29a/sdk/tools.go (about) 1 package sdk 2 3 import ( 4 "github.com/holiman/uint256" 5 "math/big" 6 ) 7 8 func Uint256StringFromBytes(b []byte) string { 9 b1 := new(big.Int) 10 b1.SetBytes(b) 11 s, _ := uint256.FromBig(b1) 12 return s.String() 13 } 14 15 func Uint256BytesFromHex(hex string) []byte { 16 s, _ := uint256.FromHex(hex) 17 return s.Bytes() 18 } 19 20 func MakeNewUint256(b []byte) *uint256.Int { 21 b1 := new(big.Int) 22 b1.SetBytes(b) 23 s, _ := uint256.FromBig(b1) 24 return s 25 }