|
|
|
@ -779,46 +779,42 @@ export class Blockchain extends Plugin { |
|
|
|
|
*/ |
|
|
|
|
sendTransaction(tx: Transaction) { |
|
|
|
|
return new Promise((resolve, reject) => { |
|
|
|
|
return this.transactionContextAPI.getGasLimit((err, value) => { |
|
|
|
|
if (err) console.log('error resolving gas limit', err); |
|
|
|
|
else { |
|
|
|
|
tx.gasLimit = value; |
|
|
|
|
this.executionContext.detectNetwork((error, network) => { |
|
|
|
|
tx.gasLimit = '0x0' // force using gas estimation
|
|
|
|
|
|
|
|
|
|
if (error) return reject(error) |
|
|
|
|
if (network.name === 'Main' && network.id === '1') { |
|
|
|
|
return reject(new Error('It is not allowed to make this action against mainnet')) |
|
|
|
|
} |
|
|
|
|
this.executionContext.detectNetwork((error, network) => { |
|
|
|
|
if (error) return reject(error) |
|
|
|
|
if (network.name === 'Main' && network.id === '1') { |
|
|
|
|
return reject(new Error('It is not allowed to make this action against mainnet')) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
this.txRunner.rawRun( |
|
|
|
|
tx, |
|
|
|
|
(network, tx, gasEstimation, continueTxExecution, cancelCb) => { |
|
|
|
|
|
|
|
|
|
this.txRunner.rawRun( |
|
|
|
|
tx, |
|
|
|
|
(network, tx, gasEstimation, continueTxExecution, cancelCb) => { |
|
|
|
|
continueTxExecution() |
|
|
|
|
}, |
|
|
|
|
(error, continueTxExecution, cancelCb) => { |
|
|
|
|
if (error) { |
|
|
|
|
reject(error) |
|
|
|
|
} else { |
|
|
|
|
continueTxExecution() |
|
|
|
|
}, |
|
|
|
|
(error, continueTxExecution, cancelCb) => { |
|
|
|
|
if (error) { |
|
|
|
|
reject(error) |
|
|
|
|
} else { |
|
|
|
|
continueTxExecution() |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
(okCb, cancelCb) => { |
|
|
|
|
okCb() |
|
|
|
|
}, |
|
|
|
|
async (error, result) => { |
|
|
|
|
if (error) return reject(error) |
|
|
|
|
try { |
|
|
|
|
if (this.executionContext.isVM()) { |
|
|
|
|
const execResult = await this.web3().remix.getExecutionResultFromSimulator(result.transactionHash) |
|
|
|
|
resolve(resultToRemixTx(result, execResult)) |
|
|
|
|
} else resolve(resultToRemixTx(result)) |
|
|
|
|
} catch (e) { |
|
|
|
|
reject(e) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
) |
|
|
|
|
}) |
|
|
|
|
})
|
|
|
|
|
}, |
|
|
|
|
(okCb, cancelCb) => { |
|
|
|
|
okCb() |
|
|
|
|
}, |
|
|
|
|
async (error, result) => { |
|
|
|
|
if (error) return reject(error) |
|
|
|
|
try { |
|
|
|
|
if (this.executionContext.isVM()) { |
|
|
|
|
const execResult = await this.web3().remix.getExecutionResultFromSimulator(result.transactionHash) |
|
|
|
|
resolve(resultToRemixTx(result, execResult)) |
|
|
|
|
} else resolve(resultToRemixTx(result)) |
|
|
|
|
} catch (e) { |
|
|
|
|
reject(e) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
) |
|
|
|
|
})
|
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|