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=="
|
"integrity": "sha512-p0oOHXr60hXZuLNsQ/PsOQtCfia79thm7MjPxTrnnBvD+csJoHzARYMB0IFj/KTw6U5vLXODgjJAn8x6QksLwg=="
|
||||||
},
|
},
|
||||||
"@oceanprotocol/lib": {
|
"@oceanprotocol/lib": {
|
||||||
"version": "0.9.0",
|
"version": "0.9.3",
|
||||||
"resolved": "https://registry.npmjs.org/@oceanprotocol/lib/-/lib-0.9.0.tgz",
|
"resolved": "https://registry.npmjs.org/@oceanprotocol/lib/-/lib-0.9.3.tgz",
|
||||||
"integrity": "sha512-BI00ZXTdGXJZNTJhwtqsnXjKtlcl1PXB18e26aCo5g1VT9S19urPLT04k9Zkz4k+3HepSc5QdOu+yo47MS1I7g==",
|
"integrity": "sha512-eUTM5D5AZ1eDfzAYSqML1fELXOTXy0Zj7y8NuSlyN9Ersg7e9G8lIWCAA49pcBNCJ41niG/lpAuIpiUPd2eFpA==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"@ethereum-navigator/navigator": "^0.5.0",
|
"@ethereum-navigator/navigator": "^0.5.0",
|
||||||
"@oceanprotocol/contracts": "^0.5.7",
|
"@oceanprotocol/contracts": "^0.5.7",
|
||||||
@ -3867,11 +3867,11 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"@oceanprotocol/react": {
|
"@oceanprotocol/react": {
|
||||||
"version": "0.3.9",
|
"version": "0.3.10",
|
||||||
"resolved": "https://registry.npmjs.org/@oceanprotocol/react/-/react-0.3.9.tgz",
|
"resolved": "https://registry.npmjs.org/@oceanprotocol/react/-/react-0.3.10.tgz",
|
||||||
"integrity": "sha512-qsaQVSQtHL+5QoknrVuJOdRr2mQ+2An368yNYzsMbxaAKp6HJ7b3p9bfqV0WQqaMA10GqTyfUi1GUJq630h9DA==",
|
"integrity": "sha512-NlnWq/AxhtdfjeVAxKboODHUnlJT0kAcB4KAJEC4boDvPW6pWVhJlyEwt1+JiJuefq/YyppxqnY21yrTkUE3wA==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"@oceanprotocol/lib": "^0.9.0",
|
"@oceanprotocol/lib": "^0.9.3",
|
||||||
"axios": "^0.21.0",
|
"axios": "^0.21.0",
|
||||||
"decimal.js": "^10.2.1",
|
"decimal.js": "^10.2.1",
|
||||||
"web3": "^1.3.0",
|
"web3": "^1.3.0",
|
||||||
@ -34850,9 +34850,9 @@
|
|||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@types/node": {
|
"@types/node": {
|
||||||
"version": "12.19.1",
|
"version": "12.19.2",
|
||||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-12.19.1.tgz",
|
"resolved": "https://registry.npmjs.org/@types/node/-/node-12.19.2.tgz",
|
||||||
"integrity": "sha512-/xaVmBBjOGh55WCqumLAHXU9VhjGtmyTGqJzFBXRWZzByOXI5JAJNx9xPVGEsNizrNwcec92fQMj458MWfjN1A=="
|
"integrity": "sha512-SRH6QM0IMOBBFmDiJ75vlhcbUEYEquvSuhsVW9ijG20JvdFTfOrB1p6ddZxz5y/JNnbf+9HoHhjhOVSX2hsJyA=="
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -35050,9 +35050,9 @@
|
|||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@types/node": {
|
"@types/node": {
|
||||||
"version": "12.19.1",
|
"version": "12.19.2",
|
||||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-12.19.1.tgz",
|
"resolved": "https://registry.npmjs.org/@types/node/-/node-12.19.2.tgz",
|
||||||
"integrity": "sha512-/xaVmBBjOGh55WCqumLAHXU9VhjGtmyTGqJzFBXRWZzByOXI5JAJNx9xPVGEsNizrNwcec92fQMj458MWfjN1A=="
|
"integrity": "sha512-SRH6QM0IMOBBFmDiJ75vlhcbUEYEquvSuhsVW9ijG20JvdFTfOrB1p6ddZxz5y/JNnbf+9HoHhjhOVSX2hsJyA=="
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -22,8 +22,8 @@
|
|||||||
"@coingecko/cryptoformat": "^0.4.2",
|
"@coingecko/cryptoformat": "^0.4.2",
|
||||||
"@loadable/component": "5.13.1",
|
"@loadable/component": "5.13.1",
|
||||||
"@oceanprotocol/art": "^3.0.0",
|
"@oceanprotocol/art": "^3.0.0",
|
||||||
"@oceanprotocol/lib": "^0.9.0",
|
"@oceanprotocol/lib": "^0.9.3",
|
||||||
"@oceanprotocol/react": "^0.3.9",
|
"@oceanprotocol/react": "^0.3.10",
|
||||||
"@oceanprotocol/typographies": "^0.1.0",
|
"@oceanprotocol/typographies": "^0.1.0",
|
||||||
"@sindresorhus/slugify": "^1.0.0",
|
"@sindresorhus/slugify": "^1.0.0",
|
||||||
"@tippyjs/react": "^4.2.0",
|
"@tippyjs/react": "^4.2.0",
|
||||||
|
@ -35,16 +35,18 @@ export default function FormPricing({
|
|||||||
function handleTabChange(tabName: string) {
|
function handleTabChange(tabName: string) {
|
||||||
const type = tabName.toLowerCase()
|
const type = tabName.toLowerCase()
|
||||||
setFieldValue('type', type)
|
setFieldValue('type', type)
|
||||||
|
type === 'fixed' && setFieldValue('dtAmount', 1000)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Always update everything when price value changes
|
// Always update everything when price value changes
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
if (type === 'fixed') return
|
||||||
const dtAmount =
|
const dtAmount =
|
||||||
(Number(oceanAmount) / Number(weightOnOcean) / price) *
|
(Number(oceanAmount) / Number(weightOnOcean) / price) *
|
||||||
Number(weightOnDataToken)
|
Number(weightOnDataToken)
|
||||||
|
|
||||||
setFieldValue('dtAmount', dtAmount)
|
setFieldValue('dtAmount', dtAmount)
|
||||||
}, [price, oceanAmount, weightOnOcean, weightOnDataToken])
|
}, [price, oceanAmount, weightOnOcean, weightOnDataToken, type])
|
||||||
|
|
||||||
const tabs = [
|
const tabs = [
|
||||||
{
|
{
|
||||||
|
@ -29,7 +29,7 @@ export default function AssetContent({
|
|||||||
const { dtSymbol, dtName } = usePricing(ddo)
|
const { dtSymbol, dtName } = usePricing(ddo)
|
||||||
|
|
||||||
const isOwner = accountId === ddo.publicKey[0].owner
|
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
|
const showPricing = isOwner && hasNoPrice
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
Loading…
Reference in New Issue
Block a user