Skip to content

feat: cross chain swaps - tx submit#27262

Merged
infiniteflower merged 93 commits intodevelopfrom
mb892-cross-chain-swap-tx-submit
Nov 21, 2024
Merged

feat: cross chain swaps - tx submit#27262
infiniteflower merged 93 commits intodevelopfrom
mb892-cross-chain-swap-tx-submit

Conversation

@infiniteflower
Copy link
Copy Markdown
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

Open in GitHub Codespaces

Related issues

Manual testing steps

  1. Go to Bridge
  2. Fill in source/dest token and amounts
  3. Get a quote
  4. Execute Bridge

Screenshots/Recordings

Before

After

Screen.Recording.2024-11-08.at.11.06.12.AM.mov

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.

@github-actions
Copy link
Copy Markdown
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 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
@infiniteflower infiniteflower added the team-bridge-deprecated DEPRECATED: please use "team-swaps-and-bridge" instead label Oct 9, 2024
@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
@metamaskbot
Copy link
Copy Markdown
Collaborator

Builds ready [496fa98]
Page Load Metrics (2139 ± 91 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint32925001955544261
domContentLoaded18412525210918589
load18462546213919091
domInteractive31297565627
backgroundConnect777242010
firstReactRender563901167235
getState431781043115
initialActions01000
loadScripts13621911158614670
setupStore68415199
uiStartup211434762532324156
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: -6.42 KiB (-0.11%)
  • ui: 11.63 KiB (0.15%)
  • common: 9.61 KiB (0.12%)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Minor, I love these modular hooks, but a benefit of having them in separate files is to be able to test them individually also.

if (networkAndAccountSupports1559) {
const { estimatedBaseFeeGwei = '0' } = networkGasFeeEstimates;
const hexEstimatedBaseFee = decGWEIToHexWEI(estimatedBaseFeeGwei) as Hex;
const txGasFeeEstimates = await getTransaction1559GasFeeEstimates(
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

❤️

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

release-12.9.0 Issue or pull request that will be included in release 12.9.0 team-bridge-deprecated DEPRECATED: please use "team-swaps-and-bridge" instead

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

4 participants