Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Address webhook custom confirmations and confidence #23

Merged
merged 2 commits into from
Dec 24, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions blockcypher/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down Expand Up @@ -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).
Expand All @@ -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)

Expand Down