Fix fetching token data, next one: gnosisSafe.getThresold is not a function

This commit is contained in:
mmv 2019-03-11 15:29:50 +04:00
parent 659eb9e48c
commit 866d2a57cb
4 changed files with 11 additions and 11 deletions

View File

@ -44,7 +44,7 @@ export const getWeb3 = () => web3 || new Web3(window.web3.currentProvider)
const isMetamask: Function = (web3Provider): boolean => {
const isMetamaskConstructor = web3Provider.currentProvider.constructor.name === 'MetamaskInpageProvider'
console.log(web3Provider)
return isMetamaskConstructor || web3Provider.currentProvider.isMetaMask
}
@ -56,7 +56,7 @@ const getAccountFrom: Function = async (web3Provider): Promise<string | null> =>
const getNetworkIdFrom = async (web3Provider) => {
const networkId = await web3Provider.eth.net.getId()
console.log(networkId)
return networkId
}
@ -91,8 +91,8 @@ export const getProviderInfo: Function = async (): Promise<ProviderProps> => {
}
export const getBalanceInEtherOf = async (safeAddress: string) => {
const funds: BigNumber = await promisify(cb => web3.eth.getBalance(safeAddress, cb))
if (!funds) {
const funds: BigNumber = await web3.eth.getBalance(safeAddress)
if (!funds || funds === '0') {
return '0'
}

View File

@ -2,7 +2,9 @@
import * as React from 'react'
import { connect } from 'react-redux'
import Page from '~/components/layout/Page'
import { getAccountsFrom, getThresholdFrom, getNamesFrom, getSafeNameFrom } from '~/routes/open/utils/safeDataExtractor'
import {
getAccountsFrom, getThresholdFrom, getNamesFrom, getSafeNameFrom,
} from '~/routes/open/utils/safeDataExtractor'
import { getWeb3 } from '~/logic/wallets/getWeb3'
import { getGnosisSafeContract, deploySafeContract, initContracts } from '~/logic/contracts/safeContracts'
import { checkReceiptStatus } from '~/logic/wallets/ethTransactions'
@ -34,11 +36,9 @@ export const createSafe = async (values: Object, userAccount: string, addSafe: A
await initContracts()
const safe = await deploySafeContract(accounts, numConfirmations, userAccount)
checkReceiptStatus(safe.tx)
console.log(safe)
const param = safe.logs[0].args.proxy
console.log(param)
const safeContract = await GnosisSafe.at(param)
console.log(safeContract)
addSafe(name, safeContract.address, numConfirmations, owners, accounts)
@ -66,7 +66,7 @@ class Open extends React.Component<Props> {
history.push(OPENING_ADDRESS)
} catch (error) {
// eslint-disable-next-line
console.log('Error while creating the Safe' + error)
console.error('Error while creating the Safe: ' + error)
}
}

View File

@ -42,7 +42,7 @@ export default (safeAddress: string) => async (dispatch: ReduxDispatch<GlobalSta
return dispatch(updateSafe(safeRecord))
} catch (err) {
// eslint-disable-next-line
console.log("Error while updating safe information")
console.error("Error while updating safe information: ", err)
return Promise.resolve()
}

View File

@ -51,7 +51,7 @@ export const fetchTokens = (safeAddress: string) => async (dispatch: ReduxDispat
const tokens: List<string> = getActiveTokenAddresses(safeAddress)
const ethBalance = await getSafeEthToken(safeAddress)
const customTokens = getTokens(safeAddress)
const json = await exports.fetchTokensData()
const json = await fetchTokensData()
try {
const balancesRecords = await Promise.all(