import { Long } from "../../../helpers";
export const AminoConverter = {
  "/osmosis.gamm.v1beta1.MsgJoinPool": {
    aminoType: "osmosis/gamm/join-pool",
    toAmino: ({
      sender,
      poolId,
      shareOutAmount,
      tokenInMaxs
    }) => {
      return {
        sender,
        pool_id: poolId.toString(),
        share_out_amount: shareOutAmount,
        token_in_maxs: tokenInMaxs.map(el0 => ({
          denom: el0.denom,
          amount: el0.amount
        }))
      };
    },
    fromAmino: ({
      sender,
      pool_id,
      share_out_amount,
      token_in_maxs
    }) => {
      return {
        sender,
        poolId: Long.fromString(pool_id),
        shareOutAmount: share_out_amount,
        tokenInMaxs: token_in_maxs.map(el0 => ({
          denom: el0.denom,
          amount: el0.amount
        }))
      };
    }
  },
  "/osmosis.gamm.v1beta1.MsgExitPool": {
    aminoType: "osmosis/gamm/exit-pool",
    toAmino: ({
      sender,
      poolId,
      shareInAmount,
      tokenOutMins
    }) => {
      return {
        sender,
        pool_id: poolId.toString(),
        share_in_amount: shareInAmount,
        token_out_mins: tokenOutMins.map(el0 => ({
          denom: el0.denom,
          amount: el0.amount
        }))
      };
    },
    fromAmino: ({
      sender,
      pool_id,
      share_in_amount,
      token_out_mins
    }) => {
      return {
        sender,
        poolId: Long.fromString(pool_id),
        shareInAmount: share_in_amount,
        tokenOutMins: token_out_mins.map(el0 => ({
          denom: el0.denom,
          amount: el0.amount
        }))
      };
    }
  },
  "/osmosis.gamm.v1beta1.MsgSwapExactAmountIn": {
    aminoType: "osmosis/gamm/swap-exact-amount-in",
    toAmino: ({
      sender,
      routes,
      tokenIn,
      tokenOutMinAmount
    }) => {
      return {
        sender,
        routes: routes.map(el0 => ({
          pool_id: el0.poolId.toString(),
          token_out_denom: el0.tokenOutDenom
        })),
        token_in: {
          denom: tokenIn.denom,
          amount: Long.fromValue(tokenIn.amount).toString()
        },
        token_out_min_amount: tokenOutMinAmount
      };
    },
    fromAmino: ({
      sender,
      routes,
      token_in,
      token_out_min_amount
    }) => {
      return {
        sender,
        routes: routes.map(el0 => ({
          poolId: Long.fromString(el0.pool_id),
          tokenOutDenom: el0.token_out_denom
        })),
        tokenIn: {
          denom: token_in.denom,
          amount: token_in.amount
        },
        tokenOutMinAmount: token_out_min_amount
      };
    }
  },
  "/osmosis.gamm.v1beta1.MsgSwapExactAmountOut": {
    aminoType: "osmosis/gamm/swap-exact-amount-out",
    toAmino: ({
      sender,
      routes,
      tokenInMaxAmount,
      tokenOut
    }) => {
      return {
        sender,
        routes: routes.map(el0 => ({
          pool_id: el0.poolId.toString(),
          token_in_denom: el0.tokenInDenom
        })),
        token_in_max_amount: tokenInMaxAmount,
        token_out: {
          denom: tokenOut.denom,
          amount: Long.fromValue(tokenOut.amount).toString()
        }
      };
    },
    fromAmino: ({
      sender,
      routes,
      token_in_max_amount,
      token_out
    }) => {
      return {
        sender,
        routes: routes.map(el0 => ({
          poolId: Long.fromString(el0.pool_id),
          tokenInDenom: el0.token_in_denom
        })),
        tokenInMaxAmount: token_in_max_amount,
        tokenOut: {
          denom: token_out.denom,
          amount: token_out.amount
        }
      };
    }
  },
  "/osmosis.gamm.v1beta1.MsgJoinSwapExternAmountIn": {
    aminoType: "osmosis/gamm/join-swap-extern-amount-in",
    toAmino: ({
      sender,
      poolId,
      tokenIn,
      shareOutMinAmount
    }) => {
      return {
        sender,
        pool_id: poolId.toString(),
        token_in: {
          denom: tokenIn.denom,
          amount: Long.fromValue(tokenIn.amount).toString()
        },
        share_out_min_amount: shareOutMinAmount
      };
    },
    fromAmino: ({
      sender,
      pool_id,
      token_in,
      share_out_min_amount
    }) => {
      return {
        sender,
        poolId: Long.fromString(pool_id),
        tokenIn: {
          denom: token_in.denom,
          amount: token_in.amount
        },
        shareOutMinAmount: share_out_min_amount
      };
    }
  },
  "/osmosis.gamm.v1beta1.MsgJoinSwapShareAmountOut": {
    aminoType: "osmosis/gamm/join-swap-share-amount-out",
    toAmino: ({
      sender,
      poolId,
      tokenInDenom,
      shareOutAmount,
      tokenInMaxAmount
    }) => {
      return {
        sender,
        pool_id: poolId.toString(),
        token_in_denom: tokenInDenom,
        share_out_amount: shareOutAmount,
        token_in_max_amount: tokenInMaxAmount
      };
    },
    fromAmino: ({
      sender,
      pool_id,
      token_in_denom,
      share_out_amount,
      token_in_max_amount
    }) => {
      return {
        sender,
        poolId: Long.fromString(pool_id),
        tokenInDenom: token_in_denom,
        shareOutAmount: share_out_amount,
        tokenInMaxAmount: token_in_max_amount
      };
    }
  },
  "/osmosis.gamm.v1beta1.MsgExitSwapExternAmountOut": {
    aminoType: "osmosis/gamm/exit-swap-extern-amount-out",
    toAmino: ({
      sender,
      poolId,
      tokenOut,
      shareInMaxAmount
    }) => {
      return {
        sender,
        pool_id: poolId.toString(),
        token_out: {
          denom: tokenOut.denom,
          amount: Long.fromValue(tokenOut.amount).toString()
        },
        share_in_max_amount: shareInMaxAmount
      };
    },
    fromAmino: ({
      sender,
      pool_id,
      token_out,
      share_in_max_amount
    }) => {
      return {
        sender,
        poolId: Long.fromString(pool_id),
        tokenOut: {
          denom: token_out.denom,
          amount: token_out.amount
        },
        shareInMaxAmount: share_in_max_amount
      };
    }
  },
  "/osmosis.gamm.v1beta1.MsgExitSwapShareAmountIn": {
    aminoType: "osmosis/gamm/exit-swap-share-amount-in",
    toAmino: ({
      sender,
      poolId,
      tokenOutDenom,
      shareInAmount,
      tokenOutMinAmount
    }) => {
      return {
        sender,
        pool_id: poolId.toString(),
        token_out_denom: tokenOutDenom,
        share_in_amount: shareInAmount,
        token_out_min_amount: tokenOutMinAmount
      };
    },
    fromAmino: ({
      sender,
      pool_id,
      token_out_denom,
      share_in_amount,
      token_out_min_amount
    }) => {
      return {
        sender,
        poolId: Long.fromString(pool_id),
        tokenOutDenom: token_out_denom,
        shareInAmount: share_in_amount,
        tokenOutMinAmount: token_out_min_amount
      };
    }
  }
};