I finished smart contract tutorial, and it worked well.
Now I'm trying to send same action as cleos push action hello hi '["bob"]' -p user@active
in tutorial by using RPC API, cause need to implement push in other language(not JS).
Currently, I've found that I need to generate JSON as abi-bin for now, so tried to send like:
curl --header "Content-Type: application/json" \
--data '{
"code": "hello",
"action": "hi",
"args": {
"name": "user",
"type": "account_name"
}
}' \
--request POST http://localhost:8888/v1/chain/abi_json_to_bin
but it failed. It returns:
{
"code":500,
"message":"Internal Service Error",
"error":{
"code":3015014,
"name":"pack_exception",
"what":"Pack data exception",
"details":[]
}
}
...and in chain, it prints:
2018-10-19T10:18:47.006 thread-0 http_plugin.cpp:581 handle_exception ] Exception Details: 3015014 pack_exception: Pack data exception
Missing 'user' in variant object
{"f":"user"}
thread-0 abi_serializer.cpp:389 _variant_to_binary
{"type":"hi","var":{"name":"user","type":"account_name"}}
thread-0 abi_serializer.cpp:410 _variant_to_binary
{"type":"hi","var":{"name":"user","type":"account_name"}}
thread-0 abi_serializer.cpp:426 _variant_to_binary
'{"name":"user","type":"account_name"}' is invalid args for action 'hi' code 'hello'. expected '[{"name":"user","type":"name"}]'
{"args": {"name":"user","type":"account_name"},"action":"hi","code":"hello","proto": [{"name":"user","type":"name"}]}
thread-0 chain_plugin.cpp:1737 abi_json_to_bin
code: hello, action: hi, args: {"name":"user","type":"account_name"}
{"code":"hello","action":"hi","args": {"name":"user","type":"account_name"}}
thread-0 chain_plugin.cpp:1743 abi_json_to_bin
Could somebody give me a guide for correct request form?
Thanks.
-p
? it'd help if you mentioned how it failed i.e. what error