Skip to content

Commit 3214e76

Browse files
committed
add setTimeout
1 parent 466f9e4 commit 3214e76

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

apps/remix-ide/src/app/tabs/web3-provider.js

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,15 @@ export class Web3ProviderModule extends Plugin {
2828
if (error) return reject(error)
2929
if (payload.method === 'eth_sendTransaction') {
3030
if (payload.params.length && !payload.params[0].to && message.result) {
31-
const receipt = await this.tryTillReceiptAvailable(message.result)
32-
const contractData = await this.call('compilerArtefacts', 'getContractDataFromAddress', receipt.contractAddress)
33-
if (contractData) this.call('udapp', 'addInstance', receipt.contractAddress, contractData.contract.abi, contractData.name)
31+
setTimeout(async () => {
32+
const receipt = await this.tryTillReceiptAvailable(message.result)
33+
if (!receipt.contractAddress) {
34+
console.log('receipt available but contract address not present', receipt)
35+
return
36+
}
37+
const contractData = await this.call('compilerArtefacts', 'getContractDataFromAddress', receipt.contractAddress)
38+
if (contractData) this.call('udapp', 'addInstance', receipt.contractAddress, contractData.contract.abi, contractData.name)
39+
}, 50)
3440
}
3541
}
3642
resolve(message)
@@ -42,7 +48,7 @@ export class Web3ProviderModule extends Plugin {
4248
try {
4349
const receipt = await this.call('blockchain', 'getTransactionReceipt', txhash)
4450
if (receipt) return receipt
45-
} catch (e) {} // eslint-disable-line
51+
} catch (e) {}
4652
await this.pause()
4753
return await this.tryTillReceiptAvailable(txhash)
4854
}

0 commit comments

Comments
 (0)