interchainjs
Version:
InterchainJS is a JavaScript library for interacting with Cosmos SDK based blockchains.
338 lines (337 loc) • 12.1 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.QueryCurrentEpochResponse = exports.QueryCurrentEpochRequest = exports.QueryEpochInfosResponse = exports.QueryEpochInfosRequest = void 0;
const genesis_1 = require("./genesis");
const binary_1 = require("../../../binary");
const registry_1 = require("../../../registry");
function createBaseQueryEpochInfosRequest() {
return {};
}
/**
* QueryEpochInfosRequest defines the gRPC request structure for
* querying all epoch info.
* @name QueryEpochInfosRequest
* @package cosmos.epochs.v1beta1
* @see proto type: cosmos.epochs.v1beta1.QueryEpochInfosRequest
*/
exports.QueryEpochInfosRequest = {
typeUrl: "/cosmos.epochs.v1beta1.QueryEpochInfosRequest",
aminoType: "cosmos-sdk/QueryEpochInfosRequest",
is(o) {
return o && o.$typeUrl === exports.QueryEpochInfosRequest.typeUrl;
},
isAmino(o) {
return o && o.$typeUrl === exports.QueryEpochInfosRequest.typeUrl;
},
encode(_, writer = binary_1.BinaryWriter.create()) {
return writer;
},
decode(input, length) {
const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseQueryEpochInfosRequest();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
default:
reader.skipType(tag & 7);
break;
}
}
return message;
},
fromPartial(_) {
const message = createBaseQueryEpochInfosRequest();
return message;
},
fromAmino(_) {
const message = createBaseQueryEpochInfosRequest();
return message;
},
toAmino(_) {
const obj = {};
return obj;
},
fromAminoMsg(object) {
return exports.QueryEpochInfosRequest.fromAmino(object.value);
},
toAminoMsg(message) {
return {
type: "cosmos-sdk/QueryEpochInfosRequest",
value: exports.QueryEpochInfosRequest.toAmino(message)
};
},
fromProtoMsg(message) {
return exports.QueryEpochInfosRequest.decode(message.value);
},
toProto(message) {
return exports.QueryEpochInfosRequest.encode(message).finish();
},
toProtoMsg(message) {
return {
typeUrl: "/cosmos.epochs.v1beta1.QueryEpochInfosRequest",
value: exports.QueryEpochInfosRequest.encode(message).finish()
};
},
registerTypeUrl() { }
};
function createBaseQueryEpochInfosResponse() {
return {
epochs: []
};
}
/**
* QueryEpochInfosRequest defines the gRPC response structure for
* querying all epoch info.
* @name QueryEpochInfosResponse
* @package cosmos.epochs.v1beta1
* @see proto type: cosmos.epochs.v1beta1.QueryEpochInfosResponse
*/
exports.QueryEpochInfosResponse = {
typeUrl: "/cosmos.epochs.v1beta1.QueryEpochInfosResponse",
aminoType: "cosmos-sdk/QueryEpochInfosResponse",
is(o) {
return o && (o.$typeUrl === exports.QueryEpochInfosResponse.typeUrl || Array.isArray(o.epochs) && (!o.epochs.length || genesis_1.EpochInfo.is(o.epochs[0])));
},
isAmino(o) {
return o && (o.$typeUrl === exports.QueryEpochInfosResponse.typeUrl || Array.isArray(o.epochs) && (!o.epochs.length || genesis_1.EpochInfo.isAmino(o.epochs[0])));
},
encode(message, writer = binary_1.BinaryWriter.create()) {
for (const v of message.epochs) {
genesis_1.EpochInfo.encode(v, writer.uint32(10).fork()).ldelim();
}
return writer;
},
decode(input, length) {
const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseQueryEpochInfosResponse();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
message.epochs.push(genesis_1.EpochInfo.decode(reader, reader.uint32()));
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
},
fromPartial(object) {
const message = createBaseQueryEpochInfosResponse();
message.epochs = object.epochs?.map(e => genesis_1.EpochInfo.fromPartial(e)) || [];
return message;
},
fromAmino(object) {
const message = createBaseQueryEpochInfosResponse();
message.epochs = object.epochs?.map(e => genesis_1.EpochInfo.fromAmino(e)) || [];
return message;
},
toAmino(message) {
const obj = {};
if (message.epochs) {
obj.epochs = message.epochs.map(e => e ? genesis_1.EpochInfo.toAmino(e) : undefined);
}
else {
obj.epochs = message.epochs;
}
return obj;
},
fromAminoMsg(object) {
return exports.QueryEpochInfosResponse.fromAmino(object.value);
},
toAminoMsg(message) {
return {
type: "cosmos-sdk/QueryEpochInfosResponse",
value: exports.QueryEpochInfosResponse.toAmino(message)
};
},
fromProtoMsg(message) {
return exports.QueryEpochInfosResponse.decode(message.value);
},
toProto(message) {
return exports.QueryEpochInfosResponse.encode(message).finish();
},
toProtoMsg(message) {
return {
typeUrl: "/cosmos.epochs.v1beta1.QueryEpochInfosResponse",
value: exports.QueryEpochInfosResponse.encode(message).finish()
};
},
registerTypeUrl() {
if (!registry_1.GlobalDecoderRegistry.registerExistingTypeUrl(exports.QueryEpochInfosResponse.typeUrl)) {
return;
}
genesis_1.EpochInfo.registerTypeUrl();
}
};
function createBaseQueryCurrentEpochRequest() {
return {
identifier: ""
};
}
/**
* QueryCurrentEpochRequest defines the gRPC request structure for
* querying an epoch by its identifier.
* @name QueryCurrentEpochRequest
* @package cosmos.epochs.v1beta1
* @see proto type: cosmos.epochs.v1beta1.QueryCurrentEpochRequest
*/
exports.QueryCurrentEpochRequest = {
typeUrl: "/cosmos.epochs.v1beta1.QueryCurrentEpochRequest",
aminoType: "cosmos-sdk/QueryCurrentEpochRequest",
is(o) {
return o && (o.$typeUrl === exports.QueryCurrentEpochRequest.typeUrl || typeof o.identifier === "string");
},
isAmino(o) {
return o && (o.$typeUrl === exports.QueryCurrentEpochRequest.typeUrl || typeof o.identifier === "string");
},
encode(message, writer = binary_1.BinaryWriter.create()) {
if (message.identifier !== "") {
writer.uint32(10).string(message.identifier);
}
return writer;
},
decode(input, length) {
const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseQueryCurrentEpochRequest();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
message.identifier = reader.string();
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
},
fromPartial(object) {
const message = createBaseQueryCurrentEpochRequest();
message.identifier = object.identifier ?? "";
return message;
},
fromAmino(object) {
const message = createBaseQueryCurrentEpochRequest();
if (object.identifier !== undefined && object.identifier !== null) {
message.identifier = object.identifier;
}
return message;
},
toAmino(message) {
const obj = {};
obj.identifier = message.identifier === "" ? undefined : message.identifier;
return obj;
},
fromAminoMsg(object) {
return exports.QueryCurrentEpochRequest.fromAmino(object.value);
},
toAminoMsg(message) {
return {
type: "cosmos-sdk/QueryCurrentEpochRequest",
value: exports.QueryCurrentEpochRequest.toAmino(message)
};
},
fromProtoMsg(message) {
return exports.QueryCurrentEpochRequest.decode(message.value);
},
toProto(message) {
return exports.QueryCurrentEpochRequest.encode(message).finish();
},
toProtoMsg(message) {
return {
typeUrl: "/cosmos.epochs.v1beta1.QueryCurrentEpochRequest",
value: exports.QueryCurrentEpochRequest.encode(message).finish()
};
},
registerTypeUrl() { }
};
function createBaseQueryCurrentEpochResponse() {
return {
currentEpoch: BigInt(0)
};
}
/**
* QueryCurrentEpochResponse defines the gRPC response structure for
* querying an epoch by its identifier.
* @name QueryCurrentEpochResponse
* @package cosmos.epochs.v1beta1
* @see proto type: cosmos.epochs.v1beta1.QueryCurrentEpochResponse
*/
exports.QueryCurrentEpochResponse = {
typeUrl: "/cosmos.epochs.v1beta1.QueryCurrentEpochResponse",
aminoType: "cosmos-sdk/QueryCurrentEpochResponse",
is(o) {
return o && (o.$typeUrl === exports.QueryCurrentEpochResponse.typeUrl || typeof o.currentEpoch === "bigint");
},
isAmino(o) {
return o && (o.$typeUrl === exports.QueryCurrentEpochResponse.typeUrl || typeof o.current_epoch === "bigint");
},
encode(message, writer = binary_1.BinaryWriter.create()) {
if (message.currentEpoch !== BigInt(0)) {
writer.uint32(8).int64(message.currentEpoch);
}
return writer;
},
decode(input, length) {
const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseQueryCurrentEpochResponse();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
message.currentEpoch = reader.int64();
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
},
fromPartial(object) {
const message = createBaseQueryCurrentEpochResponse();
message.currentEpoch = object.currentEpoch !== undefined && object.currentEpoch !== null ? BigInt(object.currentEpoch.toString()) : BigInt(0);
return message;
},
fromAmino(object) {
const message = createBaseQueryCurrentEpochResponse();
if (object.current_epoch !== undefined && object.current_epoch !== null) {
message.currentEpoch = BigInt(object.current_epoch);
}
return message;
},
toAmino(message) {
const obj = {};
obj.current_epoch = message.currentEpoch !== BigInt(0) ? message.currentEpoch?.toString() : undefined;
return obj;
},
fromAminoMsg(object) {
return exports.QueryCurrentEpochResponse.fromAmino(object.value);
},
toAminoMsg(message) {
return {
type: "cosmos-sdk/QueryCurrentEpochResponse",
value: exports.QueryCurrentEpochResponse.toAmino(message)
};
},
fromProtoMsg(message) {
return exports.QueryCurrentEpochResponse.decode(message.value);
},
toProto(message) {
return exports.QueryCurrentEpochResponse.encode(message).finish();
},
toProtoMsg(message) {
return {
typeUrl: "/cosmos.epochs.v1beta1.QueryCurrentEpochResponse",
value: exports.QueryCurrentEpochResponse.encode(message).finish()
};
},
registerTypeUrl() { }
};