diff options
author | Brandon Millman <brandon@0xproject.com> | 2018-11-10 08:21:32 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-11-10 08:21:32 +0800 |
commit | 397b4e289015f9bb0831c1a0ce6fee601670b487 (patch) | |
tree | 43fe5262fbe6e2ee4e9b19e34ac6784f9eab1a7b /packages/instant/src/redux/async_data.ts | |
parent | 26cbe7ae6646d97c286e58756c23a93de32ae37b (diff) | |
parent | 38896c9358c07d722b2a24d458e6c949b802fa37 (diff) | |
download | dexon-0x-contracts-397b4e289015f9bb0831c1a0ce6fee601670b487.tar dexon-0x-contracts-397b4e289015f9bb0831c1a0ce6fee601670b487.tar.gz dexon-0x-contracts-397b4e289015f9bb0831c1a0ce6fee601670b487.tar.bz2 dexon-0x-contracts-397b4e289015f9bb0831c1a0ce6fee601670b487.tar.lz dexon-0x-contracts-397b4e289015f9bb0831c1a0ce6fee601670b487.tar.xz dexon-0x-contracts-397b4e289015f9bb0831c1a0ce6fee601670b487.tar.zst dexon-0x-contracts-397b4e289015f9bb0831c1a0ce6fee601670b487.zip |
Merge pull request #1239 from 0xProject/feature/instant/privacy-mode
[instant] Handle privacy mode in wallets
Diffstat (limited to 'packages/instant/src/redux/async_data.ts')
-rw-r--r-- | packages/instant/src/redux/async_data.ts | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/packages/instant/src/redux/async_data.ts b/packages/instant/src/redux/async_data.ts index a47c7a605..b920ac914 100644 --- a/packages/instant/src/redux/async_data.ts +++ b/packages/instant/src/redux/async_data.ts @@ -40,14 +40,19 @@ export const asyncData = { const { store, shouldSetToLoading } = options; const { providerState } = store.getState(); const web3Wrapper = providerState.web3Wrapper; + const provider = providerState.provider; if (shouldSetToLoading && providerState.account.state !== AccountState.Loading) { store.dispatch(actions.setAccountStateLoading()); } let availableAddresses: string[]; try { - availableAddresses = await web3Wrapper.getAvailableAddressesAsync(); + // TODO(bmillman): Add support at the web3Wrapper level for calling `eth_requestAccounts` instead of calling enable here + const isPrivacyModeEnabled = !_.isUndefined((provider as any).enable); + availableAddresses = isPrivacyModeEnabled + ? await (provider as any).enable() + : await web3Wrapper.getAvailableAddressesAsync(); } catch (e) { - store.dispatch(actions.setAccountStateError()); + store.dispatch(actions.setAccountStateLocked()); return; } if (!_.isEmpty(availableAddresses)) { |