1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-23 02:10:12 +01:00

Fix i18n merge conflicts

This commit is contained in:
Alexander Tseung 2018-03-29 09:37:29 -07:00
commit ef61ef2ce8
120 changed files with 1994 additions and 839 deletions

View File

@ -6,12 +6,19 @@ workflows:
jobs: jobs:
- prep-deps-npm - prep-deps-npm
- prep-deps-firefox - prep-deps-firefox
- prep-build:
requires:
- prep-deps-npm
- prep-scss: - prep-scss:
requires: requires:
- prep-deps-npm - prep-deps-npm
- test-lint: - test-lint:
requires: requires:
- prep-deps-npm - prep-deps-npm
- test-e2e:
requires:
- prep-build
- prep-deps-npm
- test-unit: - test-unit:
requires: requires:
- prep-deps-npm - prep-deps-npm
@ -33,6 +40,15 @@ workflows:
- prep-deps-npm - prep-deps-npm
- prep-deps-firefox - prep-deps-firefox
- prep-scss - prep-scss
- all-tests-pass:
requires:
- test-lint
- test-unit
- test-e2e
- test-integration-mascara-chrome
- test-integration-mascara-firefox
- test-integration-flat-chrome
- test-integration-flat-firefox
jobs: jobs:
prep-deps-npm: prep-deps-npm:
@ -65,6 +81,23 @@ jobs:
paths: paths:
- firefox - firefox
prep-build:
docker:
- image: circleci/node:8-browsers
steps:
- checkout
- restore_cache:
key: dependency-cache-{{ checksum "package-lock.json" }}
- run:
name: build:dist
command: npm run dist
- run:
name: build:debug
command: find dist/ -type f -exec md5sum {} \; | sort -k 2
- save_cache:
key: build-cache-{{ .Revision }}
paths:
- dist
prep-scss: prep-scss:
docker: docker:
@ -96,6 +129,19 @@ jobs:
name: Test name: Test
command: npm run lint command: npm run lint
test-e2e:
docker:
- image: circleci/node:8-browsers
steps:
- checkout
- restore_cache:
key: dependency-cache-{{ checksum "package-lock.json" }}
- restore_cache:
key: build-cache-{{ .Revision }}
- run:
name: Test
command: npm run test:e2e
test-unit: test-unit:
docker: docker:
- image: circleci/node:8-browsers - image: circleci/node:8-browsers
@ -200,3 +246,11 @@ jobs:
- run: - run:
name: test:integration:mascara name: test:integration:mascara
command: npm run test:mascara command: npm run test:mascara
all-tests-pass:
docker:
- image: circleci/node:8-browsers
steps:
- run:
name: All Tests Passed
command: echo 'weew - everything passed!'

View File

@ -1,6 +1,13 @@
# Changelog # Changelog
## Current Master ## Current Master
- Fix bug where the "Reset account" feature would not clear the network cache.
## 4.4.0 Mon Mar 26 2018
- Internationalization: Taiwanese, Thai, Slovenian
- Fixes bug where MetaMask would not open once its storage grew too large.
- Updates design of new-ui Add Token screen - Updates design of new-ui Add Token screen
- New-ui can send to ens addresses - New-ui can send to ens addresses
- Update new-ui button styles - Update new-ui button styles

View File

@ -185,7 +185,7 @@
}, },
"decimal": { "decimal": {
"message": "Decimals of Precision" "message": "Decimals of Precision"
}, },
"defaultNetwork": { "defaultNetwork": {
"message": "The default network for Ether transactions is Main Net." "message": "The default network for Ether transactions is Main Net."
}, },
@ -235,7 +235,7 @@
"done": { "done": {
"message": "Done" "message": "Done"
}, },
"downloadStatelogs": { "downloadStateLogs": {
"message": "Download State Logs" "message": "Download State Logs"
}, },
"dropped": { "dropped": {
@ -671,6 +671,12 @@
"save": { "save": {
"message": "Save" "message": "Save"
}, },
"reprice_title": {
"message": "Reprice Transaction"
},
"reprice_subtitle": {
"message": "Increase your gas price to attempt to overwrite and speed up your transaction"
},
"saveAsFile": { "saveAsFile": {
"message": "Save as File", "message": "Save as File",
"description": "Account export process" "description": "Account export process"
@ -884,7 +890,7 @@
}, },
"visitWebSite": { "visitWebSite": {
"message": "Visit our web site" "message": "Visit our web site"
}, },
"warning": { "warning": {
"message": "Warning" "message": "Warning"
}, },

19
app/_locales/index.json Normal file
View File

@ -0,0 +1,19 @@
[
{ "code": "de", "name": "German" },
{ "code": "en", "name": "English" },
{ "code": "es", "name": "Spanish" },
{ "code": "fr", "name": "French" },
{ "code": "hn", "name": "Hindi" },
{ "code": "it", "name": "Italian" },
{ "code": "ja", "name": "Japanese" },
{ "code": "ko", "name": "Korean" },
{ "code": "nl", "name": "Dutch" },
{ "code": "ph", "name": "Tagalog" },
{ "code": "pt", "name": "Portuguese" },
{ "code": "ru", "name": "Russian" },
{ "code": "sl", "name": "Slovenian" },
{ "code": "th", "name": "Thai" },
{ "code": "vi", "name": "Vietnamese" },
{ "code": "zh_CN", "name": "Mandarin" },
{ "code": "zh_TW", "name": "Taiwanese" }
]

View File

@ -223,7 +223,7 @@
"done": { "done": {
"message": "Finito" "message": "Finito"
}, },
"downloadStatelogs": { "downloadStateLogs": {
"message": "Scarica i log di Stato" "message": "Scarica i log di Stato"
}, },
"edit": { "edit": {

View File

@ -14,6 +14,9 @@
"address": { "address": {
"message": "アドレス" "message": "アドレス"
}, },
"addCustomToken": {
"message": "カスタムトークンを追加"
},
"addToken": { "addToken": {
"message": "トークンを追加" "message": "トークンを追加"
}, },
@ -63,11 +66,14 @@
"message": "Coinbaseで購入" "message": "Coinbaseで購入"
}, },
"buyCoinbaseExplainer": { "buyCoinbaseExplainer": {
"message": "Coinbaseは、世界で最もポピュラーなBitcoin、Ethereum、そしてLitecoinの取引所です。" "message": "Coinbaseは、世界なBitcoin、Ethereum、そしてLitecoinの取引所です。"
}, },
"cancel": { "cancel": {
"message": "キャンセル" "message": "キャンセル"
}, },
"classicInterface": {
"message": "旧インタフェイスを使用"
},
"clickCopy": { "clickCopy": {
"message": "クリックしてコピー" "message": "クリックしてコピー"
}, },
@ -126,6 +132,9 @@
"message": "暗号通貨", "message": "暗号通貨",
"description": "Exchange type (cryptocurrencies)" "description": "Exchange type (cryptocurrencies)"
}, },
"currentConversion": {
"message": "基軸通貨"
},
"customGas": { "customGas": {
"message": "ガスのカスタマイズ" "message": "ガスのカスタマイズ"
}, },
@ -135,14 +144,17 @@
"customRPC": { "customRPC": {
"message": "カスタムRPC" "message": "カスタムRPC"
}, },
"decimal": {
"message": "小数点桁数"
},
"defaultNetwork": { "defaultNetwork": {
"message": "Etherトランザクションのデフォルトのネットワークはメインネットです。" "message": "デフォルトのEther送受信ネットワークはメインネットです。"
}, },
"denExplainer": { "denExplainer": {
"message": "DENとは、あなたのパスワードが暗号化されたMetaMask内のストレージです。" "message": "DENとは、あなたのパスワードが暗号化されたMetaMask内のストレージです。"
}, },
"deposit": { "deposit": {
"message": "デポジット" "message": "受取り"
}, },
"depositBTC": { "depositBTC": {
"message": "あなたのBTCを次のアドレスへデポジット:" "message": "あなたのBTCを次のアドレスへデポジット:"
@ -161,13 +173,13 @@
"message": "法定通貨でデポジット" "message": "法定通貨でデポジット"
}, },
"depositFromAccount": { "depositFromAccount": {
"message": "別のアカウントからデポジット" "message": "別のアカウントから入金"
}, },
"depositShapeShift": { "depositShapeShift": {
"message": "ShapeShiftでデポジット" "message": "ShapeShiftで入金"
}, },
"depositShapeShiftExplainer": { "depositShapeShiftExplainer": {
"message": "あなたが他の暗号通貨を持っているなら、Etherにトレードしてダイレクトにメタマスクウォレットへのデポジットが可能です。アカウント作成は不要。" "message": "他の暗号通貨をEtherと交換してMetaMaskのウォレットへ入金できます。アカウント作成は不要です。"
}, },
"details": { "details": {
"message": "詳細" "message": "詳細"
@ -176,10 +188,10 @@
"message": "ダイレクトデポジット" "message": "ダイレクトデポジット"
}, },
"directDepositEther": { "directDepositEther": {
"message": "Etherをダイレクトデポジット" "message": "Etherを直接受け取り"
}, },
"directDepositEtherExplainer": { "directDepositEtherExplainer": {
"message": "あなたがEtherをすでにお持ちなら、ダイレクトデポジットは新しいウォレットにEtherを入手する最も迅速な方法です。" "message": "Etherをすでにお持ちなら、MetaMaskの新しいウォレットにEtherを送信することができます。"
}, },
"done": { "done": {
"message": "完了" "message": "完了"
@ -197,7 +209,7 @@
"message": "パスワードを入力" "message": "パスワードを入力"
}, },
"etherscanView": { "etherscanView": {
"message": "Etherscanでアカウントを見る" "message": "Etherscanでアカウントを参照"
}, },
"exchangeRate": { "exchangeRate": {
"message": "交換レート" "message": "交換レート"
@ -257,7 +269,7 @@
"message": "Etherをゲット" "message": "Etherをゲット"
}, },
"getEtherFromFaucet": { "getEtherFromFaucet": {
"message": "フォーセットで $1のEtherをゲット", "message": "フォーセットで $1のEtherを得ることができます。",
"description": "Displays network name for Ether faucet" "description": "Displays network name for Ether faucet"
}, },
"greaterThanMin": { "greaterThanMin": {
@ -281,12 +293,15 @@
"message": "どのようにEtherをデポジットしますか?" "message": "どのようにEtherをデポジットしますか?"
}, },
"import": { "import": {
"message": "インポート", "message": "追加",
"description": "Button to import an account from a selected file" "description": "Button to import an account from a selected file"
}, },
"importAccount": { "importAccount": {
"message": "アカウントのインポート" "message": "アカウントのインポート"
}, },
"importAccountMsg": {
"message":"追加したアカウントはMetaMaskのアカウントシードフレーズとは関連付けられません。インポートしたアカウントについての詳細は"
},
"importAnAccount": { "importAnAccount": {
"message": "アカウントをインポート" "message": "アカウントをインポート"
}, },
@ -298,7 +313,10 @@
"description": "status showing that an account has been fully loaded into the keyring" "description": "status showing that an account has been fully loaded into the keyring"
}, },
"infoHelp": { "infoHelp": {
"message": "インフォメーションとヘルプ" "message": "情報とヘルプ"
},
"insufficientFunds": {
"message": "残高不足"
}, },
"invalidAddress": { "invalidAddress": {
"message": "アドレスが無効です。" "message": "アドレスが無効です。"
@ -354,7 +372,7 @@
"message": "マイアカウント" "message": "マイアカウント"
}, },
"needEtherInWallet": { "needEtherInWallet": {
"message": "MetaMaskを使って分散型アプリケーションと対話するためには、あなたのウォレットにEtherが必要になります。" "message": "MetaMaskを使って分散型アプリケーションを使用するためには、このウォレットにEtherが必要です。"
}, },
"needImportFile": { "needImportFile": {
"message": "インポートするファイルを選択してください。", "message": "インポートするファイルを選択してください。",
@ -383,6 +401,9 @@
"newRecipient": { "newRecipient": {
"message": "新規受取人" "message": "新規受取人"
}, },
"newRPC": {
"message": "新しいRPCのURLを追加"
},
"next": { "next": {
"message": "次へ" "message": "次へ"
}, },
@ -460,12 +481,21 @@
"rejected": { "rejected": {
"message": "拒否されました" "message": "拒否されました"
}, },
"resetAccount": {
"message": "アカウントをリセット"
},
"restoreFromSeed": {
"message": "パスフレーズから復元する"
},
"required": { "required": {
"message": "必要です。" "message": "必要です。"
}, },
"retryWithMoreGas": { "retryWithMoreGas": {
"message": "より高いガスプライスで再度試して下さい。" "message": "より高いガスプライスで再度試して下さい。"
}, },
"revealSeedWords": {
"message": "パスフレーズを表示"
},
"revert": { "revert": {
"message": "元に戻す" "message": "元に戻す"
}, },
@ -495,8 +525,11 @@
"sendTokens": { "sendTokens": {
"message": "トークンを送る" "message": "トークンを送る"
}, },
"onlySendToEtherAddress": {
"message": "ETHはイーサリウムアカウントのみに送信できます。"
},
"sendTokensAnywhere": { "sendTokensAnywhere": {
"message": "イーサリアムのアカウントを持っている人にトークンを送る" "message": "イーサリアムアカウントを持っている人にトークンを送る"
}, },
"settings": { "settings": {
"message": "設定" "message": "設定"
@ -544,9 +577,21 @@
"message": "ShapeShiftで $1をETHにする", "message": "ShapeShiftで $1をETHにする",
"description": "system will fill in deposit type in start of message" "description": "system will fill in deposit type in start of message"
}, },
"tokenAddress": {
"message": "トークンアドレス"
},
"tokenBalance": { "tokenBalance": {
"message": "あなたのトークン残高:" "message": "あなたのトークン残高:"
}, },
"tokenSelection": {
"message": "トークンを検索、またはリストから選択してください。"
},
"tokenSymbol": {
"message": "トークンシンボル"
},
"tokenWarning1": {
"message": "MetaMaskのアカウントで取得したアカウントのみ追加できます。他のアカウントを使用して取得したトークンは、カスタムトークンを使用してください。"
},
"total": { "total": {
"message": "合計" "message": "合計"
}, },
@ -591,6 +636,9 @@
"usedByClients": { "usedByClients": {
"message": "様々なクライアントによって使用されています。" "message": "様々なクライアントによって使用されています。"
}, },
"useOldUI": {
"message": "旧UIに切り替え"
},
"viewAccount": { "viewAccount": {
"message": "アカウントを見る" "message": "アカウントを見る"
}, },

View File

@ -223,7 +223,7 @@
"done": { "done": {
"message": "Finalizado" "message": "Finalizado"
}, },
"downloadStatelogs": { "downloadStateLogs": {
"message": "Descarregar Registos de Estado" "message": "Descarregar Registos de Estado"
}, },
"edit": { "edit": {

View File

@ -171,6 +171,9 @@
"customGas": { "customGas": {
"message": "自訂 Gas" "message": "自訂 Gas"
}, },
"customToken": {
"message": "自訂代幣"
},
"customize": { "customize": {
"message": "自訂" "message": "自訂"
}, },
@ -184,7 +187,7 @@
"message": "小數點精度" "message": "小數點精度"
}, },
"defaultNetwork": { "defaultNetwork": {
"message": "預設Ether交易網路為主網Main Net。" "message": "預設 Ether 交易網路為主網Main Net。"
}, },
"denExplainer": { "denExplainer": {
"message": "你的 DEN 是在你的 MetaMask 中的加密密碼儲存庫。" "message": "你的 DEN 是在你的 MetaMask 中的加密密碼儲存庫。"
@ -215,7 +218,7 @@
"message": "從 ShapeShift 存入" "message": "從 ShapeShift 存入"
}, },
"depositShapeShiftExplainer": { "depositShapeShiftExplainer": {
"message": "如果你擁有其他加密貨幣,你可以直接交易並存入 Ether 到你的MetaMask錢包。不需要開帳戶。" "message": "如果你擁有其他加密貨幣,你可以直接交易並存入 Ether 到你的 MetaMask 錢包。不需要開帳戶。"
}, },
"details": { "details": {
"message": "詳情" "message": "詳情"
@ -227,7 +230,7 @@
"message": "直接存入 Ether" "message": "直接存入 Ether"
}, },
"directDepositEtherExplainer": { "directDepositEtherExplainer": {
"message": "如果你已經擁有了一些Ether使用直接存入功能是讓你的新錢包最快取得Ether的方式。" "message": "如果你已經擁有了一些 Ether使用直接存入功能是讓你的新錢包最快取得 Ether 的方式。"
}, },
"done": { "done": {
"message": "完成" "message": "完成"
@ -285,6 +288,9 @@
"message": "檔案導入失敗?點擊這裡!", "message": "檔案導入失敗?點擊這裡!",
"description": "Helps user import their account from a JSON file" "description": "Helps user import their account from a JSON file"
}, },
"followTwitter": {
"message": "追蹤 Twitter"
},
"from": { "from": {
"message": "來源地址" "message": "來源地址"
}, },
@ -313,6 +319,9 @@
"gasLimitTooLow": { "gasLimitTooLow": {
"message": "Gas 上限至少為 21000" "message": "Gas 上限至少為 21000"
}, },
"generatingSeed": {
"message": "產生助憶詞中..."
},
"gasPrice": { "gasPrice": {
"message": "Gas 價格 (GWEI)" "message": "Gas 價格 (GWEI)"
}, },
@ -362,6 +371,9 @@
"importAccount": { "importAccount": {
"message": "導入帳戶" "message": "導入帳戶"
}, },
"importAccountMsg": {
"message":" 匯入的帳戶與您原有 MetaMask 帳戶的助憶詞並無關聯. 請查看與導入帳戶相關的資料 "
},
"importAnAccount": { "importAnAccount": {
"message": "導入一個帳戶" "message": "導入一個帳戶"
}, },
@ -400,12 +412,15 @@
"message": "無效的 RPC URI" "message": "無效的 RPC URI"
}, },
"jsonFail": { "jsonFail": {
"message": "有東西出錯了. 請確認你的 JSON 檔案格式正確." "message": "有東西出錯了. 請確認你的 JSON 檔案格式正確"
}, },
"jsonFile": { "jsonFile": {
"message": "JSON 檔案", "message": "JSON 檔案",
"description": "format for importing an account" "description": "format for importing an account"
}, },
"keepTrackTokens": {
"message": "持續追蹤您 MetaMask 帳戶中的代幣。"
},
"kovan": { "kovan": {
"message": "Kovan 測試網路" "message": "Kovan 測試網路"
}, },
@ -415,6 +430,9 @@
"max": { "max": {
"message": "最大值" "message": "最大值"
}, },
"learnMore": {
"message": "了解更多。"
},
"lessThanMax": { "lessThanMax": {
"message": "必須小於等於 $1.", "message": "必須小於等於 $1.",
"description": "helper for inputting hex as decimal input" "description": "helper for inputting hex as decimal input"
@ -437,17 +455,20 @@
"localhost": { "localhost": {
"message": "Localhost 8545" "message": "Localhost 8545"
}, },
"login": {
"message": "登入"
},
"logout": { "logout": {
"message": "登出" "message": "登出"
}, },
"loose": { "loose": {
"message": "非Metamask帳號" "message": "非 MetaMask 帳號"
}, },
"loweCaseWords": { "loweCaseWords": {
"message": "助憶詞僅包含小寫字元" "message": "助憶詞僅包含小寫字元"
}, },
"mainnet": { "mainnet": {
"message": "乙太坊網路" "message": "乙太坊網路"
}, },
"message": { "message": {
"message": "訊息" "message": "訊息"
@ -465,7 +486,7 @@
"message": "必須選擇至少 1 代幣." "message": "必須選擇至少 1 代幣."
}, },
"needEtherInWallet": { "needEtherInWallet": {
"message": "要使用 MetaMask 存取 DAPP時,您的錢包中需要有 Ether。" "message": "要使用 MetaMask 存取 DAPP 時,您的錢包中需要有 Ether。"
}, },
"needImportFile": { "needImportFile": {
"message": "您必須選擇一個檔案來導入。", "message": "您必須選擇一個檔案來導入。",
@ -475,6 +496,9 @@
"message": "您必須為選擇好的檔案輸入密碼。", "message": "您必須為選擇好的檔案輸入密碼。",
"description": "Password and file needed to import an account" "description": "Password and file needed to import an account"
}, },
"negativeETH": {
"message": "不能送出負值的 ETH。"
},
"networks": { "networks": {
"message": "網路" "message": "網路"
}, },
@ -525,6 +549,9 @@
"message": "或", "message": "或",
"description": "choice between creating or importing a new account" "description": "choice between creating or importing a new account"
}, },
"passwordCorrect": {
"message": "請確認您的密碼是正確的。"
},
"passwordMismatch": { "passwordMismatch": {
"message": "密碼不一致", "message": "密碼不一致",
"description": "in password creation process, the two new password fields did not match" "description": "in password creation process, the two new password fields did not match"
@ -546,6 +573,12 @@
"pleaseReviewTransaction": { "pleaseReviewTransaction": {
"message": "請檢查你的交易。" "message": "請檢查你的交易。"
}, },
"popularTokens": {
"message": "常見的代幣"
},
"privacyMsg": {
"message": "隱私政策"
},
"privateKey": { "privateKey": {
"message": "私鑰", "message": "私鑰",
"description": "select this type of file to use to import an account" "description": "select this type of file to use to import an account"
@ -681,6 +714,9 @@
"onlySendToEtherAddress": { "onlySendToEtherAddress": {
"message": "只發送 ETH 到乙太坊地址." "message": "只發送 ETH 到乙太坊地址."
}, },
"searchTokens": {
"message": "搜尋代幣"
},
"sendTokensAnywhere": { "sendTokensAnywhere": {
"message": "發送代幣給擁有乙太坊帳戶的任何人" "message": "發送代幣給擁有乙太坊帳戶的任何人"
}, },
@ -700,13 +736,16 @@
"message": "顯示 QR Code" "message": "顯示 QR Code"
}, },
"sign": { "sign": {
"message": "簽名" "message": "簽署"
},
"signed": {
"message": "已簽署"
}, },
"signMessage": { "signMessage": {
"message": "簽署訊息" "message": "簽署訊息"
}, },
"signNotice": { "signNotice": {
"message": "簽署此訊息可能會產生危險的副作用。 \n只從你完全信任的網站上簽名。這種危險的方法;將在未來的版本中被移除。" "message": "簽署此訊息可能會產生危險地副作用。 \n只從你完全信任的網站上簽署。這種危險的方法;將在未來的版本中被移除。"
}, },
"sigRequest": { "sigRequest": {
"message": "請求簽署" "message": "請求簽署"
@ -767,7 +806,7 @@
"message": "代幣餘額:" "message": "代幣餘額:"
}, },
"tokenSelection": { "tokenSelection": {
"message": "搜尋代幣或是從熱門代幣列表中選擇。" "message": "搜尋代幣或是從常見代幣列表中選擇。"
}, },
"tokenSymbol": { "tokenSymbol": {
"message": "代幣代號" "message": "代幣代號"
@ -804,7 +843,7 @@
"message": "歡迎使用新版界面 Beta" "message": "歡迎使用新版界面 Beta"
}, },
"uiWelcomeMessage": { "uiWelcomeMessage": {
"message": "你現在正在使用新的 Metamask 界面。試試諸如發送代幣等新功能,有任何問題請告知我們。" "message": "你現在正在使用新版 MetaMask 界面。試試諸如發送代幣等新功能吧,有任何問題請告知我們。"
}, },
"unapproved": { "unapproved": {
"message": "未同意" "message": "未同意"

View File

@ -1,7 +1,7 @@
{ {
"name": "__MSG_appName__", "name": "__MSG_appName__",
"short_name": "__MSG_appName__", "short_name": "__MSG_appName__",
"version": "4.3.0", "version": "4.4.0",
"manifest_version": 2, "manifest_version": 2,
"author": "https://metamask.io", "author": "https://metamask.io",
"description": "__MSG_appDescription__", "description": "__MSG_appDescription__",

View File

@ -19,7 +19,7 @@ const setupRaven = require('./lib/setupRaven')
const reportFailedTxToSentry = require('./lib/reportFailedTxToSentry') const reportFailedTxToSentry = require('./lib/reportFailedTxToSentry')
const setupMetamaskMeshMetrics = require('./lib/setupMetamaskMeshMetrics') const setupMetamaskMeshMetrics = require('./lib/setupMetamaskMeshMetrics')
const EdgeEncryptor = require('./edge-encryptor') const EdgeEncryptor = require('./edge-encryptor')
const getFirstPreferredLangCode = require('./lib/get-first-preferred-lang-code')
const STORAGE_KEY = 'metamask-config' const STORAGE_KEY = 'metamask-config'
const METAMASK_DEBUG = 'GULP_METAMASK_DEBUG' const METAMASK_DEBUG = 'GULP_METAMASK_DEBUG'
@ -58,7 +58,8 @@ setupMetamaskMeshMetrics()
async function initialize () { async function initialize () {
const initState = await loadStateFromPersistence() const initState = await loadStateFromPersistence()
await setupController(initState) const initLangCode = await getFirstPreferredLangCode()
await setupController(initState, initLangCode)
log.debug('MetaMask initialization complete.') log.debug('MetaMask initialization complete.')
} }
@ -84,17 +85,16 @@ async function loadStateFromPersistence () {
// write to disk // write to disk
if (localStore.isSupported) localStore.set(versionedData) if (localStore.isSupported) localStore.set(versionedData)
diskStore.putState(versionedData)
// return just the data // return just the data
return versionedData.data return versionedData.data
} }
function setupController (initState) { function setupController (initState, initLangCode) {
// //
// MetaMask Controller // MetaMask Controller
// //
const controller = new MetamaskController({ const controller = new MetamaskController({
// User confirmation callbacks: // User confirmation callbacks:
showUnconfirmedMessage: triggerUi, showUnconfirmedMessage: triggerUi,
@ -102,6 +102,8 @@ function setupController (initState) {
showUnapprovedTx: triggerUi, showUnapprovedTx: triggerUi,
// initial state // initial state
initState, initState,
// initial locale code
initLangCode,
// platform specific api // platform specific api
platform, platform,
encryptor: isEdge ? new EdgeEncryptor() : undefined, encryptor: isEdge ? new EdgeEncryptor() : undefined,
@ -121,7 +123,6 @@ function setupController (initState) {
debounce(1000), debounce(1000),
storeTransform(versionifyData), storeTransform(versionifyData),
storeTransform(syncDataWithExtension), storeTransform(syncDataWithExtension),
asStream(diskStore),
(error) => { (error) => {
log.error('pump hit error', error) log.error('pump hit error', error)
} }

View File

@ -52,7 +52,7 @@ class CurrencyController {
this.setConversionDate(Number(parsedResponse.timestamp)) this.setConversionDate(Number(parsedResponse.timestamp))
}).catch((err) => { }).catch((err) => {
if (err) { if (err) {
console.warn('MetaMask - Failed to query currency conversion.') console.warn(`MetaMask - Failed to query currency conversion:`, currentCurrency, err)
this.setConversionRate(0) this.setConversionRate(0)
this.setConversionDate('N/A') this.setConversionDate('N/A')
} }

View File

@ -11,6 +11,7 @@ class PreferencesController {
tokens: [], tokens: [],
useBlockie: false, useBlockie: false,
featureFlags: {}, featureFlags: {},
currentLocale: opts.initLangCode,
}, opts.initState) }, opts.initState)
this.store = new ObservableStore(initState) this.store = new ObservableStore(initState)
} }
@ -24,6 +25,10 @@ class PreferencesController {
return this.store.getState().useBlockie return this.store.getState().useBlockie
} }
setCurrentLocale (key) {
this.store.updateState({ currentLocale: key })
}
setSelectedAddress (_address) { setSelectedAddress (_address) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
const address = normalizeAddress(_address) const address = normalizeAddress(_address)

View File

@ -250,7 +250,7 @@ module.exports = class TransactionController extends EventEmitter {
// wait for a nonce // wait for a nonce
nonceLock = await this.nonceTracker.getNonceLock(fromAddress) nonceLock = await this.nonceTracker.getNonceLock(fromAddress)
// add nonce to txParams // add nonce to txParams
// if txMeta has lastGasPrice then it is a retry at same nonce with higher // if txMeta has lastGasPrice then it is a retry at same nonce with higher
// gas price transaction and their for the nonce should not be calculated // gas price transaction and their for the nonce should not be calculated
const nonce = txMeta.lastGasPrice ? txMeta.txParams.nonce : nonceLock.nextNonce const nonce = txMeta.lastGasPrice ? txMeta.txParams.nonce : nonceLock.nextNonce
txMeta.txParams.nonce = ethUtil.addHexPrefix(nonce.toString(16)) txMeta.txParams.nonce = ethUtil.addHexPrefix(nonce.toString(16))
@ -273,12 +273,14 @@ module.exports = class TransactionController extends EventEmitter {
async signTransaction (txId) { async signTransaction (txId) {
const txMeta = this.txStateManager.getTx(txId) const txMeta = this.txStateManager.getTx(txId)
const txParams = txMeta.txParams
const fromAddress = txParams.from
// add network/chain id // add network/chain id
txParams.chainId = ethUtil.addHexPrefix(this.getChainId().toString(16)) const chainId = this.getChainId()
const txParams = Object.assign({}, txMeta.txParams, { chainId })
// sign tx
const fromAddress = txParams.from
const ethTx = new Transaction(txParams) const ethTx = new Transaction(txParams)
await this.signEthTx(ethTx, fromAddress) await this.signEthTx(ethTx, fromAddress)
// set state to signed
this.txStateManager.setTxStatusSigned(txMeta.id) this.txStateManager.setTxStatusSigned(txMeta.id)
const rawTx = ethUtil.bufferToHex(ethTx.serialize()) const rawTx = ethUtil.bufferToHex(ethTx.serialize())
return rawTx return rawTx

View File

@ -0,0 +1,27 @@
const ethJsRpcSlug = 'Error: [ethjs-rpc] rpc error with payload '
const errorLabelPrefix = 'Error: '
module.exports = extractEthjsErrorMessage
//
// ethjs-rpc provides overly verbose error messages
// if we detect this type of message, we extract the important part
// Below is an example input and output
//
// Error: [ethjs-rpc] rpc error with payload {"id":3947817945380,"jsonrpc":"2.0","params":["0xf8eb8208708477359400830398539406012c8cf97bead5deae237070f9587f8e7a266d80b8843d7d3f5a0000000000000000000000000000000000000000000000000000000000081d1a000000000000000000000000000000000000000000000000001ff973cafa800000000000000000000000000000000000000000000000000000038d7ea4c68000000000000000000000000000000000000000000000000000000000000003f48025a04c32a9b630e0d9e7ff361562d850c86b7a884908135956a7e4a336fa0300d19ca06830776423f25218e8d19b267161db526e66895567147015b1f3fc47aef9a3c7"],"method":"eth_sendRawTransaction"} Error: replacement transaction underpriced
//
// Transaction Failed: replacement transaction underpriced
//
function extractEthjsErrorMessage(errorMessage) {
const isEthjsRpcError = errorMessage.includes(ethJsRpcSlug)
if (isEthjsRpcError) {
const payloadAndError = errorMessage.slice(ethJsRpcSlug.length)
const originalError = payloadAndError.slice(payloadAndError.indexOf(errorLabelPrefix) + errorLabelPrefix.length)
return originalError
} else {
return errorMessage
}
}

View File

@ -0,0 +1,16 @@
const extension = require('extensionizer')
const promisify = require('pify')
const allLocales = require('../../_locales/index.json')
const existingLocaleCodes = allLocales.map(locale => locale.code)
async function getFirstPreferredLangCode () {
const userPreferredLocaleCodes = await promisify(
extension.i18n.getAcceptLanguages,
{ errorFirst: false }
)()
const firstPreferredLangCode = userPreferredLocaleCodes.find(code => existingLocaleCodes.includes(code))
return firstPreferredLangCode || 'en'
}
module.exports = getFirstPreferredLangCode

View File

@ -1,5 +1,4 @@
const ethJsRpcSlug = 'Error: [ethjs-rpc] rpc error with payload ' const extractEthjsErrorMessage = require('./extractEthjsErrorMessage')
const errorLabelPrefix = 'Error: '
module.exports = reportFailedTxToSentry module.exports = reportFailedTxToSentry
@ -9,30 +8,9 @@ module.exports = reportFailedTxToSentry
// //
function reportFailedTxToSentry({ raven, txMeta }) { function reportFailedTxToSentry({ raven, txMeta }) {
const errorMessage = extractErrorMessage(txMeta.err.message) const errorMessage = 'Transaction Failed: ' + extractEthjsErrorMessage(txMeta.err.message)
raven.captureMessage(errorMessage, { raven.captureMessage(errorMessage, {
// "extra" key is required by Sentry // "extra" key is required by Sentry
extra: txMeta, extra: txMeta,
}) })
} }
//
// ethjs-rpc provides overly verbose error messages
// if we detect this type of message, we extract the important part
// Below is an example input and output
//
// Error: [ethjs-rpc] rpc error with payload {"id":3947817945380,"jsonrpc":"2.0","params":["0xf8eb8208708477359400830398539406012c8cf97bead5deae237070f9587f8e7a266d80b8843d7d3f5a0000000000000000000000000000000000000000000000000000000000081d1a000000000000000000000000000000000000000000000000001ff973cafa800000000000000000000000000000000000000000000000000000038d7ea4c68000000000000000000000000000000000000000000000000000000000000003f48025a04c32a9b630e0d9e7ff361562d850c86b7a884908135956a7e4a336fa0300d19ca06830776423f25218e8d19b267161db526e66895567147015b1f3fc47aef9a3c7"],"method":"eth_sendRawTransaction"} Error: replacement transaction underpriced
//
// Transaction Failed: replacement transaction underpriced
//
function extractErrorMessage(errorMessage) {
const isEthjsRpcError = errorMessage.includes(ethJsRpcSlug)
if (isEthjsRpcError) {
const payloadAndError = errorMessage.slice(ethJsRpcSlug.length)
const originalError = payloadAndError.slice(payloadAndError.indexOf(errorLabelPrefix) + errorLabelPrefix.length)
return `Transaction Failed: ${originalError}`
} else {
return `Transaction Failed: ${errorMessage}`
}
}

View File

@ -1,5 +1,6 @@
const Raven = require('raven-js') const Raven = require('raven-js')
const METAMASK_DEBUG = 'GULP_METAMASK_DEBUG' const METAMASK_DEBUG = 'GULP_METAMASK_DEBUG'
const extractEthjsErrorMessage = require('./extractEthjsErrorMessage')
const PROD = 'https://3567c198f8a8412082d32655da2961d0@sentry.io/273505' const PROD = 'https://3567c198f8a8412082d32655da2961d0@sentry.io/273505'
const DEV = 'https://f59f3dd640d2429d9d0e2445a87ea8e1@sentry.io/273496' const DEV = 'https://f59f3dd640d2429d9d0e2445a87ea8e1@sentry.io/273496'
@ -21,8 +22,22 @@ function setupRaven(opts) {
const client = Raven.config(ravenTarget, { const client = Raven.config(ravenTarget, {
release, release,
transport: function(opts) { transport: function(opts) {
// modify report urls
const report = opts.data const report = opts.data
// simplify certain complex error messages
report.exception.values.forEach(item => {
let errorMessage = item.value
// simplify ethjs error messages
errorMessage = extractEthjsErrorMessage(errorMessage)
// simplify 'Transaction Failed: known transaction'
if (errorMessage.indexOf('Transaction Failed: known transaction') === 0) {
// cut the hash from the error message
errorMessage = 'Transaction Failed: known transaction'
}
// finalize
item.value = errorMessage
})
// modify report urls
rewriteReportUrls(report) rewriteReportUrls(report)
// make request normally // make request normally
client._makeRequest(opts) client._makeRequest(opts)

View File

@ -38,11 +38,6 @@ module.exports = class TransactionStateManager extends EventEmitter {
}, opts) }, opts)
} }
// Returns the number of txs for the current network.
getTxCount () {
return this.getTxList().length
}
getTxList () { getTxList () {
const network = this.getNetwork() const network = this.getNetwork()
const fullTxList = this.getFullTxList() const fullTxList = this.getFullTxList()
@ -88,7 +83,7 @@ module.exports = class TransactionStateManager extends EventEmitter {
txMeta.history.push(snapshot) txMeta.history.push(snapshot)
const transactions = this.getFullTxList() const transactions = this.getFullTxList()
const txCount = this.getTxCount() const txCount = transactions.length
const txHistoryLimit = this.txHistoryLimit const txHistoryLimit = this.txHistoryLimit
// checks if the length of the tx history is // checks if the length of the tx history is
@ -111,12 +106,9 @@ module.exports = class TransactionStateManager extends EventEmitter {
} }
updateTx (txMeta, note) { updateTx (txMeta, note) {
// validate txParams
if (txMeta.txParams) { if (txMeta.txParams) {
Object.keys(txMeta.txParams).forEach((key) => { this.validateTxParams(txMeta.txParams)
const value = txMeta.txParams[key]
if (typeof value !== 'string') console.error(`${key}: ${value} in txParams is not a string`)
if (!ethUtil.isHexPrefixed(value)) console.error('is not hex prefixed, anything on txParams must be hex prefixed')
})
} }
// create txMeta snapshot for history // create txMeta snapshot for history
@ -144,6 +136,15 @@ module.exports = class TransactionStateManager extends EventEmitter {
this.updateTx(txMeta, `txStateManager#updateTxParams`) this.updateTx(txMeta, `txStateManager#updateTxParams`)
} }
// validates txParams members by type
validateTxParams(txParams) {
Object.keys(txParams).forEach((key) => {
const value = txParams[key]
if (typeof value !== 'string') throw new Error(`${key}: ${value} in txParams is not a string`)
if (!ethUtil.isHexPrefixed(value)) throw new Error('is not hex prefixed, everything on txParams must be hex prefixed')
})
}
/* /*
Takes an object of fields to search for eg: Takes an object of fields to search for eg:
let thingsToLookFor = { let thingsToLookFor = {

View File

@ -49,7 +49,7 @@ module.exports = class MetamaskController extends EventEmitter {
/** /**
* @constructor * @constructor
* @param {Object} opts * @param {Object} opts
*/ */
constructor (opts) { constructor (opts) {
super() super()
@ -57,7 +57,7 @@ module.exports = class MetamaskController extends EventEmitter {
this.defaultMaxListeners = 20 this.defaultMaxListeners = 20
this.sendUpdate = debounce(this.privateSendUpdate.bind(this), 200) this.sendUpdate = debounce(this.privateSendUpdate.bind(this), 200)
this.opts = opts this.opts = opts
const initState = opts.initState || {} const initState = opts.initState || {}
this.recordFirstTimeInfo(initState) this.recordFirstTimeInfo(initState)
@ -82,6 +82,7 @@ module.exports = class MetamaskController extends EventEmitter {
// preferences controller // preferences controller
this.preferencesController = new PreferencesController({ this.preferencesController = new PreferencesController({
initState: initState.PreferencesController, initState: initState.PreferencesController,
initLangCode: opts.initLangCode,
}) })
// currency controller // currency controller
@ -296,8 +297,8 @@ module.exports = class MetamaskController extends EventEmitter {
/** /**
* The metamask-state of the various controllers, made available to the UI * The metamask-state of the various controllers, made available to the UI
* *
* @returns {Object} status * @returns {Object} status
*/ */
getState () { getState () {
const wallet = this.configManager.getWallet() const wallet = this.configManager.getWallet()
@ -335,8 +336,8 @@ module.exports = class MetamaskController extends EventEmitter {
/** /**
* Returns an api-object which is consumed by the UI * Returns an api-object which is consumed by the UI
* *
* @returns {Object} * @returns {Object}
*/ */
getApi () { getApi () {
const keyringController = this.keyringController const keyringController = this.keyringController
@ -351,6 +352,7 @@ module.exports = class MetamaskController extends EventEmitter {
getState: (cb) => cb(null, this.getState()), getState: (cb) => cb(null, this.getState()),
setCurrentCurrency: this.setCurrentCurrency.bind(this), setCurrentCurrency: this.setCurrentCurrency.bind(this),
setUseBlockie: this.setUseBlockie.bind(this), setUseBlockie: this.setUseBlockie.bind(this),
setCurrentLocale: this.setCurrentLocale.bind(this),
markAccountsFound: this.markAccountsFound.bind(this), markAccountsFound: this.markAccountsFound.bind(this),
markPasswordForgotten: this.markPasswordForgotten.bind(this), markPasswordForgotten: this.markPasswordForgotten.bind(this),
unMarkPasswordForgotten: this.unMarkPasswordForgotten.bind(this), unMarkPasswordForgotten: this.unMarkPasswordForgotten.bind(this),
@ -365,7 +367,7 @@ module.exports = class MetamaskController extends EventEmitter {
placeSeedWords: this.placeSeedWords.bind(this), placeSeedWords: this.placeSeedWords.bind(this),
verifySeedPhrase: nodeify(this.verifySeedPhrase, this), verifySeedPhrase: nodeify(this.verifySeedPhrase, this),
clearSeedWordCache: this.clearSeedWordCache.bind(this), clearSeedWordCache: this.clearSeedWordCache.bind(this),
resetAccount: this.resetAccount.bind(this), resetAccount: nodeify(this.resetAccount, this),
importAccountWithStrategy: this.importAccountWithStrategy.bind(this), importAccountWithStrategy: this.importAccountWithStrategy.bind(this),
// vault management // vault management
@ -426,14 +428,14 @@ module.exports = class MetamaskController extends EventEmitter {
/** /**
* Creates a new Vault(?) and create a new keychain(?) * Creates a new Vault(?) and create a new keychain(?)
* *
* A vault is ... * A vault is ...
* *
* A keychain is ... * A keychain is ...
* *
* *
* @param {} password * @param {} password
* *
* @returns {} vault * @returns {} vault
*/ */
async createNewVaultAndKeychain (password) { async createNewVaultAndKeychain (password) {
@ -479,9 +481,9 @@ module.exports = class MetamaskController extends EventEmitter {
/** /**
* Retrieves the first Identiy from the passed Vault and selects the related address * Retrieves the first Identiy from the passed Vault and selects the related address
* *
* An Identity is ... * An Identity is ...
* *
* @param {} vault * @param {} vault
*/ */
selectFirstIdentity (vault) { selectFirstIdentity (vault) {
@ -495,8 +497,8 @@ module.exports = class MetamaskController extends EventEmitter {
// //
/** /**
* Adds a new account to ... * Adds a new account to ...
* *
* @returns {} keyState * @returns {} keyState
*/ */
async addNewAccount () { async addNewAccount () {
@ -522,10 +524,10 @@ module.exports = class MetamaskController extends EventEmitter {
/** /**
* Adds the current vault's seed words to the UI's state tree. * Adds the current vault's seed words to the UI's state tree.
* *
* Used when creating a first vault, to allow confirmation. * Used when creating a first vault, to allow confirmation.
* Also used when revealing the seed words in the confirmation view. * Also used when revealing the seed words in the confirmation view.
*/ */
placeSeedWords (cb) { placeSeedWords (cb) {
this.verifySeedPhrase() this.verifySeedPhrase()
@ -540,7 +542,7 @@ module.exports = class MetamaskController extends EventEmitter {
/** /**
* Verifies the validity of the current vault's seed phrase. * Verifies the validity of the current vault's seed phrase.
* *
* Validity: seed phrase restores the accounts belonging to the current vault. * Validity: seed phrase restores the accounts belonging to the current vault.
* *
* Called when the first account is created and on unlocking the vault. * Called when the first account is created and on unlocking the vault.
@ -571,27 +573,32 @@ module.exports = class MetamaskController extends EventEmitter {
/** /**
* Remove the primary account seed phrase from the UI's state tree. * Remove the primary account seed phrase from the UI's state tree.
* *
* The seed phrase remains available in the background process. * The seed phrase remains available in the background process.
* *
*/ */
clearSeedWordCache (cb) { clearSeedWordCache (cb) {
this.configManager.setSeedWords(null) this.configManager.setSeedWords(null)
cb(null, this.preferencesController.getSelectedAddress()) cb(null, this.preferencesController.getSelectedAddress())
} }
/** /**
* ? * ?
*/ */
resetAccount (cb) { async resetAccount (cb) {
const selectedAddress = this.preferencesController.getSelectedAddress() const selectedAddress = this.preferencesController.getSelectedAddress()
this.txController.wipeTransactions(selectedAddress) this.txController.wipeTransactions(selectedAddress)
cb(null, selectedAddress)
const networkController = this.networkController
const oldType = networkController.getProviderConfig().type
await networkController.setProviderType(oldType, true)
return selectedAddress
} }
/** /**
* Imports an account ... ? * Imports an account ... ?
* *
* @param {} strategy * @param {} strategy
* @param {} args * @param {} args
* @param {} cb * @param {} cb
@ -634,9 +641,9 @@ module.exports = class MetamaskController extends EventEmitter {
} }
// Prefixed Style Message Signing Methods: // Prefixed Style Message Signing Methods:
/** /**
* *
* @param {} msgParams * @param {} msgParams
* @param {} cb * @param {} cb
*/ */
@ -655,7 +662,7 @@ module.exports = class MetamaskController extends EventEmitter {
} }
}) })
} }
/** /**
* @param {} msgParams * @param {} msgParams
*/ */
@ -676,7 +683,7 @@ module.exports = class MetamaskController extends EventEmitter {
return this.getState() return this.getState()
}) })
} }
/** /**
* @param {} msgParams * @param {} msgParams
*/ */
@ -697,13 +704,13 @@ module.exports = class MetamaskController extends EventEmitter {
return this.getState() return this.getState()
}) })
} }
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
// Account Restauration // Account Restauration
/** /**
* ? * ?
* *
* @param {} migratorOutput * @param {} migratorOutput
*/ */
restoreOldVaultAccounts (migratorOutput) { restoreOldVaultAccounts (migratorOutput) {
@ -714,7 +721,7 @@ module.exports = class MetamaskController extends EventEmitter {
/** /**
* ? * ?
* *
* @param {} migratorOutput * @param {} migratorOutput
*/ */
restoreOldLostAccounts (migratorOutput) { restoreOldLostAccounts (migratorOutput) {
@ -728,9 +735,9 @@ module.exports = class MetamaskController extends EventEmitter {
/** /**
* Import (lost) Accounts * Import (lost) Accounts
* *
* @param {Object} {lostAccounts} @Array accounts <{ address, privateKey }> * @param {Object} {lostAccounts} @Array accounts <{ address, privateKey }>
* *
* Uses the array's private keys to create a new Simple Key Pair keychain * Uses the array's private keys to create a new Simple Key Pair keychain
* and add it to the keyring controller. * and add it to the keyring controller.
*/ */
@ -823,7 +830,7 @@ module.exports = class MetamaskController extends EventEmitter {
if (cb && typeof cb === 'function') { if (cb && typeof cb === 'function') {
cb(null, this.getState()) cb(null, this.getState())
} }
} }
cancelPersonalMessage (msgId, cb) { cancelPersonalMessage (msgId, cb) {
const messageManager = this.personalMessageManager const messageManager = this.personalMessageManager
@ -978,7 +985,7 @@ module.exports = class MetamaskController extends EventEmitter {
const percentileNum = percentile(50, lowestPrices) const percentileNum = percentile(50, lowestPrices)
const percentileNumBn = new BN(percentileNum) const percentileNumBn = new BN(percentileNum)
return '0x' + percentileNumBn.mul(GWEI_BN).toString(16) return '0x' + percentileNumBn.mul(GWEI_BN).toString(16)
} }
//============================================================================= //=============================================================================
// CONFIG // CONFIG
@ -1029,6 +1036,15 @@ module.exports = class MetamaskController extends EventEmitter {
} }
} }
setCurrentLocale (key, cb) {
try {
this.preferencesController.setCurrentLocale(key)
cb(null)
} catch (err) {
cb(err)
}
}
recordFirstTimeInfo (initState) { recordFirstTimeInfo (initState) {
if (!('firstTimeInfo' in initState)) { if (!('firstTimeInfo' in initState)) {
initState.firstTimeInfo = { initState.firstTimeInfo = {

View File

@ -0,0 +1,50 @@
const version = 23
/*
This migration removes transactions that are no longer usefull down to 40 total
*/
const clone = require('clone')
module.exports = {
version,
migrate: function (originalVersionedData) {
const versionedData = clone(originalVersionedData)
versionedData.meta.version = version
try {
const state = versionedData.data
const newState = transformState(state)
versionedData.data = newState
} catch (err) {
console.warn(`MetaMask Migration #${version}` + err.stack)
}
return Promise.resolve(versionedData)
},
}
function transformState (state) {
const newState = state
const transactions = newState.TransactionController.transactions
if (transactions.length <= 40) return newState
let reverseTxList = transactions.reverse()
let stripping = true
while (reverseTxList.length > 40 && stripping) {
let txIndex = reverseTxList.findIndex((txMeta) => {
return (txMeta.status === 'failed' ||
txMeta.status === 'rejected' ||
txMeta.status === 'confirmed' ||
txMeta.status === 'dropped')
})
if (txIndex < 0) stripping = false
else reverseTxList.splice(txIndex, 1)
}
newState.TransactionController.transactions = reverseTxList.reverse()
return newState
}

View File

@ -32,4 +32,6 @@ module.exports = [
require('./019'), require('./019'),
require('./020'), require('./020'),
require('./021'), require('./021'),
require('./022'),
require('./023'),
] ]

View File

@ -10,69 +10,75 @@ const NotificationManager = require('./lib/notification-manager')
const notificationManager = new NotificationManager() const notificationManager = new NotificationManager()
const setupRaven = require('./lib/setupRaven') const setupRaven = require('./lib/setupRaven')
// create platform global start().catch(log.error)
global.platform = new ExtensionPlatform()
// setup sentry error reporting async function start() {
const release = global.platform.getVersion()
setupRaven({ release })
// inject css // create platform global
// const css = MetaMaskUiCss() global.platform = new ExtensionPlatform()
// injectCss(css)
// identify window type (popup, notification) // setup sentry error reporting
const windowType = isPopupOrNotification() const release = global.platform.getVersion()
global.METAMASK_UI_TYPE = windowType setupRaven({ release })
closePopupIfOpen(windowType)
// setup stream to background // inject css
const extensionPort = extension.runtime.connect({ name: windowType }) // const css = MetaMaskUiCss()
const connectionStream = new PortStream(extensionPort) // injectCss(css)
// start ui // identify window type (popup, notification)
const container = document.getElementById('app-content') const windowType = isPopupOrNotification()
startPopup({ container, connectionStream }, (err, store) => { global.METAMASK_UI_TYPE = windowType
if (err) return displayCriticalError(err) closePopupIfOpen(windowType)
// Code commented out until we begin auto adding users to NewUI // setup stream to background
// const { isMascara, identities = {}, featureFlags = {} } = store.getState().metamask const extensionPort = extension.runtime.connect({ name: windowType })
// const firstTime = Object.keys(identities).length === 0 const connectionStream = new PortStream(extensionPort)
const { isMascara, featureFlags = {} } = store.getState().metamask
let betaUIState = featureFlags.betaUI
// Code commented out until we begin auto adding users to NewUI // start ui
// const useBetaCss = isMascara || firstTime || betaUIState const container = document.getElementById('app-content')
const useBetaCss = isMascara || betaUIState startPopup({ container, connectionStream }, (err, store) => {
if (err) return displayCriticalError(err)
let css = useBetaCss ? NewMetaMaskUiCss() : OldMetaMaskUiCss() // Code commented out until we begin auto adding users to NewUI
let deleteInjectedCss = injectCss(css) // const { isMascara, identities = {}, featureFlags = {} } = store.getState().metamask
let newBetaUIState // const firstTime = Object.keys(identities).length === 0
const { isMascara, featureFlags = {} } = store.getState().metamask
let betaUIState = featureFlags.betaUI
store.subscribe(() => { // Code commented out until we begin auto adding users to NewUI
const state = store.getState() // const useBetaCss = isMascara || firstTime || betaUIState
newBetaUIState = state.metamask.featureFlags.betaUI const useBetaCss = isMascara || betaUIState
if (newBetaUIState !== betaUIState) {
deleteInjectedCss() let css = useBetaCss ? NewMetaMaskUiCss() : OldMetaMaskUiCss()
betaUIState = newBetaUIState let deleteInjectedCss = injectCss(css)
css = betaUIState ? NewMetaMaskUiCss() : OldMetaMaskUiCss() let newBetaUIState
deleteInjectedCss = injectCss(css)
} store.subscribe(() => {
if (state.appState.shouldClose) notificationManager.closePopup() const state = store.getState()
newBetaUIState = state.metamask.featureFlags.betaUI
if (newBetaUIState !== betaUIState) {
deleteInjectedCss()
betaUIState = newBetaUIState
css = betaUIState ? NewMetaMaskUiCss() : OldMetaMaskUiCss()
deleteInjectedCss = injectCss(css)
}
if (state.appState.shouldClose) notificationManager.closePopup()
})
}) })
})
function closePopupIfOpen (windowType) { function closePopupIfOpen (windowType) {
if (windowType !== 'notification') { if (windowType !== 'notification') {
// should close only chrome popup // should close only chrome popup
notificationManager.closePopup() notificationManager.closePopup()
}
}
function displayCriticalError (err) {
container.innerHTML = '<div class="critical-error">The MetaMask app failed to load: please open and close MetaMask again to restart.</div>'
container.style.height = '80px'
log.error(err.stack)
throw err
} }
}
function displayCriticalError (err) {
container.innerHTML = '<div class="critical-error">The MetaMask app failed to load: please open and close MetaMask again to restart.</div>'
container.style.height = '80px'
log.error(err.stack)
throw err
} }

View File

@ -1,6 +1,8 @@
const fs = require('fs') const fs = require('fs')
const path = require('path') const path = require('path')
const promisify = require('pify') const promisify = require('pify')
const enLocaleMessages = require('../app/_locales/en/messages.json')
start().catch(console.error) start().catch(console.error)
@ -12,6 +14,9 @@ async function start () {
const stateFilePath = path.join(__dirname, 'states', stateFileName) const stateFilePath = path.join(__dirname, 'states', stateFileName)
const stateFileContent = await promisify(fs.readFile)(stateFilePath, 'utf8') const stateFileContent = await promisify(fs.readFile)(stateFilePath, 'utf8')
const state = JSON.parse(stateFileContent) const state = JSON.parse(stateFileContent)
state.localeMessages = { en: enLocaleMessages, current: {} }
const stateName = stateFileName.split('.')[0].replace(/-/g, ' ', 'g') const stateName = stateFileName.split('.')[0].replace(/-/g, ' ', 'g')
states[stateName] = state states[stateName] = state
})) }))

View File

@ -106,7 +106,8 @@
"errors": {}, "errors": {},
"maxModeOn": false, "maxModeOn": false,
"editingTransactionId": null "editingTransactionId": null
} },
"currentLocale": "en"
}, },
"appState": { "appState": {
"menuOpen": false, "menuOpen": false,

View File

@ -128,7 +128,8 @@
"errors": {}, "errors": {},
"maxModeOn": false, "maxModeOn": false,
"editingTransactionId": null "editingTransactionId": null
} },
"currentLocale": "en"
}, },
"appState": { "appState": {
"menuOpen": false, "menuOpen": false,

View File

@ -149,7 +149,8 @@
"errors": {}, "errors": {},
"maxModeOn": false, "maxModeOn": false,
"editingTransactionId": null "editingTransactionId": null
} },
"currentLocale": "en"
}, },
"appState": { "appState": {
"menuOpen": false, "menuOpen": false,

View File

@ -36,7 +36,8 @@
}, },
"shapeShiftTxList": [], "shapeShiftTxList": [],
"lostAccounts": [], "lostAccounts": [],
"tokens": [] "tokens": [],
"currentLocale": "en"
}, },
"appState": { "appState": {
"menuOpen": false, "menuOpen": false,

View File

@ -128,7 +128,8 @@
"errors": {}, "errors": {},
"maxModeOn": false, "maxModeOn": false,
"editingTransactionId": null "editingTransactionId": null
} },
"currentLocale": "en"
}, },
"appState": { "appState": {
"menuOpen": false, "menuOpen": false,

View File

@ -107,7 +107,8 @@
"errors": {}, "errors": {},
"maxModeOn": false, "maxModeOn": false,
"editingTransactionId": null "editingTransactionId": null
} },
"currentLocale": "en"
}, },
"appState": { "appState": {
"menuOpen": false, "menuOpen": false,

View File

@ -168,7 +168,6 @@ ConfigScreen.prototype.render = function () {
h('a', { h('a', {
href: 'http://metamask.helpscoutdocs.com/article/36-resetting-an-account', href: 'http://metamask.helpscoutdocs.com/article/36-resetting-an-account',
target: '_blank', target: '_blank',
onClick (event) { this.navigateTo(event.target.href) },
}, 'Read more.'), }, 'Read more.'),
]), ]),
h('br'), h('br'),
@ -260,7 +259,3 @@ function currentProviderDisplay (metamaskState) {
h('span', value), h('span', value),
]) ])
} }
ConfigScreen.prototype.navigateTo = function (url) {
global.platform.openWindow({ url })
}

327
package-lock.json generated
View File

@ -224,6 +224,15 @@
} }
} }
}, },
"@sinonjs/formatio": {
"version": "2.0.0",
"resolved": "http://registry.npmjs.org/@sinonjs/formatio/-/formatio-2.0.0.tgz",
"integrity": "sha512-ls6CAMA6/5gG+O/IdsBcblvnd8qcO/l1TYoNeAzp3wcISOxlPXQEus0mLcdwazEkWjaBdaJ3TaxmNgCLWwvWzg==",
"dev": true,
"requires": {
"samsam": "1.3.0"
}
},
"@types/node": { "@types/node": {
"version": "8.5.5", "version": "8.5.5",
"resolved": "https://registry.npmjs.org/@types/node/-/node-8.5.5.tgz", "resolved": "https://registry.npmjs.org/@types/node/-/node-8.5.5.tgz",
@ -2994,6 +3003,19 @@
"readdirp": "2.1.0" "readdirp": "2.1.0"
} }
}, },
"chromedriver": {
"version": "2.36.0",
"resolved": "https://registry.npmjs.org/chromedriver/-/chromedriver-2.36.0.tgz",
"integrity": "sha512-Lq2HrigCJ4RVdIdCmchenv1rVrejNSJ7EUCQojycQo12ww3FedQx4nb+GgTdqMhjbOMTqq5+ziaiZlrEN2z1gQ==",
"dev": true,
"requires": {
"del": "3.0.0",
"extract-zip": "1.6.6",
"kew": "0.7.0",
"mkdirp": "0.5.1",
"request": "2.83.0"
}
},
"cipher-base": { "cipher-base": {
"version": "1.0.4", "version": "1.0.4",
"resolved": "https://registry.npmjs.org/cipher-base/-/cipher-base-1.0.4.tgz", "resolved": "https://registry.npmjs.org/cipher-base/-/cipher-base-1.0.4.tgz",
@ -5189,12 +5211,20 @@
"dev": true "dev": true
}, },
"eslint-plugin-mocha": { "eslint-plugin-mocha": {
"version": "4.11.0", "version": "5.0.0",
"resolved": "https://registry.npmjs.org/eslint-plugin-mocha/-/eslint-plugin-mocha-4.11.0.tgz", "resolved": "https://registry.npmjs.org/eslint-plugin-mocha/-/eslint-plugin-mocha-5.0.0.tgz",
"integrity": "sha1-kRk6L1XiCl41l0BUoAidMBmO5Xg=", "integrity": "sha512-mpRWWsjxRco2bY4qE5DL8SmGoVF0Onb6DZrbgOjFoNo1YNN299K2voIozd8Kce3qC/neWNr2XF27E1ZDMl1yZg==",
"dev": true, "dev": true,
"requires": { "requires": {
"ramda": "0.24.1" "ramda": "0.25.0"
},
"dependencies": {
"ramda": {
"version": "0.25.0",
"resolved": "https://registry.npmjs.org/ramda/-/ramda-0.25.0.tgz",
"integrity": "sha512-GXpfrYVPwx3K7RQ6aYT8KPS8XViSXUVJT1ONhoKPE9VAleW42YE+U+8VEyGWt41EnEQW7gwecYJriTI0pKoecQ==",
"dev": true
}
} }
}, },
"eslint-plugin-react": { "eslint-plugin-react": {
@ -5339,6 +5369,11 @@
"json-rpc-error": "2.0.0", "json-rpc-error": "2.0.0",
"promise-to-callback": "1.0.0" "promise-to-callback": "1.0.0"
} }
},
"pify": {
"version": "2.3.0",
"resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz",
"integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw="
} }
} }
}, },
@ -5652,6 +5687,13 @@
"ethjs-util": "0.1.4", "ethjs-util": "0.1.4",
"pify": "2.3.0", "pify": "2.3.0",
"tape": "4.8.0" "tape": "4.8.0"
},
"dependencies": {
"pify": {
"version": "2.3.0",
"resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz",
"integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw="
}
} }
}, },
"ethjs-format": { "ethjs-format": {
@ -6065,12 +6107,12 @@
} }
}, },
"ethjs-query": { "ethjs-query": {
"version": "0.3.2", "version": "0.3.4",
"resolved": "https://registry.npmjs.org/ethjs-query/-/ethjs-query-0.3.2.tgz", "resolved": "https://registry.npmjs.org/ethjs-query/-/ethjs-query-0.3.4.tgz",
"integrity": "sha1-9IikjOGZTNTHfsy3tSkCxvKc/YU=", "integrity": "sha512-RkeLtBwuXJkBIf/U+Az0GOT203UiBLmN7WA6WZIwSTbmhH2yNicggwaWKvN3TOtpErOsXnzYTZp82mElHdORUQ==",
"requires": { "requires": {
"ethjs-format": "0.2.4", "ethjs-format": "0.2.5",
"ethjs-rpc": "0.1.8" "ethjs-rpc": "0.1.9"
}, },
"dependencies": { "dependencies": {
"bn.js": { "bn.js": {
@ -6079,12 +6121,12 @@
"integrity": "sha1-UzRK2xRhehP26N0s4okF0cC6MhU=" "integrity": "sha1-UzRK2xRhehP26N0s4okF0cC6MhU="
}, },
"ethjs-format": { "ethjs-format": {
"version": "0.2.4", "version": "0.2.5",
"resolved": "https://registry.npmjs.org/ethjs-format/-/ethjs-format-0.2.4.tgz", "resolved": "https://registry.npmjs.org/ethjs-format/-/ethjs-format-0.2.5.tgz",
"integrity": "sha1-W7vESlrSTmirOTMS/5A5pztlv4E=", "integrity": "sha1-RPMKvuF7B01xYtLIhqv/0GWCiSU=",
"requires": { "requires": {
"bn.js": "4.11.6", "bn.js": "4.11.6",
"ethjs-schema": "0.1.9", "ethjs-schema": "0.2.0",
"ethjs-util": "0.1.3", "ethjs-util": "0.1.3",
"is-hex-prefixed": "1.0.0", "is-hex-prefixed": "1.0.0",
"number-to-bn": "1.7.0", "number-to-bn": "1.7.0",
@ -6092,9 +6134,14 @@
} }
}, },
"ethjs-rpc": { "ethjs-rpc": {
"version": "0.1.8", "version": "0.1.9",
"resolved": "https://registry.npmjs.org/ethjs-rpc/-/ethjs-rpc-0.1.8.tgz", "resolved": "https://registry.npmjs.org/ethjs-rpc/-/ethjs-rpc-0.1.9.tgz",
"integrity": "sha1-FnZ0DkHHIoGWpxGJ0z8VychbWZ0=" "integrity": "sha512-KJqT7cgTeCJQ2RY1AlVmTZVnKIUXMPg+niPN5VJKwRSzpjgfr3LTVHlGbkRCqZtOMDi0ogB2vHZaRQiZBXZTUg=="
},
"ethjs-schema": {
"version": "0.2.0",
"resolved": "https://registry.npmjs.org/ethjs-schema/-/ethjs-schema-0.2.0.tgz",
"integrity": "sha1-B7RtT1W3kqhGyQp58zDTHREsyjg="
}, },
"ethjs-util": { "ethjs-util": {
"version": "0.1.3", "version": "0.1.3",
@ -6382,6 +6429,35 @@
"is-extglob": "1.0.0" "is-extglob": "1.0.0"
} }
}, },
"extract-zip": {
"version": "1.6.6",
"resolved": "https://registry.npmjs.org/extract-zip/-/extract-zip-1.6.6.tgz",
"integrity": "sha1-EpDt6NINCHK0Kf0/NRyhKOxe+Fw=",
"dev": true,
"requires": {
"concat-stream": "1.6.0",
"debug": "2.6.9",
"mkdirp": "0.5.0",
"yauzl": "2.4.1"
},
"dependencies": {
"minimist": {
"version": "0.0.8",
"resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz",
"integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=",
"dev": true
},
"mkdirp": {
"version": "0.5.0",
"resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.0.tgz",
"integrity": "sha1-HXMHam35hs2TROFecfzAWkyavxI=",
"dev": true,
"requires": {
"minimist": "0.0.8"
}
}
}
},
"extsprintf": { "extsprintf": {
"version": "1.3.0", "version": "1.3.0",
"resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.3.0.tgz", "resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.3.0.tgz",
@ -6490,6 +6566,15 @@
} }
} }
}, },
"fd-slicer": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/fd-slicer/-/fd-slicer-1.0.1.tgz",
"integrity": "sha1-i1vL2ewyfFBBv5qwI/1nUPEXfmU=",
"dev": true,
"requires": {
"pend": "1.2.0"
}
},
"fetch-ponyfill": { "fetch-ponyfill": {
"version": "4.1.0", "version": "4.1.0",
"resolved": "https://registry.npmjs.org/fetch-ponyfill/-/fetch-ponyfill-4.1.0.tgz", "resolved": "https://registry.npmjs.org/fetch-ponyfill/-/fetch-ponyfill-4.1.0.tgz",
@ -7002,6 +7087,13 @@
"pify": "2.3.0", "pify": "2.3.0",
"pinkie-promise": "2.0.1", "pinkie-promise": "2.0.1",
"rimraf": "2.6.2" "rimraf": "2.6.2"
},
"dependencies": {
"pify": {
"version": "2.3.0",
"resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz",
"integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw="
}
} }
} }
} }
@ -8306,6 +8398,13 @@
"object-assign": "4.1.1", "object-assign": "4.1.1",
"pify": "2.3.0", "pify": "2.3.0",
"pinkie-promise": "2.0.1" "pinkie-promise": "2.0.1"
},
"dependencies": {
"pify": {
"version": "2.3.0",
"resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz",
"integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw="
}
} }
}, },
"globjoin": { "globjoin": {
@ -11159,6 +11258,53 @@
"array-includes": "3.0.3" "array-includes": "3.0.3"
} }
}, },
"jszip": {
"version": "3.1.5",
"resolved": "https://registry.npmjs.org/jszip/-/jszip-3.1.5.tgz",
"integrity": "sha512-5W8NUaFRFRqTOL7ZDDrx5qWHJyBXy6velVudIzQUSoqAAYqzSh2Z7/m0Rf1QbmQJccegD0r+YZxBjzqoBiEeJQ==",
"dev": true,
"requires": {
"core-js": "2.3.0",
"es6-promise": "3.0.2",
"lie": "3.1.1",
"pako": "1.0.6",
"readable-stream": "2.0.6"
},
"dependencies": {
"core-js": {
"version": "2.3.0",
"resolved": "https://registry.npmjs.org/core-js/-/core-js-2.3.0.tgz",
"integrity": "sha1-+rg/uwstjchfpjbEudNMdUIMbWU=",
"dev": true
},
"es6-promise": {
"version": "3.0.2",
"resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-3.0.2.tgz",
"integrity": "sha1-AQ1YWEI6XxGJeWZfRkhqlcbuK7Y=",
"dev": true
},
"readable-stream": {
"version": "2.0.6",
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.0.6.tgz",
"integrity": "sha1-j5A0HmilPMySh4jaz80Rs265t44=",
"dev": true,
"requires": {
"core-util-is": "1.0.2",
"inherits": "2.0.3",
"isarray": "1.0.0",
"process-nextick-args": "1.0.7",
"string_decoder": "0.10.31",
"util-deprecate": "1.0.2"
}
},
"string_decoder": {
"version": "0.10.31",
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz",
"integrity": "sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ=",
"dev": true
}
}
},
"just-debounce": { "just-debounce": {
"version": "1.0.0", "version": "1.0.0",
"resolved": "https://registry.npmjs.org/just-debounce/-/just-debounce-1.0.0.tgz", "resolved": "https://registry.npmjs.org/just-debounce/-/just-debounce-1.0.0.tgz",
@ -11454,6 +11600,12 @@
"sha3": "1.2.0" "sha3": "1.2.0"
} }
}, },
"kew": {
"version": "0.7.0",
"resolved": "https://registry.npmjs.org/kew/-/kew-0.7.0.tgz",
"integrity": "sha1-edk9LTM2PW/dKXCzNdkUGtWR15s=",
"dev": true
},
"kind-of": { "kind-of": {
"version": "3.2.2", "version": "3.2.2",
"resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz",
@ -11765,6 +11917,23 @@
"integrity": "sha1-9ebgatdLeU+1tbZpiL9yjvHe2+g=", "integrity": "sha1-9ebgatdLeU+1tbZpiL9yjvHe2+g=",
"dev": true "dev": true
}, },
"lie": {
"version": "3.1.1",
"resolved": "https://registry.npmjs.org/lie/-/lie-3.1.1.tgz",
"integrity": "sha1-mkNrLMd0bKWd56QfpGmz77dr2H4=",
"dev": true,
"requires": {
"immediate": "3.0.6"
},
"dependencies": {
"immediate": {
"version": "3.0.6",
"resolved": "https://registry.npmjs.org/immediate/-/immediate-3.0.6.tgz",
"integrity": "sha1-nbHb0Pr43m++D13V5Wu2BigN5ps=",
"dev": true
}
}
},
"liftoff": { "liftoff": {
"version": "2.5.0", "version": "2.5.0",
"resolved": "https://registry.npmjs.org/liftoff/-/liftoff-2.5.0.tgz", "resolved": "https://registry.npmjs.org/liftoff/-/liftoff-2.5.0.tgz",
@ -11796,6 +11965,13 @@
"pify": "2.3.0", "pify": "2.3.0",
"pinkie-promise": "2.0.1", "pinkie-promise": "2.0.1",
"strip-bom": "2.0.0" "strip-bom": "2.0.0"
},
"dependencies": {
"pify": {
"version": "2.3.0",
"resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz",
"integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw="
}
} }
}, },
"loader-runner": { "loader-runner": {
@ -12305,9 +12481,9 @@
"integrity": "sha1-rgyqVhERSYxboTcj1vtjHSQAOTQ=" "integrity": "sha1-rgyqVhERSYxboTcj1vtjHSQAOTQ="
}, },
"lolex": { "lolex": {
"version": "2.3.1", "version": "2.3.2",
"resolved": "https://registry.npmjs.org/lolex/-/lolex-2.3.1.tgz", "resolved": "https://registry.npmjs.org/lolex/-/lolex-2.3.2.tgz",
"integrity": "sha512-mQuW55GhduF3ppo+ZRUTz1PRjEh1hS5BbqU7d8D0ez2OKxHDod7StPPeAVKisZR5aLkHZjdGWSL42LSONUJsZw==", "integrity": "sha512-A5pN2tkFj7H0dGIAM6MFvHKMJcPnjZsOMvR7ujCjfgW5TbV6H9vb1PgxLtHvjqNZTHsUolz+6/WEO0N1xNx2ng==",
"dev": true "dev": true
}, },
"longest": { "longest": {
@ -13492,14 +13668,14 @@
"dev": true "dev": true
}, },
"nise": { "nise": {
"version": "1.2.0", "version": "1.3.2",
"resolved": "https://registry.npmjs.org/nise/-/nise-1.2.0.tgz", "resolved": "https://registry.npmjs.org/nise/-/nise-1.3.2.tgz",
"integrity": "sha512-q9jXh3UNsMV28KeqI43ILz5+c3l+RiNW8mhurEwCKckuHQbL+hTJIKKTiUlCPKlgQ/OukFvSnKB/Jk3+sFbkGA==", "integrity": "sha512-KPKb+wvETBiwb4eTwtR/OsA2+iijXP+VnlSFYJo3EHjm2yjek1NWxHOUQat3i7xNLm1Bm18UA5j5Wor0yO2GtA==",
"dev": true, "dev": true,
"requires": { "requires": {
"formatio": "1.2.0", "@sinonjs/formatio": "2.0.0",
"just-extend": "1.1.27", "just-extend": "1.1.27",
"lolex": "1.6.0", "lolex": "2.3.2",
"path-to-regexp": "1.7.0", "path-to-regexp": "1.7.0",
"text-encoding": "0.6.4" "text-encoding": "0.6.4"
}, },
@ -13510,12 +13686,6 @@
"integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8=", "integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8=",
"dev": true "dev": true
}, },
"lolex": {
"version": "1.6.0",
"resolved": "https://registry.npmjs.org/lolex/-/lolex-1.6.0.tgz",
"integrity": "sha1-OpoCg0UqR9dDnnJzG54H1zhuSfY=",
"dev": true
},
"path-to-regexp": { "path-to-regexp": {
"version": "1.7.0", "version": "1.7.0",
"resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-1.7.0.tgz", "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-1.7.0.tgz",
@ -16340,6 +16510,13 @@
"graceful-fs": "4.1.11", "graceful-fs": "4.1.11",
"pify": "2.3.0", "pify": "2.3.0",
"pinkie-promise": "2.0.1" "pinkie-promise": "2.0.1"
},
"dependencies": {
"pify": {
"version": "2.3.0",
"resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz",
"integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw="
}
} }
}, },
"pathval": { "pathval": {
@ -16369,6 +16546,12 @@
"sha.js": "2.4.9" "sha.js": "2.4.9"
} }
}, },
"pend": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/pend/-/pend-1.2.0.tgz",
"integrity": "sha1-elfrVQpng/kRUzH89GY9XI4AelA=",
"dev": true
},
"percentile": { "percentile": {
"version": "1.2.0", "version": "1.2.0",
"resolved": "https://registry.npmjs.org/percentile/-/percentile-1.2.0.tgz", "resolved": "https://registry.npmjs.org/percentile/-/percentile-1.2.0.tgz",
@ -16380,9 +16563,9 @@
"integrity": "sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns=" "integrity": "sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns="
}, },
"pify": { "pify": {
"version": "2.3.0", "version": "3.0.0",
"resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", "resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz",
"integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=" "integrity": "sha1-5aSs0sEB/fPZpNB/DbxNtJ3SgXY="
}, },
"ping-pong-stream": { "ping-pong-stream": {
"version": "1.0.0", "version": "1.0.0",
@ -18331,6 +18514,29 @@
"safe-buffer": "5.1.1" "safe-buffer": "5.1.1"
} }
}, },
"selenium-webdriver": {
"version": "3.6.0",
"resolved": "https://registry.npmjs.org/selenium-webdriver/-/selenium-webdriver-3.6.0.tgz",
"integrity": "sha512-WH7Aldse+2P5bbFBO4Gle/nuQOdVwpHMTL6raL3uuBj/vPG07k6uzt3aiahu352ONBr5xXh0hDlM3LhtXPOC4Q==",
"dev": true,
"requires": {
"jszip": "3.1.5",
"rimraf": "2.6.2",
"tmp": "0.0.30",
"xml2js": "0.4.19"
},
"dependencies": {
"tmp": {
"version": "0.0.30",
"resolved": "https://registry.npmjs.org/tmp/-/tmp-0.0.30.tgz",
"integrity": "sha1-ckGdSovn1s51FI/YsyTlk6cRwu0=",
"dev": true,
"requires": {
"os-tmpdir": "1.0.2"
}
}
}
},
"semaphore": { "semaphore": {
"version": "1.1.0", "version": "1.1.0",
"resolved": "https://registry.npmjs.org/semaphore/-/semaphore-1.1.0.tgz", "resolved": "https://registry.npmjs.org/semaphore/-/semaphore-1.1.0.tgz",
@ -18505,16 +18711,16 @@
"integrity": "sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0=" "integrity": "sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0="
}, },
"sinon": { "sinon": {
"version": "4.1.3", "version": "5.0.0",
"resolved": "https://registry.npmjs.org/sinon/-/sinon-4.1.3.tgz", "resolved": "https://registry.npmjs.org/sinon/-/sinon-5.0.0.tgz",
"integrity": "sha512-c7u0ZuvBRX1eXuB4jN3BRCAOGiUTlM8SE3TxbJHrNiHUKL7wonujMOB6Fi1gQc00U91IscFORQHDga/eccqpbw==", "integrity": "sha512-dMX7ZB2E1iQ5DOEOePoNJQp03uyhdMfb+kLXlNPbquv2FwfezD+0GbbHSgCw4MFhpSSS9NMoYJfOPMjCMJtXWA==",
"dev": true, "dev": true,
"requires": { "requires": {
"diff": "3.3.1", "diff": "3.3.1",
"formatio": "1.2.0", "formatio": "1.2.0",
"lodash.get": "4.4.2", "lodash.get": "4.4.2",
"lolex": "2.3.1", "lolex": "2.3.2",
"nise": "1.2.0", "nise": "1.3.2",
"supports-color": "4.5.0", "supports-color": "4.5.0",
"type-detect": "4.0.5" "type-detect": "4.0.5"
}, },
@ -19636,6 +19842,14 @@
"object-assign": "4.1.1", "object-assign": "4.1.1",
"pify": "2.3.0", "pify": "2.3.0",
"pinkie-promise": "2.0.1" "pinkie-promise": "2.0.1"
},
"dependencies": {
"pify": {
"version": "2.3.0",
"resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz",
"integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=",
"dev": true
}
} }
}, },
"has-flag": { "has-flag": {
@ -19900,6 +20114,12 @@
"integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=",
"dev": true "dev": true
}, },
"pify": {
"version": "2.3.0",
"resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz",
"integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=",
"dev": true
},
"postcss": { "postcss": {
"version": "5.2.18", "version": "5.2.18",
"resolved": "https://registry.npmjs.org/postcss/-/postcss-5.2.18.tgz", "resolved": "https://registry.npmjs.org/postcss/-/postcss-5.2.18.tgz",
@ -21504,6 +21724,12 @@
"integrity": "sha1-uI+UqCzzi4eR1YBG6kAprYjKmdE=", "integrity": "sha1-uI+UqCzzi4eR1YBG6kAprYjKmdE=",
"dev": true "dev": true
}, },
"pify": {
"version": "2.3.0",
"resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz",
"integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=",
"dev": true
},
"replace-ext": { "replace-ext": {
"version": "0.0.1", "version": "0.0.1",
"resolved": "https://registry.npmjs.org/replace-ext/-/replace-ext-0.0.1.tgz", "resolved": "https://registry.npmjs.org/replace-ext/-/replace-ext-0.0.1.tgz",
@ -22243,6 +22469,22 @@
"integrity": "sha1-TYuPHszTQZqjYgYb7O9RXh5VljU=", "integrity": "sha1-TYuPHszTQZqjYgYb7O9RXh5VljU=",
"dev": true "dev": true
}, },
"xml2js": {
"version": "0.4.19",
"resolved": "https://registry.npmjs.org/xml2js/-/xml2js-0.4.19.tgz",
"integrity": "sha512-esZnJZJOiJR9wWKMyuvSE1y6Dq5LCuJanqhxslH2bxM6duahNZ+HMpCLhBQGZkbX6xRf8x1Y2eJlgt2q3qo49Q==",
"dev": true,
"requires": {
"sax": "1.2.4",
"xmlbuilder": "9.0.7"
}
},
"xmlbuilder": {
"version": "9.0.7",
"resolved": "https://registry.npmjs.org/xmlbuilder/-/xmlbuilder-9.0.7.tgz",
"integrity": "sha1-Ey7mPS7FVlxVfiD0wi35rKaGsQ0=",
"dev": true
},
"xmldom": { "xmldom": {
"version": "0.1.27", "version": "0.1.27",
"resolved": "https://registry.npmjs.org/xmldom/-/xmldom-0.1.27.tgz", "resolved": "https://registry.npmjs.org/xmldom/-/xmldom-0.1.27.tgz",
@ -22310,6 +22552,15 @@
"camelcase": "3.0.0" "camelcase": "3.0.0"
} }
}, },
"yauzl": {
"version": "2.4.1",
"resolved": "https://registry.npmjs.org/yauzl/-/yauzl-2.4.1.tgz",
"integrity": "sha1-lSj0QtqxsihOWLQ3m7GU4i4MQAU=",
"dev": true,
"requires": {
"fd-slicer": "1.0.1"
}
},
"yazl": { "yazl": {
"version": "2.4.3", "version": "2.4.3",
"resolved": "https://registry.npmjs.org/yazl/-/yazl-2.4.3.tgz", "resolved": "https://registry.npmjs.org/yazl/-/yazl-2.4.3.tgz",

View File

@ -17,16 +17,19 @@
"test:single": "cross-env METAMASK_ENV=test mocha --require test/helper.js", "test:single": "cross-env METAMASK_ENV=test mocha --require test/helper.js",
"test:integration": "npm run test:integration:build && npm run test:flat && npm run test:mascara", "test:integration": "npm run test:integration:build && npm run test:flat && npm run test:mascara",
"test:integration:build": "gulp build:scss", "test:integration:build": "gulp build:scss",
"test:e2e": "METAMASK_ENV=test mocha test/e2e/metamask.spec --recursive",
"test:coverage": "nyc npm run test:unit && npm run test:coveralls-upload", "test:coverage": "nyc npm run test:unit && npm run test:coveralls-upload",
"test:coveralls-upload": "if [ $COVERALLS_REPO_TOKEN ]; then nyc report --reporter=text-lcov | coveralls; fi", "test:coveralls-upload": "if [ $COVERALLS_REPO_TOKEN ]; then nyc report --reporter=text-lcov | coveralls; fi",
"test:flat": "npm run test:flat:build && karma start test/flat.conf.js", "test:flat": "npm run test:flat:build && karma start test/flat.conf.js",
"test:flat:build": "npm run test:flat:build:ui && npm run test:flat:build:tests", "test:flat:build": "npm run test:flat:build:ui && npm run test:flat:build:tests && npm run test:flat:build:locales",
"test:flat:build:tests": "node test/integration/index.js", "test:flat:build:tests": "node test/integration/index.js",
"test:flat:build:states": "node development/genStates.js", "test:flat:build:states": "node development/genStates.js",
"test:flat:build:locales": "mkdirp dist/chrome && cp -R app/_locales dist/chrome/_locales",
"test:flat:build:ui": "npm run test:flat:build:states && browserify ./development/mock-dev.js -o ./development/bundle.js", "test:flat:build:ui": "npm run test:flat:build:states && browserify ./development/mock-dev.js -o ./development/bundle.js",
"test:mascara": "npm run test:mascara:build && karma start test/mascara.conf.js", "test:mascara": "npm run test:mascara:build && karma start test/mascara.conf.js",
"test:mascara:build": "mkdirp dist/mascara && npm run test:mascara:build:ui && npm run test:mascara:build:background && npm run test:mascara:build:tests", "test:mascara:build": "mkdirp dist/mascara && npm run test:mascara:build:ui && npm run test:mascara:build:background && npm run test:mascara:build:tests && npm run test:mascara:build:locales",
"test:mascara:build:ui": "browserify mascara/test/test-ui.js -o dist/mascara/ui.js", "test:mascara:build:ui": "browserify mascara/test/test-ui.js -o dist/mascara/ui.js",
"test:mascara:build:locales": "mkdirp dist/chrome && cp -R app/_locales dist/chrome/_locales",
"test:mascara:build:background": "browserify mascara/src/background.js -o dist/mascara/background.js", "test:mascara:build:background": "browserify mascara/src/background.js -o dist/mascara/background.js",
"test:mascara:build:tests": "browserify test/integration/lib/first-time.js -o dist/mascara/tests.js", "test:mascara:build:tests": "browserify test/integration/lib/first-time.js -o dist/mascara/tests.js",
"sentry": "export RELEASE=`cat app/manifest.json| jq -r .version` && npm run sentry:release && npm run sentry:upload", "sentry": "export RELEASE=`cat app/manifest.json| jq -r .version` && npm run sentry:release && npm run sentry:upload",
@ -106,7 +109,7 @@
"ethjs": "^0.2.8", "ethjs": "^0.2.8",
"ethjs-contract": "^0.1.9", "ethjs-contract": "^0.1.9",
"ethjs-ens": "^2.0.0", "ethjs-ens": "^2.0.0",
"ethjs-query": "^0.3.1", "ethjs-query": "^0.3.4",
"express": "^4.15.5", "express": "^4.15.5",
"extension-link-enabler": "^1.0.0", "extension-link-enabler": "^1.0.0",
"extensionizer": "^1.0.0", "extensionizer": "^1.0.0",
@ -141,6 +144,7 @@
"obs-store": "^3.0.0", "obs-store": "^3.0.0",
"once": "^1.3.3", "once": "^1.3.3",
"percentile": "^1.2.0", "percentile": "^1.2.0",
"pify": "^3.0.0",
"ping-pong-stream": "^1.0.0", "ping-pong-stream": "^1.0.0",
"pojo-migrator": "^2.1.0", "pojo-migrator": "^2.1.0",
"polyfill-crypto.getrandomvalues": "^1.0.0", "polyfill-crypto.getrandomvalues": "^1.0.0",
@ -203,6 +207,7 @@
"brfs": "^1.4.3", "brfs": "^1.4.3",
"browserify": "^16.1.1", "browserify": "^16.1.1",
"chai": "^4.1.0", "chai": "^4.1.0",
"chromedriver": "^2.34.1",
"compression": "^1.7.1", "compression": "^1.7.1",
"coveralls": "^3.0.0", "coveralls": "^3.0.0",
"cross-env": "^5.1.4", "cross-env": "^5.1.4",
@ -212,7 +217,7 @@
"enzyme": "^3.3.0", "enzyme": "^3.3.0",
"enzyme-adapter-react-15": "^1.0.5", "enzyme-adapter-react-15": "^1.0.5",
"eslint-plugin-chai": "0.0.1", "eslint-plugin-chai": "0.0.1",
"eslint-plugin-mocha": "^4.9.0", "eslint-plugin-mocha": "^5.0.0",
"eslint-plugin-react": "^7.4.0", "eslint-plugin-react": "^7.4.0",
"eth-json-rpc-middleware": "^1.2.7", "eth-json-rpc-middleware": "^1.2.7",
"fs-promise": "^2.0.3", "fs-promise": "^2.0.3",
@ -232,7 +237,7 @@
"gulp-watch": "^5.0.0", "gulp-watch": "^5.0.0",
"gulp-zip": "^4.0.0", "gulp-zip": "^4.0.0",
"isomorphic-fetch": "^2.2.1", "isomorphic-fetch": "^2.2.1",
"jsdom": "^11.1.0", "jsdom": "^11.2.0",
"jsdom-global": "^3.0.2", "jsdom-global": "^3.0.2",
"jshint-stylish": "~2.2.1", "jshint-stylish": "~2.2.1",
"karma": "^2.0.0", "karma": "^2.0.0",
@ -255,8 +260,9 @@
"react-addons-test-utils": "^15.5.1", "react-addons-test-utils": "^15.5.1",
"react-test-renderer": "^15.6.2", "react-test-renderer": "^15.6.2",
"react-testutils-additions": "^15.2.0", "react-testutils-additions": "^15.2.0",
"selenium-webdriver": "^3.5.0",
"redux-test-utils": "^0.2.2", "redux-test-utils": "^0.2.2",
"sinon": "^4.0.0", "sinon": "^5.0.0",
"stylelint-config-standard": "^18.2.0", "stylelint-config-standard": "^18.2.0",
"tape": "^4.5.1", "tape": "^4.5.1",
"testem": "^2.0.0", "testem": "^2.0.0",

View File

@ -19,11 +19,13 @@ module.exports = function(config) {
'test/integration/jquery-3.1.0.min.js', 'test/integration/jquery-3.1.0.min.js',
{ pattern: 'dist/chrome/images/**/*.*', watched: false, included: false, served: true }, { pattern: 'dist/chrome/images/**/*.*', watched: false, included: false, served: true },
{ pattern: 'dist/chrome/fonts/**/*.*', watched: false, included: false, served: true }, { pattern: 'dist/chrome/fonts/**/*.*', watched: false, included: false, served: true },
{ pattern: 'dist/chrome/_locales/**/*.*', watched: false, included: false, served: true },
], ],
proxies: { proxies: {
'/images/': '/base/dist/chrome/images/', '/images/': '/base/dist/chrome/images/',
'/fonts/': '/base/dist/chrome/fonts/', '/fonts/': '/base/dist/chrome/fonts/',
'/_locales/': '/base/dist/chrome/_locales/',
}, },
// test results reporter to use // test results reporter to use

18
test/e2e/func.js Normal file
View File

@ -0,0 +1,18 @@
require('chromedriver')
const webdriver = require('selenium-webdriver')
exports.delay = function delay (time) {
return new Promise(resolve => setTimeout(resolve, time))
}
exports.buildWebDriver = function buildWebDriver (extPath) {
return new webdriver.Builder()
.withCapabilities({
chromeOptions: {
args: [`load-extension=${extPath}`],
},
})
.forBrowser('chrome')
.build()
}

122
test/e2e/metamask.spec.js Normal file
View File

@ -0,0 +1,122 @@
const path = require('path')
const assert = require('assert')
const webdriver = require('selenium-webdriver')
const By = webdriver.By
const { delay, buildWebDriver } = require('./func')
describe('Metamask popup page', function () {
let driver
this.seedPhase
this.accountAddress
this.timeout(0)
before(async function () {
const extPath = path.resolve('dist/chrome')
driver = buildWebDriver(extPath)
await driver.get('chrome://extensions-frame')
const elems = await driver.findElements(By.className('extension-list-item-wrapper'))
const extensionId = await elems[1].getAttribute('id')
await driver.get(`chrome-extension://${extensionId}/popup.html`)
await delay(500)
})
after(async function () {
await driver.quit()
})
describe('#onboarding', () => {
it('should open Metamask.io', async function () {
const tabs = await driver.getAllWindowHandles()
await driver.switchTo().window(tabs[0])
await delay(300)
})
it('should match title', async () => {
const title = await driver.getTitle()
assert.equal(title, 'MetaMask Plugin', 'title matches MetaMask Plugin')
})
it('should show privacy notice', async () => {
const privacy = await driver.findElement(By.className(
'terms-header'
)).getText()
assert.equal(privacy, 'PRIVACY NOTICE', 'shows privacy notice')
driver.findElement(By.css(
'button'
)).click()
})
it('should show terms of use', async () => {
await delay(300)
const terms = await driver.findElement(By.className(
'terms-header'
)).getText()
assert.equal(terms, 'TERMS OF USE', 'shows terms of use')
})
it('should be unable to continue without scolling throught the terms of use', async () => {
const button = await driver.findElement(By.css(
'button'
)).isEnabled()
assert.equal(button, false, 'disabled continue button')
const element = driver.findElement(By.linkText(
'Attributions'
))
await driver.executeScript('arguments[0].scrollIntoView(true)', element)
})
it('should be able to continue when scrolled to the bottom of terms of use', async () => {
const button = await driver.findElement(By.css('button'))
const buttonEnabled = await button.isEnabled()
await delay(500)
assert.equal(buttonEnabled, true, 'enabled continue button')
await button.click()
})
it('should accept password with length of eight', async () => {
await delay(300)
const passwordBox = await driver.findElement(By.id('password-box'))
const passwordBoxConfirm = await driver.findElement(By.id('password-box-confirm'))
const button = driver.findElement(By.css('button'))
passwordBox.sendKeys('123456789')
passwordBoxConfirm.sendKeys('123456789')
await delay(500)
await button.click()
})
it('should show value was created and seed phrase', async () => {
await delay(700)
this.seedPhase = await driver.findElement(By.className('twelve-word-phrase')).getText()
const continueAfterSeedPhrase = await driver.findElement(By.css('button'))
await continueAfterSeedPhrase.click()
})
it('should show lock account', async () => {
await delay(300)
await driver.findElement(By.className('sandwich-expando')).click()
await delay(500)
await driver.findElement(By.xpath('//*[@id="app-content"]/div/div[3]/span/div/li[2]')).click()
})
it('should accept account password after lock', async () => {
await delay(500)
await driver.findElement(By.id('password-box')).sendKeys('123456789')
await driver.findElement(By.css('button')).click()
await delay(500)
})
it('should show QR code', async () => {
await delay(300)
await driver.findElement(By.className('fa-ellipsis-h')).click()
await driver.findElement(By.xpath('//*[@id="app-content"]/div/div[4]/div/div/div[1]/flex-column/div[1]/div/span/i/div/div/li[2]')).click()
await delay(300)
})
it('should show the account address', async () => {
this.accountAddress = await driver.findElement(By.className('ellip-address')).getText()
await driver.findElement(By.className('fa-arrow-left')).click()
await delay(500)
})
})
})

View File

@ -0,0 +1,99 @@
const assert = require('assert')
const migration23 = require('../../../app/scripts/migrations/023')
const properTime = (new Date()).getTime()
const storage = {
"meta": {},
"data": {
"TransactionController": {
"transactions": [
]
},
},
}
const transactions = []
const transactions40 = []
const transactions20 = []
const txStates = [
'unapproved',
'approved',
'signed',
'submitted',
'confirmed',
'rejected',
'failed',
'dropped',
]
const deletableTxStates = [
'confirmed',
'rejected',
'failed',
'dropped',
]
let nonDeletableCount = 0
let status
while (transactions.length <= 100) {
status = txStates[Math.floor(Math.random() * Math.floor(txStates.length - 1))]
if (!deletableTxStates.find((s) => s === status)) nonDeletableCount++
transactions.push({status})
}
while (transactions40.length < 40) {
status = txStates[Math.floor(Math.random() * Math.floor(txStates.length - 1))]
transactions40.push({status})
}
while (transactions20.length < 20) {
status = txStates[Math.floor(Math.random() * Math.floor(txStates.length - 1))]
transactions20.push({status})
}
storage.data.TransactionController.transactions = transactions
describe('storage is migrated successfully and the proper transactions are remove from state', () => {
it('should remove transactions that are unneeded', (done) => {
migration23.migrate(storage)
.then((migratedData) => {
let leftoverNonDeletableTxCount = 0
const migratedTransactions = migratedData.data.TransactionController.transactions
migratedTransactions.forEach((tx) => {
if (!deletableTxStates.find((s) => s === tx.status)) {
leftoverNonDeletableTxCount++
}
})
assert.equal(leftoverNonDeletableTxCount, nonDeletableCount, 'migration shouldnt delete transactions we want to keep')
assert((migratedTransactions.length >= 40), `should be equal or greater to 40 if they are non deletable states got ${migratedTransactions.length} transactions`)
done()
}).catch(done)
})
it('should not remove any transactions because 40 is the expectable limit', (done) => {
storage.meta.version = 22
storage.data.TransactionController.transactions = transactions40
migration23.migrate(storage)
.then((migratedData) => {
const migratedTransactions = migratedData.data.TransactionController.transactions
assert.equal(migratedTransactions.length, 40, 'migration shouldnt delete when at limit')
done()
}).catch(done)
})
it('should not remove any transactions because 20 txs is under the expectable limit', (done) => {
storage.meta.version = 22
storage.data.TransactionController.transactions = transactions20
migration23.migrate(storage)
.then((migratedData) => {
const migratedTransactions = migratedData.data.TransactionController.transactions
assert.equal(migratedTransactions.length, 20, 'migration shouldnt delete when under limit')
done()
}).catch(done)
})
})

View File

@ -240,12 +240,12 @@ describe('TransactionStateManager', function () {
}) })
describe('#wipeTransactions', function () { describe('#wipeTransactions', function () {
const specificAddress = '0xaa' const specificAddress = '0xaa'
const otherAddress = '0xbb' const otherAddress = '0xbb'
it('should remove only the transactions from a specific address', function () { it('should remove only the transactions from a specific address', function () {
const txMetas = [ const txMetas = [
{ id: 0, status: 'unapproved', txParams: { from: specificAddress, to: otherAddress }, metamaskNetworkId: currentNetworkId }, { id: 0, status: 'unapproved', txParams: { from: specificAddress, to: otherAddress }, metamaskNetworkId: currentNetworkId },
{ id: 1, status: 'confirmed', txParams: { from: otherAddress, to: specificAddress }, metamaskNetworkId: currentNetworkId }, { id: 1, status: 'confirmed', txParams: { from: otherAddress, to: specificAddress }, metamaskNetworkId: currentNetworkId },
@ -268,7 +268,7 @@ describe('TransactionStateManager', function () {
{ id: 1, status: 'confirmed', txParams: { from: specificAddress, to: otherAddress }, metamaskNetworkId: otherNetworkId }, { id: 1, status: 'confirmed', txParams: { from: specificAddress, to: otherAddress }, metamaskNetworkId: otherNetworkId },
{ id: 2, status: 'confirmed', txParams: { from: specificAddress, to: otherAddress }, metamaskNetworkId: otherNetworkId }, { id: 2, status: 'confirmed', txParams: { from: specificAddress, to: otherAddress }, metamaskNetworkId: otherNetworkId },
] ]
txMetas.forEach((txMeta) => txStateManager.addTx(txMeta, noop)) txMetas.forEach((txMeta) => txStateManager.addTx(txMeta, noop))
txStateManager.wipeTransactions(specificAddress) txStateManager.wipeTransactions(specificAddress)

View File

@ -1,9 +1,8 @@
const Component = require('react').Component const Component = require('react').Component
const h = require('react-hyperscript') const h = require('react-hyperscript')
const inherits = require('util').inherits const inherits = require('util').inherits
const connect = require('react-redux').connect const connect = require('../../metamask-connect')
const actions = require('../../actions') const actions = require('../../actions')
const t = require('../../../i18n')
const { getCurrentViewContext } = require('../../selectors') const { getCurrentViewContext } = require('../../selectors')
const classnames = require('classnames') const classnames = require('classnames')
@ -46,7 +45,7 @@ AccountDetailsModal.prototype.render = function () {
h('div.new-account__header', [ h('div.new-account__header', [
h('div.new-account__title', t('newAccount')), h('div.new-account__title', this.props.t('newAccount')),
h('div.new-account__tabs', [ h('div.new-account__tabs', [
@ -56,7 +55,7 @@ AccountDetailsModal.prototype.render = function () {
'new-account__tabs__unselected cursor-pointer': displayedForm !== 'CREATE', 'new-account__tabs__unselected cursor-pointer': displayedForm !== 'CREATE',
}), }),
onClick: () => displayForm('CREATE'), onClick: () => displayForm('CREATE'),
}, t('createDen')), }, this.props.t('createDen')),
h('div.new-account__tabs__tab', { h('div.new-account__tabs__tab', {
className: classnames('new-account__tabs__tab', { className: classnames('new-account__tabs__tab', {
@ -64,7 +63,7 @@ AccountDetailsModal.prototype.render = function () {
'new-account__tabs__unselected cursor-pointer': displayedForm !== 'IMPORT', 'new-account__tabs__unselected cursor-pointer': displayedForm !== 'IMPORT',
}), }),
onClick: () => displayForm('IMPORT'), onClick: () => displayForm('IMPORT'),
}, t('import')), }, this.props.t('import')),
]), ]),

View File

@ -2,6 +2,7 @@ const abi = require('human-standard-token-abi')
const getBuyEthUrl = require('../../app/scripts/lib/buy-eth-url') const getBuyEthUrl = require('../../app/scripts/lib/buy-eth-url')
const { getTokenAddressFromTokenObject } = require('./util') const { getTokenAddressFromTokenObject } = require('./util')
const ethUtil = require('ethereumjs-util') const ethUtil = require('ethereumjs-util')
const { fetchLocale } = require('../i18n-helper')
var actions = { var actions = {
_setBackgroundConnection: _setBackgroundConnection, _setBackgroundConnection: _setBackgroundConnection,
@ -23,7 +24,7 @@ var actions = {
NETWORK_DROPDOWN_CLOSE: 'UI_NETWORK_DROPDOWN_CLOSE', NETWORK_DROPDOWN_CLOSE: 'UI_NETWORK_DROPDOWN_CLOSE',
showNetworkDropdown: showNetworkDropdown, showNetworkDropdown: showNetworkDropdown,
hideNetworkDropdown: hideNetworkDropdown, hideNetworkDropdown: hideNetworkDropdown,
// menu state // menu state/
getNetworkStatus: 'getNetworkStatus', getNetworkStatus: 'getNetworkStatus',
// transition state // transition state
TRANSITION_FORWARD: 'TRANSITION_FORWARD', TRANSITION_FORWARD: 'TRANSITION_FORWARD',
@ -254,6 +255,13 @@ var actions = {
SET_USE_BLOCKIE: 'SET_USE_BLOCKIE', SET_USE_BLOCKIE: 'SET_USE_BLOCKIE',
setUseBlockie, setUseBlockie,
// locale
SET_CURRENT_LOCALE: 'SET_CURRENT_LOCALE',
SET_LOCALE_MESSAGES: 'SET_LOCALE_MESSAGES',
setCurrentLocale,
updateCurrentLocale,
setLocaleMessages,
//
// Feature Flags // Feature Flags
setFeatureFlag, setFeatureFlag,
updateFeatureFlags, updateFeatureFlags,
@ -1865,6 +1873,38 @@ function setUseBlockie (val) {
} }
} }
function updateCurrentLocale (key) {
return (dispatch) => {
dispatch(actions.showLoadingIndication())
fetchLocale(key)
.then((localeMessages) => {
log.debug(`background.setCurrentLocale`)
background.setCurrentLocale(key, (err) => {
dispatch(actions.hideLoadingIndication())
if (err) {
return dispatch(actions.displayWarning(err.message))
}
dispatch(actions.setCurrentLocale(key))
dispatch(actions.setLocaleMessages(localeMessages))
})
})
}
}
function setCurrentLocale (key) {
return {
type: actions.SET_CURRENT_LOCALE,
value: key,
}
}
function setLocaleMessages (localeMessages) {
return {
type: actions.SET_LOCALE_MESSAGES,
value: localeMessages,
}
}
function setNetworkEndpoints (networkEndpointType) { function setNetworkEndpoints (networkEndpointType) {
return dispatch => { return dispatch => {
log.debug('background.setNetworkEndpoints') log.debug('background.setNetworkEndpoints')

View File

@ -1,12 +1,11 @@
const { Component } = require('react') const { Component } = require('react')
const PropTypes = require('prop-types') const PropTypes = require('prop-types')
const { connect } = require('react-redux') const connect = require('./metamask-connect')
const { Route, Switch, Redirect, withRouter } = require('react-router-dom') const { Route, Switch, Redirect, withRouter } = require('react-router-dom')
const { compose } = require('recompose') const { compose } = require('recompose')
const h = require('react-hyperscript') const h = require('react-hyperscript')
const actions = require('./actions') const actions = require('./actions')
const classnames = require('classnames') const classnames = require('classnames')
const t = require('../i18n')
// init // init
const InitializeScreen = require('../../mascara/src/app/first-time').default const InitializeScreen = require('../../mascara/src/app/first-time').default
@ -297,7 +296,10 @@ class App extends Component {
}), }),
// metamask name // metamask name
h('h1', 'MetaMask'), h('.flex-row', [
h('h1', this.props.t('appName')),
h('div.beta-label', this.props.t('beta')),
]),
]), ]),
@ -602,15 +604,15 @@ class App extends Component {
let name let name
if (providerName === 'mainnet') { if (providerName === 'mainnet') {
name = t('connectingToMainnet') name = this.props.t('connectingToMainnet')
} else if (providerName === 'ropsten') { } else if (providerName === 'ropsten') {
name = t('connectingToRopsten') name = this.props.t('connectingToRopsten')
} else if (providerName === 'kovan') { } else if (providerName === 'kovan') {
name = t('connectingToRopsten') name = this.props.t('connectingToRopsten')
} else if (providerName === 'rinkeby') { } else if (providerName === 'rinkeby') {
name = t('connectingToRinkeby') name = this.props.t('connectingToRinkeby')
} else { } else {
name = t('connectingToUnknown') name = this.props.t('connectingToUnknown')
} }
return name return name
@ -623,15 +625,15 @@ class App extends Component {
let name let name
if (providerName === 'mainnet') { if (providerName === 'mainnet') {
name = 'Main Ethereum Network' name = this.props.t('mainnet')
} else if (providerName === 'ropsten') { } else if (providerName === 'ropsten') {
name = 'Ropsten Test Network' name = this.props.t('ropsten')
} else if (providerName === 'kovan') { } else if (providerName === 'kovan') {
name = 'Kovan Test Network' name = this.props.t('kovan')
} else if (providerName === 'rinkeby') { } else if (providerName === 'rinkeby') {
name = 'Rinkeby Test Network' name = this.props.t('rinkeby')
} else { } else {
name = 'Unknown Private Network' name = this.props.t('unknownNetwork')
} }
return name return name

View File

@ -3,13 +3,12 @@ const PropTypes = require('prop-types')
const h = require('react-hyperscript') const h = require('react-hyperscript')
const actions = require('../actions') const actions = require('../actions')
const genAccountLink = require('etherscan-link').createAccountLink const genAccountLink = require('etherscan-link').createAccountLink
const connect = require('react-redux').connect const connect = require('../metamask-connect')
const Dropdown = require('./dropdown').Dropdown const Dropdown = require('./dropdown').Dropdown
const DropdownMenuItem = require('./dropdown').DropdownMenuItem const DropdownMenuItem = require('./dropdown').DropdownMenuItem
const Identicon = require('./identicon') const Identicon = require('./identicon')
const ethUtil = require('ethereumjs-util') const ethUtil = require('ethereumjs-util')
const copyToClipboard = require('copy-to-clipboard') const copyToClipboard = require('copy-to-clipboard')
const t = require('../../i18n')
class AccountDropdowns extends Component { class AccountDropdowns extends Component {
constructor (props) { constructor (props) {
@ -80,7 +79,7 @@ class AccountDropdowns extends Component {
try { // Sometimes keyrings aren't loaded yet: try { // Sometimes keyrings aren't loaded yet:
const type = keyring.type const type = keyring.type
const isLoose = type !== 'HD Key Tree' const isLoose = type !== 'HD Key Tree'
return isLoose ? h('.keyring-label.allcaps', t('loose')) : null return isLoose ? h('.keyring-label.allcaps', this.props.t('loose')) : null
} catch (e) { return } } catch (e) { return }
} }
@ -130,7 +129,7 @@ class AccountDropdowns extends Component {
diameter: 32, diameter: 32,
}, },
), ),
h('span', { style: { marginLeft: '20px', fontSize: '24px' } }, t('createAccount')), h('span', { style: { marginLeft: '20px', fontSize: '24px' } }, this.props.t('createAccount')),
], ],
), ),
h( h(
@ -155,7 +154,7 @@ class AccountDropdowns extends Component {
fontSize: '24px', fontSize: '24px',
marginBottom: '5px', marginBottom: '5px',
}, },
}, t('importAccount')), }, this.props.t('importAccount')),
] ]
), ),
] ]
@ -193,7 +192,7 @@ class AccountDropdowns extends Component {
global.platform.openWindow({ url }) global.platform.openWindow({ url })
}, },
}, },
t('etherscanView'), this.props.t('etherscanView'),
), ),
h( h(
DropdownMenuItem, DropdownMenuItem,
@ -205,7 +204,7 @@ class AccountDropdowns extends Component {
actions.showQrView(selected, identity ? identity.name : '') actions.showQrView(selected, identity ? identity.name : '')
}, },
}, },
t('showQRCode'), this.props.t('showQRCode'),
), ),
h( h(
DropdownMenuItem, DropdownMenuItem,
@ -217,7 +216,7 @@ class AccountDropdowns extends Component {
copyToClipboard(checkSumAddress) copyToClipboard(checkSumAddress)
}, },
}, },
t('copyAddress'), this.props.t('copyAddress'),
), ),
h( h(
DropdownMenuItem, DropdownMenuItem,
@ -227,7 +226,7 @@ class AccountDropdowns extends Component {
actions.requestAccountExport() actions.requestAccountExport()
}, },
}, },
t('exportPrivateKey'), this.props.t('exportPrivateKey'),
), ),
] ]
) )
@ -301,6 +300,7 @@ AccountDropdowns.propTypes = {
style: PropTypes.object, style: PropTypes.object,
enableAccountOptions: PropTypes.bool, enableAccountOptions: PropTypes.bool,
enableAccountsSelector: PropTypes.bool, enableAccountsSelector: PropTypes.bool,
t: PropTypes.func,
} }
const mapDispatchToProps = (dispatch) => { const mapDispatchToProps = (dispatch) => {

View File

@ -5,8 +5,7 @@ const exportAsFile = require('../util').exportAsFile
const copyToClipboard = require('copy-to-clipboard') const copyToClipboard = require('copy-to-clipboard')
const actions = require('../actions') const actions = require('../actions')
const ethUtil = require('ethereumjs-util') const ethUtil = require('ethereumjs-util')
const connect = require('react-redux').connect const connect = require('../metamask-connect')
const t = require('../../i18n')
module.exports = connect(mapStateToProps)(ExportAccountView) module.exports = connect(mapStateToProps)(ExportAccountView)
@ -36,7 +35,7 @@ ExportAccountView.prototype.render = function () {
if (notExporting) return h('div') if (notExporting) return h('div')
if (exportRequested) { if (exportRequested) {
const warning = t('exportPrivateKeyWarning') const warning = this.props.t('exportPrivateKeyWarning')
return ( return (
h('div', { h('div', {
style: { style: {
@ -54,7 +53,7 @@ ExportAccountView.prototype.render = function () {
h('p.error', warning), h('p.error', warning),
h('input#exportAccount.sizing-input', { h('input#exportAccount.sizing-input', {
type: 'password', type: 'password',
placeholder: t('confirmPassword').toLowerCase(), placeholder: this.props.t('confirmPassword').toLowerCase(),
onKeyPress: this.onExportKeyPress.bind(this), onKeyPress: this.onExportKeyPress.bind(this),
style: { style: {
position: 'relative', position: 'relative',
@ -75,10 +74,10 @@ ExportAccountView.prototype.render = function () {
style: { style: {
marginRight: '10px', marginRight: '10px',
}, },
}, t('submit')), }, this.props.t('submit')),
h('button', { h('button', {
onClick: () => this.props.dispatch(actions.backToAccountDetail(this.props.address)), onClick: () => this.props.dispatch(actions.backToAccountDetail(this.props.address)),
}, t('cancel')), }, this.props.t('cancel')),
]), ]),
(this.props.warning) && ( (this.props.warning) && (
h('span.error', { h('span.error', {
@ -99,7 +98,7 @@ ExportAccountView.prototype.render = function () {
margin: '0 20px', margin: '0 20px',
}, },
}, [ }, [
h('label', t('copyPrivateKey') + ':'), h('label', this.props.t('copyPrivateKey') + ':'),
h('p.error.cursor-pointer', { h('p.error.cursor-pointer', {
style: { style: {
textOverflow: 'ellipsis', textOverflow: 'ellipsis',
@ -113,13 +112,13 @@ ExportAccountView.prototype.render = function () {
}, plainKey), }, plainKey),
h('button', { h('button', {
onClick: () => this.props.dispatch(actions.backToAccountDetail(this.props.address)), onClick: () => this.props.dispatch(actions.backToAccountDetail(this.props.address)),
}, t('done')), }, this.props.t('done')),
h('button', { h('button', {
style: { style: {
marginLeft: '10px', marginLeft: '10px',
}, },
onClick: () => exportAsFile(`MetaMask ${nickname} Private Key`, plainKey), onClick: () => exportAsFile(`MetaMask ${nickname} Private Key`, plainKey),
}, t('saveAsFile')), }, this.props.t('saveAsFile')),
]) ])
} }
} }

View File

@ -1,6 +1,6 @@
const inherits = require('util').inherits const inherits = require('util').inherits
const Component = require('react').Component const Component = require('react').Component
const connect = require('react-redux').connect const connect = require('../../metamask-connect')
const { compose } = require('recompose') const { compose } = require('recompose')
const { withRouter } = require('react-router-dom') const { withRouter } = require('react-router-dom')
const h = require('react-hyperscript') const h = require('react-hyperscript')
@ -8,7 +8,6 @@ const actions = require('../../actions')
const { Menu, Item, Divider, CloseArea } = require('../dropdowns/components/menu') const { Menu, Item, Divider, CloseArea } = require('../dropdowns/components/menu')
const Identicon = require('../identicon') const Identicon = require('../identicon')
const { formatBalance } = require('../../util') const { formatBalance } = require('../../util')
const t = require('../../../i18n')
const { const {
SETTINGS_ROUTE, SETTINGS_ROUTE,
INFO_ROUTE, INFO_ROUTE,
@ -75,13 +74,13 @@ AccountMenu.prototype.render = function () {
h(Item, { h(Item, {
className: 'account-menu__header', className: 'account-menu__header',
}, [ }, [
t('myAccounts'), this.props.t('myAccounts'),
h('button.account-menu__logout-button', { h('button.account-menu__logout-button', {
onClick: () => { onClick: () => {
lockMetamask() lockMetamask()
history.push(DEFAULT_ROUTE) history.push(DEFAULT_ROUTE)
}, },
}, t('logout')), }, this.props.t('logout')),
]), ]),
h(Divider), h(Divider),
h('div.account-menu__accounts', this.renderAccounts()), h('div.account-menu__accounts', this.renderAccounts()),
@ -92,7 +91,7 @@ AccountMenu.prototype.render = function () {
history.push(NEW_ACCOUNT_ROUTE) history.push(NEW_ACCOUNT_ROUTE)
}, },
icon: h('img.account-menu__item-icon', { src: 'images/plus-btn-white.svg' }), icon: h('img.account-menu__item-icon', { src: 'images/plus-btn-white.svg' }),
text: t('createAccount'), text: this.props.t('createAccount'),
}), }),
h(Item, { h(Item, {
onClick: () => { onClick: () => {
@ -100,7 +99,7 @@ AccountMenu.prototype.render = function () {
history.push(IMPORT_ACCOUNT_ROUTE) history.push(IMPORT_ACCOUNT_ROUTE)
}, },
icon: h('img.account-menu__item-icon', { src: 'images/import-account.svg' }), icon: h('img.account-menu__item-icon', { src: 'images/import-account.svg' }),
text: t('importAccount'), text: this.props.t('importAccount'),
}), }),
h(Divider), h(Divider),
h(Item, { h(Item, {
@ -109,7 +108,7 @@ AccountMenu.prototype.render = function () {
history.push(INFO_ROUTE) history.push(INFO_ROUTE)
}, },
icon: h('img', { src: 'images/mm-info-icon.svg' }), icon: h('img', { src: 'images/mm-info-icon.svg' }),
text: t('infoHelp'), text: this.props.t('infoHelp'),
}), }),
h(Item, { h(Item, {
onClick: () => { onClick: () => {
@ -117,7 +116,7 @@ AccountMenu.prototype.render = function () {
history.push(SETTINGS_ROUTE) history.push(SETTINGS_ROUTE)
}, },
icon: h('img.account-menu__item-icon', { src: 'images/settings.svg' }), icon: h('img.account-menu__item-icon', { src: 'images/settings.svg' }),
text: t('settings'), text: this.props.t('settings'),
}), }),
]) ])
} }
@ -175,6 +174,6 @@ AccountMenu.prototype.indicateIfLoose = function (keyring) {
try { // Sometimes keyrings aren't loaded yet: try { // Sometimes keyrings aren't loaded yet:
const type = keyring.type const type = keyring.type
const isLoose = type !== 'HD Key Tree' const isLoose = type !== 'HD Key Tree'
return isLoose ? h('.keyring-label.allcaps', t('imported')) : null return isLoose ? h('.keyring-label.allcaps', this.props.t('imported')) : null
} catch (e) { return } } catch (e) { return }
} }

View File

@ -1,5 +1,5 @@
const Component = require('react').Component const Component = require('react').Component
const connect = require('react-redux').connect const connect = require('../metamask-connect')
const h = require('react-hyperscript') const h = require('react-hyperscript')
const inherits = require('util').inherits const inherits = require('util').inherits
const TokenBalance = require('./token-balance') const TokenBalance = require('./token-balance')

View File

@ -4,9 +4,9 @@ const inherits = require('util').inherits
const ethUtil = require('ethereumjs-util') const ethUtil = require('ethereumjs-util')
const BN = ethUtil.BN const BN = ethUtil.BN
const extend = require('xtend') const extend = require('xtend')
const t = require('../../i18n') const connect = require('../metamask-connect')
module.exports = BnAsDecimalInput module.exports = connect()(BnAsDecimalInput)
inherits(BnAsDecimalInput, Component) inherits(BnAsDecimalInput, Component)
function BnAsDecimalInput () { function BnAsDecimalInput () {
@ -137,13 +137,13 @@ BnAsDecimalInput.prototype.constructWarning = function () {
let message = name ? name + ' ' : '' let message = name ? name + ' ' : ''
if (min && max) { if (min && max) {
message += t('betweenMinAndMax', [`${newMin} ${suffix}`, `${newMax} ${suffix}`]) message += this.props.t('betweenMinAndMax', [`${newMin} ${suffix}`, `${newMax} ${suffix}`])
} else if (min) { } else if (min) {
message += t('greaterThanMin', [`${newMin} ${suffix}`]) message += this.props.t('greaterThanMin', [`${newMin} ${suffix}`])
} else if (max) { } else if (max) {
message += t('lessThanMax', [`${newMax} ${suffix}`]) message += this.props.t('lessThanMax', [`${newMax} ${suffix}`])
} else { } else {
message += t('invalidInput') message += this.props.t('invalidInput')
} }
return message return message

View File

@ -1,7 +1,7 @@
const Component = require('react').Component const Component = require('react').Component
const h = require('react-hyperscript') const h = require('react-hyperscript')
const inherits = require('util').inherits const inherits = require('util').inherits
const connect = require('react-redux').connect const connect = require('../metamask-connect')
const actions = require('../actions') const actions = require('../actions')
const CoinbaseForm = require('./coinbase-form') const CoinbaseForm = require('./coinbase-form')
const ShapeshiftForm = require('./shapeshift-form') const ShapeshiftForm = require('./shapeshift-form')
@ -9,7 +9,6 @@ const Loading = require('./loading')
const AccountPanel = require('./account-panel') const AccountPanel = require('./account-panel')
const RadioList = require('./custom-radio-list') const RadioList = require('./custom-radio-list')
const networkNames = require('../../../app/scripts/config.js').networkNames const networkNames = require('../../../app/scripts/config.js').networkNames
const t = require('../../i18n')
module.exports = connect(mapStateToProps)(BuyButtonSubview) module.exports = connect(mapStateToProps)(BuyButtonSubview)
@ -77,7 +76,7 @@ BuyButtonSubview.prototype.headerSubview = function () {
paddingTop: '4px', paddingTop: '4px',
paddingBottom: '4px', paddingBottom: '4px',
}, },
}, t('depositEth')), }, this.props.t('depositEth')),
]), ]),
// loading indication // loading indication
@ -119,7 +118,7 @@ BuyButtonSubview.prototype.headerSubview = function () {
paddingTop: '4px', paddingTop: '4px',
paddingBottom: '4px', paddingBottom: '4px',
}, },
}, t('selectService')), }, this.props.t('selectService')),
]), ]),
]) ])
@ -144,7 +143,7 @@ BuyButtonSubview.prototype.primarySubview = function () {
case '4': case '4':
case '42': case '42':
const networkName = networkNames[network] const networkName = networkNames[network]
const label = `${networkName} ${t('testFaucet')}` const label = `${networkName} ${this.props.t('testFaucet')}`
return ( return (
h('div.flex-column', { h('div.flex-column', {
style: { style: {
@ -165,14 +164,14 @@ BuyButtonSubview.prototype.primarySubview = function () {
style: { style: {
marginTop: '15px', marginTop: '15px',
}, },
}, t('borrowDharma')) }, this.props.t('borrowDharma'))
) : null, ) : null,
]) ])
) )
default: default:
return ( return (
h('h2.error', t('unknownNetworkId')) h('h2.error', this.props.t('unknownNetworkId'))
) )
} }
@ -204,8 +203,8 @@ BuyButtonSubview.prototype.mainnetSubview = function () {
'ShapeShift', 'ShapeShift',
], ],
subtext: { subtext: {
'Coinbase': `${t('crypto')}/${t('fiat')} (${t('usaOnly')})`, 'Coinbase': `${this.props.t('crypto')}/${this.props.t('fiat')} (${this.props.t('usaOnly')})`,
'ShapeShift': t('crypto'), 'ShapeShift': this.props.t('crypto'),
}, },
onClick: this.radioHandler.bind(this), onClick: this.radioHandler.bind(this),
}), }),

View File

@ -1,9 +1,8 @@
const Component = require('react').Component const Component = require('react').Component
const h = require('react-hyperscript') const h = require('react-hyperscript')
const inherits = require('util').inherits const inherits = require('util').inherits
const connect = require('react-redux').connect const connect = require('../metamask-connect')
const actions = require('../actions') const actions = require('../actions')
const t = require('../../i18n')
module.exports = connect(mapStateToProps)(CoinbaseForm) module.exports = connect(mapStateToProps)(CoinbaseForm)
@ -38,11 +37,11 @@ CoinbaseForm.prototype.render = function () {
}, [ }, [
h('button.btn-green', { h('button.btn-green', {
onClick: this.toCoinbase.bind(this), onClick: this.toCoinbase.bind(this),
}, t('continueToCoinbase')), }, this.props.t('continueToCoinbase')),
h('button.btn-red', { h('button.btn-red', {
onClick: () => props.dispatch(actions.goHome()), onClick: () => props.dispatch(actions.goHome()),
}, t('cancel')), }, this.props.t('cancel')),
]), ]),
]) ])
} }

View File

@ -2,11 +2,11 @@ const Component = require('react').Component
const h = require('react-hyperscript') const h = require('react-hyperscript')
const inherits = require('util').inherits const inherits = require('util').inherits
const copyToClipboard = require('copy-to-clipboard') const copyToClipboard = require('copy-to-clipboard')
const t = require('../../i18n') const connect = require('../metamask-connect')
const Tooltip = require('./tooltip') const Tooltip = require('./tooltip')
module.exports = CopyButton module.exports = connect()(CopyButton)
inherits(CopyButton, Component) inherits(CopyButton, Component)
function CopyButton () { function CopyButton () {
@ -23,7 +23,7 @@ CopyButton.prototype.render = function () {
const value = props.value const value = props.value
const copied = state.copied const copied = state.copied
const message = copied ? t('copiedButton') : props.title || t('copyButton') const message = copied ? this.props.t('copiedButton') : props.title || this.props.t('copyButton')
return h('.copy-button', { return h('.copy-button', {
style: { style: {

View File

@ -4,9 +4,9 @@ const inherits = require('util').inherits
const Tooltip = require('./tooltip') const Tooltip = require('./tooltip')
const copyToClipboard = require('copy-to-clipboard') const copyToClipboard = require('copy-to-clipboard')
const t = require('../../i18n') const connect = require('../metamask-connect')
module.exports = Copyable module.exports = connect()(Copyable)
inherits(Copyable, Component) inherits(Copyable, Component)
function Copyable () { function Copyable () {
@ -23,7 +23,7 @@ Copyable.prototype.render = function () {
const { copied } = state const { copied } = state
return h(Tooltip, { return h(Tooltip, {
title: copied ? t('copiedExclamation') : t('copy'), title: copied ? this.props.t('copiedExclamation') : this.props.t('copy'),
position: 'bottom', position: 'bottom',
}, h('span', { }, h('span', {
style: { style: {

View File

@ -1,9 +1,8 @@
const Component = require('react').Component const Component = require('react').Component
const h = require('react-hyperscript') const h = require('react-hyperscript')
const inherits = require('util').inherits const inherits = require('util').inherits
const connect = require('react-redux').connect const connect = require('../../metamask-connect')
const actions = require('../../actions') const actions = require('../../actions')
const t = require('../../../i18n')
const GasModalCard = require('./gas-modal-card') const GasModalCard = require('./gas-modal-card')
const ethUtil = require('ethereumjs-util') const ethUtil = require('ethereumjs-util')
@ -150,7 +149,7 @@ CustomizeGasModal.prototype.validate = function ({ gasTotal, gasLimit }) {
}) })
if (!balanceIsSufficient) { if (!balanceIsSufficient) {
error = t('balanceIsInsufficientGas') error = this.props.t('balanceIsInsufficientGas')
} }
const gasLimitTooLow = gasLimit && conversionGreaterThan( const gasLimitTooLow = gasLimit && conversionGreaterThan(
@ -166,7 +165,7 @@ CustomizeGasModal.prototype.validate = function ({ gasTotal, gasLimit }) {
) )
if (gasLimitTooLow) { if (gasLimitTooLow) {
error = t('gasLimitTooLow') error = this.props.t('gasLimitTooLow')
} }
this.setState({ error }) this.setState({ error })
@ -259,7 +258,7 @@ CustomizeGasModal.prototype.render = function () {
}, [ }, [
h('div.send-v2__customize-gas__header', {}, [ h('div.send-v2__customize-gas__header', {}, [
h('div.send-v2__customize-gas__title', t('customGas')), h('div.send-v2__customize-gas__title', this.props.t('customGas')),
h('div.send-v2__customize-gas__close', { h('div.send-v2__customize-gas__close', {
onClick: hideModal, onClick: hideModal,
@ -275,8 +274,8 @@ CustomizeGasModal.prototype.render = function () {
// max: 1000, // max: 1000,
step: multiplyCurrencies(MIN_GAS_PRICE_GWEI, 10), step: multiplyCurrencies(MIN_GAS_PRICE_GWEI, 10),
onChange: value => this.convertAndSetGasPrice(value), onChange: value => this.convertAndSetGasPrice(value),
title: t('gasPrice'), title: this.props.t('gasPrice'),
copy: t('gasPriceCalculation'), copy: this.props.t('gasPriceCalculation'),
}), }),
h(GasModalCard, { h(GasModalCard, {
@ -285,8 +284,8 @@ CustomizeGasModal.prototype.render = function () {
// max: 100000, // max: 100000,
step: 1, step: 1,
onChange: value => this.convertAndSetGasLimit(value), onChange: value => this.convertAndSetGasLimit(value),
title: t('gasLimit'), title: this.props.t('gasLimit'),
copy: t('gasLimitCalculation'), copy: this.props.t('gasLimitCalculation'),
}), }),
]), ]),
@ -299,7 +298,7 @@ CustomizeGasModal.prototype.render = function () {
h('div.send-v2__customize-gas__revert', { h('div.send-v2__customize-gas__revert', {
onClick: () => this.revert(), onClick: () => this.revert(),
}, [t('revert')]), }, [this.props.t('revert')]),
h('div.send-v2__customize-gas__buttons', [ h('div.send-v2__customize-gas__buttons', [
h('button.btn-secondary.send-v2__customize-gas__cancel', { h('button.btn-secondary.send-v2__customize-gas__cancel', {
@ -307,12 +306,12 @@ CustomizeGasModal.prototype.render = function () {
style: { style: {
marginRight: '10px', marginRight: '10px',
}, },
}, [t('cancel')]), }, [this.props.t('cancel')]),
h('button.btn-primary.send-v2__customize-gas__save', { h('button.btn-primary.send-v2__customize-gas__save', {
onClick: () => !error && this.save(newGasPrice, gasLimit, gasTotal), onClick: () => !error && this.save(newGasPrice, gasLimit, gasTotal),
className: error && 'btn-primary--disabled', className: error && 'btn-primary--disabled',
}, [t('save')]), }, [this.props.t('save')]),
]), ]),
]), ]),

View File

@ -3,14 +3,14 @@ const PropTypes = require('prop-types')
const h = require('react-hyperscript') const h = require('react-hyperscript')
const actions = require('../../../actions') const actions = require('../../../actions')
const genAccountLink = require('../../../../lib/account-link.js') const genAccountLink = require('../../../../lib/account-link.js')
const connect = require('react-redux').connect const connect = require('../../../metamask-connect')
const Dropdown = require('./dropdown').Dropdown const Dropdown = require('./dropdown').Dropdown
const DropdownMenuItem = require('./dropdown').DropdownMenuItem const DropdownMenuItem = require('./dropdown').DropdownMenuItem
const Identicon = require('../../identicon') const Identicon = require('../../identicon')
const ethUtil = require('ethereumjs-util') const ethUtil = require('ethereumjs-util')
const copyToClipboard = require('copy-to-clipboard') const copyToClipboard = require('copy-to-clipboard')
const { formatBalance } = require('../../../util') const { formatBalance } = require('../../../util')
const t = require('../../../../i18n')
class AccountDropdowns extends Component { class AccountDropdowns extends Component {
constructor (props) { constructor (props) {
@ -130,7 +130,7 @@ class AccountDropdowns extends Component {
actions.showEditAccountModal(identity) actions.showEditAccountModal(identity)
}, },
}, [ }, [
t('edit'), this.props.t('edit'),
]), ]),
]), ]),
@ -144,7 +144,7 @@ class AccountDropdowns extends Component {
try { // Sometimes keyrings aren't loaded yet: try { // Sometimes keyrings aren't loaded yet:
const type = keyring.type const type = keyring.type
const isLoose = type !== 'HD Key Tree' const isLoose = type !== 'HD Key Tree'
return isLoose ? h('.keyring-label.allcaps', t('loose')) : null return isLoose ? h('.keyring-label.allcaps', this.props.t('loose')) : null
} catch (e) { return } } catch (e) { return }
} }
@ -202,7 +202,7 @@ class AccountDropdowns extends Component {
fontSize: '16px', fontSize: '16px',
lineHeight: '23px', lineHeight: '23px',
}, },
}, t('createAccount')), }, this.props.t('createAccount')),
], ],
), ),
h( h(
@ -236,7 +236,7 @@ class AccountDropdowns extends Component {
fontSize: '16px', fontSize: '16px',
lineHeight: '23px', lineHeight: '23px',
}, },
}, t('importAccount')), }, this.props.t('importAccount')),
] ]
), ),
] ]
@ -287,7 +287,7 @@ class AccountDropdowns extends Component {
menuItemStyles, menuItemStyles,
), ),
}, },
t('accountDetails'), this.props.t('accountDetails'),
), ),
h( h(
DropdownMenuItem, DropdownMenuItem,
@ -303,7 +303,7 @@ class AccountDropdowns extends Component {
menuItemStyles, menuItemStyles,
), ),
}, },
t('etherscanView'), this.props.t('etherscanView'),
), ),
h( h(
DropdownMenuItem, DropdownMenuItem,
@ -319,7 +319,7 @@ class AccountDropdowns extends Component {
menuItemStyles, menuItemStyles,
), ),
}, },
t('copyAddress'), this.props.t('copyAddress'),
), ),
h( h(
DropdownMenuItem, DropdownMenuItem,
@ -331,7 +331,7 @@ class AccountDropdowns extends Component {
menuItemStyles, menuItemStyles,
), ),
}, },
t('exportPrivateKey'), this.props.t('exportPrivateKey'),
), ),
h( h(
DropdownMenuItem, DropdownMenuItem,
@ -346,7 +346,7 @@ class AccountDropdowns extends Component {
menuItemStyles, menuItemStyles,
), ),
}, },
t('addToken'), this.props.t('addToken'),
), ),
] ]
@ -425,6 +425,7 @@ AccountDropdowns.propTypes = {
enableAccountsSelector: PropTypes.bool, enableAccountsSelector: PropTypes.bool,
enableAccountOption: PropTypes.bool, enableAccountOption: PropTypes.bool,
enableAccountOptions: PropTypes.bool, enableAccountOptions: PropTypes.bool,
t: PropTypes.func,
} }
const mapDispatchToProps = (dispatch) => { const mapDispatchToProps = (dispatch) => {

View File

@ -1,14 +1,14 @@
const Component = require('react').Component const Component = require('react').Component
const h = require('react-hyperscript') const h = require('react-hyperscript')
const inherits = require('util').inherits const inherits = require('util').inherits
const connect = require('react-redux').connect const connect = require('../../metamask-connect')
const actions = require('../../actions') const actions = require('../../actions')
const Dropdown = require('./components/dropdown').Dropdown const Dropdown = require('./components/dropdown').Dropdown
const DropdownMenuItem = require('./components/dropdown').DropdownMenuItem const DropdownMenuItem = require('./components/dropdown').DropdownMenuItem
const NetworkDropdownIcon = require('./components/network-dropdown-icon') const NetworkDropdownIcon = require('./components/network-dropdown-icon')
const t = require('../../../i18n')
const R = require('ramda') const R = require('ramda')
// classes from nodes of the toggle element. // classes from nodes of the toggle element.
const notToggleElementClassnames = [ const notToggleElementClassnames = [
'menu-icon', 'menu-icon',
@ -94,13 +94,13 @@ NetworkDropdown.prototype.render = function () {
}, [ }, [
h('div.network-dropdown-header', {}, [ h('div.network-dropdown-header', {}, [
h('div.network-dropdown-title', {}, t('networks')), h('div.network-dropdown-title', {}, this.props.t('networks')),
h('div.network-dropdown-divider'), h('div.network-dropdown-divider'),
h('div.network-dropdown-content', h('div.network-dropdown-content',
{}, {},
t('defaultNetwork') this.props.t('defaultNetwork')
), ),
]), ]),
@ -122,7 +122,7 @@ NetworkDropdown.prototype.render = function () {
style: { style: {
color: providerType === 'mainnet' ? '#ffffff' : '#9b9b9b', color: providerType === 'mainnet' ? '#ffffff' : '#9b9b9b',
}, },
}, t('mainnet')), }, this.props.t('mainnet')),
] ]
), ),
@ -144,7 +144,7 @@ NetworkDropdown.prototype.render = function () {
style: { style: {
color: providerType === 'ropsten' ? '#ffffff' : '#9b9b9b', color: providerType === 'ropsten' ? '#ffffff' : '#9b9b9b',
}, },
}, t('ropsten')), }, this.props.t('ropsten')),
] ]
), ),
@ -166,7 +166,7 @@ NetworkDropdown.prototype.render = function () {
style: { style: {
color: providerType === 'kovan' ? '#ffffff' : '#9b9b9b', color: providerType === 'kovan' ? '#ffffff' : '#9b9b9b',
}, },
}, t('kovan')), }, this.props.t('kovan')),
] ]
), ),
@ -188,7 +188,7 @@ NetworkDropdown.prototype.render = function () {
style: { style: {
color: providerType === 'rinkeby' ? '#ffffff' : '#9b9b9b', color: providerType === 'rinkeby' ? '#ffffff' : '#9b9b9b',
}, },
}, t('rinkeby')), }, this.props.t('rinkeby')),
] ]
), ),
@ -210,7 +210,7 @@ NetworkDropdown.prototype.render = function () {
style: { style: {
color: activeNetwork === 'http://localhost:8545' ? '#ffffff' : '#9b9b9b', color: activeNetwork === 'http://localhost:8545' ? '#ffffff' : '#9b9b9b',
}, },
}, t('localhost')), }, this.props.t('localhost')),
] ]
), ),
@ -234,7 +234,7 @@ NetworkDropdown.prototype.render = function () {
style: { style: {
color: activeNetwork === 'custom' ? '#ffffff' : '#9b9b9b', color: activeNetwork === 'custom' ? '#ffffff' : '#9b9b9b',
}, },
}, t('customRPC')), }, this.props.t('customRPC')),
] ]
), ),
@ -249,15 +249,15 @@ NetworkDropdown.prototype.getNetworkName = function () {
let name let name
if (providerName === 'mainnet') { if (providerName === 'mainnet') {
name = t('mainnet') name = this.props.t('mainnet')
} else if (providerName === 'ropsten') { } else if (providerName === 'ropsten') {
name = t('ropsten') name = this.props.t('ropsten')
} else if (providerName === 'kovan') { } else if (providerName === 'kovan') {
name = t('kovan') name = this.props.t('kovan')
} else if (providerName === 'rinkeby') { } else if (providerName === 'rinkeby') {
name = t('rinkeby') name = this.props.t('rinkeby')
} else { } else {
name = t('unknownNetwork') name = this.props.t('unknownNetwork')
} }
return name return name

View File

@ -1,9 +1,9 @@
const Component = require('react').Component const Component = require('react').Component
const h = require('react-hyperscript') const h = require('react-hyperscript')
const inherits = require('util').inherits const inherits = require('util').inherits
const connect = require('react-redux').connect const connect = require('../../metamask-connect')
const actions = require('../../actions') const actions = require('../../actions')
const t = require('../../../i18n')
module.exports = connect(null, mapDispatchToProps)(TokenMenuDropdown) module.exports = connect(null, mapDispatchToProps)(TokenMenuDropdown)
@ -44,7 +44,7 @@ TokenMenuDropdown.prototype.render = function () {
showHideTokenConfirmationModal(this.props.token) showHideTokenConfirmationModal(this.props.token)
this.props.onClose() this.props.onClose()
}, },
}, t('hideToken')), }, this.props.t('hideToken')),
]), ]),
]), ]),

View File

@ -8,11 +8,10 @@ const ENS = require('ethjs-ens')
const networkMap = require('ethjs-ens/lib/network-map.json') const networkMap = require('ethjs-ens/lib/network-map.json')
const ensRE = /.+\..+$/ const ensRE = /.+\..+$/
const ZERO_ADDRESS = '0x0000000000000000000000000000000000000000' const ZERO_ADDRESS = '0x0000000000000000000000000000000000000000'
const t = require('../../i18n') const connect = require('../metamask-connect')
const ToAutoComplete = require('./send/to-autocomplete') const ToAutoComplete = require('./send/to-autocomplete')
module.exports = connect()(EnsInput)
module.exports = EnsInput
inherits(EnsInput, Component) inherits(EnsInput, Component)
function EnsInput () { function EnsInput () {
@ -71,13 +70,13 @@ EnsInput.prototype.lookupEnsName = function (recipient) {
log.info(`ENS attempting to resolve name: ${recipient}`) log.info(`ENS attempting to resolve name: ${recipient}`)
this.ens.lookup(recipient.trim()) this.ens.lookup(recipient.trim())
.then((address) => { .then((address) => {
if (address === ZERO_ADDRESS) throw new Error(t('noAddressForName')) if (address === ZERO_ADDRESS) throw new Error(this.props.t('noAddressForName'))
if (address !== ensResolution) { if (address !== ensResolution) {
this.setState({ this.setState({
loadingEns: false, loadingEns: false,
ensResolution: address, ensResolution: address,
nickname: recipient.trim(), nickname: recipient.trim(),
hoverText: address + '\n' + t('clickCopy'), hoverText: address + '\n' + this.props.t('clickCopy'),
ensFailure: false, ensFailure: false,
}) })
} }

View File

@ -4,9 +4,9 @@ const inherits = require('util').inherits
const ethUtil = require('ethereumjs-util') const ethUtil = require('ethereumjs-util')
const BN = ethUtil.BN const BN = ethUtil.BN
const extend = require('xtend') const extend = require('xtend')
const t = require('../../i18n') const connect = require('../metamask-connect')
module.exports = HexAsDecimalInput module.exports = connect()(HexAsDecimalInput)
inherits(HexAsDecimalInput, Component) inherits(HexAsDecimalInput, Component)
function HexAsDecimalInput () { function HexAsDecimalInput () {
@ -127,13 +127,13 @@ HexAsDecimalInput.prototype.constructWarning = function () {
let message = name ? name + ' ' : '' let message = name ? name + ' ' : ''
if (min && max) { if (min && max) {
message += t('betweenMinAndMax', [min, max]) message += this.props.t('betweenMinAndMax', [min, max])
} else if (min) { } else if (min) {
message += t('greaterThanMin', [min]) message += this.props.t('greaterThanMin', [min])
} else if (max) { } else if (max) {
message += t('lessThanMax', [max]) message += this.props.t('lessThanMax', [max])
} else { } else {
message += t('invalidInput') message += this.props.t('invalidInput')
} }
return message return message

View File

@ -1,7 +1,7 @@
const Component = require('react').Component const Component = require('react').Component
const h = require('react-hyperscript') const h = require('react-hyperscript')
const inherits = require('util').inherits const inherits = require('util').inherits
const connect = require('react-redux').connect const connect = require('../metamask-connect')
const isNode = require('detect-node') const isNode = require('detect-node')
const findDOMNode = require('react-dom').findDOMNode const findDOMNode = require('react-dom').findDOMNode
const jazzicon = require('jazzicon') const jazzicon = require('jazzicon')

View File

@ -1,14 +1,13 @@
const Component = require('react').Component const Component = require('react').Component
const h = require('react-hyperscript') const h = require('react-hyperscript')
const inherits = require('util').inherits const inherits = require('util').inherits
const connect = require('react-redux').connect const connect = require('../../metamask-connect')
const actions = require('../../actions') const actions = require('../../actions')
const AccountModalContainer = require('./account-modal-container') const AccountModalContainer = require('./account-modal-container')
const { getSelectedIdentity } = require('../../selectors') const { getSelectedIdentity } = require('../../selectors')
const genAccountLink = require('../../../lib/account-link.js') const genAccountLink = require('../../../lib/account-link.js')
const QrView = require('../qr-code') const QrView = require('../qr-code')
const EditableLabel = require('../editable-label') const EditableLabel = require('../editable-label')
const t = require('../../../i18n')
function mapStateToProps (state) { function mapStateToProps (state) {
return { return {
@ -65,12 +64,12 @@ AccountDetailsModal.prototype.render = function () {
h('button.btn-primary.account-modal__button', { h('button.btn-primary.account-modal__button', {
onClick: () => global.platform.openWindow({ url: genAccountLink(address, network) }), onClick: () => global.platform.openWindow({ url: genAccountLink(address, network) }),
}, t('etherscanView')), }, this.props.t('etherscanView')),
// Holding on redesign for Export Private Key functionality // Holding on redesign for Export Private Key functionality
h('button.btn-primary.account-modal__button', { h('button.btn-primary.account-modal__button', {
onClick: () => showExportPrivateKeyModal(), onClick: () => showExportPrivateKeyModal(),
}, t('exportPrivateKey')), }, this.props.t('exportPrivateKey')),
]) ])
} }

View File

@ -1,11 +1,10 @@
const Component = require('react').Component const Component = require('react').Component
const h = require('react-hyperscript') const h = require('react-hyperscript')
const inherits = require('util').inherits const inherits = require('util').inherits
const connect = require('react-redux').connect const connect = require('../../metamask-connect')
const actions = require('../../actions') const actions = require('../../actions')
const { getSelectedIdentity } = require('../../selectors') const { getSelectedIdentity } = require('../../selectors')
const Identicon = require('../identicon') const Identicon = require('../identicon')
const t = require('../../../i18n')
function mapStateToProps (state) { function mapStateToProps (state) {
return { return {
@ -60,7 +59,7 @@ AccountModalContainer.prototype.render = function () {
h('i.fa.fa-angle-left.fa-lg'), h('i.fa.fa-angle-left.fa-lg'),
h('span.account-modal-back__text', ' ' + t('back')), h('span.account-modal-back__text', ' ' + this.props.t('back')),
]), ]),

View File

@ -1,10 +1,9 @@
const Component = require('react').Component const Component = require('react').Component
const h = require('react-hyperscript') const h = require('react-hyperscript')
const inherits = require('util').inherits const inherits = require('util').inherits
const connect = require('react-redux').connect const connect = require('../../metamask-connect')
const actions = require('../../actions') const actions = require('../../actions')
const networkNames = require('../../../../app/scripts/config.js').networkNames const networkNames = require('../../../../app/scripts/config.js').networkNames
const t = require('../../../i18n')
function mapStateToProps (state) { function mapStateToProps (state) {
return { return {
@ -57,15 +56,15 @@ BuyOptions.prototype.render = function () {
}, [ }, [
h('div.buy-modal-content-title', { h('div.buy-modal-content-title', {
style: {}, style: {},
}, t('transfers')), }, this.props.t('transfers')),
h('div', {}, t('howToDeposit')), h('div', {}, this.props.t('howToDeposit')),
]), ]),
h('div.buy-modal-content-options.flex-column.flex-center', {}, [ h('div.buy-modal-content-options.flex-column.flex-center', {}, [
isTestNetwork isTestNetwork
? this.renderModalContentOption(networkName, t('testFaucet'), () => toFaucet(network)) ? this.renderModalContentOption(networkName, this.props.t('testFaucet'), () => toFaucet(network))
: this.renderModalContentOption('Coinbase', t('depositFiat'), () => toCoinbase(address)), : this.renderModalContentOption('Coinbase', this.props.t('depositFiat'), () => toCoinbase(address)),
// h('div.buy-modal-content-option', {}, [ // h('div.buy-modal-content-option', {}, [
// h('div.buy-modal-content-option-title', {}, 'Shapeshift'), // h('div.buy-modal-content-option-title', {}, 'Shapeshift'),
@ -73,8 +72,8 @@ BuyOptions.prototype.render = function () {
// ]),, // ]),,
this.renderModalContentOption( this.renderModalContentOption(
t('directDeposit'), this.props.t('directDeposit'),
t('depositFromAccount'), this.props.t('depositFromAccount'),
() => this.goToAccountDetailsModal() () => this.goToAccountDetailsModal()
), ),
@ -85,7 +84,7 @@ BuyOptions.prototype.render = function () {
background: 'white', background: 'white',
}, },
onClick: () => { this.props.hideModal() }, onClick: () => { this.props.hideModal() },
}, h('div.buy-modal-content-footer#buy-modal-content-footer-text', {}, t('cancel'))), }, h('div.buy-modal-content-footer#buy-modal-content-footer-text', {}, this.props.t('cancel'))),
]), ]),
]) ])
} }

View File

@ -1,22 +1,18 @@
const Component = require('react').Component const Component = require('react').Component
const h = require('react-hyperscript') const h = require('react-hyperscript')
const inherits = require('util').inherits const inherits = require('util').inherits
const connect = require('react-redux').connect const connect = require('../../metamask-connect')
const actions = require('../../actions') const actions = require('../../actions')
const networkNames = require('../../../../app/scripts/config.js').networkNames const networkNames = require('../../../../app/scripts/config.js').networkNames
const ShapeshiftForm = require('../shapeshift-form') const ShapeshiftForm = require('../shapeshift-form')
const t = require('../../../i18n')
const DIRECT_DEPOSIT_ROW_TITLE = t('directDepositEther') let DIRECT_DEPOSIT_ROW_TITLE
const DIRECT_DEPOSIT_ROW_TEXT = t('directDepositEtherExplainer') let DIRECT_DEPOSIT_ROW_TEXT
const COINBASE_ROW_TITLE = t('buyCoinbase') let COINBASE_ROW_TITLE
const COINBASE_ROW_TEXT = t('buyCoinbaseExplainer') let COINBASE_ROW_TEXT
const SHAPESHIFT_ROW_TITLE = t('depositShapeShift') let SHAPESHIFT_ROW_TITLE
const SHAPESHIFT_ROW_TEXT = t('depositShapeShiftExplainer') let SHAPESHIFT_ROW_TEXT
const FAUCET_ROW_TITLE = t('testFaucet') let FAUCET_ROW_TITLE
const facuetRowText = (networkName) => {
return t('getEtherFromFaucet', [networkName])
}
function mapStateToProps (state) { function mapStateToProps (state) {
return { return {
@ -44,9 +40,18 @@ function mapDispatchToProps (dispatch) {
} }
inherits(DepositEtherModal, Component) inherits(DepositEtherModal, Component)
function DepositEtherModal () { function DepositEtherModal (props) {
Component.call(this) Component.call(this)
// need to set after i18n locale has loaded
DIRECT_DEPOSIT_ROW_TITLE = props.t('directDepositEther')
DIRECT_DEPOSIT_ROW_TEXT = props.t('directDepositEtherExplainer')
COINBASE_ROW_TITLE = props.t('buyCoinbase')
COINBASE_ROW_TEXT = props.t('buyCoinbaseExplainer')
SHAPESHIFT_ROW_TITLE = props.t('depositShapeShift')
SHAPESHIFT_ROW_TEXT = props.t('depositShapeShiftExplainer')
FAUCET_ROW_TITLE = props.t('testFaucet')
this.state = { this.state = {
buyingWithShapeshift: false, buyingWithShapeshift: false,
} }
@ -54,6 +59,10 @@ function DepositEtherModal () {
module.exports = connect(mapStateToProps, mapDispatchToProps)(DepositEtherModal) module.exports = connect(mapStateToProps, mapDispatchToProps)(DepositEtherModal)
DepositEtherModal.prototype.facuetRowText = function (networkName) {
return this.props.t('getEtherFromFaucet', [networkName])
}
DepositEtherModal.prototype.renderRow = function ({ DepositEtherModal.prototype.renderRow = function ({
logo, logo,
title, title,
@ -113,10 +122,10 @@ DepositEtherModal.prototype.render = function () {
h('div.page-container__header', [ h('div.page-container__header', [
h('div.page-container__title', [t('depositEther')]), h('div.page-container__title', [this.props.t('depositEther')]),
h('div.page-container__subtitle', [ h('div.page-container__subtitle', [
t('needEtherInWallet'), this.props.t('needEtherInWallet'),
]), ]),
h('div.page-container__header-close', { h('div.page-container__header-close', {
@ -139,7 +148,7 @@ DepositEtherModal.prototype.render = function () {
}), }),
title: DIRECT_DEPOSIT_ROW_TITLE, title: DIRECT_DEPOSIT_ROW_TITLE,
text: DIRECT_DEPOSIT_ROW_TEXT, text: DIRECT_DEPOSIT_ROW_TEXT,
buttonLabel: t('viewAccount'), buttonLabel: this.props.t('viewAccount'),
onButtonClick: () => this.goToAccountDetailsModal(), onButtonClick: () => this.goToAccountDetailsModal(),
hide: buyingWithShapeshift, hide: buyingWithShapeshift,
}), }),
@ -147,8 +156,8 @@ DepositEtherModal.prototype.render = function () {
this.renderRow({ this.renderRow({
logo: h('i.fa.fa-tint.fa-2x'), logo: h('i.fa.fa-tint.fa-2x'),
title: FAUCET_ROW_TITLE, title: FAUCET_ROW_TITLE,
text: facuetRowText(networkName), text: this.facuetRowText(networkName),
buttonLabel: t('getEther'), buttonLabel: this.props.t('getEther'),
onButtonClick: () => toFaucet(network), onButtonClick: () => toFaucet(network),
hide: !isTestNetwork || buyingWithShapeshift, hide: !isTestNetwork || buyingWithShapeshift,
}), }),
@ -162,7 +171,7 @@ DepositEtherModal.prototype.render = function () {
}), }),
title: COINBASE_ROW_TITLE, title: COINBASE_ROW_TITLE,
text: COINBASE_ROW_TEXT, text: COINBASE_ROW_TEXT,
buttonLabel: t('continueToCoinbase'), buttonLabel: this.props.t('continueToCoinbase'),
onButtonClick: () => toCoinbase(address), onButtonClick: () => toCoinbase(address),
hide: isTestNetwork || buyingWithShapeshift, hide: isTestNetwork || buyingWithShapeshift,
}), }),
@ -175,7 +184,7 @@ DepositEtherModal.prototype.render = function () {
}), }),
title: SHAPESHIFT_ROW_TITLE, title: SHAPESHIFT_ROW_TITLE,
text: SHAPESHIFT_ROW_TEXT, text: SHAPESHIFT_ROW_TEXT,
buttonLabel: t('shapeshiftBuy'), buttonLabel: this.props.t('shapeshiftBuy'),
onButtonClick: () => this.setState({ buyingWithShapeshift: true }), onButtonClick: () => this.setState({ buyingWithShapeshift: true }),
hide: isTestNetwork, hide: isTestNetwork,
hideButton: buyingWithShapeshift, hideButton: buyingWithShapeshift,

View File

@ -1,10 +1,9 @@
const Component = require('react').Component const Component = require('react').Component
const h = require('react-hyperscript') const h = require('react-hyperscript')
const inherits = require('util').inherits const inherits = require('util').inherits
const connect = require('react-redux').connect const connect = require('../../metamask-connect')
const actions = require('../../actions') const actions = require('../../actions')
const { getSelectedAccount } = require('../../selectors') const { getSelectedAccount } = require('../../selectors')
const t = require('../../../i18n')
function mapStateToProps (state) { function mapStateToProps (state) {
return { return {
@ -51,7 +50,7 @@ EditAccountNameModal.prototype.render = function () {
]), ]),
h('div.edit-account-name-modal-title', { h('div.edit-account-name-modal-title', {
}, [t('editAccountName')]), }, [this.props.t('editAccountName')]),
h('input.edit-account-name-modal-input', { h('input.edit-account-name-modal-input', {
placeholder: identity.name, placeholder: identity.name,
@ -70,7 +69,7 @@ EditAccountNameModal.prototype.render = function () {
}, },
disabled: this.state.inputText.length === 0, disabled: this.state.inputText.length === 0,
}, [ }, [
t('save'), this.props.t('save'),
]), ]),
]), ]),

View File

@ -1,13 +1,12 @@
const Component = require('react').Component const Component = require('react').Component
const h = require('react-hyperscript') const h = require('react-hyperscript')
const inherits = require('util').inherits const inherits = require('util').inherits
const connect = require('react-redux').connect const connect = require('../../metamask-connect')
const ethUtil = require('ethereumjs-util') const ethUtil = require('ethereumjs-util')
const actions = require('../../actions') const actions = require('../../actions')
const AccountModalContainer = require('./account-modal-container') const AccountModalContainer = require('./account-modal-container')
const { getSelectedIdentity } = require('../../selectors') const { getSelectedIdentity } = require('../../selectors')
const ReadOnlyInput = require('../readonly-input') const ReadOnlyInput = require('../readonly-input')
const t = require('../../../i18n')
const copyToClipboard = require('copy-to-clipboard') const copyToClipboard = require('copy-to-clipboard')
function mapStateToProps (state) { function mapStateToProps (state) {
@ -49,8 +48,8 @@ ExportPrivateKeyModal.prototype.exportAccountAndGetPrivateKey = function (passwo
ExportPrivateKeyModal.prototype.renderPasswordLabel = function (privateKey) { ExportPrivateKeyModal.prototype.renderPasswordLabel = function (privateKey) {
return h('span.private-key-password-label', privateKey return h('span.private-key-password-label', privateKey
? t('copyPrivateKey') ? this.props.t('copyPrivateKey')
: t('typePassword') : this.props.t('typePassword')
) )
} }
@ -87,8 +86,8 @@ ExportPrivateKeyModal.prototype.renderButtons = function (privateKey, password,
), ),
(privateKey (privateKey
? this.renderButton('btn-primary--lg export-private-key__button', () => hideModal(), t('done')) ? this.renderButton('btn-primary--lg export-private-key__button', () => hideModal(), this.props.t('done'))
: this.renderButton('btn-primary--lg export-private-key__button', () => this.exportAccountAndGetPrivateKey(this.state.password, address), t('confirm')) : this.renderButton('btn-primary--lg export-private-key__button', () => this.exportAccountAndGetPrivateKey(this.state.password, address), this.props.t('confirm'))
), ),
]) ])
@ -121,7 +120,7 @@ ExportPrivateKeyModal.prototype.render = function () {
h('div.account-modal-divider'), h('div.account-modal-divider'),
h('span.modal-body-title', t('showPrivateKeys')), h('span.modal-body-title', this.props.t('showPrivateKeys')),
h('div.private-key-password', {}, [ h('div.private-key-password', {}, [
this.renderPasswordLabel(privateKey), this.renderPasswordLabel(privateKey),
@ -131,7 +130,7 @@ ExportPrivateKeyModal.prototype.render = function () {
!warning ? null : h('span.private-key-password-error', warning), !warning ? null : h('span.private-key-password-error', warning),
]), ]),
h('div.private-key-password-warning', t('privateKeyWarning')), h('div.private-key-password-warning', this.props.t('privateKeyWarning')),
this.renderButtons(privateKey, this.state.password, address, hideModal), this.renderButtons(privateKey, this.state.password, address, hideModal),

View File

@ -1,10 +1,9 @@
const Component = require('react').Component const Component = require('react').Component
const h = require('react-hyperscript') const h = require('react-hyperscript')
const inherits = require('util').inherits const inherits = require('util').inherits
const connect = require('react-redux').connect const connect = require('../../metamask-connect')
const actions = require('../../actions') const actions = require('../../actions')
const Identicon = require('../identicon') const Identicon = require('../identicon')
const t = require('../../../i18n')
function mapStateToProps (state) { function mapStateToProps (state) {
return { return {
@ -42,7 +41,7 @@ HideTokenConfirmationModal.prototype.render = function () {
h('div.hide-token-confirmation__container', { h('div.hide-token-confirmation__container', {
}, [ }, [
h('div.hide-token-confirmation__title', {}, [ h('div.hide-token-confirmation__title', {}, [
t('hideTokenPrompt'), this.props.t('hideTokenPrompt'),
]), ]),
h(Identicon, { h(Identicon, {
@ -55,19 +54,19 @@ HideTokenConfirmationModal.prototype.render = function () {
h('div.hide-token-confirmation__symbol', {}, symbol), h('div.hide-token-confirmation__symbol', {}, symbol),
h('div.hide-token-confirmation__copy', {}, [ h('div.hide-token-confirmation__copy', {}, [
t('readdToken'), this.props.t('readdToken'),
]), ]),
h('div.hide-token-confirmation__buttons', {}, [ h('div.hide-token-confirmation__buttons', {}, [
h('button.btn-cancel.hide-token-confirmation__button.allcaps', { h('button.btn-cancel.hide-token-confirmation__button.allcaps', {
onClick: () => hideModal(), onClick: () => hideModal(),
}, [ }, [
t('cancel'), this.props.t('cancel'),
]), ]),
h('button.btn-clear.hide-token-confirmation__button.allcaps', { h('button.btn-clear.hide-token-confirmation__button.allcaps', {
onClick: () => hideToken(address), onClick: () => hideToken(address),
}, [ }, [
t('hide'), this.props.t('hide'),
]), ]),
]), ]),
]), ]),

View File

@ -6,7 +6,6 @@ const FadeModal = require('boron').FadeModal
const actions = require('../../actions') const actions = require('../../actions')
const isMobileView = require('../../../lib/is-mobile-view') const isMobileView = require('../../../lib/is-mobile-view')
const isPopupOrNotification = require('../../../../app/scripts/lib/is-popup-or-notification') const isPopupOrNotification = require('../../../../app/scripts/lib/is-popup-or-notification')
const t = require('../../../i18n')
// Modal Components // Modal Components
const BuyOptions = require('./buy-options-modal') const BuyOptions = require('./buy-options-modal')
@ -174,8 +173,8 @@ const MODALS = {
BETA_UI_NOTIFICATION_MODAL: { BETA_UI_NOTIFICATION_MODAL: {
contents: [ contents: [
h(NotifcationModal, { h(NotifcationModal, {
header: t('uiWelcome'), header: 'uiWelcome',
message: t('uiWelcomeMessage'), message: 'uiWelcomeMessage',
}), }),
], ],
mobileModalStyle: { mobileModalStyle: {
@ -191,8 +190,8 @@ const MODALS = {
OLD_UI_NOTIFICATION_MODAL: { OLD_UI_NOTIFICATION_MODAL: {
contents: [ contents: [
h(NotifcationModal, { h(NotifcationModal, {
header: t('oldUI'), header: 'oldUI',
message: t('oldUIMessage'), message: 'oldUIMessage',
}), }),
], ],
mobileModalStyle: { mobileModalStyle: {

View File

@ -1,9 +1,8 @@
const { Component } = require('react') const { Component } = require('react')
const PropTypes = require('prop-types') const PropTypes = require('prop-types')
const h = require('react-hyperscript') const h = require('react-hyperscript')
const { connect } = require('react-redux') const connect = require('../../metamask-connect')
const actions = require('../../actions') const actions = require('../../actions')
const t = require('../../../i18n')
class NewAccountModal extends Component { class NewAccountModal extends Component {
constructor (props) { constructor (props) {
@ -12,7 +11,7 @@ class NewAccountModal extends Component {
const newAccountNumber = numberOfExistingAccounts + 1 const newAccountNumber = numberOfExistingAccounts + 1
this.state = { this.state = {
newAccountName: `${t('account')} ${newAccountNumber}`, newAccountName: `${props.t('account')} ${newAccountNumber}`,
} }
} }
@ -23,7 +22,7 @@ class NewAccountModal extends Component {
h('div.new-account-modal-wrapper', { h('div.new-account-modal-wrapper', {
}, [ }, [
h('div.new-account-modal-header', {}, [ h('div.new-account-modal-header', {}, [
t('newAccount'), this.props.t('newAccount'),
]), ]),
h('div.modal-close-x', { h('div.modal-close-x', {
@ -31,19 +30,19 @@ class NewAccountModal extends Component {
}), }),
h('div.new-account-modal-content', {}, [ h('div.new-account-modal-content', {}, [
t('accountName'), this.props.t('accountName'),
]), ]),
h('div.new-account-input-wrapper', {}, [ h('div.new-account-input-wrapper', {}, [
h('input.new-account-input', { h('input.new-account-input', {
value: this.state.newAccountName, value: this.state.newAccountName,
placeholder: t('sampleAccountName'), placeholder: this.props.t('sampleAccountName'),
onChange: event => this.setState({ newAccountName: event.target.value }), onChange: event => this.setState({ newAccountName: event.target.value }),
}, []), }, []),
]), ]),
h('div.new-account-modal-content.after-input', {}, [ h('div.new-account-modal-content.after-input', {}, [
t('or'), this.props.t('or'),
]), ]),
h('div.new-account-modal-content.after-input.pointer', { h('div.new-account-modal-content.after-input.pointer', {
@ -51,13 +50,13 @@ class NewAccountModal extends Component {
this.props.hideModal() this.props.hideModal()
this.props.showImportPage() this.props.showImportPage()
}, },
}, t('importAnAccount')), }, this.props.t('importAnAccount')),
h('div.new-account-modal-content.button.allcaps', {}, [ h('div.new-account-modal-content.button.allcaps', {}, [
h('button.btn-clear', { h('button.btn-clear', {
onClick: () => this.props.createAccount(newAccountName), onClick: () => this.props.createAccount(newAccountName),
}, [ }, [
t('save'), this.props.t('save'),
]), ]),
]), ]),
]), ]),
@ -70,6 +69,7 @@ NewAccountModal.propTypes = {
showImportPage: PropTypes.func, showImportPage: PropTypes.func,
createAccount: PropTypes.func, createAccount: PropTypes.func,
numberOfExistingAccounts: PropTypes.number, numberOfExistingAccounts: PropTypes.number,
t: PropTypes.func,
} }
const mapStateToProps = state => { const mapStateToProps = state => {

View File

@ -1,7 +1,7 @@
const { Component } = require('react') const { Component } = require('react')
const PropTypes = require('prop-types') const PropTypes = require('prop-types')
const h = require('react-hyperscript') const h = require('react-hyperscript')
const { connect } = require('react-redux') const connect = require('../../metamask-connect')
const actions = require('../../actions') const actions = require('../../actions')
class NotificationModal extends Component { class NotificationModal extends Component {
@ -22,12 +22,12 @@ class NotificationModal extends Component {
}, [ }, [
h('div.notification-modal__header', {}, [ h('div.notification-modal__header', {}, [
header, this.props.t(header),
]), ]),
h('div.notification-modal__message-wrapper', {}, [ h('div.notification-modal__message-wrapper', {}, [
h('div.notification-modal__message', {}, [ h('div.notification-modal__message', {}, [
message, this.props.t(message),
]), ]),
]), ]),
@ -62,6 +62,7 @@ NotificationModal.propTypes = {
showCancelButton: PropTypes.bool, showCancelButton: PropTypes.bool,
showConfirmButton: PropTypes.bool, showConfirmButton: PropTypes.bool,
onConfirm: PropTypes.func, onConfirm: PropTypes.func,
t: PropTypes.func,
} }
const mapDispatchToProps = dispatch => { const mapDispatchToProps = dispatch => {

View File

@ -1,7 +1,7 @@
const { Component } = require('react') const { Component } = require('react')
const PropTypes = require('prop-types') const PropTypes = require('prop-types')
const h = require('react-hyperscript') const h = require('react-hyperscript')
const { connect } = require('react-redux') const connect = require('../../../metamask-connect')
const actions = require('../../../actions') const actions = require('../../../actions')
const NotifcationModal = require('../notification-modal') const NotifcationModal = require('../notification-modal')

View File

@ -1,7 +1,7 @@
const Component = require('react').Component const Component = require('react').Component
const h = require('react-hyperscript') const h = require('react-hyperscript')
const inherits = require('util').inherits const inherits = require('util').inherits
const connect = require('react-redux').connect const connect = require('../../metamask-connect')
const actions = require('../../actions') const actions = require('../../actions')
const QrView = require('../qr-code') const QrView = require('../qr-code')
const AccountModalContainer = require('./account-modal-container') const AccountModalContainer = require('./account-modal-container')

View File

@ -1,9 +1,8 @@
const { Component } = require('react') const { Component } = require('react')
const h = require('react-hyperscript') const h = require('react-hyperscript')
const PropTypes = require('prop-types') const PropTypes = require('prop-types')
const { connect } = require('react-redux') const connect = require('../metamask-connect')
const NetworkDropdownIcon = require('./dropdowns/components/network-dropdown-icon') const NetworkDropdownIcon = require('./dropdowns/components/network-dropdown-icon')
const t = require('../../i18n')
const networkToColorHash = { const networkToColorHash = {
1: '#038789', 1: '#038789',
@ -31,7 +30,7 @@ class NetworkDisplay extends Component {
const { provider: { type } } = this.props const { provider: { type } } = this.props
return h('.network-display__container', [ return h('.network-display__container', [
this.renderNetworkIcon(), this.renderNetworkIcon(),
h('.network-name', t(type)), h('.network-name', this.props.t(type)),
]) ])
} }
} }
@ -39,6 +38,7 @@ class NetworkDisplay extends Component {
NetworkDisplay.propTypes = { NetworkDisplay.propTypes = {
network: PropTypes.string, network: PropTypes.string,
provider: PropTypes.object, provider: PropTypes.object,
t: PropTypes.func,
} }
const mapStateToProps = ({ metamask: { network, provider } }) => { const mapStateToProps = ({ metamask: { network, provider } }) => {

View File

@ -1,11 +1,11 @@
const Component = require('react').Component const Component = require('react').Component
const h = require('react-hyperscript') const h = require('react-hyperscript')
const connect = require('../metamask-connect')
const classnames = require('classnames') const classnames = require('classnames')
const inherits = require('util').inherits const inherits = require('util').inherits
const NetworkDropdownIcon = require('./dropdowns/components/network-dropdown-icon') const NetworkDropdownIcon = require('./dropdowns/components/network-dropdown-icon')
const t = require('../../i18n')
module.exports = Network module.exports = connect()(Network)
inherits(Network, Component) inherits(Network, Component)
@ -34,7 +34,7 @@ Network.prototype.render = function () {
onClick: (event) => this.props.onClick(event), onClick: (event) => this.props.onClick(event),
}, [ }, [
h('img', { h('img', {
title: t('attemptingConnect'), title: props.t('attemptingConnect'),
style: { style: {
width: '27px', width: '27px',
}, },
@ -42,22 +42,22 @@ Network.prototype.render = function () {
}), }),
]) ])
} else if (providerName === 'mainnet') { } else if (providerName === 'mainnet') {
hoverText = t('mainnet') hoverText = props.t('mainnet')
iconName = 'ethereum-network' iconName = 'ethereum-network'
} else if (providerName === 'ropsten') { } else if (providerName === 'ropsten') {
hoverText = t('ropsten') hoverText = props.t('ropsten')
iconName = 'ropsten-test-network' iconName = 'ropsten-test-network'
} else if (parseInt(networkNumber) === 3) { } else if (parseInt(networkNumber) === 3) {
hoverText = t('ropsten') hoverText = props.t('ropsten')
iconName = 'ropsten-test-network' iconName = 'ropsten-test-network'
} else if (providerName === 'kovan') { } else if (providerName === 'kovan') {
hoverText = t('kovan') hoverText = props.t('kovan')
iconName = 'kovan-test-network' iconName = 'kovan-test-network'
} else if (providerName === 'rinkeby') { } else if (providerName === 'rinkeby') {
hoverText = t('rinkeby') hoverText = props.t('rinkeby')
iconName = 'rinkeby-test-network' iconName = 'rinkeby-test-network'
} else { } else {
hoverText = t('unknownNetwork') hoverText = props.t('unknownNetwork')
iconName = 'unknown-private-network' iconName = 'unknown-private-network'
} }
@ -85,7 +85,7 @@ Network.prototype.render = function () {
backgroundColor: '#038789', // $blue-lagoon backgroundColor: '#038789', // $blue-lagoon
nonSelectBackgroundColor: '#15afb2', nonSelectBackgroundColor: '#15afb2',
}), }),
h('.network-name', t('mainnet')), h('.network-name', props.t('mainnet')),
h('i.fa.fa-chevron-down.fa-lg.network-caret'), h('i.fa.fa-chevron-down.fa-lg.network-caret'),
]) ])
case 'ropsten-test-network': case 'ropsten-test-network':
@ -94,7 +94,7 @@ Network.prototype.render = function () {
backgroundColor: '#e91550', // $crimson backgroundColor: '#e91550', // $crimson
nonSelectBackgroundColor: '#ec2c50', nonSelectBackgroundColor: '#ec2c50',
}), }),
h('.network-name', t('ropsten')), h('.network-name', props.t('ropsten')),
h('i.fa.fa-chevron-down.fa-lg.network-caret'), h('i.fa.fa-chevron-down.fa-lg.network-caret'),
]) ])
case 'kovan-test-network': case 'kovan-test-network':
@ -103,7 +103,7 @@ Network.prototype.render = function () {
backgroundColor: '#690496', // $purple backgroundColor: '#690496', // $purple
nonSelectBackgroundColor: '#b039f3', nonSelectBackgroundColor: '#b039f3',
}), }),
h('.network-name', t('kovan')), h('.network-name', props.t('kovan')),
h('i.fa.fa-chevron-down.fa-lg.network-caret'), h('i.fa.fa-chevron-down.fa-lg.network-caret'),
]) ])
case 'rinkeby-test-network': case 'rinkeby-test-network':
@ -112,7 +112,7 @@ Network.prototype.render = function () {
backgroundColor: '#ebb33f', // $tulip-tree backgroundColor: '#ebb33f', // $tulip-tree
nonSelectBackgroundColor: '#ecb23e', nonSelectBackgroundColor: '#ecb23e',
}), }),
h('.network-name', t('rinkeby')), h('.network-name', props.t('rinkeby')),
h('i.fa.fa-chevron-down.fa-lg.network-caret'), h('i.fa.fa-chevron-down.fa-lg.network-caret'),
]) ])
default: default:
@ -124,7 +124,7 @@ Network.prototype.render = function () {
}, },
}), }),
h('.network-name', t('privateNetwork')), h('.network-name', props.t('privateNetwork')),
h('i.fa.fa-chevron-down.fa-lg.network-caret'), h('i.fa.fa-chevron-down.fa-lg.network-caret'),
]) ])
} }

View File

@ -4,9 +4,9 @@ const h = require('react-hyperscript')
const ReactMarkdown = require('react-markdown') const ReactMarkdown = require('react-markdown')
const linker = require('extension-link-enabler') const linker = require('extension-link-enabler')
const findDOMNode = require('react-dom').findDOMNode const findDOMNode = require('react-dom').findDOMNode
const t = require('../../i18n') const connect = require('../metamask-connect')
module.exports = Notice module.exports = connect()(Notice)
inherits(Notice, Component) inherits(Notice, Component)
function Notice () { function Notice () {
@ -111,7 +111,7 @@ Notice.prototype.render = function () {
style: { style: {
marginTop: '18px', marginTop: '18px',
}, },
}, t('accept')), }, this.props.t('accept')),
]) ])
) )
} }

View File

@ -2,7 +2,7 @@ const inherits = require('util').inherits
const Component = require('react').Component const Component = require('react').Component
const classnames = require('classnames') const classnames = require('classnames')
const h = require('react-hyperscript') const h = require('react-hyperscript')
const connect = require('react-redux').connect const connect = require('./metamask-connect')
const R = require('ramda') const R = require('ramda')
const Fuse = require('fuse.js') const Fuse = require('fuse.js')
const contractMap = require('eth-contract-metadata') const contractMap = require('eth-contract-metadata')
@ -25,7 +25,6 @@ const fuse = new Fuse(contractList, {
}) })
const actions = require('../../actions') const actions = require('../../actions')
const ethUtil = require('ethereumjs-util') const ethUtil = require('ethereumjs-util')
const t = require('../../../i18n')
const { tokenInfoGetter } = require('../../token-util') const { tokenInfoGetter } = require('../../token-util')
const { DEFAULT_ROUTE } = require('../../routes') const { DEFAULT_ROUTE } = require('../../routes')
@ -140,28 +139,31 @@ AddTokenScreen.prototype.validate = function () {
if (customAddress) { if (customAddress) {
const validAddress = ethUtil.isValidAddress(customAddress) const validAddress = ethUtil.isValidAddress(customAddress)
if (!validAddress) { if (!validAddress) {
errors.customAddress = t('invalidAddress') errors.customAddress = this.props.t('invalidAddress')
} }
const validDecimals = customDecimals !== null && customDecimals >= 0 && customDecimals < 36 const validDecimals = customDecimals !== null
&& customDecimals !== ''
&& customDecimals >= 0
&& customDecimals < 36
if (!validDecimals) { if (!validDecimals) {
errors.customDecimals = t('decimalsMustZerotoTen') errors.customDecimals = this.props.t('decimalsMustZerotoTen')
} }
const symbolLen = customSymbol.trim().length const symbolLen = customSymbol.trim().length
const validSymbol = symbolLen > 0 && symbolLen < 10 const validSymbol = symbolLen > 0 && symbolLen < 10
if (!validSymbol) { if (!validSymbol) {
errors.customSymbol = t('symbolBetweenZeroTen') errors.customSymbol = this.props.t('symbolBetweenZeroTen')
} }
const ownAddress = identitiesList.includes(standardAddress) const ownAddress = identitiesList.includes(standardAddress)
if (ownAddress) { if (ownAddress) {
errors.customAddress = t('personalAddressDetected') errors.customAddress = this.props.t('personalAddressDetected')
} }
const tokenAlreadyAdded = this.checkExistingAddresses(customAddress) const tokenAlreadyAdded = this.checkExistingAddresses(customAddress)
if (tokenAlreadyAdded) { if (tokenAlreadyAdded) {
errors.customAddress = t('tokenAlreadyAdded') errors.customAddress = this.props.t('tokenAlreadyAdded')
} }
} else if ( } else if (
Object.entries(selectedTokens) Object.entries(selectedTokens)
@ -169,7 +171,7 @@ AddTokenScreen.prototype.validate = function () {
isEmpty && !isSelected isEmpty && !isSelected
), true) ), true)
) { ) {
errors.tokenSelector = t('mustSelectOne') errors.tokenSelector = this.props.t('mustSelectOne')
} }
return { return {
@ -199,7 +201,7 @@ AddTokenScreen.prototype.renderCustomForm = function () {
'add-token__add-custom-field--error': errors.customAddress, 'add-token__add-custom-field--error': errors.customAddress,
}), }),
}, [ }, [
h('div.add-token__add-custom-label', t('tokenAddress')), h('div.add-token__add-custom-label', this.props.t('tokenAddress')),
h('input.add-token__add-custom-input', { h('input.add-token__add-custom-input', {
type: 'text', type: 'text',
onChange: this.tokenAddressDidChange, onChange: this.tokenAddressDidChange,
@ -212,7 +214,7 @@ AddTokenScreen.prototype.renderCustomForm = function () {
'add-token__add-custom-field--error': errors.customSymbol, 'add-token__add-custom-field--error': errors.customSymbol,
}), }),
}, [ }, [
h('div.add-token__add-custom-label', t('tokenSymbol')), h('div.add-token__add-custom-label', this.props.t('tokenSymbol')),
h('input.add-token__add-custom-input', { h('input.add-token__add-custom-input', {
type: 'text', type: 'text',
onChange: this.tokenSymbolDidChange, onChange: this.tokenSymbolDidChange,
@ -226,7 +228,7 @@ AddTokenScreen.prototype.renderCustomForm = function () {
'add-token__add-custom-field--error': errors.customDecimals, 'add-token__add-custom-field--error': errors.customDecimals,
}), }),
}, [ }, [
h('div.add-token__add-custom-label', t('decimal')), h('div.add-token__add-custom-label', this.props.t('decimal')),
h('input.add-token__add-custom-input', { h('input.add-token__add-custom-input', {
type: 'number', type: 'number',
onChange: this.tokenDecimalsDidChange, onChange: this.tokenDecimalsDidChange,
@ -248,7 +250,7 @@ AddTokenScreen.prototype.renderTokenList = function () {
const results = [...addressSearchResult, ...fuseSearchResult] const results = [...addressSearchResult, ...fuseSearchResult]
return h('div', [ return h('div', [
results.length > 0 && h('div.add-token__token-icons-title', t('popularTokens')), results.length > 0 && h('div.add-token__token-icons-title', this.props.t('popularTokens')),
h('div.add-token__token-icons-container', Array(6).fill(undefined) h('div.add-token__token-icons-container', Array(6).fill(undefined)
.map((_, i) => { .map((_, i) => {
const { logo, symbol, name, address } = results[i] || {} const { logo, symbol, name, address } = results[i] || {}
@ -303,10 +305,10 @@ AddTokenScreen.prototype.renderConfirmation = function () {
h('div.add-token', [ h('div.add-token', [
h('div.add-token__wrapper', [ h('div.add-token__wrapper', [
h('div.add-token__title-container.add-token__confirmation-title', [ h('div.add-token__title-container.add-token__confirmation-title', [
h('div.add-token__description', t('likeToAddTokens')), h('div.add-token__description', this.props.t('likeToAddTokens')),
]), ]),
h('div.add-token__content-container.add-token__confirmation-content', [ h('div.add-token__content-container.add-token__confirmation-content', [
h('div.add-token__description.add-token__confirmation-description', t('balances')), h('div.add-token__description.add-token__confirmation-description', this.props.t('balances')),
h('div.add-token__confirmation-token-list', h('div.add-token__confirmation-token-list',
Object.entries(tokens) Object.entries(tokens)
.map(([ address, token ]) => ( .map(([ address, token ]) => (
@ -325,10 +327,10 @@ AddTokenScreen.prototype.renderConfirmation = function () {
h('div.add-token__buttons', [ h('div.add-token__buttons', [
h('button.btn-secondary--lg.add-token__cancel-button', { h('button.btn-secondary--lg.add-token__cancel-button', {
onClick: () => this.setState({ isShowingConfirmation: false }), onClick: () => this.setState({ isShowingConfirmation: false }),
}, t('back')), }, this.props.t('back')),
h('button.btn-primary--lg', { h('button.btn-primary--lg', {
onClick: () => addTokens(tokens).then(() => history.push(DEFAULT_ROUTE)), onClick: () => addTokens(tokens).then(() => history.push(DEFAULT_ROUTE)),
}, t('addTokens')), }, this.props.t('addTokens')),
]), ]),
]) ])
) )
@ -348,14 +350,14 @@ AddTokenScreen.prototype.renderTabs = function () {
h('div.add-token__content-container', [ h('div.add-token__content-container', [
h('div.add-token__info-box', [ h('div.add-token__info-box', [
h('div.add-token__info-box__close'), h('div.add-token__info-box__close'),
h('div.add-token__info-box__title', t('whatsThis')), h('div.add-token__info-box__title', this.props.t('whatsThis')),
h('div.add-token__info-box__copy', t('keepTrackTokens')), h('div.add-token__info-box__copy', this.props.t('keepTrackTokens')),
h('div.add-token__info-box__copy--blue', t('learnMore')), h('div.add-token__info-box__copy--blue', this.props.t('learnMore')),
]), ]),
h('div.add-token__input-container', [ h('div.add-token__input-container', [
h('input.add-token__input', { h('input.add-token__input', {
type: 'text', type: 'text',
placeholder: t('searchTokens'), placeholder: this.props.t('searchTokens'),
onChange: e => this.setState({ searchQuery: e.target.value }), onChange: e => this.setState({ searchQuery: e.target.value }),
}), }),
h('div.add-token__search-input-error-message', errors.tokenSelector), h('div.add-token__search-input-error-message', errors.tokenSelector),
@ -379,9 +381,9 @@ AddTokenScreen.prototype.render = function () {
onClick: () => history.goBack(), onClick: () => history.goBack(),
}, [ }, [
h('i.fa.fa-angle-left.fa-lg'), h('i.fa.fa-angle-left.fa-lg'),
h('span', t('cancel')), h('span', this.props.t('cancel')),
]), ]),
h('div.add-token__header__title', t('addTokens')), h('div.add-token__header__title', this.props.t('addTokens')),
!isShowingConfirmation && h('div.add-token__header__tabs', [ !isShowingConfirmation && h('div.add-token__header__tabs', [
h('div.add-token__header__tabs__tab', { h('div.add-token__header__tabs__tab', {
@ -390,7 +392,7 @@ AddTokenScreen.prototype.render = function () {
'add-token__header__tabs__unselected cursor-pointer': displayedTab !== 'SEARCH', 'add-token__header__tabs__unselected cursor-pointer': displayedTab !== 'SEARCH',
}), }),
onClick: () => this.displayTab('SEARCH'), onClick: () => this.displayTab('SEARCH'),
}, t('search')), }, this.props.t('search')),
h('div.add-token__header__tabs__tab', { h('div.add-token__header__tabs__tab', {
className: classnames('add-token__header__tabs__tab', { className: classnames('add-token__header__tabs__tab', {
@ -398,11 +400,11 @@ AddTokenScreen.prototype.render = function () {
'add-token__header__tabs__unselected cursor-pointer': displayedTab !== 'CUSTOM_TOKEN', 'add-token__header__tabs__unselected cursor-pointer': displayedTab !== 'CUSTOM_TOKEN',
}), }),
onClick: () => this.displayTab('CUSTOM_TOKEN'), onClick: () => this.displayTab('CUSTOM_TOKEN'),
}, t('customToken')), }, this.props.t('customToken')),
]), ]),
]), ]),
//
isShowingConfirmation isShowingConfirmation
? this.renderConfirmation() ? this.renderConfirmation()
: this.renderTabs(), : this.renderTabs(),
@ -410,10 +412,10 @@ AddTokenScreen.prototype.render = function () {
!isShowingConfirmation && h('div.add-token__buttons', [ !isShowingConfirmation && h('div.add-token__buttons', [
h('button.btn-secondary--lg.add-token__cancel-button', { h('button.btn-secondary--lg.add-token__cancel-button', {
onClick: () => history.goBack(), onClick: () => history.goBack(),
}, t('cancel')), }, this.props.t('cancel')),
h('button.btn-primary--lg.add-token__confirm-button', { h('button.btn-primary--lg.add-token__confirm-button', {
onClick: this.onNext, onClick: this.onNext,
}, t('next')), }, this.props.t('next')),
]), ]),
]) ])
} }

View File

@ -1,43 +1,38 @@
const inherits = require('util').inherits const inherits = require('util').inherits
const Component = require('react').Component const Component = require('react').Component
const h = require('react-hyperscript') const h = require('react-hyperscript')
const connect = require('react-redux').connect const connect = require('../../../../metamask-connect')
const t = require('../../../../../i18n')
import Select from 'react-select' import Select from 'react-select'
// Subviews // Subviews
const JsonImportView = require('./json.js') const JsonImportView = require('./json.js')
const PrivateKeyImportView = require('./private-key.js') const PrivateKeyImportView = require('./private-key.js')
const menuItems = [
t('privateKey'),
t('jsonFile'),
]
module.exports = connect(mapStateToProps)(AccountImportSubview) module.exports = connect()(AccountImportSubview)
function mapStateToProps (state) {
return {
menuItems,
}
}
inherits(AccountImportSubview, Component) inherits(AccountImportSubview, Component)
function AccountImportSubview () { function AccountImportSubview () {
Component.call(this) Component.call(this)
} }
AccountImportSubview.prototype.getMenuItemTexts = function () {
return [
this.props.t('privateKey'),
this.props.t('jsonFile'),
]
}
AccountImportSubview.prototype.render = function () { AccountImportSubview.prototype.render = function () {
const props = this.props
const state = this.state || {} const state = this.state || {}
const { menuItems } = props const menuItems = this.getMenuItemTexts()
const { type } = state const { type } = state
return ( return (
h('div.new-account-import-form', [ h('div.new-account-import-form', [
h('.new-account-import-disclaimer', [ h('.new-account-import-disclaimer', [
h('span', t('importAccountMsg')), h('span', this.props.t('importAccountMsg')),
h('span', { h('span', {
style: { style: {
cursor: 'pointer', cursor: 'pointer',
@ -48,12 +43,12 @@ AccountImportSubview.prototype.render = function () {
url: 'https://metamask.helpscoutdocs.com/article/17-what-are-loose-accounts', url: 'https://metamask.helpscoutdocs.com/article/17-what-are-loose-accounts',
}) })
}, },
}, t('here')), }, this.props.t('here')),
]), ]),
h('div.new-account-import-form__select-section', [ h('div.new-account-import-form__select-section', [
h('div.new-account-import-form__select-label', t('selectType')), h('div.new-account-import-form__select-label', this.props.t('selectType')),
h(Select, { h(Select, {
className: 'new-account-import-form__select', className: 'new-account-import-form__select',
@ -79,16 +74,15 @@ AccountImportSubview.prototype.render = function () {
} }
AccountImportSubview.prototype.renderImportView = function () { AccountImportSubview.prototype.renderImportView = function () {
const props = this.props
const state = this.state || {} const state = this.state || {}
const { type } = state const { type } = state
const { menuItems } = props const menuItems = this.getMenuItemTexts()
const current = type || menuItems[0] const current = type || menuItems[0]
switch (current) { switch (current) {
case t('privateKey'): case this.props.t('privateKey'):
return h(PrivateKeyImportView) return h(PrivateKeyImportView)
case t('jsonFile'): case this.props.t('jsonFile'):
return h(JsonImportView) return h(JsonImportView)
default: default:
return h(JsonImportView) return h(JsonImportView)

View File

@ -3,10 +3,9 @@ const PropTypes = require('prop-types')
const h = require('react-hyperscript') const h = require('react-hyperscript')
const { withRouter } = require('react-router-dom') const { withRouter } = require('react-router-dom')
const { compose } = require('recompose') const { compose } = require('recompose')
const { connect } = require('react-redux') const connect = require('../../../../metamask-connect')
const actions = require('../../../../actions') const actions = require('../../../../actions')
const FileInput = require('react-simple-file-input').default const FileInput = require('react-simple-file-input').default
const t = require('../../../../../i18n')
const { DEFAULT_ROUTE } = require('../../../../routes') const { DEFAULT_ROUTE } = require('../../../../routes')
const HELP_LINK = 'https://support.metamask.io/kb/article/7-importing-accounts' const HELP_LINK = 'https://support.metamask.io/kb/article/7-importing-accounts'
@ -26,11 +25,11 @@ class JsonImportSubview extends Component {
return ( return (
h('div.new-account-import-form__json', [ h('div.new-account-import-form__json', [
h('p', t('usedByClients')), h('p', this.props.t('usedByClients')),
h('a.warning', { h('a.warning', {
href: HELP_LINK, href: HELP_LINK,
target: '_blank', target: '_blank',
}, t('fileImportFail')), }, this.props.t('fileImportFail')),
h(FileInput, { h(FileInput, {
readAs: 'text', readAs: 'text',
@ -45,7 +44,7 @@ class JsonImportSubview extends Component {
h('input.new-account-import-form__input-password', { h('input.new-account-import-form__input-password', {
type: 'password', type: 'password',
placeholder: t('enterPassword'), placeholder: this.props.t('enterPassword'),
id: 'json-password-box', id: 'json-password-box',
onKeyPress: this.createKeyringOnEnter.bind(this), onKeyPress: this.createKeyringOnEnter.bind(this),
}), }),
@ -55,13 +54,13 @@ class JsonImportSubview extends Component {
h('button.btn-secondary.new-account-create-form__button', { h('button.btn-secondary.new-account-create-form__button', {
onClick: () => this.props.history.push(DEFAULT_ROUTE), onClick: () => this.props.history.push(DEFAULT_ROUTE),
}, [ }, [
t('cancel'), this.props.t('cancel'),
]), ]),
h('button.btn-primary.new-account-create-form__button', { h('button.btn-primary.new-account-create-form__button', {
onClick: () => this.createNewKeychain(), onClick: () => this.createNewKeychain(),
}, [ }, [
t('import'), this.props.t('import'),
]), ]),
]), ]),
@ -86,14 +85,14 @@ class JsonImportSubview extends Component {
const state = this.state const state = this.state
if (!state) { if (!state) {
const message = t('validFileImport') const message = this.props.t('validFileImport')
return this.props.displayWarning(message) return this.props.displayWarning(message)
} }
const { fileContents } = state const { fileContents } = state
if (!fileContents) { if (!fileContents) {
const message = t('needImportFile') const message = this.props.t('needImportFile')
return this.props.displayWarning(message) return this.props.displayWarning(message)
} }
@ -101,7 +100,7 @@ class JsonImportSubview extends Component {
const password = passwordInput.value const password = passwordInput.value
if (!password) { if (!password) {
const message = t('needImportPassword') const message = this.props.t('needImportPassword')
return this.props.displayWarning(message) return this.props.displayWarning(message)
} }
@ -115,6 +114,7 @@ JsonImportSubview.propTypes = {
displayWarning: PropTypes.func, displayWarning: PropTypes.func,
importNewJsonAccount: PropTypes.func, importNewJsonAccount: PropTypes.func,
history: PropTypes.object, history: PropTypes.object,
t: PropTypes.func,
} }
const mapStateToProps = state => { const mapStateToProps = state => {

View File

@ -3,10 +3,9 @@ const Component = require('react').Component
const h = require('react-hyperscript') const h = require('react-hyperscript')
const { withRouter } = require('react-router-dom') const { withRouter } = require('react-router-dom')
const { compose } = require('recompose') const { compose } = require('recompose')
const { connect } = require('react-redux') const connect = require('../../../../metamask-connect')
const actions = require('../../../../actions') const actions = require('../../../../actions')
const { DEFAULT_ROUTE } = require('../../../../routes') const { DEFAULT_ROUTE } = require('../../../../routes')
const t = require('../../../../../i18n')
module.exports = compose( module.exports = compose(
withRouter, withRouter,
@ -39,7 +38,7 @@ PrivateKeyImportView.prototype.render = function () {
return ( return (
h('div.new-account-import-form__private-key', [ h('div.new-account-import-form__private-key', [
h('span.new-account-create-form__instruction', t('pastePrivateKey')), h('span.new-account-create-form__instruction', this.props.t('pastePrivateKey')),
h('div.new-account-import-form__private-key-password-container', [ h('div.new-account-import-form__private-key-password-container', [
@ -56,13 +55,13 @@ PrivateKeyImportView.prototype.render = function () {
h('button.btn-secondary--lg.new-account-create-form__button', { h('button.btn-secondary--lg.new-account-create-form__button', {
onClick: () => this.props.history.push(DEFAULT_ROUTE), onClick: () => this.props.history.push(DEFAULT_ROUTE),
}, [ }, [
t('cancel'), this.props.t('cancel'),
]), ]),
h('button.btn-primary--lg.new-account-create-form__button', { h('button.btn-primary--lg.new-account-create-form__button', {
onClick: () => this.createNewKeychain(), onClick: () => this.createNewKeychain(),
}, [ }, [
t('import'), this.props.t('import'),
]), ]),
]), ]),

View File

@ -1,8 +1,7 @@
const inherits = require('util').inherits const inherits = require('util').inherits
const Component = require('react').Component const Component = require('react').Component
const h = require('react-hyperscript') const h = require('react-hyperscript')
const connect = require('react-redux').connect const connect = require('../../../../metamask-connect')
const t = require('../../../../../i18n')
module.exports = connect(mapStateToProps)(SeedImportSubview) module.exports = connect(mapStateToProps)(SeedImportSubview)
@ -21,10 +20,10 @@ SeedImportSubview.prototype.render = function () {
style: { style: {
}, },
}, [ }, [
t('pasteSeed'), this.props.t('pasteSeed'),
h('textarea'), h('textarea'),
h('br'), h('br'),
h('button', t('submit')), h('button', this.props.t('submit')),
]) ])
) )
} }

View File

@ -1,10 +1,9 @@
const { Component } = require('react') const { Component } = require('react')
const PropTypes = require('prop-types') const PropTypes = require('prop-types')
const h = require('react-hyperscript') const h = require('react-hyperscript')
const { connect } = require('react-redux') const connect = require('../../../metamask-connect')
const actions = require('../../../actions') const actions = require('../../../actions')
const { DEFAULT_ROUTE } = require('../../../routes') const { DEFAULT_ROUTE } = require('../../../routes')
const t = require('../../../../i18n')
class NewAccountCreateForm extends Component { class NewAccountCreateForm extends Component {
constructor (props) { constructor (props) {
@ -15,7 +14,7 @@ class NewAccountCreateForm extends Component {
this.state = { this.state = {
newAccountName: '', newAccountName: '',
defaultAccountName: t('newAccountNumberName', [newAccountNumber]), defaultAccountName: this.props.t('newAccountNumberName', [newAccountNumber]),
} }
} }
@ -26,7 +25,7 @@ class NewAccountCreateForm extends Component {
return h('div.new-account-create-form', [ return h('div.new-account-create-form', [
h('div.new-account-create-form__input-label', {}, [ h('div.new-account-create-form__input-label', {}, [
t('accountName'), this.props.t('accountName'),
]), ]),
h('div.new-account-create-form__input-wrapper', {}, [ h('div.new-account-create-form__input-wrapper', {}, [
@ -42,7 +41,7 @@ class NewAccountCreateForm extends Component {
h('button.btn-secondary--lg.new-account-create-form__button', { h('button.btn-secondary--lg.new-account-create-form__button', {
onClick: () => history.push(DEFAULT_ROUTE), onClick: () => history.push(DEFAULT_ROUTE),
}, [ }, [
t('cancel'), this.props.t('cancel'),
]), ]),
h('button.btn-primary--lg.new-account-create-form__button', { h('button.btn-primary--lg.new-account-create-form__button', {
@ -51,7 +50,7 @@ class NewAccountCreateForm extends Component {
.then(() => history.push(DEFAULT_ROUTE)) .then(() => history.push(DEFAULT_ROUTE))
}, },
}, [ }, [
t('create'), this.props.t('create'),
]), ]),
]), ]),
@ -66,6 +65,7 @@ NewAccountCreateForm.propTypes = {
createAccount: PropTypes.func, createAccount: PropTypes.func,
numberOfExistingAccounts: PropTypes.number, numberOfExistingAccounts: PropTypes.number,
history: PropTypes.object, history: PropTypes.object,
t: PropTypes.func,
} }
const mapStateToProps = state => { const mapStateToProps = state => {

View File

@ -1,7 +1,7 @@
const { Component } = require('react') const { Component } = require('react')
const PropTypes = require('prop-types') const PropTypes = require('prop-types')
const h = require('react-hyperscript') const h = require('react-hyperscript')
const t = require('../../../../i18n') const connect = require('../../../metamask-connect')
class Info extends Component { class Info extends Component {
renderLogo () { renderLogo () {
@ -15,13 +15,13 @@ class Info extends Component {
renderInfoLinks () { renderInfoLinks () {
return ( return (
h('div.settings__content-item.settings__content-item--without-height', [ h('div.settings__content-item.settings__content-item--without-height', [
h('div.settings__info-link-header', t('links')), h('div.settings__info-link-header', this.props.t('links')),
h('div.settings__info-link-item', [ h('div.settings__info-link-item', [
h('a', { h('a', {
href: 'https://metamask.io/privacy.html', href: 'https://metamask.io/privacy.html',
target: '_blank', target: '_blank',
}, [ }, [
h('span.settings__info-link', t('privacyMsg')), h('span.settings__info-link', this.props.t('privacyMsg')),
]), ]),
]), ]),
h('div.settings__info-link-item', [ h('div.settings__info-link-item', [
@ -29,7 +29,7 @@ class Info extends Component {
href: 'https://metamask.io/terms.html', href: 'https://metamask.io/terms.html',
target: '_blank', target: '_blank',
}, [ }, [
h('span.settings__info-link', t('terms')), h('span.settings__info-link', this.props.t('terms')),
]), ]),
]), ]),
h('div.settings__info-link-item', [ h('div.settings__info-link-item', [
@ -37,7 +37,7 @@ class Info extends Component {
href: 'https://metamask.io/attributions.html', href: 'https://metamask.io/attributions.html',
target: '_blank', target: '_blank',
}, [ }, [
h('span.settings__info-link', t('attributions')), h('span.settings__info-link', this.props.t('attributions')),
]), ]),
]), ]),
h('hr.settings__info-separator'), h('hr.settings__info-separator'),
@ -46,7 +46,7 @@ class Info extends Component {
href: 'https://support.metamask.io', href: 'https://support.metamask.io',
target: '_blank', target: '_blank',
}, [ }, [
h('span.settings__info-link', t('supportCenter')), h('span.settings__info-link', this.props.t('supportCenter')),
]), ]),
]), ]),
h('div.settings__info-link-item', [ h('div.settings__info-link-item', [
@ -54,7 +54,7 @@ class Info extends Component {
href: 'https://metamask.io/', href: 'https://metamask.io/',
target: '_blank', target: '_blank',
}, [ }, [
h('span.settings__info-link', t('visitWebSite')), h('span.settings__info-link', this.props.t('visitWebSite')),
]), ]),
]), ]),
h('div.settings__info-link-item', [ h('div.settings__info-link-item', [
@ -62,7 +62,7 @@ class Info extends Component {
target: '_blank', target: '_blank',
href: 'mailto:help@metamask.io?subject=Feedback', href: 'mailto:help@metamask.io?subject=Feedback',
}, [ }, [
h('span.settings__info-link', t('emailUs')), h('span.settings__info-link', this.props.t('emailUs')),
]), ]),
]), ]),
]) ])
@ -82,7 +82,7 @@ class Info extends Component {
h('div.settings__info-item', [ h('div.settings__info-item', [
h( h(
'div.settings__info-about', 'div.settings__info-about',
t('builtInCalifornia') this.props.t('builtInCalifornia')
), ),
]), ]),
]), ]),
@ -103,6 +103,7 @@ Info.propTypes = {
warning: PropTypes.string, warning: PropTypes.string,
location: PropTypes.object, location: PropTypes.object,
history: PropTypes.object, history: PropTypes.object,
t: PropTypes.func,
} }
module.exports = Info module.exports = connect()(Info)

View File

@ -3,7 +3,7 @@ const { withRouter } = require('react-router-dom')
const { compose } = require('recompose') const { compose } = require('recompose')
const PropTypes = require('prop-types') const PropTypes = require('prop-types')
const h = require('react-hyperscript') const h = require('react-hyperscript')
const { connect } = require('react-redux') const connect = require('../../../metamask-connect')
const actions = require('../../../actions') const actions = require('../../../actions')
const infuraCurrencies = require('../../../infura-conversion.json') const infuraCurrencies = require('../../../infura-conversion.json')
const validUrl = require('valid-url') const validUrl = require('valid-url')
@ -11,8 +11,8 @@ const { exportAsFile } = require('../../../util')
const SimpleDropdown = require('../../dropdowns/simple-dropdown') const SimpleDropdown = require('../../dropdowns/simple-dropdown')
const ToggleButton = require('react-toggle-button') const ToggleButton = require('react-toggle-button')
const { REVEAL_SEED_ROUTE } = require('../../../routes') const { REVEAL_SEED_ROUTE } = require('../../../routes')
const locales = require('../../../../../app/_locales/index.json')
const { OLD_UI_NETWORK_TYPE } = require('../../../../../app/scripts/config').enums const { OLD_UI_NETWORK_TYPE } = require('../../../../../app/scripts/config').enums
const t = require('../../../../i18n')
const getInfuraCurrencyOptions = () => { const getInfuraCurrencyOptions = () => {
const sortedCurrencies = infuraCurrencies.objects.sort((a, b) => { const sortedCurrencies = infuraCurrencies.objects.sort((a, b) => {
@ -28,6 +28,16 @@ const getInfuraCurrencyOptions = () => {
}) })
} }
const getLocaleOptions = () => {
return locales.map((locale) => {
return {
displayValue: `${locale.name}`,
key: locale.code,
value: locale.code,
}
})
}
class Settings extends Component { class Settings extends Component {
constructor (props) { constructor (props) {
super(props) super(props)
@ -42,7 +52,7 @@ class Settings extends Component {
return h('div.settings__content-row', [ return h('div.settings__content-row', [
h('div.settings__content-item', [ h('div.settings__content-item', [
h('span', t('blockiesIdenticon')), h('span', this.props.t('blockiesIdenticon')),
]), ]),
h('div.settings__content-item', [ h('div.settings__content-item', [
h('div.settings__content-item-col', [ h('div.settings__content-item-col', [
@ -62,13 +72,13 @@ class Settings extends Component {
return h('div.settings__content-row', [ return h('div.settings__content-row', [
h('div.settings__content-item', [ h('div.settings__content-item', [
h('span', t('currentConversion')), h('span', this.props.t('currentConversion')),
h('span.settings__content-description', `Updated ${Date(conversionDate)}`), h('span.settings__content-description', `Updated ${Date(conversionDate)}`),
]), ]),
h('div.settings__content-item', [ h('div.settings__content-item', [
h('div.settings__content-item-col', [ h('div.settings__content-item-col', [
h(SimpleDropdown, { h(SimpleDropdown, {
placeholder: t('selectCurrency'), placeholder: this.props.t('selectCurrency'),
options: getInfuraCurrencyOptions(), options: getInfuraCurrencyOptions(),
selectedOption: currentCurrency, selectedOption: currentCurrency,
onSelect: newCurrency => setCurrentCurrency(newCurrency), onSelect: newCurrency => setCurrentCurrency(newCurrency),
@ -78,6 +88,30 @@ class Settings extends Component {
]) ])
} }
renderCurrentLocale () {
const { updateCurrentLocale, currentLocale } = this.props
const currentLocaleMeta = locales.find(locale => locale.code === currentLocale)
return h('div.settings__content-row', [
h('div.settings__content-item', [
h('span', 'Current Language'),
h('span.settings__content-description', `${currentLocaleMeta.name}`),
]),
h('div.settings__content-item', [
h('div.settings__content-item-col', [
h(SimpleDropdown, {
placeholder: 'Select Locale',
options: getLocaleOptions(),
selectedOption: currentLocale,
onSelect: async (newLocale) => {
updateCurrentLocale(newLocale)
},
}),
]),
]),
])
}
renderCurrentProvider () { renderCurrentProvider () {
const { metamask: { provider = {} } } = this.props const { metamask: { provider = {} } } = this.props
let title, value, color let title, value, color
@ -85,31 +119,31 @@ class Settings extends Component {
switch (provider.type) { switch (provider.type) {
case 'mainnet': case 'mainnet':
title = t('currentNetwork') title = this.props.t('currentNetwork')
value = t('mainnet') value = this.props.t('mainnet')
color = '#038789' color = '#038789'
break break
case 'ropsten': case 'ropsten':
title = t('currentNetwork') title = this.props.t('currentNetwork')
value = t('ropsten') value = this.props.t('ropsten')
color = '#e91550' color = '#e91550'
break break
case 'kovan': case 'kovan':
title = t('currentNetwork') title = this.props.t('currentNetwork')
value = t('kovan') value = this.props.t('kovan')
color = '#690496' color = '#690496'
break break
case 'rinkeby': case 'rinkeby':
title = t('currentNetwork') title = this.props.t('currentNetwork')
value = t('rinkeby') value = this.props.t('rinkeby')
color = '#ebb33f' color = '#ebb33f'
break break
default: default:
title = t('currentRpc') title = this.props.t('currentRpc')
value = provider.rpcTarget value = provider.rpcTarget
} }
@ -130,12 +164,12 @@ class Settings extends Component {
return ( return (
h('div.settings__content-row', [ h('div.settings__content-row', [
h('div.settings__content-item', [ h('div.settings__content-item', [
h('span', t('newRPC')), h('span', this.props.t('newRPC')),
]), ]),
h('div.settings__content-item', [ h('div.settings__content-item', [
h('div.settings__content-item-col', [ h('div.settings__content-item-col', [
h('input.settings__input', { h('input.settings__input', {
placeholder: t('newRPC'), placeholder: this.props.t('newRPC'),
onChange: event => this.setState({ newRpc: event.target.value }), onChange: event => this.setState({ newRpc: event.target.value }),
onKeyPress: event => { onKeyPress: event => {
if (event.key === 'Enter') { if (event.key === 'Enter') {
@ -148,7 +182,7 @@ class Settings extends Component {
event.preventDefault() event.preventDefault()
this.validateRpc(this.state.newRpc) this.validateRpc(this.state.newRpc)
}, },
}, t('save')), }, this.props.t('save')),
]), ]),
]), ]),
]) ])
@ -164,9 +198,9 @@ class Settings extends Component {
const appendedRpc = `http://${newRpc}` const appendedRpc = `http://${newRpc}`
if (validUrl.isWebUri(appendedRpc)) { if (validUrl.isWebUri(appendedRpc)) {
displayWarning(t('uriErrorMsg')) displayWarning(this.props.t('uriErrorMsg'))
} else { } else {
displayWarning(t('invalidRPC')) displayWarning(this.props.t('invalidRPC'))
} }
} }
} }
@ -175,10 +209,10 @@ class Settings extends Component {
return ( return (
h('div.settings__content-row', [ h('div.settings__content-row', [
h('div.settings__content-item', [ h('div.settings__content-item', [
h('div', t('stateLogs')), h('div', this.props.t('stateLogs')),
h( h(
'div.settings__content-description', 'div.settings__content-description',
t('stateLogsDescription') this.props.t('stateLogsDescription')
), ),
]), ]),
h('div.settings__content-item', [ h('div.settings__content-item', [
@ -187,13 +221,13 @@ class Settings extends Component {
onClick (event) { onClick (event) {
window.logStateString((err, result) => { window.logStateString((err, result) => {
if (err) { if (err) {
this.state.dispatch(actions.displayWarning(t('stateLogError'))) this.state.dispatch(actions.displayWarning(this.props.t('stateLogError')))
} else { } else {
exportAsFile('MetaMask State Logs.json', result) exportAsFile('MetaMask State Logs.json', result)
} }
}) })
}, },
}, t('downloadStateLogs')), }, this.props.t('downloadStateLogs')),
]), ]),
]), ]),
]) ])
@ -205,12 +239,15 @@ class Settings extends Component {
return ( return (
h('div.settings__content-row', [ h('div.settings__content-row', [
h('div.settings__content-item', t('revealSeedWords')), h('div.settings__content-item', this.props.t('revealSeedWords')),
h('div.settings__content-item', [ h('div.settings__content-item', [
h('div.settings__content-item-col', [ h('div.settings__content-item-col', [
h('button.btn-primary--lg.settings__button--red', { h('button.btn-primary--lg.settings__button--red', {
onClick: () => history.push(REVEAL_SEED_ROUTE), onClick: event => {
}, t('revealSeedWords')), event.preventDefault()
history.push(REVEAL_SEED_ROUTE)
},
}, this.props.t('revealSeedWords')),
]), ]),
]), ]),
]) ])
@ -222,7 +259,7 @@ class Settings extends Component {
return ( return (
h('div.settings__content-row', [ h('div.settings__content-row', [
h('div.settings__content-item', t('useOldUI')), h('div.settings__content-item', this.props.t('useOldUI')),
h('div.settings__content-item', [ h('div.settings__content-item', [
h('div.settings__content-item-col', [ h('div.settings__content-item-col', [
h('button.btn-primary--lg.settings__button--orange', { h('button.btn-primary--lg.settings__button--orange', {
@ -230,7 +267,7 @@ class Settings extends Component {
event.preventDefault() event.preventDefault()
setFeatureFlagToBeta() setFeatureFlagToBeta()
}, },
}, t('useOldUI')), }, this.props.t('useOldUI')),
]), ]),
]), ]),
]) ])
@ -241,7 +278,7 @@ class Settings extends Component {
const { showResetAccountConfirmationModal } = this.props const { showResetAccountConfirmationModal } = this.props
return h('div.settings__content-row', [ return h('div.settings__content-row', [
h('div.settings__content-item', t('resetAccount')), h('div.settings__content-item', this.props.t('resetAccount')),
h('div.settings__content-item', [ h('div.settings__content-item', [
h('div.settings__content-item-col', [ h('div.settings__content-item-col', [
h('button.btn-primary--lg.settings__button--orange', { h('button.btn-primary--lg.settings__button--orange', {
@ -249,7 +286,7 @@ class Settings extends Component {
event.preventDefault() event.preventDefault()
showResetAccountConfirmationModal() showResetAccountConfirmationModal()
}, },
}, t('resetAccount')), }, this.props.t('resetAccount')),
]), ]),
]), ]),
]) ])
@ -262,6 +299,7 @@ class Settings extends Component {
h('div.settings__content', [ h('div.settings__content', [
warning && h('div.settings__error', warning), warning && h('div.settings__error', warning),
this.renderCurrentConversion(), this.renderCurrentConversion(),
this.renderCurrentLocale(),
// this.renderCurrentProvider(), // this.renderCurrentProvider(),
this.renderNewRpcUrl(), this.renderNewRpcUrl(),
this.renderStateLogs(), this.renderStateLogs(),
@ -286,6 +324,9 @@ Settings.propTypes = {
warning: PropTypes.string, warning: PropTypes.string,
history: PropTypes.object, history: PropTypes.object,
isMascara: PropTypes.bool, isMascara: PropTypes.bool,
updateCurrentLocale: PropTypes.func,
currentLocale: PropTypes.string,
t: PropTypes.func,
} }
const mapStateToProps = state => { const mapStateToProps = state => {
@ -293,6 +334,7 @@ const mapStateToProps = state => {
metamask: state.metamask, metamask: state.metamask,
warning: state.appState.warning, warning: state.appState.warning,
isMascara: state.metamask.isMascara, isMascara: state.metamask.isMascara,
currentLocale: state.metamask.currentLocale,
} }
} }
@ -303,6 +345,7 @@ const mapDispatchToProps = dispatch => {
displayWarning: warning => dispatch(actions.displayWarning(warning)), displayWarning: warning => dispatch(actions.displayWarning(warning)),
revealSeedConfirmation: () => dispatch(actions.revealSeedConfirmation()), revealSeedConfirmation: () => dispatch(actions.revealSeedConfirmation()),
setUseBlockie: value => dispatch(actions.setUseBlockie(value)), setUseBlockie: value => dispatch(actions.setUseBlockie(value)),
updateCurrentLocale: key => dispatch(actions.updateCurrentLocale(key)),
setFeatureFlagToBeta: () => { setFeatureFlagToBeta: () => {
return dispatch(actions.setFeatureFlag('betaUI', false, 'OLD_UI_NOTIFICATION_MODAL')) return dispatch(actions.setFeatureFlag('betaUI', false, 'OLD_UI_NOTIFICATION_MODAL'))
.then(() => dispatch(actions.setNetworkEndpoints(OLD_UI_NETWORK_TYPE))) .then(() => dispatch(actions.setNetworkEndpoints(OLD_UI_NETWORK_TYPE)))

View File

@ -1,11 +1,11 @@
const Component = require('react').Component const Component = require('react').Component
const h = require('react-hyperscript') const h = require('react-hyperscript')
const inherits = require('util').inherits const inherits = require('util').inherits
const t = require('../../i18n') const connect = require('../metamask-connect')
const AccountPanel = require('./account-panel') const AccountPanel = require('./account-panel')
module.exports = PendingMsgDetails module.exports = connect()(PendingMsgDetails)
inherits(PendingMsgDetails, Component) inherits(PendingMsgDetails, Component)
function PendingMsgDetails () { function PendingMsgDetails () {
@ -40,7 +40,7 @@ PendingMsgDetails.prototype.render = function () {
// message data // message data
h('.tx-data.flex-column.flex-justify-center.flex-grow.select-none', [ h('.tx-data.flex-column.flex-justify-center.flex-grow.select-none', [
h('.flex-column.flex-space-between', [ h('.flex-column.flex-space-between', [
h('label.font-small.allcaps', t('message')), h('label.font-small.allcaps', this.props.t('message')),
h('span.font-small', msgParams.data), h('span.font-small', msgParams.data),
]), ]),
]), ]),

View File

@ -2,9 +2,9 @@ const Component = require('react').Component
const h = require('react-hyperscript') const h = require('react-hyperscript')
const inherits = require('util').inherits const inherits = require('util').inherits
const PendingTxDetails = require('./pending-msg-details') const PendingTxDetails = require('./pending-msg-details')
const t = require('../../i18n') const connect = require('../metamask-connect')
module.exports = PendingMsg module.exports = connect()(PendingMsg)
inherits(PendingMsg, Component) inherits(PendingMsg, Component)
function PendingMsg () { function PendingMsg () {
@ -30,14 +30,14 @@ PendingMsg.prototype.render = function () {
fontWeight: 'bold', fontWeight: 'bold',
textAlign: 'center', textAlign: 'center',
}, },
}, t('signMessage')), }, this.props.t('signMessage')),
h('.error', { h('.error', {
style: { style: {
margin: '10px', margin: '10px',
}, },
}, [ }, [
t('signNotice'), this.props.t('signNotice'),
h('a', { h('a', {
href: 'https://medium.com/metamask/the-new-secure-way-to-sign-data-in-your-browser-6af9dd2a1527', href: 'https://medium.com/metamask/the-new-secure-way-to-sign-data-in-your-browser-6af9dd2a1527',
style: { color: 'rgb(247, 134, 28)' }, style: { color: 'rgb(247, 134, 28)' },
@ -46,7 +46,7 @@ PendingMsg.prototype.render = function () {
const url = 'https://medium.com/metamask/the-new-secure-way-to-sign-data-in-your-browser-6af9dd2a1527' const url = 'https://medium.com/metamask/the-new-secure-way-to-sign-data-in-your-browser-6af9dd2a1527'
global.platform.openWindow({ url }) global.platform.openWindow({ url })
}, },
}, t('readMore')), }, this.props.t('readMore')),
]), ]),
// message details // message details
@ -56,10 +56,10 @@ PendingMsg.prototype.render = function () {
h('.flex-row.flex-space-around', [ h('.flex-row.flex-space-around', [
h('button', { h('button', {
onClick: state.cancelMessage, onClick: state.cancelMessage,
}, t('cancel')), }, this.props.t('cancel')),
h('button', { h('button', {
onClick: state.signMessage, onClick: state.signMessage,
}, t('sign')), }, this.props.t('sign')),
]), ]),
]) ])

View File

@ -1,5 +1,5 @@
const { Component } = require('react') const { Component } = require('react')
const { connect } = require('react-redux') const connect = require('../../metamask-connect')
const h = require('react-hyperscript') const h = require('react-hyperscript')
const PropTypes = require('prop-types') const PropTypes = require('prop-types')
const actions = require('../../actions') const actions = require('../../actions')
@ -8,7 +8,6 @@ const ethUtil = require('ethereumjs-util')
const BN = ethUtil.BN const BN = ethUtil.BN
const hexToBn = require('../../../../app/scripts/lib/hex-to-bn') const hexToBn = require('../../../../app/scripts/lib/hex-to-bn')
const { conversionUtil } = require('../../conversion-util') const { conversionUtil } = require('../../conversion-util')
const t = require('../../../i18n')
const SenderToRecipient = require('../sender-to-recipient') const SenderToRecipient = require('../sender-to-recipient')
const NetworkDisplay = require('../network-display') const NetworkDisplay = require('../network-display')
@ -33,7 +32,7 @@ class ConfirmDeployContract extends Component {
if (valid && this.verifyGasParams()) { if (valid && this.verifyGasParams()) {
this.props.sendTransaction(txMeta, event) this.props.sendTransaction(txMeta, event)
} else { } else {
this.props.displayWarning('invalidGasParams') this.props.displayWarning(this.props.t('invalidGasParams'))
this.setState({ submitting: false }) this.setState({ submitting: false })
} }
} }
@ -178,7 +177,7 @@ class ConfirmDeployContract extends Component {
return ( return (
h('section.flex-row.flex-center.confirm-screen-row', [ h('section.flex-row.flex-center.confirm-screen-row', [
h('span.confirm-screen-label.confirm-screen-section-column', [ t('gasFee') ]), h('span.confirm-screen-label.confirm-screen-section-column', [ this.props.t('gasFee') ]),
h('div.confirm-screen-section-column', [ h('div.confirm-screen-section-column', [
h('div.confirm-screen-row-info', `${fiatGas} ${currentCurrency.toUpperCase()}`), h('div.confirm-screen-row-info', `${fiatGas} ${currentCurrency.toUpperCase()}`),
@ -217,8 +216,8 @@ class ConfirmDeployContract extends Component {
return ( return (
h('section.flex-row.flex-center.confirm-screen-row.confirm-screen-total-box ', [ h('section.flex-row.flex-center.confirm-screen-row.confirm-screen-total-box ', [
h('div.confirm-screen-section-column', [ h('div.confirm-screen-section-column', [
h('span.confirm-screen-label', [ t('total') + ' ' ]), h('span.confirm-screen-label', [ this.props.t('total') + ' ' ]),
h('div.confirm-screen-total-box__subtitle', [ t('amountPlusGas') ]), h('div.confirm-screen-total-box__subtitle', [ this.props.t('amountPlusGas') ]),
]), ]),
h('div.confirm-screen-section-column', [ h('div.confirm-screen-section-column', [
@ -248,11 +247,11 @@ class ConfirmDeployContract extends Component {
h('.page-container__header-row', [ h('.page-container__header-row', [
h('span.page-container__back-button', { h('span.page-container__back-button', {
onClick: () => backToAccountDetail(selectedAddress), onClick: () => backToAccountDetail(selectedAddress),
}, t('back')), }, this.props.t('back')),
window.METAMASK_UI_TYPE === 'notification' && h(NetworkDisplay), window.METAMASK_UI_TYPE === 'notification' && h(NetworkDisplay),
]), ]),
h('.page-container__title', t('confirmContract')), h('.page-container__title', this.props.t('confirmContract')),
h('.page-container__subtitle', t('pleaseReviewTransaction')), h('.page-container__subtitle', this.props.t('pleaseReviewTransaction')),
]), ]),
// Main Send token Card // Main Send token Card
h('.page-container__content', [ h('.page-container__content', [
@ -275,7 +274,7 @@ class ConfirmDeployContract extends Component {
h('div.confirm-screen-rows', [ h('div.confirm-screen-rows', [
h('section.flex-row.flex-center.confirm-screen-row', [ h('section.flex-row.flex-center.confirm-screen-row', [
h('span.confirm-screen-label.confirm-screen-section-column', [ t('from') ]), h('span.confirm-screen-label.confirm-screen-section-column', [ this.props.t('from') ]),
h('div.confirm-screen-section-column', [ h('div.confirm-screen-section-column', [
h('div.confirm-screen-row-info', fromName), h('div.confirm-screen-row-info', fromName),
h('div.confirm-screen-row-detail', `...${fromAddress.slice(fromAddress.length - 4)}`), h('div.confirm-screen-row-detail', `...${fromAddress.slice(fromAddress.length - 4)}`),
@ -283,9 +282,9 @@ class ConfirmDeployContract extends Component {
]), ]),
h('section.flex-row.flex-center.confirm-screen-row', [ h('section.flex-row.flex-center.confirm-screen-row', [
h('span.confirm-screen-label.confirm-screen-section-column', [ t('to') ]), h('span.confirm-screen-label.confirm-screen-section-column', [ this.props.t('to') ]),
h('div.confirm-screen-section-column', [ h('div.confirm-screen-section-column', [
h('div.confirm-screen-row-info', t('newContract')), h('div.confirm-screen-row-info', this.props.t('newContract')),
]), ]),
]), ]),
@ -303,12 +302,12 @@ class ConfirmDeployContract extends Component {
// Cancel Button // Cancel Button
h('button.btn-cancel.page-container__footer-button.allcaps', { h('button.btn-cancel.page-container__footer-button.allcaps', {
onClick: event => this.cancel(event, txMeta), onClick: event => this.cancel(event, txMeta),
}, t('cancel')), }, this.props.t('cancel')),
// Accept Button // Accept Button
h('button.btn-confirm.page-container__footer-button.allcaps', { h('button.btn-confirm.page-container__footer-button.allcaps', {
onClick: event => this.onSubmit(event), onClick: event => this.onSubmit(event),
}, t('confirm')), }, this.props.t('confirm')),
]), ]),
]), ]),
]) ])
@ -325,6 +324,7 @@ ConfirmDeployContract.propTypes = {
conversionRate: PropTypes.number, conversionRate: PropTypes.number,
currentCurrency: PropTypes.string, currentCurrency: PropTypes.string,
selectedAddress: PropTypes.string, selectedAddress: PropTypes.string,
t: PropTypes.func,
} }
const mapStateToProps = state => { const mapStateToProps = state => {
@ -347,8 +347,8 @@ const mapDispatchToProps = dispatch => {
return { return {
backToAccountDetail: address => dispatch(actions.backToAccountDetail(address)), backToAccountDetail: address => dispatch(actions.backToAccountDetail(address)),
cancelTransaction: ({ id }) => dispatch(actions.cancelTx({ id })), cancelTransaction: ({ id }) => dispatch(actions.cancelTx({ id })),
displayWarning: warning => actions.displayWarning(t(warning)), displayWarning: warning => actions.displayWarning(warning),
} }
} }
module.exports = connect(mapStateToProps, mapDispatchToProps)(ConfirmDeployContract) module.exports = connect(mapStateToProps, mapDispatchToProps)(ConfirmDeployContract)

View File

@ -1,5 +1,5 @@
const Component = require('react').Component const Component = require('react').Component
const { connect } = require('react-redux') const connect = require('../../metamask-connect')
const { withRouter } = require('react-router-dom') const { withRouter } = require('react-router-dom')
const { compose } = require('recompose') const { compose } = require('recompose')
const h = require('react-hyperscript') const h = require('react-hyperscript')
@ -15,7 +15,6 @@ const {
multiplyCurrencies, multiplyCurrencies,
} = require('../../conversion-util') } = require('../../conversion-util')
const GasFeeDisplay = require('../send/gas-fee-display-v2') const GasFeeDisplay = require('../send/gas-fee-display-v2')
const t = require('../../../i18n')
const SenderToRecipient = require('../sender-to-recipient') const SenderToRecipient = require('../sender-to-recipient')
const NetworkDisplay = require('../network-display') const NetworkDisplay = require('../network-display')
@ -202,7 +201,7 @@ ConfirmSendEther.prototype.getData = function () {
}, },
to: { to: {
address: txParams.to, address: txParams.to,
name: identities[txParams.to] ? identities[txParams.to].name : t('newRecipient'), name: identities[txParams.to] ? identities[txParams.to].name : this.props.t('newRecipient'),
}, },
memo: txParams.memo || '', memo: txParams.memo || '',
gasFeeInFIAT, gasFeeInFIAT,
@ -309,7 +308,7 @@ ConfirmSendEther.prototype.render = function () {
h('div.confirm-screen-rows', [ h('div.confirm-screen-rows', [
h('section.flex-row.flex-center.confirm-screen-row', [ h('section.flex-row.flex-center.confirm-screen-row', [
h('span.confirm-screen-label.confirm-screen-section-column', [ t('from') ]), h('span.confirm-screen-label.confirm-screen-section-column', [ this.props.t('from') ]),
h('div.confirm-screen-section-column', [ h('div.confirm-screen-section-column', [
h('div.confirm-screen-row-info', fromName), h('div.confirm-screen-row-info', fromName),
h('div.confirm-screen-row-detail', `...${fromAddress.slice(fromAddress.length - 4)}`), h('div.confirm-screen-row-detail', `...${fromAddress.slice(fromAddress.length - 4)}`),
@ -317,7 +316,7 @@ ConfirmSendEther.prototype.render = function () {
]), ]),
h('section.flex-row.flex-center.confirm-screen-row', [ h('section.flex-row.flex-center.confirm-screen-row', [
h('span.confirm-screen-label.confirm-screen-section-column', [ t('to') ]), h('span.confirm-screen-label.confirm-screen-section-column', [ this.props.t('to') ]),
h('div.confirm-screen-section-column', [ h('div.confirm-screen-section-column', [
h('div.confirm-screen-row-info', toName), h('div.confirm-screen-row-info', toName),
h('div.confirm-screen-row-detail', `...${toAddress.slice(toAddress.length - 4)}`), h('div.confirm-screen-row-detail', `...${toAddress.slice(toAddress.length - 4)}`),
@ -325,7 +324,7 @@ ConfirmSendEther.prototype.render = function () {
]), ]),
h('section.flex-row.flex-center.confirm-screen-row', [ h('section.flex-row.flex-center.confirm-screen-row', [
h('span.confirm-screen-label.confirm-screen-section-column', [ t('gasFee') ]), h('span.confirm-screen-label.confirm-screen-section-column', [ this.props.t('gasFee') ]),
h('div.confirm-screen-section-column', [ h('div.confirm-screen-section-column', [
h(GasFeeDisplay, { h(GasFeeDisplay, {
gasTotal: gasTotal || gasFeeInHex, gasTotal: gasTotal || gasFeeInHex,
@ -338,8 +337,8 @@ ConfirmSendEther.prototype.render = function () {
h('section.flex-row.flex-center.confirm-screen-row.confirm-screen-total-box ', [ h('section.flex-row.flex-center.confirm-screen-row.confirm-screen-total-box ', [
h('div.confirm-screen-section-column', [ h('div.confirm-screen-section-column', [
h('span.confirm-screen-label', [ t('total') + ' ' ]), h('span.confirm-screen-label', [ this.props.t('total') + ' ' ]),
h('div.confirm-screen-total-box__subtitle', [ t('amountPlusGas') ]), h('div.confirm-screen-total-box__subtitle', [ this.props.t('amountPlusGas') ]),
]), ]),
h('div.confirm-screen-section-column', [ h('div.confirm-screen-section-column', [
@ -440,10 +439,10 @@ ConfirmSendEther.prototype.render = function () {
clearSend() clearSend()
this.cancel(event, txMeta) this.cancel(event, txMeta)
}, },
}, t('cancel')), }, this.props.t('cancel')),
// Accept Button // Accept Button
h('button.btn-confirm.page-container__footer-button.allcaps', [t('confirm')]), h('button.btn-confirm.page-container__footer-button.allcaps', [this.props.t('confirm')]),
]), ]),
]), ]),
]) ])
@ -459,7 +458,7 @@ ConfirmSendEther.prototype.onSubmit = function (event) {
if (valid && this.verifyGasParams()) { if (valid && this.verifyGasParams()) {
this.props.sendTransaction(txMeta, event) this.props.sendTransaction(txMeta, event)
} else { } else {
this.props.dispatch(actions.displayWarning(t('invalidGasParams'))) this.props.dispatch(actions.displayWarning(this.props.t('invalidGasParams')))
this.setState({ submitting: false }) this.setState({ submitting: false })
} }
} }

View File

@ -1,5 +1,5 @@
const Component = require('react').Component const Component = require('react').Component
const { connect } = require('react-redux') const connect = require('../../metamask-connect')
const { withRouter } = require('react-router-dom') const { withRouter } = require('react-router-dom')
const { compose } = require('recompose') const { compose } = require('recompose')
const h = require('react-hyperscript') const h = require('react-hyperscript')
@ -8,7 +8,6 @@ const tokenAbi = require('human-standard-token-abi')
const abiDecoder = require('abi-decoder') const abiDecoder = require('abi-decoder')
abiDecoder.addABI(tokenAbi) abiDecoder.addABI(tokenAbi)
const actions = require('../../actions') const actions = require('../../actions')
const t = require('../../../i18n')
const clone = require('clone') const clone = require('clone')
const Identicon = require('../identicon') const Identicon = require('../identicon')
const GasFeeDisplay = require('../send/gas-fee-display-v2.js') const GasFeeDisplay = require('../send/gas-fee-display-v2.js')
@ -181,7 +180,7 @@ ConfirmSendToken.prototype.getAmount = function () {
? +(sendTokenAmount * tokenExchangeRate * conversionRate).toFixed(2) ? +(sendTokenAmount * tokenExchangeRate * conversionRate).toFixed(2)
: null, : null,
token: typeof value === 'undefined' token: typeof value === 'undefined'
? t('unknown') ? this.props.t('unknown')
: +sendTokenAmount.toFixed(decimals), : +sendTokenAmount.toFixed(decimals),
} }
@ -253,7 +252,7 @@ ConfirmSendToken.prototype.getData = function () {
}, },
to: { to: {
address: value, address: value,
name: identities[value] ? identities[value].name : t('newRecipient'), name: identities[value] ? identities[value].name : this.props.t('newRecipient'),
}, },
memo: txParams.memo || '', memo: txParams.memo || '',
} }
@ -299,7 +298,7 @@ ConfirmSendToken.prototype.renderGasFee = function () {
return ( return (
h('section.flex-row.flex-center.confirm-screen-row', [ h('section.flex-row.flex-center.confirm-screen-row', [
h('span.confirm-screen-label.confirm-screen-section-column', [ t('gasFee') ]), h('span.confirm-screen-label.confirm-screen-section-column', [ this.props.t('gasFee') ]),
h('div.confirm-screen-section-column', [ h('div.confirm-screen-section-column', [
h(GasFeeDisplay, { h(GasFeeDisplay, {
gasTotal: gasTotal || gasFeeInHex, gasTotal: gasTotal || gasFeeInHex,
@ -321,8 +320,8 @@ ConfirmSendToken.prototype.renderTotalPlusGas = function () {
? ( ? (
h('section.flex-row.flex-center.confirm-screen-row.confirm-screen-total-box ', [ h('section.flex-row.flex-center.confirm-screen-row.confirm-screen-total-box ', [
h('div.confirm-screen-section-column', [ h('div.confirm-screen-section-column', [
h('span.confirm-screen-label', [ t('total') + ' ' ]), h('span.confirm-screen-label', [ this.props.t('total') + ' ' ]),
h('div.confirm-screen-total-box__subtitle', [ t('amountPlusGas') ]), h('div.confirm-screen-total-box__subtitle', [ this.props.t('amountPlusGas') ]),
]), ]),
h('div.confirm-screen-section-column', [ h('div.confirm-screen-section-column', [
@ -334,13 +333,13 @@ ConfirmSendToken.prototype.renderTotalPlusGas = function () {
: ( : (
h('section.flex-row.flex-center.confirm-screen-row.confirm-screen-total-box ', [ h('section.flex-row.flex-center.confirm-screen-row.confirm-screen-total-box ', [
h('div.confirm-screen-section-column', [ h('div.confirm-screen-section-column', [
h('span.confirm-screen-label', [ t('total') + ' ' ]), h('span.confirm-screen-label', [ this.props.t('total') + ' ' ]),
h('div.confirm-screen-total-box__subtitle', [ t('amountPlusGas') ]), h('div.confirm-screen-total-box__subtitle', [ this.props.t('amountPlusGas') ]),
]), ]),
h('div.confirm-screen-section-column', [ h('div.confirm-screen-section-column', [
h('div.confirm-screen-row-info', `${tokenAmount} ${symbol}`), h('div.confirm-screen-row-info', `${tokenAmount} ${symbol}`),
h('div.confirm-screen-row-detail', `+ ${fiatGas} ${currentCurrency} ${t('gas')}`), h('div.confirm-screen-row-detail', `+ ${fiatGas} ${currentCurrency} ${this.props.t('gas')}`),
]), ]),
]) ])
) )
@ -362,10 +361,11 @@ ConfirmSendToken.prototype.render = function () {
this.inputs = [] this.inputs = []
const title = txMeta.lastGasPrice ? 'Reprice Transaction' : t('confirm') const isTxReprice = Boolean(txMeta.lastGasPrice)
const subtitle = txMeta.lastGasPrice const title = isTxReprice ? this.props.t('reprice_title') : this.props.t('confirm')
? 'Increase your gas fee to attempt to overwrite and speed up your transaction' const subtitle = isTxReprice
: t('pleaseReviewTransaction') ? this.props.t('reprice_subtitle')
: this.props.t('pleaseReviewTransaction')
return ( return (
h('div.confirm-screen-container.confirm-send-token', [ h('div.confirm-screen-container.confirm-send-token', [
@ -374,7 +374,7 @@ ConfirmSendToken.prototype.render = function () {
h('div.page-container__header', [ h('div.page-container__header', [
!txMeta.lastGasPrice && h('button.confirm-screen-back-button', { !txMeta.lastGasPrice && h('button.confirm-screen-back-button', {
onClick: () => editTransaction(txMeta), onClick: () => editTransaction(txMeta),
}, t('edit')), }, this.props.t('edit')),
h('div.page-container__title', title), h('div.page-container__title', title),
h('div.page-container__subtitle', subtitle), h('div.page-container__subtitle', subtitle),
]), ]),
@ -418,7 +418,7 @@ ConfirmSendToken.prototype.render = function () {
h('div.confirm-screen-rows', [ h('div.confirm-screen-rows', [
h('section.flex-row.flex-center.confirm-screen-row', [ h('section.flex-row.flex-center.confirm-screen-row', [
h('span.confirm-screen-label.confirm-screen-section-column', [ t('from') ]), h('span.confirm-screen-label.confirm-screen-section-column', [ this.props.t('from') ]),
h('div.confirm-screen-section-column', [ h('div.confirm-screen-section-column', [
h('div.confirm-screen-row-info', fromName), h('div.confirm-screen-row-info', fromName),
h('div.confirm-screen-row-detail', `...${fromAddress.slice(fromAddress.length - 4)}`), h('div.confirm-screen-row-detail', `...${fromAddress.slice(fromAddress.length - 4)}`),
@ -426,7 +426,7 @@ ConfirmSendToken.prototype.render = function () {
]), ]),
toAddress && h('section.flex-row.flex-center.confirm-screen-row', [ toAddress && h('section.flex-row.flex-center.confirm-screen-row', [
h('span.confirm-screen-label.confirm-screen-section-column', [ t('to') ]), h('span.confirm-screen-label.confirm-screen-section-column', [ this.props.t('to') ]),
h('div.confirm-screen-section-column', [ h('div.confirm-screen-section-column', [
h('div.confirm-screen-row-info', toName), h('div.confirm-screen-row-info', toName),
h('div.confirm-screen-row-detail', `...${toAddress.slice(toAddress.length - 4)}`), h('div.confirm-screen-row-detail', `...${toAddress.slice(toAddress.length - 4)}`),
@ -440,6 +440,7 @@ ConfirmSendToken.prototype.render = function () {
]), ]),
]), ]),
h('form#pending-tx-form', { h('form#pending-tx-form', {
onSubmit: this.onSubmit, onSubmit: this.onSubmit,
}, [ }, [
@ -447,10 +448,10 @@ ConfirmSendToken.prototype.render = function () {
// Cancel Button // Cancel Button
h('button.btn-cancel.page-container__footer-button.allcaps', { h('button.btn-cancel.page-container__footer-button.allcaps', {
onClick: (event) => this.cancel(event, txMeta), onClick: (event) => this.cancel(event, txMeta),
}, t('cancel')), }, this.props.t('cancel')),
// Accept Button // Accept Button
h('button.btn-confirm.page-container__footer-button.allcaps', [t('confirm')]), h('button.btn-confirm.page-container__footer-button.allcaps', [this.props.t('confirm')]),
]), ]),
]), ]),
]), ]),
@ -467,7 +468,7 @@ ConfirmSendToken.prototype.onSubmit = function (event) {
if (valid && this.verifyGasParams()) { if (valid && this.verifyGasParams()) {
this.props.sendTransaction(txMeta, event) this.props.sendTransaction(txMeta, event)
} else { } else {
this.props.dispatch(actions.displayWarning(t('invalidGasParams'))) this.props.dispatch(actions.displayWarning(this.props.t('invalidGasParams')))
this.setState({ submitting: false }) this.setState({ submitting: false })
} }
} }

View File

@ -1,5 +1,5 @@
const Component = require('react').Component const Component = require('react').Component
const { connect } = require('react-redux') const connect = require('../../metamask-connect')
const h = require('react-hyperscript') const h = require('react-hyperscript')
const clone = require('clone') const clone = require('clone')
const abi = require('human-standard-token-abi') const abi = require('human-standard-token-abi')

View File

@ -2,7 +2,7 @@ const Component = require('react').Component
const h = require('react-hyperscript') const h = require('react-hyperscript')
const qrCode = require('qrcode-npm').qrcode const qrCode = require('qrcode-npm').qrcode
const inherits = require('util').inherits const inherits = require('util').inherits
const connect = require('react-redux').connect const connect = require('../metamask-connect')
const isHexPrefixed = require('ethereumjs-util').isHexPrefixed const isHexPrefixed = require('ethereumjs-util').isHexPrefixed
const ReadOnlyInput = require('./readonly-input') const ReadOnlyInput = require('./readonly-input')

View File

@ -1,7 +1,7 @@
const Component = require('react').Component const Component = require('react').Component
const h = require('react-hyperscript') const h = require('react-hyperscript')
const inherits = require('util').inherits const inherits = require('util').inherits
const connect = require('react-redux').connect const connect = require('../../metamask-connect')
const Identicon = require('../identicon') const Identicon = require('../identicon')
const CurrencyDisplay = require('./currency-display') const CurrencyDisplay = require('./currency-display')
const { conversionRateSelector, getCurrentCurrency } = require('../../selectors') const { conversionRateSelector, getCurrentCurrency } = require('../../selectors')

View File

@ -2,9 +2,9 @@ const Component = require('react').Component
const h = require('react-hyperscript') const h = require('react-hyperscript')
const inherits = require('util').inherits const inherits = require('util').inherits
const CurrencyDisplay = require('./currency-display') const CurrencyDisplay = require('./currency-display')
const t = require('../../../i18n') const connect = require('../../metamask-connect')
module.exports = GasFeeDisplay module.exports = connect()(GasFeeDisplay)
inherits(GasFeeDisplay, Component) inherits(GasFeeDisplay, Component)
function GasFeeDisplay () { function GasFeeDisplay () {
@ -33,8 +33,8 @@ GasFeeDisplay.prototype.render = function () {
readOnly: true, readOnly: true,
}) })
: gasLoadingError : gasLoadingError
? h('div..currency-display.currency-display--message', 'Set with the gas price customizer.') ? h('div.currency-display.currency-display--message', this.props.t('setGasPrice'))
: h('div.currency-display', t('loading')), : h('div.currency-display', this.props.t('loading')),
h('button.sliders-icon-container', { h('button.sliders-icon-container', {
onClick, onClick,

View File

@ -2,9 +2,9 @@ const Component = require('react').Component
const h = require('react-hyperscript') const h = require('react-hyperscript')
const inherits = require('util').inherits const inherits = require('util').inherits
const InputNumber = require('../input-number.js') const InputNumber = require('../input-number.js')
const t = require('../../../i18n') const connect = require('../../metamask-connect')
module.exports = GasTooltip module.exports = connect()(GasTooltip)
inherits(GasTooltip, Component) inherits(GasTooltip, Component)
function GasTooltip () { function GasTooltip () {
@ -82,7 +82,7 @@ GasTooltip.prototype.render = function () {
'marginTop': '81px', 'marginTop': '81px',
}, },
}, [ }, [
h('span.gas-tooltip-label', {}, [t('gasLimit')]), h('span.gas-tooltip-label', {}, [this.props.t('gasLimit')]),
h('i.fa.fa-info-circle'), h('i.fa.fa-info-circle'),
]), ]),
h(InputNumber, { h(InputNumber, {

View File

@ -1,4 +1,4 @@
const connect = require('react-redux').connect const connect = require('../../metamask-connect')
const actions = require('../../actions') const actions = require('../../actions')
const abi = require('ethereumjs-abi') const abi = require('ethereumjs-abi')
const SendEther = require('../../send-v2') const SendEther = require('../../send-v2')

View File

@ -2,9 +2,9 @@ const Component = require('react').Component
const h = require('react-hyperscript') const h = require('react-hyperscript')
const inherits = require('util').inherits const inherits = require('util').inherits
const AccountListItem = require('./account-list-item') const AccountListItem = require('./account-list-item')
const t = require('../../../i18n') const connect = require('../../metamask-connect')
module.exports = ToAutoComplete module.exports = connect()(ToAutoComplete)
inherits(ToAutoComplete, Component) inherits(ToAutoComplete, Component)
function ToAutoComplete () { function ToAutoComplete () {
@ -93,7 +93,7 @@ ToAutoComplete.prototype.render = function () {
return h('div.send-v2__to-autocomplete', {}, [ return h('div.send-v2__to-autocomplete', {}, [
h('input.send-v2__to-autocomplete__input', { h('input.send-v2__to-autocomplete__input', {
placeholder: t('recipientAddress'), placeholder: this.props.t('recipientAddress'),
className: inError ? `send-v2__error-border` : '', className: inError ? `send-v2__error-border` : '',
value: to, value: to,
onChange: event => onChange(event.target.value), onChange: event => onChange(event.target.value),

View File

@ -1,7 +1,7 @@
const { Component } = require('react') const { Component } = require('react')
const h = require('react-hyperscript') const h = require('react-hyperscript')
const connect = require('../metamask-connect')
const PropTypes = require('prop-types') const PropTypes = require('prop-types')
const t = require('../../i18n')
const Identicon = require('./identicon') const Identicon = require('./identicon')
class SenderToRecipient extends Component { class SenderToRecipient extends Component {
@ -21,7 +21,7 @@ class SenderToRecipient extends Component {
this.renderRecipientIcon(), this.renderRecipientIcon(),
h( h(
'.sender-to-recipient__name.sender-to-recipient__recipient-name', '.sender-to-recipient__name.sender-to-recipient__recipient-name',
recipientName || t('newContract') recipientName || this.props.t('newContract')
), ),
]) ])
) )
@ -61,6 +61,7 @@ SenderToRecipient.propTypes = {
senderAddress: PropTypes.string, senderAddress: PropTypes.string,
recipientName: PropTypes.string, recipientName: PropTypes.string,
recipientAddress: PropTypes.string, recipientAddress: PropTypes.string,
t: PropTypes.func,
} }
module.exports = SenderToRecipient module.exports = connect()(SenderToRecipient)

View File

@ -1,13 +1,12 @@
const h = require('react-hyperscript') const h = require('react-hyperscript')
const inherits = require('util').inherits const inherits = require('util').inherits
const Component = require('react').Component const Component = require('react').Component
const connect = require('react-redux').connect const connect = require('../metamask-connect')
const classnames = require('classnames') const classnames = require('classnames')
const { qrcode } = require('qrcode-npm') const { qrcode } = require('qrcode-npm')
const { shapeShiftSubview, pairUpdate, buyWithShapeShift } = require('../actions') const { shapeShiftSubview, pairUpdate, buyWithShapeShift } = require('../actions')
const { isValidAddress } = require('../util') const { isValidAddress } = require('../util')
const SimpleDropdown = require('./dropdowns/simple-dropdown') const SimpleDropdown = require('./dropdowns/simple-dropdown')
const t = require('../../i18n')
function mapStateToProps (state) { function mapStateToProps (state) {
const { const {
@ -94,7 +93,7 @@ ShapeshiftForm.prototype.onBuyWithShapeShift = function () {
})) }))
.catch(() => this.setState({ .catch(() => this.setState({
showQrCode: false, showQrCode: false,
errorMessage: t('invalidRequest'), errorMessage: this.props.t('invalidRequest'),
isLoading: false, isLoading: false,
})) }))
} }
@ -126,10 +125,10 @@ ShapeshiftForm.prototype.renderMarketInfo = function () {
return h('div.shapeshift-form__metadata', {}, [ return h('div.shapeshift-form__metadata', {}, [
this.renderMetadata(t('status'), limit ? t('available') : t('unavailable')), this.renderMetadata(this.props.t('status'), limit ? this.props.t('available') : this.props.t('unavailable')),
this.renderMetadata(t('limit'), limit), this.renderMetadata(this.props.t('limit'), limit),
this.renderMetadata(t('exchangeRate'), rate), this.renderMetadata(this.props.t('exchangeRate'), rate),
this.renderMetadata(t('min'), minimum), this.renderMetadata(this.props.t('min'), minimum),
]) ])
} }
@ -143,7 +142,7 @@ ShapeshiftForm.prototype.renderQrCode = function () {
return h('div.shapeshift-form', {}, [ return h('div.shapeshift-form', {}, [
h('div.shapeshift-form__deposit-instruction', [ h('div.shapeshift-form__deposit-instruction', [
t('depositCoin', [depositCoin.toUpperCase()]), this.props.t('depositCoin', [depositCoin.toUpperCase()]),
]), ]),
h('div', depositAddress), h('div', depositAddress),
@ -180,7 +179,7 @@ ShapeshiftForm.prototype.render = function () {
h('div.shapeshift-form__selector', [ h('div.shapeshift-form__selector', [
h('div.shapeshift-form__selector-label', t('deposit')), h('div.shapeshift-form__selector-label', this.props.t('deposit')),
h(SimpleDropdown, { h(SimpleDropdown, {
selectedOption: this.state.depositCoin, selectedOption: this.state.depositCoin,
@ -200,7 +199,7 @@ ShapeshiftForm.prototype.render = function () {
h('div.shapeshift-form__selector', [ h('div.shapeshift-form__selector', [
h('div.shapeshift-form__selector-label', [ h('div.shapeshift-form__selector-label', [
t('receive'), this.props.t('receive'),
]), ]),
h('div.shapeshift-form__selector-input', ['ETH']), h('div.shapeshift-form__selector-input', ['ETH']),
@ -218,7 +217,7 @@ ShapeshiftForm.prototype.render = function () {
}, [ }, [
h('div.shapeshift-form__address-input-label', [ h('div.shapeshift-form__address-input-label', [
t('refundAddress'), this.props.t('refundAddress'),
]), ]),
h('input.shapeshift-form__address-input', { h('input.shapeshift-form__address-input', {
@ -240,7 +239,7 @@ ShapeshiftForm.prototype.render = function () {
className: btnClass, className: btnClass,
disabled: !token, disabled: !token,
onClick: () => this.onBuyWithShapeShift(), onClick: () => this.onBuyWithShapeShift(),
}, [t('buy')]), }, [this.props.t('buy')]),
]) ])
} }

View File

@ -1,12 +1,11 @@
const inherits = require('util').inherits const inherits = require('util').inherits
const Component = require('react').Component const Component = require('react').Component
const h = require('react-hyperscript') const h = require('react-hyperscript')
const connect = require('react-redux').connect const connect = require('../metamask-connect')
const vreme = new (require('vreme'))() const vreme = new (require('vreme'))()
const explorerLink = require('etherscan-link').createExplorerLink const explorerLink = require('etherscan-link').createExplorerLink
const actions = require('../actions') const actions = require('../actions')
const addressSummary = require('../util').addressSummary const addressSummary = require('../util').addressSummary
const t = require('../../i18n')
const CopyButton = require('./copyButton') const CopyButton = require('./copyButton')
const EthBalance = require('./eth-balance') const EthBalance = require('./eth-balance')
@ -76,7 +75,7 @@ ShiftListItem.prototype.renderUtilComponents = function () {
value: this.props.depositAddress, value: this.props.depositAddress,
}), }),
h(Tooltip, { h(Tooltip, {
title: t('qrCode'), title: this.props.t('qrCode'),
}, [ }, [
h('i.fa.fa-qrcode.pointer.pop-hover', { h('i.fa.fa-qrcode.pointer.pop-hover', {
onClick: () => props.dispatch(actions.reshowQrCode(props.depositAddress, props.depositType)), onClick: () => props.dispatch(actions.reshowQrCode(props.depositAddress, props.depositType)),
@ -136,8 +135,8 @@ ShiftListItem.prototype.renderInfo = function () {
color: '#ABA9AA', color: '#ABA9AA',
width: '100%', width: '100%',
}, },
}, t('toETHviaShapeShift', [props.depositType])), }, this.props.t('toETHviaShapeShift', [props.depositType])),
h('div', t('noDeposits')), h('div', this.props.t('noDeposits')),
h('div', { h('div', {
style: { style: {
fontSize: 'x-small', fontSize: 'x-small',
@ -159,8 +158,8 @@ ShiftListItem.prototype.renderInfo = function () {
color: '#ABA9AA', color: '#ABA9AA',
width: '100%', width: '100%',
}, },
}, t('toETHviaShapeShift', [props.depositType])), }, this.props.t('toETHviaShapeShift', [props.depositType])),
h('div', t('conversionProgress')), h('div', this.props.t('conversionProgress')),
h('div', { h('div', {
style: { style: {
fontSize: 'x-small', fontSize: 'x-small',
@ -185,7 +184,7 @@ ShiftListItem.prototype.renderInfo = function () {
color: '#ABA9AA', color: '#ABA9AA',
width: '100%', width: '100%',
}, },
}, t('fromShapeShift')), }, this.props.t('fromShapeShift')),
h('div', formatDate(props.time)), h('div', formatDate(props.time)),
h('div', { h('div', {
style: { style: {
@ -197,7 +196,7 @@ ShiftListItem.prototype.renderInfo = function () {
]) ])
case 'failed': case 'failed':
return h('span.error', '(' + t('failed') + ')') return h('span.error', '(' + this.props.t('failed') + ')')
default: default:
return '' return ''
} }

View File

@ -2,14 +2,13 @@ const Component = require('react').Component
const h = require('react-hyperscript') const h = require('react-hyperscript')
const inherits = require('util').inherits const inherits = require('util').inherits
const Identicon = require('./identicon') const Identicon = require('./identicon')
const connect = require('react-redux').connect const connect = require('../metamask-connect')
const ethUtil = require('ethereumjs-util') const ethUtil = require('ethereumjs-util')
const classnames = require('classnames') const classnames = require('classnames')
const AccountDropdownMini = require('./dropdowns/account-dropdown-mini') const AccountDropdownMini = require('./dropdowns/account-dropdown-mini')
const actions = require('../actions') const actions = require('../actions')
const t = require('../../i18n')
const { conversionUtil } = require('../conversion-util') const { conversionUtil } = require('../conversion-util')
const { const {
@ -55,7 +54,7 @@ SignatureRequest.prototype.renderHeader = function () {
h('div.request-signature__header-background'), h('div.request-signature__header-background'),
h('div.request-signature__header__text', t('sigRequest')), h('div.request-signature__header__text', this.props.t('sigRequest')),
h('div.request-signature__header__tip-container', [ h('div.request-signature__header__tip-container', [
h('div.request-signature__header__tip'), h('div.request-signature__header__tip'),
@ -76,7 +75,7 @@ SignatureRequest.prototype.renderAccountDropdown = function () {
return h('div.request-signature__account', [ return h('div.request-signature__account', [
h('div.request-signature__account-text', [t('account') + ':']), h('div.request-signature__account-text', [this.props.t('account') + ':']),
h(AccountDropdownMini, { h(AccountDropdownMini, {
selectedAccount, selectedAccount,
@ -103,7 +102,7 @@ SignatureRequest.prototype.renderBalance = function () {
return h('div.request-signature__balance', [ return h('div.request-signature__balance', [
h('div.request-signature__balance-text', [t('balance')]), h('div.request-signature__balance-text', [this.props.t('balance')]),
h('div.request-signature__balance-value', `${balanceInEther} ETH`), h('div.request-signature__balance-value', `${balanceInEther} ETH`),
@ -137,7 +136,7 @@ SignatureRequest.prototype.renderRequestInfo = function () {
return h('div.request-signature__request-info', [ return h('div.request-signature__request-info', [
h('div.request-signature__headline', [ h('div.request-signature__headline', [
t('yourSigRequested'), this.props.t('yourSigRequested'),
]), ]),
]) ])
@ -155,18 +154,18 @@ SignatureRequest.prototype.msgHexToText = function (hex) {
SignatureRequest.prototype.renderBody = function () { SignatureRequest.prototype.renderBody = function () {
let rows let rows
let notice = t('youSign') + ':' let notice = this.props.t('youSign') + ':'
const { txData } = this.props const { txData } = this.props
const { type, msgParams: { data } } = txData const { type, msgParams: { data } } = txData
if (type === 'personal_sign') { if (type === 'personal_sign') {
rows = [{ name: t('message'), value: this.msgHexToText(data) }] rows = [{ name: this.props.t('message'), value: this.msgHexToText(data) }]
} else if (type === 'eth_signTypedData') { } else if (type === 'eth_signTypedData') {
rows = data rows = data
} else if (type === 'eth_sign') { } else if (type === 'eth_sign') {
rows = [{ name: t('message'), value: data }] rows = [{ name: this.props.t('message'), value: data }]
notice = t('signNotice') notice = this.props.t('signNotice')
} }
return h('div.request-signature__body', {}, [ return h('div.request-signature__body', {}, [
@ -225,10 +224,10 @@ SignatureRequest.prototype.renderFooter = function () {
return h('div.request-signature__footer', [ return h('div.request-signature__footer', [
h('button.btn-secondary--lg.request-signature__footer__cancel-button', { h('button.btn-secondary--lg.request-signature__footer__cancel-button', {
onClick: cancel, onClick: cancel,
}, t('cancel')), }, this.props.t('cancel')),
h('button.btn-primary--lg', { h('button.btn-primary--lg', {
onClick: sign, onClick: sign,
}, t('sign')), }, this.props.t('sign')),
]) ])
} }

View File

@ -2,7 +2,7 @@ const Component = require('react').Component
const h = require('react-hyperscript') const h = require('react-hyperscript')
const inherits = require('util').inherits const inherits = require('util').inherits
const TokenTracker = require('eth-token-tracker') const TokenTracker = require('eth-token-tracker')
const connect = require('react-redux').connect const connect = require('../metamask-connect')
const selectors = require('../selectors') const selectors = require('../selectors')
function mapStateToProps (state) { function mapStateToProps (state) {

View File

@ -1,7 +1,7 @@
const Component = require('react').Component const Component = require('react').Component
const h = require('react-hyperscript') const h = require('react-hyperscript')
const inherits = require('util').inherits const inherits = require('util').inherits
const connect = require('react-redux').connect const connect = require('../metamask-connect')
const Identicon = require('./identicon') const Identicon = require('./identicon')
const prefixForNetwork = require('../../lib/etherscan-prefix-for-network') const prefixForNetwork = require('../../lib/etherscan-prefix-for-network')
const selectors = require('../selectors') const selectors = require('../selectors')

View File

@ -3,9 +3,8 @@ const h = require('react-hyperscript')
const inherits = require('util').inherits const inherits = require('util').inherits
const TokenTracker = require('eth-token-tracker') const TokenTracker = require('eth-token-tracker')
const TokenCell = require('./token-cell.js') const TokenCell = require('./token-cell.js')
const connect = require('react-redux').connect const connect = require('../metamask-connect')
const selectors = require('../selectors') const selectors = require('../selectors')
const t = require('../../i18n')
function mapStateToProps (state) { function mapStateToProps (state) {
return { return {
@ -43,7 +42,7 @@ TokenList.prototype.render = function () {
const { tokens, isLoading, error } = state const { tokens, isLoading, error } = state
if (isLoading) { if (isLoading) {
return this.message(t('loadingTokens')) return this.message(this.props.t('loadingTokens'))
} }
if (error) { if (error) {
@ -53,7 +52,7 @@ TokenList.prototype.render = function () {
padding: '80px', padding: '80px',
}, },
}, [ }, [
t('troubleTokenBalances'), this.props.t('troubleTokenBalances'),
h('span.hotFix', { h('span.hotFix', {
style: { style: {
color: 'rgba(247, 134, 28, 1)', color: 'rgba(247, 134, 28, 1)',
@ -64,7 +63,7 @@ TokenList.prototype.render = function () {
url: `https://ethplorer.io/address/${userAddress}`, url: `https://ethplorer.io/address/${userAddress}`,
}) })
}, },
}, t('here')), }, this.props.t('here')),
]) ])
} }

View File

@ -1,6 +1,6 @@
const Component = require('react').Component const Component = require('react').Component
const h = require('react-hyperscript') const h = require('react-hyperscript')
const connect = require('react-redux').connect const connect = require('../metamask-connect')
const inherits = require('util').inherits const inherits = require('util').inherits
const classnames = require('classnames') const classnames = require('classnames')
const abi = require('human-standard-token-abi') const abi = require('human-standard-token-abi')
@ -14,7 +14,6 @@ const { conversionUtil, multiplyCurrencies } = require('../conversion-util')
const { calcTokenAmount } = require('../token-util') const { calcTokenAmount } = require('../token-util')
const { getCurrentCurrency } = require('../selectors') const { getCurrentCurrency } = require('../selectors')
const t = require('../../i18n')
module.exports = connect(mapStateToProps, mapDispatchToProps)(TxListItem) module.exports = connect(mapStateToProps, mapDispatchToProps)(TxListItem)
@ -75,7 +74,7 @@ TxListItem.prototype.getAddressText = function () {
default: default:
return address return address
? `${address.slice(0, 10)}...${address.slice(-4)}` ? `${address.slice(0, 10)}...${address.slice(-4)}`
: t('contractDeployment') : this.props.t('contractDeployment')
} }
} }
@ -307,21 +306,21 @@ TxListItem.prototype.txStatusIndicator = function () {
let name let name
if (transactionStatus === 'unapproved') { if (transactionStatus === 'unapproved') {
name = t('unapproved') name = this.props.t('unapproved')
} else if (transactionStatus === 'rejected') { } else if (transactionStatus === 'rejected') {
name = t('rejected') name = this.props.t('rejected')
} else if (transactionStatus === 'approved') { } else if (transactionStatus === 'approved') {
name = t('approved') name = this.props.t('approved')
} else if (transactionStatus === 'signed') { } else if (transactionStatus === 'signed') {
name = t('signed') name = this.props.t('signed')
} else if (transactionStatus === 'submitted') { } else if (transactionStatus === 'submitted') {
name = t('submitted') name = this.props.t('submitted')
} else if (transactionStatus === 'confirmed') { } else if (transactionStatus === 'confirmed') {
name = t('confirmed') name = this.props.t('confirmed')
} else if (transactionStatus === 'failed') { } else if (transactionStatus === 'failed') {
name = t('failed') name = this.props.t('failed')
} else if (transactionStatus === 'dropped') { } else if (transactionStatus === 'dropped') {
name = t('dropped') name = this.props.t('dropped')
} }
return name return name
} }

View File

@ -1,5 +1,5 @@
const Component = require('react').Component const Component = require('react').Component
const connect = require('react-redux').connect const connect = require('../metamask-connect')
const h = require('react-hyperscript') const h = require('react-hyperscript')
const inherits = require('util').inherits const inherits = require('util').inherits
const prefixForNetwork = require('../../lib/etherscan-prefix-for-network') const prefixForNetwork = require('../../lib/etherscan-prefix-for-network')
@ -13,7 +13,6 @@ const { tokenInfoGetter } = require('../token-util')
const { withRouter } = require('react-router-dom') const { withRouter } = require('react-router-dom')
const { compose } = require('recompose') const { compose } = require('recompose')
const { CONFIRM_TRANSACTION_ROUTE } = require('../routes') const { CONFIRM_TRANSACTION_ROUTE } = require('../routes')
const t = require('../../i18n')
module.exports = compose( module.exports = compose(
withRouter, withRouter,
@ -46,7 +45,7 @@ TxList.prototype.render = function () {
return h('div.flex-column', [ return h('div.flex-column', [
h('div.flex-row.tx-list-header-wrapper', [ h('div.flex-row.tx-list-header-wrapper', [
h('div.flex-row.tx-list-header', [ h('div.flex-row.tx-list-header', [
h('div', t('transactions')), h('div', this.props.t('transactions')),
]), ]),
]), ]),
h('div.flex-column.tx-list-container', {}, [ h('div.flex-column.tx-list-container', {}, [
@ -63,7 +62,7 @@ TxList.prototype.renderTransaction = function () {
: [h( : [h(
'div.tx-list-item.tx-list-item--empty', 'div.tx-list-item.tx-list-item--empty',
{ key: 'tx-list-none' }, { key: 'tx-list-none' },
[ t('noTransactions') ], [ this.props.t('noTransactions') ],
)] )]
} }
@ -117,7 +116,7 @@ TxList.prototype.renderTransactionListItem = function (transaction, conversionRa
if (isUnapproved) { if (isUnapproved) {
opts.onClick = () => history.push(CONFIRM_TRANSACTION_ROUTE) opts.onClick = () => history.push(CONFIRM_TRANSACTION_ROUTE)
opts.transactionStatus = t('Not Started') opts.transactionStatus = this.props.t('notStarted')
} else if (transactionHash) { } else if (transactionHash) {
opts.onClick = () => this.view(transactionHash, transactionNetworkId) opts.onClick = () => this.view(transactionHash, transactionNetworkId)
} }

Some files were not shown because too many files have changed in this diff Show More