import { Long, omitDefault } from "../../../../helpers";
export const AminoConverter = {
  "/ibc.core.connection.v1.MsgConnectionOpenInit": {
    aminoType: "cosmos-sdk/MsgConnectionOpenInit",
    toAmino: ({
      clientId,
      counterparty,
      version,
      delayPeriod,
      signer
    }) => {
      return {
        client_id: clientId,
        counterparty: {
          client_id: counterparty.clientId,
          connection_id: counterparty.connectionId,
          prefix: {
            key_prefix: counterparty.prefix.keyPrefix
          }
        },
        version: {
          identifier: version.identifier,
          features: version.features
        },
        delay_period: delayPeriod.toString(),
        signer
      };
    },
    fromAmino: ({
      client_id,
      counterparty,
      version,
      delay_period,
      signer
    }) => {
      return {
        clientId: client_id,
        counterparty: {
          clientId: counterparty.client_id,
          connectionId: counterparty.connection_id,
          prefix: {
            keyPrefix: counterparty.prefix.key_prefix
          }
        },
        version: {
          identifier: version.identifier,
          features: version.features
        },
        delayPeriod: Long.fromString(delay_period),
        signer
      };
    }
  },
  "/ibc.core.connection.v1.MsgConnectionOpenTry": {
    aminoType: "cosmos-sdk/MsgConnectionOpenTry",
    toAmino: ({
      clientId,
      previousConnectionId,
      clientState,
      counterparty,
      delayPeriod,
      counterpartyVersions,
      proofHeight,
      proofInit,
      proofClient,
      proofConsensus,
      consensusHeight,
      signer
    }) => {
      var _omitDefault, _omitDefault2, _omitDefault3, _omitDefault4;
      return {
        client_id: clientId,
        previous_connection_id: previousConnectionId,
        client_state: {
          type_url: clientState.typeUrl,
          value: clientState.value
        },
        counterparty: {
          client_id: counterparty.clientId,
          connection_id: counterparty.connectionId,
          prefix: {
            key_prefix: counterparty.prefix.keyPrefix
          }
        },
        delay_period: delayPeriod.toString(),
        counterparty_versions: counterpartyVersions.map(el0 => ({
          identifier: el0.identifier,
          features: el0.features
        })),
        proof_height: proofHeight ? {
          revision_height: (_omitDefault = omitDefault(proofHeight.revisionHeight)) === null || _omitDefault === void 0 ? void 0 : _omitDefault.toString(),
          revision_number: (_omitDefault2 = omitDefault(proofHeight.revisionNumber)) === null || _omitDefault2 === void 0 ? void 0 : _omitDefault2.toString()
        } : {},
        proof_init: proofInit,
        proof_client: proofClient,
        proof_consensus: proofConsensus,
        consensus_height: consensusHeight ? {
          revision_height: (_omitDefault3 = omitDefault(consensusHeight.revisionHeight)) === null || _omitDefault3 === void 0 ? void 0 : _omitDefault3.toString(),
          revision_number: (_omitDefault4 = omitDefault(consensusHeight.revisionNumber)) === null || _omitDefault4 === void 0 ? void 0 : _omitDefault4.toString()
        } : {},
        signer
      };
    },
    fromAmino: ({
      client_id,
      previous_connection_id,
      client_state,
      counterparty,
      delay_period,
      counterparty_versions,
      proof_height,
      proof_init,
      proof_client,
      proof_consensus,
      consensus_height,
      signer
    }) => {
      return {
        clientId: client_id,
        previousConnectionId: previous_connection_id,
        clientState: {
          typeUrl: client_state.type_url,
          value: client_state.value
        },
        counterparty: {
          clientId: counterparty.client_id,
          connectionId: counterparty.connection_id,
          prefix: {
            keyPrefix: counterparty.prefix.key_prefix
          }
        },
        delayPeriod: Long.fromString(delay_period),
        counterpartyVersions: counterparty_versions.map(el0 => ({
          identifier: el0.identifier,
          features: el0.features
        })),
        proofHeight: proof_height ? {
          revisionHeight: Long.fromString(proof_height.revision_height || "0", true),
          revisionNumber: Long.fromString(proof_height.revision_number || "0", true)
        } : undefined,
        proofInit: proof_init,
        proofClient: proof_client,
        proofConsensus: proof_consensus,
        consensusHeight: consensus_height ? {
          revisionHeight: Long.fromString(consensus_height.revision_height || "0", true),
          revisionNumber: Long.fromString(consensus_height.revision_number || "0", true)
        } : undefined,
        signer
      };
    }
  },
  "/ibc.core.connection.v1.MsgConnectionOpenAck": {
    aminoType: "cosmos-sdk/MsgConnectionOpenAck",
    toAmino: ({
      connectionId,
      counterpartyConnectionId,
      version,
      clientState,
      proofHeight,
      proofTry,
      proofClient,
      proofConsensus,
      consensusHeight,
      signer
    }) => {
      var _omitDefault5, _omitDefault6, _omitDefault7, _omitDefault8;
      return {
        connection_id: connectionId,
        counterparty_connection_id: counterpartyConnectionId,
        version: {
          identifier: version.identifier,
          features: version.features
        },
        client_state: {
          type_url: clientState.typeUrl,
          value: clientState.value
        },
        proof_height: proofHeight ? {
          revision_height: (_omitDefault5 = omitDefault(proofHeight.revisionHeight)) === null || _omitDefault5 === void 0 ? void 0 : _omitDefault5.toString(),
          revision_number: (_omitDefault6 = omitDefault(proofHeight.revisionNumber)) === null || _omitDefault6 === void 0 ? void 0 : _omitDefault6.toString()
        } : {},
        proof_try: proofTry,
        proof_client: proofClient,
        proof_consensus: proofConsensus,
        consensus_height: consensusHeight ? {
          revision_height: (_omitDefault7 = omitDefault(consensusHeight.revisionHeight)) === null || _omitDefault7 === void 0 ? void 0 : _omitDefault7.toString(),
          revision_number: (_omitDefault8 = omitDefault(consensusHeight.revisionNumber)) === null || _omitDefault8 === void 0 ? void 0 : _omitDefault8.toString()
        } : {},
        signer
      };
    },
    fromAmino: ({
      connection_id,
      counterparty_connection_id,
      version,
      client_state,
      proof_height,
      proof_try,
      proof_client,
      proof_consensus,
      consensus_height,
      signer
    }) => {
      return {
        connectionId: connection_id,
        counterpartyConnectionId: counterparty_connection_id,
        version: {
          identifier: version.identifier,
          features: version.features
        },
        clientState: {
          typeUrl: client_state.type_url,
          value: client_state.value
        },
        proofHeight: proof_height ? {
          revisionHeight: Long.fromString(proof_height.revision_height || "0", true),
          revisionNumber: Long.fromString(proof_height.revision_number || "0", true)
        } : undefined,
        proofTry: proof_try,
        proofClient: proof_client,
        proofConsensus: proof_consensus,
        consensusHeight: consensus_height ? {
          revisionHeight: Long.fromString(consensus_height.revision_height || "0", true),
          revisionNumber: Long.fromString(consensus_height.revision_number || "0", true)
        } : undefined,
        signer
      };
    }
  },
  "/ibc.core.connection.v1.MsgConnectionOpenConfirm": {
    aminoType: "cosmos-sdk/MsgConnectionOpenConfirm",
    toAmino: ({
      connectionId,
      proofAck,
      proofHeight,
      signer
    }) => {
      var _omitDefault9, _omitDefault10;
      return {
        connection_id: connectionId,
        proof_ack: proofAck,
        proof_height: proofHeight ? {
          revision_height: (_omitDefault9 = omitDefault(proofHeight.revisionHeight)) === null || _omitDefault9 === void 0 ? void 0 : _omitDefault9.toString(),
          revision_number: (_omitDefault10 = omitDefault(proofHeight.revisionNumber)) === null || _omitDefault10 === void 0 ? void 0 : _omitDefault10.toString()
        } : {},
        signer
      };
    },
    fromAmino: ({
      connection_id,
      proof_ack,
      proof_height,
      signer
    }) => {
      return {
        connectionId: connection_id,
        proofAck: proof_ack,
        proofHeight: proof_height ? {
          revisionHeight: Long.fromString(proof_height.revision_height || "0", true),
          revisionNumber: Long.fromString(proof_height.revision_number || "0", true)
        } : undefined,
        signer
      };
    }
  }
};