vizapi.noderpc

Module Contents

log
class NodeRPC(*args, **kwargs)

Bases: grapheneapi.api.Api

Inheritance diagram of vizapi.noderpc.NodeRPC
private-bases

Redefine graphene Api class.

Class wraps communications with API nodes via proxying requests to lower-level Rpc class and it’s implementations Websocket and Http.

To enable RPC debugging:

log = logging.getLogger('vizapi')
log.setLevel(logging.DEBUG)
log.addHandler(logging.StreamHandler())
post_process_exception(self, error: Exception)

Process error response and raise proper exception.

Called from __getattr__(), which catches RPCError exception which raised by Rpc.parse_response() in Rpc class.

Parameters

error – exception

updated_connection(self)
get_network(self)

Cache connected network info.

This avoids multiple calls of self.get_config()

_get_network(self)

Identify the connected network.

This call returns a dictionary with keys chain_id, core_symbol and prefix

class Rpc(*args, **kwargs)

Bases: grapheneapi.rpc.Rpc

Inheritance diagram of vizapi.noderpc.Rpc
private-bases

This class is responsible for making RPC queries.

Original graphene chains (like Bitshares) uses api_id in “params”, while Golos and VIZ uses api name here.

__getattr__(self, name)

Map all methods to RPC calls and pass through the arguments.

class Websocket(*args, **kwargs)

Bases: grapheneapi.websocket.Websocket, vizapi.noderpc.Rpc

Inheritance diagram of vizapi.noderpc.Websocket
private-bases

Interface to API node websocket endpoint.

We have to override Websocket class because we need it to inherit from our own Rpc class.

__getattr__(self, name)

Map all methods to RPC calls and pass through the arguments.

class Http(*args, **kwargs)

Bases: grapheneapi.http.Http, vizapi.noderpc.Rpc

Inheritance diagram of vizapi.noderpc.Http
private-bases

Interface to API node http endpoint.

We have to override Websocket class because we need it to inherit from our own Rpc class.

__getattr__(self, name)

Map all methods to RPC calls and pass through the arguments.