Skip to content

Commit f0fa9e1

Browse files
WIP
1 parent a5e02fc commit f0fa9e1

File tree

3 files changed

+16
-13
lines changed

3 files changed

+16
-13
lines changed

sdk/compiler/damlc/daml-stdlib-src/DA/ContractKeys.daml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,14 @@
55

66
module DA.ContractKeys where
77

8-
import DA.Internal.Template.Functions as DA
8+
--import DA.Internal.Template.Functions as DA
9+
import DA.Internal.Template.Functions (queryNByKey)
910

1011
#ifdef DAML_NUCK
11-
queryNByKey : forall t k. HasQueryNByKey t k => Int -> k -> Update [(ContractId t, t)]
12-
queryNByKey = DA.queryNByKey
12+
libqueryNByKey : forall t k. HasQueryNByKey t k => Int -> k -> Update [(ContractId t, t)]
13+
--queryNByKey = DA.queryNByKey
14+
libqueryNByKey = queryNByKey
1315

1416
queryAllByKey : forall t k. HasQueryNByKey t k => k -> Update [(ContractId t, t)]
15-
queryAllByKey = queryNByKey (maxBound @Int)
17+
queryAllByKey = libqueryNByKey (maxBound @Int)
1618
#endif

sdk/compiler/damlc/daml-stdlib-src/LibraryModules.daml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import DA.Action.State
1313
import DA.Assert
1414
import DA.BigNumeric
1515
import DA.Bifunctor
16+
import DA.ContractKeys
1617
import DA.Crypto.Text
1718
import DA.Date
1819
import DA.Either

sdk/compiler/damlc/tests/daml-test-files/QueryNByKey.daml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
module QueryNByKey where
77

8-
-- import Daml.Script
8+
import DA.ContractKeys
99

1010
template WithKey
1111
with
@@ -28,14 +28,14 @@ template Helper
2828
pure ()
2929
[] ->
3030
abort "Assertion failed: queryNByKey returned an empty list."
31-
-- choice PerformQueryAllByKey : ()
32-
-- controller p
33-
-- do contracts <- queryAllByKey @WithKey p
34-
-- case contracts of
35-
-- (contract :: _) -> do
36-
-- pure ()
37-
-- [] ->
38-
-- abort "Assertion failed: queryAllByKey returned an empty list."
31+
choice PerformQueryAllByKey : ()
32+
controller p
33+
do contracts <- queryAllByKey @WithKey p
34+
case contracts of
35+
(contract :: _) -> do
36+
pure ()
37+
[] ->
38+
abort "Assertion failed: queryAllByKey returned an empty list."
3939

4040
-- Test just here to assert that queryNByKey compiles
4141
-- When we have an ledger implementation, assert things actually run

0 commit comments

Comments
 (0)