-
Notifications
You must be signed in to change notification settings - Fork 237
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: Add getters into TransactionResponse and update implementations #1328
feat: Add getters into TransactionResponse and update implementations #1328
Conversation
/// Input data | ||
#[doc(alias = "calldata")] | ||
fn input(&self) -> &Bytes; | ||
|
||
/// Transaction signature | ||
fn signature(&self) -> Option<Signature>; |
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.
@emhane Signature
comes from alloy-rpc-types-eth
which can't be imported network-primitives/Cargo.toml
due to a cyclic dependency since rpc-types-eth/Cargo.toml
already pulls in network-primitives.
Do you have a suggestion here?
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.
probably best to add signature as associated type to the trait
/// Input data | ||
#[doc(alias = "calldata")] | ||
fn input(&self) -> &Bytes; | ||
|
||
/// Transaction signature | ||
fn signature(&self) -> Option<Signature>; |
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.
probably best to add signature as associated type to the trait
@emhane I've updated this to use an associated type, feel free to merge if LGTY or happy to wait for a +1 from another reviewer |
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.
wdyt @klkvr
@@ -63,10 +64,24 @@ pub trait ReceiptResponse { | |||
|
|||
/// Transaction JSON-RPC response. | |||
pub trait TransactionResponse { |
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.
Is this now just Transaction
+ additional functions to get the block context?
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.
Yep, although I'm not entirely across the context. It looks similar to how ReceiptResponse
is a projection of the fields on a TransactionReceipt
. Happy to be guided by owners on this
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, this is now very similar to Transaction
trait, we can dedup those in a follow-up
another thing we can do is restrict the signature to |
Thanks @klkvr @mattsse @emhane! Can one of you kick off a merge if LGTY, happy to address in a follow up.
@mattsse |
imo, that would make sense but ideally we could phase this out entirely
|
probably will be nicest if we have the consensus ref #1316 |
agree, was thinking about this as well |
…alloy-rs#1328) * init * wip: fix signature import * associated type --------- Co-authored-by: garwah <garwah@garwah>
Closes #1297
Adds getters into the
TransactionResponse
trait and updates implementations accordingly.