mirror of
https://gitlab.com/pulsechaincom/erigon-pulse.git
synced 2025-01-10 04:51:20 +00:00
31 lines
791 B
Go
31 lines
791 B
Go
|
package requests
|
||
|
|
||
|
import (
|
||
|
"fmt"
|
||
|
|
||
|
"github.com/ledgerwatch/erigon/cmd/devnet/devnetutils"
|
||
|
"github.com/ledgerwatch/erigon/cmd/devnet/models"
|
||
|
"github.com/ledgerwatch/erigon/cmd/rpctest/rpctest"
|
||
|
"github.com/ledgerwatch/erigon/common"
|
||
|
)
|
||
|
|
||
|
func GetLogs(reqId int, fromBlock uint64, toBlock uint64, address common.Address, printLogs bool) error {
|
||
|
reqGen := initialiseRequestGenerator(reqId)
|
||
|
var b rpctest.EthGetLogs
|
||
|
|
||
|
if res := reqGen.Erigon(models.ETHGetLogs, reqGen.GetLogs(fromBlock, toBlock, address), &b); res.Err != nil {
|
||
|
return fmt.Errorf("failed to fetch logs: %v", res.Err)
|
||
|
}
|
||
|
|
||
|
s, err := devnetutils.ParseResponse(b)
|
||
|
if err != nil {
|
||
|
return fmt.Errorf("error parsing response: %v", err)
|
||
|
}
|
||
|
|
||
|
if printLogs {
|
||
|
fmt.Printf("Logs ======================> %v\n", s)
|
||
|
}
|
||
|
|
||
|
return nil
|
||
|
}
|