Merge pull request #1394 from lnbits/feat/boltz-fee-info

feat/boltz fee info
This commit is contained in:
Arc 2023-01-30 00:57:07 +00:00 committed by GitHub
commit bdfbbb779e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 61 additions and 21 deletions

View File

@ -39,8 +39,9 @@
<b>Fee Information</b>
</h3>
<span>
Every swap consists of 2 onchain transactions, lockup and claim / refund,
routing fees and a Boltz fee of <b>0.5%</b>.
{% raw %} Every swap consists of 2 onchain transactions, lockup and claim
/ refund, routing fees and a Boltz fee of
<b>{{ boltzConfig.fee_percentage }}%</b>. {% endraw %}
</span>
</q-card-section>
<q-expansion-item
@ -50,20 +51,29 @@
:content-inset-level="0.5"
>
<q-card-section>
You want to swap out 100.000 sats, Lightning to Onchain:
{% raw %} You want to swap out {{ boltzExample.amount }} sats, Lightning
to Onchain:
<ul style="padding-left: 12px">
<li>Onchain lockup tx fee: ~500 sats</li>
<li>Onchain claim tx fee: 1000 sats (hardcoded)</li>
<li>Onchain lockup tx fee: ~{{ boltzExample.onchain_boltz }} sats</li>
<li>
Onchain claim tx fee: {{ boltzExample.onchain_lnbits }} sats
(hardcoded)
</li>
<li>Routing fees (paid by you): unknown</li>
<li>Boltz fees: 500 sats</li>
<li>Fees total: 2000 sats + routing fees</li>
<li>You receive: 98.000 sats</li>
<li>
Boltz fees: {{ boltzExample.boltz_fee }} sats ({{
boltzConfig.fee_percentage }}%)
</li>
<li>
Fees total: {{ boltzExample.reverse_fee_total }} sats + routing fees
</li>
<li>You receive: {{ boltzExample.reverse_receive }} sats</li>
</ul>
<p>
onchain_amount_received = amount - (amount * boltz_fee / 100) -
lockup_fee - claim_fee
</p>
<p>98.000 = 100.000 - 500 - 500 - 1000</p>
{% endraw %}
</q-card-section>
</q-expansion-item>
<q-expansion-item
@ -73,21 +83,27 @@
:content-inset-level="0.5"
>
<q-card-section>
You want to swap in 100.000 sats, Onchain to Lightning:
{% raw %} You want to swap in {{ boltzExample.amount }} sats, Onchain to
Lightning:
<ul style="padding-left: 12px">
<li>Onchain lockup tx fee: whatever you choose when paying</li>
<li>Onchain claim tx fee: ~500 sats</li>
<li>Onchain claim tx fee: ~{{ boltzExample.onchain_boltz }} sats</li>
<li>Routing fees (paid by boltz): unknown</li>
<li>Boltz fees: 500 sats (0.5%)</li>
<li>Fees total: 1000 sats + lockup_fee</li>
<li>You pay onchain: 101.000 sats + lockup_fee</li>
<li>You receive lightning: 100.000 sats</li>
<li>
Boltz fees: {{ boltzExample.boltz_fee }} sats ({{
boltzConfig.fee_percentage }}%)
</li>
<li>
Fees total: {{ boltzExample.normal_fee_total }} sats + lockup_fee
</li>
<li>
You pay onchain: {{ boltzExample.normal_expected_amount }} sats +
lockup_fee
</li>
<li>You receive lightning: {{ boltzExample.amount }} sats</li>
</ul>
<p>
onchain_payment + lockup_fee = amount + (amount * boltz_fee / 100) +
claim_fee + lockup_fee
</p>
<p>101.000 + lockup_fee = 100.000 + 500 + 500 + lockup_fee</p>
<p>onchain_payment = amount + (amount * boltz_fee / 100) + claim_fee</p>
{% endraw %}
</q-card-section>
</q-expansion-item>
</q-card>

View File

@ -249,6 +249,26 @@
}
}
},
computed: {
boltzExample() {
let amount = 100000
let onchain_lnbits = 1000
let onchain_boltz = 500
let boltz_fee = (amount * this.boltzConfig.fee_percentage) / 100
let normal_fee_total = onchain_boltz + boltz_fee
let reverse_fee_total = onchain_boltz + boltz_fee + onchain_lnbits
return {
amount: amount,
boltz_fee: boltz_fee,
reverse_fee_total: reverse_fee_total,
reverse_receive: amount - reverse_fee_total,
onchain_lnbits: onchain_lnbits,
onchain_boltz: onchain_boltz,
normal_fee_total: normal_fee_total,
normal_expected_amount: amount + normal_fee_total
}
}
},
methods: {
getLimits() {
if (this.boltzConfig) {

View File

@ -325,4 +325,8 @@ async def api_swap_status(swap_id: str):
)
async def api_boltz_config():
client = create_boltz_client()
return {"minimal": client.limit_minimal, "maximal": client.limit_maximal}
return {
"minimal": client.limit_minimal,
"maximal": client.limit_maximal,
"fee_percentage": client.fee_percentage,
}