|
|
|
@ -17,7 +17,11 @@ import AddRecipient from './send-content/add-recipient'; |
|
|
|
|
import SendContent from './send-content'; |
|
|
|
|
import SendFooter from './send-footer'; |
|
|
|
|
import EnsInput from './send-content/add-recipient/ens-input'; |
|
|
|
|
import { INVALID_RECIPIENT_ADDRESS_ERROR } from './send.constants'; |
|
|
|
|
import { |
|
|
|
|
INVALID_RECIPIENT_ADDRESS_ERROR, |
|
|
|
|
KNOWN_RECIPIENT_ADDRESS_ERROR, |
|
|
|
|
CONTRACT_ADDRESS_ERROR, |
|
|
|
|
} from './send.constants'; |
|
|
|
|
|
|
|
|
|
export default class SendTransactionScreen extends Component { |
|
|
|
|
static propTypes = { |
|
|
|
@ -53,6 +57,7 @@ export default class SendTransactionScreen extends Component { |
|
|
|
|
scanQrCode: PropTypes.func.isRequired, |
|
|
|
|
qrCodeDetected: PropTypes.func.isRequired, |
|
|
|
|
qrCodeData: PropTypes.object, |
|
|
|
|
sendTokenAddress: PropTypes.string, |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
static contextTypes = { |
|
|
|
@ -93,6 +98,7 @@ export default class SendTransactionScreen extends Component { |
|
|
|
|
qrCodeData, |
|
|
|
|
qrCodeDetected, |
|
|
|
|
} = this.props; |
|
|
|
|
const { toError, toWarning } = this.state; |
|
|
|
|
|
|
|
|
|
let updateGas = false; |
|
|
|
|
const { |
|
|
|
@ -187,6 +193,25 @@ export default class SendTransactionScreen extends Component { |
|
|
|
|
this.updateGas(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// If selecting ETH after selecting a token, clear token related messages.
|
|
|
|
|
if (prevSendToken && !sendToken) { |
|
|
|
|
let error = toError; |
|
|
|
|
let warning = toWarning; |
|
|
|
|
|
|
|
|
|
if (toError === CONTRACT_ADDRESS_ERROR) { |
|
|
|
|
error = null; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (toWarning === KNOWN_RECIPIENT_ADDRESS_ERROR) { |
|
|
|
|
warning = null; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
this.setState({ |
|
|
|
|
toError: error, |
|
|
|
|
toWarning: warning, |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
componentDidMount() { |
|
|
|
@ -233,7 +258,7 @@ export default class SendTransactionScreen extends Component { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
validate(query) { |
|
|
|
|
const { tokens, sendToken, network } = this.props; |
|
|
|
|
const { tokens, sendToken, network, sendTokenAddress } = this.props; |
|
|
|
|
|
|
|
|
|
const { internalSearch } = this.state; |
|
|
|
|
|
|
|
|
@ -242,7 +267,7 @@ export default class SendTransactionScreen extends Component { |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
const toErrorObject = getToErrorObject(query, network); |
|
|
|
|
const toErrorObject = getToErrorObject(query, sendTokenAddress, network); |
|
|
|
|
const toWarningObject = getToWarningObject(query, tokens, sendToken); |
|
|
|
|
|
|
|
|
|
this.setState({ |
|
|
|
@ -358,7 +383,7 @@ export default class SendTransactionScreen extends Component { |
|
|
|
|
|
|
|
|
|
renderSendContent() { |
|
|
|
|
const { history, showHexData } = this.props; |
|
|
|
|
const { toWarning } = this.state; |
|
|
|
|
const { toWarning, toError } = this.state; |
|
|
|
|
|
|
|
|
|
return [ |
|
|
|
|
<SendContent |
|
|
|
@ -368,6 +393,7 @@ export default class SendTransactionScreen extends Component { |
|
|
|
|
} |
|
|
|
|
showHexData={showHexData} |
|
|
|
|
warning={toWarning} |
|
|
|
|
error={toError} |
|
|
|
|
/>, |
|
|
|
|
<SendFooter key="send-footer" history={history} />, |
|
|
|
|
]; |
|
|
|
|