Fix: Extended private key for electrum.

This commit is contained in:
gerlofvanek
2026-04-27 18:43:31 +02:00
parent fe0de84054
commit a3e6d0cf17
3 changed files with 25 additions and 1 deletions
+6 -1
View File
@@ -2106,7 +2106,12 @@ def initialise_wallets(
continue continue
try: try:
ci = swap_client.ci(c) ci = swap_client.ci(c)
if hasattr(ci, "canExportToElectrum") and ci.canExportToElectrum(): coin_settings = settings["chainclients"].get(coin_name, {})
is_electrum = coin_settings.get("connection_type") == "electrum"
can_export = (
hasattr(ci, "canExportToElectrum") and ci.canExportToElectrum()
)
if can_export or (is_electrum and hasattr(ci, "getAccountKey")):
seed_key = swap_client.getWalletKey(c, 1) seed_key = swap_client.getWalletKey(c, 1)
account_key = ci.getAccountKey(seed_key, zprv_prefix) account_key = ci.getAccountKey(seed_key, zprv_prefix)
extended_keys[getCoinName(c)] = account_key extended_keys[getCoinName(c)] = account_key
+10
View File
@@ -337,6 +337,16 @@
<td class="py-3 px-6">{{ w.expected_seed }}</td> <td class="py-3 px-6">{{ w.expected_seed }}</td>
</tr> </tr>
{% endif %} {% endif %}
{% if w.account_key %}
<tr class="opacity-100 text-gray-500 dark:text-gray-100 hover:bg-coolGray-200 dark:hover:bg-gray-600">
<td class="py-3 px-6 bold">Extended Private Key:</td>
<td class="py-3 px-6">
<span id="account-key-hidden" class="font-mono text-sm">••••••••••••••••</span>
<span id="account-key-value" class="font-mono text-sm hidden break-all">{{ w.account_key }}</span>
<button type="button" id="toggle-account-key" onclick="var h=document.getElementById('account-key-hidden'),v=document.getElementById('account-key-value');if(v.classList.contains('hidden')){v.classList.remove('hidden');h.classList.add('hidden');this.textContent='Hide';}else{v.classList.add('hidden');h.classList.remove('hidden');this.textContent='Show';}" class="ml-2 px-2 py-1 text-xs bg-blue-500 hover:bg-blue-600 text-white rounded">Show</button>
</td>
</tr>
{% endif %}
</table> </table>
</div> </div>
</div> </div>
+9
View File
@@ -473,6 +473,15 @@ def page_wallet(self, url_split, post_string):
getattr(ci, "_connection_type", "rpc") == "electrum" getattr(ci, "_connection_type", "rpc") == "electrum"
) )
if hasattr(ci, "getAccountKey") and k not in (Coins.XMR, Coins.WOW):
try:
chain = swap_client.chain
zprv_prefix = 0x04B2430C if chain == "mainnet" else 0x045F18BC
seed_key = swap_client.getWalletKey(k, 1)
wallet_data["account_key"] = ci.getAccountKey(seed_key, zprv_prefix)
except Exception:
pass
fee_rate, fee_src = swap_client.getFeeRateForCoin(k) fee_rate, fee_src = swap_client.getFeeRateForCoin(k)
est_fee = swap_client.estimateWithdrawFee(k, fee_rate) est_fee = swap_client.estimateWithdrawFee(k, fee_rate)
wallet_data["fee_rate"] = ci.format_amount(int(fee_rate * ci.COIN())) wallet_data["fee_rate"] = ci.format_amount(int(fee_rate * ci.COIN()))