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

Display fiat value inside pool statistics (#610)

* fixed

* replaced ddo.price with price from useAsset

Co-authored-by: Norbi <katunanorbert@gmai.com>
This commit is contained in:
Norbi 2021-05-19 15:14:06 +03:00 committed by GitHub
parent cb8243f4cc
commit 9ce9fc84c7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 5 deletions

View File

@ -7,7 +7,7 @@ import { useAsset } from '../../../../providers/Asset'
export default function Transactions(): ReactElement {
const [open, setOpen] = useState(false)
const { ddo } = useAsset()
const { price } = useAsset()
function handleClick() {
setOpen(!open)
}
@ -29,7 +29,7 @@ export default function Transactions(): ReactElement {
</Button>
</h3>
{open === true && (
<PoolTransactions poolAddress={ddo.price?.address} minimal />
<PoolTransactions poolAddress={price?.address} minimal />
)}
</div>
)

View File

@ -95,8 +95,8 @@ export default function Pool(): ReactElement {
const [refreshPool, setRefreshPool] = useState(false)
const { data: dataLiquidity } = useQuery<PoolLiquidity>(poolLiquidityQuery, {
variables: {
id: ddo.price.address.toLowerCase(),
shareId: `${ddo.price.address.toLowerCase()}-${ddo.publicKey[0].owner.toLowerCase()}`
id: price.address.toLowerCase(),
shareId: `${price.address.toLowerCase()}-${ddo.publicKey[0].owner.toLowerCase()}`
},
pollInterval: 5000
})
@ -170,7 +170,8 @@ export default function Pool(): ReactElement {
const totalUserLiquidityInOcean =
userLiquidity?.ocean + userLiquidity?.datatoken * price?.value
setTotalUserLiquidityInOcean(totalUserLiquidityInOcean)
const totalLiquidityInOcean = price?.ocean + price?.datatoken * price?.value
const totalLiquidityInOcean =
Number(price?.ocean) + Number(price?.datatoken) * Number(price?.value)
setTotalLiquidityInOcean(totalLiquidityInOcean)
}, [userLiquidity, price, poolTokens, totalPoolTokens])