-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use a single instance of BreezSDK on Dart snippets
- Add documentation that recommends using single instance of BreezSDK and possible options on how. - Add documentation on how to use initialize() in light of recent SDK stream management changes.
- Loading branch information
1 parent
b4bd996
commit b8bdd1d
Showing
22 changed files
with
157 additions
and
135 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
import 'package:breez_sdk/breez_sdk.dart'; | ||
import 'package:dart_snippets/sdk_instance.dart'; | ||
|
||
void main(List<String> arguments) { | ||
BreezSDK().initialize(); | ||
breezSDK.initialize(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
import 'package:breez_sdk/breez_sdk.dart'; | ||
import 'package:breez_sdk/bridge_generated.dart'; | ||
import 'package:dart_snippets/sdk_instance.dart'; | ||
|
||
Future<BuyBitcoinResponse> buyBitcoin() async { | ||
// ANCHOR: buy-btc | ||
BuyBitcoinRequest req = const BuyBitcoinRequest(provider: BuyBitcoinProvider.Moonpay); | ||
BuyBitcoinResponse resp = await BreezSDK().buyBitcoin(req: req); | ||
BuyBitcoinResponse resp = await breezSDK.buyBitcoin(req: req); | ||
// ANCHOR_END: buy-btc | ||
return resp; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,24 @@ | ||
import 'package:breez_sdk/breez_sdk.dart'; | ||
import 'package:dart_snippets/sdk_instance.dart'; | ||
import 'package:breez_sdk/bridge_generated.dart'; | ||
|
||
Future<void> getLspInfo() async { | ||
// ANCHOR: get-lsp-info | ||
String? lspId = await BreezSDK().lspId(); | ||
LspInformation? lspInfo = await BreezSDK().lspInfo(); | ||
String? lspId = await breezSDK.lspId(); | ||
LspInformation? lspInfo = await breezSDK.lspInfo(); | ||
print(lspId); | ||
print(lspInfo); | ||
// ANCHOR_END: get-lsp-info | ||
} | ||
|
||
Future<List<LspInformation>> listLsps() async { | ||
// ANCHOR: list-lsps | ||
List<LspInformation> availableLsps = await BreezSDK().listLsps(); | ||
List<LspInformation> availableLsps = await breezSDK.listLsps(); | ||
// ANCHOR_END: list-lsps | ||
return availableLsps; | ||
} | ||
|
||
Future<void> connectLsp(String lspId) async { | ||
// ANCHOR: connect-lsp | ||
await BreezSDK().connectLSP(lspId); | ||
await breezSDK.connectLSP(lspId); | ||
// ANCHOR_END: connect-lsp | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
import 'package:breez_sdk/breez_sdk.dart'; | ||
import 'package:dart_snippets/sdk_instance.dart'; | ||
import 'package:breez_sdk/bridge_generated.dart'; | ||
|
||
Future<void> lnurlPay() async { | ||
|
@@ -8,7 +8,7 @@ Future<void> lnurlPay() async { | |
/// lnurl1dp68gurn8ghj7mr0vdskc6r0wd6z7mrww4excttsv9un7um9wdekjmmw84jxywf5x43rvv35xgmr2enrxanr2cfcvsmnwe3jxcukvde48qukgdec89snwde3vfjxvepjxpjnjvtpxd3kvdnxx5crxwpjvyunsephsz36jf | ||
String lnurlPayUrl = "[email protected]"; | ||
|
||
InputType inputType = await BreezSDK().parseInput(input: lnurlPayUrl); | ||
InputType inputType = await breezSDK.parseInput(input: lnurlPayUrl); | ||
if (inputType is InputType_LnUrlPay) { | ||
int amountMsat = inputType.data.minSendable; | ||
String optionalComment = "<comment>"; | ||
|
@@ -19,7 +19,7 @@ Future<void> lnurlPay() async { | |
comment: optionalComment, | ||
paymentLabel: optionalPaymentLabel, | ||
); | ||
LnUrlPayResult result = await BreezSDK().lnurlPay(req: req); | ||
LnUrlPayResult result = await breezSDK.lnurlPay(req: req); | ||
print(result.data); | ||
} | ||
// ANCHOR_END: lnurl-pay | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.