graphql: add yParity field for transactions (#27882)

Co-authored-by: Felix Lange <fjl@twurst.com>
This commit is contained in:
Delweng 2023-08-09 23:57:57 +08:00 committed by GitHub
parent 7ec60d5f0c
commit 10d9f9377b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 0 deletions

View File

@ -566,6 +566,16 @@ func (t *Transaction) V(ctx context.Context) hexutil.Big {
return hexutil.Big(*v)
}
func (t *Transaction) YParity(ctx context.Context) (*hexutil.Uint64, error) {
tx, _ := t.resolve(ctx)
if tx == nil || tx.Type() == types.LegacyTxType {
return nil, nil
}
v, _, _ := tx.RawSignatureValues()
ret := hexutil.Uint64(v.Int64())
return &ret, nil
}
func (t *Transaction) Raw(ctx context.Context) (hexutil.Bytes, error) {
tx, _ := t.resolve(ctx)
if tx == nil {

View File

@ -151,6 +151,7 @@ const schema string = `
r: BigInt!
s: BigInt!
v: BigInt!
yParity: Long
# Envelope transaction support
type: Long
accessList: [AccessTuple!]