mirror of https://github.com/hyperledger/besu
GraphQL Support for withdrawals (#5496)
Add support for withdrawals in GraphQL, including needed changes to testing infrastructure for shanghai-era blocks. Also align existing adapters with graphql schema optionality. Signed-off-by: Danno Ferrin <danno.ferrin@gmail.com>pull/5517/head
parent
925b915cd9
commit
cc2150d537
@ -0,0 +1,43 @@ |
||||
/* |
||||
* Copyright contributors to Hyperledger Besu |
||||
* |
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with |
||||
* the License. You may obtain a copy of the License at |
||||
* |
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* |
||||
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on |
||||
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the |
||||
* specific language governing permissions and limitations under the License. |
||||
* |
||||
* SPDX-License-Identifier: Apache-2.0 |
||||
*/ |
||||
package org.hyperledger.besu.ethereum.api.graphql.internal.pojoadapter; |
||||
|
||||
import org.hyperledger.besu.datatypes.Address; |
||||
import org.hyperledger.besu.plugin.data.Withdrawal; |
||||
|
||||
public class WithdrawalAdapter { |
||||
|
||||
Withdrawal withdrawal; |
||||
|
||||
public WithdrawalAdapter(final Withdrawal withdrawal) { |
||||
this.withdrawal = withdrawal; |
||||
} |
||||
|
||||
public Long getIndex() { |
||||
return withdrawal.getIndex().toLong(); |
||||
} |
||||
|
||||
public Long getValidator() { |
||||
return withdrawal.getValidatorIndex().toLong(); |
||||
} |
||||
|
||||
public Address getAddress() { |
||||
return withdrawal.getAddress(); |
||||
} |
||||
|
||||
public Long getAmount() { |
||||
return withdrawal.getAmount().getAsBigInteger().longValue(); |
||||
} |
||||
} |
@ -0,0 +1,20 @@ |
||||
{ |
||||
"request": |
||||
"{ block (number: 33) { number withdrawalsRoot withdrawals { index amount validator address } } }", |
||||
|
||||
"response": { |
||||
"data" : { |
||||
"block" : { |
||||
"number" : 33, |
||||
"withdrawalsRoot": "0x37945ab58d2712a26df2a38d217e822694927e29b30d5993d7a53ccea618d1f3", |
||||
"withdrawals": [{ |
||||
"index": 0, |
||||
"amount": 10000000000, |
||||
"validator": 10, |
||||
"address": "0x0000000000000000000000000000000000000dad" |
||||
}] |
||||
} |
||||
} |
||||
}, |
||||
"statusCode": 200 |
||||
} |
@ -0,0 +1,15 @@ |
||||
{ |
||||
"request": |
||||
"{ block (number: 32) { number withdrawalsRoot withdrawals { index amount } } }", |
||||
|
||||
"response": { |
||||
"data" : { |
||||
"block" : { |
||||
"number" : 32, |
||||
"withdrawalsRoot": null, |
||||
"withdrawals": null |
||||
} |
||||
} |
||||
}, |
||||
"statusCode": 200 |
||||
} |
@ -0,0 +1,29 @@ |
||||
{ |
||||
"request": "{block (number : 33) { baseFeePerGas difficulty extraData miner { address } mixHash nonce stateRoot totalDifficulty withdrawalsRoot withdrawals { address amount index validator } }} ", |
||||
"response":{ |
||||
"data" : { |
||||
"block" : { |
||||
"baseFeePerGas": "0x3b9aca00", |
||||
"difficulty": "0x0", |
||||
"extraData": "0x", |
||||
"miner": { |
||||
"address": "0x0000000000000000000000000000000000000000" |
||||
}, |
||||
"mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000", |
||||
"nonce": "0x0000000000000000", |
||||
"stateRoot": "0x0d3c456bb68669bad05da3a1a766daab236c9df1da8f74edf5ebe9383f00084c", |
||||
"totalDifficulty": "0x427c00", |
||||
"withdrawalsRoot": "0x37945ab58d2712a26df2a38d217e822694927e29b30d5993d7a53ccea618d1f3", |
||||
"withdrawals": [ |
||||
{ |
||||
"address": "0x0000000000000000000000000000000000000dad", |
||||
"amount": 10000000000, |
||||
"index": 0, |
||||
"validator": 10 |
||||
} |
||||
] |
||||
} |
||||
} |
||||
}, |
||||
"statusCode": 200 |
||||
} |
@ -0,0 +1,19 @@ |
||||
{ |
||||
"request": "{transaction (hash : \"0x3ecd2ca6cf26c864d0ea5f038a58d4cd4a46a3e242fe92f446f392fdc232dd98\") { accessList { address storageKeys } maxFeePerGas maxPriorityFeePerGas nonce type status } } ", |
||||
"response": { |
||||
"data": { |
||||
"transaction": { |
||||
"accessList": [{ |
||||
"address": "0x6295ee1b4f6dd65047762f924ecd367c17eabf8f", |
||||
"storageKeys": ["0x0000000000000000000000000000000000000000000000000000000000000000"] |
||||
}], |
||||
"maxFeePerGas": "0xb2d05e00", |
||||
"maxPriorityFeePerGas": "0x3b9aca00", |
||||
"nonce": 32, |
||||
"type": 2, |
||||
"status": 1 |
||||
} |
||||
} |
||||
}, |
||||
"statusCode": 200 |
||||
} |
Binary file not shown.
@ -0,0 +1,22 @@ |
||||
{ |
||||
"config": { |
||||
"chainId": 1, |
||||
"ethash": { |
||||
}, |
||||
"londonBlock": 33, |
||||
"shanghaiTime": 1444660030 |
||||
}, |
||||
"parentHash" : "0x0000000000000000000000000000000000000000000000000000000000000000", |
||||
"coinbase" : "0x8888f1f195afa192cfee860698584c030f4c9db1", |
||||
"difficulty" : "0x020000", |
||||
"gasLimit" : "0x2fefd8", |
||||
"timestamp" : "0x54c98c81", |
||||
"extraData" : "0x42", |
||||
"mixHash" : "0x2c85bcbce56429100b2108254bb56906257582aeafcbd682bc9af67a9f5aee46", |
||||
"nonce" : "0x78cc16f7b4f65485", |
||||
"alloc" : { |
||||
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b": { |
||||
"balance" : "0x09184e72a000" |
||||
} |
||||
} |
||||
} |
Loading…
Reference in new issue