Skip to content

Commit 2e18681

Browse files
authored
chore: Clean up docs for abi-decode & calldata-decode (#5211)
1 parent 885ca7b commit 2e18681

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

Diff for: cast/src/lib.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -1340,6 +1340,8 @@ impl SimpleCast {
13401340

13411341
/// Decodes abi-encoded hex input or output
13421342
///
1343+
/// When `input=true`, `calldata` string MUST not be prefixed with function selector
1344+
///
13431345
/// # Example
13441346
///
13451347
/// ```
@@ -1374,7 +1376,8 @@ impl SimpleCast {
13741376
}
13751377

13761378
/// Decodes calldata-encoded hex input or output
1377-
/// Similar to `abi_decode`, but does requires a function signature prefixed for "calldata"
1379+
///
1380+
/// Similar to `abi_decode`, but `calldata` string MUST be prefixed with function selector
13781381
///
13791382
/// # Example
13801383
///

Diff for: cli/src/opts/cast.rs

+6-2
Original file line numberDiff line numberDiff line change
@@ -443,6 +443,9 @@ pub enum Subcommands {
443443
Estimate(EstimateArgs),
444444

445445
/// Decode ABI-encoded input data.
446+
///
447+
/// Similar to `abi-decode --input`, but function selector MUST be prefixed in `calldata`
448+
/// string
446449
#[clap(visible_aliases = &["--calldata-decode","cdd"])]
447450
CalldataDecode {
448451
/// The function signature in the format `<name>(<in-types>)(<out-types>)`.
@@ -454,8 +457,9 @@ pub enum Subcommands {
454457

455458
/// Decode ABI-encoded input or output data.
456459
///
457-
/// Defaults to decoding output data. To decode input data pass --input or use cast
458-
/// --calldata-decode.
460+
/// Defaults to decoding output data. To decode input data pass --input.
461+
///
462+
/// When passing `--input`, function selector must NOT be prefixed in `calldata` string
459463
#[clap(name = "abi-decode", visible_alias = "ad")]
460464
AbiDecode {
461465
/// The function signature in the format `<name>(<in-types>)(<out-types>)`.

0 commit comments

Comments
 (0)