mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2024-12-29 15:09:23 +00:00
1eb8d0c698
* add restoring wallet from qr * add restore mode * add alert for exceptions * add restore from seed * add check for create wallet state * convert sweeping page into stateful * fix parsing url * restoration flow update * update restoring from key mode * update config * fix restor of BTC and LTC wallets * fix pin code issue * wallet Seed/keys uri or code fix * fix key restore credentials * update the restore workflow * update from main * PR coments fixes * update * update * PR fixes
66 lines
2 KiB
Dart
66 lines
2 KiB
Dart
import 'package:cake_wallet/view_model/restore/restore_mode.dart';
|
|
import 'package:cw_core/wallet_type.dart';
|
|
|
|
class RestoredWallet {
|
|
RestoredWallet(
|
|
{required this.restoreMode,
|
|
required this.type,
|
|
required this.address,
|
|
this.txId,
|
|
this.spendKey,
|
|
this.viewKey,
|
|
this.mnemonicSeed,
|
|
this.txAmount,
|
|
this.txDescription,
|
|
this.recipientName,
|
|
this.height});
|
|
|
|
final WalletRestoreMode restoreMode;
|
|
final WalletType type;
|
|
final String? address;
|
|
final String? txId;
|
|
final String? spendKey;
|
|
final String? viewKey;
|
|
final String? mnemonicSeed;
|
|
final String? txAmount;
|
|
final String? txDescription;
|
|
final String? recipientName;
|
|
final int? height;
|
|
|
|
factory RestoredWallet.fromKey(Map<String, dynamic> json) {
|
|
final height = json['height'] as String?;
|
|
return RestoredWallet(
|
|
restoreMode: json['mode'] as WalletRestoreMode,
|
|
type: json['type'] as WalletType,
|
|
address: json['address'] as String?,
|
|
spendKey: json['spend_key'] as String?,
|
|
viewKey: json['view_key'] as String?,
|
|
height: height != null ? int.parse(height) : 0,
|
|
);
|
|
}
|
|
|
|
factory RestoredWallet.fromSeed(Map<String, dynamic> json) {
|
|
final height = json['height'] as String?;
|
|
final mnemonic_seed = json['mnemonic_seed'] as String?;
|
|
final seed = json['seed'] as String?;
|
|
return RestoredWallet(
|
|
restoreMode: json['mode'] as WalletRestoreMode,
|
|
type: json['type'] as WalletType,
|
|
address: json['address'] as String?,
|
|
mnemonicSeed: mnemonic_seed ?? seed,
|
|
height: height != null ? int.parse(height) : 0,
|
|
);
|
|
}
|
|
|
|
factory RestoredWallet.fromTxIds(Map<String, dynamic> json) {
|
|
return RestoredWallet(
|
|
restoreMode: json['mode'] as WalletRestoreMode,
|
|
type: json['type'] as WalletType,
|
|
address: json['address'] as String?,
|
|
txId: json['tx_payment_id'] as String,
|
|
txAmount: json['tx_amount'] as String,
|
|
txDescription: json['tx_description'] as String?,
|
|
recipientName: json['recipient_name'] as String?,
|
|
);
|
|
}
|
|
}
|