UNPKG

interchainjs

Version:

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

1,169 lines (1,168 loc) 49.4 kB
import { Counterparty, Version } from "./connection"; import { Any } from "../../../../google/protobuf/any"; import { Height, Params } from "../../client/v1/client"; import { BinaryReader, BinaryWriter } from "../../../../binary"; import { GlobalDecoderRegistry } from "../../../../registry"; import { bytesFromBase64, base64FromBytes } from "../../../../helpers"; function createBaseMsgConnectionOpenInit() { return { clientId: "", counterparty: Counterparty.fromPartial({}), version: undefined, delayPeriod: BigInt(0), signer: "" }; } /** * MsgConnectionOpenInit defines the msg sent by an account on Chain A to * initialize a connection with Chain B. * @name MsgConnectionOpenInit * @package ibc.core.connection.v1 * @see proto type: ibc.core.connection.v1.MsgConnectionOpenInit */ export const MsgConnectionOpenInit = { typeUrl: "/ibc.core.connection.v1.MsgConnectionOpenInit", aminoType: "cosmos-sdk/MsgConnectionOpenInit", is(o) { return o && (o.$typeUrl === MsgConnectionOpenInit.typeUrl || typeof o.clientId === "string" && Counterparty.is(o.counterparty) && typeof o.delayPeriod === "bigint" && typeof o.signer === "string"); }, isAmino(o) { return o && (o.$typeUrl === MsgConnectionOpenInit.typeUrl || typeof o.client_id === "string" && Counterparty.isAmino(o.counterparty) && typeof o.delay_period === "bigint" && typeof o.signer === "string"); }, encode(message, writer = BinaryWriter.create()) { if (message.clientId !== "") { writer.uint32(10).string(message.clientId); } if (message.counterparty !== undefined) { Counterparty.encode(message.counterparty, writer.uint32(18).fork()).ldelim(); } if (message.version !== undefined) { Version.encode(message.version, writer.uint32(26).fork()).ldelim(); } if (message.delayPeriod !== BigInt(0)) { writer.uint32(32).uint64(message.delayPeriod); } 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 = createBaseMsgConnectionOpenInit(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: message.clientId = reader.string(); break; case 2: message.counterparty = Counterparty.decode(reader, reader.uint32()); break; case 3: message.version = Version.decode(reader, reader.uint32()); break; case 4: message.delayPeriod = reader.uint64(); break; case 5: message.signer = reader.string(); break; default: reader.skipType(tag & 7); break; } } return message; }, fromPartial(object) { const message = createBaseMsgConnectionOpenInit(); message.clientId = object.clientId ?? ""; message.counterparty = object.counterparty !== undefined && object.counterparty !== null ? Counterparty.fromPartial(object.counterparty) : undefined; message.version = object.version !== undefined && object.version !== null ? Version.fromPartial(object.version) : undefined; message.delayPeriod = object.delayPeriod !== undefined && object.delayPeriod !== null ? BigInt(object.delayPeriod.toString()) : BigInt(0); message.signer = object.signer ?? ""; return message; }, fromAmino(object) { const message = createBaseMsgConnectionOpenInit(); if (object.client_id !== undefined && object.client_id !== null) { message.clientId = object.client_id; } if (object.counterparty !== undefined && object.counterparty !== null) { message.counterparty = Counterparty.fromAmino(object.counterparty); } if (object.version !== undefined && object.version !== null) { message.version = Version.fromAmino(object.version); } if (object.delay_period !== undefined && object.delay_period !== null) { message.delayPeriod = BigInt(object.delay_period); } if (object.signer !== undefined && object.signer !== null) { message.signer = object.signer; } return message; }, toAmino(message) { const obj = {}; obj.client_id = message.clientId === "" ? undefined : message.clientId; obj.counterparty = message.counterparty ? Counterparty.toAmino(message.counterparty) : undefined; obj.version = message.version ? Version.toAmino(message.version) : undefined; obj.delay_period = message.delayPeriod !== BigInt(0) ? message.delayPeriod?.toString() : undefined; obj.signer = message.signer === "" ? undefined : message.signer; return obj; }, fromAminoMsg(object) { return MsgConnectionOpenInit.fromAmino(object.value); }, toAminoMsg(message) { return { type: "cosmos-sdk/MsgConnectionOpenInit", value: MsgConnectionOpenInit.toAmino(message) }; }, fromProtoMsg(message) { return MsgConnectionOpenInit.decode(message.value); }, toProto(message) { return MsgConnectionOpenInit.encode(message).finish(); }, toProtoMsg(message) { return { typeUrl: "/ibc.core.connection.v1.MsgConnectionOpenInit", value: MsgConnectionOpenInit.encode(message).finish() }; }, registerTypeUrl() { if (!GlobalDecoderRegistry.registerExistingTypeUrl(MsgConnectionOpenInit.typeUrl)) { return; } Counterparty.registerTypeUrl(); Version.registerTypeUrl(); } }; function createBaseMsgConnectionOpenInitResponse() { return {}; } /** * MsgConnectionOpenInitResponse defines the Msg/ConnectionOpenInit response * type. * @name MsgConnectionOpenInitResponse * @package ibc.core.connection.v1 * @see proto type: ibc.core.connection.v1.MsgConnectionOpenInitResponse */ export const MsgConnectionOpenInitResponse = { typeUrl: "/ibc.core.connection.v1.MsgConnectionOpenInitResponse", aminoType: "cosmos-sdk/MsgConnectionOpenInitResponse", is(o) { return o && o.$typeUrl === MsgConnectionOpenInitResponse.typeUrl; }, isAmino(o) { return o && o.$typeUrl === MsgConnectionOpenInitResponse.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 = createBaseMsgConnectionOpenInitResponse(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { default: reader.skipType(tag & 7); break; } } return message; }, fromPartial(_) { const message = createBaseMsgConnectionOpenInitResponse(); return message; }, fromAmino(_) { const message = createBaseMsgConnectionOpenInitResponse(); return message; }, toAmino(_) { const obj = {}; return obj; }, fromAminoMsg(object) { return MsgConnectionOpenInitResponse.fromAmino(object.value); }, toAminoMsg(message) { return { type: "cosmos-sdk/MsgConnectionOpenInitResponse", value: MsgConnectionOpenInitResponse.toAmino(message) }; }, fromProtoMsg(message) { return MsgConnectionOpenInitResponse.decode(message.value); }, toProto(message) { return MsgConnectionOpenInitResponse.encode(message).finish(); }, toProtoMsg(message) { return { typeUrl: "/ibc.core.connection.v1.MsgConnectionOpenInitResponse", value: MsgConnectionOpenInitResponse.encode(message).finish() }; }, registerTypeUrl() { } }; function createBaseMsgConnectionOpenTry() { return { clientId: "", previousConnectionId: "", clientState: undefined, counterparty: Counterparty.fromPartial({}), delayPeriod: BigInt(0), counterpartyVersions: [], proofHeight: Height.fromPartial({}), proofInit: new Uint8Array(), proofClient: new Uint8Array(), proofConsensus: new Uint8Array(), consensusHeight: Height.fromPartial({}), signer: "", hostConsensusStateProof: new Uint8Array() }; } /** * MsgConnectionOpenTry defines a msg sent by a Relayer to try to open a * connection on Chain B. * @name MsgConnectionOpenTry * @package ibc.core.connection.v1 * @see proto type: ibc.core.connection.v1.MsgConnectionOpenTry */ export const MsgConnectionOpenTry = { typeUrl: "/ibc.core.connection.v1.MsgConnectionOpenTry", aminoType: "cosmos-sdk/MsgConnectionOpenTry", is(o) { return o && (o.$typeUrl === MsgConnectionOpenTry.typeUrl || typeof o.clientId === "string" && typeof o.previousConnectionId === "string" && Counterparty.is(o.counterparty) && typeof o.delayPeriod === "bigint" && Array.isArray(o.counterpartyVersions) && (!o.counterpartyVersions.length || Version.is(o.counterpartyVersions[0])) && Height.is(o.proofHeight) && (o.proofInit instanceof Uint8Array || typeof o.proofInit === "string") && (o.proofClient instanceof Uint8Array || typeof o.proofClient === "string") && (o.proofConsensus instanceof Uint8Array || typeof o.proofConsensus === "string") && Height.is(o.consensusHeight) && typeof o.signer === "string" && (o.hostConsensusStateProof instanceof Uint8Array || typeof o.hostConsensusStateProof === "string")); }, isAmino(o) { return o && (o.$typeUrl === MsgConnectionOpenTry.typeUrl || typeof o.client_id === "string" && typeof o.previous_connection_id === "string" && Counterparty.isAmino(o.counterparty) && typeof o.delay_period === "bigint" && Array.isArray(o.counterparty_versions) && (!o.counterparty_versions.length || Version.isAmino(o.counterparty_versions[0])) && Height.isAmino(o.proof_height) && (o.proof_init instanceof Uint8Array || typeof o.proof_init === "string") && (o.proof_client instanceof Uint8Array || typeof o.proof_client === "string") && (o.proof_consensus instanceof Uint8Array || typeof o.proof_consensus === "string") && Height.isAmino(o.consensus_height) && typeof o.signer === "string" && (o.host_consensus_state_proof instanceof Uint8Array || typeof o.host_consensus_state_proof === "string")); }, encode(message, writer = BinaryWriter.create()) { if (message.clientId !== "") { writer.uint32(10).string(message.clientId); } if (message.previousConnectionId !== "") { writer.uint32(18).string(message.previousConnectionId); } if (message.clientState !== undefined) { Any.encode(message.clientState, writer.uint32(26).fork()).ldelim(); } if (message.counterparty !== undefined) { Counterparty.encode(message.counterparty, writer.uint32(34).fork()).ldelim(); } if (message.delayPeriod !== BigInt(0)) { writer.uint32(40).uint64(message.delayPeriod); } for (const v of message.counterpartyVersions) { Version.encode(v, writer.uint32(50).fork()).ldelim(); } if (message.proofHeight !== undefined) { Height.encode(message.proofHeight, writer.uint32(58).fork()).ldelim(); } if (message.proofInit.length !== 0) { writer.uint32(66).bytes(message.proofInit); } if (message.proofClient.length !== 0) { writer.uint32(74).bytes(message.proofClient); } if (message.proofConsensus.length !== 0) { writer.uint32(82).bytes(message.proofConsensus); } if (message.consensusHeight !== undefined) { Height.encode(message.consensusHeight, writer.uint32(90).fork()).ldelim(); } if (message.signer !== "") { writer.uint32(98).string(message.signer); } if (message.hostConsensusStateProof.length !== 0) { writer.uint32(106).bytes(message.hostConsensusStateProof); } 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 = createBaseMsgConnectionOpenTry(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: message.clientId = reader.string(); break; case 2: message.previousConnectionId = reader.string(); break; case 3: message.clientState = Any.decode(reader, reader.uint32()); break; case 4: message.counterparty = Counterparty.decode(reader, reader.uint32()); break; case 5: message.delayPeriod = reader.uint64(); break; case 6: message.counterpartyVersions.push(Version.decode(reader, reader.uint32())); break; case 7: message.proofHeight = Height.decode(reader, reader.uint32()); break; case 8: message.proofInit = reader.bytes(); break; case 9: message.proofClient = reader.bytes(); break; case 10: message.proofConsensus = reader.bytes(); break; case 11: message.consensusHeight = Height.decode(reader, reader.uint32()); break; case 12: message.signer = reader.string(); break; case 13: message.hostConsensusStateProof = reader.bytes(); break; default: reader.skipType(tag & 7); break; } } return message; }, fromPartial(object) { const message = createBaseMsgConnectionOpenTry(); message.clientId = object.clientId ?? ""; message.previousConnectionId = object.previousConnectionId ?? ""; message.clientState = object.clientState !== undefined && object.clientState !== null ? Any.fromPartial(object.clientState) : undefined; message.counterparty = object.counterparty !== undefined && object.counterparty !== null ? Counterparty.fromPartial(object.counterparty) : undefined; message.delayPeriod = object.delayPeriod !== undefined && object.delayPeriod !== null ? BigInt(object.delayPeriod.toString()) : BigInt(0); message.counterpartyVersions = object.counterpartyVersions?.map(e => Version.fromPartial(e)) || []; message.proofHeight = object.proofHeight !== undefined && object.proofHeight !== null ? Height.fromPartial(object.proofHeight) : undefined; message.proofInit = object.proofInit ?? new Uint8Array(); message.proofClient = object.proofClient ?? new Uint8Array(); message.proofConsensus = object.proofConsensus ?? new Uint8Array(); message.consensusHeight = object.consensusHeight !== undefined && object.consensusHeight !== null ? Height.fromPartial(object.consensusHeight) : undefined; message.signer = object.signer ?? ""; message.hostConsensusStateProof = object.hostConsensusStateProof ?? new Uint8Array(); return message; }, fromAmino(object) { const message = createBaseMsgConnectionOpenTry(); if (object.client_id !== undefined && object.client_id !== null) { message.clientId = object.client_id; } if (object.previous_connection_id !== undefined && object.previous_connection_id !== null) { message.previousConnectionId = object.previous_connection_id; } if (object.client_state !== undefined && object.client_state !== null) { message.clientState = Any.fromAmino(object.client_state); } if (object.counterparty !== undefined && object.counterparty !== null) { message.counterparty = Counterparty.fromAmino(object.counterparty); } if (object.delay_period !== undefined && object.delay_period !== null) { message.delayPeriod = BigInt(object.delay_period); } message.counterpartyVersions = object.counterparty_versions?.map(e => Version.fromAmino(e)) || []; if (object.proof_height !== undefined && object.proof_height !== null) { message.proofHeight = Height.fromAmino(object.proof_height); } if (object.proof_init !== undefined && object.proof_init !== null) { message.proofInit = bytesFromBase64(object.proof_init); } if (object.proof_client !== undefined && object.proof_client !== null) { message.proofClient = bytesFromBase64(object.proof_client); } if (object.proof_consensus !== undefined && object.proof_consensus !== null) { message.proofConsensus = bytesFromBase64(object.proof_consensus); } if (object.consensus_height !== undefined && object.consensus_height !== null) { message.consensusHeight = Height.fromAmino(object.consensus_height); } if (object.signer !== undefined && object.signer !== null) { message.signer = object.signer; } if (object.host_consensus_state_proof !== undefined && object.host_consensus_state_proof !== null) { message.hostConsensusStateProof = bytesFromBase64(object.host_consensus_state_proof); } return message; }, toAmino(message) { const obj = {}; obj.client_id = message.clientId === "" ? undefined : message.clientId; obj.previous_connection_id = message.previousConnectionId === "" ? undefined : message.previousConnectionId; obj.client_state = message.clientState ? Any.toAmino(message.clientState) : undefined; obj.counterparty = message.counterparty ? Counterparty.toAmino(message.counterparty) : undefined; obj.delay_period = message.delayPeriod !== BigInt(0) ? message.delayPeriod?.toString() : undefined; if (message.counterpartyVersions) { obj.counterparty_versions = message.counterpartyVersions.map(e => e ? Version.toAmino(e) : undefined); } else { obj.counterparty_versions = message.counterpartyVersions; } obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight) : {}; obj.proof_init = message.proofInit ? base64FromBytes(message.proofInit) : undefined; obj.proof_client = message.proofClient ? base64FromBytes(message.proofClient) : undefined; obj.proof_consensus = message.proofConsensus ? base64FromBytes(message.proofConsensus) : undefined; obj.consensus_height = message.consensusHeight ? Height.toAmino(message.consensusHeight) : {}; obj.signer = message.signer === "" ? undefined : message.signer; obj.host_consensus_state_proof = message.hostConsensusStateProof ? base64FromBytes(message.hostConsensusStateProof) : undefined; return obj; }, fromAminoMsg(object) { return MsgConnectionOpenTry.fromAmino(object.value); }, toAminoMsg(message) { return { type: "cosmos-sdk/MsgConnectionOpenTry", value: MsgConnectionOpenTry.toAmino(message) }; }, fromProtoMsg(message) { return MsgConnectionOpenTry.decode(message.value); }, toProto(message) { return MsgConnectionOpenTry.encode(message).finish(); }, toProtoMsg(message) { return { typeUrl: "/ibc.core.connection.v1.MsgConnectionOpenTry", value: MsgConnectionOpenTry.encode(message).finish() }; }, registerTypeUrl() { if (!GlobalDecoderRegistry.registerExistingTypeUrl(MsgConnectionOpenTry.typeUrl)) { return; } Counterparty.registerTypeUrl(); Version.registerTypeUrl(); Height.registerTypeUrl(); } }; function createBaseMsgConnectionOpenTryResponse() { return {}; } /** * MsgConnectionOpenTryResponse defines the Msg/ConnectionOpenTry response type. * @name MsgConnectionOpenTryResponse * @package ibc.core.connection.v1 * @see proto type: ibc.core.connection.v1.MsgConnectionOpenTryResponse */ export const MsgConnectionOpenTryResponse = { typeUrl: "/ibc.core.connection.v1.MsgConnectionOpenTryResponse", aminoType: "cosmos-sdk/MsgConnectionOpenTryResponse", is(o) { return o && o.$typeUrl === MsgConnectionOpenTryResponse.typeUrl; }, isAmino(o) { return o && o.$typeUrl === MsgConnectionOpenTryResponse.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 = createBaseMsgConnectionOpenTryResponse(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { default: reader.skipType(tag & 7); break; } } return message; }, fromPartial(_) { const message = createBaseMsgConnectionOpenTryResponse(); return message; }, fromAmino(_) { const message = createBaseMsgConnectionOpenTryResponse(); return message; }, toAmino(_) { const obj = {}; return obj; }, fromAminoMsg(object) { return MsgConnectionOpenTryResponse.fromAmino(object.value); }, toAminoMsg(message) { return { type: "cosmos-sdk/MsgConnectionOpenTryResponse", value: MsgConnectionOpenTryResponse.toAmino(message) }; }, fromProtoMsg(message) { return MsgConnectionOpenTryResponse.decode(message.value); }, toProto(message) { return MsgConnectionOpenTryResponse.encode(message).finish(); }, toProtoMsg(message) { return { typeUrl: "/ibc.core.connection.v1.MsgConnectionOpenTryResponse", value: MsgConnectionOpenTryResponse.encode(message).finish() }; }, registerTypeUrl() { } }; function createBaseMsgConnectionOpenAck() { return { connectionId: "", counterpartyConnectionId: "", version: undefined, clientState: undefined, proofHeight: Height.fromPartial({}), proofTry: new Uint8Array(), proofClient: new Uint8Array(), proofConsensus: new Uint8Array(), consensusHeight: Height.fromPartial({}), signer: "", hostConsensusStateProof: new Uint8Array() }; } /** * MsgConnectionOpenAck defines a msg sent by a Relayer to Chain A to * acknowledge the change of connection state to TRYOPEN on Chain B. * @name MsgConnectionOpenAck * @package ibc.core.connection.v1 * @see proto type: ibc.core.connection.v1.MsgConnectionOpenAck */ export const MsgConnectionOpenAck = { typeUrl: "/ibc.core.connection.v1.MsgConnectionOpenAck", aminoType: "cosmos-sdk/MsgConnectionOpenAck", is(o) { return o && (o.$typeUrl === MsgConnectionOpenAck.typeUrl || typeof o.connectionId === "string" && typeof o.counterpartyConnectionId === "string" && Height.is(o.proofHeight) && (o.proofTry instanceof Uint8Array || typeof o.proofTry === "string") && (o.proofClient instanceof Uint8Array || typeof o.proofClient === "string") && (o.proofConsensus instanceof Uint8Array || typeof o.proofConsensus === "string") && Height.is(o.consensusHeight) && typeof o.signer === "string" && (o.hostConsensusStateProof instanceof Uint8Array || typeof o.hostConsensusStateProof === "string")); }, isAmino(o) { return o && (o.$typeUrl === MsgConnectionOpenAck.typeUrl || typeof o.connection_id === "string" && typeof o.counterparty_connection_id === "string" && Height.isAmino(o.proof_height) && (o.proof_try instanceof Uint8Array || typeof o.proof_try === "string") && (o.proof_client instanceof Uint8Array || typeof o.proof_client === "string") && (o.proof_consensus instanceof Uint8Array || typeof o.proof_consensus === "string") && Height.isAmino(o.consensus_height) && typeof o.signer === "string" && (o.host_consensus_state_proof instanceof Uint8Array || typeof o.host_consensus_state_proof === "string")); }, encode(message, writer = BinaryWriter.create()) { if (message.connectionId !== "") { writer.uint32(10).string(message.connectionId); } if (message.counterpartyConnectionId !== "") { writer.uint32(18).string(message.counterpartyConnectionId); } if (message.version !== undefined) { Version.encode(message.version, writer.uint32(26).fork()).ldelim(); } if (message.clientState !== undefined) { Any.encode(message.clientState, writer.uint32(34).fork()).ldelim(); } if (message.proofHeight !== undefined) { Height.encode(message.proofHeight, writer.uint32(42).fork()).ldelim(); } if (message.proofTry.length !== 0) { writer.uint32(50).bytes(message.proofTry); } if (message.proofClient.length !== 0) { writer.uint32(58).bytes(message.proofClient); } if (message.proofConsensus.length !== 0) { writer.uint32(66).bytes(message.proofConsensus); } if (message.consensusHeight !== undefined) { Height.encode(message.consensusHeight, writer.uint32(74).fork()).ldelim(); } if (message.signer !== "") { writer.uint32(82).string(message.signer); } if (message.hostConsensusStateProof.length !== 0) { writer.uint32(90).bytes(message.hostConsensusStateProof); } 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 = createBaseMsgConnectionOpenAck(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: message.connectionId = reader.string(); break; case 2: message.counterpartyConnectionId = reader.string(); break; case 3: message.version = Version.decode(reader, reader.uint32()); break; case 4: message.clientState = Any.decode(reader, reader.uint32()); break; case 5: message.proofHeight = Height.decode(reader, reader.uint32()); break; case 6: message.proofTry = reader.bytes(); break; case 7: message.proofClient = reader.bytes(); break; case 8: message.proofConsensus = reader.bytes(); break; case 9: message.consensusHeight = Height.decode(reader, reader.uint32()); break; case 10: message.signer = reader.string(); break; case 11: message.hostConsensusStateProof = reader.bytes(); break; default: reader.skipType(tag & 7); break; } } return message; }, fromPartial(object) { const message = createBaseMsgConnectionOpenAck(); message.connectionId = object.connectionId ?? ""; message.counterpartyConnectionId = object.counterpartyConnectionId ?? ""; message.version = object.version !== undefined && object.version !== null ? Version.fromPartial(object.version) : undefined; message.clientState = object.clientState !== undefined && object.clientState !== null ? Any.fromPartial(object.clientState) : undefined; message.proofHeight = object.proofHeight !== undefined && object.proofHeight !== null ? Height.fromPartial(object.proofHeight) : undefined; message.proofTry = object.proofTry ?? new Uint8Array(); message.proofClient = object.proofClient ?? new Uint8Array(); message.proofConsensus = object.proofConsensus ?? new Uint8Array(); message.consensusHeight = object.consensusHeight !== undefined && object.consensusHeight !== null ? Height.fromPartial(object.consensusHeight) : undefined; message.signer = object.signer ?? ""; message.hostConsensusStateProof = object.hostConsensusStateProof ?? new Uint8Array(); return message; }, fromAmino(object) { const message = createBaseMsgConnectionOpenAck(); if (object.connection_id !== undefined && object.connection_id !== null) { message.connectionId = object.connection_id; } if (object.counterparty_connection_id !== undefined && object.counterparty_connection_id !== null) { message.counterpartyConnectionId = object.counterparty_connection_id; } if (object.version !== undefined && object.version !== null) { message.version = Version.fromAmino(object.version); } if (object.client_state !== undefined && object.client_state !== null) { message.clientState = Any.fromAmino(object.client_state); } if (object.proof_height !== undefined && object.proof_height !== null) { message.proofHeight = Height.fromAmino(object.proof_height); } if (object.proof_try !== undefined && object.proof_try !== null) { message.proofTry = bytesFromBase64(object.proof_try); } if (object.proof_client !== undefined && object.proof_client !== null) { message.proofClient = bytesFromBase64(object.proof_client); } if (object.proof_consensus !== undefined && object.proof_consensus !== null) { message.proofConsensus = bytesFromBase64(object.proof_consensus); } if (object.consensus_height !== undefined && object.consensus_height !== null) { message.consensusHeight = Height.fromAmino(object.consensus_height); } if (object.signer !== undefined && object.signer !== null) { message.signer = object.signer; } if (object.host_consensus_state_proof !== undefined && object.host_consensus_state_proof !== null) { message.hostConsensusStateProof = bytesFromBase64(object.host_consensus_state_proof); } return message; }, toAmino(message) { const obj = {}; obj.connection_id = message.connectionId === "" ? undefined : message.connectionId; obj.counterparty_connection_id = message.counterpartyConnectionId === "" ? undefined : message.counterpartyConnectionId; obj.version = message.version ? Version.toAmino(message.version) : undefined; obj.client_state = message.clientState ? Any.toAmino(message.clientState) : undefined; obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight) : {}; obj.proof_try = message.proofTry ? base64FromBytes(message.proofTry) : undefined; obj.proof_client = message.proofClient ? base64FromBytes(message.proofClient) : undefined; obj.proof_consensus = message.proofConsensus ? base64FromBytes(message.proofConsensus) : undefined; obj.consensus_height = message.consensusHeight ? Height.toAmino(message.consensusHeight) : {}; obj.signer = message.signer === "" ? undefined : message.signer; obj.host_consensus_state_proof = message.hostConsensusStateProof ? base64FromBytes(message.hostConsensusStateProof) : undefined; return obj; }, fromAminoMsg(object) { return MsgConnectionOpenAck.fromAmino(object.value); }, toAminoMsg(message) { return { type: "cosmos-sdk/MsgConnectionOpenAck", value: MsgConnectionOpenAck.toAmino(message) }; }, fromProtoMsg(message) { return MsgConnectionOpenAck.decode(message.value); }, toProto(message) { return MsgConnectionOpenAck.encode(message).finish(); }, toProtoMsg(message) { return { typeUrl: "/ibc.core.connection.v1.MsgConnectionOpenAck", value: MsgConnectionOpenAck.encode(message).finish() }; }, registerTypeUrl() { if (!GlobalDecoderRegistry.registerExistingTypeUrl(MsgConnectionOpenAck.typeUrl)) { return; } Height.registerTypeUrl(); } }; function createBaseMsgConnectionOpenAckResponse() { return {}; } /** * MsgConnectionOpenAckResponse defines the Msg/ConnectionOpenAck response type. * @name MsgConnectionOpenAckResponse * @package ibc.core.connection.v1 * @see proto type: ibc.core.connection.v1.MsgConnectionOpenAckResponse */ export const MsgConnectionOpenAckResponse = { typeUrl: "/ibc.core.connection.v1.MsgConnectionOpenAckResponse", aminoType: "cosmos-sdk/MsgConnectionOpenAckResponse", is(o) { return o && o.$typeUrl === MsgConnectionOpenAckResponse.typeUrl; }, isAmino(o) { return o && o.$typeUrl === MsgConnectionOpenAckResponse.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 = createBaseMsgConnectionOpenAckResponse(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { default: reader.skipType(tag & 7); break; } } return message; }, fromPartial(_) { const message = createBaseMsgConnectionOpenAckResponse(); return message; }, fromAmino(_) { const message = createBaseMsgConnectionOpenAckResponse(); return message; }, toAmino(_) { const obj = {}; return obj; }, fromAminoMsg(object) { return MsgConnectionOpenAckResponse.fromAmino(object.value); }, toAminoMsg(message) { return { type: "cosmos-sdk/MsgConnectionOpenAckResponse", value: MsgConnectionOpenAckResponse.toAmino(message) }; }, fromProtoMsg(message) { return MsgConnectionOpenAckResponse.decode(message.value); }, toProto(message) { return MsgConnectionOpenAckResponse.encode(message).finish(); }, toProtoMsg(message) { return { typeUrl: "/ibc.core.connection.v1.MsgConnectionOpenAckResponse", value: MsgConnectionOpenAckResponse.encode(message).finish() }; }, registerTypeUrl() { } }; function createBaseMsgConnectionOpenConfirm() { return { connectionId: "", proofAck: new Uint8Array(), proofHeight: Height.fromPartial({}), signer: "" }; } /** * MsgConnectionOpenConfirm defines a msg sent by a Relayer to Chain B to * acknowledge the change of connection state to OPEN on Chain A. * @name MsgConnectionOpenConfirm * @package ibc.core.connection.v1 * @see proto type: ibc.core.connection.v1.MsgConnectionOpenConfirm */ export const MsgConnectionOpenConfirm = { typeUrl: "/ibc.core.connection.v1.MsgConnectionOpenConfirm", aminoType: "cosmos-sdk/MsgConnectionOpenConfirm", is(o) { return o && (o.$typeUrl === MsgConnectionOpenConfirm.typeUrl || typeof o.connectionId === "string" && (o.proofAck instanceof Uint8Array || typeof o.proofAck === "string") && Height.is(o.proofHeight) && typeof o.signer === "string"); }, isAmino(o) { return o && (o.$typeUrl === MsgConnectionOpenConfirm.typeUrl || typeof o.connection_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.connectionId !== "") { writer.uint32(10).string(message.connectionId); } if (message.proofAck.length !== 0) { writer.uint32(18).bytes(message.proofAck); } if (message.proofHeight !== undefined) { Height.encode(message.proofHeight, writer.uint32(26).fork()).ldelim(); } if (message.signer !== "") { writer.uint32(34).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 = createBaseMsgConnectionOpenConfirm(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: message.connectionId = reader.string(); break; case 2: message.proofAck = reader.bytes(); break; case 3: message.proofHeight = Height.decode(reader, reader.uint32()); break; case 4: message.signer = reader.string(); break; default: reader.skipType(tag & 7); break; } } return message; }, fromPartial(object) { const message = createBaseMsgConnectionOpenConfirm(); message.connectionId = object.connectionId ?? ""; 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 = createBaseMsgConnectionOpenConfirm(); if (object.connection_id !== undefined && object.connection_id !== null) { message.connectionId = object.connection_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.connection_id = message.connectionId === "" ? undefined : message.connectionId; 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 MsgConnectionOpenConfirm.fromAmino(object.value); }, toAminoMsg(message) { return { type: "cosmos-sdk/MsgConnectionOpenConfirm", value: MsgConnectionOpenConfirm.toAmino(message) }; }, fromProtoMsg(message) { return MsgConnectionOpenConfirm.decode(message.value); }, toProto(message) { return MsgConnectionOpenConfirm.encode(message).finish(); }, toProtoMsg(message) { return { typeUrl: "/ibc.core.connection.v1.MsgConnectionOpenConfirm", value: MsgConnectionOpenConfirm.encode(message).finish() }; }, registerTypeUrl() { if (!GlobalDecoderRegistry.registerExistingTypeUrl(MsgConnectionOpenConfirm.typeUrl)) { return; } Height.registerTypeUrl(); } }; function createBaseMsgConnectionOpenConfirmResponse() { return {}; } /** * MsgConnectionOpenConfirmResponse defines the Msg/ConnectionOpenConfirm * response type. * @name MsgConnectionOpenConfirmResponse * @package ibc.core.connection.v1 * @see proto type: ibc.core.connection.v1.MsgConnectionOpenConfirmResponse */ export const MsgConnectionOpenConfirmResponse = { typeUrl: "/ibc.core.connection.v1.MsgConnectionOpenConfirmResponse", aminoType: "cosmos-sdk/MsgConnectionOpenConfirmResponse", is(o) { return o && o.$typeUrl === MsgConnectionOpenConfirmResponse.typeUrl; }, isAmino(o) { return o && o.$typeUrl === MsgConnectionOpenConfirmResponse.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 = createBaseMsgConnectionOpenConfirmResponse(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { default: reader.skipType(tag & 7); break; } } return message; }, fromPartial(_) { const message = createBaseMsgConnectionOpenConfirmResponse(); return message; }, fromAmino(_) { const message = createBaseMsgConnectionOpenConfirmResponse(); return message; }, toAmino(_) { const obj = {}; return obj; }, fromAminoMsg(object) { return MsgConnectionOpenConfirmResponse.fromAmino(object.value); }, toAminoMsg(message) { return { type: "cosmos-sdk/MsgConnectionOpenConfirmResponse", value: MsgConnectionOpenConfirmResponse.toAmino(message) }; }, fromProtoMsg(message) { return MsgConnectionOpenConfirmResponse.decode(message.value); }, toProto(message) { return MsgConnectionOpenConfirmResponse.encode(message).finish(); }, toProtoMsg(message) { return { typeUrl: "/ibc.core.connection.v1.MsgConnectionOpenConfirmResponse", value: MsgConnectionOpenConfirmResponse.encode(message).finish() }; }, registerTypeUrl() { } }; function createBaseMsgUpdateParams() { return { signer: "", params: Params.fromPartial({}) }; } /** * MsgUpdateParams defines the sdk.Msg type to update the connection parameters. * @name MsgUpdateParams * @package ibc.core.connection.v1 * @see proto type: ibc.core.connection.v1.MsgUpdateParams */ export const MsgUpdateParams = { typeUrl: "/ibc.core.connection.v1.MsgUpdateParams", aminoType: "cosmos-sdk/MsgUpdateParams", is(o) { return o && (o.$typeUrl === MsgUpdateParams.typeUrl || typeof o.signer === "string" && Params.is(o.params)); }, isAmino(o) { return o && (o.$typeUrl === MsgUpdateParams.typeUrl || typeof o.signer === "string" && Params.isAmino(o.params)); }, encode(message, writer = BinaryWriter.create()) { if (message.signer !== "") { writer.uint32(10).string(message.signer); } if (message.params !== undefined) { Params.encode(message.params, 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 = createBaseMsgUpdateParams(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: message.signer = reader.string(); break; case 2: message.params = Params.decode(reader, reader.uint32()); break; default: reader.skipType(tag & 7); break; } } return message; }, fromPartial(object) { const message = createBaseMsgUpdateParams(); message.signer = object.signer ?? ""; message.params = object.params !== undefined && object.params !== null ? Params.fromPartial(object.params) : undefined; return message; }, fromAmino(object) { const message = createBaseMsgUpdateParams(); if (object.signer !== undefined && object.signer !== null) { message.signer = object.signer; } if (object.params !== undefined && object.params !== null) { message.params = Params.fromAmino(object.params); } return message; }, toAmino(message) { const obj = {}; obj.signer = message.signer === "" ? undefined : message.signer; obj.params = message.params ? Params.toAmino(message.params) : undefined; return obj; }, fromAminoMsg(object) { return MsgUpdateParams.fromAmino(object.value); }, toAminoMsg(message) { return { type: "cosmos-sdk/MsgUpdateParams", value: MsgUpdateParams.toAmino(message) }; }, fromProtoMsg(message) { return MsgUpdateParams.decode(message.value); }, toProto(message) { return MsgUpdateParams.encode(message).finish(); }, toProtoMsg(message) { return { typeUrl: "/ibc.core.connection.v1.MsgUpdateParams", value: MsgUpdateParams.encode(message).finish() }; }, registerTypeUrl() { if (!GlobalDecoderRegistry.registerExistingTypeUrl(MsgUpdateParams.typeUrl)) { return; } Params.registerTypeUrl(); } }; function createBaseMsgUpdateParamsResponse() { return {}; } /** * MsgUpdateParamsResponse defines the MsgUpdateParams response type. * @name MsgUpdateParamsResponse * @package ibc.core.connection.v1 * @see proto type: ibc.core.connection.v1.MsgUpdateParamsResponse */ export const MsgUpdateParamsResponse = { typeUrl: "/ibc.core.connection.v1.MsgUpdateParamsResponse", aminoType: "cosmos-sdk/MsgUpdateParamsResponse", is(o) { return o && o.$typeUrl === MsgUpdateParamsResponse.typeUrl; }, isAmino(o) { return o && o.$typeUrl === MsgUpdateParamsResponse.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 = createBaseMsgUpdateParamsResponse(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { default: reader.skipType(tag & 7); break; } } return message; }, fromPartial(_) { const message = createBaseMsgUpdateParamsResponse(); return message; }, fromAmino(_) { const message = createBaseMsgUpdateParamsResponse(); return message; }, toAmino(_) { const obj = {}; return obj; }, fromAminoMsg(object) { return MsgUpdateParamsResponse.fromAmino(object.value); }, toAminoMsg(message) { return { type: "cosmos-sdk/MsgUpdateParamsResponse", value: MsgUpdateParamsResponse.toAmino(message) }; }, fromProtoMsg(message) { return MsgUpdateParamsResponse.decode(message.value); }, toProto(message) { return MsgUpdateParamsResponse.encode(message).finish(); }, toProtoMsg(message) { return { typeUrl: "/ibc.core.connection.v1.MsgUpdateParamsResponse", value: MsgUpdateParamsResponse.encode(message).finish() }; }, registerTypeUrl() { } };