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

Cross chain swaps - tx submit #27262

Open
wants to merge 88 commits into
base: mb891-fetch-bridge-quotes
Choose a base branch
from

Conversation

infiniteflower
Copy link
Contributor

@infiniteflower infiniteflower commented Sep 18, 2024

Description

This PR implements the following:

  1. Submit bridge transaction for normal transactions
  2. Submit bridge transaction for native gas tokens that don't require approval
  3. Submit bridge transaction for ERC20s that require approval

Does not fully:

  1. Submit bridge transaction for smart transactions
    • You can submit an STX, but the status screens don't make the most sense right now. Looking to align them with how Swaps does it in a future PR.

Open in GitHub Codespaces

Related issues

Manual testing steps

Currently quote fetching is not wired up, as that depends on #27237 and #27731

So instead what you can do to get a quote is:

  1. Go to https://portfolio.metamask.io/bridge
  2. Open up devtools > Network tab
  3. Fetch a quote for your desired networks and tokens
  4. Filter the network logs for getQuote
  5. Copy the quote to ui/ducks/bridge/selectors.ts in the function getQuotes()

To execute the transactions

  1. Go to Extension Bridge
  2. In ui/pages/bridge/prepare/bridge-cta-button.tsx, comment out the checks for isTxSubmittable to enable the CTA button
  3. Click the button

Screenshots/Recordings

Before

After

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.

Copy link
Contributor

CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes.

@infiniteflower infiniteflower changed the base branch from develop to mb890-src-and-dest-asset-pickers-backup-0828 September 19, 2024 21:29
@infiniteflower infiniteflower changed the title Mb892 cross chain swap tx submit chore: cross chain swap tx submit Sep 19, 2024
@infiniteflower infiniteflower force-pushed the mb892-cross-chain-swap-tx-submit branch from 325a70a to a6d627c Compare October 1, 2024 18:33
@infiniteflower infiniteflower changed the base branch from mb890-src-and-dest-asset-pickers-backup-0828 to mb890-src-and-dest-asset-pickers-backup-0927 October 1, 2024 18:33
@micaelae micaelae force-pushed the mb890-src-and-dest-asset-pickers-backup-0927 branch 2 times, most recently from 448ce2a to 4971d09 Compare October 2, 2024 00:33
@infiniteflower infiniteflower force-pushed the mb892-cross-chain-swap-tx-submit branch from b433f88 to 2813f63 Compare October 2, 2024 20:43
@micaelae micaelae force-pushed the mb890-src-and-dest-asset-pickers-backup-0927 branch from 4971d09 to 52f9352 Compare October 2, 2024 23:34
infiniteflower added a commit to MetaMask/core that referenced this pull request Oct 3, 2024
## Explanation

<!--
Thanks for your contribution! Take a moment to answer these questions so
that reviewers have the information they need to properly understand
your changes:

* What is the current state of things and why does it need to change?
* What is the solution your changes offer and how does it work?
* Are there any changes whose purpose might not obvious to those
unfamiliar with the domain?
* If your primary goal was to update one package but you found you had
to update another one along the way, why did you do so?
* If you had to upgrade a dependency, why did you do so?
-->

This PR adds additional types to facilitate Bridge development in
Extension.

## References

<!--
Are there any issues that this pull request is tied to? Are there other
links that reviewers should consult to understand these changes better?

For example:

* Fixes #12345
* Related to #67890
-->

Related to: MetaMask/metamask-extension#27262

## Changelog

<!--
If you're making any consumer-facing changes, list those changes here as
if you were updating a changelog, using the template below as a guide.

(CATEGORY is one of BREAKING, ADDED, CHANGED, DEPRECATED, REMOVED, or
FIXED. For security-related issues, follow the Security Advisory
process.)

Please take care to name the exact pieces of the API you've added or
changed (e.g. types, interfaces, functions, or methods).

If there are any breaking changes, make sure to offer a solution for
consumers to follow once they upgrade to the changes.

Finally, if you're only making changes to development scripts or tests,
you may replace the template below with "None".
-->

### `@metamask/transaction-controller`

- ADDED: `bridgeApproval`, `bridge` types

## Checklist

- [x] I've updated the test suite for new or updated code as appropriate
- [ ] I've updated documentation (JSDoc, Markdown, etc.) for new or
updated code as appropriate
- [ ] I've highlighted breaking changes using the "BREAKING" category
above as appropriate

---------

Co-authored-by: Matthew Walsh <matthew.walsh@consensys.net>
@infiniteflower infiniteflower force-pushed the mb892-cross-chain-swap-tx-submit branch from 3c283a7 to 94365a1 Compare October 3, 2024 18:45
@micaelae micaelae force-pushed the mb890-src-and-dest-asset-pickers-backup-0927 branch from 1ee57c2 to 81fbdf1 Compare October 7, 2024 23:51
@infiniteflower infiniteflower force-pushed the mb892-cross-chain-swap-tx-submit branch from a37617b to 1d686bd Compare October 8, 2024 20:27
@micaelae micaelae force-pushed the mb890-src-and-dest-asset-pickers-backup-0927 branch 2 times, most recently from 9f11057 to 7c2f8e0 Compare October 9, 2024 17:04
@infiniteflower infiniteflower force-pushed the mb892-cross-chain-swap-tx-submit branch from b0e3d32 to d2d1d5a Compare October 9, 2024 17:45
@infiniteflower infiniteflower marked this pull request as ready for review October 9, 2024 18:02
@infiniteflower infiniteflower requested review from a team as code owners October 9, 2024 18:02
@micaelae micaelae force-pushed the mb890-src-and-dest-asset-pickers-backup-0927 branch from 7c2f8e0 to 3222e6d Compare October 9, 2024 18:03
@micaelae micaelae force-pushed the mb890-src-and-dest-asset-pickers-backup-0927 branch from 3222e6d to 6506bef Compare October 9, 2024 18:22
@infiniteflower infiniteflower force-pushed the mb892-cross-chain-swap-tx-submit branch from d2d1d5a to 6de5ea4 Compare October 9, 2024 18:56
@micaelae micaelae force-pushed the mb890-src-and-dest-asset-pickers-backup-0927 branch 2 times, most recently from d80b1c6 to 75afeab Compare October 10, 2024 17:42
@micaelae micaelae requested a review from a team as a code owner October 10, 2024 17:42
@micaelae micaelae force-pushed the mb890-src-and-dest-asset-pickers-backup-0927 branch 2 times, most recently from 78bcf71 to 403d594 Compare October 10, 2024 22:06
@micaelae micaelae force-pushed the mb891-fetch-bridge-quotes branch 2 times, most recently from a5688be to 0b78610 Compare October 21, 2024 22:25
@micaelae micaelae requested a review from a team as a code owner October 21, 2024 22:25
@micaelae micaelae force-pushed the mb891-fetch-bridge-quotes branch 7 times, most recently from 650bb36 to 3f91ec0 Compare October 23, 2024 23:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants