Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cast send 0x prefixed calldata #1434

Open
tynes opened this issue Jan 17, 2023 · 7 comments
Open

cast send 0x prefixed calldata #1434

tynes opened this issue Jan 17, 2023 · 7 comments
Milestone

Comments

@tynes
Copy link

tynes commented Jan 17, 2023

Component

Cast

Describe the feature you would like

I'd like to be able to send transactions, make eth_calls or do gas estimation with calldata directly instead of passing in a function selector + args. This is useful when handling data that has already been ABI encoded or if the calldata is not following ABI.

seth does have this feature, it would require some refactoring to allow cast to do so but it should definitely be possible.

Additional context

No response

@DaniPopes
Copy link
Member

cast call has a --data flag which is mutually exclusive with selector/args, so this should be trivial to add to cast send too

@mattsse
Copy link
Member

mattsse commented Jan 27, 2023

closing as this appears to be solved via --data flag

@mattsse mattsse closed this as completed Jan 27, 2023
@XD-OK
Copy link

XD-OK commented Jan 30, 2023

I don't think this has been resolved, send/estimate has no --data flag

"make eth_calls or do gas estimation with calldata directly instead of passing in a function selector + args" it's useful

@XD-OK
Copy link

XD-OK commented Jan 30, 2023

I don't think this has been resolved, send/estimate has no --data flag

"make eth_calls or do gas estimation with calldata directly instead of passing in a function selector + args" it's useful

Sorry, I found "sig" has already support calldata:
The signature (sig) can be:

A fragment: someFunction(uint256,bytes32)
A selector and encoded calldata: 0xcdba2fd40000000000000000000000000000000000000000000000000000000000007a69
Only the function name: in this case Cast will try to fetch the function signature from Etherscan

@mattsse mattsse reopened this Jan 30, 2023
@mattsse
Copy link
Member

mattsse commented Jan 30, 2023

sorry confused send with call

@DaniPopes we should mirror cast call --data to send|estimate

@DaniPopes
Copy link
Member

Actually I think it should be the other way around. Since the sig argument can also be raw calldata, --data is redundant

@zerosnacks zerosnacks added this to the v1.0.0 milestone Jul 26, 2024
@grandizzy
Copy link
Collaborator

you can do

cast send $(cast az) 0x1234 --private-key 0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80

we're keeping this to update the docs for

[SIG]
          The signature of the function to call

to reflect this option

@grandizzy grandizzy transferred this issue from foundry-rs/foundry Feb 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Status: No status
Development

No branches or pull requests

6 participants