Following @Leonid_Rozenberg lead on submit API i was able to implement a scenario in which a multi party submit is performed on an existing contract.
However, i face an “UNAUTHENTICATED” error although i made sure my tokens are up-to-date. I belive the root cause is one of the following bullets (code is shown below):
-
The choice receives a party and productId - Is the party suppose to be the contract’s owner?
-
The Exercise receives actAs and readAs which are currently set to the new created party (“dummyParty”) and the owner. Is this correct input? Should i populate both list with same parties?
private void exerciseCommandOnProduct(String contractId, ProductFields productFields, String multiPartyToken) {
List<String> actAs = Arrays.asList(damlProperties.getOwnerParty(), "dummyParty");
List<String> readAs = Arrays.asList(damlProperties.getOwnerParty(), "dummyParty");
ArrayList<DamlRecord.Field> fields = new ArrayList<DamlRecord.Field>();
fields.add(new DamlRecord.Field(new Party(damlProperties.getOwnerParty())));
fields.add(new DamlRecord.Field(new Party(productFields.getProductCode())));
DamlRecord choiceArgument = new DamlRecord(fields);
ExerciseCommand command = new ExerciseCommand(TEMPLATE_ID, contractId, "CustomerCreatesPolicyRequest", choiceArgument);
List<Command> commands = Collections.singletonList(command);
final Single<Empty> emptySingle = client.
getCommandSubmissionClient().
submit(WORKFLOW_ID, APPLICATION_ID, UUID.randomUUID().toString(), actAs, readAs, commands, multiPartyToken);
emptySingle.blockingGet();
}
Thanks