foundry-rs / foundry-rs/foundry

feat(`cast`): consolidate conversion commands

Open
#12,500 10 comments 1 reaction 1 assignee Claimed by @dipanshuhappy View on GitHub
C-cast T-feature
Dominant language
Rust
Stars
10.6k
Forks
2.6k
Avg merge
18h 20m
Merged PRs (30d)
510

Description

### 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:**
```bash
cast to-wei 1 ether
cast from-utf8 "hello"
```

**After:**
```bash
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`

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.