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:
parent
00f02729e1
commit
8d51307852
@ -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
|
||||||
|
Loading…
Reference in New Issue
Block a user