Skip to content

Commit

Permalink
graphql: add withdrawals (EIP-4895) (#400)
Browse files Browse the repository at this point in the history
* 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>
  • Loading branch information
s1na and lightclient committed May 30, 2023
1 parent 128af69 commit 3d627c9
Show file tree
Hide file tree
Showing 2 changed files with 142 additions and 2 deletions.
107 changes: 107 additions & 0 deletions graphql.json
Original file line number Diff line number Diff line change
Expand Up @@ -766,6 +766,38 @@
},
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "withdrawalsRoot",
"description": "WithdrawalsRoot is the withdrawals trie root in this block.\nIf withdrawals are unavailable for this block, this field will be null.",
"args": [],
"type": {
"kind": "SCALAR",
"name": "Bytes32",
"ofType": null
},
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "withdrawals",
"description": "Withdrawals is a list of withdrawals associated with this block. If\nwithdrawals are unavailable for this block, this field will be null.",
"args": [],
"type": {
"kind": "LIST",
"name": null,
"ofType": {
"kind": "NON_NULL",
"name": null,
"ofType": {
"kind": "OBJECT",
"name": "Withdrawal",
"ofType": null
}
}
},
"isDeprecated": false,
"deprecationReason": null
}
],
"inputFields": null,
Expand Down Expand Up @@ -2131,6 +2163,81 @@
"enumValues": null,
"possibleTypes": null
},
{
"kind": "OBJECT",
"name": "Withdrawal",
"description": "EIP-4895",
"fields": [
{
"name": "index",
"description": "Index is a monotonically increasing identifier issued by consensus layer.",
"args": [],
"type": {
"kind": "NON_NULL",
"name": null,
"ofType": {
"kind": "SCALAR",
"name": "Long",
"ofType": null
}
},
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "validator",
"description": "Validator is index of the validator associated with withdrawal.",
"args": [],
"type": {
"kind": "NON_NULL",
"name": null,
"ofType": {
"kind": "SCALAR",
"name": "Long",
"ofType": null
}
},
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "address",
"description": "Recipient address of the withdrawn amount.",
"args": [],
"type": {
"kind": "NON_NULL",
"name": null,
"ofType": {
"kind": "SCALAR",
"name": "Address",
"ofType": null
}
},
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "amount",
"description": "Amount is the withdrawal value in Gwei.",
"args": [],
"type": {
"kind": "NON_NULL",
"name": null,
"ofType": {
"kind": "SCALAR",
"name": "Long",
"ofType": null
}
},
"isDeprecated": false,
"deprecationReason": null
}
],
"inputFields": null,
"interfaces": [],
"enumValues": null,
"possibleTypes": null
},
{
"kind": "OBJECT",
"name": "__Directive",
Expand Down
37 changes: 35 additions & 2 deletions schema.graphqls
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ type Account {
storage(slot: Bytes32!): Bytes32!
}

"""Address is a 20 byte Ethereum address, represented as 0x-prefixed hexadecimal."""
"""
Address is a 20 byte Ethereum address, represented as 0x-prefixed hexadecimal.
"""
scalar Address

"""
Expand Down Expand Up @@ -185,6 +187,18 @@ type Block {

"""Raw is the RLP encoding of the block."""
raw: Bytes!

"""
WithdrawalsRoot is withdrawals trie root in this block.
If withdrawals are unavailable for this block, this field will be null.
"""
withdrawalsRoot: Bytes32

"""
Withdrawals is a list of withdrawals associated with this block. If
withdrawals are unavailable for this block, this field will be null.
"""
withdrawals: [Withdrawal!]
}

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

"""Bytes32 is a 32 byte binary string, represented as 0x-prefixed hexadecimal."""
"""
Bytes32 is a 32 byte binary string, represented as 0x-prefixed hexadecimal.
"""
scalar Bytes32

"""
Expand Down Expand Up @@ -537,3 +553,20 @@ type Transaction {
"""
rawReceipt: Bytes!
}

"""EIP-4895"""
type Withdrawal {
"""
Index is a monotonically increasing identifier issued by consensus layer.
"""
index: Long!

"""Validator is index of the validator associated with withdrawal."""
validator: Long!

"""Recipient address of the withdrawn amount."""
address: Address!

"""Amount is the withdrawal value in Gwei."""
amount: Long!
}

2 comments on commit 3d627c9

@Paulorenatomiguel
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

preciso de ajuda para fazer a retirada dos recursos deasde de entao nunca retirei estou precisando

@Mrquinn4
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Me to can you help

Please sign in to comment.