mirror of
https://github.com/BlueWallet/BlueWallet.git
synced 2025-03-03 20:07:11 +01:00
ADD: Toggle for RBF
Update hd-segwit-bech32-wallet.js Update details.js Update details.js
This commit is contained in:
parent
9dd9fb6b97
commit
d60323961b
2 changed files with 26 additions and 2 deletions
|
@ -727,7 +727,11 @@ export class HDSegwitBech32Wallet extends AbstractHDWallet {
|
||||||
*/
|
*/
|
||||||
createTransaction(utxos, targets, feeRate, changeAddress, sequence, skipSigning = false) {
|
createTransaction(utxos, targets, feeRate, changeAddress, sequence, skipSigning = false) {
|
||||||
if (!changeAddress) throw new Error('No change address provided');
|
if (!changeAddress) throw new Error('No change address provided');
|
||||||
|
if (sequence === false) {
|
||||||
|
sequence = undefined;
|
||||||
|
} else {
|
||||||
sequence = sequence || HDSegwitBech32Wallet.defaultRBFSequence;
|
sequence = sequence || HDSegwitBech32Wallet.defaultRBFSequence;
|
||||||
|
}
|
||||||
|
|
||||||
let algo = coinSelectAccumulative;
|
let algo = coinSelectAccumulative;
|
||||||
if (targets.length === 1 && targets[0] && !targets[0].value) {
|
if (targets.length === 1 && targets[0] && !targets[0].value) {
|
||||||
|
|
|
@ -84,6 +84,7 @@ export default class SendDetails extends Component {
|
||||||
showSendMax: false,
|
showSendMax: false,
|
||||||
isFeeSelectionModalVisible: false,
|
isFeeSelectionModalVisible: false,
|
||||||
isAdvancedTransactionOptionsVisible: false,
|
isAdvancedTransactionOptionsVisible: false,
|
||||||
|
isTransactionReplaceable: fromWallet.type === HDSegwitBech32Wallet.type,
|
||||||
recipientsScrollIndex: 0,
|
recipientsScrollIndex: 0,
|
||||||
fromAddress,
|
fromAddress,
|
||||||
fromWallet,
|
fromWallet,
|
||||||
|
@ -535,7 +536,13 @@ export default class SendDetails extends Component {
|
||||||
targets = [{ address: firstTransaction.address, amount: BitcoinUnit.MAX }];
|
targets = [{ address: firstTransaction.address, amount: BitcoinUnit.MAX }];
|
||||||
}
|
}
|
||||||
|
|
||||||
let { tx, fee, psbt } = wallet.createTransaction(wallet.getUtxo(), targets, requestedSatPerByte, changeAddress);
|
let { tx, fee, psbt } = wallet.createTransaction(
|
||||||
|
wallet.getUtxo(),
|
||||||
|
targets,
|
||||||
|
requestedSatPerByte,
|
||||||
|
changeAddress,
|
||||||
|
this.state.isTransactionReplaceable === true ? HDSegwitBech32Wallet.defaultRBFSequence : false,
|
||||||
|
);
|
||||||
|
|
||||||
if (wallet.type === WatchOnlyWallet.type) {
|
if (wallet.type === WatchOnlyWallet.type) {
|
||||||
// watch-only wallets with enabled HW wallet support have different flow. we have to show PSBT to user as QR code
|
// watch-only wallets with enabled HW wallet support have different flow. we have to show PSBT to user as QR code
|
||||||
|
@ -720,6 +727,15 @@ export default class SendDetails extends Component {
|
||||||
onPress={this.onUseAllPressed}
|
onPress={this.onUseAllPressed}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
{this.state.fromWallet.type === HDSegwitBech32Wallet.type && (
|
||||||
|
<BlueListItem
|
||||||
|
title="Allow Fee Bump"
|
||||||
|
hideChevron
|
||||||
|
switchButton
|
||||||
|
switched={this.state.isTransactionReplaceable}
|
||||||
|
onSwitch={this.onReplaceableFeeSwitchValueChanged}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
{this.state.fromWallet.allowBatchSend() && (
|
{this.state.fromWallet.allowBatchSend() && (
|
||||||
<>
|
<>
|
||||||
<BlueListItem
|
<BlueListItem
|
||||||
|
@ -770,6 +786,10 @@ export default class SendDetails extends Component {
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
onReplaceableFeeSwitchValueChanged = value => {
|
||||||
|
this.setState({ isTransactionReplaceable: value });
|
||||||
|
};
|
||||||
|
|
||||||
renderCreateButton = () => {
|
renderCreateButton = () => {
|
||||||
return (
|
return (
|
||||||
<View style={{ marginHorizontal: 56, marginVertical: 16, alignContent: 'center', backgroundColor: '#FFFFFF', minHeight: 44 }}>
|
<View style={{ marginHorizontal: 56, marginVertical: 16, alignContent: 'center', backgroundColor: '#FFFFFF', minHeight: 44 }}>
|
||||||
|
|
Loading…
Add table
Reference in a new issue