Generic fixes (#1342)

* handle balance exceptions in estimating All exchange

* Fix trades not showing
This commit is contained in:
Omar Hatem 2024-03-21 16:31:05 +02:00 committed by GitHub
parent ecb4f32cda
commit af7fe05099
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 19 additions and 13 deletions

View file

@ -220,7 +220,9 @@ abstract class ElectrumWalletAddressesBase extends WalletAddresses with Store {
Future<void> updateAddressesInBox() async {
try {
addressesMap.clear();
addressesMap[address] = '';
_addresses.forEach((addressRecord) {
addressesMap[addressRecord.address] = addressRecord.name;
});
await saveAddressesInBox();
} catch (e) {
print(e.toString());

View file

@ -127,19 +127,23 @@ class CWBitcoin extends Bitcoin {
final p2shAddr = sk.getPublic().toP2pkhInP2sh();
final p2wpkhAddr = sk.getPublic().toP2wpkhAddress();
final estimatedTx = await electrumWallet.estimateTxFeeAndInputsToUse(
0,
true,
// Deposit address + change address
[p2shAddr, p2wpkhAddr],
[
BitcoinOutput(address: p2shAddr, value: BigInt.zero),
BitcoinOutput(address: p2wpkhAddr, value: BigInt.zero)
],
null,
priority as BitcoinTransactionPriority);
try {
final estimatedTx = await electrumWallet.estimateTxFeeAndInputsToUse(
0,
true,
// Deposit address + change address
[p2shAddr, p2wpkhAddr],
[
BitcoinOutput(address: p2shAddr, value: BigInt.zero),
BitcoinOutput(address: p2wpkhAddr, value: BigInt.zero)
],
null,
priority as BitcoinTransactionPriority);
return estimatedTx.amount;
return estimatedTx.amount;
} catch (_) {
return 0;
}
}
@override