add transaction id validator

This commit is contained in:
Halil Beycan 2021-10-20 10:52:40 +03:00
parent fb94ea92c5
commit e506a0f847

View File

@ -0,0 +1,26 @@
<?php
/**
* @author Halil Beycan <halilbeycan0@gmail.com>
* @license MIT
*/
namespace Web3\Validators;
class TransactionIdValidator
{
/**
* validate
*
* @param string $value
* @return bool
*/
public static function validate($value)
{
if (!is_string($value)) {
return false;
}
return (preg_match('/^0x[a-fA-F0-9]{66}$/', $value) >= 1);
}
}