From f374315a5a2972b19b97c68932ff0606e63a6446 Mon Sep 17 00:00:00 2001 From: Daniel Sanchez Date: Mon, 3 Aug 2020 11:29:17 +0200 Subject: [PATCH] Avoid constant creation of new web3 object (#1171) * Avoid constant creation of new web3 object * rollback web3 version, small type fixes in ConnectButton * Use web3 instance in getProviderInfo Co-authored-by: Mikhail Mikheev --- src/components/ConnectButton/index.tsx | 4 ++-- src/logic/wallets/getWeb3.ts | 12 ++++-------- src/logic/wallets/store/actions/fetchProvider.ts | 2 +- .../wallets/store/middlewares/providerWatcher.ts | 2 +- src/test/builder/safe.redux.builder.ts | 3 ++- src/test/safe.dom.create.tsx | 3 ++- src/test/safe.dom.load.tsx | 3 ++- yarn.lock | 5 +++++ 8 files changed, 19 insertions(+), 15 deletions(-) diff --git a/src/components/ConnectButton/index.tsx b/src/components/ConnectButton/index.tsx index 83552dce..a719776f 100644 --- a/src/components/ConnectButton/index.tsx +++ b/src/components/ConnectButton/index.tsx @@ -56,7 +56,7 @@ export const onboard = Onboard({ ], }) -export const onboardUser = async () => { +export const onboardUser = async (): Promise => { // before calling walletSelect you want to check if web3 has been instantiated // which indicates that a wallet has already been selected // and web3 has been instantiated with that provider @@ -65,7 +65,7 @@ export const onboardUser = async () => { return walletSelected && onboard.walletCheck() } -const ConnectButton = (props) => ( +const ConnectButton = (props): React.ReactElement => (