UNPKG

interchainjs

Version:

InterchainJS is a JavaScript library for interacting with Cosmos SDK based blockchains.

1,286 lines 86.2 kB
import { Channel, Packet } from "./channel"; import { Height } from "../../client/v1/client"; import { BinaryReader, BinaryWriter } from "../../../../binary"; import { GlobalDecoderRegistry } from "../../../../registry"; import { bytesFromBase64, base64FromBytes, isSet } from "../../../../helpers"; /** ResponseResultType defines the possible outcomes of the execution of a message */ export var ResponseResultType; (function (ResponseResultType) { /** RESPONSE_RESULT_TYPE_UNSPECIFIED - Default zero value enumeration */ ResponseResultType[ResponseResultType["RESPONSE_RESULT_TYPE_UNSPECIFIED"] = 0] = "RESPONSE_RESULT_TYPE_UNSPECIFIED"; /** RESPONSE_RESULT_TYPE_NOOP - The message did not call the IBC application callbacks (because, for example, the packet had already been relayed) */ ResponseResultType[ResponseResultType["RESPONSE_RESULT_TYPE_NOOP"] = 1] = "RESPONSE_RESULT_TYPE_NOOP"; /** RESPONSE_RESULT_TYPE_SUCCESS - The message was executed successfully */ ResponseResultType[ResponseResultType["RESPONSE_RESULT_TYPE_SUCCESS"] = 2] = "RESPONSE_RESULT_TYPE_SUCCESS"; /** RESPONSE_RESULT_TYPE_FAILURE - The message was executed unsuccessfully */ ResponseResultType[ResponseResultType["RESPONSE_RESULT_TYPE_FAILURE"] = 3] = "RESPONSE_RESULT_TYPE_FAILURE"; ResponseResultType[ResponseResultType["UNRECOGNIZED"] = -1] = "UNRECOGNIZED"; })(ResponseResultType || (ResponseResultType = {})); export const ResponseResultTypeAmino = ResponseResultType; export function responseResultTypeFromJSON(object) { switch (object) { case 0: case "RESPONSE_RESULT_TYPE_UNSPECIFIED": return ResponseResultType.RESPONSE_RESULT_TYPE_UNSPECIFIED; case 1: case "RESPONSE_RESULT_TYPE_NOOP": return ResponseResultType.RESPONSE_RESULT_TYPE_NOOP; case 2: case "RESPONSE_RESULT_TYPE_SUCCESS": return ResponseResultType.RESPONSE_RESULT_TYPE_SUCCESS; case 3: case "RESPONSE_RESULT_TYPE_FAILURE": return ResponseResultType.RESPONSE_RESULT_TYPE_FAILURE; case -1: case "UNRECOGNIZED": default: return ResponseResultType.UNRECOGNIZED; } } export function responseResultTypeToJSON(object) { switch (object) { case ResponseResultType.RESPONSE_RESULT_TYPE_UNSPECIFIED: return "RESPONSE_RESULT_TYPE_UNSPECIFIED"; case ResponseResultType.RESPONSE_RESULT_TYPE_NOOP: return "RESPONSE_RESULT_TYPE_NOOP"; case ResponseResultType.RESPONSE_RESULT_TYPE_SUCCESS: return "RESPONSE_RESULT_TYPE_SUCCESS"; case ResponseResultType.RESPONSE_RESULT_TYPE_FAILURE: return "RESPONSE_RESULT_TYPE_FAILURE"; case ResponseResultType.UNRECOGNIZED: default: return "UNRECOGNIZED"; } } function createBaseMsgChannelOpenInit() { return { portId: "", channel: Channel.fromPartial({}), signer: "" }; } /** * MsgChannelOpenInit defines an sdk.Msg to initialize a channel handshake. It * is called by a relayer on Chain A. * @name MsgChannelOpenInit * @package ibc.core.channel.v1 * @see proto type: ibc.core.channel.v1.MsgChannelOpenInit */ export const MsgChannelOpenInit = { typeUrl: "/ibc.core.channel.v1.MsgChannelOpenInit", aminoType: "cosmos-sdk/MsgChannelOpenInit", is(o) { return o && (o.$typeUrl === MsgChannelOpenInit.typeUrl || typeof o.portId === "string" && Channel.is(o.channel) && typeof o.signer === "string"); }, isAmino(o) { return o && (o.$typeUrl === MsgChannelOpenInit.typeUrl || typeof o.port_id === "string" && Channel.isAmino(o.channel) && typeof o.signer === "string"); }, encode(message, writer = BinaryWriter.create()) { if (message.portId !== "") { writer.uint32(10).string(message.portId); } if (message.channel !== undefined) { Channel.encode(message.channel, writer.uint32(18).fork()).ldelim(); } if (message.signer !== "") { writer.uint32(26).string(message.signer); } 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 = createBaseMsgChannelOpenInit(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: message.portId = reader.string(); break; case 2: message.channel = Channel.decode(reader, reader.uint32()); break; case 3: message.signer = reader.string(); break; default: reader.skipType(tag & 7); break; } } return message; }, fromPartial(object) { const message = createBaseMsgChannelOpenInit(); message.portId = object.portId ?? ""; message.channel = object.channel !== undefined && object.channel !== null ? Channel.fromPartial(object.channel) : undefined; message.signer = object.signer ?? ""; return message; }, fromAmino(object) { const message = createBaseMsgChannelOpenInit(); if (object.port_id !== undefined && object.port_id !== null) { message.portId = object.port_id; } if (object.channel !== undefined && object.channel !== null) { message.channel = Channel.fromAmino(object.channel); } if (object.signer !== undefined && object.signer !== null) { message.signer = object.signer; } return message; }, toAmino(message) { const obj = {}; obj.port_id = message.portId === "" ? undefined : message.portId; obj.channel = message.channel ? Channel.toAmino(message.channel) : undefined; obj.signer = message.signer === "" ? undefined : message.signer; return obj; }, fromAminoMsg(object) { return MsgChannelOpenInit.fromAmino(object.value); }, toAminoMsg(message) { return { type: "cosmos-sdk/MsgChannelOpenInit", value: MsgChannelOpenInit.toAmino(message) }; }, fromProtoMsg(message) { return MsgChannelOpenInit.decode(message.value); }, toProto(message) { return MsgChannelOpenInit.encode(message).finish(); }, toProtoMsg(message) { return { typeUrl: "/ibc.core.channel.v1.MsgChannelOpenInit", value: MsgChannelOpenInit.encode(message).finish() }; }, registerTypeUrl() { if (!GlobalDecoderRegistry.registerExistingTypeUrl(MsgChannelOpenInit.typeUrl)) { return; } Channel.registerTypeUrl(); } }; function createBaseMsgChannelOpenInitResponse() { return { channelId: "", version: "" }; } /** * MsgChannelOpenInitResponse defines the Msg/ChannelOpenInit response type. * @name MsgChannelOpenInitResponse * @package ibc.core.channel.v1 * @see proto type: ibc.core.channel.v1.MsgChannelOpenInitResponse */ export const MsgChannelOpenInitResponse = { typeUrl: "/ibc.core.channel.v1.MsgChannelOpenInitResponse", aminoType: "cosmos-sdk/MsgChannelOpenInitResponse", is(o) { return o && (o.$typeUrl === MsgChannelOpenInitResponse.typeUrl || typeof o.channelId === "string" && typeof o.version === "string"); }, isAmino(o) { return o && (o.$typeUrl === MsgChannelOpenInitResponse.typeUrl || typeof o.channel_id === "string" && typeof o.version === "string"); }, encode(message, writer = BinaryWriter.create()) { if (message.channelId !== "") { writer.uint32(10).string(message.channelId); } if (message.version !== "") { writer.uint32(18).string(message.version); } 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 = createBaseMsgChannelOpenInitResponse(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: message.channelId = reader.string(); break; case 2: message.version = reader.string(); break; default: reader.skipType(tag & 7); break; } } return message; }, fromPartial(object) { const message = createBaseMsgChannelOpenInitResponse(); message.channelId = object.channelId ?? ""; message.version = object.version ?? ""; return message; }, fromAmino(object) { const message = createBaseMsgChannelOpenInitResponse(); if (object.channel_id !== undefined && object.channel_id !== null) { message.channelId = object.channel_id; } if (object.version !== undefined && object.version !== null) { message.version = object.version; } return message; }, toAmino(message) { const obj = {}; obj.channel_id = message.channelId === "" ? undefined : message.channelId; obj.version = message.version === "" ? undefined : message.version; return obj; }, fromAminoMsg(object) { return MsgChannelOpenInitResponse.fromAmino(object.value); }, toAminoMsg(message) { return { type: "cosmos-sdk/MsgChannelOpenInitResponse", value: MsgChannelOpenInitResponse.toAmino(message) }; }, fromProtoMsg(message) { return MsgChannelOpenInitResponse.decode(message.value); }, toProto(message) { return MsgChannelOpenInitResponse.encode(message).finish(); }, toProtoMsg(message) { return { typeUrl: "/ibc.core.channel.v1.MsgChannelOpenInitResponse", value: MsgChannelOpenInitResponse.encode(message).finish() }; }, registerTypeUrl() { } }; function createBaseMsgChannelOpenTry() { return { portId: "", previousChannelId: "", channel: Channel.fromPartial({}), counterpartyVersion: "", proofInit: new Uint8Array(), proofHeight: Height.fromPartial({}), signer: "" }; } /** * MsgChannelOpenInit defines a msg sent by a Relayer to try to open a channel * on Chain B. The version field within the Channel field has been deprecated. Its * value will be ignored by core IBC. * @name MsgChannelOpenTry * @package ibc.core.channel.v1 * @see proto type: ibc.core.channel.v1.MsgChannelOpenTry */ export const MsgChannelOpenTry = { typeUrl: "/ibc.core.channel.v1.MsgChannelOpenTry", aminoType: "cosmos-sdk/MsgChannelOpenTry", is(o) { return o && (o.$typeUrl === MsgChannelOpenTry.typeUrl || typeof o.portId === "string" && typeof o.previousChannelId === "string" && Channel.is(o.channel) && typeof o.counterpartyVersion === "string" && (o.proofInit instanceof Uint8Array || typeof o.proofInit === "string") && Height.is(o.proofHeight) && typeof o.signer === "string"); }, isAmino(o) { return o && (o.$typeUrl === MsgChannelOpenTry.typeUrl || typeof o.port_id === "string" && typeof o.previous_channel_id === "string" && Channel.isAmino(o.channel) && typeof o.counterparty_version === "string" && (o.proof_init instanceof Uint8Array || typeof o.proof_init === "string") && Height.isAmino(o.proof_height) && typeof o.signer === "string"); }, encode(message, writer = BinaryWriter.create()) { if (message.portId !== "") { writer.uint32(10).string(message.portId); } if (message.previousChannelId !== "") { writer.uint32(18).string(message.previousChannelId); } if (message.channel !== undefined) { Channel.encode(message.channel, writer.uint32(26).fork()).ldelim(); } if (message.counterpartyVersion !== "") { writer.uint32(34).string(message.counterpartyVersion); } if (message.proofInit.length !== 0) { writer.uint32(42).bytes(message.proofInit); } if (message.proofHeight !== undefined) { Height.encode(message.proofHeight, writer.uint32(50).fork()).ldelim(); } if (message.signer !== "") { writer.uint32(58).string(message.signer); } 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 = createBaseMsgChannelOpenTry(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: message.portId = reader.string(); break; case 2: message.previousChannelId = reader.string(); break; case 3: message.channel = Channel.decode(reader, reader.uint32()); break; case 4: message.counterpartyVersion = reader.string(); break; case 5: message.proofInit = reader.bytes(); break; case 6: message.proofHeight = Height.decode(reader, reader.uint32()); break; case 7: message.signer = reader.string(); break; default: reader.skipType(tag & 7); break; } } return message; }, fromPartial(object) { const message = createBaseMsgChannelOpenTry(); message.portId = object.portId ?? ""; message.previousChannelId = object.previousChannelId ?? ""; message.channel = object.channel !== undefined && object.channel !== null ? Channel.fromPartial(object.channel) : undefined; message.counterpartyVersion = object.counterpartyVersion ?? ""; message.proofInit = object.proofInit ?? new Uint8Array(); message.proofHeight = object.proofHeight !== undefined && object.proofHeight !== null ? Height.fromPartial(object.proofHeight) : undefined; message.signer = object.signer ?? ""; return message; }, fromAmino(object) { const message = createBaseMsgChannelOpenTry(); if (object.port_id !== undefined && object.port_id !== null) { message.portId = object.port_id; } if (object.previous_channel_id !== undefined && object.previous_channel_id !== null) { message.previousChannelId = object.previous_channel_id; } if (object.channel !== undefined && object.channel !== null) { message.channel = Channel.fromAmino(object.channel); } if (object.counterparty_version !== undefined && object.counterparty_version !== null) { message.counterpartyVersion = object.counterparty_version; } if (object.proof_init !== undefined && object.proof_init !== null) { message.proofInit = bytesFromBase64(object.proof_init); } if (object.proof_height !== undefined && object.proof_height !== null) { message.proofHeight = Height.fromAmino(object.proof_height); } if (object.signer !== undefined && object.signer !== null) { message.signer = object.signer; } return message; }, toAmino(message) { const obj = {}; obj.port_id = message.portId === "" ? undefined : message.portId; obj.previous_channel_id = message.previousChannelId === "" ? undefined : message.previousChannelId; obj.channel = message.channel ? Channel.toAmino(message.channel) : undefined; obj.counterparty_version = message.counterpartyVersion === "" ? undefined : message.counterpartyVersion; obj.proof_init = message.proofInit ? base64FromBytes(message.proofInit) : undefined; obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight) : {}; obj.signer = message.signer === "" ? undefined : message.signer; return obj; }, fromAminoMsg(object) { return MsgChannelOpenTry.fromAmino(object.value); }, toAminoMsg(message) { return { type: "cosmos-sdk/MsgChannelOpenTry", value: MsgChannelOpenTry.toAmino(message) }; }, fromProtoMsg(message) { return MsgChannelOpenTry.decode(message.value); }, toProto(message) { return MsgChannelOpenTry.encode(message).finish(); }, toProtoMsg(message) { return { typeUrl: "/ibc.core.channel.v1.MsgChannelOpenTry", value: MsgChannelOpenTry.encode(message).finish() }; }, registerTypeUrl() { if (!GlobalDecoderRegistry.registerExistingTypeUrl(MsgChannelOpenTry.typeUrl)) { return; } Channel.registerTypeUrl(); Height.registerTypeUrl(); } }; function createBaseMsgChannelOpenTryResponse() { return { version: "", channelId: "" }; } /** * MsgChannelOpenTryResponse defines the Msg/ChannelOpenTry response type. * @name MsgChannelOpenTryResponse * @package ibc.core.channel.v1 * @see proto type: ibc.core.channel.v1.MsgChannelOpenTryResponse */ export const MsgChannelOpenTryResponse = { typeUrl: "/ibc.core.channel.v1.MsgChannelOpenTryResponse", aminoType: "cosmos-sdk/MsgChannelOpenTryResponse", is(o) { return o && (o.$typeUrl === MsgChannelOpenTryResponse.typeUrl || typeof o.version === "string" && typeof o.channelId === "string"); }, isAmino(o) { return o && (o.$typeUrl === MsgChannelOpenTryResponse.typeUrl || typeof o.version === "string" && typeof o.channel_id === "string"); }, encode(message, writer = BinaryWriter.create()) { if (message.version !== "") { writer.uint32(10).string(message.version); } 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 = createBaseMsgChannelOpenTryResponse(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: message.version = reader.string(); break; case 2: message.channelId = reader.string(); break; default: reader.skipType(tag & 7); break; } } return message; }, fromPartial(object) { const message = createBaseMsgChannelOpenTryResponse(); message.version = object.version ?? ""; message.channelId = object.channelId ?? ""; return message; }, fromAmino(object) { const message = createBaseMsgChannelOpenTryResponse(); if (object.version !== undefined && object.version !== null) { message.version = object.version; } if (object.channel_id !== undefined && object.channel_id !== null) { message.channelId = object.channel_id; } return message; }, toAmino(message) { const obj = {}; obj.version = message.version === "" ? undefined : message.version; obj.channel_id = message.channelId === "" ? undefined : message.channelId; return obj; }, fromAminoMsg(object) { return MsgChannelOpenTryResponse.fromAmino(object.value); }, toAminoMsg(message) { return { type: "cosmos-sdk/MsgChannelOpenTryResponse", value: MsgChannelOpenTryResponse.toAmino(message) }; }, fromProtoMsg(message) { return MsgChannelOpenTryResponse.decode(message.value); }, toProto(message) { return MsgChannelOpenTryResponse.encode(message).finish(); }, toProtoMsg(message) { return { typeUrl: "/ibc.core.channel.v1.MsgChannelOpenTryResponse", value: MsgChannelOpenTryResponse.encode(message).finish() }; }, registerTypeUrl() { } }; function createBaseMsgChannelOpenAck() { return { portId: "", channelId: "", counterpartyChannelId: "", counterpartyVersion: "", proofTry: new Uint8Array(), proofHeight: Height.fromPartial({}), signer: "" }; } /** * MsgChannelOpenAck defines a msg sent by a Relayer to Chain A to acknowledge * the change of channel state to TRYOPEN on Chain B. * @name MsgChannelOpenAck * @package ibc.core.channel.v1 * @see proto type: ibc.core.channel.v1.MsgChannelOpenAck */ export const MsgChannelOpenAck = { typeUrl: "/ibc.core.channel.v1.MsgChannelOpenAck", aminoType: "cosmos-sdk/MsgChannelOpenAck", is(o) { return o && (o.$typeUrl === MsgChannelOpenAck.typeUrl || typeof o.portId === "string" && typeof o.channelId === "string" && typeof o.counterpartyChannelId === "string" && typeof o.counterpartyVersion === "string" && (o.proofTry instanceof Uint8Array || typeof o.proofTry === "string") && Height.is(o.proofHeight) && typeof o.signer === "string"); }, isAmino(o) { return o && (o.$typeUrl === MsgChannelOpenAck.typeUrl || typeof o.port_id === "string" && typeof o.channel_id === "string" && typeof o.counterparty_channel_id === "string" && typeof o.counterparty_version === "string" && (o.proof_try instanceof Uint8Array || typeof o.proof_try === "string") && Height.isAmino(o.proof_height) && typeof o.signer === "string"); }, 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.counterpartyChannelId !== "") { writer.uint32(26).string(message.counterpartyChannelId); } if (message.counterpartyVersion !== "") { writer.uint32(34).string(message.counterpartyVersion); } if (message.proofTry.length !== 0) { writer.uint32(42).bytes(message.proofTry); } if (message.proofHeight !== undefined) { Height.encode(message.proofHeight, writer.uint32(50).fork()).ldelim(); } if (message.signer !== "") { writer.uint32(58).string(message.signer); } 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 = createBaseMsgChannelOpenAck(); 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.counterpartyChannelId = reader.string(); break; case 4: message.counterpartyVersion = reader.string(); break; case 5: message.proofTry = reader.bytes(); break; case 6: message.proofHeight = Height.decode(reader, reader.uint32()); break; case 7: message.signer = reader.string(); break; default: reader.skipType(tag & 7); break; } } return message; }, fromPartial(object) { const message = createBaseMsgChannelOpenAck(); message.portId = object.portId ?? ""; message.channelId = object.channelId ?? ""; message.counterpartyChannelId = object.counterpartyChannelId ?? ""; message.counterpartyVersion = object.counterpartyVersion ?? ""; message.proofTry = object.proofTry ?? new Uint8Array(); message.proofHeight = object.proofHeight !== undefined && object.proofHeight !== null ? Height.fromPartial(object.proofHeight) : undefined; message.signer = object.signer ?? ""; return message; }, fromAmino(object) { const message = createBaseMsgChannelOpenAck(); 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.counterparty_channel_id !== undefined && object.counterparty_channel_id !== null) { message.counterpartyChannelId = object.counterparty_channel_id; } if (object.counterparty_version !== undefined && object.counterparty_version !== null) { message.counterpartyVersion = object.counterparty_version; } if (object.proof_try !== undefined && object.proof_try !== null) { message.proofTry = bytesFromBase64(object.proof_try); } if (object.proof_height !== undefined && object.proof_height !== null) { message.proofHeight = Height.fromAmino(object.proof_height); } if (object.signer !== undefined && object.signer !== null) { message.signer = object.signer; } return message; }, toAmino(message) { const obj = {}; obj.port_id = message.portId === "" ? undefined : message.portId; obj.channel_id = message.channelId === "" ? undefined : message.channelId; obj.counterparty_channel_id = message.counterpartyChannelId === "" ? undefined : message.counterpartyChannelId; obj.counterparty_version = message.counterpartyVersion === "" ? undefined : message.counterpartyVersion; obj.proof_try = message.proofTry ? base64FromBytes(message.proofTry) : undefined; obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight) : {}; obj.signer = message.signer === "" ? undefined : message.signer; return obj; }, fromAminoMsg(object) { return MsgChannelOpenAck.fromAmino(object.value); }, toAminoMsg(message) { return { type: "cosmos-sdk/MsgChannelOpenAck", value: MsgChannelOpenAck.toAmino(message) }; }, fromProtoMsg(message) { return MsgChannelOpenAck.decode(message.value); }, toProto(message) { return MsgChannelOpenAck.encode(message).finish(); }, toProtoMsg(message) { return { typeUrl: "/ibc.core.channel.v1.MsgChannelOpenAck", value: MsgChannelOpenAck.encode(message).finish() }; }, registerTypeUrl() { if (!GlobalDecoderRegistry.registerExistingTypeUrl(MsgChannelOpenAck.typeUrl)) { return; } Height.registerTypeUrl(); } }; function createBaseMsgChannelOpenAckResponse() { return {}; } /** * MsgChannelOpenAckResponse defines the Msg/ChannelOpenAck response type. * @name MsgChannelOpenAckResponse * @package ibc.core.channel.v1 * @see proto type: ibc.core.channel.v1.MsgChannelOpenAckResponse */ export const MsgChannelOpenAckResponse = { typeUrl: "/ibc.core.channel.v1.MsgChannelOpenAckResponse", aminoType: "cosmos-sdk/MsgChannelOpenAckResponse", is(o) { return o && o.$typeUrl === MsgChannelOpenAckResponse.typeUrl; }, isAmino(o) { return o && o.$typeUrl === MsgChannelOpenAckResponse.typeUrl; }, encode(_, writer = BinaryWriter.create()) { 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 = createBaseMsgChannelOpenAckResponse(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { default: reader.skipType(tag & 7); break; } } return message; }, fromPartial(_) { const message = createBaseMsgChannelOpenAckResponse(); return message; }, fromAmino(_) { const message = createBaseMsgChannelOpenAckResponse(); return message; }, toAmino(_) { const obj = {}; return obj; }, fromAminoMsg(object) { return MsgChannelOpenAckResponse.fromAmino(object.value); }, toAminoMsg(message) { return { type: "cosmos-sdk/MsgChannelOpenAckResponse", value: MsgChannelOpenAckResponse.toAmino(message) }; }, fromProtoMsg(message) { return MsgChannelOpenAckResponse.decode(message.value); }, toProto(message) { return MsgChannelOpenAckResponse.encode(message).finish(); }, toProtoMsg(message) { return { typeUrl: "/ibc.core.channel.v1.MsgChannelOpenAckResponse", value: MsgChannelOpenAckResponse.encode(message).finish() }; }, registerTypeUrl() { } }; function createBaseMsgChannelOpenConfirm() { return { portId: "", channelId: "", proofAck: new Uint8Array(), proofHeight: Height.fromPartial({}), signer: "" }; } /** * MsgChannelOpenConfirm defines a msg sent by a Relayer to Chain B to * acknowledge the change of channel state to OPEN on Chain A. * @name MsgChannelOpenConfirm * @package ibc.core.channel.v1 * @see proto type: ibc.core.channel.v1.MsgChannelOpenConfirm */ export const MsgChannelOpenConfirm = { typeUrl: "/ibc.core.channel.v1.MsgChannelOpenConfirm", aminoType: "cosmos-sdk/MsgChannelOpenConfirm", is(o) { return o && (o.$typeUrl === MsgChannelOpenConfirm.typeUrl || typeof o.portId === "string" && typeof o.channelId === "string" && (o.proofAck instanceof Uint8Array || typeof o.proofAck === "string") && Height.is(o.proofHeight) && typeof o.signer === "string"); }, isAmino(o) { return o && (o.$typeUrl === MsgChannelOpenConfirm.typeUrl || typeof o.port_id === "string" && typeof o.channel_id === "string" && (o.proof_ack instanceof Uint8Array || typeof o.proof_ack === "string") && Height.isAmino(o.proof_height) && typeof o.signer === "string"); }, 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.proofAck.length !== 0) { writer.uint32(26).bytes(message.proofAck); } if (message.proofHeight !== undefined) { Height.encode(message.proofHeight, writer.uint32(34).fork()).ldelim(); } if (message.signer !== "") { writer.uint32(42).string(message.signer); } 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 = createBaseMsgChannelOpenConfirm(); 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.proofAck = reader.bytes(); break; case 4: message.proofHeight = Height.decode(reader, reader.uint32()); break; case 5: message.signer = reader.string(); break; default: reader.skipType(tag & 7); break; } } return message; }, fromPartial(object) { const message = createBaseMsgChannelOpenConfirm(); message.portId = object.portId ?? ""; message.channelId = object.channelId ?? ""; message.proofAck = object.proofAck ?? new Uint8Array(); message.proofHeight = object.proofHeight !== undefined && object.proofHeight !== null ? Height.fromPartial(object.proofHeight) : undefined; message.signer = object.signer ?? ""; return message; }, fromAmino(object) { const message = createBaseMsgChannelOpenConfirm(); 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.proof_ack !== undefined && object.proof_ack !== null) { message.proofAck = bytesFromBase64(object.proof_ack); } if (object.proof_height !== undefined && object.proof_height !== null) { message.proofHeight = Height.fromAmino(object.proof_height); } if (object.signer !== undefined && object.signer !== null) { message.signer = object.signer; } return message; }, toAmino(message) { const obj = {}; obj.port_id = message.portId === "" ? undefined : message.portId; obj.channel_id = message.channelId === "" ? undefined : message.channelId; obj.proof_ack = message.proofAck ? base64FromBytes(message.proofAck) : undefined; obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight) : {}; obj.signer = message.signer === "" ? undefined : message.signer; return obj; }, fromAminoMsg(object) { return MsgChannelOpenConfirm.fromAmino(object.value); }, toAminoMsg(message) { return { type: "cosmos-sdk/MsgChannelOpenConfirm", value: MsgChannelOpenConfirm.toAmino(message) }; }, fromProtoMsg(message) { return MsgChannelOpenConfirm.decode(message.value); }, toProto(message) { return MsgChannelOpenConfirm.encode(message).finish(); }, toProtoMsg(message) { return { typeUrl: "/ibc.core.channel.v1.MsgChannelOpenConfirm", value: MsgChannelOpenConfirm.encode(message).finish() }; }, registerTypeUrl() { if (!GlobalDecoderRegistry.registerExistingTypeUrl(MsgChannelOpenConfirm.typeUrl)) { return; } Height.registerTypeUrl(); } }; function createBaseMsgChannelOpenConfirmResponse() { return {}; } /** * MsgChannelOpenConfirmResponse defines the Msg/ChannelOpenConfirm response * type. * @name MsgChannelOpenConfirmResponse * @package ibc.core.channel.v1 * @see proto type: ibc.core.channel.v1.MsgChannelOpenConfirmResponse */ export const MsgChannelOpenConfirmResponse = { typeUrl: "/ibc.core.channel.v1.MsgChannelOpenConfirmResponse", aminoType: "cosmos-sdk/MsgChannelOpenConfirmResponse", is(o) { return o && o.$typeUrl === MsgChannelOpenConfirmResponse.typeUrl; }, isAmino(o) { return o && o.$typeUrl === MsgChannelOpenConfirmResponse.typeUrl; }, encode(_, writer = BinaryWriter.create()) { 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 = createBaseMsgChannelOpenConfirmResponse(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { default: reader.skipType(tag & 7); break; } } return message; }, fromPartial(_) { const message = createBaseMsgChannelOpenConfirmResponse(); return message; }, fromAmino(_) { const message = createBaseMsgChannelOpenConfirmResponse(); return message; }, toAmino(_) { const obj = {}; return obj; }, fromAminoMsg(object) { return MsgChannelOpenConfirmResponse.fromAmino(object.value); }, toAminoMsg(message) { return { type: "cosmos-sdk/MsgChannelOpenConfirmResponse", value: MsgChannelOpenConfirmResponse.toAmino(message) }; }, fromProtoMsg(message) { return MsgChannelOpenConfirmResponse.decode(message.value); }, toProto(message) { return MsgChannelOpenConfirmResponse.encode(message).finish(); }, toProtoMsg(message) { return { typeUrl: "/ibc.core.channel.v1.MsgChannelOpenConfirmResponse", value: MsgChannelOpenConfirmResponse.encode(message).finish() }; }, registerTypeUrl() { } }; function createBaseMsgChannelCloseInit() { return { portId: "", channelId: "", signer: "" }; } /** * MsgChannelCloseInit defines a msg sent by a Relayer to Chain A * to close a channel with Chain B. * @name MsgChannelCloseInit * @package ibc.core.channel.v1 * @see proto type: ibc.core.channel.v1.MsgChannelCloseInit */ export const MsgChannelCloseInit = { typeUrl: "/ibc.core.channel.v1.MsgChannelCloseInit", aminoType: "cosmos-sdk/MsgChannelCloseInit", is(o) { return o && (o.$typeUrl === MsgChannelCloseInit.typeUrl || typeof o.portId === "string" && typeof o.channelId === "string" && typeof o.signer === "string"); }, isAmino(o) { return o && (o.$typeUrl === MsgChannelCloseInit.typeUrl || typeof o.port_id === "string" && typeof o.channel_id === "string" && typeof o.signer === "string"); }, 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.signer !== "") { writer.uint32(26).string(message.signer); } 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 = createBaseMsgChannelCloseInit(); 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.signer = reader.string(); break; default: reader.skipType(tag & 7); break; } } return message; }, fromPartial(object) { const message = createBaseMsgChannelCloseInit(); message.portId = object.portId ?? ""; message.channelId = object.channelId ?? ""; message.signer = object.signer ?? ""; return message; }, fromAmino(object) { const message = createBaseMsgChannelCloseInit(); 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.signer !== undefined && object.signer !== null) { message.signer = object.signer; } return message; }, toAmino(message) { const obj = {}; obj.port_id = message.portId === "" ? undefined : message.portId; obj.channel_id = message.channelId === "" ? undefined : message.channelId; obj.signer = message.signer === "" ? undefined : message.signer; return obj; }, fromAminoMsg(object) { return MsgChannelCloseInit.fromAmino(object.value); }, toAminoMsg(message) { return { type: "cosmos-sdk/MsgChannelCloseInit", value: MsgChannelCloseInit.toAmino(message) }; }, fromProtoMsg(message) { return MsgChannelCloseInit.decode(message.value); }, toProto(message) { return MsgChannelCloseInit.encode(message).finish(); }, toProtoMsg(message) { return { typeUrl: "/ibc.core.channel.v1.MsgChannelCloseInit", value: MsgChannelCloseInit.encode(message).finish() }; }, registerTypeUrl() { } }; function createBaseMsgChannelCloseInitResponse() { return {}; } /** * MsgChannelCloseInitResponse defines the Msg/ChannelCloseInit response type. * @name MsgChannelCloseInitResponse * @package ibc.core.channel.v1 * @see proto type: ibc.core.channel.v1.MsgChannelCloseInitResponse */ export const MsgChannelCloseInitResponse = { typeUrl: "/ibc.core.channel.v1.MsgChannelCloseInitResponse", aminoType: "cosmos-sdk/MsgChannelCloseInitResponse", is(o) { return o && o.$typeUrl === MsgChannelCloseInitResponse.typeUrl; }, isAmino(o) { return o && o.$typeUrl === MsgChannelCloseInitResponse.typeUrl; }, encode(_, writer = BinaryWriter.create()) { 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 = createBaseMsgChannelCloseInitResponse(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { default: reader.skipType(tag & 7); break; } } return message; }, fromPartial(_) { const message = createBaseMsgChannelCloseInitResponse(); return message; }, fromAmino(_) { const message = createBaseMsgChannelCloseInitResponse(); return message; }, toAmino(_) { const obj = {}; return obj; }, fromAminoMsg(object) { return MsgChannelCloseInitResponse.fromAmino(object.value); }, toAminoMsg(message) { return { type: "cosmos-sdk/MsgChannelCloseInitResponse", value: MsgChannelCloseInitResponse.toAmino(message) }; }, fromProtoMsg(message) { return MsgChannelCloseInitResponse.decode(message.value); }, toProto(message) { return MsgChannelCloseInitResponse.encode(message).finish(); }, toProtoMsg(message) { return { typeUrl: "/ibc.core.channel.v1.MsgChannelCloseInitResponse", value: MsgChannelCloseInitResponse.encode(message).finish() }; }, registerTypeUrl() { } }; function createBaseMsgChannelCloseConfirm() { return { portId: "", channelId: "", proofInit: new Uint8Array(), proofHeight: Height.fromPartial({}), signer: "" }; } /** * MsgChannelCloseConfirm defines a msg sent by a Relayer to Chain B * to acknowledge the change of channel state to CLOSED on Chain A. * @name MsgChannelCloseConfirm * @package ibc.core.channel.v1 * @see proto type: ibc.core.channel.v1.MsgChannelCloseConfirm */ export const MsgChannelCloseConfirm = { typeUrl: "/ibc.core.channel.v1.MsgChannelCloseConfirm", aminoType: "cosmos-sdk/MsgChannelCloseConfirm", is(o) { return o && (o.$typeUrl === MsgChannelCloseConfirm.typeUrl || typeof o.portId === "string" && typeof o.channelId === "string" && (o.proofInit instanceof Uint8Array || typeof o.proofInit === "string") && Height.is(o.proofHeight) && typeof o.signer === "string"); }, isAmino(o) { return o && (o.$typeUrl === MsgChannelCloseConfirm.typeUrl || typeof o.port_id === "string" && typeof o.channel_id === "string" && (o.proof_init instanceof Uint8Array || typeof o.proof_init === "string") && Height.isAmino(o.proof_height) && typeof o.signer === "string"); }, 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.proofInit.length !== 0) { writer.uint32(26).bytes(message.proofInit); } if (message.proofHeight !== undefined) { Height.encode(message.proofHeight, writer.uint32(34).fork()).ldelim(); } if (message.signer !== "") { writer.uint32(42).string(message.signer); } 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 = createBaseMsgChannelCloseConfirm(); 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.proofInit = reader.bytes(); break; case 4: message.proofHeight = Height.decode(reader, reader.uint32()); break; case 5: message.signer = reader.string(); break; default: reader.skipType(tag & 7); break; } } return message; }, fromPartial(object) { const message = createBaseMsgChannelCloseConfirm(); message.portId = object.portId ?? ""; message.channelId = object.channelId ?? ""; message.proofInit = object.proofInit ?? new Uint8Array(); message.proofHeight = object.proofHeight !== undefined && object.proofHeight !== null ? Height.fromPartial(object.proofHeight) : undefined; message.signer = object.signer ?? ""; return message; }, fromAmino(object) { const message = createBaseMsgChannelCloseConfirm(); 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.proof_init !== undefined && object.proof_init !== null) { message.proofInit = bytesFromBase64(object.proof_init); } if (object.proof_height !== undefined && object.proof_height !== null) { message.proofHeight = Height.fromAmino(object.proof_height); } if (object.signer !== undefined && object.signer !== null) { message.signer = object.signer; } return message; }, toAmino(message) { const obj = {}; obj.port_id = message.portId === "" ? undefined : message.portId; obj.channel_id = message.channelId === "" ? undefined : message.channelId; obj.proof_init = message.proofInit ? base64FromBytes(message.proofInit) : undefined; obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight) : {}; obj.signer = message.signer === "" ? undefined : message.signer; return obj; }, fromAminoMsg(object) { return MsgChannelCloseConfirm.fromAmino(object.value); }, toAminoMsg(message) { return { type: "cosmos-sdk/MsgChannelCloseConfirm", value: MsgChannelCloseConfirm.toAmino(message) }; }, fromProtoMsg(message) { return MsgChannelCloseConfirm.decode(message.value); }, toProto(message) { return MsgChannelCloseConfirm.encode(message).finish(); }, toProtoMsg(message) { return { typeUrl: "/ibc.core.channel.v1.MsgChannelCloseConfirm", value: MsgChannelCloseConfirm.encode(message).finish() }; }, registerTypeUrl() { if (!GlobalDecoderRegistry.registerExistingTypeUrl(MsgChannelCloseConfirm.typeUrl)) { return; } Height.registerTypeUrl(); } }; function createBaseMsgChannelCloseConfirmResponse() { return {}; } /** * MsgChannelCloseConfirmResponse defines the Msg/ChannelCloseConfirm response * type. * @name MsgChannelCloseConfirmResponse * @package ibc.core.channel.v1 * @see proto type: ibc.core.channel.v1.MsgChannelCloseConfirmResponse */ export const MsgChannelCloseConfirmResponse = { typeUrl: "/ibc.co