Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 15 additions & 2 deletions crates/cast/bin/cmd/mktx.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use foundry_cli::{
};
use foundry_common::ens::NameOrAddress;
use foundry_config::Config;
use std::str::FromStr;
use std::{path::PathBuf, str::FromStr};

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

/// The path of blob data to be sent.
#[arg(
long,
value_name = "BLOB_DATA_PATH",
conflicts_with = "legacy",
requires = "blob",
help_heading = "Transaction options"
)]
path: Option<PathBuf>,

#[command(flatten)]
eth: EthereumOpts,
}
Expand All @@ -55,7 +65,9 @@ pub enum MakeTxSubcommands {

impl MakeTxArgs {
pub async fn run(self) -> Result<()> {
let Self { to, mut sig, mut args, command, tx, eth } = self;
let Self { to, mut sig, mut args, command, tx, path, eth } = self;

let blob_data = if let Some(path) = path { Some(std::fs::read(path)?) } else { None };

let code = if let Some(MakeTxSubcommands::Create {
code,
Expand Down Expand Up @@ -88,6 +100,7 @@ impl MakeTxArgs {
.with_tx_kind(tx_kind)
.with_code_sig_and_args(code, sig, args)
.await?
.with_blob_data(blob_data)?
.build(from)
.await?;

Expand Down
8 changes: 7 additions & 1 deletion crates/cast/bin/cmd/send.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,13 @@ pub struct SendTxArgs {
eth: EthereumOpts,

/// The path of blob data to be sent.
#[arg(long, value_name = "BLOB_DATA_PATH", conflicts_with = "legacy", requires = "blob")]
#[arg(
long,
value_name = "BLOB_DATA_PATH",
conflicts_with = "legacy",
requires = "blob",
help_heading = "Transaction options"
)]
path: Option<PathBuf>,
}

Expand Down