Skip to content

Commit f15e7c9

Browse files
committedJul 26, 2022
[FIX] multiple outputs rbf speedup
1 parent ec24d7b commit f15e7c9

File tree

1 file changed

+53
-13
lines changed

1 file changed

+53
-13
lines changed
 

‎src/pages/tx-details/tx-details.ts

+53-13
Original file line numberDiff line numberDiff line change
@@ -407,20 +407,60 @@ export class TxDetailsModal {
407407
}
408408

409409
public async goToConfirm() {
410-
const txp = await this.getTransaction();
411-
const amount = this.btx.amount;
412-
const toAddress = this.btx.outputs[0].address;
410+
const txp = await this.getTransaction(); // only way to get actual inputs and ouputs
413411
const inputs = txp.inputs;
414-
this.navCtrl.push(ConfirmPage, {
415-
walletId: this.wallet.credentials.walletId,
416-
fromReplaceByFee: true,
417-
amount,
418-
toAddress,
419-
coin: this.wallet.coin,
420-
network: this.wallet.network,
421-
useSendMax: false,
422-
inputs
423-
});
412+
const multiRecipients = [];
413+
414+
if (this.btx.hasMultiplesOutputs) {
415+
txp.outputs.forEach(output => {
416+
let amountToShow: string = +output.amount
417+
? this.txFormatProvider.formatAmount(this.wallet.coin, +output.amount)
418+
: null;
419+
420+
let altAmountStr = this.txFormatProvider.formatAlternativeStr(
421+
this.wallet.coin,
422+
+output.amount
423+
);
424+
425+
multiRecipients.push({
426+
amount: output.amount,
427+
amountToShow,
428+
altAmountStr: altAmountStr ? altAmountStr : null,
429+
toAddress: output.toAddress,
430+
recipientType: 'address'
431+
});
432+
});
433+
let totalAmount = 0;
434+
multiRecipients.forEach(recipient => {
435+
totalAmount += recipient.amount;
436+
});
437+
this.navCtrl.push(ConfirmPage, {
438+
walletId: this.wallet.credentials.walletId,
439+
fromMultiSend: true,
440+
fromReplaceByFee: true,
441+
totalAmount,
442+
recipientType: 'multi',
443+
color: this.wallet.color,
444+
coin: this.wallet.coin,
445+
network: this.wallet.network,
446+
useSendMax: false,
447+
recipients: multiRecipients,
448+
inputs
449+
});
450+
} else {
451+
const toAddress = this.btx.outputs[0].address;
452+
const amount = this.btx.amount;
453+
this.navCtrl.push(ConfirmPage, {
454+
walletId: this.wallet.credentials.walletId,
455+
fromReplaceByFee: true,
456+
amount,
457+
toAddress,
458+
coin: this.wallet.coin,
459+
network: this.wallet.network,
460+
useSendMax: false,
461+
inputs
462+
});
463+
}
424464
this.close();
425465
}
426466
}

0 commit comments

Comments
 (0)
Please sign in to comment.