Remove preliminary test to know if the ledger can handle the store. If it can't signing will fail anyway.

This commit is contained in:
nicolas.dorier
2018-12-25 19:32:14 +09:00
parent 0eabb3c37c
commit af22d6a4e3
3 changed files with 26 additions and 55 deletions

View File

@@ -476,15 +476,6 @@ namespace BTCPayServer.Controllers
} }
catch { throw new FormatException("Invalid value for subtract fees"); } catch { throw new FormatException("Invalid value for subtract fees"); }
} }
if (command == "getinfo")
{
var strategy = GetDirectDerivationStrategy(derivationScheme);
if (strategy == null || await hw.GetKeyPath(network, strategy, normalOperationTimeout.Token) == null)
{
throw new Exception($"This store is not configured to use this ledger");
}
result = new GetInfoResult();
}
if (command == "test") if (command == "test")
{ {
result = await hw.Test(normalOperationTimeout.Token); result = await hw.Test(normalOperationTimeout.Token);

View File

@@ -28,10 +28,6 @@
<p id="hw-loading"><span class="fa fa-question-circle" style="color:orange"></span> <span>Detecting hardware wallet...</span></p> <p id="hw-loading"><span class="fa fa-question-circle" style="color:orange"></span> <span>Detecting hardware wallet...</span></p>
<p id="hw-error" style="display:none;"><span class="fa fa-times-circle" style="color:red;"></span> <span class="hw-label">An error happened</span></p> <p id="hw-error" style="display:none;"><span class="fa fa-times-circle" style="color:red;"></span> <span class="hw-label">An error happened</span></p>
<p id="hw-success" style="display:none;"><span class="fa fa-check-circle" style="color:green;"></span> <span class="hw-label">Detecting hardware wallet...</span></p> <p id="hw-success" style="display:none;"><span class="fa fa-check-circle" style="color:green;"></span> <span class="hw-label">Detecting hardware wallet...</span></p>
<p id="check-loading" style="display:none;"><span class="fa fa-question-circle" style="color:orange"></span> <span class="check-label">Detecting hardware wallet...</span></p>
<p id="check-error" style="display:none;"><span class="fa fa-times-circle" style="color:red;"></span> <span class="check-label">An error happened</span></p>
<p id="check-success" style="display:none;"><span class="fa fa-check-circle" style="color:green;"></span> <span class="check-label">Detecting hardware wallet...</span></p>
</div> </div>
</div> </div>

View File

@@ -41,52 +41,36 @@
var updateInfo = function () { var updateInfo = function () {
if (!ledgerDetected) if (!ledgerDetected)
return false; return false;
$(".crypto-info").css("display", "none"); $(".crypto-info").css("display", "block");
bridge.sendCommand("getinfo", "cryptoCode=" + cryptoCode) var args = "";
.catch(function (reason) { Write('check', 'error', reason); }) args += "cryptoCode=" + cryptoCode;
args += "&destination=" + destination;
args += "&amount=" + amount;
args += "&feeRate=" + fee;
args += "&substractFees=" + substractFee;
WriteAlert("warning", 'Please validate the transaction on your ledger');
var confirmButton = $("#confirm-button");
confirmButton.prop("disabled", true);
confirmButton.addClass("disabled");
bridge.sendCommand('sendtoaddress', args, 60 * 10 /* timeout */)
.catch(function (reason) {
WriteAlert("danger", reason);
confirmButton.prop("disabled", false);
confirmButton.removeClass("disabled");
})
.then(function (result) { .then(function (result) {
if (!result) if (!result)
return; return;
confirmButton.prop("disabled", false);
confirmButton.removeClass("disabled");
if (result.error) { if (result.error) {
Write('check', 'error', result.error); WriteAlert("danger", result.error);
return; } else {
} WriteAlert("success", 'Transaction broadcasted (' + result.transactionId + ')');
else { window.location.replace(successCallback + "?txid=" + result.transactionId);
Write('check', 'success', 'This store is configured to use your ledger');
$(".crypto-info").css("display", "block");
var args = "";
args += "cryptoCode=" + cryptoCode;
args += "&destination=" + destination;
args += "&amount=" + amount;
args += "&feeRate=" + fee;
args += "&substractFees=" + substractFee;
WriteAlert("warning", 'Please validate the transaction on your ledger');
var confirmButton = $("#confirm-button");
confirmButton.prop("disabled", true);
confirmButton.addClass("disabled");
bridge.sendCommand('sendtoaddress', args, 60 * 10 /* timeout */)
.catch(function (reason) {
WriteAlert("danger", reason);
confirmButton.prop("disabled", false);
confirmButton.removeClass("disabled");
})
.then(function (result) {
if (!result)
return;
confirmButton.prop("disabled", false);
confirmButton.removeClass("disabled");
if (result.error) {
WriteAlert("danger", result.error);
} else {
WriteAlert("success", 'Transaction broadcasted (' + result.transactionId + ')');
window.location.replace(successCallback + "?txid=" + result.transactionId);
}
});
} }
}); });
}; };