1
0
mirror of https://github.com/oceanprotocol/market.git synced 2024-11-14 17:24:51 +01:00

use totalPoolTokens as maximumPoolShares, removal UI

This commit is contained in:
Matthias Kretschmann 2020-08-31 10:55:12 +02:00
parent 1d52702a87
commit 09edb9d42b
Signed by: m
GPG Key ID: 606EEEF3C479A91F
2 changed files with 18 additions and 8 deletions

View File

@ -7,21 +7,21 @@ import Header from './Header'
import { toast } from 'react-toastify'
import Loader from '../../../atoms/Loader'
import InputElement from '../../../atoms/Input/InputElement'
// TODO: make it work, figure out maximumPoolShares
import Alert from '../../../atoms/Alert'
export default function Remove({
setShowRemove,
poolAddress
poolAddress,
totalPoolTokens
}: {
setShowRemove: (show: boolean) => void
poolAddress: string
totalPoolTokens: string
}): ReactElement {
const { ocean, accountId } = useOcean()
const [amount, setAmount] = useState('')
const [isLoading, setIsLoading] = useState<boolean>()
const maximumPoolShares = '?'
const [txId, setTxId] = useState<string>('')
async function handleRemoveLiquidity() {
setIsLoading(true)
@ -31,9 +31,9 @@ export default function Remove({
accountId,
poolAddress,
amount,
maximumPoolShares
totalPoolTokens
)
console.log(result)
setTxId(result.transactionHash)
} catch (error) {
console.error(error.message)
toast.error(error.message)
@ -80,6 +80,12 @@ export default function Remove({
Remove
</Button>
)}
{txId && (
<Alert
text={`Liquidity removed. Transaction ID: ${txId}`}
state="success"
/>
)}
</div>
</div>
)

View File

@ -118,7 +118,11 @@ export default function Pool({ ddo }: { ddo: DDO }): ReactElement {
totalBalance={totalBalance}
/>
) : showRemove ? (
<Remove setShowRemove={setShowRemove} poolAddress={poolAddress} />
<Remove
setShowRemove={setShowRemove}
poolAddress={poolAddress}
totalPoolTokens={totalPoolTokens}
/>
) : (
<>
<div className={styles.dataToken}>