Commit cb4e1648 authored by Noah Zinsmeister's avatar Noah Zinsmeister Committed by GitHub

bug fixes (#319)

* fix ens name bug

* remove console.log

* add GEN

* fix styling and min display values
parent 5c2acb8c
...@@ -93,21 +93,28 @@ export default function AddressInputPanel({ title, initialInput = '', onChange = ...@@ -93,21 +93,28 @@ export default function AddressInputPanel({ title, initialInput = '', onChange =
let stale = false let stale = false
if (isAddress(debouncedInput)) { if (isAddress(debouncedInput)) {
library.lookupAddress(debouncedInput).then(name => { library
if (!stale) { .lookupAddress(debouncedInput)
// if an ENS name exists, set it as the destination .then(name => {
if (name) { if (!stale) {
setInput(name) // if an ENS name exists, set it as the destination
} else { if (name) {
setData({ address: debouncedInput, name: '' }) setInput(name)
setError(null) } else {
setData({ address: debouncedInput, name: '' })
setError(null)
}
} }
} })
}) .catch(() => {
setData({ address: debouncedInput, name: '' })
setError(null)
})
} else { } else {
if (debouncedInput !== '') { if (debouncedInput !== '') {
try { library
library.resolveName(debouncedInput).then(address => { .resolveName(debouncedInput)
.then(address => {
if (!stale) { if (!stale) {
// if the debounced input name resolves to an address // if the debounced input name resolves to an address
if (address) { if (address) {
...@@ -118,9 +125,9 @@ export default function AddressInputPanel({ title, initialInput = '', onChange = ...@@ -118,9 +125,9 @@ export default function AddressInputPanel({ title, initialInput = '', onChange =
} }
} }
}) })
} catch { .catch(() => {
setError(true) setError(true)
} })
} }
} }
......
...@@ -13,6 +13,14 @@ const SummaryWrapper = styled.div` ...@@ -13,6 +13,14 @@ const SummaryWrapper = styled.div`
padding-top: 1rem; padding-top: 1rem;
` `
const Details = styled.div`
background-color: ${({ theme }) => theme.concreteGray};
padding: 1.5rem;
border-radius: 1rem;
font-size: 0.75rem;
margin-top: 1rem;
`
const SummaryWrapperContainer = styled.div` const SummaryWrapperContainer = styled.div`
${({ theme }) => theme.flexRowNoWrap}; ${({ theme }) => theme.flexRowNoWrap};
color: ${({ theme }) => theme.royalBlue}; color: ${({ theme }) => theme.royalBlue};
...@@ -59,7 +67,7 @@ class ContextualInfo extends Component { ...@@ -59,7 +67,7 @@ class ContextualInfo extends Component {
return null return null
} }
return <div className="contextual-info__details">{this.props.renderTransactionDetails()}</div> return <Details>{this.props.renderTransactionDetails()}</Details>
} }
render() { render() {
......
...@@ -95,6 +95,12 @@ const INITIAL_TOKENS_CONTEXT = { ...@@ -95,6 +95,12 @@ const INITIAL_TOKENS_CONTEXT = {
[DECIMALS]: 8, [DECIMALS]: 8,
[EXCHANGE_ADDRESS]: '0x60a87cC7Fca7E53867facB79DA73181B1bB4238B' [EXCHANGE_ADDRESS]: '0x60a87cC7Fca7E53867facB79DA73181B1bB4238B'
}, },
'0x543Ff227F64Aa17eA132Bf9886cAb5DB55DCAddf': {
[NAME]: 'DAOstack',
[SYMBOL]: 'GEN',
[DECIMALS]: 18,
[EXCHANGE_ADDRESS]: '0x26Cc0EAb6Cb650B0Db4D0d0dA8cB5BF69F4ad692'
},
'0x6810e776880C02933D47DB1b9fc05908e5386b96': { '0x6810e776880C02933D47DB1b9fc05908e5386b96': {
[NAME]: 'Gnosis Token', [NAME]: 'Gnosis Token',
[SYMBOL]: 'GNO', [SYMBOL]: 'GNO',
......
...@@ -54,6 +54,10 @@ const NewExchangeWarningText = styled.div` ...@@ -54,6 +54,10 @@ const NewExchangeWarningText = styled.div`
} }
` `
const LastSummaryText = styled.div`
margin-top: 1rem;
`
const DownArrowBackground = styled.div` const DownArrowBackground = styled.div`
${({ theme }) => theme.flexRowNoWrap} ${({ theme }) => theme.flexRowNoWrap}
justify-content: center; justify-content: center;
...@@ -282,7 +286,7 @@ export default function AddLiquidity() { ...@@ -282,7 +286,7 @@ export default function AddLiquidity() {
<div> <div>
{t('youAreAdding')} {b(`${inputValue} ETH`)} {t('and')} {b(`${outputValue} ${symbol}`)} {t('intoPool')} {t('youAreAdding')} {b(`${inputValue} ETH`)} {t('and')} {b(`${outputValue} ${symbol}`)} {t('intoPool')}
</div> </div>
<div> <LastSummaryText>
{t('youAreSettingExRate')}{' '} {t('youAreSettingExRate')}{' '}
{b( {b(
`1 ETH = ${amountFormatter( `1 ETH = ${amountFormatter(
...@@ -293,11 +297,11 @@ export default function AddLiquidity() { ...@@ -293,11 +297,11 @@ export default function AddLiquidity() {
)} ${symbol}` )} ${symbol}`
)} )}
. .
</div> </LastSummaryText>
<div> <LastSummaryText>
{t('youWillMint')} {b(`${inputValue}`)} {t('liquidityTokens')} {t('youWillMint')} {b(`${inputValue}`)} {t('liquidityTokens')}
</div> </LastSummaryText>
<div>{t('totalSupplyIs0')}</div> <LastSummaryText>{t('totalSupplyIs0')}</LastSummaryText>
</div> </div>
) )
} else { } else {
...@@ -307,16 +311,16 @@ export default function AddLiquidity() { ...@@ -307,16 +311,16 @@ export default function AddLiquidity() {
{t('youAreAdding')} {b(`${amountFormatter(inputValueParsed, 18, 4)} ETH`)} {t('and')} {'at most'}{' '} {t('youAreAdding')} {b(`${amountFormatter(inputValueParsed, 18, 4)} ETH`)} {t('and')} {'at most'}{' '}
{b(`${amountFormatter(outputValueMax, decimals, 4)} ${symbol}`)} {t('intoPool')} {b(`${amountFormatter(outputValueMax, decimals, 4)} ${symbol}`)} {t('intoPool')}
</div> </div>
<div> <LastSummaryText>
{t('youWillMint')} {b(amountFormatter(liquidityMinted, 18, 4))} {t('liquidityTokens')} {t('youWillMint')} {b(amountFormatter(liquidityMinted, 18, 4))} {t('liquidityTokens')}
</div> </LastSummaryText>
<div> <LastSummaryText>
{t('totalSupplyIs')} {b(amountFormatter(totalPoolTokens, 18, 4))} {t('totalSupplyIs')} {b(amountFormatter(totalPoolTokens, 18, 4))}
</div> </LastSummaryText>
<div> <LastSummaryText>
{t('tokenWorth')} {b(amountFormatter(ethPerLiquidityToken, 18, 4))} ETH {t('and')}{' '} {t('tokenWorth')} {b(amountFormatter(ethPerLiquidityToken, 18, 4))} ETH {t('and')}{' '}
{b(amountFormatter(tokenPerLiquidityToken, decimals, Math.min(decimals, 4)))} {symbol} {b(amountFormatter(tokenPerLiquidityToken, decimals, Math.min(decimals, 4)))} {symbol}
</div> </LastSummaryText>
</> </>
) )
} }
......
...@@ -65,6 +65,10 @@ const SummaryPanel = styled.div` ...@@ -65,6 +65,10 @@ const SummaryPanel = styled.div`
padding: 1rem 0; padding: 1rem 0;
` `
const LastSummaryText = styled.div`
margin-top: 1rem;
`
const ExchangeRateWrapper = styled.div` const ExchangeRateWrapper = styled.div`
${({ theme }) => theme.flexRowNoWrap}; ${({ theme }) => theme.flexRowNoWrap};
align-items: center; align-items: center;
...@@ -268,19 +272,19 @@ export default function RemoveLiquidity() { ...@@ -268,19 +272,19 @@ export default function RemoveLiquidity() {
return ( return (
<div> <div>
<div> <div>
{t('youAreRemoving')} {b(`${amountFormatter(ethWithdrawnMin, 18, 4)} ETH`)} {t('and')}{' '} {t('youAreRemoving')} {b(`${amountFormatter(ethWithdrawn, 18, 4)} ETH`)} {t('and')}{' '}
{b(`${amountFormatter(tokenWithdrawnMin, decimals, Math.min(decimals, 4))} ${symbol}`)} {t('outPool')} {b(`${amountFormatter(tokenWithdrawn, decimals, Math.min(decimals, 4))} ${symbol}`)} {t('outPool')}
</div> </div>
<div> <LastSummaryText>
{t('youWillRemove')} {b(amountFormatter(valueParsed, 18, 4))} {t('liquidityTokens')} {t('youWillRemove')} {b(amountFormatter(valueParsed, 18, 4))} {t('liquidityTokens')}
</div> </LastSummaryText>
<div> <LastSummaryText>
{t('totalSupplyIs')} {b(amountFormatter(totalPoolTokens, 18, 4))} {t('totalSupplyIs')} {b(amountFormatter(totalPoolTokens, 18, 4))}
</div> </LastSummaryText>
<div> <LastSummaryText>
{t('tokenWorth')} {b(amountFormatter(ETHPer, 18, 4))} ETH {t('and')}{' '} {t('tokenWorth')} {b(amountFormatter(ETHPer, 18, 4))} ETH {t('and')}{' '}
{b(amountFormatter(tokenPer, decimals, Math.min(4, decimals)))} {symbol} {b(amountFormatter(tokenPer, decimals, Math.min(4, decimals)))} {symbol}
</div> </LastSummaryText>
</div> </div>
) )
} }
...@@ -348,17 +352,17 @@ export default function RemoveLiquidity() { ...@@ -348,17 +352,17 @@ export default function RemoveLiquidity() {
</OversizedPanel> </OversizedPanel>
<CurrencyInputPanel <CurrencyInputPanel
title={t('output')} title={t('output')}
description={ethWithdrawnMin && tokenWithdrawnMin ? `(${t('estimated')})` : ''} description={!!(ethWithdrawn && tokenWithdrawn) ? `(${t('estimated')})` : ''}
key="remove-liquidity-input" key="remove-liquidity-input"
renderInput={() => renderInput={() =>
ethWithdrawnMin && tokenWithdrawnMin ? ( !!(ethWithdrawn && tokenWithdrawn) ? (
<RemoveLiquidityOutput> <RemoveLiquidityOutput>
<RemoveLiquidityOutputText> <RemoveLiquidityOutputText>
{`${amountFormatter(ethWithdrawnMin, 18, 4, false)} ETH`} {`${amountFormatter(ethWithdrawn, 18, 4, false)} ETH`}
</RemoveLiquidityOutputText> </RemoveLiquidityOutputText>
<RemoveLiquidityOutputPlus> + </RemoveLiquidityOutputPlus> <RemoveLiquidityOutputPlus> + </RemoveLiquidityOutputPlus>
<RemoveLiquidityOutputText> <RemoveLiquidityOutputText>
{`${amountFormatter(tokenWithdrawnMin, decimals, Math.min(4, decimals))} ${symbol}`} {`${amountFormatter(tokenWithdrawn, decimals, Math.min(4, decimals))} ${symbol}`}
</RemoveLiquidityOutputText> </RemoveLiquidityOutputText>
</RemoveLiquidityOutput> </RemoveLiquidityOutput>
) : ( ) : (
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment