mirror of
https://github.com/LBRYFoundation/LBRY-Vault.git
synced 2025-09-01 01:35:20 +00:00
add watchaddress command
This commit is contained in:
parent
3c11c63289
commit
9b5b9849d7
1 changed files with 16 additions and 0 deletions
|
@ -600,6 +600,22 @@ class Commands:
|
||||||
for k in self.wallet.receive_requests.keys():
|
for k in self.wallet.receive_requests.keys():
|
||||||
self.wallet.remove_payment_request(k, self.config)
|
self.wallet.remove_payment_request(k, self.config)
|
||||||
|
|
||||||
|
@command('n')
|
||||||
|
def watchaddress(self, address, URL):
|
||||||
|
"""Watch an address. Everytime the address changes, a http POST is sent to the URL."""
|
||||||
|
def callback(x):
|
||||||
|
import urllib2
|
||||||
|
headers = {'content-type':'application/json'}
|
||||||
|
data = {'address':address, 'status':x.get('result')}
|
||||||
|
try:
|
||||||
|
req = urllib2.Request(URL, json.dumps(data), headers)
|
||||||
|
response_stream = urllib2.urlopen(req)
|
||||||
|
util.print_error('Got Response for %s' % address)
|
||||||
|
except BaseException as e:
|
||||||
|
util.print_error(str(e))
|
||||||
|
self.network.send([('blockchain.address.subscribe', [address])], callback)
|
||||||
|
return "ok"
|
||||||
|
|
||||||
|
|
||||||
param_descriptions = {
|
param_descriptions = {
|
||||||
'privkey': 'Private key. Type \'?\' to get a prompt.',
|
'privkey': 'Private key. Type \'?\' to get a prompt.',
|
||||||
|
|
Loading…
Add table
Reference in a new issue