mirror of
https://github.com/oceanprotocol/market.git
synced 2024-12-02 05:57:29 +01:00
use totalPoolTokens as maximumPoolShares, removal UI
This commit is contained in:
parent
1d52702a87
commit
09edb9d42b
@ -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>
|
||||
)
|
||||
|
@ -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}>
|
||||
|
Loading…
Reference in New Issue
Block a user