@distrohelena/canton-typescript-sdk 0.1.4 → 0.1.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +333 -1
- package/dist/client/canton-client-options.d.ts +3 -0
- package/dist/client/canton-client-options.js +2 -0
- package/dist/client/service-registry.js +4 -3
- package/dist/core/errors/grpc-transport-error.d.ts +14 -0
- package/dist/core/errors/grpc-transport-error.js +76 -0
- package/dist/core/signing/sign-command-request.d.ts +4 -0
- package/dist/core/signing/sign-command-request.js +4 -0
- package/dist/core/signing/sign-command-result.d.ts +2 -0
- package/dist/core/signing/sign-command-result.js +9 -0
- package/dist/core/transports/transport.interface.d.ts +2 -2
- package/dist/core/types/canton-hash-purpose.d.ts +2 -1
- package/dist/core/types/canton-hash-purpose.js +1 -0
- package/dist/core/types/commands/create-and-exercise-command.js +1 -1
- package/dist/core/types/commands/exercise-by-key-command.js +2 -2
- package/dist/core/types/commands/exercise-command.js +2 -2
- package/dist/core/types/daml-numeric.d.ts +6 -0
- package/dist/core/types/daml-numeric.js +14 -0
- package/dist/core/types/daml-party.d.ts +6 -0
- package/dist/core/types/daml-party.js +14 -0
- package/dist/core/types/requests/create-decentralized-party-request.d.ts +41 -0
- package/dist/core/types/requests/create-decentralized-party-request.js +82 -0
- package/dist/core/types/requests/create-external-party-request.d.ts +42 -0
- package/dist/core/types/requests/create-external-party-request.js +47 -0
- package/dist/core/types/requests/finalize-decentralized-party-request.d.ts +39 -0
- package/dist/core/types/requests/finalize-decentralized-party-request.js +42 -0
- package/dist/core/types/requests/get-active-contracts-page-request.d.ts +15 -2
- package/dist/core/types/requests/get-active-contracts-page-request.js +4 -0
- package/dist/core/types/requests/submit-command-request.d.ts +2 -0
- package/dist/core/types/requests/submit-command-request.js +2 -0
- package/dist/core/types/topology/topology-signature-format.d.ts +2 -1
- package/dist/core/types/topology/topology-signature-format.js +1 -0
- package/dist/daml-lf/container/dar-archive-entry.d.ts +8 -0
- package/dist/daml-lf/container/dar-archive-entry.js +8 -0
- package/dist/daml-lf/container/dar-archive-loader.js +14 -0
- package/dist/daml-lf/container/dar-archive.d.ts +6 -0
- package/dist/daml-lf/container/dar-archive.js +4 -0
- package/dist/daml-lf/container/dar-source-bundle-loader.d.ts +5 -0
- package/dist/daml-lf/container/dar-source-bundle-loader.js +33 -0
- package/dist/daml-lf/container/dar-source-bundle.d.ts +45 -0
- package/dist/daml-lf/container/dar-source-bundle.js +11 -0
- package/dist/daml-lf/container/dar-source-file-entry.d.ts +8 -0
- package/dist/daml-lf/container/dar-source-file-entry.js +8 -0
- package/dist/daml-lf/daml-lf-compilation.d.ts +12 -0
- package/dist/daml-lf/daml-lf-compilation.js +35 -0
- package/dist/daml-lf/index.d.ts +11 -0
- package/dist/daml-lf/index.js +10 -0
- package/dist/daml-lf/interpreter/daml-lf-builtin-dispatch.d.ts +43 -0
- package/dist/daml-lf/interpreter/daml-lf-builtin-dispatch.js +933 -0
- package/dist/daml-lf/interpreter/daml-lf-evaluator.d.ts +95 -0
- package/dist/daml-lf/interpreter/daml-lf-evaluator.js +1131 -0
- package/dist/daml-lf/interpreter/daml-lf-interpreter-scaffold.d.ts +3 -0
- package/dist/daml-lf/interpreter/daml-lf-interpreter-scaffold.js +6 -1
- package/dist/daml-lf/interpreter/daml-lf-lexical-scope.d.ts +13 -0
- package/dist/daml-lf/interpreter/daml-lf-lexical-scope.js +46 -0
- package/dist/daml-lf/interpreter/daml-lf-runtime-frame.d.ts +16 -0
- package/dist/daml-lf/interpreter/daml-lf-runtime-frame.js +15 -0
- package/dist/daml-lf/interpreter/daml-lf-runtime-value.d.ts +21 -0
- package/dist/daml-lf/interpreter/daml-lf-runtime-value.js +4 -1
- package/dist/daml-lf/interpreter/daml-lf-step-kind.d.ts +7 -0
- package/dist/daml-lf/interpreter/daml-lf-step-kind.js +8 -0
- package/dist/daml-lf/interpreter/daml-lf-trace-sink.interface.d.ts +30 -0
- package/dist/daml-lf/interpreter/daml-lf-trace-sink.interface.js +1 -0
- package/dist/daml-lf/model/daml-lf-builtin-type.d.ts +3 -0
- package/dist/daml-lf/model/daml-lf-builtin-type.js +3 -0
- package/dist/daml-lf/model/daml-lf-choice.d.ts +5 -0
- package/dist/daml-lf/model/daml-lf-choice.js +4 -0
- package/dist/daml-lf/model/daml-lf-expression-path.d.ts +2 -0
- package/dist/daml-lf/model/daml-lf-expression-path.js +81 -0
- package/dist/daml-lf/model/daml-lf-expression.d.ts +146 -0
- package/dist/daml-lf/model/daml-lf-expression.js +71 -0
- package/dist/daml-lf/model/daml-lf-template.d.ts +2 -0
- package/dist/daml-lf/model/daml-lf-template.js +2 -0
- package/dist/daml-lf/model/daml-lf-type.d.ts +2 -0
- package/dist/daml-lf/model/daml-lf-type.js +4 -0
- package/dist/daml-lf/model/lf-2-model-mapper.d.ts +5 -0
- package/dist/daml-lf/model/lf-2-model-mapper.js +445 -12
- package/dist/debugger/errors/replay-determinism.exception.d.ts +3 -0
- package/dist/debugger/errors/replay-determinism.exception.js +3 -0
- package/dist/debugger/errors/replay-missing-package.exception.d.ts +3 -0
- package/dist/debugger/errors/replay-missing-package.exception.js +3 -0
- package/dist/debugger/errors/replay-missing-source.exception.d.ts +3 -0
- package/dist/debugger/errors/replay-missing-source.exception.js +3 -0
- package/dist/debugger/errors/replay-source-map.exception.d.ts +3 -0
- package/dist/debugger/errors/replay-source-map.exception.js +3 -0
- package/dist/debugger/errors/replay-state-hydration.exception.d.ts +3 -0
- package/dist/debugger/errors/replay-state-hydration.exception.js +3 -0
- package/dist/debugger/errors/replay-unsupported-lf-construct.exception.d.ts +3 -0
- package/dist/debugger/errors/replay-unsupported-lf-construct.exception.js +3 -0
- package/dist/debugger/errors/replay-unsupported-update.exception.d.ts +3 -0
- package/dist/debugger/errors/replay-unsupported-update.exception.js +3 -0
- package/dist/debugger/index.d.ts +31 -0
- package/dist/debugger/index.js +31 -0
- package/dist/debugger/ledger-replay-debugger-client.d.ts +31 -0
- package/dist/debugger/ledger-replay-debugger-client.js +53 -0
- package/dist/debugger/replay/ledger-replay-environment-builder.d.ts +95 -0
- package/dist/debugger/replay/ledger-replay-environment-builder.js +249 -0
- package/dist/debugger/replay/ledger-replay-session-loader.d.ts +78 -0
- package/dist/debugger/replay/ledger-replay-session-loader.js +565 -0
- package/dist/debugger/replay/replay-artifact-resolver.d.ts +30 -0
- package/dist/debugger/replay/replay-artifact-resolver.js +210 -0
- package/dist/debugger/replay/replay-determinism-validator.d.ts +12 -0
- package/dist/debugger/replay/replay-determinism-validator.js +161 -0
- package/dist/debugger/replay/replay-entrypoint-definition-resolver.d.ts +40 -0
- package/dist/debugger/replay/replay-entrypoint-definition-resolver.js +337 -0
- package/dist/debugger/replay/replay-entrypoint.d.ts +22 -0
- package/dist/debugger/replay/replay-entrypoint.js +14 -0
- package/dist/debugger/replay/replay-ledger-value-normalizer.d.ts +7 -0
- package/dist/debugger/replay/replay-ledger-value-normalizer.js +194 -0
- package/dist/debugger/replay/replay-update-loader.d.ts +24 -0
- package/dist/debugger/replay/replay-update-loader.js +94 -0
- package/dist/debugger/replay/replay-update-visibility-validator.d.ts +19 -0
- package/dist/debugger/replay/replay-update-visibility-validator.js +19 -0
- package/dist/debugger/session/in-memory-replay-session-store.d.ts +27 -0
- package/dist/debugger/session/in-memory-replay-session-store.js +109 -0
- package/dist/debugger/session/replay-phase.d.ts +7 -0
- package/dist/debugger/session/replay-phase.js +8 -0
- package/dist/debugger/session/replay-scope.d.ts +10 -0
- package/dist/debugger/session/replay-scope.js +10 -0
- package/dist/debugger/session/replay-session-metadata.d.ts +10 -0
- package/dist/debugger/session/replay-session-metadata.js +10 -0
- package/dist/debugger/session/replay-session-request.d.ts +6 -0
- package/dist/debugger/session/replay-session-request.js +10 -0
- package/dist/debugger/session/replay-session.d.ts +12 -0
- package/dist/debugger/session/replay-session.js +10 -0
- package/dist/debugger/session/replay-source-location.d.ts +17 -0
- package/dist/debugger/session/replay-source-location.js +16 -0
- package/dist/debugger/session/replay-stack-frame.d.ts +8 -0
- package/dist/debugger/session/replay-stack-frame.js +8 -0
- package/dist/debugger/session/replay-state-delta.d.ts +29 -0
- package/dist/debugger/session/replay-state-delta.js +24 -0
- package/dist/debugger/session/replay-step-advance-result.d.ts +24 -0
- package/dist/debugger/session/replay-step-advance-result.js +16 -0
- package/dist/debugger/session/replay-step.d.ts +30 -0
- package/dist/debugger/session/replay-step.js +24 -0
- package/dist/debugger/session/replay-value-preview.d.ts +8 -0
- package/dist/debugger/session/replay-value-preview.js +15 -0
- package/dist/debugger/source/daml-source-mapper.d.ts +12 -0
- package/dist/debugger/source/daml-source-mapper.js +21 -0
- package/dist/debugger/source/dar-source-map-metadata.d.ts +26 -0
- package/dist/debugger/source/dar-source-map-metadata.js +10 -0
- package/dist/debugger/source/source-coverage-validator.d.ts +8 -0
- package/dist/debugger/source/source-coverage-validator.js +16 -0
- package/dist/debugger/source/source-indexed-compilation.d.ts +45 -0
- package/dist/debugger/source/source-indexed-compilation.js +110 -0
- package/dist/debugger/source/source-mapping-precision.d.ts +5 -0
- package/dist/debugger/source/source-mapping-precision.js +4 -0
- package/dist/index.d.ts +20 -0
- package/dist/index.js +12 -0
- package/dist/query/cache/memory-query-cache.d.ts +9 -0
- package/dist/query/cache/memory-query-cache.js +24 -0
- package/dist/query/cache/query-cache-store.d.ts +5 -0
- package/dist/query/cache/query-cache-store.js +1 -0
- package/dist/query/canton-manager-options.d.ts +17 -0
- package/dist/query/canton-manager-options.js +1 -0
- package/dist/query/canton-manager.d.ts +11 -0
- package/dist/query/canton-manager.js +42 -0
- package/dist/query/errors/pqs-query-error.d.ts +10 -0
- package/dist/query/errors/pqs-query-error.js +11 -0
- package/dist/query/errors/pqs-schema-profile-error.d.ts +3 -0
- package/dist/query/errors/pqs-schema-profile-error.js +3 -0
- package/dist/query/errors/query-capability-error.d.ts +7 -0
- package/dist/query/errors/query-capability-error.js +10 -0
- package/dist/query/grpc/grpc-contract-query-client.d.ts +32 -0
- package/dist/query/grpc/grpc-contract-query-client.js +126 -0
- package/dist/query/model-types.d.ts +258 -0
- package/dist/query/model-types.js +14 -0
- package/dist/query/pqs/pqs-pool.d.ts +13 -0
- package/dist/query/pqs/pqs-pool.js +18 -0
- package/dist/query/pqs/pqs-query-client.d.ts +49 -0
- package/dist/query/pqs/pqs-query-client.js +324 -0
- package/dist/query/pqs/pqs-schema-profile.d.ts +25 -0
- package/dist/query/pqs/pqs-schema-profile.js +120 -0
- package/dist/query/pqs/pqs-sql-compiler.d.ts +7 -0
- package/dist/query/pqs/pqs-sql-compiler.js +132 -0
- package/dist/query/pqs/read-only-sql.d.ts +1 -0
- package/dist/query/pqs/read-only-sql.js +35 -0
- package/dist/query/query-client.d.ts +61 -0
- package/dist/query/query-client.js +1 -0
- package/dist/query/query-source.d.ts +4 -0
- package/dist/query/query-source.js +5 -0
- package/dist/services/commands/command-payload-builder.js +3 -3
- package/dist/services/commands/command-submission-pipeline.js +1 -7
- package/dist/services/party-management/decentralized-party-lifecycle.d.ts +6 -0
- package/dist/services/party-management/decentralized-party-lifecycle.js +82 -0
- package/dist/services/party-management/party-management-service-client.d.ts +16 -1
- package/dist/services/party-management/party-management-service-client.js +142 -1
- package/dist/services/topology-manager-write/topology-signed-transaction-assembler.js +4 -0
- package/dist/testing/campaign/campaign-artifact.d.ts +20 -0
- package/dist/testing/campaign/campaign-artifact.js +147 -0
- package/dist/testing/campaign/campaign-definition.d.ts +9 -0
- package/dist/testing/campaign/campaign-definition.js +78 -0
- package/dist/testing/campaign/campaign-metrics.d.ts +32 -0
- package/dist/testing/campaign/campaign-metrics.js +26 -0
- package/dist/testing/campaign/campaign-model.d.ts +11 -0
- package/dist/testing/campaign/campaign-model.js +21 -0
- package/dist/testing/campaign/campaign-runner.d.ts +99 -0
- package/dist/testing/campaign/campaign-runner.js +194 -0
- package/dist/testing/campaign/campaign-scheduler.d.ts +40 -0
- package/dist/testing/campaign/campaign-scheduler.js +75 -0
- package/dist/testing/campaign/campaign-types.d.ts +52 -0
- package/dist/testing/campaign/campaign-types.js +11 -0
- package/dist/testing/daml/daml-action-arbitrary.d.ts +13 -0
- package/dist/testing/daml/daml-action-arbitrary.js +24 -0
- package/dist/testing/daml/daml-choice-action-arbitrary.d.ts +18 -0
- package/dist/testing/daml/daml-choice-action-arbitrary.js +27 -0
- package/dist/testing/daml/daml-create-action-arbitrary.d.ts +19 -0
- package/dist/testing/daml/daml-create-action-arbitrary.js +34 -0
- package/dist/testing/daml/daml-testing-catalog.d.ts +38 -0
- package/dist/testing/daml/daml-testing-catalog.js +40 -0
- package/dist/testing/daml/daml-value-arbitrary.d.ts +8 -0
- package/dist/testing/daml/daml-value-arbitrary.js +43 -0
- package/dist/testing/daml/declarative-campaign-arbitrary.d.ts +15 -0
- package/dist/testing/daml/declarative-campaign-arbitrary.js +30 -0
- package/dist/testing/errors/invariant-campaign-failure.d.ts +24 -0
- package/dist/testing/errors/invariant-campaign-failure.js +37 -0
- package/dist/testing/errors/testing-configuration-error.d.ts +3 -0
- package/dist/testing/errors/testing-configuration-error.js +6 -0
- package/dist/testing/handlers/handler.d.ts +19 -0
- package/dist/testing/handlers/handler.js +31 -0
- package/dist/testing/index.d.ts +22 -0
- package/dist/testing/index.js +22 -0
- package/dist/testing/runtime/campaign-isolation.d.ts +14 -0
- package/dist/testing/runtime/campaign-isolation.js +23 -0
- package/dist/testing/runtime/canton-test-runtime.d.ts +58 -0
- package/dist/testing/runtime/canton-test-runtime.js +138 -0
- package/dist/testing/runtime/declarative-action-executor.d.ts +16 -0
- package/dist/testing/runtime/declarative-action-executor.js +41 -0
- package/dist/testing/targets/target.d.ts +49 -0
- package/dist/testing/targets/target.js +121 -0
- package/dist/transports/grpc/grpc-channel-factory.d.ts +4 -0
- package/dist/transports/grpc/grpc-channel-factory.js +42 -1
- package/dist/transports/grpc/grpc-transport.d.ts +2 -2
- package/dist/transports/grpc/grpc-transport.js +42 -3
- package/dist/transports/grpc/mappers/commands-mapper.d.ts +10 -2
- package/dist/transports/grpc/mappers/commands-mapper.js +30 -12
- package/dist/transports/grpc/mappers/contracts-mapper.d.ts +3 -1
- package/dist/transports/grpc/mappers/contracts-mapper.js +16 -3
- package/dist/transports/grpc/mappers/interactive-command-mapper.d.ts +15 -0
- package/dist/transports/grpc/mappers/interactive-command-mapper.js +54 -0
- package/dist/transports/grpc/mappers/topology-manager-write-mapper.js +59 -1
- package/dist/transports/json/json-transport.d.ts +2 -2
- package/dist/transports/json/json-transport.js +2 -2
- package/dist/transports/json/mappers/commands-mapper.js +23 -9
- package/node/.generated/start-local/additional-config.extra-participants.conf +37 -0
- package/node/.generated/start-local/additional-config.extra-validators.conf +35 -0
- package/node/.generated/start-local/compose-extra-participants.yaml +147 -0
- package/node/.generated/start-local/extra-participants.env +30 -0
- package/node/es256-jwt.mjs +177 -0
- package/node/start-local.sh +886 -0
- package/node/stop-local.sh +200 -0
- package/node/test-start-local.sh +354 -0
- package/node/test-stop-local.sh +112 -0
- package/package.json +21 -2
|
@@ -0,0 +1,337 @@
|
|
|
1
|
+
import { DamlLfExpression } from "../../daml-lf/model/daml-lf-expression.js";
|
|
2
|
+
import { DamlLfType } from "../../daml-lf/model/daml-lf-type.js";
|
|
3
|
+
import { DamlLfValueDefinition } from "../../daml-lf/model/daml-lf-value-definition.js";
|
|
4
|
+
import { DamlLfTemplateId } from "../../daml-lf/model/daml-lf-template-id.js";
|
|
5
|
+
import { ReplaySourceMapException } from "../errors/replay-source-map.exception.js";
|
|
6
|
+
export class ReplayEntrypointDefinitionResolver {
|
|
7
|
+
indexedCompilation;
|
|
8
|
+
constructor(indexedCompilation) {
|
|
9
|
+
this.indexedCompilation = indexedCompilation;
|
|
10
|
+
}
|
|
11
|
+
resolveEntrypointDefinitionOrThrow(entrypoint) {
|
|
12
|
+
const templateId = entrypoint.templateId;
|
|
13
|
+
if (templateId?.packageId === undefined
|
|
14
|
+
|| templateId.moduleName === undefined
|
|
15
|
+
|| templateId.entityName === undefined) {
|
|
16
|
+
throw new ReplaySourceMapException("replay entrypoint is missing template identity for source resolution");
|
|
17
|
+
}
|
|
18
|
+
const packageId = templateId.packageId;
|
|
19
|
+
const moduleName = templateId.moduleName;
|
|
20
|
+
const templateName = templateId.entityName;
|
|
21
|
+
const source = entrypoint.kind === "create"
|
|
22
|
+
? this.indexedCompilation
|
|
23
|
+
.getExecutableSources()
|
|
24
|
+
.find((candidate) => this.matchesTemplate(candidate, {
|
|
25
|
+
packageId,
|
|
26
|
+
moduleName,
|
|
27
|
+
templateName,
|
|
28
|
+
})
|
|
29
|
+
&& candidate.entrypointKind === "create")
|
|
30
|
+
: this.findExerciseSourceOrThrow(new DamlLfTemplateId({
|
|
31
|
+
packageId,
|
|
32
|
+
moduleName,
|
|
33
|
+
templateName,
|
|
34
|
+
}), entrypoint.choice);
|
|
35
|
+
if (source === undefined) {
|
|
36
|
+
throw new ReplaySourceMapException(`missing executable metadata for replay entrypoint '${packageId}::${moduleName}::${templateName}'`);
|
|
37
|
+
}
|
|
38
|
+
const definition = this.indexedCompilation.compilation.getValueDefinitionOrThrow(source.packageId, source.moduleName, source.definitionName);
|
|
39
|
+
return {
|
|
40
|
+
packageId: source.packageId,
|
|
41
|
+
moduleName: source.moduleName,
|
|
42
|
+
definition,
|
|
43
|
+
entrypointArgumentRecordId: entrypoint.kind === "create"
|
|
44
|
+
? {
|
|
45
|
+
packageId,
|
|
46
|
+
moduleName,
|
|
47
|
+
entityName: templateName,
|
|
48
|
+
}
|
|
49
|
+
: this.resolveChoiceArgumentRecordId(new DamlLfTemplateId({
|
|
50
|
+
packageId,
|
|
51
|
+
moduleName,
|
|
52
|
+
templateName,
|
|
53
|
+
}), entrypoint.choice),
|
|
54
|
+
...this.resolveReplayStrategy(definition.expression, source, entrypoint.kind, entrypoint.kind === "exercise"
|
|
55
|
+
? new DamlLfTemplateId({
|
|
56
|
+
packageId,
|
|
57
|
+
moduleName,
|
|
58
|
+
templateName,
|
|
59
|
+
})
|
|
60
|
+
: undefined, entrypoint.choice),
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
resolveChoiceArgumentRecordId(templateId, choiceName) {
|
|
64
|
+
if (choiceName === undefined) {
|
|
65
|
+
return undefined;
|
|
66
|
+
}
|
|
67
|
+
try {
|
|
68
|
+
const template = this.indexedCompilation.compilation
|
|
69
|
+
.getTemplates()
|
|
70
|
+
.find((candidate) => candidate.templateId.packageId === templateId.packageId
|
|
71
|
+
&& candidate.templateId.moduleName === templateId.moduleName
|
|
72
|
+
&& candidate.templateId.templateName === templateId.templateName);
|
|
73
|
+
const choice = template?.choices.find((candidate) => candidate.name === choiceName);
|
|
74
|
+
const typeConReference = choice?.parameter.type.typeConReference;
|
|
75
|
+
return typeConReference === undefined
|
|
76
|
+
? undefined
|
|
77
|
+
: {
|
|
78
|
+
packageId: typeConReference.packageId,
|
|
79
|
+
moduleName: typeConReference.moduleName,
|
|
80
|
+
entityName: typeConReference.name,
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
catch {
|
|
84
|
+
return undefined;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
resolveChoiceDefinitionOrThrow(templateId, choiceName) {
|
|
88
|
+
const choiceReplayExpression = this.resolveChoiceReplayExpression(templateId, choiceName);
|
|
89
|
+
const source = this.findExerciseSource(templateId, choiceName);
|
|
90
|
+
if (source === undefined) {
|
|
91
|
+
if (choiceReplayExpression === undefined) {
|
|
92
|
+
throw new ReplaySourceMapException(`missing executable metadata for choice '${templateId.packageId}::${templateId.moduleName}::${templateId.templateName}::${choiceName}'`);
|
|
93
|
+
}
|
|
94
|
+
return {
|
|
95
|
+
packageId: templateId.packageId,
|
|
96
|
+
moduleName: templateId.moduleName,
|
|
97
|
+
definition: new DamlLfValueDefinition({
|
|
98
|
+
name: `${templateId.templateName}$${choiceName}`,
|
|
99
|
+
type: new DamlLfType({}),
|
|
100
|
+
expression: choiceReplayExpression,
|
|
101
|
+
}),
|
|
102
|
+
frameIdentity: {
|
|
103
|
+
packageId: templateId.packageId,
|
|
104
|
+
moduleName: templateId.moduleName,
|
|
105
|
+
},
|
|
106
|
+
replayExpression: choiceReplayExpression,
|
|
107
|
+
replayBindingMode: "templateChoice",
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
const definition = this.indexedCompilation.compilation.getValueDefinitionOrThrow(source.packageId, source.moduleName, source.definitionName);
|
|
111
|
+
return {
|
|
112
|
+
packageId: source.packageId,
|
|
113
|
+
moduleName: source.moduleName,
|
|
114
|
+
definition,
|
|
115
|
+
...this.resolveChoiceReplayStrategy(definition.expression, choiceReplayExpression, source),
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
resolveReplayStrategy(expression, source, entrypointKind, templateId, choiceName) {
|
|
119
|
+
if (entrypointKind === "exercise"
|
|
120
|
+
&& templateId !== undefined
|
|
121
|
+
&& choiceName !== undefined) {
|
|
122
|
+
const normalizedCurriedChoiceExpression = this.wrapChoiceArgumentEnvelope(this.normalizeCurriedChoiceExpression(expression), source.choiceArgumentFieldName);
|
|
123
|
+
if (normalizedCurriedChoiceExpression !== undefined) {
|
|
124
|
+
return {
|
|
125
|
+
replayExpression: normalizedCurriedChoiceExpression,
|
|
126
|
+
replayBindingMode: "templateChoice",
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
const choiceReplayExpression = this.resolveChoiceReplayExpression(templateId, choiceName);
|
|
130
|
+
if (choiceReplayExpression !== undefined
|
|
131
|
+
&& this.shouldPreferTemplateChoiceExpression(expression, source)) {
|
|
132
|
+
const replayExpression = this.wrapChoiceArgumentEnvelope(choiceReplayExpression, source.choiceArgumentFieldName);
|
|
133
|
+
return {
|
|
134
|
+
replayExpression: replayExpression ?? choiceReplayExpression,
|
|
135
|
+
replayBindingMode: "templateChoice",
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
return {
|
|
140
|
+
replayExpression: this.unwrapReplayExpression(expression, entrypointKind),
|
|
141
|
+
replayBindingMode: this.resolveReplayBindingMode(expression, entrypointKind),
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
resolveChoiceReplayExpression(templateId, choiceName) {
|
|
145
|
+
let choices;
|
|
146
|
+
let templateParameterName;
|
|
147
|
+
try {
|
|
148
|
+
const template = this.indexedCompilation.compilation
|
|
149
|
+
.getTemplates()
|
|
150
|
+
.find((candidate) => candidate.templateId.packageId === templateId.packageId
|
|
151
|
+
&& candidate.templateId.moduleName === templateId.moduleName
|
|
152
|
+
&& candidate.templateId.templateName === templateId.templateName);
|
|
153
|
+
if (template === undefined) {
|
|
154
|
+
return undefined;
|
|
155
|
+
}
|
|
156
|
+
choices = template.choices;
|
|
157
|
+
templateParameterName = template.parameterName;
|
|
158
|
+
}
|
|
159
|
+
catch {
|
|
160
|
+
return undefined;
|
|
161
|
+
}
|
|
162
|
+
const choice = choices.find((candidate) => candidate.name === choiceName);
|
|
163
|
+
if (choice?.updateExpression === undefined) {
|
|
164
|
+
return undefined;
|
|
165
|
+
}
|
|
166
|
+
return new DamlLfExpression({
|
|
167
|
+
lambda: {
|
|
168
|
+
parameters: [
|
|
169
|
+
choice.selfBinderName,
|
|
170
|
+
templateParameterName,
|
|
171
|
+
choice.parameter.name,
|
|
172
|
+
],
|
|
173
|
+
body: choice.updateExpression,
|
|
174
|
+
},
|
|
175
|
+
});
|
|
176
|
+
}
|
|
177
|
+
resolveChoiceReplayStrategy(expression, choiceReplayExpression, source) {
|
|
178
|
+
const normalizedCurriedChoiceExpression = this.wrapChoiceArgumentEnvelope(this.normalizeCurriedChoiceExpression(expression), source.choiceArgumentFieldName);
|
|
179
|
+
if (normalizedCurriedChoiceExpression !== undefined) {
|
|
180
|
+
return {
|
|
181
|
+
replayExpression: normalizedCurriedChoiceExpression,
|
|
182
|
+
replayBindingMode: "templateChoice",
|
|
183
|
+
};
|
|
184
|
+
}
|
|
185
|
+
if (choiceReplayExpression !== undefined
|
|
186
|
+
&& this.shouldPreferTemplateChoiceExpression(expression, source)) {
|
|
187
|
+
const replayExpression = this.wrapChoiceArgumentEnvelope(choiceReplayExpression, source.choiceArgumentFieldName);
|
|
188
|
+
return {
|
|
189
|
+
replayExpression: replayExpression ?? choiceReplayExpression,
|
|
190
|
+
replayBindingMode: "templateChoice",
|
|
191
|
+
};
|
|
192
|
+
}
|
|
193
|
+
return {
|
|
194
|
+
replayExpression: this.unwrapReplayExpression(expression, "exercise"),
|
|
195
|
+
replayBindingMode: this.resolveReplayBindingMode(expression, "exercise"),
|
|
196
|
+
};
|
|
197
|
+
}
|
|
198
|
+
findExerciseSource(templateId, choiceName) {
|
|
199
|
+
return this.indexedCompilation
|
|
200
|
+
.getExecutableSources()
|
|
201
|
+
.find((candidate) => this.matchesTemplate(candidate, templateId)
|
|
202
|
+
&& candidate.entrypointKind === "exercise"
|
|
203
|
+
&& candidate.choiceName === choiceName);
|
|
204
|
+
}
|
|
205
|
+
findExerciseSourceOrThrow(templateId, choiceName) {
|
|
206
|
+
const source = this.findExerciseSource(templateId, choiceName);
|
|
207
|
+
if (source !== undefined) {
|
|
208
|
+
return source;
|
|
209
|
+
}
|
|
210
|
+
throw new ReplaySourceMapException(`missing executable metadata for choice '${templateId.packageId}::${templateId.moduleName}::${templateId.templateName}::${choiceName ?? "<unknown>"}'`);
|
|
211
|
+
}
|
|
212
|
+
matchesTemplate(candidate, templateId) {
|
|
213
|
+
return (candidate.packageId === templateId.packageId
|
|
214
|
+
&& candidate.moduleName === templateId.moduleName
|
|
215
|
+
&& candidate.templateName === templateId.templateName);
|
|
216
|
+
}
|
|
217
|
+
unwrapReplayExpression(expression, entrypointKind) {
|
|
218
|
+
if (expression.recordConstruction === undefined) {
|
|
219
|
+
return expression;
|
|
220
|
+
}
|
|
221
|
+
const wrapperFieldName = entrypointKind === "create" ? "m_create" : "m_exercise";
|
|
222
|
+
const wrapperField = expression.recordConstruction.fields.find((field) => field.name === wrapperFieldName);
|
|
223
|
+
return wrapperField?.value ?? expression;
|
|
224
|
+
}
|
|
225
|
+
resolveReplayBindingMode(expression, entrypointKind) {
|
|
226
|
+
if (expression.recordConstruction === undefined) {
|
|
227
|
+
return "standard";
|
|
228
|
+
}
|
|
229
|
+
const wrapperFieldName = entrypointKind === "create" ? "m_create" : "m_exercise";
|
|
230
|
+
const wrapperField = expression.recordConstruction.fields.find((field) => field.name === wrapperFieldName);
|
|
231
|
+
const parameters = wrapperField?.value.lambda?.parameters ?? [];
|
|
232
|
+
if (entrypointKind === "exercise"
|
|
233
|
+
&& parameters.length >= 3
|
|
234
|
+
&& parameters.at(-2) === "this"
|
|
235
|
+
&& parameters.at(-1) === "arg") {
|
|
236
|
+
return "exerciseWrapper";
|
|
237
|
+
}
|
|
238
|
+
if (entrypointKind === "create"
|
|
239
|
+
&& parameters.length >= 2
|
|
240
|
+
&& parameters.at(-1) === "arg") {
|
|
241
|
+
return "createWrapper";
|
|
242
|
+
}
|
|
243
|
+
return "standard";
|
|
244
|
+
}
|
|
245
|
+
shouldPreferTemplateChoiceExpression(expression, source) {
|
|
246
|
+
return (expression.recordConstruction !== undefined
|
|
247
|
+
&& source?.choiceName !== "Archive");
|
|
248
|
+
}
|
|
249
|
+
normalizeCurriedChoiceExpression(expression) {
|
|
250
|
+
const outerParameterName = expression.lambda?.parameters[0];
|
|
251
|
+
const trailingLambda = this.extractTrailingLambda(expression.lambda?.body);
|
|
252
|
+
if (outerParameterName === undefined
|
|
253
|
+
|| expression.lambda?.parameters.length !== 1
|
|
254
|
+
|| trailingLambda === undefined
|
|
255
|
+
|| trailingLambda.parameters.length < 2) {
|
|
256
|
+
return undefined;
|
|
257
|
+
}
|
|
258
|
+
return new DamlLfExpression({
|
|
259
|
+
lambda: {
|
|
260
|
+
parameters: [
|
|
261
|
+
trailingLambda.parameters[0],
|
|
262
|
+
outerParameterName,
|
|
263
|
+
trailingLambda.parameters[1],
|
|
264
|
+
],
|
|
265
|
+
body: trailingLambda.body,
|
|
266
|
+
},
|
|
267
|
+
sourceLocation: expression.sourceLocation,
|
|
268
|
+
});
|
|
269
|
+
}
|
|
270
|
+
wrapChoiceArgumentEnvelope(expression, choiceArgumentFieldName) {
|
|
271
|
+
if (expression === undefined
|
|
272
|
+
|| choiceArgumentFieldName === undefined
|
|
273
|
+
|| expression.lambda === undefined
|
|
274
|
+
|| expression.lambda.parameters.length < 3) {
|
|
275
|
+
return expression;
|
|
276
|
+
}
|
|
277
|
+
const argumentParameterName = expression.lambda.parameters[2];
|
|
278
|
+
const envelopeParameterName = `__${argumentParameterName}Envelope`;
|
|
279
|
+
return new DamlLfExpression({
|
|
280
|
+
lambda: {
|
|
281
|
+
parameters: [
|
|
282
|
+
expression.lambda.parameters[0],
|
|
283
|
+
expression.lambda.parameters[1],
|
|
284
|
+
envelopeParameterName,
|
|
285
|
+
],
|
|
286
|
+
body: new DamlLfExpression({
|
|
287
|
+
letExpression: {
|
|
288
|
+
bindings: [
|
|
289
|
+
{
|
|
290
|
+
name: argumentParameterName,
|
|
291
|
+
value: new DamlLfExpression({
|
|
292
|
+
recordProjection: {
|
|
293
|
+
fieldName: choiceArgumentFieldName,
|
|
294
|
+
record: new DamlLfExpression({
|
|
295
|
+
variableName: envelopeParameterName,
|
|
296
|
+
}),
|
|
297
|
+
},
|
|
298
|
+
}),
|
|
299
|
+
},
|
|
300
|
+
],
|
|
301
|
+
body: expression.lambda.body,
|
|
302
|
+
},
|
|
303
|
+
sourceLocation: expression.lambda.body.sourceLocation,
|
|
304
|
+
}),
|
|
305
|
+
},
|
|
306
|
+
sourceLocation: expression.sourceLocation,
|
|
307
|
+
});
|
|
308
|
+
}
|
|
309
|
+
extractTrailingLambda(expression) {
|
|
310
|
+
if (expression === undefined) {
|
|
311
|
+
return undefined;
|
|
312
|
+
}
|
|
313
|
+
if (expression.lambda !== undefined) {
|
|
314
|
+
return {
|
|
315
|
+
parameters: expression.lambda.parameters,
|
|
316
|
+
body: expression.lambda.body,
|
|
317
|
+
};
|
|
318
|
+
}
|
|
319
|
+
if (expression.letExpression !== undefined) {
|
|
320
|
+
const trailingLambda = this.extractTrailingLambda(expression.letExpression.body);
|
|
321
|
+
if (trailingLambda === undefined) {
|
|
322
|
+
return undefined;
|
|
323
|
+
}
|
|
324
|
+
return {
|
|
325
|
+
parameters: trailingLambda.parameters,
|
|
326
|
+
body: new DamlLfExpression({
|
|
327
|
+
letExpression: {
|
|
328
|
+
bindings: expression.letExpression.bindings,
|
|
329
|
+
body: trailingLambda.body,
|
|
330
|
+
},
|
|
331
|
+
sourceLocation: expression.sourceLocation,
|
|
332
|
+
}),
|
|
333
|
+
};
|
|
334
|
+
}
|
|
335
|
+
return undefined;
|
|
336
|
+
}
|
|
337
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export declare class ReplayEntrypoint {
|
|
2
|
+
readonly kind: "create" | "exercise";
|
|
3
|
+
readonly templateId?: {
|
|
4
|
+
packageId?: string;
|
|
5
|
+
moduleName?: string;
|
|
6
|
+
entityName?: string;
|
|
7
|
+
};
|
|
8
|
+
readonly contractId?: string;
|
|
9
|
+
readonly choice?: string;
|
|
10
|
+
readonly argument?: unknown;
|
|
11
|
+
constructor(init: {
|
|
12
|
+
kind: "create" | "exercise";
|
|
13
|
+
templateId?: {
|
|
14
|
+
packageId?: string;
|
|
15
|
+
moduleName?: string;
|
|
16
|
+
entityName?: string;
|
|
17
|
+
};
|
|
18
|
+
contractId?: string;
|
|
19
|
+
choice?: string;
|
|
20
|
+
argument?: unknown;
|
|
21
|
+
});
|
|
22
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export class ReplayEntrypoint {
|
|
2
|
+
kind;
|
|
3
|
+
templateId;
|
|
4
|
+
contractId;
|
|
5
|
+
choice;
|
|
6
|
+
argument;
|
|
7
|
+
constructor(init) {
|
|
8
|
+
this.kind = init.kind;
|
|
9
|
+
this.templateId = init.templateId;
|
|
10
|
+
this.contractId = init.contractId;
|
|
11
|
+
this.choice = init.choice;
|
|
12
|
+
this.argument = init.argument;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare function normalizeReplayLedgerValue(value: unknown): unknown;
|
|
2
|
+
export declare function collectReplayLedgerContractIds(value: unknown): readonly string[];
|
|
3
|
+
export declare function attachReplayRecordId(value: unknown, recordId: {
|
|
4
|
+
packageId?: string;
|
|
5
|
+
moduleName?: string;
|
|
6
|
+
entityName?: string;
|
|
7
|
+
} | undefined): unknown;
|
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
import { DAML_LF_CONTRACT_ID_MARKER_KEY, DAML_LF_NUMERIC_MARKER_KEY, DAML_LF_PARTY_MARKER_KEY, DAML_LF_RECORD_ID_MARKER_KEY, } from "../../daml-lf/interpreter/daml-lf-runtime-value.js";
|
|
2
|
+
export function normalizeReplayLedgerValue(value) {
|
|
3
|
+
if (Array.isArray(value)) {
|
|
4
|
+
return value.map((item) => normalizeReplayLedgerValue(item));
|
|
5
|
+
}
|
|
6
|
+
if (value === null || value === undefined || typeof value !== "object") {
|
|
7
|
+
return value;
|
|
8
|
+
}
|
|
9
|
+
if ("sum" in value && isOneofValue(value.sum)) {
|
|
10
|
+
return normalizeOneofValue(value.sum);
|
|
11
|
+
}
|
|
12
|
+
if ("fields" in value
|
|
13
|
+
&& Array.isArray(value.fields)
|
|
14
|
+
&& value.fields.every((field) => field !== null
|
|
15
|
+
&& typeof field === "object"
|
|
16
|
+
&& "value" in field)) {
|
|
17
|
+
const normalizedRecord = Object.fromEntries(value.fields.map((field, index) => [
|
|
18
|
+
getRecordFieldKey(field, index),
|
|
19
|
+
normalizeReplayLedgerValue(field.value),
|
|
20
|
+
]));
|
|
21
|
+
const recordId = readRecordId(value);
|
|
22
|
+
return recordId === undefined
|
|
23
|
+
? normalizedRecord
|
|
24
|
+
: {
|
|
25
|
+
...normalizedRecord,
|
|
26
|
+
[DAML_LF_RECORD_ID_MARKER_KEY]: recordId,
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
return Object.fromEntries(Object.entries(value)
|
|
30
|
+
.filter(([, child]) => child !== undefined)
|
|
31
|
+
.map(([key, child]) => [key, normalizeReplayLedgerValue(child)]));
|
|
32
|
+
}
|
|
33
|
+
export function collectReplayLedgerContractIds(value) {
|
|
34
|
+
const contractIds = new Set();
|
|
35
|
+
collectContractIdsInto(value, contractIds);
|
|
36
|
+
return [...contractIds];
|
|
37
|
+
}
|
|
38
|
+
export function attachReplayRecordId(value, recordId) {
|
|
39
|
+
if (recordId === undefined
|
|
40
|
+
|| value === null
|
|
41
|
+
|| value === undefined
|
|
42
|
+
|| typeof value !== "object"
|
|
43
|
+
|| Array.isArray(value)
|
|
44
|
+
|| DAML_LF_RECORD_ID_MARKER_KEY in value) {
|
|
45
|
+
return value;
|
|
46
|
+
}
|
|
47
|
+
return {
|
|
48
|
+
...value,
|
|
49
|
+
[DAML_LF_RECORD_ID_MARKER_KEY]: recordId,
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
function isOneofValue(value) {
|
|
53
|
+
return value !== null && typeof value === "object";
|
|
54
|
+
}
|
|
55
|
+
function normalizeOneofValue(value) {
|
|
56
|
+
switch (value.oneofKind) {
|
|
57
|
+
case "unit":
|
|
58
|
+
return null;
|
|
59
|
+
case "bool":
|
|
60
|
+
case "int64":
|
|
61
|
+
case "date":
|
|
62
|
+
case "timestamp":
|
|
63
|
+
case "text":
|
|
64
|
+
return value[value.oneofKind];
|
|
65
|
+
case "numeric":
|
|
66
|
+
return {
|
|
67
|
+
[DAML_LF_NUMERIC_MARKER_KEY]: value.numeric,
|
|
68
|
+
};
|
|
69
|
+
case "party":
|
|
70
|
+
return {
|
|
71
|
+
[DAML_LF_PARTY_MARKER_KEY]: value.party,
|
|
72
|
+
};
|
|
73
|
+
case "contractId":
|
|
74
|
+
return {
|
|
75
|
+
[DAML_LF_CONTRACT_ID_MARKER_KEY]: value.contractId,
|
|
76
|
+
};
|
|
77
|
+
case "optional":
|
|
78
|
+
return normalizeOptionalValue(value.optional);
|
|
79
|
+
case "list":
|
|
80
|
+
return normalizeListValue(value.list);
|
|
81
|
+
case "textMap":
|
|
82
|
+
return normalizeTextMapValue(value.textMap);
|
|
83
|
+
case "genMap":
|
|
84
|
+
return normalizeGenMapValue(value.genMap);
|
|
85
|
+
case "record":
|
|
86
|
+
return normalizeReplayLedgerValue(value.record);
|
|
87
|
+
case "variant":
|
|
88
|
+
return {
|
|
89
|
+
constructor: readObjectString(value.variant, "constructor"),
|
|
90
|
+
value: normalizeReplayLedgerValue(readObjectProperty(value.variant, "value")),
|
|
91
|
+
};
|
|
92
|
+
case "enum":
|
|
93
|
+
return readObjectString(value.enum, "constructor");
|
|
94
|
+
default:
|
|
95
|
+
return value;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
function normalizeOptionalValue(value) {
|
|
99
|
+
if (value === null || value === undefined || typeof value !== "object") {
|
|
100
|
+
return undefined;
|
|
101
|
+
}
|
|
102
|
+
return normalizeReplayLedgerValue(readObjectProperty(value, "value"));
|
|
103
|
+
}
|
|
104
|
+
function normalizeListValue(value) {
|
|
105
|
+
if (value === null || value === undefined || typeof value !== "object") {
|
|
106
|
+
return [];
|
|
107
|
+
}
|
|
108
|
+
const elements = readObjectProperty(value, "elements");
|
|
109
|
+
return Array.isArray(elements)
|
|
110
|
+
? elements.map((element) => normalizeReplayLedgerValue(element))
|
|
111
|
+
: [];
|
|
112
|
+
}
|
|
113
|
+
function normalizeTextMapValue(value) {
|
|
114
|
+
if (value === null || value === undefined || typeof value !== "object") {
|
|
115
|
+
return {};
|
|
116
|
+
}
|
|
117
|
+
const entries = readObjectProperty(value, "entries");
|
|
118
|
+
if (!Array.isArray(entries)) {
|
|
119
|
+
return {};
|
|
120
|
+
}
|
|
121
|
+
return Object.fromEntries(entries.map((entry) => [
|
|
122
|
+
readObjectString(entry, "key"),
|
|
123
|
+
normalizeReplayLedgerValue(readObjectProperty(entry, "value")),
|
|
124
|
+
]));
|
|
125
|
+
}
|
|
126
|
+
function normalizeGenMapValue(value) {
|
|
127
|
+
if (value === null || value === undefined || typeof value !== "object") {
|
|
128
|
+
return [];
|
|
129
|
+
}
|
|
130
|
+
const entries = readObjectProperty(value, "entries");
|
|
131
|
+
if (!Array.isArray(entries)) {
|
|
132
|
+
return [];
|
|
133
|
+
}
|
|
134
|
+
return entries.map((entry) => ({
|
|
135
|
+
key: normalizeReplayLedgerValue(readObjectProperty(entry, "key")),
|
|
136
|
+
value: normalizeReplayLedgerValue(readObjectProperty(entry, "value")),
|
|
137
|
+
}));
|
|
138
|
+
}
|
|
139
|
+
function getRecordFieldKey(field, index) {
|
|
140
|
+
if (field !== null
|
|
141
|
+
&& typeof field === "object"
|
|
142
|
+
&& "label" in field
|
|
143
|
+
&& typeof field.label === "string"
|
|
144
|
+
&& field.label.length > 0) {
|
|
145
|
+
return field.label;
|
|
146
|
+
}
|
|
147
|
+
return index.toString();
|
|
148
|
+
}
|
|
149
|
+
function readObjectProperty(value, propertyName) {
|
|
150
|
+
if (value === null || value === undefined || typeof value !== "object") {
|
|
151
|
+
return undefined;
|
|
152
|
+
}
|
|
153
|
+
return value[propertyName];
|
|
154
|
+
}
|
|
155
|
+
function readObjectString(value, propertyName) {
|
|
156
|
+
const property = readObjectProperty(value, propertyName);
|
|
157
|
+
return typeof property === "string" ? property : "";
|
|
158
|
+
}
|
|
159
|
+
function readRecordId(value) {
|
|
160
|
+
const recordId = readObjectProperty(value, "recordId");
|
|
161
|
+
if (recordId === undefined || recordId === null || typeof recordId !== "object") {
|
|
162
|
+
return undefined;
|
|
163
|
+
}
|
|
164
|
+
return {
|
|
165
|
+
packageId: readOptionalObjectString(recordId, "packageId"),
|
|
166
|
+
moduleName: readOptionalObjectString(recordId, "moduleName"),
|
|
167
|
+
entityName: readOptionalObjectString(recordId, "entityName"),
|
|
168
|
+
};
|
|
169
|
+
}
|
|
170
|
+
function readOptionalObjectString(value, propertyName) {
|
|
171
|
+
const property = readObjectProperty(value, propertyName);
|
|
172
|
+
return typeof property === "string" && property.length > 0
|
|
173
|
+
? property
|
|
174
|
+
: undefined;
|
|
175
|
+
}
|
|
176
|
+
function collectContractIdsInto(value, contractIds) {
|
|
177
|
+
if (Array.isArray(value)) {
|
|
178
|
+
for (const item of value) {
|
|
179
|
+
collectContractIdsInto(item, contractIds);
|
|
180
|
+
}
|
|
181
|
+
return;
|
|
182
|
+
}
|
|
183
|
+
if (value === null || value === undefined || typeof value !== "object") {
|
|
184
|
+
return;
|
|
185
|
+
}
|
|
186
|
+
if (DAML_LF_CONTRACT_ID_MARKER_KEY in value
|
|
187
|
+
&& typeof value[DAML_LF_CONTRACT_ID_MARKER_KEY] === "string") {
|
|
188
|
+
contractIds.add(value[DAML_LF_CONTRACT_ID_MARKER_KEY]);
|
|
189
|
+
return;
|
|
190
|
+
}
|
|
191
|
+
for (const child of Object.values(value)) {
|
|
192
|
+
collectContractIdsInto(child, contractIds);
|
|
193
|
+
}
|
|
194
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { GetUpdateByOffsetRequest } from "../../core/types/requests/get-update-by-offset-request.js";
|
|
2
|
+
import { GetUpdateByOffsetResponse } from "../../core/types/responses/get-update-by-offset-response.js";
|
|
3
|
+
import { ReplayEntrypoint } from "./replay-entrypoint.js";
|
|
4
|
+
interface IReplayUpdateService {
|
|
5
|
+
getUpdateByOffsetAsync(request: GetUpdateByOffsetRequest): Promise<GetUpdateByOffsetResponse>;
|
|
6
|
+
}
|
|
7
|
+
export declare class ReplayUpdateLoader {
|
|
8
|
+
private readonly dependencies;
|
|
9
|
+
constructor(dependencies: {
|
|
10
|
+
updateService: IReplayUpdateService;
|
|
11
|
+
visibleParties?: readonly string[];
|
|
12
|
+
});
|
|
13
|
+
loadOrThrowAsync(offset: string): Promise<{
|
|
14
|
+
kind: "transaction";
|
|
15
|
+
offset: string;
|
|
16
|
+
updateId?: string;
|
|
17
|
+
actAs?: readonly string[];
|
|
18
|
+
readAs?: readonly string[];
|
|
19
|
+
events: readonly unknown[];
|
|
20
|
+
entrypoint: ReplayEntrypoint;
|
|
21
|
+
}>;
|
|
22
|
+
private deriveEntrypointOrThrow;
|
|
23
|
+
}
|
|
24
|
+
export {};
|