save wallet after making changes

master
lza_menace 2 years ago
parent 0a23715ef8
commit 65990ae26c

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

Loading…
Cancel
Save