tonkeeper / android

Tonkeeper open-source non-custodial TON crypto wallet and gateway to blockchain dApps
https://play.google.com/store/apps/details?id=com.tonapps.tonkeeperx
45 stars 28 forks source link

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

Open MostafaAryan opened 1 month ago

MostafaAryan commented 1 month ago

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

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.

MostafaAryan commented 1 month ago

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:

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.