Mismatching type error when accessing ledger api using grpcurl
Hello, I am unable to exercise a choice on a contract using grpcurl against a sandbox ledger.
Details are as follows:
Command:
grpcurl -plaintext -d '{
"commands": {
"ledgerId": "sandbox",
"applicationId": "test",
"party": "Alice",
"commands": [
{
"exercise": {
"contractId": "<some-contract-id>",
"choice": "CloseTask",
"choiceArgument": {
"party": "Alice"
},
"templateId": {
"packageId": "<package-id>",
"moduleName": "Main.Main",
"entityName": "Task"
}
}
}
],
"actAs": [
"Alice"
],
"readAs": [
"Alice"
],
"disclosedContracts": [],
"commandId": "test"
}
}' localhost:6865 com.daml.ledger.api.v1.CommandSubmissionService.Submit
Here is the choice that I am trying to exercise:
choice CloseTask: () with
user: Party
controller user
do
return ()
Here is the response from the ledger API:
COMMAND_PREPROCESSING_FAILED(8,8e61f8b9): mismatching type: Main.Main:CloseTask and value: ValueParty(Alice)
Is this an issue passing argument to the choice?
Hi, @ksm3. I haven’t tried to replicate this. However, the first thing I would explore would be including the full party id, instead of just the user-friendly portion of the id.
For example, instead of this:
"party": "Alice"
I would try something like this:
"party": "Alice::1220a07d5e7862998100f5c69aebf309bef4be2ffb08f2ab6b044e42fe0f71a20cc9"
You can get the full party names with this command:
daml ledger list-parties
The full party id reflects the fact that there might be another “Alice” on the network somewhere. The part after the :: is “the fingerprint of the public key that can authorize topology transactions for this party.” See here.