Hi,
Could you please let me know how I can call contract methods with "dynamic-length arrays" arguments. I have read this document: Write Methods, and it is quite brief.
Codility function example:
function paySalary(address[] employeeList) public payable {}
In Javascript, I have tried many things including passing an array:
let emplyeeList = [addr_John, addr_Mark, addr_Steve];
await myDapp.paySalary(emplyeeList, overrides);
But it seems it does not work. In the smart contractpaySalary(address[] employeeList), it only takes the first element(length is 1).
Could you please share some insights. Thanks for your great help.
B.R
Andy
The way you are trying looks completely fine and I use it al the time.
console.log(emplyeeList) to see if there are three addresses present or are last two undefined.Thanks @zemse
I will try that ASAP. Thanks for your great help.
Did that work for you? If so, I'll close this issue.
Hi, @ricmoo
yes, it does work. I forgot to reply, sorry.
Please close it.
Thanks for your help.
Awesome! Thanks. :)
Most helpful comment
The way you are trying looks completely fine and I use it al the time.
console.log(emplyeeList)to see if there are three addresses present or are last two undefined.