mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2024-12-23 12:09:43 +00:00
[skip ci] path fixes
This commit is contained in:
parent
933c68bf3b
commit
faa2040666
1 changed files with 26 additions and 13 deletions
|
@ -149,6 +149,22 @@ abstract class LightningWalletBase extends ElectrumWallet with Store {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Future<void> _handleNodeState(NodeState? nodeState) async {
|
||||||
|
if (nodeState == null) return;
|
||||||
|
_balance[CryptoCurrency.btcln] = LightningBalance(
|
||||||
|
confirmed: nodeState.maxPayableMsat ~/ 1000,
|
||||||
|
unconfirmed: nodeState.maxReceivableMsat ~/ 1000,
|
||||||
|
frozen: 0,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> _handlePayments(List<Payment> payments) async {
|
||||||
|
_isTransactionUpdating = true;
|
||||||
|
final txs = convertToTxInfo(payments);
|
||||||
|
transactionHistory.addMany(txs);
|
||||||
|
_isTransactionUpdating = false;
|
||||||
|
}
|
||||||
|
|
||||||
Future<void> setupBreez(Uint8List seedBytes) async {
|
Future<void> setupBreez(Uint8List seedBytes) async {
|
||||||
final sdk = await BreezSDK();
|
final sdk = await BreezSDK();
|
||||||
try {
|
try {
|
||||||
|
@ -179,8 +195,9 @@ abstract class LightningWalletBase extends ElectrumWallet with Store {
|
||||||
nodeConfig: breezNodeConfig,
|
nodeConfig: breezNodeConfig,
|
||||||
);
|
);
|
||||||
|
|
||||||
String workingDir = (await getApplicationDocumentsDirectory()).path;
|
String workingDir = await pathForWalletDir(name: walletInfo.name, type: type);
|
||||||
workingDir = "$workingDir/wallets/lightning/${walletInfo.address}/breez/";
|
workingDir = "$workingDir/breez";
|
||||||
|
|
||||||
new Directory(workingDir).createSync(recursive: true);
|
new Directory(workingDir).createSync(recursive: true);
|
||||||
breezConfig = breezConfig.copyWith(workingDir: workingDir);
|
breezConfig = breezConfig.copyWith(workingDir: workingDir);
|
||||||
|
|
||||||
|
@ -204,21 +221,17 @@ abstract class LightningWalletBase extends ElectrumWallet with Store {
|
||||||
print("Error connecting to Breez: $e\n$s");
|
print("Error connecting to Breez: $e\n$s");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_nodeStateSub?.cancel();
|
||||||
_nodeStateSub = sdk.nodeStateStream.listen((event) {
|
_nodeStateSub = sdk.nodeStateStream.listen((event) {
|
||||||
if (event == null) return;
|
_handleNodeState(event);
|
||||||
_balance[CryptoCurrency.btcln] = LightningBalance(
|
|
||||||
confirmed: event.maxPayableMsat ~/ 1000,
|
|
||||||
unconfirmed: event.maxReceivableMsat ~/ 1000,
|
|
||||||
frozen: 0,
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
|
await _handleNodeState(await sdk.nodeInfo());
|
||||||
|
|
||||||
_paymentsSub = sdk.paymentsStream.listen((payments) {
|
_paymentsSub?.cancel();
|
||||||
_isTransactionUpdating = true;
|
_paymentsSub = sdk.paymentsStream.listen((List<Payment> payments) {
|
||||||
final txs = convertToTxInfo(payments);
|
_handlePayments(payments);
|
||||||
transactionHistory.addMany(txs);
|
|
||||||
_isTransactionUpdating = false;
|
|
||||||
});
|
});
|
||||||
|
await _handlePayments(await sdk.listPayments(req: ListPaymentsRequest()));
|
||||||
|
|
||||||
// TODO: get actual nds service url:
|
// TODO: get actual nds service url:
|
||||||
// if (Platform.isAndroid || Platform.isIOS) {
|
// if (Platform.isAndroid || Platform.isIOS) {
|
||||||
|
|
Loading…
Reference in a new issue