i am having quite a hard time reading an array that is passed through an event, this is the event:
event SaleCreated( address seller, address indexed token, uint256 indexed tokenId, uint256 price, uint256 indexed indexOrder, uint256 amount, uint256 orderType, uint256 orderTime );
I have no problem reading any parameter, whether it is indexed or not, the problem is reading the tokenId array or the amount array, for example inserting this in the tokenId array:
I get this:
how can i go from that to the original array?
My personal solution
I found a workaround for this problem, although I know it may not work for everyone. In my case the data that was put into the array and shown in the event (tokenId and amount) were both arrays inserted as input to the function call, so when the event is captured I get the transaction hash , and with web3.py I call:
contractObject = web3.eth.contract(address=addressContract, abi=abiContract) transaction = web3.eth.get_transaction(tx_hash) inputs = contractObject.decode_function_input(transaction.input)
thus getting clean input data.
I didn't find these web3.py functions in web3.js, I hope it will be useful for you