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