i'm having difficulties to change this line of code to web3.eth.subscribe anyone know how to write in subcribe for this since i want to change from old ver to new beta ver.

    const filter2 = web3.eth.filter('0xd6307de796bc5746ff4002d1ce5283c136a19c89');
filter2.watch((err, res) => {
    if (err) {
        console.log(`Watch error: ${err}`);
    } else {
        // Update balance
        web3.eth.getBalance('0xd63xxxxxxxxxxxsomethingxxxxxxxxxx', function (error, result) {
            if (!error) {
                console.log(JSON.stringify(web3.fromWei(result, 'ether')));
                answer = web3.fromWei(result, 'ether')
                document.getElementById("Cbalance2").innerHTML = (answer);

            } else

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.