Skip to content

Commit 94a16bf

Browse files
committed
create separate library for interfaces
1 parent 4ce69fe commit 94a16bf

File tree

5 files changed

+52
-63
lines changed

5 files changed

+52
-63
lines changed

build.sbt

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,8 @@ lazy val root: Project = (project in file("."))
114114
`splice-dso-governance-test-daml`,
115115
`splice-validator-lifecycle-daml`,
116116
`splice-validator-lifecycle-test-daml`,
117+
`splice-api-featured-app-v1-daml`,
118+
`splice-api-credential-registry-v1-daml`,
117119
`splice-api-token-metadata-v1-daml`,
118120
`splice-api-token-holding-v1-daml`,
119121
`splice-api-token-transfer-instruction-v1-daml`,
@@ -660,7 +662,7 @@ lazy val `splice-util-daml` =
660662
`canton-bindings-java`
661663
)
662664

663-
lazy val `splice-featured-app-api-v1-daml` =
665+
lazy val `splice-api-featured-app-v1-daml` =
664666
project
665667
.in(file("daml/splice-api-featured-app-v1"))
666668
.enablePlugins(DamlPlugin)
@@ -671,6 +673,21 @@ lazy val `splice-featured-app-api-v1-daml` =
671673
`canton-bindings-java`
672674
)
673675

676+
lazy val `splice-api-credential-registry-v1-daml` =
677+
project
678+
.in(file("daml/splice-api-credential-registry-v1"))
679+
.enablePlugins(DamlPlugin)
680+
.settings(
681+
BuildCommon.damlSettings,
682+
Compile / damlDependencies :=
683+
(`splice-util-daml` / Compile / damlBuild).value ++
684+
(`splice-api-token-metadata-v1-daml` / Compile / damlBuild).value,
685+
)
686+
.dependsOn(
687+
`canton-bindings-java`
688+
)
689+
690+
674691
lazy val `splice-amulet-daml` =
675692
project
676693
.in(file("daml/splice-amulet"))
@@ -685,7 +702,7 @@ lazy val `splice-amulet-daml` =
685702
(`splice-api-token-allocation-v1-daml` / Compile / damlBuild).value ++
686703
(`splice-api-token-allocation-request-v1-daml` / Compile / damlBuild).value ++
687704
(`splice-api-token-allocation-instruction-v1-daml` / Compile / damlBuild).value ++
688-
(`splice-featured-app-api-v1-daml` / Compile / damlBuild).value,
705+
(`splice-api-featured-app-v1-daml` / Compile / damlBuild).value,
689706
)
690707
.dependsOn(`canton-bindings-java`)
691708

@@ -796,7 +813,7 @@ lazy val `splice-util-featured-app-proxies-daml` =
796813
(`splice-api-token-transfer-instruction-v1-daml` / Compile / damlBuild).value ++
797814
(`splice-api-token-allocation-v1-daml` / Compile / damlBuild).value ++
798815
(`splice-api-token-allocation-instruction-v1-daml` / Compile / damlBuild).value ++
799-
(`splice-featured-app-api-v1-daml` / Compile / damlBuild).value,
816+
(`splice-api-featured-app-v1-daml` / Compile / damlBuild).value,
800817
)
801818
.dependsOn(`canton-bindings-java`)
802819

@@ -810,7 +827,7 @@ lazy val `splice-util-token-standard-wallet-daml` =
810827
(`splice-api-token-holding-v1-daml` / Compile / damlBuild).value ++
811828
(`splice-api-token-metadata-v1-daml` / Compile / damlBuild).value ++
812829
(`splice-api-token-transfer-instruction-v1-daml` / Compile / damlBuild).value ++
813-
(`splice-featured-app-api-v1-daml` / Compile / damlBuild).value,
830+
(`splice-api-featured-app-v1-daml` / Compile / damlBuild).value,
814831
)
815832
.dependsOn(`canton-bindings-java`)
816833

@@ -922,7 +939,7 @@ lazy val `apps-common` =
922939
`splice-api-token-allocation-instruction-v1-daml`,
923940
`splice-token-test-dummy-holding-daml`,
924941
`splice-token-test-trading-app-daml`,
925-
`splice-featured-app-api-v1-daml`,
942+
`splice-api-featured-app-v1-daml`,
926943
)
927944
.enablePlugins(BuildInfoPlugin)
928945
.settings(

daml/splice-amulet-name-service/daml.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,14 @@ data-dependencies:
99
- ../splice-amulet/.daml/dist/splice-amulet-current.dar
1010
- ../splice-util/.daml/dist/splice-util-current.dar
1111
- ../splice-wallet-payments/.daml/dist/splice-wallet-payments-current.dar
12+
1213
- ../splice-api-featured-app-v1/.daml/dist/splice-api-featured-app-v1-current.dar
14+
- ../splice-api-credential-registry-v1/.daml/dist/splice-api-credential-registry-v1-current.dar
1315
- ../../token-standard/splice-api-token-metadata-v1/.daml/dist/splice-api-token-metadata-v1-current.dar
1416
build-options:
1517
- --ghc-option=-Wunused-binds
1618
- --ghc-option=-Wunused-matches
1719
- -Wno-ledger-time-is-alpha
18-
- -Wupgrade-interfaces # FIXME: remove once the interface files moved
1920
- --target=2.1
2021
codegen:
2122
java:

daml/splice-amulet-name-service/daml/Splice/AnsV2/AnsCredential.daml

Lines changed: 10 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ import Splice.Util
1414
import Splice.Api.Token.MetadataV1 (emptyMetadata)
1515
import Splice.Api.Credential.RegistryV1 qualified as RegistryV1
1616

17+
18+
-- | Registry for creating ANS records.
1719
template AnsCredentialRegistry with
1820
dso : Party
1921
where
@@ -24,9 +26,9 @@ template AnsCredentialRegistry with
2426
admin = dso
2527
meta = emptyMetadata
2628

27-
credentialRegistry_updateRecordsImpl self RegistryV1.CredentialRegistry_UpdateRecords{..} = do
29+
credentialRegistry_updateRecordsImpl _self RegistryV1.CredentialRegistry_UpdateRecords{..} = do
2830
assertDeadlineExceeded "newCreatedAt" newCreatedAt
29-
-- FIXME: make configurable
31+
-- TODO: make configurable
3032
let defaultExpiresAt = addRelTime newCreatedAt (days 90) -- default to 90 day expiry
3133

3234
-- check admin
@@ -86,69 +88,20 @@ template AnsCredentialRecord
8688
require "actor is stakeholder" (actor == holder || actor == issuer || actor == dso)
8789
assertDeadlineExceeded "expiresAt" expiresAt
8890

89-
-- TODO: add choice for Dso to remove invalid credential records
90-
91-
{-
92-
choice AnsCredential_DsoInvalidCreatedAt : ()
91+
choice AnsCredential_DsoArchiveInvalid : ()
92+
-- ^ Archive this credential record if it is invalid according to the DSO rules.
93+
-- Required as the DSO party is only an observer and thus cannot control the creation of records.
9394
controller dso
9495
do
9596
-- created at cannot be in the future
9697
assertWithinDeadline "createdAt" createdAt
98+
-- TODO: add check that expiresAt is not too far in the future
99+
-- TODO: consider how to check that reliably when the allowed TTL changes
97100
pure ()
98101

99-
choice AnsCredential_Update : ContractId AnsCredential
100-
with
101-
newCreatedAt : Time
102-
actor : Party
103-
controller actor
104-
do
105-
assertDeadlineExceeded "newCreatedAt" newCreatedAt
106-
create this with
107-
createdAt = newCreatedAt
108-
109-
-}
110-
111-
{-
112-
113-
{-
114-
115-
template AnsConfigV2 with
116-
dso : Party
117-
entryTTL : RelTime
118-
where
119-
signatory dso
120-
121-
canton.network/url#<name> : url
122-
123-
124-
-}
125-
126-
data Credential = Credential with
127-
claims : TextMap Text
128-
validFrom : Optional Time
129-
validUntil : Optional Time
130-
createdAt : Time
131-
meta : Metadata
132-
deriving (Eq, Show)
133-
134-
interface CredentialRegistry where
135-
-- | Register a new credential with the DSO.
136-
registerCredential : Party -> Credential -> Update (ContractId AnsCredential)
137-
138-
139-
nonconsuming choice CredentialRegistry_UpdateCredentials
140-
: ContractId Credential
141-
with
142-
inputCredentials : [ContractId Credential]
143-
newCredentials : [Credential]
144-
actors : Party
145-
expectedRegisty : Party
146-
controller actors
147-
do updateCredentials
148-
149-
150102

151103

104+
{- TODO: consider exact validation rules and implement them
152105

153106

154107
validEntry : AnsCredential -> Bool
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
sdk-version: 3.3.0-snapshot.20250502.13767.0.v2fc6c7e2
2+
name: splice-api-credential-registry-v1
3+
source: daml
4+
version: 1.0.0
5+
dependencies:
6+
- daml-prim
7+
- daml-stdlib
8+
data-dependencies:
9+
- ../../token-standard/splice-api-token-metadata-v1/.daml/dist/splice-api-token-metadata-v1-current.dar
10+
build-options:
11+
- --ghc-option=-Wunused-binds
12+
- --ghc-option=-Wunused-matches
13+
- --target=2.1
14+
codegen:
15+
java:
16+
package-prefix: org.lfdecentralizedtrust.splice.codegen.java
17+
decoderClass: org.lfdecentralizedtrust.splice.codegen.java.DecoderSpliceCredentialRegistryV1
18+
output-directory: target/daml-codegen-java

daml/splice-amulet-name-service/daml/Splice/Api/Credential/RegistryV1.daml renamed to daml/splice-api-credential-registry-v1/daml/Splice/Api/Credential/RegistryV1.daml

File renamed without changes.

0 commit comments

Comments
 (0)