diff --git a/src/Contracts/Types/Uinteger.php b/src/Contracts/Types/Uinteger.php index c2099eda..b37c91da 100644 --- a/src/Contracts/Types/Uinteger.php +++ b/src/Contracts/Types/Uinteger.php @@ -73,7 +73,7 @@ public function outputFormat($value, $name) { $match = []; - if (preg_match('/^[0]+([a-f0-9]+)$/', $value, $match) === 1) { + if (preg_match('/^([a-f0-9]+)$/', $value, $match) === 1) { // due to value without 0x prefix, we will parse as decimal $value = '0x' . $match[1]; } diff --git a/src/Utils.php b/src/Utils.php index 8883c2b4..a09c427f 100644 --- a/src/Utils.php +++ b/src/Utils.php @@ -492,7 +492,7 @@ public static function toBn($number) $bn = $number; } elseif (is_int($number)) { $bn = new BigNumber($number); - } elseif (is_numeric($number)) { + } elseif (preg_match('/^(-{0,1})[0-9]*$/', $number)) { $number = (string) $number; if (self::isNegative($number)) {