@digitalasset/daml-ledger
Version:
DAML Ledger API Node.js bindings
36 lines • 1.49 kB
JavaScript
;
// Copyright (c) 2021 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
// SPDX-License-Identifier: Apache-2.0
Object.defineProperty(exports, "__esModule", { value: true });
exports.CommandsCodec = void 0;
const commands_pb_1 = require("../generated/com/daml/ledger/api/v1/commands_pb");
const CommandCodec_1 = require("./CommandCodec");
exports.CommandsCodec = {
deserialize(commands) {
const result = {
applicationId: commands.getApplicationId(),
commandId: commands.getCommandId(),
party: commands.getParty(),
list: commands.getCommandsList().map((command) => CommandCodec_1.CommandCodec.deserialize(command))
};
const workflowId = commands.getWorkflowId();
if (workflowId !== undefined && workflowId !== '') {
result.workflowId = workflowId;
}
return result;
},
serialize(commands) {
const result = new commands_pb_1.Commands();
result.setCommandId(commands.commandId);
result.setParty(commands.party);
result.setCommandsList(commands.list.map((command) => CommandCodec_1.CommandCodec.serialize(command)));
if (commands.workflowId) {
result.setWorkflowId(commands.workflowId);
}
if (commands.applicationId) {
result.setApplicationId(commands.applicationId);
}
return result;
}
};
//# sourceMappingURL=CommandsCodec.js.map