getLogs API changes to return txHash, make contract arg optional. #81

Merged
ashwinphatak merged 4 commits from ashwinp-get-logs-tx-hash into master 2021-07-26 10:13:38 +00:00
Showing only changes of commit e391af6b90 - Show all commits

View File

@ -1014,6 +1014,7 @@ func (r *Resolver) GetLogs(ctx context.Context, args struct {
return nil, err
}
var logIndexInBlock uint = 0
receipts := make(types.Receipts, len(receiptsBytes))
for index, receiptBytes := range receiptsBytes {
receiptCID := receiptCIDs[index]
@ -1024,6 +1025,9 @@ func (r *Resolver) GetLogs(ctx context.Context, args struct {
receipts[index] = receipt
for _, log := range receipt.Logs {
log.Index = logIndexInBlock
logIndexInBlock++
if args.Contract == nil || *args.Contract == log.Address {
ret = append(ret, &Log{
backend: r.backend,