This repository has been archived by the owner on Jan 11, 2024. It is now read-only.
FIX: Accept 'input' or 'data' or both in transaction request #460
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.
Equivalent of filecoin-project/lotus#11471
Introduces an
Eip1559TransactionRequestCompat
type next to ourTypedTransactionRequestCompat
which we use to deserialize JSON requests. It acceptsinput
ordata
, preferringinput
, before being mapped to theethers
type.Instead of adding both fields I used the approach in I found here.
I also tried with
#[serde(rename="input", alias = "data")]
but that does not accept duplicate fields.Eventually ended up with Raul's suggestion of adding
input
but usingflatten
to wrap the original, which requires the minimum amount of code.Also opened a PR in
ethers
but ended up only adding analias = "input"
to keep things simple. I think the trend is that clients will only send one value or the other, at least the double sending is being fixed inweb3.js
, so the added complexity of supporting both fields seems like an overkill. We can keep ourCompat
stuff to support both fields though.