好的,我是 DAML 新手,拥有丰富的 Java 编程经验。现在,我有一个问题。在 Java 中,“A 类”有“B 类”,这样,A 可以使用“B 类”的“状态”。我也想在 DAML 中做这样的事情。
如果我认为模板是一个类,'contract id' 是它的一个实例,并且模板的'state'(我们在'with'中声明的东西)在作为参数传入时应该可以在另一个模板中访问,但是我在编写的代码中遇到编译错误。
一种方法是发送 'party' 作为参数而不是合同 ID,然后尝试访问合同中的当事方,但我想检查这是否/有什么问题!
提前致谢!
第一个模板
daml 1.2
module RFP where
template RFP
with
requestorCEO: Party
where
signatory requestorCEO
第二个模板
daml 1.2
module InternalComm where
import RFP
template InternalComm
with
-- RFP is sent in as a parameter to this template.
rfpContractID: ContractId RFP
where
-- Here with this, I'm trying to say that the CEO who would be approving
-- an RFP is the signatory for internal communications too. It is the
-- below line that fails with compilation error.
signatory rfpContractID.requestorCEO
这是我收到的上述问题的实际错误消息。任何想法将不胜感激!
No instance for (DA.Internal.Record.HasField
"requestorCEO" (ContractId RFP) a0)