Updated logos-blockchain node api url path and deserialization

This commit is contained in:
Petar Radovic 2026-01-29 19:19:00 +01:00
parent 6fa406f83f
commit 73bcd9cc66
2 changed files with 7 additions and 4 deletions

View File

@ -21,4 +21,4 @@ GET {{host}}/cryptarchia/blocks?slot_from=0&slot_to=10
###
GET {{host}}/cryptarchia/blocks/stream
GET {{host}}/cryptarchia/events/blocks/stream

View File

@ -24,7 +24,7 @@ class HttpNodeApi(NodeApi):
ENDPOINT_INFO = "cryptarchia/info"
ENDPOINT_TRANSACTIONS = "cryptarchia/transactions"
ENDPOINT_BLOCKS = "cryptarchia/blocks"
ENDPOINT_BLOCKS_STREAM = "cryptarchia/blocks/stream"
ENDPOINT_BLOCKS_STREAM = "cryptarchia/events/blocks/stream"
def __init__(self, settings: "NBESettings"):
self.host: str = settings.node_api_host
@ -89,8 +89,11 @@ class HttpNodeApi(NodeApi):
if not line:
continue
try:
block = BlockSerializer.model_validate_json(line)
except ValidationError as error:
import json
event = json.loads(line)
block = BlockSerializer.model_validate(event["block"])
except (ValidationError, KeyError, json.JSONDecodeError) as error:
logger.exception(error)
continue