Skip to content

Allow passing arguments to cast {call,send} through stdin #7890

Open
@guidanoli

Description

@guidanoli

Component

Cast

Describe the feature you would like

There are several cast commands which can potentially receive lengthy arguments. Those are often limited by the underlying host OS to a couple of kilobytes, which, in some situations, might not be enough.

One alternative is to receive such arguments via stdin. It can be formatted as JSON, which is a format already in use for the output of some cast commands. For example:

cast call $to 'func(uint256,address,bytes)' < arguments.json

Where arguments.json might have the following data:

[
  "42",
  "0x41b1a0649752af1b28b3dc29a1556eee781e4a4c",
  "0x9f24c52e0fcd1ac696d00405c3bd5adc558c48936919ac5ab3718fcb7d70f93f..."
]

Alternatively, arguments can be separated line-by-line...

cast call $to 'func(uint256,address,bytes)' < arguments.txt

Where arguments.txt might have the following data:

42
0x41b1a0649752af1b28b3dc29a1556eee781e4a4c
0x9f24c52e0fcd1ac696d00405c3bd5adc558c48936919ac5ab3718fcb7d70f93f...

Additional context

This stemmed from an application I'm developing, called Bugless.
We were using go-ethereum to sign transactions to anvil, but then we changed the underlying framework, and opted to sign transactions with cast instead.
The problem is that some transactions can be quite big, and cast doesn't work because of the argument size limit imposed by the underlying OS, Linux.
If cast doesn't implement a workaround, we might rewrite our CLI tool using viem.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    Status

    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions