Proto/Alpha: add a RPC /context/voting_period_kind

This commit is contained in:
Guillem Rieu 2017-04-14 20:24:11 +02:00 committed by Grégoire Henry
parent 4ded0660d6
commit 58587258dc
4 changed files with 24 additions and 0 deletions

View File

@ -72,6 +72,9 @@ module Context = struct
let faucet_counter cctxt block = let faucet_counter cctxt block =
call_error_service1 cctxt Services.Context.faucet_counter block () call_error_service1 cctxt Services.Context.faucet_counter block ()
let voting_period_kind cctxt block =
call_error_service1 cctxt Services.Context.voting_period_kind block ()
module Nonce = struct module Nonce = struct
type nonce_info = Services.Context.Nonce.nonce_info = type nonce_info = Services.Context.Nonce.nonce_info =

View File

@ -64,6 +64,12 @@ module Context : sig
Client_rpcs.config -> Client_rpcs.config ->
block -> int32 tzresult Lwt.t block -> int32 tzresult Lwt.t
val voting_period_kind:
Client_rpcs.config ->
block -> Voting_period.kind tzresult Lwt.t
(** [voting_period_kind cctxt blk] returns the voting period kind
of [blk]. *)
module Nonce : sig module Nonce : sig
val hash: val hash:
Client_rpcs.config -> Client_rpcs.config ->

View File

@ -143,6 +143,17 @@ module Context = struct
~output: (wrap_tzerror int32) ~output: (wrap_tzerror int32)
RPC.Path.(custom_root / "context" / "faucet_counter") RPC.Path.(custom_root / "context" / "faucet_counter")
let voting_period_kind custom_root =
RPC.service
~description: "Voting period kind for the current block"
~input: empty
~output:
(wrap_tzerror @@
(obj1
(req "voting_period_kind" Voting_period.kind_encoding)))
RPC.Path.(custom_root / "context" / "voting_period_kind")
module Nonce = struct module Nonce = struct
type nonce_info = type nonce_info =

View File

@ -142,6 +142,10 @@ let () = register0 Services.Context.next_level next_level
let () = register0 Services.Context.faucet_counter Contract.get_faucet_counter let () = register0 Services.Context.faucet_counter Contract.get_faucet_counter
let () =
register0 Services.Context.voting_period_kind Vote.get_current_period_kind
(*-- Context.Nonce -----------------------------------------------------------*) (*-- Context.Nonce -----------------------------------------------------------*)
let nonce ctxt raw_level () = let nonce ctxt raw_level () =