@cheqd/ts-proto
Version:
A TypeScript package for all transpiled cheqd ProtoBuf definitions.
308 lines (276 loc) • 9.53 kB
text/typescript
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
// versions:
// protoc-gen-ts_proto v2.11.4
// protoc unknown
// source: cosmos_proto/cosmos.proto
/* eslint-disable */
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
export enum ScalarType {
SCALAR_TYPE_UNSPECIFIED = 0,
SCALAR_TYPE_STRING = 1,
SCALAR_TYPE_BYTES = 2,
UNRECOGNIZED = -1,
}
export function scalarTypeFromJSON(object: any): ScalarType {
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: ScalarType): string {
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";
}
}
/**
* InterfaceDescriptor describes an interface type to be used with
* accepts_interface and implements_interface and declared by declare_interface.
*/
export interface InterfaceDescriptor {
/**
* name is the name of the interface. It should be a short-name (without
* a period) such that the fully qualified name of the interface will be
* package.name, ex. for the package a.b and interface named C, the
* fully-qualified name will be a.b.C.
*/
name: string;
/**
* description is a human-readable description of the interface and its
* purpose.
*/
description: string;
}
/**
* ScalarDescriptor describes an scalar type to be used with
* the scalar field option and declared by declare_scalar.
* Scalars extend simple protobuf built-in types with additional
* syntax and semantics, for instance to represent big integers.
* Scalars should ideally define an encoding such that there is only one
* valid syntactical representation for a given semantic meaning,
* i.e. the encoding should be deterministic.
*/
export interface ScalarDescriptor {
/**
* name is the name of the scalar. It should be a short-name (without
* a period) such that the fully qualified name of the scalar will be
* package.name, ex. for the package a.b and scalar named C, the
* fully-qualified name will be a.b.C.
*/
name: string;
/**
* description is a human-readable description of the scalar and its
* encoding format. For instance a big integer or decimal scalar should
* specify precisely the expected encoding format.
*/
description: string;
/**
* field_type is the type of field with which this scalar can be used.
* Scalars can be used with one and only one type of field so that
* encoding standards and simple and clear. Currently only string and
* bytes fields are supported for scalars.
*/
fieldType: ScalarType[];
}
function createBaseInterfaceDescriptor(): InterfaceDescriptor {
return { name: "", description: "" };
}
export const InterfaceDescriptor: MessageFns<InterfaceDescriptor> = {
encode(message: InterfaceDescriptor, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
if (message.name !== "") {
writer.uint32(10).string(message.name);
}
if (message.description !== "") {
writer.uint32(18).string(message.description);
}
return writer;
},
decode(input: BinaryReader | Uint8Array, length?: number): InterfaceDescriptor {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
const 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: any): InterfaceDescriptor {
return {
name: isSet(object.name) ? globalThis.String(object.name) : "",
description: isSet(object.description) ? globalThis.String(object.description) : "",
};
},
toJSON(message: InterfaceDescriptor): unknown {
const obj: any = {};
if (message.name !== "") {
obj.name = message.name;
}
if (message.description !== "") {
obj.description = message.description;
}
return obj;
},
create<I extends Exact<DeepPartial<InterfaceDescriptor>, I>>(base?: I): InterfaceDescriptor {
return InterfaceDescriptor.fromPartial(base ?? ({} as any));
},
fromPartial<I extends Exact<DeepPartial<InterfaceDescriptor>, I>>(object: I): InterfaceDescriptor {
const message = createBaseInterfaceDescriptor();
message.name = object.name ?? "";
message.description = object.description ?? "";
return message;
},
};
function createBaseScalarDescriptor(): ScalarDescriptor {
return { name: "", description: "", fieldType: [] };
}
export const ScalarDescriptor: MessageFns<ScalarDescriptor> = {
encode(message: ScalarDescriptor, writer: BinaryWriter = new BinaryWriter()): 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: BinaryReader | Uint8Array, length?: number): ScalarDescriptor {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
const 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() as any);
continue;
}
if (tag === 26) {
const end2 = reader.uint32() + reader.pos;
while (reader.pos < end2) {
message.fieldType.push(reader.int32() as any);
}
continue;
}
break;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
fromJSON(object: any): ScalarDescriptor {
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: any) => scalarTypeFromJSON(e))
: globalThis.Array.isArray(object?.field_type)
? object.field_type.map((e: any) => scalarTypeFromJSON(e))
: [],
};
},
toJSON(message: ScalarDescriptor): unknown {
const obj: any = {};
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<I extends Exact<DeepPartial<ScalarDescriptor>, I>>(base?: I): ScalarDescriptor {
return ScalarDescriptor.fromPartial(base ?? ({} as any));
},
fromPartial<I extends Exact<DeepPartial<ScalarDescriptor>, I>>(object: I): ScalarDescriptor {
const message = createBaseScalarDescriptor();
message.name = object.name ?? "";
message.description = object.description ?? "";
message.fieldType = object.fieldType?.map((e) => e) || [];
return message;
},
};
type Builtin = Date | Function | Uint8Array | string | number | boolean | bigint | undefined;
type DeepPartial<T> = T extends Builtin ? T
: T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>>
: T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>>
: T extends {} ? { [K in keyof T]?: DeepPartial<T[K]> }
: Partial<T>;
type KeysOfUnion<T> = T extends T ? keyof T : never;
type Exact<P, I extends P> = P extends Builtin ? P
: P & { [K in keyof P]: Exact<P[K], I[K]> } & { [K in Exclude<keyof I, KeysOfUnion<P>>]: never };
function isSet(value: any): boolean {
return value !== null && value !== undefined;
}
interface MessageFns<T> {
encode(message: T, writer?: BinaryWriter): BinaryWriter;
decode(input: BinaryReader | Uint8Array, length?: number): T;
fromJSON(object: any): T;
toJSON(message: T): unknown;
create<I extends Exact<DeepPartial<T>, I>>(base?: I): T;
fromPartial<I extends Exact<DeepPartial<T>, I>>(object: I): T;
}