G-d willing
Hi everyone,
I am having some difficulties in converting one interface to another from within a Script
.
I am using the Finance Library trying to convert a Holding to Fungible.
import Daml.Finance.Interface.Holding.Base qualified as Holding
import Daml.Finance.Interface.Holding.Fungible qualified as Fungible
convertHoldingToFungible : ContractId Holding.I -> Party -> Script ()
convertHoldingToFungible holdingCid owner = do
fungibleHoldingCid <- toInterfaceContractId @Fungible.I holdingCid
pure ()
The line that is doing toInterfaceContractId
is having an error indicating:
• Couldn't match type ‘ContractId’ with ‘Script’
Expected type: Script Fungible.I
Actual type: ContractId Fungible.I
However, when I am doing it this way, it works:
fungibleHoldingCid <- toInterfaceContractId @Fungible.I . fst . head <$> queryInterface @Fungible.I owner
Can you please explain to me how can I do it correctly?
Thanks,