@bandprotocol/bandchain.js
Version:
TypeScript library for Cosmos SDK and BandChain
1,286 lines • 94.2 kB
JavaScript
//@ts-nocheck
import { PageRequest, PageResponse } from "../../../../cosmos/base/query/v1beta1/pagination";
import { Channel, IdentifiedChannel, PacketState } from "./channel";
import { Height, IdentifiedClientState } from "../../client/v1/client";
import { Any } from "../../../../google/protobuf/any";
import { BinaryReader, BinaryWriter } from "../../../../binary";
import { bytesFromBase64, base64FromBytes } from "../../../../helpers";
function createBaseQueryChannelRequest() {
return {
portId: "",
channelId: ""
};
}
export const QueryChannelRequest = {
typeUrl: "/ibc.core.channel.v1.QueryChannelRequest",
encode(message, writer = BinaryWriter.create()) {
if (message.portId !== "") {
writer.uint32(10).string(message.portId);
}
if (message.channelId !== "") {
writer.uint32(18).string(message.channelId);
}
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 = createBaseQueryChannelRequest();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
message.portId = reader.string();
break;
case 2:
message.channelId = reader.string();
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
},
fromPartial(object) {
const message = createBaseQueryChannelRequest();
message.portId = object.portId ?? "";
message.channelId = object.channelId ?? "";
return message;
},
fromAmino(object) {
const message = createBaseQueryChannelRequest();
if (object.port_id !== undefined && object.port_id !== null) {
message.portId = object.port_id;
}
if (object.channel_id !== undefined && object.channel_id !== null) {
message.channelId = object.channel_id;
}
return message;
},
toAmino(message) {
const obj = {};
obj.port_id = message.portId === "" ? undefined : message.portId;
obj.channel_id = message.channelId === "" ? undefined : message.channelId;
return obj;
},
fromAminoMsg(object) {
return QueryChannelRequest.fromAmino(object.value);
},
toAminoMsg(message) {
return {
type: "cosmos-sdk/QueryChannelRequest",
value: QueryChannelRequest.toAmino(message)
};
},
fromProtoMsg(message) {
return QueryChannelRequest.decode(message.value);
},
toProto(message) {
return QueryChannelRequest.encode(message).finish();
},
toProtoMsg(message) {
return {
typeUrl: "/ibc.core.channel.v1.QueryChannelRequest",
value: QueryChannelRequest.encode(message).finish()
};
}
};
function createBaseQueryChannelResponse() {
return {
channel: undefined,
proof: new Uint8Array(),
proofHeight: Height.fromPartial({})
};
}
export const QueryChannelResponse = {
typeUrl: "/ibc.core.channel.v1.QueryChannelResponse",
encode(message, writer = BinaryWriter.create()) {
if (message.channel !== undefined) {
Channel.encode(message.channel, writer.uint32(10).fork()).ldelim();
}
if (message.proof.length !== 0) {
writer.uint32(18).bytes(message.proof);
}
if (message.proofHeight !== undefined) {
Height.encode(message.proofHeight, writer.uint32(26).fork()).ldelim();
}
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 = createBaseQueryChannelResponse();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
message.channel = Channel.decode(reader, reader.uint32());
break;
case 2:
message.proof = reader.bytes();
break;
case 3:
message.proofHeight = Height.decode(reader, reader.uint32());
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
},
fromPartial(object) {
const message = createBaseQueryChannelResponse();
message.channel = object.channel !== undefined && object.channel !== null ? Channel.fromPartial(object.channel) : undefined;
message.proof = object.proof ?? new Uint8Array();
message.proofHeight = object.proofHeight !== undefined && object.proofHeight !== null ? Height.fromPartial(object.proofHeight) : undefined;
return message;
},
fromAmino(object) {
const message = createBaseQueryChannelResponse();
if (object.channel !== undefined && object.channel !== null) {
message.channel = Channel.fromAmino(object.channel);
}
if (object.proof !== undefined && object.proof !== null) {
message.proof = bytesFromBase64(object.proof);
}
if (object.proof_height !== undefined && object.proof_height !== null) {
message.proofHeight = Height.fromAmino(object.proof_height);
}
return message;
},
toAmino(message) {
const obj = {};
obj.channel = message.channel ? Channel.toAmino(message.channel) : undefined;
obj.proof = message.proof ? base64FromBytes(message.proof) : undefined;
obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight) : {};
return obj;
},
fromAminoMsg(object) {
return QueryChannelResponse.fromAmino(object.value);
},
toAminoMsg(message) {
return {
type: "cosmos-sdk/QueryChannelResponse",
value: QueryChannelResponse.toAmino(message)
};
},
fromProtoMsg(message) {
return QueryChannelResponse.decode(message.value);
},
toProto(message) {
return QueryChannelResponse.encode(message).finish();
},
toProtoMsg(message) {
return {
typeUrl: "/ibc.core.channel.v1.QueryChannelResponse",
value: QueryChannelResponse.encode(message).finish()
};
}
};
function createBaseQueryChannelsRequest() {
return {
pagination: undefined
};
}
export const QueryChannelsRequest = {
typeUrl: "/ibc.core.channel.v1.QueryChannelsRequest",
encode(message, writer = BinaryWriter.create()) {
if (message.pagination !== undefined) {
PageRequest.encode(message.pagination, writer.uint32(10).fork()).ldelim();
}
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 = createBaseQueryChannelsRequest();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
message.pagination = PageRequest.decode(reader, reader.uint32());
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
},
fromPartial(object) {
const message = createBaseQueryChannelsRequest();
message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined;
return message;
},
fromAmino(object) {
const message = createBaseQueryChannelsRequest();
if (object.pagination !== undefined && object.pagination !== null) {
message.pagination = PageRequest.fromAmino(object.pagination);
}
return message;
},
toAmino(message) {
const obj = {};
obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined;
return obj;
},
fromAminoMsg(object) {
return QueryChannelsRequest.fromAmino(object.value);
},
toAminoMsg(message) {
return {
type: "cosmos-sdk/QueryChannelsRequest",
value: QueryChannelsRequest.toAmino(message)
};
},
fromProtoMsg(message) {
return QueryChannelsRequest.decode(message.value);
},
toProto(message) {
return QueryChannelsRequest.encode(message).finish();
},
toProtoMsg(message) {
return {
typeUrl: "/ibc.core.channel.v1.QueryChannelsRequest",
value: QueryChannelsRequest.encode(message).finish()
};
}
};
function createBaseQueryChannelsResponse() {
return {
channels: [],
pagination: undefined,
height: Height.fromPartial({})
};
}
export const QueryChannelsResponse = {
typeUrl: "/ibc.core.channel.v1.QueryChannelsResponse",
encode(message, writer = BinaryWriter.create()) {
for (const v of message.channels) {
IdentifiedChannel.encode(v, writer.uint32(10).fork()).ldelim();
}
if (message.pagination !== undefined) {
PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim();
}
if (message.height !== undefined) {
Height.encode(message.height, writer.uint32(26).fork()).ldelim();
}
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 = createBaseQueryChannelsResponse();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
message.channels.push(IdentifiedChannel.decode(reader, reader.uint32()));
break;
case 2:
message.pagination = PageResponse.decode(reader, reader.uint32());
break;
case 3:
message.height = Height.decode(reader, reader.uint32());
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
},
fromPartial(object) {
const message = createBaseQueryChannelsResponse();
message.channels = object.channels?.map(e => IdentifiedChannel.fromPartial(e)) || [];
message.pagination = object.pagination !== undefined && object.pagination !== null ? PageResponse.fromPartial(object.pagination) : undefined;
message.height = object.height !== undefined && object.height !== null ? Height.fromPartial(object.height) : undefined;
return message;
},
fromAmino(object) {
const message = createBaseQueryChannelsResponse();
message.channels = object.channels?.map(e => IdentifiedChannel.fromAmino(e)) || [];
if (object.pagination !== undefined && object.pagination !== null) {
message.pagination = PageResponse.fromAmino(object.pagination);
}
if (object.height !== undefined && object.height !== null) {
message.height = Height.fromAmino(object.height);
}
return message;
},
toAmino(message) {
const obj = {};
if (message.channels) {
obj.channels = message.channels.map(e => e ? IdentifiedChannel.toAmino(e) : undefined);
}
else {
obj.channels = message.channels;
}
obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined;
obj.height = message.height ? Height.toAmino(message.height) : {};
return obj;
},
fromAminoMsg(object) {
return QueryChannelsResponse.fromAmino(object.value);
},
toAminoMsg(message) {
return {
type: "cosmos-sdk/QueryChannelsResponse",
value: QueryChannelsResponse.toAmino(message)
};
},
fromProtoMsg(message) {
return QueryChannelsResponse.decode(message.value);
},
toProto(message) {
return QueryChannelsResponse.encode(message).finish();
},
toProtoMsg(message) {
return {
typeUrl: "/ibc.core.channel.v1.QueryChannelsResponse",
value: QueryChannelsResponse.encode(message).finish()
};
}
};
function createBaseQueryConnectionChannelsRequest() {
return {
connection: "",
pagination: undefined
};
}
export const QueryConnectionChannelsRequest = {
typeUrl: "/ibc.core.channel.v1.QueryConnectionChannelsRequest",
encode(message, writer = BinaryWriter.create()) {
if (message.connection !== "") {
writer.uint32(10).string(message.connection);
}
if (message.pagination !== undefined) {
PageRequest.encode(message.pagination, writer.uint32(18).fork()).ldelim();
}
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 = createBaseQueryConnectionChannelsRequest();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
message.connection = reader.string();
break;
case 2:
message.pagination = PageRequest.decode(reader, reader.uint32());
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
},
fromPartial(object) {
const message = createBaseQueryConnectionChannelsRequest();
message.connection = object.connection ?? "";
message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined;
return message;
},
fromAmino(object) {
const message = createBaseQueryConnectionChannelsRequest();
if (object.connection !== undefined && object.connection !== null) {
message.connection = object.connection;
}
if (object.pagination !== undefined && object.pagination !== null) {
message.pagination = PageRequest.fromAmino(object.pagination);
}
return message;
},
toAmino(message) {
const obj = {};
obj.connection = message.connection === "" ? undefined : message.connection;
obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined;
return obj;
},
fromAminoMsg(object) {
return QueryConnectionChannelsRequest.fromAmino(object.value);
},
toAminoMsg(message) {
return {
type: "cosmos-sdk/QueryConnectionChannelsRequest",
value: QueryConnectionChannelsRequest.toAmino(message)
};
},
fromProtoMsg(message) {
return QueryConnectionChannelsRequest.decode(message.value);
},
toProto(message) {
return QueryConnectionChannelsRequest.encode(message).finish();
},
toProtoMsg(message) {
return {
typeUrl: "/ibc.core.channel.v1.QueryConnectionChannelsRequest",
value: QueryConnectionChannelsRequest.encode(message).finish()
};
}
};
function createBaseQueryConnectionChannelsResponse() {
return {
channels: [],
pagination: undefined,
height: Height.fromPartial({})
};
}
export const QueryConnectionChannelsResponse = {
typeUrl: "/ibc.core.channel.v1.QueryConnectionChannelsResponse",
encode(message, writer = BinaryWriter.create()) {
for (const v of message.channels) {
IdentifiedChannel.encode(v, writer.uint32(10).fork()).ldelim();
}
if (message.pagination !== undefined) {
PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim();
}
if (message.height !== undefined) {
Height.encode(message.height, writer.uint32(26).fork()).ldelim();
}
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 = createBaseQueryConnectionChannelsResponse();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
message.channels.push(IdentifiedChannel.decode(reader, reader.uint32()));
break;
case 2:
message.pagination = PageResponse.decode(reader, reader.uint32());
break;
case 3:
message.height = Height.decode(reader, reader.uint32());
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
},
fromPartial(object) {
const message = createBaseQueryConnectionChannelsResponse();
message.channels = object.channels?.map(e => IdentifiedChannel.fromPartial(e)) || [];
message.pagination = object.pagination !== undefined && object.pagination !== null ? PageResponse.fromPartial(object.pagination) : undefined;
message.height = object.height !== undefined && object.height !== null ? Height.fromPartial(object.height) : undefined;
return message;
},
fromAmino(object) {
const message = createBaseQueryConnectionChannelsResponse();
message.channels = object.channels?.map(e => IdentifiedChannel.fromAmino(e)) || [];
if (object.pagination !== undefined && object.pagination !== null) {
message.pagination = PageResponse.fromAmino(object.pagination);
}
if (object.height !== undefined && object.height !== null) {
message.height = Height.fromAmino(object.height);
}
return message;
},
toAmino(message) {
const obj = {};
if (message.channels) {
obj.channels = message.channels.map(e => e ? IdentifiedChannel.toAmino(e) : undefined);
}
else {
obj.channels = message.channels;
}
obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined;
obj.height = message.height ? Height.toAmino(message.height) : {};
return obj;
},
fromAminoMsg(object) {
return QueryConnectionChannelsResponse.fromAmino(object.value);
},
toAminoMsg(message) {
return {
type: "cosmos-sdk/QueryConnectionChannelsResponse",
value: QueryConnectionChannelsResponse.toAmino(message)
};
},
fromProtoMsg(message) {
return QueryConnectionChannelsResponse.decode(message.value);
},
toProto(message) {
return QueryConnectionChannelsResponse.encode(message).finish();
},
toProtoMsg(message) {
return {
typeUrl: "/ibc.core.channel.v1.QueryConnectionChannelsResponse",
value: QueryConnectionChannelsResponse.encode(message).finish()
};
}
};
function createBaseQueryChannelClientStateRequest() {
return {
portId: "",
channelId: ""
};
}
export const QueryChannelClientStateRequest = {
typeUrl: "/ibc.core.channel.v1.QueryChannelClientStateRequest",
encode(message, writer = BinaryWriter.create()) {
if (message.portId !== "") {
writer.uint32(10).string(message.portId);
}
if (message.channelId !== "") {
writer.uint32(18).string(message.channelId);
}
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 = createBaseQueryChannelClientStateRequest();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
message.portId = reader.string();
break;
case 2:
message.channelId = reader.string();
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
},
fromPartial(object) {
const message = createBaseQueryChannelClientStateRequest();
message.portId = object.portId ?? "";
message.channelId = object.channelId ?? "";
return message;
},
fromAmino(object) {
const message = createBaseQueryChannelClientStateRequest();
if (object.port_id !== undefined && object.port_id !== null) {
message.portId = object.port_id;
}
if (object.channel_id !== undefined && object.channel_id !== null) {
message.channelId = object.channel_id;
}
return message;
},
toAmino(message) {
const obj = {};
obj.port_id = message.portId === "" ? undefined : message.portId;
obj.channel_id = message.channelId === "" ? undefined : message.channelId;
return obj;
},
fromAminoMsg(object) {
return QueryChannelClientStateRequest.fromAmino(object.value);
},
toAminoMsg(message) {
return {
type: "cosmos-sdk/QueryChannelClientStateRequest",
value: QueryChannelClientStateRequest.toAmino(message)
};
},
fromProtoMsg(message) {
return QueryChannelClientStateRequest.decode(message.value);
},
toProto(message) {
return QueryChannelClientStateRequest.encode(message).finish();
},
toProtoMsg(message) {
return {
typeUrl: "/ibc.core.channel.v1.QueryChannelClientStateRequest",
value: QueryChannelClientStateRequest.encode(message).finish()
};
}
};
function createBaseQueryChannelClientStateResponse() {
return {
identifiedClientState: undefined,
proof: new Uint8Array(),
proofHeight: Height.fromPartial({})
};
}
export const QueryChannelClientStateResponse = {
typeUrl: "/ibc.core.channel.v1.QueryChannelClientStateResponse",
encode(message, writer = BinaryWriter.create()) {
if (message.identifiedClientState !== undefined) {
IdentifiedClientState.encode(message.identifiedClientState, writer.uint32(10).fork()).ldelim();
}
if (message.proof.length !== 0) {
writer.uint32(18).bytes(message.proof);
}
if (message.proofHeight !== undefined) {
Height.encode(message.proofHeight, writer.uint32(26).fork()).ldelim();
}
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 = createBaseQueryChannelClientStateResponse();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
message.identifiedClientState = IdentifiedClientState.decode(reader, reader.uint32());
break;
case 2:
message.proof = reader.bytes();
break;
case 3:
message.proofHeight = Height.decode(reader, reader.uint32());
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
},
fromPartial(object) {
const message = createBaseQueryChannelClientStateResponse();
message.identifiedClientState = object.identifiedClientState !== undefined && object.identifiedClientState !== null ? IdentifiedClientState.fromPartial(object.identifiedClientState) : undefined;
message.proof = object.proof ?? new Uint8Array();
message.proofHeight = object.proofHeight !== undefined && object.proofHeight !== null ? Height.fromPartial(object.proofHeight) : undefined;
return message;
},
fromAmino(object) {
const message = createBaseQueryChannelClientStateResponse();
if (object.identified_client_state !== undefined && object.identified_client_state !== null) {
message.identifiedClientState = IdentifiedClientState.fromAmino(object.identified_client_state);
}
if (object.proof !== undefined && object.proof !== null) {
message.proof = bytesFromBase64(object.proof);
}
if (object.proof_height !== undefined && object.proof_height !== null) {
message.proofHeight = Height.fromAmino(object.proof_height);
}
return message;
},
toAmino(message) {
const obj = {};
obj.identified_client_state = message.identifiedClientState ? IdentifiedClientState.toAmino(message.identifiedClientState) : undefined;
obj.proof = message.proof ? base64FromBytes(message.proof) : undefined;
obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight) : {};
return obj;
},
fromAminoMsg(object) {
return QueryChannelClientStateResponse.fromAmino(object.value);
},
toAminoMsg(message) {
return {
type: "cosmos-sdk/QueryChannelClientStateResponse",
value: QueryChannelClientStateResponse.toAmino(message)
};
},
fromProtoMsg(message) {
return QueryChannelClientStateResponse.decode(message.value);
},
toProto(message) {
return QueryChannelClientStateResponse.encode(message).finish();
},
toProtoMsg(message) {
return {
typeUrl: "/ibc.core.channel.v1.QueryChannelClientStateResponse",
value: QueryChannelClientStateResponse.encode(message).finish()
};
}
};
function createBaseQueryChannelConsensusStateRequest() {
return {
portId: "",
channelId: "",
revisionNumber: BigInt(0),
revisionHeight: BigInt(0)
};
}
export const QueryChannelConsensusStateRequest = {
typeUrl: "/ibc.core.channel.v1.QueryChannelConsensusStateRequest",
encode(message, writer = BinaryWriter.create()) {
if (message.portId !== "") {
writer.uint32(10).string(message.portId);
}
if (message.channelId !== "") {
writer.uint32(18).string(message.channelId);
}
if (message.revisionNumber !== BigInt(0)) {
writer.uint32(24).uint64(message.revisionNumber);
}
if (message.revisionHeight !== BigInt(0)) {
writer.uint32(32).uint64(message.revisionHeight);
}
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 = createBaseQueryChannelConsensusStateRequest();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
message.portId = reader.string();
break;
case 2:
message.channelId = reader.string();
break;
case 3:
message.revisionNumber = reader.uint64();
break;
case 4:
message.revisionHeight = reader.uint64();
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
},
fromPartial(object) {
const message = createBaseQueryChannelConsensusStateRequest();
message.portId = object.portId ?? "";
message.channelId = object.channelId ?? "";
message.revisionNumber = object.revisionNumber !== undefined && object.revisionNumber !== null ? BigInt(object.revisionNumber.toString()) : BigInt(0);
message.revisionHeight = object.revisionHeight !== undefined && object.revisionHeight !== null ? BigInt(object.revisionHeight.toString()) : BigInt(0);
return message;
},
fromAmino(object) {
const message = createBaseQueryChannelConsensusStateRequest();
if (object.port_id !== undefined && object.port_id !== null) {
message.portId = object.port_id;
}
if (object.channel_id !== undefined && object.channel_id !== null) {
message.channelId = object.channel_id;
}
if (object.revision_number !== undefined && object.revision_number !== null) {
message.revisionNumber = BigInt(object.revision_number);
}
if (object.revision_height !== undefined && object.revision_height !== null) {
message.revisionHeight = BigInt(object.revision_height);
}
return message;
},
toAmino(message) {
const obj = {};
obj.port_id = message.portId === "" ? undefined : message.portId;
obj.channel_id = message.channelId === "" ? undefined : message.channelId;
obj.revision_number = message.revisionNumber !== BigInt(0) ? message.revisionNumber?.toString() : undefined;
obj.revision_height = message.revisionHeight !== BigInt(0) ? message.revisionHeight?.toString() : undefined;
return obj;
},
fromAminoMsg(object) {
return QueryChannelConsensusStateRequest.fromAmino(object.value);
},
toAminoMsg(message) {
return {
type: "cosmos-sdk/QueryChannelConsensusStateRequest",
value: QueryChannelConsensusStateRequest.toAmino(message)
};
},
fromProtoMsg(message) {
return QueryChannelConsensusStateRequest.decode(message.value);
},
toProto(message) {
return QueryChannelConsensusStateRequest.encode(message).finish();
},
toProtoMsg(message) {
return {
typeUrl: "/ibc.core.channel.v1.QueryChannelConsensusStateRequest",
value: QueryChannelConsensusStateRequest.encode(message).finish()
};
}
};
function createBaseQueryChannelConsensusStateResponse() {
return {
consensusState: undefined,
clientId: "",
proof: new Uint8Array(),
proofHeight: Height.fromPartial({})
};
}
export const QueryChannelConsensusStateResponse = {
typeUrl: "/ibc.core.channel.v1.QueryChannelConsensusStateResponse",
encode(message, writer = BinaryWriter.create()) {
if (message.consensusState !== undefined) {
Any.encode(message.consensusState, writer.uint32(10).fork()).ldelim();
}
if (message.clientId !== "") {
writer.uint32(18).string(message.clientId);
}
if (message.proof.length !== 0) {
writer.uint32(26).bytes(message.proof);
}
if (message.proofHeight !== undefined) {
Height.encode(message.proofHeight, writer.uint32(34).fork()).ldelim();
}
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 = createBaseQueryChannelConsensusStateResponse();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
message.consensusState = Any.decode(reader, reader.uint32());
break;
case 2:
message.clientId = reader.string();
break;
case 3:
message.proof = reader.bytes();
break;
case 4:
message.proofHeight = Height.decode(reader, reader.uint32());
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
},
fromPartial(object) {
const message = createBaseQueryChannelConsensusStateResponse();
message.consensusState = object.consensusState !== undefined && object.consensusState !== null ? Any.fromPartial(object.consensusState) : undefined;
message.clientId = object.clientId ?? "";
message.proof = object.proof ?? new Uint8Array();
message.proofHeight = object.proofHeight !== undefined && object.proofHeight !== null ? Height.fromPartial(object.proofHeight) : undefined;
return message;
},
fromAmino(object) {
const message = createBaseQueryChannelConsensusStateResponse();
if (object.consensus_state !== undefined && object.consensus_state !== null) {
message.consensusState = Any.fromAmino(object.consensus_state);
}
if (object.client_id !== undefined && object.client_id !== null) {
message.clientId = object.client_id;
}
if (object.proof !== undefined && object.proof !== null) {
message.proof = bytesFromBase64(object.proof);
}
if (object.proof_height !== undefined && object.proof_height !== null) {
message.proofHeight = Height.fromAmino(object.proof_height);
}
return message;
},
toAmino(message) {
const obj = {};
obj.consensus_state = message.consensusState ? Any.toAmino(message.consensusState) : undefined;
obj.client_id = message.clientId === "" ? undefined : message.clientId;
obj.proof = message.proof ? base64FromBytes(message.proof) : undefined;
obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight) : {};
return obj;
},
fromAminoMsg(object) {
return QueryChannelConsensusStateResponse.fromAmino(object.value);
},
toAminoMsg(message) {
return {
type: "cosmos-sdk/QueryChannelConsensusStateResponse",
value: QueryChannelConsensusStateResponse.toAmino(message)
};
},
fromProtoMsg(message) {
return QueryChannelConsensusStateResponse.decode(message.value);
},
toProto(message) {
return QueryChannelConsensusStateResponse.encode(message).finish();
},
toProtoMsg(message) {
return {
typeUrl: "/ibc.core.channel.v1.QueryChannelConsensusStateResponse",
value: QueryChannelConsensusStateResponse.encode(message).finish()
};
}
};
function createBaseQueryPacketCommitmentRequest() {
return {
portId: "",
channelId: "",
sequence: BigInt(0)
};
}
export const QueryPacketCommitmentRequest = {
typeUrl: "/ibc.core.channel.v1.QueryPacketCommitmentRequest",
encode(message, writer = BinaryWriter.create()) {
if (message.portId !== "") {
writer.uint32(10).string(message.portId);
}
if (message.channelId !== "") {
writer.uint32(18).string(message.channelId);
}
if (message.sequence !== BigInt(0)) {
writer.uint32(24).uint64(message.sequence);
}
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 = createBaseQueryPacketCommitmentRequest();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
message.portId = reader.string();
break;
case 2:
message.channelId = reader.string();
break;
case 3:
message.sequence = reader.uint64();
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
},
fromPartial(object) {
const message = createBaseQueryPacketCommitmentRequest();
message.portId = object.portId ?? "";
message.channelId = object.channelId ?? "";
message.sequence = object.sequence !== undefined && object.sequence !== null ? BigInt(object.sequence.toString()) : BigInt(0);
return message;
},
fromAmino(object) {
const message = createBaseQueryPacketCommitmentRequest();
if (object.port_id !== undefined && object.port_id !== null) {
message.portId = object.port_id;
}
if (object.channel_id !== undefined && object.channel_id !== null) {
message.channelId = object.channel_id;
}
if (object.sequence !== undefined && object.sequence !== null) {
message.sequence = BigInt(object.sequence);
}
return message;
},
toAmino(message) {
const obj = {};
obj.port_id = message.portId === "" ? undefined : message.portId;
obj.channel_id = message.channelId === "" ? undefined : message.channelId;
obj.sequence = message.sequence !== BigInt(0) ? message.sequence?.toString() : undefined;
return obj;
},
fromAminoMsg(object) {
return QueryPacketCommitmentRequest.fromAmino(object.value);
},
toAminoMsg(message) {
return {
type: "cosmos-sdk/QueryPacketCommitmentRequest",
value: QueryPacketCommitmentRequest.toAmino(message)
};
},
fromProtoMsg(message) {
return QueryPacketCommitmentRequest.decode(message.value);
},
toProto(message) {
return QueryPacketCommitmentRequest.encode(message).finish();
},
toProtoMsg(message) {
return {
typeUrl: "/ibc.core.channel.v1.QueryPacketCommitmentRequest",
value: QueryPacketCommitmentRequest.encode(message).finish()
};
}
};
function createBaseQueryPacketCommitmentResponse() {
return {
commitment: new Uint8Array(),
proof: new Uint8Array(),
proofHeight: Height.fromPartial({})
};
}
export const QueryPacketCommitmentResponse = {
typeUrl: "/ibc.core.channel.v1.QueryPacketCommitmentResponse",
encode(message, writer = BinaryWriter.create()) {
if (message.commitment.length !== 0) {
writer.uint32(10).bytes(message.commitment);
}
if (message.proof.length !== 0) {
writer.uint32(18).bytes(message.proof);
}
if (message.proofHeight !== undefined) {
Height.encode(message.proofHeight, writer.uint32(26).fork()).ldelim();
}
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 = createBaseQueryPacketCommitmentResponse();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
message.commitment = reader.bytes();
break;
case 2:
message.proof = reader.bytes();
break;
case 3:
message.proofHeight = Height.decode(reader, reader.uint32());
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
},
fromPartial(object) {
const message = createBaseQueryPacketCommitmentResponse();
message.commitment = object.commitment ?? new Uint8Array();
message.proof = object.proof ?? new Uint8Array();
message.proofHeight = object.proofHeight !== undefined && object.proofHeight !== null ? Height.fromPartial(object.proofHeight) : undefined;
return message;
},
fromAmino(object) {
const message = createBaseQueryPacketCommitmentResponse();
if (object.commitment !== undefined && object.commitment !== null) {
message.commitment = bytesFromBase64(object.commitment);
}
if (object.proof !== undefined && object.proof !== null) {
message.proof = bytesFromBase64(object.proof);
}
if (object.proof_height !== undefined && object.proof_height !== null) {
message.proofHeight = Height.fromAmino(object.proof_height);
}
return message;
},
toAmino(message) {
const obj = {};
obj.commitment = message.commitment ? base64FromBytes(message.commitment) : undefined;
obj.proof = message.proof ? base64FromBytes(message.proof) : undefined;
obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight) : {};
return obj;
},
fromAminoMsg(object) {
return QueryPacketCommitmentResponse.fromAmino(object.value);
},
toAminoMsg(message) {
return {
type: "cosmos-sdk/QueryPacketCommitmentResponse",
value: QueryPacketCommitmentResponse.toAmino(message)
};
},
fromProtoMsg(message) {
return QueryPacketCommitmentResponse.decode(message.value);
},
toProto(message) {
return QueryPacketCommitmentResponse.encode(message).finish();
},
toProtoMsg(message) {
return {
typeUrl: "/ibc.core.channel.v1.QueryPacketCommitmentResponse",
value: QueryPacketCommitmentResponse.encode(message).finish()
};
}
};
function createBaseQueryPacketCommitmentsRequest() {
return {
portId: "",
channelId: "",
pagination: undefined
};
}
export const QueryPacketCommitmentsRequest = {
typeUrl: "/ibc.core.channel.v1.QueryPacketCommitmentsRequest",
encode(message, writer = BinaryWriter.create()) {
if (message.portId !== "") {
writer.uint32(10).string(message.portId);
}
if (message.channelId !== "") {
writer.uint32(18).string(message.channelId);
}
if (message.pagination !== undefined) {
PageRequest.encode(message.pagination, writer.uint32(26).fork()).ldelim();
}
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 = createBaseQueryPacketCommitmentsRequest();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
message.portId = reader.string();
break;
case 2:
message.channelId = reader.string();
break;
case 3:
message.pagination = PageRequest.decode(reader, reader.uint32());
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
},
fromPartial(object) {
const message = createBaseQueryPacketCommitmentsRequest();
message.portId = object.portId ?? "";
message.channelId = object.channelId ?? "";
message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined;
return message;
},
fromAmino(object) {
const message = createBaseQueryPacketCommitmentsRequest();
if (object.port_id !== undefined && object.port_id !== null) {
message.portId = object.port_id;
}
if (object.channel_id !== undefined && object.channel_id !== null) {
message.channelId = object.channel_id;
}
if (object.pagination !== undefined && object.pagination !== null) {
message.pagination = PageRequest.fromAmino(object.pagination);
}
return message;
},
toAmino(message) {
const obj = {};
obj.port_id = message.portId === "" ? undefined : message.portId;
obj.channel_id = message.channelId === "" ? undefined : message.channelId;
obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined;
return obj;
},
fromAminoMsg(object) {
return QueryPacketCommitmentsRequest.fromAmino(object.value);
},
toAminoMsg(message) {
return {
type: "cosmos-sdk/QueryPacketCommitmentsRequest",
value: QueryPacketCommitmentsRequest.toAmino(message)
};
},
fromProtoMsg(message) {
return QueryPacketCommitmentsRequest.decode(message.value);
},
toProto(message) {
return QueryPacketCommitmentsRequest.encode(message).finish();
},
toProtoMsg(message) {
return {
typeUrl: "/ibc.core.channel.v1.QueryPacketCommitmentsRequest",
value: QueryPacketCommitmentsRequest.encode(message).finish()
};
}
};
function createBaseQueryPacketCommitmentsResponse() {
return {
commitments: [],
pagination: undefined,
height: Height.fromPartial({})
};
}
export const QueryPacketCommitmentsResponse = {
typeUrl: "/ibc.core.channel.v1.QueryPacketCommitmentsResponse",
encode(message, writer = BinaryWriter.create()) {
for (const v of message.commitments) {
PacketState.encode(v, writer.uint32(10).fork()).ldelim();
}
if (message.pagination !== undefined) {
PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim();
}
if (message.height !== undefined) {
Height.encode(message.height, writer.uint32(26).fork()).ldelim();
}
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 = createBaseQueryPacketCommitmentsResponse();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
message.commitments.push(PacketState.decode(reader, reader.uint32()));
break;
case 2:
message.pagination = PageResponse.decode(reader, reader.uint32());
break;
case 3:
message.height = Height.decode(reader, reader.uint32());
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
},
fromPartial(object) {
const message = createBaseQueryPacketCommitmentsResponse();
message.commitments = object.commitments?.map(e => PacketState.fromPartial(e)) || [];
message.pagination = object.pagination !== undefined && object.pagination !== null ? PageResponse.fromPartial(object.pagination) : undefined;
message.height = object.height !== undefined && object.height !== null ? Height.fromPartial(object.height) : undefined;
return message;
},
fromAmino(object) {
const message = createBaseQueryPacketCommitmentsResponse();
message.commitments = object.commitments?.map(e => PacketState.fromAmino(e)) || [];
if (object.pagination !== undefined && object.pagination !== null) {
message.pagination = PageResponse.fromAmino(object.pagination);
}
if (object.height !== undefined && object.height !== null) {
message.height = Height.fromAmino(object.height);
}
return message;
},
toAmino(message) {
const obj = {};
if (message.commitments) {
obj.commitments = message.commitments.map(e => e ? PacketState.toAmino(e) : undefined);
}
else {
obj.commitments = message.commitments;
}
obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined;
obj.height = message.height ? Height.toAmino(message.height) : {};
return obj;
},
fromAminoMsg(object) {
return QueryPacketCommitmentsResponse.fromAmino(object.value);
},
toAminoMsg(message) {
return {
type: "cosmos-sdk/QueryPacketCommitmentsResponse",
value: QueryPacketCommitmentsResponse.toAmino(message)
};
},
fromProtoMsg(message) {
return QueryPacketCommitmentsResponse.decode(message.value);
},
toProto(message) {
return QueryPacketCommitmentsResponse.encode(message).finish();
},
toProtoMsg(message) {
return {
typeUrl: "/ibc.core.channel.v1.QueryPacketCommitmentsResponse",
value: QueryPacketCommitmentsResponse.encode(message).finish()
};
}
};
function createBaseQueryPacketReceiptRequest() {
return {
portId: "",
channelId: ""