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

feat: add ability to send erc20 tokens #18481

Merged
merged 1 commit into from
Jan 16, 2024
Merged

Conversation

briansztamfater
Copy link
Member

@briansztamfater briansztamfater commented Jan 13, 2024

fixes #18413

Summary

As a continuation of #18473 which adds support for sending ERC721 tokens, this PR enables sending ERC20 tokens, for example STT in Goerli, or SNT in mainnet.

Platforms

  • Android
  • iOS

Areas that maybe impacted

Functional
  • wallet / transactions

Steps to test

  • Login
  • Open wallet
  • Select an account
  • Select "Send" option
  • Enter an address
  • Select an ERC20 token in the Asset list such as STT
  • Input any valid amount
  • Check transaction confirmation screen is showing correct information
  • Slide to execute transaction
  • Verify "Sending..." page is shown and that the transaction is executed correctly (compare in blockchain explorer such as Etherscan)

status: ready

@status-im-auto
Copy link
Member

status-im-auto commented Jan 13, 2024

Jenkins Builds

Commit #️⃣ Finished (UTC) Duration Platform Result
✔️ 6d9da65 #2 2024-01-13 03:30:14 ~6 min tests 📄log
✔️ 6d9da65 #2 2024-01-13 03:31:21 ~7 min ios 📱ipa 📲
✔️ 6d9da65 #2 2024-01-13 03:31:32 ~7 min android 🤖apk 📲
✔️ 6d9da65 #2 2024-01-13 03:31:55 ~7 min android-e2e 🤖apk 📲
✔️ 60ce2c7 #4 2024-01-16 14:56:02 ~5 min tests 📄log
✔️ 60ce2c7 #4 2024-01-16 14:57:24 ~6 min android-e2e 🤖apk 📲
✔️ 60ce2c7 #4 2024-01-16 14:58:37 ~8 min android 🤖apk 📲
✔️ 60ce2c7 #4 2024-01-16 15:02:06 ~11 min ios 📱ipa 📲

@status-im-auto
Copy link
Member

85% of end-end tests have passed

Total executed tests: 48
Failed tests: 4
Expected to fail tests: 3
Passed tests: 41
IDs of failed tests: 703133,702948,702936,702947 
IDs of expected to fail tests: 703503,702808,703629 

Failed tests (4)

Click to expand
  • Rerun failed tests

  • Class TestActivityMultipleDevicePR:

    1. test_navigation_jump_to, id: 702936

    Device 2: Find `Text` by `xpath`: `//android.view.ViewGroup[@content-desc='chat-item']//android.widget.TextView[contains(@text,'https://status.app/c/')]`
    Device 2: Wait for element `Button` for max 120s and click when it is available

    Test setup failed: activity_center/test_activity_center.py:270: in prepare_devices
        self.community_2.join_community()
    ../views/chat_view.py:435: in join_community
        self.join_button.wait_and_click(120)
    ../views/base_element.py:96: in wait_and_click
        self.wait_for_visibility_of_element(sec)
    ../views/base_element.py:139: in wait_for_visibility_of_element
        raise TimeoutException(
     Device 2: Button by accessibility id:`show-request-to-join-screen-button` is not found on the screen after wait_for_visibility_of_element
    



    Device sessions

    2. test_activity_center_reply_read_unread_delete_filter_swipe, id: 702947

    Test setup failed: activity_center/test_activity_center.py:270: in prepare_devices
        self.community_2.join_community()
    ../views/chat_view.py:435: in join_community
        self.join_button.wait_and_click(120)
    ../views/base_element.py:96: in wait_and_click
        self.wait_for_visibility_of_element(sec)
    ../views/base_element.py:139: in wait_for_visibility_of_element
        raise TimeoutException(
     Device 2: Button by accessibility id:`show-request-to-join-screen-button` is not found on the screen after wait_for_visibility_of_element
    



    Class TestCommunityOneDeviceMerged:

    1. test_restore_multiaccount_with_waku_backup_remove_switch, id: 703133

    Device 1: Find Button by accessibility id: show-profiles
    Device 1: Tap on found: Button

    critical/chats/test_public_chat_browsing.py:276: in test_restore_multiaccount_with_waku_backup_remove_switch
        self.errors.verify_no_errors()
    base_test_case.py:191: in verify_no_errors
        pytest.fail('\n '.join([self.errors.pop(0) for _ in range(len(self.errors))]))
     zQ3...dWXh5 was not restored as a contact from waku backup!
    E    zQ3...Vacac was not restored as a contact from waku backup!
    E    admin_open was not restored from waku-backup!!
    E    member_open was not restored from waku-backup!!
    E    admin_closed was not restored from waku-backup!!
    E    member_closed was not restored from waku-backup!!
    



    Device sessions

    Class TestCommunityMultipleDeviceMergedTwo:

    1. test_community_hashtag_links_to_community_channels, id: 702948

    Device 1: Click until ChatMessageInput by accessibility id: chat-message-input will be presented
    Device 1: Sending message 'this message should be visible to the user before joining'

    critical/chats/test_public_chat_browsing.py:1008: in test_community_hashtag_links_to_community_channels
        self.channel_1.send_message(control_message_general_chat)
    ../views/chat_view.py:1011: in send_message
        self.chat_message_input.wait_for_element(wait_chat_input_sec)
    ../views/base_element.py:121: in wait_for_element
        raise TimeoutException(
     Device `1`: `ChatMessageInput` by` accessibility id`: `chat-message-input` is not found on the screen after wait_for_element
    



    Device sessions

    Expected to fail tests (3)

    Click to expand

    Class TestCommunityOneDeviceMerged:

    1. test_community_discovery, id: 703503

    Test is not run, e2e blocker  
    

    [[reason: [NOTRUN] Curated communities not loading, https://github.com//issues/17852]]

    Class TestGroupChatMultipleDeviceMergedNewUI:

    1. test_group_chat_offline_pn, id: 702808

    Device 3: Looking for a message by text: message from old member
    Device 3: Looking for a message by text: message from new member

    critical/chats/test_group_chat.py:324: in test_group_chat_offline_pn
        self.errors.verify_no_errors()
    base_test_case.py:191: in verify_no_errors
        pytest.fail('\n '.join([self.errors.pop(0) for _ in range(len(self.errors))]))
     Messages PN was not fetched from offline 
    

    [[Data delivery issue]]

    Device sessions

    Class TestCommunityMultipleDeviceMergedTwo:

    1. test_community_join_when_node_owner_offline, id: 703629

    Device 2: Tap on found: Button
    Device 2: Looking for community: 'open community'

    critical/chats/test_public_chat_browsing.py:1178: in test_community_join_when_node_owner_offline
        self.errors.verify_no_errors()
    base_test_case.py:191: in verify_no_errors
        pytest.fail('\n '.join([self.errors.pop(0) for _ in range(len(self.errors))]))
     open community is not listed inside Pending communities tab
    E    Joined status is not displayed
    E    open community is not listed inside Joined communities tab 
    

    [[Can't join a community if admin goes offline, https://github.com//issues/17678]]

    Device sessions

    Passed tests (41)

    Click to expand

    Class TestCommunityMultipleDeviceMerged:

    1. test_community_several_images_send_reply, id: 703194
    Device sessions

    2. test_community_one_image_send_reply, id: 702859
    Device sessions

    3. test_community_emoji_send_copy_paste_reply, id: 702840
    Device sessions

    4. test_community_mark_all_messages_as_read, id: 703086
    Device sessions

    5. test_community_contact_block_unblock_offline, id: 702894
    Device sessions

    6. test_community_edit_delete_message_when_offline, id: 704615
    Device sessions

    7. test_community_message_delete, id: 702839
    Device sessions

    8. test_community_message_send_check_timestamps_sender_username, id: 702838
    Device sessions

    9. test_community_links_with_previews_github_youtube_twitter_gif_send_enable, id: 702844
    Device sessions

    10. test_community_message_edit, id: 702843
    Device sessions

    11. test_community_unread_messages_badge, id: 702841
    Device sessions

    Class TestOneToOneChatMultipleSharedDevicesNewUiTwo:

    1. test_1_1_chat_delete_via_long_press_relogin, id: 702784
    Device sessions

    2. test_1_1_chat_is_shown_message_sent_delivered_from_offline, id: 702783
    Device sessions

    3. test_1_1_chat_mute_chat, id: 703496
    Device sessions

    Class TestCommunityMultipleDeviceMergedTwo:

    1. test_community_markdown_support, id: 702809
    Device sessions

    2. test_community_mentions_push_notification, id: 702786
    Device sessions

    3. test_community_leave, id: 702845
    Device sessions

    Class TestOneToOneChatMultipleSharedDevicesNewUi:

    1. test_1_1_chat_emoji_send_reply_and_open_link, id: 702782
    Device sessions

    2. test_1_1_chat_text_message_delete_push_disappear, id: 702733
    Device sessions

    3. test_1_1_chat_push_emoji, id: 702813
    Device sessions

    4. test_1_1_chat_non_latin_messages_stack_update_profile_photo, id: 702745
    Device sessions

    5. test_1_1_chat_edit_message, id: 702855
    Device sessions

    6. test_1_1_chat_send_image_save_and_share, id: 703391
    Device sessions

    7. test_1_1_chat_pin_messages, id: 702731
    Device sessions

    8. test_1_1_chat_message_reaction, id: 702730
    Device sessions

    Class TestGroupChatMultipleDeviceMergedNewUI:

    1. test_group_chat_pin_messages, id: 702732
    Device sessions

    2. test_group_chat_mute_chat, id: 703495
    Device sessions

    3. test_group_chat_send_image_save_and_share, id: 703297
    Device sessions

    4. test_group_chat_reactions, id: 703202
    Device sessions

    5. test_group_chat_join_send_text_messages_push, id: 702807
    Device sessions

    Class TestActivityCenterContactRequestMultipleDevicePR:

    1. test_add_contact_field_validation, id: 702777
    Device sessions

    2. test_activity_center_contact_request_accept_swipe_mark_all_as_read, id: 702851
    Device sessions

    3. test_activity_center_contact_request_decline, id: 702850
    Device sessions

    Class TestActivityMultipleDevicePRTwo:

    1. test_activity_center_mentions, id: 702957
    Device sessions

    2. test_activity_center_admin_notification_accept_swipe, id: 702958
    Device sessions

    Class TestDeepLinksOneDevice:

    1. test_links_open_universal_links_from_chat, id: 704613
    Device sessions

    2. test_links_deep_links, id: 702775
    Device sessions

    Class TestCommunityOneDeviceMerged:

    1. test_community_copy_and_paste_message_in_chat_input, id: 702742
    Device sessions

    2. test_community_undo_delete_message, id: 702869
    Device sessions

    3. test_community_navigate_to_channel_when_relaunch, id: 702846
    Device sessions

    4. test_community_mute_community_and_channel, id: 703382
    Device sessions

    gas-fees]} route
    eip-1559-enabled? (:eip-1559-enabled gas-fees)
    {:keys [gas-price max-fee-per-gas-medium
    max-priority-fee-per-gas]} gas-fees
    transfer-tx (cond-> {:From from-address
    :To (or token-address to-address)
    :Gas (money/to-hex gas-amount)
    :Value amount-out
    :Value (when eth-transfer? amount-out)
    Copy link
    Contributor

    Choose a reason for hiding this comment

    The reason will be displayed to describe this comment to others. Learn more.

    is eth-transfer specific to eth? or should this be token-transfer?

    Copy link
    Member Author

    Choose a reason for hiding this comment

    The reason will be displayed to describe this comment to others. Learn more.

    Yes, it is specific to ETH (or native token), for the rest of tokens we use erc20-transfer?

    :to-address to-address
    :from-asset token-id
    :to-asset token-id
    :amount-out (if eth-transfer? (:amount-out route) "0x0")})
    Copy link
    Contributor

    Choose a reason for hiding this comment

    The reason will be displayed to describe this comment to others. Learn more.

    perhaps "0x0" should be a named const? e.g one-in-hex

    @VolodLytvynenko VolodLytvynenko self-assigned this Jan 15, 2024
    @pavloburykh
    Copy link
    Contributor

    Hey @briansztamfater! Thanx for the PR. One question: I see that this PR is based on feat/send-collectible-events-4 branch, which has not been tested yet and in theory it might have changes/fixes in case the bugs are found. Maybe we should better combine these features into one PR to test them in one common branch? WDYT?

    @pavloburykh
    Copy link
    Contributor

    Hey @briansztamfater! Thanx for the PR. One question: I see that this PR is based on feat/send-collectible-events-4 branch, which has not been tested yet and in theory it might have changes/fixes in case the bugs are found. Maybe we should better combine these features into one PR to test them in one common branch? WDYT?

    In case if this is not a good idea, I guess we better test (https://github.com/status-im/status-mobile/tree/feat/send-collectible-events-4) first and after it will be merged we should base current PR brach against the develop.

    @briansztamfater
    Copy link
    Member Author

    Hey @briansztamfater! Thanx for the PR. One question: I see that this PR is based on feat/send-collectible-events-4 branch, which has not been tested yet and in theory it might have changes/fixes in case the bugs are found. Maybe we should better combine these features into one PR to test them in one common branch? WDYT?

    Hey @pavloburykh ! I have no strong opinion on this, I can adapt to whatever is better for you. The base PR contains major changes and as they are modifying the same part of the code I decided to use that branch as base, to avoid conflicts when merging it

    @pavloburykh
    Copy link
    Contributor

    pavloburykh commented Jan 15, 2024

    Hey @pavloburykh ! I have no strong opinion on this, I can adapt to whatever is better for you. The base PR contains major changes and as they are modifying the same part of the code I decided to use that branch as base, to avoid conflicts when merging it

    We are currently kinda blocked with testing https://github.com/status-im/status-mobile/tree/feat/send-collectible-events-4 because we don't have a good way to get collectibles on testnet. Therefore we cannot test sending properly.

    So we can test current PR with sending erc20 tokens but as far as understand we cannot merge it until https://github.com/status-im/status-mobile/tree/feat/send-collectible-events-4 is tested.

    @VolodLytvynenko
    Copy link
    Contributor

    VolodLytvynenko commented Jan 15, 2024

    @briansztamfater Thank you for PR. Here is a found issue:

    ISSUE 1: [Android] The buttons on sending page does not responds

    Steps:

    1. Select any tokens to send
    2. Slide to execute transaction
    3. Tap 'done' or [x] buttons on 'Sending' page

    Actual result:

    'done' or [x] buttons does not close the 'sending' page

    Untitled.mp4

    Expected result:

    After 'done' or [x] buttons are tapped the 'sending' page should be closed

    ENV:

    Real device: Pixel 7a, Android 14

    Logs:

    Status-debug-logs.zip

    @J-Son89
    Copy link
    Contributor

    J-Son89 commented Jan 15, 2024

    @briansztamfater Thank you for PR. Here is a found issue:

    ISSUE 1: [Android] The buttons on sending page does not responds

    Steps:

    1. Select any tokens to send

    2. Slide to execute transaction

    3. Tap 'done' or [x] buttons on 'Sending' page

    Actual result:

    'done' or [x] buttons does not close the 'sending' page

    Untitled.mp4

    Expected result:

    After 'done' or [x] buttons are tapped the 'sending' page should be closed

    ENV:

    Real device: Pixel 7a, Android 14

    Logs:

    Status-debug-logs.zip

    That is a separate issue and I have addressed in a pr I opened today 👌

    @briansztamfater briansztamfater force-pushed the feat/send-collectible-events-4 branch from d655588 to 4cc796a Compare January 16, 2024 14:32
    Base automatically changed from feat/send-collectible-events-4 to develop January 16, 2024 14:48
    Signed-off-by: Brian Sztamfater <brian@status.im>
    @briansztamfater briansztamfater merged commit 455a739 into develop Jan 16, 2024
    6 checks passed
    @briansztamfater briansztamfater deleted the feat/send-erc20-tokens branch January 16, 2024 15:02
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Projects
    Archived in project
    Archived in project
    Development

    Successfully merging this pull request may close these issues.

    Wallet: Add support for sending STT (Status Test Token)
    7 participants