2021-11-07 04:23:05 +01:00
|
|
|
import 'package:hive_flutter/hive_flutter.dart';
|
2021-11-14 19:21:20 +01:00
|
|
|
part 'wallet_data.g.dart';
|
2021-11-07 04:23:05 +01:00
|
|
|
|
|
|
|
@HiveType(typeId: 0)
|
|
|
|
class WalletData extends HiveObject {
|
|
|
|
@HiveField(0)
|
2022-05-24 16:51:40 +02:00
|
|
|
int? version;
|
2021-11-07 04:23:05 +01:00
|
|
|
|
|
|
|
@HiveField(1)
|
2022-05-24 16:51:40 +02:00
|
|
|
int? chest;
|
2021-11-07 04:23:05 +01:00
|
|
|
|
|
|
|
@HiveField(2)
|
2022-05-24 16:51:40 +02:00
|
|
|
String? address;
|
2021-11-07 04:23:05 +01:00
|
|
|
|
|
|
|
@HiveField(3)
|
2022-05-24 16:51:40 +02:00
|
|
|
int? number;
|
2021-11-07 04:23:05 +01:00
|
|
|
|
2021-11-11 14:45:12 +01:00
|
|
|
@HiveField(4)
|
2022-05-24 16:51:40 +02:00
|
|
|
String? name;
|
2021-11-11 14:45:12 +01:00
|
|
|
|
2021-11-17 06:20:23 +01:00
|
|
|
@HiveField(5)
|
2022-05-24 16:51:40 +02:00
|
|
|
int? derivation;
|
2022-05-19 07:00:25 +02:00
|
|
|
|
|
|
|
@HiveField(6)
|
2022-05-28 19:13:30 +02:00
|
|
|
String? imageDefaultPath;
|
2022-05-24 16:51:40 +02:00
|
|
|
|
|
|
|
@HiveField(7)
|
2022-05-28 19:13:30 +02:00
|
|
|
String? imageCustomPath;
|
2021-11-17 06:20:23 +01:00
|
|
|
|
2021-11-11 14:45:12 +01:00
|
|
|
WalletData(
|
2022-05-24 16:51:40 +02:00
|
|
|
{this.version,
|
|
|
|
this.chest,
|
2022-05-19 07:00:25 +02:00
|
|
|
this.address,
|
2021-11-17 06:20:23 +01:00
|
|
|
this.number,
|
|
|
|
this.name,
|
|
|
|
this.derivation,
|
2022-05-28 19:13:30 +02:00
|
|
|
this.imageDefaultPath,
|
|
|
|
this.imageCustomPath});
|
2021-11-07 04:23:05 +01:00
|
|
|
|
|
|
|
// representation of WalletData when debugging
|
|
|
|
@override
|
|
|
|
String toString() {
|
2021-12-23 12:36:09 +01:00
|
|
|
return name!;
|
2021-11-07 04:23:05 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
// creates the ':'-separated string from the WalletData
|
|
|
|
String inLine() {
|
2022-05-28 19:13:30 +02:00
|
|
|
return "$chest:$number:$name:$derivation:$imageDefaultPath";
|
2021-11-07 04:23:05 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
// returns only the id part of the ':'-separated string
|
2021-12-23 12:36:09 +01:00
|
|
|
List<int?> id() {
|
2021-11-14 19:21:20 +01:00
|
|
|
return [chest, number];
|
2021-11-07 04:23:05 +01:00
|
|
|
}
|
|
|
|
}
|
2022-05-19 07:00:25 +02:00
|
|
|
|
|
|
|
class NewWallet {
|
|
|
|
final String address;
|
|
|
|
final String password;
|
|
|
|
|
|
|
|
NewWallet._(this.address, this.password);
|
|
|
|
}
|