Skip to content

Commit

Permalink
List payments in reverse chronological order (newest to oldest) (#45)
Browse files Browse the repository at this point in the history
* Use ListPaymentsRequest and remove list reversal

* Apply suggestions from code review

Co-authored-by: Erdem Yerebasmaz <[email protected]>

* Use const instead of final

---------

Co-authored-by: Erdem Yerebasmaz <[email protected]>
  • Loading branch information
dangeross and erdemyerebasmaz authored Jul 11, 2024
1 parent 741b696 commit 770f429
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
3 changes: 1 addition & 2 deletions lib/bloc/account/account_bloc.dart
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,6 @@ class AccountBloc extends Cubit<AccountState> with HydratedMixin {
);
}).toList();
}
// TODO: Liquid - Return chronologically sorted list
return filteredPayments.reversed.toList();
return filteredPayments;
}
}
9 changes: 6 additions & 3 deletions lib/bloc/account/breez_sdk_liquid.dart
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class BreezSDKLiquid {

Future _fetchWalletData(liquid_sdk.BindingLiquidSdk sdk) async {
await _getInfo(sdk);
await _listPayments(sdk);
await _listPayments(sdk: sdk);
}

Future<liquid_sdk.GetInfoResponse> _getInfo(liquid_sdk.BindingLiquidSdk sdk) async {
Expand All @@ -32,8 +32,11 @@ class BreezSDKLiquid {
return walletInfo;
}

Future<List<liquid_sdk.Payment>> _listPayments(liquid_sdk.BindingLiquidSdk sdk) async {
final paymentsList = await sdk.listPayments();
Future<List<liquid_sdk.Payment>> _listPayments({
required liquid_sdk.BindingLiquidSdk sdk,
}) async {
const req = liquid_sdk.ListPaymentsRequest();
final paymentsList = await sdk.listPayments(req: req);
_paymentsController.add(paymentsList);
return paymentsList;
}
Expand Down

0 comments on commit 770f429

Please sign in to comment.