mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-11-22 01:47:00 +01:00
Enable the Token Allowance flow by default for all users (#16740)
This commit is contained in:
parent
af83e120dc
commit
f988dc1c5e
@ -6,7 +6,6 @@ SWAPS_USE_DEV_APIS=
|
||||
NFTS_V1=
|
||||
PUBNUB_PUB_KEY=
|
||||
PUBNUB_SUB_KEY=
|
||||
TOKEN_ALLOWANCE_IMPROVEMENTS=
|
||||
PORTFOLIO_URL=
|
||||
TRANSACTION_SECURITY_PROVIDER=
|
||||
|
||||
|
4
app/_locales/ar/messages.json
generated
4
app/_locales/ar/messages.json
generated
@ -12,10 +12,6 @@
|
||||
"message": "لقد قرأت دولار واحد وأوافق عليه",
|
||||
"description": "$1 is the `terms` message"
|
||||
},
|
||||
"accessAndSpendNotice": {
|
||||
"message": "$1 يمكن الوصول إلى هذا المبلغ الأقصى وإنفاقه حتى",
|
||||
"description": "$1 is the url of the site requesting ability to spend"
|
||||
},
|
||||
"accessingYourCamera": {
|
||||
"message": "جاري استخدام كاميرتك..."
|
||||
},
|
||||
|
22
app/_locales/de/messages.json
generated
22
app/_locales/de/messages.json
generated
@ -110,10 +110,6 @@
|
||||
"message": "Ich habe die $1 gelesen und stimme ihnen zu",
|
||||
"description": "$1 is the `terms` message"
|
||||
},
|
||||
"accessAndSpendNotice": {
|
||||
"message": "$1 kann bis zu diesem maximalen Betrag abrufen und ausgeben",
|
||||
"description": "$1 is the url of the site requesting ability to spend"
|
||||
},
|
||||
"accessAndSpendNoticeNFT": {
|
||||
"message": "$1 kann auf dieses Asset zugreifen und es ausgeben",
|
||||
"description": "$1 is the url of the site requesting ability to spend"
|
||||
@ -388,9 +384,6 @@
|
||||
"approved": {
|
||||
"message": "Genehmigt"
|
||||
},
|
||||
"approvedAmountWithColon": {
|
||||
"message": "Genehmigter Betrag:"
|
||||
},
|
||||
"approvedAsset": {
|
||||
"message": "Genehmigtes Asset"
|
||||
},
|
||||
@ -1709,12 +1702,6 @@
|
||||
"message": "Importiert",
|
||||
"description": "status showing that an account has been fully loaded into the keyring"
|
||||
},
|
||||
"improvedTokenAllowance": {
|
||||
"message": "Verbesserte Erfahrung mit der Token-Erlaubnis"
|
||||
},
|
||||
"improvedTokenAllowanceDescription": {
|
||||
"message": "Aktivieren Sie diese Option, um die verbesserte Token-Erlaubnis zu erhalten, wenn ein Dapp eine ERC20-Genehmigung anfordert."
|
||||
},
|
||||
"inYourSettings": {
|
||||
"message": "in Ihren Einstellungen"
|
||||
},
|
||||
@ -2398,15 +2385,6 @@
|
||||
"notifications15Title": {
|
||||
"message": "Ethereum Merge ist da!"
|
||||
},
|
||||
"notifications16ActionText": {
|
||||
"message": "Hier ausprobieren"
|
||||
},
|
||||
"notifications16Description": {
|
||||
"message": "Wir haben unsere Token-Bestätigung neu gestaltet, um Ihnen zu helfen, fundiertere Entscheidungen zu treffen."
|
||||
},
|
||||
"notifications16Title": {
|
||||
"message": "Verbesserte Erfahrung mit der Token-Erlaubnis"
|
||||
},
|
||||
"notifications17ActionText": {
|
||||
"message": "Sicherheits- und Datenschutzeinstellungen anzeigen"
|
||||
},
|
||||
|
22
app/_locales/el/messages.json
generated
22
app/_locales/el/messages.json
generated
@ -110,10 +110,6 @@
|
||||
"message": "Έχω διαβάσει και συμφωνώ με το $1",
|
||||
"description": "$1 is the `terms` message"
|
||||
},
|
||||
"accessAndSpendNotice": {
|
||||
"message": "$1 μπορεί να έχει πρόσβαση και να ξοδέψει μέχρι αυτό το μέγιστο ποσό",
|
||||
"description": "$1 is the url of the site requesting ability to spend"
|
||||
},
|
||||
"accessAndSpendNoticeNFT": {
|
||||
"message": "Το $1 ίσως αποκτήσει πρόσβαση και δαπανήσει αυτό το περιουσιακό στοιχείο",
|
||||
"description": "$1 is the url of the site requesting ability to spend"
|
||||
@ -388,9 +384,6 @@
|
||||
"approved": {
|
||||
"message": "Εγκρίθηκε"
|
||||
},
|
||||
"approvedAmountWithColon": {
|
||||
"message": "Εγκεκριμένο ποσό:"
|
||||
},
|
||||
"approvedAsset": {
|
||||
"message": "Εγκεκριμένο περιουσιακό στοιχείο"
|
||||
},
|
||||
@ -1709,12 +1702,6 @@
|
||||
"message": "Έγινε εισαγωγή",
|
||||
"description": "status showing that an account has been fully loaded into the keyring"
|
||||
},
|
||||
"improvedTokenAllowance": {
|
||||
"message": "Βελτιωμένη εμπειρία χορήγησης tokens"
|
||||
},
|
||||
"improvedTokenAllowanceDescription": {
|
||||
"message": "Ενεργοποιήστε το για να μεταβείτε στη βελτιωμένη εμπειρία χορήγησης tokens κάθε φορά που μια αποκεντρωμένη εφαρμογή ζητά έγκριση ERC20"
|
||||
},
|
||||
"inYourSettings": {
|
||||
"message": "στις Ρυθμίσεις σας"
|
||||
},
|
||||
@ -2398,15 +2385,6 @@
|
||||
"notifications15Title": {
|
||||
"message": "Η συγχώνευση στο Ethereum είναι εδώ!"
|
||||
},
|
||||
"notifications16ActionText": {
|
||||
"message": "Δοκιμάστε το εδώ"
|
||||
},
|
||||
"notifications16Description": {
|
||||
"message": "Επανασχεδιάσαμε την επιβεβαίωση χορήγησης tokens για να σας βοηθήσουμε να λάβετε πιο συνειδητές αποφάσεις."
|
||||
},
|
||||
"notifications16Title": {
|
||||
"message": "Βελτιωμένη εμπειρία χορήγησης tokens"
|
||||
},
|
||||
"notifications17ActionText": {
|
||||
"message": "Εμφάνιση ρυθμίσεων Ασφάλειας & Απορρήτου"
|
||||
},
|
||||
|
22
app/_locales/en/messages.json
generated
22
app/_locales/en/messages.json
generated
@ -110,10 +110,6 @@
|
||||
"message": "I have read and agree to the $1",
|
||||
"description": "$1 is the `terms` message"
|
||||
},
|
||||
"accessAndSpendNotice": {
|
||||
"message": "$1 may access and spend up to this max amount",
|
||||
"description": "$1 is the url of the site requesting ability to spend"
|
||||
},
|
||||
"accessAndSpendNoticeNFT": {
|
||||
"message": "$1 may access and spend this asset",
|
||||
"description": "$1 is the url of the site requesting ability to spend"
|
||||
@ -388,9 +384,6 @@
|
||||
"approved": {
|
||||
"message": "Approved"
|
||||
},
|
||||
"approvedAmountWithColon": {
|
||||
"message": "Approved amount:"
|
||||
},
|
||||
"approvedAsset": {
|
||||
"message": "Approved asset"
|
||||
},
|
||||
@ -1722,12 +1715,6 @@
|
||||
"message": "Imported",
|
||||
"description": "status showing that an account has been fully loaded into the keyring"
|
||||
},
|
||||
"improvedTokenAllowance": {
|
||||
"message": "Improved token allowance experience"
|
||||
},
|
||||
"improvedTokenAllowanceDescription": {
|
||||
"message": "Turn this on to go through the improved token allowance experience whenever a dapp requests an ERC20 approve"
|
||||
},
|
||||
"inYourSettings": {
|
||||
"message": "in your Settings"
|
||||
},
|
||||
@ -2420,15 +2407,6 @@
|
||||
"notifications15Title": {
|
||||
"message": "The Ethereum Merge is here!"
|
||||
},
|
||||
"notifications16ActionText": {
|
||||
"message": "Try it out here"
|
||||
},
|
||||
"notifications16Description": {
|
||||
"message": "We redesigned our token allowance confirmation to help you make more informed decisions."
|
||||
},
|
||||
"notifications16Title": {
|
||||
"message": "Improved token allowance experience"
|
||||
},
|
||||
"notifications17ActionText": {
|
||||
"message": "Show Security & Privacy settings"
|
||||
},
|
||||
|
22
app/_locales/es/messages.json
generated
22
app/_locales/es/messages.json
generated
@ -110,10 +110,6 @@
|
||||
"message": "Leí y estoy de acuerdo con $1",
|
||||
"description": "$1 is the `terms` message"
|
||||
},
|
||||
"accessAndSpendNotice": {
|
||||
"message": "$1 puede acceder y gastar hasta este importe máximo",
|
||||
"description": "$1 is the url of the site requesting ability to spend"
|
||||
},
|
||||
"accessAndSpendNoticeNFT": {
|
||||
"message": "$1 puede acceder y gastar este activo",
|
||||
"description": "$1 is the url of the site requesting ability to spend"
|
||||
@ -388,9 +384,6 @@
|
||||
"approved": {
|
||||
"message": "Aprobado"
|
||||
},
|
||||
"approvedAmountWithColon": {
|
||||
"message": "Monto aprobado:"
|
||||
},
|
||||
"approvedAsset": {
|
||||
"message": "Activo aprobado"
|
||||
},
|
||||
@ -1709,12 +1702,6 @@
|
||||
"message": "Importado",
|
||||
"description": "status showing that an account has been fully loaded into the keyring"
|
||||
},
|
||||
"improvedTokenAllowance": {
|
||||
"message": "Experiencia mejorada de asignación de tokens"
|
||||
},
|
||||
"improvedTokenAllowanceDescription": {
|
||||
"message": "Actívelo para pasar por la experiencia de asignación de token mejorada cada vez que una dapp solicite una aprobación ERC20"
|
||||
},
|
||||
"inYourSettings": {
|
||||
"message": "en su Configuración"
|
||||
},
|
||||
@ -2398,15 +2385,6 @@
|
||||
"notifications15Title": {
|
||||
"message": "¡La Fusión de Ethereum está aquí!"
|
||||
},
|
||||
"notifications16ActionText": {
|
||||
"message": "Inténtelo aquí"
|
||||
},
|
||||
"notifications16Description": {
|
||||
"message": "Rediseñamos nuestra confirmación de asignación de tokens para ayudarlo a tomar decisiones más informadas."
|
||||
},
|
||||
"notifications16Title": {
|
||||
"message": "Experiencia mejorada de asignación de tokens"
|
||||
},
|
||||
"notifications17ActionText": {
|
||||
"message": "Mostrar configuración de seguridad y privacidad"
|
||||
},
|
||||
|
7
app/_locales/es_419/messages.json
generated
7
app/_locales/es_419/messages.json
generated
@ -51,10 +51,6 @@
|
||||
"message": "Leí y estoy de acuerdo con $1",
|
||||
"description": "$1 is the `terms` message"
|
||||
},
|
||||
"accessAndSpendNotice": {
|
||||
"message": "$1 puede acceder y gastar hasta este importe máximo",
|
||||
"description": "$1 is the url of the site requesting ability to spend"
|
||||
},
|
||||
"accessingYourCamera": {
|
||||
"message": "Accediendo a la cámara..."
|
||||
},
|
||||
@ -237,9 +233,6 @@
|
||||
"approved": {
|
||||
"message": "Aprobado"
|
||||
},
|
||||
"approvedAmountWithColon": {
|
||||
"message": "Monto aprobado:"
|
||||
},
|
||||
"asset": {
|
||||
"message": "Activo"
|
||||
},
|
||||
|
22
app/_locales/fr/messages.json
generated
22
app/_locales/fr/messages.json
generated
@ -110,10 +110,6 @@
|
||||
"message": "J’ai lu et j’accepte les $1",
|
||||
"description": "$1 is the `terms` message"
|
||||
},
|
||||
"accessAndSpendNotice": {
|
||||
"message": "$1 peut accéder et dépenser jusqu’à ce montant maximal",
|
||||
"description": "$1 is the url of the site requesting ability to spend"
|
||||
},
|
||||
"accessAndSpendNoticeNFT": {
|
||||
"message": "$1 peut accéder à cet actif et le dépenser",
|
||||
"description": "$1 is the url of the site requesting ability to spend"
|
||||
@ -388,9 +384,6 @@
|
||||
"approved": {
|
||||
"message": "Approuvé"
|
||||
},
|
||||
"approvedAmountWithColon": {
|
||||
"message": "Montant approuvé :"
|
||||
},
|
||||
"approvedAsset": {
|
||||
"message": "Actif approuvé"
|
||||
},
|
||||
@ -1709,12 +1702,6 @@
|
||||
"message": "Importé",
|
||||
"description": "status showing that an account has been fully loaded into the keyring"
|
||||
},
|
||||
"improvedTokenAllowance": {
|
||||
"message": "Amélioration du processus d’approbation des jetons"
|
||||
},
|
||||
"improvedTokenAllowanceDescription": {
|
||||
"message": "Activez cette option si vous voulez lancer le processus amélioré d’approbation des jetons chaque fois qu’une dApp demande l’approbation de jetons ERC20"
|
||||
},
|
||||
"inYourSettings": {
|
||||
"message": "dans vos paramètres"
|
||||
},
|
||||
@ -2398,15 +2385,6 @@
|
||||
"notifications15Title": {
|
||||
"message": "La fusion Ethereum est en marche !"
|
||||
},
|
||||
"notifications16ActionText": {
|
||||
"message": "Essayez-le"
|
||||
},
|
||||
"notifications16Description": {
|
||||
"message": "Nous avons amélioré le processus d’approbation des jetons pour vous aider à prendre des décisions plus éclairées."
|
||||
},
|
||||
"notifications16Title": {
|
||||
"message": "Amélioration du processus d’approbation des jetons"
|
||||
},
|
||||
"notifications17ActionText": {
|
||||
"message": "Afficher les paramètres de sécurité et de confidentialité"
|
||||
},
|
||||
|
22
app/_locales/hi/messages.json
generated
22
app/_locales/hi/messages.json
generated
@ -110,10 +110,6 @@
|
||||
"message": "मैंने $1 पढ़ लिया है और मैं सहमत हूं",
|
||||
"description": "$1 is the `terms` message"
|
||||
},
|
||||
"accessAndSpendNotice": {
|
||||
"message": "$1 इस अधिकतम राशि तक पहुंच सकते हैं और खर्च कर सकते हैं",
|
||||
"description": "$1 is the url of the site requesting ability to spend"
|
||||
},
|
||||
"accessAndSpendNoticeNFT": {
|
||||
"message": "$1 एक्सेस कर सकता है और इस एसेट को खर्च कर सकता है",
|
||||
"description": "$1 is the url of the site requesting ability to spend"
|
||||
@ -388,9 +384,6 @@
|
||||
"approved": {
|
||||
"message": "अनुमोदित"
|
||||
},
|
||||
"approvedAmountWithColon": {
|
||||
"message": "स्वीकृत राशि:"
|
||||
},
|
||||
"approvedAsset": {
|
||||
"message": "स्वीकृत एसेट"
|
||||
},
|
||||
@ -1709,12 +1702,6 @@
|
||||
"message": "आयातित",
|
||||
"description": "status showing that an account has been fully loaded into the keyring"
|
||||
},
|
||||
"improvedTokenAllowance": {
|
||||
"message": "बेहतर टोकन भत्ता अनुभव"
|
||||
},
|
||||
"improvedTokenAllowanceDescription": {
|
||||
"message": "जब भी कोई डैप ERC20 स्वीकृति का अनुरोध करता है तो बेहतर टोकन भत्ता अनुभव प्राप्त करने के लिए इसे चालू करें"
|
||||
},
|
||||
"inYourSettings": {
|
||||
"message": "आपके सेटिंग्स में"
|
||||
},
|
||||
@ -2398,15 +2385,6 @@
|
||||
"notifications15Title": {
|
||||
"message": "इथेरियम मर्ज यहाँ है!"
|
||||
},
|
||||
"notifications16ActionText": {
|
||||
"message": "इसे यहां आजमाएं"
|
||||
},
|
||||
"notifications16Description": {
|
||||
"message": "अधिक सूचित निर्णय लेने में आपकी सहायता करने के लिए हमने अपने टोकन भत्ता पुष्टिकरण को फिर से डिजाइन किया।"
|
||||
},
|
||||
"notifications16Title": {
|
||||
"message": "बेहतर टोकन भत्ता अनुभव"
|
||||
},
|
||||
"notifications17ActionText": {
|
||||
"message": "सुरक्षा और गोपनीयता सेटिंग्स को दिखाएं"
|
||||
},
|
||||
|
22
app/_locales/id/messages.json
generated
22
app/_locales/id/messages.json
generated
@ -110,10 +110,6 @@
|
||||
"message": "Saya telah membaca dan menyetujui $1",
|
||||
"description": "$1 is the `terms` message"
|
||||
},
|
||||
"accessAndSpendNotice": {
|
||||
"message": "$1 dapat diakses dan digunakan hingga jumlah maksimum ini",
|
||||
"description": "$1 is the url of the site requesting ability to spend"
|
||||
},
|
||||
"accessAndSpendNoticeNFT": {
|
||||
"message": "$1 dapat mengakses dan membelanjakan aset ini",
|
||||
"description": "$1 is the url of the site requesting ability to spend"
|
||||
@ -388,9 +384,6 @@
|
||||
"approved": {
|
||||
"message": "Disetujui"
|
||||
},
|
||||
"approvedAmountWithColon": {
|
||||
"message": "Jumlah yang disetujui:"
|
||||
},
|
||||
"approvedAsset": {
|
||||
"message": "Aset yang disetujui"
|
||||
},
|
||||
@ -1709,12 +1702,6 @@
|
||||
"message": "Diimpor",
|
||||
"description": "status showing that an account has been fully loaded into the keyring"
|
||||
},
|
||||
"improvedTokenAllowance": {
|
||||
"message": "Peningkatan pengalaman tunjangan token"
|
||||
},
|
||||
"improvedTokenAllowanceDescription": {
|
||||
"message": "Aktifkan ini untuk memperoleh peningkatan pengalaman tunjangan token setiap kali aplikasi terdesentralisasi (dapp) meminta persetujuan ERC20"
|
||||
},
|
||||
"inYourSettings": {
|
||||
"message": "di Pengaturan Anda"
|
||||
},
|
||||
@ -2398,15 +2385,6 @@
|
||||
"notifications15Title": {
|
||||
"message": "Penggabungan Ethereum telah tiba!"
|
||||
},
|
||||
"notifications16ActionText": {
|
||||
"message": "Cobalah di sini"
|
||||
},
|
||||
"notifications16Description": {
|
||||
"message": "Kami mendesain ulang konfirmasi tunjangan token kami untuk membantu Anda membuat keputusan yang lebih tepat."
|
||||
},
|
||||
"notifications16Title": {
|
||||
"message": "Peningkatan pengalaman tunjangan token"
|
||||
},
|
||||
"notifications17ActionText": {
|
||||
"message": "Tampilkan pengaturan Keamanan & Privasi"
|
||||
},
|
||||
|
7
app/_locales/it/messages.json
generated
7
app/_locales/it/messages.json
generated
@ -92,10 +92,6 @@
|
||||
"message": "Ho letto e accetto i $1",
|
||||
"description": "$1 is the `terms` message"
|
||||
},
|
||||
"accessAndSpendNotice": {
|
||||
"message": "$1 può avere accesso e spendere al massimo",
|
||||
"description": "$1 is the url of the site requesting ability to spend"
|
||||
},
|
||||
"accessAndSpendNoticeNFT": {
|
||||
"message": "$1 può accedere e spendere questa risorsa",
|
||||
"description": "$1 is the url of the site requesting ability to spend"
|
||||
@ -316,9 +312,6 @@
|
||||
"approved": {
|
||||
"message": "Approvato"
|
||||
},
|
||||
"approvedAmountWithColon": {
|
||||
"message": "Importo approvato:"
|
||||
},
|
||||
"approvedAsset": {
|
||||
"message": "Asset approvato"
|
||||
},
|
||||
|
22
app/_locales/ja/messages.json
generated
22
app/_locales/ja/messages.json
generated
@ -110,10 +110,6 @@
|
||||
"message": "$1を読んで同意しました",
|
||||
"description": "$1 is the `terms` message"
|
||||
},
|
||||
"accessAndSpendNotice": {
|
||||
"message": "$1はアクセスしてこの最大量まで消費できます",
|
||||
"description": "$1 is the url of the site requesting ability to spend"
|
||||
},
|
||||
"accessAndSpendNoticeNFT": {
|
||||
"message": "$1 はこのアセットにアクセスし、使用できます",
|
||||
"description": "$1 is the url of the site requesting ability to spend"
|
||||
@ -388,9 +384,6 @@
|
||||
"approved": {
|
||||
"message": "承認済み"
|
||||
},
|
||||
"approvedAmountWithColon": {
|
||||
"message": "承認された金額:"
|
||||
},
|
||||
"approvedAsset": {
|
||||
"message": "承認済みのアセット"
|
||||
},
|
||||
@ -1709,12 +1702,6 @@
|
||||
"message": "インポート済み",
|
||||
"description": "status showing that an account has been fully loaded into the keyring"
|
||||
},
|
||||
"improvedTokenAllowance": {
|
||||
"message": "改善されたトークンの許可設定"
|
||||
},
|
||||
"improvedTokenAllowanceDescription": {
|
||||
"message": "これをオンにすると、DApp が ERC20 の承認を求めた際に、改善されたトークン許可設定が利用できます"
|
||||
},
|
||||
"inYourSettings": {
|
||||
"message": "設定で"
|
||||
},
|
||||
@ -2398,15 +2385,6 @@
|
||||
"notifications15Title": {
|
||||
"message": "Ethereum のマージ (Merge) が完了しました!"
|
||||
},
|
||||
"notifications16ActionText": {
|
||||
"message": "こちらでお試しください"
|
||||
},
|
||||
"notifications16Description": {
|
||||
"message": "より多くの情報に基づき決定を下せるよう、トークン許可設定の確認のデザインを変更しました。"
|
||||
},
|
||||
"notifications16Title": {
|
||||
"message": "改善されたトークン許可設定"
|
||||
},
|
||||
"notifications17ActionText": {
|
||||
"message": "セキュリティおよびプライバシー設定を表示"
|
||||
},
|
||||
|
22
app/_locales/ko/messages.json
generated
22
app/_locales/ko/messages.json
generated
@ -110,10 +110,6 @@
|
||||
"message": "$1의 내용을 읽고 이에 동의합니다.",
|
||||
"description": "$1 is the `terms` message"
|
||||
},
|
||||
"accessAndSpendNotice": {
|
||||
"message": "$1의 경우, 이 최대 금액까지 액세스 및 지출할 수 있습니다.",
|
||||
"description": "$1 is the url of the site requesting ability to spend"
|
||||
},
|
||||
"accessAndSpendNoticeNFT": {
|
||||
"message": "$1(은)는 이 자산에 접근하여 사용할 수 있습니다",
|
||||
"description": "$1 is the url of the site requesting ability to spend"
|
||||
@ -388,9 +384,6 @@
|
||||
"approved": {
|
||||
"message": "승인됨"
|
||||
},
|
||||
"approvedAmountWithColon": {
|
||||
"message": "승인 금액:"
|
||||
},
|
||||
"approvedAsset": {
|
||||
"message": "승인된 자산"
|
||||
},
|
||||
@ -1709,12 +1702,6 @@
|
||||
"message": "가져옴",
|
||||
"description": "status showing that an account has been fully loaded into the keyring"
|
||||
},
|
||||
"improvedTokenAllowance": {
|
||||
"message": "토큰 허용 기능이 개선되었습니다"
|
||||
},
|
||||
"improvedTokenAllowanceDescription": {
|
||||
"message": "Dapp에서 ERC20 승인을 요청할 때마다 이 기능을 켜시면 토큰 허용 기능을 이용할 수 있습니다"
|
||||
},
|
||||
"inYourSettings": {
|
||||
"message": "설정에서"
|
||||
},
|
||||
@ -2398,15 +2385,6 @@
|
||||
"notifications15Title": {
|
||||
"message": "이더리움 머지가 완료되었습니다!"
|
||||
},
|
||||
"notifications16ActionText": {
|
||||
"message": "여기서 체험하세요"
|
||||
},
|
||||
"notifications16Description": {
|
||||
"message": "토큰 허용 확인 과정을 재설계하여 사용자가 정보에 의한 결정을 할 수 있도록 하였습니다."
|
||||
},
|
||||
"notifications16Title": {
|
||||
"message": "토큰 허용 경험 개선됨"
|
||||
},
|
||||
"notifications17ActionText": {
|
||||
"message": "보안 및 개인정보 설정 표시"
|
||||
},
|
||||
|
4
app/_locales/ph/messages.json
generated
4
app/_locales/ph/messages.json
generated
@ -6,10 +6,6 @@
|
||||
"message": "Nabasa ko at sumasang-ayon ako sa $1",
|
||||
"description": "$1 is the `terms` message"
|
||||
},
|
||||
"accessAndSpendNotice": {
|
||||
"message": "Maaaring i-access ng $1 ang max na halagang ito at gumastos hanggang sa max na halagang ito",
|
||||
"description": "$1 is the url of the site requesting ability to spend"
|
||||
},
|
||||
"accessingYourCamera": {
|
||||
"message": "Ina-access ang iyong camera..."
|
||||
},
|
||||
|
22
app/_locales/pt/messages.json
generated
22
app/_locales/pt/messages.json
generated
@ -110,10 +110,6 @@
|
||||
"message": "Eu li e concordo com os $1",
|
||||
"description": "$1 is the `terms` message"
|
||||
},
|
||||
"accessAndSpendNotice": {
|
||||
"message": "$1 pode acessar e gastar até esse valor máximo",
|
||||
"description": "$1 is the url of the site requesting ability to spend"
|
||||
},
|
||||
"accessAndSpendNoticeNFT": {
|
||||
"message": "$1 pode(m) acessar e usar esse ativo",
|
||||
"description": "$1 is the url of the site requesting ability to spend"
|
||||
@ -388,9 +384,6 @@
|
||||
"approved": {
|
||||
"message": "Aprovado"
|
||||
},
|
||||
"approvedAmountWithColon": {
|
||||
"message": "Valor aprovado:"
|
||||
},
|
||||
"approvedAsset": {
|
||||
"message": "Ativo aprovado"
|
||||
},
|
||||
@ -1709,12 +1702,6 @@
|
||||
"message": "Importado",
|
||||
"description": "status showing that an account has been fully loaded into the keyring"
|
||||
},
|
||||
"improvedTokenAllowance": {
|
||||
"message": "Experiência aprimorada nas permissões de tokens"
|
||||
},
|
||||
"improvedTokenAllowanceDescription": {
|
||||
"message": "Ative para ter a experiência aprimorada nas permissões de tokens sempre que um dapp solicitar uma aprovação de ERC20"
|
||||
},
|
||||
"inYourSettings": {
|
||||
"message": "em suas Configurações"
|
||||
},
|
||||
@ -2398,15 +2385,6 @@
|
||||
"notifications15Title": {
|
||||
"message": "A fusão do Ethereum chegou!"
|
||||
},
|
||||
"notifications16ActionText": {
|
||||
"message": "Teste aqui"
|
||||
},
|
||||
"notifications16Description": {
|
||||
"message": "Reprojetamos nossa confirmação de permissões de token para ajudar você a tomar decisões mais informadas."
|
||||
},
|
||||
"notifications16Title": {
|
||||
"message": "Experiência aprimorada nas permissões de tokens"
|
||||
},
|
||||
"notifications17ActionText": {
|
||||
"message": "Mostrar configurações de segurança e privacidade"
|
||||
},
|
||||
|
7
app/_locales/pt_BR/messages.json
generated
7
app/_locales/pt_BR/messages.json
generated
@ -51,10 +51,6 @@
|
||||
"message": "Eu li e concordo com os $1",
|
||||
"description": "$1 is the `terms` message"
|
||||
},
|
||||
"accessAndSpendNotice": {
|
||||
"message": "$1 pode acessar e gastar até esse valor máximo",
|
||||
"description": "$1 is the url of the site requesting ability to spend"
|
||||
},
|
||||
"accessingYourCamera": {
|
||||
"message": "Acessando sua câmera..."
|
||||
},
|
||||
@ -237,9 +233,6 @@
|
||||
"approved": {
|
||||
"message": "Aprovado"
|
||||
},
|
||||
"approvedAmountWithColon": {
|
||||
"message": "Valor aprovado:"
|
||||
},
|
||||
"asset": {
|
||||
"message": "Ativo"
|
||||
},
|
||||
|
22
app/_locales/ru/messages.json
generated
22
app/_locales/ru/messages.json
generated
@ -110,10 +110,6 @@
|
||||
"message": "Я прочитал(-а) $1 и согласен(-на) с ними",
|
||||
"description": "$1 is the `terms` message"
|
||||
},
|
||||
"accessAndSpendNotice": {
|
||||
"message": "$1 может получить доступ и потратить до этой максимальной суммы",
|
||||
"description": "$1 is the url of the site requesting ability to spend"
|
||||
},
|
||||
"accessAndSpendNoticeNFT": {
|
||||
"message": "$1 может получить доступ к этому активу и потратить его",
|
||||
"description": "$1 is the url of the site requesting ability to spend"
|
||||
@ -388,9 +384,6 @@
|
||||
"approved": {
|
||||
"message": "Одобрен"
|
||||
},
|
||||
"approvedAmountWithColon": {
|
||||
"message": "Одобренная сумма:"
|
||||
},
|
||||
"approvedAsset": {
|
||||
"message": "Одобренный актив"
|
||||
},
|
||||
@ -1709,12 +1702,6 @@
|
||||
"message": "Импортирован",
|
||||
"description": "status showing that an account has been fully loaded into the keyring"
|
||||
},
|
||||
"improvedTokenAllowance": {
|
||||
"message": "Улучшенный опыт предоставления токенов"
|
||||
},
|
||||
"improvedTokenAllowanceDescription": {
|
||||
"message": "Включите этот параметр, чтобы воспользоваться улучшенным доступом к токенам всякий раз, когда децентрализованное приложение запрашивает одобрение ERC20."
|
||||
},
|
||||
"inYourSettings": {
|
||||
"message": "в ваших Настройках"
|
||||
},
|
||||
@ -2398,15 +2385,6 @@
|
||||
"notifications15Title": {
|
||||
"message": "Ethereum Merge уже досутпно!"
|
||||
},
|
||||
"notifications16ActionText": {
|
||||
"message": "Попробуйте это здесь"
|
||||
},
|
||||
"notifications16Description": {
|
||||
"message": "Мы переработали наше подтверждение допустимых токенов, чтобы помочь вам принимать более обоснованные решения."
|
||||
},
|
||||
"notifications16Title": {
|
||||
"message": "Улучшенный опыт предоставления токенов"
|
||||
},
|
||||
"notifications17ActionText": {
|
||||
"message": "Показать настройки безопасности и конфиденциальности"
|
||||
},
|
||||
|
22
app/_locales/tl/messages.json
generated
22
app/_locales/tl/messages.json
generated
@ -110,10 +110,6 @@
|
||||
"message": "Nabasa ko at sumasang-ayon ako sa $1",
|
||||
"description": "$1 is the `terms` message"
|
||||
},
|
||||
"accessAndSpendNotice": {
|
||||
"message": "Maaaring i-access ng $1 ang max na halagang ito at gumastos hanggang sa max na halagang ito",
|
||||
"description": "$1 is the url of the site requesting ability to spend"
|
||||
},
|
||||
"accessAndSpendNoticeNFT": {
|
||||
"message": "$1 maaaring i-access at gamitin ang asset na ito",
|
||||
"description": "$1 is the url of the site requesting ability to spend"
|
||||
@ -388,9 +384,6 @@
|
||||
"approved": {
|
||||
"message": "Inaprubahan"
|
||||
},
|
||||
"approvedAmountWithColon": {
|
||||
"message": "Inaprubahang halaga:"
|
||||
},
|
||||
"approvedAsset": {
|
||||
"message": "Aprubadong asset"
|
||||
},
|
||||
@ -1709,12 +1702,6 @@
|
||||
"message": "Na-import",
|
||||
"description": "status showing that an account has been fully loaded into the keyring"
|
||||
},
|
||||
"improvedTokenAllowance": {
|
||||
"message": "Pinahusay na karanasan sa allowance ng token"
|
||||
},
|
||||
"improvedTokenAllowanceDescription": {
|
||||
"message": "I-on ito para dumaan sa pinahusay na karanasan sa allowance ng token tuwing humihiling ang isang dapp na aprubahan ng ERC20"
|
||||
},
|
||||
"inYourSettings": {
|
||||
"message": "sa iyong Mga Setting"
|
||||
},
|
||||
@ -2398,15 +2385,6 @@
|
||||
"notifications15Title": {
|
||||
"message": "Narito na ang Ethereum Merge!"
|
||||
},
|
||||
"notifications16ActionText": {
|
||||
"message": "Subukan ito dito"
|
||||
},
|
||||
"notifications16Description": {
|
||||
"message": "Muli naming idinisenyo ang aming kumpirmasyon ng allowance ng token upang matulungan kang gumawa ng mas matalinong mga desisyon."
|
||||
},
|
||||
"notifications16Title": {
|
||||
"message": "Pinahusay na karanasan sa allowance ng token"
|
||||
},
|
||||
"notifications17ActionText": {
|
||||
"message": "Ipakita ang mga setting ng Seguridad at Pagkapribado"
|
||||
},
|
||||
|
22
app/_locales/tr/messages.json
generated
22
app/_locales/tr/messages.json
generated
@ -110,10 +110,6 @@
|
||||
"message": "$1 bölümünü okudum ve kabul ediyorum",
|
||||
"description": "$1 is the `terms` message"
|
||||
},
|
||||
"accessAndSpendNotice": {
|
||||
"message": "$1 bu maksimum tutara kadar erişim sağlayabilir ve harcama yapabilir",
|
||||
"description": "$1 is the url of the site requesting ability to spend"
|
||||
},
|
||||
"accessAndSpendNoticeNFT": {
|
||||
"message": "$1 bu varlığa erişebilir ve harcayabilir",
|
||||
"description": "$1 is the url of the site requesting ability to spend"
|
||||
@ -388,9 +384,6 @@
|
||||
"approved": {
|
||||
"message": "Onaylandı"
|
||||
},
|
||||
"approvedAmountWithColon": {
|
||||
"message": "Onaylanan tutar:"
|
||||
},
|
||||
"approvedAsset": {
|
||||
"message": "Onaylanan varlık"
|
||||
},
|
||||
@ -1709,12 +1702,6 @@
|
||||
"message": "İçe Aktarıldı",
|
||||
"description": "status showing that an account has been fully loaded into the keyring"
|
||||
},
|
||||
"improvedTokenAllowance": {
|
||||
"message": "Gelişmiş token hakediş deneyimi"
|
||||
},
|
||||
"improvedTokenAllowanceDescription": {
|
||||
"message": "Merkeziyetsiz bir uygulama ERC20 onayı istediğinde gelişmiş token hakediş deneyimini kullanmak için bunu açın"
|
||||
},
|
||||
"inYourSettings": {
|
||||
"message": "Ayarlar kısmında"
|
||||
},
|
||||
@ -2398,15 +2385,6 @@
|
||||
"notifications15Title": {
|
||||
"message": "Ethereum Birleşmesi başladı!"
|
||||
},
|
||||
"notifications16ActionText": {
|
||||
"message": "Burada dene"
|
||||
},
|
||||
"notifications16Description": {
|
||||
"message": "Token hakediş onayımızı daha bilgiye dayalı kararlar almanıza yardımcı olacak şekilde yeniden tasarladık."
|
||||
},
|
||||
"notifications16Title": {
|
||||
"message": "Gelişmiş token hakedişi deneyimi"
|
||||
},
|
||||
"notifications17ActionText": {
|
||||
"message": "Güvenlik ve Gizlilik ayarlarını göster"
|
||||
},
|
||||
|
22
app/_locales/vi/messages.json
generated
22
app/_locales/vi/messages.json
generated
@ -110,10 +110,6 @@
|
||||
"message": "Tôi đã đọc và đồng ý với $1",
|
||||
"description": "$1 is the `terms` message"
|
||||
},
|
||||
"accessAndSpendNotice": {
|
||||
"message": "$1 có thể truy cập và chi tiêu đến số tiền tối đa",
|
||||
"description": "$1 is the url of the site requesting ability to spend"
|
||||
},
|
||||
"accessAndSpendNoticeNFT": {
|
||||
"message": "$1 có thể truy cập và chi tiêu tài sản này",
|
||||
"description": "$1 is the url of the site requesting ability to spend"
|
||||
@ -388,9 +384,6 @@
|
||||
"approved": {
|
||||
"message": "Đã phê duyệt"
|
||||
},
|
||||
"approvedAmountWithColon": {
|
||||
"message": "Số tiền được duyệt:"
|
||||
},
|
||||
"approvedAsset": {
|
||||
"message": "Tài sản được chấp nhận"
|
||||
},
|
||||
@ -1709,12 +1702,6 @@
|
||||
"message": "Đã nhập",
|
||||
"description": "status showing that an account has been fully loaded into the keyring"
|
||||
},
|
||||
"improvedTokenAllowance": {
|
||||
"message": "Trải nghiệm cho phép token được cải thiện"
|
||||
},
|
||||
"improvedTokenAllowanceDescription": {
|
||||
"message": "Bật tính năng này để có trải nghiệm cho phép token được cải thiện mỗi khi có một dapp yêu cầu phê duyệt ERC20"
|
||||
},
|
||||
"inYourSettings": {
|
||||
"message": "trong phần Cài đặt"
|
||||
},
|
||||
@ -2398,15 +2385,6 @@
|
||||
"notifications15Title": {
|
||||
"message": "Hợp nhất Ethereum đã được triển khai!"
|
||||
},
|
||||
"notifications16ActionText": {
|
||||
"message": "Dùng thử tại đây"
|
||||
},
|
||||
"notifications16Description": {
|
||||
"message": "Chúng tôi đã thiết kế lại xác nhận cho phép token để giúp bạn đưa ra quyết định sáng suốt hơn."
|
||||
},
|
||||
"notifications16Title": {
|
||||
"message": "Trải nghiệm cho phép token được cải thiện"
|
||||
},
|
||||
"notifications17ActionText": {
|
||||
"message": "Hiển thị cài đặt Bảo mật và Quyền riêng tư"
|
||||
},
|
||||
|
22
app/_locales/zh_CN/messages.json
generated
22
app/_locales/zh_CN/messages.json
generated
@ -110,10 +110,6 @@
|
||||
"message": "我已阅读并同意 $1",
|
||||
"description": "$1 is the `terms` message"
|
||||
},
|
||||
"accessAndSpendNotice": {
|
||||
"message": "$1 可以访问并使用此最大金额",
|
||||
"description": "$1 is the url of the site requesting ability to spend"
|
||||
},
|
||||
"accessAndSpendNoticeNFT": {
|
||||
"message": "$1可以访问并使用此资产",
|
||||
"description": "$1 is the url of the site requesting ability to spend"
|
||||
@ -388,9 +384,6 @@
|
||||
"approved": {
|
||||
"message": "已批准"
|
||||
},
|
||||
"approvedAmountWithColon": {
|
||||
"message": "已批准金额:"
|
||||
},
|
||||
"approvedAsset": {
|
||||
"message": "已获批准的资产"
|
||||
},
|
||||
@ -1709,12 +1702,6 @@
|
||||
"message": "已导入",
|
||||
"description": "status showing that an account has been fully loaded into the keyring"
|
||||
},
|
||||
"improvedTokenAllowance": {
|
||||
"message": "经过改进的代币津贴体验"
|
||||
},
|
||||
"improvedTokenAllowanceDescription": {
|
||||
"message": "每当分布式应用请求 ERC20 批准时,打开此项以查看经过改进的代币津贴体验"
|
||||
},
|
||||
"inYourSettings": {
|
||||
"message": "在设置中"
|
||||
},
|
||||
@ -2398,15 +2385,6 @@
|
||||
"notifications15Title": {
|
||||
"message": "以太坊合并来了!"
|
||||
},
|
||||
"notifications16ActionText": {
|
||||
"message": "在此处尝试"
|
||||
},
|
||||
"notifications16Description": {
|
||||
"message": "我们重新设计了代币津贴确认,助您作出更明智的决策。"
|
||||
},
|
||||
"notifications16Title": {
|
||||
"message": "经过改进的代币津贴体验"
|
||||
},
|
||||
"notifications17ActionText": {
|
||||
"message": "显示安全和隐私设置"
|
||||
},
|
||||
|
4
app/_locales/zh_TW/messages.json
generated
4
app/_locales/zh_TW/messages.json
generated
@ -6,10 +6,6 @@
|
||||
"message": "我已閱讀並同意$1",
|
||||
"description": "$1 is the `terms` message"
|
||||
},
|
||||
"accessAndSpendNotice": {
|
||||
"message": "$1 可能會存取並最多花費以下額度",
|
||||
"description": "$1 is the url of the site requesting ability to spend"
|
||||
},
|
||||
"accessingYourCamera": {
|
||||
"message": "正在存取您的攝影鏡頭..."
|
||||
},
|
||||
|
@ -66,7 +66,6 @@ export default class PreferencesController {
|
||||
ledgerTransportType: window.navigator.hid
|
||||
? LedgerTransportTypes.webhid
|
||||
: LedgerTransportTypes.u2f,
|
||||
improvedTokenAllowanceEnabled: false,
|
||||
transactionSecurityCheckEnabled: false,
|
||||
theme: THEME_TYPE.OS,
|
||||
...opts.initState,
|
||||
@ -195,17 +194,6 @@ export default class PreferencesController {
|
||||
this.store.updateState({ theme: val });
|
||||
}
|
||||
|
||||
/**
|
||||
* Setter for the `improvedTokenAllowanceEnabled` property
|
||||
*
|
||||
* @param improvedTokenAllowanceEnabled
|
||||
*/
|
||||
setImprovedTokenAllowanceEnabled(improvedTokenAllowanceEnabled) {
|
||||
this.store.updateState({
|
||||
improvedTokenAllowanceEnabled,
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Setter for the `transactionSecurityCheckEnabled` property
|
||||
*
|
||||
|
@ -1802,10 +1802,6 @@ export default class MetamaskController extends EventEmitter {
|
||||
preferencesController,
|
||||
),
|
||||
setTheme: preferencesController.setTheme.bind(preferencesController),
|
||||
setImprovedTokenAllowanceEnabled:
|
||||
preferencesController.setImprovedTokenAllowanceEnabled.bind(
|
||||
preferencesController,
|
||||
),
|
||||
setTransactionSecurityCheckEnabled:
|
||||
preferencesController.setTransactionSecurityCheckEnabled.bind(
|
||||
preferencesController,
|
||||
|
@ -78,10 +78,6 @@ export const UI_NOTIFICATIONS = {
|
||||
id: 15,
|
||||
date: '2022-09-15',
|
||||
},
|
||||
16: {
|
||||
id: 16,
|
||||
date: null,
|
||||
},
|
||||
17: {
|
||||
id: 17,
|
||||
date: null,
|
||||
@ -232,17 +228,6 @@ export const getTranslatedUINotifications = (t, locale) => {
|
||||
)
|
||||
: '',
|
||||
},
|
||||
16: {
|
||||
...UI_NOTIFICATIONS[16],
|
||||
title: t('notifications16Title'),
|
||||
description: t('notifications16Description'),
|
||||
actionText: t('notifications16ActionText'),
|
||||
date: UI_NOTIFICATIONS[16].date
|
||||
? new Intl.DateTimeFormat(formattedLocale).format(
|
||||
new Date(UI_NOTIFICATIONS[16].date),
|
||||
)
|
||||
: '',
|
||||
},
|
||||
17: {
|
||||
...UI_NOTIFICATIONS[17],
|
||||
title: t('notifications17Title'),
|
||||
|
@ -106,11 +106,6 @@ function defaultFixture() {
|
||||
id: 15,
|
||||
isShown: false,
|
||||
},
|
||||
16: {
|
||||
date: null,
|
||||
id: 16,
|
||||
isShown: true,
|
||||
},
|
||||
17: {
|
||||
date: null,
|
||||
id: 17,
|
||||
|
@ -474,136 +474,6 @@ describe('MetaMask', function () {
|
||||
});
|
||||
});
|
||||
|
||||
describe('Approves a custom token from dapp', function () {
|
||||
it('approves an already created token', async function () {
|
||||
const windowHandles = await driver.getAllWindowHandles();
|
||||
const extension = windowHandles[0];
|
||||
const dapp = await driver.switchToWindowWithTitle(
|
||||
'E2E Test Dapp',
|
||||
windowHandles,
|
||||
);
|
||||
await driver.closeAllWindowHandlesExcept([extension, dapp]);
|
||||
await driver.delay(regularDelayMs);
|
||||
|
||||
await driver.switchToWindow(dapp);
|
||||
await driver.delay(tinyDelayMs);
|
||||
|
||||
await driver.clickElement({ text: 'Approve Tokens', tag: 'button' });
|
||||
|
||||
await driver.switchToWindow(extension);
|
||||
await driver.delay(regularDelayMs);
|
||||
|
||||
await driver.wait(async () => {
|
||||
const pendingTxes = await driver.findElements(
|
||||
'.transaction-list__pending-transactions .transaction-list-item',
|
||||
);
|
||||
return pendingTxes.length === 1;
|
||||
}, 10000);
|
||||
|
||||
await driver.waitForSelector({
|
||||
// Selects only the very first transaction list item immediately following the 'Pending' header
|
||||
css: '.transaction-list__pending-transactions .transaction-list__header + .transaction-list-item .list-item__heading',
|
||||
text: 'Approve TST spend limit',
|
||||
});
|
||||
|
||||
await driver.clickElement('.transaction-list-item');
|
||||
await driver.delay(regularDelayMs);
|
||||
});
|
||||
|
||||
it('displays the token approval data', async function () {
|
||||
await driver.clickElement({
|
||||
text: 'View full transaction details',
|
||||
css: '.confirm-approve-content__small-blue-text',
|
||||
});
|
||||
const functionType = await driver.findElement(
|
||||
'.confirm-approve-content__data .confirm-approve-content__small-text',
|
||||
);
|
||||
const functionTypeText = await functionType.getText();
|
||||
assert.equal(functionTypeText, 'Function: Approve');
|
||||
|
||||
const confirmDataDiv = await driver.findElement(
|
||||
'.confirm-approve-content__data__data-block',
|
||||
);
|
||||
const confirmDataText = await confirmDataDiv.getText();
|
||||
assert(
|
||||
confirmDataText.match(
|
||||
/0x095ea7b30000000000000000000000009bc5baf874d2da8d216ae9f137804184ee5afef4/u,
|
||||
),
|
||||
);
|
||||
});
|
||||
|
||||
it('customizes gas', async function () {
|
||||
await driver.clickElement('.confirm-approve-content__small-blue-text');
|
||||
await driver.delay(regularDelayMs);
|
||||
await driver.clickElement({
|
||||
text: 'Edit suggested gas fee',
|
||||
tag: 'button',
|
||||
});
|
||||
await driver.delay(regularDelayMs);
|
||||
|
||||
const [gasLimitInput, gasPriceInput] = await driver.findElements(
|
||||
'input[type="number"]',
|
||||
);
|
||||
|
||||
await gasPriceInput.fill('10');
|
||||
await driver.delay(50);
|
||||
|
||||
await gasLimitInput.fill('60001');
|
||||
|
||||
await driver.delay(veryLargeDelayMs);
|
||||
|
||||
await driver.clickElement({ text: 'Save', tag: 'button' });
|
||||
await driver.delay(veryLargeDelayMs);
|
||||
|
||||
const gasFeeInEth = await driver.findElement(
|
||||
'.confirm-approve-content__transaction-details-content__secondary-fee',
|
||||
);
|
||||
assert.equal(await gasFeeInEth.getText(), '0.0006 ETH');
|
||||
});
|
||||
|
||||
it('edits the permission', async function () {
|
||||
const editButtons = await driver.findClickableElements(
|
||||
'.confirm-approve-content__small-blue-text',
|
||||
);
|
||||
await editButtons[2].click();
|
||||
|
||||
// wait for permission modal to be visible
|
||||
const permissionModal = await driver.findVisibleElement('span .modal');
|
||||
const radioButtons = await driver.findClickableElements(
|
||||
'.edit-approval-permission__edit-section__radio-button',
|
||||
);
|
||||
await radioButtons[1].click();
|
||||
|
||||
await driver.fill('input', '5');
|
||||
await driver.delay(regularDelayMs);
|
||||
|
||||
await driver.clickElement({ text: 'Save', tag: 'button' });
|
||||
await driver.delay(veryLargeDelayMs);
|
||||
|
||||
// wait for permission modal to be removed from DOM.
|
||||
await permissionModal.waitForElementState('hidden');
|
||||
|
||||
const permissionInfo = await driver.findElements(
|
||||
'.confirm-approve-content__medium-text',
|
||||
);
|
||||
const amountDiv = permissionInfo[0];
|
||||
assert.equal(await amountDiv.getText(), '5 TST');
|
||||
});
|
||||
|
||||
it('submits the transaction', async function () {
|
||||
await driver.clickElement({ text: 'Confirm', tag: 'button' });
|
||||
await driver.delay(regularDelayMs);
|
||||
});
|
||||
|
||||
it('finds the transaction in the transactions list', async function () {
|
||||
await driver.waitForSelector({
|
||||
// Select only the heading of the first entry in the transaction list.
|
||||
css: '.transaction-list__completed-transactions .transaction-list-item:first-child .list-item__heading',
|
||||
text: 'Approve TST spend limit',
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('Transfers a custom token from dapp when no gas value is specified', function () {
|
||||
it('transfers an already created token, without specifying gas', async function () {
|
||||
const windowHandles = await driver.getAllWindowHandles();
|
||||
@ -660,69 +530,4 @@ describe('MetaMask', function () {
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('Approves a custom token from dapp when no gas value is specified', function () {
|
||||
it('approves an already created token', async function () {
|
||||
const windowHandles = await driver.getAllWindowHandles();
|
||||
const extension = windowHandles[0];
|
||||
const dapp = await driver.switchToWindowWithTitle(
|
||||
'E2E Test Dapp',
|
||||
windowHandles,
|
||||
);
|
||||
await driver.closeAllWindowHandlesExcept([extension, dapp]);
|
||||
await driver.delay(regularDelayMs);
|
||||
|
||||
await driver.switchToWindow(dapp);
|
||||
await driver.delay(tinyDelayMs);
|
||||
|
||||
await driver.clickElement({
|
||||
text: 'Approve Tokens Without Gas',
|
||||
tag: 'button',
|
||||
});
|
||||
|
||||
await driver.switchToWindow(extension);
|
||||
await driver.delay(regularDelayMs);
|
||||
|
||||
await driver.wait(async () => {
|
||||
const pendingTxes = await driver.findElements(
|
||||
'.transaction-list__pending-transactions .transaction-list-item',
|
||||
);
|
||||
return pendingTxes.length === 1;
|
||||
}, 10000);
|
||||
|
||||
await driver.waitForSelector({
|
||||
// Selects only the very first transaction list item immediately following the 'Pending' header
|
||||
css: '.transaction-list__pending-transactions .transaction-list__header + .transaction-list-item .list-item__heading',
|
||||
text: 'Approve TST spend limit',
|
||||
});
|
||||
|
||||
await driver.clickElement('.transaction-list-item');
|
||||
await driver.delay(regularDelayMs);
|
||||
});
|
||||
|
||||
it('shows the correct recipient', async function () {
|
||||
await driver.clickElement({
|
||||
text: 'View full transaction details',
|
||||
css: '.confirm-approve-content__small-blue-text',
|
||||
});
|
||||
const permissionInfo = await driver.findElements(
|
||||
'.confirm-approve-content__medium-text',
|
||||
);
|
||||
const recipientDiv = permissionInfo[1];
|
||||
assert.equal(await recipientDiv.getText(), '0x2f318C33...C970');
|
||||
});
|
||||
|
||||
it('submits the transaction', async function () {
|
||||
await driver.delay(veryLargeDelayMs);
|
||||
await driver.clickElement({ text: 'Confirm', tag: 'button' });
|
||||
await driver.delay(regularDelayMs);
|
||||
});
|
||||
|
||||
it('finds the transaction in the transactions list', async function () {
|
||||
await driver.waitForSelector({
|
||||
css: '.transaction-list__completed-transactions .transaction-list-item:first-child .list-item__heading',
|
||||
text: 'Approve TST spend limit',
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@ -1,362 +1,502 @@
|
||||
/* eslint-disable mocha/no-skipped-tests */
|
||||
const { strict: assert } = require('assert');
|
||||
|
||||
const {
|
||||
convertToHexValue,
|
||||
withFixtures,
|
||||
getWindowHandles,
|
||||
} = require('../helpers');
|
||||
const { convertToHexValue, withFixtures } = require('../helpers');
|
||||
const FixtureBuilder = require('../fixture-builder');
|
||||
const { SMART_CONTRACTS } = require('../seeder/smart-contracts');
|
||||
|
||||
describe.skip('Create token, approve token and approve token without gas', function () {
|
||||
describe('Add a custom token from a dapp', function () {
|
||||
const ganacheOptions = {
|
||||
accounts: [
|
||||
{
|
||||
secretKey:
|
||||
'0x7C9529A67102755B7E6102D6D950AC5D5863C98713805CEC576B945B15B71EAC',
|
||||
balance: convertToHexValue(25000000000000000000),
|
||||
},
|
||||
],
|
||||
};
|
||||
describe('Create token, approve token and approve token without gas', function () {
|
||||
const smartContract = SMART_CONTRACTS.HST;
|
||||
const ganacheOptions = {
|
||||
accounts: [
|
||||
{
|
||||
secretKey:
|
||||
'0x7C9529A67102755B7E6102D6D950AC5D5863C98713805CEC576B945B15B71EAC',
|
||||
balance: convertToHexValue(25000000000000000000),
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
it('creates, imports and renders the balance for the new token', async function () {
|
||||
await withFixtures(
|
||||
{
|
||||
dapp: true,
|
||||
fixtures: new FixtureBuilder()
|
||||
.withPermissionControllerConnectedToTestDapp()
|
||||
.build(),
|
||||
ganacheOptions,
|
||||
title: this.test.title,
|
||||
},
|
||||
async ({ driver }) => {
|
||||
await driver.navigate();
|
||||
await driver.fill('#password', 'correct horse battery staple');
|
||||
await driver.press('#password', driver.Key.ENTER);
|
||||
it('imports and renders the balance for the new token', async function () {
|
||||
await withFixtures(
|
||||
{
|
||||
dapp: true,
|
||||
fixtures: new FixtureBuilder()
|
||||
.withPermissionControllerConnectedToTestDapp()
|
||||
.build(),
|
||||
ganacheOptions,
|
||||
smartContract,
|
||||
title: this.test.title,
|
||||
},
|
||||
async ({ driver, contractRegistry }) => {
|
||||
const contractAddress = await contractRegistry.getContractAddress(
|
||||
smartContract,
|
||||
);
|
||||
await driver.navigate();
|
||||
await driver.fill('#password', 'correct horse battery staple');
|
||||
await driver.press('#password', driver.Key.ENTER);
|
||||
|
||||
// create token
|
||||
await driver.openNewPage(`http://127.0.0.1:8080/`);
|
||||
await driver.waitForSelector({ text: 'Create Token', tag: 'button' });
|
||||
await driver.clickElement({ text: 'Create Token', tag: 'button' });
|
||||
// create token
|
||||
await driver.openNewPage(
|
||||
`http://127.0.0.1:8080/?contract=${contractAddress}`,
|
||||
);
|
||||
|
||||
const windowHandles = await getWindowHandles(driver, 3);
|
||||
await driver.switchToWindow(windowHandles.popup);
|
||||
await driver.clickElement({ text: 'Edit', tag: 'button' });
|
||||
const inputs = await driver.findElements('input[type="number"]');
|
||||
const gasLimitInput = inputs[0];
|
||||
const gasPriceInput = inputs[1];
|
||||
await gasLimitInput.fill('4700000');
|
||||
await gasPriceInput.fill('20');
|
||||
await driver.waitForSelector({ text: 'Save', tag: 'button' });
|
||||
await driver.clickElement({ text: 'Save', tag: 'button' });
|
||||
await driver.clickElement({ text: 'Confirm', tag: 'button' });
|
||||
const windowHandles = await driver.getAllWindowHandles();
|
||||
const extension = windowHandles[0];
|
||||
|
||||
await driver.switchToWindow(windowHandles.dapp);
|
||||
// imports custom token from extension
|
||||
await driver.switchToWindow(extension);
|
||||
await driver.clickElement(`[data-testid="home__asset-tab"]`);
|
||||
await driver.clickElement({ tag: 'button', text: 'Assets' });
|
||||
|
||||
const tokenContractAddress = await driver.waitForSelector({
|
||||
css: '#tokenAddress',
|
||||
text: '0x',
|
||||
});
|
||||
const tokenAddress = await tokenContractAddress.getText();
|
||||
await driver.clickElement({ text: 'import tokens', tag: 'a' });
|
||||
await driver.clickElement({
|
||||
text: 'Custom token',
|
||||
tag: 'button',
|
||||
});
|
||||
await driver.fill('#custom-address', contractAddress);
|
||||
await driver.waitForSelector('#custom-decimals');
|
||||
await driver.delay(2000);
|
||||
|
||||
// imports custom token from extension
|
||||
await driver.switchToWindow(windowHandles.extension);
|
||||
await driver.clickElement(`[data-testid="home__asset-tab"]`);
|
||||
await driver.clickElement({ tag: 'button', text: 'Assets' });
|
||||
await driver.clickElement({
|
||||
text: 'Add custom token',
|
||||
tag: 'button',
|
||||
});
|
||||
|
||||
await driver.clickElement({ text: 'import tokens', tag: 'a' });
|
||||
await driver.clickElement({
|
||||
text: 'Custom token',
|
||||
tag: 'button',
|
||||
});
|
||||
await driver.waitForSelector('#custom-address');
|
||||
await driver.fill('#custom-address', tokenAddress);
|
||||
await driver.waitForSelector('#custom-symbol');
|
||||
await driver.waitForSelector('#custom-decimals');
|
||||
await driver.delay(2000);
|
||||
await driver.delay(2000);
|
||||
await driver.clickElement({
|
||||
text: 'Import tokens',
|
||||
tag: 'button',
|
||||
});
|
||||
|
||||
await driver.clickElement({
|
||||
text: 'Add custom token',
|
||||
tag: 'button',
|
||||
});
|
||||
|
||||
await driver.delay(2000);
|
||||
await driver.clickElement({
|
||||
text: 'Import tokens',
|
||||
tag: 'button',
|
||||
});
|
||||
|
||||
// renders balance for newly created token
|
||||
await driver.waitForSelector('.app-header__logo-container');
|
||||
await driver.clickElement('.app-header__logo-container');
|
||||
await driver.clickElement({ tag: 'button', text: 'Assets' });
|
||||
const asset = await driver.waitForSelector({
|
||||
css: '.asset-list-item__token-value',
|
||||
text: '10',
|
||||
});
|
||||
assert.equal(await asset.getText(), '10');
|
||||
},
|
||||
);
|
||||
});
|
||||
// renders balance for newly created token
|
||||
await driver.clickElement('.app-header__logo-container');
|
||||
await driver.clickElement({ tag: 'button', text: 'Assets' });
|
||||
const asset = await driver.waitForSelector({
|
||||
css: '.asset-list-item__token-value',
|
||||
text: '10',
|
||||
});
|
||||
assert.equal(await asset.getText(), '10');
|
||||
},
|
||||
);
|
||||
});
|
||||
|
||||
describe('Approves a custom token from dapp', function () {
|
||||
let windowHandles;
|
||||
it('approves an already created token and displays the token approval data', async function () {
|
||||
await withFixtures(
|
||||
{
|
||||
dapp: true,
|
||||
fixtures: new FixtureBuilder()
|
||||
.withPermissionControllerConnectedToTestDapp()
|
||||
.build(),
|
||||
ganacheOptions,
|
||||
smartContract,
|
||||
title: this.test.title,
|
||||
},
|
||||
async ({ driver, contractRegistry }) => {
|
||||
const contractAddress = await contractRegistry.getContractAddress(
|
||||
smartContract,
|
||||
);
|
||||
await driver.navigate();
|
||||
await driver.fill('#password', 'correct horse battery staple');
|
||||
await driver.press('#password', driver.Key.ENTER);
|
||||
|
||||
const ganacheOptions = {
|
||||
accounts: [
|
||||
{
|
||||
secretKey:
|
||||
'0x7C9529A67102755B7E6102D6D950AC5D5863C98713805CEC576B945B15B71EAC',
|
||||
balance: convertToHexValue(25000000000000000000),
|
||||
},
|
||||
],
|
||||
};
|
||||
it('approves an already created token and displays the token approval data', async function () {
|
||||
await withFixtures(
|
||||
{
|
||||
dapp: true,
|
||||
fixtures: new FixtureBuilder()
|
||||
.withPermissionControllerConnectedToTestDapp()
|
||||
.build(),
|
||||
ganacheOptions,
|
||||
title: this.test.title,
|
||||
},
|
||||
async ({ driver }) => {
|
||||
await driver.navigate();
|
||||
await driver.fill('#password', 'correct horse battery staple');
|
||||
await driver.press('#password', driver.Key.ENTER);
|
||||
// create token
|
||||
await driver.openNewPage(
|
||||
`http://127.0.0.1:8080/?contract=${contractAddress}`,
|
||||
);
|
||||
|
||||
await driver.openNewPage(`http://127.0.0.1:8080/`);
|
||||
let windowHandles = await driver.getAllWindowHandles();
|
||||
const extension = windowHandles[0];
|
||||
|
||||
await driver.waitForSelector({ text: 'Create Token', tag: 'button' });
|
||||
await driver.clickElement({ text: 'Create Token', tag: 'button' });
|
||||
windowHandles = await getWindowHandles(driver, 3);
|
||||
await driver.switchToWindow(windowHandles.popup);
|
||||
await driver.clickElement({ text: 'Confirm', tag: 'button' });
|
||||
await driver.switchToWindow(windowHandles.dapp);
|
||||
await driver.waitForSelector({
|
||||
text: 'Approve Tokens',
|
||||
tag: 'button',
|
||||
});
|
||||
await driver.clickElement({ text: 'Approve Tokens', tag: 'button' });
|
||||
await driver.findClickableElement('#deployButton');
|
||||
// approve token from dapp
|
||||
await driver.clickElement({ text: 'Approve Tokens', tag: 'button' });
|
||||
|
||||
// displays the token approval data
|
||||
// switch to popup
|
||||
windowHandles = await getWindowHandles(driver, 3);
|
||||
await driver.switchToWindow(windowHandles.popup);
|
||||
await driver.waitUntilXWindowHandles(3);
|
||||
windowHandles = await driver.getAllWindowHandles();
|
||||
await driver.switchToWindowWithTitle(
|
||||
'MetaMask Notification',
|
||||
windowHandles,
|
||||
);
|
||||
|
||||
const functionType = await driver.findElement(
|
||||
'.confirm-approve-content__data .confirm-approve-content__small-text',
|
||||
await driver.clickElement({
|
||||
text: 'Verify contract details',
|
||||
css: '.token-allowance-container__verify-link',
|
||||
});
|
||||
|
||||
const modalTitle = await driver.waitForSelector({
|
||||
text: 'Contract details',
|
||||
tag: 'h5',
|
||||
});
|
||||
|
||||
assert.equal(await modalTitle.getText(), 'Contract details');
|
||||
|
||||
await driver.clickElement({
|
||||
text: 'Got it',
|
||||
tag: 'button',
|
||||
});
|
||||
await driver.clickElement({
|
||||
text: 'Use default',
|
||||
css: '.mm-button-link',
|
||||
});
|
||||
await driver.clickElement({
|
||||
text: 'View details',
|
||||
css: '.token-allowance-container__view-details',
|
||||
});
|
||||
|
||||
// checks elements on approve token popup
|
||||
const functionType = await driver.findElement({
|
||||
text: 'Function: Approve',
|
||||
tag: 'h6',
|
||||
});
|
||||
assert.equal(await functionType.getText(), 'Function: Approve');
|
||||
|
||||
const confirmDataDiv = await driver.findElement(
|
||||
'.approve-content-card-container__data__data-block',
|
||||
);
|
||||
const confirmDataText = await confirmDataDiv.getText();
|
||||
assert(
|
||||
confirmDataText.match(
|
||||
/0x095ea7b30000000000000000000000009bc5baf874d2da8d216ae9f137804184ee5afef4/u,
|
||||
),
|
||||
);
|
||||
await driver.clickElement({ text: 'Next', tag: 'button' });
|
||||
|
||||
await driver.findElement({
|
||||
text: 'Review your spending cap',
|
||||
tag: 'div',
|
||||
});
|
||||
|
||||
const defaultSpendingCup = await driver.findElement({
|
||||
text: '7 TST',
|
||||
css: '.box--flex-direction-row > h6',
|
||||
});
|
||||
|
||||
assert.equal(
|
||||
await defaultSpendingCup.getText(),
|
||||
'7 TST',
|
||||
'Default value is not correctly set',
|
||||
);
|
||||
|
||||
await driver.clickElement({
|
||||
text: 'Approve',
|
||||
tag: 'button',
|
||||
});
|
||||
|
||||
await driver.switchToWindow(extension);
|
||||
await driver.clickElement({ tag: 'button', text: 'Activity' });
|
||||
|
||||
// check list of pending transactions in extension
|
||||
await driver.wait(async () => {
|
||||
const pendingTxes = await driver.findElements(
|
||||
'.transaction-list-item',
|
||||
);
|
||||
return pendingTxes.length === 1;
|
||||
}, 10000);
|
||||
|
||||
await driver.scrollToElement(functionType);
|
||||
const functionTypeText = await functionType.getText();
|
||||
assert.equal(functionTypeText, 'Function: Approve');
|
||||
const confirmDataDiv = await driver.findElement(
|
||||
'.confirm-approve-content__data__data-block',
|
||||
);
|
||||
const confirmDataText = await confirmDataDiv.getText();
|
||||
assert(
|
||||
confirmDataText.match(
|
||||
/0x095ea7b30000000000000000000000009bc5baf874d2da8d216ae9f137804184ee5afef4/u,
|
||||
),
|
||||
);
|
||||
await driver.clickElement({ text: 'Confirm', tag: 'button' });
|
||||
await driver.switchToWindow(windowHandles.extension);
|
||||
await driver.clickElement({ tag: 'button', text: 'Activity' });
|
||||
|
||||
await driver.wait(async () => {
|
||||
const pendingTxes = await driver.findElements(
|
||||
'.transaction-list-item',
|
||||
);
|
||||
return pendingTxes.length === 2;
|
||||
}, 10000);
|
||||
|
||||
await driver.waitForSelector({
|
||||
// Selects only the very first transaction list item immediately following the 'Pending' header
|
||||
css: '.transaction-list__pending-transactions .transaction-list__header + .transaction-list-item .list-item__heading',
|
||||
text: 'Approve Token spend limit',
|
||||
});
|
||||
},
|
||||
);
|
||||
});
|
||||
|
||||
it('customizes gas, edit permissions and checks transaction in transaction list', async function () {
|
||||
await withFixtures(
|
||||
{
|
||||
dapp: true,
|
||||
fixtures: new FixtureBuilder()
|
||||
.withPermissionControllerConnectedToTestDapp()
|
||||
.build(),
|
||||
ganacheOptions,
|
||||
title: this.test.title,
|
||||
},
|
||||
async ({ driver }) => {
|
||||
await driver.navigate();
|
||||
await driver.fill('#password', 'correct horse battery staple');
|
||||
await driver.press('#password', driver.Key.ENTER);
|
||||
|
||||
await driver.openNewPage(`http://127.0.0.1:8080/`);
|
||||
|
||||
await driver.waitForSelector({ text: 'Create Token', tag: 'button' });
|
||||
await driver.clickElement({ text: 'Create Token', tag: 'button' });
|
||||
windowHandles = await getWindowHandles(driver, 3);
|
||||
await driver.switchToWindow(windowHandles.popup);
|
||||
await driver.clickElement({ text: 'Confirm', tag: 'button' });
|
||||
|
||||
await driver.switchToWindow(windowHandles.dapp);
|
||||
|
||||
await driver.waitForSelector({
|
||||
text: 'Approve Tokens',
|
||||
tag: 'button',
|
||||
});
|
||||
await driver.clickElement({ text: 'Approve Tokens', tag: 'button' });
|
||||
|
||||
// switch to popup
|
||||
windowHandles = await getWindowHandles(driver, 3);
|
||||
await driver.switchToWindow(windowHandles.popup);
|
||||
|
||||
await driver.clickElement(
|
||||
'.confirm-approve-content__small-blue-text',
|
||||
);
|
||||
await driver.clickElement({
|
||||
text: 'Edit suggested gas fee',
|
||||
tag: 'button',
|
||||
});
|
||||
const [gasLimitInput, gasPriceInput] = await driver.findElements(
|
||||
'input[type="number"]',
|
||||
);
|
||||
await gasPriceInput.clear();
|
||||
await gasPriceInput.fill('10');
|
||||
await gasLimitInput.clear();
|
||||
await gasLimitInput.fill('60001');
|
||||
await driver.findClickableElement({ text: 'Save', tag: 'button' });
|
||||
await driver.clickElement({ text: 'Save', tag: 'button' });
|
||||
|
||||
await driver.waitForSelector({
|
||||
css: '.confirm-approve-content__transaction-details-content__secondary-fee',
|
||||
text: '0.0006 ETH',
|
||||
});
|
||||
|
||||
// edits the permission
|
||||
const editButtons = await driver.findClickableElements(
|
||||
'.confirm-approve-content__small-blue-text',
|
||||
);
|
||||
await editButtons[2].click();
|
||||
|
||||
// wait for permission modal to be visible
|
||||
const permissionModal = await driver.findVisibleElement(
|
||||
'span .modal',
|
||||
);
|
||||
const radioButtons = await driver.findClickableElements(
|
||||
'.edit-approval-permission__edit-section__radio-button',
|
||||
);
|
||||
const customSpendLimit = await radioButtons[1];
|
||||
await customSpendLimit.click();
|
||||
await driver.fill('input', '5');
|
||||
await driver.clickElement({ text: 'Save', tag: 'button' });
|
||||
|
||||
// wait for permission modal to be removed from DOM.
|
||||
await permissionModal.waitForElementState('hidden');
|
||||
const permissionInfo = await driver.findElements(
|
||||
'.confirm-approve-content__medium-text',
|
||||
);
|
||||
const amountDiv = permissionInfo[0];
|
||||
assert.equal(await amountDiv.getText(), '5 TST');
|
||||
|
||||
// submits the transaction
|
||||
await driver.clickElement({ text: 'Confirm', tag: 'button' });
|
||||
|
||||
// finds the transaction in transaction list
|
||||
await driver.switchToWindow(windowHandles.extension);
|
||||
await driver.clickElement({ tag: 'button', text: 'Activity' });
|
||||
await driver.waitForSelector({
|
||||
// Select only the heading of the first entry in the transaction list.
|
||||
css: '.transaction-list__completed-transactions .transaction-list-item:first-child .list-item__heading',
|
||||
text: 'Approve Token spend limit',
|
||||
});
|
||||
},
|
||||
);
|
||||
});
|
||||
const approveTokenTask = await driver.waitForSelector({
|
||||
// Selects only the very first transaction list item immediately following the 'Pending' header
|
||||
css: '.transaction-list__completed-transactions .transaction-list-item:first-child .list-item__heading',
|
||||
text: 'Approve Token spend limit',
|
||||
});
|
||||
assert.equal(
|
||||
await approveTokenTask.getText(),
|
||||
'Approve Token spend limit',
|
||||
);
|
||||
},
|
||||
);
|
||||
});
|
||||
|
||||
describe('Approves a custom token from dapp when no gas value is specified', function () {
|
||||
let windowHandles;
|
||||
it('set custom spending cap, customizes gas, edit spending cap and checks transaction in transaction list', async function () {
|
||||
await withFixtures(
|
||||
{
|
||||
dapp: true,
|
||||
fixtures: new FixtureBuilder()
|
||||
.withPermissionControllerConnectedToTestDapp()
|
||||
.build(),
|
||||
ganacheOptions,
|
||||
smartContract,
|
||||
title: this.test.title,
|
||||
},
|
||||
async ({ driver, contractRegistry }) => {
|
||||
const contractAddress = await contractRegistry.getContractAddress(
|
||||
smartContract,
|
||||
);
|
||||
await driver.navigate();
|
||||
await driver.fill('#password', 'correct horse battery staple');
|
||||
await driver.press('#password', driver.Key.ENTER);
|
||||
|
||||
const ganacheOptions = {
|
||||
accounts: [
|
||||
{
|
||||
secretKey:
|
||||
'0x7C9529A67102755B7E6102D6D950AC5D5863C98713805CEC576B945B15B71EAC',
|
||||
balance: convertToHexValue(25000000000000000000),
|
||||
},
|
||||
],
|
||||
};
|
||||
// create token
|
||||
await driver.openNewPage(
|
||||
`http://127.0.0.1:8080/?contract=${contractAddress}`,
|
||||
);
|
||||
|
||||
it('approves an already created token, shows the correct recipient, submits the transaction and finds the transaction in the transactions list', async function () {
|
||||
await withFixtures(
|
||||
{
|
||||
dapp: true,
|
||||
fixtures: new FixtureBuilder()
|
||||
.withPermissionControllerConnectedToTestDapp()
|
||||
.build(),
|
||||
ganacheOptions,
|
||||
title: this.test.title,
|
||||
},
|
||||
async ({ driver }) => {
|
||||
await driver.navigate();
|
||||
await driver.fill('#password', 'correct horse battery staple');
|
||||
await driver.press('#password', driver.Key.ENTER);
|
||||
let windowHandles = await driver.getAllWindowHandles();
|
||||
const extension = windowHandles[0];
|
||||
|
||||
await driver.openNewPage(`http://127.0.0.1:8080/`);
|
||||
await driver.findClickableElement('#deployButton');
|
||||
|
||||
await driver.waitForSelector({ text: 'Create Token', tag: 'button' });
|
||||
await driver.clickElement({ text: 'Create Token', tag: 'button' });
|
||||
windowHandles = await getWindowHandles(driver, 3);
|
||||
await driver.switchToWindow(windowHandles.popup);
|
||||
await driver.clickElement({ text: 'Confirm', tag: 'button' });
|
||||
// approve token from dapp
|
||||
await driver.clickElement({ text: 'Approve Tokens', tag: 'button' });
|
||||
|
||||
await driver.switchToWindow(windowHandles.dapp);
|
||||
await driver.waitUntilXWindowHandles(3);
|
||||
windowHandles = await driver.getAllWindowHandles();
|
||||
await driver.switchToWindowWithTitle(
|
||||
'MetaMask Notification',
|
||||
windowHandles,
|
||||
);
|
||||
|
||||
await driver.clickElement({
|
||||
text: 'Approve Tokens Without Gas',
|
||||
tag: 'button',
|
||||
});
|
||||
// set custom spending cap
|
||||
let setSpendingCap = await driver.findElement(
|
||||
'[data-testid="custom-spending-cap-input"]',
|
||||
);
|
||||
await setSpendingCap.fill('5');
|
||||
|
||||
await driver.switchToWindow(windowHandles.extension);
|
||||
await driver.clickElement({ tag: 'button', text: 'Activity' });
|
||||
await driver.clickElement({
|
||||
text: 'View details',
|
||||
css: '.token-allowance-container__view-details',
|
||||
});
|
||||
await driver.clickElement({
|
||||
text: 'Next',
|
||||
tag: 'button',
|
||||
});
|
||||
|
||||
await driver.wait(async () => {
|
||||
const pendingTxes = await driver.findElements(
|
||||
'.transaction-list__pending-transactions .transaction-list-item',
|
||||
);
|
||||
return pendingTxes.length === 1;
|
||||
}, 10000);
|
||||
let spendingCup = await driver.findElement({
|
||||
text: '5 TST',
|
||||
css: '.box--flex-direction-row > h6',
|
||||
});
|
||||
|
||||
await driver.waitForSelector({
|
||||
// Selects only the very first transaction list item immediately following the 'Pending' header
|
||||
css: '.transaction-list__pending-transactions .transaction-list__header + .transaction-list-item .list-item__heading',
|
||||
text: 'Approve Token spend limit',
|
||||
});
|
||||
assert.equal(
|
||||
await spendingCup.getText(),
|
||||
'5 TST',
|
||||
'Default value is not correctly set',
|
||||
);
|
||||
|
||||
await driver.clickElement('.transaction-list-item');
|
||||
// editing gas fee
|
||||
const editBtn = await driver.findElements({
|
||||
text: 'Edit',
|
||||
class: 'btn-link > h6',
|
||||
});
|
||||
|
||||
const permissionInfo = await driver.findElements(
|
||||
'.confirm-approve-content__medium-text',
|
||||
editBtn[1].click();
|
||||
|
||||
await driver.clickElement({
|
||||
text: 'Edit suggested gas fee',
|
||||
tag: 'button',
|
||||
});
|
||||
const [gasLimitInput, gasPriceInput] = await driver.findElements(
|
||||
'input[type="number"]',
|
||||
);
|
||||
await gasPriceInput.clear();
|
||||
await gasPriceInput.fill('10');
|
||||
await gasLimitInput.clear();
|
||||
await gasLimitInput.fill('60001');
|
||||
await driver.clickElement({ text: 'Save', tag: 'button' });
|
||||
|
||||
await driver.waitForSelector({
|
||||
css: '.box--flex-direction-row > h6',
|
||||
text: '0.0006 ETH',
|
||||
});
|
||||
|
||||
// editing spending cap
|
||||
await driver.clickElement({
|
||||
class: '.review-spending-cap__heading-detail__button',
|
||||
text: 'Edit',
|
||||
});
|
||||
|
||||
setSpendingCap = await driver.findElement(
|
||||
'[data-testid="custom-spending-cap-input"]',
|
||||
);
|
||||
await setSpendingCap.fill('9');
|
||||
|
||||
await driver.clickElement({
|
||||
text: 'Next',
|
||||
tag: 'button',
|
||||
});
|
||||
|
||||
spendingCup = await driver.findElement({
|
||||
text: '9 TST',
|
||||
css: '.box--flex-direction-row > h6',
|
||||
});
|
||||
assert.equal(
|
||||
await spendingCup.getText(),
|
||||
'9 TST',
|
||||
'Default value is not correctly set',
|
||||
);
|
||||
|
||||
// submits the transaction
|
||||
await driver.clickElement({ text: 'Approve', tag: 'button' });
|
||||
|
||||
// finds the transaction in transaction list
|
||||
await driver.switchToWindow(extension);
|
||||
await driver.clickElement({ tag: 'button', text: 'Activity' });
|
||||
|
||||
await driver.wait(async () => {
|
||||
const pendingTxes = await driver.findElements(
|
||||
'.transaction-list-item',
|
||||
);
|
||||
const recipientDiv = permissionInfo[1];
|
||||
assert.equal(await recipientDiv.getText(), '0x2f318C33...C970');
|
||||
return pendingTxes.length === 1;
|
||||
}, 10000);
|
||||
const approveTokenTask = await driver.waitForSelector({
|
||||
// Select only the heading of the first entry in the transaction list.
|
||||
css: '.transaction-list__completed-transactions .transaction-list-item:first-child .list-item__heading',
|
||||
text: 'Approve Token spend limit',
|
||||
});
|
||||
assert.equal(
|
||||
await approveTokenTask.getText(),
|
||||
'Approve Token spend limit',
|
||||
);
|
||||
},
|
||||
);
|
||||
});
|
||||
|
||||
await driver.clickElement({ text: 'Confirm', tag: 'button' });
|
||||
it('set maximum spending cap, submits the transaction and finds the transaction in the transactions list', async function () {
|
||||
await withFixtures(
|
||||
{
|
||||
dapp: true,
|
||||
fixtures: new FixtureBuilder()
|
||||
.withPermissionControllerConnectedToTestDapp()
|
||||
.build(),
|
||||
ganacheOptions,
|
||||
smartContract,
|
||||
title: this.test.title,
|
||||
},
|
||||
async ({ driver, contractRegistry }) => {
|
||||
const contractAddress = await contractRegistry.getContractAddress(
|
||||
smartContract,
|
||||
);
|
||||
await driver.navigate();
|
||||
await driver.fill('#password', 'correct horse battery staple');
|
||||
await driver.press('#password', driver.Key.ENTER);
|
||||
|
||||
await driver.waitForSelector({
|
||||
css: '.transaction-list__completed-transactions .transaction-list-item:first-child .list-item__heading',
|
||||
text: 'Approve Token spend limit',
|
||||
});
|
||||
},
|
||||
);
|
||||
});
|
||||
// create token
|
||||
await driver.openNewPage(
|
||||
`http://127.0.0.1:8080/?contract=${contractAddress}`,
|
||||
);
|
||||
|
||||
const windowHandles = await driver.getAllWindowHandles();
|
||||
const extension = windowHandles[0];
|
||||
|
||||
await driver.findClickableElement('#deployButton');
|
||||
|
||||
// approve token from dapp
|
||||
await driver.clickElement({ text: 'Approve Tokens', tag: 'button' });
|
||||
|
||||
await driver.switchToWindow(extension);
|
||||
await driver.clickElement({ tag: 'button', text: 'Activity' });
|
||||
|
||||
const pendingTxes = await driver.findElements(
|
||||
'.transaction-list__pending-transactions .transaction-list-item',
|
||||
);
|
||||
pendingTxes[0].click();
|
||||
|
||||
// set max spending cap
|
||||
await driver.clickElement({
|
||||
css: '.custom-spending-cap__max',
|
||||
text: 'Max',
|
||||
});
|
||||
|
||||
await driver.clickElement({
|
||||
tag: 'button',
|
||||
text: 'Next',
|
||||
});
|
||||
|
||||
// checks the balance
|
||||
const balance = await driver.findElement({
|
||||
css: '.box--display-flex > h6',
|
||||
text: '10 TST',
|
||||
});
|
||||
|
||||
const maxSpendingCap = await driver.findElement({
|
||||
text: '10 TST',
|
||||
css: '.box--flex-direction-row > h6',
|
||||
});
|
||||
|
||||
assert.equal(
|
||||
await maxSpendingCap.getText(),
|
||||
await balance.getText(),
|
||||
'Max spending cap is not set corectly',
|
||||
);
|
||||
|
||||
await driver.delay(500);
|
||||
await driver.clickElement({
|
||||
tag: 'button',
|
||||
text: 'Approve',
|
||||
});
|
||||
|
||||
const approveTokenTask = await driver.waitForSelector({
|
||||
// Select only the heading of the first entry in the transaction list.
|
||||
css: '.transaction-list__completed-transactions .transaction-list-item:first-child .list-item__heading',
|
||||
text: 'Approve Token spend limit',
|
||||
});
|
||||
assert.equal(
|
||||
await approveTokenTask.getText(),
|
||||
'Approve Token spend limit',
|
||||
);
|
||||
},
|
||||
);
|
||||
});
|
||||
|
||||
it('approves token without gas, set default spending cap, submits the transaction and finds the transaction in the transactions list', async function () {
|
||||
await withFixtures(
|
||||
{
|
||||
dapp: true,
|
||||
fixtures: new FixtureBuilder()
|
||||
.withPermissionControllerConnectedToTestDapp()
|
||||
.build(),
|
||||
ganacheOptions,
|
||||
smartContract,
|
||||
title: this.test.title,
|
||||
},
|
||||
async ({ driver, contractRegistry }) => {
|
||||
const contractAddress = await contractRegistry.getContractAddress(
|
||||
smartContract,
|
||||
);
|
||||
await driver.navigate();
|
||||
await driver.fill('#password', 'correct horse battery staple');
|
||||
await driver.press('#password', driver.Key.ENTER);
|
||||
|
||||
await driver.openNewPage(
|
||||
`http://127.0.0.1:8080/?contract=${contractAddress}`,
|
||||
);
|
||||
const windowHandles = await driver.getAllWindowHandles();
|
||||
const extension = windowHandles[0];
|
||||
|
||||
await driver.findClickableElement('#deployButton');
|
||||
// approve token without gas from dapp
|
||||
await driver.clickElement({
|
||||
text: 'Approve Tokens Without Gas',
|
||||
tag: 'button',
|
||||
});
|
||||
|
||||
// switch to extension
|
||||
await driver.switchToWindow(extension);
|
||||
await driver.clickElement({ tag: 'button', text: 'Activity' });
|
||||
|
||||
const pendingTxes = await driver.findElements('.transaction-list-item');
|
||||
pendingTxes[0].click();
|
||||
// set spending cap
|
||||
await driver.clickElement({
|
||||
text: 'Use default',
|
||||
css: '.mm-button-link',
|
||||
});
|
||||
await driver.clickElement({
|
||||
text: 'Next',
|
||||
tag: 'button',
|
||||
});
|
||||
|
||||
await driver.delay(500);
|
||||
await driver.clickElement({ text: 'Approve', tag: 'button' });
|
||||
|
||||
// check transaction in Activity tab
|
||||
const approveTokenTask = await driver.waitForSelector({
|
||||
css: '.transaction-list__completed-transactions .transaction-list-item:first-child .list-item__heading',
|
||||
text: 'Approve Token spend limit',
|
||||
});
|
||||
assert.equal(
|
||||
await approveTokenTask.getText(),
|
||||
'Approve Token spend limit',
|
||||
);
|
||||
},
|
||||
);
|
||||
});
|
||||
});
|
||||
|
@ -59,10 +59,6 @@ function getActionFunctionById(id, history) {
|
||||
updateViewedNotifications({ 14: true });
|
||||
history.push(`${ADVANCED_ROUTE}#backup-userdata`);
|
||||
},
|
||||
16: () => {
|
||||
updateViewedNotifications({ 16: true });
|
||||
history.push(EXPERIMENTAL_ROUTE);
|
||||
},
|
||||
17: () => {
|
||||
updateViewedNotifications({ 17: true });
|
||||
history.push(SECURITY_ROUTE);
|
||||
|
@ -350,13 +350,6 @@ export const SETTINGS_CONSTANTS = [
|
||||
route: `${ADVANCED_ROUTE}#restore-userdata`,
|
||||
icon: 'fas fa-upload',
|
||||
},
|
||||
{
|
||||
tabMessage: (t) => t('experimental'),
|
||||
sectionMessage: (t) => t('improvedTokenAllowance'),
|
||||
descriptionMessage: (t) => t('improvedTokenAllowanceDescription'),
|
||||
route: `${EXPERIMENTAL_ROUTE}#improved-token-allowance`,
|
||||
icon: 'fa fa-flask',
|
||||
},
|
||||
{
|
||||
tabMessage: (t) => t('experimental'),
|
||||
sectionMessage: (t) => t('transactionSecurityCheck'),
|
||||
|
@ -182,7 +182,7 @@ describe('Settings Search Utils', () => {
|
||||
|
||||
it('should get good experimental section number', () => {
|
||||
expect(getNumberOfSettingsInSection(t, t('experimental'))).toStrictEqual(
|
||||
2,
|
||||
1,
|
||||
);
|
||||
});
|
||||
|
||||
|
@ -2,16 +2,14 @@ import React, { Component } from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import classnames from 'classnames';
|
||||
import copyToClipboard from 'copy-to-clipboard';
|
||||
import { getTokenTrackerLink, getAccountLink } from '@metamask/etherscan-link';
|
||||
import { getTokenTrackerLink } from '@metamask/etherscan-link';
|
||||
import UrlIcon from '../../../components/ui/url-icon';
|
||||
import { addressSummary } from '../../../helpers/utils/util';
|
||||
import { formatCurrency } from '../../../helpers/utils/confirm-tx.util';
|
||||
import { ellipsify } from '../../send/send.utils';
|
||||
import Typography from '../../../components/ui/typography';
|
||||
import Box from '../../../components/ui/box';
|
||||
import Button from '../../../components/ui/button';
|
||||
import EditGasFeeButton from '../../../components/app/edit-gas-fee-button';
|
||||
import Identicon from '../../../components/ui/identicon';
|
||||
import MultiLayerFeeMessage from '../../../components/app/multilayer-fee-message';
|
||||
import CopyIcon from '../../../components/ui/icon/copy-icon.component';
|
||||
import {
|
||||
@ -36,16 +34,10 @@ export default class ConfirmApproveContent extends Component {
|
||||
};
|
||||
|
||||
static propTypes = {
|
||||
decimals: PropTypes.number,
|
||||
tokenAmount: PropTypes.string,
|
||||
customTokenAmount: PropTypes.string,
|
||||
tokenSymbol: PropTypes.string,
|
||||
siteImage: PropTypes.string,
|
||||
showCustomizeGasModal: PropTypes.func,
|
||||
showEditApprovalPermissionModal: PropTypes.func,
|
||||
origin: PropTypes.string,
|
||||
setCustomAmount: PropTypes.func,
|
||||
tokenBalance: PropTypes.string,
|
||||
data: PropTypes.string,
|
||||
toAddress: PropTypes.string,
|
||||
currentCurrency: PropTypes.string,
|
||||
@ -243,66 +235,6 @@ export default class ConfirmApproveContent extends Component {
|
||||
);
|
||||
}
|
||||
|
||||
renderERC20PermissionContent() {
|
||||
const { t } = this.context;
|
||||
const {
|
||||
customTokenAmount,
|
||||
tokenAmount,
|
||||
tokenSymbol,
|
||||
origin,
|
||||
toAddress,
|
||||
isContract,
|
||||
} = this.props;
|
||||
|
||||
const displayedAddress = isContract
|
||||
? `${t('contract')} (${addressSummary(toAddress)})`
|
||||
: addressSummary(toAddress);
|
||||
return (
|
||||
<div className="flex-column">
|
||||
<div className="confirm-approve-content__small-text">
|
||||
{t('accessAndSpendNotice', [origin])}
|
||||
</div>
|
||||
<div className="flex-row">
|
||||
<div className="confirm-approve-content__label">
|
||||
{t('approvedAmountWithColon')}
|
||||
</div>
|
||||
<div className="confirm-approve-content__medium-text">
|
||||
{`${Number(customTokenAmount || tokenAmount)} ${tokenSymbol}`}
|
||||
</div>
|
||||
</div>
|
||||
<div className="flex-row">
|
||||
<div className="confirm-approve-content__label">
|
||||
{t('grantedToWithColon')}
|
||||
</div>
|
||||
<div className="confirm-approve-content__medium-text">
|
||||
{`${displayedAddress}`}
|
||||
</div>
|
||||
<div className="confirm-approve-content__medium-text">
|
||||
<Button
|
||||
type="link"
|
||||
className="confirm-approve-content__copy-address"
|
||||
onClick={() => {
|
||||
this.setState({ copied: true });
|
||||
this.copyTimeout = setTimeout(
|
||||
() => this.setState({ copied: false }),
|
||||
SECOND * 3,
|
||||
);
|
||||
copyToClipboard(toAddress);
|
||||
}}
|
||||
title={
|
||||
this.state.copied
|
||||
? t('copiedExclamation')
|
||||
: t('copyToClipboard')
|
||||
}
|
||||
>
|
||||
<CopyIcon size={14} color="var(--color-icon-default)" />
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
renderDataContent() {
|
||||
const { t } = this.context;
|
||||
const { data, isSetApproveForAll, isApprovalOrRejection } = this.props;
|
||||
@ -327,49 +259,8 @@ export default class ConfirmApproveContent extends Component {
|
||||
|
||||
renderFullDetails() {
|
||||
const { t } = this.context;
|
||||
const {
|
||||
assetStandard,
|
||||
showEditApprovalPermissionModal,
|
||||
customTokenAmount,
|
||||
tokenAmount,
|
||||
decimals,
|
||||
origin,
|
||||
setCustomAmount,
|
||||
tokenSymbol,
|
||||
tokenBalance,
|
||||
} = this.props;
|
||||
if (assetStandard === TokenStandard.ERC20) {
|
||||
return (
|
||||
<div className="confirm-approve-content__full-tx-content">
|
||||
<div className="confirm-approve-content__permission">
|
||||
{this.renderApproveContentCard({
|
||||
symbol: <i className="fa fa-user-check" />,
|
||||
title: t('permissionRequest'),
|
||||
content: this.renderERC20PermissionContent(),
|
||||
showEdit: true,
|
||||
onEditClick: () =>
|
||||
showEditApprovalPermissionModal({
|
||||
customTokenAmount,
|
||||
decimals,
|
||||
origin,
|
||||
setCustomAmount,
|
||||
tokenAmount,
|
||||
tokenSymbol,
|
||||
tokenBalance,
|
||||
}),
|
||||
})}
|
||||
</div>
|
||||
<div className="confirm-approve-content__data">
|
||||
{this.renderApproveContentCard({
|
||||
symbol: <i className="fa fa-file" />,
|
||||
title: 'Data',
|
||||
content: this.renderDataContent(),
|
||||
noBorder: true,
|
||||
})}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
} else if (
|
||||
const { assetStandard } = this.props;
|
||||
if (
|
||||
assetStandard === TokenStandard.ERC721 ||
|
||||
assetStandard === TokenStandard.ERC1155
|
||||
) {
|
||||
@ -450,22 +341,11 @@ export default class ConfirmApproveContent extends Component {
|
||||
}
|
||||
|
||||
getTokenName() {
|
||||
const {
|
||||
tokenId,
|
||||
assetName,
|
||||
assetStandard,
|
||||
tokenSymbol,
|
||||
isSetApproveForAll,
|
||||
} = this.props;
|
||||
const { tokenId, assetName, assetStandard, tokenSymbol } = this.props;
|
||||
const { t } = this.context;
|
||||
|
||||
let titleTokenDescription = t('token');
|
||||
if (
|
||||
assetStandard === TokenStandard.ERC20 ||
|
||||
(tokenSymbol && !tokenId && !isSetApproveForAll)
|
||||
) {
|
||||
titleTokenDescription = tokenSymbol;
|
||||
} else if (
|
||||
assetStandard === TokenStandard.ERC721 ||
|
||||
assetStandard === TokenStandard.ERC1155 ||
|
||||
// if we don't have an asset standard but we do have either both an assetname and a tokenID or both a tokenSymbol and tokenId we assume its an NFT
|
||||
@ -604,16 +484,10 @@ export default class ConfirmApproveContent extends Component {
|
||||
render() {
|
||||
const { t } = this.context;
|
||||
const {
|
||||
decimals,
|
||||
siteImage,
|
||||
tokenAmount,
|
||||
customTokenAmount,
|
||||
origin,
|
||||
tokenSymbol,
|
||||
showCustomizeGasModal,
|
||||
showEditApprovalPermissionModal,
|
||||
setCustomAmount,
|
||||
tokenBalance,
|
||||
useNonceField,
|
||||
warning,
|
||||
txData,
|
||||
@ -621,13 +495,10 @@ export default class ConfirmApproveContent extends Component {
|
||||
toAddress,
|
||||
chainId,
|
||||
rpcPrefs,
|
||||
isContract,
|
||||
assetStandard,
|
||||
userAddress,
|
||||
tokenId,
|
||||
tokenAddress,
|
||||
assetName,
|
||||
isSetApproveForAll,
|
||||
} = this.props;
|
||||
const { showFullTxDetails, setshowContractDetails } = this.state;
|
||||
|
||||
@ -672,124 +543,28 @@ export default class ConfirmApproveContent extends Component {
|
||||
<div className="confirm-approve-content__description">
|
||||
{this.renderDescription()}
|
||||
</div>
|
||||
{assetStandard === TokenStandard.ERC20 ||
|
||||
(tokenSymbol && !tokenId && !isSetApproveForAll) ? (
|
||||
<Box className="confirm-approve-content__address-display-content">
|
||||
<Box display={DISPLAY.FLEX}>
|
||||
<Identicon
|
||||
className="confirm-approve-content__address-identicon"
|
||||
diameter={20}
|
||||
address={toAddress}
|
||||
/>
|
||||
<Typography
|
||||
variant={TYPOGRAPHY.H6}
|
||||
fontWeight={FONT_WEIGHT.NORMAL}
|
||||
color={COLORS.TEXT_ALTERNATIVE}
|
||||
boxProps={{ marginBottom: 0 }}
|
||||
>
|
||||
{ellipsify(toAddress)}
|
||||
</Typography>
|
||||
<Button
|
||||
type="link"
|
||||
className="confirm-approve-content__copy-address"
|
||||
onClick={() => {
|
||||
this.setState({ copied: true });
|
||||
this.copyTimeout = setTimeout(
|
||||
() => this.setState({ copied: false }),
|
||||
SECOND * 3,
|
||||
);
|
||||
copyToClipboard(toAddress);
|
||||
}}
|
||||
title={
|
||||
this.state.copied
|
||||
? t('copiedExclamation')
|
||||
: t('copyToClipboard')
|
||||
}
|
||||
>
|
||||
<CopyIcon size={9} color="var(--color-icon-default)" />
|
||||
</Button>
|
||||
<Button
|
||||
type="link"
|
||||
className="confirm-approve-content__etherscan-link"
|
||||
onClick={() => {
|
||||
const blockExplorerTokenLink = isContract
|
||||
? getTokenTrackerLink(
|
||||
toAddress,
|
||||
chainId,
|
||||
null,
|
||||
userAddress,
|
||||
{
|
||||
blockExplorerUrl: rpcPrefs?.blockExplorerUrl ?? null,
|
||||
},
|
||||
)
|
||||
: getAccountLink(
|
||||
toAddress,
|
||||
chainId,
|
||||
{
|
||||
blockExplorerUrl: rpcPrefs?.blockExplorerUrl ?? null,
|
||||
},
|
||||
null,
|
||||
);
|
||||
global.platform.openTab({
|
||||
url: blockExplorerTokenLink,
|
||||
});
|
||||
}}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
title={t('etherscanView')}
|
||||
>
|
||||
<i
|
||||
className="fa fa-share-square fa-sm"
|
||||
style={{ color: 'var(--color-icon-default)', fontSize: 11 }}
|
||||
title={t('etherscanView')}
|
||||
/>
|
||||
</Button>
|
||||
</Box>
|
||||
</Box>
|
||||
) : (
|
||||
<Box marginBottom={4} marginTop={2}>
|
||||
<Button
|
||||
type="link"
|
||||
className="confirm-approve-content__verify-contract-details"
|
||||
onClick={() => this.setState({ setshowContractDetails: true })}
|
||||
>
|
||||
{t('verifyContractDetails')}
|
||||
</Button>
|
||||
{setshowContractDetails && (
|
||||
<ContractDetailsModal
|
||||
onClose={() => this.setState({ setshowContractDetails: false })}
|
||||
tokenName={tokenSymbol}
|
||||
tokenAddress={tokenAddress}
|
||||
toAddress={toAddress}
|
||||
chainId={chainId}
|
||||
rpcPrefs={rpcPrefs}
|
||||
tokenId={tokenId}
|
||||
assetName={assetName}
|
||||
assetStandard={assetStandard}
|
||||
/>
|
||||
)}
|
||||
</Box>
|
||||
)}
|
||||
{assetStandard === TokenStandard.ERC20 ? (
|
||||
<div className="confirm-approve-content__edit-submission-button-container">
|
||||
<div
|
||||
className="confirm-approve-content__medium-link-text cursor-pointer"
|
||||
onClick={() =>
|
||||
showEditApprovalPermissionModal({
|
||||
customTokenAmount,
|
||||
decimals,
|
||||
origin,
|
||||
setCustomAmount,
|
||||
tokenAmount,
|
||||
tokenSymbol,
|
||||
tokenBalance,
|
||||
})
|
||||
}
|
||||
>
|
||||
{t('editPermission')}
|
||||
</div>
|
||||
</div>
|
||||
) : null}
|
||||
<Box marginBottom={4} marginTop={2}>
|
||||
<Button
|
||||
type="link"
|
||||
className="confirm-approve-content__verify-contract-details"
|
||||
onClick={() => this.setState({ setshowContractDetails: true })}
|
||||
>
|
||||
{t('verifyContractDetails')}
|
||||
</Button>
|
||||
{setshowContractDetails && (
|
||||
<ContractDetailsModal
|
||||
onClose={() => this.setState({ setshowContractDetails: false })}
|
||||
tokenName={tokenSymbol}
|
||||
tokenAddress={tokenAddress}
|
||||
toAddress={toAddress}
|
||||
chainId={chainId}
|
||||
rpcPrefs={rpcPrefs}
|
||||
tokenId={tokenId}
|
||||
assetName={assetName}
|
||||
assetStandard={assetStandard}
|
||||
/>
|
||||
)}
|
||||
</Box>
|
||||
<div className="confirm-approve-content__card-wrapper">
|
||||
{this.renderApproveContentCard({
|
||||
symbol: <i className="fa fa-tag" />,
|
||||
|
@ -13,17 +13,12 @@ const renderComponent = (props) => {
|
||||
};
|
||||
|
||||
const props = {
|
||||
decimals: 16,
|
||||
siteImage: 'https://metamask.github.io/test-dapp/metamask-fox.svg',
|
||||
customTokenAmount: '10',
|
||||
tokenAmount: '10',
|
||||
origin: 'https://metamask.github.io/test-dapp/',
|
||||
tokenSymbol: 'TST',
|
||||
assetStandard: TokenStandard.ERC20,
|
||||
tokenSymbol: 'TestDappCollectibles (#1)',
|
||||
assetStandard: TokenStandard.ERC721,
|
||||
tokenImage: 'https://metamask.github.io/test-dapp/metamask-fox.svg',
|
||||
tokenBalance: '15',
|
||||
showCustomizeGasModal: jest.fn(),
|
||||
showEditApprovalPermissionModal: jest.fn(),
|
||||
data: '0x095ea7b30000000000000000000000009bc5baf874d2da8d216ae9f137804184ee5afef40000000000000000000000000000000000000000000000000000000000011170',
|
||||
toAddress: '0x9bc5baf874d2da8d216ae9f137804184ee5afef4',
|
||||
currentCurrency: 'TST',
|
||||
@ -47,21 +42,16 @@ describe('ConfirmApproveContent Component', () => {
|
||||
queryByText('https://metamask.github.io/test-dapp/'),
|
||||
).toBeInTheDocument();
|
||||
expect(getByTestId('confirm-approve-title').textContent).toStrictEqual(
|
||||
' Give permission to access your TST? ',
|
||||
' Allow access to and transfer of your TestDappCollectibles (#1)? ',
|
||||
);
|
||||
expect(
|
||||
queryByText(
|
||||
'By granting permission, you are allowing the following contract to access your funds',
|
||||
'This allows a third party to access and transfer the following NFTs without further notice until you revoke its access.',
|
||||
),
|
||||
).toBeInTheDocument();
|
||||
expect(queryByText('0x9bc5...fef4')).toBeInTheDocument();
|
||||
expect(queryByText('Verify contract details')).toBeInTheDocument();
|
||||
expect(queryByText('View full transaction details')).toBeInTheDocument();
|
||||
|
||||
expect(queryByText('Edit permission')).toBeInTheDocument();
|
||||
const editPermission = getByText('Edit permission');
|
||||
fireEvent.click(editPermission);
|
||||
expect(props.showEditApprovalPermissionModal).toHaveBeenCalledTimes(1);
|
||||
|
||||
const editButtons = getAllByText('Edit');
|
||||
|
||||
expect(queryByText('Transaction fee')).toBeInTheDocument();
|
||||
@ -79,13 +69,21 @@ describe('ConfirmApproveContent Component', () => {
|
||||
|
||||
const showViewTxDetails = getByText('View full transaction details');
|
||||
expect(queryByText('Permission request')).not.toBeInTheDocument();
|
||||
expect(queryByText('Approved amount:')).not.toBeInTheDocument();
|
||||
expect(queryByText('Approved asset:')).not.toBeInTheDocument();
|
||||
expect(queryByText('Granted to:')).not.toBeInTheDocument();
|
||||
expect(queryByText('Data')).not.toBeInTheDocument();
|
||||
fireEvent.click(showViewTxDetails);
|
||||
expect(getByText('Hide full transaction details')).toBeInTheDocument();
|
||||
expect(getByText('Permission request')).toBeInTheDocument();
|
||||
expect(getByText('Approved amount:')).toBeInTheDocument();
|
||||
expect(getByText('Approved asset:')).toBeInTheDocument();
|
||||
expect(getByText('Granted to:')).toBeInTheDocument();
|
||||
expect(getByText('0x9bc5...fef4')).toBeInTheDocument();
|
||||
expect(getByText('Contract (0x9bc5baF8...fEF4)')).toBeInTheDocument();
|
||||
expect(getByText('Data')).toBeInTheDocument();
|
||||
expect(getByText('Function: Approve')).toBeInTheDocument();
|
||||
expect(
|
||||
getByText(
|
||||
'0x095ea7b30000000000000000000000009bc5baf874d2da8d216ae9f137804184ee5afef40000000000000000000000000000000000000000000000000000000000011170',
|
||||
),
|
||||
).toBeInTheDocument();
|
||||
});
|
||||
});
|
||||
|
@ -27,7 +27,6 @@ import {
|
||||
getRpcPrefsForCurrentProvider,
|
||||
getIsMultiLayerFeeNetwork,
|
||||
checkNetworkAndAccountSupports1559,
|
||||
getIsImprovedTokenAllowanceEnabled,
|
||||
} from '../../selectors';
|
||||
import { useApproveTransaction } from '../../hooks/useApproveTransaction';
|
||||
import AdvancedGasFeePopover from '../../components/app/advanced-gas-fee-popover';
|
||||
@ -87,10 +86,6 @@ export default function ConfirmApprove({
|
||||
|
||||
const supportsEIP1559 = networkAndAccountSupports1559;
|
||||
|
||||
const improvedTokenAllowanceEnabled = useSelector(
|
||||
getIsImprovedTokenAllowanceEnabled,
|
||||
);
|
||||
|
||||
const previousTokenAmount = useRef(tokenAmount);
|
||||
const {
|
||||
approveTransaction,
|
||||
@ -142,9 +137,7 @@ export default function ConfirmApprove({
|
||||
const { iconUrl: siteImage = '' } = subjectMetadata[origin] || {};
|
||||
|
||||
let tokensText;
|
||||
if (assetStandard === TokenStandard.ERC20) {
|
||||
tokensText = `${Number(tokenAmount)} ${tokenSymbol}`;
|
||||
} else if (
|
||||
if (
|
||||
assetStandard === TokenStandard.ERC721 ||
|
||||
assetStandard === TokenStandard.ERC1155
|
||||
) {
|
||||
@ -171,7 +164,7 @@ export default function ConfirmApprove({
|
||||
if (assetStandard === undefined) {
|
||||
return <ConfirmContractInteraction />;
|
||||
}
|
||||
if (improvedTokenAllowanceEnabled && assetStandard === TokenStandard.ERC20) {
|
||||
if (assetStandard === TokenStandard.ERC20) {
|
||||
return (
|
||||
<GasFeeContextProvider transaction={transaction}>
|
||||
<TransactionModalContextProvider>
|
||||
@ -234,46 +227,15 @@ export default function ConfirmApprove({
|
||||
userAddress={userAddress}
|
||||
isSetApproveForAll={isSetApproveForAll}
|
||||
isApprovalOrRejection={isApprovalOrRejection}
|
||||
decimals={decimals}
|
||||
siteImage={siteImage}
|
||||
setCustomAmount={setCustomPermissionAmount}
|
||||
customTokenAmount={String(customPermissionAmount)}
|
||||
tokenAmount={tokenAmount}
|
||||
origin={formattedOrigin}
|
||||
tokenSymbol={tokenSymbol}
|
||||
tokenImage={tokenImage}
|
||||
tokenBalance={tokenBalance}
|
||||
tokenId={tokenId}
|
||||
assetName={assetName}
|
||||
assetStandard={assetStandard}
|
||||
tokenAddress={tokenAddress}
|
||||
showCustomizeGasModal={approveTransaction}
|
||||
showEditApprovalPermissionModal={({
|
||||
/* eslint-disable no-shadow */
|
||||
customTokenAmount,
|
||||
decimals,
|
||||
origin,
|
||||
setCustomAmount,
|
||||
tokenAmount,
|
||||
tokenBalance,
|
||||
tokenSymbol,
|
||||
/* eslint-enable no-shadow */
|
||||
}) =>
|
||||
dispatch(
|
||||
showModal({
|
||||
name: 'EDIT_APPROVAL_PERMISSION',
|
||||
customTokenAmount,
|
||||
decimals,
|
||||
origin,
|
||||
setCustomAmount,
|
||||
tokenAmount,
|
||||
tokenBalance,
|
||||
tokenSymbol,
|
||||
tokenId,
|
||||
assetStandard,
|
||||
}),
|
||||
)
|
||||
}
|
||||
data={customData || transactionData}
|
||||
toAddress={toAddress}
|
||||
currentCurrency={currentCurrency}
|
||||
|
@ -24,8 +24,6 @@ export default class ExperimentalTab extends PureComponent {
|
||||
setUseNftDetection: PropTypes.func,
|
||||
setOpenSeaEnabled: PropTypes.func,
|
||||
openSeaEnabled: PropTypes.bool,
|
||||
improvedTokenAllowanceEnabled: PropTypes.bool,
|
||||
setImprovedTokenAllowanceEnabled: PropTypes.func,
|
||||
transactionSecurityCheckEnabled: PropTypes.bool,
|
||||
setTransactionSecurityCheckEnabled: PropTypes.func,
|
||||
};
|
||||
@ -102,43 +100,6 @@ export default class ExperimentalTab extends PureComponent {
|
||||
);
|
||||
}
|
||||
|
||||
renderImprovedTokenAllowanceToggle() {
|
||||
const { t } = this.context;
|
||||
const { improvedTokenAllowanceEnabled, setImprovedTokenAllowanceEnabled } =
|
||||
this.props;
|
||||
|
||||
return (
|
||||
<div ref={this.settingsRefs[2]} className="settings-page__content-row">
|
||||
<div className="settings-page__content-item">
|
||||
<span>{t('improvedTokenAllowance')}</span>
|
||||
<div className="settings-page__content-description">
|
||||
{t('improvedTokenAllowanceDescription')}
|
||||
</div>
|
||||
</div>
|
||||
<div className="settings-page__content-item">
|
||||
<div className="settings-page__content-item-col">
|
||||
<ToggleButton
|
||||
value={improvedTokenAllowanceEnabled}
|
||||
onToggle={(value) => {
|
||||
this.context.trackEvent({
|
||||
category: EVENT.CATEGORIES.SETTINGS,
|
||||
event: 'Enabled/Disable ImprovedTokenAllowance',
|
||||
properties: {
|
||||
action: 'Enabled/Disable ImprovedTokenAllowance',
|
||||
legacy_event: true,
|
||||
},
|
||||
});
|
||||
setImprovedTokenAllowanceEnabled(!value);
|
||||
}}
|
||||
offLabel={t('off')}
|
||||
onLabel={t('on')}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
renderTransactionSecurityCheckToggle() {
|
||||
const { t } = this.context;
|
||||
|
||||
@ -229,7 +190,6 @@ export default class ExperimentalTab extends PureComponent {
|
||||
<div className="settings-page__body">
|
||||
{process.env.TRANSACTION_SECURITY_PROVIDER &&
|
||||
this.renderTransactionSecurityCheckToggle()}
|
||||
{this.renderImprovedTokenAllowanceToggle()}
|
||||
{this.renderOpenSeaEnabledToggle()}
|
||||
</div>
|
||||
);
|
||||
|
@ -4,13 +4,11 @@ import { withRouter } from 'react-router-dom';
|
||||
import {
|
||||
setUseNftDetection,
|
||||
setOpenSeaEnabled,
|
||||
setImprovedTokenAllowanceEnabled,
|
||||
setTransactionSecurityCheckEnabled,
|
||||
} from '../../../store/actions';
|
||||
import {
|
||||
getUseNftDetection,
|
||||
getOpenSeaEnabled,
|
||||
getIsImprovedTokenAllowanceEnabled,
|
||||
getIsTransactionSecurityCheckEnabled,
|
||||
} from '../../../selectors';
|
||||
import ExperimentalTab from './experimental-tab.component';
|
||||
@ -19,7 +17,6 @@ const mapStateToProps = (state) => {
|
||||
return {
|
||||
useNftDetection: getUseNftDetection(state),
|
||||
openSeaEnabled: getOpenSeaEnabled(state),
|
||||
improvedTokenAllowanceEnabled: getIsImprovedTokenAllowanceEnabled(state),
|
||||
transactionSecurityCheckEnabled:
|
||||
getIsTransactionSecurityCheckEnabled(state),
|
||||
};
|
||||
@ -29,8 +26,6 @@ const mapDispatchToProps = (dispatch) => {
|
||||
return {
|
||||
setUseNftDetection: (val) => dispatch(setUseNftDetection(val)),
|
||||
setOpenSeaEnabled: (val) => dispatch(setOpenSeaEnabled(val)),
|
||||
setImprovedTokenAllowanceEnabled: (val) =>
|
||||
dispatch(setImprovedTokenAllowanceEnabled(val)),
|
||||
setTransactionSecurityCheckEnabled: (val) =>
|
||||
dispatch(setTransactionSecurityCheckEnabled(val)),
|
||||
};
|
||||
|
@ -1306,16 +1306,6 @@ export function getIstokenDetectionInactiveOnNonMainnetSupportedNetwork(state) {
|
||||
return isDynamicTokenListAvailable && !useTokenDetection && !isMainnet;
|
||||
}
|
||||
|
||||
/**
|
||||
* To get the `improvedTokenAllowanceEnabled` value which determines whether we use the improved token allowance
|
||||
*
|
||||
* @param {*} state
|
||||
* @returns Boolean
|
||||
*/
|
||||
export function getIsImprovedTokenAllowanceEnabled(state) {
|
||||
return state.metamask.improvedTokenAllowanceEnabled;
|
||||
}
|
||||
|
||||
/**
|
||||
* To get the `transactionSecurityCheckEnabled` value which determines whether we use the transaction security check
|
||||
*
|
||||
|
@ -3811,20 +3811,6 @@ export function setCollectiblesDetectionNoticeDismissed() {
|
||||
]);
|
||||
}
|
||||
|
||||
export function setImprovedTokenAllowanceEnabled(
|
||||
improvedTokenAllowanceEnabled,
|
||||
) {
|
||||
return async () => {
|
||||
try {
|
||||
await submitRequestToBackground('setImprovedTokenAllowanceEnabled', [
|
||||
improvedTokenAllowanceEnabled,
|
||||
]);
|
||||
} catch (error) {
|
||||
log.error(error);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
export function setTransactionSecurityCheckEnabled(
|
||||
transactionSecurityCheckEnabled,
|
||||
) {
|
||||
|
Loading…
Reference in New Issue
Block a user