Closed litcc closed 1 year ago
Sorry, this may be a misunderstanding, a separate implementation of Detokenize will solve the problem
#[derive(Debug)]
enum OutputData {
One(Token),
List(Vec<Token>)
}
impl Detokenize for OutputData {
fn from_tokens(tokens: Vec<Token>) -> std::result::Result<Self, Error> where Self: Sized {
if tokens.len() !=1 {
Ok(OutputData::List(tokens))
}else {
Ok(OutputData::One(tokens.first().unwrap().to_owned()))
}
}
}
contract.query::<OutputData,_,_,_>("slot0", (), None, Options::default(), None)
When abi is the following result
Corresponding contract call code:
The code there always reports an error, no matter what I set the return value type to be
https://github.com/tomusdrw/rust-web3/blob/c593b722d57da0c2885123867a7d4662a288d6cc/src/contract/tokens.rs#L20
Because the function returns a list, there may be more than one
https://github.com/tomusdrw/rust-web3/blob/c593b722d57da0c2885123867a7d4662a288d6cc/src/contract/mod.rs#L276
https://github.com/rust-ethereum/ethabi/blob/8501b692587bea8e93bb9440abd35038cb0d6bde/ethabi/src/function.rs#L72
I think this is a bug