aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Finlay <flyswatter@users.noreply.github.com>2017-07-06 01:27:21 +0800
committerGitHub <noreply@github.com>2017-07-06 01:27:21 +0800
commitce3d374d800a7213ac5dcc472d058372f3fe813b (patch)
treec21e740a114b03d7a342f4407884013b5da51311
parentbc844ac80a2328330ee84ce9fcd92d28c194ca8a (diff)
parent68fc3603dfe72721e080a80b9a4103408e113c6c (diff)
downloadtangerine-wallet-browser-ce3d374d800a7213ac5dcc472d058372f3fe813b.tar
tangerine-wallet-browser-ce3d374d800a7213ac5dcc472d058372f3fe813b.tar.gz
tangerine-wallet-browser-ce3d374d800a7213ac5dcc472d058372f3fe813b.tar.bz2
tangerine-wallet-browser-ce3d374d800a7213ac5dcc472d058372f3fe813b.tar.lz
tangerine-wallet-browser-ce3d374d800a7213ac5dcc472d058372f3fe813b.tar.xz
tangerine-wallet-browser-ce3d374d800a7213ac5dcc472d058372f3fe813b.tar.zst
tangerine-wallet-browser-ce3d374d800a7213ac5dcc472d058372f3fe813b.zip
Merge pull request #1739 from MetaMask/origin-header
metamask - append dapp origin domain to rpc request
-rw-r--r--app/scripts/metamask-controller.js11
-rw-r--r--package.json4
2 files changed, 11 insertions, 4 deletions
diff --git a/app/scripts/metamask-controller.js b/app/scripts/metamask-controller.js
index 782641b3f..73093dfad 100644
--- a/app/scripts/metamask-controller.js
+++ b/app/scripts/metamask-controller.js
@@ -184,7 +184,9 @@ module.exports = class MetamaskController extends EventEmitter {
eth_syncing: false,
web3_clientVersion: `MetaMask/v${version}`,
},
+ // rpc data source
rpcUrl: this.networkController.getCurrentRpcAddress(),
+ originHttpHeaderKey: 'X-Metamask-Origin',
// account mgmt
getAccounts: (cb) => {
const isUnlocked = this.keyringController.memStore.getState().isUnlocked
@@ -356,8 +358,13 @@ module.exports = class MetamaskController extends EventEmitter {
}
setupProviderConnection (outStream, originDomain) {
- streamIntoProvider(outStream, this.provider, logger)
- function logger (err, request, response) {
+ streamIntoProvider(outStream, this.provider, onRequest, onResponse)
+ // append dapp origin domain to request
+ function onRequest (request) {
+ request.origin = originDomain
+ }
+ // log rpc activity
+ function onResponse (err, request, response) {
if (err) return console.error(err)
if (response.error) {
console.error('Error in RPC response:\n', response.error)
diff --git a/package.json b/package.json
index 3b608af0e..27fe7a84a 100644
--- a/package.json
+++ b/package.json
@@ -124,8 +124,8 @@
"valid-url": "^1.0.9",
"vreme": "^3.0.2",
"web3": "0.19.1",
- "web3-provider-engine": "^13.0.3",
- "web3-stream-provider": "^2.0.6",
+ "web3-provider-engine": "^13.1.1",
+ "web3-stream-provider": "^3.0.1",
"xtend": "^4.0.1"
},
"devDependencies": {