1
0
mirror of https://github.com/oceanprotocol/market.git synced 2024-11-14 09:14:52 +01:00

make pool info work

This commit is contained in:
Matthias Kretschmann 2020-08-18 13:13:55 +02:00
parent 7e10f2232c
commit 2d3e0e9681
Signed by: m
GPG Key ID: 606EEEF3C479A91F

View File

@ -8,11 +8,12 @@ export default function Trade({ ddo }: { ddo: DDO }): ReactElement {
const [currentTokens, setCurrentTokens] = useState<string[]>() const [currentTokens, setCurrentTokens] = useState<string[]>()
const [numTokens, setNumTokens] = useState() const [numTokens, setNumTokens] = useState()
const poolAddress = '0xunknown' // How to get this?
useEffect(() => { useEffect(() => {
async function init() { async function init() {
try { try {
const pools = await ocean.pool.searchPoolforDT(accountId, ddo.dataToken)
const poolAddress = pools[0] // assume there is only one pool
const numTokens = await ocean.pool.getNumTokens(accountId, poolAddress) const numTokens = await ocean.pool.getNumTokens(accountId, poolAddress)
setNumTokens(numTokens) setNumTokens(numTokens)