Skip to content

Commit 3d627c9

Browse files
s1nalightclient
andauthored
graphql: add withdrawals (EIP-4895) (ethereum#400)
* graphql: add withdrawals * rm block field * Apply suggestions Co-authored-by: lightclient <14004106+lightclient@users.noreply.github.com> * fix comments in graphqls doc * typo --------- Co-authored-by: lightclient <14004106+lightclient@users.noreply.github.com>
1 parent 128af69 commit 3d627c9

File tree

2 files changed

+142
-2
lines changed

2 files changed

+142
-2
lines changed

graphql.json

Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -766,6 +766,38 @@
766766
},
767767
"isDeprecated": false,
768768
"deprecationReason": null
769+
},
770+
{
771+
"name": "withdrawalsRoot",
772+
"description": "WithdrawalsRoot is the withdrawals trie root in this block.\nIf withdrawals are unavailable for this block, this field will be null.",
773+
"args": [],
774+
"type": {
775+
"kind": "SCALAR",
776+
"name": "Bytes32",
777+
"ofType": null
778+
},
779+
"isDeprecated": false,
780+
"deprecationReason": null
781+
},
782+
{
783+
"name": "withdrawals",
784+
"description": "Withdrawals is a list of withdrawals associated with this block. If\nwithdrawals are unavailable for this block, this field will be null.",
785+
"args": [],
786+
"type": {
787+
"kind": "LIST",
788+
"name": null,
789+
"ofType": {
790+
"kind": "NON_NULL",
791+
"name": null,
792+
"ofType": {
793+
"kind": "OBJECT",
794+
"name": "Withdrawal",
795+
"ofType": null
796+
}
797+
}
798+
},
799+
"isDeprecated": false,
800+
"deprecationReason": null
769801
}
770802
],
771803
"inputFields": null,
@@ -2131,6 +2163,81 @@
21312163
"enumValues": null,
21322164
"possibleTypes": null
21332165
},
2166+
{
2167+
"kind": "OBJECT",
2168+
"name": "Withdrawal",
2169+
"description": "EIP-4895",
2170+
"fields": [
2171+
{
2172+
"name": "index",
2173+
"description": "Index is a monotonically increasing identifier issued by consensus layer.",
2174+
"args": [],
2175+
"type": {
2176+
"kind": "NON_NULL",
2177+
"name": null,
2178+
"ofType": {
2179+
"kind": "SCALAR",
2180+
"name": "Long",
2181+
"ofType": null
2182+
}
2183+
},
2184+
"isDeprecated": false,
2185+
"deprecationReason": null
2186+
},
2187+
{
2188+
"name": "validator",
2189+
"description": "Validator is index of the validator associated with withdrawal.",
2190+
"args": [],
2191+
"type": {
2192+
"kind": "NON_NULL",
2193+
"name": null,
2194+
"ofType": {
2195+
"kind": "SCALAR",
2196+
"name": "Long",
2197+
"ofType": null
2198+
}
2199+
},
2200+
"isDeprecated": false,
2201+
"deprecationReason": null
2202+
},
2203+
{
2204+
"name": "address",
2205+
"description": "Recipient address of the withdrawn amount.",
2206+
"args": [],
2207+
"type": {
2208+
"kind": "NON_NULL",
2209+
"name": null,
2210+
"ofType": {
2211+
"kind": "SCALAR",
2212+
"name": "Address",
2213+
"ofType": null
2214+
}
2215+
},
2216+
"isDeprecated": false,
2217+
"deprecationReason": null
2218+
},
2219+
{
2220+
"name": "amount",
2221+
"description": "Amount is the withdrawal value in Gwei.",
2222+
"args": [],
2223+
"type": {
2224+
"kind": "NON_NULL",
2225+
"name": null,
2226+
"ofType": {
2227+
"kind": "SCALAR",
2228+
"name": "Long",
2229+
"ofType": null
2230+
}
2231+
},
2232+
"isDeprecated": false,
2233+
"deprecationReason": null
2234+
}
2235+
],
2236+
"inputFields": null,
2237+
"interfaces": [],
2238+
"enumValues": null,
2239+
"possibleTypes": null
2240+
},
21342241
{
21352242
"kind": "OBJECT",
21362243
"name": "__Directive",

schema.graphqls

Lines changed: 35 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,9 @@ type Account {
3232
storage(slot: Bytes32!): Bytes32!
3333
}
3434

35-
"""Address is a 20 byte Ethereum address, represented as 0x-prefixed hexadecimal."""
35+
"""
36+
Address is a 20 byte Ethereum address, represented as 0x-prefixed hexadecimal.
37+
"""
3638
scalar Address
3739

3840
"""
@@ -185,6 +187,18 @@ type Block {
185187

186188
"""Raw is the RLP encoding of the block."""
187189
raw: Bytes!
190+
191+
"""
192+
WithdrawalsRoot is withdrawals trie root in this block.
193+
If withdrawals are unavailable for this block, this field will be null.
194+
"""
195+
withdrawalsRoot: Bytes32
196+
197+
"""
198+
Withdrawals is a list of withdrawals associated with this block. If
199+
withdrawals are unavailable for this block, this field will be null.
200+
"""
201+
withdrawals: [Withdrawal!]
188202
}
189203

190204
"""
@@ -220,7 +234,9 @@ An empty byte string is represented as '0x'. Byte strings must have an even numb
220234
"""
221235
scalar Bytes
222236

223-
"""Bytes32 is a 32 byte binary string, represented as 0x-prefixed hexadecimal."""
237+
"""
238+
Bytes32 is a 32 byte binary string, represented as 0x-prefixed hexadecimal.
239+
"""
224240
scalar Bytes32
225241

226242
"""
@@ -537,3 +553,20 @@ type Transaction {
537553
"""
538554
rawReceipt: Bytes!
539555
}
556+
557+
"""EIP-4895"""
558+
type Withdrawal {
559+
"""
560+
Index is a monotonically increasing identifier issued by consensus layer.
561+
"""
562+
index: Long!
563+
564+
"""Validator is index of the validator associated with withdrawal."""
565+
validator: Long!
566+
567+
"""Recipient address of the withdrawn amount."""
568+
address: Address!
569+
570+
"""Amount is the withdrawal value in Gwei."""
571+
amount: Long!
572+
}

0 commit comments

Comments
 (0)