From 09edb9d42b958356528199716a258ede104c131a Mon Sep 17 00:00:00 2001 From: Matthias Kretschmann Date: Mon, 31 Aug 2020 10:55:12 +0200 Subject: [PATCH] use totalPoolTokens as maximumPoolShares, removal UI --- .../organisms/AssetActions/Pool/Remove.tsx | 20 ++++++++++++------- .../organisms/AssetActions/Pool/index.tsx | 6 +++++- 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/src/components/organisms/AssetActions/Pool/Remove.tsx b/src/components/organisms/AssetActions/Pool/Remove.tsx index 1a1bdee60..27a57f7af 100644 --- a/src/components/organisms/AssetActions/Pool/Remove.tsx +++ b/src/components/organisms/AssetActions/Pool/Remove.tsx @@ -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() - - const maximumPoolShares = '?' + const [txId, setTxId] = useState('') 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 )} + {txId && ( + + )} ) diff --git a/src/components/organisms/AssetActions/Pool/index.tsx b/src/components/organisms/AssetActions/Pool/index.tsx index 0ad2df9f2..4728593a2 100644 --- a/src/components/organisms/AssetActions/Pool/index.tsx +++ b/src/components/organisms/AssetActions/Pool/index.tsx @@ -118,7 +118,11 @@ export default function Pool({ ddo }: { ddo: DDO }): ReactElement { totalBalance={totalBalance} /> ) : showRemove ? ( - + ) : ( <>