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

chore: disable non selectable bridge assets #20846

Merged
merged 3 commits into from
Jul 29, 2024
Merged

Conversation

J-Son89
Copy link
Contributor

@J-Son89 J-Son89 commented Jul 22, 2024

fixes: #20842

account page bottom sheet

home page bottom sheet

bridge page

To test:
check the bridge entry points,
wallet home long press on asset
account page long press on asset
bridge flow from account page cta

only a ETH and stable coins should be bridgeable.

@J-Son89 J-Son89 requested a review from ulisesmac July 22, 2024 15:37
@J-Son89 J-Son89 self-assigned this Jul 22, 2024
:stack-id :screen/wallet.accounts
:start-flow? true}
{:token-symbol token-symbol
:bridge-disabled? (not (send-utils/bridgeable? token-symbol))
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@ulisesmac - should this be done in a subscription instead? wdyt? 🤔

Copy link
Member

Choose a reason for hiding this comment

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

If I'm not mistaken, the sub :wallet/current-viewing-account-tokens-filtered (used in this view) depends on token-symbol already adds this boolean

https://github.com/status-im/status-mobile/pull/20846/files#diff-442712259612e50c55f46c1a8916e777155ff5e4964e457061af3d8388ef6f57R414

We just need to de-structure token-data and use it

Quick thoughts: Why do we not hide the option to bridge instead of disabling it?

Copy link
Contributor

Choose a reason for hiding this comment

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

@J-Son89 Both are fine but I'd prefer having it inside the subscription.

If it exists in the subscription, it'll be easier to be reused and the logic would be centralized.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

:wallet/current-viewing-account-tokens-filtere does, but it won't work for the home page.

I figured disabling is better as when the list is empty at least the user will see something on the page of assets to select / it doesn't look like assets are disappearing then.

@status-im-auto
Copy link
Member

status-im-auto commented Jul 22, 2024

Jenkins Builds

Click to see older builds (37)
Commit #️⃣ Finished (UTC) Duration Platform Result
✔️ f966429 #2 2024-07-22 15:50:28 ~8 min tests 📄log
✔️ f966429 #2 2024-07-22 15:50:40 ~9 min android 🤖apk 📲
✔️ f966429 #2 2024-07-22 15:51:45 ~10 min ios 📱ipa 📲
✔️ f966429 #2 2024-07-22 15:52:33 ~11 min android-e2e 🤖apk 📲
✔️ 40c7908 #3 2024-07-24 09:24:15 ~5 min tests 📄log
✔️ 40c7908 #3 2024-07-24 09:29:15 ~10 min ios 📱ipa 📲
✔️ 40c7908 #3 2024-07-24 09:29:28 ~10 min android-e2e 🤖apk 📲
✔️ 40c7908 #3 2024-07-24 09:29:30 ~10 min android 🤖apk 📲
✔️ 8eea7e3 #4 2024-07-24 13:18:10 ~4 min tests 📄log
✔️ 8eea7e3 #5 2024-07-24 13:19:50 ~6 min android-e2e 🤖apk 📲
✔️ 8eea7e3 #5 2024-07-24 13:20:27 ~6 min android 🤖apk 📲
✔️ 8eea7e3 #4 2024-07-24 13:30:59 ~17 min ios 📱ipa 📲
df57ed5 #5 2024-07-25 15:55:34 ~3 min tests 📄log
4520668 #6 2024-07-25 16:00:04 ~3 min tests 📄log
✔️ 4520668 #7 2024-07-25 16:03:32 ~6 min android 🤖apk 📲
✔️ 4520668 #7 2024-07-25 16:03:48 ~6 min android-e2e 🤖apk 📲
✔️ 4520668 #6 2024-07-25 16:05:49 ~8 min ios 📱ipa 📲
✔️ 9f9d9fa #7 2024-07-25 16:12:55 ~5 min tests 📄log
✔️ 9f9d9fa #8 2024-07-25 16:14:28 ~7 min android-e2e 🤖apk 📲
✔️ 9f9d9fa #8 2024-07-25 16:14:28 ~7 min android 🤖apk 📲
✔️ 9f9d9fa #7 2024-07-25 16:19:00 ~12 min ios 📱ipa 📲
e52b0b2 #8 2024-07-25 16:41:06 ~2 min tests 📄log
✔️ e52b0b2 #9 2024-07-25 16:44:32 ~6 min android 🤖apk 📲
✔️ e52b0b2 #9 2024-07-25 16:45:24 ~7 min android-e2e 🤖apk 📲
✔️ e52b0b2 #8 2024-07-25 16:48:42 ~10 min ios 📱ipa 📲
✔️ cf8032a #9 2024-07-25 16:55:37 ~4 min tests 📄log
✔️ cf8032a #10 2024-07-25 16:59:29 ~8 min android-e2e 🤖apk 📲
✔️ cf8032a #10 2024-07-25 16:59:35 ~8 min android 🤖apk 📲
✔️ cf8032a #9 2024-07-25 17:01:52 ~11 min ios 📱ipa 📲
✔️ e6515de #10 2024-07-26 10:40:58 ~4 min tests 📄log
✔️ e6515de #11 2024-07-26 10:42:44 ~6 min android-e2e 🤖apk 📲
✔️ e6515de #11 2024-07-26 10:44:07 ~7 min android 🤖apk 📲
✔️ e6515de #10 2024-07-26 10:46:56 ~10 min ios 📱ipa 📲
✔️ 2abdd4f #12 2024-07-26 13:45:50 ~13 min ios 📱ipa 📲
✔️ 2abdd4f #12 2024-07-26 13:54:15 ~22 min tests 📄log
✔️ 2abdd4f #13 2024-07-26 13:56:49 ~24 min android 🤖apk 📲
✔️ 2abdd4f #13 2024-07-26 13:58:03 ~26 min android-e2e 🤖apk 📲
Commit #️⃣ Finished (UTC) Duration Platform Result
✔️ f75a6fb #14 2024-07-26 14:39:24 ~19 min android-e2e 🤖apk 📲
✔️ f75a6fb #13 2024-07-26 14:44:32 ~24 min tests 📄log
✔️ f75a6fb #14 2024-07-26 14:46:14 ~26 min android 🤖apk 📲
✔️ f75a6fb #14 2024-07-29 08:32:21 ~15 min ios 📱ipa 📲
✔️ db1ba33 #14 2024-07-29 09:48:51 ~3 min tests 📄log
✔️ db1ba33 #15 2024-07-29 09:52:36 ~7 min android-e2e 🤖apk 📲
✔️ db1ba33 #15 2024-07-29 09:54:00 ~9 min android 🤖apk 📲
✔️ db1ba33 #15 2024-07-29 09:55:55 ~11 min ios 📱ipa 📲
✔️ db1ba33 #16 2024-07-29 10:15:05 ~12 min ios 📱ipa 📲

@@ -558,6 +558,8 @@
(def ^:const bridge-name-erc-1155-transfer "ERC1155Transfer")
(def ^:const bridge-name-hop "Hop")

(def ^:const bridge-assets ["ETH" "USDT" "USDC" "DAI"])
Copy link
Member

Choose a reason for hiding this comment

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

It's good to use set here as the data(token symbols) will be distinct.

Additionally, are we planning to add these supported tokens as well?

status-im/status-desktop#15697 (comment)

Suggested change
(def ^:const bridge-assets ["ETH" "USDT" "USDC" "DAI"])
(def ^:const bridge-assets #{"ETH" "USDT" "USDC" "USDC.e" "DAI" "HOP" "SNX" "sUSD" "rETH" "MAGIC"})

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think we do not need these tokens just yet as they are unstable for the moment.
cc @churik

Copy link
Contributor

Choose a reason for hiding this comment

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

Is this the default list of bridge assets? (if so, could be renamed to default-bridge-assets)


(defn bridgeable?
[token-symbol]
(some #(= % token-symbol) constants/bridge-assets))
Copy link
Member

Choose a reason for hiding this comment

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

Perf suggestion: If we update the constants/bridge-assets to set, then updating this some to contains? will be better.

Suggested change
(some #(= % token-symbol) constants/bridge-assets))
(contains? constants/bridge-assets token-symbol))

:stack-id :screen/wallet.accounts
:start-flow? true}
{:token-symbol token-symbol
:bridge-disabled? (not (send-utils/bridgeable? token-symbol))
Copy link
Member

Choose a reason for hiding this comment

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

If I'm not mistaken, the sub :wallet/current-viewing-account-tokens-filtered (used in this view) depends on token-symbol already adds this boolean

https://github.com/status-im/status-mobile/pull/20846/files#diff-442712259612e50c55f46c1a8916e777155ff5e4964e457061af3d8388ef6f57R414

We just need to de-structure token-data and use it

Quick thoughts: Why do we not hide the option to bridge instead of disabling it?

Copy link
Contributor

@ulisesmac ulisesmac left a comment

Choose a reason for hiding this comment

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

Looks good 👍 👍

Comment on lines 29 to 33
:state (cond
disabled? :disabled
(= preselected-token-symbol token-symbol)
:selected
:else nil)}]))
Copy link
Contributor

Choose a reason for hiding this comment

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

cond doesn't need an :else clause, it returns nil when nothing matches.

:stack-id :screen/wallet.accounts
:start-flow? true}
{:token-symbol token-symbol
:bridge-disabled? (not (send-utils/bridgeable? token-symbol))
Copy link
Contributor

Choose a reason for hiding this comment

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

@J-Son89 Both are fine but I'd prefer having it inside the subscription.

If it exists in the subscription, it'll be easier to be reused and the logic would be centralized.

@IvanBelyakoff
Copy link

Hey, @J-Son89 we don't want to support bridging all tokens that Hop + Celer support for now?

@churik
Copy link
Member

churik commented Jul 23, 2024

@IvanBelyakoff they are not working, and there is no confidence when Celer will start working inside our app. I don't think that it might happen any time soon (i.e. in couple of weeks) and we should release the app sooner (referring to this conversation )

Hopefully in the future when we can add more providers, we can expand the list.

@churik
Copy link
Member

churik commented Jul 23, 2024

@J-Son89 ping me when it is ready to test

@@ -411,6 +411,7 @@
(fn [[account networks] [_ query chain-ids]]
(let [tokens (map (fn [token]
(assoc token
:bridge-disabled? (not (send-utils/bridgeable? (:symbol token)))
Copy link
Contributor

Choose a reason for hiding this comment

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

I would suggest to use either of the namings bridge-disabled? or bridgeable? as they mean the same thing

@@ -46,3 +50,4 @@
:key-fn :symbol
:on-scroll-to-index-failed identity
:render-fn asset-component}]))

Copy link
Contributor

Choose a reason for hiding this comment

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

Empty line

@@ -558,6 +558,8 @@
(def ^:const bridge-name-erc-1155-transfer "ERC1155Transfer")
(def ^:const bridge-name-hop "Hop")

(def ^:const bridge-assets ["ETH" "USDT" "USDC" "DAI"])
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this the default list of bridge assets? (if so, could be renamed to default-bridge-assets)

@@ -18,6 +18,7 @@
:padding-vertical 8
:border-radius 12
:height 56
:opacity (when (= state :disabled) 0.3)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this is in design system, just adding it now.

@status-im-auto
Copy link
Member

71% of end-end tests have passed

Total executed tests: 7
Failed tests: 1
Expected to fail tests: 1
Passed tests: 5
IDs of failed tests: 727229 
IDs of expected to fail tests: 727232 

Failed tests (1)

Click to expand
  • Rerun failed tests

  • Class TestWalletMultipleDevice:

    1. test_wallet_send_eth, id: 727229

    Device 2: Find `Text` by `xpath`: `//android.view.ViewGroup[@content-desc='container']/android.widget.TextView[@text='Ether']/../android.widget.TextView[3]`
    Device 2: `Text` is `0.01419 ETH`

    critical/test_wallet.py:156: in test_wallet_send_eth
        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))]))
     Sender balance is not updated on Etherscan, it is 0.4839 but expected to be 0.484
    



    Expected to fail tests (1)

    Click to expand

    Class TestWalletOneDevice:

    1. test_wallet_add_remove_watch_only_account, id: 727232

    Device 1: Find EditBox by accessibility id: add-address-to-watch
    Device 1: Type 0x8d2413447ff297d30bdc475f6d5cb00254685aae to EditBox

    critical/test_wallet.py:249: in test_wallet_add_remove_watch_only_account
        self.wallet_view.add_watch_only_account(address=address_to_watch, account_name=new_account_name)
    ../views/wallet_view.py:163: in add_watch_only_account
        self.account_has_activity_label.wait_for_visibility_of_element()
    ../views/base_element.py:147: in wait_for_visibility_of_element
        raise TimeoutException(
     Device 1: Text by accessibility id:`account-has-activity` is not found on the screen after wait_for_visibility_of_element 
    

    [[Missing networks in account address, https://github.com//issues/20166]]

    Device sessions

    Passed tests (5)

    Click to expand

    Class TestWalletOneDevice:

    1. test_wallet_add_remove_regular_account, id: 727231
    Device sessions

    Class TestCommunityOneDeviceMerged:

    1. test_restore_multiaccount_with_waku_backup_remove_switch, id: 703133
    Device sessions

    2. test_community_copy_and_paste_message_in_chat_input, id: 702742
    Device sessions

    Class TestOneToOneChatMultipleSharedDevicesNewUi:

    1. test_1_1_chat_non_latin_messages_stack_update_profile_photo, id: 702745
    Device sessions

    Class TestWalletMultipleDevice:

    1. test_wallet_send_asset_from_drawer, id: 727230

    @churik
    Copy link
    Member

    churik commented Jul 24, 2024

    @J-Son89 did we leave the opportunity for the user to select an unbridgable token?
    Check out the video:

    IMG_7704.MP4

    I'd expect that we can't select these tokens, but it is already way better than not show anything at all

    @churik churik self-assigned this Jul 24, 2024
    @J-Son89
    Copy link
    Contributor Author

    J-Son89 commented Jul 24, 2024

    @J-Son89 did we leave the opportunity for the user to select an unbridgable token? Check out the video:

    IMG_7704.MP4
    I'd expect that we can't select these tokens, but it is already way better than not show anything at all

    sorry @churik, that is my basic mis step. I left that part out foolishly 😓
    I will adjust!

    @J-Son89 J-Son89 force-pushed the jc/disable-bridges branch 2 times, most recently from e0416e9 to 8eea7e3 Compare July 24, 2024 13:13
    @J-Son89
    Copy link
    Contributor Author

    J-Son89 commented Jul 24, 2024

    sorry @churik - my brain didn't initially comprehend that was an expectation 😅

    disabled assets should not be clickable now.

    @churik
    Copy link
    Member

    churik commented Jul 24, 2024

    @J-Son89 :)

    assets are disabled in Send flow as well:

    FILE.2024-07-24.16.33.20.mp4

    Expected: that these assets are disable only in Brodge flow

    Copy link
    Contributor

    @mmilad75 mmilad75 left a comment

    Choose a reason for hiding this comment

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

    Great job man 👍

    @J-Son89 J-Son89 force-pushed the jc/disable-bridges branch 5 times, most recently from e52b0b2 to cf8032a Compare July 25, 2024 16:50
    @J-Son89
    Copy link
    Contributor Author

    J-Son89 commented Jul 26, 2024

    @churik this pr should be ready now :)

    @churik churik added this to the 2.30.0 Beta milestone Jul 29, 2024
    @churik
    Copy link
    Member

    churik commented Jul 29, 2024

    Amazing work, thank you @J-Son89 !!!

    @J-Son89 J-Son89 merged commit 1f5bb57 into develop Jul 29, 2024
    5 checks passed
    @J-Son89 J-Son89 deleted the jc/disable-bridges branch July 29, 2024 10:02
    ilmotta added a commit that referenced this pull request Jul 30, 2024
    Revisions from develop:
    
    - 59ceddb develop origin/develop fix(wallet): fix bridge transactions (#20902)
    - 99ccbc3 Cover wallet send events with tests Part 2 #20411 #20533 (#20721)
    - 8c2d539 Enabling WalletConnect feature flag (#20906)
    - 67c83b1 fix(wallet): remove edit routes button in bridging (#20874)
    - 11a84ba feat(wallet): disable complex routing (#20901)
    - 1f5bb57 chore(wallet): disable bridging on unsupported tokens (#20846)
    - 4586f80 Add toggle in advanced settings for mobile data
    - 55c620e fix: create password for small screen (#20645)
    - 525609f Wallet Activity: transactions are not sorted by time #20808 (#20862)
    - 9065395 chore(settings): Disable telemetry option (#20881)
    - d27ab75 fix_:display group message using the new ui (#20787)
    - c6a1db6 ci: enable split apks & build only for arm64-v8a (#20683)
    - 73777e0 Ensure keycard account can send transaction after upgrading from v1 to v2 #20552 (#20845)
    - a6d3fc3 [#20524] fix: the missed keypairs are shown in the key pair list screen (#20888)
    - a671c70 fix broken screen and navigation when syncing fails (#20887)
    - a45991b 🥅 Filter connected dapps based on testnet mode, reject proposals and requests gracefully (#20799)
    - 2e9fa22 feat: wallet router v2 (#20631)
    - 737d8c4 rename sub to fix error when requesting to join community (#20868)
    - 3aa7e10 Sync process is blocked on Enabled notifications screen (#20883)
    - c1d2d44 perf: Fix app freeze after login (#20729)
    - 0fed811 e2e: updated testnet switching and added one test into smoke
    - 53c35cb fix(wallet): Linear gradient exception on invalid colors for watched account cards (#20854)
    - be82365 chore(settings)_: Remove testnet toggle from legacy advanced settings (#20875)
    - eae8a65 feat(wallet)_: Add beta info box in activity tab (#20873)
    - fe54a25 fix: not clearing network & web3-wallet on logout (#20886)
    - 15a4219 Reject wallet-connect request by dragging the modal down (#20763) (#20836)
    - 2ffbdac WalletConnect show expired toast (#20857)
    - 402eb83 fix Issue with scrolling WalletConnect transaction on Android (#20867)
    - ff88049 Fix WalletConnect header alignment on Android (#20860)
    - cee2124 WalletConnect no internet edge-cases (#20826)
    - 60ad7c8 chore(tests): New match-strict? cljs.test directive (#20825)
    - 4989c92 fix_: Adding own address as saved addresses (#20839)
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Projects
    Archived in project
    Development

    Successfully merging this pull request may close these issues.

    Limit the asset selection for bridge for ETH and stablecoins
    10 participants