Skip to content

Commit

Permalink
Merge branch 'master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
k9ert authored Sep 20, 2023
2 parents 298b8d0 + 6a51d31 commit eef3c40
Show file tree
Hide file tree
Showing 8 changed files with 59 additions and 87 deletions.
6 changes: 3 additions & 3 deletions pyinstaller/electron/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -704,9 +704,9 @@ [email protected]:
lazy-val "^1.0.5"
mime "^2.5.2"

electron@^22.1.0:
version "22.1.0"
resolved "https://registry.npmjs.org/electron/-/electron-22.1.0.tgz"
electron@^22.3.21:
version "22.3.21"
resolved "https://registry.yarnpkg.com/electron/-/electron-22.3.21.tgz#a817446cc1e62e9650522fa7eae389f9fc5b5e19"
dependencies:
"@electron/get" "^2.0.0"
"@types/node" "^16.11.26"
Expand Down
3 changes: 3 additions & 0 deletions src/cryptoadvance/specter/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,9 @@ class BaseConfig(object):
CERT = os.getenv("CERT", None)
KEY = os.getenv("KEY", None)

# It might be necessary to enforce the HWI initialisation
ENFORCE_HWI_INITIALISATION_AT_STARTUP = False

# This will be used to search for a bitcoin.conf in order to enable the
# auth method "RPC password as pin"
RASPIBLITZ_SPECTER_RPC_LOGIN_BITCOIN_CONF_LOCATION = os.getenv(
Expand Down
11 changes: 6 additions & 5 deletions src/cryptoadvance/specter/devices/hwi/jade.py
Original file line number Diff line number Diff line change
Expand Up @@ -556,10 +556,11 @@ def display_multisig_address(
paths.append(parse_path(path))

# sort origins, signers and paths according to origins (like in _get_multisig_name)
signer_origins, signers, paths = [
list(a) for a in zip(*sorted(zip(signer_origins, signers, paths)))
]

# But, only sort if sorted_multi is used (and thus the order of xpubs is not relevant)
if multisig.is_sorted:
signer_origins, signers, paths = [
list(a) for a in zip(*sorted(zip(signer_origins, signers, paths)))
]
# Get a deterministic name for this multisig wallet
script_variant = self._convertAddrType(addr_type, multisig=True)
multisig_name = self._get_multisig_name(
Expand All @@ -572,7 +573,7 @@ def display_multisig_address(
self._network(),
multisig_name,
script_variant,
True, # always use sorted
multisig.is_sorted,
multisig.thresh,
signers,
)
Expand Down
9 changes: 8 additions & 1 deletion src/cryptoadvance/specter/hwi_rpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ class HWIBridge(JSONRPC):
All methods of this class are callable over JSON-RPC, except _underscored.
"""

def __init__(self):
def __init__(self, enforce_hwi_initialisation=False):
self.exposed_rpc = {
"enumerate": self.enumerate,
"detect_device": self.detect_device,
Expand All @@ -81,6 +81,13 @@ def __init__(self):
"extract_master_blinding_key": self.extract_master_blinding_key,
"bitbox02_pairing": self.bitbox02_pairing,
}
if enforce_hwi_initialisation:
# Running enumerate after beginning an interaction with a specific device
# crashes python or make HWI misbehave. For now we just get all connected
# devices once per session and save them.
logger.info("Initializing HWI...") # to explain user why it takes so long
self.enumerate()
logger.info("Finished initializing HWI!")
self.devices = []

@locked(hwilock)
Expand Down
2 changes: 1 addition & 1 deletion src/cryptoadvance/specter/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ def service_manager_cleanup_on_exit(signum, frame):
specter.initialize()

# HWI
specter.hwi = HWIBridge()
specter.hwi = HWIBridge(app.config["ENFORCE_HWI_INITIALISATION_AT_STARTUP"])

login_manager = LoginManager()
login_manager.session_protection = app.config.get("SESSION_PROTECTION", "strong")
Expand Down
36 changes: 4 additions & 32 deletions src/cryptoadvance/specter/templates/components/price_bar.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -79,57 +79,29 @@
<select class="floating-input peer" name="price_provider" id="price_provider" onchange="providerChanged()">
<option data-currency-type="usd" value="bitstamp_usd" {% if specter.price_provider == 'bitstamp' %}selected{% endif %}>Bitstamp USD</option>
<option data-currency-type="usd" value="coindesk_usd" {% if specter.price_provider == 'coindesk' %}selected{% endif %}>Coindesk USD</option>
<option data-currency-type="usd" value="spotbit_coinbase" {% if specter.price_provider == 'spotbit_coinbase' %}selected{% endif %}>Spotbit Coinbase (Tor) USD</option>
<option data-currency-type="usd" value="spotbit_kraken" {% if specter.price_provider == 'spotbit_kraken' %}selected{% endif %}>Spotbit Kraken (Tor) USD</option>
<option data-currency-type="usd" value="spotbit_bitfinex" {% if specter.price_provider == 'spotbit_bitfinex' %}selected{% endif %}>Spotbit Bitfinex (Tor) USD</option>
<option data-currency-type="usd" value="spotbit_okcoin" {% if specter.price_provider == 'spotbit_okcoin' %}selected{% endif %}>Spotbit OKCoin (Tor) USD</option>
<option data-currency-type="usd" value="spotbit_bitstamp" {% if specter.price_provider == 'spotbit_bitstamp' %}selected{% endif %}>Spotbit Bitstamp (Tor) USD</option>
<option data-currency-type="usd" value="spotbit_bitstamp_usd" {% if specter.price_provider == 'spotbit_bitstamp_usd' %}selected{% endif %}>Spotbit Bitstamp (Tor) USD</option>
<option data-currency-type="usd" value="spotbit_gemini_usd" {% if specter.price_provider == 'spotbit_gemini_usd' %}selected{% endif %}>Spotbit Gemini (Tor) USD</option>
<option data-currency-type="eur" value="bitstamp_eur" {% if specter.price_provider == 'bitstamp_eur' %}selected{% endif %}>Bitstamp EUR</option>
<option data-currency-type="eur" value="coindesk_eur" {% if specter.price_provider == 'coindesk_eur' %}selected{% endif %}>Coindesk EUR</option>
<option data-currency-type="eur" value="spotbit_coinbase_eur" {% if specter.price_provider == 'spotbit_coinbase_eur' %}selected{% endif %}>Spotbit Coinbase (Tor) EUR</option>
<option data-currency-type="eur" value="spotbit_kraken_eur" {% if specter.price_provider == 'spotbit_kraken_eur' %}selected{% endif %}>Spotbit Kraken (Tor) EUR</option>
<option data-currency-type="eur" value="spotbit_bitfinex_eur" {% if specter.price_provider == 'spotbit_bitfinex_eur' %}selected{% endif %}>Spotbit Bitfinex (Tor) EUR</option>
<option data-currency-type="eur" value="spotbit_okcoin_eur" {% if specter.price_provider == 'spotbit_okcoin_eur' %}selected{% endif %}>Spotbit OKCoin (Tor) EUR</option>
<option data-currency-type="eur" value="spotbit_bitstamp_eur" {% if specter.price_provider == 'spotbit_bitstamp_eur' %}selected{% endif %}>Spotbit Bitstamp (Tor) EUR</option>
<option data-currency-type="eur" value="spotbit_gemini_eur" {% if specter.price_provider == 'spotbit_gemini_eur' %}selected{% endif %}>Spotbit Gemini (Tor) EUR</option>
<option data-currency-type="gbp" value="bitstamp_gbp" {% if specter.price_provider == 'bitstamp_gbp' %}selected{% endif %}>Bitstamp GBP</option>
<option data-currency-type="gbp" value="coindesk_gbp" {% if specter.price_provider == 'coindesk_gbp' %}selected{% endif %}>Coindesk GBP</option>
<option data-currency-type="gbp" value="spotbit_coinbase_gbp" {% if specter.price_provider == 'spotbit_coinbase_gbp' %}selected{% endif %}>Spotbit Coinbase (Tor) GBP</option>
<option data-currency-type="gbp" value="spotbit_kraken_gbp" {% if specter.price_provider == 'spotbit_kraken_gbp' %}selected{% endif %}>Spotbit Kraken (Tor) GBP</option>
<option data-currency-type="gbp" value="spotbit_bitfinex_gbp" {% if specter.price_provider == 'spotbit_bitfinex_gbp' %}selected{% endif %}>Spotbit Bitfinex (Tor) GBP</option>
<option data-currency-type="gbp" value="spotbit_bitstamp_gbp" {% if specter.price_provider == 'spotbit_bitstamp_gbp' %}selected{% endif %}>Spotbit Bitstamp (Tor) GBP</option>
<option data-currency-type="gbp" value="spotbit_gemini_gbp" {% if specter.price_provider == 'spotbit_gemini_gbp' %}selected{% endif %}>Spotbit Gemini (Tor) GBP</option>
<option data-currency-type="chf" value="coindesk_chf" {% if specter.price_provider == 'coindesk_chf' %}selected{% endif %}>Coindesk CHF</option>
<option data-currency-type="chf" value="spotbit_coinbase_chf" {% if specter.price_provider == 'spotbit_coinbase_chf' %}selected{% endif %}>Spotbit Coinbase (Tor) CHF</option>
<option data-currency-type="chf" value="spotbit_kraken_chf" {% if specter.price_provider == 'spotbit_kraken_chf' %}selected{% endif %}>Spotbit Kraken (Tor) CHF</option>
<option data-currency-type="jpy" value="coindesk_jpy" {% if specter.price_provider == 'coindesk_jpy' %}selected{% endif %}>Coindesk JPY</option>
<option data-currency-type="jpy" value="spotbit_coinbase_jpy" {% if specter.price_provider == 'spotbit_coinbase_jpy' %}selected{% endif %}>Spotbit Coinbase (Tor) JPY</option>
<option data-currency-type="jpy" value="spotbit_kraken_jpy" {% if specter.price_provider == 'spotbit_kraken_jpy' %}selected{% endif %}>Spotbit Kraken (Tor) JPY</option>
<option data-currency-type="jpy" value="spotbit_bitfinex_jpy" {% if specter.price_provider == 'spotbit_bitfinex_jpy' %}selected{% endif %}>Spotbit Bitfinex (Tor) JPY</option>
<option data-currency-type="aud" value="coindesk_aud" {% if specter.price_provider == 'coindesk_aud' %}selected{% endif %}>Coindesk AUD</option>
<option data-currency-type="aud" value="spotbit_coinbase_aud" {% if specter.price_provider == 'spotbit_coinbase_aud' %}selected{% endif %}>Spotbit Coinbase (Tor) AUD</option>
<option data-currency-type="aud" value="spotbit_kraken_aud" {% if specter.price_provider == 'spotbit_kraken_aud' %}selected{% endif %}>Spotbit Kraken (Tor) AUD</option>
<option data-currency-type="cad" value="coindesk_cad" {% if specter.price_provider == 'coindesk_cad' %}selected{% endif %}>Coindesk CAD</option>
<option data-currency-type="cad" value="spotbit_coinbase_cad" {% if specter.price_provider == 'spotbit_coinbase_cad' %}selected{% endif %}>Spotbit Coinbase (Tor) CAD</option>
<option data-currency-type="cad" value="spotbit_kraken_cad" {% if specter.price_provider == 'spotbit_kraken_cad' %}selected{% endif %}>Spotbit Kraken (Tor) CAD</option>
<option data-currency-type="nzd" value="coindesk_nzd" {% if specter.price_provider == 'coindesk_nzd' %}selected{% endif %}>Coindesk NZD</option>
<option data-currency-type="nzd" value="spotbit_coinbase_nzd" {% if specter.price_provider == 'spotbit_coinbase_nzd' %}selected{% endif %}>Spotbit Coinbase (Tor) NZD</option>
<option data-currency-type="hkd" value="coindesk_hkd" {% if specter.price_provider == 'coindesk_hkd' %}selected{% endif %}>Coindesk HKD</option>
<option data-currency-type="hkd" value="spotbit_coinbase_hkd" {% if specter.price_provider == 'spotbit_coinbase_hkd' %}selected{% endif %}>Spotbit Coinbase (Tor) HKD</option>
<option data-currency-type="rub" value="coindesk_rub" {% if specter.price_provider == 'coindesk_rub' %}selected{% endif %}>Coindesk RUB</option>
<option data-currency-type="rub" value="spotbit_coinbase_rub" {% if specter.price_provider == 'spotbit_coinbase_rub' %}selected{% endif %}>Spotbit Coinbase (Tor) RUB</option>
<option data-currency-type="ils" value="coindesk_ils" {% if specter.price_provider == 'coindesk_ils' %}selected{% endif %}>Coindesk NIS</option>
<option data-currency-type="ils" value="spotbit_coinbase_ils" {% if specter.price_provider == 'spotbit_coinbase_ils' %}selected{% endif %}>Spotbit Coinbase (Tor) NIS</option>
<option data-currency-type="jod" value="coindesk_jod" {% if specter.price_provider == 'coindesk_jod' %}selected{% endif %}>Coindesk JOD</option>
<option data-currency-type="jod" value="spotbit_coinbase_jod" {% if specter.price_provider == 'spotbit_coinbase_jod' %}selected{% endif %}>Spotbit Coinbase (Tor) JOD</option>
<option data-currency-type="twd" value="coindesk_twd" {% if specter.price_provider == 'coindesk_twd' %}selected{% endif %}>Coindesk TWD</option>
<option data-currency-type="twd" value="spotbit_coinbase_twd" {% if specter.price_provider == 'spotbit_coinbase_twd' %}selected{% endif %}>Spotbit Coinbase (Tor) TWD</option>
<option data-currency-type="brl" value="coindesk_brl" {% if specter.price_provider == 'coindesk_brl' %}selected{% endif %}>Coindesk BRL</option>
<option data-currency-type="brl" value="spotbit_coinbase_brl" {% if specter.price_provider == 'spotbit_coinbase_brl' %}selected{% endif %}>Spotbit Coinbase (Tor) BRL</option>
<option data-currency-type="xau" value="coindesk_xau" {% if specter.price_provider == 'coindesk_xau' %}selected{% endif %}>Coindesk Gold</option>
<option data-currency-type="xau" value="spotbit_coinbase_xau" {% if specter.price_provider == 'spotbit_coinbase_xau' %}selected{% endif %}>Spotbit Coinbase (Tor) Gold</option>
<option data-currency-type="xag" value="coindesk_xag" {% if specter.price_provider == 'coindesk_xag' %}selected{% endif %}>Coindesk Silver</option>
<option data-currency-type="xag" value="spotbit_coinbase_xag" {% if specter.price_provider == 'spotbit_coinbase_xag' %}selected{% endif %}>Spotbit Coinbase (Tor) Silver</option>
<option data-currency-type="xpt" value="spotbit_coinbase_xpt" {% if specter.price_provider == 'spotbit_coinbase_xpt' %}selected{% endif %}>Spotbit Coinbase (Tor) Platinum</option>
<option data-currency-type="xpd" value="spotbit_coinbase_xpd" {% if specter.price_provider == 'spotbit_coinbase_xpd' %}selected{% endif %}>Spotbit Coinbase (Tor) Palladium</option>
</select>
<label class="floating-label">Provider</label>
</fieldset>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{% if wallet is defined %}

<div id="hwi_display_address" class="flex-center flex-column hidden" data-style="overflow-wrap: break-word;">
<div id="hwi_display_address" class="flex-center flex-column hidden p-4 bg-dark-800" data-style="overflow-wrap: break-word;">
<h2>{{ _("Confirm Address") }}</h2><br>
<div>
{{ _("Please confirm address matches on your ")}}<span id="hwi_device_name">{{ _('device')}}</span><br><br>
{{ _("Expected address") }}:<br><span id="expected_address"></span>
</div>
<div class="flex-center">
<img src="{{ url_for('static', filename='img/loader_boxes.svg') }}"/>
<div class="flex justify-center mt-4 ">
<img src="{{ url_for('static', filename='img/loader_boxes.svg') }}" class="w-16 h-16"/>
</div>
</div>

Expand Down
Loading

0 comments on commit eef3c40

Please sign in to comment.