Skip to content

feat: add swap+send type#4298

Merged
BZahory merged 6 commits intomainfrom
add-swap-and-send-type
May 21, 2024
Merged

feat: add swap+send type#4298
BZahory merged 6 commits intomainfrom
add-swap-and-send-type

Conversation

@BZahory
Copy link
Copy Markdown
Contributor

@BZahory BZahory commented May 21, 2024

Explanation

What is the current state of things and why does it need to change?

With MetaMask/metamask-extension#23703, we will be implementing a new type of transaction, swap+send – a swap targeting the recipient. To properly track this transaction, we will need a new transaction type with new properties.

What is the solution your changes offer and how does it work?

We add a new swapAndSend transaction type with properties that track the source+destination tokens, as well as the recipient.

Are there any changes whose purpose might not obvious to those unfamiliar with the domain?

We include certain swap properties that we may not use initially (e.g., swapTokenValue, swapMetaData) in case we add more parity with the swaps functionality over time.

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?

The TransactionType enum was abstracted to this library rather than the Extension.

If you had to upgrade a dependency, why did you do so?

N/A

References

MB-843

MetaMask/metamask-extension#23703 (MetaMask/metamask-extension#24429 latest in merge train targeting that branch)

Changelog

@metamask/transaction-controller

  • ADDED: swapAndSend type
  • ADDED: updateSwapAndSendTransaction()
  • ADDED: TransactionMetaBase properties: destinationTokenAmount, sourceTokenAddress, sourceTokenAmount, sourceTokenDecimals, swapAndSendRecipient

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

@BZahory BZahory requested a review from a team May 21, 2024 15:11
@BZahory BZahory marked this pull request as draft May 21, 2024 15:15
@BZahory BZahory force-pushed the add-swap-and-send-type branch from 0cc7de2 to ea30346 Compare May 21, 2024 18:39
micaelae
micaelae previously approved these changes May 21, 2024
@BZahory BZahory marked this pull request as ready for review May 21, 2024 20:07
@BZahory BZahory merged commit 9ef4b26 into main May 21, 2024
@BZahory BZahory deleted the add-swap-and-send-type branch May 21, 2024 20:53
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.

2 participants