Skip to content

Commit

Permalink
Merge pull request #2521 from get10101/fix/send-payments
Browse files Browse the repository at this point in the history
fix(webapp): send payments from frontend
  • Loading branch information
bonomat authored May 9, 2024
2 parents dd39d85 + 8bdcde3 commit 002c6a0
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
2 changes: 2 additions & 0 deletions webapp/frontend/lib/common/model.dart
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,8 @@ class FeeRate implements Formattable {
FeeRate(double.parse(value));
}

double get feeRate => _feeRate;

@override
String formatted() {
return _feeRate.toString();
Expand Down
7 changes: 5 additions & 2 deletions webapp/frontend/lib/services/wallet_service.dart
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,11 @@ class WalletService {
headers: <String, String>{
'Content-Type': 'application/json; charset=UTF-8',
},
body: jsonEncode(
<String, dynamic>{'address': address, 'amount': amount.sats, 'feeRate': feeRate}));
body: jsonEncode(<String, dynamic>{
'address': address,
'amount': amount.sats,
'fee_rate': feeRate.feeRate
}));

if (response.statusCode != 200) {
throw FlutterError(response.body);
Expand Down
5 changes: 4 additions & 1 deletion webapp/frontend/lib/wallet/send_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import 'package:get_10101/common/color.dart';
import 'package:get_10101/common/snack_bar.dart';
import 'package:get_10101/common/text_input_field.dart';
import 'package:get_10101/change_notifier/wallet_change_notifier.dart';
import 'package:get_10101/logger/logger.dart';
import 'package:provider/provider.dart';

class SendScreen extends StatefulWidget {
Expand Down Expand Up @@ -132,7 +133,9 @@ class _SendScreenState extends State<SendScreen> {

showSnackBar(messenger, "Payment has been sent.");
} catch (e) {
showSnackBar(messenger, "Failed to send payment. $e");
logger.e("Failed to send payment ${e.toString()}");
showSnackBar(
messenger, "Failed to send payment. ${e.toString()}");
}
}
: null,
Expand Down

0 comments on commit 002c6a0

Please sign in to comment.