From 6e474409c96953f4b4fd938f4f10c53ca19832d9 Mon Sep 17 00:00:00 2001 From: mchinaloy <6108344+mchinaloy@users.noreply.github.com> Date: Mon, 29 Apr 2024 11:51:39 +0100 Subject: [PATCH] - update Cardano collector to work with ogmios API v6.1.x --- src/collectors.py | 11 +++-------- src/test_collectors.py | 10 +++------- 2 files changed, 6 insertions(+), 15 deletions(-) diff --git a/src/collectors.py b/src/collectors.py index 3a4c377..513cd1b 100644 --- a/src/collectors.py +++ b/src/collectors.py @@ -2,7 +2,6 @@ from interfaces import WebsocketInterface, HttpsInterface from helpers import validate_dict_and_return_key_value, strip_url - class EvmCollector(): """A collector to fetch information about evm compatible RPC endpoints.""" @@ -116,13 +115,9 @@ def __init__(self, url, labels, chain_id, **client_parameters): self.labels = labels self.chain_id = chain_id self.block_height_payload = { - "type": "jsonwsp/request", - "version": "1.0", - "servicename": "ogmios", - "methodname": "Query", - "args": { - "query": "blockHeight" - } + "id": "exporter", + "jsonrpc": "2.0", + "method": "queryNetwork/blockHeight" } self.interface = WebsocketInterface( url, **client_parameters) diff --git a/src/test_collectors.py b/src/test_collectors.py index 6987390..feca7e6 100644 --- a/src/test_collectors.py +++ b/src/test_collectors.py @@ -188,13 +188,9 @@ def setUp(self): self.chain_id = 123 self.client_params = {"param1": "dummy", "param2": "data"} self.block_height_payload = { - "type": "jsonwsp/request", - "version": "1.0", - "servicename": "ogmios", - "methodname": "Query", - "args": { - "query": "blockHeight" - } + "id": "exporter", + "version": "2.0", + "methodname": "queryNetwork/blockHeight" } with mock.patch('collectors.WebsocketInterface') as mocked_websocket: self.cardano_collector = collectors.CardanoCollector(