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 Swap + Animation tools, core improvements & bugfixes, new widgets, and more. #17

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

Conversation

vkryl
Copy link

@vkryl vkryl commented May 29, 2024

Native Swap + Animation tools, core improvements & bugfixes, new widgets, and more.

Most of the work is related to everything that happens after pressing "Swap" button.

APK for testing: APK

Note for regular users who are going to test it: Tonkeeper X is work-in-progress project, it is recommended to create a new wallet inside this Tonkeeper X, and send TON to that balance if someone wants to play with Swap feature, and all animations it brings (do not use primary wallet until it is released, and be aware of scams).

@vkryl
Copy link
Author

vkryl commented May 29, 2024

The submission is overfilled with animations, little details, and fintech precision when working with balances and arithmetic operations.

I wanted to give an additional credit to some probably not noticeable things, but which required an effort:

  1. Balances and rates displayed in the new Swap section are the only place in the app where they are displayed accurately. It turns out that balances that app displays in various places are not correct, because 32-bit float is used. 64-bit signed long for nano also causes problems for some tokens (FISH token is the best for finding all of the problems: when you open chart screen, where the balance is intended to be displayed accurately, many digits are zeroed out). I've deprecated some of the methods, added properly working alternatives, and added comments with guide on how to migrate to them in other parts of the app.
  2. When entering swap screen (Continue button), the transaction is simulated on the blockchain, and up-to-date market rate is fetched.
  3. Blockchain fee is displayed on confirmation screen instead of hadcoded string like in tonkeeper.ston.fi
  4. App tries to show the difference in market price for swapping tokens (increases the decimal part until the difference is visible to user)
  5. Transparent user-friendly error handling. For example, rate API behaves weirdly (e.g. for some wallets it doesn't return USDT rate), however, app transparently notifies the user at every step about any potential errors / outdated information.
  6. Swap section properly handles different user currencies. It doesn't hardcode number of decimals, but calculates how big decimal part should be on the fly
  7. Formatting and support for any locales in amount input: for EN/RU decimal and grouping separator characters are different. App properly handles them (and other locales too, if they ever come to Tonkeeper X)
  8. RTL support: all screens properly handle RTL direction just in case Arabic, Hebrew or Persian ever comes to Tonkeeper X
  9. Network handling: if Swap screen is opened without network, or connection is lost while it was open, it will properly recover once the device is back online.
  10. Made some optimizations and bugfixes outside of the Swap section, like for trimmed balances in the balances list
  11. Easter egg: quick picker by holding choose token (re-used from send screen)

There're, of course, dozen of other details packed in this submission, like few tools which should help the development of animations and bringing the X quality to Tonkeeper. :) I may post some animation demos here later, but I hope they aren't necessary and you will enjoy them.

@vkryl
Copy link
Author

vkryl commented May 30, 2024

Here's a sample issue for №1 in the list above.

  1. Holder has exactly 222,493,621.88751073 FISH.
  2. On tonviewer.com the decimal part is rounded to 222,493,621.89 (it seems it has the the "decimal size for UI" field for tokens).
  3. On main screen the amount is displayed as 222,493,616, which is incorrect (lost 5.89 FISH)
  4. On the charts screen the issue is the same, and entire decimal part is zeroed out.

tonviewer

tonkeeper

choose token

chart screen

swap

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.

2 participants