Commit c2a4312
authored
feat: support type 4 transactions (#5285)
## Explanation
Support EIP-7702 / type 4 transactions including `authorizationList` via
the `TransactionController`.
Specifically:
- Upgrade `ethereumjs/tx` and `ethereumjs/common`.
- Add `setCode` to `TransactionEnvelopeType`.
- Add `authorizationList` to `TransactionParams`.
- Complete and sign all authorizations using `KeyringController` before
signing transaction.
- Prevent type 4 transactions if origin is not `ORIGIN_METAMASK`.
- Validate `authorizationList` property before approval request.
- Centralise prepare and serialization logic into `prepare.ts` utils.
- Encapsulate all EIP-7702 specific logic in new `eip7702.ts` util.
_Currently using a local messenger action type for the signing. To be
replaced once available in the `KeyringController`._
## References
Fixes [#4095](MetaMask/MetaMask-planning#4095)
## Changelog
### `@metamask/transaction-controller`
- **ADDED**: Add `setCode` to `TransactionEnvelopeType`.
- **ADDED**: Add `authorizationList` to `TransactionParams`.
- **CHANGED**: Bump `ethereumjs/tx` to `^5.4.0`.
- **CHANGED**: Bump `ethereumjs/common` to `^4.4.0`.
## Checklist
- [x] I've updated the test suite for new or updated code as appropriate
- [x] I've updated documentation (JSDoc, Markdown, etc.) for new or
updated code as appropriate
- [x] I've highlighted breaking changes using the "BREAKING" category
above as appropriate
- [x] I've prepared draft pull requests for clients and consumer
packages to resolve any breaking changes1 parent 1fbade9 commit c2a4312
File tree
16 files changed
+1075
-282
lines changed- packages/transaction-controller
- src
- gas-flows
- utils
16 files changed
+1075
-282
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
575 | 575 | | |
576 | 576 | | |
577 | 577 | | |
578 | | - | |
579 | 578 | | |
580 | | - | |
581 | | - | |
582 | | - | |
583 | | - | |
| 579 | + | |
584 | 580 | | |
585 | 581 | | |
586 | 582 | | |
| |||
612 | 608 | | |
613 | 609 | | |
614 | 610 | | |
615 | | - | |
616 | | - | |
617 | | - | |
618 | 611 | | |
619 | 612 | | |
620 | 613 | | |
| |||
673 | 666 | | |
674 | 667 | | |
675 | 668 | | |
676 | | - | |
677 | | - | |
678 | | - | |
679 | 669 | | |
680 | 670 | | |
681 | 671 | | |
| |||
764 | 754 | | |
765 | 755 | | |
766 | 756 | | |
767 | | - | |
768 | | - | |
769 | | - | |
770 | | - | |
771 | | - | |
772 | | - | |
773 | | - | |
774 | 757 | | |
775 | 758 | | |
776 | 759 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
21 | | - | |
| 21 | + | |
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
47 | 47 | | |
48 | 48 | | |
49 | 49 | | |
50 | | - | |
51 | | - | |
| 50 | + | |
| 51 | + | |
52 | 52 | | |
53 | 53 | | |
54 | 54 | | |
| |||
0 commit comments