From 9aebb3ab6e7e6f3f519e9f977d29472d3fa63b71 Mon Sep 17 00:00:00 2001 From: Mike Goldin Date: Thu, 7 May 2020 17:12:57 -0400 Subject: [PATCH] Initial commit --- .github/actions/build/action.yaml | 5 + .github/actions/build/index.js | 33 + .github/workflows/build.yaml | 20 + .github/workflows/release.yaml | 66 + .gitignore | 3 + BUILD.bazel | 31 + LICENSE.txt | 201 + Makefile | 32 + README.md | 56 + WORKSPACE | 161 + cmd/eth2-comply/BUILD.bazel | 45 + cmd/eth2-comply/main.go | 93 + go.mod | 8 + go.sum | 15 + pkg/eth2spec/.gitignore | 24 + pkg/eth2spec/.openapi-generator/VERSION | 1 + pkg/eth2spec/BUILD.bazel | 97 + pkg/eth2spec/README.md | 161 + pkg/eth2spec/api/openapi.yaml | 3486 +++++++++++++++++ pkg/eth2spec/api_beacon.go | 1608 ++++++++ pkg/eth2spec/api_config.go | 250 ++ pkg/eth2spec/api_minimal_validator_api.go | 403 ++ pkg/eth2spec/api_node.go | 468 +++ pkg/eth2spec/api_validator_required_api.go | 402 ++ pkg/eth2spec/client.go | 551 +++ pkg/eth2spec/configuration.go | 136 + pkg/eth2spec/docs/Attestation.md | 13 + pkg/eth2spec/docs/AttesterDuty.md | 14 + pkg/eth2spec/docs/AttesterSlashing.md | 12 + pkg/eth2spec/docs/BeaconApi.md | 739 ++++ pkg/eth2spec/docs/BeaconBlock.md | 15 + pkg/eth2spec/docs/BeaconBlockAllOf.md | 14 + pkg/eth2spec/docs/BeaconBlockAllOf1.md | 11 + pkg/eth2spec/docs/BeaconBlockAllOf1Body.md | 18 + .../docs/BeaconBlockAllOf1BodyData.md | 14 + .../docs/BeaconBlockAllOf1BodyDeposits.md | 12 + .../docs/BeaconBlockAllOf1BodyEth1Data.md | 13 + pkg/eth2spec/docs/Checkpoint.md | 12 + pkg/eth2spec/docs/Committee.md | 13 + pkg/eth2spec/docs/ConfigApi.md | 101 + pkg/eth2spec/docs/Fork.md | 13 + pkg/eth2spec/docs/GenesisTime.md | 10 + pkg/eth2spec/docs/InlineObject.md | 13 + pkg/eth2spec/docs/InlineObject1.md | 12 + pkg/eth2spec/docs/InlineObject2.md | 12 + pkg/eth2spec/docs/InlineObject3.md | 12 + pkg/eth2spec/docs/InlineResponse200.md | 11 + pkg/eth2spec/docs/InlineResponse2001.md | 11 + pkg/eth2spec/docs/InlineResponse20010.md | 11 + pkg/eth2spec/docs/InlineResponse20010Data.md | 11 + pkg/eth2spec/docs/InlineResponse20011.md | 11 + pkg/eth2spec/docs/InlineResponse20011Data.md | 15 + pkg/eth2spec/docs/InlineResponse20011Data1.md | 13 + pkg/eth2spec/docs/InlineResponse20012.md | 11 + .../docs/InlineResponse20012Attestation1.md | 13 + pkg/eth2spec/docs/InlineResponse20012Data.md | 12 + pkg/eth2spec/docs/InlineResponse20013.md | 11 + pkg/eth2spec/docs/InlineResponse20013Data.md | 12 + pkg/eth2spec/docs/InlineResponse20014.md | 11 + pkg/eth2spec/docs/InlineResponse20014Data.md | 12 + .../docs/InlineResponse20014Message.md | 12 + pkg/eth2spec/docs/InlineResponse20015.md | 11 + pkg/eth2spec/docs/InlineResponse20015Data.md | 15 + .../docs/InlineResponse20015DataMetadata.md | 12 + pkg/eth2spec/docs/InlineResponse20016.md | 11 + pkg/eth2spec/docs/InlineResponse20016Data.md | 15 + pkg/eth2spec/docs/InlineResponse20017.md | 11 + pkg/eth2spec/docs/InlineResponse20018.md | 11 + pkg/eth2spec/docs/InlineResponse20018Data.md | 11 + pkg/eth2spec/docs/InlineResponse20019.md | 11 + pkg/eth2spec/docs/InlineResponse20019Data.md | 12 + pkg/eth2spec/docs/InlineResponse2001Data.md | 11 + pkg/eth2spec/docs/InlineResponse2002.md | 11 + pkg/eth2spec/docs/InlineResponse20020.md | 11 + pkg/eth2spec/docs/InlineResponse20021.md | 11 + pkg/eth2spec/docs/InlineResponse20022.md | 11 + pkg/eth2spec/docs/InlineResponse20022Data.md | 12 + pkg/eth2spec/docs/InlineResponse2002Data.md | 13 + pkg/eth2spec/docs/InlineResponse2003.md | 11 + pkg/eth2spec/docs/InlineResponse2003Data.md | 13 + ...InlineResponse2003DataPreviousJustified.md | 12 + pkg/eth2spec/docs/InlineResponse2004.md | 11 + pkg/eth2spec/docs/InlineResponse2004Data.md | 14 + .../docs/InlineResponse2004Validator.md | 18 + pkg/eth2spec/docs/InlineResponse2005.md | 11 + pkg/eth2spec/docs/InlineResponse2006.md | 11 + pkg/eth2spec/docs/InlineResponse2006Data.md | 13 + pkg/eth2spec/docs/InlineResponse2007.md | 11 + pkg/eth2spec/docs/InlineResponse2007Data.md | 13 + pkg/eth2spec/docs/InlineResponse2007Header.md | 12 + pkg/eth2spec/docs/InlineResponse2008.md | 11 + pkg/eth2spec/docs/InlineResponse2008Data.md | 12 + pkg/eth2spec/docs/InlineResponse2009.md | 11 + pkg/eth2spec/docs/InlineResponse2009Data.md | 12 + pkg/eth2spec/docs/InlineResponse200Data.md | 13 + pkg/eth2spec/docs/MinimalValidatorApiApi.md | 176 + pkg/eth2spec/docs/NetworkIdentity.md | 15 + pkg/eth2spec/docs/NodeApi.md | 198 + pkg/eth2spec/docs/Peer.md | 15 + pkg/eth2spec/docs/ProposerSlashing.md | 12 + pkg/eth2spec/docs/SignedAggregateAndProof.md | 12 + pkg/eth2spec/docs/SignedBeaconBlock.md | 12 + pkg/eth2spec/docs/SignedBeaconBlockHeader.md | 12 + pkg/eth2spec/docs/SignedVoluntaryExit.md | 12 + pkg/eth2spec/docs/ValidatorRequiredApiApi.md | 176 + pkg/eth2spec/docs/ValidatorResponse.md | 14 + pkg/eth2spec/docs/ValidatorStatus.md | 10 + pkg/eth2spec/model_attestation.go | 17 + pkg/eth2spec/model_attester_duty.go | 18 + pkg/eth2spec/model_attester_slashing.go | 15 + pkg/eth2spec/model_beacon_block.go | 18 + pkg/eth2spec/model_beacon_block_all_of.go | 17 + pkg/eth2spec/model_beacon_block_all_of_1.go | 14 + .../model_beacon_block_all_of_1_body.go | 21 + .../model_beacon_block_all_of_1_body_data.go | 18 + ...del_beacon_block_all_of_1_body_deposits.go | 16 + ...el_beacon_block_all_of_1_body_eth1_data.go | 16 + pkg/eth2spec/model_checkpoint.go | 15 + pkg/eth2spec/model_committee.go | 17 + pkg/eth2spec/model_fork.go | 18 + pkg/eth2spec/model_genesis_time.go | 13 + pkg/eth2spec/model_inline_object.go | 17 + pkg/eth2spec/model_inline_object_1.go | 15 + pkg/eth2spec/model_inline_object_2.go | 15 + pkg/eth2spec/model_inline_object_3.go | 15 + pkg/eth2spec/model_inline_response_200.go | 14 + pkg/eth2spec/model_inline_response_200_1.go | 14 + pkg/eth2spec/model_inline_response_200_10.go | 14 + .../model_inline_response_200_10_data.go | 14 + pkg/eth2spec/model_inline_response_200_11.go | 14 + .../model_inline_response_200_11_data.go | 18 + .../model_inline_response_200_11_data_1.go | 17 + pkg/eth2spec/model_inline_response_200_12.go | 14 + ...el_inline_response_200_12_attestation_1.go | 17 + .../model_inline_response_200_12_data.go | 15 + pkg/eth2spec/model_inline_response_200_13.go | 14 + .../model_inline_response_200_13_data.go | 15 + pkg/eth2spec/model_inline_response_200_14.go | 14 + .../model_inline_response_200_14_data.go | 15 + .../model_inline_response_200_14_message.go | 15 + pkg/eth2spec/model_inline_response_200_15.go | 14 + .../model_inline_response_200_15_data.go | 20 + ...el_inline_response_200_15_data_metadata.go | 15 + pkg/eth2spec/model_inline_response_200_16.go | 14 + .../model_inline_response_200_16_data.go | 21 + pkg/eth2spec/model_inline_response_200_17.go | 14 + pkg/eth2spec/model_inline_response_200_18.go | 14 + .../model_inline_response_200_18_data.go | 15 + pkg/eth2spec/model_inline_response_200_19.go | 14 + .../model_inline_response_200_19_data.go | 15 + .../model_inline_response_200_1_data.go | 14 + pkg/eth2spec/model_inline_response_200_2.go | 14 + pkg/eth2spec/model_inline_response_200_20.go | 14 + pkg/eth2spec/model_inline_response_200_21.go | 15 + pkg/eth2spec/model_inline_response_200_22.go | 14 + .../model_inline_response_200_22_data.go | 16 + .../model_inline_response_200_2_data.go | 18 + pkg/eth2spec/model_inline_response_200_3.go | 14 + .../model_inline_response_200_3_data.go | 16 + ..._response_200_3_data_previous_justified.go | 15 + pkg/eth2spec/model_inline_response_200_4.go | 14 + .../model_inline_response_200_4_data.go | 18 + .../model_inline_response_200_4_validator.go | 23 + pkg/eth2spec/model_inline_response_200_5.go | 14 + pkg/eth2spec/model_inline_response_200_6.go | 14 + .../model_inline_response_200_6_data.go | 17 + pkg/eth2spec/model_inline_response_200_7.go | 14 + .../model_inline_response_200_7_data.go | 16 + .../model_inline_response_200_7_header.go | 16 + pkg/eth2spec/model_inline_response_200_8.go | 14 + .../model_inline_response_200_8_data.go | 15 + pkg/eth2spec/model_inline_response_200_9.go | 14 + .../model_inline_response_200_9_data.go | 16 + .../model_inline_response_200_data.go | 17 + pkg/eth2spec/model_network_identity.go | 20 + pkg/eth2spec/model_peer.go | 21 + pkg/eth2spec/model_proposer_slashing.go | 15 + .../model_signed_aggregate_and_proof.go | 15 + pkg/eth2spec/model_signed_beacon_block.go | 16 + .../model_signed_beacon_block_header.go | 16 + pkg/eth2spec/model_signed_voluntary_exit.go | 15 + pkg/eth2spec/model_validator_response.go | 18 + pkg/eth2spec/model_validator_status.go | 25 + pkg/eth2spec/response.go | 46 + pkg/oapi/BUILD.bazel | 12 + pkg/oapi/oapi.go | 433 ++ pkg/testcases/BUILD.bazel | 16 + pkg/testcases/import.go | 226 ++ pkg/testcases/router.go | 164 + pkg/testcases/testcases.go | 314 ++ .../200_0.json | 4 + .../attestations/200_0.json | 4 + .../root/200_0.json | 4 + tests/get/v1/beacon/genesis/200_0.json | 4 + .../200_0.json | 4 + tests/get/v1/beacon/headers/200_0.json | 4 + .../v1/beacon/pool/attestations/200_0.json | 4 + .../beacon/pool/attester_slashings/200_0.json | 4 + .../beacon/pool/proposer_slashings/200_0.json | 4 + .../v1/beacon/pool/voluntary_exits/200_0.json | 4 + .../committees/2666/200_0.json | 4 + .../finality_checkpoints/200_0.json | 4 + .../fork/200_0.json | 4 + .../root/200_0.json | 4 + .../validators/1000/200_0.json | 4 + .../validators/200_0.json | 4 + tests/get/v1/node/health/200_0.json | 4 + tests/get/v1/node/identity/200_0.json | 4 + tests/get/v1/node/peers/200_0.json | 4 + .../200_0.json | 4 + tests/get/v1/node/syncing/200.json | 4 + tests/get/v1/node/version/200_0.json | 4 + 212 files changed, 13186 insertions(+) create mode 100644 .github/actions/build/action.yaml create mode 100644 .github/actions/build/index.js create mode 100644 .github/workflows/build.yaml create mode 100644 .github/workflows/release.yaml create mode 100644 .gitignore create mode 100644 BUILD.bazel create mode 100644 LICENSE.txt create mode 100644 Makefile create mode 100644 README.md create mode 100644 WORKSPACE create mode 100644 cmd/eth2-comply/BUILD.bazel create mode 100644 cmd/eth2-comply/main.go create mode 100644 go.mod create mode 100644 go.sum create mode 100644 pkg/eth2spec/.gitignore create mode 100644 pkg/eth2spec/.openapi-generator/VERSION create mode 100644 pkg/eth2spec/BUILD.bazel create mode 100644 pkg/eth2spec/README.md create mode 100644 pkg/eth2spec/api/openapi.yaml create mode 100644 pkg/eth2spec/api_beacon.go create mode 100644 pkg/eth2spec/api_config.go create mode 100644 pkg/eth2spec/api_minimal_validator_api.go create mode 100644 pkg/eth2spec/api_node.go create mode 100644 pkg/eth2spec/api_validator_required_api.go create mode 100644 pkg/eth2spec/client.go create mode 100644 pkg/eth2spec/configuration.go create mode 100644 pkg/eth2spec/docs/Attestation.md create mode 100644 pkg/eth2spec/docs/AttesterDuty.md create mode 100644 pkg/eth2spec/docs/AttesterSlashing.md create mode 100644 pkg/eth2spec/docs/BeaconApi.md create mode 100644 pkg/eth2spec/docs/BeaconBlock.md create mode 100644 pkg/eth2spec/docs/BeaconBlockAllOf.md create mode 100644 pkg/eth2spec/docs/BeaconBlockAllOf1.md create mode 100644 pkg/eth2spec/docs/BeaconBlockAllOf1Body.md create mode 100644 pkg/eth2spec/docs/BeaconBlockAllOf1BodyData.md create mode 100644 pkg/eth2spec/docs/BeaconBlockAllOf1BodyDeposits.md create mode 100644 pkg/eth2spec/docs/BeaconBlockAllOf1BodyEth1Data.md create mode 100644 pkg/eth2spec/docs/Checkpoint.md create mode 100644 pkg/eth2spec/docs/Committee.md create mode 100644 pkg/eth2spec/docs/ConfigApi.md create mode 100644 pkg/eth2spec/docs/Fork.md create mode 100644 pkg/eth2spec/docs/GenesisTime.md create mode 100644 pkg/eth2spec/docs/InlineObject.md create mode 100644 pkg/eth2spec/docs/InlineObject1.md create mode 100644 pkg/eth2spec/docs/InlineObject2.md create mode 100644 pkg/eth2spec/docs/InlineObject3.md create mode 100644 pkg/eth2spec/docs/InlineResponse200.md create mode 100644 pkg/eth2spec/docs/InlineResponse2001.md create mode 100644 pkg/eth2spec/docs/InlineResponse20010.md create mode 100644 pkg/eth2spec/docs/InlineResponse20010Data.md create mode 100644 pkg/eth2spec/docs/InlineResponse20011.md create mode 100644 pkg/eth2spec/docs/InlineResponse20011Data.md create mode 100644 pkg/eth2spec/docs/InlineResponse20011Data1.md create mode 100644 pkg/eth2spec/docs/InlineResponse20012.md create mode 100644 pkg/eth2spec/docs/InlineResponse20012Attestation1.md create mode 100644 pkg/eth2spec/docs/InlineResponse20012Data.md create mode 100644 pkg/eth2spec/docs/InlineResponse20013.md create mode 100644 pkg/eth2spec/docs/InlineResponse20013Data.md create mode 100644 pkg/eth2spec/docs/InlineResponse20014.md create mode 100644 pkg/eth2spec/docs/InlineResponse20014Data.md create mode 100644 pkg/eth2spec/docs/InlineResponse20014Message.md create mode 100644 pkg/eth2spec/docs/InlineResponse20015.md create mode 100644 pkg/eth2spec/docs/InlineResponse20015Data.md create mode 100644 pkg/eth2spec/docs/InlineResponse20015DataMetadata.md create mode 100644 pkg/eth2spec/docs/InlineResponse20016.md create mode 100644 pkg/eth2spec/docs/InlineResponse20016Data.md create mode 100644 pkg/eth2spec/docs/InlineResponse20017.md create mode 100644 pkg/eth2spec/docs/InlineResponse20018.md create mode 100644 pkg/eth2spec/docs/InlineResponse20018Data.md create mode 100644 pkg/eth2spec/docs/InlineResponse20019.md create mode 100644 pkg/eth2spec/docs/InlineResponse20019Data.md create mode 100644 pkg/eth2spec/docs/InlineResponse2001Data.md create mode 100644 pkg/eth2spec/docs/InlineResponse2002.md create mode 100644 pkg/eth2spec/docs/InlineResponse20020.md create mode 100644 pkg/eth2spec/docs/InlineResponse20021.md create mode 100644 pkg/eth2spec/docs/InlineResponse20022.md create mode 100644 pkg/eth2spec/docs/InlineResponse20022Data.md create mode 100644 pkg/eth2spec/docs/InlineResponse2002Data.md create mode 100644 pkg/eth2spec/docs/InlineResponse2003.md create mode 100644 pkg/eth2spec/docs/InlineResponse2003Data.md create mode 100644 pkg/eth2spec/docs/InlineResponse2003DataPreviousJustified.md create mode 100644 pkg/eth2spec/docs/InlineResponse2004.md create mode 100644 pkg/eth2spec/docs/InlineResponse2004Data.md create mode 100644 pkg/eth2spec/docs/InlineResponse2004Validator.md create mode 100644 pkg/eth2spec/docs/InlineResponse2005.md create mode 100644 pkg/eth2spec/docs/InlineResponse2006.md create mode 100644 pkg/eth2spec/docs/InlineResponse2006Data.md create mode 100644 pkg/eth2spec/docs/InlineResponse2007.md create mode 100644 pkg/eth2spec/docs/InlineResponse2007Data.md create mode 100644 pkg/eth2spec/docs/InlineResponse2007Header.md create mode 100644 pkg/eth2spec/docs/InlineResponse2008.md create mode 100644 pkg/eth2spec/docs/InlineResponse2008Data.md create mode 100644 pkg/eth2spec/docs/InlineResponse2009.md create mode 100644 pkg/eth2spec/docs/InlineResponse2009Data.md create mode 100644 pkg/eth2spec/docs/InlineResponse200Data.md create mode 100644 pkg/eth2spec/docs/MinimalValidatorApiApi.md create mode 100644 pkg/eth2spec/docs/NetworkIdentity.md create mode 100644 pkg/eth2spec/docs/NodeApi.md create mode 100644 pkg/eth2spec/docs/Peer.md create mode 100644 pkg/eth2spec/docs/ProposerSlashing.md create mode 100644 pkg/eth2spec/docs/SignedAggregateAndProof.md create mode 100644 pkg/eth2spec/docs/SignedBeaconBlock.md create mode 100644 pkg/eth2spec/docs/SignedBeaconBlockHeader.md create mode 100644 pkg/eth2spec/docs/SignedVoluntaryExit.md create mode 100644 pkg/eth2spec/docs/ValidatorRequiredApiApi.md create mode 100644 pkg/eth2spec/docs/ValidatorResponse.md create mode 100644 pkg/eth2spec/docs/ValidatorStatus.md create mode 100644 pkg/eth2spec/model_attestation.go create mode 100644 pkg/eth2spec/model_attester_duty.go create mode 100644 pkg/eth2spec/model_attester_slashing.go create mode 100644 pkg/eth2spec/model_beacon_block.go create mode 100644 pkg/eth2spec/model_beacon_block_all_of.go create mode 100644 pkg/eth2spec/model_beacon_block_all_of_1.go create mode 100644 pkg/eth2spec/model_beacon_block_all_of_1_body.go create mode 100644 pkg/eth2spec/model_beacon_block_all_of_1_body_data.go create mode 100644 pkg/eth2spec/model_beacon_block_all_of_1_body_deposits.go create mode 100644 pkg/eth2spec/model_beacon_block_all_of_1_body_eth1_data.go create mode 100644 pkg/eth2spec/model_checkpoint.go create mode 100644 pkg/eth2spec/model_committee.go create mode 100644 pkg/eth2spec/model_fork.go create mode 100644 pkg/eth2spec/model_genesis_time.go create mode 100644 pkg/eth2spec/model_inline_object.go create mode 100644 pkg/eth2spec/model_inline_object_1.go create mode 100644 pkg/eth2spec/model_inline_object_2.go create mode 100644 pkg/eth2spec/model_inline_object_3.go create mode 100644 pkg/eth2spec/model_inline_response_200.go create mode 100644 pkg/eth2spec/model_inline_response_200_1.go create mode 100644 pkg/eth2spec/model_inline_response_200_10.go create mode 100644 pkg/eth2spec/model_inline_response_200_10_data.go create mode 100644 pkg/eth2spec/model_inline_response_200_11.go create mode 100644 pkg/eth2spec/model_inline_response_200_11_data.go create mode 100644 pkg/eth2spec/model_inline_response_200_11_data_1.go create mode 100644 pkg/eth2spec/model_inline_response_200_12.go create mode 100644 pkg/eth2spec/model_inline_response_200_12_attestation_1.go create mode 100644 pkg/eth2spec/model_inline_response_200_12_data.go create mode 100644 pkg/eth2spec/model_inline_response_200_13.go create mode 100644 pkg/eth2spec/model_inline_response_200_13_data.go create mode 100644 pkg/eth2spec/model_inline_response_200_14.go create mode 100644 pkg/eth2spec/model_inline_response_200_14_data.go create mode 100644 pkg/eth2spec/model_inline_response_200_14_message.go create mode 100644 pkg/eth2spec/model_inline_response_200_15.go create mode 100644 pkg/eth2spec/model_inline_response_200_15_data.go create mode 100644 pkg/eth2spec/model_inline_response_200_15_data_metadata.go create mode 100644 pkg/eth2spec/model_inline_response_200_16.go create mode 100644 pkg/eth2spec/model_inline_response_200_16_data.go create mode 100644 pkg/eth2spec/model_inline_response_200_17.go create mode 100644 pkg/eth2spec/model_inline_response_200_18.go create mode 100644 pkg/eth2spec/model_inline_response_200_18_data.go create mode 100644 pkg/eth2spec/model_inline_response_200_19.go create mode 100644 pkg/eth2spec/model_inline_response_200_19_data.go create mode 100644 pkg/eth2spec/model_inline_response_200_1_data.go create mode 100644 pkg/eth2spec/model_inline_response_200_2.go create mode 100644 pkg/eth2spec/model_inline_response_200_20.go create mode 100644 pkg/eth2spec/model_inline_response_200_21.go create mode 100644 pkg/eth2spec/model_inline_response_200_22.go create mode 100644 pkg/eth2spec/model_inline_response_200_22_data.go create mode 100644 pkg/eth2spec/model_inline_response_200_2_data.go create mode 100644 pkg/eth2spec/model_inline_response_200_3.go create mode 100644 pkg/eth2spec/model_inline_response_200_3_data.go create mode 100644 pkg/eth2spec/model_inline_response_200_3_data_previous_justified.go create mode 100644 pkg/eth2spec/model_inline_response_200_4.go create mode 100644 pkg/eth2spec/model_inline_response_200_4_data.go create mode 100644 pkg/eth2spec/model_inline_response_200_4_validator.go create mode 100644 pkg/eth2spec/model_inline_response_200_5.go create mode 100644 pkg/eth2spec/model_inline_response_200_6.go create mode 100644 pkg/eth2spec/model_inline_response_200_6_data.go create mode 100644 pkg/eth2spec/model_inline_response_200_7.go create mode 100644 pkg/eth2spec/model_inline_response_200_7_data.go create mode 100644 pkg/eth2spec/model_inline_response_200_7_header.go create mode 100644 pkg/eth2spec/model_inline_response_200_8.go create mode 100644 pkg/eth2spec/model_inline_response_200_8_data.go create mode 100644 pkg/eth2spec/model_inline_response_200_9.go create mode 100644 pkg/eth2spec/model_inline_response_200_9_data.go create mode 100644 pkg/eth2spec/model_inline_response_200_data.go create mode 100644 pkg/eth2spec/model_network_identity.go create mode 100644 pkg/eth2spec/model_peer.go create mode 100644 pkg/eth2spec/model_proposer_slashing.go create mode 100644 pkg/eth2spec/model_signed_aggregate_and_proof.go create mode 100644 pkg/eth2spec/model_signed_beacon_block.go create mode 100644 pkg/eth2spec/model_signed_beacon_block_header.go create mode 100644 pkg/eth2spec/model_signed_voluntary_exit.go create mode 100644 pkg/eth2spec/model_validator_response.go create mode 100644 pkg/eth2spec/model_validator_status.go create mode 100644 pkg/eth2spec/response.go create mode 100644 pkg/oapi/BUILD.bazel create mode 100644 pkg/oapi/oapi.go create mode 100644 pkg/testcases/BUILD.bazel create mode 100644 pkg/testcases/import.go create mode 100644 pkg/testcases/router.go create mode 100644 pkg/testcases/testcases.go create mode 100644 tests/get/v1/beacon/blocks/0xd8f7c4f204f695df7ca4ad079468f48f57b71f2d569a396c811751e3cf8c0596/200_0.json create mode 100644 tests/get/v1/beacon/blocks/0xd8f7c4f204f695df7ca4ad079468f48f57b71f2d569a396c811751e3cf8c0596/attestations/200_0.json create mode 100644 tests/get/v1/beacon/blocks/0xd8f7c4f204f695df7ca4ad079468f48f57b71f2d569a396c811751e3cf8c0596/root/200_0.json create mode 100644 tests/get/v1/beacon/genesis/200_0.json create mode 100644 tests/get/v1/beacon/headers/0xd8f7c4f204f695df7ca4ad079468f48f57b71f2d569a396c811751e3cf8c0596/200_0.json create mode 100644 tests/get/v1/beacon/headers/200_0.json create mode 100644 tests/get/v1/beacon/pool/attestations/200_0.json create mode 100644 tests/get/v1/beacon/pool/attester_slashings/200_0.json create mode 100644 tests/get/v1/beacon/pool/proposer_slashings/200_0.json create mode 100644 tests/get/v1/beacon/pool/voluntary_exits/200_0.json create mode 100644 tests/get/v1/beacon/states/0x00797233cf8a4272c672ec08f324ac3ba7fd601c32ef0c8a9d35e6541c048ca6/committees/2666/200_0.json create mode 100644 tests/get/v1/beacon/states/0x00797233cf8a4272c672ec08f324ac3ba7fd601c32ef0c8a9d35e6541c048ca6/finality_checkpoints/200_0.json create mode 100644 tests/get/v1/beacon/states/0x00797233cf8a4272c672ec08f324ac3ba7fd601c32ef0c8a9d35e6541c048ca6/fork/200_0.json create mode 100644 tests/get/v1/beacon/states/0x00797233cf8a4272c672ec08f324ac3ba7fd601c32ef0c8a9d35e6541c048ca6/root/200_0.json create mode 100644 tests/get/v1/beacon/states/0x00797233cf8a4272c672ec08f324ac3ba7fd601c32ef0c8a9d35e6541c048ca6/validators/1000/200_0.json create mode 100644 tests/get/v1/beacon/states/0x00797233cf8a4272c672ec08f324ac3ba7fd601c32ef0c8a9d35e6541c048ca6/validators/200_0.json create mode 100644 tests/get/v1/node/health/200_0.json create mode 100644 tests/get/v1/node/identity/200_0.json create mode 100644 tests/get/v1/node/peers/200_0.json create mode 100644 tests/get/v1/node/peers/QmYyQSo1c1Ym7orWxLYvCrM2EmxFTANf8wXmmE7DWjhx5N/200_0.json create mode 100644 tests/get/v1/node/syncing/200.json create mode 100644 tests/get/v1/node/version/200_0.json diff --git a/.github/actions/build/action.yaml b/.github/actions/build/action.yaml new file mode 100644 index 0000000..9b0b102 --- /dev/null +++ b/.github/actions/build/action.yaml @@ -0,0 +1,5 @@ +name: Build (all platforms) +description: Builds eth2-comply for all supported platforms +runs: + using: node12 + main: index.js diff --git a/.github/actions/build/index.js b/.github/actions/build/index.js new file mode 100644 index 0000000..80e4298 --- /dev/null +++ b/.github/actions/build/index.js @@ -0,0 +1,33 @@ +const { spawn } = require('child_process') + +const buildCommand = "bazel" +const standardBuildArgs = ["build"] + +let buildProcs = [] +let buildProc + +const linuxAmd64BuildArgs = standardBuildArgs.concat([":linux_amd64"]) +buildProc = spawn(buildCommand, linuxAmd64BuildArgs) +buildProcs = buildProcs.concat([buildProc]) + +const darwinAmd64BuildArgs = standardBuildArgs.concat([":darwin_amd64"]) +buildProc = spawn(buildCommand, darwinAmd64BuildArgs) +buildProcs = buildProcs.concat([buildProc]) + +const windowsAmd64BuildArgs = standardBuildArgs.concat([":windows_amd64"]) +buildProc = spawn(buildCommand, windowsAmd64BuildArgs) +buildProcs = buildProcs.concat([buildProc]) + +const testsBuildArgs = standardBuildArgs.concat([":tests"]) +buildProc = spawn(buildCommand, testsBuildArgs) +buildProcs = buildProcs.concat([buildProc]) + +buildProcs.map(buildProc => { + buildProc.stdout.on("data", data => { + process.stdout.write(data.toString("utf-8")) + }) + buildProc.stderr.on("data", data => { + process.stderr.write(data.toString("utf-8")) + }) +}) + diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml new file mode 100644 index 0000000..1ca7ea6 --- /dev/null +++ b/.github/workflows/build.yaml @@ -0,0 +1,20 @@ +name: build +on: + push: + branches-ignore: + - master + +jobs: + build: + name: build (all platforms) + runs-on: ubuntu-18.04 + container: + image: l.gcr.io/google/bazel:3.1.0 + steps: + - name: checkout + uses: actions/checkout@v2 + with: + ref: ${{ github.ref }} + - name: build (all platforms) + uses: ./.github/actions/build + diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml new file mode 100644 index 0000000..066fb33 --- /dev/null +++ b/.github/workflows/release.yaml @@ -0,0 +1,66 @@ +name: Release +on: + push: + tags: + - v* + +jobs: + release_master: + name: Release (master) + runs-on: ubuntu-18.04 + container: + image: l.gcr.io/google/bazel:3.1.0 + steps: + - name: checkout + uses: actions/checkout@v2 + with: + ref: ${{ github.ref }} + - name: get version + id: get_version + run: echo ::set-output name=version::${GITHUB_REF#refs/tags/} + - name: build (all platforms) + uses: ./.github/actions/build + - name: create release + id: create_release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: ${{ github.ref }} + release_name: eth2-comply ${{ github.ref }} + - name: upload tests + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: bazel-bin/tests.zip + asset_name: tests-${{ steps.get_version.outputs.version }}.zip + asset_content_type: "application/zip" + - name: upload linux_amd64 + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: bazel-bin/linux_amd64.zip + asset_name: linux_amd64-${{ steps.get_version.outputs.version }}.zip + asset_content_type: "application/zip" + - name: upload darwin_amd64 + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: bazel-bin/darwin_amd64.zip + asset_name: darwin_amd64-${{ steps.get_version.outputs.version }}.zip + asset_content_type: "application/zip" + - name: upload windows_amd64 + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: bazel-bin/windows_amd64.zip + asset_name: windows_amd64-${{ steps.get_version.outputs.version }}.zip + asset_content_type: "application/zip" diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..8857af1 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +bazel-* +eth2-comply + diff --git a/BUILD.bazel b/BUILD.bazel new file mode 100644 index 0000000..501cb4b --- /dev/null +++ b/BUILD.bazel @@ -0,0 +1,31 @@ +load("@bazel_gazelle//:def.bzl", "gazelle") + +gazelle( + name = "gazelle", + prefix = "github.com/INFURA/eth2-comply", +) + +load("@rules_pkg//:pkg.bzl", "pkg_zip") + +genrule( + name = "tests", + srcs = glob(["tests/**"]), + tools = ["@bazel_tools//tools/zip:zipper"], + outs = ["tests.zip"], + cmd = "$(location @bazel_tools//tools/zip:zipper) c $@ $(SRCS)", +) + +pkg_zip( + name = "linux_amd64", + srcs = ["//cmd/eth2-comply:linux_amd64"], +) + +pkg_zip( + name = "darwin_amd64", + srcs = ["//cmd/eth2-comply:darwin_amd64"], +) + +pkg_zip( + name = "windows_amd64", + srcs = ["//cmd/eth2-comply:windows_amd64"], +) diff --git a/LICENSE.txt b/LICENSE.txt new file mode 100644 index 0000000..261eeb9 --- /dev/null +++ b/LICENSE.txt @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + 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. diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..ef2f991 --- /dev/null +++ b/Makefile @@ -0,0 +1,32 @@ +ETH2SPECREMOTE=git@github.com:ethereum/eth2.0-APIs.git +ETH2SPECFS=/tmp/eth2-api +ETH2SPECROOT=beacon-node-oapi.yaml +ETH2SPECBUNDLE=bundle.yaml +ETH2PKGPATH=pkg/eth2spec + +build: + go build ./... \ + && bazel run //:gazelle + +lint: + golangci-lint --skip-dirs $(ETH2PKGPATH) run + +oapi-pull-latest: + rm -rf $(ETH2SPECFS) \ + ; git clone $(ETH2SPECREMOTE) $(ETH2SPECFS) + +oapi-build: + swagger-cli bundle -r $(ETH2SPECFS)/$(ETH2SPECROOT) > $(ETH2SPECFS)/$(ETH2SPECBUNDLE) \ + && openapi-generator generate \ + -i $(ETH2SPECFS)/$(ETH2SPECBUNDLE) \ + -g go \ + -o $(ETH2PKGPATH) \ + --additional-properties=packageName=eth2spec,isGoSubmodule=true \ + && rm $(ETH2PKGPATH)/go.mod \ + && rm $(ETH2PKGPATH)/go.sum \ + && rm $(ETH2PKGPATH)/.travis.yml \ + && rm $(ETH2PKGPATH)/.openapi-generator-ignore \ + && rm $(ETH2PKGPATH)/git_push.sh \ + && go build $(ETH2PKGPATH)/*.go \ + && bazel run //:gazelle \ + && bazel run //:gazelle -- update-repos -from_file=go.mod diff --git a/README.md b/README.md new file mode 100644 index 0000000..30a7f45 --- /dev/null +++ b/README.md @@ -0,0 +1,56 @@ +# eth2-comply + +eth2-comply is a no-code platform for [Ethereum 2.0 API](https://github.com/ethereum/eth2.0-APIs) conformance testing. It provides blackbox conformance testing facilities and a simple syntax for specifying test cases. + +## Install + +Check the [release page](https://github.com/INFURA/eth2-comply/releases) for the latest eth2-comply binaries and test files. + +## Usage + +``` +eth2-comply --target http://localhost:5051 --testsRemote https://github.com/INFURA/eth2-comply/releases/download/v0.1.1/tests-v0.1.1.zip +``` + +CLI arguments: + +- `--testsRoot` Path to a directory tree on the filesystem containing JSON test cases. +- `--testsRemote` URL to a zip file containing a valid tests directory tree. `--testsRemote` takes precedence over `--testsRoot` if both are specidied. +- `--outDir` Location on the filesystem to download and unpack a zip file specified in `--testsRemote`. Has no meaning if `--testsRemote` is not specified. +- `--target` URL of any appliance serving the Ethereum 2.0 API. +- `--timeout` Time after which to abandon waiting tests. Defaults to 10 minutes. Uses [Go duration syntax](https://golang.org/pkg/time/#ParseDuration). + +## Syntax of test cases + +Tests are specified as normal JSON objects. Only one test should be specified per file. Test files should be placed in the appropriate directory according to the API route they activate. Files should be named `_.json` where `seq_num` is just a unique number to prevent the file name from colliding with any other test case in that directory testing for the same expected status code in that route. The names and filepaths of test files have no bearing on how eth2-comply processes them, this topology is just an organizational methodology. + +The following JSON fields have meaning in eth2-comply test case syntax. Any fields not listed have no meaning to eth2-comply and are ignored. + +| field | required | value type | example | +|--------------------|----------|------------|--------------------------------------------------| +| method | yes | string | "GET" | +| route | yes | string | "/beacon/committees" | +| reqBody | no | object | `{"epoch": "0", "pubkeys": ["0xdeadbeef"]}` | +| queryParams | no | object | `{"epoch": "0"}` | +| awaitSlot | no | int | 2666 | +| expectedRespStatus | no | int | 200 | +| expectedRespBody | no | object | `[{"slot": "0", "index": "0", "committee": []}]` | + +Most of the fields meaning should be self-explanatory. `awaitSlot` can be used to make `eth2-comply` wait until the target node has synced the specified slot before executing the test. + +When specifying expected response bodies, know that received and expected responses are canonicalized before being compared. This means that whitespace and key order do not matter in general. Remember that list order does matter; the way a list is specified literally is its canonical form, though nested objects are themselves canonicalized. + +## Build and run while developing + +Build: + +``` +make build +``` + +Run: + +``` +bazel run -- cmd/eth2-comply:eth2-comply --target http://localhost:5051 --testsRoot $(PWD)/tests +``` + diff --git a/WORKSPACE b/WORKSPACE new file mode 100644 index 0000000..57bdf04 --- /dev/null +++ b/WORKSPACE @@ -0,0 +1,161 @@ +load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") + +# Download and install rules_pkg +http_archive( + name = "rules_pkg", + url = "https://github.com/bazelbuild/rules_pkg/releases/download/0.2.5/rules_pkg-0.2.5.tar.gz", + sha256 = "352c090cc3d3f9a6b4e676cf42a6047c16824959b438895a76c2989c6d7c246a", +) + +load("@rules_pkg//:deps.bzl", "rules_pkg_dependencies") + +rules_pkg_dependencies() + +# Download and install Go Bazel tools +http_archive( + name = "io_bazel_rules_go", + sha256 = "7b9bbe3ea1fccb46dcfa6c3f3e29ba7ec740d8733370e21cdc8937467b4a4349", + urls = [ + "https://mirror.bazel.build/github.com/bazelbuild/rules_go/releases/download/v0.22.4/rules_go-v0.22.4.tar.gz", + "https://github.com/bazelbuild/rules_go/releases/download/v0.22.4/rules_go-v0.22.4.tar.gz", + ], +) + +load("@io_bazel_rules_go//go:deps.bzl", "go_register_toolchains", "go_rules_dependencies") + +go_rules_dependencies() + +go_register_toolchains() + +# Download and install Gazelle tool +http_archive( + name = "bazel_gazelle", + sha256 = "d8c45ee70ec39a57e7a05e5027c32b1576cc7f16d9dd37135b0eddde45cf1b10", + urls = [ + "https://storage.googleapis.com/bazel-mirror/github.com/bazelbuild/bazel-gazelle/releases/download/v0.20.0/bazel-gazelle-v0.20.0.tar.gz", + "https://github.com/bazelbuild/bazel-gazelle/releases/download/v0.20.0/bazel-gazelle-v0.20.0.tar.gz", + ], +) + +load("@bazel_gazelle//:deps.bzl", "gazelle_dependencies", "go_repository") + +gazelle_dependencies() + +go_repository( + name = "com_github_davecgh_go_spew", + importpath = "github.com/davecgh/go-spew", + sum = "h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8=", + version = "v1.1.0", +) + +go_repository( + name = "com_github_getkin_kin_openapi", + importpath = "github.com/getkin/kin-openapi", + sum = "h1:a6TQjTqwkyscC4/hShJX7WhCVE+4bi9lzw61XHQW5hE=", + version = "v0.8.0", +) + +go_repository( + name = "com_github_ghodss_yaml", + importpath = "github.com/ghodss/yaml", + sum = "h1:wQHKEahhL6wmXdzwWG11gIVCkOv05bNOh+Rxn0yngAk=", + version = "v1.0.0", +) + +go_repository( + name = "com_github_pmezard_go_difflib", + importpath = "github.com/pmezard/go-difflib", + sum = "h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=", + version = "v1.0.0", +) + +go_repository( + name = "com_github_stretchr_objx", + importpath = "github.com/stretchr/objx", + sum = "h1:4G4v2dO3VZwixGIRoQ5Lfboy6nUhCyYzaqnIAPPhYs4=", + version = "v0.1.0", +) + +go_repository( + name = "com_github_stretchr_testify", + importpath = "github.com/stretchr/testify", + sum = "h1:nOGnQDM7FYENwehXlg/kFVnos3rEvtKTjRvOWSzb6H4=", + version = "v1.5.1", +) + +go_repository( + name = "in_gopkg_check_v1", + importpath = "gopkg.in/check.v1", + sum = "h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=", + version = "v0.0.0-20161208181325-20d25e280405", +) + +go_repository( + name = "in_gopkg_yaml_v2", + importpath = "gopkg.in/yaml.v2", + sum = "h1:obN1ZagJSUGI0Ek/LBmuj4SNLPfIny3KsKFopxRdj10=", + version = "v2.2.8", +) + +go_repository( + name = "com_github_golang_protobuf", + importpath = "github.com/golang/protobuf", + sum = "h1:P3YflyNX/ehuJFLhxviNdFxQPkGK5cDcApsge1SqnvM=", + version = "v1.2.0", +) + +go_repository( + name = "com_google_cloud_go", + importpath = "cloud.google.com/go", + sum = "h1:eOI3/cP2VTU6uZLDYAoic+eyzzB9YyGmJ7eIjl8rOPg=", + version = "v0.34.0", +) + +go_repository( + name = "org_golang_google_appengine", + importpath = "google.golang.org/appengine", + sum = "h1:/wp5JvzpHIxhs/dumFmF7BXTf3Z+dd4uXta4kVyO508=", + version = "v1.4.0", +) + +go_repository( + name = "org_golang_x_net", + importpath = "golang.org/x/net", + sum = "h1:bRhVy7zSSasaqNksaRZiA5EEI+Ei4I1nO5Jh72wfHlg=", + version = "v0.0.0-20190108225652-1e06a53dbb7e", +) + +go_repository( + name = "org_golang_x_oauth2", + importpath = "golang.org/x/oauth2", + sum = "h1:TzXSXBo42m9gQenoE3b9BGiEpg5IG2JkU5FkPIawgtw=", + version = "v0.0.0-20200107190931-bf48bf16ab8d", +) + +go_repository( + name = "org_golang_x_sync", + importpath = "golang.org/x/sync", + sum = "h1:YUO/7uOKsKeq9UokNS62b8FYywz3ker1l1vDZRCRefw=", + version = "v0.0.0-20181221193216-37e7f081c4d4", +) + +go_repository( + name = "org_golang_x_text", + importpath = "golang.org/x/text", + sum = "h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg=", + version = "v0.3.0", +) + +go_repository( + name = "com_github_gibson042_canonicaljson_go", + importpath = "github.com/gibson042/canonicaljson-go", + sum = "h1:EAyF8L74AWabkyUmrvEFHEt/AGFQeD6RfwbAuf0j1bI=", + version = "v1.0.3", +) + +go_repository( + name = "com_github_antihax_optional", + importpath = "github.com/antihax/optional", + sum = "h1:xK2lYat7ZLaVVcIuj82J8kIro4V6kDe0AUDFboUCwcg=", + version = "v1.0.0", +) diff --git a/cmd/eth2-comply/BUILD.bazel b/cmd/eth2-comply/BUILD.bazel new file mode 100644 index 0000000..8bd0786 --- /dev/null +++ b/cmd/eth2-comply/BUILD.bazel @@ -0,0 +1,45 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library") + +go_library( + name = "go_default_library", + srcs = ["main.go"], + importpath = "github.com/INFURA/eth2-comply/cmd/eth2-comply", + visibility = ["//visibility:private"], + deps = [ + "//pkg/oapi:go_default_library", + "//pkg/testcases:go_default_library", + ], +) + +go_binary( + name = "eth2-comply", + embed = [":go_default_library"], + visibility = ["//visibility:public"], +) + +go_binary( + name = "linux_amd64", + embed = [":go_default_library"], + visibility = ["//visibility:public"], + goos = "linux", + goarch = "amd64", + pure = "on", +) + +go_binary( + name = "darwin_amd64", + embed = [":go_default_library"], + visibility = ["//visibility:public"], + goos = "darwin", + goarch = "amd64", + pure = "on", +) + +go_binary( + name = "windows_amd64", + embed = [":go_default_library"], + visibility = ["//visibility:public"], + goos = "windows", + goarch = "amd64", + pure = "on", +) diff --git a/cmd/eth2-comply/main.go b/cmd/eth2-comply/main.go new file mode 100644 index 0000000..d3ca622 --- /dev/null +++ b/cmd/eth2-comply/main.go @@ -0,0 +1,93 @@ +package main + +import ( + "context" + "flag" + "fmt" + "net/url" + "os" + "sort" + "time" + + "github.com/INFURA/eth2-comply/pkg/oapi" + "github.com/INFURA/eth2-comply/pkg/testcases" +) + +func main() { + // Setup and parse CLI arguments. + testsRoot := flag.String("testsRoot", "NO TESTS DIR PROVIDED", "Path to a directory tree with test cases") + testsRemote := flag.String("testsRemote", "", "URL of a ZIP file containing a directory tree with test cases") + outDir := flag.String("outDir", "/tmp", "A directory where zip files will be downloaded and unzipped.") + target := flag.String("target", "NO TARGET PROVIDED", "A URL to run tests against, for example http://localhost:5051") + timeout := flag.String("timeout", "10m", "The time to wait for a case execution to complete. For example, 3600s, 60m, 1h") + flag.Parse() + + // Setup OAPI client. + targetUrl, err := url.Parse(*target) + if err != nil { + panic(err) + } + oapiClient := oapi.NewClient(*targetUrl) + + // Get test cases. + opts := &testcases.TestsCasesOpts{ + Target: *target, + TestsRoot: *testsRoot, + TestsRemote: *testsRemote, + OutDir: *outDir, + OapiClient: oapiClient, + } + testCases, err := testcases.All(opts) + if err != nil { + panic(err) + } + + // Create test context with timeout. + timeoutDur, err := time.ParseDuration(*timeout) + if err != nil { + panic(err) + } + ctx, cancelFunc := context.WithTimeout(context.Background(), timeoutDur) + + // Execute test cases. + for _, testCase := range testCases { + go testCase.Exec(ctx) + } + + // Concurrent helper function cancels contexts (tests) that timeout. + go func(ctx context.Context, cancelFunc func()) { + deadline, ok := ctx.Deadline() + if !ok { + panic("Could not get deadline for background context. Is your timeout parameter specified properly?") + } + for { + if time.Now().After(deadline) { + cancelFunc() + return + } + time.Sleep(time.Second) + } + }(ctx, cancelFunc) + + // Sort testCases by awaitSlot. This enables us to always print the latest + // available test result. + sort.Slice(testCases, func(i, j int) bool { + return testCases[i].Config.AwaitSlot < testCases[j].Config.AwaitSlot + }) + + // Print test results as they come in. + for _, testCase := range testCases { + if testCase.Config.AwaitSlot > 0 { + fmt.Printf("Next test is awaiting slot %d\n", testCase.Config.AwaitSlot) + } + <-testCase.Done + testCase.PrintResults() + } + + // If any test was unsuccessful, exit with code 1. + for _, testCase := range testCases { + if !testCase.Result.Success { + os.Exit(1) + } + } +} diff --git a/go.mod b/go.mod new file mode 100644 index 0000000..d9f6d6e --- /dev/null +++ b/go.mod @@ -0,0 +1,8 @@ +module github.com/INFURA/eth2-comply + +go 1.14 + +require ( + github.com/antihax/optional v1.0.0 + golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d +) diff --git a/go.sum b/go.sum new file mode 100644 index 0000000..795fed2 --- /dev/null +++ b/go.sum @@ -0,0 +1,15 @@ +cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +github.com/antihax/optional v1.0.0 h1:xK2lYat7ZLaVVcIuj82J8kIro4V6kDe0AUDFboUCwcg= +github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= +github.com/golang/protobuf v1.2.0 h1:P3YflyNX/ehuJFLhxviNdFxQPkGK5cDcApsge1SqnvM= +github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e h1:bRhVy7zSSasaqNksaRZiA5EEI+Ei4I1nO5Jh72wfHlg= +golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d h1:TzXSXBo42m9gQenoE3b9BGiEpg5IG2JkU5FkPIawgtw= +golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4 h1:YUO/7uOKsKeq9UokNS62b8FYywz3ker1l1vDZRCRefw= +golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +google.golang.org/appengine v1.4.0 h1:/wp5JvzpHIxhs/dumFmF7BXTf3Z+dd4uXta4kVyO508= +google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= diff --git a/pkg/eth2spec/.gitignore b/pkg/eth2spec/.gitignore new file mode 100644 index 0000000..daf913b --- /dev/null +++ b/pkg/eth2spec/.gitignore @@ -0,0 +1,24 @@ +# Compiled Object files, Static and Dynamic libs (Shared Objects) +*.o +*.a +*.so + +# Folders +_obj +_test + +# Architecture specific extensions/prefixes +*.[568vq] +[568vq].out + +*.cgo1.go +*.cgo2.c +_cgo_defun.c +_cgo_gotypes.go +_cgo_export.* + +_testmain.go + +*.exe +*.test +*.prof diff --git a/pkg/eth2spec/.openapi-generator/VERSION b/pkg/eth2spec/.openapi-generator/VERSION new file mode 100644 index 0000000..ecedc98 --- /dev/null +++ b/pkg/eth2spec/.openapi-generator/VERSION @@ -0,0 +1 @@ +4.3.1 \ No newline at end of file diff --git a/pkg/eth2spec/BUILD.bazel b/pkg/eth2spec/BUILD.bazel new file mode 100644 index 0000000..0d30c7a --- /dev/null +++ b/pkg/eth2spec/BUILD.bazel @@ -0,0 +1,97 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library") + +go_library( + name = "go_default_library", + srcs = [ + "api_beacon.go", + "api_config.go", + "api_minimal_validator_api.go", + "api_node.go", + "api_validator_required_api.go", + "client.go", + "configuration.go", + "model_attestation.go", + "model_attester_duty.go", + "model_attester_slashing.go", + "model_beacon_block.go", + "model_beacon_block_all_of.go", + "model_beacon_block_all_of_1.go", + "model_beacon_block_all_of_1_body.go", + "model_beacon_block_all_of_1_body_data.go", + "model_beacon_block_all_of_1_body_deposits.go", + "model_beacon_block_all_of_1_body_eth1_data.go", + "model_checkpoint.go", + "model_committee.go", + "model_fork.go", + "model_genesis_time.go", + "model_inline_object.go", + "model_inline_object_1.go", + "model_inline_object_2.go", + "model_inline_object_3.go", + "model_inline_response_200.go", + "model_inline_response_200_1.go", + "model_inline_response_200_10.go", + "model_inline_response_200_10_data.go", + "model_inline_response_200_11.go", + "model_inline_response_200_11_data.go", + "model_inline_response_200_11_data_1.go", + "model_inline_response_200_12.go", + "model_inline_response_200_12_attestation_1.go", + "model_inline_response_200_12_data.go", + "model_inline_response_200_13.go", + "model_inline_response_200_13_data.go", + "model_inline_response_200_14.go", + "model_inline_response_200_14_data.go", + "model_inline_response_200_14_message.go", + "model_inline_response_200_15.go", + "model_inline_response_200_15_data.go", + "model_inline_response_200_15_data_metadata.go", + "model_inline_response_200_16.go", + "model_inline_response_200_16_data.go", + "model_inline_response_200_17.go", + "model_inline_response_200_18.go", + "model_inline_response_200_18_data.go", + "model_inline_response_200_19.go", + "model_inline_response_200_19_data.go", + "model_inline_response_200_1_data.go", + "model_inline_response_200_2.go", + "model_inline_response_200_20.go", + "model_inline_response_200_21.go", + "model_inline_response_200_22.go", + "model_inline_response_200_22_data.go", + "model_inline_response_200_2_data.go", + "model_inline_response_200_3.go", + "model_inline_response_200_3_data.go", + "model_inline_response_200_3_data_previous_justified.go", + "model_inline_response_200_4.go", + "model_inline_response_200_4_data.go", + "model_inline_response_200_4_validator.go", + "model_inline_response_200_5.go", + "model_inline_response_200_6.go", + "model_inline_response_200_6_data.go", + "model_inline_response_200_7.go", + "model_inline_response_200_7_data.go", + "model_inline_response_200_7_header.go", + "model_inline_response_200_8.go", + "model_inline_response_200_8_data.go", + "model_inline_response_200_9.go", + "model_inline_response_200_9_data.go", + "model_inline_response_200_data.go", + "model_network_identity.go", + "model_peer.go", + "model_proposer_slashing.go", + "model_signed_aggregate_and_proof.go", + "model_signed_beacon_block.go", + "model_signed_beacon_block_header.go", + "model_signed_voluntary_exit.go", + "model_validator_response.go", + "model_validator_status.go", + "response.go", + ], + importpath = "github.com/INFURA/eth2-comply/pkg/eth2spec", + visibility = ["//visibility:public"], + deps = [ + "@com_github_antihax_optional//:go_default_library", + "@org_golang_x_oauth2//:go_default_library", + ], +) diff --git a/pkg/eth2spec/README.md b/pkg/eth2spec/README.md new file mode 100644 index 0000000..5e3f7cd --- /dev/null +++ b/pkg/eth2spec/README.md @@ -0,0 +1,161 @@ +# Go API client for eth2spec + +API specification for the beacon node, which enables users to query and participate in Ethereum 2.0 phase 0 beacon chain. + +## Overview +This API client was generated by the [OpenAPI Generator](https://openapi-generator.tech) project. By using the [OpenAPI-spec](https://www.openapis.org/) from a remote server, you can easily generate an API client. + +- API version: Dev - Eth2Spec v0.11.1 +- Package version: 1.0.0 +- Build package: org.openapitools.codegen.languages.GoClientCodegen +For more information, please visit [https://github.com/ethereum/eth2.0-apis/issues](https://github.com/ethereum/eth2.0-apis/issues) + +## Installation + +Install the following dependencies: + +```shell +go get github.com/stretchr/testify/assert +go get golang.org/x/oauth2 +go get golang.org/x/net/context +go get github.com/antihax/optional +``` + +Put the package under your project folder and add the following in import: + +```golang +import "./eth2spec" +``` + +## Documentation for API Endpoints + +All URIs are relative to *http://public-mainnet-node.ethereum.org/api* + +Class | Method | HTTP request | Description +------------ | ------------- | ------------- | ------------- +*BeaconApi* | [**GetBlock**](docs/BeaconApi.md#getblock) | **Get** /v1/beacon/blocks/{block_id} | Get block +*BeaconApi* | [**GetBlockAttestations**](docs/BeaconApi.md#getblockattestations) | **Get** /v1/beacon/blocks/{block_id}/attestations | Get block attestations +*BeaconApi* | [**GetBlockHeader**](docs/BeaconApi.md#getblockheader) | **Get** /v1/beacon/headers/{block_id} | Get block header +*BeaconApi* | [**GetBlockHeaders**](docs/BeaconApi.md#getblockheaders) | **Get** /v1/beacon/headers | Get block headers +*BeaconApi* | [**GetBlockRoot**](docs/BeaconApi.md#getblockroot) | **Get** /v1/beacon/blocks/{block_id}/root | Get block root +*BeaconApi* | [**GetEpochCommittees**](docs/BeaconApi.md#getepochcommittees) | **Get** /v1/beacon/states/{state_id}/committees/{epoch} | Get all committees for epoch +*BeaconApi* | [**GetGenesis**](docs/BeaconApi.md#getgenesis) | **Get** /v1/beacon/genesis | Retrieve details of the chain's genesis. +*BeaconApi* | [**GetPoolAttestations**](docs/BeaconApi.md#getpoolattestations) | **Get** /v1/beacon/pool/attestations | Get Attestations from operations pool +*BeaconApi* | [**GetPoolAttesterSlashings**](docs/BeaconApi.md#getpoolattesterslashings) | **Get** /v1/beacon/pool/atttester_slashings | Get AttesterSlashings from operations pool +*BeaconApi* | [**GetPoolProposerSlashings**](docs/BeaconApi.md#getpoolproposerslashings) | **Get** /v1/beacon/pool/proposer_slashings | Get ProposerSlashings from operations pool +*BeaconApi* | [**GetPoolVoluntaryExits**](docs/BeaconApi.md#getpoolvoluntaryexits) | **Get** /v1/beacon/pool/voluntary_exits | Get SignedVoluntaryExit from operations pool +*BeaconApi* | [**GetStateFinalityCheckpoints**](docs/BeaconApi.md#getstatefinalitycheckpoints) | **Get** /v1/beacon/states/{state_id}/finality_checkpoints | Get state finality checkpoints +*BeaconApi* | [**GetStateFork**](docs/BeaconApi.md#getstatefork) | **Get** /v1/beacon/states/{state_id}/fork | Get Fork object for requested state +*BeaconApi* | [**GetStateRoot**](docs/BeaconApi.md#getstateroot) | **Get** /v1/beacon/states/{state_id}/root | Get state SSZ HashTreeRoot +*BeaconApi* | [**GetStateValidator**](docs/BeaconApi.md#getstatevalidator) | **Get** /v1/beacon/states/{state_id}/validators/{validator_id} | Get validator from state by id +*BeaconApi* | [**GetStateValidators**](docs/BeaconApi.md#getstatevalidators) | **Get** /v1/beacon/states/{state_id}/validators | Get validators from state +*BeaconApi* | [**SubmitPoolAttestations**](docs/BeaconApi.md#submitpoolattestations) | **Post** /v1/beacon/pool/attestations | Submit Attestation object to node +*BeaconApi* | [**SubmitPoolAttesterSlashings**](docs/BeaconApi.md#submitpoolattesterslashings) | **Post** /v1/beacon/pool/atttester_slashings | Submit AttesterSlashing object to node's pool +*BeaconApi* | [**SubmitPoolProposerSlashings**](docs/BeaconApi.md#submitpoolproposerslashings) | **Post** /v1/beacon/pool/proposer_slashings | Submit ProposerSlashing object to node's pool +*BeaconApi* | [**SubmitPoolVoluntaryExit**](docs/BeaconApi.md#submitpoolvoluntaryexit) | **Post** /v1/beacon/pool/voluntary_exits | Submit SignedVoluntaryExit object to node's pool +*ConfigApi* | [**GetDepositContract**](docs/ConfigApi.md#getdepositcontract) | **Get** /v1/config/deposit_contract | Get deposit contract address. +*ConfigApi* | [**GetForkSchedule**](docs/ConfigApi.md#getforkschedule) | **Get** /v1/config/fork_schedule | Get scheduled upcoming forks. +*ConfigApi* | [**GetSpec**](docs/ConfigApi.md#getspec) | **Get** /v1/config/spec | Get spec params. +*NodeApi* | [**GetHealth**](docs/NodeApi.md#gethealth) | **Get** /v1/node/health | Get health check +*NodeApi* | [**GetNetworkIdentity**](docs/NodeApi.md#getnetworkidentity) | **Get** /v1/node/identity | Get node network identity +*NodeApi* | [**GetNodeVersion**](docs/NodeApi.md#getnodeversion) | **Get** /v1/node/version | Get version string of the running beacon node. +*NodeApi* | [**GetPeer**](docs/NodeApi.md#getpeer) | **Get** /v1/node/peers/{peer_id} | Get peer +*NodeApi* | [**GetPeers**](docs/NodeApi.md#getpeers) | **Get** /v1/node/peers | Get node network peers +*NodeApi* | [**GetSyncingStatus**](docs/NodeApi.md#getsyncingstatus) | **Get** /v1/node/syncing | Get node syncing status +*ValidatorRequiredApiApi* | [**GetGenesis**](docs/ValidatorRequiredApiApi.md#getgenesis) | **Get** /v1/beacon/genesis | Retrieve details of the chain's genesis. +*ValidatorRequiredApiApi* | [**GetStateFork**](docs/ValidatorRequiredApiApi.md#getstatefork) | **Get** /v1/beacon/states/{state_id}/fork | Get Fork object for requested state +*ValidatorRequiredApiApi* | [**GetStateValidator**](docs/ValidatorRequiredApiApi.md#getstatevalidator) | **Get** /v1/beacon/states/{state_id}/validators/{validator_id} | Get validator from state by id +*ValidatorRequiredApiApi* | [**GetSyncingStatus**](docs/ValidatorRequiredApiApi.md#getsyncingstatus) | **Get** /v1/node/syncing | Get node syncing status +*ValidatorRequiredApiApi* | [**SubmitPoolAttestations**](docs/ValidatorRequiredApiApi.md#submitpoolattestations) | **Post** /v1/beacon/pool/attestations | Submit Attestation object to node + + +## Documentation For Models + + - [Attestation](docs/Attestation.md) + - [AttesterDuty](docs/AttesterDuty.md) + - [AttesterSlashing](docs/AttesterSlashing.md) + - [BeaconBlock](docs/BeaconBlock.md) + - [BeaconBlockAllOf](docs/BeaconBlockAllOf.md) + - [BeaconBlockAllOf1](docs/BeaconBlockAllOf1.md) + - [BeaconBlockAllOf1Body](docs/BeaconBlockAllOf1Body.md) + - [BeaconBlockAllOf1BodyData](docs/BeaconBlockAllOf1BodyData.md) + - [BeaconBlockAllOf1BodyDeposits](docs/BeaconBlockAllOf1BodyDeposits.md) + - [BeaconBlockAllOf1BodyEth1Data](docs/BeaconBlockAllOf1BodyEth1Data.md) + - [Checkpoint](docs/Checkpoint.md) + - [Committee](docs/Committee.md) + - [Fork](docs/Fork.md) + - [GenesisTime](docs/GenesisTime.md) + - [InlineObject](docs/InlineObject.md) + - [InlineObject1](docs/InlineObject1.md) + - [InlineObject2](docs/InlineObject2.md) + - [InlineObject3](docs/InlineObject3.md) + - [InlineResponse200](docs/InlineResponse200.md) + - [InlineResponse2001](docs/InlineResponse2001.md) + - [InlineResponse20010](docs/InlineResponse20010.md) + - [InlineResponse20010Data](docs/InlineResponse20010Data.md) + - [InlineResponse20011](docs/InlineResponse20011.md) + - [InlineResponse20011Data](docs/InlineResponse20011Data.md) + - [InlineResponse20011Data1](docs/InlineResponse20011Data1.md) + - [InlineResponse20012](docs/InlineResponse20012.md) + - [InlineResponse20012Attestation1](docs/InlineResponse20012Attestation1.md) + - [InlineResponse20012Data](docs/InlineResponse20012Data.md) + - [InlineResponse20013](docs/InlineResponse20013.md) + - [InlineResponse20013Data](docs/InlineResponse20013Data.md) + - [InlineResponse20014](docs/InlineResponse20014.md) + - [InlineResponse20014Data](docs/InlineResponse20014Data.md) + - [InlineResponse20014Message](docs/InlineResponse20014Message.md) + - [InlineResponse20015](docs/InlineResponse20015.md) + - [InlineResponse20015Data](docs/InlineResponse20015Data.md) + - [InlineResponse20015DataMetadata](docs/InlineResponse20015DataMetadata.md) + - [InlineResponse20016](docs/InlineResponse20016.md) + - [InlineResponse20016Data](docs/InlineResponse20016Data.md) + - [InlineResponse20017](docs/InlineResponse20017.md) + - [InlineResponse20018](docs/InlineResponse20018.md) + - [InlineResponse20018Data](docs/InlineResponse20018Data.md) + - [InlineResponse20019](docs/InlineResponse20019.md) + - [InlineResponse20019Data](docs/InlineResponse20019Data.md) + - [InlineResponse2001Data](docs/InlineResponse2001Data.md) + - [InlineResponse2002](docs/InlineResponse2002.md) + - [InlineResponse20020](docs/InlineResponse20020.md) + - [InlineResponse20021](docs/InlineResponse20021.md) + - [InlineResponse20022](docs/InlineResponse20022.md) + - [InlineResponse20022Data](docs/InlineResponse20022Data.md) + - [InlineResponse2002Data](docs/InlineResponse2002Data.md) + - [InlineResponse2003](docs/InlineResponse2003.md) + - [InlineResponse2003Data](docs/InlineResponse2003Data.md) + - [InlineResponse2003DataPreviousJustified](docs/InlineResponse2003DataPreviousJustified.md) + - [InlineResponse2004](docs/InlineResponse2004.md) + - [InlineResponse2004Data](docs/InlineResponse2004Data.md) + - [InlineResponse2004Validator](docs/InlineResponse2004Validator.md) + - [InlineResponse2005](docs/InlineResponse2005.md) + - [InlineResponse2006](docs/InlineResponse2006.md) + - [InlineResponse2006Data](docs/InlineResponse2006Data.md) + - [InlineResponse2007](docs/InlineResponse2007.md) + - [InlineResponse2007Data](docs/InlineResponse2007Data.md) + - [InlineResponse2007Header](docs/InlineResponse2007Header.md) + - [InlineResponse2008](docs/InlineResponse2008.md) + - [InlineResponse2008Data](docs/InlineResponse2008Data.md) + - [InlineResponse2009](docs/InlineResponse2009.md) + - [InlineResponse2009Data](docs/InlineResponse2009Data.md) + - [InlineResponse200Data](docs/InlineResponse200Data.md) + - [NetworkIdentity](docs/NetworkIdentity.md) + - [Peer](docs/Peer.md) + - [ProposerSlashing](docs/ProposerSlashing.md) + - [SignedAggregateAndProof](docs/SignedAggregateAndProof.md) + - [SignedBeaconBlock](docs/SignedBeaconBlock.md) + - [SignedBeaconBlockHeader](docs/SignedBeaconBlockHeader.md) + - [SignedVoluntaryExit](docs/SignedVoluntaryExit.md) + - [ValidatorResponse](docs/ValidatorResponse.md) + - [ValidatorStatus](docs/ValidatorStatus.md) + + +## Documentation For Authorization + + Endpoints do not require authorization. + + + +## Author + + + diff --git a/pkg/eth2spec/api/openapi.yaml b/pkg/eth2spec/api/openapi.yaml new file mode 100644 index 0000000..f1eee78 --- /dev/null +++ b/pkg/eth2spec/api/openapi.yaml @@ -0,0 +1,3486 @@ +openapi: 3.0.3 +info: + contact: + name: Ethereum Github + url: https://github.com/ethereum/eth2.0-apis/issues + description: API specification for the beacon node, which enables users to query + and participate in Ethereum 2.0 phase 0 beacon chain. + license: + name: Apache 2.0 + url: https://www.apache.org/licenses/LICENSE-2.0.html + title: Eth2 Beacon Node API + version: Dev - Eth2Spec v0.11.1 +servers: +- url: '{server_url}' + variables: + server_url: + default: http://public-mainnet-node.ethereum.org/api + description: Beacon node API url +tags: +- description: Set of endpoints to query beacon chain. + name: Beacon +- description: Endpoints to query chain configuration, specification, and fork schedules. + name: Config +- description: Endpoints to query node related informations + name: Node +- description: Endpoints intended for validator clients + name: Validator +- description: The minimal set of endpoints to enable a working validator implementation. + name: ValidatorRequiredApi +paths: + /v1/beacon/genesis: + get: + description: Retrieve details of the chain's genesis which can be used to identify + chain. + operationId: getGenesis + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/inline_response_200' + description: Request successful + "404": + description: Chain genesis info is not yet known + "500": + description: Beacon node internal error. + summary: Retrieve details of the chain's genesis. + tags: + - Beacon + - ValidatorRequiredApi + /v1/beacon/states/{state_id}/root: + get: + description: Calculates HashTreeRoot for state with given 'stateId'. If stateId + is root, same value will be returned. + operationId: getStateRoot + parameters: + - description: | + State identifier. + Can be one of: "head" (canonical head in node's view), "genesis", "finalized", "justified", \, \. + example: head + explode: false + in: path + name: state_id + required: true + schema: + type: string + style: simple + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/inline_response_200_1' + description: Success + "500": + description: Beacon node internal error. + summary: Get state SSZ HashTreeRoot + tags: + - Beacon + /v1/beacon/states/{state_id}/fork: + get: + description: Returns [Fork](https://github.com/ethereum/eth2.0-specs/blob/v0.11.1/specs/phase0/beacon-chain.md#fork) + object for state with given 'stateId'. + operationId: getStateFork + parameters: + - description: | + State identifier. + Can be one of: "head" (canonical head in node's view), "genesis", "finalized", "justified", \, \. + example: head + explode: false + in: path + name: state_id + required: true + schema: + type: string + style: simple + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/inline_response_200_2' + description: Success + "500": + description: Beacon node internal error. + summary: Get Fork object for requested state + tags: + - Beacon + - ValidatorRequiredApi + /v1/beacon/states/{state_id}/finality_checkpoints: + get: + description: | + Returns finality checkpoints for state with given 'stateId'. + In case finality is not yet achieved, checkpoint should return epoch 0 and ZERO_HASH as root. + operationId: getStateFinalityCheckpoints + parameters: + - description: | + State identifier. + Can be one of: "head" (canonical head in node's view), "genesis", "finalized", "justified", \, \. + example: head + explode: false + in: path + name: state_id + required: true + schema: + type: string + style: simple + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/inline_response_200_3' + description: Success + "500": + description: Beacon node internal error. + summary: Get state finality checkpoints + tags: + - Beacon + /v1/beacon/states/{state_id}/validators: + get: + description: Returns filterable list of validators with their balance, status + and index. + operationId: getStateValidators + parameters: + - description: | + State identifier. + Can be one of: "head" (canonical head in node's view), "genesis", "finalized", "justified", \, \. + example: head + explode: false + in: path + name: state_id + required: true + schema: + type: string + style: simple + - description: Either hex encoded public key (with 0x prefix) or validator index + explode: true + in: query + name: id + required: false + schema: + items: + description: Either hex encoded public key (with 0x prefix) or validator + index + type: string + maxItems: 30 + type: array + uniqueItems: true + style: form + - description: '[Validator status specification](https://hackmd.io/ofFJ5gOmQpu1jjHilHbdQQ)' + explode: true + in: query + name: status + required: false + schema: + items: + allOf: + - description: | + Possible statuses: + - **pending_initialized** - When the first deposit is processed, but not enough funds are available (or not yet the end of the first epoch) to get validator into the activation queue. + - **pending_queued** - When validator is waiting to get activated, and have enough funds etc. while in the queue, validator activation epoch keeps changing until it gets to the front and make it through (finalization is a requirement here too). + - **active_ongoing** - When validator must be attesting, and have not initiated any exit. + - **active_exiting** - When validator is still active, but filed a voluntary request to exit. + - **active_slashed** - When validator is still active, but have a slashed status and is scheduled to exit. + - **exited_unslashed** - When validator has reached reguler exit epoch, not being slashed, and doesn't have to attest any more, but cannot withdraw yet. + - **exited_slashed** - When validator has reached reguler exit epoch, but was slashed, have to wait for a longer withdrawal period. + - **withdrawal_possible** - After validator has exited, a while later is permitted to move funds, and is truly out of the system. + - **withdrawal_done** - (not possible in phase0, except slashing full balance) - actually having moved funds away + + [Validator status specification](https://hackmd.io/ofFJ5gOmQpu1jjHilHbdQQ) + enum: + - pending_initialized + - pending_queued + - active_ongoing + - active_exiting + - active_slashed + - exited_unslashed + - exited_slashed + - withdrawal_possible + - withdrawal_done + example: active_ongoing + type: string + - enum: + - active + - pending + - exited + - withdrawal + type: string + type: array + uniqueItems: true + style: form + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/inline_response_200_4' + description: Success + "500": + description: Beacon node internal error. + summary: Get validators from state + tags: + - Beacon + /v1/beacon/states/{state_id}/validators/{validator_id}: + get: + description: Returns validator specified by state and id or public key along + with status and balance. + operationId: getStateValidator + parameters: + - description: | + State identifier. + Can be one of: "head" (canonical head in node's view), "genesis", "finalized", "justified", \, \. + example: head + explode: false + in: path + name: state_id + required: true + schema: + type: string + style: simple + - description: Either hex encoded public key (with 0x prefix) or validator index + explode: false + in: path + name: validator_id + required: true + schema: + type: string + style: simple + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/inline_response_200_5' + description: Success + "404": + description: Validator doesn't exist. + "500": + description: Beacon node internal error. + summary: Get validator from state by id + tags: + - Beacon + - ValidatorRequiredApi + /v1/beacon/states/{state_id}/committees/{epoch}: + get: + description: Retrieves the committees for the given state at the given epoch. + operationId: getEpochCommittees + parameters: + - description: | + State identifier. + Can be one of: "head" (canonical head in node's view), "genesis", "finalized", "justified", \, \. + example: head + explode: false + in: path + name: state_id + required: true + schema: + type: string + style: simple + - description: Epoch for which to calculate committees. Defaults to beacon state + epoch. + explode: false + in: path + name: epoch + required: true + schema: + allOf: + - example: "1" + type: string + - {} + style: simple + - description: Committee index + explode: true + in: query + name: index + required: false + schema: + allOf: + - example: "1" + type: string + - {} + style: form + - explode: true + in: query + name: slot + required: false + schema: + allOf: + - example: "1" + type: string + - {} + style: form + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/inline_response_200_6' + description: Success + "400": + description: If slot doesn't belong in given epoch. + "500": + description: Beacon node internal error. + summary: Get all committees for epoch + tags: + - Beacon + /v1/beacon/headers: + get: + description: Retrieves block headers matching given query. By default it will + fetch current head slot blocks. + operationId: getBlockHeaders + parameters: + - explode: true + in: query + name: slot + required: false + schema: + allOf: + - example: "1" + type: string + - {} + style: form + - explode: true + in: query + name: parent_root + required: false + schema: + allOf: + - example: 0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2 + format: hex + pattern: ^0x[a-fA-F0-9]{64}$ + type: string + - {} + style: form + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/inline_response_200_7' + description: Success + "500": + description: Beacon node internal error. + summary: Get block headers + tags: + - Beacon + /v1/beacon/headers/{block_id}: + get: + description: Retrieves block header for given block id. + operationId: getBlockHeader + parameters: + - description: | + Block identifier. + Can be one of: "head" (canonical head in node's view), "genesis", "finalized", \, \. + example: head + explode: false + in: path + name: block_id + required: true + schema: + type: string + style: simple + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/inline_response_200_8' + description: Success + "404": + description: Block not found! + "500": + description: Beacon node internal error. + summary: Get block header + tags: + - Beacon + /v1/beacon/blocks/{block_id}: + get: + description: Retrieves block details for given block id. + operationId: getBlock + parameters: + - description: | + Block identifier. + Can be one of: "head" (canonical head in node's view), "genesis", "finalized", \, \. + example: head + explode: false + in: path + name: block_id + required: true + schema: + type: string + style: simple + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/inline_response_200_9' + description: Success + "404": + description: Block not found! + "500": + description: Beacon node internal error. + summary: Get block + tags: + - Beacon + /v1/beacon/blocks/{block_id}/root: + get: + description: Retrieves hashTreeRoot of BeaconBlock/BeaconBlockHeader + operationId: getBlockRoot + parameters: + - description: | + Block identifier. + Can be one of: "head" (canonical head in node's view), "genesis", "finalized", \, \. + example: head + explode: false + in: path + name: block_id + required: true + schema: + type: string + style: simple + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/inline_response_200_10' + description: Success + "404": + description: Block not found! + "500": + description: Beacon node internal error. + summary: Get block root + tags: + - Beacon + /v1/beacon/blocks/{block_id}/attestations: + get: + description: Retrieves attestation included in requested block. + operationId: getBlockAttestations + parameters: + - description: | + Block identifier. + Can be one of: "head" (canonical head in node's view), "genesis", "finalized", \, \. + example: head + explode: false + in: path + name: block_id + required: true + schema: + type: string + style: simple + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/inline_response_200_11' + description: Success + "500": + description: Beacon node internal error. + summary: Get block attestations + tags: + - Beacon + /v1/beacon/pool/attestations: + get: + description: Retrieves attestations known by the node but not necessarily incorporated + into any block + operationId: getPoolAttestations + parameters: + - explode: true + in: query + name: slot + required: false + schema: + example: "1" + type: string + style: form + - explode: true + in: query + name: committee_index + required: false + schema: + example: "1" + type: string + style: form + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/inline_response_200_11' + description: Successful response + "500": + description: Beacon node internal error. + summary: Get Attestations from operations pool + tags: + - Beacon + post: + description: Submits Attestation object to node. If attestation passes all validation + constraints, node MUST publish attestation on appropriate subnet. + operationId: submitPoolAttestations + requestBody: + $ref: '#/components/requestBodies/inline_object' + content: + application/json: + schema: + description: The [`Attestation`](https://github.com/ethereum/eth2.0-specs/blob/v0.11.1/specs/phase0/beacon-chain.md#attestation) + object from the Eth2.0 spec. + properties: + aggregation_bits: + description: Attester aggregation bits. + format: byte + pattern: ^0x[a-fA-F0-9]+$ + type: string + signature: + allOf: + - example: 0x1b66ac1fb663c9bc59509846d6ec05345bd908eda73e670af888da41af171505cc411d61252fb6cb3fa0017b679f8bb2305b26a285fa2737f175668d0dff91cc1b66ac1fb663c9bc59509846d6ec05345bd908eda73e670af888da41af171505 + format: bytes + pattern: ^0x[a-fA-F0-9]{192}$ + type: string + - description: BLS aggregate signature. + data: + $ref: '#/components/schemas/inline_response_200_11_data' + type: object + required: true + responses: + "200": + description: Attestation is stored in pool and broadcast on appropriate + subnet + "400": + description: Invalid attestation, it will never pass validation so it's + rejected + "500": + description: Beacon node internal error. + summary: Submit Attestation object to node + tags: + - Beacon + - ValidatorRequiredApi + /v1/beacon/pool/atttester_slashings: + get: + description: Retrieves attester slashings known by the node but not necessarily + incorporated into any block + operationId: getPoolAttesterSlashings + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/inline_response_200_12' + description: Successful response + "500": + description: Beacon node internal error. + summary: Get AttesterSlashings from operations pool + tags: + - Beacon + post: + description: Submits AttesterSlashing object to node's pool and if passes validation + node MUST broadcast it to network. + operationId: submitPoolAttesterSlashings + requestBody: + $ref: '#/components/requestBodies/inline_object_1' + content: + application/json: + schema: + description: The [`AttesterSlashing`](https://github.com/ethereum/eth2.0-specs/blob/v0.11.1/specs/core/0_beacon-chain.md#attesterslashing) + object from the Eth2.0 spec. + properties: + attestation_1: + $ref: '#/components/schemas/inline_response_200_12_attestation_1' + attestation_2: + $ref: '#/components/schemas/inline_response_200_12_attestation_1' + type: object + required: true + responses: + "200": + description: Success + "400": + description: Invalid attester slashing. [See attester_slashing topic validation](https://github.com/ethereum/eth2.0-specs/blob/v0.11.3/specs/phase0/p2p-interface.md#global-topics) + "500": + description: Beacon node internal error. + summary: Submit AttesterSlashing object to node's pool + tags: + - Beacon + /v1/beacon/pool/proposer_slashings: + get: + description: Retrieves proposer slashings known by the node but not necessarily + incorporated into any block + operationId: getPoolProposerSlashings + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/inline_response_200_13' + description: Successful response + "500": + description: Beacon node internal error. + summary: Get ProposerSlashings from operations pool + tags: + - Beacon + post: + description: Submits ProposerSlashing object to node's pool and if passes validation node + MUST broadcast it to network. + operationId: submitPoolProposerSlashings + requestBody: + $ref: '#/components/requestBodies/inline_object_2' + content: + application/json: + schema: + description: The [`ProposerSlashing`](https://github.com/ethereum/eth2.0-specs/blob/v0.11.1/specs/phase0/beacon-chain.md#proposerslashing) + object from the Eth2.0 spec. + properties: + signed_header_1: + $ref: '#/components/schemas/inline_response_200_7_header' + signed_header_2: + $ref: '#/components/schemas/inline_response_200_7_header' + type: object + required: true + responses: + "200": + description: Success + "400": + description: Invalid proposer slashing. [See proposer_slashing topic validation](https://github.com/ethereum/eth2.0-specs/blob/v0.11.3/specs/phase0/p2p-interface.md#global-topics) + "500": + description: Beacon node internal error. + summary: Submit ProposerSlashing object to node's pool + tags: + - Beacon + /v1/beacon/pool/voluntary_exits: + get: + description: Retrieves voluntary exits known by the node but not necessarily + incorporated into any block + operationId: getPoolVoluntaryExits + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/inline_response_200_14' + description: Successful response + "500": + description: Beacon node internal error. + summary: Get SignedVoluntaryExit from operations pool + tags: + - Beacon + post: + description: Submits SignedVoluntaryExit object to node's pool and if passes + validation node MUST broadcast it to network. + operationId: submitPoolVoluntaryExit + requestBody: + $ref: '#/components/requestBodies/inline_object_3' + content: + application/json: + schema: + description: The [`SignedVoluntaryExit`](https://github.com/ethereum/eth2.0-specs/blob/v0.11.1/specs/phase0/beacon-chain.md#signedvoluntaryexit) + object from the Eth2.0 spec. + properties: + message: + $ref: '#/components/schemas/inline_response_200_14_message' + signature: + example: 0x1b66ac1fb663c9bc59509846d6ec05345bd908eda73e670af888da41af171505cc411d61252fb6cb3fa0017b679f8bb2305b26a285fa2737f175668d0dff91cc1b66ac1fb663c9bc59509846d6ec05345bd908eda73e670af888da41af171505 + format: bytes + pattern: ^0x[a-fA-F0-9]{192}$ + type: string + type: object + required: true + responses: + "200": + description: Voluntary exit is stored in node and broadcasted to network + "400": + description: Invalid voluntary exit. + "500": + description: Beacon node internal error. + summary: Submit SignedVoluntaryExit object to node's pool + tags: + - Beacon + /v1/node/identity: + get: + description: Retrieves data about the node's network presence + operationId: getNetworkIdentity + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/inline_response_200_15' + description: Request successful + "500": + description: Beacon node internal error. + summary: Get node network identity + tags: + - Node + /v1/node/peers: + get: + description: Retrieves data about the node's network peers + operationId: getPeers + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/inline_response_200_16' + description: Request successful + "500": + description: Beacon node internal error. + summary: Get node network peers + tags: + - Node + /v1/node/peers/{peer_id}: + get: + description: Retrieves data about the given peer + operationId: getPeer + parameters: + - explode: false + in: path + name: peer_id + required: true + schema: + description: Cryptographic hash of a peer’s public key. [Read more](https://docs.libp2p.io/concepts/peer-id/) + example: QmYyQSo1c1Ym7orWxLYvCrM2EmxFTANf8wXmmE7DWjhx5N + type: string + style: simple + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/inline_response_200_17' + description: Request successful + "500": + description: Beacon node internal error. + summary: Get peer + tags: + - Node + /v1/node/version: + get: + description: Requests that the beacon node identify information about its implementation + in a format similar to a [HTTP User-Agent](https://tools.ietf.org/html/rfc7231#section-5.5.3) + field. + operationId: getNodeVersion + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/inline_response_200_18' + description: Request successful + "500": + description: Beacon node internal error. + summary: Get version string of the running beacon node. + tags: + - Node + /v1/node/syncing: + get: + description: Requests the beacon node to describe if it's currently syncing + or not, and if it is, what block it is up to. + operationId: getSyncingStatus + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/inline_response_200_19' + description: Request successful + "500": + description: Beacon node internal error. + summary: Get node syncing status + tags: + - Node + - ValidatorRequiredApi + /v1/node/health: + get: + description: Returns node health status in http status codes. Useful for load + balancers. + operationId: getHealth + responses: + "200": + description: Node is ready + "206": + description: Node is syncing but can serve incomplete data + "503": + description: Node not initialized or having issues + summary: Get health check + tags: + - Node + /v1/config/fork_schedule: + get: + description: Retrieve all scheduled upcoming forks this node is aware of. + operationId: getForkSchedule + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/inline_response_200_20' + description: Success + "500": + description: Beacon node internal error. + summary: Get scheduled upcoming forks. + tags: + - Config + /v1/config/spec: + get: + description: | + Retrieve specification configuration (without Phase 1 params) used on this node. + [Specification params list](https://github.com/ethereum/eth2.0-specs/blob/v0.11.1/configs/mainnet.yaml) + + Values are returned with following format: + - any value starting with 0x in the spec is returned as a hex string + - all other values are returned as number + operationId: getSpec + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/inline_response_200_21' + description: Success + "500": + description: Beacon node internal error. + summary: Get spec params. + tags: + - Config + /v1/config/deposit_contract: + get: + description: Retrieve deposit contract address and genesis fork version. + operationId: getDepositContract + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/inline_response_200_22' + description: Success + "500": + description: Beacon node internal error. + summary: Get deposit contract address. + tags: + - Config +components: + parameters: + StateId: + description: | + State identifier. + Can be one of: "head" (canonical head in node's view), "genesis", "finalized", "justified", \, \. + example: head + explode: false + in: path + name: state_id + required: true + schema: + type: string + style: simple + BlockId: + description: | + Block identifier. + Can be one of: "head" (canonical head in node's view), "genesis", "finalized", \, \. + example: head + explode: false + in: path + name: block_id + required: true + schema: + type: string + style: simple + requestBodies: + inline_object_1: + content: + application/json: + schema: + $ref: '#/components/schemas/inline_object_1' + required: true + inline_object: + content: + application/json: + schema: + $ref: '#/components/schemas/inline_object' + required: true + inline_object_3: + content: + application/json: + schema: + $ref: '#/components/schemas/inline_object_3' + required: true + inline_object_2: + content: + application/json: + schema: + $ref: '#/components/schemas/inline_object_2' + required: true + responses: + InvalidRequest: + description: Invalid request syntax. + InternalError: + description: Beacon node internal error. + NotFound: + description: Not found + CurrentlySyncing: + description: Beacon node is currently syncing, try again later. + schemas: + BeaconBlock: + allOf: + - $ref: '#/components/schemas/BeaconBlock_allOf' + - $ref: '#/components/schemas/BeaconBlock_allOf_1' + description: The [`BeaconBlock`](https://github.com/ethereum/eth2.0-specs/blob/v0.11.1/specs/phase0/beacon-chain.md#beaconblock) + object from the Eth2.0 spec. + SignedBeaconBlock: + description: The [`SignedBeaconBlock`](https://github.com/ethereum/eth2.0-specs/blob/v0.10.1/specs/phase0/beacon-chain.md#signedbeaconblock) + object envelope from the Eth2.0 spec. + properties: + message: + allOf: + - properties: + slot: + allOf: + - example: "1" + type: string + - description: The slot to which this block corresponds. + proposer_index: + allOf: + - example: "1" + type: string + - description: Index of validator in validator registry. + parent_root: + allOf: + - example: 0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2 + format: hex + pattern: ^0x[a-fA-F0-9]{64}$ + type: string + - description: The signing merkle root of the parent `BeaconBlock`. + state_root: + allOf: + - example: 0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2 + format: hex + pattern: ^0x[a-fA-F0-9]{64}$ + type: string + - description: The tree hash merkle root of the `BeaconState` for + the `BeaconBlock`. + type: object + - properties: + body: + description: The [`BeaconBlockBody`](https://github.com/ethereum/eth2.0-specs/blob/v0.11.1/specs/phase0/beacon-chain.md#beaconblockbody) + object from the Eth2.0 spec. + properties: + randao_reveal: + allOf: + - example: 0x1b66ac1fb663c9bc59509846d6ec05345bd908eda73e670af888da41af171505cc411d61252fb6cb3fa0017b679f8bb2305b26a285fa2737f175668d0dff91cc1b66ac1fb663c9bc59509846d6ec05345bd908eda73e670af888da41af171505 + format: bytes + pattern: ^0x[a-fA-F0-9]{192}$ + type: string + - description: The RanDAO reveal value provided by the validator. + eth1_data: + description: The [`Eth1Data`](https://github.com/ethereum/eth2.0-specs/blob/v0.11.1/specs/phase0/beacon-chain.md#eth1data) + object from the Eth2.0 spec. + properties: + deposit_root: + allOf: + - example: 0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2 + format: hex + pattern: ^0x[a-fA-F0-9]{64}$ + type: string + - description: Root of the deposit tree. + deposit_count: + allOf: + - example: "1" + type: string + - description: Total number of deposits. + block_hash: + allOf: + - example: 0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2 + format: hex + pattern: ^0x[a-fA-F0-9]{64}$ + type: string + - description: Ethereum 1.x block hash. + type: object + graffiti: + format: byte + pattern: ^0x[a-fA-F0-9]{64}$ + type: string + proposer_slashings: + items: + description: The [`ProposerSlashing`](https://github.com/ethereum/eth2.0-specs/blob/v0.11.1/specs/phase0/beacon-chain.md#proposerslashing) + object from the Eth2.0 spec. + properties: + signed_header_1: + description: The [`SignedBeaconBlockHeader`](https://github.com/ethereum/eth2.0-specs/blob/v0.11.1/specs/phase0/beacon-chain.md#signedbeaconblockheader) + object envelope from the Eth2.0 spec. + properties: + message: + allOf: + - properties: + slot: + allOf: + - example: "1" + type: string + - description: The slot to which this block corresponds. + proposer_index: + allOf: + - example: "1" + type: string + - description: Index of validator in validator + registry. + parent_root: + allOf: + - example: 0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2 + format: hex + pattern: ^0x[a-fA-F0-9]{64}$ + type: string + - description: The signing merkle root of the + parent `BeaconBlock`. + state_root: + allOf: + - example: 0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2 + format: hex + pattern: ^0x[a-fA-F0-9]{64}$ + type: string + - description: The tree hash merkle root of the + `BeaconState` for the `BeaconBlock`. + type: object + - properties: + body_root: + allOf: + - example: 0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2 + format: hex + pattern: ^0x[a-fA-F0-9]{64}$ + type: string + - description: The tree hash merkle root of the + `BeaconBlockBody` for the `BeaconBlock` + type: object + description: The [`BeaconBlockHeader`](https://github.com/ethereum/eth2.0-specs/blob/v0.11.1/specs/phase0/beacon-chain.md#beaconblockheader) + object from the Eth2.0 spec. + signature: + example: 0x1b66ac1fb663c9bc59509846d6ec05345bd908eda73e670af888da41af171505cc411d61252fb6cb3fa0017b679f8bb2305b26a285fa2737f175668d0dff91cc1b66ac1fb663c9bc59509846d6ec05345bd908eda73e670af888da41af171505 + format: bytes + pattern: ^0x[a-fA-F0-9]{192}$ + type: string + type: object + signed_header_2: + description: The [`SignedBeaconBlockHeader`](https://github.com/ethereum/eth2.0-specs/blob/v0.11.1/specs/phase0/beacon-chain.md#signedbeaconblockheader) + object envelope from the Eth2.0 spec. + properties: + message: + allOf: + - properties: + slot: + allOf: + - example: "1" + type: string + - description: The slot to which this block corresponds. + proposer_index: + allOf: + - example: "1" + type: string + - description: Index of validator in validator + registry. + parent_root: + allOf: + - example: 0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2 + format: hex + pattern: ^0x[a-fA-F0-9]{64}$ + type: string + - description: The signing merkle root of the + parent `BeaconBlock`. + state_root: + allOf: + - example: 0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2 + format: hex + pattern: ^0x[a-fA-F0-9]{64}$ + type: string + - description: The tree hash merkle root of the + `BeaconState` for the `BeaconBlock`. + type: object + - properties: + body_root: + allOf: + - example: 0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2 + format: hex + pattern: ^0x[a-fA-F0-9]{64}$ + type: string + - description: The tree hash merkle root of the + `BeaconBlockBody` for the `BeaconBlock` + type: object + description: The [`BeaconBlockHeader`](https://github.com/ethereum/eth2.0-specs/blob/v0.11.1/specs/phase0/beacon-chain.md#beaconblockheader) + object from the Eth2.0 spec. + signature: + example: 0x1b66ac1fb663c9bc59509846d6ec05345bd908eda73e670af888da41af171505cc411d61252fb6cb3fa0017b679f8bb2305b26a285fa2737f175668d0dff91cc1b66ac1fb663c9bc59509846d6ec05345bd908eda73e670af888da41af171505 + format: bytes + pattern: ^0x[a-fA-F0-9]{192}$ + type: string + type: object + type: object + type: array + attester_slashings: + items: + description: The [`AttesterSlashing`](https://github.com/ethereum/eth2.0-specs/blob/v0.11.1/specs/core/0_beacon-chain.md#attesterslashing) + object from the Eth2.0 spec. + properties: + attestation_1: + description: The [`IndexedAttestation`](https://github.com/ethereum/eth2.0-specs/blob/v0.11.1/specs/phase0/beacon-chain.md#indexedattestation) + object from the Eth2.0 spec. + properties: + attesting_indices: + description: Attesting validator indices + items: + example: "1" + type: string + maxItems: 2048 + type: array + signature: + allOf: + - example: 0x1b66ac1fb663c9bc59509846d6ec05345bd908eda73e670af888da41af171505cc411d61252fb6cb3fa0017b679f8bb2305b26a285fa2737f175668d0dff91cc1b66ac1fb663c9bc59509846d6ec05345bd908eda73e670af888da41af171505 + format: bytes + pattern: ^0x[a-fA-F0-9]{192}$ + type: string + - description: The BLS signature of the `IndexedAttestation`, + created by the validator of the attestation. + data: + description: The [`AttestationData`](https://github.com/ethereum/eth2.0-specs/blob/v0.11.1/specs/phase0/beacon-chain.md#attestationdata) + object from the Eth2.0 spec. + properties: + slot: + example: "1" + type: string + index: + example: "1" + type: string + beacon_block_root: + allOf: + - example: 0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2 + format: hex + pattern: ^0x[a-fA-F0-9]{64}$ + type: string + - description: LMD GHOST vote. + source: + description: The [`Checkpoint`](https://github.com/ethereum/eth2.0-specs/blob/v0.11.1/specs/phase0/beacon-chain.md#checkpoint + properties: + epoch: + example: "1" + type: string + root: + example: 0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2 + format: hex + pattern: ^0x[a-fA-F0-9]{64}$ + type: string + type: object + target: + description: The [`Checkpoint`](https://github.com/ethereum/eth2.0-specs/blob/v0.11.1/specs/phase0/beacon-chain.md#checkpoint + properties: + epoch: + example: "1" + type: string + root: + example: 0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2 + format: hex + pattern: ^0x[a-fA-F0-9]{64}$ + type: string + type: object + type: object + type: object + attestation_2: + description: The [`IndexedAttestation`](https://github.com/ethereum/eth2.0-specs/blob/v0.11.1/specs/phase0/beacon-chain.md#indexedattestation) + object from the Eth2.0 spec. + properties: + attesting_indices: + description: Attesting validator indices + items: + example: "1" + type: string + maxItems: 2048 + type: array + signature: + allOf: + - example: 0x1b66ac1fb663c9bc59509846d6ec05345bd908eda73e670af888da41af171505cc411d61252fb6cb3fa0017b679f8bb2305b26a285fa2737f175668d0dff91cc1b66ac1fb663c9bc59509846d6ec05345bd908eda73e670af888da41af171505 + format: bytes + pattern: ^0x[a-fA-F0-9]{192}$ + type: string + - description: The BLS signature of the `IndexedAttestation`, + created by the validator of the attestation. + data: + description: The [`AttestationData`](https://github.com/ethereum/eth2.0-specs/blob/v0.11.1/specs/phase0/beacon-chain.md#attestationdata) + object from the Eth2.0 spec. + properties: + slot: + example: "1" + type: string + index: + example: "1" + type: string + beacon_block_root: + allOf: + - example: 0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2 + format: hex + pattern: ^0x[a-fA-F0-9]{64}$ + type: string + - description: LMD GHOST vote. + source: + description: The [`Checkpoint`](https://github.com/ethereum/eth2.0-specs/blob/v0.11.1/specs/phase0/beacon-chain.md#checkpoint + properties: + epoch: + example: "1" + type: string + root: + example: 0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2 + format: hex + pattern: ^0x[a-fA-F0-9]{64}$ + type: string + type: object + target: + description: The [`Checkpoint`](https://github.com/ethereum/eth2.0-specs/blob/v0.11.1/specs/phase0/beacon-chain.md#checkpoint + properties: + epoch: + example: "1" + type: string + root: + example: 0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2 + format: hex + pattern: ^0x[a-fA-F0-9]{64}$ + type: string + type: object + type: object + type: object + type: object + type: array + attestations: + items: + description: The [`Attestation`](https://github.com/ethereum/eth2.0-specs/blob/v0.11.1/specs/phase0/beacon-chain.md#attestation) + object from the Eth2.0 spec. + properties: + aggregation_bits: + description: Attester aggregation bits. + format: byte + pattern: ^0x[a-fA-F0-9]+$ + type: string + signature: + allOf: + - example: 0x1b66ac1fb663c9bc59509846d6ec05345bd908eda73e670af888da41af171505cc411d61252fb6cb3fa0017b679f8bb2305b26a285fa2737f175668d0dff91cc1b66ac1fb663c9bc59509846d6ec05345bd908eda73e670af888da41af171505 + format: bytes + pattern: ^0x[a-fA-F0-9]{192}$ + type: string + - description: BLS aggregate signature. + data: + description: The [`AttestationData`](https://github.com/ethereum/eth2.0-specs/blob/v0.11.1/specs/phase0/beacon-chain.md#attestationdata) + object from the Eth2.0 spec. + properties: + slot: + example: "1" + type: string + index: + example: "1" + type: string + beacon_block_root: + allOf: + - example: 0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2 + format: hex + pattern: ^0x[a-fA-F0-9]{64}$ + type: string + - description: LMD GHOST vote. + source: + description: The [`Checkpoint`](https://github.com/ethereum/eth2.0-specs/blob/v0.11.1/specs/phase0/beacon-chain.md#checkpoint + properties: + epoch: + example: "1" + type: string + root: + example: 0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2 + format: hex + pattern: ^0x[a-fA-F0-9]{64}$ + type: string + type: object + target: + description: The [`Checkpoint`](https://github.com/ethereum/eth2.0-specs/blob/v0.11.1/specs/phase0/beacon-chain.md#checkpoint + properties: + epoch: + example: "1" + type: string + root: + example: 0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2 + format: hex + pattern: ^0x[a-fA-F0-9]{64}$ + type: string + type: object + type: object + type: object + type: array + deposits: + items: + description: The [`Deposit`](https://github.com/ethereum/eth2.0-specs/blob/v0.11.1/specs/phase0/beacon-chain.md#deposit) + object from the Eth2.0 spec. + properties: + proof: + description: Branch in the deposit tree. + items: + allOf: + - example: 0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2 + format: hex + pattern: ^0x[a-fA-F0-9]{64}$ + type: string + maxItems: 32 + minItems: 32 + type: array + data: + description: The [`DepositData`](https://github.com/ethereum/eth2.0-specs/blob/v0.11.1/specs/phase0/beacon-chain.md#depositdata) + object from the Eth2.0 spec. + properties: + pubkey: + description: The validator's BLS public key, uniquely + identifying them. _48-bytes, hex encoded with 0x prefix, + case insensitive._ + example: 0x93247f2209abcacf57b75a51dafae777f9dd38bc7053d1af526f220a7489a6d3a2753e5f3e8b1cfe39b56f43611df74a + pattern: ^0x[a-fA-F0-9]{96}$ + type: string + withdrawal_credentials: + allOf: + - example: 0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2 + format: hex + pattern: ^0x[a-fA-F0-9]{64}$ + type: string + - description: The withdrawal credentials. + amount: + allOf: + - example: "1" + type: string + - description: Amount in Gwei. + signature: + allOf: + - example: 0x1b66ac1fb663c9bc59509846d6ec05345bd908eda73e670af888da41af171505cc411d61252fb6cb3fa0017b679f8bb2305b26a285fa2737f175668d0dff91cc1b66ac1fb663c9bc59509846d6ec05345bd908eda73e670af888da41af171505 + format: bytes + pattern: ^0x[a-fA-F0-9]{192}$ + type: string + - description: Container self-signature. + type: object + type: object + type: array + voluntary_exits: + items: + description: The [`VoluntaryExit`](https://github.com/ethereum/eth2.0-specs/blob/v0.11.1/specs/phase0/beacon-chain.md#voluntaryexit) + object from the Eth2.0 spec. + properties: + epoch: + allOf: + - example: "1" + type: string + - description: Minimum epoch for processing exit. + validator_index: + allOf: + - example: "1" + type: string + - description: Index of the exiting validator. + type: object + type: array + type: object + type: object + description: The [`BeaconBlock`](https://github.com/ethereum/eth2.0-specs/blob/v0.11.1/specs/phase0/beacon-chain.md#beaconblock) + object from the Eth2.0 spec. + signature: + example: 0x1b66ac1fb663c9bc59509846d6ec05345bd908eda73e670af888da41af171505cc411d61252fb6cb3fa0017b679f8bb2305b26a285fa2737f175668d0dff91cc1b66ac1fb663c9bc59509846d6ec05345bd908eda73e670af888da41af171505 + format: bytes + pattern: ^0x[a-fA-F0-9]{192}$ + type: string + type: object + SignedBeaconBlockHeader: + description: The [`SignedBeaconBlockHeader`](https://github.com/ethereum/eth2.0-specs/blob/v0.11.1/specs/phase0/beacon-chain.md#signedbeaconblockheader) + object envelope from the Eth2.0 spec. + properties: + message: + allOf: + - properties: + slot: + allOf: + - example: "1" + type: string + - description: The slot to which this block corresponds. + proposer_index: + allOf: + - example: "1" + type: string + - description: Index of validator in validator registry. + parent_root: + allOf: + - example: 0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2 + format: hex + pattern: ^0x[a-fA-F0-9]{64}$ + type: string + - description: The signing merkle root of the parent `BeaconBlock`. + state_root: + allOf: + - example: 0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2 + format: hex + pattern: ^0x[a-fA-F0-9]{64}$ + type: string + - description: The tree hash merkle root of the `BeaconState` for + the `BeaconBlock`. + type: object + - properties: + body_root: + allOf: + - example: 0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2 + format: hex + pattern: ^0x[a-fA-F0-9]{64}$ + type: string + - description: The tree hash merkle root of the `BeaconBlockBody` + for the `BeaconBlock` + type: object + description: The [`BeaconBlockHeader`](https://github.com/ethereum/eth2.0-specs/blob/v0.11.1/specs/phase0/beacon-chain.md#beaconblockheader) + object from the Eth2.0 spec. + signature: + example: 0x1b66ac1fb663c9bc59509846d6ec05345bd908eda73e670af888da41af171505cc411d61252fb6cb3fa0017b679f8bb2305b26a285fa2737f175668d0dff91cc1b66ac1fb663c9bc59509846d6ec05345bd908eda73e670af888da41af171505 + format: bytes + pattern: ^0x[a-fA-F0-9]{192}$ + type: string + type: object + ValidatorResponse: + properties: + index: + allOf: + - example: "1" + type: string + - description: Index of validator in validator registry. + balance: + allOf: + - example: "1" + type: string + - description: Current validator balance in gwei. + status: + description: | + Possible statuses: + - **pending_initialized** - When the first deposit is processed, but not enough funds are available (or not yet the end of the first epoch) to get validator into the activation queue. + - **pending_queued** - When validator is waiting to get activated, and have enough funds etc. while in the queue, validator activation epoch keeps changing until it gets to the front and make it through (finalization is a requirement here too). + - **active_ongoing** - When validator must be attesting, and have not initiated any exit. + - **active_exiting** - When validator is still active, but filed a voluntary request to exit. + - **active_slashed** - When validator is still active, but have a slashed status and is scheduled to exit. + - **exited_unslashed** - When validator has reached reguler exit epoch, not being slashed, and doesn't have to attest any more, but cannot withdraw yet. + - **exited_slashed** - When validator has reached reguler exit epoch, but was slashed, have to wait for a longer withdrawal period. + - **withdrawal_possible** - After validator has exited, a while later is permitted to move funds, and is truly out of the system. + - **withdrawal_done** - (not possible in phase0, except slashing full balance) - actually having moved funds away + + [Validator status specification](https://hackmd.io/ofFJ5gOmQpu1jjHilHbdQQ) + enum: + - pending_initialized + - pending_queued + - active_ongoing + - active_exiting + - active_slashed + - exited_unslashed + - exited_slashed + - withdrawal_possible + - withdrawal_done + example: active_ongoing + type: string + validator: + $ref: '#/components/schemas/inline_response_200_4_validator' + type: object + ValidatorStatus: + description: | + Possible statuses: + - **pending_initialized** - When the first deposit is processed, but not enough funds are available (or not yet the end of the first epoch) to get validator into the activation queue. + - **pending_queued** - When validator is waiting to get activated, and have enough funds etc. while in the queue, validator activation epoch keeps changing until it gets to the front and make it through (finalization is a requirement here too). + - **active_ongoing** - When validator must be attesting, and have not initiated any exit. + - **active_exiting** - When validator is still active, but filed a voluntary request to exit. + - **active_slashed** - When validator is still active, but have a slashed status and is scheduled to exit. + - **exited_unslashed** - When validator has reached reguler exit epoch, not being slashed, and doesn't have to attest any more, but cannot withdraw yet. + - **exited_slashed** - When validator has reached reguler exit epoch, but was slashed, have to wait for a longer withdrawal period. + - **withdrawal_possible** - After validator has exited, a while later is permitted to move funds, and is truly out of the system. + - **withdrawal_done** - (not possible in phase0, except slashing full balance) - actually having moved funds away + + [Validator status specification](https://hackmd.io/ofFJ5gOmQpu1jjHilHbdQQ) + enum: + - pending_initialized + - pending_queued + - active_ongoing + - active_exiting + - active_slashed + - exited_unslashed + - exited_slashed + - withdrawal_possible + - withdrawal_done + example: active_ongoing + type: string + Committee: + description: Group of validators assigned to attest at specific slot and that + have the same committee index (shard in phase 1) + properties: + index: + allOf: + - example: "1" + type: string + - description: Committee index at a slot + slot: + example: "1" + type: string + validators: + description: List of validator indices assigned to this committee + items: + example: "1" + type: string + type: array + type: object + AttesterSlashing: + description: The [`AttesterSlashing`](https://github.com/ethereum/eth2.0-specs/blob/v0.11.1/specs/core/0_beacon-chain.md#attesterslashing) + object from the Eth2.0 spec. + properties: + attestation_1: + $ref: '#/components/schemas/inline_response_200_12_attestation_1' + attestation_2: + $ref: '#/components/schemas/inline_response_200_12_attestation_1' + type: object + ProposerSlashing: + description: The [`ProposerSlashing`](https://github.com/ethereum/eth2.0-specs/blob/v0.11.1/specs/phase0/beacon-chain.md#proposerslashing) + object from the Eth2.0 spec. + properties: + signed_header_1: + $ref: '#/components/schemas/inline_response_200_7_header' + signed_header_2: + $ref: '#/components/schemas/inline_response_200_7_header' + type: object + SignedVoluntaryExit: + description: The [`SignedVoluntaryExit`](https://github.com/ethereum/eth2.0-specs/blob/v0.11.1/specs/phase0/beacon-chain.md#signedvoluntaryexit) + object from the Eth2.0 spec. + properties: + message: + $ref: '#/components/schemas/inline_response_200_14_message' + signature: + example: 0x1b66ac1fb663c9bc59509846d6ec05345bd908eda73e670af888da41af171505cc411d61252fb6cb3fa0017b679f8bb2305b26a285fa2737f175668d0dff91cc1b66ac1fb663c9bc59509846d6ec05345bd908eda73e670af888da41af171505 + format: bytes + pattern: ^0x[a-fA-F0-9]{192}$ + type: string + type: object + AttesterDuty: + properties: + validator_pubkey: + description: The validator's BLS public key, uniquely identifying them. + _48-bytes, hex encoded with 0x prefix, case insensitive._ + example: 0x93247f2209abcacf57b75a51dafae777f9dd38bc7053d1af526f220a7489a6d3a2753e5f3e8b1cfe39b56f43611df74a + pattern: ^0x[a-fA-F0-9]{96}$ + type: string + aggregator_modulo: + allOf: + - example: "1" + type: string + - description: Value which validator can use to calculate is_aggregator + (aka bytes_to_int(hash(slot_signature)[0:8]) % aggregator_modulo == + 0) + attestation_slot: + allOf: + - example: "1" + type: string + - description: The slot at which the validator must attest. + committee_index: + allOf: + - example: "1" + type: string + - description: The committee index + type: object + SignedAggregateAndProof: + properties: + message: + allOf: + - description: The [`AggregateAndProof`](https://github.com/ethereum/eth2.0-specs/blob/v0.9.2/specs/validator/0_beacon-chain-validator.md#aggregateandproof) + without selection_proof + properties: + aggregator_index: + example: "1" + type: string + attestation: + description: The [`Attestation`](https://github.com/ethereum/eth2.0-specs/blob/v0.11.1/specs/phase0/beacon-chain.md#attestation) + object from the Eth2.0 spec. + properties: + aggregation_bits: + description: Attester aggregation bits. + format: byte + pattern: ^0x[a-fA-F0-9]+$ + type: string + signature: + allOf: + - example: 0x1b66ac1fb663c9bc59509846d6ec05345bd908eda73e670af888da41af171505cc411d61252fb6cb3fa0017b679f8bb2305b26a285fa2737f175668d0dff91cc1b66ac1fb663c9bc59509846d6ec05345bd908eda73e670af888da41af171505 + format: bytes + pattern: ^0x[a-fA-F0-9]{192}$ + type: string + - description: BLS aggregate signature. + data: + description: The [`AttestationData`](https://github.com/ethereum/eth2.0-specs/blob/v0.11.1/specs/phase0/beacon-chain.md#attestationdata) + object from the Eth2.0 spec. + properties: + slot: + example: "1" + type: string + index: + example: "1" + type: string + beacon_block_root: + allOf: + - example: 0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2 + format: hex + pattern: ^0x[a-fA-F0-9]{64}$ + type: string + - description: LMD GHOST vote. + source: + description: The [`Checkpoint`](https://github.com/ethereum/eth2.0-specs/blob/v0.11.1/specs/phase0/beacon-chain.md#checkpoint + properties: + epoch: + example: "1" + type: string + root: + example: 0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2 + format: hex + pattern: ^0x[a-fA-F0-9]{64}$ + type: string + type: object + target: + description: The [`Checkpoint`](https://github.com/ethereum/eth2.0-specs/blob/v0.11.1/specs/phase0/beacon-chain.md#checkpoint + properties: + epoch: + example: "1" + type: string + root: + example: 0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2 + format: hex + pattern: ^0x[a-fA-F0-9]{64}$ + type: string + type: object + type: object + type: object + type: object + - properties: + selection_proof: + example: 0x1b66ac1fb663c9bc59509846d6ec05345bd908eda73e670af888da41af171505cc411d61252fb6cb3fa0017b679f8bb2305b26a285fa2737f175668d0dff91cc1b66ac1fb663c9bc59509846d6ec05345bd908eda73e670af888da41af171505 + format: bytes + pattern: ^0x[a-fA-F0-9]{192}$ + type: string + type: object + signature: + example: 0x1b66ac1fb663c9bc59509846d6ec05345bd908eda73e670af888da41af171505cc411d61252fb6cb3fa0017b679f8bb2305b26a285fa2737f175668d0dff91cc1b66ac1fb663c9bc59509846d6ec05345bd908eda73e670af888da41af171505 + format: bytes + pattern: ^0x[a-fA-F0-9]{192}$ + type: string + Attestation: + description: The [`Attestation`](https://github.com/ethereum/eth2.0-specs/blob/v0.11.1/specs/phase0/beacon-chain.md#attestation) + object from the Eth2.0 spec. + properties: + aggregation_bits: + description: Attester aggregation bits. + format: byte + pattern: ^0x[a-fA-F0-9]+$ + type: string + signature: + allOf: + - example: 0x1b66ac1fb663c9bc59509846d6ec05345bd908eda73e670af888da41af171505cc411d61252fb6cb3fa0017b679f8bb2305b26a285fa2737f175668d0dff91cc1b66ac1fb663c9bc59509846d6ec05345bd908eda73e670af888da41af171505 + format: bytes + pattern: ^0x[a-fA-F0-9]{192}$ + type: string + - description: BLS aggregate signature. + data: + $ref: '#/components/schemas/inline_response_200_11_data' + type: object + Fork: + description: The [`Fork`](https://github.com/ethereum/eth2.0-specs/blob/v0.11.1/specs/phase0/beacon-chain.md#fork) + object from the Eth2.0 spec. + properties: + previous_version: + description: a fork version number + example: 0x00000000 + pattern: ^0x[a-fA-F0-9]{8}$ + type: string + current_version: + description: a fork version number + example: 0x00000000 + pattern: ^0x[a-fA-F0-9]{8}$ + type: string + epoch: + example: "1" + type: string + type: object + Checkpoint: + description: The [`Checkpoint`](https://github.com/ethereum/eth2.0-specs/blob/v0.11.1/specs/phase0/beacon-chain.md#checkpoint + properties: + epoch: + example: "1" + type: string + root: + example: 0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2 + format: hex + pattern: ^0x[a-fA-F0-9]{64}$ + type: string + type: object + PublicKey: + description: The validator's BLS public key, uniquely identifying them. _48-bytes, + hex encoded with 0x prefix, case insensitive._ + example: 0x93247f2209abcacf57b75a51dafae777f9dd38bc7053d1af526f220a7489a6d3a2753e5f3e8b1cfe39b56f43611df74a + pattern: ^0x[a-fA-F0-9]{96}$ + type: string + Uint64: + example: "1" + type: string + NetworkIdentity: + properties: + peer_id: + description: Cryptographic hash of a peer’s public key. [Read more](https://docs.libp2p.io/concepts/peer-id/) + example: QmYyQSo1c1Ym7orWxLYvCrM2EmxFTANf8wXmmE7DWjhx5N + type: string + enr: + description: Ethereum node record. [Read more](https://eips.ethereum.org/EIPS/eip-778) + example: enr:-IS4QHCYrYZbAKWCBRlAy5zzaDZXJBGkcnh4MHcBFZntXNFrdvJjX04jRzjzCBOonrkTfj499SZuOh8R33Ls8RRcy5wBgmlkgnY0gmlwhH8AAAGJc2VjcDI1NmsxoQPKY0yuDUmstAHYpMa2_oxVtw0RW_QAdpzBQA8yWM0xOIN1ZHCCdl8 + type: string + p2p_addresses: + items: + allOf: + - description: '[Read more](https://docs.libp2p.io/reference/glossary/#multiaddr)' + example: /ip4/7.7.7.7/tcp/4242/p2p/QmYyQSo1c1Ym7orWxLYvCrM2EmxFTANf8wXmmE7DWjhx5N + type: string + - description: Node's addresses on which eth2 rpc requests are served. + [Read more](https://docs.libp2p.io/reference/glossary/#multiaddr) + type: array + discovery_addresses: + items: + allOf: + - description: '[Read more](https://docs.libp2p.io/reference/glossary/#multiaddr)' + example: /ip4/7.7.7.7/tcp/4242/p2p/QmYyQSo1c1Ym7orWxLYvCrM2EmxFTANf8wXmmE7DWjhx5N + type: string + - description: Node's addresses on which is listening for discv5 requests. + [Read more](https://docs.libp2p.io/reference/glossary/#multiaddr) + type: array + metadata: + $ref: '#/components/schemas/inline_response_200_15_data_metadata' + type: object + Peer: + properties: + peer_id: + description: Cryptographic hash of a peer’s public key. [Read more](https://docs.libp2p.io/concepts/peer-id/) + example: QmYyQSo1c1Ym7orWxLYvCrM2EmxFTANf8wXmmE7DWjhx5N + type: string + enr: + description: Ethereum node record. [Read more](https://eips.ethereum.org/EIPS/eip-778) + example: enr:-IS4QHCYrYZbAKWCBRlAy5zzaDZXJBGkcnh4MHcBFZntXNFrdvJjX04jRzjzCBOonrkTfj499SZuOh8R33Ls8RRcy5wBgmlkgnY0gmlwhH8AAAGJc2VjcDI1NmsxoQPKY0yuDUmstAHYpMa2_oxVtw0RW_QAdpzBQA8yWM0xOIN1ZHCCdl8 + type: string + address: + description: '[Read more](https://docs.libp2p.io/reference/glossary/#multiaddr)' + example: /ip4/7.7.7.7/tcp/4242/p2p/QmYyQSo1c1Ym7orWxLYvCrM2EmxFTANf8wXmmE7DWjhx5N + type: string + state: + enum: + - disconnected + - connecting + - connected + - disconnecting + type: string + direction: + enum: + - inbound + - outbound + type: string + type: object + PeerId: + description: Cryptographic hash of a peer’s public key. [Read more](https://docs.libp2p.io/concepts/peer-id/) + example: QmYyQSo1c1Ym7orWxLYvCrM2EmxFTANf8wXmmE7DWjhx5N + type: string + GenesisTime: + allOf: + - example: "1" + type: string + - example: "1590832934" + - description: The genesis_time configured for the beacon node, which is the + unix time in seconds at which the Eth2.0 chain began. + Version: + description: A string which uniquely identifies the client implementation and + its version; similar to [HTTP User-Agent](https://tools.ietf.org/html/rfc7231#section-5.5.3). + example: Lighthouse / v0.1.5 (Linux x86_64) + type: string + ForkVersion: + description: a fork version number + example: 0x00000000 + pattern: ^0x[a-fA-F0-9]{8}$ + type: string + Root: + example: 0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2 + format: hex + pattern: ^0x[a-fA-F0-9]{64}$ + type: string + Hex: + example: 0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2 + format: hex + pattern: ^0x[a-fA-F0-9]{64}$ + type: string + Signature: + example: 0x1b66ac1fb663c9bc59509846d6ec05345bd908eda73e670af888da41af171505cc411d61252fb6cb3fa0017b679f8bb2305b26a285fa2737f175668d0dff91cc1b66ac1fb663c9bc59509846d6ec05345bd908eda73e670af888da41af171505 + format: bytes + pattern: ^0x[a-fA-F0-9]{192}$ + type: string + inline_response_200_data: + example: + genesis_time: "" + genesis_validators_root: 0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2 + genesis_fork_version: 0x00000000 + properties: + genesis_time: + allOf: + - example: "1" + type: string + - example: "1590832934" + - description: The genesis_time configured for the beacon node, which is + the unix time in seconds at which the Eth2.0 chain began. + genesis_validators_root: + example: 0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2 + format: hex + pattern: ^0x[a-fA-F0-9]{64}$ + type: string + genesis_fork_version: + description: a fork version number + example: 0x00000000 + pattern: ^0x[a-fA-F0-9]{8}$ + type: string + inline_response_200: + example: + data: + genesis_time: "" + genesis_validators_root: 0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2 + genesis_fork_version: 0x00000000 + properties: + data: + $ref: '#/components/schemas/inline_response_200_data' + inline_response_200_1_data: + example: + root: "" + properties: + root: + allOf: + - description: HashTreeRoot of BeaconState object + - example: 0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2 + format: hex + pattern: ^0x[a-fA-F0-9]{64}$ + type: string + inline_response_200_1: + example: + data: + root: "" + properties: + data: + $ref: '#/components/schemas/inline_response_200_1_data' + inline_response_200_2_data: + description: The [`Fork`](https://github.com/ethereum/eth2.0-specs/blob/v0.11.1/specs/phase0/beacon-chain.md#fork) + object from the Eth2.0 spec. + example: + previous_version: 0x00000000 + current_version: 0x00000000 + epoch: "1" + properties: + previous_version: + description: a fork version number + example: 0x00000000 + pattern: ^0x[a-fA-F0-9]{8}$ + type: string + current_version: + description: a fork version number + example: 0x00000000 + pattern: ^0x[a-fA-F0-9]{8}$ + type: string + epoch: + example: "1" + type: string + inline_response_200_2: + example: + data: + previous_version: 0x00000000 + current_version: 0x00000000 + epoch: "1" + properties: + data: + $ref: '#/components/schemas/inline_response_200_2_data' + inline_response_200_3_data_previous_justified: + description: The [`Checkpoint`](https://github.com/ethereum/eth2.0-specs/blob/v0.11.1/specs/phase0/beacon-chain.md#checkpoint + example: + root: 0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2 + epoch: "1" + properties: + epoch: + example: "1" + type: string + root: + example: 0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2 + format: hex + pattern: ^0x[a-fA-F0-9]{64}$ + type: string + inline_response_200_3_data: + example: + finalized: + root: 0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2 + epoch: "1" + previous_justified: + root: 0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2 + epoch: "1" + current_justified: + root: 0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2 + epoch: "1" + properties: + previous_justified: + $ref: '#/components/schemas/inline_response_200_3_data_previous_justified' + current_justified: + $ref: '#/components/schemas/inline_response_200_3_data_previous_justified' + finalized: + $ref: '#/components/schemas/inline_response_200_3_data_previous_justified' + inline_response_200_3: + example: + data: + finalized: + root: 0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2 + epoch: "1" + previous_justified: + root: 0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2 + epoch: "1" + current_justified: + root: 0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2 + epoch: "1" + properties: + data: + $ref: '#/components/schemas/inline_response_200_3_data' + inline_response_200_4_validator: + example: + withdrawable_epoch: "" + exit_epoch: "" + slashed: false + effective_balance: "" + activation_eligibility_epoch: "" + pubkey: 0x93247f2209abcacf57b75a51dafae777f9dd38bc7053d1af526f220a7489a6d3a2753e5f3e8b1cfe39b56f43611df74a + withdrawal_credentials: "" + activation_epoch: "" + properties: + pubkey: + description: The validator's BLS public key, uniquely identifying them. + _48-bytes, hex encoded with 0x prefix, case insensitive._ + example: 0x93247f2209abcacf57b75a51dafae777f9dd38bc7053d1af526f220a7489a6d3a2753e5f3e8b1cfe39b56f43611df74a + pattern: ^0x[a-fA-F0-9]{96}$ + type: string + withdrawal_credentials: + allOf: + - example: 0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2 + format: hex + pattern: ^0x[a-fA-F0-9]{64}$ + type: string + - description: Root of withdrawal credentials + effective_balance: + allOf: + - example: "1" + type: string + - description: Balance at stake in Gwei. + slashed: + description: Was validator slashed (not longer active). + example: false + type: boolean + activation_eligibility_epoch: + allOf: + - example: "1" + type: string + - description: When criteria for activation were met. + activation_epoch: + allOf: + - example: "1" + type: string + - description: Epoch when validator activated. 'FAR_FUTURE_EPOCH' if not + activated + exit_epoch: + allOf: + - example: "1" + type: string + - description: Epoch when validator exited. 'FAR_FUTURE_EPOCH' if not exited. + withdrawable_epoch: + allOf: + - example: "1" + type: string + - description: When validator can withdraw or transfer funds. 'FAR_FUTURE_EPOCH' + if not defined + inline_response_200_4_data: + example: + balance: "" + validator: + withdrawable_epoch: "" + exit_epoch: "" + slashed: false + effective_balance: "" + activation_eligibility_epoch: "" + pubkey: 0x93247f2209abcacf57b75a51dafae777f9dd38bc7053d1af526f220a7489a6d3a2753e5f3e8b1cfe39b56f43611df74a + withdrawal_credentials: "" + activation_epoch: "" + index: "" + status: active_ongoing + properties: + index: + allOf: + - example: "1" + type: string + - description: Index of validator in validator registry. + balance: + allOf: + - example: "1" + type: string + - description: Current validator balance in gwei. + status: + description: | + Possible statuses: + - **pending_initialized** - When the first deposit is processed, but not enough funds are available (or not yet the end of the first epoch) to get validator into the activation queue. + - **pending_queued** - When validator is waiting to get activated, and have enough funds etc. while in the queue, validator activation epoch keeps changing until it gets to the front and make it through (finalization is a requirement here too). + - **active_ongoing** - When validator must be attesting, and have not initiated any exit. + - **active_exiting** - When validator is still active, but filed a voluntary request to exit. + - **active_slashed** - When validator is still active, but have a slashed status and is scheduled to exit. + - **exited_unslashed** - When validator has reached reguler exit epoch, not being slashed, and doesn't have to attest any more, but cannot withdraw yet. + - **exited_slashed** - When validator has reached reguler exit epoch, but was slashed, have to wait for a longer withdrawal period. + - **withdrawal_possible** - After validator has exited, a while later is permitted to move funds, and is truly out of the system. + - **withdrawal_done** - (not possible in phase0, except slashing full balance) - actually having moved funds away + + [Validator status specification](https://hackmd.io/ofFJ5gOmQpu1jjHilHbdQQ) + enum: + - pending_initialized + - pending_queued + - active_ongoing + - active_exiting + - active_slashed + - exited_unslashed + - exited_slashed + - withdrawal_possible + - withdrawal_done + example: active_ongoing + type: string + validator: + $ref: '#/components/schemas/inline_response_200_4_validator' + inline_response_200_4: + example: + data: + - balance: "" + validator: + withdrawable_epoch: "" + exit_epoch: "" + slashed: false + effective_balance: "" + activation_eligibility_epoch: "" + pubkey: 0x93247f2209abcacf57b75a51dafae777f9dd38bc7053d1af526f220a7489a6d3a2753e5f3e8b1cfe39b56f43611df74a + withdrawal_credentials: "" + activation_epoch: "" + index: "" + status: active_ongoing + - balance: "" + validator: + withdrawable_epoch: "" + exit_epoch: "" + slashed: false + effective_balance: "" + activation_eligibility_epoch: "" + pubkey: 0x93247f2209abcacf57b75a51dafae777f9dd38bc7053d1af526f220a7489a6d3a2753e5f3e8b1cfe39b56f43611df74a + withdrawal_credentials: "" + activation_epoch: "" + index: "" + status: active_ongoing + properties: + data: + items: + $ref: '#/components/schemas/inline_response_200_4_data' + type: array + inline_response_200_5: + example: + data: + balance: "" + validator: + withdrawable_epoch: "" + exit_epoch: "" + slashed: false + effective_balance: "" + activation_eligibility_epoch: "" + pubkey: 0x93247f2209abcacf57b75a51dafae777f9dd38bc7053d1af526f220a7489a6d3a2753e5f3e8b1cfe39b56f43611df74a + withdrawal_credentials: "" + activation_epoch: "" + index: "" + status: active_ongoing + properties: + data: + $ref: '#/components/schemas/inline_response_200_4_data' + inline_response_200_6_data: + description: Group of validators assigned to attest at specific slot and that + have the same committee index (shard in phase 1) + example: + validators: + - "1" + - "1" + index: "" + slot: "1" + properties: + index: + allOf: + - example: "1" + type: string + - description: Committee index at a slot + slot: + example: "1" + type: string + validators: + description: List of validator indices assigned to this committee + items: + example: "1" + type: string + type: array + inline_response_200_6: + example: + data: + - validators: + - "1" + - "1" + index: "" + slot: "1" + - validators: + - "1" + - "1" + index: "" + slot: "1" + properties: + data: + items: + $ref: '#/components/schemas/inline_response_200_6_data' + type: array + inline_response_200_7_header: + description: The [`SignedBeaconBlockHeader`](https://github.com/ethereum/eth2.0-specs/blob/v0.11.1/specs/phase0/beacon-chain.md#signedbeaconblockheader) + object envelope from the Eth2.0 spec. + example: + signature: 0x1b66ac1fb663c9bc59509846d6ec05345bd908eda73e670af888da41af171505cc411d61252fb6cb3fa0017b679f8bb2305b26a285fa2737f175668d0dff91cc1b66ac1fb663c9bc59509846d6ec05345bd908eda73e670af888da41af171505 + message: "" + properties: + message: + allOf: + - properties: + slot: + allOf: + - example: "1" + type: string + - description: The slot to which this block corresponds. + proposer_index: + allOf: + - example: "1" + type: string + - description: Index of validator in validator registry. + parent_root: + allOf: + - example: 0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2 + format: hex + pattern: ^0x[a-fA-F0-9]{64}$ + type: string + - description: The signing merkle root of the parent `BeaconBlock`. + state_root: + allOf: + - example: 0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2 + format: hex + pattern: ^0x[a-fA-F0-9]{64}$ + type: string + - description: The tree hash merkle root of the `BeaconState` for + the `BeaconBlock`. + type: object + - properties: + body_root: + allOf: + - example: 0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2 + format: hex + pattern: ^0x[a-fA-F0-9]{64}$ + type: string + - description: The tree hash merkle root of the `BeaconBlockBody` + for the `BeaconBlock` + type: object + description: The [`BeaconBlockHeader`](https://github.com/ethereum/eth2.0-specs/blob/v0.11.1/specs/phase0/beacon-chain.md#beaconblockheader) + object from the Eth2.0 spec. + signature: + example: 0x1b66ac1fb663c9bc59509846d6ec05345bd908eda73e670af888da41af171505cc411d61252fb6cb3fa0017b679f8bb2305b26a285fa2737f175668d0dff91cc1b66ac1fb663c9bc59509846d6ec05345bd908eda73e670af888da41af171505 + format: bytes + pattern: ^0x[a-fA-F0-9]{192}$ + type: string + inline_response_200_7_data: + example: + root: 0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2 + header: + signature: 0x1b66ac1fb663c9bc59509846d6ec05345bd908eda73e670af888da41af171505cc411d61252fb6cb3fa0017b679f8bb2305b26a285fa2737f175668d0dff91cc1b66ac1fb663c9bc59509846d6ec05345bd908eda73e670af888da41af171505 + message: "" + canonical: true + properties: + root: + example: 0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2 + format: hex + pattern: ^0x[a-fA-F0-9]{64}$ + type: string + canonical: + type: boolean + header: + $ref: '#/components/schemas/inline_response_200_7_header' + inline_response_200_7: + example: + data: + - root: 0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2 + header: + signature: 0x1b66ac1fb663c9bc59509846d6ec05345bd908eda73e670af888da41af171505cc411d61252fb6cb3fa0017b679f8bb2305b26a285fa2737f175668d0dff91cc1b66ac1fb663c9bc59509846d6ec05345bd908eda73e670af888da41af171505 + message: "" + canonical: true + - root: 0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2 + header: + signature: 0x1b66ac1fb663c9bc59509846d6ec05345bd908eda73e670af888da41af171505cc411d61252fb6cb3fa0017b679f8bb2305b26a285fa2737f175668d0dff91cc1b66ac1fb663c9bc59509846d6ec05345bd908eda73e670af888da41af171505 + message: "" + canonical: true + properties: + data: + items: + $ref: '#/components/schemas/inline_response_200_7_data' + type: array + inline_response_200_8_data: + example: + header: + signature: 0x1b66ac1fb663c9bc59509846d6ec05345bd908eda73e670af888da41af171505cc411d61252fb6cb3fa0017b679f8bb2305b26a285fa2737f175668d0dff91cc1b66ac1fb663c9bc59509846d6ec05345bd908eda73e670af888da41af171505 + message: "" + canonical: true + properties: + canonical: + type: boolean + header: + $ref: '#/components/schemas/inline_response_200_7_header' + inline_response_200_8: + example: + data: + header: + signature: 0x1b66ac1fb663c9bc59509846d6ec05345bd908eda73e670af888da41af171505cc411d61252fb6cb3fa0017b679f8bb2305b26a285fa2737f175668d0dff91cc1b66ac1fb663c9bc59509846d6ec05345bd908eda73e670af888da41af171505 + message: "" + canonical: true + properties: + data: + $ref: '#/components/schemas/inline_response_200_8_data' + inline_response_200_9_data: + description: The [`SignedBeaconBlock`](https://github.com/ethereum/eth2.0-specs/blob/v0.10.1/specs/phase0/beacon-chain.md#signedbeaconblock) + object envelope from the Eth2.0 spec. + example: + signature: 0x1b66ac1fb663c9bc59509846d6ec05345bd908eda73e670af888da41af171505cc411d61252fb6cb3fa0017b679f8bb2305b26a285fa2737f175668d0dff91cc1b66ac1fb663c9bc59509846d6ec05345bd908eda73e670af888da41af171505 + message: "" + properties: + message: + allOf: + - properties: + slot: + allOf: + - example: "1" + type: string + - description: The slot to which this block corresponds. + proposer_index: + allOf: + - example: "1" + type: string + - description: Index of validator in validator registry. + parent_root: + allOf: + - example: 0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2 + format: hex + pattern: ^0x[a-fA-F0-9]{64}$ + type: string + - description: The signing merkle root of the parent `BeaconBlock`. + state_root: + allOf: + - example: 0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2 + format: hex + pattern: ^0x[a-fA-F0-9]{64}$ + type: string + - description: The tree hash merkle root of the `BeaconState` for + the `BeaconBlock`. + type: object + - properties: + body: + description: The [`BeaconBlockBody`](https://github.com/ethereum/eth2.0-specs/blob/v0.11.1/specs/phase0/beacon-chain.md#beaconblockbody) + object from the Eth2.0 spec. + properties: + randao_reveal: + allOf: + - example: 0x1b66ac1fb663c9bc59509846d6ec05345bd908eda73e670af888da41af171505cc411d61252fb6cb3fa0017b679f8bb2305b26a285fa2737f175668d0dff91cc1b66ac1fb663c9bc59509846d6ec05345bd908eda73e670af888da41af171505 + format: bytes + pattern: ^0x[a-fA-F0-9]{192}$ + type: string + - description: The RanDAO reveal value provided by the validator. + eth1_data: + description: The [`Eth1Data`](https://github.com/ethereum/eth2.0-specs/blob/v0.11.1/specs/phase0/beacon-chain.md#eth1data) + object from the Eth2.0 spec. + properties: + deposit_root: + allOf: + - example: 0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2 + format: hex + pattern: ^0x[a-fA-F0-9]{64}$ + type: string + - description: Root of the deposit tree. + deposit_count: + allOf: + - example: "1" + type: string + - description: Total number of deposits. + block_hash: + allOf: + - example: 0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2 + format: hex + pattern: ^0x[a-fA-F0-9]{64}$ + type: string + - description: Ethereum 1.x block hash. + type: object + graffiti: + format: byte + pattern: ^0x[a-fA-F0-9]{64}$ + type: string + proposer_slashings: + items: + description: The [`ProposerSlashing`](https://github.com/ethereum/eth2.0-specs/blob/v0.11.1/specs/phase0/beacon-chain.md#proposerslashing) + object from the Eth2.0 spec. + properties: + signed_header_1: + description: The [`SignedBeaconBlockHeader`](https://github.com/ethereum/eth2.0-specs/blob/v0.11.1/specs/phase0/beacon-chain.md#signedbeaconblockheader) + object envelope from the Eth2.0 spec. + properties: + message: + allOf: + - properties: + slot: + allOf: + - example: "1" + type: string + - description: The slot to which this block corresponds. + proposer_index: + allOf: + - example: "1" + type: string + - description: Index of validator in validator + registry. + parent_root: + allOf: + - example: 0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2 + format: hex + pattern: ^0x[a-fA-F0-9]{64}$ + type: string + - description: The signing merkle root of the + parent `BeaconBlock`. + state_root: + allOf: + - example: 0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2 + format: hex + pattern: ^0x[a-fA-F0-9]{64}$ + type: string + - description: The tree hash merkle root of the + `BeaconState` for the `BeaconBlock`. + type: object + - properties: + body_root: + allOf: + - example: 0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2 + format: hex + pattern: ^0x[a-fA-F0-9]{64}$ + type: string + - description: The tree hash merkle root of the + `BeaconBlockBody` for the `BeaconBlock` + type: object + description: The [`BeaconBlockHeader`](https://github.com/ethereum/eth2.0-specs/blob/v0.11.1/specs/phase0/beacon-chain.md#beaconblockheader) + object from the Eth2.0 spec. + signature: + example: 0x1b66ac1fb663c9bc59509846d6ec05345bd908eda73e670af888da41af171505cc411d61252fb6cb3fa0017b679f8bb2305b26a285fa2737f175668d0dff91cc1b66ac1fb663c9bc59509846d6ec05345bd908eda73e670af888da41af171505 + format: bytes + pattern: ^0x[a-fA-F0-9]{192}$ + type: string + type: object + signed_header_2: + description: The [`SignedBeaconBlockHeader`](https://github.com/ethereum/eth2.0-specs/blob/v0.11.1/specs/phase0/beacon-chain.md#signedbeaconblockheader) + object envelope from the Eth2.0 spec. + properties: + message: + allOf: + - properties: + slot: + allOf: + - example: "1" + type: string + - description: The slot to which this block corresponds. + proposer_index: + allOf: + - example: "1" + type: string + - description: Index of validator in validator + registry. + parent_root: + allOf: + - example: 0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2 + format: hex + pattern: ^0x[a-fA-F0-9]{64}$ + type: string + - description: The signing merkle root of the + parent `BeaconBlock`. + state_root: + allOf: + - example: 0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2 + format: hex + pattern: ^0x[a-fA-F0-9]{64}$ + type: string + - description: The tree hash merkle root of the + `BeaconState` for the `BeaconBlock`. + type: object + - properties: + body_root: + allOf: + - example: 0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2 + format: hex + pattern: ^0x[a-fA-F0-9]{64}$ + type: string + - description: The tree hash merkle root of the + `BeaconBlockBody` for the `BeaconBlock` + type: object + description: The [`BeaconBlockHeader`](https://github.com/ethereum/eth2.0-specs/blob/v0.11.1/specs/phase0/beacon-chain.md#beaconblockheader) + object from the Eth2.0 spec. + signature: + example: 0x1b66ac1fb663c9bc59509846d6ec05345bd908eda73e670af888da41af171505cc411d61252fb6cb3fa0017b679f8bb2305b26a285fa2737f175668d0dff91cc1b66ac1fb663c9bc59509846d6ec05345bd908eda73e670af888da41af171505 + format: bytes + pattern: ^0x[a-fA-F0-9]{192}$ + type: string + type: object + type: object + type: array + attester_slashings: + items: + description: The [`AttesterSlashing`](https://github.com/ethereum/eth2.0-specs/blob/v0.11.1/specs/core/0_beacon-chain.md#attesterslashing) + object from the Eth2.0 spec. + properties: + attestation_1: + description: The [`IndexedAttestation`](https://github.com/ethereum/eth2.0-specs/blob/v0.11.1/specs/phase0/beacon-chain.md#indexedattestation) + object from the Eth2.0 spec. + properties: + attesting_indices: + description: Attesting validator indices + items: + example: "1" + type: string + maxItems: 2048 + type: array + signature: + allOf: + - example: 0x1b66ac1fb663c9bc59509846d6ec05345bd908eda73e670af888da41af171505cc411d61252fb6cb3fa0017b679f8bb2305b26a285fa2737f175668d0dff91cc1b66ac1fb663c9bc59509846d6ec05345bd908eda73e670af888da41af171505 + format: bytes + pattern: ^0x[a-fA-F0-9]{192}$ + type: string + - description: The BLS signature of the `IndexedAttestation`, + created by the validator of the attestation. + data: + description: The [`AttestationData`](https://github.com/ethereum/eth2.0-specs/blob/v0.11.1/specs/phase0/beacon-chain.md#attestationdata) + object from the Eth2.0 spec. + properties: + slot: + example: "1" + type: string + index: + example: "1" + type: string + beacon_block_root: + allOf: + - example: 0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2 + format: hex + pattern: ^0x[a-fA-F0-9]{64}$ + type: string + - description: LMD GHOST vote. + source: + description: The [`Checkpoint`](https://github.com/ethereum/eth2.0-specs/blob/v0.11.1/specs/phase0/beacon-chain.md#checkpoint + properties: + epoch: + example: "1" + type: string + root: + example: 0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2 + format: hex + pattern: ^0x[a-fA-F0-9]{64}$ + type: string + type: object + target: + description: The [`Checkpoint`](https://github.com/ethereum/eth2.0-specs/blob/v0.11.1/specs/phase0/beacon-chain.md#checkpoint + properties: + epoch: + example: "1" + type: string + root: + example: 0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2 + format: hex + pattern: ^0x[a-fA-F0-9]{64}$ + type: string + type: object + type: object + type: object + attestation_2: + description: The [`IndexedAttestation`](https://github.com/ethereum/eth2.0-specs/blob/v0.11.1/specs/phase0/beacon-chain.md#indexedattestation) + object from the Eth2.0 spec. + properties: + attesting_indices: + description: Attesting validator indices + items: + example: "1" + type: string + maxItems: 2048 + type: array + signature: + allOf: + - example: 0x1b66ac1fb663c9bc59509846d6ec05345bd908eda73e670af888da41af171505cc411d61252fb6cb3fa0017b679f8bb2305b26a285fa2737f175668d0dff91cc1b66ac1fb663c9bc59509846d6ec05345bd908eda73e670af888da41af171505 + format: bytes + pattern: ^0x[a-fA-F0-9]{192}$ + type: string + - description: The BLS signature of the `IndexedAttestation`, + created by the validator of the attestation. + data: + description: The [`AttestationData`](https://github.com/ethereum/eth2.0-specs/blob/v0.11.1/specs/phase0/beacon-chain.md#attestationdata) + object from the Eth2.0 spec. + properties: + slot: + example: "1" + type: string + index: + example: "1" + type: string + beacon_block_root: + allOf: + - example: 0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2 + format: hex + pattern: ^0x[a-fA-F0-9]{64}$ + type: string + - description: LMD GHOST vote. + source: + description: The [`Checkpoint`](https://github.com/ethereum/eth2.0-specs/blob/v0.11.1/specs/phase0/beacon-chain.md#checkpoint + properties: + epoch: + example: "1" + type: string + root: + example: 0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2 + format: hex + pattern: ^0x[a-fA-F0-9]{64}$ + type: string + type: object + target: + description: The [`Checkpoint`](https://github.com/ethereum/eth2.0-specs/blob/v0.11.1/specs/phase0/beacon-chain.md#checkpoint + properties: + epoch: + example: "1" + type: string + root: + example: 0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2 + format: hex + pattern: ^0x[a-fA-F0-9]{64}$ + type: string + type: object + type: object + type: object + type: object + type: array + attestations: + items: + description: The [`Attestation`](https://github.com/ethereum/eth2.0-specs/blob/v0.11.1/specs/phase0/beacon-chain.md#attestation) + object from the Eth2.0 spec. + properties: + aggregation_bits: + description: Attester aggregation bits. + format: byte + pattern: ^0x[a-fA-F0-9]+$ + type: string + signature: + allOf: + - example: 0x1b66ac1fb663c9bc59509846d6ec05345bd908eda73e670af888da41af171505cc411d61252fb6cb3fa0017b679f8bb2305b26a285fa2737f175668d0dff91cc1b66ac1fb663c9bc59509846d6ec05345bd908eda73e670af888da41af171505 + format: bytes + pattern: ^0x[a-fA-F0-9]{192}$ + type: string + - description: BLS aggregate signature. + data: + description: The [`AttestationData`](https://github.com/ethereum/eth2.0-specs/blob/v0.11.1/specs/phase0/beacon-chain.md#attestationdata) + object from the Eth2.0 spec. + properties: + slot: + example: "1" + type: string + index: + example: "1" + type: string + beacon_block_root: + allOf: + - example: 0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2 + format: hex + pattern: ^0x[a-fA-F0-9]{64}$ + type: string + - description: LMD GHOST vote. + source: + description: The [`Checkpoint`](https://github.com/ethereum/eth2.0-specs/blob/v0.11.1/specs/phase0/beacon-chain.md#checkpoint + properties: + epoch: + example: "1" + type: string + root: + example: 0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2 + format: hex + pattern: ^0x[a-fA-F0-9]{64}$ + type: string + type: object + target: + description: The [`Checkpoint`](https://github.com/ethereum/eth2.0-specs/blob/v0.11.1/specs/phase0/beacon-chain.md#checkpoint + properties: + epoch: + example: "1" + type: string + root: + example: 0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2 + format: hex + pattern: ^0x[a-fA-F0-9]{64}$ + type: string + type: object + type: object + type: object + type: array + deposits: + items: + description: The [`Deposit`](https://github.com/ethereum/eth2.0-specs/blob/v0.11.1/specs/phase0/beacon-chain.md#deposit) + object from the Eth2.0 spec. + properties: + proof: + description: Branch in the deposit tree. + items: + allOf: + - example: 0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2 + format: hex + pattern: ^0x[a-fA-F0-9]{64}$ + type: string + maxItems: 32 + minItems: 32 + type: array + data: + description: The [`DepositData`](https://github.com/ethereum/eth2.0-specs/blob/v0.11.1/specs/phase0/beacon-chain.md#depositdata) + object from the Eth2.0 spec. + properties: + pubkey: + description: The validator's BLS public key, uniquely + identifying them. _48-bytes, hex encoded with 0x prefix, + case insensitive._ + example: 0x93247f2209abcacf57b75a51dafae777f9dd38bc7053d1af526f220a7489a6d3a2753e5f3e8b1cfe39b56f43611df74a + pattern: ^0x[a-fA-F0-9]{96}$ + type: string + withdrawal_credentials: + allOf: + - example: 0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2 + format: hex + pattern: ^0x[a-fA-F0-9]{64}$ + type: string + - description: The withdrawal credentials. + amount: + allOf: + - example: "1" + type: string + - description: Amount in Gwei. + signature: + allOf: + - example: 0x1b66ac1fb663c9bc59509846d6ec05345bd908eda73e670af888da41af171505cc411d61252fb6cb3fa0017b679f8bb2305b26a285fa2737f175668d0dff91cc1b66ac1fb663c9bc59509846d6ec05345bd908eda73e670af888da41af171505 + format: bytes + pattern: ^0x[a-fA-F0-9]{192}$ + type: string + - description: Container self-signature. + type: object + type: object + type: array + voluntary_exits: + items: + description: The [`VoluntaryExit`](https://github.com/ethereum/eth2.0-specs/blob/v0.11.1/specs/phase0/beacon-chain.md#voluntaryexit) + object from the Eth2.0 spec. + properties: + epoch: + allOf: + - example: "1" + type: string + - description: Minimum epoch for processing exit. + validator_index: + allOf: + - example: "1" + type: string + - description: Index of the exiting validator. + type: object + type: array + type: object + type: object + description: The [`BeaconBlock`](https://github.com/ethereum/eth2.0-specs/blob/v0.11.1/specs/phase0/beacon-chain.md#beaconblock) + object from the Eth2.0 spec. + signature: + example: 0x1b66ac1fb663c9bc59509846d6ec05345bd908eda73e670af888da41af171505cc411d61252fb6cb3fa0017b679f8bb2305b26a285fa2737f175668d0dff91cc1b66ac1fb663c9bc59509846d6ec05345bd908eda73e670af888da41af171505 + format: bytes + pattern: ^0x[a-fA-F0-9]{192}$ + type: string + inline_response_200_9: + example: + data: + signature: 0x1b66ac1fb663c9bc59509846d6ec05345bd908eda73e670af888da41af171505cc411d61252fb6cb3fa0017b679f8bb2305b26a285fa2737f175668d0dff91cc1b66ac1fb663c9bc59509846d6ec05345bd908eda73e670af888da41af171505 + message: "" + properties: + data: + $ref: '#/components/schemas/inline_response_200_9_data' + inline_response_200_10_data: + example: + root: "" + properties: + root: + allOf: + - description: HashTreeRoot of BeaconBlock/BeaconBlockHeader object + - example: 0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2 + format: hex + pattern: ^0x[a-fA-F0-9]{64}$ + type: string + inline_response_200_10: + example: + data: + root: "" + properties: + data: + $ref: '#/components/schemas/inline_response_200_10_data' + inline_response_200_11_data: + description: The [`AttestationData`](https://github.com/ethereum/eth2.0-specs/blob/v0.11.1/specs/phase0/beacon-chain.md#attestationdata) + object from the Eth2.0 spec. + example: + beacon_block_root: "" + index: "1" + slot: "1" + source: + root: 0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2 + epoch: "1" + target: + root: 0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2 + epoch: "1" + properties: + slot: + example: "1" + type: string + index: + example: "1" + type: string + beacon_block_root: + allOf: + - example: 0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2 + format: hex + pattern: ^0x[a-fA-F0-9]{64}$ + type: string + - description: LMD GHOST vote. + source: + $ref: '#/components/schemas/inline_response_200_3_data_previous_justified' + target: + $ref: '#/components/schemas/inline_response_200_3_data_previous_justified' + inline_response_200_11_data_1: + description: The [`Attestation`](https://github.com/ethereum/eth2.0-specs/blob/v0.11.1/specs/phase0/beacon-chain.md#attestation) + object from the Eth2.0 spec. + example: + data: + beacon_block_root: "" + index: "1" + slot: "1" + source: + root: 0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2 + epoch: "1" + target: + root: 0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2 + epoch: "1" + signature: "" + aggregation_bits: aggregation_bits + properties: + aggregation_bits: + description: Attester aggregation bits. + format: byte + pattern: ^0x[a-fA-F0-9]+$ + type: string + signature: + allOf: + - example: 0x1b66ac1fb663c9bc59509846d6ec05345bd908eda73e670af888da41af171505cc411d61252fb6cb3fa0017b679f8bb2305b26a285fa2737f175668d0dff91cc1b66ac1fb663c9bc59509846d6ec05345bd908eda73e670af888da41af171505 + format: bytes + pattern: ^0x[a-fA-F0-9]{192}$ + type: string + - description: BLS aggregate signature. + data: + $ref: '#/components/schemas/inline_response_200_11_data' + inline_response_200_11: + example: + data: + - data: + beacon_block_root: "" + index: "1" + slot: "1" + source: + root: 0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2 + epoch: "1" + target: + root: 0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2 + epoch: "1" + signature: "" + aggregation_bits: aggregation_bits + - data: + beacon_block_root: "" + index: "1" + slot: "1" + source: + root: 0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2 + epoch: "1" + target: + root: 0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2 + epoch: "1" + signature: "" + aggregation_bits: aggregation_bits + properties: + data: + items: + $ref: '#/components/schemas/inline_response_200_11_data_1' + type: array + inline_object: + description: The [`Attestation`](https://github.com/ethereum/eth2.0-specs/blob/v0.11.1/specs/phase0/beacon-chain.md#attestation) + object from the Eth2.0 spec. + properties: + aggregation_bits: + description: Attester aggregation bits. + format: byte + pattern: ^0x[a-fA-F0-9]+$ + type: string + signature: + allOf: + - example: 0x1b66ac1fb663c9bc59509846d6ec05345bd908eda73e670af888da41af171505cc411d61252fb6cb3fa0017b679f8bb2305b26a285fa2737f175668d0dff91cc1b66ac1fb663c9bc59509846d6ec05345bd908eda73e670af888da41af171505 + format: bytes + pattern: ^0x[a-fA-F0-9]{192}$ + type: string + - description: BLS aggregate signature. + data: + $ref: '#/components/schemas/inline_response_200_11_data' + type: object + inline_response_200_12_attestation_1: + description: The [`IndexedAttestation`](https://github.com/ethereum/eth2.0-specs/blob/v0.11.1/specs/phase0/beacon-chain.md#indexedattestation) + object from the Eth2.0 spec. + example: + attesting_indices: + - "1" + - "1" + - "1" + - "1" + - "1" + data: + beacon_block_root: "" + index: "1" + slot: "1" + source: + root: 0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2 + epoch: "1" + target: + root: 0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2 + epoch: "1" + signature: "" + properties: + attesting_indices: + description: Attesting validator indices + items: + example: "1" + type: string + maxItems: 2048 + type: array + signature: + allOf: + - example: 0x1b66ac1fb663c9bc59509846d6ec05345bd908eda73e670af888da41af171505cc411d61252fb6cb3fa0017b679f8bb2305b26a285fa2737f175668d0dff91cc1b66ac1fb663c9bc59509846d6ec05345bd908eda73e670af888da41af171505 + format: bytes + pattern: ^0x[a-fA-F0-9]{192}$ + type: string + - description: The BLS signature of the `IndexedAttestation`, created by + the validator of the attestation. + data: + $ref: '#/components/schemas/inline_response_200_11_data' + inline_response_200_12_data: + description: The [`AttesterSlashing`](https://github.com/ethereum/eth2.0-specs/blob/v0.11.1/specs/core/0_beacon-chain.md#attesterslashing) + object from the Eth2.0 spec. + example: + attestation_2: + attesting_indices: + - "1" + - "1" + - "1" + - "1" + - "1" + data: + beacon_block_root: "" + index: "1" + slot: "1" + source: + root: 0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2 + epoch: "1" + target: + root: 0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2 + epoch: "1" + signature: "" + attestation_1: + attesting_indices: + - "1" + - "1" + - "1" + - "1" + - "1" + data: + beacon_block_root: "" + index: "1" + slot: "1" + source: + root: 0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2 + epoch: "1" + target: + root: 0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2 + epoch: "1" + signature: "" + properties: + attestation_1: + $ref: '#/components/schemas/inline_response_200_12_attestation_1' + attestation_2: + $ref: '#/components/schemas/inline_response_200_12_attestation_1' + inline_response_200_12: + example: + data: + - attestation_2: + attesting_indices: + - "1" + - "1" + - "1" + - "1" + - "1" + data: + beacon_block_root: "" + index: "1" + slot: "1" + source: + root: 0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2 + epoch: "1" + target: + root: 0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2 + epoch: "1" + signature: "" + attestation_1: + attesting_indices: + - "1" + - "1" + - "1" + - "1" + - "1" + data: + beacon_block_root: "" + index: "1" + slot: "1" + source: + root: 0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2 + epoch: "1" + target: + root: 0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2 + epoch: "1" + signature: "" + - attestation_2: + attesting_indices: + - "1" + - "1" + - "1" + - "1" + - "1" + data: + beacon_block_root: "" + index: "1" + slot: "1" + source: + root: 0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2 + epoch: "1" + target: + root: 0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2 + epoch: "1" + signature: "" + attestation_1: + attesting_indices: + - "1" + - "1" + - "1" + - "1" + - "1" + data: + beacon_block_root: "" + index: "1" + slot: "1" + source: + root: 0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2 + epoch: "1" + target: + root: 0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2 + epoch: "1" + signature: "" + properties: + data: + items: + $ref: '#/components/schemas/inline_response_200_12_data' + type: array + inline_object_1: + description: The [`AttesterSlashing`](https://github.com/ethereum/eth2.0-specs/blob/v0.11.1/specs/core/0_beacon-chain.md#attesterslashing) + object from the Eth2.0 spec. + properties: + attestation_1: + $ref: '#/components/schemas/inline_response_200_12_attestation_1' + attestation_2: + $ref: '#/components/schemas/inline_response_200_12_attestation_1' + type: object + inline_response_200_13_data: + description: The [`ProposerSlashing`](https://github.com/ethereum/eth2.0-specs/blob/v0.11.1/specs/phase0/beacon-chain.md#proposerslashing) + object from the Eth2.0 spec. + example: + signed_header_2: + signature: 0x1b66ac1fb663c9bc59509846d6ec05345bd908eda73e670af888da41af171505cc411d61252fb6cb3fa0017b679f8bb2305b26a285fa2737f175668d0dff91cc1b66ac1fb663c9bc59509846d6ec05345bd908eda73e670af888da41af171505 + message: "" + signed_header_1: + signature: 0x1b66ac1fb663c9bc59509846d6ec05345bd908eda73e670af888da41af171505cc411d61252fb6cb3fa0017b679f8bb2305b26a285fa2737f175668d0dff91cc1b66ac1fb663c9bc59509846d6ec05345bd908eda73e670af888da41af171505 + message: "" + properties: + signed_header_1: + $ref: '#/components/schemas/inline_response_200_7_header' + signed_header_2: + $ref: '#/components/schemas/inline_response_200_7_header' + inline_response_200_13: + example: + data: + - signed_header_2: + signature: 0x1b66ac1fb663c9bc59509846d6ec05345bd908eda73e670af888da41af171505cc411d61252fb6cb3fa0017b679f8bb2305b26a285fa2737f175668d0dff91cc1b66ac1fb663c9bc59509846d6ec05345bd908eda73e670af888da41af171505 + message: "" + signed_header_1: + signature: 0x1b66ac1fb663c9bc59509846d6ec05345bd908eda73e670af888da41af171505cc411d61252fb6cb3fa0017b679f8bb2305b26a285fa2737f175668d0dff91cc1b66ac1fb663c9bc59509846d6ec05345bd908eda73e670af888da41af171505 + message: "" + - signed_header_2: + signature: 0x1b66ac1fb663c9bc59509846d6ec05345bd908eda73e670af888da41af171505cc411d61252fb6cb3fa0017b679f8bb2305b26a285fa2737f175668d0dff91cc1b66ac1fb663c9bc59509846d6ec05345bd908eda73e670af888da41af171505 + message: "" + signed_header_1: + signature: 0x1b66ac1fb663c9bc59509846d6ec05345bd908eda73e670af888da41af171505cc411d61252fb6cb3fa0017b679f8bb2305b26a285fa2737f175668d0dff91cc1b66ac1fb663c9bc59509846d6ec05345bd908eda73e670af888da41af171505 + message: "" + properties: + data: + items: + $ref: '#/components/schemas/inline_response_200_13_data' + type: array + inline_object_2: + description: The [`ProposerSlashing`](https://github.com/ethereum/eth2.0-specs/blob/v0.11.1/specs/phase0/beacon-chain.md#proposerslashing) + object from the Eth2.0 spec. + properties: + signed_header_1: + $ref: '#/components/schemas/inline_response_200_7_header' + signed_header_2: + $ref: '#/components/schemas/inline_response_200_7_header' + type: object + inline_response_200_14_message: + description: The [`VoluntaryExit`](https://github.com/ethereum/eth2.0-specs/blob/v0.11.1/specs/phase0/beacon-chain.md#voluntaryexit) + object from the Eth2.0 spec. + example: + validator_index: "" + epoch: "" + properties: + epoch: + allOf: + - example: "1" + type: string + - description: Minimum epoch for processing exit. + validator_index: + allOf: + - example: "1" + type: string + - description: Index of the exiting validator. + inline_response_200_14_data: + description: The [`SignedVoluntaryExit`](https://github.com/ethereum/eth2.0-specs/blob/v0.11.1/specs/phase0/beacon-chain.md#signedvoluntaryexit) + object from the Eth2.0 spec. + example: + signature: 0x1b66ac1fb663c9bc59509846d6ec05345bd908eda73e670af888da41af171505cc411d61252fb6cb3fa0017b679f8bb2305b26a285fa2737f175668d0dff91cc1b66ac1fb663c9bc59509846d6ec05345bd908eda73e670af888da41af171505 + message: + validator_index: "" + epoch: "" + properties: + message: + $ref: '#/components/schemas/inline_response_200_14_message' + signature: + example: 0x1b66ac1fb663c9bc59509846d6ec05345bd908eda73e670af888da41af171505cc411d61252fb6cb3fa0017b679f8bb2305b26a285fa2737f175668d0dff91cc1b66ac1fb663c9bc59509846d6ec05345bd908eda73e670af888da41af171505 + format: bytes + pattern: ^0x[a-fA-F0-9]{192}$ + type: string + inline_response_200_14: + example: + data: + - signature: 0x1b66ac1fb663c9bc59509846d6ec05345bd908eda73e670af888da41af171505cc411d61252fb6cb3fa0017b679f8bb2305b26a285fa2737f175668d0dff91cc1b66ac1fb663c9bc59509846d6ec05345bd908eda73e670af888da41af171505 + message: + validator_index: "" + epoch: "" + - signature: 0x1b66ac1fb663c9bc59509846d6ec05345bd908eda73e670af888da41af171505cc411d61252fb6cb3fa0017b679f8bb2305b26a285fa2737f175668d0dff91cc1b66ac1fb663c9bc59509846d6ec05345bd908eda73e670af888da41af171505 + message: + validator_index: "" + epoch: "" + properties: + data: + items: + $ref: '#/components/schemas/inline_response_200_14_data' + type: array + inline_object_3: + description: The [`SignedVoluntaryExit`](https://github.com/ethereum/eth2.0-specs/blob/v0.11.1/specs/phase0/beacon-chain.md#signedvoluntaryexit) + object from the Eth2.0 spec. + properties: + message: + $ref: '#/components/schemas/inline_response_200_14_message' + signature: + example: 0x1b66ac1fb663c9bc59509846d6ec05345bd908eda73e670af888da41af171505cc411d61252fb6cb3fa0017b679f8bb2305b26a285fa2737f175668d0dff91cc1b66ac1fb663c9bc59509846d6ec05345bd908eda73e670af888da41af171505 + format: bytes + pattern: ^0x[a-fA-F0-9]{192}$ + type: string + type: object + inline_response_200_15_data_metadata: + description: Based on eth2 [Metadata object](https://github.com/ethereum/eth2.0-specs/blob/v0.12.0/specs/phase0/p2p-interface.md#metadata) + example: + seq_number: "" + attnets: "" + properties: + seq_number: + allOf: + - description: Uint64 starting at 0 used to version the node's metadata. + If any other field in the local MetaData changes, the node MUST increment + seq_number by 1. + - example: "1" + type: string + attnets: + allOf: + - description: Bitvector representing the node's persistent attestation + subnet subscriptions. + - format: hex + pattern: ^0x[a-fA-F0-9]{2,}$ + type: string + inline_response_200_15_data: + example: + metadata: + seq_number: "" + attnets: "" + discovery_addresses: + - "" + - "" + p2p_addresses: + - "" + - "" + enr: enr:-IS4QHCYrYZbAKWCBRlAy5zzaDZXJBGkcnh4MHcBFZntXNFrdvJjX04jRzjzCBOonrkTfj499SZuOh8R33Ls8RRcy5wBgmlkgnY0gmlwhH8AAAGJc2VjcDI1NmsxoQPKY0yuDUmstAHYpMa2_oxVtw0RW_QAdpzBQA8yWM0xOIN1ZHCCdl8 + peer_id: QmYyQSo1c1Ym7orWxLYvCrM2EmxFTANf8wXmmE7DWjhx5N + properties: + peer_id: + description: Cryptographic hash of a peer’s public key. [Read more](https://docs.libp2p.io/concepts/peer-id/) + example: QmYyQSo1c1Ym7orWxLYvCrM2EmxFTANf8wXmmE7DWjhx5N + type: string + enr: + description: Ethereum node record. [Read more](https://eips.ethereum.org/EIPS/eip-778) + example: enr:-IS4QHCYrYZbAKWCBRlAy5zzaDZXJBGkcnh4MHcBFZntXNFrdvJjX04jRzjzCBOonrkTfj499SZuOh8R33Ls8RRcy5wBgmlkgnY0gmlwhH8AAAGJc2VjcDI1NmsxoQPKY0yuDUmstAHYpMa2_oxVtw0RW_QAdpzBQA8yWM0xOIN1ZHCCdl8 + type: string + p2p_addresses: + items: + allOf: + - description: '[Read more](https://docs.libp2p.io/reference/glossary/#multiaddr)' + example: /ip4/7.7.7.7/tcp/4242/p2p/QmYyQSo1c1Ym7orWxLYvCrM2EmxFTANf8wXmmE7DWjhx5N + type: string + - description: Node's addresses on which eth2 rpc requests are served. + [Read more](https://docs.libp2p.io/reference/glossary/#multiaddr) + type: array + discovery_addresses: + items: + allOf: + - description: '[Read more](https://docs.libp2p.io/reference/glossary/#multiaddr)' + example: /ip4/7.7.7.7/tcp/4242/p2p/QmYyQSo1c1Ym7orWxLYvCrM2EmxFTANf8wXmmE7DWjhx5N + type: string + - description: Node's addresses on which is listening for discv5 requests. + [Read more](https://docs.libp2p.io/reference/glossary/#multiaddr) + type: array + metadata: + $ref: '#/components/schemas/inline_response_200_15_data_metadata' + inline_response_200_15: + example: + data: + metadata: + seq_number: "" + attnets: "" + discovery_addresses: + - "" + - "" + p2p_addresses: + - "" + - "" + enr: enr:-IS4QHCYrYZbAKWCBRlAy5zzaDZXJBGkcnh4MHcBFZntXNFrdvJjX04jRzjzCBOonrkTfj499SZuOh8R33Ls8RRcy5wBgmlkgnY0gmlwhH8AAAGJc2VjcDI1NmsxoQPKY0yuDUmstAHYpMa2_oxVtw0RW_QAdpzBQA8yWM0xOIN1ZHCCdl8 + peer_id: QmYyQSo1c1Ym7orWxLYvCrM2EmxFTANf8wXmmE7DWjhx5N + properties: + data: + $ref: '#/components/schemas/inline_response_200_15_data' + inline_response_200_16_data: + example: + address: /ip4/7.7.7.7/tcp/4242/p2p/QmYyQSo1c1Ym7orWxLYvCrM2EmxFTANf8wXmmE7DWjhx5N + enr: enr:-IS4QHCYrYZbAKWCBRlAy5zzaDZXJBGkcnh4MHcBFZntXNFrdvJjX04jRzjzCBOonrkTfj499SZuOh8R33Ls8RRcy5wBgmlkgnY0gmlwhH8AAAGJc2VjcDI1NmsxoQPKY0yuDUmstAHYpMa2_oxVtw0RW_QAdpzBQA8yWM0xOIN1ZHCCdl8 + state: disconnected + peer_id: QmYyQSo1c1Ym7orWxLYvCrM2EmxFTANf8wXmmE7DWjhx5N + direction: inbound + properties: + peer_id: + description: Cryptographic hash of a peer’s public key. [Read more](https://docs.libp2p.io/concepts/peer-id/) + example: QmYyQSo1c1Ym7orWxLYvCrM2EmxFTANf8wXmmE7DWjhx5N + type: string + enr: + description: Ethereum node record. [Read more](https://eips.ethereum.org/EIPS/eip-778) + example: enr:-IS4QHCYrYZbAKWCBRlAy5zzaDZXJBGkcnh4MHcBFZntXNFrdvJjX04jRzjzCBOonrkTfj499SZuOh8R33Ls8RRcy5wBgmlkgnY0gmlwhH8AAAGJc2VjcDI1NmsxoQPKY0yuDUmstAHYpMa2_oxVtw0RW_QAdpzBQA8yWM0xOIN1ZHCCdl8 + type: string + address: + description: '[Read more](https://docs.libp2p.io/reference/glossary/#multiaddr)' + example: /ip4/7.7.7.7/tcp/4242/p2p/QmYyQSo1c1Ym7orWxLYvCrM2EmxFTANf8wXmmE7DWjhx5N + type: string + state: + enum: + - disconnected + - connecting + - connected + - disconnecting + type: string + direction: + enum: + - inbound + - outbound + type: string + inline_response_200_16: + example: + data: + - address: /ip4/7.7.7.7/tcp/4242/p2p/QmYyQSo1c1Ym7orWxLYvCrM2EmxFTANf8wXmmE7DWjhx5N + enr: enr:-IS4QHCYrYZbAKWCBRlAy5zzaDZXJBGkcnh4MHcBFZntXNFrdvJjX04jRzjzCBOonrkTfj499SZuOh8R33Ls8RRcy5wBgmlkgnY0gmlwhH8AAAGJc2VjcDI1NmsxoQPKY0yuDUmstAHYpMa2_oxVtw0RW_QAdpzBQA8yWM0xOIN1ZHCCdl8 + state: disconnected + peer_id: QmYyQSo1c1Ym7orWxLYvCrM2EmxFTANf8wXmmE7DWjhx5N + direction: inbound + - address: /ip4/7.7.7.7/tcp/4242/p2p/QmYyQSo1c1Ym7orWxLYvCrM2EmxFTANf8wXmmE7DWjhx5N + enr: enr:-IS4QHCYrYZbAKWCBRlAy5zzaDZXJBGkcnh4MHcBFZntXNFrdvJjX04jRzjzCBOonrkTfj499SZuOh8R33Ls8RRcy5wBgmlkgnY0gmlwhH8AAAGJc2VjcDI1NmsxoQPKY0yuDUmstAHYpMa2_oxVtw0RW_QAdpzBQA8yWM0xOIN1ZHCCdl8 + state: disconnected + peer_id: QmYyQSo1c1Ym7orWxLYvCrM2EmxFTANf8wXmmE7DWjhx5N + direction: inbound + properties: + data: + items: + $ref: '#/components/schemas/inline_response_200_16_data' + type: array + inline_response_200_17: + example: + data: + address: /ip4/7.7.7.7/tcp/4242/p2p/QmYyQSo1c1Ym7orWxLYvCrM2EmxFTANf8wXmmE7DWjhx5N + enr: enr:-IS4QHCYrYZbAKWCBRlAy5zzaDZXJBGkcnh4MHcBFZntXNFrdvJjX04jRzjzCBOonrkTfj499SZuOh8R33Ls8RRcy5wBgmlkgnY0gmlwhH8AAAGJc2VjcDI1NmsxoQPKY0yuDUmstAHYpMa2_oxVtw0RW_QAdpzBQA8yWM0xOIN1ZHCCdl8 + state: disconnected + peer_id: QmYyQSo1c1Ym7orWxLYvCrM2EmxFTANf8wXmmE7DWjhx5N + direction: inbound + properties: + data: + $ref: '#/components/schemas/inline_response_200_16_data' + inline_response_200_18_data: + example: + version: Lighthouse / v0.1.5 (Linux x86_64) + properties: + version: + description: A string which uniquely identifies the client implementation + and its version; similar to [HTTP User-Agent](https://tools.ietf.org/html/rfc7231#section-5.5.3). + example: Lighthouse / v0.1.5 (Linux x86_64) + type: string + inline_response_200_18: + example: + data: + version: Lighthouse / v0.1.5 (Linux x86_64) + properties: + data: + $ref: '#/components/schemas/inline_response_200_18_data' + inline_response_200_19_data: + example: + head_slot: "" + sync_distance: "" + properties: + head_slot: + allOf: + - description: Head slot node is trying to reach + - example: "1" + type: string + sync_distance: + allOf: + - description: How many slots node needs to process to reach head. 0 if + synced. + - example: "1" + type: string + inline_response_200_19: + example: + data: + head_slot: "" + sync_distance: "" + properties: + data: + $ref: '#/components/schemas/inline_response_200_19_data' + inline_response_200_20: + example: + data: + - previous_version: 0x00000000 + current_version: 0x00000000 + epoch: "1" + - previous_version: 0x00000000 + current_version: 0x00000000 + epoch: "1" + properties: + data: + items: + $ref: '#/components/schemas/inline_response_200_2_data' + type: array + inline_response_200_21: + example: + data: '{}' + properties: + data: + description: | + Key value mapping of Phase 0[spec variables](https://github.com/ethereum/eth2.0-specs/blob/v0.11.1/configs/mainnet.yaml). + Values are returned with following format: + - any value starting with 0x in the spec is returned as a hex string + - all other values are returned as number + type: object + inline_response_200_22_data: + example: + address: "" + chain_id: 1 + properties: + chain_id: + description: Id of Eth1 chain on which contract is deployed. + example: 1 + format: int32 + minimum: 1 + type: integer + address: + allOf: + - example: 0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2 + format: hex + pattern: ^0x[a-fA-F0-9]{64}$ + type: string + - description: Hex encoded deposit contract address with 0x prefix + - example: 0x1Db3439a222C519ab44bb1144fC28167b4Fa6EE6 + inline_response_200_22: + example: + data: + address: "" + chain_id: 1 + properties: + data: + $ref: '#/components/schemas/inline_response_200_22_data' + BeaconBlock_allOf: + properties: + slot: + allOf: + - example: "1" + type: string + - description: The slot to which this block corresponds. + proposer_index: + allOf: + - example: "1" + type: string + - description: Index of validator in validator registry. + parent_root: + allOf: + - example: 0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2 + format: hex + pattern: ^0x[a-fA-F0-9]{64}$ + type: string + - description: The signing merkle root of the parent `BeaconBlock`. + state_root: + allOf: + - example: 0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2 + format: hex + pattern: ^0x[a-fA-F0-9]{64}$ + type: string + - description: The tree hash merkle root of the `BeaconState` for the `BeaconBlock`. + BeaconBlock_allOf_1_body_eth1_data: + description: The [`Eth1Data`](https://github.com/ethereum/eth2.0-specs/blob/v0.11.1/specs/phase0/beacon-chain.md#eth1data) + object from the Eth2.0 spec. + properties: + deposit_root: + allOf: + - example: 0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2 + format: hex + pattern: ^0x[a-fA-F0-9]{64}$ + type: string + - description: Root of the deposit tree. + deposit_count: + allOf: + - example: "1" + type: string + - description: Total number of deposits. + block_hash: + allOf: + - example: 0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2 + format: hex + pattern: ^0x[a-fA-F0-9]{64}$ + type: string + - description: Ethereum 1.x block hash. + BeaconBlock_allOf_1_body_data: + description: The [`DepositData`](https://github.com/ethereum/eth2.0-specs/blob/v0.11.1/specs/phase0/beacon-chain.md#depositdata) + object from the Eth2.0 spec. + properties: + pubkey: + description: The validator's BLS public key, uniquely identifying them. + _48-bytes, hex encoded with 0x prefix, case insensitive._ + example: 0x93247f2209abcacf57b75a51dafae777f9dd38bc7053d1af526f220a7489a6d3a2753e5f3e8b1cfe39b56f43611df74a + pattern: ^0x[a-fA-F0-9]{96}$ + type: string + withdrawal_credentials: + allOf: + - example: 0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2 + format: hex + pattern: ^0x[a-fA-F0-9]{64}$ + type: string + - description: The withdrawal credentials. + amount: + allOf: + - example: "1" + type: string + - description: Amount in Gwei. + signature: + allOf: + - example: 0x1b66ac1fb663c9bc59509846d6ec05345bd908eda73e670af888da41af171505cc411d61252fb6cb3fa0017b679f8bb2305b26a285fa2737f175668d0dff91cc1b66ac1fb663c9bc59509846d6ec05345bd908eda73e670af888da41af171505 + format: bytes + pattern: ^0x[a-fA-F0-9]{192}$ + type: string + - description: Container self-signature. + BeaconBlock_allOf_1_body_deposits: + description: The [`Deposit`](https://github.com/ethereum/eth2.0-specs/blob/v0.11.1/specs/phase0/beacon-chain.md#deposit) + object from the Eth2.0 spec. + properties: + proof: + description: Branch in the deposit tree. + items: + allOf: + - example: 0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2 + format: hex + pattern: ^0x[a-fA-F0-9]{64}$ + type: string + maxItems: 32 + minItems: 32 + type: array + data: + $ref: '#/components/schemas/BeaconBlock_allOf_1_body_data' + BeaconBlock_allOf_1_body: + description: The [`BeaconBlockBody`](https://github.com/ethereum/eth2.0-specs/blob/v0.11.1/specs/phase0/beacon-chain.md#beaconblockbody) + object from the Eth2.0 spec. + properties: + randao_reveal: + allOf: + - example: 0x1b66ac1fb663c9bc59509846d6ec05345bd908eda73e670af888da41af171505cc411d61252fb6cb3fa0017b679f8bb2305b26a285fa2737f175668d0dff91cc1b66ac1fb663c9bc59509846d6ec05345bd908eda73e670af888da41af171505 + format: bytes + pattern: ^0x[a-fA-F0-9]{192}$ + type: string + - description: The RanDAO reveal value provided by the validator. + eth1_data: + $ref: '#/components/schemas/BeaconBlock_allOf_1_body_eth1_data' + graffiti: + format: byte + pattern: ^0x[a-fA-F0-9]{64}$ + type: string + proposer_slashings: + items: + $ref: '#/components/schemas/inline_response_200_13_data' + type: array + attester_slashings: + items: + $ref: '#/components/schemas/inline_response_200_12_data' + type: array + attestations: + items: + $ref: '#/components/schemas/inline_response_200_11_data_1' + type: array + deposits: + items: + $ref: '#/components/schemas/BeaconBlock_allOf_1_body_deposits' + type: array + voluntary_exits: + items: + $ref: '#/components/schemas/inline_response_200_14_message' + type: array + BeaconBlock_allOf_1: + properties: + body: + $ref: '#/components/schemas/BeaconBlock_allOf_1_body' diff --git a/pkg/eth2spec/api_beacon.go b/pkg/eth2spec/api_beacon.go new file mode 100644 index 0000000..347ec8f --- /dev/null +++ b/pkg/eth2spec/api_beacon.go @@ -0,0 +1,1608 @@ +/* + * Eth2 Beacon Node API + * + * API specification for the beacon node, which enables users to query and participate in Ethereum 2.0 phase 0 beacon chain. + * + * API version: Dev - Eth2Spec v0.11.1 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package eth2spec + +import ( + _context "context" + _ioutil "io/ioutil" + _nethttp "net/http" + _neturl "net/url" + "strings" + "github.com/antihax/optional" + "reflect" +) + +// Linger please +var ( + _ _context.Context +) + +// BeaconApiService BeaconApi service +type BeaconApiService service + +/* +GetBlock Get block +Retrieves block details for given block id. + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param blockId Block identifier. Can be one of: \"head\" (canonical head in node's view), \"genesis\", \"finalized\", \\, \\. +@return InlineResponse2009 +*/ +func (a *BeaconApiService) GetBlock(ctx _context.Context, blockId string) (InlineResponse2009, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue InlineResponse2009 + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/beacon/blocks/{block_id}" + localVarPath = strings.Replace(localVarPath, "{"+"block_id"+"}", _neturl.QueryEscape(parameterToString(blockId, "")) , -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(r) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +/* +GetBlockAttestations Get block attestations +Retrieves attestation included in requested block. + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param blockId Block identifier. Can be one of: \"head\" (canonical head in node's view), \"genesis\", \"finalized\", \\, \\. +@return InlineResponse20011 +*/ +func (a *BeaconApiService) GetBlockAttestations(ctx _context.Context, blockId string) (InlineResponse20011, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue InlineResponse20011 + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/beacon/blocks/{block_id}/attestations" + localVarPath = strings.Replace(localVarPath, "{"+"block_id"+"}", _neturl.QueryEscape(parameterToString(blockId, "")) , -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(r) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +/* +GetBlockHeader Get block header +Retrieves block header for given block id. + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param blockId Block identifier. Can be one of: \"head\" (canonical head in node's view), \"genesis\", \"finalized\", \\, \\. +@return InlineResponse2008 +*/ +func (a *BeaconApiService) GetBlockHeader(ctx _context.Context, blockId string) (InlineResponse2008, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue InlineResponse2008 + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/beacon/headers/{block_id}" + localVarPath = strings.Replace(localVarPath, "{"+"block_id"+"}", _neturl.QueryEscape(parameterToString(blockId, "")) , -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(r) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +// GetBlockHeadersOpts Optional parameters for the method 'GetBlockHeaders' +type GetBlockHeadersOpts struct { + Slot optional.Interface + ParentRoot optional.Interface +} + +/* +GetBlockHeaders Get block headers +Retrieves block headers matching given query. By default it will fetch current head slot blocks. + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param optional nil or *GetBlockHeadersOpts - Optional Parameters: + * @param "Slot" (optional.Interface of string) - + * @param "ParentRoot" (optional.Interface of string) - +@return InlineResponse2007 +*/ +func (a *BeaconApiService) GetBlockHeaders(ctx _context.Context, localVarOptionals *GetBlockHeadersOpts) (InlineResponse2007, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue InlineResponse2007 + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/beacon/headers" + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + + if localVarOptionals != nil && localVarOptionals.Slot.IsSet() { + localVarQueryParams.Add("slot", parameterToString(localVarOptionals.Slot.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.ParentRoot.IsSet() { + localVarQueryParams.Add("parent_root", parameterToString(localVarOptionals.ParentRoot.Value(), "")) + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(r) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +/* +GetBlockRoot Get block root +Retrieves hashTreeRoot of BeaconBlock/BeaconBlockHeader + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param blockId Block identifier. Can be one of: \"head\" (canonical head in node's view), \"genesis\", \"finalized\", \\, \\. +@return InlineResponse20010 +*/ +func (a *BeaconApiService) GetBlockRoot(ctx _context.Context, blockId string) (InlineResponse20010, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue InlineResponse20010 + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/beacon/blocks/{block_id}/root" + localVarPath = strings.Replace(localVarPath, "{"+"block_id"+"}", _neturl.QueryEscape(parameterToString(blockId, "")) , -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(r) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +// GetEpochCommitteesOpts Optional parameters for the method 'GetEpochCommittees' +type GetEpochCommitteesOpts struct { + Index optional.Interface + Slot optional.Interface +} + +/* +GetEpochCommittees Get all committees for epoch +Retrieves the committees for the given state at the given epoch. + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param stateId State identifier. Can be one of: \"head\" (canonical head in node's view), \"genesis\", \"finalized\", \"justified\", \\, \\. + * @param epoch Epoch for which to calculate committees. Defaults to beacon state epoch. + * @param optional nil or *GetEpochCommitteesOpts - Optional Parameters: + * @param "Index" (optional.Interface of string) - Committee index + * @param "Slot" (optional.Interface of string) - +@return InlineResponse2006 +*/ +func (a *BeaconApiService) GetEpochCommittees(ctx _context.Context, stateId string, epoch string, localVarOptionals *GetEpochCommitteesOpts) (InlineResponse2006, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue InlineResponse2006 + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/beacon/states/{state_id}/committees/{epoch}" + localVarPath = strings.Replace(localVarPath, "{"+"state_id"+"}", _neturl.QueryEscape(parameterToString(stateId, "")) , -1) + + localVarPath = strings.Replace(localVarPath, "{"+"epoch"+"}", _neturl.QueryEscape(parameterToString(epoch, "")) , -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + + if localVarOptionals != nil && localVarOptionals.Index.IsSet() { + localVarQueryParams.Add("index", parameterToString(localVarOptionals.Index.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.Slot.IsSet() { + localVarQueryParams.Add("slot", parameterToString(localVarOptionals.Slot.Value(), "")) + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(r) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +/* +GetGenesis Retrieve details of the chain's genesis. +Retrieve details of the chain's genesis which can be used to identify chain. + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). +@return InlineResponse200 +*/ +func (a *BeaconApiService) GetGenesis(ctx _context.Context) (InlineResponse200, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue InlineResponse200 + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/beacon/genesis" + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(r) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +// GetPoolAttestationsOpts Optional parameters for the method 'GetPoolAttestations' +type GetPoolAttestationsOpts struct { + Slot optional.String + CommitteeIndex optional.String +} + +/* +GetPoolAttestations Get Attestations from operations pool +Retrieves attestations known by the node but not necessarily incorporated into any block + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param optional nil or *GetPoolAttestationsOpts - Optional Parameters: + * @param "Slot" (optional.String) - + * @param "CommitteeIndex" (optional.String) - +@return InlineResponse20011 +*/ +func (a *BeaconApiService) GetPoolAttestations(ctx _context.Context, localVarOptionals *GetPoolAttestationsOpts) (InlineResponse20011, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue InlineResponse20011 + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/beacon/pool/attestations" + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + + if localVarOptionals != nil && localVarOptionals.Slot.IsSet() { + localVarQueryParams.Add("slot", parameterToString(localVarOptionals.Slot.Value(), "")) + } + if localVarOptionals != nil && localVarOptionals.CommitteeIndex.IsSet() { + localVarQueryParams.Add("committee_index", parameterToString(localVarOptionals.CommitteeIndex.Value(), "")) + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(r) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +/* +GetPoolAttesterSlashings Get AttesterSlashings from operations pool +Retrieves attester slashings known by the node but not necessarily incorporated into any block + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). +@return InlineResponse20012 +*/ +func (a *BeaconApiService) GetPoolAttesterSlashings(ctx _context.Context) (InlineResponse20012, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue InlineResponse20012 + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/beacon/pool/atttester_slashings" + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(r) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +/* +GetPoolProposerSlashings Get ProposerSlashings from operations pool +Retrieves proposer slashings known by the node but not necessarily incorporated into any block + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). +@return InlineResponse20013 +*/ +func (a *BeaconApiService) GetPoolProposerSlashings(ctx _context.Context) (InlineResponse20013, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue InlineResponse20013 + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/beacon/pool/proposer_slashings" + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(r) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +/* +GetPoolVoluntaryExits Get SignedVoluntaryExit from operations pool +Retrieves voluntary exits known by the node but not necessarily incorporated into any block + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). +@return InlineResponse20014 +*/ +func (a *BeaconApiService) GetPoolVoluntaryExits(ctx _context.Context) (InlineResponse20014, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue InlineResponse20014 + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/beacon/pool/voluntary_exits" + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(r) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +/* +GetStateFinalityCheckpoints Get state finality checkpoints +Returns finality checkpoints for state with given 'stateId'. In case finality is not yet achieved, checkpoint should return epoch 0 and ZERO_HASH as root. + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param stateId State identifier. Can be one of: \"head\" (canonical head in node's view), \"genesis\", \"finalized\", \"justified\", \\, \\. +@return InlineResponse2003 +*/ +func (a *BeaconApiService) GetStateFinalityCheckpoints(ctx _context.Context, stateId string) (InlineResponse2003, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue InlineResponse2003 + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/beacon/states/{state_id}/finality_checkpoints" + localVarPath = strings.Replace(localVarPath, "{"+"state_id"+"}", _neturl.QueryEscape(parameterToString(stateId, "")) , -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(r) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +/* +GetStateFork Get Fork object for requested state +Returns [Fork](https://github.com/ethereum/eth2.0-specs/blob/v0.11.1/specs/phase0/beacon-chain.md#fork) object for state with given 'stateId'. + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param stateId State identifier. Can be one of: \"head\" (canonical head in node's view), \"genesis\", \"finalized\", \"justified\", \\, \\. +@return InlineResponse2002 +*/ +func (a *BeaconApiService) GetStateFork(ctx _context.Context, stateId string) (InlineResponse2002, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue InlineResponse2002 + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/beacon/states/{state_id}/fork" + localVarPath = strings.Replace(localVarPath, "{"+"state_id"+"}", _neturl.QueryEscape(parameterToString(stateId, "")) , -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(r) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +/* +GetStateRoot Get state SSZ HashTreeRoot +Calculates HashTreeRoot for state with given 'stateId'. If stateId is root, same value will be returned. + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param stateId State identifier. Can be one of: \"head\" (canonical head in node's view), \"genesis\", \"finalized\", \"justified\", \\, \\. +@return InlineResponse2001 +*/ +func (a *BeaconApiService) GetStateRoot(ctx _context.Context, stateId string) (InlineResponse2001, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue InlineResponse2001 + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/beacon/states/{state_id}/root" + localVarPath = strings.Replace(localVarPath, "{"+"state_id"+"}", _neturl.QueryEscape(parameterToString(stateId, "")) , -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(r) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +/* +GetStateValidator Get validator from state by id +Returns validator specified by state and id or public key along with status and balance. + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param stateId State identifier. Can be one of: \"head\" (canonical head in node's view), \"genesis\", \"finalized\", \"justified\", \\, \\. + * @param validatorId Either hex encoded public key (with 0x prefix) or validator index +@return InlineResponse2005 +*/ +func (a *BeaconApiService) GetStateValidator(ctx _context.Context, stateId string, validatorId string) (InlineResponse2005, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue InlineResponse2005 + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/beacon/states/{state_id}/validators/{validator_id}" + localVarPath = strings.Replace(localVarPath, "{"+"state_id"+"}", _neturl.QueryEscape(parameterToString(stateId, "")) , -1) + + localVarPath = strings.Replace(localVarPath, "{"+"validator_id"+"}", _neturl.QueryEscape(parameterToString(validatorId, "")) , -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(r) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +// GetStateValidatorsOpts Optional parameters for the method 'GetStateValidators' +type GetStateValidatorsOpts struct { + Id optional.Interface + Status optional.Interface +} + +/* +GetStateValidators Get validators from state +Returns filterable list of validators with their balance, status and index. + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param stateId State identifier. Can be one of: \"head\" (canonical head in node's view), \"genesis\", \"finalized\", \"justified\", \\, \\. + * @param optional nil or *GetStateValidatorsOpts - Optional Parameters: + * @param "Id" (optional.Interface of []string) - Either hex encoded public key (with 0x prefix) or validator index + * @param "Status" (optional.Interface of []string) - [Validator status specification](https://hackmd.io/ofFJ5gOmQpu1jjHilHbdQQ) +@return InlineResponse2004 +*/ +func (a *BeaconApiService) GetStateValidators(ctx _context.Context, stateId string, localVarOptionals *GetStateValidatorsOpts) (InlineResponse2004, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue InlineResponse2004 + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/beacon/states/{state_id}/validators" + localVarPath = strings.Replace(localVarPath, "{"+"state_id"+"}", _neturl.QueryEscape(parameterToString(stateId, "")) , -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + + if localVarOptionals != nil && localVarOptionals.Id.IsSet() { + t:=localVarOptionals.Id.Value() + if reflect.TypeOf(t).Kind() == reflect.Slice { + s := reflect.ValueOf(t) + for i := 0; i < s.Len(); i++ { + localVarQueryParams.Add("id", parameterToString(s.Index(i), "multi")) + } + } else { + localVarQueryParams.Add("id", parameterToString(t, "multi")) + } + } + if localVarOptionals != nil && localVarOptionals.Status.IsSet() { + t:=localVarOptionals.Status.Value() + if reflect.TypeOf(t).Kind() == reflect.Slice { + s := reflect.ValueOf(t) + for i := 0; i < s.Len(); i++ { + localVarQueryParams.Add("status", parameterToString(s.Index(i), "multi")) + } + } else { + localVarQueryParams.Add("status", parameterToString(t, "multi")) + } + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(r) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +/* +SubmitPoolAttestations Submit Attestation object to node +Submits Attestation object to node. If attestation passes all validation constraints, node MUST publish attestation on appropriate subnet. + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param inlineObject +*/ +func (a *BeaconApiService) SubmitPoolAttestations(ctx _context.Context, inlineObject InlineObject) (*_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPost + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/beacon/pool/attestations" + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = &inlineObject + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(r) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} + +/* +SubmitPoolAttesterSlashings Submit AttesterSlashing object to node's pool +Submits AttesterSlashing object to node's pool and if passes validation node MUST broadcast it to network. + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param inlineObject1 +*/ +func (a *BeaconApiService) SubmitPoolAttesterSlashings(ctx _context.Context, inlineObject1 InlineObject1) (*_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPost + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/beacon/pool/atttester_slashings" + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = &inlineObject1 + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(r) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} + +/* +SubmitPoolProposerSlashings Submit ProposerSlashing object to node's pool +Submits ProposerSlashing object to node's pool and if passes validation node MUST broadcast it to network. + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param inlineObject2 +*/ +func (a *BeaconApiService) SubmitPoolProposerSlashings(ctx _context.Context, inlineObject2 InlineObject2) (*_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPost + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/beacon/pool/proposer_slashings" + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = &inlineObject2 + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(r) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} + +/* +SubmitPoolVoluntaryExit Submit SignedVoluntaryExit object to node's pool +Submits SignedVoluntaryExit object to node's pool and if passes validation node MUST broadcast it to network. + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param inlineObject3 +*/ +func (a *BeaconApiService) SubmitPoolVoluntaryExit(ctx _context.Context, inlineObject3 InlineObject3) (*_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPost + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/beacon/pool/voluntary_exits" + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = &inlineObject3 + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(r) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} diff --git a/pkg/eth2spec/api_config.go b/pkg/eth2spec/api_config.go new file mode 100644 index 0000000..b9a65cd --- /dev/null +++ b/pkg/eth2spec/api_config.go @@ -0,0 +1,250 @@ +/* + * Eth2 Beacon Node API + * + * API specification for the beacon node, which enables users to query and participate in Ethereum 2.0 phase 0 beacon chain. + * + * API version: Dev - Eth2Spec v0.11.1 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package eth2spec + +import ( + _context "context" + _ioutil "io/ioutil" + _nethttp "net/http" + _neturl "net/url" +) + +// Linger please +var ( + _ _context.Context +) + +// ConfigApiService ConfigApi service +type ConfigApiService service + +/* +GetDepositContract Get deposit contract address. +Retrieve deposit contract address and genesis fork version. + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). +@return InlineResponse20022 +*/ +func (a *ConfigApiService) GetDepositContract(ctx _context.Context) (InlineResponse20022, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue InlineResponse20022 + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/config/deposit_contract" + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(r) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +/* +GetForkSchedule Get scheduled upcoming forks. +Retrieve all scheduled upcoming forks this node is aware of. + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). +@return InlineResponse20020 +*/ +func (a *ConfigApiService) GetForkSchedule(ctx _context.Context) (InlineResponse20020, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue InlineResponse20020 + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/config/fork_schedule" + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(r) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +/* +GetSpec Get spec params. +Retrieve specification configuration (without Phase 1 params) used on this node. [Specification params list](https://github.com/ethereum/eth2.0-specs/blob/v0.11.1/configs/mainnet.yaml) Values are returned with following format: - any value starting with 0x in the spec is returned as a hex string - all other values are returned as number + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). +@return InlineResponse20021 +*/ +func (a *ConfigApiService) GetSpec(ctx _context.Context) (InlineResponse20021, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue InlineResponse20021 + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/config/spec" + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(r) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} diff --git a/pkg/eth2spec/api_minimal_validator_api.go b/pkg/eth2spec/api_minimal_validator_api.go new file mode 100644 index 0000000..b90c821 --- /dev/null +++ b/pkg/eth2spec/api_minimal_validator_api.go @@ -0,0 +1,403 @@ +/* + * Beacon Node API + * + * API specification for the beacon node, which enables users to query and participate in Ethereum 2.0 phase 0 beacon chain. + * + * API version: 0.11.1 + * Contact: dont-contact@ethereum.org + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package eth2spec + +import ( + _context "context" + _ioutil "io/ioutil" + _nethttp "net/http" + _neturl "net/url" + "strings" +) + +// Linger please +var ( + _ _context.Context +) + +// MinimalValidatorApiApiService MinimalValidatorApiApi service +type MinimalValidatorApiApiService service + +/* +GetGenesis Retrieve details of the chain's genesis. +Retrieve details of the chain's genesis which can be used to identify chain. + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). +@return InlineResponse200 +*/ +func (a *MinimalValidatorApiApiService) GetGenesis(ctx _context.Context) (InlineResponse200, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue InlineResponse200 + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/beacon/genesis" + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(r) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +/* +GetStateFork Get Fork object for requested state +Returns [Fork](https://github.com/ethereum/eth2.0-specs/blob/v0.11.1/specs/phase0/beacon-chain.md#fork) object for state with given 'stateId'. + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param stateId State identifier. Can be one of: \"head\" (canonical head in node's view), \"genesis\", \"finalized\", \"justified\", \\, \\. +@return InlineResponse2002 +*/ +func (a *MinimalValidatorApiApiService) GetStateFork(ctx _context.Context, stateId string) (InlineResponse2002, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue InlineResponse2002 + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/beacon/states/{state_id}/fork" + localVarPath = strings.Replace(localVarPath, "{"+"state_id"+"}", _neturl.QueryEscape(parameterToString(stateId, "")) , -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(r) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +/* +GetStateValidator Get validator from state by id +Returns validator specified by state and id or public key along with status and balance. + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param stateId State identifier. Can be one of: \"head\" (canonical head in node's view), \"genesis\", \"finalized\", \"justified\", \\, \\. + * @param validatorId Either hex encoded public key (with 0x prefix) or validator index +@return InlineResponse2005 +*/ +func (a *MinimalValidatorApiApiService) GetStateValidator(ctx _context.Context, stateId string, validatorId string) (InlineResponse2005, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue InlineResponse2005 + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/beacon/states/{state_id}/validators/{validator_id}" + localVarPath = strings.Replace(localVarPath, "{"+"state_id"+"}", _neturl.QueryEscape(parameterToString(stateId, "")) , -1) + + localVarPath = strings.Replace(localVarPath, "{"+"validator_id"+"}", _neturl.QueryEscape(parameterToString(validatorId, "")) , -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(r) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +/* +GetSyncingStatus Get node syncing status +Requests the beacon node to describe if it's currently syncing or not, and if it is, what block it is up to. + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). +@return InlineResponse20019 +*/ +func (a *MinimalValidatorApiApiService) GetSyncingStatus(ctx _context.Context) (InlineResponse20019, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue InlineResponse20019 + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/node/syncing" + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(r) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +/* +SubmitPoolAttestations Submit Attestation object to node +Submits Attestation object to node. If attestation passes all validation constraints, node MUST publish attestation on appropriate subnet. + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param inlineObject +*/ +func (a *MinimalValidatorApiApiService) SubmitPoolAttestations(ctx _context.Context, inlineObject InlineObject) (*_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPost + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/beacon/pool/attestations" + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = &inlineObject + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(r) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} diff --git a/pkg/eth2spec/api_node.go b/pkg/eth2spec/api_node.go new file mode 100644 index 0000000..11c6598 --- /dev/null +++ b/pkg/eth2spec/api_node.go @@ -0,0 +1,468 @@ +/* + * Eth2 Beacon Node API + * + * API specification for the beacon node, which enables users to query and participate in Ethereum 2.0 phase 0 beacon chain. + * + * API version: Dev - Eth2Spec v0.11.1 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package eth2spec + +import ( + _context "context" + _ioutil "io/ioutil" + _nethttp "net/http" + _neturl "net/url" + "strings" +) + +// Linger please +var ( + _ _context.Context +) + +// NodeApiService NodeApi service +type NodeApiService service + +/* +GetHealth Get health check +Returns node health status in http status codes. Useful for load balancers. + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). +*/ +func (a *NodeApiService) GetHealth(ctx _context.Context) (*_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/node/health" + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(r) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} + +/* +GetNetworkIdentity Get node network identity +Retrieves data about the node's network presence + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). +@return InlineResponse20015 +*/ +func (a *NodeApiService) GetNetworkIdentity(ctx _context.Context) (InlineResponse20015, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue InlineResponse20015 + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/node/identity" + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(r) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +/* +GetNodeVersion Get version string of the running beacon node. +Requests that the beacon node identify information about its implementation in a format similar to a [HTTP User-Agent](https://tools.ietf.org/html/rfc7231#section-5.5.3) field. + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). +@return InlineResponse20018 +*/ +func (a *NodeApiService) GetNodeVersion(ctx _context.Context) (InlineResponse20018, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue InlineResponse20018 + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/node/version" + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(r) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +/* +GetPeer Get peer +Retrieves data about the given peer + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param peerId +@return InlineResponse20017 +*/ +func (a *NodeApiService) GetPeer(ctx _context.Context, peerId string) (InlineResponse20017, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue InlineResponse20017 + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/node/peers/{peer_id}" + localVarPath = strings.Replace(localVarPath, "{"+"peer_id"+"}", _neturl.QueryEscape(parameterToString(peerId, "")) , -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(r) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +/* +GetPeers Get node network peers +Retrieves data about the node's network peers + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). +@return InlineResponse20016 +*/ +func (a *NodeApiService) GetPeers(ctx _context.Context) (InlineResponse20016, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue InlineResponse20016 + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/node/peers" + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(r) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +/* +GetSyncingStatus Get node syncing status +Requests the beacon node to describe if it's currently syncing or not, and if it is, what block it is up to. + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). +@return InlineResponse20019 +*/ +func (a *NodeApiService) GetSyncingStatus(ctx _context.Context) (InlineResponse20019, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue InlineResponse20019 + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/node/syncing" + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(r) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} diff --git a/pkg/eth2spec/api_validator_required_api.go b/pkg/eth2spec/api_validator_required_api.go new file mode 100644 index 0000000..39851cf --- /dev/null +++ b/pkg/eth2spec/api_validator_required_api.go @@ -0,0 +1,402 @@ +/* + * Eth2 Beacon Node API + * + * API specification for the beacon node, which enables users to query and participate in Ethereum 2.0 phase 0 beacon chain. + * + * API version: Dev - Eth2Spec v0.11.1 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package eth2spec + +import ( + _context "context" + _ioutil "io/ioutil" + _nethttp "net/http" + _neturl "net/url" + "strings" +) + +// Linger please +var ( + _ _context.Context +) + +// ValidatorRequiredApiApiService ValidatorRequiredApiApi service +type ValidatorRequiredApiApiService service + +/* +GetGenesis Retrieve details of the chain's genesis. +Retrieve details of the chain's genesis which can be used to identify chain. + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). +@return InlineResponse200 +*/ +func (a *ValidatorRequiredApiApiService) GetGenesis(ctx _context.Context) (InlineResponse200, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue InlineResponse200 + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/beacon/genesis" + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(r) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +/* +GetStateFork Get Fork object for requested state +Returns [Fork](https://github.com/ethereum/eth2.0-specs/blob/v0.11.1/specs/phase0/beacon-chain.md#fork) object for state with given 'stateId'. + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param stateId State identifier. Can be one of: \"head\" (canonical head in node's view), \"genesis\", \"finalized\", \"justified\", \\, \\. +@return InlineResponse2002 +*/ +func (a *ValidatorRequiredApiApiService) GetStateFork(ctx _context.Context, stateId string) (InlineResponse2002, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue InlineResponse2002 + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/beacon/states/{state_id}/fork" + localVarPath = strings.Replace(localVarPath, "{"+"state_id"+"}", _neturl.QueryEscape(parameterToString(stateId, "")) , -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(r) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +/* +GetStateValidator Get validator from state by id +Returns validator specified by state and id or public key along with status and balance. + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param stateId State identifier. Can be one of: \"head\" (canonical head in node's view), \"genesis\", \"finalized\", \"justified\", \\, \\. + * @param validatorId Either hex encoded public key (with 0x prefix) or validator index +@return InlineResponse2005 +*/ +func (a *ValidatorRequiredApiApiService) GetStateValidator(ctx _context.Context, stateId string, validatorId string) (InlineResponse2005, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue InlineResponse2005 + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/beacon/states/{state_id}/validators/{validator_id}" + localVarPath = strings.Replace(localVarPath, "{"+"state_id"+"}", _neturl.QueryEscape(parameterToString(stateId, "")) , -1) + + localVarPath = strings.Replace(localVarPath, "{"+"validator_id"+"}", _neturl.QueryEscape(parameterToString(validatorId, "")) , -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(r) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +/* +GetSyncingStatus Get node syncing status +Requests the beacon node to describe if it's currently syncing or not, and if it is, what block it is up to. + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). +@return InlineResponse20019 +*/ +func (a *ValidatorRequiredApiApiService) GetSyncingStatus(ctx _context.Context) (InlineResponse20019, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue InlineResponse20019 + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/node/syncing" + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(r) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +/* +SubmitPoolAttestations Submit Attestation object to node +Submits Attestation object to node. If attestation passes all validation constraints, node MUST publish attestation on appropriate subnet. + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param inlineObject +*/ +func (a *ValidatorRequiredApiApiService) SubmitPoolAttestations(ctx _context.Context, inlineObject InlineObject) (*_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPost + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1/beacon/pool/attestations" + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = &inlineObject + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(r) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} diff --git a/pkg/eth2spec/client.go b/pkg/eth2spec/client.go new file mode 100644 index 0000000..e4b864b --- /dev/null +++ b/pkg/eth2spec/client.go @@ -0,0 +1,551 @@ +/* + * Eth2 Beacon Node API + * + * API specification for the beacon node, which enables users to query and participate in Ethereum 2.0 phase 0 beacon chain. + * + * API version: Dev - Eth2Spec v0.11.1 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package eth2spec + +import ( + "bytes" + "context" + "encoding/json" + "encoding/xml" + "errors" + "fmt" + "io" + "io/ioutil" + "log" + "mime/multipart" + "net/http" + "net/http/httputil" + "net/url" + "os" + "path/filepath" + "reflect" + "regexp" + "strconv" + "strings" + "time" + "unicode/utf8" + + "golang.org/x/oauth2" +) + +var ( + jsonCheck = regexp.MustCompile(`(?i:(?:application|text)/(?:vnd\.[^;]+\+)?json)`) + xmlCheck = regexp.MustCompile(`(?i:(?:application|text)/xml)`) +) + +// APIClient manages communication with the Eth2 Beacon Node API API vDev - Eth2Spec v0.11.1 +// In most cases there should be only one, shared, APIClient. +type APIClient struct { + cfg *Configuration + common service // Reuse a single struct instead of allocating one for each service on the heap. + + // API Services + + BeaconApi *BeaconApiService + + ConfigApi *ConfigApiService + + NodeApi *NodeApiService + + ValidatorRequiredApiApi *ValidatorRequiredApiApiService +} + +type service struct { + client *APIClient +} + +// NewAPIClient creates a new API client. Requires a userAgent string describing your application. +// optionally a custom http.Client to allow for advanced features such as caching. +func NewAPIClient(cfg *Configuration) *APIClient { + if cfg.HTTPClient == nil { + cfg.HTTPClient = http.DefaultClient + } + + c := &APIClient{} + c.cfg = cfg + c.common.client = c + + // API Services + c.BeaconApi = (*BeaconApiService)(&c.common) + c.ConfigApi = (*ConfigApiService)(&c.common) + c.NodeApi = (*NodeApiService)(&c.common) + c.ValidatorRequiredApiApi = (*ValidatorRequiredApiApiService)(&c.common) + + return c +} + +func atoi(in string) (int, error) { + return strconv.Atoi(in) +} + +// selectHeaderContentType select a content type from the available list. +func selectHeaderContentType(contentTypes []string) string { + if len(contentTypes) == 0 { + return "" + } + if contains(contentTypes, "application/json") { + return "application/json" + } + return contentTypes[0] // use the first content type specified in 'consumes' +} + +// selectHeaderAccept join all accept types and return +func selectHeaderAccept(accepts []string) string { + if len(accepts) == 0 { + return "" + } + + if contains(accepts, "application/json") { + return "application/json" + } + + return strings.Join(accepts, ",") +} + +// contains is a case insenstive match, finding needle in a haystack +func contains(haystack []string, needle string) bool { + for _, a := range haystack { + if strings.ToLower(a) == strings.ToLower(needle) { + return true + } + } + return false +} + +// Verify optional parameters are of the correct type. +func typeCheckParameter(obj interface{}, expected string, name string) error { + // Make sure there is an object. + if obj == nil { + return nil + } + + // Check the type is as expected. + if reflect.TypeOf(obj).String() != expected { + return fmt.Errorf("Expected %s to be of type %s but received %s.", name, expected, reflect.TypeOf(obj).String()) + } + return nil +} + +// parameterToString convert interface{} parameters to string, using a delimiter if format is provided. +func parameterToString(obj interface{}, collectionFormat string) string { + var delimiter string + + switch collectionFormat { + case "pipes": + delimiter = "|" + case "ssv": + delimiter = " " + case "tsv": + delimiter = "\t" + case "csv": + delimiter = "," + } + + if reflect.TypeOf(obj).Kind() == reflect.Slice { + return strings.Trim(strings.Replace(fmt.Sprint(obj), " ", delimiter, -1), "[]") + } else if t, ok := obj.(time.Time); ok { + return t.Format(time.RFC3339) + } + + return fmt.Sprintf("%v", obj) +} + +// helper for converting interface{} parameters to json strings +func parameterToJson(obj interface{}) (string, error) { + jsonBuf, err := json.Marshal(obj) + if err != nil { + return "", err + } + return string(jsonBuf), err +} + + +// callAPI do the request. +func (c *APIClient) callAPI(request *http.Request) (*http.Response, error) { + if c.cfg.Debug { + dump, err := httputil.DumpRequestOut(request, true) + if err != nil { + return nil, err + } + log.Printf("\n%s\n", string(dump)) + } + + resp, err := c.cfg.HTTPClient.Do(request) + if err != nil { + return resp, err + } + + if c.cfg.Debug { + dump, err := httputil.DumpResponse(resp, true) + if err != nil { + return resp, err + } + log.Printf("\n%s\n", string(dump)) + } + + return resp, err +} + +// ChangeBasePath changes base path to allow switching to mocks +func (c *APIClient) ChangeBasePath(path string) { + c.cfg.BasePath = path +} + +// Allow modification of underlying config for alternate implementations and testing +// Caution: modifying the configuration while live can cause data races and potentially unwanted behavior +func (c *APIClient) GetConfig() *Configuration { + return c.cfg +} + +// prepareRequest build the request +func (c *APIClient) prepareRequest( + ctx context.Context, + path string, method string, + postBody interface{}, + headerParams map[string]string, + queryParams url.Values, + formParams url.Values, + formFileName string, + fileName string, + fileBytes []byte) (localVarRequest *http.Request, err error) { + + var body *bytes.Buffer + + // Detect postBody type and post. + if postBody != nil { + contentType := headerParams["Content-Type"] + if contentType == "" { + contentType = detectContentType(postBody) + headerParams["Content-Type"] = contentType + } + + body, err = setBody(postBody, contentType) + if err != nil { + return nil, err + } + } + + // add form parameters and file if available. + if strings.HasPrefix(headerParams["Content-Type"], "multipart/form-data") && len(formParams) > 0 || (len(fileBytes) > 0 && fileName != "") { + if body != nil { + return nil, errors.New("Cannot specify postBody and multipart form at the same time.") + } + body = &bytes.Buffer{} + w := multipart.NewWriter(body) + + for k, v := range formParams { + for _, iv := range v { + if strings.HasPrefix(k, "@") { // file + err = addFile(w, k[1:], iv) + if err != nil { + return nil, err + } + } else { // form value + w.WriteField(k, iv) + } + } + } + if len(fileBytes) > 0 && fileName != "" { + w.Boundary() + //_, fileNm := filepath.Split(fileName) + part, err := w.CreateFormFile(formFileName, filepath.Base(fileName)) + if err != nil { + return nil, err + } + _, err = part.Write(fileBytes) + if err != nil { + return nil, err + } + } + + // Set the Boundary in the Content-Type + headerParams["Content-Type"] = w.FormDataContentType() + + // Set Content-Length + headerParams["Content-Length"] = fmt.Sprintf("%d", body.Len()) + w.Close() + } + + if strings.HasPrefix(headerParams["Content-Type"], "application/x-www-form-urlencoded") && len(formParams) > 0 { + if body != nil { + return nil, errors.New("Cannot specify postBody and x-www-form-urlencoded form at the same time.") + } + body = &bytes.Buffer{} + body.WriteString(formParams.Encode()) + // Set Content-Length + headerParams["Content-Length"] = fmt.Sprintf("%d", body.Len()) + } + + // Setup path and query parameters + url, err := url.Parse(path) + if err != nil { + return nil, err + } + + // Override request host, if applicable + if c.cfg.Host != "" { + url.Host = c.cfg.Host + } + + // Override request scheme, if applicable + if c.cfg.Scheme != "" { + url.Scheme = c.cfg.Scheme + } + + // Adding Query Param + query := url.Query() + for k, v := range queryParams { + for _, iv := range v { + query.Add(k, iv) + } + } + + // Encode the parameters. + url.RawQuery = query.Encode() + + // Generate a new request + if body != nil { + localVarRequest, err = http.NewRequest(method, url.String(), body) + } else { + localVarRequest, err = http.NewRequest(method, url.String(), nil) + } + if err != nil { + return nil, err + } + + // add header parameters, if any + if len(headerParams) > 0 { + headers := http.Header{} + for h, v := range headerParams { + headers.Set(h, v) + } + localVarRequest.Header = headers + } + + // Add the user agent to the request. + localVarRequest.Header.Add("User-Agent", c.cfg.UserAgent) + + if ctx != nil { + // add context to the request + localVarRequest = localVarRequest.WithContext(ctx) + + // Walk through any authentication. + + // OAuth2 authentication + if tok, ok := ctx.Value(ContextOAuth2).(oauth2.TokenSource); ok { + // We were able to grab an oauth2 token from the context + var latestToken *oauth2.Token + if latestToken, err = tok.Token(); err != nil { + return nil, err + } + + latestToken.SetAuthHeader(localVarRequest) + } + + // Basic HTTP Authentication + if auth, ok := ctx.Value(ContextBasicAuth).(BasicAuth); ok { + localVarRequest.SetBasicAuth(auth.UserName, auth.Password) + } + + // AccessToken Authentication + if auth, ok := ctx.Value(ContextAccessToken).(string); ok { + localVarRequest.Header.Add("Authorization", "Bearer "+auth) + } + + } + + for header, value := range c.cfg.DefaultHeader { + localVarRequest.Header.Add(header, value) + } + + return localVarRequest, nil +} + +func (c *APIClient) decode(v interface{}, b []byte, contentType string) (err error) { + if len(b) == 0 { + return nil + } + if s, ok := v.(*string); ok { + *s = string(b) + return nil + } + if f, ok := v.(**os.File); ok { + *f, err = ioutil.TempFile("", "HttpClientFile") + if err != nil { + return + } + _, err = (*f).Write(b) + _, err = (*f).Seek(0, io.SeekStart) + return + } + if xmlCheck.MatchString(contentType) { + if err = xml.Unmarshal(b, v); err != nil { + return err + } + return nil + } + if jsonCheck.MatchString(contentType) { + if err = json.Unmarshal(b, v); err != nil { + return err + } + return nil + } + return errors.New("undefined response type") +} + +// Add a file to the multipart request +func addFile(w *multipart.Writer, fieldName, path string) error { + file, err := os.Open(path) + if err != nil { + return err + } + defer file.Close() + + part, err := w.CreateFormFile(fieldName, filepath.Base(path)) + if err != nil { + return err + } + _, err = io.Copy(part, file) + + return err +} + +// Prevent trying to import "fmt" +func reportError(format string, a ...interface{}) error { + return fmt.Errorf(format, a...) +} + +// Set request body from an interface{} +func setBody(body interface{}, contentType string) (bodyBuf *bytes.Buffer, err error) { + if bodyBuf == nil { + bodyBuf = &bytes.Buffer{} + } + + if reader, ok := body.(io.Reader); ok { + _, err = bodyBuf.ReadFrom(reader) + } else if b, ok := body.([]byte); ok { + _, err = bodyBuf.Write(b) + } else if s, ok := body.(string); ok { + _, err = bodyBuf.WriteString(s) + } else if s, ok := body.(*string); ok { + _, err = bodyBuf.WriteString(*s) + } else if jsonCheck.MatchString(contentType) { + err = json.NewEncoder(bodyBuf).Encode(body) + } else if xmlCheck.MatchString(contentType) { + err = xml.NewEncoder(bodyBuf).Encode(body) + } + + if err != nil { + return nil, err + } + + if bodyBuf.Len() == 0 { + err = fmt.Errorf("Invalid body type %s\n", contentType) + return nil, err + } + return bodyBuf, nil +} + +// detectContentType method is used to figure out `Request.Body` content type for request header +func detectContentType(body interface{}) string { + contentType := "text/plain; charset=utf-8" + kind := reflect.TypeOf(body).Kind() + + switch kind { + case reflect.Struct, reflect.Map, reflect.Ptr: + contentType = "application/json; charset=utf-8" + case reflect.String: + contentType = "text/plain; charset=utf-8" + default: + if b, ok := body.([]byte); ok { + contentType = http.DetectContentType(b) + } else if kind == reflect.Slice { + contentType = "application/json; charset=utf-8" + } + } + + return contentType +} + +// Ripped from https://github.com/gregjones/httpcache/blob/master/httpcache.go +type cacheControl map[string]string + +func parseCacheControl(headers http.Header) cacheControl { + cc := cacheControl{} + ccHeader := headers.Get("Cache-Control") + for _, part := range strings.Split(ccHeader, ",") { + part = strings.Trim(part, " ") + if part == "" { + continue + } + if strings.ContainsRune(part, '=') { + keyval := strings.Split(part, "=") + cc[strings.Trim(keyval[0], " ")] = strings.Trim(keyval[1], ",") + } else { + cc[part] = "" + } + } + return cc +} + +// CacheExpires helper function to determine remaining time before repeating a request. +func CacheExpires(r *http.Response) time.Time { + // Figure out when the cache expires. + var expires time.Time + now, err := time.Parse(time.RFC1123, r.Header.Get("date")) + if err != nil { + return time.Now() + } + respCacheControl := parseCacheControl(r.Header) + + if maxAge, ok := respCacheControl["max-age"]; ok { + lifetime, err := time.ParseDuration(maxAge + "s") + if err != nil { + expires = now + } else { + expires = now.Add(lifetime) + } + } else { + expiresHeader := r.Header.Get("Expires") + if expiresHeader != "" { + expires, err = time.Parse(time.RFC1123, expiresHeader) + if err != nil { + expires = now + } + } + } + return expires +} + +func strlen(s string) int { + return utf8.RuneCountInString(s) +} + +// GenericOpenAPIError Provides access to the body, error and model on returned errors. +type GenericOpenAPIError struct { + body []byte + error string + model interface{} +} + +// Error returns non-empty string if there was an error. +func (e GenericOpenAPIError) Error() string { + return e.error +} + +// Body returns the raw bytes of the response +func (e GenericOpenAPIError) Body() []byte { + return e.body +} + +// Model returns the unpacked model of the error +func (e GenericOpenAPIError) Model() interface{} { + return e.model +} diff --git a/pkg/eth2spec/configuration.go b/pkg/eth2spec/configuration.go new file mode 100644 index 0000000..bc20ef4 --- /dev/null +++ b/pkg/eth2spec/configuration.go @@ -0,0 +1,136 @@ +/* + * Eth2 Beacon Node API + * + * API specification for the beacon node, which enables users to query and participate in Ethereum 2.0 phase 0 beacon chain. + * + * API version: Dev - Eth2Spec v0.11.1 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package eth2spec + +import ( + "fmt" + "net/http" + "strings" +) + +// contextKeys are used to identify the type of value in the context. +// Since these are string, it is possible to get a short description of the +// context key for logging and debugging using key.String(). + +type contextKey string + +func (c contextKey) String() string { + return "auth " + string(c) +} + +var ( + // ContextOAuth2 takes an oauth2.TokenSource as authentication for the request. + ContextOAuth2 = contextKey("token") + + // ContextBasicAuth takes BasicAuth as authentication for the request. + ContextBasicAuth = contextKey("basic") + + // ContextAccessToken takes a string oauth2 access token as authentication for the request. + ContextAccessToken = contextKey("accesstoken") + + // ContextAPIKey takes an APIKey as authentication for the request + ContextAPIKey = contextKey("apikey") + +) + +// BasicAuth provides basic http authentication to a request passed via context using ContextBasicAuth +type BasicAuth struct { + UserName string `json:"userName,omitempty"` + Password string `json:"password,omitempty"` +} + +// APIKey provides API key based authentication to a request passed via context using ContextAPIKey +type APIKey struct { + Key string + Prefix string +} + + +// ServerVariable stores the information about a server variable +type ServerVariable struct { + Description string + DefaultValue string + EnumValues []string +} + +// ServerConfiguration stores the information about a server +type ServerConfiguration struct { + Url string + Description string + Variables map[string]ServerVariable +} + +// Configuration stores the configuration of the API client +type Configuration struct { + BasePath string `json:"basePath,omitempty"` + Host string `json:"host,omitempty"` + Scheme string `json:"scheme,omitempty"` + DefaultHeader map[string]string `json:"defaultHeader,omitempty"` + UserAgent string `json:"userAgent,omitempty"` + Debug bool `json:"debug,omitempty"` + Servers []ServerConfiguration + HTTPClient *http.Client +} + +// NewConfiguration returns a new Configuration object +func NewConfiguration() *Configuration { + cfg := &Configuration{ + BasePath: "http://public-mainnet-node.ethereum.org/api", + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Servers: []ServerConfiguration{ + { + Url: "{server_url}", + Description: "No description provided", + Variables: map[string]ServerVariable{ + "server_url": ServerVariable{ + Description: "Beacon node API url", + DefaultValue: "http://public-mainnet-node.ethereum.org/api", + }, + }, + }, + }, + } + return cfg +} + +// AddDefaultHeader adds a new HTTP header to the default header in the request +func (c *Configuration) AddDefaultHeader(key string, value string) { + c.DefaultHeader[key] = value +} + +// ServerUrl returns URL based on server settings +func (c *Configuration) ServerUrl(index int, variables map[string]string) (string, error) { + if index < 0 || len(c.Servers) <= index { + return "", fmt.Errorf("Index %v out of range %v", index, len(c.Servers) - 1) + } + server := c.Servers[index] + url := server.Url + + // go through variables and replace placeholders + for name, variable := range server.Variables { + if value, ok := variables[name]; ok { + found := bool(len(variable.EnumValues) == 0) + for _, enumValue := range variable.EnumValues { + if value == enumValue { + found = true + } + } + if !found { + return "", fmt.Errorf("The variable %s in the server URL has invalid value %v. Must be %v", name, value, variable.EnumValues) + } + url = strings.Replace(url, "{"+name+"}", value, -1) + } else { + url = strings.Replace(url, "{"+name+"}", variable.DefaultValue, -1) + } + } + return url, nil +} diff --git a/pkg/eth2spec/docs/Attestation.md b/pkg/eth2spec/docs/Attestation.md new file mode 100644 index 0000000..0d787f9 --- /dev/null +++ b/pkg/eth2spec/docs/Attestation.md @@ -0,0 +1,13 @@ +# Attestation + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**AggregationBits** | **string** | Attester aggregation bits. | [optional] +**Signature** | **string** | | [optional] +**Data** | [**InlineResponse20011Data**](inline_response_200_11_data.md) | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/pkg/eth2spec/docs/AttesterDuty.md b/pkg/eth2spec/docs/AttesterDuty.md new file mode 100644 index 0000000..77adc78 --- /dev/null +++ b/pkg/eth2spec/docs/AttesterDuty.md @@ -0,0 +1,14 @@ +# AttesterDuty + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ValidatorPubkey** | **string** | The validator's BLS public key, uniquely identifying them. _48-bytes, hex encoded with 0x prefix, case insensitive._ | [optional] +**AggregatorModulo** | **string** | | [optional] +**AttestationSlot** | **string** | | [optional] +**CommitteeIndex** | **string** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/pkg/eth2spec/docs/AttesterSlashing.md b/pkg/eth2spec/docs/AttesterSlashing.md new file mode 100644 index 0000000..7429c49 --- /dev/null +++ b/pkg/eth2spec/docs/AttesterSlashing.md @@ -0,0 +1,12 @@ +# AttesterSlashing + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Attestation1** | [**InlineResponse20012Attestation1**](inline_response_200_12_attestation_1.md) | | [optional] +**Attestation2** | [**InlineResponse20012Attestation1**](inline_response_200_12_attestation_1.md) | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/pkg/eth2spec/docs/BeaconApi.md b/pkg/eth2spec/docs/BeaconApi.md new file mode 100644 index 0000000..33e756a --- /dev/null +++ b/pkg/eth2spec/docs/BeaconApi.md @@ -0,0 +1,739 @@ +# \BeaconApi + +All URIs are relative to *http://public-mainnet-node.ethereum.org/api* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**GetBlock**](BeaconApi.md#GetBlock) | **Get** /v1/beacon/blocks/{block_id} | Get block +[**GetBlockAttestations**](BeaconApi.md#GetBlockAttestations) | **Get** /v1/beacon/blocks/{block_id}/attestations | Get block attestations +[**GetBlockHeader**](BeaconApi.md#GetBlockHeader) | **Get** /v1/beacon/headers/{block_id} | Get block header +[**GetBlockHeaders**](BeaconApi.md#GetBlockHeaders) | **Get** /v1/beacon/headers | Get block headers +[**GetBlockRoot**](BeaconApi.md#GetBlockRoot) | **Get** /v1/beacon/blocks/{block_id}/root | Get block root +[**GetEpochCommittees**](BeaconApi.md#GetEpochCommittees) | **Get** /v1/beacon/states/{state_id}/committees/{epoch} | Get all committees for epoch +[**GetGenesis**](BeaconApi.md#GetGenesis) | **Get** /v1/beacon/genesis | Retrieve details of the chain's genesis. +[**GetPoolAttestations**](BeaconApi.md#GetPoolAttestations) | **Get** /v1/beacon/pool/attestations | Get Attestations from operations pool +[**GetPoolAttesterSlashings**](BeaconApi.md#GetPoolAttesterSlashings) | **Get** /v1/beacon/pool/atttester_slashings | Get AttesterSlashings from operations pool +[**GetPoolProposerSlashings**](BeaconApi.md#GetPoolProposerSlashings) | **Get** /v1/beacon/pool/proposer_slashings | Get ProposerSlashings from operations pool +[**GetPoolVoluntaryExits**](BeaconApi.md#GetPoolVoluntaryExits) | **Get** /v1/beacon/pool/voluntary_exits | Get SignedVoluntaryExit from operations pool +[**GetStateFinalityCheckpoints**](BeaconApi.md#GetStateFinalityCheckpoints) | **Get** /v1/beacon/states/{state_id}/finality_checkpoints | Get state finality checkpoints +[**GetStateFork**](BeaconApi.md#GetStateFork) | **Get** /v1/beacon/states/{state_id}/fork | Get Fork object for requested state +[**GetStateRoot**](BeaconApi.md#GetStateRoot) | **Get** /v1/beacon/states/{state_id}/root | Get state SSZ HashTreeRoot +[**GetStateValidator**](BeaconApi.md#GetStateValidator) | **Get** /v1/beacon/states/{state_id}/validators/{validator_id} | Get validator from state by id +[**GetStateValidators**](BeaconApi.md#GetStateValidators) | **Get** /v1/beacon/states/{state_id}/validators | Get validators from state +[**SubmitPoolAttestations**](BeaconApi.md#SubmitPoolAttestations) | **Post** /v1/beacon/pool/attestations | Submit Attestation object to node +[**SubmitPoolAttesterSlashings**](BeaconApi.md#SubmitPoolAttesterSlashings) | **Post** /v1/beacon/pool/atttester_slashings | Submit AttesterSlashing object to node's pool +[**SubmitPoolProposerSlashings**](BeaconApi.md#SubmitPoolProposerSlashings) | **Post** /v1/beacon/pool/proposer_slashings | Submit ProposerSlashing object to node's pool +[**SubmitPoolVoluntaryExit**](BeaconApi.md#SubmitPoolVoluntaryExit) | **Post** /v1/beacon/pool/voluntary_exits | Submit SignedVoluntaryExit object to node's pool + + + +## GetBlock + +> InlineResponse2009 GetBlock(ctx, blockId) + +Get block + +Retrieves block details for given block id. + +### Required Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**blockId** | **string**| Block identifier. Can be one of: \"head\" (canonical head in node's view), \"genesis\", \"finalized\", \\<slot\\>, \\<hex encoded blockRoot with 0x prefix\\>. | + +### Return type + +[**InlineResponse2009**](inline_response_200_9.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## GetBlockAttestations + +> InlineResponse20011 GetBlockAttestations(ctx, blockId) + +Get block attestations + +Retrieves attestation included in requested block. + +### Required Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**blockId** | **string**| Block identifier. Can be one of: \"head\" (canonical head in node's view), \"genesis\", \"finalized\", \\<slot\\>, \\<hex encoded blockRoot with 0x prefix\\>. | + +### Return type + +[**InlineResponse20011**](inline_response_200_11.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## GetBlockHeader + +> InlineResponse2008 GetBlockHeader(ctx, blockId) + +Get block header + +Retrieves block header for given block id. + +### Required Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**blockId** | **string**| Block identifier. Can be one of: \"head\" (canonical head in node's view), \"genesis\", \"finalized\", \\<slot\\>, \\<hex encoded blockRoot with 0x prefix\\>. | + +### Return type + +[**InlineResponse2008**](inline_response_200_8.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## GetBlockHeaders + +> InlineResponse2007 GetBlockHeaders(ctx, optional) + +Get block headers + +Retrieves block headers matching given query. By default it will fetch current head slot blocks. + +### Required Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. + **optional** | ***GetBlockHeadersOpts** | optional parameters | nil if no parameters + +### Optional Parameters + +Optional parameters are passed through a pointer to a GetBlockHeadersOpts struct + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **slot** | [**optional.Interface of string**](.md)| | + **parentRoot** | [**optional.Interface of string**](.md)| | + +### Return type + +[**InlineResponse2007**](inline_response_200_7.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## GetBlockRoot + +> InlineResponse20010 GetBlockRoot(ctx, blockId) + +Get block root + +Retrieves hashTreeRoot of BeaconBlock/BeaconBlockHeader + +### Required Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**blockId** | **string**| Block identifier. Can be one of: \"head\" (canonical head in node's view), \"genesis\", \"finalized\", \\<slot\\>, \\<hex encoded blockRoot with 0x prefix\\>. | + +### Return type + +[**InlineResponse20010**](inline_response_200_10.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## GetEpochCommittees + +> InlineResponse2006 GetEpochCommittees(ctx, stateId, epoch, optional) + +Get all committees for epoch + +Retrieves the committees for the given state at the given epoch. + +### Required Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**stateId** | **string**| State identifier. Can be one of: \"head\" (canonical head in node's view), \"genesis\", \"finalized\", \"justified\", \\<slot\\>, \\<hex encoded stateRoot with 0x prefix\\>. | +**epoch** | [**string**](.md)| Epoch for which to calculate committees. Defaults to beacon state epoch. | + **optional** | ***GetEpochCommitteesOpts** | optional parameters | nil if no parameters + +### Optional Parameters + +Optional parameters are passed through a pointer to a GetEpochCommitteesOpts struct + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + + + **index** | [**optional.Interface of string**](.md)| Committee index | + **slot** | [**optional.Interface of string**](.md)| | + +### Return type + +[**InlineResponse2006**](inline_response_200_6.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## GetGenesis + +> InlineResponse200 GetGenesis(ctx, ) + +Retrieve details of the chain's genesis. + +Retrieve details of the chain's genesis which can be used to identify chain. + +### Required Parameters + +This endpoint does not need any parameter. + +### Return type + +[**InlineResponse200**](inline_response_200.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## GetPoolAttestations + +> InlineResponse20011 GetPoolAttestations(ctx, optional) + +Get Attestations from operations pool + +Retrieves attestations known by the node but not necessarily incorporated into any block + +### Required Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. + **optional** | ***GetPoolAttestationsOpts** | optional parameters | nil if no parameters + +### Optional Parameters + +Optional parameters are passed through a pointer to a GetPoolAttestationsOpts struct + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **slot** | **optional.String**| | + **committeeIndex** | **optional.String**| | + +### Return type + +[**InlineResponse20011**](inline_response_200_11.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## GetPoolAttesterSlashings + +> InlineResponse20012 GetPoolAttesterSlashings(ctx, ) + +Get AttesterSlashings from operations pool + +Retrieves attester slashings known by the node but not necessarily incorporated into any block + +### Required Parameters + +This endpoint does not need any parameter. + +### Return type + +[**InlineResponse20012**](inline_response_200_12.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## GetPoolProposerSlashings + +> InlineResponse20013 GetPoolProposerSlashings(ctx, ) + +Get ProposerSlashings from operations pool + +Retrieves proposer slashings known by the node but not necessarily incorporated into any block + +### Required Parameters + +This endpoint does not need any parameter. + +### Return type + +[**InlineResponse20013**](inline_response_200_13.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## GetPoolVoluntaryExits + +> InlineResponse20014 GetPoolVoluntaryExits(ctx, ) + +Get SignedVoluntaryExit from operations pool + +Retrieves voluntary exits known by the node but not necessarily incorporated into any block + +### Required Parameters + +This endpoint does not need any parameter. + +### Return type + +[**InlineResponse20014**](inline_response_200_14.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## GetStateFinalityCheckpoints + +> InlineResponse2003 GetStateFinalityCheckpoints(ctx, stateId) + +Get state finality checkpoints + +Returns finality checkpoints for state with given 'stateId'. In case finality is not yet achieved, checkpoint should return epoch 0 and ZERO_HASH as root. + +### Required Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**stateId** | **string**| State identifier. Can be one of: \"head\" (canonical head in node's view), \"genesis\", \"finalized\", \"justified\", \\<slot\\>, \\<hex encoded stateRoot with 0x prefix\\>. | + +### Return type + +[**InlineResponse2003**](inline_response_200_3.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## GetStateFork + +> InlineResponse2002 GetStateFork(ctx, stateId) + +Get Fork object for requested state + +Returns [Fork](https://github.com/ethereum/eth2.0-specs/blob/v0.11.1/specs/phase0/beacon-chain.md#fork) object for state with given 'stateId'. + +### Required Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**stateId** | **string**| State identifier. Can be one of: \"head\" (canonical head in node's view), \"genesis\", \"finalized\", \"justified\", \\<slot\\>, \\<hex encoded stateRoot with 0x prefix\\>. | + +### Return type + +[**InlineResponse2002**](inline_response_200_2.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## GetStateRoot + +> InlineResponse2001 GetStateRoot(ctx, stateId) + +Get state SSZ HashTreeRoot + +Calculates HashTreeRoot for state with given 'stateId'. If stateId is root, same value will be returned. + +### Required Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**stateId** | **string**| State identifier. Can be one of: \"head\" (canonical head in node's view), \"genesis\", \"finalized\", \"justified\", \\<slot\\>, \\<hex encoded stateRoot with 0x prefix\\>. | + +### Return type + +[**InlineResponse2001**](inline_response_200_1.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## GetStateValidator + +> InlineResponse2005 GetStateValidator(ctx, stateId, validatorId) + +Get validator from state by id + +Returns validator specified by state and id or public key along with status and balance. + +### Required Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**stateId** | **string**| State identifier. Can be one of: \"head\" (canonical head in node's view), \"genesis\", \"finalized\", \"justified\", \\<slot\\>, \\<hex encoded stateRoot with 0x prefix\\>. | +**validatorId** | **string**| Either hex encoded public key (with 0x prefix) or validator index | + +### Return type + +[**InlineResponse2005**](inline_response_200_5.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## GetStateValidators + +> InlineResponse2004 GetStateValidators(ctx, stateId, optional) + +Get validators from state + +Returns filterable list of validators with their balance, status and index. + +### Required Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**stateId** | **string**| State identifier. Can be one of: \"head\" (canonical head in node's view), \"genesis\", \"finalized\", \"justified\", \\<slot\\>, \\<hex encoded stateRoot with 0x prefix\\>. | + **optional** | ***GetStateValidatorsOpts** | optional parameters | nil if no parameters + +### Optional Parameters + +Optional parameters are passed through a pointer to a GetStateValidatorsOpts struct + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + + **id** | [**optional.Interface of []string**](string.md)| Either hex encoded public key (with 0x prefix) or validator index | + **status** | [**optional.Interface of []string**](string.md)| [Validator status specification](https://hackmd.io/ofFJ5gOmQpu1jjHilHbdQQ) | + +### Return type + +[**InlineResponse2004**](inline_response_200_4.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## SubmitPoolAttestations + +> SubmitPoolAttestations(ctx, inlineObject) + +Submit Attestation object to node + +Submits Attestation object to node. If attestation passes all validation constraints, node MUST publish attestation on appropriate subnet. + +### Required Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**inlineObject** | [**InlineObject**](InlineObject.md)| | + +### Return type + + (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## SubmitPoolAttesterSlashings + +> SubmitPoolAttesterSlashings(ctx, inlineObject1) + +Submit AttesterSlashing object to node's pool + +Submits AttesterSlashing object to node's pool and if passes validation node MUST broadcast it to network. + +### Required Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**inlineObject1** | [**InlineObject1**](InlineObject1.md)| | + +### Return type + + (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## SubmitPoolProposerSlashings + +> SubmitPoolProposerSlashings(ctx, inlineObject2) + +Submit ProposerSlashing object to node's pool + +Submits ProposerSlashing object to node's pool and if passes validation node MUST broadcast it to network. + +### Required Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**inlineObject2** | [**InlineObject2**](InlineObject2.md)| | + +### Return type + + (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## SubmitPoolVoluntaryExit + +> SubmitPoolVoluntaryExit(ctx, inlineObject3) + +Submit SignedVoluntaryExit object to node's pool + +Submits SignedVoluntaryExit object to node's pool and if passes validation node MUST broadcast it to network. + +### Required Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**inlineObject3** | [**InlineObject3**](InlineObject3.md)| | + +### Return type + + (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + diff --git a/pkg/eth2spec/docs/BeaconBlock.md b/pkg/eth2spec/docs/BeaconBlock.md new file mode 100644 index 0000000..9123294 --- /dev/null +++ b/pkg/eth2spec/docs/BeaconBlock.md @@ -0,0 +1,15 @@ +# BeaconBlock + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Slot** | **string** | | [optional] +**ProposerIndex** | **string** | | [optional] +**ParentRoot** | **string** | | [optional] +**StateRoot** | **string** | | [optional] +**Body** | [**BeaconBlockAllOf1Body**](BeaconBlock_allOf_1_body.md) | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/pkg/eth2spec/docs/BeaconBlockAllOf.md b/pkg/eth2spec/docs/BeaconBlockAllOf.md new file mode 100644 index 0000000..6c3d237 --- /dev/null +++ b/pkg/eth2spec/docs/BeaconBlockAllOf.md @@ -0,0 +1,14 @@ +# BeaconBlockAllOf + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Slot** | **string** | | [optional] +**ProposerIndex** | **string** | | [optional] +**ParentRoot** | **string** | | [optional] +**StateRoot** | **string** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/pkg/eth2spec/docs/BeaconBlockAllOf1.md b/pkg/eth2spec/docs/BeaconBlockAllOf1.md new file mode 100644 index 0000000..e175d06 --- /dev/null +++ b/pkg/eth2spec/docs/BeaconBlockAllOf1.md @@ -0,0 +1,11 @@ +# BeaconBlockAllOf1 + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Body** | [**BeaconBlockAllOf1Body**](BeaconBlock_allOf_1_body.md) | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/pkg/eth2spec/docs/BeaconBlockAllOf1Body.md b/pkg/eth2spec/docs/BeaconBlockAllOf1Body.md new file mode 100644 index 0000000..47e1e2e --- /dev/null +++ b/pkg/eth2spec/docs/BeaconBlockAllOf1Body.md @@ -0,0 +1,18 @@ +# BeaconBlockAllOf1Body + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**RandaoReveal** | **string** | | [optional] +**Eth1Data** | [**BeaconBlockAllOf1BodyEth1Data**](BeaconBlock_allOf_1_body_eth1_data.md) | | [optional] +**Graffiti** | **string** | | [optional] +**ProposerSlashings** | [**[]InlineResponse20013Data**](inline_response_200_13_data.md) | | [optional] +**AttesterSlashings** | [**[]InlineResponse20012Data**](inline_response_200_12_data.md) | | [optional] +**Attestations** | [**[]InlineResponse20011Data1**](inline_response_200_11_data_1.md) | | [optional] +**Deposits** | [**[]BeaconBlockAllOf1BodyDeposits**](BeaconBlock_allOf_1_body_deposits.md) | | [optional] +**VoluntaryExits** | [**[]InlineResponse20014Message**](inline_response_200_14_message.md) | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/pkg/eth2spec/docs/BeaconBlockAllOf1BodyData.md b/pkg/eth2spec/docs/BeaconBlockAllOf1BodyData.md new file mode 100644 index 0000000..c5d47a4 --- /dev/null +++ b/pkg/eth2spec/docs/BeaconBlockAllOf1BodyData.md @@ -0,0 +1,14 @@ +# BeaconBlockAllOf1BodyData + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Pubkey** | **string** | The validator's BLS public key, uniquely identifying them. _48-bytes, hex encoded with 0x prefix, case insensitive._ | [optional] +**WithdrawalCredentials** | **string** | | [optional] +**Amount** | **string** | | [optional] +**Signature** | **string** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/pkg/eth2spec/docs/BeaconBlockAllOf1BodyDeposits.md b/pkg/eth2spec/docs/BeaconBlockAllOf1BodyDeposits.md new file mode 100644 index 0000000..67caa6b --- /dev/null +++ b/pkg/eth2spec/docs/BeaconBlockAllOf1BodyDeposits.md @@ -0,0 +1,12 @@ +# BeaconBlockAllOf1BodyDeposits + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Proof** | **[]string** | Branch in the deposit tree. | [optional] +**Data** | [**BeaconBlockAllOf1BodyData**](BeaconBlock_allOf_1_body_data.md) | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/pkg/eth2spec/docs/BeaconBlockAllOf1BodyEth1Data.md b/pkg/eth2spec/docs/BeaconBlockAllOf1BodyEth1Data.md new file mode 100644 index 0000000..c2c849b --- /dev/null +++ b/pkg/eth2spec/docs/BeaconBlockAllOf1BodyEth1Data.md @@ -0,0 +1,13 @@ +# BeaconBlockAllOf1BodyEth1Data + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**DepositRoot** | **string** | | [optional] +**DepositCount** | **string** | | [optional] +**BlockHash** | **string** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/pkg/eth2spec/docs/Checkpoint.md b/pkg/eth2spec/docs/Checkpoint.md new file mode 100644 index 0000000..b03ebd2 --- /dev/null +++ b/pkg/eth2spec/docs/Checkpoint.md @@ -0,0 +1,12 @@ +# Checkpoint + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Epoch** | **string** | | [optional] +**Root** | **string** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/pkg/eth2spec/docs/Committee.md b/pkg/eth2spec/docs/Committee.md new file mode 100644 index 0000000..fab760e --- /dev/null +++ b/pkg/eth2spec/docs/Committee.md @@ -0,0 +1,13 @@ +# Committee + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Index** | **string** | | [optional] +**Slot** | **string** | | [optional] +**Validators** | **[]string** | List of validator indices assigned to this committee | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/pkg/eth2spec/docs/ConfigApi.md b/pkg/eth2spec/docs/ConfigApi.md new file mode 100644 index 0000000..747c304 --- /dev/null +++ b/pkg/eth2spec/docs/ConfigApi.md @@ -0,0 +1,101 @@ +# \ConfigApi + +All URIs are relative to *http://public-mainnet-node.ethereum.org/api* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**GetDepositContract**](ConfigApi.md#GetDepositContract) | **Get** /v1/config/deposit_contract | Get deposit contract address. +[**GetForkSchedule**](ConfigApi.md#GetForkSchedule) | **Get** /v1/config/fork_schedule | Get scheduled upcoming forks. +[**GetSpec**](ConfigApi.md#GetSpec) | **Get** /v1/config/spec | Get spec params. + + + +## GetDepositContract + +> InlineResponse20022 GetDepositContract(ctx, ) + +Get deposit contract address. + +Retrieve deposit contract address and genesis fork version. + +### Required Parameters + +This endpoint does not need any parameter. + +### Return type + +[**InlineResponse20022**](inline_response_200_22.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## GetForkSchedule + +> InlineResponse20020 GetForkSchedule(ctx, ) + +Get scheduled upcoming forks. + +Retrieve all scheduled upcoming forks this node is aware of. + +### Required Parameters + +This endpoint does not need any parameter. + +### Return type + +[**InlineResponse20020**](inline_response_200_20.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## GetSpec + +> InlineResponse20021 GetSpec(ctx, ) + +Get spec params. + +Retrieve specification configuration (without Phase 1 params) used on this node. [Specification params list](https://github.com/ethereum/eth2.0-specs/blob/v0.11.1/configs/mainnet.yaml) Values are returned with following format: - any value starting with 0x in the spec is returned as a hex string - all other values are returned as number + +### Required Parameters + +This endpoint does not need any parameter. + +### Return type + +[**InlineResponse20021**](inline_response_200_21.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + diff --git a/pkg/eth2spec/docs/Fork.md b/pkg/eth2spec/docs/Fork.md new file mode 100644 index 0000000..d84ede0 --- /dev/null +++ b/pkg/eth2spec/docs/Fork.md @@ -0,0 +1,13 @@ +# Fork + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**PreviousVersion** | **string** | a fork version number | [optional] +**CurrentVersion** | **string** | a fork version number | [optional] +**Epoch** | **string** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/pkg/eth2spec/docs/GenesisTime.md b/pkg/eth2spec/docs/GenesisTime.md new file mode 100644 index 0000000..98126ed --- /dev/null +++ b/pkg/eth2spec/docs/GenesisTime.md @@ -0,0 +1,10 @@ +# GenesisTime + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/pkg/eth2spec/docs/InlineObject.md b/pkg/eth2spec/docs/InlineObject.md new file mode 100644 index 0000000..fc210c7 --- /dev/null +++ b/pkg/eth2spec/docs/InlineObject.md @@ -0,0 +1,13 @@ +# InlineObject + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**AggregationBits** | **string** | Attester aggregation bits. | [optional] +**Signature** | **string** | | [optional] +**Data** | [**InlineResponse20011Data**](inline_response_200_11_data.md) | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/pkg/eth2spec/docs/InlineObject1.md b/pkg/eth2spec/docs/InlineObject1.md new file mode 100644 index 0000000..db3c20f --- /dev/null +++ b/pkg/eth2spec/docs/InlineObject1.md @@ -0,0 +1,12 @@ +# InlineObject1 + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Attestation1** | [**InlineResponse20012Attestation1**](inline_response_200_12_attestation_1.md) | | [optional] +**Attestation2** | [**InlineResponse20012Attestation1**](inline_response_200_12_attestation_1.md) | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/pkg/eth2spec/docs/InlineObject2.md b/pkg/eth2spec/docs/InlineObject2.md new file mode 100644 index 0000000..29f3bf3 --- /dev/null +++ b/pkg/eth2spec/docs/InlineObject2.md @@ -0,0 +1,12 @@ +# InlineObject2 + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**SignedHeader1** | [**InlineResponse2007Header**](inline_response_200_7_header.md) | | [optional] +**SignedHeader2** | [**InlineResponse2007Header**](inline_response_200_7_header.md) | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/pkg/eth2spec/docs/InlineObject3.md b/pkg/eth2spec/docs/InlineObject3.md new file mode 100644 index 0000000..02f928f --- /dev/null +++ b/pkg/eth2spec/docs/InlineObject3.md @@ -0,0 +1,12 @@ +# InlineObject3 + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Message** | [**InlineResponse20014Message**](inline_response_200_14_message.md) | | [optional] +**Signature** | **string** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/pkg/eth2spec/docs/InlineResponse200.md b/pkg/eth2spec/docs/InlineResponse200.md new file mode 100644 index 0000000..fe1e6a2 --- /dev/null +++ b/pkg/eth2spec/docs/InlineResponse200.md @@ -0,0 +1,11 @@ +# InlineResponse200 + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Data** | [**InlineResponse200Data**](inline_response_200_data.md) | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/pkg/eth2spec/docs/InlineResponse2001.md b/pkg/eth2spec/docs/InlineResponse2001.md new file mode 100644 index 0000000..0a83453 --- /dev/null +++ b/pkg/eth2spec/docs/InlineResponse2001.md @@ -0,0 +1,11 @@ +# InlineResponse2001 + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Data** | [**InlineResponse2001Data**](inline_response_200_1_data.md) | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/pkg/eth2spec/docs/InlineResponse20010.md b/pkg/eth2spec/docs/InlineResponse20010.md new file mode 100644 index 0000000..74c2dc7 --- /dev/null +++ b/pkg/eth2spec/docs/InlineResponse20010.md @@ -0,0 +1,11 @@ +# InlineResponse20010 + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Data** | [**InlineResponse20010Data**](inline_response_200_10_data.md) | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/pkg/eth2spec/docs/InlineResponse20010Data.md b/pkg/eth2spec/docs/InlineResponse20010Data.md new file mode 100644 index 0000000..1964cc0 --- /dev/null +++ b/pkg/eth2spec/docs/InlineResponse20010Data.md @@ -0,0 +1,11 @@ +# InlineResponse20010Data + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Root** | **interface{}** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/pkg/eth2spec/docs/InlineResponse20011.md b/pkg/eth2spec/docs/InlineResponse20011.md new file mode 100644 index 0000000..4d4d795 --- /dev/null +++ b/pkg/eth2spec/docs/InlineResponse20011.md @@ -0,0 +1,11 @@ +# InlineResponse20011 + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Data** | [**[]InlineResponse20011Data1**](inline_response_200_11_data_1.md) | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/pkg/eth2spec/docs/InlineResponse20011Data.md b/pkg/eth2spec/docs/InlineResponse20011Data.md new file mode 100644 index 0000000..772432f --- /dev/null +++ b/pkg/eth2spec/docs/InlineResponse20011Data.md @@ -0,0 +1,15 @@ +# InlineResponse20011Data + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Slot** | **string** | | [optional] +**Index** | **string** | | [optional] +**BeaconBlockRoot** | **string** | | [optional] +**Source** | [**InlineResponse2003DataPreviousJustified**](inline_response_200_3_data_previous_justified.md) | | [optional] +**Target** | [**InlineResponse2003DataPreviousJustified**](inline_response_200_3_data_previous_justified.md) | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/pkg/eth2spec/docs/InlineResponse20011Data1.md b/pkg/eth2spec/docs/InlineResponse20011Data1.md new file mode 100644 index 0000000..81352cd --- /dev/null +++ b/pkg/eth2spec/docs/InlineResponse20011Data1.md @@ -0,0 +1,13 @@ +# InlineResponse20011Data1 + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**AggregationBits** | **string** | Attester aggregation bits. | [optional] +**Signature** | **string** | | [optional] +**Data** | [**InlineResponse20011Data**](inline_response_200_11_data.md) | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/pkg/eth2spec/docs/InlineResponse20012.md b/pkg/eth2spec/docs/InlineResponse20012.md new file mode 100644 index 0000000..0974e8d --- /dev/null +++ b/pkg/eth2spec/docs/InlineResponse20012.md @@ -0,0 +1,11 @@ +# InlineResponse20012 + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Data** | [**[]InlineResponse20012Data**](inline_response_200_12_data.md) | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/pkg/eth2spec/docs/InlineResponse20012Attestation1.md b/pkg/eth2spec/docs/InlineResponse20012Attestation1.md new file mode 100644 index 0000000..3222877 --- /dev/null +++ b/pkg/eth2spec/docs/InlineResponse20012Attestation1.md @@ -0,0 +1,13 @@ +# InlineResponse20012Attestation1 + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**AttestingIndices** | **[]string** | Attesting validator indices | [optional] +**Signature** | **string** | | [optional] +**Data** | [**InlineResponse20011Data**](inline_response_200_11_data.md) | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/pkg/eth2spec/docs/InlineResponse20012Data.md b/pkg/eth2spec/docs/InlineResponse20012Data.md new file mode 100644 index 0000000..ba73d76 --- /dev/null +++ b/pkg/eth2spec/docs/InlineResponse20012Data.md @@ -0,0 +1,12 @@ +# InlineResponse20012Data + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Attestation1** | [**InlineResponse20012Attestation1**](inline_response_200_12_attestation_1.md) | | [optional] +**Attestation2** | [**InlineResponse20012Attestation1**](inline_response_200_12_attestation_1.md) | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/pkg/eth2spec/docs/InlineResponse20013.md b/pkg/eth2spec/docs/InlineResponse20013.md new file mode 100644 index 0000000..6fa30b1 --- /dev/null +++ b/pkg/eth2spec/docs/InlineResponse20013.md @@ -0,0 +1,11 @@ +# InlineResponse20013 + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Data** | [**[]InlineResponse20013Data**](inline_response_200_13_data.md) | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/pkg/eth2spec/docs/InlineResponse20013Data.md b/pkg/eth2spec/docs/InlineResponse20013Data.md new file mode 100644 index 0000000..a1897ff --- /dev/null +++ b/pkg/eth2spec/docs/InlineResponse20013Data.md @@ -0,0 +1,12 @@ +# InlineResponse20013Data + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**SignedHeader1** | [**InlineResponse2007Header**](inline_response_200_7_header.md) | | [optional] +**SignedHeader2** | [**InlineResponse2007Header**](inline_response_200_7_header.md) | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/pkg/eth2spec/docs/InlineResponse20014.md b/pkg/eth2spec/docs/InlineResponse20014.md new file mode 100644 index 0000000..15d831e --- /dev/null +++ b/pkg/eth2spec/docs/InlineResponse20014.md @@ -0,0 +1,11 @@ +# InlineResponse20014 + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Data** | [**[]InlineResponse20014Data**](inline_response_200_14_data.md) | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/pkg/eth2spec/docs/InlineResponse20014Data.md b/pkg/eth2spec/docs/InlineResponse20014Data.md new file mode 100644 index 0000000..69b612b --- /dev/null +++ b/pkg/eth2spec/docs/InlineResponse20014Data.md @@ -0,0 +1,12 @@ +# InlineResponse20014Data + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Message** | [**InlineResponse20014Message**](inline_response_200_14_message.md) | | [optional] +**Signature** | **string** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/pkg/eth2spec/docs/InlineResponse20014Message.md b/pkg/eth2spec/docs/InlineResponse20014Message.md new file mode 100644 index 0000000..82db2e3 --- /dev/null +++ b/pkg/eth2spec/docs/InlineResponse20014Message.md @@ -0,0 +1,12 @@ +# InlineResponse20014Message + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Epoch** | **string** | | [optional] +**ValidatorIndex** | **string** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/pkg/eth2spec/docs/InlineResponse20015.md b/pkg/eth2spec/docs/InlineResponse20015.md new file mode 100644 index 0000000..11c44fb --- /dev/null +++ b/pkg/eth2spec/docs/InlineResponse20015.md @@ -0,0 +1,11 @@ +# InlineResponse20015 + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Data** | [**InlineResponse20015Data**](inline_response_200_15_data.md) | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/pkg/eth2spec/docs/InlineResponse20015Data.md b/pkg/eth2spec/docs/InlineResponse20015Data.md new file mode 100644 index 0000000..13ecbfe --- /dev/null +++ b/pkg/eth2spec/docs/InlineResponse20015Data.md @@ -0,0 +1,15 @@ +# InlineResponse20015Data + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**PeerId** | **string** | Cryptographic hash of a peer’s public key. [Read more](https://docs.libp2p.io/concepts/peer-id/) | [optional] +**Enr** | **string** | Ethereum node record. [Read more](https://eips.ethereum.org/EIPS/eip-778) | [optional] +**P2pAddresses** | **[]string** | | [optional] +**DiscoveryAddresses** | **[]string** | | [optional] +**Metadata** | [**InlineResponse20015DataMetadata**](inline_response_200_15_data_metadata.md) | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/pkg/eth2spec/docs/InlineResponse20015DataMetadata.md b/pkg/eth2spec/docs/InlineResponse20015DataMetadata.md new file mode 100644 index 0000000..01f9de1 --- /dev/null +++ b/pkg/eth2spec/docs/InlineResponse20015DataMetadata.md @@ -0,0 +1,12 @@ +# InlineResponse20015DataMetadata + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**SeqNumber** | **interface{}** | | [optional] +**Attnets** | **interface{}** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/pkg/eth2spec/docs/InlineResponse20016.md b/pkg/eth2spec/docs/InlineResponse20016.md new file mode 100644 index 0000000..b7a1cb7 --- /dev/null +++ b/pkg/eth2spec/docs/InlineResponse20016.md @@ -0,0 +1,11 @@ +# InlineResponse20016 + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Data** | [**[]InlineResponse20016Data**](inline_response_200_16_data.md) | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/pkg/eth2spec/docs/InlineResponse20016Data.md b/pkg/eth2spec/docs/InlineResponse20016Data.md new file mode 100644 index 0000000..b546616 --- /dev/null +++ b/pkg/eth2spec/docs/InlineResponse20016Data.md @@ -0,0 +1,15 @@ +# InlineResponse20016Data + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**PeerId** | **string** | Cryptographic hash of a peer’s public key. [Read more](https://docs.libp2p.io/concepts/peer-id/) | [optional] +**Enr** | **string** | Ethereum node record. [Read more](https://eips.ethereum.org/EIPS/eip-778) | [optional] +**Address** | **string** | [Read more](https://docs.libp2p.io/reference/glossary/#multiaddr) | [optional] +**State** | **string** | | [optional] +**Direction** | **string** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/pkg/eth2spec/docs/InlineResponse20017.md b/pkg/eth2spec/docs/InlineResponse20017.md new file mode 100644 index 0000000..6b8f1f7 --- /dev/null +++ b/pkg/eth2spec/docs/InlineResponse20017.md @@ -0,0 +1,11 @@ +# InlineResponse20017 + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Data** | [**InlineResponse20016Data**](inline_response_200_16_data.md) | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/pkg/eth2spec/docs/InlineResponse20018.md b/pkg/eth2spec/docs/InlineResponse20018.md new file mode 100644 index 0000000..faa60c0 --- /dev/null +++ b/pkg/eth2spec/docs/InlineResponse20018.md @@ -0,0 +1,11 @@ +# InlineResponse20018 + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Data** | [**InlineResponse20018Data**](inline_response_200_18_data.md) | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/pkg/eth2spec/docs/InlineResponse20018Data.md b/pkg/eth2spec/docs/InlineResponse20018Data.md new file mode 100644 index 0000000..c575148 --- /dev/null +++ b/pkg/eth2spec/docs/InlineResponse20018Data.md @@ -0,0 +1,11 @@ +# InlineResponse20018Data + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Version** | **string** | A string which uniquely identifies the client implementation and its version; similar to [HTTP User-Agent](https://tools.ietf.org/html/rfc7231#section-5.5.3). | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/pkg/eth2spec/docs/InlineResponse20019.md b/pkg/eth2spec/docs/InlineResponse20019.md new file mode 100644 index 0000000..c0f1d0b --- /dev/null +++ b/pkg/eth2spec/docs/InlineResponse20019.md @@ -0,0 +1,11 @@ +# InlineResponse20019 + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Data** | [**InlineResponse20019Data**](inline_response_200_19_data.md) | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/pkg/eth2spec/docs/InlineResponse20019Data.md b/pkg/eth2spec/docs/InlineResponse20019Data.md new file mode 100644 index 0000000..de72b25 --- /dev/null +++ b/pkg/eth2spec/docs/InlineResponse20019Data.md @@ -0,0 +1,12 @@ +# InlineResponse20019Data + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**HeadSlot** | **interface{}** | | [optional] +**SyncDistance** | **interface{}** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/pkg/eth2spec/docs/InlineResponse2001Data.md b/pkg/eth2spec/docs/InlineResponse2001Data.md new file mode 100644 index 0000000..a2358b3 --- /dev/null +++ b/pkg/eth2spec/docs/InlineResponse2001Data.md @@ -0,0 +1,11 @@ +# InlineResponse2001Data + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Root** | **interface{}** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/pkg/eth2spec/docs/InlineResponse2002.md b/pkg/eth2spec/docs/InlineResponse2002.md new file mode 100644 index 0000000..b78eac5 --- /dev/null +++ b/pkg/eth2spec/docs/InlineResponse2002.md @@ -0,0 +1,11 @@ +# InlineResponse2002 + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Data** | [**InlineResponse2002Data**](inline_response_200_2_data.md) | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/pkg/eth2spec/docs/InlineResponse20020.md b/pkg/eth2spec/docs/InlineResponse20020.md new file mode 100644 index 0000000..b6d53b1 --- /dev/null +++ b/pkg/eth2spec/docs/InlineResponse20020.md @@ -0,0 +1,11 @@ +# InlineResponse20020 + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Data** | [**[]InlineResponse2002Data**](inline_response_200_2_data.md) | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/pkg/eth2spec/docs/InlineResponse20021.md b/pkg/eth2spec/docs/InlineResponse20021.md new file mode 100644 index 0000000..8007010 --- /dev/null +++ b/pkg/eth2spec/docs/InlineResponse20021.md @@ -0,0 +1,11 @@ +# InlineResponse20021 + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Data** | [**map[string]interface{}**](.md) | Key value mapping of Phase 0[spec variables](https://github.com/ethereum/eth2.0-specs/blob/v0.11.1/configs/mainnet.yaml). Values are returned with following format: - any value starting with 0x in the spec is returned as a hex string - all other values are returned as number | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/pkg/eth2spec/docs/InlineResponse20022.md b/pkg/eth2spec/docs/InlineResponse20022.md new file mode 100644 index 0000000..dc163a5 --- /dev/null +++ b/pkg/eth2spec/docs/InlineResponse20022.md @@ -0,0 +1,11 @@ +# InlineResponse20022 + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Data** | [**InlineResponse20022Data**](inline_response_200_22_data.md) | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/pkg/eth2spec/docs/InlineResponse20022Data.md b/pkg/eth2spec/docs/InlineResponse20022Data.md new file mode 100644 index 0000000..78fd7a0 --- /dev/null +++ b/pkg/eth2spec/docs/InlineResponse20022Data.md @@ -0,0 +1,12 @@ +# InlineResponse20022Data + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ChainId** | **int32** | Id of Eth1 chain on which contract is deployed. | [optional] +**Address** | **string** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/pkg/eth2spec/docs/InlineResponse2002Data.md b/pkg/eth2spec/docs/InlineResponse2002Data.md new file mode 100644 index 0000000..0f9f702 --- /dev/null +++ b/pkg/eth2spec/docs/InlineResponse2002Data.md @@ -0,0 +1,13 @@ +# InlineResponse2002Data + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**PreviousVersion** | **string** | a fork version number | [optional] +**CurrentVersion** | **string** | a fork version number | [optional] +**Epoch** | **string** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/pkg/eth2spec/docs/InlineResponse2003.md b/pkg/eth2spec/docs/InlineResponse2003.md new file mode 100644 index 0000000..3f80207 --- /dev/null +++ b/pkg/eth2spec/docs/InlineResponse2003.md @@ -0,0 +1,11 @@ +# InlineResponse2003 + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Data** | [**InlineResponse2003Data**](inline_response_200_3_data.md) | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/pkg/eth2spec/docs/InlineResponse2003Data.md b/pkg/eth2spec/docs/InlineResponse2003Data.md new file mode 100644 index 0000000..2e1654d --- /dev/null +++ b/pkg/eth2spec/docs/InlineResponse2003Data.md @@ -0,0 +1,13 @@ +# InlineResponse2003Data + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**PreviousJustified** | [**InlineResponse2003DataPreviousJustified**](inline_response_200_3_data_previous_justified.md) | | [optional] +**CurrentJustified** | [**InlineResponse2003DataPreviousJustified**](inline_response_200_3_data_previous_justified.md) | | [optional] +**Finalized** | [**InlineResponse2003DataPreviousJustified**](inline_response_200_3_data_previous_justified.md) | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/pkg/eth2spec/docs/InlineResponse2003DataPreviousJustified.md b/pkg/eth2spec/docs/InlineResponse2003DataPreviousJustified.md new file mode 100644 index 0000000..dd8f2de --- /dev/null +++ b/pkg/eth2spec/docs/InlineResponse2003DataPreviousJustified.md @@ -0,0 +1,12 @@ +# InlineResponse2003DataPreviousJustified + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Epoch** | **string** | | [optional] +**Root** | **string** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/pkg/eth2spec/docs/InlineResponse2004.md b/pkg/eth2spec/docs/InlineResponse2004.md new file mode 100644 index 0000000..0241968 --- /dev/null +++ b/pkg/eth2spec/docs/InlineResponse2004.md @@ -0,0 +1,11 @@ +# InlineResponse2004 + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Data** | [**[]InlineResponse2004Data**](inline_response_200_4_data.md) | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/pkg/eth2spec/docs/InlineResponse2004Data.md b/pkg/eth2spec/docs/InlineResponse2004Data.md new file mode 100644 index 0000000..0b45809 --- /dev/null +++ b/pkg/eth2spec/docs/InlineResponse2004Data.md @@ -0,0 +1,14 @@ +# InlineResponse2004Data + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Index** | **string** | | [optional] +**Balance** | **string** | | [optional] +**Status** | **string** | Possible statuses: - **pending_initialized** - When the first deposit is processed, but not enough funds are available (or not yet the end of the first epoch) to get validator into the activation queue. - **pending_queued** - When validator is waiting to get activated, and have enough funds etc. while in the queue, validator activation epoch keeps changing until it gets to the front and make it through (finalization is a requirement here too). - **active_ongoing** - When validator must be attesting, and have not initiated any exit. - **active_exiting** - When validator is still active, but filed a voluntary request to exit. - **active_slashed** - When validator is still active, but have a slashed status and is scheduled to exit. - **exited_unslashed** - When validator has reached reguler exit epoch, not being slashed, and doesn't have to attest any more, but cannot withdraw yet. - **exited_slashed** - When validator has reached reguler exit epoch, but was slashed, have to wait for a longer withdrawal period. - **withdrawal_possible** - After validator has exited, a while later is permitted to move funds, and is truly out of the system. - **withdrawal_done** - (not possible in phase0, except slashing full balance) - actually having moved funds away [Validator status specification](https://hackmd.io/ofFJ5gOmQpu1jjHilHbdQQ) | [optional] +**Validator** | [**InlineResponse2004Validator**](inline_response_200_4_validator.md) | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/pkg/eth2spec/docs/InlineResponse2004Validator.md b/pkg/eth2spec/docs/InlineResponse2004Validator.md new file mode 100644 index 0000000..7661a8c --- /dev/null +++ b/pkg/eth2spec/docs/InlineResponse2004Validator.md @@ -0,0 +1,18 @@ +# InlineResponse2004Validator + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Pubkey** | **string** | The validator's BLS public key, uniquely identifying them. _48-bytes, hex encoded with 0x prefix, case insensitive._ | [optional] +**WithdrawalCredentials** | **string** | | [optional] +**EffectiveBalance** | **string** | | [optional] +**Slashed** | **bool** | Was validator slashed (not longer active). | [optional] +**ActivationEligibilityEpoch** | **string** | | [optional] +**ActivationEpoch** | **string** | | [optional] +**ExitEpoch** | **string** | | [optional] +**WithdrawableEpoch** | **string** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/pkg/eth2spec/docs/InlineResponse2005.md b/pkg/eth2spec/docs/InlineResponse2005.md new file mode 100644 index 0000000..98289bf --- /dev/null +++ b/pkg/eth2spec/docs/InlineResponse2005.md @@ -0,0 +1,11 @@ +# InlineResponse2005 + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Data** | [**InlineResponse2004Data**](inline_response_200_4_data.md) | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/pkg/eth2spec/docs/InlineResponse2006.md b/pkg/eth2spec/docs/InlineResponse2006.md new file mode 100644 index 0000000..e83ea62 --- /dev/null +++ b/pkg/eth2spec/docs/InlineResponse2006.md @@ -0,0 +1,11 @@ +# InlineResponse2006 + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Data** | [**[]InlineResponse2006Data**](inline_response_200_6_data.md) | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/pkg/eth2spec/docs/InlineResponse2006Data.md b/pkg/eth2spec/docs/InlineResponse2006Data.md new file mode 100644 index 0000000..58ee8e1 --- /dev/null +++ b/pkg/eth2spec/docs/InlineResponse2006Data.md @@ -0,0 +1,13 @@ +# InlineResponse2006Data + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Index** | **string** | | [optional] +**Slot** | **string** | | [optional] +**Validators** | **[]string** | List of validator indices assigned to this committee | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/pkg/eth2spec/docs/InlineResponse2007.md b/pkg/eth2spec/docs/InlineResponse2007.md new file mode 100644 index 0000000..1229e24 --- /dev/null +++ b/pkg/eth2spec/docs/InlineResponse2007.md @@ -0,0 +1,11 @@ +# InlineResponse2007 + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Data** | [**[]InlineResponse2007Data**](inline_response_200_7_data.md) | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/pkg/eth2spec/docs/InlineResponse2007Data.md b/pkg/eth2spec/docs/InlineResponse2007Data.md new file mode 100644 index 0000000..e863c80 --- /dev/null +++ b/pkg/eth2spec/docs/InlineResponse2007Data.md @@ -0,0 +1,13 @@ +# InlineResponse2007Data + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Root** | **string** | | [optional] +**Canonical** | **bool** | | [optional] +**Header** | [**InlineResponse2007Header**](inline_response_200_7_header.md) | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/pkg/eth2spec/docs/InlineResponse2007Header.md b/pkg/eth2spec/docs/InlineResponse2007Header.md new file mode 100644 index 0000000..8b9acee --- /dev/null +++ b/pkg/eth2spec/docs/InlineResponse2007Header.md @@ -0,0 +1,12 @@ +# InlineResponse2007Header + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Message** | **map[string]interface{}** | The [`BeaconBlockHeader`](https://github.com/ethereum/eth2.0-specs/blob/v0.11.1/specs/phase0/beacon-chain.md#beaconblockheader) object from the Eth2.0 spec. | [optional] +**Signature** | **string** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/pkg/eth2spec/docs/InlineResponse2008.md b/pkg/eth2spec/docs/InlineResponse2008.md new file mode 100644 index 0000000..749e784 --- /dev/null +++ b/pkg/eth2spec/docs/InlineResponse2008.md @@ -0,0 +1,11 @@ +# InlineResponse2008 + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Data** | [**InlineResponse2008Data**](inline_response_200_8_data.md) | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/pkg/eth2spec/docs/InlineResponse2008Data.md b/pkg/eth2spec/docs/InlineResponse2008Data.md new file mode 100644 index 0000000..a80ef24 --- /dev/null +++ b/pkg/eth2spec/docs/InlineResponse2008Data.md @@ -0,0 +1,12 @@ +# InlineResponse2008Data + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Canonical** | **bool** | | [optional] +**Header** | [**InlineResponse2007Header**](inline_response_200_7_header.md) | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/pkg/eth2spec/docs/InlineResponse2009.md b/pkg/eth2spec/docs/InlineResponse2009.md new file mode 100644 index 0000000..95e18cd --- /dev/null +++ b/pkg/eth2spec/docs/InlineResponse2009.md @@ -0,0 +1,11 @@ +# InlineResponse2009 + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Data** | [**InlineResponse2009Data**](inline_response_200_9_data.md) | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/pkg/eth2spec/docs/InlineResponse2009Data.md b/pkg/eth2spec/docs/InlineResponse2009Data.md new file mode 100644 index 0000000..acf73ce --- /dev/null +++ b/pkg/eth2spec/docs/InlineResponse2009Data.md @@ -0,0 +1,12 @@ +# InlineResponse2009Data + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Message** | **map[string]interface{}** | The [`BeaconBlock`](https://github.com/ethereum/eth2.0-specs/blob/v0.11.1/specs/phase0/beacon-chain.md#beaconblock) object from the Eth2.0 spec. | [optional] +**Signature** | **string** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/pkg/eth2spec/docs/InlineResponse200Data.md b/pkg/eth2spec/docs/InlineResponse200Data.md new file mode 100644 index 0000000..efc6e80 --- /dev/null +++ b/pkg/eth2spec/docs/InlineResponse200Data.md @@ -0,0 +1,13 @@ +# InlineResponse200Data + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**GenesisTime** | **string** | | [optional] +**GenesisValidatorsRoot** | **string** | | [optional] +**GenesisForkVersion** | **string** | a fork version number | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/pkg/eth2spec/docs/MinimalValidatorApiApi.md b/pkg/eth2spec/docs/MinimalValidatorApiApi.md new file mode 100644 index 0000000..f9d9b86 --- /dev/null +++ b/pkg/eth2spec/docs/MinimalValidatorApiApi.md @@ -0,0 +1,176 @@ +# \MinimalValidatorApiApi + +All URIs are relative to *http://public-mainnet-node.ethereum.org/api* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**GetGenesis**](MinimalValidatorApiApi.md#GetGenesis) | **Get** /v1/beacon/genesis | Retrieve details of the chain's genesis. +[**GetStateFork**](MinimalValidatorApiApi.md#GetStateFork) | **Get** /v1/beacon/states/{state_id}/fork | Get Fork object for requested state +[**GetStateValidator**](MinimalValidatorApiApi.md#GetStateValidator) | **Get** /v1/beacon/states/{state_id}/validators/{validator_id} | Get validator from state by id +[**GetSyncingStatus**](MinimalValidatorApiApi.md#GetSyncingStatus) | **Get** /v1/node/syncing | Get node syncing status +[**SubmitPoolAttestations**](MinimalValidatorApiApi.md#SubmitPoolAttestations) | **Post** /v1/beacon/pool/attestations | Submit Attestation object to node + + + +## GetGenesis + +> InlineResponse200 GetGenesis(ctx, ) + +Retrieve details of the chain's genesis. + +Retrieve details of the chain's genesis which can be used to identify chain. + +### Required Parameters + +This endpoint does not need any parameter. + +### Return type + +[**InlineResponse200**](inline_response_200.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## GetStateFork + +> InlineResponse2002 GetStateFork(ctx, stateId) + +Get Fork object for requested state + +Returns [Fork](https://github.com/ethereum/eth2.0-specs/blob/v0.11.1/specs/phase0/beacon-chain.md#fork) object for state with given 'stateId'. + +### Required Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**stateId** | **string**| State identifier. Can be one of: \"head\" (canonical head in node's view), \"genesis\", \"finalized\", \"justified\", \\<slot\\>, \\<hex encoded stateRoot with 0x prefix\\>. | + +### Return type + +[**InlineResponse2002**](inline_response_200_2.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## GetStateValidator + +> InlineResponse2005 GetStateValidator(ctx, stateId, validatorId) + +Get validator from state by id + +Returns validator specified by state and id or public key along with status and balance. + +### Required Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**stateId** | **string**| State identifier. Can be one of: \"head\" (canonical head in node's view), \"genesis\", \"finalized\", \"justified\", \\<slot\\>, \\<hex encoded stateRoot with 0x prefix\\>. | +**validatorId** | **string**| Either hex encoded public key (with 0x prefix) or validator index | + +### Return type + +[**InlineResponse2005**](inline_response_200_5.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## GetSyncingStatus + +> InlineResponse20019 GetSyncingStatus(ctx, ) + +Get node syncing status + +Requests the beacon node to describe if it's currently syncing or not, and if it is, what block it is up to. + +### Required Parameters + +This endpoint does not need any parameter. + +### Return type + +[**InlineResponse20019**](inline_response_200_19.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## SubmitPoolAttestations + +> SubmitPoolAttestations(ctx, inlineObject) + +Submit Attestation object to node + +Submits Attestation object to node. If attestation passes all validation constraints, node MUST publish attestation on appropriate subnet. + +### Required Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**inlineObject** | [**InlineObject**](InlineObject.md)| | + +### Return type + + (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + diff --git a/pkg/eth2spec/docs/NetworkIdentity.md b/pkg/eth2spec/docs/NetworkIdentity.md new file mode 100644 index 0000000..cc5ea6f --- /dev/null +++ b/pkg/eth2spec/docs/NetworkIdentity.md @@ -0,0 +1,15 @@ +# NetworkIdentity + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**PeerId** | **string** | Cryptographic hash of a peer’s public key. [Read more](https://docs.libp2p.io/concepts/peer-id/) | [optional] +**Enr** | **string** | Ethereum node record. [Read more](https://eips.ethereum.org/EIPS/eip-778) | [optional] +**P2pAddresses** | **[]string** | | [optional] +**DiscoveryAddresses** | **[]string** | | [optional] +**Metadata** | [**InlineResponse20015DataMetadata**](inline_response_200_15_data_metadata.md) | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/pkg/eth2spec/docs/NodeApi.md b/pkg/eth2spec/docs/NodeApi.md new file mode 100644 index 0000000..5f28251 --- /dev/null +++ b/pkg/eth2spec/docs/NodeApi.md @@ -0,0 +1,198 @@ +# \NodeApi + +All URIs are relative to *http://public-mainnet-node.ethereum.org/api* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**GetHealth**](NodeApi.md#GetHealth) | **Get** /v1/node/health | Get health check +[**GetNetworkIdentity**](NodeApi.md#GetNetworkIdentity) | **Get** /v1/node/identity | Get node network identity +[**GetNodeVersion**](NodeApi.md#GetNodeVersion) | **Get** /v1/node/version | Get version string of the running beacon node. +[**GetPeer**](NodeApi.md#GetPeer) | **Get** /v1/node/peers/{peer_id} | Get peer +[**GetPeers**](NodeApi.md#GetPeers) | **Get** /v1/node/peers | Get node network peers +[**GetSyncingStatus**](NodeApi.md#GetSyncingStatus) | **Get** /v1/node/syncing | Get node syncing status + + + +## GetHealth + +> GetHealth(ctx, ) + +Get health check + +Returns node health status in http status codes. Useful for load balancers. + +### Required Parameters + +This endpoint does not need any parameter. + +### Return type + + (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## GetNetworkIdentity + +> InlineResponse20015 GetNetworkIdentity(ctx, ) + +Get node network identity + +Retrieves data about the node's network presence + +### Required Parameters + +This endpoint does not need any parameter. + +### Return type + +[**InlineResponse20015**](inline_response_200_15.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## GetNodeVersion + +> InlineResponse20018 GetNodeVersion(ctx, ) + +Get version string of the running beacon node. + +Requests that the beacon node identify information about its implementation in a format similar to a [HTTP User-Agent](https://tools.ietf.org/html/rfc7231#section-5.5.3) field. + +### Required Parameters + +This endpoint does not need any parameter. + +### Return type + +[**InlineResponse20018**](inline_response_200_18.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## GetPeer + +> InlineResponse20017 GetPeer(ctx, peerId) + +Get peer + +Retrieves data about the given peer + +### Required Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**peerId** | **string**| | + +### Return type + +[**InlineResponse20017**](inline_response_200_17.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## GetPeers + +> InlineResponse20016 GetPeers(ctx, ) + +Get node network peers + +Retrieves data about the node's network peers + +### Required Parameters + +This endpoint does not need any parameter. + +### Return type + +[**InlineResponse20016**](inline_response_200_16.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## GetSyncingStatus + +> InlineResponse20019 GetSyncingStatus(ctx, ) + +Get node syncing status + +Requests the beacon node to describe if it's currently syncing or not, and if it is, what block it is up to. + +### Required Parameters + +This endpoint does not need any parameter. + +### Return type + +[**InlineResponse20019**](inline_response_200_19.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + diff --git a/pkg/eth2spec/docs/Peer.md b/pkg/eth2spec/docs/Peer.md new file mode 100644 index 0000000..6224176 --- /dev/null +++ b/pkg/eth2spec/docs/Peer.md @@ -0,0 +1,15 @@ +# Peer + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**PeerId** | **string** | Cryptographic hash of a peer’s public key. [Read more](https://docs.libp2p.io/concepts/peer-id/) | [optional] +**Enr** | **string** | Ethereum node record. [Read more](https://eips.ethereum.org/EIPS/eip-778) | [optional] +**Address** | **string** | [Read more](https://docs.libp2p.io/reference/glossary/#multiaddr) | [optional] +**State** | **string** | | [optional] +**Direction** | **string** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/pkg/eth2spec/docs/ProposerSlashing.md b/pkg/eth2spec/docs/ProposerSlashing.md new file mode 100644 index 0000000..a794c94 --- /dev/null +++ b/pkg/eth2spec/docs/ProposerSlashing.md @@ -0,0 +1,12 @@ +# ProposerSlashing + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**SignedHeader1** | [**InlineResponse2007Header**](inline_response_200_7_header.md) | | [optional] +**SignedHeader2** | [**InlineResponse2007Header**](inline_response_200_7_header.md) | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/pkg/eth2spec/docs/SignedAggregateAndProof.md b/pkg/eth2spec/docs/SignedAggregateAndProof.md new file mode 100644 index 0000000..e765790 --- /dev/null +++ b/pkg/eth2spec/docs/SignedAggregateAndProof.md @@ -0,0 +1,12 @@ +# SignedAggregateAndProof + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Message** | **map[string]interface{}** | | [optional] +**Signature** | **string** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/pkg/eth2spec/docs/SignedBeaconBlock.md b/pkg/eth2spec/docs/SignedBeaconBlock.md new file mode 100644 index 0000000..60f263e --- /dev/null +++ b/pkg/eth2spec/docs/SignedBeaconBlock.md @@ -0,0 +1,12 @@ +# SignedBeaconBlock + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Message** | **map[string]interface{}** | The [`BeaconBlock`](https://github.com/ethereum/eth2.0-specs/blob/v0.11.1/specs/phase0/beacon-chain.md#beaconblock) object from the Eth2.0 spec. | [optional] +**Signature** | **string** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/pkg/eth2spec/docs/SignedBeaconBlockHeader.md b/pkg/eth2spec/docs/SignedBeaconBlockHeader.md new file mode 100644 index 0000000..5f688c2 --- /dev/null +++ b/pkg/eth2spec/docs/SignedBeaconBlockHeader.md @@ -0,0 +1,12 @@ +# SignedBeaconBlockHeader + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Message** | **map[string]interface{}** | The [`BeaconBlockHeader`](https://github.com/ethereum/eth2.0-specs/blob/v0.11.1/specs/phase0/beacon-chain.md#beaconblockheader) object from the Eth2.0 spec. | [optional] +**Signature** | **string** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/pkg/eth2spec/docs/SignedVoluntaryExit.md b/pkg/eth2spec/docs/SignedVoluntaryExit.md new file mode 100644 index 0000000..f1c9a9a --- /dev/null +++ b/pkg/eth2spec/docs/SignedVoluntaryExit.md @@ -0,0 +1,12 @@ +# SignedVoluntaryExit + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Message** | [**InlineResponse20014Message**](inline_response_200_14_message.md) | | [optional] +**Signature** | **string** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/pkg/eth2spec/docs/ValidatorRequiredApiApi.md b/pkg/eth2spec/docs/ValidatorRequiredApiApi.md new file mode 100644 index 0000000..6171908 --- /dev/null +++ b/pkg/eth2spec/docs/ValidatorRequiredApiApi.md @@ -0,0 +1,176 @@ +# \ValidatorRequiredApiApi + +All URIs are relative to *http://public-mainnet-node.ethereum.org/api* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**GetGenesis**](ValidatorRequiredApiApi.md#GetGenesis) | **Get** /v1/beacon/genesis | Retrieve details of the chain's genesis. +[**GetStateFork**](ValidatorRequiredApiApi.md#GetStateFork) | **Get** /v1/beacon/states/{state_id}/fork | Get Fork object for requested state +[**GetStateValidator**](ValidatorRequiredApiApi.md#GetStateValidator) | **Get** /v1/beacon/states/{state_id}/validators/{validator_id} | Get validator from state by id +[**GetSyncingStatus**](ValidatorRequiredApiApi.md#GetSyncingStatus) | **Get** /v1/node/syncing | Get node syncing status +[**SubmitPoolAttestations**](ValidatorRequiredApiApi.md#SubmitPoolAttestations) | **Post** /v1/beacon/pool/attestations | Submit Attestation object to node + + + +## GetGenesis + +> InlineResponse200 GetGenesis(ctx, ) + +Retrieve details of the chain's genesis. + +Retrieve details of the chain's genesis which can be used to identify chain. + +### Required Parameters + +This endpoint does not need any parameter. + +### Return type + +[**InlineResponse200**](inline_response_200.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## GetStateFork + +> InlineResponse2002 GetStateFork(ctx, stateId) + +Get Fork object for requested state + +Returns [Fork](https://github.com/ethereum/eth2.0-specs/blob/v0.11.1/specs/phase0/beacon-chain.md#fork) object for state with given 'stateId'. + +### Required Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**stateId** | **string**| State identifier. Can be one of: \"head\" (canonical head in node's view), \"genesis\", \"finalized\", \"justified\", \\<slot\\>, \\<hex encoded stateRoot with 0x prefix\\>. | + +### Return type + +[**InlineResponse2002**](inline_response_200_2.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## GetStateValidator + +> InlineResponse2005 GetStateValidator(ctx, stateId, validatorId) + +Get validator from state by id + +Returns validator specified by state and id or public key along with status and balance. + +### Required Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**stateId** | **string**| State identifier. Can be one of: \"head\" (canonical head in node's view), \"genesis\", \"finalized\", \"justified\", \\<slot\\>, \\<hex encoded stateRoot with 0x prefix\\>. | +**validatorId** | **string**| Either hex encoded public key (with 0x prefix) or validator index | + +### Return type + +[**InlineResponse2005**](inline_response_200_5.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## GetSyncingStatus + +> InlineResponse20019 GetSyncingStatus(ctx, ) + +Get node syncing status + +Requests the beacon node to describe if it's currently syncing or not, and if it is, what block it is up to. + +### Required Parameters + +This endpoint does not need any parameter. + +### Return type + +[**InlineResponse20019**](inline_response_200_19.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## SubmitPoolAttestations + +> SubmitPoolAttestations(ctx, inlineObject) + +Submit Attestation object to node + +Submits Attestation object to node. If attestation passes all validation constraints, node MUST publish attestation on appropriate subnet. + +### Required Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**inlineObject** | [**InlineObject**](InlineObject.md)| | + +### Return type + + (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + diff --git a/pkg/eth2spec/docs/ValidatorResponse.md b/pkg/eth2spec/docs/ValidatorResponse.md new file mode 100644 index 0000000..6919bfd --- /dev/null +++ b/pkg/eth2spec/docs/ValidatorResponse.md @@ -0,0 +1,14 @@ +# ValidatorResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Index** | **string** | | [optional] +**Balance** | **string** | | [optional] +**Status** | **string** | Possible statuses: - **pending_initialized** - When the first deposit is processed, but not enough funds are available (or not yet the end of the first epoch) to get validator into the activation queue. - **pending_queued** - When validator is waiting to get activated, and have enough funds etc. while in the queue, validator activation epoch keeps changing until it gets to the front and make it through (finalization is a requirement here too). - **active_ongoing** - When validator must be attesting, and have not initiated any exit. - **active_exiting** - When validator is still active, but filed a voluntary request to exit. - **active_slashed** - When validator is still active, but have a slashed status and is scheduled to exit. - **exited_unslashed** - When validator has reached reguler exit epoch, not being slashed, and doesn't have to attest any more, but cannot withdraw yet. - **exited_slashed** - When validator has reached reguler exit epoch, but was slashed, have to wait for a longer withdrawal period. - **withdrawal_possible** - After validator has exited, a while later is permitted to move funds, and is truly out of the system. - **withdrawal_done** - (not possible in phase0, except slashing full balance) - actually having moved funds away [Validator status specification](https://hackmd.io/ofFJ5gOmQpu1jjHilHbdQQ) | [optional] +**Validator** | [**InlineResponse2004Validator**](inline_response_200_4_validator.md) | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/pkg/eth2spec/docs/ValidatorStatus.md b/pkg/eth2spec/docs/ValidatorStatus.md new file mode 100644 index 0000000..fe214c4 --- /dev/null +++ b/pkg/eth2spec/docs/ValidatorStatus.md @@ -0,0 +1,10 @@ +# ValidatorStatus + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/pkg/eth2spec/model_attestation.go b/pkg/eth2spec/model_attestation.go new file mode 100644 index 0000000..7fceee2 --- /dev/null +++ b/pkg/eth2spec/model_attestation.go @@ -0,0 +1,17 @@ +/* + * Eth2 Beacon Node API + * + * API specification for the beacon node, which enables users to query and participate in Ethereum 2.0 phase 0 beacon chain. + * + * API version: Dev - Eth2Spec v0.11.1 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package eth2spec +// Attestation The [`Attestation`](https://github.com/ethereum/eth2.0-specs/blob/v0.11.1/specs/phase0/beacon-chain.md#attestation) object from the Eth2.0 spec. +type Attestation struct { + // Attester aggregation bits. + AggregationBits string `json:"aggregation_bits,omitempty"` + Signature string `json:"signature,omitempty"` + Data InlineResponse20011Data `json:"data,omitempty"` +} diff --git a/pkg/eth2spec/model_attester_duty.go b/pkg/eth2spec/model_attester_duty.go new file mode 100644 index 0000000..d4b399b --- /dev/null +++ b/pkg/eth2spec/model_attester_duty.go @@ -0,0 +1,18 @@ +/* + * Eth2 Beacon Node API + * + * API specification for the beacon node, which enables users to query and participate in Ethereum 2.0 phase 0 beacon chain. + * + * API version: Dev - Eth2Spec v0.11.1 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package eth2spec +// AttesterDuty struct for AttesterDuty +type AttesterDuty struct { + // The validator's BLS public key, uniquely identifying them. _48-bytes, hex encoded with 0x prefix, case insensitive._ + ValidatorPubkey string `json:"validator_pubkey,omitempty"` + AggregatorModulo string `json:"aggregator_modulo,omitempty"` + AttestationSlot string `json:"attestation_slot,omitempty"` + CommitteeIndex string `json:"committee_index,omitempty"` +} diff --git a/pkg/eth2spec/model_attester_slashing.go b/pkg/eth2spec/model_attester_slashing.go new file mode 100644 index 0000000..c8308b9 --- /dev/null +++ b/pkg/eth2spec/model_attester_slashing.go @@ -0,0 +1,15 @@ +/* + * Eth2 Beacon Node API + * + * API specification for the beacon node, which enables users to query and participate in Ethereum 2.0 phase 0 beacon chain. + * + * API version: Dev - Eth2Spec v0.11.1 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package eth2spec +// AttesterSlashing The [`AttesterSlashing`](https://github.com/ethereum/eth2.0-specs/blob/v0.11.1/specs/core/0_beacon-chain.md#attesterslashing) object from the Eth2.0 spec. +type AttesterSlashing struct { + Attestation1 InlineResponse20012Attestation1 `json:"attestation_1,omitempty"` + Attestation2 InlineResponse20012Attestation1 `json:"attestation_2,omitempty"` +} diff --git a/pkg/eth2spec/model_beacon_block.go b/pkg/eth2spec/model_beacon_block.go new file mode 100644 index 0000000..d64a2d2 --- /dev/null +++ b/pkg/eth2spec/model_beacon_block.go @@ -0,0 +1,18 @@ +/* + * Eth2 Beacon Node API + * + * API specification for the beacon node, which enables users to query and participate in Ethereum 2.0 phase 0 beacon chain. + * + * API version: Dev - Eth2Spec v0.11.1 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package eth2spec +// BeaconBlock The [`BeaconBlock`](https://github.com/ethereum/eth2.0-specs/blob/v0.11.1/specs/phase0/beacon-chain.md#beaconblock) object from the Eth2.0 spec. +type BeaconBlock struct { + Slot string `json:"slot,omitempty"` + ProposerIndex string `json:"proposer_index,omitempty"` + ParentRoot string `json:"parent_root,omitempty"` + StateRoot string `json:"state_root,omitempty"` + Body BeaconBlockAllOf1Body `json:"body,omitempty"` +} diff --git a/pkg/eth2spec/model_beacon_block_all_of.go b/pkg/eth2spec/model_beacon_block_all_of.go new file mode 100644 index 0000000..b63896b --- /dev/null +++ b/pkg/eth2spec/model_beacon_block_all_of.go @@ -0,0 +1,17 @@ +/* + * Eth2 Beacon Node API + * + * API specification for the beacon node, which enables users to query and participate in Ethereum 2.0 phase 0 beacon chain. + * + * API version: Dev - Eth2Spec v0.11.1 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package eth2spec +// BeaconBlockAllOf struct for BeaconBlockAllOf +type BeaconBlockAllOf struct { + Slot string `json:"slot,omitempty"` + ProposerIndex string `json:"proposer_index,omitempty"` + ParentRoot string `json:"parent_root,omitempty"` + StateRoot string `json:"state_root,omitempty"` +} diff --git a/pkg/eth2spec/model_beacon_block_all_of_1.go b/pkg/eth2spec/model_beacon_block_all_of_1.go new file mode 100644 index 0000000..acdb1d1 --- /dev/null +++ b/pkg/eth2spec/model_beacon_block_all_of_1.go @@ -0,0 +1,14 @@ +/* + * Eth2 Beacon Node API + * + * API specification for the beacon node, which enables users to query and participate in Ethereum 2.0 phase 0 beacon chain. + * + * API version: Dev - Eth2Spec v0.11.1 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package eth2spec +// BeaconBlockAllOf1 struct for BeaconBlockAllOf1 +type BeaconBlockAllOf1 struct { + Body BeaconBlockAllOf1Body `json:"body,omitempty"` +} diff --git a/pkg/eth2spec/model_beacon_block_all_of_1_body.go b/pkg/eth2spec/model_beacon_block_all_of_1_body.go new file mode 100644 index 0000000..a9bd2e1 --- /dev/null +++ b/pkg/eth2spec/model_beacon_block_all_of_1_body.go @@ -0,0 +1,21 @@ +/* + * Eth2 Beacon Node API + * + * API specification for the beacon node, which enables users to query and participate in Ethereum 2.0 phase 0 beacon chain. + * + * API version: Dev - Eth2Spec v0.11.1 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package eth2spec +// BeaconBlockAllOf1Body The [`BeaconBlockBody`](https://github.com/ethereum/eth2.0-specs/blob/v0.11.1/specs/phase0/beacon-chain.md#beaconblockbody) object from the Eth2.0 spec. +type BeaconBlockAllOf1Body struct { + RandaoReveal string `json:"randao_reveal,omitempty"` + Eth1Data BeaconBlockAllOf1BodyEth1Data `json:"eth1_data,omitempty"` + Graffiti string `json:"graffiti,omitempty"` + ProposerSlashings []InlineResponse20013Data `json:"proposer_slashings,omitempty"` + AttesterSlashings []InlineResponse20012Data `json:"attester_slashings,omitempty"` + Attestations []InlineResponse20011Data1 `json:"attestations,omitempty"` + Deposits []BeaconBlockAllOf1BodyDeposits `json:"deposits,omitempty"` + VoluntaryExits []InlineResponse20014Message `json:"voluntary_exits,omitempty"` +} diff --git a/pkg/eth2spec/model_beacon_block_all_of_1_body_data.go b/pkg/eth2spec/model_beacon_block_all_of_1_body_data.go new file mode 100644 index 0000000..18d793c --- /dev/null +++ b/pkg/eth2spec/model_beacon_block_all_of_1_body_data.go @@ -0,0 +1,18 @@ +/* + * Eth2 Beacon Node API + * + * API specification for the beacon node, which enables users to query and participate in Ethereum 2.0 phase 0 beacon chain. + * + * API version: Dev - Eth2Spec v0.11.1 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package eth2spec +// BeaconBlockAllOf1BodyData The [`DepositData`](https://github.com/ethereum/eth2.0-specs/blob/v0.11.1/specs/phase0/beacon-chain.md#depositdata) object from the Eth2.0 spec. +type BeaconBlockAllOf1BodyData struct { + // The validator's BLS public key, uniquely identifying them. _48-bytes, hex encoded with 0x prefix, case insensitive._ + Pubkey string `json:"pubkey,omitempty"` + WithdrawalCredentials string `json:"withdrawal_credentials,omitempty"` + Amount string `json:"amount,omitempty"` + Signature string `json:"signature,omitempty"` +} diff --git a/pkg/eth2spec/model_beacon_block_all_of_1_body_deposits.go b/pkg/eth2spec/model_beacon_block_all_of_1_body_deposits.go new file mode 100644 index 0000000..d5bd052 --- /dev/null +++ b/pkg/eth2spec/model_beacon_block_all_of_1_body_deposits.go @@ -0,0 +1,16 @@ +/* + * Eth2 Beacon Node API + * + * API specification for the beacon node, which enables users to query and participate in Ethereum 2.0 phase 0 beacon chain. + * + * API version: Dev - Eth2Spec v0.11.1 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package eth2spec +// BeaconBlockAllOf1BodyDeposits The [`Deposit`](https://github.com/ethereum/eth2.0-specs/blob/v0.11.1/specs/phase0/beacon-chain.md#deposit) object from the Eth2.0 spec. +type BeaconBlockAllOf1BodyDeposits struct { + // Branch in the deposit tree. + Proof []string `json:"proof,omitempty"` + Data BeaconBlockAllOf1BodyData `json:"data,omitempty"` +} diff --git a/pkg/eth2spec/model_beacon_block_all_of_1_body_eth1_data.go b/pkg/eth2spec/model_beacon_block_all_of_1_body_eth1_data.go new file mode 100644 index 0000000..1c251b4 --- /dev/null +++ b/pkg/eth2spec/model_beacon_block_all_of_1_body_eth1_data.go @@ -0,0 +1,16 @@ +/* + * Eth2 Beacon Node API + * + * API specification for the beacon node, which enables users to query and participate in Ethereum 2.0 phase 0 beacon chain. + * + * API version: Dev - Eth2Spec v0.11.1 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package eth2spec +// BeaconBlockAllOf1BodyEth1Data The [`Eth1Data`](https://github.com/ethereum/eth2.0-specs/blob/v0.11.1/specs/phase0/beacon-chain.md#eth1data) object from the Eth2.0 spec. +type BeaconBlockAllOf1BodyEth1Data struct { + DepositRoot string `json:"deposit_root,omitempty"` + DepositCount string `json:"deposit_count,omitempty"` + BlockHash string `json:"block_hash,omitempty"` +} diff --git a/pkg/eth2spec/model_checkpoint.go b/pkg/eth2spec/model_checkpoint.go new file mode 100644 index 0000000..f148966 --- /dev/null +++ b/pkg/eth2spec/model_checkpoint.go @@ -0,0 +1,15 @@ +/* + * Eth2 Beacon Node API + * + * API specification for the beacon node, which enables users to query and participate in Ethereum 2.0 phase 0 beacon chain. + * + * API version: Dev - Eth2Spec v0.11.1 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package eth2spec +// Checkpoint The [`Checkpoint`](https://github.com/ethereum/eth2.0-specs/blob/v0.11.1/specs/phase0/beacon-chain.md#checkpoint +type Checkpoint struct { + Epoch string `json:"epoch,omitempty"` + Root string `json:"root,omitempty"` +} diff --git a/pkg/eth2spec/model_committee.go b/pkg/eth2spec/model_committee.go new file mode 100644 index 0000000..718a315 --- /dev/null +++ b/pkg/eth2spec/model_committee.go @@ -0,0 +1,17 @@ +/* + * Eth2 Beacon Node API + * + * API specification for the beacon node, which enables users to query and participate in Ethereum 2.0 phase 0 beacon chain. + * + * API version: Dev - Eth2Spec v0.11.1 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package eth2spec +// Committee Group of validators assigned to attest at specific slot and that have the same committee index (shard in phase 1) +type Committee struct { + Index string `json:"index,omitempty"` + Slot string `json:"slot,omitempty"` + // List of validator indices assigned to this committee + Validators []string `json:"validators,omitempty"` +} diff --git a/pkg/eth2spec/model_fork.go b/pkg/eth2spec/model_fork.go new file mode 100644 index 0000000..f5a2243 --- /dev/null +++ b/pkg/eth2spec/model_fork.go @@ -0,0 +1,18 @@ +/* + * Eth2 Beacon Node API + * + * API specification for the beacon node, which enables users to query and participate in Ethereum 2.0 phase 0 beacon chain. + * + * API version: Dev - Eth2Spec v0.11.1 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package eth2spec +// Fork The [`Fork`](https://github.com/ethereum/eth2.0-specs/blob/v0.11.1/specs/phase0/beacon-chain.md#fork) object from the Eth2.0 spec. +type Fork struct { + // a fork version number + PreviousVersion string `json:"previous_version,omitempty"` + // a fork version number + CurrentVersion string `json:"current_version,omitempty"` + Epoch string `json:"epoch,omitempty"` +} diff --git a/pkg/eth2spec/model_genesis_time.go b/pkg/eth2spec/model_genesis_time.go new file mode 100644 index 0000000..8ca3b12 --- /dev/null +++ b/pkg/eth2spec/model_genesis_time.go @@ -0,0 +1,13 @@ +/* + * Eth2 Beacon Node API + * + * API specification for the beacon node, which enables users to query and participate in Ethereum 2.0 phase 0 beacon chain. + * + * API version: Dev - Eth2Spec v0.11.1 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package eth2spec +// GenesisTime struct for GenesisTime +type GenesisTime struct { +} diff --git a/pkg/eth2spec/model_inline_object.go b/pkg/eth2spec/model_inline_object.go new file mode 100644 index 0000000..ac52f07 --- /dev/null +++ b/pkg/eth2spec/model_inline_object.go @@ -0,0 +1,17 @@ +/* + * Eth2 Beacon Node API + * + * API specification for the beacon node, which enables users to query and participate in Ethereum 2.0 phase 0 beacon chain. + * + * API version: Dev - Eth2Spec v0.11.1 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package eth2spec +// InlineObject The [`Attestation`](https://github.com/ethereum/eth2.0-specs/blob/v0.11.1/specs/phase0/beacon-chain.md#attestation) object from the Eth2.0 spec. +type InlineObject struct { + // Attester aggregation bits. + AggregationBits string `json:"aggregation_bits,omitempty"` + Signature string `json:"signature,omitempty"` + Data InlineResponse20011Data `json:"data,omitempty"` +} diff --git a/pkg/eth2spec/model_inline_object_1.go b/pkg/eth2spec/model_inline_object_1.go new file mode 100644 index 0000000..2d3f23e --- /dev/null +++ b/pkg/eth2spec/model_inline_object_1.go @@ -0,0 +1,15 @@ +/* + * Eth2 Beacon Node API + * + * API specification for the beacon node, which enables users to query and participate in Ethereum 2.0 phase 0 beacon chain. + * + * API version: Dev - Eth2Spec v0.11.1 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package eth2spec +// InlineObject1 The [`AttesterSlashing`](https://github.com/ethereum/eth2.0-specs/blob/v0.11.1/specs/core/0_beacon-chain.md#attesterslashing) object from the Eth2.0 spec. +type InlineObject1 struct { + Attestation1 InlineResponse20012Attestation1 `json:"attestation_1,omitempty"` + Attestation2 InlineResponse20012Attestation1 `json:"attestation_2,omitempty"` +} diff --git a/pkg/eth2spec/model_inline_object_2.go b/pkg/eth2spec/model_inline_object_2.go new file mode 100644 index 0000000..3f66102 --- /dev/null +++ b/pkg/eth2spec/model_inline_object_2.go @@ -0,0 +1,15 @@ +/* + * Eth2 Beacon Node API + * + * API specification for the beacon node, which enables users to query and participate in Ethereum 2.0 phase 0 beacon chain. + * + * API version: Dev - Eth2Spec v0.11.1 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package eth2spec +// InlineObject2 The [`ProposerSlashing`](https://github.com/ethereum/eth2.0-specs/blob/v0.11.1/specs/phase0/beacon-chain.md#proposerslashing) object from the Eth2.0 spec. +type InlineObject2 struct { + SignedHeader1 InlineResponse2007Header `json:"signed_header_1,omitempty"` + SignedHeader2 InlineResponse2007Header `json:"signed_header_2,omitempty"` +} diff --git a/pkg/eth2spec/model_inline_object_3.go b/pkg/eth2spec/model_inline_object_3.go new file mode 100644 index 0000000..c2ba00d --- /dev/null +++ b/pkg/eth2spec/model_inline_object_3.go @@ -0,0 +1,15 @@ +/* + * Eth2 Beacon Node API + * + * API specification for the beacon node, which enables users to query and participate in Ethereum 2.0 phase 0 beacon chain. + * + * API version: Dev - Eth2Spec v0.11.1 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package eth2spec +// InlineObject3 The [`SignedVoluntaryExit`](https://github.com/ethereum/eth2.0-specs/blob/v0.11.1/specs/phase0/beacon-chain.md#signedvoluntaryexit) object from the Eth2.0 spec. +type InlineObject3 struct { + Message InlineResponse20014Message `json:"message,omitempty"` + Signature string `json:"signature,omitempty"` +} diff --git a/pkg/eth2spec/model_inline_response_200.go b/pkg/eth2spec/model_inline_response_200.go new file mode 100644 index 0000000..7fed8e0 --- /dev/null +++ b/pkg/eth2spec/model_inline_response_200.go @@ -0,0 +1,14 @@ +/* + * Eth2 Beacon Node API + * + * API specification for the beacon node, which enables users to query and participate in Ethereum 2.0 phase 0 beacon chain. + * + * API version: Dev - Eth2Spec v0.11.1 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package eth2spec +// InlineResponse200 struct for InlineResponse200 +type InlineResponse200 struct { + Data InlineResponse200Data `json:"data,omitempty"` +} diff --git a/pkg/eth2spec/model_inline_response_200_1.go b/pkg/eth2spec/model_inline_response_200_1.go new file mode 100644 index 0000000..efec250 --- /dev/null +++ b/pkg/eth2spec/model_inline_response_200_1.go @@ -0,0 +1,14 @@ +/* + * Eth2 Beacon Node API + * + * API specification for the beacon node, which enables users to query and participate in Ethereum 2.0 phase 0 beacon chain. + * + * API version: Dev - Eth2Spec v0.11.1 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package eth2spec +// InlineResponse2001 struct for InlineResponse2001 +type InlineResponse2001 struct { + Data InlineResponse2001Data `json:"data,omitempty"` +} diff --git a/pkg/eth2spec/model_inline_response_200_10.go b/pkg/eth2spec/model_inline_response_200_10.go new file mode 100644 index 0000000..4a54fcf --- /dev/null +++ b/pkg/eth2spec/model_inline_response_200_10.go @@ -0,0 +1,14 @@ +/* + * Eth2 Beacon Node API + * + * API specification for the beacon node, which enables users to query and participate in Ethereum 2.0 phase 0 beacon chain. + * + * API version: Dev - Eth2Spec v0.11.1 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package eth2spec +// InlineResponse20010 struct for InlineResponse20010 +type InlineResponse20010 struct { + Data InlineResponse20010Data `json:"data,omitempty"` +} diff --git a/pkg/eth2spec/model_inline_response_200_10_data.go b/pkg/eth2spec/model_inline_response_200_10_data.go new file mode 100644 index 0000000..1885a9f --- /dev/null +++ b/pkg/eth2spec/model_inline_response_200_10_data.go @@ -0,0 +1,14 @@ +/* + * Eth2 Beacon Node API + * + * API specification for the beacon node, which enables users to query and participate in Ethereum 2.0 phase 0 beacon chain. + * + * API version: Dev - Eth2Spec v0.11.1 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package eth2spec +// InlineResponse20010Data struct for InlineResponse20010Data +type InlineResponse20010Data struct { + Root interface{} `json:"root,omitempty"` +} diff --git a/pkg/eth2spec/model_inline_response_200_11.go b/pkg/eth2spec/model_inline_response_200_11.go new file mode 100644 index 0000000..0bb74e4 --- /dev/null +++ b/pkg/eth2spec/model_inline_response_200_11.go @@ -0,0 +1,14 @@ +/* + * Eth2 Beacon Node API + * + * API specification for the beacon node, which enables users to query and participate in Ethereum 2.0 phase 0 beacon chain. + * + * API version: Dev - Eth2Spec v0.11.1 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package eth2spec +// InlineResponse20011 struct for InlineResponse20011 +type InlineResponse20011 struct { + Data []InlineResponse20011Data1 `json:"data,omitempty"` +} diff --git a/pkg/eth2spec/model_inline_response_200_11_data.go b/pkg/eth2spec/model_inline_response_200_11_data.go new file mode 100644 index 0000000..c77258f --- /dev/null +++ b/pkg/eth2spec/model_inline_response_200_11_data.go @@ -0,0 +1,18 @@ +/* + * Eth2 Beacon Node API + * + * API specification for the beacon node, which enables users to query and participate in Ethereum 2.0 phase 0 beacon chain. + * + * API version: Dev - Eth2Spec v0.11.1 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package eth2spec +// InlineResponse20011Data The [`AttestationData`](https://github.com/ethereum/eth2.0-specs/blob/v0.11.1/specs/phase0/beacon-chain.md#attestationdata) object from the Eth2.0 spec. +type InlineResponse20011Data struct { + Slot string `json:"slot,omitempty"` + Index string `json:"index,omitempty"` + BeaconBlockRoot string `json:"beacon_block_root,omitempty"` + Source InlineResponse2003DataPreviousJustified `json:"source,omitempty"` + Target InlineResponse2003DataPreviousJustified `json:"target,omitempty"` +} diff --git a/pkg/eth2spec/model_inline_response_200_11_data_1.go b/pkg/eth2spec/model_inline_response_200_11_data_1.go new file mode 100644 index 0000000..44aea75 --- /dev/null +++ b/pkg/eth2spec/model_inline_response_200_11_data_1.go @@ -0,0 +1,17 @@ +/* + * Eth2 Beacon Node API + * + * API specification for the beacon node, which enables users to query and participate in Ethereum 2.0 phase 0 beacon chain. + * + * API version: Dev - Eth2Spec v0.11.1 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package eth2spec +// InlineResponse20011Data1 The [`Attestation`](https://github.com/ethereum/eth2.0-specs/blob/v0.11.1/specs/phase0/beacon-chain.md#attestation) object from the Eth2.0 spec. +type InlineResponse20011Data1 struct { + // Attester aggregation bits. + AggregationBits string `json:"aggregation_bits,omitempty"` + Signature string `json:"signature,omitempty"` + Data InlineResponse20011Data `json:"data,omitempty"` +} diff --git a/pkg/eth2spec/model_inline_response_200_12.go b/pkg/eth2spec/model_inline_response_200_12.go new file mode 100644 index 0000000..ec1d4ca --- /dev/null +++ b/pkg/eth2spec/model_inline_response_200_12.go @@ -0,0 +1,14 @@ +/* + * Eth2 Beacon Node API + * + * API specification for the beacon node, which enables users to query and participate in Ethereum 2.0 phase 0 beacon chain. + * + * API version: Dev - Eth2Spec v0.11.1 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package eth2spec +// InlineResponse20012 struct for InlineResponse20012 +type InlineResponse20012 struct { + Data []InlineResponse20012Data `json:"data,omitempty"` +} diff --git a/pkg/eth2spec/model_inline_response_200_12_attestation_1.go b/pkg/eth2spec/model_inline_response_200_12_attestation_1.go new file mode 100644 index 0000000..54dcb34 --- /dev/null +++ b/pkg/eth2spec/model_inline_response_200_12_attestation_1.go @@ -0,0 +1,17 @@ +/* + * Eth2 Beacon Node API + * + * API specification for the beacon node, which enables users to query and participate in Ethereum 2.0 phase 0 beacon chain. + * + * API version: Dev - Eth2Spec v0.11.1 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package eth2spec +// InlineResponse20012Attestation1 The [`IndexedAttestation`](https://github.com/ethereum/eth2.0-specs/blob/v0.11.1/specs/phase0/beacon-chain.md#indexedattestation) object from the Eth2.0 spec. +type InlineResponse20012Attestation1 struct { + // Attesting validator indices + AttestingIndices []string `json:"attesting_indices,omitempty"` + Signature string `json:"signature,omitempty"` + Data InlineResponse20011Data `json:"data,omitempty"` +} diff --git a/pkg/eth2spec/model_inline_response_200_12_data.go b/pkg/eth2spec/model_inline_response_200_12_data.go new file mode 100644 index 0000000..38e6112 --- /dev/null +++ b/pkg/eth2spec/model_inline_response_200_12_data.go @@ -0,0 +1,15 @@ +/* + * Eth2 Beacon Node API + * + * API specification for the beacon node, which enables users to query and participate in Ethereum 2.0 phase 0 beacon chain. + * + * API version: Dev - Eth2Spec v0.11.1 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package eth2spec +// InlineResponse20012Data The [`AttesterSlashing`](https://github.com/ethereum/eth2.0-specs/blob/v0.11.1/specs/core/0_beacon-chain.md#attesterslashing) object from the Eth2.0 spec. +type InlineResponse20012Data struct { + Attestation1 InlineResponse20012Attestation1 `json:"attestation_1,omitempty"` + Attestation2 InlineResponse20012Attestation1 `json:"attestation_2,omitempty"` +} diff --git a/pkg/eth2spec/model_inline_response_200_13.go b/pkg/eth2spec/model_inline_response_200_13.go new file mode 100644 index 0000000..dba9296 --- /dev/null +++ b/pkg/eth2spec/model_inline_response_200_13.go @@ -0,0 +1,14 @@ +/* + * Eth2 Beacon Node API + * + * API specification for the beacon node, which enables users to query and participate in Ethereum 2.0 phase 0 beacon chain. + * + * API version: Dev - Eth2Spec v0.11.1 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package eth2spec +// InlineResponse20013 struct for InlineResponse20013 +type InlineResponse20013 struct { + Data []InlineResponse20013Data `json:"data,omitempty"` +} diff --git a/pkg/eth2spec/model_inline_response_200_13_data.go b/pkg/eth2spec/model_inline_response_200_13_data.go new file mode 100644 index 0000000..ac71164 --- /dev/null +++ b/pkg/eth2spec/model_inline_response_200_13_data.go @@ -0,0 +1,15 @@ +/* + * Eth2 Beacon Node API + * + * API specification for the beacon node, which enables users to query and participate in Ethereum 2.0 phase 0 beacon chain. + * + * API version: Dev - Eth2Spec v0.11.1 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package eth2spec +// InlineResponse20013Data The [`ProposerSlashing`](https://github.com/ethereum/eth2.0-specs/blob/v0.11.1/specs/phase0/beacon-chain.md#proposerslashing) object from the Eth2.0 spec. +type InlineResponse20013Data struct { + SignedHeader1 InlineResponse2007Header `json:"signed_header_1,omitempty"` + SignedHeader2 InlineResponse2007Header `json:"signed_header_2,omitempty"` +} diff --git a/pkg/eth2spec/model_inline_response_200_14.go b/pkg/eth2spec/model_inline_response_200_14.go new file mode 100644 index 0000000..26b9adc --- /dev/null +++ b/pkg/eth2spec/model_inline_response_200_14.go @@ -0,0 +1,14 @@ +/* + * Eth2 Beacon Node API + * + * API specification for the beacon node, which enables users to query and participate in Ethereum 2.0 phase 0 beacon chain. + * + * API version: Dev - Eth2Spec v0.11.1 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package eth2spec +// InlineResponse20014 struct for InlineResponse20014 +type InlineResponse20014 struct { + Data []InlineResponse20014Data `json:"data,omitempty"` +} diff --git a/pkg/eth2spec/model_inline_response_200_14_data.go b/pkg/eth2spec/model_inline_response_200_14_data.go new file mode 100644 index 0000000..34980a7 --- /dev/null +++ b/pkg/eth2spec/model_inline_response_200_14_data.go @@ -0,0 +1,15 @@ +/* + * Eth2 Beacon Node API + * + * API specification for the beacon node, which enables users to query and participate in Ethereum 2.0 phase 0 beacon chain. + * + * API version: Dev - Eth2Spec v0.11.1 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package eth2spec +// InlineResponse20014Data The [`SignedVoluntaryExit`](https://github.com/ethereum/eth2.0-specs/blob/v0.11.1/specs/phase0/beacon-chain.md#signedvoluntaryexit) object from the Eth2.0 spec. +type InlineResponse20014Data struct { + Message InlineResponse20014Message `json:"message,omitempty"` + Signature string `json:"signature,omitempty"` +} diff --git a/pkg/eth2spec/model_inline_response_200_14_message.go b/pkg/eth2spec/model_inline_response_200_14_message.go new file mode 100644 index 0000000..ef8765e --- /dev/null +++ b/pkg/eth2spec/model_inline_response_200_14_message.go @@ -0,0 +1,15 @@ +/* + * Eth2 Beacon Node API + * + * API specification for the beacon node, which enables users to query and participate in Ethereum 2.0 phase 0 beacon chain. + * + * API version: Dev - Eth2Spec v0.11.1 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package eth2spec +// InlineResponse20014Message The [`VoluntaryExit`](https://github.com/ethereum/eth2.0-specs/blob/v0.11.1/specs/phase0/beacon-chain.md#voluntaryexit) object from the Eth2.0 spec. +type InlineResponse20014Message struct { + Epoch string `json:"epoch,omitempty"` + ValidatorIndex string `json:"validator_index,omitempty"` +} diff --git a/pkg/eth2spec/model_inline_response_200_15.go b/pkg/eth2spec/model_inline_response_200_15.go new file mode 100644 index 0000000..7710713 --- /dev/null +++ b/pkg/eth2spec/model_inline_response_200_15.go @@ -0,0 +1,14 @@ +/* + * Eth2 Beacon Node API + * + * API specification for the beacon node, which enables users to query and participate in Ethereum 2.0 phase 0 beacon chain. + * + * API version: Dev - Eth2Spec v0.11.1 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package eth2spec +// InlineResponse20015 struct for InlineResponse20015 +type InlineResponse20015 struct { + Data InlineResponse20015Data `json:"data,omitempty"` +} diff --git a/pkg/eth2spec/model_inline_response_200_15_data.go b/pkg/eth2spec/model_inline_response_200_15_data.go new file mode 100644 index 0000000..dfe3c29 --- /dev/null +++ b/pkg/eth2spec/model_inline_response_200_15_data.go @@ -0,0 +1,20 @@ +/* + * Eth2 Beacon Node API + * + * API specification for the beacon node, which enables users to query and participate in Ethereum 2.0 phase 0 beacon chain. + * + * API version: Dev - Eth2Spec v0.11.1 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package eth2spec +// InlineResponse20015Data struct for InlineResponse20015Data +type InlineResponse20015Data struct { + // Cryptographic hash of a peer’s public key. [Read more](https://docs.libp2p.io/concepts/peer-id/) + PeerId string `json:"peer_id,omitempty"` + // Ethereum node record. [Read more](https://eips.ethereum.org/EIPS/eip-778) + Enr string `json:"enr,omitempty"` + P2pAddresses []string `json:"p2p_addresses,omitempty"` + DiscoveryAddresses []string `json:"discovery_addresses,omitempty"` + Metadata InlineResponse20015DataMetadata `json:"metadata,omitempty"` +} diff --git a/pkg/eth2spec/model_inline_response_200_15_data_metadata.go b/pkg/eth2spec/model_inline_response_200_15_data_metadata.go new file mode 100644 index 0000000..8cf0502 --- /dev/null +++ b/pkg/eth2spec/model_inline_response_200_15_data_metadata.go @@ -0,0 +1,15 @@ +/* + * Eth2 Beacon Node API + * + * API specification for the beacon node, which enables users to query and participate in Ethereum 2.0 phase 0 beacon chain. + * + * API version: Dev - Eth2Spec v0.11.1 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package eth2spec +// InlineResponse20015DataMetadata Based on eth2 [Metadata object](https://github.com/ethereum/eth2.0-specs/blob/v0.12.0/specs/phase0/p2p-interface.md#metadata) +type InlineResponse20015DataMetadata struct { + SeqNumber interface{} `json:"seq_number,omitempty"` + Attnets interface{} `json:"attnets,omitempty"` +} diff --git a/pkg/eth2spec/model_inline_response_200_16.go b/pkg/eth2spec/model_inline_response_200_16.go new file mode 100644 index 0000000..75760ef --- /dev/null +++ b/pkg/eth2spec/model_inline_response_200_16.go @@ -0,0 +1,14 @@ +/* + * Eth2 Beacon Node API + * + * API specification for the beacon node, which enables users to query and participate in Ethereum 2.0 phase 0 beacon chain. + * + * API version: Dev - Eth2Spec v0.11.1 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package eth2spec +// InlineResponse20016 struct for InlineResponse20016 +type InlineResponse20016 struct { + Data []InlineResponse20016Data `json:"data,omitempty"` +} diff --git a/pkg/eth2spec/model_inline_response_200_16_data.go b/pkg/eth2spec/model_inline_response_200_16_data.go new file mode 100644 index 0000000..706aabd --- /dev/null +++ b/pkg/eth2spec/model_inline_response_200_16_data.go @@ -0,0 +1,21 @@ +/* + * Eth2 Beacon Node API + * + * API specification for the beacon node, which enables users to query and participate in Ethereum 2.0 phase 0 beacon chain. + * + * API version: Dev - Eth2Spec v0.11.1 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package eth2spec +// InlineResponse20016Data struct for InlineResponse20016Data +type InlineResponse20016Data struct { + // Cryptographic hash of a peer’s public key. [Read more](https://docs.libp2p.io/concepts/peer-id/) + PeerId string `json:"peer_id,omitempty"` + // Ethereum node record. [Read more](https://eips.ethereum.org/EIPS/eip-778) + Enr string `json:"enr,omitempty"` + // [Read more](https://docs.libp2p.io/reference/glossary/#multiaddr) + Address string `json:"address,omitempty"` + State string `json:"state,omitempty"` + Direction string `json:"direction,omitempty"` +} diff --git a/pkg/eth2spec/model_inline_response_200_17.go b/pkg/eth2spec/model_inline_response_200_17.go new file mode 100644 index 0000000..491e5ef --- /dev/null +++ b/pkg/eth2spec/model_inline_response_200_17.go @@ -0,0 +1,14 @@ +/* + * Eth2 Beacon Node API + * + * API specification for the beacon node, which enables users to query and participate in Ethereum 2.0 phase 0 beacon chain. + * + * API version: Dev - Eth2Spec v0.11.1 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package eth2spec +// InlineResponse20017 struct for InlineResponse20017 +type InlineResponse20017 struct { + Data InlineResponse20016Data `json:"data,omitempty"` +} diff --git a/pkg/eth2spec/model_inline_response_200_18.go b/pkg/eth2spec/model_inline_response_200_18.go new file mode 100644 index 0000000..f5d025b --- /dev/null +++ b/pkg/eth2spec/model_inline_response_200_18.go @@ -0,0 +1,14 @@ +/* + * Eth2 Beacon Node API + * + * API specification for the beacon node, which enables users to query and participate in Ethereum 2.0 phase 0 beacon chain. + * + * API version: Dev - Eth2Spec v0.11.1 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package eth2spec +// InlineResponse20018 struct for InlineResponse20018 +type InlineResponse20018 struct { + Data InlineResponse20018Data `json:"data,omitempty"` +} diff --git a/pkg/eth2spec/model_inline_response_200_18_data.go b/pkg/eth2spec/model_inline_response_200_18_data.go new file mode 100644 index 0000000..474cd19 --- /dev/null +++ b/pkg/eth2spec/model_inline_response_200_18_data.go @@ -0,0 +1,15 @@ +/* + * Eth2 Beacon Node API + * + * API specification for the beacon node, which enables users to query and participate in Ethereum 2.0 phase 0 beacon chain. + * + * API version: Dev - Eth2Spec v0.11.1 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package eth2spec +// InlineResponse20018Data struct for InlineResponse20018Data +type InlineResponse20018Data struct { + // A string which uniquely identifies the client implementation and its version; similar to [HTTP User-Agent](https://tools.ietf.org/html/rfc7231#section-5.5.3). + Version string `json:"version,omitempty"` +} diff --git a/pkg/eth2spec/model_inline_response_200_19.go b/pkg/eth2spec/model_inline_response_200_19.go new file mode 100644 index 0000000..c63a010 --- /dev/null +++ b/pkg/eth2spec/model_inline_response_200_19.go @@ -0,0 +1,14 @@ +/* + * Eth2 Beacon Node API + * + * API specification for the beacon node, which enables users to query and participate in Ethereum 2.0 phase 0 beacon chain. + * + * API version: Dev - Eth2Spec v0.11.1 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package eth2spec +// InlineResponse20019 struct for InlineResponse20019 +type InlineResponse20019 struct { + Data InlineResponse20019Data `json:"data,omitempty"` +} diff --git a/pkg/eth2spec/model_inline_response_200_19_data.go b/pkg/eth2spec/model_inline_response_200_19_data.go new file mode 100644 index 0000000..d0f0290 --- /dev/null +++ b/pkg/eth2spec/model_inline_response_200_19_data.go @@ -0,0 +1,15 @@ +/* + * Eth2 Beacon Node API + * + * API specification for the beacon node, which enables users to query and participate in Ethereum 2.0 phase 0 beacon chain. + * + * API version: Dev - Eth2Spec v0.11.1 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package eth2spec +// InlineResponse20019Data struct for InlineResponse20019Data +type InlineResponse20019Data struct { + HeadSlot interface{} `json:"head_slot,omitempty"` + SyncDistance interface{} `json:"sync_distance,omitempty"` +} diff --git a/pkg/eth2spec/model_inline_response_200_1_data.go b/pkg/eth2spec/model_inline_response_200_1_data.go new file mode 100644 index 0000000..07d73eb --- /dev/null +++ b/pkg/eth2spec/model_inline_response_200_1_data.go @@ -0,0 +1,14 @@ +/* + * Eth2 Beacon Node API + * + * API specification for the beacon node, which enables users to query and participate in Ethereum 2.0 phase 0 beacon chain. + * + * API version: Dev - Eth2Spec v0.11.1 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package eth2spec +// InlineResponse2001Data struct for InlineResponse2001Data +type InlineResponse2001Data struct { + Root interface{} `json:"root,omitempty"` +} diff --git a/pkg/eth2spec/model_inline_response_200_2.go b/pkg/eth2spec/model_inline_response_200_2.go new file mode 100644 index 0000000..6647879 --- /dev/null +++ b/pkg/eth2spec/model_inline_response_200_2.go @@ -0,0 +1,14 @@ +/* + * Eth2 Beacon Node API + * + * API specification for the beacon node, which enables users to query and participate in Ethereum 2.0 phase 0 beacon chain. + * + * API version: Dev - Eth2Spec v0.11.1 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package eth2spec +// InlineResponse2002 struct for InlineResponse2002 +type InlineResponse2002 struct { + Data InlineResponse2002Data `json:"data,omitempty"` +} diff --git a/pkg/eth2spec/model_inline_response_200_20.go b/pkg/eth2spec/model_inline_response_200_20.go new file mode 100644 index 0000000..64a8efa --- /dev/null +++ b/pkg/eth2spec/model_inline_response_200_20.go @@ -0,0 +1,14 @@ +/* + * Eth2 Beacon Node API + * + * API specification for the beacon node, which enables users to query and participate in Ethereum 2.0 phase 0 beacon chain. + * + * API version: Dev - Eth2Spec v0.11.1 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package eth2spec +// InlineResponse20020 struct for InlineResponse20020 +type InlineResponse20020 struct { + Data []InlineResponse2002Data `json:"data,omitempty"` +} diff --git a/pkg/eth2spec/model_inline_response_200_21.go b/pkg/eth2spec/model_inline_response_200_21.go new file mode 100644 index 0000000..8fb9478 --- /dev/null +++ b/pkg/eth2spec/model_inline_response_200_21.go @@ -0,0 +1,15 @@ +/* + * Eth2 Beacon Node API + * + * API specification for the beacon node, which enables users to query and participate in Ethereum 2.0 phase 0 beacon chain. + * + * API version: Dev - Eth2Spec v0.11.1 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package eth2spec +// InlineResponse20021 struct for InlineResponse20021 +type InlineResponse20021 struct { + // Key value mapping of Phase 0[spec variables](https://github.com/ethereum/eth2.0-specs/blob/v0.11.1/configs/mainnet.yaml). Values are returned with following format: - any value starting with 0x in the spec is returned as a hex string - all other values are returned as number + Data map[string]interface{} `json:"data,omitempty"` +} diff --git a/pkg/eth2spec/model_inline_response_200_22.go b/pkg/eth2spec/model_inline_response_200_22.go new file mode 100644 index 0000000..23007be --- /dev/null +++ b/pkg/eth2spec/model_inline_response_200_22.go @@ -0,0 +1,14 @@ +/* + * Eth2 Beacon Node API + * + * API specification for the beacon node, which enables users to query and participate in Ethereum 2.0 phase 0 beacon chain. + * + * API version: Dev - Eth2Spec v0.11.1 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package eth2spec +// InlineResponse20022 struct for InlineResponse20022 +type InlineResponse20022 struct { + Data InlineResponse20022Data `json:"data,omitempty"` +} diff --git a/pkg/eth2spec/model_inline_response_200_22_data.go b/pkg/eth2spec/model_inline_response_200_22_data.go new file mode 100644 index 0000000..0f971e5 --- /dev/null +++ b/pkg/eth2spec/model_inline_response_200_22_data.go @@ -0,0 +1,16 @@ +/* + * Eth2 Beacon Node API + * + * API specification for the beacon node, which enables users to query and participate in Ethereum 2.0 phase 0 beacon chain. + * + * API version: Dev - Eth2Spec v0.11.1 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package eth2spec +// InlineResponse20022Data struct for InlineResponse20022Data +type InlineResponse20022Data struct { + // Id of Eth1 chain on which contract is deployed. + ChainId int32 `json:"chain_id,omitempty"` + Address string `json:"address,omitempty"` +} diff --git a/pkg/eth2spec/model_inline_response_200_2_data.go b/pkg/eth2spec/model_inline_response_200_2_data.go new file mode 100644 index 0000000..b5758e2 --- /dev/null +++ b/pkg/eth2spec/model_inline_response_200_2_data.go @@ -0,0 +1,18 @@ +/* + * Eth2 Beacon Node API + * + * API specification for the beacon node, which enables users to query and participate in Ethereum 2.0 phase 0 beacon chain. + * + * API version: Dev - Eth2Spec v0.11.1 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package eth2spec +// InlineResponse2002Data The [`Fork`](https://github.com/ethereum/eth2.0-specs/blob/v0.11.1/specs/phase0/beacon-chain.md#fork) object from the Eth2.0 spec. +type InlineResponse2002Data struct { + // a fork version number + PreviousVersion string `json:"previous_version,omitempty"` + // a fork version number + CurrentVersion string `json:"current_version,omitempty"` + Epoch string `json:"epoch,omitempty"` +} diff --git a/pkg/eth2spec/model_inline_response_200_3.go b/pkg/eth2spec/model_inline_response_200_3.go new file mode 100644 index 0000000..3ee2a02 --- /dev/null +++ b/pkg/eth2spec/model_inline_response_200_3.go @@ -0,0 +1,14 @@ +/* + * Eth2 Beacon Node API + * + * API specification for the beacon node, which enables users to query and participate in Ethereum 2.0 phase 0 beacon chain. + * + * API version: Dev - Eth2Spec v0.11.1 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package eth2spec +// InlineResponse2003 struct for InlineResponse2003 +type InlineResponse2003 struct { + Data InlineResponse2003Data `json:"data,omitempty"` +} diff --git a/pkg/eth2spec/model_inline_response_200_3_data.go b/pkg/eth2spec/model_inline_response_200_3_data.go new file mode 100644 index 0000000..fab6261 --- /dev/null +++ b/pkg/eth2spec/model_inline_response_200_3_data.go @@ -0,0 +1,16 @@ +/* + * Eth2 Beacon Node API + * + * API specification for the beacon node, which enables users to query and participate in Ethereum 2.0 phase 0 beacon chain. + * + * API version: Dev - Eth2Spec v0.11.1 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package eth2spec +// InlineResponse2003Data struct for InlineResponse2003Data +type InlineResponse2003Data struct { + PreviousJustified InlineResponse2003DataPreviousJustified `json:"previous_justified,omitempty"` + CurrentJustified InlineResponse2003DataPreviousJustified `json:"current_justified,omitempty"` + Finalized InlineResponse2003DataPreviousJustified `json:"finalized,omitempty"` +} diff --git a/pkg/eth2spec/model_inline_response_200_3_data_previous_justified.go b/pkg/eth2spec/model_inline_response_200_3_data_previous_justified.go new file mode 100644 index 0000000..3b4cfae --- /dev/null +++ b/pkg/eth2spec/model_inline_response_200_3_data_previous_justified.go @@ -0,0 +1,15 @@ +/* + * Eth2 Beacon Node API + * + * API specification for the beacon node, which enables users to query and participate in Ethereum 2.0 phase 0 beacon chain. + * + * API version: Dev - Eth2Spec v0.11.1 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package eth2spec +// InlineResponse2003DataPreviousJustified The [`Checkpoint`](https://github.com/ethereum/eth2.0-specs/blob/v0.11.1/specs/phase0/beacon-chain.md#checkpoint +type InlineResponse2003DataPreviousJustified struct { + Epoch string `json:"epoch,omitempty"` + Root string `json:"root,omitempty"` +} diff --git a/pkg/eth2spec/model_inline_response_200_4.go b/pkg/eth2spec/model_inline_response_200_4.go new file mode 100644 index 0000000..edfd5e5 --- /dev/null +++ b/pkg/eth2spec/model_inline_response_200_4.go @@ -0,0 +1,14 @@ +/* + * Eth2 Beacon Node API + * + * API specification for the beacon node, which enables users to query and participate in Ethereum 2.0 phase 0 beacon chain. + * + * API version: Dev - Eth2Spec v0.11.1 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package eth2spec +// InlineResponse2004 struct for InlineResponse2004 +type InlineResponse2004 struct { + Data []InlineResponse2004Data `json:"data,omitempty"` +} diff --git a/pkg/eth2spec/model_inline_response_200_4_data.go b/pkg/eth2spec/model_inline_response_200_4_data.go new file mode 100644 index 0000000..133b572 --- /dev/null +++ b/pkg/eth2spec/model_inline_response_200_4_data.go @@ -0,0 +1,18 @@ +/* + * Eth2 Beacon Node API + * + * API specification for the beacon node, which enables users to query and participate in Ethereum 2.0 phase 0 beacon chain. + * + * API version: Dev - Eth2Spec v0.11.1 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package eth2spec +// InlineResponse2004Data struct for InlineResponse2004Data +type InlineResponse2004Data struct { + Index string `json:"index,omitempty"` + Balance string `json:"balance,omitempty"` + // Possible statuses: - **pending_initialized** - When the first deposit is processed, but not enough funds are available (or not yet the end of the first epoch) to get validator into the activation queue. - **pending_queued** - When validator is waiting to get activated, and have enough funds etc. while in the queue, validator activation epoch keeps changing until it gets to the front and make it through (finalization is a requirement here too). - **active_ongoing** - When validator must be attesting, and have not initiated any exit. - **active_exiting** - When validator is still active, but filed a voluntary request to exit. - **active_slashed** - When validator is still active, but have a slashed status and is scheduled to exit. - **exited_unslashed** - When validator has reached reguler exit epoch, not being slashed, and doesn't have to attest any more, but cannot withdraw yet. - **exited_slashed** - When validator has reached reguler exit epoch, but was slashed, have to wait for a longer withdrawal period. - **withdrawal_possible** - After validator has exited, a while later is permitted to move funds, and is truly out of the system. - **withdrawal_done** - (not possible in phase0, except slashing full balance) - actually having moved funds away [Validator status specification](https://hackmd.io/ofFJ5gOmQpu1jjHilHbdQQ) + Status string `json:"status,omitempty"` + Validator InlineResponse2004Validator `json:"validator,omitempty"` +} diff --git a/pkg/eth2spec/model_inline_response_200_4_validator.go b/pkg/eth2spec/model_inline_response_200_4_validator.go new file mode 100644 index 0000000..6194dae --- /dev/null +++ b/pkg/eth2spec/model_inline_response_200_4_validator.go @@ -0,0 +1,23 @@ +/* + * Eth2 Beacon Node API + * + * API specification for the beacon node, which enables users to query and participate in Ethereum 2.0 phase 0 beacon chain. + * + * API version: Dev - Eth2Spec v0.11.1 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package eth2spec +// InlineResponse2004Validator struct for InlineResponse2004Validator +type InlineResponse2004Validator struct { + // The validator's BLS public key, uniquely identifying them. _48-bytes, hex encoded with 0x prefix, case insensitive._ + Pubkey string `json:"pubkey,omitempty"` + WithdrawalCredentials string `json:"withdrawal_credentials,omitempty"` + EffectiveBalance string `json:"effective_balance,omitempty"` + // Was validator slashed (not longer active). + Slashed bool `json:"slashed,omitempty"` + ActivationEligibilityEpoch string `json:"activation_eligibility_epoch,omitempty"` + ActivationEpoch string `json:"activation_epoch,omitempty"` + ExitEpoch string `json:"exit_epoch,omitempty"` + WithdrawableEpoch string `json:"withdrawable_epoch,omitempty"` +} diff --git a/pkg/eth2spec/model_inline_response_200_5.go b/pkg/eth2spec/model_inline_response_200_5.go new file mode 100644 index 0000000..2c5a191 --- /dev/null +++ b/pkg/eth2spec/model_inline_response_200_5.go @@ -0,0 +1,14 @@ +/* + * Eth2 Beacon Node API + * + * API specification for the beacon node, which enables users to query and participate in Ethereum 2.0 phase 0 beacon chain. + * + * API version: Dev - Eth2Spec v0.11.1 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package eth2spec +// InlineResponse2005 struct for InlineResponse2005 +type InlineResponse2005 struct { + Data InlineResponse2004Data `json:"data,omitempty"` +} diff --git a/pkg/eth2spec/model_inline_response_200_6.go b/pkg/eth2spec/model_inline_response_200_6.go new file mode 100644 index 0000000..b52f535 --- /dev/null +++ b/pkg/eth2spec/model_inline_response_200_6.go @@ -0,0 +1,14 @@ +/* + * Eth2 Beacon Node API + * + * API specification for the beacon node, which enables users to query and participate in Ethereum 2.0 phase 0 beacon chain. + * + * API version: Dev - Eth2Spec v0.11.1 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package eth2spec +// InlineResponse2006 struct for InlineResponse2006 +type InlineResponse2006 struct { + Data []InlineResponse2006Data `json:"data,omitempty"` +} diff --git a/pkg/eth2spec/model_inline_response_200_6_data.go b/pkg/eth2spec/model_inline_response_200_6_data.go new file mode 100644 index 0000000..41c7ebd --- /dev/null +++ b/pkg/eth2spec/model_inline_response_200_6_data.go @@ -0,0 +1,17 @@ +/* + * Eth2 Beacon Node API + * + * API specification for the beacon node, which enables users to query and participate in Ethereum 2.0 phase 0 beacon chain. + * + * API version: Dev - Eth2Spec v0.11.1 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package eth2spec +// InlineResponse2006Data Group of validators assigned to attest at specific slot and that have the same committee index (shard in phase 1) +type InlineResponse2006Data struct { + Index string `json:"index,omitempty"` + Slot string `json:"slot,omitempty"` + // List of validator indices assigned to this committee + Validators []string `json:"validators,omitempty"` +} diff --git a/pkg/eth2spec/model_inline_response_200_7.go b/pkg/eth2spec/model_inline_response_200_7.go new file mode 100644 index 0000000..833e73d --- /dev/null +++ b/pkg/eth2spec/model_inline_response_200_7.go @@ -0,0 +1,14 @@ +/* + * Eth2 Beacon Node API + * + * API specification for the beacon node, which enables users to query and participate in Ethereum 2.0 phase 0 beacon chain. + * + * API version: Dev - Eth2Spec v0.11.1 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package eth2spec +// InlineResponse2007 struct for InlineResponse2007 +type InlineResponse2007 struct { + Data []InlineResponse2007Data `json:"data,omitempty"` +} diff --git a/pkg/eth2spec/model_inline_response_200_7_data.go b/pkg/eth2spec/model_inline_response_200_7_data.go new file mode 100644 index 0000000..9bb92df --- /dev/null +++ b/pkg/eth2spec/model_inline_response_200_7_data.go @@ -0,0 +1,16 @@ +/* + * Eth2 Beacon Node API + * + * API specification for the beacon node, which enables users to query and participate in Ethereum 2.0 phase 0 beacon chain. + * + * API version: Dev - Eth2Spec v0.11.1 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package eth2spec +// InlineResponse2007Data struct for InlineResponse2007Data +type InlineResponse2007Data struct { + Root string `json:"root,omitempty"` + Canonical bool `json:"canonical,omitempty"` + Header InlineResponse2007Header `json:"header,omitempty"` +} diff --git a/pkg/eth2spec/model_inline_response_200_7_header.go b/pkg/eth2spec/model_inline_response_200_7_header.go new file mode 100644 index 0000000..65267a4 --- /dev/null +++ b/pkg/eth2spec/model_inline_response_200_7_header.go @@ -0,0 +1,16 @@ +/* + * Eth2 Beacon Node API + * + * API specification for the beacon node, which enables users to query and participate in Ethereum 2.0 phase 0 beacon chain. + * + * API version: Dev - Eth2Spec v0.11.1 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package eth2spec +// InlineResponse2007Header The [`SignedBeaconBlockHeader`](https://github.com/ethereum/eth2.0-specs/blob/v0.11.1/specs/phase0/beacon-chain.md#signedbeaconblockheader) object envelope from the Eth2.0 spec. +type InlineResponse2007Header struct { + // The [`BeaconBlockHeader`](https://github.com/ethereum/eth2.0-specs/blob/v0.11.1/specs/phase0/beacon-chain.md#beaconblockheader) object from the Eth2.0 spec. + Message map[string]interface{} `json:"message,omitempty"` + Signature string `json:"signature,omitempty"` +} diff --git a/pkg/eth2spec/model_inline_response_200_8.go b/pkg/eth2spec/model_inline_response_200_8.go new file mode 100644 index 0000000..3c861ed --- /dev/null +++ b/pkg/eth2spec/model_inline_response_200_8.go @@ -0,0 +1,14 @@ +/* + * Eth2 Beacon Node API + * + * API specification for the beacon node, which enables users to query and participate in Ethereum 2.0 phase 0 beacon chain. + * + * API version: Dev - Eth2Spec v0.11.1 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package eth2spec +// InlineResponse2008 struct for InlineResponse2008 +type InlineResponse2008 struct { + Data InlineResponse2008Data `json:"data,omitempty"` +} diff --git a/pkg/eth2spec/model_inline_response_200_8_data.go b/pkg/eth2spec/model_inline_response_200_8_data.go new file mode 100644 index 0000000..2cd5b5c --- /dev/null +++ b/pkg/eth2spec/model_inline_response_200_8_data.go @@ -0,0 +1,15 @@ +/* + * Eth2 Beacon Node API + * + * API specification for the beacon node, which enables users to query and participate in Ethereum 2.0 phase 0 beacon chain. + * + * API version: Dev - Eth2Spec v0.11.1 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package eth2spec +// InlineResponse2008Data struct for InlineResponse2008Data +type InlineResponse2008Data struct { + Canonical bool `json:"canonical,omitempty"` + Header InlineResponse2007Header `json:"header,omitempty"` +} diff --git a/pkg/eth2spec/model_inline_response_200_9.go b/pkg/eth2spec/model_inline_response_200_9.go new file mode 100644 index 0000000..4f3ac89 --- /dev/null +++ b/pkg/eth2spec/model_inline_response_200_9.go @@ -0,0 +1,14 @@ +/* + * Eth2 Beacon Node API + * + * API specification for the beacon node, which enables users to query and participate in Ethereum 2.0 phase 0 beacon chain. + * + * API version: Dev - Eth2Spec v0.11.1 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package eth2spec +// InlineResponse2009 struct for InlineResponse2009 +type InlineResponse2009 struct { + Data InlineResponse2009Data `json:"data,omitempty"` +} diff --git a/pkg/eth2spec/model_inline_response_200_9_data.go b/pkg/eth2spec/model_inline_response_200_9_data.go new file mode 100644 index 0000000..039c77c --- /dev/null +++ b/pkg/eth2spec/model_inline_response_200_9_data.go @@ -0,0 +1,16 @@ +/* + * Eth2 Beacon Node API + * + * API specification for the beacon node, which enables users to query and participate in Ethereum 2.0 phase 0 beacon chain. + * + * API version: Dev - Eth2Spec v0.11.1 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package eth2spec +// InlineResponse2009Data The [`SignedBeaconBlock`](https://github.com/ethereum/eth2.0-specs/blob/v0.10.1/specs/phase0/beacon-chain.md#signedbeaconblock) object envelope from the Eth2.0 spec. +type InlineResponse2009Data struct { + // The [`BeaconBlock`](https://github.com/ethereum/eth2.0-specs/blob/v0.11.1/specs/phase0/beacon-chain.md#beaconblock) object from the Eth2.0 spec. + Message map[string]interface{} `json:"message,omitempty"` + Signature string `json:"signature,omitempty"` +} diff --git a/pkg/eth2spec/model_inline_response_200_data.go b/pkg/eth2spec/model_inline_response_200_data.go new file mode 100644 index 0000000..0971a5b --- /dev/null +++ b/pkg/eth2spec/model_inline_response_200_data.go @@ -0,0 +1,17 @@ +/* + * Eth2 Beacon Node API + * + * API specification for the beacon node, which enables users to query and participate in Ethereum 2.0 phase 0 beacon chain. + * + * API version: Dev - Eth2Spec v0.11.1 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package eth2spec +// InlineResponse200Data struct for InlineResponse200Data +type InlineResponse200Data struct { + GenesisTime string `json:"genesis_time,omitempty"` + GenesisValidatorsRoot string `json:"genesis_validators_root,omitempty"` + // a fork version number + GenesisForkVersion string `json:"genesis_fork_version,omitempty"` +} diff --git a/pkg/eth2spec/model_network_identity.go b/pkg/eth2spec/model_network_identity.go new file mode 100644 index 0000000..6b8e39c --- /dev/null +++ b/pkg/eth2spec/model_network_identity.go @@ -0,0 +1,20 @@ +/* + * Eth2 Beacon Node API + * + * API specification for the beacon node, which enables users to query and participate in Ethereum 2.0 phase 0 beacon chain. + * + * API version: Dev - Eth2Spec v0.11.1 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package eth2spec +// NetworkIdentity struct for NetworkIdentity +type NetworkIdentity struct { + // Cryptographic hash of a peer’s public key. [Read more](https://docs.libp2p.io/concepts/peer-id/) + PeerId string `json:"peer_id,omitempty"` + // Ethereum node record. [Read more](https://eips.ethereum.org/EIPS/eip-778) + Enr string `json:"enr,omitempty"` + P2pAddresses []string `json:"p2p_addresses,omitempty"` + DiscoveryAddresses []string `json:"discovery_addresses,omitempty"` + Metadata InlineResponse20015DataMetadata `json:"metadata,omitempty"` +} diff --git a/pkg/eth2spec/model_peer.go b/pkg/eth2spec/model_peer.go new file mode 100644 index 0000000..56680d1 --- /dev/null +++ b/pkg/eth2spec/model_peer.go @@ -0,0 +1,21 @@ +/* + * Eth2 Beacon Node API + * + * API specification for the beacon node, which enables users to query and participate in Ethereum 2.0 phase 0 beacon chain. + * + * API version: Dev - Eth2Spec v0.11.1 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package eth2spec +// Peer struct for Peer +type Peer struct { + // Cryptographic hash of a peer’s public key. [Read more](https://docs.libp2p.io/concepts/peer-id/) + PeerId string `json:"peer_id,omitempty"` + // Ethereum node record. [Read more](https://eips.ethereum.org/EIPS/eip-778) + Enr string `json:"enr,omitempty"` + // [Read more](https://docs.libp2p.io/reference/glossary/#multiaddr) + Address string `json:"address,omitempty"` + State string `json:"state,omitempty"` + Direction string `json:"direction,omitempty"` +} diff --git a/pkg/eth2spec/model_proposer_slashing.go b/pkg/eth2spec/model_proposer_slashing.go new file mode 100644 index 0000000..04867eb --- /dev/null +++ b/pkg/eth2spec/model_proposer_slashing.go @@ -0,0 +1,15 @@ +/* + * Eth2 Beacon Node API + * + * API specification for the beacon node, which enables users to query and participate in Ethereum 2.0 phase 0 beacon chain. + * + * API version: Dev - Eth2Spec v0.11.1 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package eth2spec +// ProposerSlashing The [`ProposerSlashing`](https://github.com/ethereum/eth2.0-specs/blob/v0.11.1/specs/phase0/beacon-chain.md#proposerslashing) object from the Eth2.0 spec. +type ProposerSlashing struct { + SignedHeader1 InlineResponse2007Header `json:"signed_header_1,omitempty"` + SignedHeader2 InlineResponse2007Header `json:"signed_header_2,omitempty"` +} diff --git a/pkg/eth2spec/model_signed_aggregate_and_proof.go b/pkg/eth2spec/model_signed_aggregate_and_proof.go new file mode 100644 index 0000000..37a3cbb --- /dev/null +++ b/pkg/eth2spec/model_signed_aggregate_and_proof.go @@ -0,0 +1,15 @@ +/* + * Eth2 Beacon Node API + * + * API specification for the beacon node, which enables users to query and participate in Ethereum 2.0 phase 0 beacon chain. + * + * API version: Dev - Eth2Spec v0.11.1 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package eth2spec +// SignedAggregateAndProof struct for SignedAggregateAndProof +type SignedAggregateAndProof struct { + Message map[string]interface{} `json:"message,omitempty"` + Signature string `json:"signature,omitempty"` +} diff --git a/pkg/eth2spec/model_signed_beacon_block.go b/pkg/eth2spec/model_signed_beacon_block.go new file mode 100644 index 0000000..a2b09a3 --- /dev/null +++ b/pkg/eth2spec/model_signed_beacon_block.go @@ -0,0 +1,16 @@ +/* + * Eth2 Beacon Node API + * + * API specification for the beacon node, which enables users to query and participate in Ethereum 2.0 phase 0 beacon chain. + * + * API version: Dev - Eth2Spec v0.11.1 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package eth2spec +// SignedBeaconBlock The [`SignedBeaconBlock`](https://github.com/ethereum/eth2.0-specs/blob/v0.10.1/specs/phase0/beacon-chain.md#signedbeaconblock) object envelope from the Eth2.0 spec. +type SignedBeaconBlock struct { + // The [`BeaconBlock`](https://github.com/ethereum/eth2.0-specs/blob/v0.11.1/specs/phase0/beacon-chain.md#beaconblock) object from the Eth2.0 spec. + Message map[string]interface{} `json:"message,omitempty"` + Signature string `json:"signature,omitempty"` +} diff --git a/pkg/eth2spec/model_signed_beacon_block_header.go b/pkg/eth2spec/model_signed_beacon_block_header.go new file mode 100644 index 0000000..935784c --- /dev/null +++ b/pkg/eth2spec/model_signed_beacon_block_header.go @@ -0,0 +1,16 @@ +/* + * Eth2 Beacon Node API + * + * API specification for the beacon node, which enables users to query and participate in Ethereum 2.0 phase 0 beacon chain. + * + * API version: Dev - Eth2Spec v0.11.1 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package eth2spec +// SignedBeaconBlockHeader The [`SignedBeaconBlockHeader`](https://github.com/ethereum/eth2.0-specs/blob/v0.11.1/specs/phase0/beacon-chain.md#signedbeaconblockheader) object envelope from the Eth2.0 spec. +type SignedBeaconBlockHeader struct { + // The [`BeaconBlockHeader`](https://github.com/ethereum/eth2.0-specs/blob/v0.11.1/specs/phase0/beacon-chain.md#beaconblockheader) object from the Eth2.0 spec. + Message map[string]interface{} `json:"message,omitempty"` + Signature string `json:"signature,omitempty"` +} diff --git a/pkg/eth2spec/model_signed_voluntary_exit.go b/pkg/eth2spec/model_signed_voluntary_exit.go new file mode 100644 index 0000000..69140f6 --- /dev/null +++ b/pkg/eth2spec/model_signed_voluntary_exit.go @@ -0,0 +1,15 @@ +/* + * Eth2 Beacon Node API + * + * API specification for the beacon node, which enables users to query and participate in Ethereum 2.0 phase 0 beacon chain. + * + * API version: Dev - Eth2Spec v0.11.1 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package eth2spec +// SignedVoluntaryExit The [`SignedVoluntaryExit`](https://github.com/ethereum/eth2.0-specs/blob/v0.11.1/specs/phase0/beacon-chain.md#signedvoluntaryexit) object from the Eth2.0 spec. +type SignedVoluntaryExit struct { + Message InlineResponse20014Message `json:"message,omitempty"` + Signature string `json:"signature,omitempty"` +} diff --git a/pkg/eth2spec/model_validator_response.go b/pkg/eth2spec/model_validator_response.go new file mode 100644 index 0000000..646d0ab --- /dev/null +++ b/pkg/eth2spec/model_validator_response.go @@ -0,0 +1,18 @@ +/* + * Eth2 Beacon Node API + * + * API specification for the beacon node, which enables users to query and participate in Ethereum 2.0 phase 0 beacon chain. + * + * API version: Dev - Eth2Spec v0.11.1 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package eth2spec +// ValidatorResponse struct for ValidatorResponse +type ValidatorResponse struct { + Index string `json:"index,omitempty"` + Balance string `json:"balance,omitempty"` + // Possible statuses: - **pending_initialized** - When the first deposit is processed, but not enough funds are available (or not yet the end of the first epoch) to get validator into the activation queue. - **pending_queued** - When validator is waiting to get activated, and have enough funds etc. while in the queue, validator activation epoch keeps changing until it gets to the front and make it through (finalization is a requirement here too). - **active_ongoing** - When validator must be attesting, and have not initiated any exit. - **active_exiting** - When validator is still active, but filed a voluntary request to exit. - **active_slashed** - When validator is still active, but have a slashed status and is scheduled to exit. - **exited_unslashed** - When validator has reached reguler exit epoch, not being slashed, and doesn't have to attest any more, but cannot withdraw yet. - **exited_slashed** - When validator has reached reguler exit epoch, but was slashed, have to wait for a longer withdrawal period. - **withdrawal_possible** - After validator has exited, a while later is permitted to move funds, and is truly out of the system. - **withdrawal_done** - (not possible in phase0, except slashing full balance) - actually having moved funds away [Validator status specification](https://hackmd.io/ofFJ5gOmQpu1jjHilHbdQQ) + Status string `json:"status,omitempty"` + Validator InlineResponse2004Validator `json:"validator,omitempty"` +} diff --git a/pkg/eth2spec/model_validator_status.go b/pkg/eth2spec/model_validator_status.go new file mode 100644 index 0000000..c76a4e6 --- /dev/null +++ b/pkg/eth2spec/model_validator_status.go @@ -0,0 +1,25 @@ +/* + * Eth2 Beacon Node API + * + * API specification for the beacon node, which enables users to query and participate in Ethereum 2.0 phase 0 beacon chain. + * + * API version: Dev - Eth2Spec v0.11.1 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package eth2spec +// ValidatorStatus Possible statuses: - **pending_initialized** - When the first deposit is processed, but not enough funds are available (or not yet the end of the first epoch) to get validator into the activation queue. - **pending_queued** - When validator is waiting to get activated, and have enough funds etc. while in the queue, validator activation epoch keeps changing until it gets to the front and make it through (finalization is a requirement here too). - **active_ongoing** - When validator must be attesting, and have not initiated any exit. - **active_exiting** - When validator is still active, but filed a voluntary request to exit. - **active_slashed** - When validator is still active, but have a slashed status and is scheduled to exit. - **exited_unslashed** - When validator has reached reguler exit epoch, not being slashed, and doesn't have to attest any more, but cannot withdraw yet. - **exited_slashed** - When validator has reached reguler exit epoch, but was slashed, have to wait for a longer withdrawal period. - **withdrawal_possible** - After validator has exited, a while later is permitted to move funds, and is truly out of the system. - **withdrawal_done** - (not possible in phase0, except slashing full balance) - actually having moved funds away [Validator status specification](https://hackmd.io/ofFJ5gOmQpu1jjHilHbdQQ) +type ValidatorStatus string + +// List of ValidatorStatus +const ( + PENDING_INITIALIZED ValidatorStatus = "pending_initialized" + PENDING_QUEUED ValidatorStatus = "pending_queued" + ACTIVE_ONGOING ValidatorStatus = "active_ongoing" + ACTIVE_EXITING ValidatorStatus = "active_exiting" + ACTIVE_SLASHED ValidatorStatus = "active_slashed" + EXITED_UNSLASHED ValidatorStatus = "exited_unslashed" + EXITED_SLASHED ValidatorStatus = "exited_slashed" + WITHDRAWAL_POSSIBLE ValidatorStatus = "withdrawal_possible" + WITHDRAWAL_DONE ValidatorStatus = "withdrawal_done" +) diff --git a/pkg/eth2spec/response.go b/pkg/eth2spec/response.go new file mode 100644 index 0000000..45ccf0f --- /dev/null +++ b/pkg/eth2spec/response.go @@ -0,0 +1,46 @@ +/* + * Eth2 Beacon Node API + * + * API specification for the beacon node, which enables users to query and participate in Ethereum 2.0 phase 0 beacon chain. + * + * API version: Dev - Eth2Spec v0.11.1 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package eth2spec + +import ( + "net/http" +) + +// APIResponse stores the API response returned by the server. +type APIResponse struct { + *http.Response `json:"-"` + Message string `json:"message,omitempty"` + // Operation is the name of the OpenAPI operation. + Operation string `json:"operation,omitempty"` + // RequestURL is the request URL. This value is always available, even if the + // embedded *http.Response is nil. + RequestURL string `json:"url,omitempty"` + // Method is the HTTP method used for the request. This value is always + // available, even if the embedded *http.Response is nil. + Method string `json:"method,omitempty"` + // Payload holds the contents of the response body (which may be nil or empty). + // This is provided here as the raw response.Body() reader will have already + // been drained. + Payload []byte `json:"-"` +} + +// NewAPIResponse returns a new APIResonse object. +func NewAPIResponse(r *http.Response) *APIResponse { + + response := &APIResponse{Response: r} + return response +} + +// NewAPIResponseWithError returns a new APIResponse object with the provided error message. +func NewAPIResponseWithError(errorMessage string) *APIResponse { + + response := &APIResponse{Message: errorMessage} + return response +} diff --git a/pkg/oapi/BUILD.bazel b/pkg/oapi/BUILD.bazel new file mode 100644 index 0000000..c6119f7 --- /dev/null +++ b/pkg/oapi/BUILD.bazel @@ -0,0 +1,12 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library") + +go_library( + name = "go_default_library", + srcs = ["oapi.go"], + importpath = "github.com/INFURA/eth2-comply/pkg/oapi", + visibility = ["//visibility:public"], + deps = [ + "//pkg/eth2spec:go_default_library", + "@com_github_antihax_optional//:go_default_library", + ], +) diff --git a/pkg/oapi/oapi.go b/pkg/oapi/oapi.go new file mode 100644 index 0000000..503a3ce --- /dev/null +++ b/pkg/oapi/oapi.go @@ -0,0 +1,433 @@ +// package oapi primarily provides executors for Ethereum 2.0 API operations. +package oapi + +import ( + "context" + "net/url" + + "github.com/INFURA/eth2-comply/pkg/eth2spec" + "github.com/antihax/optional" +) + +// NewClient returns an OAPI client which can conduct operations against the +// provided target. +func NewClient(target url.URL) *eth2spec.APIClient { + cfg := eth2spec.NewConfiguration() + + cfg.Host = target.Host + + client := eth2spec.NewAPIClient(cfg) + + return client +} + +// ExecutorResult is the first element in the uniform tuple returned by all +// oapi executor functions. +type ExecutorResult struct { + // Response is an instantiated OAPI data structure of the type returned + // by the executor for a function's route. + Response interface{} + // ResponseDS (DS = Data Structure) is an empty OAPI data structure of + // the type returned by the executor for a function's route. Properly + // encoded expected responses can be unmarshaled into this struct. This + // struct can be marshaled into a canonical JSON encoding to compare + // against the actual response. + ResponseDS interface{} + // StatusCode is the HTTP status code returned for the operation executed + // by the function. It can be used to compare against expected status + // code results. + StatusCode *int +} + +func ExecGetBeaconGenesis(ctx context.Context, client *eth2spec.APIClient) (*ExecutorResult, error) { + genesis, httpdata, err := client.BeaconApi.GetGenesis(ctx) + if err != nil { + return nil, err + } + + result := &ExecutorResult{ + Response: genesis, + ResponseDS: eth2spec.InlineResponse200{}, + StatusCode: &httpdata.StatusCode, + } + + return result, nil +} + +func ExecGetBeaconStatesFork(ctx context.Context, client *eth2spec.APIClient, stateId string) (*ExecutorResult, error) { + fork, httpdata, err := client.BeaconApi.GetStateFork(ctx, stateId) + if err != nil { + return nil, err + } + + result := &ExecutorResult{ + Response: fork, + ResponseDS: eth2spec.InlineResponse2002{}, + StatusCode: &httpdata.StatusCode, + } + + return result, nil +} + +func ExecGetBeaconStatesRoot(ctx context.Context, client *eth2spec.APIClient, stateId string) (*ExecutorResult, error) { + root, httpdata, err := client.BeaconApi.GetStateRoot(ctx, stateId) + if err != nil { + return nil, err + } + + result := &ExecutorResult{ + Response: root, + ResponseDS: eth2spec.InlineResponse2001{}, + StatusCode: &httpdata.StatusCode, + } + + return result, nil +} + +func ExecGetBeaconStatesFinalityCheckpoints(ctx context.Context, client *eth2spec.APIClient, stateId string) (*ExecutorResult, error) { + finalityCheckpoint, httpdata, err := client.BeaconApi.GetStateFinalityCheckpoints(ctx, stateId) + if err != nil { + return nil, err + } + + result := &ExecutorResult{ + Response: finalityCheckpoint, + ResponseDS: eth2spec.InlineResponse2003{}, + StatusCode: &httpdata.StatusCode, + } + + return result, nil +} + +type ExecGetBeaconStatesCommitteesOpts struct { + StateId string + Epoch string + QueryParams map[string]string +} + +func ExecGetBeaconStatesCommittees(ctx context.Context, client *eth2spec.APIClient, opts *ExecGetBeaconStatesCommitteesOpts) (*ExecutorResult, error) { + + getEpochCommitteesOpts := ð2spec.GetEpochCommitteesOpts{} + + if len(opts.QueryParams["index"]) > 0 { + getEpochCommitteesOpts.Index = optional.NewInterface(opts.QueryParams["index"]) + } + if len(opts.QueryParams["slot"]) > 0 { + getEpochCommitteesOpts.Slot = optional.NewInterface(opts.QueryParams["slot"]) + } + + committees, httpdata, err := client.BeaconApi.GetEpochCommittees(ctx, opts.StateId, opts.Epoch, getEpochCommitteesOpts) + if err != nil { + return nil, err + } + + result := &ExecutorResult{ + Response: committees, + ResponseDS: eth2spec.InlineResponse2006{}, + StatusCode: &httpdata.StatusCode, + } + + return result, nil +} + +type ExecGetBeaconStatesValidatorsOpts struct { + StateId string + QueryParams map[string]string +} + +func ExecGetBeaconStatesValidators(ctx context.Context, client *eth2spec.APIClient, opts *ExecGetBeaconStatesValidatorsOpts) (*ExecutorResult, error) { + getStateValidatorsOpts := ð2spec.GetStateValidatorsOpts{} + + if len(opts.QueryParams["id"]) > 0 { + getStateValidatorsOpts.Id = optional.NewInterface(opts.QueryParams["id"]) + } + if len(opts.QueryParams["status"]) > 0 { + getStateValidatorsOpts.Status = optional.NewInterface(opts.QueryParams["status"]) + } + + validators, httpdata, err := client.BeaconApi.GetStateValidators(ctx, opts.StateId, getStateValidatorsOpts) + if err != nil { + return nil, err + } + + result := &ExecutorResult{ + Response: validators, + ResponseDS: eth2spec.InlineResponse2004{}, + StatusCode: &httpdata.StatusCode, + } + + return result, nil +} + +type ExecGetBeaconStatesValidatorsWithValidatorIdOpts struct { + StateId string + ValidatorId string +} + +func ExecGetBeaconStatesValidator(ctx context.Context, client *eth2spec.APIClient, opts *ExecGetBeaconStatesValidatorsWithValidatorIdOpts) (*ExecutorResult, error) { + validator, httpdata, err := client.BeaconApi.GetStateValidator(ctx, opts.StateId, opts.ValidatorId) + if err != nil { + return nil, err + } + + result := &ExecutorResult{ + Response: validator, + ResponseDS: eth2spec.InlineResponse2005{}, + StatusCode: &httpdata.StatusCode, + } + + return result, nil +} + +func ExecGetBeaconHeaders(ctx context.Context, client *eth2spec.APIClient, queryParams map[string]string) (*ExecutorResult, error) { + getBlockHeaderOpts := ð2spec.GetBlockHeadersOpts{} + + if len(queryParams["slot"]) > 0 { + getBlockHeaderOpts.Slot = optional.NewInterface(queryParams["slot"]) + } + if len(queryParams["parent_root"]) > 0 { + getBlockHeaderOpts.ParentRoot = optional.NewInterface(queryParams["parent_root"]) + } + + headers, httpdata, err := client.BeaconApi.GetBlockHeaders(ctx, getBlockHeaderOpts) + if err != nil { + return nil, err + } + + result := &ExecutorResult{ + Response: headers, + ResponseDS: eth2spec.InlineResponse2007{}, + StatusCode: &httpdata.StatusCode, + } + + return result, nil +} + +func ExecGetBeaconHeader(ctx context.Context, client *eth2spec.APIClient, blockId string) (*ExecutorResult, error) { + + header, httpdata, err := client.BeaconApi.GetBlockHeader(ctx, blockId) + if err != nil { + return nil, err + } + + result := &ExecutorResult{ + Response: header, + ResponseDS: eth2spec.InlineResponse2008{}, + StatusCode: &httpdata.StatusCode, + } + + return result, nil +} + +func ExecGetBeaconBlock(ctx context.Context, client *eth2spec.APIClient, blockId string) (*ExecutorResult, error) { + block, httpdata, err := client.BeaconApi.GetBlock(ctx, blockId) + if err != nil { + return nil, err + } + + result := &ExecutorResult{ + Response: block, + ResponseDS: eth2spec.InlineResponse2009{}, + StatusCode: &httpdata.StatusCode, + } + + return result, nil +} + +func ExecGetBeaconBlockRoot(ctx context.Context, client *eth2spec.APIClient, blockId string) (*ExecutorResult, error) { + blockRoot, httpdata, err := client.BeaconApi.GetBlockRoot(ctx, blockId) + if err != nil { + return nil, err + } + + result := &ExecutorResult{ + Response: blockRoot, + ResponseDS: eth2spec.InlineResponse20010{}, + StatusCode: &httpdata.StatusCode, + } + + return result, nil +} + +func ExecGetBeaconBlockAttestations(ctx context.Context, client *eth2spec.APIClient, blockId string) (*ExecutorResult, error) { + blockAttestations, httpdata, err := client.BeaconApi.GetBlockAttestations(ctx, blockId) + if err != nil { + return nil, err + } + + result := &ExecutorResult{ + Response: blockAttestations, + ResponseDS: eth2spec.InlineResponse20011{}, + StatusCode: &httpdata.StatusCode, + } + + return result, nil +} + +func ExecGetBeaconPoolAttestations(ctx context.Context, client *eth2spec.APIClient, queryParams map[string]string) (*ExecutorResult, error) { + getPoolAttestationsOpts := ð2spec.GetPoolAttestationsOpts{} + + if len(queryParams["slot"]) > 0 { + getPoolAttestationsOpts.Slot = optional.NewString(queryParams["slot"]) + } + if len(queryParams["committee_index"]) > 0 { + getPoolAttestationsOpts.CommitteeIndex = optional.NewString(queryParams["committee_index"]) + } + + poolAttestations, httpdata, err := client.BeaconApi.GetPoolAttestations(ctx, getPoolAttestationsOpts) + if err != nil { + return nil, err + } + + result := &ExecutorResult{ + Response: poolAttestations, + ResponseDS: eth2spec.InlineResponse20011{}, + StatusCode: &httpdata.StatusCode, + } + + return result, nil +} + +func ExecGetBeaconPoolAttesterSlashings(ctx context.Context, client *eth2spec.APIClient) (*ExecutorResult, error) { + + attesterSlashings, httpdata, err := client.BeaconApi.GetPoolAttesterSlashings(ctx) + if err != nil { + return nil, err + } + + result := &ExecutorResult{ + Response: attesterSlashings, + ResponseDS: eth2spec.InlineResponse20012{}, + StatusCode: &httpdata.StatusCode, + } + + return result, nil +} + +func ExecGetBeaconPoolProposerSlashings(ctx context.Context, client *eth2spec.APIClient) (*ExecutorResult, error) { + + proposerSlashings, httpdata, err := client.BeaconApi.GetPoolProposerSlashings(ctx) + if err != nil { + return nil, err + } + + result := &ExecutorResult{ + Response: proposerSlashings, + ResponseDS: eth2spec.InlineResponse20013{}, + StatusCode: &httpdata.StatusCode, + } + + return result, nil +} + +func ExecGetBeaconPoolVoluntaryExits(ctx context.Context, client *eth2spec.APIClient) (*ExecutorResult, error) { + + voluntaryExits, httpdata, err := client.BeaconApi.GetPoolVoluntaryExits(ctx) + if err != nil { + return nil, err + } + + result := &ExecutorResult{ + Response: voluntaryExits, + ResponseDS: eth2spec.InlineResponse20014{}, + StatusCode: &httpdata.StatusCode, + } + + return result, nil +} + +func ExecGetNodeHealth(ctx context.Context, client *eth2spec.APIClient) (*ExecutorResult, error) { + + httpdata, err := client.NodeApi.GetHealth(ctx) + if err != nil { + return nil, err + } + + result := &ExecutorResult{ + Response: nil, + ResponseDS: nil, + StatusCode: &httpdata.StatusCode, + } + + return result, nil +} + +func ExecGetNodeSyncing(ctx context.Context, client *eth2spec.APIClient) (*ExecutorResult, error) { + + syncing, httpdata, err := client.NodeApi.GetSyncingStatus(ctx) + if err != nil { + return nil, err + } + + result := &ExecutorResult{ + Response: syncing, + ResponseDS: eth2spec.InlineResponse20019{}, + StatusCode: &httpdata.StatusCode, + } + + return result, nil +} + +func ExecGetNodeVersion(ctx context.Context, client *eth2spec.APIClient) (*ExecutorResult, error) { + + version, httpdata, err := client.NodeApi.GetNodeVersion(ctx) + if err != nil { + return nil, err + } + + result := &ExecutorResult{ + Response: version, + ResponseDS: eth2spec.InlineResponse20018{}, + StatusCode: &httpdata.StatusCode, + } + + return result, nil +} + +func ExecGetNodeIdentity(ctx context.Context, client *eth2spec.APIClient) (*ExecutorResult, error) { + + identity, httpdata, err := client.NodeApi.GetNetworkIdentity(ctx) + if err != nil { + return nil, err + } + + result := &ExecutorResult{ + Response: identity, + ResponseDS: eth2spec.InlineResponse20015{}, + StatusCode: &httpdata.StatusCode, + } + + return result, nil +} + +func ExecGetNodePeers(ctx context.Context, client *eth2spec.APIClient) (*ExecutorResult, error) { + + peers, httpdata, err := client.NodeApi.GetPeers(ctx) + if err != nil { + return nil, err + } + + result := &ExecutorResult{ + Response: peers, + ResponseDS: eth2spec.InlineResponse20016{}, + StatusCode: &httpdata.StatusCode, + } + + return result, nil +} + +func ExecGetNodePeer(ctx context.Context, client *eth2spec.APIClient, peerId string) (*ExecutorResult, error) { + + peer, httpdata, err := client.NodeApi.GetPeer(ctx, peerId) + if err != nil { + return nil, err + } + + result := &ExecutorResult{ + Response: peer, + ResponseDS: eth2spec.InlineResponse20017{}, + StatusCode: &httpdata.StatusCode, + } + + return result, nil +} diff --git a/pkg/testcases/BUILD.bazel b/pkg/testcases/BUILD.bazel new file mode 100644 index 0000000..5d4821c --- /dev/null +++ b/pkg/testcases/BUILD.bazel @@ -0,0 +1,16 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library") + +go_library( + name = "go_default_library", + srcs = [ + "import.go", + "router.go", + "testcases.go", + ], + importpath = "github.com/INFURA/eth2-comply/pkg/testcases", + visibility = ["//visibility:public"], + deps = [ + "//pkg/eth2spec:go_default_library", + "//pkg/oapi:go_default_library", + ], +) diff --git a/pkg/testcases/import.go b/pkg/testcases/import.go new file mode 100644 index 0000000..51ddeed --- /dev/null +++ b/pkg/testcases/import.go @@ -0,0 +1,226 @@ +package testcases + +import ( + "archive/zip" + "encoding/json" + "fmt" + "io" + "io/ioutil" + "net/http" + "os" + "path/filepath" + "strings" + + "github.com/INFURA/eth2-comply/pkg/eth2spec" +) + +// TestsCasesOpts are used to configure statically defined test cases with +// dynamic values at runtime. +type TestsCasesOpts struct { + // target is a URL hosting an Ethereum 2.0 API where test requests should + // be sent. For example, http://localhost:5051 + Target string + // TestsRemote is a URL to a zip file containing a directory tree + // containing well-specified JSON tests cases. + TestsRemote string + // OutDir is the directory where zip files will be downloaded, and + // unzipped. + OutDir string + // testsRoot is a file path to a directory tree containing well-specified + // JSON tests cases. + TestsRoot string + // oapiClient is an instantiated Ethereum 2.0 OAPI client which will be + // used to conduct OAPI operations. + OapiClient *eth2spec.APIClient +} + +// All returns an array of executable test cases for the directory tree +// specified by testsRoot. Tests will be executable against the given target. +// +// Cases recursively traverses down the testsRoot directory and collects all +// test cases it finds. *Any* file in the dir tree which is not a directory or +// a well-formed JSON test case will cause this function to return an error. +func All(opts *TestsCasesOpts) ([]*Case, error) { + configs := []CaseConfig{} + cases := []*Case{} + + if opts.TestsRemote != "" { + filePath, err := getRemoteTestsFile(opts.TestsRemote, opts.OutDir) + if err != nil { + return nil, err + } + err = Unzip(filePath, opts.OutDir) + if err != nil { + return nil, err + } + // Overwrite opts.TestsRoot + opts.TestsRoot = filepath.Join(opts.OutDir, "tests") + } + + configs, err := getConfigsFromDirTree(opts.TestsRoot, configs) + if err != nil { + return nil, err + } + + for _, config := range configs { + config.Route = opts.Target + config.Route + if err != nil { + return nil, err + } + c := NewCase(config, opts.OapiClient) + + cases = append(cases, c) + + } + + return cases, nil + +} + +type TestSpecificationError struct { + Filepath string + Err error +} + +func (e TestSpecificationError) Error() string { + return fmt.Sprintf("Error parsing %s: %s", e.Filepath, e.Err.Error()) +} + +// getConfigsFromDirTree recursively traverses down the root directory and +// collects test cases it finds. *Any* file in the dir tree which is not a +// directory or a well-formed JSON test case will cause this function to +// return an error. +func getConfigsFromDirTree(root string, configs []CaseConfig) ([]CaseConfig, error) { + rootDir, err := os.Open(root) + if err != nil { + return nil, err + } + + filesInDir, err := rootDir.Readdir(0) + if err != nil { + return nil, err + } + + for _, fileInfo := range filesInDir { + if fileInfo.IsDir() { + // Recursive case, found a directory + configs, err = getConfigsFromDirTree(root+"/"+fileInfo.Name(), configs) + if err != nil { + return nil, err + } + } else { + // Base case, found files + config := CaseConfig{} + filePath := root + "/" + fileInfo.Name() + file, err := os.Open(filePath) + if err != nil { + return nil, TestSpecificationError{ + Filepath: filePath, + Err: err, + } + } + + fileData, err := ioutil.ReadAll(file) + if err != nil { + return nil, TestSpecificationError{ + Filepath: filePath, + Err: err, + } + } + + err = json.Unmarshal(fileData, &config) + if err != nil { + return nil, TestSpecificationError{ + Filepath: filePath, + Err: err, + } + } + + configs = append(configs, config) + } + } + + return configs, nil +} + +// Unzip unzips a zip file into the provided outDir +func Unzip(zipFilePath, outDir string) error { + zipFileReader, err := zip.OpenReader(zipFilePath) + if err != nil { + return err + } + + // Create root tests directory + err = os.MkdirAll(outDir, 0777) + if err != nil { + zipFileReader.Close() + return err + } + + // Write all the tests out into the tests directory + for _, zippedFile := range zipFileReader.File { + fileName := filepath.Join(outDir, zippedFile.Name) + + if zippedFile.FileInfo().IsDir() { + // Create inner directory + err = os.MkdirAll(fileName, 0777) + if err != nil { + return err + } + } else { + // Create file + err = os.MkdirAll(filepath.Dir(fileName), 0777) + if err != nil { + return err + } + f, err := os.Create(fileName) + if err != nil { + return err + } + + // Write file contents + fileReader, err := zippedFile.Open() + if err != nil { + return err + } + _, err = io.Copy(f, fileReader) + if err != nil { + return err + } + + f.Close() + fileReader.Close() + } + } + + zipFileReader.Close() + return nil +} + +// getRemoteTestsFile fetches a ZIP file from the location specified in +// testsRemote and places it in the outDir. +func getRemoteTestsFile(testsRemote, outDir string) (string, error) { + resp, err := http.Get(testsRemote) + if err != nil { + return "", err + } + + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return "", err + } + + // Place remote zip into /tmp directory + pathParts := strings.Split(testsRemote, "/") + fileName := filepath.Join(outDir, pathParts[len(pathParts)-1]) + f, err := os.Create(fileName) + if err != nil { + return "", err + } + _, err = f.Write(body) + if err != nil { + return "", err + } + + return fileName, nil +} diff --git a/pkg/testcases/router.go b/pkg/testcases/router.go new file mode 100644 index 0000000..23dcaf3 --- /dev/null +++ b/pkg/testcases/router.go @@ -0,0 +1,164 @@ +package testcases + +import ( + "context" + "fmt" + "net/url" + "strings" + + "github.com/INFURA/eth2-comply/pkg/oapi" +) + +type UnimplementedOperationError struct { + method string + route string +} + +func (e UnimplementedOperationError) Error() string { + return fmt.Sprintf("Tests for the operation %s %s are not supported.", e.method, e.route) +} + +// execOperation is a big if-else tree that uses the CaseConfig method and +// route to determine the appropriate OAPI executor to use for actually +// executing the operation under test. +// +// For routes that use path params, it is the responsibility of the case for +// that route in this function to extract the path param and pass it along to +// the constituent oapi executor function. +func (c Case) execOperation(ctx context.Context) (*oapi.ExecutorResult, error) { + _route, err := url.Parse(c.Config.Route) + if err != nil { + return nil, err + } + route := _route.RequestURI() + + switch c.Config.Method { + case "GET": + return c.execGetOperation(ctx, route) + case "POST": + return c.execPostOperation(ctx, route) + } + + return nil, UnimplementedOperationError{method: c.Config.Method, route: route} +} + +func (c Case) execGetOperation(ctx context.Context, route string) (*oapi.ExecutorResult, error) { + switch { + case strings.Contains(route, "/node/"): + return c.execGetNodeOperation(ctx, route) + case strings.Contains(route, "/beacon/"): + return c.execGetBeaconOperation(ctx, route) + + } + + return nil, UnimplementedOperationError{method: c.Config.Method, route: route} +} + +func (c Case) execPostOperation(ctx context.Context, route string) (*oapi.ExecutorResult, error) { + return nil, UnimplementedOperationError{method: c.Config.Method, route: route} +} + +func (c Case) execGetBeaconOperation(ctx context.Context, route string) (*oapi.ExecutorResult, error) { + uriTokens := strings.Split(route, "/") + + switch { + case strings.Contains(route, "/genesis"): + return oapi.ExecGetBeaconGenesis(ctx, c.OapiClient) + case strings.Contains(route, "/headers/"): + blockId := uriTokens[4] + return oapi.ExecGetBeaconHeader(ctx, c.OapiClient, blockId) + case strings.Contains(route, "/headers"): + return oapi.ExecGetBeaconHeaders(ctx, c.OapiClient, c.Config.QueryParams) + case strings.Contains(route, "/blocks/"): + blockId := uriTokens[4] + switch { + case strings.Contains(route, "/root"): + return oapi.ExecGetBeaconBlockRoot(ctx, c.OapiClient, blockId) + case strings.Contains(route, "/attestations"): + return oapi.ExecGetBeaconBlockAttestations(ctx, c.OapiClient, blockId) + default: + return oapi.ExecGetBeaconBlock(ctx, c.OapiClient, blockId) + } + case strings.Contains(route, "/pool/"): + return c.execGetBeaconPoolOperation(ctx, route) + case strings.Contains(route, "/states/"): + return c.execGetBeaconStatesOperation(ctx, route) + } + + return nil, UnimplementedOperationError{method: c.Config.Method, route: route} +} + +func (c Case) execGetNodeOperation(ctx context.Context, route string) (*oapi.ExecutorResult, error) { + uriTokens := strings.Split(route, "/") + + switch { + case strings.Contains(route, "/health"): + return oapi.ExecGetNodeHealth(ctx, c.OapiClient) + case strings.Contains(route, "/syncing"): + return oapi.ExecGetNodeSyncing(ctx, c.OapiClient) + case strings.Contains(route, "/version"): + return oapi.ExecGetNodeVersion(ctx, c.OapiClient) + case strings.Contains(route, "/peers/"): + peerId := uriTokens[len(uriTokens)-1] + return oapi.ExecGetNodePeer(ctx, c.OapiClient, peerId) + case strings.Contains(route, "/peers"): + return oapi.ExecGetNodePeers(ctx, c.OapiClient) + case strings.Contains(route, "/identity"): + return oapi.ExecGetNodeIdentity(ctx, c.OapiClient) + + } + + return nil, UnimplementedOperationError{method: c.Config.Method, route: route} +} + +func (c Case) execGetBeaconPoolOperation(ctx context.Context, route string) (*oapi.ExecutorResult, error) { + switch { + case strings.Contains(route, "/attestations"): + return oapi.ExecGetBeaconPoolAttestations(ctx, c.OapiClient, c.Config.QueryParams) + case strings.Contains(route, "/attester_slashings"): + return oapi.ExecGetBeaconPoolAttesterSlashings(ctx, c.OapiClient) + case strings.Contains(route, "/proposer_slashings"): + return oapi.ExecGetBeaconPoolProposerSlashings(ctx, c.OapiClient) + case strings.Contains(route, "/voluntary_exits"): + return oapi.ExecGetBeaconPoolVoluntaryExits(ctx, c.OapiClient) + } + + return nil, UnimplementedOperationError{method: c.Config.Method, route: route} +} + +func (c Case) execGetBeaconStatesOperation(ctx context.Context, route string) (*oapi.ExecutorResult, error) { + uriTokens := strings.Split(route, "/") + stateId := uriTokens[4] + + switch { + case strings.Contains(route, "/committees/"): + epoch := uriTokens[6] + opts := &oapi.ExecGetBeaconStatesCommitteesOpts{ + StateId: stateId, + Epoch: epoch, + QueryParams: c.Config.QueryParams, + } + return oapi.ExecGetBeaconStatesCommittees(ctx, c.OapiClient, opts) + case strings.Contains(route, "/finality_checkpoints"): + return oapi.ExecGetBeaconStatesFinalityCheckpoints(ctx, c.OapiClient, stateId) + case strings.Contains(route, "/fork"): + return oapi.ExecGetBeaconStatesFork(ctx, c.OapiClient, stateId) + case strings.Contains(route, "/root"): + return oapi.ExecGetBeaconStatesRoot(ctx, c.OapiClient, stateId) + case strings.Contains(route, "/validators/"): + validatorId := uriTokens[6] + opts := &oapi.ExecGetBeaconStatesValidatorsWithValidatorIdOpts{ + StateId: stateId, + ValidatorId: validatorId, + } + return oapi.ExecGetBeaconStatesValidator(ctx, c.OapiClient, opts) + case strings.Contains(route, "/validators"): + opts := &oapi.ExecGetBeaconStatesValidatorsOpts{ + StateId: stateId, + QueryParams: c.Config.QueryParams, + } + return oapi.ExecGetBeaconStatesValidators(ctx, c.OapiClient, opts) + } + + return nil, UnimplementedOperationError{method: c.Config.Method, route: route} +} diff --git a/pkg/testcases/testcases.go b/pkg/testcases/testcases.go new file mode 100644 index 0000000..b63fd4f --- /dev/null +++ b/pkg/testcases/testcases.go @@ -0,0 +1,314 @@ +// package testcases defines the Case data structure, and a public function for +// instantiating slices of Cases from JSON test specifications in directory +// trees on the filesystem. +package testcases + +import ( + "bytes" + "context" + "encoding/json" + "fmt" + "net/url" + "reflect" + "strconv" + "strings" + "time" + + "github.com/INFURA/eth2-comply/pkg/eth2spec" + "github.com/INFURA/eth2-comply/pkg/oapi" +) + +// Case is an executable test case. The Config property can be accessed to get +// information about the case scenario. +type Case struct { + Config CaseConfig + OapiClient *eth2spec.APIClient + Result Result + Done chan struct{} +} + +// CaseConfig describes a test scenario. +type CaseConfig struct { + Method string + Route string + AwaitSlot int + QueryParams map[string]string + ReqBody interface{} + ExpectedRespStatus int + ExpectedRespBody interface{} +} + +// Result describes the result of a test. Error is nil is success is true. +type Result struct { + Success bool + Error error +} + +// NewCase instantiates and returns a Case struct. +func NewCase(config CaseConfig, oapiClient *eth2spec.APIClient) *Case { + c := &Case{} + + c.Config = config + c.OapiClient = oapiClient + c.Result = Result{} + c.Done = make(chan struct{}) + + return c +} + +type OapiError struct { + Err error + ServerResponse []byte +} + +func (e OapiError) Error() string { + return fmt.Sprintf(" OpenAPI client error! A 404 error means the target does not implement the route. A json unmarshaling error means the target implements the route response incorrectly.\n\n Error:\n %s\n Received server message:\n %s", e.Err.Error(), string(e.ServerResponse)) +} + +type ExpectationsError struct { + Err error +} + +func (e ExpectationsError) Error() string { + return fmt.Sprintf(" Response did not satisfy expectations!\n\n Error:\n%s", e.Err.Error()) +} + +// Exec executes a test Case and populates the Case's Result struct. The Result +// is unsuccessful and an error is stored in any of three cases: +// +// 1. The response was invalid for the request according to the OAPI schema. +// 2. The response contents did not satisfy the Case's expectations (if any). +// 3. Other reasons pertaining to the case specification or the environment. +// For example, the case contains an invalid route or cannot be unmarshaled +// (is ill-formed), or a network condition prevented contacting the target. +// +// Otherwise, the Result is marked as a Success and the Error is left nil. +func (c *Case) Exec(ctx context.Context) { + defer close(c.Done) + + // If a test specifies an await slot, wait for the node to sync that slot. + // Otherwise, just wait for the node to be healthy. awaitTargetHasSlot + // uses awaitTargetIsHealthy internally. + var err error + switch { + case c.Config.AwaitSlot > 0: + err = c.awaitTargetHasSlot(ctx) + default: + err = c.awaitTargetIsHealthy(ctx) + } + if err != nil { + c.setFailure(err) + return + } + + result, err := c.execOperation(ctx) + if err != nil { + // If the response is invalid in the OAPI schema, set that error here. + oapiErr, ok := err.(eth2spec.GenericOpenAPIError) + if ok { + if len(oapiErr.Body()) > 0 { + c.setFailure(OapiError{Err: oapiErr, ServerResponse: oapiErr.Body()}) + return + } + } + + // If an environmental error like a network failure occurred, set that + // failure here. + c.setFailure(err) + return + } + + err = c.assertExpectations(result) + if err != nil { + c.setFailure(ExpectationsError{Err: err}) + return + } + + c.Result.Success = true +} + +// setFailure marks a test case as having failed and records a corresponding +// error. +func (c *Case) setFailure(err error) { + c.Result.Success = false + c.Result.Error = err +} + +// PrintResults pretty-prints a test case and its result to stdout. +func (c Case) PrintResults() { + route, err := url.Parse(c.Config.Route) + if err != nil { + // Panic on user-error + panicMsg := fmt.Sprintf("Could not parse url %s when printing test results", c.Config.Route) + panic(panicMsg) + } + + routeString := fmt.Sprintf("%s %s", c.Config.Method, route.RequestURI()) + if len(c.Config.QueryParams) > 0 { + routeString = fmt.Sprintf("%s%s", routeString, "?") + for i, x := range c.Config.QueryParams { + routeString = fmt.Sprintf("%s%s=%s,", routeString, i, x) + } + routeString = routeString[:len(routeString)-1] + } + + fmt.Printf("%s ", routeString) + + if !c.Result.Success { + fmt.Printf("❌\n") + fmt.Println(c.Result.Error) + } else { + fmt.Printf("✅\n") + } +} + +// assertExpectations does expectations checking for the Case and returns an +// error if any stated expectations are not satisfied by actual results. +func (c Case) assertExpectations(result *oapi.ExecutorResult) error { + // If the config has an expected resonse status, evaluate that. + if c.Config.ExpectedRespStatus != 0 { + if c.Config.ExpectedRespStatus != *result.StatusCode { + return fmt.Errorf("Expected status code: %d\nReceived status code: %d", c.Config.ExpectedRespStatus, *result.StatusCode) + } + } + + // If the config has an expected response body, evaluate that. + if c.Config.ExpectedRespBody != nil { + // If the expected response is a simple string and not a JSON blob, do + // that comparison here. + if expectedString, ok := c.Config.ExpectedRespBody.(string); ok { + actualString := reflect.ValueOf(result.Response).String() + if strings.Compare(expectedString, actualString) != 0 { + return fmt.Errorf("Expected response body:\n%s\n\nReceived response body:\n%s", expectedString, actualString) + } + } else { + // If the expected response body is JSON, do that comparison that here. + err := c.compareActualAndExpectedJson(result) + if err != nil { + return err + } + } + + } + + return nil +} + +// compareActualAndExpectedJson unmarshals the expected response body into the +// appropriate Go type, only then to marshal it back out to JSON in a +// canonicalized form. The received JSON is already stored in its canonical +// data structure and is marshaled into canonicalized JSON bytes as well. The +// bytes are compared. An error is returned if the canonicalizes byte slices +// are not identical, or if there was an issue marshaling or unmarshaling any +// data. +func (c Case) compareActualAndExpectedJson(result *oapi.ExecutorResult) error { + data, err := json.Marshal(c.Config.ExpectedRespBody) + if err != nil { + return err + } + + err = json.Unmarshal(data, &result.ResponseDS) + if err != nil { + return err + } + canonicalizedExpected, err := json.Marshal(result.ResponseDS) + if err != nil { + return err + } + + canonicalizedActual, err := json.Marshal(result.Response) + if err != nil { + return err + } + + if !bytes.Equal(canonicalizedExpected, canonicalizedActual) { + return fmt.Errorf("Expected response body:\n%s\n\nReceived response body:\n%s", canonicalizedExpected, canonicalizedActual) + } + + return nil +} + +type TargetNodeSyncingError struct{} + +func (e TargetNodeSyncingError) Error() string { + return "The target does not correctly implement /node/syncing, which is required by eth2-comply. SyncStatus values should be JSON strings, not numbers." +} + +// awaitTargetIsHealthy blocks until the target server reports itself as being +// ready. +func (c Case) awaitTargetIsHealthy(ctx context.Context) error { + for { + if ctx.Err() != nil { + return BadTargetError{Route: "/node/health", Err: ctx.Err()} + } + + httpdata, _ := c.OapiClient.NodeApi.GetHealth(ctx) + switch { + case httpdata != nil && (httpdata.StatusCode == 200 || httpdata.StatusCode == 206): + return nil + default: + time.Sleep(time.Second) + continue + } + } + +} + +type BadTargetError struct { + Route string + Err error +} + +func (e BadTargetError) Error() string { + return fmt.Sprintf("BadTargetError\n%s %s\n\nTarget never became healthy. Targets MUST implement /node/health AND /node/syncing correctly as pre-requisites for compatability with eth2-comply. These routes are used by eth2-comply's control flow to manage test runs. For information about the correct implementation of these routes, see https://ethereum.github.io/eth2.0-APIs/", e.Route, e.Err.Error()) +} + +// awaitTargetHasSlot blocks until the target server has synchronized the slot needed +// for the test case. +func (c Case) awaitTargetHasSlot(ctx context.Context) error { + err := c.awaitTargetIsHealthy(ctx) + if err != nil { + return err + } + + for { + if ctx.Err() != nil { + return ctx.Err() + } + + headSlot, syncDistance, err := c.getHeadSlotAndSyncDistance(ctx) + if err != nil { + return err + } + + currentSlot := headSlot - syncDistance + + switch { + case currentSlot >= c.Config.AwaitSlot: + return nil + default: + time.Sleep(time.Second) + continue + } + } +} + +// getHeadSlotAndSyncDistance is a convenience function that encapsulates some +// logic for awaitTargetHasSlot. +func (c Case) getHeadSlotAndSyncDistance(ctx context.Context) (int, int, error) { + result, _, err := c.OapiClient.NodeApi.GetSyncingStatus(ctx) + if err != nil { + return 0, 0, BadTargetError{Route: "/node/syncing", Err: err} + } + + headSlot, err := strconv.ParseInt(result.Data.HeadSlot.(string), 10, 0) + if err != nil { + return 0, 0, err + } + syncDistance, err := strconv.ParseInt(result.Data.SyncDistance.(string), 10, 0) + if err != nil { + return 0, 0, err + } + + return int(headSlot), int(syncDistance), nil +} diff --git a/tests/get/v1/beacon/blocks/0xd8f7c4f204f695df7ca4ad079468f48f57b71f2d569a396c811751e3cf8c0596/200_0.json b/tests/get/v1/beacon/blocks/0xd8f7c4f204f695df7ca4ad079468f48f57b71f2d569a396c811751e3cf8c0596/200_0.json new file mode 100644 index 0000000..f21ce76 --- /dev/null +++ b/tests/get/v1/beacon/blocks/0xd8f7c4f204f695df7ca4ad079468f48f57b71f2d569a396c811751e3cf8c0596/200_0.json @@ -0,0 +1,4 @@ +{ + "method": "GET", + "route": "/v1/beacon/blocks/0xd8f7c4f204f695df7ca4ad079468f48f57b71f2d569a396c811751e3cf8c0596" +} diff --git a/tests/get/v1/beacon/blocks/0xd8f7c4f204f695df7ca4ad079468f48f57b71f2d569a396c811751e3cf8c0596/attestations/200_0.json b/tests/get/v1/beacon/blocks/0xd8f7c4f204f695df7ca4ad079468f48f57b71f2d569a396c811751e3cf8c0596/attestations/200_0.json new file mode 100644 index 0000000..a0fe972 --- /dev/null +++ b/tests/get/v1/beacon/blocks/0xd8f7c4f204f695df7ca4ad079468f48f57b71f2d569a396c811751e3cf8c0596/attestations/200_0.json @@ -0,0 +1,4 @@ +{ + "method": "GET", + "route": "/v1/beacon/blocks/0xd8f7c4f204f695df7ca4ad079468f48f57b71f2d569a396c811751e3cf8c0596/attestations" +} diff --git a/tests/get/v1/beacon/blocks/0xd8f7c4f204f695df7ca4ad079468f48f57b71f2d569a396c811751e3cf8c0596/root/200_0.json b/tests/get/v1/beacon/blocks/0xd8f7c4f204f695df7ca4ad079468f48f57b71f2d569a396c811751e3cf8c0596/root/200_0.json new file mode 100644 index 0000000..4543e82 --- /dev/null +++ b/tests/get/v1/beacon/blocks/0xd8f7c4f204f695df7ca4ad079468f48f57b71f2d569a396c811751e3cf8c0596/root/200_0.json @@ -0,0 +1,4 @@ +{ + "method": "GET", + "route": "/v1/beacon/blocks/0xd8f7c4f204f695df7ca4ad079468f48f57b71f2d569a396c811751e3cf8c0596/root" +} diff --git a/tests/get/v1/beacon/genesis/200_0.json b/tests/get/v1/beacon/genesis/200_0.json new file mode 100644 index 0000000..0e4dcd8 --- /dev/null +++ b/tests/get/v1/beacon/genesis/200_0.json @@ -0,0 +1,4 @@ +{ + "method": "GET", + "route": "/v1/beacon/genesis" +} diff --git a/tests/get/v1/beacon/headers/0xd8f7c4f204f695df7ca4ad079468f48f57b71f2d569a396c811751e3cf8c0596/200_0.json b/tests/get/v1/beacon/headers/0xd8f7c4f204f695df7ca4ad079468f48f57b71f2d569a396c811751e3cf8c0596/200_0.json new file mode 100644 index 0000000..f462652 --- /dev/null +++ b/tests/get/v1/beacon/headers/0xd8f7c4f204f695df7ca4ad079468f48f57b71f2d569a396c811751e3cf8c0596/200_0.json @@ -0,0 +1,4 @@ +{ + "method": "GET", + "route": "/v1/beacon/headers/0xd8f7c4f204f695df7ca4ad079468f48f57b71f2d569a396c811751e3cf8c0596" +} diff --git a/tests/get/v1/beacon/headers/200_0.json b/tests/get/v1/beacon/headers/200_0.json new file mode 100644 index 0000000..db92252 --- /dev/null +++ b/tests/get/v1/beacon/headers/200_0.json @@ -0,0 +1,4 @@ +{ + "method": "GET", + "route": "/v1/beacon/headers" +} diff --git a/tests/get/v1/beacon/pool/attestations/200_0.json b/tests/get/v1/beacon/pool/attestations/200_0.json new file mode 100644 index 0000000..0cb58e3 --- /dev/null +++ b/tests/get/v1/beacon/pool/attestations/200_0.json @@ -0,0 +1,4 @@ +{ + "method": "GET", + "route": "/v1/beacon/pool/attestions" +} diff --git a/tests/get/v1/beacon/pool/attester_slashings/200_0.json b/tests/get/v1/beacon/pool/attester_slashings/200_0.json new file mode 100644 index 0000000..2bedf56 --- /dev/null +++ b/tests/get/v1/beacon/pool/attester_slashings/200_0.json @@ -0,0 +1,4 @@ +{ + "method": "GET", + "route": "/v1/beacon/pool/attester_slashings" +} diff --git a/tests/get/v1/beacon/pool/proposer_slashings/200_0.json b/tests/get/v1/beacon/pool/proposer_slashings/200_0.json new file mode 100644 index 0000000..a961c66 --- /dev/null +++ b/tests/get/v1/beacon/pool/proposer_slashings/200_0.json @@ -0,0 +1,4 @@ +{ + "method": "GET", + "route": "/v1/beacon/pool/proposer_slashings" +} diff --git a/tests/get/v1/beacon/pool/voluntary_exits/200_0.json b/tests/get/v1/beacon/pool/voluntary_exits/200_0.json new file mode 100644 index 0000000..d02a7d8 --- /dev/null +++ b/tests/get/v1/beacon/pool/voluntary_exits/200_0.json @@ -0,0 +1,4 @@ +{ + "method": "GET", + "route": "/v1/beacon/pool/voluntary_exits" +} diff --git a/tests/get/v1/beacon/states/0x00797233cf8a4272c672ec08f324ac3ba7fd601c32ef0c8a9d35e6541c048ca6/committees/2666/200_0.json b/tests/get/v1/beacon/states/0x00797233cf8a4272c672ec08f324ac3ba7fd601c32ef0c8a9d35e6541c048ca6/committees/2666/200_0.json new file mode 100644 index 0000000..0330254 --- /dev/null +++ b/tests/get/v1/beacon/states/0x00797233cf8a4272c672ec08f324ac3ba7fd601c32ef0c8a9d35e6541c048ca6/committees/2666/200_0.json @@ -0,0 +1,4 @@ +{ + "method": "GET", + "route": "/v1/beacon/states/0x00797233cf8a4272c672ec08f324ac3ba7fd601c32ef0c8a9d35e6541c048ca6/committees/2666" +} diff --git a/tests/get/v1/beacon/states/0x00797233cf8a4272c672ec08f324ac3ba7fd601c32ef0c8a9d35e6541c048ca6/finality_checkpoints/200_0.json b/tests/get/v1/beacon/states/0x00797233cf8a4272c672ec08f324ac3ba7fd601c32ef0c8a9d35e6541c048ca6/finality_checkpoints/200_0.json new file mode 100644 index 0000000..135a32e --- /dev/null +++ b/tests/get/v1/beacon/states/0x00797233cf8a4272c672ec08f324ac3ba7fd601c32ef0c8a9d35e6541c048ca6/finality_checkpoints/200_0.json @@ -0,0 +1,4 @@ +{ + "method": "GET", + "route": "/v1/beacon/states/0x00797233cf8a4272c672ec08f324ac3ba7fd601c32ef0c8a9d35e6541c048ca6/finality_checkpoints" +} diff --git a/tests/get/v1/beacon/states/0x00797233cf8a4272c672ec08f324ac3ba7fd601c32ef0c8a9d35e6541c048ca6/fork/200_0.json b/tests/get/v1/beacon/states/0x00797233cf8a4272c672ec08f324ac3ba7fd601c32ef0c8a9d35e6541c048ca6/fork/200_0.json new file mode 100644 index 0000000..ad89fe8 --- /dev/null +++ b/tests/get/v1/beacon/states/0x00797233cf8a4272c672ec08f324ac3ba7fd601c32ef0c8a9d35e6541c048ca6/fork/200_0.json @@ -0,0 +1,4 @@ +{ + "method": "GET", + "route": "/v1/beacon/states/0x00797233cf8a4272c672ec08f324ac3ba7fd601c32ef0c8a9d35e6541c048ca6/fork" +} diff --git a/tests/get/v1/beacon/states/0x00797233cf8a4272c672ec08f324ac3ba7fd601c32ef0c8a9d35e6541c048ca6/root/200_0.json b/tests/get/v1/beacon/states/0x00797233cf8a4272c672ec08f324ac3ba7fd601c32ef0c8a9d35e6541c048ca6/root/200_0.json new file mode 100644 index 0000000..2d6f170 --- /dev/null +++ b/tests/get/v1/beacon/states/0x00797233cf8a4272c672ec08f324ac3ba7fd601c32ef0c8a9d35e6541c048ca6/root/200_0.json @@ -0,0 +1,4 @@ +{ + "method": "GET", + "route": "/v1/beacon/states/0x00797233cf8a4272c672ec08f324ac3ba7fd601c32ef0c8a9d35e6541c048ca6/root" +} diff --git a/tests/get/v1/beacon/states/0x00797233cf8a4272c672ec08f324ac3ba7fd601c32ef0c8a9d35e6541c048ca6/validators/1000/200_0.json b/tests/get/v1/beacon/states/0x00797233cf8a4272c672ec08f324ac3ba7fd601c32ef0c8a9d35e6541c048ca6/validators/1000/200_0.json new file mode 100644 index 0000000..53a1c79 --- /dev/null +++ b/tests/get/v1/beacon/states/0x00797233cf8a4272c672ec08f324ac3ba7fd601c32ef0c8a9d35e6541c048ca6/validators/1000/200_0.json @@ -0,0 +1,4 @@ +{ + "method": "GET", + "route": "/v1/beacon/states/0x00797233cf8a4272c672ec08f324ac3ba7fd601c32ef0c8a9d35e6541c048ca6/validators/1000" +} diff --git a/tests/get/v1/beacon/states/0x00797233cf8a4272c672ec08f324ac3ba7fd601c32ef0c8a9d35e6541c048ca6/validators/200_0.json b/tests/get/v1/beacon/states/0x00797233cf8a4272c672ec08f324ac3ba7fd601c32ef0c8a9d35e6541c048ca6/validators/200_0.json new file mode 100644 index 0000000..b802376 --- /dev/null +++ b/tests/get/v1/beacon/states/0x00797233cf8a4272c672ec08f324ac3ba7fd601c32ef0c8a9d35e6541c048ca6/validators/200_0.json @@ -0,0 +1,4 @@ +{ + "method": "GET", + "route": "/v1/beacon/states/0x00797233cf8a4272c672ec08f324ac3ba7fd601c32ef0c8a9d35e6541c048ca6/validators" +} diff --git a/tests/get/v1/node/health/200_0.json b/tests/get/v1/node/health/200_0.json new file mode 100644 index 0000000..1f4b499 --- /dev/null +++ b/tests/get/v1/node/health/200_0.json @@ -0,0 +1,4 @@ +{ + "method": "GET", + "route": "/v1/node/health" +} diff --git a/tests/get/v1/node/identity/200_0.json b/tests/get/v1/node/identity/200_0.json new file mode 100644 index 0000000..99f3f05 --- /dev/null +++ b/tests/get/v1/node/identity/200_0.json @@ -0,0 +1,4 @@ +{ + "method": "GET", + "route": "/v1/node/identity" +} diff --git a/tests/get/v1/node/peers/200_0.json b/tests/get/v1/node/peers/200_0.json new file mode 100644 index 0000000..0c83629 --- /dev/null +++ b/tests/get/v1/node/peers/200_0.json @@ -0,0 +1,4 @@ +{ + "method": "GET", + "route": "/v1/node/peers" +} diff --git a/tests/get/v1/node/peers/QmYyQSo1c1Ym7orWxLYvCrM2EmxFTANf8wXmmE7DWjhx5N/200_0.json b/tests/get/v1/node/peers/QmYyQSo1c1Ym7orWxLYvCrM2EmxFTANf8wXmmE7DWjhx5N/200_0.json new file mode 100644 index 0000000..c594b44 --- /dev/null +++ b/tests/get/v1/node/peers/QmYyQSo1c1Ym7orWxLYvCrM2EmxFTANf8wXmmE7DWjhx5N/200_0.json @@ -0,0 +1,4 @@ +{ + "method": "GET", + "route": "/v1/node/peers/QmYyQSo1c1Ym7orWxLYvCrM2EmxFTANf8wXmmE7DWjhx5N" +} diff --git a/tests/get/v1/node/syncing/200.json b/tests/get/v1/node/syncing/200.json new file mode 100644 index 0000000..97da64b --- /dev/null +++ b/tests/get/v1/node/syncing/200.json @@ -0,0 +1,4 @@ +{ + "method": "GET", + "route": "/v1/node/syncing" +} diff --git a/tests/get/v1/node/version/200_0.json b/tests/get/v1/node/version/200_0.json new file mode 100644 index 0000000..a8bae14 --- /dev/null +++ b/tests/get/v1/node/version/200_0.json @@ -0,0 +1,4 @@ +{ + "method": "GET", + "route": "/v1/node/version" +}