laconicd/utils/int.go
Austin Abell 7f1eb4b0cf
Query and bug fixes (#110)
* Fix queries and bugs

* Fix issues from rebasing

* Fix rpc query address
2019-09-26 11:36:23 -04:00

20 lines
413 B
Go

package utils
import "math/big"
// MarshalBigInt marshalls big int into text string for consistent encoding
func MarshalBigInt(i *big.Int) string {
bz, err := i.MarshalText()
if err != nil {
panic(err)
}
return string(bz)
}
// UnmarshalBigInt unmarshalls string from *big.Int
func UnmarshalBigInt(s string) (*big.Int, error) {
ret := new(big.Int)
err := ret.UnmarshalText([]byte(s))
return ret, err
}