mirror of
https://github.com/oceanprotocol/market.git
synced 2024-12-02 05:57:29 +01:00
price update when connecting
This commit is contained in:
parent
920d5c59fb
commit
041a6c63b5
6
package-lock.json
generated
6
package-lock.json
generated
@ -3606,9 +3606,9 @@
|
||||
}
|
||||
},
|
||||
"@oceanprotocol/react": {
|
||||
"version": "0.0.34",
|
||||
"resolved": "https://registry.npmjs.org/@oceanprotocol/react/-/react-0.0.34.tgz",
|
||||
"integrity": "sha512-xgKNuVszU0eYtDnByPaI0PSZgO1S+haWlMOGvmLTfxiKv2A/m2qK09gFiY5SgiGsPozphG5daTw7M0dyf0tD1w==",
|
||||
"version": "0.0.36",
|
||||
"resolved": "https://registry.npmjs.org/@oceanprotocol/react/-/react-0.0.36.tgz",
|
||||
"integrity": "sha512-IUiA3zWGUBUb23bW+Oxg9QDd7rS6EVVCDqxkvbGqOuNxPybKqZMs5JNzQGW9hJY6SrmrBQGY114b3+CxoCULUA==",
|
||||
"requires": {
|
||||
"@oceanprotocol/lib": "^0.1.11",
|
||||
"axios": "^0.19.2",
|
||||
|
@ -23,7 +23,7 @@
|
||||
"@loadable/component": "^5.13.1",
|
||||
"@oceanprotocol/art": "^3.0.0",
|
||||
"@oceanprotocol/lib": "^0.1.11",
|
||||
"@oceanprotocol/react": "^0.0.34",
|
||||
"@oceanprotocol/react": "^0.0.36",
|
||||
"@oceanprotocol/typographies": "^0.1.0",
|
||||
"@sindresorhus/slugify": "^1.0.0",
|
||||
"@tippyjs/react": "^4.1.0",
|
||||
|
@ -21,18 +21,19 @@ export default function Price({
|
||||
small?: boolean
|
||||
setPriceOutside?: (price: string) => void
|
||||
}): ReactElement {
|
||||
const { chainId } = useOcean()
|
||||
const { ocean, chainId, accountId } = useOcean()
|
||||
const { getBestPrice } = useMetadata()
|
||||
const [price, setPrice] = useState<string>()
|
||||
|
||||
useEffect(() => {
|
||||
async function init() {
|
||||
console.log(ocean)
|
||||
const price = await getBestPrice(ddo.dataToken)
|
||||
setPrice(price)
|
||||
setPriceOutside && price !== '' && setPriceOutside(price)
|
||||
}
|
||||
init()
|
||||
}, [chainId])
|
||||
}, [chainId, accountId, ocean])
|
||||
|
||||
const styleClasses = cx({
|
||||
price: true,
|
||||
@ -51,7 +52,9 @@ export default function Price({
|
||||
</>
|
||||
)
|
||||
|
||||
return price ? (
|
||||
return !ocean ? (
|
||||
<div className={styles.empty}>Please connect your wallet to view price</div>
|
||||
) : price ? (
|
||||
<div className={styleClasses}>{displayPrice}</div>
|
||||
) : price === '' ? (
|
||||
<div className={styles.empty}>
|
||||
|
Loading…
Reference in New Issue
Block a user