2

I have this parameter for a function:

type modify_list is 
| Add of list(address)
| Remove of list(address)

type modify_list_michelson is michelson_or_right_comb(modify_list)

When I try to supply the parameter in my truffle tests like this:

{ add: [account1, account2], remove: [] }

I get this error:

Received 1 arguments while expecting one of the following signatures ([["add","list"],["remove","list"]])

Can anyone tell me how to supply the arguments correctly? I've tried simplifying the parameter with addresses instead of a list and tried pretty much every data structure I could think of in the JS test, but no success yet.

1
  • Do you have a deployed contract for that? I'd like to run some tests against it. Oct 27, 2020 at 13:15

2 Answers 2

2

The correct syntax for the parameter is the following: "remove", [account1, account2] (2 different parameters, no object).
I built a simple contract to emulate your case, deployed it and wrote a little script to test it. After calling the entrypoint of your choice, you must provide 2 parameters: 1- the field you want to set the union value with 2- its parameters (if any).
Let me know if you have other questions :)

1

I believe the error is that you pass the 2 parameters (add and remove), but you should only pass the chosen one. I suggest you try : { add: [account1, account2] }

1
  • 1
    I tried that, unfortunately I got the same error as well Oct 23, 2020 at 20:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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