Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
Geth-Modification
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
张蕾
Geth-Modification
Commits
29a6b6bc
Unverified
Commit
29a6b6bc
authored
May 17, 2022
by
Sina Mahmoodi
Committed by
GitHub
May 17, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
graphql: add raw fields to block and tx (#24816)
parent
39fb82bc
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
35 additions
and
2 deletions
+35
-2
graphql.go
graphql/graphql.go
+26
-1
schema.go
graphql/schema.go
+9
-1
No files found.
graphql/graphql.go
View file @
29a6b6bc
...
...
@@ -33,6 +33,7 @@ import (
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/eth/filters"
"github.com/ethereum/go-ethereum/internal/ethapi"
"github.com/ethereum/go-ethereum/rlp"
"github.com/ethereum/go-ethereum/rpc"
)
...
...
@@ -516,10 +517,18 @@ func (t *Transaction) V(ctx context.Context) (hexutil.Big, error) {
return
hexutil
.
Big
(
*
v
),
nil
}
func
(
t
*
Transaction
)
Raw
(
ctx
context
.
Context
)
(
hexutil
.
Bytes
,
error
)
{
tx
,
err
:=
t
.
resolve
(
ctx
)
if
err
!=
nil
||
tx
==
nil
{
return
hexutil
.
Bytes
{},
err
}
return
tx
.
MarshalBinary
()
}
func
(
t
*
Transaction
)
RawReceipt
(
ctx
context
.
Context
)
(
hexutil
.
Bytes
,
error
)
{
receipt
,
err
:=
t
.
getReceipt
(
ctx
)
if
err
!=
nil
||
receipt
==
nil
{
return
nil
,
err
return
hexutil
.
Bytes
{}
,
err
}
return
receipt
.
MarshalBinary
()
}
...
...
@@ -798,6 +807,22 @@ func (b *Block) TotalDifficulty(ctx context.Context) (hexutil.Big, error) {
return
hexutil
.
Big
(
*
td
),
nil
}
func
(
b
*
Block
)
RawHeader
(
ctx
context
.
Context
)
(
hexutil
.
Bytes
,
error
)
{
header
,
err
:=
b
.
resolveHeader
(
ctx
)
if
err
!=
nil
{
return
hexutil
.
Bytes
{},
err
}
return
rlp
.
EncodeToBytes
(
header
)
}
func
(
b
*
Block
)
Raw
(
ctx
context
.
Context
)
(
hexutil
.
Bytes
,
error
)
{
block
,
err
:=
b
.
resolve
(
ctx
)
if
err
!=
nil
{
return
hexutil
.
Bytes
{},
err
}
return
rlp
.
EncodeToBytes
(
block
)
}
// BlockNumberArgs encapsulates arguments to accessors that specify a block number.
type
BlockNumberArgs
struct
{
// TODO: Ideally we could use input unions to allow the query to specify the
...
...
graphql/schema.go
View file @
29a6b6bc
...
...
@@ -140,7 +140,11 @@ const schema string = `
# Envelope transaction support
type: Int
accessList: [AccessTuple!]
# RawReceipt is the binary encoding of the receipt. For post EIP-2718 typed transactions
# Raw is the canonical encoding of the transaction.
# For legacy transactions, it returns the RLP encoding.
# For EIP-2718 typed transactions, it returns the type and payload.
raw: Bytes!
# RawReceipt is the canonical encoding of the receipt. For post EIP-2718 typed transactions
# this is equivalent to TxType || ReceiptEncoding.
rawReceipt: Bytes!
}
...
...
@@ -238,6 +242,10 @@ const schema string = `
# EstimateGas estimates the amount of gas that will be required for
# successful execution of a transaction at the current block's state.
estimateGas(data: CallData!): Long!
# RawHeader is the RLP encoding of the block's header.
rawHeader: Bytes!
# Raw is the RLP encoding of the block.
raw: Bytes!
}
# CallData represents the data associated with a local contract call.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment