|
|
|
@ -28,7 +28,7 @@ export class Web3ProviderModule extends Plugin { |
|
|
|
|
if (error) return reject(error) |
|
|
|
|
if (payload.method === 'eth_sendTransaction') { |
|
|
|
|
if (payload.params.length && !payload.params[0].to && message.result) { |
|
|
|
|
const receipt = await this.call('blockchain', 'getTransactionReceipt', message.result) |
|
|
|
|
const receipt = await this.tryTillReceiptAvailable(message.result) |
|
|
|
|
const contractData = await this.call('compilerArtefacts', 'getContractDataFromAddress', receipt.contractAddress) |
|
|
|
|
if (contractData) this.call('udapp', 'addInstance', receipt.contractAddress, contractData.contract.abi, contractData.name) |
|
|
|
|
} |
|
|
|
@ -37,4 +37,19 @@ export class Web3ProviderModule extends Plugin { |
|
|
|
|
}) |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
async tryTillReceiptAvailable (txhash) { |
|
|
|
|
try { |
|
|
|
|
const receipt = await this.call('blockchain', 'getTransactionReceipt', txhash) |
|
|
|
|
if (receipt) return receipt |
|
|
|
|
} catch (e) {} |
|
|
|
|
await this.pause() |
|
|
|
|
return await this.tryTillReceiptAvailable(txhash) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
async pause () {
|
|
|
|
|
return new Promise((resolve, reject) => {
|
|
|
|
|
setTimeout(resolve, 500)
|
|
|
|
|
})
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|