G-d willing
Hello,
In regards to a question I had a couple of months ago regarding interfaces and their conversions (with no strong answer except repeating what is written in the documentation), I am trying to retrieve (from within a choice) the payload from a Fungible.I interface that is stored as a Holding.I
interface.
I have a list of ContractId Holding.I
, and I need to get the quantity of each one of them, which is taken from the Fungible.I
. I first try to convert the Holding.I
to Fungible.I
with the coerceInterfaceContractId
like so:
forA holdingCids (\holdingCid -> do
a <- coerceInterfaceContractId @Fungible.I holdingCid
b <- fetchFromInterface @Fungible.Fungible a
return True
)
I am getting an error saying:
error:
• Couldn't match type ‘ContractId’ with ‘Update’
Expected type: Update Fungible.I
Actual type: ContractId Fungible.I
When I am doing the 2 operations in one command it does work:
a <- fetchFromInterface @Fungible.Fungible (coerceInterfaceContractId @Fungible.I tenderParticipationData.holdingCid)
Why the first way doesn’t work and the second one does work?
Thanks