| 1 | import 'package:cw_zano/api/model/recent_history.dart'; |
| 2 | import 'package:cw_zano/api/model/wi.dart'; |
| 3 | import 'package:cw_zano/zano_wallet.dart'; |
| 4 | |
| 5 | class CreateWalletResult { |
| 6 | final String name; |
| 7 | final String pass; |
| 8 | final RecentHistory recentHistory; |
| 9 | final bool recovered; |
| 10 | final int walletFileSize; |
| 11 | final int walletId; |
| 12 | final int walletLocalBcSize; |
| 13 | final Wi wi; |
| 14 | final String privateSpendKey; |
| 15 | final String privateViewKey; |
| 16 | final String publicSpendKey; |
| 17 | final String publicViewKey; |
| 18 | |
| 19 | CreateWalletResult( |
| 20 | {required this.name, |
| 21 | required this.pass, |
| 22 | required this.recentHistory, |
| 23 | required this.recovered, |
| 24 | required this.walletFileSize, |
| 25 | required this.walletId, |
| 26 | required this.walletLocalBcSize, |
| 27 | required this.wi, |
| 28 | required this.privateSpendKey, |
| 29 | required this.privateViewKey, |
| 30 | required this.publicSpendKey, |
| 31 | required this.publicViewKey}); |
| 32 | |
| 33 | factory CreateWalletResult.fromJson(Map<String, dynamic> json) => CreateWalletResult( |
| 34 | name: json['name'] as String? ?? '', |
| 35 | pass: json['pass'] as String? ?? '', |
| 36 | recentHistory: |
| 37 | RecentHistory.fromJson(json['recent_history'] as Map<String, dynamic>? ?? {}), |
| 38 | recovered: json['recovered'] as bool? ?? false, |
| 39 | walletFileSize: json['wallet_file_size'] as int? ?? 0, |
| 40 | walletId: json['wallet_id'] as int? ?? 0, |
| 41 | walletLocalBcSize: json['wallet_local_bc_size'] as int? ?? 0, |
| 42 | wi: Wi.fromJson(json['wi'] as Map<String, dynamic>? ?? {}), |
| 43 | privateSpendKey: json['private_spend_key'] as String? ?? '', |
| 44 | privateViewKey: json['private_view_key'] as String? ?? '', |
| 45 | publicSpendKey: json['public_spend_key'] as String? ?? '', |
| 46 | publicViewKey: json['public_view_key'] as String? ?? '', |
| 47 | ); |
| 48 | Future<String> seed(ZanoWalletBase api) { |
| 49 | return api.getSeed(); |
| 50 | } |
| 51 | } |