added rpc fallback support

This commit is contained in:
Alexander 2024-08-24 09:00:38 -04:00
parent f2041b5f38
commit 639d60cdcf
3 changed files with 5 additions and 4 deletions

View file

@ -1,18 +1,18 @@
import asyncio
import json
import os
import re
import warnings
from datetime import datetime, timezone
from json import JSONDecodeError
from web3 import Web3, HTTPProvider
from web3 import Web3
from web3_multi_provider import FallbackProvider
from common import *
from logs import *
warnings.filterwarnings("ignore")
web3 = Web3(HTTPProvider(os.getenv('RPC_SERVER')))
web3 = Web3(FallbackProvider(json.loads(os.getenv('RPC_SERVER'))))
log_contract = web3.eth.contract(
os.getenv('LOG_CONTRACT_ADDRESS'),
abi=json.load(open("./data/abi/{}".format(os.getenv('LOG_CONTRACT_ABI_FILE'))))

View file

@ -1,2 +1,3 @@
web3
web3_multi_provider
python-dotenv

View file

@ -1,5 +1,5 @@
DATA_FOLDER=./data
RPC_SERVER=https://rpc.pulsechain.com
RPC_SERVER=["https://rpc.pulsechain.com", "https://rpc-pulsechain.g4mm4.io"]
LOG_CONTRACT_ADDRESS=0x7aE73C498A308247BE73688c09c96B3fd06dDB84
LOG_CONTRACT_ABI_FILE=SHIO.json
LOG_TOPIC=0x6b81130c485ac9b98332fa40c2e57900867815b0fe1497e1a168caf930fc9c9d