I want to listen to event Sync
from a contract.
In javascript, I managed like this (this is to understand better what I want):
const contract = new web3.eth.Contract(abi, contractAddress);
const syncEvent = contract.events["Sync"];
syncEvent().on('data', function(event){
console.log(event);
}).on('error', function(error){
console.log(error)
}).on("changed", function(isSyncing){
console.log(isSyncing);
});
In java I managed only this:
Web3j web3jWS = Web3j.build(new WebSocketService("wss://...", false));
EthFilter filter = new EthFilter(
DefaultBlockParameterName.LATEST,
DefaultBlockParameterName.LATEST,
contractAddress
);
But I have no idea how to continue this, even if it's right my code.
How I can listen to the event Sync
with Web3j?
DefaultBlockParameterName.LATEST,
toDefaultBlockParameterName.EARLIEST,
.String contractAddress = "0x2b4c76d0dc16be1c31d4c1dc53bf9b45987fc75c"
. It's from Fantom Blockchain.0x
prefix from the address?