|
@ -1,13 +1,13 @@ |
|
|
import { call, put, takeLatest } from 'redux-saga/effects' |
|
|
import { call, put, takeLatest } from 'redux-saga/effects' |
|
|
|
|
|
|
|
|
// Initialization Functions
|
|
|
// Initialization Functions
|
|
|
import { getNetworkId, initializeWeb3 } from '../web3/web3Saga' |
|
|
import { getNetworkInfo, initializeWeb3 } from '../web3/web3Saga' |
|
|
import { getAccounts } from '../accounts/accountsSaga' |
|
|
import { getAccounts } from '../accounts/accountsSaga' |
|
|
import { getAccountBalances } from '../accountBalances/accountBalancesSaga' |
|
|
import { getAccountBalances } from '../accountBalances/accountBalancesSaga' |
|
|
import * as DrizzleActions from './drizzleActions' |
|
|
import * as DrizzleActions from './drizzleActions' |
|
|
import * as BlocksActions from '../blocks/blockActions' |
|
|
import * as BlocksActions from '../blocks/blockActions' |
|
|
|
|
|
|
|
|
import { NETWORK_IDS, NETWORK_MISMATCH } from '../web3/web3Actions' |
|
|
import { NETWORK_IDS, WEB3_NETWORK_MISMATCH } from '../web3/web3Actions' |
|
|
import { CONTRACT_NOT_DEPLOYED } from '../contracts/constants' |
|
|
import { CONTRACT_NOT_DEPLOYED } from '../contracts/constants' |
|
|
import { isContractDeployed } from '../contracts/contractsSaga' |
|
|
import { isContractDeployed } from '../contracts/contractsSaga' |
|
|
|
|
|
|
|
@ -23,14 +23,14 @@ export function * initializeDrizzle (action) { |
|
|
// further web3 interaction, and note web3 will be undefined
|
|
|
// further web3 interaction, and note web3 will be undefined
|
|
|
//
|
|
|
//
|
|
|
if (web3) { |
|
|
if (web3) { |
|
|
const networkId = yield call(getNetworkId, { web3 }) |
|
|
const networkId = yield call(getNetworkInfo, { web3 }) |
|
|
|
|
|
|
|
|
// Check whether network is allowed
|
|
|
// Check whether network is allowed
|
|
|
const networkWhitelist = options.networkWhitelist |
|
|
const networkWhitelist = options.networkWhitelist |
|
|
if (networkWhitelist.length && |
|
|
if (networkWhitelist.length && |
|
|
networkId !== NETWORK_IDS.ganache && |
|
|
networkId !== NETWORK_IDS.ganache && |
|
|
!networkWhitelist.includes(networkId)) { |
|
|
!networkWhitelist.includes(networkId)) { |
|
|
yield put({ type: NETWORK_MISMATCH, networkId }) |
|
|
yield put({ type: WEB3_NETWORK_MISMATCH, networkId }) |
|
|
} else { |
|
|
} else { |
|
|
// Get initial accounts list and balances.
|
|
|
// Get initial accounts list and balances.
|
|
|
yield call(getAccounts, { web3 }) |
|
|
yield call(getAccounts, { web3 }) |