book icon indicating copy to clipboard operation
book copied to clipboard

`cast send` 0x prefixed calldata

Open tynes opened this issue 2 years ago • 7 comments

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

tynes avatar Jan 17 '23 19:01 tynes

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

DaniPopes avatar Jan 17 '23 19:01 DaniPopes

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

mattsse avatar Jan 27 '23 13:01 mattsse

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 avatar Jan 30 '23 04:01 XD-OK

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

XD-OK avatar Jan 30 '23 06:01 XD-OK

sorry confused send with call

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

mattsse avatar Jan 30 '23 15:01 mattsse

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

DaniPopes avatar Jan 30 '23 15:01 DaniPopes

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 avatar Nov 12 '24 13:11 grandizzy