-
Notifications
You must be signed in to change notification settings - Fork 23
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
Could we add an easier way to call a function? #41
Comments
We could expand #23 to make some method calls easier (never fully implemented path/query params), but isn't the ABI required to make contract function calls? |
We can't rely on query param ordering either. Is it possible to import only import {AbiCoder} from 'web3-eth-abi';
const abiCoder = new AbiCoder(); |
Ordering: that's why I have arg0, arg1, etc. With their types which I think gives you everything you'd need. Encoding docs are here: https://solidity.readthedocs.io/en/develop/abi-spec.html#function-selector |
It seems possible to do, but using What format would we return data in? |
Let's say I'm not using javascript, just want to curl and jq the data. It's essentially just making it easier to use curl -X POST --data '{"jsonrpc":"2.0","method":"eth_call","params":[{see above}],"id":1}' But I guess you'd have to know response types and order too... hmmm.... Let's use this example:
Example GET and response:
|
If the user is on the command line, isn't web3 a simpler choice? I don't see how we can avoid using the equivalent ABI data in some form, and having users manually specify it in their request seems unnecessarily cumbersome and error prone. Maybe there are some narrow use cases for simple functions though. |
Returning native JSON values instead of hex encoded values seems troublesome too. |
Rather than having to generate the hash for the
data
field on the client side, allow human readable input, like:Then rpc-proxy will convert that to the hash.
Or even better, something like this:
Rationale
Say I have a simple app/webpage that wants to get data from a contract and display it, and I don't want to load in the full web3.js and create contract code just to get some data. I could just do a simple jquery.getJSON instead.
The text was updated successfully, but these errors were encountered: