From 07c2baaabb708f32ef6f58ca8bf802b03b4a2a55 Mon Sep 17 00:00:00 2001 From: Bill Hsu Date: Sat, 23 Nov 2019 16:49:26 +0800 Subject: [PATCH 1/3] Add sample circleci config --- .circleci/config.yml | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 .circleci/config.yml diff --git a/.circleci/config.yml b/.circleci/config.yml new file mode 100644 index 0000000..93cb2ad --- /dev/null +++ b/.circleci/config.yml @@ -0,0 +1,37 @@ +# Javascript Node CircleCI 2.0 configuration file +# +# Check https://circleci.com/docs/2.0/language-javascript/ for more details +# +version: 2 +jobs: + build: + docker: + # specify the version you desire here + - image: circleci/node:7.10 + + # Specify service dependencies here if necessary + # CircleCI maintains a library of pre-built images + # documented at https://circleci.com/docs/2.0/circleci-images/ + # - image: circleci/mongo:3.4.4 + + working_directory: ~/repo + + steps: + - checkout + + # Download and cache dependencies + - restore_cache: + keys: + - v1-dependencies-{{ checksum "package.json" }} + # fallback to using the latest cache if no exact match is found + - v1-dependencies- + + - run: npm install + + - save_cache: + paths: + - node_modules + key: v1-dependencies-{{ checksum "package.json" }} + + # run tests! + - run: npm run lint From f0e66f5c31ef6c65bb39232786cb8d63887a2014 Mon Sep 17 00:00:00 2001 From: Bill Hsu Date: Sat, 23 Nov 2019 16:55:49 +0800 Subject: [PATCH 2/3] Aaoie --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 93cb2ad..6b61833 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -7,7 +7,7 @@ jobs: build: docker: # specify the version you desire here - - image: circleci/node:7.10 + - image: circleci/node:11.0.0 # Specify service dependencies here if necessary # CircleCI maintains a library of pre-built images From c25d56a6182d0f4a91ad8a4f2c34acc2f0b7da9e Mon Sep 17 00:00:00 2001 From: StillFantastic Date: Mon, 11 Jan 2021 17:00:20 +0800 Subject: [PATCH 3/3] Update window.ethereum method --- src/index.js | 6 +++++- src/utils/ethutil.js | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/index.js b/src/index.js index 3c74972..e72f551 100644 --- a/src/index.js +++ b/src/index.js @@ -46,8 +46,12 @@ window.addEventListener("load", async() => { if (window.ethereum) { window.web3 = new constants.Web3(window.ethereum) + window.ethereum.autoRefreshOnNetworkChange = false + window.ethereum.on("chainChanged", () => { + document.location.reload() + }) try { - await window.ethereum.enable() + await window.ethereum.request({method: "eth_requestAccounts"}) } catch (error) { console.error(error) console.error("Refresh the page to approve/reject again") diff --git a/src/utils/ethutil.js b/src/utils/ethutil.js index 5ebde03..2cb1026 100644 --- a/src/utils/ethutil.js +++ b/src/utils/ethutil.js @@ -188,5 +188,5 @@ function logger(req, res, next, end) { } export function attachLogger() { - web3.currentProvider.rpcEngine._middleware.unshift(logger) + web3.currentProvider._rpcEngine._middleware.unshift(logger) }