This commit is contained in:
fosse 2024-02-08 13:13:54 -05:00
parent c92a6954a2
commit 3a83a8573b
2 changed files with 37 additions and 17 deletions

View file

@ -142,12 +142,8 @@ abstract class BitcoinWalletBase extends ElectrumWallet with Store {
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);
print(workingDir);
// await sdk.connect(config: breezConfig, seed: seedBytes);
print(await sdk.isInitialized());
print(await sdk.listLsps());
print("initialized: ${(await sdk.isInitialized())}");
}
}

View file

@ -165,28 +165,52 @@ class AddressPage extends BasePage {
constraints: BoxConstraints(),
highlightColor: Colors.transparent,
splashColor: Colors.transparent,
iconSize: 25,
iconSize: 40,
onPressed: () async {
print("pressed");
// ReceivePaymentRequest req = const ReceivePaymentRequest(
// amountMsat: 3000000,
// description: "Invoice for 3000 sats",
// );
// ReceivePaymentResponse receivePaymentResponse =
// await BreezSDK().receivePayment(req: req);
// await BreezSDK().receivePayment(req: req);
// print(receivePaymentResponse.lnInvoice);
ServiceHealthCheckResponse healthCheck = await BreezSDK().serviceHealthCheck();
print("Current service status is: ${healthCheck.status}");
final sdk = await BreezSDK();
ReceiveOnchainRequest req = const ReceiveOnchainRequest();
SwapInfo swapInfo = await BreezSDK().receiveOnchain(req: req);
sdk.nodeStateStream.listen((event) {
// print("Node state: $event");
if (event == null) return;
int balanceSat = event.maxPayableMsat ~/ 1000;
print("sats: $balanceSat");
});
// Send your funds to the below bitcoin address
String address = swapInfo.bitcoinAddress;
print(address);
print("Minimum amount allowed to deposit in sats: ${swapInfo.minAllowedDeposit}");
print("Maximum amount allowed to deposit in sats: ${swapInfo.maxAllowedDeposit}");
// ServiceHealthCheckResponse healthCheck = await sdk.serviceHealthCheck();
// print("Current service status is: ${healthCheck.status}");
// ReceivePaymentRequest req = ReceivePaymentRequest(
// amountMsat: 123 * 1000,
// description: "Invoice for 123 sats",
// );
// final s = await sdk.receivePayment(req: req);
// print(s.lnInvoice.bolt11);
// ReceiveOnchainRequest req = const ReceiveOnchainRequest();
// SwapInfo swapInfo = await sdk.receiveOnchain(req: req);
// // Send your funds to the below bitcoin address
// String address = swapInfo.bitcoinAddress;
// print(address);
// print("Minimum amount allowed to deposit in sats: ${swapInfo.minAllowedDeposit}");
// print("Maximum amount allowed to deposit in sats: ${swapInfo.maxAllowedDeposit}");
ListPaymentsRequest lReq = ListPaymentsRequest();
var list = await sdk.listPayments(req: lReq);
print(list[0].amountMsat);
var data = await sdk.fetchNodeData();
print(data);
},
icon: Icon(
Icons.lightbulb_outline_rounded,