cake_wallet/cw_decred/lib/wallet_addresses.dart

47 lines
1.1 KiB
Dart
Raw Normal View History

2024-03-12 04:54:43 +00:00
import 'dart:convert';
import 'package:cw_core/wallet_addresses.dart';
import 'package:cw_core/wallet_info.dart';
import 'package:cw_decred/api/libdcrwallet.dart' as libdcrwallet;
class DecredWalletAddresses extends WalletAddresses {
DecredWalletAddresses(WalletInfo walletInfo) : super(walletInfo);
2024-08-27 08:38:04 +00:00
String currentAddr = '';
@override
String get address {
2024-08-27 08:38:04 +00:00
final cAddr = libdcrwallet.currentReceiveAddress(walletInfo.name) ?? '';
if (cAddr != '') {
currentAddr = cAddr;
}
return currentAddr;
}
String generateNewAddress() {
2024-08-27 08:38:04 +00:00
final nAddr = libdcrwallet.newExternalAddress(walletInfo.name) ?? '';
if (nAddr != '') {
currentAddr = nAddr;
}
return nAddr;
}
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;
}
@override
set address(String addr) {}
@override
Future<void> init() async {}
@override
Future<void> updateAddressesInBox() async {}
@override
Future<void> saveAddressesInBox() async {}
}