Fix deleting last target (#7)

* fix deleting last target
This commit is contained in:
Tiago Vasconcelos 2023-09-26 12:43:51 +01:00 committed by GitHub
commit a2efae3c30
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 13 additions and 9 deletions

View file

@ -1,4 +1,5 @@
# Split Payments - <small>[LNbits](https://github.com/lnbits/lnbits) extension</small>
<small>For more about LNBits extension check [this tutorial](https://github.com/lnbits/lnbits/wiki/LNbits-Documentation#use-cases-of-lnbits)</small>
## Have payments split between multiple wallets
@ -18,11 +19,11 @@ LNbits Split Payments extension allows for distributing payments across multiple
- set how much, in percentage, this wallet will receive from every payment sent to the source wallet
3. When done with adding or deleting a set of targets, click "SAVE TARGETS" to make the splits effective.
3. When done with adding or deleting a set of targets, click "SAVE TARGETS" to make the splits effective.
4. You can have several wallets to split to, as long as the sum of the percentages is under or equal to 100%. It can only reach 100% if the targets are all internal ones.
5. When the source wallet receives a payment, the extension will automatically split the corresponding values to every wallet.
5. When the source wallet receives a payment, the extension will automatically split the corresponding values to every wallet.
- on receiving a 20 sats payment\
![get 20 sats payment](https://i.imgur.com/BKp0xvy.png)
- source wallet gets 18 sats\
@ -33,13 +34,12 @@ LNbits Split Payments extension allows for distributing payments across multiple
IMPORTANT:
- If you split to a LNURLp or LNaddress through the LNURLp extension make sure your receipients allow comments ! Split&Scrub add a comment in your transaction - and if it is not allowed, the split/scrub will not take place.
- Make sure the LNURLp / LNaddress of the receipient has its min-sats set very low (e.g. 1 sat). If the wallet does not belong to you you can [check with a Decoder](https://lightningdecoder.com/), if that is the case already
- Make sure the LNURLp / LNaddress of the receipient has its min-sats set very low (e.g. 1 sat). If the wallet does not belong to you you can [check with a Decoder](https://lightningdecoder.com/), if that is the case already
- Yes, there is fees - internal and external! Updating your own wallets on your own instance will not cost any fees but sending to an external instance will. Please notice that you should therefore not split up to 100% if you send to a wallet that is external (leave 1-2% reserve for routing fees!). External fees are deducted from the individual payment percentage of the receipient
<img width="1148" alt="Bildschirm­foto 2023-05-01 um 22 14 36" src="https://user-images.githubusercontent.com/63317640/235534056-49296aeb-7295-4b4e-9f57-914a677f5ad4.png">
<img width="1402" alt="Bildschirm­foto 2023-05-01 um 22 17 52" src="https://user-images.githubusercontent.com/63317640/235534063-b2734654-7c1a-48a3-b48e-32798c232b49.png">
## Sponsored by
[![](https://cdn.shopify.com/s/files/1/0826/9235/files/cryptograffiti_logo_clear_background.png?v=1504730421)](https://cryptograffiti.com/)

View file

@ -34,8 +34,10 @@ new Vue({
},
methods: {
clearTarget(index) {
if(this.targets.length == 1) {
return this.deleteTargets()
}
this.targets.splice(index, 1)
console.log(this.targets)
this.$q.notify({
message: 'Removed item. You must click to save manually.',
timeout: 500
@ -84,7 +86,7 @@ new Vue({
},
deleteTargets() {
LNbits.utils
.confirmDialog('Are you sure you want to delete the targets?')
.confirmDialog('Are you sure you want to delete all targets?')
.onOk(() => {
this.targets = []
LNbits.api

View file

@ -9,7 +9,7 @@ from loguru import logger
from lnbits import bolt11
from lnbits.core.crud import get_standalone_payment
from lnbits.core.models import Payment
from lnbits.core.services import create_invoice, pay_invoice, fee_reserve
from lnbits.core.services import create_invoice, fee_reserve, pay_invoice
from lnbits.helpers import get_current_extension_name
from lnbits.tasks import register_invoice_listener

View file

@ -118,10 +118,12 @@
This is valid for every payment, doesn't matter how it was created.
</p>
<p>
Targets can be LNBits wallets from this LNBits instance or any valid LNURL or LN Address.
Targets can be LNBits wallets from this LNBits instance or any valid
LNURL or LN Address.
</p>
<p class="text-warning">
LNURLp and LN Addresses must allow comments > 100 chars and also have a flexible amount.
LNURLp and LN Addresses must allow comments > 100 chars and also
have a flexible amount.
</p>
<p>
To remove a wallet from the targets list just press the X and save.