contine polling if contract address not available

pull/4201/head
yann300 1 year ago committed by Aniket
parent 8c9093603c
commit 8d1e0c70ce
  1. 12
      libs/remix-lib/src/execution/txRunnerWeb3.ts

@ -175,16 +175,22 @@ export class TxRunnerWeb3 {
} }
} }
async function tryTillReceiptAvailable (txhash, web3) { async function tryTillReceiptAvailable (txhash: string, web3: Web3) {
try { try {
const receipt = await web3.eth.getTransactionReceipt(txhash) const receipt = await web3.eth.getTransactionReceipt(txhash)
if (receipt) return receipt if (receipt) {
if (!receipt.to && !receipt.contractAddress) {
// this is a contract creation and the receipt doesn't contain a contract address. we have to keep polling...
console.log('this is a contract creation and the receipt does nott contain a contract address. we have to keep polling...')
} else
return receipt
}
} catch (e) {} } catch (e) {}
await pause() await pause()
return await tryTillReceiptAvailable(txhash, web3) return await tryTillReceiptAvailable(txhash, web3)
} }
async function tryTillTxAvailable (txhash, web3) { async function tryTillTxAvailable (txhash: string, web3: Web3) {
try { try {
const tx = await web3.eth.getTransaction(txhash) const tx = await web3.eth.getTransaction(txhash)
if (tx && tx.blockHash) return tx if (tx && tx.blockHash) return tx

Loading…
Cancel
Save