From ed023321482a4c9401d253eb702accc131c2a13e Mon Sep 17 00:00:00 2001 From: Nick Johnson Date: Sun, 14 Oct 2018 15:33:39 +0100 Subject: [PATCH] Add transactionCount to block --- ethgraphql/main.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/ethgraphql/main.go b/ethgraphql/main.go index c24e38702e..4650ec7b96 100644 --- a/ethgraphql/main.go +++ b/ethgraphql/main.go @@ -606,6 +606,14 @@ func (b *Block) Coinbase(ctx context.Context, args BlockNumberArgs) (*Account, e }, nil } +func (b *Block) TransactionCount(ctx context.Context) (int32, error) { + block, err := b.resolve(ctx) + if err != nil { + return 0, err + } + return int32(len(block.Transactions())), nil +} + func (b *Block) Transactions(ctx context.Context) ([]*Transaction, error) { block, err := b.resolve(ctx) if err != nil { @@ -768,6 +776,7 @@ func NewHandler(n *node.Node) (http.Handler, error) { extra: HexBytes! totalDifficulty: BigNum! coinbase(block: Int): Account! + transactionCount: Int! transactions: [Transaction]! }