Client: introduce an alternative context alpha's commands
This commit is contained in:
parent
d539072f1b
commit
e4cde4c196
@ -143,6 +143,14 @@ module type V1 = sig
|
|||||||
and type rpc_context := Updater.rpc_context
|
and type rpc_context := Updater.rpc_context
|
||||||
and type 'a tzresult := 'a tzresult
|
and type 'a tzresult := 'a tzresult
|
||||||
|
|
||||||
|
class ['block] proto_rpc_context :
|
||||||
|
Tezos_rpc.RPC_context.t -> (unit, unit * 'block) RPC_path.t ->
|
||||||
|
['block] RPC_context.simple
|
||||||
|
|
||||||
|
class ['block] proto_rpc_context_of_directory :
|
||||||
|
('block -> RPC_context.t) -> RPC_context.t RPC_directory.t ->
|
||||||
|
['block] RPC_context.simple
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
module MakeV1
|
module MakeV1
|
||||||
@ -454,6 +462,87 @@ module MakeV1
|
|||||||
configure_sandbox c j >|= wrap_error
|
configure_sandbox c j >|= wrap_error
|
||||||
end
|
end
|
||||||
|
|
||||||
|
class ['block] proto_rpc_context
|
||||||
|
(t : Tezos_rpc.RPC_context.t)
|
||||||
|
(prefix : (unit, unit * 'block) RPC_path.t) =
|
||||||
|
object
|
||||||
|
method call_proto_service0
|
||||||
|
: 'm 'q 'i 'o.
|
||||||
|
([< RPC_service.meth ] as 'm, RPC_context.t,
|
||||||
|
RPC_context.t, 'q, 'i, 'o) RPC_service.t ->
|
||||||
|
'block -> 'q -> 'i -> 'o tzresult Lwt.t
|
||||||
|
= fun s block q i ->
|
||||||
|
let s = RPC_service.subst0 s in
|
||||||
|
let s = RPC_service.prefix prefix s in
|
||||||
|
t#call_service s ((), block) q i
|
||||||
|
method call_proto_service1
|
||||||
|
: 'm 'a 'q 'i 'o.
|
||||||
|
([< RPC_service.meth ] as 'm, RPC_context.t,
|
||||||
|
RPC_context.t * 'a, 'q, 'i, 'o) RPC_service.t ->
|
||||||
|
'block -> 'a -> 'q -> 'i -> 'o tzresult Lwt.t
|
||||||
|
= fun s block a1 q i ->
|
||||||
|
let s = RPC_service.subst1 s in
|
||||||
|
let s = RPC_service.prefix prefix s in
|
||||||
|
t#call_service s (((), block), a1) q i
|
||||||
|
method call_proto_service2
|
||||||
|
: 'm 'a 'b 'q 'i 'o.
|
||||||
|
([< RPC_service.meth ] as 'm, RPC_context.t,
|
||||||
|
(RPC_context.t * 'a) * 'b, 'q, 'i, 'o) RPC_service.t ->
|
||||||
|
'block -> 'a -> 'b -> 'q -> 'i -> 'o tzresult Lwt.t
|
||||||
|
= fun s block a1 a2 q i ->
|
||||||
|
let s = RPC_service.subst2 s in
|
||||||
|
let s = RPC_service.prefix prefix s in
|
||||||
|
t#call_service s ((((), block), a1), a2) q i
|
||||||
|
method call_proto_service3
|
||||||
|
: 'm 'a 'b 'c 'q 'i 'o.
|
||||||
|
([< RPC_service.meth ] as 'm, RPC_context.t,
|
||||||
|
((RPC_context.t * 'a) * 'b) * 'c,
|
||||||
|
'q, 'i, 'o) RPC_service.t ->
|
||||||
|
'block -> 'a -> 'b -> 'c -> 'q -> 'i -> 'o tzresult Lwt.t
|
||||||
|
= fun s block a1 a2 a3 q i ->
|
||||||
|
let s = RPC_service.subst3 s in
|
||||||
|
let s = RPC_service.prefix prefix s in
|
||||||
|
t#call_service s (((((), block), a1), a2), a3) q i
|
||||||
|
end
|
||||||
|
|
||||||
|
class ['block] proto_rpc_context_of_directory conv dir : ['block] RPC_context.simple =
|
||||||
|
let lookup = new Tezos_rpc.RPC_context.of_directory dir in
|
||||||
|
object
|
||||||
|
method call_proto_service0
|
||||||
|
: 'm 'q 'i 'o.
|
||||||
|
([< RPC_service.meth ] as 'm, RPC_context.t,
|
||||||
|
RPC_context.t, 'q, 'i, 'o) RPC_service.t ->
|
||||||
|
'block -> 'q -> 'i -> 'o tzresult Lwt.t
|
||||||
|
= fun s block q i ->
|
||||||
|
let rpc_context = conv block in
|
||||||
|
lookup#call_service s rpc_context q i
|
||||||
|
method call_proto_service1
|
||||||
|
: 'm 'a 'q 'i 'o.
|
||||||
|
([< RPC_service.meth ] as 'm, RPC_context.t,
|
||||||
|
RPC_context.t * 'a, 'q, 'i, 'o) RPC_service.t ->
|
||||||
|
'block -> 'a -> 'q -> 'i -> 'o tzresult Lwt.t
|
||||||
|
= fun s block a1 q i ->
|
||||||
|
let rpc_context = conv block in
|
||||||
|
lookup#call_service s (rpc_context, a1) q i
|
||||||
|
method call_proto_service2
|
||||||
|
: 'm 'a 'b 'q 'i 'o.
|
||||||
|
([< RPC_service.meth ] as 'm, RPC_context.t,
|
||||||
|
(RPC_context.t * 'a) * 'b, 'q, 'i, 'o) RPC_service.t ->
|
||||||
|
'block -> 'a -> 'b -> 'q -> 'i -> 'o tzresult Lwt.t
|
||||||
|
= fun s block a1 a2 q i ->
|
||||||
|
let rpc_context = conv block in
|
||||||
|
lookup#call_service s ((rpc_context, a1), a2) q i
|
||||||
|
method call_proto_service3
|
||||||
|
: 'm 'a 'b 'c 'q 'i 'o.
|
||||||
|
([< RPC_service.meth ] as 'm, RPC_context.t,
|
||||||
|
((RPC_context.t * 'a) * 'b) * 'c,
|
||||||
|
'q, 'i, 'o) RPC_service.t ->
|
||||||
|
'block -> 'a -> 'b -> 'c -> 'q -> 'i -> 'o tzresult Lwt.t
|
||||||
|
= fun s block a1 a2 a3 q i ->
|
||||||
|
let rpc_context = conv block in
|
||||||
|
lookup#call_service s (((rpc_context, a1), a2), a3) q i
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
@ -136,6 +136,14 @@ module type V1 = sig
|
|||||||
and type rpc_context := Updater.rpc_context
|
and type rpc_context := Updater.rpc_context
|
||||||
and type 'a tzresult := 'a tzresult
|
and type 'a tzresult := 'a tzresult
|
||||||
|
|
||||||
|
class ['block] proto_rpc_context :
|
||||||
|
Tezos_rpc.RPC_context.t -> (unit, unit * 'block) RPC_path.t ->
|
||||||
|
['block] RPC_context.simple
|
||||||
|
|
||||||
|
class ['block] proto_rpc_context_of_directory :
|
||||||
|
('block -> RPC_context.t) -> RPC_context.t RPC_directory.t ->
|
||||||
|
['block] RPC_context.simple
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
module MakeV1
|
module MakeV1
|
||||||
|
@ -64,6 +64,28 @@ class type full_context = object
|
|||||||
inherit block
|
inherit block
|
||||||
end
|
end
|
||||||
|
|
||||||
|
class proxy_context (obj : full_context) = object
|
||||||
|
method block = obj#block
|
||||||
|
method answer : type a. (a, unit) lwt_format -> a = obj#answer
|
||||||
|
method call_service :
|
||||||
|
'm 'p 'q 'i 'o.
|
||||||
|
([< Resto.meth ] as 'm, 'pr, 'p, 'q, 'i, 'o) RPC_service.t ->
|
||||||
|
'p -> 'q -> 'i -> 'o tzresult Lwt.t = obj#call_service
|
||||||
|
method call_streamed_service :
|
||||||
|
'm 'p 'q 'i 'o.
|
||||||
|
([< Resto.meth ] as 'm, 'pr, 'p, 'q, 'i, 'o) RPC_service.t ->
|
||||||
|
on_chunk: ('o -> unit) ->
|
||||||
|
on_close: (unit -> unit) ->
|
||||||
|
'p -> 'q -> 'i -> (unit -> unit) tzresult Lwt.t = obj#call_streamed_service
|
||||||
|
method error : type a b. (a, b) lwt_format -> a = obj#error
|
||||||
|
method generic_json_call = obj#generic_json_call
|
||||||
|
method load : type a. string -> default:a -> a Data_encoding.encoding -> a tzresult Lwt.t = obj#load
|
||||||
|
method log : type a. string -> (a, unit) lwt_format -> a = obj#log
|
||||||
|
method message : type a. (a, unit) lwt_format -> a = obj#message
|
||||||
|
method warning : type a. (a, unit) lwt_format -> a = obj#warning
|
||||||
|
method write : type a. string -> a -> a Data_encoding.encoding -> unit tzresult Lwt.t = obj#write
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
class file_wallet dir : wallet = object (self)
|
class file_wallet dir : wallet = object (self)
|
||||||
method private filename alias_name =
|
method private filename alias_name =
|
||||||
|
@ -54,6 +54,8 @@ end
|
|||||||
handler when running a command, and must be transmitted to all
|
handler when running a command, and must be transmitted to all
|
||||||
basic operations, also making client commands reantrant. *)
|
basic operations, also making client commands reantrant. *)
|
||||||
|
|
||||||
|
class proxy_context : full_context -> full_context
|
||||||
|
|
||||||
val make_context :
|
val make_context :
|
||||||
?base_dir:string ->
|
?base_dir:string ->
|
||||||
?block:Block_services.block ->
|
?block:Block_services.block ->
|
||||||
|
@ -9,27 +9,41 @@
|
|||||||
|
|
||||||
open Error_monad
|
open Error_monad
|
||||||
|
|
||||||
class type simple = object
|
class type ['pr] gen_simple = object
|
||||||
method call_service :
|
method call_service :
|
||||||
'm 'p 'q 'i 'o.
|
'm 'p 'q 'i 'o.
|
||||||
([< Resto.meth ] as 'm, unit, 'p, 'q, 'i, 'o) RPC_service.t ->
|
([< Resto.meth ] as 'm, 'pr, 'p, 'q, 'i, 'o) RPC_service.t ->
|
||||||
'p -> 'q -> 'i -> 'o tzresult Lwt.t
|
'p -> 'q -> 'i -> 'o tzresult Lwt.t
|
||||||
end
|
end
|
||||||
|
|
||||||
class type streamed = object
|
class type ['pr] gen_streamed = object
|
||||||
method call_streamed_service :
|
method call_streamed_service :
|
||||||
'm 'p 'q 'i 'o.
|
'm 'p 'q 'i 'o.
|
||||||
([< Resto.meth ] as 'm, unit, 'p, 'q, 'i, 'o) RPC_service.t ->
|
([< Resto.meth ] as 'm, 'pr, 'p, 'q, 'i, 'o) RPC_service.t ->
|
||||||
on_chunk: ('o -> unit) ->
|
on_chunk: ('o -> unit) ->
|
||||||
on_close: (unit -> unit) ->
|
on_close: (unit -> unit) ->
|
||||||
'p -> 'q -> 'i -> (unit -> unit) tzresult Lwt.t
|
'p -> 'q -> 'i -> (unit -> unit) tzresult Lwt.t
|
||||||
end
|
end
|
||||||
|
|
||||||
|
class type ['pr] gen = object
|
||||||
|
inherit ['pr] gen_simple
|
||||||
|
inherit ['pr] gen_streamed
|
||||||
|
end
|
||||||
|
|
||||||
|
class type simple = object
|
||||||
|
inherit [unit] gen_simple
|
||||||
|
end
|
||||||
|
|
||||||
|
class type streamed = object
|
||||||
|
inherit [unit] gen_streamed
|
||||||
|
end
|
||||||
|
|
||||||
class type t = object
|
class type t = object
|
||||||
inherit simple
|
inherit simple
|
||||||
inherit streamed
|
inherit streamed
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
type error +=
|
type error +=
|
||||||
| Not_found of { meth: RPC_service.meth ;
|
| Not_found of { meth: RPC_service.meth ;
|
||||||
uri: Uri.t }
|
uri: Uri.t }
|
||||||
@ -39,17 +53,17 @@ type error +=
|
|||||||
let base = Uri.make ~scheme:"ocaml" ()
|
let base = Uri.make ~scheme:"ocaml" ()
|
||||||
let not_found s p q =
|
let not_found s p q =
|
||||||
let { RPC_service.meth ; uri ; _ } =
|
let { RPC_service.meth ; uri ; _ } =
|
||||||
RPC_service.forge_request s ~base p q in
|
RPC_service.forge_partial_request s ~base p q in
|
||||||
fail (Not_found { meth ; uri })
|
fail (Not_found { meth ; uri })
|
||||||
|
|
||||||
let generic_error s p q =
|
let generic_error s p q =
|
||||||
let { RPC_service.meth ; uri ; _ } =
|
let { RPC_service.meth ; uri ; _ } =
|
||||||
RPC_service.forge_request s ~base p q in
|
RPC_service.forge_partial_request s ~base p q in
|
||||||
fail (Generic_error { meth ; uri })
|
fail (Generic_error { meth ; uri })
|
||||||
|
|
||||||
let of_directory (dir : unit RPC_directory.t) : t = object
|
class ['pr] of_directory (dir : 'pr RPC_directory.t) = object
|
||||||
method call_service : 'm 'p 'q 'i 'o.
|
method call_service : 'm 'p 'q 'i 'o.
|
||||||
([< Resto.meth ] as 'm, unit, 'p, 'q, 'i, 'o) RPC_service.t ->
|
([< Resto.meth ] as 'm, 'pr, 'p, 'q, 'i, 'o) RPC_service.t ->
|
||||||
'p -> 'q -> 'i -> 'o tzresult Lwt.t =
|
'p -> 'q -> 'i -> 'o tzresult Lwt.t =
|
||||||
fun s p q i ->
|
fun s p q i ->
|
||||||
RPC_directory.transparent_lookup dir s p q i >>= function
|
RPC_directory.transparent_lookup dir s p q i >>= function
|
||||||
@ -72,7 +86,7 @@ let of_directory (dir : unit RPC_directory.t) : t = object
|
|||||||
| `Conflict None
|
| `Conflict None
|
||||||
| `No_content -> generic_error s p q
|
| `No_content -> generic_error s p q
|
||||||
method call_streamed_service : 'm 'p 'q 'i 'o.
|
method call_streamed_service : 'm 'p 'q 'i 'o.
|
||||||
([< Resto.meth ] as 'm, unit, 'p, 'q, 'i, 'o) RPC_service.t ->
|
([< Resto.meth ] as 'm, 'pr, 'p, 'q, 'i, 'o) RPC_service.t ->
|
||||||
on_chunk: ('o -> unit) ->
|
on_chunk: ('o -> unit) ->
|
||||||
on_close: (unit -> unit) ->
|
on_close: (unit -> unit) ->
|
||||||
'p -> 'q -> 'i -> (unit -> unit) tzresult Lwt.t =
|
'p -> 'q -> 'i -> (unit -> unit) tzresult Lwt.t =
|
||||||
|
@ -9,28 +9,41 @@
|
|||||||
|
|
||||||
open Error_monad
|
open Error_monad
|
||||||
|
|
||||||
class type simple = object
|
class type ['pr] gen_simple = object
|
||||||
method call_service :
|
method call_service :
|
||||||
'm 'p 'q 'i 'o.
|
'm 'p 'q 'i 'o.
|
||||||
([< Resto.meth ] as 'm, unit, 'p, 'q, 'i, 'o) RPC_service.t ->
|
([< Resto.meth ] as 'm, 'pr, 'p, 'q, 'i, 'o) RPC_service.t ->
|
||||||
'p -> 'q -> 'i -> 'o tzresult Lwt.t
|
'p -> 'q -> 'i -> 'o tzresult Lwt.t
|
||||||
end
|
end
|
||||||
|
|
||||||
class type streamed = object
|
class type ['pr] gen_streamed = object
|
||||||
method call_streamed_service :
|
method call_streamed_service :
|
||||||
'm 'p 'q 'i 'o.
|
'm 'p 'q 'i 'o.
|
||||||
([< Resto.meth ] as 'm, unit, 'p, 'q, 'i, 'o) RPC_service.t ->
|
([< Resto.meth ] as 'm, 'pr, 'p, 'q, 'i, 'o) RPC_service.t ->
|
||||||
on_chunk: ('o -> unit) ->
|
on_chunk: ('o -> unit) ->
|
||||||
on_close: (unit -> unit) ->
|
on_close: (unit -> unit) ->
|
||||||
'p -> 'q -> 'i -> (unit -> unit) tzresult Lwt.t
|
'p -> 'q -> 'i -> (unit -> unit) tzresult Lwt.t
|
||||||
end
|
end
|
||||||
|
|
||||||
|
class type ['pr] gen = object
|
||||||
|
inherit ['pr] gen_simple
|
||||||
|
inherit ['pr] gen_streamed
|
||||||
|
end
|
||||||
|
|
||||||
|
class type simple = object
|
||||||
|
inherit [unit] gen_simple
|
||||||
|
end
|
||||||
|
|
||||||
|
class type streamed = object
|
||||||
|
inherit [unit] gen_streamed
|
||||||
|
end
|
||||||
|
|
||||||
class type t = object
|
class type t = object
|
||||||
inherit simple
|
inherit simple
|
||||||
inherit streamed
|
inherit streamed
|
||||||
end
|
end
|
||||||
|
|
||||||
val of_directory : unit RPC_directory.t -> t
|
class ['pr] of_directory : 'pr RPC_directory.t -> ['pr] gen
|
||||||
|
|
||||||
type error +=
|
type error +=
|
||||||
| Not_found of { meth: RPC_service.meth ;
|
| Not_found of { meth: RPC_service.meth ;
|
||||||
@ -60,3 +73,4 @@ val make_streamed_call :
|
|||||||
([< Resto.meth ], unit, 'p, 'q, 'i, 'o) RPC_service.t ->
|
([< Resto.meth ], unit, 'p, 'q, 'i, 'o) RPC_service.t ->
|
||||||
#streamed -> 'p -> 'q -> 'i ->
|
#streamed -> 'p -> 'q -> 'i ->
|
||||||
('o Lwt_stream.t * stopper) tzresult Lwt.t
|
('o Lwt_stream.t * stopper) tzresult Lwt.t
|
||||||
|
|
||||||
|
@ -23,10 +23,6 @@ type ('o, 'e) rest_result =
|
|||||||
| `Not_found of 'e
|
| `Not_found of 'e
|
||||||
| `Unauthorized of 'e ] tzresult
|
| `Unauthorized of 'e ] tzresult
|
||||||
|
|
||||||
type content_type = (string * string)
|
|
||||||
type raw_content = Cohttp_lwt.Body.t * content_type option
|
|
||||||
type content = Cohttp_lwt.Body.t * content_type option * Media_type.t option
|
|
||||||
|
|
||||||
type rpc_error =
|
type rpc_error =
|
||||||
| Empty_answer
|
| Empty_answer
|
||||||
| Connection_failed of string
|
| Connection_failed of string
|
||||||
@ -222,6 +218,9 @@ let request_failed meth uri error =
|
|||||||
let meth = ( meth : [< RPC_service.meth ] :> RPC_service.meth) in
|
let meth = ( meth : [< RPC_service.meth ] :> RPC_service.meth) in
|
||||||
fail (Request_failed { meth ; uri ; error })
|
fail (Request_failed { meth ; uri ; error })
|
||||||
|
|
||||||
|
type content_type = (string * string)
|
||||||
|
type content = Cohttp_lwt.Body.t * content_type option * Media_type.t option
|
||||||
|
|
||||||
let generic_call ?logger ?accept ?body ?media meth uri : (content, content) rest_result Lwt.t =
|
let generic_call ?logger ?accept ?body ?media meth uri : (content, content) rest_result Lwt.t =
|
||||||
Client.generic_call meth ?logger ?accept ?body ?media uri >>= function
|
Client.generic_call meth ?logger ?accept ?body ?media uri >>= function
|
||||||
| `Ok (Some v) -> return (`Ok v)
|
| `Ok (Some v) -> return (`Ok v)
|
||||||
|
@ -82,10 +82,6 @@ type error +=
|
|||||||
|
|
||||||
(**/**)
|
(**/**)
|
||||||
|
|
||||||
type content_type = (string * string)
|
|
||||||
type raw_content = Cohttp_lwt.Body.t * content_type option
|
|
||||||
type content = Cohttp_lwt.Body.t * content_type option * Media_type.t option
|
|
||||||
|
|
||||||
val call_service :
|
val call_service :
|
||||||
Media_type.t list ->
|
Media_type.t list ->
|
||||||
?logger:logger ->
|
?logger:logger ->
|
||||||
@ -102,6 +98,15 @@ val call_streamed_service :
|
|||||||
on_close: (unit -> unit) ->
|
on_close: (unit -> unit) ->
|
||||||
'p -> 'q -> 'i -> (unit -> unit) tzresult Lwt.t
|
'p -> 'q -> 'i -> (unit -> unit) tzresult Lwt.t
|
||||||
|
|
||||||
|
val generic_json_call :
|
||||||
|
?logger:logger ->
|
||||||
|
?body:Data_encoding.json ->
|
||||||
|
[< RPC_service.meth ] -> Uri.t ->
|
||||||
|
(Data_encoding.json, Data_encoding.json option) rest_result Lwt.t
|
||||||
|
|
||||||
|
type content_type = (string * string)
|
||||||
|
type content = Cohttp_lwt.Body.t * content_type option * Media_type.t option
|
||||||
|
|
||||||
val generic_call :
|
val generic_call :
|
||||||
?logger:logger ->
|
?logger:logger ->
|
||||||
?accept:Media_type.t list ->
|
?accept:Media_type.t list ->
|
||||||
@ -110,8 +115,3 @@ val generic_call :
|
|||||||
[< RPC_service.meth ] ->
|
[< RPC_service.meth ] ->
|
||||||
Uri.t -> (content, content) rest_result Lwt.t
|
Uri.t -> (content, content) rest_result Lwt.t
|
||||||
|
|
||||||
val generic_json_call :
|
|
||||||
?logger:logger ->
|
|
||||||
?body:Data_encoding.json ->
|
|
||||||
[< RPC_service.meth ] -> Uri.t ->
|
|
||||||
(Data_encoding.json, Data_encoding.json option) rest_result Lwt.t
|
|
||||||
|
@ -383,7 +383,7 @@ let build_rpc_directory node =
|
|||||||
RPC_directory.register_dynamic_directory1
|
RPC_directory.register_dynamic_directory1
|
||||||
~descr:
|
~descr:
|
||||||
"All the RPCs which are specific to the protocol version."
|
"All the RPCs which are specific to the protocol version."
|
||||||
dir Block_services.S.proto_path implementation in
|
dir (Block_services.S.proto_path ()) implementation in
|
||||||
let dir =
|
let dir =
|
||||||
RPC_directory.gen_register0 dir Protocol_services.S.list
|
RPC_directory.gen_register0 dir Protocol_services.S.list
|
||||||
(list_protocols node) in
|
(list_protocols node) in
|
||||||
|
@ -132,6 +132,8 @@ module S = struct
|
|||||||
|
|
||||||
let block_path : (unit, unit * block) RPC_path.path =
|
let block_path : (unit, unit * block) RPC_path.path =
|
||||||
RPC_path.(root / "blocks" /: blocks_arg)
|
RPC_path.(root / "blocks" /: blocks_arg)
|
||||||
|
let proto_path () =
|
||||||
|
RPC_path.(open_root / "blocks" /: blocks_arg / "proto")
|
||||||
|
|
||||||
let info =
|
let info =
|
||||||
RPC_service.post_service
|
RPC_service.post_service
|
||||||
@ -279,9 +281,6 @@ module S = struct
|
|||||||
(obj1 (req "unprocessed" (list (dynamic_size operation_encoding))))))
|
(obj1 (req "unprocessed" (list (dynamic_size operation_encoding))))))
|
||||||
RPC_path.(block_path / "pending_operations")
|
RPC_path.(block_path / "pending_operations")
|
||||||
|
|
||||||
let proto_path =
|
|
||||||
RPC_path.(block_path / "proto")
|
|
||||||
|
|
||||||
type preapply_param = {
|
type preapply_param = {
|
||||||
timestamp: Time.t ;
|
timestamp: Time.t ;
|
||||||
proto_header: MBytes.t ;
|
proto_header: MBytes.t ;
|
||||||
|
@ -215,6 +215,6 @@ module S : sig
|
|||||||
(unit * block) * string, unit, unit,
|
(unit * block) * string, unit, unit,
|
||||||
string list) RPC_service.t
|
string list) RPC_service.t
|
||||||
|
|
||||||
val proto_path: (unit, unit * block) RPC_path.path
|
val proto_path: unit -> ('a, 'a * block) RPC_path.path
|
||||||
|
|
||||||
end
|
end
|
||||||
|
@ -21,21 +21,21 @@ type block_info = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
val info:
|
val info:
|
||||||
#RPC_context.simple ->
|
#Proto_alpha.rpc_context ->
|
||||||
?include_ops:bool -> Block_services.block -> block_info tzresult Lwt.t
|
?include_ops:bool -> Block_services.block -> block_info tzresult Lwt.t
|
||||||
|
|
||||||
val compare:
|
val compare:
|
||||||
block_info -> block_info -> int
|
block_info -> block_info -> int
|
||||||
|
|
||||||
val monitor:
|
val monitor:
|
||||||
#RPC_context.t ->
|
#Proto_alpha.rpc_context ->
|
||||||
?include_ops:bool -> ?length:int -> ?heads:Block_hash.t list ->
|
?include_ops:bool -> ?length:int -> ?heads:Block_hash.t list ->
|
||||||
?delay:int -> ?min_date:Time.t -> ?min_heads:int ->
|
?delay:int -> ?min_date:Time.t -> ?min_heads:int ->
|
||||||
?compare:(block_info -> block_info -> int) ->
|
?compare:(block_info -> block_info -> int) ->
|
||||||
unit -> block_info list tzresult Lwt_stream.t tzresult Lwt.t
|
unit -> block_info list tzresult Lwt_stream.t tzresult Lwt.t
|
||||||
|
|
||||||
val blocks_from_cycle:
|
val blocks_from_cycle:
|
||||||
#RPC_context.simple ->
|
#Proto_alpha.rpc_context ->
|
||||||
Block_services.block ->
|
Block_services.block ->
|
||||||
Cycle.t ->
|
Cycle.t ->
|
||||||
Block_hash.t list tzresult Lwt.t
|
Block_hash.t list tzresult Lwt.t
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
(* *)
|
(* *)
|
||||||
(**************************************************************************)
|
(**************************************************************************)
|
||||||
|
|
||||||
let run (cctxt : #Client_commands.full_context) ?max_priority ~delay ?min_date delegates ~endorsement ~denunciation ~baking =
|
let run (cctxt : #Proto_alpha.full_context) ?max_priority ~delay ?min_date delegates ~endorsement ~denunciation ~baking =
|
||||||
(* TODO really detach... *)
|
(* TODO really detach... *)
|
||||||
let endorsement =
|
let endorsement =
|
||||||
if endorsement then
|
if endorsement then
|
||||||
|
@ -11,7 +11,7 @@ open Proto_alpha
|
|||||||
open Alpha_context
|
open Alpha_context
|
||||||
|
|
||||||
val run:
|
val run:
|
||||||
#Client_commands.full_context ->
|
#Proto_alpha.full_context ->
|
||||||
?max_priority: int ->
|
?max_priority: int ->
|
||||||
delay: int ->
|
delay: int ->
|
||||||
?min_date: Time.t ->
|
?min_date: Time.t ->
|
||||||
|
@ -8,6 +8,6 @@
|
|||||||
(**************************************************************************)
|
(**************************************************************************)
|
||||||
|
|
||||||
val create:
|
val create:
|
||||||
#Client_commands.full_context ->
|
#Proto_alpha.full_context ->
|
||||||
Client_baking_operations.valid_endorsement tzresult Lwt_stream.t ->
|
Client_baking_operations.valid_endorsement tzresult Lwt_stream.t ->
|
||||||
unit Lwt.t
|
unit Lwt.t
|
||||||
|
@ -91,7 +91,7 @@ let get_signing_slots cctxt ?max_priority block delegate level =
|
|||||||
@@ List.filter (fun (l, _) -> l = level) possibilities in
|
@@ List.filter (fun (l, _) -> l = level) possibilities in
|
||||||
return slots
|
return slots
|
||||||
|
|
||||||
let inject_endorsement (cctxt : #Client_commands.full_context)
|
let inject_endorsement (cctxt : #Proto_alpha.full_context)
|
||||||
block level ?async
|
block level ?async
|
||||||
src_sk source slot =
|
src_sk source slot =
|
||||||
let block = Block_services.last_baked_block block in
|
let block = Block_services.last_baked_block block in
|
||||||
@ -123,7 +123,7 @@ let check_endorsement cctxt level slot =
|
|||||||
Block_hash.pp_short block Raw_level.pp level slot
|
Block_hash.pp_short block Raw_level.pp level slot
|
||||||
|
|
||||||
|
|
||||||
let forge_endorsement (cctxt : #Client_commands.full_context)
|
let forge_endorsement (cctxt : #Proto_alpha.full_context)
|
||||||
block
|
block
|
||||||
~src_sk ?slot ?max_priority src_pk =
|
~src_sk ?slot ?max_priority src_pk =
|
||||||
let block = Block_services.last_baked_block block in
|
let block = Block_services.last_baked_block block in
|
||||||
@ -186,7 +186,7 @@ let drop_old_endorsement ~before state =
|
|||||||
(fun { block } -> Fitness.compare before block.fitness <= 0)
|
(fun { block } -> Fitness.compare before block.fitness <= 0)
|
||||||
state.to_endorse
|
state.to_endorse
|
||||||
|
|
||||||
let schedule_endorsements (cctxt : #Client_commands.full_context) state bis =
|
let schedule_endorsements (cctxt : #Proto_alpha.full_context) state bis =
|
||||||
let may_endorse (block: Client_baking_blocks.block_info) delegate time =
|
let may_endorse (block: Client_baking_blocks.block_info) delegate time =
|
||||||
Client_keys.Public_key_hash.name cctxt delegate >>=? fun name ->
|
Client_keys.Public_key_hash.name cctxt delegate >>=? fun name ->
|
||||||
lwt_log_info "May endorse block %a for %s"
|
lwt_log_info "May endorse block %a for %s"
|
||||||
@ -256,7 +256,7 @@ let schedule_endorsements (cctxt : #Client_commands.full_context) state bis =
|
|||||||
bis)
|
bis)
|
||||||
delegates
|
delegates
|
||||||
|
|
||||||
let schedule_endorsements (cctxt : #Client_commands.full_context) state bis =
|
let schedule_endorsements (cctxt : #Proto_alpha.full_context) state bis =
|
||||||
schedule_endorsements cctxt state bis >>= function
|
schedule_endorsements cctxt state bis >>= function
|
||||||
| Error exns ->
|
| Error exns ->
|
||||||
lwt_log_error
|
lwt_log_error
|
||||||
@ -311,7 +311,7 @@ let compute_timeout state =
|
|||||||
else
|
else
|
||||||
Lwt_unix.sleep (Int64.to_float delay)
|
Lwt_unix.sleep (Int64.to_float delay)
|
||||||
|
|
||||||
let create (cctxt : #Client_commands.full_context) ~delay contracts block_stream =
|
let create (cctxt : #Proto_alpha.full_context) ~delay contracts block_stream =
|
||||||
lwt_log_info "Starting endorsement daemon" >>= fun () ->
|
lwt_log_info "Starting endorsement daemon" >>= fun () ->
|
||||||
Lwt_stream.get block_stream >>= function
|
Lwt_stream.get block_stream >>= function
|
||||||
| None | Some (Ok []) | Some (Error _) ->
|
| None | Some (Ok []) | Some (Error _) ->
|
||||||
|
@ -11,7 +11,7 @@ open Proto_alpha
|
|||||||
open Alpha_context
|
open Alpha_context
|
||||||
|
|
||||||
val forge_endorsement:
|
val forge_endorsement:
|
||||||
#Client_commands.full_context ->
|
#Proto_alpha.full_context ->
|
||||||
Block_services.block ->
|
Block_services.block ->
|
||||||
src_sk:Client_keys.sk_locator ->
|
src_sk:Client_keys.sk_locator ->
|
||||||
?slot:int ->
|
?slot:int ->
|
||||||
@ -20,7 +20,7 @@ val forge_endorsement:
|
|||||||
Operation_hash.t tzresult Lwt.t
|
Operation_hash.t tzresult Lwt.t
|
||||||
|
|
||||||
val create :
|
val create :
|
||||||
#Client_commands.full_context ->
|
#Proto_alpha.full_context ->
|
||||||
delay:int ->
|
delay:int ->
|
||||||
public_key_hash list ->
|
public_key_hash list ->
|
||||||
Client_baking_blocks.block_info list tzresult Lwt_stream.t -> unit Lwt.t
|
Client_baking_blocks.block_info list tzresult Lwt_stream.t -> unit Lwt.t
|
||||||
|
@ -368,7 +368,7 @@ let compute_timeout { future_slots } =
|
|||||||
else
|
else
|
||||||
Lwt_unix.sleep (Int64.to_float delay)
|
Lwt_unix.sleep (Int64.to_float delay)
|
||||||
|
|
||||||
let get_unrevealed_nonces (cctxt : #Client_commands.full_context) ?(force = false) block =
|
let get_unrevealed_nonces (cctxt : #Proto_alpha.full_context) ?(force = false) block =
|
||||||
Client_proto_rpcs.Context.next_level cctxt block >>=? fun level ->
|
Client_proto_rpcs.Context.next_level cctxt block >>=? fun level ->
|
||||||
let cur_cycle = level.cycle in
|
let cur_cycle = level.cycle in
|
||||||
match Cycle.pred cur_cycle with
|
match Cycle.pred cur_cycle with
|
||||||
@ -416,7 +416,7 @@ let get_delegates cctxt state =
|
|||||||
| _ :: _ as delegates -> return delegates
|
| _ :: _ as delegates -> return delegates
|
||||||
|
|
||||||
let insert_block
|
let insert_block
|
||||||
(cctxt : #Client_commands.full_context) ?max_priority state (bi: Client_baking_blocks.block_info) =
|
(cctxt : #Proto_alpha.full_context) ?max_priority state (bi: Client_baking_blocks.block_info) =
|
||||||
begin
|
begin
|
||||||
safe_get_unrevealed_nonces cctxt (`Hash bi.hash) >>= fun nonces ->
|
safe_get_unrevealed_nonces cctxt (`Hash bi.hash) >>= fun nonces ->
|
||||||
Client_baking_revelation.forge_seed_nonce_revelation
|
Client_baking_revelation.forge_seed_nonce_revelation
|
||||||
@ -461,7 +461,7 @@ let insert_blocks cctxt ?max_priority state bis =
|
|||||||
Format.eprintf "Error: %a" pp_print_error err ;
|
Format.eprintf "Error: %a" pp_print_error err ;
|
||||||
Lwt.return_unit
|
Lwt.return_unit
|
||||||
|
|
||||||
let bake (cctxt : #Client_commands.full_context) state =
|
let bake (cctxt : #Proto_alpha.full_context) state =
|
||||||
let slots = pop_baking_slots state in
|
let slots = pop_baking_slots state in
|
||||||
let seed_nonce = generate_seed_nonce () in
|
let seed_nonce = generate_seed_nonce () in
|
||||||
let seed_nonce_hash = Nonce.hash seed_nonce in
|
let seed_nonce_hash = Nonce.hash seed_nonce in
|
||||||
@ -550,7 +550,7 @@ let bake (cctxt : #Client_commands.full_context) state =
|
|||||||
return ()
|
return ()
|
||||||
|
|
||||||
let create
|
let create
|
||||||
(cctxt : #Client_commands.full_context) ?max_priority delegates
|
(cctxt : #Proto_alpha.full_context) ?max_priority delegates
|
||||||
(block_stream:
|
(block_stream:
|
||||||
Client_baking_blocks.block_info list tzresult Lwt_stream.t)
|
Client_baking_blocks.block_info list tzresult Lwt_stream.t)
|
||||||
(endorsement_stream:
|
(endorsement_stream:
|
||||||
|
@ -17,7 +17,7 @@ val generate_seed_nonce: unit -> Nonce.t
|
|||||||
reveal the aforementionned nonce during the next cycle. *)
|
reveal the aforementionned nonce during the next cycle. *)
|
||||||
|
|
||||||
val inject_block:
|
val inject_block:
|
||||||
#RPC_context.simple ->
|
#Proto_alpha.rpc_context ->
|
||||||
?force:bool ->
|
?force:bool ->
|
||||||
?net_id:Net_id.t ->
|
?net_id:Net_id.t ->
|
||||||
shell_header:Block_header.shell_header ->
|
shell_header:Block_header.shell_header ->
|
||||||
@ -36,7 +36,7 @@ type error +=
|
|||||||
| Failed_to_preapply of Tezos_base.Operation.t * error list
|
| Failed_to_preapply of Tezos_base.Operation.t * error list
|
||||||
|
|
||||||
val forge_block:
|
val forge_block:
|
||||||
#RPC_context.simple ->
|
#Proto_alpha.rpc_context ->
|
||||||
Block_services.block ->
|
Block_services.block ->
|
||||||
?force:bool ->
|
?force:bool ->
|
||||||
?operations:Operation.raw list ->
|
?operations:Operation.raw list ->
|
||||||
@ -68,15 +68,15 @@ val forge_block:
|
|||||||
|
|
||||||
module State : sig
|
module State : sig
|
||||||
val get_block:
|
val get_block:
|
||||||
#Client_commands.full_context ->
|
#Proto_alpha.full_context ->
|
||||||
Raw_level.t -> Block_hash.t list tzresult Lwt.t
|
Raw_level.t -> Block_hash.t list tzresult Lwt.t
|
||||||
val record_block:
|
val record_block:
|
||||||
#Client_commands.full_context ->
|
#Proto_alpha.full_context ->
|
||||||
Raw_level.t -> Block_hash.t -> Nonce.t -> unit tzresult Lwt.t
|
Raw_level.t -> Block_hash.t -> Nonce.t -> unit tzresult Lwt.t
|
||||||
end
|
end
|
||||||
|
|
||||||
val create:
|
val create:
|
||||||
#Client_commands.full_context ->
|
#Proto_alpha.full_context ->
|
||||||
?max_priority: int ->
|
?max_priority: int ->
|
||||||
public_key_hash list ->
|
public_key_hash list ->
|
||||||
Client_baking_blocks.block_info list tzresult Lwt_stream.t ->
|
Client_baking_blocks.block_info list tzresult Lwt_stream.t ->
|
||||||
@ -84,7 +84,7 @@ val create:
|
|||||||
unit tzresult Lwt.t
|
unit tzresult Lwt.t
|
||||||
|
|
||||||
val get_unrevealed_nonces:
|
val get_unrevealed_nonces:
|
||||||
#Client_commands.full_context ->
|
#Proto_alpha.full_context ->
|
||||||
?force:bool ->
|
?force:bool ->
|
||||||
Block_services.block ->
|
Block_services.block ->
|
||||||
(Block_hash.t * (Raw_level.t * Nonce.t)) list tzresult Lwt.t
|
(Block_hash.t * (Raw_level.t * Nonce.t)) list tzresult Lwt.t
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
open Proto_alpha
|
open Proto_alpha
|
||||||
open Alpha_context
|
open Alpha_context
|
||||||
|
|
||||||
let bake_block (cctxt : #Client_commands.full_context) block
|
let bake_block (cctxt : #Proto_alpha.full_context) block
|
||||||
?force ?max_priority ?(free_baking=false) ?src_sk delegate =
|
?force ?max_priority ?(free_baking=false) ?src_sk delegate =
|
||||||
begin
|
begin
|
||||||
match src_sk with
|
match src_sk with
|
||||||
@ -59,7 +59,7 @@ let do_reveal cctxt block blocks =
|
|||||||
Client_proto_nonces.dels cctxt (List.map fst blocks) >>=? fun () ->
|
Client_proto_nonces.dels cctxt (List.map fst blocks) >>=? fun () ->
|
||||||
return ()
|
return ()
|
||||||
|
|
||||||
let reveal_block_nonces (cctxt : #Client_commands.full_context) block_hashes =
|
let reveal_block_nonces (cctxt : #Proto_alpha.full_context) block_hashes =
|
||||||
Lwt_list.filter_map_p
|
Lwt_list.filter_map_p
|
||||||
(fun hash ->
|
(fun hash ->
|
||||||
Lwt.catch
|
Lwt.catch
|
||||||
|
@ -12,7 +12,7 @@ open Alpha_context
|
|||||||
|
|
||||||
(** Mine a block *)
|
(** Mine a block *)
|
||||||
val bake_block:
|
val bake_block:
|
||||||
#Client_commands.full_context ->
|
#Proto_alpha.full_context ->
|
||||||
Block_services.block ->
|
Block_services.block ->
|
||||||
?force:bool ->
|
?force:bool ->
|
||||||
?max_priority: int ->
|
?max_priority: int ->
|
||||||
@ -23,32 +23,32 @@ val bake_block:
|
|||||||
|
|
||||||
(** Endorse a block *)
|
(** Endorse a block *)
|
||||||
val endorse_block:
|
val endorse_block:
|
||||||
#Client_commands.full_context ->
|
#Proto_alpha.full_context ->
|
||||||
?max_priority:int ->
|
?max_priority:int ->
|
||||||
Client_keys.Public_key_hash.t ->
|
Client_keys.Public_key_hash.t ->
|
||||||
unit Error_monad.tzresult Lwt.t
|
unit Error_monad.tzresult Lwt.t
|
||||||
|
|
||||||
(** Get the previous cycle of the given cycle *)
|
(** Get the previous cycle of the given cycle *)
|
||||||
val get_predecessor_cycle:
|
val get_predecessor_cycle:
|
||||||
#Client_commands.full_context ->
|
#Proto_alpha.full_context ->
|
||||||
Cycle.t ->
|
Cycle.t ->
|
||||||
Cycle.t Lwt.t
|
Cycle.t Lwt.t
|
||||||
|
|
||||||
(** Reveal the nonces used to bake each block in the given list *)
|
(** Reveal the nonces used to bake each block in the given list *)
|
||||||
val reveal_block_nonces :
|
val reveal_block_nonces :
|
||||||
#Client_commands.full_context ->
|
#Proto_alpha.full_context ->
|
||||||
Block_hash.t list ->
|
Block_hash.t list ->
|
||||||
unit Error_monad.tzresult Lwt.t
|
unit Error_monad.tzresult Lwt.t
|
||||||
|
|
||||||
(** Reveal all unrevealed nonces *)
|
(** Reveal all unrevealed nonces *)
|
||||||
val reveal_nonces :
|
val reveal_nonces :
|
||||||
#Client_commands.full_context ->
|
#Proto_alpha.full_context ->
|
||||||
unit ->
|
unit ->
|
||||||
unit Error_monad.tzresult Lwt.t
|
unit Error_monad.tzresult Lwt.t
|
||||||
|
|
||||||
(** Initialize the baking daemon *)
|
(** Initialize the baking daemon *)
|
||||||
val run_daemon:
|
val run_daemon:
|
||||||
#Client_commands.full_context ->
|
#Proto_alpha.full_context ->
|
||||||
?max_priority:int ->
|
?max_priority:int ->
|
||||||
endorsement_delay:int ->
|
endorsement_delay:int ->
|
||||||
('a * public_key_hash) list ->
|
('a * public_key_hash) list ->
|
||||||
|
@ -7,4 +7,4 @@
|
|||||||
(* *)
|
(* *)
|
||||||
(**************************************************************************)
|
(**************************************************************************)
|
||||||
|
|
||||||
val commands: unit -> Client_commands.command list
|
val commands: unit -> (Proto_alpha.full_context, unit) Cli_entries.command list
|
||||||
|
@ -16,7 +16,7 @@ type operation = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
val monitor:
|
val monitor:
|
||||||
#RPC_context.t ->
|
#Proto_alpha.rpc_context ->
|
||||||
?contents:bool -> ?check:bool -> unit ->
|
?contents:bool -> ?check:bool -> unit ->
|
||||||
operation list tzresult Lwt_stream.t tzresult Lwt.t
|
operation list tzresult Lwt_stream.t tzresult Lwt.t
|
||||||
|
|
||||||
@ -28,6 +28,6 @@ type valid_endorsement = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
val monitor_endorsement:
|
val monitor_endorsement:
|
||||||
#RPC_context.t ->
|
#Proto_alpha.rpc_context ->
|
||||||
valid_endorsement tzresult Lwt_stream.t tzresult Lwt.t
|
valid_endorsement tzresult Lwt_stream.t tzresult Lwt.t
|
||||||
|
|
||||||
|
@ -25,7 +25,7 @@ let inject_seed_nonce_revelation rpc_config block ?async nonces =
|
|||||||
return oph
|
return oph
|
||||||
|
|
||||||
let forge_seed_nonce_revelation
|
let forge_seed_nonce_revelation
|
||||||
(cctxt: #Client_commands.full_context)
|
(cctxt: #Proto_alpha.full_context)
|
||||||
block nonces =
|
block nonces =
|
||||||
Block_services.hash cctxt block >>=? fun hash ->
|
Block_services.hash cctxt block >>=? fun hash ->
|
||||||
match nonces with
|
match nonces with
|
||||||
|
@ -11,14 +11,14 @@ open Proto_alpha
|
|||||||
open Alpha_context
|
open Alpha_context
|
||||||
|
|
||||||
val inject_seed_nonce_revelation:
|
val inject_seed_nonce_revelation:
|
||||||
#RPC_context.simple ->
|
#Proto_alpha.rpc_context ->
|
||||||
Block_services.block ->
|
Block_services.block ->
|
||||||
?async:bool ->
|
?async:bool ->
|
||||||
(Raw_level.t * Nonce.t) list ->
|
(Raw_level.t * Nonce.t) list ->
|
||||||
Operation_hash.t tzresult Lwt.t
|
Operation_hash.t tzresult Lwt.t
|
||||||
|
|
||||||
val forge_seed_nonce_revelation:
|
val forge_seed_nonce_revelation:
|
||||||
#Client_commands.full_context ->
|
#Proto_alpha.full_context ->
|
||||||
Block_services.block ->
|
Block_services.block ->
|
||||||
(Raw_level.t * Nonce.t) list ->
|
(Raw_level.t * Nonce.t) list ->
|
||||||
unit tzresult Lwt.t
|
unit tzresult Lwt.t
|
||||||
|
@ -12,36 +12,36 @@ open Alpha_context
|
|||||||
|
|
||||||
val tez_sym: string
|
val tez_sym: string
|
||||||
|
|
||||||
val init_arg: (string, Client_commands.full_context) Cli_entries.arg
|
val init_arg: (string, Proto_alpha.full_context) Cli_entries.arg
|
||||||
val fee_arg: (Tez.t, Client_commands.full_context) Cli_entries.arg
|
val fee_arg: (Tez.t, Proto_alpha.full_context) Cli_entries.arg
|
||||||
val arg_arg: (string, Client_commands.full_context) Cli_entries.arg
|
val arg_arg: (string, Proto_alpha.full_context) Cli_entries.arg
|
||||||
val source_arg: (string option, Client_commands.full_context) Cli_entries.arg
|
val source_arg: (string option, Proto_alpha.full_context) Cli_entries.arg
|
||||||
|
|
||||||
val delegate_arg: (string option, Client_commands.full_context) Cli_entries.arg
|
val delegate_arg: (string option, Proto_alpha.full_context) Cli_entries.arg
|
||||||
val delegatable_switch: (bool, Client_commands.full_context) Cli_entries.arg
|
val delegatable_switch: (bool, Proto_alpha.full_context) Cli_entries.arg
|
||||||
val spendable_switch: (bool, Client_commands.full_context) Cli_entries.arg
|
val spendable_switch: (bool, Proto_alpha.full_context) Cli_entries.arg
|
||||||
val max_priority_arg: (int option, Client_commands.full_context) Cli_entries.arg
|
val max_priority_arg: (int option, Proto_alpha.full_context) Cli_entries.arg
|
||||||
val free_baking_switch: (bool, Client_commands.full_context) Cli_entries.arg
|
val free_baking_switch: (bool, Proto_alpha.full_context) Cli_entries.arg
|
||||||
val force_switch: (bool, Client_commands.full_context) Cli_entries.arg
|
val force_switch: (bool, Proto_alpha.full_context) Cli_entries.arg
|
||||||
val endorsement_delay_arg: (int, Client_commands.full_context) Cli_entries.arg
|
val endorsement_delay_arg: (int, Proto_alpha.full_context) Cli_entries.arg
|
||||||
|
|
||||||
val no_print_source_flag : (bool, Client_commands.full_context) Cli_entries.arg
|
val no_print_source_flag : (bool, Proto_alpha.full_context) Cli_entries.arg
|
||||||
|
|
||||||
val tez_arg :
|
val tez_arg :
|
||||||
default:string ->
|
default:string ->
|
||||||
parameter:string ->
|
parameter:string ->
|
||||||
doc:string ->
|
doc:string ->
|
||||||
(Tez.t, Client_commands.full_context) Cli_entries.arg
|
(Tez.t, Proto_alpha.full_context) Cli_entries.arg
|
||||||
val tez_param :
|
val tez_param :
|
||||||
name:string ->
|
name:string ->
|
||||||
desc:string ->
|
desc:string ->
|
||||||
('a, Client_commands.full_context, 'ret) Cli_entries.params ->
|
('a, full_context, 'ret) Cli_entries.params ->
|
||||||
(Tez.t -> 'a, Client_commands.full_context, 'ret) Cli_entries.params
|
(Tez.t -> 'a, full_context, 'ret) Cli_entries.params
|
||||||
|
|
||||||
module Daemon : sig
|
module Daemon : sig
|
||||||
val baking_switch: (bool, Client_commands.full_context) Cli_entries.arg
|
val baking_switch: (bool, Proto_alpha.full_context) Cli_entries.arg
|
||||||
val endorsement_switch: (bool, Client_commands.full_context) Cli_entries.arg
|
val endorsement_switch: (bool, Proto_alpha.full_context) Cli_entries.arg
|
||||||
val denunciation_switch: (bool, Client_commands.full_context) Cli_entries.arg
|
val denunciation_switch: (bool, Proto_alpha.full_context) Cli_entries.arg
|
||||||
end
|
end
|
||||||
|
|
||||||
val string_parameter : (string, Client_commands.full_context) Cli_entries.parameter
|
val string_parameter : (string, full_context) Cli_entries.parameter
|
||||||
|
@ -13,10 +13,10 @@ open Tezos_micheline
|
|||||||
open Client_proto_contracts
|
open Client_proto_contracts
|
||||||
open Client_keys
|
open Client_keys
|
||||||
|
|
||||||
let get_balance (rpc : #RPC_context.simple) block contract =
|
let get_balance (rpc : #Proto_alpha.rpc_context) block contract =
|
||||||
Client_proto_rpcs.Context.Contract.balance rpc block contract
|
Client_proto_rpcs.Context.Contract.balance rpc block contract
|
||||||
|
|
||||||
let get_storage (rpc : #RPC_context.simple) block contract =
|
let get_storage (rpc : #Proto_alpha.rpc_context) block contract =
|
||||||
Client_proto_rpcs.Context.Contract.storage rpc block contract
|
Client_proto_rpcs.Context.Contract.storage rpc block contract
|
||||||
|
|
||||||
let rec find_predecessor rpc_config h n =
|
let rec find_predecessor rpc_config h n =
|
||||||
@ -195,7 +195,7 @@ let set_delegate (cctxt : #RPC_context.simple) block ~fee contract ~src_pk ~mana
|
|||||||
cctxt block ~source:contract
|
cctxt block ~source:contract
|
||||||
~src_pk ~manager_sk ~fee opt_delegate
|
~src_pk ~manager_sk ~fee opt_delegate
|
||||||
|
|
||||||
let source_to_keys (wallet : #Client_commands.full_context) block source =
|
let source_to_keys (wallet : #Proto_alpha.full_context) block source =
|
||||||
get_manager wallet block source >>=? fun (_src_name, _src_pkh, src_pk, src_sk) ->
|
get_manager wallet block source >>=? fun (_src_name, _src_pkh, src_pk, src_sk) ->
|
||||||
return (src_pk, src_sk)
|
return (src_pk, src_sk)
|
||||||
|
|
||||||
@ -216,7 +216,7 @@ let originate_contract
|
|||||||
~src_pk
|
~src_pk
|
||||||
~src_sk
|
~src_sk
|
||||||
~code
|
~code
|
||||||
(cctxt : #Client_commands.full_context) =
|
(cctxt : #Proto_alpha.full_context) =
|
||||||
Lwt.return (Michelson_v1_parser.parse_expression initial_storage) >>= fun result ->
|
Lwt.return (Michelson_v1_parser.parse_expression initial_storage) >>= fun result ->
|
||||||
Lwt.return (Micheline_parser.no_parsing_error result) >>=?
|
Lwt.return (Micheline_parser.no_parsing_error result) >>=?
|
||||||
fun { Michelson_v1_parser.expanded = storage } ->
|
fun { Michelson_v1_parser.expanded = storage } ->
|
||||||
|
@ -11,31 +11,31 @@ open Proto_alpha
|
|||||||
open Alpha_context
|
open Alpha_context
|
||||||
|
|
||||||
val list_contract_labels :
|
val list_contract_labels :
|
||||||
#Client_commands.full_context ->
|
#Proto_alpha.full_context ->
|
||||||
Block_services.block ->
|
Block_services.block ->
|
||||||
(string * string * string) list tzresult Lwt.t
|
(string * string * string) list tzresult Lwt.t
|
||||||
|
|
||||||
val get_storage :
|
val get_storage :
|
||||||
#RPC_context.simple ->
|
#Proto_alpha.rpc_context ->
|
||||||
Block_services.block ->
|
Block_services.block ->
|
||||||
Contract.t ->
|
Contract.t ->
|
||||||
Script.expr option tzresult Lwt.t
|
Script.expr option tzresult Lwt.t
|
||||||
|
|
||||||
val get_manager :
|
val get_manager :
|
||||||
#Client_commands.full_context ->
|
#Proto_alpha.full_context ->
|
||||||
Block_services.block ->
|
Block_services.block ->
|
||||||
Contract.t ->
|
Contract.t ->
|
||||||
(string * public_key_hash *
|
(string * public_key_hash *
|
||||||
public_key * Client_keys.sk_locator) tzresult Lwt.t
|
public_key * Client_keys.sk_locator) tzresult Lwt.t
|
||||||
|
|
||||||
val get_balance:
|
val get_balance:
|
||||||
#RPC_context.simple ->
|
#Proto_alpha.rpc_context ->
|
||||||
Block_services.block ->
|
Block_services.block ->
|
||||||
Contract.t ->
|
Contract.t ->
|
||||||
Tez.t tzresult Lwt.t
|
Tez.t tzresult Lwt.t
|
||||||
|
|
||||||
val set_delegate :
|
val set_delegate :
|
||||||
#RPC_context.simple ->
|
#Proto_alpha.rpc_context ->
|
||||||
Block_services.block ->
|
Block_services.block ->
|
||||||
fee:Tez.tez ->
|
fee:Tez.tez ->
|
||||||
Contract.t ->
|
Contract.t ->
|
||||||
@ -50,7 +50,7 @@ val operation_submitted_message :
|
|||||||
unit tzresult Lwt.t
|
unit tzresult Lwt.t
|
||||||
|
|
||||||
val source_to_keys:
|
val source_to_keys:
|
||||||
#Client_commands.full_context ->
|
#Proto_alpha.full_context ->
|
||||||
Block_services.block ->
|
Block_services.block ->
|
||||||
Contract.t ->
|
Contract.t ->
|
||||||
(public_key * Client_keys.sk_locator) tzresult Lwt.t
|
(public_key * Client_keys.sk_locator) tzresult Lwt.t
|
||||||
@ -66,12 +66,12 @@ val originate_account :
|
|||||||
balance:Tez.tez ->
|
balance:Tez.tez ->
|
||||||
fee:Tez.tez ->
|
fee:Tez.tez ->
|
||||||
Block_services.block ->
|
Block_services.block ->
|
||||||
#RPC_context.simple ->
|
#Proto_alpha.rpc_context ->
|
||||||
unit -> (Operation_list_hash.elt * Contract.t) tzresult Lwt.t
|
unit -> (Operation_list_hash.elt * Contract.t) tzresult Lwt.t
|
||||||
|
|
||||||
val save_contract :
|
val save_contract :
|
||||||
force:bool ->
|
force:bool ->
|
||||||
#Client_commands.full_context ->
|
#Proto_alpha.full_context ->
|
||||||
string ->
|
string ->
|
||||||
Contract.t ->
|
Contract.t ->
|
||||||
unit tzresult Lwt.t
|
unit tzresult Lwt.t
|
||||||
@ -94,18 +94,18 @@ val originate_contract:
|
|||||||
src_pk:public_key ->
|
src_pk:public_key ->
|
||||||
src_sk:Client_keys.sk_locator ->
|
src_sk:Client_keys.sk_locator ->
|
||||||
code:Script.expr ->
|
code:Script.expr ->
|
||||||
#Client_commands.full_context ->
|
#Proto_alpha.full_context ->
|
||||||
(Operation_hash.t * Contract.t) tzresult Lwt.t
|
(Operation_hash.t * Contract.t) tzresult Lwt.t
|
||||||
|
|
||||||
val faucet :
|
val faucet :
|
||||||
?branch:int ->
|
?branch:int ->
|
||||||
manager_pkh:public_key_hash ->
|
manager_pkh:public_key_hash ->
|
||||||
Block_services.block ->
|
Block_services.block ->
|
||||||
#RPC_context.simple ->
|
#Proto_alpha.rpc_context ->
|
||||||
unit -> (Operation_list_hash.elt * Contract.t) tzresult Lwt.t
|
unit -> (Operation_list_hash.elt * Contract.t) tzresult Lwt.t
|
||||||
|
|
||||||
val transfer :
|
val transfer :
|
||||||
#RPC_context.simple ->
|
#Proto_alpha.rpc_context ->
|
||||||
Block_services.block ->
|
Block_services.block ->
|
||||||
?branch:int ->
|
?branch:int ->
|
||||||
source:Contract.t ->
|
source:Contract.t ->
|
||||||
@ -119,7 +119,7 @@ val transfer :
|
|||||||
(Operation_hash.t * Contract.t list) tzresult Lwt.t
|
(Operation_hash.t * Contract.t list) tzresult Lwt.t
|
||||||
|
|
||||||
val dictate :
|
val dictate :
|
||||||
#RPC_context.simple ->
|
#Proto_alpha.rpc_context ->
|
||||||
Block_services.block ->
|
Block_services.block ->
|
||||||
dictator_operation ->
|
dictator_operation ->
|
||||||
secret_key ->
|
secret_key ->
|
||||||
|
@ -47,7 +47,7 @@ let commands () =
|
|||||||
command ~group ~desc: "Access the timestamp of the block."
|
command ~group ~desc: "Access the timestamp of the block."
|
||||||
no_options
|
no_options
|
||||||
(fixed [ "get" ; "timestamp" ])
|
(fixed [ "get" ; "timestamp" ])
|
||||||
begin fun () (cctxt : Client_commands.full_context) ->
|
begin fun () (cctxt : Proto_alpha.full_context) ->
|
||||||
Block_services.timestamp
|
Block_services.timestamp
|
||||||
cctxt cctxt#block >>=? fun v ->
|
cctxt cctxt#block >>=? fun v ->
|
||||||
cctxt#message "%s" (Time.to_notation v) >>= fun () ->
|
cctxt#message "%s" (Time.to_notation v) >>= fun () ->
|
||||||
@ -57,7 +57,7 @@ let commands () =
|
|||||||
command ~group ~desc: "Lists all non empty contracts of the block."
|
command ~group ~desc: "Lists all non empty contracts of the block."
|
||||||
no_options
|
no_options
|
||||||
(fixed [ "list" ; "contracts" ])
|
(fixed [ "list" ; "contracts" ])
|
||||||
begin fun () (cctxt : Client_commands.full_context) ->
|
begin fun () (cctxt : Proto_alpha.full_context) ->
|
||||||
list_contract_labels cctxt cctxt#block >>=? fun contracts ->
|
list_contract_labels cctxt cctxt#block >>=? fun contracts ->
|
||||||
Lwt_list.iter_s
|
Lwt_list.iter_s
|
||||||
(fun (alias, hash, kind) -> cctxt#message "%s%s%s" hash kind alias)
|
(fun (alias, hash, kind) -> cctxt#message "%s%s%s" hash kind alias)
|
||||||
@ -70,7 +70,7 @@ let commands () =
|
|||||||
(prefixes [ "get" ; "balance" ; "for" ]
|
(prefixes [ "get" ; "balance" ; "for" ]
|
||||||
@@ ContractAlias.destination_param ~name:"src" ~desc:"source contract"
|
@@ ContractAlias.destination_param ~name:"src" ~desc:"source contract"
|
||||||
@@ stop)
|
@@ stop)
|
||||||
begin fun () (_, contract) (cctxt : Client_commands.full_context) ->
|
begin fun () (_, contract) (cctxt : Proto_alpha.full_context) ->
|
||||||
get_balance cctxt cctxt#block contract >>=? fun amount ->
|
get_balance cctxt cctxt#block contract >>=? fun amount ->
|
||||||
cctxt#answer "%a %s" Tez.pp amount Client_proto_args.tez_sym >>= fun () ->
|
cctxt#answer "%a %s" Tez.pp amount Client_proto_args.tez_sym >>= fun () ->
|
||||||
return ()
|
return ()
|
||||||
@ -81,7 +81,7 @@ let commands () =
|
|||||||
(prefixes [ "get" ; "storage" ; "for" ]
|
(prefixes [ "get" ; "storage" ; "for" ]
|
||||||
@@ ContractAlias.destination_param ~name:"src" ~desc:"source contract"
|
@@ ContractAlias.destination_param ~name:"src" ~desc:"source contract"
|
||||||
@@ stop)
|
@@ stop)
|
||||||
begin fun () (_, contract) (cctxt : Client_commands.full_context) ->
|
begin fun () (_, contract) (cctxt : Proto_alpha.full_context) ->
|
||||||
get_storage cctxt cctxt#block contract >>=? function
|
get_storage cctxt cctxt#block contract >>=? function
|
||||||
| None ->
|
| None ->
|
||||||
cctxt#error "This is not a smart contract."
|
cctxt#error "This is not a smart contract."
|
||||||
@ -95,7 +95,7 @@ let commands () =
|
|||||||
(prefixes [ "get" ; "manager" ; "for" ]
|
(prefixes [ "get" ; "manager" ; "for" ]
|
||||||
@@ ContractAlias.destination_param ~name:"src" ~desc:"source contract"
|
@@ ContractAlias.destination_param ~name:"src" ~desc:"source contract"
|
||||||
@@ stop)
|
@@ stop)
|
||||||
begin fun () (_, contract) (cctxt : Client_commands.full_context) ->
|
begin fun () (_, contract) (cctxt : Proto_alpha.full_context) ->
|
||||||
Client_proto_contracts.get_manager
|
Client_proto_contracts.get_manager
|
||||||
cctxt cctxt#block contract >>=? fun manager ->
|
cctxt cctxt#block contract >>=? fun manager ->
|
||||||
Public_key_hash.rev_find cctxt manager >>=? fun mn ->
|
Public_key_hash.rev_find cctxt manager >>=? fun mn ->
|
||||||
@ -110,7 +110,7 @@ let commands () =
|
|||||||
(prefixes [ "get" ; "delegate" ; "for" ]
|
(prefixes [ "get" ; "delegate" ; "for" ]
|
||||||
@@ ContractAlias.destination_param ~name:"src" ~desc:"source contract"
|
@@ ContractAlias.destination_param ~name:"src" ~desc:"source contract"
|
||||||
@@ stop)
|
@@ stop)
|
||||||
begin fun () (_, contract) (cctxt : Client_commands.full_context) ->
|
begin fun () (_, contract) (cctxt : Proto_alpha.full_context) ->
|
||||||
Client_proto_contracts.get_delegate
|
Client_proto_contracts.get_delegate
|
||||||
cctxt cctxt#block contract >>=? fun delegate ->
|
cctxt cctxt#block contract >>=? fun delegate ->
|
||||||
Public_key_hash.rev_find cctxt delegate >>=? fun mn ->
|
Public_key_hash.rev_find cctxt delegate >>=? fun mn ->
|
||||||
@ -128,7 +128,7 @@ let commands () =
|
|||||||
@@ Public_key_hash.alias_param
|
@@ Public_key_hash.alias_param
|
||||||
~name: "mgr" ~desc: "new delegate of the contract"
|
~name: "mgr" ~desc: "new delegate of the contract"
|
||||||
@@ stop)
|
@@ stop)
|
||||||
begin fun fee (_, contract) (_, delegate) cctxt ->
|
begin fun fee (_, contract) (_, delegate) (cctxt : Proto_alpha.full_context) ->
|
||||||
source_to_keys cctxt cctxt#block contract >>=? fun (src_pk, manager_sk) ->
|
source_to_keys cctxt cctxt#block contract >>=? fun (src_pk, manager_sk) ->
|
||||||
set_delegate ~fee cctxt cctxt#block contract (Some delegate) ~src_pk ~manager_sk >>=? fun oph ->
|
set_delegate ~fee cctxt cctxt#block contract (Some delegate) ~src_pk ~manager_sk >>=? fun oph ->
|
||||||
operation_submitted_message cctxt oph
|
operation_submitted_message cctxt oph
|
||||||
@ -150,7 +150,7 @@ let commands () =
|
|||||||
~name:"src" ~desc: "name of the source contract"
|
~name:"src" ~desc: "name of the source contract"
|
||||||
@@ stop)
|
@@ stop)
|
||||||
begin fun (fee, delegate, delegatable, force)
|
begin fun (fee, delegate, delegatable, force)
|
||||||
new_contract (_, manager_pkh) balance (_, source) (cctxt : Client_commands.full_context) ->
|
new_contract (_, manager_pkh) balance (_, source) (cctxt : Proto_alpha.full_context) ->
|
||||||
RawContractAlias.of_fresh cctxt force new_contract >>=? fun alias_name ->
|
RawContractAlias.of_fresh cctxt force new_contract >>=? fun alias_name ->
|
||||||
source_to_keys cctxt cctxt#block source >>=? fun (src_pk, src_sk) ->
|
source_to_keys cctxt cctxt#block source >>=? fun (src_pk, src_sk) ->
|
||||||
get_pkh cctxt delegate >>=? fun delegate ->
|
get_pkh cctxt delegate >>=? fun delegate ->
|
||||||
@ -192,7 +192,7 @@ let commands () =
|
|||||||
Combine with -init if the storage type is not unit."
|
Combine with -init if the storage type is not unit."
|
||||||
@@ stop)
|
@@ stop)
|
||||||
begin fun (fee, delegate, force, delegatable, spendable, initial_storage, no_print_source)
|
begin fun (fee, delegate, force, delegatable, spendable, initial_storage, no_print_source)
|
||||||
alias_name (_, manager) balance (_, source) program (cctxt : Client_commands.full_context) ->
|
alias_name (_, manager) balance (_, source) program (cctxt : Proto_alpha.full_context) ->
|
||||||
RawContractAlias.of_fresh cctxt force alias_name >>=? fun alias_name ->
|
RawContractAlias.of_fresh cctxt force alias_name >>=? fun alias_name ->
|
||||||
Lwt.return (Micheline_parser.no_parsing_error program) >>=? fun { expanded = code } ->
|
Lwt.return (Micheline_parser.no_parsing_error program) >>=? fun { expanded = code } ->
|
||||||
source_to_keys cctxt cctxt#block source >>=? fun (src_pk, src_sk) ->
|
source_to_keys cctxt cctxt#block source >>=? fun (src_pk, src_sk) ->
|
||||||
@ -238,7 +238,7 @@ let commands () =
|
|||||||
@@ Public_key_hash.alias_param
|
@@ Public_key_hash.alias_param
|
||||||
~name: "mgr" ~desc: "manager of the new contract"
|
~name: "mgr" ~desc: "manager of the new contract"
|
||||||
@@ stop)
|
@@ stop)
|
||||||
begin fun force alias_name (_, manager_pkh) cctxt ->
|
begin fun force alias_name (_, manager_pkh) (cctxt: Proto_alpha.full_context) ->
|
||||||
RawContractAlias.of_fresh cctxt force alias_name >>=? fun alias_name ->
|
RawContractAlias.of_fresh cctxt force alias_name >>=? fun alias_name ->
|
||||||
faucet ~manager_pkh cctxt#block cctxt () >>=? fun (oph, contract) ->
|
faucet ~manager_pkh cctxt#block cctxt () >>=? fun (oph, contract) ->
|
||||||
operation_submitted_message cctxt
|
operation_submitted_message cctxt
|
||||||
|
@ -42,19 +42,19 @@ val list_contracts:
|
|||||||
(string * string * RawContractAlias.t) list tzresult Lwt.t
|
(string * string * RawContractAlias.t) list tzresult Lwt.t
|
||||||
|
|
||||||
val get_manager:
|
val get_manager:
|
||||||
#RPC_context.simple ->
|
#Proto_alpha.rpc_context ->
|
||||||
Block_services.block ->
|
Block_services.block ->
|
||||||
Contract.t ->
|
Contract.t ->
|
||||||
public_key_hash tzresult Lwt.t
|
public_key_hash tzresult Lwt.t
|
||||||
|
|
||||||
val get_delegate:
|
val get_delegate:
|
||||||
#RPC_context.simple ->
|
#Proto_alpha.rpc_context ->
|
||||||
Block_services.block ->
|
Block_services.block ->
|
||||||
Contract.t ->
|
Contract.t ->
|
||||||
public_key_hash tzresult Lwt.t
|
public_key_hash tzresult Lwt.t
|
||||||
|
|
||||||
val check_public_key :
|
val check_public_key :
|
||||||
#RPC_context.simple ->
|
#Proto_alpha.rpc_context ->
|
||||||
Block_services.block ->
|
Block_services.block ->
|
||||||
?src_pk:public_key ->
|
?src_pk:public_key ->
|
||||||
public_key_hash ->
|
public_key_hash ->
|
||||||
|
@ -40,7 +40,7 @@ let commands () =
|
|||||||
command ~group ~desc: "Lists all known contracts in the wallet."
|
command ~group ~desc: "Lists all known contracts in the wallet."
|
||||||
no_options
|
no_options
|
||||||
(fixed [ "list" ; "known" ; "contracts" ])
|
(fixed [ "list" ; "known" ; "contracts" ])
|
||||||
(fun () (cctxt : Client_commands.full_context) ->
|
(fun () (cctxt : Proto_alpha.full_context) ->
|
||||||
list_contracts cctxt >>=? fun contracts ->
|
list_contracts cctxt >>=? fun contracts ->
|
||||||
iter_s
|
iter_s
|
||||||
(fun (prefix, alias, contract) ->
|
(fun (prefix, alias, contract) ->
|
||||||
@ -62,7 +62,7 @@ let commands () =
|
|||||||
(prefixes [ "show" ; "known" ; "contract" ]
|
(prefixes [ "show" ; "known" ; "contract" ]
|
||||||
@@ RawContractAlias.alias_param
|
@@ RawContractAlias.alias_param
|
||||||
@@ stop)
|
@@ stop)
|
||||||
(fun () (_, contract) (cctxt : Client_commands.full_context) ->
|
(fun () (_, contract) (cctxt : Proto_alpha.full_context) ->
|
||||||
cctxt#message "%a\n%!" Contract.pp contract >>= fun () ->
|
cctxt#message "%a\n%!" Contract.pp contract >>= fun () ->
|
||||||
return ()) ;
|
return ()) ;
|
||||||
|
|
||||||
|
@ -13,6 +13,7 @@ let protocol =
|
|||||||
|
|
||||||
let () =
|
let () =
|
||||||
Client_commands.register protocol @@
|
Client_commands.register protocol @@
|
||||||
|
List.map (Cli_entries.map_command (new Proto_alpha.wrap_full_context)) @@
|
||||||
Client_proto_programs_commands.commands () @
|
Client_proto_programs_commands.commands () @
|
||||||
Client_proto_contracts_commands.commands () @
|
Client_proto_contracts_commands.commands () @
|
||||||
Client_proto_context_commands.commands () @
|
Client_proto_context_commands.commands () @
|
||||||
|
@ -20,7 +20,7 @@ val run :
|
|||||||
storage:Michelson_v1_parser.parsed ->
|
storage:Michelson_v1_parser.parsed ->
|
||||||
input:Michelson_v1_parser.parsed ->
|
input:Michelson_v1_parser.parsed ->
|
||||||
Block_services.block ->
|
Block_services.block ->
|
||||||
#RPC_context.simple ->
|
#Proto_alpha.rpc_context ->
|
||||||
(Script.expr * Script.expr * (Script.expr * Script.expr option) list option) tzresult Lwt.t
|
(Script.expr * Script.expr * (Script.expr * Script.expr option) list option) tzresult Lwt.t
|
||||||
|
|
||||||
val trace :
|
val trace :
|
||||||
@ -29,7 +29,7 @@ val trace :
|
|||||||
storage:Michelson_v1_parser.parsed ->
|
storage:Michelson_v1_parser.parsed ->
|
||||||
input:Michelson_v1_parser.parsed ->
|
input:Michelson_v1_parser.parsed ->
|
||||||
Block_services.block ->
|
Block_services.block ->
|
||||||
#RPC_context.simple ->
|
#Proto_alpha.rpc_context ->
|
||||||
(Script.expr * Script.expr * (int * Gas.t * Script.expr list) list * (Script.expr * Script.expr option) list option) tzresult Lwt.t
|
(Script.expr * Script.expr * (int * Gas.t * Script.expr list) list * (Script.expr * Script.expr option) list option) tzresult Lwt.t
|
||||||
|
|
||||||
val print_run_result :
|
val print_run_result :
|
||||||
@ -53,20 +53,20 @@ val hash_and_sign :
|
|||||||
Michelson_v1_parser.parsed ->
|
Michelson_v1_parser.parsed ->
|
||||||
Client_keys.sk_locator ->
|
Client_keys.sk_locator ->
|
||||||
Block_services.block ->
|
Block_services.block ->
|
||||||
#RPC_context.simple ->
|
#Proto_alpha.rpc_context ->
|
||||||
(string * string) tzresult Lwt.t
|
(string * string) tzresult Lwt.t
|
||||||
|
|
||||||
val typecheck_data :
|
val typecheck_data :
|
||||||
data:Michelson_v1_parser.parsed ->
|
data:Michelson_v1_parser.parsed ->
|
||||||
ty:Michelson_v1_parser.parsed ->
|
ty:Michelson_v1_parser.parsed ->
|
||||||
Block_services.block ->
|
Block_services.block ->
|
||||||
#RPC_context.simple ->
|
#Proto_alpha.rpc_context ->
|
||||||
unit tzresult Lwt.t
|
unit tzresult Lwt.t
|
||||||
|
|
||||||
val typecheck_program :
|
val typecheck_program :
|
||||||
Michelson_v1_parser.parsed ->
|
Michelson_v1_parser.parsed ->
|
||||||
Block_services.block ->
|
Block_services.block ->
|
||||||
#RPC_context.simple ->
|
#Proto_alpha.rpc_context ->
|
||||||
Script_tc_errors.type_map tzresult Lwt.t
|
Script_tc_errors.type_map tzresult Lwt.t
|
||||||
|
|
||||||
val print_typecheck_result :
|
val print_typecheck_result :
|
||||||
|
@ -43,7 +43,7 @@ let commands () =
|
|||||||
command ~group ~desc: "Lists all programs in the library."
|
command ~group ~desc: "Lists all programs in the library."
|
||||||
no_options
|
no_options
|
||||||
(fixed [ "list" ; "known" ; "programs" ])
|
(fixed [ "list" ; "known" ; "programs" ])
|
||||||
(fun () (cctxt : Client_commands.full_context) ->
|
(fun () (cctxt : Proto_alpha.full_context) ->
|
||||||
Program.load cctxt >>=? fun list ->
|
Program.load cctxt >>=? fun list ->
|
||||||
Lwt_list.iter_s (fun (n, _) -> cctxt#message "%s" n) list >>= fun () ->
|
Lwt_list.iter_s (fun (n, _) -> cctxt#message "%s" n) list >>= fun () ->
|
||||||
return ()) ;
|
return ()) ;
|
||||||
@ -54,7 +54,7 @@ let commands () =
|
|||||||
@@ Program.fresh_alias_param
|
@@ Program.fresh_alias_param
|
||||||
@@ Program.source_param
|
@@ Program.source_param
|
||||||
@@ stop)
|
@@ stop)
|
||||||
(fun force name hash (cctxt : Client_commands.full_context) ->
|
(fun force name hash cctxt ->
|
||||||
Program.of_fresh cctxt force name >>=? fun name ->
|
Program.of_fresh cctxt force name >>=? fun name ->
|
||||||
Program.add ~force cctxt name hash) ;
|
Program.add ~force cctxt name hash) ;
|
||||||
|
|
||||||
@ -70,7 +70,7 @@ let commands () =
|
|||||||
(prefixes [ "show" ; "known" ; "program" ]
|
(prefixes [ "show" ; "known" ; "program" ]
|
||||||
@@ Program.alias_param
|
@@ Program.alias_param
|
||||||
@@ stop)
|
@@ stop)
|
||||||
(fun () (_, program) (cctxt : Client_commands.full_context) ->
|
(fun () (_, program) (cctxt : Proto_alpha.full_context) ->
|
||||||
Program.to_source program >>=? fun source ->
|
Program.to_source program >>=? fun source ->
|
||||||
cctxt#message "%s\n" source >>= fun () ->
|
cctxt#message "%s\n" source >>= fun () ->
|
||||||
return ()) ;
|
return ()) ;
|
||||||
|
@ -7,4 +7,4 @@
|
|||||||
(* *)
|
(* *)
|
||||||
(**************************************************************************)
|
(**************************************************************************)
|
||||||
|
|
||||||
val commands: unit -> Client_commands.command list
|
val commands: unit -> (Proto_alpha.full_context, unit) Cli_entries.command list
|
||||||
|
@ -11,11 +11,11 @@ open Proto_alpha
|
|||||||
open Alpha_context
|
open Alpha_context
|
||||||
|
|
||||||
let make_call1 cctxt s=
|
let make_call1 cctxt s=
|
||||||
RPC_context.make_call1 (s Block_services.S.proto_path) cctxt
|
RPC_context.make_call1 (s (Block_services.S.proto_path ())) cctxt
|
||||||
let make_call2 cctxt s =
|
let make_call2 cctxt s =
|
||||||
RPC_context.make_call2 (s Block_services.S.proto_path) cctxt
|
RPC_context.make_call2 (s (Block_services.S.proto_path ())) cctxt
|
||||||
let make_call3 cctxt s =
|
let make_call3 cctxt s =
|
||||||
RPC_context.make_call3 (s Block_services.S.proto_path) cctxt
|
RPC_context.make_call3 (s (Block_services.S.proto_path ())) cctxt
|
||||||
|
|
||||||
let make_opt_call2 cctxt s block a1 q i =
|
let make_opt_call2 cctxt s block a1 q i =
|
||||||
make_call2 cctxt s block a1 q i >>= function
|
make_call2 cctxt s block a1 q i >>= function
|
||||||
|
@ -7,13 +7,15 @@
|
|||||||
tezos-protocol-alpha
|
tezos-protocol-alpha
|
||||||
tezos-protocol-environment-client
|
tezos-protocol-environment-client
|
||||||
tezos-shell-services
|
tezos-shell-services
|
||||||
tezos-client-base))
|
tezos-client-base
|
||||||
|
tezos-rpc-http))
|
||||||
(library_flags (:standard -linkall))
|
(library_flags (:standard -linkall))
|
||||||
(flags (:standard -w -9+27-30-32-40@8
|
(flags (:standard -w -9+27-30-32-40@8
|
||||||
-safe-string
|
-safe-string
|
||||||
-open Tezos_base__TzPervasives
|
-open Tezos_base__TzPervasives
|
||||||
-open Tezos_shell_services
|
-open Tezos_shell_services
|
||||||
-open Tezos_client_base))))
|
-open Tezos_client_base
|
||||||
|
-open Tezos_rpc_http))))
|
||||||
|
|
||||||
(alias
|
(alias
|
||||||
((name runtest_indent)
|
((name runtest_indent)
|
||||||
|
@ -10,3 +10,33 @@
|
|||||||
module Name = struct let name = "alpha" end
|
module Name = struct let name = "alpha" end
|
||||||
module Alpha_environment = Tezos_protocol_environment_client.Fake.Make(Name)()
|
module Alpha_environment = Tezos_protocol_environment_client.Fake.Make(Name)()
|
||||||
include Tezos_protocol_alpha.Functor.Make(Alpha_environment)
|
include Tezos_protocol_alpha.Functor.Make(Alpha_environment)
|
||||||
|
|
||||||
|
class type rpc_context = object
|
||||||
|
inherit RPC_client.ctxt
|
||||||
|
inherit [Block_services.block] Alpha_environment.RPC_context.simple
|
||||||
|
end
|
||||||
|
|
||||||
|
class wrap_proto_context (t : RPC_client.ctxt) : rpc_context = object
|
||||||
|
method generic_json_call = t#generic_json_call
|
||||||
|
method call_service : 'm 'p 'q 'i 'o.
|
||||||
|
([< Resto.meth ] as 'm, unit, 'p, 'q, 'i, 'o) RPC_service.t ->
|
||||||
|
'p -> 'q -> 'i -> 'o tzresult Lwt.t= t#call_service
|
||||||
|
method call_streamed_service : 'm 'p 'q 'i 'o.
|
||||||
|
([< Resto.meth ] as 'm, unit, 'p, 'q, 'i, 'o) RPC_service.t ->
|
||||||
|
on_chunk: ('o -> unit) ->
|
||||||
|
on_close: (unit -> unit) ->
|
||||||
|
'p -> 'q -> 'i -> (unit -> unit) tzresult Lwt.t = t#call_streamed_service
|
||||||
|
inherit [Block_services.block] Alpha_environment.proto_rpc_context
|
||||||
|
(t :> RPC_context.t) (Block_services.S.proto_path ())
|
||||||
|
end
|
||||||
|
|
||||||
|
class type full_context = object
|
||||||
|
inherit Client_commands.full_context
|
||||||
|
inherit [Block_services.block] Alpha_environment.RPC_context.simple
|
||||||
|
end
|
||||||
|
|
||||||
|
class wrap_full_context (t : Client_commands.full_context) : full_context = object
|
||||||
|
inherit Client_commands.proxy_context t
|
||||||
|
inherit [Block_services.block] Alpha_environment.proto_rpc_context
|
||||||
|
(t :> RPC_context.t) (Block_services.S.proto_path ())
|
||||||
|
end
|
||||||
|
@ -22,6 +22,7 @@ let rpc_config = ref {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let build_rpc_context config =
|
let build_rpc_context config =
|
||||||
|
new Proto_alpha.wrap_proto_context @@
|
||||||
new RPC_client.http_ctxt config Media_type.all_media_types
|
new RPC_client.http_ctxt config Media_type.all_media_types
|
||||||
|
|
||||||
let rpc_ctxt = ref (build_rpc_context !rpc_config)
|
let rpc_ctxt = ref (build_rpc_context !rpc_config)
|
||||||
|
Loading…
Reference in New Issue
Block a user