2024-02-18 01:16:49 +00:00
|
|
|
# beacon_chain
|
2024-01-03 05:58:34 +00:00
|
|
|
# Copyright (c) 2018-2024 Status Research & Development GmbH
|
2021-08-03 15:17:11 +00:00
|
|
|
# Licensed and distributed under either of
|
|
|
|
# * MIT license (license terms in the root directory or at https://opensource.org/licenses/MIT).
|
|
|
|
# * Apache v2 license (license terms in the root directory or at https://www.apache.org/licenses/LICENSE-2.0).
|
|
|
|
# at your option. This file may not be copied, modified, or distributed except according to those terms.
|
|
|
|
|
2023-01-20 14:14:37 +00:00
|
|
|
{.push raises: [].}
|
2021-08-03 15:17:11 +00:00
|
|
|
|
|
|
|
import
|
2021-09-27 18:31:11 +00:00
|
|
|
chronos, presto/client, chronicles,
|
2021-12-22 12:37:31 +00:00
|
|
|
".."/".."/validators/slashing_protection_common,
|
2022-02-13 15:21:55 +00:00
|
|
|
".."/datatypes/[phase0, altair, bellatrix],
|
2022-11-24 09:14:05 +00:00
|
|
|
".."/mev/bellatrix_mev,
|
2021-12-22 12:37:31 +00:00
|
|
|
".."/[helpers, forks, keystore, eth2_ssz_serialization],
|
2022-02-07 20:36:09 +00:00
|
|
|
"."/[rest_types, rest_common, eth2_rest_serialization]
|
2021-08-03 15:17:11 +00:00
|
|
|
|
2022-11-22 11:56:05 +00:00
|
|
|
from ".."/datatypes/capella import SignedBeaconBlock
|
|
|
|
|
2021-08-27 09:00:06 +00:00
|
|
|
export chronos, client, rest_types, eth2_rest_serialization
|
2021-08-03 15:17:11 +00:00
|
|
|
|
|
|
|
proc getGenesis*(): RestResponse[GetGenesisResponse] {.
|
|
|
|
rest, endpoint: "/eth/v1/beacon/genesis",
|
|
|
|
meth: MethodGet.}
|
2021-08-27 09:00:06 +00:00
|
|
|
## https://ethereum.github.io/beacon-APIs/#/Beacon/getGenesis
|
2021-08-03 15:17:11 +00:00
|
|
|
|
2022-01-25 10:07:15 +00:00
|
|
|
proc getGenesisPlain*(): RestPlainResponse {.
|
|
|
|
rest, endpoint: "/eth/v1/beacon/genesis",
|
|
|
|
meth: MethodGet.}
|
|
|
|
## https://ethereum.github.io/beacon-APIs/#/Beacon/getGenesis
|
|
|
|
|
2021-08-03 15:17:11 +00:00
|
|
|
proc getStateRoot*(state_id: StateIdent): RestResponse[GetStateRootResponse] {.
|
|
|
|
rest, endpoint: "/eth/v1/beacon/states/{state_id}/root",
|
|
|
|
meth: MethodGet.}
|
2021-08-27 09:00:06 +00:00
|
|
|
## https://ethereum.github.io/beacon-APIs/#/Beacon/getStateRoot
|
2021-08-03 15:17:11 +00:00
|
|
|
|
2022-01-25 10:07:15 +00:00
|
|
|
proc getStateForkPlain*(state_id: StateIdent): RestPlainResponse {.
|
|
|
|
rest, endpoint: "/eth/v1/beacon/states/{state_id}/fork",
|
|
|
|
meth: MethodGet.}
|
|
|
|
## https://ethereum.github.io/beacon-APIs/#/Beacon/getStateFork
|
|
|
|
|
2021-08-03 15:17:11 +00:00
|
|
|
proc getStateFinalityCheckpoints*(state_id: StateIdent
|
|
|
|
): RestResponse[GetStateFinalityCheckpointsResponse] {.
|
2022-01-06 07:38:40 +00:00
|
|
|
rest, endpoint: "/eth/v1/beacon/states/{state_id}/finality_checkpoints",
|
2021-08-03 15:17:11 +00:00
|
|
|
meth: MethodGet.}
|
2021-09-29 10:43:30 +00:00
|
|
|
## https://ethereum.github.io/beacon-APIs/#/Beacon/getStateFinalityCheckpoints
|
2021-08-03 15:17:11 +00:00
|
|
|
|
2023-03-03 20:20:01 +00:00
|
|
|
proc getStateValidatorsPlain*(
|
|
|
|
state_id: StateIdent,
|
|
|
|
id: seq[ValidatorIdent]
|
|
|
|
): RestPlainResponse {.
|
|
|
|
rest, endpoint: "/eth/v1/beacon/states/{state_id}/validators",
|
|
|
|
meth: MethodGet.}
|
|
|
|
## https://ethereum.github.io/beacon-APIs/#/Beacon/getStateValidators
|
|
|
|
|
2022-01-25 10:07:15 +00:00
|
|
|
proc getStateValidatorPlain*(state_id: StateIdent,
|
|
|
|
validator_id: ValidatorIdent
|
|
|
|
): RestPlainResponse {.
|
|
|
|
rest,
|
|
|
|
endpoint: "/eth/v1/beacon/states/{state_id}/validators/{validator_id}",
|
|
|
|
meth: MethodGet.}
|
|
|
|
## https://ethereum.github.io/beacon-APIs/#/Beacon/getStateValidator
|
|
|
|
|
2021-08-03 15:17:11 +00:00
|
|
|
proc getStateValidatorBalances*(state_id: StateIdent
|
|
|
|
): RestResponse[GetStateValidatorBalancesResponse] {.
|
|
|
|
rest, endpoint: "/eth/v1/beacon/states/{state_id}/validator_balances",
|
|
|
|
meth: MethodGet.}
|
2021-08-27 09:00:06 +00:00
|
|
|
## https://ethereum.github.io/beacon-APIs/#/Beacon/getStateValidators
|
2021-08-03 15:17:11 +00:00
|
|
|
|
2023-06-06 10:01:05 +00:00
|
|
|
proc getStateRandao*(state_id: StateIdent
|
|
|
|
): RestResponse[GetStateRandaoResponse] {.
|
|
|
|
rest, endpoint: "/eth/v1/beacon/states/{state_id}/randao",
|
|
|
|
meth: MethodGet.}
|
|
|
|
## https://ethereum.github.io/beacon-APIs/#/Beacon/getStateRandao
|
|
|
|
|
2022-01-05 14:49:10 +00:00
|
|
|
proc getEpochCommittees*(state_id: StateIdent, epoch: Option[Epoch],
|
2021-08-03 15:17:11 +00:00
|
|
|
): RestResponse[GetEpochCommitteesResponse] {.
|
|
|
|
rest, endpoint: "/eth/v1/beacon/states/{state_id}/committees",
|
|
|
|
meth: MethodGet.}
|
2021-08-27 09:00:06 +00:00
|
|
|
## https://ethereum.github.io/beacon-APIs/#/Beacon/getEpochCommittees
|
2021-08-03 15:17:11 +00:00
|
|
|
|
2022-01-05 14:49:10 +00:00
|
|
|
proc getEpochSyncCommittees*(state_id: StateIdent, epoch: Option[Epoch],
|
|
|
|
): RestResponse[GetEpochSyncCommitteesResponse] {.
|
|
|
|
rest, endpoint: "/eth/v1/beacon/states/{state_id}/sync_committees",
|
|
|
|
meth: MethodGet.}
|
|
|
|
## https://ethereum.github.io/beacon-APIs/#/Beacon/getEpochSyncCommittees
|
2021-08-03 15:17:11 +00:00
|
|
|
|
|
|
|
proc getBlockHeaders*(slot: Option[Slot], parent_root: Option[Eth2Digest]
|
|
|
|
): RestResponse[GetBlockHeadersResponse] {.
|
2022-01-06 07:38:40 +00:00
|
|
|
rest, endpoint: "/eth/v1/beacon/headers",
|
2021-08-03 15:17:11 +00:00
|
|
|
meth: MethodGet.}
|
2021-08-27 09:00:06 +00:00
|
|
|
## https://ethereum.github.io/beacon-APIs/#/Beacon/getBlockHeaders
|
2021-08-03 15:17:11 +00:00
|
|
|
|
2023-06-08 08:44:32 +00:00
|
|
|
proc getBlockHeaderPlain*(block_id: BlockIdent): RestPlainResponse {.
|
2022-01-06 07:38:40 +00:00
|
|
|
rest, endpoint: "/eth/v1/beacon/headers/{block_id}",
|
2021-08-03 15:17:11 +00:00
|
|
|
meth: MethodGet.}
|
2021-08-27 09:00:06 +00:00
|
|
|
## https://ethereum.github.io/beacon-APIs/#/Beacon/getBlockHeader
|
2021-08-03 15:17:11 +00:00
|
|
|
|
2023-06-08 08:44:32 +00:00
|
|
|
proc getBlockHeader*(
|
|
|
|
client: RestClientRef,
|
|
|
|
block_id: BlockIdent
|
|
|
|
): Future[Opt[GetBlockHeaderResponse]] {.async.} =
|
|
|
|
## https://ethereum.github.io/beacon-APIs/#/Beacon/getBlockHeader
|
|
|
|
let resp = await client.getBlockHeaderPlain(block_id)
|
|
|
|
return
|
|
|
|
case resp.status
|
|
|
|
of 200:
|
|
|
|
let response = decodeBytes(GetBlockHeaderResponse, resp.data,
|
|
|
|
resp.contentType).valueOr:
|
|
|
|
raise newException(RestError, $error)
|
|
|
|
Opt.some(response)
|
|
|
|
of 404:
|
|
|
|
Opt.none(GetBlockHeaderResponse)
|
|
|
|
of 400, 500:
|
|
|
|
let error = decodeBytes(RestErrorMessage, resp.data,
|
|
|
|
resp.contentType).valueOr:
|
|
|
|
let msg = "Incorrect response error format (" & $resp.status &
|
|
|
|
") [" & $error & "]"
|
|
|
|
raise (ref RestResponseError)(msg: msg, status: resp.status)
|
|
|
|
let msg = "Error response (" & $resp.status & ") [" & error.message & "]"
|
|
|
|
raise (ref RestResponseError)(
|
|
|
|
msg: msg, status: error.code, message: error.message)
|
|
|
|
else:
|
|
|
|
raiseRestResponseError(resp)
|
|
|
|
|
2021-08-03 15:17:11 +00:00
|
|
|
proc publishBlock*(body: phase0.SignedBeaconBlock): RestPlainResponse {.
|
|
|
|
rest, endpoint: "/eth/v1/beacon/blocks",
|
|
|
|
meth: MethodPost.}
|
2021-08-27 09:00:06 +00:00
|
|
|
## https://ethereum.github.io/beacon-APIs/#/Beacon/publishBlock
|
|
|
|
|
|
|
|
proc publishBlock*(body: altair.SignedBeaconBlock): RestPlainResponse {.
|
|
|
|
rest, endpoint: "/eth/v1/beacon/blocks",
|
|
|
|
meth: MethodPost.}
|
|
|
|
## https://ethereum.github.io/beacon-APIs/#/Beacon/publishBlock
|
2021-08-03 15:17:11 +00:00
|
|
|
|
2022-02-13 15:21:55 +00:00
|
|
|
proc publishBlock*(body: bellatrix.SignedBeaconBlock): RestPlainResponse {.
|
|
|
|
rest, endpoint: "/eth/v1/beacon/blocks",
|
|
|
|
meth: MethodPost.}
|
|
|
|
## https://ethereum.github.io/beacon-APIs/#/Beacon/publishBlock
|
|
|
|
|
2022-11-22 11:56:05 +00:00
|
|
|
proc publishBlock*(body: capella.SignedBeaconBlock): RestPlainResponse {.
|
|
|
|
rest, endpoint: "/eth/v1/beacon/blocks",
|
|
|
|
meth: MethodPost.}
|
|
|
|
## https://ethereum.github.io/beacon-APIs/#/Beacon/publishBlock
|
|
|
|
|
2023-06-23 09:30:16 +00:00
|
|
|
proc publishBlock*(body: DenebSignedBlockContents): RestPlainResponse {.
|
|
|
|
rest, endpoint: "/eth/v1/beacon/blocks",
|
|
|
|
meth: MethodPost.}
|
|
|
|
## https://ethereum.github.io/beacon-APIs/#/Beacon/publishBlock
|
|
|
|
|
2022-09-29 21:00:53 +00:00
|
|
|
proc publishSszBlock*(
|
|
|
|
client: RestClientRef,
|
|
|
|
blck: ForkySignedBeaconBlock
|
|
|
|
): Future[RestPlainResponse] {.async.} =
|
|
|
|
## https://ethereum.github.io/beacon-APIs/#/Beacon/publishBlock
|
|
|
|
let
|
2023-09-27 15:10:28 +00:00
|
|
|
consensus = typeof(blck).kind.toString()
|
2022-09-29 21:00:53 +00:00
|
|
|
resp = await client.publishBlock(
|
|
|
|
blck, restContentType = $OctetStreamMediaType,
|
|
|
|
extraHeaders = @[("eth-consensus-version", consensus)])
|
|
|
|
return resp
|
|
|
|
|
2023-08-12 03:08:54 +00:00
|
|
|
proc publishBlockV2Plain(body: phase0.SignedBeaconBlock): RestPlainResponse {.
|
|
|
|
rest, endpoint: "/eth/v2/beacon/blocks",
|
|
|
|
meth: MethodPost.}
|
|
|
|
## https://ethereum.github.io/beacon-APIs/#/Beacon/publishBlockV2
|
|
|
|
|
|
|
|
proc publishBlockV2Plain(body: altair.SignedBeaconBlock): RestPlainResponse {.
|
|
|
|
rest, endpoint: "/eth/v2/beacon/blocks",
|
|
|
|
meth: MethodPost.}
|
|
|
|
## https://ethereum.github.io/beacon-APIs/#/Beacon/publishBlockV2
|
|
|
|
|
|
|
|
proc publishBlockV2Plain(body: bellatrix.SignedBeaconBlock): RestPlainResponse {.
|
|
|
|
rest, endpoint: "/eth/v2/beacon/blocks",
|
|
|
|
meth: MethodPost.}
|
|
|
|
## https://ethereum.github.io/beacon-APIs/#/Beacon/publishBlockV2
|
|
|
|
|
|
|
|
proc publishBlockV2Plain(body: capella.SignedBeaconBlock): RestPlainResponse {.
|
|
|
|
rest, endpoint: "/eth/v2/beacon/blocks",
|
|
|
|
meth: MethodPost.}
|
|
|
|
## https://ethereum.github.io/beacon-APIs/#/Beacon/publishBlockV2
|
|
|
|
|
|
|
|
proc publishBlockV2Plain(body: DenebSignedBlockContents): RestPlainResponse {.
|
|
|
|
rest, endpoint: "/eth/v2/beacon/blocks",
|
|
|
|
meth: MethodPost.}
|
|
|
|
## https://ethereum.github.io/beacon-APIs/#/Beacon/publishBlockV2
|
|
|
|
|
|
|
|
proc publishBlockV2*(
|
|
|
|
client: RestClientRef,
|
|
|
|
blck: phase0.SignedBeaconBlock | altair.SignedBeaconBlock |
|
|
|
|
bellatrix.SignedBeaconBlock | capella.SignedBeaconBlock |
|
|
|
|
deneb.SignedBeaconBlock
|
|
|
|
): Future[RestPlainResponse] {.async} =
|
|
|
|
let
|
2023-09-27 15:10:28 +00:00
|
|
|
consensus = typeof(blck).kind.toString()
|
2023-08-12 03:08:54 +00:00
|
|
|
resp = await client.publishBlockV2Plain(
|
|
|
|
blck, extraHeaders = @[
|
|
|
|
("eth-consensus-version", consensus),
|
|
|
|
("broadcast_validation", "gossip")])
|
|
|
|
return resp
|
|
|
|
|
2022-11-24 09:14:05 +00:00
|
|
|
proc publishBlindedBlock*(body: phase0.SignedBeaconBlock): RestPlainResponse {.
|
|
|
|
rest, endpoint: "/eth/v1/beacon/blinded_blocks",
|
|
|
|
meth: MethodPost.}
|
|
|
|
## https://ethereum.github.io/beacon-APIs/#/Beacon/publishBlindedBlock
|
|
|
|
|
|
|
|
proc publishBlindedBlock*(body: altair.SignedBeaconBlock): RestPlainResponse {.
|
|
|
|
rest, endpoint: "/eth/v1/beacon/blinded_blocks",
|
|
|
|
meth: MethodPost.}
|
|
|
|
## https://ethereum.github.io/beacon-APIs/#/Beacon/publishBlindedBlock
|
|
|
|
|
2023-02-06 18:07:30 +00:00
|
|
|
proc publishBlindedBlock*(body: bellatrix_mev.SignedBlindedBeaconBlock):
|
|
|
|
RestPlainResponse {.
|
2022-11-24 09:14:05 +00:00
|
|
|
rest, endpoint: "/eth/v1/beacon/blinded_blocks",
|
|
|
|
meth: MethodPost.}
|
|
|
|
## https://ethereum.github.io/beacon-APIs/#/Beacon/publishBlindedBlock
|
|
|
|
|
2023-02-21 13:21:38 +00:00
|
|
|
proc publishBlindedBlock*(body: capella_mev.SignedBlindedBeaconBlock):
|
|
|
|
RestPlainResponse {.
|
|
|
|
rest, endpoint: "/eth/v1/beacon/blinded_blocks",
|
|
|
|
meth: MethodPost.}
|
|
|
|
## https://ethereum.github.io/beacon-APIs/#/Beacon/publishBlindedBlock
|
|
|
|
|
2023-11-16 00:20:13 +00:00
|
|
|
proc publishBlindedBlock*(body: deneb_mev.SignedBlindedBeaconBlock):
|
2023-10-12 11:49:48 +00:00
|
|
|
RestPlainResponse {.
|
|
|
|
rest, endpoint: "/eth/v1/beacon/blinded_blocks",
|
|
|
|
meth: MethodPost.}
|
|
|
|
## https://ethereum.github.io/beacon-APIs/#/Beacon/publishBlindedBlock
|
|
|
|
|
2022-11-24 09:14:05 +00:00
|
|
|
proc publishSszBlindedBlock*(
|
|
|
|
client: RestClientRef,
|
|
|
|
blck: ForkySignedBeaconBlock
|
|
|
|
): Future[RestPlainResponse] {.async.} =
|
|
|
|
## https://ethereum.github.io/beacon-APIs/#/Beacon/publishBlindedBlock
|
|
|
|
let
|
2023-09-27 15:10:28 +00:00
|
|
|
consensus = typeof(blck).kind.toString()
|
2022-11-24 09:14:05 +00:00
|
|
|
resp = await client.publishBlindedBlock(
|
|
|
|
blck, restContentType = $OctetStreamMediaType,
|
|
|
|
extraHeaders = @[("eth-consensus-version", consensus)])
|
|
|
|
return resp
|
|
|
|
|
2021-09-27 18:31:11 +00:00
|
|
|
proc getBlockV2Plain*(block_id: BlockIdent): RestPlainResponse {.
|
2022-01-06 07:38:40 +00:00
|
|
|
rest, endpoint: "/eth/v2/beacon/blocks/{block_id}",
|
2022-02-04 13:26:27 +00:00
|
|
|
accept: preferSSZ,
|
2021-08-27 09:00:06 +00:00
|
|
|
meth: MethodGet.}
|
|
|
|
## https://ethereum.github.io/beacon-APIs/#/Beacon/getBlockV2
|
2021-08-03 15:17:11 +00:00
|
|
|
|
2021-09-27 18:31:11 +00:00
|
|
|
proc getBlockV2*(client: RestClientRef, block_id: BlockIdent,
|
2022-01-06 07:38:40 +00:00
|
|
|
cfg: RuntimeConfig,
|
2022-02-12 11:09:59 +00:00
|
|
|
restAccept = ""): Future[Option[ref ForkedSignedBeaconBlock]] {.
|
2021-09-27 18:31:11 +00:00
|
|
|
async.} =
|
2022-01-06 07:38:40 +00:00
|
|
|
# Return the asked-for block, or None in case 404 is returned from the server.
|
|
|
|
# Raises on other errors
|
2021-09-27 18:31:11 +00:00
|
|
|
let resp =
|
|
|
|
if len(restAccept) > 0:
|
|
|
|
await client.getBlockV2Plain(block_id, restAcceptType = restAccept)
|
|
|
|
else:
|
|
|
|
await client.getBlockV2Plain(block_id)
|
2022-01-06 07:38:40 +00:00
|
|
|
|
|
|
|
return
|
2021-09-27 18:31:11 +00:00
|
|
|
case resp.status
|
|
|
|
of 200:
|
2022-09-19 09:17:29 +00:00
|
|
|
if resp.contentType.isNone() or
|
|
|
|
isWildCard(resp.contentType.get().mediaType):
|
|
|
|
raise newException(RestError, "Missing or incorrect Content-Type")
|
2021-09-27 18:31:11 +00:00
|
|
|
else:
|
2022-09-19 09:17:29 +00:00
|
|
|
let mediaType = resp.contentType.get().mediaType
|
|
|
|
if mediaType == ApplicationJsonMediaType:
|
|
|
|
let blck = decodeBytes(GetBlockV2Response, resp.data,
|
|
|
|
resp.contentType).valueOr:
|
|
|
|
raise newException(RestError, $error)
|
|
|
|
some(newClone(blck))
|
|
|
|
elif mediaType == OctetStreamMediaType:
|
|
|
|
try:
|
|
|
|
some newClone(readSszForkedSignedBeaconBlock(cfg, resp.data))
|
|
|
|
except CatchableError as exc:
|
|
|
|
raise newException(RestError, exc.msg)
|
|
|
|
else:
|
|
|
|
raise newException(RestError, "Unsupported Content-Type")
|
2022-01-06 07:38:40 +00:00
|
|
|
of 404:
|
2022-02-12 11:09:59 +00:00
|
|
|
none(ref ForkedSignedBeaconBlock)
|
2022-01-06 07:38:40 +00:00
|
|
|
of 400, 500:
|
2022-09-29 20:55:18 +00:00
|
|
|
let error = decodeBytes(RestErrorMessage, resp.data,
|
2022-09-19 09:17:29 +00:00
|
|
|
resp.contentType).valueOr:
|
|
|
|
let msg = "Incorrect response error format (" & $resp.status &
|
|
|
|
") [" & $error & "]"
|
2022-09-29 20:55:18 +00:00
|
|
|
raise (ref RestResponseError)(msg: msg, status: resp.status)
|
2021-09-27 18:31:11 +00:00
|
|
|
let msg = "Error response (" & $resp.status & ") [" & error.message & "]"
|
2022-09-29 20:55:18 +00:00
|
|
|
raise (ref RestResponseError)(
|
|
|
|
msg: msg, status: error.code, message: error.message)
|
2021-09-27 18:31:11 +00:00
|
|
|
else:
|
2022-09-29 20:55:18 +00:00
|
|
|
raiseRestResponseError(resp)
|
2021-09-27 18:31:11 +00:00
|
|
|
|
2023-03-03 20:20:01 +00:00
|
|
|
proc getBlockRootPlain*(block_id: BlockIdent): RestPlainResponse {.
|
|
|
|
rest, endpoint: "/eth/v1/beacon/blocks/{block_id}/root",
|
|
|
|
meth: MethodGet.}
|
|
|
|
## https://ethereum.github.io/beacon-APIs/#/Beacon/getBlockRoot
|
|
|
|
|
2021-08-03 15:17:11 +00:00
|
|
|
proc getBlockAttestations*(block_id: BlockIdent
|
|
|
|
): RestResponse[GetBlockAttestationsResponse] {.
|
|
|
|
rest, endpoint: "/eth/v1/beacon/blocks/{block_id}/attestations",
|
|
|
|
meth: MethodGet.}
|
2021-08-27 09:00:06 +00:00
|
|
|
## https://ethereum.github.io/beacon-APIs/#/Beacon/getBlockAttestations
|
2021-08-03 15:17:11 +00:00
|
|
|
|
|
|
|
proc getPoolAttestations*(
|
|
|
|
slot: Option[Slot],
|
|
|
|
committee_index: Option[CommitteeIndex]
|
|
|
|
): RestResponse[GetPoolAttestationsResponse] {.
|
2021-12-22 12:37:31 +00:00
|
|
|
rest, endpoint: "/eth/v1/beacon/pool/attestations",
|
2021-08-03 15:17:11 +00:00
|
|
|
meth: MethodGet.}
|
2021-08-27 09:00:06 +00:00
|
|
|
## https://ethereum.github.io/beacon-APIs/#/Beacon/getPoolAttestations
|
2021-08-03 15:17:11 +00:00
|
|
|
|
|
|
|
proc submitPoolAttestations*(body: seq[Attestation]): RestPlainResponse {.
|
|
|
|
rest, endpoint: "/eth/v1/beacon/pool/attestations",
|
|
|
|
meth: MethodPost.}
|
2021-08-27 09:00:06 +00:00
|
|
|
## https://ethereum.github.io/beacon-APIs/#/Beacon/submitPoolAttestations
|
2021-08-03 15:17:11 +00:00
|
|
|
|
|
|
|
proc getPoolAttesterSlashings*(): RestResponse[GetPoolAttesterSlashingsResponse] {.
|
2021-12-22 12:37:31 +00:00
|
|
|
rest, endpoint: "/eth/v1/beacon/pool/attester_slashings",
|
2021-08-03 15:17:11 +00:00
|
|
|
meth: MethodGet.}
|
2021-08-27 09:00:06 +00:00
|
|
|
## https://ethereum.github.io/beacon-APIs/#/Beacon/getPoolAttesterSlashings
|
2021-08-03 15:17:11 +00:00
|
|
|
|
|
|
|
proc submitPoolAttesterSlashings*(body: AttesterSlashing): RestPlainResponse {.
|
2021-12-22 12:37:31 +00:00
|
|
|
rest, endpoint: "/eth/v1/beacon/pool/attester_slashings",
|
2021-08-03 15:17:11 +00:00
|
|
|
meth: MethodPost.}
|
2021-08-27 09:00:06 +00:00
|
|
|
## https://ethereum.github.io/beacon-APIs/#/Beacon/submitPoolAttesterSlashings
|
2021-08-03 15:17:11 +00:00
|
|
|
|
|
|
|
proc getPoolProposerSlashings*(): RestResponse[GetPoolProposerSlashingsResponse] {.
|
2021-12-22 12:37:31 +00:00
|
|
|
rest, endpoint: "/eth/v1/beacon/pool/proposer_slashings",
|
2021-08-03 15:17:11 +00:00
|
|
|
meth: MethodGet.}
|
2021-08-27 09:00:06 +00:00
|
|
|
## https://ethereum.github.io/beacon-APIs/#/Beacon/getPoolProposerSlashings
|
2021-08-03 15:17:11 +00:00
|
|
|
|
|
|
|
proc submitPoolProposerSlashings*(body: ProposerSlashing): RestPlainResponse {.
|
2021-12-22 12:37:31 +00:00
|
|
|
rest, endpoint: "/eth/v1/beacon/pool/proposer_slashings",
|
2021-08-03 15:17:11 +00:00
|
|
|
meth: MethodPost.}
|
2021-08-27 09:00:06 +00:00
|
|
|
## https://ethereum.github.io/beacon-APIs/#/Beacon/submitPoolProposerSlashings
|
2021-08-03 15:17:11 +00:00
|
|
|
|
2021-10-19 17:44:05 +00:00
|
|
|
proc submitPoolSyncCommitteeSignatures*(body: seq[RestSyncCommitteeMessage]): RestPlainResponse {.
|
|
|
|
rest, endpoint: "/eth/v1/beacon/pool/sync_committees",
|
|
|
|
meth: MethodPost.}
|
|
|
|
## https://ethereum.github.io/beacon-APIs/#/Beacon/submitPoolSyncCommitteeSignatures
|
2021-08-03 15:17:11 +00:00
|
|
|
|
|
|
|
proc getPoolVoluntaryExits*(): RestResponse[GetPoolVoluntaryExitsResponse] {.
|
2021-12-22 12:37:31 +00:00
|
|
|
rest, endpoint: "/eth/v1/beacon/pool/voluntary_exits",
|
2021-08-03 15:17:11 +00:00
|
|
|
meth: MethodGet.}
|
2021-08-27 09:00:06 +00:00
|
|
|
## https://ethereum.github.io/beacon-APIs/#/Beacon/getPoolVoluntaryExits
|
2021-08-03 15:17:11 +00:00
|
|
|
|
|
|
|
proc submitPoolVoluntaryExit*(body: SignedVoluntaryExit): RestPlainResponse {.
|
2021-12-22 12:37:31 +00:00
|
|
|
rest, endpoint: "/eth/v1/beacon/pool/voluntary_exits",
|
2021-08-03 15:17:11 +00:00
|
|
|
meth: MethodPost.}
|
2021-08-27 09:00:06 +00:00
|
|
|
## https://ethereum.github.io/beacon-APIs/#/Beacon/submitPoolVoluntaryExit
|
2022-12-07 10:24:51 +00:00
|
|
|
|
|
|
|
proc getDepositSnapshot*(): RestResponse[GetDepositSnapshotResponse] {.
|
|
|
|
rest, endpoint: "/eth/v1/beacon/deposit_snapshot",
|
|
|
|
meth: MethodGet.}
|
|
|
|
## https://github.com/ethereum/EIPs/blob/master/EIPS/eip-4881.md
|