2017-04-05 01:35:41 +04:00
|
|
|
(**************************************************************************)
|
|
|
|
(* *)
|
2017-11-14 03:36:14 +04:00
|
|
|
(* Copyright (c) 2014 - 2017. *)
|
2017-04-05 01:35:41 +04:00
|
|
|
(* Dynamic Ledger Solutions, Inc. <contact@tezos.com> *)
|
|
|
|
(* *)
|
|
|
|
(* All rights reserved. No warranty, explicit or implicit, provided. *)
|
|
|
|
(* *)
|
|
|
|
(**************************************************************************)
|
|
|
|
|
|
|
|
type config = {
|
|
|
|
host : string ;
|
|
|
|
port : int ;
|
|
|
|
tls : bool ;
|
2017-12-09 01:08:29 +04:00
|
|
|
logger : RPC_client.logger ;
|
2017-04-05 01:35:41 +04:00
|
|
|
}
|
|
|
|
|
2017-12-09 01:08:29 +04:00
|
|
|
class type json_ctxt = object
|
|
|
|
method generic_json_call :
|
2017-12-09 06:51:58 +04:00
|
|
|
RPC_service.meth ->
|
2017-12-09 01:08:29 +04:00
|
|
|
?body:Data_encoding.json ->
|
|
|
|
Uri.t ->
|
|
|
|
(Data_encoding.json, Data_encoding.json option) RPC_client.rest_result Lwt.t
|
2017-11-07 20:38:11 +04:00
|
|
|
end
|
|
|
|
|
2017-12-09 01:08:29 +04:00
|
|
|
class type service_ctxt = object
|
|
|
|
method call_service :
|
|
|
|
'm 'p 'q 'i 'o 'e.
|
|
|
|
([< Resto.meth ] as 'm, unit, 'p, 'q, 'i, 'o, 'e) RPC_service.t ->
|
|
|
|
'p -> 'q -> 'i -> 'o tzresult Lwt.t
|
|
|
|
method call_streamed_service :
|
|
|
|
'm 'p 'q 'i 'o 'e.
|
|
|
|
([< Resto.meth ] as 'm, unit, 'p, 'q, 'i, 'o, 'e) RPC_service.t ->
|
|
|
|
on_chunk: ('o -> unit) ->
|
|
|
|
on_close: (unit -> unit) ->
|
|
|
|
'p -> 'q -> 'i -> (unit -> unit) tzresult Lwt.t
|
|
|
|
end
|
|
|
|
|
|
|
|
class type ctxt = object
|
|
|
|
inherit json_ctxt
|
|
|
|
inherit service_ctxt
|
|
|
|
end
|
2017-11-07 20:38:11 +04:00
|
|
|
|
2017-04-05 01:35:41 +04:00
|
|
|
val default_config: config
|
2017-12-09 01:08:29 +04:00
|
|
|
class http_ctxt: config -> ctxt
|
|
|
|
|
|
|
|
val call_service:
|
|
|
|
#service_ctxt ->
|
|
|
|
('m, unit,
|
|
|
|
'p, 'q, 'i,
|
|
|
|
'o, 'e) RPC_service.t ->
|
|
|
|
'p -> 'q -> 'i -> 'o tzresult Lwt.t
|
2017-04-05 01:35:41 +04:00
|
|
|
|
|
|
|
val call_service0:
|
2017-12-09 01:08:29 +04:00
|
|
|
#service_ctxt ->
|
|
|
|
('m, unit,
|
2017-12-07 20:43:21 +04:00
|
|
|
unit, unit, 'i,
|
2017-12-09 01:08:29 +04:00
|
|
|
'o, 'e) RPC_service.t ->
|
2017-04-05 01:35:41 +04:00
|
|
|
'i -> 'o tzresult Lwt.t
|
|
|
|
|
|
|
|
val call_service1:
|
2017-12-09 01:08:29 +04:00
|
|
|
#service_ctxt ->
|
|
|
|
('m, unit,
|
2017-12-07 20:43:21 +04:00
|
|
|
unit * 'a, unit, 'i,
|
2017-12-09 01:08:29 +04:00
|
|
|
'o, 'e) RPC_service.t ->
|
2017-04-05 01:35:41 +04:00
|
|
|
'a -> 'i -> 'o tzresult Lwt.t
|
|
|
|
|
|
|
|
val call_service2:
|
2017-12-09 01:08:29 +04:00
|
|
|
#service_ctxt ->
|
|
|
|
('m, unit,
|
2017-12-07 20:43:21 +04:00
|
|
|
(unit * 'a) * 'b, unit, 'i,
|
2017-12-09 01:08:29 +04:00
|
|
|
'o, 'e) RPC_service.t ->
|
2017-04-05 01:35:41 +04:00
|
|
|
'a -> 'b -> 'i -> 'o tzresult Lwt.t
|
|
|
|
|
|
|
|
val call_streamed_service0:
|
2017-12-09 01:08:29 +04:00
|
|
|
#service_ctxt ->
|
|
|
|
('m, unit,
|
2017-12-07 20:43:21 +04:00
|
|
|
unit, unit, 'a,
|
2017-12-09 06:51:58 +04:00
|
|
|
'b, unit) RPC_service.t ->
|
2017-12-09 01:08:29 +04:00
|
|
|
'a -> 'b Lwt_stream.t tzresult Lwt.t
|
2017-04-05 01:35:41 +04:00
|
|
|
|
2017-04-19 23:46:10 +04:00
|
|
|
val call_streamed_service1:
|
2017-12-09 01:08:29 +04:00
|
|
|
#service_ctxt ->
|
|
|
|
('m, unit,
|
2017-12-07 20:43:21 +04:00
|
|
|
unit * 'a, unit, 'b,
|
2017-12-09 06:51:58 +04:00
|
|
|
'c, unit) RPC_service.t ->
|
2017-12-09 01:08:29 +04:00
|
|
|
'a -> 'b -> 'c Lwt_stream.t tzresult Lwt.t
|
2017-04-19 23:46:10 +04:00
|
|
|
|
2017-04-05 01:35:41 +04:00
|
|
|
val call_err_service0:
|
2017-12-09 01:08:29 +04:00
|
|
|
#service_ctxt ->
|
|
|
|
('m, unit,
|
2017-12-07 20:43:21 +04:00
|
|
|
unit, unit, 'i,
|
2017-12-09 01:08:29 +04:00
|
|
|
'o tzresult, 'e) RPC_service.t ->
|
2017-04-05 01:35:41 +04:00
|
|
|
'i -> 'o tzresult Lwt.t
|
|
|
|
|
|
|
|
val call_err_service1:
|
2017-12-09 01:08:29 +04:00
|
|
|
#service_ctxt ->
|
|
|
|
('m, unit,
|
2017-12-07 20:43:21 +04:00
|
|
|
unit * 'a, unit, 'i,
|
2017-12-09 01:08:29 +04:00
|
|
|
'o tzresult, 'e) RPC_service.t ->
|
2017-04-05 01:35:41 +04:00
|
|
|
'a -> 'i -> 'o tzresult Lwt.t
|
|
|
|
|
|
|
|
val call_err_service2:
|
2017-12-09 01:08:29 +04:00
|
|
|
#service_ctxt ->
|
|
|
|
('m, unit,
|
2017-12-07 20:43:21 +04:00
|
|
|
(unit * 'a) * 'b, unit, 'i,
|
2017-12-09 01:08:29 +04:00
|
|
|
'o tzresult, 'e) RPC_service.t ->
|
2017-04-05 01:35:41 +04:00
|
|
|
'a -> 'b -> 'i -> 'o tzresult Lwt.t
|
|
|
|
|
2017-04-20 10:26:43 +04:00
|
|
|
type block = Node_rpc_services.Blocks.block
|
|
|
|
|
2017-11-20 06:37:06 +04:00
|
|
|
val last_baked_block:
|
2017-04-20 10:26:43 +04:00
|
|
|
block -> [>
|
|
|
|
| `Genesis
|
|
|
|
| `Head of int
|
|
|
|
| `Test_head of int
|
|
|
|
| `Hash of Block_hash.t
|
|
|
|
]
|