Merge branch 'master' into testing

feature/default_network_editable
Thomas 7 years ago
commit 0100923129
  1. 1
      .eslintrc
  2. 1
      .gitignore
  3. 27
      .jshintrc
  4. 4
      CHANGELOG.md
  5. 2
      README.md
  6. 912
      app/_locales/cs/messages.json
  7. 3
      app/_locales/en/messages.json
  8. 20
      app/_locales/hn/messages.json
  9. 2
      app/_locales/index.json
  10. 912
      app/_locales/tml/messages.json
  11. 66
      app/scripts/background.js
  12. 39
      app/scripts/config.js
  13. 42
      app/scripts/contentscript.js
  14. 66
      app/scripts/controllers/address-book.js
  15. 1
      app/scripts/controllers/blacklist.js
  16. 45
      app/scripts/controllers/computed-balances.js
  17. 66
      app/scripts/controllers/currency.js
  18. 1
      app/scripts/controllers/infura.js
  19. 1
      app/scripts/controllers/network.js
  20. 124
      app/scripts/controllers/preferences.js
  21. 1
      app/scripts/controllers/recent-blocks.js
  22. 75
      app/scripts/controllers/shapeshift.js
  23. 77
      app/scripts/controllers/token-rates.js
  24. 1
      app/scripts/controllers/transactions.js
  25. 36
      app/scripts/edge-encryptor.js
  26. 16
      app/scripts/first-time-state.js
  27. 20
      app/scripts/inpage.js
  28. 49
      app/scripts/lib/ComposableObservableStore.js
  29. 11
      app/scripts/lib/buy-eth-url.js
  30. 22
      app/scripts/lib/config-manager.js
  31. 16
      app/scripts/lib/createLoggerMiddleware.js
  32. 12
      app/scripts/lib/createOriginMiddleware.js
  33. 6
      app/scripts/lib/createProviderMiddleware.js
  34. 9
      app/scripts/lib/enums.js
  35. 10
      app/scripts/lib/environment-type.js
  36. 25
      app/scripts/lib/events-proxy.js
  37. 7
      app/scripts/lib/get-first-preferred-lang-code.js
  38. 7
      app/scripts/lib/hex-to-bn.js
  39. 12
      app/scripts/lib/is-popup-or-notification.js
  40. 38
      app/scripts/lib/local-store.js
  41. 35
      app/scripts/lib/migrator/index.js
  42. 8
      app/scripts/lib/nodeify.js
  43. 1
      app/scripts/lib/personal-message-manager.js
  44. 37
      app/scripts/lib/port-stream.js
  45. 1
      app/scripts/lib/seed-phrase-verifier.js
  46. 3
      app/scripts/lib/setupMetamaskMeshMetrics.js
  47. 18
      app/scripts/lib/stream-utils.js
  48. 2
      app/scripts/lib/typed-message-manager.js
  49. 81
      app/scripts/lib/util.js
  50. 123
      app/scripts/metamask-controller.js
  51. 27
      app/scripts/platforms/sw.js
  52. 23
      app/scripts/platforms/window.js
  53. 25
      app/scripts/popup-core.js
  54. 8
      app/scripts/ui.js
  55. 134
      development/states/currency-localization.json
  56. 25
      development/tools/.jsdoc.json
  57. 15
      development/tools/README.md
  58. 21
      development/tools/appveyor.txt
  59. 78
      docs/team.md
  60. 14
      mascara/src/app/first-time/confirm-seed-screen.js
  61. 69
      mascara/src/app/first-time/seed-screen.js
  62. 1
      old-ui/app/app.js
  63. 1
      old-ui/app/components/ens-input.js
  64. 1
      old-ui/app/components/pending-tx.js
  65. 1
      old-ui/app/components/token-list.js
  66. 6
      old-ui/app/conf-tx.js
  67. 1
      old-ui/lib/tx-helper.js
  68. 816
      package-lock.json
  69. 8
      package.json
  70. 28
      test/integration/lib/currency-localization.js
  71. 8
      test/integration/lib/send-new-ui.js
  72. 2
      test/integration/lib/tx-list-items.js
  73. 5
      test/setup.js
  74. 35
      test/unit/ComposableObservableStore.js
  75. 27
      test/unit/balance-formatter-test.js
  76. 29
      test/unit/token-rates-controller.js
  77. 59
      ui/app/actions.js
  78. 28
      ui/app/app.js
  79. 5
      ui/app/components/account-dropdowns.js
  80. 18
      ui/app/components/balance-component.js
  81. 5
      ui/app/components/dropdowns/components/account-dropdowns.js
  82. 1
      ui/app/components/ens-input.js
  83. 10
      ui/app/components/loading.js
  84. 7
      ui/app/components/modals/export-private-key-modal.js
  85. 11
      ui/app/components/modals/modal.js
  86. 1
      ui/app/components/pages/home.js
  87. 1
      ui/app/components/pages/keychains/restore-vault.js
  88. 10
      ui/app/components/pages/settings/info.js
  89. 5
      ui/app/components/pages/unlock.js
  90. 19
      ui/app/components/pending-tx/confirm-send-ether.js
  91. 29
      ui/app/components/pending-tx/confirm-send-token.js
  92. 31
      ui/app/components/pending-tx/index.js
  93. 13
      ui/app/components/qr-code.js
  94. 3
      ui/app/components/send/account-list-item.js
  95. 35
      ui/app/components/send/currency-display.js
  96. 1
      ui/app/components/send/send-v2-container.js
  97. 1
      ui/app/components/token-balance.js
  98. 20
      ui/app/components/token-cell.js
  99. 1
      ui/app/components/token-list.js
  100. 23
      ui/app/components/tx-list-item.js
  101. Some files were not shown because too many files have changed in this diff Show More

@ -35,7 +35,6 @@
"globals": {
"document": false,
"log": true,
"navigator": false,
"web3": true,
"window": false

1
.gitignore vendored

@ -20,6 +20,7 @@ dist
builds/
disc/
builds.zip
docs/jsdocs
development/bundle.js
development/states.js

@ -1,27 +0,0 @@
{
"node": true,
"browser": true,
"esnext": true,
"bitwise": true,
"camelcase": true,
"curly": true,
"eqeqeq": true,
"immed": true,
"indent": 2,
"latedef": true,
"newcap": true,
"noarg": true,
"quotmark": "single",
"regexp": true,
"undef": true,
"unused": true,
"strict": true,
"trailing": true,
"smarttabs": true,
"globals" : {
"chrome": true,
"crypto": true,
"describe": true,
"it": true
}
}

@ -2,7 +2,11 @@
## Current Master
- Correctly format currency conversion for locally selected preferred currency.
- Improved performance of 3D fox logo.
- Fetch token prices based on contract address, not symbol
- Fix bug that prevents setting language locale in settings.
- Show checksum addresses throughout the UI
## 4.5.5 Fri Apr 06 2018

@ -1,6 +1,7 @@
# MetaMask Browser Extension
[![Build Status](https://circleci.com/gh/MetaMask/metamask-extension.svg?style=shield&circle-token=a1ddcf3cd38e29267f254c9c59d556d513e3a1fd)](https://circleci.com/gh/MetaMask/metamask-extension) [![Coverage Status](https://coveralls.io/repos/github/MetaMask/metamask-extension/badge.svg?branch=master)](https://coveralls.io/github/MetaMask/metamask-extension?branch=master) [![Greenkeeper badge](https://badges.greenkeeper.io/MetaMask/metamask-extension.svg)](https://greenkeeper.io/) [![Stories in Ready](https://badge.waffle.io/MetaMask/metamask-extension.png?label=in%20progress&title=waffle.io)](https://waffle.io/MetaMask/metamask-extension)
[Internal documentation](./docs/jsdocs)
## Support
@ -68,6 +69,7 @@ To write tests that will be run in the browser using QUnit, add your test files
- [How to develop a live-reloading UI](./docs/ui-dev-mode.md)
- [How to add a new translation to MetaMask](./docs/translating-guide.md)
- [Publishing Guide](./docs/publishing.md)
- [The MetaMask Team](./docs/team.md)
- [How to develop an in-browser mocked UI](./docs/ui-mock-mode.md)
- [How to live reload on local dependency changes](./docs/developing-on-deps.md)
- [How to add new networks to the Provider Menu](./docs/adding-new-networks.md)

@ -0,0 +1,912 @@
{
"accept": {
"message": "Přijmout"
},
"account": {
"message": "Účet"
},
"accountDetails": {
"message": "Detaily účtu"
},
"accountName": {
"message": "Název účtu"
},
"address": {
"message": "Adresa"
},
"addCustomToken": {
"message": "Přidat vlastní token"
},
"addToken": {
"message": "Přidat token"
},
"addTokens": {
"message": "Přidat tokeny"
},
"amount": {
"message": "Částka"
},
"amountPlusGas": {
"message": "Částka + palivo"
},
"appDescription": {
"message": "Ethereum rozšíření prohlížeče",
"description": "The description of the application"
},
"appName": {
"message": "MetaMask",
"description": "The name of the application"
},
"approved": {
"message": "Schváleno"
},
"attemptingConnect": {
"message": "Pokouším se připojit k blockchainu."
},
"attributions": {
"message": "Zásluhy"
},
"available": {
"message": "Dostupné"
},
"back": {
"message": "Zpět"
},
"balance": {
"message": "Zůstatek:"
},
"balances": {
"message": "Zůstatek tokenu"
},
"balanceIsInsufficientGas": {
"message": "Nedostatek prostředků pro aktuální množství paliva"
},
"beta": {
"message": "BETA"
},
"betweenMinAndMax": {
"message": "musí být větší nebo roven $1 a menší nebo roven $2.",
"description": "helper for inputting hex as decimal input"
},
"blockiesIdenticon": {
"message": "Použít Blockies Identicon"
},
"borrowDharma": {
"message": "Pújčit si přes Dharma (Beta)"
},
"builtInCalifornia": {
"message": "MetaMask je navržen a vytvořen v Kalifornii."
},
"buy": {
"message": "Koupit"
},
"buyCoinbase": {
"message": "Nákup na Coinbase"
},
"buyCoinbaseExplainer": {
"message": "Coinbase je světově nejoblíbenější místo k nákupu a prodeji bitcoinu, etherea nebo litecoinu."
},
"ok": {
"message": "Ok"
},
"cancel": {
"message": "Zrušit"
},
"classicInterface": {
"message": "Použít klasické rozhraní"
},
"clickCopy": {
"message": "Kliknutím zkopírovat"
},
"confirm": {
"message": "Potvrdit"
},
"confirmed": {
"message": "Potvrzeno"
},
"confirmContract": {
"message": "Potvrdit kontrakt"
},
"confirmPassword": {
"message": "Potvrdit heslo"
},
"confirmTransaction": {
"message": "Potvrdit transakci"
},
"continue": {
"message": "Pokračovat"
},
"continueToCoinbase": {
"message": "Přejít na Coinbase"
},
"contractDeployment": {
"message": "Nasazení kontraktu"
},
"conversionProgress": {
"message": "Provádí se převod"
},
"copiedButton": {
"message": "Zkopírováno"
},
"copiedClipboard": {
"message": "Zkopírováno do schránky"
},
"copiedExclamation": {
"message": "Zkopírováno!"
},
"copiedSafe": {
"message": "Zkopíroval jsem to na bezpečné místo"
},
"copy": {
"message": "Kopírovat"
},
"copyToClipboard": {
"message": "Kopírovat do schránky"
},
"copyButton": {
"message": " Kopírovat "
},
"copyPrivateKey": {
"message": "Toto je váš privátní klíč (kliknutím zkopírujte)"
},
"create": {
"message": "Vytvořit"
},
"createAccount": {
"message": "Vytvořit účet"
},
"createDen": {
"message": "Vytvořit"
},
"crypto": {
"message": "Krypto",
"description": "Exchange type (cryptocurrencies)"
},
"currentConversion": {
"message": "Aktuální převod"
},
"currentNetwork": {
"message": "Aktuální síť"
},
"customGas": {
"message": "Nastavit palivo"
},
"customToken": {
"message": "Vlastní token"
},
"customize": {
"message": "Nastavit"
},
"customRPC": {
"message": "Vlastní RPC"
},
"decimalsMustZerotoTen": {
"message": "Desetinných míst musí být od 0 do 36."
},
"decimal": {
"message": "Počet desetinných míst přesnosti"
},
"defaultNetwork": {
"message": "Výchozí síť pro Etherové transakce je Main Net."
},
"denExplainer": {
"message": "Váš DEN je heslem šifrované uložiště v MetaMasku."
},
"deposit": {
"message": "Vklad"
},
"depositBTC": {
"message": "Vložte BTC na níže uvedenou adresu:"
},
"depositCoin": {
"message": "Vložte $1 na níže uvedenou adresu",
"description": "Tells the user what coin they have selected to deposit with shapeshift"
},
"depositEth": {
"message": "Vložit Eth"
},
"depositEther": {
"message": "Vložit Ether"
},
"depositFiat": {
"message": "Vklad s fiat měnou"
},
"depositFromAccount": {
"message": "Vložte z jiného účtu"
},
"depositShapeShift": {
"message": "Vklad přes ShapeShift"
},
"depositShapeShiftExplainer": {
"message": "Pokud vlastníte jiné kryptoměny, můžete je směnit Ether a vložit ho přímo do peněženky MetaMask. Bez založení účtu."
},
"details": {
"message": "Podrobnosti"
},
"directDeposit": {
"message": "Přímý vklad"
},
"directDepositEther": {
"message": "Vložit Ether přímo"
},
"directDepositEtherExplainer": {
"message": "Pokud už vlastníte nějaký Ether, nejrychleji ho dostanete do peněženky přímým vkladem."
},
"done": {
"message": "Hotovo"
},
"downloadStateLogs": {
"message": "Stáhnout stavové protokoly"
},
"dropped": {
"message": "Zrušeno"
},
"edit": {
"message": "Upravit"
},
"editAccountName": {
"message": "Upravit název účtu"
},
"emailUs": {
"message": "Napište nám e-mail!"
},
"encryptNewDen": {
"message": "Zašifrujte svůj nový DEN"
},
"enterPassword": {
"message": "Zadejte heslo"
},
"enterPasswordConfirm": {
"message": "Zadejte heslo k potvrzení"
},
"passwordNotLongEnough": {
"message": "Heslo není dost dlouhé"
},
"passwordsDontMatch": {
"message": "Hesla nejsou stejná"
},
"etherscanView": {
"message": "Prohlédněte si účet na Etherscan"
},
"exchangeRate": {
"message": "Směnný kurz"
},
"exportPrivateKey": {
"message": "Exportovat privátní klíč"
},
"exportPrivateKeyWarning": {
"message": "Exportujte privátní klíč na vlastní riziko."
},
"failed": {
"message": "Neúspěšné"
},
"fiat": {
"message": "FIAT",
"description": "Exchange type"
},
"fileImportFail": {
"message": "Import souboru nefunguje? Klikněte sem!",
"description": "Helps user import their account from a JSON file"
},
"followTwitter": {
"message": "Sledujte nás na Twitteru"
},
"from": {
"message": "Od"
},
"fromToSame": {
"message": "Adresy odesílatele a příjemce nemohou být stejné"
},
"fromShapeShift": {
"message": "Z ShapeShift"
},
"gas": {
"message": "Palivo",
"description": "Short indication of gas cost"
},
"gasFee": {
"message": "Poplatek za palivo"
},
"gasLimit": {
"message": "Limit paliva"
},
"gasLimitCalculation": {
"message": "Počítáme doporučený limit paliva na základě úspěšnosti v síti."
},
"gasLimitRequired": {
"message": "Limit paliva je povinný"
},
"gasLimitTooLow": {
"message": "Limit paliva musí být alespoň 21000"
},
"generatingSeed": {
"message": "Generuji klíčovou frázi..."
},
"gasPrice": {
"message": "Cena paliva (GWEI)"
},
"gasPriceCalculation": {
"message": "Počítáme doporučenou cenu paliva na základě úspěšnosti v síti."
},
"gasPriceRequired": {
"message": "Cena paliva je povinná"
},
"getEther": {
"message": "Získejte Ether"
},
"getEtherFromFaucet": {
"message": "Získejte Ether z faucetu za $1.",
"description": "Displays network name for Ether faucet"
},
"greaterThanMin": {
"message": "musí být větší nebo roven $1.",
"description": "helper for inputting hex as decimal input"
},
"here": {
"message": "zde",
"description": "as in -click here- for more information (goes with troubleTokenBalances)"
},
"hereList": {
"message": "Tady je seznam!!!!"
},
"hide": {
"message": "Skrýt"
},
"hideToken": {
"message": "Skrýt token"
},
"hideTokenPrompt": {
"message": "Skrýt token?"
},
"howToDeposit": {
"message": "Jakým způsobem chcete vložit Ether?"
},
"holdEther": {
"message": "Dovoluje vám držet ether a tokeny a slouží jako most k decentralizovaným aplikacím."
},
"import": {
"message": "Import",
"description": "Button to import an account from a selected file"
},
"importAccount": {
"message": "Import účtu"
},
"importAccountMsg": {
"message":"Importované účty nebudou spojeny s vaší původní MetaMaskovou klíčovou frází. Zjistěte více o importovaných účtech "
},
"importAnAccount": {
"message": "Import účtu"
},
"importDen": {
"message": "Import existujícího DEN"
},
"imported": {
"message": "Importováno",
"description": "status showing that an account has been fully loaded into the keyring"
},
"infoHelp": {
"message": "Informace a nápověda"
},
"insufficientFunds": {
"message": "Nedostatek finančních prostředků."
},
"insufficientTokens": {
"message": "Nedostatek tokenů."
},
"invalidAddress": {
"message": "Neplatná adresa"
},
"invalidAddressRecipient": {
"message": "Adresa příjemce je neplatná"
},
"invalidGasParams": {
"message": "Neplatná parametry paliva"
},
"invalidInput": {
"message": "Neplatný vstup."
},
"invalidRequest": {
"message": "Neplatný požadavek"
},
"invalidRPC": {
"message": "Neplatné RPC URI"
},
"jsonFail": {
"message": "Něco se pokazilo. Prosím, ujistěte se, že váš JSON soubor má správný formát."
},
"jsonFile": {
"message": "JSON soubor",
"description": "format for importing an account"
},
"keepTrackTokens": {
"message": "Udržujte si záznamy o tokenech, které jste koupili s účtem v MetaMasku."
},
"kovan": {
"message": "Kovan Test Network"
},
"knowledgeDataBase": {
"message": "Navštivte naši Knowledge Base"
},
"max": {
"message": "Max"
},
"learnMore": {
"message": "Zjistěte více."
},
"lessThanMax": {
"message": "musí být menší nebo roven $1.",
"description": "helper for inputting hex as decimal input"
},
"likeToAddTokens": {
"message": "Chcete přidat tyto tokeny?"
},
"links": {
"message": "Odkazy"
},
"limit": {
"message": "Limit"
},
"loading": {
"message": "Načítám..."
},
"loadingTokens": {
"message": "Načítám tokeny..."
},
"localhost": {
"message": "Localhost 8545"
},
"login": {
"message": "Přihlásit"
},
"logout": {
"message": "Odhlásit"
},
"loose": {
"message": "Nevázané"
},
"loweCaseWords": {
"message": "slova klíčové fráze mají pouze malá písmena"
},
"mainnet": {
"message": "Main Ethereum Network"
},
"message": {
"message": "Zpráva"
},
"metamaskDescription": {
"message": "MetaMask je bezpečný osobní trezor pro Ethereum."
},
"min": {
"message": "Minimum"
},
"myAccounts": {
"message": "Moje účty"
},
"mustSelectOne": {
"message": "Musíte zvolit aspoň 1 token."
},
"needEtherInWallet": {
"message": "Potřebujete Ether v peněžence, abyste mohli pomocí MetaMasku interagovat s decentralizovanými aplikacemi."
},
"needImportFile": {
"message": "Musíte zvolit soubor k importu.",
"description": "User is important an account and needs to add a file to continue"
},
"needImportPassword": {
"message": "Musíte zadat heslo pro zvolený soubor.",
"description": "Password and file needed to import an account"
},
"negativeETH": {
"message": "Nelze odeslat zápornou částku ETH."
},
"networks": {
"message": "Sítě"
},
"newAccount": {
"message": "Nový účet"
},
"newAccountNumberName": {
"message": "Účet $1",
"description": "Default name of next account to be created on create account screen"
},
"newContract": {
"message": "Nový kontrakt"
},
"newPassword": {
"message": "Nové heslo (min 8 znaků)"
},
"newRecipient": {
"message": "Nový příjemce"
},
"newRPC": {
"message": "Nová RPC URL"
},
"next": {
"message": "Další"
},
"noAddressForName": {
"message": "Pro toto jméno nebyla nastavena žádná adresa."
},
"noDeposits": {
"message": "Žádný vklad"
},
"noTransactionHistory": {
"message": "Žádná historie transakcí."
},
"noTransactions": {
"message": "Žádné transakce"
},
"notStarted": {
"message": "Nezačalo"
},
"oldUI": {
"message": "Staré rozhraní"
},
"oldUIMessage": {
"message": "Vrátili jste se ke starému rozhraní. Můžete přepnout na nové rozhraní v nastavení v pravém horním menu."
},
"or": {
"message": "nebo",
"description": "choice between creating or importing a new account"
},
"passwordCorrect": {
"message": "Ujistěte se, že je vaše heslo správně."
},
"passwordMismatch": {
"message": "hesla nesouhlasí",
"description": "in password creation process, the two new password fields did not match"
},
"passwordShort": {
"message": "heslo je krátké",
"description": "in password creation process, the password is not long enough to be secure"
},
"pastePrivateKey": {
"message": "Vložte zde svůj privátní klíč:",
"description": "For importing an account from a private key"
},
"pasteSeed": {
"message": "Svou klíčovou frázi vložte zde!"
},
"personalAddressDetected": {
"message": "Detekována osobní adresa. Zadejte adresu kontraktu tokenu."
},
"pleaseReviewTransaction": {
"message": "Zkontrolujte si transakci."
},
"popularTokens": {
"message": "Oblíbené tokeny"
},
"privacyMsg": {
"message": "Zásady ochrany osobních údajů"
},
"privateKey": {
"message": "Privátní klíč",
"description": "select this type of file to use to import an account"
},
"privateKeyWarning": {
"message": "Upozornění: Nikdy nezveřejněte tento klíč. Kdokoli může s vaším privátním klíčem odcizit vaše aktiva z účtu."
},
"privateNetwork": {
"message": "Soukromá síť"
},
"qrCode": {
"message": "Ukázat QR kód"
},
"readdToken": {
"message": "Tento token můžete v budoucnu přidat zpět s „Přidat token“ v nastavení účtu."
},
"readMore": {
"message": "Přečtěte si více zde."
},
"readMore2": {
"message": "Přečtěte si více."
},
"receive": {
"message": "Obrdžet"
},
"recipientAddress": {
"message": "Adresa příjemce"
},
"refundAddress": {
"message": "Adresa pro vrácení peněz"
},
"rejected": {
"message": "Odmítnuto"
},
"resetAccount": {
"message": "Resetovat účet"
},
"restoreFromSeed": {
"message": "Obnovit z seed fráze"
},
"restoreVault": {
"message": "Obnovit trezor"
},
"required": {
"message": "Povinné"
},
"retryWithMoreGas": {
"message": "Opakujte s vyšší cenou paliva"
},
"walletSeed": {
"message": "Klíčová fráze peněženky"
},
"revealSeedWords": {
"message": "Zobrazit slova klíčové fráze"
},
"revealSeedWordsWarning": {
"message": "Nebnovujte slova klíčové fráze na veřejnosti! Tato slova mohou být použita k odcizení veškerých vyašich účtů."
},
"revert": {
"message": "Zvrátit"
},
"rinkeby": {
"message": "Rinkeby Test Network"
},
"ropsten": {
"message": "Ropsten Test Network"
},
"currentRpc": {
"message": "Současné RPC"
},
"connectingToMainnet": {
"message": "Připojuji se k Main Ethereum Network"
},
"connectingToRopsten": {
"message": "Připojuji se k Ropsten Test Network"
},
"connectingToKovan": {
"message": "Připojuji se k Kovan Test Network"
},
"connectingToRinkeby": {
"message": "Připojuji se k Rinkeby Test Network"
},
"connectingToUnknown": {
"message": "Připojuji se k neznámé síti"
},
"sampleAccountName": {
"message": "Např. můj nový účet",
"description": "Help user understand concept of adding a human-readable name to their account"
},
"save": {
"message": "Uložit"
},
"reprice_title": {
"message": "Změnit cenu transakce"
},
"reprice_subtitle": {
"message": "Navyšte cenu paliva ve snaze k přepsání a urychlení vyší transakce"
},
"saveAsFile": {
"message": "Uložit do souboru",
"description": "Account export process"
},
"saveSeedAsFile": {
"message": "Uložit slova klíčové fráze do souboru"
},
"search": {
"message": "Hledat"
},
"secretPhrase": {
"message": "Zadejte svých 12 slov tajné fráze k obnovení trezoru."
},
"newPassword8Chars": {
"message": "Nové heslo (min 8 znaků)"
},
"seedPhraseReq": {
"message": "klíčové fráze mají 12 slov"
},
"select": {
"message": "Vybrat"
},
"selectCurrency": {
"message": "Vybrat měnu"
},
"selectService": {
"message": "Vybrat službu"
},
"selectType": {
"message": "Vybrat typ"
},
"send": {
"message": "Odeslat"
},
"sendETH": {
"message": "Odeslat ETH"
},
"sendTokens": {
"message": "Odeslat tokeny"
},
"onlySendToEtherAddress": {
"message": "Posílejte jen ETH na Ethereum adresu."
},
"searchTokens": {
"message": "Hledat tokeny"
},
"sendTokensAnywhere": {
"message": "Posílejte tokeny komukoli s Ethereum účtem"
},
"settings": {
"message": "Nastavení"
},
"info": {
"message": "Informace"
},
"shapeshiftBuy": {
"message": "Nakoupit na ShapeShift"
},
"showPrivateKeys": {
"message": "Zobrazit privátní klíče"
},
"showQRCode": {
"message": "Zobrazit QR kód"
},
"sign": {
"message": "Podepsat"
},
"signed": {
"message": "Podepsáno"
},
"signMessage": {
"message": "Podepsat zprávu"
},
"signNotice": {
"message": "Podepsání zprávy může mít \nnebezpečný vedlejší učinek. Podepisujte zprávy pouze ze \nstránek, kterým plně důvěřujete celým svým účtem.\n Tato nebezpečná metoda bude odebrána v budoucí verzi. "
},
"sigRequest": {
"message": "Požadavek podpisu"
},
"sigRequested": {
"message": "Požádáno o podpis"
},
"spaceBetween": {
"message": "mezi slovy může být pouze mezera"
},
"status": {
"message": "Stav"
},
"stateLogs": {
"message": "Stavové protokoly"
},
"stateLogsDescription": {
"message": "Stavové protokoly obsahují vaše veřejné adresy účtů a odeslané transakce."
},
"stateLogError": {
"message": "Chyba během získávání stavových protokolů."
},
"submit": {
"message": "Odeslat"
},
"submitted": {
"message": "Odesláno"
},
"supportCenter": {
"message": "Navštivte naše centrum podpory"
},
"symbolBetweenZeroTen": {
"message": "Symbol musí být mezi 0 a 10 znaky."
},
"takesTooLong": {
"message": "Trvá to dlouho?"
},
"terms": {
"message": "Podmínky použití"
},
"testFaucet": {
"message": "Testovací faucet"
},
"to": {
"message": "Komu: "
},
"toETHviaShapeShift": {
"message": "$1 na ETH přes ShapeShift",
"description": "system will fill in deposit type in start of message"
},
"tokenAddress": {
"message": "Adresa tokenu"
},
"tokenAlreadyAdded": {
"message": "Token byl už přidán."
},
"tokenBalance": {
"message": "Váš zůstatek tokenu je:"
},
"tokenSelection": {
"message": "Vyhledejte token nebo je vyberte z našeho seznamu oblíbených tokenů."
},
"tokenSymbol": {
"message": "Symbol tokenu"
},
"tokenWarning1": {
"message": "Mějte přehled o tokenech, které jste koupili s účtem MetaMasku. Pokud jste koupili tokeny s jiným účtem, tyto tokeny se zde nezobrazí."
},
"total": {
"message": "Celkem"
},
"transactions": {
"message": "transakce"
},
"transactionError": {
"message": "Chyba transakce. Vyhozena výjimka v kódu kontraktu."
},
"transactionMemo": {
"message": "Poznámka transakce (nepovinné)"
},
"transactionNumber": {
"message": "Číslo transakce"
},
"transfers": {
"message": "Převody"
},
"troubleTokenBalances": {
"message": "Měli jsme problém s načtením vašich tokenových zůstatků. Můžete je vidět ",
"description": "Followed by a link (here) to view token balances"
},
"twelveWords": {
"message": "Těchto 12 slov je jedinou možností, jak obnovit MetaMask účet. \nUložte je na bezpečné a neveřejné místo."
},
"typePassword": {
"message": "Zadejte své heslo"
},
"uiWelcome": {
"message": "Vítejte v novém rozhraní (Beta)"
},
"uiWelcomeMessage": {
"message": "Používáte nyní nové rozhraní MetaMasku. Rozhlédněte se kolem, vyzkoušejte nové funkce, jako jsou zasílání tokenů, a dejte nám vědět, pokud narazíte na problém."
},
"unapproved": {
"message": "Neschváleno"
},
"unavailable": {
"message": "Nedostupné"
},
"unknown": {
"message": "Neznámé"
},
"unknownNetwork": {
"message": "Neznámá soukromá síť"
},
"unknownNetworkId": {
"message": "Neznámé ID sítě"
},
"uriErrorMsg": {
"message": "URI vyžadují korektní HTTP/HTTPS prefix."
},
"usaOnly": {
"message": "jen v USA",
"description": "Using this exchange is limited to people inside the USA"
},
"usedByClients": {
"message": "Používána různými klienty"
},
"useOldUI": {
"message": "Použijte staré rozhraní"
},
"validFileImport": {
"message": "Musíte vybrat validní soubor k importu."
},
"vaultCreated": {
"message": "Trezor vytvořen"
},
"viewAccount": {
"message": "Zobrazit účet"
},
"visitWebSite": {
"message": "Navštivte naši stránku"
},
"warning": {
"message": "Varování"
},
"welcomeBeta": {
"message": "Vítejte v MetaMask Beta"
},
"whatsThis": {
"message": "Co to je?"
},
"yourSigRequested": {
"message": "Je vyžadován váš podpis"
},
"youSign": {
"message": "Podepisujete"
}
}

@ -908,5 +908,8 @@
},
"youSign": {
"message": "You are signing"
},
"generatingTransaction": {
"message": "Generating transaction"
}
}

@ -9,7 +9,7 @@
"message": "खिवरण"
},
"accountName": {
"message": "खम"
"message": "खम"
},
"address": {
"message": "ख पत"
@ -21,7 +21,7 @@
"message": "टकन ज"
},
"addTokens": {
"message": "टकन"
"message": "टकन"
},
"amount": {
"message": "रि"
@ -30,7 +30,7 @@
"message": "रि + गस"
},
"appDescription": {
"message": "एथरम बउजर एकसटशन",
"message": "इथिम बउजर एकसटशन",
"description": "आवदन किवरण"
},
"appName": {
@ -53,7 +53,7 @@
"message": "उपलबध बस।"
},
"balances": {
"message": "पक उपलबध बस"
"message": "पक उपलबध बस"
},
"balanceIsInsufficientGas": {
"message": "वरतमन गस कल किए अपरत शष"
@ -78,10 +78,10 @@
"message": "खर"
},
"buyCoinbase": {
"message": "कनबस पर खर"
"message": "कनबस पर खर"
},
"buyCoinbaseExplainer": {
"message": "बिटकइन, एथरम और लइटकइन खरदन और बचनिए दि सबसकपिय तर Coinbase।"
"message": "बिटकइन, इथिम और लइटकइन खरदन और बचनिए दि सबसकपिय तर इनब।"
},
"cancel": {
"message": "रदद कर"
@ -108,7 +108,7 @@
"message": "ज रख"
},
"continueToCoinbase": {
"message": "कनबस कजन रख"
"message": "कनबस कजन रख"
},
"contractDeployment": {
"message": "अनध परििजन व त"
@ -435,13 +435,13 @@
"message": "बज शबद मवल लअरकस वरण ह"
},
"mainnet": {
"message": "मईथरम नटवरक"
"message": "मइथिम नटवरक"
},
"message": {
"message": "सश"
},
"metamaskDescription": {
"message": "मएथरम किए एक सरकित पहचन वट ह।"
"message": "मइथिम किए एक सरकित पहचन वट ह।"
},
"min": {
"message": "ननतम"
@ -649,7 +649,7 @@
"message": "भकन"
},
"sendTokensAnywhere": {
"message": "इम खिकन भ"
"message": "इिम खिकन भ"
},
"settings": {
"message": "सिस"

@ -1,4 +1,5 @@
[
{ "code": "cs", "name": "Czech" },
{ "code": "de", "name": "German" },
{ "code": "en", "name": "English" },
{ "code": "es", "name": "Spanish" },
@ -13,6 +14,7 @@
{ "code": "ru", "name": "Russian" },
{ "code": "sl", "name": "Slovenian" },
{ "code": "th", "name": "Thai" },
{ "code": "tml", "name": "Tamil" },
{ "code": "tr", "name": "Turkish" },
{ "code": "vi", "name": "Vietnamese" },
{ "code": "zh_CN", "name": "Mandarin" },

@ -0,0 +1,912 @@
{
"accept": {
"message": "ஏறகவ"
},
"account": {
"message": "கணக"
},
"accountDetails": {
"message": "கணகிவரஙகள"
},
"accountName": {
"message": "கணகியர"
},
"address": {
"message": "மகவரி"
},
"addCustomToken": {
"message": "தனிபயனகனகவ"
},
"addToken": {
"message": "டகன"
},
"addTokens": {
"message": "டகனகள"
},
"amount": {
"message": "த"
},
"amountPlusGas": {
"message": "த + எரி"
},
"appDescription": {
"message": "எதிிசரி",
"description": "பயனிிளககம"
},
"appName": {
"message": "மடமஸ ",
"description": "பயனியர"
},
"approved": {
"message": "அஙகரிகபபடட"
},
"attemptingConnect": {
"message": "இணக மயறிக ப"
},
"attributions": {
"message": "பணகள"
},
"available": {
"message": "கி"
},
"back": {
"message": "ம"
},
"balance": {
"message": "இர:"
},
"balances": {
"message": "உஙகள இர"
},
"balanceIsInsufficientGas": {
"message": "நடபதமன சமநி"
},
"beta": {
"message": "ப"
},
"betweenMinAndMax": {
"message": "$ 1 க அதிகமகவ அலலத $ 2 க சமமகவ இரக வ.",
"description": "ஹ உள தசம உள என உதவி"
},
"blockiesIdenticon": {
"message": "பி ஐடி பயன"
},
"borrowDharma": {
"message": "தரமதடன கடனகள (ப)"
},
"builtInCalifornia": {
"message": "மடமஸ வடிவமகபபட கலிிி கடடபபடளத."
},
"buy": {
"message": "வக"
},
"buyCoinbase": {
"message": "கஇனபசகவ"
},
"buyCoinbaseExplainer": {
"message": "கஇனபசிறக , எதி மறிடசக மறிக உலகிிகவிரபலமன வழி"
},
"ok": {
"message": "சரி"
},
"cancel": {
"message": "ரத"
},
"classicInterface": {
"message": "கிி இடகத பயனபடதவ"
},
"clickCopy": {
"message": "நகலக கிியவ"
},
"confirm": {
"message": "உறிபடதவ"
},
"confirmed": {
"message": "உறி"
},
"confirmContract": {
"message": "ஒபபநதத உறிபடக"
},
"confirmPassword": {
"message": "கடவ உறிபடக"
},
"confirmTransaction": {
"message": "பரிவரதன உறிபடதவ"
},
"continue": {
"message": "தடர"
},
"continueToCoinbase": {
"message": "கஇனபச ஐதடரவ"
},
"contractDeployment": {
"message": "ஒபபநத வரிபடதல"
},
"conversionProgress": {
"message": "மறமறம"
},
"copiedButton": {
"message": "நகலகபபடடன"
},
"copiedClipboard": {
"message": "கிி நகலகபபடடத"
},
"copiedExclamation": {
"message": "நகலகபபடடன!"
},
"copiedSafe": {
"message": "ந எஙவதக நகலிி"
},
"copy": {
"message": "நகல"
},
"copyToClipboard": {
"message": "கிி நகலகபபடடத"
},
"copyButton": {
"message": " நகல "
},
"copyPrivateKey": {
"message": "இத உஙகள தனிபடட வி (நகலக கிியவ)"
},
"create": {
"message": "உரகவ"
},
"createAccount": {
"message": "உஙகள கணகவஙகள"
},
"createDen": {
"message": "உரகவ"
},
"crypto": {
"message": "கிி",
"description": "பரிற வக (கிிி)"
},
"currentConversion": {
"message": "தறய மறம"
},
"currentNetwork": {
"message": "தறய ந"
},
"customGas": {
"message": "எரி தனிபயனகள"
},
"customToken": {
"message": "தனிபயனகன"
},
"customize": {
"message": "தனிபயனகல"
},
"customRPC": {
"message": "விப RPC ஐ"
},
"decimalsMustZerotoTen": {
"message": "தசமஙகளதபடசம 0, மற 36 க இரக வ."
},
"decimal": {
"message": "தியதிி"
},
"defaultNetwork": {
"message": "எதி பரிவரதனகளன மி வலயமதனிகரம."
},
"denExplainer": {
"message": "உஙகள DEN எனபத உஙகள கடவ-மறிகபபடட சிபகமி."
},
"deposit": {
"message": "வ"
},
"depositBTC": {
"message": "க உஙகளகவரி உஙகள BTC வ:"
},
"depositCoin": {
"message": "உஙகளகவரி $ 1 ஐ க உளிடவ",
"description": "சபஷிி உடனகபபடட நணயத பயனரிடமி"
},
"depositEth": {
"message": "வ எத "
},
"depositEther": {
"message": "வ எதி "
},
"depositFiat": {
"message": "ஃபியட உடன"
},
"depositFromAccount": {
"message": "மற கணகிி"
},
"depositShapeShift": {
"message": "ShapeShift உடன"
},
"depositShapeShiftExplainer": {
"message": "நகள மறற கிிிரனகளதமக வி, உஙகள பணபிரடிக ஈதர வரதகமயல மறயல. கணகி."
},
"details": {
"message": "விவரஙகள"
},
"directDeposit": {
"message": "நரடி"
},
"directDepositEther": {
"message": "நரடிக வ"
},
"directDepositEtherExplainer": {
"message": "நகள ஏறகனவ ஏத இர, நரடிலம உஙகளிய பணபி ஈததரற வின வழி."
},
"done": {
"message": "மிதத"
},
"downloadStateLogs": {
"message": "மில பதிகள பதிிறகக"
},
"dropped": {
"message": "நகபபட"
},
"edit": {
"message": "த"
},
"editAccountName": {
"message": "கணகயரக"
},
"emailUs": {
"message": "எஙகளினஞசல!"
},
"encryptNewDen": {
"message": "உஙகளிய DEN ஐ கிக"
},
"enterPassword": {
"message": "கடவ உளிடவ"
},
"enterPasswordConfirm": {
"message": "உறிபடத உஙகள கடவ உளிடவ"
},
"passwordNotLongEnough": {
"message": "கடவ"
},
"passwordsDontMatch": {
"message": "கடவகள"
},
"etherscanView": {
"message": "Etherscan கணககவ"
},
"exchangeRate": {
"message": "மிிதம"
},
"exportPrivateKey": {
"message": "தனிி ஐ ஏறமதிக"
},
"exportPrivateKeyWarning": {
"message": "தனிபடட விகள உஙகளத ஆபதி ஏறமதிகள."
},
"failed": {
"message": "தி"
},
"fiat": {
"message": "FIAT",
"description": "பரிற வக"
},
"fileImportFail": {
"message": "க இறகமதியவி? இஙிியவ!",
"description": "JSON கி பயனர கணக தஙகள கணக இறகமதிய உதவிறத"
},
"followTwitter": {
"message": "Twitter இல எஙகளிடரவ"
},
"from": {
"message": "இர"
},
"fromToSame": {
"message": "இர மறகவரி அத இரக மி"
},
"fromShapeShift": {
"message": "ShapeShift இலி"
},
"gas": {
"message": "எரி",
"description": "எரிி"
},
"gasFee": {
"message": "எரி கடடணம"
},
"gasLimit": {
"message": "எரி வரம"
},
"gasLimitCalculation": {
"message": "நிிிதஙகளி அடிபடி பரிகபபடட எரி வரமகள கணகிி."
},
"gasLimitRequired": {
"message": "எரி வரம"
},
"gasLimitTooLow": {
"message": "எரி வரமதத 21000 ஆக இரக வ"
},
"generatingSeed": {
"message": "வி உரிறத ..."
},
"gasPrice": {
"message": "எரிி (GWEI)"
},
"gasPriceCalculation": {
"message": "நிிிதஙகளி அடிபடி பரிகபபடட எரிிகளகள கணகிி."
},
"gasPriceRequired": {
"message": "எரிிபடிறத"
},
"getEther": {
"message": "ஈததரி"
},
"getEtherFromFaucet": {
"message": "$ 1 க ஒர இர ஈதரி$1",
"description": "ஈததர ஐநிய பயரிறத"
},
"greaterThanMin": {
"message": "$ 1 க அதிகமகவ அலலத சமமகவ இரக வ",
"description": "ஹ உள தசம உள என உதவி"
},
"here": {
"message": "இங",
"description": "இங-கிியவ- ம தகவல (troubleTokenBalances சிறத)"
},
"hereList": {
"message": "இங ஒர படியல !!!!"
},
"hide": {
"message": "மற"
},
"hideToken": {
"message": "டகன மற"
},
"hideTokenPrompt": {
"message": "டகன மற?"
},
"howToDeposit": {
"message": "எபபடி ஈததரபத?"
},
"holdEther": {
"message": "இதகள ஈததர மறகனகளிக உதவிறத, மற பரவலகபபடட பயனகள உஙகளலமக சயலபடிறத."
},
"import": {
"message": "இறகமதி",
"description": "தகபபடட கிி ஒர கணக இறகமதிய ப அழதவ"
},
"importAccount": {
"message": "கணக இறகமதிக"
},
"importAccountMsg": {
"message":" இறகமதியபபடட கணக உஙகளதலி உரகபபடட ம கணகிலமடரயதக இர. இறகமதியபபடட கணககள பறி அறிக "
},
"importAnAccount": {
"message": "ஒர கணக இறகமதிக"
},
"importDen": {
"message": "இறகமதி DEN இறகமதி"
},
"imported": {
"message": "இறகமதி",
"description": "ஒர கணகக விபலகி ஏறறபபடடதிறத"
},
"infoHelp": {
"message": "தகவல மற உதவி"
},
"insufficientFunds": {
"message": "பன பணம இல."
},
"insufficientTokens": {
"message": "பன டகனகள."
},
"invalidAddress": {
"message": "தவறன மகவரி"
},
"invalidAddressRecipient": {
"message": "பநரகவரி தவறனத"
},
"invalidGasParams": {
"message": "தவறன எரி அளவகள"
},
"invalidInput": {
"message": "தவறன உள.."
},
"invalidRequest": {
"message": "தவறன கி"
},
"invalidRPC": {
"message": "தவறன RPC URI"
},
"jsonFail": {
"message": "ஏத தவற நடநிடத. உஙகள JSON க ஒழக வடிவமகபபடளத எனபத உறிபடதவ"
},
"jsonFile": {
"message": "JSON க",
"description": "ஒர கணக இறகமதிய வடிவமகபபடளத"
},
"keepTrackTokens": {
"message": "உஙகளடமஸ கணகடனகளிய டகனகள கணிகள."
},
"kovan": {
"message": "கவன"
},
"knowledgeDataBase": {
"message": "எஙகள அறி தளதிடவ"
},
"max": {
"message": "ம"
},
"learnMore": {
"message": "ம அறிக"
},
"lessThanMax": {
"message": "$ 1 ககவ அலலத சமமகவ இரக வ.",
"description": "ஹ உள தசம உள என உதவி"
},
"likeToAddTokens": {
"message": "இநத டகனகளக விிகள?"
},
"links": {
"message": "இணகள"
},
"limit": {
"message": "அளவ"
},
"loading": {
"message": "ஏறதல ..."
},
"loadingTokens": {
"message": "டகனகள ஏறிறத ..."
},
"localhost": {
"message": "லகல 8545"
},
"login": {
"message": "உள"
},
"logout": {
"message": "வி"
},
"loose": {
"message": "ல"
},
"loweCaseWords": {
"message": "விகள எழகள மட"
},
"mainnet": {
"message": "மதன எதி"
},
"message": {
"message": "சி"
},
"metamaskDescription": {
"message": "மடமஸ எனபத ஒரன அடள வ எதி"
},
"min": {
"message": "கதபடச"
},
"myAccounts": {
"message": "எனத கணககள"
},
"mustSelectOne": {
"message": "கதத 1 டகனக வ."
},
"needEtherInWallet": {
"message": "மடமஸ ஐ பயனபடி பரவலகபபடட பயனகளடனடரள, உஙகள பணபபரிறதி ஈதர."
},
"needImportFile": {
"message": "இறகமதிய ஒரகளக வ.",
"description": "பயனர ஒர கணகியம மறடர ஒரக வ"
},
"needImportPassword": {
"message": "நகளத க ஒர கடவ உளிட வ.",
"description": "ஒர கணக இறகமதிய கடவ மற"
},
"negativeETH": {
"message": "ETH எதிமற அளவகள அனப மி."
},
"networks": {
"message": "ந"
},
"newAccount": {
"message": "பிய கணக"
},
"newAccountNumberName": {
"message": "கணக $ 1",
"description": "கணக கணக உரவதற அடத கணகி இயலியர உரகபபட"
},
"newContract": {
"message": "பிய ஒபபநதம"
},
"newPassword": {
"message": "பிய கடவ (min 8 எழகள)"
},
"newRecipient": {
"message": "பிய பநர"
},
"newRPC": {
"message": "பிய RPC URL"
},
"next": {
"message": "அடத"
},
"noAddressForName": {
"message": "இநத பயரன மகவரி அமகபபடவி."
},
"noDeposits": {
"message": "எநத வகளிகவி"
},
"noTransactionHistory": {
"message": "பரிவரதன வரல இல."
},
"noTransactions": {
"message": "பரிவரதனகள இல"
},
"notStarted": {
"message": "தவஙகவி"
},
"oldUI": {
"message": "பழய UI"
},
"oldUIMessage": {
"message": "நகள பழய UI கிிகள. ம வலதி உளள விபதிலமிய UI ஐ மறல."
},
"or": {
"message": "அலலத",
"description": "ஒரிய கணக உரக அலலத இறகமதிவதற இட"
},
"passwordCorrect": {
"message": "தயவ உஙகள கடவ சரினத என உறிபடதவ."
},
"passwordMismatch": {
"message": "கடவகளதவி",
"description": "கடவ உரகதி, இரணிய கடவலஙகளதவி"
},
"passwordShort": {
"message": "கடவட கலமக இல",
"description": "கடவ உரகதி, பனதக இர கடவ"
},
"pastePrivateKey": {
"message": "இங உஙகள தனிபடட வி சரத ஒடக:",
"description": "ஒர தனிபடட வி ஒர கணக இறகமதிய"
},
"pasteSeed": {
"message": "இங உஙகளிடர ஒடடவ!"
},
"personalAddressDetected": {
"message": "தனிபடட மகவரி கணடறியபபடடத. டகன ஒபபநத மகவரி உளிடவ."
},
"pleaseReviewTransaction": {
"message": "உஙகள பரிவரதன மதியவ."
},
"popularTokens": {
"message": "பிரபலமன டகனகள"
},
"privacyMsg": {
"message": "தனிி"
},
"privateKey": {
"message": "தனிபடட வி",
"description": "ஒர கணக இறகமதிய பயனபடத இநத வககவ"
},
"privateKeyWarning": {
"message": "எசசரி: இநத வி எபிிட வ. உஙகள தனிபடட விகளட எவர உஙகள கணகி உளள எநத சகளிடல."
},
"privateNetwork": {
"message": "தனி"
},
"qrCode": {
"message": "QR கி"
},
"readdToken": {
"message": "உஙகள கணகிபஙகளி \"டகன\" எனபதனலமகள எதிலதி இநத டகனகல."
},
"readMore": {
"message": "மிக இங."
},
"readMore2": {
"message": "மிக."
},
"receive": {
"message": "பக"
},
"recipientAddress": {
"message": "பநரகவரி"
},
"refundAddress": {
"message": "உஙகள பணதிி அனகவரி"
},
"rejected": {
"message": "நிகரிகபபடடத"
},
"resetAccount": {
"message": "கணகடம"
},
"restoreFromSeed": {
"message": "விியதிிகவ"
},
"restoreVault": {
"message": "வகவ"
},
"required": {
"message": "தன"
},
"retryWithMoreGas": {
"message": "இங அதிக எரிியறிகவ"
},
"walletSeed": {
"message": "வி"
},
"revealSeedWords": {
"message": "விகளிபடத"
},
"revealSeedWordsWarning": {
"message": "உஙகளிகள ஒர இடதிக வ! உஙகள எல கணககளிட இநத வகள பயனபடதபபடல."
},
"revert": {
"message": "மியம"
},
"rinkeby": {
"message": "ரிய ட"
},
"ropsten": {
"message": "ர"
},
"currentRpc": {
"message": "தறய RPC"
},
"connectingToMainnet": {
"message": "மிய எதி இண"
},
"connectingToRopsten": {
"message": "ரடன இணிறத"
},
"connectingToKovan": {
"message": "கவனடன இணதல"
},
"connectingToRinkeby": {
"message": "ரிய டடன இணிறத"
},
"connectingToUnknown": {
"message": "தித நடன இணிறத"
},
"sampleAccountName": {
"message": "உதரணமக எனதிய கணக",
"description": "தஙகள கணகி மனிதர படிககிய பயர கர பயனரிள உதவகள"
},
"save": {
"message": "சி"
},
"reprice_title": {
"message": "ரி பரிவரதன"
},
"reprice_subtitle": {
"message": "உஙகள பரிவரதனகளயறி அதிகரிக உஙகள எரிி அதிகரிகவ"
},
"saveAsFile": {
"message": "கக சிகவ",
"description": "கணக ஏறமதியல"
},
"saveSeedAsFile": {
"message": "க என விகளிகவ"
},
"search": {
"message": "தடல"
},
"secretPhrase": {
"message": "உஙகளடகதபதறக இங உஙகள ரகசிய பனிரணடர உளிடவ."
},
"newPassword8Chars": {
"message": "பிய கடவ (கதபடசம 8 எழகள)"
},
"seedPhraseReq": {
"message": "விியஙகள 12 வகளடவ"
},
"select": {
"message": "த"
},
"selectCurrency": {
"message": "நணயத"
},
"selectService": {
"message": "சகவ"
},
"selectType": {
"message": "வக"
},
"send": {
"message": "அன"
},
"sendETH": {
"message": "ETH ஐ அன"
},
"sendTokens": {
"message": "டகனகள அனபவ"
},
"onlySendToEtherAddress": {
"message": "ETH ஐ ஒர எதரிகவரி மட அனபவ."
},
"searchTokens": {
"message": "தடலகன"
},
"sendTokensAnywhere": {
"message": "யடனகனகள அனபவ எதி கணக"
},
"settings": {
"message": "அமகள"
},
"info": {
"message": "தகவல"
},
"shapeshiftBuy": {
"message": "Shapeshift உடனகவ"
},
"showPrivateKeys": {
"message": "தனிபடட விகளி"
},
"showQRCode": {
"message": "QR கி"
},
"sign": {
"message": "உள"
},
"signed": {
"message": "கபமிடபபடட"
},
"signMessage": {
"message": "சி பதிக"
},
"signNotice": {
"message": "இநத சிிபமிடல \nஆபதன பகக விகள இரகல. \n உஙகளத கணகிக நமபகிய தளஙகளிிகள மடபமிகள. \n இநத ஆபதன ம எதில பதிி அகறறபபட."
},
"sigRequest": {
"message": "கபமி"
},
"sigRequested": {
"message": "கபமரபபடடத"
},
"spaceBetween": {
"message": "வகள இட இடி மட இரக மி"
},
"status": {
"message": "நி"
},
"stateLogs": {
"message": "மில பதிகள"
},
"stateLogsDescription": {
"message": "மில பதிகள உஙகள கணககவரிகள மற பரிறஙகள அனிளன."
},
"stateLogError": {
"message": "மில பதிகளபதிி."
},
"submit": {
"message": "சமரி"
},
"submitted": {
"message": "சமரிகபபடடத"
},
"supportCenter": {
"message": "எஙகள ஆதரவயதிடவ"
},
"symbolBetweenZeroTen": {
"message": "கி 0 மற 10 எழகள இடி இரக வ."
},
"takesTooLong": {
"message": "நட நரம எடிறத?"
},
"terms": {
"message": "பயனிிகள"
},
"testFaucet": {
"message": "சதன"
},
"to": {
"message": "பநர: "
},
"toETHviaShapeShift": {
"message": "$ 1 மதல ETH வர வடிவம",
"description": "சிடககதி வககளிிரபபபபட"
},
"tokenAddress": {
"message": "டகனகவரி"
},
"tokenAlreadyAdded": {
"message": "டகன ஏறகனவகபபடடத."
},
"tokenBalance": {
"message": "உஙகளகன இர:"
},
"tokenSelection": {
"message": "டகனகள அலலதிரபல டகனகளி படியலிிகவ."
},
"tokenSymbol": {
"message": "டகனினம"
},
"tokenWarning1": {
"message": "உஙகளடமஸ கணகடனகளிய டகனகள கணிகள. வ கணக பயனபடிகனகளிி, அநத டகனகள இங."
},
"total": {
"message": "மத"
},
"transactions": {
"message": "பரிவரதனகள"
},
"transactionError": {
"message": "பரிவரதனி. விி ஒபபநததிிிிலக."
},
"transactionMemo": {
"message": "பரிவரதனி (விபம)"
},
"transactionNumber": {
"message": "பரிவரதன எண"
},
"transfers": {
"message": "இடமறஙகள"
},
"troubleTokenBalances": {
"message": "உஙகளகனிகள ஏறவதிிகல ஏறபடடத. நகள அவரகளக மி.",
"description": "டகனிகளண ஒர இண (இங) தடர"
},
"twelveWords": {
"message": "இநத 12 வகள உஙகள கணகக ஒர வழி. \n அவற எஙவதகவ ரகசியமகவிகவ."
},
"typePassword": {
"message": "உஙகள கடவ தடடசயவ"
},
"uiWelcome": {
"message": "பிய UI (ப) க வரவி"
},
"uiWelcomeMessage": {
"message": "இபகளிய ம UI ஐ பயனபடிகள. சிகள, டகனகள அனிய அமசஙகளயறிகவ, உஙகளிடம ஏதிகல இர எஙகளியபபடதவ."
},
"unapproved": {
"message": "அஙகரிகபபடத"
},
"unavailable": {
"message": "கிகவி"
},
"unknown": {
"message": "தித"
},
"unknownNetwork": {
"message": "அறியபபடத தனி"
},
"unknownNetworkId": {
"message": "தித ந ஐடி"
},
"uriErrorMsg": {
"message": "URI கள சரின HTTP / HTTPS ம."
},
"usaOnly": {
"message": "அமி மட",
"description": "இநத பரிறத பயனபடி அமிி உளளவரகள மட இத வரயறகபபடிறத"
},
"usedByClients": {
"message": "பலிளரகள பல பயனபடிய"
},
"useOldUI": {
"message": "உஸ ஓல உய "
},
"validFileImport": {
"message": "இறகமதிய சரின கக வ."
},
"vaultCreated": {
"message": "வ உரகபபடடத"
},
"viewAccount": {
"message": "கணக"
},
"visitWebSite": {
"message": "எஙகள வலதளதிடவ"
},
"warning": {
"message": "எசசரி"
},
"welcomeBeta": {
"message": "ம வரக"
},
"whatsThis": {
"message": "இத எனன?"
},
"yourSigRequested": {
"message": "உஙகளபமரபபடிறத"
},
"youSign": {
"message": "நகளிிகள"
}
}

@ -21,12 +21,16 @@ const setupMetamaskMeshMetrics = require('./lib/setupMetamaskMeshMetrics')
const EdgeEncryptor = require('./edge-encryptor')
const getFirstPreferredLangCode = require('./lib/get-first-preferred-lang-code')
const getObjStructure = require('./lib/getObjStructure')
const {
ENVIRONMENT_TYPE_POPUP,
ENVIRONMENT_TYPE_NOTIFICATION,
ENVIRONMENT_TYPE_FULLSCREEN,
} = require('./lib/enums')
const STORAGE_KEY = 'metamask-config'
const METAMASK_DEBUG = process.env.METAMASK_DEBUG
window.log = log
log.setDefaultLevel(METAMASK_DEBUG ? 'debug' : 'warn')
log.setDefaultLevel(process.env.METAMASK_DEBUG ? 'debug' : 'warn')
const platform = new ExtensionPlatform()
const notificationManager = new NotificationManager()
@ -44,7 +48,7 @@ const isEdge = !isIE && !!window.StyleMedia
let popupIsOpen = false
let notificationIsOpen = false
let openMetamaskTabsIDs = {}
const openMetamaskTabsIDs = {}
// state persistence
const diskStore = new LocalStorageStore({ storageKey: STORAGE_KEY })
@ -192,30 +196,53 @@ function setupController (initState, initLangCode) {
//
// connect to other contexts
//
extension.runtime.onConnect.addListener(connectRemote)
const metamaskInternalProcessHash = {
[ENVIRONMENT_TYPE_POPUP]: true,
[ENVIRONMENT_TYPE_NOTIFICATION]: true,
[ENVIRONMENT_TYPE_FULLSCREEN]: true,
}
const isClientOpenStatus = () => {
return popupIsOpen || Boolean(Object.keys(openMetamaskTabsIDs).length) || notificationIsOpen
}
function connectRemote (remotePort) {
const isMetaMaskInternalProcess = remotePort.name === 'popup' || remotePort.name === 'notification'
const processName = remotePort.name
const isMetaMaskInternalProcess = metamaskInternalProcessHash[processName]
const portStream = new PortStream(remotePort)
if (isMetaMaskInternalProcess) {
// communication with popup
popupIsOpen = popupIsOpen || (remotePort.name === 'popup')
controller.isClientOpen = true
controller.setupTrustedCommunication(portStream, 'MetaMask')
// record popup as closed
if (remotePort.sender.url.match(/home.html$/)) {
openMetamaskTabsIDs[remotePort.sender.tab.id] = true
}
if (remotePort.name === 'popup') {
if (processName === ENVIRONMENT_TYPE_POPUP) {
popupIsOpen = true
endOfStream(portStream, () => {
popupIsOpen = false
if (remotePort.sender.url.match(/home.html$/)) {
openMetamaskTabsIDs[remotePort.sender.tab.id] = false
}
controller.isClientOpen = isClientOpenStatus()
})
}
if (remotePort.name === 'notification') {
if (processName === ENVIRONMENT_TYPE_NOTIFICATION) {
notificationIsOpen = true
endOfStream(portStream, () => {
notificationIsOpen = false
controller.isClientOpen = isClientOpenStatus()
})
}
if (processName === ENVIRONMENT_TYPE_FULLSCREEN) {
const tabId = remotePort.sender.tab.id
openMetamaskTabsIDs[tabId] = true
endOfStream(portStream, () => {
delete openMetamaskTabsIDs[tabId]
controller.isClientOpen = isClientOpenStatus()
})
}
} else {
@ -258,10 +285,11 @@ function setupController (initState, initLangCode) {
// popup trigger
function triggerUi () {
extension.tabs.query({ active: true }, (tabs) => {
const currentlyActiveMetamaskTab = tabs.find(tab => openMetamaskTabsIDs[tab.id])
if (!popupIsOpen && !currentlyActiveMetamaskTab && !notificationIsOpen) notificationManager.showPopup()
notificationIsOpen = true
extension.tabs.query({ active: true }, tabs => {
const currentlyActiveMetamaskTab = Boolean(tabs.find(tab => openMetamaskTabsIDs[tab.id]))
if (!popupIsOpen && !currentlyActiveMetamaskTab && !notificationIsOpen) {
notificationManager.showPopup()
}
})
}

@ -15,7 +15,41 @@ const BETA_UI_NETWORK_TYPE = 'networkBeta'
global.METAMASK_DEBUG = process.env.METAMASK_DEBUG
module.exports = {
/**
* @typedef {Object} UrlConfig
* @property {string} localhost URL of local RPC provider
* @property {string} mainnet URL of mainnet RPC provider
* @property {string} ropsten URL of Ropsten testnet RPC provider
* @property {string} kovan URL of Kovan testnet RPC provider
* @property {string} rinkeby URL of Rinkeby testnet RPC provider
*/
/**
* @typedef {Object} NameConfig
* @property {string} 3 URL of local RPC provider
* @property {string} 4 URL of mainnet RPC provider
* @property {string} 42 URL of Ropsten testnet RPC provider
*/
/**
* @typedef {Object} EnumConfig
* @property {string} DEFAULT_RPC Default network provider URL
* @property {string} OLD_UI_NETWORK_TYPE Network associated with old UI
* @property {string} BETA_UI_NETWORK_TYPE Network associated with new UI
*/
/**
* @typedef {Object} Config
* @property {UrlConfig} network Network configuration parameters
* @property {UrlConfig} networkBeta Beta UI network configuration parameters
* @property {NameConfig} networkNames Network name configuration parameters
* @property {EnumConfig} enums Application-wide string constants
*/
/**
* @type {Config}
**/
const config = {
network: {
localhost: LOCALHOST_RPC_URL,
mainnet: MAINET_RPC_URL,
@ -23,7 +57,6 @@ module.exports = {
kovan: KOVAN_RPC_URL,
rinkeby: RINKEBY_RPC_URL,
},
// Used for beta UI
networkBeta: {
localhost: LOCALHOST_RPC_URL,
mainnet: MAINET_RPC_URL_BETA,
@ -42,3 +75,5 @@ module.exports = {
BETA_UI_NETWORK_TYPE,
},
}
module.exports = config

@ -23,6 +23,9 @@ if (shouldInjectWeb3()) {
setupStreams()
}
/**
* Creates a script tag that injects inpage.js
*/
function setupInjection () {
try {
// inject in-page script
@ -37,6 +40,10 @@ function setupInjection () {
}
}
/**
* Sets up two-way communication streams between the
* browser extension and local per-page browser context
*/
function setupStreams () {
// setup communication to page and plugin
const pageStream = new LocalMessageDuplexStream({
@ -89,17 +96,34 @@ function setupStreams () {
mux.ignoreStream('publicConfig')
}
/**
* Error handler for page to plugin stream disconnections
*
* @param {string} remoteLabel Remote stream name
* @param {Error} err Stream connection error
*/
function logStreamDisconnectWarning (remoteLabel, err) {
let warningMsg = `MetamaskContentscript - lost connection to ${remoteLabel}`
if (err) warningMsg += '\n' + err.stack
console.warn(warningMsg)
}
/**
* Determines if Web3 should be injected
*
* @returns {boolean} {@code true} if Web3 should be injected
*/
function shouldInjectWeb3 () {
return doctypeCheck() && suffixCheck()
&& documentElementCheck() && !blacklistedDomainCheck()
}
/**
* Checks the doctype of the current document if it exists
*
* @returns {boolean} {@code true} if the doctype is html or if none exists
*/
function doctypeCheck () {
const doctype = window.document.doctype
if (doctype) {
@ -109,6 +133,11 @@ function doctypeCheck () {
}
}
/**
* Checks the current document extension
*
* @returns {boolean} {@code true} if the current extension is not prohibited
*/
function suffixCheck () {
var prohibitedTypes = ['xml', 'pdf']
var currentUrl = window.location.href
@ -122,6 +151,11 @@ function suffixCheck () {
return true
}
/**
* Checks the documentElement of the current document
*
* @returns {boolean} {@code true} if the documentElement is an html node or if none exists
*/
function documentElementCheck () {
var documentElement = document.documentElement.nodeName
if (documentElement) {
@ -130,6 +164,11 @@ function documentElementCheck () {
return true
}
/**
* Checks if the current domain is blacklisted
*
* @returns {boolean} {@code true} if the current domain is blacklisted
*/
function blacklistedDomainCheck () {
var blacklistedDomains = [
'uscourts.gov',
@ -148,6 +187,9 @@ function blacklistedDomainCheck () {
return false
}
/**
* Redirects the current page to a phishing information page
*/
function redirectToPhishingWarning () {
console.log('MetaMask - redirecting to phishing warning')
window.location.href = 'https://metamask.io/phishing.html'

@ -4,9 +4,22 @@ const extend = require('xtend')
class AddressBookController {
// Controller in charge of managing the address book functionality from the
// recipients field on the send screen. Manages a history of all saved
// addresses and all currently owned addresses.
/**
* Controller in charge of managing the address book functionality from the
* recipients field on the send screen. Manages a history of all saved
* addresses and all currently owned addresses.
*
* @typedef {Object} AddressBookController
* @param {object} opts Overrides the defaults for the initial state of this.store
* @property {array} opts.initState initializes the the state of the AddressBookController. Can contain an
* addressBook property to initialize the addressBook array
* @param {KeyringController} keyringController (Soon to be deprecated) The keyringController used in the current
* MetamaskController. Contains the identities used in this AddressBookController.
* @property {object} store The the store of the current users address book
* @property {array} store.addressBook An array of addresses and nicknames. These are set by the user when sending
* to a new address.
*
*/
constructor (opts = {}, keyringController) {
const initState = extend({
addressBook: [],
@ -19,7 +32,14 @@ class AddressBookController {
// PUBLIC METHODS
//
// Sets a new address book in store by accepting a new address and nickname.
/**
* Sets a new address book in store by accepting a new address and nickname.
*
* @param {string} address A hex address of a new account that the user is sending to.
* @param {string} name The name the user wishes to associate with the new account
* @returns {Promise<void>} Promise resolves with undefined
*
*/
setAddressBook (address, name) {
return this._addToAddressBook(address, name)
.then((addressBook) => {
@ -30,14 +50,16 @@ class AddressBookController {
})
}
//
// PRIVATE METHODS
//
// Performs the logic to add the address and name into the address book. The
// pushed object is an object of two fields. Current behavior does not set an
// upper limit to the number of addresses.
/**
* Performs the logic to add the address and name into the address book. The pushed object is an object of two
* fields. Current behavior does not set an upper limit to the number of addresses.
*
* @private
* @param {string} address A hex address of a new account that the user is sending to.
* @param {string} name The name the user wishes to associate with the new account
* @returns {Promise<array>} Promises the updated addressBook array
*
*/
_addToAddressBook (address, name) {
const addressBook = this._getAddressBook()
const identities = this._getIdentities()
@ -62,14 +84,26 @@ class AddressBookController {
return Promise.resolve(addressBook)
}
// Internal method to get the address book. Current persistence behavior
// should not require that this method be called from the UI directly.
/**
* Internal method to get the address book. Current persistence behavior should not require that this method be
* called from the UI directly.
*
* @private
* @returns {array} The addressBook array from the store.
*
*/
_getAddressBook () {
return this.store.getState().addressBook
}
// Retrieves identities from the keyring controller in order to avoid
// duplication
/**
* Retrieves identities from the keyring controller in order to avoid
* duplication
*
* @deprecated
* @returns {array} Returns the identies array from the keyringContoller's state
*
*/
_getIdentities () {
return this.keyringController.memStore.getState().identities
}

@ -1,6 +1,7 @@
const ObservableStore = require('obs-store')
const extend = require('xtend')
const PhishingDetector = require('eth-phishing-detect/src/detector')
const log = require('loglevel')
// compute phishing lists
const PHISHING_DETECTION_CONFIG = require('eth-phishing-detect/src/config.json')

@ -2,8 +2,24 @@ const ObservableStore = require('obs-store')
const extend = require('xtend')
const BalanceController = require('./balance')
class ComputedbalancesController {
/**
* @typedef {Object} ComputedBalancesOptions
* @property {Object} accountTracker Account tracker store reference
* @property {Object} txController Token controller reference
* @property {Object} blockTracker Block tracker reference
* @property {Object} initState Initial state to populate this internal store with
*/
/**
* Background controller responsible for syncing
* and computing ETH balances for all accounts
*/
class ComputedbalancesController {
/**
* Creates a new controller instance
*
* @param {ComputedBalancesOptions} [opts] Controller configuration parameters
*/
constructor (opts = {}) {
const { accountTracker, txController, blockTracker } = opts
this.accountTracker = accountTracker
@ -19,6 +35,9 @@ class ComputedbalancesController {
this._initBalanceUpdating()
}
/**
* Updates balances associated with each internal address
*/
updateAllBalances () {
Object.keys(this.balances).forEach((balance) => {
const address = balance.address
@ -26,12 +45,23 @@ class ComputedbalancesController {
})
}
/**
* Initializes internal address tracking
*
* @private
*/
_initBalanceUpdating () {
const store = this.accountTracker.store.getState()
this.syncAllAccountsFromStore(store)
this.accountTracker.store.subscribe(this.syncAllAccountsFromStore.bind(this))
}
/**
* Uses current account state to sync and track all
* addresses associated with the current account
*
* @param {{ accounts: Object }} store Account tracking state
*/
syncAllAccountsFromStore (store) {
const upstream = Object.keys(store.accounts)
const balances = Object.keys(this.balances)
@ -50,6 +80,13 @@ class ComputedbalancesController {
})
}
/**
* Conditionally establishes a new subscription
* to track an address associated with the current
* account
*
* @param {string} address Address to conditionally subscribe to
*/
trackAddressIfNotAlready (address) {
const state = this.store.getState()
if (!(address in state.computedBalances)) {
@ -57,6 +94,12 @@ class ComputedbalancesController {
}
}
/**
* Establishes a new subscription to track an
* address associated with the current account
*
* @param {string} address Address to conditionally subscribe to
*/
trackAddress (address) {
const updater = new BalanceController({
address,

@ -1,11 +1,28 @@
const ObservableStore = require('obs-store')
const extend = require('xtend')
const log = require('loglevel')
// every ten minutes
const POLLING_INTERVAL = 600000
class CurrencyController {
/**
* Controller responsible for managing data associated with the currently selected currency.
*
* @typedef {Object} CurrencyController
* @param {object} opts Overrides the defaults for the initial state of this.store
* @property {array} opts.initState initializes the the state of the CurrencyController. Can contain an
* currentCurrency, conversionRate and conversionDate properties
* @property {string} currentCurrency A 2-4 character shorthand that describes a specific currency, currently
* selected by the user
* @property {number} conversionRate The conversion rate from ETH to the selected currency.
* @property {string} conversionDate The date at which the conversion rate was set. Expressed in in milliseconds
* since midnight of January 1, 1970
* @property {number} conversionInterval The id of the interval created by the scheduleConversionInterval method.
* Used to clear an existing interval on subsequent calls of that method.
*
*/
constructor (opts = {}) {
const initState = extend({
currentCurrency: 'usd',
@ -19,30 +36,73 @@ class CurrencyController {
// PUBLIC METHODS
//
/**
* A getter for the currentCurrency property
*
* @returns {string} A 2-4 character shorthand that describes a specific currency, currently selected by the user
*
*/
getCurrentCurrency () {
return this.store.getState().currentCurrency
}
/**
* A setter for the currentCurrency property
*
* @param {string} currentCurrency The new currency to set as the currentCurrency in the store
*
*/
setCurrentCurrency (currentCurrency) {
this.store.updateState({ currentCurrency })
}
/**
* A getter for the conversionRate property
*
* @returns {string} The conversion rate from ETH to the selected currency.
*
*/
getConversionRate () {
return this.store.getState().conversionRate
}
/**
* A setter for the conversionRate property
*
* @param {number} conversionRate The new rate to set as the conversionRate in the store
*
*/
setConversionRate (conversionRate) {
this.store.updateState({ conversionRate })
}
/**
* A getter for the conversionDate property
*
* @returns {string} The date at which the conversion rate was set. Expressed in milliseconds since midnight of
* January 1, 1970
*
*/
getConversionDate () {
return this.store.getState().conversionDate
}
/**
* A setter for the conversionDate property
*
* @param {number} conversionDate The date, expressed in milliseconds since midnight of January 1, 1970, that the
* conversionRate was set
*
*/
setConversionDate (conversionDate) {
this.store.updateState({ conversionDate })
}
/**
* Updates the conversionRate and conversionDate properties associated with the currentCurrency. Updated info is
* fetched from an external API
*
*/
async updateConversionRate () {
let currentCurrency
try {
@ -58,6 +118,12 @@ class CurrencyController {
}
}
/**
* Creates a new poll, using setInterval, to periodically call updateConversionRate. The id of the interval is
* stored at the controller's conversionInterval property. If it is called and such an id already exists, the
* previous interval is clear and a new one is created.
*
*/
scheduleConversionInterval () {
if (this.conversionInterval) {
clearInterval(this.conversionInterval)

@ -1,5 +1,6 @@
const ObservableStore = require('obs-store')
const extend = require('xtend')
const log = require('loglevel')
// every ten minutes
const POLLING_INTERVAL = 10 * 60 * 1000

@ -9,6 +9,7 @@ const extend = require('xtend')
const EthQuery = require('eth-query')
const createEventEmitterProxy = require('../lib/events-proxy.js')
const networkConfig = require('../config.js')
const log = require('loglevel')
const { OLD_UI_NETWORK_TYPE, DEFAULT_RPC } = networkConfig.enums
const INFURA_PROVIDER_TYPES = ['ropsten', 'rinkeby', 'kovan', 'mainnet']

@ -4,6 +4,21 @@ const extend = require('xtend')
class PreferencesController {
/**
*
* @typedef {Object} PreferencesController
* @param {object} opts Overrides the defaults for the initial state of this.store
* @property {object} store The an object containing a users preferences, stored in local storage
* @property {array} store.frequentRpcList A list of custom rpcs to provide the user
* @property {string} store.currentAccountTab Indicates the selected tab in the ui
* @property {array} store.tokens The tokens the user wants display in their token lists
* @property {boolean} store.useBlockie The users preference for blockie identicons within the UI
* @property {object} store.featureFlags A key-boolean map, where keys refer to features and booleans to whether the
* user wishes to see that feature
* @property {string} store.currentLocale The preferred language locale key
* @property {string} store.selectedAddress A hex string that matches the currently selected address in the app
*
*/
constructor (opts = {}) {
const initState = extend({
frequentRpcList: [],
@ -17,18 +32,43 @@ class PreferencesController {
}
// PUBLIC METHODS
/**
* Setter for the `useBlockie` property
*
* @param {boolean} val Whether or not the user prefers blockie indicators
*
*/
setUseBlockie (val) {
this.store.updateState({ useBlockie: val })
}
/**
* Getter for the `useBlockie` property
*
* @returns {boolean} this.store.useBlockie
*
*/
getUseBlockie () {
return this.store.getState().useBlockie
}
/**
* Setter for the `currentLocale` property
*
* @param {string} key he preferred language locale key
*
*/
setCurrentLocale (key) {
this.store.updateState({ currentLocale: key })
}
/**
* Setter for the `selectedAddress` property
*
* @param {string} _address A new hex address for an account
* @returns {Promise<void>} Promise resolves with undefined
*
*/
setSelectedAddress (_address) {
return new Promise((resolve, reject) => {
const address = normalizeAddress(_address)
@ -37,10 +77,37 @@ class PreferencesController {
})
}
/**
* Getter for the `selectedAddress` property
*
* @returns {string} The hex address for the currently selected account
*
*/
getSelectedAddress () {
return this.store.getState().selectedAddress
}
/**
* Contains data about tokens users add to their account.
* @typedef {Object} AddedToken
* @property {string} address - The hex address for the token contract. Will be all lower cased and hex-prefixed.
* @property {string} symbol - The symbol of the token, usually 3 or 4 capitalized letters
* {@link https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20.md#symbol}
* @property {boolean} decimals - The number of decimals the token uses.
* {@link https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20.md#decimals}
*/
/**
* Adds a new token to the token array, or updates the token if passed an address that already exists.
* Modifies the existing tokens array from the store. All objects in the tokens array array AddedToken objects.
* @see AddedToken {@link AddedToken}
*
* @param {string} rawAddress Hex address of the token contract. May or may not be a checksum address.
* @param {string} symbol The symbol of the token
* @param {number} decimals The number of decimals the token uses.
* @returns {Promise<array>} Promises the new array of AddedToken objects.
*
*/
async addToken (rawAddress, symbol, decimals) {
const address = normalizeAddress(rawAddress)
const newEntry = { address, symbol, decimals }
@ -62,6 +129,13 @@ class PreferencesController {
return Promise.resolve(tokens)
}
/**
* Removes a specified token from the tokens array.
*
* @param {string} rawAddress Hex address of the token contract to remove.
* @returns {Promise<array>} The new array of AddedToken objects
*
*/
removeToken (rawAddress) {
const tokens = this.store.getState().tokens
@ -71,10 +145,23 @@ class PreferencesController {
return Promise.resolve(updatedTokens)
}
/**
* A getter for the `tokens` property
*
* @returns {array} The current array of AddedToken objects
*
*/
getTokens () {
return this.store.getState().tokens
}
/**
* Gets an updated rpc list from this.addToFrequentRpcList() and sets the `frequentRpcList` to this update list.
*
* @param {string} _url The the new rpc url to add to the updated list
* @returns {Promise<void>} Promise resolves with undefined
*
*/
updateFrequentRpcList (_url) {
return this.addToFrequentRpcList(_url)
.then((rpcList) => {
@ -83,6 +170,13 @@ class PreferencesController {
})
}
/**
* Setter for the `currentAccountTab` property
*
* @param {string} currentAccountTab Specifies the new tab to be marked as current
* @returns {Promise<void>} Promise resolves with undefined
*
*/
setCurrentAccountTab (currentAccountTab) {
return new Promise((resolve, reject) => {
this.store.updateState({ currentAccountTab })
@ -90,6 +184,15 @@ class PreferencesController {
})
}
/**
* Returns an updated rpcList based on the passed url and the current list.
* The returned list will have a max length of 2. If the _url currently exists it the list, it will be moved to the
* end of the list. The current list is modified and returned as a promise.
*
* @param {string} _url The rpc url to add to the frequentRpcList.
* @returns {Promise<array>} The updated frequentRpcList.
*
*/
addToFrequentRpcList (_url) {
const rpcList = this.getFrequentRpcList()
const index = rpcList.findIndex((element) => { return element === _url })
@ -105,10 +208,24 @@ class PreferencesController {
return Promise.resolve(rpcList)
}
/**
* Getter for the `frequentRpcList` property.
*
* @returns {array<string>} An array of one or two rpc urls.
*
*/
getFrequentRpcList () {
return this.store.getState().frequentRpcList
}
/**
* Updates the `featureFlags` property, which is an object. One property within that object will be set to a boolean.
*
* @param {string} feature A key that corresponds to a UI feature.
* @param {boolean} activated Indicates whether or not the UI feature should be displayed
* @returns {Promise<object>} Promises a new object; the updated featureFlags object.
*
*/
setFeatureFlag (feature, activated) {
const currentFeatureFlags = this.store.getState().featureFlags
const updatedFeatureFlags = {
@ -121,6 +238,13 @@ class PreferencesController {
return Promise.resolve(updatedFeatureFlags)
}
/**
* A getter for the `featureFlags` property
*
* @returns {object} A key-boolean map, where keys refer to features and booleans to whether the
* user wishes to see that feature
*
*/
getFeatureFlags () {
return this.store.getState().featureFlags
}

@ -2,6 +2,7 @@ const ObservableStore = require('obs-store')
const extend = require('xtend')
const BN = require('ethereumjs-util').BN
const EthQuery = require('eth-query')
const log = require('loglevel')
class RecentBlocksController {

@ -1,11 +1,23 @@
const ObservableStore = require('obs-store')
const extend = require('xtend')
const log = require('loglevel')
// every three seconds when an incomplete tx is waiting
const POLLING_INTERVAL = 3000
class ShapeshiftController {
/**
* Controller responsible for managing the list of shapeshift transactions. On construction, it initiates a poll
* that queries a shapeshift.io API for updates to any pending shapeshift transactions
*
* @typedef {Object} ShapeshiftController
* @param {object} opts Overrides the defaults for the initial state of this.store
* @property {array} opts.initState initializes the the state of the ShapeshiftController. Can contain an
* shapeShiftTxList array.
* @property {array} shapeShiftTxList An array of ShapeShiftTx objects
*
*/
constructor (opts = {}) {
const initState = extend({
shapeShiftTxList: [],
@ -14,21 +26,54 @@ class ShapeshiftController {
this.pollForUpdates()
}
/**
* Represents, and contains data about, a single shapeshift transaction.
* @typedef {Object} ShapeShiftTx
* @property {string} depositAddress - An address at which to send a crypto deposit, so that eth can be sent to the
* user's Metamask account
* @property {string} depositType - An abbreviation of the type of crypto currency to be deposited.
* @property {string} key - The 'shapeshift' key differentiates this from other types of txs in Metamask
* @property {number} time - The time at which the tx was created
* @property {object} response - Initiated as an empty object, which will be replaced by a Response object. @see {@link
* https://developer.mozilla.org/en-US/docs/Web/API/Response}
*/
//
// PUBLIC METHODS
//
/**
* A getter for the shapeShiftTxList property
*
* @returns {array<ShapeShiftTx>}
*
*/
getShapeShiftTxList () {
const shapeShiftTxList = this.store.getState().shapeShiftTxList
return shapeShiftTxList
}
/**
* A getter for all ShapeShiftTx in the shapeShiftTxList that have not successfully completed a deposit.
*
* @returns {array<ShapeShiftTx>} Only includes ShapeShiftTx which has a response property with a status !== complete
*
*/
getPendingTxs () {
const txs = this.getShapeShiftTxList()
const pending = txs.filter(tx => tx.response && tx.response.status !== 'complete')
return pending
}
/**
* A poll that exists as long as there are pending transactions. Each call attempts to update the data of any
* pendingTxs, and then calls itself again. If there are no pending txs, the recursive call is not made and
* the polling stops.
*
* this.updateTx is used to attempt the update to the pendingTxs in the ShapeShiftTxList, and that updated data
* is saved with saveTx.
*
*/
pollForUpdates () {
const pendingTxs = this.getPendingTxs()
@ -45,6 +90,15 @@ class ShapeshiftController {
})
}
/**
* Attempts to update a ShapeShiftTx with data from a shapeshift.io API. Both the response and time properties
* can be updated. The response property is updated with every call, but the time property is only updated when
* the response status updates to 'complete'. This will occur once the user makes a deposit as the ShapeShiftTx
* depositAddress
*
* @param {ShapeShiftTx} tx The tx to update
*
*/
async updateTx (tx) {
try {
const url = `https://shapeshift.io/txStat/${tx.depositAddress}`
@ -60,6 +114,13 @@ class ShapeshiftController {
}
}
/**
* Saves an updated to a ShapeShiftTx in the shapeShiftTxList. If the passed ShapeShiftTx is not in the
* shapeShiftTxList, nothing happens.
*
* @param {ShapeShiftTx} tx The updated tx to save, if it exists in the current shapeShiftTxList
*
*/
saveTx (tx) {
const { shapeShiftTxList } = this.store.getState()
const index = shapeShiftTxList.indexOf(tx)
@ -69,6 +130,12 @@ class ShapeshiftController {
}
}
/**
* Removes a ShapeShiftTx from the shapeShiftTxList
*
* @param {ShapeShiftTx} tx The tx to remove
*
*/
removeShapeShiftTx (tx) {
const { shapeShiftTxList } = this.store.getState()
const index = shapeShiftTxList.indexOf(index)
@ -78,6 +145,14 @@ class ShapeshiftController {
this.updateState({ shapeShiftTxList })
}
/**
* Creates a new ShapeShiftTx, adds it to the shapeShiftTxList, and initiates a new poll for updates of pending txs
*
* @param {string} depositAddress - An address at which to send a crypto deposit, so that eth can be sent to the
* user's Metamask account
* @param {string} depositType - An abbreviation of the type of crypto currency to be deposited.
*
*/
createShapeShiftTx (depositAddress, depositType) {
const state = this.store.getState()
let { shapeShiftTxList } = state

@ -0,0 +1,77 @@
const ObservableStore = require('obs-store')
// By default, poll every 3 minutes
const DEFAULT_INTERVAL = 180 * 1000
/**
* A controller that polls for token exchange
* rates based on a user's current token list
*/
class TokenRatesController {
/**
* Creates a TokenRatesController
*
* @param {Object} [config] - Options to configure controller
*/
constructor ({ interval = DEFAULT_INTERVAL, preferences } = {}) {
this.store = new ObservableStore()
this.preferences = preferences
this.interval = interval
}
/**
* Updates exchange rates for all tokens
*/
async updateExchangeRates () {
if (!this.isActive) { return }
const contractExchangeRates = {}
for (const i in this._tokens) {
const address = this._tokens[i].address
contractExchangeRates[address] = await this.fetchExchangeRate(address)
}
this.store.putState({ contractExchangeRates })
}
/**
* Fetches a token exchange rate by address
*
* @param {String} address - Token contract address
*/
async fetchExchangeRate (address) {
try {
const response = await fetch(`https://exchanges.balanc3.net/prices?from=${address}&to=ETH&autoConversion=false&summaryOnly=true`)
const json = await response.json()
return json && json.length ? json[0].averagePrice : 0
} catch (error) { }
}
/**
* @type {Number}
*/
set interval (interval) {
this._handle && clearInterval(this._handle)
if (!interval) { return }
this._handle = setInterval(() => { this.updateExchangeRates() }, interval)
}
/**
* @type {Object}
*/
set preferences (preferences) {
this._preferences && this._preferences.unsubscribe()
if (!preferences) { return }
this._preferences = preferences
this.tokens = preferences.getState().tokens
preferences.subscribe(({ tokens = [] }) => { this.tokens = tokens })
}
/**
* @type {Array}
*/
set tokens (tokens) {
this._tokens = tokens
this.updateExchangeRates()
}
}
module.exports = TokenRatesController

@ -7,6 +7,7 @@ const TransactionStateManager = require('../lib/tx-state-manager')
const TxGasUtil = require('../lib/tx-gas-utils')
const PendingTransactionTracker = require('../lib/pending-tx-tracker')
const NonceTracker = require('../lib/nonce-tracker')
const log = require('loglevel')
/*
Transaction Controller is an aggregate of sub-controllers and trackers

@ -1,14 +1,22 @@
const asmcrypto = require('asmcrypto.js')
const Unibabel = require('browserify-unibabel')
/**
* A Microsoft Edge-specific encryption class that exposes
* the interface expected by eth-keykeyring-controller
*/
class EdgeEncryptor {
/**
* Encrypts an arbitrary object to ciphertext
*
* @param {string} password Used to generate a key to encrypt the data
* @param {Object} dataObject Data to encrypt
* @returns {Promise<string>} Promise resolving to an object with ciphertext
*/
encrypt (password, dataObject) {
var salt = this._generateSalt()
return this._keyFromPassword(password, salt)
.then(function (key) {
var data = JSON.stringify(dataObject)
var dataBuffer = Unibabel.utf8ToBuffer(data)
var vector = global.crypto.getRandomValues(new Uint8Array(16))
@ -25,8 +33,14 @@ class EdgeEncryptor {
})
}
/**
* Decrypts an arbitrary object from ciphertext
*
* @param {string} password Used to generate a key to decrypt the data
* @param {string} text Ciphertext of an encrypted object
* @returns {Promise<Object>} Promise resolving to copy of decrypted object
*/
decrypt (password, text) {
const payload = JSON.parse(text)
const salt = payload.salt
return this._keyFromPassword(password, salt)
@ -48,6 +62,14 @@ class EdgeEncryptor {
})
}
/**
* Retrieves a cryptographic key using a password
*
* @private
* @param {string} password Password used to unlock a cryptographic key
* @param {string} salt Random base64 data
* @returns {Promise<Object>} Promise resolving to a derived key
*/
_keyFromPassword (password, salt) {
var passBuffer = Unibabel.utf8ToBuffer(password)
@ -58,6 +80,12 @@ class EdgeEncryptor {
})
}
/**
* Generates random base64 encoded data
*
* @private
* @returns {string} Randomized base64 encoded data
*/
_generateSalt (byteCount = 32) {
var view = new Uint8Array(byteCount)
global.crypto.getRandomValues(view)

@ -2,10 +2,16 @@
const env = process.env.METAMASK_ENV
const METAMASK_DEBUG = process.env.METAMASK_DEBUG
//
// The default state of MetaMask
//
module.exports = {
/**
* @typedef {Object} FirstTimeState
* @property {Object} config Initial configuration parameters
* @property {Object} NetworkController Network controller state
*/
/**
* @type {FirstTimeState}
*/
const initialState = {
config: {},
NetworkController: {
provider: {
@ -13,3 +19,5 @@ module.exports = {
},
},
}
module.exports = initialState

@ -3,16 +3,11 @@ cleanContextForImports()
require('web3/dist/web3.min.js')
const log = require('loglevel')
const LocalMessageDuplexStream = require('post-message-stream')
// const PingStream = require('ping-pong-stream/ping')
// const endOfStream = require('end-of-stream')
const setupDappAutoReload = require('./lib/auto-reload.js')
const MetamaskInpageProvider = require('./lib/inpage-provider.js')
restoreContextAfterImports()
const METAMASK_DEBUG = process.env.METAMASK_DEBUG
window.log = log
log.setDefaultLevel(METAMASK_DEBUG ? 'debug' : 'warn')
log.setDefaultLevel(process.env.METAMASK_DEBUG ? 'debug' : 'warn')
//
// setup plugin communication
@ -47,20 +42,20 @@ log.debug('MetaMask - injected web3')
setupDappAutoReload(web3, inpageProvider.publicConfigStore)
// set web3 defaultAccount
inpageProvider.publicConfigStore.subscribe(function (state) {
web3.eth.defaultAccount = state.selectedAddress
})
//
// util
//
// need to make sure we aren't affected by overlapping namespaces
// and that we dont affect the app with our namespace
// mostly a fix for web3's BigNumber if AMD's "define" is defined...
var __define
/**
* Caches reference to global define object and deletes it to
* avoid conflicts with other global define objects, such as
* AMD's define function
*/
function cleanContextForImports () {
__define = global.define
try {
@ -70,6 +65,9 @@ function cleanContextForImports () {
}
}
/**
* Restores global define object from cached reference
*/
function restoreContextAfterImports () {
try {
global.define = __define

@ -0,0 +1,49 @@
const ObservableStore = require('obs-store')
/**
* An ObservableStore that can composes a flat
* structure of child stores based on configuration
*/
class ComposableObservableStore extends ObservableStore {
/**
* Create a new store
*
* @param {Object} [initState] - The initial store state
* @param {Object} [config] - Map of internal state keys to child stores
*/
constructor (initState, config) {
super(initState)
this.updateStructure(config)
}
/**
* Composes a new internal store subscription structure
*
* @param {Object} [config] - Map of internal state keys to child stores
*/
updateStructure (config) {
this.config = config
this.removeAllListeners()
for (const key in config) {
config[key].subscribe((state) => {
this.updateState({ [key]: state })
})
}
}
/**
* Merges all child store state into a single object rather than
* returning an object keyed by child store class name
*
* @returns {Object} - Object containing merged child store state
*/
getFlatState () {
let flatState = {}
for (const key in this.config) {
flatState = { ...flatState, ...this.config[key].getState() }
}
return flatState
}
}
module.exports = ComposableObservableStore

@ -1,5 +1,16 @@
module.exports = getBuyEthUrl
/**
* Gives the caller a url at which the user can acquire eth, depending on the network they are in
*
* @param {object} opts Options required to determine the correct url
* @param {string} opts.network The network for which to return a url
* @param {string} opts.amount The amount of ETH to buy on coinbase. Only relevant if network === '1'.
* @param {string} opts.address The address the bought ETH should be sent to. Only relevant if network === '1'.
* @returns {string|undefined} The url at which the user can access ETH, while in the given network. If the passed
* network does not match any of the specified cases, or if no network is given, returns undefined.
*
*/
function getBuyEthUrl ({ network, amount, address }) {
let url
switch (network) {

@ -102,7 +102,6 @@ ConfigManager.prototype.setShowSeedWords = function (should) {
this.setData(data)
}
ConfigManager.prototype.getShouldShowSeedWords = function () {
var data = this.getData()
return data.showSeedWords
@ -118,6 +117,27 @@ ConfigManager.prototype.getSeedWords = function () {
var data = this.getData()
return data.seedWords
}
/**
* Called to set the isRevealingSeedWords flag. This happens only when the user chooses to reveal
* the seed words and not during the first time flow.
* @param {boolean} reveal - Value to set the isRevealingSeedWords flag.
*/
ConfigManager.prototype.setIsRevealingSeedWords = function (reveal = false) {
const data = this.getData()
data.isRevealingSeedWords = reveal
this.setData(data)
}
/**
* Returns the isRevealingSeedWords flag.
* @returns {boolean|undefined}
*/
ConfigManager.prototype.getIsRevealingSeedWords = function () {
const data = this.getData()
return data.isRevealingSeedWords
}
ConfigManager.prototype.setRpcTarget = function (rpcUrl) {
var config = this.getConfig()
config.provider = {

@ -1,14 +1,20 @@
// log rpc activity
const log = require('loglevel')
module.exports = createLoggerMiddleware
function createLoggerMiddleware ({ origin }) {
return function loggerMiddleware (req, res, next, end) {
next((cb) => {
/**
* Returns a middleware that logs RPC activity
* @param {{ origin: string }} opts - The middleware options
* @returns {Function}
*/
function createLoggerMiddleware (opts) {
return function loggerMiddleware (/** @type {any} */ req, /** @type {any} */ res, /** @type {Function} */ next) {
next((/** @type {Function} */ cb) => {
if (res.error) {
log.error('Error in RPC response:\n', res)
}
if (req.isMetamaskInternal) return
log.info(`RPC (${origin}):`, req, '->', res)
log.info(`RPC (${opts.origin}):`, req, '->', res)
cb()
})
}

@ -1,9 +1,13 @@
// append dapp origin domain to request
module.exports = createOriginMiddleware
function createOriginMiddleware ({ origin }) {
return function originMiddleware (req, res, next, end) {
req.origin = origin
/**
* Returns a middleware that appends the DApp origin to request
* @param {{ origin: string }} opts - The middleware options
* @returns {Function}
*/
function createOriginMiddleware (opts) {
return function originMiddleware (/** @type {any} */ req, /** @type {any} */ _, /** @type {Function} */ next) {
req.origin = opts.origin
next()
}
}

@ -1,6 +1,10 @@
module.exports = createProviderMiddleware
// forward requests to provider
/**
* Forwards an HTTP request to the current Web3 provider
*
* @param {{ provider: Object }} config Configuration containing current Web3 provider
*/
function createProviderMiddleware ({ provider }) {
return (req, res, next, end) => {
provider.sendAsync(req, (err, _res) => {

@ -0,0 +1,9 @@
const ENVIRONMENT_TYPE_POPUP = 'popup'
const ENVIRONMENT_TYPE_NOTIFICATION = 'notification'
const ENVIRONMENT_TYPE_FULLSCREEN = 'fullscreen'
module.exports = {
ENVIRONMENT_TYPE_POPUP,
ENVIRONMENT_TYPE_NOTIFICATION,
ENVIRONMENT_TYPE_FULLSCREEN,
}

@ -1,10 +0,0 @@
module.exports = function environmentType () {
const url = window.location.href
if (url.match(/popup.html$/)) {
return 'popup'
} else if (url.match(/home.html$/)) {
return 'responsive'
} else {
return 'notification'
}
}

@ -1,26 +1,37 @@
/**
* Returns an EventEmitter that proxies events from the given event emitter
* @param {any} eventEmitter
* @param {object} listeners - The listeners to proxy to
* @returns {any}
*/
module.exports = function createEventEmitterProxy (eventEmitter, listeners) {
let target = eventEmitter
const eventHandlers = listeners || {}
const proxy = new Proxy({}, {
get: (obj, name) => {
const proxy = /** @type {any} */ (new Proxy({}, {
get: (_, name) => {
// intercept listeners
if (name === 'on') return addListener
if (name === 'setTarget') return setTarget
if (name === 'proxyEventHandlers') return eventHandlers
return target[name]
return (/** @type {any} */ (target))[name]
},
set: (obj, name, value) => {
set: (_, name, value) => {
target[name] = value
return true
},
})
function setTarget (eventEmitter) {
}))
function setTarget (/** @type {EventEmitter} */ eventEmitter) {
target = eventEmitter
// migrate listeners
Object.keys(eventHandlers).forEach((name) => {
eventHandlers[name].forEach((handler) => target.on(name, handler))
/** @type {Array<Function>} */ (eventHandlers[name]).forEach((handler) => target.on(name, handler))
})
}
/**
* Attaches a function to be called whenever the specified event is emitted
* @param {string} name
* @param {Function} handler
*/
function addListener (name, handler) {
if (!eventHandlers[name]) eventHandlers[name] = []
eventHandlers[name].push(handler)

@ -4,6 +4,13 @@ const allLocales = require('../../_locales/index.json')
const existingLocaleCodes = allLocales.map(locale => locale.code.toLowerCase().replace('_', '-'))
/**
* Returns a preferred language code, based on settings within the user's browser. If we have no translations for the
* users preferred locales, 'en' is returned.
*
* @returns {Promise<string>} Promises a locale code, either one from the user's preferred list that we have a translation for, or 'en'
*
*/
async function getFirstPreferredLangCode () {
const userPreferredLocaleCodes = await promisify(
extension.i18n.getAcceptLanguages,

@ -1,6 +1,11 @@
const ethUtil = require('ethereumjs-util')
const ethUtil = (/** @type {object} */ (require('ethereumjs-util')))
const BN = ethUtil.BN
/**
* Returns a [BinaryNumber]{@link BN} representation of the given hex value
* @param {string} hex
* @return {any}
*/
module.exports = function hexToBn (hex) {
return new BN(ethUtil.stripHexPrefix(hex), 16)
}

@ -1,12 +0,0 @@
module.exports = function isPopupOrNotification () {
const url = window.location.href
// if (url.match(/popup.html$/) || url.match(/home.html$/)) {
// Below regexes needed for feature toggles (e.g. see line ~340 in ui/app/app.js)
// Revert below regexes to above commented out regexes before merge to master
if (url.match(/popup.html(?:\?.+)*$/) ||
url.match(/home.html(?:\?.+)*$/) || url.match(/home.html(?:#.*)*$/)) {
return 'popup'
} else {
return 'notification'
}
}

@ -1,10 +1,13 @@
// We should not rely on local storage in an extension!
// We should use this instead!
// https://developer.mozilla.org/en-US/Add-ons/WebExtensions/API/storage/local
const extension = require('extensionizer')
const log = require('loglevel')
/**
* A wrapper around the extension's storage local API
*/
module.exports = class ExtensionStore {
/**
* @constructor
*/
constructor() {
this.isSupported = !!(extension.storage.local)
if (!this.isSupported) {
@ -12,6 +15,10 @@ module.exports = class ExtensionStore {
}
}
/**
* Returns all of the keys currently saved
* @return {Promise<*>}
*/
async get() {
if (!this.isSupported) return undefined
const result = await this._get()
@ -24,14 +31,24 @@ module.exports = class ExtensionStore {
}
}
/**
* Sets the key in local state
* @param {object} state - The state to set
* @return {Promise<void>}
*/
async set(state) {
return this._set(state)
}
/**
* Returns all of the keys currently saved
* @private
* @return {object} the key-value map from local storage
*/
_get() {
const local = extension.storage.local
return new Promise((resolve, reject) => {
local.get(null, (result) => {
local.get(null, (/** @type {any} */ result) => {
const err = extension.runtime.lastError
if (err) {
reject(err)
@ -42,6 +59,12 @@ module.exports = class ExtensionStore {
})
}
/**
* Sets the key in local state
* @param {object} obj - The key to set
* @return {Promise<void>}
* @private
*/
_set(obj) {
const local = extension.storage.local
return new Promise((resolve, reject) => {
@ -57,6 +80,11 @@ module.exports = class ExtensionStore {
}
}
/**
* Returns whether or not the given object contains no keys
* @param {object} obj - The object to check
* @returns {boolean}
*/
function isEmpty(obj) {
return Object.keys(obj).length === 0
}

@ -1,7 +1,23 @@
const EventEmitter = require('events')
/**
* @typedef {object} Migration
* @property {number} version - The migration version
* @property {Function} migrate - Returns a promise of the migrated data
*/
/**
* @typedef {object} MigratorOptions
* @property {Array<Migration>} [migrations] - The list of migrations to apply
* @property {number} [defaultVersion] - The version to use in the initial state
*/
class Migrator extends EventEmitter {
/**
* @constructor
* @param {MigratorOptions} opts
*/
constructor (opts = {}) {
super()
const migrations = opts.migrations || []
@ -42,19 +58,30 @@ class Migrator extends EventEmitter {
return versionedData
// migration is "pending" if it has a higher
// version number than currentVersion
/**
* Returns whether or not the migration is pending
*
* A migration is considered "pending" if it has a higher
* version number than the current version.
* @param {Migration} migration
* @returns {boolean}
*/
function migrationIsPending (migration) {
return migration.version > versionedData.meta.version
}
}
generateInitialState (initState) {
/**
* Returns the initial state for the migrator
* @param {object} [data] - The data for the initial state
* @returns {{meta: {version: number}, data: any}}
*/
generateInitialState (data) {
return {
meta: {
version: this.defaultVersion,
},
data: initState,
data,
}
}

@ -1,6 +1,14 @@
const promiseToCallback = require('promise-to-callback')
const noop = function () {}
/**
* A generator that returns a function which, when passed a promise, can treat that promise as a node style callback.
* The prime advantage being that callbacks are better for error handling.
*
* @param {Function} fn The function to handle as a callback
* @param {Object} context The context in which the fn is to be called, most often a this reference
*
*/
module.exports = function nodeify (fn, context) {
return function () {
const args = [].slice.call(arguments)

@ -3,6 +3,7 @@ const ObservableStore = require('obs-store')
const ethUtil = require('ethereumjs-util')
const createId = require('./random-id')
const hexRe = /^[0-9A-Fa-f]+$/g
const log = require('loglevel')
module.exports = class PersonalMessageManager extends EventEmitter {

@ -6,6 +6,13 @@ module.exports = PortDuplexStream
inherits(PortDuplexStream, Duplex)
/**
* Creates a stream that's both readable and writable.
* The stream supports arbitrary objects.
*
* @class
* @param {Object} port Remote Port object
*/
function PortDuplexStream (port) {
Duplex.call(this, {
objectMode: true,
@ -15,8 +22,13 @@ function PortDuplexStream (port) {
port.onDisconnect.addListener(this._onDisconnect.bind(this))
}
// private
/**
* Callback triggered when a message is received from
* the remote Port associated with this Stream.
*
* @private
* @param {Object} msg - Payload from the onMessage listener of Port
*/
PortDuplexStream.prototype._onMessage = function (msg) {
if (Buffer.isBuffer(msg)) {
delete msg._isBuffer
@ -27,14 +39,31 @@ PortDuplexStream.prototype._onMessage = function (msg) {
}
}
/**
* Callback triggered when the remote Port
* associated with this Stream disconnects.
*
* @private
*/
PortDuplexStream.prototype._onDisconnect = function () {
this.destroy()
}
// stream plumbing
/**
* Explicitly sets read operations to a no-op
*/
PortDuplexStream.prototype._read = noop
/**
* Called internally when data should be written to
* this writable stream.
*
* @private
* @param {*} msg Arbitrary object to write
* @param {string} encoding Encoding to use when writing payload
* @param {Function} cb Called when writing is complete or an error occurs
*/
PortDuplexStream.prototype._write = function (msg, encoding, cb) {
try {
if (Buffer.isBuffer(msg)) {

@ -1,4 +1,5 @@
const KeyringController = require('eth-keyring-controller')
const log = require('loglevel')
const seedPhraseVerifier = {

@ -1,6 +1,9 @@
module.exports = setupMetamaskMeshMetrics
/**
* Injects an iframe into the current document for testing
*/
function setupMetamaskMeshMetrics() {
const testingContainer = document.createElement('iframe')
testingContainer.src = 'https://metamask.github.io/mesh-testing/'

@ -8,20 +8,34 @@ module.exports = {
setupMultiplex: setupMultiplex,
}
/**
* Returns a stream transform that parses JSON strings passing through
* @return {stream.Transform}
*/
function jsonParseStream () {
return Through.obj(function (serialized, encoding, cb) {
return Through.obj(function (serialized, _, cb) {
this.push(JSON.parse(serialized))
cb()
})
}
/**
* Returns a stream transform that calls {@code JSON.stringify}
* on objects passing through
* @return {stream.Transform} the stream transform
*/
function jsonStringifyStream () {
return Through.obj(function (obj, encoding, cb) {
return Through.obj(function (obj, _, cb) {
this.push(JSON.stringify(obj))
cb()
})
}
/**
* Sets up stream multiplexing for the given stream
* @param {any} connectionStream - the stream to mux
* @return {stream.Stream} the multiplexed stream
*/
function setupMultiplex (connectionStream) {
const mux = new ObjectMultiplex()
pump(

@ -3,7 +3,7 @@ const ObservableStore = require('obs-store')
const createId = require('./random-id')
const assert = require('assert')
const sigUtil = require('eth-sig-util')
const log = require('loglevel')
module.exports = class TypedMessageManager extends EventEmitter {
constructor (opts) {

@ -1,20 +1,53 @@
const ethUtil = require('ethereumjs-util')
const assert = require('assert')
const BN = require('bn.js')
const {
ENVIRONMENT_TYPE_POPUP,
ENVIRONMENT_TYPE_NOTIFICATION,
ENVIRONMENT_TYPE_FULLSCREEN,
} = require('./enums')
module.exports = {
getStack,
sufficientBalance,
hexToBn,
bnToHex,
BnMultiplyByFraction,
}
/**
* Generates an example stack trace
*
* @returns {string} A stack trace
*
*/
function getStack () {
const stack = new Error('Stack trace generator - not an error').stack
return stack
}
/**
* Used to determine the window type through which the app is being viewed.
* - 'popup' refers to the extension opened through the browser app icon (in top right corner in chrome and firefox)
* - 'responsive' refers to the main browser window
* - 'notification' refers to the popup that appears in its own window when taking action outside of metamask
*
* @returns {string} A single word label that represents the type of window through which the app is being viewed
*
*/
const getEnvironmentType = (url = window.location.href) => {
if (url.match(/popup.html(?:\?.+)*$/)) {
return ENVIRONMENT_TYPE_POPUP
} else if (url.match(/home.html(?:\?.+)*$/) || url.match(/home.html(?:#.*)*$/)) {
return ENVIRONMENT_TYPE_FULLSCREEN
} else {
return ENVIRONMENT_TYPE_NOTIFICATION
}
}
/**
* Checks whether a given balance of ETH, represented as a hex string, is sufficient to pay a value plus a gas fee
*
* @param {object} txParams Contains data about a transaction
* @param {string} txParams.gas The gas for a transaction
* @param {string} txParams.gasPrice The price per gas for the transaction
* @param {string} txParams.value The value of ETH to send
* @param {string} hexBalance A balance of ETH represented as a hex string
* @returns {boolean} Whether the balance is greater than or equal to the value plus the value of gas times gasPrice
*
*/
function sufficientBalance (txParams, hexBalance) {
// validate hexBalance is a hex string
assert.equal(typeof hexBalance, 'string', 'sufficientBalance - hexBalance is not a hex string')
@ -29,16 +62,48 @@ function sufficientBalance (txParams, hexBalance) {
return balance.gte(maxCost)
}
/**
* Converts a BN object to a hex string with a '0x' prefix
*
* @param {BN} inputBn The BN to convert to a hex string
* @returns {string} A '0x' prefixed hex string
*
*/
function bnToHex (inputBn) {
return ethUtil.addHexPrefix(inputBn.toString(16))
}
/**
* Converts a hex string to a BN object
*
* @param {string} inputHex A number represented as a hex string
* @returns {Object} A BN object
*
*/
function hexToBn (inputHex) {
return new BN(ethUtil.stripHexPrefix(inputHex), 16)
}
/**
* Used to multiply a BN by a fraction
*
* @param {BN} targetBN The number to multiply by a fraction
* @param {number|string} numerator The numerator of the fraction multiplier
* @param {number|string} denominator The denominator of the fraction multiplier
* @returns {BN} The product of the multiplication
*
*/
function BnMultiplyByFraction (targetBN, numerator, denominator) {
const numBN = new BN(numerator)
const denomBN = new BN(denominator)
return targetBN.mul(numBN).div(denomBN)
}
module.exports = {
getStack,
getEnvironmentType,
sufficientBalance,
hexToBn,
bnToHex,
BnMultiplyByFraction,
}

@ -5,10 +5,10 @@
*/
const EventEmitter = require('events')
const extend = require('xtend')
const pump = require('pump')
const Dnode = require('dnode')
const ObservableStore = require('obs-store')
const ComposableObservableStore = require('./lib/ComposableObservableStore')
const asStream = require('obs-store/lib/asStream')
const AccountTracker = require('./lib/account-tracker')
const RpcEngine = require('json-rpc-engine')
@ -34,6 +34,7 @@ const PersonalMessageManager = require('./lib/personal-message-manager')
const TypedMessageManager = require('./lib/typed-message-manager')
const TransactionController = require('./controllers/transactions')
const BalancesController = require('./controllers/computed-balances')
const TokenRatesController = require('./controllers/token-rates')
const ConfigManager = require('./lib/config-manager')
const nodeify = require('./lib/nodeify')
const accountImporter = require('./account-import-strategies')
@ -44,6 +45,7 @@ const BN = require('ethereumjs-util').BN
const GWEI_BN = new BN('1000000000')
const percentile = require('percentile')
const seedPhraseVerifier = require('./lib/seed-phrase-verifier')
const log = require('loglevel')
module.exports = class MetamaskController extends EventEmitter {
@ -65,7 +67,7 @@ module.exports = class MetamaskController extends EventEmitter {
this.platform = opts.platform
// observable state store
this.store = new ObservableStore(initState)
this.store = new ComposableObservableStore(initState)
// lock to ensure only one vault created at once
this.createVaultMutex = new Mutex()
@ -104,6 +106,11 @@ module.exports = class MetamaskController extends EventEmitter {
this.provider = this.initializeProvider()
this.blockTracker = this.provider._blockTracker
// token exchange rate tracker
this.tokenRatesController = new TokenRatesController({
preferences: this.preferencesController.store,
})
this.recentBlocksController = new RecentBlocksController({
blockTracker: this.blockTracker,
provider: this.provider,
@ -184,53 +191,37 @@ module.exports = class MetamaskController extends EventEmitter {
this.typedMessageManager = new TypedMessageManager()
this.publicConfigStore = this.initPublicConfigStore()
// manual disk state subscriptions
this.txController.store.subscribe((state) => {
this.store.updateState({ TransactionController: state })
})
this.keyringController.store.subscribe((state) => {
this.store.updateState({ KeyringController: state })
})
this.preferencesController.store.subscribe((state) => {
this.store.updateState({ PreferencesController: state })
})
this.addressBookController.store.subscribe((state) => {
this.store.updateState({ AddressBookController: state })
})
this.currencyController.store.subscribe((state) => {
this.store.updateState({ CurrencyController: state })
})
this.noticeController.store.subscribe((state) => {
this.store.updateState({ NoticeController: state })
})
this.shapeshiftController.store.subscribe((state) => {
this.store.updateState({ ShapeShiftController: state })
})
this.networkController.store.subscribe((state) => {
this.store.updateState({ NetworkController: state })
this.store.updateStructure({
TransactionController: this.txController.store,
KeyringController: this.keyringController.store,
PreferencesController: this.preferencesController.store,
AddressBookController: this.addressBookController.store,
CurrencyController: this.currencyController.store,
NoticeController: this.noticeController.store,
ShapeShiftController: this.shapeshiftController.store,
NetworkController: this.networkController.store,
InfuraController: this.infuraController.store,
})
this.infuraController.store.subscribe((state) => {
this.store.updateState({ InfuraController: state })
this.memStore = new ComposableObservableStore(null, {
NetworkController: this.networkController.store,
AccountTracker: this.accountTracker.store,
TxController: this.txController.memStore,
BalancesController: this.balancesController.store,
TokenRatesController: this.tokenRatesController.store,
MessageManager: this.messageManager.memStore,
PersonalMessageManager: this.personalMessageManager.memStore,
TypesMessageManager: this.typedMessageManager.memStore,
KeyringController: this.keyringController.memStore,
PreferencesController: this.preferencesController.store,
RecentBlocksController: this.recentBlocksController.store,
AddressBookController: this.addressBookController.store,
CurrencyController: this.currencyController.store,
NoticeController: this.noticeController.memStore,
ShapeshiftController: this.shapeshiftController.store,
InfuraController: this.infuraController.store,
})
// manual mem state subscriptions
const sendUpdate = this.sendUpdate.bind(this)
this.networkController.store.subscribe(sendUpdate)
this.accountTracker.store.subscribe(sendUpdate)
this.txController.memStore.subscribe(sendUpdate)
this.balancesController.store.subscribe(sendUpdate)
this.messageManager.memStore.subscribe(sendUpdate)
this.personalMessageManager.memStore.subscribe(sendUpdate)
this.typedMessageManager.memStore.subscribe(sendUpdate)
this.keyringController.memStore.subscribe(sendUpdate)
this.preferencesController.store.subscribe(sendUpdate)
this.recentBlocksController.store.subscribe(sendUpdate)
this.addressBookController.store.subscribe(sendUpdate)
this.currencyController.store.subscribe(sendUpdate)
this.noticeController.memStore.subscribe(sendUpdate)
this.shapeshiftController.store.subscribe(sendUpdate)
this.infuraController.store.subscribe(sendUpdate)
this.memStore.subscribe(this.sendUpdate.bind(this))
}
/**
@ -279,6 +270,7 @@ module.exports = class MetamaskController extends EventEmitter {
// memStore -> transform -> publicConfigStore
this.on('update', (memState) => {
this.isClientOpenAndUnlocked = memState.isUnlocked && this._isClientOpen
const publicState = selectPublicState(memState)
publicConfigStore.putState(publicState)
})
@ -308,33 +300,17 @@ module.exports = class MetamaskController extends EventEmitter {
const vault = this.keyringController.store.getState().vault
const isInitialized = (!!wallet || !!vault)
return extend(
{
isInitialized,
},
this.networkController.store.getState(),
this.accountTracker.store.getState(),
this.txController.memStore.getState(),
this.messageManager.memStore.getState(),
this.personalMessageManager.memStore.getState(),
this.typedMessageManager.memStore.getState(),
this.keyringController.memStore.getState(),
this.balancesController.store.getState(),
this.preferencesController.store.getState(),
this.addressBookController.store.getState(),
this.currencyController.store.getState(),
this.noticeController.memStore.getState(),
this.infuraController.store.getState(),
this.recentBlocksController.store.getState(),
// config manager
this.configManager.getConfig(),
this.shapeshiftController.store.getState(),
{
return {
...{ isInitialized },
...this.memStore.getFlatState(),
...this.configManager.getConfig(),
...{
lostAccounts: this.configManager.getLostAccounts(),
seedWords: this.configManager.getSeedWords(),
forgottenPassword: this.configManager.getPasswordForgotten(),
isRevealingSeedWords: Boolean(this.configManager.getIsRevealingSeedWords()),
},
}
)
}
/**
@ -372,6 +348,7 @@ module.exports = class MetamaskController extends EventEmitter {
clearSeedWordCache: this.clearSeedWordCache.bind(this),
resetAccount: nodeify(this.resetAccount, this),
importAccountWithStrategy: this.importAccountWithStrategy.bind(this),
setIsRevealingSeedWords: this.configManager.setIsRevealingSeedWords.bind(this.configManager),
// vault management
submitPassword: nodeify(keyringController.submitPassword, keyringController),
@ -1057,4 +1034,12 @@ module.exports = class MetamaskController extends EventEmitter {
}
}
set isClientOpen (open) {
this._isClientOpen = open
this.isClientOpenAndUnlocked = this.getState().isUnlocked && open
}
set isClientOpenAndUnlocked (active) {
this.tokenRatesController.isActive = active
}
}

@ -1,20 +1,25 @@
class SwPlatform {
//
// Public
//
/**
* Reloads the platform
*/
reload () {
// you cant actually do this
global.location.reload()
// TODO: you can't actually do this
/** @type {any} */ (global).location.reload()
}
openWindow ({ url }) {
// this doesnt actually work
global.open(url, '_blank')
/**
* Opens a window
* @param {{url: string}} opts - The window options
*/
openWindow (opts) {
// TODO: this doesn't actually work
/** @type {any} */ (global).open(opts.url, '_blank')
}
/**
* Returns the platform version
* @returns {string}
*/
getVersion () {
return '<unable to read version>'
}

@ -1,18 +1,23 @@
class WindowPlatform {
//
// Public
//
/**
* Reload the platform
*/
reload () {
global.location.reload()
/** @type {any} */ (global).location.reload()
}
openWindow ({ url }) {
global.open(url, '_blank')
/**
* Opens a window
* @param {{url: string}} opts - The window options
*/
openWindow (opts) {
/** @type {any} */ (global).open(opts.url, '_blank')
}
/**
* Returns the platform version
* @returns {string}
*/
getVersion () {
return '<unable to read version>'
}

@ -7,10 +7,14 @@ const launchMetamaskUi = require('../../ui')
const StreamProvider = require('web3-stream-provider')
const setupMultiplex = require('./lib/stream-utils.js').setupMultiplex
module.exports = initializePopup
/**
* Asynchronously initializes the MetaMask popup UI
*
* @param {{ container: Element, connectionStream: * }} config Popup configuration object
* @param {Function} cb Called when initialization is complete
*/
function initializePopup ({ container, connectionStream }, cb) {
// setup app
async.waterfall([
@ -19,6 +23,12 @@ function initializePopup ({ container, connectionStream }, cb) {
], cb)
}
/**
* Establishes streamed connections to background scripts and a Web3 provider
*
* @param {PortDuplexStream} connectionStream PortStream instance establishing a background connection
* @param {Function} cb Called when controller connection is established
*/
function connectToAccountManager (connectionStream, cb) {
// setup communication with background
// setup multiplexing
@ -28,6 +38,11 @@ function connectToAccountManager (connectionStream, cb) {
setupWeb3Connection(mx.createStream('provider'))
}
/**
* Establishes a streamed connection to a Web3 provider
*
* @param {PortDuplexStream} connectionStream PortStream instance establishing a background connection
*/
function setupWeb3Connection (connectionStream) {
var providerStream = new StreamProvider()
providerStream.pipe(connectionStream).pipe(providerStream)
@ -38,6 +53,12 @@ function setupWeb3Connection (connectionStream) {
global.eth = new Eth(providerStream)
}
/**
* Establishes a streamed connection to the background account manager
*
* @param {PortDuplexStream} connectionStream PortStream instance establishing a background connection
* @param {Function} cb Called when the remote account manager connection is established
*/
function setupControllerConnection (connectionStream, cb) {
// this is a really sneaky way of adding EventEmitter api
// to a bi-directional dnode instance

@ -3,12 +3,14 @@ const OldMetaMaskUiCss = require('../../old-ui/css')
const NewMetaMaskUiCss = require('../../ui/css')
const startPopup = require('./popup-core')
const PortStream = require('./lib/port-stream.js')
const isPopupOrNotification = require('./lib/is-popup-or-notification')
const { getEnvironmentType } = require('./lib/util')
const { ENVIRONMENT_TYPE_NOTIFICATION } = require('./lib/enums')
const extension = require('extensionizer')
const ExtensionPlatform = require('./platforms/extension')
const NotificationManager = require('./lib/notification-manager')
const notificationManager = new NotificationManager()
const setupRaven = require('./lib/setupRaven')
const log = require('loglevel')
start().catch(log.error)
@ -26,7 +28,7 @@ async function start() {
// injectCss(css)
// identify window type (popup, notification)
const windowType = isPopupOrNotification()
const windowType = getEnvironmentType(window.location.href)
global.METAMASK_UI_TYPE = windowType
closePopupIfOpen(windowType)
@ -68,7 +70,7 @@ async function start() {
function closePopupIfOpen (windowType) {
if (windowType !== 'notification') {
if (windowType !== ENVIRONMENT_TYPE_NOTIFICATION) {
// should close only chrome popup
notificationManager.closePopup()
}

@ -0,0 +1,134 @@
{
"metamask": {
"isInitialized": true,
"isUnlocked": true,
"featureFlags": {"betaUI": true},
"rpcTarget": "https://rawtestrpc.metamask.io/",
"identities": {
"0xfdea65c8e26263f6d9a1b5de9555d2931a33b825": {
"address": "0xfdea65c8e26263f6d9a1b5de9555d2931a33b825",
"name": "Send Account 1"
},
"0xc5b8dbac4c1d3f152cdeb400e2313f309c410acb": {
"address": "0xc5b8dbac4c1d3f152cdeb400e2313f309c410acb",
"name": "Send Account 2"
},
"0x2f8d4a878cfa04a6e60d46362f5644deab66572d": {
"address": "0x2f8d4a878cfa04a6e60d46362f5644deab66572d",
"name": "Send Account 3"
},
"0xd85a4b6a394794842887b8284293d69163007bbb": {
"address": "0xd85a4b6a394794842887b8284293d69163007bbb",
"name": "Send Account 4"
}
},
"unapprovedTxs": {},
"currentCurrency": "USD",
"conversionRate": 19855,
"conversionDate": 1489013762,
"noActiveNotices": true,
"frequentRpcList": [],
"network": "3",
"accounts": {
"0xfdea65c8e26263f6d9a1b5de9555d2931a33b825": {
"code": "0x",
"balance": "0x47c9d71831c76efe",
"nonce": "0x1b",
"address": "0xfdea65c8e26263f6d9a1b5de9555d2931a33b825"
},
"0xc5b8dbac4c1d3f152cdeb400e2313f309c410acb": {
"code": "0x",
"balance": "0x37452b1315889f80",
"nonce": "0xa",
"address": "0xc5b8dbac4c1d3f152cdeb400e2313f309c410acb"
},
"0x2f8d4a878cfa04a6e60d46362f5644deab66572d": {
"code": "0x",
"balance": "0x30c9d71831c76efe",
"nonce": "0x1c",
"address": "0x2f8d4a878cfa04a6e60d46362f5644deab66572d"
},
"0xd85a4b6a394794842887b8284293d69163007bbb": {
"code": "0x",
"balance": "0x0",
"nonce": "0x0",
"address": "0xd85a4b6a394794842887b8284293d69163007bbb"
}
},
"addressBook": [
{
"address": "0x06195827297c7a80a443b6894d3bdb8824b43896",
"name": "Address Book Account 1"
}
],
"tokens": [],
"transactions": {},
"selectedAddressTxList": [],
"unapprovedMsgs": {},
"unapprovedMsgCount": 0,
"unapprovedPersonalMsgs": {},
"unapprovedPersonalMsgCount": 0,
"keyringTypes": [
"Simple Key Pair",
"HD Key Tree"
],
"keyrings": [
{
"type": "HD Key Tree",
"accounts": [
"fdea65c8e26263f6d9a1b5de9555d2931a33b825",
"c5b8dbac4c1d3f152cdeb400e2313f309c410acb",
"2f8d4a878cfa04a6e60d46362f5644deab66572d"
]
},
{
"type": "Simple Key Pair",
"accounts": [
"0xfdea65c8e26263f6d9a1b5de9555d2931a33b825"
]
}
],
"selectedAddress": "0xfdea65c8e26263f6d9a1b5de9555d2931a33b825",
"currentCurrency": "PHP",
"provider": {
"type": "testnet"
},
"shapeShiftTxList": [],
"lostAccounts": [],
"send": {
"gasLimit": null,
"gasPrice": null,
"gasTotal": "0xb451dc41b578",
"tokenBalance": null,
"from": "",
"to": "",
"amount": "0x0",
"memo": "",
"errors": {},
"maxModeOn": false,
"editingTransactionId": null
},
"currentLocale": "en"
},
"appState": {
"menuOpen": false,
"currentView": {
"name": "accountDetail",
"detailView": null,
"context": "0x0dcd5d886577d5081b0c52e242ef29e70be3e7bc"
},
"accountDetail": {
"subview": "transactions"
},
"modal": {
"modalState": {},
"previousModalState": {}
},
"transForward": true,
"isLoading": false,
"warning": null,
"scrollToBottom": false,
"forgottenPassword": null
},
"identities": {}
}

@ -0,0 +1,25 @@
{
"tags": {
"allowUnknownTags": false
},
"source": {
"include": "app/scripts/",
"includePattern": ".js$",
"excludePattern": "(node_modules/|docs)"
},
"plugins": [
"plugins/markdown"
],
"opts": {
"template": "node_modules/radgrad-jsdoc-template/",
"encoding": "utf8",
"destination": "docs/jsdocs",
"recurse": true,
"verbose": true
},
"templates": {
"cleverLinks": false,
"monospaceLinks": false
}
}

@ -0,0 +1,15 @@
# Development Tools & Configurations
This folder contains configuration files which are used by the the different
development-tools, like e.g. JsDoc.
## Appveyor
https://www.appveyor.com/docs/build-configuration/#alternative-yaml-file-location
Withtin the configuration, point to a weblocation of a txt config file:
https://ci.appveyor.com/project/lazaridiscom/mm-vault/settings
https://raw.githubusercontent.com/lazaridiscom/mm-vault/master/dev/tools/appveyor.txt

@ -0,0 +1,21 @@
# Test against the latest version of this Node.js version
environment:
nodejs_version: "8"
# Install scripts. (runs after repo cloning)
install:
# Get the latest stable version of Node.js or io.js
- ps: Install-Product node $env:nodejs_version
# install modules
- npm install
# Post-install test scripts.
test_script:
# Output useful info for debugging.
- node --version
- npm --version
# run tests
- npm test
# Don't actually build.
build: off

@ -0,0 +1,78 @@
# The Team
Here is an overview of the current MetaMask team, and their primary roles and responsibilities, in the order they joined the team.
## Core Team Members
The core team maintains aspects of the main product (the extension) and the core libraries (the MetaMask Controller, provider-engine, etc).
### Aaron Davis
@kumavis
Founder / Technical Lead
Especially in charge of connection to the blockchain. Wrote [provider-engine](https://github.com/MetaMask/provider-engine), and is currently working with @hermanjunge on our JavaScript light-client.
### Dan Finlay
@danfinlay
Software Engineer / Product Lead
Focused on the deliverable, user-valuable aspects of MetaMask, including usability and documentation. Coordinates efforts between different branches of the team, and integrations with other projects.
### Frankie Pangilinan
@frankiebee
Software Engineer / Transaction Manager Lead
Frankie contributes code throughout MetaMask, but has become especially specialized in the way MetaMask manages transactions. She is also the original lead of the [Mascara](https://github.com/MetaMask/mascara) project.
### Kevin Serrano
@Zanibas
Software Engineer / Project Management Lead
Kevin is a software engineer, but also spends a lot of his time keeping the team's administrative operations running smoothly.
### Thomas Huang
@tmashuang
QA Engineer
Thomas is the head of MetaMask Quality Assurance. He both takes the final pass of branches of code before we ship to production, and is also in charge of continuously improving our automated quality assurance process.
### Christian Jeria
@cjeria
User Experience Designer
Christian is the lead of MetaMask's user experience. He is continuously designing prototypes, testing them with users, and refining them with our developers for production.
### Paul Bouchon
@bitpshr
Software Engineer
The newest member of the team! Paul is currently being onboarded, and finding his niche within the team.
## Laboratory Team Members
These team members are working on projects that will benefit MetaMask, but are not directly working on the product itself.
### Herman Junge
@hermanjunge
Software Engineer
Herman is currently leading the Mustekala project, a JavaScript, IPFS-based Ethereum light client.
## Kyokan Team Members
[Kyokan](http://kyokan.io/) is a consulting firm that has been working closely with the MetaMask team on the latest version of our user interface. Their team members are not members of ConsenSys LLC, but they contribute a lot to the project.
- Daniel Tsui (@sdsui)
- Chi Kei Chan (@chikeichan)
- Dan Miller (@danjm)
- David Yoo (@yookd)
- Whymarrh Whitby (@whymarrh)

@ -9,7 +9,7 @@ import Identicon from '../../../../ui/app/components/identicon'
import { confirmSeedWords, showModal } from '../../../../ui/app/actions'
import Breadcrumbs from './breadcrumbs'
import LoadingScreen from './loading-screen'
import { DEFAULT_ROUTE } from '../../../../ui/app/routes'
import { DEFAULT_ROUTE, INITIALIZE_BACKUP_PHRASE_ROUTE } from '../../../../ui/app/routes'
class ConfirmSeedScreen extends Component {
static propTypes = {
@ -53,7 +53,7 @@ class ConfirmSeedScreen extends Component {
}
render () {
const { seedWords } = this.props
const { seedWords, history } = this.props
const { selectedSeeds, shuffledSeeds } = this.state
const isValid = seedWords === selectedSeeds.map(([_, seed]) => seed).join(' ')
@ -66,6 +66,16 @@ class ConfirmSeedScreen extends Component {
<div className="first-view-main-wrapper">
<div className="first-view-main">
<div className="backup-phrase">
<a
className="backup-phrase__back-button"
onClick={e => {
e.preventDefault()
history.push(INITIALIZE_BACKUP_PHRASE_ROUTE)
}}
href="#"
>
{`< Back`}
</a>
<Identicon address={this.props.address} diameter={70} />
<div className="backup-phrase__content-wrapper">
<div>

@ -8,6 +8,7 @@ import Identicon from '../../../../ui/app/components/identicon'
import Breadcrumbs from './breadcrumbs'
import LoadingScreen from './loading-screen'
import { DEFAULT_ROUTE, INITIALIZE_CONFIRM_SEED_ROUTE } from '../../../../ui/app/routes'
import { confirmSeedWords } from '../../../../ui/app/actions'
const LockIcon = props => (
<svg
@ -44,6 +45,8 @@ class BackupPhraseScreen extends Component {
address: PropTypes.string.isRequired,
seedWords: PropTypes.string,
history: PropTypes.object,
isRevealingSeedWords: PropTypes.bool,
clearSeedWords: PropTypes.func,
};
static defaultProps = {
@ -58,6 +61,14 @@ class BackupPhraseScreen extends Component {
}
componentWillMount () {
this.checkSeedWords()
}
componentDidUpdate () {
this.checkSeedWords()
}
checkSeedWords () {
const { seedWords, history } = this.props
if (!seedWords) {
@ -92,9 +103,29 @@ class BackupPhraseScreen extends Component {
)
}
renderSecretScreen () {
renderSubmitButton () {
const { isRevealingSeedWords, clearSeedWords, history } = this.props
const { isShowingSecret } = this.state
const { history } = this.props
return isRevealingSeedWords
? <button
className="first-time-flow__button"
onClick={() => clearSeedWords().then(() => history.push(DEFAULT_ROUTE))}
disabled={!isShowingSecret}
>
Done
</button>
: <button
className="first-time-flow__button"
onClick={() => isShowingSecret && history.push(INITIALIZE_CONFIRM_SEED_ROUTE)}
disabled={!isShowingSecret}
>
Next
</button>
}
renderSecretScreen () {
const { isRevealingSeedWords } = this.props
return (
<div className="backup-phrase__content-wrapper">
@ -121,14 +152,8 @@ class BackupPhraseScreen extends Component {
</div>
</div>
<div className="backup-phrase__next-button">
<button
className="first-time-flow__button"
onClick={() => isShowingSecret && history.push(INITIALIZE_CONFIRM_SEED_ROUTE)}
disabled={!isShowingSecret}
>
Next
</button>
<Breadcrumbs total={3} currentIndex={1} />
{ this.renderSubmitButton() }
{ !isRevealingSeedWords && <Breadcrumbs total={3} currentIndex={1} />}
</div>
</div>
)
@ -150,13 +175,25 @@ class BackupPhraseScreen extends Component {
}
}
export default compose(
withRouter,
connect(
({ metamask: { selectedAddress, seedWords }, appState: { isLoading } }) => ({
const mapStateToProps = ({ metamask, appState }) => {
const { selectedAddress, seedWords, isRevealingSeedWords } = metamask
const { isLoading } = appState
return {
seedWords,
isRevealingSeedWords,
isLoading,
address: selectedAddress,
})
)
}
}
const mapDispatchToProps = dispatch => {
return {
clearSeedWords: () => dispatch(confirmSeedWords()),
}
}
export default compose(
withRouter,
connect(mapStateToProps, mapDispatchToProps),
)(BackupPhraseScreen)

@ -3,6 +3,7 @@ const Component = require('react').Component
const connect = require('react-redux').connect
const h = require('react-hyperscript')
const actions = require('../../ui/app/actions')
const log = require('loglevel')
// mascara
const MascaraFirstTime = require('../../mascara/src/app/first-time').default
const MascaraBuyEtherScreen = require('../../mascara/src/app/first-time/buy-ether-screen').default

@ -8,6 +8,7 @@ const ENS = require('ethjs-ens')
const networkMap = require('ethjs-ens/lib/network-map.json')
const ensRE = /.+\..+$/
const ZERO_ADDRESS = '0x0000000000000000000000000000000000000000'
const log = require('loglevel')
module.exports = EnsInput

@ -3,6 +3,7 @@ const h = require('react-hyperscript')
const inherits = require('util').inherits
const actions = require('../../../ui/app/actions')
const clone = require('clone')
const log = require('loglevel')
const ethUtil = require('ethereumjs-util')
const BN = ethUtil.BN

@ -3,6 +3,7 @@ const h = require('react-hyperscript')
const inherits = require('util').inherits
const TokenTracker = require('eth-token-tracker')
const TokenCell = require('./token-cell.js')
const log = require('loglevel')
module.exports = TokenList

@ -6,7 +6,9 @@ const actions = require('../../ui/app/actions')
const NetworkIndicator = require('./components/network')
const LoadingIndicator = require('./components/loading')
const txHelper = require('../lib/tx-helper')
const isPopupOrNotification = require('../../app/scripts/lib/is-popup-or-notification')
const log = require('loglevel')
const { ENVIRONMENT_TYPE_NOTIFICATION } = require('../../app/scripts/lib/enums')
const { getEnvironmentType } = require('../../app/scripts/lib/util')
const PendingTx = require('./components/pending-tx')
const PendingMsg = require('./components/pending-msg')
@ -50,7 +52,7 @@ ConfirmTxScreen.prototype.render = function () {
var txData = unconfTxList[props.index] || {}
var txParams = txData.params || {}
var isNotification = isPopupOrNotification() === 'notification'
var isNotification = getEnvironmentType(window.location.href) === ENVIRONMENT_TYPE_NOTIFICATION
log.info(`rendering a combined ${unconfTxList.length} unconf msg & txs`)
if (unconfTxList.length === 0) return h(Loading, { isLoading: true })

@ -1,4 +1,5 @@
const valuesFor = require('../app/util').valuesFor
const log = require('loglevel')
module.exports = function (unapprovedTxs, unapprovedMsgs, personalMsgs, typedMessages, network) {
log.debug('tx-helper called with params:')

816
package-lock.json generated

File diff suppressed because it is too large Load Diff

@ -7,8 +7,9 @@
"start": "gulp dev:extension",
"mascara": "gulp dev:mascara & node ./mascara/example/server",
"dist": "gulp dist",
"doc": "jsdoc -c development/tools/.jsdoc.json",
"test": "npm run test:unit && npm run test:integration && npm run lint",
"test:unit": "cross-env METAMASK_ENV=test mocha --exit --require babel-core/register --require test/helper.js --recursive \"test/unit/**/*.js\"",
"test:unit": "cross-env METAMASK_ENV=test mocha --exit --require test/setup.js --recursive \"test/unit/**/*.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:build": "gulp build:scss",
@ -75,6 +76,7 @@
"classnames": "^2.2.5",
"clone": "^2.1.1",
"copy-to-clipboard": "^3.0.8",
"currency-formatter": "^1.4.2",
"debounce": "^1.0.0",
"debounce-stream": "^2.0.0",
"deep-extend": "^0.5.0",
@ -90,7 +92,7 @@
"eth-hd-keyring": "^1.2.1",
"eth-json-rpc-filters": "^1.2.5",
"eth-json-rpc-infura": "^3.0.0",
"eth-keyring-controller": "^2.1.4",
"eth-keyring-controller": "^2.2.0",
"eth-phishing-detect": "^1.1.4",
"eth-query": "^2.1.2",
"eth-sig-util": "^1.4.2",
@ -236,6 +238,7 @@
"gulp-zip": "^4.0.0",
"image-size": "^0.6.2",
"isomorphic-fetch": "^2.2.1",
"jsdoc": "^3.5.5",
"jsdom": "^11.2.0",
"jsdom-global": "^3.0.2",
"jshint-stylish": "~2.2.1",
@ -257,6 +260,7 @@
"prompt": "^1.0.0",
"qs": "^6.2.0",
"qunitjs": "^2.4.1",
"radgrad-jsdoc-template": "^1.1.3",
"react-addons-test-utils": "^15.5.1",
"react-test-renderer": "^15.6.2",
"react-testutils-additions": "^15.2.0",

@ -0,0 +1,28 @@
const reactTriggerChange = require('../../lib/react-trigger-change')
const {
timeout,
queryAsync,
findAsync,
} = require('../../lib/util')
QUnit.module('currency localization')
QUnit.test('renders localized currency', (assert) => {
const done = assert.async()
runCurrencyLocalizationTest(assert).then(done).catch((err) => {
assert.notOk(err, `Error was thrown: ${err.stack}`)
done()
})
})
async function runCurrencyLocalizationTest(assert, done) {
console.log('*** start runCurrencyLocalizationTest')
const selectState = await queryAsync($, 'select')
selectState.val('currency localization')
reactTriggerChange(selectState[0])
await timeout(1000)
const txView = await queryAsync($, '.tx-view')
const heroBalance = await findAsync($(txView), '.hero-balance')
const fiatAmount = await findAsync($(heroBalance), '.fiat-amount')
assert.equal(fiatAmount[0].textContent, '₱102,707.97')
}

@ -91,7 +91,7 @@ async function runSendFlowTest(assert, done) {
)
assert.equal(
sendGasField.find('.currency-display__converted-value')[0].textContent,
'0.24 USD',
'$0.24 USD',
'send gas field should show estimated gas total converted to USD'
)
@ -118,7 +118,7 @@ async function runSendFlowTest(assert, done) {
)
assert.equal(
(await findAsync(sendGasField, '.currency-display__converted-value'))[0].textContent,
'3.60 USD',
'$3.60 USD',
'send gas field should show customized gas total converted to USD'
)
@ -138,9 +138,9 @@ async function runSendFlowTest(assert, done) {
const confirmScreenRows = await queryAsync($, '.confirm-screen-rows')
const confirmScreenGas = confirmScreenRows.find('.currency-display__converted-value')[0]
assert.equal(confirmScreenGas.textContent, '3.60 USD', 'confirm screen should show correct gas')
assert.equal(confirmScreenGas.textContent, '$3.60 USD', 'confirm screen should show correct gas')
const confirmScreenTotal = confirmScreenRows.find('.confirm-screen-row-info')[2]
assert.equal(confirmScreenTotal.textContent, '2405.36 USD', 'confirm screen should show correct total')
assert.equal(confirmScreenTotal.textContent, '$2,405.36 USD', 'confirm screen should show correct total')
const confirmScreenBackButton = await queryAsync($, '.page-container__back-button')
confirmScreenBackButton[0].click()

@ -53,7 +53,7 @@ async function runTxListItemsTest(assert, done) {
const confirmedTokenTx = txListItems[6]
const confirmedTokenTxAddress = await findAsync($(confirmedTokenTx), '.tx-list-account')
assert.equal(confirmedTokenTxAddress[0].textContent, '0xe7884118...81a9', 'confirmedTokenTx has correct address')
assert.equal(confirmedTokenTxAddress[0].textContent, '0xE7884118...81a9', 'confirmedTokenTx has correct address')
const rejectedTx = txListItems[7]
const rejectedTxRenderedStatus = await findAsync($(rejectedTx), '.tx-list-status')

@ -0,0 +1,5 @@
require('babel-register')({
ignore: name => name.includes('node_modules') && !name.includes('obs-store'),
})
require('./helper')

@ -0,0 +1,35 @@
const assert = require('assert')
const ComposableObservableStore = require('../../app/scripts/lib/ComposableObservableStore')
const ObservableStore = require('obs-store')
describe('ComposableObservableStore', () => {
it('should register initial state', () => {
const store = new ComposableObservableStore('state')
assert.strictEqual(store.getState(), 'state')
})
it('should register initial structure', () => {
const testStore = new ObservableStore()
const store = new ComposableObservableStore(null, { TestStore: testStore })
testStore.putState('state')
assert.deepEqual(store.getState(), { TestStore: 'state' })
})
it('should update structure', () => {
const testStore = new ObservableStore()
const store = new ComposableObservableStore()
store.updateStructure({ TestStore: testStore })
testStore.putState('state')
assert.deepEqual(store.getState(), { TestStore: 'state' })
})
it('should return flattened state', () => {
const fooStore = new ObservableStore({ foo: 'foo' })
const barStore = new ObservableStore({ bar: 'bar' })
const store = new ComposableObservableStore(null, {
FooStore: fooStore,
BarStore: barStore,
})
assert.deepEqual(store.getFlatState(), { foo: 'foo', bar: 'bar' })
})
})

@ -0,0 +1,27 @@
const assert = require('assert')
const currencyFormatter = require('currency-formatter')
const infuraConversion = require('../../ui/app/infura-conversion.json')
describe('currencyFormatting', function () {
it('be able to format any infura currency', function (done) {
const number = 10000
infuraConversion.objects.forEach((conversion) => {
const code = conversion.quote.code.toUpperCase()
const result = currencyFormatter.format(number, { code })
switch (code) {
case 'USD':
assert.equal(result, '$10,000.00')
break
case 'JPY':
assert.equal(result, '¥10,000')
break
default:
assert.ok(result, `Currency ${code} formatted as ${result}`)
}
})
done()
})
})

@ -0,0 +1,29 @@
const assert = require('assert')
const sinon = require('sinon')
const TokenRatesController = require('../../app/scripts/controllers/token-rates')
const ObservableStore = require('obs-store')
describe('TokenRatesController', () => {
it('should listen for preferences store updates', () => {
const preferences = new ObservableStore({ tokens: [] })
const controller = new TokenRatesController({ preferences })
preferences.putState({ tokens: ['foo'] })
assert.deepEqual(controller._tokens, ['foo'])
})
it('should poll on correct interval', async () => {
const stub = sinon.stub(global, 'setInterval')
new TokenRatesController({ interval: 1337 }) // eslint-disable-line no-new
assert.strictEqual(stub.getCall(0).args[1], 1337)
stub.restore()
})
it('should fetch each token rate based on address', async () => {
const controller = new TokenRatesController()
controller.isActive = true
controller.fetchExchangeRate = address => address
controller.tokens = [{ address: 'foo' }, { address: 'bar' }]
await controller.updateExchangeRates()
assert.deepEqual(controller.store.getState().contractExchangeRates, { foo: 'foo', bar: 'bar' })
})
})

@ -3,6 +3,7 @@ const getBuyEthUrl = require('../../app/scripts/lib/buy-eth-url')
const { getTokenAddressFromTokenObject } = require('./util')
const ethUtil = require('ethereumjs-util')
const { fetchLocale } = require('../i18n-helper')
const log = require('loglevel')
var actions = {
_setBackgroundConnection: _setBackgroundConnection,
@ -220,8 +221,6 @@ var actions = {
coinBaseSubview: coinBaseSubview,
SHAPESHIFT_SUBVIEW: 'SHAPESHIFT_SUBVIEW',
shapeShiftSubview: shapeShiftSubview,
UPDATE_TOKEN_EXCHANGE_RATE: 'UPDATE_TOKEN_EXCHANGE_RATE',
updateTokenExchangeRate,
PAIR_UPDATE: 'PAIR_UPDATE',
pairUpdate: pairUpdate,
coinShiftRquest: coinShiftRquest,
@ -346,13 +345,11 @@ function transitionBackward () {
}
}
function confirmSeedWords () {
return dispatch => {
dispatch(actions.showLoadingIndication())
function clearSeedWordCache () {
log.debug(`background.clearSeedWordCache`)
return dispatch => {
return new Promise((resolve, reject) => {
background.clearSeedWordCache((err, account) => {
dispatch(actions.hideLoadingIndication())
if (err) {
dispatch(actions.displayWarning(err.message))
return reject(err)
@ -366,6 +363,22 @@ function confirmSeedWords () {
}
}
function confirmSeedWords () {
return async dispatch => {
dispatch(actions.showLoadingIndication())
const account = await dispatch(clearSeedWordCache())
return dispatch(setIsRevealingSeedWords(false))
.then(() => {
dispatch(actions.hideLoadingIndication())
return account
})
.catch(() => {
dispatch(actions.hideLoadingIndication())
return account
})
}
}
function createNewVaultAndRestore (password, seed) {
return (dispatch) => {
dispatch(actions.showLoadingIndication())
@ -447,11 +460,13 @@ function requestRevealSeed (password) {
}
dispatch(actions.showNewVaultSeed(result))
dispatch(actions.hideLoadingIndication())
resolve()
})
})
})
.then(() => dispatch(setIsRevealingSeedWords(true)))
.then(() => dispatch(actions.hideLoadingIndication()))
.catch(() => dispatch(actions.hideLoadingIndication()))
}
}
@ -1751,28 +1766,6 @@ function shapeShiftRequest (query, options, cb) {
}
}
function updateTokenExchangeRate (token = '') {
const pair = `${token.toLowerCase()}_eth`
return dispatch => {
if (!token) {
return
}
shapeShiftRequest('marketinfo', { pair }, marketinfo => {
if (!marketinfo.error) {
dispatch({
type: actions.UPDATE_TOKEN_EXCHANGE_RATE,
payload: {
pair,
marketinfo,
},
})
}
})
}
}
function setFeatureFlag (feature, activated, notificationType) {
return (dispatch) => {
dispatch(actions.showLoadingIndication())
@ -1930,3 +1923,11 @@ function updateNetworkEndpointType (networkEndpointType) {
value: networkEndpointType,
}
}
function setIsRevealingSeedWords (reveal) {
return dispatch => {
log.debug(`background.setIsRevealingSeedWords`)
background.setIsRevealingSeedWords(reveal)
return forceUpdateMetamaskState(dispatch)
}
}

@ -6,6 +6,7 @@ const { compose } = require('recompose')
const h = require('react-hyperscript')
const actions = require('./actions')
const classnames = require('classnames')
const log = require('loglevel')
// init
const InitializeScreen = require('../../mascara/src/app/first-time').default
@ -55,11 +56,20 @@ const {
class App extends Component {
componentWillMount () {
const { currentCurrency, setCurrentCurrencyToUSD } = this.props
const {
currentCurrency,
setCurrentCurrencyToUSD,
isRevealingSeedWords,
clearSeedWords,
} = this.props
if (!currentCurrency) {
setCurrentCurrencyToUSD()
}
if (isRevealingSeedWords) {
clearSeedWords()
}
}
renderRoutes () {
@ -136,8 +146,6 @@ class App extends Component {
loadingMessage: loadMessage,
}),
// this.renderLoadingIndicator({ isLoading, isLoadingNetwork, loadMessage }),
// content
this.renderRoutes(),
])
@ -301,17 +309,6 @@ class App extends Component {
)
}
renderLoadingIndicator ({ isLoading, isLoadingNetwork, loadMessage }) {
const { isMascara } = this.props
return isMascara
? null
: h(Loading, {
isLoading: isLoading || isLoadingNetwork,
loadingMessage: loadMessage,
})
}
toggleMetamaskActive () {
if (!this.props.isUnlocked) {
// currently inactive: redirect to password box
@ -405,6 +402,8 @@ App.propTypes = {
isMouseUser: PropTypes.bool,
setMouseUserState: PropTypes.func,
t: PropTypes.func,
isRevealingSeedWords: PropTypes.bool,
clearSeedWords: PropTypes.func,
}
function mapStateToProps (state) {
@ -485,6 +484,7 @@ function mapDispatchToProps (dispatch, ownProps) {
setCurrentCurrencyToUSD: () => dispatch(actions.setCurrentCurrency('usd')),
toggleAccountMenu: () => dispatch(actions.toggleAccountMenu()),
setMouseUserState: (isMouseUser) => dispatch(actions.setMouseUserState(isMouseUser)),
clearSeedWords: () => dispatch(actions.confirmSeedWords()),
}
}

@ -7,8 +7,8 @@ const connect = require('react-redux').connect
const Dropdown = require('./dropdown').Dropdown
const DropdownMenuItem = require('./dropdown').DropdownMenuItem
const Identicon = require('./identicon')
const ethUtil = require('ethereumjs-util')
const copyToClipboard = require('copy-to-clipboard')
const { checksumAddress } = require('../util')
class AccountDropdowns extends Component {
constructor (props) {
@ -212,8 +212,7 @@ class AccountDropdowns extends Component {
closeMenu: () => {},
onClick: () => {
const { selected } = this.props
const checkSumAddress = selected && ethUtil.toChecksumAddress(selected)
copyToClipboard(checkSumAddress)
copyToClipboard(checksumAddress(selected))
},
},
this.context.t('copyAddress'),

@ -4,6 +4,8 @@ const h = require('react-hyperscript')
const inherits = require('util').inherits
const TokenBalance = require('./token-balance')
const Identicon = require('./identicon')
const currencyFormatter = require('currency-formatter')
const currencies = require('currency-formatter/currencies')
const { formatBalance, generateBalanceObject } = require('../util')
@ -97,9 +99,17 @@ BalanceComponent.prototype.renderFiatAmount = function (fiatDisplayNumber, fiatS
const shouldNotRenderFiat = fiatDisplayNumber === 'N/A' || Number(fiatDisplayNumber) === 0
if (shouldNotRenderFiat) return null
const upperCaseFiatSuffix = fiatSuffix.toUpperCase()
const display = currencies.find(currency => currency.code === upperCaseFiatSuffix)
? currencyFormatter.format(Number(fiatDisplayNumber), {
code: upperCaseFiatSuffix,
})
: `${fiatPrefix}${fiatDisplayNumber} ${upperCaseFiatSuffix}`
return h('div.fiat-amount', {
style: {},
}, `${fiatPrefix}${fiatDisplayNumber} ${fiatSuffix}`)
}, display)
}
BalanceComponent.prototype.getTokenBalance = function (formattedBalance, shorten) {
@ -117,5 +127,9 @@ BalanceComponent.prototype.getFiatDisplayNumber = function (formattedBalance, co
const splitBalance = formattedBalance.split(' ')
return (Number(splitBalance[0]) * conversionRate).toFixed(2)
const convertedNumber = (Number(splitBalance[0]) * conversionRate)
const wholePart = Math.floor(convertedNumber)
const decimalPart = convertedNumber - wholePart
return wholePart + Number(decimalPart.toPrecision(2))
}

@ -7,7 +7,7 @@ const connect = require('react-redux').connect
const Dropdown = require('./dropdown').Dropdown
const DropdownMenuItem = require('./dropdown').DropdownMenuItem
const Identicon = require('../../identicon')
const ethUtil = require('ethereumjs-util')
const { checksumAddress } = require('../../../util')
const copyToClipboard = require('copy-to-clipboard')
const { formatBalance } = require('../../../util')
@ -311,8 +311,7 @@ class AccountDropdowns extends Component {
closeMenu: () => {},
onClick: () => {
const { selected } = this.props
const checkSumAddress = selected && ethUtil.toChecksumAddress(selected)
copyToClipboard(checkSumAddress)
copyToClipboard(checksumAddress(selected))
},
style: Object.assign(
dropdownMenuItemStyle,

@ -11,6 +11,7 @@ const ensRE = /.+\..+$/
const ZERO_ADDRESS = '0x0000000000000000000000000000000000000000'
const connect = require('react-redux').connect
const ToAutoComplete = require('./send/to-autocomplete')
const log = require('loglevel')
EnsInput.contextTypes = {
t: PropTypes.func,

@ -1,6 +1,7 @@
const { Component } = require('react')
const h = require('react-hyperscript')
const PropTypes = require('prop-types')
const classnames = require('classnames')
class LoadingIndicator extends Component {
renderMessage () {
@ -10,14 +11,16 @@ class LoadingIndicator extends Component {
render () {
return (
h('.full-flex-height.loading-overlay', {}, [
h('.loading-overlay', {
className: classnames({ 'loading-overlay--full-screen': this.props.fullScreen }),
}, [
h('.flex-center.flex-column', [
h('img', {
src: 'images/loading.svg',
}),
h('br'),
this.renderMessage(),
]),
])
)
}
@ -25,6 +28,7 @@ class LoadingIndicator extends Component {
LoadingIndicator.propTypes = {
loadingMessage: PropTypes.string,
fullScreen: PropTypes.bool,
}
module.exports = LoadingIndicator

@ -3,12 +3,13 @@ const PropTypes = require('prop-types')
const h = require('react-hyperscript')
const inherits = require('util').inherits
const connect = require('react-redux').connect
const ethUtil = require('ethereumjs-util')
const { stripHexPrefix } = require('ethereumjs-util')
const actions = require('../../actions')
const AccountModalContainer = require('./account-modal-container')
const { getSelectedIdentity } = require('../../selectors')
const ReadOnlyInput = require('../readonly-input')
const copyToClipboard = require('copy-to-clipboard')
const { checksumAddress } = require('../../util')
function mapStateToProps (state) {
return {
@ -60,7 +61,7 @@ ExportPrivateKeyModal.prototype.renderPasswordLabel = function (privateKey) {
}
ExportPrivateKeyModal.prototype.renderPasswordInput = function (privateKey) {
const plainKey = privateKey && ethUtil.stripHexPrefix(privateKey)
const plainKey = privateKey && stripHexPrefix(privateKey)
return privateKey
? h(ReadOnlyInput, {
@ -121,7 +122,7 @@ ExportPrivateKeyModal.prototype.render = function () {
h(ReadOnlyInput, {
wrapperClass: 'ellip-address-wrapper',
inputClass: 'qr-ellip-address ellip-address',
value: address,
value: checksumAddress(address),
}),
h('div.account-modal-divider'),

@ -5,7 +5,8 @@ const connect = require('react-redux').connect
const FadeModal = require('boron').FadeModal
const actions = require('../../actions')
const isMobileView = require('../../../lib/is-mobile-view')
const isPopupOrNotification = require('../../../../app/scripts/lib/is-popup-or-notification')
const { getEnvironmentType } = require('../../../../app/scripts/lib/util')
const { ENVIRONMENT_TYPE_POPUP } = require('../../../../app/scripts/lib/enums')
// Modal Components
const BuyOptions = require('./buy-options-modal')
@ -162,7 +163,7 @@ const MODALS = {
],
mobileModalStyle: {
width: '95%',
top: isPopupOrNotification() === 'popup' ? '52vh' : '36.5vh',
top: getEnvironmentType(window.location.href) === ENVIRONMENT_TYPE_POPUP ? '52vh' : '36.5vh',
},
laptopModalStyle: {
width: '449px',
@ -179,7 +180,7 @@ const MODALS = {
],
mobileModalStyle: {
width: '95%',
top: isPopupOrNotification() === 'popup' ? '52vh' : '36.5vh',
top: getEnvironmentType(window.location.href) === ENVIRONMENT_TYPE_POPUP ? '52vh' : '36.5vh',
},
laptopModalStyle: {
width: '449px',
@ -196,7 +197,7 @@ const MODALS = {
],
mobileModalStyle: {
width: '95%',
top: isPopupOrNotification() === 'popup' ? '52vh' : '36.5vh',
top: getEnvironmentType(window.location.href) === ENVIRONMENT_TYPE_POPUP ? '52vh' : '36.5vh',
},
laptopModalStyle: {
width: '449px',
@ -208,7 +209,7 @@ const MODALS = {
contents: h(ConfirmResetAccount),
mobileModalStyle: {
width: '95%',
top: isPopupOrNotification() === 'popup' ? '52vh' : '36.5vh',
top: getEnvironmentType(window.location.href) === ENVIRONMENT_TYPE_POPUP ? '52vh' : '36.5vh',
},
laptopModalStyle: {
width: '473px',

@ -5,6 +5,7 @@ const { Redirect, withRouter } = require('react-router-dom')
const { compose } = require('recompose')
const h = require('react-hyperscript')
const actions = require('../../actions')
const log = require('loglevel')
// init
const NewKeyChainScreen = require('../../new-keychain')

@ -6,6 +6,7 @@ const connect = require('../../../metamask-connect')
const h = require('react-hyperscript')
const { createNewVaultAndRestore, unMarkPasswordForgotten } = require('../../../actions')
const { DEFAULT_ROUTE } = require('../../../routes')
const log = require('loglevel')
class RestoreVaultPage extends PersistentForm {
constructor (props) {

@ -3,6 +3,14 @@ const PropTypes = require('prop-types')
const h = require('react-hyperscript')
class Info extends Component {
constructor (props) {
super(props)
this.state = {
version: global.platform.getVersion(),
}
}
renderLogo () {
return (
h('div.settings__info-logo-wrapper', [
@ -76,7 +84,7 @@ class Info extends Component {
this.renderLogo(),
h('div.settings__info-item', [
h('div.settings__info-version-header', 'MetaMask Version'),
h('div.settings__info-version-number', '4.0.0'),
h('div.settings__info-version-number', this.state.version),
]),
h('div.settings__info-item', [
h(

@ -11,7 +11,8 @@ const {
setNetworkEndpoints,
setFeatureFlag,
} = require('../../actions')
const environmentType = require('../../../../app/scripts/lib/environment-type')
const { ENVIRONMENT_TYPE_POPUP } = require('../../../../app/scripts/lib/enums')
const { getEnvironmentType } = require('../../../../app/scripts/lib/util')
const getCaretCoordinates = require('textarea-caret')
const EventEmitter = require('events').EventEmitter
const Mascot = require('../mascot')
@ -131,7 +132,7 @@ class UnlockScreen extends Component {
this.props.markPasswordForgotten()
this.props.history.push(RESTORE_VAULT_ROUTE)
if (environmentType() === 'popup') {
if (getEnvironmentType(window.location.href) === ENVIRONMENT_TYPE_POPUP) {
global.platform.openExtensionInBrowser()
}
},

@ -23,6 +23,8 @@ const {
const GasFeeDisplay = require('../send/gas-fee-display-v2')
const SenderToRecipient = require('../sender-to-recipient')
const NetworkDisplay = require('../network-display')
const currencyFormatter = require('currency-formatter')
const currencies = require('currency-formatter/currencies')
const { MIN_GAS_PRICE_HEX } = require('../send/send-constants')
const { SEND_ROUTE, DEFAULT_ROUTE } = require('../../routes')
@ -275,6 +277,16 @@ ConfirmSendEther.prototype.getData = function () {
}
}
ConfirmSendEther.prototype.convertToRenderableCurrency = function (value, currencyCode) {
const upperCaseCurrencyCode = currencyCode.toUpperCase()
return currencies.find(currency => currency.code === upperCaseCurrencyCode)
? currencyFormatter.format(Number(value), {
code: upperCaseCurrencyCode,
})
: value
}
ConfirmSendEther.prototype.editTransaction = function (txMeta) {
const { editTransaction, history } = this.props
editTransaction(txMeta)
@ -319,6 +331,9 @@ ConfirmSendEther.prototype.render = function () {
? 'Increase your gas fee to attempt to overwrite and speed up your transaction'
: 'Please review your transaction.'
const convertedAmountInFiat = this.convertToRenderableCurrency(amountInFIAT, currentCurrency)
const convertedTotalInFiat = this.convertToRenderableCurrency(totalInFIAT, currentCurrency)
// This is from the latest master
// It handles some of the errors that we are not currently handling
// Leaving as comments fo reference
@ -365,7 +380,7 @@ ConfirmSendEther.prototype.render = function () {
// `You're sending to Recipient ...${toAddress.slice(toAddress.length - 4)}`,
// ]),
h('h3.flex-center.confirm-screen-send-amount', [`${amountInFIAT}`]),
h('h3.flex-center.confirm-screen-send-amount', [`${convertedAmountInFiat}`]),
h('h3.flex-center.confirm-screen-send-amount-currency', [ currentCurrency.toUpperCase() ]),
h('div.flex-center.confirm-memo-wrapper', [
h('h3.confirm-screen-send-memo', [ memo ? `"${memo}"` : '' ]),
@ -412,7 +427,7 @@ ConfirmSendEther.prototype.render = function () {
]),
h('div.confirm-screen-section-column', [
h('div.confirm-screen-row-info', `${totalInFIAT} ${currentCurrency.toUpperCase()}`),
h('div.confirm-screen-row-info', `${convertedTotalInFiat} ${currentCurrency.toUpperCase()}`),
h('div.confirm-screen-row-detail', `${totalInETH} ETH`),
]),

@ -27,6 +27,8 @@ const {
calcTokenAmount,
} = require('../../token-util')
const classnames = require('classnames')
const currencyFormatter = require('currency-formatter')
const currencies = require('currency-formatter/currencies')
const { MIN_GAS_PRICE_HEX } = require('../send/send-constants')
@ -48,7 +50,7 @@ module.exports = compose(
function mapStateToProps (state, ownProps) {
const { token: { symbol }, txData } = ownProps
const { token: { address }, txData } = ownProps
const { txParams } = txData || {}
const tokenData = txParams.data && abiDecoder.decodeMethod(txParams.data)
@ -59,7 +61,7 @@ function mapStateToProps (state, ownProps) {
} = state.metamask
const accounts = state.metamask.accounts
const selectedAddress = getSelectedAddress(state)
const tokenExchangeRate = getTokenExchangeRate(state, symbol)
const tokenExchangeRate = getTokenExchangeRate(state, address)
const { balance } = accounts[selectedAddress]
return {
conversionRate,
@ -75,12 +77,9 @@ function mapStateToProps (state, ownProps) {
}
function mapDispatchToProps (dispatch, ownProps) {
const { token: { symbol } } = ownProps
return {
backToAccountDetail: address => dispatch(actions.backToAccountDetail(address)),
cancelTransaction: ({ id }) => dispatch(actions.cancelTx({ id })),
updateTokenExchangeRate: () => dispatch(actions.updateTokenExchangeRate(symbol)),
editTransaction: txMeta => {
const { token: { address } } = ownProps
const { txParams = {}, id } = txMeta
@ -203,7 +202,6 @@ ConfirmSendToken.prototype.componentWillMount = function () {
.balanceOf(selectedAddress)
.then(usersToken => {
})
this.props.updateTokenExchangeRate()
this.updateComponentSendErrors({})
}
@ -322,10 +320,12 @@ ConfirmSendToken.prototype.renderHeroAmount = function () {
const txParams = txMeta.txParams || {}
const { memo = '' } = txParams
const convertedAmountInFiat = this.convertToRenderableCurrency(fiatAmount, currentCurrency)
return fiatAmount
? (
h('div.confirm-send-token__hero-amount-wrapper', [
h('h3.flex-center.confirm-screen-send-amount', `${fiatAmount}`),
h('h3.flex-center.confirm-screen-send-amount', `${convertedAmountInFiat}`),
h('h3.flex-center.confirm-screen-send-amount-currency', currentCurrency),
h('div.flex-center.confirm-memo-wrapper', [
h('h3.confirm-screen-send-memo', [ memo ? `"${memo}"` : '' ]),
@ -373,6 +373,9 @@ ConfirmSendToken.prototype.renderTotalPlusGas = function () {
const { fiat: fiatAmount, token: tokenAmount } = this.getAmount()
const { fiat: fiatGas, token: tokenGas } = this.getGasFee()
const totalInFIAT = fiatAmount && fiatGas && addCurrencies(fiatAmount, fiatGas)
const convertedTotalInFiat = this.convertToRenderableCurrency(totalInFIAT, currentCurrency)
return fiatAmount && fiatGas
? (
h('section.flex-row.flex-center.confirm-screen-row.confirm-screen-total-box ', [
@ -382,7 +385,7 @@ ConfirmSendToken.prototype.renderTotalPlusGas = function () {
]),
h('div.confirm-screen-section-column', [
h('div.confirm-screen-row-info', `${addCurrencies(fiatAmount, fiatGas)} ${currentCurrency}`),
h('div.confirm-screen-row-info', `${convertedTotalInFiat} ${currentCurrency}`),
h('div.confirm-screen-row-detail', `${addCurrencies(tokenAmount, tokenGas || '0')} ${symbol}`),
]),
])
@ -417,6 +420,16 @@ ConfirmSendToken.prototype.renderErrorMessage = function (message) {
: null
}
ConfirmSendToken.prototype.convertToRenderableCurrency = function (value, currencyCode) {
const upperCaseCurrencyCode = currencyCode.toUpperCase()
return currencies.find(currency => currency.code === upperCaseCurrencyCode)
? currencyFormatter.format(Number(value), {
code: upperCaseCurrencyCode,
})
: value
}
ConfirmSendToken.prototype.render = function () {
const txMeta = this.gatherTxMeta()
const {

@ -1,6 +1,7 @@
const Component = require('react').Component
const connect = require('react-redux').connect
const h = require('react-hyperscript')
const PropTypes = require('prop-types')
const clone = require('clone')
const abi = require('human-standard-token-abi')
const abiDecoder = require('abi-decoder')
@ -11,6 +12,7 @@ const util = require('../../util')
const ConfirmSendEther = require('./confirm-send-ether')
const ConfirmSendToken = require('./confirm-send-token')
const ConfirmDeployContract = require('./confirm-deploy-contract')
const Loading = require('../loading')
const TX_TYPES = {
DEPLOY_CONTRACT: 'deploy_contract',
@ -53,10 +55,24 @@ function PendingTx () {
}
}
PendingTx.prototype.componentWillMount = async function () {
PendingTx.prototype.componentDidMount = function () {
this.setTokenData()
}
PendingTx.prototype.componentDidUpdate = function (prevProps, prevState) {
if (prevState.isFetching) {
this.setTokenData()
}
}
PendingTx.prototype.setTokenData = async function () {
const txMeta = this.gatherTxMeta()
const txParams = txMeta.txParams || {}
if (txMeta.loadingDefaults) {
return
}
if (!txParams.to) {
return this.setState({
transactionType: TX_TYPES.DEPLOY_CONTRACT,
@ -125,7 +141,10 @@ PendingTx.prototype.render = function () {
const { sendTransaction } = this.props
if (isFetching) {
return h('noscript')
return h(Loading, {
fullScreen: true,
loadingMessage: this.context.t('generatingTransaction'),
})
}
switch (transactionType) {
@ -150,6 +169,12 @@ PendingTx.prototype.render = function () {
sendTransaction,
})
default:
return h('noscript')
return h(Loading, {
fullScreen: true,
})
}
}
PendingTx.contextTypes = {
t: PropTypes.func,
}

@ -3,8 +3,9 @@ const h = require('react-hyperscript')
const qrCode = require('qrcode-npm').qrcode
const inherits = require('util').inherits
const connect = require('react-redux').connect
const isHexPrefixed = require('ethereumjs-util').isHexPrefixed
const { isHexPrefixed } = require('ethereumjs-util')
const ReadOnlyInput = require('./readonly-input')
const { checksumAddress } = require('../util')
module.exports = connect(mapStateToProps)(QrCodeView)
@ -24,16 +25,16 @@ function QrCodeView () {
QrCodeView.prototype.render = function () {
const props = this.props
const Qr = props.Qr
const address = `${isHexPrefixed(Qr.data) ? 'ethereum:' : ''}${Qr.data}`
const { message, data } = props.Qr
const address = `${isHexPrefixed(data) ? 'ethereum:' : ''}${data}`
const qrImage = qrCode(4, 'M')
qrImage.addData(address)
qrImage.make()
return h('.div.flex-column.flex-center', [
Array.isArray(Qr.message)
Array.isArray(message)
? h('.message-container', this.renderMultiMessage())
: Qr.message && h('.qr-header', Qr.message),
: message && h('.qr-header', message),
this.props.warning ? this.props.warning && h('span.error.flex-center', {
style: {
@ -50,7 +51,7 @@ QrCodeView.prototype.render = function () {
h(ReadOnlyInput, {
wrapperClass: 'ellip-address-wrapper',
inputClass: 'qr-ellip-address',
value: Qr.data,
value: checksumAddress(data),
}),
])
}

@ -2,6 +2,7 @@ const Component = require('react').Component
const h = require('react-hyperscript')
const inherits = require('util').inherits
const connect = require('react-redux').connect
const { checksumAddress } = require('../../util')
const Identicon = require('../identicon')
const CurrencyDisplay = require('./currency-display')
const { conversionRateSelector, getCurrentCurrency } = require('../../selectors')
@ -56,7 +57,7 @@ AccountListItem.prototype.render = function () {
]),
displayAddress && name && h('div.account-list-item__account-address', address),
displayAddress && name && h('div.account-list-item__account-address', checksumAddress(address)),
displayBalance && h(CurrencyDisplay, {
primaryCurrency: 'ETH',

@ -3,6 +3,8 @@ const h = require('react-hyperscript')
const inherits = require('util').inherits
const CurrencyInput = require('../currency-input')
const { conversionUtil, multiplyCurrencies } = require('../../conversion-util')
const currencyFormatter = require('currency-formatter')
const currencies = require('currency-formatter/currencies')
module.exports = CurrencyDisplay
@ -53,12 +55,32 @@ CurrencyDisplay.prototype.getValueToRender = function () {
})
}
CurrencyDisplay.prototype.getConvertedValueToRender = function (nonFormattedValue) {
const { primaryCurrency, convertedCurrency, conversionRate } = this.props
let convertedValue = conversionUtil(nonFormattedValue, {
fromNumericBase: 'dec',
fromCurrency: primaryCurrency,
toCurrency: convertedCurrency,
numberOfDecimals: 2,
conversionRate,
})
convertedValue = Number(convertedValue).toFixed(2)
const upperCaseCurrencyCode = convertedCurrency.toUpperCase()
return currencies.find(currency => currency.code === upperCaseCurrencyCode)
? currencyFormatter.format(Number(convertedValue), {
code: upperCaseCurrencyCode,
})
: convertedValue
}
CurrencyDisplay.prototype.render = function () {
const {
className = 'currency-display',
primaryBalanceClassName = 'currency-display__input',
convertedBalanceClassName = 'currency-display__converted-value',
conversionRate,
primaryCurrency,
convertedCurrency,
readOnly = false,
@ -68,14 +90,7 @@ CurrencyDisplay.prototype.render = function () {
const valueToRender = this.getValueToRender()
let convertedValue = conversionUtil(valueToRender, {
fromNumericBase: 'dec',
fromCurrency: primaryCurrency,
toCurrency: convertedCurrency,
numberOfDecimals: 2,
conversionRate,
})
convertedValue = Number(convertedValue).toFixed(2)
const convertedValueToRender = this.getConvertedValueToRender(valueToRender)
return h('div', {
className,
@ -108,7 +123,7 @@ CurrencyDisplay.prototype.render = function () {
h('div', {
className: convertedBalanceClassName,
}, `${convertedValue} ${convertedCurrency.toUpperCase()}`),
}, `${convertedValueToRender} ${convertedCurrency.toUpperCase()}`),
])

@ -66,7 +66,6 @@ function mapDispatchToProps (dispatch) {
showCustomizeGasModal: () => dispatch(actions.showModal({ name: 'CUSTOMIZE_GAS' })),
estimateGas: params => dispatch(actions.estimateGas(params)),
getGasPrice: () => dispatch(actions.getGasPrice()),
updateTokenExchangeRate: token => dispatch(actions.updateTokenExchangeRate(token)),
signTokenTx: (tokenAddress, toAddress, amount, txData) => (
dispatch(actions.signTokenTx(tokenAddress, toAddress, amount, txData))
),

@ -4,6 +4,7 @@ const inherits = require('util').inherits
const TokenTracker = require('eth-token-tracker')
const connect = require('react-redux').connect
const selectors = require('../selectors')
const log = require('loglevel')
function mapStateToProps (state) {
return {

@ -16,7 +16,7 @@ function mapStateToProps (state) {
currentCurrency: state.metamask.currentCurrency,
selectedTokenAddress: state.metamask.selectedTokenAddress,
userAddress: selectors.getSelectedAddress(state),
tokenExchangeRates: state.metamask.tokenExchangeRates,
contractExchangeRates: state.metamask.contractExchangeRates,
conversionRate: state.metamask.conversionRate,
sidebarOpen: state.appState.sidebarOpen,
}
@ -25,7 +25,6 @@ function mapStateToProps (state) {
function mapDispatchToProps (dispatch) {
return {
setSelectedToken: address => dispatch(actions.setSelectedToken(address)),
updateTokenExchangeRate: token => dispatch(actions.updateTokenExchangeRate(token)),
hideSidebar: () => dispatch(actions.hideSidebar()),
}
}
@ -41,15 +40,6 @@ function TokenCell () {
}
}
TokenCell.prototype.componentWillMount = function () {
const {
updateTokenExchangeRate,
symbol,
} = this.props
updateTokenExchangeRate(symbol)
}
TokenCell.prototype.render = function () {
const { tokenMenuOpen } = this.state
const props = this.props
@ -60,7 +50,7 @@ TokenCell.prototype.render = function () {
network,
setSelectedToken,
selectedTokenAddress,
tokenExchangeRates,
contractExchangeRates,
conversionRate,
hideSidebar,
sidebarOpen,
@ -68,15 +58,13 @@ TokenCell.prototype.render = function () {
// userAddress,
} = props
const pair = `${symbol.toLowerCase()}_eth`
let currentTokenToFiatRate
let currentTokenInFiat
let formattedFiat = ''
if (tokenExchangeRates[pair]) {
if (contractExchangeRates[address]) {
currentTokenToFiatRate = multiplyCurrencies(
tokenExchangeRates[pair].rate,
contractExchangeRates[address],
conversionRate
)
currentTokenInFiat = conversionUtil(string, {

@ -6,6 +6,7 @@ const TokenTracker = require('eth-token-tracker')
const TokenCell = require('./token-cell.js')
const connect = require('react-redux').connect
const selectors = require('../selectors')
const log = require('loglevel')
function mapStateToProps (state) {
return {

@ -9,6 +9,7 @@ const abiDecoder = require('abi-decoder')
abiDecoder.addABI(abi)
const Identicon = require('./identicon')
const contractMap = require('eth-contract-metadata')
const { checksumAddress } = require('../util')
const actions = require('../actions')
const { conversionUtil, multiplyCurrencies } = require('../conversion-util')
@ -27,7 +28,7 @@ function mapStateToProps (state) {
return {
tokens: state.metamask.tokens,
currentCurrency: getCurrentCurrency(state),
tokenExchangeRates: state.metamask.tokenExchangeRates,
contractExchangeRates: state.metamask.contractExchangeRates,
selectedAddressTxList: state.metamask.selectedAddressTxList,
}
}
@ -74,10 +75,12 @@ TxListItem.prototype.getAddressText = function () {
const decodedData = txParams.data && abiDecoder.decodeMethod(txParams.data)
const { name: txDataName, params = [] } = decodedData || {}
const { value } = params[0] || {}
const checksummedAddress = checksumAddress(address)
const checksummedValue = checksumAddress(value)
let addressText
if (txDataName === 'transfer' || address) {
const addressToRender = txDataName === 'transfer' ? value : address
const addressToRender = txDataName === 'transfer' ? checksummedValue : checksummedAddress
addressText = `${addressToRender.slice(0, 10)}...${addressToRender.slice(-4)}`
} else if (isMsg) {
addressText = this.context.t('sigRequest')
@ -142,31 +145,29 @@ TxListItem.prototype.getTokenInfo = async function () {
({ decimals, symbol } = await tokenInfoGetter(toAddress))
}
return { decimals, symbol }
return { decimals, symbol, address: toAddress }
}
TxListItem.prototype.getSendTokenTotal = async function () {
const {
txParams = {},
conversionRate,
tokenExchangeRates,
contractExchangeRates,
currentCurrency,
} = this.props
const decodedData = txParams.data && abiDecoder.decodeMethod(txParams.data)
const { params = [] } = decodedData || {}
const { value } = params[1] || {}
const { decimals, symbol } = await this.getTokenInfo()
const { decimals, symbol, address } = await this.getTokenInfo()
const total = calcTokenAmount(value, decimals)
const pair = symbol && `${symbol.toLowerCase()}_eth`
let tokenToFiatRate
let totalInFiat
if (tokenExchangeRates[pair]) {
if (contractExchangeRates[address]) {
tokenToFiatRate = multiplyCurrencies(
tokenExchangeRates[pair].rate,
contractExchangeRates[address],
conversionRate
)
@ -220,7 +221,6 @@ TxListItem.prototype.resubmit = function () {
TxListItem.prototype.render = function () {
const {
transactionStatus,
transactionAmount,
onClick,
transactionId,
dateString,
@ -229,7 +229,6 @@ TxListItem.prototype.render = function () {
txParams,
} = this.props
const { total, fiatTotal, isTokenTx } = this.state
const showFiatTotal = transactionAmount !== '0x0' && fiatTotal
return h(`div${className || ''}`, {
key: transactionId,
@ -288,7 +287,7 @@ TxListItem.prototype.render = function () {
h('span.tx-list-value', total),
showFiatTotal && h('span.tx-list-fiat-value', fiatTotal),
fiatTotal && h('span.tx-list-fiat-value', fiatTotal),
]),
]),

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

Loading…
Cancel
Save