mirror of
https://github.com/oceanprotocol/market.git
synced 2024-12-02 05:57:29 +01:00
Merge pull request #146 from oceanprotocol/fix/144
fixed price and gas estimate
This commit is contained in:
commit
d33669c963
26
package-lock.json
generated
26
package-lock.json
generated
@ -3850,9 +3850,9 @@
|
||||
"integrity": "sha512-p0oOHXr60hXZuLNsQ/PsOQtCfia79thm7MjPxTrnnBvD+csJoHzARYMB0IFj/KTw6U5vLXODgjJAn8x6QksLwg=="
|
||||
},
|
||||
"@oceanprotocol/lib": {
|
||||
"version": "0.9.0",
|
||||
"resolved": "https://registry.npmjs.org/@oceanprotocol/lib/-/lib-0.9.0.tgz",
|
||||
"integrity": "sha512-BI00ZXTdGXJZNTJhwtqsnXjKtlcl1PXB18e26aCo5g1VT9S19urPLT04k9Zkz4k+3HepSc5QdOu+yo47MS1I7g==",
|
||||
"version": "0.9.3",
|
||||
"resolved": "https://registry.npmjs.org/@oceanprotocol/lib/-/lib-0.9.3.tgz",
|
||||
"integrity": "sha512-eUTM5D5AZ1eDfzAYSqML1fELXOTXy0Zj7y8NuSlyN9Ersg7e9G8lIWCAA49pcBNCJ41niG/lpAuIpiUPd2eFpA==",
|
||||
"requires": {
|
||||
"@ethereum-navigator/navigator": "^0.5.0",
|
||||
"@oceanprotocol/contracts": "^0.5.7",
|
||||
@ -3867,11 +3867,11 @@
|
||||
}
|
||||
},
|
||||
"@oceanprotocol/react": {
|
||||
"version": "0.3.9",
|
||||
"resolved": "https://registry.npmjs.org/@oceanprotocol/react/-/react-0.3.9.tgz",
|
||||
"integrity": "sha512-qsaQVSQtHL+5QoknrVuJOdRr2mQ+2An368yNYzsMbxaAKp6HJ7b3p9bfqV0WQqaMA10GqTyfUi1GUJq630h9DA==",
|
||||
"version": "0.3.10",
|
||||
"resolved": "https://registry.npmjs.org/@oceanprotocol/react/-/react-0.3.10.tgz",
|
||||
"integrity": "sha512-NlnWq/AxhtdfjeVAxKboODHUnlJT0kAcB4KAJEC4boDvPW6pWVhJlyEwt1+JiJuefq/YyppxqnY21yrTkUE3wA==",
|
||||
"requires": {
|
||||
"@oceanprotocol/lib": "^0.9.0",
|
||||
"@oceanprotocol/lib": "^0.9.3",
|
||||
"axios": "^0.21.0",
|
||||
"decimal.js": "^10.2.1",
|
||||
"web3": "^1.3.0",
|
||||
@ -34850,9 +34850,9 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@types/node": {
|
||||
"version": "12.19.1",
|
||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-12.19.1.tgz",
|
||||
"integrity": "sha512-/xaVmBBjOGh55WCqumLAHXU9VhjGtmyTGqJzFBXRWZzByOXI5JAJNx9xPVGEsNizrNwcec92fQMj458MWfjN1A=="
|
||||
"version": "12.19.2",
|
||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-12.19.2.tgz",
|
||||
"integrity": "sha512-SRH6QM0IMOBBFmDiJ75vlhcbUEYEquvSuhsVW9ijG20JvdFTfOrB1p6ddZxz5y/JNnbf+9HoHhjhOVSX2hsJyA=="
|
||||
}
|
||||
}
|
||||
},
|
||||
@ -35050,9 +35050,9 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@types/node": {
|
||||
"version": "12.19.1",
|
||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-12.19.1.tgz",
|
||||
"integrity": "sha512-/xaVmBBjOGh55WCqumLAHXU9VhjGtmyTGqJzFBXRWZzByOXI5JAJNx9xPVGEsNizrNwcec92fQMj458MWfjN1A=="
|
||||
"version": "12.19.2",
|
||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-12.19.2.tgz",
|
||||
"integrity": "sha512-SRH6QM0IMOBBFmDiJ75vlhcbUEYEquvSuhsVW9ijG20JvdFTfOrB1p6ddZxz5y/JNnbf+9HoHhjhOVSX2hsJyA=="
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -22,8 +22,8 @@
|
||||
"@coingecko/cryptoformat": "^0.4.2",
|
||||
"@loadable/component": "5.13.1",
|
||||
"@oceanprotocol/art": "^3.0.0",
|
||||
"@oceanprotocol/lib": "^0.9.0",
|
||||
"@oceanprotocol/react": "^0.3.9",
|
||||
"@oceanprotocol/lib": "^0.9.3",
|
||||
"@oceanprotocol/react": "^0.3.10",
|
||||
"@oceanprotocol/typographies": "^0.1.0",
|
||||
"@sindresorhus/slugify": "^1.0.0",
|
||||
"@tippyjs/react": "^4.2.0",
|
||||
|
@ -35,16 +35,18 @@ export default function FormPricing({
|
||||
function handleTabChange(tabName: string) {
|
||||
const type = tabName.toLowerCase()
|
||||
setFieldValue('type', type)
|
||||
type === 'fixed' && setFieldValue('dtAmount', 1000)
|
||||
}
|
||||
|
||||
// Always update everything when price value changes
|
||||
useEffect(() => {
|
||||
if (type === 'fixed') return
|
||||
const dtAmount =
|
||||
(Number(oceanAmount) / Number(weightOnOcean) / price) *
|
||||
Number(weightOnDataToken)
|
||||
|
||||
setFieldValue('dtAmount', dtAmount)
|
||||
}, [price, oceanAmount, weightOnOcean, weightOnDataToken])
|
||||
}, [price, oceanAmount, weightOnOcean, weightOnDataToken, type])
|
||||
|
||||
const tabs = [
|
||||
{
|
||||
|
@ -29,7 +29,7 @@ export default function AssetContent({
|
||||
const { dtSymbol, dtName } = usePricing(ddo)
|
||||
|
||||
const isOwner = accountId === ddo.publicKey[0].owner
|
||||
const hasNoPrice = ddo.price.type === ''
|
||||
const hasNoPrice = ddo.price.datatoken === 0 && ddo.price.value === 0
|
||||
const showPricing = isOwner && hasNoPrice
|
||||
|
||||
return (
|
||||
|
Loading…
Reference in New Issue
Block a user