1
0
mirror of https://github.com/oceanprotocol/market.git synced 2024-11-15 01:34:57 +01:00

refactor getting dtPrice

This commit is contained in:
Matthias Kretschmann 2020-08-19 18:17:18 +02:00
parent 00f02729e1
commit 8d51307852
Signed by: m
GPG Key ID: 606EEEF3C479A91F

View File

@ -32,8 +32,9 @@ export default function Pool({ ddo }: { ddo: DDO }): ReactElement {
useEffect(() => { useEffect(() => {
async function init() { async function init() {
try { try {
const { poolAddress } = await getBestPool(ddo.dataToken) const { poolAddress, poolPrice } = await getBestPool(ddo.dataToken)
setPoolAddress(poolAddress) setPoolAddress(poolAddress)
setDtPrice(poolPrice)
const dtSymbol = await ocean.datatokens.getSymbol( const dtSymbol = await ocean.datatokens.getSymbol(
ddo.dataToken, ddo.dataToken,
@ -41,9 +42,6 @@ export default function Pool({ ddo }: { ddo: DDO }): ReactElement {
) )
setDtSymbol(dtSymbol) setDtSymbol(dtSymbol)
const dtPrice = await ocean.pool.getDTPrice(accountId, poolAddress)
setDtPrice(dtPrice)
const oceanReserve = await ocean.pool.getOceanReserve( const oceanReserve = await ocean.pool.getOceanReserve(
accountId, accountId,
poolAddress poolAddress