web3.php logs event returns null, how to fix this?

83 views Asked by At

I am using Laravel with web3.php library https://github.com/web3p/web3.php

my code is

$web3 = new Web3('https://data-seed-prebsc-1-s1.binance.org:8545/');

$filter = $web3->eth->getLogs([
    'address' => '0x40ae816d6CF7D9c85562Fa305A7fE4b50Ba20C23', // contract address
    'topics' => ['0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef'],
], function ($error, $logs) {
    if ($error !== null) {
        // Obsłuż błąd
        echo "Error mooahahahah: " . $error->getMessage();
        return;
    }

    dd($logs);

    foreach ($logs as $log) {
        // to do with logs
    }
});

but always see empty array. I tried on other random contracts and still no success. How can i take a log event search by topics?

0

There are 0 answers