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 { toast } from 'react-toastify'
|
||||||
import Loader from '../../../atoms/Loader'
|
import Loader from '../../../atoms/Loader'
|
||||||
import InputElement from '../../../atoms/Input/InputElement'
|
import InputElement from '../../../atoms/Input/InputElement'
|
||||||
|
import Alert from '../../../atoms/Alert'
|
||||||
// TODO: make it work, figure out maximumPoolShares
|
|
||||||
|
|
||||||
export default function Remove({
|
export default function Remove({
|
||||||
setShowRemove,
|
setShowRemove,
|
||||||
poolAddress
|
poolAddress,
|
||||||
|
totalPoolTokens
|
||||||
}: {
|
}: {
|
||||||
setShowRemove: (show: boolean) => void
|
setShowRemove: (show: boolean) => void
|
||||||
poolAddress: string
|
poolAddress: string
|
||||||
|
totalPoolTokens: string
|
||||||
}): ReactElement {
|
}): ReactElement {
|
||||||
const { ocean, accountId } = useOcean()
|
const { ocean, accountId } = useOcean()
|
||||||
const [amount, setAmount] = useState('')
|
const [amount, setAmount] = useState('')
|
||||||
const [isLoading, setIsLoading] = useState<boolean>()
|
const [isLoading, setIsLoading] = useState<boolean>()
|
||||||
|
const [txId, setTxId] = useState<string>('')
|
||||||
const maximumPoolShares = '?'
|
|
||||||
|
|
||||||
async function handleRemoveLiquidity() {
|
async function handleRemoveLiquidity() {
|
||||||
setIsLoading(true)
|
setIsLoading(true)
|
||||||
@ -31,9 +31,9 @@ export default function Remove({
|
|||||||
accountId,
|
accountId,
|
||||||
poolAddress,
|
poolAddress,
|
||||||
amount,
|
amount,
|
||||||
maximumPoolShares
|
totalPoolTokens
|
||||||
)
|
)
|
||||||
console.log(result)
|
setTxId(result.transactionHash)
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error.message)
|
console.error(error.message)
|
||||||
toast.error(error.message)
|
toast.error(error.message)
|
||||||
@ -80,6 +80,12 @@ export default function Remove({
|
|||||||
Remove
|
Remove
|
||||||
</Button>
|
</Button>
|
||||||
)}
|
)}
|
||||||
|
{txId && (
|
||||||
|
<Alert
|
||||||
|
text={`Liquidity removed. Transaction ID: ${txId}`}
|
||||||
|
state="success"
|
||||||
|
/>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
|
@ -118,7 +118,11 @@ export default function Pool({ ddo }: { ddo: DDO }): ReactElement {
|
|||||||
totalBalance={totalBalance}
|
totalBalance={totalBalance}
|
||||||
/>
|
/>
|
||||||
) : showRemove ? (
|
) : showRemove ? (
|
||||||
<Remove setShowRemove={setShowRemove} poolAddress={poolAddress} />
|
<Remove
|
||||||
|
setShowRemove={setShowRemove}
|
||||||
|
poolAddress={poolAddress}
|
||||||
|
totalPoolTokens={totalPoolTokens}
|
||||||
|
/>
|
||||||
) : (
|
) : (
|
||||||
<>
|
<>
|
||||||
<div className={styles.dataToken}>
|
<div className={styles.dataToken}>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user