From 58587258dc1a2b659c3de7a3215834958f1ffd60 Mon Sep 17 00:00:00 2001 From: Guillem Rieu Date: Fri, 14 Apr 2017 20:24:11 +0200 Subject: [PATCH] Proto/Alpha: add a RPC `/context/voting_period_kind` --- src/client/embedded/alpha/client_proto_rpcs.ml | 3 +++ src/client/embedded/alpha/client_proto_rpcs.mli | 6 ++++++ src/proto/alpha/services.ml | 11 +++++++++++ src/proto/alpha/services_registration.ml | 4 ++++ 4 files changed, 24 insertions(+) diff --git a/src/client/embedded/alpha/client_proto_rpcs.ml b/src/client/embedded/alpha/client_proto_rpcs.ml index 1b943456f..0a71b5146 100644 --- a/src/client/embedded/alpha/client_proto_rpcs.ml +++ b/src/client/embedded/alpha/client_proto_rpcs.ml @@ -72,6 +72,9 @@ module Context = struct let faucet_counter cctxt 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 type nonce_info = Services.Context.Nonce.nonce_info = diff --git a/src/client/embedded/alpha/client_proto_rpcs.mli b/src/client/embedded/alpha/client_proto_rpcs.mli index 4e20e69e4..18429648b 100644 --- a/src/client/embedded/alpha/client_proto_rpcs.mli +++ b/src/client/embedded/alpha/client_proto_rpcs.mli @@ -64,6 +64,12 @@ module Context : sig Client_rpcs.config -> 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 val hash: Client_rpcs.config -> diff --git a/src/proto/alpha/services.ml b/src/proto/alpha/services.ml index 2829bcac4..a7e39d70f 100644 --- a/src/proto/alpha/services.ml +++ b/src/proto/alpha/services.ml @@ -143,6 +143,17 @@ module Context = struct ~output: (wrap_tzerror int32) 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 type nonce_info = diff --git a/src/proto/alpha/services_registration.ml b/src/proto/alpha/services_registration.ml index b1b18e647..9816e4d40 100644 --- a/src/proto/alpha/services_registration.ml +++ b/src/proto/alpha/services_registration.ml @@ -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.voting_period_kind Vote.get_current_period_kind + + (*-- Context.Nonce -----------------------------------------------------------*) let nonce ctxt raw_level () =