Alpha/RPC: minor renaming

This commit is contained in:
Grégoire Henry 2018-05-27 22:56:41 +02:00 committed by Benjamin Canou
parent f5e3fb17c0
commit f7aa0398ca
15 changed files with 36 additions and 27 deletions

View File

@ -79,7 +79,7 @@ module Raw_level : sig
include BASIC_DATA
type raw_level = t
val arg: raw_level RPC_arg.arg
val rpc_arg: raw_level RPC_arg.arg
val diff: raw_level -> raw_level -> int32
@ -95,7 +95,7 @@ module Cycle : sig
include BASIC_DATA
type cycle = t
val arg: cycle RPC_arg.arg
val rpc_arg: cycle RPC_arg.arg
val root: cycle
val succ: cycle -> cycle
@ -375,7 +375,7 @@ module Voting_period : sig
include BASIC_DATA
type voting_period = t
val arg: voting_period RPC_arg.arg
val rpc_arg: voting_period RPC_arg.arg
val root: voting_period
val succ: voting_period -> voting_period
@ -485,7 +485,7 @@ module Contract : sig
include BASIC_DATA
type contract = t
val arg: contract RPC_arg.arg
val rpc_arg: contract RPC_arg.arg
val to_b58check: contract -> string
val of_b58check: string -> contract tzresult

View File

@ -42,7 +42,7 @@ module Nonce = struct
~description: "Info about the nonce of a previous block."
~query: RPC_query.empty
~output: info_encoding
RPC_path.(custom_root / "context" / "nonces" /: Raw_level.arg)
RPC_path.(custom_root / "context" / "nonces" /: Raw_level.rpc_arg)
end

View File

@ -9,6 +9,9 @@
include S.HASH
val encoding : t Data_encoding.t
val rpc_arg : t RPC_arg.t
type activation_code
val activation_code_encoding : activation_code Data_encoding.t

View File

@ -135,7 +135,7 @@ let incr_origination_nonce nonce =
let origination_index = Int32.succ nonce.origination_index in
{ nonce with origination_index }
let arg =
let rpc_arg =
let construct = to_b58check in
let destruct hash =
match of_b58check hash with

View File

@ -58,7 +58,7 @@ val encoding : contract Data_encoding.t
val origination_nonce_encoding : origination_nonce Data_encoding.t
val arg : contract RPC_arg.arg
val rpc_arg : contract RPC_arg.arg
module Index : sig
type t = contract

View File

@ -51,14 +51,14 @@ module S = struct
~description: "Access the balance of a contract."
~query: RPC_query.empty
~output: Tez.encoding
RPC_path.(custom_root /: Contract.arg / "balance")
RPC_path.(custom_root /: Contract.rpc_arg / "balance")
let manager =
RPC_service.get_service
~description: "Access the manager of a contract."
~query: RPC_query.empty
~output: Signature.Public_key_hash.encoding
RPC_path.(custom_root /: Contract.arg / "manager")
RPC_path.(custom_root /: Contract.rpc_arg / "manager")
let manager_key =
RPC_service.get_service
@ -67,56 +67,56 @@ module S = struct
~output: (obj2
(req "manager" Signature.Public_key_hash.encoding)
(opt "key" Signature.Public_key.encoding))
RPC_path.(custom_root /: Contract.arg / "manager_key")
RPC_path.(custom_root /: Contract.rpc_arg / "manager_key")
let delegate =
RPC_service.get_service
~description: "Access the delegate of a contract, if any."
~query: RPC_query.empty
~output: Signature.Public_key_hash.encoding
RPC_path.(custom_root /: Contract.arg / "delegate")
RPC_path.(custom_root /: Contract.rpc_arg / "delegate")
let counter =
RPC_service.get_service
~description: "Access the counter of a contract, if any."
~query: RPC_query.empty
~output: int32
RPC_path.(custom_root /: Contract.arg / "counter")
RPC_path.(custom_root /: Contract.rpc_arg / "counter")
let spendable =
RPC_service.get_service
~description: "Tells if the contract tokens can be spent by the manager."
~query: RPC_query.empty
~output: bool
RPC_path.(custom_root /: Contract.arg / "spendable")
RPC_path.(custom_root /: Contract.rpc_arg / "spendable")
let delegatable =
RPC_service.get_service
~description: "Tells if the contract delegate can be changed."
~query: RPC_query.empty
~output: bool
RPC_path.(custom_root /: Contract.arg / "delegatable")
RPC_path.(custom_root /: Contract.rpc_arg / "delegatable")
let script =
RPC_service.get_service
~description: "Access the code and data of the contract."
~query: RPC_query.empty
~output: Script.encoding
RPC_path.(custom_root /: Contract.arg / "script")
RPC_path.(custom_root /: Contract.rpc_arg / "script")
let storage =
RPC_service.get_service
~description: "Access the data of the contract."
~query: RPC_query.empty
~output: Script.expr_encoding
RPC_path.(custom_root /: Contract.arg / "storage")
RPC_path.(custom_root /: Contract.rpc_arg / "storage")
let info =
RPC_service.get_service
~description: "Access the complete status of a contract."
~query: RPC_query.empty
~output: info_encoding
RPC_path.(custom_root /: Contract.arg)
RPC_path.(custom_root /: Contract.rpc_arg)
let list =
RPC_service.get_service

View File

@ -11,7 +11,7 @@ type t = int32
type cycle = t
let encoding = Data_encoding.int32
let arg =
let rpc_arg =
let construct = Int32.to_string in
let destruct str =
match Int32.of_string str with

View File

@ -11,7 +11,7 @@ type t
type cycle = t
include Compare.S with type t := t
val encoding: cycle Data_encoding.t
val arg: cycle RPC_arg.arg
val rpc_arg: cycle RPC_arg.arg
val pp: Format.formatter -> cycle -> unit
val root: cycle

View File

@ -314,8 +314,8 @@ module Baking_rights = struct
let open RPC_query in
query (fun levels cycles delegates max_priority all ->
{ levels ; cycles ; delegates ; max_priority ; all })
|+ multi_field "level" Raw_level.arg (fun t -> t.levels)
|+ multi_field "cycle" Cycle.arg (fun t -> t.cycles)
|+ multi_field "level" Raw_level.rpc_arg (fun t -> t.levels)
|+ multi_field "cycle" Cycle.rpc_arg (fun t -> t.cycles)
|+ multi_field "delegate" Signature.Public_key_hash.rpc_arg (fun t -> t.delegates)
|+ opt_field "max_priority" RPC_arg.int (fun t -> t.max_priority)
|+ flag "all" (fun t -> t.all)
@ -437,8 +437,8 @@ module Endorsing_rights = struct
let open RPC_query in
query (fun levels cycles delegates ->
{ levels ; cycles ; delegates })
|+ multi_field "level" Raw_level.arg (fun t -> t.levels)
|+ multi_field "cycle" Cycle.arg (fun t -> t.cycles)
|+ multi_field "level" Raw_level.rpc_arg (fun t -> t.levels)
|+ multi_field "cycle" Cycle.rpc_arg (fun t -> t.cycles)
|+ multi_field "delegate" Signature.Public_key_hash.rpc_arg (fun t -> t.delegates)
|> seal

View File

@ -12,7 +12,7 @@ type raw_level = t
include (Compare.Int32 : Compare.S with type t := t)
let encoding = Data_encoding.int32
let pp ppf level = Format.fprintf ppf "%ld" level
let arg =
let rpc_arg =
let construct raw_level = Int32.to_string raw_level in
let destruct str =
match Int32.of_string str with

View File

@ -13,7 +13,7 @@
type t
type raw_level = t
val encoding: raw_level Data_encoding.t
val arg: raw_level RPC_arg.arg
val rpc_arg: raw_level RPC_arg.arg
val pp: Format.formatter -> raw_level -> unit
include Compare.S with type t := raw_level

View File

@ -18,6 +18,11 @@ let succ i = Int32.succ i
let random sequence ~bound =
Seed_repr.take_int32 sequence bound
let rpc_arg =
RPC_arg.like
RPC_arg.int32
"roll"
let to_int32 v = v
let (=) = Compare.Int32.(=)

View File

@ -11,6 +11,7 @@ type t = private int32
type roll = t
val encoding: roll Data_encoding.t
val rpc_arg: roll RPC_arg.t
val random:
Seed_repr.sequence -> bound:roll -> roll * Seed_repr.sequence

View File

@ -12,7 +12,7 @@ type voting_period = t
include (Compare.Int32 : Compare.S with type t := t)
let encoding = Data_encoding.int32
let pp ppf level = Format.fprintf ppf "%ld" level
let arg =
let rpc_arg =
let construct voting_period = Int32.to_string voting_period in
let destruct str =
match Int32.of_string str with

View File

@ -10,7 +10,7 @@
type t
type voting_period = t
val encoding: voting_period Data_encoding.t
val arg: voting_period RPC_arg.arg
val rpc_arg: voting_period RPC_arg.arg
val pp: Format.formatter -> voting_period -> unit
include Compare.S with type t := voting_period