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