mirror of
https://github.com/aljazceru/breez-sdk-docs.git
synced 2025-12-18 14:24:19 +01:00
add dart examples
This commit is contained in:
@@ -51,7 +51,15 @@ try {
|
||||
<section>
|
||||
|
||||
```dart
|
||||
// TODO add docs
|
||||
try {
|
||||
BuyBitcoinResponse buyBitcoinResponse = buyBitcoin(
|
||||
reqData: BuyBitcoinRequest(provider: BuyBitcoinProvider.Moonpay,
|
||||
),
|
||||
);
|
||||
} catch {
|
||||
// Handle error
|
||||
}
|
||||
|
||||
```
|
||||
</section>
|
||||
|
||||
|
||||
@@ -61,8 +61,12 @@ try {
|
||||
|
||||
```dart
|
||||
try {
|
||||
ReceivePaymentRequestData requestData = ReceivePaymentRequestData(amountSats: 3000, description: "Invoice for 3000 sats");
|
||||
ReceivePaymentResponse invoice = await receivePayment(reqData: requestData);
|
||||
ReceivePaymentResponse invoice = await receivePayment(
|
||||
reqData: ReceivePaymentRequestData(
|
||||
amountSats: 3000,
|
||||
description: "Invoice for 3000 sats",
|
||||
),
|
||||
);
|
||||
} catch (error) {
|
||||
// handle error
|
||||
}
|
||||
|
||||
@@ -69,11 +69,7 @@ try {
|
||||
|
||||
```dart
|
||||
try {
|
||||
// Optional user-selected dynamic fees (see Connecting to LSP section for details)
|
||||
OpeningFeeParams? openingFeeParams = null;
|
||||
ReceiveOnchainRequest request = new ReceiveOnchainRequest(openingFeeParams);
|
||||
|
||||
SwapInfo swapInfo = await receiveOnchain(request);
|
||||
SwapInfo swapInfo = await receiveOnchain(ReceiveOnchainRequest());
|
||||
|
||||
// Send your funds to the below bitcoin address
|
||||
String address = swapInfo.bitcoinAddress;
|
||||
|
||||
@@ -66,7 +66,7 @@ try {
|
||||
try {
|
||||
ReverseSwapPairInfo currentFees = await fetchReverseSwapFees();
|
||||
|
||||
print(`Total estimated fees for reverse swap: ${currentFees.totalEstimatedFees}`);
|
||||
print("Total estimated fees for reverse swap: ${currentFees.totalEstimatedFees}");
|
||||
} catch (error) {
|
||||
// handle error
|
||||
}
|
||||
@@ -161,8 +161,8 @@ console.log(`Maximum amount, in sats: ${currentFees.max}`);
|
||||
<section>
|
||||
|
||||
```dart
|
||||
print(`Minimum amount, in sats: ${currentFees.min}`);
|
||||
print(`Maximum amount, in sats: ${currentFees.max}`);
|
||||
print("Minimum amount, in sats: ${currentFees.min}");
|
||||
print("Maximum amount, in sats: ${currentFees.max}");
|
||||
```
|
||||
</section>
|
||||
|
||||
@@ -262,7 +262,7 @@ try {
|
||||
|
||||
```dart
|
||||
String destinationAddress = "bc1..";
|
||||
int amountSat = currentFees.min;
|
||||
int amountSat = <amount>;
|
||||
int satPerVbyte = <fee rate>
|
||||
try {
|
||||
ReverseSwapInfo reverseSwapInfo = await sendOnchain(
|
||||
|
||||
Reference in New Issue
Block a user