If I apply the ledger export tool to the skeleton template, I get the following script, which replays the ledger history:
-- | Test 'export' with freshly allocated parties and
-- no replacements for missing contract ids.
testExport : Script ()
testExport = do
parties <- allocateParties
let contracts = DA.TextMap.empty
export Args with ..
-- | The Daml ledger export.
export : Args -> Script ()
export Args{parties, contracts} = do
let alice1220dfe521ccae0f585dc76c3c250170e3ac3bcda3fba26bd64df6e1ff83629321bf_0 = lookupParty "Alice::1220dfe521ccae0f585dc76c3c250170e3ac3bcda3fba26bd64df6e1ff83629321bf" parties
let bob1220dfe521ccae0f585dc76c3c250170e3ac3bcda3fba26bd64df6e1ff83629321bf_0 = lookupParty "Bob::1220dfe521ccae0f585dc76c3c250170e3ac3bcda3fba26bd64df6e1ff83629321bf" parties
(coerceContractId @_ @Main.Asset -> asset_1_0) <- submit alice1220dfe521ccae0f585dc76c3c250170e3ac3bcda3fba26bd64df6e1ff83629321bf_0 do
createCmd (Main.Asset {issuer = alice1220dfe521ccae0f585dc76c3c250170e3ac3bcda3fba26bd64df6e1ff83629321bf_0,
owner = alice1220dfe521ccae0f585dc76c3c250170e3ac3bcda3fba26bd64df6e1ff83629321bf_0,
name = "TV"})
(coerceContractId @_ @Main.Asset -> asset_2_0) <- submit alice1220dfe521ccae0f585dc76c3c250170e3ac3bcda3fba26bd64df6e1ff83629321bf_0 do
exerciseCmd asset_1_0 (Main.Give {newOwner = bob1220dfe521ccae0f585dc76c3c250170e3ac3bcda3fba26bd64df6e1ff83629321bf_0})
_ <- submit bob1220dfe521ccae0f585dc76c3c250170e3ac3bcda3fba26bd64df6e1ff83629321bf_0 do
exerciseCmd asset_2_0 (Main.Give {newOwner = alice1220dfe521ccae0f585dc76c3c250170e3ac3bcda3fba26bd64df6e1ff83629321bf_0})
pure ()
What does coerceContractId
do in this script?
What does the syntax with the right arrow mean?: coerceContractId @_ @Main.Asset -> asset_1_0
(coerceContractId` is also used in connection with interfaces which are already stable, still I couldn’t find anything about it in the docs.)