Skip to content
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

Amazing and fully native swap #17

Open
wants to merge 35 commits into
base: develop
Choose a base branch
from

Conversation

katleta3000
Copy link

Hi there, welcome to my swap feature implementation 🚀

That was an exciting challenge, but due to my limited time and priorities, I decided to focus only on the swap feature.

Here, you can take a look at the overall result:
https://github.com/tonkeeper/ios/assets/1257625/32ab2e1b-78e8-4afd-baac-21804d1de181

All three kinds of swap work without using any webview.
As STON.fi defines its individual list of provided tokens, I did the same with USDT, NOT, ANON, PUNK, jUSDT.

Also, in SwapAvailableTokenController, you can find the commented code for receiving tokens from the TON blockchain. Unfortunately, there is no API to search through more than 35k tokens and no way to receive only tokens that are whitelisted. I thought about making recursive requests in the background to get the whole database, but I dropped the realisation from the final codebase. That's why I also didn't finish the ChooseTokenViewController, as it can't be fully implemented to work as expected in Figma. Cheers to those who succeded 🫡

Here are some known issues and polishing things I didn't have time to implement:

  • The settings feature for choosing the price variability is not complete. But you can find the line private var priceChangeLimit: Double = 0.01 // 1% in SwapViewModel.swift. And this is a working settings, but with no UI implemented.
  • New strings use only the en locale.
  • No dynamic update of the token rates on the swap screen – the rate is fixed after the last input.
  • No tips in the provider details (also removed the liquidity provider fee)
  • There are several duplicated functions between SendV3Controller and the new SwapController; I suggest adding shared controllers or common extensions or moving the re-used codes to other architecture layers.

Some other suggestions for the codebase:

  • How about writing unit-tests? As the wallet is an open-source solution, as a potential user, I want to be sure that the code was well tested. I have found two crashes and fixed them as well. unit tests could definitely find them.
  • There are duplicated formatters. Please see the attachment below
Screenshot 2024-05-29 at 20 28 44
  • Also, there is a lot about the architecture. It's pretty nice and easy to read. However, some layers are not used as they could be, and the SPM modules don't have any intuitive principles of their separation. If you're interested, I can provide my thoughts afterward.

Evgenii Rtishchev added 30 commits May 15, 2024 21:16
- Change certificates and signing for local development
- Change Model to SendV3View.Model due to conflicts
- Add new module and navigation
- Crash iOS15 due to internal problems with reload after append
- WIP
- TonSwift 1.0.10
- Move to common App
- Add hint status
- Add new module and transition based on TonPicker
- Add mock output, add some tuning to bottom sheet view controller
- WIP
- Add rate conversion for chosen tokens
- Fix rate conversion and formatting
- Add special formatting to swap fields
- Add details expand animation
- WIP
- Fix bug with cell backhrounds
- Remove a token from picker that is chosen in the pair
- Fixes of UI glitches and keyboard
- Add continue button
- Add details output to swap
- Small improvement for async tasks
- Add module and basic classes
- Add swap details
- Add error handling
- Add special tokens
- Choose token animations and extra offset
# Conflicts:
#	LocalPackages/App/Sources/App/MainModule/Flows/MainCoordinator.swift
#	LocalPackages/App/Sources/App/WalletModule/Modules/WalletBalance/WalletBalanceViewModel.swift
#	LocalPackages/core-swift/Sources/KeeperCore/Controller/Send/SendConfirmationController/SendConfirmationController.swift
#	Tonkeeper.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved
Evgenii Rtishchev added 5 commits May 29, 2024 17:05
- Fix the issue due to formatting; add haptic engine on success
- Constraint and animation fix
- Add converted balances
This reverts commit 49460d7.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant