Skip to content

Commit 4bc2989

Browse files
authored
chore: use trait fn for setting both input fields (#12426)
1 parent c2abd2c commit 4bc2989

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

crates/cast/src/tx.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use alloy_network::{
99
};
1010
use alloy_primitives::{Address, Bytes, TxKind, U256, hex};
1111
use alloy_provider::Provider;
12-
use alloy_rpc_types::{AccessList, Authorization, TransactionInput, TransactionRequest};
12+
use alloy_rpc_types::{AccessList, Authorization, TransactionInputKind, TransactionRequest};
1313
use alloy_serde::WithOtherFields;
1414
use alloy_signer::Signer;
1515
use alloy_transport::TransportError;
@@ -317,8 +317,7 @@ impl<P: Provider<AnyNetwork>> CastTxBuilder<P, InputState> {
317317
self.tx.set_kind(self.state.kind);
318318

319319
// we set both fields to the same value because some nodes only accept the legacy `data` field: <https://github.com/foundry-rs/foundry/issues/7764#issuecomment-2210453249>
320-
let input = Bytes::copy_from_slice(&self.state.input);
321-
self.tx.input = TransactionInput { input: Some(input.clone()), data: Some(input) };
320+
self.tx.set_input_kind(self.state.input.clone(), TransactionInputKind::Both);
322321

323322
self.tx.set_from(from);
324323
self.tx.set_chain_id(self.chain.id());
@@ -443,6 +442,7 @@ impl<P, S> CastTxBuilder<P, S>
443442
where
444443
P: Provider<AnyNetwork>,
445444
{
445+
/// Populates the blob sidecar for the transaction if any blob data was provided.
446446
pub fn with_blob_data(mut self, blob_data: Option<Vec<u8>>) -> Result<Self> {
447447
let Some(blob_data) = blob_data else { return Ok(self) };
448448

0 commit comments

Comments
 (0)