mirror of
https://github.com/oceanprotocol/market.git
synced 2024-12-02 05:57:29 +01:00
Merge branch 'main' into feature/history-compute
This commit is contained in:
commit
0f092c6df3
6
package-lock.json
generated
6
package-lock.json
generated
@ -4479,9 +4479,9 @@
|
||||
}
|
||||
},
|
||||
"@oceanprotocol/react": {
|
||||
"version": "0.3.4",
|
||||
"resolved": "https://registry.npmjs.org/@oceanprotocol/react/-/react-0.3.4.tgz",
|
||||
"integrity": "sha512-ACCbjbGq8jZ5knNeP4rQA2g7WxCyVIvifualTOGoW5xJVudYJmt6rAJMCJTrjNMqQ8b0aRQ9wLO4G/A3ISydiw==",
|
||||
"version": "0.3.5",
|
||||
"resolved": "https://registry.npmjs.org/@oceanprotocol/react/-/react-0.3.5.tgz",
|
||||
"integrity": "sha512-k51Mltb8bhd/n7cpcwV3knURpUXiwlryQgi6/vyd2kMNMQX6OorwHT1LcmP593FW5pIHpUEC3x/zLthYY42EiA==",
|
||||
"requires": {
|
||||
"@oceanprotocol/lib": "^0.7.3",
|
||||
"axios": "^0.20.0",
|
||||
|
@ -23,7 +23,7 @@
|
||||
"@loadable/component": "5.13.1",
|
||||
"@oceanprotocol/art": "^3.0.0",
|
||||
"@oceanprotocol/lib": "^0.7.5",
|
||||
"@oceanprotocol/react": "^0.3.4",
|
||||
"@oceanprotocol/react": "^0.3.5",
|
||||
"@oceanprotocol/typographies": "^0.1.0",
|
||||
"@sindresorhus/slugify": "^1.0.0",
|
||||
"@tippyjs/react": "^4.2.0",
|
||||
|
@ -103,6 +103,29 @@ export default function Remove({
|
||||
setIsAdvanced(!isAdvanced)
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
if (!ocean || !poolTokens) return
|
||||
async function resetValues() {
|
||||
setAmountPoolShares(`0`)
|
||||
setAmountPercent('0')
|
||||
setAmountOcean('0')
|
||||
|
||||
if (isAdvanced === true) {
|
||||
setAmountMaxPercent('100')
|
||||
setAmountDatatoken('0')
|
||||
} else {
|
||||
const { amountMaxPercent } = await getMaxValuesRemove(
|
||||
ocean,
|
||||
poolAddress,
|
||||
poolTokens,
|
||||
`0`
|
||||
)
|
||||
setAmountMaxPercent(amountMaxPercent)
|
||||
}
|
||||
}
|
||||
resetValues()
|
||||
}, [isAdvanced])
|
||||
|
||||
// Check and set outputs when percentage changes
|
||||
useEffect(() => {
|
||||
if (!ocean || !poolTokens) return
|
||||
@ -113,8 +136,6 @@ export default function Remove({
|
||||
setAmountPoolShares(`${amountPoolShares}`)
|
||||
|
||||
if (isAdvanced === true) {
|
||||
setAmountMaxPercent('100')
|
||||
|
||||
const tokens = await ocean.pool.getTokensRemovedforPoolShares(
|
||||
poolAddress,
|
||||
`${amountPoolShares}`
|
||||
@ -122,13 +143,12 @@ export default function Remove({
|
||||
setAmountOcean(tokens?.oceanAmount)
|
||||
setAmountDatatoken(tokens?.dtAmount)
|
||||
} else {
|
||||
const { amountMaxPercent, amountOcean } = await getMaxValuesRemove(
|
||||
const { amountOcean } = await getMaxValuesRemove(
|
||||
ocean,
|
||||
poolAddress,
|
||||
poolTokens,
|
||||
`${amountPoolShares}`
|
||||
)
|
||||
setAmountMaxPercent(amountMaxPercent)
|
||||
setAmountOcean(amountOcean)
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user