From dd3709b819d8b27b722127f9d37d71d3ec4922eb Mon Sep 17 00:00:00 2001 From: Sushi Date: Mon, 14 Feb 2022 18:47:00 +0530 Subject: [PATCH] feat(cast): implementing cast call/send
<0xCalldata> --- cast/src/lib.rs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/cast/src/lib.rs b/cast/src/lib.rs index 108eb4527ec0..256f02f9aad5 100644 --- a/cast/src/lib.rs +++ b/cast/src/lib.rs @@ -276,6 +276,9 @@ where let func = if sig.contains('(') { get_func(sig)? + } else if sig.starts_with("0x") { + // if only calldata is provided, returning a dummy function + get_func("x()")? } else { get_func_etherscan( sig, @@ -286,7 +289,13 @@ where ) .await? }; - let data = encode_args(&func, &args)?; + + let data = if sig.starts_with("0x") { + hex::decode(strip_0x(sig))? + } else { + encode_args(&func, &args)? + }; + tx.set_data(data.into()); Some(func) } else {