2023-01-20 14:14:37 +00:00
|
|
|
# Copyright (c) 2018-2023 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-08-27 09:00:06 +00:00
|
|
|
chronos, presto/client,
|
2021-08-03 15:17:11 +00:00
|
|
|
"."/[rest_types, eth2_rest_serialization]
|
|
|
|
|
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 getNetworkIdentity*(): RestResponse[GetNetworkIdentityResponse] {.
|
|
|
|
rest, endpoint: "/eth/v1/node/identity",
|
|
|
|
meth: MethodGet.}
|
2021-08-27 09:00:06 +00:00
|
|
|
## https://ethereum.github.io/beacon-APIs/#/Node/getNetworkIdentity
|
2021-08-03 15:17:11 +00:00
|
|
|
|
|
|
|
proc getPeers*(
|
|
|
|
state: seq[PeerStateKind],
|
|
|
|
direction: seq[PeerDirectKind]): RestResponse[GetPeersResponse] {.
|
|
|
|
rest, endpoint: "/eth/v1/node/peers",
|
|
|
|
meth: MethodGet.}
|
2021-08-27 09:00:06 +00:00
|
|
|
## https://ethereum.github.io/beacon-APIs/#/Node/getPeers
|
2021-08-03 15:17:11 +00:00
|
|
|
|
|
|
|
proc getPeer*(peer_id: PeerId): RestResponse[GetPeerResponse] {.
|
|
|
|
rest, endpoint: "/eth/v1/node/peers/{peer_id}",
|
|
|
|
meth: MethodGet.}
|
2021-08-27 09:00:06 +00:00
|
|
|
## https://ethereum.github.io/beacon-APIs/#/Node/getPeer
|
2021-08-03 15:17:11 +00:00
|
|
|
|
|
|
|
proc getPeerCount*(): RestResponse[GetPeerCountResponse] {.
|
|
|
|
rest, endpoint: "/eth/v1/node/peer_count",
|
|
|
|
meth: MethodGet.}
|
2021-08-27 09:00:06 +00:00
|
|
|
## https://ethereum.github.io/beacon-APIs/#/Node/getPeerCount
|
2021-08-03 15:17:11 +00:00
|
|
|
|
|
|
|
proc getNodeVersion*(): RestResponse[GetVersionResponse] {.
|
|
|
|
rest, endpoint: "/eth/v1/node/version",
|
|
|
|
meth: MethodGet.}
|
2021-08-27 09:00:06 +00:00
|
|
|
## https://ethereum.github.io/beacon-APIs/#/Node/getNodeVersion
|
2021-08-03 15:17:11 +00:00
|
|
|
|
|
|
|
proc getSyncingStatus*(): RestResponse[GetSyncingStatusResponse] {.
|
|
|
|
rest, endpoint: "/eth/v1/node/syncing",
|
|
|
|
meth: MethodGet.}
|
2021-08-27 09:00:06 +00:00
|
|
|
## https://ethereum.github.io/beacon-APIs/#/Node/getSyncingStatus
|
2021-08-03 15:17:11 +00:00
|
|
|
|
|
|
|
proc getHealth*(): RestPlainResponse {.
|
|
|
|
rest, endpoint: "/eth/v1/node/health",
|
|
|
|
meth: MethodGet.}
|
2021-08-27 09:00:06 +00:00
|
|
|
## https://ethereum.github.io/beacon-APIs/#/Node/getHealth
|