From 8d51307852227b7ad503d48bcc408cac00053944 Mon Sep 17 00:00:00 2001 From: Matthias Kretschmann Date: Wed, 19 Aug 2020 18:17:18 +0200 Subject: [PATCH] refactor getting dtPrice --- src/components/organisms/AssetActions/Pool/index.tsx | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/components/organisms/AssetActions/Pool/index.tsx b/src/components/organisms/AssetActions/Pool/index.tsx index 87278e220..422e8f9b8 100644 --- a/src/components/organisms/AssetActions/Pool/index.tsx +++ b/src/components/organisms/AssetActions/Pool/index.tsx @@ -32,8 +32,9 @@ export default function Pool({ ddo }: { ddo: DDO }): ReactElement { useEffect(() => { async function init() { try { - const { poolAddress } = await getBestPool(ddo.dataToken) + const { poolAddress, poolPrice } = await getBestPool(ddo.dataToken) setPoolAddress(poolAddress) + setDtPrice(poolPrice) const dtSymbol = await ocean.datatokens.getSymbol( ddo.dataToken, @@ -41,9 +42,6 @@ export default function Pool({ ddo }: { ddo: DDO }): ReactElement { ) setDtSymbol(dtSymbol) - const dtPrice = await ocean.pool.getDTPrice(accountId, poolAddress) - setDtPrice(dtPrice) - const oceanReserve = await ocean.pool.getOceanReserve( accountId, poolAddress