Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request enables consumers to use newer versions of
@ethereumjs/tx
(previouslyethereumjs-tx
). This enables support for typed transaction envelopes, and features built upon it such as optional access lists.Support for the oldest supported version of
ethereumjs-tx
prior to this change is maintained. I have not confirmed if this will work for all versions ofethereumjs-tx
/@ethereumjs/tx
between those two points.Challenges:
@ethereumjs/tx
defaults to immutable objects, which is great... however the previous version of thesignTransaction
method relied upon mutability. The immutability is opt-out but in an effort to allow for taking advantage of immutability at least in the user's domain (not in this repo), this converts immutable Transactions into mutable versions temporarily, then returns an object that is immutable, if the provided transaction object was immutable.@ethereumjs/tx
has a new 'Common' utility that sets things like chain and hardfork support. This is passed in the options object forTransactionFactory.fromTxData
. In order to not lock ourselves into having to pass this object around between the consumer and this package, the common options are lifted from the provided transaction object and reapplied to the copies created.ethereumjs-tx
and@ethereumjs/tx
have differing accessor methods and construction methods. to work through this I have split the implementation of these two paths up, keeping the most shared code as possible while also creating branches wherein we can rest assured we are dealing with the appropriate type of object.@ethereumjs/tx
as a result the test case uses a mutable object and stubs out many methods that would otherwise cause tests to fail. I will be following this up with a PR that changes the test structure to use a private key for the HDkey initialization and allows more appropriate levels of testing.