Skip to content

Commit f86a66e

Browse files
authored
fix: check for auth when deriving legacy (#10619)
* fix: check for auth when deriving legacy * fmt
1 parent 3e1c72b commit f86a66e

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

crates/cast/src/tx.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,7 @@ pub struct InputState {
138138
pub struct CastTxBuilder<P, S> {
139139
provider: P,
140140
tx: WithOtherFields<TransactionRequest>,
141+
/// Whether the transaction should be sent as a legacy transaction.
141142
legacy: bool,
142143
blob: bool,
143144
auth: Option<CliAuthorizationList>,
@@ -157,7 +158,8 @@ impl<P: Provider<AnyNetwork>> CastTxBuilder<P, InitState> {
157158
let chain = utils::get_chain(config.chain, &provider).await?;
158159
let etherscan_api_version = config.get_etherscan_api_version(Some(chain));
159160
let etherscan_api_key = config.get_etherscan_api_key(Some(chain));
160-
let legacy = tx_opts.legacy || chain.is_legacy();
161+
// mark it as legacy if requested or the chain is legacy and no 7702 is provided.
162+
let legacy = tx_opts.legacy || (chain.is_legacy() && tx_opts.auth.is_none());
161163

162164
if let Some(gas_limit) = tx_opts.gas_limit {
163165
tx.set_gas_limit(gas_limit.to());

0 commit comments

Comments
 (0)