Trying to update web3, wip commit

This commit is contained in:
mmv 2019-03-07 18:21:16 +04:00
parent 5f91761f8e
commit 7dff751e1e
5 changed files with 337 additions and 30188 deletions

29832
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -110,7 +110,6 @@
"truffle-contract": "^4.0.7", "truffle-contract": "^4.0.7",
"truffle-solidity-loader": "^0.1.6", "truffle-solidity-loader": "^0.1.6",
"uglifyjs-webpack-plugin": "^2.1.2", "uglifyjs-webpack-plugin": "^2.1.2",
"web3": "^0.20.7",
"webpack": "^4.1.1", "webpack": "^4.1.1",
"webpack-bundle-analyzer": "^3.1.0", "webpack-bundle-analyzer": "^3.1.0",
"webpack-cli": "^3.2.3", "webpack-cli": "^3.2.3",
@ -128,7 +127,8 @@
"react-final-form": "^4.1.0", "react-final-form": "^4.1.0",
"react-loadable": "^5.3.1", "react-loadable": "^5.3.1",
"react-router-dom": "^4.2.2", "react-router-dom": "^4.2.2",
"recompose": "^0.30.0" "recompose": "^0.30.0",
"web3": "1.0.0-beta.48"
}, },
"jest": { "jest": {
"verbose": true, "verbose": true,

View File

@ -65,8 +65,9 @@ export const deploySafeContract = async (
numConfirmations: number, numConfirmations: number,
userAccount: string, userAccount: string,
) => { ) => {
const gnosisSafeData = await safeMaster.contract.setup.getData(safeAccounts, numConfirmations, 0, '0x') console.log(safeMaster)
const proxyFactoryData = proxyFactoryMaster.contract.createProxy.getData(safeMaster.address, gnosisSafeData) const gnosisSafeData = await safeMaster.setup(safeAccounts, numConfirmations, 0, '0x').encodeABI()
const proxyFactoryData = proxyFactoryMaster.createProxy(safeMaster.address, gnosisSafeData).encodeABI()
const gas = await calculateGasOf(proxyFactoryData, userAccount, proxyFactoryMaster.address) const gas = await calculateGasOf(proxyFactoryData, userAccount, proxyFactoryMaster.address)
const gasPrice = await calculateGasPrice() const gasPrice = await calculateGasPrice()

View File

@ -44,18 +44,18 @@ 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
} }
const getAccountFrom: Function = async (web3Provider): Promise<string | null> => { const getAccountFrom: Function = async (web3Provider): Promise<string | null> => {
const accounts = await promisify(cb => web3Provider.eth.getAccounts(cb)) const accounts = await web3Provider.eth.getAccounts()
return accounts && accounts.length > 0 ? accounts[0] : null return accounts && accounts.length > 0 ? accounts[0] : null
} }
const getNetworkIdFrom = async (web3Provider) => { const getNetworkIdFrom = async (web3Provider) => {
const networkId = await promisify(cb => web3Provider.version.getNetwork(cb)) const networkId = await web3Provider.eth.net.getId()
return networkId return networkId
} }
@ -75,7 +75,7 @@ export const getProviderInfo: Function = async (): Promise<ProviderProps> => {
console.log('Injected web3 detected.') console.log('Injected web3 detected.')
} }
const name = isMetamask(web3) ? WALLET_PROVIDER.METAMASK : 'UNKNOWN' const name = isMetamask(window.web3) ? WALLET_PROVIDER.METAMASK : 'UNKNOWN'
const account = await getAccountFrom(web3) const account = await getAccountFrom(web3)
const network = await getNetworkIdFrom(web3) const network = await getNetworkIdFrom(web3)

676
yarn.lock

File diff suppressed because it is too large Load Diff