Skip to content

Commit

Permalink
fix: simplify dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
iamacook committed Jul 13, 2023
1 parent 7e3cbf3 commit 826623a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/hooks/wallets/useProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ export const useProvider = (isSafeApp = false): JsonRpcProvider | Web3Provider |
const wallet = useWallet()
const rpcMap = useAppSelector(selectRpc)

const customRpc = chain ? rpcMap[chain.chainId] : undefined

return useMemo(() => {
if (!chain) {
return
Expand All @@ -25,10 +23,12 @@ export const useProvider = (isSafeApp = false): JsonRpcProvider | Web3Provider |
return createWeb3(wallet.provider)
}

const customRpc = rpcMap[chain.chainId]

if (!isSafeApp) {
return createWeb3ReadOnly(chain.rpcUri, customRpc)
} else {
return createSafeAppsWeb3Provider(chain.safeAppsRpcUri, customRpc)
}
}, [chain, wallet, isSafeApp, customRpc])
}, [chain, wallet, isSafeApp, rpcMap])
}

0 comments on commit 826623a

Please sign in to comment.