-
-
Notifications
You must be signed in to change notification settings - Fork 239
fix: preserve transaction type of batched transactions #6056
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
base: main
Are you sure you want to change the base?
Conversation
@metamaskbot publish-preview |
Preview builds have been published. See these instructions for more information about preview builds. Expand for full list of packages and versions.
|
@@ -1722,6 +1722,9 @@ export type PublishBatchHookTransaction = { | |||
|
|||
/** Signed transaction data to publish. */ | |||
signedTx: Hex; | |||
|
|||
/** Type of the nested transaction. */ | |||
type?: TransactionType; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we need the type
here?
The intent of providing the id
is so the hook can require any specific transaction metadata it needs via the transaction controller state and that reference.
expect(publishBatchHook.mock.calls[0][0].transactions[0].type).toBe( | ||
TransactionType.swap, | ||
); | ||
expect(publishBatchHook.mock.calls[0][0].transactions[1].type).toBe( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rather than asserting the hook is called with the type, ideally the hook wouldn't know, and instead we could verify that addTransaction
is called multiple times with the correct types?
Explanation
When a batch of transactions with specific TransactionType values is submitted (example: bridgeApproval, swap, bridge), the txs get published with generic types like
contractInteraction
andapprove
, and the requested types are not preservedThe
type
values are needed in the swaps and bridge experiences in order to track and display accurate transaction statuses so they need to be propagatedReferences
Changelog
Checklist