lots of merge conflict fixes :(

This commit is contained in:
fosse 2024-02-23 12:29:11 -05:00
parent c4614725c3
commit 7b68c036d5
12 changed files with 153 additions and 123 deletions

View file

@ -0,0 +1,19 @@
import 'package:cw_core/receive_page_option.dart';
class LightningReceivePageOption implements ReceivePageOption {
static const lightningOnchain = LightningReceivePageOption._('lightningOnchain');
static const lightningInvoice = LightningReceivePageOption._('lightningInvoice');
const LightningReceivePageOption._(this.value);
final String value;
String toString() {
return value;
}
static const all = [
LightningReceivePageOption.lightningInvoice,
LightningReceivePageOption.lightningOnchain
];
}

View file

@ -1,12 +1,15 @@
import 'dart:convert'; import 'dart:convert';
import 'dart:io'; import 'dart:io';
import 'package:bitcoin_base/bitcoin_base.dart';
import 'package:breez_sdk/breez_sdk.dart'; import 'package:breez_sdk/breez_sdk.dart';
import 'package:breez_sdk/bridge_generated.dart'; import 'package:breez_sdk/bridge_generated.dart';
import 'package:cw_bitcoin/bitcoin_mnemonic.dart'; import 'package:cw_bitcoin/bitcoin_mnemonic.dart';
import 'package:cw_bitcoin/bitcoin_wallet_keys.dart'; import 'package:cw_bitcoin/bitcoin_wallet_keys.dart';
import 'package:cw_bitcoin/electrum.dart'; import 'package:cw_bitcoin/electrum.dart';
import 'package:cw_bitcoin/electrum_wallet_addresses.dart'; import 'package:cw_bitcoin/electrum_wallet_addresses.dart';
import 'package:cw_bitcoin/electrum_wallet_snapshot.dart';
import 'package:cw_bitcoin/litecoin_network.dart';
import 'package:cw_core/crypto_currency.dart'; import 'package:cw_core/crypto_currency.dart';
import 'package:cw_core/node.dart'; import 'package:cw_core/node.dart';
import 'package:cw_core/pathForWallet.dart'; import 'package:cw_core/pathForWallet.dart';
@ -24,8 +27,6 @@ import 'package:hive/hive.dart';
import 'package:mobx/mobx.dart'; import 'package:mobx/mobx.dart';
import 'package:flutter/foundation.dart'; import 'package:flutter/foundation.dart';
import 'package:bitcoin_flutter/bitcoin_flutter.dart' as bitcoin; import 'package:bitcoin_flutter/bitcoin_flutter.dart' as bitcoin;
import 'package:cw_bitcoin/electrum_wallet_snapshot.dart';
import 'package:cw_bitcoin/electrum_wallet.dart';
import 'package:cw_core/wallet_info.dart'; import 'package:cw_core/wallet_info.dart';
import 'package:cw_bitcoin/bitcoin_address_record.dart'; import 'package:cw_bitcoin/bitcoin_address_record.dart';
import 'package:cw_bitcoin/bitcoin_wallet_addresses.dart'; import 'package:cw_bitcoin/bitcoin_wallet_addresses.dart';
@ -54,6 +55,7 @@ abstract class LightningWalletBase
late ElectrumWalletAddresses walletAddresses; late ElectrumWalletAddresses walletAddresses;
bitcoin.NetworkType networkType = bitcoin.bitcoin; bitcoin.NetworkType networkType = bitcoin.bitcoin;
late BasedUtxoNetwork network;
@override @override
BitcoinWalletKeys get keys => BitcoinWalletKeys get keys =>
@ -63,18 +65,20 @@ abstract class LightningWalletBase
@observable @observable
SyncStatus syncStatus; SyncStatus syncStatus;
LightningWalletBase( LightningWalletBase({
{required String mnemonic, required String mnemonic,
required String password, required String password,
required WalletInfo walletInfo, required WalletInfo walletInfo,
required Box<UnspentCoinsInfo> unspentCoinsInfo, required Box<UnspentCoinsInfo> unspentCoinsInfo,
required Uint8List seedBytes, required Uint8List seedBytes,
ElectrumClient? electrumClient, String? addressPageType,
List<BitcoinAddressRecord>? initialAddresses, ElectrumClient? electrumClient,
LightningBalance? initialBalance, BasedUtxoNetwork? networkParam,
int initialRegularAddressIndex = 0, List<BitcoinAddressRecord>? initialAddresses,
int initialChangeAddressIndex = 0}) LightningBalance? initialBalance,
: hd = bitcoin.HDWallet.fromSeed(seedBytes, network: bitcoin.bitcoin).derivePath("m/0'/0"), Map<String, int>? initialRegularAddressIndex,
Map<String, int>? initialChangeAddressIndex,
}) : hd = bitcoin.HDWallet.fromSeed(seedBytes, network: bitcoin.bitcoin).derivePath("m/0'/0"),
syncStatus = NotConnectedSyncStatus(), syncStatus = NotConnectedSyncStatus(),
mnemonic = mnemonic, mnemonic = mnemonic,
_password = password, _password = password,
@ -85,14 +89,24 @@ abstract class LightningWalletBase
}), }),
super(walletInfo) { super(walletInfo) {
transactionHistory = LightningTransactionHistory(walletInfo: walletInfo, password: password); transactionHistory = LightningTransactionHistory(walletInfo: walletInfo, password: password);
walletAddresses = BitcoinWalletAddresses(walletInfo,
electrumClient: electrumClient ?? ElectrumClient(), this.network = networkType == bitcoin.bitcoin
initialAddresses: initialAddresses, ? BitcoinNetwork.mainnet
initialRegularAddressIndex: initialRegularAddressIndex, : networkType == litecoinNetwork
initialChangeAddressIndex: initialChangeAddressIndex, ? LitecoinNetwork.mainnet
mainHd: hd, : BitcoinNetwork.testnet;
sideHd: bitcoin.HDWallet.fromSeed(seedBytes, network: networkType).derivePath("m/0'/1"), this.isTestnet = networkType == bitcoin.testnet;
networkType: networkType);
walletAddresses = BitcoinWalletAddresses(
walletInfo,
electrumClient: electrumClient ?? ElectrumClient(),
initialAddresses: initialAddresses,
initialRegularAddressIndex: initialRegularAddressIndex,
initialChangeAddressIndex: initialChangeAddressIndex,
mainHd: hd,
sideHd: bitcoin.HDWallet.fromSeed(seedBytes, network: networkType).derivePath("m/0'/1"),
network: networkParam ?? network,
);
this.electrumClient = electrumClient ?? ElectrumClient(); this.electrumClient = electrumClient ?? ElectrumClient();
@ -108,23 +122,26 @@ abstract class LightningWalletBase
}); });
} }
static Future<LightningWallet> create( static Future<LightningWallet> create({
{required String mnemonic, required String mnemonic,
required String password, required String password,
required WalletInfo walletInfo, required WalletInfo walletInfo,
required Box<UnspentCoinsInfo> unspentCoinsInfo, required Box<UnspentCoinsInfo> unspentCoinsInfo,
List<BitcoinAddressRecord>? initialAddresses, BasedUtxoNetwork? network,
int initialRegularAddressIndex = 0, List<BitcoinAddressRecord>? initialAddresses,
int initialChangeAddressIndex = 0}) async { Map<String, int>? initialRegularAddressIndex,
Map<String, int>? initialChangeAddressIndex,
}) async {
return LightningWallet( return LightningWallet(
mnemonic: mnemonic, mnemonic: mnemonic,
password: password, password: password,
walletInfo: walletInfo, walletInfo: walletInfo,
unspentCoinsInfo: unspentCoinsInfo, unspentCoinsInfo: unspentCoinsInfo,
initialAddresses: initialAddresses, initialAddresses: initialAddresses,
seedBytes: await mnemonicToSeedBytes(mnemonic), seedBytes: await mnemonicToSeedBytes(mnemonic),
initialRegularAddressIndex: initialRegularAddressIndex, initialRegularAddressIndex: initialRegularAddressIndex,
initialChangeAddressIndex: initialChangeAddressIndex); initialChangeAddressIndex: initialChangeAddressIndex,
);
} }
static Future<LightningWallet> open({ static Future<LightningWallet> open({
@ -133,16 +150,22 @@ abstract class LightningWalletBase
required Box<UnspentCoinsInfo> unspentCoinsInfo, required Box<UnspentCoinsInfo> unspentCoinsInfo,
required String password, required String password,
}) async { }) async {
final snp = await ElectrumWallletSnapshot.load(name, walletInfo.type, password); final snp = await ElectrumWalletSnapshot.load(name, walletInfo.type, password,
walletInfo.network != null ? BasedUtxoNetwork.fromName(walletInfo.network!) : null);
return LightningWallet( return LightningWallet(
mnemonic: snp.mnemonic, mnemonic: snp.mnemonic,
password: password, password: password,
walletInfo: walletInfo, walletInfo: walletInfo,
unspentCoinsInfo: unspentCoinsInfo, unspentCoinsInfo: unspentCoinsInfo,
initialAddresses: snp.addresses, initialAddresses: snp.addresses,
seedBytes: await mnemonicToSeedBytes(snp.mnemonic), // initialBalance: snp.balance,
initialRegularAddressIndex: snp.regularAddressIndex, seedBytes: await mnemonicToSeedBytes(snp.mnemonic),
initialChangeAddressIndex: snp.changeAddressIndex); initialRegularAddressIndex: snp.regularAddressIndex,
initialChangeAddressIndex: snp.changeAddressIndex,
addressPageType: snp.addressPageType,
networkParam: snp.network,
);
} }
Future<void> setupBreez(Uint8List seedBytes) async { Future<void> setupBreez(Uint8List seedBytes) async {
@ -312,10 +335,14 @@ abstract class LightningWalletBase
String toJSON() => json.encode({ String toJSON() => json.encode({
'mnemonic': mnemonic, 'mnemonic': mnemonic,
'account_index': walletAddresses.currentReceiveAddressIndex.toString(), 'account_index': walletAddresses.currentReceiveAddressIndexByType,
'change_address_index': walletAddresses.currentChangeAddressIndex.toString(), 'change_address_index': walletAddresses.currentChangeAddressIndexByType,
'addresses': walletAddresses.addresses.map((addr) => addr.toJSON()).toList(), 'addresses': walletAddresses.allAddresses.map((addr) => addr.toJSON()).toList(),
'balance': balance[currency]?.toJSON() 'address_page_type': walletInfo.addressPageType == null
? SegwitAddresType.p2wpkh.toString()
: walletInfo.addressPageType.toString(),
'balance': balance[currency]?.toJSON(),
'network_type': network == BitcoinNetwork.testnet ? 'testnet' : 'mainnet',
}); });
@override @override

View file

@ -1,4 +1,5 @@
import 'dart:io'; import 'dart:io';
import 'package:bitcoin_base/bitcoin_base.dart';
import 'package:cw_bitcoin/bitcoin_mnemonic.dart'; import 'package:cw_bitcoin/bitcoin_mnemonic.dart';
import 'package:cw_bitcoin/bitcoin_mnemonic_is_incorrect_exception.dart'; import 'package:cw_bitcoin/bitcoin_mnemonic_is_incorrect_exception.dart';
import 'package:cw_bitcoin/bitcoin_wallet_creation_credentials.dart'; import 'package:cw_bitcoin/bitcoin_wallet_creation_credentials.dart';
@ -96,16 +97,22 @@ class LightningWalletService extends WalletService<BitcoinNewWalletCredentials,
throw UnimplementedError(); throw UnimplementedError();
@override @override
Future<LightningWallet> restoreFromSeed(BitcoinRestoreWalletFromSeedCredentials credentials) async { Future<LightningWallet> restoreFromSeed(BitcoinRestoreWalletFromSeedCredentials credentials,
{bool? isTestnet}) async {
if (!validateMnemonic(credentials.mnemonic)) { if (!validateMnemonic(credentials.mnemonic)) {
throw BitcoinMnemonicIsIncorrectException(); throw BitcoinMnemonicIsIncorrectException();
} }
final network = isTestnet == true ? BitcoinNetwork.testnet : BitcoinNetwork.mainnet;
credentials.walletInfo?.network = network.value;
final wallet = await LightningWalletBase.create( final wallet = await LightningWalletBase.create(
password: credentials.password!, password: credentials.password!,
mnemonic: credentials.mnemonic, mnemonic: credentials.mnemonic,
walletInfo: credentials.walletInfo!, walletInfo: credentials.walletInfo!,
unspentCoinsInfo: unspentCoinsInfoSource); unspentCoinsInfo: unspentCoinsInfoSource,
network: network,
);
await wallet.save(); await wallet.save();
await wallet.init(); await wallet.init();
return wallet; return wallet;

View file

@ -19,7 +19,7 @@ class SolanaWalletService extends WalletService<SolanaNewWalletCredentials,
final Box<WalletInfo> walletInfoSource; final Box<WalletInfo> walletInfoSource;
@override @override
Future<SolanaWallet> create(SolanaNewWalletCredentials credentials) async { Future<SolanaWallet> create(SolanaNewWalletCredentials credentials, {bool? isTestnet}) async {
final strength = credentials.seedPhraseLength == 24 ? 256 : 128; final strength = credentials.seedPhraseLength == 24 ? 256 : 128;
final mnemonic = bip39.generateMnemonic(strength: strength); final mnemonic = bip39.generateMnemonic(strength: strength);
@ -67,7 +67,8 @@ class SolanaWalletService extends WalletService<SolanaNewWalletCredentials,
} }
@override @override
Future<SolanaWallet> restoreFromKeys(SolanaRestoreWalletFromPrivateKey credentials) async { Future<SolanaWallet> restoreFromKeys(SolanaRestoreWalletFromPrivateKey credentials,
{bool? isTestnet}) async {
final wallet = SolanaWallet( final wallet = SolanaWallet(
password: credentials.password!, password: credentials.password!,
privateKey: credentials.privateKey, privateKey: credentials.privateKey,
@ -82,7 +83,8 @@ class SolanaWalletService extends WalletService<SolanaNewWalletCredentials,
} }
@override @override
Future<SolanaWallet> restoreFromSeed(SolanaRestoreWalletFromSeedCredentials credentials) async { Future<SolanaWallet> restoreFromSeed(SolanaRestoreWalletFromSeedCredentials credentials,
{bool? isTestnet}) async {
if (!bip39.validateMnemonic(credentials.mnemonic)) { if (!bip39.validateMnemonic(credentials.mnemonic)) {
throw SolanaMnemonicIsIncorrectException(); throw SolanaMnemonicIsIncorrectException();
} }

View file

@ -5,6 +5,7 @@ import 'package:cake_wallet/src/widgets/alert_with_one_action.dart';
import 'package:cake_wallet/utils/show_pop_up.dart'; import 'package:cake_wallet/utils/show_pop_up.dart';
import 'package:cake_wallet/view_model/dashboard/dashboard_view_model.dart'; import 'package:cake_wallet/view_model/dashboard/dashboard_view_model.dart';
import 'package:cw_core/wallet_type.dart'; import 'package:cw_core/wallet_type.dart';
import 'package:cw_lightning/lightning_receive_page_option.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
class MainActions { class MainActions {
@ -60,7 +61,7 @@ class MainActions {
Navigator.pushNamed( Navigator.pushNamed(
context, context,
Routes.lightningInvoice, Routes.lightningInvoice,
arguments: [ReceivePageOption.lightningInvoice], arguments: [LightningReceivePageOption.lightningInvoice],
); );
return; return;
} }

View file

@ -1,30 +0,0 @@
enum ReceivePageOption {
mainnet,
anonPayInvoice,
anonPayDonationLink,
lightningInvoice,
lightningOnchain;
@override
String toString() {
String label = '';
switch (this) {
case ReceivePageOption.mainnet:
label = 'Mainnet';
break;
case ReceivePageOption.anonPayInvoice:
label = 'Trocador AnonPay Invoice';
break;
case ReceivePageOption.anonPayDonationLink:
label = 'Trocador AnonPay Donation Link';
break;
case ReceivePageOption.lightningInvoice:
label = 'Lightning via Invoice';
break;
case ReceivePageOption.lightningOnchain:
label = 'Lightning via BTC address';
break;
}
return label;
}
}

View file

@ -91,28 +91,28 @@ class CWLightning extends Lightning {
priority: priority != null ? priority as BitcoinTransactionPriority : null, priority: priority != null ? priority as BitcoinTransactionPriority : null,
feeRate: feeRate); feeRate: feeRate);
@override @override
List<String> getAddresses(Object wallet) { List<String> getAddresses(Object wallet) {
final lightningWallet = wallet as ElectrumWallet; final bitcoinWallet = wallet as ElectrumWallet;
return lightningWallet.walletAddresses.addresses return bitcoinWallet.walletAddresses.addressesByReceiveType
.map((BitcoinAddressRecord addr) => addr.address) .map((BitcoinAddressRecord addr) => addr.address)
.toList(); .toList();
} }
@override @override
@computed @computed
List<ElectrumSubAddress> getSubAddresses(Object wallet) { List<ElectrumSubAddress> getSubAddresses(Object wallet) {
final electrumWallet = wallet as ElectrumWallet; final electrumWallet = wallet as ElectrumWallet;
return electrumWallet.walletAddresses.addresses return electrumWallet.walletAddresses.addressesByReceiveType
.map((BitcoinAddressRecord addr) => ElectrumSubAddress( .map((BitcoinAddressRecord addr) => ElectrumSubAddress(
id: addr.index, id: addr.index,
name: addr.name, name: addr.name,
address: addr.address, address: electrumWallet.type == WalletType.bitcoinCash ? addr.cashAddr : addr.address,
txCount: addr.txCount, txCount: addr.txCount,
balance: addr.balance, balance: addr.balance,
isChange: addr.isHidden)) isChange: addr.isHidden))
.toList(); .toList();
} }
@override @override
String getAddress(Object wallet) { String getAddress(Object wallet) {
@ -158,4 +158,7 @@ class CWLightning extends Lightning {
@override @override
TransactionPriority getLightningTransactionPrioritySlow() TransactionPriority getLightningTransactionPrioritySlow()
=> BitcoinTransactionPriority.slow; => BitcoinTransactionPriority.slow;
@override
List<LightningReceivePageOption> getLightningReceivePageOptions() => LightningReceivePageOption.all;
} }

View file

@ -7,6 +7,7 @@ import 'package:cw_core/output_info.dart';
import 'package:cw_core/unspent_coins_info.dart'; import 'package:cw_core/unspent_coins_info.dart';
import 'package:cw_core/wallet_service.dart'; import 'package:cw_core/wallet_service.dart';
import 'package:cake_wallet/view_model/send/output.dart'; import 'package:cake_wallet/view_model/send/output.dart';
import 'package:cw_core/wallet_type.dart';
import 'package:hive/hive.dart'; import 'package:hive/hive.dart';
import 'package:mobx/mobx.dart'; import 'package:mobx/mobx.dart';
@ -19,6 +20,7 @@ import 'package:cw_bitcoin/bitcoin_amount_format.dart';
import 'package:cw_bitcoin/bitcoin_address_record.dart'; import 'package:cw_bitcoin/bitcoin_address_record.dart';
import 'package:cw_bitcoin/bitcoin_transaction_credentials.dart'; import 'package:cw_bitcoin/bitcoin_transaction_credentials.dart';
import 'package:cw_lightning/lightning_wallet_service.dart'; import 'package:cw_lightning/lightning_wallet_service.dart';
import 'package:cw_lightning/lightning_receive_page_option.dart';
part 'cw_lightning.dart'; part 'cw_lightning.dart';
@ -64,5 +66,6 @@ abstract class Lightning {
Box<WalletInfo> walletInfoSource, Box<UnspentCoinsInfo> unspentCoinSource); Box<WalletInfo> walletInfoSource, Box<UnspentCoinsInfo> unspentCoinSource);
TransactionPriority getLightningTransactionPriorityMedium(); TransactionPriority getLightningTransactionPriorityMedium();
TransactionPriority getLightningTransactionPrioritySlow(); TransactionPriority getLightningTransactionPrioritySlow();
List<LightningReceivePageOption> getLightningReceivePageOptions();
} }

View file

@ -3,22 +3,18 @@ import 'package:cake_wallet/src/widgets/alert_with_two_actions.dart';
import 'package:cake_wallet/themes/extensions/dashboard_page_theme.dart'; import 'package:cake_wallet/themes/extensions/dashboard_page_theme.dart';
import 'package:cake_wallet/themes/extensions/exchange_page_theme.dart'; import 'package:cake_wallet/themes/extensions/exchange_page_theme.dart';
import 'package:cake_wallet/themes/extensions/keyboard_theme.dart'; import 'package:cake_wallet/themes/extensions/keyboard_theme.dart';
import 'package:cake_wallet/anonpay/anonpay_donation_link_info.dart';
import 'package:cake_wallet/core/execution_state.dart'; import 'package:cake_wallet/core/execution_state.dart';
import 'package:cake_wallet/di.dart';
import 'package:cake_wallet/entities/preferences_key.dart';
import 'package:cake_wallet/entities/receive_page_option.dart';
import 'package:cake_wallet/routes.dart'; import 'package:cake_wallet/routes.dart';
import 'package:cake_wallet/src/screens/dashboard/widgets/present_receive_option_picker.dart'; import 'package:cake_wallet/src/screens/dashboard/widgets/present_receive_option_picker.dart';
import 'package:cake_wallet/src/screens/receive/widgets/anonpay_input_form.dart';
import 'package:cake_wallet/src/widgets/alert_with_one_action.dart'; import 'package:cake_wallet/src/widgets/alert_with_one_action.dart';
import 'package:cake_wallet/src/widgets/keyboard_done_button.dart'; import 'package:cake_wallet/src/widgets/keyboard_done_button.dart';
import 'package:cake_wallet/utils/responsive_layout_util.dart'; import 'package:cake_wallet/utils/responsive_layout_util.dart';
import 'package:cake_wallet/utils/show_bar.dart'; import 'package:cake_wallet/utils/show_bar.dart';
import 'package:cake_wallet/view_model/anon_invoice_page_view_model.dart';
import 'package:cake_wallet/view_model/dashboard/receive_option_view_model.dart'; import 'package:cake_wallet/view_model/dashboard/receive_option_view_model.dart';
import 'package:cake_wallet/view_model/lightning_invoice_page_view_model.dart'; import 'package:cake_wallet/view_model/lightning_invoice_page_view_model.dart';
import 'package:cake_wallet/view_model/lightning_view_model.dart'; import 'package:cake_wallet/view_model/lightning_view_model.dart';
import 'package:cw_core/receive_page_option.dart';
import 'package:cw_lightning/lightning_receive_page_option.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:flutter_mobx/flutter_mobx.dart'; import 'package:flutter_mobx/flutter_mobx.dart';
@ -30,7 +26,6 @@ import 'package:cake_wallet/generated/i18n.dart';
import 'package:cake_wallet/src/widgets/primary_button.dart'; import 'package:cake_wallet/src/widgets/primary_button.dart';
import 'package:cake_wallet/src/widgets/scollable_with_bottom_section.dart'; import 'package:cake_wallet/src/widgets/scollable_with_bottom_section.dart';
import 'package:mobx/mobx.dart'; import 'package:mobx/mobx.dart';
import 'package:shared_preferences/shared_preferences.dart';
class LightningInvoicePage extends BasePage { class LightningInvoicePage extends BasePage {
LightningInvoicePage({ LightningInvoicePage({
@ -219,13 +214,13 @@ class LightningInvoicePage extends BasePage {
reaction((_) => receiveOptionViewModel.selectedReceiveOption, (ReceivePageOption option) async { reaction((_) => receiveOptionViewModel.selectedReceiveOption, (ReceivePageOption option) async {
switch (option) { switch (option) {
case ReceivePageOption.lightningInvoice: case LightningReceivePageOption.lightningInvoice:
break; break;
case ReceivePageOption.lightningOnchain: case LightningReceivePageOption.lightningOnchain:
Navigator.popAndPushNamed( Navigator.popAndPushNamed(
context, context,
Routes.lightningReceiveOnchain, Routes.lightningReceiveOnchain,
arguments: [ReceivePageOption.lightningOnchain], arguments: [LightningReceivePageOption.lightningOnchain],
); );
break; break;
default: default:

View file

@ -1,5 +1,4 @@
import 'package:cake_wallet/entities/qr_view_data.dart'; import 'package:cake_wallet/entities/qr_view_data.dart';
import 'package:cake_wallet/entities/receive_page_option.dart';
import 'package:cake_wallet/routes.dart'; import 'package:cake_wallet/routes.dart';
import 'package:cake_wallet/src/screens/dashboard/widgets/present_receive_option_picker.dart'; import 'package:cake_wallet/src/screens/dashboard/widgets/present_receive_option_picker.dart';
import 'package:cake_wallet/src/screens/receive/widgets/qr_image.dart'; import 'package:cake_wallet/src/screens/receive/widgets/qr_image.dart';
@ -10,6 +9,7 @@ import 'package:cake_wallet/utils/brightness_util.dart';
import 'package:cake_wallet/utils/show_bar.dart'; import 'package:cake_wallet/utils/show_bar.dart';
import 'package:cake_wallet/view_model/dashboard/receive_option_view_model.dart'; import 'package:cake_wallet/view_model/dashboard/receive_option_view_model.dart';
import 'package:cake_wallet/view_model/lightning_view_model.dart'; import 'package:cake_wallet/view_model/lightning_view_model.dart';
import 'package:cw_core/receive_page_option.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:cake_wallet/generated/i18n.dart'; import 'package:cake_wallet/generated/i18n.dart';
import 'package:cake_wallet/src/screens/base_page.dart'; import 'package:cake_wallet/src/screens/base_page.dart';

View file

@ -1,4 +1,5 @@
import 'package:cake_wallet/bitcoin/bitcoin.dart'; import 'package:cake_wallet/bitcoin/bitcoin.dart';
import 'package:cake_wallet/lightning/lightning.dart';
import 'package:cw_core/receive_page_option.dart'; import 'package:cw_core/receive_page_option.dart';
import 'package:cw_core/wallet_base.dart'; import 'package:cw_core/wallet_base.dart';
import 'package:cw_core/wallet_type.dart'; import 'package:cw_core/wallet_type.dart';
@ -22,7 +23,7 @@ abstract class ReceiveOptionViewModelBase with Store {
_options = [ReceivePageOption.mainnet]; _options = [ReceivePageOption.mainnet];
break; break;
case WalletType.lightning: case WalletType.lightning:
_options = [ReceivePageOption.lightningInvoice, ReceivePageOption.lightningOnchain]; _options = [...lightning!.getLightningReceivePageOptions()];
break; break;
case WalletType.bitcoin: case WalletType.bitcoin:
_options = [ _options = [

View file

@ -726,6 +726,7 @@ import 'package:cw_core/output_info.dart';
import 'package:cw_core/unspent_coins_info.dart'; import 'package:cw_core/unspent_coins_info.dart';
import 'package:cw_core/wallet_service.dart'; import 'package:cw_core/wallet_service.dart';
import 'package:cake_wallet/view_model/send/output.dart'; import 'package:cake_wallet/view_model/send/output.dart';
import 'package:cw_core/wallet_type.dart';
import 'package:hive/hive.dart'; import 'package:hive/hive.dart';
import 'package:mobx/mobx.dart'; import 'package:mobx/mobx.dart';
"""; """;
@ -739,6 +740,7 @@ import 'package:cw_bitcoin/bitcoin_amount_format.dart';
import 'package:cw_bitcoin/bitcoin_address_record.dart'; import 'package:cw_bitcoin/bitcoin_address_record.dart';
import 'package:cw_bitcoin/bitcoin_transaction_credentials.dart'; import 'package:cw_bitcoin/bitcoin_transaction_credentials.dart';
import 'package:cw_lightning/lightning_wallet_service.dart'; import 'package:cw_lightning/lightning_wallet_service.dart';
import 'package:cw_lightning/lightning_receive_page_option.dart';
"""; """;
const lightningCwPart = "part 'cw_lightning.dart';"; const lightningCwPart = "part 'cw_lightning.dart';";
const lightningContent = """ const lightningContent = """