mirror of
https://github.com/basicswap/basicswap.git
synced 2025-11-06 02:38:11 +01:00
refactor: Lazy load interfaces.
This commit is contained in:
@@ -32,14 +32,6 @@ from sqlalchemy.orm.session import close_all_sessions
|
||||
|
||||
from .interface import Curves
|
||||
from .interface.part import PARTInterface, PARTInterfaceAnon, PARTInterfaceBlind
|
||||
from .interface.btc import BTCInterface
|
||||
from .interface.ltc import LTCInterface
|
||||
from .interface.nmc import NMCInterface
|
||||
from .interface.xmr import XMRInterface
|
||||
from .interface.pivx import PIVXInterface
|
||||
from .interface.dash import DASHInterface
|
||||
from .interface.firo import FIROInterface
|
||||
from .interface.passthrough_btc import PassthroughBTCInterface
|
||||
|
||||
from . import __version__
|
||||
from .rpc_xmr import make_xmr_rpc2_func
|
||||
@@ -578,27 +570,35 @@ class BasicSwap(BaseApp):
|
||||
if coin == Coins.PART:
|
||||
return PARTInterface(self.coin_clients[coin], self.chain, self)
|
||||
elif coin == Coins.BTC:
|
||||
from .interface.btc import BTCInterface
|
||||
return BTCInterface(self.coin_clients[coin], self.chain, self)
|
||||
elif coin == Coins.LTC:
|
||||
from .interface.ltc import LTCInterface
|
||||
return LTCInterface(self.coin_clients[coin], self.chain, self)
|
||||
elif coin == Coins.NMC:
|
||||
from .interface.nmc import NMCInterface
|
||||
return NMCInterface(self.coin_clients[coin], self.chain, self)
|
||||
elif coin == Coins.XMR:
|
||||
from .interface.xmr import XMRInterface
|
||||
xmr_i = XMRInterface(self.coin_clients[coin], self.chain, self)
|
||||
chain_client_settings = self.getChainClientSettings(coin)
|
||||
xmr_i.setWalletFilename(chain_client_settings['walletfile'])
|
||||
return xmr_i
|
||||
elif coin == Coins.PIVX:
|
||||
from .interface.pivx import PIVXInterface
|
||||
return PIVXInterface(self.coin_clients[coin], self.chain, self)
|
||||
elif coin == Coins.DASH:
|
||||
from .interface.dash import DASHInterface
|
||||
return DASHInterface(self.coin_clients[coin], self.chain, self)
|
||||
elif coin == Coins.FIRO:
|
||||
from .interface.firo import FIROInterface
|
||||
return FIROInterface(self.coin_clients[coin], self.chain, self)
|
||||
else:
|
||||
raise ValueError('Unknown coin type')
|
||||
|
||||
def createPassthroughInterface(self, coin):
|
||||
if coin == Coins.BTC:
|
||||
from .interface.passthrough_btc import PassthroughBTCInterface
|
||||
return PassthroughBTCInterface(self.coin_clients[coin], self.chain)
|
||||
else:
|
||||
raise ValueError('Unknown coin type')
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Copyright (c) 2019-2022 tecnovert
|
||||
# Copyright (c) 2019-2023 tecnovert
|
||||
# Distributed under the MIT software license, see the accompanying
|
||||
# file LICENSE or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
@@ -36,18 +36,3 @@ NAMECOIN_TX = os.getenv('NAMECOIN_TX', 'namecoin-tx' + bin_suffix)
|
||||
XMR_BINDIR = os.path.expanduser(os.getenv('XMR_BINDIR', os.path.join(DEFAULT_TEST_BINDIR, 'monero')))
|
||||
XMRD = os.getenv('XMRD', 'monerod' + bin_suffix)
|
||||
XMR_WALLET_RPC = os.getenv('XMR_WALLET_RPC', 'monero-wallet-rpc' + bin_suffix)
|
||||
|
||||
PIVX_BINDIR = os.path.expanduser(os.getenv('PIVX_BINDIR', os.path.join(DEFAULT_TEST_BINDIR, 'pivx')))
|
||||
PIVXD = os.getenv('PIVXD', 'pivxd' + bin_suffix)
|
||||
PIVX_CLI = os.getenv('PIVX_CLI', 'pivx-cli' + bin_suffix)
|
||||
PIVX_TX = os.getenv('PIVX_TX', 'pivx-tx' + bin_suffix)
|
||||
|
||||
DASH_BINDIR = os.path.expanduser(os.getenv('DASH_BINDIR', os.path.join(DEFAULT_TEST_BINDIR, 'dash')))
|
||||
DASHD = os.getenv('DASHD', 'dashd' + bin_suffix)
|
||||
DASH_CLI = os.getenv('DASH_CLI', 'dash-cli' + bin_suffix)
|
||||
DASH_TX = os.getenv('DASH_TX', 'dash-tx' + bin_suffix)
|
||||
|
||||
FIRO_BINDIR = os.path.expanduser(os.getenv('FIRO_BINDIR', os.path.join(DEFAULT_TEST_BINDIR, 'firo')))
|
||||
FIROD = os.getenv('FIROD', 'firod' + bin_suffix)
|
||||
FIRO_CLI = os.getenv('FIRO_CLI', 'firo-cli' + bin_suffix)
|
||||
FIRO_TX = os.getenv('FIRO_TX', 'firo-tx' + bin_suffix)
|
||||
|
||||
Reference in New Issue
Block a user