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