Problem importing DAML Script from Data Dependency

I’ve got a project with a module Test.Intro.Asset.Trade containing a script tradeSetup. This is in fact a modified version of the daml-intro-7 template with scripts instead of scenarios.

Now I’m importing a compiled DAR file from that project into an upgrade project. There I’m importing the aforementioned module using import qualified Test.Intro.Asset.Trade as TradeTest.

When trying to use the imported script, I get an error:

testUpgrade = do
  (alice, bob, usdbank, eurbank, usdha, usdhb, eurha, eurhb, usdCid, eurCid) <- TradeTest.tradeSetup
  return ()
File:     daml/Test/Intro/Asset/Upgrade/V2.daml
Hidden:   no
Range:    18:80-18:100
Source:   typecheck
Severity: DsError
Message:
  daml/Test/Intro/Asset/Upgrade/V2.daml:18:81: error:
  Not in scope: ‘TradeTest.tradeSetup’
  Module ‘Test.Intro.Asset.Trade’ does not export ‘tradeSetup’.
ERROR: Creation of DAR file failed.

What’s going wrong here? Are scripts not imported with data-dependencies?

2 Likes

This is expected at the moment. The DAML Script type changes in each SDK version so if we would expose this, you would now end up with 2 incompatible Script types. I’ve opened Document cross-SDK guarantees for DAML Script · Issue #7341 · digital-asset/daml · GitHub to document this.

1 Like