1
0

use contacts in command line

This commit is contained in:
ThomasV
2015-05-31 14:10:52 +02:00
parent 5cd3bfedb6
commit ee5f499fc1
3 changed files with 35 additions and 43 deletions

View File

@@ -461,3 +461,19 @@ class StoreDict(dict):
if key in self.keys():
dict.pop(self, key)
self.save()
import bitcoin
class Contacts(StoreDict):
def __init__(self, config):
StoreDict.__init__(self, config, 'contacts')
def resolve(self, k):
if bitcoin.is_address(k):
return k
if k in self.keys():
_type, addr = self[k]
return addr
raise Exception("invalid Bitcoin address", k)