From 6fe109347ae007a6a9a4f3daea49f5cdda41df47 Mon Sep 17 00:00:00 2001 From: ruben beck Date: Mon, 4 Sep 2023 11:02:57 +0200 Subject: [PATCH] add dart examples --- src/guide/buy_btc.md | 10 +++++++++- src/guide/payments.md | 8 ++++++-- src/guide/receive_onchain.md | 6 +----- src/guide/send_onchain.md | 8 ++++---- 4 files changed, 20 insertions(+), 12 deletions(-) diff --git a/src/guide/buy_btc.md b/src/guide/buy_btc.md index addf407..713bdd5 100644 --- a/src/guide/buy_btc.md +++ b/src/guide/buy_btc.md @@ -51,7 +51,15 @@ try {
```dart -// TODO add docs +try { + BuyBitcoinResponse buyBitcoinResponse = buyBitcoin( + reqData: BuyBitcoinRequest(provider: BuyBitcoinProvider.Moonpay, + ), + ); +} catch { + // Handle error +} + ```
diff --git a/src/guide/payments.md b/src/guide/payments.md index 00b8ca7..4632179 100644 --- a/src/guide/payments.md +++ b/src/guide/payments.md @@ -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 } diff --git a/src/guide/receive_onchain.md b/src/guide/receive_onchain.md index 0b7ce59..af582d1 100644 --- a/src/guide/receive_onchain.md +++ b/src/guide/receive_onchain.md @@ -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; diff --git a/src/guide/send_onchain.md b/src/guide/send_onchain.md index 90e2a2c..96f923a 100644 --- a/src/guide/send_onchain.md +++ b/src/guide/send_onchain.md @@ -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}`);
```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}"); ```
@@ -262,7 +262,7 @@ try { ```dart String destinationAddress = "bc1.."; -int amountSat = currentFees.min; +int amountSat = ; int satPerVbyte = try { ReverseSwapInfo reverseSwapInfo = await sendOnchain(