From d73df893a6fc528e69506397322205bd9258b6fa Mon Sep 17 00:00:00 2001 From: Sina Mahmoodi <1591639+s1na@users.noreply.github.com> Date: Wed, 4 May 2022 14:31:07 +0200 Subject: [PATCH] graphql: add rawReceipt field to transaction type (#24738) * graphql: add tx receiptsRLP field * use MarshalBinary Co-authored-by: Ryan Schneider * update schema Co-authored-by: Ryan Schneider * rename to rawReceipt * indent fix Co-authored-by: Ryan Schneider --- graphql/graphql.go | 8 ++++++++ graphql/schema.go | 5 ++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/graphql/graphql.go b/graphql/graphql.go index cbd76465d6681..dc25a41f21c96 100644 --- a/graphql/graphql.go +++ b/graphql/graphql.go @@ -514,6 +514,14 @@ func (t *Transaction) V(ctx context.Context) (hexutil.Big, error) { return hexutil.Big(*v), nil } +func (t *Transaction) RawReceipt(ctx context.Context) (hexutil.Bytes, error) { + receipt, err := t.getReceipt(ctx) + if err != nil || receipt == nil { + return nil, err + } + return receipt.MarshalBinary() +} + type BlockType int // Block represents an Ethereum block. diff --git a/graphql/schema.go b/graphql/schema.go index 0013e7bae75c0..c908866be259f 100644 --- a/graphql/schema.go +++ b/graphql/schema.go @@ -137,9 +137,12 @@ const schema string = ` r: BigInt! s: BigInt! v: BigInt! - #Envelope transaction support + # Envelope transaction support type: Int accessList: [AccessTuple!] + # RawReceipt is the binary encoding of the receipt. For post EIP-2718 typed transactions + # this is equivalent to TxType || ReceiptEncoding. + rawReceipt: Bytes! } # BlockFilterCriteria encapsulates log filter criteria for a filter applied