fix: resolve NameError for Config in wallet_daemon_client.py
Some checks failed
CLI Tests / test-cli (push) Failing after 5s
Cross-Node Transaction Testing / transaction-test (push) Successful in 3s
Deploy to Testnet / deploy-testnet (push) Successful in 1m19s
Multi-Node Stress Testing / stress-test (push) Successful in 3s
Security Scanning / security-scan (push) Successful in 56s

Config was used as a type annotation in WalletDaemonClient.__init__ but
never imported, causing NameError at class definition time. Fixed by
importing Config under TYPE_CHECKING guard and using string annotation
'Config' to defer resolution to type-checkers only.
This commit is contained in:
aitbc
2026-05-19 17:25:09 +02:00
parent 88ed8a70cc
commit 93a823c655

View File

@@ -6,7 +6,7 @@ This module provides a client for interacting with the AITBC wallet daemon.
import sys
import json
import base64
from typing import Dict, Any, Optional, List
from typing import TYPE_CHECKING, Dict, Any, Optional, List
from pathlib import Path
from dataclasses import dataclass
@@ -15,6 +15,9 @@ from aitbc import AITBCHTTPClient, NetworkError
sys.path.insert(0, "/opt/aitbc/cli")
from utils import error, success
if TYPE_CHECKING:
from core.config import Config
@dataclass
class ChainInfo:
@@ -62,7 +65,7 @@ class WalletMigrationResult:
class WalletDaemonClient:
"""Client for interacting with AITBC wallet daemon"""
def __init__(self, config: Config):
def __init__(self, config: "Config"):
self.config = config
self.base_url = config.wallet_url.rstrip('/')
self.timeout = getattr(config, 'timeout', 30)