-
Notifications
You must be signed in to change notification settings - Fork 25
Restore orders feature #355
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
faece2b
feat: Add 'restore-session' action and EmptyPayload
BraCR10 61f1e50
feat: Partially Implement restore session manager and progress state
BraCR10 8587759
feat: Create restore progress overlay UI and dialog
BraCR10 5828a05
fix: Update notification handling for restore action
BraCR10 21802bb
feat: Add localization for restore and import features
BraCR10 6aa579b
feat: Add 'orders' action enum and notification placeholders
BraCR10 6a86f74
feat: Introduce OrdersRequest and OrdersResponse data models
BraCR10 c623007
refactor(restore): Remove old RestoreMessage and rename restore method
BraCR10 98c9f93
refactor(restore): Setup event-driven infrastructure in RestoreService
BraCR10 3f56975
feat(restore): Implement staged restore process with order details fe…
BraCR10 0fad4e0
feat: Add LastTradeIndex action and response model
BraCR10 b91c40f
chore: Update notification message mapping for new actions
BraCR10 2740856
refactor(restore): Update dependencies and cleanup logic in RestoreSe…
BraCR10 2006194
feat(restore): Implement session-based restore and last trade index r…
BraCR10 33d1c27
feat(restore): Orchestrate new restore process flow
BraCR10 8fce8ba
chore: Clear notifications on master key regeneration
BraCR10 d3f9960
feat(restore) : Manage index trade resquest and show overley
BraCR10 b932715
feat : build msg logic
BraCR10 54db811
feat : disputes restore management
BraCR10 68e4565
feat : mnemonic checksum validator
BraCR10 b619b2b
refactor(restore): improve logs and comments
BraCR10 bd2b140
Refactors restore mode implementation
BraCR10 e254926
fix : solving action issues according with user roles
BraCR10 3c59a29
fix : removing duplicated var
BraCR10 cf3f61a
fix : restore msgs state issues
BraCR10 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| import 'package:mostro_mobile/data/models/payload.dart'; | ||
|
|
||
| class LastTradeIndexResponse implements Payload { | ||
| final int tradeIndex; | ||
|
|
||
| const LastTradeIndexResponse({required this.tradeIndex}); | ||
|
|
||
| @override | ||
| String get type => 'last-trade-index'; | ||
|
|
||
| factory LastTradeIndexResponse.fromJson(Map<String, dynamic> json) { | ||
| return LastTradeIndexResponse( | ||
| tradeIndex: json['trade_index'] as int, | ||
| ); | ||
| } | ||
|
|
||
| @override | ||
| Map<String, dynamic> toJson() => { | ||
| 'trade_index': tradeIndex, | ||
| }; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| import 'package:mostro_mobile/data/models/payload.dart'; | ||
|
|
||
| class OrdersPayload implements Payload { | ||
| final List<String> ids; | ||
|
|
||
| const OrdersPayload({required this.ids}); | ||
|
|
||
| @override | ||
| String get type => 'orders'; | ||
|
|
||
| factory OrdersPayload.fromJson(Map<String, dynamic> json) { | ||
| return OrdersPayload( | ||
| ids: (json['ids'] as List<dynamic>).map((e) => e as String).toList(), | ||
| ); | ||
| } | ||
|
|
||
| @override | ||
| Map<String, dynamic> toJson() => { | ||
| 'ids': ids, | ||
| }; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,95 @@ | ||
| import 'package:mostro_mobile/data/models/payload.dart'; | ||
|
|
||
|
|
||
| class OrdersResponse implements Payload { | ||
| final List<OrderDetail> orders; | ||
|
|
||
| OrdersResponse({required this.orders}); | ||
|
|
||
| @override | ||
| String get type => 'orders'; | ||
|
|
||
| factory OrdersResponse.fromJson(Map<String, dynamic> json) { | ||
| return OrdersResponse( | ||
| orders: (json['orders'] as List<dynamic>?) | ||
| ?.map((o) => OrderDetail.fromJson(o as Map<String, dynamic>)) | ||
| .toList() ?? | ||
| [], | ||
| ); | ||
| } | ||
|
|
||
| @override | ||
| Map<String, dynamic> toJson() => { | ||
| 'orders': orders.map((o) => o.toJson()).toList(), | ||
| }; | ||
| } | ||
|
|
||
| class OrderDetail { | ||
| final String id; | ||
| final String kind; | ||
| final String status; | ||
| final int amount; | ||
| final String fiatCode; | ||
| final int? minAmount; | ||
| final int? maxAmount; | ||
| final int fiatAmount; | ||
| final String paymentMethod; | ||
| final int premium; | ||
| final String? buyerTradePubkey; | ||
| final String? sellerTradePubkey; | ||
| final int? createdAt; | ||
| final int? expiresAt; | ||
|
|
||
| OrderDetail({ | ||
| required this.id, | ||
| required this.kind, | ||
| required this.status, | ||
| required this.amount, | ||
| required this.fiatCode, | ||
| this.minAmount, | ||
| this.maxAmount, | ||
| required this.fiatAmount, | ||
| required this.paymentMethod, | ||
| required this.premium, | ||
| this.buyerTradePubkey, | ||
| this.sellerTradePubkey, | ||
| this.createdAt, | ||
| this.expiresAt, | ||
| }); | ||
|
|
||
| factory OrderDetail.fromJson(Map<String, dynamic> json) { | ||
| return OrderDetail( | ||
| id: json['id'] as String, | ||
| kind: json['kind'] as String, | ||
| status: json['status'] as String, | ||
| amount: json['amount'] as int, | ||
| fiatCode: json['fiat_code'] as String, | ||
| minAmount: json['min_amount'] != null ? json['min_amount'] as int : null, | ||
| maxAmount: json['max_amount'] != null ? json['max_amount'] as int : null, | ||
| fiatAmount: json['fiat_amount'] as int, | ||
| paymentMethod: json['payment_method'] as String, | ||
| premium: json['premium'] as int, | ||
| buyerTradePubkey: json['buyer_trade_pubkey'] != null ? json['buyer_trade_pubkey'] as String : null, | ||
| sellerTradePubkey: json['seller_trade_pubkey'] != null ? json['seller_trade_pubkey'] as String : null, | ||
| createdAt: json['created_at'] != null ? json['created_at'] as int : null, | ||
| expiresAt: json['expires_at'] != null ? json['expires_at'] as int : null, | ||
| ); | ||
| } | ||
|
|
||
| Map<String, dynamic> toJson() => { | ||
| 'id': id, | ||
| 'kind': kind, | ||
| 'status': status, | ||
| 'amount': amount, | ||
| 'fiat_code': fiatCode, | ||
| 'min_amount': minAmount, | ||
| 'max_amount': maxAmount, | ||
| 'fiat_amount': fiatAmount, | ||
| 'payment_method': paymentMethod, | ||
| 'premium': premium, | ||
| 'buyer_trade_pubkey': buyerTradePubkey, | ||
| 'seller_trade_pubkey': sellerTradePubkey, | ||
| 'created_at': createdAt, | ||
| 'expires_at': expiresAt, | ||
| }; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,91 @@ | ||
| import 'package:mostro_mobile/data/models/payload.dart'; | ||
|
|
||
| class RestoreData implements Payload { | ||
| final List<RestoredOrder> orders; | ||
| final List<RestoredDispute> disputes; | ||
|
|
||
| RestoreData({ | ||
| required this.orders, | ||
| required this.disputes, | ||
| }); | ||
|
|
||
| @override | ||
| String get type => 'restore_data'; | ||
|
|
||
| factory RestoreData.fromJson(Map<String, dynamic> json) { | ||
| final restoreData = json['restore_data'] as Map<String, dynamic>; | ||
|
|
||
| return RestoreData( | ||
| orders: (restoreData['orders'] as List<dynamic>?) | ||
| ?.map((o) => RestoredOrder.fromJson(o as Map<String, dynamic>)) | ||
| .toList() ?? [], | ||
| disputes: (restoreData['disputes'] as List<dynamic>?) | ||
| ?.map((d) => RestoredDispute.fromJson(d as Map<String, dynamic>)) | ||
| .toList() ?? [], | ||
| ); | ||
| } | ||
|
|
||
| @override | ||
| Map<String, dynamic> toJson() => { | ||
| 'restore_data': { | ||
| 'orders': orders.map((o) => o.toJson()).toList(), | ||
| 'disputes': disputes.map((d) => d.toJson()).toList(), | ||
| } | ||
| }; | ||
| } | ||
|
|
||
| class RestoredOrder { | ||
| final String id; | ||
| final int tradeIndex; | ||
| final String status; | ||
|
|
||
| RestoredOrder({ | ||
| required this.id, | ||
| required this.tradeIndex, | ||
| required this.status, | ||
| }); | ||
|
|
||
| factory RestoredOrder.fromJson(Map<String, dynamic> json) { | ||
| return RestoredOrder( | ||
| id: json['order_id'] as String, | ||
| tradeIndex: json['trade_index'] as int, | ||
| status: json['status'] as String, | ||
| ); | ||
| } | ||
|
|
||
| Map<String, dynamic> toJson() => { | ||
| 'order_id': id, | ||
| 'trade_index': tradeIndex, | ||
| 'status': status, | ||
| }; | ||
| } | ||
|
|
||
| class RestoredDispute { | ||
| final String disputeId; | ||
| final String orderId; | ||
| final int tradeIndex; | ||
| final String status; | ||
|
|
||
| RestoredDispute({ | ||
| required this.disputeId, | ||
| required this.orderId, | ||
| required this.tradeIndex, | ||
| required this.status, | ||
| }); | ||
|
|
||
| factory RestoredDispute.fromJson(Map<String, dynamic> json) { | ||
| return RestoredDispute( | ||
| disputeId: json['dispute_id'] as String, | ||
| orderId: json['order_id'] as String, | ||
| tradeIndex: json['trade_index'] as int, | ||
| status: json['status'] as String, | ||
| ); | ||
| } | ||
|
|
||
| Map<String, dynamic> toJson() => { | ||
| 'dispute_id': disputeId, | ||
| 'order_id': orderId, | ||
| 'trade_index': tradeIndex, | ||
| 'status': status, | ||
| }; | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.