Per the title, I'm having trouble passing in contract calls with multiple parameters. I can call balanceOf on this node just fine.

I'm using an infura node, and I'm attempting to call the more complex function "balanceOfBatch" which takes an address[] and uint256[] - presumably I was thinking I could pass a python list and a standard integer - however it's telling me the function invocation isn't being done properly.

The balanceOfBatch is the standard ERC-1155 function from Openzeppelin on a Polygon Mainnet contract.

Python web3.py code:

contract_address = Web3.toChecksumAddress("0x123")
web3_poly = Web3(Web3.HTTPProvider(polygon_mainnet_endpoint))
contract_object = web3_poly.eth.contract(address=contract_address, abi=my_abi)
addrs = [] # List of address strings (I tried ints too) e.g.: .append("0x123...")
ids = [] # list of ints (e.g. [1,2,3] - I tried numpy arrays, formatted strings (e.g. "[1,2,3]") - no success.
this_fails = contract_object.functions.balanceOfBatch(addrs, ids).call()

enter image description here


Could not identify the intended function with name balanceOfBatch, positional argument(s) of type () and keyword argument(s) of type {'accounts': <class 'numpy.ndarray'>, 'ids': <class 'numpy.ndarray'>}. Found 1 function(s) with the name balanceOfBatch: ['balanceOfBatch(address[],uint256[])'] Function invocation failed due to no matching argument types.

1 Answer 1


the list of addrs was missing the web3.utils.toChecksumAddress formatting thus causing the invalid function arguments type (I struggled with even focusing in on the list of addresses).

What I was doing addrs = [] ... addrs.append("0x123...")

The fix: addrs = [] cleaned_addr = addrs.append(web3.toChecksumAddress("0x123"))

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.