This commit is contained in:
cheatfate 2021-04-13 13:19:31 +03:00 committed by zah
parent b0a3008a1b
commit 79d4735355
7 changed files with 212 additions and 1 deletions

View File

@ -830,3 +830,109 @@ proc installBeaconApiHandlers*(router: var RestRouter, node: BeaconNode) =
res
node.sendVoluntaryExit(exit)
return RestApiResponse.jsonError(Http200, VoluntaryExitValidationSuccess)
router.redirect(
MethodGet,
"/eth/v1/beacon/genesis",
"/api/eth/v1/beacon/genesis"
)
router.redirect(
MethodGet,
"/eth/v1/beacon/states/{state_id}/root",
"/api/eth/v1/beacon/states/{state_id}/root"
)
router.redirect(
MethodGet,
"/eth/v1/beacon/states/{state_id}/fork",
"/api/eth/v1/beacon/states/{state_id}/fork"
)
router.redirect(
MethodGet,
"/eth/v1/beacon/states/{state_id}/finality_checkpoints",
"/api/eth/v1/beacon/states/{state_id}/finality_checkpoints"
)
router.redirect(
MethodGet,
"/eth/v1/beacon/states/{state_id}/validators",
"/api/eth/v1/beacon/states/{state_id}/validators"
)
router.redirect(
MethodGet,
"/eth/v1/beacon/states/{state_id}/validators/{validator_id}",
"/api/eth/v1/beacon/states/{state_id}/validators/{validator_id}"
)
router.redirect(
MethodGet,
"/eth/v1/beacon/states/{state_id}/validator_balances",
"/api/eth/v1/beacon/states/{state_id}/validator_balances"
)
router.redirect(
MethodGet,
"/eth/v1/beacon/states/{state_id}/committees",
"/api/eth/v1/beacon/states/{state_id}/committees"
)
router.redirect(
MethodGet,
"/eth/v1/beacon/headers",
"/api/eth/v1/beacon/headers"
)
router.redirect(
MethodGet,
"/eth/v1/beacon/headers/{block_id}",
"/api/eth/v1/beacon/headers/{block_id}"
)
router.redirect(
MethodPost,
"/eth/v1/beacon/blocks",
"/api/eth/v1/beacon/blocks"
)
router.redirect(
MethodGet,
"/eth/v1/beacon/blocks/{block_id}",
"/api/eth/v1/beacon/blocks/{block_id}"
)
router.redirect(
MethodGet,
"/eth/v1/beacon/blocks/{block_id}/root",
"/api/eth/v1/beacon/blocks/{block_id}/root"
)
router.redirect(
MethodGet,
"/eth/v1/beacon/blocks/{block_id}/attestations",
"/api/eth/v1/beacon/blocks/{block_id}/attestations"
)
router.redirect(
MethodGet,
"/eth/v1/beacon/pool/attestations",
"/api/eth/v1/beacon/pool/attestations"
)
router.redirect(
MethodPost,
"/eth/v1/beacon/pool/attester_slashings",
"/api/eth/v1/beacon/pool/attester_slashings"
)
router.redirect(
MethodGet,
"/eth/v1/beacon/pool/attester_slashings",
"/api/eth/v1/beacon/pool/attester_slashings"
)
router.redirect(
MethodPost,
"/eth/v1/beacon/pool/proposer_slashings",
"/api/eth/v1/beacon/pool/proposer_slashings"
)
router.redirect(
MethodGet,
"/eth/v1/beacon/pool/proposer_slashings",
"/api/eth/v1/beacon/pool/proposer_slashings"
)
router.redirect(
MethodPost,
"/eth/v1/beacon/pool/voluntary_exits",
"/api/eth/v1/beacon/pool/voluntary_exits"
)
router.redirect(
MethodGet,
"/eth/v1/beacon/pool/voluntary_exits",
"/api/eth/v1/beacon/pool/voluntary_exits"
)

View File

@ -163,3 +163,19 @@ proc installConfigApiHandlers*(router: var RestRouter, node: BeaconNode) =
return RestApiResponse.jsonResponse(
(chain_id: $DEPOSIT_CHAIN_ID, address: node.getDepositAddress())
)
router.redirect(
MethodGet,
"/eth/v1/config/fork_schedule",
"/api/eth/v1/config/fork_schedule"
)
router.redirect(
MethodGet,
"/eth/v1/config/spec",
"/api/eth/v1/config/spec"
)
router.redirect(
MethodGet,
"/eth/v1/config/deposit_contract",
"/api/eth/v1/config/deposit_contract"
)

View File

@ -31,3 +31,14 @@ proc installDebugApiHandlers*(router: var RestRouter, node: BeaconNode) =
return RestApiResponse.jsonResponse(
node.chainDag.heads.mapIt((root: it.root, slot: it.slot))
)
router.redirect(
MethodGet,
"/eth/v1/debug/beacon/states/{state_id}",
"/api/eth/v1/debug/beacon/states/{state_id}"
)
router.redirect(
MethodGet,
"/eth/v1/debug/beacon/heads",
"/api/eth/v1/debug/beacon/heads"
)

View File

@ -65,3 +65,9 @@ proc installEventApiHandlers*(router: var RestRouter, node: BeaconNode) =
res.get()
return RestApiResponse.jsonError(Http500, "Not implemented yet")
router.redirect(
MethodGet,
"/eth/v1/events",
"/api/eth/v1/events"
)

View File

@ -254,3 +254,39 @@ proc installNodeApiHandlers*(router: var RestRouter, node: BeaconNode) =
else:
(health: 200)
return RestApiResponse.jsonResponse(res)
router.redirect(
MethodGet,
"/eth/v1/node/identity",
"/api/eth/v1/node/identity"
)
router.redirect(
MethodGet,
"/eth/v1/node/peers",
"/api/eth/v1/node/peers"
)
router.redirect(
MethodGet,
"/eth/v1/node/peer_count",
"/api/eth/v1/node/peer_count"
)
router.redirect(
MethodGet,
"/eth/v1/node/peers/{peer_id}",
"/api/eth/v1/node/peers/{peer_id}"
)
router.redirect(
MethodGet,
"/eth/v1/node/version",
"/api/eth/v1/node/version"
)
router.redirect(
MethodGet,
"/eth/v1/node/syncing",
"/api/eth/v1/node/syncing"
)
router.redirect(
MethodGet,
"/eth/v1/node/health",
"/api/eth/v1/node/health"
)

View File

@ -389,3 +389,39 @@ proc installValidatorApiHandlers*(router: var RestRouter, node: BeaconNode) =
request.committee_index)
)
return RestApiResponse.jsonError(Http500, NoImplementationError)
router.redirect(
MethodPost,
"/eth/v1/validator/duties/attester/{epoch}",
"/api/eth/v1/validator/duties/attester/{epoch}"
)
router.redirect(
MethodGet,
"/eth/v1/validator/duties/proposer/{epoch}",
"/api/eth/v1/validator/duties/proposer/{epoch}"
)
router.redirect(
MethodGet,
"/eth/v1/validator/blocks/{slot}",
"/api/eth/v1/validator/blocks/{slot}"
)
router.redirect(
MethodGet,
"/eth/v1/validator/attestation_data",
"/api/eth/v1/validator/attestation_data"
)
router.redirect(
MethodGet,
"/eth/v1/validator/aggregate_attestation",
"/api/eth/v1/validator/aggregate_attestation"
)
router.redirect(
MethodPost,
"/eth/v1/validator/aggregate_and_proofs",
"/api/eth/v1/validator/aggregate_and_proofs"
)
router.redirect(
MethodPost,
"/eth/v1/validator/beacon_committee_subscriptions",
"/api/eth/v1/validator/beacon_committee_subscriptions"
)

2
vendor/nim-presto vendored

@ -1 +1 @@
Subproject commit 04c22587216940a18185175dd3043c25f098565f
Subproject commit 8943d3fd6c2e5be1c604a0afdc2b873ad3575bd1