2020-10-19 09:39:07 +00:00
import QtQuick 2.13
import QtQuick . Controls 2.13
import QtQuick . Layouts 1.13
2021-09-28 15:04:06 +00:00
import utils 1.0
2021-10-14 12:28:35 +00:00
import "../"
import "../panels"
2020-10-19 09:39:07 +00:00
Item {
id: root
anchors.left: parent . left
anchors.right: parent . right
2022-04-04 11:26:30 +00:00
property string sendToContractWarningMessage: qsTr ( "Tokens will be sent directly to a contract address, which may result in a loss of funds. To transfer ERC-20 tokens, ensure the recipient address is the address of the destination wallet." )
2020-10-19 09:39:07 +00:00
property var selectedRecipient
property bool isValid: true
onSelectedRecipientChanged: validate ( )
function validate ( ) {
let isValid = true
if ( ! ( selectedRecipient && selectedRecipient . address ) ) {
return root . isValid
}
txtValidationError . text = ""
2021-12-13 14:24:21 +00:00
// Not Refactored Yet
// if (walletModel.tokensView.isKnownTokenContract(selectedRecipient.address)) {
// // do not set isValid = false here because it would make the
// // TransactionStackGroup invalid and therefore not let the user
// // continue in the modal
// txtValidationError.text = sendToContractWarningMessage
// }
2020-10-19 09:39:07 +00:00
return isValid
}
Column {
id: colValidation
anchors.horizontalCenter: parent . horizontalCenter
visible: txtValidationError . text !== ""
spacing: 5
SVGImage {
id: imgExclamation
width: 13.33
height: 13.33
sourceSize.height: height * 2
sourceSize.width: width * 2
anchors.horizontalCenter: parent . horizontalCenter
fillMode: Image . PreserveAspectFit
2021-10-05 20:50:22 +00:00
source: Style . svg ( "exclamation_outline" )
2020-10-19 09:39:07 +00:00
}
StyledText {
id: txtValidationError
text: ""
width: root . width
verticalAlignment: Text . AlignVCenter
horizontalAlignment: Text . AlignHCenter
font.pixelSize: 13
color: Style . current . danger
lineHeight: 18
lineHeightMode: Text . FixedHeight
wrapMode: Text . WordWrap
}
}
}