From 424ff14e3cf64658913462eebed6b33815ca7ed4 Mon Sep 17 00:00:00 2001 From: Liquid369 Date: Mon, 8 Jul 2024 18:38:11 -0500 Subject: [PATCH] Update blockbook and API to handle customization --- src/apiClient.py | 7 ++++--- src/blockbookClient.py | 14 ++++++++------ 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/src/apiClient.py b/src/apiClient.py index 2205db8..a54e903 100644 --- a/src/apiClient.py +++ b/src/apiClient.py @@ -31,9 +31,10 @@ def process_api_exceptions_int(*args, **kwargs): class ApiClient: - def __init__(self, isTestnet=False): - self.isTestnet = isTestnet - self.api = BlockBookClient(isTestnet) + def __init__(self, main_wnd): + self.main_wnd = main_wnd + self.isTestnet = main_wnd.isTestnetRPC + self.api = BlockBookClient(main_wnd, self.isTestnet) @process_api_exceptions def getAddressUtxos(self, address): diff --git a/src/blockbookClient.py b/src/blockbookClient.py index 4348542..da0f733 100644 --- a/src/blockbookClient.py +++ b/src/blockbookClient.py @@ -32,13 +32,16 @@ def process_blockbook_exceptions_int(*args, **kwargs): class BlockBookClient: - - def __init__(self, isTestnet=False): + def __init__(self, main_wnd, isTestnet=False): + self.main_wnd = main_wnd self.isTestnet = isTestnet - if isTestnet: - self.url = "https://testnet.rockdev.org/" + self.loadURL() + + def loadURL(self): + if self.isTestnet: + self.url = self.main_wnd.getExplorerURL('testnet') else: - self.url = "https://explorer.rockdev.org/" + self.url = self.main_wnd.getExplorerURL('mainnet') def checkResponse(self, method, param=""): url = self.url + "/api/%s" % method @@ -53,7 +56,6 @@ def checkResponse(self, method, param=""): @process_blockbook_exceptions def getAddressUtxos(self, address): utxos = self.checkResponse("utxo", address) - # Add script for cryptoID legacy for u in utxos: u["script"] = "" return utxos