2016-09-08 21:13:10 +04:00
|
|
|
(**************************************************************************)
|
|
|
|
(* *)
|
2018-02-06 00:17:03 +04:00
|
|
|
(* Copyright (c) 2014 - 2018. *)
|
2016-09-08 21:13:10 +04:00
|
|
|
(* Dynamic Ledger Solutions, Inc. <contact@tezos.com> *)
|
|
|
|
(* *)
|
|
|
|
(* All rights reserved. No warranty, explicit or implicit, provided. *)
|
|
|
|
(* *)
|
|
|
|
(**************************************************************************)
|
|
|
|
|
2016-12-03 16:05:02 +04:00
|
|
|
type ('a, 'b) lwt_format =
|
|
|
|
('a, Format.formatter, unit, 'b Lwt.t) format4
|
|
|
|
|
2017-11-07 20:38:11 +04:00
|
|
|
class type logger_sig = object
|
|
|
|
method error : ('a, 'b) lwt_format -> 'a
|
|
|
|
method warning : ('a, unit) lwt_format -> 'a
|
|
|
|
method message : ('a, unit) lwt_format -> 'a
|
|
|
|
method answer : ('a, unit) lwt_format -> 'a
|
|
|
|
method log : string -> ('a, unit) lwt_format -> 'a
|
|
|
|
end
|
|
|
|
|
|
|
|
class logger : (string -> string -> unit Lwt.t) -> logger_sig
|
|
|
|
|
|
|
|
class type wallet = object
|
|
|
|
method load : string -> default:'a -> 'a Data_encoding.encoding -> 'a tzresult Lwt.t
|
|
|
|
method write : string -> 'a -> 'a Data_encoding.encoding -> unit tzresult Lwt.t
|
|
|
|
end
|
|
|
|
|
|
|
|
class type block = object
|
2018-01-26 16:07:49 +04:00
|
|
|
method block : Block_services.block
|
2017-11-07 20:38:11 +04:00
|
|
|
end
|
|
|
|
|
|
|
|
class type logging_wallet = object
|
|
|
|
inherit logger_sig
|
|
|
|
inherit wallet
|
|
|
|
end
|
|
|
|
|
|
|
|
class type logging_rpcs = object
|
|
|
|
inherit logger_sig
|
2018-02-14 03:54:33 +04:00
|
|
|
inherit RPC_context.json
|
2017-11-07 20:38:11 +04:00
|
|
|
end
|
|
|
|
|
|
|
|
class type full_context = object
|
|
|
|
inherit logger_sig
|
|
|
|
inherit wallet
|
2018-02-14 03:54:33 +04:00
|
|
|
inherit RPC_context.json
|
2017-11-07 20:38:11 +04:00
|
|
|
inherit block
|
|
|
|
end
|
|
|
|
(** The [full_context] allows the client {!command} handlers to work in
|
2017-03-08 21:47:01 +04:00
|
|
|
various modes (command line, batch mode, web client, etc.) by
|
|
|
|
abstracting some basic operations such as logging and reading
|
|
|
|
configuration options. It is passed as parameter to the command
|
|
|
|
handler when running a command, and must be transmitted to all
|
|
|
|
basic operations, also making client commands reantrant. *)
|
2016-12-03 16:05:02 +04:00
|
|
|
|
2018-02-11 22:17:40 +04:00
|
|
|
class proxy_context : full_context -> full_context
|
|
|
|
|
2018-02-13 20:56:47 +04:00
|
|
|
type command = full_context Cli_entries.command
|
2016-09-08 21:13:10 +04:00
|
|
|
|
|
|
|
exception Version_not_found
|
|
|
|
|
|
|
|
val register: Protocol_hash.t -> command list -> unit
|
|
|
|
val commands_for_version: Protocol_hash.t -> command list
|
|
|
|
val get_versions: unit -> (Protocol_hash.t * (command list)) list
|
2017-11-07 17:23:01 +04:00
|
|
|
|
|
|
|
(** Have a command execute ignoring warnings.
|
2018-01-29 13:43:07 +04:00
|
|
|
Default doc is ["Silence any warnings and some checks."]. *)
|
2018-02-11 22:17:39 +04:00
|
|
|
val force_switch : ?doc:string -> unit -> (bool, #full_context) Cli_entries.arg
|