import { oracleTypeFromJSON } from "../../oracle/v1beta1/oracle";
import { Long } from "../../../helpers";
export const AminoConverter = {
  "/injective.insurance.v1beta1.MsgCreateInsuranceFund": {
    aminoType: "/injective.insurance.v1beta1.MsgCreateInsuranceFund",
    toAmino: ({
      sender,
      ticker,
      quoteDenom,
      oracleBase,
      oracleQuote,
      oracleType,
      expiry,
      initialDeposit
    }) => {
      return {
        sender,
        ticker,
        quote_denom: quoteDenom,
        oracle_base: oracleBase,
        oracle_quote: oracleQuote,
        oracle_type: oracleType,
        expiry: expiry.toString(),
        initial_deposit: {
          denom: initialDeposit.denom,
          amount: Long.fromValue(initialDeposit.amount).toString()
        }
      };
    },
    fromAmino: ({
      sender,
      ticker,
      quote_denom,
      oracle_base,
      oracle_quote,
      oracle_type,
      expiry,
      initial_deposit
    }) => {
      return {
        sender,
        ticker,
        quoteDenom: quote_denom,
        oracleBase: oracle_base,
        oracleQuote: oracle_quote,
        oracleType: oracleTypeFromJSON(oracle_type),
        expiry: Long.fromString(expiry),
        initialDeposit: {
          denom: initial_deposit.denom,
          amount: initial_deposit.amount
        }
      };
    }
  },
  "/injective.insurance.v1beta1.MsgUnderwrite": {
    aminoType: "/injective.insurance.v1beta1.MsgUnderwrite",
    toAmino: ({
      sender,
      marketId,
      deposit
    }) => {
      return {
        sender,
        market_id: marketId,
        deposit: {
          denom: deposit.denom,
          amount: Long.fromValue(deposit.amount).toString()
        }
      };
    },
    fromAmino: ({
      sender,
      market_id,
      deposit
    }) => {
      return {
        sender,
        marketId: market_id,
        deposit: {
          denom: deposit.denom,
          amount: deposit.amount
        }
      };
    }
  },
  "/injective.insurance.v1beta1.MsgRequestRedemption": {
    aminoType: "/injective.insurance.v1beta1.MsgRequestRedemption",
    toAmino: ({
      sender,
      marketId,
      amount
    }) => {
      return {
        sender,
        market_id: marketId,
        amount: {
          denom: amount.denom,
          amount: Long.fromValue(amount.amount).toString()
        }
      };
    },
    fromAmino: ({
      sender,
      market_id,
      amount
    }) => {
      return {
        sender,
        marketId: market_id,
        amount: {
          denom: amount.denom,
          amount: amount.amount
        }
      };
    }
  }
};