-
Notifications
You must be signed in to change notification settings - Fork 205
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use TO_TEXT_CONTRACT_ID in Show instance of ContractId (#7153)
fixes #7114 This PR changes the Show instance of ContractId and flips the switch on triggers and DAML Script to run in off-ledger mode. It also adds a test that for DAML Script we actually get back the correct contract id. There is a bit of a design decision here in how we want to print contract ids, so let me list the options I considered. $cid will stand for the actual cid and all options are wrapped in markdown inline code. 1. `"$cid"`. Indistinguishable from string. Suggests that there might be an IsString instance for ContractId. 2. `<$cid>`. Matches the dummy `<contract-id>` but it’s not a dummy so I don’t think matching that is benefitial. 3. `$cid`. Easy to spot (contract ids start with # and have no spaces), clearly not a string but might look slightly weird. changelog_begin - [DAML Script/DAML Triggers] When using DAML-LF 1.dev, the `Show` instance of `ContractId` will now display the actual contract id instead of a dummy `<contract-id>` value. Note that this only applies to DAML Script and DAML Triggers not to ledger code. changelog_end
- Loading branch information
1 parent
74986b9
commit d4d0419
Showing
8 changed files
with
148 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
-- Copyright (c) 2020 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved. | ||
-- SPDX-License-Identifier: Apache-2.0 | ||
|
||
module TestContractId where | ||
|
||
import Daml.Script | ||
|
||
template T | ||
with | ||
t : Party | ||
where | ||
signatory t | ||
|
||
testContractId = do | ||
p <- allocateParty "p" | ||
cid <- submit p (createCmd (T p)) | ||
pure (cid, show cid) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters