-
Notifications
You must be signed in to change notification settings - Fork 205
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
typed ACS and transaction streams for Java codegen #14969
Comments
I think the template / interface Companion will be the good place for these utility methods, agree? |
No, I think a static method on |
How to access Companion in these method? by passing in as a parameter?
|
I have moved |
What is the problem you want to solve?
The highest-level subscription to read contracts we offer in Java looks like this:
daml/language-support/java/bindings-rxjava/src/main/java/com/daml/ledger/rxjava/TransactionsClient.java
Lines 27 to 28 in a516be7
It requires
TransactionFilter
, andTransaction
.By contrast, in TypeScript, we offer
daml/language-support/ts/daml-ledger/index.ts
Lines 998 to 1001 in 7657ba0
daml/language-support/ts/daml-react/defaultLedgerContext.ts
Lines 69 to 71 in a516be7
This hides the mechanics of the relationship between template/interface IDs and the payload format, yielding decoded contracts as a result. Consider
CreateEvent
above, for example: instead of genericRecord
createArguments
, the payload type matches what you queried.What is the solution you would propose?
From codegen decoders #14313 , we can produce utility methods that
TransactionFilter
s for given party sets, with template or interface selected according to underlying contract-type-type, andMoreover, these can then be combined into single utility calls to take
ContractTypeCompanion
s and yield well-typed, decoded stream results.Only a bare minimum of #14313 is needed for this feature: define
FromValue
, and define how it is derived fromTemplateCompanion
. Then it becomes possible to write and test the aforementioned utility methods. With #15125, we can consider interface support.Describe alternatives you've considered
A single
ContractTypeCompanion
is sufficient to handle all sorts of single-interface or single-template streaming requests. For streaming multiple templates/interfaces at once, you need a combinator language to unify disparate payload types. This is similar to the problem of submitting multiple commands with the API proposed by #14312, and may invite similar thinking.Additional context
When we decided to unify interface views and template payloads in JSON query, that yielded a TypeScript API that looked exactly the same from a user perspective as the present templates API. "Interface view is contract payload" is a nice way to transition from working with template payloads.
Moreover, while #14313 has been largely considered in terms of choice exercise utilities like #14329, it is equally useful for improving codegen integration into the bindings in this category.
The text was updated successfully, but these errors were encountered: