From 231fdbb7fe4ad86b846da532896b508fbe5178fe Mon Sep 17 00:00:00 2001 From: Matthias Kretschmann Date: Wed, 7 Oct 2020 13:38:55 +0200 Subject: [PATCH] add method refactor --- src/components/organisms/AssetActions/Pool/Add.tsx | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/components/organisms/AssetActions/Pool/Add.tsx b/src/components/organisms/AssetActions/Pool/Add.tsx index 669ca1c9d..c31a7e047 100644 --- a/src/components/organisms/AssetActions/Pool/Add.tsx +++ b/src/components/organisms/AssetActions/Pool/Add.tsx @@ -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)