mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2024-12-23 03:59:23 +00:00
Fix conflicts with main
This commit is contained in:
parent
5cfea38f22
commit
52f16b5130
1 changed files with 36 additions and 15 deletions
|
@ -198,15 +198,14 @@ abstract class ElectrumWalletBase
|
||||||
List<BitcoinBaseAddress> outputAddresses,
|
List<BitcoinBaseAddress> outputAddresses,
|
||||||
List<BitcoinOutput> outputs,
|
List<BitcoinOutput> outputs,
|
||||||
BitcoinTransactionCredentials transactionCredentials,
|
BitcoinTransactionCredentials transactionCredentials,
|
||||||
{int? inputsCount}) async {
|
{int? inputsCount,
|
||||||
|
String? memo}) async {
|
||||||
final utxos = <UtxoWithAddress>[];
|
final utxos = <UtxoWithAddress>[];
|
||||||
List<ECPrivate> privateKeys = [];
|
List<ECPrivate> privateKeys = [];
|
||||||
|
|
||||||
var leftAmount = credentialsAmount;
|
var leftAmount = credentialsAmount;
|
||||||
var allInputsAmount = 0;
|
var allInputsAmount = 0;
|
||||||
|
|
||||||
final String? opReturnMemo = outputs.first.memo;
|
|
||||||
|
|
||||||
for (int i = 0; i < unspentCoins.length; i++) {
|
for (int i = 0; i < unspentCoins.length; i++) {
|
||||||
final utx = unspentCoins[i];
|
final utx = unspentCoins[i];
|
||||||
|
|
||||||
|
@ -258,7 +257,11 @@ abstract class ElectrumWalletBase
|
||||||
}
|
}
|
||||||
|
|
||||||
final estimatedSize = BitcoinTransactionBuilder.estimateTransactionSize(
|
final estimatedSize = BitcoinTransactionBuilder.estimateTransactionSize(
|
||||||
utxos: utxos, outputs: outputs, network: network);
|
utxos: utxos,
|
||||||
|
outputs: outputs,
|
||||||
|
network: network,
|
||||||
|
memo: memo,
|
||||||
|
);
|
||||||
|
|
||||||
final fee = transactionCredentials.feeRate != null
|
final fee = transactionCredentials.feeRate != null
|
||||||
? feeAmountWithFeeRate(transactionCredentials.feeRate!, 0, 0, size: estimatedSize)
|
? feeAmountWithFeeRate(transactionCredentials.feeRate!, 0, 0, size: estimatedSize)
|
||||||
|
@ -305,7 +308,13 @@ abstract class ElectrumWalletBase
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return EstimatedTxResult(utxos: utxos, privateKeys: privateKeys, fee: fee, amount: amount);
|
return EstimatedTxResult(
|
||||||
|
utxos: utxos,
|
||||||
|
privateKeys: privateKeys,
|
||||||
|
fee: fee,
|
||||||
|
amount: amount,
|
||||||
|
memo: memo,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
@ -347,13 +356,22 @@ abstract class ElectrumWalletBase
|
||||||
}
|
}
|
||||||
|
|
||||||
final estimatedTx = await _estimateTxFeeAndInputsToUse(
|
final estimatedTx = await _estimateTxFeeAndInputsToUse(
|
||||||
credentialsAmount, sendAll, outputAddresses, outputs, transactionCredentials);
|
credentialsAmount,
|
||||||
|
sendAll,
|
||||||
|
outputAddresses,
|
||||||
|
outputs,
|
||||||
|
transactionCredentials,
|
||||||
|
memo: transactionCredentials.outputs.first.memo,
|
||||||
|
);
|
||||||
|
|
||||||
final txb = BitcoinTransactionBuilder(
|
final txb = BitcoinTransactionBuilder(
|
||||||
utxos: estimatedTx.utxos,
|
utxos: estimatedTx.utxos,
|
||||||
outputs: outputs,
|
outputs: outputs,
|
||||||
fee: BigInt.from(estimatedTx.fee),
|
fee: BigInt.from(estimatedTx.fee),
|
||||||
network: network);
|
network: network,
|
||||||
|
memo: estimatedTx.memo,
|
||||||
|
outputOrdering: BitcoinOrdering.none,
|
||||||
|
);
|
||||||
|
|
||||||
final transaction = txb.buildTransaction((txDigest, utxo, publicKey, sighash) {
|
final transaction = txb.buildTransaction((txDigest, utxo, publicKey, sighash) {
|
||||||
final key = estimatedTx.privateKeys
|
final key = estimatedTx.privateKeys
|
||||||
|
@ -370,9 +388,6 @@ abstract class ElectrumWalletBase
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// TODO: fix
|
|
||||||
if (opReturnMemo != null) txb.addOutputData(opReturnMemo);
|
|
||||||
|
|
||||||
return PendingBitcoinTransaction(transaction, type,
|
return PendingBitcoinTransaction(transaction, type,
|
||||||
electrumClient: electrumClient,
|
electrumClient: electrumClient,
|
||||||
amount: estimatedTx.amount,
|
amount: estimatedTx.amount,
|
||||||
|
@ -875,13 +890,19 @@ class EstimateTxParams {
|
||||||
}
|
}
|
||||||
|
|
||||||
class EstimatedTxResult {
|
class EstimatedTxResult {
|
||||||
EstimatedTxResult(
|
EstimatedTxResult({
|
||||||
{required this.utxos, required this.privateKeys, required this.fee, required this.amount});
|
required this.utxos,
|
||||||
|
required this.privateKeys,
|
||||||
|
required this.fee,
|
||||||
|
required this.amount,
|
||||||
|
this.memo,
|
||||||
|
});
|
||||||
|
|
||||||
final List<UtxoWithAddress> utxos;
|
final List<UtxoWithAddress> utxos;
|
||||||
final List<ECPrivate> privateKeys;
|
final List<ECPrivate> privateKeys;
|
||||||
final int fee;
|
final int fee;
|
||||||
final int amount;
|
final int amount;
|
||||||
|
final String? memo;
|
||||||
}
|
}
|
||||||
|
|
||||||
BitcoinBaseAddress _addressTypeFromStr(String address, BasedUtxoNetwork network) {
|
BitcoinBaseAddress _addressTypeFromStr(String address, BasedUtxoNetwork network) {
|
||||||
|
|
Loading…
Reference in a new issue