Skip to content

Commit

Permalink
Merge branch 'fee-credits'
Browse files Browse the repository at this point in the history
  • Loading branch information
ahopk127 committed Jun 28, 2022
2 parents fbd4638 + fe21961 commit dbc6832
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/components/Transaction.vue
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ export default {
/** Returns the withdrawal fee, in SAT */
conversionFeeSAT() {
let conversionFeeSAT = Math.floor(this.payment.amount / 100);
let conversionFeeDeductionSAT = Math.min(this.user.account.fee_credits, conversionFeeSAT);
let conversionFeeDeductionSAT = Math.min(this.feeCreditsSAT, conversionFeeSAT);
return conversionFeeSAT - conversionFeeDeductionSAT;
},
conversionFee() {
Expand Down Expand Up @@ -199,6 +199,18 @@ export default {
if (!this.fee) return null;
return ((this.fee * this.rate) / SATS).toFixed(2);
},
feeCreditsSAT() {
switch (this.payment.network) {
case 'bitcoin':
return this.user.account.btc_credits;
case 'liquid':
return this.user.account.liquid_credits;
case 'lightning':
return this.user.account.lightning_credits;
default:
throw new Error("Invalid network " + this.payment.network);
}
},
feeUnit() {
return this.user.fiat
? this.user.currency
Expand Down

0 comments on commit dbc6832

Please sign in to comment.