@cheqd/ts-proto
Version:
A TypeScript package for all transpiled cheqd ProtoBuf definitions.
210 lines • 7.06 kB
JavaScript
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
// versions:
// protoc-gen-ts_proto v2.6.1
// protoc unknown
// source: cosmos_proto/cosmos.proto
/* eslint-disable */
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
export var ScalarType;
(function (ScalarType) {
ScalarType[ScalarType["SCALAR_TYPE_UNSPECIFIED"] = 0] = "SCALAR_TYPE_UNSPECIFIED";
ScalarType[ScalarType["SCALAR_TYPE_STRING"] = 1] = "SCALAR_TYPE_STRING";
ScalarType[ScalarType["SCALAR_TYPE_BYTES"] = 2] = "SCALAR_TYPE_BYTES";
ScalarType[ScalarType["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
})(ScalarType || (ScalarType = {}));
export function scalarTypeFromJSON(object) {
switch (object) {
case 0:
case "SCALAR_TYPE_UNSPECIFIED":
return ScalarType.SCALAR_TYPE_UNSPECIFIED;
case 1:
case "SCALAR_TYPE_STRING":
return ScalarType.SCALAR_TYPE_STRING;
case 2:
case "SCALAR_TYPE_BYTES":
return ScalarType.SCALAR_TYPE_BYTES;
case -1:
case "UNRECOGNIZED":
default:
return ScalarType.UNRECOGNIZED;
}
}
export function scalarTypeToJSON(object) {
switch (object) {
case ScalarType.SCALAR_TYPE_UNSPECIFIED:
return "SCALAR_TYPE_UNSPECIFIED";
case ScalarType.SCALAR_TYPE_STRING:
return "SCALAR_TYPE_STRING";
case ScalarType.SCALAR_TYPE_BYTES:
return "SCALAR_TYPE_BYTES";
case ScalarType.UNRECOGNIZED:
default:
return "UNRECOGNIZED";
}
}
function createBaseInterfaceDescriptor() {
return { name: "", description: "" };
}
export const InterfaceDescriptor = {
encode(message, writer = new BinaryWriter()) {
if (message.name !== "") {
writer.uint32(10).string(message.name);
}
if (message.description !== "") {
writer.uint32(18).string(message.description);
}
return writer;
},
decode(input, length) {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseInterfaceDescriptor();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 10) {
break;
}
message.name = reader.string();
continue;
}
case 2: {
if (tag !== 18) {
break;
}
message.description = reader.string();
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
fromJSON(object) {
return {
name: isSet(object.name) ? globalThis.String(object.name) : "",
description: isSet(object.description) ? globalThis.String(object.description) : "",
};
},
toJSON(message) {
const obj = {};
if (message.name !== "") {
obj.name = message.name;
}
if (message.description !== "") {
obj.description = message.description;
}
return obj;
},
create(base) {
return InterfaceDescriptor.fromPartial(base ?? {});
},
fromPartial(object) {
const message = createBaseInterfaceDescriptor();
message.name = object.name ?? "";
message.description = object.description ?? "";
return message;
},
};
function createBaseScalarDescriptor() {
return { name: "", description: "", fieldType: [] };
}
export const ScalarDescriptor = {
encode(message, writer = new BinaryWriter()) {
if (message.name !== "") {
writer.uint32(10).string(message.name);
}
if (message.description !== "") {
writer.uint32(18).string(message.description);
}
writer.uint32(26).fork();
for (const v of message.fieldType) {
writer.int32(v);
}
writer.join();
return writer;
},
decode(input, length) {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseScalarDescriptor();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 10) {
break;
}
message.name = reader.string();
continue;
}
case 2: {
if (tag !== 18) {
break;
}
message.description = reader.string();
continue;
}
case 3: {
if (tag === 24) {
message.fieldType.push(reader.int32());
continue;
}
if (tag === 26) {
const end2 = reader.uint32() + reader.pos;
while (reader.pos < end2) {
message.fieldType.push(reader.int32());
}
continue;
}
break;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
fromJSON(object) {
return {
name: isSet(object.name) ? globalThis.String(object.name) : "",
description: isSet(object.description) ? globalThis.String(object.description) : "",
fieldType: globalThis.Array.isArray(object?.fieldType)
? object.fieldType.map((e) => scalarTypeFromJSON(e))
: [],
};
},
toJSON(message) {
const obj = {};
if (message.name !== "") {
obj.name = message.name;
}
if (message.description !== "") {
obj.description = message.description;
}
if (message.fieldType?.length) {
obj.fieldType = message.fieldType.map((e) => scalarTypeToJSON(e));
}
return obj;
},
create(base) {
return ScalarDescriptor.fromPartial(base ?? {});
},
fromPartial(object) {
const message = createBaseScalarDescriptor();
message.name = object.name ?? "";
message.description = object.description ?? "";
message.fieldType = object.fieldType?.map((e) => e) || [];
return message;
},
};
function isSet(value) {
return value !== null && value !== undefined;
}
//# sourceMappingURL=cosmos.js.map