Open lukerQuant opened 2 years ago
This issue is caused by the EthBlock.TransactionHash class which is an implementation of the EthBlock.TransactionResult interface.
The default serializer doesn't like the default get() and fails to get the hash string. To get this to work it would need to be changed to getValue()
Below is a workaround. You can create a new class which overrides the getter and serialize this instead.
class TransactionHashOverride extends EthBlock.TransactionHash {
public TransactionHashOverride(EthBlock.TransactionResult hash) {
super.setValue(hash.get().toString());
}
public String getValue() {
return super.get();
}
}
Block.transactions always returns empty array, i.e. = [{},...,{}]
When getting a block, the transactions parameter always has an array of empty transaction objects, i.e. block.transactions = [{},{},{},...{}]
Steps To Reproduce
use getBlock
Expected behavior
According to https://web3js.readthedocs.io/en/v1.7.5/web3-eth.html#getblock this function should return an array of transaction objects, or 32 Bytes transaction hashes depending on the returnTransactionObjects parameter.
Actual behavior
Empty array
Environment
Additional context
Possibly this is happening as web3j has transactions as a list of transactionResults https://github.com/web3j/web3j/blob/e7b7591b38e0632b65100a6b03ba134eedc94f3e/core/src/main/java/org/web3j/protocol/core/methods/response/EthBlock.java#L80 which is equal to transactionReceipts right? And web3js states this should be transaction objects (the non receipt version) or transaction hashes