mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2025-05-07 02:32:12 +00:00
fixes
This commit is contained in:
parent
452ff1e82b
commit
8828262ee0
7 changed files with 21 additions and 81 deletions
|
@ -126,7 +126,11 @@ abstract class LightningWalletBase extends ElectrumWallet with Store {
|
||||||
required String password,
|
required String password,
|
||||||
}) async {
|
}) async {
|
||||||
final snp = await ElectrumWalletSnapshot.load(
|
final snp = await ElectrumWalletSnapshot.load(
|
||||||
name, walletInfo.type, password, BitcoinCashNetwork.mainnet);
|
name,
|
||||||
|
walletInfo.type,
|
||||||
|
password,
|
||||||
|
BitcoinNetwork.mainnet
|
||||||
|
);
|
||||||
return LightningWallet(
|
return LightningWallet(
|
||||||
mnemonic: snp.mnemonic,
|
mnemonic: snp.mnemonic,
|
||||||
password: password,
|
password: password,
|
||||||
|
|
28
lib/di.dart
28
lib/di.dart
|
@ -1209,32 +1209,32 @@ Future<void> setup({
|
||||||
settingsStore: getIt.get<SettingsStore>(),
|
settingsStore: getIt.get<SettingsStore>(),
|
||||||
fiatConversionStore: getIt.get<FiatConversionStore>(),
|
fiatConversionStore: getIt.get<FiatConversionStore>(),
|
||||||
));
|
));
|
||||||
getIt.registerFactoryParam<LightningInvoicePageViewModel, List<dynamic>, void>((args, _) {
|
|
||||||
final pageOption = args.first as ReceivePageOption;
|
getIt.registerFactoryParam<LightningInvoicePageViewModel, void, void>((_, __) {
|
||||||
return LightningInvoicePageViewModel(
|
return LightningInvoicePageViewModel(
|
||||||
getIt.get<SettingsStore>(),
|
getIt.get<SettingsStore>(),
|
||||||
getIt.get<AppStore>().wallet!,
|
getIt.get<AppStore>().wallet!,
|
||||||
getIt.get<SharedPreferences>(),
|
getIt.get<SharedPreferences>(),
|
||||||
getIt.get<LightningViewModel>(),
|
getIt.get<LightningViewModel>(),
|
||||||
pageOption,
|
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
getIt.registerFactoryParam<LightningReceiveOnchainPage, List<dynamic>, void>(
|
getIt.registerFactoryParam<LightningReceiveOnchainPage, void, void>((_, __) {
|
||||||
(List<dynamic> args, _) {
|
|
||||||
final pageOption = args.last as ReceivePageOption;
|
|
||||||
return LightningReceiveOnchainPage(
|
return LightningReceiveOnchainPage(
|
||||||
addressListViewModel: getIt.get<WalletAddressListViewModel>(),
|
addressListViewModel: getIt.get<WalletAddressListViewModel>(),
|
||||||
lightningViewModel: getIt.get<LightningViewModel>(),
|
lightningViewModel: getIt.get<LightningViewModel>(),
|
||||||
receiveOptionViewModel: getIt.get<ReceiveOptionViewModel>(param1: pageOption));
|
receiveOptionViewModel:
|
||||||
|
getIt.get<ReceiveOptionViewModel>(param1: lightning!.getOptionOnchain()),
|
||||||
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
getIt.registerFactoryParam<LightningInvoicePage, List<dynamic>, void>((List<dynamic> args, _) {
|
getIt.registerFactoryParam<LightningInvoicePage, void, void>((_, __) {
|
||||||
final pageOption = args.last as ReceivePageOption;
|
|
||||||
return LightningInvoicePage(
|
return LightningInvoicePage(
|
||||||
lightningInvoicePageViewModel: getIt.get<LightningInvoicePageViewModel>(param1: args),
|
lightningInvoicePageViewModel: getIt.get<LightningInvoicePageViewModel>(),
|
||||||
lightningViewModel: getIt.get<LightningViewModel>(),
|
lightningViewModel: getIt.get<LightningViewModel>(),
|
||||||
receiveOptionViewModel: getIt.get<ReceiveOptionViewModel>(param1: pageOption));
|
receiveOptionViewModel:
|
||||||
|
getIt.get<ReceiveOptionViewModel>(param1: lightning!.getOptionInvoice()),
|
||||||
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
getIt.registerFactory<LightningSendPage>(() {
|
getIt.registerFactory<LightningSendPage>(() {
|
||||||
|
|
|
@ -57,11 +57,7 @@ class MainActions {
|
||||||
image: 'assets/images/received.png',
|
image: 'assets/images/received.png',
|
||||||
onTap: (BuildContext context, DashboardViewModel viewModel) async {
|
onTap: (BuildContext context, DashboardViewModel viewModel) async {
|
||||||
if (viewModel.wallet.type == WalletType.lightning) {
|
if (viewModel.wallet.type == WalletType.lightning) {
|
||||||
Navigator.pushNamed(
|
Navigator.pushNamed(context, Routes.lightningInvoice);
|
||||||
context,
|
|
||||||
Routes.lightningInvoice,
|
|
||||||
arguments: [lightning!.getOptionInvoice()],
|
|
||||||
);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Navigator.pushNamed(context, Routes.addressPage);
|
Navigator.pushNamed(context, Routes.addressPage);
|
||||||
|
|
|
@ -1,49 +1,6 @@
|
||||||
part of 'lightning.dart';
|
part of 'lightning.dart';
|
||||||
|
|
||||||
class CWLightning extends Lightning {
|
class CWLightning extends Lightning {
|
||||||
@override
|
|
||||||
WalletCredentials createLightningRestoreWalletFromSeedCredentials(
|
|
||||||
{required String name, required String mnemonic, required String password}) =>
|
|
||||||
BitcoinRestoreWalletFromSeedCredentials(name: name, mnemonic: mnemonic, password: password);
|
|
||||||
|
|
||||||
@override
|
|
||||||
WalletCredentials createLightningRestoreWalletFromWIFCredentials(
|
|
||||||
{required String name,
|
|
||||||
required String password,
|
|
||||||
required String wif,
|
|
||||||
WalletInfo? walletInfo}) =>
|
|
||||||
BitcoinRestoreWalletFromWIFCredentials(
|
|
||||||
name: name, password: password, wif: wif, walletInfo: walletInfo);
|
|
||||||
|
|
||||||
@override
|
|
||||||
WalletCredentials createLightningNewWalletCredentials(
|
|
||||||
{required String name, WalletInfo? walletInfo}) =>
|
|
||||||
BitcoinNewWalletCredentials(name: name, walletInfo: walletInfo);
|
|
||||||
|
|
||||||
@override
|
|
||||||
Object createLightningTransactionCredentials(List<Output> outputs,
|
|
||||||
{required TransactionPriority priority, int? feeRate}) =>
|
|
||||||
BitcoinTransactionCredentials(
|
|
||||||
outputs
|
|
||||||
.map((out) => OutputInfo(
|
|
||||||
fiatAmount: out.fiatAmount,
|
|
||||||
cryptoAmount: out.cryptoAmount,
|
|
||||||
address: out.address,
|
|
||||||
note: out.note,
|
|
||||||
sendAll: out.sendAll,
|
|
||||||
extractedAddress: out.extractedAddress,
|
|
||||||
isParsedAddress: out.isParsedAddress,
|
|
||||||
formattedCryptoAmount: out.formattedCryptoAmount))
|
|
||||||
.toList(),
|
|
||||||
priority: priority as BitcoinTransactionPriority,
|
|
||||||
feeRate: feeRate);
|
|
||||||
|
|
||||||
@override
|
|
||||||
Object createLightningTransactionCredentialsRaw(List<OutputInfo> outputs,
|
|
||||||
{TransactionPriority? priority, required int feeRate}) =>
|
|
||||||
BitcoinTransactionCredentials(outputs,
|
|
||||||
priority: priority != null ? priority as BitcoinTransactionPriority : null,
|
|
||||||
feeRate: feeRate);
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String formatterLightningAmountToString({required int amount}) =>
|
String formatterLightningAmountToString({required int amount}) =>
|
||||||
|
|
|
@ -659,9 +659,8 @@ Route<dynamic> createRoute(RouteSettings settings) {
|
||||||
builder: (_) => getIt.get<LightningReceiveOnchainPage>(param1: args));
|
builder: (_) => getIt.get<LightningReceiveOnchainPage>(param1: args));
|
||||||
|
|
||||||
case Routes.lightningInvoice:
|
case Routes.lightningInvoice:
|
||||||
final args = settings.arguments as List;
|
|
||||||
return CupertinoPageRoute<void>(
|
return CupertinoPageRoute<void>(
|
||||||
fullscreenDialog: true, builder: (_) => getIt.get<LightningInvoicePage>(param1: args));
|
fullscreenDialog: true, builder: (_) => getIt.get<LightningInvoicePage>());
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return MaterialPageRoute<void>(
|
return MaterialPageRoute<void>(
|
||||||
|
|
|
@ -21,7 +21,6 @@ abstract class LightningInvoicePageViewModelBase with Store {
|
||||||
this._wallet,
|
this._wallet,
|
||||||
this.sharedPreferences,
|
this.sharedPreferences,
|
||||||
this.lightningViewModel,
|
this.lightningViewModel,
|
||||||
this.pageOption,
|
|
||||||
) : description = '',
|
) : description = '',
|
||||||
amount = '',
|
amount = '',
|
||||||
state = InitialExecutionState(),
|
state = InitialExecutionState(),
|
||||||
|
@ -34,7 +33,6 @@ abstract class LightningInvoicePageViewModelBase with Store {
|
||||||
final SettingsStore settingsStore;
|
final SettingsStore settingsStore;
|
||||||
final WalletBase _wallet;
|
final WalletBase _wallet;
|
||||||
final SharedPreferences sharedPreferences;
|
final SharedPreferences sharedPreferences;
|
||||||
final ReceivePageOption pageOption;
|
|
||||||
final LightningViewModel lightningViewModel;
|
final LightningViewModel lightningViewModel;
|
||||||
|
|
||||||
@observable
|
@observable
|
||||||
|
|
|
@ -750,20 +750,6 @@ 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 = """
|
||||||
abstract class Lightning {
|
abstract class Lightning {
|
||||||
WalletCredentials createLightningRestoreWalletFromSeedCredentials(
|
|
||||||
{required String name, required String mnemonic, required String password});
|
|
||||||
WalletCredentials createLightningRestoreWalletFromWIFCredentials(
|
|
||||||
{required String name,
|
|
||||||
required String password,
|
|
||||||
required String wif,
|
|
||||||
WalletInfo? walletInfo});
|
|
||||||
WalletCredentials createLightningNewWalletCredentials(
|
|
||||||
{required String name, WalletInfo? walletInfo});
|
|
||||||
Object createLightningTransactionCredentials(List<Output> outputs,
|
|
||||||
{required TransactionPriority priority, int? feeRate});
|
|
||||||
Object createLightningTransactionCredentialsRaw(List<OutputInfo> outputs,
|
|
||||||
{TransactionPriority? priority, required int feeRate});
|
|
||||||
|
|
||||||
String formatterLightningAmountToString({required int amount});
|
String formatterLightningAmountToString({required int amount});
|
||||||
double formatterLightningAmountToDouble({required int amount});
|
double formatterLightningAmountToDouble({required int amount});
|
||||||
int formatterStringDoubleToLightningAmount(String amount);
|
int formatterStringDoubleToLightningAmount(String amount);
|
||||||
|
|
Loading…
Reference in a new issue