Skip to content

Commit

Permalink
dApp: clear some Metamask warnings, fix transfer progress dialog
Browse files Browse the repository at this point in the history
  • Loading branch information
andrevmatos committed Aug 27, 2020
1 parent 813f1b6 commit 1bfa9aa
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 14 deletions.
11 changes: 5 additions & 6 deletions raiden-dapp/src/services/web3-provider.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
export class Web3Provider {
static async provider(rpcEndpoint?: string) {
const ethereum = window.ethereum;
let provider = null;

if (rpcEndpoint) {
Expand All @@ -9,17 +8,17 @@ export class Web3Provider {
} else {
provider = rpcEndpoint;
}
} else if (typeof ethereum !== 'undefined') {
await ethereum.enable();
provider = ethereum;
} else if (typeof window.ethereum !== 'undefined') {
window.ethereum.autoRefreshOnNetworkChange = false;
await window.ethereum.request({ method: 'eth_requestAccounts' });
provider = window.ethereum;
} else if (window.web3) {
provider = window.web3.currentProvider;
}

/* istanbul ignore next */
if (provider && provider.isMetaMask) {
provider.autoRefreshOnNetworkChange = false;
provider.on('networkChanged', () =>
provider.on('chainChanged', () =>
window.location.replace(window.location.origin)
);
}
Expand Down
10 changes: 2 additions & 8 deletions raiden-dapp/src/store/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -242,15 +242,9 @@ const store: StoreOptions<RootState> = {
return pendingTransfers;
}, {}),
transfer: (state: RootState) => (paymentId: BigNumber) => {
const key = Object.keys(state.transfers).find(
(key) => state.transfers[key].paymentId === paymentId
return Object.values(state.transfers).find((transfer) =>
transfer.paymentId.eq(paymentId)
);

if (key) {
return state.transfers[key];
}

return undefined;
},
isConnected: (state: RootState): boolean => {
return (
Expand Down

0 comments on commit 1bfa9aa

Please sign in to comment.