mars-v2-frontend/src/api/vaults/getVaultTokenFromLp.ts
Bob van der Helm 3413203ca7
Mp 2949 implemet health computer for borrow (#311)
* implemented max borrow for borrow page

setup basic useHealthComputer

* finish up healthcomputer

* updated tests
2023-07-24 09:44:45 +02:00

15 lines
405 B
TypeScript

import { getVaultQueryClient } from 'api/cosmwasm-client'
export async function getVaultTokenFromLp(
vaultAddress: string,
lpAmount: string,
): Promise<{ vaultAddress: string; amount: string }> {
try {
const client = await getVaultQueryClient(vaultAddress)
return client.previewDeposit({ amount: lpAmount }).then((amount) => ({ vaultAddress, amount }))
} catch (ex) {
throw ex
}
}