mirror of
https://github.com/Such-Software/hash-wallet.git
synced 2026-10-26 06:08:40 +01:00
guard regeneration of lightning address
This commit is contained in:
@@ -442,6 +442,10 @@ abstract class ElectrumWalletAddressesBase extends WalletAddresses with Store {
|
||||
|
||||
@action
|
||||
BaseBitcoinAddressRecord generateNewAddress({String label = ''}) {
|
||||
if (addressPageType is LightningAddressType) {
|
||||
throw Exception("Lightning addresses cannot be rotated");
|
||||
}
|
||||
|
||||
if (addressPageType == SilentPaymentsAddresType.p2sp && silentAddress != null) {
|
||||
final currentSilentAddressIndex = silentAddresses
|
||||
.where((addressRecord) => addressRecord.type != SegwitAddresType.p2tr)
|
||||
|
||||
@@ -317,6 +317,12 @@ class CWBitcoin extends Bitcoin {
|
||||
return bitcoinWallet.walletAddresses.addressPageType == SilentPaymentsAddresType.p2sp;
|
||||
}
|
||||
|
||||
@override
|
||||
bool hasSelectedLightning(Object wallet) {
|
||||
final bitcoinWallet = wallet as ElectrumWallet;
|
||||
return bitcoinWallet.walletAddresses.addressPageType is LightningAddressType;
|
||||
}
|
||||
|
||||
@override
|
||||
BitcoinAddressType getBitcoinAddressType(ReceivePageOption option) {
|
||||
switch (option) {
|
||||
|
||||
@@ -614,7 +614,8 @@ abstract class WalletAddressListViewModelBase extends WalletChangeListenerViewMo
|
||||
|
||||
@computed
|
||||
bool get isLightning =>
|
||||
wallet.type == WalletType.bitcoin && selectedCurrency == CryptoCurrency.btcln;
|
||||
wallet.type == WalletType.bitcoin &&
|
||||
(selectedCurrency == CryptoCurrency.btcln || bitcoin!.hasSelectedLightning(wallet));
|
||||
|
||||
@computed
|
||||
bool get isZCashTransparent {
|
||||
|
||||
@@ -149,6 +149,7 @@ import 'package:cw_bitcoin/bitcoin_amount_format.dart';
|
||||
import 'package:cw_bitcoin/bitcoin_address_record.dart';
|
||||
import 'package:cw_bitcoin/bitcoin_wallet_addresses.dart';
|
||||
import 'package:cw_bitcoin/bitcoin_transaction_credentials.dart';
|
||||
import 'package:cw_bitcoin/lightning/lightning_addres_type.dart';
|
||||
import 'package:cw_bitcoin/lightning/pending_lightning_transaction.dart';
|
||||
import 'package:cw_bitcoin/litecoin_wallet_service.dart';
|
||||
import 'package:cw_bitcoin/litecoin_wallet.dart';
|
||||
@@ -245,6 +246,7 @@ abstract class Bitcoin {
|
||||
ReceivePageOption getLitecoinMwebReceivePageOption();
|
||||
bool isPayjoinAvailable(Object wallet);
|
||||
bool hasSelectedSilentPayments(Object wallet);
|
||||
bool hasSelectedLightning(Object wallet);
|
||||
bool isBitcoinReceivePageOption(ReceivePageOption option);
|
||||
BitcoinAddressType getOptionToType(ReceivePageOption option);
|
||||
bool hasTaprootInput(PendingTransaction pendingTransaction);
|
||||
|
||||
Reference in New Issue
Block a user