|
|
@@ -8,6 +8,7 @@ from web3.middleware import ExtraDataToPOAMiddleware # For PoA networks like Goe
|
|
|
from eth_account import Account
|
|
|
from dotenv import load_dotenv
|
|
|
from checker.logger_config import get_logger
|
|
|
+from encode_decode import decrypt
|
|
|
|
|
|
|
|
|
# 配置日志
|
|
|
@@ -119,7 +120,12 @@ IERC20_ABI = json.loads('''
|
|
|
class EthClient:
|
|
|
def __init__(self, rpc_url: str = None, hash: str = None):
|
|
|
self.rpc_url = rpc_url or os.getenv("RPC_URL")
|
|
|
- _hash = hash or os.getenv("HASH")
|
|
|
+
|
|
|
+ ciphertext = os.getenv("ED_CIPHERTEXT")
|
|
|
+ initial_vector = os.getenv("ED_INITIAL_VECTOR")
|
|
|
+ secret_key = os.getenv("ED_SECRET_KEY")
|
|
|
+
|
|
|
+ _hash = hash or decrypt(bytes.fromhex(ciphertext), bytes.fromhex(secret_key), bytes.fromhex(initial_vector)).decode('utf-8')
|
|
|
|
|
|
if not self.rpc_url:
|
|
|
raise ValueError("RPC_URL not provided or found in environment variables.")
|