diff --git a/src/components/Exchange.js b/src/components/Exchange.js
index 73aa182a7..911262b6e 100644
--- a/src/components/Exchange.js
+++ b/src/components/Exchange.js
@@ -533,11 +533,11 @@ export default class Exchange extends React.Component {
}
async sendEth(){
- const {
+ const {
ethSendToAddress,
mainnetMetaAccount,
mainnetweb3,
- daiAddress
+ daiAddress
} = this.state;
const {
ethprice,
@@ -724,14 +724,14 @@ export default class Exchange extends React.Component {
let {daiToXdaiMode,ethToDaiMode } = this.state
let ethCancelButton = {
- this.setState({amount:"",ethToDaiMode:false})
+ this.setState({ethToDaiAmount:"",ethToDaiMode:false})
}}>
{i18n.t('cancel')}
let daiCancelButton =
{
- this.setState({amount:"",daiToXdaiMode:false})
+ this.setState({daiToXdaiAmount:"",daiToXdaiMode:false})
}}>
{i18n.t('cancel')}
@@ -795,8 +795,8 @@ export default class Exchange extends React.Component {
type="number"
step="0.1"
placeholder={this.props.currencyDisplay(0)}
- value={this.state.amount}
- onChange={event => this.updateState('amount', event.target.value)} />
+ value={this.state.daiToXdaiAmount}
+ onChange={event => this.updateState('daiToXdaiAmount', event.target.value)} />
{daiCancelButton}
@@ -804,14 +804,14 @@ export default class Exchange extends React.Component {
className={"btn-send"}
disabled={buttonsDisabled}
onClick={()=>{
- let { amount } = this.state;
+ let { daiToXdaiAmount } = this.state;
const { convertCurrency } = this.props;
- console.log("AMOUNT:", amount,"DAI BALANCE:",this.props.daiBalance)
+ console.log("AMOUNT:", daiToXdaiAmount,"DAI BALANCE:",this.props.daiBalance)
this.setState({
daiToXdaiMode:"depositing",
xdaiBalanceAtStart:this.props.xdaiBalance,
- xdaiBalanceShouldBe:parseFloat(this.props.xdaiBalance)+parseFloat(this.state.amount),
+ xdaiBalanceShouldBe:parseFloat(this.props.xdaiBalance)+parseFloat(this.state.daiToXdaiAmount),
loaderBarColor:"#3efff8",
loaderBarStatusText: i18n.t('exchange.calculate_gas_price'),
loaderBarPercent:0,
@@ -822,12 +822,12 @@ export default class Exchange extends React.Component {
})
const displayCurrency = localStorage.getItem("currency");
- amount = convertCurrency(amount, `USD/${displayCurrency}`);
+ let amount = convertCurrency(daiToXdaiAmount, `USD/${displayCurrency}`);
// TODO: depositDai doesn't use the destination parameter anymore
// Remove it.
this.depositDai(null, amount, "Sending funds to bridge...", () => {
this.setState({
- amount:"",
+ daiToXdaiAmount:"",
loaderBarColor:"#4ab3f5",
loaderBarStatusText:"Waiting for bridge...",
loaderBarClick:()=>{
@@ -866,18 +866,18 @@ export default class Exchange extends React.Component {
type="number"
step="0.1"
placeholder={this.props.currencyDisplay(0)}
- value={this.state.amount}
- onChange={event => this.updateState('amount', event.target.value)} />
+ value={this.state.daiToXdaiAmount}
+ onChange={event => this.updateState('daiToXdaiAmount', event.target.value)} />
{daiCancelButton}
{
const { convertCurrency } = this.props;
- let { amount } = this.state;
+ let { daiToXdaiAmount } = this.state;
// First we convert from the current display value and
const displayCurrency = localStorage.getItem("currency");
- amount = convertCurrency(amount, `USD/${displayCurrency}`);
+ let amount = convertCurrency(daiToXdaiAmount, `USD/${displayCurrency}`);
// Then we convert that value to wei
amount = bi(amount * 10 ** 18);
@@ -932,7 +932,7 @@ export default class Exchange extends React.Component {
// noop
}
})
- this.setState({ amount: "", daiToXdaiMode: false });
+ this.setState({ daiToXdaiAmount: "", daiToXdaiMode: false });
this.props.changeAlert({
type: "success",
message: i18n.t("exchange.fast_exit_patience")
@@ -965,7 +965,7 @@ export default class Exchange extends React.Component {
message: i18n.t("exchange.fast_exit_patience")
});
this.setState({
- amount: "",
+ daiToXdaiAmount: "",
daiToXdaiMode: false
});
}).catch(err => {
@@ -1046,15 +1046,15 @@ export default class Exchange extends React.Component {
type="number"
step="0.1"
placeholder={this.props.currencyDisplay(0)}
- value={this.state.amount}
- onChange={event => this.updateState('amount', event.target.value)} />
+ value={this.state.ethToDaiAmount}
+ onChange={event => this.updateState('ethToDaiAmount', event.target.value)} />
{ethCancelButton}
{
console.log("Using uniswap exchange to move ETH to DAI")
const { convertCurrency } = this.props;
- let { amount } = this.state;
+ let { ethToDaiAmount } = this.state;
let webToUse = this.props.web3
if(this.state.mainnetMetaAccount){
@@ -1063,7 +1063,7 @@ export default class Exchange extends React.Component {
// TODO: Error: Returned values aren't valid, did it run Out of Gas?
const displayCurrency = localStorage.getItem("currency");
- amount = convertCurrency(amount, `USD/${displayCurrency}`);
+ let amount = convertCurrency(ethToDaiAmount, `USD/${displayCurrency}`);
console.log("AMOUNT:", amount, "DAI BALANCE:", this.props.daiBalance)
@@ -1115,7 +1115,7 @@ export default class Exchange extends React.Component {
"Sending funds to 🦄 exchange...",
(receipt)=>{
this.setState({
- amount:"",
+ ethToDaiAmount:"",
loaderBarColor:"#4ab3f5",
loaderBarStatusText:"Waiting for 🦄 exchange...",
loaderBarClick:()=>{
@@ -1154,15 +1154,15 @@ export default class Exchange extends React.Component {
type="number"
step="0.1"
placeholder={this.props.currencyDisplay(0)}
- value={this.state.amount}
- onChange={event => this.updateState('amount', event.target.value)} />
+ value={this.state.ethToDaiAmount}
+ onChange={event => this.updateState('ethToDaiAmount', event.target.value)} />
{ethCancelButton}
{
console.log("Using uniswap exchange to move DAI to ETH")
const { convertCurrency } = this.props;
- let { amount } = this.state;
+ let { ethToDaiAmount } = this.state;
let webToUse = this.props.web3
if(this.state.mainnetMetaAccount){
@@ -1170,7 +1170,7 @@ export default class Exchange extends React.Component {
}
const displayCurrency = localStorage.getItem("currency");
- amount = convertCurrency(amount, `USD/${displayCurrency}`);
+ let amount = convertCurrency(ethToDaiAmount, `USD/${displayCurrency}`);
console.log("AMOUNT:", amount, "ETH BALANCE:", this.props.ethBalance)
@@ -1277,7 +1277,7 @@ export default class Exchange extends React.Component {
if(receipt&&receipt.transactionHash&&!metaReceiptTracker[receipt.transactionHash]){
metaReceiptTracker[receipt.transactionHash] = true
this.setState({
- amount:"",
+ ethToDaiAmount:"",
})
}
}).on('error', (err)=>{
@@ -1320,7 +1320,7 @@ export default class Exchange extends React.Component {
if(receipt&&receipt.transactionHash&&!metaReceiptTracker[receipt.transactionHash]){
metaReceiptTracker[receipt.transactionHash] = true
this.setState({
- amount:"",
+ ethToDaiAmount:"",
loaderBarColor:"#4ab3f5",
})
}
@@ -1342,7 +1342,7 @@ export default class Exchange extends React.Component {
//send funds using metamask (or other injected web3 ... should be checked and on mainnet)
this.setState({
- amount:"",
+ ethToDaiAmount:"",
loaderBarColor:"#42ceb2",
loaderBarStatusText:"Approving 🦄 exchange...",
loaderBarClick:()=>{
@@ -1358,7 +1358,7 @@ export default class Exchange extends React.Component {
if(receipt){
console.log("APPROVE COMPLETE?!?",receipt)
this.setState({
- amount:"",
+ ethToDaiAmount:"",
ethBalanceAtStart:this.props.ethBalance,
ethBalanceShouldBe:eventualEthBalance,
loaderBarColor:"#4ab3f5",
@@ -1381,7 +1381,7 @@ export default class Exchange extends React.Component {
})
}else{
this.setState({
- amount:"",
+ ethToDaiAmount:"",
ethBalanceAtStart:this.props.ethBalance,
ethBalanceShouldBe:eventualEthBalance,
loaderBarColor:"#4ab3f5",
@@ -1614,7 +1614,7 @@ export default class Exchange extends React.Component {
)
}
-
+
let sendXdaiButton = (
{sendEthRow}
-
+