|
|
@ -118,21 +118,13 @@ class Blockchain { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
this.runTx({ data: data, useCall: false }, confirmationCb, continueCb, promptCb, |
|
|
|
this.runTx({ data: data, useCall: false }, confirmationCb, continueCb, promptCb, |
|
|
|
(error, txResult) => { |
|
|
|
(error, txResult, address) => { |
|
|
|
if (error) { |
|
|
|
if (error) { |
|
|
|
return finalCb(`creation of ${selectedContract.name} errored: ${error}`) |
|
|
|
return finalCb(`creation of ${selectedContract.name} errored: ${error}`) |
|
|
|
} |
|
|
|
} |
|
|
|
const isVM = this.executionContext.isVM() |
|
|
|
|
|
|
|
if (isVM) { |
|
|
|
|
|
|
|
const vmError = txExecution.checkVMError(txResult) |
|
|
|
|
|
|
|
if (vmError.error) { |
|
|
|
|
|
|
|
return finalCb(vmError.message) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (txResult.result.status && txResult.result.status === '0x0') { |
|
|
|
if (txResult.result.status && txResult.result.status === '0x0') { |
|
|
|
return finalCb(`creation of ${selectedContract.name} errored: transaction execution failed`) |
|
|
|
return finalCb(`creation of ${selectedContract.name} errored: transaction execution failed`) |
|
|
|
} |
|
|
|
} |
|
|
|
const address = isVM ? txResult.result.createdAddress : txResult.result.contractAddress |
|
|
|
|
|
|
|
finalCb(null, selectedContract, address) |
|
|
|
finalCb(null, selectedContract, address) |
|
|
|
} |
|
|
|
} |
|
|
|
) |
|
|
|
) |
|
|
@ -360,18 +352,7 @@ class Blockchain { |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
callFunction (to, data, funAbi, confirmationCb, continueCb, promptCb, callback) { |
|
|
|
callFunction (to, data, funAbi, confirmationCb, continueCb, promptCb, callback) { |
|
|
|
const useCall = funAbi.stateMutability === 'view' || funAbi.stateMutability === 'pure' |
|
|
|
const useCall = funAbi.stateMutability === 'view' || funAbi.stateMutability === 'pure' |
|
|
|
this.runTx({to, data, useCall}, confirmationCb, continueCb, promptCb, (error, txResult) => { |
|
|
|
this.runTx({to, data, useCall}, confirmationCb, continueCb, promptCb, callback) |
|
|
|
const isVM = this.executionContext.isVM() |
|
|
|
|
|
|
|
if (isVM) { |
|
|
|
|
|
|
|
const vmError = txExecution.checkVMError(txResult) |
|
|
|
|
|
|
|
if (vmError.error) { |
|
|
|
|
|
|
|
return callback(vmError.message) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// see universaldapp.js line 660 => 700 to check possible values of txResult (error case)
|
|
|
|
|
|
|
|
callback(error, txResult) |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
@ -470,7 +451,23 @@ class Blockchain { |
|
|
|
} |
|
|
|
} |
|
|
|
) |
|
|
|
) |
|
|
|
} |
|
|
|
} |
|
|
|
], cb) |
|
|
|
], |
|
|
|
|
|
|
|
(error, txResult) => { |
|
|
|
|
|
|
|
const isVM = this.executionContext.isVM() |
|
|
|
|
|
|
|
if (isVM) { |
|
|
|
|
|
|
|
const vmError = txExecution.checkVMError(txResult) |
|
|
|
|
|
|
|
if (vmError.error) { |
|
|
|
|
|
|
|
return cb(vmError.message) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let address = null |
|
|
|
|
|
|
|
if (txResult && txResult.result) { |
|
|
|
|
|
|
|
address = isVM ? txResult.result.createdAddress : txResult.result.contractAddress |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
cb(error, txResult, address) |
|
|
|
|
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|