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

Native Android Swap (no webview) + Buy & Sell #20

Open
wants to merge 14 commits into
base: main
Choose a base branch
from

Conversation

MostafaAryan
Copy link

I have took part in the tonkeeper contest and have implemented these two features:

  • Swap
  • Buy & Sell

About Swap: I have implemented swap natively using Kotlin code and have not used any Javascript injection into webview. This has resulted into a smooth swap and great performance.

About: I have also implemented Buy and sell feature is where user can enter TON amount and select payment method and currency and then operator and finally is redirected to the operators web payment gateway.

Thanks.

polstianka and others added 14 commits May 16, 2024 17:04
- Swap functionality is implemented using native kotlin/android code which is much faster and has better performance than the proposed webview workaround.

-Stonfi APIs added to project.

- multidex added to project.

- new strings added to project.
- Implemented the android native flow of buy and sell.

- Added "boot.tonkeeper.com" to the list of base URLs.
- Some strings translated to Russian language.
- swap submit button UI improvement.
- Removed TokenTypeItem.kt class and added new Item classes for ChooseTokenAdapter.
- Handle UI reaction on API request timeout.
- Fix minor bug related to list scrolling in bottomsheet.
- Minor bug fix.
@MostafaAryan
Copy link
Author

MostafaAryan commented Jun 7, 2024

My Submission Details:

APK of my submission: APK
Contact me (Telegram): @a_jake

Implemented Features:

I have implemented two features for this contest, the native SWAP and the BUY/SELL. Unfortunately due to my time limitations I did not completely implement staking feature and therefore I didn't push this feature.

About My Implementation:

  • I have not used any visible or hidden webview, all implementations are fully native and pure Kotlin code (Except for Last step of buy/sell in which user should be redirected to operator's website).
  • My implementation has respected the original code base of the project's developer. I have developed these features with the same code style that other features in the application has been developed. Deprecated classes have not been used.
  • Not a single library has been added to the project.
  • The views are xml as requested by the contest supervisors.
  • Some animations such as Shimmer/Skeleton animation is used to improve UX.

Swap:

I have implemented the swap feature completely native. There is no use of webview or javascript injection, only pure Kotlin code which ensures great performance, and a fast user experience. When user enters the native swap page, a skeleton/shimmer loading is displayed and all assets are fetched from the API. The user can choose pairs to swap and change minimum slippage and see the swap simulation details, and finally click on the continue button to go to confirm page and confirm the swap. In this part the message object is created using native Kotlin code and then sent to the blockchain. Swap is done successfully and user is redirected to transaction history page. The flow of the swap is exactly implemented based on the provided Figma desings and the current behavior of tonkeeper react-native app and tonkeeper web.


Buy/Sell:

I have also implemented Buy and sell feature where users can trade TON, and fiat through partner platforms. When user enters the "Buy or Sell" screen, they can enter the amount of TON they want to buy or sell, and the fiat equivalent of the entered amount is instantly calculated and displayed to the user. The exchange rate between TON and fiat currency is being fetched periodically, and the fiat equivalent that is displayed to the user is updated periodically and is always based on the latest exchange rate. Then user can select payment method from a list (for example pay by credit card), and then the continue button becomes active and user continues to the next page where a list of operators are displayed to the user. The list of operators are fetched from one API and the exchange rate each operator offers is fetched from another API. These data are mapped and displayed together. User can also change the default currency and the exchange rate will instantly update based on the new currency. After selecting the operator the user moves forward to the confirmation page where we display how much user is paying and how much user is getting, the user can change these numbers and click continue, after that user is redirected to the webview to do its payment. finally user is redirected back to the application. Buy or Sell is done successfully.


Staking:

Unfortunately due to my time limitations I did not completely implement staking feature and therefore I didn't push this feature.

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.

3 participants