Add default provider for node
This commit is contained in:
parent
a7e69683a3
commit
7fe182db3c
|
@ -64,7 +64,7 @@ export const getInfuraUrl = () => {
|
||||||
export const web3ReadOnly =
|
export const web3ReadOnly =
|
||||||
process.env.NODE_ENV !== 'test'
|
process.env.NODE_ENV !== 'test'
|
||||||
? new Web3(new Web3.providers.HttpProvider(getInfuraUrl()))
|
? new Web3(new Web3.providers.HttpProvider(getInfuraUrl()))
|
||||||
: new Web3((window as any).web3.currentProvider)
|
: new Web3((window as any).web3?.currentProvider || 'ws://localhost:8545')
|
||||||
|
|
||||||
let web3 = web3ReadOnly
|
let web3 = web3ReadOnly
|
||||||
export const getWeb3 = () => web3
|
export const getWeb3 = () => web3
|
||||||
|
|
|
@ -72,7 +72,7 @@ export const aMinedSafe = async (
|
||||||
threshold = 1,
|
threshold = 1,
|
||||||
name = 'Safe Name',
|
name = 'Safe Name',
|
||||||
) => {
|
) => {
|
||||||
const provider = await getProviderInfo((window as any).web3.currentProvider)
|
const provider = await getProviderInfo((window as any).web3?.currentProvider || 'ws://localhost:8545')
|
||||||
const walletRecord = makeProvider(provider)
|
const walletRecord = makeProvider(provider)
|
||||||
store.dispatch(addProvider(walletRecord))
|
store.dispatch(addProvider(walletRecord))
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@ import { ConnectedRouter } from 'connected-react-router'
|
||||||
import Load from 'src/routes/load/container/Load'
|
import Load from 'src/routes/load/container/Load'
|
||||||
import { aNewStore, history, } from 'src/store'
|
import { aNewStore, history, } from 'src/store'
|
||||||
import { sleep } from 'src/utils/timer'
|
import { sleep } from 'src/utils/timer'
|
||||||
import { getProviderInfo } from 'src/logic/wallets/getWeb3'
|
import { getProviderInfo, getWeb3 } from 'src/logic/wallets/getWeb3'
|
||||||
import addProvider from 'src/logic/wallets/store/actions/addProvider'
|
import addProvider from 'src/logic/wallets/store/actions/addProvider'
|
||||||
import { makeProvider } from 'src/logic/wallets/store/model/provider'
|
import { makeProvider } from 'src/logic/wallets/store/model/provider'
|
||||||
import { aMinedSafe } from './builder/safe.redux.builder'
|
import { aMinedSafe } from './builder/safe.redux.builder'
|
||||||
|
@ -29,7 +29,7 @@ afterAll(() => {
|
||||||
})
|
})
|
||||||
|
|
||||||
const renderLoadSafe = async (localStore) => {
|
const renderLoadSafe = async (localStore) => {
|
||||||
const provider = await getProviderInfo((window as any).web3.currentProvider)
|
const provider = await getProviderInfo((window as any).web3.currentProvider || 'ws://localhost:8545')
|
||||||
const walletRecord = makeProvider(provider)
|
const walletRecord = makeProvider(provider)
|
||||||
localStore.dispatch(addProvider(walletRecord))
|
localStore.dispatch(addProvider(walletRecord))
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue