@cheqd/ts-proto
Version:
A TypeScript package for all transpiled cheqd ProtoBuf definitions.
541 lines • 19.6 kB
JavaScript
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
// versions:
// protoc-gen-ts_proto v2.3.0
// protoc unknown
// source: tendermint/types/params.proto
/* eslint-disable */
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
import { Duration } from "../../google/protobuf/duration.js";
function createBaseConsensusParams() {
return { block: undefined, evidence: undefined, validator: undefined, version: undefined, abci: undefined };
}
export const ConsensusParams = {
encode(message, writer = new BinaryWriter()) {
if (message.block !== undefined) {
BlockParams.encode(message.block, writer.uint32(10).fork()).join();
}
if (message.evidence !== undefined) {
EvidenceParams.encode(message.evidence, writer.uint32(18).fork()).join();
}
if (message.validator !== undefined) {
ValidatorParams.encode(message.validator, writer.uint32(26).fork()).join();
}
if (message.version !== undefined) {
VersionParams.encode(message.version, writer.uint32(34).fork()).join();
}
if (message.abci !== undefined) {
ABCIParams.encode(message.abci, writer.uint32(42).fork()).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 = createBaseConsensusParams();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 10) {
break;
}
message.block = BlockParams.decode(reader, reader.uint32());
continue;
}
case 2: {
if (tag !== 18) {
break;
}
message.evidence = EvidenceParams.decode(reader, reader.uint32());
continue;
}
case 3: {
if (tag !== 26) {
break;
}
message.validator = ValidatorParams.decode(reader, reader.uint32());
continue;
}
case 4: {
if (tag !== 34) {
break;
}
message.version = VersionParams.decode(reader, reader.uint32());
continue;
}
case 5: {
if (tag !== 42) {
break;
}
message.abci = ABCIParams.decode(reader, reader.uint32());
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
fromJSON(object) {
return {
block: isSet(object.block) ? BlockParams.fromJSON(object.block) : undefined,
evidence: isSet(object.evidence) ? EvidenceParams.fromJSON(object.evidence) : undefined,
validator: isSet(object.validator) ? ValidatorParams.fromJSON(object.validator) : undefined,
version: isSet(object.version) ? VersionParams.fromJSON(object.version) : undefined,
abci: isSet(object.abci) ? ABCIParams.fromJSON(object.abci) : undefined,
};
},
toJSON(message) {
const obj = {};
if (message.block !== undefined) {
obj.block = BlockParams.toJSON(message.block);
}
if (message.evidence !== undefined) {
obj.evidence = EvidenceParams.toJSON(message.evidence);
}
if (message.validator !== undefined) {
obj.validator = ValidatorParams.toJSON(message.validator);
}
if (message.version !== undefined) {
obj.version = VersionParams.toJSON(message.version);
}
if (message.abci !== undefined) {
obj.abci = ABCIParams.toJSON(message.abci);
}
return obj;
},
create(base) {
return ConsensusParams.fromPartial(base ?? {});
},
fromPartial(object) {
const message = createBaseConsensusParams();
message.block = (object.block !== undefined && object.block !== null)
? BlockParams.fromPartial(object.block)
: undefined;
message.evidence = (object.evidence !== undefined && object.evidence !== null)
? EvidenceParams.fromPartial(object.evidence)
: undefined;
message.validator = (object.validator !== undefined && object.validator !== null)
? ValidatorParams.fromPartial(object.validator)
: undefined;
message.version = (object.version !== undefined && object.version !== null)
? VersionParams.fromPartial(object.version)
: undefined;
message.abci = (object.abci !== undefined && object.abci !== null)
? ABCIParams.fromPartial(object.abci)
: undefined;
return message;
},
};
function createBaseBlockParams() {
return { maxBytes: 0n, maxGas: 0n };
}
export const BlockParams = {
encode(message, writer = new BinaryWriter()) {
if (message.maxBytes !== 0n) {
if (BigInt.asIntN(64, message.maxBytes) !== message.maxBytes) {
throw new globalThis.Error("value provided for field message.maxBytes of type int64 too large");
}
writer.uint32(8).int64(message.maxBytes);
}
if (message.maxGas !== 0n) {
if (BigInt.asIntN(64, message.maxGas) !== message.maxGas) {
throw new globalThis.Error("value provided for field message.maxGas of type int64 too large");
}
writer.uint32(16).int64(message.maxGas);
}
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 = createBaseBlockParams();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 8) {
break;
}
message.maxBytes = reader.int64();
continue;
}
case 2: {
if (tag !== 16) {
break;
}
message.maxGas = reader.int64();
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
fromJSON(object) {
return {
maxBytes: isSet(object.maxBytes) ? BigInt(object.maxBytes) : 0n,
maxGas: isSet(object.maxGas) ? BigInt(object.maxGas) : 0n,
};
},
toJSON(message) {
const obj = {};
if (message.maxBytes !== 0n) {
obj.maxBytes = message.maxBytes.toString();
}
if (message.maxGas !== 0n) {
obj.maxGas = message.maxGas.toString();
}
return obj;
},
create(base) {
return BlockParams.fromPartial(base ?? {});
},
fromPartial(object) {
const message = createBaseBlockParams();
message.maxBytes = object.maxBytes ?? 0n;
message.maxGas = object.maxGas ?? 0n;
return message;
},
};
function createBaseEvidenceParams() {
return { maxAgeNumBlocks: 0n, maxAgeDuration: undefined, maxBytes: 0n };
}
export const EvidenceParams = {
encode(message, writer = new BinaryWriter()) {
if (message.maxAgeNumBlocks !== 0n) {
if (BigInt.asIntN(64, message.maxAgeNumBlocks) !== message.maxAgeNumBlocks) {
throw new globalThis.Error("value provided for field message.maxAgeNumBlocks of type int64 too large");
}
writer.uint32(8).int64(message.maxAgeNumBlocks);
}
if (message.maxAgeDuration !== undefined) {
Duration.encode(message.maxAgeDuration, writer.uint32(18).fork()).join();
}
if (message.maxBytes !== 0n) {
if (BigInt.asIntN(64, message.maxBytes) !== message.maxBytes) {
throw new globalThis.Error("value provided for field message.maxBytes of type int64 too large");
}
writer.uint32(24).int64(message.maxBytes);
}
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 = createBaseEvidenceParams();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 8) {
break;
}
message.maxAgeNumBlocks = reader.int64();
continue;
}
case 2: {
if (tag !== 18) {
break;
}
message.maxAgeDuration = Duration.decode(reader, reader.uint32());
continue;
}
case 3: {
if (tag !== 24) {
break;
}
message.maxBytes = reader.int64();
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
fromJSON(object) {
return {
maxAgeNumBlocks: isSet(object.maxAgeNumBlocks) ? BigInt(object.maxAgeNumBlocks) : 0n,
maxAgeDuration: isSet(object.maxAgeDuration) ? Duration.fromJSON(object.maxAgeDuration) : undefined,
maxBytes: isSet(object.maxBytes) ? BigInt(object.maxBytes) : 0n,
};
},
toJSON(message) {
const obj = {};
if (message.maxAgeNumBlocks !== 0n) {
obj.maxAgeNumBlocks = message.maxAgeNumBlocks.toString();
}
if (message.maxAgeDuration !== undefined) {
obj.maxAgeDuration = Duration.toJSON(message.maxAgeDuration);
}
if (message.maxBytes !== 0n) {
obj.maxBytes = message.maxBytes.toString();
}
return obj;
},
create(base) {
return EvidenceParams.fromPartial(base ?? {});
},
fromPartial(object) {
const message = createBaseEvidenceParams();
message.maxAgeNumBlocks = object.maxAgeNumBlocks ?? 0n;
message.maxAgeDuration = (object.maxAgeDuration !== undefined && object.maxAgeDuration !== null)
? Duration.fromPartial(object.maxAgeDuration)
: undefined;
message.maxBytes = object.maxBytes ?? 0n;
return message;
},
};
function createBaseValidatorParams() {
return { pubKeyTypes: [] };
}
export const ValidatorParams = {
encode(message, writer = new BinaryWriter()) {
for (const v of message.pubKeyTypes) {
writer.uint32(10).string(v);
}
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 = createBaseValidatorParams();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 10) {
break;
}
message.pubKeyTypes.push(reader.string());
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
fromJSON(object) {
return {
pubKeyTypes: globalThis.Array.isArray(object?.pubKeyTypes)
? object.pubKeyTypes.map((e) => globalThis.String(e))
: [],
};
},
toJSON(message) {
const obj = {};
if (message.pubKeyTypes?.length) {
obj.pubKeyTypes = message.pubKeyTypes;
}
return obj;
},
create(base) {
return ValidatorParams.fromPartial(base ?? {});
},
fromPartial(object) {
const message = createBaseValidatorParams();
message.pubKeyTypes = object.pubKeyTypes?.map((e) => e) || [];
return message;
},
};
function createBaseVersionParams() {
return { app: 0n };
}
export const VersionParams = {
encode(message, writer = new BinaryWriter()) {
if (message.app !== 0n) {
if (BigInt.asUintN(64, message.app) !== message.app) {
throw new globalThis.Error("value provided for field message.app of type uint64 too large");
}
writer.uint32(8).uint64(message.app);
}
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 = createBaseVersionParams();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 8) {
break;
}
message.app = reader.uint64();
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
fromJSON(object) {
return { app: isSet(object.app) ? BigInt(object.app) : 0n };
},
toJSON(message) {
const obj = {};
if (message.app !== 0n) {
obj.app = message.app.toString();
}
return obj;
},
create(base) {
return VersionParams.fromPartial(base ?? {});
},
fromPartial(object) {
const message = createBaseVersionParams();
message.app = object.app ?? 0n;
return message;
},
};
function createBaseHashedParams() {
return { blockMaxBytes: 0n, blockMaxGas: 0n };
}
export const HashedParams = {
encode(message, writer = new BinaryWriter()) {
if (message.blockMaxBytes !== 0n) {
if (BigInt.asIntN(64, message.blockMaxBytes) !== message.blockMaxBytes) {
throw new globalThis.Error("value provided for field message.blockMaxBytes of type int64 too large");
}
writer.uint32(8).int64(message.blockMaxBytes);
}
if (message.blockMaxGas !== 0n) {
if (BigInt.asIntN(64, message.blockMaxGas) !== message.blockMaxGas) {
throw new globalThis.Error("value provided for field message.blockMaxGas of type int64 too large");
}
writer.uint32(16).int64(message.blockMaxGas);
}
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 = createBaseHashedParams();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 8) {
break;
}
message.blockMaxBytes = reader.int64();
continue;
}
case 2: {
if (tag !== 16) {
break;
}
message.blockMaxGas = reader.int64();
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
fromJSON(object) {
return {
blockMaxBytes: isSet(object.blockMaxBytes) ? BigInt(object.blockMaxBytes) : 0n,
blockMaxGas: isSet(object.blockMaxGas) ? BigInt(object.blockMaxGas) : 0n,
};
},
toJSON(message) {
const obj = {};
if (message.blockMaxBytes !== 0n) {
obj.blockMaxBytes = message.blockMaxBytes.toString();
}
if (message.blockMaxGas !== 0n) {
obj.blockMaxGas = message.blockMaxGas.toString();
}
return obj;
},
create(base) {
return HashedParams.fromPartial(base ?? {});
},
fromPartial(object) {
const message = createBaseHashedParams();
message.blockMaxBytes = object.blockMaxBytes ?? 0n;
message.blockMaxGas = object.blockMaxGas ?? 0n;
return message;
},
};
function createBaseABCIParams() {
return { voteExtensionsEnableHeight: 0n };
}
export const ABCIParams = {
encode(message, writer = new BinaryWriter()) {
if (message.voteExtensionsEnableHeight !== 0n) {
if (BigInt.asIntN(64, message.voteExtensionsEnableHeight) !== message.voteExtensionsEnableHeight) {
throw new globalThis.Error("value provided for field message.voteExtensionsEnableHeight of type int64 too large");
}
writer.uint32(8).int64(message.voteExtensionsEnableHeight);
}
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 = createBaseABCIParams();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
if (tag !== 8) {
break;
}
message.voteExtensionsEnableHeight = reader.int64();
continue;
}
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
fromJSON(object) {
return {
voteExtensionsEnableHeight: isSet(object.voteExtensionsEnableHeight)
? BigInt(object.voteExtensionsEnableHeight)
: 0n,
};
},
toJSON(message) {
const obj = {};
if (message.voteExtensionsEnableHeight !== 0n) {
obj.voteExtensionsEnableHeight = message.voteExtensionsEnableHeight.toString();
}
return obj;
},
create(base) {
return ABCIParams.fromPartial(base ?? {});
},
fromPartial(object) {
const message = createBaseABCIParams();
message.voteExtensionsEnableHeight = object.voteExtensionsEnableHeight ?? 0n;
return message;
},
};
function isSet(value) {
return value !== null && value !== undefined;
}
//# sourceMappingURL=params.js.map