Skip to content

Commit

Permalink
Merge pull request #12051 from gabrielbazan7/fix/multiple-output-rbf
Browse files Browse the repository at this point in the history
[FIX] multiple outputs rbf speedup
  • Loading branch information
cmgustavo authored Jul 27, 2022
2 parents ec24d7b + 61e5079 commit 692a1a8
Showing 1 changed file with 55 additions and 13 deletions.
68 changes: 55 additions & 13 deletions src/pages/tx-details/tx-details.ts
Original file line number Diff line number Diff line change
Expand Up @@ -407,20 +407,62 @@ export class TxDetailsModal {
}

public async goToConfirm() {
const txp = await this.getTransaction();
const amount = this.btx.amount;
const toAddress = this.btx.outputs[0].address;
const txp = await this.getTransaction(); // only way to get actual inputs and ouputs
const inputs = txp.inputs;
this.navCtrl.push(ConfirmPage, {
walletId: this.wallet.credentials.walletId,
fromReplaceByFee: true,
amount,
toAddress,
coin: this.wallet.coin,
network: this.wallet.network,
useSendMax: false,
inputs
});
const multiRecipients = [];

if (this.btx.hasMultiplesOutputs) {
txp.outputs.forEach(output => {
let amountToShow: string = +output.amount
? this.txFormatProvider.formatAmount(this.wallet.coin, +output.amount)
: null;

let altAmountStr = this.txFormatProvider.formatAlternativeStr(
this.wallet.coin,
+output.amount
);

multiRecipients.push({
amount: output.amount,
amountToShow,
altAmountStr: altAmountStr ? altAmountStr : null,
toAddress: output.toAddress,
recipientType: 'address'
});
});
let totalAmount = 0;
multiRecipients.forEach(recipient => {
totalAmount += recipient.amount;
});
this.navCtrl.push(ConfirmPage, {
walletId: this.wallet.credentials.walletId,
fromMultiSend: true,
fromReplaceByFee: true,
totalAmount,
recipientType: 'multi',
color: this.wallet.color,
coin: this.wallet.coin,
network: this.wallet.network,
useSendMax: false,
recipients: multiRecipients,
description: this.btx.message,
inputs
});
} else {
const toAddress = this.btx.outputs[0].address;
const amount = this.btx.amount;
this.navCtrl.push(ConfirmPage, {
walletId: this.wallet.credentials.walletId,
fromReplaceByFee: true,
amount,
toAddress,
coin: this.wallet.coin,
network: this.wallet.network,
useSendMax: false,
description: this.btx.message,
inputs
});
}
this.close();
}
}

0 comments on commit 692a1a8

Please sign in to comment.