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
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion crates/cast/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ alloy-signer.workspace = true
alloy-sol-types.workspace = true
alloy-transport.workspace = true
alloy-ens = { workspace = true, features = ["provider"] }
alloy-eips.workspace = true

op-alloy-flz.workspace = true
op-alloy-consensus = { workspace = true, features = ["alloy-compat"] }
Expand Down Expand Up @@ -98,4 +99,4 @@ mimalloc = ["foundry-cli/mimalloc"]
tracy-allocator = ["foundry-cli/tracy-allocator"]
aws-kms = ["foundry-wallets/aws-kms"]
gcp-kms = ["foundry-wallets/gcp-kms"]
isolate-by-default = ["foundry-config/isolate-by-default"]
isolate-by-default = ["foundry-config/isolate-by-default"]
5 changes: 5 additions & 0 deletions crates/cast/src/args.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ use crate::{
};
use alloy_consensus::transaction::{Recovered, SignerRecoverable};
use alloy_dyn_abi::{DynSolValue, ErrorExt, EventExt};
use alloy_eips::eip7702::SignedAuthorization;
use alloy_ens::{namehash, ProviderEnsExt};
use alloy_primitives::{eip191_hash_message, hex, keccak256, Address, B256};
use alloy_provider::Provider;
Expand Down Expand Up @@ -723,6 +724,10 @@ pub async fn run_command(args: CastArgs) -> Result<()> {
sh_println!("{}", serde_json::to_string_pretty(&tx)?)?;
}
}
CastSubcommand::RecoverAuthority { auth } => {
let auth: SignedAuthorization = serde_json::from_str(&auth).unwrap();
sh_println!("{}", auth.recover_authority()?)?;
}
CastSubcommand::TxPool { command } => command.run().await?,
CastSubcommand::DAEstimate(cmd) => {
cmd.run().await?;
Expand Down
4 changes: 4 additions & 0 deletions crates/cast/src/opts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1070,6 +1070,10 @@ pub enum CastSubcommand {
#[command(visible_aliases = &["dt", "decode-tx"])]
DecodeTransaction { tx: Option<String> },

/// Recovery an EIP-7702 authority from a Authorization JSON string.
#[command(visible_aliases = &["decode-auth"])]
RecoverAuthority { auth: String },

/// Extracts function selectors and arguments from bytecode
#[command(visible_alias = "sel")]
Selectors {
Expand Down
15 changes: 15 additions & 0 deletions crates/cast/tests/cli/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2852,3 +2852,18 @@ casttest!(tx_raw_opstack_deposit, |_prj, cmd| {

"#]]);
});

casttest!(recover_authority, |_prj, cmd| {
let auth = r#"{
"chainId": "0x1",
"address": "0xb684710e6d5914ad6e64493de2a3c424cc43e970",
"nonce": "0x3dc1",
"yParity": "0x1",
"r": "0x2f15ba55009fcd3682cd0f9c9645dd94e616f9a969ba3f1a5a2d871f9fe0f2b4",
"s": "0x53c332a83312d0b17dd4c16eeb15b1ff5223398b14e0a55c70762e8f3972b7a5"
}"#;
cmd.args(["recover-authority", auth]).assert_success().stdout_eq(str![[r#"
0x17816E9A858b161c3E37016D139cf618056CaCD4

"#]]);
});