diff --git a/types/uint.go b/types/uint.go index 4bb71fff0..a6c4a0abf 100644 --- a/types/uint.go +++ b/types/uint.go @@ -13,6 +13,11 @@ type Uint struct { i *big.Int } +// BigInt converts Uint to big.Int +func (u Uint) BigInt() *big.Int { + return new(big.Int).Set(u.i) +} + // NewUintFromBigUint constructs Uint from big.Uint func NewUintFromBigInt(i *big.Int) Uint { u, err := checkNewUint(i) diff --git a/types/uint_test.go b/types/uint_test.go index 167f65284..34fc1780b 100644 --- a/types/uint_test.go +++ b/types/uint_test.go @@ -84,6 +84,7 @@ func TestIdentUint(t *testing.T) { cases := []uint64{ i.Uint64(), + i.BigInt().Uint64(), i.i.Uint64(), ifromstr.Uint64(), NewUintFromBigInt(new(big.Int).SetUint64(n)).Uint64(),