import { waitForGethConnectivity } from 'src/geth/saga'
import { RootState } from 'src/redux/reducers'
import Logger from 'src/utils/Logger'
import { setGasPrice } from 'src/web3/actions'
import { web3 } from 'src/web3/contracts'

const TAG = 'web3/gas'

export const gasPriceSelector = (state: RootState) => state.web3.gasPrice
export const gasPriceLastUpdatedSelector = (state: RootState) => state.web3.gasPriceLastUpdated

export function* refreshGasPrice() {
  yield call(waitForGethConnectivity)

  let gasPrice = yield select(gasPriceSelector)