From e391af6b90061a441ecfe96cba694e07fedc225e Mon Sep 17 00:00:00 2001 From: Ashwin Phatak Date: Tue, 13 Jul 2021 15:46:39 +0530 Subject: [PATCH] Populate log index. --- pkg/graphql/graphql.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pkg/graphql/graphql.go b/pkg/graphql/graphql.go index 86717217..8eee9d87 100644 --- a/pkg/graphql/graphql.go +++ b/pkg/graphql/graphql.go @@ -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,