This commit is contained in:
M 2020-08-31 17:39:12 +03:00
parent fec2ec2845
commit eaa5d48bb6
3 changed files with 9 additions and 7 deletions

View file

@ -37,7 +37,6 @@ import 'package:shared_preferences/shared_preferences.dart';
part 'bitcoin_wallet.g.dart';
class BitcoinWallet = BitcoinWalletBase with _$BitcoinWallet;
abstract class BitcoinWalletBase extends WalletBase<BitcoinBalance> with Store {

View file

@ -1,5 +1,4 @@
import 'dart:io';
import 'dart:convert';
import 'package:bip39/bip39.dart' as bip39;
import 'package:cake_wallet/bitcoin/file.dart';
import 'package:cake_wallet/bitcoin/bitcoin_wallet_creation_credentials.dart';

View file

@ -1,6 +1,7 @@
import 'dart:async';
import 'dart:convert';
import 'dart:io';
import 'dart:typed_data';
import 'package:cake_wallet/bitcoin/script_hash.dart';
import 'package:flutter/foundation.dart';
import 'package:rxdart/rxdart.dart';
@ -52,9 +53,11 @@ class ElectrumClient {
socket = await SecureSocket.connect(host, port, timeout: connectionTimeout);
_setIsConnected(true);
socket.listen((List<int> event) {
socket.listen((Uint8List event) {
try {
final jsoned = json.decode(utf8.decode(event)) as Map<String, Object>;
final jsoned =
json.decode(utf8.decode(event.toList())) as Map<String, Object>;
print(jsoned);
final method = jsoned['method'];
final id = jsoned['id'] as String;
@ -69,9 +72,10 @@ class ElectrumClient {
} catch (e) {
print(e);
}
},
onError: (Error _) => _setIsConnected(false),
onDone: () => _setIsConnected(false));
}, onError: (Object error) {
print(error.toString());
_setIsConnected(false);
}, onDone: () => _setIsConnected(false));
keepAlive();
}