@digitalasset/daml-ledger
Version:
DAML Ledger API Node.js bindings
28 lines • 1.28 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.ExerciseCommandCodec = void 0;
const IdentifierCodec_1 = require("./IdentifierCodec");
const ValueCodec_1 = require("./ValueCodec");
const commands_pb_1 = require("../generated/com/daml/ledger/api/v1/commands_pb");
exports.ExerciseCommandCodec = {
deserialize(command) {
return {
commandType: "exercise",
templateId: IdentifierCodec_1.IdentifierCodec.deserialize(command.getTemplateId()),
contractId: command.getContractId(),
choice: command.getChoice(),
argument: ValueCodec_1.ValueCodec.deserialize(command.getChoiceArgument()),
};
},
serialize(command) {
const result = new commands_pb_1.ExerciseCommand();
result.setTemplateId(IdentifierCodec_1.IdentifierCodec.serialize(command.templateId));
result.setContractId(command.contractId);
result.setChoice(command.choice);
result.setChoiceArgument(ValueCodec_1.ValueCodec.serialize(command.argument));
return result;
}
};
//# sourceMappingURL=ExerciseCommandCodec.js.map