fix safe loading by awaiting .at function
This commit is contained in:
parent
aad76abaee
commit
2593b8a765
|
@ -76,7 +76,7 @@ export const deploySafeContract = async (safeAccounts: string[], numConfirmation
|
||||||
export const getGnosisSafeInstanceAt = async (safeAddress: string) => {
|
export const getGnosisSafeInstanceAt = async (safeAddress: string) => {
|
||||||
const web3 = getWeb3()
|
const web3 = getWeb3()
|
||||||
const GnosisSafe = await getGnosisSafeContract(web3)
|
const GnosisSafe = await getGnosisSafeContract(web3)
|
||||||
const gnosisSafe = GnosisSafe.at(safeAddress)
|
const gnosisSafe = await GnosisSafe.at(safeAddress)
|
||||||
|
|
||||||
return gnosisSafe
|
return gnosisSafe
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,7 +26,8 @@ const hasOneOwner = (safe: Safe) => {
|
||||||
export const getSafeEthereumInstance = async (safeAddress: string) => {
|
export const getSafeEthereumInstance = async (safeAddress: string) => {
|
||||||
const web3 = getWeb3()
|
const web3 = getWeb3()
|
||||||
const GnosisSafe = await getGnosisSafeContract(web3)
|
const GnosisSafe = await getGnosisSafeContract(web3)
|
||||||
return GnosisSafe.at(safeAddress)
|
const safeInstance = await GnosisSafe.at(safeAddress)
|
||||||
|
return safeInstance
|
||||||
}
|
}
|
||||||
|
|
||||||
export const createTransaction = async (
|
export const createTransaction = async (
|
||||||
|
|
|
@ -47,7 +47,7 @@ export const safeFieldsValidation = async (values: Object) => {
|
||||||
// https://solidity.readthedocs.io/en/latest/metadata.html#usage-for-source-code-verification
|
// https://solidity.readthedocs.io/en/latest/metadata.html#usage-for-source-code-verification
|
||||||
const metaData = 'a165'
|
const metaData = 'a165'
|
||||||
|
|
||||||
const code = await promisify(cb => web3.eth.getCode(safeAddress, cb))
|
const code = await web3.eth.getCode(safeAddress)
|
||||||
const codeWithoutMetadata = code.substring(0, code.lastIndexOf(metaData))
|
const codeWithoutMetadata = code.substring(0, code.lastIndexOf(metaData))
|
||||||
|
|
||||||
const proxyCode = SafeProxy.deployedBytecode
|
const proxyCode = SafeProxy.deployedBytecode
|
||||||
|
@ -63,7 +63,7 @@ export const safeFieldsValidation = async (values: Object) => {
|
||||||
// check mastercopy
|
// check mastercopy
|
||||||
const proxy = contract(SafeProxy)
|
const proxy = contract(SafeProxy)
|
||||||
proxy.setProvider(web3.currentProvider)
|
proxy.setProvider(web3.currentProvider)
|
||||||
const proxyInstance = proxy.at(safeAddress)
|
const proxyInstance = await proxy.at(safeAddress)
|
||||||
const proxyImplementation = await proxyInstance.implementation()
|
const proxyImplementation = await proxyInstance.implementation()
|
||||||
|
|
||||||
const safeMaster = await getSafeMasterContract()
|
const safeMaster = await getSafeMasterContract()
|
||||||
|
|
|
@ -62,6 +62,8 @@ class ReviewComponent extends React.PureComponent<Props, State> {
|
||||||
isOwner: false,
|
isOwner: false,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mounted = false
|
||||||
|
|
||||||
componentDidMount = async () => {
|
componentDidMount = async () => {
|
||||||
this.mounted = true
|
this.mounted = true
|
||||||
|
|
||||||
|
@ -70,7 +72,7 @@ class ReviewComponent extends React.PureComponent<Props, State> {
|
||||||
const web3 = getWeb3()
|
const web3 = getWeb3()
|
||||||
|
|
||||||
const GnosisSafe = getGnosisSafeContract(web3)
|
const GnosisSafe = getGnosisSafeContract(web3)
|
||||||
const gnosisSafe = GnosisSafe.at(safeAddress)
|
const gnosisSafe = await GnosisSafe.at(safeAddress)
|
||||||
const owners = await gnosisSafe.getOwners()
|
const owners = await gnosisSafe.getOwners()
|
||||||
if (!owners) {
|
if (!owners) {
|
||||||
return
|
return
|
||||||
|
@ -86,8 +88,6 @@ class ReviewComponent extends React.PureComponent<Props, State> {
|
||||||
this.mounted = false
|
this.mounted = false
|
||||||
}
|
}
|
||||||
|
|
||||||
mounted = false
|
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { values, classes, network } = this.props
|
const { values, classes, network } = this.props
|
||||||
const { isOwner } = this.state
|
const { isOwner } = this.state
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
// @flow
|
// @flow
|
||||||
export const FIELD_LOAD_NAME: string = 'name'
|
export const FIELD_LOAD_NAME: string = 'name'
|
||||||
export const FIELD_LOAD_ADDRESS: string = 'address'
|
export const FIELD_LOAD_ADDRESS: string = 'address'
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue