edit: To the question in the subject, yes. Maintainers play a specific semantic role in the contract key model that may not simply be carried out by arbitrary data.
You need to tell DAML how to get the Partys from your CitizenKey.
If this is the only place, you could just write maintainer key._1.citizen.
If you generally want CitizenKey to work, you could add the missing instance. If I add this line to the file:
instance IsParties CitizenKey where
I get the error
Test.daml:63:10: error:
• No explicit implementation for
‘toParties’
• In the instance declaration for ‘IsParties CitizenKey’
So I can add
instance IsParties CitizenKey where
toParties = ()
Now I get
Test.daml:64:15: error:
• Couldn't match expected type ‘CitizenKey -> [Party]’
with actual type ‘()’
• In the expression: ()
In an equation for ‘toParties’: toParties = ()
In the instance declaration for ‘IsParties CitizenKey’
Now just implement that signature. There are a few ways; since what I want is “just recur on the IsParties instance for the citizen field”, I would write:
instance IsParties CitizenKey where
toParties = toParties . citizen
But this is almost a stylistic choice at this point.