Skip to content

Commit

Permalink
fix: allow empty to field in can_build (#489)
Browse files Browse the repository at this point in the history
* fix can build

* fix
  • Loading branch information
klkvr authored Apr 9, 2024
1 parent 2439614 commit 5f74d4e
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions crates/network/src/ethereum/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -121,22 +121,22 @@ impl TransactionBuilder<Ethereum> for TransactionRequest {
// value and data may be None. If they are, they will be set to default.
// gas fields and nonce may be None, if they are, they will be populated
// with default values by the RPC server
self.to.is_some() && self.from.is_some()
self.from.is_some()
}

fn can_build(&self) -> bool {
// value and data may be none. If they are, they will be set to default
// values.

// chain_id and from may be none.
let common = self.to.is_some() && self.gas.is_some() && self.nonce.is_some();
let common = self.gas.is_some() && self.nonce.is_some();

let legacy = self.gas_price.is_some();
let eip2930 = legacy && self.access_list().is_some();

let eip1559 = self.max_fee_per_gas.is_some() && self.max_priority_fee_per_gas.is_some();

let eip4844 = eip1559 && self.sidecar.is_some();
let eip4844 = eip1559 && self.sidecar.is_some() && self.to.is_some();
common && (legacy || eip2930 || eip1559 || eip4844)
}

Expand Down

0 comments on commit 5f74d4e

Please sign in to comment.