refactor: Move all coin interfaces to a dir

2024-05-20_merge
tecnovert 2 years ago
parent 80f0098a3d
commit 20c0c372d0
No known key found for this signature in database
GPG Key ID: 8ED6D8750C4E3F93
  1. 12
      basicswap/basicswap.py
  2. 0
      basicswap/interface/__init__.py
  3. 18
      basicswap/interface/btc.py
  4. 4
      basicswap/interface/ltc.py
  5. 6
      basicswap/interface/nmc.py
  6. 14
      basicswap/interface/part.py
  7. 4
      basicswap/interface/passthrough_btc.py
  8. 8
      basicswap/interface/xmr.py
  9. 4
      tests/basicswap/test_other.py
  10. 2
      tests/basicswap/test_xmr.py

@ -27,12 +27,12 @@ import concurrent.futures
from sqlalchemy.orm import sessionmaker, scoped_session
from sqlalchemy.orm.session import close_all_sessions
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_passthrough_btc import PassthroughBTCInterface
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.passthrough_btc import PassthroughBTCInterface
from . import __version__
from .rpc_xmr import make_xmr_rpc2_func

@ -14,22 +14,22 @@ import traceback
from io import BytesIO
from basicswap.contrib.test_framework import segwit_addr
from .util import (
from basicswap.util import (
dumpj,
ensure,
make_int,
b2h, i2b, b2i, i2h)
from .util.ecc import (
from basicswap.util.ecc import (
ep,
pointToCPK, CPKToPoint,
getSecretInt)
from .util.script import (
from basicswap.util.script import (
decodeScriptNum,
getCompactSizeLen,
SerialiseNumCompact,
getWitnessElementLen,
)
from .util.address import (
from basicswap.util.address import (
toWIF,
b58encode,
decodeWif,
@ -47,7 +47,7 @@ from coincurve.ecdsaotves import (
ecdsaotves_dec_sig,
ecdsaotves_rec_enc_key)
from .contrib.test_framework.messages import (
from basicswap.contrib.test_framework.messages import (
COIN,
COutPoint,
CTransaction,
@ -56,7 +56,7 @@ from .contrib.test_framework.messages import (
CTxOut,
FromHex)
from .contrib.test_framework.script import (
from basicswap.contrib.test_framework.script import (
CScript, CScriptOp,
OP_IF, OP_ELSE, OP_ENDIF,
OP_0, OP_2,
@ -68,11 +68,11 @@ from .contrib.test_framework.script import (
SegwitV0SignatureHash,
hash160)
from .basicswap_util import (
from basicswap.basicswap_util import (
TxLockTypes)
from .chainparams import CoinInterface, Coins
from .rpc import make_rpc_func, openrpc
from basicswap.chainparams import CoinInterface, Coins
from basicswap.rpc import make_rpc_func, openrpc
SEQUENCE_LOCKTIME_GRANULARITY = 9 # 512 seconds

@ -5,8 +5,8 @@
# Distributed under the MIT software license, see the accompanying
# file LICENSE or http://www.opensource.org/licenses/mit-license.php.
from .interface_btc import BTCInterface
from .chainparams import Coins
from .btc import BTCInterface
from basicswap.chainparams import Coins
class LTCInterface(BTCInterface):

@ -5,9 +5,9 @@
# Distributed under the MIT software license, see the accompanying
# file LICENSE or http://www.opensource.org/licenses/mit-license.php.
from .interface_btc import BTCInterface
from .chainparams import Coins
from .util import (
from .btc import BTCInterface
from basicswap.chainparams import Coins
from basicswap.util import (
make_int,
)

@ -8,30 +8,30 @@
import hashlib
from enum import IntEnum
from .contrib.test_framework.messages import (
from basicswap.contrib.test_framework.messages import (
CTxOutPart,
)
from .contrib.test_framework.script import (
from basicswap.contrib.test_framework.script import (
CScript,
OP_0,
OP_DUP, OP_HASH160, OP_EQUALVERIFY, OP_CHECKSIG
)
from .util import (
from basicswap.util import (
i2b,
ensure,
make_int,
TemporaryError,
)
from .util.script import (
from basicswap.util.script import (
getP2WSH,
getCompactSizeLen,
getWitnessElementLen,
)
from .util.address import (
from basicswap.util.address import (
toWIF,
encodeStealthAddress)
from .chainparams import Coins, chainparams
from .interface_btc import BTCInterface
from basicswap.chainparams import Coins, chainparams
from .btc import BTCInterface
class BalanceTypes(IntEnum):

@ -5,8 +5,8 @@
# Distributed under the MIT software license, see the accompanying
# file LICENSE or http://www.opensource.org/licenses/mit-license.php.
from .interface_btc import BTCInterface
from .contrib.test_framework.messages import (
from .btc import BTCInterface
from basicswap.contrib.test_framework.messages import (
CTxOut)

@ -24,18 +24,18 @@ from coincurve.dleag import (
verify_ed25519_point,
)
from .util import (
from basicswap.util import (
dumpj,
ensure,
make_int,
TemporaryError)
from .rpc_xmr import (
from basicswap.rpc_xmr import (
make_xmr_rpc_func,
make_xmr_rpc2_func,
make_xmr_wallet_rpc_func)
from .util import (
from basicswap.util import (
b2i, b2h)
from .chainparams import XMR_COIN, CoinInterface, Coins
from basicswap.chainparams import XMR_COIN, CoinInterface, Coins
class XMRInterface(CoinInterface):

@ -24,8 +24,8 @@ from coincurve.keys import (
from basicswap.util import i2b, h2b
from basicswap.util.crypto import ripemd160
from basicswap.util.rfc2440 import rfc2440_hash_password
from basicswap.interface_btc import BTCInterface
from basicswap.interface_xmr import XMRInterface
from basicswap.interface.btc import BTCInterface
from basicswap.interface.xmr import XMRInterface
from basicswap.basicswap_util import (
TxLockTypes)

@ -48,7 +48,7 @@ from basicswap.rpc_xmr import (
callrpc_xmr,
callrpc_xmr_na,
)
from basicswap.interface_xmr import (
from basicswap.interface.xmr import (
XMR_COIN,
)
from basicswap.contrib.key import (

Loading…
Cancel
Save