mirror of
https://github.com/logos-blockchain/logos-blockchain-block-explorer-template.git
synced 2026-05-21 17:00:03 +00:00
Updated logos-blockchain node api url path and deserialization
This commit is contained in:
parent
6fa406f83f
commit
73bcd9cc66
@ -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
|
||||||
|
|||||||
@ -24,7 +24,7 @@ class HttpNodeApi(NodeApi):
|
|||||||
ENDPOINT_INFO = "cryptarchia/info"
|
ENDPOINT_INFO = "cryptarchia/info"
|
||||||
ENDPOINT_TRANSACTIONS = "cryptarchia/transactions"
|
ENDPOINT_TRANSACTIONS = "cryptarchia/transactions"
|
||||||
ENDPOINT_BLOCKS = "cryptarchia/blocks"
|
ENDPOINT_BLOCKS = "cryptarchia/blocks"
|
||||||
ENDPOINT_BLOCKS_STREAM = "cryptarchia/blocks/stream"
|
ENDPOINT_BLOCKS_STREAM = "cryptarchia/events/blocks/stream"
|
||||||
|
|
||||||
def __init__(self, settings: "NBESettings"):
|
def __init__(self, settings: "NBESettings"):
|
||||||
self.host: str = settings.node_api_host
|
self.host: str = settings.node_api_host
|
||||||
@ -89,8 +89,11 @@ class HttpNodeApi(NodeApi):
|
|||||||
if not line:
|
if not line:
|
||||||
continue
|
continue
|
||||||
try:
|
try:
|
||||||
block = BlockSerializer.model_validate_json(line)
|
import json
|
||||||
except ValidationError as error:
|
|
||||||
|
event = json.loads(line)
|
||||||
|
block = BlockSerializer.model_validate(event["block"])
|
||||||
|
except (ValidationError, KeyError, json.JSONDecodeError) as error:
|
||||||
logger.exception(error)
|
logger.exception(error)
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user