status-mobile
status-mobile copied to clipboard
feat: trigger swap transactions
fixes #20381 fixes #20344
Summary
This PR integrates swaps transactions actually triggering after user confirms the transaction. Also adds proper toasts notifications as per designs.
https://github.com/user-attachments/assets/ae5b0be9-575c-437c-b57e-b2c88a43cf13
Platforms
- Android
- iOS
Functional
- wallet / transactions
Steps to test
- Open Status
- Login
- Go to wallet
- Select an account
- Select Swap option
- Select a ERC20 token on Select asset to pay screen
- Enter a valid amount
- Wait for swap proposal to appear
- Tap on "Review swap"
- Slide to execute the transction
- Enter password
- Swap modal should be dismissed and toast should be shown
- Wait for the swap transaction to be confirmed / failed and proper toasts are shown
status: wip
Jenkins Builds
Click to see older builds (60)
| :grey_question: | Commit | :hash: | Finished (UTC) | Duration | Platform | Result |
|---|---|---|---|---|---|---|
| :x: | c1313801 | #2 | 2024-08-28 03:54:26 | ~2 min | tests |
:page_facing_up:log |
| :heavy_check_mark: | c1313801 | #2 | 2024-08-28 03:59:22 | ~7 min | android-e2e |
:robot:apk :calling: |
| :heavy_check_mark: | c1313801 | #2 | 2024-08-28 03:59:52 | ~7 min | android |
:robot:apk :calling: |
| :heavy_check_mark: | c1313801 | #2 | 2024-08-28 04:02:23 | ~10 min | ios |
:iphone:ipa :calling: |
| :heavy_check_mark: | dfcf773c | #3 | 2024-08-28 18:09:51 | ~4 min | tests |
:page_facing_up:log |
| :heavy_check_mark: | dfcf773c | #3 | 2024-08-28 18:12:49 | ~7 min | android-e2e |
:robot:apk :calling: |
| :heavy_check_mark: | dfcf773c | #3 | 2024-08-28 18:13:12 | ~7 min | android |
:robot:apk :calling: |
| :heavy_check_mark: | dfcf773c | #3 | 2024-08-28 18:15:01 | ~9 min | ios |
:iphone:ipa :calling: |
| :heavy_check_mark: | 4b44668d | #4 | 2024-08-29 12:21:49 | ~4 min | tests |
:page_facing_up:log |
| :heavy_check_mark: | 4b44668d | #4 | 2024-08-29 12:25:46 | ~8 min | android-e2e |
:robot:apk :calling: |
| :heavy_check_mark: | 4b44668d | #4 | 2024-08-29 12:26:12 | ~9 min | android |
:robot:apk :calling: |
| :heavy_check_mark: | 4b44668d | #4 | 2024-08-29 12:26:47 | ~9 min | ios |
:iphone:ipa :calling: |
| :x: | 698a8ec6 | #5 | 2024-08-29 13:08:54 | ~3 min | tests |
:page_facing_up:log |
| :heavy_check_mark: | 698a8ec6 | #5 | 2024-08-29 13:12:04 | ~6 min | android |
:robot:apk :calling: |
| :heavy_check_mark: | 698a8ec6 | #5 | 2024-08-29 13:13:15 | ~7 min | android-e2e |
:robot:apk :calling: |
| :heavy_check_mark: | 698a8ec6 | #5 | 2024-08-29 13:15:39 | ~10 min | ios |
:iphone:ipa :calling: |
| :x: | 538d2a7a | #6 | 2024-08-30 04:34:37 | ~3 min | tests |
:page_facing_up:log |
| :heavy_check_mark: | 538d2a7a | #6 | 2024-08-30 04:37:59 | ~7 min | android-e2e |
:robot:apk :calling: |
| :heavy_check_mark: | 538d2a7a | #6 | 2024-08-30 04:39:58 | ~9 min | android |
:robot:apk :calling: |
| :heavy_check_mark: | 538d2a7a | #6 | 2024-08-30 04:41:41 | ~10 min | ios |
:iphone:ipa :calling: |
| :x: | 40088e56 | #7 | 2024-09-02 04:52:12 | ~2 min | tests |
:page_facing_up:log |
| :heavy_check_mark: | 40088e56 | #7 | 2024-09-02 04:56:52 | ~7 min | android-e2e |
:robot:apk :calling: |
| :heavy_check_mark: | 40088e56 | #7 | 2024-09-02 04:57:56 | ~8 min | android |
:robot:apk :calling: |
| :heavy_check_mark: | 40088e56 | #7 | 2024-09-02 04:59:35 | ~10 min | ios |
:iphone:ipa :calling: |
| :x: | a87a51b7 | #8 | 2024-09-02 14:10:52 | ~2 min | tests |
:page_facing_up:log |
| :heavy_check_mark: | bd3111b7 | #9 | 2024-09-02 14:25:10 | ~10 min | ios |
:iphone:ipa :calling: |
| :heavy_check_mark: | bd3111b7 | #9 | 2024-09-02 14:25:55 | ~11 min | android-e2e |
:robot:apk :calling: |
| :x: | bd3111b7 | #9 | 2024-09-02 14:28:58 | ~14 min | tests |
:page_facing_up:log |
| :heavy_check_mark: | bd3111b7 | #9 | 2024-09-02 14:29:04 | ~14 min | android |
:robot:apk :calling: |
| :x: | 184e9fe7 | #10 | 2024-09-02 20:41:23 | ~3 min | tests |
:page_facing_up:log |
| :heavy_check_mark: | 184e9fe7 | #10 | 2024-09-02 20:44:36 | ~6 min | android-e2e |
:robot:apk :calling: |
| :heavy_check_mark: | 184e9fe7 | #10 | 2024-09-02 20:47:33 | ~9 min | android |
:robot:apk :calling: |
| :heavy_check_mark: | 184e9fe7 | #10 | 2024-09-02 20:47:58 | ~9 min | ios |
:iphone:ipa :calling: |
| :x: | 066230f3 | #11 | 2024-09-03 13:23:47 | ~2 min | tests |
:page_facing_up:log |
| :heavy_check_mark: | 066230f3 | #11 | 2024-09-03 13:28:51 | ~7 min | android-e2e |
:robot:apk :calling: |
| :heavy_check_mark: | 066230f3 | #11 | 2024-09-03 13:29:10 | ~7 min | android |
:robot:apk :calling: |
| :heavy_check_mark: | 066230f3 | #11 | 2024-09-03 13:31:06 | ~9 min | ios |
:iphone:ipa :calling: |
| :x: | 1b58b9cb | #12 | 2024-09-03 15:30:13 | ~2 min | tests |
:page_facing_up:log |
| :heavy_check_mark: | 1b58b9cb | #12 | 2024-09-03 15:35:31 | ~7 min | android-e2e |
:robot:apk :calling: |
| :heavy_check_mark: | 1b58b9cb | #12 | 2024-09-03 15:35:51 | ~7 min | android |
:robot:apk :calling: |
| :heavy_check_mark: | 1b58b9cb | #12 | 2024-09-03 15:38:53 | ~10 min | ios |
:iphone:ipa :calling: |
| :x: | 6c6e4e18 | #13 | 2024-09-03 17:10:40 | ~3 min | tests |
:page_facing_up:log |
| :heavy_check_mark: | 6c6e4e18 | #13 | 2024-09-03 17:14:31 | ~6 min | android |
:robot:apk :calling: |
| :heavy_check_mark: | 6c6e4e18 | #13 | 2024-09-03 17:15:50 | ~8 min | android-e2e |
:robot:apk :calling: |
| :heavy_check_mark: | 6c6e4e18 | #13 | 2024-09-03 17:17:16 | ~9 min | ios |
:iphone:ipa :calling: |
| :x: | 0ae3d1bc | #15 | 2024-09-03 19:05:11 | ~2 min | tests |
:page_facing_up:log |
| :heavy_check_mark: | 0ae3d1bc | #15 | 2024-09-03 19:09:33 | ~6 min | android |
:robot:apk :calling: |
| :heavy_check_mark: | 0ae3d1bc | #15 | 2024-09-03 19:10:02 | ~7 min | android-e2e |
:robot:apk :calling: |
| :heavy_check_mark: | 981100fb | #16 | 2024-09-03 19:15:07 | ~4 min | tests |
:page_facing_up:log |
| :heavy_check_mark: | 981100fb | #16 | 2024-09-03 19:18:23 | ~7 min | android-e2e |
:robot:apk :calling: |
| :heavy_check_mark: | 981100fb | #16 | 2024-09-03 19:18:47 | ~7 min | android |
:robot:apk :calling: |
| :heavy_check_mark: | 981100fb | #16 | 2024-09-03 19:20:44 | ~9 min | ios |
:iphone:ipa :calling: |
| :heavy_check_mark: | ffde94fc | #17 | 2024-09-03 20:08:18 | ~4 min | tests |
:page_facing_up:log |
| :heavy_check_mark: | ffde94fc | #17 | 2024-09-03 20:10:38 | ~6 min | android-e2e |
:robot:apk :calling: |
| :heavy_check_mark: | ffde94fc | #17 | 2024-09-03 20:11:10 | ~6 min | android |
:robot:apk :calling: |
| :heavy_check_mark: | ffde94fc | #17 | 2024-09-03 20:14:27 | ~10 min | ios |
:iphone:ipa :calling: |
| :heavy_check_mark: | 85c05f18 | #18 | 2024-09-04 15:49:32 | ~4 min | tests |
:page_facing_up:log |
| :heavy_check_mark: | 85c05f18 | #18 | 2024-09-04 15:52:55 | ~7 min | android-e2e |
:robot:apk :calling: |
| :heavy_check_mark: | 85c05f18 | #18 | 2024-09-04 15:53:17 | ~7 min | android |
:robot:apk :calling: |
| :heavy_check_mark: | 85c05f18 | #18 | 2024-09-04 15:55:50 | ~10 min | ios |
:iphone:ipa :calling: |
| :grey_question: | Commit | :hash: | Finished (UTC) | Duration | Platform | Result |
|---|---|---|---|---|---|---|
| :heavy_check_mark: | 9940f3c7 | #21 | 2024-09-04 17:02:38 | ~4 min | tests |
:page_facing_up:log |
| :heavy_check_mark: | 9940f3c7 | #21 | 2024-09-04 17:04:30 | ~6 min | android-e2e |
:robot:apk :calling: |
| :heavy_check_mark: | 9940f3c7 | #21 | 2024-09-04 17:06:26 | ~8 min | android |
:robot:apk :calling: |
| :heavy_check_mark: | 9940f3c7 | #21 | 2024-09-04 17:10:52 | ~12 min | ios |
:iphone:ipa :calling: |
| :heavy_check_mark: | f12e0e57 | #22 | 2024-09-06 14:20:19 | ~4 min | tests |
:page_facing_up:log |
| :heavy_check_mark: | f12e0e57 | #22 | 2024-09-06 14:22:20 | ~6 min | android-e2e |
:robot:apk :calling: |
| :heavy_check_mark: | f12e0e57 | #22 | 2024-09-06 14:23:12 | ~7 min | android |
:robot:apk :calling: |
| :heavy_check_mark: | f12e0e57 | #22 | 2024-09-06 14:26:18 | ~10 min | ios |
:iphone:ipa :calling: |
71% of end-end tests have passed
Total executed tests: 7
Failed tests: 2
Expected to fail tests: 0
Passed tests: 5
IDs of failed tests: 727230,727229
Failed tests (2)
Click to expand
Class TestWalletMultipleDevice:
| 1. test_wallet_send_asset_from_drawer, id: 727230 |
|
| 2. test_wallet_send_eth, id: 727229 |
|
Passed tests (5)
Click to expand
Class TestOneToOneChatMultipleSharedDevicesNewUi:
| 1. test_1_1_chat_non_latin_messages_stack_update_profile_photo, id: 702745 |
| Device sessions Device 1: Device 2: |
Class TestCommunityMultipleDeviceMerged:
| 1. test_community_message_edit, id: 702843 |
| Device sessions Device 1: Device 2: |
Class TestWalletOneDevice:
| 1. test_wallet_add_remove_regular_account, id: 727231 |
| Device sessions Device 1: |
Class TestCommunityOneDeviceMerged:
| 1. test_community_copy_and_paste_message_in_chat_input, id: 702742 |
| Device sessions Device 1: |
| 2. test_restore_multiaccount_with_waku_backup_remove_switch, id: 703133 |
| Device sessions Device 1: |
hi @briansztamfater could you please rebase the current PR? thanx
@briansztamfater should the swap feature still be feature-flagged? In the latest build, I had to manually enable it in the feature flags to see the swap option
PR_ISSUE 1: "Something went wrong, please try again later" Error message shown after entering valid value to swap
Steps:
- Go to swap page
- Enter valid available value
Actual result:
'Something went wrong, please try again later' error message is shown
Expected result:
The user should be able to proceed to the swap confirmation page after entering a valid amount.
OS:
IOS, Android
Devices:
- Pixel 7a, Android 13
- iPhone 11 Pro Max, IOS 17
Logs
@briansztamfater I think some commits might be missing in the latest build because the swap UI looks completely different from what was shown in the demo compared with the latest build where the issue is found. Could you please check?
@briansztamfater should the swap feature still be feature-flagged? In the latest build, I had to manually enable it in the feature flags to see the swap option
We should remove it at some point, I'll raise a new PR removing the flag 👍
About issue 1, please try again, I have just updated the code. As we don't have a way (yet) to select the asset to receive, I hardcoded USDT for testing purposes, but SNT should be the default, which is a token available for all users. If you don't have USDT in your tokens list that may cause problems for now. Once #21140 is done that should be fine.
Also I will rebase, it will take some time as there is some PR chaining so I need to rebase the dependant PRs first
71% of end-end tests have passed
Total executed tests: 7
Failed tests: 2
Expected to fail tests: 0
Passed tests: 5
IDs of failed tests: 727230,727229
Failed tests (2)
Click to expand
Class TestWalletMultipleDevice:
| 1. test_wallet_send_asset_from_drawer, id: 727230 |
|
| 2. test_wallet_send_eth, id: 727229 |
|
Passed tests (5)
Click to expand
Class TestWalletOneDevice:
| 1. test_wallet_add_remove_regular_account, id: 727231 |
| Device sessions Device 1: |
Class TestOneToOneChatMultipleSharedDevicesNewUi:
| 1. test_1_1_chat_non_latin_messages_stack_update_profile_photo, id: 702745 |
| Device sessions Device 1: Device 2: |
Class TestCommunityMultipleDeviceMerged:
| 1. test_community_message_edit, id: 702843 |
| Device sessions Device 1: Device 2: |
Class TestCommunityOneDeviceMerged:
| 1. test_community_copy_and_paste_message_in_chat_input, id: 702742 |
| Device sessions Device 1: |
| 2. test_restore_multiaccount_with_waku_backup_remove_switch, id: 703133 |
| Device sessions Device 1: |
@briansztamfater thank you for clarification. Unfortunately I am blocked to test the swap flow fully due status go issue .
Only some UI issues are found:
ISSUE 2: [Android] Device's native keyboard appears on Swap page
Steps:
Go to the swap page within the app on an Android device.
Actual result:
The device's native keyboard automatically opens, resulting in two keyboards being displayed: the app's keyboard and the device's native keyboard.
Expected result:
Only the app's keyboard should be displayed, without triggering the device's native keyboard.
ENV:
Pixel 7a, Android 13
ISSUE 3: Max value balances not updating according to selected account
Steps:
- Recover a user with at least 2 accounts.
- Navigate to the swap page.
- Select a different account on the swap page.
Actual result:
The max value balances displayed do not update to reflect the newly selected account's balances
https://github.com/user-attachments/assets/59ddf14b-336d-4f14-8943-c33091d98388
Expected result:
The max balances should update to reflect the selected account's available funds on the swap page.
@briansztamfater Not sure if issue 2 and issue 3 are within the scope of this PR. If not, I'll create them separately.
@VolodLytvynenko thanks for testing! Issue 3 is out of scope of this PR. Can work on issue 2 at the meantime, until status-go issue is fixed and the whole flow could be tested.
@VolodLytvynenko updated status-go version which includes changes in https://github.com/status-im/status-go/pull/5784
@VolodLytvynenko issue 2 should be fixed now
86% of end-end tests have passed
Total executed tests: 7
Failed tests: 1
Expected to fail tests: 0
Passed tests: 6
IDs of failed tests: 727229
Failed tests (1)
Click to expand
Class TestWalletMultipleDevice:
| 1. test_wallet_send_eth, id: 727229 |
|
Passed tests (6)
Click to expand
Class TestCommunityOneDeviceMerged:
| 1. test_community_copy_and_paste_message_in_chat_input, id: 702742 |
| Device sessions Device 1: |
| 2. test_restore_multiaccount_with_waku_backup_remove_switch, id: 703133 |
| Device sessions Device 1: |
Class TestCommunityMultipleDeviceMerged:
| 1. test_community_message_edit, id: 702843 |
| Device sessions Device 1: Device 2: |
Class TestOneToOneChatMultipleSharedDevicesNewUi:
| 1. test_1_1_chat_non_latin_messages_stack_update_profile_photo, id: 702745 |
| Device sessions Device 1: Device 2: |
Class TestWalletMultipleDevice:
| 1. test_wallet_send_asset_from_drawer, id: 727230 |
Class TestWalletOneDevice:
| 1. test_wallet_add_remove_regular_account, id: 727231 |
| Device sessions Device 1: |
hi @briansztamfater Thank you for fixes! Unfortunately, I can't complete the transaction. I keep encountering an "insufficient balance" error toast every time, even though my account has enough tokens.
It seems we may be calculating the fee incorrectly. In MetaMask, the fee for an ETH -> SNT transaction is estimated at $17, while in Status, it's $3. My account has $5 (0.0021 ETH) for fees, which should be enough, but our fee calculation might be off.
Additionally, I can't confirm this transaction on other L2 networks, which would be cheaper, because the default SNT for receiving has low liquidity on L2 networks. As a result, there are no quotes available (the same behavior it both MetaMask and Status Desktop), leading to the "something went wrong" message on mobile.
I suggest either temporary changing the receiving token to one with higher liquidity, like DAI or USDC, which would reduce the transaction fee to around $0.05, or merging this PR as it is and rechecking the feature once we can manually change the receiving tokens. WDYT?
@VolodLytvynenko thanks for testing and the valuable feedback. I've set DAI as the default token for now. I just tried locally and could swap USDT/DAI without any issues. Please let me know if swaps work this way, and we can try to figure out other issues in follow up PRs
71% of end-end tests have passed
Total executed tests: 7
Failed tests: 2
Expected to fail tests: 0
Passed tests: 5
IDs of failed tests: 727230,727229
Failed tests (2)
Click to expand
Class TestWalletMultipleDevice:
| 1. test_wallet_send_asset_from_drawer, id: 727230 |
|
| 2. test_wallet_send_eth, id: 727229 |
|
Passed tests (5)
Click to expand
Class TestWalletOneDevice:
| 1. test_wallet_add_remove_regular_account, id: 727231 |
| Device sessions Device 1: |
Class TestOneToOneChatMultipleSharedDevicesNewUi:
| 1. test_1_1_chat_non_latin_messages_stack_update_profile_photo, id: 702745 |
| Device sessions Device 1: Device 2: |
Class TestCommunityMultipleDeviceMerged:
| 1. test_community_message_edit, id: 702843 |
| Device sessions Device 1: Device 2: |
Class TestCommunityOneDeviceMerged:
| 1. test_community_copy_and_paste_message_in_chat_input, id: 702742 |
| Device sessions Device 1: |
| 2. test_restore_multiaccount_with_waku_backup_remove_switch, id: 703133 |
| Device sessions Device 1: |
50% of end-end tests have passed
Total executed tests: 2
Failed tests: 1
Expected to fail tests: 0
Passed tests: 1
IDs of failed tests: 727230
Failed tests (1)
Click to expand
Class TestWalletMultipleDevice:
| 1. test_wallet_send_asset_from_drawer, id: 727230 |
|
Passed tests (1)
Thank you for PR, no issues from my side, except this UI lower priority ones that can be considered as follow ups
ISSUE 4: Incorrect placement of max value and incorrect button label on swap approval page
Steps:
- Go to the swap page.
- Select an ERC20 token.
- Enter a valid value.
- Tap the "Approve" button.
Actual Result:
The "Max Value" is located in the wrong place on the approval page.
The button label says "Slide to swap" instead of "Slide to sign."
Expected Result:
The "Max Value" should be correctly placed according to the design.
The button label should correctly say "Slide to sign" on the approval page.
Awesome @VolodLytvynenko, just fixed Issue 4 too :)
Waiting for an approval from the dev side now. blocked label can be removed, right?
ISSUE 5: The input and receiving value not properly rounded
Steps:
- Go to the swap page and select ETH.
- Enter a minimum value, such as 0.0000000001 ETH.
###Actual Result:
- The input value of 0.0000000001 ETH is less than $0.01 USD and is displayed without proper rounding.
- The receiving value is displayed in an incorrect format, such as 2.4712412341234e-7, without proper rounding.
Expected Result:
Potential solutions:
- Crypto values should be rounded so that the final decimal place always represents a value between $0.01 and $0.10 USD, ensuring that small values are displayed appropriately. OR
- The token value should be rounded to the "maximum number of decimal places" as specified in https://github.com/status-im/status-mobile/issues/18244
Examples:
- If the user enters a fiat value resulting in a token value with more than the allowed decimal places (e.g., 0.37 USD which equals 0.0001001... ETH), and taps the "show in token" button, the value in the input field should become 0.0001 ETH.)
- When ETH is priced at $365, four decimal places should be used for ETH because 0.0001 ETH = $0.036 USD, which is between $0.01 and $0.10 USD
@briansztamfater Should the swap transaction be included in the activity tab in the scope of this PR? Currently, swap transactions are not showing at all there.
Actual result:
Expected result:
https://www.figma.com/design/AD2JSKg0I8dZcylyiGa62O/Swap-for-Mobile?node-id=54-48281&node-type=INSTANCE&m=dev
blockedlabel can be removed, right?
yes. just removed it. thanx
@briansztamfater Should the swap transaction be included in the activity tab in the scope of this PR? Currently, swap transactions are not showing at all there.
Actual result:
Expected result:
https://www.figma.com/design/AD2JSKg0I8dZcylyiGa62O/Swap-for-Mobile?node-id=54-48281&node-type=INSTANCE&m=dev
Definitely not included in the scope of this PR. We have an issue for it #20345, and we should also check with the team how the changes in the Activity implementation will affect how we display swaps transactions.
Will take a look at issue 5 👍
@VolodLytvynenko issue 5 should be fixed 👍
@briansztamfater You mentioned earlier that if a user doesn't have a receiving token (in our case DAI), some errors might occur. Is this the issue shown on record?
https://github.com/user-attachments/assets/f53993da-74ae-4402-a71d-eb9f9e193e97
Logs:
@briansztamfater You mentioned earlier that if a user doesn't have a receiving token (in our case DAI), some errors might occur. Is this the issue shown on record?
dai.mp4
Logs:
@briansztamfater Facing this error even when DAI is present in account. I will share this user in DM
ISSUE 6: "undefined is not a function" error is shown after an attempt to swap ERC20 token
Steps:
- Select erc20 token during swap
- Tap "approve" button
Actual result:
Additional info:
Perhaps the issue is related to the fee. I tested a scenario where the user doesn't have enough ETH to cover the fee or has too little ETH, which could be causing this problem.
@VolodLytvynenko issue should be fixed now, seems I introduced the bug with the last fix 😅 Let me know how testing goes now!
