I need to pass a list of integers to an action. It would be fine to use vectors or arrays, but I can't find one that works. Using vector in the smart contract compiles fine, but then I get this error when I invoke in cleos this way:

cleos push action mycontract myaction '{"player_cards":[3, 4, 5, 6]}' -p mycontract

I get this error:

2018-10-07T04:25:26.099 thread-0   http_plugin.cpp:476           handle_exception     ] Exception Details: 3050000 action_validate_exception: Action validate exception
Unknown action myaction in contract mycontract
    thread-0  chain_plugin.cpp:1564 abi_json_to_bin
code: mycontract, action: myaction, args: {"player_cards":[3,4,5,6]}
    thread-0  chain_plugin.cpp:1575 abi_json_to_bin

Let say you have a action like this:

void vertordemo(vector<double> &percentages){

//play with your vector here

you have to pass values like:

cleos push action mycontract vertordemo '{"percentages":[20.5,20]}' -p mycontract

please make sure you imported the vector library in the starting of your cpp file:

#include <vector>
| improve this answer | |
  • How is that different than what I did? – Max Oct 7 '18 at 14:29
  • can you share your action definition , you are passing parameters correctly but I think something is wrong with action. – Nirdesh Kumar Choudhary Oct 8 '18 at 4:03

Not the answer you're looking for? Browse other questions tagged or ask your own question.