mirror of
https://github.com/basicswap/basicswap.git
synced 2024-12-23 03:49:25 +00:00
ui: Hide all except 'Reseed Wallet' button if expected_seed is false.
This commit is contained in:
parent
eb9eb49bd9
commit
6ae8651d1b
3 changed files with 13 additions and 10 deletions
|
@ -704,7 +704,7 @@ class BasicSwap(BaseApp):
|
|||
if synced < 1.0:
|
||||
raise ValueError('{} chain is still syncing, currently at {}.'.format(self.coin_clients[c]['name'], synced))
|
||||
|
||||
def initialiseWallet(self, coin_type):
|
||||
def initialiseWallet(self, coin_type, raise_errors=False):
|
||||
if coin_type == Coins.PART:
|
||||
return
|
||||
ci = self.ci(coin_type)
|
||||
|
@ -722,7 +722,14 @@ class BasicSwap(BaseApp):
|
|||
|
||||
root_key = self.getWalletKey(coin_type, 1)
|
||||
root_hash = ci.getAddressHashFromKey(root_key)[::-1]
|
||||
ci.initialiseWallet(root_key)
|
||||
|
||||
try:
|
||||
ci.initialiseWallet(root_key)
|
||||
except Exception as e:
|
||||
# < 0.21: sethdseed cannot set a new HD seed while still in Initial Block Download.
|
||||
self._log.error('initialiseWallet failed: {}'.format(str(e)))
|
||||
if raise_errors:
|
||||
raise e
|
||||
|
||||
key_str = 'main_wallet_seedid_' + ci.coin_name().lower()
|
||||
self.setStringKV(key_str, root_hash.hex())
|
||||
|
@ -1499,7 +1506,7 @@ class BasicSwap(BaseApp):
|
|||
if ci.knownWalletSeed():
|
||||
raise ValueError('{} wallet seed is already derived from the particl mnemonic'.format(ci.coin_name()))
|
||||
|
||||
self.initialiseWallet(coin_type)
|
||||
self.initialiseWallet(coin_type, raise_errors=True)
|
||||
|
||||
# TODO: How to scan pruned blocks?
|
||||
|
||||
|
|
|
@ -259,11 +259,7 @@ class BTCInterface(CoinInterface):
|
|||
def initialiseWallet(self, key_bytes):
|
||||
key_wif = self.encodeKey(key_bytes)
|
||||
|
||||
try:
|
||||
self.rpc_callback('sethdseed', [True, key_wif])
|
||||
except Exception as e:
|
||||
# < 0.21: Cannot set a new HD seed while still in Initial Block Download.
|
||||
self._log.error('sethdseed failed: {}'.format(str(e)))
|
||||
self.rpc_callback('sethdseed', [True, key_wif])
|
||||
|
||||
def getWalletInfo(self):
|
||||
return self.rpc_callback('getwalletinfo')
|
||||
|
|
|
@ -177,7 +177,7 @@
|
|||
<td>{{ w.expected_seed }}</td>{% if w.expected_seed != true %}
|
||||
<td>
|
||||
<input class="appearance-none bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg outline-none focus:ring-blue-500 focus:border-blue-500 block p-2.5" type="submit" name="reseed_{{ w.cid }}" value="Reseed wallet" onclick="return confirmReseed();">
|
||||
</td>{% endif %}
|
||||
</td> </tr></table> {% else %}
|
||||
</tr> {% if w.cid == '1' %}
|
||||
<tr class="bg-white border-t hover:bg-gray-50">
|
||||
<td class="py-4 px-6 bold">Stealth Address</td>
|
||||
|
@ -317,7 +317,7 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div> {% endif %} {% endif %} {% endif %} {% endif %}
|
||||
</div> {% endif %} {% endif %} {% endif %} {% endif %} {% endif %}
|
||||
<!-- havedata -->
|
||||
<input type="hidden" name="formid" value="{{ form_id }}">
|
||||
</form>
|
||||
|
|
Loading…
Reference in a new issue