Struct fuels_core::abi_decoder::ABIDecoder
source · pub struct ABIDecoder;Implementations§
source§impl ABIDecoder
impl ABIDecoder
sourcepub fn decode(param_types: &[ParamType], bytes: &[u8]) -> Result<Vec<Token>>
pub fn decode(param_types: &[ParamType], bytes: &[u8]) -> Result<Vec<Token>>
Decodes types described by param_types into their respective Tokens
using the data in bytes and receipts.
Arguments
param_types: The ParamType’s of the types we expect are encoded insidebytesandreceipts.bytes: The bytes to be used in the decoding process.
Examples
use fuels_core::abi_decoder::ABIDecoder;
use fuels_types::{Token, param_types::ParamType};
let tokens = ABIDecoder::decode(&[ParamType::U8, ParamType::U8], &[0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,2]).unwrap();
assert_eq!(tokens, vec![Token::U8(1), Token::U8(2)])