diff --git a/src/guide/buy_btc.md b/src/guide/buy_btc.md index 3aa4794..3bf96fe 100644 --- a/src/guide/buy_btc.md +++ b/src/guide/buy_btc.md @@ -68,7 +68,8 @@ try { ```dart try { BuyBitcoinResponse buyBitcoinResponse = buyBitcoin( - reqData: BuyBitcoinRequest(provider: BuyBitcoinProvider.Moonpay, + reqData: BuyBitcoinRequest( + provider: BuyBitcoinProvider.Moonpay, ), ); } catch { diff --git a/src/guide/fiat_currencies.md b/src/guide/fiat_currencies.md index 50f80c3..a8b3087 100644 --- a/src/guide/fiat_currencies.md +++ b/src/guide/fiat_currencies.md @@ -109,7 +109,7 @@ try { ```dart try { - Map fiatRatesMap = fetchFiatRates(); + Map fiatRatesMap = await fetchFiatRates(); // print your desired rate print(fiatRatesMap["USD"]?.value); } catch(e) { @@ -201,7 +201,31 @@ fun fiatCurrenciesAndRate(): Map = try {
```dart -// TODO +Future> fiatCurrenciesAndRate() async { + try { + List fiatCurrencies = await _breezLib.listFiatCurrencies(); + Map fiatRates = await _breezLib.fetchFiatRates(); + + var sorted = fiatCurrencies.toList(); + sorted.sort((f1, f2) { + return f1.id.compareTo(f2.id); + }); + + Map result = {}; + for (var currency in sorted) { + var rate = fiatRates[currency.id]; + if (rate != null) { + result[currency] = rate; + } + } + + return result; + } catch (e) { + // Handle error + return {}; + } +} + ```
diff --git a/src/guide/payments.md b/src/guide/payments.md index 756abcb..fd1543c 100644 --- a/src/guide/payments.md +++ b/src/guide/payments.md @@ -75,11 +75,11 @@ try { ```dart try { ReceivePaymentResponse invoice = await receivePayment( - reqData: ReceivePaymentRequestData( + reqData: ReceivePaymentRequest( 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 96ff26c..82bd525 100644 --- a/src/guide/receive_onchain.md +++ b/src/guide/receive_onchain.md @@ -68,7 +68,9 @@ try { ```dart try { - SwapInfo swapInfo = await receiveOnchain(ReceiveOnchainRequest()); + SwapInfo swapInfo = await receiveOnchain( + reqData: ReceiveOnchainRequest(), + ); // Send your funds to the below bitcoin address String address = swapInfo.bitcoinAddress; @@ -175,7 +177,7 @@ try { ```dart try { - SwapInfo? swapInfo = await inProgressSwap() + SwapInfo? swapInfo = await inProgressSwap(); } catch (error) { // handle error } @@ -391,7 +393,7 @@ try { swapAddress: refundable.bitcoinAddress, toAddress: destinationAddress, satPerVbyte: satPerVbyte, - ); + ); } catch (error) { // handle error } @@ -507,8 +509,9 @@ try { ```dart int amountMsats = try { - int channelFees = openChannelFee(OpenChannelFeeRequest( - amountMsats: amountMsats, + int channelFees = openChannelFee( + req: OpenChannelFeeRequest( + amountMsats: amountMsats, ), ); } catch { diff --git a/src/guide/send_onchain.md b/src/guide/send_onchain.md index af94b9c..b9d818a 100644 --- a/src/guide/send_onchain.md +++ b/src/guide/send_onchain.md @@ -68,9 +68,9 @@ try { try { ReverseSwapPairInfo currentFees = await fetchReverseSwapFees( req: ReverseSwapFeesRequest( - sendAmountSat: 50000, - ), - ); + sendAmountSat: 50000, + ), + ); print("Total estimated fees for reverse swap: ${currentFees.totalEstimatedFees}"); } catch (error) { @@ -275,6 +275,7 @@ try { String destinationAddress = "bc1.."; int amountSat = ; int satPerVbyte = +ReverseSwapPairInfo currentFees = try { ReverseSwapInfo reverseSwapInfo = await sendOnchain( amountSat: amountSat, diff --git a/src/guide/static_channel_backup.md b/src/guide/static_channel_backup.md index 30db1cf..9e3549d 100644 --- a/src/guide/static_channel_backup.md +++ b/src/guide/static_channel_backup.md @@ -63,7 +63,11 @@ try { ```dart try { - StaticBackupResponse backupData = await staticBackup(request: StaticBackupRequest(workingDir: "")); + StaticBackupResponse backupData = await staticBackup( + request: StaticBackupRequest + workingDir: "", + ), + ); } catch (error) { // handle error }