1
0
mirror of https://github.com/oceanprotocol/market.git synced 2024-12-02 05:57:29 +01:00

add method refactor

This commit is contained in:
Matthias Kretschmann 2020-10-07 13:38:55 +02:00
parent baa61b3481
commit 231fdbb7fe
Signed by: m
GPG Key ID: 606EEEF3C479A91F

View File

@ -59,14 +59,13 @@ export default function Add({
async function handleAddLiquidity() {
setIsLoading(true)
const addMethod =
coin === 'OCEAN'
? ocean.pool.addOceanLiquidity
: ocean.pool.addDTLiquidity
try {
const result = await addMethod(accountId, poolAddress, amount)
setTxId(result.transactionHash)
const result =
coin === 'OCEAN'
? await ocean.pool.addOceanLiquidity(accountId, poolAddress, amount)
: await ocean.pool.addDTLiquidity(accountId, poolAddress, amount)
setTxId(result?.transactionHash)
} catch (error) {
console.error(error.message)
toast.error(error.message)