Merge branch 'develop' into testing

feature/default_network_editable
tmashuang 7 years ago
commit 848f8f805b
  1. 1
      .circleci/config.yml
  2. 1
      app/scripts/contentscript.js
  3. 13
      docs/porting_to_new_environment.md
  4. 8
      package-lock.json
  5. 2
      package.json
  6. 2
      ui/app/css/itcss/components/modal.scss
  7. 2
      ui/app/css/itcss/components/request-signature.scss
  8. 3
      ui/app/token-util.js
  9. 13432
      yarn.lock

@ -51,7 +51,6 @@ workflows:
- all-tests-pass: - all-tests-pass:
requires: requires:
- test-lint - test-lint
- test-deps
- test-unit - test-unit
- test-e2e-chrome - test-e2e-chrome
- test-e2e-firefox - test-e2e-firefox

@ -175,6 +175,7 @@ function blacklistedDomainCheck () {
'dropbox.com', 'dropbox.com',
'webbyawards.com', 'webbyawards.com',
'cdn.shopify.com/s/javascripts/tricorder/xtld-read-only-frame.html', 'cdn.shopify.com/s/javascripts/tricorder/xtld-read-only-frame.html',
'adyen.com',
] ]
var currentUrl = window.location.href var currentUrl = window.location.href
var currentRegex var currentRegex

@ -1,6 +1,16 @@
# Guide to Porting MetaMask to a New Environment # Guide to Porting MetaMask to a New Environment
MetaMask has been under continuous development for nearly two years now, and we’ve gradually discovered some very useful abstractions, that have allowed us to grow more easily. A couple of those layers together allow MetaMask to be ported to new environments and contexts increasingly easily. MetaMask has been under continuous development for nearly two years now, and we’ve gradually discovered some useful abstractions that have allowed us to grow more easily. A couple of those layers together allow MetaMask to be ported to new environments and contexts increasingly easily (although it still could be easier, and please let us know if you get stuck!)
Before we get started, it's worth becoming familiar with our basic architecture:
![metamask-architecture-diagram](./architecture.png)
The `metamask-background` describes the file at `app/scripts/background.js`, which is the web extension singleton. This context instantiates an instance of the `MetaMask Controller`, which represents the user's accounts, a connection to the blockchain, and the interaction with new Dapps.
When a new site is visited, the WebExtension creates a new `ContentScript` in that page's context, which can be seen at `app/scripts/contentscript.js`. This script represents a per-page setup process, which creates the per-page `web3` api, connects it to the background script via the Port API (wrapped in a [stream abstraction](https://github.com/substack/stream-handbook)), and injected into the DOM before anything loads.
The most confusing part about porting MetaMask to a new platform is the way we provide the Web3 API over a series of streams between contexts. Once you understand how we create the [InpageProvider](../app/scripts/lib/inpage-provider.js) in the [inpage.js script](../app/scripts/inpage.js), you will be able to understand how the [port-stream](../app/scripts/lib/port-stream.js) is just a thin wrapper around the [postMessage API](https://developer.mozilla.org/en-US/docs/Web/API/Window/postMessage), and a similar stream API can be wrapped around any communication channel to communicate with the `MetaMaskController` via its `setupUntrustedCommunication(stream, domain)` method.
### The MetaMask Controller ### The MetaMask Controller
@ -90,3 +100,4 @@ If streams seem new and confusing to you, that's ok, they can seem strange at fi
## Conclusion ## Conclusion
I hope this has been helpful to you! If you have any other questionsm, or points you think need clarification in this guide, please [open an issue on our GitHub](https://github.com/MetaMask/metamask-plugin/issues/new)! I hope this has been helpful to you! If you have any other questionsm, or points you think need clarification in this guide, please [open an issue on our GitHub](https://github.com/MetaMask/metamask-plugin/issues/new)!

8
package-lock.json generated

@ -9154,13 +9154,13 @@
"resolved": "https://registry.npmjs.org/extension-link-enabler/-/extension-link-enabler-1.0.0.tgz", "resolved": "https://registry.npmjs.org/extension-link-enabler/-/extension-link-enabler-1.0.0.tgz",
"integrity": "sha1-V7kZru7fOL6XJwuYmM7nimN+RvM=", "integrity": "sha1-V7kZru7fOL6XJwuYmM7nimN+RvM=",
"requires": { "requires": {
"extensionizer": "1.0.0" "extensionizer": "1.0.1"
} }
}, },
"extensionizer": { "extensionizer": {
"version": "1.0.0", "version": "1.0.1",
"resolved": "https://registry.npmjs.org/extensionizer/-/extensionizer-1.0.0.tgz", "resolved": "https://registry.npmjs.org/extensionizer/-/extensionizer-1.0.1.tgz",
"integrity": "sha1-AcIJu+ptnArLp3Epw6pKmpj8NTg=" "integrity": "sha512-UES5CSOYqshNsWFrpORcQR47+ph6UvQK25mguD44IyeMemt40CG+LTZrH1PgpGUHX3w7ACtNQnmM0J+qEe8G0Q=="
}, },
"external-editor": { "external-editor": {
"version": "2.1.0", "version": "2.1.0",

@ -111,7 +111,7 @@
"ethjs-query": "^0.3.4", "ethjs-query": "^0.3.4",
"express": "^4.15.5", "express": "^4.15.5",
"extension-link-enabler": "^1.0.0", "extension-link-enabler": "^1.0.0",
"extensionizer": "^1.0.0", "extensionizer": "^1.0.1",
"fast-json-patch": "^2.0.4", "fast-json-patch": "^2.0.4",
"fast-levenshtein": "^2.0.6", "fast-levenshtein": "^2.0.6",
"file-loader": "^1.1.11", "file-loader": "^1.1.11",

@ -566,7 +566,6 @@
padding: 30px; padding: 30px;
font-size: 22px; font-size: 22px;
color: $nile-blue; color: $nile-blue;
height: 79px;
} }
&__message { &__message {
@ -832,7 +831,6 @@
padding: 30px; padding: 30px;
font-size: 22px; font-size: 22px;
color: $nile-blue; color: $nile-blue;
height: 79px;
} }
.notification-modal-message { .notification-modal-message {

@ -43,8 +43,6 @@
} }
&__header__text { &__header__text {
height: 29px;
width: 179px;
color: #5B5D67; color: #5B5D67;
font-family: Roboto; font-family: Roboto;
font-size: 22px; font-size: 22px;

@ -1,3 +1,4 @@
const log = require('loglevel')
const util = require('./util') const util = require('./util')
function tokenInfoGetter () { function tokenInfoGetter () {
@ -29,7 +30,7 @@ async function getSymbolAndDecimals (tokenAddress, existingTokens = []) {
token.decimals(), token.decimals(),
]) ])
} catch (err) { } catch (err) {
console.log(`symbol() and decimal() calls for token at address ${tokenAddress} resulted in error:`, err) log.warn(`symbol() and decimal() calls for token at address ${tokenAddress} resulted in error:`, err)
} }
const [ symbol = [], decimals = [] ] = result const [ symbol = [], decimals = [] ] = result

13432
yarn.lock

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save