From 7e42ad7ccee67c5bd5bd26333cc8a577312c6106 Mon Sep 17 00:00:00 2001 From: lukewarm Date: Sat, 12 Dec 2015 17:53:22 -0500 Subject: [PATCH 1/2] Address webhook desired confirmation and confidence Added to function subscribe_to_address_webhook two parameters that accept custom values of confirmations and confidence for tx-confirmation and tx-confidence event types, respectively. --- blockcypher/api.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/blockcypher/api.py b/blockcypher/api.py index 6162cef..d26bc35 100644 --- a/blockcypher/api.py +++ b/blockcypher/api.py @@ -919,7 +919,7 @@ def delete_forwarding_address(payment_id, coin_symbol='btc'): def subscribe_to_address_webhook(callback_url, subscription_address, - event='tx-confirmation', coin_symbol='btc', api_key=None): + event='tx-confirmation', coin_symbol='btc', confirmations=6, confidence=0.99, api_key=None): ''' Subscribe to transaction webhooks on a given address. Webhooks for transaction broadcast and each confirmation (up to 6). @@ -945,6 +945,11 @@ def subscribe_to_address_webhook(callback_url, subscription_address, if api_key: data['token'] = api_key + + if event == 'tx-confirmation': + data['confirmations'] = confirmations + elif event == 'tx-confidence': + data['confidence'] = confidence r = requests.post(url, json=data, verify=True, timeout=TIMEOUT_IN_SECONDS) From c30a81b69283f2aafd1a283a7d86f5787b2cf6d9 Mon Sep 17 00:00:00 2001 From: lukewarm Date: Sun, 13 Dec 2015 13:00:21 -0500 Subject: [PATCH 2/2] Fix bug in api.get_addresses_details --- blockcypher/api.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/blockcypher/api.py b/blockcypher/api.py index d26bc35..cf4c599 100644 --- a/blockcypher/api.py +++ b/blockcypher/api.py @@ -150,7 +150,7 @@ def get_addresses_details(address_list, coin_symbol='btc', txn_limit=None, api_k cleaned_dict_list = [] for response_dict in r.json(): - cleaned_dict_list.append(_clean_tx(response_dict=r.json())) + cleaned_dict_list.append(_clean_tx(response_dict=response_dict)) return cleaned_dict_list