Evm_node_lib_dev.Websocket_client
Client to communicate with an EVM node over websockets
type Tezos_base.TzPervasives.error +=
| No_response of Rpc_encodings.JSONRPC.request
| Request_failed of Rpc_encodings.JSONRPC.request * Rpc_encodings.JSONRPC.error
| Cannot_destruct of Evm_node_lib_dev_encoding.Ethereum_types.Subscription.kind
* Evm_node_lib_dev_encoding.Ethereum_types.Subscription.id
* string
type 'a subscription = {
stream : 'a Lwt_stream.t;
The stream of events.
*)unsubscribe : unit -> bool Tezos_base.TzPervasives.tzresult Lwt.t;
A function to unsubscribe from events notifications.
*)}
Subscriptions returned by subscribe
.
type (_, _) call =
| Call : (module Rpc_encodings.METHOD
with type input = 'input
and type output = 'output)
* 'input -> ('input, 'output) call
Wrapper type for calling a JSONRPC method with an input
val connect :
?monitoring:monitoring ->
Tezos_rpc_http.Media_type.t ->
Uri.t ->
t Lwt.t
connect ?monitoring media uri
connects to an EVM node websocket server on uri
, communication is either JSON or binary depending on media
. If monitoring
is provided, the connection is monitored with the given parameters.
val disconnect : t -> unit Lwt.t
Disconnect the websocket client by sending a close frame and closing the connection.
val send_jsonrpc_request :
t ->
Rpc_encodings.JSONRPC.request ->
Rpc_encodings.JSONRPC.value Lwt.t
Send a raw JSON RPC request on the websocket.
val send_jsonrpc :
t ->
('input, 'output) call ->
'output Tezos_base.TzPervasives.tzresult Lwt.t
send_jsonrpc client (Call ((module Method), input))
makes a JSONRPC request with the provided Method
and input
to the websocket client
. It returns the corresponding response.
val subscribe :
t ->
Rpc_encodings.Subscribe.input ->
Transaction_object.t
Evm_node_lib_dev_encoding.Ethereum_types.Subscription.output
Tezos_base.TzPervasives.tzresult
subscription
Tezos_base.TzPervasives.tzresult
Lwt.t
subscribe client kind
creates a subscription of kind
with the websocket client
. It returns a stream with the notifications and a function to unsubscribe.
val subscribe_newHeads :
t ->
Transaction_object.t Evm_node_lib_dev_encoding.Ethereum_types.block
Tezos_base.TzPervasives.tzresult
subscription
Tezos_base.TzPervasives.tzresult
Lwt.t
subscribe_newHeads client
is like subscribe
but specialized for newHeads events.
val subscribe_newHeadNumbers :
t ->
Evm_node_lib_dev_encoding.Ethereum_types.quantity
Tezos_base.TzPervasives.tzresult
subscription
Tezos_base.TzPervasives.tzresult
Lwt.t
subscribe_newHeadNumbers client
is like subscribe_newHeads
but only parses numbers in blocks.
val subscribe_newPendingTransactions :
t ->
Evm_node_lib_dev_encoding.Ethereum_types.hash
Tezos_base.TzPervasives.tzresult
subscription
Tezos_base.TzPervasives.tzresult
Lwt.t
subscribe_newPendingTransactions client
is like subscribe
but specialized for newPendingTransactions events.
val subscribe_syncing :
t ->
Evm_node_lib_dev_encoding.Ethereum_types.Subscription.sync_output
Tezos_base.TzPervasives.tzresult
subscription
Tezos_base.TzPervasives.tzresult
Lwt.t
subscribe_syncing client
is like subscribe
but specialized for syncing events.
val subscribe_logs :
?address:Evm_node_lib_dev_encoding.Ethereum_types.Filter.filter_address ->
?topics:Evm_node_lib_dev_encoding.Ethereum_types.Filter.topic option list ->
t ->
Evm_node_lib_dev_encoding.Ethereum_types.transaction_log
Tezos_base.TzPervasives.tzresult
subscription
Tezos_base.TzPervasives.tzresult
Lwt.t
subscribe_logs ?address ?topics client
is like subscribe
but specialized for logs events filtered by address
and/or topics
.
val subscribe_l1_l2_levels :
?start_l1_level:int32 ->
t ->
Evm_node_lib_dev_encoding.Ethereum_types.Subscription.l1_l2_levels_output
Tezos_base.TzPervasives.tzresult
subscription
Tezos_base.TzPervasives.tzresult
Lwt.t
Subscribe to L1/L2 levels associations.