"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
  for (var name in all)
    __defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
  if (from && typeof from === "object" || typeof from === "function") {
    for (let key of __getOwnPropNames(from))
      if (!__hasOwnProp.call(to, key) && key !== except)
        __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
  }
  return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var update_service_exports = {};
__export(update_service_exports, {
  GetTransactionByIdRequest: () => GetTransactionByIdRequest,
  GetTransactionByOffsetRequest: () => GetTransactionByOffsetRequest,
  GetTransactionResponse: () => GetTransactionResponse,
  GetTransactionTreeResponse: () => GetTransactionTreeResponse,
  GetUpdateByIdRequest: () => GetUpdateByIdRequest,
  GetUpdateByOffsetRequest: () => GetUpdateByOffsetRequest,
  GetUpdateResponse: () => GetUpdateResponse,
  GetUpdateTreesResponse: () => GetUpdateTreesResponse,
  GetUpdatesRequest: () => GetUpdatesRequest,
  GetUpdatesResponse: () => GetUpdatesResponse,
  UpdateService: () => UpdateService
});
module.exports = __toCommonJS(update_service_exports);
var import_runtime_rpc = require("@protobuf-ts/runtime-rpc");
var import_runtime = require("@protobuf-ts/runtime");
var import_runtime2 = require("@protobuf-ts/runtime");
var import_runtime3 = require("@protobuf-ts/runtime");
var import_runtime4 = require("@protobuf-ts/runtime");
var import_transaction_filter = require("./transaction_filter.cjs");
var import_transaction = require("./transaction.cjs");
var import_topology_transaction = require("./topology_transaction.cjs");
var import_offset_checkpoint = require("./offset_checkpoint.cjs");
var import_reassignment = require("./reassignment.cjs");
var import_transaction2 = require("./transaction.cjs");
var import_transaction_filter2 = require("./transaction_filter.cjs");
var import_transaction_filter3 = require("./transaction_filter.cjs");
class GetUpdatesRequest$Type extends import_runtime4.MessageType {
  constructor() {
    super("com.daml.ledger.api.v2.GetUpdatesRequest", [
      {
        no: 1,
        name: "begin_exclusive",
        kind: "scalar",
        T: 3,
        L: 0
      },
      {
        no: 2,
        name: "end_inclusive",
        kind: "scalar",
        opt: true,
        T: 3,
        L: 0
      },
      {
        no: 3,
        name: "filter",
        kind: "message",
        T: () => import_transaction_filter3.TransactionFilter
      },
      {
        no: 4,
        name: "verbose",
        kind: "scalar",
        T: 8
      },
      {
        no: 5,
        name: "update_format",
        kind: "message",
        T: () => import_transaction_filter2.UpdateFormat
      }
    ]);
  }
  create(value) {
    const message = globalThis.Object.create(this.messagePrototype);
    message.beginExclusive = 0n;
    message.verbose = false;
    if (value !== void 0)
      (0, import_runtime3.reflectionMergePartial)(this, message, value);
    return message;
  }
  internalBinaryRead(reader, length, options, target) {
    let message = target ?? this.create(), end = reader.pos + length;
    while (reader.pos < end) {
      let [fieldNo, wireType] = reader.tag();
      switch (fieldNo) {
        case /* int64 begin_exclusive */
        1:
          message.beginExclusive = reader.int64().toBigInt();
          break;
        case /* optional int64 end_inclusive */
        2:
          message.endInclusive = reader.int64().toBigInt();
          break;
        case /* com.daml.ledger.api.v2.TransactionFilter filter = 3 [deprecated = true] */
        3:
          message.filter = import_transaction_filter3.TransactionFilter.internalBinaryRead(
            reader,
            reader.uint32(),
            options,
            message.filter
          );
          break;
        case /* bool verbose = 4 [deprecated = true] */
        4:
          message.verbose = reader.bool();
          break;
        case /* com.daml.ledger.api.v2.UpdateFormat update_format */
        5:
          message.updateFormat = import_transaction_filter2.UpdateFormat.internalBinaryRead(
            reader,
            reader.uint32(),
            options,
            message.updateFormat
          );
          break;
        default:
          let u = options.readUnknownField;
          if (u === "throw")
            throw new globalThis.Error(
              `Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`
            );
          let d = reader.skip(wireType);
          if (u !== false)
            (u === true ? import_runtime2.UnknownFieldHandler.onRead : u)(
              this.typeName,
              message,
              fieldNo,
              wireType,
              d
            );
      }
    }
    return message;
  }
  internalBinaryWrite(message, writer, options) {
    if (message.beginExclusive !== 0n)
      writer.tag(1, import_runtime.WireType.Varint).int64(message.beginExclusive);
    if (message.endInclusive !== void 0)
      writer.tag(2, import_runtime.WireType.Varint).int64(message.endInclusive);
    if (message.filter)
      import_transaction_filter3.TransactionFilter.internalBinaryWrite(
        message.filter,
        writer.tag(3, import_runtime.WireType.LengthDelimited).fork(),
        options
      ).join();
    if (message.verbose !== false)
      writer.tag(4, import_runtime.WireType.Varint).bool(message.verbose);
    if (message.updateFormat)
      import_transaction_filter2.UpdateFormat.internalBinaryWrite(
        message.updateFormat,
        writer.tag(5, import_runtime.WireType.LengthDelimited).fork(),
        options
      ).join();
    let u = options.writeUnknownFields;
    if (u !== false)
      (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(
        this.typeName,
        message,
        writer
      );
    return writer;
  }
}
const GetUpdatesRequest = new GetUpdatesRequest$Type();
class GetUpdatesResponse$Type extends import_runtime4.MessageType {
  constructor() {
    super("com.daml.ledger.api.v2.GetUpdatesResponse", [
      {
        no: 1,
        name: "transaction",
        kind: "message",
        oneof: "update",
        T: () => import_transaction2.Transaction
      },
      {
        no: 2,
        name: "reassignment",
        kind: "message",
        oneof: "update",
        T: () => import_reassignment.Reassignment
      },
      {
        no: 3,
        name: "offset_checkpoint",
        kind: "message",
        oneof: "update",
        T: () => import_offset_checkpoint.OffsetCheckpoint
      },
      {
        no: 4,
        name: "topology_transaction",
        kind: "message",
        oneof: "update",
        T: () => import_topology_transaction.TopologyTransaction
      }
    ]);
  }
  create(value) {
    const message = globalThis.Object.create(this.messagePrototype);
    message.update = { oneofKind: void 0 };
    if (value !== void 0)
      (0, import_runtime3.reflectionMergePartial)(this, message, value);
    return message;
  }
  internalBinaryRead(reader, length, options, target) {
    let message = target ?? this.create(), end = reader.pos + length;
    while (reader.pos < end) {
      let [fieldNo, wireType] = reader.tag();
      switch (fieldNo) {
        case /* com.daml.ledger.api.v2.Transaction transaction */
        1:
          message.update = {
            oneofKind: "transaction",
            transaction: import_transaction2.Transaction.internalBinaryRead(
              reader,
              reader.uint32(),
              options,
              message.update.transaction
            )
          };
          break;
        case /* com.daml.ledger.api.v2.Reassignment reassignment */
        2:
          message.update = {
            oneofKind: "reassignment",
            reassignment: import_reassignment.Reassignment.internalBinaryRead(
              reader,
              reader.uint32(),
              options,
              message.update.reassignment
            )
          };
          break;
        case /* com.daml.ledger.api.v2.OffsetCheckpoint offset_checkpoint */
        3:
          message.update = {
            oneofKind: "offsetCheckpoint",
            offsetCheckpoint: import_offset_checkpoint.OffsetCheckpoint.internalBinaryRead(
              reader,
              reader.uint32(),
              options,
              message.update.offsetCheckpoint
            )
          };
          break;
        case /* com.daml.ledger.api.v2.TopologyTransaction topology_transaction */
        4:
          message.update = {
            oneofKind: "topologyTransaction",
            topologyTransaction: import_topology_transaction.TopologyTransaction.internalBinaryRead(
              reader,
              reader.uint32(),
              options,
              message.update.topologyTransaction
            )
          };
          break;
        default:
          let u = options.readUnknownField;
          if (u === "throw")
            throw new globalThis.Error(
              `Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`
            );
          let d = reader.skip(wireType);
          if (u !== false)
            (u === true ? import_runtime2.UnknownFieldHandler.onRead : u)(
              this.typeName,
              message,
              fieldNo,
              wireType,
              d
            );
      }
    }
    return message;
  }
  internalBinaryWrite(message, writer, options) {
    if (message.update.oneofKind === "transaction")
      import_transaction2.Transaction.internalBinaryWrite(
        message.update.transaction,
        writer.tag(1, import_runtime.WireType.LengthDelimited).fork(),
        options
      ).join();
    if (message.update.oneofKind === "reassignment")
      import_reassignment.Reassignment.internalBinaryWrite(
        message.update.reassignment,
        writer.tag(2, import_runtime.WireType.LengthDelimited).fork(),
        options
      ).join();
    if (message.update.oneofKind === "offsetCheckpoint")
      import_offset_checkpoint.OffsetCheckpoint.internalBinaryWrite(
        message.update.offsetCheckpoint,
        writer.tag(3, import_runtime.WireType.LengthDelimited).fork(),
        options
      ).join();
    if (message.update.oneofKind === "topologyTransaction")
      import_topology_transaction.TopologyTransaction.internalBinaryWrite(
        message.update.topologyTransaction,
        writer.tag(4, import_runtime.WireType.LengthDelimited).fork(),
        options
      ).join();
    let u = options.writeUnknownFields;
    if (u !== false)
      (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(
        this.typeName,
        message,
        writer
      );
    return writer;
  }
}
const GetUpdatesResponse = new GetUpdatesResponse$Type();
class GetUpdateTreesResponse$Type extends import_runtime4.MessageType {
  constructor() {
    super("com.daml.ledger.api.v2.GetUpdateTreesResponse", [
      {
        no: 1,
        name: "transaction_tree",
        kind: "message",
        oneof: "update",
        T: () => import_transaction.TransactionTree
      },
      {
        no: 2,
        name: "reassignment",
        kind: "message",
        oneof: "update",
        T: () => import_reassignment.Reassignment
      },
      {
        no: 3,
        name: "offset_checkpoint",
        kind: "message",
        oneof: "update",
        T: () => import_offset_checkpoint.OffsetCheckpoint
      }
    ]);
  }
  create(value) {
    const message = globalThis.Object.create(this.messagePrototype);
    message.update = { oneofKind: void 0 };
    if (value !== void 0)
      (0, import_runtime3.reflectionMergePartial)(this, message, value);
    return message;
  }
  internalBinaryRead(reader, length, options, target) {
    let message = target ?? this.create(), end = reader.pos + length;
    while (reader.pos < end) {
      let [fieldNo, wireType] = reader.tag();
      switch (fieldNo) {
        case /* com.daml.ledger.api.v2.TransactionTree transaction_tree */
        1:
          message.update = {
            oneofKind: "transactionTree",
            transactionTree: import_transaction.TransactionTree.internalBinaryRead(
              reader,
              reader.uint32(),
              options,
              message.update.transactionTree
            )
          };
          break;
        case /* com.daml.ledger.api.v2.Reassignment reassignment */
        2:
          message.update = {
            oneofKind: "reassignment",
            reassignment: import_reassignment.Reassignment.internalBinaryRead(
              reader,
              reader.uint32(),
              options,
              message.update.reassignment
            )
          };
          break;
        case /* com.daml.ledger.api.v2.OffsetCheckpoint offset_checkpoint */
        3:
          message.update = {
            oneofKind: "offsetCheckpoint",
            offsetCheckpoint: import_offset_checkpoint.OffsetCheckpoint.internalBinaryRead(
              reader,
              reader.uint32(),
              options,
              message.update.offsetCheckpoint
            )
          };
          break;
        default:
          let u = options.readUnknownField;
          if (u === "throw")
            throw new globalThis.Error(
              `Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`
            );
          let d = reader.skip(wireType);
          if (u !== false)
            (u === true ? import_runtime2.UnknownFieldHandler.onRead : u)(
              this.typeName,
              message,
              fieldNo,
              wireType,
              d
            );
      }
    }
    return message;
  }
  internalBinaryWrite(message, writer, options) {
    if (message.update.oneofKind === "transactionTree")
      import_transaction.TransactionTree.internalBinaryWrite(
        message.update.transactionTree,
        writer.tag(1, import_runtime.WireType.LengthDelimited).fork(),
        options
      ).join();
    if (message.update.oneofKind === "reassignment")
      import_reassignment.Reassignment.internalBinaryWrite(
        message.update.reassignment,
        writer.tag(2, import_runtime.WireType.LengthDelimited).fork(),
        options
      ).join();
    if (message.update.oneofKind === "offsetCheckpoint")
      import_offset_checkpoint.OffsetCheckpoint.internalBinaryWrite(
        message.update.offsetCheckpoint,
        writer.tag(3, import_runtime.WireType.LengthDelimited).fork(),
        options
      ).join();
    let u = options.writeUnknownFields;
    if (u !== false)
      (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(
        this.typeName,
        message,
        writer
      );
    return writer;
  }
}
const GetUpdateTreesResponse = new GetUpdateTreesResponse$Type();
class GetTransactionByOffsetRequest$Type extends import_runtime4.MessageType {
  constructor() {
    super("com.daml.ledger.api.v2.GetTransactionByOffsetRequest", [
      {
        no: 1,
        name: "offset",
        kind: "scalar",
        T: 3,
        L: 0
      },
      {
        no: 2,
        name: "requesting_parties",
        kind: "scalar",
        repeat: 2,
        T: 9
      },
      {
        no: 3,
        name: "transaction_format",
        kind: "message",
        T: () => import_transaction_filter.TransactionFormat
      }
    ]);
  }
  create(value) {
    const message = globalThis.Object.create(this.messagePrototype);
    message.offset = 0n;
    message.requestingParties = [];
    if (value !== void 0)
      (0, import_runtime3.reflectionMergePartial)(
        this,
        message,
        value
      );
    return message;
  }
  internalBinaryRead(reader, length, options, target) {
    let message = target ?? this.create(), end = reader.pos + length;
    while (reader.pos < end) {
      let [fieldNo, wireType] = reader.tag();
      switch (fieldNo) {
        case /* int64 offset */
        1:
          message.offset = reader.int64().toBigInt();
          break;
        case /* repeated string requesting_parties */
        2:
          message.requestingParties.push(reader.string());
          break;
        case /* com.daml.ledger.api.v2.TransactionFormat transaction_format */
        3:
          message.transactionFormat = import_transaction_filter.TransactionFormat.internalBinaryRead(
            reader,
            reader.uint32(),
            options,
            message.transactionFormat
          );
          break;
        default:
          let u = options.readUnknownField;
          if (u === "throw")
            throw new globalThis.Error(
              `Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`
            );
          let d = reader.skip(wireType);
          if (u !== false)
            (u === true ? import_runtime2.UnknownFieldHandler.onRead : u)(
              this.typeName,
              message,
              fieldNo,
              wireType,
              d
            );
      }
    }
    return message;
  }
  internalBinaryWrite(message, writer, options) {
    if (message.offset !== 0n)
      writer.tag(1, import_runtime.WireType.Varint).int64(message.offset);
    for (let i = 0; i < message.requestingParties.length; i++)
      writer.tag(2, import_runtime.WireType.LengthDelimited).string(message.requestingParties[i]);
    if (message.transactionFormat)
      import_transaction_filter.TransactionFormat.internalBinaryWrite(
        message.transactionFormat,
        writer.tag(3, import_runtime.WireType.LengthDelimited).fork(),
        options
      ).join();
    let u = options.writeUnknownFields;
    if (u !== false)
      (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(
        this.typeName,
        message,
        writer
      );
    return writer;
  }
}
const GetTransactionByOffsetRequest = new GetTransactionByOffsetRequest$Type();
class GetTransactionByIdRequest$Type extends import_runtime4.MessageType {
  constructor() {
    super("com.daml.ledger.api.v2.GetTransactionByIdRequest", [
      {
        no: 1,
        name: "update_id",
        kind: "scalar",
        T: 9
      },
      {
        no: 2,
        name: "requesting_parties",
        kind: "scalar",
        repeat: 2,
        T: 9
      },
      {
        no: 3,
        name: "transaction_format",
        kind: "message",
        T: () => import_transaction_filter.TransactionFormat
      }
    ]);
  }
  create(value) {
    const message = globalThis.Object.create(this.messagePrototype);
    message.updateId = "";
    message.requestingParties = [];
    if (value !== void 0)
      (0, import_runtime3.reflectionMergePartial)(
        this,
        message,
        value
      );
    return message;
  }
  internalBinaryRead(reader, length, options, target) {
    let message = target ?? this.create(), end = reader.pos + length;
    while (reader.pos < end) {
      let [fieldNo, wireType] = reader.tag();
      switch (fieldNo) {
        case /* string update_id */
        1:
          message.updateId = reader.string();
          break;
        case /* repeated string requesting_parties */
        2:
          message.requestingParties.push(reader.string());
          break;
        case /* com.daml.ledger.api.v2.TransactionFormat transaction_format */
        3:
          message.transactionFormat = import_transaction_filter.TransactionFormat.internalBinaryRead(
            reader,
            reader.uint32(),
            options,
            message.transactionFormat
          );
          break;
        default:
          let u = options.readUnknownField;
          if (u === "throw")
            throw new globalThis.Error(
              `Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`
            );
          let d = reader.skip(wireType);
          if (u !== false)
            (u === true ? import_runtime2.UnknownFieldHandler.onRead : u)(
              this.typeName,
              message,
              fieldNo,
              wireType,
              d
            );
      }
    }
    return message;
  }
  internalBinaryWrite(message, writer, options) {
    if (message.updateId !== "")
      writer.tag(1, import_runtime.WireType.LengthDelimited).string(message.updateId);
    for (let i = 0; i < message.requestingParties.length; i++)
      writer.tag(2, import_runtime.WireType.LengthDelimited).string(message.requestingParties[i]);
    if (message.transactionFormat)
      import_transaction_filter.TransactionFormat.internalBinaryWrite(
        message.transactionFormat,
        writer.tag(3, import_runtime.WireType.LengthDelimited).fork(),
        options
      ).join();
    let u = options.writeUnknownFields;
    if (u !== false)
      (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(
        this.typeName,
        message,
        writer
      );
    return writer;
  }
}
const GetTransactionByIdRequest = new GetTransactionByIdRequest$Type();
class GetTransactionTreeResponse$Type extends import_runtime4.MessageType {
  constructor() {
    super("com.daml.ledger.api.v2.GetTransactionTreeResponse", [
      {
        no: 1,
        name: "transaction",
        kind: "message",
        T: () => import_transaction.TransactionTree
      }
    ]);
  }
  create(value) {
    const message = globalThis.Object.create(this.messagePrototype);
    if (value !== void 0)
      (0, import_runtime3.reflectionMergePartial)(
        this,
        message,
        value
      );
    return message;
  }
  internalBinaryRead(reader, length, options, target) {
    let message = target ?? this.create(), end = reader.pos + length;
    while (reader.pos < end) {
      let [fieldNo, wireType] = reader.tag();
      switch (fieldNo) {
        case /* com.daml.ledger.api.v2.TransactionTree transaction */
        1:
          message.transaction = import_transaction.TransactionTree.internalBinaryRead(
            reader,
            reader.uint32(),
            options,
            message.transaction
          );
          break;
        default:
          let u = options.readUnknownField;
          if (u === "throw")
            throw new globalThis.Error(
              `Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`
            );
          let d = reader.skip(wireType);
          if (u !== false)
            (u === true ? import_runtime2.UnknownFieldHandler.onRead : u)(
              this.typeName,
              message,
              fieldNo,
              wireType,
              d
            );
      }
    }
    return message;
  }
  internalBinaryWrite(message, writer, options) {
    if (message.transaction)
      import_transaction.TransactionTree.internalBinaryWrite(
        message.transaction,
        writer.tag(1, import_runtime.WireType.LengthDelimited).fork(),
        options
      ).join();
    let u = options.writeUnknownFields;
    if (u !== false)
      (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(
        this.typeName,
        message,
        writer
      );
    return writer;
  }
}
const GetTransactionTreeResponse = new GetTransactionTreeResponse$Type();
class GetTransactionResponse$Type extends import_runtime4.MessageType {
  constructor() {
    super("com.daml.ledger.api.v2.GetTransactionResponse", [
      {
        no: 1,
        name: "transaction",
        kind: "message",
        T: () => import_transaction2.Transaction
      }
    ]);
  }
  create(value) {
    const message = globalThis.Object.create(this.messagePrototype);
    if (value !== void 0)
      (0, import_runtime3.reflectionMergePartial)(this, message, value);
    return message;
  }
  internalBinaryRead(reader, length, options, target) {
    let message = target ?? this.create(), end = reader.pos + length;
    while (reader.pos < end) {
      let [fieldNo, wireType] = reader.tag();
      switch (fieldNo) {
        case /* com.daml.ledger.api.v2.Transaction transaction */
        1:
          message.transaction = import_transaction2.Transaction.internalBinaryRead(
            reader,
            reader.uint32(),
            options,
            message.transaction
          );
          break;
        default:
          let u = options.readUnknownField;
          if (u === "throw")
            throw new globalThis.Error(
              `Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`
            );
          let d = reader.skip(wireType);
          if (u !== false)
            (u === true ? import_runtime2.UnknownFieldHandler.onRead : u)(
              this.typeName,
              message,
              fieldNo,
              wireType,
              d
            );
      }
    }
    return message;
  }
  internalBinaryWrite(message, writer, options) {
    if (message.transaction)
      import_transaction2.Transaction.internalBinaryWrite(
        message.transaction,
        writer.tag(1, import_runtime.WireType.LengthDelimited).fork(),
        options
      ).join();
    let u = options.writeUnknownFields;
    if (u !== false)
      (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(
        this.typeName,
        message,
        writer
      );
    return writer;
  }
}
const GetTransactionResponse = new GetTransactionResponse$Type();
class GetUpdateByOffsetRequest$Type extends import_runtime4.MessageType {
  constructor() {
    super("com.daml.ledger.api.v2.GetUpdateByOffsetRequest", [
      {
        no: 1,
        name: "offset",
        kind: "scalar",
        T: 3,
        L: 0
      },
      {
        no: 2,
        name: "update_format",
        kind: "message",
        T: () => import_transaction_filter2.UpdateFormat
      }
    ]);
  }
  create(value) {
    const message = globalThis.Object.create(this.messagePrototype);
    message.offset = 0n;
    if (value !== void 0)
      (0, import_runtime3.reflectionMergePartial)(
        this,
        message,
        value
      );
    return message;
  }
  internalBinaryRead(reader, length, options, target) {
    let message = target ?? this.create(), end = reader.pos + length;
    while (reader.pos < end) {
      let [fieldNo, wireType] = reader.tag();
      switch (fieldNo) {
        case /* int64 offset */
        1:
          message.offset = reader.int64().toBigInt();
          break;
        case /* com.daml.ledger.api.v2.UpdateFormat update_format */
        2:
          message.updateFormat = import_transaction_filter2.UpdateFormat.internalBinaryRead(
            reader,
            reader.uint32(),
            options,
            message.updateFormat
          );
          break;
        default:
          let u = options.readUnknownField;
          if (u === "throw")
            throw new globalThis.Error(
              `Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`
            );
          let d = reader.skip(wireType);
          if (u !== false)
            (u === true ? import_runtime2.UnknownFieldHandler.onRead : u)(
              this.typeName,
              message,
              fieldNo,
              wireType,
              d
            );
      }
    }
    return message;
  }
  internalBinaryWrite(message, writer, options) {
    if (message.offset !== 0n)
      writer.tag(1, import_runtime.WireType.Varint).int64(message.offset);
    if (message.updateFormat)
      import_transaction_filter2.UpdateFormat.internalBinaryWrite(
        message.updateFormat,
        writer.tag(2, import_runtime.WireType.LengthDelimited).fork(),
        options
      ).join();
    let u = options.writeUnknownFields;
    if (u !== false)
      (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(
        this.typeName,
        message,
        writer
      );
    return writer;
  }
}
const GetUpdateByOffsetRequest = new GetUpdateByOffsetRequest$Type();
class GetUpdateByIdRequest$Type extends import_runtime4.MessageType {
  constructor() {
    super("com.daml.ledger.api.v2.GetUpdateByIdRequest", [
      {
        no: 1,
        name: "update_id",
        kind: "scalar",
        T: 9
      },
      {
        no: 2,
        name: "update_format",
        kind: "message",
        T: () => import_transaction_filter2.UpdateFormat
      }
    ]);
  }
  create(value) {
    const message = globalThis.Object.create(this.messagePrototype);
    message.updateId = "";
    if (value !== void 0)
      (0, import_runtime3.reflectionMergePartial)(this, message, value);
    return message;
  }
  internalBinaryRead(reader, length, options, target) {
    let message = target ?? this.create(), end = reader.pos + length;
    while (reader.pos < end) {
      let [fieldNo, wireType] = reader.tag();
      switch (fieldNo) {
        case /* string update_id */
        1:
          message.updateId = reader.string();
          break;
        case /* com.daml.ledger.api.v2.UpdateFormat update_format */
        2:
          message.updateFormat = import_transaction_filter2.UpdateFormat.internalBinaryRead(
            reader,
            reader.uint32(),
            options,
            message.updateFormat
          );
          break;
        default:
          let u = options.readUnknownField;
          if (u === "throw")
            throw new globalThis.Error(
              `Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`
            );
          let d = reader.skip(wireType);
          if (u !== false)
            (u === true ? import_runtime2.UnknownFieldHandler.onRead : u)(
              this.typeName,
              message,
              fieldNo,
              wireType,
              d
            );
      }
    }
    return message;
  }
  internalBinaryWrite(message, writer, options) {
    if (message.updateId !== "")
      writer.tag(1, import_runtime.WireType.LengthDelimited).string(message.updateId);
    if (message.updateFormat)
      import_transaction_filter2.UpdateFormat.internalBinaryWrite(
        message.updateFormat,
        writer.tag(2, import_runtime.WireType.LengthDelimited).fork(),
        options
      ).join();
    let u = options.writeUnknownFields;
    if (u !== false)
      (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(
        this.typeName,
        message,
        writer
      );
    return writer;
  }
}
const GetUpdateByIdRequest = new GetUpdateByIdRequest$Type();
class GetUpdateResponse$Type extends import_runtime4.MessageType {
  constructor() {
    super("com.daml.ledger.api.v2.GetUpdateResponse", [
      {
        no: 1,
        name: "transaction",
        kind: "message",
        oneof: "update",
        T: () => import_transaction2.Transaction
      },
      {
        no: 2,
        name: "reassignment",
        kind: "message",
        oneof: "update",
        T: () => import_reassignment.Reassignment
      },
      {
        no: 3,
        name: "topology_transaction",
        kind: "message",
        oneof: "update",
        T: () => import_topology_transaction.TopologyTransaction
      }
    ]);
  }
  create(value) {
    const message = globalThis.Object.create(this.messagePrototype);
    message.update = { oneofKind: void 0 };
    if (value !== void 0)
      (0, import_runtime3.reflectionMergePartial)(this, message, value);
    return message;
  }
  internalBinaryRead(reader, length, options, target) {
    let message = target ?? this.create(), end = reader.pos + length;
    while (reader.pos < end) {
      let [fieldNo, wireType] = reader.tag();
      switch (fieldNo) {
        case /* com.daml.ledger.api.v2.Transaction transaction */
        1:
          message.update = {
            oneofKind: "transaction",
            transaction: import_transaction2.Transaction.internalBinaryRead(
              reader,
              reader.uint32(),
              options,
              message.update.transaction
            )
          };
          break;
        case /* com.daml.ledger.api.v2.Reassignment reassignment */
        2:
          message.update = {
            oneofKind: "reassignment",
            reassignment: import_reassignment.Reassignment.internalBinaryRead(
              reader,
              reader.uint32(),
              options,
              message.update.reassignment
            )
          };
          break;
        case /* com.daml.ledger.api.v2.TopologyTransaction topology_transaction */
        3:
          message.update = {
            oneofKind: "topologyTransaction",
            topologyTransaction: import_topology_transaction.TopologyTransaction.internalBinaryRead(
              reader,
              reader.uint32(),
              options,
              message.update.topologyTransaction
            )
          };
          break;
        default:
          let u = options.readUnknownField;
          if (u === "throw")
            throw new globalThis.Error(
              `Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`
            );
          let d = reader.skip(wireType);
          if (u !== false)
            (u === true ? import_runtime2.UnknownFieldHandler.onRead : u)(
              this.typeName,
              message,
              fieldNo,
              wireType,
              d
            );
      }
    }
    return message;
  }
  internalBinaryWrite(message, writer, options) {
    if (message.update.oneofKind === "transaction")
      import_transaction2.Transaction.internalBinaryWrite(
        message.update.transaction,
        writer.tag(1, import_runtime.WireType.LengthDelimited).fork(),
        options
      ).join();
    if (message.update.oneofKind === "reassignment")
      import_reassignment.Reassignment.internalBinaryWrite(
        message.update.reassignment,
        writer.tag(2, import_runtime.WireType.LengthDelimited).fork(),
        options
      ).join();
    if (message.update.oneofKind === "topologyTransaction")
      import_topology_transaction.TopologyTransaction.internalBinaryWrite(
        message.update.topologyTransaction,
        writer.tag(3, import_runtime.WireType.LengthDelimited).fork(),
        options
      ).join();
    let u = options.writeUnknownFields;
    if (u !== false)
      (u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(
        this.typeName,
        message,
        writer
      );
    return writer;
  }
}
const GetUpdateResponse = new GetUpdateResponse$Type();
const UpdateService = new import_runtime_rpc.ServiceType(
  "com.daml.ledger.api.v2.UpdateService",
  [
    {
      name: "GetUpdates",
      serverStreaming: true,
      options: {},
      I: GetUpdatesRequest,
      O: GetUpdatesResponse
    },
    {
      name: "GetUpdateTrees",
      serverStreaming: true,
      options: {},
      I: GetUpdatesRequest,
      O: GetUpdateTreesResponse
    },
    {
      name: "GetTransactionTreeByOffset",
      options: {},
      I: GetTransactionByOffsetRequest,
      O: GetTransactionTreeResponse
    },
    {
      name: "GetTransactionTreeById",
      options: {},
      I: GetTransactionByIdRequest,
      O: GetTransactionTreeResponse
    },
    {
      name: "GetTransactionByOffset",
      options: {},
      I: GetTransactionByOffsetRequest,
      O: GetTransactionResponse
    },
    {
      name: "GetTransactionById",
      options: {},
      I: GetTransactionByIdRequest,
      O: GetTransactionResponse
    },
    {
      name: "GetUpdateByOffset",
      options: {},
      I: GetUpdateByOffsetRequest,
      O: GetUpdateResponse
    },
    {
      name: "GetUpdateById",
      options: {},
      I: GetUpdateByIdRequest,
      O: GetUpdateResponse
    }
  ]
);
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
  GetTransactionByIdRequest,
  GetTransactionByOffsetRequest,
  GetTransactionResponse,
  GetTransactionTreeResponse,
  GetUpdateByIdRequest,
  GetUpdateByOffsetRequest,
  GetUpdateResponse,
  GetUpdateTreesResponse,
  GetUpdatesRequest,
  GetUpdatesResponse,
  UpdateService
});
//# sourceMappingURL=update_service.cjs.map