{"version":3,"file":"proofs.cjs","names":[],"sources":["../../../../../src/generated/cosmos/ics23/v1/proofs.ts"],"sourcesContent":["// Code generated by protoc-gen-ts_proto. DO NOT EDIT.\n// versions:\n//   protoc-gen-ts_proto  v2.8.2\n//   protoc               v5.27.1\n// source: cosmos/ics23/v1/proofs.proto\n\n/* eslint-disable */\nimport { BinaryReader, BinaryWriter } from \"@bufbuild/protobuf/wire\";\n\nexport const protobufPackage = \"cosmos.ics23.v1\";\n\nexport enum HashOp {\n  /** NO_HASH - NO_HASH is the default if no data passed. Note this is an illegal argument some places. */\n  NO_HASH = 0,\n  SHA256 = 1,\n  SHA512 = 2,\n  KECCAK = 3,\n  RIPEMD160 = 4,\n  /** BITCOIN - ripemd160(sha256(x)) */\n  BITCOIN = 5,\n  SHA512_256 = 6,\n  UNRECOGNIZED = -1,\n}\n\nexport function hashOpFromJSON(object: any): HashOp {\n  switch (object) {\n    case 0:\n    case \"NO_HASH\":\n      return HashOp.NO_HASH;\n    case 1:\n    case \"SHA256\":\n      return HashOp.SHA256;\n    case 2:\n    case \"SHA512\":\n      return HashOp.SHA512;\n    case 3:\n    case \"KECCAK\":\n      return HashOp.KECCAK;\n    case 4:\n    case \"RIPEMD160\":\n      return HashOp.RIPEMD160;\n    case 5:\n    case \"BITCOIN\":\n      return HashOp.BITCOIN;\n    case 6:\n    case \"SHA512_256\":\n      return HashOp.SHA512_256;\n    case -1:\n    case \"UNRECOGNIZED\":\n    default:\n      return HashOp.UNRECOGNIZED;\n  }\n}\n\nexport function hashOpToJSON(object: HashOp): string {\n  switch (object) {\n    case HashOp.NO_HASH:\n      return \"NO_HASH\";\n    case HashOp.SHA256:\n      return \"SHA256\";\n    case HashOp.SHA512:\n      return \"SHA512\";\n    case HashOp.KECCAK:\n      return \"KECCAK\";\n    case HashOp.RIPEMD160:\n      return \"RIPEMD160\";\n    case HashOp.BITCOIN:\n      return \"BITCOIN\";\n    case HashOp.SHA512_256:\n      return \"SHA512_256\";\n    case HashOp.UNRECOGNIZED:\n    default:\n      return \"UNRECOGNIZED\";\n  }\n}\n\n/**\n * LengthOp defines how to process the key and value of the LeafOp\n * to include length information. After encoding the length with the given\n * algorithm, the length will be prepended to the key and value bytes.\n * (Each one with it's own encoded length)\n */\nexport enum LengthOp {\n  /** NO_PREFIX - NO_PREFIX don't include any length info */\n  NO_PREFIX = 0,\n  /** VAR_PROTO - VAR_PROTO uses protobuf (and go-amino) varint encoding of the length */\n  VAR_PROTO = 1,\n  /** VAR_RLP - VAR_RLP uses rlp int encoding of the length */\n  VAR_RLP = 2,\n  /** FIXED32_BIG - FIXED32_BIG uses big-endian encoding of the length as a 32 bit integer */\n  FIXED32_BIG = 3,\n  /** FIXED32_LITTLE - FIXED32_LITTLE uses little-endian encoding of the length as a 32 bit integer */\n  FIXED32_LITTLE = 4,\n  /** FIXED64_BIG - FIXED64_BIG uses big-endian encoding of the length as a 64 bit integer */\n  FIXED64_BIG = 5,\n  /** FIXED64_LITTLE - FIXED64_LITTLE uses little-endian encoding of the length as a 64 bit integer */\n  FIXED64_LITTLE = 6,\n  /** REQUIRE_32_BYTES - REQUIRE_32_BYTES is like NONE, but will fail if the input is not exactly 32 bytes (sha256 output) */\n  REQUIRE_32_BYTES = 7,\n  /** REQUIRE_64_BYTES - REQUIRE_64_BYTES is like NONE, but will fail if the input is not exactly 64 bytes (sha512 output) */\n  REQUIRE_64_BYTES = 8,\n  UNRECOGNIZED = -1,\n}\n\nexport function lengthOpFromJSON(object: any): LengthOp {\n  switch (object) {\n    case 0:\n    case \"NO_PREFIX\":\n      return LengthOp.NO_PREFIX;\n    case 1:\n    case \"VAR_PROTO\":\n      return LengthOp.VAR_PROTO;\n    case 2:\n    case \"VAR_RLP\":\n      return LengthOp.VAR_RLP;\n    case 3:\n    case \"FIXED32_BIG\":\n      return LengthOp.FIXED32_BIG;\n    case 4:\n    case \"FIXED32_LITTLE\":\n      return LengthOp.FIXED32_LITTLE;\n    case 5:\n    case \"FIXED64_BIG\":\n      return LengthOp.FIXED64_BIG;\n    case 6:\n    case \"FIXED64_LITTLE\":\n      return LengthOp.FIXED64_LITTLE;\n    case 7:\n    case \"REQUIRE_32_BYTES\":\n      return LengthOp.REQUIRE_32_BYTES;\n    case 8:\n    case \"REQUIRE_64_BYTES\":\n      return LengthOp.REQUIRE_64_BYTES;\n    case -1:\n    case \"UNRECOGNIZED\":\n    default:\n      return LengthOp.UNRECOGNIZED;\n  }\n}\n\nexport function lengthOpToJSON(object: LengthOp): string {\n  switch (object) {\n    case LengthOp.NO_PREFIX:\n      return \"NO_PREFIX\";\n    case LengthOp.VAR_PROTO:\n      return \"VAR_PROTO\";\n    case LengthOp.VAR_RLP:\n      return \"VAR_RLP\";\n    case LengthOp.FIXED32_BIG:\n      return \"FIXED32_BIG\";\n    case LengthOp.FIXED32_LITTLE:\n      return \"FIXED32_LITTLE\";\n    case LengthOp.FIXED64_BIG:\n      return \"FIXED64_BIG\";\n    case LengthOp.FIXED64_LITTLE:\n      return \"FIXED64_LITTLE\";\n    case LengthOp.REQUIRE_32_BYTES:\n      return \"REQUIRE_32_BYTES\";\n    case LengthOp.REQUIRE_64_BYTES:\n      return \"REQUIRE_64_BYTES\";\n    case LengthOp.UNRECOGNIZED:\n    default:\n      return \"UNRECOGNIZED\";\n  }\n}\n\n/**\n * ExistenceProof takes a key and a value and a set of steps to perform on it.\n * The result of peforming all these steps will provide a \"root hash\", which can\n * be compared to the value in a header.\n *\n * Since it is computationally infeasible to produce a hash collission for any of the used\n * cryptographic hash functions, if someone can provide a series of operations to transform\n * a given key and value into a root hash that matches some trusted root, these key and values\n * must be in the referenced merkle tree.\n *\n * The only possible issue is maliablity in LeafOp, such as providing extra prefix data,\n * which should be controlled by a spec. Eg. with lengthOp as NONE,\n * prefix = FOO, key = BAR, value = CHOICE\n * and\n * prefix = F, key = OOBAR, value = CHOICE\n * would produce the same value.\n *\n * With LengthOp this is tricker but not impossible. Which is why the \"leafPrefixEqual\" field\n * in the ProofSpec is valuable to prevent this mutability. And why all trees should\n * length-prefix the data before hashing it.\n */\nexport interface ExistenceProof {\n  key: Uint8Array;\n  value: Uint8Array;\n  leaf: LeafOp | undefined;\n  path: InnerOp[];\n}\n\n/**\n * NonExistenceProof takes a proof of two neighbors, one left of the desired key,\n * one right of the desired key. If both proofs are valid AND they are neighbors,\n * then there is no valid proof for the given key.\n */\nexport interface NonExistenceProof {\n  /** TODO: remove this as unnecessary??? we prove a range */\n  key: Uint8Array;\n  left: ExistenceProof | undefined;\n  right: ExistenceProof | undefined;\n}\n\n/** CommitmentProof is either an ExistenceProof or a NonExistenceProof, or a Batch of such messages */\nexport interface CommitmentProof {\n  exist?: ExistenceProof | undefined;\n  nonexist?: NonExistenceProof | undefined;\n  batch?: BatchProof | undefined;\n  compressed?: CompressedBatchProof | undefined;\n}\n\n/**\n * LeafOp represents the raw key-value data we wish to prove, and\n * must be flexible to represent the internal transformation from\n * the original key-value pairs into the basis hash, for many existing\n * merkle trees.\n *\n * key and value are passed in. So that the signature of this operation is:\n * leafOp(key, value) -> output\n *\n * To process this, first prehash the keys and values if needed (ANY means no hash in this case):\n * hkey = prehashKey(key)\n * hvalue = prehashValue(value)\n *\n * Then combine the bytes, and hash it\n * output = hash(prefix || length(hkey) || hkey || length(hvalue) || hvalue)\n */\nexport interface LeafOp {\n  hash: HashOp;\n  prehashKey: HashOp;\n  prehashValue: HashOp;\n  length: LengthOp;\n  /**\n   * prefix is a fixed bytes that may optionally be included at the beginning to differentiate\n   * a leaf node from an inner node.\n   */\n  prefix: Uint8Array;\n}\n\n/**\n * InnerOp represents a merkle-proof step that is not a leaf.\n * It represents concatenating two children and hashing them to provide the next result.\n *\n * The result of the previous step is passed in, so the signature of this op is:\n * innerOp(child) -> output\n *\n * The result of applying InnerOp should be:\n * output = op.hash(op.prefix || child || op.suffix)\n *\n * where the || operator is concatenation of binary data,\n * and child is the result of hashing all the tree below this step.\n *\n * Any special data, like prepending child with the length, or prepending the entire operation with\n * some value to differentiate from leaf nodes, should be included in prefix and suffix.\n * If either of prefix or suffix is empty, we just treat it as an empty string\n */\nexport interface InnerOp {\n  hash: HashOp;\n  prefix: Uint8Array;\n  suffix: Uint8Array;\n}\n\n/**\n * ProofSpec defines what the expected parameters are for a given proof type.\n * This can be stored in the client and used to validate any incoming proofs.\n *\n * verify(ProofSpec, Proof) -> Proof | Error\n *\n * As demonstrated in tests, if we don't fix the algorithm used to calculate the\n * LeafHash for a given tree, there are many possible key-value pairs that can\n * generate a given hash (by interpretting the preimage differently).\n * We need this for proper security, requires client knows a priori what\n * tree format server uses. But not in code, rather a configuration object.\n */\nexport interface ProofSpec {\n  /**\n   * any field in the ExistenceProof must be the same as in this spec.\n   * except Prefix, which is just the first bytes of prefix (spec can be longer)\n   */\n  leafSpec: LeafOp | undefined;\n  innerSpec:\n    | InnerSpec\n    | undefined;\n  /** max_depth (if > 0) is the maximum number of InnerOps allowed (mainly for fixed-depth tries) */\n  maxDepth: number;\n  /** min_depth (if > 0) is the minimum number of InnerOps allowed (mainly for fixed-depth tries) */\n  minDepth: number;\n  /**\n   * prehash_key_before_comparison is a flag that indicates whether to use the\n   * prehash_key specified by LeafOp to compare lexical ordering of keys for\n   * non-existence proofs.\n   */\n  prehashKeyBeforeComparison: boolean;\n}\n\n/**\n * InnerSpec contains all store-specific structure info to determine if two proofs from a\n * given store are neighbors.\n *\n * This enables:\n *\n * isLeftMost(spec: InnerSpec, op: InnerOp)\n * isRightMost(spec: InnerSpec, op: InnerOp)\n * isLeftNeighbor(spec: InnerSpec, left: InnerOp, right: InnerOp)\n */\nexport interface InnerSpec {\n  /**\n   * Child order is the ordering of the children node, must count from 0\n   * iavl tree is [0, 1] (left then right)\n   * merk is [0, 2, 1] (left, right, here)\n   */\n  childOrder: number[];\n  childSize: number;\n  minPrefixLength: number;\n  maxPrefixLength: number;\n  /** empty child is the prehash image that is used when one child is nil (eg. 20 bytes of 0) */\n  emptyChild: Uint8Array;\n  /** hash is the algorithm that must be used for each InnerOp */\n  hash: HashOp;\n}\n\n/** BatchProof is a group of multiple proof types than can be compressed */\nexport interface BatchProof {\n  entries: BatchEntry[];\n}\n\n/** Use BatchEntry not CommitmentProof, to avoid recursion */\nexport interface BatchEntry {\n  exist?: ExistenceProof | undefined;\n  nonexist?: NonExistenceProof | undefined;\n}\n\nexport interface CompressedBatchProof {\n  entries: CompressedBatchEntry[];\n  lookupInners: InnerOp[];\n}\n\n/** Use BatchEntry not CommitmentProof, to avoid recursion */\nexport interface CompressedBatchEntry {\n  exist?: CompressedExistenceProof | undefined;\n  nonexist?: CompressedNonExistenceProof | undefined;\n}\n\nexport interface CompressedExistenceProof {\n  key: Uint8Array;\n  value: Uint8Array;\n  leaf:\n    | LeafOp\n    | undefined;\n  /** these are indexes into the lookup_inners table in CompressedBatchProof */\n  path: number[];\n}\n\nexport interface CompressedNonExistenceProof {\n  /** TODO: remove this as unnecessary??? we prove a range */\n  key: Uint8Array;\n  left: CompressedExistenceProof | undefined;\n  right: CompressedExistenceProof | undefined;\n}\n\nfunction createBaseExistenceProof(): ExistenceProof {\n  return { key: new Uint8Array(0), value: new Uint8Array(0), leaf: undefined, path: [] };\n}\n\nexport const ExistenceProof: MessageFns<ExistenceProof> = {\n  encode(message: ExistenceProof, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {\n    if (message.key.length !== 0) {\n      writer.uint32(10).bytes(message.key);\n    }\n    if (message.value.length !== 0) {\n      writer.uint32(18).bytes(message.value);\n    }\n    if (message.leaf !== undefined) {\n      LeafOp.encode(message.leaf, writer.uint32(26).fork()).join();\n    }\n    for (const v of message.path) {\n      InnerOp.encode(v!, writer.uint32(34).fork()).join();\n    }\n    return writer;\n  },\n\n  decode(input: BinaryReader | Uint8Array, length?: number): ExistenceProof {\n    const reader = input instanceof BinaryReader ? input : new BinaryReader(input);\n    const end = length === undefined ? reader.len : reader.pos + length;\n    const message = createBaseExistenceProof();\n    while (reader.pos < end) {\n      const tag = reader.uint32();\n      switch (tag >>> 3) {\n        case 1: {\n          if (tag !== 10) {\n            break;\n          }\n\n          message.key = reader.bytes();\n          continue;\n        }\n        case 2: {\n          if (tag !== 18) {\n            break;\n          }\n\n          message.value = reader.bytes();\n          continue;\n        }\n        case 3: {\n          if (tag !== 26) {\n            break;\n          }\n\n          message.leaf = LeafOp.decode(reader, reader.uint32());\n          continue;\n        }\n        case 4: {\n          if (tag !== 34) {\n            break;\n          }\n\n          message.path.push(InnerOp.decode(reader, reader.uint32()));\n          continue;\n        }\n      }\n      if ((tag & 7) === 4 || tag === 0) {\n        break;\n      }\n      reader.skip(tag & 7);\n    }\n    return message;\n  },\n\n  fromJSON(object: any): ExistenceProof {\n    return {\n      key: isSet(object.key) ? bytesFromBase64(object.key) : new Uint8Array(0),\n      value: isSet(object.value) ? bytesFromBase64(object.value) : new Uint8Array(0),\n      leaf: isSet(object.leaf) ? LeafOp.fromJSON(object.leaf) : undefined,\n      path: globalThis.Array.isArray(object?.path) ? object.path.map((e: any) => InnerOp.fromJSON(e)) : [],\n    };\n  },\n\n  toJSON(message: ExistenceProof): unknown {\n    const obj: any = {};\n    if (message.key.length !== 0) {\n      obj.key = base64FromBytes(message.key);\n    }\n    if (message.value.length !== 0) {\n      obj.value = base64FromBytes(message.value);\n    }\n    if (message.leaf !== undefined) {\n      obj.leaf = LeafOp.toJSON(message.leaf);\n    }\n    if (message.path?.length) {\n      obj.path = message.path.map((e) => InnerOp.toJSON(e));\n    }\n    return obj;\n  },\n\n  create(base?: DeepPartial<ExistenceProof>): ExistenceProof {\n    return ExistenceProof.fromPartial(base ?? {});\n  },\n  fromPartial(object: DeepPartial<ExistenceProof>): ExistenceProof {\n    const message = createBaseExistenceProof();\n    message.key = object.key ?? new Uint8Array(0);\n    message.value = object.value ?? new Uint8Array(0);\n    message.leaf = (object.leaf !== undefined && object.leaf !== null) ? LeafOp.fromPartial(object.leaf) : undefined;\n    message.path = object.path?.map((e) => InnerOp.fromPartial(e)) || [];\n    return message;\n  },\n};\n\nfunction createBaseNonExistenceProof(): NonExistenceProof {\n  return { key: new Uint8Array(0), left: undefined, right: undefined };\n}\n\nexport const NonExistenceProof: MessageFns<NonExistenceProof> = {\n  encode(message: NonExistenceProof, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {\n    if (message.key.length !== 0) {\n      writer.uint32(10).bytes(message.key);\n    }\n    if (message.left !== undefined) {\n      ExistenceProof.encode(message.left, writer.uint32(18).fork()).join();\n    }\n    if (message.right !== undefined) {\n      ExistenceProof.encode(message.right, writer.uint32(26).fork()).join();\n    }\n    return writer;\n  },\n\n  decode(input: BinaryReader | Uint8Array, length?: number): NonExistenceProof {\n    const reader = input instanceof BinaryReader ? input : new BinaryReader(input);\n    const end = length === undefined ? reader.len : reader.pos + length;\n    const message = createBaseNonExistenceProof();\n    while (reader.pos < end) {\n      const tag = reader.uint32();\n      switch (tag >>> 3) {\n        case 1: {\n          if (tag !== 10) {\n            break;\n          }\n\n          message.key = reader.bytes();\n          continue;\n        }\n        case 2: {\n          if (tag !== 18) {\n            break;\n          }\n\n          message.left = ExistenceProof.decode(reader, reader.uint32());\n          continue;\n        }\n        case 3: {\n          if (tag !== 26) {\n            break;\n          }\n\n          message.right = ExistenceProof.decode(reader, reader.uint32());\n          continue;\n        }\n      }\n      if ((tag & 7) === 4 || tag === 0) {\n        break;\n      }\n      reader.skip(tag & 7);\n    }\n    return message;\n  },\n\n  fromJSON(object: any): NonExistenceProof {\n    return {\n      key: isSet(object.key) ? bytesFromBase64(object.key) : new Uint8Array(0),\n      left: isSet(object.left) ? ExistenceProof.fromJSON(object.left) : undefined,\n      right: isSet(object.right) ? ExistenceProof.fromJSON(object.right) : undefined,\n    };\n  },\n\n  toJSON(message: NonExistenceProof): unknown {\n    const obj: any = {};\n    if (message.key.length !== 0) {\n      obj.key = base64FromBytes(message.key);\n    }\n    if (message.left !== undefined) {\n      obj.left = ExistenceProof.toJSON(message.left);\n    }\n    if (message.right !== undefined) {\n      obj.right = ExistenceProof.toJSON(message.right);\n    }\n    return obj;\n  },\n\n  create(base?: DeepPartial<NonExistenceProof>): NonExistenceProof {\n    return NonExistenceProof.fromPartial(base ?? {});\n  },\n  fromPartial(object: DeepPartial<NonExistenceProof>): NonExistenceProof {\n    const message = createBaseNonExistenceProof();\n    message.key = object.key ?? new Uint8Array(0);\n    message.left = (object.left !== undefined && object.left !== null)\n      ? ExistenceProof.fromPartial(object.left)\n      : undefined;\n    message.right = (object.right !== undefined && object.right !== null)\n      ? ExistenceProof.fromPartial(object.right)\n      : undefined;\n    return message;\n  },\n};\n\nfunction createBaseCommitmentProof(): CommitmentProof {\n  return { exist: undefined, nonexist: undefined, batch: undefined, compressed: undefined };\n}\n\nexport const CommitmentProof: MessageFns<CommitmentProof> = {\n  encode(message: CommitmentProof, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {\n    if (message.exist !== undefined) {\n      ExistenceProof.encode(message.exist, writer.uint32(10).fork()).join();\n    }\n    if (message.nonexist !== undefined) {\n      NonExistenceProof.encode(message.nonexist, writer.uint32(18).fork()).join();\n    }\n    if (message.batch !== undefined) {\n      BatchProof.encode(message.batch, writer.uint32(26).fork()).join();\n    }\n    if (message.compressed !== undefined) {\n      CompressedBatchProof.encode(message.compressed, writer.uint32(34).fork()).join();\n    }\n    return writer;\n  },\n\n  decode(input: BinaryReader | Uint8Array, length?: number): CommitmentProof {\n    const reader = input instanceof BinaryReader ? input : new BinaryReader(input);\n    const end = length === undefined ? reader.len : reader.pos + length;\n    const message = createBaseCommitmentProof();\n    while (reader.pos < end) {\n      const tag = reader.uint32();\n      switch (tag >>> 3) {\n        case 1: {\n          if (tag !== 10) {\n            break;\n          }\n\n          message.exist = ExistenceProof.decode(reader, reader.uint32());\n          continue;\n        }\n        case 2: {\n          if (tag !== 18) {\n            break;\n          }\n\n          message.nonexist = NonExistenceProof.decode(reader, reader.uint32());\n          continue;\n        }\n        case 3: {\n          if (tag !== 26) {\n            break;\n          }\n\n          message.batch = BatchProof.decode(reader, reader.uint32());\n          continue;\n        }\n        case 4: {\n          if (tag !== 34) {\n            break;\n          }\n\n          message.compressed = CompressedBatchProof.decode(reader, reader.uint32());\n          continue;\n        }\n      }\n      if ((tag & 7) === 4 || tag === 0) {\n        break;\n      }\n      reader.skip(tag & 7);\n    }\n    return message;\n  },\n\n  fromJSON(object: any): CommitmentProof {\n    return {\n      exist: isSet(object.exist) ? ExistenceProof.fromJSON(object.exist) : undefined,\n      nonexist: isSet(object.nonexist) ? NonExistenceProof.fromJSON(object.nonexist) : undefined,\n      batch: isSet(object.batch) ? BatchProof.fromJSON(object.batch) : undefined,\n      compressed: isSet(object.compressed) ? CompressedBatchProof.fromJSON(object.compressed) : undefined,\n    };\n  },\n\n  toJSON(message: CommitmentProof): unknown {\n    const obj: any = {};\n    if (message.exist !== undefined) {\n      obj.exist = ExistenceProof.toJSON(message.exist);\n    }\n    if (message.nonexist !== undefined) {\n      obj.nonexist = NonExistenceProof.toJSON(message.nonexist);\n    }\n    if (message.batch !== undefined) {\n      obj.batch = BatchProof.toJSON(message.batch);\n    }\n    if (message.compressed !== undefined) {\n      obj.compressed = CompressedBatchProof.toJSON(message.compressed);\n    }\n    return obj;\n  },\n\n  create(base?: DeepPartial<CommitmentProof>): CommitmentProof {\n    return CommitmentProof.fromPartial(base ?? {});\n  },\n  fromPartial(object: DeepPartial<CommitmentProof>): CommitmentProof {\n    const message = createBaseCommitmentProof();\n    message.exist = (object.exist !== undefined && object.exist !== null)\n      ? ExistenceProof.fromPartial(object.exist)\n      : undefined;\n    message.nonexist = (object.nonexist !== undefined && object.nonexist !== null)\n      ? NonExistenceProof.fromPartial(object.nonexist)\n      : undefined;\n    message.batch = (object.batch !== undefined && object.batch !== null)\n      ? BatchProof.fromPartial(object.batch)\n      : undefined;\n    message.compressed = (object.compressed !== undefined && object.compressed !== null)\n      ? CompressedBatchProof.fromPartial(object.compressed)\n      : undefined;\n    return message;\n  },\n};\n\nfunction createBaseLeafOp(): LeafOp {\n  return { hash: 0, prehashKey: 0, prehashValue: 0, length: 0, prefix: new Uint8Array(0) };\n}\n\nexport const LeafOp: MessageFns<LeafOp> = {\n  encode(message: LeafOp, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {\n    if (message.hash !== 0) {\n      writer.uint32(8).int32(message.hash);\n    }\n    if (message.prehashKey !== 0) {\n      writer.uint32(16).int32(message.prehashKey);\n    }\n    if (message.prehashValue !== 0) {\n      writer.uint32(24).int32(message.prehashValue);\n    }\n    if (message.length !== 0) {\n      writer.uint32(32).int32(message.length);\n    }\n    if (message.prefix.length !== 0) {\n      writer.uint32(42).bytes(message.prefix);\n    }\n    return writer;\n  },\n\n  decode(input: BinaryReader | Uint8Array, length?: number): LeafOp {\n    const reader = input instanceof BinaryReader ? input : new BinaryReader(input);\n    const end = length === undefined ? reader.len : reader.pos + length;\n    const message = createBaseLeafOp();\n    while (reader.pos < end) {\n      const tag = reader.uint32();\n      switch (tag >>> 3) {\n        case 1: {\n          if (tag !== 8) {\n            break;\n          }\n\n          message.hash = reader.int32() as any;\n          continue;\n        }\n        case 2: {\n          if (tag !== 16) {\n            break;\n          }\n\n          message.prehashKey = reader.int32() as any;\n          continue;\n        }\n        case 3: {\n          if (tag !== 24) {\n            break;\n          }\n\n          message.prehashValue = reader.int32() as any;\n          continue;\n        }\n        case 4: {\n          if (tag !== 32) {\n            break;\n          }\n\n          message.length = reader.int32() as any;\n          continue;\n        }\n        case 5: {\n          if (tag !== 42) {\n            break;\n          }\n\n          message.prefix = reader.bytes();\n          continue;\n        }\n      }\n      if ((tag & 7) === 4 || tag === 0) {\n        break;\n      }\n      reader.skip(tag & 7);\n    }\n    return message;\n  },\n\n  fromJSON(object: any): LeafOp {\n    return {\n      hash: isSet(object.hash) ? hashOpFromJSON(object.hash) : 0,\n      prehashKey: isSet(object.prehashKey) ? hashOpFromJSON(object.prehashKey) : 0,\n      prehashValue: isSet(object.prehashValue) ? hashOpFromJSON(object.prehashValue) : 0,\n      length: isSet(object.length) ? lengthOpFromJSON(object.length) : 0,\n      prefix: isSet(object.prefix) ? bytesFromBase64(object.prefix) : new Uint8Array(0),\n    };\n  },\n\n  toJSON(message: LeafOp): unknown {\n    const obj: any = {};\n    if (message.hash !== 0) {\n      obj.hash = hashOpToJSON(message.hash);\n    }\n    if (message.prehashKey !== 0) {\n      obj.prehashKey = hashOpToJSON(message.prehashKey);\n    }\n    if (message.prehashValue !== 0) {\n      obj.prehashValue = hashOpToJSON(message.prehashValue);\n    }\n    if (message.length !== 0) {\n      obj.length = lengthOpToJSON(message.length);\n    }\n    if (message.prefix.length !== 0) {\n      obj.prefix = base64FromBytes(message.prefix);\n    }\n    return obj;\n  },\n\n  create(base?: DeepPartial<LeafOp>): LeafOp {\n    return LeafOp.fromPartial(base ?? {});\n  },\n  fromPartial(object: DeepPartial<LeafOp>): LeafOp {\n    const message = createBaseLeafOp();\n    message.hash = object.hash ?? 0;\n    message.prehashKey = object.prehashKey ?? 0;\n    message.prehashValue = object.prehashValue ?? 0;\n    message.length = object.length ?? 0;\n    message.prefix = object.prefix ?? new Uint8Array(0);\n    return message;\n  },\n};\n\nfunction createBaseInnerOp(): InnerOp {\n  return { hash: 0, prefix: new Uint8Array(0), suffix: new Uint8Array(0) };\n}\n\nexport const InnerOp: MessageFns<InnerOp> = {\n  encode(message: InnerOp, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {\n    if (message.hash !== 0) {\n      writer.uint32(8).int32(message.hash);\n    }\n    if (message.prefix.length !== 0) {\n      writer.uint32(18).bytes(message.prefix);\n    }\n    if (message.suffix.length !== 0) {\n      writer.uint32(26).bytes(message.suffix);\n    }\n    return writer;\n  },\n\n  decode(input: BinaryReader | Uint8Array, length?: number): InnerOp {\n    const reader = input instanceof BinaryReader ? input : new BinaryReader(input);\n    const end = length === undefined ? reader.len : reader.pos + length;\n    const message = createBaseInnerOp();\n    while (reader.pos < end) {\n      const tag = reader.uint32();\n      switch (tag >>> 3) {\n        case 1: {\n          if (tag !== 8) {\n            break;\n          }\n\n          message.hash = reader.int32() as any;\n          continue;\n        }\n        case 2: {\n          if (tag !== 18) {\n            break;\n          }\n\n          message.prefix = reader.bytes();\n          continue;\n        }\n        case 3: {\n          if (tag !== 26) {\n            break;\n          }\n\n          message.suffix = reader.bytes();\n          continue;\n        }\n      }\n      if ((tag & 7) === 4 || tag === 0) {\n        break;\n      }\n      reader.skip(tag & 7);\n    }\n    return message;\n  },\n\n  fromJSON(object: any): InnerOp {\n    return {\n      hash: isSet(object.hash) ? hashOpFromJSON(object.hash) : 0,\n      prefix: isSet(object.prefix) ? bytesFromBase64(object.prefix) : new Uint8Array(0),\n      suffix: isSet(object.suffix) ? bytesFromBase64(object.suffix) : new Uint8Array(0),\n    };\n  },\n\n  toJSON(message: InnerOp): unknown {\n    const obj: any = {};\n    if (message.hash !== 0) {\n      obj.hash = hashOpToJSON(message.hash);\n    }\n    if (message.prefix.length !== 0) {\n      obj.prefix = base64FromBytes(message.prefix);\n    }\n    if (message.suffix.length !== 0) {\n      obj.suffix = base64FromBytes(message.suffix);\n    }\n    return obj;\n  },\n\n  create(base?: DeepPartial<InnerOp>): InnerOp {\n    return InnerOp.fromPartial(base ?? {});\n  },\n  fromPartial(object: DeepPartial<InnerOp>): InnerOp {\n    const message = createBaseInnerOp();\n    message.hash = object.hash ?? 0;\n    message.prefix = object.prefix ?? new Uint8Array(0);\n    message.suffix = object.suffix ?? new Uint8Array(0);\n    return message;\n  },\n};\n\nfunction createBaseProofSpec(): ProofSpec {\n  return { leafSpec: undefined, innerSpec: undefined, maxDepth: 0, minDepth: 0, prehashKeyBeforeComparison: false };\n}\n\nexport const ProofSpec: MessageFns<ProofSpec> = {\n  encode(message: ProofSpec, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {\n    if (message.leafSpec !== undefined) {\n      LeafOp.encode(message.leafSpec, writer.uint32(10).fork()).join();\n    }\n    if (message.innerSpec !== undefined) {\n      InnerSpec.encode(message.innerSpec, writer.uint32(18).fork()).join();\n    }\n    if (message.maxDepth !== 0) {\n      writer.uint32(24).int32(message.maxDepth);\n    }\n    if (message.minDepth !== 0) {\n      writer.uint32(32).int32(message.minDepth);\n    }\n    if (message.prehashKeyBeforeComparison !== false) {\n      writer.uint32(40).bool(message.prehashKeyBeforeComparison);\n    }\n    return writer;\n  },\n\n  decode(input: BinaryReader | Uint8Array, length?: number): ProofSpec {\n    const reader = input instanceof BinaryReader ? input : new BinaryReader(input);\n    const end = length === undefined ? reader.len : reader.pos + length;\n    const message = createBaseProofSpec();\n    while (reader.pos < end) {\n      const tag = reader.uint32();\n      switch (tag >>> 3) {\n        case 1: {\n          if (tag !== 10) {\n            break;\n          }\n\n          message.leafSpec = LeafOp.decode(reader, reader.uint32());\n          continue;\n        }\n        case 2: {\n          if (tag !== 18) {\n            break;\n          }\n\n          message.innerSpec = InnerSpec.decode(reader, reader.uint32());\n          continue;\n        }\n        case 3: {\n          if (tag !== 24) {\n            break;\n          }\n\n          message.maxDepth = reader.int32();\n          continue;\n        }\n        case 4: {\n          if (tag !== 32) {\n            break;\n          }\n\n          message.minDepth = reader.int32();\n          continue;\n        }\n        case 5: {\n          if (tag !== 40) {\n            break;\n          }\n\n          message.prehashKeyBeforeComparison = reader.bool();\n          continue;\n        }\n      }\n      if ((tag & 7) === 4 || tag === 0) {\n        break;\n      }\n      reader.skip(tag & 7);\n    }\n    return message;\n  },\n\n  fromJSON(object: any): ProofSpec {\n    return {\n      leafSpec: isSet(object.leafSpec) ? LeafOp.fromJSON(object.leafSpec) : undefined,\n      innerSpec: isSet(object.innerSpec) ? InnerSpec.fromJSON(object.innerSpec) : undefined,\n      maxDepth: isSet(object.maxDepth) ? globalThis.Number(object.maxDepth) : 0,\n      minDepth: isSet(object.minDepth) ? globalThis.Number(object.minDepth) : 0,\n      prehashKeyBeforeComparison: isSet(object.prehashKeyBeforeComparison)\n        ? globalThis.Boolean(object.prehashKeyBeforeComparison)\n        : false,\n    };\n  },\n\n  toJSON(message: ProofSpec): unknown {\n    const obj: any = {};\n    if (message.leafSpec !== undefined) {\n      obj.leafSpec = LeafOp.toJSON(message.leafSpec);\n    }\n    if (message.innerSpec !== undefined) {\n      obj.innerSpec = InnerSpec.toJSON(message.innerSpec);\n    }\n    if (message.maxDepth !== 0) {\n      obj.maxDepth = Math.round(message.maxDepth);\n    }\n    if (message.minDepth !== 0) {\n      obj.minDepth = Math.round(message.minDepth);\n    }\n    if (message.prehashKeyBeforeComparison !== false) {\n      obj.prehashKeyBeforeComparison = message.prehashKeyBeforeComparison;\n    }\n    return obj;\n  },\n\n  create(base?: DeepPartial<ProofSpec>): ProofSpec {\n    return ProofSpec.fromPartial(base ?? {});\n  },\n  fromPartial(object: DeepPartial<ProofSpec>): ProofSpec {\n    const message = createBaseProofSpec();\n    message.leafSpec = (object.leafSpec !== undefined && object.leafSpec !== null)\n      ? LeafOp.fromPartial(object.leafSpec)\n      : undefined;\n    message.innerSpec = (object.innerSpec !== undefined && object.innerSpec !== null)\n      ? InnerSpec.fromPartial(object.innerSpec)\n      : undefined;\n    message.maxDepth = object.maxDepth ?? 0;\n    message.minDepth = object.minDepth ?? 0;\n    message.prehashKeyBeforeComparison = object.prehashKeyBeforeComparison ?? false;\n    return message;\n  },\n};\n\nfunction createBaseInnerSpec(): InnerSpec {\n  return {\n    childOrder: [],\n    childSize: 0,\n    minPrefixLength: 0,\n    maxPrefixLength: 0,\n    emptyChild: new Uint8Array(0),\n    hash: 0,\n  };\n}\n\nexport const InnerSpec: MessageFns<InnerSpec> = {\n  encode(message: InnerSpec, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {\n    writer.uint32(10).fork();\n    for (const v of message.childOrder) {\n      writer.int32(v);\n    }\n    writer.join();\n    if (message.childSize !== 0) {\n      writer.uint32(16).int32(message.childSize);\n    }\n    if (message.minPrefixLength !== 0) {\n      writer.uint32(24).int32(message.minPrefixLength);\n    }\n    if (message.maxPrefixLength !== 0) {\n      writer.uint32(32).int32(message.maxPrefixLength);\n    }\n    if (message.emptyChild.length !== 0) {\n      writer.uint32(42).bytes(message.emptyChild);\n    }\n    if (message.hash !== 0) {\n      writer.uint32(48).int32(message.hash);\n    }\n    return writer;\n  },\n\n  decode(input: BinaryReader | Uint8Array, length?: number): InnerSpec {\n    const reader = input instanceof BinaryReader ? input : new BinaryReader(input);\n    const end = length === undefined ? reader.len : reader.pos + length;\n    const message = createBaseInnerSpec();\n    while (reader.pos < end) {\n      const tag = reader.uint32();\n      switch (tag >>> 3) {\n        case 1: {\n          if (tag === 8) {\n            message.childOrder.push(reader.int32());\n\n            continue;\n          }\n\n          if (tag === 10) {\n            const end2 = reader.uint32() + reader.pos;\n            while (reader.pos < end2) {\n              message.childOrder.push(reader.int32());\n            }\n\n            continue;\n          }\n\n          break;\n        }\n        case 2: {\n          if (tag !== 16) {\n            break;\n          }\n\n          message.childSize = reader.int32();\n          continue;\n        }\n        case 3: {\n          if (tag !== 24) {\n            break;\n          }\n\n          message.minPrefixLength = reader.int32();\n          continue;\n        }\n        case 4: {\n          if (tag !== 32) {\n            break;\n          }\n\n          message.maxPrefixLength = reader.int32();\n          continue;\n        }\n        case 5: {\n          if (tag !== 42) {\n            break;\n          }\n\n          message.emptyChild = reader.bytes();\n          continue;\n        }\n        case 6: {\n          if (tag !== 48) {\n            break;\n          }\n\n          message.hash = reader.int32() as any;\n          continue;\n        }\n      }\n      if ((tag & 7) === 4 || tag === 0) {\n        break;\n      }\n      reader.skip(tag & 7);\n    }\n    return message;\n  },\n\n  fromJSON(object: any): InnerSpec {\n    return {\n      childOrder: globalThis.Array.isArray(object?.childOrder)\n        ? object.childOrder.map((e: any) => globalThis.Number(e))\n        : [],\n      childSize: isSet(object.childSize) ? globalThis.Number(object.childSize) : 0,\n      minPrefixLength: isSet(object.minPrefixLength) ? globalThis.Number(object.minPrefixLength) : 0,\n      maxPrefixLength: isSet(object.maxPrefixLength) ? globalThis.Number(object.maxPrefixLength) : 0,\n      emptyChild: isSet(object.emptyChild) ? bytesFromBase64(object.emptyChild) : new Uint8Array(0),\n      hash: isSet(object.hash) ? hashOpFromJSON(object.hash) : 0,\n    };\n  },\n\n  toJSON(message: InnerSpec): unknown {\n    const obj: any = {};\n    if (message.childOrder?.length) {\n      obj.childOrder = message.childOrder.map((e) => Math.round(e));\n    }\n    if (message.childSize !== 0) {\n      obj.childSize = Math.round(message.childSize);\n    }\n    if (message.minPrefixLength !== 0) {\n      obj.minPrefixLength = Math.round(message.minPrefixLength);\n    }\n    if (message.maxPrefixLength !== 0) {\n      obj.maxPrefixLength = Math.round(message.maxPrefixLength);\n    }\n    if (message.emptyChild.length !== 0) {\n      obj.emptyChild = base64FromBytes(message.emptyChild);\n    }\n    if (message.hash !== 0) {\n      obj.hash = hashOpToJSON(message.hash);\n    }\n    return obj;\n  },\n\n  create(base?: DeepPartial<InnerSpec>): InnerSpec {\n    return InnerSpec.fromPartial(base ?? {});\n  },\n  fromPartial(object: DeepPartial<InnerSpec>): InnerSpec {\n    const message = createBaseInnerSpec();\n    message.childOrder = object.childOrder?.map((e) => e) || [];\n    message.childSize = object.childSize ?? 0;\n    message.minPrefixLength = object.minPrefixLength ?? 0;\n    message.maxPrefixLength = object.maxPrefixLength ?? 0;\n    message.emptyChild = object.emptyChild ?? new Uint8Array(0);\n    message.hash = object.hash ?? 0;\n    return message;\n  },\n};\n\nfunction createBaseBatchProof(): BatchProof {\n  return { entries: [] };\n}\n\nexport const BatchProof: MessageFns<BatchProof> = {\n  encode(message: BatchProof, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {\n    for (const v of message.entries) {\n      BatchEntry.encode(v!, writer.uint32(10).fork()).join();\n    }\n    return writer;\n  },\n\n  decode(input: BinaryReader | Uint8Array, length?: number): BatchProof {\n    const reader = input instanceof BinaryReader ? input : new BinaryReader(input);\n    const end = length === undefined ? reader.len : reader.pos + length;\n    const message = createBaseBatchProof();\n    while (reader.pos < end) {\n      const tag = reader.uint32();\n      switch (tag >>> 3) {\n        case 1: {\n          if (tag !== 10) {\n            break;\n          }\n\n          message.entries.push(BatchEntry.decode(reader, reader.uint32()));\n          continue;\n        }\n      }\n      if ((tag & 7) === 4 || tag === 0) {\n        break;\n      }\n      reader.skip(tag & 7);\n    }\n    return message;\n  },\n\n  fromJSON(object: any): BatchProof {\n    return {\n      entries: globalThis.Array.isArray(object?.entries) ? object.entries.map((e: any) => BatchEntry.fromJSON(e)) : [],\n    };\n  },\n\n  toJSON(message: BatchProof): unknown {\n    const obj: any = {};\n    if (message.entries?.length) {\n      obj.entries = message.entries.map((e) => BatchEntry.toJSON(e));\n    }\n    return obj;\n  },\n\n  create(base?: DeepPartial<BatchProof>): BatchProof {\n    return BatchProof.fromPartial(base ?? {});\n  },\n  fromPartial(object: DeepPartial<BatchProof>): BatchProof {\n    const message = createBaseBatchProof();\n    message.entries = object.entries?.map((e) => BatchEntry.fromPartial(e)) || [];\n    return message;\n  },\n};\n\nfunction createBaseBatchEntry(): BatchEntry {\n  return { exist: undefined, nonexist: undefined };\n}\n\nexport const BatchEntry: MessageFns<BatchEntry> = {\n  encode(message: BatchEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {\n    if (message.exist !== undefined) {\n      ExistenceProof.encode(message.exist, writer.uint32(10).fork()).join();\n    }\n    if (message.nonexist !== undefined) {\n      NonExistenceProof.encode(message.nonexist, writer.uint32(18).fork()).join();\n    }\n    return writer;\n  },\n\n  decode(input: BinaryReader | Uint8Array, length?: number): BatchEntry {\n    const reader = input instanceof BinaryReader ? input : new BinaryReader(input);\n    const end = length === undefined ? reader.len : reader.pos + length;\n    const message = createBaseBatchEntry();\n    while (reader.pos < end) {\n      const tag = reader.uint32();\n      switch (tag >>> 3) {\n        case 1: {\n          if (tag !== 10) {\n            break;\n          }\n\n          message.exist = ExistenceProof.decode(reader, reader.uint32());\n          continue;\n        }\n        case 2: {\n          if (tag !== 18) {\n            break;\n          }\n\n          message.nonexist = NonExistenceProof.decode(reader, reader.uint32());\n          continue;\n        }\n      }\n      if ((tag & 7) === 4 || tag === 0) {\n        break;\n      }\n      reader.skip(tag & 7);\n    }\n    return message;\n  },\n\n  fromJSON(object: any): BatchEntry {\n    return {\n      exist: isSet(object.exist) ? ExistenceProof.fromJSON(object.exist) : undefined,\n      nonexist: isSet(object.nonexist) ? NonExistenceProof.fromJSON(object.nonexist) : undefined,\n    };\n  },\n\n  toJSON(message: BatchEntry): unknown {\n    const obj: any = {};\n    if (message.exist !== undefined) {\n      obj.exist = ExistenceProof.toJSON(message.exist);\n    }\n    if (message.nonexist !== undefined) {\n      obj.nonexist = NonExistenceProof.toJSON(message.nonexist);\n    }\n    return obj;\n  },\n\n  create(base?: DeepPartial<BatchEntry>): BatchEntry {\n    return BatchEntry.fromPartial(base ?? {});\n  },\n  fromPartial(object: DeepPartial<BatchEntry>): BatchEntry {\n    const message = createBaseBatchEntry();\n    message.exist = (object.exist !== undefined && object.exist !== null)\n      ? ExistenceProof.fromPartial(object.exist)\n      : undefined;\n    message.nonexist = (object.nonexist !== undefined && object.nonexist !== null)\n      ? NonExistenceProof.fromPartial(object.nonexist)\n      : undefined;\n    return message;\n  },\n};\n\nfunction createBaseCompressedBatchProof(): CompressedBatchProof {\n  return { entries: [], lookupInners: [] };\n}\n\nexport const CompressedBatchProof: MessageFns<CompressedBatchProof> = {\n  encode(message: CompressedBatchProof, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {\n    for (const v of message.entries) {\n      CompressedBatchEntry.encode(v!, writer.uint32(10).fork()).join();\n    }\n    for (const v of message.lookupInners) {\n      InnerOp.encode(v!, writer.uint32(18).fork()).join();\n    }\n    return writer;\n  },\n\n  decode(input: BinaryReader | Uint8Array, length?: number): CompressedBatchProof {\n    const reader = input instanceof BinaryReader ? input : new BinaryReader(input);\n    const end = length === undefined ? reader.len : reader.pos + length;\n    const message = createBaseCompressedBatchProof();\n    while (reader.pos < end) {\n      const tag = reader.uint32();\n      switch (tag >>> 3) {\n        case 1: {\n          if (tag !== 10) {\n            break;\n          }\n\n          message.entries.push(CompressedBatchEntry.decode(reader, reader.uint32()));\n          continue;\n        }\n        case 2: {\n          if (tag !== 18) {\n            break;\n          }\n\n          message.lookupInners.push(InnerOp.decode(reader, reader.uint32()));\n          continue;\n        }\n      }\n      if ((tag & 7) === 4 || tag === 0) {\n        break;\n      }\n      reader.skip(tag & 7);\n    }\n    return message;\n  },\n\n  fromJSON(object: any): CompressedBatchProof {\n    return {\n      entries: globalThis.Array.isArray(object?.entries)\n        ? object.entries.map((e: any) => CompressedBatchEntry.fromJSON(e))\n        : [],\n      lookupInners: globalThis.Array.isArray(object?.lookupInners)\n        ? object.lookupInners.map((e: any) => InnerOp.fromJSON(e))\n        : [],\n    };\n  },\n\n  toJSON(message: CompressedBatchProof): unknown {\n    const obj: any = {};\n    if (message.entries?.length) {\n      obj.entries = message.entries.map((e) => CompressedBatchEntry.toJSON(e));\n    }\n    if (message.lookupInners?.length) {\n      obj.lookupInners = message.lookupInners.map((e) => InnerOp.toJSON(e));\n    }\n    return obj;\n  },\n\n  create(base?: DeepPartial<CompressedBatchProof>): CompressedBatchProof {\n    return CompressedBatchProof.fromPartial(base ?? {});\n  },\n  fromPartial(object: DeepPartial<CompressedBatchProof>): CompressedBatchProof {\n    const message = createBaseCompressedBatchProof();\n    message.entries = object.entries?.map((e) => CompressedBatchEntry.fromPartial(e)) || [];\n    message.lookupInners = object.lookupInners?.map((e) => InnerOp.fromPartial(e)) || [];\n    return message;\n  },\n};\n\nfunction createBaseCompressedBatchEntry(): CompressedBatchEntry {\n  return { exist: undefined, nonexist: undefined };\n}\n\nexport const CompressedBatchEntry: MessageFns<CompressedBatchEntry> = {\n  encode(message: CompressedBatchEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {\n    if (message.exist !== undefined) {\n      CompressedExistenceProof.encode(message.exist, writer.uint32(10).fork()).join();\n    }\n    if (message.nonexist !== undefined) {\n      CompressedNonExistenceProof.encode(message.nonexist, writer.uint32(18).fork()).join();\n    }\n    return writer;\n  },\n\n  decode(input: BinaryReader | Uint8Array, length?: number): CompressedBatchEntry {\n    const reader = input instanceof BinaryReader ? input : new BinaryReader(input);\n    const end = length === undefined ? reader.len : reader.pos + length;\n    const message = createBaseCompressedBatchEntry();\n    while (reader.pos < end) {\n      const tag = reader.uint32();\n      switch (tag >>> 3) {\n        case 1: {\n          if (tag !== 10) {\n            break;\n          }\n\n          message.exist = CompressedExistenceProof.decode(reader, reader.uint32());\n          continue;\n        }\n        case 2: {\n          if (tag !== 18) {\n            break;\n          }\n\n          message.nonexist = CompressedNonExistenceProof.decode(reader, reader.uint32());\n          continue;\n        }\n      }\n      if ((tag & 7) === 4 || tag === 0) {\n        break;\n      }\n      reader.skip(tag & 7);\n    }\n    return message;\n  },\n\n  fromJSON(object: any): CompressedBatchEntry {\n    return {\n      exist: isSet(object.exist) ? CompressedExistenceProof.fromJSON(object.exist) : undefined,\n      nonexist: isSet(object.nonexist) ? CompressedNonExistenceProof.fromJSON(object.nonexist) : undefined,\n    };\n  },\n\n  toJSON(message: CompressedBatchEntry): unknown {\n    const obj: any = {};\n    if (message.exist !== undefined) {\n      obj.exist = CompressedExistenceProof.toJSON(message.exist);\n    }\n    if (message.nonexist !== undefined) {\n      obj.nonexist = CompressedNonExistenceProof.toJSON(message.nonexist);\n    }\n    return obj;\n  },\n\n  create(base?: DeepPartial<CompressedBatchEntry>): CompressedBatchEntry {\n    return CompressedBatchEntry.fromPartial(base ?? {});\n  },\n  fromPartial(object: DeepPartial<CompressedBatchEntry>): CompressedBatchEntry {\n    const message = createBaseCompressedBatchEntry();\n    message.exist = (object.exist !== undefined && object.exist !== null)\n      ? CompressedExistenceProof.fromPartial(object.exist)\n      : undefined;\n    message.nonexist = (object.nonexist !== undefined && object.nonexist !== null)\n      ? CompressedNonExistenceProof.fromPartial(object.nonexist)\n      : undefined;\n    return message;\n  },\n};\n\nfunction createBaseCompressedExistenceProof(): CompressedExistenceProof {\n  return { key: new Uint8Array(0), value: new Uint8Array(0), leaf: undefined, path: [] };\n}\n\nexport const CompressedExistenceProof: MessageFns<CompressedExistenceProof> = {\n  encode(message: CompressedExistenceProof, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {\n    if (message.key.length !== 0) {\n      writer.uint32(10).bytes(message.key);\n    }\n    if (message.value.length !== 0) {\n      writer.uint32(18).bytes(message.value);\n    }\n    if (message.leaf !== undefined) {\n      LeafOp.encode(message.leaf, writer.uint32(26).fork()).join();\n    }\n    writer.uint32(34).fork();\n    for (const v of message.path) {\n      writer.int32(v);\n    }\n    writer.join();\n    return writer;\n  },\n\n  decode(input: BinaryReader | Uint8Array, length?: number): CompressedExistenceProof {\n    const reader = input instanceof BinaryReader ? input : new BinaryReader(input);\n    const end = length === undefined ? reader.len : reader.pos + length;\n    const message = createBaseCompressedExistenceProof();\n    while (reader.pos < end) {\n      const tag = reader.uint32();\n      switch (tag >>> 3) {\n        case 1: {\n          if (tag !== 10) {\n            break;\n          }\n\n          message.key = reader.bytes();\n          continue;\n        }\n        case 2: {\n          if (tag !== 18) {\n            break;\n          }\n\n          message.value = reader.bytes();\n          continue;\n        }\n        case 3: {\n          if (tag !== 26) {\n            break;\n          }\n\n          message.leaf = LeafOp.decode(reader, reader.uint32());\n          continue;\n        }\n        case 4: {\n          if (tag === 32) {\n            message.path.push(reader.int32());\n\n            continue;\n          }\n\n          if (tag === 34) {\n            const end2 = reader.uint32() + reader.pos;\n            while (reader.pos < end2) {\n              message.path.push(reader.int32());\n            }\n\n            continue;\n          }\n\n          break;\n        }\n      }\n      if ((tag & 7) === 4 || tag === 0) {\n        break;\n      }\n      reader.skip(tag & 7);\n    }\n    return message;\n  },\n\n  fromJSON(object: any): CompressedExistenceProof {\n    return {\n      key: isSet(object.key) ? bytesFromBase64(object.key) : new Uint8Array(0),\n      value: isSet(object.value) ? bytesFromBase64(object.value) : new Uint8Array(0),\n      leaf: isSet(object.leaf) ? LeafOp.fromJSON(object.leaf) : undefined,\n      path: globalThis.Array.isArray(object?.path) ? object.path.map((e: any) => globalThis.Number(e)) : [],\n    };\n  },\n\n  toJSON(message: CompressedExistenceProof): unknown {\n    const obj: any = {};\n    if (message.key.length !== 0) {\n      obj.key = base64FromBytes(message.key);\n    }\n    if (message.value.length !== 0) {\n      obj.value = base64FromBytes(message.value);\n    }\n    if (message.leaf !== undefined) {\n      obj.leaf = LeafOp.toJSON(message.leaf);\n    }\n    if (message.path?.length) {\n      obj.path = message.path.map((e) => Math.round(e));\n    }\n    return obj;\n  },\n\n  create(base?: DeepPartial<CompressedExistenceProof>): CompressedExistenceProof {\n    return CompressedExistenceProof.fromPartial(base ?? {});\n  },\n  fromPartial(object: DeepPartial<CompressedExistenceProof>): CompressedExistenceProof {\n    const message = createBaseCompressedExistenceProof();\n    message.key = object.key ?? new Uint8Array(0);\n    message.value = object.value ?? new Uint8Array(0);\n    message.leaf = (object.leaf !== undefined && object.leaf !== null) ? LeafOp.fromPartial(object.leaf) : undefined;\n    message.path = object.path?.map((e) => e) || [];\n    return message;\n  },\n};\n\nfunction createBaseCompressedNonExistenceProof(): CompressedNonExistenceProof {\n  return { key: new Uint8Array(0), left: undefined, right: undefined };\n}\n\nexport const CompressedNonExistenceProof: MessageFns<CompressedNonExistenceProof> = {\n  encode(message: CompressedNonExistenceProof, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {\n    if (message.key.length !== 0) {\n      writer.uint32(10).bytes(message.key);\n    }\n    if (message.left !== undefined) {\n      CompressedExistenceProof.encode(message.left, writer.uint32(18).fork()).join();\n    }\n    if (message.right !== undefined) {\n      CompressedExistenceProof.encode(message.right, writer.uint32(26).fork()).join();\n    }\n    return writer;\n  },\n\n  decode(input: BinaryReader | Uint8Array, length?: number): CompressedNonExistenceProof {\n    const reader = input instanceof BinaryReader ? input : new BinaryReader(input);\n    const end = length === undefined ? reader.len : reader.pos + length;\n    const message = createBaseCompressedNonExistenceProof();\n    while (reader.pos < end) {\n      const tag = reader.uint32();\n      switch (tag >>> 3) {\n        case 1: {\n          if (tag !== 10) {\n            break;\n          }\n\n          message.key = reader.bytes();\n          continue;\n        }\n        case 2: {\n          if (tag !== 18) {\n            break;\n          }\n\n          message.left = CompressedExistenceProof.decode(reader, reader.uint32());\n          continue;\n        }\n        case 3: {\n          if (tag !== 26) {\n            break;\n          }\n\n          message.right = CompressedExistenceProof.decode(reader, reader.uint32());\n          continue;\n        }\n      }\n      if ((tag & 7) === 4 || tag === 0) {\n        break;\n      }\n      reader.skip(tag & 7);\n    }\n    return message;\n  },\n\n  fromJSON(object: any): CompressedNonExistenceProof {\n    return {\n      key: isSet(object.key) ? bytesFromBase64(object.key) : new Uint8Array(0),\n      left: isSet(object.left) ? CompressedExistenceProof.fromJSON(object.left) : undefined,\n      right: isSet(object.right) ? CompressedExistenceProof.fromJSON(object.right) : undefined,\n    };\n  },\n\n  toJSON(message: CompressedNonExistenceProof): unknown {\n    const obj: any = {};\n    if (message.key.length !== 0) {\n      obj.key = base64FromBytes(message.key);\n    }\n    if (message.left !== undefined) {\n      obj.left = CompressedExistenceProof.toJSON(message.left);\n    }\n    if (message.right !== undefined) {\n      obj.right = CompressedExistenceProof.toJSON(message.right);\n    }\n    return obj;\n  },\n\n  create(base?: DeepPartial<CompressedNonExistenceProof>): CompressedNonExistenceProof {\n    return CompressedNonExistenceProof.fromPartial(base ?? {});\n  },\n  fromPartial(object: DeepPartial<CompressedNonExistenceProof>): CompressedNonExistenceProof {\n    const message = createBaseCompressedNonExistenceProof();\n    message.key = object.key ?? new Uint8Array(0);\n    message.left = (object.left !== undefined && object.left !== null)\n      ? CompressedExistenceProof.fromPartial(object.left)\n      : undefined;\n    message.right = (object.right !== undefined && object.right !== null)\n      ? CompressedExistenceProof.fromPartial(object.right)\n      : undefined;\n    return message;\n  },\n};\n\nfunction bytesFromBase64(b64: string): Uint8Array {\n  if ((globalThis as any).Buffer) {\n    return Uint8Array.from(globalThis.Buffer.from(b64, \"base64\"));\n  } else {\n    const bin = globalThis.atob(b64);\n    const arr = new Uint8Array(bin.length);\n    for (let i = 0; i < bin.length; ++i) {\n      arr[i] = bin.charCodeAt(i);\n    }\n    return arr;\n  }\n}\n\nfunction base64FromBytes(arr: Uint8Array): string {\n  if ((globalThis as any).Buffer) {\n    return globalThis.Buffer.from(arr).toString(\"base64\");\n  } else {\n    const bin: string[] = [];\n    arr.forEach((byte) => {\n      bin.push(globalThis.String.fromCharCode(byte));\n    });\n    return globalThis.btoa(bin.join(\"\"));\n  }\n}\n\ntype Builtin = Date | Function | Uint8Array | string | number | boolean | bigint | undefined;\n\nexport type DeepPartial<T> = T extends Builtin ? T\n  : T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>>\n  : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>>\n  : T extends {} ? { [K in keyof T]?: DeepPartial<T[K]> }\n  : Partial<T>;\n\nfunction isSet(value: any): boolean {\n  return value !== null && value !== undefined;\n}\n\nexport interface MessageFns<T> {\n  encode(message: T, writer?: BinaryWriter): BinaryWriter;\n  decode(input: BinaryReader | Uint8Array, length?: number): T;\n  fromJSON(object: any): T;\n  toJSON(message: T): unknown;\n  create(base?: DeepPartial<T>): T;\n  fromPartial(object: DeepPartial<T>): T;\n}\n"],"mappings":";;;;;AAWA,IAAY,4CAAL;;AAEL;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;;;;;;;;AA6DF,IAAY,gDAAL;;AAEL;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;AACA"}