From fc38db50595c5265d447bf6952ca9ef6f6c30e10 Mon Sep 17 00:00:00 2001 From: Amit Shah Date: Tue, 4 Feb 2020 13:36:02 -0500 Subject: [PATCH] add signature parameter retrieval to graphql interface --- graphql/graphql.go | 27 +++++++++++++++++++++++++++ graphql/schema.go | 3 +++ 2 files changed, 30 insertions(+) diff --git a/graphql/graphql.go b/graphql/graphql.go index ddd928dff1..590b964a74 100644 --- a/graphql/graphql.go +++ b/graphql/graphql.go @@ -314,6 +314,33 @@ func (t *Transaction) Logs(ctx context.Context) (*[]*Log, error) { return &ret, nil } +func (t *Transaction) R(ctx context.Context) (hexutil.Big, error){ + tx, err:= t.resolve(ctx) + if err!= nil || tx == nil{ + return hexutil.Big{}, err + } + r,_,_ := tx.RawSignatureValues() + return hexutil.Big(*r),nil +} + + +func (t *Transaction) S(ctx context.Context) (hexutil.Big, error){ + tx, err:= t.resolve(ctx) + if err!= nil || tx == nil{ + return hexutil.Big{}, err + } + _,s,_ := tx.RawSignatureValues() + return hexutil.Big(*s),nil +} + +func (t *Transaction) V(ctx context.Context) (hexutil.Big, error){ + tx, err:= t.resolve(ctx) + if err!= nil || tx == nil{ + return hexutil.Big{}, err + } + _,_,v := tx.RawSignatureValues() + return hexutil.Big(*v),nil +} type BlockType int // Block represents an Ethereum block. diff --git a/graphql/schema.go b/graphql/schema.go index 525b9e1e5a..b47bd260da 100644 --- a/graphql/schema.go +++ b/graphql/schema.go @@ -115,6 +115,9 @@ const schema string = ` # Logs is a list of log entries emitted by this transaction. If the # transaction has not yet been mined, this field will be null. logs: [Log!] + r: BigInt! + s: BigInt! + v: BigInt! } # BlockFilterCriteria encapsulates log filter criteria for a filter applied