pub fn check(param_type_str: &str, value: &str) -> Result<Token> {
    match param_type_str {
        "address" => {
            let v = Address::from_str(remove_0x(value))?;
            Ok(Token::Address(v))
        }
        "bytes" => {
            let v = remove_0x(value).from_hex()?;
            Ok(Token::Bytes(v))
        }
        "int" => {
            let v = U256::from_str(remove_0x(value))?;
            Ok(Token::Int(v))
        }
        "uint" => {
            let v = U256::from_str(remove_0x(value))?;
            Ok(Token::Uint(v))
        }
        "bool" => {
            let v = bool::from_str(value)?;
            Ok(Token::Bool(v))
        }
        "string" => {
            Ok(Token::String(value.to_string()))
        }
        "fixedbytes" => {
            let v = remove_0x(value).from_hex()?;
            let size = v.len();
            if size == 1 ||
                size == 2 ||
                size == 3 ||
                size == 4 ||
                size == 5 ||
                size == 8 ||
                size == 16 ||
                size == 32 ||
                size == 64 ||
                size == 128 ||
                size == 256 ||
                size == 512 ||
                size == 1024
                {
                    Ok(Token::FixedBytes(v.to_vec()))
                } else {
                Err(Error::from("Invalid sized bytes"))
            }
        }
        _ => Err(Error::from("Invalid"))
    }
}
// TODO: Suppurt Array and FixedArray
// value is in hex format
Suppurt Array and FixedArray
value is in hex format
Suppurt Array and FixedArray value is in hex format
pub fn check(param_type_str: &str, value: &str) -> Result<Token> {
    match param_type_str {
        "address" => {
            let v = Address::from_str(remove_0x(value))?;
            Ok(Token::Address(v))
        }
        "bytes" => {
            let v = remove_0x(value).from_hex()?;
            Ok(Token::Bytes(v))
        }
        "int" => {
            let v = U256::from_str(remove_0x(value))?;
            Ok(Token::Int(v))
        }
        "uint" => {
            let v = U256::from_str(remove_0x(value))?;
            Ok(Token::Uint(v))
        }
        "bool" => {
            let v = bool::from_str(value)?;
            Ok(Token::Bool(v))
        }
        "string" => {
            Ok(Token::String(value.to_string()))
        }
        "fixedbytes" => {
            let v = remove_0x(value).from_hex()?;
            let size = v.len();
            if size == 1 ||
                size == 2 ||
                size == 3 ||
                size == 4 ||
                size == 5 ||
                size == 8 ||
                size == 16 ||
                size == 32 ||
                size == 64 ||
                size == 128 ||
                size == 256 ||
                size == 512 ||
                size == 1024
                {
                    Ok(Token::FixedBytes(v.to_vec()))
                } else {
                Err(Error::from("Invalid sized bytes"))
            }
        }
        _ => Err(Error::from("Invalid"))
    }
}
pub fn check ( param_type_str : & str , value : & str ) -> Result < Token > { match param_type_str { " " => { let v = Address :: from_str ( remove_0x ( value ) ) ? ; Ok ( Token :: Address ( v ) ) } " " => { let v = remove_0x ( value ) . from_hex ( ) ? ; Ok ( Token :: Bytes ( v ) ) } " " => { let v = U256 :: from_str ( remove_0x ( value ) ) ? ; Ok ( Token :: Int ( v ) ) } " " => { let v = U256 :: from_str ( remove_0x ( value ) ) ? ; Ok ( Token :: Uint ( v ) ) } " " => { let v = bool :: from_str ( value ) ? ; Ok ( Token :: Bool ( v ) ) } " " => { Ok ( Token :: String ( value . to_string ( ) ) ) } " " => { let v = remove_0x ( value ) . from_hex ( ) ? ; let size = v . len ( ) ; if size == 1 || size == 2 || size == 3 || size == 4 || size == 5 || size == 8 || size == 16 || size == 32 || size == 64 || size == 128 || size == 256 || size == 512 || size == 1024 { Ok ( Token :: FixedBytes ( v . to_vec ( ) ) ) } else { Err ( Error :: from ( " " ) ) } } _ => Err ( Error :: from ( " " ) ) } }
TODO: Suppurt Array and FixedArray
value is in hex format
TODO : Suppurt Array and FixedArray value is in hex format
param_type_str
&str
value
&str
param_type_str
&str
value
&str