-
Notifications
You must be signed in to change notification settings - Fork 31
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
Added Swap Watcher Service #506
base: refactoring-bloc
Are you sure you want to change the base?
Conversation
i5hi
commented
Mar 5, 2025
•
edited
Loading
edited
- Refactor repository and services to ensure domain does not depend on data layer
- Add swap watcher & swap processing
- Add basic swap interaction with wallets
- Implement Fees & Limits logic
…plit up datasources
… fee variables to Swap object.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the main things to change are combining storage and api again to just a boltz_data_source class, or at least inject the storage one in the api one, so that creating a swap contains both creating the swap with the api as persisting it, and returning one BoltzSwapModel
type instead of library types.
Then the second main thing is also using the model in the boltz SwapStatusStream processing so the types of the stream the datasource exposes also is BoltzSwapModel
and not a library type, keeping all dependencies on boltz-dart abstracted in the datasource.
Future<List<SwapModel>> getAll(); | ||
Future<void> delete(String swapId); | ||
// Secure Storage | ||
Future<void> storeBtcLnSwap(BtcLnSwap swap); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it possible to make every concrete Boltz Swap type (BtcLnSwap, LbtcLnSwap and ChainSwap) have a common base type? If so, it would not be required to have a separate method that does exactly the same thing for every type. This will reduce the amount of code needed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Its possible to make a common base type for the *LnSwap but ChainSwap has a different interface. It will require some additional code in the library in dart beyond what is generated automatically by flutter_rust_bridge.
Although, I think the explicit methods are clear and safe ? We won't need to check if what we got back is a Btc or Lbtc swap because the method will always return exactly the one the caller wants.
…oes not return library types or entity types.
@kumulynja This is ready for final review and merge. |
Injected storage into the main datasource, its now just called BoltzDataSource. Also storing the swaps at the time of creation at the datasource and always returning SwapModel or other basic types. Mapped SwapStreamStatus to (String, String) and now boltz-dart types are ONLY used in the datasource. |