pub fn decode(types: &[ParamType], data: &[u8]) -> Result<Vec<Token>, Error> {
    let is_empty_bytes_valid_encoding = types.iter().all(|t| t.is_empty_bytes_valid_encoding());
    if !is_empty_bytes_valid_encoding && data.is_empty() {
        bail!("please ensure the contract and method you're calling exist! failed to decode empty bytes. if you're using jsonrpc this is likely due to jsonrpc returning `0x` in case contract or method don't exist");
    }
	let slices = slice_data(data)?;
	let mut tokens = vec![];
	let mut offset = 0;
	for param in types {
		let res = decode_param(param, &slices, offset).chain_err(|| format!("Cannot decode {}", param))?;
		offset = res.new_offset;
		tokens.push(res.token);
	}
	Ok(tokens)
}
/// Decodes ABI compliant vector of bytes into vector of tokens described by types param.
Decodes ABI compliant vector of bytes into vector of tokens described by types param.
Decodes ABI compliant vector of bytes into vector of tokens described by types param .
pub fn decode(types: &[ParamType], data: &[u8]) -> Result<Vec<Token>, Error> {
    let is_empty_bytes_valid_encoding = types.iter().all(|t| t.is_empty_bytes_valid_encoding());
    if !is_empty_bytes_valid_encoding && data.is_empty() {
        bail!("please ensure the contract and method you're calling exist! failed to decode empty bytes. if you're using jsonrpc this is likely due to jsonrpc returning `0x` in case contract or method don't exist");
    }
	let slices = slice_data(data)?;
	let mut tokens = vec![];
	let mut offset = 0;
	for param in types {
		let res = decode_param(param, &slices, offset).chain_err(|| format!("Cannot decode {}", param))?;
		offset = res.new_offset;
		tokens.push(res.token);
	}
	Ok(tokens)
}
pub fn decode ( types : & [ ParamType ] , data : & [ u8 ] ) -> Result < Vec < Token > , Error > { let is_empty_bytes_valid_encoding = types . iter ( ) . all ( | t | t . is_empty_bytes_valid_encoding ( ) ) ; if ! is_empty_bytes_valid_encoding && data . is_empty ( ) { bail ! ( " " ) ; } let slices = slice_data ( data ) ? ; let mut tokens = vec ! [ ] ; let mut offset = 0 ; for param in types { let res = decode_param ( param , & slices , offset ) . chain_err ( | | format ! ( " " param ) ) ? ; offset = res . new_offset ; tokens . push ( res . token ) ; } Ok ( tokens ) }
Decodes ABI compliant vector of bytes into vector of tokens described by types param.
Decodes ABI compliant vector of bytes into vector of tokens described by types param .
types
&[ParamType]
data
&[u8]
types
&[ParamType]
data
&[u8]