2024-03-12 04:54:43 +00:00
|
|
|
import 'dart:convert';
|
|
|
|
|
2023-12-22 11:59:02 +00:00
|
|
|
import 'package:cw_core/wallet_addresses.dart';
|
|
|
|
import 'package:cw_core/wallet_info.dart';
|
2024-03-06 02:32:15 +00:00
|
|
|
import 'package:cw_decred/api/libdcrwallet.dart' as libdcrwallet;
|
2023-12-22 11:59:02 +00:00
|
|
|
|
|
|
|
class DecredWalletAddresses extends WalletAddresses {
|
2024-03-06 02:32:15 +00:00
|
|
|
DecredWalletAddresses(WalletInfo walletInfo) : super(walletInfo);
|
2023-12-22 11:59:02 +00:00
|
|
|
|
|
|
|
@override
|
|
|
|
String get address {
|
2024-03-06 02:32:15 +00:00
|
|
|
return libdcrwallet.currentReceiveAddress(walletInfo.name) ?? '';
|
2023-12-22 11:59:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
String generateNewAddress() {
|
2024-03-12 04:54:43 +00:00
|
|
|
return libdcrwallet.newExternalAddress(walletInfo.name) ?? '';
|
2023-12-22 11:59:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
List<String> addresses() {
|
2024-03-12 04:54:43 +00:00
|
|
|
final res = libdcrwallet.addresses(walletInfo.name);
|
|
|
|
final addrs = (json.decode(res) as List<dynamic>).cast<String>();
|
|
|
|
return addrs;
|
2023-12-22 11:59:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
@override
|
|
|
|
set address(String addr) {}
|
|
|
|
|
|
|
|
@override
|
|
|
|
Future<void> init() async {}
|
|
|
|
|
|
|
|
@override
|
|
|
|
Future<void> updateAddressesInBox() async {}
|
|
|
|
|
|
|
|
@override
|
|
|
|
Future<void> saveAddressesInBox() async {}
|
|
|
|
}
|