Docs/RPC: minor RPC improvements

This commit is contained in:
Grégoire Henry 2018-04-22 00:43:07 +02:00 committed by Benjamin Canou
parent 33ded01ae7
commit 22d20509bf
4 changed files with 16 additions and 14 deletions

View File

@ -9,3 +9,9 @@
include Crypto_box.Public_key_hash
let rpc_arg =
RPC_arg.like
rpc_arg
~descr:"A cryptographic node identity (Base58Check-encoded)"
"peer_id"

View File

@ -8,8 +8,8 @@
(**************************************************************************)
include Blake2B.Make (Base58) (struct
let name = "Block_hash"
let title = "A Tezos block ID"
let name = "block_hash"
let title = "A block identifier"
let b58check_prefix = Base58.Prefix.block_hash
let size = None
end)

View File

@ -165,6 +165,12 @@ module Public_key_hash = struct
let encoding = encoding
end)
let rpc_arg =
RPC_arg.like
rpc_arg
~descr:"A Secp256k1 of a Ed25519 public key hash (Base58Check-encoded)"
"pkh"
end
module Public_key = struct

View File

@ -69,16 +69,6 @@ module Peer_validators = struct
module S = struct
let (peer_id_arg : P2p_peer.Id.t RPC_arg.t) =
RPC_arg.make
~name:"peer_id"
~descr:"The peer identifier of whom the prevalidator is responsible."
~destruct:(fun s -> try
Ok (P2p_peer.Id.of_b58check_exn s)
with Failure msg -> Error msg)
~construct:P2p_peer.Id.to_b58check
()
let list =
RPC_service.get_service
~description:"Lists the peer validator workers and their status."
@ -88,7 +78,7 @@ module Peer_validators = struct
(obj2
(req "peer_id" P2p_peer.Id.encoding)
(req "status" (Worker_types.worker_status_encoding RPC_error.encoding))))
RPC_path.(root / "workers" / "peer_validators" /: Chain_services.chain_arg)
RPC_path.(root / "workers" / "chain_validators" /: Chain_services.chain_arg / "peers_validators" )
let state =
RPC_service.get_service
@ -99,7 +89,7 @@ module Peer_validators = struct
Peer_validator_worker_state.Request.encoding
Peer_validator_worker_state.Event.encoding
RPC_error.encoding)
RPC_path.(root / "workers" / "peer_validators" /: Chain_services.chain_arg /: peer_id_arg)
RPC_path.(root / "workers" / "chain_validators" /: Chain_services.chain_arg / "peers_validators" /: P2p_peer.Id.rpc_arg)
end