Using python web3 module, attempting to call a contract function that takes one argument, a list of 48 uints:
function checkOrderBatch(uint[48] input) external view returns(uint16[16] status, uint[16] amount) { ...
Calling the function like so:
res = contract.functions.checkOrderBatch(o).call()
Where o is my input.
I've been able to successfully interact with this contract already with the python web3 module, but everything I try for this function returns an error about my input values.
Here are the things I've tried, and the errors I've recieved:
Input: List of 48, with each element being a string of the following form
'0x0160e8043c35120bde2b0788f918bdd57160a127d2d56cea9c24a1342b45320c'
Error:
Could not identify the intended function with name
checkOrderBatch
, positional argument(s) of type(<class 'list'>,)
and keyword argument(s) of type{}
. Found 1 function(s) with the namecheckOrderBatch
: ['checkOrderBatch(uint256[48])'] Function invocation failed due to improper argument encoding.
Input: List of 48, with each element being bytes of the following form
b'0160e8043c35120bde2b0788f918bdd57160a127d2d56cea9c24a1342b45320c'
Error: Same as #1
Input: List of 48, with each element being a string of the following form
'0160e8043c35120bde2b0788f918bdd57160a127d2d56cea9c24a1342b45320c'
Error: Same as #1
Input: List of 48, with each element being bytes of the follow form
b'0x0160e8043c35120bde2b0788f918bdd57160a127d2d56cea9c24a1342b45320'
Error: Same as #1
Input: 48 separate arguments. Error: As expected, incorrect number of arguments.
Clearly I'm not an expert in the data types intended here, so I'm likely doing something stupid. But I can't seem to figure it out. Any help would be greatly appreciated!
If you would like something to test, here is the specific contract:
https://etherscan.io/address/0x37304b0ab297f13f5520c523102797121182fb5b#code
The function is checkOrderBatch. It is a view function, so you can mess with it without wasting gas. If you can submit anything to it and get past the point I got, that's all I need! It's ok if the function returns an error. I just need to get the encoding right.
Thank you!
[0, 1, 2, ...]
– user19510 Aug 16 '18 at 15:35