CW-289-Fix bitcoin pending send receive transactions not showing until confirmed (#878)

* Fix error in rendering pending transactions in different device

* Show pending status

* Fix broken subscription stream
This commit is contained in:
Godwin Asuquo 2023-04-20 23:20:37 +03:00 committed by GitHub
parent ab20312e61
commit 3fc927f742
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 7 deletions

View file

@ -410,7 +410,7 @@ class ElectrumClient {
switch (method) {
case 'blockchain.scripthash.subscribe':
final params = request['params'] as List<dynamic>;
final scripthash = params.first as String;
final scripthash = params.first as String?;
final id = 'blockchain.scripthash.subscribe:$scripthash';
_tasks[id]?.subject?.add(params.last);
@ -430,15 +430,17 @@ class ElectrumClient {
void _handleResponse(Map<String, dynamic> response) {
final method = response['method'];
final id = response['id'] as String;
final id = response['id'] as String?;
final result = response['result'];
if (method is String) {
_methodHandler(method: method, request: response);
return;
}
_finish(id, result);
if (id != null){
_finish(id, result);
}
}
}

View file

@ -136,7 +136,7 @@ class ElectrumTransactionInfo extends TransactionInfo {
return ElectrumTransactionInfo(type,
id: bundle.originalTransaction.getId(),
height: height,
isPending: false,
isPending: bundle.confirmations == 0,
fee: fee,
direction: direction,
amount: amount,

View file

@ -537,8 +537,8 @@ abstract class ElectrumWalletBase extends WalletBase<ElectrumBalance,
final transactionHex = verboseTransaction['hex'] as String;
final original = bitcoin.Transaction.fromHex(transactionHex);
final ins = <bitcoin.Transaction>[];
final time = verboseTransaction['time'] as int;
final confirmations = verboseTransaction['confirmations'] as int ?? 0;
final time = verboseTransaction['time'] as int?;
final confirmations = verboseTransaction['confirmations'] as int? ?? 0;
for (final vin in original.ins) {
final id = HEX.encode(vin.hash!.reversed.toList());