From e93e25429cd29cd1fd75b5007780667126074966 Mon Sep 17 00:00:00 2001 From: Chen Yu Date: Thu, 27 Sep 2018 19:49:16 +0800 Subject: [PATCH 1/2] Update/update neuron web ui (#44) * Publish - @nervos/chain@0.18.0 - @nervos/signer@1.0.37 - neuron-web@0.1.8 * update: update neuron web ui * fix: display account --- packages/neuron-web/README.md | 4 ++ packages/neuron-web/build/asset-manifest.json | 4 +- packages/neuron-web/build/service-worker.js | 2 +- .../src/components/EncryptedMessage/index.tsx | 1 + .../src/components/Transaction/index.tsx | 5 ++- .../src/containers/Accounts/index.tsx | 4 +- .../src/containers/Options/index.tsx | 7 +++- .../src/containers/Transactions/index.tsx | 42 ++++++++++--------- 8 files changed, 44 insertions(+), 25 deletions(-) diff --git a/packages/neuron-web/README.md b/packages/neuron-web/README.md index 7f150f5..220fc25 100644 --- a/packages/neuron-web/README.md +++ b/packages/neuron-web/README.md @@ -2,6 +2,10 @@ Neuron Web is an extension of chrome similar to [MetaMask](https://metamask.io). +# Disclaimer + +Neuron Web is just a debugger tool now, do not take it as an official wallet. + # Quick Start ## Enable nervos in dapp to interact with NeuronWeb diff --git a/packages/neuron-web/build/asset-manifest.json b/packages/neuron-web/build/asset-manifest.json index 1daae99..20dedd3 100644 --- a/packages/neuron-web/build/asset-manifest.json +++ b/packages/neuron-web/build/asset-manifest.json @@ -1,6 +1,6 @@ { "main.css": "static/css/main.87567d85.css", "main.css.map": "static/css/main.87567d85.css.map", - "main.js": "static/js/main.3b7f5f86.js", - "main.js.map": "static/js/main.3b7f5f86.js.map" + "main.js": "static/js/main.c0847399.js", + "main.js.map": "static/js/main.c0847399.js.map" } \ No newline at end of file diff --git a/packages/neuron-web/build/service-worker.js b/packages/neuron-web/build/service-worker.js index ded3cc7..e2c1974 100644 --- a/packages/neuron-web/build/service-worker.js +++ b/packages/neuron-web/build/service-worker.js @@ -1 +1 @@ -"use strict";var precacheConfig=[["/index.html","a8510a7732dbebbcac25d01277292736"],["/static/css/main.87567d85.css","28533fb43ad10fc6ff9890a7d9bb31b1"]],cacheName="sw-precache-v3-sw-precache-webpack-plugin-"+(self.registration?self.registration.scope:""),ignoreUrlParametersMatching=[/^utm_/],addDirectoryIndex=function(e,t){var n=new URL(e);return"/"===n.pathname.slice(-1)&&(n.pathname+=t),n.toString()},cleanResponse=function(t){return t.redirected?("body"in t?Promise.resolve(t.body):t.blob()).then(function(e){return new Response(e,{headers:t.headers,status:t.status,statusText:t.statusText})}):Promise.resolve(t)},createCacheKey=function(e,t,n,r){var a=new URL(e);return r&&a.pathname.match(r)||(a.search+=(a.search?"&":"")+encodeURIComponent(t)+"="+encodeURIComponent(n)),a.toString()},isPathWhitelisted=function(e,t){if(0===e.length)return!0;var n=new URL(t).pathname;return e.some(function(e){return n.match(e)})},stripIgnoredUrlParameters=function(e,n){var t=new URL(e);return t.hash="",t.search=t.search.slice(1).split("&").map(function(e){return e.split("=")}).filter(function(t){return n.every(function(e){return!e.test(t[0])})}).map(function(e){return e.join("=")}).join("&"),t.toString()},hashParamName="_sw-precache",urlsToCacheKeys=new Map(precacheConfig.map(function(e){var t=e[0],n=e[1],r=new URL(t,self.location),a=createCacheKey(r,hashParamName,n,/\.\w{8}\./);return[r.toString(),a]}));function setOfCachedUrls(e){return e.keys().then(function(e){return e.map(function(e){return e.url})}).then(function(e){return new Set(e)})}self.addEventListener("install",function(e){e.waitUntil(caches.open(cacheName).then(function(r){return setOfCachedUrls(r).then(function(n){return Promise.all(Array.from(urlsToCacheKeys.values()).map(function(t){if(!n.has(t)){var e=new Request(t,{credentials:"same-origin"});return fetch(e).then(function(e){if(!e.ok)throw new Error("Request for "+t+" returned a response with status "+e.status);return cleanResponse(e).then(function(e){return r.put(t,e)})})}}))})}).then(function(){return self.skipWaiting()}))}),self.addEventListener("activate",function(e){var n=new Set(urlsToCacheKeys.values());e.waitUntil(caches.open(cacheName).then(function(t){return t.keys().then(function(e){return Promise.all(e.map(function(e){if(!n.has(e.url))return t.delete(e)}))})}).then(function(){return self.clients.claim()}))}),self.addEventListener("fetch",function(t){if("GET"===t.request.method){var e,n=stripIgnoredUrlParameters(t.request.url,ignoreUrlParametersMatching),r="index.html";(e=urlsToCacheKeys.has(n))||(n=addDirectoryIndex(n,r),e=urlsToCacheKeys.has(n));var a="/index.html";!e&&"navigate"===t.request.mode&&isPathWhitelisted(["^(?!\\/__).*"],t.request.url)&&(n=new URL(a,self.location).toString(),e=urlsToCacheKeys.has(n)),e&&t.respondWith(caches.open(cacheName).then(function(e){return e.match(urlsToCacheKeys.get(n)).then(function(e){if(e)return e;throw Error("The cached response that was expected is missing.")})}).catch(function(e){return console.warn('Couldn\'t serve response for "%s" from cache: %O',t.request.url,e),fetch(t.request)}))}}); \ No newline at end of file +"use strict";var precacheConfig=[["/index.html","734dce84bc80a96131ca1f6a0989cfe4"],["/static/css/main.87567d85.css","28533fb43ad10fc6ff9890a7d9bb31b1"]],cacheName="sw-precache-v3-sw-precache-webpack-plugin-"+(self.registration?self.registration.scope:""),ignoreUrlParametersMatching=[/^utm_/],addDirectoryIndex=function(e,t){var n=new URL(e);return"/"===n.pathname.slice(-1)&&(n.pathname+=t),n.toString()},cleanResponse=function(t){return t.redirected?("body"in t?Promise.resolve(t.body):t.blob()).then(function(e){return new Response(e,{headers:t.headers,status:t.status,statusText:t.statusText})}):Promise.resolve(t)},createCacheKey=function(e,t,n,r){var a=new URL(e);return r&&a.pathname.match(r)||(a.search+=(a.search?"&":"")+encodeURIComponent(t)+"="+encodeURIComponent(n)),a.toString()},isPathWhitelisted=function(e,t){if(0===e.length)return!0;var n=new URL(t).pathname;return e.some(function(e){return n.match(e)})},stripIgnoredUrlParameters=function(e,n){var t=new URL(e);return t.hash="",t.search=t.search.slice(1).split("&").map(function(e){return e.split("=")}).filter(function(t){return n.every(function(e){return!e.test(t[0])})}).map(function(e){return e.join("=")}).join("&"),t.toString()},hashParamName="_sw-precache",urlsToCacheKeys=new Map(precacheConfig.map(function(e){var t=e[0],n=e[1],r=new URL(t,self.location),a=createCacheKey(r,hashParamName,n,/\.\w{8}\./);return[r.toString(),a]}));function setOfCachedUrls(e){return e.keys().then(function(e){return e.map(function(e){return e.url})}).then(function(e){return new Set(e)})}self.addEventListener("install",function(e){e.waitUntil(caches.open(cacheName).then(function(r){return setOfCachedUrls(r).then(function(n){return Promise.all(Array.from(urlsToCacheKeys.values()).map(function(t){if(!n.has(t)){var e=new Request(t,{credentials:"same-origin"});return fetch(e).then(function(e){if(!e.ok)throw new Error("Request for "+t+" returned a response with status "+e.status);return cleanResponse(e).then(function(e){return r.put(t,e)})})}}))})}).then(function(){return self.skipWaiting()}))}),self.addEventListener("activate",function(e){var n=new Set(urlsToCacheKeys.values());e.waitUntil(caches.open(cacheName).then(function(t){return t.keys().then(function(e){return Promise.all(e.map(function(e){if(!n.has(e.url))return t.delete(e)}))})}).then(function(){return self.clients.claim()}))}),self.addEventListener("fetch",function(t){if("GET"===t.request.method){var e,n=stripIgnoredUrlParameters(t.request.url,ignoreUrlParametersMatching),r="index.html";(e=urlsToCacheKeys.has(n))||(n=addDirectoryIndex(n,r),e=urlsToCacheKeys.has(n));var a="/index.html";!e&&"navigate"===t.request.mode&&isPathWhitelisted(["^(?!\\/__).*"],t.request.url)&&(n=new URL(a,self.location).toString(),e=urlsToCacheKeys.has(n)),e&&t.respondWith(caches.open(cacheName).then(function(e){return e.match(urlsToCacheKeys.get(n)).then(function(e){if(e)return e;throw Error("The cached response that was expected is missing.")})}).catch(function(e){return console.warn('Couldn\'t serve response for "%s" from cache: %O',t.request.url,e),fetch(t.request)}))}}); \ No newline at end of file diff --git a/packages/neuron-web/src/components/EncryptedMessage/index.tsx b/packages/neuron-web/src/components/EncryptedMessage/index.tsx index 08d11b5..b82cecd 100644 --- a/packages/neuron-web/src/components/EncryptedMessage/index.tsx +++ b/packages/neuron-web/src/components/EncryptedMessage/index.tsx @@ -13,6 +13,7 @@ const EncryptedMessage = ({ }) => (
{status === TransactionAction.SENDING ? 'Sending' : ''}
- {Object.keys(transaction).map((key: string) => { + {// Object.keys(transaction) + fields.map((key: string) => { return ( ) diff --git a/packages/neuron-web/src/containers/Accounts/index.tsx b/packages/neuron-web/src/containers/Accounts/index.tsx index 7375438..7c66abd 100644 --- a/packages/neuron-web/src/containers/Accounts/index.tsx +++ b/packages/neuron-web/src/containers/Accounts/index.tsx @@ -5,6 +5,8 @@ import { INervosContext, withNervos } from '../../contexts/nervos' import { handleInputOf } from '../../utils/compActions' import './accounts.css' +const ErrorMessage = 'Private Key Error...' + enum EnterEventType { privateKey = 'PRIVATE_KEY', login = 'LOGIN', @@ -89,7 +91,7 @@ class Accounts extends React.Component { ( +const SwitchWallet = ({ address }: { address: string }) => ( - + ) @@ -37,7 +39,7 @@ class Transactions extends React.Component {copied ? 'Copied' : 'Copy Address'} - + ) : (

No wallet yet, please import wallet first!

- +
)}
@@ -131,20 +133,22 @@ class Transactions extends React.Component{this.props.currentTxHash}
) : null} - {transactions.map(tx => ( -
-
{new Date(tx.timestamp).toLocaleString()}
-
- - {tx.hash} - -
-
- ))} + {transactions.length + ? transactions.map(tx => ( +
+
{new Date(tx.timestamp).toLocaleString()}
+
+ + {tx.hash} + +
+
+ )) + : 'No Transactions'}
Date: Thu, 27 Sep 2018 20:00:26 +0800 Subject: [PATCH 2/2] update: update neuron web version --- packages/neuron-web/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/neuron-web/package.json b/packages/neuron-web/package.json index ad4f3e9..f1e6554 100644 --- a/packages/neuron-web/package.json +++ b/packages/neuron-web/package.json @@ -1,6 +1,6 @@ { "name": "neuron-web", - "version": "0.1.8", + "version": "0.1.0", "private": true, "dependencies": { "@material-ui/core": "^1.5.1",