Search in sources :

Example 1 with GetBlock

use of tech.pegasys.teku.beaconrestapi.handlers.v1.beacon.GetBlock in project teku by ConsenSys.

the class BeaconRestApi method addBeaconHandlers.

private void addBeaconHandlers(final DataProvider dataProvider) {
    app.get(GetGenesis.ROUTE, new GetGenesis(dataProvider, jsonProvider));
    app.get(GetStateRoot.ROUTE, new GetStateRoot(dataProvider, jsonProvider));
    app.get(GetStateFork.ROUTE, new GetStateFork(dataProvider, jsonProvider));
    app.get(GetStateFinalityCheckpoints.ROUTE, new GetStateFinalityCheckpoints(dataProvider, jsonProvider));
    app.get(GetStateValidators.ROUTE, new GetStateValidators(dataProvider, jsonProvider));
    app.get(GetStateValidator.ROUTE, new GetStateValidator(dataProvider, jsonProvider));
    app.get(GetStateValidatorBalances.ROUTE, new GetStateValidatorBalances(dataProvider, jsonProvider));
    app.get(GetStateCommittees.ROUTE, new GetStateCommittees(dataProvider, jsonProvider));
    app.get(GetStateSyncCommittees.ROUTE, new GetStateSyncCommittees(dataProvider, jsonProvider));
    app.get(GetBlockHeaders.ROUTE, new GetBlockHeaders(dataProvider, jsonProvider));
    app.get(GetBlockHeader.ROUTE, new GetBlockHeader(dataProvider, jsonProvider));
    app.post(PostBlock.ROUTE, new PostBlock(dataProvider, jsonProvider));
    app.get(GetBlock.ROUTE, new GetBlock(dataProvider, jsonProvider));
    app.get(tech.pegasys.teku.beaconrestapi.handlers.v2.beacon.GetBlock.ROUTE, new tech.pegasys.teku.beaconrestapi.handlers.v2.beacon.GetBlock(dataProvider, jsonProvider));
    app.get(GetBlockRoot.ROUTE, new GetBlockRoot(dataProvider, jsonProvider));
    app.get(GetBlockAttestations.ROUTE, new GetBlockAttestations(dataProvider, jsonProvider));
    app.get(GetAttestations.ROUTE, new GetAttestations(dataProvider, jsonProvider));
    app.post(PostAttestation.ROUTE, new PostAttestation(dataProvider, jsonProvider));
    app.get(GetAttesterSlashings.ROUTE, new GetAttesterSlashings(dataProvider, jsonProvider));
    app.post(PostAttesterSlashing.ROUTE, new PostAttesterSlashing(dataProvider, jsonProvider));
    app.get(GetProposerSlashings.ROUTE, new GetProposerSlashings(dataProvider, jsonProvider));
    app.post(PostProposerSlashing.ROUTE, new PostProposerSlashing(dataProvider, jsonProvider));
    app.get(GetVoluntaryExits.ROUTE, new GetVoluntaryExits(dataProvider, jsonProvider));
    app.post(PostVoluntaryExit.ROUTE, new PostVoluntaryExit(dataProvider, jsonProvider));
    app.post(PostSyncCommittees.ROUTE, new PostSyncCommittees(dataProvider, jsonProvider));
    app.post(PostValidatorLiveness.ROUTE, new PostValidatorLiveness(dataProvider, jsonProvider));
}
Also used : GetBlockHeaders(tech.pegasys.teku.beaconrestapi.handlers.v1.beacon.GetBlockHeaders) GetBlockRoot(tech.pegasys.teku.beaconrestapi.handlers.v1.beacon.GetBlockRoot) GetStateFork(tech.pegasys.teku.beaconrestapi.handlers.v1.beacon.GetStateFork) GetStateValidator(tech.pegasys.teku.beaconrestapi.handlers.v1.beacon.GetStateValidator) PostAttestation(tech.pegasys.teku.beaconrestapi.handlers.v1.beacon.PostAttestation) PostVoluntaryExit(tech.pegasys.teku.beaconrestapi.handlers.v1.beacon.PostVoluntaryExit) PostValidatorLiveness(tech.pegasys.teku.beaconrestapi.handlers.v1.validator.PostValidatorLiveness) GetGenesis(tech.pegasys.teku.beaconrestapi.handlers.v1.beacon.GetGenesis) PostBlock(tech.pegasys.teku.beaconrestapi.handlers.v1.beacon.PostBlock) GetStateCommittees(tech.pegasys.teku.beaconrestapi.handlers.v1.beacon.GetStateCommittees) PostProposerSlashing(tech.pegasys.teku.beaconrestapi.handlers.v1.beacon.PostProposerSlashing) PostAttesterSlashing(tech.pegasys.teku.beaconrestapi.handlers.v1.beacon.PostAttesterSlashing) GetStateRoot(tech.pegasys.teku.beaconrestapi.handlers.v1.beacon.GetStateRoot) GetBlockHeader(tech.pegasys.teku.beaconrestapi.handlers.v1.beacon.GetBlockHeader) GetAttesterSlashings(tech.pegasys.teku.beaconrestapi.handlers.v1.beacon.GetAttesterSlashings) GetStateValidatorBalances(tech.pegasys.teku.beaconrestapi.handlers.v1.beacon.GetStateValidatorBalances) GetAttestations(tech.pegasys.teku.beaconrestapi.handlers.v1.beacon.GetAttestations) GetVoluntaryExits(tech.pegasys.teku.beaconrestapi.handlers.v1.beacon.GetVoluntaryExits) GetProposerSlashings(tech.pegasys.teku.beaconrestapi.handlers.v1.beacon.GetProposerSlashings) PostSyncCommittees(tech.pegasys.teku.beaconrestapi.handlers.v1.beacon.PostSyncCommittees) GetStateValidators(tech.pegasys.teku.beaconrestapi.handlers.v1.beacon.GetStateValidators) GetBlockAttestations(tech.pegasys.teku.beaconrestapi.handlers.v1.beacon.GetBlockAttestations) GetBlock(tech.pegasys.teku.beaconrestapi.handlers.v1.beacon.GetBlock) GetStateFinalityCheckpoints(tech.pegasys.teku.beaconrestapi.handlers.v1.beacon.GetStateFinalityCheckpoints) GetStateSyncCommittees(tech.pegasys.teku.beaconrestapi.handlers.v1.beacon.GetStateSyncCommittees)

Example 2 with GetBlock

use of tech.pegasys.teku.beaconrestapi.handlers.v1.beacon.GetBlock in project teku by ConsenSys.

the class GetBlockHeaderIntegrationTest method shouldGetBlockHeader.

@Test
public void shouldGetBlockHeader() throws IOException {
    final List<SignedBlockAndState> created = createBlocksAtSlots(10);
    final Response response = get("head");
    final GetBlockHeaderResponse body = jsonProvider.jsonToObject(response.body().string(), GetBlockHeaderResponse.class);
    final BlockHeader data = body.data;
    assertThat(data).isEqualTo(new BlockHeader(created.get(0).getBlock(), true));
}
Also used : Response(okhttp3.Response) GetBlockHeaderResponse(tech.pegasys.teku.api.response.v1.beacon.GetBlockHeaderResponse) GetBlockHeaderResponse(tech.pegasys.teku.api.response.v1.beacon.GetBlockHeaderResponse) SignedBlockAndState(tech.pegasys.teku.spec.datastructures.blocks.SignedBlockAndState) GetBlockHeader(tech.pegasys.teku.beaconrestapi.handlers.v1.beacon.GetBlockHeader) BlockHeader(tech.pegasys.teku.api.response.v1.beacon.BlockHeader) Test(org.junit.jupiter.api.Test) AbstractDataBackedRestAPIIntegrationTest(tech.pegasys.teku.beaconrestapi.AbstractDataBackedRestAPIIntegrationTest)

Aggregations

GetBlockHeader (tech.pegasys.teku.beaconrestapi.handlers.v1.beacon.GetBlockHeader)2 Response (okhttp3.Response)1 Test (org.junit.jupiter.api.Test)1 BlockHeader (tech.pegasys.teku.api.response.v1.beacon.BlockHeader)1 GetBlockHeaderResponse (tech.pegasys.teku.api.response.v1.beacon.GetBlockHeaderResponse)1 AbstractDataBackedRestAPIIntegrationTest (tech.pegasys.teku.beaconrestapi.AbstractDataBackedRestAPIIntegrationTest)1 GetAttestations (tech.pegasys.teku.beaconrestapi.handlers.v1.beacon.GetAttestations)1 GetAttesterSlashings (tech.pegasys.teku.beaconrestapi.handlers.v1.beacon.GetAttesterSlashings)1 GetBlock (tech.pegasys.teku.beaconrestapi.handlers.v1.beacon.GetBlock)1 GetBlockAttestations (tech.pegasys.teku.beaconrestapi.handlers.v1.beacon.GetBlockAttestations)1 GetBlockHeaders (tech.pegasys.teku.beaconrestapi.handlers.v1.beacon.GetBlockHeaders)1 GetBlockRoot (tech.pegasys.teku.beaconrestapi.handlers.v1.beacon.GetBlockRoot)1 GetGenesis (tech.pegasys.teku.beaconrestapi.handlers.v1.beacon.GetGenesis)1 GetProposerSlashings (tech.pegasys.teku.beaconrestapi.handlers.v1.beacon.GetProposerSlashings)1 GetStateCommittees (tech.pegasys.teku.beaconrestapi.handlers.v1.beacon.GetStateCommittees)1 GetStateFinalityCheckpoints (tech.pegasys.teku.beaconrestapi.handlers.v1.beacon.GetStateFinalityCheckpoints)1 GetStateFork (tech.pegasys.teku.beaconrestapi.handlers.v1.beacon.GetStateFork)1 GetStateRoot (tech.pegasys.teku.beaconrestapi.handlers.v1.beacon.GetStateRoot)1 GetStateSyncCommittees (tech.pegasys.teku.beaconrestapi.handlers.v1.beacon.GetStateSyncCommittees)1 GetStateValidator (tech.pegasys.teku.beaconrestapi.handlers.v1.beacon.GetStateValidator)1