diff --git a/basicswap/__init__.py b/basicswap/__init__.py index d77e35a..18d9033 100644 --- a/basicswap/__init__.py +++ b/basicswap/__init__.py @@ -1,3 +1,3 @@ name = "basicswap" -__version__ = "0.11.57" +__version__ = "0.11.58" diff --git a/basicswap/basicswap.py b/basicswap/basicswap.py index 3d00412..edebcfb 100644 --- a/basicswap/basicswap.py +++ b/basicswap/basicswap.py @@ -5838,6 +5838,9 @@ class BasicSwap(BaseApp): filter_coin_to = filters.get('coin_to', None) if filter_coin_to and filter_coin_to > -1: q = q.filter(Offer.coin_to == int(filter_coin_to)) + filter_include_sent = filters.get('include_sent', None) + if filter_include_sent and filter_include_sent is not True: + q = q.filter(Offer.was_sent == False) # noqa: E712 order_dir = filters.get('sort_dir', 'desc') order_by = filters.get('sort_by', 'created_at') diff --git a/basicswap/js_server.py b/basicswap/js_server.py index 8ed3815..f48cfcc 100644 --- a/basicswap/js_server.py +++ b/basicswap/js_server.py @@ -171,6 +171,8 @@ def js_offers(self, url_split, post_string, is_json, sent=False) -> bytes: assert (filters['limit'] > 0 and filters['limit'] <= PAGE_LIMIT), 'Invalid limit' if have_data_entry(post_data, 'active'): filters['active'] = get_data_entry(post_data, 'active') + if have_data_entry(post_data, 'include_sent'): + filters['include_sent'] = toBool(get_data_entry(post_data, 'include_sent')) offers = swap_client.listOffers(sent, filters) rv = [] diff --git a/basicswap/util/__init__.py b/basicswap/util/__init__.py index eec8a70..d85938a 100644 --- a/basicswap/util/__init__.py +++ b/basicswap/util/__init__.py @@ -47,6 +47,8 @@ def ensure(v, err_string): def toBool(s) -> bool: + if isinstance(s, bool): + return s return s.lower() in ['1', 'true'] diff --git a/bin/basicswap_prepare.py b/bin/basicswap_prepare.py index 10192c9..5bf0af5 100755 --- a/bin/basicswap_prepare.py +++ b/bin/basicswap_prepare.py @@ -663,7 +663,7 @@ def prepareCore(coin, version_data, settings, data_dir, extra_opts={}): for key in rv.fingerprints: gpg.trust_keys(rv.fingerprints[0], 'TRUST_FULLY') - if coin in ('pivx', 'firo'): + if coin in ('firo', ): pubkey_filename = '{}_{}.pgp'.format('particl', signing_key_name) else: pubkey_filename = '{}_{}.pgp'.format(coin, signing_key_name) diff --git a/guix.scm b/guix.scm index 7e602ab..cf8133a 100644 --- a/guix.scm +++ b/guix.scm @@ -117,15 +117,15 @@ (define-public basicswap (package (name "basicswap") - (version "0.11.55") + (version "0.11.58") (source (origin (method git-fetch) (uri (git-reference (url "https://github.com/tecnovert/basicswap") - (commit "ac07727da7ec0f6bf2df832843dcaafc7dd7046a"))) + (commit "9729dcf526917eb5e128dd72b091464d1e72fe54"))) (sha256 (base32 - "1xg70jyvggkcr0la7lnj96w34pxrr0sp59d174jpgmlfs625ybbk")) + "0sjxk4c9vzn5fr8dqxrmvgw1267njjkblajxvqf3kls5b2s7l41k")) (file-name (git-file-name name version)))) (build-system python-build-system) diff --git a/scripts/createoffers.py b/scripts/createoffers.py index 46ab445..73e3710 100755 --- a/scripts/createoffers.py +++ b/scripts/createoffers.py @@ -75,6 +75,7 @@ def readTemplates(known_coins): offer_template['minrate'] = float(row_data[3]) offer_template['ratetweakpercent'] = float(row_data[4]) offer_template['amount_variable'] = row_data[5].lower() in ('true', 1) + offer_template['address'] = row_data[6] offer_templates.append(offer_template) except Exception as e: print(f'Warning: Skipping row {i}, {e}') @@ -91,7 +92,8 @@ def main(): if not os.path.exists('offer_rules.csv'): with open('offer_rules.csv', 'w') as fp: - fp.write('coin from,coin to,offer value,min rate,rate tweak percent,amount variable') + # Set address to -1 to use new addresses + fp.write('coin from,coin to,offer value,min rate,rate tweak percent,amount variable,address') known_coins = read_json_api(args.port, 'coins') coins_map = {} @@ -104,6 +106,9 @@ def main(): offer_templates = readTemplates(known_coins) try: + recieved_offers = read_json_api(args.port, 'offers', {'active': 'active', 'include_sent': False}) + print('recieved_offers', recieved_offers) + sent_offers = read_json_api(args.port, 'sentoffers', {'active': 'active'}) for offer_template in offer_templates: @@ -133,7 +138,7 @@ def main(): print('Creating offer for: {} at rate: {}'.format(offer_template, use_rate)) offer_data = { - 'addr_from': '-1', + 'addr_from': offer_template['address'], 'coin_from': coin_from_data['ticker'], 'coin_to': coin_to_data['ticker'], 'amt_from': offer_template['amount'],