mirror of
https://github.com/basicswap/basicswap.git
synced 2025-11-06 02:38:11 +01:00
api: Fix offers path.
This commit is contained in:
@@ -29,6 +29,7 @@ from .interface_btc import BTCInterface
|
||||
from .interface_ltc import LTCInterface
|
||||
from .interface_nmc import NMCInterface
|
||||
from .interface_xmr import XMRInterface
|
||||
from .interface_bitcore_btc import BitcoreBTCInterface
|
||||
|
||||
from . import __version__
|
||||
from .util import (
|
||||
@@ -600,6 +601,12 @@ class BasicSwap(BaseApp):
|
||||
else:
|
||||
raise ValueError('Unknown coin type')
|
||||
|
||||
def createBitcoreInterface(self, coin):
|
||||
if coin == Coins.BTC:
|
||||
return BitcoreBTCInterface(self.coin_clients[coin], self.chain)
|
||||
else:
|
||||
raise ValueError('Unknown coin type')
|
||||
|
||||
def setCoinRunParams(self, coin):
|
||||
cc = self.coin_clients[coin]
|
||||
if coin == Coins.XMR:
|
||||
@@ -636,6 +643,8 @@ class BasicSwap(BaseApp):
|
||||
def createCoinInterface(self, coin):
|
||||
if self.coin_clients[coin]['connection_type'] == 'rpc':
|
||||
self.coin_clients[coin]['interface'] = self.createInterface(coin)
|
||||
elif self.coin_clients[coin]['connection_type'] == 'bitcore':
|
||||
self.coin_clients[coin]['interface'] = self.createBitcoreInterface(coin)
|
||||
|
||||
def start(self):
|
||||
self.log.info('Starting BasicSwap %s, database v%d\n\n', __version__, self.db_version)
|
||||
|
||||
19
basicswap/interface_bitcore_btc.py
Normal file
19
basicswap/interface_bitcore_btc.py
Normal file
@@ -0,0 +1,19 @@
|
||||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Copyright (c) 2021 tecnovert
|
||||
# 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 (
|
||||
CTxOut)
|
||||
|
||||
|
||||
class BitcoreBTCInterface(BTCInterface):
|
||||
def __init__(self, coin_settings, network):
|
||||
super().__init__(coin_settings, network)
|
||||
self.txoType = CTxOut
|
||||
self._network = network
|
||||
self.blocks_confirmed = coin_settings['blocks_confirmed']
|
||||
self.setConfTarget(coin_settings['conf_target'])
|
||||
@@ -31,7 +31,7 @@ from .rpc_xmr import (
|
||||
make_xmr_rpc2_func,
|
||||
make_xmr_wallet_rpc_func)
|
||||
from .ecc_util import (
|
||||
b2i, i2b, b2h)
|
||||
b2i, b2h)
|
||||
from .chainparams import CoinInterface, Coins
|
||||
|
||||
XMR_COIN = 10 ** 12
|
||||
|
||||
@@ -58,8 +58,8 @@ def js_offers(self, url_split, post_string, sent=False):
|
||||
|
||||
if post_string != '':
|
||||
post_data = urllib.parse.parse_qs(post_string)
|
||||
filters['coin_from'] = setCoinFilter(form_data, b'coin_from')
|
||||
filters['coin_to'] = setCoinFilter(form_data, b'coin_to')
|
||||
filters['coin_from'] = setCoinFilter(post_data, b'coin_from')
|
||||
filters['coin_to'] = setCoinFilter(post_data, b'coin_to')
|
||||
|
||||
if b'sort_by' in post_data:
|
||||
sort_by = post_data[b'sort_by'][0].decode('utf-8')
|
||||
|
||||
Reference in New Issue
Block a user