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 17:36:24 +00:00
|
|
|
: address = '',
|
2023-07-25 15:21:49 +00:00
|
|
|
super(walletInfo);
|
2023-07-24 20:23:09 +00:00
|
|
|
|
|
|
|
@override
|
|
|
|
String address;
|
2023-07-25 15:21:49 +00:00
|
|
|
|
2023-07-24 20:23:09 +00:00
|
|
|
@override
|
|
|
|
Future<void> init() async {
|
2023-07-25 17:36:24 +00:00
|
|
|
address = walletInfo.address;
|
|
|
|
await updateAddressesInBox();
|
2023-07-24 20:23:09 +00:00
|
|
|
}
|
|
|
|
|
2023-07-25 15:21:49 +00:00
|
|
|
@override
|
|
|
|
Future<void> updateAddressesInBox() async {
|
2023-07-25 17:36:24 +00:00
|
|
|
try {
|
|
|
|
addressesMap.clear();
|
|
|
|
addressesMap[address] = '';
|
|
|
|
await saveAddressesInBox();
|
|
|
|
} catch (e) {
|
|
|
|
print(e.toString());
|
2023-07-24 20:23:09 +00:00
|
|
|
}
|
|
|
|
}
|
2023-07-25 17:36:24 +00:00
|
|
|
}
|