Load Snapshot from RPC request

This commit is contained in:
Thales Lima
2024-07-18 04:54:02 +02:00
committed by tvinagre
parent 5e6c7d4647
commit 183868e536
8 changed files with 500 additions and 59 deletions

View File

@@ -1,14 +1,14 @@
import os
import signal
import subprocess
import threading
import time
import requests
import subprocess
import os
import psycopg2
from psycopg2 import sql
from pathlib import Path
import psycopg2
import requests
from psycopg2 import sql
binary_path = Path(__file__).parent / "tycho-indexer"
@@ -148,6 +148,16 @@ class TychoRunner:
response = requests.post(url, headers=headers, json=data)
return response.json()
@staticmethod
def get_contract_state() -> dict:
"""Retrieve contract state from the RPC server."""
url = "http://0.0.0.0:4242/v1/ethereum/contract_state"
headers = {"accept": "application/json", "Content-Type": "application/json"}
data = {}
response = requests.post(url, headers=headers, json=data)
return response.json()
@staticmethod
def empty_database(db_url: str) -> None:
"""Drop and recreate the Tycho indexer database."""