foundry icon indicating copy to clipboard operation
foundry copied to clipboard

feat(`cast`): consolidate conversion commands

Open 0xClandestine opened this issue 1 month ago • 10 comments

Component

Cast

Describe the feature you would like

Motivation

Cast is getting bloated with excessive conversion commands, increasing cognitive load when trying to remember/find the right one.

Proposal

Create a cast convert subcommand to group all conversion-related commands, similar to how cast wallet groups wallet operations.

Before:

cast to-wei 1 ether
cast from-utf8 "hello"

After:

cast convert to-wei 1 ether
cast convert from-utf8 "hello"

Additional context

Proposed (26) commands to consolidate under cast convert

  • from-wei, to-wei, to-unit
  • from-fixed-point, to-fixed-point
  • format-units, parse-units
  • to-hex, to-dec, to-base
  • to-int256, to-uint256
  • from-utf8, to-utf8, to-ascii, from-bin
  • to-bytes32, to-hexdata
  • format-bytes32-string, parse-bytes32-string, parse-bytes32-address
  • to-check-sum-address, concat-hex, pad
  • to-rlp, from-rlp

0xClandestine avatar Nov 08 '25 19:11 0xClandestine

Happy to work on this if approved

dipanshuhappy avatar Nov 08 '25 19:11 dipanshuhappy

makes sense to group them, would be nice to avoid breaking change if possible, @dipanshuhappy going to assign this to you if still up to implement it, thanks!

grandizzy avatar Nov 12 '25 09:11 grandizzy

makes sense to group them, would be nice to avoid breaking change if possible, @dipanshuhappy going to assign this to you if still up to implement it, thanks!

Yep I am still up to take it

dipanshuhappy avatar Nov 12 '25 10:11 dipanshuhappy

makes sense to group them, would be nice to avoid breaking change if possible, @dipanshuhappy going to assign this to you if still up to implement it, thanks!

Was kinda hoping for a breaking change here, cast as-is has a ton of commands and they're only growing - hence the point on cognitive load. Another good reason is LLM prompting, much easier for an LLM to reason about using a single cast command as opposed to 30.

https://github.com/0xClandestine/foundry-mcp-rs

0xClandestine avatar Nov 12 '25 17:11 0xClandestine

Was kinda hoping for a breaking change here, cast as-is has a ton of commands and they're only growing - hence the point on cognitive load. Another good reason is LLM prompting, much easier for an LLM to reason about using a single cast command as opposed to 30.

👍 yeah, can do that

grandizzy avatar Nov 13 '25 12:11 grandizzy

Was kinda hoping for a breaking change here, cast as-is has a ton of commands and they're only growing - hence the point on cognitive load. Another good reason is LLM prompting, much easier for an LLM to reason about using a single cast command as opposed to 30.

👍 yeah, can do that

Thank you, thank you. May also be a good idea to see if this could be applied elsewhere to further consolidate other similar commands.

0xClandestine avatar Nov 13 '25 21:11 0xClandestine

@dipanshuhappy thanks for taking this on, any updates ser?

0xClandestine avatar Nov 19 '25 17:11 0xClandestine

@dipanshuhappy thanks for taking this on, any updates ser?

Hey, Yes gonna push in the next few hours

dipanshuhappy avatar Nov 19 '25 17:11 dipanshuhappy

@dipanshuhappy friendly bump

0xClandestine avatar Nov 21 '25 15:11 0xClandestine

@dipanshuhappy friendly bump

creating the PR right now, apologies for the delay I was in transit

dipanshuhappy avatar Nov 22 '25 14:11 dipanshuhappy