aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkumavis <kumavis@users.noreply.github.com>2016-08-23 10:19:53 +0800
committerGitHub <noreply@github.com>2016-08-23 10:19:53 +0800
commit5c9ca21ba3224fd54430a3c518b825ff6cd112f3 (patch)
tree5e11c75a4b1fdbb6d2d351c4ab9f1f50c8b45cb1
parenta0d0245343a48e16baddf3db9e509a0f8d98c2fe (diff)
parentf9c58c07466d181a895cd38b1c3049a11e02cb99 (diff)
downloadtangerine-wallet-browser-5c9ca21ba3224fd54430a3c518b825ff6cd112f3.tar
tangerine-wallet-browser-5c9ca21ba3224fd54430a3c518b825ff6cd112f3.tar.gz
tangerine-wallet-browser-5c9ca21ba3224fd54430a3c518b825ff6cd112f3.tar.bz2
tangerine-wallet-browser-5c9ca21ba3224fd54430a3c518b825ff6cd112f3.tar.lz
tangerine-wallet-browser-5c9ca21ba3224fd54430a3c518b825ff6cd112f3.tar.xz
tangerine-wallet-browser-5c9ca21ba3224fd54430a3c518b825ff6cd112f3.tar.zst
tangerine-wallet-browser-5c9ca21ba3224fd54430a3c518b825ff6cd112f3.zip
Merge branch 'master' into i390-TransactionLimit
-rw-r--r--app/_locales/es/messages.json10
-rw-r--r--app/_locales/es_419/messages.json10
-rw-r--r--app/_locales/zh_CN/messages.json10
-rw-r--r--app/scripts/lib/inpage-provider.js30
4 files changed, 58 insertions, 2 deletions
diff --git a/app/_locales/es/messages.json b/app/_locales/es/messages.json
new file mode 100644
index 000000000..78fc64dbf
--- /dev/null
+++ b/app/_locales/es/messages.json
@@ -0,0 +1,10 @@
+{
+ "appName": {
+ "message": "MetaMask",
+ "description": "The name of the application"
+ },
+ "appDescription": {
+ "message": "Administración de identidad en Ethereum",
+ "description": "The description of the application"
+ }
+}
diff --git a/app/_locales/es_419/messages.json b/app/_locales/es_419/messages.json
new file mode 100644
index 000000000..78fc64dbf
--- /dev/null
+++ b/app/_locales/es_419/messages.json
@@ -0,0 +1,10 @@
+{
+ "appName": {
+ "message": "MetaMask",
+ "description": "The name of the application"
+ },
+ "appDescription": {
+ "message": "Administración de identidad en Ethereum",
+ "description": "The description of the application"
+ }
+}
diff --git a/app/_locales/zh_CN/messages.json b/app/_locales/zh_CN/messages.json
new file mode 100644
index 000000000..fc87384e5
--- /dev/null
+++ b/app/_locales/zh_CN/messages.json
@@ -0,0 +1,10 @@
+{
+ "appName": {
+ "message": "MetaMask",
+ "description": "The name of the application"
+ },
+ "appDescription": {
+ "message": "以太坊身份管理",
+ "description": "The description of the application"
+ }
+}
diff --git a/app/scripts/lib/inpage-provider.js b/app/scripts/lib/inpage-provider.js
index b3ed3d9e2..65354cd3d 100644
--- a/app/scripts/lib/inpage-provider.js
+++ b/app/scripts/lib/inpage-provider.js
@@ -33,8 +33,16 @@ function MetamaskInpageProvider (connectionStream) {
})
asyncProvider.on('error', console.error.bind(console))
self.asyncProvider = asyncProvider
- // overwrite own sendAsync method
- self.sendAsync = asyncProvider.sendAsync.bind(asyncProvider)
+ // handle sendAsync requests via asyncProvider
+ self.sendAsync = function(payload, cb){
+ // rewrite request ids
+ var request = jsonrpcMessageTransform(payload, (message) => {
+ message.id = createRandomId()
+ return message
+ })
+ // forward to asyncProvider
+ asyncProvider.sendAsync(request, cb)
+ }
}
MetamaskInpageProvider.prototype.send = function (payload) {
@@ -92,3 +100,21 @@ function remoteStoreWithLocalStorageCache (storageKey) {
return store
}
+
+function createRandomId(){
+ const extraDigits = 3
+ // 13 time digits
+ const datePart = new Date().getTime() * Math.pow(10, extraDigits)
+ // 3 random digits
+ const extraPart = Math.floor(Math.random() * Math.pow(10, extraDigits))
+ // 16 digits
+ return datePart + extraPart
+}
+
+function jsonrpcMessageTransform(payload, transformFn){
+ if (Array.isArray(payload)) {
+ return payload.map(transformFn)
+ } else {
+ return transformFn(payload)
+ }
+} \ No newline at end of file