1
0
mirror of https://github.com/oceanprotocol/market.git synced 2024-11-15 01:34:57 +01:00

typing fixes

This commit is contained in:
Matthias Kretschmann 2020-10-08 14:45:55 +02:00
parent 50accc0065
commit 4b0f7c0042
Signed by: m
GPG Key ID: 606EEEF3C479A91F
4 changed files with 15 additions and 19 deletions

View File

@ -26,8 +26,8 @@ export default function PoolStatistics({
return ( return (
<div className={styles.statistics}> <div className={styles.statistics}>
<h3 className={styles.title}>Pool Statistics</h3> <h3 className={styles.title}>Pool Statistics</h3>
<Token symbol="OCEAN" balance={totalBalance.ocean} /> <Token symbol="OCEAN" balance={`${totalBalance.ocean}`} />
<Token symbol={dtSymbol} balance={totalBalance.datatoken} /> <Token symbol={dtSymbol} balance={`${totalBalance.datatoken}`} />
{debug === true && <Token symbol="BPT" balance={totalPoolTokens} />} {debug === true && <Token symbol="BPT" balance={totalPoolTokens} />}
<Token symbol="% swap fee" balance={swapFee} /> <Token symbol="% swap fee" balance={swapFee} />
<Conversion price={`${totalLiquidityInOcean}`} /> <Conversion price={`${totalLiquidityInOcean}`} />

View File

@ -50,7 +50,7 @@ export default function Remove({
} }
function handleMax() { function handleMax() {
setAmount(userLiquidity.ocean) setAmount(`${userLiquidity.ocean}`)
} }
return ( return (
@ -63,7 +63,7 @@ export default function Remove({
<form className={styles.removeInput}> <form className={styles.removeInput}>
<div className={styles.userLiquidity}> <div className={styles.userLiquidity}>
<span>Your pool liquidity: </span> <span>Your pool liquidity: </span>
<PriceUnit price={userLiquidity.ocean} symbol="OCEAN" small /> <PriceUnit price={`${userLiquidity.ocean}`} symbol="OCEAN" small />
</div> </div>
<InputElement <InputElement
value={amount} value={amount}
@ -74,7 +74,7 @@ export default function Remove({
onChange={handleAmountChange} onChange={handleAmountChange}
/> />
{userLiquidity.ocean > amount && ( {userLiquidity.ocean > Number(amount) && (
<Button <Button
className={styles.buttonMax} className={styles.buttonMax}
style="text" style="text"

View File

@ -16,8 +16,8 @@ import PoolStatistics from './PoolStatistics'
import Token from './Token' import Token from './Token'
export interface Balance { export interface Balance {
ocean: string ocean: number
datatoken: string datatoken: number
} }
/* /*
@ -86,8 +86,8 @@ export default function Pool({ ddo }: { ddo: DDO }): ReactElement {
Number(price.datatoken) Number(price.datatoken)
const userLiquidity = { const userLiquidity = {
ocean: `${userOceanBalance}`, ocean: userOceanBalance,
datatoken: `${userDtBalance}` datatoken: userDtBalance
} }
setUserBalance(userLiquidity) setUserBalance(userLiquidity)
@ -130,8 +130,8 @@ export default function Pool({ ddo }: { ddo: DDO }): ReactElement {
<> <>
<div className={styles.dataToken}> <div className={styles.dataToken}>
<PriceUnit price="1" symbol={dtSymbol} /> ={' '} <PriceUnit price="1" symbol={dtSymbol} /> ={' '}
<PriceUnit price={price.value} /> <PriceUnit price={`${price.value}`} />
<Conversion price={price.value} /> <Conversion price={`${price.value}`} />
<Tooltip content="Explain how this price is determined..." /> <Tooltip content="Explain how this price is determined..." />
<div className={styles.dataTokenLinks}> <div className={styles.dataTokenLinks}>
<EtherscanLink <EtherscanLink
@ -152,14 +152,14 @@ export default function Pool({ ddo }: { ddo: DDO }): ReactElement {
Your Liquidity Your Liquidity
<Tooltip content="Explain what this represents, advantage of providing liquidity..." /> <Tooltip content="Explain what this represents, advantage of providing liquidity..." />
</h3> </h3>
<Token symbol="OCEAN" balance={userLiquidity.ocean} /> <Token symbol="OCEAN" balance={`${userLiquidity.ocean}`} />
<Token symbol={dtSymbol} balance={userLiquidity.datatoken} /> <Token symbol={dtSymbol} balance={`${userLiquidity.datatoken}`} />
{debug === true && <Token symbol="BPT" balance={poolTokens} />} {debug === true && <Token symbol="BPT" balance={poolTokens} />}
<Token symbol="% of pool" balance={poolShare} /> <Token symbol="% of pool" balance={poolShare} />
</div> </div>
<PoolStatistics <PoolStatistics
price={price.value} price={`${price.value}`}
totalPoolTokens={totalPoolTokens} totalPoolTokens={totalPoolTokens}
totalBalance={{ ocean: price.ocean, datatoken: price.datatoken }} totalBalance={{ ocean: price.ocean, datatoken: price.datatoken }}
swapFee={swapFee} swapFee={swapFee}

View File

@ -21,11 +21,7 @@ export default function AssetActions({ ddo }: { ddo: DDO }): ReactElement {
useEffect(() => { useEffect(() => {
if (!price || !price.value || !balance || !balance.ocean) return if (!price || !price.value || !balance || !balance.ocean) return
const isFree = price.value === '0' setIsBalanceSufficient(compareAsBN(balance.ocean, `${price.value}`))
setIsBalanceSufficient(
isFree ? true : compareAsBN(balance.ocean, price.value)
)
return () => { return () => {
setIsBalanceSufficient(false) setIsBalanceSufficient(false)