@@ -24,7 +24,10 @@ import {
2424import StatusProgressBar from ' @/common/components/status/StatusProgressBar.vue' ;
2525import { useStateAttribute } from ' @/common/store/helper' ;
2626import StatusSummary from ' @/common/components/status/StatusSummary.vue' ;
27- import { bigNumberToSatoshiBigIntString , toWeiBigIntString } from ' @/common/utils' ;
27+ import {
28+ toWeiBigIntString ,
29+ toSatoshiBigIntString ,
30+ } from ' @/common/utils' ;
2831
2932export default defineComponent ({
3033 name: ' TxPegout' ,
@@ -51,30 +54,35 @@ export default defineComponent({
5154 const amountToBeReceived = computed ((): string => {
5255 const status = txDetails .value as PegoutStatusDataModel ;
5356 if (isRejectedPegout .value ) {
54- return ' ' ;
57+ return ' 0 ' ;
5558 }
5659 if (status .valueInSatoshisToBeReceived ) {
5760 return new SatoshiBig (status .valueInSatoshisToBeReceived , ' satoshi' ).toBTCTrimmedString ();
5861 }
59- const requestedAmount = new SatoshiBig (status .valueRequestedInSatoshis , ' satoshi' );
60- return requestedAmount .minus (pegOutEstimatedFee .value ).toBTCTrimmedString ();
62+ const requestedAmount = new WeiBig (status .valueRequestedInSatoshis , ' wei' );
63+ const requestedAmountString = toWeiBigIntString (requestedAmount .toRBTCTrimmedString ());
64+ const pegOutEstimatedString = toSatoshiBigIntString (pegOutEstimatedFee .value
65+ .toBTCTrimmedString ());
66+ const amountToReceive = (new WeiBig (requestedAmountString , ' wei' ))
67+ .minus (new WeiBig (pegOutEstimatedString , ' wei' ));
68+ return amountToReceive .toRBTCTrimmedString ();
6169 });
6270
6371 const txPegoutSummary = computed ((): NormalizedSummary => {
6472 const status = txDetails .value as PegoutStatusDataModel ;
65- const valueRequested = bigNumberToSatoshiBigIntString (status .valueRequestedInSatoshis );
66- const amountSent = new WeiBig (valueRequested , ' rbtc' )
67- .plus (calculatedGasFee .value ).toRBTCTrimmedString ();
73+ const valueRequested = new SatoshiBig (status .valueRequestedInSatoshis , ' satoshi' );
74+ const amountSent = new WeiBig (valueRequested .toSatoshiBigIntUnsafe (), ' wei' ).plus (calculatedGasFee .value );
6875 const btcTxId = status .status === PegoutStatus .RELEASE_BTC ? status .btcTxId : ' ' ;
6976 return {
70- amountFromString: amountSent ,
77+ amountFromString: isRejectedPegout .value ? valueRequested .toBTCTrimmedString ()
78+ : amountSent .toRBTCTrimmedString (),
7179 amountReceivedString: amountToBeReceived .value ,
72- gas: calculatedGasFee .value .toString (),
80+ gas: calculatedGasFee .value .toRBTCTrimmedString (),
7381 fee: status .feeInSatoshisToBePaid ?? ' 0' ,
7482 recipientAddress: status .btcRecipientAddress ,
7583 senderAddress: status .rskSenderAddress ,
7684 txId: status .rskTxHash ? status .rskTxHash : props .txId ,
77- estimatedFee: pegOutEstimatedFee .value .toString (),
85+ estimatedFee: pegOutEstimatedFee .value .toBTCTrimmedString (),
7886 status: status .status ,
7987 btcTxId ,
8088 };
0 commit comments