status-desktop/ui/shared/SendToContractWarning.qml

64 lines
2.2 KiB
QML
Raw Normal View History

import QtQuick 2.13
import QtQuick.Controls 2.13
import QtQuick.Layouts 1.13
import utils 1.0
import "./"
Item {
id: root
anchors.left: parent.left
anchors.right: parent.right
2021-02-18 16:36:05 +00:00
//% "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."
property string sendToContractWarningMessage: qsTrId("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-")
property var selectedRecipient
property bool isValid: true
onSelectedRecipientChanged: validate()
function validate() {
let isValid = true
if (!(selectedRecipient && selectedRecipient.address)) {
return root.isValid
}
txtValidationError.text = ""
refactor wallet views add getSettings methods to src/status fix issue with calling getSettings; document issue remove most direct references to libstatus; document some common issues remove most references to libstatus wallet add mailserver layer to status lib; remove references to libstatus mailservers remove libstatus accounts references move types out of libstatus; remove libstatus types references remove libstatus browser references refactor libstatus utils references remove more references to libstatus stickers remove references to libstatus constants from src/app remove more libstatus references from src/app refactor token_list usage of libstatus refactor stickers usage of libstatus refactor chat usage of libstatus remove libstatus references from the wallet view remove logic from ens manager view fix issue with import & namespace conflict remove unnecessary imports refactor provider view to not depend on libstatus refactor provider view refactor: move accounts specific code to its own section fix account selection move collectibles to their own module update references to wallet transactions refactor: move gas methods to their own file refactor: extract tokens into their own file refactor: extract ens to its own file refactor: extract dappbrowser code to its own file refactor: extract history related code to its own file refactor: extract balance to its own file refactor: extract utils to its own file clean up wallet imports fix: identicon for transaction commands Fixes #2533
2021-06-08 12:48:31 +00:00
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
}
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
source: Style.svg("exclamation_outline")
}
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
}
}
}