From 45f91facf163a06f98170e14388c00c9638b9629 Mon Sep 17 00:00:00 2001 From: Jaco Greeff Date: Wed, 2 Aug 2017 13:56:09 +0200 Subject: [PATCH] Don't copy source window --- js/package-lock.json | 286 +++++++++++-------------- js/package.json | 7 + js/src/DappRequests/Request/request.js | 5 +- js/src/DappRequests/store.js | 27 ++- 4 files changed, 163 insertions(+), 162 deletions(-) diff --git a/js/package-lock.json b/js/package-lock.json index 23c69156f..189744d8a 100644 --- a/js/package-lock.json +++ b/js/package-lock.json @@ -45,11 +45,11 @@ } }, "@parity/dapp-account": { - "version": "github:paritytech/dapp-account#ff1c7962b11007af474c0b12865dd26a66e2fdd5", + "version": "github:paritytech/dapp-account#be1279faf2ac430ec44ab2d4769ca68eacdac9b6", "requires": { "@parity/api": "github:paritytech/js-api#ade4a6750292a2918676039ea53eea20c4c728bc", - "@parity/dapp-accounts": "github:paritytech/dapp-accounts#a81d4e61db299c83b40409564dc0b3198ab04b89", - "@parity/dapp-address": "github:paritytech/dapp-address#b53a09038f6689facf6c67a376dae207c3437dac", + "@parity/dapp-accounts": "github:paritytech/dapp-accounts#235036f3e726e206391b15cf8c3e9d8956bc121d", + "@parity/dapp-address": "github:paritytech/dapp-address#8e1431a2e57d2fe8805fc184848148f8dce34210", "@parity/dapp-vaults": "github:paritytech/dapp-vaults#de86d2bf21f1d0283b7f9fd7b3159a280e321818", "@parity/parity.js": "1.8.7", "@parity/shapeshift": "github:paritytech/js-shapeshift#59d71436b678390a3abdea37d58b5ff06edfd750", @@ -67,7 +67,7 @@ } }, "@parity/dapp-accounts": { - "version": "github:paritytech/dapp-accounts#a81d4e61db299c83b40409564dc0b3198ab04b89", + "version": "github:paritytech/dapp-accounts#235036f3e726e206391b15cf8c3e9d8956bc121d", "requires": { "@parity/api": "github:paritytech/js-api#ade4a6750292a2918676039ea53eea20c4c728bc", "@parity/dapp-vaults": "github:paritytech/dapp-vaults#de86d2bf21f1d0283b7f9fd7b3159a280e321818", @@ -83,10 +83,10 @@ } }, "@parity/dapp-address": { - "version": "github:paritytech/dapp-address#b53a09038f6689facf6c67a376dae207c3437dac", + "version": "github:paritytech/dapp-address#8e1431a2e57d2fe8805fc184848148f8dce34210", "requires": { "@parity/api": "github:paritytech/js-api#ade4a6750292a2918676039ea53eea20c4c728bc", - "@parity/dapp-account": "github:paritytech/dapp-account#ff1c7962b11007af474c0b12865dd26a66e2fdd5", + "@parity/dapp-account": "github:paritytech/dapp-account#be1279faf2ac430ec44ab2d4769ca68eacdac9b6", "@parity/dapp-addresses": "github:paritytech/dapp-addresses#b1ecac83d0d2921ad882695dc0f4fbfc7e442cf2", "@parity/shared": "github:paritytech/js-shared#49f3719ffc732962efc9017daf0e30bd384bfbc2", "@parity/ui": "github:paritytech/js-ui#7f7235fe696defd547ace030041f2f52c842c7dc", @@ -97,21 +97,85 @@ "version": "github:paritytech/dapp-addresses#b1ecac83d0d2921ad882695dc0f4fbfc7e442cf2", "requires": { "@parity/api": "github:paritytech/js-api#ade4a6750292a2918676039ea53eea20c4c728bc", - "@parity/dapp-accounts": "github:paritytech/dapp-accounts#a81d4e61db299c83b40409564dc0b3198ab04b89", + "@parity/dapp-accounts": "github:paritytech/dapp-accounts#235036f3e726e206391b15cf8c3e9d8956bc121d", + "@parity/shared": "github:paritytech/js-shared#49f3719ffc732962efc9017daf0e30bd384bfbc2", + "@parity/ui": "github:paritytech/js-ui#7f7235fe696defd547ace030041f2f52c842c7dc", + "recharts": "0.15.2" + } + }, + "@parity/dapp-chaindeploy": { + "version": "github:paritytech/dapp-chaindeploy#dfb12d38e9c0c8a540be0a51681a36685b812963", + "requires": { + "@parity/api": "github:paritytech/js-api#ade4a6750292a2918676039ea53eea20c4c728bc", + "@parity/shared": "github:paritytech/js-shared#49f3719ffc732962efc9017daf0e30bd384bfbc2", + "react": "15.6.1", + "react-dom": "15.6.1" + } + }, + "@parity/dapp-contract": { + "version": "github:paritytech/dapp-contract#311caba0c0ae14ec84c2cb6ea395990dd4af5d60", + "requires": { + "@parity/api": "github:paritytech/js-api#ade4a6750292a2918676039ea53eea20c4c728bc", + "@parity/dapp-account": "github:paritytech/dapp-account#be1279faf2ac430ec44ab2d4769ca68eacdac9b6", + "@parity/dapp-address": "github:paritytech/dapp-address#8e1431a2e57d2fe8805fc184848148f8dce34210", "@parity/shared": "github:paritytech/js-shared#49f3719ffc732962efc9017daf0e30bd384bfbc2", "@parity/ui": "github:paritytech/js-ui#7f7235fe696defd547ace030041f2f52c842c7dc", "recharts": "0.15.2" } }, "@parity/dapp-contracts": { - "version": "github:paritytech/dapp-contracts#1e7e1d2662bf58419cc148172d5c12db61a3aa92", + "version": "github:paritytech/dapp-contracts#d96a451a540cb46d4fc1300b90c91ebf1421213d", "requires": { "@parity/api": "github:paritytech/js-api#ade4a6750292a2918676039ea53eea20c4c728bc", - "@parity/dapp-account": "github:paritytech/dapp-account#4af7ae5d09ecb662c6be9d97aebeef13d1fc8153", - "@parity/dapp-accounts": "github:paritytech/dapp-accounts#bdf7f53d98e589dc19c305d76fe6ade11292fd61", - "@parity/shared": "github:paritytech/js-shared#9bb1d291d8752a827613889498e380fcd3afa8da", - "@parity/ui": "github:paritytech/js-ui#037782bd16e8abf1c169143aa61749a44b94489b", + "@parity/dapp-account": "github:paritytech/dapp-account#be1279faf2ac430ec44ab2d4769ca68eacdac9b6", + "@parity/dapp-accounts": "github:paritytech/dapp-accounts#235036f3e726e206391b15cf8c3e9d8956bc121d", + "@parity/shared": "github:paritytech/js-shared#49f3719ffc732962efc9017daf0e30bd384bfbc2", + "@parity/ui": "github:paritytech/js-ui#7f7235fe696defd547ace030041f2f52c842c7dc", "recharts": "0.15.2" + } + }, + "@parity/dapp-dapp-accounts": { + "version": "github:paritytech/dapp-dapp-accounts#c2e748cfcbd3e4deb09cdf1bab5634576b961010", + "requires": { + "@parity/api": "github:paritytech/js-api#ade4a6750292a2918676039ea53eea20c4c728bc", + "@parity/shared": "github:paritytech/js-shared#49f3719ffc732962efc9017daf0e30bd384bfbc2", + "@parity/ui": "github:paritytech/js-ui#7f7235fe696defd547ace030041f2f52c842c7dc", + "recharts": "0.15.2" + } + }, + "@parity/dapp-dapp-methods": { + "version": "github:paritytech/dapp-dapp-methods#c38f3f7ad253fe675f24ec442bf8d763325aa058", + "requires": { + "@parity/api": "github:paritytech/js-api#ade4a6750292a2918676039ea53eea20c4c728bc", + "@parity/shared": "github:paritytech/js-shared#49f3719ffc732962efc9017daf0e30bd384bfbc2", + "@parity/ui": "github:paritytech/js-ui#7f7235fe696defd547ace030041f2f52c842c7dc", + "recharts": "0.15.2" + } + }, + "@parity/dapp-develop": { + "version": "github:paritytech/dapp-develop#899c49dd7d384ebd1ebcbf3c42291acbdc257c10", + "requires": { + "@parity/api": "github:paritytech/js-api#ade4a6750292a2918676039ea53eea20c4c728bc", + "@parity/dapp-contracts": "github:paritytech/dapp-contracts#d96a451a540cb46d4fc1300b90c91ebf1421213d", + "@parity/parity.js": "1.8.7", + "@parity/shared": "github:paritytech/js-shared#49f3719ffc732962efc9017daf0e30bd384bfbc2", + "@parity/ui": "github:paritytech/js-ui#7f7235fe696defd547ace030041f2f52c842c7dc", + "oo7": "0.5.3", + "oo7-parity": "0.6.8", + "oo7-react": "0.4.5", + "parity-reactive-ui": "0.4.5", + "recharts": "0.15.2" + } + }, + "@parity/dapp-githubhint": { + "version": "github:paritytech/dapp-githubhint#10b394b8cd4f90bc83b9b0da7dfbe034f8cd9f33", + "requires": { + "@parity/api": "github:paritytech/js-api#ade4a6750292a2918676039ea53eea20c4c728bc", + "@parity/shared": "github:paritytech/js-shared#9bb1d291d8752a827613889498e380fcd3afa8da", + "moment": "2.17.0", + "react": "15.6.1", + "react-dom": "15.6.1", + "react-tap-event-plugin": "2.0.1" }, "dependencies": { "@parity/api": { @@ -134,43 +198,6 @@ "store": "2.0.12" } }, - "@parity/dapp-account": { - "version": "github:paritytech/dapp-account#4af7ae5d09ecb662c6be9d97aebeef13d1fc8153", - "requires": { - "@parity/api": "github:paritytech/js-api#ade4a6750292a2918676039ea53eea20c4c728bc", - "@parity/dapp-accounts": "github:paritytech/dapp-accounts#bdf7f53d98e589dc19c305d76fe6ade11292fd61", - "@parity/dapp-address": "github:paritytech/dapp-address#a53e424768984f03d504e942f2835e20482be956", - "@parity/dapp-vaults": "github:paritytech/dapp-vaults#d97679804d81a5a5b4d6064931211b7f802e335e", - "@parity/parity.js": "1.8.7", - "@parity/shapeshift": "github:paritytech/js-shapeshift#59d71436b678390a3abdea37d58b5ff06edfd750", - "@parity/shared": "github:paritytech/js-shared#9bb1d291d8752a827613889498e380fcd3afa8da", - "@parity/ui": "github:paritytech/js-ui#037782bd16e8abf1c169143aa61749a44b94489b", - "lodash": "4.17.2", - "oo7": "0.5.3", - "oo7-parity": "0.6.8", - "oo7-react": "0.4.5", - "parity-reactive-ui": "0.4.5", - "phoneformat.js": "1.0.3", - "react-intl": "2.1.5", - "recharts": "0.15.2" - }, - "dependencies": { - "lodash": { - "version": "4.17.2", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.2.tgz", - "integrity": "sha1-NKMFW6vgTOQkZ7YH1wAHLH/2v0I=" - } - } - }, - "@parity/dapp-accounts": { - "version": "github:paritytech/dapp-accounts#bdf7f53d98e589dc19c305d76fe6ade11292fd61" - }, - "@parity/dapp-address": { - "version": "github:paritytech/dapp-address#a53e424768984f03d504e942f2835e20482be956" - }, - "@parity/dapp-vaults": { - "version": "github:paritytech/dapp-vaults#d97679804d81a5a5b4d6064931211b7f802e335e" - }, "@parity/ledger": { "version": "github:paritytech/js-ledger#c363adfb9192aa56b7b498b0ad90bc4032bcd6ab", "requires": { @@ -178,12 +205,58 @@ "u2f-api-polyfill": "0.4.3" } }, - "@parity/shapeshift": { - "version": "github:paritytech/js-shapeshift#59d71436b678390a3abdea37d58b5ff06edfd750", + "@parity/shared": { + "version": "github:paritytech/js-shared#9bb1d291d8752a827613889498e380fcd3afa8da", "requires": { - "node-fetch": "1.6.3" + "@parity/ledger": "github:paritytech/js-ledger#c363adfb9192aa56b7b498b0ad90bc4032bcd6ab", + "loglevel": "1.4.1", + "mobx": "2.6.4", + "mobx-react": "4.0.3", + "promise-worker": "1.1.1", + "push.js": "0.0.11", + "react-redux": "4.4.6", + "redux": "3.6.0", + "redux-actions": "1.1.0", + "redux-thunk": "2.1.0", + "scryptsy": "2.0.0", + "serviceworker-webpack-plugin": "0.2.0", + "solc": "github:ngotchac/solc-js#04eb38cc3003fba8cb3656653a7941ed36408818", + "worker-loader": "0.8.1", + "yargs": "6.6.0" } }, + "lodash": { + "version": "4.17.4", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.4.tgz", + "integrity": "sha1-eCA6TRwyiuHYbcpkYONptX9AVa4=" + }, + "store": { + "version": "2.0.12", + "resolved": "https://registry.npmjs.org/store/-/store-2.0.12.tgz", + "integrity": "sha1-jFNOKguDH3K3X8XxEZhXxE711ZM=" + } + } + }, + "@parity/dapp-vaults": { + "version": "github:paritytech/dapp-vaults#de86d2bf21f1d0283b7f9fd7b3159a280e321818", + "requires": { + "@parity/api": "github:paritytech/js-api#ade4a6750292a2918676039ea53eea20c4c728bc", + "@parity/shared": "github:paritytech/js-shared#49f3719ffc732962efc9017daf0e30bd384bfbc2", + "@parity/ui": "github:paritytech/js-ui#7f7235fe696defd547ace030041f2f52c842c7dc", + "recharts": "0.15.2" + } + }, + "@parity/dapp-wallet": { + "version": "github:paritytech/dapp-wallet#711f4381cef112e8d11f0cd6cbfa15d87eea0b54", + "requires": { + "@parity/api": "github:paritytech/js-api#ade4a6750292a2918676039ea53eea20c4c728bc", + "@parity/dapp-account": "github:paritytech/dapp-account#be1279faf2ac430ec44ab2d4769ca68eacdac9b6", + "@parity/dapp-address": "github:paritytech/dapp-address#8e1431a2e57d2fe8805fc184848148f8dce34210", + "@parity/shared": "github:paritytech/js-shared#9bb1d291d8752a827613889498e380fcd3afa8da", + "@parity/ui": "github:paritytech/js-ui#037782bd16e8abf1c169143aa61749a44b94489b", + "recharts": "0.15.2" + }, + "dependencies": { "@parity/shared": { "version": "github:paritytech/js-shared#9bb1d291d8752a827613889498e380fcd3afa8da", "requires": { @@ -285,19 +358,9 @@ "solc": "github:ngotchac/solc-js#04eb38cc3003fba8cb3656653a7941ed36408818", "yargs": "6.6.0" } - }, - "lodash": { - "version": "4.17.2", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.2.tgz", - "integrity": "sha1-NKMFW6vgTOQkZ7YH1wAHLH/2v0I=" } } }, - "lodash": { - "version": "4.17.4", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.4.tgz", - "integrity": "sha1-eCA6TRwyiuHYbcpkYONptX9AVa4=" - }, "store": { "version": "2.0.12", "resolved": "https://registry.npmjs.org/store/-/store-2.0.12.tgz", @@ -305,100 +368,6 @@ } } }, - "@parity/dapp-develop": { - "version": "github:paritytech/dapp-develop#899c49dd7d384ebd1ebcbf3c42291acbdc257c10", - "requires": { - "@parity/api": "github:paritytech/js-api#ade4a6750292a2918676039ea53eea20c4c728bc", - "@parity/dapp-contracts": "github:paritytech/dapp-contracts#1e7e1d2662bf58419cc148172d5c12db61a3aa92", - "@parity/parity.js": "1.8.7", - "@parity/shared": "github:paritytech/js-shared#49f3719ffc732962efc9017daf0e30bd384bfbc2", - "@parity/ui": "github:paritytech/js-ui#7f7235fe696defd547ace030041f2f52c842c7dc", - "oo7": "0.5.3", - "oo7-parity": "0.6.8", - "oo7-react": "0.4.5", - "parity-reactive-ui": "0.4.5", - "recharts": "0.15.2" - } - }, - "@parity/dapp-githubhint": { - "version": "github:paritytech/dapp-githubhint#10b394b8cd4f90bc83b9b0da7dfbe034f8cd9f33", - "requires": { - "@parity/api": "github:paritytech/js-api#ade4a6750292a2918676039ea53eea20c4c728bc", - "@parity/shared": "github:paritytech/js-shared#9bb1d291d8752a827613889498e380fcd3afa8da", - "moment": "2.17.0", - "react": "15.6.1", - "react-dom": "15.6.1", - "react-tap-event-plugin": "2.0.1" - }, - "dependencies": { - "@parity/api": { - "version": "github:paritytech/js-api#ade4a6750292a2918676039ea53eea20c4c728bc", - "requires": { - "@parity/abi": "github:paritytech/js-abi#414765a476d88b6fb9f3398c99a946021957d07a", - "@parity/jsonrpc": "github:paritytech/js-jsonrpc#89a6e441370f55d8fe995e27007f60da29b6672b", - "@parity/wordlist": "1.1.0", - "bignumber.js": "3.0.1", - "blockies": "0.0.2", - "es6-error": "4.0.0", - "ethereumjs-tx": "1.3.3", - "eventemitter3": "2.0.3", - "isomorphic-fetch": "2.2.1", - "js-sha3": "0.5.5", - "keythereum": "0.4.6", - "lodash": "4.17.4", - "node-fetch": "1.6.3", - "secp256k1": "3.2.5", - "store": "2.0.12" - } - }, - "@parity/ledger": { - "version": "github:paritytech/js-ledger#c363adfb9192aa56b7b498b0ad90bc4032bcd6ab", - "requires": { - "u2f-api": "0.0.9", - "u2f-api-polyfill": "0.4.3" - } - }, - "@parity/shared": { - "version": "github:paritytech/js-shared#9bb1d291d8752a827613889498e380fcd3afa8da", - "requires": { - "@parity/ledger": "github:paritytech/js-ledger#c363adfb9192aa56b7b498b0ad90bc4032bcd6ab", - "loglevel": "1.4.1", - "mobx": "2.6.4", - "mobx-react": "4.0.3", - "promise-worker": "1.1.1", - "push.js": "0.0.11", - "react-redux": "4.4.6", - "redux": "3.6.0", - "redux-actions": "1.1.0", - "redux-thunk": "2.1.0", - "scryptsy": "2.0.0", - "serviceworker-webpack-plugin": "0.2.0", - "solc": "github:ngotchac/solc-js#04eb38cc3003fba8cb3656653a7941ed36408818", - "worker-loader": "0.8.1", - "yargs": "6.6.0" - } - }, - "lodash": { - "version": "4.17.4", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.4.tgz", - "integrity": "sha1-eCA6TRwyiuHYbcpkYONptX9AVa4=" - }, - "store": { - "version": "2.0.12", - "resolved": "https://registry.npmjs.org/store/-/store-2.0.12.tgz", - "integrity": "sha1-jFNOKguDH3K3X8XxEZhXxE711ZM=" - } - } - }, - "@parity/dapp-vaults": { - "version": "github:paritytech/dapp-vaults#de86d2bf21f1d0283b7f9fd7b3159a280e321818", - "requires": { - "@parity/api": "github:paritytech/js-api#ade4a6750292a2918676039ea53eea20c4c728bc", - "@parity/shared": "github:paritytech/js-shared#49f3719ffc732962efc9017daf0e30bd384bfbc2", - "@parity/ui": "github:paritytech/js-ui#7f7235fe696defd547ace030041f2f52c842c7dc", - "recharts": "0.15.2" - } - }, "@parity/etherscan": { "version": "github:paritytech/js-etherscan#efe859ac7d2a8a3cc05e01c689b7fa58f47f8b87", "requires": { @@ -10158,6 +10127,11 @@ "integrity": "sha1-soqmKIorn8ZRA1x3EfZathkDMaY=", "dev": true }, + "lodash.clonedeep": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/lodash.clonedeep/-/lodash.clonedeep-4.5.0.tgz", + "integrity": "sha1-4j8/nE+Pvd6HJSnBBxhXoIblzO8=" + }, "lodash.create": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/lodash.create/-/lodash.create-3.1.1.tgz", diff --git a/js/package.json b/js/package.json index 85c3ad08c..bf67cd935 100644 --- a/js/package.json +++ b/js/package.json @@ -157,9 +157,15 @@ "@parity/dapp-accounts": "paritytech/dapp-accounts", "@parity/dapp-address": "paritytech/dapp-address", "@parity/dapp-addresses": "paritytech/dapp-addresses", + "@parity/dapp-chaindeploy": "paritytech/dapp-chaindeploy", + "@parity/dapp-contract": "paritytech/dapp-contract", + "@parity/dapp-contracts": "paritytech/dapp-contracts", + "@parity/dapp-dapp-accounts": "paritytech/dapp-dapp-accounts", + "@parity/dapp-dapp-methods": "paritytech/dapp-dapp-methods", "@parity/dapp-develop": "paritytech/dapp-develop", "@parity/dapp-githubhint": "paritytech/dapp-githubhint", "@parity/dapp-vaults": "paritytech/dapp-vaults", + "@parity/dapp-wallet": "paritytech/dapp-wallet", "@parity/shared": "paritytech/js-shared", "@parity/ui": "paritytech/js-ui", "es6-error": "4.0.0", @@ -170,6 +176,7 @@ "format-number": "2.0.1", "isomorphic-fetch": "2.2.1", "lodash": "4.17.2", + "lodash.clonedeep": "4.5.0", "moment": "2.17.0", "prop-types": "15.5.10", "react": "15.6.1", diff --git a/js/src/DappRequests/Request/request.js b/js/src/DappRequests/Request/request.js index 43a932903..ddf33fa07 100644 --- a/js/src/DappRequests/Request/request.js +++ b/js/src/DappRequests/Request/request.js @@ -35,7 +35,10 @@ export default function Request ({ appId, className, approveRequest, denyRequest id='dappRequests.request.info' defaultMessage='Received request for {method} from {appName}' values={ { - appName: app.name, + appName: + app + ? app.name + : appId, method } } /> diff --git a/js/src/DappRequests/store.js b/js/src/DappRequests/store.js index f0cca1536..1d7183e6f 100644 --- a/js/src/DappRequests/store.js +++ b/js/src/DappRequests/store.js @@ -32,6 +32,8 @@ export default class Store { @observable requests = []; @observable tokens = {}; + sources = {}; + constructor (provider) { this.provider = provider; this.permissions = store.get(LS_PERMISSIONS) || {}; @@ -71,13 +73,24 @@ export default class Store { @action removeRequest = (_queueId) => { this.requests = this.requests.filter(({ queueId }) => queueId !== _queueId); + delete this.sources[_queueId]; } @action queueRequest = (request) => { - const appId = this.tokens[request.data.token]; + const { data, origin, source } = request; + const appId = this.tokens[data.token]; + let queueId = ++nextQueueId; - this.requests = this.requests.concat([{ appId, queueId, request }]); + this.sources[queueId] = source; + this.requests = this.requests.concat([{ + appId, + queueId, + request: { + data, + origin + } + }]); } @action addTokenPermission = (method, token) => { @@ -89,8 +102,11 @@ export default class Store { this.savePermissions(); } - @action approveSingleRequest = ({ queueId, request: { data, source } }) => { + @action approveSingleRequest = ({ queueId, request: { data } }) => { + const source = this.sources[queueId]; + this.removeRequest(queueId); + if (data.api) { this.executePubsubCall(data, source); } else { @@ -114,10 +130,11 @@ export default class Store { } @action rejectRequest = (queueId) => { - const { request } = this.findRequest(queueId); + const { request: { data } } = this.findRequest(queueId); + const source = this.sources[queueId]; this.removeRequest(queueId); - this.rejectMessage(request); + this.rejectMessage(source, data); } @action rejectMessage = (source, { id, from, method, token }) => {