From 65990ae26c47f82777be027dd42437d7600fa15d Mon Sep 17 00:00:00 2001 From: lza_menace Date: Fri, 2 Sep 2022 08:17:31 -0700 Subject: [PATCH] save wallet after making changes --- suchwow/wownero.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/suchwow/wownero.py b/suchwow/wownero.py index 73e65ff..d8eb95b 100644 --- a/suchwow/wownero.py +++ b/suchwow/wownero.py @@ -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):