I am trying to call a smart constract function with the following abi with pragma experimental ABIEncoderV2:
"constant": false,
"inputs": [
{
"name": "blockNumber",
"type": "uint256"
},
{
"name": "data",
"type": "bytes"
},
{
"name": "tokenNum",
"type": "uint256"
}
],
"name": "execute",
"outputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
The data parameter is a struct with the following definition in solidity
struct InputParams {
address addressFirst;
address addressSecond;
uint256 tokenAmount;
}
How can I encode the data on the python side? I am getting error
Could not identify the intended function with name `execute`, positional argument(s) of type `(<class 'int'>, <class 'list'>, <class 'int'>)` and keyword argument(s) of type `{}`. Found 1 function(s) with the name `execute`: ['execute(uint256,bytes,uint256)']
I think I need to convert the python list into 'bytes' type, but how do I specify in the bytes that necessary datatypes of the struct?