mirror of
https://github.com/btcpayserver/btcpayserver.git
synced 2025-02-28 16:58:00 +01:00
* BPU Prep Work Part2 * Adjust tests to use the hot wallet when registering deriv scheme * Add amount to payment data view for onchain payments * Make zone limits higher when in dev mode (for tests in next PR) * Make IPaymentMethodDetails serialize/deserialize through payment type using the network * Allow named settings through settings repo * Refactor some extensions for next PR * pr changes * use json convert for now
53 lines
1.7 KiB
JavaScript
53 lines
1.7 KiB
JavaScript
function updateFiatValue(element) {
|
|
|
|
if (!element) {
|
|
element = $(this);
|
|
}
|
|
var rateStr = $("#Rate").val();
|
|
var divisibilityStr = $("#Divisibility").val();
|
|
var fiat = $("#Fiat").val();
|
|
var rate = parseFloat(rateStr);
|
|
var divisibility = parseInt(divisibilityStr);
|
|
if (!isNaN(rate) && !isNaN(divisibility)) {
|
|
var fiatValue = $(element).parents(".input-group").first().find(".fiat-value");
|
|
var amountValue = parseFloat($(element).val());
|
|
if (!isNaN(amountValue)) {
|
|
fiatValue.show();
|
|
fiatValue.text("= " + (rate * amountValue).toFixed(divisibility) + " " + fiat);
|
|
} else {
|
|
fiatValue.text("");
|
|
}
|
|
}
|
|
}
|
|
|
|
function updateFiatValueWithCurrentElement() {
|
|
updateFiatValue($(this))
|
|
}
|
|
|
|
$(function () {
|
|
$(".output-amount").on("input", updateFiatValueWithCurrentElement).each(updateFiatValueWithCurrentElement);
|
|
|
|
$("#crypto-fee-link").on("click", function (elem) {
|
|
var val = $(this).text();
|
|
$("#FeeSatoshiPerByte").val(val);
|
|
return false;
|
|
});
|
|
|
|
$(".crypto-balance-link").on("click", function (elem) {
|
|
var val = $(this).text();
|
|
var parentContainer = $(this).parents(".transaction-output-form");
|
|
var outputAmountElement = parentContainer.find(".output-amount");
|
|
outputAmountElement.val(val);
|
|
parentContainer.find(".subtract-fees").prop('checked', true);
|
|
updateFiatValue(outputAmountElement);
|
|
return false;
|
|
});
|
|
|
|
$("#bip21parse").on("click", function(){
|
|
var bip21 = prompt("Paste BIP21 here");
|
|
if(bip21){
|
|
$("#BIP21").val(bip21);
|
|
$("form").submit();
|
|
}
|
|
});
|
|
});
|