cake_wallet/cw_nano/lib/nano_wallet_addresses.dart

49 lines
1.1 KiB
Dart
Raw Normal View History

2023-07-24 20:23:09 +00:00
import 'package:cw_core/wallet_addresses.dart';
import 'package:cw_core/wallet_info.dart';
import 'package:cw_core/account.dart';
import 'package:cw_nano/nano_account_list.dart';
import 'package:cw_core/subaddress.dart';
import 'package:mobx/mobx.dart';
2023-07-25 15:21:49 +00:00
part 'nano_wallet_addresses.g.dart';
2023-07-24 20:23:09 +00:00
2023-07-25 15:21:49 +00:00
class NanoWalletAddresses = NanoWalletAddressesBase with _$NanoWalletAddresses;
2023-07-24 20:23:09 +00:00
abstract class NanoWalletAddressesBase extends WalletAddresses with Store {
NanoWalletAddressesBase(WalletInfo walletInfo)
2023-07-25 15:21:49 +00:00
: accountList = NanoAccountList(),
address = '',
super(walletInfo);
2023-07-24 20:23:09 +00:00
@override
@observable
String address;
2023-07-25 15:21:49 +00:00
2023-07-24 20:23:09 +00:00
@observable
Account? account;
NanoAccountList accountList;
@override
Future<void> init() async {
accountList.update();
account = accountList.accounts.first;
}
2023-07-25 15:21:49 +00:00
@override
Future<void> updateAddressesInBox() async {
throw UnimplementedError();
}
2023-07-24 20:23:09 +00:00
bool validate() {
accountList.update();
final accountListLength = accountList.accounts.length ?? 0;
if (accountListLength <= 0) {
return false;
}
return true;
}
2023-07-25 15:21:49 +00:00
}