BUG: Only injected providers are cached as last used provider (#733)

* cache every used provider, not only injected one

* package json update
This commit is contained in:
Mikhail Mikheev 2020-04-03 19:53:58 +04:00 committed by GitHub
parent 94a56d2ebd
commit 727b16481f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 2 additions and 10 deletions

View File

@ -1,6 +1,6 @@
{ {
"name": "safe-react", "name": "safe-react",
"version": "1.9.1", "version": "1.9.2",
"description": "Allowing crypto users manage funds in a safer way", "description": "Allowing crypto users manage funds in a safer way",
"homepage": "https://github.com/gnosis/safe-react#readme", "homepage": "https://github.com/gnosis/safe-react#readme",
"bugs": { "bugs": {

View File

@ -13,7 +13,6 @@ import selector, { type SelectorProps } from './selector'
import { onboard } from '~/components/ConnectButton' import { onboard } from '~/components/ConnectButton'
import { NOTIFICATIONS, showSnackbar } from '~/logic/notifications' import { NOTIFICATIONS, showSnackbar } from '~/logic/notifications'
import { INJECTED_PROVIDERS } from '~/logic/wallets/getWeb3'
import { loadLastUsedProvider } from '~/logic/wallets/store/middlewares/providerWatcher' import { loadLastUsedProvider } from '~/logic/wallets/store/middlewares/providerWatcher'
import { type Info, logComponentStack } from '~/utils/logBoundaries' import { type Info, logComponentStack } from '~/utils/logBoundaries'
@ -38,7 +37,7 @@ class HeaderComponent extends React.PureComponent<Props, State> {
async componentDidMount() { async componentDidMount() {
const lastUsedProvider = await loadLastUsedProvider() const lastUsedProvider = await loadLastUsedProvider()
if (INJECTED_PROVIDERS.includes(lastUsedProvider.toUpperCase()) || process.env.NODE_ENV === 'test') { if (lastUsedProvider) {
const hasSelectedWallet = await onboard.walletSelect(lastUsedProvider) const hasSelectedWallet = await onboard.walletSelect(lastUsedProvider)
if (hasSelectedWallet) { if (hasSelectedWallet) {
await onboard.walletCheck() await onboard.walletCheck()

View File

@ -34,13 +34,6 @@ export const WALLET_PROVIDER = {
TREZOR: 'TREZOR', TREZOR: 'TREZOR',
} }
export const INJECTED_PROVIDERS = [
WALLET_PROVIDER.SAFE,
WALLET_PROVIDER.METAMASK,
WALLET_PROVIDER.OPERA,
WALLET_PROVIDER.DAPPER,
]
export const ETHEREUM_NETWORK_IDS = { export const ETHEREUM_NETWORK_IDS = {
// $FlowFixMe // $FlowFixMe
1: ETHEREUM_NETWORK.MAINNET, 1: ETHEREUM_NETWORK.MAINNET,