-
Notifications
You must be signed in to change notification settings - Fork 245
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
feat: impl From<Transaction> for TransactionRequest
+ small type updates
#338
Conversation
impl From<Transaction> for TransactionRequest
+ small type updates
impl From<Transaction> for TransactionRequest { | ||
fn from(tx: Transaction) -> TransactionRequest { |
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.
this is definitely useful, for example,
eth_getTransaction
-> eth_call
so I think we want/need this.
The missing blob is also not problematic because this will be used mostly for calls.
and there's nothing we can do without the blob anyway
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.
lgtm,
pending @onbjerg
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.
lgtm
pending @prestwich @onbjerg
bed2e9d
to
47e349f
Compare
/// | ||
/// During this conversion data for [TransactionRequest::sidecar] is not populated as it is not | ||
/// part of [Transaction]. | ||
pub fn into_request(self) -> TransactionRequest { |
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.
any reason we have this instead of just the auto-impl'd Into
we get from From
?
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.
We wanted to have it documented on Transaction
Ref #338 (comment)
fc028c1
to
65b6391
Compare
Motivation
This was in ethers and is being used in foundry: https://github.com/foundry-rs/foundry/blob/master/crates/common/src/transactions.rs#L43
Transaction
does not include sidecar so this conversion is not losslessI've also updated several field types on
Transaction
so they matchTransactionRequest
types.Transaction::chain_id
changed to u64 to matchTransactionRequest
Transaction::access_list
changed to useAccessList
structTransaction::transaction_type
changed toU8
(Ethereum spec defines it as a number <=127, Optimism deposit transaction has type 126).PR Checklist