-
Notifications
You must be signed in to change notification settings - Fork 246
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
Feature: Joinable transaction fillers #426
Changes from all commits
adaef96
ec38e5d
247599c
1621849
9e009ca
d1a19c5
55ef5f3
a64b1c4
a76ecaf
d272290
935fd9b
021c1bd
c19aaf4
5f59ec0
49cf6a8
be9cec6
e6ae1b9
b4f22a6
8f732a9
5c26fa7
e40b1c8
f663dd8
ffef2ab
741eb02
cdb9f80
b1358ff
bc475a9
2a533c5
6beabc9
c9976b2
ca3197d
bc3bc80
8022cc8
7353f79
1c376d7
9401eac
0846652
a7295e5
90ba04c
fe0aa67
4ced66c
e21f8fe
fef56d4
52ce1dc
b48ff24
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
use std::ops::{Deref, DerefMut}; | ||
|
||
use alloy_consensus::BlobTransactionSidecar; | ||
use alloy_rpc_types::{TransactionRequest, WithOtherFields}; | ||
use alloy_rpc_types::{AccessList, TransactionRequest, WithOtherFields}; | ||
|
||
use crate::{ | ||
any::AnyNetwork, ethereum::build_unsigned, BuilderResult, Network, TransactionBuilder, | ||
|
@@ -96,18 +96,36 @@ impl TransactionBuilder<AnyNetwork> for WithOtherFields<TransactionRequest> { | |
self.deref_mut().set_gas_limit(gas_limit); | ||
} | ||
|
||
fn build_unsigned(self) -> BuilderResult<<AnyNetwork as Network>::UnsignedTx> { | ||
build_unsigned::<AnyNetwork>(self.inner) | ||
/// Get the EIP-2930 access list for the transaction. | ||
fn access_list(&self) -> Option<&AccessList> { | ||
self.deref().access_list() | ||
} | ||
|
||
/// Sets the EIP-2930 access list. | ||
fn set_access_list(&mut self, access_list: AccessList) { | ||
self.deref_mut().set_access_list(access_list) | ||
} | ||
|
||
fn get_blob_sidecar(&self) -> Option<&BlobTransactionSidecar> { | ||
self.deref().get_blob_sidecar() | ||
fn blob_sidecar(&self) -> Option<&BlobTransactionSidecar> { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. dropping the get_ prefix is good There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. matches the style of the rest of all the other methods |
||
self.deref().blob_sidecar() | ||
} | ||
|
||
fn set_blob_sidecar(&mut self, sidecar: BlobTransactionSidecar) { | ||
self.deref_mut().set_blob_sidecar(sidecar) | ||
} | ||
|
||
fn can_build(&self) -> bool { | ||
self.deref().can_build() | ||
} | ||
|
||
fn can_submit(&self) -> bool { | ||
self.deref().can_submit() | ||
} | ||
|
||
fn build_unsigned(self) -> BuilderResult<<AnyNetwork as Network>::UnsignedTx> { | ||
build_unsigned::<AnyNetwork>(self.inner) | ||
} | ||
|
||
async fn build<S: crate::NetworkSigner<AnyNetwork>>( | ||
self, | ||
signer: &S, | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,7 @@ use super::signer::NetworkSigner; | |
use crate::Network; | ||
use alloy_consensus::BlobTransactionSidecar; | ||
use alloy_primitives::{Address, Bytes, ChainId, TxKind, U256}; | ||
use alloy_rpc_types::AccessList; | ||
use futures_utils_wasm::impl_future; | ||
|
||
/// Error type for transaction builders. | ||
|
@@ -191,8 +192,20 @@ pub trait TransactionBuilder<N: Network>: Default + Sized + Send + Sync + 'stati | |
self | ||
} | ||
|
||
/// Get the EIP-2930 access list for the transaction. | ||
fn access_list(&self) -> Option<&AccessList>; | ||
|
||
/// Sets the EIP-2930 access list. | ||
fn set_access_list(&mut self, access_list: AccessList); | ||
|
||
/// Builder-pattern method for setting the access list. | ||
fn with_access_list(mut self, access_list: AccessList) -> Self { | ||
self.set_access_list(access_list); | ||
self | ||
} | ||
|
||
/// Gets the EIP-4844 blob sidecar of the transaction. | ||
fn get_blob_sidecar(&self) -> Option<&BlobTransactionSidecar>; | ||
fn blob_sidecar(&self) -> Option<&BlobTransactionSidecar>; | ||
|
||
/// Sets the EIP-4844 blob sidecar of the transaction. | ||
/// | ||
|
@@ -206,6 +219,14 @@ pub trait TransactionBuilder<N: Network>: Default + Sized + Send + Sync + 'stati | |
self | ||
} | ||
|
||
/// True if the builder contains all necessary information to be submitted | ||
/// to the `eth_sendTransaction` endpoint. | ||
fn can_submit(&self) -> bool; | ||
|
||
/// True if the builder contains all necessary information to be built into | ||
/// a valid transaction. | ||
fn can_build(&self) -> bool; | ||
Comment on lines
+222
to
+228
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. like |
||
|
||
/// Build an unsigned, but typed, transaction. | ||
fn build_unsigned(self) -> BuilderResult<N::UnsignedTx>; | ||
|
||
|
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.
nit, both layers + fillers in example?
and still thinking about the on_builtin naming separately, did you not like connect_?
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.
there are currently no layers because they were all converted to fillers 😅