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 more bridge fields to txMeta for Bridge #4918

Draft
wants to merge 9 commits into
base: main
Choose a base branch
from

Conversation

infiniteflower
Copy link
Contributor

@infiniteflower infiniteflower commented Nov 12, 2024

Explanation

This PR adds sourceChainId and destinationChainId to the TransactionMeta type.

This is needed for Bridge transactions. We track overall Bridge status through a new BridgeStatusController in Extension. However, that assumes that transactions have a txHash on the source chain that can be used as a reference. For smart transactions, a txHash is not returned immediately. Therefore, we need to attach some additional data to the txMeta so we can properly display information about the transaction even when there is no txHash.

References

Related to MetaMask/metamask-extension#27740

Changelog

@metamask/transaction-controller

  • ADDED: bridgeSteps, destinationChainId to the TransactionMeta type
  • ADDED: In addTransaction(), update the txMeta object through the swaps.meta field when it is a Bridge tx, similar to what happens when it's a Swap tx
  • ADDED: TransactionControllerTransactionNewBridgeApprovalEvent, TransactionControllerTransactionNewBridgeEvent events

Checklist

  • 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
  • I've prepared draft pull requests for clients and consumer packages to resolve any breaking changes

@infiniteflower infiniteflower changed the title feat: add sourceChainId and destinatonChainId to txMeta feat: add more bridge fields to txMeta Nov 14, 2024
@infiniteflower infiniteflower changed the title feat: add more bridge fields to txMeta feat: add more bridge fields to txMeta for Bridge Nov 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant