toString()
This commit is contained in:
parent
48d00a2641
commit
917f08e74f
@ -11,6 +11,7 @@
|
||||
|
||||
namespace Web3;
|
||||
|
||||
use RuntimeException;
|
||||
use InvalidArgumentException;
|
||||
use stdClass;
|
||||
use kornrunner\Keccak;
|
||||
@ -214,6 +215,22 @@ class Utils
|
||||
return '0x' . $hash;
|
||||
}
|
||||
|
||||
/**
|
||||
* toString
|
||||
*
|
||||
* @param mixed $value
|
||||
* @return string
|
||||
*/
|
||||
public function toString($value)
|
||||
{
|
||||
try {
|
||||
$value = (string) $value;
|
||||
} catch (\Exception $e) {
|
||||
throw new RuntimeException('Cannot transform value to string!');
|
||||
}
|
||||
return $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* toWei
|
||||
* Change number from unit to wei.
|
||||
|
Loading…
Reference in New Issue
Block a user