0

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
    {"action":"myaction","contract":"mycontract"}
    thread-0  chain_plugin.cpp:1564 abi_json_to_bin
code: mycontract, action: myaction, args: {"player_cards":[3,4,5,6]}
    {"code":"mycontract","action":"myaction","args":{"player_cards":[3,4,5,6]}}
    thread-0  chain_plugin.cpp:1575 abi_json_to_bin
0

1 Answer 1

0

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>
2
  • How is that different than what I did?
    – Max
    Commented Oct 7, 2018 at 14:29
  • can you share your action definition , you are passing parameters correctly but I think something is wrong with action. Commented Oct 8, 2018 at 4:03

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