mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2024-12-23 03:59:23 +00:00
save
This commit is contained in:
parent
1a32c91217
commit
65686719ee
9 changed files with 41 additions and 21 deletions
|
@ -5,6 +5,8 @@ CryptoCurrency currencyForWalletType(WalletType type) {
|
|||
switch (type) {
|
||||
case WalletType.bitcoin:
|
||||
return CryptoCurrency.btc;
|
||||
case WalletType.lightning:
|
||||
return CryptoCurrency.btc;
|
||||
case WalletType.monero:
|
||||
return CryptoCurrency.xmr;
|
||||
case WalletType.litecoin:
|
||||
|
|
|
@ -101,29 +101,29 @@ abstract class LightningWalletBase extends ElectrumWallet with Store {
|
|||
}
|
||||
|
||||
Future<void> setupBreeze(Uint8List seedBytes) async {
|
||||
// Initialize SDK logs listener
|
||||
final sdk = BreezSDK();
|
||||
sdk.initialize();
|
||||
// // Initialize SDK logs listener
|
||||
// final sdk = BreezSDK();
|
||||
// sdk.initialize();
|
||||
|
||||
NodeConfig breezNodeConfig = NodeConfig.greenlight(
|
||||
config: GreenlightNodeConfig(
|
||||
partnerCredentials: null,
|
||||
inviteCode: secrets.breezInviteCode,
|
||||
),
|
||||
);
|
||||
Config breezConfig = await sdk.defaultConfig(
|
||||
envType: EnvironmentType.Production,
|
||||
apiKey: secrets.breezApiKey,
|
||||
nodeConfig: breezNodeConfig,
|
||||
);
|
||||
// NodeConfig breezNodeConfig = NodeConfig.greenlight(
|
||||
// config: GreenlightNodeConfig(
|
||||
// partnerCredentials: null,
|
||||
// inviteCode: secrets.breezInviteCode,
|
||||
// ),
|
||||
// );
|
||||
// Config breezConfig = await sdk.defaultConfig(
|
||||
// envType: EnvironmentType.Production,
|
||||
// apiKey: secrets.breezApiKey,
|
||||
// nodeConfig: breezNodeConfig,
|
||||
// );
|
||||
|
||||
// Customize the config object according to your needs
|
||||
String workingDir = (await getApplicationDocumentsDirectory()).path;
|
||||
workingDir = "$workingDir/wallets/bitcoin/${walletInfo.name}/breez/";
|
||||
new Directory(workingDir).createSync(recursive: true);
|
||||
breezConfig = breezConfig.copyWith(workingDir: workingDir);
|
||||
await sdk.connect(config: breezConfig, seed: seedBytes);
|
||||
// // Customize the config object according to your needs
|
||||
// String workingDir = (await getApplicationDocumentsDirectory()).path;
|
||||
// workingDir = "$workingDir/wallets/lightning/${walletInfo.name}/breez/";
|
||||
// new Directory(workingDir).createSync(recursive: true);
|
||||
// breezConfig = breezConfig.copyWith(workingDir: workingDir);
|
||||
// await sdk.connect(config: breezConfig, seed: seedBytes);
|
||||
|
||||
print("initialized: ${(await sdk.isInitialized())}");
|
||||
// print("initialized: ${(await sdk.isInitialized())}");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -873,6 +873,7 @@ abstract class SettingsStoreBase with Store {
|
|||
|
||||
if (bitcoinElectrumServer != null) {
|
||||
nodes[WalletType.bitcoin] = bitcoinElectrumServer;
|
||||
nodes[WalletType.lightning] = bitcoinElectrumServer;
|
||||
}
|
||||
|
||||
if (litecoinElectrumServer != null) {
|
||||
|
@ -1205,6 +1206,7 @@ abstract class SettingsStoreBase with Store {
|
|||
|
||||
if (bitcoinElectrumServer != null) {
|
||||
nodes[WalletType.bitcoin] = bitcoinElectrumServer;
|
||||
nodes[WalletType.lightning] = bitcoinElectrumServer;
|
||||
}
|
||||
|
||||
if (litecoinElectrumServer != null) {
|
||||
|
|
|
@ -54,6 +54,9 @@ abstract class NodeListViewModelBase with Store {
|
|||
case WalletType.bitcoin:
|
||||
node = getBitcoinDefaultElectrumServer(nodes: _nodeSource)!;
|
||||
break;
|
||||
case WalletType.lightning:
|
||||
node = getBitcoinDefaultElectrumServer(nodes: _nodeSource)!;
|
||||
break;
|
||||
case WalletType.monero:
|
||||
node = getMoneroDefaultNode(nodes: _nodeSource);
|
||||
break;
|
||||
|
|
|
@ -377,6 +377,8 @@ abstract class SendViewModelBase extends WalletChangeListenerViewModel with Stor
|
|||
case WalletType.polygon:
|
||||
return polygon!.createPolygonTransactionCredentials(outputs,
|
||||
priority: priority!, currency: selectedCryptoCurrency);
|
||||
case WalletType.lightning:
|
||||
throw Exception("TODO: CW-563 Implement lightning tx send!");
|
||||
default:
|
||||
throw Exception('Unexpected wallet type: ${wallet.type}');
|
||||
}
|
||||
|
|
|
@ -237,6 +237,11 @@ abstract class WalletAddressListViewModelBase extends WalletChangeListenerViewMo
|
|||
return BitcoinURI(amount: amount, address: address.address);
|
||||
}
|
||||
|
||||
if (wallet.type == WalletType.lightning) {
|
||||
// TODO: CW-563
|
||||
return BitcoinURI(amount: amount, address: address.address);
|
||||
}
|
||||
|
||||
if (wallet.type == WalletType.litecoin) {
|
||||
return LitecoinURI(amount: amount, address: address.address);
|
||||
}
|
||||
|
|
|
@ -165,6 +165,8 @@ abstract class WalletKeysViewModelBase with Store {
|
|||
return 'banano-wallet';
|
||||
case WalletType.polygon:
|
||||
return 'polygon-wallet';
|
||||
case WalletType.lightning:
|
||||
return 'lightning-wallet';
|
||||
default:
|
||||
throw Exception('Unexpected wallet type: ${_appStore.wallet!.toString()}');
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import 'package:cake_wallet/ethereum/ethereum.dart';
|
||||
import 'package:cake_wallet/bitcoin_cash/bitcoin_cash.dart';
|
||||
import 'package:cake_wallet/lightning/lightning.dart';
|
||||
import 'package:hive/hive.dart';
|
||||
import 'package:mobx/mobx.dart';
|
||||
import 'package:cake_wallet/monero/monero.dart';
|
||||
|
@ -61,6 +62,8 @@ abstract class WalletNewVMBase extends WalletCreationVM with Store {
|
|||
name: name, language: options!.first as String, isPolyseed: options.last as bool);
|
||||
case WalletType.bitcoin:
|
||||
return bitcoin!.createBitcoinNewWalletCredentials(name: name);
|
||||
case WalletType.lightning:
|
||||
return lightning!.createLightningNewWalletCredentials(name: name);
|
||||
case WalletType.litecoin:
|
||||
return bitcoin!.createBitcoinNewWalletCredentials(name: name);
|
||||
case WalletType.haven:
|
||||
|
|
|
@ -5,4 +5,5 @@ cd cw_bitcoin && flutter pub get && flutter packages pub run build_runner build
|
|||
cd cw_haven && flutter pub get && flutter packages pub run build_runner build --delete-conflicting-outputs && cd ..
|
||||
cd cw_nano && flutter pub get && flutter packages pub run build_runner build --delete-conflicting-outputs && cd ..
|
||||
cd cw_bitcoin_cash && flutter pub get && flutter packages pub run build_runner build --delete-conflicting-outputs && cd ..
|
||||
cd cw_lightning && flutter pub get && flutter packages pub run build_runner build --delete-conflicting-outputs && cd ..
|
||||
flutter packages pub run build_runner build --delete-conflicting-outputs
|
Loading…
Reference in a new issue