Skip to content

Commit 1bae886

Browse files
fix(cast): mktx: add missing --path argument for blob txs (#8483)
Co-authored-by: Matthias Seitz <[email protected]>
1 parent e436daa commit 1bae886

File tree

2 files changed

+22
-3
lines changed

2 files changed

+22
-3
lines changed

crates/cast/bin/cmd/mktx.rs

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use foundry_cli::{
1010
};
1111
use foundry_common::ens::NameOrAddress;
1212
use foundry_config::Config;
13-
use std::str::FromStr;
13+
use std::{path::PathBuf, str::FromStr};
1414

1515
/// CLI arguments for `cast mktx`.
1616
#[derive(Debug, Parser)]
@@ -33,6 +33,16 @@ pub struct MakeTxArgs {
3333
#[command(flatten)]
3434
tx: TransactionOpts,
3535

36+
/// The path of blob data to be sent.
37+
#[arg(
38+
long,
39+
value_name = "BLOB_DATA_PATH",
40+
conflicts_with = "legacy",
41+
requires = "blob",
42+
help_heading = "Transaction options"
43+
)]
44+
path: Option<PathBuf>,
45+
3646
#[command(flatten)]
3747
eth: EthereumOpts,
3848
}
@@ -55,7 +65,9 @@ pub enum MakeTxSubcommands {
5565

5666
impl MakeTxArgs {
5767
pub async fn run(self) -> Result<()> {
58-
let Self { to, mut sig, mut args, command, tx, eth } = self;
68+
let Self { to, mut sig, mut args, command, tx, path, eth } = self;
69+
70+
let blob_data = if let Some(path) = path { Some(std::fs::read(path)?) } else { None };
5971

6072
let code = if let Some(MakeTxSubcommands::Create {
6173
code,
@@ -88,6 +100,7 @@ impl MakeTxArgs {
88100
.with_tx_kind(tx_kind)
89101
.with_code_sig_and_args(code, sig, args)
90102
.await?
103+
.with_blob_data(blob_data)?
91104
.build(from)
92105
.await?;
93106

crates/cast/bin/cmd/send.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,13 @@ pub struct SendTxArgs {
5757
eth: EthereumOpts,
5858

5959
/// The path of blob data to be sent.
60-
#[arg(long, value_name = "BLOB_DATA_PATH", conflicts_with = "legacy", requires = "blob")]
60+
#[arg(
61+
long,
62+
value_name = "BLOB_DATA_PATH",
63+
conflicts_with = "legacy",
64+
requires = "blob",
65+
help_heading = "Transaction options"
66+
)]
6167
path: Option<PathBuf>,
6268
}
6369

0 commit comments

Comments
 (0)