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: wire up bridge input actions [METABRIDGE-866] #25813

Closed
wants to merge 24 commits into from

Conversation

micaelae
Copy link
Member

@micaelae micaelae commented Jul 12, 2024

Description

This change adds controller and redux methods for managing bridge page input fields (networks, src/dest chain, token, amounts)

Open in GitHub Codespaces

Related issues

Fixes: https://consensyssoftware.atlassian.net/browse/METABRIDGE-866

Manual testing steps

  1. Run extension locally with BRIDGE_USE_DEV_APIS=1
  2. Click on Bridge button
  3. Network tab should show requests for src tokens and topAssets

Screenshots/Recordings

Before

Screenshot 2024-07-12 at 3 44 34 PM

After

No visual changes
Screenshot 2024-07-12 at 3 44 34 PM

Pre-merge author checklist

Pre-merge reviewer checklist

  • I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed).
  • I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots.

@micaelae micaelae requested a review from a team as a code owner July 12, 2024 22:31
@micaelae micaelae force-pushed the mb866-bridge-input-actions branch from 3a22d69 to 21b3f54 Compare July 12, 2024 22:54
@micaelae micaelae changed the title chore: wire up bridge input actions chore: wire up bridge input actions [METABRIDGE-866] Jul 15, 2024
@micaelae micaelae changed the base branch from mb867-bridge-feature-flagged-route to mb867-bridge-feature-flagged-route-e2e-test July 15, 2024 23:29
@micaelae micaelae force-pushed the mb867-bridge-feature-flagged-route-e2e-test branch from 3662d50 to 235fd33 Compare July 15, 2024 23:30
@micaelae micaelae force-pushed the mb866-bridge-input-actions branch from 21b3f54 to a74b678 Compare July 16, 2024 02:21
@micaelae micaelae changed the base branch from mb867-bridge-feature-flagged-route-e2e-test to mb867-bridge-feature-flagged-route July 16, 2024 02:21
@micaelae micaelae requested a review from a team as a code owner July 16, 2024 02:21
@micaelae micaelae force-pushed the mb867-bridge-feature-flagged-route branch from 0b673a9 to eccc944 Compare July 18, 2024 20:55
@micaelae micaelae requested a review from a team as a code owner July 18, 2024 20:55
@micaelae micaelae changed the base branch from mb867-bridge-feature-flagged-route to mb867-bridge-feature-flagged-route-e2e-test July 18, 2024 22:24
@micaelae micaelae force-pushed the mb867-bridge-feature-flagged-route-e2e-test branch from 3cfba29 to 7d640ae Compare July 18, 2024 22:27
@micaelae micaelae force-pushed the mb866-bridge-input-actions branch from a74b678 to b41d339 Compare July 22, 2024 23:10
Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

PR Summary

This pull request introduces controller and Redux methods for managing bridge page input fields, enhancing the bridge functionality by allowing dynamic updates based on user input.

  • app/scripts/controllers/bridge.ts: Added methods to fetch and update tokens and top assets for selected networks.
  • ui/ducks/bridge/actions.ts: Introduced actions to set source and destination chains, ensuring Redux state sync.
  • ui/ducks/bridge/selectors.ts: Added new selectors for managing bridge state, leveraging reselect for memoization.
  • ui/hooks/bridge/useBridging.ts: Updated hook to use currentProviderConfig for bridging functionality.
  • test/e2e/tests/bridge/constants.ts: Added feature flags for allowed source and destination networks.

16 file(s) reviewed, no comment(s)
Edit PR Review Bot Settings

@micaelae micaelae force-pushed the mb866-bridge-input-actions branch from b41d339 to 7eb09c0 Compare July 23, 2024 23:14
Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

PR Summary

(updates since last review)

This pull request introduces controller and Redux methods for managing bridge page input fields, enhancing the bridge functionality by allowing dynamic updates based on user input.

  • app/scripts/controllers/bridge.ts: Added methods to fetch and update tokens and top assets for selected networks.
  • ui/ducks/bridge/actions.ts: Introduced actions to set source and destination chains, ensuring Redux state sync.
  • ui/ducks/bridge/selectors.ts: Added new selectors for managing bridge state, leveraging reselect for memoization.
  • ui/hooks/bridge/useBridging.ts: Updated hook to use currentProviderConfig for bridging functionality.
  • test/e2e/tests/bridge/constants.ts: Added feature flags for allowed source and destination networks.

25 file(s) reviewed, no comment(s)
Edit PR Review Bot Settings

@micaelae micaelae force-pushed the mb866-bridge-input-actions branch from 7eb09c0 to 3c05d7c Compare July 24, 2024 01:04
Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

PR Summary

(updates since last review)

This pull request introduces controller and Redux methods for managing bridge page input fields, enhancing the bridge functionality by allowing dynamic updates based on user input.

  • app/scripts/controllers/bridge.ts: Added methods to fetch and update tokens and top assets for selected networks.
  • test/e2e/tests/bridge/constants.ts: Introduced new feature flags for source and destination network allowlists.
  • test/e2e/tests/metrics/state-snapshots/errors-after-init-opt-in-background-state.json: Updated BridgeController state with new properties for tokens and top assets.
  • test/e2e/tests/metrics/state-snapshots/errors-after-init-opt-in-ui-state.json: Added new properties to bridgeState for managing network and token data.
  • test/e2e/tests/metrics/state-snapshots/errors-before-init-opt-in-background-state.json: Similar updates as the errors-after-init file, ensuring consistency in state management.

6 file(s) reviewed, no comment(s)
Edit PR Review Bot Settings

Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

PR Summary

(updates since last review)

This pull request introduces controller and Redux methods for managing bridge page input fields, enhancing the bridge functionality by allowing dynamic updates based on user input.

  • test/e2e/tests/bridge/bridge-test-utils.ts: Added mock server response for the portfolio bridge endpoint to ensure proper handling in e2e tests.
  • test/e2e/tests/swap-send/swap-send-test-utils.ts: Introduced new utility functions to support Swap and Send page's end-to-end tests, enhancing test coverage and robustness.

2 file(s) reviewed, no comment(s)
Edit PR Review Bot Settings

@metamaskbot
Copy link
Collaborator

Builds ready [353ab3b]
Page Load Metrics (134 ± 141 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint641401002110
domContentLoaded96026136
load391413134294141
domInteractive96026136
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: -6.27 KiB (-0.19%)
  • ui: 9.22 KiB (0.12%)
  • common: 12.61 KiB (0.18%)

Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

PR Summary

(updates since last review)

This pull request introduces controller and Redux methods for managing bridge page input fields, enhancing the bridge functionality by allowing dynamic updates based on user input.

  • app/scripts/controllers/bridge.ts: Added methods for fetching and setting bridge feature flags, source/destination tokens, and top assets.
  • ui/ducks/bridge/actions.ts: Introduced new Redux actions for managing bridge input fields and interacting with the background controller.
  • ui/hooks/bridge/useBridging.ts: Enhanced the useBridging hook to handle bridge experience based on network and user settings.
  • test/e2e/tests/bridge/bridge-test-utils.ts: Added mock server response for the portfolio bridge endpoint to ensure proper handling in e2e tests.
  • ui/pages/bridge/index.tsx: Introduced the CrossChainSwap component to integrate the bridge feature into the application.

272 file(s) reviewed, 1 comment(s)
Edit PR Review Bot Settings

const { chainId } = network;
if (!isProviderConfig(network)) {
// TODO add new network and set it as active using upsertNetworkConfiguration
} else if (isProviderConfig(network) && network.id) {
Copy link

Choose a reason for hiding this comment

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

Style: Redundant check for isProviderConfig

@micaelae micaelae force-pushed the mb866-bridge-input-actions branch from 353ab3b to 85a352b Compare July 25, 2024 01:35
@micaelae micaelae changed the base branch from mb867-bridge-feature-flagged-route-e2e-test to mb866-bridge-controller-v2 July 25, 2024 01:41
@micaelae micaelae force-pushed the mb866-bridge-controller-v2 branch from f155cae to d035314 Compare July 25, 2024 01:46
@micaelae micaelae force-pushed the mb866-bridge-input-actions branch from 85a352b to b6447a1 Compare July 25, 2024 01:46
Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

PR Summary

(updates since last review)

This pull request introduces controller and Redux methods for managing bridge page input fields, enhancing the bridge functionality by allowing dynamic updates based on user input.

  • app/scripts/controllers/bridge/bridge-controller.ts: Introduced a new BridgeController class to manage bridge state and actions.
  • ui/ducks/bridge/actions.ts: Added Redux actions for setting source and destination chains.
  • test/e2e/tests/bridge/bridge-test-utils.ts: Updated mock server setup for bridge API endpoints.
  • ui/pages/bridge/index.tsx: Integrated useBridging hook into CrossChainSwap component.
  • app/scripts/lib/setupSentry.js: Updated Sentry state with new bridge-related properties.

32 file(s) reviewed, 1 comment(s)
Edit PR Review Bot Settings

const { chainId } = network;
if (!isProviderConfig(network)) {
// TODO add new network and set it as active using upsertNetworkConfiguration
} else if (isProviderConfig(network) && network.id) {
Copy link

Choose a reason for hiding this comment

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

Style: Redundant check for isProviderConfig.

Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

PR Summary

(updates since last review)

This pull request introduces controller and Redux methods for managing bridge page input fields, enhancing the bridge functionality by allowing dynamic updates based on user input.

  • app/scripts/controllers/bridge/bridge-controller.ts: Added methods for selecting source and destination networks, fetching and setting top assets and tokens.
  • ui/ducks/bridge/actions.ts: Introduced new actions for setting source and destination chains.
  • test/e2e/tests/bridge/bridge-test-utils.ts: Updated mock server setup to handle new bridge API endpoints.
  • ui/pages/bridge/index.tsx: Integrated useBridging hook into CrossChainSwap component.
  • app/scripts/metamask-controller.js: Added new bridge input actions to the MetaMask controller.

29 file(s) reviewed, 1 comment(s)
Edit PR Review Bot Settings

const { chainId } = network;
if (!isProviderConfig(network)) {
// TODO add new network and set it as active using upsertNetworkConfiguration
} else if (isProviderConfig(network) && network.id) {
Copy link

Choose a reason for hiding this comment

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

Style: Redundant check for isProviderConfig.

@metamaskbot
Copy link
Collaborator

Builds ready [b6447a1]
Page Load Metrics (84 ± 11 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint852911264421
domContentLoaded116435157
load47128842311
domInteractive116435157
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 7.06 KiB (0.21%)
  • ui: 9.25 KiB (0.12%)
  • common: 1.48 KiB (0.02%)

Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

PR Summary

(updates since last review)

This pull request introduces controller and Redux methods for managing bridge page input fields, enhancing the bridge functionality by allowing dynamic updates based on user input.

  • test/e2e/default-fixture.js: Updated bridgeFeatureFlags with network IDs '0x1', '0xa', and '0xe708'.
  • test/e2e/fixture-builder.js: Added withBridgeControllerDefaultState method to initialize BridgeController state.
  • test/e2e/tests/bridge/bridge-test-utils.ts: Added method to set default state for BridgeController and a TODO for future improvements.
  • test/e2e/tests/metrics/state-snapshots/errors-before-init-opt-in-background-state.json: Added srcNetworkAllowlist and destNetworkAllowlist properties.
  • test/e2e/tests/metrics/state-snapshots/errors-before-init-opt-in-ui-state.json: Updated bridgeFeatureFlags with specific network allowlists.

5 file(s) reviewed, no comment(s)
Edit PR Review Bot Settings

@metamaskbot
Copy link
Collaborator

Builds ready [e3d2cfd]
Page Load Metrics (162 ± 165 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint733001205125
domContentLoaded106431136
load411656162344165
domInteractive106431136
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 7.1 KiB (0.21%)
  • ui: 9.25 KiB (0.12%)
  • common: 1.48 KiB (0.02%)

@micaelae micaelae force-pushed the mb866-bridge-controller-v2 branch 2 times, most recently from cfece3b to 23d035d Compare August 12, 2024 22:25
@micaelae micaelae force-pushed the mb866-bridge-controller-v2 branch 4 times, most recently from 65c14a6 to 7d62780 Compare August 14, 2024 22:00
@micaelae micaelae closed this Aug 14, 2024
@micaelae micaelae deleted the mb866-bridge-input-actions branch August 14, 2024 22:09
@github-actions github-actions bot locked and limited conversation to collaborators Aug 14, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants