I am trying to decode the tx data using the ethersrs crate with Rust. From the crate source code, I can see that it is possible to decode using an instance of the BaseContract type. However, I cannot see any apparent way to create this instance. Here is what I tried thus far:

pub fn decode(tx_input: Bytes) {
    abigen!(TestContract, "./src/web3/abi/TestContract.json");

    let contract = BaseContract::from(TestContract);

    let result = contract.decode_input(tx_input);

But I receive the following error message:

Expected value, found struct TestContract constructor is not visible here due to private fields


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.