The problem
Here's my function :
#[endpoint(registerItem)]
fn register_item(&self, items_id: &[String])
{
// nothing for the moment
}
In my Mandos tests, everything is good (setState, scDeploy, etc..) until I test the call of this endpoint like so :
{
"step": "scCall",
"tx": {
"from": "address:owner",
"to": "sc:equip",
"function": "registerItem",
"arguments": [
"0x70757461696e|0x70757461696e"
],
"gasLimit": "5,000,000",
"gasPrice": "0"
},
"expect": {
"status": "0",
"gas": "*",
"refund": "*"
}
}
When I run it, I got the error code 10 aka execution failed.
This is the entire log :
Output: Scenario: init.scen.json ... FAIL: result code mismatch. Tx . Want: 0. Have: 10 (execution failed). Message: execution failed
Done. Passed: 0. Failed: 1. Skipped: 0.
ERROR: some tests failed
** Things I have tried **
I have replaced the strings array with an int array and I didn't get this problem. I also tried [str] but I got this error :
15 | #[elrond_wasm::derive::contract]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
If it's a endpoint I think you have to use SDK special type for that like ManagedVec so that Node can know how to serialize/deserialize it.
So maybe try this :
#[endpoint(registerItem)]
fn register_item(&self, items_id: ManagedVec<ManagedBuffer>)
{
// nothing for the moment
}