The daml-ui-template currently just supports exercising choices with a single parameter (or none). But the components in there, specifically the Contracts component, are really just meant as examples for you to adapt, not to be used as is in the final application. So you can for example just copy the code from Contracts into your own component and adjust it to your needs. When taking in > 1 parameters you’d anyway probably don’t want to display these inline in a contracts table, but maybe would want to pop up a form dialogue.
As for your other question to get the currently logged in user party you can use const party = useParty().
template Network
with
operator : Party
where
signatory operator
controller operator can
nonconsuming InviteHealthClinic : ContractId HealthClinicInvitation
with
healthclinic : Party
do
create HealthClinicInvitation with healthclinic, operator
nonconsuming InviteCitizen : ContractId CitizenInvitation
with
citizen : Party
do
create CitizenInvitation with citizen, operator
template HealthClinicInvitation
with
operator : Party
healthclinic : Party
where
signatory operator
controller healthclinic can
AcceptInvitation : ContractId HealthClinicRole
do
create HealthClinicRole with healthclinic, operator
You are passing already the full argument into the operator parameter for your exerciseInviteHealthClinic function. You can either change the function to take a single args parameter that you then pass directly to the choice, or you change it to just take the healthclinic parameter, and use the ops party as the operator (which you’ll have to move up to before the function. For the latter the code would look like this:
Uncaught (in promise) Error: Trying to look up template c94a6ca42d2899213eb9634a997a173f12698d32c69781559e077163792aeddf:Main:HealthClinicInvitation.
at Object.push…/node_modules/@daml/types/index.js.exports.lookupTemplate (index.js:30)
at index.js:72
at decoder.ts:795
at andThen (result.ts:130)
at Decoder.decode (decoder.ts:795)
at Decoder.decode (decoder.ts:312)
at Decoder.decode (decoder.ts:501)
at decodeValue_1 (decoder.ts:371)
at decoder.ts:375
at Array.reduce ()
at Decoder.decode (decoder.ts:373)
at Decoder.decode (decoder.ts:312)
at Decoder.run (decoder.ts:716)
at Ledger. (index.js:357)
at step (index.js:33)
at Object.next (index.js:14)
at fulfilled (index.js:5)
I also saw the following Warn issue show up in the JSON-API Console:
Looks like your JS generated code is out of sync with the compiled DAML models. Make sure to follow the steps here each time you modify your DAML models.
After some more digging. I found that the exercise choice contract is actually executing and a new record is added in the database in the Contracts Table.
Some other code is still creating the errors on the page
Ok, that’s an odd issue, but I think I’ve seen this before. It could be that two versions of @daml/types are being loaded. Can you do the nuclear option:
Just to add to this thread: we’ve also observed when users upgrade from previous versions of the SDK, in particular v0.13.55, that the yarn.lock file in the UI directory can get messed up. So if the above doesn’t resolve the issue for you, try deleting the yarn.lock file in your UI directory and then perform the above steps (just with a normal yarn install without the additional parameters).