mirror of
https://github.com/BlueWallet/BlueWallet.git
synced 2025-03-13 19:16:52 +01:00
fix: on SendDetails screen move targets creation out of options loop
This commit is contained in:
parent
c4b1e67f9d
commit
7bb3dd6aef
1 changed files with 31 additions and 31 deletions
|
@ -295,38 +295,38 @@ const SendDetails = () => {
|
|||
|
||||
const newFeePrecalc: /* Record<string, any> */ IFee = { ...feePrecalc };
|
||||
|
||||
let targets = [];
|
||||
for (const transaction of addresses) {
|
||||
if (transaction.amount === BitcoinUnit.MAX) {
|
||||
// single output with MAX
|
||||
targets = [{ address: transaction.address }];
|
||||
break;
|
||||
}
|
||||
const value = transaction.amountSats;
|
||||
if (Number(value) > 0) {
|
||||
targets.push({ address: transaction.address, value });
|
||||
} else if (transaction.amount) {
|
||||
if (btcToSatoshi(transaction.amount) > 0) {
|
||||
targets.push({ address: transaction.address, value: btcToSatoshi(transaction.amount) });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// if targets is empty, insert dust
|
||||
if (targets.length === 0) {
|
||||
targets.push({ address: '36JxaUrpDzkEerkTf1FzwHNE1Hb7cCjgJV', value: 546 });
|
||||
}
|
||||
|
||||
// replace wrong addresses with dump
|
||||
targets = targets.map(t => {
|
||||
if (!wallet.isAddressValid(t.address)) {
|
||||
return { ...t, address: '36JxaUrpDzkEerkTf1FzwHNE1Hb7cCjgJV' };
|
||||
} else {
|
||||
return t;
|
||||
}
|
||||
});
|
||||
|
||||
for (const opt of options) {
|
||||
let targets = [];
|
||||
for (const transaction of addresses) {
|
||||
if (transaction.amount === BitcoinUnit.MAX) {
|
||||
// single output with MAX
|
||||
targets = [{ address: transaction.address }];
|
||||
break;
|
||||
}
|
||||
const value = transaction.amountSats;
|
||||
if (Number(value) > 0) {
|
||||
targets.push({ address: transaction.address, value });
|
||||
} else if (transaction.amount) {
|
||||
if (btcToSatoshi(transaction.amount) > 0) {
|
||||
targets.push({ address: transaction.address, value: btcToSatoshi(transaction.amount) });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// if targets is empty, insert dust
|
||||
if (targets.length === 0) {
|
||||
targets.push({ address: '36JxaUrpDzkEerkTf1FzwHNE1Hb7cCjgJV', value: 546 });
|
||||
}
|
||||
|
||||
// replace wrong addresses with dump
|
||||
targets = targets.map(t => {
|
||||
if (!wallet.isAddressValid(t.address)) {
|
||||
return { ...t, address: '36JxaUrpDzkEerkTf1FzwHNE1Hb7cCjgJV' };
|
||||
} else {
|
||||
return t;
|
||||
}
|
||||
});
|
||||
|
||||
let flag = false;
|
||||
while (true) {
|
||||
try {
|
||||
|
|
Loading…
Add table
Reference in a new issue