1
0
mirror of https://github.com/oceanprotocol/react.git synced 2025-02-14 21:10:38 +01:00

change pool to poolAddress

This commit is contained in:
mihaisc 2020-08-20 13:18:42 +03:00
parent ef1dd37837
commit 03159f0bf4

View File

@ -11,7 +11,7 @@ interface UseMetadata {
metadata: Metadata metadata: Metadata
title: string title: string
price: string price: string
pool: Pool poolAddress: string
isLoaded: boolean isLoaded: boolean
getPrice: (dataTokenAddress?: string) => Promise<string> getPrice: (dataTokenAddress?: string) => Promise<string>
getPool: (dataTokenAddress?: string) => Promise<Pool> getPool: (dataTokenAddress?: string) => Promise<Pool>
@ -25,7 +25,7 @@ function useMetadata(did?: DID | string, ddo?: DDO): UseMetadata {
const [title, setTitle] = useState<string | undefined>() const [title, setTitle] = useState<string | undefined>()
const [isLoaded, setIsLoaded] = useState(false) const [isLoaded, setIsLoaded] = useState(false)
const [price, setPrice] = useState<string | undefined>() const [price, setPrice] = useState<string | undefined>()
const [pool, setPool] = useState<Pool | undefined>() const [poolAddress, setPoolAddress] = useState<string | undefined>()
async function getDDO(did: DID | string): Promise<DDO> { async function getDDO(did: DID | string): Promise<DDO> {
if (status === ProviderStatus.CONNECTED) { if (status === ProviderStatus.CONNECTED) {
@ -81,7 +81,7 @@ function useMetadata(did?: DID | string, ddo?: DDO): UseMetadata {
setMetadata(metadata) setMetadata(metadata)
setTitle(metadata.main.name) setTitle(metadata.main.name)
const pool = await getPool() const pool = await getPool()
setPool(pool) setPoolAddress(pool.address)
setPrice(pool.price) setPrice(pool.price)
setIsLoaded(true) setIsLoaded(true)
} }
@ -90,7 +90,7 @@ function useMetadata(did?: DID | string, ddo?: DDO): UseMetadata {
const interval = setInterval(async () => { const interval = setInterval(async () => {
const pool = await getPool() const pool = await getPool()
setPool(pool) setPoolAddress(pool.address)
setPrice(pool.price) setPrice(pool.price)
}, 10000) }, 10000)
return () => clearInterval(interval) return () => clearInterval(interval)
@ -102,7 +102,7 @@ function useMetadata(did?: DID | string, ddo?: DDO): UseMetadata {
metadata, metadata,
title, title,
price, price,
pool, poolAddress,
isLoaded, isLoaded,
getPrice, getPrice,
getPool getPool