|
|
@ -33,13 +33,17 @@ class Wallet(object):
|
|
|
|
r = requests.get(
|
|
|
|
r = requests.get(
|
|
|
|
self.endpoint,
|
|
|
|
self.endpoint,
|
|
|
|
data=json.dumps({'method': method, 'params': params}),
|
|
|
|
data=json.dumps({'method': method, 'params': params}),
|
|
|
|
auth=self.auth
|
|
|
|
auth=self.auth,
|
|
|
|
|
|
|
|
timeout=10
|
|
|
|
)
|
|
|
|
)
|
|
|
|
if 'error' in r.json():
|
|
|
|
if 'error' in r.json():
|
|
|
|
return r.json()['error']
|
|
|
|
return r.json()['error']
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
return r.json()['result']
|
|
|
|
return r.json()['result']
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def store(self):
|
|
|
|
|
|
|
|
self.make_wallet_rpc('store')
|
|
|
|
|
|
|
|
|
|
|
|
def height(self):
|
|
|
|
def height(self):
|
|
|
|
return self.make_wallet_rpc('get_height', {})
|
|
|
|
return self.make_wallet_rpc('get_height', {})
|
|
|
|
|
|
|
|
|
|
|
@ -58,6 +62,7 @@ class Wallet(object):
|
|
|
|
|
|
|
|
|
|
|
|
def new_account(self, label=None):
|
|
|
|
def new_account(self, label=None):
|
|
|
|
_account = self.make_wallet_rpc('create_account', {'label': label})
|
|
|
|
_account = self.make_wallet_rpc('create_account', {'label': label})
|
|
|
|
|
|
|
|
self.store()
|
|
|
|
return _account['account_index']
|
|
|
|
return _account['account_index']
|
|
|
|
|
|
|
|
|
|
|
|
def addresses(self, account, addr_indices=None):
|
|
|
|
def addresses(self, account, addr_indices=None):
|
|
|
@ -83,6 +88,7 @@ class Wallet(object):
|
|
|
|
def new_address(self, account, label=None):
|
|
|
|
def new_address(self, account, label=None):
|
|
|
|
data = {'account_index': account, 'label': label}
|
|
|
|
data = {'account_index': account, 'label': label}
|
|
|
|
_address = self.make_wallet_rpc('create_address', data)
|
|
|
|
_address = self.make_wallet_rpc('create_address', data)
|
|
|
|
|
|
|
|
self.store()
|
|
|
|
return (_address['address_index'], _address['address'])
|
|
|
|
return (_address['address_index'], _address['address'])
|
|
|
|
|
|
|
|
|
|
|
|
def transfers(self, account, address_indices=[]):
|
|
|
|
def transfers(self, account, address_indices=[]):
|
|
|
@ -113,6 +119,7 @@ class Wallet(object):
|
|
|
|
'ring_size': 22
|
|
|
|
'ring_size': 22
|
|
|
|
}
|
|
|
|
}
|
|
|
|
transfer = self.make_wallet_rpc('transfer', data)
|
|
|
|
transfer = self.make_wallet_rpc('transfer', data)
|
|
|
|
|
|
|
|
self.store()
|
|
|
|
return transfer
|
|
|
|
return transfer
|
|
|
|
|
|
|
|
|
|
|
|
def sweep_all(self, account, dest_address):
|
|
|
|
def sweep_all(self, account, dest_address):
|
|
|
@ -121,6 +128,7 @@ class Wallet(object):
|
|
|
|
'account_index': account,
|
|
|
|
'account_index': account,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
sweep = self.make_wallet_rpc('sweep_all', data)
|
|
|
|
sweep = self.make_wallet_rpc('sweep_all', data)
|
|
|
|
|
|
|
|
self.store()
|
|
|
|
return sweep
|
|
|
|
return sweep
|
|
|
|
|
|
|
|
|
|
|
|
def incoming_transfers(self, account, transfer_type='all', verbose=True):
|
|
|
|
def incoming_transfers(self, account, transfer_type='all', verbose=True):
|
|
|
|