Fix fetching token data, next one: gnosisSafe.getThresold is not a function
This commit is contained in:
parent
659eb9e48c
commit
866d2a57cb
|
@ -44,7 +44,7 @@ export const getWeb3 = () => web3 || new Web3(window.web3.currentProvider)
|
||||||
|
|
||||||
const isMetamask: Function = (web3Provider): boolean => {
|
const isMetamask: Function = (web3Provider): boolean => {
|
||||||
const isMetamaskConstructor = web3Provider.currentProvider.constructor.name === 'MetamaskInpageProvider'
|
const isMetamaskConstructor = web3Provider.currentProvider.constructor.name === 'MetamaskInpageProvider'
|
||||||
console.log(web3Provider)
|
|
||||||
return isMetamaskConstructor || web3Provider.currentProvider.isMetaMask
|
return isMetamaskConstructor || web3Provider.currentProvider.isMetaMask
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -56,7 +56,7 @@ const getAccountFrom: Function = async (web3Provider): Promise<string | null> =>
|
||||||
|
|
||||||
const getNetworkIdFrom = async (web3Provider) => {
|
const getNetworkIdFrom = async (web3Provider) => {
|
||||||
const networkId = await web3Provider.eth.net.getId()
|
const networkId = await web3Provider.eth.net.getId()
|
||||||
console.log(networkId)
|
|
||||||
return networkId
|
return networkId
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -91,8 +91,8 @@ export const getProviderInfo: Function = async (): Promise<ProviderProps> => {
|
||||||
}
|
}
|
||||||
|
|
||||||
export const getBalanceInEtherOf = async (safeAddress: string) => {
|
export const getBalanceInEtherOf = async (safeAddress: string) => {
|
||||||
const funds: BigNumber = await promisify(cb => web3.eth.getBalance(safeAddress, cb))
|
const funds: BigNumber = await web3.eth.getBalance(safeAddress)
|
||||||
if (!funds) {
|
if (!funds || funds === '0') {
|
||||||
return '0'
|
return '0'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,9 @@
|
||||||
import * as React from 'react'
|
import * as React from 'react'
|
||||||
import { connect } from 'react-redux'
|
import { connect } from 'react-redux'
|
||||||
import Page from '~/components/layout/Page'
|
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 { getWeb3 } from '~/logic/wallets/getWeb3'
|
||||||
import { getGnosisSafeContract, deploySafeContract, initContracts } from '~/logic/contracts/safeContracts'
|
import { getGnosisSafeContract, deploySafeContract, initContracts } from '~/logic/contracts/safeContracts'
|
||||||
import { checkReceiptStatus } from '~/logic/wallets/ethTransactions'
|
import { checkReceiptStatus } from '~/logic/wallets/ethTransactions'
|
||||||
|
@ -34,11 +36,9 @@ export const createSafe = async (values: Object, userAccount: string, addSafe: A
|
||||||
await initContracts()
|
await initContracts()
|
||||||
const safe = await deploySafeContract(accounts, numConfirmations, userAccount)
|
const safe = await deploySafeContract(accounts, numConfirmations, userAccount)
|
||||||
checkReceiptStatus(safe.tx)
|
checkReceiptStatus(safe.tx)
|
||||||
console.log(safe)
|
|
||||||
const param = safe.logs[0].args.proxy
|
const param = safe.logs[0].args.proxy
|
||||||
console.log(param)
|
|
||||||
const safeContract = await GnosisSafe.at(param)
|
const safeContract = await GnosisSafe.at(param)
|
||||||
console.log(safeContract)
|
|
||||||
|
|
||||||
addSafe(name, safeContract.address, numConfirmations, owners, accounts)
|
addSafe(name, safeContract.address, numConfirmations, owners, accounts)
|
||||||
|
|
||||||
|
@ -66,7 +66,7 @@ class Open extends React.Component<Props> {
|
||||||
history.push(OPENING_ADDRESS)
|
history.push(OPENING_ADDRESS)
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
// eslint-disable-next-line
|
// eslint-disable-next-line
|
||||||
console.log('Error while creating the Safe' + error)
|
console.error('Error while creating the Safe: ' + error)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -42,7 +42,7 @@ export default (safeAddress: string) => async (dispatch: ReduxDispatch<GlobalSta
|
||||||
return dispatch(updateSafe(safeRecord))
|
return dispatch(updateSafe(safeRecord))
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
// eslint-disable-next-line
|
// eslint-disable-next-line
|
||||||
console.log("Error while updating safe information")
|
console.error("Error while updating safe information: ", err)
|
||||||
|
|
||||||
return Promise.resolve()
|
return Promise.resolve()
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,7 +51,7 @@ export const fetchTokens = (safeAddress: string) => async (dispatch: ReduxDispat
|
||||||
const tokens: List<string> = getActiveTokenAddresses(safeAddress)
|
const tokens: List<string> = getActiveTokenAddresses(safeAddress)
|
||||||
const ethBalance = await getSafeEthToken(safeAddress)
|
const ethBalance = await getSafeEthToken(safeAddress)
|
||||||
const customTokens = getTokens(safeAddress)
|
const customTokens = getTokens(safeAddress)
|
||||||
const json = await exports.fetchTokensData()
|
const json = await fetchTokensData()
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const balancesRecords = await Promise.all(
|
const balancesRecords = await Promise.all(
|
||||||
|
|
Loading…
Reference in New Issue