-
Notifications
You must be signed in to change notification settings - Fork 243
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bug fix: Multiple send bug fixes #1538
Merged
Merged
Changes from all commits
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
ab69e25
Added tests/bitcoin to gitignore
moneymanolis ec0a863
Merge branch 'master' of github.com:cryptoadvance/specter-desktop
moneymanolis d55390c
Merge branch 'master' of github.com:cryptoadvance/specter-desktop
moneymanolis ca5e957
Merge branch 'master' of github.com:cryptoadvance/specter-desktop
moneymanolis 329ab71
Merge branch 'master' of github.com:cryptoadvance/specter-desktop
moneymanolis 2029ae8
Merge branch 'master' of github.com:cryptoadvance/specter-desktop
moneymanolis 928536f
Merge branch 'master' of github.com:cryptoadvance/specter-desktop
moneymanolis 08afceb
Merge branch 'master' of github.com:cryptoadvance/specter-desktop
moneymanolis 423f169
Merge branch 'master' of github.com:cryptoadvance/specter-desktop
moneymanolis 9e5b294
Merge branch 'master' of github.com:cryptoadvance/specter-desktop
moneymanolis 7f25465
Merge branch 'master' of github.com:cryptoadvance/specter-desktop
moneymanolis c109684
Merge branch 'master' of github.com:cryptoadvance/specter-desktop
moneymanolis 12d481c
Merge branch 'master' of github.com:cryptoadvance/specter-desktop
moneymanolis 646b8e3
Merge branch 'master' of github.com:cryptoadvance/specter-desktop
moneymanolis 261bfad
Merge branch 'master' of github.com:cryptoadvance/specter-desktop
moneymanolis 9ae5006
Merge branch 'master' of github.com:cryptoadvance/specter-desktop
moneymanolis aa0ad5f
Merge branch 'master' of github.com:cryptoadvance/specter-desktop
moneymanolis 59706f8
Merge branch 'master' of github.com:cryptoadvance/specter-desktop
moneymanolis fa52dd8
Merge branch 'master' of github.com:cryptoadvance/specter-desktop
moneymanolis f66f5cd
Merge branch 'master' of github.com:cryptoadvance/specter-desktop
moneymanolis ae209b3
Merge branch 'master' of github.com:cryptoadvance/specter-desktop
moneymanolis d78c208
Multiple send bug fixes, disabling RBF and subtract fee from for Liqu…
moneymanolis 1938376
Merge branch 'master' into send_bugfixes
db9b65d
Merge branch 'master' into send_bugfixes
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -118,13 +118,15 @@ | |
|
||
{% block scripts %} | ||
<script> | ||
|
||
{% if specter.is_liquid %} | ||
const MIN_FEE_RATE = 0.1; | ||
const NETWORK = "Liquid" | ||
{% else %} | ||
const MIN_FEE_RATE = 1; | ||
const NETWORK = "Bitcoin" | ||
{% endif %} | ||
|
||
// Amounts and units | ||
var units = []; | ||
var amounts = []; | ||
|
@@ -156,6 +158,24 @@ | |
}) | ||
var FeeSelectionComponent = document.getElementById('fee-selection-component') | ||
FeeSelectionComponent = document.getElementById('fee-selection-component') | ||
|
||
// Switch off RBF and subtract fee for Liquid | ||
function adjustForLiquid() { | ||
if (NETWORK == "Liquid") { | ||
console.log("On Liquid, removing RBF and subtract from features ... ") | ||
FeeSelectionComponent.deactivateRbf() | ||
FeeSelectionComponent.deactivateSubtract() // Subtract from is still set to true for send max under the hood | ||
// Remove some line breaks | ||
advancedSettingsDiv = document.getElementById("advanced_settings") | ||
lineBreaks = Array.from(advancedSettingsDiv.querySelectorAll('br')) | ||
lineBreaks.pop() // We still need the last line break | ||
for (var br of lineBreaks) { | ||
if (br.parentNode == advancedSettingsDiv) { | ||
advancedSettingsDiv.removeChild(br) | ||
} | ||
} | ||
} | ||
} | ||
|
||
// Main part of displaying subtractFrom, the rest is with addRecipient, deleteRecipient and toggleSendUIType | ||
FeeSelectionComponent.addEventListener("subtractClick", (event) => { | ||
|
@@ -372,15 +392,9 @@ | |
async function setMaxAmount(i) { | ||
let amountInput = document.getElementById('amount_' + i); | ||
if (!validAddress(i)) { | ||
showError(`{{ _("Please first enter a valid address") }}`); | ||
return; | ||
} | ||
let subtract = document.getElementById('subtract'); | ||
subtract.checked = (units[i] == 'sat' || units[i] == 'btc'); | ||
if (amounts.length > 1) { | ||
document.getElementById('subtract_from').style.display = 'block'; | ||
document.getElementById('subtract_from_input').value = i + 1; | ||
} | ||
FeeSelectionComponent.setSubtract(units[i] == 'sat' || units[i] == 'btc' || units[i] == 'lbtc'); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As far as I remember LBTC has unit |
||
let othersAmount = 0; | ||
for(let j in amounts) { | ||
if (j != i) { | ||
|
@@ -635,7 +649,7 @@ | |
} | ||
} catch (e) { | ||
console.log(e); | ||
document.getElementById('calculated_tx_fee').innerText = `: {{ _("Failed to calculate transaction fees. Perhaps you used an invalid Bitcoin address.") }}`; // TODO: Remove second part of the message until we have a better address validation here. | ||
document.getElementById('calculated_tx_fee').innerText = `: {{ _("Failed to calculate transaction fees.") }}`; | ||
} | ||
return -1; | ||
} | ||
|
@@ -648,6 +662,7 @@ | |
{% else %} | ||
addRecipient("", 0, "btc", ""); | ||
{% endif %} | ||
adjustForLiquid() | ||
document.getElementById('toggle_advanced').addEventListener('click', (event) => { | ||
toggleAdvanced(); | ||
}); | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
... ?