Skip to content

Commit

Permalink
Update amount calculations on confirm page and summary
Browse files Browse the repository at this point in the history
  • Loading branch information
ronaldsg20 authored and alexjavabraz committed Sep 27, 2024
1 parent a392a39 commit ab9c20d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
12 changes: 6 additions & 6 deletions src/pegin/components/create/ConfirmTx.vue
Original file line number Diff line number Diff line change
Expand Up @@ -131,11 +131,10 @@ export default defineComponent({
return provider?.name ?? '';
}
function getProviderFee(): string {
function getProviderFee(): SatoshiBig {
return selectedQuote.value.quote.productFeeAmount
.plus(selectedQuote.value.quote.callFee)
.plus(new SatoshiBig(selectedQuote.value.quote.gasFee.toRBTCString(), 'btc'))
.toBTCTrimmedString();
.plus(SatoshiBig.fromWeiBig(selectedQuote.value.quote.gasFee));
}
const txPeginSummary = computed((): NormalizedSummary => ({
Expand All @@ -147,13 +146,14 @@ export default defineComponent({
senderAddress: pegInTxState.value.normalizedTx.inputs[0].address,
}));
const flyoverTotalFee = computed(() => new SatoshiBig(getProviderFee(), 'btc').plus(safeFee.value).toBTCTrimmedString());
const flyoverTotalFee = computed(() => getProviderFee()
.plus(safeFee.value));
const flyoverPeginSummary = computed((): NormalizedSummary => ({
amountFromString: selectedQuote.value.quote.value.toBTCTrimmedString(),
amountReceivedString: selectedQuote.value.quote.value.toBTCTrimmedString(),
fee: Number(flyoverTotalFee.value),
total: selectedQuote.value.quote.value.plus(new SatoshiBig(flyoverTotalFee.value, 'btc')).toBTCTrimmedString(),
total: selectedQuote.value.quote.value.plus(flyoverTotalFee.value).toBTCTrimmedString(),
recipientAddress: recipientAddress.value,
senderAddress: pegInTxState.value.normalizedTx.inputs[0].address,
}));
Expand All @@ -164,7 +164,7 @@ export default defineComponent({
const flyoverProps = computed(() => ({
value: Number(selectedQuote.value.quote.value.toBTCTrimmedString()),
fee: Number(flyoverTotalFee.value),
fee: Number(flyoverTotalFee.value.toBTCTrimmedString()),
provider: getLPName(),
details: {
senderAddress: pegInTxState.value.normalizedTx.inputs[0].address,
Expand Down
2 changes: 1 addition & 1 deletion src/pegin/components/create/PegInForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ export default defineComponent({
const fullAmount: SatoshiBig = quote?.value
.plus(quote.productFeeAmount)
.plus(quote.callFee)
.plus(new SatoshiBig(quote.gasFee.toRBTCString(), 'btc'))
.plus(SatoshiBig.fromWeiBig(quote.gasFee))
.plus(selectedFee.value);
return selectedAccountBalance.value?.gte(fullAmount);
Expand Down

0 comments on commit ab9c20d

Please sign in to comment.