mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2025-01-09 04:19:36 +00:00
25 lines
No EOL
901 B
Dart
25 lines
No EOL
901 B
Dart
import 'dart:convert';
|
|
import 'package:cw_bitcoin/bitcoin_address_record.dart';
|
|
import 'package:cw_bitcoin/electrum_balance.dart';
|
|
import 'package:cw_bitcoin/file.dart';
|
|
import 'package:cw_core/pathForWallet.dart';
|
|
import 'package:cw_core/wallet_type.dart';
|
|
|
|
class ElectrumWallletSnapshot {
|
|
ElectrumWallletSnapshot({
|
|
required this.mnemonic,
|
|
});
|
|
|
|
String mnemonic;
|
|
|
|
static Future<ElectrumWallletSnapshot> load(String name, WalletType type, String password) async {
|
|
final path = await pathForWallet(name: name, type: type);
|
|
final jsonSource = await read(path: path, password: password);
|
|
// final data = json.decode(jsonSource) as Map;
|
|
// final mnemonic = data['mnemonic'] as String;
|
|
|
|
return ElectrumWallletSnapshot(
|
|
mnemonic: jsonSource, //Passing the jsonSource as mnemonic because the json.decode() method throws an exception unterminated string
|
|
);
|
|
}
|
|
} |