Skip to content

Commit 34bb132

Browse files
AmitBRDAmitShahfjl
authored
graphql: add transaction signature values (#20623)
The feature update allows the GraphQL API endpoint to retrieve transaction signature R,S,V parameters. Co-authored-by: amitshah <amitshah0t7@gmail.com> Co-authored-by: Felix Lange <fjl@twurst.com>
1 parent 675f4e7 commit 34bb132

2 files changed

Lines changed: 30 additions & 0 deletions

File tree

‎graphql/graphql.go‎

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -314,6 +314,33 @@ func (t *Transaction) Logs(ctx context.Context) (*[]*Log, error) {
314314
return &ret, nil
315315
}
316316

317+
func (t *Transaction) R(ctx context.Context) (hexutil.Big, error) {
318+
tx, err := t.resolve(ctx)
319+
if err != nil || tx == nil {
320+
return hexutil.Big{}, err
321+
}
322+
_, r, _ := tx.RawSignatureValues()
323+
return hexutil.Big(*r), nil
324+
}
325+
326+
func (t *Transaction) S(ctx context.Context) (hexutil.Big, error) {
327+
tx, err := t.resolve(ctx)
328+
if err != nil || tx == nil {
329+
return hexutil.Big{}, err
330+
}
331+
_, _, s := tx.RawSignatureValues()
332+
return hexutil.Big(*s), nil
333+
}
334+
335+
func (t *Transaction) V(ctx context.Context) (hexutil.Big, error) {
336+
tx, err := t.resolve(ctx)
337+
if err != nil || tx == nil {
338+
return hexutil.Big{}, err
339+
}
340+
v, _, _ := tx.RawSignatureValues()
341+
return hexutil.Big(*v), nil
342+
}
343+
317344
type BlockType int
318345

319346
// Block represents an Ethereum block.

‎graphql/schema.go‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,9 @@ const schema string = `
115115
# Logs is a list of log entries emitted by this transaction. If the
116116
# transaction has not yet been mined, this field will be null.
117117
logs: [Log!]
118+
r: BigInt!
119+
s: BigInt!
120+
v: BigInt!
118121
}
119122
120123
# BlockFilterCriteria encapsulates log filter criteria for a filter applied

0 commit comments

Comments
 (0)