Skip to content

Commit 1bfbaff

Browse files
authored
fix(cast): correctly handle legacy chains (#8420)
fix: correctly handle legacy chains
1 parent 309a2f9 commit 1bfbaff

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

crates/cast/bin/tx.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ where
9494

9595
let chain = utils::get_chain(config.chain, &provider).await?;
9696
let etherscan_api_key = config.get_etherscan_api_key(Some(chain));
97+
let legacy = tx_opts.legacy || chain.is_legacy();
9798

9899
if let Some(gas_limit) = tx_opts.gas_limit {
99100
tx.set_gas_limit(gas_limit.to());
@@ -104,14 +105,14 @@ where
104105
}
105106

106107
if let Some(gas_price) = tx_opts.gas_price {
107-
if tx_opts.legacy {
108+
if legacy {
108109
tx.set_gas_price(gas_price.to());
109110
} else {
110111
tx.set_max_fee_per_gas(gas_price.to());
111112
}
112113
}
113114

114-
if !tx_opts.legacy {
115+
if !legacy {
115116
if let Some(priority_fee) = tx_opts.priority_gas_price {
116117
tx.set_max_priority_fee_per_gas(priority_fee.to());
117118
}
@@ -128,7 +129,7 @@ where
128129
Ok(Self {
129130
provider,
130131
tx,
131-
legacy: tx_opts.legacy || chain.is_legacy(),
132+
legacy,
132133
blob: tx_opts.blob,
133134
chain,
134135
etherscan_api_key,

0 commit comments

Comments
 (0)